structs.h (9152B)
1 /* 2 =========================================================================== 3 4 Doom 3 BFG Edition GPL Source Code 5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). 8 9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 BFG Edition Source Code 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 You should have received a copy of the GNU General Public License 20 along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 29 #pragma once 30 31 // am_map.structs begin // 32 typedef struct 33 { 34 int x, y; 35 } fpoint_t; 36 typedef struct 37 { 38 fpoint_t a, b; 39 } fline_t; 40 typedef struct 41 { 42 fixed_t x,y; 43 } mpoint_t; 44 typedef struct 45 { 46 mpoint_t a, b; 47 } mline_t; 48 typedef struct 49 { 50 fixed_t slp, islp; 51 } islope_t; 52 // am_map.structs end // 53 // f_finale.structs begin // 54 typedef struct 55 { 56 char *name; 57 mobjtype_t type; 58 } castinfo_t; 59 // f_finale.structs end // 60 // i_input.structs begin // 61 62 enum { 63 J_DELTAX, 64 J_DELTAY, 65 }; 66 enum InputEventType 67 { 68 IETAxis, 69 IETButtonDigital, 70 IETButtonAnalog, 71 IETNone, 72 } ; 73 struct InputEvent 74 { 75 InputEventType type; 76 int data; 77 int action; 78 int port; 79 } ; 80 // i_input.structs end // 81 82 // mus2midi.structs begin // 83 typedef struct tagMUSheader_t { 84 char ID[4]; // identifier "MUS" 0x1A 85 WORD scoreLen; 86 WORD scoreStart; 87 WORD channels; // count of primary channels 88 WORD sec_channels; // count of secondary channels 89 WORD instrCnt; 90 WORD dummy; 91 //// variable-length part starts here 92 } MUSheader_t ; 93 typedef struct tagMidiHeaderChunk_t { 94 char name[4]; 95 int length; 96 97 short format; // make 0 98 short ntracks; // make 1 99 short division; // 0xe250?? 100 } MidiHeaderChunk_t; 101 typedef struct tagMidiTrackChunk_t { 102 char name[4]; 103 int length; 104 } MidiTrackChunk_t; 105 // mus2midi.structs end // 106 // m_menu.structs begin // 107 typedef struct 108 { 109 // 0 = no cursor here, 1 = ok, 2 = arrows ok 110 short status; 111 112 char name[10]; 113 114 // choice = menu item #. 115 // if status = 2, 116 // choice=0:leftarrow,1:rightarrow 117 void (*routine)(int choice); 118 119 // hotkey in menu 120 char alphaKey; 121 } menuitem_t; 122 typedef struct menu_s 123 { 124 short numitems; // # of menu items 125 struct menu_s* prevMenu; // previous menu 126 menuitem_t* menuitems; // menu items 127 void (*routine)(); // draw routine 128 short x; 129 short y; // x,y of menu 130 short lastOn; // last item user was on in menu 131 } menu_t; 132 typedef enum 133 { 134 newgame = 0, 135 options, 136 loadgame, 137 savegame, 138 quitdoom, 139 main_end 140 } main_e; 141 typedef enum 142 { 143 g_accept, 144 g_cancel, 145 g_change, 146 qut_end 147 } quit_e; 148 typedef enum 149 { 150 ep1, 151 ep2, 152 ep3, 153 ep4, 154 ep_end 155 } episodes_e; 156 typedef enum 157 { 158 ex1, 159 ex2, 160 ex_end 161 } expansions_e; 162 typedef enum 163 { 164 killthings, 165 toorough, 166 hurtme, 167 violence, 168 nightmare, 169 newg_end 170 } newgame_e; 171 typedef enum 172 { 173 endgame, 174 scrnsize, 175 messages, 176 //detail, 177 option_empty1, 178 mousesens, 179 option_empty2, 180 soundvol, 181 opt_end 182 } options_e; 183 typedef enum 184 { 185 rdthsempty1, 186 read1_end 187 } read_e; 188 typedef enum 189 { 190 rdthsempty2, 191 read2_end 192 } read_e2; 193 typedef enum 194 { 195 sfx_vol, 196 sfx_empty1, 197 music_vol, 198 sfx_empty2, 199 sound_end 200 } sound_e; 201 typedef enum 202 { 203 load1, 204 load2, 205 load3, 206 load4, 207 load5, 208 load6, 209 load_end 210 } load_e; 211 // m_menu.structs end // 212 // m_misc.structs begin // 213 struct default_t 214 { 215 char* name; 216 union { 217 int * location; 218 const char * * charLocation; 219 }; 220 union { 221 int defaultvalue; 222 const char * charDefault; 223 }; 224 int scantranslate; // PC scan code hack 225 int untranslated; // lousy hack 226 227 default_t( ) : 228 name( NULL ), 229 location( NULL ), 230 defaultvalue( 0 ), 231 scantranslate( 0 ), 232 untranslated( 0 ) { 233 } 234 235 default_t( char * name_, int * location_, int defaultvalue_ ) : 236 name( name_ ), 237 location( location_ ), 238 defaultvalue( defaultvalue_ ) { 239 } 240 241 default_t( char * name_, const char * * charLocation_, const char * charDefault_ ) : 242 name( name_ ), 243 charLocation( charLocation_ ), 244 charDefault( charDefault_ ) { 245 } 246 }; 247 typedef struct 248 { 249 char manufacturer; 250 char version; 251 char encoding; 252 char bits_per_pixel; 253 254 unsigned short xmin; 255 unsigned short ymin; 256 unsigned short xmax; 257 unsigned short ymax; 258 259 unsigned short hres; 260 unsigned short vres; 261 262 unsigned char palette[48]; 263 264 char reserved; 265 char color_planes; 266 unsigned short bytes_per_line; 267 unsigned short palette_type; 268 269 char filler[58]; 270 unsigned char data; // unbounded 271 } pcx_t; 272 // m_misc.structs end // 273 // p_enemy.structs begin // 274 typedef enum 275 { 276 DI_EAST, 277 DI_NORTHEAST, 278 DI_NORTH, 279 DI_NORTHWEST, 280 DI_WEST, 281 DI_SOUTHWEST, 282 DI_SOUTH, 283 DI_SOUTHEAST, 284 DI_NODIR, 285 NUMDIRS 286 287 } dirtype_t; 288 // p_enemy.structs end // 289 // p_saveg.structs begin // 290 typedef enum 291 { 292 tc_end = 0, 293 tc_mobj 294 295 } thinkerclass_t; 296 typedef enum 297 { 298 tc_ceiling = 2, 299 tc_door, 300 tc_floor, 301 tc_plat, 302 tc_flash, 303 tc_strobe, 304 tc_glow, 305 tc_endspecials, 306 tc_fire 307 308 } specials_e; 309 // p_saveg.structs end // 310 // p_spec.structs begin // 311 typedef struct 312 { 313 qboolean istexture; 314 int picnum; 315 int basepic; 316 int numpics; 317 int speed; 318 319 } anim_t2; 320 typedef struct 321 { 322 qboolean istexture; // if false, it is a flat 323 char endname[9]; 324 char startname[9]; 325 int speed; 326 } animdef_t; 327 // p_spec.structs end // 328 // r_bsp.structs begin // 329 typedef struct 330 { 331 int first; 332 int last; 333 334 } cliprange_t; 335 // r_bsp.structs end // 336 // r_data.structs begin // 337 typedef struct 338 { 339 short originx; 340 short originy; 341 short patch; 342 short stepdir; 343 short colormap; 344 } mappatch_t; 345 typedef struct 346 { 347 char name[8]; 348 int masked; 349 short width; 350 short height; 351 void **columndirectory; // OBSOLETE 352 short patchcount; 353 mappatch_t patches[1]; 354 } maptexture_t; 355 typedef struct 356 { 357 // Block origin (allways UL), 358 // which has allready accounted 359 // for the internal origin of the patch. 360 int originx; 361 int originy; 362 int patch; 363 } texpatch_t; 364 typedef struct 365 { 366 // Keep name for switch changing, etc. 367 char name[8]; 368 short width; 369 short height; 370 371 // All the patches[patchcount] 372 // are drawn back to front into the cached texture. 373 short patchcount; 374 texpatch_t patches[1]; 375 376 } texture_t; 377 // r_data.structs end // 378 // r_things.structs begin // 379 typedef struct 380 { 381 int x1; 382 int x2; 383 384 int column; 385 int topclip; 386 int bottomclip; 387 388 } maskdraw_t; 389 // r_things.structs end // 390 // st_stuff.structs begin // 391 typedef enum 392 { 393 NoState = -1, 394 StatCount, 395 ShowNextLoc 396 397 } stateenum_t; 398 // st_stuff.structs end // 399 // s_sound.structs begin // 400 typedef struct 401 { 402 // sound information (if null, channel avail.) 403 sfxinfo_t* sfxinfo; 404 405 // origin of sound 406 void* origin; 407 408 // handle of the sound being played 409 int handle; 410 411 } channel_t; 412 // s_sound.structs end // 413 // wi_stuff.structs begin // 414 typedef enum 415 { 416 ANIM_ALWAYS, 417 ANIM_RANDOM, 418 ANIM_LEVEL 419 420 } animenum_t; 421 typedef struct 422 { 423 int x; 424 int y; 425 426 } point_t; 427 typedef struct 428 { 429 animenum_t type; 430 431 // period in tics between animations 432 int period; 433 434 // number of animation frames 435 int nanims; 436 437 // location of animation 438 point_t loc; 439 440 // ALWAYS: n/a, 441 // RANDOM: period deviation (<256), 442 // LEVEL: level 443 int data1; 444 445 // ALWAYS: n/a, 446 // RANDOM: random base period, 447 // LEVEL: n/a 448 int data2; 449 450 // actual graphics for frames of animations 451 patch_t* p[3]; 452 453 // following must be initialized to zero before use! 454 455 // next value of bcnt (used in conjunction with period) 456 int nexttic; 457 458 // last drawn animation frame 459 int lastdrawn; 460 461 // next frame number to animate 462 int ctr; 463 464 // used by RANDOM and LEVEL when animating 465 int state; 466 467 } anim_t; 468 // wi_stuff.structs end // 469 // z_zone.structs begin // 470 struct lumplookup 471 { 472 int lump; 473 lumplookup *next; 474 lumplookup *prev; 475 }; 476 typedef struct 477 { 478 // total bytes malloced, including header 479 int size; 480 481 // start / end cap for linked list 482 memblock_t blocklist; 483 484 memblock_t* rover; 485 486 } memzone_t; 487 // z_zone.structs end //