diff options
author | Bertrand Augereau | 2011-12-02 16:29:16 +0100 |
---|---|---|
committer | Bertrand Augereau | 2011-12-02 16:29:16 +0100 |
commit | 38ec14b15b19af5ae4ebcf3a6d6601351a7b2794 (patch) | |
tree | 42ce356d320500319efcd02408b2f6df8200cbb7 /engines | |
parent | 734e6c49b1a2aba7c88acd9ad1b177810b31cbce (diff) | |
download | scummvm-rg350-38ec14b15b19af5ae4ebcf3a6d6601351a7b2794.tar.gz scummvm-rg350-38ec14b15b19af5ae4ebcf3a6d6601351a7b2794.tar.bz2 scummvm-rg350-38ec14b15b19af5ae4ebcf3a6d6601351a7b2794.zip |
DREAMWEB: 'segRef' was redundant with 'getSegment' (thanks to Max for noting this)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/backdrop.cpp | 38 | ||||
-rw-r--r-- | engines/dreamweb/keypad.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/monitor.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 24 | ||||
-rw-r--r-- | engines/dreamweb/pathfind.cpp | 6 | ||||
-rw-r--r-- | engines/dreamweb/print.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/runtime.h | 6 | ||||
-rw-r--r-- | engines/dreamweb/saveload.cpp | 12 | ||||
-rw-r--r-- | engines/dreamweb/sprite.cpp | 24 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 136 | ||||
-rw-r--r-- | engines/dreamweb/talk.cpp | 2 | ||||
-rw-r--r-- | engines/dreamweb/vgafades.cpp | 6 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 24 |
13 files changed, 142 insertions, 148 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 07731e543d..96d36e4fe3 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -27,8 +27,8 @@ namespace DreamGen { 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); - const uint8 *blocks = segRef(data.word(kBackdrop)).ptr(kBlocks, 0); + const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(mapOffset, 0); + const uint8 *blocks = getSegment(data.word(kBackdrop)).ptr(kBlocks, 0); uint8 *dstBuffer = workspace() + dstOffset; for (size_t i = 0; i < 10; ++i) { @@ -113,7 +113,7 @@ void DreamGenContext::calcFrFrame() { } void DreamGenContext::calcFrFrame(uint8* width, uint8* height) { - const Frame *frame = (const Frame *)segRef(data.word(kFrsegment)).ptr(data.word(kCurrentframe) * sizeof(Frame), sizeof(Frame)); + const Frame *frame = (const Frame *)getSegment(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; data.byte(kSavesize+1) = frame->height; @@ -139,13 +139,13 @@ void DreamGenContext::finalFrame(uint16 *x, uint16 *y) { void DreamGenContext::showAllObs() { data.word(kListpos) = kSetlist; - memset(segRef(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5); + memset(getSegment(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5); data.word(kFrsegment) = data.word(kSetframes); data.word(kDataad) = kFramedata; data.word(kFramesad) = kFrames; - const Frame *frames = (const Frame *)segRef(data.word(kFrsegment)).ptr(0, 0); - SetObject *setEntries = (SetObject *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject)); + const Frame *frames = (const Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0); + SetObject *setEntries = (SetObject *)getSegment(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) @@ -165,7 +165,7 @@ void DreamGenContext::showAllObs() { } else makeBackOb(setEntry); - ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); objPos->xMin = data.byte(kSavex); objPos->yMin = data.byte(kSavey); objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0); @@ -202,7 +202,7 @@ bool DreamGenContext::addLength(const uint8 *mapFlags) { } void DreamGenContext::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { - const uint8 *mapFlags = segRef(data.word(kBuffers)).ptr(kMapflags, 0); + const uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); uint8 yStart = 0; while (! addAlong(mapFlags + 3 * 11 * yStart)) @@ -240,14 +240,14 @@ void DreamGenContext::calcMapAd() { void DreamGenContext::showAllFree() { data.word(kListpos) = kFreelist; - ObjPos *listPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); + ObjPos *listPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); memset(listPos, 0xff, 80 * sizeof(ObjPos)); data.word(kFrsegment) = data.word(kFreeframes); data.word(kDataad) = kFrframedata; data.word(kFramesad) = kFrframes; data.byte(kCurrentfree) = 0; - const DynObject *freeObjects = (const DynObject *)segRef(data.word(kFreedat)).ptr(0, 0); + const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); for(size_t i = 0; i < 80; ++i) { uint8 mapAd = getMapAd(freeObjects[i].mapad); if (mapAd != 0) { @@ -259,8 +259,8 @@ void DreamGenContext::showAllFree() { 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); - ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); + showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x, y, data.word(kCurrentframe) & 0xff, 0); + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); objPos->xMin = data.byte(kSavex); objPos->yMin = data.byte(kSavey); objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0); @@ -275,9 +275,9 @@ void DreamGenContext::showAllFree() { } 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); + uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0); + const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0); + const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0); for (size_t i = 0; i < 10; ++i) { for (size_t j = 0; j < 11; ++j) { @@ -292,13 +292,13 @@ void DreamGenContext::drawFlags() { void DreamGenContext::showAllEx() { data.word(kListpos) = kExlist; - memset(segRef(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5); + memset(getSegment(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5); data.word(kFrsegment) = data.word(kExtras); data.word(kDataad) = kExframedata; data.word(kFramesad) = kExframes; data.byte(kCurrentex) = 0; - DynObject *objects = (DynObject *)segRef(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); + DynObject *objects = (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); for (size_t i = 0; i < 100; ++i, ++data.byte(kCurrentex)) { DynObject *object = objects + i; if (object->mapad[0] == 0xff) @@ -313,8 +313,8 @@ void DreamGenContext::showAllEx() { uint16 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); - ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); + showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), data.word(kCurrentframe) & 0xff, 0); + ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos)); objPos->xMin = data.byte(kSavex); objPos->yMin = data.byte(kSavey); objPos->xMax = data.byte(kSavesize + 0) + data.byte(kSavex); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 743d539f08..1f4fa72f38 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -25,11 +25,11 @@ namespace DreamGen { void DreamGenContext::getUnderMenu() { - multiGet(segRef(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); + multiGet(getSegment(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); + multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48); } void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) { diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 42a8f41e22..04cfaa073d 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -138,7 +138,7 @@ void DreamGenContext::input() { 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(getSegment(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); inputLine[data.word(kCurpos) * 2 + 1] = charWidth; @@ -232,7 +232,7 @@ void DreamGenContext::monMessage() { void DreamGenContext::monMessage(uint8 index) { assert(index > 0); - const char *string = (const char *)segRef(data.word(kTextfile1)).ptr(kTextstart, 0); + const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0); for (uint8 i = 0; i < index; ++i) { while (*string++ != '+') { } diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index a01da08700..f617bfb21d 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -25,7 +25,7 @@ namespace DreamGen { void DreamGenContext::fillRyan() { - uint8 *inv = segRef(data.word(kBuffers)).ptr(kRyaninvlist, 60); + uint8 *inv = getSegment(data.word(kBuffers)).ptr(kRyaninvlist, 60); findAllRyan(inv); inv += data.byte(kRyanpage) * 2 * 10; for (size_t i = 0; i < 2; ++i) { @@ -73,13 +73,13 @@ void DreamGenContext::obToInv() { } void DreamGenContext::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { - Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0); + Frame *icons1 = (Frame *)getSegment(data.word(kIcons1)).ptr(0, 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 *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); const DynObject *object = (const DynObject *)getAnyAdDir(index, flag); @@ -93,9 +93,9 @@ void DreamGenContext::obPicture() { return; Frame *frames; if (data.byte(kObjecttype) == 4) - frames = (Frame *)segRef(data.word(kExtras)).ptr(0, 0); + frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0); else - frames = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0); + frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); uint8 frame = 3 * data.byte(kCommand) + 1; showFrame(frames, 160, 68, frame, 0x80); } @@ -105,10 +105,10 @@ void DreamGenContext::obIcons() { getAnyAd(&value1, &value2); if (value1 != 0xff) { // can open it - showFrame((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 210, 1, 4, 0); + showFrame((Frame *)getSegment(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 *)getSegment(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0); } void DreamGenContext::examineOb(bool examineAgain) { @@ -246,11 +246,11 @@ void DreamGenContext::inventory() { } void DreamGenContext::transferText() { - segRef(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos); + getSegment(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); - const char *src = (const char *)segRef(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0); - char *dst = (char *)segRef(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0); + uint16 srcOffset = getSegment(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset); + const char *src = (const char *)getSegment(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0); + char *dst = (char *)getSegment(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0); size_t len = strlen(src); memcpy(dst, src, len + 1); diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 2ca732467f..2353fc798f 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -50,7 +50,7 @@ void DreamGenContext::turnPathOff(uint8 param) { void DreamGenContext::turnAnyPathOn(uint8 param, uint8 room) { findOrMake(param, 0xff, room + 100); - PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0); + PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0); paths[param].on = 0xff; } @@ -60,7 +60,7 @@ void DreamGenContext::turnAnyPathOn() { void DreamGenContext::turnAnyPathOff(uint8 param, uint8 room) { findOrMake(param, 0x00, room + 100); - PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0); + PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0); paths[param].on = 0x00; } @@ -69,7 +69,7 @@ void DreamGenContext::turnAnyPathOff() { } RoomPaths *DreamGenContext::getRoomsPaths() { - void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144); + void *result = getSegment(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144); return (RoomPaths *)result; } diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index fcdaad902e..2d2d40baaa 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -95,7 +95,7 @@ void DreamGenContext::printSlow() { 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); + const Frame* charSet = (const Frame *)getSegment(data.word(kCharset1)).ptr(0, 0); do { uint16 offset = x; uint16 charCount = getNumber(charSet, string, maxWidth, centered, &offset); @@ -149,7 +149,7 @@ uint8 DreamGenContext::printDirect(const uint8* string, uint16 x, uint16 y, uint 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); + const Frame *charSet = (const Frame *)getSegment(data.word(kCurrentset)).ptr(0, 0); while (true) { uint16 offset = x; uint8 charCount = getNumber(charSet, *string, maxWidth, centered, &offset); diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h index 72b11c6df5..cd171a04c7 100644 --- a/engines/dreamweb/runtime.h +++ b/engines/dreamweb/runtime.h @@ -289,12 +289,6 @@ public: _freeSegments.push_back(id); } - SegmentRef segRef(uint16 seg) { - SegmentRef result(this); - result = seg; - return result; - } - inline void _cmp(uint8 a, uint8 b) { _sub(a, b); } diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 83db639ff5..17c05cd5c3 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -226,11 +226,11 @@ void DreamGenContext::saveGame() { } void DreamGenContext::namesToOld() { - memcpy(segRef(data.word(kBuffers)).ptr(kZoomspace, 0), cs.ptr(kSavenames, 0), 17*4); + memcpy(getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), cs.ptr(kSavenames, 0), 17*4); } void DreamGenContext::oldToNames() { - memcpy(cs.ptr(kSavenames, 0), segRef(data.word(kBuffers)).ptr(kZoomspace, 0), 17*4); + memcpy(cs.ptr(kSavenames, 0), getSegment(data.word(kBuffers)).ptr(kZoomspace, 0), 17*4); } void DreamGenContext::saveLoad() { @@ -330,8 +330,8 @@ void DreamGenContext::savePosition(unsigned int slot, const uint8 *descbuf) { engine->writeToSaveFile(data.ptr(kFileheader, kHeaderlen), kHeaderlen); engine->writeToSaveFile(descbuf, len[0]); engine->writeToSaveFile(data.ptr(kStartvars, len[1]), len[1]); - engine->writeToSaveFile(segRef(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); - engine->writeToSaveFile(segRef(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]); + engine->writeToSaveFile(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); + engine->writeToSaveFile(getSegment(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(); @@ -360,8 +360,8 @@ void DreamGenContext::loadPosition(unsigned int slot) { engine->readFromSaveFile(namebuf, 17); } engine->readFromSaveFile(data.ptr(kStartvars, len[1]), len[1]); - engine->readFromSaveFile(segRef(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); - engine->readFromSaveFile(segRef(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]); + engine->readFromSaveFile(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]); + engine->readFromSaveFile(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]); engine->readFromSaveFile(data.ptr(kMadeuproomdat, len[4]), len[4]); engine->readFromSaveFile(cs.ptr(kReelroutines, len[5]), len[5]); diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index 2659f5b885..8b4bc7f7bf 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -25,7 +25,7 @@ namespace DreamGen { Sprite *DreamGenContext::spriteTable() { - Sprite *sprite = (Sprite *)segRef(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite)); + Sprite *sprite = (Sprite *)getSegment(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite)); return sprite; } @@ -64,7 +64,7 @@ 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 *)getSegment(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c); } void DreamGenContext::clearSprites() { @@ -254,7 +254,7 @@ void DreamGenContext::backObject() { } void DreamGenContext::backObject(Sprite *sprite) { - SetObject *objData = (SetObject *)segRef(data.word(kSetdat)).ptr(sprite->objData(), 0); + SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->objData(), 0); if (sprite->delay != 0) { --sprite->delay; @@ -475,18 +475,18 @@ Frame *DreamGenContext::findSource() { uint16 currentFrame = data.word(kCurrentframe); if (currentFrame < 160) { data.word(kTakeoff) = 0; - return (Frame *)segRef(data.word(kReel1)).ptr(0, 0); + return (Frame *)getSegment(data.word(kReel1)).ptr(0, 0); } else if (currentFrame < 320) { data.word(kTakeoff) = 160; - return (Frame *)segRef(data.word(kReel2)).ptr(0, 0); + return (Frame *)getSegment(data.word(kReel2)).ptr(0, 0); } else { data.word(kTakeoff) = 320; - return (Frame *)segRef(data.word(kReel3)).ptr(0, 0); + return (Frame *)getSegment(data.word(kReel3)).ptr(0, 0); } } Reel *DreamGenContext::getReelStart() { - Reel *reel = (Reel *)segRef(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel)); + Reel *reel = (Reel *)getSegment(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel)); return reel; } @@ -520,7 +520,7 @@ const Frame *DreamGenContext::getReelFrameAX(uint16 frame) { } void DreamGenContext::showRain() { - Rain *rain = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0); + Rain *rain = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); // Do nothing if there's no rain at all if (rain->x == 255) @@ -631,7 +631,7 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { void DreamGenContext::updatePeople() { data.word(kListpos) = kPeoplelist; - memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); + memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); // The original callbacks are called with es:bx pointing to their reelRoutine entry. @@ -776,7 +776,7 @@ void DreamGenContext::checkOne() { 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); + const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3); *flag = tileData[0]; *flagEx = tileData[1]; *type = tileData[2]; @@ -802,7 +802,7 @@ void DreamGenContext::addToPeopleList() { 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)); + People *people = (People *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People)); people->setReelPointer(routine->reelPointer()); people->setRoutinePointer(routinePointer); people->b4 = routine->b7; @@ -882,7 +882,7 @@ static const RainLocation rainLocationList[] = { void DreamGenContext::initRain() { const RainLocation *r = rainLocationList; - Rain *rainList = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0); + Rain *rainList = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0); Rain *rain = rainList; uint8 rainSpacing = 0; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 65d600e77b..a64285875a 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -304,7 +304,7 @@ static Common::String getFilename(Context &context) { } uint8 *DreamGenContext::textUnder() { - return segRef(data.word(kBuffers)).ptr(kTextunder, 0); + return getSegment(data.word(kBuffers)).ptr(kTextunder, 0); } uint16 DreamGenContext::standardLoad(const char *fileName) { @@ -312,7 +312,7 @@ uint16 DreamGenContext::standardLoad(const char *fileName) { engine->readFromFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen); uint16 sizeInBytes = cs.word(kFiledata); uint16 result = allocateMem((sizeInBytes + 15) / 16); - engine->readFromFile(segRef(result).ptr(0, 0), sizeInBytes); + engine->readFromFile(getSegment(result).ptr(0, 0), sizeInBytes); engine->closeFile(); return result; } @@ -354,7 +354,7 @@ void DreamGenContext::loadTempCharset(const char *fileName) { } Frame *DreamGenContext::tempCharset() { - return (Frame *)segRef(data.word(kTempcharset)).ptr(0, 0); + return (Frame *)getSegment(data.word(kTempcharset)).ptr(0, 0); } void DreamGenContext::hangOnCurs(uint16 frameCount) { @@ -576,8 +576,8 @@ void DreamGenContext::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, data.word(kCounttotimed) = countToTimed; data.word(kTimecount) = timeCount + countToTimed; data.word(kTimedseg) = data.word(kTextfile1); - data.word(kTimedoffset) = kTextstart + segRef(data.word(kTextfile1)).word(textIndex * 2); - const uint8 *string = segRef(data.word(kTextfile1)).ptr(data.word(kTimedoffset), 0); + data.word(kTimedoffset) = kTextstart + getSegment(data.word(kTextfile1)).word(textIndex * 2); + const uint8 *string = getSegment(data.word(kTextfile1)).ptr(data.word(kTimedoffset), 0); debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, string); } @@ -802,7 +802,7 @@ void DreamGenContext::makeBackOb(SetObject *objData) { uint8 type = objData->type; Sprite *sprite = makeSprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0); - uint16 objDataOffset = (uint8 *)objData - segRef(data.word(kSetdat)).ptr(0, 0); + uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0); assert(objDataOffset % sizeof(SetObject) == 0); assert(objDataOffset < 128 * sizeof(SetObject)); sprite->setObjData(objDataOffset); @@ -833,14 +833,14 @@ void DreamGenContext::readHeader() { uint16 DreamGenContext::allocateAndLoad(unsigned int size) { // allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down uint16 result = allocateMem(size / 16); - engine->readFromFile(segRef(result).ptr(0, size), size); + engine->readFromFile(getSegment(result).ptr(0, size), size); return result; } void DreamGenContext::clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize) { assert(size <= maxSize); - uint8 *buf = segRef(seg).ptr(0, maxSize); + uint8 *buf = getSegment(seg).ptr(0, maxSize); memset(buf, c, maxSize); engine->readFromFile(buf, size); } @@ -945,7 +945,7 @@ void DreamGenContext::crosshair() { } else { frame = 29; } - const Frame *src = (const Frame *)segRef(data.word(kIcons1)).ptr(0, 0); + const Frame *src = (const Frame *)getSegment(data.word(kIcons1)).ptr(0, 0); showFrame(src, kZoomx + 24, kZoomy + 19, frame, 0); } @@ -964,9 +964,9 @@ void DreamGenContext::commandOnly() { void DreamGenContext::commandOnly(uint8 command) { delTextLine(); uint16 index = command * 2; - uint16 offset = kTextstart + segRef(data.word(kCommandtext)).word(index); + uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index); uint16 y = data.word(kTextaddressy); - const uint8 *string = segRef(data.word(kCommandtext)).ptr(offset, 0); + const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); printDirect(&string, data.word(kTextaddressx), &y, data.byte(kTextlen), (bool)(data.byte(kTextlen) & 1)); data.byte(kNewtextline) = 1; } @@ -976,7 +976,7 @@ void DreamGenContext::checkIfPerson() { } bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) { - People *people = (People *)segRef(data.word(kBuffers)).ptr(kPeoplelist, 0); + People *people = (People *)getSegment(data.word(kBuffers)).ptr(kPeoplelist, 0); for (size_t i = 0; i < 12; ++i, ++people) { if (people->b4 == 255) @@ -1010,7 +1010,7 @@ void DreamGenContext::checkIfFree() { } bool DreamGenContext::checkIfFree(uint8 x, uint8 y) { - const ObjPos *freeList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); + const ObjPos *freeList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos)); for (size_t i = 0; i < 80; ++i) { const ObjPos *objPos = freeList + 79 - i; if (objPos->index == 0xff || !objPos->contains(x,y)) @@ -1026,7 +1026,7 @@ void DreamGenContext::checkIfEx() { } bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { - const ObjPos *exList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos)); + const ObjPos *exList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos)); for (size_t i = 0; i < 100; ++i) { const ObjPos *objPos = exList + 99 - i; if (objPos->index == 0xff || !objPos->contains(x,y)) @@ -1040,20 +1040,20 @@ bool DreamGenContext::checkIfEx(uint8 x, uint8 y) { const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) { if (type == 5) { uint16 i = 64 * 2 * (index & 127); - uint16 offset = segRef(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext; - return segRef(data.word(kPeople)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext; + return getSegment(data.word(kPeople)).ptr(offset, 0); } else if (type == 4) { - uint16 offset = segRef(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext; - return segRef(data.word(kExtras)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext; + return getSegment(data.word(kExtras)).ptr(offset, 0); } else if (type == 2) { - uint16 offset = segRef(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext; - return segRef(data.word(kFreedesc)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext; + return getSegment(data.word(kFreedesc)).ptr(offset, 0); } else if (type == 1) { - uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext; - return segRef(data.word(kSetdesc)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext; + return getSegment(data.word(kSetdesc)).ptr(offset, 0); } else { - uint16 offset = segRef(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext; - return segRef(data.word(kBlockdesc)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext; + return getSegment(data.word(kBlockdesc)).ptr(offset, 0); } } @@ -1082,10 +1082,10 @@ void DreamGenContext::commandWithOb() { void DreamGenContext::commandWithOb(uint8 command, uint8 type, uint8 index) { uint8 commandLine[64] = "OBJECT NAME ONE "; delTextLine(); - uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2); + uint16 commandText = kTextstart + getSegment(data.word(kCommandtext)).word(command * 2); uint8 textLen = data.byte(kTextlen); { - const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0); + const uint8 *string = getSegment(data.word(kCommandtext)).ptr(commandText, 0); printDirect(string, data.word(kTextaddressx), data.word(kTextaddressy), textLen, (bool)(textLen & 1)); } copyName(type, index, commandLine); @@ -1101,7 +1101,7 @@ void DreamGenContext::examineObText() { } void DreamGenContext::showPanel() { - Frame *frame = (Frame *)segRef(data.word(kIcons1)).ptr(0, sizeof(Frame)); + Frame *frame = (Frame *)getSegment(data.word(kIcons1)).ptr(0, sizeof(Frame)); showFrame(frame, 72, 0, 19, 0); showFrame(frame, 192, 0, 19, 0); } @@ -1126,7 +1126,7 @@ void DreamGenContext::findOrMake() { } void DreamGenContext::findOrMake(uint8 index, uint8 value, uint8 type) { - Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); + Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); for (; change->index != 0xff; ++change) { if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) { change->value = value; @@ -1141,18 +1141,18 @@ void DreamGenContext::findOrMake(uint8 index, uint8 value, uint8 type) { } void DreamGenContext::setAllChanges() { - Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); + Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change)); for (; change->index != 0xff; ++change) if (change->location == data.byte(kReallocation)) doChange(change->index, change->value, change->type); } DynObject *DreamGenContext::getFreeAd(uint8 index) { - return (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0) + index; + return (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0) + index; } DynObject *DreamGenContext::getExAd(uint8 index) { - return (DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0) + index; + return (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0) + index; } DynObject *DreamGenContext::getEitherAdCPP() { @@ -1191,7 +1191,7 @@ void *DreamGenContext::getAnyAdDir(uint8 index, uint8 flag) { } SetObject *DreamGenContext::getSetAd(uint8 index) { - return (SetObject *)segRef(data.word(kSetdat)).ptr(0, 0) + index; + return (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 0) + index; } void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) { @@ -1209,8 +1209,8 @@ void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) { } void DreamGenContext::deleteTaken() { - const DynObject *extraObjects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0); - DynObject *freeObjects = (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0); + const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + DynObject *freeObjects = (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); for(size_t i = 0; i < kNumexobjects; ++i) { uint8 location = extraObjects[i].initialLocation; if (location == data.byte(kReallocation)) { @@ -1222,7 +1222,7 @@ void DreamGenContext::deleteTaken() { void DreamGenContext::getExPos() { es = data.word(kExtras); - const DynObject *objects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); + const DynObject *objects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, sizeof(DynObject)); for (size_t i = 0; i < kNumexobjects; ++i) { if (objects[i].mapad[0] == 0xff) { data.byte(kExpos) = i; @@ -1366,7 +1366,7 @@ void DreamGenContext::delPointer() { data.word(kDelherey) = data.word(kOldpointery); data.byte(kDelxs) = data.byte(kPointerxs); data.byte(kDelys) = data.byte(kPointerys); - multiPut(segRef(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys)); + multiPut(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys)); } void DreamGenContext::showBlink() { @@ -1387,7 +1387,7 @@ void DreamGenContext::showBlink() { blinkFrame = 6; static const uint8 blinkTab[] = { 16,18,18,17,16,16,16 }; uint8 width, height; - showFrame((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), 44, 32, blinkTab[blinkFrame], 0, &width, &height); + showFrame((Frame *)getSegment(data.word(kIcons1)).ptr(0, 0), 44, 32, blinkTab[blinkFrame], 0, &width, &height); } void DreamGenContext::dumpBlink() { @@ -1531,7 +1531,7 @@ void DreamGenContext::checkCoords(const RectWithCallback *rectWithCallbacks) { void DreamGenContext::showPointer() { showBlink(); - const Frame *icons1 = ((const Frame *)segRef(data.word(kIcons1)).ptr(0, 0)); + const Frame *icons1 = ((const Frame *)getSegment(data.word(kIcons1)).ptr(0, 0)); uint16 x = data.word(kMousex); data.word(kOldpointerx) = data.word(kMousex); uint16 y = data.word(kMousey); @@ -1539,9 +1539,9 @@ void DreamGenContext::showPointer() { if (data.byte(kPickup) == 1) { const Frame *frames; if (data.byte(kObjecttype) != 4) - frames = (const Frame *)segRef(data.word(kFreeframes)).ptr(0, 0); + frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); else - frames = (const Frame *)segRef(data.word(kExtras)).ptr(0, 0); + frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); const Frame *frame = frames + (3 * data.byte(kItemframe) + 1); uint8 width = frame->width; uint8 height = frame->height; @@ -1555,7 +1555,7 @@ void DreamGenContext::showPointer() { uint16 yMin = (y >= height / 2) ? y - height / 2 : 0; data.word(kOldpointerx) = xMin; data.word(kOldpointery) = yMin; - multiGet(segRef(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height); + multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height); showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128); showFrame(icons1, x, y, 3, 128); } else { @@ -1568,7 +1568,7 @@ void DreamGenContext::showPointer() { height = 12; data.byte(kPointerxs) = width; data.byte(kPointerys) = height; - multiGet(segRef(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height); + multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height); showFrame(icons1, x, y, data.byte(kPointerframe) + 20, 0); } } @@ -1632,8 +1632,8 @@ void DreamGenContext::printMessage() { } void DreamGenContext::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { - uint16 offset = kTextstart + segRef(data.word(kCommandtext)).word(index * 2); - const uint8 *string = segRef(data.word(kCommandtext)).ptr(offset, 0); + uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2); + const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0); printDirect(&string, x, &y, maxWidth, centered); } @@ -1653,8 +1653,8 @@ bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) { } bool DreamGenContext::isItDescribed(const ObjPos *pos) { - uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); - uint8 result = segRef(data.word(kSetdesc)).byte(kSettext + offset); + uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2); + uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset); return result != 0; } @@ -1674,7 +1674,7 @@ void DreamGenContext::showIcon() { panelIcons1(); zoomIcon(); } else { - Frame *tempSprites = (Frame *)segRef(data.word(kTempsprites)).ptr(0, 0); + Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0); showFrame(tempSprites, 72, 2, 45, 0); showFrame(tempSprites, 72+47, 2, 46, 0); showFrame(tempSprites, 69-10, 21, 49, 0); @@ -1690,7 +1690,7 @@ void DreamGenContext::checkIfSet() { } bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { - const ObjPos *setList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128); + const ObjPos *setList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128); for (size_t i = 0; i < 128; ++i) { const ObjPos *pos = setList + 127 - i; if (pos->index == 0xff || !pos->contains(x,y)) @@ -1706,7 +1706,7 @@ bool DreamGenContext::checkIfSet(uint8 x, uint8 y) { } void DreamGenContext::showRyanPage() { - Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0); + Frame *icons1 = (Frame *)getSegment(data.word(kIcons1)).ptr(0, 0); showFrame(icons1, kInventx + 167, kInventy - 12, 12, 0); showFrame(icons1, kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); } @@ -1857,7 +1857,7 @@ void DreamGenContext::zoomOnOff() { void DreamGenContext::sortOutMap() { const uint8 *src = workspace(); - uint8 *dst = (uint8 *)segRef(data.word(kMapdata)).ptr(0, 0); + uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0); for (uint16 y = 0; y < kMaplength; ++y) { memcpy(dst, src, kMapwidth); dst += kMapwidth; @@ -1903,7 +1903,7 @@ void DreamGenContext::mainScreen() { void DreamGenContext::showWatch() { if (data.byte(kWatchon)) { - showFrame((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), 250, 1, 6, 0); + showFrame((Frame *)getSegment(data.word(kIcons1)).ptr(0, 0), 250, 1, 6, 0); showTime(); } } @@ -1918,7 +1918,7 @@ void DreamGenContext::dumpWatch() { void DreamGenContext::showTime() { if (data.byte(kWatchon) == 0) return; - Frame *charset = (Frame *)segRef(data.word(kCharset1)).ptr(0, 0); + Frame *charset = (Frame *)getSegment(data.word(kCharset1)).ptr(0, 0); int seconds = data.byte(kSecondcount); int minutes = data.byte(kMinutecount); @@ -1941,7 +1941,7 @@ void DreamGenContext::watchCount() { return; ++data.byte(kTimercount); if (data.byte(kTimercount) == 9) { - showFrame((Frame *)segRef(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0); + showFrame((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0); data.byte(kWatchdump) = 1; } else if (data.byte(kTimercount) == 18) { data.byte(kTimercount) = 0; @@ -1968,8 +1968,8 @@ void DreamGenContext::roomName() { textIndex -= 32; data.word(kLinespacing) = 7; uint8 maxWidth = (data.byte(kWatchon) == 1) ? 120 : 160; - uint16 descOffset = segRef(data.word(kRoomdesc)).word(kIntextdat + textIndex * 2); - const uint8 *string = segRef(data.word(kRoomdesc)).ptr(kIntext + descOffset, 0); + uint16 descOffset = getSegment(data.word(kRoomdesc)).word(kIntextdat + textIndex * 2); + const uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext + descOffset, 0); printDirect(string, 88, 25, maxWidth, false); data.word(kLinespacing) = 10; useCharset1(); @@ -1978,7 +1978,7 @@ void DreamGenContext::roomName() { void DreamGenContext::zoomIcon() { if (data.byte(kZoomon) == 0) return; - showFrame((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), kZoomx, kZoomy-1, 8, 0); + showFrame((Frame *)getSegment(data.word(kIcons1)).ptr(0, 0), kZoomx, kZoomy-1, 8, 0); } void DreamGenContext::loadRoom() { @@ -2025,21 +2025,21 @@ void DreamGenContext::readSetData() { return; //engine->openFile("DREAMWEB.VOL"); - //uint8 *volumeTab = segRef(data.word(kSoundbuffer)).ptr(16384, 0); + //uint8 *volumeTab = getSegment(data.word(kSoundbuffer)).ptr(16384, 0); //engine->readFromFile(volumeTab, 2048-256); //engine->closeFile(); } Frame * DreamGenContext::tempGraphics() { - return (Frame *)segRef(data.word(kTempgraphics)).ptr(0, 0); + return (Frame *)getSegment(data.word(kTempgraphics)).ptr(0, 0); } Frame * DreamGenContext::tempGraphics2() { - return (Frame *)segRef(data.word(kTempgraphics2)).ptr(0, 0); + return (Frame *)getSegment(data.word(kTempgraphics2)).ptr(0, 0); } Frame * DreamGenContext::tempGraphics3() { - return (Frame *)segRef(data.word(kTempgraphics3)).ptr(0, 0); + return (Frame *)getSegment(data.word(kTempgraphics3)).ptr(0, 0); } void DreamGenContext::playChannel0(uint8 index, uint8 repeat) { @@ -2049,10 +2049,10 @@ void DreamGenContext::playChannel0(uint8 index, uint8 repeat) { data.byte(kCh0playing) = index; Sound *soundBank; if (index >= 12) { - soundBank = (Sound *)segRef(data.word(kSounddata2)).ptr(0, 0); + soundBank = (Sound *)getSegment(data.word(kSounddata2)).ptr(0, 0); index -= 12; } else - soundBank = (Sound *)segRef(data.word(kSounddata)).ptr(0, 0); + soundBank = (Sound *)getSegment(data.word(kSounddata)).ptr(0, 0); data.byte(kCh0repeat) = repeat; data.word(kCh0emmpage) = soundBank[index].emmPage; @@ -2078,10 +2078,10 @@ void DreamGenContext::playChannel1(uint8 index) { data.byte(kCh1playing) = index; Sound *soundBank; if (index >= 12) { - soundBank = (Sound *)segRef(data.word(kSounddata2)).ptr(0, 0); + soundBank = (Sound *)getSegment(data.word(kSounddata2)).ptr(0, 0); index -= 12; } else - soundBank = (Sound *)segRef(data.word(kSounddata)).ptr(0, 0); + soundBank = (Sound *)getSegment(data.word(kSounddata)).ptr(0, 0); data.word(kCh1emmpage) = soundBank[index].emmPage; data.word(kCh1offset) = soundBank[index].offset(); @@ -2134,8 +2134,8 @@ void DreamGenContext::doLook() { data.byte(kCommandtype) = 255; dumpTextLine(); uint8 index = data.byte(kRoomnum) & 31; - uint16 offset = segRef(data.word(kRoomdesc)).word(kIntextdat + index * 2); - uint8 *string = segRef(data.word(kRoomdesc)).ptr(kIntext, 0) + offset; + uint16 offset = getSegment(data.word(kRoomdesc)).word(kIntextdat + index * 2); + uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext, 0) + offset; findNextColon(&string); uint16 x; if (data.byte(kReallocation) < 50) @@ -2341,8 +2341,8 @@ void DreamGenContext::setLocation() { } const uint8 *DreamGenContext::getTextInFile1(uint16 index) { - uint16 offset = segRef(data.word(kTextfile1)).word(index * 2) + kTextstart; - const uint8 *string = segRef(data.word(kTextfile1)).ptr(offset, 0); + uint16 offset = getSegment(data.word(kTextfile1)).word(index * 2) + kTextstart; + const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); return string; } diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 55178cb150..35001a1677 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -25,7 +25,7 @@ namespace DreamGen { uint16 DreamGenContext::getPersFrame(uint8 index) { - return segRef(data.word(kPeople)).word(kPersonframes + index * 2); + return getSegment(data.word(kPeople)).word(kPersonframes + index * 2); } void DreamGenContext::convIcons() { diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index f0ed36620d..83725d63d1 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -25,15 +25,15 @@ namespace DreamGen { uint8 *DreamGenContext::mainPalette() { - return segRef(data.word(kBuffers)).ptr(kMaingamepal, 256*3); + return getSegment(data.word(kBuffers)).ptr(kMaingamepal, 256*3); } uint8 *DreamGenContext::startPalette() { - return segRef(data.word(kBuffers)).ptr(kStartpal, 256*3); + return getSegment(data.word(kBuffers)).ptr(kStartpal, 256*3); } uint8 *DreamGenContext::endPalette() { - return segRef(data.word(kBuffers)).ptr(kEndpal, 256*3); + return getSegment(data.word(kBuffers)).ptr(kEndpal, 256*3); } void DreamGenContext::clearStartPal() { diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index aee8417f70..1c297f1e93 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -27,7 +27,7 @@ namespace DreamGen { uint8 *DreamGenContext::workspace() { - uint8 *result = segRef(data.word(kWorkspace)).ptr(0, 0); + uint8 *result = getSegment(data.word(kWorkspace)).ptr(0, 0); return result; } @@ -431,11 +431,11 @@ void DreamGenContext::zoom() { } 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)); + multiGet(getSegment(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)); + multiPut(getSegment(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() { @@ -443,17 +443,17 @@ void DreamGenContext::dumpMap() { } void DreamGenContext::transferInv() { - const Frame *freeFrames = (const Frame *)segRef(data.word(kFreeframes)).ptr(kFrframedata, 0); + const Frame *freeFrames = (const Frame *)getSegment(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); + Frame *exFrames = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata, 0); Frame *exFrame = exFrames + (3 * data.byte(kExpos) + 1); exFrame->width = freeFrame->width; exFrame->height = freeFrame->height; exFrame->x = freeFrame->x; exFrame->y = freeFrame->y; uint16 byteCount = freeFrame->width * freeFrame->height; - const uint8 *src = segRef(data.word(kFreeframes)).ptr(kFrframes + freeFrame->ptr(), byteCount); - uint8 *dst = segRef(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount); + const uint8 *src = getSegment(data.word(kFreeframes)).ptr(kFrframes + freeFrame->ptr(), byteCount); + uint8 *dst = getSegment(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount); memcpy(dst, src, byteCount); exFrame->setPtr(data.word(kExframepos)); data.word(kExframepos) += byteCount; @@ -463,8 +463,8 @@ bool DreamGenContext::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { x -= pos->xMin; y -= pos->yMin; 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; + 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; return *ptr != 0; } @@ -477,7 +477,7 @@ void DreamGenContext::loadPalFromIFF() { readFromFile(); closeFile(); - const uint8 *src = segRef(data.word(kMapstore)).ptr(0x30, 0); + const uint8 *src = getSegment(data.word(kMapstore)).ptr(0x30, 0); uint8 *dst = mainPalette(); for (size_t i = 0; i < 256*3; ++i) { uint8 c = src[i] / 4; @@ -493,7 +493,7 @@ void DreamGenContext::loadPalFromIFF() { } void DreamGenContext::createPanel() { - Frame *icons = (Frame *)segRef(data.word(kIcons2)).ptr(0, 0); + Frame *icons = (Frame *)getSegment(data.word(kIcons2)).ptr(0, 0); showFrame(icons, 0, 8, 0, 2); showFrame(icons, 160, 8, 0, 2); showFrame(icons, 0, 104, 0, 2); @@ -502,7 +502,7 @@ void DreamGenContext::createPanel() { void DreamGenContext::createPanel2() { createPanel(); - Frame *icons = (Frame *)segRef(data.word(kIcons2)).ptr(0, 0); + Frame *icons = (Frame *)getSegment(data.word(kIcons2)).ptr(0, 0); showFrame(icons, 0, 0, 5, 2); showFrame(icons, 160, 0, 5, 2); } |