Solar Winds Sprites

From ModdingWiki
Jump to navigation Jump to search
Solar Winds Sprites
Solar Winds Sprites.png
Format typeImage
HardwareVGA
Colour depth6-bit
Minimum size (pixels)0×0
Maximum size (pixels)256×256
PaletteExternal
Plane count
Transparent pixels?
Hitmap pixels?No
Games

The Solar Winds Sprites format is an image format used by Solar Winds. It contains several VGA images concatenated together in a single file. This format only appears to be used in the bh_expl.dat file, the explosion animation used when your ship is destroyed. The format is probably used by other graphic files in the game, but the others are encoded.

Header

Each image contains a width and height.

Data type Description
UINT8 width The sprite's width, 0-255.
UINT8 height The sprite's height, 0-255.

Image Data

Image data comes after the header. Its size is the product of the width and height.

Data type Description
UINT8 pixel A series of pixel data.

Once you finish reading the sprite data, another sprite may follow. Since the header doesn't include the number of sprites in the file, you must use an end of file check to determine when you've reached the last sprite.

Source Code

Free BASIC

This code will display each of the sprites in the specified file with the palette of your choice.

ScreenRes 640, 480, 8

Dim C As UShort
Dim R As UByte, G As UByte, B As UByte

Open "H:\DOS\Solar Winds\bh_mp1.dat" For Binary As #1

For C = 0 to 255
    Get #1, , R
    Get #1, , G
    Get #1, , B
    
    R = R * 4
    G = G * 4
    B = B * 4
    
    Palette C, R, G, B
    Line (C, 470)-(C, 479), C
Next C

Close #1

Dim X As UByte, Y As UByte, Z As UByte
Dim W As UByte, H As UByte
Dim Pixel As UByte

Open "H:\DOS\Solar Winds\bh_expl.dat" For Binary As #1

Do While Not EOF(1)
    Get #1, , W
    Get #1, , H
    
    Color 255
    Locate 58, 1: Print W & ", " & H
    
    For Y = 0 To (H - 1)
        For X = 0 To (W - 1)
            Get #1, , Pixel
            PSet(X, Y), Pixel
        Next X
    Next Y

    Sleep
    Line (0,0)-(319, 199), 0, BF
Loop

Close #1

Credits

This graphic format was reverse engineered by TheAlmightyGuru. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)