From 5cffa3891f48d64154f00571c8127ef2c601d6d5 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 5 Oct 2017 20:53:27 -0500 Subject: SCI32: Clean up GfxPalette32 * Replace raw pointers with smart pointers * Use references instead of const pointers where appropriate * Tweak initialisation * Tweak palette copies to the stack --- engines/sci/graphics/palette32.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'engines/sci/graphics/palette32.h') diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h index b8ba85eb4a..2d00b86501 100644 --- a/engines/sci/graphics/palette32.h +++ b/engines/sci/graphics/palette32.h @@ -23,6 +23,8 @@ #ifndef SCI_GRAPHICS_PALETTE32_H #define SCI_GRAPHICS_PALETTE32_H +#include "common/ptr.h" + namespace Sci { #pragma mark HunkPalette @@ -233,7 +235,6 @@ struct PalCycler { class GfxPalette32 { public: GfxPalette32(ResourceManager *resMan); - ~GfxPalette32(); void saveLoadWithSerializer(Common::Serializer &s); @@ -440,13 +441,13 @@ private: * operation. If this palette is not specified, `_sourcePalette` is used * instead. */ - Palette *_varyStartPalette; + Common::ScopedPtr _varyStartPalette; /** * An optional palette used to provide target colors for a palette vary * operation. */ - Palette *_varyTargetPalette; + Common::ScopedPtr _varyTargetPalette; /** * The minimum palette index that has been varied from the source palette. @@ -553,7 +554,8 @@ private: kNumCyclers = 10 }; - PalCycler *_cyclers[kNumCyclers]; + typedef Common::ScopedPtr PalCyclerOwner; + PalCyclerOwner _cyclers[kNumCyclers]; /** * Updates the `currentCycle` of the given `cycler` by `speed` entries. @@ -564,8 +566,8 @@ private: * The cycle map is used to detect overlapping cyclers, and to avoid * remapping to palette entries that are being cycled. * - * According to SCI engine code, when two cyclers overlap, a fatal error has - * occurred and the engine will display an error and then exit. + * According to SSCI, when two cyclers overlap, a fatal error has occurred + * and the engine will display an error and then exit. * * The color remapping system avoids attempts to remap to palette entries * that are cycling because they won't be the expected color once the cycler -- cgit v1.2.3