SPRTINFO

From SRB2 Wiki
Jump to navigation Jump to search
To do
Review for accuracy

SPRTINFO is a text lump that provides information about sprites, such as the point to rotate around.

Format

SPRTINFO is a text lump, though it is formatted differently than SOC. Below is an example of the contents of a SPRTINFO lump:

//
// Sonic
//

Sprite2 NDRL
{
	Skin sonic
	Frame A
	{
		XPivot 22
		YPivot 47
	}
	Frame B
	{
		XPivot 22
		YPivot 23
	}
}

The doubled forward slash denotes that a line is a comment and should be ignored by the game.

A sprite info ruleset begins with Sprite2 SNAM, where SNAM is the four-letter sprite prefix that is being referenced. Inside the opening curly bracket following it, there is the declaration Skin skinname, where skinname is the name value of the character being referenced, as set in their S_SKIN. This is followed by Frame X where X is the frame being referenced. Then, in another pair of curly brackets, the values XPivot and YPivot are set. These values specify the point on the sprite, in pixels, that should be used as an "anchor" for rotation, i.e. the sprite is rotated around that point. They are specified as an offset from the top left corner of the sprite; an XPivot and YPivot of 0 and 0 corresponds to the top left corner of the sprite.

The Frame X ruleset and its corresponding XPivot and YPivot declarations can be repeated as many times as needed for each frame.