PGX3 Map Editor

Creating a new map.
Map editor starts with a default 32x30 blank map.
File-New will start a new map. Prompting for new dimensions.
Maximum dimensions may be 32,000 x 32,000.  Theoretically anyway....
The biggest one I've got working so far is 2000x2000 but, 
The problem is the Strategic, or Jump map ! Get's too big.
I think I can fix that...I'll give it a try anyway...
(The real limitation is how much memory your computer has ! )

Select new tiles from the 'Tiles (F2)' form. Left click.
Left click on the Main screen to place the tiles.

You can select tiles from the main screen by right clicking on a hex.
'N' key cycles to the next tile of that hex type.
'B' key cycles to the previous tile of that type.
'R' key places a randomly selected tile of that type.

Tiles menu Random and Cycle toggle the random and cycle modes on and off.
The key commands are always enabled.
Hex Sides On or Off menu commands display hexsides.
Options: 
  Hex Control On:
   Opens the Nationality screen to choose nation, and hex objective types.
   Primary, Secondary, Oil, or none.
   ('None' is just used to mark an empty or non-objective hex for Nationality control.)
   The click on hexes on the Main screen to mark them.
  Hex Control Off:
   Turns off hex control mode.
  Determine Separate Land Masses:
   If new Islands are created, or a new map is created from scratch, you should
   run this to create the Land Mass data. The AI uses this to know which parts of 
   the map are not connected to each other quickly.
Strategic Map:
   Show: creates and shows Strategic Map.
   Hide: just hides it. (F1 will pop it up again.)
Block Fill Button:
  Fills a 10x10 block with the selected hex type.
  (Random or cycled hexes depending on the mode.)
Map Tiles button:
  just pops the map tiles screen up for hex type selection.
Clear Hex Sides button:
  Puts the editor in 'Clear' mode. Any hex you click will have it's
  hex side data (roads, rail roads) erased.
Deployment Hexes on/off button:
  Toggles deployment Mode: Select deployment hexes for PG/AG style scenarios.
  Area (Fill) mode is not functioning yet, so I've disabled that for now.

To place road hex-sides.
Select Roads from the bottom window, and click in the appropriate hexes.
When you click on the 'Roads' window Editor will go into Road Mode. 
Temporary road connections will be shown on the map. You will still need to
replace the tiles with the correct Tile image for the roads to be visible on
the finished version. (The roads will be there, but they won't be visible !
Which can actually come in handy sometimes !)
If you goof up. Just click 'clear hex sides' and click the hex to erase them,
and start over on that hex.

I have added an Auto assist mode to the editor. (Button at top of main window)
Auto-Tile On/Off
if Auto-Tile is on. The map editor will try to place the correct tile for that
hex while you are placing them. Hex types are identified by the .rnd file entries.
(So even non river hexes may be identified as river icons.)
Don't forget...you can hit the 'N' or 'B' key to change the tiles on the selected hex too !

The Editor creates the Jump map version of the map. (mapname.bmp)
This, and the map file are the two necessary map files PGX needs for scenarios.

Some other parts of the program. These are not really Map editing functions, but
I've put them in here.

Bitmap Utilities: Opens Bitmap Utility Screen
   'Create Seasonal Versions'
   PGX3 uses the following files for the terrain tiles.
   mapl.bmp (light tiles)
   mapd.bmp (darker tiles)
   mapwl.bmp (Winter light colour)
   mapwd.bmp (Winter dark colour)
   mapmd.bmp (Mud dark colour)
   mapml.bmp (Mud light colour)
   mapr.bmp (Red Aircraft fuel restricted)
   After new terrain tiles are added to the mapl.bmp file
   you can create the other files with the 
   Create Seasonal Bitmaps: utility 
   It creates the other files, and places them in the same folder as mapl.bmp.
   (It will replace older versions if they exist.)

   'Create Sprite Mask'
   Some of the icon image files need a black and white mask file to function properly.
   If you edit or add images to the icons.bmp or some of the other files you will need
   to update the mask version of the file. (iconsm.bmp for example)
   Just load the icons.bmp file in the Bitmap Utilities screen.
   Click 'Utilities' 'Create Sprite Mask'
   This will create the sprite version for you, and place it in the same folder.

