Title    : Exploding Box Fix
Filename : boxfix.zip
Version  : 1.0a
Date     : March 3, 1998 (3/3/98)
Author   : Patrick Martin
Email    : cimartin@flash.net


Type of Mod
-----------
Quake C  : Yes (Type:  Misc/Code Example)
Sound    : No
MDL      : No


Format of QuakeC
----------------
unified diff  : No
context diff  : No
.qc files     : Yes
progs.dat     : No


Construction
----------------
Base           : Modified misc.qc.
Build Time     : Few minutes.
Editor(s) used : MS-DOS text editor and ProQCC v1.60.
Hardware used  : Pentium-100 with 16MB RAM and Quake v1.06.
Known Bugs     : None -- this *fixes* a bug in Quake :)
Impulses       : N/A


Description of the Modification
-------------------------------
     Ever since I have played around with my Buster patch,
I noticed a bug with the barrels in Quake:  Whenever a
radius attack destroys a barrel, that radius attack is
negated and the explosion of the barrel's takes its place.

     Since nothing in normal Quake (other than lightning
discharge underwater) had the explosive power of an exploding
barrel, this bug had very little if any effect in regular
Quake.  However, custom weapons which produce large, damaging
explosions, such as those that recreate the effects of a nuke,
could have their damaging effects spoiled if a barrel is
destroyed by the explosion.

     Below is some code that will fix this bug.  What it
does is delay the barrel explosion for a frame (0.1 sec.),
which will let *your* weapon do the damage first without
interference; then the barrel explodes immediately afterward.

     Feel free to cut-and-paste this code into your projects.


MISC.QC
(Go down to

	void() barrel_explode =

 and erase the *entire* function.

 Then insert the following two functions where
 the original void() barrel_explode used to be...)


//-------------------------------------------------------- Code Change -----
//  This fixes a bug in which barrel explosions cancel other explosions.
//  Here, the barrel explosion is delayed for one frame so that other
//  explosions can occur without interference from the barrel.
//--------------------------------------------------------------------------
void() barrel_damage =
{
	T_RadiusDamage (self, self, 160, world);
        setorigin(self, self.origin + '0 0 32');
        self.effects = self.effects | EF_MUZZLEFLASH;
	BecomeExplosion ();
};

void() barrel_explode =
{
	self.takedamage = DAMAGE_NO;
	self.classname = "explo_box";
        sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
        particle (self.origin + '0 0 32', '0 0 0', 75, 255);
        self.nextthink = time + 0.1;
        self.think = barrel_damage;
};
//---------------------------------------------------------------- END -----


Revision History
----------------
9/14/97:
   version 1.0a
   * Fixed a typo.

7/25/97:
   version 1.0
   * First release.


Credits
-------
* ID for creating Doom, Doom][, and Quake.
* Rob Albin for QC106PAC.ZIP.
* Lee Smith for PROQC160.ZIP.
* Olivier Montanuy and Ferrara Francesco for the QuakeC manual.
* Mom and Dad for plenty of good stuff.
* God!


Author Information
------------------
I am a 26 college graduate with one degree in mathematics
and another degree in computer science.  I currently live
in Edmond, Oklahoma (which is in the United States).

I am currently a member of The Coven.  Webpage is at -
   http://www.planetquake.com/TheCoven/

I am also the author of the following Doom][ and Quake stuff:

  DOOM][ levels
BLAKGATE   DARKEDEN   PM1523

  Quake QC mods
ARCHSHAM   BOXFIX     BREATH     BUSTER     CHARGE
CHOKE      CRANKED    DKNIGHT    DOOMSHOT   DRAGONS
GASBOMB    LOB_AI     NAPALM     RESPAWN

  Quake2 DLL mods
NAPALM2


Copyright and Distribution Permissions
--------------------------------------
This is public domain.


Disclaimer
----------
The author of this mod is NOT responsible for any damage caused
by the use of this mod!  If your computer malfunctions, you are
on your own.  To put it another way, use this mod at your own risk.


Availability
------------
ftp.cdrom.com
