[Scummvm-cvs-logs] scummvm master -> 6e70f7728915b766d647668a156b09f84a3c40cf

wjp wjp at usecode.org
Thu Feb 23 22:38:43 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
256d160679 DREAMWEB: Remove shared temp graphics variables.
6e70f77289 DREAMWEB: Dynamically allocate GraphicsFile::_frames.


Commit: 256d160679eb211e9a38fbcf18ee5fedd232fc72
    https://github.com/scummvm/scummvm/commit/256d160679eb211e9a38fbcf18ee5fedd232fc72
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2012-02-23T13:34:22-08:00

Commit Message:
DREAMWEB: Remove shared temp graphics variables.

Instead, have a different variable for each use.

Changed paths:
    engines/dreamweb/dreamweb.h
    engines/dreamweb/keypad.cpp
    engines/dreamweb/monitor.cpp
    engines/dreamweb/newplace.cpp
    engines/dreamweb/print.cpp
    engines/dreamweb/saveload.cpp
    engines/dreamweb/stubs.cpp
    engines/dreamweb/titles.cpp
    engines/dreamweb/use.cpp



diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 38016e5..c67dfb3 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -265,13 +265,28 @@ protected:
 	TextFile _puzzleText;
 	TextFile _commandText;
 
-	// graphics files
-	GraphicsFile _tempGraphics;
-	GraphicsFile _tempGraphics2;
-	GraphicsFile _tempGraphics3;
+	// local graphics files
+	GraphicsFile _keypadGraphics;
+	GraphicsFile _menuGraphics;
+	GraphicsFile _menuGraphics2;
+	GraphicsFile _folderGraphics;
+	GraphicsFile _folderGraphics2;
+	GraphicsFile _folderGraphics3;
+	GraphicsFile _folderCharset;
+	GraphicsFile _symbolGraphics;
+	GraphicsFile _diaryGraphics;
+	GraphicsFile _diaryCharset;
+	GraphicsFile _monitorGraphics;
+	GraphicsFile _monitorCharset;
+	GraphicsFile _newplaceGraphics;
+	GraphicsFile _newplaceGraphics2;
+	GraphicsFile _newplaceGraphics3;
+	GraphicsFile _cityGraphics;
+	GraphicsFile _saveGraphics;
+
+	// global graphics files
 	GraphicsFile _icons1;
 	GraphicsFile _icons2;
-	GraphicsFile _tempCharset;
 	GraphicsFile _charset1;
 	GraphicsFile _mainSprites;
 	const GraphicsFile *_currentCharset;
@@ -797,15 +812,11 @@ public:
 	void loadGraphicsFile(GraphicsFile &file, const char *fileName);
 	void loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len);
 	void loadTextSegment(TextFile &file, Common::File &inFile, unsigned int len);
-	void loadIntoTemp(const char *fileName);
-	void loadIntoTemp2(const char *fileName);
-	void loadIntoTemp3(const char *fileName);
-	void loadTempCharset(const char *fileName);
 	void loadTravelText();
 	void loadTempText(const char *fileName);
 	void sortOutMap();
 	void loadRoomData(const Room &room, bool skipDat);
-	void useTempCharset();
+	void useTempCharset(GraphicsFile *charset);
 	void useCharset1();
 	void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
 	void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count);
@@ -848,11 +859,7 @@ public:
 	bool isItWorn(const DynObject *object);
 	bool compare(uint8 index, uint8 flag, const char id[4]);
 	void hangOnW(uint16 frameCount);
-	void getRidOfTemp();
 	void getRidOfTempText();
-	void getRidOfTemp2();
-	void getRidOfTemp3();
-	void getRidOfTempCharset();
 	void getRidOfAll();
 	void placeSetObject(uint8 index);
 	void removeSetObject(uint8 index);
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index 2a31652..172e851 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -93,7 +93,7 @@ void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
 		}
 	}
 	_manIsOffScreen = 0;
-	getRidOfTemp();
+	_keypadGraphics.clear();
 	restoreReels();
 	redrawMainScrn();
 	workToScreenM();
@@ -108,7 +108,7 @@ bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 d
 }
 
 void DreamWebEngine::loadKeypad() {
-	loadIntoTemp("DREAMWEB.G02");
+	loadGraphicsFile(_keypadGraphics, "DREAMWEB.G02");
 }
 
 void DreamWebEngine::quitKey() {
@@ -185,8 +185,8 @@ void DreamWebEngine::buttonPress(uint8 buttonId) {
 }
 
 void DreamWebEngine::showOuterPad() {
-	showFrame(_tempGraphics, kKeypadx-3, kKeypady-4, 1, 0);
-	showFrame(_tempGraphics, kKeypadx+74, kKeypady+76, 37, 0);
+	showFrame(_keypadGraphics, kKeypadx-3, kKeypady-4, 1, 0);
+	showFrame(_keypadGraphics, kKeypadx+74, kKeypady+76, 37, 0);
 }
 
 void DreamWebEngine::showKeypad() {
@@ -214,7 +214,7 @@ void DreamWebEngine::showKeypad() {
 		}
 		if ((_lightCount >= 60) && (_lightCount < 100))
 			--frameIndex;
-		showFrame(_tempGraphics, kKeypadx+60, y, frameIndex, 0);
+		showFrame(_keypadGraphics, kKeypadx+60, y, frameIndex, 0);
 	}
 }
 
