1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id: g_level.h 1859 2010-09-05 21:54:58Z mike $ 5 // 6 // Copyright (C) 1998-2006 by Randy Heit (ZDoom 1.22). 7 // Copyright (C) 2006-2014 by The Odamex Team. 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // DESCRIPTION: 20 // G_LEVEL 21 // 22 //----------------------------------------------------------------------------- 23 24 25 #ifndef __G_LEVEL_H__ 26 #define __G_LEVEL_H__ 27 28 #include "doomtype.h" 29 #include "doomdef.h" 30 #include "m_fixed.h" 31 32 #include <string> 33 #include <vector> 34 35 #define NUM_MAPVARS 128 36 #define NUM_WORLDVARS 256 37 #define NUM_GLOBALVARS 64 38 39 #define LEVEL_NOINTERMISSION 0x00000001u 40 #define LEVEL_DOUBLESKY 0x00000004u 41 #define LEVEL_NOSOUNDCLIPPING 0x00000008u 42 43 #define LEVEL_MAP07SPECIAL 0x00000010u 44 #define LEVEL_BRUISERSPECIAL 0x00000020u 45 #define LEVEL_CYBORGSPECIAL 0x00000040u 46 #define LEVEL_SPIDERSPECIAL 0x00000080u 47 48 #define LEVEL_SPECLOWERFLOOR 0x00000100u 49 #define LEVEL_SPECOPENDOOR 0x00000200u 50 #define LEVEL_SPECACTIONSMASK 0x00000300u 51 52 #define LEVEL_MONSTERSTELEFRAG 0x00000400u 53 #define LEVEL_EVENLIGHTING 0x00000800u 54 #define LEVEL_SNDSEQTOTALCTRL 0x00001000u 55 #define LEVEL_FORCENOSKYSTRETCH 0x00002000u 56 57 #define LEVEL_JUMP_NO 0x00004000u 58 #define LEVEL_JUMP_YES 0x00008000u 59 #define LEVEL_FREELOOK_NO 0x00010000u 60 #define LEVEL_FREELOOK_YES 0x00020000u 61 62 #define LEVEL_STARTLIGHTNING 0x01000000u // Automatically start lightning 63 #define LEVEL_FILTERSTARTS 0x02000000u // Apply mapthing filtering to player starts 64 65 #define LEVEL_DEFINEDINMAPINFO 0x20000000u // Level was defined in a MAPINFO lump 66 #define LEVEL_CHANGEMAPCHEAT 0x40000000u // Don't display cluster messages 67 #define LEVEL_VISITED 0x80000000u // Used for intermission map 68 69 struct acsdefered_s; 70 class FBehavior; 71 72 struct level_info_s { 73 char mapname[9]; 74 int levelnum; 75 const char *level_name; 76 char pname[9]; 77 char nextmap[9]; 78 char secretmap[9]; 79 int partime; 80 char skypic[9]; 81 char music[9]; 82 DWORD flags; 83 int cluster; 84 FLZOMemFile *snapshot; 85 struct acsdefered_s *defered; 86 }; 87 typedef struct level_info_s level_info_t; 88 89 struct level_pwad_info_s 90 { 91 // level_info_s 92 char mapname[9]; 93 int levelnum; 94 const char *level_name; 95 char pname[9]; 96 char nextmap[9]; 97 char secretmap[9]; 98 int partime; 99 char skypic[9]; 100 char music[9]; 101 DWORD flags; 102 int cluster; 103 FLZOMemFile *snapshot; 104 struct acsdefered_s *defered; 105 106 // level_pwad_info_s [ML] 5/11/06 Removed sky scrolling/sky2 107 char skypic2[9]; 108 DWORD fadeto; 109 char fadetable[8]; 110 DWORD outsidefog; 111 float gravity; 112 float aircontrol; 113 }; 114 typedef struct level_pwad_info_s level_pwad_info_t; 115 116 117 struct level_locals_s { 118 int time; 119 int starttime; 120 int partime; 121 int timeleft; 122 unsigned int inttimeleft; 123 124 level_info_t *info; 125 int cluster; 126 int levelnum; 127 char level_name[64]; // the descriptive name (Outer Base, etc) 128 char mapname[8]; // the server name (base1, etc) 129 char nextmap[8]; // go here when sv_fraglimit is hit 130 char secretmap[8]; // map to go to when used secret exit 131 132 DWORD flags; 133 134 DWORD fadeto; // The color the palette fades to (usually black) 135 DWORD outsidefog; // The fog for sectors with sky ceilings 136 137 char music[8]; 138 char skypic[8]; 139 char skypic2[8]; 140 141 int total_secrets; 142 int found_secrets; 143 144 int total_items; 145 int found_items; 146 147 int total_monsters; 148 int killed_monsters; 149 150 float gravity; 151 fixed_t aircontrol; 152 fixed_t airfriction; 153 154 // The following are all used for ACS scripting 155 FBehavior *behavior; 156 SDWORD vars[NUM_MAPVARS]; 157 }; 158 typedef struct level_locals_s level_locals_t; 159 160 struct cluster_info_s { 161 int cluster; 162 char messagemusic[9]; 163 // [Russell] - Naturally, this should have an extra byte for the null terminator 164 char finaleflat[9]; 165 const char *exittext; 166 const char *entertext; 167 int flags; 168 }; 169 typedef struct cluster_info_s cluster_info_t; 170 171 // Only one cluster flag right now 172 #define CLUSTER_HUB 0x00000001 173 174 extern level_locals_t level; 175 extern level_info_t LevelInfos[]; 176 extern cluster_info_t ClusterInfos[]; 177 178 extern int ACS_WorldVars[NUM_WORLDVARS]; 179 extern int ACS_GlobalVars[NUM_GLOBALVARS]; 180 181 extern BOOL savegamerestore; 182 extern BOOL HexenHack; // Semi-Hexen-compatibility mode 183 184 void G_InitNew (const char *mapname); 185 void G_ChangeMap (void); 186 void G_ChangeMap (size_t index); 187 void G_RestartMap (void); 188 189 // Can be called by the startup code or M_Responder. 190 // A normal game starts at map 1, 191 // but a warp test can start elsewhere 192 void G_DeferedInitNew (char *mapname); 193 194 // Map reset functions 195 void G_DeferedFullReset(); 196 void G_DeferedReset(); 197 198 void G_ExitLevel (int position, int drawscores); 199 void G_SecretExitLevel (int position, int drawscores); 200 201 void G_DoLoadLevel (int position); 202 void G_DoResetLevel (bool full_reset); 203 204 void G_InitLevelLocals (void); 205 206 void G_AirControlChanged (); 207 208 void G_SetLevelStrings (void); 209 210 cluster_info_t *FindClusterInfo (int cluster); 211 level_info_t *FindLevelInfo (char *mapname); 212 level_info_t *FindLevelByNum (int num); 213 214 char *CalcMapName (int episode, int level); 215 216 void G_ParseMapInfo (void); 217 void G_ParseMusInfo (void); 218 219 void G_ClearSnapshots (void); 220 void G_SnapshotLevel (void); 221 void G_UnSnapshotLevel (bool keepPlayers); 222 void G_SerializeSnapshots (FArchive &arc); 223 224 void cmd_maplist(const std::vector<std::string> &arguments, std::vector<std::string> &response); 225 226 #endif //__G_LEVEL_H__ 227