world.qc 12 KB

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