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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef ULTIMA_SHARED_EARLY_GAME_H
24 #define ULTIMA_SHARED_EARLY_GAME_H
25 
26 #include "ultima/shared/early/game_base.h"
27 #include "ultima/shared/core/party.h"
28 
29 namespace Ultima {
30 namespace Shared {
31 
32 class GameView;
33 class GameState;
34 class FontResources;
35 
36 namespace Maps {
37 class Map;
38 }
39 
40 /**
41  * More specialized base class for earlier Ultima games
42  */
43 class Game : public GameBase {
44 	DECLARE_MESSAGE_MAP;
45 	bool EndOfTurnMsg(CEndOfTurnMsg *msg);
46 protected:
47 	GameView *_gameView;
48 	FontResources *_fontResources;
49 protected:
50 	/**
51 	 * Sets up EGA palette
52 	 */
53 	void setEGAPalette();
54 
55 	/**
56 	 * Loads the Ultima 6 palette
57 	 */
58 	void loadU6Palette();
59 public:
60 	byte _edgeColor;
61 	byte _borderColor;
62 	byte _highlightColor;
63 	byte _textColor;
64 	byte _color1;
65 	byte _bgColor;
66 	byte _whiteColor;
67 
68 	/**
69 	 * Player party. In the earlier Ultima games, this is a single character
70 	 */
71 	Party *_party;
72 
73 	/**
74 	 * Pointer to the map manager for the game
75 	 */
76 	Maps::Map *_map;
77 
78 	/**
79 	 * Stores the base random seed used for generating deterministic dungeon levels
80 	 */
81 	uint32 _randomSeed;
82 
83 public:
84 	CLASSDEF;
85 
86 	/**
87 	 * Constructor
88 	 */
89 	Game();
90 
91 	/**
92 	 * Destructor
93 	 */
94 	~Game() override;
95 
96 	/**
97 	 * Play a sound effect
98 	 */
99 	void playFX(uint effectId);
100 
101 	/**
102 	 * Sets an EGA palette based on a 16-byte EGA RGB indexes
103 	 */
104 	void setEGAPalette(const byte *palette);
105 
106 	/**
107 	 * Sets up a CGA palette
108 	 */
109 	void setCGAPalette();
110 
111 	/**
112 	 * Returns the map
113 	 */
getMap()114 	Maps::Map *getMap() const override { return _map; }
115 
116 	/**
117 	 * Handles loading and saving games
118 	 */
119 	void synchronize(Common::Serializer &s) override;
120 
121 	/**
122 	 * Signal an end of turn
123 	 */
124 	void endOfTurn();
125 };
126 
127 } // End of namespace Shared
128 } // End of namespace Ultima
129 
130 #endif
131