Read RollerCoaster Tycoon graphic files.
npm install --save rct-graphics
var fs = require('fs')
var RCTGraphics = require('rct-graphics')
var srcData = fs.readFileSync('csg1.dat')
var srcIndex = fs.readFileSync('csg1i.dat')
var graphics = new RCTGraphics({
srcData: srcData,
srcIndex: srcIndex
})
// Load a palette
var palette = graphics.loadDataAtIndex(2024)
// Load a bitmap
var info = graphics.loadInfoAtIndex(2275)
var bitmap = graphics.loadDataAtIndex(2275)
Create a new instance for retrieving graphics. opts
should be an object with
both srcData
and srcIndex
. srcData
is a buffer with the content of
csg1.dat
. srcIndex
is a buffer with the content of csg1i.dat
.
Load info about the graphic at index idx
. Returns an object with
startAddress
, width
, height
, offsetX
, offsetY
and flags
.
Loads data for the graphic at index idx
. Returns either a buffer (bitmap) or
a Map
(palette).
To run the tests you need to supply csg1.dat
and csg1i.dat
. Create a folder
called game-files
and drop them in there. Then run npm test
.