This program (EDITRPY) is designed to perform various editing functions
on Indycar, Indycar2 and Nascar replay files.

It can:

* Identify each of the laps in a replay file, giving the lap time
  for each lap of each car, accurate to 1/1000 second.  (In all
  cases that I have observed these times have differed from the
  lap times reported by INDYCAR by no more than 1/1000 second.)
  It also reports the average speed for each lap.

  This data can also be written to a file in human readable form
  or in a form suitable for importing into a spreadsheet.

* Copy a lap (for a single car) from a replay file and paste it to
  another (possibly new) replay file.  A lap is the sequence of
  1/15 second frames starting with the first frame after a finish
  line crossing and ending with the last frame before the next finish
  line crossing.

* Produce a file with speed and acceleration data for a lap.
  This can be imported into a spreadsheet (or other program) and
  used to produce graphs of speed and/or acceleration as a function
  of position along the track or as a function of time.

* Produce a race report from a replay of a race.  This shows the
  leader of each lap and can show the lap and time of each pass,
  yellow flags, damaged cars, cars out of the race, etc.  I find
  this useful for producing my race reports for the racing league
  I am in.  See the examples at the bottom of this file for the
  format of the various lines in the report file.

What's new in version 3.4

- Fixed a bug introduced in v3.1 when I tried to fix the infinite
  loop associated with "position > track len".  This bug caused
  unpredictable program crashes after the "position > track len"
  message came up.

- Updated the track lengths in Papyrus units for five of the tracks.
  These were off by 1 or 2 units (1.3 - 2.6 cm)

- New function in the race report which optionally prints the time
  behind the leader (or laps behind) as each car crosses the finish.  

What's new in version 3.3

- In version 3.1 I added a preference for a decimal separator 
  character.  I added it to the "Lap Report" preferences even though
  it applied more generally.  I've moved this preference to a new
  "General" preferences section.  I've also added a field separator
  preference.  This applies to the delimited reports (Lap Report
  and Lap Analysis).  This allows European users whose spreadsheets
  expect semicolon delimited fields with comma as the decimal
  separator.
  
  The General preferences section now includes the "Units" (english
  or metric) and the decimal/field separators.
  
  When you start using version 3.3, it will reset your "units"
  and output file format preferences.  Be sure to set them up again. 

What's new in version 3.2

- In Nascar and Indycar 2, when a lap is copied into a replay 
  file which has no pace car, and the driver for the copied lap
  already exists in the target file, then the copied lap is made
  to be the pace car.  This is somewhat annoying.  3.2 fixes this
  so no copied car will ever become the pace car.

What's new in version 3.1

- The bug which sometimes caused the vertical scroll bar in the
  lap windows to be inoperative is now fixed.

- Earlier versions of editrpy got into an infinite loop when
  they discovered invalid replay files (position > track length).
  Now after displaying a message, the program continues correctly. 

- Earlier versions of editrpy did not report the same lap speeds
  as ICR2 on the oval tracks.  Version 3.1 corrects this so that
  editrpy should now report the same speed as the game.  Unfortunately
  editrpy will now report different speeds for the same lap times
  between ICR1 and ICR2.  This is because the track length 
  Papyrus used to compute the speed from the time is different in
  ICR2 than it was in ICR1.

- Modified drivers2.txt files confused editrpy and caused it to
  display numbers instead of the driver's names.  This is now fixed.

- Editrpy now supports all 30 available tracks for ICR2.  This 
  includes the 15 tracks that come with ICR2, the 14 other tracks
  which can be converted from Nascar and Indianapolis converted
  from ICR1.

- There is a new preference in the editrpy.ini file which allows
  the decimal separator character to be specified.  This is useful
  in countries where decimals are formatted as 123,45 rather than
  123.45 as in the US.  Set this preference in the Lap Report
  preferences.

- In version 3.0, if you installed ICR2 into a directory called
  INDYCAR instead of ICR2, editrpy would think this was Indycar1.
  This caused lots of difficulties, mainly that the replay files
  appeared invalid (position > track length messages).  I've 
  implemented a new method to determine which directories are
  which.  Hopefully, this will work better.

