Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

1
engines/gnap/POTFILES Normal file
View File

@@ -0,0 +1 @@
engines/gnap/menu.cpp

1408
engines/gnap/character.cpp Normal file

File diff suppressed because it is too large Load Diff

145
engines/gnap/character.h Normal file
View File

@@ -0,0 +1,145 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_CHARACTER_H
#define GNAP_CHARACTER_H
namespace Gnap {
class GnapEngine;
enum Facing {
kDirIdleLeft = 0,
kDirBottomRight = 1,
kDirBottomLeft = 3,
kDirIdleRight = 4,
kDirUpLeft = 5,
kDirUpRight = 7
};
struct GridStruct {
int _deltaX, _deltaY;
int _gridX1, _gridY1;
int _sequenceId;
int _id;
};
const int kMaxGridStructs = 30;
class Character {
public:
Character(GnapEngine *vm);
virtual ~Character();
void walkStep();
virtual int getSequenceId(int kind, Common::Point gridPos) = 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;
int _actionStatus;
int _sequenceId;
int _sequenceDatNum;
int _id;
int _gridX;
int _gridY;
int _walkNodesCount;
GridStruct _walkNodes[kMaxGridStructs];
int _walkDestX, _walkDestY;
int _walkDeltaX, _walkDeltaY, _walkDirX, _walkDirY, _walkDirXIncr, _walkDirYIncr;
protected:
GnapEngine *_vm;
};
class PlayerGnap : public Character {
public:
PlayerGnap(GnapEngine *vm);
int getSequenceId(int kind, Common::Point gridPos) override;
void initPos(int gridX, int gridY, Facing facing) override;
void playSequence(int sequenceId) override;
void updateIdleSequence() override;
void updateIdleSequence2() override;
int getWalkSequenceId(int deltaX, int deltaY) override;
bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) override;
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);
void idle();
void initBrainPulseRndValue();
void kissPlatypus(int callback);
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(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(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(Common::Point gridPos = Common::Point(0, 0));
void useDeviceOnPlatypus();
void useDisguiseOnPlatypus();
void useJointOnPlatypus();
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 {
public:
PlayerPlat(GnapEngine *vm);
~PlayerPlat() override {}
int getSequenceId(int kind = 0, Common::Point gridPos = Common::Point(0, 0)) override;
void initPos(int gridX, int gridY, Facing facing) override;
void playSequence(int sequenceId) override;
void updateIdleSequence() override;
void updateIdleSequence2() override;
int getWalkSequenceId(int deltaX, int deltaY) override;
bool walkTo(Common::Point gridPos, int animationIndex, int sequenceId, int flags) override;
void makeRoom();
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
#endif // GNAP_CHARACTER_H

View File

@@ -0,0 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
add_engine gnap "UFOs" yes "" "" "highres 16bit" "midi"

4
engines/gnap/credits.pl Normal file
View File

@@ -0,0 +1,4 @@
begin_section("Gnap");
add_person("Arnaud Boutonn&eacute;", "Strangerke", "");
add_person("Benjamin Haisch", "john_doe", "");
end_section();

122
engines/gnap/datarchive.cpp Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/compression/dcl.h"
#include "common/file.h"
#include "common/stream.h"
#include "common/substream.h"
#include "gnap/gnap.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();
debugC(kDebugBasic, "_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);
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);
return buffer;
}
// DatManager
DatManager::DatManager() {
for (int i = 0; i < kMaxDatArchives; ++i)
_datArchives[i] = nullptr;
}
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] = nullptr;
}
byte *DatManager::loadResource(int resourceId) {
const int datIndex = ridToDatIndex(resourceId);
const int entryIndex = ridToEntryIndex(resourceId);
return _datArchives[datIndex] ? _datArchives[datIndex]->load(entryIndex) : nullptr;
}
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

79
engines/gnap/datarchive.h Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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

41
engines/gnap/debugger.cpp Normal file
View File

@@ -0,0 +1,41 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "gnap/debugger.h"
#include "gnap/gnap.h"
namespace Gnap {
Debugger::Debugger() : GUI::Debugger() {
// 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

51
engines/gnap/debugger.h Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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 {
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();
~Debugger() override {}
};
} // End of namespace Gnap
#endif

103
engines/gnap/detection.cpp Normal file
View File

@@ -0,0 +1,103 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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", "U.F.O.s" },
{ nullptr, nullptr }
};
static const DebugChannelDef debugFlagList[] = {
{Gnap::kDebugBasic, "basic", "Basic debug level"},
DEBUG_CHANNEL_END
};
namespace Gnap {
static const ADGameDescription gameDescriptions[] = {
{
"gnap", "",
AD_ENTRY1s("stock_n.dat", "46819043d019a2f36b727cc2bdd6980f", 12515823),
Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "",
AD_ENTRY1s("stock_n.dat", "46819043d019a2f36b727cc2bdd6980f", 13497301),
Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{ // Bugreport #11404
"gnap", "",
AD_ENTRY1s("stock_n.dat", "46819043d019a2f36b727cc2bdd6980f", 13035286),
Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "",
AD_ENTRY1s("stock_n.dat", "46819043d019a2f36b727cc2bdd6980f", 12995485),
Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "Fargus",
AD_ENTRY1s("stock_n.dat", "46819043d019a2f36b727cc2bdd6980f", 12847726),
Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "",
AD_ENTRY1s("stock_n.dat", "9729e1c77a74f2f23c53596fae385bfa", 13428133),
Common::PL_POL, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
AD_TABLE_END_MARKER
};
} // End of namespace Gnap
class GnapMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
public:
GnapMetaEngineDetection() : AdvancedMetaEngineDetection(Gnap::gameDescriptions, gnapGames) {
_maxScanDepth = 3;
}
const char *getName() const override {
return "gnap";
}
const char *getEngineName() const override {
return "Gnap";
}
const char *getOriginalCopyright() const override {
return "Gnap (C) Artech Digital Entertainment 1997";
}
const DebugChannelDef *getDebugChannels() const override {
return debugFlagList;
}
};
REGISTER_PLUGIN_STATIC(GNAP_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GnapMetaEngineDetection);

796
engines/gnap/fontdata.h Normal file
View File

@@ -0,0 +1,796 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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 FONT_INFO's data array
FONT_CHAR_INFO(byte width, uint16 offset) : _width(width), _offset(offset) {}
};
/*
** 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 */
const byte _dejaVuSans9ptWidth[] = {
5, /* */ 1, /* ! */ 3, /* " */ 8, /* # */ 5, /* $ */
10,/* % */ 8, /* & */ 1, /* ' */ 3, /* ( */ 3, /* ) */
5, /* * */ 7, /* + */ 1, /* , */ 3, /* - */ 1, /* . */
4, /* / */ 6, /* 0 */ 5, /* 1 */ 6, /* 2 */ 6, /* 3 */
6, /* 4 */ 6, /* 5 */ 6, /* 6 */ 6, /* 7 */ 6, /* 8 */
6, /* 9 */ 1, /* : */ 1, /* ; */ 8, /* < */ 8, /* = */
8, /* > */ 5, /* ? */ 11,/* @ */ 8, /* A */ 6, /* B */
6, /* C */ 7, /* D */ 6, /* E */ 5, /* F */ 7, /* G */
7, /* H */ 1, /* I */ 3, /* J */ 6, /* K */ 5, /* L */
8, /* M */ 7, /* N */ 7, /* O */ 6, /* P */ 7, /* Q */
7, /* R */ 6, /* S */ 7, /* T */ 7, /* U */ 8, /* V */
11,/* W */ 7, /* X */ 7, /* Y */ 7, /* Z */ 2, /* [ */
4, /* \ */ 2, /* ] */ 6, /* ^ */ 6, /* _ */ 2, /* ` */
6, /* a */ 6, /* b */ 5, /* c */ 6, /* d */ 6, /* e */
4, /* f */ 6, /* g */ 6, /* h */ 1, /* i */ 2, /* j */
5, /* k */ 1, /* l */ 9, /* m */ 6, /* n */ 6, /* o */
6, /* p */ 6, /* q */ 4, /* r */ 5, /* s */ 4, /* t */
6, /* u */ 6, /* v */ 9, /* w */ 6, /* x */ 6, /* y */
5, /* z */ 5, /* { */ 1, /* | */ 5, /* ) */ 8 /* ~ */
};
const uint16 _dejaVuSans9ptOffsets[] = {
0, /* */ 10, /* ! */ 12, /* " */ 18, /* # */ 34, /* $ */
44, /* % */ 64, /* & */ 80, /* ' */ 82, /* ( */ 88, /* */
94, /* * */ 104, /* + */ 118, /* , */ 120, /* - */ 126, /* . */
128, /* / */ 136, /* 0 */ 148, /* 1 */ 158, /* 2 */ 170, /* 3 */
182, /* 4 */ 194, /* 5 */ 206, /* 6 */ 218, /* 7 */ 230, /* 8 */
242, /* 9 */ 254, /* : */ 256, /* ; */ 258, /* < */ 274, /* = */
290, /* > */ 306, /* ? */ 316, /* @ */ 338, /* A */ 354, /* B */
366, /* C */ 378, /* D */ 392, /* E */ 404, /* F */ 414, /* G */
428, /* H */ 442, /* I */ 444, /* J */ 450, /* K */ 462, /* L */
472, /* M */ 488, /* N */ 502, /* O */ 516, /* P */ 528, /* Q */
542, /* R */ 556, /* S */ 568, /* T */ 582, /* U */ 596, /* V */
612, /* W */ 634, /* X */ 648, /* Y */ 662, /* Z */ 676, /* [ */
680, /* \ */ 688, /* ] */ 692, /* ^ */ 704, /* _ */ 716, /* ` */
720, /* a */ 732, /* b */ 744, /* c */ 754, /* d */ 766, /* e */
778, /* f */ 786, /* g */ 798, /* h */ 810, /* i */ 812, /* j */
816, /* k */ 826, /* l */ 828, /* m */ 846, /* n */ 858, /* o */
870, /* p */ 882, /* q */ 894, /* r */ 902, /* s */ 912, /* t */
920, /* u */ 932, /* v */ 944, /* w */ 962, /* x */ 974, /* y */
986, /* z */ 996, /* { */ 1006, /* | */ 1008, /* */ 1018 /* ~ */
};
} // End of namespace Gnap
#endif // GNAP_RESOURCE_H

