world.qc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. /* Copyright (C) 1996-1997 Id Software, Inc.
  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() InitBodyQue;
  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. InitBodyQue ();
  153. // custom map attributes
  154. if (self.model == "maps/e1m8.bsp")
  155. cvar_set ("sv_gravity", "100");
  156. else
  157. cvar_set ("sv_gravity", "800");
  158. // the area based ambient sounds MUST be the first precache_sounds
  159. // player precaches
  160. W_Precache (); // get weapon precaches
  161. // sounds used from C physics code
  162. precache_sound ("demon/dland2.wav"); // landing thud
  163. precache_sound ("misc/h2ohit1.wav"); // landing splash
  164. // setup precaches allways needed
  165. precache_sound ("items/itembk2.wav"); // item respawn sound
  166. precache_sound ("player/plyrjmp8.wav"); // player jump
  167. precache_sound ("player/land.wav"); // player landing
  168. precache_sound ("player/land2.wav"); // player hurt landing
  169. precache_sound ("player/drown1.wav"); // drowning pain
  170. precache_sound ("player/drown2.wav"); // drowning pain
  171. precache_sound ("player/gasp1.wav"); // gasping for air
  172. precache_sound ("player/gasp2.wav"); // taking breath
  173. precache_sound ("player/h2odeath.wav"); // drowning death
  174. precache_sound ("misc/talk.wav"); // talk
  175. precache_sound ("player/teledth1.wav"); // telefrag
  176. precache_sound ("misc/r_tele1.wav"); // teleport sounds
  177. precache_sound ("misc/r_tele2.wav");
  178. precache_sound ("misc/r_tele3.wav");
  179. precache_sound ("misc/r_tele4.wav");
  180. precache_sound ("misc/r_tele5.wav");
  181. precache_sound ("weapons/lock4.wav"); // ammo pick up
  182. precache_sound ("weapons/pkup.wav"); // weapon up
  183. precache_sound ("items/armor1.wav"); // armor up
  184. precache_sound ("weapons/lhit.wav"); //lightning
  185. precache_sound ("weapons/lstart.wav"); //lightning start
  186. precache_sound ("items/damage3.wav");
  187. precache_sound ("misc/power.wav"); //lightning for boss
  188. // player gib sounds
  189. precache_sound ("player/gib.wav"); // player gib sound
  190. precache_sound ("player/udeath.wav"); // player gib sound
  191. precache_sound ("player/tornoff2.wav"); // gib sound
  192. // player pain sounds
  193. precache_sound ("player/pain1.wav");
  194. precache_sound ("player/pain2.wav");
  195. precache_sound ("player/pain3.wav");
  196. precache_sound ("player/pain4.wav");
  197. precache_sound ("player/pain5.wav");
  198. precache_sound ("player/pain6.wav");
  199. // player death sounds
  200. precache_sound ("player/death1.wav");
  201. precache_sound ("player/death2.wav");
  202. precache_sound ("player/death3.wav");
  203. precache_sound ("player/death4.wav");
  204. precache_sound ("player/death5.wav");
  205. // ax sounds
  206. precache_sound ("weapons/ax1.wav"); // ax swoosh
  207. precache_sound ("player/axhit1.wav"); // ax hit meat
  208. precache_sound ("player/axhit2.wav"); // ax hit world
  209. precache_sound ("player/h2ojump.wav"); // player jumping into water
  210. precache_sound ("player/slimbrn2.wav"); // player enter slime
  211. precache_sound ("player/inh2o.wav"); // player enter water
  212. precache_sound ("player/inlava.wav"); // player enter lava
  213. precache_sound ("misc/outwater.wav"); // leaving water sound
  214. precache_sound ("player/lburn1.wav"); // lava burn
  215. precache_sound ("player/lburn2.wav"); // lava burn
  216. precache_sound ("misc/water1.wav"); // swimming
  217. precache_sound ("misc/water2.wav"); // swimming
  218. precache_model ("progs/player.mdl");
  219. precache_model ("progs/eyes.mdl");
  220. precache_model ("progs/h_player.mdl");
  221. precache_model ("progs/gib1.mdl");
  222. precache_model ("progs/gib2.mdl");
  223. precache_model ("progs/gib3.mdl");
  224. precache_model ("progs/s_bubble.spr"); // drowning bubbles
  225. precache_model ("progs/s_explod.spr"); // sprite explosion
  226. precache_model ("progs/v_axe.mdl");
  227. precache_model ("progs/v_shot.mdl");
  228. precache_model ("progs/v_nail.mdl");
  229. precache_model ("progs/v_rock.mdl");
  230. precache_model ("progs/v_shot2.mdl");
  231. precache_model ("progs/v_nail2.mdl");
  232. precache_model ("progs/v_rock2.mdl");
  233. precache_model ("progs/bolt.mdl"); // for lightning gun
  234. precache_model ("progs/bolt2.mdl"); // for lightning gun
  235. precache_model ("progs/bolt3.mdl"); // for boss shock
  236. precache_model ("progs/lavaball.mdl"); // for testing
  237. precache_model ("progs/missile.mdl");
  238. precache_model ("progs/grenade.mdl");
  239. precache_model ("progs/spike.mdl");
  240. precache_model ("progs/s_spike.mdl");
  241. precache_model ("progs/backpack.mdl");
  242. precache_model ("progs/zom_gib.mdl");
  243. precache_model ("progs/v_light.mdl");
  244. //
  245. // Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
  246. //
  247. // 0 normal
  248. lightstyle(0, "m");
  249. // 1 FLICKER (first variety)
  250. lightstyle(1, "mmnmmommommnonmmonqnmmo");
  251. // 2 SLOW STRONG PULSE
  252. lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
  253. // 3 CANDLE (first variety)
  254. lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
  255. // 4 FAST STROBE
  256. lightstyle(4, "mamamamamama");
  257. // 5 GENTLE PULSE 1
  258. lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
  259. // 6 FLICKER (second variety)
  260. lightstyle(6, "nmonqnmomnmomomno");
  261. // 7 CANDLE (second variety)
  262. lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
  263. // 8 CANDLE (third variety)
  264. lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
  265. // 9 SLOW STROBE (fourth variety)
  266. lightstyle(9, "aaaaaaaazzzzzzzz");
  267. // 10 FLUORESCENT FLICKER
  268. lightstyle(10, "mmamammmmammamamaaamammma");
  269. // 11 SLOW PULSE NOT FADE TO BLACK
  270. lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
  271. // styles 32-62 are assigned by the light program for switchable lights
  272. // 63 testing
  273. lightstyle(63, "a");
  274. };
  275. void() StartFrame =
  276. {
  277. teamplay = cvar("teamplay");
  278. skill = cvar("skill");
  279. framecount = framecount + 1;
  280. };
  281. /*
  282. ==============================================================================
  283. BODY QUE
  284. ==============================================================================
  285. */
  286. entity bodyque_head;
  287. void() bodyque =
  288. { // just here so spawn functions don't complain after the world
  289. // creates bodyques
  290. };
  291. void() InitBodyQue =
  292. {
  293. local entity e;
  294. bodyque_head = spawn();
  295. bodyque_head.classname = "bodyque";
  296. bodyque_head.owner = spawn();
  297. bodyque_head.owner.classname = "bodyque";
  298. bodyque_head.owner.owner = spawn();
  299. bodyque_head.owner.owner.classname = "bodyque";
  300. bodyque_head.owner.owner.owner = spawn();
  301. bodyque_head.owner.owner.owner.classname = "bodyque";
  302. bodyque_head.owner.owner.owner.owner = bodyque_head;
  303. };
  304. // make a body que entry for the given ent so the ent can be
  305. // respawned elsewhere
  306. void(entity ent) CopyToBodyQue =
  307. {
  308. bodyque_head.angles = ent.angles;
  309. bodyque_head.model = ent.model;
  310. bodyque_head.modelindex = ent.modelindex;
  311. bodyque_head.frame = ent.frame;
  312. bodyque_head.colormap = ent.colormap;
  313. bodyque_head.movetype = ent.movetype;
  314. bodyque_head.velocity = ent.velocity;
  315. bodyque_head.flags = 0;
  316. setorigin (bodyque_head, ent.origin);
  317. setsize (bodyque_head, ent.mins, ent.maxs);
  318. bodyque_head = bodyque_head.owner;
  319. };