// C Source File
// Created 29/09/2003; 19:17:15
#define USE_TI89 // Compile for TI-89
#define USE_TI92PLUS // Compile for TI-92 Plus
#define USE_V200 // Compile for V200
#define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization
#define MIN_AMS 100 // Compile for AMS 1.00 or higher
#define SAVE_SCREEN // Save/Restore LCD Contents
#include <tigcclib.h> // Include All Header Files
#define round(x) ({typeof(x) __x = (x); typeof(x) __ux = (typeof(x))trunc(x); __ux<=__x+0.5 ? (long)__ux : (long)__ux+1; })
enum Attrib {CT_NONE = 0, CT_UNDL = 1, CT_FRAME = 2, CT_CROSS = 4, CT_WWRAP = 8};
void CenterStrX(short y, const char *str, short Attr, int underline);
void Center3DStrX(short y, const char * str, short Attr, int underline);
// Main Function
void _main(void)
{
short x, att;
float a, l;
char round[20];
static unsigned short holly_bomb[] = { 0x23, 0x77, 0x3E, 0x1C, 0xF3E, 0x30F7, 0x70E2, 0x51E0, 0x9B90, 0x8F10, 0x8E10, 0x9F70, 0x79E0, 0x7020, 0x30C0, 0xF00};
static unsigned long ver_debut[] = { 0x1F0, 0x208, 0x404, 0x802, 0x802, 0x806, 0x809, 0x8C9, 0x92B, 0x92B, 0x969, 0x966, 0x922, 0x8C2, 0x802, 0x802, 0x804, 0x7C838, 0x82804, 0x101804, 0x200804, 0x200804, 0x400804, 0x400404, 0x810404, 0x810204, 0x1010004, 0x2028004, 0x4028008, 0x2044008, 0x1083010, 0xF00FE0};
static unsigned long ver_debut2[] = { 0x1F0, 0x208, 0x404, 0x802, 0x802, 0x806, 0x809, 0x8C9, 0x92B, 0x92B, 0x969, 0x966, 0x922, 0x8C2, 0x802, 0x802, 0x804, 0x838, 0x804, 0x804, 0x804, 0x804, 0x3F0804, 0xC0E804, 0x1001C04, 0x6000204, 0x8000004, 0x10000004, 0x20080008, 0x40140008, 0x30630010, 0xF80FFE0};
clrscr();
a=0;
FontSetSys(F_8x10);
CenterStrX(35, "F5 to skip intro", A_NORMAL, CT_UNDL);
FontSetSys(F_6x8);
OSFreeTimer(USER_TIMER);
OSRegisterTimer(USER_TIMER, 20);
for(x=3 ; x!=0 ; x--)
{
sprintf(round, "%i", x);
CenterStrX(52, round, A_REPLACE, CT_NONE);
while(!OSTimerExpired(USER_TIMER));
OSTimerRestart(USER_TIMER);
if(kbhit()==272)
{
a=32;
break;
}
}
GKeyFlush();
INT_HANDLER save_int_1; save_int_1 = GetIntVec(AUTO_INT_1); SetIntVec(AUTO_INT_1, DUMMY_HANDLER);
if(a!=32)
{
OSFreeTimer(USER_TIMER);
OSRegisterTimer(USER_TIMER, 5);
for(x=0 ; x!=50 ; x+=5)
{
clrscr();
Sprite32(x, 65, 32, ver_debut, LCD_MEM, SPRT_OR);
while(!OSTimerExpired(USER_TIMER));
OSTimerRestart(USER_TIMER);
clrscr();
Sprite32(x+5, 65, 32, ver_debut2, LCD_MEM, SPRT_OR);
while(!OSTimerExpired(USER_TIMER));
OSTimerRestart(USER_TIMER);
}
clrscr();
Sprite32(50, 65, 32, ver_debut, LCD_MEM, SPRT_OR);
FontSetSys(F_8x10);
DrawStrXY(82, 60, "?", A_NORMAL);
FontSetSys(F_4x6);
OSFreeTimer(USER_TIMER);
OSRegisterTimer(USER_TIMER, 1);
for(x=0 ; x!=-40 ; x--)
{
for(att=0 ; att!=100 ; att++)
{
DrawLine(90, att, 160, att, A_REVERSE);
}
att=83-sqrt(1600-(x*x));
Sprite16(145+x, att, 16, holly_bomb, LCD_MEM, SPRT_OR);
for(l=0; l>6; l++); //ralentir
//while(!OSTimerExpired(USER_TIMER));
//OSTimerRestart(USER_TIMER);
}
for(x=10 ; x!=-15 ; x--)
{
for(att=0 ; att!=100 ; att++)
{
DrawLine(82, att, 121, att, A_REVERSE);
}
att=83-sqrt(100-(x*x));
Sprite16(95+x, att, 16, holly_bomb, LCD_MEM, SPRT_OR);
for(l=0; l>6; l++); //ralentir
//while(!OSTimerExpired(USER_TIMER));
//OSTimerRestart(USER_TIMER);
}
OSFreeTimer(USER_TIMER);
OSRegisterTimer(USER_TIMER, 20);
for(x=3 ; x!=0 ; x--)
{
sprintf(round, "%i", x);
DrawStrXY(100, 75, round, A_REPLACE);
FontSetSys(F_8x10);
DrawStrXY(52+10*x, 50+10*abs(x-2), "!", A_NORMAL);
FontSetSys(F_4x6);
while(!OSTimerExpired(USER_TIMER));
OSTimerRestart(USER_TIMER);
}
DrawStrXY(100, 75, " ", A_REPLACE);
att=0;
for(x=2 ; x!=35 ; x++)
{
DrawClipEllipse(80, 99, x, x, &(SCR_RECT){{0, 0, 160, 100}}, A_NORMAL);
DrawClipEllipse(80, 99, x-1, x-1, &(SCR_RECT){{0, 0, 160, 100}}, A_REVERSE);
}
FontSetSys(F_4x6);
CenterStrX(89, "Worms", A_NORMAL, 0);
FontSetSys(F_6x8);
for(x=35 ; x!=60 ; x++)
{
att+=1;
DrawClipEllipse(80, 99, x+att, x, &(SCR_RECT){{0, 0, 160, 100}}, A_NORMAL);
DrawClipEllipse(80, 99, x+att-2, x-1, &(SCR_RECT){{0, 0, 160, 100}}, A_REVERSE);
if(x==48)
CenterStrX(88, "Worms", A_REPLACE, 0);
if(x==58)
{
FontSetSys(F_8x10);
CenterStrX(87, "Worms", A_REPLACE, 0);
FontSetSys(F_6x8);
}
}
}
SetIntVec(AUTO_INT_1, save_int_1);
ngetchx();
}
void CenterStrX(short y, const char *str, short Attr, int underline)
{
if((underline & CT_UNDL) == CT_UNDL)
{
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2, FontGetSys()*2+6+y, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys()), FontGetSys()*2+6+y, A_NORMAL);
}
else if((underline & CT_FRAME) == CT_FRAME)
{
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2-1, FontGetSys()*2+6+y, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys())+1, FontGetSys()*2+6+y, A_NORMAL);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2, FontGetSys()*2+6+y-1, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys()), FontGetSys()*2+6+y-1, A_REVERSE);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2, y-1, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys()), y-1, A_REVERSE);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2-1, y-2, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys())+1, y-2, A_NORMAL);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2-1, y-2, (160-DrawStrWidth(str, FontGetSys()))/2-1, FontGetSys()*2+6+y, A_NORMAL);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys())+1, y-2, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys())+1, FontGetSys()*2+6+y, A_NORMAL);
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2-1, FontGetSys()*2+6+y+1, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys())+1, FontGetSys()*2+6+y+1, A_REVERSE);
}
if((underline & CT_CROSS) == CT_CROSS)
{
DrawLine((160-DrawStrWidth(str, FontGetSys()))/2, FontGetSys()*2+y, (160-DrawStrWidth(str, FontGetSys()))/2+DrawStrWidth(str, FontGetSys()), FontGetSys()*2+y, A_NORMAL);
}
if((underline & CT_WWRAP) == CT_WWRAP)
{
//TODO
}
DrawStrXY((160-DrawStrWidth(str, FontGetSys()))/2, y, str, Attr);
}
void Center3DStrX(short y, const char * str, short Attr, int underline)
{
if(GrayCheckRunning())
{
SetPlane(LIGHT_PLANE);
DrawStrXY((LCD_WIDTH-DrawStrWidth(str, FontGetSys()))/2, y, str, Attr);
DrawStrXY((LCD_WIDTH-DrawStrWidth(str, FontGetSys()))/2-1, y-1, str, Attr);
SetPlane(DARK_PLANE);
DrawStrXY((LCD_WIDTH-DrawStrWidth(str, FontGetSys()))/2-1, y-1, str, Attr);
underline = 0;
}
}
voici le code complet d'une intro de jeu ...
mais au lieu de laisser un laps de temps pour eviter l'intro, j'aimerai qu'on puisse la quitter n'importe quand. Ya pas une solution avec l'interrupt handler ?? j'avoue que G pas bien compris le tutos en anglais de Tict
@+