diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 2e3c530853a..de7bada9434 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -53,6 +53,10 @@ protected: // from pathfind.cpp Common::Point _lineData[200]; // Output of Bresenham + // from saveload.cpp + char _saveNames[17*7]; + char _saveNamesOld[17*7]; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -109,6 +113,9 @@ public: // from object.cpp void obIcons(); + void fillRyan(); + void findAllRyan(uint8 *inv); + void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); // from pathfind.cpp void checkDest(const RoomPaths *roomsPaths); @@ -135,8 +142,10 @@ public: void delCurs(); // from saveload.cpp - char _saveNames[17*7]; - char _saveNamesOld[17*7]; + void oldToNames(); + void namesToOld(); + void showMainOps(); + void showDiscOps(); void showNames(); // from sound.cpp @@ -157,6 +166,7 @@ public: void soundOnReels(uint16 reelPointer); void rollEndCredits(); void priestText(ReelRoutine &routine); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); // from stubs.cpp void crosshair(); @@ -185,6 +195,7 @@ public: DynObject *getFreeAd(uint8 index); DynObject *getExAd(uint8 index); DynObject *getEitherAdCPP(); + void *getAnyAdDir(uint8 index, uint8 flag); void showWatch(); void showTime(); void showExit(); @@ -203,6 +214,8 @@ public: void loadIntoTemp2(const char *fileName); void loadIntoTemp3(const char *fileName); void loadTempCharset(const char *fileName); + void loadTravelText(); + void loadTempText(const char *fileName); void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize); void sortOutMap(); @@ -218,6 +231,33 @@ public: void eraseOldObs(); void commandOnly(uint8 command); void blank(); + void setTopLeft(); + void setTopRight(); + void setBotLeft(); + void setBotRight(); + void examIcon(); + void animPointer(); + void getFlagUnderP(uint8 *flag, uint8 *flagEx); + void workToScreenM(); + void quitKey(); + void loadFolder(); + void folderHints(); + void folderExit(); + void showFolder(); + void showLeftPage(); + void showRightPage(); + void underTextLine(); + void hangOnP(uint16 count); + void getUnderZoom(); + void putUnderZoom(); + void examineInventory(); + void openInv(); + void getBack1(); + void getBackFromOb(); + void getBackFromOps(); + void getBackToOps(); + void DOSReturn(); + bool isItWorn(const DynObject *object); // from use.cpp void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 795f5b053e3..032f01873e5 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -94,18 +94,18 @@ void DreamBase::addToPressList() { void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { 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 }, + { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, + { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, + { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamBase::buttonThree }, + { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamBase::buttonFour }, + { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamBase::buttonFive }, + { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamBase::buttonSix }, + { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamBase::buttonSeven }, + { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamBase::buttonEight }, + { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamBase::buttonNine }, + { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamBase::buttonNought }, + { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamBase::buttonEnter }, + { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamBase::quitKey }, { 0,320,0,200,&DreamGenContext::blank }, { 0xFFFF,0,0,0,0 } }; diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8e5da2c90e2..b430183cee5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -24,7 +24,27 @@ namespace DreamGen { -void DreamGenContext::fillRyan() { +void DreamBase::showRyanPage() { + showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0); + showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); +} + +void DreamBase::findAllRyan(uint8 *inv) { + memset(inv, 0xff, 60); + for (size_t i = 0; i < kNumexobjects; ++i) { + DynObject *extra = getExAd(i); + if (extra->mapad[0] != 4) + continue; + if (extra->mapad[1] != 0xff) + continue; + uint8 slot = extra->mapad[2]; + assert(slot < 30); + inv[2 * slot + 0] = i; + inv[2 * slot + 1] = 4; + } +} + +void DreamBase::fillRyan() { uint8 *inv = getSegment(data.word(kBuffers)).ptr(kRyaninvlist, 60); findAllRyan(inv); inv += data.byte(kRyanpage) * 2 * 10; @@ -42,7 +62,7 @@ void DreamGenContext::isItWorn() { flags._z = isItWorn((const DynObject *)es.ptr(bx, sizeof(DynObject))); } -bool DreamGenContext::isItWorn(const DynObject *object) { +bool DreamBase::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } @@ -72,7 +92,7 @@ void DreamGenContext::obToInv() { obToInv(al, ah, di, bx); } -void DreamGenContext::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { +void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { showFrame(engine->icons1(), x - 2, y - 1, 10, 0); if (index == 0xff) return; @@ -154,8 +174,8 @@ void DreamGenContext::examineOb(bool examineAgain) { { 260,300,0,44,&DreamGenContext::useObject }, { 210,254,0,44,&DreamGenContext::selectOpenOb }, { 144,176,64,96,&DreamGenContext::setPickup }, - { 0,50,50,200,&DreamGenContext::examineInventory }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,50,50,200,&DreamBase::examineInventory }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(examList); @@ -169,7 +189,7 @@ void DreamGenContext::examineOb(bool examineAgain) { { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage }, { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened }, { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(invList1); @@ -180,7 +200,7 @@ void DreamGenContext::examineOb(bool examineAgain) { { 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 }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(withList1); @@ -256,7 +276,7 @@ void DreamGenContext::transferText() { data.word(kExtextpos) += len + 1; } -void DreamGenContext::getBackFromOb() { +void DreamBase::getBackFromOb() { if (data.byte(kPickup) != 1) getBack1(); else diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index f0fd477ec14..2945874e1ab 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -71,7 +71,7 @@ void DreamGenContext::doLoad(int savegameId) { { 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 }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(loadlist); @@ -167,7 +167,7 @@ void DreamGenContext::saveGame() { { 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 }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(savelist); @@ -216,11 +216,11 @@ void DreamGenContext::saveGame() { } } -void DreamGenContext::namesToOld() { +void DreamBase::namesToOld() { memcpy(_saveNamesOld, _saveNames, 17*7); } -void DreamGenContext::oldToNames() { +void DreamBase::oldToNames() { memcpy(_saveNames, _saveNamesOld, 17*7); } @@ -237,13 +237,77 @@ void DreamGenContext::saveLoad() { doSaveLoad(); } -void DreamGenContext::showMainOps() { +void DreamGenContext::doSaveLoad() { + data.byte(kPointerframe) = 0; + data.word(kTextaddressx) = 70; + data.word(kTextaddressy) = 182-8; + data.byte(kTextlen) = 181; + data.byte(kManisoffscreen) = 1; + clearWork(); + createPanel2(); + underTextLine(); + getRidOfAll(); + loadSaveBox(); + showOpBox(); + showMainOps(); + workToScreenCPP(); + + RectWithCallback opsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, + { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, + { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + bool firstOps = true; + + do { // restart ops + if (firstOps) { + firstOps = false; + } else { + showOpBox(); + showMainOps(); + workToScreenM(); + } + data.byte(kGetback) = 0; + + do { // wait ops + if (data.byte(kQuitrequested)) { + data.byte(kManisoffscreen) = 0; + return; + } + + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + delPointer(); + checkCoords(opsList); + } while (!data.byte(kGetback)); + } while (data.byte(kGetback) == 2); + + data.word(kTextaddressx) = 13; + data.word(kTextaddressy) = 182; + data.byte(kTextlen) = 240; + if (data.byte(kGetback) != 4) { + getRidOfTemp(); + restoreAll(); + redrawMainScrn(); + workToScreenM(); + data.byte(kCommandtype) = 200; + } + data.byte(kManisoffscreen) = 0; +} + +void DreamBase::showMainOps() { showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 8, 0); showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 7, 0); showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0); } -void DreamGenContext::showDiscOps() { +void DreamBase::showDiscOps() { showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0); showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 9, 0); showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 10, 0); @@ -522,5 +586,42 @@ void DreamGenContext::checkInput() { workToScreenM(); } +void DreamGenContext::selectSlot() { + if (data.byte(kCommandtype) != 244) { + data.byte(kCommandtype) = 244; + commandOnly(45); + } + + if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) + return; // noselslot + if (data.byte(kLoadingorsave) == 3) + data.byte(kLoadingorsave)--; + + oldToNames(); + int y = data.word(kMousey) - (kOpsy + 4); + if (y < 11) + data.byte(kCurrentslot) = 0; + else + data.byte(kCurrentslot) = y / 11; + + delPointer(); + showOpBox(); + showSlots(); + showNames(); + if (data.byte(kLoadingorsave) == 1) + showLoadOps(); + else + showSaveOps(); + readMouse(); + showPointer(); + workToScreen(); + delPointer(); +} + +void DreamGenContext::selectSlot2() { + if (data.word(kMousebutton)) + data.byte(kLoadingorsave) = 2; + selectSlot(); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index aca935cde9d..1a341ce8d32 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -581,7 +581,7 @@ void DreamGenContext::checkOne() { al = type; } -void DreamGenContext::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { +void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { *flagX = x / 16; *flagY = y / 16; const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 014e3143d91..d53c1a1346f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -882,13 +882,13 @@ void DreamGenContext::triggerMessage(uint16 index) { void DreamGenContext::processTrigger() { if (data.byte(kLasttrigger) == '1') { - DreamBase::setLocation(8); + setLocation(8); triggerMessage(45); } else if (data.byte(kLasttrigger) == '2') { - DreamBase::setLocation(9); + setLocation(9); triggerMessage(55); } else if (data.byte(kLasttrigger) == '3') { - DreamBase::setLocation(2); + setLocation(2); triggerMessage(59); } } @@ -1000,7 +1000,7 @@ void DreamBase::deallocateMem(uint16 segment) { } } -void DreamGenContext::DOSReturn() { +void DreamBase::DOSReturn() { if (data.byte(kCommandtype) != 250) { data.byte(kCommandtype) = 250; commandOnly(46); @@ -1409,7 +1409,7 @@ void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { } } -void *DreamGenContext::getAnyAdDir(uint8 index, uint8 flag) { +void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) { if (flag == 4) return getExAd(index); else if (flag == 2) @@ -1488,18 +1488,11 @@ bool DreamGenContext::finishedWalkingCPP() { return (data.byte(kLinepointer) == 254) && (data.byte(kFacing) == data.byte(kTurntoface)); } -void DreamGenContext::getFlagUnderP() { - uint8 flag, flagEx; - getFlagUnderP(&flag, &flagEx); - cl = flag; - ch = flagEx; -} - -void DreamGenContext::getFlagUnderP(uint8 *flag, uint8 *flagEx) { +void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) { uint8 type, flagX, flagY; checkOne(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY); - cl = data.byte(kLastflag) = *flag; - ch = data.byte(kLastflagex) = *flagEx; + data.byte(kLastflag) = *flag; + data.byte(kLastflagex) = *flagEx; } void DreamGenContext::walkAndExamine() { @@ -1574,7 +1567,8 @@ void DreamGenContext::obName(uint8 command, uint8 commandType) { } } - getFlagUnderP(); + uint8 flag, flagEx; + getFlagUnderP(&flag, &flagEx); if (data.byte(kLastflag) < 2) { blockNameText(); return; @@ -1691,7 +1685,7 @@ void DreamBase::showPointer() { } } -void DreamGenContext::animPointer() { +void DreamBase::animPointer() { if (data.byte(kPointermode) == 2) { data.byte(kPointerframe) = 0; @@ -1879,30 +1873,6 @@ bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { return false; } -void DreamBase::showRyanPage() { - showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0); - showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); -} - -void DreamGenContext::findAllRyan() { - findAllRyan(es.ptr(di, 60)); -} - -void DreamGenContext::findAllRyan(uint8 *inv) { - memset(inv, 0xff, 60); - for (size_t i = 0; i < kNumexobjects; ++i) { - DynObject *extra = getExAd(i); - if (extra->mapad[0] != 4) - continue; - if (extra->mapad[1] != 0xff) - continue; - uint8 slot = extra->mapad[2]; - assert(slot < 30); - inv[2 * slot + 0] = i; - inv[2 * slot + 1] = 4; - } -} - void DreamGenContext::hangOn() { hangOn(cx); } @@ -1938,7 +1908,7 @@ void DreamGenContext::hangOnP() { hangOnP(cx); } -void DreamGenContext::hangOnP(uint16 count) { +void DreamBase::hangOnP(uint16 count) { data.word(kMaintimer) = 0; uint8 pointerFrame = data.byte(kPointerframe); uint8 pickup = data.byte(kPickup); @@ -2022,12 +1992,12 @@ void DreamGenContext::enterSymbol() { dumpTextLine(); dumpSymbol(); 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 }, + { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol }, + { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight }, + { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamBase::setBotLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamBase::setBotRight }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(symbolList); @@ -2438,7 +2408,7 @@ void DreamGenContext::restoreReels() { engine->closeFile(); } -void DreamGenContext::loadFolder() { +void DreamBase::loadFolder() { loadIntoTemp("DREAMWEB.G09"); // folder graphics 1 loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2 loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3 @@ -2446,7 +2416,7 @@ void DreamGenContext::loadFolder() { loadTempText("DREAMWEB.T50"); // folder text } -void DreamGenContext::showFolder() { +void DreamBase::showFolder() { data.byte(kCommandtype) = 255; if (data.byte(kFolderpage)) { useTempCharset(); @@ -2471,7 +2441,7 @@ void DreamGenContext::showFolder() { } } -void DreamGenContext::showLeftPage() { +void DreamBase::showLeftPage() { showFrame(tempGraphics2(), 0, 12, 3, 0); uint16 y = 12+5; for (size_t i = 0; i < 9; ++i) { @@ -2504,7 +2474,7 @@ void DreamGenContext::showLeftPage() { } } -void DreamGenContext::showRightPage() { +void DreamBase::showRightPage() { showFrame(tempGraphics2(), 143, 12, 0, 0); uint16 y = 12+37; for (size_t i = 0; i < 7; ++i) { @@ -2552,7 +2522,7 @@ void DreamBase::panelIcons1() { showWatch(); } -void DreamGenContext::examIcon() { +void DreamBase::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } @@ -2560,10 +2530,6 @@ uint8 DreamBase::getLocation(uint8 index) { return data.byte(kRoomscango + index); } -void DreamGenContext::getLocation() { - al = DreamBase::getLocation(al); -} - void DreamBase::setLocation(uint8 index) { data.byte(kRoomscango + index) = 1; } @@ -2581,10 +2547,10 @@ const uint8 *DreamBase::getTextInFile1(uint16 index) { void DreamGenContext::checkFolderCoords() { RectWithCallback folderList[] = { - { 280,320,160,200, &DreamGenContext::quitKey }, + { 280,320,160,200, &DreamBase::quitKey }, { 143,300,6,194, &DreamGenContext::nextFolder }, { 0,143,6,194, &DreamGenContext::lastFolder }, - { 0,320,0,200, &DreamGenContext::blank }, + { 0,320,0,200, &DreamBase::blank }, { 0xFFFF,0,0,0, 0 } }; checkCoords(folderList); @@ -2630,10 +2596,10 @@ void DreamGenContext::lastFolder() { } } -void DreamGenContext::folderHints() { +void DreamBase::folderHints() { if (data.byte(kFolderpage) == 5) { - if ((data.byte(kAidedead) != 1) && (DreamBase::getLocation(13) != 1)) { - DreamBase::setLocation(13); + if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) { + setLocation(13); showFolder(); const uint8 *string = getTextInFile1(30); printDirect(string, 0, 86, 141, true); @@ -2641,8 +2607,8 @@ void DreamGenContext::folderHints() { hangOnP(200); } } else if (data.byte(kFolderpage) == 9) { - if (DreamBase::getLocation(7) != 1) { - DreamBase::setLocation(7); + if (getLocation(7) != 1) { + setLocation(7); showFolder(); const uint8 *string = getTextInFile1(31); printDirect(string, 0, 86, 141, true); @@ -2652,19 +2618,15 @@ void DreamGenContext::folderHints() { } } -void DreamGenContext::folderExit() { +void DreamBase::folderExit() { showFrame(tempGraphics2(), 296, 178, 6, 0); } -void DreamGenContext::loadTravelText() { +void DreamBase::loadTravelText() { data.word(kTraveltext) = standardLoad("DREAMWEB.T81"); // location descs } -void DreamGenContext::loadTempText() { - loadTempText((const char *)data.ptr(dx, 0)); -} - -void DreamGenContext::loadTempText(const char *fileName) { +void DreamBase::loadTempText(const char *fileName) { data.word(kTextfile1) = standardLoad(fileName); } @@ -2692,7 +2654,7 @@ void DreamGenContext::allocateBuffers() { data.word(kSounddata2) = allocateMem(2048/16); } -void DreamGenContext::workToScreenM() { +void DreamBase::workToScreenM() { animPointer(); readMouse(); showPointer(); @@ -2742,8 +2704,8 @@ void DreamGenContext::useMenu() { dumpMenu(); dumpTextLine(); RectWithCallback menuList[] = { - { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamGenContext::quitKey }, - { 0,320,0,200,&DreamGenContext::blank }, + { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(menuList); @@ -3169,7 +3131,7 @@ void DreamGenContext::intro() { data.byte(kLasthardkey) = 0; } -void DreamGenContext::setTopLeft() { +void DreamBase::setTopLeft() { if (data.byte(kSymboltopdir) != 0) { blank(); return; @@ -3184,7 +3146,7 @@ void DreamGenContext::setTopLeft() { data.byte(kSymboltopdir) = 0xFF; } -void DreamGenContext::setTopRight() { +void DreamBase::setTopRight() { if (data.byte(kSymboltopdir) != 0) { blank(); return; @@ -3199,7 +3161,7 @@ void DreamGenContext::setTopRight() { data.byte(kSymboltopdir) = 1; } -void DreamGenContext::setBotLeft() { +void DreamBase::setBotLeft() { if (data.byte(kSymbolbotdir) != 0) { blank(); return; @@ -3214,7 +3176,7 @@ void DreamGenContext::setBotLeft() { data.byte(kSymbolbotdir) = 0xFF; } -void DreamGenContext::setBotRight() { +void DreamBase::setBotRight() { if (data.byte(kSymbolbotdir) != 0) { blank(); return; @@ -3239,14 +3201,14 @@ void DreamGenContext::newGame() { data.byte(kGetback) = 3; } -void DreamGenContext::getBackFromOps() { +void DreamBase::getBackFromOps() { if (data.byte(kMandead) == 2) blank(); else getBack1(); } -void DreamGenContext::getBackToOps() { +void DreamBase::getBackToOps() { if (data.byte(kCommandtype) != 201) { data.byte(kCommandtype) = 201; commandOnly(42); @@ -3356,12 +3318,6 @@ void DreamGenContext::redrawMainScrn() { data.byte(kCommandtype) = 255; } -void DreamGenContext::selectSlot2() { - if (data.word(kMousebutton)) - data.byte(kLoadingorsave) = 2; - selectSlot(); -} - void DreamBase::blank() { if (data.byte(kCommandtype) != 199) { data.byte(kCommandtype) = 199; @@ -3392,7 +3348,7 @@ void DreamGenContext::makeMainScreen() { data.byte(kManisoffscreen) = 0; } -void DreamGenContext::openInv() { +void DreamBase::openInv() { data.byte(kInvopen) = 1; printMessage(80, 58 - 10, 61, 240, (240 & 1)); fillRyan(); @@ -3403,8 +3359,8 @@ void DreamGenContext::obsThatDoThings() { if (!compare(data.byte(kCommand), data.byte(kObjecttype), "MEMB")) return; // notlouiscard - if (DreamBase::getLocation(4) != 1) { - DreamBase::setLocation(4); + if (getLocation(4) != 1) { + setLocation(4); lookAtCard(); } } @@ -3704,7 +3660,7 @@ void DreamGenContext::selectLocation() { { 280,308,4,44,&DreamGenContext::lookAtPlace }, { 104,216,138,192,&DreamGenContext::destSelect }, { 273,320,157,198,&DreamGenContext::getBack1 }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(destList); @@ -3722,7 +3678,7 @@ void DreamGenContext::selectLocation() { } -void DreamGenContext::examineInventory() { +void DreamBase::examineInventory() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; commandOnly(32); @@ -3781,13 +3737,11 @@ void DreamBase::showDiary() { showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0); } -void DreamGenContext::underTextLine() { +void DreamBase::underTextLine() { uint16 y = data.word(kTextaddressy); if (data.byte(kForeignrelease)) y -= 3; - ds = data.word(kBuffers); - si = kTextunder; - multiGet(ds.ptr(si, 0), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); + multiGet(textUnder(), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey); } void DreamGenContext::showDecisions() { @@ -3797,16 +3751,12 @@ void DreamGenContext::showDecisions() { underTextLine(); } -void DreamGenContext::getUnderZoom() { - ds = data.word(kBuffers); - si = kZoomspace; - multiGet(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40); +void DreamBase::getUnderZoom() { + multiGet(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::putUnderZoom() { - ds = data.word(kBuffers); - si = kZoomspace; - multiPut(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40); +void DreamBase::putUnderZoom() { + multiPut(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), kZoomx + 5, kZoomy + 4, 46, 40); } void DreamGenContext::showWatchReel() { @@ -3939,9 +3889,9 @@ void DreamGenContext::decide() { RectWithCallback decideList[] = { { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame }, - { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn }, + { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -3985,7 +3935,7 @@ void DreamGenContext::talk() { RectWithCallback talkList[] = { { 273,320,157,198,&DreamGenContext::getBack1 }, { 240,290,2,44,&DreamGenContext::moreTalk }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4040,7 +3990,7 @@ void DreamGenContext::discOps() { { 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 }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4058,76 +4008,12 @@ void DreamGenContext::discOps() { } while (!data.byte(kGetback)); } -void DreamGenContext::doSaveLoad() { - data.byte(kPointerframe) = 0; - data.word(kTextaddressx) = 70; - data.word(kTextaddressy) = 182-8; - data.byte(kTextlen) = 181; - data.byte(kManisoffscreen) = 1; - clearWork(); - createPanel2(); - underTextLine(); - getRidOfAll(); - loadSaveBox(); - showOpBox(); - showMainOps(); - workToScreenCPP(); - - 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 } - }; - - bool firstOps = true; - - do { // restart ops - if (firstOps) { - firstOps = false; - } else { - showOpBox(); - showMainOps(); - workToScreenM(); - } - data.byte(kGetback) = 0; - - do { // wait ops - if (data.byte(kQuitrequested)) { - data.byte(kManisoffscreen) = 0; - return; - } - - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - delPointer(); - checkCoords(opsList); - } while (!data.byte(kGetback)); - } while (data.byte(kGetback) == 2); - - data.word(kTextaddressx) = 13; - data.word(kTextaddressy) = 182; - data.byte(kTextlen) = 240; - if (data.byte(kGetback) != 4) { - getRidOfTemp(); - restoreAll(); - redrawMainScrn(); - workToScreenM(); - data.byte(kCommandtype) = 200; - } - data.byte(kManisoffscreen) = 0; -} - void DreamGenContext::hangOnPQ() { data.byte(kGetback) = 0; RectWithCallback quitList[] = { { 273,320,157,198,&DreamGenContext::getBack1 }, - { 0,320,0,200,&DreamGenContext::blank }, + { 0,320,0,200,&DreamBase::blank }, { 0xFFFF,0,0,0,0 } }; @@ -4276,7 +4162,7 @@ void DreamGenContext::cantDrop() { workToScreenM(); } -void DreamGenContext::getBack1() { +void DreamBase::getBack1() { if (data.byte(kPickup) != 0) { blank(); return; @@ -4383,7 +4269,7 @@ void DreamGenContext::autoAppear() { // In alley al = 5; resetLocation(); - DreamBase::setLocation(10); + setLocation(10); data.byte(kDestpos) = 10; return; } @@ -4414,7 +4300,7 @@ void DreamGenContext::autoAppear() { data.byte(kNewsitem) = 3; al = 6; resetLocation(); - DreamBase::setLocation(11); + setLocation(11); data.byte(kDestpos) = 11; } else { if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0) @@ -4423,7 +4309,7 @@ void DreamGenContext::autoAppear() { } } -void DreamGenContext::quitKey() { +void DreamBase::quitKey() { if (data.byte(kCommandtype) != 222) { data.byte(kCommandtype) = 222; commandOnly(4); @@ -4557,38 +4443,6 @@ void DreamGenContext::entryAnims() { } } -void DreamGenContext::selectSlot() { - if (data.byte(kCommandtype) != 244) { - data.byte(kCommandtype) = 244; - commandOnly(45); - } - - if (data.word(kMousebutton) != 1 || data.word(kMousebutton) == data.word(kOldbutton)) - return; // noselslot - if (data.byte(kLoadingorsave) == 3) - data.byte(kLoadingorsave)--; - - oldToNames(); - int y = data.word(kMousey) - (kOpsy + 4); - if (y < 11) - data.byte(kCurrentslot) = 0; - else - data.byte(kCurrentslot) = y / 11; - - delPointer(); - showOpBox(); - showSlots(); - showNames(); - if (data.byte(kLoadingorsave) == 1) - showLoadOps(); - else - showSaveOps(); - readMouse(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::updateSymbolTop() { if (!data.byte(kSymboltopdir)) return; // topfinished diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index c028c6851bf..0e407415e86 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -72,8 +72,6 @@ void getUnderTimed(); void putUnderTimed(); void dumpTextLine(); - void oldToNames(); - void namesToOld(); void startLoading(const Room &room); void showFrame(); void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { @@ -160,14 +158,12 @@ DynObject *getExAd(uint8 index) { return DreamBase::getExAd(index); } - DynObject *getEitherAdCPP(); void *getAnyAd(uint8 *value1, uint8 *value2) { return DreamBase::getAnyAd(value1, value2); } SetObject *getSetAd(uint8 index) { return DreamBase::getSetAd(index); } - void *getAnyAdDir(uint8 index, uint8 flag); void setAllChanges(); void doChange(uint8 index, uint8 value, uint8 type); void deleteTaken(); @@ -181,13 +177,12 @@ bool finishedWalkingCPP(); void finishedWalking(); void checkOne(); - void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); - void getFlagUnderP(); - void getFlagUnderP(uint8 *flag, uint8 *flagEx); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { + DreamBase::checkOne(x, y, flag, flagEx, type, flagX, flagY); + } void walkAndExamine(); void obName(); void obName(uint8 command, uint8 commandType); - void animPointer(); void checkCoords(const RectWithCallback *rectWithCallbacks); void addToPeopleList(); void addToPeopleList(ReelRoutine *routine); @@ -201,15 +196,16 @@ void checkIfPathIsOn(); bool checkIfPathIsOn(uint8 index); void isItWorn(); - bool isItWorn(const DynObject *object); + bool isItWorn(const DynObject *object) { + return DreamBase::isItWorn(object); + } void wornError(); void makeWorn(); void makeWorn(DynObject *object); void obToInv(); - void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); - void findAllRyan(); - void findAllRyan(uint8 *inv); - void fillRyan(); + void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { + DreamBase::obToInv(index, flag, x, y); + } void useRoutine(); void hangOn(); void hangOn(uint16 frameCount) { @@ -218,7 +214,9 @@ void hangOnW(); void hangOnW(uint16 frameCount); void hangOnP(); - void hangOnP(uint16 count); + void hangOnP(uint16 count) { + DreamBase::hangOnP(count); + } uint8 findNextColon(const uint8 **string) { return DreamBase::findNextColon(string); } @@ -274,15 +272,12 @@ void playChannel1(uint8 index) { DreamBase::playChannel1(index); } - void showMainOps(); - void showDiscOps(); void findRoomInLoc(); void reelsOnScreen(); void reconstruct(); void look(); void autoLook(); void doLook(); - void getBackFromOb(); void getRidOfAll(); void getRidOfTemp(); void getRidOfTempText(); @@ -351,28 +346,14 @@ void wearWatch(); void wearShades(); void checkFolderCoords(); - void loadFolder(); - void showFolder(); - void showLeftPage(); - void showRightPage(); void nextFolder(); void lastFolder(); - void folderHints(); - void folderExit(); - void getLocation(); - uint8 getLocation(uint8 index) { - return DreamBase::getLocation(index); - } void setLocation(); void setLocation(uint8 index) { DreamBase::setLocation(index); } - void loadTempText(); - void loadTempText(const char *fileName); - void loadTravelText(); void drawFloor(); void allocateBuffers(); - void workToScreenM(); bool checkSpeed(ReelRoutine &routine); void checkSpeed(); void sparkyDrip(ReelRoutine &routine); @@ -422,7 +403,6 @@ void loadSaveBox(); uint8 nextSymbol(uint8 symbol); void showSymbol(); - void examIcon(); void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); unsigned int scanForNames(); void doLoad(int slot); @@ -446,13 +426,7 @@ void clearReels(); void getRidOfReels(); void liftNoise(uint8 index); - void setTopLeft(); - void setTopRight(); - void setBotLeft(); - void setBotRight(); void newGame(); - void getBackFromOps(); - void getBackToOps(); void pickupOb(uint8 command, uint8 pos); void initialInv(); void walkIntoRoom(); @@ -469,7 +443,6 @@ void openEden(); void openSarters(); void openLouis(); - void DOSReturn(); void useLadder(); void useLadderB(); void useCart(); @@ -490,7 +463,6 @@ void hotelControl(); void obsThatDoThings(); void makeMainScreen(); - void openInv(); void delEverything(); void clearPalette(); void errorMessage1(); @@ -514,7 +486,6 @@ } void getTime(); void set16ColPalette(); - void examineInventory(); void showSaveOps(); void showLoadOps(); void watchReel(); @@ -526,9 +497,6 @@ void afterNewRoom(); void madmanRun(); void showDecisions(); - void underTextLine(); - void getUnderZoom(); - void putUnderZoom(); void decide(); void talk(); void discOps(); @@ -542,7 +510,6 @@ void checkInput(); void dropError(); void cantDrop(); - void getBack1(); void newPlace(); void showPuzText(uint16 command, uint16 count); void showPuzText(); @@ -550,7 +517,6 @@ void rollEndCredits2(); void useButtonA(); void autoAppear(); - void quitKey(); void setupTimedUse(); void entryAnims(); void triggerMessage(uint16 index);