| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design) |
| 5 | * Copyright (c) 2017-2021, The LegacyClonk Team and contributors |
| 6 | * |
| 7 | * Distributed under the terms of the ISC license; see accompanying file |
| 8 | * "COPYING" for details. |
| 9 | * |
| 10 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 11 | * See accompanying file "TRADEMARK" for details. |
| 12 | * |
| 13 | * To redistribute this file separately, substitute the full license texts |
| 14 | * for the above references. |
| 15 | */ |
| 16 | |
| 17 | /* Small member of the landscape class to handle the sky background */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "Fixed.h" |
| 22 | #include "C4FacetEx.h" |
| 23 | |
| 24 | #define C4SkyPM_Fixed 0 // sky parallax mode: fixed |
| 25 | #define C4SkyPM_Wind 1 // sky parallax mode: blown by the wind |
| 26 | |
| 27 | class C4Sky |
| 28 | { |
| 29 | public: |
| 30 | C4Sky() { Default(); } |
| 31 | ~C4Sky(); |
| 32 | void Default(); // zero fields |
| 33 | |
| 34 | bool Init(bool fSavegame); |
| 35 | bool Save(C4Group &hGroup); |
| 36 | void Clear(); |
| 37 | void SetFadePalette(int32_t *ipColors); |
| 38 | void Draw(C4FacetEx &cgo); // draw sky |
| 39 | uint32_t GetSkyFadeClr(int32_t iY); // get sky color at iY |
| 40 | void Execute(); // move sky |
| 41 | bool SetModulation(uint32_t dwWithClr, uint32_t dwBackClr); // adjust the way the sky is blitted |
| 42 | |
| 43 | uint32_t GetModulation(bool fBackClr) |
| 44 | { |
| 45 | return fBackClr ? BackClr : Modulation; |
| 46 | } |
| 47 | |
| 48 | void CompileFunc(StdCompiler *pComp); |
| 49 | |
| 50 | protected: |
| 51 | int32_t Width, Height; |
| 52 | uint32_t Modulation; |
| 53 | int32_t BackClr; // background color behind sky |
| 54 | bool BackClrEnabled; // is the background color enabled? |
| 55 | |
| 56 | public: |
| 57 | class C4Surface *Surface; |
| 58 | C4Fixed xdir, ydir; // sky movement speed |
| 59 | C4Fixed x, y; // sky movement pos |
| 60 | int32_t ParX, ParY; // parallax movement in xdir/ydir |
| 61 | uint32_t FadeClr1, FadeClr2; |
| 62 | int32_t ParallaxMode; // sky scrolling mode |
| 63 | }; |
| 64 | |