These videos might hang your browser, sorry!
BirdLand
AcctRegSetDefaultEntry("LT/BirdLand","double high_score=9999;\r\n");
AcctRegExecuteBranch("LT/BirdLand");
$PI,"<1>",1$
$PI,"<2>",2$
$PI,"<3>",3$
$PI,"<4>",4$
#define EAT_TIME 0.5
BoolI1 flap_down,flap_up,reset;
double tt,yy,xx,eat_timeout;
double frame_x,complete,t0,t_score;
TssStruct *song_tss;
#define MAX_BUGS 32
I4 bugs_x[MAX_BUGS],bugs_y[MAX_BUGS];
BoolI1 bugs_dead[MAX_BUGS];
void UpdateWin(TssStruct *tss)
{
I8 i,y,x,
h=tss->win_pixel_width-10,
v=tss->win_pixel_height-10;
U1 *inter,*inter2,*inter3;
if (h<1) h=1;
if (v<1) v=1;
inter=GrElemsInterpolate($IB,"<1>",1$,$IB,"<2>",2$,tt*tt*tt);
GrBitMap *base=GrAlias(grbase,tss);
if (eat_timeout && t<eat_timeout) {
inter2=GrElemsInterpolate($IB,"<3>",3$,$IB,"<4>",4$,tt*tt*tt);
inter3=GrElemsInterpolate(inter2,inter,1.0-(eat_timeout-t)/EAT_TIME);
Free(inter);
Free(inter2);
inter=inter3;
}
GrElemsPlot(base,xx,yy,0,inter);
Free(inter);
for (i=0;i<MAX_BUGS;i++)
if (!bugs_dead[i]) {
x=(bugs_x[i]+frame_x)%h+5;
y=bugs_y[i]%v+5;
base->color=BLACK;
GrPlot(base,x,y);
GrPlot(base,x+1,y);
base->color=RED;
GrPlot(base,x,y-1);
}
base->color=BLACK;
GrPrintF(base,0,0,"Best:%7.2f",high_score);
GrPrintF(base,0,FONT_HEIGHT,"Time:%7.2f Complete:%6.2f%%",t_score,complete);
GrDel(base);
}
void CheckBugs()
{
I8 i,j=0,x,y,
h=Fs->parent_tss->win_pixel_width-10,
v=Fs->parent_tss->win_pixel_height-10;
if (h<1) h=1;
if (v<1) v=1;
if (eat_timeout && eat_timeout-t<0.75*EAT_TIME) {
Btr(&song_tss->task_flags,TSSf_SUSPENDED);
if (t>=eat_timeout)
eat_timeout=0;
}
for (i=0;i<MAX_BUGS;i++)
if (!bugs_dead[i]) {
x=(bugs_x[i]+frame_x)%h+5;
y=bugs_y[i]%v+5;
if (Abs(x-xx)<10 && Abs(y-yy)<10) {
bugs_dead[i]=TRUE;
eat_timeout=t+EAT_TIME;
Sound(1000);
Bts(&song_tss->task_flags,TSSf_SUSPENDED);
j++;
}
} else
j++;
complete=j*100.0/MAX_BUGS;
if (j!=MAX_BUGS)
t_score=t-t0;
else {
Bts(&song_tss->task_flags,TSSf_SUSPENDED);
Sound(0);
if (t_score<high_score)
high_score=t_score;
}
frame_x-=0.1;
if (frame_x<0)
frame_x+=h;
}
void Init()
{
I8 i;
flap_down=FALSE;
flap_up=TRUE;
tt=0;
yy=0;
xx=100;
frame_x=0;
for (i=0;i<MAX_BUGS;i++) {
bugs_dead[i]=FALSE;
bugs_x[i]=RandU2;
bugs_y[i]=RandU2;
}
Btr(&song_tss->task_flags,TSSf_SUSPENDED);
eat_timeout=0;
t0=t;
}
void SongEndTask()
{
Sound(0);
Exit;
}
void SongTask()
{
Fs->end_task_cb=&SongEndTask;
ResetMusicSettings;
while (TRUE) {
Play("W13eBEBCBEsEFqEeBEBCBEsEF");
Play("qEeADABADsDCqDeBEBCB");
Play("EsEDqE");
}
}
void AnimateTask()
{
double d_tt=0;
while (TRUE) {
if (reset) {
Init;
reset=FALSE;
}
if (flap_down) {
flap_down=FALSE;
d_tt=-0.005;
} else if (flap_up) {
flap_up=FALSE;
d_tt= 0.005;
}
if (d_tt<0) {
yy+=75*d_tt;
d_tt+=0.000015;
} else
yy+=0.15;
yy=Limit(yy,10,Fs->parent_tss->win_pixel_height-10);
tt=Limit(tt+d_tt,0.0,1.0);
CheckBugs;
Sleep(1);
}
}
void BirdLand()
{
BoolI1 reset_space=TRUE;
I8 cmd,p1,p2,ch;
TssStruct *animate_tss;
void *old_update=Fs->update_win;
Fs->win_left=1;
Fs->win_right=TEXT_COLS/2;
Fs->win_top=1;
Fs->win_bottom=TEXT_ROWS/2;
UpdateDerivedTssValues;
LtfClear;
PopUpOk("Use $$FG,GREEN$$SPACE$$FG$$ to flap.\r\nHold down to glide.");
reset=TRUE;
animate_tss=Spawn(&AnimateTask,0,"Animate",Fs);
while (reset)
SwapInNextTask;
song_tss=Spawn(&SongTask,0,"Song",Fs);
Fs->update_win=&UpdateWin;
try {
do {
cmd=GetMsg(&p1,&p2,1<<MSG_KEY_DOWN+1<<MSG_KEY_UP);
switch (cmd) {
case MSG_KEY_DOWN:
ch=p1;
if (ch==CH_SPACE) {
if (reset_space) {
flap_down=TRUE;
reset_space=FALSE;
}
} else if (ch==CH_CR)
reset=TRUE;
break;
case MSG_KEY_UP:
ch=0;
if (p1==CH_SPACE) {
flap_up=TRUE;
reset_space=TRUE;
}
break;
default:
ch=0;
}
} while (ch!=CH_CTRLQ && ch!=CH_ESC);
} catch
CatchAll;
Kill(animate_tss);
Kill(song_tss);
Fs->update_win=old_update;
Sound(0);
AcctRegWriteBranch("LT/BirdLand","double high_score=%12.4f;\r\n",high_score);
}
BirdLand;
...........³.................ìÿÿÿ...ùÿÿÿ......ùÿÿÿ...üÿÿÿüÿÿÿ...üÿÿÿüÿÿÿ...ûÿÿÿ......ûÿÿÿ
...þÿÿÿ...
...þÿÿÿ..........................................þÿÿÿ ......... ......
.........
......þÿÿÿ ......þÿÿÿ
...üÿÿÿþÿÿÿ...üÿÿÿ...÷ÿÿÿ......÷ÿÿÿ...ùÿÿÿ......ùÿÿÿ...ÿÿÿÿ......ùÿÿÿþÿÿÿèÿÿÿ.......çÿÿÿ...øÿÿÿÿÿÿÿ.
..øÿÿÿÿÿÿÿêÿÿÿ...................................þÿÿÿ
............ .........ÿÿÿÿ..............³.................èÿÿÿ
...õÿÿÿ......õÿÿÿ...øÿÿÿ.......øÿÿÿ.......ÿÿÿÿ......ÿÿÿÿ............... ......... ...... .........
...............ÿÿÿÿ......øÿÿÿ......øÿÿÿ...............úÿÿÿ......ùÿÿÿ...øÿÿÿ......øÿÿÿ...úÿÿÿýÿÿ
ÿ...ùÿÿÿ....ÿÿÿÿõÿÿÿ...ÿÿÿÿöÿÿÿÿÿÿÿÿÿÿÿ...õÿÿÿ...äÿÿÿ......ãÿÿÿ...ôÿÿÿ......ôÿÿÿ...æÿÿÿ
......üÿÿÿ...þÿÿÿ.....................
......................................³.................ìÿÿÿ...ùÿÿÿ......ùÿÿÿ...üÿÿÿüÿÿÿ...
üÿÿÿüÿÿÿ...ûÿÿÿ......ûÿÿÿ...úÿÿÿ......ýÿÿÿ...ûÿÿÿ......ûÿÿÿ...ûÿÿÿ......þÿÿÿ............þÿÿÿ
......... ......
.........
......þÿÿÿ ......þÿÿÿ
...üÿÿÿþÿÿÿ...üÿÿÿ...÷ÿÿÿ......÷ÿÿÿ...ùÿÿÿ......ùÿÿÿ...ÿÿÿÿ......ùÿÿÿþÿÿÿèÿÿÿ.......çÿÿÿ...øÿÿÿÿÿÿÿ.
..øÿÿÿÿÿÿÿêÿÿÿ...................................þÿÿÿ...ûÿÿÿ.........ýÿÿÿ...ÿÿÿÿ............
..³.................èÿÿÿ
...õÿÿÿ......õÿÿÿ...øÿÿÿ.......øÿÿÿ.......ÿÿÿÿ......ÿÿÿÿ...............
...þÿÿÿ...
...ÿÿÿÿ ..........
...............ÿÿÿÿ......øÿÿÿ......øÿÿÿ...............úÿÿÿ......ùÿÿÿ...øÿÿÿ......øÿÿÿ...úÿÿÿýÿÿ
ÿ...ùÿÿÿ....ÿÿÿÿõÿÿÿ...ÿÿÿÿöÿÿÿÿÿÿÿÿÿÿÿ...õÿÿÿ...äÿÿÿ......ãÿÿÿ...ôÿÿÿ......ôÿÿÿ...æÿÿÿ
......üÿÿÿ...þÿÿÿ.....................
.............