1278
engines/gnap/gamesys.cpp Normal file

File diff suppressed because it is too large Load Diff

212
engines/gnap/gamesys.h Normal file
View File

@@ -0,0 +1,212 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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;
bool _forceFrameReset;
};
struct RemoveSpriteDrawItem {
int _id;
Graphics::Surface *_surface;
};
struct GfxItem {
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);
};
struct Animation {
int _sequenceId;
int _id;
int _status;
};
class GameSys {
public:
GameSys(GnapEngine *vm);
~GameSys();
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);
void requestClear2(bool resetFl);
void requestClear1();
void requestRemoveSequence(int sequenceId, int id);
void waitForUpdate();
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 id);
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 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);
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<Common::Rect> _dirtyRects;
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<int> _soundIds;
////////////////////////////////////////////////////////////////////////////
Common::Array<Sequence> _seqItems;
Common::Array<Sequence> _fatSequenceItems;
GfxItem _gfxItems[kMaxGfxItems];
int _gfxItemsCount;
Animation _animations[kMaxAnimations];
int _animationsCount;
int _backgroundImageValue3, _backgroundImageValue1;
int _backgroundImageValue4, _backgroundImageValue2;
int32 _gameSysClock, _lastUpdateClock;
bool _animationsDone;
Graphics::Surface *_backgroundSurface;
Graphics::Surface *_frontSurface;
Common::Rect _screenRect;
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 id);
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

1231
engines/gnap/gnap.cpp Normal file

File diff suppressed because it is too large Load Diff

474
engines/gnap/gnap.h Normal file
View File

@@ -0,0 +1,474 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GNAP_H
#define GNAP_GNAP_H
#include "common/array.h"
#include "common/events.h"
#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"
#include "engines/engine.h"
#include "graphics/pixelformat.h"
#include "graphics/fontman.h"
#include "graphics/font.h"
#include "graphics/fonts/ttf.h"
#include "gnap/debugger.h"
#include "gnap/resource.h"
#include "gnap/scenes/scenecore.h"
#include "gnap/character.h"
#include "gnap/music.h"
struct ADGameDescription;
namespace Common {
class PEResources;
}
namespace Gnap {
class DatManager;
class SequenceResource;
class SpriteResource;
class GameSys;
class SoundMan;
class MusicPlayer;
#define GNAP_SAVEGAME_VERSION 2
struct MouseButtonState {
bool _left;
bool _right;
MouseButtonState() : _left(false), _right(false) {
}
};
struct Hotspot {
Common::Rect _rect;
uint16 _flags;
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;
enum GnapDebugChannels {
kDebugBasic = 1,
kDebugMusic,
};
enum {
SF_NONE = 0x0000,
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 {
kGSPullOutDevice = 0,
kGSPullOutDeviceNonWorking = 1,
kGSIdle = 2,
kGSBrainPulsating = 3,
kGSImpossible = 4,
kGSScratchingHead = 5,
kGSDeflect = 6,
kGSUseDevice = 7,
kGSMoan1 = 8,
kGSMoan2 = 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,
kGFNeedleTaken = 2,
kGFTwigTaken = 3,
kGFUnk04 = 4,
kGFKeysTaken = 5,
kGFGrassTaken = 6,
kGFBarnPadlockOpen = 7,
kGFTruckFilledWithGas = 8,
kGFTruckKeysUsed = 9,
kGFPlatypusDisguised = 10,
kGFSceneFlag1 = 11,
kGFGnapControlsToyUFO = 12,
kGFUnk13 = 13, // Tongue Fight Won?
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
};
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() override;
bool hasFeature(EngineFeature f) const override;
public:
GnapEngine(OSystem *syst, const ADGameDescription *gd);
~GnapEngine() override;
private:
const ADGameDescription *_gameDescription;
Graphics::PixelFormat _pixelFormat;
int _loadGameSlot;
public:
Common::RandomSource *_random;
Common::PEResources *_exe;
DatManager *_dat;
SpriteCache *_spriteCache;
SoundCache *_soundCache;
SequenceCache *_sequenceCache;
GameSys *_gameSys;
SoundMan *_soundMan;
Debugger *_debugger;
Scene *_scene;
PlayerGnap *_gnap;
PlayerPlat *_plat;
MusicPlayer *_music;
Graphics::Font *_font;
Common::MemoryWriteStreamDynamic *_tempThumbnail;
int _lastUpdateClock;
bool _gameDone;
bool _keyPressState[512];
bool _keyDownState[512];
bool _isPaused;
Graphics::Surface *_pauseSprite;
int _timers[kMaxTimers], _savedTimers[kMaxTimers];
MouseButtonState _mouseButtonState;
MouseButtonState _mouseClickState;
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;
Common::Point _mousePos;
int _leftClickMouseX, _leftClickMouseY;
Graphics::Surface *_grabCursorSprite;
int _currGrabCursorX, _currGrabCursorY;
int _grabCursorSpriteIndex, _newGrabCursorSpriteIndex;
Graphics::Surface *_fullScreenSprite;
int _fullScreenSpriteId;
int _deviceX1, _deviceY1;
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, bool isAutosave = false) override;
Common::Error loadGameState(int slot) override;
void synchronize(Common::Serializer &s);
void writeSavegameHeader(Common::OutSaveFile *out, GnapSavegameHeader &header);
WARN_UNUSED_RESULT static bool readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header, bool skipThumbnail = true);
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 = SF_NONE,
int16 walkX = -1, int16 walkY = -1);
int getHotspotIndexAtPos(Common::Point pos);
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 _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);
// Gnap
void doCallback(int callback);
// Scenes
int _toyUfoNextSequenceId, _toyUfoSequenceId;
int _toyUfoId;
int _toyUfoActionStatus;
int _toyUfoX;
int _toyUfoY;
void initGlobalSceneVars();
void playSequences(int fullScreenSpriteId, int sequenceId1, int sequenceId2, int sequenceId3);
// Shared by scenes 17 & 18
int _s18GarbageCanPos;
// Scene 4x
void toyUfoSetStatus(int flagNum);
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
#endif // GNAP_GNAP_H

994
engines/gnap/grid.cpp Normal file
View File

