From f3db412d6f3dd90893eb90a084491b90acdddc9e Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 25 Feb 2017 18:13:55 -0600 Subject: SCI32: Serialize Robots in SCI3 This is necessary for at least Lighthouse, which maintains the state of Robots across save games. --- engines/sci/video/robot_decoder.h | 46 ++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'engines/sci/video/robot_decoder.h') diff --git a/engines/sci/video/robot_decoder.h b/engines/sci/video/robot_decoder.h index 9d8c720968..aa1d9da75c 100644 --- a/engines/sci/video/robot_decoder.h +++ b/engines/sci/video/robot_decoder.h @@ -469,23 +469,25 @@ public: #pragma mark RobotDecoder /** - * RobotDecoder implements the logic required - * for Robot animations. - * - * @note A paused or finished RobotDecoder was - * classified as serializable in SCI3, but the - * save/load code would attempt to use uninitialised - * values, so it seems that robots were not ever - * actually able to be saved. + * RobotDecoder implements the logic required for Robot animations. */ class RobotDecoder { public: RobotDecoder(SegManager *segMan); ~RobotDecoder(); + GuiResourceId getResourceId() const { + return _robotId; + } + private: SegManager *_segMan; + /** + * The ID of the currently loaded robot. + */ + GuiResourceId _robotId; + #pragma mark Constants public: /** @@ -1174,6 +1176,27 @@ private: #pragma mark - #pragma mark Rendering public: + /** + * Gets the plane used to render the robot. + */ + const reg_t getPlaneId() const { + return _planeId; + } + + /** + * Gets the origin of the robot. + */ + Common::Point getPosition() const { + return _position; + } + + /** + * Gets the scale of the robot. + */ + int16 getScale() const { + return _scaleInfo.x; + } + /** * Puts the current dimensions of the robot, in game script * coordinates, into the given rect, and returns the total @@ -1207,6 +1230,8 @@ public: */ void expandCel(byte *target, const byte* source, const int16 celWidth, const int16 celHeight) const; + int16 getPriority() const; + /** * Sets the visual priority of the robot. * @see Plane::_priority @@ -1291,6 +1316,11 @@ private: */ DecompressorLZS _decompressor; + /** + * The ID of the robot plane. + */ + reg_t _planeId; + /** * The origin of the robot animation, in screen * coordinates. -- cgit v1.2.3