Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.30 KB | None | 0 0
  1. /*
  2. world.qc
  3.  
  4. main/world setup functions
  5.  
  6. Copyright (C) 1996-1997 Id Software, Inc.
  7.  
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16.  
  17. See the GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to:
  21.  
  22. Free Software Foundation, Inc.
  23. 59 Temple Place - Suite 330
  24. Boston, MA 02111-1307, USA
  25.  
  26. */
  27.  
  28. void() InitBodyQue;
  29.  
  30. void() main =
  31. {
  32. dprint ("main function\n");
  33.  
  34. // these are just commands the the prog compiler to copy these files
  35.  
  36. precache_file ("progs.dat");
  37. precache_file ("gfx.wad");
  38. precache_file ("quake.rc");
  39. precache_file ("default.cfg");
  40.  
  41. precache_file ("end1.bin");
  42. precache_file2 ("end2.bin");
  43.  
  44. precache_file ("demo1.dem");
  45. precache_file ("demo2.dem");
  46. precache_file ("demo3.dem");
  47.  
  48. //
  49. // these are all of the lumps from the cached.ls files
  50. //
  51. precache_file ("gfx/palette.lmp");
  52. precache_file ("gfx/colormap.lmp");
  53.  
  54. precache_file2 ("gfx/pop.lmp");
  55.  
  56. precache_file ("gfx/complete.lmp");
  57. precache_file ("gfx/inter.lmp");
  58.  
  59. precache_file ("gfx/ranking.lmp");
  60. precache_file ("gfx/vidmodes.lmp");
  61. precache_file ("gfx/finale.lmp");
  62. precache_file ("gfx/conback.lmp");
  63. precache_file ("gfx/qplaque.lmp");
  64.  
  65. precache_file ("gfx/menudot1.lmp");
  66. precache_file ("gfx/menudot2.lmp");
  67. precache_file ("gfx/menudot3.lmp");
  68. precache_file ("gfx/menudot4.lmp");
  69. precache_file ("gfx/menudot5.lmp");
  70. precache_file ("gfx/menudot6.lmp");
  71.  
  72. precache_file ("gfx/menuplyr.lmp");
  73. precache_file ("gfx/bigbox.lmp");
  74. precache_file ("gfx/dim_modm.lmp");
  75. precache_file ("gfx/dim_drct.lmp");
  76. precache_file ("gfx/dim_ipx.lmp");
  77. precache_file ("gfx/dim_tcp.lmp");
  78. precache_file ("gfx/dim_mult.lmp");
  79. precache_file ("gfx/mainmenu.lmp");
  80.  
  81. precache_file ("gfx/box_tl.lmp");
  82. precache_file ("gfx/box_tm.lmp");
  83. precache_file ("gfx/box_tr.lmp");
  84.  
  85. precache_file ("gfx/box_ml.lmp");
  86. precache_file ("gfx/box_mm.lmp");
  87. precache_file ("gfx/box_mm2.lmp");
  88. precache_file ("gfx/box_mr.lmp");
  89.  
  90. precache_file ("gfx/box_bl.lmp");
  91. precache_file ("gfx/box_bm.lmp");
  92. precache_file ("gfx/box_br.lmp");
  93.  
  94. precache_file ("gfx/sp_menu.lmp");
  95. precache_file ("gfx/ttl_sgl.lmp");
  96. precache_file ("gfx/ttl_main.lmp");
  97. precache_file ("gfx/ttl_cstm.lmp");
  98.  
  99. precache_file ("gfx/mp_menu.lmp");
  100.  
  101. precache_file ("gfx/netmen1.lmp");
  102. precache_file ("gfx/netmen2.lmp");
  103. precache_file ("gfx/netmen3.lmp");
  104. precache_file ("gfx/netmen4.lmp");
  105. precache_file ("gfx/netmen5.lmp");
  106.  
  107. precache_file ("gfx/sell.lmp");
  108.  
  109. precache_file ("gfx/help0.lmp");
  110. precache_file ("gfx/help1.lmp");
  111. precache_file ("gfx/help2.lmp");
  112. precache_file ("gfx/help3.lmp");
  113. precache_file ("gfx/help4.lmp");
  114. precache_file ("gfx/help5.lmp");
  115.  
  116. precache_file ("gfx/pause.lmp");
  117. precache_file ("gfx/loading.lmp");
  118.  
  119. precache_file ("gfx/p_option.lmp");
  120. precache_file ("gfx/p_load.lmp");
  121. precache_file ("gfx/p_save.lmp");
  122. precache_file ("gfx/p_multi.lmp");
  123.  
  124. // sounds loaded by C code
  125. precache_sound ("misc/menu1.wav");
  126. precache_sound ("misc/menu2.wav");
  127. precache_sound ("misc/menu3.wav");
  128.  
  129. precache_sound ("ambience/water1.wav");
  130. precache_sound ("ambience/wind2.wav");
  131.  
  132. // shareware
  133. precache_file ("maps/start.bsp");
  134.  
  135. precache_file ("maps/e1m1.bsp");
  136. precache_file ("maps/e1m2.bsp");
  137. precache_file ("maps/e1m3.bsp");
  138. precache_file ("maps/e1m4.bsp");
  139. precache_file ("maps/e1m5.bsp");
  140. precache_file ("maps/e1m6.bsp");
  141. precache_file ("maps/e1m7.bsp");
  142. precache_file ("maps/e1m8.bsp");
  143.  
  144. // registered
  145. precache_file2 ("gfx/pop.lmp");
  146.  
  147. precache_file2 ("maps/e2m1.bsp");
  148. precache_file2 ("maps/e2m2.bsp");
  149. precache_file2 ("maps/e2m3.bsp");
  150. precache_file2 ("maps/e2m4.bsp");
  151. precache_file2 ("maps/e2m5.bsp");
  152. precache_file2 ("maps/e2m6.bsp");
  153. precache_file2 ("maps/e2m7.bsp");
  154.  
  155. precache_file2 ("maps/e3m1.bsp");
  156. precache_file2 ("maps/e3m2.bsp");
  157. precache_file2 ("maps/e3m3.bsp");
  158. precache_file2 ("maps/e3m4.bsp");
  159. precache_file2 ("maps/e3m5.bsp");
  160. precache_file2 ("maps/e3m6.bsp");
  161. precache_file2 ("maps/e3m7.bsp");
  162.  
  163. precache_file2 ("maps/e4m1.bsp");
  164. precache_file2 ("maps/e4m2.bsp");
  165. precache_file2 ("maps/e4m3.bsp");
  166. precache_file2 ("maps/e4m4.bsp");
  167. precache_file2 ("maps/e4m5.bsp");
  168. precache_file2 ("maps/e4m6.bsp");
  169. precache_file2 ("maps/e4m7.bsp");
  170. precache_file2 ("maps/e4m8.bsp");
  171.  
  172. precache_file2 ("maps/end.bsp");
  173.  
  174. precache_file2 ("maps/dm1.bsp");
  175. precache_file2 ("maps/dm2.bsp");
  176. precache_file2 ("maps/dm3.bsp");
  177. precache_file2 ("maps/dm4.bsp");
  178. precache_file2 ("maps/dm5.bsp");
  179. precache_file2 ("maps/dm6.bsp");
  180. };
  181.  
  182.  
  183. entity lastspawn;
  184.  
  185. float() GetPlayerCount = {
  186. local entity plr;
  187. local float num;
  188.  
  189. num = 0;
  190. plr = find( world, classname, "player" );
  191. while ( plr != world ) {
  192. num = num + 1;
  193. plr = find( plr, classname, "player" );
  194. }
  195. return num;
  196. }
  197.  
  198. void() ToggleQuad =
  199. {
  200. local entity quad;
  201.  
  202. if ( GetPlayerCount() < stof( infokey( world, "players_for_quad" ) ) ) {
  203. if ( !quadToggledOff ) {
  204. quad = find( world, classname, "item_artifact_super_damage" );
  205. while ( quad != world ) {
  206. quad.solid = SOLID_NOT;
  207. quad.model = string_null;
  208. quad = find( quad, classname, "item_artifact_super_damage" );
  209. }
  210. quad = find( world, model, "progs/quaddama.mdl" );
  211. if ( quad )
  212. remove( quad );
  213. quadToggledOff = 1;
  214. bprint( PRINT_HIGH, "Quad disabled!\n" );
  215. }
  216. } else {
  217. if ( quadToggledOff ) {
  218. quad = find( world, classname, "item_artifact_super_damage" );
  219. while ( quad != world ) {
  220. quad.solid = SOLID_TRIGGER;
  221. setmodel (quad, "progs/quaddama.mdl");
  222. quad = find( quad, classname, "item_artifact_super_damage" );
  223. }
  224. quadToggledOff = 0;
  225. bprint( PRINT_HIGH, "Quad enabled!\n" );
  226. }
  227. }
  228. };
  229.  
  230. //=======================
  231. /*QUAKED worldspawn (0 0 0) ?
  232. Only used for the world entity.
  233. Set message to the level name.
  234. Set sounds to the cd track to play.
  235.  
  236. World Types:
  237. 0: medieval
  238. 1: metal
  239. 2: base
  240. */
  241. //=======================
  242. void() worldspawn =
  243. {
  244. lastspawn = world;
  245. InitBodyQue ();
  246.  
  247. // custom map attributes
  248.  
  249. if (self.model == "maps/e1m8.bsp")
  250. cvar_set ("sv_gravity", "100");
  251. else
  252. cvar_set ("sv_gravity", "800");
  253.  
  254.  
  255. // the area based ambient sounds MUST be the first precache_sounds
  256.  
  257. // player precaches
  258. W_Precache (); // get weapon precaches
  259.  
  260. // sounds used from C physics code
  261. precache_sound ("demon/dland2.wav"); // landing thud
  262. precache_sound ("misc/h2ohit1.wav"); // landing splash
  263.  
  264. // setup precaches allways needed
  265. precache_sound ("items/itembk2.wav"); // item respawn sound
  266. precache_sound ("player/plyrjmp8.wav"); // player jump
  267. precache_sound ("player/land.wav"); // player landing
  268. precache_sound ("player/land2.wav"); // player hurt landing
  269. precache_sound ("player/drown1.wav"); // drowning pain
  270. precache_sound ("player/drown2.wav"); // drowning pain
  271. precache_sound ("player/gasp1.wav"); // gasping for air
  272. precache_sound ("player/gasp2.wav"); // taking breath
  273. precache_sound ("player/h2odeath.wav"); // drowning death
  274.  
  275. precache_sound ("misc/talk.wav"); // talk
  276. precache_sound ("player/teledth1.wav"); // telefrag
  277. precache_sound ("misc/r_tele1.wav"); // teleport sounds
  278. precache_sound ("misc/r_tele2.wav");
  279. precache_sound ("misc/r_tele3.wav");
  280. precache_sound ("misc/r_tele4.wav");
  281. precache_sound ("misc/r_tele5.wav");
  282. precache_sound ("weapons/lock4.wav"); // ammo pick up
  283. precache_sound ("weapons/pkup.wav"); // weapon up
  284. precache_sound ("items/armor1.wav"); // armor up
  285. precache_sound ("weapons/lhit.wav"); //lightning
  286. precache_sound ("weapons/lstart.wav"); //lightning start
  287. precache_sound ("items/damage3.wav");
  288.  
  289. precache_sound ("misc/power.wav"); //lightning for boss
  290.  
  291. // player gib sounds
  292. precache_sound ("player/gib.wav"); // player gib sound
  293. precache_sound ("player/udeath.wav"); // player gib sound
  294. precache_sound ("player/tornoff2.wav"); // gib sound
  295.  
  296. // player pain sounds
  297.  
  298. precache_sound ("player/pain1.wav");
  299. precache_sound ("player/pain2.wav");
  300. precache_sound ("player/pain3.wav");
  301. precache_sound ("player/pain4.wav");
  302. precache_sound ("player/pain5.wav");
  303. precache_sound ("player/pain6.wav");
  304.  
  305. // player death sounds
  306. precache_sound ("player/death1.wav");
  307. precache_sound ("player/death2.wav");
  308. precache_sound ("player/death3.wav");
  309. precache_sound ("player/death4.wav");
  310. precache_sound ("player/death5.wav");
  311.  
  312. precache_sound ("boss1/sight1.wav");
  313.  
  314. // ax sounds
  315. precache_sound ("weapons/ax1.wav"); // ax swoosh
  316. precache_sound ("player/axhit1.wav"); // ax hit meat
  317. precache_sound ("player/axhit2.wav"); // ax hit world
  318.  
  319. precache_sound ("player/h2ojump.wav"); // player jumping into water
  320. precache_sound ("player/slimbrn2.wav"); // player enter slime
  321. precache_sound ("player/inh2o.wav"); // player enter water
  322. precache_sound ("player/inlava.wav"); // player enter lava
  323. precache_sound ("misc/outwater.wav"); // leaving water sound
  324.  
  325. precache_sound ("player/lburn1.wav"); // lava burn
  326. precache_sound ("player/lburn2.wav"); // lava burn
  327.  
  328. precache_sound ("misc/water1.wav"); // swimming
  329. precache_sound ("misc/water2.wav"); // swimming
  330.  
  331. // Invulnerability sounds
  332. precache_sound ("items/protect.wav");
  333. precache_sound ("items/protect2.wav");
  334. precache_sound ("items/protect3.wav");
  335.  
  336.  
  337. precache_model ("progs/player.mdl");
  338. precache_model ("progs/eyes.mdl");
  339. precache_model ("progs/h_player.mdl");
  340. precache_model ("progs/gib1.mdl");
  341. precache_model ("progs/gib2.mdl");
  342. precache_model ("progs/gib3.mdl");
  343.  
  344. precache_model ("progs/s_bubble.spr"); // drowning bubbles
  345. precache_model ("progs/s_explod.spr"); // sprite explosion
  346.  
  347. precache_model ("progs/v_axe.mdl");
  348. precache_model ("progs/v_shot.mdl");
  349. precache_model ("progs/v_nail.mdl");
  350. precache_model ("progs/v_rock.mdl");
  351. precache_model ("progs/v_shot2.mdl");
  352. precache_model ("progs/v_nail2.mdl");
  353. precache_model ("progs/v_rock2.mdl");
  354.  
  355. precache_model ("progs/bolt.mdl"); // for lightning gun
  356. precache_model ("progs/bolt2.mdl"); // for lightning gun
  357. precache_model ("progs/bolt3.mdl"); // for boss shock
  358. precache_model ("progs/lavaball.mdl"); // for testing
  359.  
  360. precache_model ("progs/missile.mdl");
  361. precache_model ("progs/grenade.mdl");
  362. precache_model ("progs/spike.mdl");
  363. precache_model ("progs/s_spike.mdl");
  364.  
  365. precache_model ("progs/backpack.mdl");
  366.  
  367. precache_model ("progs/zom_gib.mdl");
  368.  
  369. precache_model ("progs/v_light.mdl");
  370.  
  371.  
  372. //
  373. // Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
  374. //
  375.  
  376. // 0 normal
  377. lightstyle(0, "m");
  378.  
  379. // 1 FLICKER (first variety)
  380. lightstyle(1, "mmnmmommommnonmmonqnmmo");
  381.  
  382. // 2 SLOW STRONG PULSE
  383. lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
  384.  
  385. // 3 CANDLE (first variety)
  386. lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
  387.  
  388. // 4 FAST STROBE
  389. lightstyle(4, "mamamamamama");
  390.  
  391. // 5 GENTLE PULSE 1
  392. lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
  393.  
  394. // 6 FLICKER (second variety)
  395. lightstyle(6, "nmonqnmomnmomomno");
  396.  
  397. // 7 CANDLE (second variety)
  398. lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
  399.  
  400. // 8 CANDLE (third variety)
  401. lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
  402.  
  403. // 9 SLOW STROBE (fourth variety)
  404. lightstyle(9, "aaaaaaaazzzzzzzz");
  405.  
  406. // 10 FLUORESCENT FLICKER
  407. lightstyle(10, "mmamammmmammamamaaamammma");
  408.  
  409. // 11 SLOW PULSE NOT FADE TO BLACK
  410. lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
  411.  
  412. // styles 32-62 are assigned by the light program for switchable lights
  413.  
  414. // 63 testing
  415. lightstyle(63, "a");
  416.  
  417. fodffa_mapcycle_init();
  418.  
  419. quadToggledOff = 0;
  420. };
  421.  
  422.  
  423.  
  424. void() StartFrame =
  425. {
  426. local string tlname;
  427. local float value;
  428. local string keystring;
  429.  
  430. if (!fodffa_inited)
  431. {
  432. fodffa_init();
  433. fodffa_inited = 1;
  434. }
  435.  
  436. timelimit = cvar("timelimit") * 60;
  437. fraglimit = cvar("fraglimit");
  438. teamplay = cvar("teamplay");
  439. deathmatch = cvar("deathmatch");
  440.  
  441. ToggleQuad();
  442.  
  443. framecount = framecount + 1;
  444.  
  445. tlname = fodffa_newstr(fodffa_strcat(mapname, "timelimit"), 0);
  446. keystring = infokey(world, tlname);
  447. value = stof(keystring);
  448. if (value)
  449. timelimit = value*60;
  450.  
  451. fodffa_freestr(tlname);
  452.  
  453. fodffa_checktimeleft();
  454.  
  455. if (time >= 5 && !votescounted)
  456. fodffa_countvotes();
  457. };
  458.  
  459. /*
  460. ==============================================================================
  461.  
  462. BODY QUE
  463.  
  464. ==============================================================================
  465. */
  466.  
  467. entity bodyque_head;
  468.  
  469. void() bodyque =
  470. { // just here so spawn functions don't complain after the world
  471. // creates bodyques
  472. };
  473.  
  474. void() InitBodyQue =
  475. {
  476. local entity e;
  477.  
  478. bodyque_head = spawn();
  479. bodyque_head.classname = "bodyque";
  480. bodyque_head.owner = spawn();
  481. bodyque_head.owner.classname = "bodyque";
  482. bodyque_head.owner.owner = spawn();
  483. bodyque_head.owner.owner.classname = "bodyque";
  484. bodyque_head.owner.owner.owner = spawn();
  485. bodyque_head.owner.owner.owner.classname = "bodyque";
  486. bodyque_head.owner.owner.owner.owner = bodyque_head;
  487. };
  488.  
  489.  
  490. // make a body que entry for the given ent so the ent can be
  491. // respawned elsewhere
  492. void(entity ent) CopyToBodyQue =
  493. {
  494. bodyque_head.angles = ent.angles;
  495. bodyque_head.model = ent.model;
  496. bodyque_head.modelindex = ent.modelindex;
  497. bodyque_head.frame = ent.frame;
  498. bodyque_head.colormap = ent.colormap;
  499. bodyque_head.movetype = ent.movetype;
  500. bodyque_head.velocity = ent.velocity;
  501. bodyque_head.flags = 0;
  502. setorigin (bodyque_head, ent.origin);
  503. setsize (bodyque_head, ent.mins, ent.maxs);
  504. bodyque_head = bodyque_head.owner;
  505. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement