-------------------------------------------------------------------------

###### Overview:

This is a set of QuakeC patches written on a rather cloudy weekend
using LinuxQuake-1.01.
The patches are deathmatch oriented and are to be installed on the
server only.
To a large extent they are organized in a module-like structure:

Module Motd: 
   When connecting to the server a message-of-the-day is center-printed
   to the player's screen.
   A moment later, information about local server settings and
   extensions is dumped to the player's console.
       
Module Observer:
   As observer you just watch what's happening, without interacting
   with other players or with the environment.
   This especially means that other players will not notice you when you
   are an observer.
   As observer you can
      - fly around. 
      - quickly jump to another observation point by pressing 'jump'.
      - join the game as regular player by pressing 'fire'.
   You can turn into an observer by pressing 'jump' when you
   are dead.
   When you connect to the server you automatically start as observer.
   The command 'help-observer' provides help on the observer mode.

Module KickSuicider:
   Provides a way to get rid of the suicider-nuisance (players suiciding
   in rapid succession a few dozen times).
   Players suiciding more than two times on a level are kicked out of the
   game.

Module Messages:
   Allows to selectively enable or disable messages about picking up ammo,
   armor, backpacks, keys, health, powerups and weapons. 
   By default these messages are suppressed.

Module MapQueue:
   Allows to specify a sequence of levels to be played on the server.

Module Rank:
    The command 'rank' displays a sorted ranking table with entries 
    in the format
        TOTAL = KILLS DEATHS ACCIDENTS = PLAYER
    where
        PLAYER    = the name of the player
        TOTAL     = his total score
        KILLS     = how many he killed    
        DEATHS    = how often he got killed by other players
        ACCIDENTS = number of self-caused, deathly accidents
    A Suicide counts as double-accident.
    The default formula for calculating TOTAL is
        TOTAL     = 3*KILLS - DEATHS - 3*ACCIDENTS
    The command 'help-rank' provides help on the format of the ranking
    table and should explain the (local) formula used to calculate the 
    total score as well.

Module Skin:
    This is a slightly improved version of Dennis Noordsij's 
    (lnoordsi@inter.NL.net) Multiskin, which allows you to use different
    skins (see also section Acknowledgements below).

-------------------------------------------------------------------------

###### Bugs/Unwanted Features:

# Observers occasionally get stuck or start in a position from which they
  can't move away. If this happens just press 'jump' to jump to another 
  place.  
  
-------------------------------------------------------------------------

###### How to install:
------------------------

This section assumes that you are a server administrator.

### Testing:
------------

For testing purposes you may first want to try the precompiled PROGS.DAT.

Assuming that QUAKE.EXE resides in C:\GAMES\QUAKE you should
   - create the directory C:\GAMES\QUAKE\SERVMODS
   - copy the file PROGS.DAT included in the 'Server Modules' archive 
     to C:\GAMES\QUAKE\SERVMODS
   - start a listen server by 
        QUAKE -GAME SERVMODS -LISTEN 2

### Customizing:
----------------

Customizing requires that you know how to use the program PATCH
See the file 'howpatch.txt' included in the 'Server Modules' archive
(or ftp://ftp.cdrom.com/pub/quake/quakec/howpatch.txt) on how
to obtain a free copy of this program and on how to use it.

Assuming that the directory C:\GAMES\QUAKE\SERVMODS contains a fresh copy 
of unmodified QuakeC sources together with the program QCCDOS you may 
proceed in the following way:

# Unzip the 'Server Modules' archive in C:\GAMES\QUAKE\SERVMODS.

# Patch the sources by typing the command
    PATCH < _SRVMODS.PAT

# Disable/Enable the usage of a specific module by editing the 
  USE_MODULE_* constants in file _MODULES.QH .
  By default you'll find there
      float USE_MODULE_MESSAGES     = 1;
      float USE_MODULE_KICKSUICIDER = 1;
      float USE_MODULE_RANK         = 1;
      float USE_MODULE_OBSERVER     = 1;
      float USE_MODULE_MAPQUEUE     = 0;
      float USE_MODULE_MOTD         = 1;
      float USE_MODULE_SERVER       = 1;
      float USE_MODULE_SKIN         = 1;
  which means that all modules are enabled except of module MapQueue.

# To change the message-of-the-day displayed when a player connects to a
  server you should edit the file _MOTD.QC and change the variable 
  'motd_motd' in the function 'MotdInit'.

# To change the help about server settings (which is displayed when
  connecting to a server or when typing 'help-server') just edit
  the function 'ServerShowServerSettings' in the file _SERVER.QC.

# If you want to inform players about more special properties of your 
  server have a look at the function 'ModulesShowInfo' in the file 
  _MODULES.QC. You can freely add your own messages there.

# The module 'Messages' by default takes care that a player receives no
  messages when picking up ammunition, armor,  etc.
  If you want to allow for some or all of these messages you should edit
  the file _MESSAGE.QH and change the value of the flag 'messages_flag'.

# Changing the formula used by the module 'Rank' for calculating the total
  score requires you to edit the function 'RankCountEvent' in the file
  _RANK.QC in an obvious way.

