/* --------------------------------------------------------------------- ** Project: Tetixx (a Tetris clone) ** File: tetixx.c ** StartDate: 05.02.1999 ** EndDate: 15.07.1999 ** Autor: Robert Jurziga */ #include #include "cntrl.h" #include "tetixx.h" // --------------------------------------------------------------------- // P R O T O T Y P E S // --------------------------------------------------------------------- void InitView(); void RestoreView(); void InitBackgroundSprites(); void InitFont16(); void DecodeTextPages(); void InitSelectorSprite(char *tim, GsSPRITE *spr); void InitSelectorSprites(); void InitHiscoreSprites(); void InitGameData(); // --------------------------------------------------------------------- // V A R I A B L E S // --------------------------------------------------------------------- GsOT WorldOT[2]; GsOT_TAG OTab[2][1<attribute = 0; tempspr->x = (512-256)>>1; tempspr->y = 0; tempspr->w = (timimg.pw)<<2; tempspr->h = timimg.ph; tempspr->tpage = GetTPage(0, 0, timimg.px, timimg.py); tempspr->u = (timimg.px % 64) << 2; tempspr->v = timimg.py; tempspr->cx = timimg.cx; tempspr->cy = timimg.cy; tempspr->r = tempspr->g = tempspr->b = 128; tempspr->mx = tempspr->my = 0; tempspr->scalex = tempspr->scaley = ONE; tempspr->rotate = 0; } /* --------------------------------------------------------------------- // Function: DecodeTextPages // Description: Convert each character of the TextPages text into // the index number deliverd by the font16chartable // loopup table. */ void DecodeTextPages() { short i,_done,_done2; char *tempptr; char letter; char k; _done=i=0; while (!_done) { tempptr=textpages[i]; _done2=0; while (!_done2) { letter = *tempptr; switch (letter) { case '\xff': // signalize line skip { tempptr++; break; } case '\xfe': // singalize end of page { _done2=1; break; } case '\xfd': // singalize end of pages { _done2=1; _done=1; break; } default: { for (k=0; kattribute = 0; tempspr->x = 0; tempspr->y = 0; tempspr->w = 16; tempspr->h = 16; tempspr->tpage = GetTPage(0, 0, tex_px, tex_py); tempspr->u = tex_u; tempspr->v = tex_v; tempspr->cx = tim.cx; tempspr->cy = tim.cy; tempspr->r = 128; tempspr->g = 128; tempspr->b = 128; tempspr->mx = 0; tempspr->my = 0; tempspr->scalex = ONE; tempspr->scaley = ONE; tempspr->rotate = 0; tempspr++; tex_u+=16; } tex_v+=16; tex_u=0; tex_py+=16; } for (j=0; j < 4; j++) { tempspr->attribute = 0; tempspr->x = 0; tempspr->y = 0; tempspr->w = 16; tempspr->h = 16; tempspr->tpage = GetTPage(0, 0, tex_px, tex_py); tempspr->u = tex_u; tempspr->v = tex_v; tempspr->cx = tim.cx; tempspr->cy = tim.cy; tempspr->r = 128; tempspr->g = 128; tempspr->b = 128; tempspr->mx = 0; tempspr->my = 0; tempspr->scalex = ONE; tempspr->scaley = ONE; tempspr->rotate = 0; tempspr++; tex_u+=16; } } /* --------------------------------------------------------------------- // Function: InitHiscoreSprites // Description: The hiscore sprite is like the Tetixx Logo sprite. // It is 448 pixel wide and has to be devied into two // spriets */ void InitHiscoreSprites() { GsIMAGE tim; RECT rect,imgrect; u_long *ptr; GsSPRITE *spr; short i,j; int v_loc,u_loc; // Load big HISCORE sprite into VRAM ptr=(u_long *)HiscoreLogo; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); HLLeft.attribute=(1<<24); HLLeft.x=(512 - 448) >> 1; HLLeft.y=0; HLLeft.w=256; HLLeft.h=78; HLLeft.tpage= GetTPage(1, 0, tim.px, tim.py); HLLeft.u = HLLeft.v=0; HLLeft.cx=tim.cx; HLLeft.cy=tim.cy; HLLeft.r = HLLeft.g = HLLeft.b = 128; HLLeft.mx = HLLeft.my = 0; HLLeft.scalex=HLLeft.scaley=ONE; HLLeft.rotate=0; HLRight.attribute=(1<<24); HLRight.x=((512 - 448) >> 1) + 256; HLRight.y=0; HLRight.w=448-256; HLRight.h=78; HLRight.tpage= GetTPage(1, 0, tim.px+(256>>1), tim.py); HLRight.u = HLRight.v=0; HLRight.cx=tim.cx; HLRight.cy=tim.cy; HLRight.r = HLRight.g = HLRight.b = 128; HLRight.mx = HLRight.my = 0; HLRight.scalex=HLRight.scaley=ONE; HLRight.rotate=0; // load the HiscoreFont into VRAM ptr=(u_long *)ScoreFont; ptr++; GsGetTimInfo(ptr, &tim); imgrect.x = tim.px; imgrect.y = tim.py; imgrect.w = tim.pw; imgrect.h = tim.ph; LoadImage(&imgrect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr=&ScoreFontCharSprites[0]; v_loc = tim.py; u_loc = 0; for(j=0; j<2; j++) { for(i=0, u_loc=0; i<16; i++, spr++, u_loc+=16) // init the first line (25 chars) (a-y) { spr->attribute = 0; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->u = u_loc; spr->v = v_loc; spr->cx = tim.cx; spr->cy = tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate = 0; } v_loc+=17; } for(i=0, u_loc =0; i<7; i++, spr++, u_loc+=16) // init the 2nd line (z : . 0-9) { spr->attribute = 0; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->u = u_loc; spr->v = v_loc; spr->cx = tim.cx; spr->cy = tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate = 0; } } /* --------------------------------------------------------------------- // Function: InitGameData // Description: Set all data neccessery to create the game // the sprites which are used in the game. */ void InitGameData() { GsIMAGE tim; RECT rect; u_long *ptr; GsSPRITE *spr; short i,j; unsigned long *clutptr; unsigned short xoff,yoff; unsigned char *uv; // load the playback sprite ptr=(u_long *)PlayBackText; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &PlayBackTextSprite; spr->attribute=1<<24; spr->x=spr->y = 0; spr->w=234; spr->h=232; spr->tpage= GetTPage(1, 0, tim.px, tim.py); spr->u = 0; spr->v=12; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Game Score Monitor Sprite ptr = (u_long *)GameScoreMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &GameScoreMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=100; spr->h=42; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v=78; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Game Lines Monitor Sprite ptr = (u_long *)GameLinesMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &GameLinesMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=100; spr->h=42; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 104; spr->v= 78; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Game Stones Monitor Sprite ptr = (u_long *)GameStonesMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &GameStonesMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=100; spr->h=42; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= 78+42; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Game Time Monitor Sprite ptr = (u_long *)GameTimeMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &GameTimeMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=100; spr->h=42; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 104; spr->v= 78+42; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Preview Monitor Sprite ptr = (u_long *)PreviewMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &PreviewMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=96; spr->h=75; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= 78+42+42; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Hiscore Monitor Sprite ptr = (u_long *)HiscoreMonitor; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &HiscoreMonitorSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=100; spr->h=42; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 104; spr->v= 78+42+42; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Pause Logo Sprite ptr = (u_long *)PauseLogo; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &PauseLogoSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=136; spr->h=24; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 104; spr->v= 78+42+42+42; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the Game Over Sprite ptr = (u_long *)GameOverLogo; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &GameOverLogoSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=156; spr->h=22; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= 438-256; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load the InsertStandardController Sprite ptr = (u_long *)ISCntrlLogo; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); spr = &ISCntrlSprite; spr->attribute=0; spr->x=spr->y = 0; spr->w=248; spr->h=40; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= 460-256; spr->cx=tim.cx; spr->cy=tim.cy; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; // load 19 stone-color palettes clutptr = &StoneCluts[0]; for (i=0; iattribute=0; spr->w=20; spr->h=12; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= STONE_V; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; } // setup Game (Current) stone with Stone VRAM location spr = &CurrStoneSprites[0]; for(i=0; i<16; i++, spr++) { spr->attribute=0; spr->w=20; spr->h=12; spr->tpage= GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v= STONE_V; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex=spr->scaley=ONE; spr->rotate=0; } // setup the tetixx field with Stone VRAM location spr=&TetixxFieldSprites[0]; yoff = TETIXX_FIELD_YOFF; for(j=0; jattribute=0x88000000; // NoDisplay/No RotScale spr->x=xoff; spr->y=yoff; spr->w=20; spr->h=12; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->u = 0; spr->v = STONE_V; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; spr++; xoff+=STONE_WIDTH; } yoff+=STONE_HEIGHT; } // Set Up Score Sprites ptr=(u_long *)ScoreFont; ptr++; GsGetTimInfo(ptr, &tim); spr = &GameScoreSprites[0]; xoff = SCORE_MONITOR_LEFT; yoff = SCORE_MONITOR_TOP; xoff+= 80; // 9 sprite are displayed (100 000 000) for (i=0; i<9; i++ ,spr++) { spr->attribute = 0x88000000; spr->x = xoff; spr->y = yoff; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->cx = HS_SCORE_COLSX; spr->cy = HS_SCORE_COLSY; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; xoff-=10; } // Setup Hiscore Sprites spr = &GameHiScoreSprites[0]; xoff = HISCORE_MONITOR_LEFT; yoff = HISCORE_MONITOR_TOP; xoff+= 80; // 9 sprite are displayed (100 000 000) for (i=0; i<9; i++ ,spr++) { spr->attribute = 0x88000000; spr->x = xoff; spr->y = yoff; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->cx = HS_SCORE_COLSX; spr->cy = HS_SCORE_COLSY; spr->r = spr->g = spr->b = 196; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; xoff-=10; } // Setup Lines Sprites spr = &GameLinesSprites[0]; xoff = LINES_MONITOR_LEFT; yoff = LINES_MONITOR_TOP; xoff+= 80; // 9 sprite are displayed (100 000 000) for (i=0; i<9; i++ ,spr++) { spr->attribute = 0x88000000; spr->x = xoff; spr->y = yoff; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->cx = HS_LINES_COLSX; spr->cy = HS_LINES_COLSY; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; xoff-=10; } // Setup Stones Sprites spr = &GameStonesSprites[0]; xoff = STONES_MONITOR_LEFT; yoff = STONES_MONITOR_TOP; xoff+= 80; // 9 sprite are displayed (100 000 000) for (i=0; i<9; i++ ,spr++) { spr->attribute = 0x88000000; spr->x = xoff; spr->y = yoff; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->cx = HS_STONES_COLSX; spr->cy = HS_STONES_COLSY; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; xoff-=10; } // Setup Time Sprites spr = &GameTimeSprites[0]; xoff = TIME_MONITOR_LEFT; yoff = TIME_MONITOR_TOP; // 8 sprite are displayed (00:00:00) for (i=0; i<8; i++ ,spr++) { spr->attribute = 0x88000000; spr->x = xoff; spr->y = yoff; spr->w = 16; spr->h = 17; spr->tpage = GetTPage(0, 0, tim.px, tim.py); spr->cx = HS_TIME_COLSX; spr->cy = HS_TIME_COLSY; spr->r = spr->g = spr->b = 128; spr->mx = spr->my = 0; spr->scalex = spr->scaley = ONE; spr->rotate=0; xoff+=10; } // Initalize the VU for the Number Sprites uv = &NumbersVRAM_UV[0]; spr = &ScoreFontCharSprites[26]; // point at 0 for (i=0; i<11; i++, spr++) { // 0-9 and : *uv = (unsigned char)spr->u; *(uv+1) = (unsigned char)spr->v; uv+=2; } // Load CLUTS for coloured hiscores rect.x = HS_RANK_COLSX; rect.y = HS_RANK_COLSY; rect.w = 16; rect.h = 1; LoadImage(&rect, &ScoreCols_RANK[0]); DrawSync(0); rect.x = HS_NAME_COLSX; rect.y = HS_NAME_COLSY; LoadImage(&rect, &ScoreCols_NAME[0]); DrawSync(0); rect.x = HS_SCORE_COLSX; rect.y = HS_SCORE_COLSY; LoadImage(&rect, &ScoreCols_SCORE[0]); DrawSync(0); rect.x = HS_LINES_COLSX; rect.y = HS_LINES_COLSY; LoadImage(&rect, &ScoreCols_LINES[0]); DrawSync(0); rect.x = HS_STONES_COLSX; rect.y = HS_STONES_COLSY; LoadImage(&rect, &ScoreCols_STONES[0]); DrawSync(0); rect.x = HS_TIME_COLSX; rect.y = HS_TIME_COLSY; LoadImage(&rect, &ScoreCols_TIME[0]); DrawSync(0); } /* --------------------------------------------------------------------- // Function: InitBackgroundSprites // Description: Init the game background sprites. // Background consists of 2 256x256 textures, which makes // 512x256 background. The sprites are located during the // game at the same place within the frame-buffer // Left Sprite:x,y/clut:x,y :512,0 / 768,0 // Right Sprite:x,y/clut:x,y :640,0 / 768,1 */ void InitBackgroundSprites() { static GsIMAGE tim; static RECT rect; static u_long *ptr; static u_short tpage; // Setup left background sprite ptr=(u_long *)bg_left; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); tpage = GetTPage(1, 0, tim.px, tim.py); BGLeft.attribute=(1<<24); BGLeft.x=0; BGLeft.y=0; BGLeft.w=256; BGLeft.h=256; BGLeft.tpage=tpage; BGLeft.u=0; BGLeft.v=0; BGLeft.cx=tim.cx; BGLeft.cy=tim.cy; BGLeft.r = 0; BGLeft.g = 0; BGLeft.b = 0; BGLeft.mx = 0; BGLeft.my = 0; BGLeft.scalex=ONE; BGLeft.scaley=ONE; BGLeft.rotate=0; // Setup right background sprite ptr=(u_long *)bg_right; ptr++; GsGetTimInfo(ptr, &tim); rect.x = tim.px; rect.y = tim.py; rect.w = tim.pw; rect.h = tim.ph; LoadImage(&rect, tim.pixel); DrawSync(0); rect.x = tim.cx; rect.y = tim.cy; rect.w = tim.cw; rect.h = tim.ch; LoadImage(&rect, tim.clut); DrawSync(0); tpage = GetTPage(1, 0, tim.px, tim.py); BGRight.attribute=1<<24; BGRight.x=256; BGRight.y=0; BGRight.w=256; BGRight.h=256; BGRight.tpage=tpage; BGRight.u=0; BGRight.v=0; BGRight.cx=tim.cx; BGRight.cy=tim.cy; BGRight.r = 0; BGRight.g = 0; BGRight.b = 0; BGRight.mx = 0; BGRight.my = 0; BGRight.scalex=ONE; BGRight.scaley=ONE; BGRight.rotate=0; } /* --------------------------------------------------------------------- // Function: InitView // Description: Init the basic View Parameters // */ void InitView() { // Set up graphics OldView = SetVideoMode(MODE_PAL); ResetGraph(0); GsInitGraph(SCREEN_WIDTH, SCREEN_HEIGHT, GsOFSGPU, 0, 0); GsDefDispBuff(0, 0, 0, SCREEN_HEIGHT); // Set display output position on screen GsDISPENV.screen.x=ScrXOff; GsDISPENV.screen.y=ScrYOff; GsDISPENV.screen.w=255; GsDISPENV.screen.h=255; // Set draw environment GsDRAWENV.r0=0x00; GsDRAWENV.g0=0x00; GsDRAWENV.b0=0x00; GsDRAWENV.isbg=0x00; // Set up and init ordering table WorldOT[0].length=OT_LENGTH; WorldOT[0].org = OTab[0]; GsClearOt(0, 0, &WorldOT[0]); WorldOT[1].length=OT_LENGTH; WorldOT[1].org = OTab[1]; GsClearOt(0, 0, &WorldOT[1]); } /* --------------------------------------------------------------------- // Function: RestoreView // Description: Init the previous VideoMode. // */ void RestoreView() { SetVideoMode(OldView); ResetGraph(0); }