DREAMWEB: Remove dead code and move most functions to DreamBase

This commit is contained in:
Filippos Karapetis 2011-12-26 22:09:47 +02:00
parent 0117fc415e
commit 4c66f74b58
8 changed files with 79 additions and 162 deletions

View file

@ -595,6 +595,41 @@ public:
void errorMessage2(); void errorMessage2();
void errorMessage3(); void errorMessage3();
void decide(); void decide();
void screenUpdate();
void mainScreen();
void walkAndExamine();
void autoLook();
void dumpWatch();
void watchCount();
void afterNewRoom();
void examineOb(bool examineAgain = true);
void walkIntoRoom();
void doLook();
void startup1();
void quickQuit();
void readOneBlock();
void seeCommandTail();
void quickQuit2();
void width160();
bool checkIfPerson(uint8 x, uint8 y);
bool checkIfFree(uint8 x, uint8 y);
bool checkIfEx(uint8 x, uint8 y);
void obName(uint8 command, uint8 commandType);
bool checkIfSet(uint8 x, uint8 y);
void readSetData();
void look();
void useKey();
void inventory();
void zoomOnOff();
void initialInv();
void allPointer();
void madmanRun();
void showGun();
void triggerMessage(uint16 index);
void processTrigger();
void identifyOb();
void signOn();
void searchForFiles(uint16 segment);
// from talk.cpp // from talk.cpp
void talk(); void talk();

View file

@ -233,7 +233,7 @@ void DreamBase::input() {
} }
void DreamGenContext::makeCaps() { void DreamGenContext::makeCaps() {
al = makeCaps(al); al = DreamBase::makeCaps(al);
} }
byte DreamBase::makeCaps(byte c) { byte DreamBase::makeCaps(byte c) {
@ -312,10 +312,6 @@ void DreamBase::accessLightOff() {
multiDump(74, 182, 12, 8); multiDump(74, 182, 12, 8);
} }
void DreamGenContext::randomAccess() {
randomAccess(cx);
}
void DreamBase::randomAccess(uint16 count) { void DreamBase::randomAccess(uint16 count) {
for (uint16 i = 0; i < count; ++i) { for (uint16 i = 0; i < count; ++i) {
vSync(); vSync();
@ -330,7 +326,7 @@ void DreamBase::randomAccess(uint16 count) {
} }
void DreamGenContext::monMessage() { void DreamGenContext::monMessage() {
monMessage(al); DreamBase::monMessage(al);
} }
void DreamBase::monMessage(uint8 index) { void DreamBase::monMessage(uint8 index) {
@ -551,7 +547,7 @@ void DreamGenContext::read() {
} }
} }
void DreamGenContext::signOn() { void DreamBase::signOn() {
const char *name = parser(); const char *name = parser();
int8 foundIndex = -1; int8 foundIndex = -1;
@ -609,7 +605,7 @@ void DreamGenContext::signOn() {
} }
} }
void DreamGenContext::searchForFiles(uint16 segment) { void DreamBase::searchForFiles(uint16 segment) {
const char *filesString = (const char *)getSegment(segment).ptr(kTextstart, 0); const char *filesString = (const char *)getSegment(segment).ptr(kTextstart, 0);
byte curChar; byte curChar;

View file

@ -78,10 +78,6 @@ void DreamBase::makeWorn(DynObject *object) {
object->id[1] = 'E'-'A'; object->id[1] = 'E'-'A';
} }
void DreamGenContext::obToInv() {
obToInv(al, ah, di, bx);
}
void DreamBase::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); showFrame(engine->icons1(), x - 2, y - 1, 10, 0);
if (index == 0xff) if (index == 0xff)
@ -120,7 +116,7 @@ void DreamBase::obIcons() {
showFrame(engine->icons2(), 260, 1, 1, 0); showFrame(engine->icons2(), 260, 1, 1, 0);
} }
void DreamGenContext::examineOb(bool examineAgain) { void DreamBase::examineOb(bool examineAgain) {
data.byte(kPointermode) = 0; data.byte(kPointermode) = 0;
data.word(kTimecount) = 0; data.word(kTimecount) = 0;
@ -217,7 +213,7 @@ void DreamGenContext::examineOb(bool examineAgain) {
data.byte(kOpenedob) = 255; data.byte(kOpenedob) = 255;
} }
void DreamGenContext::inventory() { void DreamBase::inventory() {
if (data.byte(kMandead) == 1 || data.word(kWatchingtime) != 0) { if (data.byte(kMandead) == 1 || data.word(kWatchingtime) != 0) {
blank(); blank();
return; return;
@ -312,7 +308,7 @@ void DreamBase::openOb() {
_openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx;
} }
void DreamGenContext::identifyOb() { void DreamBase::identifyOb() {
if (data.word(kWatchingtime) != 0) { if (data.word(kWatchingtime) != 0) {
blank(); blank();
return; return;

View file

@ -120,15 +120,6 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid
} while (true); } while (true);
} }
void DreamGenContext::printDirect() {
uint16 y = bx;
const uint8 *initialString = es.ptr(si, 0);
const uint8 *string = initialString;
al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1));
si += (string - initialString);
bx = y;
}
uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return printDirect(&string, x, &y, maxWidth, centered); return printDirect(&string, x, &y, maxWidth, centered);
} }
@ -216,7 +207,7 @@ uint16 DreamBase::waitFrames() {
void DreamGenContext::monPrint() { void DreamGenContext::monPrint() {
uint16 originalBx = bx; uint16 originalBx = bx;
const char *string = (const char *)es.ptr(bx, 0); const char *string = (const char *)es.ptr(bx, 0);
const char *nextString = monPrint(string); const char *nextString = DreamBase::monPrint(string);
bx = originalBx + (nextString - string); bx = originalBx + (nextString - string);
} }

View file

@ -651,7 +651,7 @@ bool DreamBase::quitRequested() {
return data.byte(kQuitrequested); return data.byte(kQuitrequested);
} }
void DreamGenContext::screenUpdate() { void DreamBase::screenUpdate() {
newPlace(); newPlace();
mainScreen(); mainScreen();
if (quitRequested()) if (quitRequested())
@ -722,7 +722,7 @@ void DreamBase::startup() {
atmospheres(); atmospheres();
} }
void DreamGenContext::startup1() { void DreamBase::startup1() {
clearPalette(); clearPalette();
data.byte(kThroughdoor) = 0; data.byte(kThroughdoor) = 0;
@ -789,15 +789,15 @@ void DreamBase::hangOnCurs(uint16 frameCount) {
} }
} }
void DreamGenContext::seeCommandTail() { void DreamBase::seeCommandTail() {
data.byte(kBrightness) = 1; data.byte(kBrightness) = 1;
} }
void DreamGenContext::quickQuit() { void DreamBase::quickQuit() {
engine->quit(); engine->quit();
} }
void DreamGenContext::quickQuit2() { void DreamBase::quickQuit2() {
engine->quit(); engine->quit();
} }
@ -842,7 +842,7 @@ void DreamBase::putUnderTimed() {
multiPut(_underTimedText, data.byte(kTimedx), data.byte(kTimedy), 240, kUnderTimedTextSizeY); multiPut(_underTimedText, data.byte(kTimedx), data.byte(kTimedy), 240, kUnderTimedTextSizeY);
} }
void DreamGenContext::triggerMessage(uint16 index) { void DreamBase::triggerMessage(uint16 index) {
multiGet(mapStore(), 174, 153, 200, 63); multiGet(mapStore(), 174, 153, 200, 63);
uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2);
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
@ -856,7 +856,7 @@ void DreamGenContext::triggerMessage(uint16 index) {
data.byte(kLasttrigger) = 0; data.byte(kLasttrigger) = 0;
} }
void DreamGenContext::processTrigger() { void DreamBase::processTrigger() {
if (data.byte(kLasttrigger) == '1') { if (data.byte(kLasttrigger) == '1') {
setLocation(8); setLocation(8);
triggerMessage(45); triggerMessage(45);
@ -1145,7 +1145,7 @@ void DreamBase::commandOnly(uint8 command) {
data.byte(kNewtextline) = 1; data.byte(kNewtextline) = 1;
} }
bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { bool DreamBase::checkIfPerson(uint8 x, uint8 y) {
Common::List<People>::iterator i; Common::List<People>::iterator i;
for (i = _peopleList.begin(); i != _peopleList.end(); ++i) { for (i = _peopleList.begin(); i != _peopleList.end(); ++i) {
People &people = *i; People &people = *i;
@ -1172,7 +1172,7 @@ bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
return false; return false;
} }
bool DreamGenContext::checkIfFree(uint8 x, uint8 y) { bool DreamBase::checkIfFree(uint8 x, uint8 y) {
Common::List<ObjPos>::const_iterator i; Common::List<ObjPos>::const_iterator i;
for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) { for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) {
const ObjPos &pos = *i; const ObjPos &pos = *i;
@ -1185,7 +1185,7 @@ bool DreamGenContext::checkIfFree(uint8 x, uint8 y) {
return false; return false;
} }
bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { bool DreamBase::checkIfEx(uint8 x, uint8 y) {
Common::List<ObjPos>::const_iterator i; Common::List<ObjPos>::const_iterator i;
for (i = _exList.reverse_begin(); i != _exList.end(); --i) { for (i = _exList.reverse_begin(); i != _exList.end(); --i) {
const ObjPos &pos = *i; const ObjPos &pos = *i;
@ -1393,7 +1393,7 @@ void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) {
data.byte(kLastflag) = *flag; data.byte(kLastflag) = *flag;
} }
void DreamGenContext::walkAndExamine() { void DreamBase::walkAndExamine() {
if (!finishedWalking()) if (!finishedWalking())
return; return;
data.byte(kCommandtype) = data.byte(kWalkexamtype); data.byte(kCommandtype) = data.byte(kWalkexamtype);
@ -1403,7 +1403,7 @@ void DreamGenContext::walkAndExamine() {
examineOb(); examineOb();
} }
void DreamGenContext::obName(uint8 command, uint8 commandType) { void DreamBase::obName(uint8 command, uint8 commandType) {
if (data.byte(kReasseschanges) == 0) { if (data.byte(kReasseschanges) == 0) {
if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) { if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) {
if (data.byte(kWalkandexam) == 1) { if (data.byte(kWalkandexam) == 1) {
@ -1723,7 +1723,7 @@ void DreamBase::showIcon() {
} }
} }
bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { bool DreamBase::checkIfSet(uint8 x, uint8 y) {
Common::List<ObjPos>::const_iterator i; Common::List<ObjPos>::const_iterator i;
for (i = _setList.reverse_begin(); i != _setList.end(); --i) { for (i = _setList.reverse_begin(); i != _setList.end(); --i) {
const ObjPos &pos = *i; const ObjPos &pos = *i;
@ -1862,7 +1862,7 @@ void DreamBase::enterSymbol() {
} }
} }
void DreamGenContext::zoomOnOff() { void DreamBase::zoomOnOff() {
if (data.word(kWatchingtime) != 0 || data.byte(kPointermode) == 2) { if (data.word(kWatchingtime) != 0 || data.byte(kPointermode) == 2) {
blank(); blank();
return; return;
@ -1900,7 +1900,7 @@ void DreamBase::sortOutMap() {
} }
} }
void DreamGenContext::mainScreen() { void DreamBase::mainScreen() {
data.byte(kInmaparea) = 0; data.byte(kInmaparea) = 0;
if (data.byte(kWatchon) == 1) { if (data.byte(kWatchon) == 1) {
RectWithCallback<DreamGenContext> mainList[] = { RectWithCallback<DreamGenContext> mainList[] = {
@ -1937,7 +1937,7 @@ void DreamBase::showWatch() {
} }
} }
void DreamGenContext::dumpWatch() { void DreamBase::dumpWatch() {
if (data.byte(kWatchdump) != 1) if (data.byte(kWatchdump) != 1)
return; return;
multiDump(256, 21, 40, 12); multiDump(256, 21, 40, 12);
@ -1965,7 +1965,7 @@ void DreamBase::showTime() {
showFrame(charset, 267+5, 21, 91*3+20, 0); showFrame(charset, 267+5, 21, 91*3+20, 0);
} }
void DreamGenContext::watchCount() { void DreamBase::watchCount() {
if (data.byte(kWatchon) == 0) if (data.byte(kWatchon) == 0)
return; return;
++data.byte(kTimercount); ++data.byte(kTimercount);
@ -2031,7 +2031,7 @@ void DreamBase::loadRoom() {
getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
} }
void DreamGenContext::readSetData() { void DreamBase::readSetData() {
data.word(kCharset1) = standardLoad("DREAMWEB.C00"); data.word(kCharset1) = standardLoad("DREAMWEB.C00");
void *icons1Buffer = standardLoadCPP("DREAMWEB.G00"); void *icons1Buffer = standardLoadCPP("DREAMWEB.G00");
@ -2070,7 +2070,7 @@ void DreamBase::findRoomInLoc() {
data.byte(kRoomnum) = roomNum; data.byte(kRoomnum) = roomNum;
} }
void DreamGenContext::autoLook() { void DreamBase::autoLook() {
if ((data.word(kMousex) != data.word(kOldx)) || (data.word(kMousey) != data.word(kOldy))) { if ((data.word(kMousex) != data.word(kOldx)) || (data.word(kMousey) != data.word(kOldy))) {
data.word(kLookcounter) = 1000; data.word(kLookcounter) = 1000;
return; return;
@ -2084,7 +2084,7 @@ void DreamGenContext::autoLook() {
doLook(); doLook();
} }
void DreamGenContext::look() { void DreamBase::look() {
if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) { if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) {
blank(); blank();
return; return;
@ -2097,7 +2097,7 @@ void DreamGenContext::look() {
doLook(); doLook();
} }
void DreamGenContext::doLook() { void DreamBase::doLook() {
createPanel(); createPanel();
showIcon(); showIcon();
underTextLine(); underTextLine();
@ -2721,7 +2721,7 @@ void DreamBase::pickupOb(uint8 command, uint8 pos) {
transferToEx(command); transferToEx(command);
} }
void DreamGenContext::initialInv() { void DreamBase::initialInv() {
if (data.byte(kReallocation) != 24) if (data.byte(kReallocation) != 24)
return; return;
@ -2741,7 +2741,7 @@ void DreamGenContext::initialInv() {
switchRyanOff(); switchRyanOff();
} }
void DreamGenContext::walkIntoRoom() { void DreamBase::walkIntoRoom() {
if (data.byte(kLocation) == 14 && data.byte(kMapx) == 22) { if (data.byte(kLocation) == 14 && data.byte(kMapx) == 22) {
data.byte(kDestination) = 1; data.byte(kDestination) = 1;
data.byte(kFinaldest) = 1; data.byte(kFinaldest) = 1;
@ -2785,7 +2785,7 @@ void DreamBase::blank() {
} }
} }
void DreamGenContext::allPointer() { void DreamBase::allPointer() {
readMouse(); readMouse();
showPointer(); showPointer();
dumpPointer(); dumpPointer();
@ -3050,7 +3050,7 @@ void DreamBase::watchReel() {
plotReel(reelPointer); plotReel(reelPointer);
} }
void DreamGenContext::afterNewRoom() { void DreamBase::afterNewRoom() {
if (data.byte(kNowinnewroom) == 0) if (data.byte(kNowinnewroom) == 0)
return; // notnew return; // notnew
@ -3081,7 +3081,7 @@ void DreamGenContext::afterNewRoom() {
atmospheres(); atmospheres();
} }
void DreamGenContext::madmanRun() { void DreamBase::madmanRun() {
if (data.byte(kLocation) != 14 || if (data.byte(kLocation) != 14 ||
data.byte(kMapx) != 22 || data.byte(kMapx) != 22 ||
data.byte(kPointermode) != 2 || data.byte(kPointermode) != 2 ||
@ -3147,7 +3147,7 @@ void DreamBase::decide() {
data.byte(kTextlen) = 240; data.byte(kTextlen) = 240;
} }
void DreamGenContext::showGun() { void DreamBase::showGun() {
data.byte(kAddtored) = 0; data.byte(kAddtored) = 0;
data.byte(kAddtogreen) = 0; data.byte(kAddtogreen) = 0;
data.byte(kAddtoblue) = 0; data.byte(kAddtoblue) = 0;

View file

@ -22,101 +22,22 @@
#ifndef DREAMWEB_STUBS_H #ifndef DREAMWEB_STUBS_H
#define DREAMWEB_STUBS_H #define DREAMWEB_STUBS_H
void screenUpdate(); void monMessage();
void startup1(); void monMessage(uint8 index) {
void multiGet(); DreamBase::monMessage(index);
void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) {
DreamBase::multiGet(dst, x, y, width, height);
}
void multiPut();
void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height) {
DreamBase::multiPut(src, x, y, width, height);
}
void multiDump();
void multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
DreamBase::multiDump(x, y, width, height);
}
void quickQuit();
void readOneBlock();
void seeCommandTail();
void quickQuit2();
void printDirect();
uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
return DreamBase::printDirect(string, x, y, maxWidth, centered);
}
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return DreamBase::printDirect(string, x, y, maxWidth, centered);
}
void width160();
bool checkIfPerson(uint8 x, uint8 y);
bool checkIfFree(uint8 x, uint8 y);
bool checkIfEx(uint8 x, uint8 y);
DynObject *getFreeAd(uint8 index) {
return DreamBase::getFreeAd(index);
}
DynObject *getExAd(uint8 index) {
return DreamBase::getExAd(index);
}
void *getAnyAd(uint8 *slotSize, uint8 *slotCount) {
return DreamBase::getAnyAd(slotSize, slotCount);
}
SetObject *getSetAd(uint8 index) {
return DreamBase::getSetAd(index);
}
void walkAndExamine();
void obName(uint8 command, uint8 commandType);
bool checkIfSet(uint8 x, uint8 y);
void obToInv();
void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
DreamBase::obToInv(index, flag, x, y);
}
void useRoutine();
void examineOb(bool examineAgain = true);
void dumpWatch();
void watchCount();
void readSetData();
void useMon();
void makeCaps();
byte makeCaps(byte c) {
return DreamBase::makeCaps(c);
} }
void monPrint(); void monPrint();
const char *monPrint(const char *string) { const char *monPrint(const char *string) {
return DreamBase::monPrint(string); return DreamBase::monPrint(string);
} }
void randomAccess(); void useRoutine();
void randomAccess(uint16 count) {
DreamBase::randomAccess(count);
}
void monMessage();
void monMessage(uint8 index) {
DreamBase::monMessage(index);
}
void look();
void autoLook();
void doLook();
void useKey();
void useObject(); void useObject();
void singleKey(uint8 key, uint16 x, uint16 y); void makeCaps();
void inventory(); void useMon();
void mainScreen();
void zoomOnOff();
void initialInv();
void walkIntoRoom();
void allPointer();
void afterNewRoom();
void madmanRun();
void showGun();
void triggerMessage(uint16 index);
void processTrigger();
bool execCommand();
void identifyOb();
void selectOb(); void selectOb();
void getKeyAndLogo(); bool execCommand();
void signOn();
void searchForFiles(uint16 segment);
void read(); void read();
void dirCom(); void dirCom();
void getKeyAndLogo();
#endif #endif

View file

@ -1494,7 +1494,7 @@ void DreamBase::useAxe() {
removeObFromInv(); removeObFromInv();
} }
void DreamGenContext::useKey() { void DreamBase::useKey() {
switch(data.byte(kLocation)) { switch(data.byte(kLocation)) {
case 5: case 5:
case 30: case 30:
@ -1512,7 +1512,6 @@ void DreamGenContext::useKey() {
if (data.byte(kMapx) == 11 && data.byte(kMapy) == 10) { if (data.byte(kMapx) == 11 && data.byte(kMapy) == 10) {
showPuzText(3, 300); showPuzText(3, 300);
data.byte(kNewlocation) = 30; data.byte(kNewlocation) = 30;
al = 2;
fadeScreenDown(); fadeScreenDown();
showFirstUse(); showFirstUse();
putBackObStuff(); putBackObStuff();

View file

@ -27,13 +27,6 @@
namespace DreamGen { namespace DreamGen {
void DreamGenContext::multiGet() {
multiGet(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) { void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320); assert(x < 320);
assert(y < 200); assert(y < 200);
@ -50,13 +43,6 @@ void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
} }
} }
void DreamGenContext::multiPut() {
multiPut(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) { void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320); assert(x < 320);
assert(y < 200); assert(y < 200);
@ -73,13 +59,6 @@ void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h)
} }
} }
void DreamGenContext::multiDump() {
multiDump(di, bx, cl, ch);
unsigned offset = di + bx * kScreenwidth;
si = di = offset + ch * kScreenwidth;
cx = 0;
}
void DreamBase::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) { void DreamBase::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
unsigned offset = x + y * kScreenwidth; unsigned offset = x + y * kScreenwidth;
//debug(1, "multiDump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset); //debug(1, "multiDump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset);