structs.h 8.9 KB

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