EDuke.txt
Copyright 2000-2003, Matt Saettler.  All Rights Reserved.

This is the Enhanced Duke (EDuke) readme

EDuke is additional functionality to Duke Nukem 3D(TM) from 3D Releams.
It was created from the original Duke source code by Matt Saettler.

It allows MOD makers to have many more features in their work.

Detailed technical information and a list of MODs that take advantage of 
EDuke is available at www.saettler.com/EDuke

EDuke was programed by Matt Saettler.  

Matt Saettler matts@saettler.com

Matt was assisted in testing and Duke technical information for version 2.0 by:

C3PO
Charlie "CONAN" Honig
Cyborg, James Hollidge, cyborg_jim@yahoo.com
Manson / Imbruglia / Oliver
Photon Man PhotonMan@sigma5.demon.co.uk ICQ: 36644805
James Tan ctan@xtra.co.nz  ICQ: 40072664  WebSite: http://www.dukeworld.com/metalgear
Richard "TerminX" G. (terminx@theoffspring.net) ICQ: 18083569.  AIM: TerminX1
Matthew Palmer/Usurper aesire@hotmail.com
James Ferry http://www.dukeworld.com/oglbt http://holly.mainpage.net http://www.dukeworld.com/nw3 http://www.dukeworld.com/weaponry http://www.dukeworld.com/nw4 ICQ: 32038069
w0rm


Build Notes:

1/18/02
Fixed keyboard interrupt handler in Build per Ken's notes.  It should now
work in Windows XP.


Build 042 (xx/xx/01)
Start of weapon shooting control

Add ATWITH variable to hold type of item being 'shot'.

Build 041 (09/11/01)
Changing player x,y,z now updates the corresponding sprite as well as the
player's current sector.

Build 040 (08/12/01)
Confirmed that it is no longer crashing.  This version ups the 
sprites/tiles back up to 16384.

Build 039 (08/06/01)
Remove processing of voxels in animatesprites; something may be corrupting
voxel data and it was crashing.

Reverting back to original Build engine for testing of crash

Build 38 (07/12/01)
Add startlevel command.
does same thing as level cheat.
startlevel <volumevar> <levelvar>
Starting volume and level is zero (not one)

Build 37 (07/08/01)
Fixed bug in processing of myospalx
Fixed parsing of file name to allow numerals
Added -d command line parm.

This is for DEBUG.

It sets a set of bit flags used for turning on debugging.

Currently defined:

1	COMPILE	dumps a comp.map while compiling.  This lists the offsets of
	the included files in the generated PCode.  Some errors report the
	offset.  Future enhancements will include more details in the MAP
	file as well as more reporting (based on what feedback I get).

Build 36 (07/05/01)
Return sprites/sectors/tiles to original values and released Build source
(instead of parts of NWIV).  Seems to remove crashing bug.
Team to verify and then we'll try increase again.

Build 35 (06/25/01)
Fix bug in compiling myospalx command (missing last agrument)
Added support for voxels

Build 34 (06/20/01)
NWIV version of Build had problems working with Duke.
Now compiling version directly are part of build process.
Large number of sprites/sectors/tiles (16384 for all)

EVENT_CHANGE_WEAPON now sets RETURN to zero.
set to non-zero to not have the weapon be changed.

Build 33 (06/xx/01
Use updated NWIV9 build engine

Build 32 (06/12/01)
Added
gmaxammo
smaxammo

Previous rel added:
RANDVARVAR
MYOSX
MYOSPALX

Build 30 (05/02/01)
Added XORVAR, XORVARVAR

Build 29
Weapon Enhancements

Build 28

Build 27
Compilation encrypted

Build 26
Compilation of CON code

Build 25
Added weapon control (mostly)

------------------------------------------------------------------------------
Build 24

CON Added:
Switch control Statements (switch, case, default, break)
sin command
displayrand command
myos, myospal commands for drawing on display
Event: EVENT_DISPLAYWEAPON

Build 23 (06/20/00)

Build Source is release by Ken!
http://www.advsys.net/ken/buildsrc/default.htm 
(Note that this is NOT the Duke Source)

Changes:
Saved files were not being detected correctly on initialization.
esample.con changed to only show 'user' level-load screen when a user map is being loaded

Build 22 (06/19/00)

Added /Z1 flag to disable Reverb.  It is enabled by default.

Build 21 (06/19/00)

Add 'reverb' bug fix from Ken.
Fix 'load games' hanging
Fix expander shooting

Known bugs:
1) pistol firing animation shows one frame too many

Build 20 (06/18/00)

Increase maximum sounds from 450 to 900


Build 19 (06/17/00)

More corrections to weapon behavior.

Known bugs:
1) pistol firing animation shows one frame too many
2) expander doesn't show projectile
3) firing freeze doesn't update the ammo count in the small display

Build 18 (06/17/00)

All default weapons to work basically like Duke's (per email from Photon Man)

Build 17 (06/17/00)

Slow down pistol fire rate (default weapon settings)

Build 16 (06/11/00)

Added variable

myconnectindex

player ID of 'local' player

screenpeek

player ID of player view shown on local screen (not always same as myconnectindex)

Added commands
addvar
addvarvar

To compliment subvar and subvarvar

Added
ifvarvarn, ifvarn 
if var not equal

to compliment ifvare, l and g



Build 15 (04/29/00)



Ah, weekends...

Added more global variables.  These ones are per-sprite, so I've just added them to the sprite labels.

They are from the global hittype structure.  They duplicate some of the names from the sprite data, so I've prefixed them all with 'ht'

They are:

htcgg

Control when to get new globalz data.  Set to 6 after data is calculated and counted down after that.

Initialized to zero.

htpicnum

The picture number.
This is what is compared when checking to see 'ifwasweapon'
and 'ifspawnedby'
htang

angle used sometimes instead of sprite's angle.

htextra

Varius uses depending on state...  
Seems related to amount of damage.

-1 if no damage to process.

htowner

Set to sprite's owner. set to who 'caused' damage

htmovflag
Saved results from trying to move the sprite.

ifnotmoving checks for : (hittype[g_i].movflag&49152) > 16384 );
httempang

varied uses depending on instance.

set to old pal when 'spritepal'

htactorstayput

-1 means stay.

>=0  means sector ID to stay in.


set for current actor when you call addkills

htdispicnum

Set to -4 to don't show shadows on actors.

httimetosleep

if >1, then this is counted down.
When it reaches 1, the sprite is changed to statlist 2 (active)

set by many things internally.

Directly set by 'sleeptime'

htfloorz
htceilingz

set when cgg <=0.  Current sectors information.

htlastvx
htlastvy

Where target player was last known to be.
Used in 'seeking' player.

htbposx
htbposy
htbposz

'bob' position???

	gt[0]
moving angle used to calculating 'turning towards player', etc.

set directly by 'count' command.

Checked by 'ifcount' command

	gt[1]
The moveptr.  What movement is desired. (from move command)

	gt[2]
The action counter.  used by ifactioncount. 

	gt[3]
temp used in processing of action

	gt[4]
The current action to perform. (from move command) (and action command)

if > 0 then action is counted and performed.  and lotag is incremented by TICSPERFRAME

	gt[5]
The current AI id

Stat lists

0 (used to search for pool ball pockets) (and OCEANSPRITE4 & FEMMAG1&2 & MASKWALLn) (and CRANE)
1 Actors
2 FTA (active actors)
3 effectors
4 weapons (shots)
5 explosions (things going away?)
6 standables
7 Locators (?)
8 ACTIVATOR, ACTIVATORLOCKED
9 transporters
10 players
11 FX
12 fallers
13 dummy players (for when on water, etc)
15 SECTOREFFECTOR with lotag of 40->45



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

god
	Toggled by 'God' cheat.  KROZ and CORNHOLIE in Duke

	This prevents any weapon from doing damage to APLAYER

	It also is used to reset the player health to max and
    player's cstat to 257(10)

	It also is used to check whether to kill the player when they are 'in space'


warp_on
	Initialized to zero at game start

	This is set to 1 if a specific level (-L) or volume (-V) is specified on the command line.

	It is set to the number +2 of the numeric command line option (-3 sets to 5) (to load a saved game) (and then later the game is loaded)

	It is set to 1 if a board (map) was specifed on the command line. (and then later the level is loadded)

cashman
	Is toggled when the 'cashman' cheat is used.

	If turned on and the player presses 'space', then lotsofmoney()

eog
  No longer used.  Was set by now-reserved cheat.  Looks like it ends current level and goes back to the menu. (thisplayer.gm set to MODE_MENU)

showallmap
	Toggled by the cheat.

show_help

	Initialzed to zero.

	Used to enumerate through the help pages.

scrollmode

 Contains the toggle of the 'map follow mode'

When overhead_on is set, and 'map follow mode' button is pressed, then
        if(ud.scrollmode)
        {
            ud.folx = ps[screenpeek].oposx;
            ud.foly = ps[screenpeek].oposy;
            ud.fola = ps[screenpeek].oang;
        }
(screenpeek) is the player ID of the view that is being displayed.

When moving, the following check is made after calculating player velocity:
    if(ud.scrollmode && ud.overhead_on)
    {
        ud.folfvel = vel;
        ud.folavel = angvel;
        loc.fvel = 0;
        loc.svel = 0;
        loc.avel = 0;
        loc.horz = 0;
        return;
    }

This saves the calculated velocity and angle into userdefs (ud) and sets the player's current movement to 0.

clipping
	Toggled by the 'clip' cheat.  

	Allows movement through walls/floors/etc. (turns off movement checking)

user_name[MAXPLAYERS][32]

Array of the player's names in multiplayer.  Not currently accessible through CON.

ridecule[10][40]

 The text of the 10 taunts for the local player (what text gets sent).
 Not currently accessible.

savegame[10][22]
	The file names of the saved games.
   Not currently accessible.

pwlockout[128]
 The parental lockout password loaded from the config file.
   Not currently accessible.

rtsname[128]
  The file name of the RTS file being used.
   Not currently accessible.

overhead_on
	Toggle for map view.  Non-zero if local user is in map view.

last_overhead

Used as a funky flag to determine if the 'map' button turns map mode on or off.

showweapons
	Toggle turned on and off by 'show opponents weapon' button.
	Initialized to zero.

pause_on
	Initialized to zero.
	If 1, then 'Game Paused' is displayed.
	No input/movement processing occurs while pause_on is set (non-zero)
	Toggled by the 'pause' button on any player's input.

from_bonus
	
	The level that the players (all of them) came from if this is a 'bonus' level.
	When exiting the 'bonus' level, the game will take the players to from_bonus+1 instead of the current +1

camerasprite
	Sprite ID of the current camera.  Initialized to -1 (no current camera sprite)
	This is the sprite ID to use as the player's view.

	Set by the actor when player pressing space  when current player's view is the local player


last_camsprite
	Used to save the camerasprite.  If there was a change, then camera_time is updated with the current clock

last_level

 Initialized to -1
 When entering a level, it's set the NEXT level number (yeah, it doens't make sense to me, either..)

secretlevel

Initialized to zero.
 When hitting a Nuke butoon with a palette set, secretlevel is set to the nuke button's lotag (if palette is not set, then it's not modified..)

const_visibility
	Used to reset player's visibility value when it's 'time'.  'next' time is kept in global lastvisincs.
   It doesn't appear to be initialized....

uw_framerate

	Not set nor used.

camera_time
	Set to current time + TICRATE*2 when camera sprite changes.
	Doesn't appear to be used by anything.


folfvel
folavel
folx
foly
fola

Follow angle, velocity and position.
fola = folavel >> 3
Used for map mode.

reccnt

Initialized to zero when starting a demo recording.

Number of recorded input buffers.  Used for caching buffers before writing
reset to zero after buffers are flushed.


entered_name
	Not initialized nor used.

screen_tilting
	Toggle read from CONFIG file and toggled by menu item.
	Used to turn on/off screen titlting

shadows
	Toggle read from CONFIG file and toggled by menu item.
	Used to turn on/off shadows.


fta_on

Toggle for whether to show quotes (local player only).  Toggled by F8
Initialized to 1


executions

Count of the number of times Duke has been run.  

If >50 and shareware version, display nag.

Read/saved from CONFIG file.

auto_run

Run mode setting from CONFIG file.
Toggled by 'AutoRun' button.

coords
If on, then coordinates of the current player's view are displayed (screenpeek).
Toggled by 'coords' cheat and -W command line argument

tickrate

If on, then frames/second are shown

Toggled by 'allen' cheat.

m_coop
	Set to -C command line argument
	Set to 0 for -Q argument
coop
	Both are set to the same thing.
	coop is used in the code for checking.
	m_coop is used to transmit game mode over network.

screen_size
The screen size for local user.  

Made smaller by 'Enlarge Screen' button (-4)
Made bigger by 'Shrink Screen' button (+4)

lockout

Is parental lockout on?  Non-zero if yes.

crosshair

Toggled by 'Toggle Crosshair' button.
Turns on and off crosshair

wchoice[MAXPLAYERS][MAX_WEAPONS]

Weapon Choice array.  Not currently accessible.

playerai

non-zero if using computer AI

Set to 1 by -A command line

m_respawn_items
m_respawn_monsters
m_respawn_inventory
m_monsters_off
m_ffire
ffire
monsters_off
respawn_monsters
respawn_items
respawn_inventory

Both set the same.  Controls settings.

m_recstat
recstat
Set to 1 if demo is currently being recorded.
Set to 1 by -R command line flag
Set to 2 when playing back a demo


brightness

Decreasd by shift+F11 (-4).  Increased by +4 for F11.  Max is 7<<2.  Min is 0

detail

Saved/loaded from CONFIG

Set by menu item.
 one is 'high', zero is 'low'

m_player_skill
player_skill

Player skill.  Both are set the same.
from 0 to 4.  

m_level_number
level_number
m_volume_number
volume_number

Current Level# and Volume.  Set when starting.  Set to Vol=0, level=7 when loading 'user' level.

multimode

Number of players.  

Used in many places to control display of items as well as game configuration, packet modes, etc.

For -Q. multimode is set to the # passed in.

m_marker
marker

Controls respawn marker.

mouseflip

mouse flip mode.  non-zero to flip.

Read from "mouseaimingflipped" from CONFIG



Build 14 (04/28/00)

Fixed bug in SQRT, findnearactor that caused mis-interpret internally.

Added espawnvar.  Works like espawn, but takes a VAR argument

Added access to global data structure USERDEFS.  This is used for lots of control over how the game works.

Structure:

typedef struct user_defs
{
    char god,warp_on,cashman,eog,showallmap;
    char show_help,scrollmode,clipping;
    char user_name[MAXPLAYERS][32];
    char ridecule[10][40];
    char savegame[10][22];
    char pwlockout[128],rtsname[128];
    char overhead_on,last_overhead,showweapons;

    short pause_on,from_bonus;
    short camerasprite,last_camsprite;
    short last_level,secretlevel;

    long const_visibility,uw_framerate;
    long camera_time,folfvel,folavel,folx,foly,fola;
    long reccnt;

    int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
    int32 coords,tickrate,m_coop,coop,screen_size,lockout,crosshair;
    int32 wchoice[MAXPLAYERS][MAX_WEAPONS],playerai;

    int32 respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
    int32 m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
    int32 m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
    int32 player_skill,level_number,volume_number,m_marker,marker,mouseflip;

};



Some of these are self-explanatory.

m_ prefix means multi-player.

As with the other structures, there isn't currently access to the member vars that are arrays.

This is almost the last structure that needs to get 'published' to allow
almost complete control from CONs.

I'll document what some of these members do a little later.

Have fun.


Build 13 (04/26/00)

Add SQRT command.

sqrt <invar> <outvar>

Puts sqrt(<invar>) into <outvar>

Fixed bug in get/setplayer that may have been cause other player's data to get set.

And the biggie:

Added eventloadactor

eventloadactor <tile>
{
}

Works like 'useractor', but only takes tile number.

Code is executed when actor is first loaded into the map.

sizeat should work here....

I'll probably need to expand it to deal with spawn(), too (it currently doesn't)



Build 12 (04/14/00)

Another big update.  

You can now use THISACTOR to get the actor ID of the current actor (read-only)

Also:
getplayer
setplayer

These allow direct control of player-specific data.

You can get the current player by using THISACTOR as the index.

This is another big step in allowing CONs to have complete
control over the action.

My goal is to be able to have all of the weapon processing code
moved into the CONs.

There are a TON of player variables.  Here's a (long) list:

zoom
exitx
exity
loogiex[64]
loogiey[64]
numloogs
loogcnt
posx
posy
posz
horiz
ohoriz
ohorizoff
invdisptime
bobposx
bobposy
oposx
oposy
oposz
pyoff
opyoff
posxv
posyv
poszv
last_pissed_time
truefz
truecz
player_par
visibility
bobcounter
weapon_sway
pals_time
randomflamex
crack_time
aim_mode
ang
oang
angvel
cursectnum
look_ang
last_extra
subweapon
ammo_amount[MAX_WEAPONS]
wackedbyactor
frag
fraggedself
curr_weapon
last_weapon
tipincs
horizoff
wantweaponfire
holoduke_amount
newowner
hurt_delay
hbomb_hold_delay
jumping_counter
airleft
knee_incs
access_incs
fta
ftq
access_wallnum
access_spritenum
kickback_pic
got_access
weapon_ang
firstaid_amount
somethingonplayer
on_crane
i
one_parallax_sectnum
over_shoulder_on
random_club_frame
fist_incs
one_eighty_count
cheat_phase
dummyplayersprite
extra_extra8
quick_kick
heat_amount
actorsqu
timebeforeexit
customexitsound
weaprecs[16]
weapreccnt
interface_toggle_flag
rotscrnang
dead_flag
show_empty_weapon
scuba_amount
jetpack_amount
steroids_amount
shield_amount
holoduke_on
pycount
weapon_pos
frag_ps
transporter_hold
last_full_weapon
footprintshade
boot_amount
scream_voice
gm
on_warping_sector
footprintcount
hbomb_on
jumping_toggle
rapid_fire_hold
on_ground
name[32]
inven_icon
buttonpalette
jetpack_on
spritebridge
lastrandomspot
scuba_on
footprintpal
heat_on
holster_weapon
falling_counter
gotweapon[MAX_WEAPONS]
refresh_inventory
palette
toggle_key_flag
knuckle_incs
walking_snd_toggle
palookup
hard_landing
max_secret_rooms
secret_rooms
pals[3]
max_actors_killed
actors_killed
return_to_center

As of this build, the array-based variables are not supported.

In addition, palette is not supported (it's a pointer...)

Build 11 (04/05/00)

bug fixed in findnearactor that cause infinite loop
Changed to search ALL actors, not just those in same sector

Added espawn

This is just like spawn, but returns the actor ID in the var RETURN


Build 10 (04/04/00)


findnearactor <type> <maxdist> <actorID>
findnearactorvar <type> <maxdistvar> <ActorID>

This gets the sprite ID of the nearest actor (sprite) of type type 
into <ActorID>

If none are found, then <var> will be -1

This currently only searches the current sector while looking.  
Let me know if it needs to expand beyond that... (they did)

And then we have:

setactorvar[<actorID>].<avar> <var>
getactorvar[<actorID>].<avar> <var>

These get and sector the per-actor variables <avar> belonging to the actor <actorID> to/from <var>

You can safely pass an <actorID> of -1, but nothing will get set;  You'll probably want to check for that case in your code anyway...

This is a bit complicated.  You should have seen the processing code.... I almost got a headache :)

These should allow easy inter-actor communication.

You can get <actorID> from other places (like .owner).  These actorIDs never change unless the actor dies. (they are set when the actor is spawned...)  

So, you can save the actorID across calls in a variable....  That should make for some fun stuff...  


Build 09 (03/03/00)

o Access to Wall, Sector and Actor (sprite) structures
o Access to 'ME' actor and sector

Syntax:

getwall[<var>].member <var2>

Gets the value of the member of the wall structure into var2

setwall[<var>].member <var2>

setactor
getactor
setsector
getsector

WARNING: no error checking or game checking is (currently) done on
the settings.  You can easily set things that can cause the game to crash.


Structures:

SECTOR:

wallptr
wallnum
ceilingz
floorz
ceilingstat
floorstat
ceilingpicnum
ceilingheinum
ceilingshade
ceilingpal
ceilingxpanning
ceilingypanning
floorpicnum
floorheinum
floorshade
floorpal
floorxpanning
floorypanning
visibility
filler
lotag
hitag
extra

WALL:

x
y
point2
nextwall
nextsector
cstat
picnum
overpicnum
shade
pal
xrepeat
yrepeat
xpanning
ypanning
lotag
hitag
extra

SPRITE (ACTOR):

x
y
z
cstat
picnum
shade
pal
clipdist
filler
xrepeat
yrepeat
xoffset
yoffset
sectnum
statnum
ang
owner
xvel
yvel
zvel
lotag
hitag
extra


Build 08 (02/01/00) 
o Testing Team expanded
o lockplayer required an unused third parameter.
o multiplayer game names still had WW2GI names (GI Match, etc) 

Build 07 (01/24/00) 
o bug fix to processing of ifvarvar? commands.   Optional else parsing was not correct and caused script to go into space.
o MAJOR bug in processing of gamevar.  It was using "initial value" for 'flags'.  This caused per-actor and per-player variables to, well, not be.  

Special thanks to Veldrik for helping me find these bugs.


Build 06 (01/23/00)

o control names back to Duke names
o ifp prunning should return TRUE for both RUN and auto-run (113)
o numerous CON commands added:

mulvar <VAR1> <value>
	<VAR1> = <VAR1> * <value>
mulvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> * <VAR2>
	multiplication with result in <VAR1>

divvar <VAR1> <value>
	<VAR1> = <VAR1> / <value>
divvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> / <VAR2>
	division with result in <VAR1>

modvar <VAR1> <value>
	<VAR1> = <VAR1> % <value>
modvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> % <VAR2>
	modulo (remainder) with result in <VAR1>

andvar <VAR1> <value>
	<VAR1> = <VAR1> & <value>
andvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> & <VAR2>
	logical AND with result in <VAR1>

orvar <VAR1> <value>
	<VAR1> = <VAR1> | <value>
orvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> | <VAR2>
	logical OR with result in <VAR1>

getplayerangle <VAR>
setplayerangle <VAR>
	gets and sets the current player's angle

lockplayer <VAR>
	locks the player movement for <VAR> count.  This is the same as 'transporter hold' where the player can't move for a while after moving through a transporter.

Build 05 (01/14/00)

o Set weapon defaults back to Duke defaults
o Set save-game default name to be different from Duke saved games so that they don't conflict.
o fix bug with ifsound not processing 'else'
o add getangletotarget <VAR>
o add setactorangle <VAR> (81)
o add getactorangle <VAR> (81)

This allows, 'faceplayer', by calling:
getangletotarget ANGLE
setactorangle ANGLE

Since the angle is not directly set to 'face target', the CON programmer has control over how fast the actor can face the player.  The actor can also face AWAY from the target by adding 1024 to the angle.

Future commands will also allow more usage of these commands...

o re-enabled all Duke cheats (some were disabled in WW2GI) (names are still WW2GI names (ie, 'blood' for Duke's 'stuff')
o change cheat pre-fix to 'MS' instead of 'WW' (it's 'DN' for Duke 1.x)


Enhanced Duke enhancements.

01/10/00

I've spent quite a bit of time adding enhancements to the code so that you,
the CON programmer can have more fun.

This file is the description of what I've added.

*************************
**** EDITS NEEDED HERE....
For more information on programming for WW2GI, check out 
http://www.saettler.com/ww2gi

-Matt Saettler

matts@saettler.com
matts@seanet.com

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

	VARIABLES! 

These will be usable by the CON as well as special variables will be used 
by the weapon system. 

These variables are CASE SENSITIVE. (FOOBAR is NOT the same as FooBar)

There are 'system' variables that allow you to change the way the weapon
(and other) systems work.

In addition, you can add your own variables in your code.  Take a look
at what Tuco has done in these CONs: there's some pretty amazing stuff.

I'm sure that you can come up with more.

	Here's what I've got so far: 

	gamevar <name> <value> <flags>
Defines and sets the initial value for a variable.  

Valid flags are 
0	Global (default)
1	PERPLAYER	Variable is per-player
2	PERACTOR	Variable is per-actor

	ifvarg <name> <value> 
	ifvarl <name> <value> 
	ifvare <name> <value> 
	ifvarvarg <name1> <name2> 
	ifvarvarl <name1> <name2> 
	ifvarvare <name1> <name2> 
Does the usual 'if' processing on the variable (g=greater than, l=less 
than) 

	setvar <name> <value> 
Sets the value of the variable 

	addvar <name> <value> 
add <value> to variable.  <value> can be negative 

	addvarvar       <name1> <name2> 
adds <name2> to <name1> with the result in <name1> 

	setvarvar <name1> <name2> 
sets <name1> equal to <name2> 

	spgetlotag
gets the current sprite's (actor) lotag into the variable LOTAG

	spgethitag
gets the current sprite's (actor) hitag into the variable HITAG

	sectgetlotag
gets the current sector (where the actor current is located) into the variable LOTAG

	sectgethitag
gets the current sector (where the actor current is located) into the variable HITAG

ifsound <sound>
	checks to see if sound is currently playing

gettexturefloor
	gets the texture (tile #) of the sector of the current actor into 'TEXTURE'

gettextureceiling
	gets the texture (tile #) of the sector of the current actor into 'TEXTURE'

gettexturewall
	gets the texture (tile #) of the nearest wall to the current actor into 'TEXTURE'
	NOT YET IMPLEMENTED.  YOU WILL GET A COMPILE ERROR IF YOU TRY TO USE.

starttrack <value>
	starts the track for this episode.  Tracks are specified by the 'music' 
	command.  The value is the offset into the list to use.  
	This is zero based (ie, zero is the first midi file listed)

randvar <var> <value>
	generates a random number from 0 to <value> and places it into <var>	

getangletotarget <VAR>
	gets the angle to the target.  For now, must call ifcansee to set up the target.  Future versions will allow better 'target finding...'

setactorangle <VAR>
	sets the angle of the actor to the angle in <var>.  angle wraps at 2048.
	
getactorangle <VAR>
	gets the current angle of the actor in <var>

mulvar <VAR1> <value>
	<VAR1> = <VAR1> * <value>
mulvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> * <VAR2>
	multiplication with result in <VAR1>

divvar <VAR1> <value>
	<VAR1> = <VAR1> / <value>
divvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> / <VAR2>
	division with result in <VAR1>

modvar <VAR1> <value>
	<VAR1> = <VAR1> % <value>
modvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> % <VAR2>
	modulo (remainder) with result in <VAR1>

andvar <VAR1> <value>
	<VAR1> = <VAR1> & <value>
andvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> & <VAR2>
	logical AND with result in <VAR1>

orvar <VAR1> <value>
	<VAR1> = <VAR1> | <value>
orvarvar <VAR1> <VAR2>
	<VAR1> = <VAR1> | <VAR2>
	logical OR with result in <VAR1>

getplayerangle <VAR>
setplayerangle <VAR>
	gets and sets the current player's angle

lockplayer <VAR>
	locks the player movement for <VAR> count.  This is the same as 'transporter hold' where the player can't move for a while after moving through a transporter.

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

	There are pre-defined 'system' variables that can be overridden 

	So, for example: 
gamevar FAVORITE_WEAPON 0 1
gamevar GOTBIGCLIP 0 1
gamevar ALIENSKILLED 0 0
gamevar MYTARGET 0 2

Defines a new variable of 'FAVORITE_WEAPON' per-player.

Defines a per-player variable of 'GOTBIGCLIP' with the initial value of zero 

Defines a global variable of 'ALIENSKILLED' with an initial value of zero

Defines a per-actor variable of 'MYTARGET' with an initial value of zero

In the code (for example, in a state or actor), the following could be 
executed:

	// use GOTBIGCLIP as a 'boolean' >0 mean 'true' 
ifvarg GOTBIGCLIP 0 
{ 
        setvar WEAPON1_CLIP 30 
        setvar GOTBIGCLIP 0     // so we don't keep executing 
} 

Most weapons work exactly the same.  Exceptions are: HANDBOMB_WEAPON and
HANDREMOTE_WEAPON.

Note that the weapon DISPLAY is still the same (it DOES uses WORKSLIKE).
This means that tile numbers, weapon movement, etc is still the same old way...


The variables work together like this:


Player presses 'fire'
'initialsound' is played (if set to non-zero)
Animation is started

During animation, frames are counted off.

At each frame, the following is the psuedo code that is processed for all 
weapons except HANDBOMB_WEAPON and HANDREMOTE_WEAPON:

At 'spawntime', spawn the item (if set)
At 'sound2time', make the sound (if set)
At 'firedelay', shoot the item(s)
if currentframe > 'firedelay' currentframe and < 'totaltime'
	if 'automatic'
	   if 'fireeveryother'
		if <everyother>
			shoot
	    else if 'fireeverythird'
		if <everythird>
			shoot
else if currentframe >= 'totaltime'
	if "clip reload in progress"
		at 'totaltime' +1 make EJECT_CLIP sound
		at "2/3 way through reload" make INSERT_CLIP sound
		at 'reload' end animation
	else
		if 'automatic' and "still firing"
			repeat animation
		else
			stop animation


Weapon Settings:

Certain combinations of settings may (can) cause the program to crash....

The weapon system currently uses 'worklike' to control how the weapon works.

Many things in the code are still hard-coded (such as weapon position, etc).

Not all settings are supported by all weapon 'modes'.  For example, Sound2Time
is only supported by the 'SHOTGUN_WEAPON'.

SHOOTS          what the weapons shoots (RPG, SHOTSPARK1, etc) 
FIREDELAY       delay (in animation frames) before 'shot' 
HOLDDELAY       delay (in animation frames from start) for between 'shoot' and 'reload clip' 
TOTALTIME       delay after 'fire' before recycle to ready to fire again 
SPAWN           item to spawn (if non-zero).  Use for SHELLS, SHOTGUNSHELL, etc 
SPAWNTIME       frame for when to spawn 
FLAGS           holds flags to control wepon operation (AUTOMATIC FIRE, BURSTS (like devistator), etc) 
CLIP            Number of ammo in a 'clip' (zero means no clip) 
SpawnTime		the frame at which to spawn an item
Spawn			the item to spawn
ShotsPerBurst	number of shots per 'burst' (one ammo per 'burst'
WorksLike		What original the weapon works like
InitialSound	Sound made when initialy firing. zero for no sound
FireSound		Sound made when firing (each time for automatic)
Sound2Time		Alternate sound time (ie, shotgun cocking)
Sound2Sound		Alternate sound sound ID

//Weapon Flags:
WEAPON_FLAG_HOLSTER_CLEARS_CLIP	1  'holstering' clears the current clip

WEAPON_FLAG_GLOWS 2  weapon 'glows' (shrinker and grower)

WEAPON_FLAG_AUTOMATIC	4  automatic fire (continues while 'fire' is held down

WEAPON_FLAG_FIREEVERYOTHER	8  during 'hold time' fire every frame

WEAPON_FLAG_FIREEVERYTHIRD	16  during 'hold time' fire every third frame.

WEAPON_FLAG_RANDOMRESTART	32  restart for automatic is 'randomized' by RND 3

WEAPON_FLAG_AMMOPERSHOT 64  uses ammo for each shot (for automatic)

WEAPON_FLAG_BOMB_TRIGGER 128  weapon is the 'bomb' trigger

WEAPON_FLAG_NOVISIBLE 256  weapon use does not cause user to become 'visible'

WEAPON_FLAG_THROWIT 512  weapon 'throws' the 'shoots' item...

WEAPON_FLAG_CHECKATRELOAD 1024  check weapon availability at 'reload' time

WEAPON_FLAG_STANDSTILL 2048  Player stops jumping (like old Trip bomb)


The defaults for Duke3D are:

// KICK
gamevar WEAPON0_WORKSLIKE 0 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON0_CLIP 0 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON0_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_FIREDELAY 7 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_TOTALTIME 14 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_HOLDDELAY 14 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_FLAGS WEAPON_FLAG_NOVISIBLE GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SHOOTS KNEE GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON0_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Pistol
gamevar WEAPON1_WORKSLIKE 1 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON1_CLIP 12 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_TOTALTIME 6 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_FLAGS WEAPON_FLAG_AUTOMATIC GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SHOOTS SHOTSPARK1 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SPAWNTIME 2 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SPAWN SHELL GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_FIRESOUND 3 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON1_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Shotgun
gamevar WEAPON2_WORKSLIKE 2 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON2_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_RELOAD 13 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_TOTALTIME 31 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_FLAGS WEAPON_FLAG_CHECKATRELOAD GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SHOOTS SHOTGUN GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SPAWNTIME 24 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SPAWN SHOTGUNSHELL GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SHOTSPERBURST 7 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_FIRESOUND 109 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SOUND2TIME 15 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON2_SOUND2SOUND 169 GAMEVAR_FLAG_PERPLAYER 

// Chaingun
gamevar WEAPON3_WORKSLIKE 3 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON3_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_FIREDELAY 1 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_TOTALTIME 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_FLAGS 84 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SHOOTS CHAINGUN GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SPAWN SHELL GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_FIRESOUND 6 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON3_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// RPG
gamevar WEAPON4_WORKSLIKE 4 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON4_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_TOTALTIME 20 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_FLAGS 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SHOOTS RPG GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON4_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// PipeBomb
gamevar WEAPON5_WORKSLIKE 5 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON5_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_FIREDELAY 6 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_TOTALTIME 19 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_HOLDDELAY 12 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_FLAGS WEAPON_FLAG_THROWIT GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SHOOTS HEAVYHBOMB GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON5_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Shrinker
gamevar WEAPON6_WORKSLIKE 6 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON6_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_RELOAD 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_TOTALTIME 12 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_FLAGS WEAPON_FLAG_GLOWS GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SHOOTS SHRINKER GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_INITIALSOUND 11 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON6_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Devastator
gamevar WEAPON7_WORKSLIKE 7 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON7_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_HOLDDELAY 5 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_FLAGS WEAPON_FLAG_FIREEVERYOTHER GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SHOOTS RPG GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON7_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Tripbomb
gamevar WEAPON8_WORKSLIKE 8 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON8_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_RELOAD 30 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_TOTALTIME 16 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_FLAGS WEAPON_FLAG_STANDSTILL GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SHOOTS HANDHOLDINGLASER GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON8_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Freezethrower
gamevar WEAPON9_WORKSLIKE 9 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON9_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_RELOAD 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_FLAGS WEAPON_FLAG_FIREEVERYOTHER GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SHOOTS FREEZEBLAST GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_FIRESOUND 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON9_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// ?
gamevar WEAPON10_WORKSLIKE 10 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON10_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_RELOAD 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_TOTALTIME 10 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_FLAGS 384 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SHOOTS 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON10_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER 

// Expander
gamevar WEAPON11_WORKSLIKE 11 GAMEVAR_FLAG_PERPLAYER
gamevar WEAPON11_CLIP 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_RELOAD 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_FLAGS WEAPON_FLAG_GLOWS GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SHOOTS GROWSPARK GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SPAWN 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_INITIALSOUND 388 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_FIRESOUND 388 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER 
gamevar WEAPON11_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER

WW2GI Defaults are:
gamedef WEAPON0_WORKSLIKE 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FIREDELAY 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_TOTALTIME 14 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_HOLDDELAY 14 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FLAGS 36 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SHOOTS 2521 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON0_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_WORKSLIKE 1 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_CLIP 20 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_RELOAD 50 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FLAGS 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SHOOTS 2595 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SPAWNTIME 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_FIRESOUND 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON1_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_WORKSLIKE 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_RELOAD 13 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_TOTALTIME 31 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FLAGS 1024 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SHOOTS 2613 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SPAWNTIME 24 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SPAWN 2535 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SHOTSPERBURST 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_FIRESOUND 109 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SOUND2TIME 15 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON2_SOUND2SOUND 169 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_WORKSLIKE 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FIREDELAY 1 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_TOTALTIME 12 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_HOLDDELAY 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FLAGS 84 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SHOOTS 2536 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_FIRESOUND 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON3_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_WORKSLIKE 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_TOTALTIME 20 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FLAGS 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON4_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_WORKSLIKE 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FIREDELAY 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_TOTALTIME 19 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_HOLDDELAY 12 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FLAGS 512 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SHOOTS 26 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON5_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_WORKSLIKE 6 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FIREDELAY 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_TOTALTIME 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FLAGS 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SHOOTS 2556 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_INITIALSOUND 11 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON6_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_WORKSLIKE 7 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_HOLDDELAY 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FLAGS 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON7_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_WORKSLIKE 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_TOTALTIME 16 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FLAGS 2048 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SHOOTS 2563 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON8_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_WORKSLIKE 9 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FLAGS 8 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SHOOTS 1641 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_FIRESOUND 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON9_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_WORKSLIKE 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_RELOAD 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_TOTALTIME 10 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FLAGS 384 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SHOOTS 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON10_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_WORKSLIKE 11 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_CLIP 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_RELOAD 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_TOTALTIME 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FLAGS 2 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SHOOTS 2448 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SPAWN 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_INITIALSOUND 388 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_FIRESOUND 388 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef WEAPON11_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef GRENADE_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef GRENADE_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER //  (system)
gamedef RESPAWN_MONSTERS  0 0 //  (system)
gamedef RESPAWN_ITEMS  0 0 //  (system)
gamedef RESPAWN_INVENTORY  0 0 //  (system)
gamedef MONSTERS_OFF  0 0 //  (system)
gamedef MARKER  0 0 //  (system)
gamedef FFIRE  0 0 //  (system)
gamedef LEVEL  0 0 //  (system) (read only)
gamedef VOLUME  0 0 //  (system) (read only)
gamedef COOP  0 0 //  (system)
gamedef MULTIMODE  0 0 //  (system)
gamedef WEAPON 0 0 //  (system) (read only)
gamedef WORKSLIKE 0 0 //  (system) (read only)
gamedef RETURN 0 0 //  (system)
gamedef ZRANGE 0 0 //  (system)
gamedef ANGRANGE 0 0 //  (system)
gamedef AUTOAIMANGLE 0 0 //  (system)

Weapon setting defaults can be set in the CON for all players by defining the var with a new default (flags are ignored).  For instance:

gamevar WEAPON1_CLIP 12 0


Sets the 'clip' for the PISTOL_WEAPON to 12


-----------------------------------------------------------------------------
SYSTEM VARIABLES.

These variables allow the CON programmer to take action and modify system
performance.

They are:

RESPAWN_MONSTERS
RESPAWN_ITEMS
RESPAWN_INVENTORY
MONSTERS_OFF
COOP
MARKER
FFIRE
LEVEL	Read-only.  The current level number
VOLUME	Read-only.  The current volume number

TRIPBOMB_CONTROL
	1 for a Trip wire (default)
	2 for a timer
	3 for both (not tested)


------------------------------------------------------------------------------
EVENTS

Events allow the CON programmer to change the processing on an event.

Events are defined in enhance.con

Event blocks are started with 'onevent' and ended by 'endevent'

So,

onevent EVENT_INIT
{
}
endevent

Events are:

EVENT_INIT

Called when game is initialized, just after script is parsed.  
Only called once per game.

EVENT_ENTERLEVEL

Called when a level is being entered
'LEVEL' is level number
'VOLUME' is volume number

EVENT_RESETWEAPONS

Called when player's weapons are reset.  This happens when they enter a level, and each time they 'come to life'

EVENT_RESETINVENTORY

Called when player's inventory is reset.

EVENT_HOLSTER

The player has pressed the 'holster' key.

Set 'RETURN' to zero to allow default processing (the default is to allow processing).

You can also execute any code in the event handler (such as changing weapon flags, etc)

EVENT_LOOKLEFT

The player hit the 'look left' key.

Set 'RETURN' to zero to allow default processing

EVENT_LOOKRIGHT

The player hit the 'look right' key.

Set 'RETURN' to zero to allow default processing

EVENT_SOARUP

The player hit the 'JUMP' key while the jetpack is active.

Set 'RETURN' to zero to allow default processing

EVENT_SOARDOWN

The player hit the 'Crouch' key while the jetpack is active.

Set 'RETURN' to zero to allow default processing

EVENT_CROUCH

The player hit the 'crouch' key.

Set 'RETURN' to zero to allow default processing

EVENT_JUMP

The player hit the 'Jump' key.

Set 'RETURN' to zero to allow default processing

EVENT_RETURNTOCENTER

The player hit the 'Return to center' key.

Set 'RETURN' to zero to allow default processing

EVENT_LOOKUP

The player hit the 'look up' key.

Set 'RETURN' to zero to allow default processing

EVENT_LOOKDOWN

The player hit the 'look down' key.

Set 'RETURN' to zero to allow default processing

EVENT_AIMUP

The player hit the 'aim up' key.

Set 'RETURN' to zero to allow default processing

EVENT_AIMDOWN

The player hit the 'aim down' key.

Set 'RETURN' to zero to allow default processing

EVENT_FIRE

The player hit the 'Fire' key.

'WEAPON' is set to the weapon ID that is firing.
'WORKSLIKE' is set to the weapon's WorkLike setting.

So,

onevent WEAPON_FIRE
{
	ifvare WOKSLIKE PISTOL_WEAPON
	{
		ifvare PISTOLJAMMED 1
		{
			setvar RETURN 1	// don't fire if jammed
			setvar PISTOLJAMMED 0	// unjam it for next time
		}
	}
}
endevent

Set 'RETURN' to zero to allow default processing

EVENT_CHANGEWEAPON

The player is changing weapons.

The new weapon is in 'WEAPON' and 'WORKSLIKE'

-1 means 'no weapon'

There is no return value.

EVENT_GETSHOTRANGE

Called when the player is shooting.

The current weapon is in 'WEAPON' and 'WORKSLIKE'

Return the shot random distribution in 'ANGRANGE' and 'ZRANGE'.

Default is '32', and '256'.  Numbers must be a power of two.

onevent EVENT_GETSHOTRANGE
{
 addlogvar WORKSLIKE	// log the current value (debugging)
 ifvare WORKSLIKE PISTOL_WEAPON 
 { 
  // dump the defaults...(debugging)
   addlogvar ANGRANGE
   addlogvar ZRANGE

 // set the values...
   setvar ANGRANGE 2	// very accurate
   setvar ZRANGE 16
 }
}
endevent


EVENT_GETAUTOAIMANGLE

Called when the auto aim angle is desired for the weapon.

Set 'AUTOAIMANGLE' to zero to disable auto-aim for the weapon.

Default value for AUTOAIMANGLE is 48.

onevent EVENT_GETAUTOAIMANGLE
{
 // default is 48
 ifvare WORKSLIKE PISTOL_WEAPON 
 { 
   setvar AUTOAIMANGLE 64	// a 'wider' auto-aim angle.
 }
}
endevent

EVENT_GETLOADTILE

Get the tile to display as background when starting a level.

Set value into 'RETURN'.  Default is LOADSCREEN (3281)


EVENT_CHEATGETSTEROIDS

Player has entered a cheat to get steroids.  
Set RETURN to amount of steroids to get.

On entry, RETURN is set to default.

EVENT_CHEATGETHEAT 21

Player has entered a cheat to get night vision.  
Set RETURN to amount of night vision to get.

On entry, RETURN is set to default.

EVENT_CHEATGETBOOT 22

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_CHEATGETSHIELD 23

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_CHEATGETSCUBA 24

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_CHEATGETHOLODUKE 25

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_CHEATGETJETPACK 26

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_CHEATGETFIRSTAID 27

Player has entered a cheat to get inventory item.  
Set RETURN to amount of item to get.

On entry, RETURN is set to default.

EVENT_QUICKKICK 28

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_INVENTORY 29

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_USENIGHTVISION 30

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_USESTEROIDS 31

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_INVENTORYLEFT 32

Player has hit the button (key).

On entry, RETURN is set to the next inventory item.

Set RETURN to zero to select no inventory item

EVENT_INVENTORYRIGHT 33


Player has hit the button (key).

On entry, RETURN is set to the next inventory item.

Set RETURN to zero to select no inventory item

EVENT_HOLODUKEON 34

Player has hit the button (key) and Holoduke is turning on.

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_HOLODUKEOFF 35

Player has hit the button (key) and Holoduke is turning off

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_USEMEDKIT 36

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_USEJETPACK 37

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.

EVENT_TURNAROUND 38

Player has hit the button (key).

On entry, RETURN is set to 0

Set RETURN to non-zero to prevent use of key.


WEAPONS

Weapon control consists of three parts:

FIRE button response
DISPLAY animation
SHOOTING Sequence

The DISPLAY event is called each time the weapon is to be displayed on the
player's screen.  When the weapon is NOT firing, the weaponcount variable
is zero.  When it is NOT zero, then it is the shooting sequence count. 
The display of the weapon may be skipped if the display is 'behind' in frames.

This event, unlike most (currently, all) other CON items must NOT depend on
keeping in sync with the other machines in a multiplayer system.  THis is 
because one machine may skip the display, but another may not (if it's faster,
for instance).  For this reason, no sprites should be spawned, etc.  There is
also a special RANDOM function provided for this display-only EVENT.


The FIRE event is called when the player currently being processed presses the
FIRE button.  This event is called on EACH machine in a multiplayer setup for 
the player.  Multiple players can press FIRE at the same time. Therefore,
this event may be called multiple times per frame (up to one for each player).
The FIRE event initialized the SHOOTING sequence (or not) by setting 
weaponcount to 1

The SHOOTING event is called each frame when the weaponcount is non-zero.
It is called for each player who is currently shooting on EACH machine in a
multiplayer setup.  This event sequences the actual firing of the weapon
and the generation of the projectiles.

