DREAMWEB: Streamline graphics file access
This commit is contained in:
parent
8ed39a2b9e
commit
90cb52b7f6
19 changed files with 408 additions and 346 deletions
|
@ -250,6 +250,11 @@ p = parser(skip_binary_data = [
|
|||
'puzzletext',
|
||||
'commandtext',
|
||||
'traveltext',
|
||||
'tempgraphics',
|
||||
'tempgraphics2',
|
||||
'tempgraphics3',
|
||||
'tempsprites',
|
||||
'charset1',
|
||||
# vars.asm - constants
|
||||
'openinvlist',
|
||||
'ryaninvlist',
|
||||
|
|
|
@ -99,15 +99,14 @@ uint8 DreamBase::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void DreamBase::calcFrFrame(const Frame *frameBase, uint16 frameNum, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) {
|
||||
const Frame *frame = frameBase + frameNum;
|
||||
*width = frame->width;
|
||||
*height = frame->height;
|
||||
void DreamBase::calcFrFrame(const Frame &frame, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) {
|
||||
*width = frame.width;
|
||||
*height = frame.height;
|
||||
|
||||
objPos->xMin = (x + frame->x) & 0xff;
|
||||
objPos->yMin = (y + frame->y) & 0xff;
|
||||
objPos->xMax = objPos->xMin + frame->width;
|
||||
objPos->yMax = objPos->yMin + frame->height;
|
||||
objPos->xMin = (x + frame.x) & 0xff;
|
||||
objPos->yMin = (y + frame.y) & 0xff;
|
||||
objPos->xMax = objPos->xMin + frame.width;
|
||||
objPos->yMax = objPos->yMin + frame.height;
|
||||
}
|
||||
|
||||
void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) {
|
||||
|
@ -115,7 +114,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) {
|
|||
return;
|
||||
uint8 priority = objData->priority;
|
||||
uint8 type = objData->type;
|
||||
Sprite *sprite = makeSprite(x, y, addr_backobject, data.word(kSetframes), 0);
|
||||
Sprite *sprite = makeSprite(x, y, addr_backobject, &_setFrames, 0);
|
||||
|
||||
uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0);
|
||||
assert(objDataOffset % sizeof(SetObject) == 0);
|
||||
|
@ -135,7 +134,7 @@ void DreamBase::showAllObs() {
|
|||
|
||||
_setList.clear();
|
||||
|
||||
const Frame *frameBase = (const Frame *)getSegment(data.word(kSetframes)).ptr(0, 0);
|
||||
const GraphicsFile &frameBase = _setFrames;
|
||||
SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, count * sizeof(SetObject));
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
SetObject *setEntry = setEntries + i;
|
||||
|
@ -147,7 +146,7 @@ void DreamBase::showAllObs() {
|
|||
continue;
|
||||
uint8 width, height;
|
||||
ObjPos objPos;
|
||||
calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
|
||||
calcFrFrame(frameBase._frames[currentFrame], &width, &height, x, y, &objPos);
|
||||
setEntry->index = setEntry->frames[0];
|
||||
if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) {
|
||||
x += data.word(kMapadx);
|
||||
|
@ -218,7 +217,7 @@ void DreamBase::showAllFree() {
|
|||
_freeList.clear();
|
||||
|
||||
const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
|
||||
const Frame *frameBase = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
|
||||
const GraphicsFile &frameBase = _freeFrames;
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
uint16 x, y;
|
||||
uint8 mapAd = getMapAd(freeObjects[i].mapad, &x, &y);
|
||||
|
@ -226,7 +225,7 @@ void DreamBase::showAllFree() {
|
|||
uint8 width, height;
|
||||
ObjPos objPos;
|
||||
uint16 currentFrame = 3 * i;
|
||||
calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
|
||||
calcFrFrame(frameBase._frames[currentFrame], &width, &height, x, y, &objPos);
|
||||
if ((width != 0) || (height != 0)) {
|
||||
x += data.word(kMapadx);
|
||||
y += data.word(kMapady);
|
||||
|
@ -274,7 +273,7 @@ void DreamBase::showAllEx() {
|
|||
uint8 width, height;
|
||||
ObjPos objPos;
|
||||
uint16 currentFrame = 3 * i;
|
||||
calcFrFrame(frameBase, currentFrame, &width, &height, x, y, &objPos);
|
||||
calcFrFrame(frameBase[currentFrame], &width, &height, x, y, &objPos);
|
||||
if ((width != 0) || (height != 0)) {
|
||||
assert(currentFrame < 256);
|
||||
showFrame(frameBase, x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0);
|
||||
|
|
|
@ -131,6 +131,21 @@ protected:
|
|||
TextFile _puzzleText;
|
||||
TextFile _commandText;
|
||||
|
||||
// graphics files
|
||||
GraphicsFile _tempGraphics;
|
||||
GraphicsFile _tempGraphics2;
|
||||
GraphicsFile _tempGraphics3;
|
||||
GraphicsFile _icons1;
|
||||
GraphicsFile _icons2;
|
||||
GraphicsFile _tempCharset;
|
||||
GraphicsFile _charset1;
|
||||
GraphicsFile _mainSprites;
|
||||
const GraphicsFile *_currentCharset;
|
||||
|
||||
// room graphics files
|
||||
GraphicsFile _setFrames;
|
||||
GraphicsFile _freeFrames;
|
||||
|
||||
public:
|
||||
DreamBase(DreamWeb::DreamWebEngine *en);
|
||||
|
||||
|
@ -146,7 +161,7 @@ public:
|
|||
uint8 getXAd(const uint8 *setData, uint8 *result);
|
||||
uint8 getYAd(const uint8 *setData, uint8 *result);
|
||||
uint8 getMapAd(const uint8 *setData, uint16 *x, uint16 *y);
|
||||
void calcFrFrame(const Frame *frameBase, uint16 frameNum, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos);
|
||||
void calcFrFrame(const Frame &frame, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos);
|
||||
void makeBackOb(SetObject *objData, uint16 x, uint16 y);
|
||||
void showAllObs();
|
||||
void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize);
|
||||
|
@ -348,13 +363,13 @@ public:
|
|||
void poolGuard(ReelRoutine &routine);
|
||||
|
||||
// from print.cpp
|
||||
uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
|
||||
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 printBoth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
|
||||
uint8 getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
|
||||
void printChar(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
|
||||
void printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
|
||||
void printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
|
||||
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);
|
||||
uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
|
||||
uint8 getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
|
||||
uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
|
||||
uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
|
||||
uint16 waitFrames();
|
||||
|
@ -403,7 +418,7 @@ public:
|
|||
void printSprites();
|
||||
void printASprite(const Sprite *sprite);
|
||||
void clearSprites();
|
||||
Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
|
||||
Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi);
|
||||
void initMan();
|
||||
void walking(Sprite *sprite);
|
||||
void aboutTurn(Sprite *sprite);
|
||||
|
@ -462,9 +477,6 @@ public:
|
|||
void showRyanPage();
|
||||
void switchRyanOn();
|
||||
void switchRyanOff();
|
||||
Frame *tempGraphics();
|
||||
Frame *tempGraphics2();
|
||||
Frame *tempGraphics3();
|
||||
void middlePanel();
|
||||
void showDiary();
|
||||
void readMouse();
|
||||
|
@ -492,6 +504,7 @@ public:
|
|||
void deallocateMem(uint16 segment);
|
||||
uint16 allocateAndLoad(unsigned int size);
|
||||
void loadTextFile(TextFile &file, const char *fileName);
|
||||
void loadGraphicsFile(GraphicsFile &file, const char *fileName);
|
||||
uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
|
||||
void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
|
||||
void loadIntoTemp(const char *fileName);
|
||||
|
@ -550,7 +563,6 @@ public:
|
|||
void getRidOfTemp2();
|
||||
void getRidOfTemp3();
|
||||
void getRidOfTempCharset();
|
||||
void getRidOfTempsP();
|
||||
void getRidOfAll();
|
||||
void placeSetObject(uint8 index);
|
||||
void removeSetObject(uint8 index);
|
||||
|
@ -832,6 +844,9 @@ public:
|
|||
void vSync();
|
||||
void setMode();
|
||||
void showPCX(const Common::String &name);
|
||||
void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height);
|
||||
void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
|
||||
void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
|
||||
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);
|
||||
bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y);
|
||||
|
|
|
@ -65,13 +65,13 @@ void DreamGenContext::__start() {
|
|||
//0x0100: .... .... .... ....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
//0x0110: .... .... .... ....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
//0x0120: .... .... .... ....
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00,
|
||||
//0x0130: .... .... .... ....
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
//0x0140: .... .... .... ....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, };
|
||||
0x00, 0xff, };
|
||||
ds.assign(src, src + sizeof(src));
|
||||
dreamweb();
|
||||
}
|
||||
|
|
|
@ -251,45 +251,40 @@ static const uint16 kBufferin = 276;
|
|||
static const uint16 kBufferout = 278;
|
||||
static const uint16 kExtras = 280;
|
||||
static const uint16 kWorkspace = 282;
|
||||
static const uint16 kCharset1 = 284;
|
||||
static const uint16 kMainsprites = 286;
|
||||
static const uint16 kBackdrop = 288;
|
||||
static const uint16 kRecordspace = 290;
|
||||
static const uint16 kFreedat = 292;
|
||||
static const uint16 kSetdat = 294;
|
||||
static const uint16 kReel1 = 296;
|
||||
static const uint16 kReel2 = 298;
|
||||
static const uint16 kReel3 = 300;
|
||||
static const uint16 kRoomdesc = 302;
|
||||
static const uint16 kFreedesc = 304;
|
||||
static const uint16 kSetdesc = 306;
|
||||
static const uint16 kBlockdesc = 308;
|
||||
static const uint16 kSetframes = 310;
|
||||
static const uint16 kFreeframes = 312;
|
||||
static const uint16 kPeople = 314;
|
||||
static const uint16 kReels = 316;
|
||||
static const uint16 kTempgraphics = 318;
|
||||
static const uint16 kTempgraphics2 = 320;
|
||||
static const uint16 kTempgraphics3 = 322;
|
||||
static const uint16 kTempsprites = 324;
|
||||
static const uint16 kBlinkframe = 326;
|
||||
static const uint16 kBlinkcount = 327;
|
||||
static const uint16 kReasseschanges = 328;
|
||||
static const uint16 kPointerspath = 329;
|
||||
static const uint16 kManspath = 330;
|
||||
static const uint16 kPointerfirstpath = 331;
|
||||
static const uint16 kFinaldest = 332;
|
||||
static const uint16 kDestination = 333;
|
||||
static const uint16 kLinestartx = 334;
|
||||
static const uint16 kLinestarty = 336;
|
||||
static const uint16 kLineendx = 338;
|
||||
static const uint16 kLineendy = 340;
|
||||
static const uint16 kLinepointer = 342;
|
||||
static const uint16 kLinedirection = 343;
|
||||
static const uint16 kLinelength = 344;
|
||||
static const uint16 kCh0playing = 345;
|
||||
static const uint16 kCh0repeat = 346;
|
||||
static const uint16 kCh1playing = 347;
|
||||
static const uint16 kMainsprites = 284;
|
||||
static const uint16 kBackdrop = 286;
|
||||
static const uint16 kRecordspace = 288;
|
||||
static const uint16 kFreedat = 290;
|
||||
static const uint16 kSetdat = 292;
|
||||
static const uint16 kReel1 = 294;
|
||||
static const uint16 kReel2 = 296;
|
||||
static const uint16 kReel3 = 298;
|
||||
static const uint16 kRoomdesc = 300;
|
||||
static const uint16 kFreedesc = 302;
|
||||
static const uint16 kSetdesc = 304;
|
||||
static const uint16 kBlockdesc = 306;
|
||||
static const uint16 kSetframes = 308;
|
||||
static const uint16 kFreeframes = 310;
|
||||
static const uint16 kPeople = 312;
|
||||
static const uint16 kReels = 314;
|
||||
static const uint16 kBlinkframe = 316;
|
||||
static const uint16 kBlinkcount = 317;
|
||||
static const uint16 kReasseschanges = 318;
|
||||
static const uint16 kPointerspath = 319;
|
||||
static const uint16 kManspath = 320;
|
||||
static const uint16 kPointerfirstpath = 321;
|
||||
static const uint16 kFinaldest = 322;
|
||||
static const uint16 kDestination = 323;
|
||||
static const uint16 kLinestartx = 324;
|
||||
static const uint16 kLinestarty = 326;
|
||||
static const uint16 kLineendx = 328;
|
||||
static const uint16 kLineendy = 330;
|
||||
static const uint16 kLinepointer = 332;
|
||||
static const uint16 kLinedirection = 333;
|
||||
static const uint16 kLinelength = 334;
|
||||
static const uint16 kCh0playing = 335;
|
||||
static const uint16 kCh0repeat = 336;
|
||||
static const uint16 kCh1playing = 337;
|
||||
static const uint16 kBlocktextdat = (0);
|
||||
static const uint16 kPersonframes = (0);
|
||||
static const uint16 kDebuglevel1 = (0);
|
||||
|
|
|
@ -58,18 +58,10 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
|
|||
_channel0 = 0;
|
||||
_channel1 = 0;
|
||||
|
||||
_icons1 = NULL;
|
||||
_icons2 = NULL;
|
||||
_tempCharset = NULL;
|
||||
|
||||
_language = gameDesc->desc.language;
|
||||
}
|
||||
|
||||
DreamWebEngine::~DreamWebEngine() {
|
||||
assert(_icons1 == NULL);
|
||||
assert(_icons2 == NULL);
|
||||
assert(_tempCharset == NULL);
|
||||
|
||||
DebugMan.clearAllDebugChannels();
|
||||
delete _console;
|
||||
}
|
||||
|
@ -421,6 +413,8 @@ DreamBase::DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) {
|
|||
|
||||
_currentSample = 0xff;
|
||||
|
||||
_backdropBlocks = 0;
|
||||
|
||||
_oldSubject._type = 0;
|
||||
_oldSubject._index = 0;
|
||||
}
|
||||
|
|
|
@ -125,20 +125,6 @@ public:
|
|||
|
||||
void stopSound(uint8 channel);
|
||||
|
||||
DreamGen::Frame *icons1() const { return (DreamGen::Frame *)_icons1; }
|
||||
DreamGen::Frame *icons2() const { return (DreamGen::Frame *)_icons2; }
|
||||
void setIcons1(void *frames) { assert(_icons1 == NULL); _icons1 = frames; }
|
||||
void setIcons2(void *frames) { assert(_icons2 == NULL); _icons2 = frames; }
|
||||
void freeIcons1() { free(_icons1); _icons1 = NULL; }
|
||||
void freeIcons2() { free(_icons2); _icons2 = NULL; }
|
||||
|
||||
DreamGen::Frame *tempCharset() const { return (DreamGen::Frame *)_tempCharset; }
|
||||
void setTempCharset(void *frames) { assert(_tempCharset == NULL); _tempCharset = frames; }
|
||||
void freeTempCharset() { free(_tempCharset); _tempCharset = NULL; }
|
||||
|
||||
DreamGen::Frame *currentCharset() const { return _currentCharset; }
|
||||
void setCurrentCharset(DreamGen::Frame *charset) { _currentCharset = charset; }
|
||||
|
||||
private:
|
||||
void keyPressed(uint16 ascii);
|
||||
void setSpeed(uint speed);
|
||||
|
@ -173,11 +159,6 @@ private:
|
|||
Audio::SoundHandle _channelHandle[2];
|
||||
uint8 _channel0, _channel1;
|
||||
|
||||
void *_icons1;
|
||||
void *_icons2;
|
||||
void *_tempCharset;
|
||||
DreamGen::Frame *_currentCharset;
|
||||
|
||||
DreamGen::DreamGenContext _context;
|
||||
DreamGen::DreamBase &_base;
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) {
|
|||
key -= 11;
|
||||
}
|
||||
key -= 20;
|
||||
showFrame(tempGraphics(), x, y, key, 0);
|
||||
showFrame(_tempGraphics, x, y, key, 0);
|
||||
}
|
||||
|
||||
void DreamBase::loadKeypad() {
|
||||
|
@ -71,7 +71,7 @@ void DreamBase::showKeypad() {
|
|||
}
|
||||
if ((data.byte(kLightcount) >= 60) && (data.byte(kLightcount) < 100))
|
||||
--frameIndex;
|
||||
showFrame(tempGraphics(), kKeypadx+60, y, frameIndex, 0);
|
||||
showFrame(_tempGraphics, kKeypadx+60, y, frameIndex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,8 +224,8 @@ void DreamBase::buttonPress(uint8 buttonId) {
|
|||
}
|
||||
|
||||
void DreamBase::showOuterPad() {
|
||||
showFrame(tempGraphics(), kKeypadx-3, kKeypady-4, 1, 0);
|
||||
showFrame(tempGraphics(), kKeypadx+74, kKeypady+76, 37, 0);
|
||||
showFrame(_tempGraphics, kKeypadx-3, kKeypady-4, 1, 0);
|
||||
showFrame(_tempGraphics, kKeypadx+74, kKeypady+76, 37, 0);
|
||||
}
|
||||
|
||||
void DreamBase::dumpKeypad() {
|
||||
|
|
|
@ -188,14 +188,14 @@ void DreamBase::monitorLogo() {
|
|||
}
|
||||
|
||||
void DreamBase::printLogo() {
|
||||
showFrame(tempGraphics(), 56, 32, 0, 0);
|
||||
showFrame(_tempGraphics, 56, 32, 0, 0);
|
||||
showCurrentFile();
|
||||
}
|
||||
|
||||
void DreamBase::input() {
|
||||
memset(_inputLine, 0, 64);
|
||||
data.word(kCurpos) = 0;
|
||||
printChar(engine->tempCharset(), data.word(kMonadx), data.word(kMonady), '>', 0, NULL, NULL);
|
||||
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);
|
||||
|
@ -227,7 +227,7 @@ void DreamBase::input() {
|
|||
continue;
|
||||
multiGet(_mapStore + data.word(kCurpos) * 256, data.word(kMonadx), data.word(kMonady), 8, 8);
|
||||
uint8 charWidth;
|
||||
printChar(engine->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);
|
||||
|
@ -266,7 +266,7 @@ void DreamBase::printCurs() {
|
|||
multiGet(_textUnder, x, y, 6, height);
|
||||
++data.word(kMaintimer);
|
||||
if ((data.word(kMaintimer) & 16) == 0)
|
||||
showFrame(engine->tempCharset(), x, y, '/' - 32, 0);
|
||||
showFrame(_tempCharset, x, y, '/' - 32, 0);
|
||||
multiDump(x - 6, y, 12, height);
|
||||
}
|
||||
|
||||
|
@ -297,17 +297,17 @@ void DreamBase::showCurrentFile() {
|
|||
while (*currentFile) {
|
||||
char c = *currentFile++;
|
||||
c = engine->modifyChar(c);
|
||||
printChar(engine->tempCharset(), &x, 37, c, 0, NULL, NULL);
|
||||
printChar(_tempCharset, &x, 37, c, 0, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::accessLightOn() {
|
||||
showFrame(tempGraphics(), 74, 182, 8, 0);
|
||||
showFrame(_tempGraphics, 74, 182, 8, 0);
|
||||
multiDump(74, 182, 12, 8);
|
||||
}
|
||||
|
||||
void DreamBase::accessLightOff() {
|
||||
showFrame(tempGraphics(), 74, 182, 7, 0);
|
||||
showFrame(_tempGraphics, 74, 182, 7, 0);
|
||||
multiDump(74, 182, 12, 8);
|
||||
}
|
||||
|
||||
|
@ -340,22 +340,22 @@ void DreamBase::netError() {
|
|||
}
|
||||
|
||||
void DreamBase::powerLightOn() {
|
||||
showFrame(tempGraphics(), 257+4, 182, 6, 0);
|
||||
showFrame(_tempGraphics, 257+4, 182, 6, 0);
|
||||
multiDump(257+4, 182, 12, 8);
|
||||
}
|
||||
|
||||
void DreamBase::powerLightOff() {
|
||||
showFrame(tempGraphics(), 257+4, 182, 5, 0);
|
||||
showFrame(_tempGraphics, 257+4, 182, 5, 0);
|
||||
multiDump(257+4, 182, 12, 8);
|
||||
}
|
||||
|
||||
void DreamBase::lockLightOn() {
|
||||
showFrame(tempGraphics(), 56, 182, 10, 0);
|
||||
showFrame(_tempGraphics, 56, 182, 10, 0);
|
||||
multiDump(58, 182, 12, 8);
|
||||
}
|
||||
|
||||
void DreamBase::lockLightOff() {
|
||||
showFrame(tempGraphics(), 56, 182, 9, 0);
|
||||
showFrame(_tempGraphics, 56, 182, 9, 0);
|
||||
multiDump(58, 182, 12, 8);
|
||||
}
|
||||
|
||||
|
@ -370,10 +370,10 @@ void DreamBase::turnOnPower() {
|
|||
}
|
||||
|
||||
void DreamBase::printOuterMon() {
|
||||
showFrame(tempGraphics(), 40, 32, 1, 0);
|
||||
showFrame(tempGraphics(), 264, 32, 2, 0);
|
||||
showFrame(tempGraphics(), 40, 12, 3, 0);
|
||||
showFrame(tempGraphics(), 40, 164, 4, 0);
|
||||
showFrame(_tempGraphics, 40, 32, 1, 0);
|
||||
showFrame(_tempGraphics, 264, 32, 2, 0);
|
||||
showFrame(_tempGraphics, 40, 12, 3, 0);
|
||||
showFrame(_tempGraphics, 40, 164, 4, 0);
|
||||
}
|
||||
|
||||
void DreamBase::loadPersonal() {
|
||||
|
|
|
@ -98,8 +98,8 @@ void DreamBase::selectLocation() {
|
|||
|
||||
void DreamBase::showCity() {
|
||||
clearWork();
|
||||
showFrame(tempGraphics(), 57, 32, 0, 0);
|
||||
showFrame(tempGraphics(), 120+57, 32, 1, 0);
|
||||
showFrame(_tempGraphics, 57, 32, 0, 0);
|
||||
showFrame(_tempGraphics, 120+57, 32, 1, 0);
|
||||
}
|
||||
|
||||
void DreamBase::lookAtPlace() {
|
||||
|
@ -116,10 +116,10 @@ void DreamBase::lookAtPlace() {
|
|||
delPointer();
|
||||
delTextLine();
|
||||
getUnderCentre();
|
||||
showFrame(tempGraphics3(), 60, 72, 0, 0);
|
||||
showFrame(tempGraphics3(), 60, 72 + 55, 4, 0);
|
||||
showFrame(_tempGraphics3, 60, 72, 0, 0);
|
||||
showFrame(_tempGraphics3, 60, 72 + 55, 4, 0);
|
||||
if (_foreignRelease)
|
||||
showFrame(tempGraphics3(), 60, 72+55+21, 4, 0);
|
||||
showFrame(_tempGraphics3, 60, 72+55+21, 4, 0);
|
||||
|
||||
const uint8 *string = (const uint8 *)_travelText.getString(data.byte(kDestpos));
|
||||
findNextColon(&string);
|
||||
|
@ -146,21 +146,21 @@ void DreamBase::locationPic() {
|
|||
byte picture = roomPics[data.byte(kDestpos)];
|
||||
|
||||
if (picture >= 6)
|
||||
showFrame(tempGraphics2(), 104, 138 + 14, picture - 6, 0); // Second slot
|
||||
showFrame(_tempGraphics2, 104, 138 + 14, picture - 6, 0); // Second slot
|
||||
else
|
||||
showFrame(tempGraphics(), 104, 138 + 14, picture + 4, 0);
|
||||
showFrame(_tempGraphics, 104, 138 + 14, picture + 4, 0);
|
||||
|
||||
if (data.byte(kDestpos) == data.byte(kReallocation))
|
||||
showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location
|
||||
showFrame(_tempGraphics, 104, 140 + 14, 3, 0); // Currently in this location
|
||||
|
||||
const uint8 *string = (const uint8 *)_travelText.getString(data.byte(kDestpos));
|
||||
DreamBase::printDirect(string, 50, 20, 241, 241 & 1);
|
||||
}
|
||||
|
||||
void DreamBase::showArrows() {
|
||||
showFrame(tempGraphics(), 116 - 12, 16, 0, 0);
|
||||
showFrame(tempGraphics(), 226 + 12, 16, 1, 0);
|
||||
showFrame(tempGraphics(), 280, 14, 2, 0);
|
||||
showFrame(_tempGraphics, 116 - 12, 16, 0, 0);
|
||||
showFrame(_tempGraphics, 226 + 12, 16, 1, 0);
|
||||
showFrame(_tempGraphics, 280, 14, 2, 0);
|
||||
}
|
||||
|
||||
void DreamBase::nextDest() {
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
namespace DreamGen {
|
||||
|
||||
void DreamBase::showRyanPage() {
|
||||
showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0);
|
||||
showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0);
|
||||
showFrame(_icons1, kInventx + 167, kInventy - 12, 12, 0);
|
||||
showFrame(_icons1, kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0);
|
||||
}
|
||||
|
||||
void DreamBase::findAllRyan() {
|
||||
|
@ -79,30 +79,32 @@ void DreamBase::makeWorn(DynObject *object) {
|
|||
}
|
||||
|
||||
void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
|
||||
showFrame(engine->icons1(), x - 2, y - 1, 10, 0);
|
||||
showFrame(_icons1, x - 2, y - 1, 10, 0);
|
||||
if (index == 0xff)
|
||||
return;
|
||||
|
||||
Frame *extras = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
Frame *frees = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
|
||||
Frame *frames = (flag == 4) ? extras : frees;
|
||||
showFrame(frames, x + 18, y + 19, 3 * index + 1, 128);
|
||||
if (flag == kExObjectType) {
|
||||
Frame *extras = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
showFrame(extras, x + 18, y + 19, 3 * index + 1, 128);
|
||||
} else {
|
||||
showFrame(_freeFrames, x + 18, y + 19, 3 * index + 1, 128);
|
||||
}
|
||||
const DynObject *object = (const DynObject *)getAnyAdDir(index, flag);
|
||||
bool worn = isItWorn(object);
|
||||
if (worn)
|
||||
showFrame(engine->icons1(), x - 3, y - 2, 7, 0);
|
||||
showFrame(_icons1, x - 3, y - 2, 7, 0);
|
||||
}
|
||||
|
||||
void DreamBase::obPicture() {
|
||||
if (data.byte(kObjecttype) == kSetObjectType1)
|
||||
return;
|
||||
Frame *frames;
|
||||
if (data.byte(kObjecttype) == kExObjectType)
|
||||
frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
else
|
||||
frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
|
||||
uint8 frame = 3 * data.byte(kCommand) + 1;
|
||||
showFrame(frames, 160, 68, frame, 0x80);
|
||||
if (data.byte(kObjecttype) == kExObjectType) {
|
||||
const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
showFrame(frames, 160, 68, frame, 0x80);
|
||||
} else {
|
||||
showFrame(_freeFrames, 160, 68, frame, 0x80);
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::obIcons() {
|
||||
|
@ -110,10 +112,10 @@ void DreamBase::obIcons() {
|
|||
getAnyAd(&value1, &value2);
|
||||
if (value1 != 0xff) {
|
||||
// can open it
|
||||
showFrame(engine->icons2(), 210, 1, 4, 0);
|
||||
showFrame(_icons2, 210, 1, 4, 0);
|
||||
}
|
||||
|
||||
showFrame(engine->icons2(), 260, 1, 1, 0);
|
||||
showFrame(_icons2, 260, 1, 1, 0);
|
||||
}
|
||||
|
||||
void DreamBase::examineOb(bool examineAgain) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace DreamGen {
|
||||
|
||||
void DreamBase::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
|
||||
void DreamBase::printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
|
||||
uint16 newX = *x;
|
||||
uint8 width, height;
|
||||
printChar(charSet, &newX, y, c, nextChar, &width, &height);
|
||||
|
@ -32,7 +32,7 @@ void DreamBase::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, ui
|
|||
*x = newX;
|
||||
}
|
||||
|
||||
uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
|
||||
uint8 DreamBase::getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
|
||||
*totalWidth = 0;
|
||||
*charCount = 0;
|
||||
while (true) {
|
||||
|
@ -50,14 +50,14 @@ uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *t
|
|||
firstChar = engine->modifyChar(firstChar);
|
||||
if (firstChar != 255) {
|
||||
uint8 secondChar = *string;
|
||||
uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
|
||||
uint8 width = charSet._frames[firstChar - 32 + data.word(kCharshift)].width;
|
||||
width = kernChars(firstChar, secondChar, width);
|
||||
*totalWidth += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
|
||||
void DreamBase::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
|
||||
if (c == 255)
|
||||
return;
|
||||
|
||||
|
@ -75,23 +75,22 @@ void DreamBase::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, ui
|
|||
(*x) += *width;
|
||||
}
|
||||
|
||||
void DreamBase::printChar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
|
||||
void DreamBase::printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
|
||||
printChar(charSet, &x, y, c, nextChar, width, height);
|
||||
}
|
||||
|
||||
uint8 DreamBase::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 *)getSegment(data.word(kCharset1)).ptr(0, 0);
|
||||
do {
|
||||
uint16 offset = x;
|
||||
uint16 charCount = getNumber(charSet, string, maxWidth, centered, &offset);
|
||||
uint16 charCount = getNumber(_charset1, 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(_charset1, &offset, y, c0, c1);
|
||||
if ((c1 == 0) || (c1 == ':')) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,7 +98,7 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid
|
|||
c1 = engine->modifyChar(c1);
|
||||
data.word(kCharshift) = 91;
|
||||
uint16 offset2 = offset;
|
||||
printBoth(charSet, &offset2, y, c1, c2);
|
||||
printBoth(_charset1, &offset2, y, c1, c2);
|
||||
data.word(kCharshift) = 0;
|
||||
for (int i=0; i<2; ++i) {
|
||||
uint16 mouseState = waitFrames();
|
||||
|
@ -126,7 +125,7 @@ uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxW
|
|||
|
||||
uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
|
||||
data.word(kLastxpos) = x;
|
||||
const Frame *charSet = engine->currentCharset();
|
||||
const GraphicsFile &charSet = *_currentCharset;
|
||||
while (true) {
|
||||
uint16 offset = x;
|
||||
uint8 charCount = getNumber(charSet, *string, maxWidth, centered, &offset);
|
||||
|
@ -148,7 +147,7 @@ uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 ma
|
|||
}
|
||||
}
|
||||
|
||||
uint8 DreamBase::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
|
||||
uint8 DreamBase::getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
|
||||
uint8 totalWidth = 0;
|
||||
uint8 charCount = 0;
|
||||
while (true) {
|
||||
|
@ -207,12 +206,11 @@ uint16 DreamBase::waitFrames() {
|
|||
const char *DreamBase::monPrint(const char *string) {
|
||||
data.byte(kKerning) = 1;
|
||||
uint16 x = data.word(kMonadx);
|
||||
Frame *charset = engine->tempCharset();
|
||||
const char *iterator = string;
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
|
||||
uint16 count = getNumber(charset, (const uint8 *)iterator, 166, false, &x);
|
||||
uint16 count = getNumber(_tempCharset, (const uint8 *)iterator, 166, false, &x);
|
||||
do {
|
||||
char c = *iterator++;
|
||||
if (c == ':')
|
||||
|
@ -228,7 +226,7 @@ const char *DreamBase::monPrint(const char *string) {
|
|||
break;
|
||||
}
|
||||
c = engine->modifyChar(c);
|
||||
printChar(charset, &x, data.word(kMonady), c, 0, NULL, NULL);
|
||||
printChar(_tempCharset, &x, data.word(kMonady), c, 0, NULL, NULL);
|
||||
data.word(kCurslocx) = x;
|
||||
data.word(kCurslocy) = data.word(kMonady);
|
||||
data.word(kMaintimer) = 1;
|
||||
|
|
|
@ -118,9 +118,7 @@ void DreamBase::doLoad(int savegameId) {
|
|||
// If we reach this point, loadPosition() has just been called.
|
||||
// Among other things, it will have filled g_MadeUpRoomDat.
|
||||
|
||||
// kTempgraphics might not have been allocated if we bypassed all menus
|
||||
if (data.word(kTempgraphics) != 0xFFFF)
|
||||
getRidOfTemp();
|
||||
getRidOfTemp();
|
||||
|
||||
startLoading(g_madeUpRoomDat);
|
||||
loadRoomsSample();
|
||||
|
@ -338,16 +336,16 @@ void DreamBase::getBackToOps() {
|
|||
}
|
||||
|
||||
void DreamBase::showMainOps() {
|
||||
showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 8, 0);
|
||||
showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 7, 0);
|
||||
showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0);
|
||||
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 DreamBase::showDiscOps() {
|
||||
showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0);
|
||||
showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 9, 0);
|
||||
showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 10, 0);
|
||||
showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0);
|
||||
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 DreamBase::discOps() {
|
||||
|
@ -648,7 +646,7 @@ void DreamBase::loadOld() {
|
|||
void DreamBase::showDecisions() {
|
||||
createPanel2();
|
||||
showOpBox();
|
||||
showFrame(tempGraphics(), kOpsx + 17, kOpsy + 13, 6, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 17, kOpsy + 13, 6, 0);
|
||||
underTextLine();
|
||||
}
|
||||
|
||||
|
@ -750,35 +748,35 @@ void DreamBase::selectSlot() {
|
|||
}
|
||||
|
||||
void DreamBase::showSlots() {
|
||||
showFrame(tempGraphics(), kOpsx + 7, kOpsy + 8, 2, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
|
||||
|
||||
uint16 y = kOpsy + 11;
|
||||
|
||||
for (int slot = 0; slot < 7; slot++) {
|
||||
if (slot == data.byte(kCurrentslot))
|
||||
showFrame(tempGraphics(), kOpsx + 10, y, 3, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 10, y, 3, 0);
|
||||
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::showOpBox() {
|
||||
showFrame(tempGraphics(), kOpsx, kOpsy, 0, 0);
|
||||
showFrame(_tempGraphics, kOpsx, kOpsy, 0, 0);
|
||||
|
||||
// CHECKME: There seem to be versions of dreamweb in which this call
|
||||
// should be removed. It displays a red dot on the ops dialogs if left in.
|
||||
showFrame(tempGraphics(), kOpsx, kOpsy + 55, 4, 0);
|
||||
showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0);
|
||||
}
|
||||
|
||||
void DreamBase::showLoadOps() {
|
||||
showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
||||
showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
||||
printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1));
|
||||
}
|
||||
|
||||
void DreamBase::showSaveOps() {
|
||||
showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
||||
showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
|
||||
showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
|
||||
printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ void DreamBase::printASprite(const Sprite *sprite) {
|
|||
c = 8;
|
||||
else
|
||||
c = 0;
|
||||
showFrame((const Frame *)getSegment(sprite->_frameData).ptr(0, 0), x, y, sprite->frameNumber, c);
|
||||
showFrame(*sprite->_frameData, x, y, sprite->frameNumber, c);
|
||||
}
|
||||
|
||||
void DreamBase::clearSprites() {
|
||||
_spriteTable.clear();
|
||||
}
|
||||
|
||||
Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
|
||||
Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi) {
|
||||
// Note: the original didn't append sprites here, but filled up the
|
||||
// first unused entry. This can change the order of entries, but since they
|
||||
// are drawn based on the priority field, this shouldn't matter.
|
||||
|
@ -109,7 +109,7 @@ void DreamBase::spriteUpdate() {
|
|||
}
|
||||
|
||||
void DreamBase::initMan() {
|
||||
Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
|
||||
Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, &_mainSprites, 0);
|
||||
sprite->priority = 4;
|
||||
sprite->speed = 0;
|
||||
sprite->walkFrame = 0;
|
||||
|
@ -477,8 +477,7 @@ void DreamBase::showRain() {
|
|||
if (_rainList.empty())
|
||||
return;
|
||||
|
||||
const Frame *frame = (const Frame *)getSegment(data.word(kMainsprites)).ptr(58 * sizeof(Frame), sizeof(Frame));
|
||||
const uint8 *frameData = getSegment(data.word(kMainsprites)).ptr(kFrframes + frame->ptr(), 512);
|
||||
const uint8 *frameData = _mainSprites.getFrameData(58);
|
||||
|
||||
for (i = _rainList.begin(); i != _rainList.end(); ++i) {
|
||||
Rain &rain = *i;
|
||||
|
@ -1102,13 +1101,14 @@ void DreamBase::clearBeforeLoad() {
|
|||
//clearRest
|
||||
memset(_mapData, 0, kMaplen);
|
||||
delete[] _backdropBlocks;
|
||||
deallocateMem(data.word(kSetframes));
|
||||
_backdropBlocks = 0;
|
||||
_setFrames.clear();
|
||||
deallocateMem(data.word(kReels));
|
||||
deallocateMem(data.word(kPeople));
|
||||
deallocateMem(data.word(kSetdesc));
|
||||
deallocateMem(data.word(kBlockdesc));
|
||||
deallocateMem(data.word(kRoomdesc));
|
||||
deallocateMem(data.word(kFreeframes));
|
||||
_freeFrames.clear();
|
||||
deallocateMem(data.word(kFreedesc));
|
||||
|
||||
data.byte(kRoomloaded) = 0;
|
||||
|
|
|
@ -28,11 +28,13 @@
|
|||
|
||||
namespace DreamGen {
|
||||
|
||||
struct GraphicsFile;
|
||||
|
||||
struct Sprite {
|
||||
uint16 _updateCallback;
|
||||
uint16 w2;
|
||||
uint16 w4;
|
||||
uint16 _frameData;
|
||||
const GraphicsFile *_frameData;
|
||||
uint16 w8;
|
||||
uint8 x;
|
||||
uint8 y;
|
||||
|
@ -308,6 +310,24 @@ struct TextFile {
|
|||
}
|
||||
};
|
||||
|
||||
struct GraphicsFile {
|
||||
GraphicsFile() : _data(0) { }
|
||||
|
||||
Frame _frames[347];
|
||||
uint8 *_data;
|
||||
|
||||
const uint8 *getFrameData(unsigned int i) const {
|
||||
// There is 2080 bytes of Frame data, but that is between 346 and 347
|
||||
// frames
|
||||
assert(i < 346);
|
||||
return _data + _frames[i].ptr();
|
||||
}
|
||||
void clear() {
|
||||
delete[] _data;
|
||||
_data = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // End of namespace DreamWeb
|
||||
|
||||
|
|
|
@ -640,8 +640,22 @@ done: // The engine will need some cleaner finalization, let's put it here for n
|
|||
// FIXME: This triggers "Deallocating non existent segment" errors when
|
||||
// quitting from a menu.
|
||||
getRidOfAll();
|
||||
engine->freeIcons1();
|
||||
engine->freeIcons2();
|
||||
|
||||
_icons1.clear();
|
||||
_icons2.clear();
|
||||
_charset1.clear();
|
||||
_tempGraphics.clear();
|
||||
_tempGraphics2.clear();
|
||||
_tempGraphics3.clear();
|
||||
_tempCharset.clear();
|
||||
_mainSprites.clear();
|
||||
|
||||
_textFile1.clear();
|
||||
_textFile2.clear();
|
||||
_textFile3.clear();
|
||||
_travelText.clear();
|
||||
_puzzleText.clear();
|
||||
_commandText.clear();
|
||||
}
|
||||
|
||||
void DreamBase::loadTextFile(TextFile &file, const char *fileName)
|
||||
|
@ -775,20 +789,36 @@ void *DreamBase::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
void DreamBase::loadGraphicsFile(GraphicsFile &file, const char *fileName) {
|
||||
FileHeader header;
|
||||
|
||||
Common::File f;
|
||||
f.open(fileName);
|
||||
f.read((uint8 *)&header, sizeof(FileHeader));
|
||||
uint16 sizeInBytes = header.len(0);
|
||||
|
||||
assert(sizeInBytes >= 2080);
|
||||
delete[] file._data;
|
||||
file._data = new uint8[sizeInBytes - 2080];
|
||||
|
||||
f.read((uint8 *)file._frames, 2080);
|
||||
f.read(file._data, sizeInBytes - 2080);
|
||||
}
|
||||
|
||||
void DreamBase::loadIntoTemp(const char *fileName) {
|
||||
data.word(kTempgraphics) = standardLoad(fileName);
|
||||
loadGraphicsFile(_tempGraphics, fileName);
|
||||
}
|
||||
|
||||
void DreamBase::loadIntoTemp2(const char *fileName) {
|
||||
data.word(kTempgraphics2) = standardLoad(fileName);
|
||||
loadGraphicsFile(_tempGraphics2, fileName);
|
||||
}
|
||||
|
||||
void DreamBase::loadIntoTemp3(const char *fileName) {
|
||||
data.word(kTempgraphics3) = standardLoad(fileName);
|
||||
loadGraphicsFile(_tempGraphics3, fileName);
|
||||
}
|
||||
|
||||
void DreamBase::loadTempCharset(const char *fileName) {
|
||||
engine->setTempCharset(standardLoadCPP(fileName));
|
||||
loadGraphicsFile(_tempCharset, fileName);
|
||||
}
|
||||
|
||||
void DreamBase::hangOnCurs(uint16 frameCount) {
|
||||
|
@ -955,17 +985,6 @@ uint16 DreamBase::allocateMem(uint16 paragraphs) {
|
|||
void DreamBase::deallocateMem(uint16 segment) {
|
||||
debug(1, "deallocating segment %04x", segment);
|
||||
deallocateSegment(segment);
|
||||
|
||||
// CHECKME: Do we really need this? From brief testing it appears
|
||||
// the sprite table is cleared entirely shortly after this happens
|
||||
// anyway.
|
||||
Common::List<Sprite>::iterator i;
|
||||
for (i = _spriteTable.begin(); i != _spriteTable.end(); ) {
|
||||
if (i->_frameData == segment)
|
||||
i = _spriteTable.erase(i);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::DOSReturn() {
|
||||
|
@ -1131,7 +1150,7 @@ void DreamBase::crosshair() {
|
|||
} else {
|
||||
frame = 29;
|
||||
}
|
||||
showFrame(engine->icons1(), kZoomx + 24, kZoomy + 19, frame, 0);
|
||||
showFrame(_icons1, kZoomx + 24, kZoomy + 19, frame, 0);
|
||||
}
|
||||
|
||||
void DreamBase::delTextLine() {
|
||||
|
@ -1505,7 +1524,7 @@ void DreamBase::showBlink() {
|
|||
blinkFrame = 6;
|
||||
static const uint8 blinkTab[] = { 16,18,18,17,16,16,16 };
|
||||
uint8 width, height;
|
||||
showFrame(engine->icons1(), 44, 32, blinkTab[blinkFrame], 0, &width, &height);
|
||||
showFrame(_icons1, 44, 32, blinkTab[blinkFrame], 0, &width, &height);
|
||||
}
|
||||
|
||||
void DreamBase::dumpBlink() {
|
||||
|
@ -1546,12 +1565,13 @@ void DreamBase::showPointer() {
|
|||
uint16 y = data.word(kMousey);
|
||||
data.word(kOldpointery) = data.word(kMousey);
|
||||
if (data.byte(kPickup) == 1) {
|
||||
const Frame *frames;
|
||||
if (data.byte(kObjecttype) != kExObjectType)
|
||||
frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
|
||||
else
|
||||
frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
const Frame *frame = frames + (3 * data.byte(kItemframe) + 1);
|
||||
const Frame *frame;
|
||||
if (data.byte(kObjecttype) != kExObjectType) {
|
||||
frame = &_freeFrames._frames[(3 * data.byte(kItemframe) + 1)];
|
||||
} else {
|
||||
const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
frame = frames + (3 * data.byte(kItemframe) + 1);
|
||||
}
|
||||
uint8 width = frame->width;
|
||||
uint8 height = frame->height;
|
||||
if (width < 12)
|
||||
|
@ -1565,10 +1585,15 @@ void DreamBase::showPointer() {
|
|||
data.word(kOldpointerx) = xMin;
|
||||
data.word(kOldpointery) = yMin;
|
||||
multiGet(_pointerBack, xMin, yMin, width, height);
|
||||
showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
|
||||
showFrame(engine->icons1(), x, y, 3, 128);
|
||||
if (data.byte(kObjecttype) != kExObjectType) {
|
||||
showFrame(_freeFrames, x, y, 3 * data.byte(kItemframe) + 1, 128);
|
||||
} else {
|
||||
const Frame *frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
|
||||
showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
|
||||
}
|
||||
showFrame(_icons1, x, y, 3, 128);
|
||||
} else {
|
||||
const Frame *frame = engine->icons1() + (data.byte(kPointerframe) + 20);
|
||||
const Frame *frame = &_icons1._frames[data.byte(kPointerframe) + 20];
|
||||
uint8 width = frame->width;
|
||||
uint8 height = frame->height;
|
||||
if (width < 12)
|
||||
|
@ -1578,7 +1603,7 @@ void DreamBase::showPointer() {
|
|||
data.byte(kPointerxs) = width;
|
||||
data.byte(kPointerys) = height;
|
||||
multiGet(_pointerBack, x, y, width, height);
|
||||
showFrame(engine->icons1(), x, y, data.byte(kPointerframe) + 20, 0);
|
||||
showFrame(_icons1, x, y, data.byte(kPointerframe) + 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1712,6 +1737,9 @@ void DreamBase::showIcon() {
|
|||
panelIcons1();
|
||||
zoomIcon();
|
||||
} else {
|
||||
error("Unimplemented tempsprites code called");
|
||||
// the tempsprites segment is never initialized, but used here.
|
||||
/*
|
||||
Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
|
||||
showFrame(tempSprites, 72, 2, 45, 0);
|
||||
showFrame(tempSprites, 72+47, 2, 46, 0);
|
||||
|
@ -1719,7 +1747,13 @@ void DreamBase::showIcon() {
|
|||
showFrame(tempSprites, 160+88, 2, 45, 4 & 0xfe);
|
||||
showFrame(tempSprites, 160+43, 2, 46, 4 & 0xfe);
|
||||
showFrame(tempSprites, 160+101, 21, 49, 4 & 0xfe);
|
||||
middlePanel();
|
||||
|
||||
// middle panel
|
||||
showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0);
|
||||
showFrame(tempSprites, 72 + 19, 21, 47, 0);
|
||||
showFrame(tempSprites, 160 + 23, 0, 48, 4);
|
||||
showFrame(tempSprites, 160 + 71, 21, 47, 4);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1932,7 +1966,7 @@ void DreamBase::mainScreen() {
|
|||
|
||||
void DreamBase::showWatch() {
|
||||
if (data.byte(kWatchon)) {
|
||||
showFrame(engine->icons1(), 250, 1, 6, 0);
|
||||
showFrame(_icons1, 250, 1, 6, 0);
|
||||
showTime();
|
||||
}
|
||||
}
|
||||
|
@ -1947,22 +1981,21 @@ void DreamBase::dumpWatch() {
|
|||
void DreamBase::showTime() {
|
||||
if (data.byte(kWatchon) == 0)
|
||||
return;
|
||||
Frame *charset = (Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
|
||||
|
||||
int seconds = data.byte(kSecondcount);
|
||||
int minutes = data.byte(kMinutecount);
|
||||
int hours = data.byte(kHourcount);
|
||||
|
||||
showFrame(charset, 282+5, 21, 91*3+10 + seconds / 10, 0);
|
||||
showFrame(charset, 282+9, 21, 91*3+10 + seconds % 10, 0);
|
||||
showFrame(_charset1, 282+5, 21, 91*3+10 + seconds / 10, 0);
|
||||
showFrame(_charset1, 282+9, 21, 91*3+10 + seconds % 10, 0);
|
||||
|
||||
showFrame(charset, 270+5, 21, 91*3 + minutes / 10, 0);
|
||||
showFrame(charset, 270+11, 21, 91*3 + minutes % 10, 0);
|
||||
showFrame(_charset1, 270+5, 21, 91*3 + minutes / 10, 0);
|
||||
showFrame(_charset1, 270+11, 21, 91*3 + minutes % 10, 0);
|
||||
|
||||
showFrame(charset, 256+5, 21, 91*3 + hours / 10, 0);
|
||||
showFrame(charset, 256+11, 21, 91*3 + hours % 10, 0);
|
||||
showFrame(_charset1, 256+5, 21, 91*3 + hours / 10, 0);
|
||||
showFrame(_charset1, 256+11, 21, 91*3 + hours % 10, 0);
|
||||
|
||||
showFrame(charset, 267+5, 21, 91*3+20, 0);
|
||||
showFrame(_charset1, 267+5, 21, 91*3+20, 0);
|
||||
}
|
||||
|
||||
void DreamBase::watchCount() {
|
||||
|
@ -1970,7 +2003,7 @@ void DreamBase::watchCount() {
|
|||
return;
|
||||
++data.byte(kTimercount);
|
||||
if (data.byte(kTimercount) == 9) {
|
||||
showFrame((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0);
|
||||
showFrame(_charset1, 268+4, 21, 91*3+21, 0);
|
||||
data.byte(kWatchdump) = 1;
|
||||
} else if (data.byte(kTimercount) == 18) {
|
||||
data.byte(kTimercount) = 0;
|
||||
|
@ -2007,7 +2040,7 @@ void DreamBase::roomName() {
|
|||
void DreamBase::zoomIcon() {
|
||||
if (data.byte(kZoomon) == 0)
|
||||
return;
|
||||
showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0);
|
||||
showFrame(_icons1, kZoomx, kZoomy-1, 8, 0);
|
||||
}
|
||||
|
||||
void DreamBase::loadRoom() {
|
||||
|
@ -2032,14 +2065,10 @@ void DreamBase::loadRoom() {
|
|||
}
|
||||
|
||||
void DreamBase::readSetData() {
|
||||
data.word(kCharset1) = standardLoad("DREAMWEB.C00");
|
||||
|
||||
void *icons1Buffer = standardLoadCPP("DREAMWEB.G00");
|
||||
engine->setIcons1(icons1Buffer);
|
||||
void *icons2Buffer = standardLoadCPP("DREAMWEB.G01");
|
||||
engine->setIcons2(icons2Buffer);
|
||||
|
||||
data.word(kMainsprites) = standardLoad("DREAMWEB.S00");
|
||||
loadGraphicsFile(_charset1, "DREAMWEB.C00");
|
||||
loadGraphicsFile(_icons1, "DREAMWEB.G00");
|
||||
loadGraphicsFile(_icons2, "DREAMWEB.G01");
|
||||
loadGraphicsFile(_mainSprites, "DREAMWEB.S00");
|
||||
loadTextFile(_puzzleText, "DREAMWEB.T80");
|
||||
loadTextFile(_commandText, "DREAMWEB.T84");
|
||||
useCharset1();
|
||||
|
@ -2051,18 +2080,6 @@ void DreamBase::readSetData() {
|
|||
//engine->closeFile();
|
||||
}
|
||||
|
||||
Frame * DreamBase::tempGraphics() {
|
||||
return (Frame *)getSegment(data.word(kTempgraphics)).ptr(0, 0);
|
||||
}
|
||||
|
||||
Frame * DreamBase::tempGraphics2() {
|
||||
return (Frame *)getSegment(data.word(kTempgraphics2)).ptr(0, 0);
|
||||
}
|
||||
|
||||
Frame * DreamBase::tempGraphics3() {
|
||||
return (Frame *)getSegment(data.word(kTempgraphics3)).ptr(0, 0);
|
||||
}
|
||||
|
||||
void DreamBase::findRoomInLoc() {
|
||||
uint8 x = data.byte(kMapx) / 11;
|
||||
uint8 y = data.byte(kMapy) / 10;
|
||||
|
@ -2123,15 +2140,15 @@ void DreamBase::doLook() {
|
|||
}
|
||||
|
||||
void DreamBase::useCharset1() {
|
||||
engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0));
|
||||
_currentCharset = &_charset1;
|
||||
}
|
||||
|
||||
void DreamBase::useTempCharset() {
|
||||
engine->setCurrentCharset(engine->tempCharset());
|
||||
_currentCharset = &_tempCharset;
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfTemp() {
|
||||
deallocateMem(data.word(kTempgraphics));
|
||||
_tempGraphics.clear();
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfTempText() {
|
||||
|
@ -2139,24 +2156,22 @@ void DreamBase::getRidOfTempText() {
|
|||
}
|
||||
|
||||
void DreamBase::getRidOfTemp2() {
|
||||
deallocateMem(data.word(kTempgraphics2));
|
||||
_tempGraphics2.clear();
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfTemp3() {
|
||||
deallocateMem(data.word(kTempgraphics3));
|
||||
_tempGraphics3.clear();
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfTempCharset() {
|
||||
engine->freeTempCharset();
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfTempsP() {
|
||||
deallocateMem(data.word(kTempsprites));
|
||||
_tempCharset.clear();
|
||||
}
|
||||
|
||||
void DreamBase::getRidOfAll() {
|
||||
delete[] _backdropBlocks;
|
||||
deallocateMem(data.word(kSetframes));
|
||||
_backdropBlocks = 0;
|
||||
|
||||
_setFrames.clear();
|
||||
deallocateMem(data.word(kReel1));
|
||||
deallocateMem(data.word(kReel2));
|
||||
deallocateMem(data.word(kReel3));
|
||||
|
@ -2165,7 +2180,7 @@ void DreamBase::getRidOfAll() {
|
|||
deallocateMem(data.word(kSetdesc));
|
||||
deallocateMem(data.word(kBlockdesc));
|
||||
deallocateMem(data.word(kRoomdesc));
|
||||
deallocateMem(data.word(kFreeframes));
|
||||
_freeFrames.clear();
|
||||
deallocateMem(data.word(kFreedesc));
|
||||
}
|
||||
|
||||
|
@ -2188,7 +2203,14 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) {
|
|||
|
||||
clearAndLoad(workspace(), 0, len[1], 132*66); // 132*66 = maplen
|
||||
sortOutMap();
|
||||
data.word(kSetframes) = allocateAndLoad(len[2]);
|
||||
|
||||
// TODO: Create function for loading a GraphicsFile from a file segment
|
||||
_setFrames.clear();
|
||||
assert(len[2] >= 2080);
|
||||
engine->readFromFile((uint8 *)_setFrames._frames, 2080);
|
||||
_setFrames._data = new uint8[len[2] - 2080];
|
||||
engine->readFromFile(_setFrames._data, len[2] - 2080);
|
||||
|
||||
if (!skipDat)
|
||||
clearAndLoad(data.word(kSetdat), 255, len[3], kSetdatlen);
|
||||
else
|
||||
|
@ -2196,6 +2218,7 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) {
|
|||
// NB: The skipDat version of this function as called by restoreall
|
||||
// had a 'call bloc' instead of 'call loadseg' for reel1,
|
||||
// but 'bloc' was not defined.
|
||||
// TODO: kReel1/2/3 are also GraphicsFiles?
|
||||
data.word(kReel1) = allocateAndLoad(len[4]);
|
||||
data.word(kReel2) = allocateAndLoad(len[5]);
|
||||
data.word(kReel3) = allocateAndLoad(len[6]);
|
||||
|
@ -2204,7 +2227,14 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) {
|
|||
data.word(kSetdesc) = allocateAndLoad(len[9]);
|
||||
data.word(kBlockdesc) = allocateAndLoad(len[10]);
|
||||
data.word(kRoomdesc) = allocateAndLoad(len[11]);
|
||||
data.word(kFreeframes) = allocateAndLoad(len[12]);
|
||||
|
||||
// TODO: Create function for loading a GraphicsFile from a file segment
|
||||
_freeFrames.clear();
|
||||
assert(len[12] >= 2080);
|
||||
engine->readFromFile((uint8 *)_freeFrames._frames, 2080);
|
||||
_freeFrames._data = new uint8[len[12] - 2080];
|
||||
engine->readFromFile(_freeFrames._data, len[12] - 2080);
|
||||
|
||||
if (!skipDat)
|
||||
clearAndLoad(data.word(kFreedat), 255, len[13], kFreedatlen);
|
||||
else
|
||||
|
@ -2260,10 +2290,10 @@ void DreamBase::showFolder() {
|
|||
if (data.byte(kFolderpage)) {
|
||||
useTempCharset();
|
||||
createPanel2();
|
||||
showFrame(tempGraphics(), 0, 0, 0, 0);
|
||||
showFrame(tempGraphics(), 143, 0, 1, 0);
|
||||
showFrame(tempGraphics(), 0, 92, 2, 0);
|
||||
showFrame(tempGraphics(), 143, 92, 3, 0);
|
||||
showFrame(_tempGraphics, 0, 0, 0, 0);
|
||||
showFrame(_tempGraphics, 143, 0, 1, 0);
|
||||
showFrame(_tempGraphics, 0, 92, 2, 0);
|
||||
showFrame(_tempGraphics, 143, 92, 3, 0);
|
||||
folderExit();
|
||||
if (data.byte(kFolderpage) != 1)
|
||||
showLeftPage();
|
||||
|
@ -2273,21 +2303,21 @@ void DreamBase::showFolder() {
|
|||
underTextLine();
|
||||
} else {
|
||||
createPanel2();
|
||||
showFrame(tempGraphics3(), 143-28, 0, 0, 0);
|
||||
showFrame(tempGraphics3(), 143-28, 92, 1, 0);
|
||||
showFrame(_tempGraphics3, 143-28, 0, 0, 0);
|
||||
showFrame(_tempGraphics3, 143-28, 92, 1, 0);
|
||||
folderExit();
|
||||
underTextLine();
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::showLeftPage() {
|
||||
showFrame(tempGraphics2(), 0, 12, 3, 0);
|
||||
showFrame(_tempGraphics2, 0, 12, 3, 0);
|
||||
uint16 y = 12+5;
|
||||
for (size_t i = 0; i < 9; ++i) {
|
||||
showFrame(tempGraphics2(), 0, y, 4, 0);
|
||||
showFrame(_tempGraphics2, 0, y, 4, 0);
|
||||
y += 16;
|
||||
}
|
||||
showFrame(tempGraphics2(), 0, y, 5, 0);
|
||||
showFrame(_tempGraphics2, 0, y, 5, 0);
|
||||
data.word(kLinespacing) = 8;
|
||||
data.word(kCharshift) = 91;
|
||||
data.byte(kKerning) = 1;
|
||||
|
@ -2314,14 +2344,14 @@ void DreamBase::showLeftPage() {
|
|||
}
|
||||
|
||||
void DreamBase::showRightPage() {
|
||||
showFrame(tempGraphics2(), 143, 12, 0, 0);
|
||||
showFrame(_tempGraphics2, 143, 12, 0, 0);
|
||||
uint16 y = 12+37;
|
||||
for (size_t i = 0; i < 7; ++i) {
|
||||
showFrame(tempGraphics2(), 143, y, 1, 0);
|
||||
showFrame(_tempGraphics2, 143, y, 1, 0);
|
||||
y += 16;
|
||||
}
|
||||
|
||||
showFrame(tempGraphics2(), 143, y, 2, 0);
|
||||
showFrame(_tempGraphics2, 143, y, 2, 0);
|
||||
data.word(kLinespacing) = 8;
|
||||
data.byte(kKerning) = 1;
|
||||
uint8 pageIndex = data.byte(kFolderpage) - 1;
|
||||
|
@ -2339,14 +2369,14 @@ void DreamBase::showRightPage() {
|
|||
}
|
||||
|
||||
void DreamBase::showExit() {
|
||||
showFrame(engine->icons1(), 274, 154, 11, 0);
|
||||
showFrame(_icons1, 274, 154, 11, 0);
|
||||
}
|
||||
|
||||
void DreamBase::showMan() {
|
||||
showFrame(engine->icons1(), 0, 0, 0, 0);
|
||||
showFrame(engine->icons1(), 0, 114, 1, 0);
|
||||
showFrame(_icons1, 0, 0, 0, 0);
|
||||
showFrame(_icons1, 0, 114, 1, 0);
|
||||
if (data.byte(kShadeson))
|
||||
showFrame(engine->icons1(), 28, 25, 2, 0);
|
||||
showFrame(_icons1, 28, 25, 2, 0);
|
||||
}
|
||||
|
||||
void DreamBase::panelIcons1() {
|
||||
|
@ -2355,14 +2385,14 @@ void DreamBase::panelIcons1() {
|
|||
x = 48;
|
||||
else
|
||||
x = 0;
|
||||
showFrame(engine->icons2(), 204 + x, 4, 2, 0);
|
||||
showFrame(_icons2, 204 + x, 4, 2, 0);
|
||||
if (data.byte(kZoomon) != 1)
|
||||
showFrame(engine->icons1(), 228 + x, 8, 5, 0);
|
||||
showFrame(_icons1, 228 + x, 8, 5, 0);
|
||||
showWatch();
|
||||
}
|
||||
|
||||
void DreamBase::examIcon() {
|
||||
showFrame(engine->icons2(), 254, 5, 3, 0);
|
||||
showFrame(_icons2, 254, 5, 3, 0);
|
||||
}
|
||||
|
||||
const uint8 *DreamBase::getTextInFile1(uint16 index) {
|
||||
|
@ -2443,7 +2473,7 @@ void DreamBase::folderHints() {
|
|||
}
|
||||
|
||||
void DreamBase::folderExit() {
|
||||
showFrame(tempGraphics2(), 296, 178, 6, 0);
|
||||
showFrame(_tempGraphics2, 296, 178, 6, 0);
|
||||
}
|
||||
|
||||
void DreamBase::loadTravelText() {
|
||||
|
@ -2491,7 +2521,7 @@ void DreamBase::showMenu() {
|
|||
++data.byte(kMenucount);
|
||||
if (data.byte(kMenucount) == 37*2)
|
||||
data.byte(kMenucount) = 0;
|
||||
showFrame(tempGraphics(), kMenux, kMenuy, data.byte(kMenucount) / 2, 0);
|
||||
showFrame(_tempGraphics, kMenux, kMenuy, data.byte(kMenucount) / 2, 0);
|
||||
}
|
||||
|
||||
void DreamBase::dumpMenu() {
|
||||
|
@ -2507,9 +2537,9 @@ void DreamBase::useMenu() {
|
|||
data.byte(kNewobs) = 0;
|
||||
drawFloor();
|
||||
printSprites();
|
||||
showFrame(tempGraphics2(), kMenux-48, kMenuy-4, 4, 0);
|
||||
showFrame(_tempGraphics2, kMenux-48, kMenuy-4, 4, 0);
|
||||
getUnderMenu();
|
||||
showFrame(tempGraphics2(), kMenux+54, kMenuy+72, 5, 0);
|
||||
showFrame(_tempGraphics2, kMenux+54, kMenuy+72, 5, 0);
|
||||
workToScreenM();
|
||||
data.byte(kGetback) = 0;
|
||||
do {
|
||||
|
@ -2609,19 +2639,19 @@ uint8 DreamBase::nextSymbol(uint8 symbol) {
|
|||
}
|
||||
|
||||
void DreamBase::showSymbol() {
|
||||
showFrame(tempGraphics(), kSymbolx, kSymboly, 12, 0);
|
||||
showFrame(_tempGraphics, kSymbolx, kSymboly, 12, 0);
|
||||
|
||||
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx-44, kSymboly+20, data.byte(kSymboltopnum), 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymboltopx) + kSymbolx-44, kSymboly+20, data.byte(kSymboltopnum), 32);
|
||||
uint8 nextTopSymbol = nextSymbol(data.byte(kSymboltopnum));
|
||||
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymboltopx) + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
|
||||
uint8 nextNextTopSymbol = nextSymbol(nextTopSymbol);
|
||||
showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymboltopx) + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
|
||||
|
||||
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx-44, kSymboly+49, 6 + data.byte(kSymbolbotnum), 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymbolbotx) + kSymbolx-44, kSymboly+49, 6 + data.byte(kSymbolbotnum), 32);
|
||||
uint8 nextBotSymbol = nextSymbol(data.byte(kSymbolbotnum));
|
||||
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymbolbotx) + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
|
||||
uint8 nextNextBotSymbol = nextSymbol(nextBotSymbol);
|
||||
showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
|
||||
showFrame(_tempGraphics, data.byte(kSymbolbotx) + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
|
||||
}
|
||||
|
||||
void DreamBase::readKey() {
|
||||
|
@ -2961,16 +2991,11 @@ void DreamBase::examineInventory() {
|
|||
}
|
||||
|
||||
void DreamBase::middlePanel() {
|
||||
Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
|
||||
showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0);
|
||||
showFrame(tempSprites, 72 + 19, 21, 47, 0);
|
||||
showFrame(tempSprites, 160 + 23, 0, 48, 4);
|
||||
showFrame(tempSprites, 160 + 71, 21, 47, 4);
|
||||
}
|
||||
|
||||
void DreamBase::showDiary() {
|
||||
showFrame(tempGraphics(), kDiaryx, kDiaryy + 37, 1, 0);
|
||||
showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0);
|
||||
showFrame(_tempGraphics, kDiaryx, kDiaryy + 37, 1, 0);
|
||||
showFrame(_tempGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0);
|
||||
}
|
||||
|
||||
void DreamBase::underTextLine() {
|
||||
|
@ -3166,8 +3191,8 @@ void DreamBase::showGun() {
|
|||
data.byte(kVolume) = 0;
|
||||
loadIntoTemp("DREAMWEB.G13");
|
||||
createPanel2();
|
||||
showFrame(tempGraphics(), 100, 4, 0, 0);
|
||||
showFrame(tempGraphics(), 158, 106, 1, 0);
|
||||
showFrame(_tempGraphics, 100, 4, 0, 0);
|
||||
showFrame(_tempGraphics, 158, 106, 1, 0);
|
||||
workToScreen();
|
||||
getRidOfTemp();
|
||||
fadeScreenUp();
|
||||
|
@ -3511,7 +3536,7 @@ void DreamBase::updateSymbolBot() {
|
|||
}
|
||||
|
||||
void DreamBase::showDiaryPage() {
|
||||
showFrame(tempGraphics(), kDiaryx, kDiaryy, 0, 0);
|
||||
showFrame(_tempGraphics, kDiaryx, kDiaryy, 0, 0);
|
||||
data.byte(kKerning) = 1;
|
||||
useTempCharset();
|
||||
data.word(kCharshift) = 91+91;
|
||||
|
@ -3558,7 +3583,7 @@ void DreamBase::lookAtCard() {
|
|||
getRidOfReels();
|
||||
loadKeypad();
|
||||
createPanel2();
|
||||
showFrame(tempGraphics(), 160, 80, 42, 128);
|
||||
showFrame(_tempGraphics, 160, 80, 42, 128);
|
||||
const uint8 *obText = getObTextStart();
|
||||
findNextColon(&obText);
|
||||
findNextColon(&obText);
|
||||
|
@ -3568,7 +3593,7 @@ void DreamBase::lookAtCard() {
|
|||
workToScreenM();
|
||||
hangOnW(280);
|
||||
createPanel2();
|
||||
showFrame(tempGraphics(), 160, 80, 42, 128);
|
||||
showFrame(_tempGraphics, 160, 80, 42, 128);
|
||||
printDirect(obText, 36, 130, 241, 241 & 1);
|
||||
workToScreenM();
|
||||
hangOnW(200);
|
||||
|
@ -3614,10 +3639,10 @@ void DreamBase::showDiaryKeys() {
|
|||
|
||||
if (data.byte(kPressed) == 'N') {
|
||||
byte frame = (data.byte(kPresscount) == 1) ? 3 : 4;
|
||||
showFrame(tempGraphics(), kDiaryx + 94, kDiaryy + 97, frame, 0);
|
||||
showFrame(_tempGraphics, kDiaryx + 94, kDiaryy + 97, frame, 0);
|
||||
} else {
|
||||
byte frame = (data.byte(kPresscount) == 1) ? 5 : 6;
|
||||
showFrame(tempGraphics(), kDiaryx + 151, kDiaryy + 71, frame, 0);
|
||||
showFrame(_tempGraphics, kDiaryx + 151, kDiaryy + 71, frame, 0);
|
||||
}
|
||||
|
||||
if (data.byte(kPresscount) == 1)
|
||||
|
|
|
@ -42,7 +42,7 @@ void DreamBase::monkSpeaking() {
|
|||
loadRoomsSample();
|
||||
loadIntoTemp("DREAMWEB.G15");
|
||||
clearWork();
|
||||
showFrame(tempGraphics(), 160, 72, 0, 128); // show monk
|
||||
showFrame(_tempGraphics, 160, 72, 0, 128); // show monk
|
||||
workToScreen();
|
||||
data.byte(kVolume) = 7;
|
||||
data.byte(kVolumedirection) = (byte)-1;
|
||||
|
|
|
@ -1576,7 +1576,7 @@ void DreamBase::useCashCard() {
|
|||
showExit();
|
||||
showMan();
|
||||
uint16 y = (!_foreignRelease) ? 120 : 120 - 3;
|
||||
showFrame(tempGraphics(), 114, y, 39, 0);
|
||||
showFrame(_tempGraphics, 114, y, 39, 0);
|
||||
const uint8 *obText = getObTextStart();
|
||||
findNextColon(&obText);
|
||||
findNextColon(&obText);
|
||||
|
|
|
@ -273,6 +273,45 @@ void DreamBase::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 fra
|
|||
showFrame(frameData, x, y, frameNumber, effectsFlag, &width, &height);
|
||||
}
|
||||
|
||||
|
||||
void DreamBase::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
|
||||
uint8 width, height;
|
||||
showFrame(frameData, x, y, frameNumber, effectsFlag, &width, &height);
|
||||
}
|
||||
|
||||
void DreamBase::showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height) {
|
||||
if (effectsFlag) {
|
||||
if (effectsFlag & 128) { //centred
|
||||
x -= width / 2;
|
||||
y -= height / 2;
|
||||
}
|
||||
if (effectsFlag & 64) { // diffDest
|
||||
error("Unsupported DreamBase::showFrame effectsFlag %d", effectsFlag);
|
||||
/*
|
||||
frameOutFx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
|
||||
return;
|
||||
*/
|
||||
}
|
||||
if (effectsFlag & 8) { // printList
|
||||
//addToPrintList(x - data.word(kMapadx), y - data.word(kMapady)); // NB: Commented in the original asm
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
if (effectsFlag & 32) {
|
||||
frameOutBh(workspace(), pSrc, 320, width, height, x, y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// "noEffects"
|
||||
frameOutV(workspace(), pSrc, 320, width, height, x, y);
|
||||
}
|
||||
|
||||
void DreamBase::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)) {
|
||||
|
@ -292,37 +331,29 @@ void DreamBase::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 fra
|
|||
*height = frame->height;
|
||||
const uint8 *pSrc = ((const uint8 *)frameData) + frame->ptr() + 2080;
|
||||
|
||||
if (effectsFlag) {
|
||||
if (effectsFlag & 128) { //centred
|
||||
x -= *width / 2;
|
||||
y -= *height / 2;
|
||||
}
|
||||
if (effectsFlag & 64) { // diffDest
|
||||
error("Unsupported DreamBase::showFrame effectsFlag %d", effectsFlag);
|
||||
/*
|
||||
frameOutFx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
|
||||
return;
|
||||
*/
|
||||
}
|
||||
if (effectsFlag & 8) { // printList
|
||||
//addToPrintList(x - data.word(kMapadx), y - data.word(kMapady)); // NB: Commented in the original asm
|
||||
}
|
||||
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);
|
||||
return;
|
||||
}
|
||||
if (effectsFlag & 32) {
|
||||
frameOutBh(workspace(), pSrc, 320, *width, *height, x, y);
|
||||
return;
|
||||
}
|
||||
showFrameInternal(pSrc, x, y, effectsFlag, *width, *height);
|
||||
}
|
||||
|
||||
void DreamBase::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
|
||||
const Frame *frame = &frameData._frames[frameNumber];
|
||||
if ((frame->width == 0) && (frame->height == 0)) {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
return;
|
||||
}
|
||||
// "noEffects"
|
||||
frameOutV(workspace(), pSrc, 320, *width, *height, x, y);
|
||||
return;
|
||||
|
||||
// "notBlankShow"
|
||||
if ((effectsFlag & 128) == 0) {
|
||||
x += frame->x;
|
||||
y += frame->y;
|
||||
}
|
||||
|
||||
// "skipOffsets"
|
||||
*width = frame->width;
|
||||
*height = frame->height;
|
||||
const uint8 *pSrc = frameData.getFrameData(frameNumber);
|
||||
|
||||
showFrameInternal(pSrc, x, y, effectsFlag, *width, *height);
|
||||
}
|
||||
|
||||
void DreamBase::clearWork() {
|
||||
|
@ -373,8 +404,8 @@ bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) {
|
|||
x -= pos->xMin;
|
||||
y -= pos->yMin;
|
||||
SetObject *setObject = getSetAd(pos->index);
|
||||
Frame *frame = (Frame *)getSegment(data.word(kSetframes)).ptr(kFramedata, 0) + setObject->index;
|
||||
const uint8 *ptr = getSegment(data.word(kSetframes)).ptr(kFrames, 0) + frame->ptr() + y * frame->width + x;
|
||||
const Frame &frame = _setFrames._frames[setObject->index];
|
||||
const uint8 *ptr = _setFrames.getFrameData(setObject->index) + y * frame.width + x;
|
||||
return *ptr != 0;
|
||||
}
|
||||
|
||||
|
@ -403,26 +434,25 @@ void DreamBase::loadPalFromIFF() {
|
|||
}
|
||||
|
||||
void DreamBase::createPanel() {
|
||||
showFrame(engine->icons2(), 0, 8, 0, 2);
|
||||
showFrame(engine->icons2(), 160, 8, 0, 2);
|
||||
showFrame(engine->icons2(), 0, 104, 0, 2);
|
||||
showFrame(engine->icons2(), 160, 104, 0, 2);
|
||||
showFrame(_icons2, 0, 8, 0, 2);
|
||||
showFrame(_icons2, 160, 8, 0, 2);
|
||||
showFrame(_icons2, 0, 104, 0, 2);
|
||||
showFrame(_icons2, 160, 104, 0, 2);
|
||||
}
|
||||
|
||||
void DreamBase::createPanel2() {
|
||||
createPanel();
|
||||
showFrame(engine->icons2(), 0, 0, 5, 2);
|
||||
showFrame(engine->icons2(), 160, 0, 5, 2);
|
||||
showFrame(_icons2, 0, 0, 5, 2);
|
||||
showFrame(_icons2, 160, 0, 5, 2);
|
||||
}
|
||||
|
||||
void DreamBase::showPanel() {
|
||||
showFrame(engine->icons1(), 72, 0, 19, 0);
|
||||
showFrame(engine->icons1(), 192, 0, 19, 0);
|
||||
showFrame(_icons1, 72, 0, 19, 0);
|
||||
showFrame(_icons1, 192, 0, 19, 0);
|
||||
}
|
||||
|
||||
void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) {
|
||||
const Frame *freeFrames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(kFrframedata, 0);
|
||||
const Frame &freeFrame = freeFrames[3*from + offset];
|
||||
const Frame &freeFrame = _freeFrames._frames[3*from + offset];
|
||||
|
||||
Frame *exFrames = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata, 0);
|
||||
Frame &exFrame = exFrames[3*to + offset];
|
||||
|
@ -433,7 +463,7 @@ void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) {
|
|||
exFrame.y = freeFrame.y;
|
||||
uint16 byteCount = freeFrame.width * freeFrame.height;
|
||||
|
||||
const uint8 *src = getSegment(data.word(kFreeframes)).ptr(kFrframes + freeFrame.ptr(), byteCount);
|
||||
const uint8 *src = _freeFrames.getFrameData(3*from + offset);
|
||||
uint8 *dst = getSegment(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount);
|
||||
memcpy(dst, src, byteCount);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue