| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file paletteeffects.h |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd August 2005: Created OpenJazz.h |
| 10 | * - 4th February 2009: Created palette.h from parts of OpenJazz.h |
| 11 | * - 1st August 2009: Renamed palette.h to paletteeffects.h |
| 12 | * |
| 13 | * @par Licence: |
| 14 | * Copyright (c) 2005-2010 AJ Thomson |
| 15 | * |
| 16 | * OpenJazz is distributed under the terms of |
| 17 | * the GNU General Public License, version 2.0 |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | |
| 22 | #ifndef _PALETTE_H |
| 23 | #define _PALETTE_Hcxx . . $ `src/io/gfx/paletteeffects.h:23:9`! |
| 24 | |
| 25 | #include "OpenJazz.h"cxx . . $ `<file>/src/OpenJazz.h`/ |
| 26 | |
| 27 | // Constants |
| 28 | |
| 29 | // Types of palette effect |
| 30 | #define PE_FADEcxx . . $ `src/io/gfx/paletteeffects.h:30:9`! 0 /* Fades to black, then remains black */ |
| 31 | #define PE_ROTATEcxx . . $ `src/io/gfx/paletteeffects.h:31:9`! 1 /* Cyclical colour animation */ |
| 32 | |
| 33 | // Level background palette effects |
| 34 | #define PE_SKYcxx . . $ `src/io/gfx/paletteeffects.h:34:9`! 2 /* Transfers the appropriate section of the background |
| 35 | palette to the main palette */ |
| 36 | #define PE_2Dcxx . . $ `src/io/gfx/paletteeffects.h:36:9`! 8 /* Real parallaxing background */ |
| 37 | #define PE_1Dcxx . . $ `src/io/gfx/paletteeffects.h:37:9`! 9 /* Diagonal lines parallaxing background */ |
| 38 | #define PE_WATERcxx . . $ `src/io/gfx/paletteeffects.h:38:9`! 11 /* The deeper below water, the darker it gets */ |
| 39 | |
| 40 | |
| 41 | // Class |
| 42 | |
| 43 | struct SDL_Colorcxx . . $ SDL_Color#; |
| 44 | |
| 45 | /// Palette effect base class |
| 46 | class PaletteEffectcxx . . $ PaletteEffect# { |
| 47 | |
| 48 | protected: |
| 49 | PaletteEffectcxx . . $ PaletteEffect#* nextcxx . . $ PaletteEffect#next.; ///< Next effect to use |
| 50 | |
| 51 | public: |
| 52 | explicit PaletteEffectcxx . . $ PaletteEffect#PaletteEffect(1d2f0146fec914e1).(PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 53 | virtual ~cxx . . $ PaletteEffect#`~PaletteEffect`(49f6e7a06ebc5aa8).PaletteEffectcxx . . $ PaletteEffect#(); |
| 54 | |
| 55 | virtual void applycxx . . $ PaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic); |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | /// Dissolve from white palette effect |
| 60 | class WhiteInPaletteEffectcxx . . $ WhiteInPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 61 | |
| 62 | private: |
| 63 | int durationcxx . . $ WhiteInPaletteEffect#duration.; ///< Number of milliseconds the effect lasts |
| 64 | fixedcxx . . $ fixed# whitenesscxx . . $ WhiteInPaletteEffect#whiteness.; |
| 65 | |
| 66 | public: |
| 67 | WhiteInPaletteEffectcxx . . $ WhiteInPaletteEffect#WhiteInPaletteEffect(d7b903d8eaeca941). (int newDuration, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 68 | |
| 69 | void applycxx . . $ WhiteInPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 70 | |
| 71 | }; |
| 72 | |
| 73 | /// Fade in palette effect |
| 74 | class FadeInPaletteEffectcxx . . $ FadeInPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 75 | |
| 76 | private: |
| 77 | int durationcxx . . $ FadeInPaletteEffect#duration.; ///< Number of milliseconds the effect lasts |
| 78 | fixedcxx . . $ fixed# blacknesscxx . . $ FadeInPaletteEffect#blackness.; |
| 79 | |
| 80 | public: |
| 81 | FadeInPaletteEffectcxx . . $ FadeInPaletteEffect#FadeInPaletteEffect(d7b903d8eaeca941). (int newDuration, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 82 | |
| 83 | void applycxx . . $ FadeInPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 84 | |
| 85 | }; |
| 86 | |
| 87 | /// Dissolve to white palette effect |
| 88 | class WhiteOutPaletteEffectcxx . . $ WhiteOutPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 89 | |
| 90 | private: |
| 91 | int durationcxx . . $ WhiteOutPaletteEffect#duration.; ///< Number of milliseconds the effect lasts |
| 92 | fixedcxx . . $ fixed# whitenesscxx . . $ WhiteOutPaletteEffect#whiteness.; |
| 93 | |
| 94 | public: |
| 95 | WhiteOutPaletteEffectcxx . . $ WhiteOutPaletteEffect#WhiteOutPaletteEffect(d7b903d8eaeca941). (int newDuration, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 96 | |
| 97 | void applycxx . . $ WhiteOutPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 98 | |
| 99 | }; |
| 100 | |
| 101 | /// Fade out palette effect |
| 102 | class FadeOutPaletteEffectcxx . . $ FadeOutPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 103 | |
| 104 | private: |
| 105 | int durationcxx . . $ FadeOutPaletteEffect#duration.; ///< Number of milliseconds the effect lasts |
| 106 | fixedcxx . . $ fixed# blacknesscxx . . $ FadeOutPaletteEffect#blackness.; |
| 107 | |
| 108 | public: |
| 109 | FadeOutPaletteEffectcxx . . $ FadeOutPaletteEffect#FadeOutPaletteEffect(d7b903d8eaeca941). (int newDuration, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 110 | |
| 111 | void applycxx . . $ FadeOutPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 112 | |
| 113 | }; |
| 114 | |
| 115 | /// Flash colour (dissolve to it and back again) palette effect |
| 116 | class FlashPaletteEffectcxx . . $ FlashPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 117 | |
| 118 | private: |
| 119 | int durationcxx . . $ FlashPaletteEffect#duration.; ///< Number of milliseconds the effect lasts |
| 120 | fixedcxx . . $ fixed# progresscxx . . $ FlashPaletteEffect#progress.; |
| 121 | unsigned char redcxx . . $ FlashPaletteEffect#red., greencxx . . $ FlashPaletteEffect#green., bluecxx . . $ FlashPaletteEffect#blue.; ///< Flash colour |
| 122 | |
| 123 | public: |
| 124 | FlashPaletteEffectcxx . . $ FlashPaletteEffect#FlashPaletteEffect(3a3316a3107c43ea). (unsigned char newRed, unsigned char newGreen, unsigned char newBlue, int newDuration, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 125 | |
| 126 | void applycxx . . $ FlashPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 127 | |
| 128 | }; |
| 129 | |
| 130 | /// Entry rotation palette effect |
| 131 | class RotatePaletteEffectcxx . . $ RotatePaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 132 | |
| 133 | private: |
| 134 | unsigned char firstcxx . . $ RotatePaletteEffect#first.; ///< The first palette index affected |
| 135 | int amountcxx . . $ RotatePaletteEffect#amount.; ///< The number of (consecutive) palette indices affected |
| 136 | fixedcxx . . $ fixed# speedcxx . . $ RotatePaletteEffect#speed.; ///< Rotations per second |
| 137 | fixedcxx . . $ fixed# positioncxx . . $ RotatePaletteEffect#position.; |
| 138 | |
| 139 | public: |
| 140 | RotatePaletteEffectcxx . . $ RotatePaletteEffect#RotatePaletteEffect(d314fbf4fa48014d). (unsigned char newFirst, int newAmount, fixedcxx . . $ fixed# newSpeed, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 141 | |
| 142 | void applycxx . . $ RotatePaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 143 | |
| 144 | }; |
| 145 | |
| 146 | /// Sky palette palette effect |
| 147 | class SkyPaletteEffectcxx . . $ SkyPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 148 | |
| 149 | private: |
| 150 | SDL_Colorcxx . . $ SDL_Color#* skyPalettecxx . . $ SkyPaletteEffect#skyPalette.; |
| 151 | unsigned char firstcxx . . $ SkyPaletteEffect#first.; ///< The first palette index affected |
| 152 | int amountcxx . . $ SkyPaletteEffect#amount.; ///< The number of (consecutive) palette indices affected |
| 153 | fixedcxx . . $ fixed# speedcxx . . $ SkyPaletteEffect#speed.; ///< Relative Y speed - as in Jazz 2 |
| 154 | |
| 155 | public: |
| 156 | SkyPaletteEffectcxx . . $ SkyPaletteEffect#SkyPaletteEffect(aa213b894402e617). (unsigned char newFirst, int newAmount, fixedcxx . . $ fixed# newSpeed, SDL_Colorcxx . . $ SDL_Color#* newSkyPalette, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 157 | |
| 158 | void applycxx . . $ SkyPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 159 | |
| 160 | }; |
| 161 | |
| 162 | /// 2D parallaxing background palette effect |
| 163 | class P2DPaletteEffectcxx . . $ P2DPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 164 | |
| 165 | private: |
| 166 | unsigned char firstcxx . . $ P2DPaletteEffect#first.; ///< The first palette index affected |
| 167 | int amountcxx . . $ P2DPaletteEffect#amount.; ///< The number of (consecutive) palette indices affected |
| 168 | fixedcxx . . $ fixed# speedcxx . . $ P2DPaletteEffect#speed.; ///< Relative X & Y speed - as in Jazz 2 |
| 169 | |
| 170 | public: |
| 171 | P2DPaletteEffectcxx . . $ P2DPaletteEffect#P2DPaletteEffect(d314fbf4fa48014d). (unsigned char newFirst, int newAmount, fixedcxx . . $ fixed# newSpeed, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 172 | |
| 173 | void applycxx . . $ P2DPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 174 | |
| 175 | }; |
| 176 | |
| 177 | /// 1D parallaxing background palette effect |
| 178 | class P1DPaletteEffectcxx . . $ P1DPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 179 | |
| 180 | private: |
| 181 | unsigned char firstcxx . . $ P1DPaletteEffect#first.; ///< The first palette index affected |
| 182 | int amountcxx . . $ P1DPaletteEffect#amount.; ///< The number of (consecutive) palette indices affected |
| 183 | fixedcxx . . $ fixed# speedcxx . . $ P1DPaletteEffect#speed.; ///< Relative X & Y speed - as in Jazz 2 |
| 184 | |
| 185 | public: |
| 186 | P1DPaletteEffectcxx . . $ P1DPaletteEffect#P1DPaletteEffect(d314fbf4fa48014d). (unsigned char newFirst, int newAmount, fixedcxx . . $ fixed# newSpeed, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 187 | |
| 188 | void applycxx . . $ P1DPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 189 | |
| 190 | }; |
| 191 | |
| 192 | /// Underwater darkening palette effect |
| 193 | class WaterPaletteEffectcxx . . $ WaterPaletteEffect# : public PaletteEffectcxx . . $ PaletteEffect# { |
| 194 | |
| 195 | private: |
| 196 | fixedcxx . . $ fixed# depthcxx . . $ WaterPaletteEffect#depth.; ///< Number of pixels between water surface and total darkness |
| 197 | |
| 198 | public: |
| 199 | WaterPaletteEffectcxx . . $ WaterPaletteEffect#WaterPaletteEffect(d7b903d8eaeca941). (fixedcxx . . $ fixed# newDepth, PaletteEffectcxx . . $ PaletteEffect#* nextPE); |
| 200 | |
| 201 | void applycxx . . $ WaterPaletteEffect#apply(a0d1f6d228fe1f03). (SDL_Colorcxx . . $ SDL_Color#* shownPalette, bool direct, int mspf, bool isStatic) override; |
| 202 | |
| 203 | }; |
| 204 | |
| 205 | #endif |