aboutsummaryrefslogtreecommitdiff
path: root/engines/access
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-05 22:17:30 -0400
committerPaul Gilbert2014-08-05 22:17:30 -0400
commit7d605ce57316c86a247cf978e6b123b23045659c (patch)
treed6fb956e8aa56fb2a1579c09211f8f6a3c696d70 /engines/access
parentf1309a7b0b7e98256b45e9977c62f040452d54c4 (diff)
downloadscummvm-rg350-7d605ce57316c86a247cf978e6b123b23045659c.tar.gz
scummvm-rg350-7d605ce57316c86a247cf978e6b123b23045659c.tar.bz2
scummvm-rg350-7d605ce57316c86a247cf978e6b123b23045659c.zip
ACCESS: Implement outer room handler
Diffstat (limited to 'engines/access')
-rw-r--r--engines/access/access.cpp13
-rw-r--r--engines/access/access.h10
-rw-r--r--engines/access/amazon/amazon_game.cpp6
-rw-r--r--engines/access/data.cpp17
-rw-r--r--engines/access/data.h28
-rw-r--r--engines/access/events.h2
-rw-r--r--engines/access/module.mk2
-rw-r--r--engines/access/player.cpp53
-rw-r--r--engines/access/player.h71
-rw-r--r--engines/access/room.cpp130
-rw-r--r--engines/access/room.h53
-rw-r--r--engines/access/screen.cpp25
-rw-r--r--engines/access/screen.h15
-rw-r--r--engines/access/sound.cpp5
-rw-r--r--engines/access/sound.h2
15 files changed, 378 insertions, 54 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 2a61a8ff8a..fa1775feca 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -34,6 +34,8 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_debugger = nullptr;
_events = nullptr;
_files = nullptr;
+ _player = nullptr;
+ _room = nullptr;
_screen = nullptr;
_sound = nullptr;
@@ -59,6 +61,10 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_startInvBox = 0;
_startAboutBox = 0;
_startTravelBox = 0;
+ _numImages = 0;
+ _nextImage = 0;
+ _numAnimTimers = 0;
+ _startup = 0;
_roomNumber = 0;
_rawPlayerXLow = 0;
@@ -110,6 +116,8 @@ AccessEngine::~AccessEngine() {
delete _debugger;
delete _events;
delete _files;
+ delete _player;
+ delete _room;
delete _screen;
delete _sound;
@@ -130,6 +138,7 @@ void AccessEngine::initialize() {
_debugger = new Debugger(this);
_events = new EventsManager(this);
_files = new FileManager(this);
+ _player = new Player(this);
_screen = new Screen(this);
_sound = new SoundManager(this, _mixer);
@@ -170,8 +179,4 @@ 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 869441e96b..fce6c443f4 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -34,6 +34,8 @@
#include "access/debugger.h"
#include "access/events.h"
#include "access/files.h"
+#include "access/player.h"
+#include "access/room.h"
#include "access/screen.h"
#include "access/sound.h"
@@ -103,6 +105,8 @@ public:
Debugger *_debugger;
EventsManager *_events;
FileManager *_files;
+ Player *_player;
+ Room *_room;
Screen *_screen;
SoundManager *_sound;
@@ -110,12 +114,16 @@ public:
Graphics::Surface _buffer1;
Graphics::Surface _buffer2;
byte *_objectsTable[100];
+ int _numAnimTimers;
Common::Array<TimerEntry> _timers;
- Player _player;
+ Common::Array<Common::Rect> _newRect;
+ Common::Array<Common::Rect> _oldRect;
int _pCount;
int _selectCommand;
bool _normalMouse;
int _mouseMode;
+ int _numImages;
+ int _nextImage;
int _currentManOld;
byte *_man1;
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 6eef2cf93e..8cbd0767b2 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -62,7 +62,7 @@ void AmazonEngine::playGame() {
_screen->forceFadeOut();
_events->showCursor();
- doRoom();
+ _room->doRoom();
}
void AmazonEngine::doIntroduction() {
@@ -157,8 +157,8 @@ void AmazonEngine::setupGame() {
// Set miscellaneous fields
_roomNumber = 4;
- _player._playerX = _rawPlayerX = TRAVEL_POS[_roomNumber][0];
- _player._playerY = _rawPlayerY = TRAVEL_POS[_roomNumber][1];
+ _player->_playerX = _rawPlayerX = TRAVEL_POS[_roomNumber][0];
+ _player->_playerY = _rawPlayerY = TRAVEL_POS[_roomNumber][1];
_selectCommand = -1;
}
diff --git a/engines/access/data.cpp b/engines/access/data.cpp
index e5ee1e1e7f..0ef1845892 100644
--- a/engines/access/data.cpp
+++ b/engines/access/data.cpp
@@ -25,22 +25,5 @@
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
index 069d543cb8..7e10e992d9 100644
--- a/engines/access/data.h
+++ b/engines/access/data.h
@@ -39,34 +39,6 @@ struct TimerEntry {
}
};
-#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/events.h b/engines/access/events.h
index 3cf610ece6..2e6b06b5e2 100644
--- a/engines/access/events.h
+++ b/engines/access/events.h
@@ -45,12 +45,12 @@ private:
AccessEngine *_vm;
uint32 _frameCounter;
uint32 _priorFrameTime;
- Common::Point _mousePos;
void checkForNextFrameCounter();
public:
CursorType _cursorId;
bool _leftButton;
+ Common::Point _mousePos;
public:
/**
* Constructor
diff --git a/engines/access/module.mk b/engines/access/module.mk
index bab2476a4a..791abcc861 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -9,7 +9,9 @@ MODULE_OBJS := \
detection.o \
events.o \
files.o \
+ player.o \
resources.o \
+ room.o \
screen.o \
sound.o \
amazon\amazon_game.o
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
new file mode 100644
index 0000000000..f7429bd9b5
--- /dev/null
+++ b/engines/access/player.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "access/player.h"
+#include "common/algorithm.h"
+#include "common/textconsole.h"
+
+namespace Access {
+
+Player::Player(AccessEngine *vm): _vm(vm) {
+ _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;
+
+ _playerOff = false;
+}
+
+void Player::walk() {
+ warning("TODO: Player::walk");
+}
+
+} // End of namespace Access
diff --git a/engines/access/player.h b/engines/access/player.h
new file mode 100644
index 0000000000..94ae9872b5
--- /dev/null
+++ b/engines/access/player.h
@@ -0,0 +1,71 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can 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_PLAYER_H
+#define ACCESS_PLAYER_H
+
+#include "common/scummsys.h"
+#include "common/rect.h"
+
+namespace Access {
+
+#define PLAYER_DATA_COUNT 8
+
+class AccessEngine;
+
+class Player {
+private:
+ AccessEngine *_vm;
+public:
+ // Fields in original Player structure
+ 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;
+
+ // Additional globals we've added to new Player class
+ bool _playerOff;
+public:
+ Player(AccessEngine *vm);
+
+ void walk();
+};
+
+} // End of namespace Access
+
+#endif /* ACCESS_PLAYER_H */
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
new file mode 100644
index 0000000000..25d3584ede
--- /dev/null
+++ b/engines/access/room.cpp
@@ -0,0 +1,130 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "access/access.h"
+#include "access/room.h"
+
+namespace Access {
+
+Room::Room(AccessEngine *vm) : _vm(vm) {
+ _function = 0;
+}
+
+void Room::doRoom() {
+ bool reloadFlag = false;
+
+ while (!_vm->shouldQuit()) {
+ if (!reloadFlag) {
+ _vm->_numImages = 0;
+ _vm->_newRect.clear();
+ _vm->_oldRect.clear();
+ _vm->_nextImage = 0;
+ _vm->_numAnimTimers = 0;
+ }
+
+ reloadFlag = false;
+ _vm->_startup = 0;
+ _function = 0;
+
+ while (!_vm->shouldQuit()) {
+ _vm->_numImages = 0;
+ if (_vm->_startup != -1 && --_vm->_startup != 0) {
+ --_vm->_startup;
+ _vm->_events->showCursor();
+ _vm->_screen->fadeIn();
+ }
+
+ _vm->_events->pollEvents();
+ _vm->_nextImage = 0;
+ _vm->_player->walk();
+ _vm->_sound->midiRepeat();
+ _vm->_screen->checkScroll();
+ doCommands();
+
+ // DOROOMFLASHBACK jump point
+ if (_function == 1) {
+ clearRoom();
+ break;
+ } else if (_function == 2) {
+ clearRoom();
+ return;
+ } else if (_function == 3) {
+ reloadRoom1();
+ reloadFlag = true;
+ break;
+ } else if (_function == 4) {
+ break;
+ }
+
+ if (_vm->_screen->_scrollFlag) {
+ _vm->_screen->copyBF1BF2();
+ _vm->_newRect.clear();
+ _function = 0;
+ roomLoop();
+
+ if (_function == 1) {
+ clearRoom();
+ break;
+ } else {
+ _vm->_screen->plotList();
+ _vm->_screen->copyRects();
+
+ _vm->_screen->copyBF2Vid();
+ }
+ } else {
+ _vm->_screen->copyBF1BF2();
+ _vm->_newRect.clear();
+ _function = 0;
+ roomLoop();
+
+ if (_function == 1) {
+ clearRoom();
+ break;
+ } else {
+ _vm->_screen->plotList();
+ _vm->_screen->copyBlocks();
+ }
+ }
+ }
+ }
+}
+
+void Room::clearRoom() {
+ // TODO
+}
+
+void Room::reloadRoom1() {
+ // TODO
+}
+
+void Room::roomLoop() {
+ // TODO
+}
+
+
+void Room::doCommands() {
+
+}
+
+
+} // End of namespace Access
diff --git a/engines/access/room.h b/engines/access/room.h
new file mode 100644
index 0000000000..3b1a3347f9
--- /dev/null
+++ b/engines/access/room.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ACCESS_ROOM_H
+#define ACCESS_ROOM_H
+
+#include "common/scummsys.h"
+
+namespace Access {
+
+class AccessEngine;
+
+class Room {
+private:
+ AccessEngine *_vm;
+
+ void roomLoop();
+public:
+ int _function;
+public:
+ Room(AccessEngine *vm);
+
+ void doRoom();
+
+ void doCommands();
+
+ void clearRoom();
+
+ void reloadRoom1();
+};
+
+} // End of namespace Access
+
+#endif /* ACCESS_ROOM_H */
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 591bb67a7f..8c87638937 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -41,6 +41,7 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) {
_leftSkip = _rightSkip = 0;
_topSkip = _bottomSkip = 0;
_clipWidth = _clipHeight = 0;
+ _scrollFlag = false;
}
void Screen::setDisplayScan() {
@@ -182,4 +183,28 @@ bool Screen::clip(Common::Rect &r) {
return false;
}
+void Screen::checkScroll() {
+ // TODO
+}
+
+void Screen::copyBF1BF2() {
+ // TODO
+}
+
+void Screen::copyBF2Vid() {
+ // TODO
+}
+
+void Screen::plotList() {
+ // TODO
+}
+
+void Screen::copyBlocks() {
+ // TODO
+}
+
+void Screen::copyRects() {
+ // TODO
+}
+
} // End of namespace Access
diff --git a/engines/access/screen.h b/engines/access/screen.h
index 295372770a..5f9fff058e 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -57,6 +57,7 @@ private:
bool clip(Common::Rect &r);
public:
bool _loadPalFlag;
+ bool _scrollFlag;
public:
Screen(AccessEngine *vm);
@@ -79,6 +80,8 @@ public:
*/
void forceFadeIn();
+ void fadeOut() { forceFadeOut(); }
+ void fadeIn() { forceFadeIn(); }
void clearScreen() { clearBuffer(); }
/**
@@ -94,6 +97,18 @@ public:
void copyBuffer(const byte *data);
void plotImage(const byte *pData, int idx, const Common::Point &pt);
+
+ void checkScroll();
+
+ void copyBF1BF2();
+
+ void copyBF2Vid();
+
+ void plotList();
+
+ void copyBlocks();
+
+ void copyRects();
};
} // End of namespace Access
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 5375485695..2a008d8c53 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -64,4 +64,9 @@ void SoundManager::playSound(byte *data, uint32 size) {
*/
}
+void SoundManager::midiRepeat() {
+ // TODO
+}
+
+
} // End of namespace Access
diff --git a/engines/access/sound.h b/engines/access/sound.h
index d3d5052c0e..613eca49ab 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -55,6 +55,8 @@ public:
void queueSound(int idx, int fileNum, int subfile);
void playSound(int soundIndex);
+
+ void midiRepeat();
};
} // End of namespace Access