TempleOSCDV4.06.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:19 +02:00
1 parent 6fe38d2d9d
commit b632ab9a4f
261 files changed
+6282 -5801

No files matched your search

Binary file not shown.
+1 -1
View File
@@ -323,7 +323,7 @@ U0 DrawIt(CTask *task,CDC *dc)
SpriteMat3B(dc,x,y,0,$IB,"<2>",BI=2$,r2);
else {
tt=Tri(tS,1.0);
temps=SpriteInterpolate($IB,"<3>",BI=3$,$IB,"<4>",BI=4$,tt);
temps=SpriteInterpolate(tt,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$);
SpriteMat3B(dc,x,y,0,temps,r1);
Free(temps);
}
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -127,7 +127,7 @@ Bool TestSameSlope(I64 x,I64 y,I64 w,I64 h)
s=&normals[y][x];
for (k2=0;k2<h;k2++)
for (k1=0;k1<w;k1++)
if (D3NormSqr(D3Sub(&normals[y+k2][x+k1],s,&p))>.10)
if (D3NormSqr(D3Sub(&p,&normals[y+k2][x+k1],s))>.10)
return FALSE;
return TRUE;
}
@@ -416,7 +416,7 @@ U0 MPDrawIt(CTask *task,CDC *dc)
dc->x=cx;
dc->y=cy;
//dc->x and the translation part of dc->r are identical in effect,
//dc->x and the translation part of dc->r are ident in effect,
//but we use both to show-off. We could add offsets together and
//use one or the other.
Binary file not shown.
+1 -1
View File
@@ -42,7 +42,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
while (tempm1!=&ode->next_mass) {
tempm2=tempm1->next;
while (tempm2!=&ode->next_mass) {
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
dd=D3NormSqr(&p);
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
d=Sqrt(dd)+0.0001;
+14 -14
View File
@@ -132,7 +132,7 @@ U0 RiverDel()
class RiverDrop
{
RiverDrop *next,*last;
I64 index,dx,dy;
I64 idx,dx,dy;
} rd_root;
Bool rd_lock;
@@ -153,27 +153,27 @@ U0 RiverDropsNext(CTask *mem_task)
tempr=rd_root.next;
while (tempr!=&rd_root) {
tempr1=tempr->next;
if (++tempr->index>river_hi) {
if (++tempr->idx>river_hi) {
QueRem(tempr);
Free(tempr);
} else {
do {
if (RandU16&1 && GrPeek(map_dc,r_x[tempr->index]+tempr->dx,
r_y[tempr->index]+tempr->dy)==BLUE)
if (RandU16&1 && GrPeek(map_dc,r_x[tempr->idx]+tempr->dx,
r_y[tempr->idx]+tempr->dy)==BLUE)
break;
tempr->dx=ClampI64(tempr->dx+RandU16%3-1,-r_width[tempr->index]/2,
r_width[tempr->index]/2);
tempr->dy=ClampI64(tempr->dy+RandU16%3-1,-r_width[tempr->index]/2,
r_width[tempr->index]/2);
} while (GrPeek(map_dc,r_x[tempr->index]+tempr->dx,
r_y[tempr->index]+tempr->dy)!=BLUE &&
GrPeek(map_dc,r_x[tempr->index],
r_y[tempr->index])==BLUE); //Might be reinitializing
tempr->dx=ClampI64(tempr->dx+RandU16%3-1,-r_width[tempr->idx]/2,
r_width[tempr->idx]/2);
tempr->dy=ClampI64(tempr->dy+RandU16%3-1,-r_width[tempr->idx]/2,
r_width[tempr->idx]/2);
} while (GrPeek(map_dc,r_x[tempr->idx]+tempr->dx,
r_y[tempr->idx]+tempr->dy)!=BLUE &&
GrPeek(map_dc,r_x[tempr->idx],
r_y[tempr->idx])==BLUE); //Might be reinitializing
}
tempr=tempr1;
}
tempr=MAlloc(sizeof(RiverDrop),mem_task);
tempr->index=river_lo;
tempr->idx=river_lo;
tempr->dx=0;
tempr->dy=0;
QueIns(tempr,rd_root.last);
@@ -188,7 +188,7 @@ U0 RiverDropsDraw(CDC *dc,I64 cx,I64 cy)
Yield;
tempr=rd_root.next;
while (tempr!=&rd_root) {
GrPlot(dc,r_x[tempr->index]+tempr->dx-cx,r_y[tempr->index]+tempr->dy-cy);
GrPlot(dc,r_x[tempr->idx]+tempr->dx-cx,r_y[tempr->idx]+tempr->dy-cy);
tempr=tempr->next;
}
LBtr(&rd_lock,0);
Binary file not shown.
+3 -3
View File
@@ -99,17 +99,17 @@ U0 DrawIt(CTask *task,CDC *dc)
Unit *FindUnit(I64 x,I64 y,I64 player)
{
I64 i,dd,best_dd=MAX_I64;
Unit *result=NULL;
Unit *res=NULL;
for (i=0;i<NUM_UNITS;i++) {
if (u[i].player==player && u[i].alive) {
dd=SqrI64(u[i].x-x)+SqrI64(u[i].y-y);
if (dd<best_dd) {
best_dd=dd;
result=&u[i];
res=&u[i];
}
}
}
return result;
return res;
}
U0 CheckForKills(I64 x1,I64 y1,I64 player)
+8 -8
View File
@@ -152,8 +152,8 @@ F64 Dip
Track *TrackFind(Track *_tempt,I64 x,I64 z)
{
Track *result=_tempt,*tempt;
I64 dd,best=SqrI64(result->x-x)+SqrI64(result->z-z);
Track *res=_tempt,*tempt;
I64 dd,best=SqrI64(res->x-x)+SqrI64(res->z-z);
tempt=_tempt;
while (TRUE) {
@@ -163,7 +163,7 @@ Track *TrackFind(Track *_tempt,I64 x,I64 z)
dd=SqrI64(tempt->x-x)+SqrI64(tempt->z-z);
if (dd<best) {
best=dd;
result=tempt;
res=tempt;
} else
break;
}
@@ -175,11 +175,11 @@ Track *TrackFind(Track *_tempt,I64 x,I64 z)
dd=SqrI64(tempt->x-x)+SqrI64(tempt->z-z);
if (dd<best) {
best=dd;
result=tempt;
res=tempt;
} else
break;
}
return result;
return res;
}
U0 TrackSlice(F64 *_x,F64 *_z,F64 é,F64 d)
@@ -646,12 +646,12 @@ U0 Varoom()
"Play {"
" Restart(,'\n');"
" Accelerator(,,SC_CURSOR_UP);"
" Break(,,SC_CURSOR_DOWN);"
" Brake(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
SettingsPush(,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
try {
Fs->text_attr=YELLOW<<4+BLUE;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
@@ -695,7 +695,7 @@ vr_done: //Don't goto out of try
} catch
PutExcept;
CleanUp;
SettingsPop(,TSF_SAME_SONG);
SettingsPop;
MenuPop;
RegWriteBranch("TempleOS/Varoom","F64 best_score=%5.4f;\n",best_score);
}
+12 -14
View File
@@ -96,7 +96,7 @@ class Flake
class Tree
{
U16 x,y;
I64 fire_frame_index;
I64 fire_frame_idx;
} trees[NUM_TREES];
I64 snow_x,snow_y;
@@ -132,8 +132,8 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->pen_width=1;
for (i=0;i<NUM_TREES;i++) {
if (trees[i].y<=h/2) {//Draw trees behind house
if (trees[i].fire_frame_index) {
if (trees[i].fire_frame_index++&1)
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
img=$IB,"<8>",BI=8$;
else
img=$IB,"<9>",BI=9$;
@@ -149,8 +149,8 @@ U0 DrawIt(CTask *task,CDC *dc)
for (i=0;i<NUM_TREES;i++) {
if (trees[i].y>h/2) {//Draw trees in front of house
if (trees[i].fire_frame_index) {
if (trees[i].fire_frame_index++&1)
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
img=$IB,"<8>",BI=8$;
else
img=$IB,"<9>",BI=9$;
@@ -182,10 +182,9 @@ U0 DrawIt(CTask *task,CDC *dc)
if (tempp->stopped)
SpriteMat3B(dc,tempp->x,tempp->y,GR_Z_ALL,peasant_imgs[0],r);
else {
temps=SpriteInterpolate(
temps=SpriteInterpolate(Saw(animate_mS/250.0,1.0),
peasant_imgs[ animate_phase &3],
peasant_imgs[(animate_phase+1)&3],
Saw(animate_mS/250.0,1.0));
peasant_imgs[(animate_phase+1)&3]);
SpriteMat3B(dc,tempp->x,tempp->y,GR_Z_ALL,temps,r);
Free(temps);
}
@@ -199,10 +198,9 @@ U0 DrawIt(CTask *task,CDC *dc)
if (tS>king_timeout)
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,king_imgs[0],r);
else {
temps=SpriteInterpolate(
temps=SpriteInterpolate(Saw(king_mS/250.0,1.0),
king_imgs[ king_phase &3],
king_imgs[(king_phase+1)&3],
Saw(king_mS/250.0,1.0));
king_imgs[(king_phase+1)&3]);
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,temps,r);
Free(temps);
}
@@ -279,7 +277,7 @@ U0 Init()
for (i=0;i<NUM_TREES;i++) {
trees[i].x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
trees[i].y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
trees[i].fire_frame_index=0;
trees[i].fire_frame_idx=0;
}
QueInit(&step_root);
@@ -376,7 +374,7 @@ U0 AnimateTask(I64)
tempp->door_opened_t0=door_open_t0=tS;
}
for (i=0;i<NUM_TREES;i++) //Hang-out by fire
if (trees[i].fire_frame_index &&
if (trees[i].fire_frame_idx &&
Sqr(tempp->x-trees[i].x)+Sqr(tempp->y-trees[i].y)<20*20) {
tempp->stopped=TRUE;
break;
@@ -433,7 +431,7 @@ U0 BurnTrees()
I64 i;
for (i=0;i<NUM_TREES;i++)
if (Sqr(king_x-trees[i].x)+Sqr(king_y-trees[i].y)<10*10)
trees[i].fire_frame_index=1;
trees[i].fire_frame_idx=1;
}
U0 SongTask(I64)
+2 -2
View File
@@ -66,7 +66,7 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
D3Equ(&p2,task->pix_width>>1,task->pix_height>>1,0);
for (i=1;i<NUM_BALLS;i++) {
D3Sub(&p2,&balls[i].state->x,&p);
D3Sub(&p,&p2,&balls[i].state->x);
if (d=D3Norm(&p)) {
//Gravity would be /(d*d*d), but that's too exponential.
D3MulEqu(&p,GRAVITY/d);
@@ -76,7 +76,7 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
for (i=0;i<NUM_BALLS;i++)
for (j=i+1;j<NUM_BALLS;j++) {
D3Sub(&balls[j].state->x,&balls[i].state->x,&p);
D3Sub(&p,&balls[j].state->x,&balls[i].state->x);
dd=D3NormSqr(&p);
if (dd<=(2*BALL_RADIUS)*(2*BALL_RADIUS)) {
if (t-collision_t>0.05) {