aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular
diff options
context:
space:
mode:
authorPaul Gilbert2014-02-23 19:33:26 -0500
committerPaul Gilbert2014-02-23 19:33:26 -0500
commit8c9420a8349b0cdb93dcace36c2bd5f93e03476f (patch)
tree11e48162e9644e526ac31bc30072abecb32bd150 /engines/mads/nebular
parent1d80edb2dd092b7e91805f359f0e2a7d470ed7c4 (diff)
downloadscummvm-rg350-8c9420a8349b0cdb93dcace36c2bd5f93e03476f.tar.gz
scummvm-rg350-8c9420a8349b0cdb93dcace36c2bd5f93e03476f.tar.bz2
scummvm-rg350-8c9420a8349b0cdb93dcace36c2bd5f93e03476f.zip
MADS: Added game initialisation code
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r--engines/mads/nebular/game_nebular.cpp142
-rw-r--r--engines/mads/nebular/game_nebular.h28
2 files changed, 167 insertions, 3 deletions
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index bf52af3733..2e27eaea0f 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -37,15 +37,153 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) {
_surface =MSurface::init(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT);
}
-bool GameNebular::checkCopyProtection() {
+int GameNebular::checkCopyProtection() {
if (!ConfMan.getBool("copy_protection"))
return true;
+ /* DEBUG: Disabled for now
CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false);
dlg->show();
delete dlg;
+ */
- return false;
+ // DEBUG: Return that copy protection failed
+ return 1;
+}
+
+void GameNebular::initialiseGlobals() {
+ // Allocate globals space
+ _globalFlags.resize(210);
+ for (int i = 0; i < 210; ++i)
+ _globalFlags[i] = 0;
+
+ // Set specific values needed by the game
+ _globalFlags[4] = 8;
+ _globalFlags[33] = 1;
+ _globalFlags[10] = 0xFFFF;
+ _globalFlags[13] = 0xFFFF;
+ _globalFlags[15] = 0xFFFF;
+ _globalFlags[19] = 0xFFFF;
+ _globalFlags[20] = 0xFFFF;
+ _globalFlags[21] = 0xFFFF;
+ _globalFlags[95] = 0xFFFF;
+
+ setObjectData(3, 17, nullptr);
+
+ // Put the values 0 through 3 in a random order in global slots 83 to 86
+ for (int i = 0; i < 4;) {
+ int randomVal = _vm->getRandomNumber(3);
+ _globalFlags[83 + i] = randomVal;
+
+ bool flag = false;
+ for (int idx2 = 0; idx2 < i; ++idx2) {
+ if (_globalFlags[83 + idx2] == randomVal)
+ flag = true;
+ }
+
+ if (!flag)
+ ++i;
+ }
+
+ // Put the values 0 through 3 in a random order in global slots 87 to 90
+ for (int i = 0; i < 4;) {
+ int randomVal = _vm->getRandomNumber(3);
+ _globalFlags[87 + i] = randomVal;
+
+ bool flag = false;
+ for (int idx2 = 0; idx2 < i; ++idx2) {
+ if (_globalFlags[87 + idx2] == randomVal)
+ flag = true;
+ }
+
+ if (!flag)
+ ++i;
+ }
+
+ _globalFlags[120] = 501;
+ _globalFlags[121] = 0xFFFF;
+ _globalFlags[55] = 0xFFFF;
+ _globalFlags[119] = 1;
+ _globalFlags[134] = 4;
+
+ // Fill out the globals 200 to 209 with unique random values less than 10000
+ for (int i = 0; i < 10; ++i) {
+ int randomVal = _vm->getRandomNumber(9999);
+ _globalFlags[200 + i] = randomVal;
+
+ bool flag = false;
+ for (int idx2 = 0; idx2 < i; ++idx2) {
+ if (_globalFlags[200 + idx2] == randomVal)
+ flag = true;
+ }
+
+ if (!flag)
+ ++i;
+ }
+
+ // Difficulty level control
+ switch (_difficultyLevel) {
+ case DIFFICULTY_HARD:
+ _globalFlags[35] = 0;
+ setObjectRoom(9, 1);
+ setObjectRoom(50, 1);
+ _globalFlags[137] = 5;
+ _globalFlags[136] = 0;
+ break;
+ case DIFFICULTY_MEDIUM:
+ _globalFlags[35] = 0;
+ setObjectRoom(8, 1);
+ _globalFlags[137] = 0xFFFF;
+ _globalFlags[136] = 6;
+ break;
+ case DIFFICULTY_EASY:
+ _globalFlags[35] = 2;
+ setObjectRoom(8, 1);
+ setObjectRoom(27, 1);
+ break;
+ default:
+ break;
+ }
+
+ _player._direction = 8;
+ _player._newDirection = 8;
+
+ loadResourceSequence("RXM", 1);
+ loadResourceSequence("ROX", 1);
+}
+
+void GameNebular::showDialog() {
+ warning("TODO: showDialog");
+}
+
+void GameNebular::setSectionHandler() {
+ delete _sectionHandler;
+
+ switch (_scene._sectionNum) {
+ case 1:
+ _sectionHandler = new Section1Handler(_vm);
+ break;
+ case 2:
+ _sectionHandler = new Section2Handler(_vm);
+ break;
+ case 3:
+ _sectionHandler = new Section3Handler(_vm);
+ break;
+ case 4:
+ _sectionHandler = new Section4Handler(_vm);
+ break;
+ case 5:
+ _sectionHandler = new Section5Handler(_vm);
+ break;
+ case 6:
+ _sectionHandler = new Section6Handler(_vm);
+ break;
+ case 7:
+ _sectionHandler = new Section7Handler(_vm);
+ break;
+ default:
+ break;
+ }
}
} // End of namespace Nebular
diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h
index b0f088f891..b7f47aa9cd 100644
--- a/engines/mads/nebular/game_nebular.h
+++ b/engines/mads/nebular/game_nebular.h
@@ -35,9 +35,35 @@ class GameNebular: public Game {
protected:
GameNebular(MADSEngine *vm);
- virtual bool checkCopyProtection();
+ virtual int checkCopyProtection();
+
+ virtual void initialiseGlobals();
+
+ virtual void showDialog();
+
+ virtual void setSectionHandler();
};
+
+class Section1Handler: public SectionHandler {
+public:
+ Section1Handler(MADSEngine *vm): SectionHandler(vm) {}
+
+ // TODO: Properly implement handler methods
+ virtual void loadSection() {}
+ virtual void sectionPtr2() {}
+ virtual void sectionPtr3() {}
+};
+
+// TODO: Properly implement handler classes
+typedef Section1Handler Section2Handler;
+typedef Section1Handler Section3Handler;
+typedef Section1Handler Section4Handler;
+typedef Section1Handler Section5Handler;
+typedef Section1Handler Section6Handler;
+typedef Section1Handler Section7Handler;
+
+
} // End of namespace Nebular
} // End of namespace MADS