@@ -225,7 +225,7 @@ void DreamWebEngine::singleKey(uint8 key, uint16 x, uint16 y) {
 			key -= 11;
 	}
 	key -= 20;
-	showFrame(_tempGraphics, x, y, key, 0);
+	showFrame(_keypadGraphics, x, y, key, 0);
 }
 
 void DreamWebEngine::dumpKeypad() {
@@ -241,9 +241,9 @@ void DreamWebEngine::useMenu() {
 	_vars._newObs = 0;
 	drawFloor();
 	printSprites();
-	showFrame(_tempGraphics2, kMenux-48, kMenuy-4, 4, 0);
+	showFrame(_menuGraphics2, kMenux-48, kMenuy-4, 4, 0);
 	getUnderMenu();
-	showFrame(_tempGraphics2, kMenux+54, kMenuy+72, 5, 0);
+	showFrame(_menuGraphics2, kMenux+54, kMenuy+72, 5, 0);
 	workToScreenM();
 	_getBack = 0;
 	do {
@@ -265,8 +265,8 @@ void DreamWebEngine::useMenu() {
 	} while ((_getBack != 1) && !_quitRequested);
 	_manIsOffScreen = 0;
 	redrawMainScrn();
-	getRidOfTemp();
-	getRidOfTemp2();
+	_menuGraphics.clear();
+	_menuGraphics2.clear();
 	restoreReels();
 	workToScreenM();
 }
@@ -289,12 +289,12 @@ void DreamWebEngine::showMenu() {
 	++_menuCount;
 	if (_menuCount == 37*2)
 		_menuCount = 0;
-	showFrame(_tempGraphics, kMenux, kMenuy, _menuCount / 2, 0);
+	showFrame(_menuGraphics, kMenux, kMenuy, _menuCount / 2, 0);
 }
 
 void DreamWebEngine::loadMenu() {
-	loadIntoTemp("DREAMWEB.S02"); // sprite name 3
-	loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2
+	loadGraphicsFile(_menuGraphics, "DREAMWEB.S02"); // sprite name 3
+	loadGraphicsFile(_menuGraphics2, "DREAMWEB.G07"); // mon. graphics 2
 }
 
 void DreamWebEngine::viewFolder() {
@@ -317,10 +317,10 @@ void DreamWebEngine::viewFolder() {
 		checkFolderCoords();
 	} while (_getBack == 0);
 	_manIsOffScreen = 0;
-	getRidOfTemp();
-	getRidOfTemp2();
-	getRidOfTemp3();
-	getRidOfTempCharset();
+	_folderGraphics.clear();
+	_folderGraphics2.clear();
+	_folderGraphics3.clear();
+	_folderCharset.clear();
 	restoreAll();
 	redrawMainScrn();
 	workToScreenM();
@@ -394,22 +394,22 @@ void DreamWebEngine::checkFolderCoords() {
 }
 
 void DreamWebEngine::loadFolder() {
-	loadIntoTemp("DREAMWEB.G09"); // folder graphics 1
-	loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2
-	loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3
-	loadTempCharset("DREAMWEB.C02"); // character set 3
+	loadGraphicsFile(_folderGraphics, "DREAMWEB.G09"); // folder graphics 1
+	loadGraphicsFile(_folderGraphics2, "DREAMWEB.G10"); // folder graphics 2
+	loadGraphicsFile(_folderGraphics3, "DREAMWEB.G11"); // folder graphics 3
+	loadGraphicsFile(_folderCharset, "DREAMWEB.C02"); // character set 3
 	loadTempText("DREAMWEB.T50"); // folder text
 }
 
 void DreamWebEngine::showFolder() {
 	_commandType = 255;
 	if (_folderPage) {
-		useTempCharset();
+		useTempCharset(&_folderCharset);
 		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(_folderGraphics, 0, 0, 0, 0);
+		showFrame(_folderGraphics, 143, 0, 1, 0);
+		showFrame(_folderGraphics, 0, 92, 2, 0);
+		showFrame(_folderGraphics, 143, 92, 3, 0);
 		folderExit();
 		if (_folderPage != 1)
 			showLeftPage();
@@ -419,25 +419,25 @@ void DreamWebEngine::showFolder() {
 		underTextLine();
 	} else {
 		createPanel2();
-		showFrame(_tempGraphics3, 143-28, 0, 0, 0);
-		showFrame(_tempGraphics3, 143-28, 92, 1, 0);
+		showFrame(_folderGraphics3, 143-28, 0, 0, 0);
+		showFrame(_folderGraphics3, 143-28, 92, 1, 0);
 		folderExit();
 		underTextLine();
 	}
 }
 
 void DreamWebEngine::folderExit() {
-	showFrame(_tempGraphics2, 296, 178, 6, 0);
+	showFrame(_folderGraphics2, 296, 178, 6, 0);
 }
 
 void DreamWebEngine::showLeftPage() {
-	showFrame(_tempGraphics2, 0, 12, 3, 0);
+	showFrame(_folderGraphics2, 0, 12, 3, 0);
 	uint16 y = 12+5;
 	for (size_t i = 0; i < 9; ++i) {
-		showFrame(_tempGraphics2, 0, y, 4, 0);
+		showFrame(_folderGraphics2, 0, y, 4, 0);
 		y += 16;
 	}
-	showFrame(_tempGraphics2, 0, y, 5, 0);
+	showFrame(_folderGraphics2, 0, y, 5, 0);
 	_lineSpacing = 8;
 	_charShift = 91;
 	_kerning = 1;
@@ -464,14 +464,14 @@ void DreamWebEngine::showLeftPage() {
 }
 
 void DreamWebEngine::showRightPage() {
-	showFrame(_tempGraphics2, 143, 12, 0, 0);
+	showFrame(_folderGraphics2, 143, 12, 0, 0);
 	uint16 y = 12+37;
 	for (size_t i = 0; i < 7; ++i) {
-		showFrame(_tempGraphics2, 143, y, 1, 0);
+		showFrame(_folderGraphics2, 143, y, 1, 0);
 		y += 16;
 	}
 
-	showFrame(_tempGraphics2, 143, y, 2, 0);
+	showFrame(_folderGraphics2, 143, y, 2, 0);
 	_lineSpacing = 8;
 	_kerning = 1;
 	uint8 pageIndex = _folderPage - 1;
@@ -491,7 +491,7 @@ void DreamWebEngine::showRightPage() {
 void DreamWebEngine::enterSymbol() {
 	_manIsOffScreen = 1;
 	getRidOfReels();
-	loadIntoTemp("DREAMWEB.G12"); // symbol graphics
+	loadGraphicsFile(_symbolGraphics, "DREAMWEB.G12"); // symbol graphics
 	_symbolTopX = 24;
 	_symbolTopDir = 0;
 	_symbolBotX = 24;
@@ -529,7 +529,7 @@ void DreamWebEngine::enterSymbol() {
 		turnAnyPathOn(0, _roomNum + 12);
 		_manIsOffScreen = 0;
 		redrawMainScrn();
-		getRidOfTemp();
+		_symbolGraphics.clear();
 		restoreReels();
 		workToScreenM();
 		playChannel1(13);
@@ -539,7 +539,7 @@ void DreamWebEngine::enterSymbol() {
 		turnAnyPathOff(0, _roomNum + 12);
 		_manIsOffScreen = 0;
 		redrawMainScrn();
-		getRidOfTemp();
+		_symbolGraphics.clear();
 		restoreReels();
 		workToScreenM();
 	}
@@ -616,19 +616,19 @@ void DreamWebEngine::dumpSymbol() {
 }
 
 void DreamWebEngine::showSymbol() {
-	showFrame(_tempGraphics, kSymbolx, kSymboly, 12, 0);
+	showFrame(_symbolGraphics, kSymbolx, kSymboly, 12, 0);
 
-	showFrame(_tempGraphics, _symbolTopX + kSymbolx-44, kSymboly+20, _symbolTopNum, 32);
+	showFrame(_symbolGraphics, _symbolTopX + kSymbolx-44, kSymboly+20, _symbolTopNum, 32);
 	uint8 nextTopSymbol = nextSymbol(_symbolTopNum);
-	showFrame(_tempGraphics, _symbolTopX + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
+	showFrame(_symbolGraphics, _symbolTopX + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
 	uint8 nextNextTopSymbol = nextSymbol(nextTopSymbol);
-	showFrame(_tempGraphics, _symbolTopX + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
+	showFrame(_symbolGraphics, _symbolTopX + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
 
-	showFrame(_tempGraphics, _symbolBotX + kSymbolx-44, kSymboly+49, 6 + _symbolBotNum, 32);
+	showFrame(_symbolGraphics, _symbolBotX + kSymbolx-44, kSymboly+49, 6 + _symbolBotNum, 32);
 	uint8 nextBotSymbol = nextSymbol(_symbolBotNum);
-	showFrame(_tempGraphics, _symbolBotX + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
+	showFrame(_symbolGraphics, _symbolBotX + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
 	uint8 nextNextBotSymbol = nextSymbol(nextBotSymbol);
-	showFrame(_tempGraphics, _symbolBotX + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
+	showFrame(_symbolGraphics, _symbolBotX + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
 }
 
 uint8 DreamWebEngine::nextSymbol(uint8 symbol) {
@@ -716,9 +716,9 @@ void DreamWebEngine::updateSymbolBot() {
 
 void DreamWebEngine::useDiary() {
 	getRidOfReels();
-	loadIntoTemp("DREAMWEB.G14");
+	loadGraphicsFile(_diaryGraphics, "DREAMWEB.G14");
 	loadTempText("DREAMWEB.T51");
-	loadTempCharset("DREAMWEB.C02");
+	loadGraphicsFile(_diaryCharset, "DREAMWEB.C02");
 	createPanel();
 	showIcon();
 	showDiary();
@@ -751,9 +751,9 @@ void DreamWebEngine::useDiary() {
 	} while (!_getBack && !_quitRequested);
 
 
-	getRidOfTemp();
+	_diaryGraphics.clear();
 	getRidOfTempText();
-	getRidOfTempCharset();
+	_diaryCharset.clear();
 	restoreReels();
 	_manIsOffScreen = 0;
 	redrawMainScrn();
@@ -761,8 +761,8 @@ void DreamWebEngine::useDiary() {
 }
 
 void DreamWebEngine::showDiary() {
-	showFrame(_tempGraphics, kDiaryx, kDiaryy + 37, 1, 0);
-	showFrame(_tempGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0);
+	showFrame(_diaryGraphics, kDiaryx, kDiaryy + 37, 1, 0);
+	showFrame(_diaryGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0);
 }
 
 void DreamWebEngine::showDiaryKeys() {
@@ -776,10 +776,10 @@ void DreamWebEngine::showDiaryKeys() {
 
 	if (_pressed == 'N') {
 		byte frame = (_pressCount == 1) ? 3 : 4;
-		showFrame(_tempGraphics, kDiaryx + 94, kDiaryy + 97, frame, 0);
+		showFrame(_diaryGraphics, kDiaryx + 94, kDiaryy + 97, frame, 0);
 	} else {
 		byte frame = (_pressCount == 1) ? 5 : 6;
-		showFrame(_tempGraphics, kDiaryx + 151, kDiaryy + 71, frame, 0);
+		showFrame(_diaryGraphics, kDiaryx + 151, kDiaryy + 71, frame, 0);
 	}
 
 	if (_pressCount == 1)
@@ -847,9 +847,9 @@ void DreamWebEngine::diaryKeyN() {
 }
 
 void DreamWebEngine::showDiaryPage() {
-	showFrame(_tempGraphics, kDiaryx, kDiaryy, 0, 0);
+	showFrame(_diaryGraphics, kDiaryx, kDiaryy, 0, 0);
 	_kerning = 1;
-	useTempCharset();
+	useTempCharset(&_diaryCharset);
 	_charShift = 91+91;
 	const uint8 *string = getTextInFile1(_diaryPage);
 	uint16 y = kDiaryy + 16;
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index d2f6b37..f5f064f 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -54,11 +54,11 @@ void DreamWebEngine::useMon() {
 	showIcon();
 	drawFloor();
 	getRidOfAll();
-	loadIntoTemp("DREAMWEB.G03"); // mon. graphic name
+	loadGraphicsFile(_monitorGraphics, "DREAMWEB.G03"); // mon. graphic name
 	loadPersonal();
 	loadNews();
 	loadCart();
-	loadTempCharset("DREAMWEB.C01"); // character set 2
+	loadGraphicsFile(_monitorCharset, "DREAMWEB.C01"); // character set 2
 	printOuterMon();
 	initialMonCols();
 	printLogo();
@@ -89,8 +89,8 @@ void DreamWebEngine::useMon() {
 		if (_quitRequested) //TODO : Check why it crashes when put before the execcommand
 			break;
 	} while (!stop);
-	getRidOfTemp();
-	getRidOfTempCharset();
+	_monitorGraphics.clear();
+	_monitorCharset.clear();
 
 	_textFile1.clear();
 	_textFile2.clear();
@@ -188,14 +188,14 @@ void DreamWebEngine::monitorLogo() {
 }
 
 void DreamWebEngine::printLogo() {
-	showFrame(_tempGraphics, 56, 32, 0, 0);
+	showFrame(_monitorGraphics, 56, 32, 0, 0);
 	showCurrentFile();
 }
 
 void DreamWebEngine::input() {
 	memset(_inputLine, 0, 64);
 	_curPos = 0;
-	printChar(_tempCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
+	printChar(_monitorCharset, _monAdX, _monAdY, '>', 0, NULL, NULL);
 	multiDump(_monAdX, _monAdY, 6, 8);
 	_monAdX += 6;
 	_cursLocX = _monAdX;
@@ -227,7 +227,7 @@ void DreamWebEngine::input() {
 			continue;
 		multiGet(_mapStore + _curPos * 256, _monAdX, _monAdY, 8, 8);
 		uint8 charWidth;
-		printChar(_tempCharset, _monAdX, _monAdY, currentKey, 0, &charWidth, NULL);
+		printChar(_monitorCharset, _monAdX, _monAdY, currentKey, 0, &charWidth, NULL);
 		_inputLine[_curPos * 2 + 1] = charWidth;
 		_monAdX += charWidth;
 		++_curPos;
@@ -266,7 +266,7 @@ void DreamWebEngine::printCurs() {
 	multiGet(_textUnder, x, y, 6, height);
 	++_mainTimer;
 	if ((_mainTimer & 16) == 0)
-		showFrame(_tempCharset, x, y, '/' - 32, 0);
+		showFrame(_monitorCharset, x, y, '/' - 32, 0);
 	multiDump(x - 6, y, 12, height);
 }
 
@@ -302,17 +302,17 @@ void DreamWebEngine::showCurrentFile() {
 	while (*currentFile) {
 		char c = *currentFile++;
 		c = modifyChar(c);
-		printChar(_tempCharset, &x, 37, c, 0, NULL, NULL);
+		printChar(_monitorCharset, &x, 37, c, 0, NULL, NULL);
 	}
 }
 
 void DreamWebEngine::accessLightOn() {
-	showFrame(_tempGraphics, 74, 182, 8, 0);
+	showFrame(_monitorGraphics, 74, 182, 8, 0);
 	multiDump(74, 182, 12, 8);
 }
 
 void DreamWebEngine::accessLightOff() {
-	showFrame(_tempGraphics, 74, 182, 7, 0);
+	showFrame(_monitorGraphics, 74, 182, 7, 0);
 	multiDump(74, 182, 12, 8);
 }
 
@@ -345,22 +345,22 @@ void DreamWebEngine::netError() {
 }
 
 void DreamWebEngine::powerLightOn() {
-	showFrame(_tempGraphics, 257+4, 182, 6, 0);
+	showFrame(_monitorGraphics, 257+4, 182, 6, 0);
 	multiDump(257+4, 182, 12, 8);
 }
 
 void DreamWebEngine::powerLightOff() {
-	showFrame(_tempGraphics, 257+4, 182, 5, 0);
+	showFrame(_monitorGraphics, 257+4, 182, 5, 0);
 	multiDump(257+4, 182, 12, 8);
 }
 
 void DreamWebEngine::lockLightOn() {
-	showFrame(_tempGraphics, 56, 182, 10, 0);
+	showFrame(_monitorGraphics, 56, 182, 10, 0);
 	multiDump(58, 182, 12, 8);
 }
 
 void DreamWebEngine::lockLightOff() {
-	showFrame(_tempGraphics, 56, 182, 9, 0);
+	showFrame(_monitorGraphics, 56, 182, 9, 0);
 	multiDump(58, 182, 12, 8);
 }
 
@@ -375,10 +375,10 @@ void DreamWebEngine::turnOnPower() {
 }
 
 void DreamWebEngine::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(_monitorGraphics, 40, 32, 1, 0);
+	showFrame(_monitorGraphics, 264, 32, 2, 0);
+	showFrame(_monitorGraphics, 40, 12, 3, 0);
+	showFrame(_monitorGraphics, 40, 164, 4, 0);
 }
 
 void DreamWebEngine::loadPersonal() {
diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp
index 8083055..c484855 100644
--- a/engines/dreamweb/newplace.cpp
+++ b/engines/dreamweb/newplace.cpp
@@ -41,7 +41,7 @@ void DreamWebEngine::selectLocation() {
 	_pointerFrame = 22;
 	readCityPic();
 	showCity();
-	getRidOfTemp();
+	_cityGraphics.clear();
 	readDestIcon();
 	loadTravelText();
 	showPanel();
@@ -89,17 +89,17 @@ void DreamWebEngine::selectLocation() {
 		_getBack = 0;
 	}
 
-	getRidOfTemp();
-	getRidOfTemp2();
-	getRidOfTemp3();
+	_newplaceGraphics.clear();
+	_newplaceGraphics2.clear();
+	_newplaceGraphics3.clear();
 
 	_travelText.clear();
 }
 
 void DreamWebEngine::showCity() {
 	clearWork();
-	showFrame(_tempGraphics, 57, 32, 0, 0);
-	showFrame(_tempGraphics, 120+57, 32, 1, 0);
+	showFrame(_cityGraphics, 57, 32, 0, 0);
+	showFrame(_cityGraphics, 120+57, 32, 1, 0);
 }
 
 void DreamWebEngine::lookAtPlace() {
@@ -113,10 +113,10 @@ void DreamWebEngine::lookAtPlace() {
 	delPointer();
 	delTextLine();
 	getUnderCentre();
-	showFrame(_tempGraphics3, 60, 72, 0, 0);
-	showFrame(_tempGraphics3, 60, 72 + 55, 4, 0);
+	showFrame(_newplaceGraphics3, 60, 72, 0, 0);
+	showFrame(_newplaceGraphics3, 60, 72 + 55, 4, 0);
 	if (_foreignRelease)
-		showFrame(_tempGraphics3, 60, 72+55+21, 4, 0);
+		showFrame(_newplaceGraphics3, 60, 72+55+21, 4, 0);
 
 	const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
 	findNextColon(&string);
@@ -143,21 +143,21 @@ void DreamWebEngine::locationPic() {
 	byte picture = roomPics[_destPos];
 
 	if (picture >= 6)
-		showFrame(_tempGraphics2, 104, 138 + 14, picture - 6, 0);	// Second slot
+		showFrame(_newplaceGraphics2, 104, 138 + 14, picture - 6, 0);	// Second slot
 	else
-		showFrame(_tempGraphics,  104, 138 + 14, picture + 4, 0);
+		showFrame(_newplaceGraphics,  104, 138 + 14, picture + 4, 0);
 
 	if (_destPos == _realLocation)
-		showFrame(_tempGraphics, 104, 140 + 14, 3, 0);	// Currently in this location
+		showFrame(_newplaceGraphics, 104, 140 + 14, 3, 0);	// Currently in this location
 
 	const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
 	printDirect(string, 50, 20, 241, 241 & 1);
 }
 
 void DreamWebEngine::showArrows() {
-	showFrame(_tempGraphics, 116 - 12, 16, 0, 0);
-	showFrame(_tempGraphics, 226 + 12, 16, 1, 0);
-	showFrame(_tempGraphics, 280, 14, 2, 0);
+	showFrame(_newplaceGraphics, 116 - 12, 16, 0, 0);
+	showFrame(_newplaceGraphics, 226 + 12, 16, 1, 0);
+	showFrame(_newplaceGraphics, 280, 14, 2, 0);
 }
 
 void DreamWebEngine::nextDest() {
@@ -259,13 +259,13 @@ void DreamWebEngine::resetLocation(uint8 index) {
 }
 
 void DreamWebEngine::readDestIcon() {
-	loadIntoTemp("DREAMWEB.G05");
-	loadIntoTemp2("DREAMWEB.G06");
-	loadIntoTemp3("DREAMWEB.G08");
+	loadGraphicsFile(_newplaceGraphics, "DREAMWEB.G05");
+	loadGraphicsFile(_newplaceGraphics2, "DREAMWEB.G06");
+	loadGraphicsFile(_newplaceGraphics3, "DREAMWEB.G08");
 }
 
 void DreamWebEngine::readCityPic() {
-	loadIntoTemp("DREAMWEB.G04");
+	loadGraphicsFile(_cityGraphics, "DREAMWEB.G04");
 }
 
 } // End of namespace DreamWeb
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 24e0183..a6b93a5 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -210,7 +210,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
 	bool done = false;
 	while (!done) {
 
-		uint16 count = getNumber(_tempCharset, (const uint8 *)iterator, 166, false, &x);
+		uint16 count = getNumber(_monitorCharset, (const uint8 *)iterator, 166, false, &x);
 		do {	
 			char c = *iterator++;
 			if (c == ':')
@@ -226,7 +226,7 @@ const char *DreamWebEngine::monPrint(const char *string) {
 				break;
 			}
 			c = modifyChar(c);
-			printChar(_tempCharset, &x, _monAdY, c, 0, NULL, NULL);
+			printChar(_monitorCharset, &x, _monAdY, c, 0, NULL, NULL);
 			_cursLocX = x;
 			_cursLocY = _monAdY;
 			_mainTimer = 1;
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 4779d0b..acc7657 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -178,7 +178,7 @@ void DreamWebEngine::doLoad(int savegameId) {
 	// If we reach this point, loadPosition() has just been called.
 	// Among other things, it will have filled g_MadeUpRoomDat.
 
-	getRidOfTemp();
+	_saveGraphics.clear();
 
 	startLoading(g_madeUpRoomDat);
 	loadRoomsSample();
@@ -270,7 +270,7 @@ void DreamWebEngine::saveGame() {
 			descbuf[++desclen] = 1;
 
 		// TODO: The below is copied from actualsave
-		getRidOfTemp();
+		_saveGraphics.clear();
 		restoreAll(); // reels
 		_textAddressX = 13;
 		_textAddressY = 182;
@@ -360,7 +360,7 @@ void DreamWebEngine::doSaveLoad() {
 	_textAddressY = 182;
 	_textLen = 240;
 	if (_getBack != 4) {
-		getRidOfTemp();
+		_saveGraphics.clear();
 		restoreAll();
 		redrawMainScrn();
 		workToScreenM();
@@ -388,16 +388,16 @@ void DreamWebEngine::getBackToOps() {
 }
 
 void DreamWebEngine::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(_saveGraphics, kOpsx+10, kOpsy+10, 8, 0);
+	showFrame(_saveGraphics, kOpsx+59, kOpsy+30, 7, 0);
+	showFrame(_saveGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
 }
 
 void DreamWebEngine::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(_saveGraphics, kOpsx+128+4, kOpsy+12, 1, 0);
+	showFrame(_saveGraphics, kOpsx+10, kOpsy+10, 9, 0);
+	showFrame(_saveGraphics, kOpsx+59, kOpsy+30, 10, 0);
+	showFrame(_saveGraphics, kOpsx+176+2, kOpsy+60-4, 5, 0);
 }
 
 void DreamWebEngine::discOps() {
@@ -450,7 +450,7 @@ void DreamWebEngine::actualSave() {
 
 	savePosition(slot, desc);
 
-	getRidOfTemp();
+	_saveGraphics.clear();
 	restoreAll(); // reels
 	_textAddressX = 13;
 	_textAddressY = 182;
@@ -703,12 +703,12 @@ void DreamWebEngine::loadOld() {
 void DreamWebEngine::showDecisions() {
 	createPanel2();
 	showOpBox();
-	showFrame(_tempGraphics, kOpsx + 17, kOpsy + 13, 6, 0);
+	showFrame(_saveGraphics, kOpsx + 17, kOpsy + 13, 6, 0);
 	underTextLine();
 }
 
 void DreamWebEngine::loadSaveBox() {
-	loadIntoTemp("DREAMWEB.G08");
+	loadGraphicsFile(_saveGraphics, "DREAMWEB.G08");
 }
 
 // show savegame names (original interface), and set kCursorpos
@@ -822,37 +822,37 @@ void DreamWebEngine::selectSlot() {
 void DreamWebEngine::showSlots() {
 	showFrame(_icons1, kOpsx + 158, kOpsy - 11, 12, 0);
 	showFrame(_icons1, kOpsx + 158 + 18 * _saveLoadPage, kOpsy - 11, 13 + _saveLoadPage, 0);
-	showFrame(_tempGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
+	showFrame(_saveGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
 
 	uint16 y = kOpsy + 11;
 
 	for (int slot = 0; slot < 7; slot++) {
 		if (slot == _currentSlot)
-			showFrame(_tempGraphics, kOpsx + 10, y, 3, 0);
+			showFrame(_saveGraphics, kOpsx + 10, y, 3, 0);
 
 		y += 10;
 	}
 }
 
 void DreamWebEngine::showOpBox() {
-	showFrame(_tempGraphics, kOpsx, kOpsy, 0, 0);
+	showFrame(_saveGraphics, kOpsx, kOpsy, 0, 0);
 
 	// This call displays half of the ops dialog in the CD version. It's not
 	// in the floppy version, and if it's called, a stray red dot is shown in
 	// the game dialogs.
 	if (isCD())
-		showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0);
+		showFrame(_saveGraphics, kOpsx, kOpsy + 55, 4, 0);
 }
 
 void DreamWebEngine::showLoadOps() {
-	showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
-	showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+	showFrame(_saveGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+	showFrame(_saveGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
 	printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1));
 }
 
 void DreamWebEngine::showSaveOps() {
-	showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
-	showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+	showFrame(_saveGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+	showFrame(_saveGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
 	printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1));
 }
 
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 5f8ea53..4178fb4 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -510,12 +510,27 @@ void DreamWebEngine::dreamwebFinalize() {
 	_icons1.clear();
 	_icons2.clear();
 	_charset1.clear();
-	_tempGraphics.clear();
-	_tempGraphics2.clear();
-	_tempGraphics3.clear();
-	_tempCharset.clear();
 	_mainSprites.clear();
 
+	// clear local graphics, just in case
+	_keypadGraphics.clear();
+	_menuGraphics.clear();
+	_menuGraphics2.clear();
+	_folderGraphics.clear();
+	_folderGraphics2.clear();
+	_folderGraphics3.clear();
+	_folderCharset.clear();
+	_symbolGraphics.clear();
+	_diaryGraphics.clear();
+	_diaryCharset.clear();
+	_monitorGraphics.clear();
+	_monitorCharset.clear();
+	_newplaceGraphics.clear();
+	_newplaceGraphics2.clear();
+	_newplaceGraphics3.clear();
+	_cityGraphics.clear();
+	_saveGraphics.clear();
+
 	_exFrames.clear();
 	_exText.clear();
 
@@ -852,22 +867,6 @@ void DreamWebEngine::loadTextSegment(TextFile &file, Common::File &inFile, unsig
 	inFile.read((uint8 *)file._text, len - headerSize);
 }
 
-void DreamWebEngine::loadIntoTemp(const char *fileName) {
-	loadGraphicsFile(_tempGraphics, fileName);
-}
-
-void DreamWebEngine::loadIntoTemp2(const char *fileName) {
-	loadGraphicsFile(_tempGraphics2, fileName);
-}
-
-void DreamWebEngine::loadIntoTemp3(const char *fileName) {
-	loadGraphicsFile(_tempGraphics3, fileName);
-}
-
-void DreamWebEngine::loadTempCharset(const char *fileName) {
-	loadGraphicsFile(_tempCharset, fileName);
-}
-
 void DreamWebEngine::hangOnCurs(uint16 frameCount) {
 	for (uint16 i = 0; i < frameCount; ++i) {
 		printCurs();
@@ -2065,30 +2064,14 @@ void DreamWebEngine::useCharset1() {
 	_currentCharset = &_charset1;
 }
 
-void DreamWebEngine::useTempCharset() {
-	_currentCharset = &_tempCharset;
-}
-
-void DreamWebEngine::getRidOfTemp() {
-	_tempGraphics.clear();
+void DreamWebEngine::useTempCharset(GraphicsFile *charset) {
+	_currentCharset = charset;
 }
 
 void DreamWebEngine::getRidOfTempText() {
 	_textFile1.clear();
 }
 
-void DreamWebEngine::getRidOfTemp2() {
-	_tempGraphics2.clear();
-}
-
-void DreamWebEngine::getRidOfTemp3() {
-	_tempGraphics3.clear();
-}
-
-void DreamWebEngine::getRidOfTempCharset() {
-	_tempCharset.clear();
-}
-
 void DreamWebEngine::getRidOfAll() {
 	delete[] _backdropBlocks;
 	_backdropBlocks = 0;
@@ -2765,7 +2748,7 @@ void DreamWebEngine::decide() {
 	} while (!_getBack);
 
 	if (_getBack != 4)
-		getRidOfTemp();	// room not loaded
+		_saveGraphics.clear();	// room not loaded
 
 	_textAddressX = 13;
 	_textAddressY = 182;
@@ -2794,12 +2777,13 @@ void DreamWebEngine::showGun() {
 	_roomsSample = 34;
 	loadRoomsSample();
 	_volume = 0;
-	loadIntoTemp("DREAMWEB.G13");
+	GraphicsFile graphics;
+	loadGraphicsFile(graphics, "DREAMWEB.G13");
 	createPanel2();
-	showFrame(_tempGraphics, 100, 4, 0, 0);
-	showFrame(_tempGraphics, 158, 106, 1, 0);
+	showFrame(graphics, 100, 4, 0, 0);
+	showFrame(graphics, 158, 106, 1, 0);
 	workToScreen();
-	getRidOfTemp();
+	graphics.clear();
 	fadeScreenUp();
 	hangOn(160);
 	playChannel0(12, 0);
@@ -3018,7 +3002,7 @@ void DreamWebEngine::lookAtCard() {
 	getRidOfReels();
 	loadKeypad();
 	createPanel2();
-	showFrame(_tempGraphics, 160, 80, 42, 128);
+	showFrame(_keypadGraphics, 160, 80, 42, 128);
 	const uint8 *obText = getObTextStart();
 	findNextColon(&obText);
 	findNextColon(&obText);
@@ -3028,12 +3012,12 @@ void DreamWebEngine::lookAtCard() {
 	workToScreenM();
 	hangOnW(280);
 	createPanel2();
-	showFrame(_tempGraphics, 160, 80, 42, 128);
+	showFrame(_keypadGraphics, 160, 80, 42, 128);
 	printDirect(obText, 36, 130, 241, 241 & 1);
 	workToScreenM();
 	hangOnW(200);
 	_manIsOffScreen = 0;
-	getRidOfTemp();
+	_keypadGraphics.clear();
 	restoreReels();
 	putBackObStuff();
 }
diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp
index 8ca5aa7..f4112f7 100644
--- a/engines/dreamweb/titles.cpp
+++ b/engines/dreamweb/titles.cpp
@@ -40,9 +40,10 @@ void DreamWebEngine::endGame() {
 void DreamWebEngine::monkSpeaking() {
 	_roomsSample = 35;
 	loadRoomsSample();
-	loadIntoTemp("DREAMWEB.G15");
+	GraphicsFile graphics;
+	loadGraphicsFile(graphics, "DREAMWEB.G15");
 	clearWork();
-	showFrame(_tempGraphics, 160, 72, 0, 128);	// show monk
+	showFrame(graphics, 160, 72, 0, 128);	// show monk
 	workToScreen();
 	_volume = 7;
 	_volumeDirection = -1;
@@ -74,7 +75,7 @@ void DreamWebEngine::monkSpeaking() {
 				printResult = printDirect(&string, 36, &y, 239, 239 & 1);
 				workToScreen();
 				clearWork();
-				showFrame(_tempGraphics, 160, 72, 0, 128);	// show monk
+				showFrame(graphics, 160, 72, 0, 128);	// show monk
 				hangOnP(240);
 				if (_quitRequested)
 					return;
@@ -86,7 +87,7 @@ void DreamWebEngine::monkSpeaking() {
 	_volumeTo = 7;
 	fadeScreenDowns();
 	hangOn(300);
-	getRidOfTemp();
+	graphics.clear();
 }
 
 void DreamWebEngine::gettingShot() {
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index fc0398c..e598435 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1501,7 +1501,7 @@ void DreamWebEngine::useCashCard() {
 	showExit();
 	showMan();
 	uint16 y = (!_foreignRelease) ? 120 : 120 - 3;
-	showFrame(_tempGraphics, 114, y, 39, 0);
+	showFrame(_keypadGraphics, 114, y, 39, 0);
 	const uint8 *obText = getObTextStart();
 	findNextColon(&obText);
 	findNextColon(&obText);
@@ -1517,7 +1517,7 @@ void DreamWebEngine::useCashCard() {
 	_charShift = 0;
 	workToScreenM();
 	hangOnP(400);
-	getRidOfTemp();
+	_keypadGraphics.clear();
 	restoreReels();
 	putBackObStuff();
 }


Commit: 6e70f7728915b766d647668a156b09f84a3c40cf
    https://github.com/scummvm/scummvm/commit/6e70f7728915b766d647668a156b09f84a3c40cf
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2012-02-23T13:37:21-08:00

Commit Message:
DREAMWEB: Dynamically allocate GraphicsFile::_frames.

This avoids extra memory usage due to the previous commit.

Changed paths:
    engines/dreamweb/dreamweb.h
    engines/dreamweb/structs.h
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index c67dfb3..f49c383 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -76,6 +76,7 @@ const unsigned int kSymbolx = 64;
 const unsigned int kSymboly = 56;
 const unsigned int kLengthofvars = 68;
 const unsigned int kFrameBlocksize = 2080;
+const unsigned int kGraphicsFileFrameSize = 347; // ceil(2080 / sizeof(Frame))
 const unsigned int kNumexobjects = 114;
 const unsigned int kNumExTexts = kNumexobjects + 2;
 const uint16 kExtextlen = 18000;
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index cedf2b6..24b67e3 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -339,9 +339,9 @@ struct TextFile {
 };
 
 struct GraphicsFile {
-	GraphicsFile() : _data(0) { }
+	GraphicsFile() : _data(0), _frames(0) { }
 
-	Frame _frames[347];
+	Frame *_frames;
 	uint8 *_data;
 
 	const uint8 *getFrameData(unsigned int i) const {
@@ -351,6 +351,8 @@ struct GraphicsFile {
 		return _data + _frames[i].ptr();
 	}
 	void clear() {
+		delete[] _frames;
+		_frames = 0;
 		delete[] _data;
 		_data = 0;
 	}
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 4178fb4..763bcb8 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -843,17 +843,18 @@ void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *fileName)
 	uint16 sizeInBytes = header.len(0);
 
 	assert(sizeInBytes >= kFrameBlocksize);
-	delete[] file._data;
+	file.clear();
 	file._data = new uint8[sizeInBytes - kFrameBlocksize];
-
+	file._frames = new Frame[kGraphicsFileFrameSize];
 	f.read((uint8 *)file._frames, kFrameBlocksize);
 	f.read(file._data, sizeInBytes - kFrameBlocksize);
 }
 
 void DreamWebEngine::loadGraphicsSegment(GraphicsFile &file, Common::File &inFile, unsigned int len) {
 	assert(len >= kFrameBlocksize);
-	delete[] file._data;
+	file.clear();
 	file._data = new uint8[len - kFrameBlocksize];
+	file._frames = new Frame[kGraphicsFileFrameSize];
 	inFile.read((uint8 *)file._frames, kFrameBlocksize);
 	inFile.read(file._data, len - kFrameBlocksize);
 }
@@ -2257,6 +2258,7 @@ void DreamWebEngine::drawFloor() {
 void DreamWebEngine::allocateBuffers() {
 	_exFrames.clear();
 	_exFrames._data = new uint8[kExframeslen];
+	_exFrames._frames = new Frame[kGraphicsFileFrameSize];
 	_exText.clear();
 	_exText._text = new char[kExtextlen];
 }






More information about the Scummvm-git-logs mailing list