@@ -0,0 +1,994 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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;
_gnap->_gridX = 410 - gridMinX;
_gnap->_gridY = 450 - gridMinY;
_plat->_gridX = 396 - gridMinX;
_plat->_gridY = 347 - gridMinY;
}
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)
return true;
if ((_gnap->_pos == Common::Point(gridX, gridY)) || (_plat->_pos == Common::Point(gridX, gridY)))
return true;
Common::Point pos = Common::Point(_gridMinX + 75 * gridX, _gridMinY + 48 * gridY);
for (int i = 0; i < _hotspotsCount; ++i) {
if (_hotspots[i].isPointInside(pos) && !(_hotspots[i]._flags & SF_WALKABLE))
return true;
}
return false;
}
/******************************************************************************/
int PlayerGnap::getWalkStopSequenceId(int deltaX, int deltaY) {
static const int gnapWalkStopSequenceIds[9] = {
0x7BC, 0x7BA, 0x7BA,
0x7BC, 0x000, 0x7BA,
0x7BB, 0x7B9, 0x7B9
};
int id = 3 * (deltaX + 1) + deltaY + 1;
assert (id >= 0 && id < 9 );
return gnapWalkStopSequenceIds[id];
}
Facing PlayerGnap::getWalkFacing(int deltaX, int deltaY) {
static const Facing gnapWalkFacings[9] = {
kDirUpLeft, kDirBottomLeft, kDirBottomLeft,
kDirUpLeft, kDirIdleLeft, kDirBottomLeft,
kDirUpRight, kDirBottomRight, kDirBottomRight
};
int id = 3 * (deltaX + 1) + deltaY + 1;
assert (id >= 0 && id < 9 );
return gnapWalkFacings[id];
}
bool PlayerGnap::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
_walkDirX = 0;
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
return false;
} 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
return false;
}
++_walkNodesCount;
}
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 (_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;
}
return true;
}
bool PlayerGnap::findPath2(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
_walkDirX = 0;
if (_walkDeltaY)
_walkDirY = (_walkDestY - gridY) / _walkDeltaY;
else
_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 (_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 (_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 (!_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;
}
++_walkNodesCount;
}
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 (_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;
}
return true;
}
bool PlayerGnap::findPath3(int gridX, int gridY) {
int gridIncr = 1;
bool done = false;
while (!done && gridIncr < _vm->_gridMaxX) {
if (!_vm->isPointBlocked(gridX + gridIncr, gridY) && findPath1(gridX + gridIncr, gridY, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY) && findPath1(gridX - gridIncr, gridY, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX, gridY + gridIncr) && findPath1(gridX, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX, gridY - gridIncr) && findPath1(gridX, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX + gridIncr, gridY + gridIncr) && findPath1(gridX + gridIncr, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY + gridIncr) && findPath1(gridX - gridIncr, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX + gridIncr, gridY - gridIncr) && findPath1(gridX + gridIncr, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY - gridIncr) && findPath1(gridX - gridIncr, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX + gridIncr, gridY) && findPath2(gridX + gridIncr, gridY, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY) && findPath2(gridX - gridIncr, gridY, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX, gridY + gridIncr) && findPath2(gridX, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX, gridY - gridIncr) && findPath2(gridX, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX + gridIncr, gridY + gridIncr) && findPath2(gridX + gridIncr, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY + gridIncr) && findPath2(gridX - gridIncr, gridY + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY + i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX + gridIncr, gridY - gridIncr) && findPath2(gridX + gridIncr, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX + i;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(gridX - gridIncr, gridY - gridIncr) && findPath2(gridX - gridIncr, gridY - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = gridX - i;
_walkNodes[i]._gridY1 = gridY - i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
++gridIncr;
}
return done;
}
bool PlayerGnap::findPath4(int gridX, int gridY) {
bool result = false;
_walkNodesCount = 0;
_walkDirXIncr = 0;
_walkDirYIncr = 0;
_walkDeltaX = ABS(_walkDestX - gridX);
_walkDeltaY = ABS(_walkDestY - gridY);
if (_walkDeltaX)
_walkDirX = (_walkDestX - gridX) / _walkDeltaX;
else
_walkDirX = 0;
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 {
_walkDeltaX = _walkDirXIncr;
_walkDeltaY = _walkDirYIncr;
--_walkNodesCount;
}
} 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 {
_walkDeltaX = _walkDirXIncr;
_walkDeltaY = _walkDirYIncr;
--_walkNodesCount;
}
}
++_walkNodesCount;
}
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 {
_walkDeltaX = _walkDirXIncr;
}
}
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 {
_walkDeltaY = _walkDirYIncr;
}
}
if (gridX + _walkDirX * _walkDirXIncr != _walkDestX || gridY + _walkDirY * _walkDirYIncr != _walkDestY) {
_walkDestX = gridX + _walkDirX * _walkDirXIncr;
_walkDestY = gridY + _walkDirY * _walkDirYIncr;
result = false;
} else {
result = true;
}
return result;
}
/******************************************************************************/
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
_walkDirX = 0;
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
return false;
} 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
return false;
}
++_walkNodesCount;
}
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 (_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;
}
return true;
}
bool PlayerPlat::findPath2(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
_walkDirX = 0;
if (_walkDeltaY)
_walkDirY = (_walkDestY - gridY) / _walkDeltaY;
else
_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 (_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 (_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 (!_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;
}
++_walkNodesCount;
}
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 (_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;
}
return true;
}
bool PlayerPlat::findPath3(int gridX, int gridY) {
int gridIncr = 1;
bool done = false;
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) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y) && findPath1(_pos.x - gridIncr, _pos.y, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x, _pos.y + gridIncr) && findPath1(_pos.x, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x, _pos.y - gridIncr) && findPath1(_pos.x, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y + gridIncr) && findPath1(_pos.x + gridIncr, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y + gridIncr) && findPath1(_pos.x - gridIncr, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y - gridIncr) && findPath1(_pos.x + gridIncr, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y - gridIncr) && findPath1(_pos.x - gridIncr, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y) && findPath2(_pos.x + gridIncr, _pos.y, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y) && findPath2(_pos.x - gridIncr, _pos.y, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 0;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x, _pos.y + gridIncr) && findPath2(_pos.x, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x, _pos.y - gridIncr) && findPath2(_pos.x, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = 0;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y + gridIncr) && findPath2(_pos.x + gridIncr, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y + gridIncr) && findPath2(_pos.x - gridIncr, _pos.y + gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y + i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = 1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x + gridIncr, _pos.y - gridIncr) && findPath2(_pos.x + gridIncr, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x + i;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = 1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
if (!_vm->isPointBlocked(_pos.x - gridIncr, _pos.y - gridIncr) && findPath2(_pos.x - gridIncr, _pos.y - gridIncr, gridIncr)) {
for (int i = 0; i < gridIncr; ++i) {
_walkNodes[i]._gridX1 = _pos.x - i;
_walkNodes[i]._gridY1 = _pos.y - i;
_walkNodes[i]._deltaX = -1;
_walkNodes[i]._deltaY = -1;
}
done = true;
break;
}
++gridIncr;
}
return done;
}
bool PlayerPlat::findPath4(int gridX, int gridY) {
bool result = false;
_walkNodesCount = 0;
_walkDirXIncr = 0;
_walkDirYIncr = 0;
_walkDeltaX = ABS(_walkDestX - gridX);
_walkDeltaY = ABS(_walkDestY - gridY);
if (_walkDeltaX)
_walkDirX = (_walkDestX - gridX) / _walkDeltaX;
else
_walkDirX = 0;
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 {
_walkDeltaX = _walkDirXIncr;
_walkDeltaY = _walkDirYIncr;
--_walkNodesCount;
}
} 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 {
_walkDeltaX = _walkDirXIncr;
_walkDeltaY = _walkDirYIncr;
--_walkNodesCount;
}
}
++_walkNodesCount;
}
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 {
_walkDeltaX = _walkDirXIncr;
}
}
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 {
_walkDeltaY = _walkDirYIncr;
}
}
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 PlayerPlat::makeRoom() {
int rndGridX, rndGridY;
do {
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

884
engines/gnap/menu.cpp Normal file
View File

@@ -0,0 +1,884 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/translation.h"
#include "gui/saveload.h"
#include "graphics/thumbnail.h"
#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 curId = 0;
for (int i = 0; i < 3; ++i) {
int top = 74 * i + 69;
for (int j = 0; j < 3; ++j) {
int left = 87 * j + 262;
_hotspots[curId]._rect = Common::Rect(left, top, left + 79, top + 66);
_hotspots[curId]._flags = SF_NONE;
++curId;
}
}
_hotspots[curId]._rect = Common::Rect(330, 350, 430, 460);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
_hotspots[curId]._rect = Common::Rect(180, 15, 620, 580);
_hotspots[curId]._flags = SF_NONE;
++curId;
_hotspots[curId]._rect = Common::Rect(0, 0, 799, 599);
_hotspots[curId]._flags = SF_NONE;
_hotspotsCount = curId + 1;
}
void GnapEngine::initMenuHotspots2() {
int curId = 0;
for (int i = 0; i < 4; ++i) {
int top = 48 * i + 85;
_hotspots[curId]._rect = Common::Rect(312, top, 465, top + 37);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
}
_hotspots[curId]._rect = Common::Rect(500, 72, 527, 99);
_hotspots[curId]._flags = SF_DISABLED;
++curId;
_hotspots[curId]._rect = Common::Rect(330, 350, 430, 460);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
_hotspots[curId]._rect = Common::Rect(180, 15, 620, 580);
_hotspots[curId]._flags = SF_NONE;
++curId;
_hotspots[curId]._rect = Common::Rect(0, 0, 799, 599);
_hotspots[curId]._flags = SF_NONE;
_hotspotsCount = curId + 1;
}
void GnapEngine::initMenuQuitQueryHotspots() {
_hotspots[0]._rect = Common::Rect(311, 197, 377, 237);
_hotspots[0]._flags = SF_GRAB_CURSOR;
_hotspots[1]._rect = Common::Rect(403, 197, 469, 237);
_hotspots[1]._flags = SF_GRAB_CURSOR;
_hotspots[2]._rect = Common::Rect(330, 350, 430, 460);
_hotspots[2]._flags = SF_GRAB_CURSOR;
_hotspots[3]._rect = Common::Rect(180, 15, 620, 580);
_hotspots[3]._flags = SF_NONE;
_hotspots[4]._rect = Common::Rect(0, 0, 799, 599);
_hotspots[4]._flags = SF_NONE;
_hotspotsCount = 5;
}
void GnapEngine::initSaveLoadHotspots() {
int curId = 0;
for (int i = 0; i < 7; ++i ) {
int top = 31 * i + 74;
_hotspots[curId]._rect = Common::Rect(288, top, 379, top + 22);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
}
if (_menuStatus == 2) {
_hotspots[curId]._rect = Common::Rect(416, 160, 499, 188);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
}
_hotspots[curId]._rect = Common::Rect(416, 213, 499, 241);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
_hotspots[curId]._rect = Common::Rect(330, 350, 430, 460);
_hotspots[curId]._flags = SF_GRAB_CURSOR;
++curId;
_hotspots[curId]._rect = Common::Rect(180, 15, 620, 580);
_hotspots[curId]._flags = SF_NONE;
++curId;
_hotspots[curId]._rect = Common::Rect(0, 0, 799, 599);
_hotspots[curId]._flags = SF_NONE;
_hotspotsCount = curId + 1;
}
void GnapEngine::drawInventoryFrames() {
for (int i = 0; i < 9; ++i)
_gameSys->drawSpriteToSurface(_menuBackgroundSurface, _hotspots[i]._rect.left - 93, _hotspots[i]._rect.top, 0x10001);
}
void GnapEngine::insertInventorySprites() {
for (int i = 0; i < 9; ++i) {
_menuInventoryIndices[i] = -1;
_gameSys->removeSpriteDrawItem(_menuInventorySprites[_sceneClickedHotspot], 261);
_menuInventorySprites[i] = nullptr;
}
_menuSpritesIndex = 0;
for (int index = 0; index < 30 && _menuSpritesIndex < 9; ++index) {
if (invHas(index)) {
_gameSys->drawSpriteToSurface(_menuBackgroundSurface,
_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]._rect.left + ((79 - _menuInventorySprites[_menuSpritesIndex]->w) / 2),
_hotspots[_menuSpritesIndex]._rect.top + ((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] = nullptr;
_menuInventoryIndices[j] = -1;
}
}
_menuSpritesIndex = 0;
}
void GnapEngine::runMenu() {
_spriteHandle = nullptr;
_cursorSprite = nullptr;
_menuSprite1 = nullptr;
_menuSprite2 = nullptr;
_menuSaveLoadSprite = nullptr;
_menuQuitQuerySprite = nullptr;
_menuStatus = 0;
_menuDone = false;
delete _tempThumbnail;
_tempThumbnail = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
Graphics::saveThumbnail(*_tempThumbnail);
createMenuSprite();
insertDeviceIconActive();
for (int i = 0; i < 7; ++i) {
_savegameFilenames[i][0] = 0;
_savegameSprites[i] = nullptr;
}
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(Common::KEYCODE_BACKSPACE) && !isKeyStatus1(Common::KEYCODE_ESCAPE) && !_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;
default:
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]._rect = Common::Rect(262, 69, 341, 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, false);
_menuStatus = 1;
Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom);
drawInventoryFrames();
initMenuHotspots2();
removeInventorySprites();
if (!_menuSprite1)
_menuSprite1 = _gameSys->createSurface(0x104F8);
_gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262);
_gameSys->insertDirtyRect(dirtyRect);
} else {
playSound(0x108F5, false);
}
} else if (_sceneClickedHotspot == _hotspotsCount - 1) {
_timers[2] = 10;
playSound(0x108F5, false);
_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]._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) {
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, false);
deleteSurface(&_spriteHandle); // CHECKME
_spriteHandle = _gameSys->createSurface(0x10001);
_gameSys->insertSpriteDrawItem(_spriteHandle, _hotspots[_menuSpritesIndex - 1]._rect.left, _hotspots[_menuSpritesIndex - 1]._rect.top, 261);
setGrabCursorSprite(kCombineItems[combineIndex].resultItem);
removeInventorySprites();
insertInventorySprites();
delayTicksCursor(5);
} else {
playSound(0x108F5, false);
}
}
}
void GnapEngine::updateMenuStatusMainMenu() {
_hotspots[0]._rect = Common::Rect(312, 85, 465, 122);
_sceneClickedHotspot = -1;
if (!_timers[2])
_sceneClickedHotspot = getClickedHotspotId();
if (_sceneClickedHotspot != 1 && _sceneClickedHotspot != 0) {
if (_sceneClickedHotspot != 2 && _hotspotsCount - 1 != _sceneClickedHotspot) {
if (_sceneClickedHotspot == 3) {
// Quit
_timers[2] = 10;
playSound(0x108F4, false);
_gameSys->removeSpriteDrawItem(_menuSprite1, 262);
initMenuQuitQueryHotspots();
_menuStatus = 4;
if (!_menuQuitQuerySprite)
_menuQuitQuerySprite = _gameSys->createSurface(0x104FC);
_gameSys->insertSpriteDrawItem(_menuQuitQuerySprite, 254, 93, 262);
} else if (_sceneClickedHotspot == 4) {
// Pause ?
playSound(0x108F4, false);
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);
playMidi("pause.mid");
} 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(Common::KEYCODE_ESCAPE) && !isKeyStatus1(Common::KEYCODE_RETURN)
&& !isKeyStatus1(Common::KEYCODE_SPACE) && !_timers[2] && !_gameDone)
gameUpdateTick();
playSound(0x108F5, false);
_mouseClickState._left = false;
clearKeyStatus1(Common::KEYCODE_ESCAPE);
clearKeyStatus1(Common::KEYCODE_RETURN);
clearKeyStatus1(Common::KEYCODE_SPACE);
}
_gameSys->removeSpriteDrawItem(_largeSprite, 300);
delayTicksCursor(5);
deleteSurface(&_largeSprite);
showCursor();
} else if (_hotspotsCount - 3 == _sceneClickedHotspot) {
// Button - Return to the inventory
_timers[2] = 10;
playSound(0x108F4, false);
initMenuHotspots1();
_menuStatus = 0;
if (_menuSprite1)
_gameSys->removeSpriteDrawItem(_menuSprite1, 262);
insertInventorySprites();
Common::Rect dirtyRect(_hotspots[0]._rect.left, _hotspots[0]._rect.top, _hotspots[2]._rect.right, _hotspots[_hotspotsCount - 4]._rect.bottom);
_gameSys->insertDirtyRect(dirtyRect);
}
} else {
// Resume
playSound(0x108F5, false);
_menuDone = true;
}
} else {
// Save / Load
#if 1
_timers[2] = 10;
playSound(0x108F4, false);
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;
_sceneDone = true;
playSound(0x108F4, false);
} else {
playSound(0x108F5, false);
}
}
}
#else
// 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);
if (_menuSaveLoadSprite)
deleteSurface(&_menuSaveLoadSprite);
if (_sceneClickedHotspot == 1) {
// Save
_menuStatus = 2;
initSaveLoadHotspots();
_menuSaveLoadSprite = _gameSys->createSurface(0x104FB);
} else {
// Load
_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].top, 263);
}
_savegameIndex = -1;
}
#endif
}
Common::Error GnapEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(
getSaveStateName(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) {
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;
}
}
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');
// 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;
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);
}
WARN_UNUSED_RESULT bool GnapEngine::readSavegameHeader(Common::InSaveFile *in, GnapSavegameHeader &header, bool skipThumbnail) {
char saveIdentBuffer[SAVEGAME_STR_SIZE + 1];
// 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;
// Get the thumbnail, saved in v2 or later
if (header._version == 1)
header._thumbnail = nullptr;
else {
if (!Graphics::loadThumbnail(*in, header._thumbnail, skipThumbnail)) {
return false;
}
}
// 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(
getSaveStateName(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;
_loadGameSlot = slot;
return Common::kNoError;
}
void GnapEngine::updateMenuStatusSaveGame() {
#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';
_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) {
// Button
_timers[2] = 10;
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, false);
_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, false);
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, false);
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);
}
}
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
}
void GnapEngine::updateMenuStatusLoadGame() {
_hotspots[0]._rect = Common::Rect(288, 74, 379, 96);
_sceneClickedHotspot = -1;
if (!_timers[2])
_sceneClickedHotspot = getClickedHotspotId();
if (_sceneClickedHotspot != -1 && _hotspotsCount - 2 != _sceneClickedHotspot) {
_timers[2] = 10;
if (_hotspotsCount - 4 <= _sceneClickedHotspot) {
playSound(0x108F5, false);
_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, false);
} else {
playSound(0x108F4, false);
_sceneDone = true;
}
}
}
void GnapEngine::updateMenuStatusQueryQuit() {
_hotspots[0]._rect = Common::Rect(311, 197, 377, 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, false);
_gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262);
_sceneDone = true;
_gameDone = true;
} else if (_sceneClickedHotspot == 4) {
// Exit the device
playSound(0x108F4, false);
_gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262);
_menuDone = true;
} else if (_sceneClickedHotspot != -1) {
// Return to the main menu
playSound(0x108F4, false);
_gameSys->removeSpriteDrawItem(_menuQuitQuerySprite, 262);
_timers[2] = 10;
_menuStatus = 1;
initMenuHotspots2();
_gameSys->insertSpriteDrawItem(_menuSprite1, 288, 79, 262);
}
}
} // End of namespace Gnap

