1 /*
2 ** g_mapinfo.h
3 **
4 **---------------------------------------------------------------------------
5 ** Copyright 2011 Braden Obrzut
6 ** All rights reserved.
7 **
8 ** Redistribution and use in source and binary forms, with or without
9 ** modification, are permitted provided that the following conditions
10 ** are met:
11 **
12 ** 1. Redistributions of source code must retain the above copyright
13 **    notice, this list of conditions and the following disclaimer.
14 ** 2. Redistributions in binary form must reproduce the above copyright
15 **    notice, this list of conditions and the following disclaimer in the
16 **    documentation and/or other materials provided with the distribution.
17 ** 3. The name of the author may not be used to endorse or promote products
18 **    derived from this software without specific prior written permission.
19 **
20 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 **---------------------------------------------------------------------------
31 **
32 **
33 */
34 
35 #ifndef __G_MAPINFO_H__
36 #define __G_MAPINFO_H__
37 
38 #include "textures/textures.h"
39 #include "v_font.h"
40 #include "wl_text.h"
41 #include "zstring.h"
42 
43 class ClassDef;
44 
45 extern class GameInfo
46 {
47 public:
48 	FString	SignonLump;
49 	int		MenuFadeColor;
50 	int		MenuColors[6];
51 	int		MessageColors[3];
52 	int		MenuWindowColors[6];
53 	int		AdvisoryColor;
54 	int		PsychedColors[2];
55 	int 	PsychedOffset;
56 	bool	DrawReadThis;
57 
58 	int		TitleTime;
59 	FString	BorderFlat;
60 	FString GameColormap;
61 	FString	GamePalette;
62 	FString	TitleMusic;
63 	FString	TitlePage;
64 	FString	TitlePalette;
65 	FString	MenuMusic;
66 	FString	ScoresMusic;
67 	FString	FinaleMusic;
68 	FString VictoryMusic;
69 	FString	IntermissionMusic;
70 	FString	HighScoresFont;
71 	FString	AdvisoryPic;
72 	FString FinaleFlat;
73 	FString GameOverPic;
74 	FString VictoryPic;
75 	// Special stack for strings like the default translator.
76 	// This will allow the previous default to be included.
77 	class FStringStack
78 	{
79 	public:
FStringStack()80 		FStringStack() : next(NULL) {}
~FStringStack()81 		~FStringStack() { delete next; }
82 
Next()83 		const FStringStack *Next() const { return next; }
Push(const FString & str)84 		void Push(const FString &str)
85 		{
86 			if(!this->str.IsEmpty())
87 				next = new FStringStack(*this);
88 			this->str = str;
89 		}
90 
91 		FString str;
92 	private:
93 		FStringStack *next;
94 	} Translator;
95 	FName	DoorSoundSequence;
96 	FName	PushwallSoundSequence;
97 	fixed	GibFactor;
98 
99 	TArray<FName>	PlayerClasses;
100 	TArray<FString>	QuitMessages;
101 
102 	enum EFontColors
103 	{
104 		MENU_TITLE,
105 		MENU_LABEL,
106 		MENU_SELECTION,
107 		MENU_DISABLED,
108 		MENU_INVALID,
109 		MENU_INVALIDSELECTION,
110 		MENU_HIGHLIGHT,
111 		MENU_HIGHLIGHTSELECTION,
112 		HIGHSCORES,
113 		PAGEINDEX,
114 		MESSAGEFONT,
115 		DIALOG,
116 
117 		NUM_FONTCOLORS
118 	};
119 	EColorRange	FontColors[NUM_FONTCOLORS];
120 
121 	enum ETransition
122 	{
123 		TRANSITION_Fizzle,
124 		TRANSITION_Fade
125 	};
126 	ETransition DeathTransition;
127 
128 	struct BorderTextures
129 	{
130 		bool issolid;
131 
132 		int topcolor;
133 		int bottomcolor;
134 		int highlightcolor;
135 
136 		int offset;
137 		FString tl, t, tr;
138 		FString l, r;
139 		FString bl, b, br;
140 	} Border;
141 
142 	struct AutomapInfo
143 	{
144 		EColorRange FontColor;
145 		int Background;
146 		int DoorColor;
147 		int FloorColor;
148 		int WallColor;
149 		int YourColor;
150 	} automap;
151 } gameinfo;
152 
153 class LevelInfo
154 {
155 public:
156 	LevelInfo();
157 	FTextureID GetBorderTexture() const;
158 	FString GetName(const class GameMap *gm) const;
159 
160 	char			MapName[9];
161 	FString			NextMap;
162 	FString			NextSecret;
163 	FString			NextVictory;
164 	FString			FloorNumber;
165 	FString			Music;
166 	unsigned int	Cluster;
167 	FString			Translator;
168 	FTextureID		TitlePatch;
169 
170 	FTextureID		BorderTexture;
171 	FTextureID		DefaultTexture[2];
172 	int				DefaultLighting;
173 	fixed			DefaultVisibility;
174 	fixed			DefaultMaxLightVis;
175 	int				ExitFadeColor;
176 	unsigned int	ExitFadeDuration;
177 	unsigned int	Par;
178 	FString			CompletionString;
179 	FTextureID		HighScoresGraphic;
180 	int				LevelBonus;
181 	unsigned int	LevelNumber;
182 	bool			NoIntermission;
183 
184 	bool			DeathCam;
185 	bool			SecretDeathSounds;
186 	bool			SpawnWithWeaponRaised;
187 	bool			ForceTally;
188 
189 	TArray<const ClassDef *>	EnsureInventory;
190 
191 	struct SpecialAction
192 	{
193 	public:
194 		const ClassDef	*Class;
195 		unsigned int	Special;
196 		int				Args[5];
197 	};
198 	TArray<SpecialAction>	SpecialActions;
199 
200 	static LevelInfo &Find(const char* level);
201 	static LevelInfo &FindByNumber(unsigned int num);
202 
203 protected:
204 	friend class LevelInfoBlockParser;
205 
206 	bool			UseMapInfoName;
207 	FString			Name;
208 };
209 
210 class EpisodeInfo
211 {
212 public:
213 	EpisodeInfo();
214 
215 	FString		StartMap;
216 	FString		EpisodeName;
217 	FString		EpisodePicture;
218 	char		Shortcut;
219 	bool		NoSkill;
220 
221 	static unsigned int GetNumEpisodes();
222 	static EpisodeInfo &GetEpisode(unsigned int index);
223 };
224 
225 class ClusterInfo
226 {
227 public:
228 	enum ExitType
229 	{
230 		EXIT_STRING,
231 		EXIT_LUMP,
232 		EXIT_MESSAGE
233 	};
234 
235 	ClusterInfo();
236 
237 	FString		EnterSlideshow, ExitSlideshow;
238 	FString		EnterText, ExitText;
239 	ExitType	EnterTextType, ExitTextType;
240 	FString		Flat;
241 	FString		Music;
242 	FFont		*TextFont;
243 	ETSAlignment TextAlignment;
244 	ETSAnchor	TextAnchor;
245 	EColorRange	TextColor;
246 
247 	static ClusterInfo &Find(unsigned int index);
248 };
249 
250 class SkillInfo
251 {
252 public:
253 	SkillInfo();
254 
255 	FString Name;
256 	FString SkillPicture;
257 	FString MustConfirm;
258 	fixed DamageFactor;
259 	fixed PlayerDamageFactor;
260 	unsigned int SpawnFilter;
261 	unsigned int MapFilter;
262 	bool FastMonsters;
263 	bool QuizHints;
264 
265 	static unsigned int GetNumSkills();
266 	static unsigned int GetSkillIndex(const SkillInfo &skill);
267 	static SkillInfo &GetSkill(unsigned int index);
268 };
269 
270 void G_ParseMapInfo(bool gameinfoPass);
271 
272 #endif
273