From 39a0153fbf503854011bc1947ef261e06868d971 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 27 Dec 2011 13:52:13 +0100 Subject: DREAMWEB: Remove mapStore segment --- engines/dreamweb/dreambase.h | 3 +- engines/dreamweb/dreamgen.cpp | 6 +-- engines/dreamweb/dreamgen.h | 93 +++++++++++++++++++++---------------------- engines/dreamweb/monitor.cpp | 4 +- engines/dreamweb/newplace.cpp | 4 +- engines/dreamweb/print.cpp | 8 ++-- engines/dreamweb/stubs.cpp | 5 +-- engines/dreamweb/vgagrafx.cpp | 15 ++++--- 8 files changed, 68 insertions(+), 70 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 44d62db9c8..ed384fae99 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -47,6 +47,7 @@ const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; const unsigned int kUnderTimedTextBufSize = 256 * kUnderTimedTextSizeY_f; const unsigned int kLengthOfVars = 68; const unsigned int kNumChanges = 250; +const unsigned int kLenOfMapStore = 22*8*20*8; /** * This class is one of the parent classes of DreamGenContext. Its sole purpose @@ -85,6 +86,7 @@ protected: // from vgagrafx.cpp uint8 _workspace[(0x1000 + 2) * 16]; + uint8 _mapStore[kLenOfMapStore + 32]; // from people.cpp ReelRoutine _reelRoutines[kNumReelRoutines+1]; @@ -794,7 +796,6 @@ public: inline uint8 *workspace() { return _workspace; } void clearWork(); - uint8 *mapStore(); void panelToMap(); void mapToPanel(); void dumpMap(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 777961fcef..910fd8147d 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -65,15 +65,15 @@ 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, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0120: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0130: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0140: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0150: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b736c3c9cb..3ad9b1d186 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -251,53 +251,52 @@ static const uint16 kBufferin = 276; static const uint16 kBufferout = 278; static const uint16 kExtras = 280; static const uint16 kWorkspace = 282; -static const uint16 kMapstore = 284; -static const uint16 kCharset1 = 286; -static const uint16 kMainsprites = 288; -static const uint16 kBackdrop = 290; -static const uint16 kMapdata = 292; -static const uint16 kRecordspace = 294; -static const uint16 kFreedat = 296; -static const uint16 kSetdat = 298; -static const uint16 kReel1 = 300; -static const uint16 kReel2 = 302; -static const uint16 kReel3 = 304; -static const uint16 kRoomdesc = 306; -static const uint16 kFreedesc = 308; -static const uint16 kSetdesc = 310; -static const uint16 kBlockdesc = 312; -static const uint16 kSetframes = 314; -static const uint16 kFreeframes = 316; -static const uint16 kPeople = 318; -static const uint16 kReels = 320; -static const uint16 kCommandtext = 322; -static const uint16 kPuzzletext = 324; -static const uint16 kTraveltext = 326; -static const uint16 kTempgraphics = 328; -static const uint16 kTempgraphics2 = 330; -static const uint16 kTempgraphics3 = 332; -static const uint16 kTempsprites = 334; -static const uint16 kTextfile1 = 336; -static const uint16 kTextfile2 = 338; -static const uint16 kTextfile3 = 340; -static const uint16 kBlinkframe = 342; -static const uint16 kBlinkcount = 343; -static const uint16 kReasseschanges = 344; -static const uint16 kPointerspath = 345; -static const uint16 kManspath = 346; -static const uint16 kPointerfirstpath = 347; -static const uint16 kFinaldest = 348; -static const uint16 kDestination = 349; -static const uint16 kLinestartx = 350; -static const uint16 kLinestarty = 352; -static const uint16 kLineendx = 354; -static const uint16 kLineendy = 356; -static const uint16 kLinepointer = 358; -static const uint16 kLinedirection = 359; -static const uint16 kLinelength = 360; -static const uint16 kCh0playing = 361; -static const uint16 kCh0repeat = 362; -static const uint16 kCh1playing = 363; +static const uint16 kCharset1 = 284; +static const uint16 kMainsprites = 286; +static const uint16 kBackdrop = 288; +static const uint16 kMapdata = 290; +static const uint16 kRecordspace = 292; +static const uint16 kFreedat = 294; +static const uint16 kSetdat = 296; +static const uint16 kReel1 = 298; +static const uint16 kReel2 = 300; +static const uint16 kReel3 = 302; +static const uint16 kRoomdesc = 304; +static const uint16 kFreedesc = 306; +static const uint16 kSetdesc = 308; +static const uint16 kBlockdesc = 310; +static const uint16 kSetframes = 312; +static const uint16 kFreeframes = 314; +static const uint16 kPeople = 316; +static const uint16 kReels = 318; +static const uint16 kCommandtext = 320; +static const uint16 kPuzzletext = 322; +static const uint16 kTraveltext = 324; +static const uint16 kTempgraphics = 326; +static const uint16 kTempgraphics2 = 328; +static const uint16 kTempgraphics3 = 330; +static const uint16 kTempsprites = 332; +static const uint16 kTextfile1 = 334; +static const uint16 kTextfile2 = 336; +static const uint16 kTextfile3 = 338; +static const uint16 kBlinkframe = 340; +static const uint16 kBlinkcount = 341; +static const uint16 kReasseschanges = 342; +static const uint16 kPointerspath = 343; +static const uint16 kManspath = 344; +static const uint16 kPointerfirstpath = 345; +static const uint16 kFinaldest = 346; +static const uint16 kDestination = 347; +static const uint16 kLinestartx = 348; +static const uint16 kLinestarty = 350; +static const uint16 kLineendx = 352; +static const uint16 kLineendy = 354; +static const uint16 kLinepointer = 356; +static const uint16 kLinedirection = 357; +static const uint16 kLinelength = 358; +static const uint16 kCh0playing = 359; +static const uint16 kCh0repeat = 360; +static const uint16 kCh1playing = 361; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 7419bcfdd8..4f037c6a58 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -223,7 +223,7 @@ void DreamBase::input() { _inputLine[data.word(kCurpos) * 2 + 0] = currentKey; if (currentKey > 'Z') continue; - multiGet(mapStore() + data.word(kCurpos) * 256, data.word(kMonadx), data.word(kMonady), 8, 8); + 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); _inputLine[data.word(kCurpos) * 2 + 1] = charWidth; @@ -248,7 +248,7 @@ void DreamBase::delChar() { data.word(kCurslocx) -= width; uint16 offset = data.word(kCurpos); offset = ((offset & 0x00ff) << 8) | ((offset & 0xff00) >> 8); - multiPut(mapStore() + offset, data.word(kMonadx), data.word(kMonady), 8, 8); + multiPut(_mapStore + offset, data.word(kMonadx), data.word(kMonady), 8, 8); multiDump(data.word(kMonadx), data.word(kMonady), 8, 8); } diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index 8c94b3f9cf..4d82d7032f 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -134,11 +134,11 @@ void DreamBase::lookAtPlace() { } void DreamBase::getUnderCentre() { - multiGet(mapStore(), 58, 72, 254, 110); + multiGet(_mapStore, 58, 72, 254, 110); } void DreamBase::putUnderCentre() { - multiPut(mapStore(), 58, 72, 254, 110); + multiPut(_mapStore, 58, 72, 254, 110); } void DreamBase::locationPic() { diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 9cd7b46d50..f5f0dda43c 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -253,7 +253,7 @@ void DreamBase::rollEndCreditsGameWon() { data.byte(kVolumeto) = 0; data.byte(kVolumedirection) = (byte)-1; - multiGet(mapStore(), 75, 20, 160, 160); + multiGet(_mapStore, 75, 20, 160, 160); const uint8 *string = getTextInFile1(3); const int linespacing = data.word(kLinespacing); @@ -264,7 +264,7 @@ void DreamBase::rollEndCreditsGameWon() { // line of text. for (int j = 0; j < linespacing; ++j) { vSync(); - multiPut(mapStore(), 75, 20, 160, 160); + multiPut(_mapStore, 75, 20, 160, 160); vSync(); // Output up to 18 lines of text @@ -292,7 +292,7 @@ void DreamBase::rollEndCreditsGameWon() { } void DreamBase::rollEndCreditsGameLost() { - multiGet(mapStore(), 25, 20, 160, 160); + multiGet(_mapStore, 25, 20, 160, 160); const uint8 *string = getTextInFile1(49); const int linespacing = data.word(kLinespacing); @@ -303,7 +303,7 @@ void DreamBase::rollEndCreditsGameLost() { // line of text. for (int j = 0; j < linespacing; ++j) { vSync(); - multiPut(mapStore(), 25, 20, 160, 160); + multiPut(_mapStore, 25, 20, 160, 160); vSync(); // Output up to 18 lines of text diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 1392d16dd7..772509b842 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -836,7 +836,7 @@ void DreamBase::putUnderTimed() { } void DreamBase::triggerMessage(uint16 index) { - multiGet(mapStore(), 174, 153, 200, 63); + multiGet(_mapStore, 174, 153, 200, 63); uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); uint16 y = 156; @@ -844,7 +844,7 @@ void DreamBase::triggerMessage(uint16 index) { hangOn(140); workToScreen(); hangOn(340); - multiPut(mapStore(), 174, 153, 200, 63); + multiPut(_mapStore, 174, 153, 200, 63); workToScreen(); data.byte(kLasttrigger) = 0; } @@ -2464,7 +2464,6 @@ void DreamBase::allocateBuffers() { data.word(kMapdata) = allocateMem(kLengthofmap/16); data.word(kFreedat) = allocateMem(kFreedatlen/16); data.word(kSetdat) = allocateMem(kSetdatlen/16); - data.word(kMapstore) = allocateMem(kLenofmapstore/16); } void DreamBase::workToScreenM() { diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index 7e74264dd7..f611a79329 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -357,16 +357,12 @@ void DreamBase::zoom() { data.byte(kDidzoom) = 1; } -uint8 *DreamBase::mapStore() { - return getSegment(data.word(kMapstore)).ptr(0, 0); -} - void DreamBase::panelToMap() { - multiGet(mapStore(), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize)); + multiGet(_mapStore, data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize)); } void DreamBase::mapToPanel() { - multiPut(mapStore(), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize)); + multiPut(_mapStore, data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize)); } void DreamBase::dumpMap() { @@ -384,11 +380,12 @@ bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { void DreamBase::loadPalFromIFF() { Common::File palFile; + uint8* buf = new uint8[2000]; palFile.open("DREAMWEB.PAL"); - palFile.read(mapStore(), 2000); + palFile.read(buf, 2000); palFile.close(); - const uint8 *src = mapStore() + 0x30; + const uint8 *src = buf + 0x30; uint8 *dst = _mainPal; for (size_t i = 0; i < 256*3; ++i) { uint8 c = src[i] / 4; @@ -401,6 +398,8 @@ void DreamBase::loadPalFromIFF() { } dst[i] = c; } + + delete[] buf; } void DreamBase::createPanel() { -- cgit v1.2.3