Skip to content

A Go library to load image resources for UFO: Enemy Unknown

License

Notifications You must be signed in to change notification settings

redtoad/xcom-editor

Repository files navigation

xcom-editor

Go

This is a library to load image resources for the game UFO: Enemy Unknown.

Game images

All images are stored in a custom format (see https://www.ufopaedia.org/index.php/Image_Formats for more information).

Here is an example how you can extract the images from ZOMBIE.PCK to create an animated GIF:

package main

import (
    "image/gif"
    "os"
    
    "github.com/redtoad/xcom-editor/resources"
)

func main() {
    // load all game palettes 
    palettes, _ := resources.LoadPalettes("GEODATA/PALETTES.DAT")

    // load image data from .PCK (all offsets are stored in .TAB file)
    offsets, _ := resources.LoadTAB("UNITS/ZOMBIE.TAB", 2)
    collection, _ := resources.LoadImageCollectionFromPCK("UNITS/ZOMBIE.PCK", 32, offsets)
    
    // convert to animated gif
    animated := collection.Animated(25, 40, palettes[4])
    f, _ := os.Create("zombie.gif")
    _ = gif.EncodeAll(f, animated)
}

The result is:

About

A Go library to load image resources for UFO: Enemy Unknown

Topics

Resources

License

Stars

Watchers

Forks