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