diff options
| -rw-r--r-- | engines/sci/engine/game.cpp | 4 | ||||
| -rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 13 | ||||
| -rw-r--r-- | engines/sci/gfx/gfx_resmgr.h | 10 | 
3 files changed, 17 insertions, 10 deletions
| diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 304752235b..03a8cc5b51 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -112,12 +112,13 @@ int _reset_graphics_input(EngineState *s) {  			gfxop_set_system_color(s->gfx_state, i, &(s->ega_colors[i]));  		}  	} else { +		_sci1_alloc_system_colors(s); +  		// Check for Amiga palette file.  		Common::File file;  		if (file.open("spal")) {  			s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal1_amiga(file));  			file.close(); -			_sci1_alloc_system_colors(s);  		} else {  			resource = s->resmgr->findResource(kResourceTypePalette, 999, 1);  			if (resource) { @@ -125,7 +126,6 @@ int _reset_graphics_input(EngineState *s) {  					s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal1(999, resource->data, resource->size));  				else  					s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal11(999, resource->data, resource->size)); -				_sci1_alloc_system_colors(s);  				s->resmgr->unlockResource(resource, 999, kResourceTypePalette);  			} else {  				sciprintf("Couldn't find the default palette!\n"); diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index b474a1e36c..19988be9f0 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -242,6 +242,19 @@ void GfxResManager::freeTaggedResources() {  	_tagLockCounter = 0;  } + +void GfxResManager::setStaticPalette(Palette *newPalette) +{ +	if (_staticPalette) +		_staticPalette->free(); + +	_staticPalette = newPalette; +	_staticPalette->name = "static palette"; + +	_staticPalette->mergeInto(_driver->mode->palette); +} + +  #define XLATE_AS_APPROPRIATE(key, entry) \  	if (maps & key) { \  		if (res->unscaled_data.pic&& (force || !res->unscaled_data.pic->entry->data)) { \ diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h index 8f5d02038a..6bfdfa2e23 100644 --- a/engines/sci/gfx/gfx_resmgr.h +++ b/engines/sci/gfx/gfx_resmgr.h @@ -224,14 +224,8 @@ public:  	const PaletteEntry &getColor(int color) { return _staticPalette->getColor(color); } -	void setStaticPalette(Palette *newPalette) { -		if (_staticPalette) -			_staticPalette->free(); - -		_staticPalette = newPalette; -		_staticPalette->name = "static palette"; -	} - +	// Set static palette and merge it into the global palette +	void setStaticPalette(Palette *newPalette);  	int getColorCount() { return _staticPalette ? _staticPalette->size() : 0; }  private: | 
