TempleOSCDV5.00.ISO
This commit is contained in:
1 parent
122df6338e
commit
f6eacf7744
374 files changed
+11078
-11204
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
|
||||
RegSetDftEntry("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/CastleFrankenstein");
|
||||
RegDft("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
|
||||
RegExe("TempleOS/CastleFrankenstein");
|
||||
|
||||
//Set snap to 4 and width to 4
|
||||
//if you edit this map.
|
||||
@@ -224,14 +224,14 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
z1=0;
|
||||
DCTransform(dc,&x1,&y1,&z1);
|
||||
if (z1>0)
|
||||
SpriteMat3B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<5>",BI=5$,r3);
|
||||
Sprite3Mat4x4B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<5>",BI=5$,r3);
|
||||
} else if (c==YELLOW) {
|
||||
x1=x+SCRN_SCALE/2;
|
||||
y1=y+SCRN_SCALE/2;
|
||||
z1=0;
|
||||
DCTransform(dc,&x1,&y1,&z1);
|
||||
if (z1>0)
|
||||
SpriteMat3B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
|
||||
Sprite3Mat4x4B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
|
||||
}
|
||||
|
||||
if (!map[(yy+1)*map_width+xx]) {
|
||||
@@ -320,11 +320,11 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
DCTransform(dc,&xx,&yy,&zz);
|
||||
if (zz>0) {
|
||||
if (tmpm->dead)
|
||||
SpriteMat3B(dc,x,y,0,$IB,"<2>",BI=2$,r2);
|
||||
Sprite3Mat4x4B(dc,x,y,0,$IB,"<2>",BI=2$,r2);
|
||||
else {
|
||||
tt=Tri(tS,1.0);
|
||||
tmps=SpriteInterpolate(tt,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$);
|
||||
SpriteMat3B(dc,x,y,0,tmps,r1);
|
||||
Sprite3Mat4x4B(dc,x,y,0,tmps,r1);
|
||||
Free(tmps);
|
||||
}
|
||||
}
|
||||
@@ -380,7 +380,7 @@ U0 Fire()
|
||||
F64 d,dx,dy,xx=Cos(man_é),yy=Sin(man_é);
|
||||
Monster *tmpm;
|
||||
|
||||
Noise(100,300,1000);
|
||||
Noise(100,53,74);
|
||||
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
|
||||
x=tmpm->x;
|
||||
y=tmpm->y;
|
||||
@@ -489,9 +489,9 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("2q.A#1eG2AeA#qAq.A#1eG2eAeA#qA");
|
||||
Play("q.A#1eG2A#A1qG2q.A#1eG2A#A1qG");
|
||||
Play("3eA#A2qG3eA#A2qG3eA#A2G3AA#A2qG");
|
||||
Play("3q.A#eGAeA#qAq.A#eGeAeA#qA");
|
||||
Play("3q.A#eGA#AqGq.A#eGA#AqG");
|
||||
Play("4eA#AqGeA#AqGeA#AGAA#AqG");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ fs_done:
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
MenuPop;
|
||||
RegWriteBranch("TempleOS/CastleFrankenstein","F64 best_score=%5.4f;\n",
|
||||
RegWrite("TempleOS/CastleFrankenstein","F64 best_score=%5.4f;\n",
|
||||
best_score);
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -2,8 +2,8 @@
|
||||
|
||||
//Giotto, a famous artist, drew a freehand circle to get a job.
|
||||
|
||||
RegSetDftEntry("TempleOS/CircleTrace","F64 best_score=999;\n");
|
||||
RegExeBranch("TempleOS/CircleTrace");
|
||||
RegDft("TempleOS/CircleTrace","F64 best_score=999;\n");
|
||||
RegExe("TempleOS/CircleTrace");
|
||||
|
||||
I64 cx,cy;
|
||||
F64 avg_error=0,elapsed_time=0,total_error=0,score=999;
|
||||
@@ -13,7 +13,7 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE)
|
||||
Play("hEDCARCDECR");
|
||||
Play("5hEDC4A5RCDECR");
|
||||
}
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
@@ -35,7 +35,7 @@ Bool CTPlot(CDC *dc,I64 x,I64 y,I64)
|
||||
|
||||
U0 CircleTrace()
|
||||
{
|
||||
I64 msg_code,a1,a2,x1,y1;
|
||||
I64 msg_code,arg1,arg2,x1,y1;
|
||||
F64 rad,t0,total_distance;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
@@ -57,12 +57,12 @@ U0 CircleTrace()
|
||||
dc->color=ROP_XOR+BLACK^TRANSPARENT;
|
||||
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_UP:
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
DCFill;
|
||||
dc->color=ROP_XOR+BLACK^TRANSPARENT;
|
||||
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
|
||||
@@ -70,18 +70,18 @@ U0 CircleTrace()
|
||||
t0=tS;
|
||||
total_distance=0.001;
|
||||
total_error=0;
|
||||
x1=a1; y1=a2;
|
||||
x1=arg1; y1=arg2;
|
||||
do {
|
||||
msg_code=ScanMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_UP:
|
||||
case MSG_MS_L_UP:
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
if (x1!=a1 || y1!=a2) {
|
||||
total_distance+=Sqrt(Sqr(x1-a1)+Sqr(y1-a2));
|
||||
Line(dc,x1,y1,0,a1,a2,0,&CTPlot);
|
||||
x1=a1;y1=a2;
|
||||
case MSG_MS_MOVE:
|
||||
if (x1!=arg1 || y1!=arg2) {
|
||||
total_distance+=Sqrt(Sqr(x1-arg1)+Sqr(y1-arg2));
|
||||
Line(dc,x1,y1,0,arg1,arg2,0,&CTPlot);
|
||||
x1=arg1;y1=arg2;
|
||||
//undo overlapping pixs on segments
|
||||
GrPlot(dc,x1,y1);
|
||||
rad=Sqrt(Sqr(x1-cx)+Sqr(y1-cy));
|
||||
@@ -100,29 +100,29 @@ U0 CircleTrace()
|
||||
//no need to do anything until the window mgr runs.
|
||||
Refresh;
|
||||
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
music.mute=TRUE; Sleep(200);
|
||||
if (total_distance>0.95*CIRCUMFERENCE) {
|
||||
if (score<best_score) {
|
||||
Snd(2000);Sleep(50);Snd(0);Sleep(50);
|
||||
Snd(2000);Sleep(50);Snd(0);Sleep(50);
|
||||
Snd(2000);Sleep(50);
|
||||
Snd(86);Sleep(50);Snd;Sleep(50);
|
||||
Snd(86);Sleep(50);Snd;Sleep(50);
|
||||
Snd(86);Sleep(50);
|
||||
best_score=score;
|
||||
} else {
|
||||
Snd(500);Sleep(50);
|
||||
Snd(62);Sleep(50);
|
||||
}
|
||||
} else {
|
||||
Snd(100);Sleep(1000);
|
||||
Snd(34);Sleep(1000);
|
||||
}
|
||||
Snd(0); Sleep(200); music.mute=FALSE;
|
||||
Snd; Sleep(200); music.mute=FALSE;
|
||||
break;
|
||||
}
|
||||
} while (msg_code!=MSG_KEY_DOWN || a1!=CH_SHIFT_ESC && a1!=CH_ESC);
|
||||
} while (msg_code!=MSG_KEY_DOWN || arg1!=CH_SHIFT_ESC && arg1!=CH_ESC);
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
SettingsPop;
|
||||
DCFill;
|
||||
DCDel(dc);
|
||||
RegWriteBranch("TempleOS/CircleTrace","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWrite("TempleOS/CircleTrace","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
CircleTrace; //Execute when #included
|
||||
@@ -1,5 +1,5 @@
|
||||
RegSetDftEntry("TempleOS/DunGen","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/DunGen");
|
||||
RegDft("TempleOS/DunGen","F64 best_score=9999;\n");
|
||||
RegExe("TempleOS/DunGen");
|
||||
|
||||
//Set snap to 4 and width to 4
|
||||
//if you edit this map.
|
||||
@@ -232,7 +232,7 @@ U0 Attack()
|
||||
Monster *tmpm;
|
||||
|
||||
man_attack_t0=tS;
|
||||
Noise(100,300,1000);
|
||||
Noise(100,53,74);
|
||||
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
|
||||
if (!tmpm->dead &&
|
||||
man_x+man_dx==tmpm->x && man_y+man_dy==tmpm->y) {
|
||||
@@ -438,7 +438,7 @@ dg_done:
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
MenuPop;
|
||||
RegWriteBranch("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWrite("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
|
||||
CleanUp;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+20
-20
@@ -173,7 +173,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tmpo=obj_head.next;
|
||||
while (tmpo!=&obj_head) {
|
||||
if (tmpo->flags&OF_ACTIVE && tmpo->flags&OF_SHIP) {
|
||||
SpriteZ3B(dc,tmpo->x,tmpo->y,0,
|
||||
Sprite3ZB(dc,tmpo->x,tmpo->y,0,
|
||||
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
|
||||
|
||||
k=0;
|
||||
@@ -224,7 +224,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tmpo=obj_head.next;
|
||||
while (tmpo!=&obj_head) {
|
||||
if (tmpo->flags&OF_ACTIVE && !(tmpo->flags&OF_SHIP))
|
||||
SpriteZ3B(dc,tmpo->x,tmpo->y,0,
|
||||
Sprite3ZB(dc,tmpo->x,tmpo->y,0,
|
||||
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
|
||||
if (tmpo->flags&OF_SHOOTING) {
|
||||
dc->color=LTRED;
|
||||
@@ -425,8 +425,8 @@ Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
|
||||
if (player==0) {
|
||||
launch_unit_x1=tmpo->x;
|
||||
launch_unit_y1=tmpo->y;
|
||||
launch_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
|
||||
launch_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
|
||||
launch_unit_x2=ms.pos.x-main_task->pix_left-main_task->scroll_x;
|
||||
launch_unit_y2=ms.pos.y-main_task->pix_top -main_task->scroll_y;
|
||||
launch_t=tS+0.5;
|
||||
}
|
||||
if (tmpo->squadron>=0) {
|
||||
@@ -494,8 +494,8 @@ Squadron *SquadronSet
|
||||
if (player==0) {
|
||||
set_é_unit_x1=tmpo->x;
|
||||
set_é_unit_y1=tmpo->y;
|
||||
set_é_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
|
||||
set_é_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
|
||||
set_é_unit_x2=ms.pos.x-main_task->pix_left-main_task->scroll_x;
|
||||
set_é_unit_y2=ms.pos.y-main_task->pix_top -main_task->scroll_y;
|
||||
set_é_t=tS+0.5;
|
||||
}
|
||||
if (tmpo->squadron>=0) {
|
||||
@@ -640,7 +640,7 @@ U0 Combat(F64 period)
|
||||
tmpt->target=tmpo1;
|
||||
tmpt->é=Arg(tmpo1->x-tmpo->x,tmpo1->y-tmpo->y);
|
||||
QueIns(tmpt,torpedo_head.last);
|
||||
Sweep(2000,2000,300);
|
||||
Sweep(2000,86,53);
|
||||
} else if (tmpo->ship_guns>0 && d<tmpo->ship_guns_range) {
|
||||
tmpo->flags|=OF_SHOOTING;
|
||||
if (Rand<125.0*period) {
|
||||
@@ -649,7 +649,7 @@ U0 Combat(F64 period)
|
||||
tmpo1->fuel*=0.75*Rand+0.25;
|
||||
}
|
||||
if (tS>next_noise) {
|
||||
Noise(100,75,200);
|
||||
Noise(100,29,46);
|
||||
next_noise=tS+0.1;
|
||||
}
|
||||
}
|
||||
@@ -662,7 +662,7 @@ U0 Combat(F64 period)
|
||||
tmpo1->fuel*=0.75*Rand+0.25;
|
||||
}
|
||||
if (tS>next_noise) {
|
||||
Noise(25,500,2000);
|
||||
Noise(25,62,86);
|
||||
next_noise=tS+0.025;
|
||||
}
|
||||
}
|
||||
@@ -781,7 +781,7 @@ U0 AnimateTask(I64)
|
||||
|
||||
U0 FlatTops()
|
||||
{
|
||||
I64 a1,a2;
|
||||
I64 arg1,arg2;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->text_attr=BLUE<<4+WHITE;
|
||||
@@ -805,16 +805,16 @@ U0 FlatTops()
|
||||
" Slower(,'-');"
|
||||
"}"
|
||||
);
|
||||
Fs->win_inhibit|=WIF_SELF_IP_L|WIF_SELF_IP_R;
|
||||
Fs->win_inhibit|=WIF_SELF_MS_L|WIF_SELF_MS_R;
|
||||
Init;
|
||||
Fs->draw_it=&DrawIt;
|
||||
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
|
||||
try {
|
||||
while (TRUE)
|
||||
switch (GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_IP_R_D_UP)) {
|
||||
switch (GetMsg(&arg1,&arg2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP|1<<MSG_MS_R_D_UP)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
CleanUp;
|
||||
Init;
|
||||
@@ -830,14 +830,14 @@ U0 FlatTops()
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
SquadronSeté(0,a1,a2);
|
||||
case MSG_MS_L_UP:
|
||||
SquadronSeté(0,arg1,arg2);
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
SquadronLaunch(0,a1,a2);
|
||||
case MSG_MS_R_UP:
|
||||
SquadronLaunch(0,arg1,arg2);
|
||||
break;
|
||||
case MSG_IP_R_D_UP:
|
||||
SquadronReturn(0,a1,a2);
|
||||
case MSG_MS_R_D_UP:
|
||||
SquadronReturn(0,arg1,arg2);
|
||||
break;
|
||||
}
|
||||
nv_done:
|
||||
|
||||
@@ -76,7 +76,7 @@ U0 Init()
|
||||
|
||||
U0 Halogen()
|
||||
{
|
||||
I64 a1,a2,ch=0,sc=0;
|
||||
I64 arg1,arg2,ch=0,sc=0;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->text_attr=BLACK<<4+WHITE;
|
||||
MenuPush(
|
||||
@@ -100,9 +100,9 @@ U0 Halogen()
|
||||
Fs->draw_it=&DrawIt;
|
||||
try {
|
||||
while (TRUE) {
|
||||
switch (ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
switch (ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
case MSG_KEY_DOWN:
|
||||
ch=a1;sc=a2;
|
||||
ch=arg1;sc=arg2;
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
Init;
|
||||
@@ -113,7 +113,7 @@ U0 Halogen()
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_UP:
|
||||
ch=a1;sc=a2;
|
||||
ch=arg1;sc=arg2;
|
||||
if (!ch)
|
||||
switch (sc.u8[0]) {
|
||||
case SC_CURSOR_RIGHT:
|
||||
@@ -140,12 +140,12 @@ U0 Halogen()
|
||||
break;
|
||||
}
|
||||
if (crash)
|
||||
Snd(0);
|
||||
Snd;
|
||||
else {
|
||||
if (speed)
|
||||
Snd(speed+10);
|
||||
Snd(Freq2Ona(speed+10));
|
||||
else
|
||||
Snd(0);
|
||||
Snd;
|
||||
UpdateRoad;
|
||||
}
|
||||
Sleep(10);
|
||||
|
||||
+10
-10
@@ -99,7 +99,7 @@ U0 CleanUp()
|
||||
|
||||
U0 MassSpringDemo()
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
MyMass *tmpm1=NULL,*tmpm2=NULL;
|
||||
|
||||
PopUpOk("Left-Click to place mas\n"
|
||||
@@ -130,23 +130,23 @@ U0 MassSpringDemo()
|
||||
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|1<<MSG_MS_R_UP|1<<MSG_KEY_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
PlaceMass(a1,a2);
|
||||
case MSG_MS_L_DOWN:
|
||||
PlaceMass(arg1,arg2);
|
||||
break;
|
||||
case MSG_IP_R_DOWN:
|
||||
tmpm1=MassFind(ode,a1,a2);
|
||||
case MSG_MS_R_DOWN:
|
||||
tmpm1=MassFind(ode,arg1,arg2);
|
||||
tmpm2=NULL;
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (tmpm1 && (tmpm2=MassFind(ode,a1,a2)) && tmpm1!=tmpm2)
|
||||
case MSG_MS_R_UP:
|
||||
if (tmpm1 && (tmpm2=MassFind(ode,arg1,arg2)) && tmpm1!=tmpm2)
|
||||
PlaceSpring(tmpm1,tmpm2);
|
||||
tmpm1=tmpm2=NULL;
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
CleanUp;
|
||||
Init;
|
||||
|
||||
+6
-7
@@ -14,7 +14,7 @@ U0 DrawIt(CTask *task,CDC *)
|
||||
// for (i=0;i<TEXT_COLS;i++)
|
||||
// TextChar(task,,i,j,text[j][i]);
|
||||
|
||||
TextPrint(task,0,0,ATTR>>8,"Draw a maze with left button.");
|
||||
TextPrint(task,0,0,ATTR>>8,"Draw a maze with left bttn.");
|
||||
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ U0 SolveMaze(I64 x,I64 y)
|
||||
if (stk_ptr==STK_SIZE) return;
|
||||
Sleep(100);
|
||||
if (ScanChar)
|
||||
ThrowBreak; //<CTRL-ALT-c>
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,11 @@ U0 Maze()
|
||||
do {
|
||||
MemSet(text,0,sizeof(text));
|
||||
while (!(ch=ScanChar)) {
|
||||
//Input Ptr (mouse) text x,y coordinates.
|
||||
x=ip.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
|
||||
y=ip.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
|
||||
if (ip.lb&&!winmgr.grab_scroll)
|
||||
x=ms.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
|
||||
y=ms.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
|
||||
if (ms.lb&&!winmgr.grab_scroll)
|
||||
text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;
|
||||
if (ip.rb&&!winmgr.grab_scroll) {
|
||||
if (ms.rb&&!winmgr.grab_scroll) {
|
||||
text[y][x]='*'+ATTR;
|
||||
SolveMaze(x,y);
|
||||
ch=GetChar;
|
||||
|
||||
+24
-24
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
|
||||
|
||||
RegSetDftEntry("TempleOS/RawHide","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/RawHide");
|
||||
RegDft("TempleOS/RawHide","F64 best_score=9999;\n");
|
||||
RegExe("TempleOS/RawHide");
|
||||
|
||||
F64 t0,tf;
|
||||
I64 outside_cnt;
|
||||
@@ -230,19 +230,19 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
|
||||
}
|
||||
|
||||
if (ip.pos.x-last_pos_x>0)
|
||||
if (ms.pos.x-last_pos_x>0)
|
||||
left=FALSE;
|
||||
else if (ip.pos.x-last_pos_x<0)
|
||||
else if (ms.pos.x-last_pos_x<0)
|
||||
left=TRUE;
|
||||
if (left) {
|
||||
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
|
||||
DCSymmetrySet(dc,ip.pos.x-task->pix_left-task->scroll_x,0,
|
||||
ip.pos.x-task->pix_left-task->scroll_x,1);
|
||||
DCSymmetrySet(dc,ms.pos.x-task->pix_left-task->scroll_x,0,
|
||||
ms.pos.x-task->pix_left-task->scroll_x,1);
|
||||
}
|
||||
Sprite3(dc,ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top -task->scroll_y,0,horse_imgs[frame&3]);
|
||||
Sprite3(dc,ms.pos.x-task->pix_left-task->scroll_x,
|
||||
ms.pos.y-task->pix_top -task->scroll_y,0,horse_imgs[frame&3]);
|
||||
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
|
||||
last_pos_x=ip.pos.x;
|
||||
last_pos_x=ms.pos.x;
|
||||
|
||||
if (tf) {
|
||||
dc->color=RED;
|
||||
@@ -336,8 +336,8 @@ U0 AnimateTask(CTask *parent)
|
||||
max_speed=ClampU64(max_speed,MAX_U32/3,200*MAX_U32);
|
||||
cx=(MAP_WIDTH -parent->pix_width)/2,
|
||||
cy=(MAP_HEIGHT-parent->pix_height)/2;
|
||||
cursor_x=ip.pos.x+cx-parent->pix_left-parent->scroll_x;
|
||||
cursor_y=ip.pos.y+cy-parent->pix_top -parent->scroll_y;
|
||||
cursor_x=ms.pos.x+cx-parent->pix_left-parent->scroll_x;
|
||||
cursor_y=ms.pos.y+cy-parent->pix_top -parent->scroll_y;
|
||||
cnt=0;stress=0;
|
||||
my_outside_cnt=0;
|
||||
if (cursor_x<FENCE_WIDTH && cursor_y<FENCE_HEIGHT)
|
||||
@@ -422,10 +422,10 @@ U0 AnimateTask(CTask *parent)
|
||||
if (!tf && !outside_cnt) {
|
||||
tf=tS;
|
||||
music.mute=TRUE;
|
||||
Snd(2000);Sleep(200);Snd(0);Sleep(100);
|
||||
Snd(86);Sleep(200);Snd;Sleep(100);
|
||||
if (tf-t0<best_score) {
|
||||
best_score=tf-t0;
|
||||
Snd(2000);Sleep(200);Snd(0);Sleep(100);
|
||||
Snd(86);Sleep(200);Snd;Sleep(100);
|
||||
}
|
||||
music.mute=FALSE;
|
||||
}
|
||||
@@ -451,10 +451,10 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("3qC2etG3DCBDCECFqFCsADADqB");
|
||||
Play("C2etG3DCBDCECFqFCsADADqB");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
Play("5qC4etG5DC4B5DCECFqFC4sA5D4A5D4qB");
|
||||
Play("5C4etG5DC4B5DCECFqFC4sA5D4A5D4qB");
|
||||
Play("4sGAGA5qG4etG5GD4eBBqB5F4eBA5qE");
|
||||
Play("4sGAGA5qG4etG5GD4eBBqB5F4eBA5qE");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ U0 CleanUp()
|
||||
|
||||
U0 RawHide()
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
MenuPush(
|
||||
"File {"
|
||||
@@ -559,15 +559,15 @@ U0 RawHide()
|
||||
Fs->draw_it=&DrawIt;
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_DOWN);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_R_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN: //Doesn't do anything, yet.
|
||||
case MSG_MS_L_DOWN: //Doesn't do anything, yet.
|
||||
break;
|
||||
case MSG_IP_R_DOWN: //Doesn't do anything, yet.
|
||||
case MSG_MS_R_DOWN: //Doesn't do anything, yet.
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
ReInit;
|
||||
break;
|
||||
@@ -585,7 +585,7 @@ rh_done:
|
||||
MenuPop;
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
RegWriteBranch("TempleOS/RawHide","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWrite("TempleOS/RawHide","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
RawHide;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+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;
|
||||
| ||||