/* --------------------------------------------------------------------- ** Project: Tetixx (a Tetris clone) ** File: title.c ** Date: 15.07.1999 ** Autor: Robert Jurziga */ #include #include "tetixx.h" // --------------------------------------------------------------------- // P R O T O T Y P E S // --------------------------------------------------------------------- void ViewTitle(); static void _InitTitleSprite(); static void _DoTitle(); // --------------------------------------------------------------------- // V A R I A B L E S // --------------------------------------------------------------------- static GsSPRITE titlelogo; static short _IntroPhase; static int _ActiBuf; static u_char _fade; static int _wait; static int _done; /* --------------------------------------------------------------------- ** Function: ViewIntro ** Description: Prepare to view the logo. Aim is to view the scaled. ** AntiSense banner then to scale down the sprite to its ** orginal size. Wait a while and finally fade the ** brightness to ZERO. */ void ViewTitle() { _fade=_wait=_done=_IntroPhase=0; OldView = SetVideoMode(MODE_PAL); ResetGraph(0); GsInitGraph(256, 256, GsOFSGPU, 0, 0); GsDefDispBuff(0, 0, 0, 256); // 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]); _InitTitleSprite(); _DoTitle(); } /* --------------------------------------------------------------------- ** Function: _DoTitle ** Description: Display Title Screen */ void _DoTitle() { while(!_done) { _ActiBuf = GsGetActiveBuff(); GsSetWorkBase((PACKET*)GPU_WorkArea[_ActiBuf]); GsClearOt(0, 0, &WorldOT[_ActiBuf]); switch (_IntroPhase) { case 0: { if (_fade == 128) { _IntroPhase++; _wait=0;} titlelogo.r=_fade; titlelogo.g=_fade; titlelogo.b=_fade; if (_fade < 128) _fade+=8; break; } case 1: { _wait++; if (_wait==250) {_IntroPhase++; _fade=128;} break; } case 2: { if (_fade == 8) _IntroPhase++; _fade-=8; titlelogo.r=_fade; titlelogo.g=_fade; titlelogo.b=_fade; break; } case 3: { _done=1; break; } } GsSortSprite(&titlelogo,&WorldOT[_ActiBuf],0); DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0x0, 0x0, 0x00, &WorldOT[_ActiBuf]); GsDrawOt(&WorldOT[_ActiBuf]); } } /* --------------------------------------------------------------------- ** Function: _InitLogoSprites ** Description: Init sprites. */ static void _InitTitleSprite() { GsIMAGE tim; RECT rect; u_short tpage; u_long *ptr; // Set Logo sprite ptr = (u_long *)TXTitleLogo; ptr++; // skip the ID 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); tpage = GetTPage(2, 0, tim.px, tim.py); titlelogo.attribute=(1<<25); // 15bit direct titlelogo.x=0; // Screen is 512 and sprite 256 titlelogo.y=0; titlelogo.w=256; titlelogo.h=256; titlelogo.tpage=tpage; titlelogo.u=0; titlelogo.v=0; titlelogo.cx=0; titlelogo.cy=0; titlelogo.r=0x0; titlelogo.g=0x0; titlelogo.b=0x0; titlelogo.mx=0; titlelogo.my=0; titlelogo.scalex=ONE; titlelogo.scaley=ONE; titlelogo.rotate=0; }