global_data.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. #ifndef GLOBAL_DATA_H
  2. #define GLOBAL_DATA_H
  3. #include "doomstat.h"
  4. #include "doomdef.h"
  5. #include "m_fixed.h"
  6. #include "am_map.h"
  7. #include "g_game.h"
  8. #include "hu_lib.h"
  9. #include "hu_stuff.h"
  10. #include "r_defs.h"
  11. #include "i_sound.h"
  12. #include "m_menu.h"
  13. #include "p_spec.h"
  14. #include "p_enemy.h"
  15. #include "p_map.h"
  16. #include "p_maputl.h"
  17. #include "p_mobj.h"
  18. #include "p_tick.h"
  19. #include "r_draw.h"
  20. #include "r_main.h"
  21. #include "r_plane.h"
  22. #include "r_things.h"
  23. #include "s_sound.h"
  24. #include "st_lib.h"
  25. #include "st_stuff.h"
  26. #include "v_video.h"
  27. #include "w_wad.h"
  28. #include "wi_stuff.h"
  29. typedef struct globals_t
  30. {
  31. #ifndef GLOBAL_DEFS_H
  32. #define GLOBAL_DEFS_H
  33. //******************************************************************************
  34. //am_map.c
  35. //******************************************************************************
  36. enum automapmode_e automapmode; // Mode that the automap is in
  37. // location of window on screen
  38. int f_x;
  39. int f_y;
  40. // size of window on screen
  41. int f_w;
  42. int f_h;
  43. mpoint_t m_paninc; // how far the window pans each tic (map coords)
  44. fixed_t m_x, m_y; // LL x,y window location on the map (map coords)
  45. fixed_t m_x2, m_y2; // UR x,y window location on the map (map coords)
  46. //
  47. // width/height of window on map (map coords)
  48. //
  49. fixed_t m_w;
  50. fixed_t m_h;
  51. // based on level size
  52. fixed_t min_x;
  53. fixed_t min_y;
  54. fixed_t max_x;
  55. fixed_t max_y;
  56. fixed_t max_w; // max_x-min_x,
  57. fixed_t max_h; // max_y-min_y
  58. fixed_t min_scale_mtof; // used to tell when to stop zooming out
  59. fixed_t max_scale_mtof; // used to tell when to stop zooming in
  60. // old location used by the Follower routine
  61. mpoint_t f_oldloc;
  62. // used by MTOF to scale from map-to-frame-buffer coords
  63. fixed_t scale_mtof;
  64. // used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
  65. fixed_t scale_ftom;
  66. int lastlevel, lastepisode;
  67. boolean stopped;
  68. fixed_t mtof_zoommul; // how far the window zooms each tic (map coords)
  69. fixed_t ftom_zoommul; // how far the window zooms each tic (fb coords)
  70. //******************************************************************************
  71. //d_client.c
  72. //******************************************************************************
  73. ticcmd_t netcmd;
  74. int maketic;
  75. int lastmadetic;
  76. //******************************************************************************
  77. //d_main.c
  78. //******************************************************************************
  79. // wipegamestate can be set to -1 to force a wipe on the next draw
  80. gamestate_t wipegamestate;
  81. gamestate_t oldgamestate;
  82. int demosequence; // killough 5/2/98: made static
  83. int pagetic;
  84. int pagelump; // CPhipps - const
  85. boolean singletics; // debug flag to cancel adaptiveness
  86. boolean advancedemo;
  87. unsigned int gamma;
  88. //fps counter stuff
  89. unsigned int fps_timebefore;
  90. unsigned int fps_frames;
  91. unsigned int fps_framerate;
  92. boolean fps_show;
  93. //******************************************************************************
  94. //doomstat.c
  95. //******************************************************************************
  96. // Game Mode - identify IWAD as shareware, retail etc.
  97. GameMode_t gamemode;
  98. GameMission_t gamemission;
  99. //******************************************************************************
  100. //f_finale.c
  101. //******************************************************************************
  102. // Stage of animation:
  103. // 0 = text, 1 = art screen, 2 = character cast
  104. int finalestage; // cph -
  105. int finalecount; // made static
  106. const char* finaletext; // cph -
  107. const char* finaleflat; // made static const
  108. int castnum;
  109. int casttics;
  110. const state_t* caststate;
  111. int castframes;
  112. int castonmelee;
  113. int midstage; // whether we're in "mid-stage"
  114. int laststage;
  115. boolean castattacking;
  116. boolean castdeath;
  117. //******************************************************************************
  118. //f_wipe.c
  119. //******************************************************************************
  120. short y_lookup[SCREENWIDTH];
  121. //******************************************************************************
  122. //g_game.c
  123. //******************************************************************************
  124. const byte *demobuffer; /* cph - only used for playback */
  125. int demolength; // check for overrun (missing DEMOMARKER)
  126. const byte *demo_p;
  127. gameaction_t gameaction;
  128. gamestate_t gamestate;
  129. skill_t gameskill;
  130. int gameepisode;
  131. int gamemap;
  132. player_t player;
  133. int starttime; // for comparative timing purposes
  134. int gametic;
  135. int basetic; /* killough 9/29/98: for demo sync */
  136. int totalkills, totallive, totalitems, totalsecret; // for intermission
  137. int demover;
  138. wbstartstruct_t wminfo; // parms for world map / intermission
  139. int totalleveltimes; // CPhipps - total time for all completed levels
  140. int longtics;
  141. // CPhipps - made lots of key/button state vars static
  142. boolean gamekeydown[NUMKEYS];
  143. int turnheld; // for accelerative turning
  144. // Game events info
  145. buttoncode_t special_event; // Event triggered by local player, to send
  146. gamestate_t prevgamestate;
  147. skill_t d_skill;
  148. int d_episode;
  149. int d_map;
  150. byte savegameslot; // Slot to load if gameaction == ga_loadgame
  151. boolean secretexit;
  152. boolean respawnmonsters;
  153. // CPhipps - moved *_loadgame vars here
  154. boolean command_loadgame;
  155. boolean usergame; // ok to save / end game
  156. boolean timingdemo; // if true, exit with report on completion
  157. boolean playeringame;
  158. boolean demoplayback;
  159. boolean singledemo; // quit after playing a demo from cmdline
  160. boolean haswolflevels;// jff 4/18/98 wolf levels present
  161. //******************************************************************************
  162. //hu_stuff.c
  163. //******************************************************************************
  164. // font sets
  165. const patch_t* hu_font[HU_FONTSIZE];
  166. // widgets
  167. hu_textline_t w_title;
  168. hu_stext_t w_message;
  169. int message_counter;
  170. boolean message_on;
  171. boolean message_dontfuckwithme;
  172. boolean headsupactive;
  173. //******************************************************************************
  174. //i_audio.c
  175. //******************************************************************************
  176. boolean sound_inited;
  177. unsigned int music_looping;
  178. unsigned int music_volume;
  179. unsigned int music_init;
  180. int lasttimereply;
  181. int basetime;
  182. //******************************************************************************
  183. //i_video.c
  184. //******************************************************************************
  185. const unsigned char* current_pallete;
  186. const unsigned char* pallete_lump;
  187. int newpal;
  188. //******************************************************************************
  189. //m_cheat.c
  190. //******************************************************************************
  191. unsigned int cheat_buffer;
  192. //******************************************************************************
  193. //m_menu.c
  194. //******************************************************************************
  195. //
  196. // defaulted values
  197. //
  198. int showMessages; // Show messages has default, 0 = off, 1 = on
  199. int alwaysRun;
  200. int messageToPrint; // 1 = message to be printed
  201. // CPhipps - static const
  202. const char* messageString; // ...and here is the message string!
  203. int messageLastMenuActive;
  204. int saveSlot; // which slot to save in
  205. // old save description before edit
  206. const menu_t* currentMenu; // current menudef
  207. int epi;
  208. short itemOn; // menu item skull is on (for Big Font menus)
  209. short skullAnimCounter; // skull animation counter
  210. short whichSkull; // which skull to draw (he blinks)
  211. boolean menuactive; // The menus are up
  212. boolean messageNeedsInput; // timed message = no input from user
  213. char savegamestrings[8][8];
  214. //******************************************************************************
  215. //m_random.c
  216. //******************************************************************************
  217. int rndindex;
  218. int prndindex;
  219. //******************************************************************************
  220. //p_ceiling.c
  221. //******************************************************************************
  222. // the list of ceilings moving currently, including crushers
  223. ceilinglist_t *activeceilings;
  224. //******************************************************************************
  225. //p_enemy.c
  226. //******************************************************************************
  227. mobj_t *current_actor;
  228. fixed_t dropoff_deltax, dropoff_deltay, floorz;
  229. int current_allaround;
  230. mobj_t* corpsehit;
  231. fixed_t viletryx;
  232. fixed_t viletryy;
  233. // killough 2/7/98: Remove limit on icon landings:
  234. mobj_t **braintargets;
  235. int numbraintargets_alloc;
  236. int numbraintargets;
  237. brain_t brain; // killough 3/26/98: global state of boss brain
  238. //******************************************************************************
  239. //p_map.c
  240. //******************************************************************************
  241. /* killough 8/2/98: for more intelligent autoaiming */
  242. uint_64_t aim_flags_mask;
  243. mobj_t *tmthing;
  244. fixed_t tmx;
  245. fixed_t tmy;
  246. int pe_x; // Pain Elemental position for Lost Soul checks // phares
  247. int pe_y; // Pain Elemental position for Lost Soul checks // phares
  248. int ls_x; // Lost Soul position for Lost Soul checks // phares
  249. int ls_y; // Lost Soul position for Lost Soul checks // phares
  250. // The tm* items are used to hold information globally, usually for
  251. // line or object intersection checking
  252. fixed_t tmbbox[4]; // bounding box for line intersection checks
  253. fixed_t tmfloorz; // floor you'd hit if free to fall
  254. fixed_t tmceilingz; // ceiling of sector you're in
  255. fixed_t tmdropoffz; // dropoff on other side of line you're crossing
  256. // keep track of the line that lowers the ceiling,
  257. // so missiles don't explode against sky hack walls
  258. const line_t *ceilingline;
  259. const line_t *blockline; /* killough 8/11/98: blocking linedef */
  260. const line_t *floorline; /* killough 8/1/98: Highest touched floor */
  261. int tmunstuck; /* killough 8/1/98: whether to allow unsticking */
  262. // keep track of special lines as they are hit,
  263. // but don't process them until the move is proven valid
  264. // 1/11/98 killough: removed limit on special lines crossed
  265. const line_t *spechit[4]; // new code -- killough
  266. int numspechit;
  267. // Temporary holder for thing_sectorlist threads
  268. msecnode_t* sector_list; // phares 3/16/98
  269. /* killough 8/2/98: make variables static */
  270. fixed_t bestslidefrac;
  271. const line_t* bestslideline;
  272. mobj_t* slidemo;
  273. fixed_t tmxmove;
  274. fixed_t tmymove;
  275. mobj_t* linetarget; // who got hit (or NULL)
  276. mobj_t* shootthing;
  277. // Height if not aiming up or down
  278. fixed_t shootz;
  279. int la_damage;
  280. fixed_t attackrange;
  281. fixed_t aimslope;
  282. // slopes to top and bottom of target
  283. // killough 4/20/98: make static instead of using ones in p_sight.c
  284. fixed_t topslope;
  285. fixed_t bottomslope;
  286. mobj_t *bombsource, *bombspot;
  287. int bombdamage;
  288. mobj_t* usething;
  289. // If "floatok" true, move would be ok
  290. // if within "tmfloorz - tmceilingz".
  291. boolean floatok;
  292. /* killough 11/98: if "felldown" true, object was pushed down ledge */
  293. boolean felldown;
  294. boolean crushchange, nofit;
  295. boolean telefrag; /* killough 8/9/98: whether to telefrag at exit */
  296. //******************************************************************************
  297. //p_maputl.c
  298. //******************************************************************************
  299. fixed_t opentop;
  300. fixed_t openbottom;
  301. fixed_t openrange;
  302. fixed_t lowfloor;
  303. // moved front and back outside P-LineOpening and changed // phares 3/7/98
  304. // them to these so we can pick up the new friction value
  305. // in PIT_CheckLine()
  306. sector_t *openfrontsector; // made global // phares
  307. sector_t *openbacksector; // made global
  308. divline_t trace;
  309. // 1/11/98 killough: Intercept limit removed
  310. intercept_t intercepts[MAXINTERCEPTS];
  311. intercept_t* intercept_p;
  312. //******************************************************************************
  313. //p_mobj.c
  314. //******************************************************************************
  315. //******************************************************************************
  316. //p_plats.c
  317. //******************************************************************************
  318. platlist_t *activeplats; // killough 2/14/98: made global again
  319. //******************************************************************************
  320. //p_pspr.c
  321. //******************************************************************************
  322. fixed_t bulletslope;
  323. //******************************************************************************
  324. //p_setup.c
  325. //******************************************************************************
  326. //
  327. // MAP related Lookup tables.
  328. // Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
  329. //
  330. int numvertexes;
  331. const vertex_t *vertexes;
  332. int numsegs;
  333. const seg_t *segs;
  334. int numsectors;
  335. sector_t *sectors;
  336. int numsubsectors;
  337. subsector_t *subsectors;
  338. int numlines;
  339. const line_t *lines;
  340. linedata_t* linedata;
  341. int numsides;
  342. side_t *sides;
  343. // BLOCKMAP
  344. // Created from axis aligned bounding box
  345. // of the map, a rectangular array of
  346. // blocks of size ...
  347. // Used to speed up collision detection
  348. // by spatial subdivision in 2D.
  349. //
  350. // Blockmap size.
  351. int bmapwidth, bmapheight; // size in mapblocks
  352. // killough 3/1/98: remove blockmap limit internally:
  353. const short *blockmap; // was short -- killough
  354. // offsets in blockmap are from here
  355. const short *blockmaplump; // was short -- killough
  356. fixed_t bmaporgx, bmaporgy; // origin of block map
  357. mobj_t **blocklinks; // for thing chains
  358. //
  359. // REJECT
  360. // For fast sight rejection.
  361. // Speeds up enemy AI by skipping detailed
  362. // LineOf Sight calculation.
  363. // Without the special effect, this could
  364. // be used as a PVS lookup as well.
  365. //
  366. int rejectlump;// cph - store reject lump num if cached
  367. const byte *rejectmatrix; // cph - const*
  368. // Maintain single and multi player starting spots.
  369. mapthing_t playerstarts[MAXPLAYERS];
  370. //******************************************************************************
  371. //p_sight.c
  372. //******************************************************************************
  373. los_t los; // cph - made static
  374. //******************************************************************************
  375. //p_spec.c
  376. //******************************************************************************
  377. anim_t* lastanim;
  378. anim_t anims[MAXANIMS];
  379. pusher_t* tmpusher; // pusher structure for blockmap searches
  380. //******************************************************************************
  381. //p_switch.c
  382. //******************************************************************************
  383. short switchlist[MAXSWITCHES * 2];
  384. int numswitches; // killough
  385. button_t buttonlist[MAXBUTTONS];
  386. //******************************************************************************
  387. //p_tick.c
  388. //******************************************************************************
  389. int leveltime; // tics in game play for par
  390. // killough 8/29/98: we maintain several separate threads, each containing
  391. // a special class of thinkers, to allow more efficient searches.
  392. thinker_t thinkerclasscap[th_all+1];
  393. //******************************************************************************
  394. //p_user.c
  395. //******************************************************************************
  396. boolean onground; // whether player is on ground or in air
  397. //******************************************************************************
  398. //r_bsp.c
  399. //******************************************************************************
  400. //******************************************************************************
  401. //r_data.c
  402. //******************************************************************************
  403. int firstflat, lastflat, numflats;
  404. int firstspritelump, lastspritelump, numspritelumps;
  405. int numtextures;
  406. //Store last lookup and return that if they match.
  407. const char* tex_lookup_last_name;
  408. int tex_lookup_last_num;
  409. //******************************************************************************
  410. //r_draw.c
  411. //******************************************************************************
  412. int fuzzpos;
  413. //******************************************************************************
  414. //r_draw.c
  415. //******************************************************************************
  416. unsigned short validcount; // increment every time a check is made
  417. player_t *viewplayer;
  418. // killough 3/20/98, 4/4/98: end dynamic colormaps
  419. //******************************************************************************
  420. //r_patch.c
  421. //******************************************************************************
  422. //******************************************************************************
  423. //r_plane.c
  424. //******************************************************************************
  425. visplane_t *visplanes[MAXVISPLANES]; // killough
  426. visplane_t *freetail; // killough
  427. visplane_t **freehead; // killough
  428. // Clip values are the solid pixel bounding the range.
  429. // floorclip starts out SCREENHEIGHT
  430. // ceilingclip starts out -1
  431. // killough 2/8/98: make variables static
  432. //******************************************************************************
  433. //r_segs.c
  434. //******************************************************************************
  435. //
  436. // regular wall
  437. //
  438. drawseg_t drawsegs[MAXDRAWSEGS];
  439. short openings[MAXOPENINGS];
  440. short* lastopening;
  441. //******************************************************************************
  442. //r_sky.c
  443. //******************************************************************************
  444. //
  445. // sky mapping
  446. //
  447. int skyflatnum;
  448. int skytexture;
  449. //******************************************************************************
  450. //r_things.c
  451. //******************************************************************************
  452. // variables used to look up and range check thing_t sprites patches
  453. spritedef_t *sprites;
  454. int numsprites;
  455. spriteframe_t sprtemp[MAX_SPRITE_FRAMES];
  456. int maxframe;
  457. vissprite_t vissprites[MAXVISSPRITES];
  458. vissprite_t* vissprite_ptrs[MAXVISSPRITES*2]; // killough
  459. //******************************************************************************
  460. //s_sound.c
  461. //******************************************************************************
  462. // the set of channels available
  463. channel_t *channels;
  464. // These are not used, but should be (menu).
  465. // Maximum volume of a sound effect.
  466. // Internal default is max out of 0-15.
  467. int snd_SfxVolume;
  468. // Maximum volume of music. Useless so far.
  469. int snd_MusicVolume;
  470. // music currently being played
  471. int mus_playing;
  472. //jff 3/17/98 to keep track of last IDMUS specified music num
  473. int idmusnum;
  474. // whether songs are mus_paused
  475. boolean mus_paused;
  476. //******************************************************************************
  477. //st_stuff.c
  478. //******************************************************************************
  479. // main player in game
  480. player_t *plyr;
  481. unsigned int st_needrefresh;
  482. // 0-9, tall numbers
  483. const patch_t* tallnum[10];
  484. // 0-9, short, yellow (,different!) numbers
  485. const patch_t* shortnum[10];
  486. // tall % sign
  487. const patch_t* tallpercent;
  488. const patch_t* keys[NUMCARDS];
  489. // face status patches
  490. const patch_t* faces[ST_NUMFACES];
  491. //e6y: status bar background
  492. const patch_t* stbarbg;
  493. unsigned int stbar_len;
  494. // weapon ownership patches
  495. const patch_t* arms[6][2];
  496. // ready-weapon widget
  497. st_number_t w_ready;
  498. // health widget
  499. st_percent_t st_health;
  500. // weapon ownership widgets
  501. st_multicon_t w_arms[6];
  502. // face status widget
  503. st_multicon_t w_faces;
  504. // keycard widgets
  505. st_multicon_t w_keyboxes[3];
  506. // ammo widgets
  507. st_number_t w_ammo[4];
  508. // max ammo widgets
  509. st_number_t w_maxammo[4];
  510. // armor widget
  511. st_percent_t st_armor;
  512. // used to use appopriately pained face
  513. int st_oldhealth;
  514. // used for evil grin
  515. boolean oldweaponsowned[NUMWEAPONS];
  516. // count until face changes
  517. int st_facecount;
  518. // current face index, used by w_faces
  519. int st_faceindex;
  520. // holds key-type for each key box on bar
  521. int keyboxes[3];
  522. // a random number per tick
  523. int st_randomnumber;
  524. int st_palette;
  525. // whether left-side main status bar is active
  526. boolean st_statusbaron;
  527. //******************************************************************************
  528. //v_video.c
  529. //******************************************************************************
  530. // Each screen is [SCREENWIDTH*SCREENHEIGHT];
  531. screeninfo_t screens[NUM_SCREENS];
  532. //******************************************************************************
  533. //w_wad.c
  534. //******************************************************************************
  535. int numlumps; // killough
  536. //******************************************************************************
  537. //wi_stuff.c
  538. //******************************************************************************
  539. // used to accelerate or skip a stage
  540. int acceleratestage; // killough 3/28/98: made global
  541. // wbs->pnum
  542. int me;
  543. // specifies current state
  544. stateenum_t state;
  545. // contains information passed into intermission
  546. wbstartstruct_t* wbs;
  547. wbplayerstruct_t* plrs; // wbs->plyr[]
  548. // used for general timing
  549. int cnt;
  550. // used for timing of background animation
  551. int bcnt;
  552. int cnt_time;
  553. int cnt_total_time;
  554. int cnt_par;
  555. int cnt_pause;
  556. // 0-9 graphic
  557. const patch_t* num[10];
  558. int sp_state;
  559. int cnt_kills;
  560. int cnt_items;
  561. int cnt_secret;
  562. boolean snl_pointeron;
  563. //******************************************************************************
  564. #endif // GLOBAL_DEFS_H
  565. } globals_t;
  566. void InitGlobals();
  567. extern globals_t* _g;
  568. #endif // GLOBAL_DATA_H