world.qc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /* Copyright (C) 1996-2022 id Software LLC
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. void() InitBodyQueue;
  16. void() main =
  17. {
  18. dprint ("main function\n");
  19. // these are just commands the the prog compiler to copy these files
  20. precache_file ("progs.dat");
  21. precache_file ("gfx.wad");
  22. precache_file ("quake.rc");
  23. precache_file ("default.cfg");
  24. precache_file ("end1.bin");
  25. precache_file2 ("end2.bin");
  26. precache_file ("demo1.dem");
  27. precache_file ("demo2.dem");
  28. precache_file ("demo3.dem");
  29. //
  30. // these are all of the lumps from the cached.ls files
  31. //
  32. precache_file ("gfx/palette.lmp");
  33. precache_file ("gfx/colormap.lmp");
  34. precache_file2 ("gfx/pop.lmp");
  35. precache_file ("gfx/complete.lmp");
  36. precache_file ("gfx/inter.lmp");
  37. precache_file ("gfx/ranking.lmp");
  38. precache_file ("gfx/vidmodes.lmp");
  39. precache_file ("gfx/finale.lmp");
  40. precache_file ("gfx/conback.lmp");
  41. precache_file ("gfx/qplaque.lmp");
  42. precache_file ("gfx/menudot1.lmp");
  43. precache_file ("gfx/menudot2.lmp");
  44. precache_file ("gfx/menudot3.lmp");
  45. precache_file ("gfx/menudot4.lmp");
  46. precache_file ("gfx/menudot5.lmp");
  47. precache_file ("gfx/menudot6.lmp");
  48. precache_file ("gfx/menuplyr.lmp");
  49. precache_file ("gfx/bigbox.lmp");
  50. precache_file ("gfx/dim_modm.lmp");
  51. precache_file ("gfx/dim_drct.lmp");
  52. precache_file ("gfx/dim_ipx.lmp");
  53. precache_file ("gfx/dim_tcp.lmp");
  54. precache_file ("gfx/dim_mult.lmp");
  55. precache_file ("gfx/mainmenu.lmp");
  56. precache_file ("gfx/box_tl.lmp");
  57. precache_file ("gfx/box_tm.lmp");
  58. precache_file ("gfx/box_tr.lmp");
  59. precache_file ("gfx/box_ml.lmp");
  60. precache_file ("gfx/box_mm.lmp");
  61. precache_file ("gfx/box_mm2.lmp");
  62. precache_file ("gfx/box_mr.lmp");
  63. precache_file ("gfx/box_bl.lmp");
  64. precache_file ("gfx/box_bm.lmp");
  65. precache_file ("gfx/box_br.lmp");
  66. precache_file ("gfx/sp_menu.lmp");
  67. precache_file ("gfx/ttl_sgl.lmp");
  68. precache_file ("gfx/ttl_main.lmp");
  69. precache_file ("gfx/ttl_cstm.lmp");
  70. precache_file ("gfx/mp_menu.lmp");
  71. precache_file ("gfx/netmen1.lmp");
  72. precache_file ("gfx/netmen2.lmp");
  73. precache_file ("gfx/netmen3.lmp");
  74. precache_file ("gfx/netmen4.lmp");
  75. precache_file ("gfx/netmen5.lmp");
  76. precache_file ("gfx/sell.lmp");
  77. precache_file ("gfx/help0.lmp");
  78. precache_file ("gfx/help1.lmp");
  79. precache_file ("gfx/help2.lmp");
  80. precache_file ("gfx/help3.lmp");
  81. precache_file ("gfx/help4.lmp");
  82. precache_file ("gfx/help5.lmp");
  83. precache_file ("gfx/pause.lmp");
  84. precache_file ("gfx/loading.lmp");
  85. precache_file ("gfx/p_option.lmp");
  86. precache_file ("gfx/p_load.lmp");
  87. precache_file ("gfx/p_save.lmp");
  88. precache_file ("gfx/p_multi.lmp");
  89. // sounds loaded by C code
  90. precache_sound ("misc/menu1.wav");
  91. precache_sound ("misc/menu2.wav");
  92. precache_sound ("misc/menu3.wav");
  93. precache_sound ("ambience/water1.wav");
  94. precache_sound ("ambience/wind2.wav");
  95. // shareware
  96. precache_file ("maps/start.bsp");
  97. precache_file ("maps/e1m1.bsp");
  98. precache_file ("maps/e1m2.bsp");
  99. precache_file ("maps/e1m3.bsp");
  100. precache_file ("maps/e1m4.bsp");
  101. precache_file ("maps/e1m5.bsp");
  102. precache_file ("maps/e1m6.bsp");
  103. precache_file ("maps/e1m7.bsp");
  104. precache_file ("maps/e1m8.bsp");
  105. // registered
  106. precache_file2 ("gfx/pop.lmp");
  107. precache_file2 ("maps/e2m1.bsp");
  108. precache_file2 ("maps/e2m2.bsp");
  109. precache_file2 ("maps/e2m3.bsp");
  110. precache_file2 ("maps/e2m4.bsp");
  111. precache_file2 ("maps/e2m5.bsp");
  112. precache_file2 ("maps/e2m6.bsp");
  113. precache_file2 ("maps/e2m7.bsp");
  114. precache_file2 ("maps/e3m1.bsp");
  115. precache_file2 ("maps/e3m2.bsp");
  116. precache_file2 ("maps/e3m3.bsp");
  117. precache_file2 ("maps/e3m4.bsp");
  118. precache_file2 ("maps/e3m5.bsp");
  119. precache_file2 ("maps/e3m6.bsp");
  120. precache_file2 ("maps/e3m7.bsp");
  121. precache_file2 ("maps/e4m1.bsp");
  122. precache_file2 ("maps/e4m2.bsp");
  123. precache_file2 ("maps/e4m3.bsp");
  124. precache_file2 ("maps/e4m4.bsp");
  125. precache_file2 ("maps/e4m5.bsp");
  126. precache_file2 ("maps/e4m6.bsp");
  127. precache_file2 ("maps/e4m7.bsp");
  128. precache_file2 ("maps/e4m8.bsp");
  129. precache_file2 ("maps/end.bsp");
  130. precache_file2 ("maps/dm1.bsp");
  131. precache_file2 ("maps/dm2.bsp");
  132. precache_file2 ("maps/dm3.bsp");
  133. precache_file2 ("maps/dm4.bsp");
  134. precache_file2 ("maps/dm5.bsp");
  135. precache_file2 ("maps/dm6.bsp");
  136. };
  137. entity lastspawn;
  138. //=======================
  139. /*QUAKED worldspawn (0 0 0) ?
  140. Only used for the world entity.
  141. Set message to the level name.
  142. Set sounds to the cd track to play.
  143. World Types:
  144. 0: medieval
  145. 1: metal
  146. 2: base
  147. */
  148. //=======================
  149. void() worldspawn =
  150. {
  151. lastspawn = world;
  152. runespawn = world;
  153. runespawned = 0;
  154. InitBodyQueue ();
  155. // custom map attributes
  156. if (self.model == "maps/e1m8.bsp")
  157. cvar_set ("sv_gravity", "100");
  158. else
  159. cvar_set ("sv_gravity", "800");
  160. // the area based ambient sounds MUST be the first precache_sounds
  161. // player precaches
  162. W_Precache (); // get weapon precaches
  163. // sounds used from C physics code
  164. precache_sound ("demon/dland2.wav"); // landing thud
  165. precache_sound ("misc/h2ohit1.wav"); // landing splash
  166. // setup precaches allways needed
  167. precache_sound ("items/itembk2.wav"); // item respawn sound
  168. precache_sound ("player/plyrjmp8.wav"); // player jump
  169. precache_sound ("player/land.wav"); // player landing
  170. precache_sound ("player/land2.wav"); // player hurt landing
  171. precache_sound ("player/drown1.wav"); // drowning pain
  172. precache_sound ("player/drown2.wav"); // drowning pain
  173. precache_sound ("player/gasp1.wav"); // gasping for air
  174. precache_sound ("player/gasp2.wav"); // taking breath
  175. precache_sound ("player/h2odeath.wav"); // drowning death
  176. precache_sound ("misc/talk.wav"); // talk
  177. precache_sound ("player/teledth1.wav"); // telefrag
  178. precache_sound ("misc/r_tele1.wav"); // teleport sounds
  179. precache_sound ("misc/r_tele2.wav");
  180. precache_sound ("misc/r_tele3.wav");
  181. precache_sound ("misc/r_tele4.wav");
  182. precache_sound ("misc/r_tele5.wav");
  183. precache_sound ("weapons/lock4.wav"); // ammo pick up
  184. precache_sound ("weapons/pkup.wav"); // weapon up
  185. precache_sound ("items/armor1.wav"); // armor up
  186. precache_sound ("weapons/lhit.wav"); //lightning
  187. precache_sound ("weapons/lstart.wav"); //lightning start
  188. precache_sound ("items/damage3.wav");
  189. precache_sound ("misc/power.wav"); //lightning for boss
  190. // player gib sounds
  191. precache_sound ("player/gib.wav"); // player gib sound
  192. precache_sound ("player/udeath.wav"); // player gib sound
  193. precache_sound ("player/tornoff2.wav"); // gib sound
  194. // player pain sounds
  195. precache_sound ("player/pain1.wav");
  196. precache_sound ("player/pain2.wav");
  197. precache_sound ("player/pain3.wav");
  198. precache_sound ("player/pain4.wav");
  199. precache_sound ("player/pain5.wav");
  200. precache_sound ("player/pain6.wav");
  201. // player death sounds
  202. precache_sound ("player/death1.wav");
  203. precache_sound ("player/death2.wav");
  204. precache_sound ("player/death3.wav");
  205. precache_sound ("player/death4.wav");
  206. precache_sound ("player/death5.wav");
  207. // ax sounds
  208. precache_sound ("weapons/ax1.wav"); // ax swoosh
  209. precache_sound ("player/axhit1.wav"); // ax hit meat
  210. precache_sound ("player/axhit2.wav"); // ax hit world
  211. precache_sound ("hknight/hit.wav"); // ZOID: hook launch
  212. precache_sound ("player/h2ojump.wav"); // player jumping into water
  213. precache_sound ("player/slimbrn2.wav"); // player enter slime
  214. precache_sound ("player/inh2o.wav"); // player enter water
  215. precache_sound ("player/inlava.wav"); // player enter lava
  216. precache_sound ("misc/outwater.wav"); // leaving water sound
  217. precache_sound ("player/lburn1.wav"); // lava burn
  218. precache_sound ("player/lburn2.wav"); // lava burn
  219. precache_sound ("misc/water1.wav"); // swimming
  220. precache_sound ("misc/water2.wav"); // swimming
  221. precache_model ("progs/player.mdl");
  222. precache_model ("progs/eyes.mdl");
  223. precache_model ("progs/h_player.mdl");
  224. precache_model ("progs/gib1.mdl");
  225. precache_model ("progs/gib2.mdl");
  226. precache_model ("progs/gib3.mdl");
  227. precache_model ("progs/s_bubble.spr"); // drowning bubbles
  228. precache_model ("progs/s_explod.spr"); // sprite explosion
  229. precache_model ("progs/v_axe.mdl");
  230. precache_model ("progs/v_shot.mdl");
  231. precache_model ("progs/v_nail.mdl");
  232. precache_model ("progs/v_rock.mdl");
  233. precache_model ("progs/v_shot2.mdl");
  234. precache_model ("progs/v_nail2.mdl");
  235. precache_model ("progs/v_rock2.mdl");
  236. precache_model ("progs/bolt.mdl"); // for lightning gun
  237. precache_model ("progs/bolt2.mdl"); // for lightning gun
  238. precache_model ("progs/bolt3.mdl"); // for boss shock
  239. precache_model ("progs/lavaball.mdl"); // for testing
  240. precache_model ("progs/missile.mdl");
  241. precache_model ("progs/grenade.mdl");
  242. precache_model ("progs/spike.mdl");
  243. precache_model ("progs/s_spike.mdl");
  244. // for hook
  245. precache_model ("progs/beam.mdl");
  246. precache_model ("progs/star.mdl");
  247. precache_model ("progs/v_star.mdl");
  248. precache_model ("progs/backpack.mdl");
  249. precache_model ("progs/zom_gib.mdl");
  250. precache_model ("progs/v_light.mdl");
  251. //
  252. // Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
  253. //
  254. // 0 normal
  255. lightstyle(0, "m");
  256. // 1 FLICKER (first variety)
  257. lightstyle(1, "mmnmmommommnonmmonqnmmo");
  258. // 2 SLOW STRONG PULSE
  259. lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
  260. // 3 CANDLE (first variety)
  261. lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
  262. // 4 FAST STROBE
  263. lightstyle(4, "mamamamamama");
  264. // 5 GENTLE PULSE 1
  265. lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
  266. // 6 FLICKER (second variety)
  267. lightstyle(6, "nmonqnmomnmomomno");
  268. // 7 CANDLE (second variety)
  269. lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
  270. // 8 CANDLE (third variety)
  271. lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
  272. // 9 SLOW STROBE (fourth variety)
  273. lightstyle(9, "aaaaaaaazzzzzzzz");
  274. // 10 FLUORESCENT FLICKER
  275. lightstyle(10, "mmamammmmammamamaaamammma");
  276. // 11 SLOW PULSE NOT FADE TO BLACK
  277. lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
  278. // styles 32-62 are assigned by the light program for switchable lights
  279. // 63 testing
  280. lightstyle(63, "a");
  281. };
  282. void StartFrame() {
  283. teamplay = cvar("teamplay");
  284. skill = cvar("skill");
  285. cheats_allowed = cvar("sv_cheats");
  286. framecount = framecount + 1;
  287. };
  288. /*
  289. ==============================================================================
  290. BODY QUE
  291. ==============================================================================
  292. */
  293. entity bodyqueue_head;
  294. void() bodyqueue =
  295. { // just here so spawn functions don't complain after the world
  296. // creates bodyqueues
  297. };
  298. void() InitBodyQueue =
  299. {
  300. bodyqueue_head = spawn();
  301. bodyqueue_head.classname = "bodyqueue";
  302. bodyqueue_head.owner = spawn();
  303. bodyqueue_head.owner.classname = "bodyqueue";
  304. bodyqueue_head.owner.owner = spawn();
  305. bodyqueue_head.owner.owner.classname = "bodyqueue";
  306. bodyqueue_head.owner.owner.owner = spawn();
  307. bodyqueue_head.owner.owner.owner.classname = "bodyqueue";
  308. bodyqueue_head.owner.owner.owner.owner = bodyqueue_head;
  309. };
  310. // make a body que entry for the given ent so the ent can be
  311. // respawned elsewhere
  312. void(entity ent) CopyToBodyQueue =
  313. {
  314. bodyqueue_head.angles = ent.angles;
  315. bodyqueue_head.model = ent.model;
  316. bodyqueue_head.modelindex = ent.modelindex;
  317. bodyqueue_head.frame = ent.frame;
  318. bodyqueue_head.colormap = ent.colormap;
  319. bodyqueue_head.movetype = ent.movetype;
  320. bodyqueue_head.velocity = ent.velocity;
  321. bodyqueue_head.flags = 0;
  322. setorigin (bodyqueue_head, ent.origin);
  323. setsize (bodyqueue_head, ent.mins, ent.maxs);
  324. bodyqueue_head = bodyqueue_head.owner;
  325. };