TempleOSCDV4.10.ISO
This commit is contained in:
1 parent
c5954d3371
commit
9206246147
181 files changed
+4468
-4313
No files matched your search
+251
-270
@@ -1,6 +1,6 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
|
||||
RegSetDftEntry("TempleOS/EagleDive","I64 best_score=0;\n");
|
||||
RegSetDftEntry("TempleOS/EagleDive","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
//Keep these power of two so shift is used instead of multiply
|
||||
@@ -34,15 +34,6 @@ RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +59,12 @@ RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -94,44 +91,6 @@ RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -153,43 +112,6 @@ RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -281,24 +203,39 @@ class Panel
|
||||
U16 update,num_sides;
|
||||
CColorROPU32 color;
|
||||
Obj *next_obj,*last_obj;
|
||||
} *panel_root,*panels[MAP_HEIGHT][MAP_WIDTH];
|
||||
} *panel_head,*panels[MAP_HEIGHT][MAP_WIDTH];
|
||||
|
||||
I64 critical_section_flag;
|
||||
I16 elevations[MAP_HEIGHT][MAP_WIDTH];
|
||||
CD3 normals[MAP_HEIGHT][MAP_WIDTH];
|
||||
|
||||
F64 game_t0,è,é1,é2,speed;
|
||||
|
||||
I64 strip_height,x,y,z,game_score;
|
||||
|
||||
Bool game_over;
|
||||
|
||||
class MPCtrl {
|
||||
I64 init_not_done_flags,update_not_done_flags,app_not_done_flags;
|
||||
I64 strip_width[MP_MAX_PROCESSORS];
|
||||
Bool app_done;
|
||||
} mp;
|
||||
|
||||
F64 game_t0,game_tf,pitch,roll,heading,è,speed;
|
||||
Bool invert_pitch,rolled_over;
|
||||
I64 strip_height,x,y,z,fish_left;
|
||||
|
||||
U0 WrapAngles()
|
||||
{
|
||||
è=Wrap(è);
|
||||
pitch=Wrap(-è-ã/2);
|
||||
if (Abs(pitch)>ã/2) {
|
||||
invert_pitch=TRUE;
|
||||
pitch=Wrap(ã-pitch);
|
||||
} else
|
||||
invert_pitch=FALSE;
|
||||
roll=Wrap(roll);
|
||||
if (invert_pitch ^^ -ã/2<=roll<ã/2)
|
||||
rolled_over=FALSE;
|
||||
else
|
||||
rolled_over=TRUE;
|
||||
heading=Wrap(heading,0);
|
||||
}
|
||||
|
||||
U0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
{
|
||||
I64 zz;
|
||||
@@ -392,13 +329,13 @@ U0 MPDoPanels(CTask *task)
|
||||
tempo=MAlloc(sizeof(Obj),task);
|
||||
tempo->p.x=(i+w/2)*MAP_SCALE;
|
||||
tempo->p.y=(j+h/2)*MAP_SCALE;
|
||||
if (Rand<0.2) {
|
||||
if (Rand<0.1) {
|
||||
tempo->fish=FALSE;
|
||||
if (RandI16&1)
|
||||
tempo->img=$IB,"<2>",BI=2$; //Boat
|
||||
else
|
||||
tempo->img=$IB,"<3>",BI=3$; //Boat
|
||||
tempo->p.z=(WATER_ELEVATION+1)*MAP_SCALE;
|
||||
tempo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;
|
||||
} else {
|
||||
tempo->fish=TRUE;
|
||||
tempo->img=$IB,"<1>",BI=1$; //Fish
|
||||
@@ -476,8 +413,8 @@ U0 MPDoPanels(CTask *task)
|
||||
while (LBts(&critical_section_flag,0))
|
||||
Yield;
|
||||
if (end_ptr)
|
||||
end_ptr->next=panel_root;
|
||||
panel_root=start_ptr;
|
||||
end_ptr->next=panel_head;
|
||||
panel_head=start_ptr;
|
||||
LBtr(&critical_section_flag,0);
|
||||
}
|
||||
LBtr(&mp.init_not_done_flags,Gs->num);
|
||||
@@ -523,7 +460,7 @@ for each spot.
|
||||
InitElevations;
|
||||
MemSet(panels,0,sizeof(panels));
|
||||
CalcNormals;
|
||||
panel_root=NULL;
|
||||
panel_head=NULL;
|
||||
mp.init_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
Spawn(&MPDoPanels,Fs,"Do Panels",i);
|
||||
@@ -674,9 +611,9 @@ U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
|
||||
//World to screen coordinates
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é2);
|
||||
Mat4x4RotZ(dc->r,heading);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,é1);
|
||||
Mat4x4RotZ(dc->r,roll);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
//Screen to world coordinates
|
||||
@@ -687,9 +624,10 @@ U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
//y=mx+b and y=(-1/m)x+b are perpendicular.
|
||||
|
||||
s2w=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotZ(s2w,-roll);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
Mat4x4RotZ(s2w,-heading);
|
||||
|
||||
xh=0;
|
||||
yh=0;
|
||||
zh=-256;
|
||||
@@ -827,88 +765,97 @@ U0 DrawHorizon(CDC *dc)
|
||||
dc->depth_buf=NULL;
|
||||
CColorROPU32 ground_color;
|
||||
|
||||
if (z/COORDINATE_SCALE<(WATER_ELEVATION+3)*MAP_SCALE)
|
||||
ground_color=BLUE;
|
||||
else
|
||||
ground_color=LTGREEN;
|
||||
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é2);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,é1);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->transform=&EDTransform;
|
||||
dc->x=cx;
|
||||
dc->y=cy;
|
||||
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
xh=0;
|
||||
yh=0;
|
||||
zh=-256;
|
||||
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
|
||||
Free(s2w);
|
||||
|
||||
x1=xh+yh*32; y1=yh-xh*32; z1=0;
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
x2=xh-yh*32; y2=yh+xh*32; z2=0;
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
DCClipLine(dc,&x1,&y1,&x2,&y2);
|
||||
|
||||
MemSet(p,0,sizeof(p));
|
||||
if (x2<x1) {
|
||||
SwapI64(&x1,&x2);
|
||||
SwapI64(&y1,&y2);
|
||||
}
|
||||
if (!x1 && x2==dc->width-1) {
|
||||
p[0].x=0;
|
||||
p[0].y=0;
|
||||
p[1].x=dc->width-1;
|
||||
p[1].y=0;
|
||||
p[2].x=dc->width-1;
|
||||
p[2].y=y2;
|
||||
p[3].x=0;
|
||||
p[3].y=y1;
|
||||
if (-ã/2<=é1<ã/2 ^^ -ã/2<=Wrap(è-ã/2)<ã/2)
|
||||
dc->color=LTCYAN;
|
||||
if (game_tf && fish_left)
|
||||
DCFill(dc,BLACK);
|
||||
else if (-ã/4<=Wrap(è-ã)<ã/4)
|
||||
DCFill(dc,LTCYAN);
|
||||
else {
|
||||
if (z/COORDINATE_SCALE<(WATER_ELEVATION+3)*MAP_SCALE)
|
||||
ground_color=BLUE;
|
||||
else
|
||||
dc->color=ground_color;
|
||||
GrFillPoly3(dc,4,p);
|
||||
p[0].y=dc->height-1;
|
||||
p[1].y=dc->height-1;
|
||||
if (-ã/2<=é1<ã/2 ^^ -ã/2<=Wrap(è-ã/2)<ã/2)
|
||||
dc->color=ground_color;
|
||||
else
|
||||
dc->color=LTCYAN;
|
||||
GrFillPoly3(dc,4,p);
|
||||
} else {
|
||||
if (y2<y1) {
|
||||
ground_color=LTGREEN;
|
||||
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,heading);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,roll);
|
||||
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->transform=&EDTransform;
|
||||
dc->x=cx;
|
||||
dc->y=cy;
|
||||
|
||||
Mat4x4RotZ(s2w,-roll);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-heading);
|
||||
|
||||
xh=0;
|
||||
yh=0;
|
||||
zh=-256;
|
||||
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
|
||||
Free(s2w);
|
||||
|
||||
x1=xh+yh*32; y1=yh-xh*32; z1=0;
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
x2=xh-yh*32; y2=yh+xh*32; z2=0;
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
DCClipLine(dc,&x1,&y1,&x2,&y2);
|
||||
|
||||
MemSet(p,0,sizeof(p));
|
||||
if (x2<x1) {
|
||||
SwapI64(&x1,&x2);
|
||||
SwapI64(&y1,&y2);
|
||||
}
|
||||
if (!y1 && y2==dc->height-1) {
|
||||
if (!x1 && x2==dc->width-1) {
|
||||
p[0].x=0;
|
||||
p[0].y=0;
|
||||
p[1].x=0;
|
||||
p[1].y=dc->height-1;
|
||||
p[2].x=x2;
|
||||
p[2].y=dc->height-1;
|
||||
p[3].x=x1;
|
||||
p[3].y=0;
|
||||
if (x1<x2 ^^ -ã/2<=é1<ã/2 ^^ -ã/2<=Wrap(è-ã/2)<ã/2)
|
||||
dc->color=LTCYAN;
|
||||
else
|
||||
dc->color=ground_color;
|
||||
GrFillPoly3(dc,4,p);
|
||||
p[0].x=dc->width-1;
|
||||
p[1].x=dc->width-1;
|
||||
if (x1<x2 ^^ -ã/2<=é1<ã/2 ^^ -ã/2<=Wrap(è-ã/2)<ã/2)
|
||||
p[1].y=0;
|
||||
p[2].x=dc->width-1;
|
||||
p[2].y=y2;
|
||||
p[3].x=0;
|
||||
p[3].y=y1;
|
||||
if (rolled_over)
|
||||
dc->color=ground_color;
|
||||
else
|
||||
dc->color=LTCYAN;
|
||||
GrFillPoly3(dc,4,p);
|
||||
p[0].y=dc->height-1;
|
||||
p[1].y=dc->height-1;
|
||||
if (rolled_over)
|
||||
dc->color=LTCYAN;
|
||||
else
|
||||
dc->color=ground_color;
|
||||
GrFillPoly3(dc,4,p);
|
||||
} else {
|
||||
if (y2<y1) {
|
||||
SwapI64(&x1,&x2);
|
||||
SwapI64(&y1,&y2);
|
||||
}
|
||||
if (!y1 && y2==dc->height-1) {
|
||||
p[0].x=0;
|
||||
p[0].y=0;
|
||||
p[1].x=0;
|
||||
p[1].y=dc->height-1;
|
||||
p[2].x=x2;
|
||||
p[2].y=dc->height-1;
|
||||
p[3].x=x1;
|
||||
p[3].y=0;
|
||||
if (x1<x2 ^^ rolled_over)
|
||||
dc->color=ground_color;
|
||||
else
|
||||
dc->color=LTCYAN;
|
||||
GrFillPoly3(dc,4,p);
|
||||
p[0].x=dc->width-1;
|
||||
p[1].x=dc->width-1;
|
||||
if (x1<x2 ^^ rolled_over)
|
||||
dc->color=LTCYAN;
|
||||
else
|
||||
dc->color=ground_color;
|
||||
GrFillPoly3(dc,4,p);
|
||||
} else
|
||||
DCFill(dc,LTCYAN); //Not correct.
|
||||
}
|
||||
}
|
||||
dc->depth_buf=old_db;
|
||||
@@ -917,8 +864,8 @@ U0 DrawHorizon(CDC *dc)
|
||||
U0 Core0EagleDive()
|
||||
{
|
||||
CDC *dc=DCAlias(main_dc,Fs);
|
||||
I64 i,xx,yy,elev,height,bkcolor,cx=Fs->pix_width>>1,cy=Fs->pix_height>>1;
|
||||
F64 min_strip_width,roll,pitch,heading;
|
||||
I64 i,xx,yy,elev,height,cx=Fs->pix_width>>1,cy=Fs->pix_height>>1;
|
||||
F64 min_strip_width,tt;
|
||||
|
||||
update_jiffy_limit=cnts.jiffies+JIFFY_FREQ/40;
|
||||
|
||||
@@ -930,28 +877,26 @@ U0 Core0EagleDive()
|
||||
elev=MAX_I64;
|
||||
|
||||
height=z/COORDINATE_SCALE-elev;
|
||||
if (height<0) {
|
||||
if (elev>WATER_ELEVATION*MAP_SCALE) {
|
||||
dc->color=bkcolor=BLACK;
|
||||
if (!game_over) {
|
||||
GrRect(dc,0,0,dc->width,dc->height);
|
||||
music.mute=TRUE;
|
||||
Beep;
|
||||
game_over=TRUE;
|
||||
music.mute=FALSE;
|
||||
}
|
||||
} else
|
||||
bkcolor=BLUE;
|
||||
} else
|
||||
bkcolor=LTCYAN;
|
||||
if (height<0 && elev>WATER_ELEVATION*MAP_SCALE && !game_tf) {
|
||||
music.mute=TRUE;
|
||||
Beep;
|
||||
game_tf=tS;
|
||||
music.mute=FALSE;
|
||||
}
|
||||
|
||||
if (height>=0 && !(-ã/4<=Wrap(è-ã)<ã/4)) {
|
||||
DrawHorizon(dc);
|
||||
DrawHorizon(dc);
|
||||
|
||||
if (game_tf) {
|
||||
tt=game_tf-game_t0;
|
||||
if (Blink) {
|
||||
dc->color=RED;
|
||||
GrPrint(dc,(Fs->pix_width-9*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Game Over");
|
||||
}
|
||||
} else {
|
||||
DCDepthBufRst(dc);
|
||||
|
||||
mp.update_not_done_flags=1<<mp_cnt-1;
|
||||
MPDrawIt(Fs,dc);
|
||||
|
||||
while (mp.update_not_done_flags)
|
||||
Sleep(1);
|
||||
|
||||
@@ -961,41 +906,36 @@ U0 Core0EagleDive()
|
||||
strip_height=ClampI64(
|
||||
strip_height*Clamp(0.25*min_strip_width/strip_height,0.9,1.1),
|
||||
64,1024);
|
||||
} else {
|
||||
dc->color=bkcolor;
|
||||
GrRect(dc,0,0,dc->width,dc->height);
|
||||
|
||||
tt=tS-game_t0;
|
||||
if (tt<5.0 && Blink) {
|
||||
dc->color=WHITE;
|
||||
GrPrint(dc,(Fs->pix_width-13*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2-4*FONT_HEIGHT,"Catch 10 Fish");
|
||||
}
|
||||
}
|
||||
|
||||
dc->pen_width=2;
|
||||
if (bkcolor==BLUE)
|
||||
if (game_tf && fish_left)
|
||||
dc->color=WHITE;
|
||||
else
|
||||
dc->color=BLACK;
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
GrLine3(dc,cx+5,cy,0,cx-5,cy,0);
|
||||
GrLine3(dc,cx,cy+5,0,cx,cy-5,0);
|
||||
heading=Wrap(é2,0);
|
||||
roll=é1;
|
||||
pitch=Wrap(-è-ã/2,-ã);
|
||||
if (Abs(pitch)>ã/2) {
|
||||
pitch=Wrap(ã-pitch,-ã);
|
||||
roll=Wrap(roll+ã,-ã);
|
||||
heading=Wrap(heading+ã,0);
|
||||
}
|
||||
GrPrint(dc,0,0,"Roll:%5.1f Pitch:%5.1f Heading:%5.1f",
|
||||
roll*180/ã,pitch*180/ã,heading*180/ã);
|
||||
GrPrint(dc,0,FONT_HEIGHT,"Height:%5d Score:%d High:%d [Core Strip:%3d]",
|
||||
height,game_score,best_score,strip_height);
|
||||
if (invert_pitch)
|
||||
GrPrint(dc,0,0,"Pitch:%5.1f Roll:%5.1f Heading:%5.1f "
|
||||
"Height:%5d [Core Strip:%3d]",
|
||||
pitch*180/ã,Wrap(roll+ã)*180/ã,Wrap(heading+ã,0)*180/ã,
|
||||
height,strip_height);
|
||||
else
|
||||
GrPrint(dc,0,0,"Pitch:%5.1f Roll:%5.1f Heading:%5.1f "
|
||||
"Height:%5d [Core Strip:%3d]",
|
||||
pitch*180/ã,roll*180/ã,heading*180/ã,height,strip_height);
|
||||
GrPrint(dc,0,FONT_HEIGHT,"Fish Remaining:%d Time:%3.2f Best:%3.2f",
|
||||
fish_left,tt,best_score);
|
||||
|
||||
if (game_over && Blink) {
|
||||
dc->color=RED;
|
||||
GrPrint(dc,(Fs->pix_width-9*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Game Over");
|
||||
} else if (tS-game_t0<5.0 && Blink) {
|
||||
dc->color=WHITE;
|
||||
GrPrint(dc,(Fs->pix_width-10*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Catch Fish");
|
||||
}
|
||||
//We made an alias of this we don't want freed.
|
||||
//We made an alias of this we don't want freed.
|
||||
dc->depth_buf=NULL;
|
||||
DCDel(dc);
|
||||
WinMgrSync;
|
||||
@@ -1006,7 +946,7 @@ Obj *FishFind(I64 x1,I64 y1,I64 *_dd)
|
||||
{
|
||||
I64 dd,best_dd=MAX_I64;
|
||||
Obj *res=NULL,*tempo;
|
||||
Panel *tempp=panel_root;
|
||||
Panel *tempp=panel_head;
|
||||
while (tempp) {
|
||||
tempo=tempp->next_obj;
|
||||
while (tempo!=&tempp->next_obj) {
|
||||
@@ -1030,17 +970,18 @@ Obj *FishFind(I64 x1,I64 y1,I64 *_dd)
|
||||
U0 AnimateTask(I64)
|
||||
{//Steadily moves the airplane fwd.
|
||||
I64 *s2w,x1,y1,z1,dx,dy,dz,dd;
|
||||
F64 t0=tS,mS,é,d,pitch;
|
||||
F64 t0=tS,mS,é,d;
|
||||
Obj *tempo;
|
||||
while (TRUE) {
|
||||
mS=1000*(tS-t0);
|
||||
t0=tS;
|
||||
if (!game_over) {
|
||||
if (!game_tf) {
|
||||
//Screen to world coordinates
|
||||
s2w=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotZ(s2w,-roll);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
Mat4x4RotZ(s2w,-heading);
|
||||
|
||||
dx=0;dy=0;dz=1<<16;
|
||||
Mat4x4MulXYZ(s2w,&dx,&dy,&dz);
|
||||
x-=speed*mS*COORDINATE_SCALE*dx/1<<16;
|
||||
@@ -1048,20 +989,20 @@ U0 AnimateTask(I64)
|
||||
z-=speed*mS*COORDINATE_SCALE*dz/1<<16;
|
||||
Free(s2w);
|
||||
x1=x/COORDINATE_SCALE; y1=y/COORDINATE_SCALE; z1=z/COORDINATE_SCALE;
|
||||
|
||||
if (z1<(WATER_ELEVATION+3)*MAP_SCALE) {
|
||||
if (z1<WATER_ELEVATION*MAP_SCALE) {
|
||||
z=WATER_ELEVATION*MAP_SCALE*COORDINATE_SCALE;
|
||||
pitch=Wrap(-è-ã/2,-ã);
|
||||
if (Abs(pitch)>ã/2) {
|
||||
pitch=Wrap(ã-pitch,-ã);
|
||||
if (invert_pitch) {
|
||||
if (pitch<-ã/8)
|
||||
è+=mS/1000.0*Sign(3*ã/8-è);
|
||||
} else if (pitch<-ã/8)
|
||||
è+=mS/1000.0*Sign(-3*ã/8-è);
|
||||
WrapAngles;
|
||||
}
|
||||
speed=1.0;
|
||||
if (tempo=FishFind(x1,y1,&dd)) {
|
||||
if (rolled_over || !(tempo=FishFind(x1,y1,&dd)))
|
||||
claws_down=0;
|
||||
else {
|
||||
d=Sqrt(dd);
|
||||
x1-=tempo->p.x;
|
||||
y1-=tempo->p.y;
|
||||
@@ -1071,9 +1012,11 @@ U0 AnimateTask(I64)
|
||||
else
|
||||
claws_down=0.01;
|
||||
if (d<MAP_SCALE*2) {
|
||||
game_score++;
|
||||
if (game_score>best_score)
|
||||
best_score=game_score;
|
||||
if (!--fish_left) {
|
||||
game_tf=tS;
|
||||
if (game_tf-game_t0<best_score)
|
||||
best_score=game_tf-game_t0;
|
||||
}
|
||||
QueRem(tempo);
|
||||
Free(tempo);
|
||||
music.mute=TRUE;
|
||||
@@ -1128,19 +1071,21 @@ U0 Init()
|
||||
I64 i,xx,yy;
|
||||
main_dc=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
critical_section_flag=0;
|
||||
game_over=FALSE;
|
||||
game_score=0;
|
||||
game_tf=0;
|
||||
fish_left=10;
|
||||
|
||||
MemSet(&mp,0,sizeof(MPCtrl));
|
||||
InitMap;
|
||||
DCDepthBufAlloc(main_dc);
|
||||
|
||||
strip_height=128;
|
||||
|
||||
è =-90.0*ã/180.0;
|
||||
é1 = 0.0*ã/180.0;
|
||||
é2 = 0.0*ã/180.0;
|
||||
speed = 2.5;
|
||||
roll =0;
|
||||
heading=0;
|
||||
speed =2.5;
|
||||
claws_down=0;
|
||||
WrapAngles;
|
||||
|
||||
x=MAP_WIDTH>>1 *COORDINATE_SCALE*MAP_SCALE;
|
||||
y=MAP_HEIGHT>>1*COORDINATE_SCALE*MAP_SCALE;
|
||||
@@ -1158,7 +1103,7 @@ U0 Init()
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
Panel *tempp=panel_root,*tempp1;
|
||||
Panel *tempp=panel_head,*tempp1;
|
||||
MPEnd;
|
||||
while (tempp) {
|
||||
tempp1=tempp->next;
|
||||
@@ -1173,8 +1118,6 @@ U0 CleanUp()
|
||||
U0 EagleDive()
|
||||
{
|
||||
I64 ch,sc;
|
||||
F64 pp,tt1,tt2;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
MenuPush(
|
||||
"File {"
|
||||
@@ -1202,24 +1145,26 @@ U0 EagleDive()
|
||||
try //in case <CTRL-ALT-c> is pressed.
|
||||
do {
|
||||
if (ScanKey(&ch,&sc)) {
|
||||
pp=è; tt1=é1; tt2=é2;
|
||||
switch (ch) {
|
||||
case 0:
|
||||
switch (sc.u8[0]) {
|
||||
case SC_CURSOR_DOWN:
|
||||
è +=-CTRLS_SCALE*Cos(tt1);
|
||||
é2+=-CTRLS_SCALE*Sin(tt1)*Sin(è);
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
è -=-CTRLS_SCALE*Cos(tt1);
|
||||
é2-=-CTRLS_SCALE*Sin(tt1)*Sin(è);
|
||||
break;
|
||||
case SC_CURSOR_RIGHT:
|
||||
é1+=CTRLS_SCALE;
|
||||
break;
|
||||
case SC_CURSOR_LEFT:
|
||||
é1-=CTRLS_SCALE;
|
||||
break;
|
||||
start:
|
||||
case SC_CURSOR_DOWN:
|
||||
è-=CTRLS_SCALE*Cos(roll);
|
||||
heading-=CTRLS_SCALE*Sin(roll)*Sin(è);
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
è+=CTRLS_SCALE*Cos(roll);
|
||||
heading+=CTRLS_SCALE*Sin(roll)*Sin(è);
|
||||
break;
|
||||
case SC_CURSOR_RIGHT:
|
||||
roll+=CTRLS_SCALE;
|
||||
break;
|
||||
case SC_CURSOR_LEFT:
|
||||
roll-=CTRLS_SCALE;
|
||||
break;
|
||||
end:
|
||||
WrapAngles;
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
@@ -1230,9 +1175,6 @@ U0 EagleDive()
|
||||
Fs->draw_it=&DrawIt;
|
||||
break;
|
||||
}
|
||||
é1=Wrap(é1);
|
||||
è =Wrap(è);
|
||||
é2=Wrap(é2);
|
||||
} else
|
||||
Core0EagleDive;
|
||||
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
|
||||
@@ -1240,7 +1182,7 @@ U0 EagleDive()
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
RegWriteBranch("TempleOS/EagleDive","I64 best_score=%d;\n",best_score);
|
||||
RegWriteBranch("TempleOS/EagleDive","F64 best_score=%5.4f;\n",best_score);
|
||||
MenuPop;
|
||||
}
|
||||
|
||||
@@ -1253,17 +1195,56 @@ EagleDive;
|
||||
| ||||