diff options
author | Max Horn | 2011-12-20 11:05:24 +0100 |
---|---|---|
committer | Max Horn | 2011-12-23 10:18:01 +0100 |
commit | f41412186ba7bf3748428b572a3e5147d4313064 (patch) | |
tree | 07c68b98c2a3194178b31ab5bf76012f0b88048e /engines | |
parent | ef98df589563d77625928b69be79f7227e97d4a7 (diff) | |
download | scummvm-rg350-f41412186ba7bf3748428b572a3e5147d4313064.tar.gz scummvm-rg350-f41412186ba7bf3748428b572a3e5147d4313064.tar.bz2 scummvm-rg350-f41412186ba7bf3748428b572a3e5147d4313064.zip |
DREAMWEB: Add newplace.cpp
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreambase.h | 12 | ||||
-rw-r--r-- | engines/dreamweb/module.mk | 1 | ||||
-rw-r--r-- | engines/dreamweb/newplace.cpp | 251 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 217 |
4 files changed, 259 insertions, 222 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 18eff56a77..01772bb2ff 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -137,6 +137,13 @@ public: void loadNews(); void loadCart(); + // from newplace.cpp + void getUnderCentre(); + void putUnderCentre(); + void showArrows(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + // from object.cpp void obIcons(); void fillRyan(); @@ -329,7 +336,6 @@ public: Frame *tempGraphics(); Frame *tempGraphics2(); Frame *tempGraphics3(); - void showArrows(); void middlePanel(); void showDiary(); void readMouse(); @@ -503,10 +509,6 @@ public: inline uint8 *workspace() { return _workspace; } void clearWork(); - uint8 getLocation(uint8 index); - void setLocation(uint8 index); - void getUnderCentre(); - void putUnderCentre(); uint8 *mapStore(); void panelToMap(); void mapToPanel(); diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk index 398f0b8db0..9b6d9f30df 100644 --- a/engines/dreamweb/module.mk +++ b/engines/dreamweb/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ dreamgen.o \ keypad.o \ monitor.o \ + newplace.o \ object.o \ pathfind.o \ people.o \ diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp new file mode 100644 index 0000000000..ba1276b9c6 --- /dev/null +++ b/engines/dreamweb/newplace.cpp @@ -0,0 +1,251 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "dreamweb/dreamweb.h" + +namespace DreamGen { + +void DreamGenContext::newPlace() { + if (data.byte(kNeedtotravel) == 1) { + data.byte(kNeedtotravel) = 0; + selectLocation(); + } else if (data.byte(kAutolocation) != 0xFF) { + data.byte(kNewlocation) = data.byte(kAutolocation); + data.byte(kAutolocation) = 0xFF; + } +} + +void DreamGenContext::selectLocation() { + data.byte(kInmaparea) = 0; + clearBeforeLoad(); + data.byte(kGetback) = 0; + data.byte(kPointerframe) = 22; + readCityPic(); + showCity(); + getRidOfTemp(); + readDestIcon(); + loadTravelText(); + showPanel(); + showMan(); + showArrows(); + showExit(); + locationPic(); + underTextLine(); + data.byte(kCommandtype) = 255; + readMouse(); + data.byte(kPointerframe) = 0; + showPointer(); + workToScreenCPP(); + playChannel0(9, 255); + data.byte(kNewlocation) = 255; + + while (data.byte(kNewlocation) == 255) { + if (quitRequested()) + break; + + delPointer(); + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + + if (data.byte(kGetback) == 1) + break; + + RectWithCallback<DreamGenContext> destList[] = { + { 238,258,4,44,&DreamGenContext::nextDest }, + { 104,124,4,44,&DreamGenContext::lastDest }, + { 280,308,4,44,&DreamGenContext::lookAtPlace }, + { 104,216,138,192,&DreamGenContext::destSelect }, + { 273,320,157,198,&DreamBase::getBack1 }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + checkCoords(destList); + } + + if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { + data.byte(kNewlocation) = data.byte(kReallocation); + data.byte(kGetback) = 0; + } + + getRidOfTemp(); + getRidOfTemp2(); + getRidOfTemp3(); + deallocateMem(data.word(kTraveltext)); +} + +void DreamGenContext::showCity() { + clearWork(); + showFrame(tempGraphics(), 57, 32, 0, 0); + showFrame(tempGraphics(), 120+57, 32, 1, 0); +} + +void DreamGenContext::lookAtPlace() { + if (data.byte(kCommandtype) != 224) { + data.byte(kCommandtype) = 224; + commandOnly(27); + } + + if (!(data.word(kMousebutton) & 1) || + data.word(kMousebutton) == data.word(kOldbutton) || + data.byte(kDestpos) >= 15) + return; // noinfo + + delPointer(); + delTextLine(); + getUnderCentre(); + showFrame(tempGraphics3(), 60, 72, 0, 0); + showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); + if (data.byte(kForeignrelease)) + showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); + + uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); + const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); + findNextColon(&string); + uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; + printDirect(&string, 63, &y, 191, 191 & 1); + workToScreenM(); + hangOnP(500); + data.byte(kPointermode) = 0; + data.byte(kPointerframe) = 0; + putUnderCentre(); + workToScreenM(); +} + +void DreamBase::getUnderCentre() { + multiGet(mapStore(), 58, 72, 254, 110); +} + +void DreamBase::putUnderCentre() { + multiPut(mapStore(), 58, 72, 254, 110); +} + +// TODO: put Locationpic here + +// TODO: put Getdestinfo here + +void DreamBase::showArrows() { + showFrame(tempGraphics(), 116 - 12, 16, 0, 0); + showFrame(tempGraphics(), 226 + 12, 16, 1, 0); + showFrame(tempGraphics(), 280, 14, 2, 0); +} + +void DreamGenContext::nextDest() { + if (data.byte(kCommandtype) != 218) { + data.byte(kCommandtype) = 218; + commandOnly(28); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodu + + do { + data.byte(kDestpos)++; + if (data.byte(kDestpos) == 15) + data.byte(kDestpos) = 0; // last destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::lastDest() { + if (data.byte(kCommandtype) != 219) { + data.byte(kCommandtype) = 219; + commandOnly(29); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // nodd + + do { + data.byte(kDestpos)--; + if (data.byte(kDestpos) == 0xFF) + data.byte(kDestpos) = 15; // first destination + + getDestInfo(); + } while (al == 0); + + data.byte(kNewtextline) = 1; + delTextLine(); + delPointer(); + showPanel(); + showMan(); + showArrows(); + locationPic(); + underTextLine(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + +void DreamGenContext::destSelect() { + if (data.byte(kCommandtype) != 222) { + data.byte(kCommandtype) = 222; + commandOnly(30); + } + + if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) + return; // notrav + + getDestInfo(); + data.byte(kNewlocation) = data.byte(kDestpos); +} + +uint8 DreamBase::getLocation(uint8 index) { + return data.byte(kRoomscango + index); +} + +void DreamBase::setLocation(uint8 index) { + data.byte(kRoomscango + index) = 1; +} + +// TODO: Place resetLocation here + +void DreamGenContext::readDestIcon() { + loadIntoTemp("DREAMWEB.G05"); + loadIntoTemp2("DREAMWEB.G06"); + loadIntoTemp3("DREAMWEB.G08"); +} + +void DreamGenContext::readCityPic() { + loadIntoTemp("DREAMWEB.G04"); +} + + + +} // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index dde9613f52..137fad4526 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -846,14 +846,6 @@ void DreamBase::putUnderTimed() { multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), data.byte(kTimedx), y, 240, kUndertimedysize); } -void DreamBase::getUnderCentre() { - multiGet(mapStore(), 58, 72, 254, 110); -} - -void DreamBase::putUnderCentre() { - multiPut(mapStore(), 58, 72, 254, 110); -} - void DreamGenContext::triggerMessage(uint16 index) { multiGet(mapStore(), 174, 153, 200, 63); uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(index * 2); @@ -1990,12 +1982,6 @@ void DreamBase::sortOutMap() { } } -void DreamGenContext::showCity() { - clearWork(); - showFrame(tempGraphics(), 57, 32, 0, 0); - showFrame(tempGraphics(), 120+57, 32, 1, 0); -} - void DreamGenContext::mainScreen() { data.byte(kInmaparea) = 0; if (data.byte(kWatchon) == 1) { @@ -2461,14 +2447,6 @@ void DreamBase::examIcon() { showFrame(engine->icons2(), 254, 5, 3, 0); } -uint8 DreamBase::getLocation(uint8 index) { - return data.byte(kRoomscango + index); -} - -void DreamBase::setLocation(uint8 index) { - data.byte(kRoomscango + index) = 1; -} - const uint8 *DreamBase::getTextInFile1(uint16 index) { SegmentRef text = getSegment(data.word(kTextfile1)); uint16 offset = text.word(index * 2) + kTextstart; @@ -2711,16 +2689,6 @@ void DreamGenContext::atmospheres() { cancelCh0(); } -void DreamGenContext::readCityPic() { - loadIntoTemp("DREAMWEB.G04"); -} - -void DreamGenContext::readDestIcon() { - loadIntoTemp("DREAMWEB.G05"); - loadIntoTemp2("DREAMWEB.G06"); - loadIntoTemp3("DREAMWEB.G08"); -} - uint8 DreamGenContext::nextSymbol(uint8 symbol) { uint8 result = symbol + 1; if (result == 6) @@ -3370,81 +3338,6 @@ void DreamGenContext::reExFromOpen() { } -void DreamGenContext::nextDest() { - if (data.byte(kCommandtype) != 218) { - data.byte(kCommandtype) = 218; - commandOnly(28); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodu - - do { - data.byte(kDestpos)++; - if (data.byte(kDestpos) == 15) - data.byte(kDestpos) = 0; // last destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::lastDest() { - if (data.byte(kCommandtype) != 219) { - data.byte(kCommandtype) = 219; - commandOnly(29); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // nodd - - do { - data.byte(kDestpos)--; - if (data.byte(kDestpos) == 0xFF) - data.byte(kDestpos) = 15; // first destination - - getDestInfo(); - } while (al == 0); - - data.byte(kNewtextline) = 1; - delTextLine(); - delPointer(); - showPanel(); - showMan(); - showArrows(); - locationPic(); - underTextLine(); - readMouse(); - showPointer(); - workToScreenCPP(); - delPointer(); -} - -void DreamGenContext::destSelect() { - if (data.byte(kCommandtype) != 222) { - data.byte(kCommandtype) = 222; - commandOnly(30); - } - - if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1) - return; // notrav - - getDestInfo(); - data.byte(kNewlocation) = data.byte(kDestpos); -} - void DreamGenContext::putBackObStuff() { createPanel(); showPanel(); @@ -3522,68 +3415,6 @@ void DreamBase::dumpZoom() { multiDump(kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamGenContext::selectLocation() { - data.byte(kInmaparea) = 0; - clearBeforeLoad(); - data.byte(kGetback) = 0; - data.byte(kPointerframe) = 22; - readCityPic(); - showCity(); - getRidOfTemp(); - readDestIcon(); - loadTravelText(); - showPanel(); - showMan(); - showArrows(); - showExit(); - locationPic(); - underTextLine(); - data.byte(kCommandtype) = 255; - readMouse(); - data.byte(kPointerframe) = 0; - showPointer(); - workToScreenCPP(); - playChannel0(9, 255); - data.byte(kNewlocation) = 255; - - while (data.byte(kNewlocation) == 255) { - if (quitRequested()) - break; - - delPointer(); - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - - if (data.byte(kGetback) == 1) - break; - - RectWithCallback<DreamGenContext> destList[] = { - { 238,258,4,44,&DreamGenContext::nextDest }, - { 104,124,4,44,&DreamGenContext::lastDest }, - { 280,308,4,44,&DreamGenContext::lookAtPlace }, - { 104,216,138,192,&DreamGenContext::destSelect }, - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, - { 0xFFFF,0,0,0,0 } - }; - checkCoords(destList); - } - - if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) { - data.byte(kNewlocation) = data.byte(kReallocation); - data.byte(kGetback) = 0; - } - - getRidOfTemp(); - getRidOfTemp2(); - getRidOfTemp3(); - deallocateMem(data.word(kTraveltext)); -} - - void DreamBase::examineInventory() { if (data.byte(kCommandtype) != 249) { data.byte(kCommandtype) = 249; @@ -3604,12 +3435,6 @@ void DreamBase::examineInventory() { workToScreenM(); } -void DreamBase::showArrows() { - showFrame(tempGraphics(), 116 - 12, 16, 0, 0); - showFrame(tempGraphics(), 226 + 12, 16, 1, 0); - showFrame(tempGraphics(), 280, 14, 2, 0); -} - void DreamBase::middlePanel() { Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0); showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0); @@ -4020,16 +3845,6 @@ void DreamBase::getBack1() { } } -void DreamGenContext::newPlace() { - if (data.byte(kNeedtotravel) == 1) { - data.byte(kNeedtotravel) = 0; - selectLocation(); - } else if (data.byte(kAutolocation) != 0xFF) { - data.byte(kNewlocation) = data.byte(kAutolocation); - data.byte(kAutolocation) = 0xFF; - } -} - void DreamGenContext::monkSpeaking() { // FIXME: This is the CD version only. @@ -4473,38 +4288,6 @@ void DreamGenContext::showDiaryKeys() { showDiaryPage(); } -void DreamGenContext::lookAtPlace() { - if (data.byte(kCommandtype) != 224) { - data.byte(kCommandtype) = 224; - commandOnly(27); - } - - if (!(data.word(kMousebutton) & 1) || - data.word(kMousebutton) == data.word(kOldbutton) || - data.byte(kDestpos) >= 15) - return; // noinfo - - delPointer(); - delTextLine(); - getUnderCentre(); - showFrame(tempGraphics3(), 60, 72, 0, 0); - showFrame(tempGraphics3(), 60, 72 + 55, 4, 0); - if (data.byte(kForeignrelease)) - showFrame(tempGraphics3(), 60, 72+55+21, 4, 0); - - uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2); - const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0); - findNextColon(&string); - uint16 y = (data.byte(kForeignrelease)) ? 84 + 4 : 84; - printDirect(&string, 63, &y, 191, 191 & 1); - workToScreenM(); - hangOnP(500); - data.byte(kPointermode) = 0; - data.byte(kPointerframe) = 0; - putUnderCentre(); - workToScreenM(); -} - void DreamGenContext::edensFlatReminders() { if (data.byte(kReallocation) != 24 || data.byte(kMapx) != 44) return; // not in Eden's lift |