aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood
diff options
context:
space:
mode:
Diffstat (limited to 'engines/neverhood')
-rw-r--r--engines/neverhood/gamemodule.cpp17
-rw-r--r--engines/neverhood/gamemodule.h3
-rw-r--r--engines/neverhood/module1600.cpp2
-rw-r--r--engines/neverhood/module3000.cpp2
4 files changed, 21 insertions, 3 deletions
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index ce72a22835..c7ce53fe79 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -262,6 +262,23 @@ void GameModule::initCannonSymbolsPuzzle() {
}
}
+void GameModule::initCodeSymbolsPuzzle() {
+ if (!getSubVar(VA_IS_PUZZLE_INIT, 0x0CD09B50)) {
+ for (int i = 0; i < 12; ++i)
+ setSubVar(VA_CODE_SYMBOLS, i, i);
+ for (int i = 0; i < 12; ++i) {
+ uint32 index1 = _vm->_rnd->getRandomNumber(12 - 1);
+ uint32 index2 = _vm->_rnd->getRandomNumber(12 - 1);
+ uint32 temp = getSubVar(VA_CODE_SYMBOLS, index1);
+ setSubVar(VA_CODE_SYMBOLS, index1, getSubVar(VA_CODE_SYMBOLS, index2));
+ setSubVar(VA_CODE_SYMBOLS, index2, temp);
+ }
+ setGlobalVar(V_NOISY_SYMBOL_INDEX, _vm->_rnd->getRandomNumber(11 - 1) + 1);
+ setSubVar(VA_IS_PUZZLE_INIT, 0x0CD09B50, 1);
+ }
+
+}
+
uint32 GameModule::getCurrRadioMusicFileHash() {
uint musicIndex = getGlobalVar(V_CURR_RADIO_MUSIC_INDEX);
return (musicIndex % 5 != 0) ? 0 : kRadioMusicFileHashes[CLIP<uint>(musicIndex / 5, 0, 17)];
diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h
index 81ebfb85bb..e1461d2413 100644
--- a/engines/neverhood/gamemodule.h
+++ b/engines/neverhood/gamemodule.h
@@ -46,8 +46,9 @@ public:
void initWaterPipesPuzzle();
void initRadioPuzzle();
void initTestTubes1Puzzle();
- void initTestTubes2Puzzle();
+ void initTestTubes2Puzzle();
void initCannonSymbolsPuzzle();
+ void initCodeSymbolsPuzzle();
uint32 getCurrRadioMusicFileHash();
protected:
Entity *_prevChildObject;
diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp
index db8eeab4ab..ca4d2e5322 100644
--- a/engines/neverhood/module1600.cpp
+++ b/engines/neverhood/module1600.cpp
@@ -1317,7 +1317,7 @@ void Scene1608::updateKlaymanCliprect() {
Scene1609::Scene1609(NeverhoodEngine *vm, Module *parentModule)
: Scene(vm, parentModule, true), _countdown1(1), _currentSymbolIndex(0), _symbolPosition(0), _changeCurrentSymbol(true), _isSolved(false) {
- // TODO _vm->gameModule()->initScene3011Vars();
+ _vm->gameModule()->initCodeSymbolsPuzzle();
_noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX);
SetMessageHandler(&Scene1609::handleMessage);
diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp
index 9c2d896802..1fc1f5339b 100644
--- a/engines/neverhood/module3000.cpp
+++ b/engines/neverhood/module3000.cpp
@@ -1450,7 +1450,7 @@ void AsScene3011Symbol::change(int symbolIndex, bool isNoisy) {
Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which)
: Scene(vm, parentModule, true), _updateStatus(0), _buttonClicked(false), _currentSymbolIndex(0) {
- // TODO _vm->gameModule()->initScene3011Vars();
+ _vm->gameModule()->initCodeSymbolsPuzzle();
_noisySymbolIndex = getGlobalVar(V_NOISY_SYMBOL_INDEX);
SetMessageHandler(&Scene3011::handleMessage);