aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-11-25 07:47:19 -0500
committerPaul Gilbert2014-12-12 22:44:43 -0500
commitcc8a8bfdddaf66f6c3b8a7ac049a05b6877eb973 (patch)
tree3dc41676034ad9ac3346c62870450b3b4edc1ffb /engines
parenta8c99d1986a902aaf65c760b365c49cce2174e30 (diff)
downloadscummvm-rg350-cc8a8bfdddaf66f6c3b8a7ac049a05b6877eb973.tar.gz
scummvm-rg350-cc8a8bfdddaf66f6c3b8a7ac049a05b6877eb973.tar.bz2
scummvm-rg350-cc8a8bfdddaf66f6c3b8a7ac049a05b6877eb973.zip
ACCESS: Refactored Amazon specific player loading into new AmazonPlayer class
Diffstat (limited to 'engines')
-rw-r--r--engines/access/access.cpp2
-rw-r--r--engines/access/amazon/amazon_player.cpp86
-rw-r--r--engines/access/amazon/amazon_player.h48
-rw-r--r--engines/access/amazon/amazon_resources.cpp13
-rw-r--r--engines/access/amazon/amazon_resources.h13
-rw-r--r--engines/access/animation.cpp4
-rw-r--r--engines/access/module.mk1
-rw-r--r--engines/access/player.cpp115
-rw-r--r--engines/access/player.h8
-rw-r--r--engines/access/resources.cpp12
-rw-r--r--engines/access/resources.h12
11 files changed, 210 insertions, 104 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index cdabb323e4..88c62a74a7 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -165,7 +165,7 @@ void AccessEngine::initialize() {
_events = new EventsManager(this);
_files = new FileManager(this);
_inventory = new InventoryManager(this);
- _player = new Player(this);
+ _player = Player::init(this);
_screen = new Screen(this);
_sound = new SoundManager(this, _mixer);
_video = new VideoPlayer(this);
diff --git a/engines/access/amazon/amazon_player.cpp b/engines/access/amazon/amazon_player.cpp
new file mode 100644
index 0000000000..ede7ab58e2
--- /dev/null
+++ b/engines/access/amazon/amazon_player.cpp
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can 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"
+#include "access/amazon/amazon_game.h"
+#include "access/amazon/amazon_player.h"
+#include "access/amazon/amazon_resources.h"
+
+namespace Access {
+
+namespace Amazon {
+
+AmazonPlayer::AmazonPlayer(AccessEngine *vm) : Player(vm) {
+ _game = (AmazonEngine *)vm;
+}
+
+void AmazonPlayer::load() {
+ Player::load();
+
+ // Special scene setup for the top-down view when on the Slaver ship
+ if (_vm->_room->_roomFlag == 3) {
+ _playerOffset.x = _vm->_screen->_scaleTable1[8];
+ _playerOffset.y = _vm->_screen->_scaleTable1[11];
+ _leftDelta = 0;
+ _rightDelta = 8;
+ _upDelta = 2;
+ _downDelta = -2;
+ _scrollConst = 2;
+
+ for (int i = 0; i < PLAYER_DATA_COUNT; ++i) {
+ _walkOffRight[i] = OVEROFFR[i];
+ _walkOffLeft[i] = OVEROFFL[i];
+ _walkOffUp[i] = OVEROFFU[i];
+ _walkOffDown[i] = OVEROFFD[i];
+ _walkOffUR[i].x = OVEROFFURX[i];
+ _walkOffUR[i].y = OVEROFFURY[i];
+ _walkOffDR[i].x = OVEROFFDRX[i];
+ _walkOffDR[i].y = OVEROFFDRY[i];
+ _walkOffUL[i].x = OVEROFFULX[i];
+ _walkOffUL[i].y = OVEROFFULY[i];
+ _walkOffDL[i].x = OVEROFFDLX[i];
+ _walkOffDL[i].y = OVEROFFDLY[i];
+ }
+
+ _vm->_timers[8]._initTm = 7;
+ _vm->_timers[8]._timer = 7;
+ ++_vm->_timers[8]._flag;
+
+ _sideWalkMin = 0;
+ _sideWalkMax = 5;
+ _upWalkMin = 12;
+ _upWalkMax = 17;
+ _downWalkMin = 6;
+ _downWalkMax = 11;
+ _diagUpWalkMin = 0;
+ _diagUpWalkMax = 5;
+ _diagDownWalkMin = 0;
+ _diagDownWalkMax = 5;
+ _game->_guard._position = Common::Point(56, 190);
+ }
+}
+
+} // End of namespace Amazon
+
+} // End of namespace Access
diff --git a/engines/access/amazon/amazon_player.h b/engines/access/amazon/amazon_player.h
new file mode 100644
index 0000000000..200b530aa1
--- /dev/null
+++ b/engines/access/amazon/amazon_player.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ACCESS_AMAZON_PLAYER_H
+#define ACCESS_AMAZON_PLAYER_H
+
+#include "common/scummsys.h"
+#include "access/player.h"
+
+namespace Access {
+
+namespace Amazon {
+
+class AmazonEngine;
+
+class AmazonPlayer: public Player {
+private:
+ AmazonEngine *_game;
+public:
+ AmazonPlayer(AccessEngine *vm);
+
+ virtual void load();
+};
+
+} // End of namespace Amazon
+
+} // End of namespace Access
+
+#endif /* ACCESS_AMAZON_PLAYER_H */
diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index 08b57957ec..e03750fd52 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -245,6 +245,19 @@ const int TRAVEL_POS[][2] = {
{ 0, 0 }
};
+const int OVEROFFR[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
+const int OVEROFFL[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
+const int OVEROFFU[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
+const int OVEROFFD[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
+const int OVEROFFURX[] = { 3, 1, 1, 2, 2, 1, 0, 0, 0 };
+const int OVEROFFURY[] = { 1, 0, 0, 1, 1, 0, 0, 0, 0 };
+const int OVEROFFDRX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
+const int OVEROFFDRY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
+const int OVEROFFULX[] = { 2, 1, 1, 1, 2, 1, 0, 0, 0 };
+const int OVEROFFULY[] = { 1, 0, 0, 2, 1, 0, 0, 0, 0 };
+const int OVEROFFDLX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
+const int OVEROFFDLY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
+
const byte CREDITS[] = {
0x2, 0xFF, 0xFF, 0x61, 0x0, 0x3, 0x0, 0x30, 0x22, 0x30, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0xFF, 0xFF,
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 65a38dc660..4229522f44 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -44,6 +44,19 @@ extern const byte *CURSORS[10];
extern const int TRAVEL_POS[][2];
+extern const int OVEROFFR[];
+extern const int OVEROFFL[];
+extern const int OVEROFFU[];
+extern const int OVEROFFD[];
+extern const int OVEROFFURX[];
+extern const int OVEROFFURY[];
+extern const int OVEROFFDRX[];
+extern const int OVEROFFDRY[];
+extern const int OVEROFFULX[];
+extern const int OVEROFFULY[];
+extern const int OVEROFFDLX[];
+extern const int OVEROFFDLY[];
+
extern const byte *ROOM_TABLE[];
extern const char *ROOM_DESCR[];
extern const int ROOM_NUMB;
diff --git a/engines/access/animation.cpp b/engines/access/animation.cpp
index 184b015371..e59874fe7a 100644
--- a/engines/access/animation.cpp
+++ b/engines/access/animation.cpp
@@ -222,9 +222,9 @@ void Animation::setFrame1(AnimationFrame *frame) {
ImageEntry ie;
// Set the flags
- ie._flags = part->_flags & 0xF7;
+ ie._flags = part->_flags & ~IMGFLAG_UNSCALED;
if (_vm->_animation->_frameScale == -1)
- ie._flags |= 8;
+ ie._flags |= IMGFLAG_UNSCALED;
// Set the other fields
ie._spritesPtr = _vm->_objectsTable[part->_spritesIndex];
diff --git a/engines/access/module.mk b/engines/access/module.mk
index b6e73b66bd..98464014ba 100644
--- a/engines/access/module.mk
+++ b/engines/access/module.mk
@@ -22,6 +22,7 @@ MODULE_OBJS := \
sound.o \
video.o \
amazon/amazon_game.o \
+ amazon/amazon_player.o \
amazon/amazon_resources.o \
amazon/amazon_room.o \
amazon/amazon_scripts.o \
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 70f688120c..b5046632c5 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -25,9 +25,19 @@
#include "access/player.h"
#include "access/access.h"
#include "access/resources.h"
+#include "access/amazon/amazon_player.h"
namespace Access {
+Player *Player::init(AccessEngine *vm) {
+ switch (vm->getGameID()) {
+ case GType_Amazon:
+ return new Amazon::AmazonPlayer(vm);
+ default:
+ return new Player(vm);
+ }
+}
+
Player::Player(AccessEngine *vm): Manager(vm), ImageEntry() {
Common::fill(&_walkOffRight[0], &_walkOffRight[PLAYER_DATA_COUNT], 0);
Common::fill(&_walkOffLeft[0], &_walkOffLeft[PLAYER_DATA_COUNT], 0);
@@ -71,81 +81,40 @@ Player::~Player() {
}
void Player::load() {
- if (_vm->_room->_roomFlag == 3) {
- _playerOffset.x = _vm->_screen->_scaleTable1[8];
- _playerOffset.y = _vm->_screen->_scaleTable1[11];
- _leftDelta = 0;
- _rightDelta = 8;
- _upDelta = 2;
- _downDelta = -2;
- _scrollConst = 2;
-
- for (int i = 0; i < PLAYER_DATA_COUNT; ++i) {
- _walkOffRight[i] = OVEROFFR[i];
- _walkOffLeft[i] = OVEROFFL[i];
- _walkOffUp[i] = OVEROFFU[i];
- _walkOffDown[i] = OVEROFFD[i];
- _walkOffUR[i].x = OVEROFFURX[i];
- _walkOffUR[i].y = OVEROFFURY[i];
- _walkOffDR[i].x = OVEROFFDRX[i];
- _walkOffDR[i].y = OVEROFFDRY[i];
- _walkOffUL[i].x = OVEROFFULX[i];
- _walkOffUL[i].y = OVEROFFULY[i];
- _walkOffDL[i].x = OVEROFFDLX[i];
- _walkOffDL[i].y = OVEROFFDLY[i];
- }
-
- _vm->_timers[8]._initTm = 7;
- _vm->_timers[8]._timer = 7;
- ++_vm->_timers[8]._flag;
-
- _sideWalkMin = 0;
- _sideWalkMax = 5;
- _upWalkMin = 12;
- _upWalkMax = 17;
- _downWalkMin = 6;
- _downWalkMax = 11;
- _diagUpWalkMin = 0;
- _diagUpWalkMax = 5;
- _diagDownWalkMin = 0;
- _diagDownWalkMax = 5;
- _guard = Common::Point(56, 190);
- } else {
- _playerOffset.x = _vm->_screen->_scaleTable1[25];
- _playerOffset.y = _vm->_screen->_scaleTable1[67];
- _leftDelta = -3;
- _rightDelta = 33;
- _upDelta = 5;
- _downDelta = -10;
- _scrollConst = 5;
-
- for (int i = 0; i < PLAYER_DATA_COUNT; ++i) {
- _walkOffRight[i] = SIDEOFFR[i];
- _walkOffLeft[i] = SIDEOFFL[i];
- _walkOffUp[i] = SIDEOFFU[i];
- _walkOffDown[i] = SIDEOFFD[i];
- _walkOffUR[i].x = DIAGOFFURX[i];
- _walkOffUR[i].y = DIAGOFFURY[i];
- _walkOffDR[i].x = DIAGOFFDRX[i];
- _walkOffDR[i].y = DIAGOFFDRY[i];
- _walkOffUL[i].x = DIAGOFFULX[i];
- _walkOffUL[i].y = DIAGOFFULY[i];
- _walkOffDL[i].x = DIAGOFFDLX[i];
- _walkOffDL[i].y = DIAGOFFDLY[i];
- }
-
- _sideWalkMin = 0;
- _sideWalkMax = 7;
- _upWalkMin = 16;
- _upWalkMax = 23;
- _downWalkMin = 8;
- _downWalkMax = 15;
- _diagUpWalkMin = 0;
- _diagUpWalkMax = 7;
- _diagDownWalkMin = 0;
- _diagDownWalkMax = 7;
+ _playerOffset.x = _vm->_screen->_scaleTable1[25];
+ _playerOffset.y = _vm->_screen->_scaleTable1[67];
+ _leftDelta = -3;
+ _rightDelta = 33;
+ _upDelta = 5;
+ _downDelta = -10;
+ _scrollConst = 5;
+
+ for (int i = 0; i < PLAYER_DATA_COUNT; ++i) {
+ _walkOffRight[i] = SIDEOFFR[i];
+ _walkOffLeft[i] = SIDEOFFL[i];
+ _walkOffUp[i] = SIDEOFFU[i];
+ _walkOffDown[i] = SIDEOFFD[i];
+ _walkOffUR[i].x = DIAGOFFURX[i];
+ _walkOffUR[i].y = DIAGOFFURY[i];
+ _walkOffDR[i].x = DIAGOFFDRX[i];
+ _walkOffDR[i].y = DIAGOFFDRY[i];
+ _walkOffUL[i].x = DIAGOFFULX[i];
+ _walkOffUL[i].y = DIAGOFFULY[i];
+ _walkOffDL[i].x = DIAGOFFDLX[i];
+ _walkOffDL[i].y = DIAGOFFDLY[i];
}
+ _sideWalkMin = 0;
+ _sideWalkMax = 7;
+ _upWalkMin = 16;
+ _upWalkMax = 23;
+ _downWalkMin = 8;
+ _downWalkMax = 15;
+ _diagUpWalkMin = 0;
+ _diagUpWalkMax = 7;
+ _diagDownWalkMin = 0;
+ _diagDownWalkMax = 7;
+
_playerSprites = _playerSprites1;
if (_manPal1) {
Common::copy(_manPal1 + 0x270, _manPal1 + 0x270 + 0x60, _vm->_screen->_manPal);
diff --git a/engines/access/player.h b/engines/access/player.h
index ed48af0932..400770c21a 100644
--- a/engines/access/player.h
+++ b/engines/access/player.h
@@ -38,8 +38,8 @@ enum Direction { NONE = 0, UP = 1, DOWN = 2, LEFT = 3, RIGHT = 4,
class AccessEngine;
-class Player: public ImageEntry, Manager {
-private:
+class Player: public ImageEntry, public Manager {
+protected:
int _leftDelta, _rightDelta;
int _upDelta, _downDelta;
int _scrollConst;
@@ -48,7 +48,6 @@ private:
int _downWalkMin, _downWalkMax;
int _diagUpWalkMin, _diagUpWalkMax;
int _diagDownWalkMin, _diagDownWalkMax;
- Common::Point _guard;
SpriteResource *_playerSprites1;
byte *_manPal1;
int _scrollEnd;
@@ -113,8 +112,9 @@ public:
public:
Player(AccessEngine *vm);
~Player();
+ static Player *init(AccessEngine *vm);
- void load();
+ virtual void load();
void loadSprites(const Common::String &name);
diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp
index e5a27a8ba1..9bef5cf879 100644
--- a/engines/access/resources.cpp
+++ b/engines/access/resources.cpp
@@ -58,18 +58,6 @@ const int DIAGOFFULX[] = { 4, 5, 4, 3, 3, 2, 2, 2, 0 };
const int DIAGOFFULY[] = { 3, 3, 1, 2, 2, 1, 1, 1, 0 };
const int DIAGOFFDLX[] = { 4, 5, 3, 3, 5, 4, 6, 1, 0 };
const int DIAGOFFDLY[] = { 2, 2, 1, 2, 3, 1, 2, 1, 0 };
-const int OVEROFFR[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
-const int OVEROFFL[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 };
-const int OVEROFFU[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
-const int OVEROFFD[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 };
-const int OVEROFFURX[] = { 3, 1, 1, 2, 2, 1, 0, 0, 0 };
-const int OVEROFFURY[] = { 1, 0, 0, 1, 1, 0, 0, 0, 0 };
-const int OVEROFFDRX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
-const int OVEROFFDRY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
-const int OVEROFFULX[] = { 2, 1, 1, 1, 2, 1, 0, 0, 0 };
-const int OVEROFFULY[] = { 1, 0, 0, 2, 1, 0, 0, 0, 0 };
-const int OVEROFFDLX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 };
-const int OVEROFFDLY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 };
const int RMOUSE[10][2] = {
{ 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 },
diff --git a/engines/access/resources.h b/engines/access/resources.h
index 6fb781e0d1..10f2adb97e 100644
--- a/engines/access/resources.h
+++ b/engines/access/resources.h
@@ -41,18 +41,6 @@ extern const int DIAGOFFULX[];
extern const int DIAGOFFULY[];
extern const int DIAGOFFDLX[];
extern const int DIAGOFFDLY[];
-extern const int OVEROFFR[];
-extern const int OVEROFFL[];
-extern const int OVEROFFU[];
-extern const int OVEROFFD[];
-extern const int OVEROFFURX[];
-extern const int OVEROFFURY[];
-extern const int OVEROFFDRX[];
-extern const int OVEROFFDRY[];
-extern const int OVEROFFULX[];
-extern const int OVEROFFULY[];
-extern const int OVEROFFDLX[];
-extern const int OVEROFFDLY[];
extern const int RMOUSE[10][2];