Respect sprite X and Y offsets

This makes menus display more correctly, and also fixes trees and other
objects on the main map, although it messes up bounds clipping (sigh).
This commit is contained in:
2020-03-21 00:56:35 +00:00
parent eb5c4430e8
commit 7a8e9dbd97
10 changed files with 109 additions and 55 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

View File

@@ -183,3 +183,21 @@ values:
| 405,0,0,{8, 16} | ? |
| 405,22,22,{2, 4, 5, 6, 7, 8, 9, 10, 13, 16} | ? |
| 405,30,-1,5 | ? |
## Positioning
The X-CORD and Y-CORD values would seem to be related, to this, but they are
universally set to 0 or -1.
Far more important are the XOffset and YOffset values for each sprite in the
associated .obj files. Taking these into account is enough to draw `Options.mnu`
successfully, for instance:
![](img/Options.mnu.png)
## Animation
This seems to be done by choosing a different sprite to draw every N ticks. They
are laid out sequentially, but I don't yet know how to animate them. It's likely
to be the same approach as used for other obj files.

View File

@@ -202,15 +202,13 @@ in the CENTER position. Interesting.
| Offset | Purpose |
| ------ | ------- |
| 0x0000 | ?
| 0x0000 | x,y offset (16 bits each) |
| 0x0004 | x,y size (16 bits each) |
| 0x0008 | ? (blank in all cases so far)
| 0x000c | Size of remaining pixeldata |
| 0x0010 | Padding? |
| 0x0014 | Padding? |
We still don't know what the first 32 bits are all about.
The volume represented by a cell is a little odd. We see three faces of a fake
3D volume of size 64x64x32(ish). This is presented in an isomorphic fashion, so
the height is 32px at the leftmost and rightmost extents and 96 in the centre.
@@ -222,8 +220,9 @@ for instance.
Loading a constructed `palette.obj` containing 1x63 pixels, with 0x0000 for the
first 32 bits, caused WH40K_TD.exe to render the pixels far to the left and above
the cell the palette objects were being placed into. This suggests they
represent an x,y offset to draw to. Need to experiment more.
the cell the palette objects were being placed into. Menus have a `.obj` file
associated with them too, and the elements for `Main.mnu` draw in the correct
places if we treat it as such.
Considering sprites with a 1,1 x,y.