diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 916c3b8a80b3..bebdc1446e61 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -687,6 +687,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'printsprites', 'printundermon', 'processtrigger', + 'purgealocation', 'putbackobstuff', 'putundercentre', 'putundermenu', @@ -727,6 +728,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'removesetobject', 'removeobfrominv', 'resetkeyboard', + 'resetlocation', 'restoreall', 'restoreems', 'restorereels', diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 3c2283636eb2..e20ee83bac81 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -139,6 +139,14 @@ class DreamBase : public SegmentManager { void loadNews(); void loadCart(); + // from newplace.cpp + void getUnderCentre(); + void putUnderCentre(); + void showArrows(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + void resetLocation(uint8 index); + // from object.cpp void obIcons(); void fillRyan(); @@ -149,6 +157,7 @@ class DreamBase : public SegmentManager { void deleteExObject(uint8 index); void deleteExFrame(uint8 frameNum); void deleteExText(uint8 textNum); + void purgeALocation(uint8 index); // from pathfind.cpp void turnPathOn(uint8 param); @@ -236,14 +245,22 @@ class DreamBase : public SegmentManager { void delCurs(); // from saveload.cpp - void oldToNames(); + void loadGame(); + void doLoad(int slot); + void saveGame(); void namesToOld(); + void oldToNames(); + void saveLoad(); + void doSaveLoad(); void showMainOps(); void showDiscOps(); + void discOps(); void actualSave(); void actualLoad(); void loadPosition(unsigned int slot); void savePosition(unsigned int slot, const char *descbuf); + uint scanForNames(); + void loadOld(); void showDecisions(); void loadSaveBox(); void showNames(); @@ -331,7 +348,6 @@ class DreamBase : public SegmentManager { Frame *tempGraphics(); Frame *tempGraphics2(); Frame *tempGraphics3(); - void showArrows(); void middlePanel(); void showDiary(); void readMouse(); @@ -463,6 +479,11 @@ class DreamBase : public SegmentManager { template void checkCoords(const RectWithCallback *rectWithCallbacks); void newGame(); void deleteTaken(); + void autoAppear(); + void loadRoom(); + void startLoading(const Room &room); + void startup(); + void atmospheres(); // from use.cpp void placeFreeObject(uint8 index); @@ -505,10 +526,6 @@ class DreamBase : public SegmentManager { inline uint8 *workspace() { return _workspace; } void clearWork(); - uint8 getLocation(uint8 index); - void setLocation(uint8 index); - void getUnderCentre(); - void putUnderCentre(); uint8 *mapStore(); void panelToMap(); void mapToPanel(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6a68e7c2b9e1..265b215af6b1 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1130,37 +1130,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::purgeALocation() { - STACK_CHECK; - push(ax); - es = data.word(kExtras); - di = (0+2080+30000); - bx = pop(); - cx = 0; -purgeloc: - _cmp(bl, es.byte(di+0)); - if (!flags.z()) - goto dontpurge; - _cmp(es.byte(di+2), 0); - if (!flags.z()) - goto dontpurge; - push(di); - push(es); - push(bx); - push(cx); - deleteExObject(); - cx = pop(); - bx = pop(); - es = pop(); - di = pop(); -dontpurge: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto purgeloc; -} - void DreamGenContext::emergencyPurge() { STACK_CHECK; checkpurgeagain: @@ -1491,57 +1460,6 @@ void DreamGenContext::getDestInfo() { ax = pop(); } -void DreamGenContext::resetLocation() { - STACK_CHECK; - push(ax); - _cmp(al, 5); - if (!flags.z()) - goto notdelhotel; - purgeALocation(); - al = 21; - purgeALocation(); - al = 22; - purgeALocation(); - al = 27; - purgeALocation(); - goto clearedlocations; -notdelhotel: - _cmp(al, 8); - if (!flags.z()) - goto notdeltvstud; - purgeALocation(); - al = 28; - purgeALocation(); - goto clearedlocations; -notdeltvstud: - _cmp(al, 6); - if (!flags.z()) - goto notdelsarters; - purgeALocation(); - al = 20; - purgeALocation(); - al = 25; - purgeALocation(); - goto clearedlocations; -notdelsarters: - _cmp(al, 13); - if (!flags.z()) - goto notdelboathouse; - purgeALocation(); - al = 29; - purgeALocation(); - goto clearedlocations; -notdelboathouse: -clearedlocations: - ax = pop(); - ah = 0; - bx = ax; - dx = data; - es = dx; - _add(bx, 537); - es.byte(bx) = 0; -} - void DreamGenContext::dirCom() { STACK_CHECK; cx = 30; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d7f754afe99d..f836b58577c5 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -458,7 +458,6 @@ class DreamGenContext : public DreamBase, public Context { void getObTextStart(); void checkObjectSize(); void doSomeTalk(); - void resetLocation(); void outOfOpen(); void dirCom(); void findFirstPath(); @@ -470,7 +469,6 @@ class DreamGenContext : public DreamBase, public Context { void reExFromInv(); void transferMap(); void purgeAnItem(); - void purgeALocation(); void getSetAd(); void findOpenPos(); void searchForSame(); diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk index 398f0b8db006..88dfdeea5347 100644 --- a/engines/dreamweb/module.mk +++ b/engines/dreamweb/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ dreamgen.o \ keypad.o \ monitor.o \ + newplace.o \ object.o \ pathfind.o \ people.o \ @@ -17,6 +18,7 @@ MODULE_OBJS := \ sprite.o \ stubs.o \ talk.o \ + titles.o \ use.o \ vgafades.o \ vgagrafx.o diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp new file mode 100644 index 000000000000..f1743f0e6de2 --- /dev/null +++ b/engines/dreamweb/newplace.cpp @@ -0,0 +1,274 @@ +/* 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 { + +void DreamGenContext::newPlace() { + if (data.byte(kNeedtotravel) == 1) { + data.byte(kNeedtotravel) = 0; + selectLocation(); + } else if (data.byte(kAutolocation) != 0xFF) { + data.byte(kNewlocation) = data.byte(kAutolocation); + data.byte(kAutolocation) = 0xFF; + } +} + +void DreamGenContext::selectLocation() { + data.byte(kInmaparea) = 0; + clearBeforeLoad(); + data.byte(kGetback) = 0; + data.byte(kPointerframe) = 22; + readCityPic(); + showCity(); + getRidOfTemp(); + readDestIcon(); + loadTravelText(); + showPanel(); + showMan(); + showArrows(); + showExit(); + locationPic(); + underTextLine(); + data.byte(kCommandtype) = 255; + readMouse(); + data.byte(kPointerframe) = 0; + showPointer(); + workToScreenCPP(); + playChannel0(9, 255); + data.byte(kNewlocation) = 255; + + while (data.byte(kNewlocation) == 255) { + if (quitRequested()) + break; + + delPointer(); + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + + if (data.byte(kGetback) == 1) + break; + + 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,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkCoords(destList); + } + + if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { + data.byte(kNewlocation) = data.byte(kReallocation); + data.byte(kGetback) = 0; + } + + getRidOfTemp(); + getRidOfTemp2(); + getRidOfTemp3(); + deallocateMem(data.word(kTraveltext)); +} + +void DreamGenContext::showCity() { + clearWork(); + showFrame(tempGraphics(), 57, 32, 0, 0); + showFrame(tempGraphics(), 120+57, 32, 1, 0); +} + +void DreamGenContext::lookAtPlace() { + if (data.byte(kCommandtype) != 224) { + data.byte(kCommandtype) = 224; + commandOnly(27); + } + + if (!(data.word(kMousebutton) & 1) || + data.word(kMousebutton) == data.word(kOldbutton) || + data.byte(kDestpos) >= 15) + return; // noinfo + + delPointer(); + delTextLine(); + getUnderCentre(); + showFrame(tempGraphics3(), 60, 72, 0, 0); + showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); + if (data.byte(kForeignrelease)) + showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); + + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + findNextColon(&string); + uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; + printDirect(&string, 63, &y, 191, 191 & 1); + workToScreenM(); + hangOnP(500); + data.byte(kPointermode) = 0; + data.byte(kPointerframe) = 0; + putUnderCentre(); + workToScreenM(); +} + +void DreamBase::getUnderCentre() { + multiGet(mapStore(), 58, 72, 254, 110); +} + +void DreamBase::putUnderCentre() { + multiPut(mapStore(), 58, 72, 254, 110); +} + +// TODO: put Locationpic here + +// TODO: put Getdestinfo here + +void DreamBase::showArrows() { + showFrame(tempGraphics(), 116 - 12, 16, 0, 0); + showFrame(tempGraphics(), 226 + 12, 16, 1, 0); + showFrame(tempGraphics(), 280, 14, 2, 0); +} + +void DreamGenContext::nextDest() { + if (data.byte(kCommandtype) != 218) { + data.byte(kCommandtype) = 218; + commandOnly(28); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodu + + do { + data.byte(kDestpos)++; + if (data.byte(kDestpos) == 15) + data.byte(kDestpos) = 0; // last destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::lastDest() { + if (data.byte(kCommandtype) != 219) { + data.byte(kCommandtype) = 219; + commandOnly(29); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodd + + do { + data.byte(kDestpos)--; + if (data.byte(kDestpos) == 0xFF) + data.byte(kDestpos) = 15; // first destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::destSelect() { + if (data.byte(kCommandtype) != 222) { + data.byte(kCommandtype) = 222; + commandOnly(30); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // notrav + + getDestInfo(); + data.byte(kNewlocation) = data.byte(kDestpos); +} + +uint8 DreamBase::getLocation(uint8 index) { + return data.byte(kRoomscango + index); +} + +void DreamBase::setLocation(uint8 index) { + data.byte(kRoomscango + index) = 1; +} + +void DreamBase::resetLocation(uint8 index) { + if (index == 5) { + // delete hotel + purgeALocation(5); + purgeALocation(21); + purgeALocation(22); + purgeALocation(27); + } else if (index == 8) { + // delete TV studio + purgeALocation(8); + purgeALocation(28); + } else if (index == 6) { + // delete sarters + purgeALocation(6); + purgeALocation(20); + purgeALocation(25); + } else if (index == 13) { + // delete boathouse + purgeALocation(13); + purgeALocation(29); + } + + data.byte(kRoomscango + index) = 0; +} + +void DreamGenContext::readDestIcon() { + loadIntoTemp("DREAMWEB.G05"); + loadIntoTemp2("DREAMWEB.G06"); + loadIntoTemp3("DREAMWEB.G08"); +} + +void DreamGenContext::readCityPic() { + loadIntoTemp("DREAMWEB.G04"); +} + + + +} // End of namespace DreamGen diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8553f41ee849..207f4889db10 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -631,4 +631,14 @@ void DreamGenContext::outOfInv() { delPointer(); } +void DreamBase::purgeALocation(uint8 index) { + // index == al + for (uint8 i = 0; i < kNumexobjects; ++i) { + DynObject *t = getExAd(i); + if (t->currentLocation == index && t->mapad[0] == 0) { + deleteExObject(i); + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index a0309e1ee05b..b12c668d8297 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -44,7 +44,7 @@ void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { s.syncAsByte(reel->b7); } -void DreamGenContext::loadGame() { +void DreamBase::loadGame() { if (data.byte(kCommandtype) != 246) { data.byte(kCommandtype) = 246; commandOnly(41); @@ -57,7 +57,7 @@ void DreamGenContext::loadGame() { // if -1, open menu to ask for slot to load // if >= 0, directly load from that slot -void DreamGenContext::doLoad(int savegameId) { +void DreamBase::doLoad(int savegameId) { data.byte(kLoadingorsave) = 1; if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) { @@ -138,7 +138,7 @@ void DreamGenContext::doLoad(int savegameId) { } -void DreamGenContext::saveGame() { +void DreamBase::saveGame() { if (data.byte(kMandead) == 2) { blank(); return; @@ -239,7 +239,7 @@ void DreamBase::oldToNames() { memcpy(_saveNames, _saveNamesOld, 17*7); } -void DreamGenContext::saveLoad() { +void DreamBase::saveLoad() { if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) { blank(); return; @@ -252,7 +252,7 @@ void DreamGenContext::saveLoad() { doSaveLoad(); } -void DreamGenContext::doSaveLoad() { +void DreamBase::doSaveLoad() { data.byte(kPointerframe) = 0; data.word(kTextaddressx) = 70; data.word(kTextaddressy) = 182-8; @@ -350,7 +350,7 @@ void DreamBase::showDiscOps() { showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0); } -void DreamGenContext::discOps() { +void DreamBase::discOps() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; commandOnly(43); @@ -368,8 +368,8 @@ void DreamGenContext::discOps() { data.byte(kGetback) = 0; RectWithCallback discOpsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame }, - { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame }, + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::loadGame }, + { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamBase::saveGame }, { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } @@ -589,7 +589,7 @@ void DreamBase::loadPosition(unsigned int slot) { } // Count number of save files, and load their descriptions into _saveNames -unsigned int DreamGenContext::scanForNames() { +uint DreamBase::scanForNames() { // Initialize the first 7 slots (like the original code expects) for (unsigned int slot = 0; slot < 7; ++slot) { _saveNames[17 * slot + 0] = 2; @@ -620,12 +620,13 @@ unsigned int DreamGenContext::scanForNames() { Common::strlcpy(&_saveNames[17 * slotNum + 1], name, 16); // the first character is unused } - al = saveList.size() <= 7 ? (uint8)saveList.size() : 7; + // FIXME: Can the following be safely removed? +// al = saveList.size() <= 7 ? (uint8)saveList.size() : 7; return saveList.size(); } -void DreamGenContext::loadOld() { +void DreamBase::loadOld() { if (data.byte(kCommandtype) != 252) { data.byte(kCommandtype) = 252; commandOnly(48); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index f3c908aad2a3..9969ac775abd 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -21,7 +21,6 @@ */ #include "dreamweb/dreamweb.h" -#include "engines/util.h" #include "common/config-manager.h" namespace DreamGen { @@ -329,23 +328,23 @@ static const Atmosphere g_atmosphereList[] = { { 10,33,30,6,255 }, { 10,22,30,6,255 }, - + { 9,22,10,6,255 }, { 9,22,20,16,255 }, { 9,22,30,16,255 }, { 9,22,40,16,255 }, { 9,22,50,16,255 }, - + { 6,11,30,6,255 }, { 6,0,10,15,255 }, { 6,0,20,15,255 }, { 6,11,20,15,255 }, { 6,22,20,15,255 }, - + { 7,11,20,6,255 }, { 7,0,20,6,255 }, { 7,0,30,6,255 }, - + { 55,44,0,5,255 }, { 55,44,10,5,255 }, @@ -367,12 +366,12 @@ static const Atmosphere g_atmosphereList[] = { { 8,33,40,6,255 }, { 8,22,40,6,255 }, { 8,11,40,6,255 }, - + { 11,11,20,12,255 }, { 11,11,30,12,255 }, { 11,22,20,12,255 }, { 11,22,30,12,255 }, - + { 12,22,20,12,255 }, { 13,22,20,12,255 }, { 13,33,20,12,255 }, @@ -384,7 +383,7 @@ static const Atmosphere g_atmosphereList[] = { { 14,33,30,12,255 }, { 14,33,40,12,255 }, { 14,22,0,16,255 }, - + { 19,0,0,12,255 }, { 20,0,20,16,255 }, @@ -495,7 +494,7 @@ void DreamGenContext::dreamweb() { while (true) { - unsigned int count = scanForNames(); + uint count = scanForNames(); bool startNewGame = true; @@ -544,6 +543,7 @@ void DreamGenContext::dreamweb() { // "playGame" // "titles" + // TODO: In the demo version, titles() did nothing clearPalette(); bibleQuote(); if (!quitRequested()) // "titlesearly" @@ -707,7 +707,7 @@ void DreamGenContext::screenUpdate() { delPointer(); } -void DreamGenContext::startup() { +void DreamBase::startup() { data.byte(kCurrentkey) = 0; data.byte(kMainmode) = 0; createPanel(); @@ -846,14 +846,6 @@ void DreamBase::putUnderTimed() { multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamBase::getUnderCentre() { - multiGet(mapStore(), 58, 72, 254, 110); -} - -void DreamBase::putUnderCentre() { - multiPut(mapStore(), 58, 72, 254, 110); -} - void DreamGenContext::triggerMessage(uint16 index) { multiGet(mapStore(), 174, 153, 200, 63); uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); @@ -989,9 +981,6 @@ void DreamBase::DOSReturn() { } } -void DreamGenContext::set16ColPalette() { -} - void DreamBase::eraseOldObs() { if (data.byte(kNewobs) == 0) return; @@ -1052,7 +1041,7 @@ void DreamBase::clearAndLoad(uint16 seg, uint8 c, clearAndLoad(buf, c, size, maxSize); } -void DreamGenContext::startLoading(const Room &room) { +void DreamBase::startLoading(const Room &room) { data.byte(kCombatcount) = 0; data.byte(kRoomssample) = room.roomsSample; data.byte(kMapx) = room.mapX; @@ -1249,7 +1238,7 @@ const uint8 *DreamBase::findObName(uint8 type, uint8 index) { void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { const uint8 *src = findObName(type, index); size_t i; - for (i = 0; i < 28; ++i) { + for (i = 0; i < 28; ++i) { char c = src[i]; if (c == ':') break; @@ -1261,7 +1250,7 @@ void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { } void DreamGenContext::commandWithOb() { - commandWithOb(al, bh, bl); + commandWithOb(al, bh, bl); } void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { @@ -1988,12 +1977,6 @@ void DreamBase::sortOutMap() { } } -void DreamGenContext::showCity() { - clearWork(); - 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) { @@ -2104,7 +2087,7 @@ void DreamBase::zoomIcon() { showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0); } -void DreamGenContext::loadRoom() { +void DreamBase::loadRoom() { data.byte(kRoomloaded) = 1; data.word(kTimecount) = 0; data.word(kMaintimer) = 0; @@ -2123,10 +2106,6 @@ void DreamGenContext::loadRoom() { uint8 mapXstart, mapYstart; uint8 mapXsize, mapYsize; getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); - cl = mapXstart; - ch = mapYstart; - dl = mapXsize; - dh = mapYsize; } void DreamGenContext::readSetData() { @@ -2459,14 +2438,6 @@ void DreamBase::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } -uint8 DreamBase::getLocation(uint8 index) { - return data.byte(kRoomscango + index); -} - -void DreamBase::setLocation(uint8 index) { - data.byte(kRoomscango + index) = 1; -} - const uint8 *DreamBase::getTextInFile1(uint16 index) { SegmentRef text = getSegment(data.word(kTextfile1)); uint16 offset = text.word(index * 2) + kTextstart; @@ -2647,7 +2618,7 @@ void DreamGenContext::useMenu() { workToScreenM(); } -void DreamGenContext::atmospheres() { +void DreamBase::atmospheres() { const Atmosphere *a = &g_atmosphereList[0]; @@ -2671,8 +2642,8 @@ void DreamGenContext::atmospheres() { // I'm interpreting this as if the cmp reallocation is below the jz if (data.byte(kMapy) == 0) { - data.byte(kVolume) = 0; // "fullvol" - return; + data.byte(kVolume) = 0; // "fullvol" + return; } if (data.byte(kReallocation) == 2 && data.byte(kMapx) == 22 && data.byte(kMapy) == 10) @@ -2709,16 +2680,6 @@ void DreamGenContext::atmospheres() { cancelCh0(); } -void DreamGenContext::readCityPic() { - loadIntoTemp("DREAMWEB.G04"); -} - -void DreamGenContext::readDestIcon() { - loadIntoTemp("DREAMWEB.G05"); - loadIntoTemp2("DREAMWEB.G06"); - loadIntoTemp3("DREAMWEB.G08"); -} - uint8 DreamGenContext::nextSymbol(uint8 symbol) { uint8 result = symbol + 1; if (result == 6) @@ -2758,308 +2719,6 @@ void DreamBase::readKey() { data.word(kBufferout) = bufOut; } -void DreamGenContext::hangOne(uint16 delay) { - do { - vSync(); - if (data.byte(kLasthardkey) == 1) - return; // "hangonearly" - } while (--delay); -} - -void DreamGenContext::hangOne() { - hangOne(cx); -} - -void DreamGenContext::bibleQuote() { - initGraphics(640, 480, true); - - showPCX("DREAMWEB.I00"); - fadeScreenUps(); - - hangOne(80); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - hangOne(560); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - fadeScreenDowns(); - - hangOne(200); - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "biblequotearly" - } - - cancelCh0(); - - data.byte(kLasthardkey) = 0; -} - -void DreamGenContext::realCredits() { - data.byte(kRoomssample) = 33; - loadRoomsSample(); - data.byte(kVolume) = 0; - - initGraphics(640, 480, true); - hangOn(35); - - showPCX("DREAMWEB.I01"); - playChannel0(12, 0); - - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I02"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I03"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I04"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I05"); - playChannel0(12, 0); - hangOne(2); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - allPalette(); - hangOne(80); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - showPCX("DREAMWEB.I06"); - fadeScreenUps(); - hangOne(60); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - playChannel0(13, 0); - hangOne(350); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "realcreditsearly" - } - - fadeScreenDowns(); - hangOne(256); - - data.byte(kLasthardkey) = 0; -} - -void DreamGenContext::runIntroSeq() { - data.byte(kGetback) = 0; - - do { - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - spriteUpdate(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - delEverything(); - printSprites(); - reelsOnScreen(); - afterIntroRoom(); - useTimedText(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - dumpMap(); - dumpTimedText(); - vSync(); - - if (data.byte(kLasthardkey) == 1) - break; - - } while (data.byte(kGetback) != 1); - - - if (data.byte(kLasthardkey) == 1) { - getRidOfTempText(); - clearBeforeLoad(); - } - - // These were not called in this program arc - // in the original code.. Bug? - //getRidOfTempText(); - //clearBeforeLoad(); -} - -void DreamGenContext::intro() { - loadTempText("DREAMWEB.T82"); - loadPalFromIFF(); - setMode(); - data.byte(kNewlocation) = 50; - clearPalette(); - loadIntroRoom(); - data.byte(kVolume) = 7; - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 4; - playChannel0(12, 255); - fadeScreenUps(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - data.byte(kNewlocation) = 52; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - data.byte(kNewlocation) = 53; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - clearBeforeLoad(); - allPalette(); - data.byte(kNewlocation) = 54; - loadIntroRoom(); - runIntroSeq(); - - if (data.byte(kLasthardkey) == 1) { - data.byte(kLasthardkey) = 0; - return; // "introearly" - } - - getRidOfTempText(); - clearBeforeLoad(); - - data.byte(kLasthardkey) = 0; -} - void DreamBase::setTopLeft() { if (data.byte(kSymboltopdir) != 0) { blank(); @@ -3167,25 +2826,6 @@ void DreamGenContext::walkIntoRoom() { } } -void DreamGenContext::loadIntroRoom() { - data.byte(kIntrocount) = 0; - data.byte(kLocation) = 255; - loadRoom(); - data.word(kMapoffsetx) = 72; - data.word(kMapoffsety) = 16; - clearSprites(); - data.byte(kThroughdoor) = 0; - data.byte(kCurrentkey) = '0'; - data.byte(kMainmode) = 0; - clearWork(); - data.byte(kNewobs) = 1; - drawFloor(); - reelsOnScreen(); - spriteUpdate(); - printSprites(); - workToScreenCPP(); -} - void DreamGenContext::afterIntroRoom() { if (data.byte(kNowinnewroom) == 0) return; // notnewintro @@ -3201,17 +2841,6 @@ void DreamGenContext::afterIntroRoom() { data.byte(kNowinnewroom) = 0; } -void DreamGenContext::gettingShot() { - data.byte(kNewlocation) = 55; - clearPalette(); - loadIntroRoom(); - fadeScreenUps(); - data.byte(kVolumeto) = 0; - data.byte(kVolumedirection) = (byte)-1; - runEndSeq(); - clearBeforeLoad(); -} - void DreamBase::redrawMainScrn() { data.word(kTimecount) = 0; createPanel(); @@ -3368,81 +2997,6 @@ void DreamGenContext::reExFromOpen() { } -void DreamGenContext::nextDest() { - if (data.byte(kCommandtype) != 218) { - data.byte(kCommandtype) = 218; - commandOnly(28); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodu - - do { - data.byte(kDestpos)++; - if (data.byte(kDestpos) == 15) - data.byte(kDestpos) = 0; // last destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::lastDest() { - if (data.byte(kCommandtype) != 219) { - data.byte(kCommandtype) = 219; - commandOnly(29); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodd - - do { - data.byte(kDestpos)--; - if (data.byte(kDestpos) == 0xFF) - data.byte(kDestpos) = 15; // first destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::destSelect() { - if (data.byte(kCommandtype) != 222) { - data.byte(kCommandtype) = 222; - commandOnly(30); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // notrav - - getDestInfo(); - data.byte(kNewlocation) = data.byte(kDestpos); -} - void DreamGenContext::putBackObStuff() { createPanel(); showPanel(); @@ -3459,58 +3013,6 @@ void DreamGenContext::putBackObStuff() { delPointer(); } -void DreamGenContext::redes() { - if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { - blank(); - return; - } - - if (data.byte(kCommandtype) != 217) { - data.byte(kCommandtype) = 217; - commandOnly(50); - } - - if (!(data.word(kMousebutton) & 1)) - return; - - delPointer(); - createPanel(); - showPanel(); - showMan(); - showExit(); - convIcons(); - startTalk(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::moreTalk() { - if (data.byte(kTalkmode) != 0) { - redes(); - return; - } - - if (data.byte(kCommandtype) != 215) { - data.byte(kCommandtype) = 215; - commandOnly(49); - } - - if (data.word(kMousebutton) == data.word(kOldbutton)) - return; // nomore - - if (!(data.word(kMousebutton) & 1)) - return; - - data.byte(kTalkmode) = 2; - data.byte(kTalkpos) = 4; - - if (data.byte(kCharacter) >= 100) - data.byte(kTalkpos) = 48; // second part - doSomeTalk(); -} - bool DreamBase::isSetObOnMap(uint8 index) { return (getSetAd(index)->mapad[0] == 0); } @@ -3520,68 +3022,6 @@ void DreamBase::dumpZoom() { multiDump(kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::selectLocation() { - data.byte(kInmaparea) = 0; - clearBeforeLoad(); - data.byte(kGetback) = 0; - data.byte(kPointerframe) = 22; - readCityPic(); - showCity(); - getRidOfTemp(); - readDestIcon(); - loadTravelText(); - showPanel(); - showMan(); - showArrows(); - showExit(); - locationPic(); - underTextLine(); - data.byte(kCommandtype) = 255; - readMouse(); - data.byte(kPointerframe) = 0; - showPointer(); - workToScreenCPP(); - playChannel0(9, 255); - data.byte(kNewlocation) = 255; - - while (data.byte(kNewlocation) == 255) { - if (quitRequested()) - break; - - delPointer(); - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - - if (data.byte(kGetback) == 1) - break; - - 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,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - checkCoords(destList); - } - - if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { - data.byte(kNewlocation) = data.byte(kReallocation); - data.byte(kGetback) = 0; - } - - getRidOfTemp(); - getRidOfTemp2(); - getRidOfTemp3(); - deallocateMem(data.word(kTraveltext)); -} - - void DreamBase::examineInventory() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; @@ -3602,12 +3042,6 @@ void DreamBase::examineInventory() { workToScreenM(); } -void DreamBase::showArrows() { - showFrame(tempGraphics(), 116 - 12, 16, 0, 0); - showFrame(tempGraphics(), 226 + 12, 16, 1, 0); - showFrame(tempGraphics(), 280, 14, 2, 0); -} - void DreamBase::middlePanel() { Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0); showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0); @@ -3793,107 +3227,6 @@ void DreamGenContext::decide() { data.byte(kTextlen) = 240; } -void DreamGenContext::talk() { - data.byte(kTalkpos) = 0; - data.byte(kInmaparea) = 0; - data.byte(kCharacter) = data.byte(kCommand); - createPanel(); - showPanel(); - showMan(); - showExit(); - underTextLine(); - convIcons(); - startTalk(); - data.byte(kCommandtype) = 255; - readMouse(); - showPointer(); - workToScreenCPP(); - - RectWithCallback talkList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 240,290,2,44,&DreamGenContext::moreTalk }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - - do { - delPointer(); - readMouse(); - animPointer(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - data.byte(kGetback) = 0; - checkCoords(talkList); - if (data.byte(kQuitrequested)) - break; - } while (!data.byte(kGetback)); - - if (data.byte(kTalkpos) >= 4) - _personData->b7 |= 128; - - redrawMainScrn(); - workToScreenM(); - if (data.byte(kSpeechloaded) == 1) { - cancelCh1(); - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 0; - } -} - -void DreamGenContext::hangOnPQ() { - data.byte(kGetback) = 0; - - RectWithCallback quitList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - - uint16 speechFlag = 0; - - do { - delPointer(); - readMouse(); - animPointer(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - checkCoords(quitList); - - if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) { - // Quit conversation - delPointer(); - data.byte(kPointermode) = 0; - cancelCh1(); - flags._c = true; - return; - } - - if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { - speechFlag++; - if (speechFlag == 40) - break; - } - } while (!data.word(kMousebutton) || data.word(kOldbutton)); - - delPointer(); - data.byte(kPointermode) = 0; - flags._c = false; - } - -void DreamGenContext::endGame() { - loadTempText("DREAMWEB.T83"); - monkSpeaking(); - gettingShot(); - getRidOfTempText(); - data.byte(kVolumeto) = 7; - data.byte(kVolumedirection) = 1; - hangOn(200); -} - void DreamGenContext::showGun() { data.byte(kAddtored) = 0; data.byte(kAddtogreen) = 0; @@ -4018,49 +3351,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::newPlace() { - if (data.byte(kNeedtotravel) == 1) { - data.byte(kNeedtotravel) = 0; - selectLocation(); - } else if (data.byte(kAutolocation) != 0xFF) { - data.byte(kNewlocation) = data.byte(kAutolocation); - data.byte(kAutolocation) = 0xFF; - } -} - -void DreamGenContext::monkSpeaking() { - // FIXME: This is the CD version only. - - data.byte(kRoomssample) = 35; - loadRoomsSample(); - loadIntoTemp("DREAMWEB.G15"); - clearWork(); - showFrame(tempGraphics(), 160, 72, 0, 128); // show monk - workToScreen(); - data.byte(kVolume) = 7; - data.byte(kVolumedirection) = (byte)-1; - data.byte(kVolumeto) = 5; - playChannel0(12, 255); - fadeScreenUps(); - hangOn(300); - - for (int i = 40; i <= 48; i++) { - loadSpeech('T', 83, 'T', i); - - playChannel1(50 + 12); - - do { - engine->waitForVSync(); - } while (data.byte(kCh1playing) != 255); - } - - data.byte(kVolumedirection) = 1; - data.byte(kVolumeto) = 7; - fadeScreenDowns(); - hangOn(300); - getRidOfTemp(); -} - void DreamGenContext::useButtonA() { if (!isSetObOnMap(95)) { showFirstUse(); @@ -4081,11 +3371,10 @@ void DreamGenContext::useButtonA() { } } -void DreamGenContext::autoAppear() { +void DreamBase::autoAppear() { if (data.byte(kLocation) == 32) { // In alley - al = 5; - resetLocation(); + resetLocation(5); setLocation(10); data.byte(kDestpos) = 10; return; @@ -4115,8 +3404,7 @@ void DreamGenContext::autoAppear() { if (data.byte(kReallocation) == 25) { // Sart roof data.byte(kNewsitem) = 3; - al = 6; - resetLocation(); + resetLocation(6); setLocation(11); data.byte(kDestpos) = 11; } else { @@ -4196,8 +3484,7 @@ void DreamGenContext::entryAnims() { data.byte(kSpeedcount) = 1; break; case 44: // Sparky's - al = 8; - resetLocation(); + resetLocation(8); data.word(kWatchingtime) = 50*2; data.word(kReeltowatch) = 247; data.word(kEndwatchreel) = 297; @@ -4377,26 +3664,6 @@ void DreamGenContext::dumpDiaryKeys() { multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); } -void DreamGenContext::runEndSeq() { - atmospheres(); - data.byte(kGetback) = 0; - - do { - vSync(); - spriteUpdate(); - vSync(); - delEverything(); - printSprites(); - reelsOnScreen(); - afterIntroRoom(); - useTimedText(); - vSync(); - dumpMap(); - dumpTimedText(); - vSync(); - } while (data.byte(kGetback) != 1); -} - void DreamGenContext::lookAtCard() { data.byte(kManisoffscreen) = 1; getRidOfReels(); @@ -4471,38 +3738,6 @@ void DreamGenContext::showDiaryKeys() { showDiaryPage(); } -void DreamGenContext::lookAtPlace() { - if (data.byte(kCommandtype) != 224) { - data.byte(kCommandtype) = 224; - commandOnly(27); - } - - if (!(data.word(kMousebutton) & 1) || - data.word(kMousebutton) == data.word(kOldbutton) || - data.byte(kDestpos) >= 15) - return; // noinfo - - delPointer(); - delTextLine(); - getUnderCentre(); - showFrame(tempGraphics3(), 60, 72, 0, 0); - showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); - if (data.byte(kForeignrelease)) - showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); - - uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); - const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); - findNextColon(&string); - uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; - printDirect(&string, 63, &y, 191, 191 & 1); - workToScreenM(); - hangOnP(500); - data.byte(kPointermode) = 0; - data.byte(kPointerframe) = 0; - putUnderCentre(); - workToScreenM(); -} - void DreamGenContext::edensFlatReminders() { if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) return; // not in Eden's lift diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 61697e828ee5..c94cb02a3cfa 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -23,9 +23,7 @@ #define DREAMWEB_STUBS_H void screenUpdate(); - void startup(); void startup1(); - void saveLoad(); void workToScreen(); void multiGet(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) { @@ -52,7 +50,6 @@ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return DreamBase::printDirect(string, x, y, maxWidth, centered); } - void startLoading(const Room &room); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag, width, height); @@ -131,7 +128,6 @@ void dumpWatch(); void transferText(); void watchCount(); - void loadRoom(); void readSetData(); void useMenu(); void useMon(); @@ -219,15 +215,9 @@ uint8 nextSymbol(uint8 symbol); void showSymbol(); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); - unsigned int scanForNames(); - void doLoad(int slot); - void loadOld(); void inventory(); void mainScreen(); - void loadGame(); - void saveGame(); void zoomOnOff(); - void atmospheres(); void hangOne(uint16 delay); void hangOne(); void bibleQuote(); @@ -287,8 +277,6 @@ void madmanRun(); void decide(); void talk(); - void discOps(); - void doSaveLoad(); void useDiary(); void hangOnPQ(); void showGun(); @@ -299,7 +287,6 @@ void monkSpeaking(); void rollEndCredits2(); void useButtonA(); - void autoAppear(); void setupTimedUse(); void entryAnims(); void triggerMessage(uint16 index); diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 86d1b886ef16..fac75be6cfc4 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -24,8 +24,53 @@ namespace DreamGen { -uint16 DreamGenContext::getPersFrame(uint8 index) { - return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +void DreamGenContext::talk() { + data.byte(kTalkpos) = 0; + data.byte(kInmaparea) = 0; + data.byte(kCharacter) = data.byte(kCommand); + createPanel(); + showPanel(); + showMan(); + showExit(); + underTextLine(); + convIcons(); + startTalk(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreenCPP(); + + RectWithCallback talkList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 240,290,2,44,&DreamGenContext::moreTalk }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + data.byte(kGetback) = 0; + checkCoords(talkList); + if (data.byte(kQuitrequested)) + break; + } while (!data.byte(kGetback)); + + if (data.byte(kTalkpos) >= 4) + data.byte(data.word(kPersondata)+7) |= 128; + + redrawMainScrn(); + workToScreenM(); + if (data.byte(kSpeechloaded) == 1) { + cancelCh1(); + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 0; + } } void DreamGenContext::convIcons() { @@ -35,4 +80,108 @@ void DreamGenContext::convIcons() { showFrame(base, 234, 2, frame, 0); } +uint16 DreamGenContext::getPersFrame(uint8 index) { + return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); +} + +// TODO: put Starttalk here + +// TODO: put Getpersontext here + +void DreamGenContext::moreTalk() { + if (data.byte(kTalkmode) != 0) { + redes(); + return; + } + + if (data.byte(kCommandtype) != 215) { + data.byte(kCommandtype) = 215; + commandOnly(49); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // nomore + + if (!(data.word(kMousebutton) & 1)) + return; + + data.byte(kTalkmode) = 2; + data.byte(kTalkpos) = 4; + + if (data.byte(kCharacter) >= 100) + data.byte(kTalkpos) = 48; // second part + doSomeTalk(); +} + +// TODO: put Dosometalk here + +void DreamGenContext::hangOnPQ() { + data.byte(kGetback) = 0; + + RectWithCallback quitList[] = { + { 273,320,157,198,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + uint16 speechFlag = 0; + + do { + delPointer(); + readMouse(); + animPointer(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + checkCoords(quitList); + + if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) { + // Quit conversation + delPointer(); + data.byte(kPointermode) = 0; + cancelCh1(); + flags._c = true; + return; + } + + if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) { + speechFlag++; + if (speechFlag == 40) + break; + } + } while (!data.word(kMousebutton) || data.word(kOldbutton)); + + delPointer(); + data.byte(kPointermode) = 0; + flags._c = false; +} + +void DreamGenContext::redes() { + if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) { + blank(); + return; + } + + if (data.byte(kCommandtype) != 217) { + data.byte(kCommandtype) = 217; + commandOnly(50); + } + + if (!(data.word(kMousebutton) & 1)) + return; + + delPointer(); + createPanel(); + showPanel(); + showMan(); + showExit(); + convIcons(); + startTalk(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp new file mode 100644 index 000000000000..b653c2cf2736 --- /dev/null +++ b/engines/dreamweb/titles.cpp @@ -0,0 +1,426 @@ +/* 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" +#include "engines/util.h" + +namespace DreamGen { + +void DreamGenContext::endGame() { + loadTempText("DREAMWEB.T83"); + monkSpeaking(); + gettingShot(); + getRidOfTempText(); + data.byte(kVolumeto) = 7; + data.byte(kVolumedirection) = 1; + hangOn(200); +} + +void DreamGenContext::monkSpeaking() { + // FIXME: This is the CD version only. + + data.byte(kRoomssample) = 35; + loadRoomsSample(); + loadIntoTemp("DREAMWEB.G15"); + clearWork(); + showFrame(tempGraphics(), 160, 72, 0, 128); // show monk + workToScreen(); + data.byte(kVolume) = 7; + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 5; + playChannel0(12, 255); + fadeScreenUps(); + hangOn(300); + + for (int i = 40; i <= 48; i++) { + loadSpeech('T', 83, 'T', i); + + playChannel1(50 + 12); + + do { + engine->waitForVSync(); + } while (data.byte(kCh1playing) != 255); + } + + data.byte(kVolumedirection) = 1; + data.byte(kVolumeto) = 7; + fadeScreenDowns(); + hangOn(300); + getRidOfTemp(); +} + +void DreamGenContext::gettingShot() { + data.byte(kNewlocation) = 55; + clearPalette(); + loadIntroRoom(); + fadeScreenUps(); + data.byte(kVolumeto) = 0; + data.byte(kVolumedirection) = (byte)-1; + runEndSeq(); + clearBeforeLoad(); +} + +void DreamGenContext::bibleQuote() { + initGraphics(640, 480, true); + + showPCX("DREAMWEB.I00"); + fadeScreenUps(); + + hangOne(80); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + hangOne(560); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + fadeScreenDowns(); + + hangOne(200); + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "biblequotearly" + } + + cancelCh0(); + + data.byte(kLasthardkey) = 0; +} + +void DreamGenContext::hangOne(uint16 delay) { + do { + vSync(); + if (data.byte(kLasthardkey) == 1) + return; // "hangonearly" + } while (--delay); +} + +void DreamGenContext::hangOne() { + hangOne(cx); +} + +void DreamGenContext::intro() { + loadTempText("DREAMWEB.T82"); + loadPalFromIFF(); + setMode(); + data.byte(kNewlocation) = 50; + clearPalette(); + loadIntroRoom(); + data.byte(kVolume) = 7; + data.byte(kVolumedirection) = (byte)-1; + data.byte(kVolumeto) = 4; + playChannel0(12, 255); + fadeScreenUps(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + data.byte(kNewlocation) = 52; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + data.byte(kNewlocation) = 53; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + clearBeforeLoad(); + allPalette(); + data.byte(kNewlocation) = 54; + loadIntroRoom(); + runIntroSeq(); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "introearly" + } + + getRidOfTempText(); + clearBeforeLoad(); + + data.byte(kLasthardkey) = 0; +} + +void DreamGenContext::runIntroSeq() { + data.byte(kGetback) = 0; + + do { + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + spriteUpdate(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + delEverything(); + printSprites(); + reelsOnScreen(); + afterIntroRoom(); + useTimedText(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + dumpMap(); + dumpTimedText(); + vSync(); + + if (data.byte(kLasthardkey) == 1) + break; + + } while (data.byte(kGetback) != 1); + + + if (data.byte(kLasthardkey) == 1) { + getRidOfTempText(); + clearBeforeLoad(); + } + + // These were not called in this program arc + // in the original code.. Bug? + //getRidOfTempText(); + //clearBeforeLoad(); +} + +void DreamGenContext::runEndSeq() { + atmospheres(); + data.byte(kGetback) = 0; + + do { + vSync(); + spriteUpdate(); + vSync(); + delEverything(); + printSprites(); + reelsOnScreen(); + afterIntroRoom(); + useTimedText(); + vSync(); + dumpMap(); + dumpTimedText(); + vSync(); + } while (data.byte(kGetback) != 1); +} + +void DreamGenContext::loadIntroRoom() { + data.byte(kIntrocount) = 0; + data.byte(kLocation) = 255; + loadRoom(); + data.word(kMapoffsetx) = 72; + data.word(kMapoffsety) = 16; + clearSprites(); + data.byte(kThroughdoor) = 0; + data.byte(kCurrentkey) = '0'; + data.byte(kMainmode) = 0; + clearWork(); + data.byte(kNewobs) = 1; + drawFloor(); + reelsOnScreen(); + spriteUpdate(); + printSprites(); + workToScreenCPP(); +} + +void DreamGenContext::set16ColPalette() { +} + +void DreamGenContext::realCredits() { + data.byte(kRoomssample) = 33; + loadRoomsSample(); + data.byte(kVolume) = 0; + + initGraphics(640, 480, true); + hangOn(35); + + showPCX("DREAMWEB.I01"); + playChannel0(12, 0); + + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I02"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I03"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I04"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I05"); + playChannel0(12, 0); + hangOne(2); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + allPalette(); + hangOne(80); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + showPCX("DREAMWEB.I06"); + fadeScreenUps(); + hangOne(60); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + playChannel0(13, 0); + hangOne(350); + + if (data.byte(kLasthardkey) == 1) { + data.byte(kLasthardkey) = 0; + return; // "realcreditsearly" + } + + fadeScreenDowns(); + hangOne(256); + + data.byte(kLasthardkey) = 0; +} + +} // End of namespace DreamGen diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index f6406dc77339..d3dda0e0a028 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -823,8 +823,7 @@ void DreamGenContext::useGun() { } else if (data.byte(kReallocation) == 29) { // aide data.byte(kGetback) = 1; - al = 13; - resetLocation(); + resetLocation(13); setLocation(12); data.byte(kDestpos) = 12; data.byte(kDestination) = 2; diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index d975d303c958..adbc158c8441 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -25,6 +25,7 @@ namespace DreamGen { uint8 *DreamBase::mainPalette() { +// TODO: Turn these into plain C arrays return getSegment(data.word(kBuffers)).ptr(kMaingamepal, 256 * 3); }