home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / jteam092 / jteam092.dif < prev    next >
Encoding:
Text File  |  1996-08-17  |  37.6 KB  |  1,483 lines

  1. diff --context --new-file \quake\mod\v101qc/client.qc ./client.qc
  2. *** /quake/mod/v101qc/client.qc    Wed Jul 24 23:51:22 1996
  3. --- ./client.qc    Sat Aug 17 00:41:56 1996
  4. ***************
  5. *** 1,4 ****
  6. --- 1,21 ----
  7.   
  8. + /*
  9. +     client.qc
  10. +     Originally by ID Software
  11. +     Modified by John Spickes (jspickes@eng.umd.edu) for 
  12. +         The Complete Enhanced Teamplay
  13. +     $Id: CLIENT.QC 1.14 1996/08/17 00:21:40 jspickes Exp $
  14. +     $Log: CLIENT.QC $
  15. +     Revision 1.14  1996/08/17 00:21:40  jspickes
  16. +     Teams now are persistent across level changes.
  17. +     MOTD now uses the .flag entry FL_MOTDVIEWED instead of .motd.
  18. + */
  19.   // prototypes
  20.   void () W_WeaponFrame;
  21.   void() W_SetCurrentAmmo;
  22. ***************
  23. *** 53,58 ****
  24. --- 70,77 ----
  25.       parm7 = self.ammo_cells;
  26.       parm8 = self.weapon;
  27.       parm9 = self.armortype * 100;
  28. + // *TEAMPLAY*
  29. +     parm10 = self.lastteam;    // Save the current team of the player
  30.   };
  31.   
  32.   void() SetNewParms =
  33. ***************
  34. *** 66,71 ****
  35. --- 85,92 ----
  36.       parm6 = 0;
  37.       parm8 = 1;
  38.       parm9 = 0;
  39. + // *TEAMPLAY*
  40. +     parm10 = -1;    // Reset 
  41.   };
  42.   
  43.   void() DecodeLevelParms =
  44. ***************
  45. *** 85,90 ****
  46. --- 106,114 ----
  47.       self.ammo_cells = parm7;
  48.       self.weapon = parm8;
  49.       self.armortype = parm9 * 0.01;
  50. + // *TEAMPLAY*
  51. +     if(TeamColorIsLegal(parm10 - 1))
  52. +         self.lastteam = parm10;
  53.   };
  54.   
  55.   /*
  56. ***************
  57. *** 505,510 ****
  58. --- 529,535 ----
  59.       }
  60.   
  61.       spawn_tdeath (self.origin, self);
  62.   };
  63.   
  64.   
  65. ***************
  66. *** 737,742 ****
  67. --- 762,771 ----
  68.           return;
  69.       }
  70.   
  71. + // *TEAMPLAY*
  72. +     if (coop && TEAM_STRICT_COOP)
  73. +         return;
  74.   // wait for any button down
  75.       if (!self.button2 && !self.button1 && !self.button0)
  76.           return;
  77. ***************
  78. *** 1131,1136 ****
  79. --- 1160,1167 ----
  80.       local    float    mspeed, aspeed;
  81.       local    float    r;
  82.   
  83. +         local   string  num;
  84.       if (self.view_ofs == '0 0 0')
  85.           return;        // intermission or finale
  86.       if (self.deadflag)
  87. ***************
  88. *** 1161,1166 ****
  89. --- 1192,1209 ----
  90.           self.jump_flag = self.velocity_z;
  91.   
  92.       CheckPowerups ();
  93. + // *TEAMPLAY*
  94. + // TeamCheckLock performs all necessary teamlock checking, and performs all
  95. + // actions needed.
  96. +         TeamCheckLock();
  97. + // MOTDCheck will show the MOTD if necessary.  (This happens when self.motd is 
  98. + // zero.
  99. +     MOTDCheck();
  100.   };
  101.   
  102.   
  103. ***************
  104. *** 1175,1181 ****
  105.   {
  106.       bprint (self.netname);
  107.       bprint (" entered the game\n");
  108. !     
  109.   // a client connecting during an intermission can cause problems
  110.       if (intermission_running)
  111.           ExitIntermission ();
  112. --- 1218,1234 ----
  113.   {
  114.       bprint (self.netname);
  115.       bprint (" entered the game\n");
  116. ! // *TEAMPLAY*
  117. !     // Unset the MOTDVIEWED flag if it's on.
  118. !     if(self.flags & FL_MOTDVIEWED)
  119. !         self.flags = self.flags - FL_MOTDVIEWED;
  120. !     // If this is our first connection, parm10 is < 0
  121. !     // Set lastteam negative.
  122. !     if(parm10 < 0)
  123. !         self.lastteam = -50;
  124.   // a client connecting during an intermission can cause problems
  125.       if (intermission_running)
  126.           ExitIntermission ();
  127. ***************
  128. *** 1205,1210 ****
  129. --- 1258,1269 ----
  130.       set_suicide_frame ();
  131.   };
  132.   
  133. + // *TEAMPLAY*
  134. + // Prototypes
  135. + float(entity targ, entity attacker) TeamFragPenalty;
  136. + void(entity targ, entity attacker) TeamDeathPenalty;
  137.   /*
  138.   ===========
  139.   ClientObituary
  140. ***************
  141. *** 1264,1270 ****
  142.               }
  143.               else
  144.               {
  145. !                 attacker.frags = attacker.frags + 1;
  146.   
  147.                   rnum = attacker.weapon;
  148.                   if (rnum == IT_AXE)
  149. --- 1323,1341 ----
  150.               }
  151.               else
  152.               {
  153. ! // *TEAMPLAY*
  154. ! // TeamFragPenalty returns true if the attacker gets a frag penalty for
  155. ! // killing this target.  It also deducts frags as needed.
  156. !                                 if (!TeamFragPenalty(targ, attacker))
  157. !                                         attacker.frags = attacker.frags + 1;
  158. ! // *TEAMPLAY*
  159. ! // TeamDeathPenalty kills the attacker if necessary and adjusts frags to
  160. ! // offset the one frag penalty for dying.
  161. !                                 TeamDeathPenalty(targ, attacker);
  162.   
  163.                   rnum = attacker.weapon;
  164.                   if (rnum == IT_AXE)
  165. diff --context --new-file \quake\mod\v101qc/combat.qc ./combat.qc
  166. *** /quake/mod/v101qc/combat.qc    Wed Jul 24 23:51:22 1996
  167. --- ./combat.qc    Sat Aug 17 00:41:58 1996
  168. ***************
  169. *** 91,96 ****
  170. --- 91,102 ----
  171.   };
  172.   
  173.   
  174. + // *TEAMPLAY*
  175. + // Prototypes
  176. + float(entity targ, entity inflictor, entity attacker, float damage) TeamArmorDam;
  177. + float(entity targ, entity inflictor, entity attacker, float damage) TeamHealthDam;
  178.   /*
  179.   ============
  180.   T_Damage
  181. ***************
  182. *** 118,124 ****
  183.   
  184.   // save damage based on the target's armor level
  185.   
  186. !     save = ceil(targ.armortype*damage);
  187.       if (save >= targ.armorvalue)
  188.       {
  189.           save = targ.armorvalue;
  190. --- 124,137 ----
  191.   
  192.   // save damage based on the target's armor level
  193.   
  194. ! // *TEAMPLAY*
  195. ! // TeamArmorDam returns true iff the attacker can damage the target's armor
  196. !         if (TeamArmorDam(targ, inflictor, attacker, damage))
  197. !                 save = ceil(targ.armortype*damage);
  198. !         else
  199. !                 save = 0;
  200.       if (save >= targ.armorvalue)
  201.       {
  202.           save = targ.armorvalue;
  203. ***************
  204. *** 163,168 ****
  205. --- 176,188 ----
  206.   // team play damage avoidance
  207.       if ( (teamplay == 1) && (targ.team > 0)&&(targ.team == attacker.team) )
  208.           return;
  209. + // *TEAMPLAY*
  210. + // TeamHealthDam will return true if the attacker can damage the target's
  211. + // health
  212. +         if (!TeamHealthDam(targ, inflictor, attacker, damage))
  213. +                 return;
  214.           
  215.   // do the damage
  216.       targ.health = targ.health - take;
  217. diff --context --new-file \quake\mod\v101qc/defs.qc ./defs.qc
  218. *** /quake/mod/v101qc/defs.qc    Wed Jul 24 23:51:22 1996
  219. --- ./defs.qc    Sat Aug 17 00:42:00 1996
  220. ***************
  221. *** 5,10 ****
  222. --- 5,25 ----
  223.               SOURCE FOR GLOBALVARS_T C STRUCTURE
  224.   
  225.   ==============================================================================
  226. +     defs.qc
  227. +     Originally by ID Software
  228. +     Modified by John Spickes (jspickes@eng.umd.edu) for
  229. +         The Complete Enhanced Teamplay
  230. +     $Id: DEFS.QC 1.13 1996/08/17 00:23:29 jspickes Exp $
  231. +     $Log: DEFS.QC $
  232. +     Revision 1.13  1996/08/17 00:23:29  jspickes
  233. +     Removed .motd, added FL_MOTDVIEWED to indicate whether the motd has been
  234. +     seen by self yet.
  235.   */
  236.   
  237.   //
  238. ***************
  239. *** 241,246 ****
  240. --- 256,264 ----
  241.   float    FL_WATERJUMP            = 2048;    // player jumping out of water
  242.   float    FL_JUMPRELEASED            = 4096;    // for jump debouncing
  243.   
  244. + // *TEAMPLAY*
  245. + float   FL_MOTDVIEWED            = 8192; // if we've seen the MOTD.
  246.   // edict.movetype values
  247.   float    MOVETYPE_NONE            = 0;    // never moves
  248.   //float    MOVETYPE_ANGLENOCLIP    = 1;
  249. ***************
  250. *** 457,462 ****
  251. --- 475,485 ----
  252.   //
  253.   // player only fields
  254.   //
  255. + // *TEAMPLAY*
  256. + .float          lastteam;       // The last team this player was a member of.
  257.   .float        walkframe;
  258.   
  259.   .float         attack_finished;
  260. diff --context --new-file \quake\mod\v101qc/items.qc ./items.qc
  261. *** /quake/mod/v101qc/items.qc    Wed Jul 24 23:51:24 1996
  262. --- ./items.qc    Sat Aug 17 00:42:04 1996
  263. ***************
  264. *** 196,202 ****
  265.               if (deathmatch)
  266.                   self.nextthink = time + 20;
  267.               self.think = SUB_regen;
  268. !         }
  269.       }
  270.       
  271.       activator = other;
  272. --- 196,202 ----
  273.               if (deathmatch)
  274.                   self.nextthink = time + 20;
  275.               self.think = SUB_regen;
  276. !                 }
  277.       }
  278.       
  279.       activator = other;
  280. ***************
  281. *** 415,421 ****
  282.               return;
  283.           hadammo = other.ammo_nails;            
  284.           new = IT_NAILGUN;
  285. !         other.ammo_nails = other.ammo_nails + 30;
  286.       }
  287.       else if (self.classname == "weapon_supernailgun")
  288.       {
  289. --- 415,423 ----
  290.               return;
  291.           hadammo = other.ammo_nails;            
  292.           new = IT_NAILGUN;
  293. ! // *TEAMPLAY*
  294. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  295. !             other.ammo_nails = other.ammo_nails + 30;
  296.       }
  297.       else if (self.classname == "weapon_supernailgun")
  298.       {
  299. ***************
  300. *** 423,429 ****
  301.               return;
  302.           hadammo = other.ammo_rockets;            
  303.           new = IT_SUPER_NAILGUN;
  304. !         other.ammo_nails = other.ammo_nails + 30;
  305.       }
  306.       else if (self.classname == "weapon_supershotgun")
  307.       {
  308. --- 425,433 ----
  309.               return;
  310.           hadammo = other.ammo_rockets;            
  311.           new = IT_SUPER_NAILGUN;
  312. ! // *TEAMPLAY*
  313. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  314. !             other.ammo_nails = other.ammo_nails + 30;
  315.       }
  316.       else if (self.classname == "weapon_supershotgun")
  317.       {
  318. ***************
  319. *** 431,437 ****
  320.               return;
  321.           hadammo = other.ammo_rockets;            
  322.           new = IT_SUPER_SHOTGUN;
  323. !         other.ammo_shells = other.ammo_shells + 5;
  324.       }
  325.       else if (self.classname == "weapon_rocketlauncher")
  326.       {
  327. --- 435,443 ----
  328.               return;
  329.           hadammo = other.ammo_rockets;            
  330.           new = IT_SUPER_SHOTGUN;
  331. ! // *TEAMPLAY*
  332. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  333. !             other.ammo_shells = other.ammo_shells + 5;
  334.       }
  335.       else if (self.classname == "weapon_rocketlauncher")
  336.       {
  337. ***************
  338. *** 439,445 ****
  339.               return;
  340.           hadammo = other.ammo_rockets;            
  341.           new = IT_ROCKET_LAUNCHER;
  342. !         other.ammo_rockets = other.ammo_rockets + 5;
  343.       }
  344.       else if (self.classname == "weapon_grenadelauncher")
  345.       {
  346. --- 445,453 ----
  347.               return;
  348.           hadammo = other.ammo_rockets;            
  349.           new = IT_ROCKET_LAUNCHER;
  350. ! // *TEAMPLAY*
  351. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  352. !             other.ammo_rockets = other.ammo_rockets + 5;
  353.       }
  354.       else if (self.classname == "weapon_grenadelauncher")
  355.       {
  356. ***************
  357. *** 447,453 ****
  358.               return;
  359.           hadammo = other.ammo_rockets;            
  360.           new = IT_GRENADE_LAUNCHER;
  361. !         other.ammo_rockets = other.ammo_rockets + 5;
  362.       }
  363.       else if (self.classname == "weapon_lightning")
  364.       {
  365. --- 455,463 ----
  366.               return;
  367.           hadammo = other.ammo_rockets;            
  368.           new = IT_GRENADE_LAUNCHER;
  369. ! // *TEAMPLAY*
  370. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  371. !             other.ammo_rockets = other.ammo_rockets + 5;
  372.       }
  373.       else if (self.classname == "weapon_lightning")
  374.       {
  375. ***************
  376. *** 455,461 ****
  377.               return;
  378.           hadammo = other.ammo_rockets;            
  379.           new = IT_LIGHTNING;
  380. !         other.ammo_cells = other.ammo_cells + 15;
  381.       }
  382.       else
  383.           objerror ("weapon_touch: unknown classname");
  384. --- 465,473 ----
  385.               return;
  386.           hadammo = other.ammo_rockets;            
  387.           new = IT_LIGHTNING;
  388. ! // *TEAMPLAY*
  389. !         if ( !( coop && (teamplay & TEAM_DROP_ITEMS) ) )
  390. !             other.ammo_cells = other.ammo_cells + 15;
  391.       }
  392.       else
  393.           objerror ("weapon_touch: unknown classname");
  394. ***************
  395. *** 1237,1242 ****
  396. --- 1249,1259 ----
  397.           return;
  398.       if (other.health <= 0)
  399.           return;
  400. + // *TEAMPLAY*
  401. + // Don't let the owner pick up his own backpack for one second.
  402. +         if ( (other == self.owner) && ( (self.nextthink - time) > 119 ) )
  403. +                 return;
  404.           
  405.   // if the player was using his best weapon, change up to the new one if better        
  406.       stemp = self;
  407. diff --context --new-file \quake\mod\v101qc/motd.qc ./motd.qc
  408. *** /quake/mod/v101qc/motd.qc
  409. --- ./motd.qc    Sat Aug 17 00:42:06 1996
  410. ***************
  411. *** 0 ****
  412. --- 1,46 ----
  413. + /*
  414. +     motd.qc
  415. +     Part of The Complete Enhanced Teamplay
  416. +     John Spickes    jspickes@eng.umd.edu
  417. +     $Id: MOTD.QC 1.11 1996/08/17 00:22:51 jspickes Exp $
  418. +     $Log: MOTD.QC $
  419. +     Revision 1.11  1996/08/17 00:22:51  jspickes
  420. +     Use the .flag entry FL_MOTDVIEWED instead of .motd float.
  421. + */
  422. + /*
  423. + ================
  424. + MOTDShow
  425. + Display the MOTD.
  426. + ================
  427. + */
  428. + void() MOTDShow =
  429. + {
  430. +     /* Servers!  Add your motd here! */
  431. +     
  432. +     sprint(self,"This server uses\n-The Complete Enhanced Teamplay-\nImpulse 25 for current settings.\n");
  433. +     sprint(self,"Impulse 26 to redisplay MOTD\n");
  434. + };
  435. + /*
  436. + ================
  437. + MOTDCheck
  438. + Display the MOTD if needed, and set self.motd to 1.
  439. + ================
  440. + */
  441. + void() MOTDCheck =
  442. + {
  443. +     if( !(self.flags & FL_MOTDVIEWED) )
  444. +     {
  445. +         MOTDShow();
  446. +         self.flags = self.flags | FL_MOTDVIEWED;
  447. +     }
  448. + };
  449. +     
  450. diff --context --new-file \quake\mod\v101qc/progdefs.h ./progdefs.h
  451. *** /quake/mod/v101qc/progdefs.h
  452. --- ./progdefs.h    Sat Aug 17 16:55:14 1996
  453. ***************
  454. *** 0 ****
  455. --- 1,143 ----
  456. + /* file generated by qcc, do not modify */
  457. + typedef struct
  458. + {    int    pad[28];
  459. +     int    self;
  460. +     int    other;
  461. +     int    world;
  462. +     float    time;
  463. +     float    frametime;
  464. +     float    force_retouch;
  465. +     string_t    mapname;
  466. +     float    deathmatch;
  467. +     float    coop;
  468. +     float    teamplay;
  469. +     float    serverflags;
  470. +     float    total_secrets;
  471. +     float    total_monsters;
  472. +     float    found_secrets;
  473. +     float    killed_monsters;
  474. +     float    parm1;
  475. +     float    parm2;
  476. +     float    parm3;
  477. +     float    parm4;
  478. +     float    parm5;
  479. +     float    parm6;
  480. +     float    parm7;
  481. +     float    parm8;
  482. +     float    parm9;
  483. +     float    parm10;
  484. +     float    parm11;
  485. +     float    parm12;
  486. +     float    parm13;
  487. +     float    parm14;
  488. +     float    parm15;
  489. +     float    parm16;
  490. +     vec3_t    v_forward;
  491. +     vec3_t    v_up;
  492. +     vec3_t    v_right;
  493. +     float    trace_allsolid;
  494. +     float    trace_startsolid;
  495. +     float    trace_fraction;
  496. +     vec3_t    trace_endpos;
  497. +     vec3_t    trace_plane_normal;
  498. +     float    trace_plane_dist;
  499. +     int    trace_ent;
  500. +     float    trace_inopen;
  501. +     float    trace_inwater;
  502. +     int    msg_entity;
  503. +     func_t    main;
  504. +     func_t    StartFrame;
  505. +     func_t    PlayerPreThink;
  506. +     func_t    PlayerPostThink;
  507. +     func_t    ClientKill;
  508. +     func_t    ClientConnect;
  509. +     func_t    PutClientInServer;
  510. +     func_t    ClientDisconnect;
  511. +     func_t    SetNewParms;
  512. +     func_t    SetChangeParms;
  513. + } globalvars_t;
  514. + typedef struct
  515. + {
  516. +     float    modelindex;
  517. +     vec3_t    absmin;
  518. +     vec3_t    absmax;
  519. +     float    ltime;
  520. +     float    movetype;
  521. +     float    solid;
  522. +     vec3_t    origin;
  523. +     vec3_t    oldorigin;
  524. +     vec3_t    velocity;
  525. +     vec3_t    angles;
  526. +     vec3_t    avelocity;
  527. +     vec3_t    punchangle;
  528. +     string_t    classname;
  529. +     string_t    model;
  530. +     float    frame;
  531. +     float    skin;
  532. +     float    effects;
  533. +     vec3_t    mins;
  534. +     vec3_t    maxs;
  535. +     vec3_t    size;
  536. +     func_t    touch;
  537. +     func_t    use;
  538. +     func_t    think;
  539. +     func_t    blocked;
  540. +     float    nextthink;
  541. +     int    groundentity;
  542. +     float    health;
  543. +     float    frags;
  544. +     float    weapon;
  545. +     string_t    weaponmodel;
  546. +     float    weaponframe;
  547. +     float    currentammo;
  548. +     float    ammo_shells;
  549. +     float    ammo_nails;
  550. +     float    ammo_rockets;
  551. +     float    ammo_cells;
  552. +     float    items;
  553. +     float    takedamage;
  554. +     int    chain;
  555. +     float    deadflag;
  556. +     vec3_t    view_ofs;
  557. +     float    button0;
  558. +     float    button1;
  559. +     float    button2;
  560. +     float    impulse;
  561. +     float    fixangle;
  562. +     vec3_t    v_angle;
  563. +     float    idealpitch;
  564. +     string_t    netname;
  565. +     int    enemy;
  566. +     float    flags;
  567. +     float    colormap;
  568. +     float    team;
  569. +     float    max_health;
  570. +     float    teleport_time;
  571. +     float    armortype;
  572. +     float    armorvalue;
  573. +     float    waterlevel;
  574. +     float    watertype;
  575. +     float    ideal_yaw;
  576. +     float    yaw_speed;
  577. +     int    aiment;
  578. +     int    goalentity;
  579. +     float    spawnflags;
  580. +     string_t    target;
  581. +     string_t    targetname;
  582. +     float    dmg_take;
  583. +     float    dmg_save;
  584. +     int    dmg_inflictor;
  585. +     int    owner;
  586. +     vec3_t    movedir;
  587. +     string_t    message;
  588. +     float    sounds;
  589. +     string_t    noise;
  590. +     string_t    noise1;
  591. +     string_t    noise2;
  592. +     string_t    noise3;
  593. + } entvars_t;
  594. + #define PROGHEADER_CRC 5927
  595. diff --context --new-file \quake\mod\v101qc/progs.src ./progs.src
  596. *** /quake/mod/v101qc/progs.src    Wed Jul 24 23:51:28 1996
  597. --- ./progs.src    Sat Aug 17 00:43:00 1996
  598. ***************
  599. *** 1,6 ****
  600. --- 1,8 ----
  601.   ../progs.dat
  602.   
  603.   defs.qc
  604. + teamplay.qc     // Compile the teamplay file
  605. + motd.qc        // Include the MOTD stuff
  606.   subs.qc
  607.   fight.qc
  608.   ai.qc
  609. diff --context --new-file \quake\mod\v101qc/teamplay.qc ./teamplay.qc
  610. *** /quake/mod/v101qc/teamplay.qc
  611. --- ./teamplay.qc    Sat Aug 17 16:53:46 1996
  612. ***************
  613. *** 0 ****
  614. --- 1,782 ----
  615. + /* teamplay.qc
  616. +    From
  617. +         The Comlete Enhanced Teamplay
  618. +    John Spickes -- jspickes@eng.umd.edu
  619. +     $Id: teamplay.qc 1.17 1996/08/17 16:52:45 jspickes Exp $
  620. +     $Log: teamplay.qc $
  621. +     Revision 1.17  1996/08/17 16:52:45  jspickes
  622. +     Fixed a problem with displaying the current team settings that could cause
  623. +     the wrong output when teamplay was negative.  Also added code to indicate
  624. +     when ID's silly teamplay code is being used.
  625. +     Revision 1.16  1996/08/17 00:41:52  jspickes
  626. +     Turned off strict coop by default.
  627. +     Fixed a bug that could have caused strange behavior if TEAM_COLOR* was
  628. +     set to -2.
  629. +     Revision 1.15  1996/08/17 00:34:17  jspickes
  630. +     Added instructions on drop-item use in current settings output.
  631. +     Fixed a problem that would allow you to drop lots of backpacks with
  632. +     nothing in them.
  633. + */
  634. + /** Defs **/
  635. + /** MODIFIABLE CONSTANTS **/
  636. + float TEAM_DEFAULT_PENALTY =    1;      // Default frag penalty
  637. + float TEAM_STRICT_COOP =    0;    // Strict Coop
  638. + // Allowed team colors
  639. + // -1 indicates no color
  640. + float TEAM_COLOR1       =       4;
  641. + float TEAM_COLOR2       =       13;
  642. + float TEAM_COLOR3       =       -1;
  643. + float TEAM_COLOR4       =       -1;
  644. + /** End of MODIFIABLE CONSTANTS **/
  645. + // Globals
  646. + // Teamplay bitfield entries
  647. + float TEAM_HEALTH_PROTECT =     1;      // No health damage from friendly fire
  648. + float TEAM_ARMOR_PROTECT =      2;      // No armor damage from friendly fire
  649. + float TEAM_ATTACKER_DAMAGE =    4;      // Attacker takes damage from hitting teammates
  650. + float TEAM_FRAG_PENALTY =       8;      // One frag penalty for killing teammate
  651. + float TEAM_DEATH_PENALTY =      16;     // Die when you kill a teammate.
  652. + float TEAM_LOCK_COLORS =        32;     // Allow only team colors
  653. + float TEAM_STATIC_TEAMS =       64;     // Don't allow players to switch teams
  654. + float TEAM_DROP_ITEMS =     128;    // Allow players to drop packs and 
  655. +                     // weapons.
  656. + // Prototypes
  657. + float() W_BestWeapon;
  658. + void() W_SetCurrentAmmo;
  659. + void() bound_other_ammo;
  660. + void(float o, float n) Deathmatch_Weapon;
  661. + void() BackpackTouch;
  662. + /*
  663. + ================
  664. + TeamPrintSettings
  665. + Print out current teamplay options
  666. + ================
  667. + */
  668. + void() TeamPrintSettings =
  669. + {
  670. +     local string s;
  671. +     
  672. +     sprint(self,"The following Teamplay options are set:\n");
  673. +     
  674. +     if(teamplay < 0)
  675. +     {
  676. +         sprint(self, "Frag penalty manually set to ");
  677. +         s = ftos(teamplay);
  678. +         sprint(self, s);
  679. +         sprint(self, "\n");
  680. +         return;
  681. +     }
  682. +     
  683. +     if(!teamplay) 
  684. +     {
  685. +         sprint(self, "None\n");
  686. +         return;
  687. +     }
  688. +     
  689. +     if(1 == teamplay)
  690. +     {
  691. +         sprint(self, "ID's original teamplay 1\n");
  692. +         return;
  693. +     }
  694. +     
  695. +     if(teamplay & TEAM_HEALTH_PROTECT)
  696. +         sprint(self, "Health-Protect ");
  697. +     
  698. +     if(teamplay & TEAM_ARMOR_PROTECT)
  699. +         sprint(self, "Armor-Protect ");
  700. +         
  701. +     if(teamplay & TEAM_ATTACKER_DAMAGE)
  702. +         sprint(self, "Mirror-Damage ");
  703. +         
  704. +     if(teamplay & TEAM_FRAG_PENALTY)
  705. +         sprint(self, "Frag-Penalty ");
  706. +         
  707. +     if(teamplay & TEAM_DEATH_PENALTY)
  708. +         sprint(self, "Death-Penalty ");
  709. +         
  710. +     if(teamplay & TEAM_LOCK_COLORS)
  711. +         sprint(self, "Lock-Colors ");
  712. +         
  713. +     if(teamplay & TEAM_STATIC_TEAMS)
  714. +         sprint(self, "Static-Teams ");
  715. +         
  716. +     if(teamplay & TEAM_DROP_ITEMS)
  717. +         sprint(self, "Drop-Items (Backpack Impulse 20, Weapon Impulse 21)");
  718. +         
  719. +     sprint(self, "\n");
  720. + };
  721. + /*
  722. + ================
  723. + TeamArmorDam
  724. + Return TRUE if the target's armor can take damage from this attacker.
  725. + ================
  726. + */
  727. + float(entity targ, entity inflictor, entity attacker, float damage) TeamArmorDam =
  728. + {
  729. +         if( teamplay < 0 )
  730. +                 return TRUE;
  731. +         if( (teamplay & TEAM_ARMOR_PROTECT) && (attacker.team == targ.team) && (attacker != targ) && (targ.team > 0) )
  732. +         {
  733. +                 // Armor is protected
  734. +                 return FALSE;
  735. +         }
  736. +         return TRUE;
  737. + };
  738. + /*
  739. + ================
  740. + TeamHealthDam
  741. + Return TRUE if the target can take health damage from this attacker.
  742. + ================
  743. + */
  744. + float(entity targ, entity inflictor, entity attacker, float damage) TeamHealthDam =
  745. + {
  746. +         if( teamplay < 0 )
  747. +         {
  748. +                 return TRUE;
  749. +         }
  750. +         if( (attacker.team == targ.team) && (attacker != targ) && (targ.team > 0) )
  751. +         {
  752. +                 // Attacker and target are on the same team.
  753. +                 if( teamplay & TEAM_ATTACKER_DAMAGE )
  754. +                 {
  755. +                         // Damage applied to teammate.
  756. +                         T_Damage(attacker, inflictor, attacker, damage);
  757. +                 }
  758. +                 if( teamplay & TEAM_HEALTH_PROTECT )
  759. +                 {
  760. +                         // Health is protected
  761. +                         return FALSE;
  762. +                 }
  763. +         }
  764. +         return TRUE;
  765. + };
  766. + /*
  767. + ================
  768. + TeamPFrags
  769. + Return the number of frags we should penalize attacker for killing targ.
  770. + ================
  771. + */
  772. + float(entity targ, entity attacker) TeamPFrags =
  773. + {
  774. +         if( teamplay < 0 )
  775. +                 return (-1 * teamplay);
  776. +         if( (targ.team > 0) && (targ != attacker) && (targ.team == attacker.team) )
  777. +         {
  778. +                 // targ and attacker are on the same team
  779. +                 if( teamplay < 0 )
  780. +                 {
  781. +                         // teamplay indicates frag penalty
  782. +                         return ( -1 * teamplay );
  783. +                 }
  784. +                 if( teamplay & TEAM_FRAG_PENALTY )
  785. +                 {
  786. +                         // default penalty
  787. +                         return TEAM_DEFAULT_PENALTY;
  788. +                 }
  789. +         }
  790. +         // No frag penalty
  791. +         return 0;
  792. + };
  793. + /*
  794. + ================
  795. + TeamFragPenalty
  796. + If attacker should be penalized for killing targ, penalize attacker
  797. + and return TRUE.
  798. + ================
  799. + */
  800. + float(entity targ, entity attacker) TeamFragPenalty =
  801. + {
  802. +         local float f;
  803. +         f = TeamPFrags(targ, attacker);
  804. +         if( f )
  805. +         {
  806. +                 // We should penalize some frags.
  807. +                 attacker.frags = attacker.frags - f;
  808. +                 return TRUE;
  809. +         }
  810. +         // No penalty
  811. +         return FALSE;
  812. + };
  813. + /*
  814. + =================
  815. + TeamDeathPenalty
  816. + If attacker should be killed for killing targ, kill attacker and
  817. + add a frag to offset the one attacker will lose for killing himself.
  818. + */
  819. + void(entity targ, entity attacker) TeamDeathPenalty =
  820. + {
  821. +         //Don't kill anyone if teamplay is negative.
  822. +         if ( teamplay < 0 )
  823. +                 return;
  824. +         if ( (teamplay & TEAM_DEATH_PENALTY) && (targ.team > 0) && (attacker != targ) && (attacker.team == targ.team) )
  825. +         {
  826. +                 //We should kill the attacker.
  827. +                 T_Damage(attacker,attacker,attacker,1000);
  828. +                 //Add a frag to offset the self-kill penalty.
  829. +                 attacker.frags = attacker.frags + 1;
  830. +         }
  831. + };
  832. + /*
  833. + ==================
  834. + TeamColorIsLegal
  835. + Return TRUE if the indicated color is legal
  836. + ==================
  837. + */
  838. + float(float color) TeamColorIsLegal =
  839. + {
  840. +         // All colors are legal if teamplay is negative.
  841. +         if( teamplay < 0 )
  842. +                 return TRUE;
  843. +         // All colors are legal if TEAM_LOCK_COLORS is off.
  844. +         if( !(teamplay & TEAM_LOCK_COLORS) )
  845. +                 return TRUE;
  846. +         if( (color == TEAM_COLOR1) && (TEAM_COLOR1 >= 0) )
  847. +                 return TRUE;
  848. +         if( (color == TEAM_COLOR2) && (TEAM_COLOR2 >= 0) )
  849. +                 return TRUE;
  850. +         if( (color == TEAM_COLOR3) && (TEAM_COLOR3 >= 0) )
  851. +                 return TRUE;
  852. +         if( (color == TEAM_COLOR4) && (TEAM_COLOR4 >= 0) )
  853. +                 return TRUE;
  854. + };
  855. + /*
  856. + ==================
  857. + TeamCheckTeam
  858. + Check if the team self is on is legal, and put self in a legal team if not.
  859. + Return TRUE if the current color is ok, FALSE if we have to set it.
  860. + ==================
  861. + */
  862. + float() TeamCheckTeam =
  863. + {
  864. +         local float TEAM1;
  865. +         local float TEAM2;
  866. +         local float TEAM3;
  867. +         local float TEAM4;
  868. +         local float newcolor;
  869. +         local float t;
  870. +         local entity p;
  871. +         local string n; 
  872. +         // If self.lastteam is negative, force a team assignment.
  873. +         if( self.lastteam >= 0 )
  874. +         {
  875. +                 if(TeamColorIsLegal(self.team - 1))
  876. +                         return TRUE;
  877. +         }
  878. +         // Assign the player to a team.
  879. +         // Sum the players on all the teams.
  880. +         TEAM1 = 0;
  881. +         TEAM2 = 0;
  882. +         TEAM3 = 0;
  883. +         TEAM4 = 0;
  884. +         p = find (world, classname, "player");
  885. +         while(p)
  886. +         {
  887. +                 if( (TEAM_COLOR1 >= 0) && (p.team == (TEAM_COLOR1 +1)) )
  888. +                         TEAM1 = TEAM1 + 1;
  889. +                 if( (TEAM_COLOR2 >= 0) && (p.team == (TEAM_COLOR2 +1)) )
  890. +                         TEAM2 = TEAM2 + 1;
  891. +                 if( (TEAM_COLOR3 >= 0) && (p.team == (TEAM_COLOR3 +1)) )
  892. +                         TEAM3 = TEAM3 + 1;
  893. +                 if( (TEAM_COLOR4 >= 0) && (p.team == (TEAM_COLOR4 +1)) )
  894. +                         TEAM4 = TEAM4 + 1;
  895. +                 p = find(p, classname, "player");
  896. +         }
  897. +         // Find the team with the least players.
  898. +         newcolor = TEAM_COLOR1;
  899. +         t = TEAM1;
  900. +         if ( (TEAM_COLOR2 >= 0) && (TEAM2 < t) )
  901. +         {
  902. +                 newcolor = TEAM_COLOR2;
  903. +                 t = TEAM2;
  904. +         }
  905. +         if ( (TEAM_COLOR3 >= 0) && (TEAM3 < t) )
  906. +         {
  907. +                 newcolor = TEAM_COLOR3;
  908. +                 t = TEAM3;
  909. +         }
  910. +         if ( (TEAM_COLOR4 >= 0) && (TEAM4 < t) )
  911. +         {
  912. +                 newcolor = TEAM_COLOR4;
  913. +                 t = TEAM4;
  914. +         }
  915. +         // Put the player on a the new team.
  916. +         n = ftos(newcolor);
  917. +         stuffcmd(self, "color ");
  918. +         stuffcmd(self, n);
  919. +         stuffcmd(self, "\n");
  920. +         sprint(self, "You have been assigned color ");
  921. +         sprint(self, n);
  922. +         sprint(self, "\nLegal colors are:");
  923. +         if(TEAM_COLOR1 >= 0)
  924. +         {
  925. +                 n = ftos(TEAM_COLOR1);
  926. +                 sprint(self, " ");
  927. +                 sprint(self, n);
  928. +         }
  929. +         if(TEAM_COLOR2 >= 0)
  930. +         {
  931. +                 n = ftos(TEAM_COLOR2);
  932. +                 sprint(self, " ");
  933. +                 sprint(self, n);
  934. +         }
  935. +         if(TEAM_COLOR3 >= 0)
  936. +         {
  937. +                 n = ftos(TEAM_COLOR3);
  938. +                 sprint(self, " ");
  939. +                 sprint(self, n);
  940. +         }
  941. +         if(TEAM_COLOR4 >= 0)
  942. +         {
  943. +                 n = ftos(TEAM_COLOR4);
  944. +                 sprint(self, " ");
  945. +                 sprint(self, n);
  946. +         }
  947. +         sprint(self, "\n");
  948. +         self.lastteam = newcolor + 1;      // Remember what team we're on
  949. +         return FALSE;
  950. + };
  951. + /*
  952. + ===============
  953. + TeamCheckLock
  954. + Check for team changing and perform whatever actions are neccessary.
  955. + ===============
  956. + */
  957. + void() TeamCheckLock =
  958. + {
  959. +         local   float   n;
  960. +         local   string  s;
  961. +         // Don't do anything if teamplay is negative
  962. +         if ( teamplay < 0 )
  963. +                 return;
  964. +         if ( !TeamColorIsLegal(self.team - 1) && (self.team == self.lastteam) )
  965. +                 self.lastteam = -1;
  966. +         // Check to see if the player has changed colors
  967. +         if (self.team != self.lastteam)
  968. +         {
  969. +                 // Player has changed colors
  970. +                 // If teams are static and we've been on some team already,
  971. +                 // put us back on the team we were on.
  972. +                 if ( (teamplay & TEAM_STATIC_TEAMS) && (self.lastteam >= 0) )
  973. +                 {
  974. +                         if ( TeamColorIsLegal(self.lastteam - 1) )
  975. +                         {
  976. +                                 sprint(self, "You cannot change teams.\n");
  977. +                                 stuffcmd(self, "color ");
  978. +                                 n = self.lastteam - 1;
  979. +                                 s = ftos(n);
  980. +                                 stuffcmd(self, s);
  981. +                                 stuffcmd(self, "\n");
  982. +                                 return;
  983. +                         }
  984. +                         else
  985. +                                 self.lastteam = -50;
  986. +                                 // If we're on an illegal team, force a change.
  987. +                 }
  988. +                 // If teamlock is turned off, don't do anything more.
  989. +                 if ( !(teamplay & TEAM_LOCK_COLORS) )
  990. +                 {
  991. +                         if ( teamplay & TEAM_STATIC_TEAMS )
  992. +                                 self.lastteam = self.team;
  993. +                         return;
  994. +                 }
  995. +                 if(self.lastteam > 0) 
  996. +         {
  997. +             s = ftos(self.lastteam);
  998. +                         T_Damage(self,self,self,1000);  // Kill the player
  999. +         }
  1000. +                 self.frags = 0;                 // Zero out frags
  1001. +                 if(TeamCheckTeam())
  1002. +                         self.lastteam = self.team;
  1003. +         }
  1004. + };
  1005. + /*
  1006. + =======================
  1007. + TossBackPack
  1008. + Original idea by Vhold
  1009. + Rewritten by John Spickes
  1010. + Toss out a backpack containing some ammo from your current weapon,
  1011. + and any weapons you don't have.
  1012. + =======================
  1013. + */
  1014. + void() TossBackpack =
  1015. + {
  1016. +     local entity     item;
  1017. +     // If we don't have any ammo, return
  1018. +     if(self.currentammo <= 0)
  1019. +         return;
  1020. +     item = spawn();
  1021. +     // See if you have the Shotgun or Super Shotgun on
  1022. +         if ( (self.weapon == IT_SHOTGUN) || (self.weapon == IT_SUPER_SHOTGUN) )
  1023. +     {
  1024. +         if( self.ammo_shells >= 20 ) {
  1025. +             item.ammo_shells = 20;
  1026. +             self.ammo_shells = self.ammo_shells - 20;
  1027. +         }
  1028. +         else
  1029. +         {
  1030. +             item.ammo_shells = self.ammo_shells;
  1031. +             self.ammo_shells = 0;
  1032. +         }
  1033. +     }        
  1034. +     
  1035. +     // See if you have neither the Shotgun or Super Shotgun
  1036. +         if ( !(self.items & IT_SHOTGUN) && !(self.items & IT_SUPER_SHOTGUN) )
  1037. +     {
  1038. +         if( self.ammo_shells >= 20 ) {
  1039. +             item.ammo_shells = 20;
  1040. +             self.ammo_shells = self.ammo_shells - 20;
  1041. +         }
  1042. +         else
  1043. +         {
  1044. +             item.ammo_shells = self.ammo_shells;
  1045. +             self.ammo_shells = 0;
  1046. +         }
  1047. +     }        
  1048. +     
  1049. +     // See if we are using a nailgun
  1050. +         if ( (self.weapon == IT_NAILGUN) || (self.weapon == IT_SUPER_NAILGUN) )
  1051. +     {
  1052. +         if( self.ammo_nails >= 20 )
  1053. +         {
  1054. +             item.ammo_nails = 20;
  1055. +             self.ammo_nails = self.ammo_nails - 20;
  1056. +         }
  1057. +         else
  1058. +         {
  1059. +             item.ammo_nails = self.ammo_nails;
  1060. +             self.ammo_nails = 0;
  1061. +         }
  1062. +     }    
  1063. +     // Check to see if we have neither nailgun
  1064. +         if ( !(self.items & IT_NAILGUN) && !(self.items & IT_SUPER_NAILGUN) )
  1065. +     {
  1066. +         if( self.ammo_nails >= 20 )
  1067. +         {
  1068. +             item.ammo_nails = 20;
  1069. +             self.ammo_nails = self.ammo_nails - 20;
  1070. +         }
  1071. +         else
  1072. +         {
  1073. +             item.ammo_nails = self.ammo_nails;
  1074. +             self.ammo_nails = 0;
  1075. +         }
  1076. +     }    
  1077. +     
  1078. +     // See if we are using a grenade or rocket launcher
  1079. +         if ( (self.weapon == IT_GRENADE_LAUNCHER) || (self.weapon == IT_ROCKET_LAUNCHER) )
  1080. +     {
  1081. +         if( self.ammo_rockets >= 10 )
  1082. +         {
  1083. +             item.ammo_rockets = 10;
  1084. +             self.ammo_rockets = self.ammo_rockets - 10;
  1085. +         }
  1086. +         else
  1087. +         {
  1088. +             item.ammo_rockets = self.ammo_rockets;
  1089. +             self.ammo_rockets = 0;
  1090. +         }
  1091. +     }
  1092. +     // See if we have neither the Grenade or rocket launcher
  1093. +         if ( !(self.items & IT_GRENADE_LAUNCHER) && !(self.items & IT_ROCKET_LAUNCHER) )
  1094. +     {
  1095. +         if( self.ammo_rockets >= 10 )
  1096. +         {
  1097. +             item.ammo_rockets = 10;
  1098. +             self.ammo_rockets = self.ammo_rockets - 10;
  1099. +         }
  1100. +         else
  1101. +         {
  1102. +             item.ammo_rockets = self.ammo_rockets;
  1103. +             self.ammo_rockets = 0;
  1104. +         }
  1105. +     }
  1106. +     // See if we're using the lightning gun
  1107. +     if ( self.weapon == IT_LIGHTNING )
  1108. +     {    
  1109. +         if( self.ammo_cells >= 20 )
  1110. +         {
  1111. +             item.ammo_cells = 20;
  1112. +             self.ammo_cells = self.ammo_cells - 20;
  1113. +         }
  1114. +         else
  1115. +         {
  1116. +             item.ammo_cells = self.ammo_cells;
  1117. +             self.ammo_cells = 0;
  1118. +         }
  1119. +     }
  1120. +     // see if we don't have the lightning gun
  1121. +         if ( !(self.items & IT_LIGHTNING) )
  1122. +     {    
  1123. +         if( self.ammo_cells >= 20 )
  1124. +         {
  1125. +             item.ammo_cells = 20;
  1126. +             self.ammo_cells = self.ammo_cells - 20;
  1127. +         }
  1128. +         else
  1129. +         {
  1130. +             item.ammo_cells = self.ammo_cells;
  1131. +             self.ammo_cells = 0;
  1132. +         }
  1133. +     }
  1134. +      
  1135. +     item.owner = self;
  1136. +     makevectors(self.v_angle);
  1137. +     setorigin(item, self.origin + '0 0 16');
  1138. +     item.velocity = aim(self, 1000);
  1139. +     item.velocity = item.velocity * 500;
  1140. +     item.flags = FL_ITEM;
  1141. +     item.solid = SOLID_TRIGGER;
  1142. +     item.movetype = MOVETYPE_BOUNCE;
  1143. +     setmodel (item, "progs/backpack.mdl");
  1144. +     setsize(item, '-16 -16 0', '16 16 56');
  1145. +     item.touch = BackpackTouch;
  1146. +     item.nextthink = time + 120;    // remove after 2 minutes
  1147. +     item.think = SUB_Remove;
  1148. +     W_SetCurrentAmmo();
  1149. + };
  1150. + void() Team_weapon_touch =
  1151. + {
  1152. +     local    float    hadammo, best, new, old;
  1153. +     local    entity    stemp;
  1154. +     if (!(other.flags & FL_CLIENT))
  1155. +         return;
  1156. +     // Don't let the owner pick up his own weapon for a second.
  1157. +     if ( (other == self.owner) && ( (self.nextthink - time) > 119 ) )
  1158. +         return;
  1159. + // if the player was using his best weapon, change up to the new one if better        
  1160. +     stemp = self;
  1161. +     self = other;
  1162. +     best = W_BestWeapon();
  1163. +     self = stemp;
  1164. +     if (self.classname == "weapon_nailgun")
  1165. +     {
  1166. +         hadammo = other.ammo_nails;            
  1167. +         new = IT_NAILGUN;
  1168. +     }
  1169. +     else if (self.classname == "weapon_supernailgun")
  1170. +     {
  1171. +         hadammo = other.ammo_rockets;            
  1172. +         new = IT_SUPER_NAILGUN;
  1173. +     }
  1174. +     else if (self.classname == "weapon_supershotgun")
  1175. +     {
  1176. +         hadammo = other.ammo_rockets;            
  1177. +         new = IT_SUPER_SHOTGUN;
  1178. +     }
  1179. +     else if (self.classname == "weapon_rocketlauncher")
  1180. +     {
  1181. +         hadammo = other.ammo_rockets;            
  1182. +         new = IT_ROCKET_LAUNCHER;
  1183. +     }
  1184. +     else if (self.classname == "weapon_grenadelauncher")
  1185. +     {
  1186. +         hadammo = other.ammo_rockets;            
  1187. +         new = IT_GRENADE_LAUNCHER;
  1188. +     }
  1189. +     else if (self.classname == "weapon_lightning")
  1190. +     {
  1191. +         hadammo = other.ammo_rockets;            
  1192. +         new = IT_LIGHTNING;
  1193. +     }
  1194. +     else
  1195. +         objerror ("Team_weapon_touch: unknown classname");
  1196. +     sprint (other, "You got the ");
  1197. +     sprint (other, self.netname);
  1198. +     sprint (other, "\n");
  1199. + // weapon touch sound
  1200. +     sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  1201. +     stuffcmd (other, "bf\n");
  1202. +     bound_other_ammo ();
  1203. + // change to the weapon
  1204. +     old = other.items;
  1205. +     other.items = other.items | new;
  1206. +     
  1207. +     stemp = self;
  1208. +     self = other;
  1209. +     if (!deathmatch)
  1210. +         self.weapon = new;
  1211. +     else
  1212. +         Deathmatch_Weapon (old, new);
  1213. +     W_SetCurrentAmmo();
  1214. +     self = stemp;
  1215. +     self.model = string_null;
  1216. +     self.solid = SOLID_NOT;
  1217. +     
  1218. +     activator = other;
  1219. +     SUB_UseTargets();                // fire all targets / killtargets
  1220. + };
  1221. +         
  1222. + void() TossWeapon =
  1223. + {
  1224. +     local entity item;
  1225. +     
  1226. +     if((self.weapon == IT_AXE) || (self.weapon == IT_SHOTGUN))
  1227. +         return;
  1228. +         
  1229. +     item = spawn();
  1230. +     item.owner = self;
  1231. +     makevectors(self.v_angle);
  1232. +     setorigin(item, self.origin + '0 0 16');
  1233. +     item.velocity = aim(self, 1000);
  1234. +     item.velocity = item.velocity * 500;
  1235. +     item.flags = FL_ITEM;
  1236. +     item.solid = SOLID_TRIGGER;
  1237. +     item.movetype = MOVETYPE_BOUNCE;
  1238. +     
  1239. +     if(self.weapon == IT_SUPER_SHOTGUN)
  1240. +     {
  1241. +         setmodel (item, "progs/g_shot.mdl");
  1242. +         item.weapon = IT_SUPER_SHOTGUN;
  1243. +         item.netname = "Double-barrelled Shotgun";
  1244. +         item.classname = "weapon_supershotgun";
  1245. +         self.items = self.items - IT_SUPER_SHOTGUN;
  1246. +     }
  1247. +     if( self.weapon == IT_NAILGUN )
  1248. +     {
  1249. +         setmodel (item, "progs/g_nail.mdl");
  1250. +         item.weapon = IT_NAILGUN;
  1251. +         item.netname = "nailgun";
  1252. +         item.classname = "weapon_nailgun";
  1253. +         self.items = self.items - IT_NAILGUN;
  1254. +     }
  1255. +         
  1256. +     if( self.weapon == IT_SUPER_NAILGUN )
  1257. +     {
  1258. +         setmodel (item, "progs/g_nail2.mdl");
  1259. +         item.weapon = IT_SUPER_NAILGUN;
  1260. +         item.netname = "Super Nailgun";
  1261. +         item.classname = "weapon_supernailgun";
  1262. +         self.items = self.items - IT_SUPER_NAILGUN;
  1263. +     }
  1264. +     
  1265. +     if( self.weapon == IT_GRENADE_LAUNCHER )
  1266. +     {
  1267. +         setmodel (item, "progs/g_rock.mdl");
  1268. +         item.weapon = 3;
  1269. +         item.netname = "Grenade Launcher";
  1270. +         item.classname = "weapon_grenadelauncher";
  1271. +         self.items = self.items - IT_GRENADE_LAUNCHER;
  1272. +     }
  1273. +     
  1274. +     if( self.weapon == IT_ROCKET_LAUNCHER )
  1275. +     {
  1276. +         setmodel (item, "progs/g_rock2.mdl");
  1277. +         item.weapon = 3;
  1278. +         item.netname = "Rocket Launcher";
  1279. +         item.classname = "weapon_rocketlauncher";
  1280. +         self.items = self.items - IT_ROCKET_LAUNCHER;
  1281. +     }
  1282. +     
  1283. +     if( self.weapon == IT_LIGHTNING )
  1284. +     {
  1285. +         setmodel (item, "progs/g_light.mdl");
  1286. +         item.weapon = 3;
  1287. +         item.netname = "Thunderbolt";
  1288. +         item.classname = "weapon_lightning";
  1289. +         self.items = self.items - IT_LIGHTNING;
  1290. +     }
  1291. +     setsize(item, '-16 -16 0', '16 16 56');
  1292. +     item.touch = Team_weapon_touch;
  1293. +     item.think = SUB_Null;
  1294. +     item.nextthink = time + 120;
  1295. +     
  1296. +     self.weapon = W_BestWeapon();
  1297. +     W_SetCurrentAmmo();
  1298. + };
  1299. diff --context --new-file \quake\mod\v101qc/weapons.qc ./weapons.qc
  1300. *** /quake/mod/v101qc/weapons.qc    Wed Jul 24 23:51:24 1996
  1301. --- ./weapons.qc    Sat Aug 17 00:42:58 1996
  1302. ***************
  1303. *** 1169,1174 ****
  1304. --- 1169,1195 ----
  1305.           CycleWeaponCommand ();
  1306.       if (self.impulse == 11)
  1307.           ServerflagsCommand ();
  1308. +         
  1309. + // *TEAMPLAY*
  1310. + // If we're allowed to drop items, enable impulse 20 and 21
  1311. +     if ( (teamplay > 0) && (teamplay & TEAM_DROP_ITEMS) )
  1312. +     {
  1313. +         if (self.impulse == 20)
  1314. +             TossBackpack ();
  1315. +         if (self.impulse == 21)
  1316. +             TossWeapon ();
  1317. +     }
  1318. + // *TEAMPLAY*
  1319. + // Impulse 25 prints info about the current teamplay settings.
  1320. +     if (self.impulse == 25)
  1321. +         TeamPrintSettings ();
  1322. + // Impulse 26 redisplays the MOTD
  1323. +     if (self.impulse ==26)
  1324. +         if(self.flags & FL_MOTDVIEWED)
  1325. +             self.flags = self.flags - FL_MOTDVIEWED;
  1326.   
  1327.       if (self.impulse == 255)
  1328.           QuadCheat ();
  1329.