//-------------------------------------------------------------------------- // File: red_control.c // Description: Contains Functions to control RedGem Sprite States // Notes: N/A //-------------------------------------------------------------------------- //---------------------- // Includes //---------------------- #include #include "red_control.h" #include "main.h" //--------------------------- // RedGem Sprite Tim Address //--------------------------- #define Red 0x80100000 //--------------------------- // RedGem GsSPRITE struct //--------------------------- GsSPRITE RedGem; //-------------------- // Functions //-------------------- //-------------------------------------------------------------------------- // Function: void InitRedGemSprite(void) // Description: Initalizes RedGem GsSPRITE structure // Parameters: none // Returns: none // Notes: N/A //-------------------------------------------------------------------------- void InitRedGemSprite(void) { RECT rect; // Define RECT structure GsIMAGE tim_data; // Define GsIMAGE structure // Get the TIM file info - skip 4 bytes from start of file // to get to info we need GsGetTimInfo ((u_long *)(Red+4),&tim_data); // Load the image into the frame buffer rect.x = tim_data.px; // x pos in frame buffer rect.y = tim_data.py; // y pos in frame buffer rect.w = tim_data.pw; // width of image rect.h = tim_data.ph; // height of image LoadImage(&rect, tim_data.pixel); // load data into frame buffer // Load the CLUT into the frame buffer rect.x = tim_data.cx; // x pos in frame buffer rect.y = tim_data.cy; // y pos in frame buffer rect.w = tim_data.cw; // width of CLUT rect.h = tim_data.ch; // height of CLUT LoadImage(&rect, tim_data.clut); // load data into frame buffer // Initialise sprite structure RedGem.attribute = 0x01000000; // sprite attribute - 8 bit RedGem.x = 16; // sprite x axis position RedGem.y = 16; // sprite y axis position // The width of an 8 bit sprite is half that of a 16 bit hence the *2 RedGem.w = (tim_data.pw*2); // sprite width RedGem.h = tim_data.ph; // sprite height RedGem.tpage = GetTPage(1,0, tim_data.px, tim_data.py); RedGem.u = 0; // Texture page offset x axis RedGem.v = 0; // Texture page offset y axis RedGem.cx = tim_data.cx; // CLUT x axis position RedGem.cy = tim_data.cy; // CLUT y axis position RedGem.r = 128; // Regular brightness RedGem.g = 128; // Regular brightness RedGem.b = 128; // Regular brightness RedGem.mx = 0; // RedGem.my = 0; // RedGem.scalex = ONE; // Defined as 4096 RedGem.scaley = ONE; // Defined as 4096 RedGem.rotate = 0; // No rotation // Wait until LoadImage() has finished before returning DrawSync(0); }// InitRedGemSprite