6. Continue to extract images from the roof file by using the Go To function and selecting the data between the next offsets, 1F E0, the start of the image data for the interior of first roof pair and 3F C0, the start of the image data for the roof of the second roof pair; pasting it in a new doc. Do your x and y calculations (interior image files in the same roof pair will use the identical new header as the roof image did in step 5c. above so you can copy and paste that header from the finished roof image file).
DOWN AND DIRTY ROOF### FILE 'BUILDING'
1. In your graphics editor, copy a roof from any bgmap.tga, cropping it as closely as possible, leaving as little exterior 'landscape' around the roof as you can. 'Square' bldgs (those not angled in respect to the map edges) are best for this. Paste the roof onto your new map where you want it.
2. Do any necessary graphics work to the exterior landscape surrounding the pasted roof image NOW (all roof and interior images sliced out of a roof file will have landscape matching the map they came from, bordering the bldg in the image) When pasting bldgs into a map youll find it necessary to 'blend' the pasted image in with the landscape surrounding its new position. Remember - any graphic changes done within the boundary of the roof image you copy in the step below, after you copy this roof image, will not displayed when the game 'patches' in the roof and interior images during play.
3. Copy the roof image from its new location including as little landscape as possible. !!!NOTE THE TWO CORNER COORDINATES!!! using the ruler set to measure in pixels. The marquee box the selection tool places around the section of the graphic to be copied makes determining the corners fairly easy. Make a copy of this copy (giving you two identical images, one you name roofx.tga and the other, interiorx.tga) To make the interior, 'hollow out' the roof (basically paint in a suitably colored floor or paste in a nice texture) and add something resembling walls (I find 2 pixel wide lines work well for these even tho the terrain elements in map### are all 10 pix wide) and white rectangles in the walls to represent doors and windows. Stay within the boundaries of the roof portion of the image itself when you do this.
4. Then use Texture Maker to convert the roof and interior .tga images (naming them txtr000.tga and txtr001.tga) and using the fromtga.bat file to create txtr000 and txtr 001 (again please note this step in Texture Maker refers to v.1 of that fine tool)
5. In HexEdit delete the 16 byte header from the converted file for the roof image you want to use and paste the remaining data into a new document. !!!NOTE!!! the offset address of the last line in this data (add blank bytes -'20' values to fill in any missing bytes to create a full 16 byte last line) The offset for the interior is going to be the next line. !!!IMPORTANT!!! to keep track of this as you'll need to input this offset value in the header you will create for this roofpair (the offset address for the roof image data in the first roofpair ia always 00 00 00 00).
6. Then delete the 16 byte header from the converted file for the interior image and paste the remaining data into the new document on the line following the roof image data.
7. To create the header for this roof pair its hex calculator time again. If you had noted the pixel coordinates of the roof image when you pasted it onto your new map as 700 (x1), 840 (y1) for the upper left and 780 (x2), 900 (y2) for the lower right - these decimal values would translate (using HexEdits base conversion tool, Bconv32.exe or a character table) as:
700 (= 02 BC in hex) for x1.
780 (= 03 0C in hex) for x2.
840 (= 03 48 in hex) for y1.
900 (= 03 84 in hex) for y2.
8. The first 8 bytes (specifying the roof images corner coordinates on your map) of the new header are going to be:
02 BC 03 0C 03 48 03 84
9. The next 4 bytes (the offset for the roof image data) will be 00 00 00 00 so the new header is now:
02 BC 03 0C 03 48 03 84 00 00 00 00
10. The last 4 bytes are the offset you'd noted for the beginning of the interior image data. Lets assume this as:
00 00 1D C0 The finished bldg header is now: 02 BC 03 0C 03 48 03 84 00 00 00 00 00 00 1D C0
11. Insert this at the beginning of your new roof pair data in line 1. Then insert a CC2 header (52 4F 4F 46 00 00 00 01 00 00 00 00 00 00 00 00) at the beginning of your new roof pair data in line 1 (which pushes the building header down to line 2). Save as roofxxx in the ABTF/Graphics/Maps folder and play.
Be creative folks. I did a camouflaged pillbox using a haystack graphic for the roof and a custom interior for the bunker. And a camo trench with a hedge for a roof and the trench as the interior. Let only your imagination limit you.
OVMAP AND MMMAP FILES
Ovmap (overview map) and mmmap (map monitor map) are two maps which CC2 uses for displays in the interface (the mmmap seen on the Command screen and on the Map Monitor during the game) and the BattleMaker edit screen. The pixel dimensions of the ovmap and mmmap are important. You cannot use the original ovmap### and mmmap### headers if your new files are different in size (pixel H x pixel W x 2). The data in the middle of the header is byte width x byte height (last data set in the header) x 2. You will need a hex calculator to determine this.
Mmmap example
1) You resize a copy of your new bgmap tga to 144x106 in preparation to make an mmmap file. (144x106 is not a fixed number but keep in mind the Map Monitor window, into which the graphic must fit, is only slightly bigger than that, especially in the horizontal.)
2) You then run the 144x106 .TGA thru Tin's Texture maker and convert it to CC2 format.
3) Rename the txtr000 file it creates as mmmap### (### being the # of the original map you want to substitute your new one for)
4) Open this file in a hex editor and the header appears as-
74 78 74 66 00 01 00 00 00 00 00 90 00 00 00 6A
Change the first 6 bytes to read as 00 00 00 00 00 00.
5) Now use a hex calculator (or hex to decimal conversion table) to multiply the values in bytes 12 and 16 (In this case, 90 x 6A in hex or 144 x 106 in decimal. Different dimensions will naturally produce different values in bytes 12 & 16) times 2. The result, 77 40 in hex (30528 in decimal) is placed in bytes 7 and 8.
6) The finished mmmap header will read -
00 00 00 00 00 00 77 40 00 00 00 90 00 00 00 6A
7) Save in the ABTF/Graphics/Maps folder.
Ovmap example
CC2 uses 904x646 as the ovmap image size for 1600x1200 maps. I've found there's a bit of leeway here if bgmap size is different (646 pixels may be a vertical limit though and 1142 pixels is the largest std horizontal size). This example assumes the reduction of a bgmap###.TGA from 1800x1320 (16x11 in deployment tiles) to an 881x646 .TGA in preparation to make an ovmap file. Keep in mind the values in bytes 11&12 and 15&16 of the header will vary depending on the actual dimensions of the reduction you choose to work with.
1) Use Tin's Texture Maker to convert your 881x646 ovmap###.TGA to CC2 format. The header in your hex editor will read - 74 78 74 66 00 01 00 00 00 00 03 71 00 00 02 86
2) The first 5 bytes are changed to 00.
3) Bytes 11 & 12 (03 71 or 881 in decimal) are multiplied by bytes 15 & 16 (02 86 or 646 in decimal) then the result is multiplied by 2.
4) The final product (11 5E 4C or 1138252 in decimal) is plugged into bytes 6, 7 & 8 producing a finished header that reads - 00 00 00 00 00 11 5E 4C 00 00 03 71 00 00 02 86
5) Save in the ABTF/Graphics/Maps folder
MAKING A FREE DEPLOY BATTLEMAKER TEMPLATE FOR A NEW MAP
Open your new map in the BM edit screen and remove all victory locatins and all but the mandatory 3-5 deployment tiles on the left and right edges of the map. Set the force levels for each side as 0. Save this as your new map name/Free Deploy.
Open this file in Excel. In the map matrix that constitutes the bulk of the file change all values, except for the row at the top and the column on the left, to 0. Save as tab delimited text.
Remove the .txt extension in Windows Explorer. The resulting BM file will now have he mandatory 3-5 deployment tiles along the left and right edges removed. Remember it is a template. In BM edit you will have to add deployment tiles, victory locations and choose teams or set forces levels as desired to play. The advantage of a Free Deploy BM is that you can reverse sides (tho soldiers will still retreat to the left/German or right/Allied edges as before), play top to bottom or set up with one side surrounded. Depending on the amount of 'reversal' you impose on any new setup you may find POW captures increase but theses routing cowards werent gonna be of any more use to your side in the battle anyway.
A CLARIFICATION
I've been ploughing through the MAP FAQ over the last few days in an effort to work out how to do the roof files. Well, I think I've finally cracked it (sort of). As a test on my new map
(chateau), I've managed to successfully do three roofs. There will be about 18 in all.
The problem I'm encountering is that the offset pointing to the roof and interior data is out (and more so for each roofset). Rather than pointing to where the data begins (as you would
think should be the case), I've found that I have to have the offset a number of lines before the data for that roofset begins. And with each roofset I'm adding, I find that I have to point
the offset even more lines before the data begins (ie it's compounding). While it's not a real problem with a few roofs, with 18 its going get more complicated (but not impossible to do
however - it's simply not very neat). What's the reason for this? Or is this normal?
Thanks,
Andrew (The Naked Foot) Glenn
///// What youre encountering sounds suspiciously like the probs we had before Tin made Texture Maker when we had to insert blank bytes to force a reversal in the TGA file's byte order. Assuming youre using TM then my best guess is that when you are building the image portion of the roof file you may either be adding each roof header to the top of the file as you go or not deleting the 16 byte txtr headers from the image data before pasting it in.
Keep a header file open (in your case- one with the CC2 header [52 4F 4F 46 00 00 00 1C 00 00 00 00 00 00 00 00; 1C in byte 8 = 28] followed by 28x16 byte lines of blanks ['20's]). Then open another file for the image data. Tile the header & image files horizontally in your Hex editor window. Paste in the image data for roof#1 (AFTER!!!removing the 16 byte txtr header). If the last line of the roof1 image data is incomplete (ie not a full 16 byte line; this happens occasionally) fill it in with blanks ('20's) to create a full 16 byte line. Then add another blank to start a new line. Reason for the extra blank byte is - HexEdit needs any line other than the very first to already be started so you can paste new data in.
Note the offset where the interior#1 image data will go and input that offset into the corresponding last 4 bytes of the roofpair#1 line in the header file.
Open interior#1, remove the header, copy the data and paste it into the last line of the image file. Add blanks to fill the new last line then add the extra blank (youll add 2 blanks if you had to fill in an incomplete line) to start another line. Note the offset of this line and input that offset address into bytes 9-12 of the roofpair#2 line in your header file.
Use the GoTo function to jump to the starting offset for interior#1 and remove the blank. This shifts all the data for interior#1 into its correct position, leaving 1 blank to start the offset where the roof#2 data will go. Repeat the process. Open roof#2, remove the header, copy the data, paste into image file, add an extra blank, note offset in header file (interior#20), jump to roof#2 start offset and remove the blank.
When youve finished pasting in all 28 sets roof pair image data THEN you can copy all 29 lines in the header file (the cc2 header + 28 roof pair headers) and paste them into the beginning of your image file. Thus the start of the roof#1 image data gets shifted to line 1E (=30).
Use the hex-to-decimal converter to translate all the corner coordinates you noted when you cut the roof images from the map. Again the first 2 bytes of each roof pair header get the x1 coordinate (upper left horizontal), bytes 3&4 get the x2 coordinate (lower right horizontal), bytes 5&6 get the y1 coord (upper left vertical) and bytes 7&8 get y2 (lower right vertical).
Hope this solves you prob. If so I prolly coulda just said - dont add the headers to the image file until after youve finished pasting in all the image data but better a little extra verbiage :) to make the point clear. Dont hesitate if ya need to follow up with any questions.
lotsa luck,
mick (xe5)
>>>>>>>>>>>>>>>>>>