aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-12-10 08:25:35 +0100
committerPaul Gilbert2014-12-12 23:05:57 -0500
commit538782e14e085fa4cc8e435439f0432b3b1f0b21 (patch)
treed59ee314d6fc5957d6674086dbda8846de4849b4 /engines
parent80dfc3537d8495bb1f096c1bd21ab4052ac0cb40 (diff)
downloadscummvm-rg350-538782e14e085fa4cc8e435439f0432b3b1f0b21.tar.gz
scummvm-rg350-538782e14e085fa4cc8e435439f0432b3b1f0b21.tar.bz2
scummvm-rg350-538782e14e085fa4cc8e435439f0432b3b1f0b21.zip
ACCESS: Get rid of the use of 'this' in constructor
Diffstat (limited to 'engines')
-rw-r--r--engines/access/amazon/amazon_game.cpp40
-rw-r--r--engines/access/amazon/amazon_game.h15
-rw-r--r--engines/access/amazon/amazon_player.cpp2
-rw-r--r--engines/access/amazon/amazon_scripts.cpp20
4 files changed, 52 insertions, 25 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 20d71021c2..cfcafbba6f 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -36,9 +36,15 @@ AccessEngine(syst, gameDesc),
_jasMayaFlag(_flags[168]), _moreHelp(_flags[169]), _flashbackFlag(_flags[171]),
_riverFlag(_flags[185]), _aniOutFlag(_flags[195]), _badEnd(_flags[218]),
_noHints(_flags[219]), _aniFlag(_flags[229]), _allenFlag(_flags[237]),
- _noSound(_flags[239]),
- _ant(this), _cast(this), _guard(this), _jungle(this), _opening(this),
- _plane(this), _river(this) {
+ _noSound(_flags[239]) {
+
+ _ant = nullptr;
+ _cast = nullptr;
+ _guard = nullptr;
+ _jungle = nullptr;
+ _opening = nullptr;
+ _plane = nullptr;
+ _river = nullptr;
_charSegSwitch = false;
@@ -67,6 +73,14 @@ AccessEngine(syst, gameDesc),
AmazonEngine::~AmazonEngine() {
delete _inactive._altSpritesPtr;
+
+ delete _ant;
+ delete _cast;
+ delete _guard;
+ delete _jungle;
+ delete _opening;
+ delete _plane;
+ delete _river;
}
void AmazonEngine::freeInactivePlayer() {
@@ -79,18 +93,30 @@ void AmazonEngine::configSelect() {
_hintLevel = 3;
}
-void AmazonEngine::playGame() {
- // Initialize Amazon game-specific objects
+void AmazonEngine::initObjects() {
_room = new AmazonRoom(this);
_scripts = new AmazonScripts(this);
+ _ant = new Ant(this);
+ _cast = new Cast(this);
+ _guard = new Guard(this);
+ _jungle = new Jungle(this);
+ _opening = new Opening(this);
+ _plane = new Plane(this);
+ _river = new River(this);
+}
+
+void AmazonEngine::playGame() {
+ // Initialize Amazon game-specific objects
+ initObjects();
+
// Setup the game
setupGame();
configSelect();
if (_loadSaveSlot == -1) {
// Do introduction
- _opening.doIntroduction();
+ _opening->doIntroduction();
if (shouldQuit())
return;
}
@@ -735,7 +761,7 @@ void AmazonEngine::synchronize(Common::Serializer &s) {
s.syncAsByte(_help3[i]);
}
- _river.synchronize(s);
+ _river->synchronize(s);
}
} // End of namespace Amazon
diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h
index e475542772..4ebea0f7eb 100644
--- a/engines/access/amazon/amazon_game.h
+++ b/engines/access/amazon/amazon_game.h
@@ -48,6 +48,7 @@ private:
void configSelect();
void initVariables();
+ void initObjects();
void calcIQ();
void helpTitle();
void drawHelpText(const Common::String &msg);
@@ -95,13 +96,13 @@ public:
int _esTabTable[100];
// Other game specific fields
- Ant _ant;
- Cast _cast;
- Guard _guard;
- Jungle _jungle;
- Opening _opening;
- Plane _plane;
- River _river;
+ Ant *_ant;
+ Cast *_cast;
+ Guard *_guard;
+ Jungle *_jungle;
+ Opening *_opening;
+ Plane *_plane;
+ River *_river;
int _hintLevel;
int _updateChapter;
int _oldTitleChapter;
diff --git a/engines/access/amazon/amazon_player.cpp b/engines/access/amazon/amazon_player.cpp
index c9b63a9108..2780922935 100644
--- a/engines/access/amazon/amazon_player.cpp
+++ b/engines/access/amazon/amazon_player.cpp
@@ -77,7 +77,7 @@ void AmazonPlayer::load() {
_diagUpWalkMax = 5;
_diagDownWalkMin = 0;
_diagDownWalkMax = 5;
- _game->_guard.setPosition(Common::Point(56, 190));
+ _game->_guard->setPosition(Common::Point(56, 190));
}
}
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index 76513db7fb..52c142a415 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -211,25 +211,25 @@ void AmazonScripts::mWhile(int param1) {
mWhile1();
break;
case 2:
- _game->_plane.mWhileFly();
+ _game->_plane->mWhileFly();
break;
case 3:
- _game->_plane.mWhileFall();
+ _game->_plane->mWhileFall();
break;
case 4:
- _game->_jungle.mWhileJWalk();
+ _game->_jungle->mWhileJWalk();
break;
case 5:
- _game->_jungle.mWhileDoOpen();
+ _game->_jungle->mWhileDoOpen();
break;
case 6:
- _game->_river.mWhileDownRiver();
+ _game->_river->mWhileDownRiver();
break;
case 7:
mWhile2();
break;
case 8:
- _game->_jungle.mWhileJWalk2();
+ _game->_jungle->mWhileJWalk2();
break;
default:
break;
@@ -332,7 +332,7 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
if (_vm->isDemo())
warning("TODO: DEMO - LOADCELLSET");
else
- _game->_cast.doCast(param1);
+ _game->_cast->doCast(param1);
break;
case 4:
if (_vm->isDemo())
@@ -353,7 +353,7 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
warning("TODO: DEMO - CHKMONEY");
break;
case 9:
- _game->_guard.doGuard();
+ _game->_guard->doGuard();
break;
case 10:
_vm->_midi->newMusic(param1, param2);
@@ -362,10 +362,10 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
plotInactive();
break;
case 13:
- _game->_river.doRiver();
+ _game->_river->doRiver();
break;
case 14:
- _game->_ant.doAnt();
+ _game->_ant->doAnt();
break;
case 15:
boatWalls(param1, param2);