1 //---------------------------------------------------------------------------- 2 // EDGE Data Definition File Code (Main) 3 //---------------------------------------------------------------------------- 4 // 5 // Copyright (c) 1999-2008 The EDGE Team. 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 //---------------------------------------------------------------------------- 18 19 #ifndef __DDF_GAME_H__ 20 #define __DDF_GAME_H__ 21 22 #include "epi/utility.h" 23 24 #include "types.h" 25 26 // ------------------------------------------------------------------ 27 // -----------------------GAME DEFINITIONS--------------------------- 28 // ------------------------------------------------------------------ 29 30 class wi_mapposdef_c 31 { 32 public: 33 lumpname_c name; 34 35 int x, y; 36 37 public: 38 wi_mapposdef_c(); 39 wi_mapposdef_c(wi_mapposdef_c &rhs); 40 ~wi_mapposdef_c(); 41 42 public: 43 wi_mapposdef_c& operator=(wi_mapposdef_c &rhs); 44 45 private: 46 void Copy(wi_mapposdef_c &src); 47 48 }; 49 50 51 class wi_mapposdef_container_c : public epi::array_c 52 { 53 public: 54 wi_mapposdef_container_c(); 55 wi_mapposdef_container_c(wi_mapposdef_container_c &rhs); 56 ~wi_mapposdef_container_c(); 57 58 private: 59 void CleanupObject(void *obj); 60 void Copy(wi_mapposdef_container_c &src); 61 62 public: GetSize()63 int GetSize() { return array_entries; } Insert(wi_mapposdef_c * m)64 int Insert(wi_mapposdef_c *m) { return InsertObject((void*)&m); } 65 wi_mapposdef_container_c& operator=(wi_mapposdef_container_c &rhs); 66 wi_mapposdef_c* operator[](int idx) { return *(wi_mapposdef_c**)FetchObject(idx); } 67 }; 68 69 class wi_framedef_c 70 { 71 public: 72 lumpname_c pic; // Name of pic to display. 73 int tics; // Tics on this frame 74 int x, y; // Position on screen where this goes 75 76 public: 77 wi_framedef_c(); 78 wi_framedef_c(wi_framedef_c &rhs); 79 ~wi_framedef_c(); 80 81 public: 82 void Default(void); 83 wi_framedef_c& operator=(wi_framedef_c &rhs); 84 85 private: 86 void Copy(wi_framedef_c &src); 87 }; 88 89 class wi_framedef_container_c : public epi::array_c 90 { 91 public: 92 wi_framedef_container_c(); 93 wi_framedef_container_c(wi_framedef_container_c &rhs); 94 ~wi_framedef_container_c(); 95 96 private: 97 void CleanupObject(void *obj); 98 void Copy(wi_framedef_container_c &rhs); 99 100 public: GetSize()101 int GetSize() { return array_entries; } Insert(wi_framedef_c * f)102 int Insert(wi_framedef_c *f) { return InsertObject((void*)&f); } 103 wi_framedef_container_c& operator=(wi_framedef_container_c &rhs); 104 wi_framedef_c* operator[](int idx) { return *(wi_framedef_c**)FetchObject(idx); } 105 }; 106 107 108 class wi_animdef_c 109 { 110 public: 111 enum animtype_e { WI_NORMAL, WI_LEVEL }; 112 113 animtype_e type; 114 115 lumpname_c level; 116 117 wi_framedef_container_c frames; 118 119 public: 120 wi_animdef_c(); 121 wi_animdef_c(wi_animdef_c &rhs); 122 ~wi_animdef_c(); 123 124 public: 125 wi_animdef_c& operator=(wi_animdef_c &rhs); 126 void Default(void); 127 128 private: 129 void Copy(wi_animdef_c &rhs); 130 }; 131 132 class wi_animdef_container_c : public epi::array_c 133 { 134 public: 135 wi_animdef_container_c(); 136 wi_animdef_container_c(wi_animdef_container_c &rhs); 137 ~wi_animdef_container_c(); 138 139 private: 140 void CleanupObject(void *obj); 141 void Copy(wi_animdef_container_c &src); 142 143 public: GetSize()144 int GetSize() { return array_entries; } Insert(wi_animdef_c * a)145 int Insert(wi_animdef_c *a) { return InsertObject((void*)&a); } 146 wi_animdef_container_c& operator=(wi_animdef_container_c &rhs); 147 wi_animdef_c* operator[](int idx) { return *(wi_animdef_c**)FetchObject(idx); } 148 }; 149 150 typedef enum 151 { 152 // standard Doom shading 153 LMODEL_Doom = 0, 154 155 // Doom shading without the brighter N/S, darker E/W walls 156 LMODEL_Doomish = 1, 157 158 // flat lighting (no shading at all) 159 LMODEL_Flat = 2, 160 161 // vertex lighting 162 LMODEL_Vertex = 3, 163 164 // Invalid (-ACB- 2003/10/06: MSVC wants the invalid value as part of the enum) 165 LMODEL_Invalid = 999 166 } 167 lighting_model_e; 168 169 // Game definition file 170 class gamedef_c 171 { 172 public: 173 gamedef_c(); 174 ~gamedef_c(); 175 176 public: 177 void Default(void); 178 void CopyDetail(gamedef_c &src); 179 180 // Member vars.... 181 epi::strent_c name; 182 183 wi_animdef_container_c anims; 184 wi_mapposdef_container_c mappos; 185 186 lumpname_c background; 187 lumpname_c splatpic; 188 lumpname_c yah[2]; 189 190 // -AJA- 1999/10/22: background cameras. 191 epi::strent_c bg_camera; 192 193 int music; 194 struct sfx_s *percent; 195 struct sfx_s *done; 196 struct sfx_s *endmap; 197 struct sfx_s *nextmap; 198 struct sfx_s *accel_snd; 199 struct sfx_s *frag_snd; 200 201 lumpname_c firstmap; 202 lumpname_c namegraphic; 203 204 epi::strlist_c titlepics; 205 206 int titlemusic; 207 int titletics; 208 int special_music; 209 210 lighting_model_e lighting; 211 212 private: 213 // disable copy construct and assignment operator gamedef_c(gamedef_c & rhs)214 explicit gamedef_c(gamedef_c &rhs) { } 215 gamedef_c& operator= (gamedef_c &rhs) { return *this; } 216 }; 217 218 219 class gamedef_container_c : public epi::array_c 220 { 221 public: 222 gamedef_container_c(); 223 ~gamedef_container_c(); 224 225 private: 226 void CleanupObject(void *obj); 227 228 public: 229 // List management GetSize()230 int GetSize() { return array_entries; } Insert(gamedef_c * g)231 int Insert(gamedef_c *g) { return InsertObject((void*)&g); } 232 gamedef_c* operator[](int idx) { return *(gamedef_c**)FetchObject(idx); } 233 234 // Search Functions 235 gamedef_c* Lookup(const char* refname); 236 }; 237 238 239 // -------EXTERNALISATIONS------- 240 241 extern gamedef_container_c gamedefs; // -ACB- 2004/06/21 Implemented 242 243 bool DDF_ReadGames(void *data, int size); 244 245 #endif // __DDF_GAME_H__ 246 247 //--- editor settings --- 248 // vi:ts=4:sw=4:noexpandtab 249