***********
Depthcharge
***********
by sp4x0r


Description:
Depthcharge is a speed mod made for an Inside3D speed modding competition.  The task
was to make a Quake mod in seven days with the theme "underwater".

Depthcharge runs on DarkPlaces.  I quickly tried it on a couple of other engines and
it didn't work.  The map I've made is probably horrible for all sorts of reasons, so
I have no idea if it will even work on anybody else's system.  You'll need water
transparency enabled, too.

You can download DarkPlaces from here:
http://www.icculus.org/twilight/darkplaces/

This mod turns grenades into depth charges - set a desired depth, fire one into the
water, watch it explode.

Of course this just winds up detracting from the original Quake maps, so I've made a
very quick, nasty map called "sp4x0r_dcwell" (when I say "nasty" I mean it).

A swimming rocket soldier will spawn when you grab the grenade (now depth charge)
launcher.  Killing a monster spawns another, and the number of monsters alive at once
increases as your kill count does (although it does hit a maximum).  You get two monsters;
swimming rocket soldiers and scrags.

Most of the code in this was ripped off from various tutorials on Inside3D and AI Cafe.
See the acknowledgements below.

Changes:
- Grenades bounce off everything, only depth will trigger them.
- Unlimited ammo.  The ammo count is now used as a number to set the depth for a charge to
  explode.  I have made "1" on the ammo count equal about 22 Quake units, which is based on
  the offset height of the player's eyes.  This could probably do with being larger, but
  you get used to it.
- The fire rate is twice as long as the grenade launcher, I found it too easy to just spam the
  depth charges otherwise.  This may have to change since it feels kind of annoying.
- Monsters see through water (commenting out a couple of lines in the "visible" function).
- Monsters see you from any distance (I realise this is nasty, but I'm in a hurry).
- A very quick and nasty map with things in a well for you to kill.

Requirements:
I'm running this on DarkPlaces Aug 9 2008 release.  At the very last minute I tested it on
GLQuake.exe and DirectQ.exe and neither of them liked it, so DarkPlaces it is.

Setup:
- Run the mod.
- Start the map "sp4x0r_dcwell"
- You will need to bind Impulse 20 and Impulse 21 to some keys (I use my mouse wheel).
  These set the depth that a charge will explode at.  The units aren't meant to approximate
  any standard measurement (e.g. feet or metres), it's actually based on how high the eyes of the player
  are.
Impulse 20 = deeper (i.e. a higher number in the ammo count)
Impulse 21 = shallower (i.e. a lower number in the ammu count)

If there aren't enough monsters for you, Impulse 100 will spawn a scrag and Impulse 101
will spawn a rocket soldier.


Setup for people who don't understand the above:
- Extract the mod into a directory underneath your main quake directory, e.g.:
    C:\quake\depthcharge
  (I'll assume linux folk don't need to be told what to do here, and hey, I haven't
  tested that anyway)

- Start Quake with the command line "-game [foldername]" e.g.:
    -game depthcharge
    
- Bring down the Quake console by pressing the tilde key ("`" or "~", underneath [Esc])

- You need to bind some actions to some keys.  This is done by typing something like:
    bind [key] "[command]"
  so if we wanted to bind the key "e" to "impulse 20" we'd type:
    bind e "impulse 20"
  and then maybe
    bind r "impulse 21"
  
  Personally I've used my mouse wheel for this - I don't remember if the original versions
  of Quake actually support a mouse wheel, so your mileage may vary.
  
- Run the map "sp4x0r_dcwell" by typing this into the console:
    map sp4x0r_dcwell
  and then pressing enter.

  
Acknowledgements:
- id (of course)
- Inside3D
- all the people who post things on Inside3D, particularly the tutorials.
- The monster spawning code is from Coffee's AI Cafe:
  http://minion.planetquake.gamespy.com/tutorial/tutor9.htm
- The rocket soldier code is from James Layman's tutorial on Inside3D:
  http://www.inside3d.com/showtutorial.php?id=84
- I think I got started on the depth charge based on using Tux's tutorial on water splashes:
  http://www.inside3d.com/showtutorial.php?id=15
- you
- apologies to anyone I may have neglected

Apologies (i.e. Things I ought to have done, but didn't):
- I thought about plugging in Gyro to change the physics of the grenade different, and
  probably had the time, but didn't wind up doing it.
- I've never really been into mapping, and haven't even tinkered with it for about ten
  years, so the map ain't pretty.
- The way the depth of the grenade is calculated is kind of dodgy (but cheap).  It records the height
  it was relative to the map when it entered the water an compares it to where it is.  If
  the player enters the water it uses the height the player was when he entered.  This
  means that weird, suspended bodies of water (e.g. the entrance to ep 4 on Start) mess
  things up.  Firing into a suspended body of water from underneath means the depth charge
  will not explode, even if it is in a technically deep enough spot.
- There really ought to be more incentive to go swimming in this mod - need some rewards.


email: sp4x0r@internode.on.net