diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/toltecs/script.cpp | 22 | ||||
-rw-r--r-- | engines/toltecs/toltecs.cpp | 50 | ||||
-rw-r--r-- | engines/toltecs/toltecs.h | 4 |
3 files changed, 62 insertions, 14 deletions
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 8f20b624cc..6f155b2b5b 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -52,17 +52,20 @@ ScriptInterpreter::ScriptInterpreter(ToltecsEngine *vm) : _vm(vm) { _savedSp = 0; + _slots[kMaxScriptSlots - 1].size = 1024; + _slots[kMaxScriptSlots - 1].data = new byte[_slots[kMaxScriptSlots - 1].size]; + } ScriptInterpreter::~ScriptInterpreter() { delete[] _stack; + for (int i = 0; i < kMaxScriptSlots; i++) + delete[] _slots[i].data; } void ScriptInterpreter::loadScript(uint resIndex, uint slotIndex) { - if (_slots[slotIndex].data) { - delete[] _slots[slotIndex].data; - } + delete[] _slots[slotIndex].data; _slots[slotIndex].resIndex = resIndex; byte *scriptData = _vm->_res->load(resIndex); @@ -134,13 +137,6 @@ int16 ScriptInterpreter::readInt16() { return value; } -void look(byte *code) { - char ln[256]; - snprintf(ln, 256, "\t\t\t%02X %02X %02X %02X %02X %02X %02X %02X", - code[0], code[1], code[2], code[3], code[4], code[5], code[6], code[7]); - debug(1, "%s", ln); -} - void ScriptInterpreter::execOpcode(byte opcode) { #if 0 @@ -491,8 +487,8 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) { case 6:// ok { - debug(0, "o2_printText()"); - _vm->_screen->printText((byte*)localPtr(arg16(3))); + debug(0, "o2_drawGuiTextMulti()"); + _vm->_screen->drawGuiTextMulti((byte*)localPtr(arg16(3))); break; } @@ -636,6 +632,7 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) { To avoid crashes we skip searching the rectangle index for now when scene 215 is active. I don't know yet whether this is a bug in the original engine as well or just here. Needs some more checking. + Annoyingly scene 215 is the map which becomes unusable with this hack. */ if (_vm->_sceneResIndex != 215) { if (_vm->_mouseY < _vm->_cameraHeight) { @@ -914,6 +911,7 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) { case 65:// TODO { debug(0, "o2_playMovie(%d, %d)", arg16(3), arg16(5)); + // TODO: Enable once the player is ready: _vm->_moviePlayer->playMovie() break; } diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index 6bc13401f7..b6d96330f3 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -39,12 +39,16 @@ #include "toltecs/toltecs.h" #include "toltecs/animation.h" +#include "toltecs/menu.h" +#include "toltecs/movie.h" #include "toltecs/palette.h" #include "toltecs/resource.h" #include "toltecs/script.h" #include "toltecs/screen.h" #include "toltecs/segmap.h" +#include "toltecs/microtiles.h" + namespace Toltecs { struct GameSettings { @@ -130,14 +134,54 @@ int ToltecsEngine::go() { _anim = new AnimationPlayer(this); _palette = new Palette(this); _segmap = new SegmentMap(this); + _moviePlayer = new MoviePlayer(this); + _menuSystem = new MenuSystem(this); _system->showMouse(true); -#if 1 +//#define TEST_MOVIE +#ifdef TEST_MOVIE + _screen->registerFont(0, 0x0D); + _screen->registerFont(1, 0x0E); + _moviePlayer->playMovie(0x000012D8); +#endif + +//#define TEST_MENU +#ifdef TEST_MENU + _screen->registerFont(0, 0x0D); + _screen->registerFont(1, 0x0E); + _screen->loadMouseCursor(12); + _palette->loadAddPalette(9, 224); + _palette->setDeltaPalette(_palette->getMainPalette(), 7, 0, 31, 224); + _screen->finishTextDrawItems(); + _screen->clearSprites(); + while (1) { + updateInput(); + _menuSystem->update(); + updateScreen(); + } +#endif +//#define TEST_MICROTILES +#ifdef TEST_MICROTILES + MicroTileArray *uta = new MicroTileArray(0, 0, 640, 480); + uta->unite(Common::Rect(10, 10, 50, 50)); + uta->unite(Common::Rect(45, 45, 60, 60)); + Common::Rect *rects; + int n_rects; + n_rects = uta->getRectangles(rects); + printf("n_rects = %d\n", n_rects); fflush(stdout); + for (int i = 0; i < n_rects; i++) { + printf("%d, %d, %d, %d\n", rects[i].left, rects[i].top, rects[i].right, rects[i].bottom); + fflush(stdout); + } + _system->quit(); + delete uta; +#endif + +#if 1 _script->loadScript(0, 0); _script->runScript(0); - #endif delete _arc; @@ -147,6 +191,8 @@ int ToltecsEngine::go() { delete _anim; delete _palette; delete _segmap; + delete _moviePlayer; + delete _menuSystem; return 0; } diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h index 3b38baff78..7c7e3ea435 100644 --- a/engines/toltecs/toltecs.h +++ b/engines/toltecs/toltecs.h @@ -52,6 +52,8 @@ struct ToltecsGameDescription; class AnimationPlayer; class ArchiveReader; class Input; +class MenuSystem; +class MoviePlayer; class Palette; class ResourceCache; class ScriptInterpreter; @@ -102,6 +104,8 @@ public: AnimationPlayer *_anim; ArchiveReader *_arc; Input *_input; + MenuSystem *_menuSystem; + MoviePlayer *_moviePlayer; Palette *_palette; ResourceCache *_res; ScriptInterpreter *_script; |