/* --------------------------------------------------------------------- ** Project: Tetixx (a Tetris clone) ** File: intro.c ** Date: 07.02.1999 ** Autor: Robert Jurziga */ #include #include "tetixx.h" // --------------------------------------------------------------------- // D E F I N E S // --------------------------------------------------------------------- #define DefLogoScale 10240 // (apprx 2.5 times the orginal) extern char AntiSenseLogo[]; // --------------------------------------------------------------------- // P R O T O T Y P E S // --------------------------------------------------------------------- void ViewIntro(); static void _InitLogoSprite(); static void _DoIntro(); // --------------------------------------------------------------------- // V A R I A B L E S // --------------------------------------------------------------------- static GsSPRITE antislogo; static short _IntroPhase; static int _ActiBuf; static int _scale=DefLogoScale; 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 ViewIntro() { _fade=_wait=_done=_IntroPhase=0; _scale=DefLogoScale; _InitLogoSprite(); _DoIntro(); } /* --------------------------------------------------------------------- ** Function: _DoIntro ** Description: Lets do it. ** Scale down from big and fade form black simetousley, ** If scalex and scaley is ONE, then wait 2 seconds. ** Fade to black and return to main. */ void _DoIntro() { while(!_done) { _ActiBuf = GsGetActiveBuff(); GsSetWorkBase((PACKET*)GPU_WorkArea[_ActiBuf]); GsClearOt(0, 0, &WorldOT[_ActiBuf]); switch (_IntroPhase) { case 0: { if (_scale == 4096) { _IntroPhase++; _wait=0;} antislogo.scalex=_scale; antislogo.scaley=_scale; antislogo.r=_fade; antislogo.g=_fade; antislogo.b=_fade; _scale-=64; if (_fade < 128) _fade+=8; break; } case 1: { _wait++; if (_wait==100) {_IntroPhase++; _fade=128;} break; } case 2: { if (_fade == 8) _IntroPhase++; _fade-=8; antislogo.r=_fade; antislogo.g=_fade; antislogo.b=_fade; break; } case 3: { _done=1; break; } } GsSortSprite(&antislogo,&WorldOT[_ActiBuf],0); DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0x0, 0x0, 0x00, &WorldOT[_ActiBuf]); GsDrawOt(&WorldOT[_ActiBuf]); } } /* --------------------------------------------------------------------- ** Function: _InitLogoSprites ** Description: Init sprites. */ static void _InitLogoSprite() { GsIMAGE tim; RECT rect; u_short tpage; u_long *ptr; // Set Logo sprite ptr = (u_long *)AntiSenseLogo; 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); antislogo.attribute=(1<<25); // 15bit direct antislogo.x=256; // Screen is 512 and sprite 256 antislogo.y=128; antislogo.w=256; antislogo.h=128; antislogo.tpage=tpage; antislogo.u=0; antislogo.v=0; antislogo.cx=0; antislogo.cy=0; antislogo.r=0x0; antislogo.g=0x0; antislogo.b=0x0; antislogo.mx=256/2; antislogo.my=128/2; antislogo.scalex=ONE; antislogo.scaley=ONE; antislogo.rotate=0; }