Teratos's Note: Copy&Pasted changelog to end of file.


// #autoload
// #name = jsutWaypoints
// #version = 0.2.0
// #author = [PEN]jsut
// #warrior = jsut
// #email = jsut@kabob.ca
// #description = a waypointing script that lets create your own waypoints and load and save them
// #status = not so beta
// #readme = jsut/waypoints/readme.txt
// #category = jsut


jsutWaypoints

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

SYNOPSIS

This script allows a person to create their own customized waypoints while
hosting a game, and save them to disk for later retrieval.

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

INSTALL

drop the jsutwaypoints.vl2 file in your gamedata/base directory.  set up the
keybinds you want to use.

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

INSTRUCTIONS

### CREATING WAYPOINTS (only works if hosting)

Bind a key to the jsut Create Waypoint thinger that is added into the 
keybinds.  Host a game.  go stand in a position where you would like to have
a waypoint.  Hit the key you binded to jsut Create Waypoint.  You should 
now have a waypoint that has a number for a name.

### RENAMING WAYPOINTS (only works if hosting)

The number isn't exactly that meaningful, so to rename the number to something
more useful, hit your global chat button, and in the window type

!rename <oldLABEL> <newLABEL>

Where <oldLABEL> is the current label of the waypoing, and <newLABEL> is what you 
want to change the label to.  Alternatively, you can edit the text files that this 
script creates when you save waypoints to fix the names

### SAVING YOUR WAYPOINTS (only works if hosting)

