This structure is used to represent a sprite to be drawn. It's usually included as part of a list to be drawn, terminated by a NULL struct.

0x00 Sprite 2 bytes Handle to loaded sprite segment
0x02 Frame 2 bytes This is the frame to be displayed
0x04 X 2 bytes X coordinate at which to display the sprite
0x06 Y 2 bytes Y coordinate at which to display the sprite
0x08 Scale 2 bytes Has to do with sprite scaling when it is drawn. Not fully explored yet.
0x10 Flags 2 bytes Drawing flags (mostly unexplored)

Drawing Flags Edit

1 - 8 0x00FF Low byte seems to have no effect
9 - 12 0x0F00 Low nibble of high byte is used as some kind of counter, but otherwise unexplored.
13 0x1000 No uses noted.
14 0x2000 When set, sprite is confined to the main "window." When not set, sprite can be drawn anywhere on screen.
15 0x4000 No visual difference noted. Seems to indicate some kind of "use globals" setting.
16 0x8000 If set, sprite is drawn flipped

Scaling Edit

Scaling only appears to be used in the 3D view in the following situations: objects and monsters beyond the first row; outdoor walls beyond the first row. May also be used as part of the "door" animations, when entering towers, mines, etc...

Sprites are scaled X centred, Y top; ie, a sprite scaled to half size, layered directly on top of the same sprite at normal size (drawn at the same X/Y coordinates) will be drawn at the top of the "actual" sprite, and in the centre.

The special case is when the sign bit is set; ie, scale = 0x8000. This draws the sprite at double size directly from the X/Y coordinate. It does not centre the sprite as a scale down. There is currently no known way to have a sprite drawn between 1x and 2x scale in game.

Estimated scaling from observation Edit

The high nibble of each byte is ignored

0x0002 7/8 original size
0x0004 3/4 original size
0x0006 5/8 original size
0x0008 1/2 original size
0x000A 3/8 original size
0x000C 1/4 original size
0x000E 1/8 original size

Odd values are scaled the same way between the even values listed.
High byte may or may not be used. High nibble of low byte has no effect.

Further scaling Edit

Note: the above information should be enough to get a close enough representation. The following data is mostly academic in nature, but necessary for a "perfect" conversion.

When scaling, the "scale" value is used as lookup into a table of 16 bit values. This value is then stored in two places, denoted as ScaleX and ScaleY. Before each line is drawn, the top byte of ScaleY is tested. If it is set, then the line can be drawn; otherwise, the line is skipped. Always, after each comparison, ScaleY is left rotated (left shift once, and the top bit becomes the bottom bit) before repeating the procedure. The same algorithm holds true for each pixel along that line, using ScaleX. Only the low byte appears used in game. The high byte appears unused in the game. Although setting it does seem to have an effect, this is believed to be anomolous behaviour.
Before drawing, the sprite width is scaled, divided in half, and added to the X offset, in order to centre the sprite, as mentioned above.

0x00 0xFFFF Display every pixel
0x01 0xFFEF Skips 1 in 16 pixels
0x02 0xEFEF Skips 2 in 16 pixels
0x03 0xEFEE Skips 3 in 16 pixels
0x04 0xEEEE Skips 4 in 16 pixels
0x05 0xEEAE Skips 5 in 16 pixels
0x06 0xAEAE Skips 6 in 16 pixels
0x07 0xAEAA Skips 7 in 16 pixels
0x08 0xAAAA Skips 8 in 16 pixels
0x09 0xAA8A Skips 9 in 16 pixels
0x0A 0x8A8A Skips 10 in 16 pixels
0x0B 0x8A88 Skips 11 in 16 pixels
0x0C 0x8888 Skips 12 in 16 pixels
0x0D 0x8880 Skips 13 in 16 pixels
0x0E 0x8080 Skips 14 in 16 pixels
0x0F 0x8000 Skips 15 in 16 pixels

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.