https://github.com/redtoad/xcom-editor
A Go library to load image resources for UFO: Enemy Unknown
https://github.com/redtoad/xcom-editor
go x-com
Last synced: 5 months ago
JSON representation
A Go library to load image resources for UFO: Enemy Unknown
- Host: GitHub
- URL: https://github.com/redtoad/xcom-editor
- Owner: redtoad
- License: mit
- Created: 2020-09-24T22:30:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-25T09:07:52.000Z (over 1 year ago)
- Last Synced: 2025-01-25T09:25:09.455Z (over 1 year ago)
- Topics: go, x-com
- Language: Go
- Homepage:
- Size: 271 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xcom-editor
[](https://github.com/redtoad/xcom-editor/actions/workflows/go.yml)
This is a library to load image resources for the game [UFO: Enemy Unknown](https://en.wikipedia.org/wiki/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:
```go
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:
