From f111c9cee12379932f911167acd1ac1937e4976f Mon Sep 17 00:00:00 2001 From: TempleOS-bot Date: Mon, 30 Jan 2017 16:27:26 -0500 Subject: [PATCH] Nightly update (ISO SHA-1 4afea92) --- TempleOSCD/0000Boot/0000Kernel.BIN.C | Bin 192080 -> 192080 bytes TempleOSCD/Adam/ADefine.HC | 2 +- TempleOSCD/Apps/KeepAway/KeepAway.HC | 2 +- TempleOSCD/Apps/ToTheFront/ToTheFront.HC | 2 +- TempleOSCD/Compiler/Compiler.BIN | Bin 192920 -> 192920 bytes TempleOSCD/Demo/AcctExample/PersonalNotes.DD | 2 + TempleOSCD/Demo/AcctExample/Registry.HC | 2 +- TempleOSCD/Demo/Games/BomberGolf.HC | Bin 18571 -> 18571 bytes TempleOSCD/Demo/Games/DunGen.HC | 2 +- TempleOSCD/Demo/Games/FlapBat.HC | Bin 7669 -> 7669 bytes TempleOSCD/Demo/Games/FlatTops.HC | 2 +- TempleOSCD/Demo/Games/RawHide.HC | 2 +- TempleOSCD/Demo/Games/Talons.HC | 2 +- TempleOSCD/Demo/Games/Varoom.HC | 2 +- TempleOSCD/Demo/Games/Wenceslas.HC | 2 +- TempleOSCD/Demo/Graphics/Life.HC | 4 +- TempleOSCD/Demo/Graphics/LightTable.HC | 222 +++++++++++++++++++ TempleOSCD/Demo/Graphics/PoleZeros.HC | 1 - TempleOSCD/Doc/ChgLog.DD | 3 +- TempleOSCD/Doc/DemoIndex.DD | 1 + TempleOSCD/Kernel/KernelB.HH | 2 +- TempleOSCD/Misc/OSTestSuite.HC | 14 +- 22 files changed, 253 insertions(+), 16 deletions(-) create mode 100644 TempleOSCD/Demo/Graphics/LightTable.HC diff --git a/TempleOSCD/0000Boot/0000Kernel.BIN.C b/TempleOSCD/0000Boot/0000Kernel.BIN.C index 09646357ddf774107bb5ea0f1554407a711ffb39..23921d9642b5cd1549c72b5d6f0317d74720cabc 100644 GIT binary patch delta 266 zcmca`hx@`E?g=LBA&YeGT(;%jypZK0^JX5FLy?ScH=mDHV`c2#{4FU@mT}VN)P`rQ zEHlr$GEP@0U=*L6)^>?eZ?a|kES8#Au8fo8I~6DYXg6kNd+Ik?ufvx`=`}>5#N_jB zf}2-#Bs0RK7!Pia>9Y4@{{R2~=6N?bnHgtnUU8cxohg0N_H|B-^Y|IBO!p09tOxPW z1u^o8gBbTR8J`L>KHGkzmT{#PGXo>T^nw+PwP41F6^wOEj11cgRx-|3W<0i?=PaWk zJL`WCnC^6i(Ua-l=E)m>32$F;g;B$c`R@^q?Wg6K=22UAE=kypZK0^JX5FLy?ScHlL4GV`Z$|{4FU@ma%VhYQr;D zmbUY*jMEhg7{w>2wOwLlm~7cTizV}wE92z&PQ}ST+Krh-HU>`C>+ogadks-2G5LI( z;N}$_$&4^5#;|6P(^NUJ0ml^I2V|>2Zq(dc!arx%RC*B#X z2Vc1|GE6RP6dirqA3-#!J;|6P(Q}h@%ml^I2V|=#Rq(dc!aq8yCC*B#X z>t4AsGE6R^Me?LL>V`4-;~aHKbFO_`+&#v02wB+ z?W>P6dirn*gnD$p@o0V%G4&#o$n=7Lj4azlg_zDLF)~bU=oOhPu!Up$KNF@|djLEW BHy!{0 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 13de16daa91332e6685b2419ce0ed7afd3ac582d..f277ecbbc473f598b6f3d35b8ceea05ceba8699d 100644 GIT binary patch delta 36 rcmeC4$k;uRaYK)!XmDytNoHPpaX@~7HJ5^db53evUg+k9lCSgt^^^@~ delta 36 rcmeC4$k;uRaYK)!sB=zgVqR#0HJ5@yaB4|OW?p)6K>p^1lCSgt?f?yE 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 7af5684c03f6a84ab44fdca6d6b1d8a9a3503fca..1088bdfff61762d09deed6a7ed037b7647be2e1f 100644 GIT binary patch delta 34 pcmexr{ndIyw5VusYDr0EUV3pret|WYf`W5SYGPjK<^s`H4gl~J4441_ delta 34 pcmexr{ndIyw5X_aPHJLaXn{4Cfflags|=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;