What's new in version 3.0

- EDITRPY now supports INDYCAR2 replay files.

What's new in version 2.6

- EDITRPY now can write the lap times and speeds into a file.
  This can either be in a human readable form which looks just
  like what you see in the window or in a comma delimited form
  suitable for import into a spreadsheet.

What's new in version 2.5

- All previous versions of EDITRPY have a nasty bug which can
  cause any number of bad symptoms.  These range from failure to
  write files (when it said it did), writing bogus replay files,
  hanging the machine and corrupting the smartdrive write cache.
  Thanks to all who reported these symptoms, I finally was able
  to reproduce one of them and solve this puzzle.

- EDITRPY now has a 'Race Report' function which will write a
  file containing information about a race (for which you supply
  a replay file).  This includes:

  - Lap and time for each flag shown (green, yellow, white and
    checkered).

  - Time for completion of each lap and who was leading.

  - Lap and time each time a car passes another (optional).

  - Lap and time each time a car is damaged, stops (i.e.
    pitstops) or leaves the race (optional)

  See the 'Preferences' pull down, sub-menu 'Race Report'
  to turn on/off the optional reporting.


What's new in version 2.1

- EDITRPY 2.0 had a bug which sometimes caused Indycar replay
  files to be incorrectly written.  The usual symptom was the
  lap time changing for a lap after it was pasted into another
  file.  Any Indycar (not Nascar) replay file written by EDITRPY
  version 2.0 that contains multiple laps may have one or more
  laps that will show the wrong lap time (speed).  These laps
  are then permanently screwed up, even if copied into a replay
  file by themselves.

  This bug did not affect Nascar replay files.

- I fixed several bugs that occurred if you ran EDITRPY on a
  machine which doesn't have Indycar (or Nascar) installed.
  The problems were:

  - Car numbers and driver names were printed as garbage.
    Car numbers are now assigned sequentially and the driver's
    name is listed as 'Unknown'.

  - The directory displayed when selecting 'Open' was garbage.
    Now it defaults to the current drive and directory.

  - EDITRPY searched the whole system looking for the Indycar
    (or Nascar) directory each time it was run.  You can now
    prevent this by specifying IndyCarDirectory=* (or
    NasCarDirectory=*) in the EDITRPY.INI file.  (Note this
    should only be done on systems which do not have the
    corresponding simulator installed.)

- Several people have asked me for descriptions of the replay
  file formats.  I've included what I know about Indycar and
  Nascar replay files here in icrfrmat.txt and nasfrmat.txt.


What's new in version 2.0

- EDITRPY now works for both Indycar and Nascar replay files.
  A new "Simulator" preference (under the preferences pulldown)
  allows you to select whether you want to work with Indycar
  or Nascar replay files.

- The "Edit Car ID" now lets you select which car/driver for
  each car in a replay file by name and car number rather than
  requiring you to key in a number which represents the position
  in the drivers.txt file.

What's new in version 1.5

- Version 1.4 had a misspelling of the Vancouver track's
  directory name.  This caused the program to claim that it couldn't
  determine the track and asked you to select one.  If you then
  selected VANCOUR, it would work properly.  Version 1.5 corrects
  this misspelling.

What's new in version 1.4

- In order to calculate correct lap speeds Editrpy needs to know
  which track a replay file is for.  Normally, Editrpy determines
  the track from the name of the directory containing the replay
  file.  If the directory containing the replay file doesn't have
  a name which matches one of Indycar's tracks directories previous
  versions of Editrpy would give erroneously low lap times.  In
  this version if the directory name is not one of the Indycar
  tracks directories then the program asks which track the replay
  is for.  If none is specified then the laps are all marked
  "partial".

What's new in version 1.3

- A bug which caused a "Floating Point Error" is fixed.  This
  happened if the replay file you open has a lap with exactly
  one record (i.e. it is one record long).  This can happen if
  you had previously cut the replay file and happened to start
  it one frame before the finish line.