# The Module 'MapQueue' allows to play through the sequence of maps
  specified in the function 'MapQueueChooseMap' in the file _MAPQUE.QC.
  By default this module is disabled.
  You may enable it (see above) and specify your own sequence of maps by 
  modifying the values of the string variables 'map01', 'map02', etc. in
  this function. For instance, by setting
     map01 = "e1m2";
     map02 = "e1m5";
     map03 = "";
  and starting the server with the +MAP E1M2 flag the server will play
  the maps e1m2,e1m5,e1m2,e1m5,... .
  In the example above the line
     map03 = "";
  is used to indicate the end of the sequence.
  By default you can only specify up to ten maps. If you want more
  you have to change the function  'MapQueueChooseMap' in an
  obvious way.

# Updating the module 'Skin' may become desirable if new skins become
  available in the file PLAYER.MDL which is distributed as part of the
  Multiskin package. The changes you will have to make are trivial,
  just have a look at the file _SKIN.QC.

# Finally compile the sources by typing the command QCCDOS.
  Assuming that compilation succeeded without errors you should now
  copy ..\PROGS.DAT into the directory C:\GAMES\QUAKE\SERVMODS.
  Change directory to C:\GAMES\QUAKE\ and check your changes by typing
     QUAKE -GAME SERVMODS -LISTEN 2
  If you're sure that everything works as expected start your
  dedicated server as usual for instance by
     QUAKE -NOSOUND -NOIPX -NOJOY -DEDICATED 8 +MAP E1M2
  or according to your wishes.

-------------------------------------------------------------------------
      
###### Resources Used:
----------------------

The following impulses are used:

    impulse 200    for command 'skin-next'
    impulse 201    for command 'skin-prev'
    impulse 202    for command 'help-skin'
    impulse 203    for command 'rank'
    impulse 204    for command 'help-rank'
    impulse 205    for command 'help-observer'
    impulse 206    for command 'help-server'

Furthermore the spawnparm parm16 is used to save the player flag
'.float player_flag' across level transitions.

Use the variable 'lookspring' (the cvar) to detect a player's
preferred skin (which allows players to save their preferred skin in
autoexec.cfg without too many side-effects).

-------------------------------------------------------------------------

###### Files:
-------------

_modules.qh
_modules.qc       Structuring of modules.       
_playflg.qh
_playflg.qc       Provide a player flag which is preserved across death
                  and level changing.
_kckscdr.qh       Module KickSuicider (Header)
_kckscdr.qc       Module KickSuicider (Code)
_mapque.qh        Module MapQueue (Header)
_mapque.qc        Module MapQueue (Code)
_message.qh       Module Messages (Header)
_message.qc       Module Messages (Code)
_motd.qh          Module Motd (Header)
_motd.qc          Module Motd (Code)
_observe.qc       Module Observer (Header)
_observe.qh       Module Observer (Code)
_rank.qh          Module Rank (Header)
_rank.qc          Module Rank (Code)
_server.qh        Module Server (Header)
_server.qc        Module Server (Code)
_skin.qh          Module Skin (Header)
_skin.qc          Module Skin (Code)
_srvmods.pat      Patch file containing all changes to be made
                  to the original QuakeC sources.
_srvmods.txt      Documentation.
_changes.txt      History of changes.
progs.dat         A precompiled version of the modifications
                  described here.
COPYING           GNU General Public License
conv.pl           A perl script used to strip/add CR's when switching
                  between Linux and DOS.
howpatch.txt      Provides information on how to patch and on
                  where to get a free copy of the program PATCH.

-------------------------------------------------------------------------
      
###### Copyright:
-----------------

/*
**
** Copyright (C) 1996 Johannes Plass
** 
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** 
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
** 
** Author:   Johannes Plass (plass@dipmza.physik.uni-mainz.de)
**
*/

-------------------------------------------------------------------------
      
###### Acknowledgements:
------------------------

The module 'Skin' is based on Dennis Noordsij's (lnoordsi@inter.NL.net)
Multiskin QuakeC patch. Only a few changes have been made to his code,
with the effect that
  - the value of the variable 'lookspring' is treated as the number
    of the player's preferred skin. This means players don't have
    to choose a skin each time they connect to the server provided
    they put a line 'lookspring x' with x being some number in their
    autoexec.cfg.
  - corpses show the correct skin.
  - skins are preserved  across level changings (so that players have
    to choose their skin only once).
  - the commands 'skin-next' and 'skin-prev' may be used to change
    the skin.
  - the command 'help-skin' provides some help about available
    commands.
  - names for Multiskin-1.1 skins and for Topskin-1.0 skins are shown
    when the player chooses a skin.
  - the code fits the 'Module' meta structure.
Players certainly still have to use proper player and player-head model
files containing the actual skins to be displayed. ServerModules supports
  - the MultiSkin 1.1 PLAYER.MDL file which may be found on 
    Dennis Noordsij's QuakeC page: 
       http://web.inter.NL.net/users/L.J.Noordsij/qc.htm
  - the Top20Skins PLAYER.MDL and H_PLAYER.MDL file included in the
    skin collection
       ftp://ftp.cdrom.com/pub/quake/graphics/mdl/top20skins.zip
       ftp://ftp.cdrom.com/pub/quake/newstuff/top20skins.zip
    When using this set of skins gibbed heads will show the correct
    skin also.