*****************************************************************************************************************
ADDING NEW TERRAIN TILES: (Images for existing terrain)
The first 16 rows of terrain tiles are from the original PG/AG set.
If you change them the original AG/PG map files will not be convertable
to PGX format. (Eventually I plan on adding the ability to run the original
scenarios without conversion.)
I would not change the first 255 tiles. Treat them as reserved.
New custom tiles should be added from row # 17 down.
You can add new tiles to the mapl.bmp file !
If the bottom row is full or used, then...
Edit mapl.bmp.
Increase bmp height by 50 pixels.
Open newrow.bmp in another window (960x50 bmp of blank hexes)
Select all.
Copy.
Go back to mapl.bmp window.
Paste 'newrow' at bottom of bmp.
Edit the new tiles to make them look like what you want.
Save mapl.bmp.
Exit bmp editor.

Edit ' (the pgx folder)\data\hexdata.txt' with a text editor.
first number at the top of the file = the number of tiles in the file !
Change this to the new value.
The numbers below are the terrain values associated with the corresponding
image in the mapl.bmp file.
00 = "Ocean"
01 = "Clear"
02 = "River"
03 = "Mountain"
04 = "Swamp"
05 = "City"
06 = "Air Field"
07 = "Hill/Rough"
08 = "Forest"
09 = "Fortifications"
10 = "Bocage"
11 = "Fortification/River"
12 = "Bocage/River"
13 = "Sand"
14 = "Port"
15 = "Escarpment"
16 = "Rough Desert"
enter the new row of 16 values at the end of the file.
Save and Exit.

(see Demo.gif)


Finally !
Create the Dark tiles, and weather tiles with the map editor.
run pgx4map.exe
Main screen: File-Bitmap utilities
Bitmap Utilities screen: File - Load Bitmap
Load 'pgx folder'\bmp\mapl.bmp"
(You should see the bitmap load into the picture box.)
Utilities - Create Seasonal Versions
This might take a few seconds depending on the size of the bitmap.
Exit the map editor 

******************************************************************************************************************
Adding New Terrain Types (Like Jungles, or Martian Death Bogs)
Edit Hexdata.txt
increase the number of terrain types at top of file.
add new terrain line.
Terrain Name,
Minimum entrenchment value,
Maximum entrenchment value,
Initiative Cap,
Jump map pixel Red value,
Jump map pixel Green value,
Jump map pixel Blue value
 IMPORTANT !  DON'T FORGET THE COMMAS !
********************************************************************************

BITMAP UTILITY **** CREATING A MAP FROM A BITMAP ********************************************************
Here is a way to convet Bitmaps to PGX maps. (It's not finished, but it works.)
Warning ! 1 Pixel = 1 PGX hex 
So a 3,000 x 2,000 pixel bitmap will create a 3,000 x 2,000 hex PGX map !
(As you might imagine, you can run out of memory easily with this thing.)
when a bitmap loads into the form it's RGB values are rounded to the nearest 4 I think.
So this sort of converts 24 bit bitmaps into 256 colour bitmaps ?
I don't know exactly I have'nt actually done the math...but anyway it reduces the numbers of colours...
while still seeming to preserve most....
You can change this 'rounding value' under a menu selection on the Bitmap utilities screen.

Load a bitmap into the Bitmap Utility screen
Select Terrain type from Terrain form (Ocean, Woods, Clear, etc.)
click on a pixel in the Bitmap window.
Each pixel of that colour (RGB value) in the bitmap will be converted to a hex of that type.
*********************************************************************************************************
Converting old PG .set and .scn files to PGX .map and .oob files.
Before you can do this....create a folder in the PGX main folder called PG_Files.
copy the original PG mapnames.str and panzequp.eqp files to this folder. (PG_Files)
These should be from the same mod/version of PG as the .set and .scn files !
The .scn file should be in the same folder as the .set file too !
(But they can be in any folder...just the mapnames.str and panzequp.eqp need to be in the PG_Files folder.
*********************************************************************************************************

   The map editor is older than the latest version of PGX, some of the code needs to 
be replaced with some better methods I have learned since I started. The screen scrolling,
etc, don't work as well as PGX. I will try to get back and improve the map editor soon.