- The track length constants have been updated to provide a
  more accurate conversion of lap time to lap speed.

What's new in version 1.2

- This version gives the car number and driver name (from the
  drivers.txt file within a carset).  The previous versions only
  displayed the car's index into the drivers.txt array.

- This version includes the function to produce speed and
  acceleration data for a lap.

- This version can indicate that a car was damaged.  This
  may be useful to verify that damage was on.

What's new in version 1.1

- The previous version had a limitation that it couldn't work with
  replay files which contained more than about 18 minutes of replay.
  In version 1.1, this restriction is removed.  You should be able
  to work with a replay file of any length and any number of cars.

- The previous version only displayed lap times for each lap.
  Version 1.1 displays both lap times and speeds.

Some limitations:

* The program cannot cut and paste sequences of laps, only single laps.
  For example, if you wanted to copy two consecutive laps from a file
  and add them to another file, the best you could do would be to copy
  them individually.  This would superimpose those laps (they would
  appear as two different cars) rather than having them run consecutively.

* Any "dirt", "smoke" or crash sounds associated with a copied lap are
  not copied.  This is because there is nothing in the replay file to
  identify with which car these artifacts are to be associated.  At some
  later date I plan to allow copying these from a file which has only one
  car as then there is no question about the source.

* The program won't run unless you have a mouse and have the mouse
  driver loaded.  I've seen that several people have had a problem trying
  to run the PAINTKIT program because they didn't have mouse drivers
  loaded.  I plan to improve the program to allow all functions to be
  performed from the keyboard, but for now you will need a mouse.

* I've noticed that in some replay files generated while using modem play
  cars seem to disappear (and sometimes reappear).  EDITRPY is not very
  robust when it comes to these files and sometimes fails.  You may see
  a line in the middle of the screen about an "assertion" error.  If that
  happens, you should play the replay file within INDYCAR to see if it
  exhibits any strange behavior.  If all seems well, and you can find a
  way to get me the replay file, I'll try to see if I can find out what
  is wrong.  For the most part, I would avoid using replay files created
  in modem play.

* I used the Borland Turbovision file dialog box when selecting file
  names.  I've found this code doesn't do "what you expect".  I haven't
  had the time to write my own, so for now we have to live with it.  The
  problem I have with it is that once you navigate to the directory that
  you want, if you type in a file name without path, the file is not
  created into the directory you are currently looking at, but rather
  into the "current" directory.  To get the file into the directory you
  are looking at, make sure that you keep the full path in the input line
  where you are typing the file name.

--------------------------------------------------------------------------
To install:

Place the program EDITRPY.EXE onto your hard disk.  A convenient place
may be the indycar or nascar directory itself, but it doesn't really
matter where.

Here is how to use the program:

Run the program
for example:

C:> editrpy

The first time it is run the program will search your hard drive(s) looking
for the directory containing Indycar 1.  For example on my system the 
directory is:

E:\GAMES\INDYCAR

If the directory is not found, (maybe you have Nascar or Indycar 2)
then when you set the Simulator Preference to Nascar or Indycar 2
EDITRPY will search for those directories.  

After the search, the program will create a file EDITRPY.INI in the same
directory in which you placed EDITRPY.EXE.  This file will identify where
your INDYCAR and/or NASCAR directories were found so it won't have to search
again.  If the program can't find your directories then you can edit 
EDITRPY.INI and add a line identifying where to find your INDYCAR and/or 
NASCAR directories.

For example, if you had installed Indycar into C:\MYINDY then place the
following line in EDITRPY.INI:

IndyCarDirectory=C:\MYINDY

for Nascar, the line would be something like:

NasCarDirectory=C:\MYNASCAR

for Indycar 2, the line would be something like:

Indy2CarDirectory=C:\ICR2

You can prevent EDITRPY from searching for the INDYCAR or NASCAR directories
by specifying '*' as the directory, as in:

IndyCarDirectory=*

The EDITRPY.INI file also contains other information which you can
specify on the Preferences pulldown menus.

