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

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