To save all the waypoints that you have created with the keybind (note: waypoints
created using the CC won't be saved correctly), type

!save <FILENAME> <TITLECOMMENT>

in the global or team chat window.  This will write out your waypoints to a file
at jsut/waypoint/<GAMETYPE>/<MAPNAME>/<TEAMNUMBER>/<FILENAME>.wp
This file is plain text and can be edited by the user.

The <TITLECOMMENT> is an optional description of your waypoint file that is displayed 
when you cycle using through waypoints.

### LOADING WAYPOINTS. (works all the time)

To load a set of waypoints for a map, just type

!load <FILENAME>

if you previously saved your o waypoints using "!save o", you can load that same file
by typing "!load o"

alternatively, you can cycle through your waypoint files using the next and previous
waypoint keybinds

### CLEARING WAYPOINTS

!clear

clears all waypoints created by jsutwaypoints

### DELETING WAYPOINTS

!delete <LABEL>

Deletes a waypoints using the given label or number.  or you can right click the waypoint
on the CC to delete it.

### CYCLE KEYBINDS

jsutWP Next File
jsutWP Prev File

These two keybinds will cycle you through all the *.wp files in your directory.

### OVERLAY KEYBINDS

jsutWP Set Overlay

This keybind will make your current waypoint file in your cycle set always loaded 
and remove it from the cycle set selection.  

WARNING - you can still only have 16 waypoints on the screen at a time, so if you are 
using this, make sure that your overlay file waypoints + the largest non-overlay
file doesn't have more then 16 points.  otherwise points from the non-overlay file
will not appear.

### MASTER KEYBINDS

jsutWP Set Master
jsutWP Load Master

The set keybind will make your current waypoint file your master waypoint file.  
Later when you cycle onto other waypoint files you can hit the load master keybind to instantly redisplay the set master.

### WAYPOINT MOVEMENT 

Set waypoint axis
Move Waypoint Up
Move Waypoint Down

The axis start's as 'z', which will move waypoints up and down.  you can cycle through x, and y as well to move waypoints in those directions.  It comes in handy sometimes.
The up keybind increases the value, the down keybind decreases it.  what they do on x and y depends on your position relative to the waypoint.

also....

!edit <waypoint name>

sets your keybinds to work with that waypoint.  As you create waypoints, the newly created waypoint is automatically set as the one being edited

!stepsize <number>

sets the stepsize that is used by the waypoit movement keybinds.  the default is 1.

### FANCY ASS SHIT

Spam-O-Matic keybind

This pops up a hud that has a bunch of options.  pick a waypoint and either double click it, or click on one of the buttons in the HUD.  double clicking will generate high and low are aiming waypoints to fire from your current position and hit the waypoint you have selected.  The rest of the buttons are straight forward IMO.  This stuff only works for hand held mortars, not tanks, not grenades.  



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

WP FILE LAYOUT

pretty simple, basically it's this:

postition^label

you can also comment out lines by prefixing them with a '#' , like

#this is a comment


The first line of the file is where the Title Comment is stored, and is displayed in the msg hud as you cycle through your waypoints.

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

LIMITATIONS

I can't figure out how to extract a position from a waypoint created using the CC, or
from any normally created waypoint for that matter.   So you have to create waypoints
using the keybind.

You can only have 16 waypoints.  This is in the t2 code in the executable.  Nothing to 
be done about it.

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

BUGS

creating waypoints in observer mode, or before you spawn are untested.  I have no idea 
what will happen if you try doing weird shit, so don't blame me if it screws up.  you can
tell me about weird stuff that happens and i'll do my best to fix it though.

i'm sure there is other stuff too.  /msg jsut on irc.dynamix.com, or email jsut@kabob.ca

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

CREDITS

|311|Captain_Kibitz
- Closed for solution for the waypoint calculation code.

|BRO|SquirrelOfDeath
- Actually coding the math and the GUI.

[PEN]Celerity
- vision.  implementing the bulk of the keybinds

[PEN]Koko
- figuring out how to make movement work

[PEN]Galt
- extrapolation to three dimensions

[PEN]jsut
- some stuff.


//**************************************************************************************************
//**************************************************************************************************


v0.2.1
[PEN]jsut
1. Added Clear Waypoints bind (same as !clear)
2. Updated constant to work for classic's physics



v0.2.0
[PEN]jsut
1. Added z axis waypoint movement.
2. Commented
3. Made Keybinds work when you are looking at the CC.
4. Made Waypoint movement functions only work when hosting to stop stupid looping movement bug.
5. Changed !clear (and everything that used it silently) not clear waypoints that weren't created
   by jsutwaypoints.

[PEN]Galt
1. Added axis changing stuff so you can move waypoints along the x and y axis in addition to z
2. Added !stepsize, so you can more your waypoints more finely when you want to.

|BRO|SquirrelOfDeath
1. Psycho High and Low arc Waypoint calculation code
2. Fancy ass gui
3. All the hard work

|311|Captain_Kibitz
1. Closed form version of the waypoint calculation code

[PEN]Koko
1. Initial Waypoint movement code

v0.1.0
[PEN]Celerity
1. All functions now work with both waypoint names and the waypoint numbers
   i.e.  "!rename Turret Turret_Right" {would rename waypoint "Turret" to "Turret_Right"}
2. Waypoint files now have a title comment, this is a comment in the first 
   line of the file that is displayed when cycling through waypoints.
3. The save command will write a title comment.  i.e.  !Save File TitleComment
4. Added two file cycle keybinds.  Use these to cycle through files in your directory 
   instead of using !load. The title comment will display in the chat hud to show you 
   the current waypoint file loaded.
5. Added set and load master key binds.  Use this keybind to give you random access to 
   one wp file in your cycle.  cycle to the file you want to be your master, then hit 
   the set master keybind, then press the load master keybind later to instantly load 
   that file.  (optional feature)
6. Added set overlay keybind.  An overlay is a single file you always want to display.
   Cycle to the file you want to use as an overlay, then hit the set overlay keybind or 
   type !overlay in global chat.  This file will be taken out of your cycle set and always 
   displayed.  Type !clear to leave overlay mode. (optional feature)
7. Added "!delete <waypoint>" command

[PEN]Koko
1. fixed waypoints.cs so that keybindings will work while in a vehicle.

[PEN]jsut
1. changed rename to not needlessly recreate the waypoint
2. cleaned up for release
3. fixed small bug in the Title display code of the keybinds

v0.0.2
1. added !clear
2. fixed objectiveHUD bugs.  

v0.0.1
1. original release