Skip to content

Sprite names up to 64 character long and 256 frames per sprite

LJ Sonic requested to merge long-sprite-names into next

This introduces the new LongSprites/ PK3 folder, which lets modders add sprites with names longer than 4 characters (up to 64).

Here is a screenshot showing the basic folder structure:

image

  • The name of the sprite is defined by the name of the folder containing the graphics. Here, we have two sprites: CrawlaStatue and EggmanStatue, with their respective constants SPR_CRAWLASTATUE and SPR_EGGMANSTATUE.
  • The sprite folders can be organised into any number of parent folders, including none, if desired. In this example, the Statues/ folder is simply ignored by SRB2.
  • The graphics lumps are defined in a very similar fashion to regular sprites, but they must be named after the following pattern: <frame number>_<rotation>, where <rotation> is the same as usual (0-7, L/R, etc) and frame_number is the frame number represented as any number of digits up to 4. Examples: 0_0, 0024_R, 3_7, 01_2.
  • Missing rotations are automatically mirrored from their opposite rotation (00_3 <=> 00_7 00_4 <=> 00_6, etc.).
  • If a frame needs to be mirrored from a different frame, the following alternate pattern can be used instead: <frame number>_<rotation>+<frame number 2>_<rotation 2>. Examples: 027_3+028_3, 2_L+4_L.
  • The sprites are allocated the same way as before, using the freeslot() function in Lua or Freeslot blocks in SOC.
  • Instead of being limited to 64 frames, the maximum is now 256.

Because sprites and frames are already exposed as numbers to Lua, this system is entirely backward compatible with existing scripts and can both frame notations be used interchangeably in both Lua and SOC.

Example PK3:

LongSprites.pk3

Edited by LJ Sonic

Merge request reports

Loading