//-------------------------------------------------------------------------- // File: blue_control.c // Description: Contains Functions to control BlueGem Sprite States // Notes: N/A //-------------------------------------------------------------------------- //---------------------- // Includes //---------------------- #include #include "blue_control.h" #include "main.h" //--------------------------- // BlueGem Sprite Tim Address //--------------------------- #define Blue 0x80120000 //--------------------------- // BlueGem GsSPRITE struct //--------------------------- GsSPRITE BlueGem; //-------------------- // Functions //-------------------- //-------------------------------------------------------------------------- // Function: void InitBlueGemSprite(void) // Description: Initalizes BlueGem GsSPRITE structure // Parameters: none // Returns: none // Notes: N/A //-------------------------------------------------------------------------- void InitBlueGemSprite(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 *)(Blue+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 BlueGem.attribute = 0x01000000; // sprite attribute - 8 bit BlueGem.x = 16; // sprite x axis position BlueGem.y = 16; // sprite y axis position // The width of an 8 bit sprite is half that of a 16 bit hence the *2 BlueGem.w = (tim_data.pw*2); // sprite width BlueGem.h = tim_data.ph; // sprite height BlueGem.tpage = GetTPage(1,0, tim_data.px, tim_data.py); BlueGem.u = 0; // Texture page offset x axis BlueGem.v = 0; // Texture page offset y axis BlueGem.cx = tim_data.cx; // CLUT x axis position BlueGem.cy = tim_data.cy; // CLUT y axis position BlueGem.r = 128; // Regular brightness BlueGem.g = 128; // Regular brightness BlueGem.b = 128; // Regular brightness BlueGem.mx = 0; // BlueGem.my = 0; // BlueGem.scalex = ONE; // Defined as 4096 BlueGem.scaley = ONE; // Defined as 4096 BlueGem.rotate = 0; // No rotation // Wait until LoadImage() has finished before returning DrawSync(0); }// InitBlueGemSprite