Ambrosia Garden Archive
    • LMSprite stuff


      I'm pretty sure that other people will have worked this out, but I couldn't see any posts about the contents of .LMSprite files, so here are the results of my looking at them in the hexeditor.

      First, choose a sprite in the editor. Note the number that's shown in the preview box.

      Control/right-click on the SketchFighter app, show package contents, go to Contents/Resources/Data/Sprites, and open Sprite <number>.LMSprite in a hexeditor (e.g. http://www.ex-cinder.../hexeditor.html ).

      (Obviously, make backups before changing anything....)

      NB:

      Zacha Pedro said:

      Anyway, I recommand you folks the greatest care when modifying these values, because you can screw up gameplay completely by changing anything. Even just modifying the graphic size will change behavior by making the sprite sclae to fit in the levels that reference it.

      EXAMPLE LMSprite:

      Sprite 73.LMSprite :- Wall Long Ice

      40 26 00 00 00 00 00 00  40 18 00 00 00 00 00 00 
      40 4d 80 00 00 00 00 00  40 6f 40 00 00 00 00 00 
      40 3d 80 00 00 00 00 00  40 5f 40 00 00 00 00 00 
      40 20 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
      40 43 00 00 00 00 00 00  40 6f 40 00 00 00 00 00 
      00 00 00 08 00 00 00 01  00 00 00 01 00 00 00 03 
      ff ff ff ff 00 00 00 00  00 00 00 0d 57 61 6c 6c 
      20 4c 6f 6e 67 20 49 63  65
      

      The majority of the file involves the collision boxes and image size. I'll leave those for a minute, and start with the last three lines of hex.

      00 00 00 08  00 00 00 01  00 00 00 01  00 00 00 03 
      ff ff ff ff  00 00 00 00  00 00 00 0d  57 61 6c 6c 
      20 4c 6f 6e 67 20 49 63  65
      

      All the numbers here are longs (i.e., 4 bytes).

      The first four-bytes, 00 00 00 08, define which spritemap image file the sprite comes from. It's not a straight conversion thing - 8 doesn't mean it uses Spritemap8.

      Use this table and replace the 08 with the numbers necessary for the spritemap you're using:

      Font.tiff				00
      Font2.tif				01
      Bakgrunder1.tif			02
      Spritemap0			03
      Spritemap1			04
      Font3.tif				05
      Spritemap2			06
      Spritemap3			07
      Spritemap4			08
      Spritemap5			09
      Spritemap6			0a
      Spritemap7			0b
      Spritemap8			0c
      Spritemap9			0d
      Spritemap10			0e
      Spritemap11			0f
      

      The next four bytes describe the default script to use - here it's Script 1.LMScript (no script).

      Then we have solid type (0, 1, 2, 3 or 4) for the next four bytes (here it's 1, solid).

      Last set of bytes on the first of these lines gives the default layer of the sprite.

      The first two four-byte sequences on the next line give defaut Extra 1 and Extra 2 values.

      The third four-byte sequence is the length of the name string, which makes up the remaining bytes.

      Now back to the first five lines. These are all double-precision floating point numbers, so they're 8 bytes long.
      NOTE: In the LMSprite files defining placement of stuff, x-increasing goes from left to right across the page, and y-increasing goes from top to bottom down the page.

      40 26 00 00 00 00 00 00  40 18 00 00 00 00 00 00
      

      The first line decides where the graphic will start from on the Spritemap:

      <x-offset from left of page for graphic start> <y-offset from left of page for graphic start>

      40 4d 80 00 00 00 00 00  40 6f 40 00 00 00 00 00
      

      The second line is the size of the graphic, starting from the offset from the top left corner of the spritemap given above.

      <x size of graphic> <y size of graphic>

      40 3d 80 00 00 00 00 00  40 5f 40 00 00 00 00 00
      

      The third line is the location of the centre of rotation. It's starting from the offset given in the first line.

      <x distance of c.o.r. from offset> <y distance of c.o.r. from offset>

      40 20 00 00 00 00 00 00  00 00 00 00 00 00 00 00
      

      4th line is collision offset from the top left of the graphic itself.

      <x distance of collision start from top left of graphic> <y distance of collision start from top left of graphic>

      40 43 00 00 00 00 00 00  40 6f 40 00 00 00 00 00
      

      Size of the collision box itself. Starts from where defined in previous line.

      <x size of collision box> <y size of collision box>

      Hopefully this is slightly helpful for someone (probably with custom graphics).

      This post has been edited by --- : 19 February 2007 - 08:34 AM

    • Thank you, ---.

    • "The first four-byte thing", as you say, is in fact an index into the list of texture files as described in the LMProject file (whose format is, too, completely trivial). Also, the four bytes before the name string contain the length of that string.

      By the way, HexEdit kicks Hex Editor's ass (it's dead simple and frugal, and efficient). Real men interpret double-precision floating-point values in hexadecimal themselves (including when in little-endian byte order).

      Anyway, I recommand you folks the greatest care when modifying these values, because you can screw up gameplay completely by changing anything. Even just modifying the graphic size will change behavior by making the sprite sclae to fit in the levels that reference it. Honestly, I've never modified anything in here, I know how to read this data for SketchMapMerge but that's it.

    • Thanks for that, do you mind if I edit it into the main post?

    • Awesome. You rock, ---!