----

After the program gets started there are five pull down menus at the top
of the screen "File", "Edit", "Preferences","Window" and "Help".
These are used as follows:

"File"  This pull-down menu has six functions "New", "Open", "Save",
        "Save As", "Analyze Lap" and "Exit".

        "New" creates a new replay file (it won't be written to disk
        until you select "Save As").

        "Open" brings up a file dialog box which allows you to select a
        replay file to be read into a window.

        "Save" saves an open replay file (which has been modified by "Paste",
        "Delete" or "Edit Car ID")

        "Save As" brings up a file dialog box which allows you to select
        a new file name for an open replay file.  You must use "Save As"
        to save files created with "New".

        "Lap Report" creates a file which contains the lap times and speeds
        for a replay file.  This can be either in human readable form
        (the same as what you see in the window) or in comma delimited form
        that can be imported into a spreadsheet.  The format is determined
        by the preferences specified on the "Preferences" pull down menu.

        "Analyze Lap" creates a file which contains speed and acceleration
        information for the selected lap.  The format of the file is
        determined by the preferences specified on the "Preferences"
        pull down menu.

        "Race Report" creates a file which contains a report of action in
        the current replay file.  This function only works for replay files
        which contain a "green flag" i.e. those created by Indycar/Nascar
        of a race.  Replays created by EDITRPY will produce a null race
        report file.  Optional items to be included in the race report are
        specified on the "Preferences" pull down menu.

        "Exit" ends the program.

"Edit"  This pull-down menu has four functions "Delete", "Copy", "Paste" and
        "Edit Car ID".

        "Delete" is not implemented yet, but will eventually
        allow you to delete cars and/or laps from a file.  You can get the
        equivalent by creating a new file and copying all of the laps you
        wouldn't have deleted.

        "Copy" makes a copy of a selected lap.  To select a lap, click
        on the line which shows the lap time.  "Copy" will copy the
        currently selected lap to an internal clipboard.  If there are
        multiple windows on the screen, more than one of them may have
        a lap selected.  The lap that is copied is the selected lap in
        the current window.  The current window is the window whose frame
        is highlighted.

        "Paste" copies the lap which is currently in the internal clipboard
        into the selected Car.  Cars are the lines in the windows which
        are titled "Car nn" or "New".  Currently the program is limited to
        copying laps into the "New" car.  As above, if there are multiple
        windows, the car to which the lap is added is the selected car in
        the current window.  The current window is the window whose frame
        is highlighted.

        "Edit Car ID" lets you change the car and driver associated with
        a car in a replay file.  You use this by selecting a car in a
        replay file and then selecting "Edit Car ID".  This will bring
        up a list of all of the cars (as shown in the appropriate
        drivers.txt or drivers2.txt file.  You can select a new car/driver
        from the list.  The Indycar/Nascar replay code uses this value
        to decide which graphic to use for each car.  You may set more
        than one car in a replay to the same car/driver.

"Preferences"  This pull-down menu has six functions, "General", 
        "Lap Analysis", "Simulator", "CarSets", "Race Report" and
        "Lap Report".

        "General" allows you to set some general preferences, specifically
        the "Units" (English or metric), the "Decimal separator" character
        and the "Field separator" character (for delimited reports).

        "Lap Analysis" allows you to set preferences for
        the format of the output of the Analyze Lap function.

        "Simulator" lets you select which type of replay file you
        are working with; either Indycar or Nascar

        "CarSets" lets you select which car set you want the car number
        and driver names to come from.  (Select CarSets after you select
        the "Simulator")

        "Race Report" lets you select which optional items are to be
        included in a race report file.

        "Lap Report" lets you select the file format for lap reports.
        This can either be printable (human readable) or delimited
        (importable into a spreadsheet)

        Preferences selected here are remembered in the EDITRPY.INI file.

"Window" This pull-down menu has three functions, "Next", "Zoom" and "Tile".

        "Next" sequences through the windows.  (There really isn't too much
        use for this unless you have so many files open you can't find
        the windows)

        "Zoom" maximizes (or minimizes) the current window.

        "Tile" causes all of the windows to be rearranged so they are all
        visible with no overlaps.

"Help"  This pull-down menu currently has only an "About" selection.
        Someday I plan to add some help too, but that may be a while.

        "About" only tells you who I am.  It also lets you know the
        version of the EDITRPY program.


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

Notes:

You can move the windows around by clicking on the title bar and dragging
the window.  You can resize the windows by clicking on the lower right
corner and dragging.  Each window you create will start in the upper left
corner of the screen so you will almost surely have to drag them around
to see them.

The windows have scroll bars in case you have so many laps in a window that
they can't all fit on the screen (or if you have so many windows that you've
had to resize them smaller).

You will notice that some laps (usually the first and last) will have the
word "partial" next to them.  This means that these laps are not complete
laps.  They may start at the start of the file and go to the first finish
line crossing or start at the last finish line crossing and go to the end
of the file.

Some laps will have the word "damage" next to them.  This means that the
car has had damage in that lap (or some previous lap).  Damage may consist
of flat tires or tires that fly off the car.  Unfortunately, if you make
it into the pit and fix the problem (change a flat tire), the replay file
continues to indicate the flat so all subsequent laps will also indicate
damage.

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

Examples of use:

Suppose you've just produced a replay of your latest practice session
and want to cut out a single "hot" lap.

1. Use the "File/Open" menu item to select the track and replay file
   that you just produced.  This will bring up a window with a line
   for each lap showing the lap times.
2. Click on the lap you want (it will become highlighted)
3. Use the "Edit/Copy" menu item to copy the lap to the internal clipboard.
4. Use the "File/New" menu item to create a new replay file.  This will
   bring up a window with a single line in it, New
5. Click on the word New in the window just created in step 4 to select the
   "new" car.
6. Use the "Edit/Paste" menu item to copy the lap from the internal
   clipboard to the new car.  The window will now contain a car with that
   one lap and another New car will appear.
7. Use the "File/Save As" menu item to save the new replay file to disk.

You now have a replay file with just the single "hot" lap

------

Suppose you have several "hot" laps and you want to compare them to see
why one is faster than another.

1. Use the "File/Open" menu item to select the file(s) which contain the
   laps you want to compare.  If both laps are in the same file, you only
   need to open a single window.  If the two laps are in different files,
   you will need to open a window for each file.
2. Use the "File/New" menu item to create a new replay file.
3. Click on one of the laps
4. Use the "Edit/Copy" menu item to copy the selected lap to the internal
   clipboard.
5. Click on the New car in the .Untitled file created in step 2
6. Use the "Edit/Paste" menu item to copy the lap from the internal
   clipboard to the New car in the new file
7. Repeat steps 3-6 for each of the laps you want
8. To change the car IDs click on the Car to be changed and use
   the "Edit/Edit Car ID" menu item
9. Use the "File/Save As" menu item to save the new replay file to disk.

-----------

Suppose you have an "archive" replay file which contains your best laps.
(This file could have been created using the procedure above)  You just
run another "hot" lap and want to add it to the archive.

1. Use the "File/Open" menu item to select the track and replay file
   that you just produced.  This will bring up a window with a line
   for each lap showing the lap times.
2. Click on the lap you want (it will become highlighted)
3. Use the "Edit/Copy" menu item to copy the lap to the internal clipboard.
4. Use the "File/Open" menu item to open the "archive" replay file
5. Click on the "New" car in the "archive" replay file
6. Use the "Edit/Paste" menu item to copy the lap from the internal
   clipboard to the "archive" replay file
7. Use the "File/Save" menu item to save the "archive" replay file to disk.

-----------

Suppose you have a replay file of a race and it is huge because you spent
a lot of time in the dirt.  (Dirt and smoke can easily be more than half
of a replay file).  You can use EDITRPY to remove the dirt and smoke,
leaving the rest of the information.  This can substantially reduce the
size of a replay file.

1. Use the "File/Open" menu item to select the track and replay file
   that you want to modify.
2. Use the "File/Save As" menu item to save the replay file under a new
   name.  This will save the original file minus the dirt, smoke and
   crash sounds under the new name.

-----------

Suppose you have a replay file of a lap for which you want to produce a
graph of speed vs. track position.  You can use EDITRPY to produce a
comma delimited data file which can then be loaded into a spreadsheet
program to produce graphs or perform other analysis.

1. Use the "Lap Analysis" section of the "Preferences" menu to select
   the data and format you wish.

   Select the type of data you want produced.  These are:
  - Time
  - Distance
  - Speed
  - Acceleration
   Each of the selected items are output at each ten foot interval along
   the track.  For example, if you want to produce a speed vs. position
   graph, you might select "Distance" and "Speed" then use a spreadsheet
   to produce an X-Y graph.

   Select the format of the output.  There are currently two choices,
   "Printable Report" and "Delimited".  Normally, you would choose the
   "Delimited" format.  The "DIF" format is not implemented yet.

   In the "General" section of the "Preferences" menu you can select
   the units.  These can be "English", "Metric" or "Mixed".  You can
   also select the alternate "decimal separator" and "field separator"
   for delimited reports here.

2. Use the "File/Open" menu item to select the track and replay file
   that contains the lap you wish to analyze.

3. Click on the lap you wish to analyze.

4. Use the "File/Analyze Lap" menu to create an output file with the
   lap analysis data.

-----------

Suppose you have a replay file of a race, and you want to produce a
race report.

1. Use the "Race Report" selection of the "Preferences" menu to select
   the optional report items.


2. Use the "File/Open" menu item to select the track and replay file
   that contains the race.

3. Use the "Race Report" menu to create an output file with the
   race report.

The lines in the race report look like the following:

          0:01:12.47  GREEN FLAG

This line indicates that the green flag was shown at 1 minute, 12.47
seconds into the replay.

          0:01:42.07  (13) Raul Boesel          - passed - (14) Adrian Fernandez for position
          0:01:51.80  (24) Marco Greco          - even   - (23) Dominic Dobson
          0:01:51.87  (23) Marco Greco          - ahead  - (24) Dominic Dobson for position

These lines show that Raul Boesel passed Adrian Fernandez at 1 minute,
42.07 seconds, taking 13th place, and putting Fernandez into 14th.
Marco Greco pulled even (within 1.3 cm) with  Dominic Dobson at 1 minute,
51.8 seconds and then pulled ahead (taking 23rd place).

Lap   1   0:02:16.40  ( 1) Mike Corrigan          Leader

This line shows that Mike Corrigan was the leader as he completed
the first lap of the race at 2 minutes, 16.4 seconds.
Remember this line shows the completion of lap 1, not the start.

Lap   1   0:02:18.80  ( 2) Al Unser Jr            -2.40

This line shows that Al Unser Jr was in second place as he completed
the first lap of the race at 2 minutes, 18.8 seconds.  He was 2.4 
seconds behind the leader.

          0:27:32.00       Alessandro Zampedri  - Out of race
          0:27:32.07  YELLOW FLAG
          0:27:32.67       Alessandro Zampedri  - Damaged

These lines show that Alessandro Zampedri crashed, causing a yellow flag
at 27 minutes, 32.07 seconds.  Notice that the replay indicates that he
is out of the race some time before the car is actually damaged.  I
believe that Indycar/Nascar "decides" the fate of a car before actually
showing the car hit the wall, or whatever.

Lap  30   0:33:10.60       Mike Corrigan        - Leader
          0:33:10.67  CHECKERED FLAG

These lines show that Mike Corrigan (that's me) was the leader at the
end of lap 30, when the checkered flag was shown.

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

Good luck.  As is usually the case, there are no warranties.  You use this
program at your own risk.  As far as I know there are no bugs and the
program does what I've described, but ...

If you have any problems, let me know by E-mail at:

     corrigan@millcomm.com

You should be able to get the latest level at my WWW page:

    http://www.millcomm.com/~corrigan/editrpy.html



