aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/access/access.cpp16
-rw-r--r--engines/access/access.h21
-rw-r--r--engines/access/amazon/amazon_game.cpp54
-rw-r--r--engines/access/amazon/amazon_game.h10
-rw-r--r--engines/access/data.cpp46
-rw-r--r--engines/access/data.h72
-rw-r--r--engines/access/module.mk1
-rw-r--r--engines/access/resources.cpp69
-rw-r--r--engines/access/resources.h2
9 files changed, 274 insertions, 17 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index fdf6cd03b0..2a61a8ff8a 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -38,8 +38,11 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_sound = nullptr;
_destIn = nullptr;
- _objectsTable = nullptr;
+ clearCellTable();
_pCount = 0;
+ _selectCommand = 0;
+ _normalMouse = true;
+ _mouseMode = 0;
_currentMan = 0;
_currentManOld = -1;
_man1 = nullptr;
@@ -57,7 +60,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_startAboutBox = 0;
_startTravelBox = 0;
- _startData = 0;
+ _roomNumber = 0;
_rawPlayerXLow = 0;
_rawPlayerX = 0;
_rawPlayerYLow = 0;
@@ -112,7 +115,6 @@ AccessEngine::~AccessEngine() {
_buffer1.free();
_buffer2.free();
- delete[] _objectsTable;
}
void AccessEngine::setVGA() {
@@ -164,4 +166,12 @@ int AccessEngine::getRandomNumber(int maxNumber) {
return _randomSource.getRandomNumber(maxNumber);
}
+void AccessEngine::clearCellTable() {
+ Common::fill(&_objectsTable[0], &_objectsTable[100], (byte *)nullptr);
+}
+
+void AccessEngine::doRoom() {
+ // TODO
+}
+
} // End of namespace Access
diff --git a/engines/access/access.h b/engines/access/access.h
index fd95c912bc..869441e96b 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -30,6 +30,7 @@
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
+#include "access/data.h"
#include "access/debugger.h"
#include "access/events.h"
#include "access/files.h"
@@ -63,7 +64,6 @@ enum AccessDebugChannels {
struct AccessGameDescription;
-
class AccessEngine : public Engine {
private:
/**
@@ -81,6 +81,16 @@ protected:
const AccessGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+ /**
+ * Clear the cell table
+ */
+ void clearCellTable();
+
+ /**
+ * Main handler for showing game rooms
+ */
+ void doRoom();
+
// Engine APIs
virtual Common::Error run();
virtual bool hasFeature(EngineFeature f) const;
@@ -99,8 +109,13 @@ public:
byte *_destIn;
Graphics::Surface _buffer1;
Graphics::Surface _buffer2;
- byte *_objectsTable;
+ byte *_objectsTable[100];
+ Common::Array<TimerEntry> _timers;
+ Player _player;
int _pCount;
+ int _selectCommand;
+ bool _normalMouse;
+ int _mouseMode;
int _currentManOld;
byte *_man1;
@@ -119,7 +134,7 @@ public:
int _startTravelBox;
// Fields that are included in savegames
- int _startData;
+ int _roomNumber;
int _rawPlayerXLow;
int _rawPlayerX;
int _rawPlayerYLow;
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 068d3bf6f8..6eef2cf93e 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -21,6 +21,7 @@
*/
#include "access/amazon/amazon_game.h"
+#include "access/resources.h"
namespace Access {
@@ -49,11 +50,30 @@ AmazonEngine::~AmazonEngine() {
}
void AmazonEngine::playGame() {
+ doIntroduction();
+ if (shouldQuit())
+ return;
+
+ // Setup the game
+ setupGame();
+
+ _screen->clearScreen();
+ _screen->setPanel(0);
+ _screen->forceFadeOut();
+
+ _events->showCursor();
+ doRoom();
+}
+
+void AmazonEngine::doIntroduction() {
_screen->setInitialPalettte();
_events->setCursor(CURSOR_0);
_events->showCursor();
_screen->setPanel(0);
-
+
+ // TODO: Worry about implementing full intro sequence later
+ return;
+
doTitle();
if (shouldQuit())
return;
@@ -72,14 +92,6 @@ void AmazonEngine::playGame() {
}
doTitle();
- if (shouldQuit())
- return;
-
- _screen->clearScreen();
- _screen->setPanel(0);
- _screen->forceFadeOut();
-
-
}
void AmazonEngine::doTitle() {
@@ -100,7 +112,7 @@ void AmazonEngine::doTitle() {
_screen->forceFadeIn();
_sound->playSound(1);
- _objectsTable = _files->loadFile(0, 2);
+ _objectsTable[0] = _files->loadFile(0, 2);
_sound->playSound(1);
_screen->_loadPalFlag = false;
@@ -116,7 +128,7 @@ void AmazonEngine::doTitle() {
_buffer2.copyFrom(_buffer1);
int id = READ_LE_UINT16(COUNTDOWN + _pCount * 4);
int xp = READ_LE_UINT16(COUNTDOWN + _pCount * 4 + 2);
- _screen->plotImage(_objectsTable, id, Common::Point(xp, 71));
+ _screen->plotImage(_objectsTable[0], id, Common::Point(xp, 71));
}
// TODO: More to do
}
@@ -129,6 +141,26 @@ void AmazonEngine::doTent() {
// TODO
}
+void AmazonEngine::setupGame() {
+ _chapter = 1;
+ clearCellTable();
+
+ // Setup timers
+ const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 };
+ for (int i = 0; i < 32; ++i) {
+ TimerEntry te;
+ te._initTm = te._timer = (i < 8) ? TIMER_DEFAULTS[i] : 1;
+ te._flag = true;
+
+ _timers.push_back(te);
+ }
+
+ // Set miscellaneous fields
+ _roomNumber = 4;
+ _player._playerX = _rawPlayerX = TRAVEL_POS[_roomNumber][0];
+ _player._playerY = _rawPlayerY = TRAVEL_POS[_roomNumber][1];
+ _selectCommand = -1;
+}
} // End of namespace Amazon
diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h
index 1b5397b033..b998b1de83 100644
--- a/engines/access/amazon/amazon_game.h
+++ b/engines/access/amazon/amazon_game.h
@@ -48,6 +48,10 @@ private:
int _inactiveYOff;
int _esTabTable[100];
+ /**
+ * Do the game introduction
+ */
+ void doIntroduction();
/**
* Do title sequence
@@ -63,6 +67,12 @@ private:
* Do tent scene of introduction
*/
void doTent();
+
+ /**
+ * Setup variables for the game
+ */
+ void setupGame();
+
protected:
/**
* Play the game
diff --git a/engines/access/data.cpp b/engines/access/data.cpp
new file mode 100644
index 0000000000..e5ee1e1e7f
--- /dev/null
+++ b/engines/access/data.cpp
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "access/data.h"
+#include "common/algorithm.h"
+
+namespace Access {
+
+Player::Player() {
+ _field0 = 0;
+ _monData = nullptr;
+ Common::fill(&_walkOffRight[0], &_walkOffRight[PLAYER_DATA_COUNT], 0);
+ Common::fill(&_walkOffLeft[0], &_walkOffLeft[PLAYER_DATA_COUNT], 0);
+ Common::fill(&_walkOffUp[0], &_walkOffUp[PLAYER_DATA_COUNT], 0);
+ Common::fill(&_walkOffDown[0], &_walkOffDown[PLAYER_DATA_COUNT], 0);
+ _rawTempL = 0;
+ _rawXTemp = 0;
+ _rawYTempL = 0;
+ _rawYTemp = 0;
+ _playerXLow = 0;
+ _playerX = 0;
+ _playerYLow = 0;
+ _playerY = 0;
+ _frame = 0;
+}
+
+} // End of namespace Access
diff --git a/engines/access/data.h b/engines/access/data.h
new file mode 100644
index 0000000000..069d543cb8
--- /dev/null
+++ b/engines/access/data.h
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ACCESS_DATA_H
+#define ACCESS_DATA_H
+
+#include "common/scummsys.h"
+#include "common/rect.h"
+
+namespace Access {
+
+struct TimerEntry {
+ int _initTm;
+ int _timer;
+ bool _flag;
+
+ TimerEntry() {
+ _initTm = _timer = 0;
+ _flag = false;
+ }
+};
+
+#define PLAYER_DATA_COUNT 8
+
+class Player {
+public:
+ int _field0;
+ byte *_monData;
+ int _walkOffRight[PLAYER_DATA_COUNT];
+ int _walkOffLeft[PLAYER_DATA_COUNT];
+ int _walkOffUp[PLAYER_DATA_COUNT];
+ int _walkOffDown[PLAYER_DATA_COUNT];
+ Common::Point _walkOffUR[PLAYER_DATA_COUNT];
+ Common::Point _walkOffDR[PLAYER_DATA_COUNT];
+ Common::Point _walkOffUL[PLAYER_DATA_COUNT];
+ Common::Point _walkOffDL[PLAYER_DATA_COUNT];
+ int _rawTempL;
+ int _rawXTemp;
+ int _rawYTempL;
+ int _rawYTemp;
+ Common::Point _playerOffset;
+ int _playerXLow;
+ int _playerX;
+ int _playerYLow;
+ int _playerY;
+ int _frame;
+public:
+ Player();
+};
+
+} // End of namespace Access
+
+#endif /* ACCESS_DATA_H */
diff --git a/engines/access/module.mk b/engines/access/module.mk
index ff4cedbdc6..bab2476a4a 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/access
MODULE_OBJS := \
asurface.o \
access.o \
+ data.o \
debugger.o \
decompress.o \
detection.o \
diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp
index a47abf2b06..70d4a698b1 100644
--- a/engines/access/resources.cpp
+++ b/engines/access/resources.cpp
@@ -198,6 +198,75 @@ const byte CURSHELP[] = {
0x22, 0x22, 0x22, 0x20, 0x05, 0x04, 0x20, 0x20, 0x20, 0x20
};
+const int TRAVEL_POS[][2] = {
+ { -1, 0 },
+ { 228, 117 },
+ { 28, 98 },
+ { 161, 140 },
+ { 130, 139 },
+ { 884, 95 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 41, 185 },
+ { 60, 138 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 170, 155 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 108, 95 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 100, 115 },
+ { 480, 90 },
+ { 154, 63 },
+ { 0, 0 },
+ { 145, 85 },
+ { 0, 0 },
+ { 110, 107 },
+ { 0, 0 },
+ { 105, 154 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 20, 160 },
+ { 130, 314 },
+ { 0, 0 },
+ { 50, 125 },
+ { 0, 0 },
+ { 0, 0 },
+ { 123, 123 },
+ { -1, 7 },
+ { 266, 168 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { -1, 18 },
+ { -1, 19 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 203, 160 },
+ { 0, 0 },
+ { 283, 163 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 },
+ { 180, 165 },
+ { 0, 0 },
+ { 0, 0 },
+ { 0, 0 }
+};
+
} // End of namespace Amazon
} // End of namespace Access
diff --git a/engines/access/resources.h b/engines/access/resources.h
index ba335cd0ec..e73088102d 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -46,6 +46,8 @@ extern const byte CURSHELP[];
extern const byte *CURSORS[10];
+extern const int TRAVEL_POS[][2];
+
} // End of namespace Amazon
} // End of namespace Access