155
engines/gnap/metaengine.cpp Normal file
View File

@@ -0,0 +1,155 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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"
class GnapMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
public:
const char *getName() const override {
return "gnap";
}
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
int getMaximumSaveSlot() const override;
SaveStateList listSaves(const char *target) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
bool removeSaveState(const char *target, int slot) const override;
};
bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSupportsDeleteSave) ||
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
(f == kSavesSupportCreationDate) ||
(f == kSimpleSavesNames);
}
bool Gnap::GnapEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsReturnToLauncher) ||
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime);
}
bool GnapMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.%03d", target, slot);
return 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 saveDesc;
Common::String pattern = Common::String::format("%s.0##", target);
Gnap::GnapSavegameHeader header;
filenames = saveFileMan->listSavefiles(pattern);
SaveStateList saveList;
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;
if (slot >= 0 && slot < getMaximumSaveSlot()) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
if (in) {
if (Gnap::GnapEngine::readSavegameHeader(in, header))
saveList.push_back(SaveStateDescriptor(this, slot, header._saveName));
delete in;
}
}
}
// Sort saves based on slot number.
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
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->readByte();
if (version > GNAP_SAVEGAME_VERSION) {
delete file;
return SaveStateDescriptor();
}
Common::String saveName;
char ch;
while ((ch = (char)file->readByte()) != '\0')
saveName += ch;
SaveStateDescriptor desc(this, slot, saveName);
if (version != 1) {
Graphics::Surface *thumbnail;
if (!Graphics::loadThumbnail(*file, thumbnail)) {
delete file;
return SaveStateDescriptor();
}
desc.setThumbnail(thumbnail);
}
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);
desc.setSaveTime(hour, minutes);
delete file;
return desc;
}
return SaveStateDescriptor();
}
Common::Error GnapMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
*engine = new Gnap::GnapEngine(syst, desc);
return Common::kNoError;
}
#if PLUGIN_ENABLED_DYNAMIC(GNAP)
REGISTER_PLUGIN_DYNAMIC(GNAP, PLUGIN_TYPE_ENGINE, GnapMetaEngine);
#else
REGISTER_PLUGIN_STATIC(GNAP, PLUGIN_TYPE_ENGINE, GnapMetaEngine);
#endif

