world.qc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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() 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. RunePrecache(); // precache the runes
  162. // sounds used from C physics code
  163. precache_sound ("demon/dland2.wav"); // landing thud
  164. precache_sound ("misc/h2ohit1.wav"); // landing splash
  165. // setup precaches allways needed
  166. precache_sound ("items/itembk2.wav"); // item respawn sound
  167. precache_sound ("player/plyrjmp8.wav"); // player jump
  168. precache_sound ("player/land.wav"); // player landing
  169. precache_sound ("player/land2.wav"); // player hurt landing
  170. precache_sound ("player/drown1.wav"); // drowning pain
  171. precache_sound ("player/drown2.wav"); // drowning pain
  172. precache_sound ("player/gasp1.wav"); // gasping for air
  173. precache_sound ("player/gasp2.wav"); // taking breath
  174. precache_sound ("player/h2odeath.wav"); // drowning death
  175. precache_sound ("misc/talk.wav"); // talk
  176. precache_sound ("player/teledth1.wav"); // telefrag
  177. precache_sound ("misc/r_tele1.wav"); // teleport sounds
  178. precache_sound ("misc/r_tele2.wav");
  179. precache_sound ("misc/r_tele3.wav");
  180. precache_sound ("misc/r_tele4.wav");
  181. precache_sound ("misc/r_tele5.wav");
  182. precache_sound ("weapons/lock4.wav"); // ammo pick up
  183. precache_sound ("weapons/pkup.wav"); // weapon up
  184. precache_sound ("items/armor1.wav"); // armor up
  185. precache_sound ("weapons/lhit.wav"); //lightning
  186. precache_sound ("weapons/lstart.wav"); //lightning start
  187. precache_sound ("items/damage3.wav");
  188. precache_sound ("misc/power.wav"); //lightning for boss
  189. // player gib sounds
  190. precache_sound ("player/gib.wav"); // player gib sound
  191. precache_sound ("player/udeath.wav"); // player gib sound
  192. precache_sound ("player/tornoff2.wav"); // gib sound
  193. // player pain sounds
  194. precache_sound ("player/pain1.wav");
  195. precache_sound ("player/pain2.wav");
  196. precache_sound ("player/pain3.wav");
  197. precache_sound ("player/pain4.wav");
  198. precache_sound ("player/pain5.wav");
  199. precache_sound ("player/pain6.wav");
  200. // player death sounds
  201. precache_sound ("player/death1.wav");
  202. precache_sound ("player/death2.wav");
  203. precache_sound ("player/death3.wav");
  204. precache_sound ("player/death4.wav");
  205. precache_sound ("player/death5.wav");
  206. // ax sounds
  207. precache_sound ("weapons/ax1.wav"); // ax swoosh
  208. precache_sound ("player/axhit1.wav"); // ax hit meat
  209. precache_sound ("player/axhit2.wav"); // ax hit world
  210. precache_sound ("player/h2ojump.wav"); // player jumping into water
  211. precache_sound ("player/slimbrn2.wav"); // player enter slime
  212. precache_sound ("player/inh2o.wav"); // player enter water
  213. precache_sound ("player/inlava.wav"); // player enter lava
  214. precache_sound ("misc/outwater.wav"); // leaving water sound
  215. precache_sound ("player/lburn1.wav"); // lava burn
  216. precache_sound ("player/lburn2.wav"); // lava burn
  217. precache_sound ("misc/water1.wav"); // swimming
  218. precache_sound ("misc/water2.wav"); // swimming
  219. // PGM Addition Sounds
  220. precache_sound ("enforcer/enfstop.wav"); // shield impact
  221. precache_sound ("plasma/explode.wav");
  222. precache_sound ("plasma/flight.wav");
  223. precache_sound ("plasma/fire.wav");
  224. precache_sound ("shield/hit.wav");
  225. precache_sound ("belt/use.wav");
  226. precache_sound ("items/damage2.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. // Lava Gun models - pgm change
  243. precache_model ("progs/v_lava.mdl");
  244. precache_model ("progs/v_lava2.mdl");
  245. precache_model ("progs/v_multi.mdl");
  246. precache_model ("progs/v_multi2.mdl");
  247. precache_model ("progs/bolt.mdl"); // for lightning gun
  248. precache_model ("progs/bolt2.mdl"); // for lightning gun
  249. precache_model ("progs/bolt3.mdl"); // for boss shock
  250. precache_model ("progs/lavaball.mdl"); // for testing
  251. precache_model ("progs/missile.mdl");
  252. precache_model ("progs/grenade.mdl");
  253. precache_model ("progs/spike.mdl");
  254. precache_model ("progs/s_spike.mdl");
  255. // PGM addition
  256. precache_model ("progs/mervup.mdl");
  257. precache_model ("progs/rockup.mdl");
  258. precache_model ("progs/rockup_d.mdl");
  259. precache_model ("progs/lspike.mdl");
  260. precache_model ("progs/shield.mdl");
  261. precache_model ("progs/p_shield.mdl");
  262. precache_model ("progs/backpack.mdl");
  263. precache_model ("progs/zom_gib.mdl");
  264. precache_model ("progs/v_light.mdl");
  265. precache_model ("progs/plasma.mdl");
  266. precache_model ("progs/v_plasma.mdl");
  267. //ZOID--
  268. // hook for CTF
  269. precache_model ("progs/hook.mdl");
  270. precache_model ("progs/v_grpple.mdl");
  271. // precache_model ("progs/bit.mdl");
  272. //--ZOID
  273. //
  274. // Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
  275. //
  276. // 0 normal
  277. lightstyle(0, "m");
  278. // 1 FLICKER (first variety)
  279. lightstyle(1, "mmnmmommommnonmmonqnmmo");
  280. // 2 SLOW STRONG PULSE
  281. lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
  282. // 3 CANDLE (first variety)
  283. lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
  284. // 4 FAST STROBE
  285. lightstyle(4, "mamamamamama");
  286. // 5 GENTLE PULSE 1
  287. lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
  288. // 6 FLICKER (second variety)
  289. lightstyle(6, "nmonqnmomnmomomno");
  290. // 7 CANDLE (second variety)
  291. lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
  292. // 8 CANDLE (third variety)
  293. lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
  294. // 9 SLOW STROBE (fourth variety)
  295. lightstyle(9, "aaaaaaaazzzzzzzz");
  296. // 10 FLUORESCENT FLICKER
  297. lightstyle(10, "mmamammmmammamamaaamammma");
  298. // 11 SLOW PULSE NOT FADE TO BLACK
  299. lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
  300. // styles 32-62 are assigned by the light program for switchable lights
  301. // 63 testing
  302. lightstyle(63, "a");
  303. };
  304. void() StartFrame =
  305. {
  306. teamplay = cvar("teamplay");
  307. skill = cvar("skill");
  308. cheats_allowed = cvar("sv_cheats");
  309. // save off a global here so it gets included in savegames
  310. if (!campaign_valid) {
  311. campaign_valid = TRUE;
  312. campaign = cvar("campaign");
  313. } else {
  314. cvar_set("campaign", ftos(campaign));
  315. }
  316. framecount = framecount + 1;
  317. };
  318. /*
  319. ==============================================================================
  320. BODY QUE
  321. ==============================================================================
  322. */
  323. entity bodyque_head;
  324. void() bodyque =
  325. { // just here so spawn functions don't complain after the world
  326. // creates bodyques
  327. };
  328. void() InitBodyQue =
  329. {
  330. local entity e;
  331. bodyque_head = spawn();
  332. bodyque_head.classname = "bodyque";
  333. bodyque_head.owner = spawn();
  334. bodyque_head.owner.classname = "bodyque";
  335. bodyque_head.owner.owner = spawn();
  336. bodyque_head.owner.owner.classname = "bodyque";
  337. bodyque_head.owner.owner.owner = spawn();
  338. bodyque_head.owner.owner.owner.classname = "bodyque";
  339. bodyque_head.owner.owner.owner.owner = bodyque_head;
  340. };
  341. // make a body que entry for the given ent so the ent can be
  342. // respawned elsewhere
  343. void(entity ent) CopyToBodyQue =
  344. {
  345. // PGM - support for new deathmatch skins on corpses too!
  346. bodyque_head.skin = ent.skin;
  347. bodyque_head.angles = ent.angles;
  348. bodyque_head.model = ent.model;
  349. bodyque_head.modelindex = ent.modelindex;
  350. bodyque_head.frame = ent.frame;
  351. bodyque_head.colormap = ent.colormap;
  352. bodyque_head.movetype = ent.movetype;
  353. bodyque_head.velocity = ent.velocity;
  354. bodyque_head.flags = 0;
  355. setorigin (bodyque_head, ent.origin);
  356. setsize (bodyque_head, ent.mins, ent.maxs);
  357. bodyque_head = bodyque_head.owner;
  358. };