diff options
| author | Max Horn | 2011-12-13 14:21:21 +0100 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2011-12-14 12:46:40 +0100 | 
| commit | b466575d9e36d1c36e64e2d3cccadfd44e2e6940 (patch) | |
| tree | 806ef134dd2170db5ed7e514fb54a37e5a95e8a1 | |
| parent | e44a79fdd49e746947cbb88e3982dc8c89e2ae44 (diff) | |
| download | scummvm-rg350-b466575d9e36d1c36e64e2d3cccadfd44e2e6940.tar.gz scummvm-rg350-b466575d9e36d1c36e64e2d3cccadfd44e2e6940.tar.bz2 scummvm-rg350-b466575d9e36d1c36e64e2d3cccadfd44e2e6940.zip | |
DREAMWEB: Move more stuff to DreamBase
| -rw-r--r-- | engines/dreamweb/dreambase.h | 19 | ||||
| -rw-r--r-- | engines/dreamweb/monitor.cpp | 12 | ||||
| -rw-r--r-- | engines/dreamweb/stubs.cpp | 49 | ||||
| -rw-r--r-- | engines/dreamweb/stubs.h | 27 | 
4 files changed, 53 insertions, 54 deletions
| diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index a451704c6a..1a730ac541 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -55,6 +55,10 @@ public:  	void input();  	byte makeCaps(byte c);  	void delChar(); +	void monMessage(uint8 index); +	void netError(); +	void monitorLogo(); +	void randomAccess(uint16 count);  	void printOuterMon();  	void showCurrentFile();  	void accessLightOn(); @@ -155,6 +159,21 @@ public:  	void *getAnyAd(uint8 *value1, uint8 *value2);  	const uint8 *getTextInFile1(uint16 index);  	uint8 findNextColon(const uint8 **string); +	uint16 allocateMem(uint16 paragraphs); +	void deallocateMem(uint16 segment); +	uint16 allocateAndLoad(unsigned int size); +	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); +	void loadIntoTemp2(const char *fileName); +	void loadIntoTemp3(const char *fileName); +	void loadTempCharset(const char *fileName); +	void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); +	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize); +	void sortOutMap(); +	void loadRoomData(const Room &room, bool skipDat); +	void useTempCharset(); +	void useCharset1();  	// from use.cpp  	void placeFreeObject(uint8 index); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 5d0987b29e..30ba9b88e0 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -165,7 +165,7 @@ bool DreamGenContext::execCommand() { -void DreamGenContext::monitorLogo() { +void DreamBase::monitorLogo() {  	if (data.byte(kLogonum) != data.byte(kOldlogonum)) {  		data.byte(kOldlogonum) = data.byte(kLogonum);  		printLogo(); @@ -283,10 +283,6 @@ void DreamBase::delCurs() {  	multiDump(x, y, width, height);  } -void DreamGenContext::hangOnCurs() { -	hangOnCurs(cx); -} -  void DreamBase::scrollMonitor() {  	printLogo();  	printUnderMon(); @@ -318,7 +314,7 @@ void DreamGenContext::randomAccess() {  	randomAccess(cx);  } -void DreamGenContext::randomAccess(uint16 count) { +void DreamBase::randomAccess(uint16 count) {  	for (uint16 i = 0; i < count; ++i) {  		vSync();  		vSync(); @@ -335,7 +331,7 @@ void DreamGenContext::monMessage() {  	monMessage(al);  } -void DreamGenContext::monMessage(uint8 index) { +void DreamBase::monMessage(uint8 index) {  	assert(index > 0);  	const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);  	for (uint8 i = 0; i < index; ++i) { @@ -345,7 +341,7 @@ void DreamGenContext::monMessage(uint8 index) {  	monPrint(string);  } -void DreamGenContext::netError() { +void DreamBase::netError() {  	monMessage(5);  	scrollMonitor();  } diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c365ee48d3..55e7916fc0 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -744,7 +744,7 @@ uint8 *DreamBase::textUnder() {  	return getSegment(data.word(kBuffers)).ptr(kTextunder, 0);  } -uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInBytes) { +uint16 DreamBase::standardLoad(const char *fileName, uint16 *outSizeInBytes) {  	FileHeader header;  	Common::File file; @@ -758,7 +758,7 @@ uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInByte  	return result;  } -void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) { +void *DreamBase::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {  	uint16 sizeInBytes;  	uint16 seg = standardLoad(fileName, &sizeInBytes);  	void *buffer = malloc(sizeInBytes); @@ -769,28 +769,24 @@ void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBy  	return buffer;  } -void DreamGenContext::loadIntoTemp() { -	loadIntoTemp((const char *)data.ptr(dx, 0)); -} - -void DreamGenContext::loadIntoTemp(const char *fileName) { +void DreamBase::loadIntoTemp(const char *fileName) {  	data.word(kTempgraphics) = standardLoad(fileName);  } -void DreamGenContext::loadIntoTemp2(const char *fileName) { +void DreamBase::loadIntoTemp2(const char *fileName) {  	data.word(kTempgraphics2) = standardLoad(fileName);  } -void DreamGenContext::loadIntoTemp3(const char *fileName) { +void DreamBase::loadIntoTemp3(const char *fileName) {  	data.word(kTempgraphics3) = standardLoad(fileName);  } -void DreamGenContext::loadTempCharset() { -	loadTempCharset((const char *)data.ptr(dx, 0)); +void DreamBase::loadTempCharset(const char *fileName) { +	engine->setTempCharset(standardLoadCPP(fileName));  } -void DreamGenContext::loadTempCharset(const char *fileName) { -	engine->setTempCharset(standardLoadCPP(fileName)); +void DreamGenContext::hangOnCurs() { +	hangOnCurs(cx);  }  void DreamGenContext::hangOnCurs(uint16 frameCount) { @@ -970,22 +966,25 @@ void DreamGenContext::getTime() {  	data.byte(kHourcount) = ch;  } -uint16 DreamGenContext::allocateMem(uint16 paragraphs) { +uint16 DreamBase::allocateMem(uint16 paragraphs) {  	uint size = (paragraphs + 2) * 16;  	debug(1, "allocate mem, %u bytes", size); -	flags._c = false;  	SegmentRef seg = allocateSegment(size);  	uint16 result = (uint16)seg;  	debug(1, "\tsegment address -> %04x", result);  	return result;  } -void DreamGenContext::deallocateMem(uint16 segment) { +void DreamBase::deallocateMem(uint16 segment) {  	debug(1, "deallocating segment %04x", segment);  	deallocateSegment(segment); -	//fixing invalid entries in the sprite table -	es = data; + +	// FIXME: The following line used to be enabled with the comment: "fixing +	// invalid entries in the sprite table" +	// So if there are regressions with sprites, we may want to investigate this +	// closer. +//	es = data;  	uint tsize = 16 * 32;  	uint16 bseg = data.word(kBuffers);  	if (!bseg) @@ -1075,21 +1074,21 @@ void DreamGenContext::makeBackOb(SetObject *objData) {  	sprite->animFrame = 0;  } -uint16 DreamGenContext::allocateAndLoad(unsigned int size) { +uint16 DreamBase::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(getSegment(result).ptr(0, size), size);  	return result;  } -void DreamGenContext::clearAndLoad(uint8 *buf, uint8 c, +void DreamBase::clearAndLoad(uint8 *buf, uint8 c,                                     unsigned int size, unsigned int maxSize) {  	assert(size <= maxSize);  	memset(buf, c, maxSize);  	engine->readFromFile(buf, size);  } -void DreamGenContext::clearAndLoad(uint16 seg, uint8 c, +void DreamBase::clearAndLoad(uint16 seg, uint8 c,                                     unsigned int size, unsigned int maxSize) {  	assert(size <= maxSize);  	uint8 *buf = getSegment(seg).ptr(0, maxSize); @@ -2027,7 +2026,7 @@ void DreamGenContext::zoomOnOff() {  	workToScreenM();  } -void DreamGenContext::sortOutMap() { +void DreamBase::sortOutMap() {  	const uint8 *src = workspace();  	uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);  	for (uint16 y = 0; y < kMaplength; ++y) { @@ -2262,11 +2261,11 @@ void DreamGenContext::doLook() {  	workToScreenM();  } -void DreamGenContext::useCharset1() { +void DreamBase::useCharset1() {  	engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0));  } -void DreamGenContext::useTempCharset() { +void DreamBase::useTempCharset() {  	engine->setCurrentCharset(engine->tempCharset());  } @@ -2310,7 +2309,7 @@ void DreamGenContext::getRidOfAll() {  }  // if skipDat, skip clearing and loading Setdat and Freedat -void DreamGenContext::loadRoomData(const Room &room, bool skipDat) { +void DreamBase::loadRoomData(const Room &room, bool skipDat) {  	engine->openFile(room.name);  	FileHeader header; diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 481e784e4a..089272bb0b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -27,16 +27,6 @@  	void startup1();  	void switchRyanOn();  	void switchRyanOff(); -	uint16 allocateMem(uint16 paragraphs); -	void deallocateMem(uint16 segment); -	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(); -	void loadIntoTemp(const char *fileName); -	void loadIntoTemp2(const char *fileName); -	void loadIntoTemp3(const char *fileName); -	void loadTempCharset(); -	void loadTempCharset(const char *fileName);  	void saveLoad();  	void hangOnCurs(uint16 frameCount);  	void hangOnCurs(); @@ -236,7 +226,6 @@  	void getBlockOfPixel();  	uint8 getBlockOfPixel(uint8 x, uint8 y);  	void examineObText(); -	void sortOutMap();  	void showCity();  	uint16 getPersFrame(uint8 index);  	void convIcons(); @@ -274,11 +263,14 @@  	const char *monPrint(const char *string) {  		return DreamBase::monPrint(string);  	} -	void randomAccess(uint16 count);  	void randomAccess(); -	void monMessage(uint8 index); +	void randomAccess(uint16 count) { +		DreamBase::randomAccess(count); +	}  	void monMessage(); -	void netError(); +	void monMessage(uint8 index) { +		DreamBase::monMessage(index); +	}  	void playChannel1();  	void playChannel1(uint8 index) {  		DreamBase::playChannel1(index); @@ -291,8 +283,6 @@  	void look();  	void autoLook();  	void doLook(); -	void useTempCharset(); -	void useCharset1();  	void getBackFromOb();  	void getRidOfAll();  	void getRidOfTemp(); @@ -307,10 +297,6 @@  	void actualLoad();  	void loadPosition(unsigned int slot);  	void savePosition(unsigned int slot, const char *descbuf); -	uint16 allocateAndLoad(unsigned int size); -	void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); -	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize); -	void loadRoomData(const Room &room, bool skipDat);  	void restoreAll();  	void restoreReels();  	void enterSymbol(); @@ -570,7 +556,6 @@  	void hangOnPQ();  	void showGun();  	void endGame(); -	void monitorLogo();  	void quitSymbol();  	void diaryKeyP();  	void diaryKeyN(); | 