35
engines/gnap/module.mk Normal file
View File

@@ -0,0 +1,35 @@
MODULE := engines/gnap
MODULE_OBJS := \
character.o \
datarchive.o \
debugger.o \
gamesys.o \
gnap.o \
grid.o \
menu.o \
metaengine.o \
music.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/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
# Detection objects
DETECT_OBJS += $(MODULE)/detection.o

103
engines/gnap/music.cpp Normal file
View File

@@ -0,0 +1,103 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// 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();
_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.toString().c_str());
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.toString().c_str());
delete parser;
}
}
void MusicPlayer::stop() {
Audio::MidiPlayer::stop();
}
} // End of namespace Gnap

49
engines/gnap/music.h Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// 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() override;
// Overload Audio::MidiPlayer method
void sendToChannel(byte channel, uint32 b) override;
protected:
Common::Path _filename;
};
} // End of namespace Gnap
#endif

124
engines/gnap/resource.cpp Normal file
View File

@@ -0,0 +1,124 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "gnap/gnap.h"
#include "gnap/resource.h"
namespace Gnap {
// SequenceFrame
void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) {
_duration = stream.readUint16LE();
_isScaled = (stream.readUint16LE() != 0);
_rect.left = stream.readUint32LE();
_rect.top = stream.readUint32LE();
_rect.right = stream.readUint32LE();
_rect.bottom = stream.readUint32LE();
_spriteId = stream.readUint32LE();
_soundId = stream.readUint32LE();
// Skip an unused value
stream.readUint32LE();
debugC(kDebugBasic, "SequenceFrame() spriteId: %d; soundId: %d", _spriteId, _soundId);
}
// SequenceAnimation
void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) {
// Skip two unused values
stream.readUint32LE();
_additionalDelay = stream.readUint32LE();
_framesCount = stream.readUint16LE();
_maxTotalDuration = stream.readUint16LE();
debugC(kDebugBasic, "SequenceAnimation() framesCount: %d", _framesCount);
frames = new SequenceFrame[_framesCount];
for (int i = 0; i < _framesCount; ++i)
frames[i].loadFromStream(stream);
}
// SequenceResource
SequenceResource::SequenceResource(byte *data, uint32 size) {
Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO);
// Skip an unused value
stream.readUint32LE();
_sequenceId = stream.readUint32LE();
_defaultId = stream.readUint32LE();
_sequenceId2 = stream.readUint32LE();
_defaultId2 = stream.readUint32LE();
_flags = stream.readUint32LE();
_totalDuration = stream.readUint32LE();
_xOffs = stream.readUint16LE();
_yOffs = stream.readUint16LE();
_animationsCount = stream.readUint32LE();
_animations = new SequenceAnimation[_animationsCount];
debugC(kDebugBasic, "SequenceResource() _animationsCount: %d", _animationsCount);
for (int i = 0; i < _animationsCount; ++i) {
uint32 animationOffs = stream.readUint32LE();
debugC(kDebugBasic, "animationOffs: %08X", animationOffs);
uint32 oldOffs = stream.pos();
stream.seek(animationOffs);
_animations[i].loadFromStream(stream);
stream.seek(oldOffs);
}
}
SequenceResource::~SequenceResource() {
delete[] _animations;
}
// SpriteResource
SpriteResource::SpriteResource(byte *data, uint32 size) {
_data = data;
_width = READ_LE_UINT16(_data);
_height = READ_LE_UINT16(_data + 2);
_unknownVal1 = READ_LE_UINT16(_data + 4);
_unknownVal2 = READ_LE_UINT16(_data + 6);
_transparent = (READ_LE_UINT16(_data + 8) != 0);
_colorsCount = READ_LE_UINT16(_data + 10);
_palette = (uint32 *)(_data + 12);
_pixels = _data + 12 + _colorsCount * 4;
#if defined(SCUMM_BIG_ENDIAN)
for (uint16 c = 0; c < _colorsCount; ++c)
_palette[c] = SWAP_BYTES_32(_palette[c]);
#endif
debugC(kDebugBasic, "SpriteResource() width: %d; height: %d; colorsCount: %d", _width, _height, _colorsCount);
}
SpriteResource::~SpriteResource() {
delete[] _data;
}
// SoundResource
SoundResource::SoundResource(byte *data, uint32 size) {
_data = data;
_size = size;
}
SoundResource::~SoundResource() {
delete[] _data;
}
} // End of namespace Gnap

189
engines/gnap/resource.h Normal file
View File

