diff options
| author | Torbjörn Andersson | 2003-12-10 08:01:58 +0000 | 
|---|---|---|
| committer | Torbjörn Andersson | 2003-12-10 08:01:58 +0000 | 
| commit | a2221c88e9f993cad4493ad8cd521ede581c266d (patch) | |
| tree | cba4f35182f1c9684460a770f3b72d77716523b5 | |
| parent | f89739b8f3243b5bdadb1ecaf3dabb8b6091cc30 (diff) | |
| download | scummvm-rg350-a2221c88e9f993cad4493ad8cd521ede581c266d.tar.gz scummvm-rg350-a2221c88e9f993cad4493ad8cd521ede581c266d.tar.bz2 scummvm-rg350-a2221c88e9f993cad4493ad8cd521ede581c266d.zip | |
Sprite surfaces (as opposed to standard sprites) are always display
aligned, never flipped and never RLE16-compressed. Simplified the code
accordingly. (Displaying the restore dialog when specifying an unused save
slot from the command-line works again now.)
Plus some minor cleanups.
svn-id: r11550
| -rw-r--r-- | sword2/driver/d_draw.cpp | 2 | ||||
| -rw-r--r-- | sword2/driver/driver96.h | 5 | ||||
| -rw-r--r-- | sword2/driver/sprite.cpp | 51 | ||||
| -rw-r--r-- | sword2/mouse.cpp | 1 | 
4 files changed, 15 insertions, 44 deletions
| diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index ca1ed7b9ab..dab3f9ce5b 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -145,7 +145,7 @@ int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOu  		msgSprite.y = RDMENU_MENUDEEP / 2 - frame->height / 2;  		msgSprite.w = frame->width;  		msgSprite.h = frame->height; -		msgSprite.type = RDSPR_DISPLAYALIGN | RDSPR_NOCOMPRESSION | RDSPR_TRANS; +		msgSprite.type = RDSPR_NOCOMPRESSION;  		msgSprite.data = data->ad + sizeof(_frameHeader);  		_vm->_graphics->createSurface(&msgSprite, &msgSurface); diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index d08180f979..48c0ca9c26 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -97,9 +97,8 @@ enum {  	RDSPR_NOCOMPRESSION		= 0x0040,  	RDSPR_EDGEBLEND			= 0x0080,	// Unused -	// This is the high byte part of the sprite type which defines what -	// type of compression is used, as long as RDSPR_NOCOMPRESSION is not -	//  defined. +	// This defines what type of compression is used, as long as +	// RDSPR_NOCOMPRESSION is not defined.  	RDSPR_RLE16			= 0x0000,  	RDSPR_RLE256			= 0x0100, diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp index 8a64fe4a68..737fcdbb08 100644 --- a/sword2/driver/sprite.cpp +++ b/sword2/driver/sprite.cpp @@ -243,37 +243,18 @@ int32 Graphics::decompressRLE16(uint8 *dest, uint8 *source, int32 decompSize, ui   */  int32 Graphics::createSurface(_spriteInfo *s, uint8 **sprite) { -	uint8 *newSprite; -  	*sprite = (uint8 *) malloc(s->w * s->h);  	if (!*sprite)  		return RDERR_OUTOFMEMORY; +	// Surfaces are either uncompressed or RLE256-compressed. No need to +	// test for anything else. +  	if (s->type & RDSPR_NOCOMPRESSION) {  		memcpy(*sprite, s->data, s->w * s->h); -	} else { -		if ((s->type >> 8) == (RDSPR_RLE16 >> 8)) { -			if (decompressRLE16(*sprite, s->data, s->w * s->h, s->colourTable)) { -				free(*sprite); -				return RDERR_DECOMPRESSION; -			} -		} else { -			if (decompressRLE256(*sprite, s->data, s->w * s->h)) { -				free(*sprite); -				return RDERR_DECOMPRESSION; -			} -		} - -		if (s->type & RDSPR_FLIP) { -			newSprite = (uint8 *) malloc(s->w * s->h); -			if (!newSprite) { -				free(*sprite); -				return RDERR_OUTOFMEMORY; -			} -			mirrorSprite(newSprite, *sprite, s->w, s->h); -			free(*sprite); -			*sprite = newSprite; -		} +	} else if (decompressRLE256(*sprite, s->data, s->w * s->h)) { +		free(*sprite); +		return RDERR_DECOMPRESSION;  	}  	return RD_OK; @@ -288,7 +269,7 @@ int32 Graphics::createSurface(_spriteInfo *s, uint8 **sprite) {  void Graphics::drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRect) {  	Common::Rect rd, rs; -	uint16 x, y, srcPitch; +	uint16 x, y;  	uint8 *src, *dst;  	rs.left = 0; @@ -296,17 +277,9 @@ void Graphics::drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRec  	rs.top = 0;  	rs.bottom = s->h; -	srcPitch = s->w; - -	if (s->type & RDSPR_DISPLAYALIGN) { -		rd.top = s->y; -		rd.left = s->x; -	} else { -		rd.top = s->y - _scrollY; -		rd.left = s->x - _scrollX; -	} - +	rd.left = s->x;  	rd.right = rd.left + rs.right; +	rd.top = s->y;  	rd.bottom = rd.top + rs.bottom;  	if (clipRect) { @@ -332,7 +305,7 @@ void Graphics::drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRec  			return;  	} -	src = surface + rs.top * srcPitch + rs.left; +	src = surface + rs.top * s->w + rs.left;  	dst = _buffer + _screenWide * rd.top + rd.left;  	// Surfaces are always transparent. @@ -342,7 +315,7 @@ void Graphics::drawSurface(_spriteInfo *s, uint8 *surface, Common::Rect *clipRec  			if (src[x])  				dst[x] = src[x];  		} -		src += srcPitch; +		src += s->w;  		dst += _screenWide;  	} @@ -401,7 +374,7 @@ int32 Graphics::drawSprite(_spriteInfo *s) {  		freeSprite = true;  		if (!sprite)  			return RDERR_OUTOFMEMORY; -		if ((s->type >> 8) == (RDSPR_RLE16 >> 8)) { +		if ((s->type & 0xff00) == RDSPR_RLE16) {  			if (decompressRLE16(sprite, s->data, s->w * s->h, s->colourTable)) {  				free(sprite);  				return RDERR_DECOMPRESSION; diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp index 852ba364c7..2775a0a8b8 100644 --- a/sword2/mouse.cpp +++ b/sword2/mouse.cpp @@ -192,7 +192,6 @@ void Sword2Engine::systemMenuMouse(void) {  	_graphics->clearScene();  	_graphics->processMenu(); -	_graphics->resetRenderEngine();  	// call the relevent screen | 
