diff options
author | johndoe123 | 2014-01-30 20:18:55 +0100 |
---|---|---|
committer | johndoe123 | 2014-01-30 20:18:55 +0100 |
commit | cf51529cfd0fedb33b1b0c70beb59997b21cfc5b (patch) | |
tree | 1df30e23c7f1eac7ca4a8ddfba40c89c2577dda7 /engines/draci | |
parent | 542197a891eac799855571fe2849e0dca43bdd2b (diff) | |
parent | 462f7c1c24a48b7555316a3afae357bad14cc14b (diff) | |
download | scummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.tar.gz scummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.tar.bz2 scummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.zip |
Merge remote-tracking branch 'origin/master' into bbvs
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/barchive.cpp | 12 | ||||
-rw-r--r-- | engines/draci/configure.engine | 3 | ||||
-rw-r--r-- | engines/draci/draci.cpp | 26 | ||||
-rw-r--r-- | engines/draci/game.cpp | 55 | ||||
-rw-r--r-- | engines/draci/script.cpp | 110 | ||||
-rw-r--r-- | engines/draci/sprite.cpp | 4 | ||||
-rw-r--r-- | engines/draci/surface.cpp | 2 | ||||
-rw-r--r-- | engines/draci/walking.cpp | 6 | ||||
-rw-r--r-- | engines/draci/walking.h | 12 |
9 files changed, 162 insertions, 68 deletions
diff --git a/engines/draci/barchive.cpp b/engines/draci/barchive.cpp index 31dfe62dee..584367fdfb 100644 --- a/engines/draci/barchive.cpp +++ b/engines/draci/barchive.cpp @@ -203,12 +203,12 @@ void BArchive::openArchive(const Common::String &path) { uint32 fileOffset; fileOffset = reader.readUint32LE(); - _f.seek(fileOffset); // Seek to next file in archive + _f.seek(fileOffset); // Seek to next file in archive - _files[i]._compLength = _f.readUint16LE(); // Compressed size + _files[i]._compLength = _f.readUint16LE(); // Compressed size // should be the same as uncompressed - _files[i]._length = _f.readUint16LE(); // Original size + _files[i]._length = _f.readUint16LE(); // Original size _files[i]._offset = fileOffset; // Offset of file from start @@ -216,9 +216,9 @@ void BArchive::openArchive(const Common::String &path) { assert(compressionType == 0 && "Compression type flag is non-zero (file is compressed)"); - _files[i]._crc = _f.readByte(); // CRC checksum of the file - _files[i]._data = NULL; // File data will be read in on demand - _files[i]._stopper = 0; // Dummy value; not used in BAR files, needed in DFW + _files[i]._crc = _f.readByte(); // CRC checksum of the file + _files[i]._data = NULL; // File data will be read in on demand + _files[i]._stopper = 0; // Dummy value; not used in BAR files, needed in DFW } // Last footer item should be equal to footerOffset diff --git a/engines/draci/configure.engine b/engines/draci/configure.engine new file mode 100644 index 0000000000..09022b06f5 --- /dev/null +++ b/engines/draci/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine draci "Dragon History" yes diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 6aa8477887..06730cfba7 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -92,6 +92,32 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc) DebugMan.addDebugChannel(kDraciWalkingDebugLevel, "walking", "Walking debug info"); _console = new DraciConsole(this); + + _screen = 0; + _mouse = 0; + _game = 0; + _script = 0; + _anims = 0; + _sound = 0; + _music = 0; + _smallFont = 0; + _bigFont = 0; + _iconsArchive = 0; + _objectsArchive = 0; + _spritesArchive = 0; + _paletteArchive = 0; + _roomsArchive = 0; + _overlaysArchive = 0; + _animationsArchive = 0; + _walkingMapsArchive = 0; + _itemsArchive = 0; + _itemImagesArchive = 0; + _initArchive = 0; + _stringsArchive = 0; + _soundsArchive = 0; + _dubbingArchive = 0; + _showWalkingMap = 0; + _pauseStartTime = 0; } bool DraciEngine::hasFeature(EngineFeature f) const { diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index c4108cc0c7..009f1bb3d2 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -52,6 +52,55 @@ enum { Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { uint i; + _dialogueLinesNum = 0; + _blockNum = 0; + + for (i = 0; i < kDialogueLines; i++) + _dialogueAnims[0] = 0; + + _loopStatus = kStatusOrdinary; + _loopSubstatus = kOuterLoop; + _shouldQuit = 0; + _shouldExitLoop = 0; + _isReloaded = 0; + _speechTick = 0; + _speechDuration = 0; + _objUnderCursor = 0; + _animUnderCursor = 0; + _markedAnimationIndex = 0; + _scheduledPalette = 0; + _fadePhases = 0; + _fadePhase = 0; + _fadeTick = 0; + _mouseChangeTick = 0; + _enableQuickHero = 0; + _wantQuickHero = 0; + _enableSpeedText = 0; + _titleAnim = 0; + _inventoryAnim = 0; + _walkingMapOverlay = 0; + _walkingShortestPathOverlay = 0; + _walkingObliquePathOverlay = 0; + _currentItem = 0; + _itemUnderCursor = 0; + _previousItemPosition = 0; + + for (i = 0; i < kInventorySlots; i++) + _inventory[i] = 0; + + _newRoom = 0; + _newGate = 0; + _previousRoom = 0; + _pushedNewRoom = 0; + _pushedNewGate = 0; + _currentDialogue = 0; + _dialogueArchive = 0; + _dialogueBlocks = 0; + _dialogueBegin = 0; + _dialogueExit = 0; + _currentBlock = 0; + _lastBlock = 0; + BArchive *initArchive = _vm->_initArchive; const BAFile *file; @@ -951,9 +1000,9 @@ void Game::dialogueMenu(int dialogueID) { debugC(7, kDraciLogicDebugLevel, "hit: %d, _lines[hit]: %d, lastblock: %d, dialogueLines: %d, dialogueExit: %d", - hit, _lines[hit], _lastBlock, _dialogueLinesNum, _dialogueExit); + hit, (hit >= 0 ? _lines[hit] : -1), _lastBlock, _dialogueLinesNum, _dialogueExit); - if ((!_dialogueExit) && (hit != -1) && (_lines[hit] != -1)) { + if ((!_dialogueExit) && (hit >= 0) && (_lines[hit] != -1)) { if ((oldLines == 1) && (_dialogueLinesNum == 1) && (_lines[hit] == _lastBlock)) { break; } @@ -1361,7 +1410,7 @@ void Game::enterNewRoom() { // for the dragon in the persons array if (_newRoom == _info._mapRoom) { _persons[kDragonObject]._x = 160; - _persons[kDragonObject]._y = 0; + _persons[kDragonObject]._y = 0; } // Set the appropriate loop status before loading the room diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 8ff60033ed..504476869e 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -41,65 +41,65 @@ namespace Draci { void Script::setupCommandList() { /** A table of all the commands the game player uses */ static const GPL2Command gplCommands[] = { - { 0, 0, "gplend", 0, { }, NULL }, - { 0, 1, "exit", 0, { }, NULL }, - { 1, 1, "goto", 1, { kGPL2Ident }, &Script::c_Goto }, - { 2, 1, "Let", 2, { kGPL2Ident, kGPL2Math }, &Script::c_Let }, - { 3, 1, "if", 2, { kGPL2Math, kGPL2Ident }, &Script::c_If }, - { 4, 1, "Start", 2, { kGPL2Ident, kGPL2Str }, &Script::start }, - { 5, 1, "Load", 2, { kGPL2Ident, kGPL2Str }, &Script::load }, - { 5, 2, "StartPlay", 2, { kGPL2Ident, kGPL2Str }, &Script::startPlay }, - { 5, 3, "JustTalk", 0, { }, &Script::justTalk }, - { 5, 4, "JustStay", 0, { }, &Script::justStay }, - { 6, 1, "Talk", 2, { kGPL2Ident, kGPL2Str }, &Script::talk }, - { 7, 1, "ObjStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStat }, - { 7, 2, "ObjStat_On", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStatOn }, - { 8, 1, "IcoStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::icoStat }, - { 9, 1, "Dialogue", 1, { kGPL2Str }, &Script::dialogue }, - { 9, 2, "ExitDialogue", 0, { }, &Script::exitDialogue }, - { 9, 3, "ResetDialogue", 0, { }, &Script::resetDialogue }, - { 9, 4, "ResetDialogueFrom", 0, { }, &Script::resetDialogueFrom }, - { 9, 5, "ResetBlock", 1, { kGPL2Ident }, &Script::resetBlock }, - { 10, 1, "WalkOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOn }, - { 10, 2, "StayOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::stayOn }, - { 10, 3, "WalkOnPlay", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOnPlay }, - { 11, 1, "LoadPalette", 1, { kGPL2Str }, &Script::loadPalette }, - { 12, 1, "SetPalette", 0, { }, &Script::setPalette }, - { 12, 2, "BlackPalette", 0, { }, &Script::blackPalette }, - { 13, 1, "FadePalette", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalette }, - { 13, 2, "FadePalettePlay", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalettePlay }, - { 14, 1, "NewRoom", 2, { kGPL2Ident, kGPL2Num }, &Script::newRoom }, - { 15, 1, "ExecInit", 1, { kGPL2Ident }, &Script::execInit }, - { 15, 2, "ExecLook", 1, { kGPL2Ident }, &Script::execLook }, - { 15, 3, "ExecUse", 1, { kGPL2Ident }, &Script::execUse }, - { 18, 1, "LoadMusic", 1, { kGPL2Str }, &Script::loadMusic }, - { 18, 2, "StartMusic", 0, { }, &Script::startMusic }, - { 18, 3, "StopMusic", 0, { }, &Script::stopMusic }, - { 19, 1, "Mark", 0, { }, &Script::mark }, - { 19, 2, "Release", 0, { }, &Script::release }, - { 20, 1, "Play", 0, { }, &Script::play }, - { 21, 1, "LoadMap", 1, { kGPL2Str }, &Script::loadMap }, - { 21, 2, "RoomMap", 0, { }, &Script::roomMap }, - { 22, 1, "DisableQuickHero", 0, { }, &Script::disableQuickHero }, - { 22, 2, "EnableQuickHero", 0, { }, &Script::enableQuickHero }, - { 23, 1, "DisableSpeedText", 0, { }, &Script::disableSpeedText }, - { 23, 2, "EnableSpeedText", 0, { }, &Script::enableSpeedText }, - { 24, 1, "QuitGame", 0, { }, &Script::quitGame }, - { 25, 1, "PushNewRoom", 0, { }, &Script::pushNewRoom }, - { 25, 2, "PopNewRoom", 0, { }, &Script::popNewRoom }, + { 0, 0, "gplend", 0, { }, NULL }, + { 0, 1, "exit", 0, { }, NULL }, + { 1, 1, "goto", 1, { kGPL2Ident }, &Script::c_Goto }, + { 2, 1, "Let", 2, { kGPL2Ident, kGPL2Math }, &Script::c_Let }, + { 3, 1, "if", 2, { kGPL2Math, kGPL2Ident }, &Script::c_If }, + { 4, 1, "Start", 2, { kGPL2Ident, kGPL2Str }, &Script::start }, + { 5, 1, "Load", 2, { kGPL2Ident, kGPL2Str }, &Script::load }, + { 5, 2, "StartPlay", 2, { kGPL2Ident, kGPL2Str }, &Script::startPlay }, + { 5, 3, "JustTalk", 0, { }, &Script::justTalk }, + { 5, 4, "JustStay", 0, { }, &Script::justStay }, + { 6, 1, "Talk", 2, { kGPL2Ident, kGPL2Str }, &Script::talk }, + { 7, 1, "ObjStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStat }, + { 7, 2, "ObjStat_On", 2, { kGPL2Ident, kGPL2Ident }, &Script::objStatOn }, + { 8, 1, "IcoStat", 2, { kGPL2Ident, kGPL2Ident }, &Script::icoStat }, + { 9, 1, "Dialogue", 1, { kGPL2Str }, &Script::dialogue }, + { 9, 2, "ExitDialogue", 0, { }, &Script::exitDialogue }, + { 9, 3, "ResetDialogue", 0, { }, &Script::resetDialogue }, + { 9, 4, "ResetDialogueFrom", 0, { }, &Script::resetDialogueFrom }, + { 9, 5, "ResetBlock", 1, { kGPL2Ident }, &Script::resetBlock }, + { 10, 1, "WalkOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOn }, + { 10, 2, "StayOn", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::stayOn }, + { 10, 3, "WalkOnPlay", 3, { kGPL2Num, kGPL2Num, kGPL2Ident }, &Script::walkOnPlay }, + { 11, 1, "LoadPalette", 1, { kGPL2Str }, &Script::loadPalette }, + { 12, 1, "SetPalette", 0, { }, &Script::setPalette }, + { 12, 2, "BlackPalette", 0, { }, &Script::blackPalette }, + { 13, 1, "FadePalette", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalette }, + { 13, 2, "FadePalettePlay", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, &Script::fadePalettePlay }, + { 14, 1, "NewRoom", 2, { kGPL2Ident, kGPL2Num }, &Script::newRoom }, + { 15, 1, "ExecInit", 1, { kGPL2Ident }, &Script::execInit }, + { 15, 2, "ExecLook", 1, { kGPL2Ident }, &Script::execLook }, + { 15, 3, "ExecUse", 1, { kGPL2Ident }, &Script::execUse }, + { 18, 1, "LoadMusic", 1, { kGPL2Str }, &Script::loadMusic }, + { 18, 2, "StartMusic", 0, { }, &Script::startMusic }, + { 18, 3, "StopMusic", 0, { }, &Script::stopMusic }, + { 19, 1, "Mark", 0, { }, &Script::mark }, + { 19, 2, "Release", 0, { }, &Script::release }, + { 20, 1, "Play", 0, { }, &Script::play }, + { 21, 1, "LoadMap", 1, { kGPL2Str }, &Script::loadMap }, + { 21, 2, "RoomMap", 0, { }, &Script::roomMap }, + { 22, 1, "DisableQuickHero", 0, { }, &Script::disableQuickHero }, + { 22, 2, "EnableQuickHero", 0, { }, &Script::enableQuickHero }, + { 23, 1, "DisableSpeedText", 0, { }, &Script::disableSpeedText }, + { 23, 2, "EnableSpeedText", 0, { }, &Script::enableSpeedText }, + { 24, 1, "QuitGame", 0, { }, &Script::quitGame }, + { 25, 1, "PushNewRoom", 0, { }, &Script::pushNewRoom }, + { 25, 2, "PopNewRoom", 0, { }, &Script::popNewRoom }, // The following commands are not used in the original game files. - { 16, 1, "RepaintInventory", 0, { }, NULL }, - { 16, 2, "ExitInventory", 0, { }, NULL }, - { 17, 1, "ExitMap", 0, { }, NULL }, - { 18, 4, "FadeOutMusic", 1, { kGPL2Num }, NULL }, - { 18, 5, "FadeInMusic", 1, { kGPL2Num }, NULL }, + { 16, 1, "RepaintInventory", 0, { }, NULL }, + { 16, 2, "ExitInventory", 0, { }, NULL }, + { 17, 1, "ExitMap", 0, { }, NULL }, + { 18, 4, "FadeOutMusic", 1, { kGPL2Num }, NULL }, + { 18, 5, "FadeInMusic", 1, { kGPL2Num }, NULL }, // The following commands are not even defined in the game // sources, but their numbers are allocated for internal // purposes of the old player. - { 26, 1, "ShowCheat", 0, { }, NULL }, - { 26, 2, "HideCheat", 0, { }, NULL }, - { 26, 3, "ClearCheat", 1, { kGPL2Num }, NULL }, - { 27, 1, "FeedPassword", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, NULL } + { 26, 1, "ShowCheat", 0, { }, NULL }, + { 26, 2, "HideCheat", 0, { }, NULL }, + { 26, 3, "ClearCheat", 1, { kGPL2Num }, NULL }, + { 27, 1, "FeedPassword", 3, { kGPL2Num, kGPL2Num, kGPL2Num }, NULL } }; /** Operators used by the mathematical evaluator */ diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 965cdabf3e..9a78904d25 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -38,9 +38,9 @@ const Displacement kNoDisplacement = { 0, 0, 1.0, 1.0 }; * height height of the image in the buffer */ static void transformToRows(byte *img, uint16 width, uint16 height) { - byte *buf = new byte[width * height]; + byte *buf = new byte[(uint)(width * height)]; byte *tmp = buf; - memcpy(buf, img, width * height); + memcpy(buf, img, (uint)(width * height)); for (uint16 i = 0; i < width; ++i) { for (uint16 j = 0; j < height; ++j) { diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 3676c6edac..4156398070 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -82,7 +82,7 @@ void Surface::markClean() { void Surface::fill(uint color) { byte *ptr = (byte *)getPixels(); - memset(ptr, color, w * h); + memset(ptr, color, (uint)(w * h)); } /** diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index f1ae769d80..195b968860 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -556,9 +556,15 @@ bool WalkingState::alignHeroToEdge(const Common::Point &p1, const Common::Point } bool reachedEnd; if (movement == kMoveLeft || movement == kMoveRight) { + if (p2Diff.x == 0) { + error("Wrong value for horizontal movement"); + } reachedEnd = movement == kMoveLeft ? hero->x <= p2.x : hero->x >= p2.x; hero->y += hero->x * p2Diff.y / p2Diff.x - prevHero.x * p2Diff.y / p2Diff.x; } else { + if (p2Diff.y == 0) { + error("Wrong value for vertical movement"); + } reachedEnd = movement == kMoveUp ? hero->y <= p2.y : hero->y >= p2.y; hero->x += hero->y * p2Diff.x / p2Diff.y - prevHero.y * p2Diff.x / p2Diff.y; } diff --git a/engines/draci/walking.h b/engines/draci/walking.h index a43aeb272a..7e4a3184f5 100644 --- a/engines/draci/walking.h +++ b/engines/draci/walking.h @@ -103,7 +103,17 @@ struct GPL2Program; class WalkingState { public: - explicit WalkingState(DraciEngine *vm) : _vm(vm) { stopWalking(); } + explicit WalkingState(DraciEngine *vm) : _vm(vm) { + _dir = kDirectionLast; + _startingDirection = kMoveUndefined; + _segment = 0; + _lastAnimPhase = 0; + _turningFinished = 0; + _callbackOffset = 0; + + stopWalking(); + } + ~WalkingState() {} void stopWalking(); |