ScummVM API documentation
vpal.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  *
21  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_VPAL_H
27 #define SAGA2_VPAL_H
28 
29 #include "saga2/idtypes.h"
30 
31 namespace Saga2 {
32 
33 // Stores an RGB value
34 
35 struct gPaletteEntry {
36  uint8 r,
37  g,
38  b;
39 };
40 
41 // An entire palette of 256 colors
42 
43 struct gPalette {
44  gPaletteEntry entry[256];
45 
46  void read(Common::InSaveFile *in);
47  void write(Common::MemoryWriteStreamDynamic *out);
48 };
49 
50 typedef gPalette *gPalettePtr;
51 
52 /* ===================================================================== *
53  Prototypes
54  * ===================================================================== */
55 
56 void LoadPalette(gPalette &palette);
57 int32 ColorDistance(gPaletteEntry &c1, gPaletteEntry &c2);
58 void CalcPens(gPalette &, gPaletteEntry *, gPen *, int16, bool);
59 
61 private:
62  gPalette _currentPalette;
63 
64  gPalette _oldPalette,
65  _destPalette,
66  _quickPalette;
67 
68  int32 _startTime,
69  _totalTime;
70 
71 
72 public:
73  gPalette _newPalette;
74  gPalettePtr _midnightPalette,
75  _noonPalette,
76  _darkPalette;
77 
78  uint32 _prevLightLevel;
79 
81  //~PaletteManager() {}
82 
83  void assertCurrentPalette();
84  void loadPalettes();
85  void cleanupPalettes();
86  void beginFade(gPalettePtr newPalette, int32 fadeDuration);
87  bool updatePalette();
88  void createPalette(gPalettePtr newP, gPalettePtr srcP, gPalettePtr dstP,
89  int32 elapsedTime, int32 totalTime_);
90  void setCurrentPalette(gPalettePtr newPal);
91  void getCurrentPalette(gPalettePtr pal);
92  void initPaletteState();
93  void lightsOut();
94  void quickSavePalette();
95  void quickRestorePalette();
96  void savePaletteState(Common::OutSaveFile *outS);
97  void loadPaletteState(Common::InSaveFile *in);
98 };
99 
100 } // end of namespace Saga2
101 
102 #endif
Definition: vpal.h:43
Definition: savefile.h:54
Definition: actor.h:32
Definition: memstream.h:194
Definition: stream.h:745
Definition: vpal.h:60
Definition: vpal.h:35