engine: reject mbf21 and shit24 wads. there is no way to know if it is safe to ignore...
[k8vavoom.git] / source / mapinfo.h
blobc546a1843e260179bc414762494041339be32787
1 //**************************************************************************
2 //**
3 //** ## ## ## ## ## #### #### ### ###
4 //** ## ## ## ## ## ## ## ## ## ## #### ####
5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ##
6 //** ## ## ######## ## ## ## ## ## ## ## ### ##
7 //** ### ## ## ### ## ## ## ## ## ##
8 //** # ## ## # #### #### ## ##
9 //**
10 //** Copyright (C) 1999-2006 Jānis Legzdiņš
11 //** Copyright (C) 2018-2023 Ketmar Dark
12 //**
13 //** This program is free software: you can redistribute it and/or modify
14 //** it under the terms of the GNU General Public License as published by
15 //** the Free Software Foundation, version 3 of the License ONLY.
16 //**
17 //** This program is distributed in the hope that it will be useful,
18 //** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 //** GNU General Public License for more details.
21 //**
22 //** You should have received a copy of the GNU General Public License
23 //** along with this program. If not, see <http://www.gnu.org/licenses/>.
24 //**
25 //**************************************************************************
26 #ifndef VAVOOM_MAPINFO_HEADER
27 #define VAVOOM_MAPINFO_HEADER
30 struct VMapSpecialAction {
31 VName TypeName; // class name
32 vint32 Special; // negative means "need to translate it"
33 vint32 Args[5];
36 struct VMapInfo {
37 VName LumpName;
38 VStr Name; // name of map
39 vint32 LevelNum; // level number for action specials
40 vint32 Cluster; // defines what cluster level belongs to
41 vint32 WarpTrans; // actual map number in case maps are not sequential
42 VName NextMap; // map to teleport to upon exit of timed deathmatch
43 VName SecretMap; // map to teleport upon secret exit
44 VName SongLump; // background music (MUS or MIDI)
45 vint32 Sky1Texture; // default sky texture
46 vint32 Sky2Texture; // alternate sky displayed in Sky2 sectors
47 float Sky1ScrollDelta; // default sky texture speed
48 float Sky2ScrollDelta; // alternate sky texture speed
49 VName SkyBox; // sky box
50 VName FadeTable; // fade table {fogmap}
51 vuint32 Fade;
52 vuint32 OutsideFog;
53 float Gravity; // map gravity
54 float AirControl; // air control in this map.
55 vuint32 Flags; // for values, see `VLevelInfo::LIF_XXX`
56 vuint32 Flags2; // for values, see `VLevelInfo::LIF2_XXX`
57 VName EnterTitlePatch;
58 VName ExitTitlePatch; // if empty, `EnterTitlePatch` will be used
59 vint32 ParTime;
60 vint32 SuckTime;
61 vint8 HorizWallShade;
62 vint8 VertWallShade;
63 vint8 Infighting;
64 TArray<VMapSpecialAction> SpecialActions;
65 VName RedirectType;
66 VName RedirectMap;
67 VName ExitPic;
68 VName EnterPic;
69 VName InterMusic;
70 vint32 MapinfoSourceLump;
71 vint32 FakeContrast; // 0: default; 1: smooth; 2: disabled (even)
72 // exit texts will override cluster exit texts
73 VStr ExitText;
74 VStr SecretExitText;
75 VName InterBackdrop; // used when we have exit test, set in umapinfo parser
77 VStr GetName () const;
78 void dump (const char *msg=nullptr) const;
81 enum {
82 CLUSTERF_Hub = 0x01,
83 CLUSTERF_EnterTextIsLump = 0x02,
84 CLUSTERF_ExitTextIsLump = 0x04,
85 CLUSTERF_FinalePic = 0x80,
86 CLUSTERF_LookupEnterText = 0x10,
87 CLUSTERF_LookupExitText = 0x20,
90 struct VClusterDef {
91 vint32 Cluster;
92 vint32 Flags;
93 VStr EnterText;
94 VStr ExitText;
95 VName Flat;
96 VName Music;
98 inline VClusterDef () noexcept
99 : Cluster(0)
100 , Flags(0)
101 , EnterText()
102 , ExitText()
103 , Flat(NAME_None)
104 , Music(NAME_None)
107 inline void reset () noexcept {
108 Cluster = 0;
109 Flags = 0;
110 EnterText.clear();
111 ExitText.clear();
112 Flat = NAME_None;
113 Music = NAME_None;
117 enum {
118 EPISODEF_LookupText = 0x0001,
119 EPISODEF_NoSkillMenu = 0x0002,
120 EPISODEF_Optional = 0x0004,
123 struct VEpisodeDef {
124 VName Name;
125 VName TeaserName;
126 VStr Text;
127 VName PicName;
128 vuint32 Flags;
129 VStr Key;
130 vint32 MapinfoSourceLump;
133 enum {
134 SKILLF_FastMonsters = 0x00000001,
135 SKILLF_DisableCheats = 0x00000002,
136 SKILLF_EasyBossBrain = 0x00000004,
137 SKILLF_AutoUseHealth = 0x00000008,
138 SKILLF_MenuNameIsPic = 0x00000010,
139 SKILLF_MustConfirm = 0x00000020,
140 SKILLF_SlowMonsters = 0x00000040,
141 SKILLF_SpawnMulti = 0x00000080,
144 struct VSkillPlayerClassName {
145 VStr ClassName;
146 VStr MenuName;
149 // both must be at least `EntityEx`, and compatible
150 struct VSkillMonsterReplacement {
151 VClass *oldClass;
152 VClass *newClass;
155 struct VSkillDef {
156 VStr Name;
157 float AmmoFactor;
158 float DoubleAmmoFactor;
159 float DamageFactor;
160 float RespawnTime;
161 vint32 RespawnLimit;
162 float Aggressiveness;
163 vint32 SpawnFilter;
164 vint32 AcsReturn;
165 float MonsterHealth;
166 float HealthFactor;
167 VStr MenuName;
168 TArray<VSkillPlayerClassName> PlayerClassNames;
169 VStr ConfirmationText;
170 VStr Key;
171 VStr TextColor;
172 vuint32 Flags;
173 // monster replacements for each skill
174 // WARNING! currently it works only for predefined map spawns!
175 TArray<VSkillMonsterReplacement> Replacements;
179 void InitMapInfo ();
180 void ShutdownMapInfo ();
181 const VMapInfo &P_GetMapInfo (VName);
182 VStr P_GetMapName (int);
183 VName P_GetMapLumpName (int);
184 int P_GetMapIndexByLevelNum (int);
185 VName P_TranslateMap (int);
186 VName P_TranslateMapEx (int); // returns `NAME_None` if not found
187 VName P_GetMapLumpNameByLevelNum (int);
188 void P_PutMapSongLump (int, VName);
189 const VClusterDef *P_GetClusterDef (int);
190 int P_GetNumEpisodes ();
191 int P_GetNumMaps ();
192 VMapInfo *P_GetMapInfoPtr (int mapidx);
193 VEpisodeDef *P_GetEpisodeDef (int);
194 int P_GetNumSkills ();
195 const VSkillDef *P_GetSkillDef (int);
196 void P_GetMusicLumpNames (TArray<FReplacedString> &);
197 void P_ReplaceMusicLumpNames (TArray<FReplacedString> &);
198 void P_SetParTime (VName, int);
199 bool IsMapPresent (VName);
201 void P_SetupMapinfoPlayerClasses ();
204 #endif