Notes on editing the M2 textures for Return to Mars

The M2 Shapes file format is similar to M1 or to the M2 preview format, except that the contents of the old .256 resources are now stored in the datafork (see below). I used a hex editor (HexEdit 1.07) to move the M2 wall1 textures into an .256 resource from the M2 preview. I then moved this resource into an M1 Shapes file with ResEdit, and pasted the M1 textures into the resource with Pfhred1.3. Canvas 3.5.3 was used to make the composite switch textures. Next, I moved the data from the edited resource back into the M2 Shapes file, again using HexEdit. Cutting and pasting big chunks of the Shapes file with HexEdit requires both patience and a fair amount of memory (does anyone know of a hex editor that allows selection of parts of a large file by specifying begininng and ending offsets?), but it does work. Finally, I removed the unused texture/scenery sets and adjusted the offset table in ShapesRTM with HexEdit. This rather convoluted method probably will not appeal to most people, but hopefully a Shapes editor or Marathon Infinity will be out soon. I should mention that the sprites in M2 use a different format from M1, so Pfhred 1.3 cannot edit them, even if you convert them into .256 resources.

I removed the walls, scenery, and landscape graphics collections that are not used in Return to Mars, as well as the collection for the cyborgs with the bouncing grenades. This reduced the size of the ShapesRTM file by about 4M. However,this means that if you want to use ShapesRTM for other maps, you can only use Walls1 and Landscape set 4. I did change the offset table in ShapesRTM so that Phforte2 will load additional copies of set1 and landscape4 in place of the missing sets. This prevents Pfhorte2 from crashing when it uses ShapesRTM, and this also works with M2, to a point. However, the scenery collections for the other sets are not present (including the media splashes for medias other than water), and this will eventually cause M2 to crash.

If you want to convert an M1 map to M2 and use this shapes file, note that the RTM textures are from M1 walls2, but they replace M2 texture set1. Also, a few of the original M1 walls2 textures were omitted, and others were moved to new locations within the texture set. The easiest way to convert an M1map that uses M1 walls2 is to change the texture set to walls1 in Pfhorte1.0d25 and save the map. Then open it with Pfhorte2.0 to convert it for M2. This will set the control panels correctly to set1. If instead you switch textures from set2 to set1 after opening the map in Pfhorte2.0, you will have to change any control panels to set1 manually, or M2 will crash.

M2 Shapes file format:

The first 1024 bytes contain an index to the data sets for each graphics collection. There are 32 data sets in the normal M2 Shapes file. Each data set appears to be in the same format as the.256 resources present in the M2 preview (although I have only checked the texture sets). There are 16 bit versions of some collections, but the format appears to be the same as for the 8-bit collections--with a larger palette.

The format for the index is:

index entry (32 bytes):

First 4 bytes   -unknown, always zero
long		    -offset to data set for 8 bit color (-1 if unused)	
long            -size of data set for 8 bit color   (zero if unused)
long		    -offset to data set for 16 bit color (-1 if none/unused)	
long            -size of data set for 16 bit color   (zero if none/unused)
Last 12 bytes   -unknown, always zero

Some of the offsets in the normal M2 Shapes file:

                        8 bit offset  16 bit offset

set  1                         0400

set 18 walls1                45FCA2
set 19 walls2                4DCAE2
set 20 walls3                559922
set 21 walls4 (unused)           -1
set 22 walls5                5D6762

set 23 scenery 1             6535A2
set 24 scenery 2
set 25 scenery 3
set 26 scenery 4 (unused)        -1
set 27 scenery 5

set 28 landscape1            69A8E8          6BD2E4
set 29 landscape2            7455A0          767F7C
set 30 landscape3            7F0258          812C34
set 31 landscape4            89AF10          8BD8EC

Textures

The format for the M2 texture collections is the same as for M1 texture collections. A description of this format can be found in the M1 file specs. However, you do not need this information to edit the textures, since you can use Pfhred1.3 as described above.

Landscapes

These four texture sets contain one texture each (size: 270 x 512). Since Pfhred 1.3 will not allow new textures to have sizes other than 128 by 128, it is not presently possible to paste in new landscape textures (although Pfhred does display the existing textures correctly).

Scenery

Scenery sets use sprites. Scenery includes things like lights and rocks, as well as the splashes for the various medias (scenery 1 for water, scenery 2 for lava, etc). If the appropriate scenery set is not present when something hits media and causes a splash, M2 will crash. Which scenery set is loaded is determined by the walls texture set selected (scenery 1 is loaded with walls1, etc).