aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndoe1232011-09-19 09:30:51 +0000
committerWillem Jan Palenstijn2013-05-08 20:39:39 +0200
commita4c34cedd5b7e97104cfb53b90f9808c4204dcf1 (patch)
treed79631079cdf56f7230625f1e8ac7cdec8ec97d5
parent0ec039c5b05d03d470ae120e008c1577279ff6ed (diff)
downloadscummvm-rg350-a4c34cedd5b7e97104cfb53b90f9808c4204dcf1.tar.gz
scummvm-rg350-a4c34cedd5b7e97104cfb53b90f9808c4204dcf1.tar.bz2
scummvm-rg350-a4c34cedd5b7e97104cfb53b90f9808c4204dcf1.zip
NEVERHOOD: Merge createSceneXXX/updateSceneXXX methods into createScene and updateScene for Module1200
-rw-r--r--engines/neverhood/module1200.cpp97
-rw-r--r--engines/neverhood/module1200.h9
2 files changed, 43 insertions, 63 deletions
diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp
index c050abcf68..ff0493713c 100644
--- a/engines/neverhood/module1200.cpp
+++ b/engines/neverhood/module1200.cpp
@@ -33,21 +33,11 @@ Module1200::Module1200(NeverhoodEngine *vm, Module *parentModule, int which)
debug("Module1200: which = %d", which);
if (which < 0) {
- switch (_vm->gameState().sceneNum) {
- case 0:
- createScene1201(-1);
- break;
- case 1:
- createScene1202(-1);
- break;
- case 2:
- createScene1203(-1);
- break;
- }
+ createScene(_vm->gameState().sceneNum, -1);
} else if (which == 1) {
- createScene1201(2);
+ createScene(0, 2);
} else {
- createScene1201(0);
+ createScene(0, 0);
}
// TODO Music18hList_add(0x00478311, 0x62222CAE);
@@ -58,58 +48,53 @@ Module1200::~Module1200() {
// TODO Music18hList_deleteGroup(0x00478311);
}
-void Module1200::createScene1201(int which) {
- _vm->gameState().sceneNum = 0;
- _childObject = new Scene1201(_vm, this, which);
- SetUpdateHandler(&Module1200::updateScene1201);
-}
-
-void Module1200::createScene1202(int which) {
- _vm->gameState().sceneNum = 1;
- _childObject = new Scene1202(_vm, this, which);
- SetUpdateHandler(&Module1200::updateScene1202);
-}
-
-void Module1200::createScene1203(int which) {
- _vm->gameState().sceneNum = 2;
- // TODO Music18hList_stop(0x62222CAE, 0, 0);
- createSmackerScene(0x31890001, true, true, false);
- setGlobalVar(0x2A02C07B, 1);
- SetUpdateHandler(&Module1200::updateScene1203);
+void Module1200::createScene(int sceneNum, int which) {
+ debug("Module1200::createScene(%d, %d)", sceneNum, which);
+ _vm->gameState().sceneNum = sceneNum;
+ switch (_vm->gameState().sceneNum) {
+ case 0:
+ _childObject = new Scene1201(_vm, this, which);
+ break;
+ case 1:
+ _childObject = new Scene1202(_vm, this, which);
+ break;
+ case 2:
+ // TODO Music18hList_stop(0x62222CAE, 0, 0);
+ createSmackerScene(0x31890001, true, true, false);
+ setGlobalVar(0x2A02C07B, 1);
+ break;
+ }
+ SetUpdateHandler(&Module1200::updateScene);
+ _childObject->handleUpdate();
}
-void Module1200::updateScene1201() {
+void Module1200::updateScene() {
if (!updateChild()) {
- if (_moduleResult == 1) {
- createScene1202(0);
- _childObject->handleUpdate();
- } else if (_moduleResult == 2) {
- if (getGlobalVar(0x0A18CA33) && !getGlobalVar(0x2A02C07B)) {
- createScene1203(-1);
+ switch (_vm->gameState().sceneNum) {
+ case 0:
+ if (_moduleResult == 1) {
+ createScene(1, 0);
+ } else if (_moduleResult == 2) {
+ if (getGlobalVar(0x0A18CA33) && !getGlobalVar(0x2A02C07B)) {
+ createScene(2, -1);
+ } else {
+ sendMessage(_parentModule, 0x1009, 1);
+ }
} else {
- sendMessage(_parentModule, 0x1009, 1);
+ sendMessage(_parentModule, 0x1009, 0);
}
- } else {
- sendMessage(_parentModule, 0x1009, 0);
+ break;
+ case 1:
+ createScene(0, 1);
+ break;
+ case 2:
+ // TODO Music18hList_play(0x62222CAE, 0, 0, 1);
+ createScene(0, 3);
+ break;
}
}
}
-void Module1200::updateScene1202() {
- if (!updateChild()) {
- createScene1201(1);
- _childObject->handleUpdate();
- }
-}
-
-void Module1200::updateScene1203() {
- if (!updateChild()) {
- createScene1201(3);
- _childObject->handleUpdate();
- // TODO Music18hList_play(0x62222CAE, 0, 0, 1);
- }
-}
-
// Scene1201
static const uint32 kScene1201InitArray[] = {
diff --git a/engines/neverhood/module1200.h b/engines/neverhood/module1200.h
index df1ed41b2c..a34bd958e6 100644
--- a/engines/neverhood/module1200.h
+++ b/engines/neverhood/module1200.h
@@ -36,13 +36,8 @@ public:
Module1200(NeverhoodEngine *vm, Module *parentModule, int which);
virtual ~Module1200();
protected:
- // TODO ResourceTable _resourceTable;
- void createScene1201(int which);
- void createScene1202(int which);
- void createScene1203(int which);
- void updateScene1201();
- void updateScene1202();
- void updateScene1203();
+ void createScene(int sceneNum, int which);
+ void updateScene();
};
// Scene1201