diff options
59 files changed, 1048 insertions, 971 deletions
@@ -5,6 +5,11 @@ For a more comprehensive changelog of the latest experimental code, see: SDL ports: - Added support for OpenGL (GSoC Task). + AGOS: + - Fixed bug breaking support for loading data directly from + InstallShield cabinets in The Feeble Files and Simon the + Sorcerer's Puzzle Pack. + Broken Sword 1: - Fixed incorrect sound effects in the DOS/Windows demo. diff --git a/backends/platform/maemo/debian/changelog b/backends/platform/maemo/debian/changelog index d3e0287186..8a9d8ee3c3 100644 --- a/backends/platform/maemo/debian/changelog +++ b/backends/platform/maemo/debian/changelog @@ -1,8 +1,14 @@ -scummvm (1.4.0~git) unstable; urgency=low +scummvm (1.5.0~git) unstable; urgency=low - * development snapshot + * Development snapshot - -- Tarek Soliman <tsoliman@scummvm.org> Wed, 05 Oct 2011 19:01:25 -0500 + -- Tarek Soliman <tsoliman@scummvm.org> Tue, 15 Nov 2011 14:56:57 -0600 + +scummvm (1.4.0) unstable; urgency=low + + * 1.4.0 release + + -- Tarek Soliman <tsoliman@scummvm.org> Thu, 03 Nov 2011 13:54:04 -0500 scummvm (1.2.1~pre) unstable; urgency=low diff --git a/devtools/tasmrecover/dreamweb/dreamweb.asm b/devtools/tasmrecover/dreamweb/dreamweb.asm index 8a52435b0c..d8a728c382 100644 --- a/devtools/tasmrecover/dreamweb/dreamweb.asm +++ b/devtools/tasmrecover/dreamweb/dreamweb.asm @@ -1129,6 +1129,8 @@ Screenupdate proc near call newplace call mainscreen + cmp quitrequested, 0 + jnz finishearly call animpointer call showpointer cmp watchingtime,0 diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 2066ae9b3d..f15d3d93f3 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -158,6 +158,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'dumppointer', 'showpointer', 'animpointer', + 'showicon', 'checkcoords', 'readmouse', 'readmouse1', @@ -198,8 +199,19 @@ generator = cpp(context, "DreamGen", blacklist = [ 'findnextcolon', 'usetext', 'bresenhams', + 'sortoutmap', + 'showcity', 'examineobtext', 'wornerror', + 'getpersframe', + 'convicons', + 'examineob', + 'showwatch', + 'roomname', + 'transfertext', + 'splitintolines', + 'initrain', + 'checkbasemem', ], skip_output = [ # These functions are processed but not output 'dreamweb', @@ -209,6 +221,8 @@ generator = cpp(context, "DreamGen", blacklist = [ 'loadgame', 'savegame', 'zoomonoff', - 'doload' + 'inventory', + 'mainscreen', + 'doload', ]) generator.generate('dreamweb') #start routine diff --git a/engines/agos/agos.h b/engines/agos/agos.h index cf75842cdd..03feafa70f 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -197,6 +197,7 @@ public: void registerArchive(const Common::String &filename, int priority); #endif + bool hasFile(const Common::String &name); Common::SeekableReadStream *open(const Common::String &filename); private: diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index d9d6b71a2a..db2cff328c 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -525,25 +525,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) { memcpy(shortName, baseName, 6); sprintf(filename, "%s~1.dxa", shortName); - if (Common::File::exists(filename)) { + if (vm->_archives.hasFile(filename)) { memset(baseName, 0, sizeof(baseName)); memcpy(baseName, filename, 8); } sprintf(filename, "%s~1.smk", shortName); - if (Common::File::exists(filename)) { + if (vm->_archives.hasFile(filename)) { memset(baseName, 0, sizeof(baseName)); memcpy(baseName, filename, 8); } } sprintf(filename, "%s.dxa", baseName); - if (Common::File::exists(filename)) { + if (vm->_archives.hasFile(filename)) { return new MoviePlayerDXA(vm, baseName); } sprintf(filename, "%s.smk", baseName); - if (Common::File::exists(filename)) { + if (vm->_archives.hasFile(filename)) { return new MoviePlayerSMK(vm, baseName); } diff --git a/engines/agos/installshield_cab.cpp b/engines/agos/installshield_cab.cpp index f7b49a64c5..ac4e40d1d1 100644 --- a/engines/agos/installshield_cab.cpp +++ b/engines/agos/installshield_cab.cpp @@ -162,7 +162,6 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in } bool InstallShieldCabinet::hasFile(const Common::String &name) { - warning("hasFile: Filename %s", name.c_str()); return _map.contains(name); } diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 69447f4b83..62197340d2 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -47,6 +47,13 @@ void ArchiveMan::registerArchive(const Common::String &filename, int priority) { } #endif +bool ArchiveMan::hasFile(const Common::String &name) { + if (_fallBack && SearchMan.hasFile(name)) + return true; + + return Common::SearchSet::hasFile(name); +} + Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) { if (_fallBack && SearchMan.hasFile(filename)) { return SearchMan.createReadStreamForMember(filename); diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 74a855f442..87654c53f4 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -53,9 +53,7 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _oldLev = 0; _pocPtr = 0; _bitmapPalette = NULL; - - - + _quitFlag = false; } void CGEEngine::initSceneValues() { @@ -144,7 +142,6 @@ void CGEEngine::deinit() { DebugMan.clearAllDebugChannels(); delete _console; - _midiPlayer->killMidi(); // Delete engine objects delete _vga; @@ -161,8 +158,9 @@ void CGEEngine::deinit() { delete _keyboard; delete _mouse; delete _eventManager; - delete _fx; delete _sound; + delete _fx; + delete _midiPlayer; delete _font; delete _commandHandler; delete _commandHandlerTurbo; diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 2ce154a4fb..2aada420ed 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -140,6 +140,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); static const int _maxSceneArr[5]; + bool _quitFlag; const ADGameDescription *_gameDescription; int _startupMode; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 53078fe8f8..e5831400ee 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -923,7 +923,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) { if (mask & kMouseLeftUp) switchMusic(); else if (mask & kMouseRightUp) - warning("TODO: Use ScummVM sound dialog"); + openMainMenuDialog(); break; case 3: if (mask & kMouseLeftUp) @@ -1255,12 +1255,15 @@ void CGEEngine::mainLoop() { // Handle any pending events _eventManager->poll(); + + // Check shouldQuit() + _quitFlag = shouldQuit(); } void CGEEngine::handleFrame() { // Game frame delay uint32 millis = g_system->getMillis(); - while (!_eventManager->_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) { + while (!_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) { // Handle any pending events _eventManager->poll(); @@ -1309,7 +1312,7 @@ void CGEEngine::loadUser() { } void CGEEngine::runGame() { - if (_eventManager->_quitFlag) + if (_quitFlag) return; loadHeroXY(); @@ -1339,9 +1342,7 @@ void CGEEngine::runGame() { _vga->_showQ->append(_mouse); -// ___________ loadUser(); -// ~~~~~~~~~~~ if ((_sprite = _vga->_spareQ->locate(121)) != NULL) _commandHandlerTurbo->addCommand(kCmdSeq, -1, _vga->_mono, _sprite); @@ -1409,7 +1410,7 @@ void CGEEngine::runGame() { _keyboard->setClient(_sys); // main loop - while (!_finis && !_eventManager->_quitFlag) { + while (!_finis && !_quitFlag) { if (_flag[3]) _commandHandler->addCallback(kCmdExec, -1, 0, kQGame); mainLoop(); @@ -1432,7 +1433,7 @@ void CGEEngine::runGame() { void CGEEngine::movie(const char *ext) { assert(ext); - if (_eventManager->_quitFlag) + if (_quitFlag) return; char fn[12]; @@ -1444,7 +1445,7 @@ void CGEEngine::movie(const char *ext) { feedSnail(_vga->_showQ->locate(999), kTake); _vga->_showQ->append(_mouse); _keyboard->setClient(_sys); - while (!_commandHandler->idle() && !_eventManager->_quitFlag) + while (!_commandHandler->idle() && !_quitFlag) mainLoop(); _keyboard->setClient(NULL); @@ -1456,7 +1457,7 @@ void CGEEngine::movie(const char *ext) { } bool CGEEngine::showTitle(const char *name) { - if (_eventManager->_quitFlag) + if (_quitFlag) return false; _bitmapPalette = _vga->_sysPal; @@ -1489,7 +1490,7 @@ bool CGEEngine::showTitle(const char *name) { _mouse->on(); for (; !_commandHandler->idle() || Vmenu::_addr;) { mainLoop(); - if (_eventManager->_quitFlag) + if (_quitFlag) return false; } diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index f2f5764e54..58f84d0c3e 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -55,16 +55,6 @@ static const ADGameDescription gameDescriptions[] = { }, Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, - // English ScummVM version - { - "soltys", "", - { - {"vol.cat", 0, "bd08969b5f1acea0f92d195f750c17d5", 50176}, - {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8428832}, - AD_LISTEND - }, - Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) - }, { "soltys", "Soltys Demo (not supported)", { @@ -83,6 +73,24 @@ static const ADGameDescription gameDescriptions[] = { }, Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO1(GUIO_NONE) }, + { + "soltys", "Soltys Freeware v1.0", + { + {"vol.cat", 0, "f1675684c68ab90272f5776f8f2c3974", 50176}, + {"vol.dat", 0, "4ffeff4abc99ac5999b55ccfc56ab1df", 8430868}, + AD_LISTEND + }, + Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS , GUIO1(GUIO_NONE) + }, + { + "soltys", "Soltys Freeware v1.0", + { + {"vol.cat", 0, "20fdce799adb618100ef9ee2362be875", 50176}, + {"vol.dat", 0, "0e43331c846094d77f5dd201827e0a3b", 8439339}, + AD_LISTEND + }, + Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) + }, AD_TABLE_END_MARKER }; diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 8f76d2efd5..e277d79ee1 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -282,7 +282,6 @@ void Mouse::newMouse(Common::Event &event) { /*----------------- EventManager interface -----------------*/ EventManager::EventManager(CGEEngine *vm) : _vm(vm){ - _quitFlag = false; _eventQueueHead = 0; _eventQueueTail = 0; memset(&_eventQueue, 0, kEventMax * sizeof(CGEEvent)); @@ -292,10 +291,6 @@ EventManager::EventManager(CGEEngine *vm) : _vm(vm){ void EventManager::poll() { while (g_system->getEventManager()->pollEvent(_event)) { switch (_event.type) { - case Common::EVENT_QUIT: - // Signal to quit - _quitFlag = true; - return; case Common::EVENT_KEYDOWN: case Common::EVENT_KEYUP: // Handle keyboard events diff --git a/engines/cge/events.h b/engines/cge/events.h index a4cdfed793..ac1e6231fe 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -140,8 +140,6 @@ private: void handleEvents(); public: - bool _quitFlag; - EventManager(CGEEngine *vm); void poll(); void clearEvent(Sprite *spr); diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 021dad5709..d426787ed4 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -135,6 +135,13 @@ char *Text::getText(int ref) { void Text::say(const char *text, Sprite *spr) { _vm->killText(); + + if (!text) + return; + + if (*text == 0) + return; + _vm->_talk = new Talk(_vm, text, kTBRound); if (!_vm->_talk) return; @@ -180,6 +187,9 @@ void CGEEngine::inf(const char *text) { if (!text) return; + if (*text == 0) + return; + killText(); _talk = new Talk(this, text, kTBRect); if (!_talk) diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 49cfcd3084..47b77688f7 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -492,7 +492,7 @@ void Sprite::sync(Common::Serializer &s) { _flags._near = flags & 0x0002 ? true : false; _flags._drag = flags & 0x0004 ? true : false; _flags._hold = flags & 0x0008 ? true : false; - _flags._____ = flags & 0x0010 ? true : false; + _flags._dummy = flags & 0x0010 ? true : false; _flags._slav = flags & 0x0020 ? true : false; _flags._syst = flags & 0x0040 ? true : false; _flags._kill = flags & 0x0080 ? true : false; @@ -516,7 +516,7 @@ void Sprite::sync(Common::Serializer &s) { flags = (flags << 1) | _flags._kill; flags = (flags << 1) | _flags._syst; flags = (flags << 1) | _flags._slav; - flags = (flags << 1) | _flags._____; + flags = (flags << 1) | _flags._dummy; flags = (flags << 1) | _flags._hold; flags = (flags << 1) | _flags._drag; flags = (flags << 1) | _flags._near; diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 0c514c4a66..559fa78cdb 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -91,7 +91,7 @@ public: uint16 _near : 1; // Near action lock uint16 _drag : 1; // sprite is moveable uint16 _hold : 1; // sprite is held with mouse - uint16 _____ : 1; // intrrupt driven animation + uint16 _dummy : 1; // intrrupt driven animation uint16 _slav : 1; // slave object uint16 _syst : 1; // system object uint16 _kill : 1; // dispose memory after remove diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index d0340238cd..a1337aefa7 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -998,7 +998,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y) { ovlDataStruct *ovl2 = NULL; ovlDataStruct *ovl3 = NULL; - ovlDataStruct *ovl4 = NULL; + //ovlDataStruct *ovl4 = NULL; if (verbeOvl > 0) ovl2 = overlayTable[verbeOvl].ovlData; @@ -1006,8 +1006,8 @@ bool findRelation(int objOvl, int objIdx, int x, int y) { if (obj1Ovl > 0) ovl3 = overlayTable[obj1Ovl].ovlData; - if (obj2Ovl > 0) - ovl4 = overlayTable[obj2Ovl].ovlData; + //if (obj2Ovl > 0) + // ovl4 = overlayTable[obj2Ovl].ovlData; if ((ovl3) && (ptrHead->obj1Number >= 0)) { testState = ptrHead->obj1OldState; diff --git a/engines/cruise/volume.cpp b/engines/cruise/volume.cpp index 773a146b9a..4b64d4ff77 100644 --- a/engines/cruise/volume.cpp +++ b/engines/cruise/volume.cpp @@ -326,7 +326,7 @@ int closeCnf() { int16 readVolCnf() { int i; Common::File fileHandle; - short int sizeHEntry; + //short int sizeHEntry; volumeDataLoaded = 0; @@ -344,7 +344,7 @@ int16 readVolCnf() { } numOfDisks = fileHandle.readSint16BE(); - sizeHEntry = fileHandle.readSint16BE(); // size of one header entry - 20 bytes + /*sizeHEntry =*/ fileHandle.readSint16BE(); // size of one header entry - 20 bytes for (i = 0; i < numOfDisks; i++) { // fread(&volumeData[i],20,1,fileHandle); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 8f4b4cea21..73ed6f121d 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -2262,129 +2262,6 @@ forgotone: setuptimeduse(); } -void DreamGenContext::initrain() { - STACK_CHECK; - es = data.word(kBuffers); - di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); - bx = offset_rainlocations; -checkmorerain: - al = cs.byte(bx); - _cmp(al, 255); - if (flags.z()) - goto finishinitrain; - _cmp(al, data.byte(kReallocation)); - if (!flags.z()) - goto checkrain; - al = cs.byte(bx+1); - _cmp(al, data.byte(kMapx)); - if (!flags.z()) - goto checkrain; - al = cs.byte(bx+2); - _cmp(al, data.byte(kMapy)); - if (!flags.z()) - goto checkrain; - al = cs.byte(bx+3); - data.byte(kRainspace) = al; - goto dorain; -checkrain: - _add(bx, 4); - goto checkmorerain; -dorain: - cx = 4; -initraintop: - randomnumber(); - _and(al, 31); - _add(al, 3); - _cmp(al, data.byte(kRainspace)); - if (!flags.c()) - goto initraintop; - _add(cl, al); - _cmp(cl, data.byte(kMapxsize)); - if (!flags.c()) - goto initrainside; - push(cx); - splitintolines(); - cx = pop(); - goto initraintop; -initrainside: - cl = data.byte(kMapxsize); - _dec(cl); -initrainside2: - randomnumber(); - _and(al, 31); - _add(al, 3); - _cmp(al, data.byte(kRainspace)); - if (!flags.c()) - goto initrainside2; - _add(ch, al); - _cmp(ch, data.byte(kMapysize)); - if (!flags.c()) - goto finishinitrain; - push(cx); - splitintolines(); - cx = pop(); - goto initrainside2; -finishinitrain: - al = 255; - _stosb(); -} - -void DreamGenContext::splitintolines() { - STACK_CHECK; -lookforlinestart: - getblockofpixel(); - _cmp(al, 0); - if (!flags.z()) - goto foundlinestart; - _dec(cl); - _inc(ch); - _cmp(cl, 0); - if (flags.z()) - return /* (endofthisline) */; - _cmp(ch, data.byte(kMapysize)); - if (!flags.c()) - return /* (endofthisline) */; - goto lookforlinestart; -foundlinestart: - es.word(di) = cx; - bh = 1; -lookforlineend: - getblockofpixel(); - _cmp(al, 0); - if (flags.z()) - goto foundlineend; - _dec(cl); - _inc(ch); - _cmp(cl, 0); - if (flags.z()) - goto foundlineend; - _cmp(ch, data.byte(kMapysize)); - if (!flags.c()) - goto foundlineend; - _inc(bh); - goto lookforlineend; -foundlineend: - push(cx); - es.byte(di+2) = bh; - randomnumber(); - es.byte(di+3) = al; - randomnumber(); - es.byte(di+4) = al; - randomnumber(); - _and(al, 3); - _add(al, 4); - es.byte(di+5) = al; - _add(di, 6); - cx = pop(); - _cmp(cl, 0); - if (flags.z()) - return /* (endofthisline) */; - _cmp(ch, data.byte(kMapysize)); - if (!flags.c()) - return /* (endofthisline) */; - goto lookforlinestart; -} - void DreamGenContext::liftnoise() { STACK_CHECK; _cmp(data.byte(kReallocation), 5); @@ -3851,81 +3728,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::examineob() { - STACK_CHECK; - data.byte(kPointermode) = 0; - data.word(kTimecount) = 0; -examineagain: - data.byte(kInmaparea) = 0; - data.byte(kExamagain) = 0; - data.byte(kOpenedob) = 255; - data.byte(kOpenedtype) = 255; - data.byte(kInvopen) = 0; - al = data.byte(kCommandtype); - data.byte(kObjecttype) = al; - data.byte(kItemframe) = 0; - data.byte(kPointerframe) = 0; - createpanel(); - showpanel(); - showman(); - showexit(); - obicons(); - obpicture(); - describeob(); - undertextline(); - data.byte(kCommandtype) = 255; - readmouse(); - showpointer(); - worktoscreen(); - delpointer(); -waitexam: - readmouse(); - showpointer(); - vsync(); - dumppointer(); - dumptextline(); - delpointer(); - data.byte(kGetback) = 0; - bx = offset_examlist; - _cmp(data.byte(kInvopen), 0); - if (flags.z()) - goto notuseinv; - bx = offset_invlist1; - _cmp(data.byte(kInvopen), 1); - if (flags.z()) - goto notuseinv; - bx = offset_withlist1; -notuseinv: - checkcoords(); - _cmp(data.byte(kQuitrequested), 0); - if (!flags.z()) - goto stopwaiting; - _cmp(data.byte(kExamagain), 0); - if (flags.z()) - goto norex; - goto examineagain; -norex: - _cmp(data.byte(kGetback), 0); - if (flags.z()) - goto waitexam; -stopwaiting: - data.byte(kPickup) = 0; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - goto iswatching; - _cmp(data.byte(kNewlocation), 255); - if (!flags.z()) - goto justgetback; -iswatching: - makemainscreen(); - data.byte(kInvopen) = 0; - data.byte(kOpenedob) = 255; - return; -justgetback: - data.byte(kInvopen) = 0; - data.byte(kOpenedob) = 255; -} - void DreamGenContext::makemainscreen() { STACK_CHECK; createpanel(); @@ -4233,126 +4035,6 @@ foundmatch: bx = pop(); } -void DreamGenContext::inventory() { - STACK_CHECK; - _cmp(data.byte(kMandead), 1); - if (flags.z()) - goto iswatchinv; - _cmp(data.word(kWatchingtime), 0); - if (flags.z()) - goto notwatchinv; -iswatchinv: - blank(); - return; -notwatchinv: - _cmp(data.byte(kCommandtype), 239); - if (flags.z()) - goto alreadyopinv; - data.byte(kCommandtype) = 239; - al = 32; - commandonly(); -alreadyopinv: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (cantopinv) */; - _and(ax, 1); - if (!flags.z()) - goto doopeninv; - return; -doopeninv: - data.word(kTimecount) = 0; - data.byte(kPointermode) = 0; - data.byte(kInmaparea) = 0; - animpointer(); - createpanel(); - showpanel(); - examicon(); - showman(); - showexit(); - undertextline(); - data.byte(kPickup) = 0; - data.byte(kInvopen) = 2; - openinv(); - readmouse(); - showpointer(); - worktoscreen(); - delpointer(); - data.byte(kOpenedob) = 255; - goto waitexam; - return; -/*continuing to unbounded code: examineagain from examineob:3-69*/ -examineagain: - data.byte(kInmaparea) = 0; - data.byte(kExamagain) = 0; - data.byte(kOpenedob) = 255; - data.byte(kOpenedtype) = 255; - data.byte(kInvopen) = 0; - al = data.byte(kCommandtype); - data.byte(kObjecttype) = al; - data.byte(kItemframe) = 0; - data.byte(kPointerframe) = 0; - createpanel(); - showpanel(); - showman(); - showexit(); - obicons(); - obpicture(); - describeob(); - undertextline(); - data.byte(kCommandtype) = 255; - readmouse(); - showpointer(); - worktoscreen(); - delpointer(); -waitexam: - readmouse(); - showpointer(); - vsync(); - dumppointer(); - dumptextline(); - delpointer(); - data.byte(kGetback) = 0; - bx = offset_examlist; - _cmp(data.byte(kInvopen), 0); - if (flags.z()) - goto notuseinv; - bx = offset_invlist1; - _cmp(data.byte(kInvopen), 1); - if (flags.z()) - goto notuseinv; - bx = offset_withlist1; -notuseinv: - checkcoords(); - _cmp(data.byte(kQuitrequested), 0); - if (!flags.z()) - goto stopwaiting; - _cmp(data.byte(kExamagain), 0); - if (flags.z()) - goto norex; - goto examineagain; -norex: - _cmp(data.byte(kGetback), 0); - if (flags.z()) - goto waitexam; -stopwaiting: - data.byte(kPickup) = 0; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - goto iswatching; - _cmp(data.byte(kNewlocation), 255); - if (!flags.z()) - goto justgetback; -iswatching: - makemainscreen(); - data.byte(kInvopen) = 0; - data.byte(kOpenedob) = 255; - return; -justgetback: - data.byte(kInvopen) = 0; - data.byte(kOpenedob) = 255; -} - void DreamGenContext::setpickup() { STACK_CHECK; _cmp(data.byte(kObjecttype), 1); @@ -5479,35 +5161,6 @@ void DreamGenContext::transfercontoex() { ds.byte(si+2) = 255; } -void DreamGenContext::transfertext() { - STACK_CHECK; - es = data.word(kExtras); - al = data.byte(kExpos); - ah = 0; - _add(ax, ax); - bx = (0+2080+30000+(16*114)); - _add(bx, ax); - di = data.word(kExtextpos); - es.word(bx) = di; - _add(di, (0+2080+30000+(16*114)+((114+2)*2))); - al = data.byte(kItemtotran); - ah = 0; - _add(ax, ax); - ds = data.word(kFreedesc); - bx = (0); - _add(bx, ax); - si = (0+(82*2)); - ax = ds.word(bx); - _add(si, ax); -moretext: - _lodsb(); - _stosb(); - _inc(data.word(kExtextpos)); - _cmp(al, 0); - if (!flags.z()) - goto moretext; -} - void DreamGenContext::purgealocation() { STACK_CHECK; push(ax); @@ -5950,31 +5603,6 @@ notnexttalk: data.byte(kVolumeto) = 0; } -void DreamGenContext::convicons() { - STACK_CHECK; - al = data.byte(kCharacter); - _and(al, 127); - getpersframe(); - di = 234; - bx = 2; - data.word(kCurrentframe) = ax; - findsource(); - ax = data.word(kCurrentframe); - _sub(ax, data.word(kTakeoff)); - ah = 0; - showframe(); -} - -void DreamGenContext::getpersframe() { - STACK_CHECK; - ah = 0; - _add(ax, ax); - bx = ax; - es = data.word(kPeople); - _add(bx, (0)); - ax = es.word(bx); -} - void DreamGenContext::starttalk() { STACK_CHECK; data.byte(kTalkmode) = 0; @@ -6377,23 +6005,6 @@ quittravel: deallocatemem(); } -void DreamGenContext::showcity() { - STACK_CHECK; - clearwork(); - ds = data.word(kTempgraphics); - di = 57; - bx = 32; - al = 0; - ah = 0; - showframe(); - ds = data.word(kTempgraphics); - di = 120+57; - bx = 32; - al = 1; - ah = 0; - showframe(); -} - void DreamGenContext::lookatplace() { STACK_CHECK; _cmp(data.byte(kCommandtype), 224); @@ -13682,16 +13293,6 @@ void DreamGenContext::checkforemm() { STACK_CHECK; } -void DreamGenContext::checkbasemem() { - STACK_CHECK; - bx = data.word(kHowmuchalloc); - _cmp(bx, 0x9360); - if (!flags.c()) - return /* (enoughmem) */; - data.byte(kGameerror) = 5; - { quickquit(); return; }; -} - void DreamGenContext::allocatebuffers() { STACK_CHECK; bx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/16; @@ -13880,6 +13481,9 @@ void DreamGenContext::screenupdate() { STACK_CHECK; newplace(); mainscreen(); + _cmp(data.byte(kQuitrequested), 0); + if (!flags.z()) + return /* (finishearly) */; animpointer(); showpointer(); _cmp(data.word(kWatchingtime), 0); @@ -14245,22 +13849,6 @@ notzeronum: ch = 1; } -void DreamGenContext::mainscreen() { - STACK_CHECK; - data.byte(kInmaparea) = 0; - bx = offset_mainlist; - _cmp(data.byte(kWatchon), 1); - if (flags.z()) - goto checkmain; - bx = offset_mainlist2; -checkmain: - checkcoords(); - _cmp(data.byte(kWalkandexam), 0); - if (flags.z()) - return /* (finishmain) */; - walkandexamine(); -} - void DreamGenContext::madmanrun() { STACK_CHECK; _cmp(data.byte(kLocation), 14); @@ -14750,57 +14338,6 @@ success: data.byte(kTurndirection) = 0; } -void DreamGenContext::showicon() { - STACK_CHECK; - _cmp(data.byte(kReallocation), 50); - if (!flags.c()) - goto isdream1; - showpanel(); - showman(); - roomname(); - panelicons1(); - zoomicon(); - return; -isdream1: - ds = data.word(kTempsprites); - di = 72; - bx = 2; - al = 45; - ah = 0; - showframe(); - ds = data.word(kTempsprites); - di = 72+47; - bx = 2; - al = 46; - ah = 0; - showframe(); - ds = data.word(kTempsprites); - di = 69-10; - bx = 21; - al = 49; - ah = 0; - showframe(); - ds = data.word(kTempsprites); - di = 160+88; - bx = 2; - al = 45; - ah = 4; - showframe(); - ds = data.word(kTempsprites); - di = 160+43; - bx = 2; - al = 46; - ah = 4; - showframe(); - ds = data.word(kTempsprites); - di = 160+101; - bx = 21; - al = 49; - ah = 4; - showframe(); - middlepanel(); -} - void DreamGenContext::middlepanel() { STACK_CHECK; ds = data.word(kTempsprites); @@ -14854,42 +14391,6 @@ void DreamGenContext::showman() { showframe(); } -void DreamGenContext::roomname() { - STACK_CHECK; - di = 88; - bx = 18; - al = 53; - dl = 240; - printmessage(); - bl = data.byte(kRoomnum); - _cmp(bl, 32); - if (flags.c()) - goto notover32; - _sub(bl, 32); -notover32: - bh = 0; - _add(bx, bx); - es = data.word(kRoomdesc); - _add(bx, (0)); - ax = es.word(bx); - _add(ax, (0+(38*2))); - si = ax; - data.word(kLinespacing) = 7; - di = 88; - bx = 25; - dl = 120; - _cmp(data.byte(kWatchon), 1); - if (flags.z()) - goto gotpl; - dl = 160; -gotpl: - al = 0; - ah = 0; - printdirect(); - data.word(kLinespacing) = 10; - usecharset1(); -} - void DreamGenContext::usecharset1() { STACK_CHECK; ax = data.word(kCharset1); @@ -14943,20 +14444,6 @@ zoomisoff: showwatch(); } -void DreamGenContext::showwatch() { - STACK_CHECK; - _cmp(data.byte(kWatchon), 0); - if (flags.z()) - return /* (nowristwatch) */; - ds = data.word(kIcons1); - di = 250; - bx = 1; - al = 6; - ah = 0; - showframe(); - showtime(); -} - void DreamGenContext::zoomicon() { STACK_CHECK; _cmp(data.byte(kZoomon), 0); @@ -15374,29 +14861,6 @@ void DreamGenContext::restoreall() { setallchanges(); } -void DreamGenContext::sortoutmap() { - STACK_CHECK; - push(es); - push(di); - ds = data.word(kWorkspace); - si = 0; - es = data.word(kMapdata); - di = 0; - cx = (60); -blimey: - push(cx); - push(si); - cx = (66); - _movsb(cx, true); - si = pop(); - cx = pop(); - _add(si, 132); - if (--cx) - goto blimey; - di = pop(); - es = pop(); -} - void DreamGenContext::disablepath() { STACK_CHECK; push(cx); @@ -16747,8 +16211,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_adjustleft: adjustleft(); break; case addr_adjustright: adjustright(); break; case addr_reminders: reminders(); break; - case addr_initrain: initrain(); break; - case addr_splitintolines: splitintolines(); break; case addr_backobject: backobject(); break; case addr_liftnoise: liftnoise(); break; case addr_random: random(); break; @@ -16814,7 +16276,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_monprint: monprint(); break; case addr_fillopen: fillopen(); break; case addr_findallopen: findallopen(); break; - case addr_examineob: examineob(); break; case addr_makemainscreen: makemainscreen(); break; case addr_getbackfromob: getbackfromob(); break; case addr_incryanpage: incryanpage(); break; @@ -16858,7 +16319,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_transfertoex: transfertoex(); break; case addr_pickupconts: pickupconts(); break; case addr_transfercontoex: transfercontoex(); break; - case addr_transfertext: transfertext(); break; case addr_purgealocation: purgealocation(); break; case addr_emergencypurge: emergencypurge(); break; case addr_purgeanitem: purgeanitem(); break; @@ -16873,8 +16333,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_redrawmainscrn: redrawmainscrn(); break; case addr_getback1: getback1(); break; case addr_talk: talk(); break; - case addr_convicons: convicons(); break; - case addr_getpersframe: getpersframe(); break; case addr_starttalk: starttalk(); break; case addr_getpersontext: getpersontext(); break; case addr_moretalk: moretalk(); break; @@ -16883,7 +16341,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_redes: redes(); break; case addr_newplace: newplace(); break; case addr_selectlocation: selectlocation(); break; - case addr_showcity: showcity(); break; case addr_lookatplace: lookatplace(); break; case addr_getundercentre: getundercentre(); break; case addr_putundercentre: putundercentre(); break; @@ -17165,7 +16622,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_setupemm: setupemm(); break; case addr_removeemm: removeemm(); break; case addr_checkforemm: checkforemm(); break; - case addr_checkbasemem: checkbasemem(); break; case addr_allocatebuffers: allocatebuffers(); break; case addr_clearbuffers: clearbuffers(); break; case addr_clearchanges: clearchanges(); break; @@ -17199,15 +16655,12 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_printmessage2: printmessage2(); break; case addr_setwalk: setwalk(); break; case addr_workoutframes: workoutframes(); break; - case addr_showicon: showicon(); break; case addr_middlepanel: middlepanel(); break; case addr_showman: showman(); break; - case addr_roomname: roomname(); break; case addr_usecharset1: usecharset1(); break; case addr_usetempcharset: usetempcharset(); break; case addr_showexit: showexit(); break; case addr_panelicons1: panelicons1(); break; - case addr_showwatch: showwatch(); break; case addr_gettime: gettime(); break; case addr_zoomicon: zoomicon(); break; case addr_worktoscreenm: worktoscreenm(); break; @@ -17237,7 +16690,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_getridofall: getridofall(); break; case addr_restorereels: restorereels(); break; case addr_restoreall: restoreall(); break; - case addr_sortoutmap: sortoutmap(); break; case addr_disablepath: disablepath(); break; case addr_findroominloc: findroominloc(); break; case addr_dontloadseg: dontloadseg(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f3a763fbd8..20ef2f9818 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -60,7 +60,6 @@ public: static const uint16 addr_dontloadseg = 0xcb64; static const uint16 addr_findroominloc = 0xcb58; static const uint16 addr_disablepath = 0xcb50; - static const uint16 addr_sortoutmap = 0xcb48; static const uint16 addr_restoreall = 0xcb44; static const uint16 addr_restorereels = 0xcb40; static const uint16 addr_getridofall = 0xcb3c; @@ -90,15 +89,12 @@ public: static const uint16 addr_worktoscreenm = 0xca9c; static const uint16 addr_zoomicon = 0xca90; static const uint16 addr_gettime = 0xca8c; - static const uint16 addr_showwatch = 0xca88; static const uint16 addr_panelicons1 = 0xca84; static const uint16 addr_showexit = 0xca80; static const uint16 addr_usetempcharset = 0xca7c; static const uint16 addr_usecharset1 = 0xca78; - static const uint16 addr_roomname = 0xca74; static const uint16 addr_showman = 0xca6c; static const uint16 addr_middlepanel = 0xca68; - static const uint16 addr_showicon = 0xca64; static const uint16 addr_workoutframes = 0xca54; static const uint16 addr_setwalk = 0xca44; static const uint16 addr_printmessage2 = 0xca30; @@ -132,7 +128,6 @@ public: static const uint16 addr_clearchanges = 0xc974; static const uint16 addr_clearbuffers = 0xc970; static const uint16 addr_allocatebuffers = 0xc96c; - static const uint16 addr_checkbasemem = 0xc968; static const uint16 addr_checkforemm = 0xc964; static const uint16 addr_removeemm = 0xc960; static const uint16 addr_setupemm = 0xc95c; @@ -415,7 +410,6 @@ public: static const uint16 addr_putundercentre = 0xc4b8; static const uint16 addr_getundercentre = 0xc4b4; static const uint16 addr_lookatplace = 0xc4b0; - static const uint16 addr_showcity = 0xc4ac; static const uint16 addr_selectlocation = 0xc4a8; static const uint16 addr_newplace = 0xc4a4; static const uint16 addr_redes = 0xc4a0; @@ -424,8 +418,6 @@ public: static const uint16 addr_moretalk = 0xc494; static const uint16 addr_getpersontext = 0xc490; static const uint16 addr_starttalk = 0xc48c; - static const uint16 addr_getpersframe = 0xc488; - static const uint16 addr_convicons = 0xc484; static const uint16 addr_talk = 0xc480; static const uint16 addr_getback1 = 0xc47c; static const uint16 addr_redrawmainscrn = 0xc478; @@ -440,7 +432,6 @@ public: static const uint16 addr_purgeanitem = 0xc414; static const uint16 addr_emergencypurge = 0xc410; static const uint16 addr_purgealocation = 0xc40c; - static const uint16 addr_transfertext = 0xc404; static const uint16 addr_transfercontoex = 0xc400; static const uint16 addr_pickupconts = 0xc3fc; static const uint16 addr_transfertoex = 0xc3f8; @@ -484,7 +475,6 @@ public: static const uint16 addr_incryanpage = 0xc348; static const uint16 addr_getbackfromob = 0xc344; static const uint16 addr_makemainscreen = 0xc340; - static const uint16 addr_examineob = 0xc33c; static const uint16 addr_findallopen = 0xc32c; static const uint16 addr_fillopen = 0xc324; static const uint16 addr_monprint = 0xc314; @@ -550,8 +540,6 @@ public: static const uint16 addr_random = 0xc17c; static const uint16 addr_liftnoise = 0xc178; static const uint16 addr_backobject = 0xc170; - static const uint16 addr_splitintolines = 0xc164; - static const uint16 addr_initrain = 0xc160; static const uint16 addr_reminders = 0xc15c; static const uint16 addr_adjustright = 0xc158; static const uint16 addr_adjustleft = 0xc154; @@ -660,12 +648,11 @@ public: static const uint16 offset_speechfilename = 0x13eb; static const uint16 offset_rootdir = 0x0b8c; static const uint16 offset_gameerror3 = 0x1003; - static const uint16 offset_rainlocations = 0x0459; + static const uint16 offset_facelist = 0x0451; static const uint16 offset_diarylist = 0x0e9c; static const uint16 offset_decidelist = 0x13c1; static const uint16 offset_symbollist = 0x0e5e; static const uint16 offset_folderlist = 0x0e34; - static const uint16 offset_facelist = 0x0451; static const uint16 offset_operand1 = 0x0b7e; static const uint16 offset_keypadlist = 0x0d9a; static const uint16 kStartvars = 0; @@ -1268,7 +1255,7 @@ public: //void frameoutbh(); void getobtextstart(); void loadfolder(); - void decide(); + void dumpdiarykeys(); //void dumppointer(); void reelsonscreen(); void getridofreels(); @@ -1347,7 +1334,7 @@ public: //void deltextline(); void entercode(); void getopenedsize(); - void getpersframe(); + //void getpersframe(); void doshake(); void resetkeyboard(); //void showpanel(); @@ -1369,7 +1356,7 @@ public: void watchcount(); void fadedownmon(); void loadcart(); - //void calcfrframe(); + //void splitintolines(); void bartender(); void eden(); void showdiary(); @@ -1426,7 +1413,7 @@ public: void getridoftemp2(); void usebalcony(); void runendseq(); - void dumpdiarykeys(); + void decide(); void disablesoundint(); void priesttext(); //void showallex(); @@ -1522,7 +1509,7 @@ public: void placefreeobject(); void allpalette(); //void loopchannel0(); - void initrain(); + //void initrain(); void showleftpage(); void rockstar(); void adjustright(); @@ -1538,9 +1525,10 @@ public: void dumpsymbox(); void loadgame(); void getridoftemp(); - void showcity(); + //void showcity(); void dumpsymbol(); void disablepath(); + //void convicons(); void buttonsix(); void intro2text(); void showouterpad(); @@ -1607,16 +1595,14 @@ public: void mainman(); void mansatstill(); void channel1only(); - void checkbasemem(); + //void checkbasemem(); void lastfolder(); void transfermap(); - //void showreelframe(); void showmonk(); void diarykeyn(); void set16colpalette(); - void convicons(); - void interviewer(); void sparky(); + void interviewer(); void purgeanitem(); void madman(); void createpanel(); @@ -1656,7 +1642,7 @@ public: void startup(); void savegame(); void startpaltoend(); - void showicon(); + //void showicon(); void findopenpos(); void describeob(); void deleteexframe(); @@ -1666,7 +1652,7 @@ public: void actualsave(); void autolook(); void playguitar(); - void transfertext(); + //void showreelframe(); void searchforsame(); void showmainops(); void getback1(); @@ -1685,7 +1671,7 @@ public: void openinv(); void lookatplace(); void useaxe(); - void examineob(); + //void examineob(); void buttonnought(); void useelvdoor(); void putbackobstuff(); @@ -1769,7 +1755,7 @@ public: //void madmode(); void intro3text(); void allocatemem(); - void sortoutmap(); + //void sortoutmap(); //void showrain(); void useopened(); void inventory(); @@ -1796,6 +1782,7 @@ public: //void plotreel(); void swapwithopen(); //void makesprite(); + //void transfertext(); void dreamweb(); void droperror(); void edenscdplayer(); @@ -1803,7 +1790,7 @@ public: void checkinside(); void gates(); void newgame(); - void showwatch(); + //void showwatch(); //void turnanypathon(); void restorereels(); void setwalk(); @@ -1880,7 +1867,7 @@ public: void clearrest(); //void getreelframeax(); void barwoman(); - void roomname(); + //void roomname(); void credits(); void madmanrun(); void randomnum1(); @@ -1891,7 +1878,7 @@ public: void closefile(); void delcurs(); void randomaccess(); - void splitintolines(); + //void calcfrframe(); //void checkifex(); //void findobname(); void initialmoncols(); diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk index 21429dc960..d38d4db0db 100644 --- a/engines/dreamweb/module.mk +++ b/engines/dreamweb/module.mk @@ -12,6 +12,7 @@ MODULE_OBJS := \ saveload.o \ sprite.o \ stubs.o \ + talk.o \ use.o \ vgagrafx.o diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index e2da902465..d887f1c564 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -103,12 +103,160 @@ void DreamGenContext::obpicture() { void DreamGenContext::obicons() { uint8 value1, value2; getanyad(&value1, &value2); - if (value1 == 0xff) { - showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0); - } else { + if (value1 != 0xff) { + // can open it showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 210, 1, 4, 0); } + + showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0); +} + +void DreamGenContext::examineob(bool examineAgain) { + data.byte(kPointermode) = 0; + data.word(kTimecount) = 0; + while (true) { + if (examineAgain) { + data.byte(kInmaparea) = 0; + data.byte(kExamagain) = 0; + data.byte(kOpenedob) = 255; + data.byte(kOpenedtype) = 255; + data.byte(kInvopen) = 0; + al = data.byte(kCommandtype); + data.byte(kObjecttype) = al; + data.byte(kItemframe) = 0; + data.byte(kPointerframe) = 0; + createpanel(); + showpanel(); + showman(); + showexit(); + obicons(); + obpicture(); + describeob(); + undertextline(); + data.byte(kCommandtype) = 255; + readmouse(); + showpointer(); + worktoscreen(); + delpointer(); + examineAgain = false; + } + + readmouse(); + showpointer(); + vsync(); + dumppointer(); + dumptextline(); + delpointer(); + data.byte(kGetback) = 0; + switch (data.byte(kInvopen)) { + case 0: { + RectWithCallback examlist[] = { + { 273,320,157,198,&DreamGenContext::getbackfromob }, + { 260,300,0,44,&DreamGenContext::useobject }, + { 210,254,0,44,&DreamGenContext::selectopenob }, + { 144,176,64,96,&DreamGenContext::setpickup }, + { 0,50,50,200,&DreamGenContext::examinventory }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(examlist); + break; + } + case 1: { + // NB: This table contains the non-constant openchangesize! + RectWithCallback invlist1[] = { + { 273,320,157,198,&DreamGenContext::getbackfromob }, + { 255,294,0,24,&DreamGenContext::dropobject }, + { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage }, + { kInventx, cs.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useopened }, + { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::intoinv }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(invlist1); + break; + } + default: { + RectWithCallback withlist1[] = { + { 273,320,157,198,&DreamGenContext::getbackfromob }, + { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage }, + { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectob }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(withlist1); + break; + } + } + if (data.byte(kQuitrequested) != 0) + break; + if (data.byte(kExamagain) != 0) + examineAgain = true; + else if (data.byte(kGetback) != 0) + break; + } + + data.byte(kPickup) = 0; + if (data.word(kWatchingtime) != 0 || data.byte(kNewlocation) == 255) { + // iswatching + makemainscreen(); + } + + data.byte(kInvopen) = 0; + data.byte(kOpenedob) = 255; +} + +void DreamGenContext::inventory() { + if (data.byte(kMandead) == 1 || data.word(kWatchingtime) != 0) { + blank(); + return; + } + + if (data.byte(kCommandtype) != 239) { + data.byte(kCommandtype) = 239; + al = 32; + commandonly(); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; + if (!(data.word(kMousebutton) & 1)) // only on left mouse button + return; + + + data.word(kTimecount) = 0; + data.byte(kPointermode) = 0; + data.byte(kInmaparea) = 0; + animpointer(); + createpanel(); + showpanel(); + examicon(); + showman(); + showexit(); + undertextline(); + data.byte(kPickup) = 0; + data.byte(kInvopen) = 2; + openinv(); + readmouse(); + showpointer(); + worktoscreen(); + delpointer(); + data.byte(kOpenedob) = 255; + examineob(false); } +void DreamGenContext::transfertext() { + segRef(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos); + uint16 freeTextOffset = data.byte(kItemtotran) * 2; + uint16 srcOffset = segRef(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset); + const char *src = (const char *)segRef(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0); + char *dst = (char *)segRef(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0); + + size_t len = strlen(src); + memcpy(dst, src, len + 1); + data.word(kExtextpos) += len + 1; +} + + } /*namespace dreamgen */ diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 636182dc83..f68ec86ddf 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -72,8 +72,14 @@ void DreamGenContext::doload() { vsync(); dumppointer(); dumptextline(); - bx = offset_loadlist; - checkcoords(); + RectWithCallback loadlist[] = { + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualload }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(loadlist); if (data.byte(kGetback) == 1) break; if (data.byte(kGetback) == 2) @@ -213,8 +219,15 @@ void DreamGenContext::savegame() { vsync(); dumppointer(); dumptextline(); - bx = offset_savelist; - checkcoords(); + + RectWithCallback savelist[] = { + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualsave }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(savelist); _cmp(data.byte(kGetback), 0); if (flags.z()) continue; diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 3b67bfbd72..34b0729535 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -494,43 +494,30 @@ void DreamGenContext::facerightway() { data.byte(kLeavedirection) = dir; } -void DreamGenContext::findsource() { +Frame *DreamGenContext::findsource() { uint16 currentFrame = data.word(kCurrentframe); if (currentFrame < 160) { - ds = data.word(kReel1); data.word(kTakeoff) = 0; + return (Frame *)segRef(data.word(kReel1)).ptr(0, 0); } else if (currentFrame < 320) { - ds = data.word(kReel2); data.word(kTakeoff) = 160; + return (Frame *)segRef(data.word(kReel2)).ptr(0, 0); } else { - ds = data.word(kReel3); data.word(kTakeoff) = 320; + return (Frame *)segRef(data.word(kReel3)).ptr(0, 0); } } -Frame *DreamGenContext::findsourceCPP() { - push(ds); - findsource(); - Frame *result = (Frame *)ds.ptr(0, 0); - ds = pop(); - return result; -} - Reel *DreamGenContext::getreelstart() { Reel *reel = (Reel *)segRef(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel)); return reel; } -void DreamGenContext::showreelframe() { - Reel *reel = (Reel *)es.ptr(si, sizeof(Reel)); - showreelframe(reel); -} - void DreamGenContext::showreelframe(Reel *reel) { uint16 x = reel->x + data.word(kMapadx); uint16 y = reel->y + data.word(kMapady); data.word(kCurrentframe) = reel->frame(); - Frame *source = findsourceCPP(); + Frame *source = findsource(); uint16 frame = data.word(kCurrentframe) - data.word(kTakeoff); showframe(source, x, y, frame, 8); } @@ -550,7 +537,7 @@ void DreamGenContext::showgamereel(ReelRoutine *routine) { const Frame *DreamGenContext::getreelframeax(uint16 frame) { data.word(kCurrentframe) = frame; - Frame *source = findsourceCPP(); + Frame *source = findsource(); uint16 offset = data.word(kCurrentframe) - data.word(kTakeoff); return source + offset; } @@ -602,6 +589,10 @@ void DreamGenContext::updatepeople() { data.word(kListpos) = kPeoplelist; memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); + + // The callbacks are called with es:bx pointing to their reelRoutine entry. + // They use some of the fields in it to store state. + es = cs; bx = kReelroutines; const ReelRoutine *reelRoutine = (const ReelRoutine *)cs.ptr(bx, 0); @@ -903,5 +894,131 @@ void DreamGenContext::addtopeoplelist(ReelRoutine *routine) { data.word(kListpos) += sizeof(People); } +Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) { + do { + // Look for line start + while (!getblockofpixel(x, y)) { + --x; + ++y; + if (x == 0 || y >= data.byte(kMapysize)) + return rain; + } + + rain->x = x; + rain->y = y; + + uint8 length = 1; + + // Look for line end + while (getblockofpixel(x, y)) { + --x; + ++y; + if (x == 0 || y >= data.byte(kMapysize)) + break; + ++length; + } + + rain->size = length; + rain->w3_lo = engine->randomNumber(); + rain->w3_hi = engine->randomNumber(); + rain->b5 = (engine->randomNumber() & 3) + 4; + ++rain; + } while (x > 0 && y < data.byte(kMapysize)); + + return rain; +} + +struct RainLocation { + uint8 location; + uint8 x, y; + uint8 rainSpacing; +}; + +static const RainLocation rainLocationList[] = { + { 1,44,10,16 }, + { 4,11,30,14 }, + { 4,22,30,14 }, + { 3,33,10,14 }, + { 10,33,30,14 }, + { 10,22,30,24 }, + { 9,22,10,14 }, + { 2,33,0,14 }, + { 2,22,0,14 }, + { 6,11,30,14 }, + { 7,11,20,18 }, + { 7,0,20,18 }, + { 7,0,30,18 }, + { 55,44,0,14 }, + { 5,22,30,14 }, + + { 8,0,10,18 }, + { 8,11,10,18 }, + { 8,22,10,18 }, + { 8,33,10,18 }, + { 8,33,20,18 }, + { 8,33,30,18 }, + { 8,33,40,18 }, + { 8,22,40,18 }, + { 8,11,40,18 }, + + { 21,44,20,18 }, + { 255,0,0,0 } +}; + +void DreamGenContext::initrain() { + const RainLocation *r = rainLocationList; + Rain *rainList = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0); + Rain *rain = rainList; + + uint8 rainSpacing = 0; + + // look up location in rainLocationList to determine rainSpacing + for (r = rainLocationList; r->location != 0xff; ++r) { + if (r->location == data.byte(kReallocation) && + r->x == data.byte(kMapx) && r->y == data.byte(kMapy)) { + rainSpacing = r->rainSpacing; + break; + } + } + + if (rainSpacing == 0) { + // location not found in rainLocationList: no rain + rain->x = 0xff; + return; + } + + // start lines of rain from top of screen + uint8 x = 4; + do { + uint8 delta; + do { + delta = (engine->randomNumber() & 31) + 3; + } while (delta >= rainSpacing); + + x += delta; + if (x >= data.byte(kMapxsize)) + break; + + rain = splitintolines(x, 0, rain); + } while (true); + + // start lines of rain from side of screen + uint8 y = 0; + do { + uint8 delta; + do { + delta = (engine->randomNumber() & 31) + 3; + } while (delta >= rainSpacing); + + y += delta; + if (y >= data.byte(kMapysize)) + break; + + rain = splitintolines(data.byte(kMapxsize) - 1, y, rain); + } while (true); + + rain->x = 0xff; +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 0d7bbb6cbf..ceb30e3a4f 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -54,19 +54,15 @@ struct Sprite { uint8 hidden; }; +class DreamGenContext; + struct RectWithCallback { uint16 _xMin, _xMax; uint16 _yMin, _yMax; - uint16 _callback; - - uint16 xMin() const { return READ_LE_UINT16(&_xMin); } - uint16 xMax() const { return READ_LE_UINT16(&_xMax); } - uint16 yMin() const { return READ_LE_UINT16(&_yMin); } - uint16 yMax() const { return READ_LE_UINT16(&_yMax); } - uint16 callback() const { return READ_LE_UINT16(&_callback); } + void (DreamGenContext::*_callback)(); bool contains(uint16 x, uint16 y) const { - return (x >= xMin()) && (x < xMax()) && (y >= yMin()) && (y < yMax()); + return (x >= _xMin) && (x < _xMax) && (y >= _yMin) && (y < _yMax); } }; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 7f8a511cde..a01949edfb 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -28,8 +28,19 @@ namespace DreamGen { void DreamGenContext::dreamweb() { STACK_CHECK; + + switch(engine->getLanguage()) { + case Common::EN_ANY: + case Common::EN_GRB: + case Common::EN_USA: + // Implicit data.byte(kForeignrelease) = 0 + break; + default: + data.byte(kForeignrelease) = 1; + break; + } + seecommandtail(); - checkbasemem(); soundstartup(); setkeyboardint(); setupemm(); @@ -140,6 +151,9 @@ void DreamGenContext::dreamweb() { screenupdate(); + if (data.byte(kQuitrequested)) + return; // exit game + if (data.byte(kWongame) != 0) { // "endofgame" clearbeforeload(); @@ -190,12 +204,8 @@ void DreamGenContext::dreamweb() { } static Common::String getFilename(Context &context) { - uint16 name_ptr = context.dx; - Common::String name; - uint8 c; - while((c = context.cs.byte(name_ptr++)) != 0) - name += (char)c; - return name; + const char *name = (const char *)context.cs.ptr(context.dx, 0); + return Common::String(name); } void DreamGenContext::seecommandtail() { @@ -502,15 +512,6 @@ void DreamGenContext::removeemm() { } void DreamGenContext::setupemm() { - //good place for early initialization - switch(engine->getLanguage()) { - case Common::EN_ANY: - case Common::EN_GRB: - case Common::EN_USA: - return; - default: - data.byte(kForeignrelease) = 1; - } } void DreamGenContext::pitinterupt() { @@ -669,7 +670,7 @@ void DreamGenContext::eraseoldobs() { return; Sprite *sprites = spritetable(); - for (size_t i=0; i < 16; ++i) { + for (size_t i = 0; i < 16; ++i) { Sprite &sprite = sprites[i]; if (sprite.objData() != 0xffff) { memset(&sprite, 0xff, sizeof(Sprite)); @@ -917,11 +918,7 @@ void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) { void DreamGenContext::plotreel() { Reel *reel = getreelstart(); - while (true) { - if (reel->x < 220) - break; - if (reel->x == 255) - break; + while (reel->x >= 220 && reel->x != 255) { dealwithspecial(reel->x, reel->y); ++data.word(kReelpointer); reel += 8; @@ -1144,29 +1141,24 @@ void DreamGenContext::findormake() { void DreamGenContext::findormake(uint8 index, uint8 value, uint8 type) { Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); - while (true) { - if (change->index == 0xff) { - change->index = index; - change->location = data.byte(kReallocation); - change->value = value; - change->type = type; - return; - } - if ((index == change->index) && (data.byte(kReallocation) == change->location) && (type == change->type)) { + for (; change->index != 0xff; ++change) { + if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) { change->value = value; return; } - ++change; } + + change->index = index; + change->location = data.byte(kReallocation); + change->value = value; + change->type = type; } void DreamGenContext::setallchanges() { Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); - while (change->index != 0xff) { + for (; change->index != 0xff; ++change) if (change->location == data.byte(kReallocation)) dochange(change->index, change->value, change->type); - ++change; - } } DynObject *DreamGenContext::getfreead(uint8 index) { @@ -1301,7 +1293,7 @@ void DreamGenContext::getflagunderp(uint8 *flag, uint8 *flagEx) { } void DreamGenContext::walkandexamine() { - if (! finishedwalkingCPP()) + if (!finishedwalkingCPP()) return; data.byte(kCommandtype) = data.byte(kWalkexamtype); data.byte(kCommand) = data.byte(kWalkexamnum); @@ -1434,156 +1426,160 @@ void DreamGenContext::dumppointer() { } void DreamGenContext::checkcoords() { - checkcoords((const RectWithCallback *)cs.ptr(bx, 0)); + + // FIXME: Move all these lists to the callers + + switch ((uint16)bx) { + case offset_talklist: { + RectWithCallback talklist[] = { + { 273,320,157,198,&DreamGenContext::getback1 }, + { 240,290,2,44,&DreamGenContext::moretalk }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(talklist); + break; + } + case offset_quitlist: { + RectWithCallback quitlist[] = { + { 273,320,157,198,&DreamGenContext::getback1 }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(quitlist); + break; + } + case offset_destlist: { + RectWithCallback destlist[] = { + { 238,258,4,44,&DreamGenContext::nextdest }, + { 104,124,4,44,&DreamGenContext::lastdest }, + { 280,308,4,44,&DreamGenContext::lookatplace }, + { 104,216,138,192,&DreamGenContext::destselect }, + { 273,320,157,198,&DreamGenContext::getback1 }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(destlist); + break; + } + case offset_keypadlist: { + RectWithCallback keypadlist[] = { + { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamGenContext::buttonone }, + { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamGenContext::buttontwo }, + { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamGenContext::buttonthree }, + { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamGenContext::buttonfour }, + { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamGenContext::buttonfive }, + { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamGenContext::buttonsix }, + { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamGenContext::buttonseven }, + { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamGenContext::buttoneight }, + { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamGenContext::buttonnine }, + { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamGenContext::buttonnought }, + { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamGenContext::buttonenter }, + { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamGenContext::quitkey }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(keypadlist); + break; + } + case offset_menulist: { + RectWithCallback menulist[] = { + { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamGenContext::quitkey }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(menulist); + break; + } + case offset_folderlist: { + RectWithCallback folderlist[] = { + { 280,320,160,200,&DreamGenContext::quitkey }, + { 143,300,6,194,&DreamGenContext::nextfolder }, + { 0,143,6,194,&DreamGenContext::lastfolder }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(folderlist); + break; + } + case offset_symbollist: { + RectWithCallback symbollist[] = { + { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamGenContext::quitsymbol }, + { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamGenContext::settopleft }, + { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamGenContext::settopright }, + { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamGenContext::setbotleft }, + { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamGenContext::setbotright }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(symbollist); + + break; + } + case offset_diarylist: { + RectWithCallback diarylist[] = { + { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamGenContext::diarykeyn }, + { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamGenContext::diarykeyp }, + { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamGenContext::quitkey }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(diarylist); + break; + } + case offset_opslist: { + RectWithCallback opslist[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getbackfromops }, + { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::dosreturn }, + { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discops }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(opslist); + break; + } + case offset_discopslist: { + RectWithCallback discopslist[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadgame }, + { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::savegame }, + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(discopslist); + break; + } + case offset_decidelist: { + RectWithCallback decidelist[] = { + { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newgame }, + { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamGenContext::dosreturn }, + { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadold }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(decidelist); + break; + } + default: + ::error("Unimplemented checkcoords() call"); + } } + void DreamGenContext::checkcoords(const RectWithCallback *rectWithCallbacks) { if (data.byte(kNewlocation) != 0xff) return; - const RectWithCallback *rectWithCallback = rectWithCallbacks; - while (rectWithCallback->xMin() != 0xffff) { - if (rectWithCallback->contains(data.word(kMousex), data.word(kMousey))) { - uint16 callback = rectWithCallback->callback(); - - // common - if(callback == addr_blank) - blank(); - else if(callback == addr_getbackfromob) - getbackfromob(); - else if(callback == addr_incryanpage) - incryanpage(); - else if(callback == addr_getback1) - getback1(); - else if(callback == addr_quitkey) - quitkey(); - else if(callback == addr_dosreturn) - dosreturn(); - else if(callback == addr_getbacktoops) - getbacktoops(); - else if(callback == addr_selectslot) - selectslot(); - // examlist - else if(callback == addr_useobject) - useobject(); - else if(callback == addr_selectopenob) - selectopenob(); - else if(callback == addr_setpickup) - setpickup(); - else if(callback == addr_examinventory) - examinventory(); - // invlist1 - else if(callback == addr_dropobject) - dropobject(); - else if(callback == addr_useopened) - useopened(); - else if(callback == addr_intoinv) - intoinv(); - // withlist1 - else if(callback == addr_selectob) - selectob(); - // talklist - else if(callback == addr_moretalk) - moretalk(); - // quitlist - // destlist - else if(callback == addr_nextdest) - nextdest(); - else if(callback == addr_lastdest) - lastdest(); - else if(callback == addr_lookatplace) - lookatplace(); - else if(callback == addr_destselect) - destselect(); - // keypadlist - else if(callback == addr_buttonone) - buttonone(); - else if(callback == addr_buttontwo) - buttontwo(); - else if(callback == addr_buttonthree) - buttonthree(); - else if(callback == addr_buttonfour) - buttonfour(); - else if(callback == addr_buttonfive) - buttonfive(); - else if(callback == addr_buttonsix) - buttonsix(); - else if(callback == addr_buttonseven) - buttonseven(); - else if(callback == addr_buttoneight) - buttoneight(); - else if(callback == addr_buttonnine) - buttonnine(); - else if(callback == addr_buttonnought) - buttonnought(); - else if(callback == addr_buttonenter) - buttonenter(); - // menulist - // folderlist - else if(callback == addr_nextfolder) - nextfolder(); - else if(callback == addr_lastfolder) - lastfolder(); - // symbollist - else if(callback == addr_quitsymbol) - quitsymbol(); - else if(callback == addr_settopleft) - settopleft(); - else if(callback == addr_settopright) - settopright(); - else if(callback == addr_setbotleft) - setbotleft(); - else if(callback == addr_setbotright) - setbotright(); - // diarylist - else if(callback == addr_diarykeyn) - diarykeyn(); - else if(callback == addr_diarykeyp) - diarykeyp(); - // opslist - else if(callback == addr_getbackfromops) - getbackfromops(); - else if(callback == addr_discops) - discops(); - // discopslist - else if(callback == addr_loadgame) - loadgame(); - else if(callback == addr_savegame) - savegame(); - // mainlist, mainlist2 - else if(callback == addr_look) - look(); - else if(callback == addr_inventory) - inventory(); - else if(callback == addr_zoomonoff) - zoomonoff(); - else if(callback == addr_saveload) - saveload(); - else if(callback == addr_madmanrun) - madmanrun(); - else if(callback == addr_identifyob) - identifyob(); - // decidelist - else if(callback == addr_newgame) - newgame(); - else if(callback == addr_loadold) - loadold(); - // loadlist - else if(callback == addr_actualload) - actualload(); - // savelist - else if(callback == addr_actualsave) - actualsave(); - else { - debug("__dispatch_call remaining in checkcoords! %d", (int)callback); - __dispatch_call(callback); - } + const RectWithCallback *r; + for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) { + if (r->contains(data.word(kMousex), data.word(kMousey))) { + (this->*(r->_callback))(); return; } - ++rectWithCallback; } } + void DreamGenContext::showpointer() { showblink(); const Frame *icons1 = ((const Frame *)segRef(data.word(kIcons1)).ptr(0, 0)); @@ -1721,6 +1717,25 @@ bool DreamGenContext::isCD() { return (data.byte(kSpeechloaded) == 1); } +void DreamGenContext::showicon() { + if (data.byte(kReallocation) < 50) { + showpanel(); + showman(); + roomname(); + panelicons1(); + zoomicon(); + } else { + Frame *tempSprites = (Frame *)segRef(data.word(kTempsprites)).ptr(0, 0); + showframe(tempSprites, 72, 2, 45, 0); + showframe(tempSprites, 72+47, 2, 46, 0); + showframe(tempSprites, 69-10, 21, 49, 0); + showframe(tempSprites, 160+88, 2, 45, 4 & 0xfe); + showframe(tempSprites, 160+43, 2, 46, 4 & 0xfe); + showframe(tempSprites, 160+101, 21, 49, 4 & 0xfe); + middlepanel(); + } +} + void DreamGenContext::checkifset() { flags._z = !checkifset(al, ah); } @@ -1882,5 +1897,73 @@ void DreamGenContext::zoomonoff() { worktoscreenm(); } +void DreamGenContext::sortoutmap() { + const uint8 *src = (const uint8 *)segRef(data.word(kWorkspace)).ptr(0, 0); + uint8 *dst = (uint8 *)segRef(data.word(kMapdata)).ptr(0, 0); + for (uint16 y = 0; y < kMaplength; ++y) { + memcpy(dst, src, kMapwidth); + dst += kMapwidth; + src += 132; + } +} + +void DreamGenContext::showcity() { + clearwork(); + Frame *tempGraphics = (Frame *)segRef(data.word(kTempgraphics)).ptr(0, 0); + showframe(tempGraphics, 57, 32, 0, 0); + showframe(tempGraphics, 120+57, 32, 1, 0); +} + +void DreamGenContext::mainscreen() { + data.byte(kInmaparea) = 0; + if (data.byte(kWatchon) == 1) { + RectWithCallback mainlist[] = { + { 44,70,32,46,&DreamGenContext::look }, + { 0,50,0,180,&DreamGenContext::inventory }, + { 226,244,10,26,&DreamGenContext::zoomonoff }, + { 226,244,26,40,&DreamGenContext::saveload }, + { 240,260,100,124,&DreamGenContext::madmanrun }, + { 0,320,0,200,&DreamGenContext::identifyob }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(mainlist); + } else { + RectWithCallback mainlist2[] = { + { 44,70,32,46,&DreamGenContext::look }, + { 0,50,0,180,&DreamGenContext::inventory }, + { 226+48,244+48,10,26,&DreamGenContext::zoomonoff }, + { 226+48,244+48,26,40,&DreamGenContext::saveload }, + { 240,260,100,124,&DreamGenContext::madmanrun }, + { 0,320,0,200,&DreamGenContext::identifyob }, + { 0xFFFF,0,0,0,0 } + }; + checkcoords(mainlist2); + } + + if (data.byte(kWalkandexam) != 0) + walkandexamine(); +} + +void DreamGenContext::showwatch() { + if (data.byte(kWatchon)) { + showframe((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), 250, 1, 6, 0); + showtime(); + } +} + +void DreamGenContext::roomname() { + printmessage(88, 18, 53, 240, false); + uint16 textIndex = data.byte(kRoomnum); + if (textIndex >= 32) + textIndex -= 32; + data.word(kLinespacing) = 7; + uint8 maxWidth = (data.byte(kWatchon) == 1) ? 120 : 160; + uint16 descOffset = segRef(data.word(kRoomdesc)).word(kIntextdat + textIndex * 2); + const uint8 *string = segRef(data.word(kRoomdesc)).ptr(kIntext + descOffset, 0); + printdirect(string, 88, 25, maxWidth, false); + data.word(kLinespacing) = 10; + usecharset1(); +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index ac7e1a5b91..da21d415f5 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -96,11 +96,9 @@ void widedoor(Sprite *sprite, SetObject *objData); void lockeddoorway(Sprite *sprite, SetObject *objData); void liftsprite(Sprite *sprite, SetObject *objData); - void findsource(); - Frame *findsourceCPP(); + Frame *findsource(); void showgamereel(); void showgamereel(ReelRoutine *routine); - void showreelframe(); void showreelframe(Reel *reel); const Frame *getreelframeax(uint16 frame); void turnpathon(uint8 param); @@ -237,6 +235,7 @@ void hangon(uint16 frameCount); void hangonp(); void hangonp(uint16 count); + void showicon(); uint8 findnextcolon(uint8 **string); void findnextcolon(); uint8 *getobtextstartCPP(); @@ -246,4 +245,14 @@ uint8 getblockofpixel(uint8 x, uint8 y); void bresenhams(); void examineobtext(); + void sortoutmap(); + void showcity(); + uint16 getpersframe(uint8 index); + void convicons(); + void examineob(bool examineAgain = true); + void showwatch(); + void roomname(); + void transfertext(); + void initrain(); + Rain *splitintolines(uint8 x, uint8 y, Rain *rain); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp new file mode 100644 index 0000000000..78b296afe6 --- /dev/null +++ b/engines/dreamweb/talk.cpp @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "dreamweb/dreamweb.h" + +namespace DreamGen { + +uint16 DreamGenContext::getpersframe(uint8 index) { + return segRef(data.word(kPeople)).word(kPersonframes + index * 2); +} + +void DreamGenContext::convicons() { + uint8 index = data.byte(kCharacter) & 127; + data.word(kCurrentframe) = getpersframe(index); + Frame *frame = findsource(); + uint16 frameNumber = (data.word(kCurrentframe) - data.word(kTakeoff)) & 0xff; + showframe(frame, 234, 2, frameNumber, 0); +} + +} /*namespace dreamgen */ + diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 7fd9880dce..27f09b645e 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -388,6 +388,10 @@ void GUI::updateSaveList(bool excludeQuickSaves) { if (_saveSlots.begin() == _saveSlots.end()) return; + sortSaveSlots(); +} + +void GUI::sortSaveSlots() { Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>()); if (_saveSlots.size() > 2) Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>()); diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 1efbdde394..6e9606f1de 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -200,10 +200,15 @@ protected: void redrawText(const Menu &menu); void redrawHighlight(const Menu &menu); + // The engine expects a list of contiguous savegame indices. + // Since ScummVM's savegame indices aren't, we re-index them. + // The integers stored in _saveSlots are ScummVM savegame indices. Common::Array<int> _saveSlots; void updateSaveList(bool excludeQuickSaves = false); int getNextSavegameSlot(); + virtual void sortSaveSlots(); + uint32 _lastScreenUpdate; Common::KeyState _keyPressed; void checkTextfieldInput(); diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 93a1138f1d..fefcaf762f 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -2572,11 +2572,11 @@ void GUI_LoL::setupSaveMenuSlots(Menu &menu, int num) { slotOffs = 1; } - int saveSlotMaxLen = ((_screen->getScreenDim(8))->w << 3) - _screen->getCharWidth('W'); - + int saveSlotMaxLen = ((_screen->getScreenDim(8))->w << 3) - _screen->getCharWidth('W'); + for (int i = startSlot; i < num && _savegameOffset + i - slotOffs < _savegameListSize; ++i) { - if (_savegameList[_saveSlots[i + _savegameOffset - slotOffs]]) { - Common::strlcpy(s, _savegameList[_saveSlots[i + _savegameOffset - slotOffs]], 80); + if (_savegameList[i + _savegameOffset - slotOffs]) { + Common::strlcpy(s, _savegameList[i + _savegameOffset - slotOffs], 80); // Trim long GMM save descriptions to fit our save slots int fC = _screen->getTextWidth(s); @@ -2618,15 +2618,13 @@ void GUI_LoL::updateSavegameList() { _savegameListSize = _saveSlots.size(); if (_savegameListSize) { - Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>()); - LoLEngine::SaveHeader header; Common::InSaveFile *in; _savegameList = new char *[_savegameListSize]; for (int i = 0; i < _savegameListSize; i++) { - in = _vm->openSaveForReading(_vm->getSavegameFilename(i), header); + in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i]), header); if (in) { _savegameList[i] = new char[header.description.size() + 1]; Common::strlcpy(_savegameList[i], header.description.c_str(), header.description.size() + 1); @@ -2634,15 +2632,18 @@ void GUI_LoL::updateSavegameList() { delete in; } else { _savegameList[i] = 0; - error("GUI_LoL::updateSavegameList(): Unexpected missing save file for slot: %d.", i); + error("GUI_LoL::updateSavegameList(): Unexpected missing save file for slot: %d.", _saveSlots[i]); } } - } else { _savegameList = 0; } } +void GUI_LoL::sortSaveSlots() { + Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>()); +} + void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags) { _screen->fprintString("%s", x, y, c0, c1, _vm->gameFlags().use16ColorMode ? (flags & 3) : flags , str); } diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h index 0686926534..af487402f6 100644 --- a/engines/kyra/gui_lol.h +++ b/engines/kyra/gui_lol.h @@ -175,6 +175,8 @@ private: char **_savegameList; int _savegameListSize; bool _savegameListUpdateNeeded; + + virtual void sortSaveSlots(); }; } // End of namespace Kyra diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index d6cc71e133..f70a35d5ad 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -301,11 +301,11 @@ void SpriteAsset::loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStre int32 SpriteAsset::parseSprite(bool isBigEndian) { - uint32 format, chunkType, chunkSize = 0; + uint32 chunkType, chunkSize = 0; _colorCount = 0; - format = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE(); + /*format = (!isBigEndian) ? _stream->readUint32LE() : */_stream->readUint32BE(); chunkType = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE(); diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp index 8a2ab67f11..ae16b00616 100644 --- a/engines/m4/mads_menus.cpp +++ b/engines/m4/mads_menus.cpp @@ -716,7 +716,7 @@ void RexDialogView::onRefresh(RectList *rects, M4Surface *destSurface) { bool RexDialogView::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) { static bool word_7F28C = false; int word_7FED2 = 0; - int word_8502A = 0; + //int word_8502A = 0; // If it's a keypress, handle it immediately if (eventType == KEVENT_KEY) { @@ -789,7 +789,7 @@ bool RexDialogView::onEvent(M4EventType eventType, int32 param1, int x, int y, b if (!word_7F28C || (objIndex <= 18)) _selectedLine = objIndex; - word_8502A = -1; + //word_8502A = -1; } return true; diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp index d21bfc1cf2..c1d88d5741 100644 --- a/engines/m4/mads_views.cpp +++ b/engines/m4/mads_views.cpp @@ -77,7 +77,7 @@ void MadsAction::appendVocab(int vocabId, bool capitalise) { void MadsAction::set() { int hotspotCount = _madsVm->scene()->getSceneResources().hotspots->size(); - bool flag = false; + bool flag = false; // FIXME: unused strcpy(_statusText, ""); _currentAction = -1; diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp index 1f8d9b29f9..307425b77b 100644 --- a/engines/queen/talk.cpp +++ b/engines/queen/talk.cpp @@ -96,7 +96,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { } int16 oldLevel = 0; - bool personWalking = false; + bool personWalking = false; // FIXME: unused // Lines 828-846 in talk.c for (i = 1; i <= 4; i++) { @@ -373,7 +373,7 @@ byte *Talk::loadDialogFile(const char *filename) { void Talk::load(const char *filename) { int i; byte *ptr = _fileData = loadDialogFile(filename); - bool canQuit; + bool canQuit; // FIXME: unused // Load talk header diff --git a/engines/sky/music/adlibmusic.cpp b/engines/sky/music/adlibmusic.cpp index 1b5518fcb1..a41cd6a81d 100644 --- a/engines/sky/music/adlibmusic.cpp +++ b/engines/sky/music/adlibmusic.cpp @@ -30,9 +30,8 @@ namespace Sky { -AdLibMusic::AdLibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pDisk) { +AdLibMusic::AdLibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) { _driverFileBase = 60202; - _mixer = pMixer; _sampleRate = pMixer->getOutputRate(); _opl = makeAdLibOPL(_sampleRate); diff --git a/engines/sky/music/adlibmusic.h b/engines/sky/music/adlibmusic.h index 2782a07be6..2161795b4c 100644 --- a/engines/sky/music/adlibmusic.h +++ b/engines/sky/music/adlibmusic.h @@ -26,7 +26,6 @@ #include "sky/music/musicbase.h" #include "audio/audiostream.h" #include "audio/fmopl.h" -#include "audio/mixer.h" namespace Sky { @@ -44,7 +43,6 @@ public: private: FM_OPL *_opl; - Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; uint8 *_initSequence; uint32 _sampleRate, _nextMusicPoll; diff --git a/engines/sky/music/gmmusic.cpp b/engines/sky/music/gmmusic.cpp index d0ba1505cb..85240ea82e 100644 --- a/engines/sky/music/gmmusic.cpp +++ b/engines/sky/music/gmmusic.cpp @@ -34,7 +34,7 @@ void GmMusic::passTimerFunc(void *param) { ((GmMusic*)param)->timerCall(); } -GmMusic::GmMusic(MidiDriver *pMidiDrv, Disk *pDisk) : MusicBase(pDisk) { +GmMusic::GmMusic(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) { _driverFileBase = 60200; _midiDrv = pMidiDrv; int midiRes = _midiDrv->open(); diff --git a/engines/sky/music/gmmusic.h b/engines/sky/music/gmmusic.h index 0f54a930e4..068601ba1f 100644 --- a/engines/sky/music/gmmusic.h +++ b/engines/sky/music/gmmusic.h @@ -31,7 +31,7 @@ namespace Sky { class GmMusic : public MusicBase { public: - GmMusic(MidiDriver *pMidiDrv, Disk *pDisk); + GmMusic(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk); ~GmMusic(); virtual void setVolume(uint16 param); private: diff --git a/engines/sky/music/mt32music.cpp b/engines/sky/music/mt32music.cpp index d068a221b2..18ebf123ff 100644 --- a/engines/sky/music/mt32music.cpp +++ b/engines/sky/music/mt32music.cpp @@ -34,7 +34,7 @@ void MT32Music::passTimerFunc(void *param) { ((MT32Music*)param)->timerCall(); } -MT32Music::MT32Music(MidiDriver *pMidiDrv, Disk *pDisk) : MusicBase(pDisk) { +MT32Music::MT32Music(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) { _driverFileBase = 60200; _midiDrv = pMidiDrv; int midiRes = _midiDrv->open(); diff --git a/engines/sky/music/mt32music.h b/engines/sky/music/mt32music.h index 74962daac3..8f8e70f51b 100644 --- a/engines/sky/music/mt32music.h +++ b/engines/sky/music/mt32music.h @@ -31,7 +31,7 @@ namespace Sky { class MT32Music : public MusicBase { public: - MT32Music(MidiDriver *pMidiDrv, Disk *pDisk); + MT32Music(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk); ~MT32Music(); private: static void passTimerFunc(void *param); diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp index 60d0f352e7..018614da98 100644 --- a/engines/sky/music/musicbase.cpp +++ b/engines/sky/music/musicbase.cpp @@ -25,11 +25,13 @@ #include "common/util.h" #include "common/endian.h" #include "common/textconsole.h" +#include "audio/audiostream.h" namespace Sky { -MusicBase::MusicBase(Disk *pDisk) { +MusicBase::MusicBase(Audio::Mixer *pMixer, Disk *pDisk) { _musicData = NULL; + _mixer = pMixer; _skyDisk = pDisk; _currentMusic = 0; _musicVolume = 127; @@ -59,6 +61,8 @@ void MusicBase::loadSection(uint8 pSection) { } bool MusicBase::musicIsPlaying() { + if (_mixer->isSoundHandleActive(_musicHandle)) + return true; for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) if (_channels[cnt]->isActive()) return true; @@ -71,6 +75,8 @@ void MusicBase::stopMusic() { } void MusicBase::stopMusicInternal() { + _mixer->stopHandle(_musicHandle); + for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) delete _channels[cnt]; _numberOfChannels = 0; @@ -94,18 +100,51 @@ void MusicBase::loadNewMusic() { _currentMusic = _onNextPoll.musicToProcess; - if (_currentMusic != 0) { - musicPos = READ_LE_UINT16(_musicData + _musicDataLoc + 1); - musicPos += _musicDataLoc + ((_currentMusic - 1) << 1); - musicPos = READ_LE_UINT16(_musicData + musicPos) + _musicDataLoc; + if (_currentMusic == 0) + return; + + // Try playing digital audio first (from the Music Enhancement Project). + // TODO: This always prefers digital music over the MIDI music types! + uint8 section = _currentSection; + uint8 song = _currentMusic; + // handle duplicates + if ((section == 2 && song == 1) || (section == 5 && song == 1)) { + section = 1; + song = 1; + } else if ((section == 2 && song == 4) || (section == 5 && song == 4)) { + section = 1; + song = 4; + } else if (section == 5 && song == 6) { + section = 4; + song = 4; + } + Common::String trackName = Common::String::format("music_%d%02d", section, song); + Audio::SeekableAudioStream *stream = Audio::SeekableAudioStream::openStreamFile(trackName); + if (stream) { + // not all tracks should loop + bool loops = true; + if ((section == 1 && song == 1) || (section == 1 && song == 4) + || (section == 2 && song == 1) || (section == 2 && song == 4) + || (section == 4 && song == 2) || (section == 4 && song == 3) + || (section == 4 && song == 5) || (section == 4 && song == 6) + || (section == 4 && song == 11) || (section == 5 && song == 1) + || (section == 5 && song == 3) || (section == 5 && song == 4)) + loops = false; + _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, Audio::makeLoopingAudioStream(stream, loops ? 0 : 1)); + return; + } + + // no digital audio, resort to MIDI playback + musicPos = READ_LE_UINT16(_musicData + _musicDataLoc + 1); + musicPos += _musicDataLoc + ((_currentMusic - 1) << 1); + musicPos = READ_LE_UINT16(_musicData + musicPos) + _musicDataLoc; - _musicTempo0 = _musicData[musicPos]; - _musicTempo1 = _musicData[musicPos+1]; + _musicTempo0 = _musicData[musicPos]; + _musicTempo1 = _musicData[musicPos+1]; - setupChannels(_musicData + musicPos + 2); + setupChannels(_musicData + musicPos + 2); - updateTempo(); - } + updateTempo(); } void MusicBase::pollMusic() { diff --git a/engines/sky/music/musicbase.h b/engines/sky/music/musicbase.h index c175876380..066ebe593c 100644 --- a/engines/sky/music/musicbase.h +++ b/engines/sky/music/musicbase.h @@ -27,6 +27,8 @@ #include "common/scummsys.h" #include "common/mutex.h" +#include "audio/mixer.h" + namespace Sky { class Disk; @@ -48,7 +50,7 @@ private: class MusicBase { public: - MusicBase(Disk *pDisk); + MusicBase(Audio::Mixer *pMixer, Disk *pDisk); virtual ~MusicBase(); void loadSection(uint8 pSection); void startMusic(uint16 param); @@ -60,6 +62,7 @@ public: protected: + Audio::Mixer *_mixer; Disk *_skyDisk; uint8 *_musicData; @@ -75,6 +78,7 @@ protected: Actions _onNextPoll; ChannelBase *_channels[10]; Common::Mutex _mutex; + Audio::SoundHandle _musicHandle; virtual void setupPointers() = 0; virtual void setupChannels(uint8 *channelData) = 0; diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 72abc26f32..44ea3a305b 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -268,9 +268,9 @@ Common::Error SkyEngine::init() { } else { _systemVars.systemFlags |= SF_ROLAND; if ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32")) - _skyMusic = new MT32Music(MidiDriver::createMidi(dev), _skyDisk); + _skyMusic = new MT32Music(MidiDriver::createMidi(dev), _mixer, _skyDisk); else - _skyMusic = new GmMusic(MidiDriver::createMidi(dev), _skyDisk); + _skyMusic = new GmMusic(MidiDriver::createMidi(dev), _mixer, _skyDisk); } if (isCDVersion()) { diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index d6478f5cae..f552c49491 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -485,6 +485,7 @@ PCMMusicPlayer::PCMMusicPlayer() { PCMMusicPlayer::~PCMMusicPlayer() { _vm->_mixer->stopHandle(_handle); + delete _curChunk; } void PCMMusicPlayer::startPlay(int id) { diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index d2999a2603..d21321a201 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -380,7 +380,9 @@ void Ringworld2Globals::reset() { _v57C2C = 0; _v58CE2 = 0; Common::set_to(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0); + _insetUp = 0; + // Reset fields stored in the player class _player._characterIndex = 1; _player._characterScene[1] = 100; _player._characterScene[2] = 300; @@ -396,6 +398,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v58CE2); for (int i = 0; i < MAX_CHARACTERS; ++i) s.syncAsSint16LE(_v565F1[i]); + s.syncAsSint16LE(_insetUp); } } // end of namespace Ringworld2 diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index c4108e175c..d644a02e7c 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -243,6 +243,7 @@ class Ringworld2Globals: public TsAGE2Globals { public: ASoundExt _sound1, _sound2, _sound3, _sound4; PlayStream _playStream; + int _insetUp; int _v565F5; int _v5657C; int _v57C2C; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index fa8d0be1af..7294b3d726 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -176,18 +176,8 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { } void SceneExt::remove() { -/* - R2_GLOBALS._uiElements.hide(); - R2_GLOBALS._uiElements.resetClear(); - - if (_action) { - if (_action->_endHandler) - _action->_endHandler = NULL; - _action->remove(); - } - - _focusObject = NULL; -*/ + _sceneAreas.clear(); + Scene::remove(); } void SceneExt::process(Event &event) { @@ -338,7 +328,17 @@ void SceneHandlerExt::process(Event &event) { return; } - SceneHandler::process(event); + SceneExt *scene = static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene); + if (scene) { + // Handle any scene areas that have been registered + SynchronizedList<SceneArea *>::iterator saIter; + for (saIter = scene->_sceneAreas.begin(); saIter != scene->_sceneAreas.end() && !event.handled; ++saIter) { + (*saIter)->process(event); + } + } + + if (!event.handled) + SceneHandler::process(event); } /*--------------------------------------------------------------------------*/ @@ -880,6 +880,103 @@ void SceneActor::setDetails(int resNum, int lookLineNum, int talkLineNum, int us _useLineNum = useLineNum; } +/*--------------------------------------------------------------------------*/ + +SceneArea::SceneArea(): EventHandler() { + _enabled = true; + _insideArea = false; + _savedCursorNum = CURSOR_NONE; + _cursorState = 0; +} + +void SceneArea::synchronize(Serializer &s) { + EventHandler::synchronize(s); + + _bounds.synchronize(s); + s.syncAsSint16LE(_enabled); + s.syncAsSint16LE(_insideArea); + s.syncAsSint16LE(_cursorNum); + s.syncAsSint16LE(_savedCursorNum); + s.syncAsSint16LE(_cursorState); +} + +void SceneArea::remove() { + static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.remove(this); +} + +void SceneArea::process(Event &event) { + if (!R2_GLOBALS._insetUp && _enabled && R2_GLOBALS._events.isCursorVisible()) { + CursorType cursor = R2_GLOBALS._events.getCursor(); + + if (_bounds.contains(event.mousePos)) { + // Cursor moving in bounded area + if (cursor != _cursorNum) { + _savedCursorNum = cursor; + _cursorState = 0; + R2_GLOBALS._events.setCursor(_cursorNum); + } + _insideArea = true; + } else if ((event.mousePos.y < 171) && _insideArea && (_cursorNum != cursor) && + (_savedCursorNum != CURSOR_NONE)) { + // Cursor moved outside bounded area + R2_GLOBALS._events.setCursor(_savedCursorNum); + } + } +} + +void SceneArea::setDetails(const Rect &bounds, CursorType cursor) { + _bounds = bounds; + _cursorNum = cursor; + + static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); +} + +/*--------------------------------------------------------------------------*/ + +SceneExit::SceneExit(): SceneArea() { + _moving = false; + _destPos = Common::Point(-1, -1); +} + +void SceneExit::synchronize(Serializer &s) { + SceneArea::synchronize(s); + + s.syncAsSint16LE(_moving); + s.syncAsSint16LE(_destPos.x); + s.syncAsSint16LE(_destPos.y); +} + +void SceneExit::setDetails(const Rect &bounds, CursorType cursor, int sceneNumber) { + _sceneNumber = sceneNumber; + SceneArea::setDetails(bounds, cursor); +} + +void SceneExit::changeScene() { + R2_GLOBALS._sceneManager.setNewScene(_sceneNumber); +} + +void SceneExit::process(Event &event) { + if (!R2_GLOBALS._insetUp) { + SceneArea::process(event); + + if (_enabled && (event.eventType == EVENT_BUTTON_DOWN)) { + if (!_bounds.contains(event.mousePos)) + _moving = 0; + else if (!R2_GLOBALS._player._canWalk) { + _moving = 0; + changeScene(); + event.handled = true; + } else { + Common::Point dest((_destPos.x == -1) ? event.mousePos.x : _destPos.x, + (_destPos.y == -1) ? event.mousePos.y : _destPos.y); + ADD_PLAYER_MOVER(dest.x, dest.y); + + _moving = true; + event.handled = true; + } + } + } +} } // End of namespace Ringworld2 diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 4adfc9bc05..152e6f8518 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -42,6 +42,38 @@ public: static Scene *createScene(int sceneNumber); }; +class SceneArea: public EventHandler { +public: + Rect _bounds; + bool _enabled; + bool _insideArea; + CursorType _cursorNum; + CursorType _savedCursorNum; + int _cursorState; +public: + SceneArea(); + void setDetails(const Rect &bounds, CursorType cursor); + + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void process(Event &event); +}; + +class SceneExit: public SceneArea { +public: + bool _moving; + int _sceneNumber; + Common::Point _destPos; +public: + SceneExit(); + void setDetails(const Rect &bounds, CursorType cursor, int sceneNumber); + void setDest(const Common::Point &p) { _destPos = p; } + void changeScene(); + + virtual void synchronize(Serializer &s); + virtual void process(Event &event); +}; + class SceneExt: public Scene { private: static void startStrip(); @@ -55,6 +87,7 @@ public: SceneObject *_focusObject; Visage _cursorVisage; + SynchronizedList<SceneArea *> _sceneAreas; Rect _v51C34; public: @@ -249,7 +282,6 @@ public: } }; - } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index b61e63236b..fb88a5ff5e 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -36,7 +36,7 @@ static SoundManager *_soundManager = NULL; SoundManager::SoundManager() { _soundManager = this; - __sndmgrReady = false; + _sndmgrReady = false; _ourSndResVersion = 0x102; _ourDrvResVersion = 0x10A; @@ -52,7 +52,7 @@ SoundManager::SoundManager() { } SoundManager::~SoundManager() { - if (__sndmgrReady) { + if (_sndmgrReady) { Common::StackLock slock(_serverDisabledMutex); g_vm->_mixer->stopAll(); @@ -83,7 +83,7 @@ SoundManager::~SoundManager() { } void SoundManager::postInit() { - if (!__sndmgrReady) { + if (!_sndmgrReady) { g_saver->addSaveNotifier(&SoundManager::saveNotifier); g_saver->addLoadNotifier(&SoundManager::loadNotifier); g_saver->addListener(this); @@ -94,7 +94,7 @@ void SoundManager::postInit() { // thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to // call the update method, rather than having it be called separately // g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL, "tsageSoundUpdate"); - __sndmgrReady = true; + _sndmgrReady = true; } } @@ -136,7 +136,7 @@ void SoundManager::update() { } Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) { - assert(__sndmgrReady); + assert(_sndmgrReady); _availableDrivers.clear(); // Build up a list of available drivers. Currently we only implement an Adlib music @@ -549,7 +549,7 @@ void SoundManager::loadNotifier(bool postFlag) { void SoundManager::loadNotifierProc(bool postFlag) { if (!postFlag) { // Stop any currently playing sounds - if (__sndmgrReady) { + if (_sndmgrReady) { Common::StackLock slock(_serverDisabledMutex); for (Common::List<Sound *>::iterator i = _soundList.begin(); i != _soundList.end(); ) { @@ -569,7 +569,7 @@ void SoundManager::loadNotifierProc(bool postFlag) { void SoundManager::listenerSynchronize(Serializer &s) { s.validate("SoundManager"); - assert(__sndmgrReady && _driversDetected); + assert(_sndmgrReady && _driversDetected); if (s.getVersion() < 6) return; diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 5802a62686..f4286565b0 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -169,7 +169,7 @@ class SoundManager : public SaveListener { private: SoundDriver *instantiateDriver(int driverNum); public: - bool __sndmgrReady; + bool _sndmgrReady; int _ourSndResVersion, _ourDrvResVersion; SynchronizedList<Sound *> _playList; Common::List<SoundDriver *> _installedDrivers; diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index a2cb693b78..5897d2edd2 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -77,7 +77,7 @@ inline frac_t fp_sqroot(uint32 x) { HELPER MACROS for Bresenham's circle drawing algorithm Note the proper spelling on this header. */ -#define __BE_ALGORITHM() { \ +#define BE_ALGORITHM() { \ if (f >= 0) { \ y--; \ ddF_y += 2; \ @@ -89,7 +89,7 @@ inline frac_t fp_sqroot(uint32 x) { f += ddF_x + 1; \ } -#define __BE_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \ +#define BE_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \ *(ptr1 + (y) - (px)) = color; \ *(ptr1 + (x) - (py)) = color; \ *(ptr2 - (x) - (py)) = color; \ @@ -100,7 +100,7 @@ inline frac_t fp_sqroot(uint32 x) { *(ptr4 + (y) + (px)) = color; \ } -#define __BE_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \ +#define BE_DRAWCIRCLE_XCOLOR(ptr1,ptr2,ptr3,ptr4,x,y,px,py) { \ *(ptr1 + (y) - (px)) = color1; \ *(ptr1 + (x) - (py)) = color2; \ *(ptr2 - (x) - (py)) = color2; \ @@ -111,13 +111,13 @@ inline frac_t fp_sqroot(uint32 x) { *(ptr4 + (y) + (px)) = color3; \ } -#define __BE_RESET() { \ +#define BE_RESET() { \ f = 1 - r; \ ddF_x = 0; ddF_y = -2 * r; \ x = 0; y = r; px = 0; py = pitch * r; \ } -#define __TRIANGLE_MAINX() \ +#define TRIANGLE_MAINX() \ if (error_term >= 0) { \ ptr_right += pitch; \ ptr_left += pitch; \ @@ -128,7 +128,7 @@ inline frac_t fp_sqroot(uint32 x) { ptr_right++; \ ptr_left--; -#define __TRIANGLE_MAINY() \ +#define TRIANGLE_MAINY() \ if (error_term >= 0) { \ ptr_right++; \ ptr_left--; \ @@ -140,7 +140,7 @@ inline frac_t fp_sqroot(uint32 x) { ptr_left += pitch; /** HELPER MACROS for WU's circle drawing algorithm **/ -#define __WU_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) { \ +#define WU_DRAWCIRCLE(ptr1,ptr2,ptr3,ptr4,x,y,px,py,a) { \ this->blendPixelPtr(ptr1 + (y) - (px), color, a); \ this->blendPixelPtr(ptr1 + (x) - (py), color, a); \ this->blendPixelPtr(ptr2 - (x) - (py), color, a); \ @@ -152,7 +152,7 @@ inline frac_t fp_sqroot(uint32 x) { } // optimized Wu's algorithm -#define __WU_ALGORITHM() { \ +#define WU_ALGORITHM() { \ oldT = T; \ T = fp_sqroot(rsq - y*y) ^ 0xFFFF; \ py += pitch; \ @@ -746,11 +746,11 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color); sp += pitch; - __BE_RESET(); + BE_RESET(); r--; while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); *(ptr_tr + (y) - (px)) = color; *(ptr_tr + (x) - (py)) = color; *(ptr_tl - (x) - (py)) = color; @@ -790,13 +790,13 @@ drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer: } } } else { - __BE_RESET(); + BE_RESET(); PixelType color1, color2; color1 = color2 = color; while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); if (fill_m == kFillGradient) { color1 = calcGradient(real_radius - x, long_h); @@ -1027,7 +1027,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color switch (fill_m) { case kFillDisabled: while (dx--) { - __TRIANGLE_MAINX(); + TRIANGLE_MAINX(); *ptr_right = color; *ptr_left = color; } @@ -1037,7 +1037,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color case kFillForeground: case kFillBackground: while (dx--) { - __TRIANGLE_MAINX(); + TRIANGLE_MAINX(); if (inverted) colorFill<PixelType>(ptr_right, ptr_left, color); else colorFill<PixelType>(ptr_left, ptr_right, color); } @@ -1045,7 +1045,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color case kFillGradient: while (dx--) { - __TRIANGLE_MAINX(); + TRIANGLE_MAINX(); if (inverted) colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h)); else colorFill<PixelType>(ptr_left, ptr_right, calcGradient(gradient_h++, h)); } @@ -1059,7 +1059,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color switch (fill_m) { case kFillDisabled: while (dy--) { - __TRIANGLE_MAINY(); + TRIANGLE_MAINY(); *ptr_right = color; *ptr_left = color; } @@ -1069,14 +1069,14 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color case kFillForeground: case kFillBackground: while (dy--) { - __TRIANGLE_MAINY(); + TRIANGLE_MAINY(); if (inverted) colorFill<PixelType>(ptr_right, ptr_left, color); else colorFill<PixelType>(ptr_left, ptr_right, color); } break; case kFillGradient: while (dy--) { - __TRIANGLE_MAINY(); + TRIANGLE_MAINY(); if (inverted) colorFill<PixelType>(ptr_right, ptr_left, calcGradient(gradient_h++, h)); else colorFill<PixelType>(ptr_left, ptr_right, calcGradient(gradient_h++, h)); } @@ -1158,16 +1158,16 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill<PixelType>(ptr_fill + hp - sp + r, ptr_fill + w + hp + 1 - sp - r, color); sp += pitch; - __BE_RESET(); + BE_RESET(); r--; while (x++ < y) { - __BE_ALGORITHM(); - __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); + BE_ALGORITHM(); + BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); if (Base::_strokeWidth > 1) { - __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x - 1, y, px, py); - __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px - pitch, py); + BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x - 1, y, px, py); + BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px - pitch, py); } } } @@ -1179,12 +1179,12 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto ptr_fill += pitch; } } else { - __BE_RESET(); + BE_RESET(); PixelType color1, color2, color3, color4; if (fill_m == kFillGradient) { while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); color1 = calcGradient(real_radius - x, long_h); color2 = calcGradient(real_radius - y, long_h); @@ -1197,11 +1197,11 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color4); colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color3); - __BE_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); + BE_DRAWCIRCLE_XCOLOR(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); } } else { while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color); colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color); @@ -1210,7 +1210,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color); // do not remove - messes up the drawing at lower resolutions - __BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); + BE_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py); } } @@ -1235,7 +1235,7 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode f if (fill_m == kFillDisabled) { while (sw++ < Base::_strokeWidth) { - __BE_RESET(); + BE_RESET(); r--; *(ptr + y) = color; @@ -1244,21 +1244,21 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode f *(ptr - py) = color; while (x++ < y) { - __BE_ALGORITHM(); - __BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py); + BE_ALGORITHM(); + BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py); if (Base::_strokeWidth > 1) { - __BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x - 1, y, px, py); - __BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px - pitch, py); + BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x - 1, y, px, py); + BE_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px - pitch, py); } } } } else { colorFill<PixelType>(ptr - r, ptr + r, color); - __BE_RESET(); + BE_RESET(); while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); colorFill<PixelType>(ptr - x + py, ptr + x + py, color); colorFill<PixelType>(ptr - x - py, ptr + x - py, color); colorFill<PixelType>(ptr - y + px, ptr + y + px, color); @@ -1330,7 +1330,7 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) { int short_h = h - (2 * r) + 1; - __BE_RESET(); + BE_RESET(); // HACK: As we are drawing circles exploting 8-axis symmetry, // there are 4 pixels on each circle which are drawn twice. @@ -1339,7 +1339,7 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) { uint32 hb = 0; while (x++ < y) { - __BE_ALGORITHM(); + BE_ALGORITHM(); if (((1 << x) & hb) == 0) { blendFill(ptr_tr - px - r, ptr_tr + y - px, 0, alpha); @@ -1392,7 +1392,7 @@ drawRoundedSquareFakeBevel(int x1, int y1, int r, int w, int h, int amount) { py = 0; while (x > y++) { - __WU_ALGORITHM(); + WU_ALGORITHM(); blendPixelPtr(ptr_tr + (y) - (px - pitch), color, a2); blendPixelPtr(ptr_tr + (x - 1) - (py), color, a2); @@ -1514,13 +1514,13 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto py = 0; while (x > y++) { - __WU_ALGORITHM(); + WU_ALGORITHM(); if (sw != 1 && sw != Base::_strokeWidth) a2 = a1 = 255; - __WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, (x - 1), y, (px - pitch), py, a2); - __WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1); + WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, (x - 1), y, (px - pitch), py, a2); + WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1); } } @@ -1538,7 +1538,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto py = 0; while (x > 1 + y++) { - __WU_ALGORITHM(); + WU_ALGORITHM(); colorFill<PixelType>(ptr_tl - x - py, ptr_tr + x - py, color); colorFill<PixelType>(ptr_tl - y - px, ptr_tr + y - px, color); @@ -1546,7 +1546,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill<PixelType>(ptr_bl - x + py, ptr_br + x + py, color); colorFill<PixelType>(ptr_bl - y + px, ptr_br + y + px, color); - __WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1); + WU_DRAWCIRCLE(ptr_tr, ptr_tl, ptr_bl, ptr_br, x, y, px, py, a1); } ptr_fill += pitch * r; @@ -1585,13 +1585,13 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode f *(ptr - px) = (PixelType)color; while (x > y++) { - __WU_ALGORITHM(); + WU_ALGORITHM(); if (sw != 1 && sw != Base::_strokeWidth) a2 = a1 = 255; - __WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, (x - 1), y, (px - pitch), py, a2); - __WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py, a1); + WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, (x - 1), y, (px - pitch), py, a2); + WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py, a1); } } } else { @@ -1603,14 +1603,14 @@ drawCircleAlg(int x1, int y1, int r, PixelType color, VectorRenderer::FillMode f py = 0; while (x > y++) { - __WU_ALGORITHM(); + WU_ALGORITHM(); colorFill<PixelType>(ptr - x + py, ptr + x + py, color); colorFill<PixelType>(ptr - x - py, ptr + x - py, color); colorFill<PixelType>(ptr - y + px, ptr + y + px, color); colorFill<PixelType>(ptr - y - px, ptr + y - px, color); - __WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py, a1); + WU_DRAWCIRCLE(ptr, ptr, ptr, ptr, x, y, px, py, a1); } } } diff --git a/graphics/pict.cpp b/graphics/pict.cpp index 0f4dcd463f..dcd0df8e10 100644 --- a/graphics/pict.cpp +++ b/graphics/pict.cpp @@ -467,7 +467,7 @@ void PictDecoder::skipBitsRect(Common::SeekableReadStream *stream, bool hasPalet stream->readUint16BE(); uint16 packType; - uint16 pixelSize; + uint16 pixelSize; // FIXME: unused // Top two bits signify PixMap vs BitMap if (rowBytes & 0xC000) { diff --git a/graphics/scaler/scale2x.h b/graphics/scaler/scale2x.h index b0c887d43c..917e817a0d 100644 --- a/graphics/scaler/scale2x.h +++ b/graphics/scaler/scale2x.h @@ -18,8 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __SCALE2X_H -#define __SCALE2X_H +#ifndef SCALER_SCALE2X_H +#define SCALER_SCALE2X_H #if defined(_MSC_VER) #define __restrict__ diff --git a/graphics/scaler/scale3x.h b/graphics/scaler/scale3x.h index ad5604d086..8d93914400 100644 --- a/graphics/scaler/scale3x.h +++ b/graphics/scaler/scale3x.h @@ -18,8 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef __SCALE3X_H -#define __SCALE3X_H +#ifndef SCALER_SCALE3X_H +#define SCALER_SCALE3X_H #if defined(_MSC_VER) #define __restrict__ diff --git a/graphics/scaler/scalebit.h b/graphics/scaler/scalebit.h index 6e4a30caf0..75f9dae455 100644 --- a/graphics/scaler/scalebit.h +++ b/graphics/scaler/scalebit.h @@ -33,8 +33,8 @@ * - derivative works of the program are allowed. */ -#ifndef __SCALEBIT_H -#define __SCALEBIT_H +#ifndef SCALER_SCALEBIT_H +#define SCALER_SCALEBIT_H int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height); void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height); diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index db45b5a995..7279279598 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -379,7 +379,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst * theme description format. * @param force Sets if the key is optional or necessary. */ -#define __PARSER_ASSIGN_INT(struct_name, key_name, force) \ +#define PARSER_ASSIGN_INT(struct_name, key_name, force) \ if (stepNode->values.contains(key_name)) { \ if (!parseIntegerKey(stepNode->values[key_name], 1, &x)) \ return parserError("Error parsing key value for '" + Common::String(key_name) + "'."); \ @@ -398,7 +398,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst * @param key_name Name as STRING of the key identifier as it appears in the * theme description format. */ -#define __PARSER_ASSIGN_RGB(struct_name, key_name) \ +#define PARSER_ASSIGN_RGB(struct_name, key_name) \ if (stepNode->values.contains(key_name)) { \ val = stepNode->values[key_name]; \ if (_palette.contains(val)) { \ @@ -415,16 +415,16 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->struct_name.set = true; \ } - __PARSER_ASSIGN_INT(stroke, "stroke", false); - __PARSER_ASSIGN_INT(bevel, "bevel", false); - __PARSER_ASSIGN_INT(shadow, "shadow", false); - __PARSER_ASSIGN_INT(factor, "gradient_factor", false); + PARSER_ASSIGN_INT(stroke, "stroke", false); + PARSER_ASSIGN_INT(bevel, "bevel", false); + PARSER_ASSIGN_INT(shadow, "shadow", false); + PARSER_ASSIGN_INT(factor, "gradient_factor", false); - __PARSER_ASSIGN_RGB(fgColor, "fg_color"); - __PARSER_ASSIGN_RGB(bgColor, "bg_color"); - __PARSER_ASSIGN_RGB(gradColor1, "gradient_start"); - __PARSER_ASSIGN_RGB(gradColor2, "gradient_end"); - __PARSER_ASSIGN_RGB(bevelColor, "bevel_color"); + PARSER_ASSIGN_RGB(fgColor, "fg_color"); + PARSER_ASSIGN_RGB(bgColor, "bg_color"); + PARSER_ASSIGN_RGB(gradColor1, "gradient_start"); + PARSER_ASSIGN_RGB(gradColor2, "gradient_end"); + PARSER_ASSIGN_RGB(bevelColor, "bevel_color"); if (functionSpecific) { assert(stepNode->values.contains("func")); @@ -444,7 +444,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (stepNode->values.contains("radius") && stepNode->values["radius"] == "auto") { drawstep->radius = 0xFF; } else { - __PARSER_ASSIGN_INT(radius, "radius", true); + PARSER_ASSIGN_INT(radius, "radius", true); } } @@ -545,8 +545,8 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst return parserError("'" + stepNode->values["fill"] + "' is not a valid fill mode for a shape."); } -#undef __PARSER_ASSIGN_INT -#undef __PARSER_ASSIGN_RGB +#undef PARSER_ASSIGN_INT +#undef PARSER_ASSIGN_RGB return true; } |