From d0c2493be50c3c28c57be5317061af413c699062 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Nov 2013 17:09:35 -0500 Subject: TSAGE: Further fixes for object centroid handling --- engines/tsage/core.cpp | 26 ++++++++++---------------- engines/tsage/core.h | 4 ++-- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index a281354f0d..320d3ddd2c 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2707,8 +2707,16 @@ 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); + // Reset any centroid adjustment flags, in + frame._flags &= ~(FRAME_FLIP_CENTROID_X | FRAME_FLIP_CENTROID_Y); + + // For later games, check whether the appropriate object flags are set for flipping + if (g_vm->getGameID() != GType_Ringworld) { + if ((_flags & OBJFLAG_FLIP_CENTROID_X) || _visageImages._flipHoriz) + frame._flags |= FRAME_FLIP_CENTROID_X; + if ((_flags & OBJFLAG_FLIP_CENTROID_Y) || _visageImages._flipVert) + frame._flags |= FRAME_FLIP_CENTROID_Y; + } // If shading is needed, post apply the shadiing onto the frame if ((g_vm->getGameID() == GType_Ringworld2) && (_shade >= 1)) { @@ -3300,20 +3308,6 @@ 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 62f4cf2c7e..f86172f6a1 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -490,7 +490,6 @@ public: void setVisage(int resNum, int rlbNum = 9999); GfxSurface getFrame(int frameNum); - byte &getFrameFlags(int frameNum); int getFrameCount() const; Visage &operator=(const Visage &gfxSurface); }; @@ -516,7 +515,8 @@ public: enum ObjectFlags {OBJFLAG_FIXED_PRIORITY = 1, OBJFLAG_NO_UPDATES = 2, OBJFLAG_ZOOMED = 4, OBJFLAG_SUPPRESS_DISPATCH = 8, OBJFLAG_HIDE = 0x100, OBJFLAG_HIDING = 0x200, OBJFLAG_REMOVE = 0x400, OBJFLAG_CLONED = 0x800, OBJFLAG_CHECK_REGION = 0x1000, OBJFLAG_PANE_0 = 0x4000, OBJFLAG_PANE_1 = 0x8000, - OBJFLAG_PANES = OBJFLAG_PANE_0 | OBJFLAG_PANE_1 + OBJFLAG_PANES = OBJFLAG_PANE_0 | OBJFLAG_PANE_1, + OBJFLAG_FLIP_CENTROID_X = 0x10000, OBJFLAG_FLIP_CENTROID_Y = 0x20000 }; class SceneObject : public SceneHotspot { -- cgit v1.2.3