diff --git a/TempleOSCD/0000Boot/0000Kernel.BIN.C b/TempleOSCD/0000Boot/0000Kernel.BIN.C index 0964635..23921d9 100644 Binary files a/TempleOSCD/0000Boot/0000Kernel.BIN.C and b/TempleOSCD/0000Boot/0000Kernel.BIN.C differ diff --git a/TempleOSCD/Adam/ADefine.HC b/TempleOSCD/Adam/ADefine.HC index 1564d57..e9e5368 100644 --- a/TempleOSCD/Adam/ADefine.HC +++ b/TempleOSCD/Adam/ADefine.HC @@ -18,7 +18,7 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ $TR-C,"LineRep"$ -$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,042"); +$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,185"); DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,012"); $ID,-4$ DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); diff --git a/TempleOSCD/Apps/KeepAway/KeepAway.HC b/TempleOSCD/Apps/KeepAway/KeepAway.HC index 9e53f45..4d344eb 100644 --- a/TempleOSCD/Apps/KeepAway/KeepAway.HC +++ b/TempleOSCD/Apps/KeepAway/KeepAway.HC @@ -715,9 +715,9 @@ ka_done: //Don't goto out of try } catch PutExcept; SettingsPop; + MenuPop; RegWrite("TempleOS/KeepAway","I64 best_score0=%d,best_score1=%d;\n", best_score0,best_score1); - MenuPop; } Êp¨­ÿÿÿûÿÿÿûÿÿÿ­ÿÿÿûÿÿÿ·ÿÿÿûÿÿÿûÿÿÿ·ÿÿÿûÿÿÿ­ÿÿÿûÿÿÿ­ÿÿÿ·ÿÿÿûÿÿÿ·ÿÿÿ ·ÿÿÿûÿÿÿöÿÿÿ·ÿÿÿûÿÿÿ diff --git a/TempleOSCD/Apps/ToTheFront/ToTheFront.HC b/TempleOSCD/Apps/ToTheFront/ToTheFront.HC index 5df16c3..fae5ab4 100644 --- a/TempleOSCD/Apps/ToTheFront/ToTheFront.HC +++ b/TempleOSCD/Apps/ToTheFront/ToTheFront.HC @@ -207,8 +207,8 @@ U0 ToTheFront() ProgressBarsRst; SettingsPop; - MenuPop; DCDel(map_dc); CleanUp; + MenuPop; Seed; } diff --git a/TempleOSCD/Compiler/Compiler.BIN b/TempleOSCD/Compiler/Compiler.BIN index 6c03db2..4ec766b 100644 Binary files a/TempleOSCD/Compiler/Compiler.BIN and b/TempleOSCD/Compiler/Compiler.BIN differ diff --git a/TempleOSCD/Demo/AcctExample/PersonalNotes.DD b/TempleOSCD/Demo/AcctExample/PersonalNotes.DD index 6a3c13c..a9d6816 100644 --- a/TempleOSCD/Demo/AcctExample/PersonalNotes.DD +++ b/TempleOSCD/Demo/AcctExample/PersonalNotes.DD @@ -1,5 +1,7 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$ +* TestSuite $LK,"DoLightTable",A="FF:::/Misc/OSTestSuite.HC,DoLightTable"$ + * $LK,"::/Apps/X-Caliber/X-Caliber.HC"$ * Add asteroid harbor defense. * Afterburner thruster. diff --git a/TempleOSCD/Demo/AcctExample/Registry.HC b/TempleOSCD/Demo/AcctExample/Registry.HC index acdad0b..fdf313e 100644 --- a/TempleOSCD/Demo/AcctExample/Registry.HC +++ b/TempleOSCD/Demo/AcctExample/Registry.HC @@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$ $ID,2$I64 best_score=16469; $ID,-2$$TR,"TOSRegen"$ $ID,2$progress1_tf=0.000;progress2_tf=0.000; -progress3_tf=0.000;progress4_tf=202.718; +progress3_tf=0.000;progress4_tf=198.424; $ID,-2$$ID,-2$$TR,"Once"$ $ID,2$$TR,"Adam"$ $ID,2$$ID,-2$$TR,"User"$ diff --git a/TempleOSCD/Demo/Games/BomberGolf.HC b/TempleOSCD/Demo/Games/BomberGolf.HC index 13de16d..f277ecb 100644 Binary files a/TempleOSCD/Demo/Games/BomberGolf.HC and b/TempleOSCD/Demo/Games/BomberGolf.HC differ diff --git a/TempleOSCD/Demo/Games/DunGen.HC b/TempleOSCD/Demo/Games/DunGen.HC index c6502de..17484f1 100644 --- a/TempleOSCD/Demo/Games/DunGen.HC +++ b/TempleOSCD/Demo/Games/DunGen.HC @@ -437,9 +437,9 @@ dg_done: } catch PutExcept; SettingsPop; + CleanUp; MenuPop; RegWrite("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score); - CleanUp; } DunGen; diff --git a/TempleOSCD/Demo/Games/FlapBat.HC b/TempleOSCD/Demo/Games/FlapBat.HC index 7af5684..1088bdf 100644 Binary files a/TempleOSCD/Demo/Games/FlapBat.HC and b/TempleOSCD/Demo/Games/FlapBat.HC differ diff --git a/TempleOSCD/Demo/Games/FlatTops.HC b/TempleOSCD/Demo/Games/FlatTops.HC index 45a695e..a2e973a 100644 --- a/TempleOSCD/Demo/Games/FlatTops.HC +++ b/TempleOSCD/Demo/Games/FlatTops.HC @@ -844,9 +844,9 @@ nv_done: GetMsg(,,1<flags|=DCF_NO_TRANSPARENTS; -GrBlot(dc2,0,0,dc[cur_dc]); + dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS; + GrBlot(dc2,0,0,dc[cur_dc]); } U0 AnimateTask(I64) diff --git a/TempleOSCD/Demo/Graphics/LightTable.HC b/TempleOSCD/Demo/Graphics/LightTable.HC new file mode 100644 index 0000000..088f2fc --- /dev/null +++ b/TempleOSCD/Demo/Graphics/LightTable.HC @@ -0,0 +1,222 @@ +class Photon +{ + Photon *next,*last; + CD3 p,v; +} p_root; + +CDC *map; + +#define TAIL 20 +U0 DrawIt(CTask *,CDC *dc) +{ + Photon *tmpp; + GrBlot(dc,0,0,map); + tmpp=p_root.next; + while (tmpp!=&p_root) { + dc->color=LTRED; + GrLine(dc,tmpp->p.x-TAIL*tmpp->v.x,tmpp->p.y-TAIL*tmpp->v.y, + tmpp->p.x,tmpp->p.y); + tmpp=tmpp->next; + } +} + +#define HEIGHT 10 +U0 FindNormal(CDC *dc,Photon *tmpp,I64 last,I64,CD3 *_normal) +{ + CD3 p1,p2,v,s; + F64 é=Arg(tmpp->v.x,tmpp->v.y),è; + + for (è=0;è<ã/2;è+=ã/HEIGHT) { + D3Equ(&s,Cos(é+ã-ã/4-è),Sin(é+ã-ã/4-è)); + D3Mul(&v,HEIGHT,&s); + D3Add(&p1,&tmpp->p,&v); + if (GrPeek(dc,p1.x,p1.y)!=last) + break; + } + if (GrPeek(dc,p1.x,p1.y)==last) + D3Copy(&p1,&tmpp->p); + + for (è=0;è<ã/2;è+=ã/HEIGHT) { + D3Equ(&s,Cos(é+ã+ã/4+è),Sin(é+ã+ã/4+è)); + D3Mul(&v,HEIGHT,&s); + D3Add(&p2,&tmpp->p,&v); + if (GrPeek(dc,p2.x,p2.y)!=last) + break; + } + if (GrPeek(dc,p2.x,p2.y)==last) + D3Copy(&p2,&tmpp->p); + + D3Sub(&s,&p1,&p2); + D3Equ(_normal,s.y,-s.x); + if (D3Dot(_normal,&tmpp->v)<0) + D3Equ(_normal,-s.y,s.x); + + D3Unit(_normal); +} + +U0 SnellsLaw(CDC *dc,Photon *tmpp,I64 last,I64 next) +{ +//n1 and n2 are refraction index. +//n1 Sin(é1) == n2 Sin(é2) + F64 é=Arg(tmpp->v.x,tmpp->v.y),én,n1,n2,é1,é2,éa,éb; + CD3 normal; + if (last==WHITE) + n1=1.5; + else + n1=1.0; + if (next==WHITE) + n2=1.5; + else + n2=1.0; + FindNormal(dc,tmpp,last,next,&normal); + én=Arg(normal.x,normal.y); + //dot=m1m2Cos(é); + é1=ACos(D3Dot(&normal,&tmpp->v)); + é2=ASin(n1*Sin(é1)/n2); + //é --> (én+é1) + //é <-- (én+é2) + éa=én+é2; + éb=én-é2; + if (Abs(Wrap(éa-é))v,Cos(é),Sin(é)); +} + +U0 AnimateTask(I64) +{ + CD3 v; + Photon *tmpp; + I64 last,next; + while (TRUE) { + tmpp=p_root.next; + while (tmpp!=&p_root) { + last=GrPeek(map,tmpp->p.x,tmpp->p.y); + D3Mul(&v,1.5,&tmpp->v); + D3AddEqu(&tmpp->p,&v); + if (tmpp->p.x<=0) tmpp->v.x=-tmpp->v.x; + if (tmpp->p.x>=map->width) tmpp->v.x=-tmpp->v.x; + if (tmpp->p.y<=0) tmpp->v.y=-tmpp->v.y; + if (tmpp->p.y>=map->height) tmpp->v.y=-tmpp->v.y; + next=GrPeek(map,tmpp->p.x,tmpp->p.y); + if (last!=next && + (last==BLACK && next==WHITE) || + (last==WHITE && next==BLACK)) + SnellsLaw(map,tmpp,last,next); + tmpp=tmpp->next; + } + Sleep(10); + } +} + +U0 Init() +{ + map=DCNew(Fs->pix_width,Fs->pix_height); + QueInit(&p_root); +} + +U0 CleanUp() +{ + QueDel(&p_root,TRUE); + DCDel(map); +} + +#define PTS_NUM 1024 +U0 LightTable() +{ + I64 msg_code,i,arg1,arg2,ray_x1,ray_y1,ray_x2,ray_y2; + CD3I32 *c=MAlloc(PTS_NUM*sizeof(CD3I32)); + Photon *tmpp; + + MenuPush( + "File {" + " Restart(,'\n');" + " Abort(,CH_SHIFT_ESC);" + " Exit(,CH_ESC);" + "}" + "Edit {" + " Fill(,CH_SPACE);" + "}" + ); + PopUpOk( + "Draw splines with $$GREEN$${Left-Click}$$FG$$.\n\n" + "Fill lens with $$GREEN$$$$FG$$.\n\n" + "$$GREEN$${Right-Drag}$$FG$$ to fire rays.\n" + ); + SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$ + Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS- + WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU; + Fs->text_attr=BLACK<<4+WHITE; //Current $LK,"CTask",A="MN:CTask"$ is Fs segment register. + AutoComplete; + WinBorder; + WinMax; + DocCursor; + DocClear; + Init; + Fs->draw_it=&DrawIt; + Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs); + try { + while (TRUE) { + msg_code=GetMsg(&arg1,&arg2, + 1<p.x=ray_x2; tmpp->p.y=ray_y2; + tmpp->v.x=ray_x2-ray_x1; tmpp->v.y=ray_y2-ray_y1; + D3Unit(&tmpp->v); + QueIns(tmpp,p_root.last); + break; + case MSG_MS_L_DOWN: + i=0; + map->color=ROP_XOR+WHITE; + do { + c[i].x=arg1; c[i].y=arg2; c[i].z=0; + Gr2BSpline(map,c,i+1); + msg_code=GetMsg(&arg1,&arg2, + 1<pix_left,ms.pos.y-Fs->pix_top); + break; + case '\n': + DCFill; + CleanUp; + Init; + break; + case CH_ESC: + case CH_SHIFT_ESC: + goto lt_done; + } + break; + } + } +lt_done: + GetMsg(,,1<win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER; diff --git a/TempleOSCD/Doc/ChgLog.DD b/TempleOSCD/Doc/ChgLog.DD index 4cf1576..485bd28 100644 --- a/TempleOSCD/Doc/ChgLog.DD +++ b/TempleOSCD/Doc/ChgLog.DD @@ -2,7 +2,8 @@ $WW,1$$FG,5$$TX+CX,"Change Log"$$FG$ Use $LK,"R",A="MN:R"$() to rename if I change a label. -$IV,1$----01/30/17 06:25:57----$IV,0$ +$IV,1$----01/30/17 12:37:29----$IV,0$ +* Added $LK,"::/Demo/Graphics/LightTable.HC"$. $IV,1$----01/27/17 08:13:37----$IV,0$ * Added $LK,"DocLineRead",A="MN:DocLineRead"$() and $LK,"DocLineWrite",A="MN:DocLineWrite"$(). diff --git a/TempleOSCD/Doc/DemoIndex.DD b/TempleOSCD/Doc/DemoIndex.DD index daf1a1c..d13dd3f 100644 --- a/TempleOSCD/Doc/DemoIndex.DD +++ b/TempleOSCD/Doc/DemoIndex.DD @@ -67,6 +67,7 @@ $LK,"::/Demo/Snd/WaterFowl.HC"$ $MA-X+PU,"::/Apps/Psalmody/Examples",LM="Cd(\"::/Apps/Psalmody/Examples\");Dir;View;\n"$ $LK,"CPURep",A="MN:CPURep"$ $LK,"::/Demo/MultiCore/MPPrint.HC"$ +$LK,"::/Demo/Graphics/LightTable.HC"$ $LK,"::/Demo/Graphics/PredatorPrey.HC"$ $LK,"::/Demo/Graphics/Cartesian.HC"$ $LK,"::/Demo/Graphics/Hanoi.HC"$ diff --git a/TempleOSCD/Kernel/KernelB.HH b/TempleOSCD/Kernel/KernelB.HH index 89ace33..dc7ad10 100644 --- a/TempleOSCD/Kernel/KernelB.HH +++ b/TempleOSCD/Kernel/KernelB.HH @@ -151,7 +151,7 @@ public _extern _D3_DIST_SQR F64 D3DistSqr(CD3 *d1,CD3 *d2); //Distance Squared public _extern _D3_DIV CD3 *D3Div(CD3 *quot,CD3 *d,F64 s); //quot=d/s public _extern _D3_DIV_EQU CD3 *D3DivEqu(CD3 *quot,F64 s); //quot/=s public _extern _D3_DOT F64 D3Dot(CD3 *d1,CD3 *d2); //d1 dot d2 -public _extern _D3_EQU CD3 *D3Equ(CD3 *dst,F64 x,F64 y,F64 z); //dst=(x,y,z) +public _extern _D3_EQU CD3 *D3Equ(CD3 *dst,F64 x,F64 y,F64 z=0); //dst=(x,y,z) public _extern _D3_MUL CD3 *D3Mul(CD3 *prod,F64 s,CD3 *d); //prod=s*d public _extern _D3_MUL_EQU CD3 *D3MulEqu(CD3 *prod,F64 s); //prod*=s public _extern _D3_NORM F64 D3Norm(CD3 *d); //Norm diff --git a/TempleOSCD/Misc/OSTestSuite.HC b/TempleOSCD/Misc/OSTestSuite.HC index 85f95d5..4d446d9 100644 --- a/TempleOSCD/Misc/OSTestSuite.HC +++ b/TempleOSCD/Misc/OSTestSuite.HC @@ -12,7 +12,7 @@ U0 TS(U8 *desc) (PROGRESS_DESC_LEN-StrLen(st))>>1,CH_SPACE,st); Free(st); progress4=ts_i++; - progress4_max=170; + progress4_max=171; progress4_t0=ts_t0; *progress4_desc=0; RegExe("TempleOS/OSTestSuite"); @@ -655,6 +655,17 @@ U0 DoF2Macro() DeathWait(&task,TRUE); } +U0 DoLightTable() +{ + CTask *task=User("#include \"::/Demo/Graphics/LightTable\";\n"); + BirthWait(&task->popup_task); + TaskWait(task->popup_task); + PostMsgWait(task->popup_task,MSG_KEY_DOWN_UP,CH_SPACE,0); + Sleep(750); + PostMsgWait(task,MSG_KEY_DOWN_UP,CH_ESC,0); + DeathWait(&task,TRUE); +} + U0 DoPredatorPrey() { CTask *task=User("#include \"::/Demo/Graphics/PredatorPrey\";\n"); @@ -1572,6 +1583,7 @@ U0 OSTestSuite() TS("Symmetry"); DoSymmetry; TS("Shadow"); TSFileChar("::/Demo/Graphics/Shadow",1500); TS("Transform"); TSFileChar("::/Demo/Graphics/Transform",,CH_SHIFT_ESC); + TS("LightTable"); DoLightTable; TS("PredatorPrey"); DoPredatorPrey; TS("PoleZeros"); DoPoleZeros; TS("Digits"); DoDigits;