/* * "ESCSPRIT.H" * * Part of The Escotia Playstation Library * * Functions to make programming a chore not a pleasure * * Author: ScoTT Campbell * Date: 10/9/98 * Updated: 30/9/98 * */ #ifndef __ESCSPRITEHEADER #define __ESCSPRITEHEADER /*******************************/ /* Start of GsSPRITE functions */ /*******************************/ void InitSprite(GsSPRITE* spritePtr, unsigned long int spriteAddress, int xPosition, int yPosition); /* Initialisation of sprites in one easy function */ /* spriteAddress is the location where the TIM file has been loaded in main memory */ /* xPosition and yPosition are the display position for the sprite, and can be changed */ /* using the function MoveSprite() */ /* Rotation and scaling point is set to the centre of the sprite */ /* The sprite's attributes are set to a default of brightness adjustment on, rotation */ /* on, transparency off, and display enabled. These can be changed with */ /* SetSpriteAttributes() */ /* Brightness of colours default to normal, and can be changed with SetSpriteColour() */ void CopySprite(GsSPRITE* source, GsSPRITE* destination); /* Copy 1 sprite handlers' values to another */ void InitVerticalSpriteSet(GsSPRITE* spriteArray, unsigned long int spriteAddress, unsigned int numberInSet, unsigned int spriteHeight, unsigned int xPosition, unsigned int yPosition); /* Initialisation of a set of sprites loaded as a single TIM in one easy function */ /* spriteArray is a pointer to an array of at least size numberInSet */ /* numberInSet is the number of sprites to be initialised */ /* spriteHeight is the height of the sprite in pixels */ /* spriteAddress is the location where the TIM file has been loaded in main memory */ /* xPosition and yPosition are the display position for all sprites, and can be changed */ /* using the function MoveSprite() */ /* The sprites are set up as per InitSprite() */ /* PRE: The sprites to be initialised must be stacked on top of each other */ /* POST: spriteArray contains numberInSet initialised sprites */ void InitHorizontalSpriteSet(GsSPRITE* spriteArray, unsigned long int spriteAddress, unsigned int numberInSet, unsigned int spriteWidth, unsigned int xPosition, unsigned int yPosition); /* Initialisation of a set of sprites loaded as a single TIM in one easy function */ /* spriteArray is a pointer to an array of at least size numberInSet */ /* numberInSet is the number of sprites to be initialised */ /* spriteWidth is the width of the sprite in pixels */ /* spriteAddress is the location where the TIM file has been loaded in main memory */ /* xPosition and yPosition are the display position for all sprites, and can be changed */ /* using the function MoveSprite() */ /* The sprites are set up as per InitSprite() */ /* PRE: The sprites to be initialised must be positioned beside each other */ /* POST: spriteArray contains numberInSet initialised sprites */ void InitSpriteSet(GsSPRITE* spriteArray, unsigned long int spriteAddress, unsigned int numberInSet, unsigned int spriteWidth, unsigned int spriteHeight, unsigned int xPosition, unsigned int yPosition); /* Initialisation of a set of sprites loaded as a single TIM in one easy function */ /* spriteArray is a pointer to an array of at least size numberInSet */ /* numberInSet is the number of sprites to be initialised */ /* spriteHeight is the height of the sprite in pixels */ /* spriteWidth is the width of the sprite in pixels */ /* spriteAddress is the location where the TIM file has been loaded in main memory */ /* xPosition and yPosition are the display position for all sprites, and can be changed */ /* using the function MoveSprite() */ /* The sprites are set up as per InitSprite() */ /* PRE: The sprites to be initialised must be arranged to have as many across as will */ /* fit into 256 pixels. */ /* POST: spriteArray contains numberInSet initialised sprites */ void SetSpritePosition(GsSPRITE* spritePtr, int xPosition, int yPosition); /* Sprite pointed to by spritePtr has display position set to xPosition, yPosition */ void SetSpriteXPosition(GsSPRITE* spritePtr, int xPosition); /* Sprite pointed to by spritePtr has display X position set to xPosition */ void SetSpriteYPosition(GsSPRITE* spritePtr, int yPosition); /* Sprite pointed to by spritePtr has display Y position set to yPosition */ void MoveSprite(GsSPRITE* spritePtr, int xAmount, int yAmount); /* Sprite pointed to by spritePtr has display position changed by the values specified */ /* by xAmount and yAmount */ void SetSpriteAttributes(GsSPRITE* spritePtr, unsigned long int attributes); /* Sprite pointed to by spritePtr has attributes set to value specified by attributes */ /* All attributes can be changed EXCEPT the 'Sprite pattern colour mode' */ void SetSpriteColour(GsSPRITE* spritePtr, int red, int green, int blue); /* Sprite pointed to by spritePtr has display brightness set to red, gree, blue */ void SetSpriteColourVector(GsSPRITE* spritePtr, CVECTOR* colourVectorPtr); /* Sprite pointed to by spritePtr has display brightness set to value specified by */ /* *colourVectorPtr. */ void SetSpriteRotationCentre(GsSPRITE* spritePtr, int x, int y); /* Sprite pointed to by spritePtr has it's centre of rotation set to (x,y) */ /* The origin for these co-ordinates is the top-left corner of the sprite */ /* Note that since GsSortSprite uses this for the diplay position the sprite will be */ /* drawn in a different location, unless this is accounted for by using */ /* SetSpritePosition() */ void MoveSpriteRotationCentre(GsSPRITE* spritePtr, int xAmount, int yAmount); /* Sprite pointed to by spritePtr has it's centre of rotation moved by (xAmount,yAmount)*/ /* Note that since GsSortSprite uses this for the display position the sprite will be */ /* drawn in a different location, unless this is accounted for by using MoveSprite() */ void RotateSprite(GsSPRITE* spritePtr, long int rotation); /* Rotate the sprite by the amount specified by rotation 4096 = 1 degree */ void SetSpriteSize(GsSPRITE* spritePtr, short int size); /* Set the sprites scalex & scaley fields to size */ void ScaleSprite(GsSPRITE* spritePtr, short int scaleFactor); /* Scale the sprite in both the x and y directions 4096 = Scale factor of 1 */ /* Maximum scale that can occur is 8x */ /* If scaleFactor will increase it past that then it is set to 8x */ void ScaleSpriteInX(GsSPRITE* spritePtr, short int scaleFactor); /* Scale the sprite in both the x direction 4096 = Scale factor of 1 */ /* Maximum scale that can occur is 8x */ /* If scaleFactor will increase it past that then it is set to 8x */ void ScaleSpriteInY(GsSPRITE* spritePtr, short int scaleFactor); /* Scale the sprite in both the y direction 4096 = Scale factor of 1 */ /* Maximum scale that can occur is 8x */ /* If scaleFactor will increase it past that then it is set to 8x */ /*****************************/ /* End of GsSPRITE functions */ /*****************************/ #endif