@@ -0,0 +1,189 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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;
bool _isScaled;
Common::Rect _rect;
int32 _spriteId;
int32 _soundId;
void loadFromStream(Common::MemoryReadStream &stream);
};
struct SequenceAnimation {
int32 _additionalDelay;
int16 _framesCount;
int16 _maxTotalDuration;
SequenceFrame *frames;
SequenceAnimation() : frames(nullptr), _additionalDelay(0), _framesCount(0), _maxTotalDuration(0) {}
~SequenceAnimation() { delete[] frames; }
void loadFromStream(Common::MemoryReadStream &stream);
};
class SequenceResource {
public:
SequenceResource(byte *data, uint32 size);
~SequenceResource();
public:
int32 _sequenceId;
int32 _defaultId;
int32 _sequenceId2;
uint32 _defaultId2;
uint32 _flags;
int32 _totalDuration;
int16 _xOffs;
int16 _yOffs;
int32 _animationsCount;
SequenceAnimation *_animations;
};
class SpriteResource {
public:
SpriteResource(byte *data, uint32 size);
~SpriteResource();
public:
byte *_data;
byte *_pixels;
uint32 *_palette;
int16 _width, _height;
uint16 _unknownVal1;
uint16 _unknownVal2;
bool _transparent;
uint16 _colorsCount;
};
class SoundResource {
public:
SoundResource(byte *data, uint32 size);
~SoundResource();
public:
byte *_data;
uint32 _size;
};
template <class ResourceClass, int ResourceType, bool FreeAfterLoad>
class ResourceCacheTemplate {
public:
ResourceCacheTemplate(DatManager *dat) : _dat(dat) {
}
~ResourceCacheTemplate() {
}
ResourceClass *get(int resourceId) {
Resource *resource = find(resourceId);
if (!resource) {
debug(9, "Loading resource type %d with ID %08X from disk", ResourceType, resourceId);
resource = new Resource(load(resourceId));
_cache[resourceId] = resource;
} else {
debug(9, "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) {
for (CacheMapIterator it = _cache.begin(); it != _cache.end(); ++it) {
Resource *resource = it->_value;
if (force || !resource->_isLocked) {
delete resource;
_cache.erase(it);
}
}
}
protected:
struct Resource {
ResourceClass *_obj;
bool _isLocked;
Resource(ResourceClass *obj) : _obj(obj), _isLocked(false) {}
~Resource() { delete _obj; }
};
typedef Common::HashMap<int, Resource *> 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 nullptr;
}
ResourceClass *load(int resourceId) {
if (_dat->getResourceType(resourceId) != ResourceType)
error("ResourceCache::load() Wrong resource type: Expected %d, got %d", ResourceType, _dat->getResourceType(resourceId));
byte *resourceData = _dat->loadResource(resourceId);
uint32 resourceSize = _dat->getResourceSize(resourceId);
ResourceClass *obj = new ResourceClass(resourceData, resourceSize);
if (FreeAfterLoad)
delete[] resourceData;
return obj;
}
};
typedef ResourceCacheTemplate<SpriteResource, kResTypeSprite, false> SpriteCache;
typedef ResourceCacheTemplate<SoundResource, kResTypeSound, false> SoundCache;
typedef ResourceCacheTemplate<SequenceResource, kResTypeSequence, true> SequenceCache;
} // End of namespace Gnap
#endif // GNAP_RESOURCE_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,287 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override {};
void updateAnimationsCb() override {};
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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override {};
void updateAnimationsCb() override {};
private:
int _liveAlienRows;
int _gameScore;
bool _soundToggle;
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[8];
int _alienRowAnims[8];
int _alienRowIds[8];
int _alienRowXOfs[8];
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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,400 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP0_H
#define GNAP_GROUP0_H
#include "gnap/debugger.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 {
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;
class Scene01: public Scene {
public:
Scene01(GnapEngine *vm);
~Scene01() override;
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
int _pigsIdCtr;
int _smokeIdCtr;
Graphics::Surface *_spaceshipSurface;
};
class Scene02: public Scene {
public:
Scene02(GnapEngine *vm);
~Scene02() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
int _truckGrillCtr;
int _nextChickenSequenceId;
int _currChickenSequenceId;
int _gnapTruckSequenceId;
};
class Scene03: public Scene {
public:
Scene03(GnapEngine *vm);
~Scene03() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
bool _platypusHypnotized;
bool _platypusScared;
int _nextPlatSequenceId;
int _nextFrogSequenceId;
int _currFrogSequenceId;
};
class Scene04: public Scene {
public:
Scene04(GnapEngine *vm);
~Scene04() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
bool _triedWindow;
int _dogIdCtr;
int _nextDogSequenceId;
int _currDogSequenceId;
};
class Scene05: public Scene {
public:
Scene05(GnapEngine *vm);
~Scene05() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
int _nextChickenSequenceId;
int _currChickenSequenceId;
};
class Scene06: public Scene {
public:
Scene06(GnapEngine *vm);
~Scene06() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
private:
bool _horseTurnedBack;
int _nextPlatSequenceId;
int _nextHorseSequenceId;
int _currHorseSequenceId;
};
class Scene07: public Scene {
public:
Scene07(GnapEngine *vm);
~Scene07() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
};
class Scene08: public Scene {
public:
Scene08(GnapEngine *vm);
~Scene08() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override;
private:
int _nextDogSequenceId;
int _currDogSequenceId;
int _nextManSequenceId;
int _currManSequenceId;
};
class Scene09: public Scene {
public:
Scene09(GnapEngine *vm);
~Scene09() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {}
};
} // End of namespace Gnap
#endif // GNAP_GROUP0_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,453 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP1_H
#define GNAP_GROUP1_H
#include "gnap/debugger.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 {
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;
class Scene10: public Scene {
public:
Scene10(GnapEngine *vm);
~Scene10() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override;
private:
int _nextCookSequenceId;
int _currCookSequenceId;
};
class Scene11: public Scene {
public:
Scene11(GnapEngine *vm);
~Scene11() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _billardBallCtr;
int _nextHookGuySequenceId;
int _currHookGuySequenceId;
int _nextGoggleGuySequenceId;
int _currGoggleGuySequenceId;
};
class Scene12: public Scene {
public:
Scene12(GnapEngine *vm);
~Scene12() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _nextBeardGuySequenceId;
int _currBeardGuySequenceId;
int _nextToothGuySequenceId;
int _currToothGuySequenceId;
int _nextBarkeeperSequenceId;
int _currBarkeeperSequenceId;
};
class Scene13: public Scene {
public:
Scene13(GnapEngine *vm);
~Scene13() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _backToiletCtr;
void showScribble();
};
class Scene14: public Scene {
public:
Scene14(GnapEngine *vm);
~Scene14() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
};
class Scene15: public Scene {
public:
Scene15(GnapEngine *vm);
~Scene15() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
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() override;
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
Graphics::Surface *_cowboyHatSurface;
int _platPhoneCtr;
int _platPhoneIter;
int _nextPhoneSequenceId;
int _currPhoneSequenceId;
void gnapCarryGarbageCanTo(int a5);
void putDownGarbageCan(int animationIndex);
void platEndPhoning(bool platFl);
void closeHydrantValve();
void waitForGnapAction();
};
class Scene19: public Scene {
public:
Scene19(GnapEngine *vm);
~Scene19() override;
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currShopAssistantSequenceId;
int _nextShopAssistantSequenceId;
int _toyGrabCtr;
int _shopAssistantCtr;
Graphics::Surface *_pictureSurface;
};
} // End of namespace Gnap
#endif // GNAP_GROUP1_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,406 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP2_H
#define GNAP_GROUP2_H
#include "gnap/debugger.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 {
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,
kHS29Arcade = 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;
class Scene20: public Scene {
public:
Scene20(GnapEngine *vm);
~Scene20() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override;
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() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currOldLadySequenceId;
int _nextOldLadySequenceId;
};
class Scene22: public Scene {
public:
Scene22(GnapEngine *vm);
~Scene22() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currCashierSequenceId;
int _nextCashierSequenceId;
bool _caughtBefore;
int _cashierCtr;
};
class Scene23: public Scene {
public:
Scene23(GnapEngine *vm);
~Scene23() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currStoreClerkSequenceId;
int _nextStoreClerkSequenceId;
};
class Scene24: public Scene {
public:
Scene24(GnapEngine *vm);
~Scene24() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currWomanSequenceId;
int _nextWomanSequenceId;
int _boySequenceId;
int _girlSequenceId;
};
class Scene25: public Scene {
public:
Scene25(GnapEngine *vm);
~Scene25() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currTicketVendorSequenceId;
int _nextTicketVendorSequenceId;
void playAnims(int index);
};
class Scene26: public Scene {
public:
Scene26(GnapEngine *vm);
~Scene26() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currKidSequenceId;
int _nextKidSequenceId;
};
class Scene27: public Scene {
public:
Scene27(GnapEngine *vm);
~Scene27() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _nextJanitorSequenceId;
int _currJanitorSequenceId;
};
class Scene28: public Scene {
public:
Scene28(GnapEngine *vm);
~Scene28() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currClownSequenceId;
int _nextClownSequenceId;
int _clownTalkCtr;
};
class Scene29: public Scene {
public:
Scene29(GnapEngine *vm);
~Scene29() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currMonkeySequenceId;
int _nextMonkeySequenceId;
int _currManSequenceId;
int _nextManSequenceId;
};
} // End of namespace Gnap
#endif // GNAP_GROUP1_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,239 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP3_H
#define GNAP_GROUP3_H
#include "gnap/debugger.h"
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;
class Scene30: public Scene {
public:
Scene30(GnapEngine *vm);
~Scene30() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _kidSequenceId;
};
class Scene31: public Scene {
public:
Scene31(GnapEngine *vm);
~Scene31() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
bool _beerGuyDistracted;
int _currClerkSequenceId;
int _nextClerkSequenceId;
int _clerkMeasureCtr;
int _clerkMeasureMaxCtr;
};
class Scene32: public Scene {
public:
Scene32(GnapEngine *vm);
~Scene32() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
};
class Scene33: public Scene {
public:
Scene33(GnapEngine *vm);
~Scene33() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currChickenSequenceId;
int _nextChickenSequenceId;
};
class Scene38: public Scene {
public:
Scene38(GnapEngine *vm);
~Scene38() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
};
class Scene39: public Scene {
public:
Scene39(GnapEngine *vm);
~Scene39() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currGuySequenceId;
int _nextGuySequenceId;
};
} // End of namespace Gnap
#endif // GNAP_GROUP3_H

File diff suppressed because it is too large Load Diff

View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP4_H
#define GNAP_GROUP4_H
#include "gnap/debugger.h"
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;
class Scene40: public Scene {
public:
Scene40(GnapEngine *vm);
~Scene40() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
};
class Scene41: public Scene {
public:
Scene41(GnapEngine *vm);
~Scene41() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currKidSequenceId;
int _nextKidSequenceId;
int _currToyVendorSequenceId;
int _nextToyVendorSequenceId;
};
class Scene42: public Scene {
public:
Scene42(GnapEngine *vm);
~Scene42() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currBBQVendorSequenceId;
int _nextBBQVendorSequenceId;
};
class Scene43: public Scene {
public:
Scene43(GnapEngine *vm);
~Scene43() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currTwoHeadedGuySequenceId;
int _nextTwoHeadedGuySequenceId;
};
class Scene44: public Scene {
public:
Scene44(GnapEngine *vm);
~Scene44() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _nextSpringGuySequenceId;
int _nextKissingLadySequenceId;
int _currSpringGuySequenceId;
int _currKissingLadySequenceId;
};
class Scene45: public Scene {
public:
Scene45(GnapEngine *vm);
~Scene45() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currDancerSequenceId;
};
class Scene46: public Scene {
public:
Scene46(GnapEngine *vm);
~Scene46() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override;
void updateAnimationsCb() override {};
private:
int _currSackGuySequenceId;
int _nextItchyGuySequenceId;
int _nextSackGuySequenceId;
int _currItchyGuySequenceId;
};
} // End of namespace Gnap
#endif // GNAP_GROUP4_H

View File

@@ -0,0 +1,384 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#include "gnap/resource.h"
#include "gnap/scenes/group5.h"
namespace Gnap {
Scene53::Scene53(GnapEngine *vm) : Scene(vm) {
_isGnapPhoning = false;
_currHandSequenceId = -1;
_callsMadeCtr = 0;
_callsRndUsed = 0;
}
int Scene53::init() {
GameSys& gameSys = *_vm->_gameSys;
gameSys.setAnimation(0, 0, 0);
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
};
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);
_currHandSequenceId = kGnapHandSequenceIds[buttonNum];
} else {
gameSys.setAnimation(kPlatypusHandSequenceIds[buttonNum], 40, 6);
gameSys.insertSequence(kPlatypusHandSequenceIds[buttonNum], 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
_currHandSequenceId = kPlatypusHandSequenceIds[buttonNum];
}
gnap._actionStatus = 6;
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
gnap._actionStatus = -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
};
GameSys& gameSys = *_vm->_gameSys;
PlayerGnap& gnap = *_vm->_gnap;
++_callsMadeCtr;
if (_callsMadeCtr <= 10) {
int index;
do {
index = getRandomCallIndex();
} while (!_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);
_callsMadeCtr = 0;
}
gnap._actionStatus = 1;
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
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);
gnap._actionStatus = 1;
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
gnap._actionStatus = -1;
if (_vm->isFlag(kGFSpringTaken)) {
gameSys.insertSequence(0x45, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
_currHandSequenceId = 0x45;
} else {
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;
gnap._actionStatus = 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;
default:
break;
}
if (flag && sequenceId != -1) {
_vm->stopSound(0xA0);
pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1);
gnap._actionStatus = 1;
gameSys.setAnimation(sequenceId, 1, 6);
gameSys.insertSequence(sequenceId, 1, 0, 0, kSeqNone, 16, 0, 0);
gnap._actionStatus = 1;
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_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 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
gnap._actionStatus = -1;
}
}
updateHotspots();
gnap._actionStatus = 1;
if (_vm->isFlag(kGFSpringTaken)) {
gameSys.setAnimation(0x73, 40, 6);
gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
_currHandSequenceId = 0x73;
gnap._actionStatus = -1;
}
}
void Scene53::run() {
GameSys& gameSys = *_vm->_gameSys;
PlayerGnap& gnap = *_vm->_gnap;
int phoneNumber = 0;
int phoneNumberLen = 0;
_vm->queueInsertDeviceIcon();
if (_vm->isFlag(kGFSpringTaken)) {
_currHandSequenceId = 0x45;
_isGnapPhoning = true;
} else {
_currHandSequenceId = 0x5E;
_isGnapPhoning = false;
}
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 kHS53Device:
if (gnap._actionStatus < 0) {
_vm->runMenu();
updateHotspots();
}
break;
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);
debugC(kDebugBasic, "phoneNumber: %d", phoneNumber);
if (phoneNumberLen == 7) {
gnap._actionStatus = 1;
if (_vm->isFlag(kGFSpringTaken)) {
gameSys.setAnimation(0x73, 40, 6);
gameSys.insertSequence(0x73, 40, _currHandSequenceId, 40, kSeqSyncWait, 0, 0, 0);
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
_currHandSequenceId = 0x73;
gnap._actionStatus = -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 kHS53PhoneKeySharp:
case kHS53PhoneKeyStar:
pressPhoneNumberButton(0, _vm->_sceneClickedHotspot - 1);
break;
case kHS53PhoneExit:
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);
while (gameSys.getAnimationStatus(6) != 2 && !_vm->_gameDone) {
_vm->updateMouseCursor();
_vm->gameUpdateTick();
}
_currHandSequenceId = 0x73;
gnap._actionStatus = -1;
}
_vm->_isLeavingScene = true;
_vm->_sceneDone = true;
gnap._actionStatus = 0;
_vm->_newSceneNum = 17;
}
break;
default:
break;
}
_vm->checkGameKeys();
if (_vm->isKeyStatus1(Common::KEYCODE_BACKSPACE)) {
_vm->clearKeyStatus1(Common::KEYCODE_BACKSPACE);
_vm->runMenu();
updateHotspots();
}
_vm->gameUpdateTick();
}
}
} // End of namespace Gnap

View File

@@ -0,0 +1,76 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_GROUP5_H
#define GNAP_GROUP5_H
#include "gnap/debugger.h"
#include "gnap/scenes/scenecore.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
};
/*****************************************************************************/
class GnapEngine;
class Scene53: public Scene {
public:
Scene53(GnapEngine *vm);
~Scene53() override {}
int init() override;
void updateHotspots() override;
void run() override;
void updateAnimations() override {};
void updateAnimationsCb() override {};
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

View File

@@ -0,0 +1,429 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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

View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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() override {}
int init() override;
};
class Scene471: public CutScene {
public:
Scene471(GnapEngine *vm);
~Scene471() override {}
int init() override;
};
class Scene472: public CutScene {
public:
Scene472(GnapEngine *vm);
~Scene472() override {}
int init() override;
};
class Scene473: public CutScene {
public:
Scene473(GnapEngine *vm);
~Scene473() override {}
int init() override;
};
class Scene474: public CutScene {
public:
Scene474(GnapEngine *vm);
~Scene474() override {}
int init() override;
};
class Scene475: public CutScene {
public:
Scene475(GnapEngine *vm);
~Scene475() override {}
int init() override;
};
class Scene476: public CutScene {
public:
Scene476(GnapEngine *vm);
~Scene476() override {}
int init() override;
};
class Scene477: public CutScene {
public:
Scene477(GnapEngine *vm);
~Scene477() override {}
int init() override;
};
class Scene48: public CutScene {
public:
Scene48(GnapEngine *vm);
~Scene48() override {}
int init() override;
};
class Scene541: public CutScene {
public:
Scene541(GnapEngine *vm);
~Scene541() override {}
int init() override;
};
class Scene542: public CutScene {
public:
Scene542(GnapEngine *vm);
~Scene542() override {}
int init() override;
};
} // End of namespace Gnap
#endif // GNAP_GROUPCS_H

View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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};
GameSys& gameSys = *_vm->_gameSys;
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 {
Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getScreenFormat());
// The intro AVI is played upside down, it's the only video played in the English version
for (uint16 y = 0; y < frame1->h / 2; y++) {
uint32 *ptrFrom = (uint32 *)frame1->getBasePtr(0, y);
uint32 *ptrTo = (uint32 *)frame1->getBasePtr(0, frame1->h - y - 1);
// in this else branch, bytesPerPixel equals 4
for (uint16 x = 0; x < frame1->pitch / 4; x++) {
uint32 t = *ptrFrom;
*ptrFrom = *ptrTo;
*ptrTo = t;
ptrFrom++;
ptrTo++;
}
}
_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;
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 (gameSys.getAnimationStatus(0) == 2 || skip ) {
skip = false;
gameSys.requestClear2(false);
gameSys.requestClear1();
if ( index == 11 || index == 1 )
_vm->screenEffect(0, 0, 0, 0);
gameSys.setAnimation(0, 0, 0);
if (++index >= 31)
_vm->_sceneDone = true;
else {
gameSys.insertSequence(animIdArr[index], 2, 0, 0, kSeqNone, 0, 0, 0);
if (index == 2) {
_vm->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);
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)
_vm->stopSound(0x10000);
}
}
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(Common::KEYCODE_RETURN);
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

