___________________________________________________________________

/* Damage Skins                                 Copyright  EAVY */
___________________________________________________________________

title    : Damage Skins          author   : Stefan ``EAVY'' Schwarz
filename : dmgskins.zip          homepage : www.planetquake.com/ce/
version  : 1.2                   email    : eavy@planetquake.com
date     : 98/07/24              uin      : 1947083

Code Exchange #1 ``Damage Skins'' (C) EAVY * www.planetquake.com/ce
___________________________________________________________________

Special Credits
~~~~~~~~~~~~~~~
id Software (Quake2)
	http://www.idsoftware.com/
Rowan 'Sumaleth' Crawford (Crackwhore Skin Pack)
	sumaleth@frag.com, http://impact.frag.com/
grimlock@one.net.au (Cyborg CTF Skins)
Matt Ownby (inspiration to make code more portable)
	bop@planetquake.com, http://www.planetquake.com/bop/
Jacob Navia (LCC-Win32)
	jacob@jacob.remcomp.fr, http://www.cs.virginia.edu/~lcc-win32/

Client Info
~~~~~~~~~~~
You don't have to fully understand how it works, the only thing
that you should know is that your appearance will change when
your health reaches a critical value (by default it's 25 Health,
then your health display turns red, so it's the proper time to
apply the damage skin); if the server doesn't enforce a change,
your normal skin will be the one you selected in Player Setup.
Your damage skin is usually defined within the server-side list
of models, but in case it's not, it will default to "pain" if
the normal skin is named "skin", otherwise your skin won't change
at all. If allowed to, you can override the server settings by
creating a userinfo "pain" cvar: At the console, type this...

/set pain dmgskins u
/set pain <damage_skin_name>

The first command defines the "pain" info, the second one sends
your damage skin to the server, so it will be able to use it...

Server Info
~~~~~~~~~~~
All customizability options are provided by the "dmgskins.lst" file
and a new serverinfo cvar called "dmgskins". That variable (default
value 25) defines the health points when the normal skin will be
changed to the damage skin. I picked 25 because it's the time when
numbers of the player health display turn red). The skin listing
file contains all assignments, one per line, following this syntax:

normal_model/normal_skin damage_model/damage_skin
normal_model/normal_skin damage_skin
normal_model damage_model/damage_skin
normal_model damage_skin

1. normal model/skin, SPACE, damage model/skin
   (Full definition of normal and damage skins)
   Example: male/grunt male/grunt_pain
   This sets damage skin for "male/grunt" skins to
   "male/grunt_pain"!
2. normal model/skin, SPACE, damage skin
   (If the damage model isn't defined, the normal model will be
   used with the damage skin, so this is an abbreviation)
   Example: female/insane dead
   This sets damage skin for "female/insane" skins to
   "female/dead" (same model)!
3. normal model, SPACE, damage model/skin
   (That's a replacement definition: If no full definition applies
   to the player skin, it will be changed to the one specified
   here, which will be checked for damage skins independently)
   Example: cyborg cyborg/def
   This sets all skins for the "cyborg" model that aren't listed
   in the damage skins listing to "cyborg/def"!
4. normal model, SPACE, damage skin
   (That's another replacement definition: If no full definition
   applies to the player skin, it will be changed to the one
   specified here, which will be checked for damage skins
   independently - but the model won't be changed)
   Example: crakhor crakhorg
   This sets all skins for the Crackwhore model that aren't listed
   in the damage skins listing to "crakhor/crakhorg"!

That are the simple rules that let you define powerful options...
Check out the commented sample "dmgskins.lst" listings to learn
more about the rules - or just use one of the preset lists without
bothering about other options...
To switch to a more restrictive mode that only accepts listed
skins and disregards userinfo "pain" settings, set the "dmgskins"
variable to the negative value of the critical health (e.g. -25)!
The minus only means that those restrictions apply, it won't
affect the critical health value at all...
If you set it to a value greater than 100, skins won't change, but
the parser will make sure that only valid configstrings are used
(invalid strings, e.g. containing several slashes, will default to
a standard skin based on the player's gender)!
If you set it to -100 or less, it's almost the same, skins won't
change - additionally only listed skins will be allowed!
If you set it to 0, Damage Skins will be completely disabled; you
should NEVER have to use this, if you don't want skin changes, use
a value of 100 or -100 instead!
NOTE: Most server admins won't have to bother about all the custom
settings at all - just stick to the default setting (25) and list,
I'm making sure that they are best; I suggest you check the site
occasionally to get the latest listing of Damage Skins-enhanced
player models/skins and other updates...

Coder Info
~~~~~~~~~~
You'll have to add another source file to your project: dmgskins.c
Then you only have to copy&paste a couple of lines into your other
source files - search for "//Damage Skins" inside my sample files
to find out where to place the code; I've marked all of my changes
with that special header.
The source code for the regular codebase is stored in "baseq2",
the source code for the CTF codebase is stored in "ctf", my own
code is in the main directory; "dmgskins.c" works with both code-
bases.
Let me know if you're using my mod with your project so I can put
info about it on my site; always remember: Credit where credit is
due.

Intellectual Property Notice and Legal Disclaimers 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This software is being provided by the copyright holders under
the following license. By obtaining, using and/or copying this
software, you agree that you have read, understood, and will
comply with the following terms and conditions:

Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee or royalty is
hereby granted, provided that you include the following on ALL
copies of the software and documentation or portions thereof,
including modifications, that you make:

1. A link or URL to the original ce source.
2. Any pre-existing intellectual property disclaimers.
   Also a notice of the form:
   "Copyright  EAVY - All Rights Reserved!"
3. When space permits, inclusion of the full text of this NOTICE
   should be provided. In addition, credit shall be attributed
   to the copyright holders for any software, documents, or
   other items or products that you create pursuant to the
   implementation of the contents of this document, or any
   portion thereof.

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE
OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
SOFTWARE OR DOCUMENTATION.

The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to the software without
specific, written prior permission. Title to copyright in
this software and any associated documentation will at
all times remain with copyright holders.

NOTE: My own code is marked with the "Damage Skins" headers and
footers; other code is probably property of id Software and
governed by their own license! The Player Pack File contains
additional material owned by id Software and other individuals;
it can only be distributed free of charge over the Internet -
you'll have to get specific written permission by all the owners
to be able to distribute it in any other way! The most recent
official versions of code and pack will be available at my site!

Enjoy yourself,
 -- Eavy
mailto:eavy@planetquake.com
http://www.planetquake.com/ce/dmgskins.html
