home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qplus11 / world.qc < prev    next >
Encoding:
Text File  |  1996-08-27  |  11.3 KB  |  409 lines

  1. void() InitBodyQue;
  2. void() DropCorpse;    //ws
  3.  
  4. void() main =
  5. {
  6.     dprint ("main function\n");
  7.     
  8. // these are just commands the the prog compiler to copy these files
  9.  
  10.     precache_file ("progs.dat");
  11.     precache_file ("gfx.wad");
  12.     precache_file ("quake.rc");
  13.     precache_file ("default.cfg");
  14.  
  15.     precache_file ("end1.bin");
  16.     precache_file2 ("end2.bin");
  17.  
  18.     precache_file ("demo1.dem");
  19.     precache_file ("demo2.dem");
  20.     precache_file ("demo3.dem");
  21.  
  22. //
  23. // these are all of the lumps from the cached.ls files
  24. //
  25.     precache_file ("gfx/palette.lmp");
  26.     precache_file ("gfx/colormap.lmp");
  27.  
  28.     precache_file2 ("gfx/pop.lmp");
  29.  
  30.     precache_file ("gfx/complete.lmp");
  31.     precache_file ("gfx/inter.lmp");
  32.  
  33.     precache_file ("gfx/ranking.lmp");
  34.     precache_file ("gfx/vidmodes.lmp");
  35.     precache_file ("gfx/finale.lmp");
  36.     precache_file ("gfx/conback.lmp");
  37.     precache_file ("gfx/qplaque.lmp");
  38.  
  39.     precache_file ("gfx/menudot1.lmp");
  40.     precache_file ("gfx/menudot2.lmp");
  41.     precache_file ("gfx/menudot3.lmp");
  42.     precache_file ("gfx/menudot4.lmp");
  43.     precache_file ("gfx/menudot5.lmp");
  44.     precache_file ("gfx/menudot6.lmp");
  45.  
  46.     precache_file ("gfx/menuplyr.lmp");
  47.     precache_file ("gfx/bigbox.lmp");
  48.     precache_file ("gfx/dim_modm.lmp");
  49.     precache_file ("gfx/dim_drct.lmp");
  50.     precache_file ("gfx/dim_ipx.lmp");
  51.     precache_file ("gfx/dim_tcp.lmp");
  52.     precache_file ("gfx/dim_mult.lmp");
  53.     precache_file ("gfx/mainmenu.lmp");
  54.     
  55.     precache_file ("gfx/box_tl.lmp");
  56.     precache_file ("gfx/box_tm.lmp");
  57.     precache_file ("gfx/box_tr.lmp");
  58.     
  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.     
  64.     precache_file ("gfx/box_bl.lmp");
  65.     precache_file ("gfx/box_bm.lmp");
  66.     precache_file ("gfx/box_br.lmp");
  67.     
  68.     precache_file ("gfx/sp_menu.lmp");
  69.     precache_file ("gfx/ttl_sgl.lmp");
  70.     precache_file ("gfx/ttl_main.lmp");
  71.     precache_file ("gfx/ttl_cstm.lmp");
  72.     
  73.     precache_file ("gfx/mp_menu.lmp");
  74.     
  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.     
  81.     precache_file ("gfx/sell.lmp");
  82.     
  83.     precache_file ("gfx/help0.lmp");
  84.     precache_file ("gfx/help1.lmp");
  85.     precache_file ("gfx/help2.lmp");
  86.     precache_file ("gfx/help3.lmp");
  87.     precache_file ("gfx/help4.lmp");
  88.     precache_file ("gfx/help5.lmp");
  89.  
  90.     precache_file ("gfx/pause.lmp");
  91.     precache_file ("gfx/loading.lmp");
  92.  
  93.     precache_file ("gfx/p_option.lmp");
  94.     precache_file ("gfx/p_load.lmp");
  95.     precache_file ("gfx/p_save.lmp");
  96.     precache_file ("gfx/p_multi.lmp");
  97.  
  98. // sounds loaded by C code
  99.     precache_sound ("misc/menu1.wav");
  100.     precache_sound ("misc/menu2.wav");
  101.     precache_sound ("misc/menu3.wav");
  102.  
  103.     precache_sound ("ambience/water1.wav");
  104.     precache_sound ("ambience/wind2.wav");
  105.  
  106. // shareware
  107.     precache_file ("maps/start.bsp");
  108.  
  109.     precache_file ("maps/e1m1.bsp");
  110.     precache_file ("maps/e1m2.bsp");
  111.     precache_file ("maps/e1m3.bsp");
  112.     precache_file ("maps/e1m4.bsp");
  113.     precache_file ("maps/e1m5.bsp");
  114.     precache_file ("maps/e1m6.bsp");
  115.     precache_file ("maps/e1m7.bsp");
  116.     precache_file ("maps/e1m8.bsp");
  117.  
  118. // registered
  119.     precache_file2 ("gfx/pop.lmp");
  120.  
  121.     precache_file2 ("maps/e2m1.bsp");
  122.     precache_file2 ("maps/e2m2.bsp");
  123.     precache_file2 ("maps/e2m3.bsp");
  124.     precache_file2 ("maps/e2m4.bsp");
  125.     precache_file2 ("maps/e2m5.bsp");
  126.     precache_file2 ("maps/e2m6.bsp");
  127.     precache_file2 ("maps/e2m7.bsp");
  128.  
  129.     precache_file2 ("maps/e3m1.bsp");
  130.     precache_file2 ("maps/e3m2.bsp");
  131.     precache_file2 ("maps/e3m3.bsp");
  132.     precache_file2 ("maps/e3m4.bsp");
  133.     precache_file2 ("maps/e3m5.bsp");
  134.     precache_file2 ("maps/e3m6.bsp");
  135.     precache_file2 ("maps/e3m7.bsp");
  136.  
  137.     precache_file2 ("maps/e4m1.bsp");
  138.     precache_file2 ("maps/e4m2.bsp");
  139.     precache_file2 ("maps/e4m3.bsp");
  140.     precache_file2 ("maps/e4m4.bsp");
  141.     precache_file2 ("maps/e4m5.bsp");
  142.     precache_file2 ("maps/e4m6.bsp");
  143.     precache_file2 ("maps/e4m7.bsp");
  144.     precache_file2 ("maps/e4m8.bsp");
  145.  
  146.     precache_file2 ("maps/end.bsp");
  147.  
  148.     precache_file2 ("maps/dm1.bsp");
  149.     precache_file2 ("maps/dm2.bsp");
  150.     precache_file2 ("maps/dm3.bsp");
  151.     precache_file2 ("maps/dm4.bsp");
  152.     precache_file2 ("maps/dm5.bsp");
  153.     precache_file2 ("maps/dm6.bsp");
  154. };
  155.  
  156.  
  157. entity    lastspawn;
  158.  
  159. //=======================
  160. /*QUAKED worldspawn (0 0 0) ?
  161. Only used for the world entity.
  162. Set message to the level name.
  163. Set sounds to the cd track to play.
  164.  
  165. World Types:
  166. 0: medieval
  167. 1: metal
  168. 2: base
  169. */
  170. //=======================
  171. void() worldspawn =
  172. {
  173.     lastspawn = world;
  174.     InitBodyQue ();
  175.  
  176. // custom map attributes
  177.     if (self.model == "maps/e1m8.bsp")
  178.         cvar_set ("sv_gravity", "100");
  179.     else
  180.         cvar_set ("sv_gravity", "800");
  181.  
  182. // the area based ambient sounds MUST be the first precache_sounds
  183.  
  184. // player precaches    
  185.     W_Precache ();            // get weapon precaches
  186.  
  187. // sounds used from C physics code
  188.     precache_sound ("demon/dland2.wav");        // landing thud
  189.     precache_sound ("misc/h2ohit1.wav");        // landing splash
  190.  
  191. // setup precaches allways needed
  192.     precache_sound ("items/itembk2.wav");        // item respawn sound
  193.     precache_sound ("player/plyrjmp8.wav");        // player jump
  194.     precache_sound ("player/land.wav");            // player landing
  195.     precache_sound ("player/land2.wav");        // player hurt landing
  196.     precache_sound ("player/drown1.wav");        // drowning pain
  197.     precache_sound ("player/drown2.wav");        // drowning pain
  198.     precache_sound ("player/gasp1.wav");        // gasping for air
  199.     precache_sound ("player/gasp2.wav");        // taking breath
  200.     precache_sound ("player/h2odeath.wav");        // drowning death
  201.  
  202.     precache_sound ("misc/talk.wav");            // talk
  203.     precache_sound ("player/teledth1.wav");        // telefrag
  204.     precache_sound ("misc/r_tele1.wav");        // teleport sounds
  205.     precache_sound ("misc/r_tele2.wav");
  206.     precache_sound ("misc/r_tele3.wav");
  207.     precache_sound ("misc/r_tele4.wav");
  208.     precache_sound ("misc/r_tele5.wav");
  209.     precache_sound ("weapons/lock4.wav");        // ammo pick up
  210.     precache_sound ("weapons/pkup.wav");        // weapon up
  211.     precache_sound ("items/armor1.wav");        // armor up
  212.     precache_sound ("weapons/lhit.wav");        //lightning
  213.     precache_sound ("weapons/lstart.wav");        //lightning start
  214.     precache_sound ("items/damage3.wav");
  215.  
  216.     precache_sound ("misc/power.wav");            //lightning for boss
  217.  
  218. // player gib sounds
  219.     precache_sound ("player/gib.wav");            // player gib sound
  220.     precache_sound ("player/udeath.wav");        // player gib sound
  221.     precache_sound ("player/tornoff2.wav");        // gib sound
  222.  
  223. // player pain sounds
  224.  
  225.     precache_sound ("player/pain1.wav");
  226.     precache_sound ("player/pain2.wav");
  227.     precache_sound ("player/pain3.wav");
  228.     precache_sound ("player/pain4.wav");
  229.     precache_sound ("player/pain5.wav");
  230.     precache_sound ("player/pain6.wav");
  231.  
  232. // player death sounds
  233.     precache_sound ("player/death1.wav");
  234.     precache_sound ("player/death2.wav");
  235.     precache_sound ("player/death3.wav");
  236.     precache_sound ("player/death4.wav");
  237.     precache_sound ("player/death5.wav");
  238.  
  239. // ax sounds    
  240.     precache_sound ("weapons/ax1.wav");            // ax swoosh
  241.     precache_sound ("player/axhit1.wav");        // ax hit meat
  242.     precache_sound ("player/axhit2.wav");        // ax hit world
  243.  
  244.     precache_sound ("player/h2ojump.wav");        // player jumping into water
  245.     precache_sound ("player/slimbrn2.wav");        // player enter slime
  246.     precache_sound ("player/inh2o.wav");        // player enter water
  247.     precache_sound ("player/inlava.wav");        // player enter lava
  248.     precache_sound ("misc/outwater.wav");        // leaving water sound
  249.  
  250.     precache_sound ("player/lburn1.wav");        // lava burn
  251.     precache_sound ("player/lburn2.wav");        // lava burn
  252.  
  253.     precache_sound ("misc/water1.wav");            // swimming
  254.     precache_sound ("misc/water2.wav");            // swimming
  255.  
  256.     precache_model ("progs/player.mdl");
  257.     precache_model ("progs/eyes.mdl");
  258.     precache_model ("progs/h_player.mdl");
  259.     precache_model ("progs/gib1.mdl");
  260.     precache_model ("progs/gib2.mdl");
  261.     precache_model ("progs/gib3.mdl");
  262.  
  263.     precache_model ("progs/s_bubble.spr");    // drowning bubbles
  264.     precache_model ("progs/s_explod.spr");    // sprite explosion
  265.  
  266.     precache_model ("progs/v_axe.mdl");
  267.     precache_model ("progs/v_shot.mdl");
  268.     precache_model ("progs/v_nail.mdl");
  269.     precache_model ("progs/v_rock.mdl");
  270.     precache_model ("progs/v_shot2.mdl");
  271.     precache_model ("progs/v_nail2.mdl");
  272.     precache_model ("progs/v_rock2.mdl");
  273.  
  274.     precache_model ("progs/bolt.mdl");        // for lightning gun
  275.     precache_model ("progs/bolt2.mdl");        // for lightning gun
  276.     precache_model ("progs/bolt3.mdl");        // for boss shock
  277.     precache_model ("progs/lavaball.mdl");    // for testing
  278.     
  279.     precache_model ("progs/missile.mdl");
  280.     precache_model ("progs/grenade.mdl");
  281.     precache_model ("progs/spike.mdl");
  282.     precache_model ("progs/s_spike.mdl");
  283.  
  284.     precache_model ("progs/backpack.mdl");
  285.  
  286.     precache_model ("progs/zom_gib.mdl");
  287.  
  288.     precache_model ("progs/v_light.mdl");
  289.     
  290.  
  291. //
  292. // Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
  293. //
  294.  
  295.     // 0 normal
  296.     lightstyle(0, "m");
  297.     
  298.     // 1 FLICKER (first variety)
  299.     lightstyle(1, "mmnmmommommnonmmonqnmmo");
  300.     
  301.     // 2 SLOW STRONG PULSE
  302.     lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
  303.     
  304.     // 3 CANDLE (first variety)
  305.     lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
  306.     
  307.     // 4 FAST STROBE
  308.     lightstyle(4, "mamamamamama");
  309.     
  310.     // 5 GENTLE PULSE 1
  311.     lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
  312.     
  313.     // 6 FLICKER (second variety)
  314.     lightstyle(6, "nmonqnmomnmomomno");
  315.     
  316.     // 7 CANDLE (second variety)
  317.     lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
  318.     
  319.     // 8 CANDLE (third variety)
  320.     lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
  321.     
  322.     // 9 SLOW STROBE (fourth variety)
  323.     lightstyle(9, "aaaaaaaazzzzzzzz");
  324.     
  325.     // 10 FLUORESCENT FLICKER
  326.     lightstyle(10, "mmamammmmammamamaaamammma");
  327.  
  328.     // 11 SLOW PULSE NOT FADE TO BLACK
  329.     lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
  330.     
  331.     // styles 32-62 are assigned by the light program for switchable lights
  332.  
  333.     // 63 testing
  334.     lightstyle(63, "a");
  335. };
  336.  
  337. void() StartFrame =
  338. {
  339.     teamplay = cvar("teamplay");
  340.     skill = cvar("skill");
  341.     framecount = framecount + 1;
  342. };
  343.  
  344. /*
  345. ==============================================================================
  346.  
  347. BODY QUE
  348.  
  349. ==============================================================================
  350. */
  351.  
  352. entity    bodyque_head;
  353.  
  354. void() bodyque =
  355. {    // just here so spawn functions don't complain after the world
  356.     // creates bodyques
  357. };
  358.  
  359. void() InitBodyQue =
  360. {
  361.     local entity    e;
  362.     
  363.     bodyque_head = spawn();
  364.     bodyque_head.classname = "bodyque";
  365.     bodyque_head.owner = spawn();
  366.     bodyque_head.owner.classname = "bodyque";
  367.     bodyque_head.owner.owner = spawn();
  368.     bodyque_head.owner.owner.classname = "bodyque";
  369.     bodyque_head.owner.owner.owner = spawn();
  370.     bodyque_head.owner.owner.owner.classname = "bodyque";
  371.     bodyque_head.owner.owner.owner.owner = bodyque_head;
  372. };
  373.  
  374.  
  375. // make a body que entry for the given ent so the ent can be
  376. // respawned elsewhere
  377. void(entity ent) CopyToBodyQue =
  378. {
  379.     bodyque_head.angles = ent.angles;
  380.     bodyque_head.model = ent.model;
  381.     bodyque_head.modelindex = ent.modelindex;
  382.     bodyque_head.frame = ent.frame;
  383.     bodyque_head.colormap = ent.colormap;
  384.     bodyque_head.movetype = ent.movetype;
  385.     bodyque_head.velocity = ent.velocity;
  386.     bodyque_head.flags = 0;
  387.  
  388. //    bodyque_head.skin = ent.skin;        //ws...
  389.     bodyque_head.deadflag = ent.deadflag;
  390.     // If player not gibbed...
  391.     if (ent.health >= -40)
  392.     {
  393.         bodyque_head.health = ent.health;
  394.         bodyque_head.solid = ent.solid;
  395.         bodyque_head.th_pain = ent.th_pain;
  396.         bodyque_head.th_die = ent.th_die;
  397.         bodyque_head.takedamage = ent.takedamage;
  398.         bodyque_head.think = DropCorpse;
  399.     }
  400.  
  401.     setorigin (bodyque_head, ent.origin);
  402.     bodyque_head.mins = ent.mins;
  403.     bodyque_head.maxs = ent.maxs;
  404.     bodyque_head.size = ent.size;
  405.     bodyque_head = bodyque_head.owner;
  406. };                        //...ws
  407.  
  408.  
  409.