Following is the actual structure of a single bitmap:
typedef struct bitmap { s16 width; /* Size across to draw in texels */ /* Done if width = 0 */ s16 width_img; /* Actual size across in texels */ s16 s; /* Horizontal offset into bitmap */ /* if (s > width_img), then load only! */ s16 t; /* Vertical offset into base */ void *buf /* Pointer to bitmap data */ /* Don't re-load if new buf */ /* is the same as the old one */ /* Skip if NULL */ s16 actualHeight; /* True Height of this bitmap piece */ s16 LUToffset; /* LUT base index (for 4-bit CI Texs) */ } Bitmap;
typedef struct sprite { s16 x, y; /* Target position */ s16 width, height; /* Target size (before scaling */ f32 scalex, scaley; /* Texel to Pixel scale factor */ s16 expx, expy; /* Explosion spacing */ u16 attr; /* Attribute Flags */ s16 zdepth; /* Z Depth */ u8 red, green, blue, alpha; /* Primitive Color */ u16 startTLUT; /* Lookup Table Entry Starting index */ s16 nTLUT; /* Total number of LUT Entries */ s16 *LUT; /* Pointer to Lookup Table */ s16 istart; /* Starting bitmap index */ s16 istep; /* Bitmaps index step (see SP_INCY) */ /* if 0, then variable width bitmaps */ s16 nbitmaps; /* Total number of bitmaps */ s16 ndisplist; /* Total number of display-list words */ s16 bmheight; /* Bitmap Texel height (Used) */ s16 bmHreal; /* Bitmap Texel height (Real) */ u8 bmfmt; /* Bitmap Format */ u8 bmsiz; /* Bitmap Texel Size */ Bitmap *bitmap; /* Pointer to first bitmap */ Gfx *rsp_dl; /* Pointer to RSP display list */ Gfx *rsp_dl_next; /* Pointer to next RSP DL entry */ } Sprite;
Sprite attributes permit sprites to be used in a variety of different ways. The following detailed description of each attribute indicates how setting or clearing that attribute affects the appearance of the drawn sprite. Note also that these attributes are as independent as possible, thus greatly expanding the available variety and uses for sprites.