DREAMWEB: Fix compilation due to dreamgen.* function renaming.

This commit is contained in:
D G Turner 2011-12-01 19:43:43 +00:00
parent d1144963da
commit 349cbc527f
15 changed files with 1817 additions and 1834 deletions

View file

@ -24,7 +24,7 @@
namespace DreamGen {
void DreamGenContext::doblocks() {
void DreamGenContext::doBlocks() {
uint16 dstOffset = data.word(kMapady) * 320 + data.word(kMapadx);
uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx);
const uint8 *mapData = segRef(data.word(kMapdata)).ptr(mapOffset, 0);
@ -63,7 +63,7 @@ void DreamGenContext::doblocks() {
}
}
uint8 DreamGenContext::getxad(const uint8 *setData, uint8 *result) {
uint8 DreamGenContext::getXAd(const uint8 *setData, uint8 *result) {
uint8 v0 = setData[0];
uint8 v1 = setData[1];
uint8 v2 = setData[2];
@ -78,7 +78,7 @@ uint8 DreamGenContext::getxad(const uint8 *setData, uint8 *result) {
return 1;
}
uint8 DreamGenContext::getyad(const uint8 *setData, uint8 *result) {
uint8 DreamGenContext::getYAd(const uint8 *setData, uint8 *result) {
uint8 v0 = setData[3];
uint8 v1 = setData[4];
if (v0 < data.byte(kMapy))
@ -90,29 +90,29 @@ uint8 DreamGenContext::getyad(const uint8 *setData, uint8 *result) {
return 1;
}
void DreamGenContext::getmapad() {
ch = getmapad((const uint8 *)es.ptr(si, 5));
void DreamGenContext::getMapAd() {
ch = getMapAd((const uint8 *)es.ptr(si, 5));
}
uint8 DreamGenContext::getmapad(const uint8 *setData) {
uint8 DreamGenContext::getMapAd(const uint8 *setData) {
uint8 xad, yad;
if (getxad(setData, &xad) == 0)
if (getXAd(setData, &xad) == 0)
return 0;
data.word(kObjectx) = xad;
if (getyad(setData, &yad) == 0)
if (getYAd(setData, &yad) == 0)
return 0;
data.word(kObjecty) = yad;
return 1;
}
void DreamGenContext::calcfrframe() {
void DreamGenContext::calcFrFrame() {
uint8 width, height;
calcfrframe(&width, &height);
calcFrFrame(&width, &height);
cl = width;
ch = height;
}
void DreamGenContext::calcfrframe(uint8* width, uint8* height) {
void DreamGenContext::calcFrFrame(uint8* width, uint8* height) {
const Frame *frame = (const Frame *)segRef(data.word(kFrsegment)).ptr(data.word(kCurrentframe) * sizeof(Frame), sizeof(Frame));
data.word(kSavesource) = data.word(kFramesad) + frame->ptr();
data.byte(kSavesize+0) = frame->width;
@ -123,21 +123,21 @@ void DreamGenContext::calcfrframe(uint8* width, uint8* height) {
*height = frame->height;
}
void DreamGenContext::finalframe() {
void DreamGenContext::finalFrame() {
uint16 x, y;
finalframe(&x, &y);
finalFrame(&x, &y);
di = x;
bx = y;
}
void DreamGenContext::finalframe(uint16 *x, uint16 *y) {
void DreamGenContext::finalFrame(uint16 *x, uint16 *y) {
data.byte(kSavex) = (data.word(kObjectx) + data.word(kOffsetx)) & 0xff;
data.byte(kSavey) = (data.word(kObjecty) + data.word(kOffsety)) & 0xff;
*x = data.word(kObjectx);
*y = data.word(kObjecty);
}
void DreamGenContext::showallobs() {
void DreamGenContext::showAllObs() {
data.word(kListpos) = kSetlist;
memset(segRef(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5);
data.word(kFrsegment) = data.word(kSetframes);
@ -148,22 +148,22 @@ void DreamGenContext::showallobs() {
SetObject *setEntries = (SetObject *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject));
for (size_t i = 0; i < 128; ++i) {
SetObject *setEntry = setEntries + i;
if (getmapad(setEntry->mapad) == 0)
if (getMapAd(setEntry->mapad) == 0)
continue;
uint8 currentFrame = setEntry->frames[0];
data.word(kCurrentframe) = currentFrame;
if (currentFrame == 0xff)
continue;
calcfrframe();
calcFrFrame();
uint16 x, y;
finalframe(&x, &y);
finalFrame(&x, &y);
setEntry->index = setEntry->frames[0];
if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) {
x += data.word(kMapadx);
y += data.word(kMapady);
showframe(frames, x, y, data.word(kCurrentframe), 0);
showFrame(frames, x, y, data.word(kCurrentframe), 0);
} else
makebackob(setEntry);
makeBackOb(setEntry);
ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
objPos->xMin = data.byte(kSavex);
@ -175,18 +175,17 @@ void DreamGenContext::showallobs() {
}
}
void DreamGenContext::getdimension()
{
void DreamGenContext::getDimension() {
uint8 mapXstart, mapYstart;
uint8 mapXsize, mapYsize;
getdimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
cl = mapXstart;
ch = mapYstart;
dl = mapXsize;
dh = mapYsize;
}
bool DreamGenContext::addalong(const uint8 *mapFlags) {
bool DreamGenContext::addAlong(const uint8 *mapFlags) {
for (size_t i = 0; i < 11; ++i) {
if (mapFlags[3 * i] != 0)
return true;
@ -194,7 +193,7 @@ bool DreamGenContext::addalong(const uint8 *mapFlags) {
return false;
}
bool DreamGenContext::addlength(const uint8 *mapFlags) {
bool DreamGenContext::addLength(const uint8 *mapFlags) {
for (size_t i = 0; i < 10; ++i) {
if (mapFlags[3 * 11 * i] != 0)
return true;
@ -202,23 +201,23 @@ bool DreamGenContext::addlength(const uint8 *mapFlags) {
return false;
}
void DreamGenContext::getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) {
void DreamGenContext::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) {
const uint8 *mapFlags = segRef(data.word(kBuffers)).ptr(kMapflags, 0);
uint8 yStart = 0;
while (! addalong(mapFlags + 3 * 11 * yStart))
while (! addAlong(mapFlags + 3 * 11 * yStart))
++yStart;
uint8 xStart = 0;
while (! addlength(mapFlags + 3 * xStart))
while (! addLength(mapFlags + 3 * xStart))
++xStart;
uint8 yEnd = 10;
while (! addalong(mapFlags + 3 * 11 * (yEnd - 1)))
while (! addAlong(mapFlags + 3 * 11 * (yEnd - 1)))
--yEnd;
uint8 xEnd = 11;
while (! addlength(mapFlags + 3 * (xEnd - 1)))
while (! addLength(mapFlags + 3 * (xEnd - 1)))
--xEnd;
*mapXstart = xStart;
@ -231,15 +230,15 @@ void DreamGenContext::getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *ma
data.byte(kMapysize) = *mapYsize << 4;
}
void DreamGenContext::calcmapad() {
void DreamGenContext::calcMapAd() {
uint8 mapXstart, mapYstart;
uint8 mapXsize, mapYsize;
getdimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
data.word(kMapadx) = data.word(kMapoffsetx) - 8 * (mapXsize + 2 * mapXstart - 11);
data.word(kMapady) = data.word(kMapoffsety) - 8 * (mapYsize + 2 * mapYstart - 10);
}
void DreamGenContext::showallfree() {
void DreamGenContext::showAllFree() {
data.word(kListpos) = kFreelist;
ObjPos *listPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
memset(listPos, 0xff, 80 * sizeof(ObjPos));
@ -250,17 +249,17 @@ void DreamGenContext::showallfree() {
data.byte(kCurrentfree) = 0;
const DynObject *freeObjects = (const DynObject *)segRef(data.word(kFreedat)).ptr(0, 0);
for(size_t i = 0; i < 80; ++i) {
uint8 mapad = getmapad(freeObjects[i].mapad);
if (mapad != 0) {
uint8 mapAd = getMapAd(freeObjects[i].mapad);
if (mapAd != 0) {
data.word(kCurrentframe) = 3 * data.byte(kCurrentfree);
uint8 width, height;
calcfrframe(&width, &height);
calcFrFrame(&width, &height);
uint16 x, y;
finalframe(&x, &y);
finalFrame(&x, &y);
if ((width != 0) || (height != 0)) {
x += data.word(kMapadx);
y += data.word(kMapady);
showframe((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x, y, data.word(kCurrentframe) & 0xff, 0);
showFrame((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x, y, data.word(kCurrentframe) & 0xff, 0);
ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
objPos->xMin = data.byte(kSavex);
objPos->yMin = data.byte(kSavey);
@ -275,7 +274,7 @@ void DreamGenContext::showallfree() {
}
}
void DreamGenContext::drawflags() {
void DreamGenContext::drawFlags() {
uint8 *mapFlags = segRef(data.word(kBuffers)).ptr(kMapflags, 0);
const uint8 *mapData = segRef(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0);
const uint8 *backdropFlags = segRef(data.word(kBackdrop)).ptr(kFlags, 0);
@ -291,7 +290,7 @@ void DreamGenContext::drawflags() {
}
}
void DreamGenContext::showallex() {
void DreamGenContext::showAllEx() {
data.word(kListpos) = kExlist;
memset(segRef(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5);
@ -306,15 +305,15 @@ void DreamGenContext::showallex() {
continue;
if (object->currentLocation != data.byte(kReallocation))
continue;
if (getmapad(object->mapad) == 0)
if (getMapAd(object->mapad) == 0)
continue;
data.word(kCurrentframe) = 3 * data.byte(kCurrentex);
uint8 width, height;
calcfrframe(&width, &height);
calcFrFrame(&width, &height);
uint16 x, y;
finalframe(&x, &y);
finalFrame(&x, &y);
if ((width != 0) || (height != 0)) {
showframe((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), data.word(kCurrentframe) & 0xff, 0);
showFrame((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), data.word(kCurrentframe) & 0xff, 0);
ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
objPos->xMin = data.byte(kSavex);
objPos->yMin = data.byte(kSavey);

View file

@ -93,8 +93,8 @@ void DreamWebEngine::waitForVSync() {
setVSyncInterrupt(false);
}
_context.doshake();
_context.dofade();
_context.doShake();
_context.doFade();
_system->updateScreen();
}
@ -203,7 +203,6 @@ void DreamWebEngine::processEvents() {
}
}
Common::Error DreamWebEngine::run() {
syncSoundSettings();
_console = new DreamWebConsole(this);
@ -289,7 +288,6 @@ uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) {
return _inSaveFile->read(data, size);
}
void DreamWebEngine::keyPressed(uint16 ascii) {
debug(2, "key pressed = %04x", ascii);
uint8* keybuf = _context.data.ptr(5912, 16); //fixme: some hardcoded offsets are not added as consts
@ -365,7 +363,6 @@ void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
_system->getPaletteManager()->setPalette(fixed, start, count);
}
void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) {
if (y + h > 200)
h = 200 - y;
@ -485,11 +482,10 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) {
return true;
}
void DreamWebEngine::soundHandler() {
_context.data.byte(_context.kSubtitles) = ConfMan.getBool("subtitles");
_context.push(_context.ax);
_context.volumeadjust();
_context.volumeAdjust();
_context.ax = _context.pop();
uint volume = _context.data.byte(DreamGen::DreamGenContext::kVolume);

View file

@ -24,12 +24,12 @@
namespace DreamGen {
void DreamGenContext::getundermenu() {
multiget(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
void DreamGenContext::getUnderMenu() {
multiGet(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
}
void DreamGenContext::putundermenu() {
multiput(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
void DreamGenContext::putUnderMenu() {
multiPut(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
}
} /*namespace dreamgen */

View file

@ -30,7 +30,7 @@ struct MonitorKeyEntry {
char b2[24];
};
void DreamGenContext::usemon() {
void DreamGenContext::useMon() {
data.byte(kLasttrigger) = 0;
memset(cs.ptr(kCurrentfile+1, 0), ' ', 12);
memset(cs.ptr(offset_operand1+1, 0), ' ', 12);
@ -41,33 +41,33 @@ void DreamGenContext::usemon() {
monitorKeyEntries[2].b0 = 0;
monitorKeyEntries[3].b0 = 0;
createpanel();
showpanel();
showicon();
drawfloor();
getridofall();
loadintotemp("DREAMWEB.G03");
loadpersonal();
loadnews();
loadcart();
loadtempcharset("DREAMWEB.C01");
printoutermon();
initialmoncols();
printlogo();
worktoscreen();
turnonpower();
fadeupyellows();
fadeupmonfirst();
createPanel();
showPanel();
showIcon();
drawFloor();
getRidOfAll();
loadIntoTemp("DREAMWEB.G03");
loadPersonal();
loadNews();
loadCart();
loadTempCharset("DREAMWEB.C01");
printOuterMon();
initialMonCols();
printLogo();
workToScreen();
turnOnPower();
fadeupYellows();
fadeupMonFirst();
data.word(kMonadx) = 76;
data.word(kMonady) = 141;
monmessage(1);
hangoncurs(120);
monmessage(2);
randomaccess(60);
monmessage(3);
hangoncurs(100);
printlogo();
scrollmonitor();
monMessage(1);
hangOnCurs(120);
monMessage(2);
randomAccess(60);
monMessage(3);
hangOnCurs(100);
printLogo();
scrollMonitor();
data.word(kBufferin) = 0;
data.word(kBufferout) = 0;
do {
@ -80,42 +80,42 @@ void DreamGenContext::usemon() {
di = pop();
data.word(kMonadx) = di;
data.word(kMonady) = bx;
execcommand();
execCommand();
if (quitRequested()) //TODO : Check why it crashes when put before the execcommand
break;
} while (al == 0);
getridoftemp();
getridoftempcharset();
deallocatemem(data.word(kTextfile1));
deallocatemem(data.word(kTextfile2));
deallocatemem(data.word(kTextfile3));
getRidOfTemp();
getRidOfTempCharset();
deallocateMem(data.word(kTextfile1));
deallocateMem(data.word(kTextfile2));
deallocateMem(data.word(kTextfile3));
data.byte(kGetback) = 1;
playchannel1(26);
playChannel1(26);
data.byte(kManisoffscreen) = 0;
restoreall();
redrawmainscrn();
worktoscreenm();
restoreAll();
redrawMainScrn();
workToScreenM();
}
void DreamGenContext::printlogo() {
showframe(tempGraphics(), 56, 32, 0, 0);
showcurrentfile();
void DreamGenContext::printLogo() {
showFrame(tempGraphics(), 56, 32, 0, 0);
showCurrentFile();
}
void DreamGenContext::input() {
char *inputLine = (char *)cs.ptr(kInputline, 64);
memset(inputLine, 0, 64);
data.word(kCurpos) = 0;
printchar(tempCharset(), data.word(kMonadx), data.word(kMonady), '>', 0, NULL, NULL);
multidump(data.word(kMonadx), data.word(kMonady), 6, 8);
printChar(tempCharset(), data.word(kMonadx), data.word(kMonady), '>', 0, NULL, NULL);
multiDump(data.word(kMonadx), data.word(kMonady), 6, 8);
data.word(kMonadx) += 6;
data.word(kCurslocx) = data.word(kMonadx);
data.word(kCurslocy) = data.word(kMonady);
while (true) {
printcurs();
vsync();
delcurs();
readkey();
printCurs();
vSync();
delCurs();
readKey();
if (quitRequested())
return;
uint8 currentKey = data.byte(kCurrentkey);
@ -125,7 +125,7 @@ void DreamGenContext::input() {
return;
if (currentKey == 8) {
if (data.word(kCurpos) > 0)
delchar();
delChar();
continue;
}
if (data.word(kCurpos) == 28)
@ -133,14 +133,14 @@ void DreamGenContext::input() {
if ((currentKey == 32) && (data.word(kCurpos) == 0))
continue;
al = currentKey;
makecaps();
makeCaps();
currentKey = al;
inputLine[data.word(kCurpos) * 2 + 0] = currentKey;
if (currentKey > 'Z')
continue;
multiget(segRef(data.word(kMapstore)).ptr(data.word(kCurpos) * 256, 0), data.word(kMonadx), data.word(kMonady), 8, 8);
multiGet(segRef(data.word(kMapstore)).ptr(data.word(kCurpos) * 256, 0), data.word(kMonadx), data.word(kMonady), 8, 8);
uint8 charWidth;
printchar(tempCharset(), data.word(kMonadx), data.word(kMonady), currentKey, 0, &charWidth, NULL);
printChar(tempCharset(), data.word(kMonadx), data.word(kMonady), currentKey, 0, &charWidth, NULL);
inputLine[data.word(kCurpos) * 2 + 1] = charWidth;
data.word(kMonadx) += charWidth;
++data.word(kCurpos);
@ -148,7 +148,7 @@ void DreamGenContext::input() {
}
}
void DreamGenContext::printcurs() {
void DreamGenContext::printCurs() {
uint16 x = data.word(kCurslocx);
uint16 y = data.word(kCurslocy);
uint16 height;
@ -157,14 +157,14 @@ void DreamGenContext::printcurs() {
height = 11;
} else
height = 8;
multiget(textUnder(), x, y, 6, height);
multiGet(textUnder(), x, y, 6, height);
++data.word(kMaintimer);
if ((data.word(kMaintimer) & 16) == 0)
showframe(tempCharset(), x, y, '/' - 32, 0);
multidump(x - 6, y, 12, height);
showFrame(tempCharset(), x, y, '/' - 32, 0);
multiDump(x - 6, y, 12, height);
}
void DreamGenContext::delcurs() {
void DreamGenContext::delCurs() {
uint16 x = data.word(kCurslocx);
uint16 y = data.word(kCurslocy);
uint16 width = 6;
@ -174,95 +174,95 @@ void DreamGenContext::delcurs() {
height = 11;
} else
height = 8;
multiput(textUnder(), x, y, width, height);
multidump(x, y, width, height);
multiPut(textUnder(), x, y, width, height);
multiDump(x, y, width, height);
}
void DreamGenContext::hangoncurs() {
hangoncurs(cx);
void DreamGenContext::hangOnCurs() {
hangOnCurs(cx);
}
void DreamGenContext::scrollmonitor() {
printlogo();
printundermon();
void DreamGenContext::scrollMonitor() {
printLogo();
printUnderMon();
workToScreenCPP();
playchannel1(25);
playChannel1(25);
}
void DreamGenContext::showcurrentfile() {
void DreamGenContext::showCurrentFile() {
uint16 x = 178; // TODO: Looks like this hardcoded constant in the asm doesn't match the frame
const char *currentFile = (const char *)cs.ptr(kCurrentfile+1, 0);
while (*currentFile) {
char c = *currentFile++;
c = engine->modifyChar(c);
printchar(tempCharset(), &x, 37, c, 0, NULL, NULL);
printChar(tempCharset(), &x, 37, c, 0, NULL, NULL);
}
}
void DreamGenContext::accesslighton() {
showframe(tempGraphics(), 74, 182, 8, 0);
multidump(74, 182, 12, 8);
void DreamGenContext::accessLightOn() {
showFrame(tempGraphics(), 74, 182, 8, 0);
multiDump(74, 182, 12, 8);
}
void DreamGenContext::accesslightoff() {
showframe(tempGraphics(), 74, 182, 7, 0);
multidump(74, 182, 12, 8);
void DreamGenContext::accessLightOff() {
showFrame(tempGraphics(), 74, 182, 7, 0);
multiDump(74, 182, 12, 8);
}
void DreamGenContext::randomaccess() {
randomaccess(cx);
void DreamGenContext::randomAccess() {
randomAccess(cx);
}
void DreamGenContext::randomaccess(uint16 count) {
void DreamGenContext::randomAccess(uint16 count) {
for (uint16 i = 0; i < count; ++i) {
vsync();
vsync();
vSync();
vSync();
uint16 v = engine->randomNumber() & 15;
if (v < 10)
accesslightoff();
accessLightOff();
else
accesslighton();
accessLightOn();
}
accesslightoff();
accessLightOff();
}
void DreamGenContext::monmessage() {
monmessage(al);
void DreamGenContext::monMessage() {
monMessage(al);
}
void DreamGenContext::monmessage(uint8 index) {
void DreamGenContext::monMessage(uint8 index) {
assert(index > 0);
const char *string = (const char *)segRef(data.word(kTextfile1)).ptr(kTextstart, 0);
for (uint8 i = 0; i < index; ++i) {
while (*string++ != '+') {
}
}
monprint(string);
monPrint(string);
}
void DreamGenContext::neterror() {
monmessage(5);
scrollmonitor();
void DreamGenContext::netError() {
monMessage(5);
scrollMonitor();
}
void DreamGenContext::powerlighton() {
showframe(tempGraphics(), 257+4, 182, 6, 0);
multidump(257+4, 182, 12, 8);
void DreamGenContext::powerLightOn() {
showFrame(tempGraphics(), 257+4, 182, 6, 0);
multiDump(257+4, 182, 12, 8);
}
void DreamGenContext::powerlightoff() {
showframe(tempGraphics(), 257+4, 182, 5, 0);
multidump(257+4, 182, 12, 8);
void DreamGenContext::powerLightOff() {
showFrame(tempGraphics(), 257+4, 182, 5, 0);
multiDump(257+4, 182, 12, 8);
}
void DreamGenContext::turnonpower() {
void DreamGenContext::turnOnPower() {
for (size_t i = 0; i < 3; ++i) {
powerlighton();
hangon(30);
powerlightoff();
hangon(30);
powerLightOn();
hangOn(30);
powerLightOff();
hangOn(30);
}
powerlighton();
powerLightOn();
}

View file

@ -24,71 +24,71 @@
namespace DreamGen {
void DreamGenContext::fillryan() {
void DreamGenContext::fillRyan() {
uint8 *inv = segRef(data.word(kBuffers)).ptr(kRyaninvlist, 60);
findallryan(inv);
findAllRyan(inv);
inv += data.byte(kRyanpage) * 2 * 10;
for (size_t i = 0; i < 2; ++i) {
for (size_t j = 0; j < 5; ++j) {
uint8 objIndex = *inv++;
uint8 objType = *inv++;
obtoinv(objIndex, objType, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
obToInv(objIndex, objType, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
}
}
showryanpage();
showRyanPage();
}
void DreamGenContext::isitworn() {
flags._z = isitworn((const DynObject *)es.ptr(bx, sizeof(DynObject)));
void DreamGenContext::isItWorn() {
flags._z = isItWorn((const DynObject *)es.ptr(bx, sizeof(DynObject)));
}
bool DreamGenContext::isitworn(const DynObject *object) {
bool DreamGenContext::isItWorn(const DynObject *object) {
return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A');
}
void DreamGenContext::wornerror() {
void DreamGenContext::wornError() {
data.byte(kCommandtype) = 255;
delpointer();
printmessage(76, 21, 57, 240, false);
worktoscreenm();
hangonp(50);
showpanel();
showman();
examicon();
delPointer();
printMessage(76, 21, 57, 240, false);
workToScreenM();
hangOnP(50);
showPanel();
showMan();
examIcon();
data.byte(kCommandtype) = 255;
worktoscreenm();
workToScreenM();
}
void DreamGenContext::makeworn() {
makeworn((DynObject *)es.ptr(bx, sizeof(DynObject)));
void DreamGenContext::makeWorn() {
makeWorn((DynObject *)es.ptr(bx, sizeof(DynObject)));
}
void DreamGenContext::makeworn(DynObject *object) {
void DreamGenContext::makeWorn(DynObject *object) {
object->id[0] = 'W'-'A';
object->id[1] = 'E'-'A';
}
void DreamGenContext::obtoinv() {
obtoinv(al, ah, di, bx);
void DreamGenContext::obToInv() {
obToInv(al, ah, di, bx);
}
void DreamGenContext::obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y) {
void DreamGenContext::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0);
showframe(icons1, x - 2, y - 1, 10, 0);
showFrame(icons1, x - 2, y - 1, 10, 0);
if (index == 0xff)
return;
Frame *extras = (Frame *)segRef(data.word(kExtras)).ptr(0, 0);
Frame *frees = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0);
Frame *frames = (flag == 4) ? extras : frees;
showframe(frames, x + 18, y + 19, 3 * index + 1, 128);
const DynObject *object = (const DynObject *)getanyaddir(index, flag);
bool worn = isitworn(object);
showFrame(frames, x + 18, y + 19, 3 * index + 1, 128);
const DynObject *object = (const DynObject *)getAnyAdDir(index, flag);
bool worn = isItWorn(object);
if (worn)
showframe(icons1, x - 3, y - 2, 7, 0);
showFrame(icons1, x - 3, y - 2, 7, 0);
}
void DreamGenContext::obpicture() {
void DreamGenContext::obPicture() {
if (data.byte(kObjecttype) == 1)
return;
Frame *frames;
@ -97,21 +97,21 @@ void DreamGenContext::obpicture() {
else
frames = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0);
uint8 frame = 3 * data.byte(kCommand) + 1;
showframe(frames, 160, 68, frame, 0x80);
showFrame(frames, 160, 68, frame, 0x80);
}
void DreamGenContext::obicons() {
void DreamGenContext::obIcons() {
uint8 value1, value2;
getanyad(&value1, &value2);
getAnyAd(&value1, &value2);
if (value1 != 0xff) {
// can open it
showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 210, 1, 4, 0);
showFrame((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 210, 1, 4, 0);
}
showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0);
showFrame((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0);
}
void DreamGenContext::examineob(bool examineAgain) {
void DreamGenContext::examineOb(bool examineAgain) {
data.byte(kPointermode) = 0;
data.word(kTimecount) = 0;
while (true) {
@ -125,66 +125,66 @@ void DreamGenContext::examineob(bool examineAgain) {
data.byte(kObjecttype) = al;
data.byte(kItemframe) = 0;
data.byte(kPointerframe) = 0;
createpanel();
showpanel();
showman();
showexit();
obicons();
obpicture();
describeob();
undertextline();
createPanel();
showPanel();
showMan();
showExit();
obIcons();
obPicture();
describeOb();
underTextLine();
data.byte(kCommandtype) = 255;
readmouse();
showpointer();
worktoscreen();
delpointer();
readMouse();
showPointer();
workToScreen();
delPointer();
examineAgain = false;
}
readmouse();
showpointer();
vsync();
dumppointer();
dumptextline();
delpointer();
readMouse();
showPointer();
vSync();
dumpPointer();
dumpTextLine();
delPointer();
data.byte(kGetback) = 0;
switch (data.byte(kInvopen)) {
case 0: {
RectWithCallback examlist[] = {
{ 273,320,157,198,&DreamGenContext::getbackfromob },
{ 260,300,0,44,&DreamGenContext::useobject },
{ 210,254,0,44,&DreamGenContext::selectopenob },
{ 144,176,64,96,&DreamGenContext::setpickup },
{ 0,50,50,200,&DreamGenContext::examinventory },
RectWithCallback examList[] = {
{ 273,320,157,198,&DreamGenContext::getBackFromOb },
{ 260,300,0,44,&DreamGenContext::useObject },
{ 210,254,0,44,&DreamGenContext::selectOpenOb },
{ 144,176,64,96,&DreamGenContext::setPickup },
{ 0,50,50,200,&DreamGenContext::examineInventory },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
checkcoords(examlist);
checkCoords(examList);
break;
}
case 1: {
// NB: This table contains the non-constant openchangesize!
RectWithCallback invlist1[] = {
{ 273,320,157,198,&DreamGenContext::getbackfromob },
{ 255,294,0,24,&DreamGenContext::dropobject },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage },
{ kInventx, cs.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useopened },
{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::intoinv },
// NB: This table contains the non-constant openChangeSize!
RectWithCallback invList1[] = {
{ 273,320,157,198,&DreamGenContext::getBackFromOb },
{ 255,294,0,24,&DreamGenContext::dropObject },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
{ kInventx, cs.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
checkcoords(invlist1);
checkCoords(invList1);
break;
}
default: {
RectWithCallback withlist1[] = {
{ 273,320,157,198,&DreamGenContext::getbackfromob },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage },
{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectob },
RectWithCallback withList1[] = {
{ 273,320,157,198,&DreamGenContext::getBackFromOb },
{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectOb },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
checkcoords(withlist1);
checkCoords(withList1);
break;
}
}
@ -198,8 +198,8 @@ void DreamGenContext::examineob(bool examineAgain) {
data.byte(kPickup) = 0;
if (data.word(kWatchingtime) != 0 || data.byte(kNewlocation) == 255) {
// iswatching
makemainscreen();
// isWatching
makeMainScreen();
}
data.byte(kInvopen) = 0;
@ -215,7 +215,7 @@ void DreamGenContext::inventory() {
if (data.byte(kCommandtype) != 239) {
data.byte(kCommandtype) = 239;
al = 32;
commandonly();
commandOnly();
}
if (data.word(kMousebutton) == data.word(kOldbutton))
@ -227,25 +227,25 @@ void DreamGenContext::inventory() {
data.word(kTimecount) = 0;
data.byte(kPointermode) = 0;
data.byte(kInmaparea) = 0;
animpointer();
createpanel();
showpanel();
examicon();
showman();
showexit();
undertextline();
animPointer();
createPanel();
showPanel();
examIcon();
showMan();
showExit();
underTextLine();
data.byte(kPickup) = 0;
data.byte(kInvopen) = 2;
openinv();
readmouse();
showpointer();
worktoscreen();
delpointer();
openInv();
readMouse();
showPointer();
workToScreen();
delPointer();
data.byte(kOpenedob) = 255;
examineob(false);
examineOb(false);
}
void DreamGenContext::transfertext() {
void DreamGenContext::transferText() {
segRef(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos);
uint16 freeTextOffset = data.byte(kItemtotran) * 2;
uint16 srcOffset = segRef(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset);
@ -257,9 +257,9 @@ void DreamGenContext::transfertext() {
data.word(kExtextpos) += len + 1;
}
void DreamGenContext::getbackfromob() {
void DreamGenContext::getBackFromOb() {
if (data.byte(kPickup) != 1)
getback1();
getBack1();
else
blank();
}

View file

@ -24,62 +24,61 @@
namespace DreamGen {
void DreamGenContext::turnpathon() {
turnpathon(al);
void DreamGenContext::turnPathOn() {
turnPathOn(al);
}
void DreamGenContext::turnpathon(uint8 param) {
findormake(param, 0xff, data.byte(kRoomnum) + 100);
PathNode *roomsPaths = getroomspaths()->nodes;
void DreamGenContext::turnPathOn(uint8 param) {
findOrMake(param, 0xff, data.byte(kRoomnum) + 100);
PathNode *roomsPaths = getRoomsPaths()->nodes;
if (param == 0xff)
return;
roomsPaths[param].on = 0xff;
}
void DreamGenContext::turnpathoff() {
turnpathoff(al);
void DreamGenContext::turnPathOff() {
turnPathOff(al);
}
void DreamGenContext::turnpathoff(uint8 param) {
findormake(param, 0x00, data.byte(kRoomnum) + 100);
PathNode *roomsPaths = getroomspaths()->nodes;
void DreamGenContext::turnPathOff(uint8 param) {
findOrMake(param, 0x00, data.byte(kRoomnum) + 100);
PathNode *roomsPaths = getRoomsPaths()->nodes;
if (param == 0xff)
return;
roomsPaths[param].on = 0x00;
}
void DreamGenContext::turnanypathon(uint8 param, uint8 room) {
findormake(param, 0xff, room + 100);
void DreamGenContext::turnAnyPathOn(uint8 param, uint8 room) {
findOrMake(param, 0xff, room + 100);
PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].on = 0xff;
}
void DreamGenContext::turnanypathon() {
turnanypathon(al, ah);
void DreamGenContext::turnAnyPathOn() {
turnAnyPathOn(al, ah);
}
void DreamGenContext::turnanypathoff(uint8 param, uint8 room) {
findormake(param, 0x00, room + 100);
void DreamGenContext::turnAnyPathOff(uint8 param, uint8 room) {
findOrMake(param, 0x00, room + 100);
PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].on = 0x00;
}
void DreamGenContext::turnanypathoff() {
turnanypathoff(al, ah);
void DreamGenContext::turnAnyPathOff() {
turnAnyPathOff(al, ah);
}
RoomPaths *DreamGenContext::getroomspaths() {
RoomPaths *DreamGenContext::getRoomsPaths() {
void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
return (RoomPaths *)result;
}
void DreamGenContext::autosetwalk() {
void DreamGenContext::autoSetWalk() {
al = data.byte(kManspath);
if (data.byte(kFinaldest) == al)
return;
const RoomPaths *roomsPaths = getroomspaths();
checkdest(roomsPaths);
const RoomPaths *roomsPaths = getRoomsPaths();
checkDest(roomsPaths);
data.word(kLinestartx) = roomsPaths->nodes[data.byte(kManspath)].x - 12;
data.word(kLinestarty) = roomsPaths->nodes[data.byte(kManspath)].y - 12;
data.word(kLineendx) = roomsPaths->nodes[data.byte(kDestination)].x - 12;
@ -93,7 +92,7 @@ void DreamGenContext::autosetwalk() {
data.byte(kLinepointer) = 0;
}
void DreamGenContext::checkdest(const RoomPaths *roomsPaths) {
void DreamGenContext::checkDest(const RoomPaths *roomsPaths) {
const PathSegment *segments = roomsPaths->segments;
ah = data.byte(kManspath) << 4;
al = data.byte(kDestination);
@ -114,24 +113,24 @@ void DreamGenContext::checkdest(const RoomPaths *roomsPaths) {
data.byte(kDestination) = destination;
}
void DreamGenContext::findxyfrompath() {
const PathNode *roomsPaths = getroomspaths()->nodes;
void DreamGenContext::findXYFromPath() {
const PathNode *roomsPaths = getRoomsPaths()->nodes;
data.byte(kRyanx) = roomsPaths[data.byte(kManspath)].x - 12;
data.byte(kRyany) = roomsPaths[data.byte(kManspath)].y - 12;
}
void DreamGenContext::checkifpathison() {
flags._z = checkifpathison(al);
void DreamGenContext::checkIfPathIsOn() {
flags._z = checkIfPathIsOn(al);
}
bool DreamGenContext::checkifpathison(uint8 index) {
RoomPaths *roomsPaths = getroomspaths();
bool DreamGenContext::checkIfPathIsOn(uint8 index) {
RoomPaths *roomsPaths = getRoomsPaths();
uint8 pathOn = roomsPaths->nodes[index].on;
return pathOn == 0xff;
}
void DreamGenContext::bresenhams() {
workoutframes();
workoutFrames();
int8 *lineData = (int8 *)data.ptr(kLinedata, 0);
int16 startX = (int16)data.word(kLinestartx);
int16 startY = (int16)data.word(kLinestarty);

View file

@ -24,15 +24,15 @@
namespace DreamGen {
void DreamGenContext::printboth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
void DreamGenContext::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
uint16 newX = *x;
uint8 width, height;
printchar(charSet, &newX, y, c, nextChar, &width, &height);
multidump(*x, y, width, height);
printChar(charSet, &newX, y, c, nextChar, &width, &height);
multiDump(*x, y, width, height);
*x = newX;
}
uint8 DreamGenContext::getnextword(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
uint8 DreamGenContext::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
*totalWidth = 0;
*charCount = 0;
while(true) {
@ -51,22 +51,22 @@ uint8 DreamGenContext::getnextword(const Frame *charSet, const uint8 *string, ui
if (firstChar != 255) {
uint8 secondChar = *string;
uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
width = kernchars(firstChar, secondChar, width);
width = kernChars(firstChar, secondChar, width);
*totalWidth += width;
}
}
}
void DreamGenContext::printchar() {
void DreamGenContext::printChar() {
uint16 x = di;
uint8 width, height;
printchar((const Frame *)ds.ptr(0, 0), &x, bx, al, ah, &width, &height);
printChar((const Frame *)ds.ptr(0, 0), &x, bx, al, ah, &width, &height);
di = x;
cl = width;
ch = height;
}
void DreamGenContext::printchar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
void DreamGenContext::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
if (c == 255)
return;
@ -78,33 +78,33 @@ void DreamGenContext::printchar(const Frame *charSet, uint16* x, uint16 y, uint8
if (data.byte(kForeignrelease))
y -= 3;
uint16 tmp = c - 32 + data.word(kCharshift);
showframe(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
showFrame(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
if (data.byte(kKerning), 0)
*width = kernchars(c, nextChar, *width);
*width = kernChars(c, nextChar, *width);
(*x) += *width;
}
void DreamGenContext::printchar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
printchar(charSet, &x, y, c, nextChar, width, height);
void DreamGenContext::printChar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
printChar(charSet, &x, y, c, nextChar, width, height);
}
void DreamGenContext::printslow() {
al = printslow(es.ptr(si, 0), di, bx, dl, (bool)(dl & 1));
void DreamGenContext::printSlow() {
al = printSlow(es.ptr(si, 0), di, bx, dl, (bool)(dl & 1));
}
uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
uint8 DreamGenContext::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
const Frame* charSet = (const Frame *)segRef(data.word(kCharset1)).ptr(0, 0);
do {
uint16 offset = x;
uint16 charCount = getnumber(charSet, string, maxWidth, centered, &offset);
uint16 charCount = getNumber(charSet, string, maxWidth, centered, &offset);
do {
uint8 c0 = string[0];
uint8 c1 = string[1];
uint8 c2 = string[2];
c0 = engine->modifyChar(c0);
printboth(charSet, &offset, y, c0, c1);
printBoth(charSet, &offset, y, c0, c1);
if ((c1 == 0) || (c1 == ':')) {
return 0;
}
@ -112,10 +112,10 @@ uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8
c1 = engine->modifyChar(c1);
data.word(kCharshift) = 91;
uint16 offset2 = offset;
printboth(charSet, &offset2, y, c1, c2);
printBoth(charSet, &offset2, y, c1, c2);
data.word(kCharshift) = 0;
for (int i=0; i<2; ++i) {
uint16 mouseState = waitframes();
uint16 mouseState = waitFrames();
if (data.byte(kQuitrequested))
return 0;
if (mouseState == 0)
@ -133,26 +133,26 @@ uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8
} while (true);
}
void DreamGenContext::printdirect() {
void DreamGenContext::printDirect() {
uint16 y = bx;
uint16 initialSi = si;
const uint8 *initialString = es.ptr(si, 0);
const uint8 *string = initialString;
al = printdirect(&string, di, &y, dl, (bool)(dl & 1));
al = printDirect(&string, di, &y, dl, (bool)(dl & 1));
si = initialSi + (string - initialString);
bx = y;
}
uint8 DreamGenContext::printdirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return printdirect(&string, x, &y, maxWidth, centered);
uint8 DreamGenContext::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return printDirect(&string, x, &y, maxWidth, centered);
}
uint8 DreamGenContext::printdirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
uint8 DreamGenContext::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
data.word(kLastxpos) = x;
const Frame *charSet = (const Frame *)segRef(data.word(kCurrentset)).ptr(0, 0);
while (true) {
uint16 offset = x;
uint8 charCount = getnumber(charSet, *string, maxWidth, centered, &offset);
uint8 charCount = getNumber(charSet, *string, maxWidth, centered, &offset);
uint16 i = offset;
do {
uint8 c = (*string)[0];
@ -163,7 +163,7 @@ uint8 DreamGenContext::printdirect(const uint8** string, uint16 x, uint16 *y, ui
}
c = engine->modifyChar(c);
uint8 width, height;
printchar(charSet, &i, *y, c, nextChar, &width, &height);
printChar(charSet, &i, *y, c, nextChar, &width, &height);
data.word(kLastxpos) = i;
--charCount;
} while(charCount);
@ -171,18 +171,18 @@ uint8 DreamGenContext::printdirect(const uint8** string, uint16 x, uint16 *y, ui
}
}
void DreamGenContext::getnumber() {
void DreamGenContext::getNumber() {
uint16 offset = di;
cl = getnumber((Frame *)ds.ptr(0, 0), es.ptr(si, 0), dl, (bool)(dl & 1), &offset);
cl = getNumber((Frame *)ds.ptr(0, 0), es.ptr(si, 0), dl, (bool)(dl & 1), &offset);
di = offset;
}
uint8 DreamGenContext::getnumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 DreamGenContext::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
while (true) {
uint8 wordTotalWidth, wordCharCount;
uint8 done = getnextword(charSet, string, &wordTotalWidth, &wordCharCount);
uint8 done = getNextWord(charSet, string, &wordTotalWidth, &wordCharCount);
string += wordCharCount;
if (done == 1) { //endoftext
@ -217,7 +217,7 @@ uint8 DreamGenContext::getnumber(const Frame *charSet, const uint8 *string, uint
}
}
uint8 DreamGenContext::kernchars(uint8 firstChar, uint8 secondChar, uint8 width) {
uint8 DreamGenContext::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
if ((firstChar == 'a') || (al == 'u')) {
if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l'))
return width-1;
@ -225,23 +225,23 @@ uint8 DreamGenContext::kernchars(uint8 firstChar, uint8 secondChar, uint8 width)
return width;
}
uint16 DreamGenContext::waitframes() {
readmouse();
showpointer();
vsync();
dumppointer();
delpointer();
uint16 DreamGenContext::waitFrames() {
readMouse();
showPointer();
vSync();
dumpPointer();
delPointer();
return data.word(kMousebutton);
}
void DreamGenContext::monprint() {
void DreamGenContext::monPrint() {
uint16 originalBx = bx;
const char *string = (const char *)es.ptr(bx, 0);
const char *nextString = monprint(string);
const char *nextString = monPrint(string);
bx = originalBx + (nextString - string);
}
const char *DreamGenContext::monprint(const char *string) {
const char *DreamGenContext::monPrint(const char *string) {
data.byte(kKerning) = 1;
uint16 x = data.word(kMonadx);
Frame *charset = tempCharset();
@ -249,7 +249,7 @@ const char *DreamGenContext::monprint(const char *string) {
bool done = false;
while (!done) {
uint16 count = getnumber(charset, (const uint8 *)iterator, 166, false, &x);
uint16 count = getNumber(charset, (const uint8 *)iterator, 166, false, &x);
do {
char c = *iterator++;
if (c == ':')
@ -265,18 +265,18 @@ const char *DreamGenContext::monprint(const char *string) {
break;
}
c = engine->modifyChar(c);
printchar(charset, &x, data.word(kMonady), c, 0, NULL, NULL);
printChar(charset, &x, data.word(kMonady), c, 0, NULL, NULL);
data.word(kCurslocx) = x;
data.word(kCurslocy) = data.word(kMonady);
data.word(kMaintimer) = 1;
printcurs();
vsync();
lockmon();
delcurs();
printCurs();
vSync();
lockMon();
delCurs();
} while (--count);
x = data.word(kMonadx);
scrollmonitor();
scrollMonitor();
data.word(kCurslocx) = data.word(kMonadx);
}

View file

@ -28,55 +28,55 @@
namespace DreamGen {
void DreamGenContext::loadgame() {
void DreamGenContext::loadGame() {
if (data.byte(kCommandtype) != 246) {
data.byte(kCommandtype) = 246;
commandonly(41);
commandOnly(41);
}
if (data.word(kMousebutton) == data.word(kOldbutton))
return; // "noload"
if (data.word(kMousebutton) == 1) {
ax = 0xFFFF;
doload();
doLoad();
}
}
// input: ax = savegameId
// if -1, open menu to ask for slot to load
// if >= 0, directly load from that slot
void DreamGenContext::doload() {
void DreamGenContext::doLoad() {
int savegameId = (int16)ax;
data.byte(kLoadingorsave) = 1;
if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) {
showopbox();
showloadops();
showOpBox();
showLoadOps();
data.byte(kCurrentslot) = 0;
showslots();
shownames();
showSlots();
showNames();
data.byte(kPointerframe) = 0;
worktoscreenm();
namestoold();
workToScreenM();
namesToOld();
data.byte(kGetback) = 0;
while (true) {
if (quitRequested())
return;
delpointer();
readmouse();
showpointer();
vsync();
dumppointer();
dumptextline();
delPointer();
readMouse();
showPointer();
vSync();
dumpPointer();
dumpTextLine();
RectWithCallback loadlist[] = {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualload },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot },
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualLoad },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
checkcoords(loadlist);
checkCoords(loadlist);
if (data.byte(kGetback) == 1)
break;
if (data.byte(kGetback) == 2)
@ -101,35 +101,35 @@ void DreamGenContext::doload() {
return;
}
loadposition(savegameId);
loadPosition(savegameId);
data.byte(kGetback) = 1;
}
// kTempgraphics might not have been allocated if we bypassed all menus
if (data.word(kTempgraphics) != 0xFFFF)
getridoftemp();
getRidOfTemp();
dx = data;
es = dx;
const Room *room = (Room *)cs.ptr(kMadeuproomdat, sizeof(Room));
startloading(room);
loadroomssample();
startLoading(room);
loadRoomsSample();
data.byte(kRoomloaded) = 1;
data.byte(kNewlocation) = 255;
clearsprites();
initman();
initrain();
clearSprites();
initMan();
initRain();
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
startup();
worktoscreen();
workToScreen();
data.byte(kGetback) = 4;
}
void DreamGenContext::savegame() {
void DreamGenContext::saveGame() {
if (data.byte(kMandead) == 2) {
blank();
return;
@ -137,7 +137,7 @@ void DreamGenContext::savegame() {
if (data.byte(kCommandtype) != 247) {
data.byte(kCommandtype) = 247;
commandonly(44);
commandOnly(44);
}
if (data.word(kMousebutton) != 1)
return;
@ -145,13 +145,13 @@ void DreamGenContext::savegame() {
data.byte(kLoadingorsave) = 2;
if (ConfMan.getBool("dreamweb_originalsaveload")) {
showopbox();
showsaveops();
showOpBox();
showSaveOps();
data.byte(kCurrentslot) = 0;
showslots();
shownames();
worktoscreenm();
namestoold();
showSlots();
showNames();
workToScreenM();
namesToOld();
data.word(kBufferin) = 0;
data.word(kBufferout) = 0;
data.byte(kGetback) = 0;
@ -159,22 +159,22 @@ void DreamGenContext::savegame() {
while (true) {
if (quitRequested())
return;
delpointer();
checkinput();
readmouse();
showpointer();
vsync();
dumppointer();
dumptextline();
delPointer();
checkInput();
readMouse();
showPointer();
vSync();
dumpPointer();
dumpTextLine();
RectWithCallback savelist[] = {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualsave },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot },
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualSave },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot },
{ 0,320,0,200,&DreamGenContext::blank },
{ 0xFFFF,0,0,0,0 }
};
checkcoords(savelist);
checkCoords(savelist);
_cmp(data.byte(kGetback), 0);
if (flags.z())
continue;
@ -211,58 +211,58 @@ void DreamGenContext::savegame() {
if (savegameId < 7)
memcpy(data.ptr(kSavenames + 17*savegameId, 17), descbuf, 17);
saveposition(savegameId, descbuf);
savePosition(savegameId, descbuf);
// TODO: The below is copied from actualsave
getridoftemp();
restoreall(); // reels
getRidOfTemp();
restoreAll(); // reels
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
redrawmainscrn();
worktoscreenm();
redrawMainScrn();
workToScreenM();
data.byte(kGetback) = 4;
}
}
void DreamGenContext::namestoold() {
void DreamGenContext::namesToOld() {
memcpy(segRef(data.word(kBuffers)).ptr(kZoomspace, 0), cs.ptr(kSavenames, 0), 17*4);
}
void DreamGenContext::oldtonames() {
void DreamGenContext::oldToNames() {
memcpy(cs.ptr(kSavenames, 0), segRef(data.word(kBuffers)).ptr(kZoomspace, 0), 17*4);
}
void DreamGenContext::saveload() {
void DreamGenContext::saveLoad() {
if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) {
blank();
return;
}
if (data.byte(kCommandtype) != 253) {
data.byte(kCommandtype) = 253;
commandonly(43);
commandOnly(43);
}
if ((data.word(kMousebutton) != data.word(kOldbutton)) && (data.word(kMousebutton) & 1))
dosaveload();
doSaveLoad();
}
void DreamGenContext::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::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() {
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);
showframe(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0);
void DreamGenContext::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);
showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0);
}
void DreamGenContext::actualsave() {
void DreamGenContext::actualSave() {
if (data.byte(kCommandtype) != 222) {
data.byte(kCommandtype) = 222;
commandonly(44);
commandOnly(44);
}
if (!(data.word(kMousebutton) & 1))
@ -274,22 +274,22 @@ void DreamGenContext::actualsave() {
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
saveposition(slot, desc);
savePosition(slot, desc);
getridoftemp();
restoreall(); // reels
getRidOfTemp();
restoreAll(); // reels
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
redrawmainscrn();
worktoscreenm();
redrawMainScrn();
workToScreenM();
data.byte(kGetback) = 4;
}
void DreamGenContext::actualload() {
void DreamGenContext::actualLoad() {
if (data.byte(kCommandtype) != 221) {
data.byte(kCommandtype) = 221;
commandonly(41);
commandOnly(41);
}
if (data.word(kMousebutton) == data.word(kOldbutton) || data.word(kMousebutton) != 1)
@ -301,11 +301,11 @@ void DreamGenContext::actualload() {
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
loadposition(data.byte(kCurrentslot));
loadPosition(data.byte(kCurrentslot));
data.byte(kGetback) = 1;
}
void DreamGenContext::saveposition(unsigned int slot, const uint8 *descbuf) {
void DreamGenContext::savePosition(unsigned int slot, const uint8 *descbuf) {
const Room *currentRoom = (const Room *)cs.ptr(kRoomdata + sizeof(Room)*data.byte(kLocation), sizeof(Room));
Room *madeUpRoom = (Room *)cs.ptr(kMadeuproomdat, sizeof(Room));
@ -319,8 +319,7 @@ void DreamGenContext::saveposition(unsigned int slot, const uint8 *descbuf) {
madeUpRoom->facing = data.byte(kFacing);
madeUpRoom->b27 = 255;
openforsave(slot);
openForSave(slot);
// fill length fields in savegame file header
uint16 len[6] = { 17, kLengthofvars, kLengthofextra,
@ -335,16 +334,14 @@ void DreamGenContext::saveposition(unsigned int slot, const uint8 *descbuf) {
engine->writeToSaveFile(segRef(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]);
engine->writeToSaveFile(data.ptr(kMadeuproomdat, len[4]), len[4]);
engine->writeToSaveFile(data.ptr(kReelroutines, len[5]), len[5]);
closefile();
closeFile();
}
void DreamGenContext::loadposition(unsigned int slot) {
void DreamGenContext::loadPosition(unsigned int slot) {
data.word(kTimecount) = 0;
clearchanges();
clearChanges();
openforload(slot);
openForLoad(slot);
engine->readFromSaveFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen);
@ -368,7 +365,7 @@ void DreamGenContext::loadposition(unsigned int slot) {
engine->readFromSaveFile(data.ptr(kMadeuproomdat, len[4]), len[4]);
engine->readFromSaveFile(cs.ptr(kReelroutines, len[5]), len[5]);
closefile();
closeFile();
}
} /*namespace dreamgen */

View file

@ -24,14 +24,14 @@
namespace DreamGen {
Sprite *DreamGenContext::spritetable() {
Sprite *DreamGenContext::spriteTable() {
Sprite *sprite = (Sprite *)segRef(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite));
return sprite;
}
void DreamGenContext::printsprites() {
void DreamGenContext::printSprites() {
for (size_t priority = 0; priority < 7; ++priority) {
Sprite *sprites = spritetable();
Sprite *sprites = spriteTable();
for (size_t j = 0; j < 16; ++j) {
const Sprite &sprite = sprites[j];
if (sprite.updateCallback() == 0x0ffff)
@ -40,12 +40,12 @@ void DreamGenContext::printsprites() {
continue;
if (sprite.hidden == 1)
continue;
printasprite(&sprite);
printASprite(&sprite);
}
}
}
void DreamGenContext::printasprite(const Sprite *sprite) {
void DreamGenContext::printASprite(const Sprite *sprite) {
uint16 x, y;
if (sprite->y >= 220) {
y = data.word(kMapady) - (256 - sprite->y);
@ -64,15 +64,15 @@ void DreamGenContext::printasprite(const Sprite *sprite) {
c = 8;
else
c = 0;
showframe((const Frame *)segRef(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c);
showFrame((const Frame *)segRef(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c);
}
void DreamGenContext::clearsprites() {
memset(spritetable(), 0xff, sizeof(Sprite) * 16);
void DreamGenContext::clearSprites() {
memset(spriteTable(), 0xff, sizeof(Sprite) * 16);
}
Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
Sprite *sprite = spritetable();
Sprite *DreamGenContext::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
Sprite *sprite = spriteTable();
while (sprite->frameNumber != 0xff) { // NB: No boundchecking in the original code either
++sprite;
}
@ -88,8 +88,8 @@ Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uin
return sprite;
}
void DreamGenContext::spriteupdate() {
Sprite *sprites = spritetable();
void DreamGenContext::spriteUpdate() {
Sprite *sprites = spriteTable();
sprites[0].hidden = data.byte(kRyanon);
Sprite *sprite = sprites;
@ -98,10 +98,10 @@ void DreamGenContext::spriteupdate() {
if (updateCallback != 0xffff) {
sprite->w24 = sprite->w2;
if (updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++
mainman(sprite);
mainMan(sprite);
else {
assert(updateCallback == addr_backobject);
backobject(sprite);
backObject(sprite);
}
}
@ -111,18 +111,18 @@ void DreamGenContext::spriteupdate() {
}
}
void DreamGenContext::initman() {
Sprite *sprite = makesprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
void DreamGenContext::initMan() {
Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
sprite->priority = 4;
sprite->speed = 0;
sprite->walkFrame = 0;
}
void DreamGenContext::mainman() {
void DreamGenContext::mainMan() {
assert(false);
}
void DreamGenContext::mainman(Sprite *sprite) {
void DreamGenContext::mainMan(Sprite *sprite) {
push(es);
push(ds);
@ -147,12 +147,12 @@ void DreamGenContext::mainman(Sprite *sprite) {
}
sprite->speed = 0;
if (data.byte(kTurntoface) != data.byte(kFacing)) {
aboutturn(sprite);
aboutTurn(sprite);
} else {
if ((data.byte(kTurndirection) != 0) && (data.byte(kLinepointer) == 254)) {
data.byte(kReasseschanges) = 1;
if (data.byte(kFacing) == data.byte(kLeavedirection))
checkforexit();
checkForExit();
}
data.byte(kTurndirection) = 0;
if (data.byte(kLinepointer) == 254) {
@ -172,7 +172,7 @@ void DreamGenContext::mainman(Sprite *sprite) {
if (data.byte(kTurntoface) == data.byte(kFacing)) {
data.byte(kReasseschanges) = 1;
if (data.byte(kFacing) == data.byte(kLeavedirection))
checkforexit();
checkForExit();
}
}
}
@ -204,18 +204,18 @@ void DreamGenContext::walking(Sprite *sprite) {
data.byte(kLinepointer) = 254;
data.byte(kManspath) = data.byte(kDestination);
if (data.byte(kDestination) == data.byte(kFinaldest)) {
facerightway();
faceRightWay();
return;
}
data.byte(kDestination) = data.byte(kFinaldest);
push(es);
push(bx);
autosetwalk();
autoSetWalk();
bx = pop();
es = pop();
}
void DreamGenContext::aboutturn(Sprite *sprite) {
void DreamGenContext::aboutTurn(Sprite *sprite) {
bool incdir = true;
if (data.byte(kTurndirection) == 1)
@ -249,11 +249,11 @@ void DreamGenContext::aboutturn(Sprite *sprite) {
}
}
void DreamGenContext::backobject() {
void DreamGenContext::backObject() {
assert(false);
}
void DreamGenContext::backobject(Sprite *sprite) {
void DreamGenContext::backObject(Sprite *sprite) {
SetObject *objData = (SetObject *)segRef(data.word(kSetdat)).ptr(sprite->objData(), 0);
if (sprite->delay != 0) {
@ -263,13 +263,13 @@ void DreamGenContext::backobject(Sprite *sprite) {
sprite->delay = objData->delay;
if (objData->type == 6)
widedoor(sprite, objData);
wideDoor(sprite, objData);
else if (objData->type == 5)
random(sprite, objData);
else if (objData->type == 4)
lockeddoorway(sprite, objData);
lockedDoorway(sprite, objData);
else if (objData->type == 3)
liftsprite(sprite, objData);
liftSprite(sprite, objData);
else if (objData->type == 2)
doorway(sprite, objData);
else if (objData->type == 1)
@ -289,23 +289,22 @@ void DreamGenContext::constant(Sprite *sprite, SetObject *objData) {
}
void DreamGenContext::random(Sprite *sprite, SetObject *objData) {
randomnum1();
randomNum1();
uint16 r = ax;
sprite->frameNumber = objData->frames[r&7];
}
void DreamGenContext::doorway(Sprite *sprite, SetObject *objData) {
Common::Rect check(-24, -30, 10, 10);
dodoor(sprite, objData, check);
doDoor(sprite, objData, check);
}
void DreamGenContext::widedoor(Sprite *sprite, SetObject *objData) {
void DreamGenContext::wideDoor(Sprite *sprite, SetObject *objData) {
Common::Rect check(-24, -30, 24, 24);
dodoor(sprite, objData, check);
doDoor(sprite, objData, check);
}
void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData, Common::Rect check) {
void DreamGenContext::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) {
int ryanx = data.byte(kRyanx);
int ryany = data.byte(kRyany);
@ -326,7 +325,7 @@ void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData, Common::Rect ch
soundIndex = 13;
else
soundIndex = 0;
playchannel1(soundIndex);
playChannel1(soundIndex);
}
if (objData->frames[sprite->animFrame] == 255)
--sprite->animFrame;
@ -343,7 +342,7 @@ void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData, Common::Rect ch
soundIndex = 13;
else
soundIndex = 1;
playchannel1(soundIndex);
playChannel1(soundIndex);
}
if (sprite->animFrame != 0)
--sprite->animFrame;
@ -360,8 +359,7 @@ void DreamGenContext::steady(Sprite *sprite, SetObject *objData) {
sprite->frameNumber = frame;
}
void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
void DreamGenContext::lockedDoorway(Sprite *sprite, SetObject *objData) {
int ryanx = data.byte(kRyanx);
int ryany = data.byte(kRyany);
@ -375,11 +373,11 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
if (openDoor) {
if (sprite->animFrame == 1) {
playchannel1(0);
playChannel1(0);
}
if (sprite->animFrame == 6)
turnpathon(data.byte(kDoorpath));
turnPathOn(data.byte(kDoorpath));
if (data.byte(kThroughdoor) == 1 && sprite->animFrame == 0)
sprite->animFrame = 6;
@ -396,7 +394,7 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
// shut door
if (sprite->animFrame == 5) {
playchannel1(1);
playChannel1(1);
}
if (sprite->animFrame != 0)
@ -406,16 +404,16 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
if (sprite->animFrame == 0) {
turnpathoff(data.byte(kDoorpath));
turnPathOff(data.byte(kDoorpath));
data.byte(kLockstatus) = 1;
}
}
}
void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
void DreamGenContext::liftSprite(Sprite *sprite, SetObject *objData) {
uint8 liftFlag = data.byte(kLiftflag);
if (liftFlag == 0) { //liftclosed
turnpathoff(data.byte(kLiftpath));
turnPathOff(data.byte(kLiftpath));
if (data.byte(kCounttoopen) != 0) {
_dec(data.byte(kCounttoopen));
@ -426,7 +424,7 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
}
else if (liftFlag == 1) { //liftopen
turnpathon(data.byte(kLiftpath));
turnPathOn(data.byte(kLiftpath));
if (data.byte(kCounttoclose) != 0) {
_dec(data.byte(kCounttoclose));
@ -444,7 +442,7 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
++sprite->animFrame;
if (sprite->animFrame == 1) {
al = 2;
liftnoise();
liftNoise();
}
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
} else { //closeLift
@ -456,14 +454,14 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
--sprite->animFrame;
if (sprite->animFrame == 11) {
al = 3;
liftnoise();
liftNoise();
}
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
}
}
void DreamGenContext::facerightway() {
PathNode *paths = getroomspaths()->nodes;
void DreamGenContext::faceRightWay() {
PathNode *paths = getRoomsPaths()->nodes;
uint8 dir = paths[data.byte(kManspath)].dir;
data.byte(kTurntoface) = dir;
data.byte(kLeavedirection) = dir;
@ -473,7 +471,7 @@ void DreamGenContext::facerightway() {
// The return value is a pointer to the start of the segment.
// data.word(kCurrentframe) - data.word(kTakeoff) is the number of the frame
// inside that segment
Frame *DreamGenContext::findsource() {
Frame *DreamGenContext::findSource() {
uint16 currentFrame = data.word(kCurrentframe);
if (currentFrame < 160) {
data.word(kTakeoff) = 0;
@ -487,41 +485,41 @@ Frame *DreamGenContext::findsource() {
}
}
Reel *DreamGenContext::getreelstart() {
Reel *DreamGenContext::getReelStart() {
Reel *reel = (Reel *)segRef(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel));
return reel;
}
void DreamGenContext::showreelframe(Reel *reel) {
void DreamGenContext::showReelFrame(Reel *reel) {
uint16 x = reel->x + data.word(kMapadx);
uint16 y = reel->y + data.word(kMapady);
data.word(kCurrentframe) = reel->frame();
Frame *source = findsource();
Frame *source = findSource();
uint16 frame = data.word(kCurrentframe) - data.word(kTakeoff);
showframe(source, x, y, frame, 8);
showFrame(source, x, y, frame, 8);
}
void DreamGenContext::showgamereel() {
showgamereel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
void DreamGenContext::showGameReel() {
showGameReel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
}
void DreamGenContext::showgamereel(ReelRoutine *routine) {
uint16 reelpointer = routine->reelPointer();
if (reelpointer >= 512)
void DreamGenContext::showGameReel(ReelRoutine *routine) {
uint16 reelPointer = routine->reelPointer();
if (reelPointer >= 512)
return;
data.word(kReelpointer) = reelpointer;
plotreel();
data.word(kReelpointer) = reelPointer;
plotReel();
routine->setReelPointer(data.word(kReelpointer));
}
const Frame *DreamGenContext::getreelframeax(uint16 frame) {
const Frame *DreamGenContext::getReelFrameAX(uint16 frame) {
data.word(kCurrentframe) = frame;
Frame *source = findsource();
Frame *source = findSource();
uint16 offset = data.word(kCurrentframe) - data.word(kTakeoff);
return source + offset;
}
void DreamGenContext::showrain() {
void DreamGenContext::showRain() {
Rain *rain = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0);
// Do nothing if there's no rain at all
@ -564,74 +562,74 @@ void DreamGenContext::showrain() {
soundIndex = 4;
else
soundIndex = 7;
playchannel1(soundIndex);
playChannel1(soundIndex);
}
static void (DreamGenContext::*reelCallbacks[57])() = {
NULL, NULL,
NULL, &DreamGenContext::edeninbath,
NULL, &DreamGenContext::smokebloke,
&DreamGenContext::manasleep, &DreamGenContext::drunk,
&DreamGenContext::receptionist, &DreamGenContext::malefan,
&DreamGenContext::femalefan, &DreamGenContext::louis,
&DreamGenContext::louischair, &DreamGenContext::soldier1,
&DreamGenContext::bossman, &DreamGenContext::interviewer,
&DreamGenContext::heavy, &DreamGenContext::manasleep2,
&DreamGenContext::mansatstill, &DreamGenContext::drinker,
NULL, &DreamGenContext::edenInBath,
NULL, &DreamGenContext::smokeBloke,
&DreamGenContext::manAsleep, &DreamGenContext::drunk,
&DreamGenContext::receptionist, &DreamGenContext::maleFan,
&DreamGenContext::femaleFan, &DreamGenContext::louis,
&DreamGenContext::louisChair, &DreamGenContext::soldier1,
&DreamGenContext::bossMan, &DreamGenContext::interviewer,
&DreamGenContext::heavy, &DreamGenContext::manAsleep2,
&DreamGenContext::manSatStill, &DreamGenContext::drinker,
&DreamGenContext::bartender, NULL,
&DreamGenContext::tattooman, &DreamGenContext::attendant,
&DreamGenContext::tattooMan, &DreamGenContext::attendant,
&DreamGenContext::keeper, &DreamGenContext::candles1,
&DreamGenContext::smallcandle, &DreamGenContext::security,
&DreamGenContext::copper, &DreamGenContext::poolguard,
&DreamGenContext::rockstar, &DreamGenContext::businessman,
&DreamGenContext::smallCandle, &DreamGenContext::security,
&DreamGenContext::copper, &DreamGenContext::poolGuard,
&DreamGenContext::rockstar, &DreamGenContext::businessMan,
&DreamGenContext::train, &DreamGenContext::aide,
&DreamGenContext::mugger, &DreamGenContext::helicopter,
&DreamGenContext::intromagic1, &DreamGenContext::intromusic,
&DreamGenContext::intromagic2, &DreamGenContext::candles2,
&DreamGenContext::gates, &DreamGenContext::intromagic3,
&DreamGenContext::intromonks1, &DreamGenContext::candles,
&DreamGenContext::intromonks2, &DreamGenContext::handclap,
&DreamGenContext::monkandryan, &DreamGenContext::endgameseq,
&DreamGenContext::introMagic1, &DreamGenContext::introMusic,
&DreamGenContext::introMagic2, &DreamGenContext::candles2,
&DreamGenContext::gates, &DreamGenContext::introMagic3,
&DreamGenContext::introMonks1, &DreamGenContext::candles,
&DreamGenContext::introMonks2, &DreamGenContext::handClap,
&DreamGenContext::monkAndRyan, &DreamGenContext::endGameSeq,
&DreamGenContext::priest, &DreamGenContext::madman,
&DreamGenContext::madmanstelly, &DreamGenContext::alleybarksound,
&DreamGenContext::foghornsound, &DreamGenContext::carparkdrip,
&DreamGenContext::carparkdrip, &DreamGenContext::carparkdrip,
&DreamGenContext::carparkdrip
&DreamGenContext::madmansTelly, &DreamGenContext::alleyBarkSound,
&DreamGenContext::foghornSound, &DreamGenContext::carParkDrip,
&DreamGenContext::carParkDrip, &DreamGenContext::carParkDrip,
&DreamGenContext::carParkDrip
};
static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
&DreamGenContext::gamer, &DreamGenContext::sparkydrip,
&DreamGenContext::eden, /*&DreamGenContext::edeninbath*/NULL,
&DreamGenContext::sparky, /*&DreamGenContext::smokebloke*/NULL,
/*&DreamGenContext::manasleep*/NULL, /*&DreamGenContext::drunk*/NULL,
/*&DreamGenContext::receptionist*/NULL, /*&DreamGenContext::malefan*/NULL,
/*&DreamGenContext::femalefan*/NULL, /*&DreamGenContext::louis*/NULL,
/*&DreamGenContext::louischair*/NULL, /*&DreamGenContext::soldier1*/NULL,
/*&DreamGenContext::bossman*/NULL, /*&DreamGenContext::interviewer*/NULL,
/*&DreamGenContext::heavy*/NULL, /*&DreamGenContext::manasleep2*/NULL,
/*&DreamGenContext::mansatstill*/NULL, /*&DreamGenContext::drinker*/NULL,
/*&DreamGenContext::bartender*/NULL, &DreamGenContext::othersmoker,
/*&DreamGenContext::tattooman*/NULL, /*&DreamGenContext::attendant*/NULL,
&DreamGenContext::gamer, &DreamGenContext::sparkyDrip,
&DreamGenContext::eden, /*&DreamGenContext::edenInBath*/NULL,
&DreamGenContext::sparky, /*&DreamGenContext::smokeBloke*/NULL,
/*&DreamGenContext::manAsleep*/NULL, /*&DreamGenContext::drunk*/NULL,
/*&DreamGenContext::receptionist*/NULL, /*&DreamGenContext::maleFan*/NULL,
/*&DreamGenContext::femaleFan*/NULL, /*&DreamGenContext::louis*/NULL,
/*&DreamGenContext::louisChair*/NULL, /*&DreamGenContext::soldier1*/NULL,
/*&DreamGenContext::bossMan*/NULL, /*&DreamGenContext::interviewer*/NULL,
/*&DreamGenContext::heavy*/NULL, /*&DreamGenContext::manAsleep2*/NULL,
/*&DreamGenContext::manSatStill*/NULL, /*&DreamGenContext::drinker*/NULL,
/*&DreamGenContext::bartender*/NULL, &DreamGenContext::otherSmoker,
/*&DreamGenContext::tattooMan*/NULL, /*&DreamGenContext::attendant*/NULL,
/*&DreamGenContext::keeper*/NULL, /*&DreamGenContext::candles1*/NULL,
/*&DreamGenContext::smallcandle*/NULL, /*&DreamGenContext::security*/NULL,
/*&DreamGenContext::copper*/NULL, /*&DreamGenContext::poolguard*/NULL,
/*&DreamGenContext::rockstar*/NULL, /*&DreamGenContext::businessman*/NULL,
/*&DreamGenContext::copper*/NULL, /*&DreamGenContext::poolGuard*/NULL,
/*&DreamGenContext::rockstar*/NULL, /*&DreamGenContext::businessMan*/NULL,
/*&DreamGenContext::train*/NULL, /*&DreamGenContext::aide*/NULL,
/*&DreamGenContext::mugger*/NULL, /*&DreamGenContext::helicopter*/NULL,
/*&DreamGenContext::intromagic1*/NULL, /*&DreamGenContext::intromusic*/NULL,
/*&DreamGenContext::intromagic2*/NULL, /*&DreamGenContext::candles2*/NULL,
/*&DreamGenContext::gates*/NULL, /*&DreamGenContext::intromagic3*/NULL,
/*&DreamGenContext::introMagic1*/NULL, /*&DreamGenContext::introMusic*/NULL,
/*&DreamGenContext::introMagic2*/NULL, /*&DreamGenContext::candles2*/NULL,
/*&DreamGenContext::gates*/NULL, /*&DreamGenContext::introMagic3*/NULL,
/*&DreamGenContext::intromonks1*/NULL, /*&DreamGenContext::candles*/NULL,
/*&DreamGenContext::intromonks2*/NULL, /*&DreamGenContext::handclap*/NULL,
/*&DreamGenContext::monkandryan*/NULL, /*&DreamGenContext::endgameseq*/NULL,
/*&DreamGenContext::intromonks2*/NULL, /*&DreamGenContext::handClap*/NULL,
/*&DreamGenContext::monkAndRyan*/NULL, /*&DreamGenContext::endGameSeq*/NULL,
/*&DreamGenContext::priest*/NULL, /*&DreamGenContext::madman*/NULL,
/*&DreamGenContext::madmanstelly*/NULL, /*&DreamGenContext::alleybarksound*/NULL,
/*&DreamGenContext::foghornsound*/NULL, /*&DreamGenContext::carparkdrip*/NULL,
/*&DreamGenContext::carparkdrip*/NULL, /*&DreamGenContext::carparkdrip*/NULL,
/*&DreamGenContext::carparkdrip*/NULL
/*&DreamGenContext::madmansTelly*/NULL, /*&DreamGenContext::alleyBarkSound*/NULL,
/*&DreamGenContext::foghornSound*/NULL, /*&DreamGenContext::carParkDrip*/NULL,
/*&DreamGenContext::carParkDrip*/NULL, /*&DreamGenContext::carParkDrip*/NULL,
/*&DreamGenContext::carParkDrip*/NULL
};
void DreamGenContext::updatepeople() {
void DreamGenContext::updatePeople() {
data.word(kListpos) = kPeoplelist;
memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
++data.word(kMaintimer);
@ -658,7 +656,7 @@ void DreamGenContext::updatepeople() {
}
}
void DreamGenContext::madmantext() {
void DreamGenContext::madmanText() {
if (isCD()) {
if (data.byte(kSpeechcount) >= 63)
return;
@ -675,21 +673,21 @@ void DreamGenContext::madmantext() {
return;
al = data.byte(kCombatcount) / 4;
}
setuptimedtemp(47 + al, 82, 72, 80, 90, 1);
setupTimedTemp(47 + al, 82, 72, 80, 90, 1);
}
void DreamGenContext::madman() {
ReelRoutine *routine = (ReelRoutine *)es.ptr(bx, 0);
data.word(kWatchingtime) = 2;
if (checkspeed(routine)) {
if (checkSpeed(routine)) {
ax = routine->reelPointer();
if (ax >= 364) {
data.byte(kMandead) = 2;
showgamereel(routine);
showGameReel(routine);
return;
}
if (ax == 10) {
loadtemptext("DREAMWEB.T82");
loadTempText("DREAMWEB.T82");
data.byte(kCombatcount) = (uint8)-1;
data.byte(kSpeechcount) = 0;
}
@ -700,7 +698,7 @@ void DreamGenContext::madman() {
data.byte(kWongame) = 1;
push(es);
push(bx);
getridoftemptext();
getRidOfTempText();
bx = pop();
es = pop();
return;
@ -709,7 +707,7 @@ void DreamGenContext::madman() {
++data.byte(kCombatcount);
push(es);
push(bx);
madmantext();
madmanText();
bx = pop();
es = pop();
ax = 53;
@ -728,12 +726,12 @@ void DreamGenContext::madman() {
}
routine->setReelPointer(ax);
}
showgamereel(routine);
showGameReel(routine);
routine->mapX = data.byte(kMapx);
madmode();
madMode();
}
void DreamGenContext::madmode() {
void DreamGenContext::madMode() {
data.word(kWatchingtime) = 2;
data.byte(kPointermode) = 0;
if (data.byte(kCombatcount) < (isCD() ? 65 : 63))
@ -743,7 +741,7 @@ void DreamGenContext::madmode() {
data.byte(kPointermode) = 2;
}
void DreamGenContext::movemap(uint8 param) {
void DreamGenContext::moveMap(uint8 param) {
switch (param) {
case 32:
data.byte(kMapy) -= 20;
@ -764,9 +762,9 @@ void DreamGenContext::movemap(uint8 param) {
data.byte(kNowinnewroom) = 1;
}
void DreamGenContext::checkone() {
void DreamGenContext::checkOne() {
uint8 flag, flagEx, type, flagX, flagY;
checkone(cl, ch, &flag, &flagEx, &type, &flagX, &flagY);
checkOne(cl, ch, &flag, &flagEx, &type, &flagX, &flagY);
cl = flag;
ch = flagEx;
@ -775,7 +773,7 @@ void DreamGenContext::checkone() {
al = type;
}
void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
void DreamGenContext::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
*flagX = x / 16;
*flagY = y / 16;
const uint8 *tileData = segRef(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3);
@ -784,24 +782,24 @@ void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uin
*type = tileData[2];
}
void DreamGenContext::getblockofpixel() {
al = getblockofpixel(cl, ch);
void DreamGenContext::getBlockOfPixel() {
al = getBlockOfPixel(cl, ch);
}
uint8 DreamGenContext::getblockofpixel(uint8 x, uint8 y) {
uint8 DreamGenContext::getBlockOfPixel(uint8 x, uint8 y) {
uint8 flag, flagEx, type, flagX, flagY;
checkone(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY);
checkOne(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY);
if (flag & 1)
return 0;
else
return type;
}
void DreamGenContext::addtopeoplelist() {
addtopeoplelist((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
void DreamGenContext::addToPeopleList() {
addToPeopleList((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
}
void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
void DreamGenContext::addToPeopleList(ReelRoutine *routine) {
uint16 routinePointer = (const uint8 *)routine - cs.ptr(0, 0);
People *people = (People *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People));
@ -811,10 +809,10 @@ void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
data.word(kListpos) += sizeof(People);
}
Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
Rain *DreamGenContext::splitIntoLines(uint8 x, uint8 y, Rain *rain) {
do {
// Look for line start
while (!getblockofpixel(x, y)) {
while (!getBlockOfPixel(x, y)) {
--x;
++y;
if (x == 0 || y >= data.byte(kMapysize))
@ -827,7 +825,7 @@ Rain *DreamGenContext::splitintolines(uint8 x, uint8 y, Rain *rain) {
uint8 length = 1;
// Look for line end
while (getblockofpixel(x, y)) {
while (getBlockOfPixel(x, y)) {
--x;
++y;
if (x == 0 || y >= data.byte(kMapysize))
@ -882,7 +880,7 @@ static const RainLocation rainLocationList[] = {
{ 255,0,0,0 }
};
void DreamGenContext::initrain() {
void DreamGenContext::initRain() {
const RainLocation *r = rainLocationList;
Rain *rainList = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0);
Rain *rain = rainList;
@ -916,7 +914,7 @@ void DreamGenContext::initrain() {
if (x >= data.byte(kMapxsize))
break;
rain = splitintolines(x, 0, rain);
rain = splitIntoLines(x, 0, rain);
} while (true);
// start lines of rain from side of screen
@ -931,13 +929,13 @@ void DreamGenContext::initrain() {
if (y >= data.byte(kMapysize))
break;
rain = splitintolines(data.byte(kMapxsize) - 1, y, rain);
rain = splitIntoLines(data.byte(kMapxsize) - 1, y, rain);
} while (true);
rain->x = 0xff;
}
void DreamGenContext::textforend() {
void DreamGenContext::textForEnd() {
if (data.byte(kIntrocount) == 20)
al = 0;
else if (data.byte(kIntrocount) == (isCD() ? 50 : 65))
@ -952,10 +950,10 @@ void DreamGenContext::textforend() {
cx = 60;
dx = 1;
ah = 83;
setuptimedtemp();
setupTimedTemp();
}
void DreamGenContext::textformonk() {
void DreamGenContext::textForMonk() {
if (data.byte(kIntrocount) == 1) {
al = 19;
bl = 68;
@ -1022,7 +1020,7 @@ void DreamGenContext::textformonk() {
bh = 154;
cx = 220;
} else if (data.byte(kIntrocount) == 53) {
fadescreendowns();
fadeScreenDowns();
if (isCD()) {
data.byte(kVolumeto) = 7;
data.byte(kVolumedirection) = 1;
@ -1039,35 +1037,35 @@ void DreamGenContext::textformonk() {
return;
}
setuptimedtemp();
setupTimedTemp();
}
void DreamGenContext::reelsonscreen() {
void DreamGenContext::reelsOnScreen() {
reconstruct();
updatepeople();
watchreel();
showrain();
usetimedtext();
updatePeople();
watchReel();
showRain();
useTimedText();
}
void DreamGenContext::reconstruct() {
if (data.byte(kHavedoneobs) == 0)
return;
data.byte(kNewobs) = 1;
drawfloor();
spriteupdate();
printsprites();
drawFloor();
spriteUpdate();
printSprites();
if ((data.byte(kForeignrelease) != 0) && (data.byte(kReallocation) == 20))
undertextline();
underTextLine();
data.byte(kHavedoneobs) = 0;
}
void DreamGenContext::checkspeed() {
void DreamGenContext::checkSpeed() {
ReelRoutine *routine = (ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine));
flags._z = checkspeed(routine);
flags._z = checkSpeed(routine);
}
bool DreamGenContext::checkspeed(ReelRoutine *routine) {
bool DreamGenContext::checkSpeed(ReelRoutine *routine) {
if (data.byte(kLastweapon) != (uint8)-1)
return true;
++routine->counter;
@ -1077,18 +1075,18 @@ bool DreamGenContext::checkspeed(ReelRoutine *routine) {
return true;
}
void DreamGenContext::sparkydrip(ReelRoutine &routine) {
if (checkspeed(&routine))
playchannel0(14, 0);
void DreamGenContext::sparkyDrip(ReelRoutine &routine) {
if (checkSpeed(&routine))
playChannel0(14, 0);
}
void DreamGenContext::othersmoker(ReelRoutine &routine) {
showgamereel(&routine);
addtopeoplelist(&routine);
void DreamGenContext::otherSmoker(ReelRoutine &routine) {
showGameReel(&routine);
addToPeopleList(&routine);
}
void DreamGenContext::gamer(ReelRoutine &routine) {
if (checkspeed(&routine)) {
if (checkSpeed(&routine)) {
uint8 v;
do {
v = 20 + engine->randomNumber() % 5;
@ -1096,21 +1094,21 @@ void DreamGenContext::gamer(ReelRoutine &routine) {
routine.setReelPointer(v);
}
showgamereel(&routine);
addtopeoplelist(&routine);
showGameReel(&routine);
addToPeopleList(&routine);
}
void DreamGenContext::eden(ReelRoutine &routine) {
if (data.byte(kGeneraldead))
return;
showgamereel(&routine);
addtopeoplelist(&routine);
showGameReel(&routine);
addToPeopleList(&routine);
}
void DreamGenContext::sparky(ReelRoutine &routine) {
if (data.word(kCard1money))
routine.b7 = 3;
if (checkspeed(&routine)) {
if (checkSpeed(&routine)) {
if (routine.reelPointer() != 34) {
if (engine->randomNumber() < 30)
routine.incReelPointer();
@ -1123,8 +1121,8 @@ void DreamGenContext::sparky(ReelRoutine &routine) {
routine.setReelPointer(27);
}
}
showgamereel(&routine);
addtopeoplelist(&routine);
showGameReel(&routine);
addToPeopleList(&routine);
if (routine.b7 & 128)
data.byte(kTalkedtosparky) = 1;
}

File diff suppressed because it is too large Load diff

View file

@ -19,366 +19,366 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
void screenupdate();
void screenUpdate();
bool quitRequested();
void startup();
void startup1();
void switchryanon();
void switchryanoff();
uint16 allocatemem(uint16 paragraphs);
void deallocatemem(uint16 segment);
void switchRyanOn();
void switchRyanOff();
uint16 allocateMem(uint16 paragraphs);
void deallocateMem(uint16 segment);
uint8 *workspace();
uint8 *textUnder();
void allocatework();
void clearwork();
void standardload();
uint16 standardload(const char *fileName); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
void loadintotemp();
void loadintotemp2();
void loadintotemp3();
void loadintotemp(const char *fileName);
void loadintotemp2(const char *fileName);
void loadintotemp3(const char *fileName);
void loadtempcharset();
void loadtempcharset(const char *fileName);
void allocateWork();
void clearWork();
void standardLoad();
uint16 standardLoad(const char *fileName); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
void loadIntoTemp();
void loadIntoTemp2();
void loadIntoTemp3();
void loadIntoTemp(const char *fileName);
void loadIntoTemp2(const char *fileName);
void loadIntoTemp3(const char *fileName);
void loadTempCharset();
void loadTempCharset(const char *fileName);
Frame *tempCharset();
void saveload();
void printcurs();
void delcurs();
void hangoncurs(uint16 frameCount);
void hangoncurs();
void multidump();
void multidump(uint16 x, uint16 y, uint8 width, uint8 height);
void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
void frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void worktoscreen();
void saveLoad();
void printCurs();
void delCurs();
void hangOnCurs(uint16 frameCount);
void hangOnCurs();
void multiDump();
void multiDump(uint16 x, uint16 y, uint8 width, uint8 height);
void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
void frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void workToScreen();
void workToScreenCPP();
void multiget();
void multiget(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
void convertkey();
void multiGet();
void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
void convertKey();
void cls();
void printsprites();
void quickquit();
void readoneblock();
void printundermon();
void seecommandtail();
void randomnumber();
void quickquit2();
uint8 getnextword(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
void printboth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
void printchar();
void printchar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printchar(const Frame* charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printdirect();
uint8 printdirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered);
uint8 printdirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printmessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
void printmessage();
void usetimedtext();
void dumptimedtext();
void setuptimedtemp();
void setuptimedtemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
void getundertimed();
void putundertimed();
uint8 printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printslow();
void dumptextline();
void getnumber();
uint8 getnumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width);
void oldtonames();
void namestoold();
void loadpalfromiff();
void getroomdata();
Room *getroomdata(uint8 room);
void readheader();
void fillspace();
void startloading(const Room *room);
Sprite *spritetable();
void showframe();
void showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
void showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
void printasprite(const Sprite *sprite);
void printSprites();
void quickQuit();
void readOneBlock();
void printUnderMon();
void seeCommandTail();
void randomNumber();
void quickQuit2();
uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
void printBoth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
void printChar();
void printChar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printChar(const Frame* charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printDirect();
uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered);
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
void printMessage();
void useTimedText();
void dumpTimedText();
void setupTimedTemp();
void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
void getUnderTimed();
void putUnderTimed();
uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
void printSlow();
void dumpTextLine();
void getNumber();
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
void oldToNames();
void namesToOld();
void loadPalFromIFF();
void getRoomData();
Room *getRoomData(uint8 room);
void readHeader();
void fillSpace();
void startLoading(const Room *room);
Sprite *spriteTable();
void showFrame();
void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
void printASprite(const Sprite *sprite);
void width160();
void multiput(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiput();
void eraseoldobs();
void clearsprites();
Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
void spriteupdate();
void initman();
void mainman(Sprite *sprite);
void facerightway();
void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiPut();
void eraseOldObs();
void clearSprites();
Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
void spriteUpdate();
void initMan();
void mainMan(Sprite *sprite);
void faceRightWay();
void walking(Sprite *sprite);
void autosetwalk();
void checkdest(const RoomPaths *roomsPaths);
void aboutturn(Sprite *sprite);
void backobject(Sprite *sprite);
void autoSetWalk();
void checkDest(const RoomPaths *roomsPaths);
void aboutTurn(Sprite *sprite);
void backObject(Sprite *sprite);
void constant(Sprite *sprite, SetObject *objData);
void steady(Sprite *sprite, SetObject *objData);
void random(Sprite *sprite, SetObject *objData);
void dodoor(Sprite *sprite, SetObject *objData, Common::Rect check);
void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check);
void doorway(Sprite *sprite, SetObject *objData);
void widedoor(Sprite *sprite, SetObject *objData);
void lockeddoorway(Sprite *sprite, SetObject *objData);
void liftsprite(Sprite *sprite, SetObject *objData);
Frame *findsource();
void showgamereel();
void showgamereel(ReelRoutine *routine);
void showreelframe(Reel *reel);
const Frame *getreelframeax(uint16 frame);
void turnpathon(uint8 param);
void turnpathoff(uint8 param);
void turnpathon();
void turnpathoff();
void turnanypathon(uint8 param, uint8 room);
void turnanypathoff(uint8 param, uint8 room);
void turnanypathon();
void turnanypathoff();
RoomPaths *getroomspaths();
void makebackob(SetObject *objData);
void modifychar();
void lockmon();
void cancelch0();
void cancelch1();
void plotreel();
Reel *getreelstart();
void dealwithspecial(uint8 firstParam, uint8 secondParam);
void wideDoor(Sprite *sprite, SetObject *objData);
void lockedDoorway(Sprite *sprite, SetObject *objData);
void liftSprite(Sprite *sprite, SetObject *objData);
Frame *findSource();
void showGameReel();
void showGameReel(ReelRoutine *routine);
void showReelFrame(Reel *reel);
const Frame *getReelFrameAX(uint16 frame);
void turnPathOn(uint8 param);
void turnPathOff(uint8 param);
void turnPathOn();
void turnPathOff();
void turnAnyPathOn(uint8 param, uint8 room);
void turnAnyPathOff(uint8 param, uint8 room);
void turnAnyPathOn();
void turnAnyPathOff();
RoomPaths *getRoomsPaths();
void makeBackOb(SetObject *objData);
void modifyChar();
void lockMon();
void cancelCh0();
void cancelCh1();
void plotReel();
Reel *getReelStart();
void dealWithSpecial(uint8 firstParam, uint8 secondParam);
void zoom();
void crosshair();
void showrain();
void deltextline();
void commandonly();
void commandonly(uint8 command);
void doblocks();
void checkifperson();
bool checkifperson(uint8 x, uint8 y);
void checkiffree();
bool checkiffree(uint8 x, uint8 y);
void checkifex();
bool checkifex(uint8 x, uint8 y);
const uint8 *findobname(uint8 type, uint8 index);
void copyname();
void copyname(uint8 type, uint8 index, uint8 *dst);
void commandwithob();
void commandwithob(uint8 command, uint8 type, uint8 index);
void showpanel();
void updatepeople();
void madmantext();
void madmode();
void movemap(uint8 param);
bool addalong(const uint8 *mapFlags);
bool addlength(const uint8 *mapFlags);
void getdimension();
void getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize);
void getmapad();
void calcmapad();
uint8 getmapad(const uint8 *setData);
uint8 getxad(const uint8 *setData, uint8 *result);
uint8 getyad(const uint8 *setData, uint8 *result);
void calcfrframe();
void calcfrframe(uint8* width, uint8* height);
void finalframe();
void finalframe(uint16 *x, uint16 *y);
void showallobs();
void blocknametext();
void walktotext();
void personnametext();
void findxyfrompath();
void findormake();
void findormake(uint8 index, uint8 value, uint8 type);
DynObject *getfreead(uint8 index);
DynObject *getexad(uint8 index);
DynObject *geteitheradCPP();
SetObject *getsetad(uint8 index);
void *getanyad(uint8 *value1, uint8 *value2);
void *getanyaddir(uint8 index, uint8 flag);
void setallchanges();
void dochange(uint8 index, uint8 value, uint8 type);
void deletetaken();
void showRain();
void delTextLine();
void commandOnly();
void commandOnly(uint8 command);
void doBlocks();
void checkIfPerson();
bool checkIfPerson(uint8 x, uint8 y);
void checkIfFree();
bool checkIfFree(uint8 x, uint8 y);
void checkIfEx();
bool checkIfEx(uint8 x, uint8 y);
const uint8 *findObName(uint8 type, uint8 index);
void copyName();
void copyName(uint8 type, uint8 index, uint8 *dst);
void commandWithOb();
void commandWithOb(uint8 command, uint8 type, uint8 index);
void showPanel();
void updatePeople();
void madmanText();
void madMode();
void moveMap(uint8 param);
bool addAlong(const uint8 *mapFlags);
bool addLength(const uint8 *mapFlags);
void getDimension();
void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize);
void getMapAd();
void calcMapAd();
uint8 getMapAd(const uint8 *setData);
uint8 getXAd(const uint8 *setData, uint8 *result);
uint8 getYAd(const uint8 *setData, uint8 *result);
void calcFrFrame();
void calcFrFrame(uint8* width, uint8* height);
void finalFrame();
void finalFrame(uint16 *x, uint16 *y);
void showAllObs();
void blockNameText();
void walkToText();
void personNameText();
void findXYFromPath();
void findOrMake();
void findOrMake(uint8 index, uint8 value, uint8 type);
DynObject *getFreeAd(uint8 index);
DynObject *getExAd(uint8 index);
DynObject *getEitherAdCPP();
SetObject *getSetAd(uint8 index);
void *getAnyAd(uint8 *value1, uint8 *value2);
void *getAnyAdDir(uint8 index, uint8 flag);
void setAllChanges();
void doChange(uint8 index, uint8 value, uint8 type);
void deleteTaken();
bool isCD();
void placesetobject();
void placesetobject(uint8 index);
void removesetobject();
void removesetobject(uint8 index);
void showallfree();
void showallex();
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 walkandexamine();
void obname();
void obname(uint8 command, uint8 commandType);
void delpointer();
void showblink();
void dumpblink();
void dumppointer();
void showpointer();
void animpointer();
void checkcoords();
void checkcoords(const RectWithCallback *rectWithCallbacks);
void readmouse();
void placeSetObject();
void placeSetObject(uint8 index);
void removeSetObject();
void removeSetObject(uint8 index);
void showAllFree();
void showAllEx();
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 walkAndExamine();
void obName();
void obName(uint8 command, uint8 commandType);
void delPointer();
void showBlink();
void dumpBlink();
void dumpPointer();
void showPointer();
void animPointer();
void checkCoords();
void checkCoords(const RectWithCallback *rectWithCallbacks);
void readMouse();
uint16 readMouseState();
uint16 waitframes();
void drawflags();
void addtopeoplelist();
void addtopeoplelist(ReelRoutine *routine);
void getexpos();
void paneltomap();
void maptopanel();
void dumpmap();
void obpicture();
void transferinv();
void obicons();
uint16 waitFrames();
void drawFlags();
void addToPeopleList();
void addToPeopleList(ReelRoutine *routine);
void getExPos();
void panelToMap();
void mapToPanel();
void dumpMap();
void obPicture();
void transferInv();
void obIcons();
void compare();
bool compare(uint8 index, uint8 flag, const char id[4]);
bool pixelcheckset(const ObjPos *pos, uint8 x, uint8 y);
bool isitdescribed(const ObjPos *objPos);
void checkifset();
bool checkifset(uint8 x, uint8 y);
void checkifpathison();
bool checkifpathison(uint8 index);
void isitworn();
bool isitworn(const DynObject *object);
void wornerror();
void makeworn();
void makeworn(DynObject *object);
void obtoinv();
void obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y);
void showryanpage();
void findallryan();
void findallryan(uint8 *inv);
void fillryan();
void useroutine();
void hangon();
void hangon(uint16 frameCount);
void hangonw();
void hangonw(uint16 frameCount);
void hangonp();
void hangonp(uint16 count);
void showicon();
uint8 findnextcolon(uint8 **string);
void findnextcolon();
uint8 *getobtextstartCPP();
void usetext(const uint8 *string);
void usetext();
void getblockofpixel();
uint8 getblockofpixel(uint8 x, uint8 y);
bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y);
bool isItDescribed(const ObjPos *objPos);
void checkIfSet();
bool checkIfSet(uint8 x, uint8 y);
void checkIfPathIsOn();
bool checkIfPathIsOn(uint8 index);
void isItWorn();
bool isItWorn(const DynObject *object);
void wornError();
void makeWorn();
void makeWorn(DynObject *object);
void obToInv();
void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y);
void showRyanPage();
void findAllRyan();
void findAllRyan(uint8 *inv);
void fillRyan();
void useRoutine();
void hangOn();
void hangOn(uint16 frameCount);
void hangOnW();
void hangOnW(uint16 frameCount);
void hangOnP();
void hangOnP(uint16 count);
void showIcon();
uint8 findNextColon(uint8 **string);
void findNextColon();
uint8 *getObTextStartCPP();
void useText(const uint8 *string);
void useText();
void getBlockOfPixel();
uint8 getBlockOfPixel(uint8 x, uint8 y);
void bresenhams();
void examineobtext();
void sortoutmap();
void showcity();
uint16 getpersframe(uint8 index);
void convicons();
void examineob(bool examineAgain = true);
void showwatch();
void dumpwatch();
void showtime();
void roomname();
void transfertext();
void initrain();
Rain *splitintolines(uint8 x, uint8 y, Rain *rain);
void examineObText();
void sortOutMap();
void showCity();
uint16 getPersFrame(uint8 index);
void convIcons();
void examineOb(bool examineAgain = true);
void showWatch();
void dumpWatch();
void showTime();
void roomName();
void transferText();
void initRain();
Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain);
uint8 *mainPalette();
uint8 *startPalette();
uint8 *endPalette();
void clearstartpal();
void clearendpal();
void paltostartpal();
void endpaltostart();
void startpaltoend();
void paltoendpal();
void fadecalculation();
void watchcount();
void zoomicon();
void loadroom();
void getundermenu();
void putundermenu();
void textformonk();
void textforend();
void readsetdata();
void loadroomssample();
void fadeupyellows();
void fadeupmonfirst();
void printlogo();
void usemon();
void scrollmonitor();
void showcurrentfile();
void clearStartPal();
void clearEndPal();
void palToStartPal();
void endPalToStart();
void startPalToEnd();
void palToEndPal();
void fadeCalculation();
void watchCount();
void zoomIcon();
void loadRoom();
void getUnderMenu();
void putUnderMenu();
void textForMonk();
void textForEnd();
void readSetData();
void loadRoomsSample();
void fadeupYellows();
void fadeupMonFirst();
void printLogo();
void useMon();
void scrollMonitor();
void showCurrentFile();
void input();
void monprint();
const char *monprint(const char *string);
void monPrint();
const char *monPrint(const char *string);
Frame *tempGraphics();
Frame *tempGraphics2();
Frame *tempGraphics3();
void accesslighton();
void accesslightoff();
void randomaccess(uint16 count);
void randomaccess();
void monmessage(uint8 index);
void monmessage();
void neterror();
void turnonpower();
void powerlighton();
void powerlightoff();
void playchannel0();
void playchannel0(uint8 index, uint8 repeat);
void playchannel1();
void playchannel1(uint8 index);
void showmainops();
void showdiscops();
void createpanel();
void createpanel2();
void findroominloc();
void reelsonscreen();
void accessLightOn();
void accessLightOff();
void randomAccess(uint16 count);
void randomAccess();
void monMessage(uint8 index);
void monMessage();
void netError();
void turnOnPower();
void powerLightOn();
void powerLightOff();
void playChannel0();
void playChannel0(uint8 index, uint8 repeat);
void playChannel1();
void playChannel1(uint8 index);
void showMainOps();
void showDiscOps();
void createPanel();
void createPanel2();
void findRoomInLoc();
void reelsOnScreen();
void reconstruct();
void look();
void autolook();
void dolook();
void usetempcharset();
void usecharset1();
void getbackfromob();
void showfirstuse();
void showseconduse();
void actualsave();
void actualload();
void loadposition(unsigned int slot);
void saveposition(unsigned int slot, const uint8 *descbuf);
void openforsave(unsigned int slot);
void openforload(unsigned int slot);
void autoLook();
void doLook();
void useTempCharset();
void useCharset1();
void getBackFromOb();
void showFirstUse();
void showSecondUse();
void actualSave();
void actualLoad();
void loadPosition(unsigned int slot);
void savePosition(unsigned int slot, const uint8 *descbuf);
void openForSave(unsigned int slot);
void openForLoad(unsigned int slot);
uint16 allocateAndLoad(unsigned int size);
void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
void loadRoomData(const Room* room, bool skipDat);
void restoreall();
void restorereels();
void viewfolder();
void restoreAll();
void restoreReels();
void viewFolder();
void checkFolderCoords();
void loadfolder();
void showfolder();
void showleftpage();
void showrightpage();
void nextfolder();
void lastfolder();
void folderhints();
void folderexit();
uint8 getlocation(uint8 index);
void getlocation();
void setlocation(uint8 index);
void setlocation();
void loadFolder();
void showFolder();
void showLeftPage();
void showRightPage();
void nextFolder();
void lastFolder();
void folderHints();
void folderExit();
uint8 getLocation(uint8 index);
void getLocation();
void setLocation(uint8 index);
void setLocation();
const uint8 *getTextInFile1(uint16 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);
void othersmoker(ReelRoutine &routine);
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);
void otherSmoker(ReelRoutine &routine);
void gamer(ReelRoutine &routine);
void eden(ReelRoutine &routine);
void sparky(ReelRoutine &routine);

View file

@ -24,16 +24,16 @@
namespace DreamGen {
uint16 DreamGenContext::getpersframe(uint8 index) {
uint16 DreamGenContext::getPersFrame(uint8 index) {
return segRef(data.word(kPeople)).word(kPersonframes + index * 2);
}
void DreamGenContext::convicons() {
void DreamGenContext::convIcons() {
uint8 index = data.byte(kCharacter) & 127;
data.word(kCurrentframe) = getpersframe(index);
Frame *frame = findsource();
data.word(kCurrentframe) = getPersFrame(index);
Frame *frame = findSource();
uint16 frameNumber = (data.word(kCurrentframe) - data.word(kTakeoff)) & 0xff;
showframe(frame, 234, 2, frameNumber, 0);
showFrame(frame, 234, 2, frameNumber, 0);
}
} /*namespace dreamgen */

View file

@ -35,90 +35,90 @@ struct UseListEntry {
const char *id;
};
void DreamGenContext::useroutine() {
void DreamGenContext::useRoutine() {
static const UseListEntry kUseList[] = {
{ &DreamGenContext::usemon, "NETW" },
{ &DreamGenContext::useelevator1, "ELVA" },
{ &DreamGenContext::useelevator2, "ELVB" },
{ &DreamGenContext::useelevator3, "ELVC" },
{ &DreamGenContext::useelevator4, "ELVE" },
{ &DreamGenContext::useelevator5, "ELVF" },
{ &DreamGenContext::usechurchgate, "CGAT" },
{ &DreamGenContext::usestereo, "REMO" },
{ &DreamGenContext::usebuttona, "BUTA" },
{ &DreamGenContext::usewinch, "CBOX" },
{ &DreamGenContext::uselighter, "LITE" },
{ &DreamGenContext::useplate, "PLAT" },
{ &DreamGenContext::usecontrol, "LIFT" },
{ &DreamGenContext::usewire, "WIRE" },
{ &DreamGenContext::usehandle, "HNDL" },
{ &DreamGenContext::usehatch, "HACH" },
{ &DreamGenContext::useelvdoor, "DOOR" },
{ &DreamGenContext::usecashcard, "CSHR" },
{ &DreamGenContext::usegun, "GUNA" },
{ &DreamGenContext::usecardreader1, "CRAA" },
{ &DreamGenContext::usecardreader2, "CRBB" },
{ &DreamGenContext::usecardreader3, "CRCC" },
{ &DreamGenContext::sitdowninbar, "SEAT" },
{ &DreamGenContext::usemenu, "MENU" },
{ &DreamGenContext::usecooker, "COOK" },
{ &DreamGenContext::callhotellift, "ELCA" },
{ &DreamGenContext::calledenslift, "EDCA" },
{ &DreamGenContext::calledensdlift, "DDCA" },
{ &DreamGenContext::usealtar, "ALTR" },
{ &DreamGenContext::openhoteldoor, "LOKA" },
{ &DreamGenContext::openhoteldoor2, "LOKB" },
{ &DreamGenContext::openlouis, "ENTA" },
{ &DreamGenContext::openryan, "ENTB" },
{ &DreamGenContext::openpoolboss, "ENTE" },
{ &DreamGenContext::openyourneighbour, "ENTC" },
{ &DreamGenContext::openeden, "ENTD" },
{ &DreamGenContext::opensarters, "ENTH" },
{ &DreamGenContext::wearwatch, "WWAT" },
{ &DreamGenContext::usepoolreader, "POOL" },
{ &DreamGenContext::wearshades, "WSHD" },
{ &DreamGenContext::grafittidoor, "GRAF" },
{ &DreamGenContext::trapdoor, "TRAP" },
{ &DreamGenContext::edenscdplayer, "CDPE" },
{ &DreamGenContext::opentvdoor, "DLOK" },
{ &DreamGenContext::usehole, "HOLE" },
{ &DreamGenContext::usedryer, "DRYR" },
{ &DreamGenContext::usechurchhole, "HOLY" },
{ &DreamGenContext::usewall, "WALL" },
{ &DreamGenContext::usediary, "BOOK" },
{ &DreamGenContext::useaxe, "AXED" },
{ &DreamGenContext::useshield, "SHLD" },
{ &DreamGenContext::userailing, "BCNY" },
{ &DreamGenContext::usecoveredbox, "LIDC" },
{ &DreamGenContext::useclearbox, "LIDU" },
{ &DreamGenContext::useopenbox, "LIDO" },
{ &DreamGenContext::usepipe, "PIPE" },
{ &DreamGenContext::usebalcony, "BALC" },
{ &DreamGenContext::usewindow, "WIND" },
{ &DreamGenContext::viewfolder, "PAPR" },
{ &DreamGenContext::usetrainer, "UWTA" },
{ &DreamGenContext::usetrainer, "UWTB" },
{ &DreamGenContext::entersymbol, "STAT" },
{ &DreamGenContext::opentomb, "TLID" },
{ &DreamGenContext::useslab, "SLAB" },
{ &DreamGenContext::usecart, "CART" },
{ &DreamGenContext::usefullcart, "FCAR" },
{ &DreamGenContext::slabdoora, "SLBA" },
{ &DreamGenContext::slabdoorb, "SLBB" },
{ &DreamGenContext::slabdoorc, "SLBC" },
{ &DreamGenContext::slabdoord, "SLBD" },
{ &DreamGenContext::slabdoore, "SLBE" },
{ &DreamGenContext::slabdoorf, "SLBF" },
{ &DreamGenContext::useplinth, "PLIN" },
{ &DreamGenContext::useladder, "LADD" },
{ &DreamGenContext::useladderb, "LADB" },
{ &DreamGenContext::useMon, "NETW" },
{ &DreamGenContext::useElevator1, "ELVA" },
{ &DreamGenContext::useElevator2, "ELVB" },
{ &DreamGenContext::useElevator3, "ELVC" },
{ &DreamGenContext::useElevator4, "ELVE" },
{ &DreamGenContext::useElevator5, "ELVF" },
{ &DreamGenContext::useChurchGate, "CGAT" },
{ &DreamGenContext::useStereo, "REMO" },
{ &DreamGenContext::useButtonA, "BUTA" },
{ &DreamGenContext::useWinch, "CBOX" },
{ &DreamGenContext::useLighter, "LITE" },
{ &DreamGenContext::usePlate, "PLAT" },
{ &DreamGenContext::useControl, "LIFT" },
{ &DreamGenContext::useWire, "WIRE" },
{ &DreamGenContext::useHandle, "HNDL" },
{ &DreamGenContext::useHatch, "HACH" },
{ &DreamGenContext::useElvDoor, "DOOR" },
{ &DreamGenContext::useCashCard, "CSHR" },
{ &DreamGenContext::useGun, "GUNA" },
{ &DreamGenContext::useCardReader1, "CRAA" },
{ &DreamGenContext::useCardReader2, "CRBB" },
{ &DreamGenContext::useCardReader3, "CRCC" },
{ &DreamGenContext::sitDownInBar, "SEAT" },
{ &DreamGenContext::useMenu, "MENU" },
{ &DreamGenContext::useCooker, "COOK" },
{ &DreamGenContext::callHotelLift, "ELCA" },
{ &DreamGenContext::callEdensLift, "EDCA" },
{ &DreamGenContext::callEdensDLift, "DDCA" },
{ &DreamGenContext::useAltar, "ALTR" },
{ &DreamGenContext::openHotelDoor, "LOKA" },
{ &DreamGenContext::openHotelDoor2, "LOKB" },
{ &DreamGenContext::openLouis, "ENTA" },
{ &DreamGenContext::openRyan, "ENTB" },
{ &DreamGenContext::openPoolBoss, "ENTE" },
{ &DreamGenContext::openYourNeighbour, "ENTC" },
{ &DreamGenContext::openEden, "ENTD" },
{ &DreamGenContext::openSarters, "ENTH" },
{ &DreamGenContext::wearWatch, "WWAT" },
{ &DreamGenContext::usePoolReader, "POOL" },
{ &DreamGenContext::wearShades, "WSHD" },
{ &DreamGenContext::grafittiDoor, "GRAF" },
{ &DreamGenContext::trapDoor, "TRAP" },
{ &DreamGenContext::edensCDPlayer, "CDPE" },
{ &DreamGenContext::openTVDoor, "DLOK" },
{ &DreamGenContext::useHole, "HOLE" },
{ &DreamGenContext::useDryer, "DRYR" },
{ &DreamGenContext::useChurchHole, "HOLY" },
{ &DreamGenContext::useWall, "WALL" },
{ &DreamGenContext::useDiary, "BOOK" },
{ &DreamGenContext::useAxe, "AXED" },
{ &DreamGenContext::useShield, "SHLD" },
{ &DreamGenContext::useRailing, "BCNY" },
{ &DreamGenContext::useCoveredBox, "LIDC" },
{ &DreamGenContext::useClearBox, "LIDU" },
{ &DreamGenContext::useOpenBox, "LIDO" },
{ &DreamGenContext::usePipe, "PIPE" },
{ &DreamGenContext::useBalcony, "BALC" },
{ &DreamGenContext::useWindow, "WIND" },
{ &DreamGenContext::viewFolder, "PAPR" },
{ &DreamGenContext::useTrainer, "UWTA" },
{ &DreamGenContext::useTrainer, "UWTB" },
{ &DreamGenContext::enterSymbol, "STAT" },
{ &DreamGenContext::openTomb, "TLID" },
{ &DreamGenContext::useSLab, "SLAB" },
{ &DreamGenContext::useCart, "CART" },
{ &DreamGenContext::useFullCart, "FCAR" },
{ &DreamGenContext::sLabDoorA, "SLBA" },
{ &DreamGenContext::sLabDoorB, "SLBB" },
{ &DreamGenContext::sLabDoorC, "SLBC" },
{ &DreamGenContext::sLabDoorD, "SLBD" },
{ &DreamGenContext::sLabDoorE, "SLBE" },
{ &DreamGenContext::sLabDoorF, "SLBF" },
{ &DreamGenContext::usePlinth, "PLIN" },
{ &DreamGenContext::useLadder, "LADD" },
{ &DreamGenContext::useLadderB, "LADB" },
{ &DreamGenContext::chewy, "GUMA" },
{ &DreamGenContext::wheelsound, "SQEE" },
{ &DreamGenContext::runtap, "TAPP" },
{ &DreamGenContext::playguitar, "GUIT" },
{ &DreamGenContext::hotelcontrol, "CONT" },
{ &DreamGenContext::hotelbell, "BELL" },
{ &DreamGenContext::wheelSound, "SQEE" },
{ &DreamGenContext::runTap, "TAPP" },
{ &DreamGenContext::playGuitar, "GUIT" },
{ &DreamGenContext::hotelControl, "CONT" },
{ &DreamGenContext::hotelBell, "BELL" },
};
if (data.byte(kReallocation) >= 50) {
@ -127,7 +127,7 @@ void DreamGenContext::useroutine() {
data.byte(kPointerpower) = 0;
}
getanyad();
getAnyAd();
const uint8 *id = es.ptr(bx + 12, 4);
for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) {
@ -138,89 +138,89 @@ void DreamGenContext::useroutine() {
}
}
delpointer();
uint8 *obText = getobtextstartCPP();
if (findnextcolon(&obText) != 0) {
if (findnextcolon(&obText) != 0) {
delPointer();
uint8 *obText = getObTextStartCPP();
if (findNextColon(&obText) != 0) {
if (findNextColon(&obText) != 0) {
if (*obText != 0) {
usetext(obText);
hangonp(400);
putbackobstuff();
useText(obText);
hangOnP(400);
putBackObStuff();
return;
}
}
}
createpanel();
showpanel();
showman();
showexit();
obicons();
printmessage(33, 100, 63, 241, true);
worktoscreenm();
hangonp(50);
putbackobstuff();
createPanel();
showPanel();
showMan();
showExit();
obIcons();
printMessage(33, 100, 63, 241, true);
workToScreenM();
hangOnP(50);
putBackObStuff();
data.byte(kCommandtype) = 255;
}
void DreamGenContext::usetext() {
usetext(es.ptr(si, 0));
void DreamGenContext::useText() {
useText(es.ptr(si, 0));
}
void DreamGenContext::usetext(const uint8 *string) {
createpanel();
showpanel();
showman();
showexit();
obicons();
printdirect(string, 36, 104, 241, true);
worktoscreenm();
void DreamGenContext::useText(const uint8 *string) {
createPanel();
showPanel();
showMan();
showExit();
obIcons();
printDirect(string, 36, 104, 241, true);
workToScreenM();
}
void DreamGenContext::showfirstuse() {
uint8 *obText = getobtextstartCPP();
findnextcolon(&obText);
findnextcolon(&obText);
usetext(obText);
hangonp(400);
void DreamGenContext::showFirstUse() {
uint8 *obText = getObTextStartCPP();
findNextColon(&obText);
findNextColon(&obText);
useText(obText);
hangOnP(400);
}
void DreamGenContext::showseconduse() {
uint8 *obText = getobtextstartCPP();
findnextcolon(&obText);
findnextcolon(&obText);
findnextcolon(&obText);
usetext(obText);
hangonp(400);
void DreamGenContext::showSecondUse() {
uint8 *obText = getObTextStartCPP();
findNextColon(&obText);
findNextColon(&obText);
findNextColon(&obText);
useText(obText);
hangOnP(400);
}
void DreamGenContext::viewfolder() {
void DreamGenContext::viewFolder() {
data.byte(kManisoffscreen) = 1;
getridofall();
loadfolder();
getRidOfAll();
loadFolder();
data.byte(kFolderpage) = 0;
showfolder();
worktoscreenm();
showFolder();
workToScreenM();
data.byte(kGetback) = 0;
do {
if (quitRequested())
break;
delpointer();
readmouse();
showpointer();
vsync();
dumppointer();
dumptextline();
delPointer();
readMouse();
showPointer();
vSync();
dumpPointer();
dumpTextLine();
checkFolderCoords();
} while (data.byte(kGetback) == 0);
data.byte(kManisoffscreen) = 0;
getridoftemp();
getridoftemp2();
getridoftemp3();
getridoftempcharset();
restoreall();
redrawmainscrn();
worktoscreenm();
getRidOfTemp();
getRidOfTemp2();
getRidOfTemp3();
getRidOfTempCharset();
restoreAll();
redrawMainScrn();
workToScreenM();
}
} /*namespace dreamgen */

View file

@ -36,31 +36,31 @@ uint8 *DreamGenContext::endPalette() {
return segRef(data.word(kBuffers)).ptr(kEndpal, 256*3);
}
void DreamGenContext::clearstartpal() {
void DreamGenContext::clearStartPal() {
memset(startPalette(), 0, 256*3);
}
void DreamGenContext::clearendpal() {
void DreamGenContext::clearEndPal() {
memset(endPalette(), 0, 256*3);
}
void DreamGenContext::paltostartpal() {
void DreamGenContext::palToStartPal() {
memcpy(startPalette(), mainPalette(), 256*3);
}
void DreamGenContext::endpaltostart() {
void DreamGenContext::endPalToStart() {
memcpy(startPalette(), endPalette(), 256*3);
}
void DreamGenContext::startpaltoend() {
void DreamGenContext::startPalToEnd() {
memcpy(endPalette(), startPalette(), 256*3);
}
void DreamGenContext::paltoendpal() {
void DreamGenContext::palToEndPal() {
memcpy(endPalette(), mainPalette(), 256*3);
}
void DreamGenContext::fadecalculation() {
void DreamGenContext::fadeCalculation() {
if (data.byte(kFadecount) == 0) {
data.byte(kFadedirection) = 0;
return;
@ -83,29 +83,29 @@ void DreamGenContext::fadecalculation() {
--data.byte(kFadecount);
}
void DreamGenContext::fadeupyellows() {
paltoendpal();
void DreamGenContext::fadeupYellows() {
palToEndPal();
memset(endPalette() + 231*3, 0, 8*3);
memset(endPalette() + 246*3, 0, 1*3);
data.byte(kFadedirection) = 1;
data.byte(kFadecount) = 63;
data.byte(kColourpos) = 0;
data.byte(kNumtofade) = 128;
hangon(128);
hangOn(128);
}
void DreamGenContext::fadeupmonfirst() {
paltostartpal();
paltoendpal();
void DreamGenContext::fadeupMonFirst() {
palToStartPal();
palToEndPal();
memset(startPalette() + 231*3, 0, 8*3);
memset(startPalette() + 246*3, 0, 1*3);
data.byte(kFadedirection) = 1;
data.byte(kFadecount) = 63;
data.byte(kColourpos) = 0;
data.byte(kNumtofade) = 128;
hangon(64);
playchannel1(26);
hangon(64);
hangOn(64);
playChannel1(26);
hangOn(64);
}
} /*namespace dreamgen */

View file

@ -31,18 +31,18 @@ uint8 *DreamGenContext::workspace() {
return result;
}
void DreamGenContext::allocatework() {
data.word(kWorkspace) = allocatemem(0x1000);
void DreamGenContext::allocateWork() {
data.word(kWorkspace) = allocateMem(0x1000);
}
void DreamGenContext::multiget() {
multiget(ds.ptr(si, 0), di, bx, cl, ch);
void DreamGenContext::multiGet() {
multiGet(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
void DreamGenContext::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320);
assert(y < 200);
const uint8 *src = workspace() + x + y * kScreenwidth;
@ -50,7 +50,7 @@ void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h)
h = 200 - y;
if (x + w > 320)
w = 320 - x;
//debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
//debug(1, "multiGet %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + kScreenwidth * l;
uint8 *dst_p = dst + w * l;
@ -58,14 +58,14 @@ void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h)
}
}
void DreamGenContext::multiput() {
multiput(ds.ptr(si, 0), di, bx, cl, ch);
void DreamGenContext::multiPut() {
multiPut(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
void DreamGenContext::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320);
assert(y < 200);
uint8 *dst = workspace() + x + y * kScreenwidth;
@ -73,7 +73,7 @@ void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, ui
h = 200 - y;
if (x + w > 320)
w = 320 - x;
//debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
//debug(1, "multiPut %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + w * l;
uint8 *dst_p = dst + kScreenwidth * l;
@ -81,14 +81,14 @@ void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, ui
}
}
void DreamGenContext::multidump(uint16 x, uint16 y, uint8 width, uint8 height) {
void DreamGenContext::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
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);
engine->blit(workspace() + offset, kScreenwidth, x, y, width, height);
}
void DreamGenContext::multidump() {
multidump(di, bx, cl, ch);
void DreamGenContext::multiDump() {
multiDump(di, bx, cl, ch);
unsigned offset = di + bx * kScreenwidth;
si = di = offset + ch * kScreenwidth;
cx = 0;
@ -98,14 +98,14 @@ void DreamGenContext::workToScreenCPP() {
engine->blit(workspace(), 320, 0, 0, 320, 200);
}
void DreamGenContext::worktoscreen() {
void DreamGenContext::workToScreen() {
workToScreenCPP();
uint size = 320 * 200;
di = si = size;
cx = 0;
}
void DreamGenContext::printundermon() {
void DreamGenContext::printUnderMon() {
engine->printUnderMonitor();
}
@ -113,7 +113,7 @@ void DreamGenContext::cls() {
engine->cls();
}
void DreamGenContext::frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
void DreamGenContext::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
dst += pitch * y + x;
for (uint16 j = 0; j < height; ++j) {
@ -123,7 +123,7 @@ void DreamGenContext::frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
void DreamGenContext::frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
void DreamGenContext::frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
uint16 stride = pitch - width;
dst += y * pitch + x;
@ -139,7 +139,7 @@ void DreamGenContext::frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
void DreamGenContext::frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
void DreamGenContext::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
uint16 stride = pitch - width;
dst += y * pitch + x;
dst -= width;
@ -156,7 +156,7 @@ void DreamGenContext::frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
void DreamGenContext::doshake() {
void DreamGenContext::doShake() {
uint8 &counter = data.byte(kShakecounter);
if (counter == 48)
return;
@ -185,7 +185,7 @@ void DreamGenContext::doshake() {
engine->setShakePos(offset >= 0 ? offset : -offset);
}
void DreamGenContext::vsync() {
void DreamGenContext::vSync() {
push(ax);
push(bx);
push(cx);
@ -205,8 +205,8 @@ void DreamGenContext::vsync() {
ax = pop();
}
void DreamGenContext::setmode() {
vsync();
void DreamGenContext::setMode() {
vSync();
initGraphics(320, 200, false);
}
@ -219,7 +219,7 @@ static Common::String getFilename(Context &context) {
return name;
}
void DreamGenContext::showpcx() {
void DreamGenContext::showPCX() {
Common::String name = getFilename(*this);
Common::File pcxFile;
@ -228,7 +228,7 @@ void DreamGenContext::showpcx() {
return;
}
uint8 *maingamepal;
uint8 *mainGamePal;
int i, j;
// Read the 16-color palette into the 'maingamepal' buffer. Note that
@ -236,12 +236,12 @@ void DreamGenContext::showpcx() {
pcxFile.seek(16, SEEK_SET);
es = data.word(kBuffers);
maingamepal = es.ptr(kMaingamepal, 768);
pcxFile.read(maingamepal, 48);
mainGamePal = es.ptr(kMaingamepal, 768);
pcxFile.read(mainGamePal, 48);
memset(maingamepal + 48, 0xff, 720);
memset(mainGamePal + 48, 0xff, 720);
for (i = 0; i < 48; i++) {
maingamepal[i] >>= 2;
mainGamePal[i] >>= 2;
}
// Decode the image data.
@ -289,7 +289,7 @@ void DreamGenContext::showpcx() {
pcxFile.close();
}
void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
void DreamGenContext::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
// NB : These resilience checks were not in the original engine, but did they result in undefined behaviour
// or was something broken during porting to C++?
assert(pitch == 320);
@ -331,12 +331,12 @@ void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint
}
}
void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
void DreamGenContext::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
uint8 width, height;
showframe(frameData, x, y, frameNumber, effectsFlag, &width, &height);
showFrame(frameData, x, y, frameNumber, effectsFlag, &width, &height);
}
void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
void DreamGenContext::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
const Frame *frame = frameData + frameNumber;
if ((frame->width == 0) && (frame->height == 0)) {
*width = 0;
@ -344,12 +344,12 @@ void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint
return;
}
//notblankshow:
//notBlankShow:
if ((effectsFlag & 128) == 0) {
x += frame->x;
y += frame->y;
}
//skipoffsets:
//skipOffsets:
*width = frame->width;
*height = frame->height;
@ -360,45 +360,45 @@ void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint
x -= *width / 2;
y -= *height / 2;
}
if (effectsFlag & 64) { //diffdest
frameoutfx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
if (effectsFlag & 64) { //diffDest
frameOutFx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
return;
}
if (effectsFlag & 8) { //printlist
if (effectsFlag & 8) { //printList
/*
push(ax);
al = x - data.word(kMapadx);
ah = y - data.word(kMapady);
//addtoprintlist(); // NB: Commented in the original asm
//addToPrintList(); // NB: Commented in the original asm
ax = pop();
*/
}
if (effectsFlag & 4) { //flippedx
frameoutfx(workspace(), pSrc, 320, *width, *height, x, y);
if (effectsFlag & 4) { //flippedX
frameOutFx(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
if (effectsFlag & 2) { //nomask
frameoutnm(workspace(), pSrc, 320, *width, *height, x, y);
if (effectsFlag & 2) { //noMask
frameOutNm(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
if (effectsFlag & 32) {
frameoutbh(workspace(), pSrc, 320, *width, *height, x, y);
frameOutBh(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
}
//noeffects:
frameoutv(workspace(), pSrc, 320, *width, *height, x, y);
//noEffects:
frameOutV(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
void DreamGenContext::showframe() {
void DreamGenContext::showFrame() {
uint8 width, height;
showframe((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height);
showFrame((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height);
cl = width;
ch = height;
}
void DreamGenContext::clearwork() {
void DreamGenContext::clearWork() {
memset(workspace(), 0, 320*200);
}
@ -408,7 +408,7 @@ void DreamGenContext::zoom() {
if (data.byte(kZoomon) != 1)
return;
if (data.byte(kCommandtype) >= 199) {
putunderzoom();
putUnderZoom();
return;
}
uint16 srcOffset = (data.word(kOldpointery) - 9) * 320 + (data.word(kOldpointerx) - 11);
@ -430,19 +430,19 @@ void DreamGenContext::zoom() {
data.byte(kDidzoom) = 1;
}
void DreamGenContext::paneltomap() {
multiget(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
void DreamGenContext::panelToMap() {
multiGet(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
}
void DreamGenContext::maptopanel() {
multiput(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
void DreamGenContext::mapToPanel() {
multiPut(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
}
void DreamGenContext::dumpmap() {
multidump(data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
void DreamGenContext::dumpMap() {
multiDump(data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
}
void DreamGenContext::transferinv() {
void DreamGenContext::transferInv() {
const Frame *freeFrames = (const Frame *)segRef(data.word(kFreeframes)).ptr(kFrframedata, 0);
const Frame *freeFrame = freeFrames + (3 * data.byte(kItemtotran) + 1);
Frame *exFrames = (Frame *)segRef(data.word(kExtras)).ptr(kExframedata, 0);
@ -459,23 +459,23 @@ void DreamGenContext::transferinv() {
data.word(kExframepos) += byteCount;
}
bool DreamGenContext::pixelcheckset(const ObjPos *pos, uint8 x, uint8 y) {
bool DreamGenContext::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) {
x -= pos->xMin;
y -= pos->yMin;
SetObject *setObject = getsetad(pos->index);
SetObject *setObject = getSetAd(pos->index);
Frame *frame = (Frame *)segRef(data.word(kSetframes)).ptr(kFramedata, 0) + setObject->index;
const uint8 *ptr = segRef(data.word(kSetframes)).ptr(kFrames, 0) + frame->ptr() + y * frame->width + x;
return *ptr != 0;
}
void DreamGenContext::loadpalfromiff() {
void DreamGenContext::loadPalFromIFF() {
dx = kPalettescreen;
openfile();
openFile();
cx = 2000;
ds = data.word(kMapstore);
dx = 0;
readfromfile();
closefile();
readFromFile();
closeFile();
const uint8 *src = segRef(data.word(kMapstore)).ptr(0x30, 0);
uint8 *dst = mainPalette();
@ -492,19 +492,19 @@ void DreamGenContext::loadpalfromiff() {
}
}
void DreamGenContext::createpanel() {
void DreamGenContext::createPanel() {
Frame *icons = (Frame *)segRef(data.word(kIcons2)).ptr(0, 0);
showframe(icons, 0, 8, 0, 2);
showframe(icons, 160, 8, 0, 2);
showframe(icons, 0, 104, 0, 2);
showframe(icons, 160, 104, 0, 2);
showFrame(icons, 0, 8, 0, 2);
showFrame(icons, 160, 8, 0, 2);
showFrame(icons, 0, 104, 0, 2);
showFrame(icons, 160, 104, 0, 2);
}
void DreamGenContext::createpanel2() {
createpanel();
void DreamGenContext::createPanel2() {
createPanel();
Frame *icons = (Frame *)segRef(data.word(kIcons2)).ptr(0, 0);
showframe(icons, 0, 0, 5, 2);
showframe(icons, 160, 0, 5, 2);
showFrame(icons, 0, 0, 5, 2);
showFrame(icons, 160, 0, 5, 2);
}
} /*namespace dreamgen */