diff options
| -rw-r--r-- | engines/tsage/core.cpp | 18 | ||||
| -rw-r--r-- | engines/tsage/core.h | 1 | ||||
| -rw-r--r-- | engines/tsage/graphics.cpp | 25 | ||||
| -rw-r--r-- | engines/tsage/graphics.h | 3 | 
4 files changed, 36 insertions, 11 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 040dbc8c25..a281354f0d 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2707,6 +2707,9 @@ GfxSurface SceneObject::getFrame() {  	_visageImages.setVisage(_visage, _strip);  	GfxSurface frame = _visageImages.getFrame(_frame); +	// Reset any centroid adjustment flags +	_visageImages.getFrameFlags(_frame) &= ~(FRAME_FLIP_CENTROID_X | FRAME_FLIP_CENTROID_Y); +  	// If shading is needed, post apply the shadiing onto the frame  	if ((g_vm->getGameID() == GType_Ringworld2) && (_shade >= 1)) {  		Graphics::Surface s = frame.lockSurface(); @@ -2727,6 +2730,7 @@ GfxSurface SceneObject::getFrame() {  void SceneObject::reposition() {  	GfxSurface frame = getFrame(); +  	_bounds.resize(frame, _position.x, _position.y - _yDiff, _percent);  	_xs = _bounds.left;  	_xe = _bounds.right; @@ -3296,6 +3300,20 @@ GfxSurface Visage::getFrame(int frameNum) {  	return result;  } +byte &Visage::getFrameFlags(int frameNum) { +	int numFrames = READ_LE_UINT16(_data); +	if (frameNum > numFrames) +		frameNum = numFrames; +	if (frameNum > 0) +		--frameNum; + +	int offset = READ_LE_UINT32(_data + 2 + frameNum * 4); +	byte *frameData = _data + offset; + +	return *(frameData + 9); +} + +  int Visage::getFrameCount() const {  	return READ_LE_UINT16(_data);  } diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 05f6f4b3a0..62f4cf2c7e 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -490,6 +490,7 @@ public:  	void setVisage(int resNum, int rlbNum = 9999);  	GfxSurface getFrame(int frameNum); +	byte &getFrameFlags(int frameNum);  	int getFrameCount() const;  	Visage &operator=(const Visage &gfxSurface);  }; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 446c56662a..33ddb8bcec 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -71,19 +71,14 @@ GfxSurface surfaceFromRes(const byte *imgData) {  	s._transColor = *(imgData + 8);  	byte flags = imgData[9]; +	s._flags = (g_vm->getGameID() != GType_Ringworld) ? flags : 0; +  	bool rleEncoded = (flags & 2) != 0;  	// Figure out the centroid  	s._centroid.x = READ_LE_UINT16(imgData + 4);  	s._centroid.y = READ_LE_UINT16(imgData + 6); -	if (g_vm->getGameID() != GType_Ringworld) { -		if (flags & 4) -			s._centroid.x = r.width() - (s._centroid.x + 1); -		if (flags & 8) -			s._centroid.y = r.height() - (s._centroid.y + 1); -	} -  	const byte *srcP = imgData + 10;  	Graphics::Surface destSurface = s.lockSurface();  	byte *destP = (byte *)destSurface.getPixels(); @@ -194,8 +189,9 @@ void Rect::contain(const Rect &r) {   * @percent Scaling percentage   */  void Rect::resize(const GfxSurface &surface, int xp, int yp, int percent) { -	int xe = surface.getBounds().width() * percent / 100; -	int ye = surface.getBounds().height() * percent / 100; +	const Rect &bounds = surface.getBounds(); +	int xe = bounds.width() * percent / 100; +	int ye = bounds.height() * percent / 100;  	this->set(0, 0, xe, ye);  	if (!right) ++right; @@ -203,8 +199,13 @@ void Rect::resize(const GfxSurface &surface, int xp, int yp, int percent) {  	this->moveTo(xp, yp); -	int xd = surface._centroid.x * percent / 100; -	int yd = surface._centroid.y * percent / 100; +	int xa = (surface._flags & FRAME_FLIP_CENTROID_X) == 0 ? surface._centroid.x :  +		bounds.width() - (surface._centroid.x + 1); +	int ya = (surface._flags & FRAME_FLIP_CENTROID_Y) == 0 ? surface._centroid.y :  +		bounds.height() - (surface._centroid.y + 1); + +	int xd = xa * percent / 100; +	int yd = ya * percent / 100;  	this->translate(-xd, -yd);  } @@ -234,6 +235,7 @@ GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) {  	_customSurface = NULL;  	_transColor = -1;  	_trackDirtyRects = false; +	_flags = 0;  }  GfxSurface::GfxSurface(const GfxSurface &s) { @@ -417,6 +419,7 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) {  	_bounds = s._bounds;  	_centroid = s._centroid;  	_transColor = s._transColor; +	_flags = s._flags;  	if (_customSurface) {  		// Surface owns the internal data, so replicate it so new surface owns it's own diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 858731a1ac..47961dd02a 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -71,6 +71,8 @@ public:  	LineSlice(int xStart, int xEnd) { xs = xStart; xe = xEnd; }  }; +enum FrameFlag { FRAME_FLIP_CENTROID_X = 4, FRAME_FLIP_CENTROID_Y = 8 }; +  class GfxSurface {  private:  	Graphics::Surface *_customSurface; @@ -89,6 +91,7 @@ public:  	Common::Point _centroid;  	int _transColor;  	Rect _clipRect; +	byte _flags;  public:  	GfxSurface();  	GfxSurface(const GfxSurface &s);  | 
