From 8b8216bf2cfbaa016aa20a15eb7ac9069d8f9f21 Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 4 Jul 2014 18:39:03 +0200 Subject: CGE2: Fully implement the save/load system. Now the toolbar is working too after loading. --- engines/cge2/cge2_main.cpp | 65 +++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'engines/cge2/cge2_main.cpp') diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 804294d478..935a3c94e3 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -672,40 +672,11 @@ void CGE2Engine::runGame() { if (_quitFlag) return; - selectPocket(-1); - loadUser(); - _commandHandlerTurbo->addCommand(kCmdSeq, kMusicRef, _music, nullptr); - if (!_music) - _midiPlayer->killMidi(); - - checkSaySwitch(); - - _infoLine->gotoxyz(V3D(kInfoX, kInfoY, 0)); - _infoLine->setText(nullptr); - _vga->_showQ->insert(_infoLine); + initToolbar(); sceneUp(_now); - _startupMode = 0; - _mouse->center(); - _mouse->off(); - _mouse->on(); - - _keyboard->setClient(_sys); - _commandHandler->addCommand(kCmdSeq, kPowerRef, 1, nullptr); - - _busyPtr = _vga->_showQ->locate(kBusyRef); - - _vol[0] = _vga->_showQ->locate(kDvolRef); - _vol[1] = _vga->_showQ->locate(kMvolRef); - - // these sprites are loaded with SeqPtr==0 (why?!) - if (_vol[0]) - _vol[0]->step((/*(int)SNDDrvInfo.VOL4.DL * */ _vol[0]->_seqCnt + _vol[0]->_seqCnt / 2) >> 4); - if (_vol[1]) - _vol[1]->step((/*(int)SNDDrvInfo.VOL4.ML * */ _vol[1]->_seqCnt + _vol[1]->_seqCnt / 2) >> 4); - // TODO: Recheck these! ^ // main loop while (!_endGame && !_quitFlag) { @@ -795,6 +766,40 @@ void CGE2Engine::loadPos() { error("Missing file: CGE.HXY"); } +void CGE2Engine::initToolbar() { + selectPocket(-1); + + _commandHandlerTurbo->addCommand(kCmdSeq, kMusicRef, _music, nullptr); + if (!_music) + _midiPlayer->killMidi(); + + checkSaySwitch(); + + _infoLine->gotoxyz(V3D(kInfoX, kInfoY, 0)); + _infoLine->setText(nullptr); + _vga->_showQ->insert(_infoLine); + + _startupMode = 0; + _mouse->center(); + _mouse->off(); + _mouse->on(); + + _keyboard->setClient(_sys); + _commandHandler->addCommand(kCmdSeq, kPowerRef, 1, nullptr); + + _busyPtr = _vga->_showQ->locate(kBusyRef); + + _vol[0] = _vga->_showQ->locate(kDvolRef); + _vol[1] = _vga->_showQ->locate(kMvolRef); + + // these sprites are loaded with SeqPtr==0 (why?!) + if (_vol[0]) + _vol[0]->step((/*(int)SNDDrvInfo.VOL4.DL * */ _vol[0]->_seqCnt + _vol[0]->_seqCnt / 2) >> 4); + if (_vol[1]) + _vol[1]->step((/*(int)SNDDrvInfo.VOL4.ML * */ _vol[1]->_seqCnt + _vol[1]->_seqCnt / 2) >> 4); + // TODO: Recheck these! ^ +} + void CGE2Engine::releasePocket(Sprite *spr) { for (int i = 0; i < 2; i++) { for (int j = 0; j < kPocketMax; j++) { -- cgit v1.2.3