[Scummvm-cvs-logs] SF.net SVN: scummvm:[54102] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Sat Nov 6 14:21:18 CET 2010


Revision: 54102
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54102&view=rev
Author:   strangerke
Date:     2010-11-06 13:21:18 +0000 (Sat, 06 Nov 2010)

Log Message:
-----------
HUGO: Move _palette to display.cpp

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/display.cpp
    scummvm/trunk/engines/hugo/display.h
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/hugo.h

Modified: scummvm/trunk/engines/hugo/display.cpp
===================================================================
--- scummvm/trunk/engines/hugo/display.cpp	2010-11-06 10:11:46 UTC (rev 54101)
+++ scummvm/trunk/engines/hugo/display.cpp	2010-11-06 13:21:18 UTC (rev 54102)
@@ -48,7 +48,7 @@
 #define INY(Y, B) (Y >= B->y && Y <= B->y + B->dy)
 #define OVERLAP(A, B) ((INX(A->x, B) || INX(A->x + A->dx, B) || INX(B->x, A) || INX(B->x + B->dx, A)) && (INY(A->y, B) || INY(A->y + A->dy, B) || INY(B->y, A) || INY(B->y + B->dy, A)))
 
-Screen::Screen(HugoEngine *vm) : _vm(vm) {
+Screen::Screen(HugoEngine *vm) : _vm(vm), _palette(0) {
 
 }
 
@@ -58,7 +58,7 @@
 void Screen::createPal() {
 	debugC(1, kDebugDisplay, "createPal");
 
-	g_system->setPalette(_vm->_palette, 0, NUM_COLORS);
+	g_system->setPalette(_palette, 0, NUM_COLORS);
 }
 
 /**
@@ -112,10 +112,10 @@
 
 	byte pal[4];
 
-	pal[0] = _vm->_palette[newIndex * 4 + 0];
-	pal[1] = _vm->_palette[newIndex * 4 + 1];
-	pal[2] = _vm->_palette[newIndex * 4 + 2];
-	pal[3] = _vm->_palette[newIndex * 4 + 3];
+	pal[0] = _palette[newIndex * 4 + 0];
+	pal[1] = _palette[newIndex * 4 + 1];
+	pal[2] = _palette[newIndex * 4 + 2];
+	pal[3] = _palette[newIndex * 4 + 3];
 
 	g_system->setPalette(pal, oldIndex, 1);
 }
@@ -488,5 +488,24 @@
 	// Stop premature object display in Display_list(D_DISPLAY)
 	_vm->getGameStatus().newScreenFl = true;
 }
+
+/**
+* Load palette from Hugo.dat
+*/
+void Screen::loadPalette(Common::File &in) {
+	// Read palette
+	_paletteSize = in.readUint16BE();
+	_palette = (byte *)malloc(sizeof(byte) * _paletteSize);
+	for (int i = 0; i < _paletteSize; i++)
+		_palette[i] = in.readByte();
+}
+
+/**
+* Free palette
+*/
+void Screen::freePalette() {
+	free(_palette);
+}
+
 } // End of namespace Hugo
 

Modified: scummvm/trunk/engines/hugo/display.h
===================================================================
--- scummvm/trunk/engines/hugo/display.h	2010-11-06 10:11:46 UTC (rev 54101)
+++ scummvm/trunk/engines/hugo/display.h	2010-11-06 13:21:18 UTC (rev 54102)
@@ -61,8 +61,10 @@
 	void     drawRectangle(bool filledFl, uint16 x1, uint16 y1, uint16 x2, uint16 y2, int color);
 	void     drawShape(int x, int y, int color1, int color2);
 	void     drawStatusText();
+	void     freePalette();
 	void     initDisplay();
 	void     initNewScreenDisplay();
+	void     loadPalette(Common::File &in);
 	void     moveImage(image_pt srcImage, uint16 x1, uint16 y1, uint16 dx, uint16 dy, uint16 width1, image_pt dstImage, uint16 x2, uint16 y2, uint16 width2);
 	void     remapPal(uint16 oldIndex, uint16 newIndex);
 	void     restorePal(Common::SeekableReadStream *f);
@@ -97,10 +99,13 @@
 	HugoEngine *_vm;
 
 	// Fonts used in dib (non-GDI)
-	byte _fnt;                                      // Current font number
-	byte _fontdata[NUM_FONTS][FONTSIZE];            // Font data
+	byte  _fnt;                                     // Current font number
+	byte  _fontdata[NUM_FONTS][FONTSIZE];           // Font data
 	byte *_font[NUM_FONTS][FONT_LEN];               // Ptrs to each char
+	byte *_palette;
 
+	byte  _paletteSize;
+
 private:
 	viewdib_t _frontBuffer;
 	viewdib_t _backBuffer;

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2010-11-06 10:11:46 UTC (rev 54101)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2010-11-06 13:21:18 UTC (rev 54102)
@@ -64,7 +64,7 @@
 HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(syst), _gameDescription(gd), _mouseX(0), _mouseY(0),
 	_textData(0), _stringtData(0), _screenNames(0), _textEngine(0), _textIntro(0), _textMouse(0), _textParser(0), _textSchedule(0),
 	_textUtil(0), _arrayNouns(0), _arrayVerbs(0), _arrayReqs(0), _hotspots(0), _invent(0), _uses(0), _catchallList(0),
-	_backgroundObjects(0), _points(0), _cmdList(0), _screenActs(0), _heroImage(0), _defltTunes(0), _palette(0), _introX(0),
+	_backgroundObjects(0), _points(0), _cmdList(0), _screenActs(0), _heroImage(0), _defltTunes(0), _introX(0),
 	_introY(0), _maxInvent(0), _numBonuses(0), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0), _screenStates(0),
 	_numObj(0), _score(0), _maxscore(0), _backgroundObjectsSize(0), _screenActsSize(0), _usesSize(0)
 
@@ -96,7 +96,7 @@
 	free(_arrayVerbs);
 
 	free(_screenNames);
-	free(_palette);
+	_screen->freePalette();
 	free(_textEngine);
 	free(_textIntro);
 	free(_introX);
@@ -410,11 +410,7 @@
 	// Read screenNames
 	_screenNames = loadTextsVariante(in, &_numScreens);
 
-	// Read palette
-	_paletteSize = in.readUint16BE();
-	_palette = (byte *)malloc(sizeof(byte) * _paletteSize);
-	for (int i = 0; i < _paletteSize; i++)
-		_palette[i] = in.readByte();
+	_screen->loadPalette(in);
 
 	// Read textEngine
 	_textEngine = loadTexts(in);

Modified: scummvm/trunk/engines/hugo/hugo.h
===================================================================
--- scummvm/trunk/engines/hugo/hugo.h	2010-11-06 10:11:46 UTC (rev 54101)
+++ scummvm/trunk/engines/hugo/hugo.h	2010-11-06 13:21:18 UTC (rev 54102)
@@ -123,7 +123,6 @@
 	byte  *_screen_p;
 	byte  _heroImage;
 
-	byte  *_palette;
 	byte  *_introX;
 	byte  *_introY;
 	byte  *_screenStates;
@@ -262,7 +261,6 @@
 private:
 	int _mouseX;
 	int _mouseY;
-	byte _paletteSize;
 	byte _introXSize;
 	status_t _status;                               // Game status structure
 
@@ -275,17 +273,17 @@
 // Vinterstum: These shouldn't be static, but we get weird pathfinding issues (and Valgrind warnings) without.
 // Needs more investigation. Alignment issues?
 
-	static overlay_t _boundary;                             // Boundary overlay file
-	static overlay_t _overlay;                              // First overlay file
-	static overlay_t _ovlBase;                              // First overlay base file
-	static overlay_t _objBound;                             // Boundary file marks object baselines
+	static overlay_t _boundary;                     // Boundary overlay file
+	static overlay_t _overlay;                      // First overlay file
+	static overlay_t _ovlBase;                      // First overlay base file
+	static overlay_t _objBound;                     // Boundary file marks object baselines
 
 	GameType _gameType;
 	Common::Platform _platform;
 	bool _packedFl;
 
-	int _score;                         // Holds current score
-	int _maxscore;                      // Holds maximum score
+	int _score;                                     // Holds current score
+	int _maxscore;                                  // Holds maximum score
 
 	char **loadTextsVariante(Common::File &in, uint16 *arraySize);
 	char ***loadTextsArray(Common::File &in);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list