Odamex
Setting the Standard in Multiplayer Doom
common/g_level.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*-
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: g_level.h 1859 2010-09-05 21:54:58Z mike $
00005 //
00006 // Copyright (C) 1998-2006 by Randy Heit (ZDoom 1.22).
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // DESCRIPTION:
00020 //      G_LEVEL
00021 //
00022 //-----------------------------------------------------------------------------
00023 
00024 
00025 #ifndef __G_LEVEL_H__
00026 #define __G_LEVEL_H__
00027 
00028 #include "doomtype.h"
00029 #include "doomdef.h"
00030 #include "m_fixed.h"
00031 
00032 #define NUM_MAPVARS                             32
00033 #define NUM_WORLDVARS                   64
00034 
00035 #define LEVEL_NOINTERMISSION    0x00000001
00036 #define LEVEL_DOUBLESKY                 0x00000004
00037 #define LEVEL_NOSOUNDCLIPPING   0x00000008
00038 
00039 #define LEVEL_MAP07SPECIAL              0x00000010
00040 #define LEVEL_BRUISERSPECIAL    0x00000020
00041 #define LEVEL_CYBORGSPECIAL             0x00000040
00042 #define LEVEL_SPIDERSPECIAL             0x00000080
00043 
00044 #define LEVEL_SPECLOWERFLOOR    0x00000100
00045 #define LEVEL_SPECOPENDOOR              0x00000200
00046 #define LEVEL_SPECACTIONSMASK   0x00000300
00047 
00048 #define LEVEL_MONSTERSTELEFRAG  0x00000400
00049 #define LEVEL_EVENLIGHTING              0x00000800
00050 #define LEVEL_SNDSEQTOTALCTRL   0x00001000
00051 #define LEVEL_FORCENOSKYSTRETCH 0x00002000
00052 
00053 #define LEVEL_JUMP_NO                   0x00004000
00054 #define LEVEL_JUMP_YES                  0x00008000
00055 #define LEVEL_FREELOOK_NO               0x00010000
00056 #define LEVEL_FREELOOK_YES              0x00020000
00057 
00058 #define LEVEL_STARTLIGHTNING    0x01000000              // Automatically start lightning
00059 #define LEVEL_FILTERSTARTS              0x02000000              // Apply mapthing filtering to player starts
00060 
00061 #define LEVEL_DEFINEDINMAPINFO  0x20000000              // Level was defined in a MAPINFO lump
00062 #define LEVEL_CHANGEMAPCHEAT    0x40000000              // Don't display cluster messages
00063 #define LEVEL_VISITED                   0x80000000              // Used for intermission map
00064 
00065 struct acsdefered_s;
00066 
00067 struct level_info_s {
00068         char            mapname[9];
00069         int                     levelnum;
00070         const char      *level_name;
00071         char            pname[9];
00072         char            nextmap[9];
00073         char            secretmap[9];
00074         int                     partime;
00075         char            skypic[9];
00076         char            music[9];
00077         DWORD           flags;
00078         int                     cluster;
00079         FLZOMemFile     *snapshot;
00080         struct acsdefered_s *defered;
00081 };
00082 typedef struct level_info_s level_info_t;
00083 
00084 struct level_pwad_info_s
00085 {
00086         // level_info_s
00087         char            mapname[9];
00088         int                     levelnum;
00089         const char      *level_name;
00090         char            pname[9];
00091         char            nextmap[9];
00092         char            secretmap[9];
00093         int                     partime;
00094         char            skypic[9];
00095         char            music[9];
00096         DWORD           flags;
00097         int                     cluster;
00098         FLZOMemFile     *snapshot;
00099         struct acsdefered_s *defered;
00100 
00101         // level_pwad_info_s                            [ML] 5/11/06 Removed sky scrolling/sky2
00102         DWORD           fadeto;
00103         char            fadetable[8];
00104         DWORD           outsidefog;
00105         float           gravity;
00106         float           aircontrol;     
00107 };
00108 typedef struct level_pwad_info_s level_pwad_info_t;
00109 
00110 
00111 struct level_locals_s {
00112         int                     time;
00113         int                     starttime;
00114         int                     partime;
00115 
00116         level_info_t *info;
00117         int                     cluster;
00118         int                     levelnum;
00119         char            level_name[64];                 // the descriptive name (Outer Base, etc)
00120         char            mapname[8];                             // the server name (base1, etc)
00121         char            nextmap[8];                             // go here when sv_fraglimit is hit
00122         char            secretmap[8];                   // map to go to when used secret exit
00123 
00124         DWORD           flags;
00125 
00126         DWORD           fadeto;                                 // The color the palette fades to (usually black)
00127         DWORD           outsidefog;                             // The fog for sectors with sky ceilings
00128 
00129         char            music[8];
00130         char            skypic[8];
00131 
00132         int                     total_secrets;
00133         int                     found_secrets;
00134 
00135         int                     total_items;
00136         int                     found_items;
00137 
00138         int                     total_monsters;
00139         int                     killed_monsters;
00140         
00141         float           gravity;
00142         fixed_t         aircontrol;
00143         fixed_t         airfriction;    
00144         
00145         // The following are all used for ACS scripting
00146         byte            *behavior;
00147         int                     *scripts;
00148         int                     *strings;
00149         SDWORD          vars[NUM_MAPVARS];      
00150 };
00151 typedef struct level_locals_s level_locals_t;
00152 
00153 struct cluster_info_s {
00154         int                     cluster;
00155         char            messagemusic[9];
00156         // [Russell] - Naturally, this should have an extra byte for the null terminator
00157         char            finaleflat[9];
00158         const char              *exittext;
00159         const char              *entertext;
00160         int                     flags;
00161 };
00162 typedef struct cluster_info_s cluster_info_t;
00163 
00164 // Only one cluster flag right now
00165 #define CLUSTER_HUB             0x00000001
00166 
00167 extern level_locals_t level;
00168 extern level_info_t LevelInfos[];
00169 extern cluster_info_t ClusterInfos[];
00170 
00171 extern int WorldVars[NUM_WORLDVARS];
00172 
00173 extern BOOL savegamerestore;
00174 extern BOOL HexenHack;          // Semi-Hexen-compatibility mode
00175 
00176 void G_InitNew (const char *mapname);
00177 void G_ChangeMap (void);
00178 
00179 // Can be called by the startup code or M_Responder.
00180 // A normal game starts at map 1,
00181 // but a warp test can start elsewhere
00182 void G_DeferedInitNew (char *mapname);
00183 
00184 void G_ExitLevel (int position, int drawscores);
00185 void G_SecretExitLevel (int position, int drawscores);
00186 
00187 void G_DoLoadLevel (int position);
00188 
00189 void G_InitLevelLocals (void);
00190 
00191 void G_AirControlChanged ();
00192 
00193 void G_SetLevelStrings (void);
00194 
00195 cluster_info_t *FindClusterInfo (int cluster);
00196 level_info_t *FindLevelInfo (char *mapname);
00197 level_info_t *FindLevelByNum (int num);
00198 
00199 char *CalcMapName (int episode, int level);
00200 
00201 void G_ParseMapInfo (void);
00202 
00203 void G_ClearSnapshots (void);
00204 void G_SnapshotLevel (void);
00205 void G_UnSnapshotLevel (bool keepPlayers);
00206 void G_SerializeSnapshots (FArchive &arc);
00207 
00208 #endif //__G_LEVEL_H__
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends