COPS (& GOVERMENT) Version 1.0 B

1) What is this ?

Let me start to tell you what this is not. It's not, nor will it ever become, a
full GTA-map editor. It's merely a little program which can reduce some
inperfections with the only two real editors; M1 and Junction 25.
This program has been written with 3 targets in mind and some other options were
added later.

  Target 1: Designing police-routes
  Target 2: Designing roadblocks
  Target 3: Designing unknown routes (I'll come to that later)

On top of this targets,here are some extra options and why they're there:

  - Fairly easy checking if the railroad is complete
    Both Editors are unusable to see this

  - Placing all goverment facilities (police,hospitals and firebrigade)
    M1 can place 1 hospital right, but the next 5 are mostly at random ?!?.
    Also M1 can't place police or firebrigades, at least not in version 0.92
    Junction 25 can place them but there's something wrong when you try to
    save them.

  - Adding and removing traffic lights.
    Altough junction 25 can place traffic-lights,it's very easy to create
    an error.I come to this subject later on.

  - Checking air errors. (I found this by a coincedence)
    I've found an error in nyc.cmp at coordinates (25,17). When you walk over
    this field, you'll disapear untherneath the field.

2) The screen

The screen is divided into 2 sections: the map area and the status bar.
To start with the map area, there are several colors to seperate various types
of field.

The following are used as complete one-color blocks:

Green is used for pavement or Field (No need to see the difference)
Darkblue is used for block defined as a building. (you can't run through them)
Lightblue is used for water area's.
Black is used for roads.
Red is used for air (All six levels are defined as air)

There are some special characters used for some important differences:

 is used to show a drivethrough (mostly some building with road underneath,
                                  but can also e.g. be a tunnel under water
                                  or a bridge over the water)
the dot (.) stands for multiple stacked roads. (e.g. some crossings)

The second part of the screen is somewhat more complicated.
Here'is a copy of the bottom 2 lines:

Auto follow mode indicator
    Goverment viewing                  linked route
     points insert mode                                     
AFGOVI
(022,047) Road:         RouteNr:001 Point:005 Time:1 P1H1F1  LRoute  T0
                                                                  
coordinates    directions                            mode    
                           current   current  duration           indicator 
         Block              route    point in  of this                      
       description                    route    point          level          
                                                              colors      train
                                                     Goverment              mode
                                                     buildings

Extreme left you'll see the cursor coordinates, followed by a short description
what type of block your on. If this is a road or a drivetrough (see above) you
will see some arrows in color, representing the traffic-directions at a certain
level. You can't make a proper route without those arrows !
The colors of the arrows correspond with the levelcolors shown almost right.
The leftmost color stands for level 1 (the lowest) and the rightmost for
level 6 (the highest).
Inbetween the description and these colors, you find some mode-dependent stuff.
Directly above the coordinates you'll see the Auto follow mode indicator and
the Goverment view indicator (see later for an explanation).
To the right of the colors you'll find the mode indicator. This displays what
type of edit-mode you're in. (Normal, Route, Block, or URoute)
Finaly at the right corner, you find the train-mode indicator.

3) Moving around in cops

In cops you can move the cursor within one screen with the cursorkeys.
If you want to see a different part of the map you can choose between moving
half a screen or moving a whole screen.

When you hold [CTRL] when using the cursorkeys you move a whole screen and to
move only half a screen, just use [ALT] and the cursorkeys.

[F1] Pops up a small helpscreen showing you the keys used in the program.
[F10] Saves the field, you're working on.
Finaly , when your done, you can exit by pressing [ESC].

4) The modes

The program has several modes to seperate the actions a bit.
You can always see in what mode you are almost right of the bottom line.
The program always starts in the mode 'Normal'

- Police route mode ('Route')

This mode is used to create and edit the police-routes through your city.
It speaks more or less for itself.

- Unkown route mode ('URoute')

All routes in GTA have a type number (0-255). In the Cityscape Documentation
from DNA, I read that:

0-253 are used for roadblocks.
255 is used for policeroutes.

the first route in nyc.cmp turned out to be type 254 !!!
I don't know what this is, but I asume it has something to do with the multi-
player network option. (I don't have a network, so just single player for me)
if someone finds out what type of route this is, please e-mail me.
In the unknown route mode you can create a number of those routes.
Maybe nobody will ever needs it, but better safe than sorry.

- Roadblock mode ('Block')

In this mode we can create and edit the police roadblocks. It's fairly the same
as the other routes, but there are some differences.
It's easy to create a number of those blocks that just won't work.

The three mode above have also a second option to display all instances within a
certain mode. ('R All' 'B All' and 'U All').

- Train mode

This toggles 3 possibilities to see the train/tram rails

T0: There's no special care for trains. Most blocks are defined as train AND as
    roads. In this mode these double-defined blocks are displayed as normal road.
    (mostly) without directions. You can't determen all of the rails, because
    some parts are not defined as road, but only as train.

T1: Train view mode. In this mode all blocks defined as train are displayed.
    Roads that don't have the train settings are 'converted' to air.
    This leaves most of the screen red, except for the train (don't worry, it's
    only for viewing.

T2: Don't display rails. In this mode, the trainrails is not treatened as
    road. If a certain level of a block is defined as train AND road, it will
    be ignored. The color of such a block depents on what is underneath the
    trainrails or what is above it.

You can always see the state of the train-mode at the right bottom corner

- Auto Follow mode

This is a simple toggle wheater a new route should be 'Followed' when selected.
I will explain this further later on.

- Goverment view mode

Toggle to see the places of the hospitals, police-stations, fire-station and the
suitable places for hospitals,and police-stations (see paragraph 9).

5) Designing new police-routes

This mode can be turned on be pressing the [R]. The mode-indicator will show
'Route'.

when you start with a clean city, the first thing you'll notice is the
'No Routes !!' indication at the bottom center telling you there are no routes
defined yet.

To start a new route you simply press [INS]. The indicator now changes from
'No Routes' to 'RouteNr 1  No Points'. You can now use the [A]-key to add a
point to the route. When you do this you'll be asked about the duration of a
point. In GTA police-routes can contain repeats of coordinates. The more times
a coordinate accures the longer the police will stay at this point. Let's look
at the following example:

 (100,100) (110,100) (140,100) (140,100) (180,100) (180,50) (100,50) (100,100)
                                                                  
                                                                  
                                                                  
  create    drive to   on to     just       on with      and    and     back
  a car     here       here      stop for   the route    on..   on..   to the
  here                           a while                               start

 When you look close enough, you'll see that the first and the last coordinates
 are the same. Although this is not required, I would strongly advise you to.
 You can do so by simply adding one point (at the first coordinates).
 If a route is 'linked' (start=finish) an 'L' becomes visable just left of the
 mode indicator showing you 'LRoute'. As soon as you add another point, the 'L'
 will be gone (unlinking the route). During the addition of points to the route
 you'll have to look closely to the direction-indicators at the bottom (the
 colored arrows). They show you the road direction and there has to be a
 direction available that gets the police to the next point. If that direction
 is not available the policecar will simply disapear. You can also put a point
 at a multiple-road. Then you'll be asked at what level you want it. 1 is the
 lowest and 6 the highest. All route points are displayed as '' in a color
 representing the level (Verry handy when you work with a lot of slopes, see
 'sanb.cmp' for an example).

 To insert a point in a route (not at the end), you'll need to put the cursor
 on the point AFTER which you want your new point to appear. There will be an
 'I' displaying at the statusbar. Then you can add the new point by using the
 [A]-key again. After this the 'I' will disapear!

 You can also delete a point by simply pressing the [D] when on it. Similairly
 you can press [E] to edit the duration of a point.

 Finaly, you can delete the complete route by pressing [DEL], Be carefull !!.

INPORTANT !!!. Routes can not begin on the coordinate with 2 directions defined,
so West or South are Ok, but don't use South AND West (e.g. a corner).
If you do this, this route is not valid, so the car won't appear.

6) Editing existing routes

If your city allready has policecars (An existing map or created with cops!),
you can also press [R] to get to police-route information. Offcourse you don't
need to when allreay in edit-mode (bottom displaying 'Route' or 'LRoute').

You can select the route with [PAGE UP] (previous) and [PAGE DOWN] (next).
if you activate the Auto-follow mode by pressing [TAB] the cursor will
be on the first point of the route (if there is one).The Auto-follow is
indicated by 'AF' just above the coordinates.

The [F]-key has the same purpose. If the cursor is not on a route, he will
jump to the first point of the route. Otherwise he will jump to the next point
of the route. This allows you to follow the route and double-check if all
directions are correct.

When in edit-route mode ('Route' or 'LRoute') you can press the [R] again.
this bring you into the 'R All'-mode. This mode displays all routes defined
through the entire city. You can use this mode to determen if there are parts
of the city that should have police but haven't. When you press the [R] again
you'll be back to normal mode.

ALL KEYS MENTIONED IN THIS SECTION ARE ALSO USEFULL WHEN DESIGNING NEW ROUTES

7) Unknown Routes

As explained in paragraph 3, these are the same type of routes as police-routes.
All thing explained above can be used when creating /editing these routes,
except you can enter/leave this mode by pressing [U]. This toggles between
'URoute' or 'LURoute , 'U All' and 'Normal'.

8) Police roadblocks

Before I can explain how you can create or edit roadblocks , I have to give
a little inside how GTA uses roadblocks (It will also make predicting roadblocks
during the game a little easyer).

All roadblocks in a map are linked to the traffic-light junctions. As soon
as you pass such a junction (and you have enough police after you) the police
will set up some roadblocks around that junction. Now you know why you should
avoid the traffic-light junctions when escaping from a bank-robbery. You can
safely use the smaller streets, if you can drive well that is ;-).

In cops, you can edit roadblocks almost like normal police-routes except for
a few things:

Before you can setup any roadblocks, you'll need to define some traffic-light
juctions. This has to be done by M1 or junction 25. You need to set the
attributes of EACH roadblock you want traffic lights to 'traffic-light'.
under this there's an example of a complete trafficlight junction

           Ŀ  The dots represent the roads to
                  .  .  .  .         and from the juction.
           Ĵ
               X  T  T  T  T  T      the 'T' represent a road defined
           Ĵ  as traffic-light
            .  T  .  .  .  .  T  . 
           Ĵ  the 'X' is a 'trafficlight-object'
            .  T  .  .  .  .  T  .   This makes passing the juction
           Ĵ  verry dangerous, because the cops
            .  T  .  .  .  .  T  .   will setup some roadblocks.
           Ĵ  this block is also defined as
            .  T  .  .  .  .  T  .   traffic-light !!
           Ĵ
               T  T  T  T  T  T      Not all sides of a junction
           Ĵ  have to be traffic-lights
                  .  .  .  .       
           

After defining the traffic-light, the first thing you need to do is mark the
traffic-light junction with a traffic-Light object (from now on :TL-Object).
These TL-Objects have nothing (yet) to do with the roadblocks. You can place
objects in junction 25 but there's is one big problem. Like all other objects,
TL-Objects are placed according to 14-bit coordinates, allowing you to place
the object exactly where you want it. Juction 25 also allows you to carefully
manouvre the objects and that causes the trouble. I haven't been able to
pinpoint the exact 'when and why' but when a TL-Object isn't precisely in the
center of a coordinate , GTA can produce some very strange effects.I have
managed to get a lose light nearby the normal light (visable in the game) but
also a whole bunch of those lights in a direct line to the next defined
junction. This could be 100 extra trafficlights (IN THE MIDDLE OF THE ROAD)

To start defining the TL-Objects, you need to be in the 'B All' mode allowing
you to see all placed TL-Objects. This can be achieved by pressing the [B]-key
twice. In this mode you can also see all blocks defined as valid traffic-lights.
These are displayed as a lightblue 'T'.

By Pressing the [L]-key, you can place (or remove) a TL-Object on the cursor
coordinates. If a TL-Object has one or more roadblocks linked to it (see later)
it won't be deleted !!

After placing the lights, you press the [B]-key again twice. This brings you
to the 'Block'-mode. Here you can add points to the current TL-Object. With
a few exceptions you can use the same keys as for designing police-routes.

A=Add point
D=Delete point (Won't work when the cursor in on a TL-Object)
F=Follow to next point
Page up/Down=Select route (in this case , that would be the TL-Object)

E (Edit duration) is unnessary ,because each roadblock has a duration of 1
[DEL] can be used but will only delete the defined roadblocks, but not the
      TL-Object.
[INS] can not be used. There's no way to define new junctions in this mode.

You should place your roadblocks at the top of a road (Horizontal roads) or
at the left of the road (Vertical roads).Although GTA doesn't use this, you
can setup a roadblock in any size of street (even extreme small one (1 wide).

Roadblocks won't work in the following cases:

- The junction you put a TL-Object on , doesn't have traffic-lights defined
  When you don't defined the proper Traffic-light configuration in M1 or
  junction 25, there's no way it's ever going to work.

- The junction you put a TL-object on , is to small or doesn't have the room
  (above) to place traffic-lights.
  In this case it's not just ignored but GTA will give you an error while
  loading the map (Invalid TL-junction at (XXX,YYY))

- You don't have any police-routes defined.
  If you don't at least create one police-route, there won't be any police-cars
  to create a roadblock (or something)

- You only have one police-route, but you kill that policeman and stole his
  car.If you release the car and drive away,the police will take the car back.
  Your roadblocks work again from that moment on.

- There are no hospitals defined. This is more or less a protection against
  crashing out of GTA. Changes you get wasted at the roadblock are very high.
  No don't need to define police-station before your roadblock can work, but
  offcourse you need those to prevent the program from crashing when busted.
  A hospital is only properly defined if it's can succesfully produce
  ambulances (See paragraph 9 for details).

- Some roads are not properly defined. If one of the roads is an error, e.g.
  2 block above eachother,  both defined as road (but no viaduct) , there
  won't be roadblocks nearby.

9) Goverment facilities

To be able to add goverment buildings , simply press the [V]-key to go to the
goverment view mode. You can press the [V] again to get out of it.

Due to some problems with the other two editors, I've desided to include this
option, but it's not realy a 'buildin' option. Just press the [G]-key to add
or change a facility. After that you'll be aksed what type it should be
(Hospital,Fire department or Police Station) and the number.
GTA limits the number of these stations by 6 per type.
Hospitals and Policestation can only be placed at those coordinates showing
an '*'. This restriction is nessesary to avoid the GTA-error:
No direction above hospital !. If the * is lightblue, there's no need to
ask you for the level (there's only one valid level in this case).
If the * is red, however, YOU need to provide cops with the level. This level
is generally the same as the road nearby (look at the color of the arrows).

Before you'll be able to place any hospital or police-station, you need to
prepare the map with M1 or junction 25 by setting a direction just above the
place you want your building.So if you want a hospital at (134,23,3), you need
to set the direction at (134,23,4). Sorry, but it's just to complicated to
implement this in cops!

Since GTA selects a random police-station or hospital to start after loosing
a life (busted or wasted) , you'll have to define ALL police-stations and
hospitals at once. They may even be all 6 on the same spot, but they have to
be defined.

The place you select your hospital, is the place the ambulance appears (IF THIS
PLACE IS DIRICTLY ATTACHED THE A ROAD) and the direction points to the place
where your player restarts. Here's is an example:

          Ŀ             N
       A   .  .  .  .  .  .  .                 
          Ĵ        W  E
       B          .  .                     
          Ĵ             S
       C          .  .           represents building,
          Ĵ  H is the chosen hospital location,
       D          .  .          . represent road
          Ĵ  and 'empty' stands for pavement
       E          H> .      P 
          Ĵ  The direction above the hospital
       F          .  .          is east. This causes the player
          Ĵ  to restart at E5, but that's
       G          .  .          defined as road. A player never
          Ĵ  appears on the road. E6 and E7 are
       H   .  .  .  .  .  .  .      also of limits, because they're
            defined as building.
            1   2   3   4   5   6   7   8    The player actually appears at E8.
                                             When the direction would be west,
                                             the player would appear at E1.

When the cursor is on a P,H or F (just guess what this letters are stand for)
you'll can see the number of this facility just left of the level-colors,
allowing you to check which one should disapear before creating the new one.
When there's more than one facility of one type at one coordinate this indicator
will show an M as the number.
indicator examples:

    F3  => this is firedepartment number 3
  H1    => this is hospital number 1
P4  F1  => at one spot, there's Police station 4 and Firestation 1
PM      => There are more Police stations on this coordinate (don't ask which)

In this section, there's definately room for improvement.

10) Using M1

Although both junction 25 and M1 are unable to create routes, M1 introduces a
second problem. M1 (version 0.92) has a destructive nature.
When you load an original field in with M1 and then save it again (without any
editing) you'll find out that a lot has disapeared.

All trees, garbage, and worse; all police are gone !!.

When you save a field in COPS (with or without editing) , COPS creates a backup-
file with the extension .cmb (in stead of .cmp). This file contains ONLY the
police-routes,roadblocks and the object information.

If you save the field in M1 again (detroying this information) and after that
you load it in cops, you'll be informed about the missing parts and asked if you
want to load the missing data from the backup. This way you can easely preserve
all objects,routes and blocks (just load it in cops and save it again).

11) The Source

The sourcecode is absolutely free and included with this file. DO NOT hassle
me with questions about the source, because I wrote this program in just a
few weeks and I didn't felt like keeping the strict rules.

If someone finds the need to expand this program, feel free to do so, but don't
expect me to do it. Maybe if there are complaints about crashes or something,
I might try to debug the program, But I don't think there's is going to be much
new things.

When someone has improved the program however, I would like to be informed.

The program was written with DJGPP version 2.0 and rhide.
No special libraries are needed.
Source and project files are included.

Most of the source should be fairly readable, however, one routine is the center
of this program. It's the Check_Column-Routine.

This returns a 32 Bit value representing road-levels, directions, other type of
field and traffic-lights.

bits 0-5:       1=road  2=no road (bit 0=> level1, bit 5 =>level6)
bits 6-7:       0=airr  1=water 2=pavement/field 3=building
bits 8-31 level specifications in blocks of 4 bits:
                0-12 road directions (0,1,2,3,4,5,6,8,9,10,12)
                13   directions but no road (Suitable for police or hospital)
                14   traffic light (defined by M1 or junction 25)
                15   just no road
                7 & 11 unused

if a block should display a traffic-light, ALL instances of 15 are being
replaced to 14. The level,the light is realy on, just contains a number from
0-12 (road + directions)
example (in hex):


               no road (level 6)
               no road (level 5)
               suitable for police or hospital (no road,level 4)
               road heading west (level 3)
               no road (level 2)
               no road (level 1)
              
              FFD4FFC2        level 654321
                                 
                    C2 => 11000010  (binairy)
                                     
                                      level 2 contains a road,direction W
                                  building (makes it a drivethrough)     
                                                                              
                 
12) Contact

You can always (at least this year) contact me by sending me E-mail.

the address is: e9462@tc.hsa.nl

                              Happy GTA-ing