View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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() override {}
int init() override;
void updateHotspots() override {}
void run() override;
void updateAnimations() override {}
void updateAnimationsCb() override {}
};
} // End of namespace Gnap
#endif // GNAP_INTRO_H

View File

@@ -0,0 +1,745 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "gnap/gnap.h"
#include "gnap/gamesys.h"
#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"
namespace Gnap {
int GnapEngine::initSceneLogic() {
int backgroundId = -1;
switch (_currentSceneNum) {
case 0:
_scene = new SceneIntro(this);
backgroundId = _scene->init();
_gameSys->setScaleValues(0, 500, 1, 1000);
break;
case 1:
_scene = new Scene01(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
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:
_scene = new Scene03(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 4:
_scene = new Scene04(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 5:
_scene = new Scene05(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 6:
_scene = new Scene06(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 7:
_scene = new Scene07(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 8:
_scene = new Scene08(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 9:
_scene = new Scene09(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 10:
_scene = new Scene10(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 11:
_scene = new Scene11(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 12:
_scene = new Scene12(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 13:
_scene = new Scene13(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 14:
_scene = new Scene14(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
break;
case 15:
_scene = new Scene15(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
break;
case 16:
case 47:
case 48:
case 54:
backgroundId = -1;
_gameSys->setScaleValues(0, 500, 1, 1000);
break;
case 17:
_scene = new Scene17(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 18:
_scene = new Scene18(this);
backgroundId = _scene->init();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
_scene->updateHotspots();
break;
case 19:
_scene = new Scene19(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 20:
_scene = new Scene20(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 21:
_scene = new Scene21(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 22:
_scene = new Scene22(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 23:
_scene = new Scene23(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 24:
_scene = new Scene24(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 136, 11, 10);
break;
case 25:
_scene = new Scene25(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 26:
_scene = new Scene26(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 27:
_scene = new Scene27(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 28:
_scene = new Scene28(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 29:
_scene = new Scene29(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 30:
_scene = new Scene30(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 31:
_scene = new Scene31(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 32:
_scene = new Scene32(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 33:
_scene = new Scene33(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 34:
_scene = new Scene03(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 35:
_scene = new Scene05(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 36:
_scene = new Scene06(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 37:
_scene = new Scene04(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 38:
_scene = new Scene38(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 39:
_scene = new Scene39(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 40:
_scene = new Scene40(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 41:
_scene = new Scene41(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 42:
_scene = new Scene42(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 43:
_scene = new Scene43(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 44:
_scene = new Scene44(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 45:
_scene = new Scene45(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 46:
_scene = new Scene46(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 49:
_scene = new Scene49(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 50:
_scene = new Scene50(this);
backgroundId = _scene->init();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 51:
_scene = new Scene51(this);
backgroundId = _scene->init();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 52:
_scene = new Scene52(this);
backgroundId = _scene->init();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
case 53:
_scene = new Scene53(this);
backgroundId = _scene->init();
_scene->updateHotspots();
_gameSys->setScaleValues(0, 500, 1, 1000);
initSceneGrid(21, 146, 11, 10);
break;
default:
break;
}
return backgroundId;
}
void GnapEngine::runSceneLogic() {
switch (_currentSceneNum) {
case 0:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 8;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 4;
break;
case 7:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 8;
break;
case 8:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 9;
break;
case 9:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_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 14:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 13;
break;
case 16:
_scene = new Scene16(this);
_scene->init();
_newSceneNum = 17;
_newCursorValue = 3;
_scene->run();
delete _scene;
break;
case 17:
case 18:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
_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 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 37;
break;
case 47:
if (_prevSceneNum == 49) {
_scene = new Scene471(this);
_scene->init();
_newSceneNum = 7;
_newCursorValue = 2;
} else if (_prevSceneNum == 13) {
_scene = new Scene472(this);
_scene->init();
_newSceneNum = 11;
} else if (!isFlag(kGFPlatypusDisguised) && _prevSceneNum == 2) {//CHECKME
if (isFlag(kGFUnk25)) {
_scene = new Scene473(this);
_scene->init();
_newSceneNum = 2;
} else {
_scene = new Scene474(this);
_scene->init();
_newSceneNum = 49;
}
} else if (_prevSceneNum == 21) {
_scene = new Scene475(this);
_scene->init();
_newSceneNum = 21;
setFlag(kGFTwigTaken);
setFlag(kGFKeysTaken);
} else if (_prevSceneNum == 30) {
_scene = new Scene476(this);
_scene->init();
_newSceneNum = 26;
} else if (isFlag(kGFPlatypusDisguised) && _cursorValue == 1) {
_scene = new Scene477(this);
_scene->init();
_newSceneNum = 4;
}
_scene->run();
delete _scene;
break;
case 48:
_scene = new Scene48(this);
_scene->init();
_newSceneNum = 33;
_newCursorValue = 4;
_scene->run();
delete _scene;
break;
case 49:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 47;
break;
case 50:
_scene->run();
delete _scene;
_newSceneNum = _prevSceneNum;
break;
case 51:
_scene->run();
delete _scene;
break;
case 52:
_scene->run();
delete _scene;
_newSceneNum = _prevSceneNum;
break;
case 53:
_scene->run();
delete _scene;
if (_newSceneNum == 55)
_newSceneNum = 53;
break;
case 54:
if (_prevSceneNum == 45) {
_scene = new Scene541(this);
_scene->init();
_newSceneNum = 43;
_scene->run();
delete _scene;
} else {
_scene = new Scene542(this);
_scene->init();
_scene->run();
delete _scene;
_gameDone = true;
}
break;
default:
break;
}
}
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;
default:
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;
}
/****************************************************************************/
CutScene::CutScene(GnapEngine *vm) : Scene(vm) {
_itemsCount = -1;
for (int i = 0; i < 16; i++) {
_resourceIdArr[i] = -1;
_sequenceCountArr[i] = -1;
_canSkip[i] = false;
}
for (int i = 0; i < 50; i++)
_sequenceIdArr[i] = -1;
}
void CutScene::run() {
GameSys& gameSys = *_vm->_gameSys;
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(_sequenceIdArr[_itemsCount - 1]));
_vm->_timers[0] = 0;
}
if (soundId != -1)
_vm->playSound(soundId, false);
_vm->hideCursor();
gameSys.drawSpriteToBackground(0, 0, _resourceIdArr[0]);
for (int j = 0; j < _sequenceCountArr[0]; ++j)
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);
_vm->clearKeyStatus1(Common::KEYCODE_RETURN);
_vm->_mouseClickState._left = false;
int firstSequenceIndex = 0;
while (!_vm->_sceneDone) {
_vm->gameUpdateTick();
if (gameSys.getAnimationStatus(0) == 2 || skip) {
skip = false;
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)
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);
}
}
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(Common::KEYCODE_RETURN);
if (_canSkip[itemIndex])
skip = true;
else
_vm->_sceneDone = true;
}
if (!_vm->_timers[0] && itemIndex == _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

View File

@@ -0,0 +1,69 @@
/* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GNAP_SCENECORE_H
#define GNAP_SCENECORE_H
#include "gnap/debugger.h"
namespace Gnap {
class GnapEngine;
class Scene {
public:
Scene(GnapEngine *vm) : _vm(vm) {};
virtual ~Scene() {};
void playRandomSound(int timerIndex);
bool clearKeyStatus();
virtual int init() = 0;
virtual void updateHotspots() = 0;
virtual void run() = 0;
virtual void updateAnimations() = 0;
virtual void updateAnimationsCb() = 0;
protected:
GnapEngine *_vm;
};
class CutScene : public Scene {
public:
CutScene(GnapEngine *vm);
~CutScene() override {};
int init() override = 0;
void updateHotspots() override {}
void run() override;
void updateAnimations() override {}
void updateAnimationsCb() override {}
protected:
int _itemsCount;
int _resourceIdArr[16];
int _sequenceCountArr[16];
int _sequenceIdArr[50];
bool _canSkip[16];
};
} // End of namespace Gnap
#endif // GNAP_SCENECORE_H

101
engines/gnap/sound.cpp Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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)
return;
_vm->_soundCache->release(_items[index]._resourceId);
_vm->_mixer->stopHandle(_items[index]._handle);
_items.remove_at(index);
}
void SoundMan::setSoundVolume(int resourceId, int volume) {
if (resourceId == -1 || volume < 0 || volume > 100)
return;
const int index = find(resourceId);
if (index < 0)
return;
int realVol = volume * 2.55;
_vm->_mixer->setChannelVolume(_items[index]._handle, realVol);
}
bool SoundMan::isSoundPlaying(int resourceId) {
const int index = find(resourceId);
if (index < 0)
return false;
return _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

56
engines/gnap/sound.h Normal file
View File

@@ -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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#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<SoundItem> _items;
int find(int resourceId);
};
} // End of namespace Gnap
#endif // GNAP_SOUND_H