User Tools

Site Tools


runaway_nds

Runaway: The Dream of the Turtle (Nintendo DS)

Here is a backup of a working sprite viewer for the DS version of this game. By no means perfect, often the sprite has blank space on the left, doing something wrong still.

Basically the SPR files only store the palette reference for used pixels. Repeat the following until EOF:

  • Start x = 2 bytes
  • Start y = 2 bytes
  • Num Values = 2 bytes
  • Values = Num Values bytes (one value directly maps to an offset in sprite.pal).

In the code below, “Colour” is a class in GT/GameTools.

string filePal = openFileDialog1.FileName.Replace(openFileDialog1.SafeFileName, "") + "..\\sprite.pal";
GTFS fsPal = new GTFS(filePal);
 
List<Color> listPal = new List<Color>();
while (fsPal.Position < fsPal.Length - 1) {
	int input = GT.ReadInt16(fsPal, 2, false);
	listPal.Add(Colour.ABGR1555(input));
}
 
//-------
 
GTFS fs = new GTFS(openFileDialog1.FileName);
 
List<RunawayPackedImage> listImage = new List<RunawayPackedImage>();
while (fs.Position < fs.Length - 1) {
	listImage.Add(new RunawayPackedImage(fs));
}
 
int maxFirst = listImage.Max(x => x.derivedfirstadd);
int maxSecond = listImage.Max(x => x.second);
 
Bitmap bmp = new Bitmap(maxFirst, maxSecond+1, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
foreach(RunawayPackedImage rpi in listImage) {
	for(int i = 0; i < rpi.numValues; i++) {
		bmp.SetPixel(rpi.first + i, rpi.second, listPal[rpi.values[i]]);
	}
}
 
new FormImage(bmp).Show();
runaway_nds.txt · Last modified: 2016/10/24 12:44 by jas2o