TempleOSCDV5.00.ISO
This commit is contained in:
1 parent
122df6338e
commit
f6eacf7744
374 files changed
+11078
-11204
No files matched your search
+153
-87
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
|
||||
RegSetDftEntry("TempleOS/Talons","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/Talons");
|
||||
RegDft("TempleOS/Talons","F64 best_score=9999;\n");
|
||||
RegExe("TempleOS/Talons");
|
||||
|
||||
//Keep these power of two so shift is used instead of multiply
|
||||
//to index arrays.
|
||||
@@ -18,27 +18,12 @@ RegExeBranch("TempleOS/Talons");
|
||||
#define COORDINATE_BITS 8
|
||||
|
||||
#define WATER_ELEVATION 15
|
||||
#define BIRD_ELEVATION 10
|
||||
#define ROCK_ELEVATION 45
|
||||
#define SNOW_ELEVATION 55
|
||||
|
||||
//Too big makes off-scrn draws take place.
|
||||
#define MAX_PANEL_SIZE 16
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,12 +44,6 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +73,6 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$SP,"<3>",BI=3$
|
||||
@@ -112,20 +90,6 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -149,6 +113,7 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
$SP,"<5>",BI=5$
|
||||
|
||||
|
||||
|
||||
@@ -164,6 +129,7 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
$SP,"<6>",BI=6$
|
||||
|
||||
|
||||
|
||||
@@ -172,20 +138,17 @@ RegExeBranch("TempleOS/Talons");
|
||||
|
||||
|
||||
|
||||
#define LS_TYPES 3
|
||||
U8 *landscape_small_imgs[LS_TYPES]={$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$},
|
||||
*landscape_large_imgs[LS_TYPES];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define B_NUM 256
|
||||
class Bird
|
||||
{
|
||||
Bird *next,*last;
|
||||
CD3I64 p;
|
||||
F64 é;
|
||||
} b_head[mp_cnt];
|
||||
|
||||
class Obj
|
||||
{
|
||||
@@ -218,9 +181,12 @@ class MPCtrl {
|
||||
F64 game_t0,game_tf,pitch,roll,heading,è,speed;
|
||||
Bool invert_pitch,rolled_over;
|
||||
I64 strip_height,x,y,z,fish_left;
|
||||
CD3 v;
|
||||
|
||||
U0 WrapAngles()
|
||||
{
|
||||
I64 r[4][4],x,y,z;
|
||||
|
||||
è=Wrap(è);
|
||||
pitch=Wrap(-è-ã/2);
|
||||
if (Abs(pitch)>ã/2) {
|
||||
@@ -234,6 +200,17 @@ U0 WrapAngles()
|
||||
else
|
||||
rolled_over=TRUE;
|
||||
heading=Wrap(heading,0);
|
||||
|
||||
//World to scrn coordinates
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotZ(r,heading);
|
||||
Mat4x4RotX(r,è);
|
||||
Mat4x4RotZ(r,roll);
|
||||
|
||||
//We use velocity vector for dog-fighting.
|
||||
x=0x100000000*speed; y=0; z=0;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
v.x=x/ToF64(0x100000000); v.y=y/ToF64(0x100000000); v.z=z/ToF64(0x100000000);
|
||||
}
|
||||
|
||||
U0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
@@ -332,9 +309,9 @@ U0 MPDoPanels(CTask *task)
|
||||
if (Rand<0.1) {
|
||||
tmpo->fish=FALSE;
|
||||
if (RandI16&1)
|
||||
tmpo->img=$IB,"<2>",BI=2$; //Boat
|
||||
tmpo->img=landscape_large_imgs[0]; //Boat
|
||||
else
|
||||
tmpo->img=$IB,"<3>",BI=3$; //Boat
|
||||
tmpo->img=landscape_large_imgs[1]; //Boat
|
||||
tmpo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;
|
||||
} else {
|
||||
tmpo->fish=TRUE;
|
||||
@@ -354,7 +331,7 @@ U0 MPDoPanels(CTask *task)
|
||||
tmpo->p.x=(i+w/2)*MAP_SCALE;
|
||||
tmpo->p.y=(j+h/2)*MAP_SCALE;
|
||||
tmpo->p.z=l;
|
||||
tmpo->img=$IB,"<4>",BI=4$; //Tree
|
||||
tmpo->img=landscape_large_imgs[2]; //Tree
|
||||
tmpo->fish=FALSE;
|
||||
QueIns(tmpo,tmpp->last_obj);
|
||||
}
|
||||
@@ -476,8 +453,8 @@ F64 claws_down;
|
||||
|
||||
|
||||
|
||||
$SP,"<5>",BI=5$
|
||||
$SP,"<6>",BI=6$
|
||||
$SP,"<7>",BI=7$
|
||||
$SP,"<8>",BI=8$
|
||||
|
||||
|
||||
|
||||
@@ -502,9 +479,9 @@ U0 ClawDraw(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 w,I64 segments,Bool talon)
|
||||
}
|
||||
if (talon) {
|
||||
if (y1<y2)
|
||||
Sprite3B(dc,x1,y1,0,$IB,"<5>",BI=5$);
|
||||
Sprite3B(dc,x1,y1,0,$IB,"<7>",BI=7$);
|
||||
else
|
||||
Sprite3B(dc,x1,y1,0,$IB,"<6>",BI=6$);
|
||||
Sprite3B(dc,x1,y1,0,$IB,"<8>",BI=8$);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,7 +511,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
|
||||
/*
|
||||
$SP,"<7>",BI=7$
|
||||
$SP,"<9>",BI=9$
|
||||
|
||||
|
||||
|
||||
@@ -553,7 +530,7 @@ $SP,"<7>",BI=7$
|
||||
|
||||
|
||||
|
||||
$SP,"<8>",BI=8$
|
||||
$SP,"<10>",BI=10$
|
||||
|
||||
|
||||
|
||||
@@ -598,11 +575,10 @@ I64 update_jiffy_limit;
|
||||
U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 j,update=winmgr.updates&65535,strip_width,*s2w,x1,y1,z1,xx,yy,
|
||||
xh,yh,zh,yh2,xh2,x1h,y1h,x1wa,y1wa,x1wb,y1wb,
|
||||
x3,y3,z3,dd,dd_old,
|
||||
cx=task->pix_width>>1,
|
||||
cy=task->pix_height>>1;
|
||||
xh,yh,zh,yh2,xh2,x1h,y1h,x1wa,y1wa,x1wb,y1wb,x3,y3,z3,dd,dd_old,
|
||||
cx=task->pix_width>>1,cy=task->pix_height>>1,r[16],*elems1,*elems_hard;
|
||||
Panel reg *tmpp;
|
||||
Bird *tmpb;
|
||||
Obj *tmpo;
|
||||
Bool w_on_map,h_on_map;
|
||||
|
||||
@@ -733,6 +709,21 @@ U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
}
|
||||
|
||||
tmpb=b_head[Gs->num].next;
|
||||
while (tmpb!=&b_head[Gs->num]) {
|
||||
elems1=SpriteInterpolate(Tri(tS,0.2),$IB,"<2>",BI=2$,$IB,"<3>",BI=3$);
|
||||
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotZ(r,tmpb->é);
|
||||
elems_hard=SpriteTransform(elems1,r);
|
||||
|
||||
Sprite3(dc,tmpb->p.x,tmpb->p.y,tmpb->p.z,elems_hard);
|
||||
Free(elems_hard);
|
||||
Free(elems1);
|
||||
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
|
||||
Free(s2w);
|
||||
mp.strip_width[Gs->num]=strip_width;
|
||||
LBtr(&mp.update_not_done_flags,Gs->num);
|
||||
@@ -858,6 +849,7 @@ U0 DrawHorizon(CDC *dc)
|
||||
DCFill(dc,LTCYAN); //Not correct.
|
||||
}
|
||||
}
|
||||
|
||||
dc->depth_buf=old_db;
|
||||
}
|
||||
|
||||
@@ -969,9 +961,10 @@ 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;
|
||||
I64 i,*s2w,x1,y1,z1,dx,dy,dz,dd;
|
||||
F64 t0=tS,ms,é,d;
|
||||
Obj *tmpo;
|
||||
Bird *tmpb;
|
||||
while (TRUE) {
|
||||
ms=1000*(tS-t0);
|
||||
t0=tS;
|
||||
@@ -1020,7 +1013,7 @@ U0 AnimateTask(I64)
|
||||
QueRem(tmpo);
|
||||
Free(tmpo);
|
||||
music.mute=TRUE;
|
||||
Snd(1000); Sleep(200); Snd(0);
|
||||
Snd(74); Sleep(200); Snd;
|
||||
music.mute=FALSE;
|
||||
}
|
||||
}
|
||||
@@ -1034,6 +1027,18 @@ U0 AnimateTask(I64)
|
||||
speed-=0.0001;
|
||||
speed=Clamp(speed+(0.0005-0.0002*Abs(è)/(ã/4)),0.1,5.0);
|
||||
}
|
||||
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
tmpb=b_head[i].next;
|
||||
while (tmpb!=&b_head[i]) {
|
||||
tmpb->p.x+=10*ms/1000*MAP_SCALE*Cos(tmpb->é);
|
||||
tmpb->p.y+=10*ms/1000*MAP_SCALE*Sin(tmpb->é);
|
||||
tmpb->p.z=BIRD_ELEVATION*MAP_SCALE+
|
||||
elevations[tmpb->p.y/MAP_SCALE][tmpb->p.x/MAP_SCALE];
|
||||
tmpb->é+=2*ã*ms/1000/10;
|
||||
tmpb=tmpb->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
Refresh;
|
||||
}
|
||||
@@ -1060,16 +1065,34 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("3eCGFsDAe.C2sG3eGDqCDeGsGG2qG");
|
||||
Play("3eCGFsDAe.C2sG3eGDqCDeGsGG2qG");
|
||||
Play("3eGECGCAFCsCBCBe.GsG2qG3B");
|
||||
Play("eGECGCAFCsCBCBe.GsG2qG3B");
|
||||
Play("5eCGFsD4A5e.C4sG5eGDqCDeGsGG4qG");
|
||||
Play("5eCGFsD4A5e.C4sG5eGDqCDeGsGG4qG");
|
||||
Play("5eGECGC4A5FCsC4B5C4B5e.GsG4qGB");
|
||||
Play("5eGECGC4A5FCsC4B5C4B5e.GsG4qGB");
|
||||
}
|
||||
}
|
||||
|
||||
U0 PreInit()
|
||||
{
|
||||
I64 i,*r=Mat4x4IdentNew;
|
||||
Mat4x4Scale(r,10.0);
|
||||
for (i=0;i<LS_TYPES;i++)
|
||||
landscape_large_imgs[i]=SpriteTransform(landscape_small_imgs[i],r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
U0 PostCleanUp()
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<LS_TYPES;i++)
|
||||
Free(landscape_large_imgs[i]);
|
||||
}
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
I64 i,xx,yy;
|
||||
Bird *tmpb;
|
||||
|
||||
main_dc=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
critical_section_flag=0;
|
||||
game_tf=0;
|
||||
@@ -1096,6 +1119,19 @@ U0 Init()
|
||||
yy=y/(MAP_SCALE*COORDINATE_SCALE);
|
||||
z+=elevations[yy][xx]*COORDINATE_SCALE;
|
||||
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
QueInit(&b_head[i]);
|
||||
|
||||
for (i=0;i<B_NUM;i++) {
|
||||
tmpb=MAlloc(sizeof(Bird));
|
||||
tmpb->p.x=Rand*MAP_WIDTH*MAP_SCALE;
|
||||
tmpb->p.y=Rand*MAP_HEIGHT*MAP_SCALE;
|
||||
tmpb->p.z=BIRD_ELEVATION*MAP_SCALE+
|
||||
elevations[tmpb->p.y/MAP_SCALE][tmpb->p.x/MAP_SCALE];
|
||||
tmpb->é=2*ã*Rand;
|
||||
QueIns(tmpb,b_head[i%mp_cnt].last);
|
||||
}
|
||||
|
||||
for (i=1;i<mp_cnt;i++)
|
||||
Spawn(&CoreAPTalonsTask,Fs,"AP Talons",i);
|
||||
Fs->task_end_cb=&TaskEndCB;
|
||||
@@ -1104,6 +1140,7 @@ U0 Init()
|
||||
|
||||
U0 CleanUp()
|
||||
{
|
||||
I64 i;
|
||||
Panel *tmpp=panel_head,*tmpp1;
|
||||
MPEnd;
|
||||
while (tmpp) {
|
||||
@@ -1113,6 +1150,10 @@ U0 CleanUp()
|
||||
Free(tmpp);
|
||||
tmpp=tmpp1;
|
||||
}
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
QueDel(&b_head[i]);
|
||||
QueInit(&b_head[i]);
|
||||
}
|
||||
DCDel(main_dc);
|
||||
}
|
||||
|
||||
@@ -1140,6 +1181,7 @@ U0 Talons()
|
||||
DocClear;
|
||||
"Initializing...\n";
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
PreInit;
|
||||
Init;
|
||||
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
|
||||
Fs->draw_it=&DrawIt;
|
||||
@@ -1183,10 +1225,12 @@ U0 Talons()
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
RegWriteBranch("TempleOS/Talons","F64 best_score=%5.4f;\n",best_score);
|
||||
PostCleanUp;
|
||||
RegWrite("TempleOS/Talons","F64 best_score=%5.4f;\n",best_score);
|
||||
MenuPop;
|
||||
}
|
||||
|
||||
Seed(1);
|
||||
Talons;
|
||||
| ||||