Initial (manual) import

This commit is contained in:
minexew committed 2017-01-22 20:26:44 +01:00
1 parent f39611c506
commit 895fe109de
661 files changed
+245862

No files matched your search

@@ -0,0 +1,321 @@
//Place this file in /Home and change
//anything you want.
U0 TimeIns()
{
CDate cdt;
cdt=Now;
"$$IV,1$$----%D %T----$$IV,0$$\n",cdt,cdt;
}
U0 FileLinkIns()
{
U8 *st=PopUpPickFile;
st[0]=':'; //This is my personal code, not production. LOL
"$$LK,\"%s\",A=\"FI:%s\"$$",st+2,st;
Free(st);
}
U0 DirLinksIns()
{
CDirEntry *tmpde,*tmpde1;
U8 *st=PopUpPickDir,*st2;
st[0]=':'; //This is my personal code, not production. LOL
st2=MStrPrint("%s/*",st);
tmpde=tmpde1=FilesFind(st2,FUF_JUST_FILES);
while (tmpde) {
tmpde->full_name[0]=':';
"$$LK,\"%s\",A=\"FI:%s\"$$\n",tmpde->full_name+2,tmpde->full_name;
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
Free(st);
Free(st2);
}
U0 DocHiddenDel(CDoc *doc=NULL)
{
Bool unlock;
CDocEntry *doc_e,*doc_e1;
if (!doc) doc=DocPut;
if (doc) {
unlock=DocLock(doc);
DocRecalc(doc);
doc_e=doc->head.next;
while (doc_e!=doc) {
doc_e1=doc_e->next;
if (doc_e->de_flags&(DOCEF_FILTER_SKIP|DOCEF_SKIP))
DocEntryDel(doc,doc_e);
doc_e=doc_e1;
}
DocRecalc(doc);
if (unlock)
DocUnlock(doc);
}
}
Bool MyPutKey(I64 ch,I64 sc)
{//ch=ASCII; sc=scan_code
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.DD"$.
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
//You can customize keys. This routine
//is called before the main editor
//key hndlr $LK,"DocPutKey",A="MN:DocPutKey"$().
//You can intercept any key.
//Return TRUE if you completely
//handled the key.
I64 i;
U8 *st1,*st2;
if (sc&SCF_ALT && !(sc&SCF_CTRL)) {
switch (ch) {
case 0:
switch (sc.u8[0]) {
case SC_F1:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /LTPURPLE");
else
"$$LTPURPLE$$";
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /PURPLE");
else
"$$PURPLE$$";
}
return TRUE;
case SC_F2:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /LTRED");
else
"$$LTRED$$";
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /RED");
else
"$$RED$$";
}
return TRUE;
case SC_F3:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /LTGREEN");
else
"$$LTGREEN$$";
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /GREEN");
else
"$$GREEN$$";
}
return TRUE;
case SC_F4:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /Default Color");
else
"$$FG$$";
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /BLUE");
else
"$$BLUE$$";
}
return TRUE;
case SC_F5:
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /GodOffer");
else
GodOffer;
return TRUE;
case SC_F6:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /TOSIns");
else
TOSIns;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /TimeIns");
else
TimeIns;
}
return TRUE;
case SC_F7:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /NISTGodIns2");
else
NISTGodIns2;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /GodIns");
else
GodIns;
}
return TRUE;
case SC_F8:
if (sc&SCF_SHIFT) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /DirLinksIns");
else
DirLinksIns;
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /FileLinkIns");
else
FileLinkIns;
}
return TRUE;
}
break;
case 'a':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /AutoComplete On");
else
AutoComplete(ON);
return TRUE;
case 'A':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /AutoComplete Off");
else
AutoComplete;
return TRUE;
case 'h':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /WinTileHorz");
else
WinTileHorz;
return TRUE;
case 'H':
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Del Hidden Doc Entries");
else
DocHiddenDel;
return TRUE;
case 'm':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /WinMax");
else {
WinBorder;
WinMax;
}
return TRUE;
case 'v':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /WinTileVert");
else
WinTileVert;
return TRUE;
case 'V':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /FrameGrabberToggle");
else
FrameGrabberToggle;
return TRUE;
case 'l':
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Put Link to Cur Pos on Clipboard");
else {
ClipboardDel;
st1=FileNameAbs(BIBLE_FILENAME);
st2=FileNameAbs(DocPut->filename.name);
if (!StrCmp(st1,st2)) {
Free(st1);
st1=BibleLine2Verse(DocPut->cur_entry->y+1,',');
DocPrint(sys_clipboard_doc,"$$LK,\"BF:%s\"$$",st1);
} else
DocPrint(sys_clipboard_doc,"$$LK,\"FL:%s,%d\"$$",
st2,DocPut->cur_entry->y+1);
Free(st1);
Free(st2);
}
return TRUE;
case 'L':
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Place Anchor, Put Link to Clipboard");
else {
i=RandU32;
ClipboardDel;
DocPrint(sys_clipboard_doc,"$$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$$",
DocPut->filename.name,i);
"$$AN,\"<TODO>\",A=\"ANC%d\"$$",i;
}
return TRUE;
//Ins your own ALT-key plug-ins
case '1':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /ã");
else
'ã';
return TRUE;
case '2':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /é");
else
'é';
return TRUE;
case '3':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /è");
else
'è';
return TRUE;
case '4':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /ê");
else
'ê';
return TRUE;
case '9':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /Indent 5");
else
"$$ID,5$$";
return TRUE;
case '0':
if (sc&SCF_KEY_DESC)
KeyDescSet("Dol /Unindent 5");
else
"$$ID,-5$$";
return TRUE;
case 'b':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Jump to Bad Code");
else //$LK,"::/Adam/God/HSNotes.DD"$
GodCodeJmp;
return TRUE;
case 'g':
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/BlogScrnShot");
else
BlogScrnShot;
return TRUE;
case 'p':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /JukeBox(Home/Sup1Hymns)");
else
JukeBox("~/Sup1/Sup1Hymns");
return TRUE;
case 'P':
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /JukeBox(Home/Sup1Songs)");
else
JukeBox("~/Sup1/Sup1Songs");
return TRUE;
}
}
return FALSE;
}
Bool MyPutS(U8 *)
{
return FALSE;
}
KeyDevAdd(&MyPutKey,&MyPutS,0x20000000,TRUE);
@@ -0,0 +1,21 @@
//Place this file in /Home and change
//anything you want.
Option(OPTf_WARN_PAREN,ON);
Option(OPTf_WARN_DUP_TYPES,ON);
KbdTypeMatic(0);
// Las Vegas is -7 during summer, -8 during winter
local_time_offset=-8*60*60*CDATE_FREQ; //Pacific
// Remember you can set the time in the BIOS.
//$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale
ms_hard.scale.x=0.5;
ms_hard.scale.y=0.5;
ms_hard.scale.z=5.0; //wheel
//don't change these
ms_hard.prescale.x=ms_hard.pos.x/ms_hard.scale.x;
ms_hard.prescale.y=ms_hard.pos.y/ms_hard.scale.y;
ms_hard.prescale.z=ms_hard.pos.z/ms_hard.scale.z;
+47
View File
@@ -0,0 +1,47 @@
//Place this file in /Home and change
//anything you want.
U0 UserStartUp()
{//Run each time a user a spawned
DocTermNew;
Type("::/Doc/Start.DD");
LBts(&Fs->display_flags,DISPLAYf_SHOW);
WinToTop;
WinZBufUpdate;
Dir;
"$TX,"81,223",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
CPURep;
}
U0 SrvStartUp()
{//Run each time a srv task is spawned.
DocTermNew;
LBts(&Fs->display_flags,DISPLAYf_SHOW);
WinToTop;
WinZBufUpdate;
}
CTask *user1,*user2;
U0 StartUpTasks()
{
user1=User;
user2=User;
WinToTop(user1);
WinTileVert;
"Boot Time:%7.3fs\n",tS;
XTalk(user1,"Cd;#include \"Once\";\n");
Silent;
ACInit("/*;!*/Bible.TXT*;!*.TXT"); //No Bible, no uncompressed DD.
Silent(OFF);
"AutoComplete Time:%7.3fs\n",tS;
}
if (DrvIsWritable(':')) {
DelTree("::/Tmp/ScrnShots");
MkDir("::/Tmp/ScrnShots");
}
StartUpTasks;
"\nTempleOS V%5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time;
@@ -0,0 +1,35 @@
#help_index "Cmd Line (Typically)"
#define FILEMASK_OFF_LIMITS "!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"\
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;"\
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*"
public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in all text files.
return Find(needle_str,"/*",fu_flags);
}
public I64 F2(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in most text files.
return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags);
}
public I64 R(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
{//Find text and replace in most text files.
return Find(needle_str,"/*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
}
public I64 FD(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in cur dir text files.
return Find(needle_str,"*",fu_flags);
}
public I64 FD2(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in most cur dir text files.
return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags);
}
public I64 RD(U8 *needle_str,U8 *replace_text=NULL,U8 *fu_flags="+l-i")
{//Find text and replace in most cur dir text files.
return Find(needle_str,"*;" FILEMASK_OFF_LIMITS,fu_flags,replace_text);
}
+16
View File
@@ -0,0 +1,16 @@
Cd(__DIR__);;
//If these are not present in /Home, it uses the version in the root dir. You
//can make your own, modified, version of these files in your /Home directory.
#include "~/HomeLocalize"
#include "/Adam/Opt/Boot/MakeBoot"
#include "/Adam/Opt/Utils/MakeUtils"
#include "~/HomeWrappers"
MapFileLoad("::/Kernel/Kernel");
MapFileLoad("::/Compiler/Compiler");
#include "::/Apps/Psalmody/Load"
#include "~/TOS/MakeTOS"
#include "~/HomeKeyPlugIns"
#include "~/HomeSys"
Cd("..");;
+39
View File
@@ -0,0 +1,39 @@
//Place this file in /Home and change
//anything you want.
//This file is executed by the
//first terminal window upon start-up.
//See $LK,"Once",A="FF:/Home/HomeSys.HC,Once"$ and $LK,"Home Files",A="FF:::/Doc/GuideLines.DD,/Home Files"$.
// Type("::/Doc/Customize.DD");
U0 Tmp()
{
OnceExe;
switch (sys_boot_src.u16[0]) {
case BOOT_SRC_DVD:
"\nIf you answer 'No' you can play with\n"
"the live CD without installing.\n\n"
"Install onto hard drive ";
if (YorN) {
DocBottom;
if (RunFile("::/Misc/OSInstall",,FALSE)) {
Del("C:/Home/DoDistro.HC.Z");
Del("D:/Home/DoDistro.HC.Z");
OnceDrv('C',"\"\n\nRun TOSStaffIns;\n\n\n\";");
OnceDrv('D',""); //This command uses cached Registry file.
if (PressAKey!=CH_SHIFT_ESC)
Reboot; //Too dangerous for amateurs until reboot.
}
}
break;
}
if (FileFind("D:/Tmp/Logs/access.log")) {
In("\n\n%C",CH_ESC);
RunFile("::/Demo/WebLogDemo/WebLogRep",,
"D:/Tmp/Logs/*.log","D:/Home/WebLogRep.DD");
Del("D:/Tmp/Logs/*.log");
}
}
Tmp;
+854
View File
@@ -0,0 +1,854 @@
$MA,"Cd ",LM="Cd;Dir;\n"$$MA,"DrvC ",LM="Drv('C');\n"$$MA,"DrvD ",LM="Drv('D');\n"$$MA,"/ ",LM="Cd(\"/\");Dir;\n"$$MA,"TOS ",LM="Cd(\"/Home/TOS\");Dir;\n"$$MA,"Home ",LM="Cd(\"/Home\");Dir;\n"$$MA,"ChgDskT ",LM="ChgDsk('T');\n"$$MA,"MergeD ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"D:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"MergeT ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"T:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"D:/Wb ",LM="Cd(\"D:/Wb\");Dir;\n"$
$MA,"MakeC ",LM="TOSBootHDIns('C');\n"$$MA+PU,"BootC ",LM="BootRAM(\"C:/Kernel.BIN.C\");"$$MA,"Regen ",LM="TOSRegen;\n"$$MA,"PreRegen",LM="TOSPreRegen;\n"$$MA,"MakeD ",LM="TOSBootHDIns('D');\n"$$MA+PU,"BootD ",LM="BootRAM(\"D:/Kernel.BIN.C\");"$$MA,"CopyDrv ",LM="TOSPmtAndCopyDrv;\n"$$MA,"MakeWeb ",LM="FreshenBlog;\n"$
$MA,"Kernel ",LM="Cd(\"/Kernel\");Dir;\n"$$MA,"Compiler",LM="Cd(\"/Compiler\");Dir;\n"$$MA,"BlkDev ",LM="Cd(\"/Kernel/BlkDev\");Dir;\n"$$MA,"Mem ",LM="Cd(\"/Kernel/Mem\");Dir;\n"$$MA,"Serial ",LM="Cd(\"/Kernel/SerialDev\");Dir;\n"$$MA,"Bin ",LM="Cd(\"/Home/Sup1/Sup1Bin\");Dir;\n"$$MA,"HDAudio ",LM="Cd(\"/Home/Sup1/Sup1HDAudio\");Dir;\n"$$MA,"Examples",LM="Cd(\"/Home/Sup1/Sup1HDAudio/Examples\");Dir;\n"$$MA,"Dist ",LM="Cd(\"/Home/Sup1/Sup1Distro\");Dir;\n"$
$MA,"Adam ",LM="Cd(\"/Adam\");Dir;\n"$$MA,"AutoComp",LM="Cd(\"/Adam/AutoComplete\");Dir;\n"$$MA,"Ctrls ",LM="Cd(\"/Adam/Ctrls\");Dir;\n"$$MA,"ABlkDev ",LM="Cd(\"/Adam/ABlkDev\");Dir;\n"$$MA,"DolDoc ",LM="Cd(\"/Adam/DolDoc\");Dir;\n"$$MA,"Gr ",LM="Cd(\"/Adam/Gr\");Dir;\n"$$MA,"God ",LM="Cd(\"/Adam/God\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Adam/Snd\");Dir;\n"$$MA,"Boot ",LM="Cd(\"/Adam/Opt/Boot\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Adam/Opt/Utils\");Dir;\n"$
$LK+X,"ChgLog ",A="FI:::/Doc/ChgLog.DD"$$MA,"Blog ",LM="Blog;\n"$$MA,"EdGod ",LM="Ed(\"D:/Home/God.DD\");\n"$$MA,"BlogDir ",LM="Cd(\"/Home/Web/TAD/BlogDir\");Dir;\n"$$MA,"Partial ",LM="FreshenBlog;\n"$$MA,"CodeWalk",LM="CodeWalkThru;\n"$$MA,"TOSTheme",LM="TOSTheme;\n"$$MA,"Videos ",LM="Cd(\"/Home/Sup1/Sup1Videos\");Dir;\n"$
$MA,"Web ",LM="Cd(\"/Home/Web\");Dir;\n"$$MA,"TAD ",LM="Cd(\"/Home/Web/TAD\");Dir;\n"$$MA,"DLC ",LM="Cd(\"/Home/Web/DLC\");Dir;\n"$$MA,"AppStore",LM="Cd(\"/Home/Web/AppStore\");Dir;\n"$$MA,"Sup1 ",LM="Cd(\"/Home/Sup1\");Dir;\n"$$MA,"Blog ",LM="Cd(\"/Home/Sup1/Sup1Blog\");Dir;\n"$$MA,"Code ",LM="Cd(\"/Home/Sup1/Sup1CodeScraps\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Home/Sup1/Sup1Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Home/Sup1/Sup1Graphics\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Home/Sup1/Sup1Utils\");Dir;\n"$
$MA,"Apps ",LM="Cd(\"/Apps\");Dir;\n"$$MA,"Budget ",LM="Cd(\"/Apps/Budget\");Dir;\n"$$MA,"GrModels",LM="Cd(\"/Apps/GrModels\");Dir;\n"$$MA,"KeepAway",LM="Cd(\"/Apps/KeepAway\");Dir;\n"$$MA,"Logic ",LM="Cd(\"/Apps/Logic\");Dir;\n"$$MA,"Psalmody",LM="Cd(\"/Apps/Psalmody\");Dir;\n"$$MA,"Span ",LM="Cd(\"/Apps/Span\");Dir;\n"$$MA,"Strut ",LM="Cd(\"/Apps/Strut\");Dir;\n"$$MA,"TimeClk ",LM="Cd(\"/Apps/TimeClock\");Dir;\n"$
$MA,"Titan ",LM="Cd(\"/Apps/Titanium\");Dir;\n"$$MA,"ToTheFrt",LM="Cd(\"/Apps/ToTheFront\");Dir;\n"$$MA,"Vocab ",LM="Cd(\"/Apps/Vocabulary\");Dir;\n"$$MA,"XCaliber",LM="Cd(\"/Apps/X-Caliber\");Dir;\n"$$MA,"Books1 ",LM="Cd(\"/Home/Books1\");Dir;\n"$$MA,"Books2 ",LM="Cd(\"/Home/Books2\");Dir;\n"$$MA,"Hymns ",LM="Cd(\"/Home/Sup1/Sup1Hymns\");Dir;\n"$$MA,"Songs ",LM="Cd(\"/Home/Sup1/Sup1Songs\");Dir;\n"$
$MA,"Demo ",LM="Cd(\"/Demo\");Dir;\n"$$MA,"AcctEmpl",LM="Cd(\"/Demo/AcctExample\");Dir;\n"$$MA,"Asm ",LM="Cd(\"/Demo/Asm\");Dir;\n"$$MA,"DocDoc ",LM="Cd(\"/Demo/DolDoc\");Dir;\n"$$MA,"Dsk ",LM="Cd(\"/Demo/Dsk\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Demo/Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Demo/Graphics\");Dir;\n"$$MA,"InFile ",LM="Cd(\"/Demo/InFile\");Dir;\n"$$MA,"Lectures",LM="Cd(\"/Demo/Lectures\");Dir;\n"$$MA,"MultCore",LM="Cd(\"/Demo/MultiCore\");Dir;\n"$
$MA,"RevFile ",LM="Cd(\"/Demo/RevFileDemo\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Demo/Snd\");Dir;\n"$$MA,"SortFile",LM="Cd(\"/Demo/SortFileDemo\");Dir;\n"$$MA,"Template",LM="Cd(\"/Demo/Templates\");Dir;\n"$$MA,"HtmlTXT ",LM="Cd(\"/Demo/ToHtmlToTXTDemo\");Dir;\n"$$MA,"WebLog ",LM="Cd(\"/Demo/WebLogDemo\");Dir;\n"$$MA,"Stadium ",LM="Cd(\"/Demo/Games/Stadium\");Dir;\n"$
$MA,"Doc ",LM="Cd(\"/Doc\");Dir;\n"$$MA,"Misc ",LM="Cd(\"/Misc\");Dir;\n"$$MA,"Tour ",LM="Cd(\"/Misc/Tour\");Dir;\n"$$MA,"Tmp ",LM="Cd(\"/Tmp\");Dir;\n"$$MA,"ScrnShot",LM="Cd(\"/Tmp/ScrnShots\");Dir;\n"$$MA,"DelScrSt",LM="Del(\"D:/Tmp/*.SND\");DelTree(\"D:/Tmp/ScrnShots\");MkDir(\"D:/Tmp/ScrnShots\");Del(\"C:/Tmp/*.SND\");DelTree(\"C:/Tmp/ScrnShots\");MkDir(\"C:/Tmp/ScrnShots\");\n"$$MA,"0000Boot",LM="Cd(\"/0000Boot\");Dir;\n"$$MA,"Linux ",LM="Cd(\"/Linux\");Dir;\n"$
$MA,"LinxDict",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/LinuxDict.TXT**\\\");\");\n"$$MA,"August ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/AugustWords.TXT**\\\");\");\n"$$MA,"Happy ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HappyWords.TXT*\\\");\");\n"$$MA,"Yiddish ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Yiddish.TXT*\\\");\");\n"$$MA,"Bible ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/BibleWords.TXT*\\\");\");\n"$$MA,"Huck ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HuckWords.TXT*\\\");\");\n"$$MA,"Ingreds ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Ingredients.TXT*\\\");\");\n"$$MA,"Chess ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Chess.DD*\\\");\");\n"$$MA,"Words ",LM="Cd(\"/Home/Sup1/Sup1Words\");Dir;\n"$
$MA,"MakeStd ",LM="MakeStdDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSCD.ISO\");\n"$$MA,"MakeStRS",LM="MakeStdRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSCDRS.ISO\");\n"$$MA,"MakeUlt ",LM="MakeUltraDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSUltra.ISO\");\n"$$MA,"MakeUtRS",LM="MakeUltraRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSUltraRS.ISO\");\n"$$MA,"MakeStaf",LM="MakeStaffDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSStaff.ISO\");\n"$$MA,"MakeDbg ",LM="MakeDbgDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSDbg.ISO\");\n"$
$MA,"BurnStd ",LM="MakeStdDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnStRS",LM="MakeStdRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnUlt ",LM="MakeUltraDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnUtRS",LM="MakeUltraRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnStaf",LM="MakeStaffDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnDbg ",LM="MakeDbgDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$
$FG,5$Fun Games$FG$
$SP+PU,"Titanium",LM="#include \"::/Apps/Titanium/Run\"",BI=1$ $SP+PU,"Diamond",LM="#include \"::/Demo/Games/BlackDiamond\"",BI=2$ $SP+PU," Bat",LM="#include \"::/Demo/Games/FlapBat\"",BI=3$ $SP+PU,"Varoom",LM="#include \"::/Demo/Games/Varoom\"",BI=4$
$SP+PU,"FlatTops",LM="#include \"::/Demo/Games/FlatTops\"",BI=5$ $SP+PU," Golf ",LM="#include \"::/Demo/Games/BomberGolf\"",BI=6$ $SP+PU,"KeepAway",LM="#include \"::/Apps/KeepAway/Run\"",BI=7$ $SP+PU,"RawHide",LM="#include \"::/Demo/Games/RawHide\"\n",BI=8$
$SP+PU,"X-Caliber",LM="#include \"::/Apps/X-Caliber/Run\"",BI=9$ $SP+PU,"Wenceslas",LM="#include \"::/Demo/Games/Wenceslas\"",BI=10$ $SP+PU,"Lines",LM="#include \"::/Demo/Games/BattleLines\"",BI=11$
$FG,5$Unfun Games$FG$
$SP+PU," Talons",LM="#include \"::/Demo/Games/Talons\"",BI=12$ $SP+PU,"Frankenstein",LM="#include \"::/Demo/Games/CastleFrankenstein\"",BI=13$ $SP+PU,"ZoneOut",LM="#include \"::/Demo/Games/ZoneOut\"",BI=14$
$SP+PU,"ToTheFront",LM="#include \"::/Apps/ToTheFront/Run\"",BI=15$ $SP+PU," Span ",LM="#include \"::/Apps/Span/Run\"",BI=16$ $SP+PU,"Checkers",LM="#include \"::/Demo/Games/TreeCheckers.HC.Z\"",BI=17$ $SP+PU,"Digits",LM="#include \"::/Demo/Games/Digits\"",BI=18$
$FG,5$Code Scraps$FG$
$SP+PU,"Strut",LM="#include \"::/Apps/Strut/Run\"",BI=19$ $SP+PU,"BigGuns",LM="#include \"::/Demo/Games/BigGuns\"",BI=20$ $SP+PU,"TheDead",LM="#include \"::/Demo/Games/TheDead\"",BI=21$ $SP+PU,"DunGen",LM="#include \"::/Demo/Games/DunGen\"",BI=22$ $SP+PU,"Models",LM="#include \"::/Apps/GrModels/Run\";View;",BI=23$
$FG,5$Nongames$FG$
$SP+PU,"JukeBox",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");",BI=24$ $SP+PU,"Psalmody",LM="#include \"::/Apps/Psalmody/Run\";",BI=25$ $SP+PU,"Budget",LM="#include \"::/Apps/Budget/Run\"",BI=26$ $SP+PU,"Logic",LM="#include \"::/Apps/Logic/Run\"",BI=27$ $SP+PU,"Vocab",LM="#include \"::/Apps/Vocabulary/Run\"",BI=28$
$MA,"TestSuit",LM="#include \"::/Misc/OSTestSuite\";\n"$$MA,"TakeTour",LM="Cd(\"::/Misc/Tour\");;InFile(\"Tour\");\n"$$MA+PU,"PsalSup1",LM="#include \"::/Apps/Psalmody/Load\";Psalmody(\"~/Sup1/Sup1Hymns\");"$$MA-X+PU,"SymAlpha",LM="DocMax;Who;View;"$$MA-X+PU,"SymNum ",LM="DocMax;Who(\"+m\");View;"$
C ÐÿÿÿøÿÿÿBlackÒÿÿÿÄÿÿÿ#4ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ      ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿºÚÿÿÿèÿÿÿ%ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ"
ÔÿÿÿÌÿÿÿ4.ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrØÿÿÿÚÿÿÿ#ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿ ÿ ÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ²ÒÿÿÿÞÿÿÿ'$ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿ ÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿLine truncated
ûÿÿÿöÿÿÿûÿÿÿöÿÿÿûÿÿÿìÿÿÿçÿÿÿöÿÿÿûÿÿÿöÿÿÿ
´ÿÿÿ²ÿÿÿMPÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿLine truncated
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿ
 
ÿÿÿÿÿÿÿÿÿÿ 
ÿÿÿÿÿÿÿ   
ÿÿÿÿ     ÿÿ     ÿÿ        ÿ      ÿ                    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ␍yÓÿÿÿÜÿÿÿ<H÷ÿÿÿ'ûÿÿÿ÷ÿÿÿõÿÿÿüÿÿÿ õÿÿÿ'ûÿÿÿ '
èÿÿÿòÿÿÿèÿÿÿüÿÿÿèÿÿÿèÿÿÿáÿÿÿúÿÿÿáÿÿÿúÿÿÿ èÿÿÿáÿÿÿèÿÿÿüÿÿÿèÿÿÿòÿÿÿèÿÿÿüÿÿÿúÿÿÿõÿÿÿ÷ÿÿÿ  $$÷ÿÿÿ$õÿÿÿ$ èÿÿÿõÿÿÿèÿÿÿòÿÿÿüÿÿÿõÿÿÿüÿÿÿ üÿÿÿéÿÿÿ üÿÿÿéÿÿÿ ÿÿÿÿéÿÿÿ ÿÿÿÿéÿÿÿõÿÿÿÿÿÿÿòÿÿÿÿÿÿÿûÿÿÿãÿÿÿýÿÿÿåÿÿÿãÿÿÿÿÿÿÿãÿÿÿåÿÿÿúÿÿÿáÿÿÿþÿÿÿãÿÿÿõÿÿÿ$÷ÿÿÿ$÷ÿÿÿ' $$õÿÿÿ''
' '
 ␍    !!&''"#%$$#    ␍ ␍!


 $%*$*+'&('()&(( $++
0/.112-,7 765343! 3 45833!839;:7;766;;1␍ ¸ÿÿÿøÿÿÿCastle¾éÿÿÿâÿÿÿ6R äÿÿÿ äÿÿÿ îÿÿÿ îÿÿÿ  ôÿÿÿÛÿÿÿ ôÿÿÿÛÿÿÿ äÿÿÿÛÿÿÿÛÿÿÿôÿÿÿäÿÿÿîÿÿÿîÿÿÿôÿÿÿ ÷ÿÿÿ ûÿÿÿ îÿÿÿ éÿÿÿ  óÿÿÿõÿÿÿäÿÿÿõÿÿÿäÿÿÿõÿÿÿîÿÿÿõÿÿÿîÿÿÿõÿÿÿôÿÿÿÛÿÿÿõÿÿÿôÿÿÿÛÿÿÿõÿÿÿñÿÿÿäÿÿÿñÿÿÿÛÿÿÿñÿÿÿÛÿÿÿñÿÿÿôÿÿÿäÿÿÿñÿÿÿîÿÿÿñÿÿÿîÿÿÿñÿÿÿôÿÿÿñÿÿÿõÿÿÿ÷ÿÿÿõÿÿÿûÿÿÿõÿÿÿîÿÿÿõÿÿÿéÿÿÿõÿÿÿéÿÿÿõÿÿÿóÿÿÿõÿÿÿóÿÿÿéÿÿÿ óÿÿÿõÿÿÿÿÿÿÿ

ÿÿÿÿ*ÿÿÿÿ
*
**ÿÿÿÿ␍␍ 
  ␍␍␍  
 

 ␍␍  $"$#"!  !"!#"$#! !    "!"%++&%%'&&(''(()),),**,*+-$$-$'()')&3/..232.11523400/3451104-"b
ÌÿÿÿÆÿÿÿ-7ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ Öéÿÿÿåÿÿÿp¨üÿÿÿíÿÿÿíÿÿÿüÿÿÿòÿÿÿòÿÿÿüÿÿÿíÿÿÿýÿÿÿíÿÿÿýÿÿÿüÿÿÿòÿÿÿýÿÿÿòÿÿÿýÿÿÿúÿÿÿòÿÿÿòÿÿÿúÿÿÿúÿÿÿòÿÿÿýÿÿÿòÿÿÿýÿÿÿúÿÿÿýÿÿÿýÿÿÿ÷ÿÿÿôÿÿÿùÿÿÿõÿÿÿöÿÿÿûÿÿÿýÿÿÿøÿÿÿüÿÿÿüÿÿÿ÷ÿÿÿòÿÿÿùÿÿÿóÿÿÿÿÿÿÿöÿÿÿùÿÿÿûÿÿÿøÿÿÿúÿÿÿúÿÿÿöÿÿÿüÿÿÿýÿÿÿøÿÿÿýÿÿÿüÿÿÿôÿÿÿöÿÿÿöÿÿÿõÿÿÿöÿÿÿùÿÿÿüÿÿÿøÿÿÿúÿÿÿûÿÿÿôÿÿÿýÿÿÿõÿÿÿöÿÿÿþÿÿÿôÿÿÿôÿÿÿÿÿÿÿöÿÿÿöÿÿÿõÿÿÿóÿÿÿòÿÿÿõÿÿÿñÿÿÿôÿÿÿýÿÿÿöÿÿÿöÿÿÿþÿÿÿõÿÿÿóÿÿÿÿÿÿÿòÿÿÿõÿÿÿñÿÿÿóÿÿÿóÿÿÿÿÿÿÿúÿÿÿúÿÿÿôÿÿÿþÿÿÿôÿÿÿýÿÿÿûÿÿÿûÿÿÿúÿÿÿúÿÿÿûÿÿÿûÿÿÿ  úÿÿÿýÿÿÿûÿÿÿ þÿÿÿ úÿÿÿÿÿÿÿýÿÿÿþÿÿÿûÿÿÿ þÿÿÿ ûÿÿÿ þÿÿÿ ûÿÿÿ þÿÿÿ ûÿÿÿ þÿÿÿ ûÿÿÿ
þÿÿÿ ûÿÿÿþÿÿÿüÿÿÿ ÿÿÿÿ ûÿÿÿ þÿÿÿ üÿÿÿÿÿÿÿÿÿÿÿ ûÿÿÿ úÿÿÿÿÿÿÿþÿÿÿÿÿÿÿùÿÿÿ øÿÿÿÿÿÿÿ
üÿÿÿ ûÿÿÿþÿÿÿùÿÿÿøÿÿÿÿÿÿÿùÿÿÿ øÿÿÿþÿÿÿöÿÿÿõÿÿÿþÿÿÿùÿÿÿøÿÿÿýÿÿÿñÿÿÿðÿÿÿþÿÿÿúÿÿÿùÿÿÿýÿÿÿòÿÿÿñÿÿÿ 

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmok¾Úÿÿÿâÿÿÿ6R äÿÿÿ äÿÿÿ îÿÿÿ îÿÿÿ  ôÿÿÿÛÿÿÿ ôÿÿÿÛÿÿÿ äÿÿÿÛÿÿÿÛÿÿÿôÿÿÿäÿÿÿîÿÿÿîÿÿÿôÿÿÿ ÷ÿÿÿ ûÿÿÿ îÿÿÿ éÿÿÿ  óÿÿÿõÿÿÿäÿÿÿõÿÿÿäÿÿÿõÿÿÿîÿÿÿõÿÿÿîÿÿÿõÿÿÿôÿÿÿÛÿÿÿõÿÿÿôÿÿÿÛÿÿÿõÿÿÿñÿÿÿäÿÿÿñÿÿÿÛÿÿÿñÿÿÿÛÿÿÿñÿÿÿôÿÿÿäÿÿÿñÿÿÿîÿÿÿñÿÿÿîÿÿÿñÿÿÿôÿÿÿñÿÿÿõÿÿÿ÷ÿÿÿõÿÿÿûÿÿÿõÿÿÿîÿÿÿõÿÿÿéÿÿÿõÿÿÿéÿÿÿõÿÿÿóÿÿÿõÿÿÿóÿÿÿéÿÿÿ óÿÿÿõÿÿÿÿÿÿÿ

ÿÿÿÿ*ÿÿÿÿ
*
**ÿÿÿÿ␍␍ 
  ␍␍␍  
 

    $"$#"!  !"!#"$#! !    "!"%++&%%'&&(''(()),),**,*+-$$-$'()')&3/..232.11523400/3451104-"ÒÒÿÿÿÛÿÿÿ0$ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÆÿÿÿÖÿÿÿ4$ ÐÿÿÿøÿÿÿTreeúÕÿÿÿäÿÿÿ%ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿ ÿÿÿÿÿ ÿÿÿÿ Line truncated

 
 
 
ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ôáÿÿÿÖÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÔÿÿÿøÿÿÿBattleÒÂÿÿÿÅÿÿÿ@;ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿLine truncated
    
$%&&'$%$$$'$%%&&'&#!"!# #     /-.-/,/*,,*++)(+*)+(+ + +(!.-.!" + + ,*)*<=>>?<1033211=<<01<?330<1=2=>2>233?>;9:9;8867754765GEFEGDGBDDBCCA@CBA4C@C474C7C4@9FEF9:8C7C8D5BAB56TUVVWTIHKKJIIUTTHITWKKHTIUJUVJVJKKWVSRQQPSPONOLMOMN_^]]\__\Z\[Z[XY[YZLX[[OLLO[[XLQ]^^RQPO[[\PMYZZNM P88P654@@A5LMYYXL"ÏÿÿÿÑÿÿÿ)+ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Ùÿÿÿêÿÿÿ!ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿ

ÿÿÿ



ÿÿÿ




ÿÿÿ




ÿÿÿ



ÿÿÿÿ



ÿÿÿÿ



ÿÿÿÿ



ÿÿÿ





ÿÿÿ





ÿÿÿ




ÿÿÿ


ÿÿ
ÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
@@ -0,0 +1,506 @@
$WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* $LK,"::/Apps/X-Caliber/X-Caliber.HC"$
* Add asteroid harbor defense.
* Afterburner thruster.
* $LK,"::/Apps/Titanium/Titanium.HC"$
* Lead-in at start of game with no enemy.
* Have highway of death.
* Fix straight shooting.
* Helicopters.
* Anti-Aircraft.
* $MA-X+PU,"64-Bit Device Memory",LM="F(\"mem64_ptr\");View;"$ is not implemented.
* Cursor in $LK,"~/TOS/TOSToHtml.HC"$.
* Investigate why packet loss $LK,"Training Sleep(1)",A="FF:::/Adam/Training.HC,Sleep(1)"$.
* Add AVL or red/black binary tree library support. We have fixed-size stack. Auto-balancing binary tree is very needed. I've done everything myself. I don't want to ruin a perfect record. I'm in no hurry.
* $LK,"SpriteEd",A="FI:::/Adam/Gr/SpriteEd.HC"$ shift pts, Ctrl pt for ellipse/polygon w,h is off when rotated.
* God said this is bad. $LK,"FL:::/Adam/DolDoc/DocFind.HC,41"$
* Backward <SHIFT-F3> is broken?
* $LK,"Find",A="MN:Find"$() search sprite text?
* Cannot include ':' in $LK,"Document Links",A="FF:::/Adam/DolDoc/DocLink.HC,AD"$ search string.
* $$DA fixed width string: <Del> or <BACKSPACE> permanently shortens.
* 11/19/16 editor took long time after copying old testament onto clipboard and exiting.
* Nestled switch() start/end?
* Editor filter froze.
* Editor overstrike mode at cmd line with menu macro? Probably, many other overstrike issues.
* $LK,"DOCT_HEX_ED",A="MN:DOCT_HEX_ED"$ with odd size, ASCII cannot be edited.
* $LK,"FL:::/Adam/Gr/SpriteEd.HC,789"$ Resize bitmap?
* $LK,"DOCEF_REMALLOC_DATA",A="FF:::/Adam/DolDoc/DocChar.HC,DOCEF_REMALLOC_DATA"$ HexEdit Remalloc.
* $LK,"DOCF_DBL_DOLLARS",A="MN:DOCF_DBL_DOLLARS"$ in $LK,"Reindention",A="MN:EdCodeTools2"$.
* Compiler Optimization: Local array vars --> reg. Might exist.
* Make function as a better word processor. Justify text. Page numbers. Header and footer templates?
* Compiler Optimization: heap_glbls with added offset. Might exist.
* Bug: Find-and-replace text on $$PT$$ line before it.
* 12/25/2015 Copy-Paste index.html glitch if source window 40 columns.
* 01/06/2016 Editor filter "str" applied to output from LineRep looks broken.
* Document, perhaps with video, $LK,"GetStr",A="MN:GetStr"$() all the way down into $LK,"PutKey",A="MN:PutKey"$() code.
* Better dictionary.
* Good $LK,"spell checker",A="MN:ACMisspelledFind"$.
* Good Bible search.
* Can $LK,"MEM_EXTRA_HASH2_PAGS",A="MN:MEM_EXTRA_HASH2_PAGS"$ be just one?
* Bible ranges in $LK,"BibleVerse",A="MN:BibleVerse"$().
* $LK,"::/Demo/Games/FlatTops.HC"$ is torpedo, not bombs.
* Reset MPs with $LK,"Core0StartMP",A="MN:Core0StartMP"$() after boot. Free old task memory?
* Use pen_width and pen_height when clipping with pen_width>1.
* $LK,"~/Sup1/Sup1Games/Rocks.HC"$.
* Asm LIST NOLIST bugs.
* Review writing to same cache-line from multicore. Do $LK,"CTask",A="MN:CTask"$->task_flags and others need to be in separate cache lines?
* Fix $LK,"KbdLEDsSet",A="MN:KbdLEDsSet"$().
* NumLock comes on with break key.
* Hymns: mightest, finger
* Get rid of JIFFY and HPET and just use tS.
* Use "Rosetta Stone" in documentaion pointing to this: $LK,"::/Demo/ToHtmlToTXTDemo/ToHtml.HC"$.
* Change %h*c so the character is not a arg?
* $LK,"GrLineFat3",A="MN:GrLineFat3"$() needs a little work.
* $LK,"GrFillTri0",A="MN:GrFillTri0"$() with both $LK,"GrHLine",A="MN:GrHLine"$() and $LK,"GrVLine",A="MN:GrVLine"$() don't match in $LK,"::/Demo/Games/CastleFrankenstein.HC"$ causing wall spot pixels.
$FG,5$$TX+CX,"TODO? Meh"$$FG$
* Compiler: lock{} needs warn on invalid modes or something.
* Compiler: Warn recurse class define?
* Asm could support R4u8 by adding 0x40 byte.
* $LK,"Mem32DevAlloc",A="MN:Mem32DevAlloc"$() is broken. Devices should be in free spot of E820 report.
* $LK,"SpriteEd",A="FI:::/Adam/Gr/SpriteEd.HC"$: Strip $LK,"SPT_SHIFT",A="MN:SPT_SHIFT"$ origin cmds?
* Clean-up ASCII #127 delete char? (No. Maybe, we want a new usage for 127 in future centuries.)
* Compiler: Exceptions don't free $LK,"CCmpCtrl",A="MN:CCmpCtrl"$ stuff.
* $LK,"::/Adam/DolDoc/DocHighlight.HC"$ for code comments at top of documents.
* Unhandled exception msgs from MP's get overwritten by WinMgr.
* $LK,"Diff",A="MN:Diff"$("C:/Misc/Bible.TXT","D:/Misc/Bible.TXT"); Takes too long.
* Finish Pilgrim game.
* Compiler: PtrArith MUL SIZE -->QueIns(MUL)?
* Compiler: QueRem(IC_NOP)?
* Fix Chess game so not isometric view.
$FG,5$$TX+CX,"TODO: Too Hard, or Not Worth Doing."$$FG$
* AutoComplete/$LK,"Man",A="MN:Man"$() Jmp for user code.
* $LK,"Bible sized nodes",A="FF:::/Adam/DolDoc/DocRecalc.HC,->tag+i"$
* $LK,"FileMgr",A="MN:FileMgr"$() is bad with lots of files.
* Would be nice to have a routine telling how much free memory, so apps can plan a big alloc. This is doable, depending on how.
* Log-to-file is inefficient because we load and save whole file.
* $LK,"ICMov",A="MN:ICMov"$() $LK,"PUSH_CMP",A="FF:::/Compiler/BackLib.HC,PUSH_CMP"$ and $LK,"MDf_STK",A="MN:MDf_STK"$? Perhaps, it's okay.
* Short FAT32 ~ names.
* $LK,"Find",A="MN:Find"$() search text in sprites.
* Links in text in sprites.
* Compiler: Inline functions?
* Compiler: FunPtr local vars? I forgot if this was hard or not.
$ID,5$$HL,1$U0 Main()
{
U0 (*fp_old_draw_ms)(CDC *dc,I64 x,I64 y)=gr.fp_draw_ms;
}
$ID,-5$$HL,0$
* Compiler: Get rid of $LK,"0x20000",A="FF:::/Compiler/CMain.HC,0x20000"$ limit.
* $LK,"GrFloodFillRay",A="MN:GrFloodFillRay"$: Get rid of $LK,"0x80000",A="FF:::/Adam/Gr/GrPrimatives.HC,0x80000"$ limit.
$FG,5$$TX+CX,"Bugs"$$FG$
* 1/28/16 $LK,"::/Demo/Graphics/Pick3D.HC"$ crashed in TestSuite.
* 1/12/16 make RAM drive 2288 blks, $FG,2$CopyTree("C:/Home","B:/Home"); $FG$ Disk runs-out of space and hangs instead of reporting errors.
* Bug introduced around 11/1/15. Changed $LK,"::/Kernel/Sched.HC"$ and now $LK,"WinToTop",A="MN:WinToTop"$ is called on Adam task at start-up, sometimes. Might be user's fault because of bad keys pressed during VMware power-on init. Might be fixed by $LK,"ACf_INIT_IN_PROGRESS",A="MN:ACf_INIT_IN_PROGRESS"$.
* 1/12/16 $LK,"ATARepEntry",A="MN:ATARepEntry"$ shows corrupted bttns. Weird. Perhaps, my imagination.
$FG,5$$TX+CX,"3rd Party Bugs"$$FG$
* VMware: Stretch to full scrn
* VMware: PC speaker sound distorted.
* VMware: 8/2/2015 start-up. Probably multicore.
* VMware: $LK,"CtrlAltDel",A="FF:::/Kernel/SerialDev/Keyboard.HC,CtrlAltDel"$ on <CTRL-ALT-INS>
* VMware: Size zero files don't copy out of mounted disk? (Might be fixed.)
$FG,5$$TX+CX,"Bugs? Not really sure."$$FG$
* $LK,"Mount",A="MN:Mount"$() crashes on bad drive.
* Graphics clipping: scrn y+top<0 for top<0?
* 1/1/2015 Bug messing-up keyboard, like no CTRL key. Was working on Sprites.
* 4/13/14 Strut or RawHide crashed when $LK,"sys_var_init_flag",A="MN:sys_var_init_flag"$ was set during testsuite. Perhaps, floodfill?
* $LK,"ChkDsk",A="MN:ChkDsk"$ alloc unalloced. I don't know if I fixed this.
* 1/?/2015,8/10/2015 Macro sel in Menu did not go to shell? No, I think just <CTRL-m> twice. Not a bug.
* 5/7/14:Something like $LK,"InSetMs",A="MN:InSetMs"$ caused hang, then reboot in TestSuite.
* 5/7/14:#63 Maybe, $LK,"::/Demo/Graphics/Pick3D.HC"$ crashed in TestSuite.
* $LK,"StrPrintJoin",A="MN:StrPrintJoin"$(,st); With st="\n\\"; (Forgot what this is talking about.)
* $LK,"BMPRLE4To",A="MN:BMPRLE4To"$() has files_size too big by 108. Fixed?
$FG,5$$TX+CX,"TODO? Not really, just angst."$$FG$
* Should these be moved into $LK,"CHashClass",A="MN:CHashClass"$ from $LK,"CMemberLst",A="MN:CMemberLst"$ and $LK,"CHashGlblVar",A="MN:CHashGlblVar"$?
$ID,5$CArrayDim dim;
CHashFun *fun_ptr;
$ID,-5$
* extern of fun with dft arg of str?
* ISO.C on FAT32 created by Windows or Linux are not contiguous.
* Might want to warn switch[] dup case numbers.
* Make $LK,"Clamp",A="MN:Clamp"$(), $LK,"Min",A="MN:Min"$(), $LK,"Max",A="MN:Max"$() into asm routines?
* Add local vars to sym table in $LK,"Dbg",A="MN:Dbg"$()?
* Compiler: Prints two error messages for expressions in stmts.
* $LK,"U",A="MN:U"$() negative byte displacement, neg 32-bit disp.
* Race condition in $LK,"::/Demo/Games/FlatTops.HC"$ torpedo.
* Links to self document if empty file name? $LK,"Document Links",A="FF:::/Adam/DolDoc/DocLink.HC,AD"$
* $LK,"FUF_RECURSE",A="MN:FUF_RECURSE"$ would be nice if capital "+R".
* Sprites in cmd line code.
* 16-Bit Assembly and Unassembly and is bad.
* Compiler: Cmd to enable/disable warnings.
* Compiler: Type for either F64 or I64, like Print -- no conversion.
* Compiler: Arg type ... that did do conversion, if we have one that doesn't.
* $LK,"R",A="MN:R"$("char_bmp_","set_");
* Clean-up code $LK,"FileNameAbs",A="MN:FileNameAbs"$(), does it need so many local var names? I guess no choice.
$FG,5$$TX+CX,"Committee Needed"$$FG$
* Make binary tree look-up using FUN_SEG symbol addresses, so we can eliminate fun_seg cache and wall-paper kludge? All HolyC functions and glbl vars would have left-right for address search.
* Make so just CdRom; command to copy entire disk to ::/CdRom directory?
* $LK,"MP DepthBuf",A="FF:::/Adam/Gr/SpriteMesh.HC,dc->depth_buf=e->"$ is a kludge because of dc->depth_buf=NULL in various graphics routines.
* Improve editor undo, add redo.
* Compiler: F32?
* International Date output: $LK,"MPrintDate",A="MN:MPrintDate"$(). Every country make own version?
* International Date input: $LK,"Str2Date",A="MN:Str2Date"$().
* $LK,"DCF_SYMMETRY",A="MN:DCF_SYMMETRY"$ before transformation? (Currently, it's after.)
* $LK,"TRANSPARENT",A="MN:TRANSPARENT"$ does not work with $LK,"ROPF_DITHER",A="MN:ROPF_DITHER"$.
* $LK,"ROP_XOR",A="MN:ROP_XOR"$ with pen_width>1 is broken.
* $LK,"GrPutChar3",A="MN:GrPutChar3"$() with depth buf?
* Eliminate? $LK,"::/Adam/Ctrls/CtrlsA.HC"$?
* Eliminate? $LK,"::/Adam/AMathODE.HC"$?
* Eliminate? $LK,"Complex",A="MN:Complex"$?
* Eliminate? $LK,"CDC",A="MN:CDC"$.brush?
* Eliminate? $LK,"Mat4x4MulXYZ",A="MN:Mat4x4MulXYZ"$() change to 3x3?
* Eliminate? $LK,"ROP_XOR",A="MN:ROP_XOR"$?
* $LK,"WinMgrTask",A="MN:WinMgrTask"$ needs to do doc operations on $LK,"PostMsg",A="MN:PostMsg"$() msgs for ms_hard. Already works for $LK,"MsSet",A="MN:MsSet"$()?
* Should Msgs in PopUp queue get fwded to parent when task dies?
* Import Intel datasheets so we can use links in $LK,"Code",A="FI:::/Kernel/Mem/PageTables.HC"$ for documentation. I tried a PDF-to-text convertor and it wasn't acceptible.
* Why are BMP file $LK,"CBGR24",A="MN:CBGR24"$'s wrong? $LK,"::/Adam/Opt/Utils/FileBMP.HC"$.
* Switch stmt with sparse cases? Maybe, ban sparse switch stmts.
* Compiler Optimization: Postpone LocalVar init until last possible moment in case of return.
* Compiler: Local var array/struct initialization.
* Compiler Optimization: Bools use r,rm in $LK,"ICCmp",A="MN:ICCmp"$() like in $LK,"ICCmpAndBranch",A="MN:ICCmpAndBranch"$()?
* Compiler: !F64 ~F64
* Compiler: &=, |= can overflow with Bts Btr on small data types?
* Implement $LK,"RS_ATTR_FIXED",A="MN:RS_ATTR_FIXED"$ fixed pos files?
* SIMD in $LK,"Mat4x4MulXYZ",A="MN:Mat4x4MulXYZ"$?
* I use fixed-point in $LK,"Circle",A="MN:Circle"$(), $LK,"Ellipse",A="MN:Ellipse"$(), $LK,"Mat4x4MulXYZ",A="MN:Mat4x4MulXYZ"$(), $LK,"Mat4x4MulMat4x4New",A="MN:Mat4x4MulMat4x4New"$() and others. God says I might want to change to float. $LK,"::/Demo/Lectures/FixedPoint.HC"$ $LK,"::/Demo/Lectures/FixedPointAdvanced.HC"$.
* Note: We will never put multiple $LK,"Keyboard Tables",A="FI:::/Kernel/SerialDev/Keyboard.HC"$. Each country must make their own version of TempleOS. The $LK,"Intel Factory ROM",A="FF:::/Doc/Demands.DD,English"$ will have just English. Our $LK,"Charter",A="FI:::/Doc/Charter.DD"$ bans multiple country or architectures in the same version.
* 12 border chars in scrn font codes 0x02-0x0D. $LK,"TextBorder",A="MN:TextBorder"$() $LK,"RawDr",A="MN:RawDr"$() $LK,"::/Demo/Games/CharDemo.HC"$. LineFeed shows-up in $FG,2$<CTRL-m>$FG$ PersonalMenu.
* Super-simple high speed serial needs flow control. $FG,2$<CTRL-s>$FG$ and $FG,2$<CTRL-q>$FG$?
$FG,5$$TX+CX,"Inspirational Ideas"$$FG$
* Redo videos, make more professional.
* Use standard terminology from "the literature".
* Striped and other dither patterns. Brushes?
* Get rid of BYTE, WORD, DWORD in opcode and replace with U8, U16, U32.
* Get rid of "Char".
* Get rid of having two terms and pick one, "Disk" and "BlkDev"? (Probably, not that one.)
* Could switch to having just C and D drives and RAMDrive and CD/DVD?
* New editor widgets.
* Make use of flag potential in $LK,"FilesFind",A="MN:FilesFind"$() and possibly $LK,"DirContextNew",A="MN:DirContextNew"$().
* Sort options for $LK,"FilesFind",A="MN:FilesFind"$()?
* New $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ language features?
* Better $LK,"Debugging",A="HI:Debugging"$?
* Look for mem leaks?
* Std local var names.
* Ticketmaster format stmts? Overflow "t='*'" and padding character?
* Move stuff out of $LK,"Kernel",A="FI:::/Kernel/Kernel.PRJ"$ module.
* $$LK,L="FL:D:/Kernel/File.HC"$$ instead of A=
* $$SP,B=1$$ instead of $$SP,BI=1$$
* $$CM+LE+RE is nasty
* DCF_TRANSFORMATION|DCF_SYMMETRY|DCF_JUST_MIRROR -- maybe not both needed at once.
* More $LK,"Controls",A="MN:CCtrl"$?
* Compiler: More use of more floating-point stk?
* Compiler: More aggressive in $LK,"CmpF2PushPop",A="MN:CmpF2PushPop"$() with types besides MOV and F64.
* Playing with $LK,"::/Demo/Lectures/NegDisp.HC"$ on $LK,"CTask",A="MN:CTask"$?
$ID,5$$$=-CTASK_NEG_OFFSET
offset(CTask.addr)==0
Spawn(): CAlloc()
TaskDel(): Free()
CSysFixedArea.adam
Looks like task_flags,locked_flags cause problems with neg offset.
$ID,-5$
* Make a game, S.E.T.I., with radio telescope array. Put God on air.
$FG,5$$TX+CX,"Test"$$FG$
* $LK,"SpriteBitMap",A="FI:::/Adam/Gr/SpriteBitMap.HC"$: Grabscroll?
* $LK,"DrvMap",A="MN:DrvMap"$() in $LK,"MountFile",A="MN:MountFile"$().
* Return ress for $LK,"GrBlot",A="MN:GrBlot"$, $LK,"GrRect",A="MN:GrRect"$, $LK,"GrPutChar",A="MN:GrPutChar"$?
* Collision cnts for $LK,"GrBlot",A="MN:GrBlot"$, $LK,"GrRect",A="MN:GrRect"$, $LK,"GrPutChar",A="MN:GrPutChar"$?
* $LK,"GetStr",A="MN:GetStr"$() or $LK,"GetChar",A="MN:GetChar"$() in $LK,"OSInstall",A="FI:::/Misc/OSInstall.HC"$ didn't like focus change.
* Test on Dad's computer or other people's?
* $LK,"ICDivEqu",A="MN:ICDivEqu"$() assumes RBX. Is it okay?
* InFile PopUp of PopUp?
* $LK,"FileMgr",A="MN:FileMgr"$() help link scrolls out of window.
* $LK,"MsHardDrvrInstall",A="MN:MsHardDrvrInstall"$() throws exceptions? Doesn't work? Why mouse $LK,"0x9FC30",A="FF:::/Kernel/SerialDev/Mouse.HC,9FC"$?
* VirtualBox MP reboot?
* Compiler: Err/Warn line nums?
* Asm branch-out-of-range warn by one line?
* Make sure queue links safe in one direction. Task $LK,"QueIns",A="MN:QueIns"$ and $LK,"QueRem",A="MN:QueRem"$ for multicore cycling fwd through tasks.
* Test removable media id and $LK,"RS_ATTR_RESIDENT",A="MN:RS_ATTR_RESIDENT"$. $LK,"Touch",A="MN:Touch"$("","+T");
$FG,5$$TX+CX,"Uncategorized"$$FG$
* DiskCache during FileRead. <CTRL-ALT-c>, $LK,"Kill",A="MN:Kill"$().
* MOV U8 [RSP+RCX],DL
* $LK,"gr.scrn_image",A="MN:CGrGlbls"$
>Might want to do ZOOM in U8 graphics and convert scrn capture to U8
>Might want to rev bit order
* This $LK,"Fs->catch_except=TRUE",A="FF:::/Kernel/Job.HC,Fs->catch_except=TRUE"$ causes problems because it
catches divide and out-of-mem. Not sure what to do, yet.
* Release semaphores or break lock sema,usb_td
* Might make CSprite flood fill operate on a separate bitmap
and blotted at the end.
* <CTRL-r> delete subsprite in menu near others
* make better heapwalk, do something with $LK,"_CFG_HEAP_DBG",A="FF:::/Kernel/KernelA.HH,_CFG_HEAP_DBG"$.
* static var off of data heap.
* could add "const" to not set CCF_NOT_CONST flag for trig, etc.
* could make glblvar imports use MDF_RIP_DISP32.
* PUSH_CMP allocs reg R9 or whatever
* Might be problem with NOP in OPT pass1 for NO_PUSH in expressions besides
assignments. Is ShiftNoPush fully implemented?
$FG,5$$TX+CX,"Bible Passages"$$FG$
It is love I desire $TX,"Hosea 6:6",HTML="http://www.biblegateway.com/verse/en/Hosea%206:6"$
Males appear three times, not empty $TX,"Deuteronomy 16:16",HTML="http://www.biblegateway.com/verse/en/Deuteronomy%2016:16"$
Offer a sacrifice of praise $TX,"Hebrews 13:15",HTML="http://www.biblegateway.com/verse/en/Hebrews%2013:15"$
Do I drink blood of goats? Offer praise $TX,"Psalms 50:14",HTML="http://www.biblegateway.com/verse/en/Psalms%2050:14"$
When a servant becomes king... $TX,"Proverb 30:22",HTML="http://www.biblegateway.com/verse/en/Proverb%2030:22"$
Runner's stride $TX,"Psalms 147:10",HTML="http://www.biblegateway.com/verse/en/Psalms%20147:10"$
Buckling armor $TX,"1 Kings 20:11",HTML="http://www.biblegateway.com/verse/en/1%20Kings%2020:11"$
Lot cast in the lap $TX,"Proverbs 16:33",HTML="http://www.biblegateway.com/verse/en/Proverbs%2016:33"$
Lord does not repeat $TX,"Job 33:14",HTML="http://www.biblegateway.com/verse/en/Job%2033:14"$
Offer only in approved place $TX,"Deuteronomy 12:13-18",HTML="http://www.biblegateway.com/passage/?search=Deuteronomy%2012:13-18&version=NIV"$
Jesus' zeal for the Temple $TX,"John 2:14-19",HTML="http://www.biblegateway.com/passage/?search=John%202:14-19&version=NIV"$
Famine not for bread $TX,"Amos 8:11-12",HTML="http://www.biblegateway.com/passage/?search=Amos%208:11-12&version=NIV"$
To the honest, you are honest $TX,"Psalm 18:26",HTML="http://www.biblegateway.com/verse/en/Psalm%2018:26"$
Meek and humble of heart $TX,"Matthew 11:29",HTML="http://www.biblegateway.com/verse/en/Matthew%2011:29"$
Moses gets Aaron $TX,"Exodus 4:10-16",HTML="http://www.biblegateway.com/passage/?search=Exodus%204:10-16&version=NIV"$
There is no council against the Lord $TX,"Proverbs 21:30",HTML="http://www.biblegateway.com/verse/en/Proverbs%2021:30"$
Human help is worthless $TX,"Psalm 108:12",HTML="http://www.biblegateway.com/verse/en/Psalm%20108:12"$
Do not seek your own wealth $TX,"1 Corinthians 10:24",HTML="http://www.biblegateway.com/verse/en/1%20Corinthians%2010:24"$
Abundance of Spirits $TX,"1 Corinthians 14:12",HTML="http://www.usccb.org/bible/1corinthians/14:12"$
The stone rejected is cornerstone $TX,"Matthew 21:42",HTML="http://www.biblegateway.com/verse/en/Matthew%2021:42"$
Egypt rise like flood $TX,"Jeremiah 46:7-8",HTML="http://www.biblegateway.com/passage/?search=Jeremiah%2046:7-8&version=NIV"$
New wineskins $TX,"Mark 2:22",HTML="http://www.biblegateway.com/verse/en/Mark%202:22"$
Thousand songs of Solomon $TX,"1 Kings 4:32",HTML="http://www.biblegateway.com/passage/?search=1%20Kings%204:32&version=NIV"$
Not rich, nor poor, but my portion $TX,"Proverbs 30:8",HTML="http://www.biblegateway.com/verse/en/Proverbs%2030:8"$
Be hot or cold. Lukewarm I spit you out $TX,"Revelation 3:16",HTML="http://www.biblegateway.com/verse/en/Revelation%203:16"$
$FG,5$$TX+CX,"Misc Notes"$$FG$
Erik van der Karbargenbok: $LK,"TempleBot",A="PI:~/Sup1/Sup1Bin/TempleBot"$.
Intel CEO's name: Brian Krzanich
>$FG,2$lspci -v$FG$
Size:$TX,"17378KB",D="DD_TEMPLEOSCD_K_SIZE"$
$FG,5$$TX+CX,"My Web Bookmarks"$$FG$$WW,0$
$TX,"My FireFox Bookmarks",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/Bookmarks"$
Machine $HC,"<center><img src=\"http://www.templeos.org/images/Machine.jpg\" width=\"600\" height=\"400\" alt=\"\"></center>"$
Frosting $HC,"<center><img src=\"http://www.templeos.org/images/Frosting.jpg\" width=\"600\" height=\"400\" alt=\"\"></center>"$
Soap Carvings $HC,"<center><img src=\"http://www.templeos.org/images/SoapCarvings.jpg\" width=\"640\" height=\"480\" alt=\"\"></center>"$
CottonTail $HC,"<center><img src=\"http://www.templeos.org/images/CttnTail.jpg\" width=\"644\" height=\"1113\" alt=\"\"></center>"$
TempleOS Logo $HC,"<center><img src=\"http://www.templeos.org/images/Logo128x152.jpg\" width=\"640\" height=\"760\" alt=\"\"></center>"$
T-Shirts & Mug $HC,"<img src=\"http://www.templeos.org/Wb/Home/Web/Imgs/Gear2387x2849.jpg\" width=\"477\" height=\"569\" alt=\"\">"$
Pew Pew Pew $HC,"<center><img src=\"http://i.imgur.com/sMpJ0ch.jpg\" width=\"640\" height=\"480\" alt=\"\"></center>"$
Iceberg $HC,"<center><img src=\"https://upload.wikimedia.org/wikipedia/commons/3/38/Blue_ice_in_South_Greenland_-_Visit_Greenland.jpg\" width=\"640\" height=\"480\" alt=\"\"></center>"$
I made dis $HC,"<center><img src=\"http://i.imgur.com/cZKkxTX.jpg\" width=\"640\" height=\"800\" alt=\"\"></center>"$
NIST Beacon $HC,"<center><img src=\"http://www.nist.gov/itl/csd/ct/images/beacon_architecture_2013.jpg\" width=\"550\" height=\"278\" alt=\"\"></center>"$
Purple Frog $HC,"<center><img src=\"https://s-media-cache-ak0.pinimg.com/736x/fb/08/2a/fb082a53bd798f5957a474ff9095e6d4.jpg\" width=\"640\" height=\"420\" alt=\"\"></center>"$
Casino (Dog) $HC,"<center><img src=\"http://www.templeos.org/images/Dog1855x1056.jpg\" width=\"640\" height=\"364\" alt=\"\"></center>"$
Dianna's Cross $HC,"<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fthephysicsgirl%2Fposts%2F1133902680027666&width=500\" width=\"500\" height=\"671\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>"$
$TX,"SimStructure",HTML="http://www.templeos.org/files/SimStrSetUp.zip"$
$TX,"ASU_Transcripts",HTML="http://www.templeos.org/files/ASU_Transcripts.pdf"$ $TX,"ASU Course Catalog (See page 261)",HTML="https://catalog.asu.edu/files/shared/archives/1994-1996/general/UG1994-1996.pdf/1994-1996-UG-241-267.pdf"$
$TX,"Dr. David Pheanis",HTML="https://webapp4.asu.edu/directory/person/77201"$ $TX,"Dr. Konstantinos S. Tsakalis",HTML="http://ecee.engineering.asu.edu/directory/tenured-and-tenure-track-faculty/kostantinos-s-tsakalis"$ $TX,"Dr. Walter Higgins",HTML="https://webapp4.asu.edu/directory/directorysearch?cn=Walter+Higgins"$
$TX,"Peter Gadwa",HTML="http://www.wired.com/magazine/2010/11/mf_ticketmaster/all/1"$ $TX,"Ticketmaster",HTML="http://www.nytimes.com/1994/11/06/business/ticketmaster-s-mr-tough-guy.html?pagewanted=a"$
$TX,"Tom Foley",HTML="http://web.gccaz.edu/~tfoley/perspage.html"$
$TX,"Graphic Technologies",HTML="https://web.archive.org/web/20020811060541/http://www.graphic-technologies.com/"$ $TX,"Lexmark vs Static Control",HTML="https://en.wikipedia.org/wiki/Lexmark_International,_Inc._v._Static_Control_Components,_Inc."$
$TX,"Stephen Davis",HTML="https://photos.google.com/share/AF1QipM4HI3mb_9qe8wDQ--nRfjIzOKyGG8heqWH-tbGBIIoxChWe4GeBegNzgHRy4Z1Qw?key=eGR0R0tyZG5tenRWd0tDN2RHRFRNTmI4NXdhc25B"$
3qEeEGCAsBABAqFDBeE2G33qEeEGCAsBABAqFDBeE2G33qCsBDBDq2G3s2G3F2G3FqAet2G32G3AEDAqF3qCsBDBDq2G3s2G3F2G3FqAet2G32G3AEDAqF
qFeDAsBDeDqCeF2G3sGGeF2sG3C2G3CBCeF
$FG,5$$TX+CX,"Web Bookmarks"$$FG$
Cop tying shoe $HC,"<center><img src=\"https://goodtimestories.files.wordpress.com/2013/04/cop-tying-shoe-cambridge-county-pd.jpg\" width=\"480\" height=\"376\" alt=\"\"></center>"$
$TX,"Unikernels",HTML="https://ma.ttias.be/what-is-a-unikernel"$
$TX,"Handford school",HTML="https:/pinterest.com/pin/255368241346360278"$
$TX,"Look at PCI interrupt routing.",HTML="http://forum.osdev.org/viewtopic.php?f=1&t=29558"$
$TX,"The sins of Newton",HTML="https://www.brainpickings.org/2012/01/04/isaac-newton-list-of-sins"$
$TX,"Stalin's Tanks",HTML="https://boardgamegeek.com/boardgame/5198/stalins-tanks"$
$TX,"Wisdom for the Way",HTML="https://www.amazon.com/Wisdom-Way-Wise-Words-People/dp/1404113258#reader_1404113258"$
$TX,"Lamp shades",HTML="http://www.lampsplus.com/products/lamp-shades"$
$TX,"The Original Jewish Temple",HTML="http://www.jewishvirtuallibrary.org/jsource/Judaism/The_Temple.html"$
$TX,"Top 1000 Movies",HTML="http://www.theyshootpictures.com/gf1000_all1000films.htm"$
$TX,"KingJamesBible with LineNums",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.TXT"$
$TX,"Higgs 5-Sigma Proof",HTML="http://understandinguncertainty.org/explaining-5-sigma-higgs-how-well-did-they-do"$
$TX,"The Number Bleem",HTML="http://www.strangehorizons.com/2000/20001120/secret_number.shtml"$
$TX,"Dwight: Nerd torture",HTML="http://www.noob.us/humor/the-office-dwight-faces-nerd-torture-of-the-highest-form"$
$TX,"TOSZ Compression",HTML="http://www.templeos.org/Wb/Linux/TOSZ.CPP"$
$TX,"ATA/ATAPI spec",HTML="http://www.t13.org/Documents/UploadedDocuments/docs2007/D1532v1r4b-AT_Attachment_with_Packet_Interface_-_7_Volume_1.pdf"$
$TX,"Patton Prayer",HTML="http://www.pattonhq.com/prayer.html"$
$TX,"Streaming Terry A. Davis",HTML="https://www.youtube.com/channel/UCdX4uJUwSFwiY3XBvu-F_-Q/live"$
$TX,"Bleem",HTML="http://strangehorizons.com/fiction/the-secret-number/"$
$TX,"WWW.OSDEV.ORG",HTML="http://www.osdev.org"$
$TX,"NIST Beacon",HTML="http://www.nist.gov/itl/csd/ct/nist_beacon.cfm"$
$TX,"The Perfect Coin Toss",HTML="http://hackaday.com/2014/12/19/nist-randomness-beacon"$
$TX,"BBC",HTML="http://www.knpr.org"$
$TX,"KNPR",HTML="http://www.knpr.org"$
$TX,"BBC_News_24",HTML="http://www.wherever.tv/tv-channels/BBC-News-24.jsf"$
$TX,"BBC_Five_Live",HTML="http://www.bbc.co.uk/radio/player/bbc_radio_five_live"$
$TX,"CBS News",HTML="http://www.cbsnews.com/live/?ftag= NM14632fc"$
$TX,"C64 Users Guide",HTML="http://www.commodore.ca/manuals/c64_users_guide/c64-users_guide.htm"$
$TX,"Mapping the Commodore 64",HTML="http://unusedino.de/ec64/technical/project64/mapping_c64.html"$
$TX,"C64 Programmers Reference Guide",HTML="http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference.htm"$
$TX,"8-Bit Pixel Art",HTML="http://8bitdecals.com/8-bit-image-gallery"$
$TX,"8-Bit Japanese Pixel Art",HTML="http://designmadeinjapan.com/magazine/illustration-icon/tumblr-gifs-of-japanese-life"$
+74
View File
@@ -0,0 +1,74 @@
$TR-UL,"Adam"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0xFF;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=5.020;
$ID,-2$$TR,"InsReg"$
$ID,2$#help_index "Registry/Install Registration"
MemSet(&ins_reg,0,sizeof(CInsReg));
ins_reg.registered=1;
ins_reg.host_os=2;
ins_reg.host_vm=2;
#define INS_REG_PERSONAL_INITIALS "TAD"
StrCpy(ins_reg.initials,"TAD");
HashPublic("INS_REG_PERSONAL_INITIALS",HTT_DEFINE_STR);
#define INS_REG_MACHINE_NUM 0
ins_reg.machine_num=0;
HashPublic("INS_REG_MACHINE_NUM",HTT_DEFINE_STR);
"InsReg:%s:%d\n",INS_REG_PERSONAL_INITIALS,INS_REG_MACHINE_NUM;
#help_index ""
$ID,-2$$ID,-2$$TR-UL,"TempleOS"$
$ID,2$$TR,"EagleDive"$
$ID,2$F64 best_score=147.6932;
$ID,-2$$TR,"DiningStars"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"CircleTrace"$
$ID,2$F64 best_score=4.9425;
$ID,-2$$TR,"TOSNIST"$
$ID,2$I64 tos_nist_offset=-8049;
$ID,-2$$TR,"BlackDiamond"$
$ID,2$I64 best_score=1;
$ID,-2$$TR,"DunGen"$
$ID,2$F64 best_score=20.5295;
$ID,-2$$TR,"CastleFrankenstein"$
$ID,2$F64 best_score=33.8405;
$ID,-2$$TR,"ZoneOut"$
$ID,2$F64 best_score=8.1373;
$ID,-2$$TR,"Varoom"$
$ID,2$F64 best_score=46.2643;
$ID,-2$$TR,"FlapBat"$
$ID,2$F64 best_score=16.3077;
$ID,-2$$TR,"RawHide"$
$ID,2$F64 best_score=96.1279;
$ID,-2$$TR,"KeepAway"$
$ID,2$I64 best_score0=68,best_score1=30;
$ID,-2$$TR,"Wenceslas"$
$ID,2$F64 best_score=43.9944;
$ID,-2$$TR,"BomberGolf"$
$ID,2$I64 best_score=175;
$ID,-2$$TR,"OSTestSuite"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=228.734;
$ID,-2$$TR,"Titanium"$
$ID,2$I64 best_score=16469;
$ID,-2$$TR,"XCaliber"$
$ID,2$I64 best_score=90;
I64 msg_flags=2;
$ID,-2$$TR,"Talons"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"TOSRegen"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=200.498;
$ID,-2$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Adam"$
$ID,2$$ID,-2$$TR,"User"$
$ID,2$$ID,-2$$ID,-2$$TR,"DemoCompany"$
$ID,2$$TR,"Game1"$
$ID,2$F64 best_score=1735.08564;
$TR,"SimpleVal"$
$ID,2$1236;
$ID,-2$$ID,-2$$ID,-2$
@@ -0,0 +1,13 @@
Cd(__DIR__);;
#include "TOSExt"
#include "TOSCfg"
#include "TOSMisc"
#include "TOSToHtml"
#include "TOSDistro"
#include "TOSBlog"
#include "TOSNIST"
#include "TOSHolySpirit"
#include "TOSIns"
Cd("..");;
+126
View File
@@ -0,0 +1,126 @@
#help_index "Misc/Blog"
public U8 *BlogLocalDir(CDate cdt=0)
{//MAlloc dirname of blog for date.
static U8 dir[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
Date2Struct(&ds,cdt);
StrPrint(dir,BLOG_LOCAL_BASE "/%d%Z",ds.year,ds.mon-1,"ST_MONTHS");
if (!FileFind(dir,,FUF_JUST_DIRS))
MkDir(dir);
return dir;
}
public U8 *BlogLocalFile(CDate cdt=0)
{//MAlloc filename of blog for date.
static U8 file[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
Date2Struct(&ds,cdt);
StrPrint(file,"%s/" INS_REG_PERSONAL_INITIALS "%02d%02d%02d.DD.Z",
BlogLocalDir(cdt),ds.year%100,ds.mon,ds.day_of_mon);
return file;
}
public U8 *BlogWebDir(CDate cdt=0)
{//MAlloc D:/Wb/dirname of blog for date.
static U8 dir[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
Date2Struct(&ds,cdt);
StrPrint(dir,BLOG_WEB_BASE "/%d%Z",
ds.year,ds.mon-1,"ST_MONTHS");
return dir;
}
public U8 *BlogWebFile(CDate cdt=0)
{//MAlloc D:/Wb/filename of blog for date.
static U8 file[STR_LEN];
CDateStruct ds;
if (!cdt) cdt=Now+local_time_offset;
Date2Struct(&ds,cdt);
StrPrint(file,"%s/" INS_REG_PERSONAL_INITIALS "%02d%02d%02d.DD.Z",
BlogWebDir(cdt),ds.year%100,ds.mon,ds.day_of_mon);
return file;
}
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
{//Cnt files in a mask. Create next filename.
CDirEntry *tmpde=FilesFind(files_find_mask);
U8 *res=MStrPrint(fmt,FileCnt(tmpde));
DirTreeDel(tmpde);
return res;
}
public U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
{//Add dc to blog as BMP file.
U8 file_mask[STR_LEN],file_name[STR_LEN],*st1,*st2;
if (!cdt) cdt=Now+local_time_offset;
StrPrint(file_mask,"%s/Img*",BlogLocalDir(cdt));
StrPrint(file_name,"%s/Img%%03d.BMP",BlogLocalDir(cdt));
st1=FileNameNumNext(file_mask,file_name);
st2=MStrPrint("http://www.templeos.org/Wb%s",st1+2);
BMPWrite(st1,dc);
Free(st1);
"$$HC,\"<img src=\\\"%s\\\" width=\\\"%d\\\" "
"height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",st2,dc->width,dc->height;
Free(st2);
}
public U0 BlogScrnShot()
{//Add scrn shot to blog as BMP file.
Bool old_cursor=DocCursor,old_silent;
CDC *dc1,*dc2;
U8 *old_fp_draw_ms=gr.fp_draw_ms;
gr.fp_draw_ms=NULL;
Refresh(2);
dc1=DCScrnCapture;
dc2=DCExt(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
BlogDCImgWrite(dc2);
gr.fp_draw_ms=old_fp_draw_ms;
DCDel(dc1);
DCDel(dc2);
DocCursor(old_cursor);
old_silent=Silent;
FreshenBlog;
Silent(old_silent);
}
public U0 FreshenBlog()
{//Regen html files for D:/Home/Web.
MkDir("D:/Wb");
MkDir("D:/Wb/Home");
MkDir("D:/Wb/Home/Web");
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS);
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS "/BlogDir");
FreshenWebDir("/Home/Web");
FreshenWebDir("/Home/Web/" INS_REG_PERSONAL_INITIALS);
FreshenWebDir(BlogLocalDir+2);
Drv('C');
}
public U0 Blog(Bool god_misc2=FALSE)
{//Make entry in blog.
if (!FileFind(BlogLocalFile,,FUF_JUST_FILES))
Copy("~/Web/" INS_REG_PERSONAL_INITIALS "/DailyBlogHeader.DD.Z",
BlogLocalFile);
AutoComplete;
WinBorder;
WinMax;
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN|SCF_CTRL);
if (god_misc2)
Msg(MSG_KEY_DOWN_UP,0,SC_F7|SCF_SHIFT|SCF_ALT);
else {
Msg(MSG_KEY_DOWN_UP,0,SC_F6|SCF_ALT);
Msg(MSG_KEY_DOWN_UP,'\n',0);
}
if (Ed(BlogLocalFile,EDF_WAS_WRITE)) {
DocOpt(BlogLocalFile,"-r");
Copy(BlogLocalFile,"::" DAILY_BASE ".DD.Z");
Copy(BlogLocalFile,"D:" DAILY_BASE ".DD.Z");
Copy(BlogLocalFile,"D:/Wb" DAILY_BASE ".DD.Z");
TOSWebFile("D:/Wb" DAILY_BASE ".DD.Z");
}
}
+69
View File
@@ -0,0 +1,69 @@
#help_index "Misc/TOS/Cfg"
#define PERSONAL_WEB "http:/" "/www.templeos.org/Wb"
#define BLOG_BASE "/Home/Web/"\
INS_REG_PERSONAL_INITIALS "/BlogDir"
#define DAILY_BASE "/Home/Web/"\
INS_REG_PERSONAL_INITIALS "/DailyBlog"
#define BLOG_LOCAL_BASE "::" BLOG_BASE
#define BLOG_WEB_BASE PERSONAL_WEB BLOG_BASE
#define SLOP BLK_SIZE
U0 TOSDbgDistro1()
{
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
bfh(I64)+=bfh->file_size-1;
DefinePrint("TOS_DBG_DISTRO","0x%X",
CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
DefinePrint("TOS_DBG_DISTRO_END", "0x%X",FloorI64(
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4<<4-
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
DefinePrint("CFG_DBG_DISTRO_FILE","\"/Tmp/DbgDistro.BIN.Z\"");
} TOSDbgDistro1;
U0 TOSDbgDistro2()
{
DefinePrint("CFG_DBG_DISTRO","\"a0x%X\n0x%X\n\"",TOS_DBG_DISTRO,
(TOS_DBG_DISTRO_END-TOS_DBG_DISTRO)/BLK_SIZE);
DefinePrint("CFG_DBG_DISTRO_START","\"0x%X\"",TOS_DBG_DISTRO);
} TOSDbgDistro2;
U0 TOSInit()
{
switch (INS_REG_MACHINE_NUM) {
case 1: //TAD Native Machine
DefinePrint("CFG_RAM_DRVS",
"\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
DefinePrint("CFG_HARD_DRVS","\"C\ns0xFE00\n0xFE10\n0\"");
DefinePrint("CFG_DVD_DRVS","\"Ts0x1F0\n1\"");
DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
DefinePrint("TOS_HDS","\"CD\"");
DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
break;
default:
DefinePrint("CFG_RAM_DRVS",
"\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
DefinePrint("CFG_HARD_DRVS","\"\"");
DefinePrint("CFG_DVD_DRVS","\"\"");
DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
DefinePrint("TOS_HDS","\"CD\"");
DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
}
} TOSInit;
#define TOS_ISO_NAME "B:/TempleOSCD.ISO"
#define TOS_ISO_C_NAME "B:/TempleOSCD.ISO.C"
#define TOS_DISTRO_DIR "B:/Distro"
#define CFG_OPTS "StaffMode\nAutoMountIDE\nCT\n"
#define CFG_DBG_OPTS "StaffMode\nAutoMountIDE\nCT"\
"HeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
#define CFG_DBGZ_OPTS "StaffMode\nAutoMountIDE\nCT"\
"HeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
#define TOS_CFG "\n" CFG_RAM_DRVS CFG_DVD_DRVS CFG_HARD_DRVS "\n"\
CFG_DSK_CACHE CFG_OPTS
#define TOS_DVD_CFG "TB\n0x20000\nT \n\n\nStaffMode\nAutoMountIDE\nCT\n"
#define TOS_DVD_DBG_CFG "A" CFG_DBG_DISTRO\
"B\nScale2Mem(2048,0x40000)\n\n\n"\
"NoMP\nTextMode\nDontProbe\nDbgDistro\n"\
"C:" CFG_DBG_DISTRO_FILE "\n"\
CFG_DBG_DISTRO_START "\n\n"
@@ -0,0 +1,589 @@
//The CFG defines are $LK,"~/TOS/TOSCfg.HC",A="FI:::/Demo/AcctExample/TOS/TOSCfg.HC"$.
#help_index "Misc/TOS/Distro"
#define MAKE_STD 1
#define MAKE_STD_RS 0
#define MAKE_ULTRA 1
#define MAKE_ULTRA_RS 0
#define MAKE_SUP1 1
#define MAKE_WEB 1
#define MAKE_BOOKS1 0
#define MAKE_BOOKS2 0
#define MAKE_DBG 0
#define MAKE_STAFF 1
public U8 TOSGetDrv()
{//Pmt for drv let.
I64 res;
"Drive (%s):",TOS_HDS;
res=Let2Let(GetChar);
'\n';
return res;
}
public U0 TOSBootHDIns(U8 drv_let=0)
{//Make Compiler and Kernel. Reinstall Kernel.
drv_let=Let2Let(drv_let);
In(TOS_CFG);
BootHDIns(drv_let);
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
BootMHDIns(drv_let);
}
public U0 TOSCopyDrv(U8 src,U8 dst)
{//Fmt dst and copy entire drv.
U8 buf_s[STR_LEN],buf_d[STR_LEN];
src=Let2Let(src);
dst=Let2Let(dst);
Fmt(dst,,FALSE,FSt_FAT32);
StrPrint(buf_s,"%c:/",src);
StrPrint(buf_d,"%c:/",dst);
CopyTree(buf_s,buf_d);
DocClear;
Drv(dst);
TOSBootHDIns(dst);
}
public U0 TOSPmtAndCopyDrv()
{//Pmt for drv lets. Then, Fmt dst and copy entire drv.
I64 src,dst;
"$$RED$$\nCopy Src Drive:\n$$FG$$";
src=TOSGetDrv;
"$$RED$$\nCopy Dst Drive:\n$$FG$$";
dst=TOSGetDrv;
TOSCopyDrv(src,dst);
}
U0 DistroSongsPrep(U8 threshold='7')
{
CDoc *doc;
CDocEntry *doc_e;
CDirEntry *tmpde=FilesFind("/Home/Sup1/Sup1Hymns/*.HC*",
FUF_CLUSTER_ORDER),*tmpde1=tmpde;
DelTree("/Apps/Psalmody/Examples");
MkDir("/Apps/Psalmody/Examples");
while (tmpde) {
doc=DocRead(tmpde->full_name);
doc_e=doc->head.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tmpde->full_name,"/Apps/Psalmody/Examples");
DocDel(doc);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
U0 DistroPrep()
{
AOnceFlush; //Don't want in Registry
OnceFlush;
Del("/Home/Demo*");
DelTree("/Home/*Tmp.DD.Z");
if (FileFind("/Home/Sup1/Sup1Hymns"))
DistroSongsPrep;
DelTree("/Tmp");
MkDir("/Tmp");
MkDir("/Tmp/ScrnShots");
Touch("/PersonalMenu.DD.Z","+T");
Touch("/Home/PersonalMenu.DD.Z","+T");
DelTree("/Demo/AcctExample");
CopyTree("/Home","/Demo/AcctExample");
DelTree("/Demo/AcctExample/Budget");
DelTree("/Demo/AcctExample/Private");
DelTree("/Demo/AcctExample/Sup1");
DelTree("/Demo/AcctExample/Books1");
DelTree("/Demo/AcctExample/Books2");
DelTree("/Demo/AcctExample/Web");
Del("/Demo/AcctExample/Test*");
Copy("/Home/Web/index.DD.Z",
"/Demo/ToHtmlToTXTDemo/DemoInPage.DD.Z");
if (FileFind("~/Sup1/Sup1Utils/SortHeaders.HC.Z"))
ExeFile("~/Sup1/Sup1Utils/SortHeaders.HC.Z");
if (FileFind("~/Sup1/Sup1Blog/YouTube.DD.Z"))
Sort("~/Sup1/Sup1Blog/YouTube.DD.Z",,2);
//Once in a while, do ~/Sup1/Sup1Utils/DblSpaceScan.HC.
CursorRem("/*");
DelTree("/Demo/*.BI*");
S2T("/*","+r+S");
DocOpt("/*","+R");
Move(ACD_DEF_FILENAME,ACD_DEF_FILENAME_Z);
}
U0 DbgDistroFilePrep()
{
CBlkDev *bd;
if (!Let2Drv('A',FALSE)) {
In(CFG_DBG_DISTRO "\n");
Mount;
}
bd=Let2BlkDev('A');
Fmt('A',,FALSE,FSt_REDSEA);
MkDir("A:/Compiler");
Copy("C:/Compiler/Compiler.BIN.Z", "A:/Compiler");
Copy("C:/Compiler/OpCodes.DD.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerA.HH.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerB.HH.Z", "A:/Compiler");
MkDir("A:/Kernel");
Copy("C:/Kernel/*.HH*", "A:/Kernel");
CopyTree("C:/Kernel/BlkDev", "A:/Kernel/BlkDev");
Copy("C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z","A:/StartOS.HC.Z");
MkDir("A:/Adam");
Copy("C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z","A:/Adam/MakeAdam.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z","A:/Adam");
Copy("C:/Adam/AExts.HC.Z", "A:/Adam");
Copy("C:/Adam/AMath.HC.Z", "A:/Adam");
Copy("C:/Adam/Training.HC.Z","A:/Adam");
Copy("C:/Adam/AMem.HC.Z", "A:/Adam");
Copy("C:/Adam/TaskRep.HC.Z", "A:/Adam");
FileWrite("C:" CFG_DBG_DISTRO_FILE,
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
}
U0 MakeSymFiles()
{
CDoc *doc;
U8 *st;
DocClear;
DocMax;
HashTablePurge(adam_task->hash_table);
Who;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAlpha.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
DocMax;
Who("+m");
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"D:/Wb/Home/Web/SymsAddress.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
}
I64 MakeLineRepFile()
{
U8 *st;
CDoc *doc;
I64 res,official;
CDocEntry *tree_branch,*start_indent,*end_indent;
DocClear;
Drv('C');
DistroPrep;
Cd("C:/");
DelTree("B:/TOS/TOS");
CopyTree("C:/Home","B:/TOS/TOS");
DelTree("C:/Home");
DocMax;
DocClear;
res=LineRep;
if (doc=DocPut) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,"B:/TOS/TOS/Web/LineRep.DD.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
official=LineRep("C:/*","-r")+
LineRep("C:/Adam/*")+
LineRep("C:/Compiler/*","-S+$$")+
LineRep("C:/Kernel/*");
DocClear;
CopyTree("B:/TOS/TOS","C:/Home");
DelTree("B:/TOS/TOS");
doc=DocRead("C:/Adam/ADefine.HC.Z");
DocTreeFind(doc,"LineRep",&tree_branch,&start_indent,&end_indent);
DocCut(doc,start_indent->next,end_indent->last);
doc->cur_entry=start_indent->next;
doc->cur_col=0;
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",res);
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\");\n",official);
DocWrite(doc);
DocDel(doc);
DefinePrint("DD_TEMPLEOS_LOC","%,d",res);
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","%,d",official);
"Total LOC:%12,d\n\n",res;
return res;
}
U0 StaffDistroPrep()
{
Drv('C');
DistroPrep;
In(TOS_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home/Sup1");
DelTree(TOS_DISTRO_DIR "/Home/Books1");
DelTree(TOS_DISTRO_DIR "/Home/Books2");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
}
U0 MakeStaffDistro()
{
StaffDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_STAFF_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 DbgDistroPrep()
{
Drv('C');
DistroPrep;
DbgDistroFilePrep;
In(TOS_DVD_DBG_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
}
U0 MakeDbgDistro()
{
DbgDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_DBG_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 StdDistroPrep()
{
Drv('C');
DistroPrep;
In(STD_DISTRO_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
}
U0 MakeStdDistro()
{
StdDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 MakeStdRedSeaDistro()
{
StdDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
U0 UltraDistroPrep()
{
StdDistroPrep;
DelTree(TOS_DISTRO_DIR "/Linux");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACDefs.DATA*");
Del(TOS_DISTRO_DIR "/Misc/PCIDevices.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
DelTree(TOS_DISTRO_DIR "/Apps");
MkDir(TOS_DISTRO_DIR "/Apps");
DelTree(TOS_DISTRO_DIR "/Demo");
DelTree(TOS_DISTRO_DIR "/Misc/Tour");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACWords.DATA*");
Del(TOS_DISTRO_DIR "/Adam/God/Vocab.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/OSTestSuite.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/UltraMenu.DD.Z",
TOS_DISTRO_DIR "/PersonalMenu.DD.Z");
Copy("C:/Demo/Games/Talons.HC.Z",
TOS_DISTRO_DIR "/Misc");
}
U0 MakeUltraDistro()
{
UltraDistroPrep;
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_ULTRA_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
U0 MakeUltraRedSeaDistro()
{
UltraDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOS_ULTRA_RS_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
U0 UpdateISODocDefines()
{
try {
#if MAKE_STD
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
#endif
#if MAKE_STD_RS
DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_RS_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024);
#endif
#if MAKE_ULTRA
DefinePrint("DD_TEMPLEOS_ULTRA_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_ULTRA_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
#endif
#if MAKE_ULTRA_RS
DefinePrint("DD_TEMPLEOS_ULTRA_RS_SIZE",
"Download $TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_ULTRA_RS_K_SIZE",
"%dKB",Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024);
#endif
} catch
Fs->catch_except=TRUE;
}
UpdateISODocDefines;
I64 tos_progress;
F64 tos_progress_t0;
U0 TOSProgress(U8 *st)
{
U8 buf[STR_LEN];
progress4=tos_progress;
progress3_max=1;
*progress4_desc=0;
progress4_max=13+MAKE_STD+MAKE_STD_RS+MAKE_ULTRA+MAKE_ULTRA_RS+MAKE_SUP1+
MAKE_WEB+MAKE_BOOKS1+MAKE_BOOKS2+MAKE_DBG+MAKE_STAFF;
progress4_t0=tos_progress_t0;
StrPrint(buf,"%d. %s",++progress4,st);
"$$PURPLE$$$$TX+CX,\"%s\"$$$$FG$$\n",buf;
StrCpy(progress3_desc,buf);
tos_progress=progress4;
}
I64 TOSProfanity()
{
I64 res;
if (res=Profanity(,"D:/Wb/*;"
"!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Blog/Profanity.DD*;"
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*")) {
while (PressAKey!=CH_SHIFT_ESC) {
ProgressBarsRst;
if (Profanity(,"C:/Home/*;"
"!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"
"!*/Books?/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Blog/Profanity.DD*;"
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*")) {
"\n\nEdit profanity and press $FG,2$ESC$FG$.\n";
if (!View)
break;
DocBottom;
} else
break;
}
}
return res;
}
U0 TOSRegen3()
{
I64 slash_home=0;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
tos_progress=-1;
tos_progress_t0=tS;
RegExe("TempleOS/TOSRegen");
TOSProgress("ChkDsk All");
AutoComplete;
WinBorder;
WinMax;
ChkAll;
TOSProgress("Make LineRep");
MakeLineRepFile;
TOSProgress("Copy C to D");
TOSCopyDrv('C','D');
TOSProgress("Del D:/Wb");
DelTree ("D:/Wb");
TOSProgress("Copy C to D:/Wb");
CopyTree("C:/","D:/Wb");
DocClear;
#if MAKE_STD
TOSProgress("Make Standard Distro ISO");
MakeStdDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSCD.ISO");
#endif
#if MAKE_STD_RS
TOSProgress("Make Standard RedSea Distro ISO");
MakeStdRedSeaDistro;
DocClear;
Move(TOS_ISO_C_NAME,"D:/Wb/TempleOSCDRS.ISO");
#endif
#if MAKE_ULTRA
TOSProgress("Make Ultra Distro ISO");
MakeUltraDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSUltra.ISO");
#endif
#if MAKE_ULTRA_RS
TOSProgress("Make Ultra RedSea Distro ISO");
MakeUltraRedSeaDistro;
DocClear;
Move(TOS_ISO_C_NAME,"D:/Wb/TempleOSUltraRS.ISO");
#endif
#if MAKE_DBG
TOSProgress("Make Dbg Distro ISO");
MakeDbgDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSDbg.ISO");
#endif
#if MAKE_STAFF
TOSProgress("Make Staff Distro ISO");
MakeStaffDistro;
DocClear;
Move(TOS_ISO_NAME,"D:/Wb/TempleOSStaff.ISO");
#endif
#if MAKE_SUP1
TOSProgress("Make Supplemental #1 ISO");
RedSeaISO("D:/Wb/TempleOSSup1","C:/Home/Sup1");
#endif
#if MAKE_WEB
TOSProgress("Make www.templeos.org ISO");
RedSeaISO("D:/Wb/TempleOSWeb","C:/Home/Web");
#endif
#if MAKE_BOOKS1
TOSProgress("Make Books #1 ISO");
RedSeaISO("D:/Wb/TempleOSBooks1","C:/Home/Books1");
#endif
#if MAKE_BOOKS2
TOSProgress("Make Books #2 ISO");
RedSeaISO("D:/Wb/TempleOSBooks2","C:/Home/Books2");
#endif
UpdateISODocDefines;
Cd("C:/");
DocClear;
TOSProgress("Check for Long Lines");
if (LongLines)
throw;
DocClear;
TOSProgress("Check for Broken DolDoc Links");
if (LinkChk)
throw;
DocClear;
TOSProgress("Make Symbol Files");
MakeSymFiles;
DocClear;
TOSProgress("Freshen WebSite");
FreshenSite;
DocClear;
TOSProgress("Check WebSite for Profanity");
if (TOSProfanity)
throw;
TOSProgress("Find /Home");
slash_home=F2("/Home","-i+la");
TOSProgress("ChkDsk All");
Drv('C');
ChkAll;
TOSProgress("Done");
SettingsPop;
"F2(\"/Home\") Cnt\t:%d\n",slash_home;
"Elapsed Time\t:%5.3fs\n",tS-progress4_t0;
ProgressBarsRst("TempleOS/TOSRegen");
}
public U0 TOSPreRegen()
{//Copy bookmarks and bins from D:/Home/Sup1 to C:/Home/Sup1
Copy("D:/Home/Sup1/Sup1Blog/Bookmarks.html","C:/Home/Sup1/Sup1Blog");
Del("C:/Home/Sup1/Sup1Bin/*");
Copy("D:/Home/Sup1/Sup1Bin/*","C:/Home/Sup1/Sup1Bin");
Copy("D:/Home/Sup1/Sup1Bin/God*","C:/Linux");
}
U0 TOSRegen2()
{
TOSChgLog; //$LK,"::/Doc/ChgLog.DD"$ datetime matches Kernel $LK,"sys_compile_time",A="MN:sys_compile_time"$.
TOSBootHDIns('C');
Once("TOSRegen3;");
BootRAM("C:/Kernel/" KERNEL_BIN_C); //Boot new Kernel and Compiler.
}
public U0 TOSRegen()
{//Generate distro ISO's and website image, D:/Wb.
TOSBootHDIns('C');
Once("TOSRegen2;");
BootRAM("C:/Kernel/" KERNEL_BIN_C); //Boot to load $LK,"TOS_CFG",A="PF:::/Demo/AcctExample/TOS/TOSCfg.HC,TOS_CFG"$.
}
+264
View File
@@ -0,0 +1,264 @@
#help_index "Misc/TOS/God;God/TOS"
#define NIST_TIME_OFFSET (tos_nist_offset-local_time_offset/CDATE_FREQ)
#define NIST_TIME_TO_SWITCH 3
#define GSRC_NIST_BEACON 0
#define GSRC_HOTBITS 1
#define GSRC_ANU_NIST 2
#define GSRC_RANDOM_ORG 3
#define GSRC_RANDOM_NUMBERS_INFO 4
#define GSRC_PASSWORD 5
#define GSRC_GENERATE_DATA 6
#define GSRC_VIRTUAL_NOTARY 7
#define GSRC_TIMER 8
#define GBP_SHORT 0
#define GBP_MEDIUM 1
#define GBP_LONG 2
class CRandExtDec5Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,A=\"5 Decimal Digits from Hex:%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CHexWordForm
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,A=\"Hex Word Indices#0:%s\"$$\n";
U8 rnd1[512] fmtstr "$$DA-P,A=\"Hex Word Indices#1:%s\"$$\n";
U8 rnd2[512] fmtstr "$$DA-P,A=\"Hex Word Indices#2:%s\"$$\n";
U8 rnd3[512] fmtstr "$$DA-P,A=\"Hex Word Indices#3:%s\"$$\n";
U8 rnd4[512] fmtstr "$$DA-P,A=\"Hex Word Indices#4:%s\"$$\n";
U8 rnd5[512] fmtstr "$$DA-P,A=\"Hex Word Indices#5:%s\"$$\n";
U8 rnd6[512] fmtstr "$$DA-P,A=\"Hex Word Indices#6:%s\"$$\n";
U8 rnd7[512] fmtstr "$$DA-P,A=\"Hex Word Indices#7:%s\"$$\n";
U8 rnd8[512] fmtstr "$$DA-P,A=\"Hex Word Indices#8:%s\"$$\n";
U8 rnd9[512] fmtstr "$$DA-P,A=\"Hex Word Indices#9:%s\"$$\n";
U8 rndA[512] fmtstr "$$DA-P,A=\"Hex Word Indices#A:%s\"$$\n";
U8 rndB[512] fmtstr "$$DA-P,A=\"Hex Word Indices#B:%s\"$$\n";
I64 cert;
};
class CNISTBeaconHexWordForm
{
I64 timestamp fmtstr "$$DA,A=\"TimeStamp:%d\"$$\n";
U8 rnd0[512] fmtstr "$$DA-P,A=\"Hex Word Indices#0:%s\"$$\n";
U8 rnd1[512] fmtstr "$$DA-P,A=\"Hex Word Indices#1:%s\"$$\n";
U8 rnd2[512] fmtstr "$$DA-P,A=\"Hex Word Indices#2:%s\"$$\n";
U8 rnd3[512] fmtstr "$$DA-P,A=\"Hex Word Indices#3:%s\"$$\n";
U8 rnd4[512] fmtstr "$$DA-P,A=\"Hex Word Indices#4:%s\"$$\n";
U8 rnd5[512] fmtstr "$$DA-P,A=\"Hex Word Indices#5:%s\"$$\n";
U8 rnd6[512] fmtstr "$$DA-P,A=\"Hex Word Indices#6:%s\"$$\n";
U8 rnd7[512] fmtstr "$$DA-P,A=\"Hex Word Indices#7:%s\"$$\n";
U8 rnd8[512] fmtstr "$$DA-P,A=\"Hex Word Indices#8:%s\"$$\n";
U8 rnd9[512] fmtstr "$$DA-P,A=\"Hex Word Indices#9:%s\"$$\n";
U8 rndA[512] fmtstr "$$DA-P,A=\"Hex Word Indices#A:%s\"$$\n";
U8 rndB[512] fmtstr "$$DA-P,A=\"Hex Word Indices#B:%s\"$$\n";
I64 cert;
};
class CRandHex5Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P-TRM,LEN=5,"
"A=\"Line (5-Digit Hex):%5s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CRandHex8Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P-TRM,LEN=8,"
"A=\"Line (8-Digit Hex):%8s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CMoviesForm
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,"
"A=\"Movie #1-100 (2 Decimal Digits from Hex):%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CPaintings100Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,"
"A=\"Painting #00-99 (2 Decimal Digits from Hex):%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CPaintings1000Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,"
"A=\"Painting #000-999 (3 Decimal Digits from Hex):%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CMetallicaForm
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,"
"A=\"Song #1-99 (2 Decimal Digits from Hex):%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert;
};
class CCertRandDec5Form
{
I64 timestamp;
U8 rnd0[512] fmtstr "$$DA-P,A=\"Line (Dec):%s\"$$\n";
U8 rnd1[512];
U8 rnd2[512];
U8 rnd3[512];
U8 rnd4[512];
U8 rnd5[512];
U8 rnd6[512];
U8 rnd7[512];
U8 rnd8[512];
U8 rnd9[512];
U8 rndA[512];
U8 rndB[512];
I64 cert fmtstr "$$DA,A=\"Certificate:%d\"$$\n";
};
class CGodVideoForm
{
U8 title[STR_LEN] fmtstr "$$DA-P,A=\"Title:%s\"$$\n";
U8 serial[STR_LEN] fmtstr "$$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$$\n";
I64 min fmtstr "$$DA,A=\"Minutes:%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Seconds:%d\"$$\n";
};
class CWebBibleForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"Bible Passage:%s\"$$\n";
I64 min;
I64 sec;
};
class CYouTubeForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Title:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P-TRM,LEN=11,A=\"SerialNum:%11s\"$$\n";
I64 min fmtstr "$$DA,A=\"Minutes:%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Seconds:%d\"$$\n";
};
class CImgurForm
{
U8 tag[STR_LEN];
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"SerialNum:%s\"$$\n";
I64 min fmtstr "$$DA,A=\"Width :%d\"$$\n";
I64 sec fmtstr "$$DA,A=\"Height :%d\"$$\n";
};
class CWikipediaForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN] fmtstr "$$DA-P,A=\"Index :%s\"$$\n";
I64 min;
I64 sec;
};
class CWebBookMarkForm
{
U8 tag[STR_LEN] fmtstr "$$DA-P,A=\"Tag Text:%s\"$$\n";
U8 special[STR_LEN];
I64 min;
I64 sec;
};
extern U0 FreshenBlog();
extern U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,
U8 *file_mask="*",I64 len=512,I64 verbosity=GBP_MEDIUM);
extern I64 GodHeaderIns(U8 *type=NULL);
extern U0 GodVideoDigits(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename);
extern U0 GodVideoU32(U32 rand_u32,U8 *filename);
extern U0 GodWebIdx(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
extern U0 GodWordBatch(CHexWordForm *gm);
extern U0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,
I64 radix,Bool modulo,Bool plus_one);
extern U0 TOSGodDoodle(I64 god_src,CNISTBeaconHexWordForm *gm=NULL);
@@ -0,0 +1,682 @@
#help_index "Misc/TOS/God;God/TOS"
U8 *URLPercentSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='%';
*dst++='2';
*dst++='0';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
U8 *URLPlusSpaces(U8 *src)
{
U8 buf[2048],*dst=buf;
while (*src) {
if (*src==CH_SPACE) {
*dst++='+';
src++;
} else
*dst++=*src++;
}
*dst=0;
return StrNew(buf);
}
I64 ExtDecFromHex(U8 *st,I64 digits)
{
I64 res=0,ch;
while (digits) {
if (!(ch=*st++))
break;
if ('0'<=ch<='9') {
res=10*res+ch-'0';
digits--;
}
}
return res;
}
U0 TOSBookLines(U8 *book_filename,I64 book_lines,U8 *st,I64 num_lines,
I64 radix,Bool modulo,Bool plus_one)
{//Radix<0 means extract N dec digits from hex.
CDoc *doc_out,*doc_in;
CDocEntry *doc_e;
I64 i,start;
U8 *verse;
if (*st && (doc_out=DocPut)) {
if (radix<0)
i=ExtDecFromHex(st,-radix);
else
i=Str2I64(st,radix);
if (radix<0)
DocPrint(doc_out,"'%s'-->(Taking first %d decimal digits)",st,-radix);
else if (radix==16)
DocPrint(doc_out,"0x%s-->",st);
if (modulo) {
DocPrint(doc_out,"(%d remainder when divided by %d)",
i,book_lines-(num_lines-1));
start=i%(book_lines-(num_lines-1));
} else {
if (radix>=0 || plus_one)
DocPrint(doc_out,"%d",i);
start=i;
}
if (plus_one) {
start++;
DocPrint(doc_out,"+1");
}
DocPrint(doc_out,"-->Line:%d\n",start);
if (StrMatch("NumBible",book_filename)) {
verse=BibleLine2Verse(start);
DocPrint(doc_out,"$TX,"KingJamesBible",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.TXT"$ (%s)\n\nGod says...\n$$RED$$",verse);
Free(verse);
}
doc_in=DocNew;
BookLines(doc_in,start,num_lines,book_filename);
while (TRUE) {//Del leading blanks
doc_e=doc_in->head.next;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
while (TRUE) {//Del trailing blanks
doc_e=doc_in->cur_entry->last;
if (doc_e==doc_in)
break;
else {
if (doc_e->type_u8==DOCT_NEW_LINE)
DocEntryDel(doc_in,doc_e);
else
break;
}
}
DocPrint(doc_in,"$$FG$$\n");
DocInsDoc(doc_out,doc_in);
DocDel(doc_in);
}
}
public U0 GodBooksPassageU32(U32 rand_u32,U8 *files_find_mask,
U8 *file_mask="*",I64 len=512,I64 verbosity=GBP_MEDIUM)
{//Make God pick a book passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
CDirEntry *tmpde=FilesFind(files_find_mask,
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
*tmpde1,*tmpde2,**tmpde3;
I64 i=0;
U8 *st,*st2=NULL;
tmpde3=&tmpde2;
tmpde2=NULL;
while (tmpde) {
tmpde1=tmpde->next;
if (WildMatch(tmpde->full_name,file_mask)) {
*tmpde3=tmpde;
tmpde3=&tmpde->next;
} else
DirEntryDel(tmpde);
tmpde=tmpde1;
}
*tmpde3=NULL;
if (tmpde=tmpde2) {
while (tmpde) {
st=FileRead(tmpde->full_name);
tmpde->user_data=StrLen(st);
if (verbosity==GBP_LONG)
"%08X-",i;
if (tmpde->user_data>=len)
i+=tmpde->user_data+1-len;
if (verbosity==GBP_LONG)
"%08X:$$LK,\"%s\",A=\"FI:%s\"$$\n",
i-1,tmpde->full_name+2,tmpde->full_name;
Free(st);
tmpde=tmpde->next;
}
if (verbosity==GBP_LONG)
'\n';
if (verbosity>=GBP_MEDIUM)
"%08X*%08X",rand_u32,i;
i*=rand_u32;
if (verbosity>=GBP_MEDIUM)
"=%08X.%08X\n",i.u32[1],i.u32[0];
i=i.u32[1];
tmpde=tmpde2;
while (tmpde) {
if (!st2 && tmpde->user_data>=len) {
i-=tmpde->user_data+1-len;
if (i<0) {
st=FileRead(tmpde->full_name);
st2=st+(tmpde->user_data+1-len)+i;
st2[len]=0;
"%s\nGod says...\n$$RED$$%s$$FG$$\n",tmpde->full_name,st2;
Free(st);
}
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde2);
}
}
U8 *FileDblRead(U8 *filename,I64 line)
{//FileDbl's are DolDoc files with 2-line entries.
U8 *res=NULL;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (DocLineNumGoTo(doc,line-1) && doc->cur_entry->type_u8==DOCT_TEXT)
res=StrNew(doc->cur_entry->tag);
DocDel(doc);
return res;
}
U8 *FileDblWrite(U8 *filename,I64 line,U8 *st)
{//FileDbl's are DolDoc files with 2-line entries.
U8 *res=NULL;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (DocLineNumGoTo(doc,line-1)) {
if (doc->cur_entry->type_u8==DOCT_TEXT) {
Free(doc->cur_entry->tag);
doc->cur_entry->tag=StrNew(st);
} else
DocPrint(doc,"%s",st);
DocTop(doc);
DocWrite(doc);
}
DocDel(doc);
return res;
}
U0 GodVideoDigits(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
{
U8 *st,*st2;
CGodVideoForm *gvf=CAlloc(sizeof(CGodVideoForm));
I64 i=ExtDecFromHex(rnd,digits);
if (!i) i=Round(10`digits);
if (st=FileDblRead(filename,i*2)) {
StrCpy(gvf->title,st);
Free(st);
if (!(st=FileDblRead(filename,i*2+1))||!*st) {
Free(st);
if (DocForm(gvf) && *gvf->serial) {
if (gvf->min || gvf->sec)
st=MStrPrint("%s&hl=enUS&start=%d",
gvf->serial,gvf->min*60+gvf->sec);
else
st=StrNew(gvf->serial);
FileDblWrite(filename,i*2+1,st);
} else
st=NULL;
}
"'%s'-->(Taking first %d decimal digits) #%02d\n",rnd,digits,i;
if (StrIMatch("Metallica",filename)) {
st2=URLPlusSpaces(gvf->title+3);
"God's response:\n"
"$$TX,\"%s\",HTML=\"%s\"$$\n"
"$$TX,\"%s (Lyrics)\","
"HTML=\"http://lmgtfy.com/?q=Metallica+lyrics+%s\"$$\n",
title,webpage,gvf->title,st2;
Free(st2);
} else
"God's response:\n"
"$$TX,\"%s\",HTML=\"%s\"$$\n"
"#%s\n",title,webpage,gvf->title;
if (st) {
"$$HC,\"<object width=\\\"640\\\" height=\\\"520\\\">"
"<param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$$\n",st,st;
Free(st);
}
}
Free(gvf);
}
U0 GodVideoU32(U32 rand_u32,U8 *filename)
{
U8 *st,*st2;
I64 i,num;
Bool old_silent=Silent;
num=LineRep(filename,"-S")/2;
Silent(old_silent);
if (num) {
i=rand_u32%num;
if (st=FileDblRead(filename,i*2)) {
st2=FileDblRead(filename,i*2+1);
PutFileLink(filename);
"\nGod's response:\n"
"%08X-->#%d out of %d\n%s\n",rand_u32,i,num,st;
"$$HC,\"<object width=\\\"640\\\" height=\\\"520\\\">"
"<param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$$\n",st2,st2;
Free(st2);
Free(st);
}
}
}
U0 GodWebIdx(U8 *title,U8 *webpage,U8 *rnd,I64 digits,U8 *filename)
{
U8 *st1,*st2;
I64 i=ExtDecFromHex(rnd,digits);
if (!i) i=Round(10`digits);
"'%s'-->(Taking first %d decimal digits) #%02d\n",rnd,digits,i;
st1=FileDblRead(filename,i*2);
st2=FileDblRead(filename,i*2+1);
"God's response:\n";
"$$TX,\"%s\",HTML=\"%s\"$$\n",title,webpage;
PutFileLink(filename);
if (!st1)
"\n$$RED$$God does not want to comment.$$FG$$\n";
else
"\n$$RED$$$$TX,\"%s\",HTML=\"%s\"$$$$FG$$\n",st1,st2;
Free(st1);
Free(st2);
}
U0 GodWordBatch(CHexWordForm *gm)
{//Insert batch of words from rand hex.
I64 i=0;
CDirEntry *tmpde,*tmpde1;
FifoU8Flush(god.fifo);
GodHexIns(gm->rnd0);
GodHexIns(gm->rnd1);
GodHexIns(gm->rnd2);
GodHexIns(gm->rnd3);
GodHexIns(gm->rnd4);
GodHexIns(gm->rnd5);
GodHexIns(gm->rnd6);
GodHexIns(gm->rnd7);
GodHexIns(gm->rnd8);
GodHexIns(gm->rnd9);
GodHexIns(gm->rndA);
GodHexIns(gm->rndB);
tmpde=tmpde1=FilesFind(god.word_file_mask,god.word_fuf_flags);
while (tmpde) {
PutFileLink(tmpde->full_name);
'\n';
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
"\n$$RED$$";
if (*gm->rnd0)
"%s\n",gm->rnd0;
if (*gm->rnd1)
"%s\n",gm->rnd1;
if (*gm->rnd2)
"%s\n",gm->rnd2;
if (*gm->rnd3)
"%s\n",gm->rnd3;
if (*gm->rnd4)
"%s\n",gm->rnd4;
if (*gm->rnd5)
"%s\n",gm->rnd5;
if (*gm->rnd6)
"%s\n",gm->rnd6;
if (*gm->rnd7)
"%s\n",gm->rnd7;
if (*gm->rnd8)
"%s\n",gm->rnd8;
if (*gm->rnd9)
"%s\n",gm->rnd9;
if (*gm->rndA)
"%s\n",gm->rndA;
if (*gm->rndB)
"%s\n",gm->rndB;
'\n';
while (FifoU8Cnt(god.fifo)>20) {
"%02d: ",i++;
GodWord(20,TRUE);
}
FifoU8Flush(god.fifo);
"$$FG$$\n";
}
U0 TOSGodDoodle(I64 god_src,CNISTBeaconHexWordForm *gm=NULL)
{
CDC *dc;
Bool old_silent;
U8 *elems,*hex=CAlloc(sizeof(CNISTBeaconHexWordForm.rnd0)*12);
if (gm) {
StrPrint(hex,"%s%s",gm->rnd0,gm->rnd1);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd2,gm->rnd3);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd4,gm->rnd5);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd6,gm->rnd7);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rnd8,gm->rnd9);
if (god_src==GSRC_NIST_BEACON) {
gm->timestamp=FloorI64(CDate2Unix(Now),60);
if (DocForm(gm(CNISTBeaconHexWordForm *)))
NISTBeaconURL(gm->timestamp);
else
goto gd_done;
}
CatPrint(hex,"%s%s",gm->rndA,gm->rndB);
}
if (elems=GodDoodleSprite(hex)) {
dc=Sprite2DC(elems);
BlogDCImgWrite(dc);
DCDel(dc);
Free(elems);
old_silent=Silent;
FreshenBlog;
Silent(old_silent);
}
gd_done:
Free(hex);
}
I64 GodHeaderIns(U8 *type=NULL)
{
CDateStruct ds;
I64 res;
if (type) {//If NISTBeacon
res=FloorI64(CDate2Unix(Now+2*60*CDATE_FREQ),60);
Date2Struct(&ds,Unix2CDate(res)+local_time_offset+30*CDATE_FREQ);
"Response of %s at %02d:%02d Timestamp:%d.\n\n",type,ds.hour,ds.min,res;
In("%c//Response of %s at %02d:%02d Timestamp:%d.\n\n",
CH_ESC,type,ds.hour,ds.min,res);
}
"$$TX,\"Guidelines for Talking with God.\","
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
return res;
}
U0 TimerGodIns()
{
U8 buf[STR_LEN];
GodHeaderIns;
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
switch (PopUpPickLst("Hex5Bible\0Hex8Books\0Doodle\0Movie100\0Painting100\0"
"Painting1000\0Metallica\0PhysisGirl\0")) {
case:
StrPrint(buf,"%05X",GodBits(5*4));
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
buf,20,16,TRUE,TRUE);
break;
case:
GodBooksPassageU32(GodBits(32),"~/*","C:/Home/Books?/*",,GBP_SHORT);
break;
case:
TOSGodDoodle(GSRC_TIMER);
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodVideoDigits("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
buf,2,"~/Sup1/Sup1Blog/Movies100.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
buf,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
buf,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
break;
case:
StrPrint(buf,"%05X",GodBits(2*5*4)); //Little bit risky if no dec.
GodVideoDigits("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
buf,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
case:
GodVideoU32(GodBits(32),"~/Sup1/Sup1Blog/PhysicsGirl.DD.Z");
break;
}
}
public U0 GodIns()
{//<ALT-F7> Insert misc rand God item into blog.
U8 *st,*tag;
CRandExtDec5Form *gm=CAlloc(sizeof(CRandExtDec5Form));
I64 god_src=PopUpPickLst("NISTBeacon\0HotBits\0ANU_NIST\0Random.org\0"
"RandomNumbers.info\0Password\0GenerateData\0VirtualNotary\0Timer\0");
if (god_src>=GSRC_NIST_BEACON) {
switch (god_src) {
case GSRC_NIST_BEACON:
NISTGodIns1;
break;
start:
case GSRC_HOTBITS:
tag="https://www.fourmilab.ch/hotbits/secure_generate.html";
break;
case GSRC_ANU_NIST:
tag="http://qrng.anu.edu.au/NIST.php";
break;
end:
GodHeaderIns;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
switch (PopUpPickLst("ExtDec5Bible\0LinuxWords\0"
"HappyWords\0Hex5Bible\0Hex8Books\0Doodle\0Movie100\0"
"Painting100\0Painting1000\0Metallica\0PhysicsGirl\0")) {
case:
if (DocForm(gm(CRandExtDec5Form *)))
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
break;
case:
if (DocForm(gm(CHexWordForm *))) {
Adam("GodInit(\"~/Sup1/Sup1Words/LinuxDict.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
Adam("GodInit(\"~/Sup1/Sup1Words/HappyWords.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CHexWordForm *)))
TOSGodDoodle(god_src,gm);
break;
case:
if (DocForm(gm(CMoviesForm *)))
GodVideoDigits("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies100.DD.Z");
break;
case:
if (DocForm(gm(CPaintings100Form *))) {
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
gm->rnd0,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings1000Form *))) {
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
gm->rnd0,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
}
break;
case:
if (DocForm(gm(CMetallicaForm *)))
GodVideoDigits("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
case:
if (DocForm(gm(CRandHex8Form *)))
GodVideoU32(Str2I64(gm->rnd0,16),
"~/Sup1/Sup1Blog/PhysicsGirl.DD.Z");
break;
}
break;
start:
case GSRC_RANDOM_ORG:
tag="http://www.random.org";
break;
case GSRC_RANDOM_NUMBERS_INFO:
tag="http://www.randomnumbers.info";
break;
case GSRC_PASSWORD:
tag="https://passed.pw";
break;
case GSRC_GENERATE_DATA:
break;
end:
GodHeaderIns;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
switch (PopUpPickLst("ExtDec5Bible\0HexWordBatch\0"
"Hex5Bible\0Hex8Books\0Movie100\0Metallica\0PhysicsGirl\0")) {
case:
if (DocForm(gm(CRandExtDec5Form *)))
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
break;
case:
if (DocForm(gm(CHexWordForm *)))
GodWordBatch(gm);
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/Passage.html\"$$\n";
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CMoviesForm *)))
GodVideoDigits("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies100.DD.Z");
break;
case:
if (DocForm(gm(CMetallicaForm *)))
GodVideoDigits("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
break;
case:
if (DocForm(gm(CRandHex8Form *)))
GodVideoU32(Str2I64(gm->rnd0,16),
"~/Sup1/Sup1Blog/PhysicsGirl.DD.Z");
break;
}
break;
case GSRC_VIRTUAL_NOTARY:
GodHeaderIns;
if (DocForm(gm(CCertRandDec5Form *))) {
tag="http://virtual-notary.org";
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
tag="Here is the certificate";
st=MStrPrint("http://www.templeos.org/Certs/virtual-notary-cert"
"-randomnum-%d.p12",gm->cert);
"\n$$TX,\"%$$Q: %d\",HTML=\"%$$Q\"$$.\n",tag,gm->cert,st;
Free(st);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
}
break;
case GSRC_TIMER:
TimerGodIns;
break;
}
}
Free(gm);
}
if (FileFind("~/Sup1/Sup1Words/LinuxDict.TXT"))
GodInit("~/Sup1/Sup1Words/LinuxDict.TXT");
//if (FileFind("~/Sup1/Sup1Words/HappyWords.TXT"))
// GodInit("~/Sup1/Sup1Words/HappyWords.TXT");
+226
View File
@@ -0,0 +1,226 @@
#help_index "Misc/Blog"
U8 *YouTubeGet(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",U8 *needle)
{
I64 i=0,line=I64_MIN;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),
*doc2=DocNew;
U8 *title,*code,*res;
while (DocFind(doc,line,needle)) {
if (!(doc->cur_entry->y&1)) {
title=doc->cur_entry->tag;
DocLineNumGoTo(doc,doc->cur_entry->y+2);
if (doc->cur_entry->type_u8==DOCT_TEXT) {
code=doc->cur_entry->tag;
DocPrint(doc2,"$$MU-UL,\"%s\",LE=0x%X$$\n",title,code);
i++;
}
}
line=doc->cur_entry->y+2;
}
switch (i) {
case 0:
res=NULL;
break;
case 1:
res=StrNew(code);
break;
default:
res=PopUpMenu(doc2);
if (res==DOCM_CANCEL)
res=NULL;
else
res=StrNew(res);
}
DocDel(doc);
DocDel(doc2);
return res;
}
U0 YouTubeAdd(U8 *filename="~/Sup1/Sup1Blog/YouTube.DD.Z",
U8 *title,U8 *code)
{
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
if (!DocFind(doc,,title)) {
DocBottom(doc);
DocPrint(doc,"%s\n%s\n",title,code);
DocTop(doc);
DocWrite(doc);
Sort(filename,,2);
}
DocDel(doc);
}
U8 *WebBookMarks(U8 *filename="~/Sup1/Sup1Blog/Bookmarks.html")
{
U8 *st;
CDocEntry *doc_e;
CDoc *doc=DocNew;
CCmpCtrl *cc=CmpCtrlNew(MStrPrint("#include \"%s\"",filename));
while (Lex(cc))
if (cc->token==TK_STR && *cc->cur_str(U32 *)=='http') {
DocPrint(doc,"$$MU-UL,\"%$$Q\",LE=0x%X$$\n",cc->cur_str,cc->cur_str);
cc->cur_str=NULL;
}
CmpCtrlDel(cc);
if ((st=PopUpMenu(doc))!=DOCM_CANCEL)
st=StrNew(st);
else
st=NULL;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_MENU_VAL)
Free(doc_e->left_exp);
doc_e=doc_e->next;
}
DocDel(doc);
return st;
}
U0 TOSIns()
{
CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));
U8 *tag,*st,*st2;
switch (PopUpPickLst("BiblePassage\0BibleVerse\0"
"YouTube\0Imgur\0Wikipedia\0WebBookMark\0")) {
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint("http://www.biblegateway.com/passage/"
"?search=%s&version=NIV",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MStrPrint(
"http://www.biblegateway.com/verse/en/%s",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CYouTubeForm *))) {
if (*url->special==CH_SPACE)
st2=YouTubeGet(,url->tag);
else
st2=StrNew(url->special);
if (st2 && *st2!=CH_SPACE) {
if (url->min || url->sec)
st=MStrPrint("%s&hl=enUS&start=%d",st2,url->min*60+url->sec);
else
st=StrNew(st2);
if (*url->special!=CH_SPACE && *url->tag)
YouTubeAdd(,url->tag,st);
"$$HC,\"<object width=\\\"640\\\" "
"height=\\\"520\\\"><param name=\\\"movie\\\" "
"value=\\\"http://www.youtube.com/v/%s\\\"></param><param "
"name=\\\"allowscriptaccess\\\" "
"value=\\\"always\\\"></param><embed "
"src=\\\"http://www.youtube.com/v/%s\\\" "
"type=\\\"application/x-shockwave-flash\\\" "
"allowscriptaccess=\\\"always\\\" "
"width=\\\"640\\\" height=\\\"520\\\">"
"</embed></object>\"$$\n",st,st;
Free(st);
Free(st2);
}
}
break;
case:
if (DocForm(url(CImgurForm *))) {
"$$HC,\"<center><img src=\\\"http://i.imgur.com/%s\\\" "
"width=\\\"%d\\\" height=\\\"%d\\\" "
"alt=\\\"\\\"></center>\"$$\n",
url->special,url->min,url->sec;
}
break;
case:
if (DocForm(url(CWikipediaForm *))) {
tag=url->special;
st=MStrPrint("http://en.wikipedia.org/wiki/%s",url->special);
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
case:
if (DocForm(url(CWebBookMarkForm *))) {
tag=st=WebBookMarks;
if (*url->tag)
tag=url->tag;
"$$TX,\"%$$Q\",HTML=\"%$$Q\"$$",tag,st;
Free(st);
}
break;
}
Free(url);
}
#help_index "Misc/TOS/God;God/TOS"
public U0 GodCodeJmp()
{//Jump to rand code in OS. See $LK,"::/Adam/God/HSNotes.DD"$.
CDirEntry *tmpde1=FilesFind("/*",
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
*tmpde=tmpde1;
I64 cnt=0,num;
CDoc *doc;
U8 *st;
while (tmpde) {
doc=DocRead(tmpde->full_name);
tmpde->user_data=doc->head.y;
cnt+=doc->head.y;
DocDel(doc);
tmpde=tmpde->next;
}
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMsEvtTime>>GOD_BAD_BITS);
num=GodBits(GOD_GOOD_BITS)%cnt;
tmpde=tmpde1;
while (tmpde) {
num-=tmpde->user_data;
if (num<0) {
st=MStrPrint("FL:%s,%d",tmpde->full_name,-num);
break;
}
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
Ed(st);
Free(st);
}
U0 GodOffer()
{
switch (PopUpPickLst("MosesComic\0Fiction\0")) {
case:
"---- Moses Comic ---- "
"(Set in the $TX,"Numbers 11",HTML="http://www.biblegateway.com/passage/?search=Numbers%%%%2011&version=NIV"$ "
"part of the story.)\n"
"Moses says, \"\"\n"
"God says, \"\"\n";
break;
case:
"---- $TX,"Collaborative Fiction",HTML="http://en.wikipedia.org/wiki/Collaborative_fiction"$ ----\n"
"Once upon a time ";
break;
}
}
+251
View File
@@ -0,0 +1,251 @@
#help_index "Misc/TOS"
#define VIDEO_FRAME_RATE 29.97
#define FG_JUST_AUDIO 0
#define FG_BOOT_DRV 1
#define FG_RAM_DRV 2
I64 fg_mode=FG_RAM_DRV;
Bool fg_on =FALSE;
U0 FrameGrabberTask(I64)
{//#!/bin/bash
//for f in ./ScrnShots/*.Z; do ./Bin/TOSZ $$f; done
//ffmpeg -r 8 -i VID%05d.BMP -y Movie.avi
I64 frame_num=0;
U8 buf[STR_LEN],buf2[STR_LEN],*st_dir;
F64 end_time=tS;
Silent; //no output to scrn
if (fg_mode==FG_RAM_DRV)
st_dir="B:/Tmp/ScrnShots";
else
st_dir="::/Tmp/ScrnShots";
MkDir(st_dir);
while (fg_on) {
StrPrint(buf,"%s/VID%05d.BMP.Z",st_dir,frame_num++);
StrCpy(buf2,buf);
BMPScrnCapture(buf);
while (TRUE) {
end_time+=1.0/VIDEO_FRAME_RATE;
if (end_time<tS) {
StrPrint(buf,"%s/VID%05d.BMP.Z",st_dir,frame_num++);
Copy(buf2,buf);
} else
break;
}
SleepUntil(cnts.jiffies+(end_time-tS)*JIFFY_FREQ);
}
}
I64 CopyVideo()
{
I64 res=0;
Del("D:/Tmp/*.SND");
if (fg_mode==FG_JUST_AUDIO)
SndFileCreate("D:/Tmp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35,2.5);
else {
SndFileCreate("D:/Tmp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35);
DelTree("D:/Tmp/ScrnShots");
if (fg_mode==FG_RAM_DRV) {
res=CopyTree("B:/Tmp/ScrnShots","D:/Tmp/ScrnShots");
"Unused Space: %12.6fMeg\n",UnusedDrvSpace('B')/1024.0/1024.0;
} else
res=CopyTree("::/Tmp/ScrnShots","D:/Tmp/ScrnShots");
"$$BK,1$$Files Copied:%d$$BK,0$$ Time:%8.3fm\n",
res,res/60.0/VIDEO_FRAME_RATE;
}
return res;
}
public U0 FrameGrabberToggle()
{//The frame grabber saves BMP files to D:/Tmp/ScrnShots.
static F64 last_time=0;
if (tS-last_time>3.0) {
last_time=tS;
if (fg_on) {
fg_on=FALSE;
Snd;
wall->record=snd.record=FALSE;
Sleep(1000);
User("CopyVideo;Exit;\n");
} else {
fg_on=TRUE;
if (fg_mode!=FG_JUST_AUDIO)
Spawn(&FrameGrabberTask,NULL,"Frame Grabber");
wall->record=snd.record=TRUE;
Snd;
}
}
}
public U0 JukeSong(I64 num)
{//Make movie of one song.
AutoComplete;
if (!fg_on)
FrameGrabberToggle;
JukeSongsPuppet("~/Sup1/Sup1Hymns",,num,num+1);
if (fg_on)
FrameGrabberToggle;
}
public U0 JukeLines(I64 start_line,I64 end_line)
{//Make movie of many lines of songs.
AutoComplete;
if (!fg_on)
FrameGrabberToggle;
JukeSongsPuppet("~/Sup1/Sup1Hymns",,start_line*5,end_line*5);
if (fg_on)
FrameGrabberToggle;
}
public U0 ChkAll()
{//ChkDsk on C & D.
U8 *ptr=TOS_HDS;
while (*ptr)
ChkDsk(*ptr++);
}
public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
{//Use OCR to make a text DolDoc from CDC.
U8 byte_bit_cnts[256];
I64 i,j,*ptr,row,col,ch,best_ch,score,best_score,
cur_char_image,diff_image,total_score=0;
CDoc *doc=DocNew;
MemSet(byte_bit_cnts,0,sizeof(byte_bit_cnts));
for (i=0;i<256;i++)
for (j=0;j<7;j++)
if (Bt(&i,j))
byte_bit_cnts[i]++;
for (row=0;row<dc->height/FONT_HEIGHT;row++) {
for (col=0;col<dc->width/FONT_WIDTH;col++) {
cur_char_image=0;
for (i=0;i<FONT_HEIGHT;i++)
for (j=0;j<FONT_WIDTH;j++)
if (GrPeek(dc,col*FONT_WIDTH+j+dx,row*FONT_HEIGHT+i+dy)!=WHITE)
LBts(&cur_char_image,i*8+j);
best_score=I64_MAX;
best_ch=0;
ptr=&text.font[32];
for (ch=32;ch<127;ch++) {
diff_image=*ptr++ ^ cur_char_image;
score=0;
for (i=0;i<8;i++)
score+=byte_bit_cnts[diff_image.u8[i]];
if (score<best_score) {
best_score=score;
best_ch=ch;
}
}
if (best_ch=='$$')
DocPrint(doc,"$$$$");
else
DocPrint(doc,"%c",best_ch);
total_score+=best_score;
}
DocPrint(doc,"\n");
}
if (_total_score) *_total_score=total_score;
return doc;
}
public U0 BMP2Doc(U8 *_in_name,U8 *_out_name=NULL)
{//Use OCR to make a text DolDoc from BMP file.
U8 *in_name,*out_name;
I64 dx,dy,score,best_score=I64_MAX;
CDC *dc;
CDoc *doc;
in_name=DftExt(_in_name,"BMP");
if (_out_name)
out_name=DftExt(_out_name,"DD.Z");
else
out_name=ChgExt(_in_name,"DD.Z");
if (dc=BMPRead(in_name)) {
for (dy=-3;dy<=4;dy++)
for (dx=-3;dx<=4;dx++) {
doc=DC2Doc(dc,dx,dy,&score);
if (score<best_score) {
best_score=score;
StrCpy(&doc->filename.name,out_name);
DocWrite(doc);
}
DocDel(doc);
}
}
Free(in_name);
Free(out_name);
}
U0 TOSTheme()
{
if (!fg_on)
PopUp("Sleep(50);FrameGrabberToggle;");
ExeFile("~/Sup1/Sup1Graphics/TOS/TOSTheme.HC");
DocClear;
}
U0 TOSJukeVideo(I64 start=0,I64 end=10)
{
U8 *buf=FileRead("::/Misc/Bible.TXT.Z"); //Put in cache
Free(buf);
AutoComplete;
FrameGrabberToggle;
JukeSongsPuppet("~/Sup1/Sup1Hymns",,start,end);
FrameGrabberToggle;
}
#define MEM_TEST_SIZE 1024*1024
U0 MemTest()
{
U8 *b;
while (sys_data_bp->alloced_u8s-sys_data_bp->used_u8s>0x1000000) {
b=MAlloc(MEM_TEST_SIZE,Fs->data_heap);
MemSet(b,0x88,MSize(b));
"Data:%X\n",sys_data_bp->alloced_u8s-sys_data_bp->used_u8s;
Yield;
}
while (sys_code_bp->alloced_u8s-sys_code_bp->used_u8s>0x1000000) {
b=MAlloc(MEM_TEST_SIZE,Fs->code_heap);
MemSet(b,0x88,MSize(b));
"Code:%X\n",sys_code_bp->alloced_u8s-sys_code_bp->used_u8s;
Yield;
}
}
public I64 Profanity(
U8 *needle_filename="~/Sup1/Sup1Blog/Profanity.DD.Z",
U8 *files_find_mask="/*",U8 *fu_flags=NULL)
{//Scan for profanity.
CCmpCtrl *cc;
I64 res=0;
if (FileFind(needle_filename)) {
cc=CmpCtrlNew(MStrPrint("#include \"%s\"",needle_filename));
while (Lex(cc))
if (cc->token==TK_IDENT)
res+=Find(cc->cur_str,files_find_mask,fu_flags);
CmpCtrlDel(cc);
}
return res;
}
U0 TOSChgLog2()
{
InStr("\"Ed(\\\"::/Doc/ChgLog.DD.Z\\\");\n\";
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_UP|SCF_CTRL);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,0,SC_CURSOR_DOWN);
Msg(MSG_KEY_DOWN_UP,CH_CTRLY,0);
Msg(MSG_KEY_DOWN_UP,0,SC_F6|SCF_ALT);
Msg(MSG_KEY_DOWN_UP,CH_ESC,0);"
"\"Exit;\n\";");
}
public U0 TOSChgLog()
{//Opdate ChgLog file.
User("TOSChgLog2;\n");
}
+165
View File
@@ -0,0 +1,165 @@
#help_index "Misc/TOS/God;God/TOS"
I64 tos_timestamp=0,tos_type=0;
RegDft("TempleOS/TOSNIST","I64 tos_nist_offset=-8049;\n");
RegExe("TempleOS/TOSNIST");
public I64 CDate2Unix(CDate dt)
{//TempleOS datetime to Unix timestamp.
return ToI64((dt-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET);
}
public CDate Unix2CDate(I64 timestamp)
{//Unix timestamp to TempleOS datetime.
return (timestamp-NIST_TIME_OFFSET)*CDATE_FREQ+Str2Date("1/1/1970");
}
public U0 NISTBeaconSync()
{//Help get local clk in sync with NIST clk.
I64 i,j;
CDate dt;
CDateStruct ds;
while (!ScanChar) {
dt=Now;
Date2Struct(&ds,dt);
i=CDate2Unix(dt);
j=FloorI64(i,60);
"%d %d %02d %02d\n",i,j,ds.sec,(60+ds.sec-(i-j))%60;
Sleep(100);
}
tos_nist_offset=GetI64("tos_nist_offset (%d):",tos_nist_offset);
RegWrite("TempleOS/TOSNIST","I64 tos_nist_offset=%d;\n",tos_nist_offset);
}
U0 NISTBeaconURL(I64 timestamp)
{//Insert NIST Beacon header into blog.
U8 *tag;
CDateStruct ds;
CDate dt=Unix2CDate(timestamp);
Date2Struct(&ds,dt+local_time_offset+30*CDATE_FREQ);
"$$TX,\"NIST Beacon Date:%D Time:%02d:%02d Unix TimeStamp:%u\","
"HTML=\"https://beacon.nist.gov/home\"$$\n",dt,ds.hour,ds.min,timestamp;
tag=MStrPrint("https://beacon.nist.gov/rest/record/%d",timestamp);
"$$TX,\"NIST Beacon Record:%$$Q\",HTML=\"%$$Q\"$$\n",tag,tag;
Free(tag);
}
U0 NISTGodIns1()
{
tos_type=PopUpPickLst("ExtDec5Bible\0LinuxWords\0HappyWords\0"
"Hex5Bible\0Hex8Books\0Doodle\0Movie100\0Painting100\0Painting1000\0"
"Metallica\0PhysicsGirl\0");
switch (tos_type) {
case: tos_timestamp=GodHeaderIns("Bible"); break;
case: tos_timestamp=GodHeaderIns("LinuxWords"); break;
case: tos_timestamp=GodHeaderIns("HappyWords"); break;
case: tos_timestamp=GodHeaderIns("Bible"); break;
case: tos_timestamp=GodHeaderIns("BookPick"); break;
case: tos_timestamp=GodHeaderIns("Doodle"); break;
case: tos_timestamp=GodHeaderIns("Movie100"); break;
case: tos_timestamp=GodHeaderIns("Painting100"); break;
case: tos_timestamp=GodHeaderIns("Painting1000"); break;
case: tos_timestamp=GodHeaderIns("Metallica"); break;
case: tos_timestamp=GodHeaderIns("PhysicsGirl"); break;
}
Once("tos_timestamp=%d;\ntos_type=%d;\n"
"In(\"Blog(TRUE);\n\");",tos_timestamp,tos_type);
}
U0 NISTGodIns2()
{
CRandExtDec5Form *gm=CAlloc(sizeof(CRandExtDec5Form));
gm->timestamp=tos_timestamp;
switch (tos_type) {
case:
if (DocForm(gm(CRandExtDec5Form *))) {
NISTBeaconURL(gm->timestamp);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,-5,FALSE,FALSE);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
Adam("GodInit(\"~/Sup1/Sup1Words/LinuxDict.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
Adam("GodInit(\"~/Sup1/Sup1Words/HappyWords.TXT*\");");
GodWordBatch(gm);
}
break;
case:
if (DocForm(gm(CRandHex5Form *))) {
"$$TX,\"How this random Bible passage was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPassage.html\"$$\n";
NISTBeaconURL(gm->timestamp);
TOSBookLines("~/Sup1/Sup1Blog/NumBible.TXT",ST_BIBLE_LINES,
gm->rnd0,20,16,TRUE,TRUE);
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
"$$TX,\"How this random book pick was chosen.\","
"HTML=\"http://www.templeos.org/Wb"
"/Home/Web/TAD/NISTPick002.html\"$$\n";
NISTBeaconURL(gm->timestamp);
GodBooksPassageU32(Str2I64(gm->rnd0,16),
"~/*","C:/Home/Books?/*");
}
break;
case:
if (DocForm(gm(CHexWordForm *))) {
NISTBeaconURL(gm->timestamp);
TOSGodDoodle(GSRC_NIST_BEACON,gm);
}
break;
case:
if (DocForm(gm(CMoviesForm *))) {
NISTBeaconURL(gm->timestamp);
GodVideoDigits("Top 100 Movies",
"http://www.afi.com/100years/movies10.aspx",
gm->rnd0,2,"~/Sup1/Sup1Blog/Movies100.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings100Form *))) {
NISTBeaconURL(gm->timestamp);
GodWebIdx("Top 100 Paintings",
"http://www.brushwiz.com/most-famous-paintings",
gm->rnd0,2,"~/Sup1/Sup1Blog/Paintings100.DD.Z");
}
break;
case:
if (DocForm(gm(CPaintings1000Form *))) {
NISTBeaconURL(gm->timestamp);
GodWebIdx("Top 1000 Paintings",
"http://en.most-famous-paintings.com/MostFamousPaintings."
"nsf/ListOfTop1000MostPopularPainting",
gm->rnd0,3,"~/Sup1/Sup1Blog/Paintings1000.DD.Z");
}
break;
case:
if (DocForm(gm(CMetallicaForm *))) {
NISTBeaconURL(gm->timestamp);
GodVideoDigits("Metallica Song",
"http://home.hccnet.nl/a.r.adams/lyrics/"
"metallica/songindex.html",
gm->rnd0,2,"~/Sup1/Sup1Blog/Metallica.DD.Z");
}
break;
case:
if (DocForm(gm(CRandHex8Form *))) {
NISTBeaconURL(gm->timestamp);
GodVideoU32(Str2I64(gm->rnd0,16),"~/Sup1/Sup1Blog/PhysicsGirl.DD.Z");
}
break;
}
Free(gm);
}
@@ -0,0 +1,167 @@
$WW,1$$FG,5$$TX+CX,"TOS Staff Policies"$$FG$
* Motto: Run toward bugs, not away from bugs.
* Be Metallica. Use short, sharp, powerful words, as though a song.
* Be careful $FG,2$/Demo/AcctExample$FG$ doesn't get extra files. When you run TOSRegen(), it will copy home files to $FG,2$/Demo/AcctExample$FG$.
* Be careful $FG,2$remote/Wb$FG$ site doesn't get extra files. If you delete or rename a file, also delete the $FG,2$remote/Wb$FG$ file from the site.
$TR,"PreRegen()"$
$ID,2$
Linux: Export Bookmarks to ~/TAD/Home/Sup1/Sup1Blog/Bookmarks.html
Linux: >vm_in
Linux: VMware Machine: "TOS"
{
TempleOS: >TOSPreRegen;
TempleOS: Update Budget
}
$ID,-2$
$TR,"NewRelease(Bool full=FALSE)"$
$ID,2$
if ($FG,2$full$FG$)
]PreRegen()
Linux: VMware Machine:"TOS"
{
TempleOS: >TOSRegen($FG,2$full$FG$);
}
Linux: >vm_out
if ($FG,2$full$FG$) {
Linux: Burn ~/TAD to memory stick.
On other machine {
Linux: Copy ~/TAD from memory stick.
VMware: VMware NewMachine:"TOS", Install TempleOSStaff.ISO
{ //2048 Meg RAM or 57344 Meg RAM
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in VMware.
TempleOS: >TOSRegen;
TempleOS: >#include "::/Misc/OSTestSuite"
TempleOS: >Del("~/Demo*");
}
Linux: >emu_staff_new
Linux: >emu8core or >emu24core
{
TempleOS: $LK,"TOSStaffIns",A="MN:TOSStaffIns"$(); in QEMU.
TempleOS: >TOSRegen;
}
}
}
Linux: CrossFTP sync ~/TAD/Site1/Wb to remote/Wb
if ($FG,2$full$FG$) {
FileZilla
Upload ~/TAD/Site1/index.html to remote/index.html
Upload ~/TAD/Site1/TempleOS.html to remote/TempleOS.html
}
In WebHost FileMgr {
Del {
remote/TempleOSCD.ISO
remote/TempleOSSup1.ISO.C
remote/TempleOSWeb.ISO.C
remote/TempleOSUltra.ISO
}
Copy up one level to remote root {
remote/Wb/TempleOSCD.ISO
remote/Wb/TempleOSSup1.ISO.C
remote/Wb/TempleOSWeb.ISO.C
remote/Wb/TempleOSUltra.ISO
}
}
$ID,-2$
$TR,"NewVersion(Bool full=FALSE)"$
$ID,2$
Increment minor version number.
>$LK,"R",A="MN:R"$("3.12","3.13","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChgLog.DD"$.
]NewRelease(TRUE);
Submit to www.betanews.com.
Send email to MajorGeeks.
if ($FG,2$full$FG$) {
Submit to www.upload.com.
Upload to SourceForge.
}
$ID,-2$
$TR,"NewYearlyVersion()"$
$ID,2$
Increment major version number.
>$LK,"R",A="MN:R"$("3.13","4.00","-i-l"); //Approve by hand.
Add version release notice in $LK,"::/Doc/ChgLog.DD"$.
$LK,"Update ::/Misc/PCIDevices.DD",A="FF:::/Adam/DevInfo.HC,PCIDevFileGen"$
Remove 6 months from bottom of $LK,"::/Doc/ChgLog.DD"$.
]NewVersion(TRUE);
$ID,-2$
* If you change the compiler language syntax, immediately make a ]NewRelease(TRUE).
$FG,5$$TX+CX,"TOS Staff Indoctrination"$$FG$
Make a list of all the ways you make a project scalable. With TempleOS, we scale down, not up, so do we do the opposite of all of them.
How would you improve this $LK,"LZW Compression",A="FI:::/Kernel/Compress.HC"$? We have a 100,000 line of code limit, so it's a trick, thought provoking, question introducing you to our way of thinking.
We hope to define objective metrics so we can simply ask the world to reduce the lines of code and be perfectly objective.
We hope for an objective metric for the compiler, such as how fast it compiles itself (having been compiled by itself). It's a little less elegant, but we actually compile kernel and compiler together all the time with $LK,"TOSBootHDIns",A="FF:::/Demo/AcctExample/TOS/TOSDistro.HC,TOSBootHDIns"$('C'). We have the freedom to change the $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ language, like how I made type-casting post-fix. We need some more limitations on the problem because we don't want a ridiculous language.
Consider these games as the basis of the vector space we wish to span:
$LK,"/Demo/Games/BattleLines.HC",A="FI:::/Demo/Games/BattleLines.HC"$
$LK,"/Demo/Games/BigGuns.HC",A="FI:::/Demo/Games/BigGuns.HC"$
$LK,"/Demo/Games/BlackDiamond.HC",A="FI:::/Demo/Games/BlackDiamond.HC"$
$LK,"/Demo/Games/BomberGolf.HC",A="FI:::/Demo/Games/BomberGolf.HC"$
$LK,"/Demo/Games/CastleFrankenstein.HC",A="FI:::/Demo/Games/CastleFrankenstein.HC"$
$LK,"/Demo/Games/CharDemo.HC",A="FI:::/Demo/Games/CharDemo.HC"$
$LK,"/Demo/Games/CircleTrace.HC",A="FI:::/Demo/Games/CircleTrace.HC"$
$LK,"/Demo/Games/Collision.HC",A="FI:::/Demo/Games/Collision.HC"$
$LK,"/Demo/Games/Digits.HC",A="FI:::/Demo/Games/Digits.HC"$
$LK,"/Demo/Games/DunGen.HC",A="FI:::/Demo/Games/DunGen.HC"$
$LK,"/Demo/Games/ElephantWalk.HC",A="FI:::/Demo/Games/ElephantWalk.HC"$
$LK,"/Demo/Games/FlapBat.HC",A="FI:::/Demo/Games/FlapBat.HC"$
$LK,"/Demo/Games/FlatTops.HC",A="FI:::/Demo/Games/FlatTops.HC"$
$LK,"/Demo/Games/Halogen.HC",A="FI:::/Demo/Games/Halogen.HC"$
$LK,"/Demo/Games/MassSpring.HC",A="FI:::/Demo/Games/MassSpring.HC"$
$LK,"/Demo/Games/Maze.HC",A="FI:::/Demo/Games/Maze.HC"$
$LK,"/Demo/Games/RainDrops.HC",A="FI:::/Demo/Games/RainDrops.HC"$
$LK,"/Demo/Games/RawHide.HC",A="FI:::/Demo/Games/RawHide.HC"$
$LK,"/Demo/Games/Rocket.HC",A="FI:::/Demo/Games/Rocket.HC"$
$LK,"/Demo/Games/RocketScience.HC",A="FI:::/Demo/Games/RocketScience.HC"$
$LK,"/Demo/Games/Squirt.HC",A="FI:::/Demo/Games/Squirt.HC"$
$LK,"/Demo/Games/Talons.HC",A="FI:::/Demo/Games/Talons.HC"$
$LK,"/Demo/Games/TheDead.HC",A="FI:::/Demo/Games/TheDead.HC"$
$LK,"/Demo/Games/TicTacToe.HC",A="FI:::/Demo/Games/TicTacToe.HC"$
$LK,"/Demo/Games/TreeCheckers.HC",A="FI:::/Demo/Games/TreeCheckers.HC"$
$LK,"/Demo/Games/Varoom.HC",A="FI:::/Demo/Games/Varoom.HC"$
$LK,"/Demo/Games/Wenceslas.HC",A="FI:::/Demo/Games/Wenceslas.HC"$
$LK,"/Demo/Games/Whap.HC",A="FI:::/Demo/Games/Whap.HC"$
$LK,"/Demo/Games/Zing.HC",A="FI:::/Demo/Games/Zing.HC"$
$LK,"/Demo/Games/ZoneOut.HC",A="FI:::/Demo/Games/ZoneOut.HC"$
Unlike Linux and Windows, we do not want to handle all usage models. On the contrary, we want to cherry-pick the hell out of our target usage so we maximize the elegance and simple beauty while delivering something good for $FG,4$$TX,"Hymns",HTML="http://www.templeos.org/Wb/Home/Web/TAD/HymnVideos.html"$$FG$.
If we can define the vector space we hope to span, precisely, then we can leave the operating system on autopilot for future generations. They simply make the best possible solution to the vector space.
Knuth other literate coding homos are wrong -- if you have a well define way of doing things, it usually doesn't matter as long as it is consistent and easy to remember, so you don't vasillate. Try to do things in the way the computer naturally wants to do them. Don't be an arrogant French buffoon. Top-down is ridiculous because you have to make headers for every function. Bottom-up is how a computer wants to do it. In the past, there was a big-endian/little-endian battle. Little endian is obviously the way the computer naturally wants to operate.
Do not bloat a compiler with theoretical optimizations that bad programmers might require. We would rather teach them. As a matter of fact, there is a very straight forward way to convert the C language to machine code.
When I solicit line-of-code reducing optimizations, I plan to make it 100% objective, if possible, and chuckle at the fun, hard-to-understand hacks.
If you have ideas on how to make TempleOS more like Linux, I'm not interested. However, if you have ideas to make it more like the 8-bit computer generation operating systems or like DOS, I am interested. We want the creative spirit of the 8-bit generation of computers.
$FG,8$
* "Linux" is a trademark owned by Linus Torvalds.
* "Windows" is a trademark owned by MicroSoft Corp.
@@ -0,0 +1,498 @@
//This is a customized version of $LK,"::/Demo/ToHtmlToTXTDemo/ToHtml.HC"$.
//$MA-X+PU,"Diff",LM="WinMax;WinBorder;S2T(\"/*\",\"+r+S\");Diff(\"/Demo/ToHtmlToTXTDemo/ToHtml.HC.Z\",\"~/TOS/TOSToHtml.HC.Z\");View;"$
#help_index "DolDoc/Conversion"
//See $LK,"::/Doc/Credits.DD"$.
#define DOCET_UNDEF_COLOR 0x100000000
#define DOCET_LINK_UNDERLINE 0x200000000
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,Bool underline_update,
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
{
U8 *ch,*ptr;
u32_attr&=0xFFFFFF00;
if (u32_attr&DOCET_INVERT)
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
if (underline_update &&
!(u32_attr&DOCET_UNDERLINE) && *_old_u32_attr&DOCET_UNDERLINE) {
if (!(*_old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc,"</u>");
*_old_u32_attr&=~DOCET_LINK_UNDERLINE;
}
if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)
DocPrint(doc,"</blink>");
if (u32_attr&0xFF00!=*_old_u32_attr&0xFF00) {
if (!(*_old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc,"</span>");
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
if (style_bitmap)
LBts(style_bitmap,u32_attr.u8[1]);
}
if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))
DocPrint(doc,"<blink>");
if (underline_update) {
if (u32_attr&DOCET_UNDERLINE && !(*_old_u32_attr&DOCET_UNDERLINE))
DocPrint(doc,"<u>");
} else //Keep same underline status.
u32_attr=u32_attr&~DOCET_UNDERLINE | *_old_u32_attr&DOCET_UNDERLINE;
*_old_u32_attr=u32_attr | *_old_u32_attr&DOCET_LINK_UNDERLINE;
while (ch=*st++) {
switch (ch) {
case '\t':
do {
DocPutKey(doc,CH_SPACE,0);
*_col=*_col+1;
} while (*_col&7);
break;
start:
case 'ã': ptr="pi"; break;
case 'é': ptr="theta"; break;
case 'è': ptr="phi"; break;
case 'ê': ptr="omega"; break;
case 'ì': ptr="inf"; break;
case 'æ': ptr="u"; break;
end:
DocPrint(doc,ptr);
*_col=*_col+StrLen(ptr);
break;
start:
case CH_SHIFT_SPACE: ptr=" "; break;
case '&': ptr="&amp;"; break;
case '<': ptr="&lt;"; break;
case '>': ptr="&gt;"; break;
case '"': ptr="&quot;"; break;
end:
DocPrint(doc,ptr);
*_col=*_col+1;
break;
default:
if (CH_SPACE<=ch<0x7F || ch=='\n')
DocPutKey(doc,ch,0);
else
DocPrint(doc,".");
*_col=*_col+1;
}
}
}
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
{// ::/ --> http://www.templeos.org/Wb/
//Make your own LinkCvt routine
U8 *res=NULL,*st;
if (filename) {
st=ChgExt(filename,"html");
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
res=MStrPrint(PERSONAL_WEB "/%s#l%d",st+3,line_num);
Free(st);
}
return res;
}
U8 *URLBibleGateway(U8 *src)
{
U8 buf[STR_LEN],*dst=buf;
if (!MemCmp(src,"BF:",3))
src+=3;
while (*src) {
if (*src==CH_SPACE || *src==',')
*dst++='+';
else
*dst++=*src;
src++;
}
*dst=0;
if (StrOcc(buf,'-'))
return MStrPrint(
"http://www.biblegateway.com/passage/?search=%s&version=NIV",buf);
else
return MStrPrint(
"http://www.biblegateway.com/verse/en/%s",buf);
}
U8 *TOSLinkCvt1(U8 *link_st)
{
static CDoc *bible=NULL;
static I64 locks=0;
U8 *res=NULL,*filename,*needle;
I64 i,num;
if (link_st) {
switch (i=EdLinkCvt(link_st,&filename,&needle,&num)) {
case LK_FILE_LINE:
case LK_PLAIN_LINE:
case LK_FILE:
res=TOSLinkCvt2(filename,num);
break;
case -1:
case LK_DEF:
case LK_HELP_INDEX:
case LK_DOC:
case LK_DOC_ANCHOR:
case LK_DOC_FIND:
case LK_DOC_LINE:
break;
case LK_BIBLE_FIND:
while (LBts(&locks,0))
Yield;
if (!bible)
bible=Adam("DocRead(\"%s\");",filename);
if (DocFind(bible,num,needle))
res=URLBibleGateway(link_st);
LBtr(&locks,0);
break;
default:
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
res=TOSLinkCvt2(filename,num);
}
Free(filename);
Free(needle);
}
return res;
}
public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
U8 *body_footer=NULL,U8 *html_footer=NULL,Bool line_anchors=TRUE,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$doc to HTML file.
CDocEntry *doc_e,*style,*doc_e2;
I64 i,y,old_y=I64_MIN,col,old_u32_attr=DOCET_UNDEF_COLOR,old_attr,digits;
U32 *hl,*src;
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
CBGR48 p[COLORS_NUM];
GrPaletteGet(p);
CDoc *doc_out=DocNew;
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
old_attr=doc_in->win_task->text_attr;
doc_in->win_task->text_attr=DOC_ATTR_DFT_TEXT;
for (i=0xF0;i<=0xFF;i++)
LBts(style_bitmap,i);
DocRecalc(doc_in,RECALCt_NORMAL|RECALCF_TO_HTML);
digits=Log10(doc_in->head.last->y+1)+1;
st_2[0]=0; st_2[1]=0;
doc_out->flags|=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
if (!html_header) html_header=
"<!DOCTYPE HTML>\n"
"<html>\n"
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
if (!body_footer) body_footer=
"</pre></body>\n</html>\n";
if (!html_footer) html_footer=
"</html>\n";
DocPrint(doc_out,"%s",html_header);
DocPrint(doc_out,"<style type=\"text/css\">\n");
style=doc_out->cur_entry->last;
DocPrint(doc_out,
"</style>\n"
"</head>\n");
DocPrint(doc_out,"%s",body_header);
doc_e=doc_in->head.next;
col=doc_e->x;
y=doc_e->y;
while (doc_e!=doc_in) {
if (!(doc_e->de_flags&DOCEF_SKIP)) {
if (y!=old_y) {
if (line_anchors)
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
if (line_nums)
DocPrint(doc_out,"%0*d ",digits,y+1);
old_y=y;
}
while (y<doc_e->y) {
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&old_u32_attr,FALSE,
"\n",&col,style_bitmap);
if (++y!=old_y) {
if (line_anchors)
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
if (line_nums)
DocPrint(doc_out,"%0*d ",digits,y+1);
old_y=y;
}
col=0;
}
no_bwd=TRUE;
doc_e2=doc_e->next;
while (doc_e2!=doc_in && doc_e2->y==doc_e->y) {
if (doc_e2->x<doc_e->x) {
no_bwd=FALSE;
break;
}
doc_e2=doc_e2->next;
}
if (no_bwd)
while (col<doc_e->x)
HtmlPutS(doc_out,doc_e->settings.final_u32_attr&~DOCET_UNDERLINE,
&old_u32_attr,TRUE," ",&col,style_bitmap);
link_st=NULL;
if (doc_e->de_flags&DOCEF_HTML_LINK)
link_st=StrNew(doc_e->html_link);
else if (st=DocEntryLink(doc_in,doc_e)) {
link_st=link_cvt(st);
Free(st);
}
if (link_st) {
if (old_u32_attr&DOCET_UNDERLINE &&!(old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc_out,"</u>");
if (old_u32_attr&DOCET_BLINK)
DocPrint(doc_out,"</blink>");
if (!(old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc_out,"</span>");
old_u32_attr=DOCET_UNDEF_COLOR|DOCET_UNDERLINE|DOCET_LINK_UNDERLINE;
DocPrint(doc_out,"<a href=\"%s\">",link_st);
}
switch (doc_e->type_u8) {
case DOCT_TEXT:
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
if (doc_e->last==doc_in)
MemCpy(&doc_e->settings,&doc_in->settings_head,
sizeof(CDocSettings));
else
MemCpy(&doc_e->settings,&doc_e->last->settings,
sizeof(CDocSettings));
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),
doc_e->type&0xFF00);
while (*src) {
st_2[0]=*src&0xFF;
HtmlPutS(doc_out,*src++,&old_u32_attr,TRUE,
st_2,&col,style_bitmap);
}
Free(hl);
} else {
if (doc_e->de_flags&DOCEF_CENTER_X && //$BK,1$Nonstandard$BK,0$
doc_e->settings.final_u32_attr&0xF00==PURPLE<<8)
DocPrint(doc_out,"<h1><center>");
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
&old_u32_attr,TRUE,doc_e->tag,&col,style_bitmap);
if (doc_e->de_flags&DOCEF_CENTER_X && //$BK,1$Nonstandard$BK,0$
doc_e->settings.final_u32_attr&0xF00==PURPLE<<8)
DocPrint(doc_out,"</center></h1>");
}
break;
case DOCT_TAB:
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&old_u32_attr,TRUE,
"\t",&col,style_bitmap);
break;
case DOCT_HTML_CODE:
if (old_u32_attr&DOCET_UNDERLINE &&
!(old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc_out,"</u>");
if (old_u32_attr&DOCET_BLINK)
DocPrint(doc_out,"</blink>");
if (!(old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc_out,"</span>");
old_u32_attr=DOCET_UNDEF_COLOR;
DocPrint(doc_out,"%s",doc_e->tag);
break;
case DOCT_SPRITE:
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
&old_u32_attr,TRUE,doc_e->tag,&col,style_bitmap);
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
&old_u32_attr,TRUE,"/* Graphics Not Rendered in HTML */",
&col,style_bitmap);
break;
default:
if (doc_e->de_flags&DOCEF_TAG)
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
&old_u32_attr,TRUE,doc_e->tag,&col,style_bitmap);
}
if (link_st) {
if (old_u32_attr&DOCET_UNDERLINE &&!(old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc_out,"</u>");
if (old_u32_attr&DOCET_BLINK)
DocPrint(doc_out,"</blink>");
if (!(old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc_out,"</span>");
DocPrint(doc_out,"</a>");
old_u32_attr=DOCET_UNDEF_COLOR|DOCET_UNDERLINE|DOCET_LINK_UNDERLINE;
Free(link_st);
}
}
doc_e=doc_e->next;
}
while (y++<doc_e->y) {
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
&old_u32_attr,TRUE,"\n",&col,style_bitmap);
col=0;
}
if (old_u32_attr&DOCET_UNDERLINE && !(old_u32_attr&DOCET_LINK_UNDERLINE))
DocPrint(doc_out,"</u>");
if (old_u32_attr&DOCET_BLINK)
DocPrint(doc_out,"</blink>");
if (!(old_u32_attr&DOCET_UNDEF_COLOR))
DocPrint(doc_out,"</span>");
old_u32_attr=DOCET_UNDEF_COLOR;
DocPrint(doc_out,"%s",body_footer);
DocPrint(doc_out,"%s",html_footer);
doc_out->cur_entry=style->next;
for (i=0;i<256;i++)
if (Bt(style_bitmap,i))
DocPrint(doc_out,
".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",
i,p[i&15].r>>8,p[i&15].g>>8,p[i&15].b>>8,
p[i/16].r>>8,p[i/16].g>>8,p[i/16].b>>8);
doc_out->cur_entry=&doc_out->head;
DocRecalc(doc_out);
doc_in->win_task->text_attr=old_attr;
if (unlock_doc_in)
DocUnlock(doc_in);
return doc_out;
}
#help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)"
public U0 TOSToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
U8 *body_header=NULL,U8 *body_footer=NULL,U8 *html_footer=NULL,
I64 width=80,Bool line_anchors=TRUE,
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1,Bool line_nums=FALSE)
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$file to HTML.
//Supply your own link_cvt routine.
U8 *in_name,*out_name;
CDoc *doc_in,*doc_out;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinHorz(0,width-1); //Sets doc width for word wrap.
in_name=DftExt(_in_name,"HC.Z");
if (_out_name)
out_name=DftExt(_out_name,"html");
else
out_name=ChgExt(_in_name,"html");
doc_in=DocRead(in_name);
DocTop(doc_in);
DocPrint(doc_in,"$$BD,LTCYAN$$"); //$BK,1$Nonstandard$BK,0$
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,html_footer,
line_anchors,link_cvt,line_nums);
StrCpy(&doc_out->filename.name,out_name);
SettingsPop;
DocWrite(doc_out);
DocDel(doc_in);
DocDel(doc_out);
Free(in_name);
Free(out_name);
}
#help_index "Misc/TOS"
U0 TOSWebFile(U8 *name,Bool line_nums=FALSE)
{
U8 *name2;
CDirEntry de;
Bool line_anchors;
if (FileFind(name,&de)) {
Free(de.full_name);
"File:%s\n",name;
Collapse(name,FALSE);
Touch(name,"",,de.datetime);
name2=ChgExt(name,"html");
if (StrMatch(BLOG_BASE,name) || StrMatch(DAILY_BASE,name))
line_anchors=FALSE;
else
line_anchors=TRUE;
TOSToHtml(name,name2,
"<!DOCTYPE HTML>\n"
"<html style=\"background-color:#FFFFFF;\">\n"
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<title>The Temple Operating System</title>\n"
"<meta name=\"keywords\" "
"content=\"Operating System,64-Bit,64 Bit,"
"Temple,OS,TempleOS,Free,Open Source,Public Domain,x86_64\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V5.02",D="DD_OS_NAME_VERSION"$\">\n",
"<body style=\"background-color:#55FFFF; border-style:solid;
border-width:8px; border-color:#0000AA;
margin-left:auto; margin-right:auto; width:800px; \">\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n"
"<div style=\"margin-left:auto; margin-right:auto;"
" width: 640px;\">\n",
"</div></pre></body>\n",
"</html>\n",,line_anchors,,line_nums);
Touch(name2,"",,de.datetime);
Free(name2);
}
}
U0 FreshenWebDir(U8 *dirname,Bool line_nums=FALSE)
{//No recurse
CDirEntry *tmpde,*tmpde1;
U8 *src,*dst;
src=MStrPrint("D:/Wb%s",dirname);
MkDir(src);
Free(src);
src=MStrPrint("D:/Wb%s/*",dirname);
Del(src);
Free(src);
src=MStrPrint("C:%s/*",dirname);
dst=MStrPrint("D:/Wb%s",dirname);
Copy(src,dst);
Free(src);
Free(dst);
src=MStrPrint("D:/Wb%s/*",dirname);
tmpde=tmpde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tmpde) {
TOSWebFile(tmpde->full_name,line_nums);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
}
public U0 FreshenSite()
{//Regen html files in D:/Wb
CDirEntry *tmpde,*tmpde1;
DocClear;
Cd("D:/Wb");
DelTree("D:/Wb/Home/Books1");
DelTree("D:/Wb/Home/Books2");
DelTree("D:/Wb/Home/Budget");
DelTree("D:/Wb/Home/Private");
Del("D:/Wb/Home/*");
Touch("D:/Wb/Home/Web/index.DD.Z","");
Touch("D:/Wb/Home/Web/DownloadOS.DD.Z","");
Touch("D:/Wb/Home/Web/TempleOS.DD.Z","");
tmpde=tmpde1=FilesFind("*",
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tmpde) {
TOSWebFile(tmpde->full_name);
tmpde=tmpde->next;
}
DirTreeDel(tmpde1);
FreshenWebDir("/Home/Sup1/Sup1Words",TRUE);
Drv('C');
}
+75
View File
@@ -0,0 +1,75 @@
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.DD"$.
IMPORT Beep;
_BEEPS::
//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
@@05: PUSH RCX
//U0 $LK,"Beep",A="MN:Beep"$(I8 ona=62,Bool busy=FALSE)
PUSH FALSE //Do not busy (spin) wait
PUSH 62 //500 Hz
CALL Beep
POP RCX
LOOP @@05
POP RBP
RET1 8 //Use special return. Pop one arg off of stack.
//HolyC return vals are in RAX. This function has no return value.
}
//_extern binds a asm sym to a function.
//My convention is to put an underscore
//on C callable asm routines.
_extern _BEEPS U0 Beeps(I64 cnt);
I64 AsmAndC1()
{
I64 noreg i; //Normally this would be stored in a reg
//Check by unassembling with $LK,"Uf",A="MN:Uf"$("AsmAndC1").
i=GetI64("Num of beeps 1-5 (%d):",3,1,5);
Beeps(i);
asm {
//You can clobber RAX,RBX,RCX,RDX. The compiler expects that.
IMPORT Snd; //Import an not use & or don't import and use &Snd.
MOV RCX,&i[RBP] //You can clobber RAX,RBX,RCX,RDX.
//You better preserve the rest.
@@05: PUSH RCX
//U0 $LK,"Snd",A="MN:Snd"$(I8 ona);
MOV RAX,RCX //ona=loop*10+50
IMUL2 RAX,10 //TempleOS uses nonstandard opcodes
//to avoid multiple form of the same one.
//See $LK,"::/Compiler/OpCodes.DD"$.
ADD RAX,40
PUSH RAX
CALL Snd
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
@@10: LOOP @@10
POP RCX
LOOP @@05
}
Snd;
return i;
}
"Beeps:%d\n",AsmAndC1;
+85
View File
@@ -0,0 +1,85 @@
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
//This is to demo glbl var access.
//Glbs defined elsewhere can accessed too, like cnts.jiffies.
I64 glbl_ona=Freq2Ona(400),glbl_ona_step=10,glbl_ona_base=Freq2Ona(100);
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.DD"$.
JIFFIES_MSG: DU8 "Jiffies:",0;
//See $LK,"::/Kernel/StrA.HC",A="FL:::/Kernel/StrA.HC,1"$ and $LK,"::/Kernel/KUtils.HC"$.
_BEEPS2::
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
PUSH U64 [&cnts.jiffies]
@@05: PUSH RCX
//U0 $LK,"Beep",A="MN:Beep"$(I8 ona=62,Bool busy=FALSE)
PUSH FALSE //Do not busy (spin) wait
PUSH U64 [&glbl_ona] //evaluated at run time
CALL &Beep
POP RCX
LOOP @@05
PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$ & $LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$
MOV RSI,JIFFIES_MSG
CALL PUT_STR
POP RSI
POP RAX
SUB RAX,U64 [&cnts.jiffies]
NEG RAX
CALL PUT_HEX_U64
MOV RAX,'\n'
CALL PUT_CHARS
POP RBP
RET1 8
}
//My convention is to put an underscore
//on C callable asm routines.
_extern _BEEPS2 U0 Beeps2(I64 cnt);
U0 AsmAndC2()
{
I64 reg R15 i;
i=GetI64("$$PURPLE$$\n\nNum of beeps 1-5 (%d):$$FG$$",3,1,5);
Beeps2(i);
asm {
LIST
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest.
MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX. Preserve the rest.
@@05: PUSH RCX
//U0 $LK,"Snd",A="MN:Snd"$(I8 ona);
MOV RAX,RCX //ona=loop*10+100.0Hz
IMUL2 RAX,glbl_ona_step //Intentionally evaluated at compile time
ADD RAX,U64 [&glbl_ona_base] //Intentionally evaluated at run time
PUSH RAX
CALL &Snd //We can skip IMPORT with & if JIT compiling.
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
@@10: LOOP @@10
POP RCX
LOOP @@05
}
Snd;
}
AsmAndC2;
+23
View File
@@ -0,0 +1,23 @@
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
U0 AsmAndC3()
{
I64 i;
for (i=0;i<3;i++) {
"Meaning of life:";
MOV AL,0x41
STC
ADC AL,0 //Round-about way to make the not-special constant, 0x42.
CALL PUT_HEX_U8
MOV RCX,cnts.time_stamp_freq>>5 //JIT Const. Simple delay loop.
@@1: LOOP @@1
'\n';
}
}
AsmAndC3;
+50
View File
@@ -0,0 +1,50 @@
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
These are many useful kernel
routines $LK,"::/Kernel/StrA.HC",A="FF:::/Kernel/StrA.HC,PUT_CHARS"$
intended to be called from
asm. Generally, they preserve
regs.
You can call any routine you
like, C or asm, if you import it.
Be aware that C routines do not
preserve RAX,RBX,RCX,RDX,R8,R9.
When calling from the shell or
from C, preserve all other regs.
*/
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.DD"$.
MY_WORLD_MSG:
//Define U8 does not put terminating zeros
//on strings.
DU8 "World\n",0;
//My convention is to put an underscore
//on C callable asm routines.
_HELLO_WORLD::
PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$ & $LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$
MOV RCX,10
@@05: MOV RAX,RCX
CALL PUT_HEX_U8
MOV RAX,CH_SPACE
CALL PUT_CHARS
MOV RAX,'Hello ' //Supports multi-byte char consts
CALL PUT_CHARS
//We broke it in two pieces to show different ways.
MOV RSI,MY_WORLD_MSG
CALL PUT_STR
LOOP @@05
POP RSI
RET
};
Call(_HELLO_WORLD);
+184
View File
@@ -0,0 +1,184 @@
#define RANGE_START 1
#define RANGE_END 100
#define FIZZ_SPAN 6
#define BUZZ_SPAN 7
asm {
_BUZZ_FIZZ::
PUSH RBP
MOV RBP,RSP //Always set-up stk frame. (Stack Gets Traced)
PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$ & $LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$
PUSH RDI
MOV RSI,FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1
MOV RDI,BUZZ_SPAN-RANGE_START%BUZZ_SPAN+1
MOV RAX,RANGE_START
@@05: CALL PUT_HEX_U64
PUSH RAX
MOV RAX,CH_SPACE
CALL PUT_CHARS
DEC RSI
JNZ @@10
MOV RAX,'FIZZ '
CALL PUT_CHARS
MOV RSI,FIZZ_SPAN
@@10: DEC RDI
JNZ @@15
MOV RAX,'BUZZ '
CALL PUT_CHARS
MOV RDI,BUZZ_SPAN
@@15: MOV RAX,'\n'
CALL PUT_CHARS
POP RAX
INC RAX
CMP RAX,RANGE_END //Actually only a 32-bit inst.
JBE @@05
POP RDI
POP RSI
POP RBP
RET
}
Call(_BUZZ_FIZZ);
/*
_BUZZ_FIZZ+0x0000 55 PUSH U64 RBP
_BUZZ_FIZZ+0x0001 488BEC MOV U64 RBP,U64 RSP
_BUZZ_FIZZ+0x0004 56 PUSH U64 RSI
_BUZZ_FIZZ+0x0005 57 PUSH U64 RDI
_BUZZ_FIZZ+0x0006 BE06000000 MOV U32 ESI,U32 00000006
_BUZZ_FIZZ+0x000B BF07000000 MOV U32 EDI,U32 00000007
_BUZZ_FIZZ+0x0010 B801000000 MOV U32 EAX,U32 00000001
_BUZZ_FIZZ+0x0015 E8C51F2BC0 CALL I32 PUT_HEX_U64+0x0000
_BUZZ_FIZZ+0x001A 50 PUSH U64 RAX
_BUZZ_FIZZ+0x001B B820000000 MOV U32 EAX,U32 00000020
_BUZZ_FIZZ+0x0020 E81E202BC0 CALL I32 PUT_CHARS+0x0000
_BUZZ_FIZZ+0x0025 48FFCE DEC U64 RSI
_BUZZ_FIZZ+0x0028 7514 JNZ I8 _BUZZ_FIZZ+0x003E
_BUZZ_FIZZ+0x002A 48B846495A5A MOV U64 RAX,I64 000000205A5A4946
_BUZZ_FIZZ+0x0030 20000000
_BUZZ_FIZZ+0x0034 E80A202BC0 CALL I32 PUT_CHARS+0x0000
_BUZZ_FIZZ+0x0039 BE06000000 MOV U32 ESI,U32 00000006
_BUZZ_FIZZ+0x003E 48FFCF DEC U64 RDI
_BUZZ_FIZZ+0x0041 7514 JNZ I8 _BUZZ_FIZZ+0x0057
_BUZZ_FIZZ+0x0043 48B842555A5A MOV U64 RAX,I64 000000205A5A5542
_BUZZ_FIZZ+0x0049 20000000
_BUZZ_FIZZ+0x004D E8F11F2BC0 CALL I32 PUT_CHARS+0x0000
_BUZZ_FIZZ+0x0052 BF07000000 MOV U32 EDI,U32 00000007
_BUZZ_FIZZ+0x0057 B80A000000 MOV U32 EAX,U32 0000000A
_BUZZ_FIZZ+0x005C E8E21F2BC0 CALL I32 PUT_CHARS+0x0000
_BUZZ_FIZZ+0x0061 58 POP U64 RAX
_BUZZ_FIZZ+0x0062 48FFC0 INC U64 RAX
_BUZZ_FIZZ+0x0065 4883F864 CMP U64 RAX,I8 64
_BUZZ_FIZZ+0x0069 76AA JNA I8 _BUZZ_FIZZ+0x0015
_BUZZ_FIZZ+0x006B 5F POP U64 RDI
_BUZZ_FIZZ+0x006C 5E POP U64 RSI
_BUZZ_FIZZ+0x006D 5D POP U64 RBP
_BUZZ_FIZZ+0x006E C3 RET
0000000000000001
0000000000000002
0000000000000003
0000000000000004
0000000000000005
0000000000000006 FIZZ
0000000000000007 BUZZ
0000000000000008
0000000000000009
000000000000000A
000000000000000B
000000000000000C FIZZ
000000000000000D
000000000000000E BUZZ
000000000000000F
0000000000000010
0000000000000011
0000000000000012 FIZZ
0000000000000013
0000000000000014
0000000000000015 BUZZ
0000000000000016
0000000000000017
0000000000000018 FIZZ
0000000000000019
000000000000001A
000000000000001B
000000000000001C BUZZ
000000000000001D
000000000000001E FIZZ
000000000000001F
0000000000000020
0000000000000021
0000000000000022
0000000000000023 BUZZ
0000000000000024 FIZZ
0000000000000025
0000000000000026
0000000000000027
0000000000000028
0000000000000029
000000000000002A FIZZ BUZZ
000000000000002B
000000000000002C
000000000000002D
000000000000002E
000000000000002F
0000000000000030 FIZZ
0000000000000031 BUZZ
0000000000000032
0000000000000033
0000000000000034
0000000000000035
0000000000000036 FIZZ
0000000000000037
0000000000000038 BUZZ
0000000000000039
000000000000003A
000000000000003B
000000000000003C FIZZ
000000000000003D
000000000000003E
000000000000003F BUZZ
0000000000000040
0000000000000041
0000000000000042 FIZZ
0000000000000043
0000000000000044
0000000000000045
0000000000000046 BUZZ
0000000000000047
0000000000000048 FIZZ
0000000000000049
000000000000004A
000000000000004B
000000000000004C
000000000000004D BUZZ
000000000000004E FIZZ
000000000000004F
0000000000000050
0000000000000051
0000000000000052
0000000000000053
0000000000000054 FIZZ BUZZ
0000000000000055
0000000000000056
0000000000000057
0000000000000058
0000000000000059
000000000000005A FIZZ
000000000000005B BUZZ
000000000000005C
000000000000005D
000000000000005E
000000000000005F
0000000000000060 FIZZ
0000000000000061
0000000000000062 BUZZ
0000000000000063
0000000000000064
*/
+22
View File
@@ -0,0 +1,22 @@
asm {
_DIV_U64_BY_U64::
PUSH RBP
MOV RBP,RSP
XOR RDX,RDX
MOV RCX,64
MOV RAX,SF_ARG1[RBP]
MOV RBX,SF_ARG2[RBP]
@@1: SHL1 RAX
RCL1 RDX
CMP RBX,RDX
JA @@2
INC RAX
SUB RDX,RBX
@@2: LOOP @@1
POP RBP
RET1 16
}
_extern _DIV_U64_BY_U64 I64 DivU64ByU64(I64 dividend,I64 divisor);
"123456/10=%d\n",DivU64ByU64(123456,10);
+69
View File
@@ -0,0 +1,69 @@
/*When I was a kid with a Commodore 64,
the 6502 chip had no multiply inst
and this is how we had to do it, except,
I used more regs in this example.
*/
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.DD"$.
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
MUL_BY_HAND_U8_U8_TO_U16: //This is only for fun.
//8bit * 8bit-->16bit
//AL*BL-->AX
MOV CL,8
SHL AX,8
@@05: SHL1 AX
JNC @@10
ADD AL,BL
@@10: DEC CL
JNZ @@05
RET
_MUL_BY_HAND_U8_U8_TO_U16:: //C callable
PUSH RBP
MOV RBP,RSP
MOV AL,U8 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
MOV BL,U8 SF_ARG2[RBP]
CALL MUL_BY_HAND_U8_U8_TO_U16
MOVZX RAX,AX
POP RBP
RET1 16
_MUL_U64_U64_TO_U128::
//64bit * 64bit-->128bit
PUSH RBP
MOV RBP,RSP
MOV RBX,U64 SF_ARG3[RBP]
MOV RAX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
MUL U64 SF_ARG2[RBP] //Res RDX:RAX 128bit
MOV U64 [RBX],RAX
MOV U64 8[RBX],RDX
POP RBP
RET1 24
};
//My convention is to put an underscore
//on C callable asm routines.
_extern _MUL_BY_HAND_U8_U8_TO_U16 U16 MulU8(U8 n1,U8 n2);
class U128
{
U64 lo,hi;
};
_extern _MUL_U64_U64_TO_U128 U0 MulU64(I64 n1,I64 n2,U128 *_prod);
U0 MulByHand()
{
U128 p;
"2*7 =0x%X\n",MulU8(2,7);
"100*10=0x%X\n",MulU8(100,10);
MulU64(0x0123456789ABCDEF,0x1000001,&p);
"0x0123466789ABCDEF*0x1000001=0x%016X%016X\n",p.hi,p.lo;
}
MulByHand;
+49
View File
@@ -0,0 +1,49 @@
asm {
PUT_DEC_U64::
//RAX is number to print in decimal.
//Preserves all regs.
PUSH RBP
MOV RBP,RSP
SUB RSP,24 //24 char buffer on stack
//$LK,"Save regs",A="FF:::/Kernel/KernelA.HH,PUSH_C_REGS"$ which C code is free to clobber. We don't have to for C callers,
//but this function will be nice for ASM callers if it saves all regs.
PUSH_C_REGS
PUSH RSI //See $LK,"REGG_LOCAL_VARS",A="MN:REGG_LOCAL_VARS"$&$LK,"REGG_LOCAL_NON_PTR_VARS",A="MN:REGG_LOCAL_NON_PTR_VARS"$
LEA RSI,-1[RBP] //Load addr of end of buffer.
//We picked RSI because of PUT_STR
//We'll move bwd
MOV U8 [RSI],0 //Terminator
TEST RAX,RAX //Special case -- zero
JNZ @@05
DEC RSI
MOV U8 [RSI],'0'
JMP @@15
@@05: MOV RBX,10 //Divides by 10
@@10: XOR RDX,RDX
DIV RBX //RAX=(RDX:RAX)/RBX with remainder in RDX
ADD RDX,'0'
DEC RSI
MOV U8 [RSI],DL
TEST RAX,RAX
JNZ @@10
@@15: CALL PUT_STR
POP RSI
POP_C_REGS
LEAVE
RET
_DO_IT:: //The convention is C-callable routines have underscores.
MOV RAX,122333221
CALL PUT_DEC_U64
MOV RAX,'\n'
CALL PUT_CHARS
RET
}
Call(_DO_IT);
+45
View File
@@ -0,0 +1,45 @@
//Shows the $LK,"Carry",A="MN:Carry"$ function. It holds the CPU carry flag.
//$LK,"U",A="MN:U"$() Unassemble to make sure it is right.
U0 BigCnt()
{
U64 lo=0,hi=0;
"BigCnt\n";
while (hi<0x10) {
lo+=1<<58;
hi+=Carry;
"%016X %016X\n",hi,lo;
}
}
BigCnt;
U0 BigShift()
{
U64 lo=1,hi=0;
"Big Shift\n";
while (lo||hi) {
hi<<=1;
lo<<=1;
hi+=Carry;
"%016X %016X\n",hi,lo;
}
}
BigShift;
U0 Branch()
{
U64 i=0xFFCC3311,j;
'Branch\n';
for (j=0;j<64;j++) {
i<<=1;
if (Carry)
'1';
else
'0';
}
'\n';
}
Branch;
+80
View File
@@ -0,0 +1,80 @@
/*Demonstrates class meta data.
Basically, we make use of the compiler's
data about a class. We can add to the
compilers data arbitrary items, either string or
or int or F64 (if you typecast).
This stuff is not high performance.
Don't get carried away -- it might be slow.
*/
U0 RankOut(I64 i)
{
" %z",i,"Cadet\0Ensign\0Captain\0Admiral\0President\0";
}
class Test1Struct
{
I64 age print_str "%2d" dft_val 38;
I64 color dft_val RED; //Accepts expressions
I64 rank print_str "%1d" dft_val 6/2 output_fun &RankOut;
};
class Test2Struct
{
I64 age print_str "%2d" dft_val 38 percentile 54.20;
I64 rank print_str "%1d" dft_val 5;
I64 serial_num print_str "%6d" dft_val 123456;
};
U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
{//lastclass is keyword. See $LK,"::/Demo/LastClass.HC"$.
CHashClass *tmpc=HashFind(class_name,Fs->hash_table,HTT_CLASS);
U8 *print_str;
I64 *q,dft_val;
U0 (* fp_output_fun)(I64 i);
F64 percentile;
if (!tmpc) return;
CMemberLst *ml;
ml=tmpc->member_lst_and_root;
while (ml) {
"%s:",ml->str;
//All our items are I64's. If you want, you can check
//the data type of the member var. See $LK,"ClassRep",A="MN:ClassRep"$().
q=_d+ml->offset;
if (print_str=MemberMetaData("print_str",ml))
"" print_str,*q;
//This is slightly ambiguous -- if no meta is present it will return zero.
if (dft_val=MemberMetaData("dft_val",ml))
" default:%d",dft_val;
//This corrects for the ambiguity, allowing zero percentile.
if (MemberMetaFind("percentile",ml)) {//check if it exists
//We could use the $LK,"CMemberLstMeta",A="MN:CMemberLstMeta"$ structure returned by
//$LK,"MemberMetaFind",A="MN:MemberMetaFind"$() and save a search.
percentile=MemberMetaData("percentile",ml)(F64);
" percentile: %5.2f",percentile;
}
if (fp_output_fun=MemberMetaData("output_fun",ml))
(*fp_output_fun)(*q);
'\n';
ml=ml->next;
}
}
Test1Struct t1;
t1.age=44;
t1.rank=3;
DumpStruct(&t1);
Test2Struct t2;
t2.age=22;
t2.rank=2;
t2.serial_num=55555;
DumpStruct(&t2);
+37
View File
@@ -0,0 +1,37 @@
F64 glbl;
F64 CompileDemo(U8 *st)
{
I64 type;
U8 *machine_code;
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
F64 res=0;
Lex(cc); //Gotta get it started
"Compile \"%s\"\n",st;
do {
if (machine_code=LexExpression2Bin(cc,&type)) {
if (type!=RT_F64)
res=ToF64(Call(machine_code));
else
res=Call(machine_code)(F64);
Free(machine_code);
}
"res=%9.4f\n",res;
if (cc->token==';')
Lex(cc);
} while (cc->token!=TK_EOF); //end of file?
CmpCtrlDel(cc);
return res;
}
CompileDemo("2+Cos(ã)");
CompileDemo("1;2+4");
CompileDemo("glbl=1;glbl*2;glbl/3;Sin(glbl)");
//This is just like you typed-it on
//the cmd line.
ExePrint(
"I64 i;"
"for (i=0;i<10;i++) "
" \"%%d\n\",i;"
);
+11
View File
@@ -0,0 +1,11 @@
"\n\n%D %T\n\n\n",Now,Now;
CDateStruct ds;
Date2Struct(&ds,Now+local_time_offset);
"Hour:%02d Minute:%02d Second:%02d\n\n\n",ds.hour,ds.min,ds.sec;
"Day Name:%03tZ\n\n\n",ds.day_of_week,"ST_DAYS_OF_WEEK";
"Month Name:%03tZ\n\n\n",ds.mon-1,"ST_MONTHS";
+26
View File
@@ -0,0 +1,26 @@
/*
Press <CTRL-ALT-c> to break.
Rerun Program
Press <CTRL-ALT-d> to enter Dbg.
> $LK,"Dr",A="MN:Dr"$; //Dump Regs
> $LK,"G2",A="MN:G2"$; //Cont program
Press <CTRL-ALT-d> to enter Dbg.
> $LK,"Uf",A="MN:Uf"$("DbgDemo");
> $LK,"U",A="MN:U"$(_RIP);
See $LK,"Debugging",A="HI:Debugging"$
*/
U0 DbgDemo()
{
I64 i=0;
while (TRUE)
if (!(i++%2000000))
".";
}
DbgDemo;
+36
View File
@@ -0,0 +1,36 @@
//See $LK,"Define",A="HI:Define"$.
//These might be in the Adam task.
DefineLoad("ST_YES_NO","(Yes or No)");
DefineLoad("ST_EXIT","Exit");
DefineLstLoad("ST_NO_YES_LST","No\0Yes\0");
//New strings might be loaded for each user
//to override.
"Spanish";
if (YorN) {
DefineLoad("ST_YES_NO","(Si or No)");
DefineLoad("ST_EXIT","Salida");
DefineLstLoad("ST_NO_YES_LST","No\0Si\0");
}
Bool Quit()
{
Bool res;
U8 *st;
I64 i;
while (TRUE) {
"%S %S?","ST_EXIT","ST_YES_NO";
st=GetStr;
i=DefineMatch(st,"ST_NO_YES_LST",LMF_IGNORE_CASE);
if (i>=0) {
res=i;
break;
}
Free(st);
}
return res;
}
Quit;
+13
View File
@@ -0,0 +1,13 @@
U0 Directives()
{
"Date\t:%s\n",__DATE__;
"Time\t:%s\n",__TIME__;
"File\t:%s\n",__FILE__;
"Dir\t:%s\n",__DIR__;
"Line\t:%d\n",__LINE__;
"CmdLine\t:%d\n",__CMD_LINE__;
"Inst1\t:%P:%08X\n",$$,$$;
"Inst2\t:%P:%08X\n",$$,$$;
}
Directives;
+64
View File
@@ -0,0 +1,64 @@
U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
{//This is called by the window mgr.
//Things would get corrupted
//if the window mgr used it's own
//heap, so we use the owning task's heap.
U8 *st=MAlloc(64,mem_task);
CDate cdt=tS*CDATE_FREQ;
//Doesn't have to be fixed width!!
StrPrint(st,"%d=%T",cdt,cdt);
return st;
}
U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
{
U8 *st=MAlloc(64,mem_task);
CDate cdt=Now;
StrPrint(st,"%D %T",cdt,cdt);
return st;
}
U0 DoIt()
{
CDoc *bdoc=DocBorder,*pdoc=DocPut;
CDocEntry *doc_e;
DocLock(bdoc);
DocBottom(bdoc); //Ins at the bottom
DocPrint(bdoc,"$$RED$$$$CM+BY+LX,5,-3$$");
//The $LK,"DocPrint",A="MN:DocPrint"$() routine returns the addr of the last entry.
doc_e=DocPrint(bdoc,"$$TX+TC,\" \"$$");
//The TC flag is "has tag callback".
//Flags are explained here:
//$LK,"::/Doc/DolDocOverview.DD"$ $LK,"::/Doc/Widget.DD"$
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS"$
doc_e->tag_cb=&tSCB;
DocPrint(bdoc,"$$FG$$");
DocUnlock(bdoc);
//$BK,1$WARNING:$BK,0$ If you use the put_doc you
//run the risk of the user pressing
//<CTRL-t> or using the clipboard, both
//of which will crash. So, you might want
//to use the border_doc.
DocLock(pdoc);
DocPrint(pdoc,"$$LTRED$$");
doc_e=DocPrint(pdoc,"$$TX+TC,\" \"$$");
doc_e->tag_cb=&CurTimeCB;
DocPrint(pdoc,"$$FG$$");
DocUnlock(pdoc);
//Send carriage return, new line, so
//that the timer string is not part
//of the next cmd on the cmd line.
'\n';
}
U0 UndoIt()
{//Clear-out entries without a +H hold flag.
DocClear(Fs->border_doc);
}
DoIt;
+47
View File
@@ -0,0 +1,47 @@
I64 MyLeftCB1(CDoc *,CDocEntry *)
{
I64 i;
for (i=500;i<1000;i+=25) {
Snd(Freq2Ona(i));
Sleep(10);
}
Snd;
return 0;
}
U0 ClickCallBack()
{
CDocEntry *doc_e;
DocLock(DocPut);
//The $LK,"DocPrint",A="MN:DocPrint"$() routine returns the addr of the last entry.
doc_e=DocPrint(DocPut,"\n$$MA+LC,\"Click Me\"$$ ");
//The LC flag is "has left callback".
//Flags are explained here:
//$LK,"::/Doc/DolDocOverview.DD"$ $LK,"::/Doc/Widget.DD"$
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS"$
"(Not preserved if you press <CTRL-t>.)\n\n";
doc_e->left_cb=&MyLeftCB1;
DocUnlock(DocPut);
}
ClickCallBack;
I64 MyLeftCB2(CDoc *,CDocEntry *)
{
return cnts.jiffies;
}
U0 PopUpJiffiesCallBack(I64 i)
{
CDoc *doc=DocNew;
CDocEntry *doc_e=DocPrint(doc,
"Click %d more times\n\n\n$$BT+LC,\"Jiffies\"$$\n\n\n",i);
doc_e->left_cb=&MyLeftCB2;
"Current Jiffies:%d\n",PopUpMenu(doc);
DocDel(doc);
}
PopUpJiffiesCallBack(3);
PopUpJiffiesCallBack(2);
PopUpJiffiesCallBack(1);
+38
View File
@@ -0,0 +1,38 @@
U0 CursorMovementDemo()
{
I64 i;
for (i=0;i<100;i++) {
"%03d ",i;
"$$CM,-4,1$$";
if (i%10==9)
"$$CM,4,-10$$";
}
//+LX is relative to left side.
//See <CTRL-l> with cursor-movement for all the flags.
//Check "Quote" to set-up a cmd for in quotes.
"$$CM+LX,0,+10$$\n";
}
CursorMovementDemo;
/*The word-wrap Off and On cmds are
$$WW,0$$ and $$WW,1$$.
You might need $LK,"DocMax",A="MN:DocMax"$() to adjust
the cmd line window buf size.
It counts cmds, not lines.
The +H flag will hold-onto an entry
so it doesn't get pushed-out of the document.
This is useful for a $$WW+H,1$$ cmd.
See $LK,"::/Doc/DolDocOverview.DD"$ for documentation on
all flags and cmds.
Note: the default page length is 66 lines
and branching back more than the page length
will rst the column to 1. So, set page
length to a large number if you want to
branch back a long distance.
*/
+63
View File
@@ -0,0 +1,63 @@
/*$$DA is the data widget.
-TRM flag is for var
width fields with a terminator
character.
+RD refreshes the data.
+UD updates the val when you edit it.
-P Means it is a string var, basically.
,32 sets the tag string width.
See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.HC,DataTagWidth"$.
,RT=I16 means the val is 2 bytes.
See $LK,"DocDataFmt",A="MN:DocDataFmt"$() and $LK,"DocDataScan",A="MN:DocDataScan"$().
*/
I16 i=0;
U8 buf[8];
U0 UpdateGlblTask(I64)
{
while (TRUE) {
i++;
Sleep(1);
}
}
U0 DataDemo()
{
CDocEntry *doc_e;
//This is the command line document.
CDoc *doc=DocPut;
//We do this to prevent access to
//doc_e->data before it is set.
Bool unlock=DocLock(doc);
//You might set the $LK,"DOCF_FORM",A="MN:DOCF_FORM"$ flag.
// doc->flags|=DOCF_FORM
//if you wish.
Spawn(&UpdateGlblTask,NULL,"Update Glbl",,Fs);
"Enter editor overstrike mode\n"
"and you can modify the val.\n"
"However, changes happen immediately,\n"
"so it's tricky.\n\n";
//Use <CTRL-l> for the $$DA...$$ format.
doc_e=DocPrint(doc,"$$DA-TRM+RD+UD,RT=I16,A=\"%%7d\"$$\n");
doc_e->data=&i;
StrCpy(buf,"Terry");
doc_e=DocPrint(doc,"$$DA-P+RD+UD,LEN=7,A=\"Str:%%s\"$$\n");
doc_e->data=buf;
if (unlock)
DocUnlock(doc);
}
DataDemo;
//See $LK,"PopUpExtents",A="MN:PopUpExtents"$().
+22
View File
@@ -0,0 +1,22 @@
/*The +D flag causes a define-string
look-up and substitution.
It is available in the <CTRL-l> text-widget
menu under text entries for use in
documentation.
*/
DefineLoad("COMPANY","Acme Inc");
"Company: $$TX,\"\",D=\"COMPANY\"$$\n";
DefinePrint("COMPANY_TIME","%T",Now);
#exe {
StreamPrint(
"#define COMPANY_AGE %0.1f\n",
(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
};
"Age : $$TX,\"\",D=\"COMPANY_AGE\"$$ years\n";
"Time: $$TX,\"\",D=\"COMPANY_TIME\"$$\n";
Binary file not shown.
+80
View File
@@ -0,0 +1,80 @@
public U0 DocProfile(U8 *filename,I64 flags)
{
I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_TYPES_NUM),
*flags_stats=CAlloc(sizeof(I64)*64),
*type_flags_stats=CAlloc(sizeof(I64)*64);
//Note: word wrap is determined by
//doc->win_task when a $LK,"CDoc",A="MN:CDoc"$ is recalculated
//use $LK,"DocRecalc",A="MN:DocRecalc"$().
CDoc *doc=DocRead(filename,flags);
//doc->head which is equ to doc is the
//header of the CQue and represents the end-of-file marker.
CDocEntry *doc_e=doc->head.next;
while (doc_e!=doc) {
cmd_stats[doc_e->type_u8]++;
for (i=0;i<64;i++)
if (Bt(&doc_e->de_flags,i))
flags_stats[i]++;
for (i=16;i<32;i++)
if (Bt(&doc_e->type,i))
type_flags_stats[i]++;
doc_e=doc_e->next;
}
DocDel(doc);
"$$PURPLE$$-------%s-------\n",filename;
"$$GREEN$$The lowest byte of the 32-bit 'doc_e->type', "
"'$$PURPLE$$doc_e->type.u8[0]$$GREEN$$', "
"is cmd and accessed with the union "
"'$$PURPLE$$doc_e->type_u8$$GREEN$$'. "
"See $$LK,\"CDocEntry\",A=\"MN:CDocEntry\"$$, "
"$$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$$ and "
"$$LK,\"Doc Type Codes\","
"A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_CMDS\"$$.\n"
"$$FG$$";
for (i=0;i<DOCT_TYPES_NUM;i++)
if (cmd_stats[i])
"%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];
"\n$$GREEN$$'$$PURPLE$$doc_e->type.u8[1]$$GREEN$$' is "
"the scrn color attr of the "
"entry. '$$PURPLE$$doc_e->type.u16[1]"
"$$GREEN$$' is some flags for blinking and "
"stuff. See $$LK,\"Doc Type Flag "
"Defines\",A=\"MN:DOCET_BLINK\"$$.\n$$FG$$";
for (i=16;i<32;i++)
if (type_flags_stats[i])
"%4d:%d\n",i,type_flags_stats[i];
"$$GREEN$$\n'$$PURPLE$$doc_e->de_flags$$GREEN$$' is 64-bit. "
"See $$LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$$ and "
"$$LK,\"Doc Flag Codes\","
"A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS\"$$.\n"
"$$FG$$";
for (i=0;i<64;i++)
if (flags_stats[i])
"%4Z:%d\n",i,"ST_DOC_FLAGS",flags_stats[i];
Free(cmd_stats);
Free(flags_stats);
PressAKey;
'\n';
}
/*See $LK,"TipOfDay",A="MN:TipOfDay"$.
Note: Not all $LK,"CDocEntry",A="MN:CDocEntry"$'s are full-sized nodes.
Some are $LK,"MAlloc",A="MN:MAlloc"$ed with a smaller size to save
mem. They all have at least the size $LK,"CDocEntryBase",A="MN:CDocEntryBase"$.
Note: $LK,"CDocEntry",A="MN:CDocEntry"$'s should be alloced from the
heap of the owning task, doc->mem_task.
The flag arrays $LK,"doldoc.type_flags_form",A="MN:CDolDocGlbls"$, etc
are useful.
*/
DocProfile("::/Doc/ChgLog.DD",0);
DocProfile("::/Doc/ChgLog.DD",DOCF_PLAIN_TEXT);
+51
View File
@@ -0,0 +1,51 @@
class FDStruct
{//Use <CTRL-l> and sel "Data", "List" or "Check Box"
//to generate the fmtstrs.
F64 num1 fmtstr "$$DA-TRM,A=\"Float 1:%12.8f\"$$\n";
F64 num2 fmtstr "$$DA-TRM,A=\"Float 2:%12e\"$$\n";
I64 num3 fmtstr "$$DA-TRM,A=\"Int 1:0x%016X\"$$\n";
I64 num4 fmtstr "$$DA-TRM,A=\"Int 2:%12d\"$$\n";
I64 type fmtstr "$$LS,D=\"ST_PERSON_TYPE\"$$\n";
U8 name[32] fmtstr "$$DA-P,A=\"Name :%s\"$$\n";
U8 *address1 fmtstr "$$DA+M,A=\"Address:%s\"$$\n"; //+M is unlimited len U8 *.
U8 *address2 fmtstr "$$DA+M,A=\"Address:%s\"$$\n"; //+M is unlimited len U8 *.
CDate datetime fmtstr "$$DA-TRM,A=\"Date :%8D\"$$\n";
Bool check fmtstr "$$CB,\"Check\"$$\n";
};
U0 FormDemo()
{
FDStruct fds;
DefineLstLoad("ST_PERSON_TYPE","Child\0Teen\0Adult\0");
fds.num1=12.3e-4; //Set defaults
fds.num2=4.5e3;
fds.num3=0x1234;
fds.num4=-567;
fds.type=1;
StrCpy(&fds.name,"John");
fds.address1=StrNew("1234 Pine St.");
fds.address2=NULL; //Init to NULL if empty.
fds.datetime=Now;
fds.check=TRUE;
if (DocForm(&fds)) {
"#1\t=%e\n",fds.num1;
"#2\t=%e\n",fds.num2;
"#3\t=%d\n",fds.num3;
"#4\t=%d\n",fds.num4;
"Type\t=%s\n",DefineSub(fds.type,"ST_PERSON_TYPE");
"Name\t=%s\n",fds.name;
"Address1=%s\n",fds.address1;
"Address2=%s\n",fds.address2;
"Date\t=%D\n",fds.datetime;
"Check\t=%d\n",fds.check;
} else
"Cancel\n";
"\n\nClassRep Example\n";
ClassRep(&fds);
Free(fds.address1);
Free(fds.address2);
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
}
FormDemo;
+75
View File
@@ -0,0 +1,75 @@
//This example shows bttns. Bttns return a menu val
//unless you rig them to send macros. Menu entries are
//about the same as bttns, but don't have a border.
I64 PopUpFreq()
{//See also $LK,"PopUpRangeI64",A="MN:PopUpRangeI64"$()
I64 i;
CDoc *doc=DocNew;
DocPrint(doc,"$$TX+CX,\"Set Freq\"$$\n" //Centered text
"$$CM+LX,2,4$$$$BT,\"100 Hz\",LE=100$$"
"$$CM+LX,18,0$$$$BT,\"200 Hz\",LE=200$$"
"$$CM+LX,2,4$$$$BT,\"400 Hz\",LE=400$$"
"$$CM+LX,18,0$$$$BT,\"800 Hz\",LE=800$$\n");
i=PopUpMenu(doc);
if (i<0) i=0; // <SHIFT-ESC>
DocDel(doc);
return i;
}
#define MU_NOTHING 0
#define MU_SET_FREQ 1
#define MU_SND_ON 2
#define MU_SND_OFF 3
U0 MenuBttn()
{
Bool done=FALSE;
I64 i,j=0,freq=100;
I64 old_flags=DocPut->flags;
//This allows keyboard navigation to skip nonselible entries.
DocPut->flags|=DOCF_FORM;
do {
DocClear;
//Use <CTRL-l> to generate cursor movement expressions and check "Quote".
"$$CM+CX-RE,-4$$Menu Demo\n\n";
"$$LM,8$$"; //Set left margin
//These are bttns that return a val from a menu selection.
if (!j)
"\n$$BT,\"Snd On\",LE=MU_SND_ON$$\n\n\n";
else
"\n$$BT,\"Snd Off\",LE=MU_SND_OFF$$\n\n\n";
"\n$$BT,\"Set Freq\",LE=MU_SET_FREQ$$\n\n\n"
"\n$$BT,\"Nothing\",LE=MU_NOTHING$$\n\n\n"
"\n$$BT,\"Done\",LE=DOCM_CANCEL$$\n\n\n";
i=DocMenu(DocPut);
DocBottom;
switch (i) {
case MU_NOTHING:
break;
case MU_SND_ON:
j=freq;
Snd(Freq2Ona(j));
break;
case MU_SND_OFF:
j=0;
Snd;
break;
case MU_SET_FREQ:
freq=PopUpFreq;
if (j) {
j=freq;
Snd(Freq2Ona(j));
}
break;
default:
done=TRUE;
}
} while (!done);
DocPut->flags=DocPut->flags&~DOCF_FORM |
old_flags & DOCF_FORM;
DocClear;
Snd;
}
MenuBttn;
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
// This makes a new Bible file
//with line numbers.
U0 NumBible()
{
CDoc *doc_in=DocRead("::/Misc/Bible.TXT.Z",DOCF_PLAIN_TEXT_TABS),
*doc_out=DocNew("~/DemoNumBible.DD.Z");
CDocEntry *doc_e=doc_in->head.next;
while (doc_e!=doc_in) {
if (doc_e->type_u8==DOCT_TEXT) {
DocPrint(doc_out,"%05d %s",doc_e->y+1,doc_e->tag);
doc_e=doc_e->next;
if (doc_e->type_u8==DOCT_NEW_LINE) {
DocPrint(doc_out,"\n");
doc_e=doc_e->next;
}
} else if (doc_e->type_u8==DOCT_NEW_LINE) {
DocPrint(doc_out,"%05d\n",doc_e->y+1);
doc_e=doc_e->next;
} else
doc_e=doc_e->next;
}
doc_out->flags|=DOCF_NO_CURSOR;
DocWrite(doc_out);
DocDel(doc_out);
DocDel(doc_in);
}
NumBible;
+22
View File
@@ -0,0 +1,22 @@
"\nSuper : 3$$SY,-3$$2$$SY,0$$=9\n\n"
"Sub : H$$SY,3$$2$$SY,0$$O\n\n"
"Color : $$RED$$Test$$FG$$\n\n"
"Blink : $$BK,1$$Test$$BK,0$$\n\n"
"Invert : $$IV,1$$Test$$IV,0$$\n\n"
"UnderLine: $$UL,1$$Test$$UL,0$$\n\n"
"Link : $$LK,\"Genesis,1:1\",\"BF:Genesis,1:1\"$$\n\n\n"
"Bttn : $$BT-X,\"OKAY\",LE=1$$\n\n\n\n";
//You can do it this way if you like.
"\nSuper : 3$SY,-3$2$SY,0$=9\n\n"
"Sub : H$SY,3$2$SY,0$O\n\n"
//Can't see color because of syntax highlighting. Press <CTRL-t>
"Color : $FG,4$Test$FG$\n\n"
"Blink : $BK,1$Test$BK,0$\n\n"
"Invert : $IV,1$Test$IV,0$\n\n"
"UnderLine: $UL,1$Test$UL,0$\n\n"
//<CTRL-SHIFT-T> on this link to toggle individual commands.
"Link : $LK,"Genesis,1:1",A="BF:Genesis,1:1"$\n\n\n"
"Bttn : $BT,"OKAY",LE=1$\n\n\n\n";
+39
View File
@@ -0,0 +1,39 @@
U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
{
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tmpde->name,tmpde->full_name);
if (tmpde->sub) {
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
}
} else
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
tmpde->name,tmpde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tmpde);
tmpde=tmpde1;
}
}
U0 TreeDemo()
{
I64 fuf_flags=0;
CDoc *doc=DocNew;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
DocPrint(doc,"$$TR-C,\"\"$$\n");
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,FilesFind("/*",fuf_flags));
DocPrint(doc,"$$ID,-2$$");
DocInsDoc(DocPut,doc);
DocDel(doc);
}
TreeDemo;
+82
View File
@@ -0,0 +1,82 @@
/*Scans the sym table and checks
each $LK,"HTT_DEFINE_STR",A="MN:HTT_DEFINE_STR"$ entry to see if
it only occurs once in files.
It's a brute force solution, but
gets the job done... slowly.
$LK,"Find",A="MN:Find"$() returns a count of matches.
$LK,"FileOcc",A="MN:FileOcc"$() is $LK,"Find",A="MN:Find"$() with
output $LK,"Silent",A="MN:Silent"$().
*/
U0 UnusedDefineScan()
{
CDoc *old_put_doc,*old_display_doc,*doc;
I64 i,cnt=0;
CHashTable *table;
CHash *tmph;
CDocEntry *doc_e,*doc_e2;
Bool old_silent=IsSilent;
try {
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR)
cnt++;
tmph=tmph->next;
}
}
table=table->next;
}
progress1=0;
progress1_max=cnt;
StrCpy(progress1_desc,"Define Scan");
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR) {
progress1++;
if (FileOcc(tmph->str,"/*","+l-i+$$")==1) {
doc=DocNew;
old_put_doc=DocPut;
old_display_doc=DocDisplay;
Fs->put_doc=Fs->display_doc=doc;
Find(tmph->str,"/*","+l-i+$$");
Fs->put_doc=old_put_doc;
Fs->display_doc=old_display_doc;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_LINK) {
"%s ",tmph->str;
doc_e2=DocEntryCopy(doc,doc_e);
DocInsEntry(old_put_doc,doc_e2);
'\n';
}
doc_e=doc_e->next;
}
DocDel(doc);
}
}
tmph=tmph->next;
}
}
table=table->next;
}
} catch
PutExcept;
Silent(old_silent);
'\n';
ProgressBarsRst;
}
UnusedDefineScan;
+13
View File
@@ -0,0 +1,13 @@
U0 BlkDevRep()
{//Block Device Report.
I64 i;
for (i=0;i<BLKDEVS_NUM;i++)
if (blkdev.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
ClassRep(&blkdev.blkdevs[i]);
//The lastclass arg tells ClassRep the datatype.
//lastclass is a language feature of $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$.
//See $LK,"::/Demo/LastClass.HC"$.
}
BlkDevRep;
+64
View File
@@ -0,0 +1,64 @@
#define DB_FILENAME "~/DataBaseDemo.BIN"
#define DB_ACCT_MAX 100
#define DB_ACCT_BLKS 1
class Acct
{//Use <CTRL-l> to help generate fmtstrs.
U8 name[32] fmtstr "$$DA-P,LEN=32,A=\"Name:%s\"$$\n";
U8 addr[64] fmtstr "$$DA-P,LEN=64,A=\"Addr:%s\"$$\n";
U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32];
};
U0 InitDatabase()
{ //Write new contiguous file
CFile *f=FOpen(DB_FILENAME,"w",DB_ACCT_MAX*DB_ACCT_BLKS);
FClose(f);
}
U0 WriteAcct()
{
CFile *f;
Acct a;
I64 acctnum;
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_ACCT_MAX) {
MemSet(&a,0,BLK_SIZE);
if (DocForm(&a)) {
f=FOpen(DB_FILENAME,"w+");
FWBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FClose(f);
}
}
}
U0 ReadAcct()
{
CFile *f;
Acct a;
I64 acctnum;
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_ACCT_MAX) {
f=FOpen(DB_FILENAME,"r");
FRBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FClose(f);
ClassRep(&a);
}
}
U0 DatabaseDemo()
{
I64 ch;
if (!FileFind(DB_FILENAME))
InitDatabase;
do {
"$$GREEN$$R$$FG$$ead acct, $$GREEN$$W$$FG$$rite acct or $$GREEN$$<SHIFT-ESC>$$FG$$:";
ch=ToUpper(GetChar);
'\n';
if (ch=='R') ReadAcct;
if (ch=='W') WriteAcct;
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
}
DatabaseDemo;
+41
View File
@@ -0,0 +1,41 @@
U0 RawAccess(I64 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
CBlkDev *bd=Let2BlkDev(drv_let);
I64 blk,old_offset,old_size;
U8 *buf=MAlloc(BLK_SIZE);
DrvRep;
PressAKey;
ClassRep(dv);
PressAKey;
ClassRep(bd);
PressAKey;
//Temporarily change partition range to full device.
//Normally, you are limited to just your partition.
//This is obviously $BK,1$dangerous$BK,0$!
old_offset=dv->drv_offset;
old_size =dv->size;
dv->drv_offset=0;
dv->size=bd->max_blk+1;
try {
blk=GetI64("Blk to Read: ",old_offset,0,bd->max_blk);
RBlks(dv,buf,blk,1);
D(buf,BLK_SIZE);
} catch
PutExcept;
dv->drv_offset=old_offset;
dv->size =old_size;
Free(buf);
}
RawAccess;
//See $LK,"RBlks",A="MN:RBlks"$(), $LK,"WBlks",A="MN:WBlks"$(), $LK,"DrvLock",A="MN:DrvLock"$(), $LK,"DrvUnlock",A="MN:DrvUnlock"$()
//$LK,"DBlk",A="MN:DBlk"$(), $LK,"DCluster",A="MN:DCluster"$(), $LK,"BlkDevLock",A="MN:BlkDevLock"$() and $LK,"BlkDevUnlock",A="MN:BlkDevUnlock"$().
+49
View File
@@ -0,0 +1,49 @@
/*There is no FPrintF type function and no
way to grow files. Therefore, use mem to
hold the file until you are done. The $LK,"CDoc",A="MN:CDoc"$
framework is convenient for this.
*/
U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
{
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tmpde->name,tmpde->full_name);
if (tmpde->sub) {
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
}
} else
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
tmpde->name,tmpde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tmpde);
tmpde=tmpde1;
}
}
U0 FPrintFDemo(U8 *output_filename=NULL)
{
I64 fuf_flags=0;
CDoc *doc=DocNew(output_filename);
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
DocPrint(doc,"$$TR-C,\"\"$$\n");
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,FilesFind("/*",fuf_flags));
DocPrint(doc,"$$ID,-2$$");
DocRecalc(doc);
if (output_filename)
DocWrite(doc,FALSE);
else
DocWrite(doc,TRUE);
DocDel(doc);
}
FPrintFDemo;
+35
View File
@@ -0,0 +1,35 @@
/*You probably don't need this. It makes a directory
tree into a flat contiguous memory chunk, suitable for
serial communication and rebuilds it into a tree on the
other end.
*/
U0 SerializeTree()
{
CDirEntry *tmpde=FilesFind("/Demo/*.DD*",FUF_RECURSE);
I64 size;
U8 *ptr;
CArcCompress *arc;
LineRep1(tmpde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
LineRep2(DocPut,tmpde);
"$$GREEN$$***************$$FG$$\n";
ptr=DirTreeSerialize(tmpde,&size);
DirTreeDel(tmpde);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
arc=CompressBuf(ptr,size);
Free(ptr);
D(arc,arc->compressed_size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
ptr=ExpandBuf(arc);
size=arc->expanded_size;
Free(arc);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
tmpde=DirTreeUnserialize(ptr);
LineRep2(DocPut,tmpde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
DirTreeDel(tmpde);
}
SerializeTree;
+12
View File
@@ -0,0 +1,12 @@
U0 UnusedSpaceRep()
{
I64 i;
CDrv *dv;
for (i=0;i<26;i++)
if ((dv=Let2Drv(i+'A',FALSE)) &&
(dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA))
"%C: %7.3f%% Free\n",
Drv2Let(dv),UnusedDrvSpace(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE);
}
UnusedSpaceRep;
+47
View File
@@ -0,0 +1,47 @@
//$BK,1$WARNING:$BK,0$ Don't return out of a catch{}. This
//might get fixed.
//You can use $LK,"PutExcept",A="MN:PutExcept"$() in a catch stmt
//and it will report args.
Bool Prompt(I64 i)
{
"%d ",i;
return YorN;
}
U0 D1()
{
"D1\n";
if (Prompt(1)) throw('Point1');
if (Prompt(2)) throw('Point2');
}
U0 D2()
{
"D2\n";
try {
D1;
if (Prompt(4)) throw('Point4');
} catch {
"D2 hndlr\n"
"Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
if (Fs->except_ch=='Point1') {
"Caught in D2\n";
Fs->catch_except=TRUE;
}
}
}
U0 Demo()
{
try {
D2;
if (Prompt(3)) throw('Point3');
} catch {
"Demo hndlr\n"
"Ch:%c:%P\n",Fs->except_ch,Fs->except_callers[0];
Fs->catch_except=TRUE;
}
}
Demo;
+35
View File
@@ -0,0 +1,35 @@
U8 face[8]={
0b00111100,
0b01000010,
0b10100101,
0b10000001,
0b11000011,
0b10111101,
0b01000010,
0b00111100,
};
text.font[255]=face[0](U64);
"Face:ÿ\n";
//Chars 128-255 are treated as letters
//by the compiler and everything else.
//Enter them by holding ALT and
//pressing a 3 digit decimal number or
//press <CTRL-ALT-a>.
U0 SrcExample()
{
I64 fÿÿ=12345;
"fÿÿ=%d\n",fÿÿ;
}
SrcExample;
//See $LK,"::/Demo/ScrnCodes.HC"$, $LK,"::/Demo/Graphics/CharAnimation.HC"$,
//$LK,"::/Demo/Games/CharDemo.HC"$ and $LK,"::/Demo/Graphics/FontEd.HC"$.
//See $LK,"char_bmp_alpha",A="MN:char_bmp_alpha"$ and $LK,"char_bmp_alpha_numeric",A="MN:char_bmp_alpha_numeric"$.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+770
View File
@@ -0,0 +1,770 @@
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
RegDft("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
RegExe("TempleOS/CastleFrankenstein");
//Set snap to 4 and width to 4
//if you edit this map.
//Don't forget to change the
//starting pos.
#define MAN_START_X 0
#define MAN_START_Y 4.5
$SP,"<1>",BI=1$
#define MONSTER_SCALE 2.0
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$
#define PLANT_SCALE 2.0
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
#define SCRN_SCALE 512
#define PLOT_GRID_WIDTH 24
#define PLOT_GRID_HEIGHT 24
#define MAN_HEIGHT 125
#define MAP_SCALE 4
I64 map_width,map_height;
U8 *map=NULL,
*panels_processed_bitmap=NULL;
I64 man_xx,man_yy;
F64 man_é;
F64 t0,tf;
#define MONSTERS_NUM 10
I64 monsters_left;
class Monster
{
I64 x,y;
Bool dead,pad[7];
} monsters[MONSTERS_NUM];
U0 CFTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
Mat4x4MulXYZ(dc->r,x,y,z);
zz=SCRN_SCALE/3+*z;
if (zz<1) zz=1;
*x=SCRN_SCALE/2* *x/zz;
*y=SCRN_SCALE/2* (*y+MAN_HEIGHT)/zz;
*x+=dc->x;
*y+=dc->y;
*z+=dc->z;
}
#define LOS_SCALE 4
Bool LOSPlot(U8 *,I64 x,I64 y,I64)
{
if (!map[(y/LOS_SCALE)*map_width+(x/LOS_SCALE)])
return FALSE;
else
return TRUE;
}
Bool LOS(I64 x1,I64 y1,I64 x2,I64 y2)
{//Line of sight
return Line(NULL,x1*LOS_SCALE/SCRN_SCALE,y1*LOS_SCALE/SCRN_SCALE,0,
x2*LOS_SCALE/SCRN_SCALE,y2*LOS_SCALE/SCRN_SCALE,0,&LOSPlot);
}
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,j,*r1,*r2,*r3,*s2w,xx,yy,zz,x,y,x1,y1,z1,
c,x1w,y1w,x1h,y1h,xh,yh,zh,
cx=task->pix_width/2,
cy=task->pix_height/2;
U8 *tmps;
F64 tt;
CD3I32 poly[4];
Monster *tmpm;
DCDepthBufAlloc(dc);
MemSet(panels_processed_bitmap,0,(map_width*map_height+7)>>3);
//World to scrn
Mat4x4RotZ(dc->r,man_é+ã/2);
Mat4x4RotX(dc->r,ã/2);
DCMat4x4Set(dc,dc->r);
xh=-man_xx/SCRN_SCALE; yh=-man_yy/SCRN_SCALE; zh=0;
Mat4x4MulXYZ(dc->r,&xh,&yh,&zh);
Mat4x4TranslationEqu(dc->r,xh,yh,zh);
//Scrn to world
s2w=Mat4x4IdentNew(task);
Mat4x4RotX(s2w,-ã/2);
Mat4x4RotZ(s2w,-man_é-ã/2);
xh=0; yh=0; zh=SCRN_SCALE;
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
//Rotate light source
xx=dc->ls.x; yy=dc->ls.y; zz=-dc->ls.z;
(*dc->transform)(dc,&xx,&yy,&zz);
dc->ls.x=xx; dc->ls.y=yy; dc->ls.z=zz;
dc->flags|=DCF_TRANSFORMATION;
dc->transform=&CFTransform;
dc->x=cx;
dc->y=cy;
r1=Mat4x4IdentNew(task);
Mat4x4RotX(r1,-ã/2);
Mat4x4RotZ(r1,tS);
Mat4x4Scale(r1,MONSTER_SCALE);
r2=Mat4x4IdentNew(task);
Mat4x4Scale(r2,MONSTER_SCALE);
r3=Mat4x4IdentNew(task);
Mat4x4RotX(r3,-ã/2);
Mat4x4Scale(r3,PLANT_SCALE);
Seed(1);
x1h=man_xx+yh*PLOT_GRID_WIDTH/2+xh*(PLOT_GRID_HEIGHT-1);
y1h=man_yy-xh*PLOT_GRID_WIDTH/2+yh*(PLOT_GRID_HEIGHT-1);
xh>>=1; yh>>=1;
for (j=0;j<PLOT_GRID_HEIGHT*2;j++) {
x1w=x1h;
y1w=y1h;
for (i=0;i<PLOT_GRID_WIDTH*4;i++) {
xx=x1w/SCRN_SCALE; yy=y1w/SCRN_SCALE;
x=xx*SCRN_SCALE-man_xx; y=yy*SCRN_SCALE-man_yy;
if (1<=xx<map_width-1 && 1<=yy<map_height-1 &&
!LBts(panels_processed_bitmap,yy*map_width+xx)) {
if ((c=map[yy*map_width+xx]) &&
LOS(xx*SCRN_SCALE+SCRN_SCALE/2,yy*SCRN_SCALE+SCRN_SCALE/2,
man_xx,man_yy)) {
if (c==YELLOW)
dc->color=DKGRAY;
else
dc->color=c;
poly[0].x=x;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y;
poly[1].z=0;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=0;
poly[3].x=x;
poly[3].y=y+SCRN_SCALE;
poly[3].z=0;
GrFillPoly3(dc,4,poly);
if (c==GREEN) {
x1=x+SCRN_SCALE/2;
y1=y+SCRN_SCALE/2;
z1=0;
DCTransform(dc,&x1,&y1,&z1);
if (z1>0)
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)
Sprite3Mat4x4B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
}
if (!map[(yy+1)*map_width+xx]) {
dc->color=LTGRAY;
poly[0].x=x;
poly[0].y=y+SCRN_SCALE;
poly[0].z=0;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y+SCRN_SCALE;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[yy*map_width+xx+1]) {
dc->color=WHITE;
poly[0].x=x+SCRN_SCALE;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x+SCRN_SCALE;
poly[3].y=y;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[(yy-1)*map_width+xx]) {
dc->color=LTGRAY;
poly[0].x=x;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y;
poly[1].z=0;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[yy*map_width+xx-1]) {
dc->color=WHITE;
poly[0].x=x;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
}
}
x1w-=yh;
y1w+=xh;
}
x1h-=xh;
y1h-=yh;
}
//Draw Monsters
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (LOS(x,y,man_xx,man_yy)) {
x-=man_xx;
y-=man_yy;
xx=x;
yy=y;
zz=0;
DCTransform(dc,&xx,&yy,&zz);
if (zz>0) {
if (tmpm->dead)
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$);
Sprite3Mat4x4B(dc,x,y,0,tmps,r1);
Free(tmps);
}
}
}
}
Free(r1);
Free(r2);
Free(r3);
//Draw Map heads-up display, scaled 2 pixs
Free(dc->r);
DCMat4x4Set(dc,Mat4x4IdentNew(task));
dc->x=task->pix_width -2*map_width;
dc->y=task->pix_height-2*map_height;
dc->z=0;
dc->transform=&DCTransform;
dc->pen_width=2;
for (i=0;i<map_height;i++)
for (j=0;j<map_width;j++) {
dc->color=map[(map_height-1-i)*map_width+j];
GrPlot3(dc,2*j,2*i,0);
}
//Draw Things on heads-up Map
dc->color=LTPURPLE;
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead)
GrPlot3(dc,2*(tmpm->x/SCRN_SCALE),
2*(map_height-1-tmpm->y/SCRN_SCALE),0);
dc->color=LTCYAN;
GrPlot3(dc,2*(man_xx/SCRN_SCALE),2*(map_height-1-man_yy/SCRN_SCALE),0);
if (tf) {
dc->color=LTRED;
if (Blink)
GrPrint(dc,cx-(FONT_WIDTH*14)/2,cy-FONT_HEIGHT/2,"Game Completed");
tt=tf;
} else {
dc->color=LTGREEN;
GrLine(dc,cx-5,cy,cx+5,cy);
GrLine(dc,cx,cy-5,cx,cy+5);
tt=tS;
}
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",
monsters_left,tt-t0,best_score);
Free(s2w);
Seed(0);
}
U0 Fire()
{
I64 i,x,y;
F64 d,dx,dy,xx=Cos(man_é),yy=Sin(man_é);
Monster *tmpm;
Noise(100,53,74);
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (!tmpm->dead &&
LOS(x,y,man_xx,man_yy)) {
dx=x-man_xx;
dy=man_yy-y;
if (d=Sqrt(dx*dx+dy*dy)) {
dx/=d;
dy/=d;
if (dx*xx+dy*yy>0.995) {
tmpm->dead=TRUE;
if (!--monsters_left) {
tf=tS;
if (tf-t0<best_score)
best_score=tf-t0;
}
}
}
}
}
}
U0 Init()
{
I64 i,x,y;
CDC *dc;
Monster *tmpm;
DocClear;
"$$BG,BLACK$$%h*c",TEXT_ROWS/2,'\n';
dc=Sprite2DC($IB,"<1>",BI=1$);
map_width =dc->width/MAP_SCALE+2;
map_height=dc->height/MAP_SCALE+2;
Free(map);
Free(panels_processed_bitmap);
map=CAlloc(map_width*map_height*sizeof(U8));
panels_processed_bitmap=MAlloc((map_width*map_height+7)>>3);
for (y=0;y<map_height-2;y++)
for (x=0;x<map_width-2;x++)
map[(map_height-2-y)*map_width+x+1]=GrPeek(dc,x*MAP_SCALE,y*MAP_SCALE);
DCDel(dc);
man_xx=(1+MAN_START_X)*SCRN_SCALE;
man_yy=(map_height-1-MAN_START_Y)*SCRN_SCALE;
man_é=0;
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
tmpm->dead=FALSE;
do {
tmpm->x=RandU64%((map_width-2)*SCRN_SCALE)+SCRN_SCALE;
tmpm->y=RandU64%((map_height-2)*SCRN_SCALE)+SCRN_SCALE;
} while (!map[(tmpm->y/SCRN_SCALE)*map_width+tmpm->x/SCRN_SCALE]);
}
monsters_left=MONSTERS_NUM;
tf=0;
t0=tS;
}
U0 AnimateTask(I64)
{
I64 i,x,y,dd;
Monster *tmpm;
while (TRUE) {
dd=0.25*SCRN_SCALE*Sin(tS/2);
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead) {
x=tmpm->x;
y=tmpm->y;
if (i&1)
x+=dd;
else
y+=dd;
if (0<=x<=map_width*SCRN_SCALE &&
0<=y<=map_height*SCRN_SCALE &&
map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE]) {
if (!map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE+1] &&
x-RoundI64(x,SCRN_SCALE)>SCRN_SCALE/2 ||
!map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE-1] &&
x-RoundI64(x,SCRN_SCALE)<SCRN_SCALE/2)
x=RoundI64(x,SCRN_SCALE)+SCRN_SCALE/2;
if (!map[(y/SCRN_SCALE+1)*map_width+x/SCRN_SCALE] &&
y-RoundI64(y,SCRN_SCALE)>SCRN_SCALE/2 ||
!map[(y/SCRN_SCALE-1)*map_width+x/SCRN_SCALE] &&
y-RoundI64(y,SCRN_SCALE)<SCRN_SCALE/2)
y=RoundI64(y,SCRN_SCALE)+SCRN_SCALE/2;
tmpm->x=x;
tmpm->y=y;
}
}
Sleep(20);
}
}
U0 CleanUp()
{
Free(map);
Free(panels_processed_bitmap);
map=NULL;
panels_processed_bitmap=NULL;
}
U0 SongTask(I64)
{//Song by Terry A. Davis
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
Play("3q.A#eGAeA#qAq.A#eGeAeA#qA");
Play("3q.A#eGA#AqGq.A#eGA#AqG");
Play("4eA#AqGeA#AqGeA#AGAA#AqG");
}
}
U0 MoveMan(F64 é)
{
I64 x,y,color,step=SCRN_SCALE/2;
do {
x=man_xx+step*Cos(é);
y=man_yy-step*Sin(é);
x=Clamp(x,0,map_width*SCRN_SCALE);
y=Clamp(y,0,map_height*SCRN_SCALE);
color=map[y/SCRN_SCALE*map_width+x/SCRN_SCALE];
if (color==DKGRAY || color==GREEN) {
man_xx=x;
man_yy=y;
break;
} else
step>>=1;
} while (step);
}
#define MICRO_STEPS 4
U0 RotateMan(F64 d)
{
I64 i;
for (i=0;i<MICRO_STEPS;i++) {
man_é+=d/MICRO_STEPS;
Sleep(15);
}
}
U0 CastleFrankenstein()
{
I64 sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Fwd(,,SC_CURSOR_UP);"
" Bwd(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
" Fire(,CH_SPACE);"
"}"
);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=DKGRAY<<4+WHITE;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (GetKey(&sc)) {
case CH_SPACE:
Fire;
break;
case '\n':
Init;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto fs_done;
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
Spawn(&RotateMan,(ã/32)(I64));
break;
case SC_CURSOR_LEFT:
Spawn(&RotateMan,(-ã/32)(I64));
break;
case SC_CURSOR_UP:
MoveMan(man_é);
break;
case SC_CURSOR_DOWN:
MoveMan(man_é+ã);
break;
}
break;
}
}
fs_done:
} catch
PutExcept;
DocClear;
SettingsPop;
CleanUp;
MenuPop;
RegWrite("TempleOS/CastleFrankenstein","F64 best_score=%5.4f;\n",
best_score);
}
CastleFrankenstein;
&
 
 
<
<<
< 
,,,
$8
88
8$
$$
$4
44
4 (
( (
(0
,0T0
T0TL
TL,L
,L,4
04P4
P4PH
PH0H
0H08
08L8
L8LD
LD4D
4D4<
4<H<
H<H@
H@8@
T@l@
l4lL
lLˆL
ˆLˆ$
ˆ$€$
€$€0
€0l0
p4„4
„(„H
€HpH
pDp8
p8€8
€8€D
€DtH
tDt<
t<|<
x@|@
|DxD
„ „
„t
pp
p\
\\
\l
lh
ll
l`
``
`d
dd
h h
XT
PP
PL
LL
(@@
8H
HH
H8
88
8D
D D
D < Z,u
@ Z
DD<
DDD\
D\DdT0T8THL0LLd d hh88x8|8|4x4tt$t@8HLL,L4L<LZ<HñÿÿÿñÿÿÿØÿÿÿìÿÿÿØÿÿÿûÿÿÿ¿ÿÿÿ¿ÿÿÿØÿÿÿØÿÿÿìÿÿÿƒÿÿÿçÿÿÿƒÿÿÿûÿÿÿƒÿÿÿƒÿÿÿ
tÿÿÿöÿÿÿtÿÿÿ
¿ÿÿÿöÿÿÿ¿ÿÿÿƒÿÿÿ
tÿÿÿ
ƒÿÿÿ
ûÿÿÿƒÿÿÿ
çÿÿÿƒÿÿÿ
¿ÿÿÿ
¿ÿÿÿ
ûÿÿÿ¿ÿÿÿ
öÿÿÿ¿ÿÿÿ
ìÿÿÿØÿÿÿ
ñÿÿÿØÿÿÿ
Øÿÿÿ
Øÿÿÿ
ûÿÿÿ
ûÿÿÿ
ñÿÿÿûÿÿÿ
ìÿÿÿûÿÿÿ
ƒÿÿÿ
ìÿÿÿƒÿÿÿ
çÿÿÿ«ÿÿÿ-ìÿÿÿ«ÿÿÿ-«ÿÿÿ-«ÿÿÿ-°ÿÿÿ-°ÿÿÿ-ìÿÿÿ°ÿÿÿ-çÿÿÿ°ÿÿÿ-øÿÿÿxÿÿÿ ýÿÿÿ|ÿÿÿ xÿÿÿ xÿÿÿ |ÿÿÿ öÿÿÿtÿÿÿ
ÿÿÿÿxÿÿÿ ìÿÿÿûÿÿÿñÿÿÿûÿÿÿñÿÿÿûÿÿÿûÿÿÿìÿÿÿ
 ␍    !!&''"#%$$#    ␍ ␍!


 $%*$*+'&('()&(( $++
0/.112-,7 765343! 3 45833!839;:7;766;;1␍Z<HñÿÿÿöÿÿÿñÿÿÿØÿÿÿìÿÿÿØÿÿÿûÿÿÿ¿ÿÿÿ¿ÿÿÿØÿÿÿØÿÿÿìÿÿÿöÿÿÿƒÿÿÿçÿÿÿƒÿÿÿûÿÿÿƒÿÿÿƒÿÿÿ
tÿÿÿöÿÿÿtÿÿÿ
¿ÿÿÿöÿÿÿ¿ÿÿÿƒÿÿÿ
tÿÿÿ
ƒÿÿÿ
ûÿÿÿƒÿÿÿ
çÿÿÿƒÿÿÿ
¿ÿÿÿ
¿ÿÿÿ
ûÿÿÿ¿ÿÿÿ
öÿÿÿ¿ÿÿÿ
ìÿÿÿØÿÿÿ
ñÿÿÿØÿÿÿ
Øÿÿÿ
Øÿÿÿ
ûÿÿÿûÿÿÿñÿÿÿûÿÿÿìÿÿÿûÿÿÿƒÿÿÿ
ìÿÿÿƒÿÿÿ
çÿÿÿ«ÿÿÿ-ìÿÿÿ«ÿÿÿ-«ÿÿÿÓÿÿÿ«ÿÿÿÓÿÿÿ°ÿÿÿÓÿÿÿ°ÿÿÿÓÿÿÿìÿÿÿ°ÿÿÿ-çÿÿÿ°ÿÿÿ-øÿÿÿxÿÿÿ ýÿÿÿ|ÿÿÿ xÿÿÿ xÿÿÿ |ÿÿÿ öÿÿÿtÿÿÿ
ÿÿÿÿxÿÿÿ ìÿÿÿûÿÿÿñÿÿÿûÿÿÿñÿÿÿûÿÿÿ-ûÿÿÿ-ìÿÿÿ--
 ␍    !!&''"#%$$#    ␍ ␍!


 $%*$*+'&('()&(( $++
0/.112-,7 765343! 3 45833!839;:7;766;;1␍Z<HñÿÿÿñÿÿÿØÿÿÿìÿÿÿØÿÿÿûÿÿÿ¿ÿÿÿ¿ÿÿÿØÿÿÿØÿÿÿìÿÿÿöÿÿÿƒÿÿÿçÿÿÿƒÿÿÿûÿÿÿƒÿÿÿƒÿÿÿ
tÿÿÿöÿÿÿtÿÿÿ
¿ÿÿÿöÿÿÿ¿ÿÿÿƒÿÿÿ
tÿÿÿ
ƒÿÿÿ
ûÿÿÿƒÿÿÿ
çÿÿÿƒÿÿÿ
¿ÿÿÿ
¿ÿÿÿ
ûÿÿÿ¿ÿÿÿ
öÿÿÿ¿ÿÿÿ
ìÿÿÿØÿÿÿ
ñÿÿÿØÿÿÿ
Øÿÿÿ
Øÿÿÿ
ûÿÿÿûÿÿÿñÿÿÿûÿÿÿìÿÿÿûÿÿÿƒÿÿÿ
ìÿÿÿƒÿÿÿ
çÿÿÿ«ÿÿÿÓÿÿÿìÿÿÿ«ÿÿÿÓÿÿÿ«ÿÿÿ-«ÿÿÿ-°ÿÿÿ-°ÿÿÿ-ìÿÿÿ°ÿÿÿÓÿÿÿçÿÿÿ°ÿÿÿÓÿÿÿøÿÿÿxÿÿÿ ýÿÿÿ|ÿÿÿ xÿÿÿ xÿÿÿ |ÿÿÿ öÿÿÿtÿÿÿ
ÿÿÿÿxÿÿÿ ìÿÿÿûÿÿÿ#ñÿÿÿûÿÿÿ#ñÿÿÿ#ûÿÿÿûÿÿÿìÿÿÿ#öÿÿÿ
 ␍    !!&''"#%$$#    ␍ ␍!


 $%*$*+'&('()&(( $++
0/.112-,7 765343! 3 45833!839;:7;766;;1␍,ÎÿÿÿÎÿÿÿûÿÿÿçÿÿÿûÿÿÿçÿÿÿµÿÿÿ�ÿÿÿƒÿÿÿ�ÿÿÿâÿÿÿµÿÿÿâÿÿÿûÿÿÿÎÿÿÿûÿÿÿÎÿÿÿûÿÿÿûÿÿÿçÿÿÿûÿÿÿûÿÿÿçÿÿÿûÿÿÿµÿÿÿûÿÿÿ�ÿÿÿûÿÿÿ�ÿÿÿâÿÿÿûÿÿÿµÿÿÿâÿÿÿ�ÿÿÿµÿÿÿâÿÿÿµÿÿÿâÿÿÿ�ÿÿÿ�ÿÿÿûÿÿÿµÿÿÿûÿÿÿâÿÿÿµÿÿÿûÿÿÿâÿÿÿ�ÿÿÿûÿÿÿ 


  ␍␍ ␍ 
 

 ␍
␍÷ÿÿÿ÷ÿÿÿñÿÿÿ÷ÿÿÿ ôÿÿÿ ÷ÿÿÿ øÿÿÿçÿÿÿìÿÿÿçÿÿÿìÿÿÿçÿÿÿøÿÿÿøÿÿÿçÿÿÿðÿÿÿçÿÿÿðÿÿÿçÿÿÿøÿÿÿçÿÿÿçÿÿÿ   ␍ ␍ 
   


   ␍ ␍␍(Øÿÿÿ(ØÿÿÿØÿÿÿØÿÿÿìÿÿÿÎÿÿÿÎÿÿÿìÿÿÿ‚‚ìÿÿÿ‚ìÿÿÿìÿÿÿ‚öÿÿÿâÿÿÿ‚
âÿÿÿ‚ìÿÿÿ  


  

     ␍␍ ␍  
+191
View File
@@ -0,0 +1,191 @@
/*
Char graphics are how games on the C64 were made. You don't need to do it
this way, unless for fun. You can just make device context bigger than
the scrn and scroll around.
See $LK,"::/Demo/Games/RawHide.HC"$ or $LK,"::/Demo/Games/BigGuns.HC"$.
The nice thing about character graphics are the animations.
*/
#define MAP_WIDTH (TEXT_COLS*2)
#define MAP_HEIGHT (TEXT_ROWS*2)
#define CH_WATER '^'
#define CH_LAND CH_SPACE
#define CH_TREE '*'
U16 map[MAP_HEIGHT][MAP_WIDTH];
I64 scrn_pix_x,scrn_pix_y;
U0 DrawIt(CTask *task,CDC *)
{
U16 *ptr;
I64 i,j,y=scrn_pix_y>>3;
gr.hide_col=gr.hide_row=TRUE;
gr.pan_text_x=7-scrn_pix_x&7;
gr.pan_text_y=7-scrn_pix_y&7;
for (i=0;i<task->win_height;i++) {
ptr=&map[y++][scrn_pix_x>>3];
for (j=0;j<task->win_width;j++)
//By the time you clip to window and handle Fs->scroll_x,Fs->scroll_y,
//it is too much trouble to do raw access to gr.text_base like we do
//in $LK,"::/Demo/Games/Maze.HC"$.
TextChar(task,FALSE,j,i,*ptr++);
}
}
U8 *old_font=text.font;
U64 waves[4]={
0x0011AA440011AA44,0x0022558800225588,
0x0044AA110044AA11,0x0088552200885522};
U0 AnimateEndCB()
{
text.font=old_font;
Exit;
}
U0 AnimateTask(I64)
{
I64 i;
U64 *font=MAlloc(256*8);
Fs->task_end_cb=&AnimateEndCB;
MemCpy(font,text.font,256*8);
text.font=font;
font[CH_TREE]=0x18187E7E3C3C18;
while (TRUE) {
font[CH_WATER]=waves[i++&0x3];
Sleep(200);
Refresh;
}
}
U0 ScrollTaskX(I64 sign)
{
I64 i;
for (i=0;i<32;i++) {
scrn_pix_x=ClampI64(scrn_pix_x+sign,0,
(MAP_WIDTH-TEXT_COLS+1)*FONT_WIDTH);
Refresh;
}
}
U0 ScrollTaskY(I64 sign)
{
I64 i;
for (i=0;i<32;i++) {
scrn_pix_y=ClampI64(scrn_pix_y+sign,0,
(MAP_HEIGHT-TEXT_ROWS+2)*FONT_HEIGHT);
Refresh;
}
}
U0 Init()
{
I64 i,j,x,y;
scrn_pix_x=(MAP_WIDTH-TEXT_COLS)>>1*FONT_WIDTH;
scrn_pix_y=(MAP_HEIGHT-TEXT_ROWS)>>1*FONT_HEIGHT;
MemSetU16(map,CH_WATER+(BLUE<<4+LTBLUE)<<8,MAP_WIDTH*MAP_HEIGHT);
for (i=1;i<MAP_WIDTH-1;i++)
map[0][i]=map[MAP_HEIGHT-1][i]='Í'+(BLUE<<4+RED)<<8;
for (i=1;i<MAP_HEIGHT-1;i++)
map[i][0]=map[i][MAP_WIDTH-1]='º'+(BLUE<<4+RED)<<8;
map[0][0] ='É'+(BLUE<<4+RED)<<8;
map[0][MAP_WIDTH-1] ='»'+(BLUE<<4+RED)<<8;
map[MAP_HEIGHT-1][0] ='È'+(BLUE<<4+RED)<<8;
map[MAP_HEIGHT-1][MAP_WIDTH-1]='¼'+(BLUE<<4+RED)<<8;
for (i=0;i<20;i++) {
x=MAP_WIDTH*Rand;
y=MAP_HEIGHT*Rand;
for (j=0;j<1000;j++) {
map[y][x]=CH_LAND+(YELLOW<<4+BLACK)<<8;
x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
}
}
for (i=0;i<100;i++) {
do {
x=MAP_WIDTH*Rand;
y=MAP_HEIGHT*Rand;
} while (map[y][x].u8[0]!=CH_LAND);
for (j=0;j<100;j++) {
map[y][x]=CH_TREE+(YELLOW<<4+GREEN)<<8;
x=ClampI64(x+RandU16%3-1,0,MAP_WIDTH-1);
y=ClampI64(y+RandU16%3-1,0,MAP_HEIGHT-1);
}
}
}
U0 CleanUp()
{
gr.pan_text_x=gr.pan_text_y=0;
gr.hide_col=gr.hide_row=FALSE;
}
U0 CharDemo()
{
I64 sc;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=YELLOW<<4+BLUE;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
" Up(,,SC_CURSOR_UP);"
" Down(,,SC_CURSOR_DOWN);"
"}"
);
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (GetKey(&sc)) {
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_LEFT:
Spawn(&ScrollTaskX,-1,"Scroll",,Fs);
break;
case SC_CURSOR_RIGHT:
Spawn(&ScrollTaskX,1,"Scroll",,Fs);
break;
case SC_CURSOR_UP:
Spawn(&ScrollTaskY,-1,"Scroll",,Fs);
break;
case SC_CURSOR_DOWN:
Spawn(&ScrollTaskY,1,"Scroll",,Fs);
break;
}
break;
case '\n':
CleanUp;
Init;
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto sq_done;
}
}
sq_done: //Don't goto out of try
} catch
PutExcept;
SettingsPop;
CleanUp;
MenuPop;
}
CharDemo;
+128
View File
@@ -0,0 +1,128 @@
//Practice tracing circles
//Giotto, a famous artist, drew a freehand circle to get a job.
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;
U0 SongTask(I64)
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE)
Play("5hEDC4A5RCDECR");
}
U0 DrawIt(CTask *task,CDC *dc)
{
GrPrint(dc,0,0,"Error:%6.3f Time:%6.3f Score:%6.3f Best:%8.3f",
avg_error,elapsed_time,score,best_score);
}
#define CIRCLE_RADIUS 100
#define CIRCUMFERENCE (2*ã*CIRCLE_RADIUS)
Bool CTPlot(CDC *dc,I64 x,I64 y,I64)
{
F64 rad=Sqrt(Sqr(x-cx)+Sqr(y-cy));
GrPlot(dc,x,y);
total_error+=Abs(rad-CIRCLE_RADIUS);
return TRUE;
}
U0 CircleTrace()
{
I64 msg_code,arg1,arg2,x1,y1;
F64 rad,t0,total_distance;
CDC *dc=DCAlias;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
cx=Fs->pix_width/2;
cy=Fs->pix_height/2;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
Fs->draw_it=&DrawIt;
DCFill;
dc->color=ROP_XOR+BLACK^TRANSPARENT;
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
do {
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN);
switch (msg_code) {
case MSG_KEY_UP:
break;
case MSG_MS_L_DOWN:
DCFill;
dc->color=ROP_XOR+BLACK^TRANSPARENT;
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
dc->color=ROP_XOR+RED^TRANSPARENT;
t0=tS;
total_distance=0.001;
total_error=0;
x1=arg1; y1=arg2;
do {
msg_code=ScanMsg(&arg1,&arg2,
1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
switch (msg_code) {
case MSG_MS_L_UP:
break;
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));
total_error-=Abs(rad-CIRCLE_RADIUS);
}
break;
}
elapsed_time=tS-t0;
avg_error=total_error/total_distance;
score=elapsed_time*avg_error;
//$LK,"Sleep",A="MN:Sleep"$()s until the next time the
//window mgr task runs. The
//window mgr calls the UpdateWin() routine
//and places msgs in the que, so there's
//no need to do anything until the window mgr runs.
Refresh;
} while (msg_code!=MSG_MS_L_UP);
music.mute=TRUE; Sleep(200);
if (total_distance>0.95*CIRCUMFERENCE) {
if (score<best_score) {
Snd(86);Sleep(50);Snd;Sleep(50);
Snd(86);Sleep(50);Snd;Sleep(50);
Snd(86);Sleep(50);
best_score=score;
} else {
Snd(62);Sleep(50);
}
} else {
Snd(34);Sleep(1000);
}
Snd; Sleep(200); music.mute=FALSE;
break;
}
} while (msg_code!=MSG_KEY_DOWN || arg1!=CH_SHIFT_ESC && arg1!=CH_ESC);
GetMsg(,,1<<MSG_KEY_UP);
SettingsPop;
DCFill;
DCDel(dc);
RegWrite("TempleOS/CircleTrace","F64 best_score=%5.4f;\n",best_score);
}
CircleTrace; //Execute when #included
Binary file not shown.
+80
View File
@@ -0,0 +1,80 @@
//This loads a lst of zero terminated
//strings into the sym table and
//gives a name to it. Strings like
//this are known as Define entries.
//See $LK,"ST_RAINBOW_10",A="FF:::/Adam/Gr/GrPalette.HC,ST_RAINBOW_10"$
U0 PrintDigit(U8 ch)
{
//The %Z code displays a Define subentry
if ('0'<=ch<='9')
"$$FG,%Z$$%d$$FG$$",ch-'0',"ST_RAINBOW_10",ch-'0';
}
U0 PrintPattern(U8 *st)
{
I64 ch;
while (ch=*st++)
PrintDigit(ch);
'\n';
}
U0 Digits()
{
I64 num,ch,i;
U8 answer[1024];
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=DKGRAY<<4+WHITE;
DocClear;
//Set default background and foreground
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$"
"\nThis is a memory game. "
"Try to remember the digits and enter them. "
"They are colored based on electrical "
"engineering color codes.\n";
for (i=0;i<10;i++)
"$$FG,%Z$$%d: %Z\n",i,"ST_RAINBOW_10",i,i,"ST_RAINBOW_10";
"$$FG$$\n"; //set to default background
ch=PressAKey;
if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
while (TRUE) {
restart:
num=0;
//Set to zeros so we have terminators
MemSet(answer,0,sizeof(answer));
while (TRUE) {
DocClear;
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$\n";
"Pattern\nLength:%d\n\n",num+1;
answer[num++]=RandU32%10+'0';
PrintPattern(answer);
ch=PressAKey;
if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
DocClear;
"$$WW,1$$$$BG,DKGRAY$$$$FD,WHITE$$\n";
"Guess\nLength:%d\n\n",num;
for (i=0;i<num;i++) {
ch=GetChar(,FALSE);
if (ch==CH_ESC||ch==CH_SHIFT_ESC) goto dg_done;
PrintDigit(ch);
if (ch!=answer[i]) {
"\nScore:%d\n",num;
PrintPattern(answer);
Beep; Beep;
ch=PressAKey;
if (ch==CH_ESC||ch==CH_SHIFT_ESC)
goto dg_done;
else
goto restart;
}
}
}
}
dg_done:
DocClear;
SettingsPop;
}
Digits;
+569
View File
@@ -0,0 +1,569 @@
RegDft("TempleOS/DunGen","F64 best_score=9999;\n");
RegExe("TempleOS/DunGen");
//Set snap to 4 and width to 4
//if you edit this map.
//Don't forget to change the
//starting pos.
$BG,0$
$SP,"<1>",BI=1$
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
$SP,"<7>",BI=7$
$SP,"<8>",BI=8$
$SP,"<9>",BI=9$
$SP,"<10>",BI=10$
$BG$//These are indexed by color #.
//See $LK,"COLORS",A="MN:RED"$.
U8 *tiles1[16]={NULL,$IB,"<7>",BI=7$ ,$IB,"<5>",BI=5$ ,NULL,NULL,NULL,NULL,NULL,
$IB,"<6>",BI=6$ ,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
U8 *tiles2[16]={NULL,$IB,"<8>",BI=8$ ,$IB,"<5>",BI=5$ ,NULL,NULL,NULL,NULL,NULL,
$IB,"<6>",BI=6$ ,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
#define SCRN_SCALE 24
#define SCRN_WIDTH 24
#define SCRN_HEIGHT 24
I64 scrn_x,scrn_y;
#define MAP_SCALE 4
I64 map_width,map_height;
U8 *map=NULL;
I64 man_x,man_y,man_dx,man_dy;
Bool man_attack;
F64 man_attack_t0;
#define MONSTERS_NUM 10
I64 monsters_left;
class Monster
{
I64 x,y,dx,dy;
Bool dead,pad[7];
} monsters[MONSTERS_NUM];
F64 t0,tf;
#define LOS_SCALE 4
Bool LOSPlot(U8 *,I64 x,I64 y,I64)
{
if (!map[(y/LOS_SCALE)*map_width+(x/LOS_SCALE)])
return FALSE;
else
return TRUE;
}
Bool LOS(I64 x1,I64 y1,I64 x2,I64 y2)
{//Line of sight
return Line(NULL,x1*LOS_SCALE+LOS_SCALE/2,y1*LOS_SCALE+LOS_SCALE/2,0,
x2*LOS_SCALE+LOS_SCALE/2,y2*LOS_SCALE+LOS_SCALE/2,0,&LOSPlot);
}
U0 DrawIt(CTask *task,CDC *dc)
{
CDC *dc_t=DCAlias(gr.dc2,task);
I64 i,x,y,xx,yy,x1,y1,z1,color,
cx=task->pix_width/2,
cy=task->pix_height/2;
CD3I32 poly[4];
U8 **_tiles;
F64 tt;
Monster *tmpm;
if (Blink(5))
_tiles=tiles1;
else
_tiles=tiles2;
Mat4x4RotX(dc_t->r,60*2*ã/360);
Mat4x4RotZ(dc_t->r,15*2*ã/360);
DCMat4x4Set(dc_t,dc_t->r);
dc_t->x=task->pix_width/2;
dc_t->y=task->pix_height/2;
dc_t->flags|=DCF_TRANSFORMATION;
//You could make it much more efficient
//if you did it like $LK,"::/Demo/Games/BigGuns.HC"$
//with a $LK,"CDC",A="MN:CDC"$.
for (y=-SCRN_HEIGHT/2;y<SCRN_HEIGHT/2;y++) {
yy=y+scrn_y;
if (0<=yy<map_height)
for (x=-SCRN_WIDTH/2;x<SCRN_WIDTH/2;x++) {
xx=x+scrn_x;
if (0<=xx<map_width) {
if ((color=map[yy*map_width+xx]) &&
LOS(xx,yy,man_x,man_y)) {
if (_tiles[color]) {
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,_tiles[color]);
} else {//If no tile defined, do solid color.
poly[0].x=x*SCRN_SCALE;
poly[0].y=y*SCRN_SCALE;
poly[0].z=0;
poly[1].x=(x+1)*SCRN_SCALE-1;
poly[1].y=y*SCRN_SCALE;
poly[1].z=0;
poly[2].x=(x+1)*SCRN_SCALE;
poly[2].y=(y+1)*SCRN_SCALE-1;
poly[2].z=0;
poly[3].x=x*SCRN_SCALE-1;
poly[3].y=(y+1)*SCRN_SCALE-1;
poly[3].z=0;
dc_t->color=color;
GrFillPoly3(dc_t,4,poly);
}
}
}
}
}
for (y=-SCRN_HEIGHT/2;y<SCRN_HEIGHT/2;y++) {
yy=y+scrn_y;
if (0<=yy<map_height)
for (x=-SCRN_WIDTH/2;x<SCRN_WIDTH/2;x++) {
xx=x+scrn_x;
if (0<=xx<map_width) {
if (!map[yy*map_width+xx]) {
if (yy+1<map_height && LOS(xx,yy+1,man_x,man_y)) {
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,$IB,"<9>",BI=9$);
}
if (xx+1<map_width && LOS(xx+1,yy,man_x,man_y)) {
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,$IB,"<10>",BI=10$);
}
}
}
}
}
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead && LOS(tmpm->x,tmpm->y,man_x,man_y)) {
x1=(tmpm->x-scrn_x)*SCRN_SCALE+SCRN_SCALE/2;
y1=(tmpm->y-scrn_y)*SCRN_SCALE+SCRN_SCALE/2;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
if (tmpm->dx<0) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,x1,y1,x1,y1+1);
} else
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
Sprite3(dc,x1,y1,z1,$IB,"<4>",BI=4$);
}
x1=(man_x-scrn_x)*SCRN_SCALE+SCRN_SCALE/2;
y1=(man_y-scrn_y)*SCRN_SCALE+SCRN_SCALE/2;
z1=0;
if (tS-man_attack_t0<0.2) {
x1+=Tri(tS-man_attack_t0,0.2)*SCRN_SCALE*man_dx;
y1+=Tri(tS-man_attack_t0,0.2)*SCRN_SCALE*man_dy;
if (man_dy!=1)
y1-=Saw(tS-man_attack_t0,0.2)*SCRN_SCALE;
}
DCTransform(dc_t,&x1,&y1,&z1);
if (man_dx<0) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,x1,y1,x1,y1+1);
} else
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
if (tS-man_attack_t0<0.2)
Sprite3(dc,x1,y1,z1,$IB,"<3>",BI=3$);
else
Sprite3(dc,x1,y1,z1,$IB,"<2>",BI=2$);
DCDel(dc_t);
if (tf) {
dc->color=LTRED;
if (Blink)
GrPrint(dc,cx-(FONT_WIDTH*14)/2,cy-FONT_HEIGHT/2,"Game Completed");
tt=tf;
} else {
dc->color=LTGREEN;
tt=tS;
}
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",
monsters_left,tt-t0,best_score);
}
U0 Attack()
{
I64 i;
Monster *tmpm;
man_attack_t0=tS;
Noise(100,53,74);
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
if (!tmpm->dead &&
man_x+man_dx==tmpm->x && man_y+man_dy==tmpm->y) {
tmpm->dead=TRUE;
if (!--monsters_left) {
tf=tS;
if (tf-t0<best_score)
best_score=tf-t0;
}
}
}
}
U0 Init()
{
I64 i,x,y;
CDC *dc;
Monster *tmpm;
dc=Sprite2DC($IB,"<1>",BI=1$);
map_width =dc->width/MAP_SCALE;
map_height=dc->height/MAP_SCALE;
Free(map);
map=MAlloc(map_width*map_height*sizeof(U8));
for (y=0;y<map_height;y++)
for (x=0;x<map_width;x++)
map[y*map_width+x]=GrPeek(dc,x*MAP_SCALE,y*MAP_SCALE);
DCDel(dc);
man_attack_t0=0;
man_attack=FALSE;
man_x=0;
man_y=4;
man_dx=0;
man_dy=0;
scrn_x=0;
scrn_y=0;
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++) {
tmpm->dead=FALSE;
tmpm->dx=0;
tmpm->dy=0;
do {
tmpm->x=RandU64%(map_width-2)+1;
tmpm->y=RandU64%(map_height-2)+1;
} while (!map[(tmpm->y)*map_width+tmpm->x]);
}
monsters_left=MONSTERS_NUM;
tf=0;
t0=tS;
}
U0 CleanUp()
{
Free(map);
map=NULL;
}
U0 AnimateTask(I64)
{
I64 i,x,y,dx,dy;
Monster *tmpm;
while (TRUE) {
for (i=0,tmpm=monsters;i<MONSTERS_NUM;i++,tmpm++)
if (!tmpm->dead) {
dx=RandU16%3-1;
dy=RandU16%3-1;
x=tmpm->x+dx;
y=tmpm->y+dy;
if (0<=x<map_width && 0<=y<map_height && map[y*map_width+x]) {
tmpm->x=x;
tmpm->y=y;
tmpm->dx=dx;
tmpm->dy=dy;
}
}
Sleep(1000);
}
}
U0 DunGen()
{
I64 ch,sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Up(,,SC_CURSOR_UP);"
" Down(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
" Attack(,CH_SPACE);"
"}"
);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=BLACK<<4+WHITE;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (GetMsg(&ch,&sc,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
case MSG_KEY_DOWN:
switch (ch) {
case '\n':
Init;
break;
case CH_SPACE:
man_attack=TRUE;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto dg_done;
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
if (man_attack) {
man_dx=1;
man_dy=0;
Attack;
} else
if (man_x+1<map_width &&
map[man_y*map_width+(man_x+1)]==DKGRAY) {
man_x++;
if (man_x-scrn_x>SCRN_WIDTH/2-3) {
scrn_x+=SCRN_WIDTH/2;
if (scrn_x+SCRN_WIDTH/2>map_width)
scrn_x=map_width-SCRN_WIDTH/2;
}
}
break;
case SC_CURSOR_LEFT:
if (man_attack) {
man_dx=-1;
man_dy=0;
Attack;
} else
if (man_x-1>=0 &&
map[man_y*map_width+(man_x-1)]==DKGRAY) {
man_x--;
if (man_x-scrn_x<-SCRN_WIDTH/2+3) {
scrn_x-=SCRN_WIDTH/2;
if (scrn_x-SCRN_WIDTH/2<0)
scrn_x=SCRN_WIDTH/2;
}
}
break;
case SC_CURSOR_UP:
if (man_attack) {
man_dx=0;
man_dy=-1;
Attack;
} else
if (man_y-1>=0 &&
map[(man_y-1)*map_width+man_x]==DKGRAY) {
man_y--;
if (man_y-scrn_y<-SCRN_HEIGHT/2+3) {
scrn_y-=SCRN_HEIGHT/2;
if (scrn_y-SCRN_HEIGHT/2<0)
scrn_y=SCRN_HEIGHT/2;
}
}
break;
case SC_CURSOR_DOWN:
if (man_attack) {
man_dx=0;
man_dy=1;
Attack;
} else
if (man_y+1<map_height &&
map[(man_y+1)*map_width+man_x]==DKGRAY) {
man_y++;
if (man_y-scrn_y>SCRN_HEIGHT/2-3) {
scrn_y+=SCRN_HEIGHT/2;
if (scrn_y+SCRN_HEIGHT/2>map_height)
scrn_y=map_height-SCRN_HEIGHT/2;
}
}
break;
}
}
break;
case MSG_KEY_UP:
if (ch==CH_SPACE)
man_attack=FALSE;
break;
}
}
dg_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
SettingsPop;
MenuPop;
RegWrite("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
CleanUp;
}
DunGen;
£
7
7üÿÿÿ7
7S
SSüÿÿÿ
Süÿÿÿ7üÿÿÿ
CC$
;O
OO
O;
;;
; K
K K
K?
??
?G
C(k(
k(kD
kDCD
CDC,
G,g,
g,g@
g@G@
G@G0
G0c0
c0c<
c<K<
K<K4
K4_4
_4_8
_8O8
k8ƒ8
ƒ,ƒD
ƒDŸD
ŸDŸ
Ÿ—
——(
—(ƒ(
‡,›,
› ›@
—@‡@
‡<‡0
‡0—0
—0—<
—<‹@
‹<‹4
‹4“4
�8“8
“<�<
››
›‹
‡üÿÿÿ‡
‡s
ssüÿÿÿ
süÿÿÿƒüÿÿÿ
ƒüÿÿÿ
ƒƒ
ƒw
ww
w{
{{

ok
gg
gc
cc
?8/8
+0+@
+@ @
@ 0
0'0
'0'<
'<#<
#<#4
787P
3P;P
;P;\
;\3\
3\3T
7T7X
[øÿÿÿ[4
[<[T
[T[\Oc0c<Òýÿÿÿëÿÿÿ&ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ²ýÿÿÿüÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ²ýÿÿÿüÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿ    ÿÿÿÿÿÿÿÿ   ÿÿÿÿ    ÿÿ      ÿÿ    ÿ    ÿ   ÿ       ÿ   ÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿ    ÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ²ýÿÿÿüÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿ     ÿÿÿÿ    ÿÿÿ    ÿÿÿÿ    ÿÿÿ    ÿÿÿ   ÿÿÿ       ÿÿÿÿÿÿÿÿÿÿÿÿÿ    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ²ýÿÿÿüÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
’ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ2õÿÿÿèÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿ ÿÿÿÿÿÿ ÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿ  ÿÿÿÿÿÿÿ ÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿ ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ‚øÿÿÿéÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ  ÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿÿÿÿÿÿ ÿÿÿÿ ÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿ ÿÿÿÿÿ ÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ"ùÿÿÿìÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ␍ÿÿÿÿÿÿÿÿÿ␍␍␍␍ÿÿÿÿÿÿÿÿÿÿÿ␍␍␍␍␍␍ÿÿÿÿÿÿÿÿÿÿ␍␍␍␍␍ÿÿÿÿÿÿÿÿÿÿÿÿ␍␍␍ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Binary file not shown.
Binary file not shown.
+901
View File
@@ -0,0 +1,901 @@
#define GAME_SPEED_SCALE 0.1
F64 game_speed,
launch_unit_x1,launch_unit_y1,launch_unit_x2,launch_unit_y2,launch_t,
return_unit_x1,return_unit_y1,return_unit_x2,return_unit_y2,return_t,
set_é_unit_x1,set_é_unit_y1,set_é_unit_x2,set_é_unit_y2,set_é_t,
next_noise;
CTask *main_task;
#define OT_CARRIER 0
#define OT_CRUISER 1
#define OT_FIGHTER 2
#define OT_TYPES_NUM 3
#define OF_SHIP 1
#define OF_ACTIVE 2
#define OF_RETURNING 4
#define OF_SHOOTING 8
#define FIRE_WIDTH 56
#define FIRE_HEIGHT 16
#define FIRE_X_SCALE 0.5
#define FIRE_Y_SCALE 0.5
#define FIRE_COLORS 16
U8 fire_colors[FIRE_COLORS]={
YELLOW,YELLOW,LTRED,YELLOW, BLACK,YELLOW,RED,YELLOW,
YELLOW,BLACK,YELLOW,LTRED, RED,YELLOW,DKGRAY,YELLOW};
class Obj
{
Obj *next,*last;
Obj *next_in_squadron,*last_in_squadron;
Obj *host;
U8 player,type;
U16 flags;
I16 squadron,member_num;
F64 x,y,é,dé,
speed,turn_rate,
life_percent,
target_x,target_y,
ship_guns,ship_guns_range,
air_guns,air_guns_range,
fuel,max_fuel,fuel_burn_rate,
death_time,next_action_time;
I32 torpedos,max_torpedos;
F64 torpedos_range;
U8 fire[(FIRE_WIDTH*FIRE_HEIGHT+7)/8];
} obj_head;
class Torpedo
{
Torpedo *next,*last;
Obj *target;
F64 x,y,é,speed,timeout;
} torpedo_head;
#define SA_PARKED 0
#define SA_LAUNCHING 1
#define SA_FLYING 2
#define SA_SET_é 3
#define SA_RETURNING 4
#define SA_DEAD 5
class Squadron : Obj
{
I64 action,dead_mask,total_mask;
} *squadrons;
U0 SquadronIns(Obj *o,Obj *pred)
{
Obj *succ=pred->next_in_squadron;
o->next_in_squadron=succ;
o->last_in_squadron=pred;
pred->next_in_squadron=o;
succ->last_in_squadron=o;
}
U0 SquadronRem(Obj *o)
{
Obj *pred=o->last_in_squadron,*succ=o->next_in_squadron;
pred->next_in_squadron=succ;
succ->last_in_squadron=pred;
}
#define PLAYERS_NUM 2
I64 num_carriers[PLAYERS_NUM]={2,3},
num_cruisers[PLAYERS_NUM]={2,3},
num_planes_per_squadron[PLAYERS_NUM]={6,5},
num_squadrons_per_carrier[PLAYERS_NUM]={2,3},
num_alive[PLAYERS_NUM],
num_squadrons;
Obj *ObjFind(F64 x,F64 y,
I64 flag_mask=OF_ACTIVE|OF_RETURNING,I64 flag_val=OF_ACTIVE,
I64 type_mask=-1,I64 player_mask=-1,F64 *_d=NULL)
{
Obj *tmpo=obj_head.next,*best=NULL;
F64 dd,best_dd=F64_MAX;
while (tmpo!=&obj_head) {
if (tmpo->flags&flag_mask==flag_val &&
Bt(&type_mask,tmpo->type)&&Bt(&player_mask,tmpo->player)) {
dd=Sqr(tmpo->x-x)+Sqr(tmpo->y-y);
if (dd<best_dd) {
best=tmpo;
best_dd=dd;
}
}
tmpo=tmpo->next;
}
if (_d) *_d=Sqrt(best_dd);
return best;
}
U0 ObjDel(Obj *tmpo)
{
if (tmpo) {
if (tS<tmpo->death_time)
tmpo->flags&=~OF_ACTIVE;
else {
if (tmpo->squadron>=0)
SquadronRem(tmpo);
QueRem(tmpo);
if (tmpo->squadron>=0)
LBts(&squadrons[tmpo->squadron].dead_mask,tmpo->member_num);
num_alive[tmpo->player]--;
Free(tmpo);
}
}
}
$BG,1$
$SP,"<1>",BI=1$
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
$BG$
U8 *imgs[PLAYERS_NUM][OT_TYPES_NUM]={{$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$},{$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$}};
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,j,k;
F64 d,cur_time=tS;
Obj *tmpo;
Torpedo *tmpt;
tmpt=torpedo_head.next;
while (tmpt!=&torpedo_head) {
dc->color=WHITE;
GrPlot(dc,tmpt->x,tmpt->y);
tmpt=tmpt->next;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && tmpo->flags&OF_SHIP) {
Sprite3ZB(dc,tmpo->x,tmpo->y,0,
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
k=0;
for (j=0;j<FIRE_HEIGHT;j++)
for (i=0;i<FIRE_WIDTH;i++)
if (Bt(tmpo->fire,k++)) {
dc->color=fire_colors[ToI64(k+10*tS)&(FIRE_COLORS-1)];
GrPlot(dc,
tmpo->x+FIRE_X_SCALE*(i-FIRE_WIDTH /2+(11*tS+i)%1.7)
*Cos(tmpo->é)-
FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(12*tS+j)%1.7)*Sin(tmpo->é),
tmpo->y+FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(19*tS+j)%1.7)
*Cos(tmpo->é)+
FIRE_X_SCALE*(i-FIRE_WIDTH /2+(13*tS+i)%1.7)*Sin(tmpo->é));
}
if (Blink) {
dc->color=BLACK;
GrLine(dc,tmpo->x+5,tmpo->y,tmpo->x+5+10,tmpo->y);
if (tmpo->life_percent>0) {
if (tmpo->life_percent<33)
dc->color=RED;
else if (tmpo->life_percent<66)
dc->color=YELLOW;
else
dc->color=GREEN;
GrLine(dc,tmpo->x+5,tmpo->y,
tmpo->x+5+10*tmpo->life_percent/100,tmpo->y);
}
dc->color=BLACK;
GrLine(dc,tmpo->x+5,tmpo->y+2,tmpo->x+5+10,tmpo->y+2);
d=tmpo->fuel*100/tmpo->max_fuel;
if (d>0) {
if (d<33)
dc->color=RED;
else if (d<66)
dc->color=YELLOW;
else
dc->color=GREEN;
GrLine(dc,tmpo->x+5,tmpo->y+2,tmpo->x+5+10*d/100,tmpo->y+2);
}
}
}
tmpo=tmpo->next;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && !(tmpo->flags&OF_SHIP))
Sprite3ZB(dc,tmpo->x,tmpo->y,0,
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
if (tmpo->flags&OF_SHOOTING) {
dc->color=LTRED;
GrLine(dc,tmpo->x,tmpo->y,tmpo->target_x,tmpo->target_y,3);
}
tmpo=tmpo->next;
}
dc->flags|=DCF_TRANSFORMATION;
if (cur_time<launch_t) {
dc->color=LTGREEN;
GrArrow3(dc,launch_unit_x1,launch_unit_y1,0,
launch_unit_x2,launch_unit_y2,0);
}
if (cur_time<return_t) {
dc->color=LTRED;
GrArrow3(dc,return_unit_x1,return_unit_y1,0,
return_unit_x2,return_unit_y2,0);
}
if (cur_time<set_é_t) {
dc->color=YELLOW;
GrArrow3(dc,set_é_unit_x1,set_é_unit_y1,0,
set_é_unit_x2,set_é_unit_y2,0);
}
dc->color=YELLOW;
GrPrint(dc,-task->scroll_x,-task->scroll_y,
"Game Speed: %5.2f",game_speed);
dc->color=LTCYAN;
GrPrint(dc,-task->scroll_x,-task->scroll_y+FONT_HEIGHT,
"Player 1: %d",num_alive[0]);
dc->color=LTPURPLE;
GrPrint(dc,-task->scroll_x,-task->scroll_y+2*FONT_HEIGHT,
"Player 2: %d",num_alive[1]);
if ((!num_alive[0]||!num_alive[1]) && Blink) {
if (!num_alive[1]) {
dc->color=LTGREEN;
GrPrint(dc,task->pix_width>>1 -(FONT_WIDTH*14)/2-task->scroll_x,
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Completed");
} else {
dc->color=LTRED;
GrPrint(dc,task->pix_width>>1 -(FONT_WIDTH*9)/2-task->scroll_x,
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Over");
}
}
}
U0 Init()
{
I64 i,fighter,ship,player,squadron,
w=Fs->pix_width,h=Fs->pix_height;
Squadron *tmps;
Obj *tmpo,*tmpo1;
QueInit(&obj_head);
QueInit(&torpedo_head);
next_noise=tS;
Fs->scroll_x=0;
Fs->scroll_y=0;
game_speed=1.0;
launch_t=return_t=set_é_t=0;
main_task=Fs;
num_squadrons=0;
for (player=0;player<PLAYERS_NUM;player++) {
num_alive[player]=0;
for (ship=0;ship<num_cruisers[player];ship++) {
tmpo1=CAlloc(sizeof(Obj));
num_alive[player]++;
tmpo1->type=OT_CRUISER; tmpo1->player=player;
tmpo1->squadron=-1; tmpo1->member_num=ship;
tmpo1->flags=OF_ACTIVE|OF_SHIP;
tmpo1->x=0.8*w*(Rand-0.5)+w>>1; tmpo1->y=0.8*h*(Rand-0.5)+h>>1;
tmpo1->host=NULL;
tmpo1->speed=35.0; tmpo1->turn_rate=2.5;
tmpo1->é=2*ã*(Rand-0.5); tmpo1->dé=0;
tmpo1->life_percent=100.0;
tmpo1->fuel=tmpo1->max_fuel=100000;
tmpo1->fuel_burn_rate=100.0;
tmpo1->air_guns =5000; tmpo1->air_guns_range =30.0;
tmpo1->ship_guns=10000; tmpo1->ship_guns_range=30.0;
tmpo1->torpedos =tmpo1->max_torpedos=0;
tmpo1->torpedos_range =0.0;
tmpo1->next_action_time=0;
QueIns(tmpo1,obj_head.last);
}
for (ship=0;ship<num_carriers[player];ship++) {
tmpo1=CAlloc(sizeof(Obj));
num_alive[player]++;
tmpo1->type=OT_CARRIER; tmpo1->player=player;
tmpo1->squadron=-1; tmpo1->member_num=ship;
tmpo1->flags=OF_ACTIVE|OF_SHIP;
tmpo1->x=0.8*w*(Rand-0.5)+w>>1; tmpo1->y=0.8*h*(Rand-0.5)+h>>1;
tmpo1->host=NULL;
tmpo1->speed=28.0; tmpo1->turn_rate=1.0;
tmpo1->é=2*ã*(Rand-0.5); tmpo1->dé=0;
tmpo1->life_percent=100.0;
tmpo1->fuel=tmpo1->max_fuel=750000;
tmpo1->fuel_burn_rate=500.0;
tmpo1->air_guns =5000; tmpo1->air_guns_range =20.0;
tmpo1->ship_guns=2000; tmpo1->ship_guns_range=30.0;
tmpo1->torpedos =tmpo1->max_torpedos=0;
tmpo1->torpedos_range =0.0;
tmpo1->next_action_time=0;
QueIns(tmpo1,obj_head.last);
for (squadron=0;squadron<num_squadrons_per_carrier[player];
squadron++,num_squadrons++) {
for (fighter=0;fighter<num_planes_per_squadron[player];fighter++) {
tmpo=CAlloc(sizeof(Obj));
num_alive[player]++;
tmpo->type=OT_FIGHTER; tmpo->player=player;
tmpo->squadron=num_squadrons; tmpo->member_num=fighter;
tmpo->flags=0;
tmpo->host=tmpo1;
tmpo->speed=300.0; tmpo->turn_rate=25.0;
tmpo->life_percent=100.0;
tmpo->fuel=tmpo->max_fuel=1000;
tmpo->fuel_burn_rate=1.0;
tmpo->air_guns =35000; tmpo->air_guns_range =8.0;
tmpo->ship_guns=0; tmpo->ship_guns_range=0.0;
tmpo->torpedos =tmpo->max_torpedos=1;
tmpo->torpedos_range =20.0;
QueIns(tmpo,obj_head.last);
}
}
}
}
squadrons=CAlloc(num_squadrons*sizeof(Squadron));
for (i=0,tmps=squadrons;i<num_squadrons;i++,tmps++) {
tmps->next_in_squadron=tmps->last_in_squadron=tmps;
tmps->squadron=i;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
tmps->host =tmpo->host;
tmps->player=tmpo->player;
tmps->total_mask=1<<num_planes_per_squadron[tmpo->player]-1;
SquadronIns(tmpo,tmps->last_in_squadron);
}
tmpo=tmpo->next;
}
}
U0 CleanUp()
{
QueDel(&obj_head,TRUE);
QueDel(&torpedo_head,TRUE);
Free(squadrons);
}
Obj *ObjLaunch(I64 player,I64 squadron=-1,
Obj *host=NULL,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Obj *tmpo;
F64 cur_time=tS;
if (!host)
host=ObjFind(x,y,,,1<<OT_CARRIER,1<<player);
if (host && cur_time>host->next_action_time) {
if (é==F64_MAX)
é=Arg(x-host->x,y-host->y);
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->host==host && (squadron<0||tmpo->squadron==squadron) &&
!(tmpo->flags&OF_ACTIVE) &&
(tmpo->squadron<0||squadrons[tmpo->squadron].action==SA_PARKED||
squadrons[tmpo->squadron].action==SA_LAUNCHING)) {
if (tmpo->fuel<=0.0)
//When low on fuel, not zero, gets launched and captured.
LBts(&squadrons[tmpo->squadron].dead_mask,tmpo->member_num);
else {
tmpo->flags=tmpo->flags&~OF_RETURNING|OF_ACTIVE;
tmpo->é=host->é;
if (x==F64_MAX || y==F64_MAX || Sqr(x-host->x)+Sqr(y-host->y)>3*3)
tmpo->dé=Wrap(é-tmpo->é,-ã);
else
tmpo->dé=0;
tmpo->x=host->x;
tmpo->y=host->y;
host->next_action_time=cur_time+0.25/game_speed;
return tmpo;
}
}
tmpo=tmpo->next;
}
}
return NULL;
}
Squadron *SquadronLaunch(I64 player,F64 x=F64_MAX,F64 y=F64_MAX)
{
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjLaunch(player,,,x,y)) {
if (player==0) {
launch_unit_x1=tmpo->x;
launch_unit_y1=tmpo->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) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_PARKED) {
tmps->action=SA_LAUNCHING;
tmps->é=tmpo->é+tmpo->dé;
}
return tmps;
}
}
return NULL;
}
Obj *ObjReturn(I64 player,F64 x,F64 y)
{
Obj *tmpo;
if (tmpo=ObjFind(x,y,OF_ACTIVE,OF_ACTIVE,1<<OT_FIGHTER,1<<player))
tmpo->flags|=OF_RETURNING;
return tmpo;
}
Squadron *SquadronReturn(I64 player,F64 x,F64 y)
{
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjReturn(player,x,y)) {
if (player==0) {
return_unit_x1=tmpo->x;
return_unit_y1=tmpo->y;
if (tmpo->host) {
return_unit_x2=tmpo->host->x;
return_unit_y2=tmpo->host->y;
return_t=tS+0.5;
}
}
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_FLYING)
tmps->action=SA_RETURNING;
return tmps;
}
}
return NULL;
}
Obj *ObjSeté(I64 player,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Obj *tmpo;
if ((tmpo=ObjFind(x,y,,,,1<<player)) && tmpo->flags&OF_ACTIVE &&
!(tmpo->flags&OF_RETURNING)) {
if (é==F64_MAX)
é=Arg(x-tmpo->x,y-tmpo->y);
tmpo->dé+=Wrap(é-(tmpo->é+tmpo->dé),-ã);
return tmpo;
}
return NULL;
}
Squadron *SquadronSeté(I64 player,F64 x=F64_MAX,F64 y=F64_MAX,F64 é=F64_MAX)
{
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjSeté(player,x,y,é)) {
if (player==0) {
set_é_unit_x1=tmpo->x;
set_é_unit_y1=tmpo->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) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_FLYING) {
tmps->action=SA_SET_é;
tmps->é=tmpo->é+tmpo->dé;
}
return tmps;
}
}
return NULL;
}
U0 SquadronActions()
{
I64 i,completed_mask;
Obj *tmpo;
Squadron *tmps;
for (i=0,tmps=squadrons;i<num_squadrons;i++,tmps++) {
completed_mask=0;
switch (tmps->action) {
case SA_LAUNCHING:
ObjLaunch(tmps->player,i,tmps->host,,,tmps->é);
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
LBEqu(&completed_mask,tmpo->member_num,tmpo->flags&OF_ACTIVE);
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_FLYING;
break;
case SA_FLYING:
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
LBEqu(&completed_mask,tmpo->member_num,!(tmpo->flags&OF_ACTIVE));
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_PARKED;
break;
case SA_SET_é:
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
tmpo->dé+=Wrap(tmps->é-(tmpo->é+tmpo->dé),-ã);
tmpo=tmpo->next_in_squadron;
}
tmps->action=SA_FLYING;
break;
case SA_RETURNING:
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
tmpo->flags|=OF_RETURNING;
LBEqu(&completed_mask,tmpo->member_num,!(tmpo->flags&OF_ACTIVE));
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_PARKED;
break;
}
if (tmps->dead_mask==tmps->total_mask)
tmps->action=SA_DEAD;
}
}
U0 AI(I64 player,F64 period)
{
Obj *tmpo;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->player==player) {
if (tmpo->type==OT_CARRIER && Rand<5*period)
SquadronLaunch(player,tmpo->x,tmpo->y);
if (tmpo->flags&OF_ACTIVE && !(tmpo->flags&OF_RETURNING) &&
Rand<10.0*period)
SquadronSeté(player,tmpo->x,tmpo->y,tmpo->é+pi/2*(Rand-0.5));
}
tmpo=tmpo->next;
}
}
U0 ShipDamage(Obj *tmpo,F64 d)
{
I64 i,x=Rand*FIRE_WIDTH,y=Rand*FIRE_HEIGHT;
tmpo->life_percent-=d;
while (d>0) {
if (!Bts(tmpo->fire,y*FIRE_WIDTH+x))
d-=500.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=25.0/(FIRE_WIDTH*FIRE_HEIGHT);
i=RandI16&7;
x+=gr_x_offsets[i];
y+=gr_y_offsets[i];
while (x>=FIRE_WIDTH)
x-=FIRE_WIDTH;
while (x<0)
x+=FIRE_WIDTH;
while (y>=FIRE_HEIGHT)
y-=FIRE_HEIGHT;
while (y<0)
y+=FIRE_HEIGHT;
}
}
U0 ShipFix(Obj *tmpo,F64 d)
{
tmpo->life_percent+=d;
if (tmpo->life_percent>=100.0) {
tmpo->life_percent=100.0;
MemSet(tmpo->fire,0,sizeof(Obj.fire));
return;
}
while (d>0)
if (Btr(tmpo->fire,FIRE_WIDTH*FIRE_HEIGHT*Rand))
d-=400.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=20.0/(FIRE_WIDTH*FIRE_HEIGHT);
}
U0 Combat(F64 period)
{
F64 d;
Obj *tmpo,*tmpo1;
Torpedo *tmpt;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo->flags&=~OF_SHOOTING;
if (tmpo->flags&OF_ACTIVE &&
(tmpo1=ObjFind(tmpo->x,tmpo->y,OF_ACTIVE,OF_ACTIVE,,
1<<(tmpo->player^1),&d))) {
tmpo->target_x=tmpo1->x;
tmpo->target_y=tmpo1->y;
if (tmpo1->flags&OF_SHIP) {
if (tmpo->torpedos && d<tmpo->torpedos_range && Rand<125*period) {
tmpo->torpedos--;
tmpt=CAlloc(sizeof(Torpedo));
tmpt->x=tmpo->x;
tmpt->y=tmpo->y;
tmpt->speed=100;
d/=tmpt->speed*(GAME_SPEED_SCALE*game_speed);
tmpo1->death_time=tmpt->timeout=tS+d;
tmpt->target=tmpo1;
tmpt->é=Arg(tmpo1->x-tmpo->x,tmpo1->y-tmpo->y);
QueIns(tmpt,torpedo_head.last);
Sweep(2000,86,53);
} else if (tmpo->ship_guns>0 && d<tmpo->ship_guns_range) {
tmpo->flags|=OF_SHOOTING;
if (Rand<125.0*period) {
ShipDamage(tmpo1,tmpo->ship_guns*Rand*period);
if (Rand<10.0*period)
tmpo1->fuel*=0.75*Rand+0.25;
}
if (tS>next_noise) {
Noise(100,29,46);
next_noise=tS+0.1;
}
}
} else {
if (tmpo->air_guns>0 && d<tmpo->air_guns_range) {
tmpo->flags|=OF_SHOOTING;
if (Rand<125.0*period) {
tmpo1->life_percent-=tmpo->air_guns*Rand*period;
if (Rand<10.0*period)
tmpo1->fuel*=0.75*Rand+0.25;
}
if (tS>next_noise) {
Noise(25,62,86);
next_noise=tS+0.025;
}
}
}
}
tmpo=tmpo->next;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo1=tmpo->next;
if (tmpo->type==OT_FIGHTER &&
(tmpo->life_percent<=0.0 || tmpo->flags&OF_ACTIVE &&
tmpo->fuel<=0.0 || tmpo->host &&
!(tmpo->flags&OF_ACTIVE) && tmpo->host->life_percent<=0.0))
ObjDel(tmpo);
tmpo=tmpo1;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo1=tmpo->next;
if (tmpo->life_percent<=0.0)
ObjDel(tmpo);
tmpo=tmpo1;
}
}
#define ANIMATE_FREQ 50
U0 AnimateTask(I64)
{
Obj *tmpo;
Torpedo *tmpt,*tmpt1;
F64 d,period;
while (TRUE) {
period=GAME_SPEED_SCALE*game_speed/ANIMATE_FREQ;
SquadronActions;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && tmpo->fuel>0) {
if (tmpo->dé) {
d=tmpo->dé;
if (d> tmpo->turn_rate*period) d= tmpo->turn_rate*period;
if (d<-tmpo->turn_rate*period) d=-tmpo->turn_rate*period;
tmpo->é +=d;
tmpo->dé-=d;
}
tmpo->x+=tmpo->speed*Cos(tmpo->é)*period*tmpo->life_percent/100.0;
tmpo->y+=tmpo->speed*Sin(tmpo->é)*period*tmpo->life_percent/100.0;
tmpo->fuel-=tmpo->speed*tmpo->fuel_burn_rate*period;
}
tmpo=tmpo->next;
}
tmpt=torpedo_head.next;
while (tmpt!=&torpedo_head) {
tmpt1=tmpt->next;
if (tS>tmpt->timeout) {
tmpo=tmpt->target;
if (Rand<0.333333) {
ShipDamage(tmpo,150*Rand*Rand);
if (Rand<0.333333)
tmpo->fuel*=0.75*Rand+0.25;
}
QueRem(tmpt);
Free(tmpt);
} else {
tmpt->x+=tmpt->speed*Cos(tmpt->é)*period;
tmpt->y+=tmpt->speed*Sin(tmpt->é)*period;
}
tmpt=tmpt1;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->host && !(tmpo->flags&OF_ACTIVE)) {
tmpo->x=tmpo->host->x;
tmpo->y=tmpo->host->y;
}
tmpo=tmpo->next;
}
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE) {
if (tmpo->host) {
d=Sqrt(Sqr(tmpo->x-tmpo->host->x)+Sqr(tmpo->y-tmpo->host->y));
if (d<8 && tmpo->max_fuel-tmpo->fuel>30) {
tmpo->life_percent=100.0;
if (tmpo->host->fuel>0) {
d=tmpo->max_fuel-tmpo->fuel;
if (d>tmpo->host->fuel) d=tmpo->host->fuel;
tmpo->host->fuel-=d;
tmpo->fuel+=d;
}
tmpo->torpedos=tmpo->max_torpedos;
tmpo->x=tmpo->host->x;
tmpo->y=tmpo->host->y;
tmpo->flags&=~OF_ACTIVE;
} else if (d>tmpo->fuel-250)
tmpo->flags|=OF_RETURNING;
if (tmpo->flags&OF_RETURNING)
tmpo->dé+=Wrap(Arg(tmpo->host->x-tmpo->x,
tmpo->host->y-tmpo->y)-(tmpo->é+tmpo->dé),-ã);
} else if (tmpo->type==OT_CARRIER)
ShipFix(tmpo,2.5*period);
}
tmpo=tmpo->next;
}
AI(1,period);
Combat(period);
Sleep(1000/ANIMATE_FREQ);
}
}
U0 FlatTops()
{
I64 arg1,arg2;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=BLUE<<4+WHITE;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
PopUpOk("$$GREEN$${Left-Mouse}$$FG$$\t\tChange Course\n"
"$$GREEN$${Right-Mouse}$$FG$$\t\tLaunch Squadron\n"
"$$GREEN$${Right-Double-Mouse}$$FG$$\tReturn Squadron\n"
"$$GREEN$${Ctrl-Left Grab}$$FG$$\tScroll Scrn\n");
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Faster(,'+');"
" Slower(,'-');"
"}"
);
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(&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 (arg1) {
case '\n':
CleanUp;
Init;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto nv_done;
case '+':
game_speed*=1.5;
break;
case '-':
game_speed/=1.5;
break;
}
break;
case MSG_MS_L_UP:
SquadronSeté(0,arg1,arg2);
break;
case MSG_MS_R_UP:
SquadronLaunch(0,arg1,arg2);
break;
case MSG_MS_R_D_UP:
SquadronReturn(0,arg1,arg2);
break;
}
nv_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
MenuPop;
SettingsPop;
CleanUp;
}
FlatTops;
//Maybe use this in the future $SP,"<7>",BI=7$
rúÿÿÿéÿÿÿ&ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿ ÿ ÿ ÿ ÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrúÿÿÿéÿÿÿ&ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ␍␍␍ÿ␍␍ÿ␍␍ÿ␍␍ÿ␍␍ÿ␍ÿ␍ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿbüÿÿÿìÿÿÿ %ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿbüÿÿÿìÿÿÿ %ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ␍␍ÿÿÿ␍␍ÿÿÿÿ␍␍␍␍ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿZþÿÿÿüÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿZþÿÿÿüÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ␍␍ÿÿ␍␍ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿã <,,çÿÿÿ}âÿÿÿiØÿÿÿUØÿÿÿUâÿÿÿÉÿÿÿÔþÿÿÉÿÿÿÔþÿÿFFdíþÿÿÎÿÿÿÿÿÿÎÿÿÿÿÿÿâÿÿÿíþÿÿâÿÿÿíþÿÿÎÿÿÿÿÿÿÎÿÿÿÿÿÿâÿÿÿíþÿÿâÿÿÿiâÿÿÿ,öÿÿÿ,çÿÿÿöÿÿÿ}âÿÿÿöÿÿÿiØÿÿÿöÿÿÿUØÿÿÿöÿÿÿUâÿÿÿöÿÿÿÉÿÿÿöÿÿÿÔþÿÿÉÿÿÿöÿÿÿÔþÿÿFöÿÿÿFöÿÿÿdöÿÿÿiâÿÿÿöÿÿÿ    
 




      

 
   ␍  ␍␍␍     ,,ìÿÿÿØÿÿÿÔþÿÿÝÿÿÿÔþÿÿ<2Þþÿÿ-âÿÿÿÞþÿÿâÿÿÿâÿÿÿÝÿÿÿâÿÿÿ-âÿÿÿ'âÿÿÿ'ñÿÿÿâÿÿÿ  
    



 
+162
View File
@@ -0,0 +1,162 @@
#define ROAD_NUM 512
#define ROAD_WIDTH_BY_2 200
#define CAR_WIDTH_BY_2 100
I64 road_x[ROAD_NUM],road_trend;
F64 speed,distance;
I64 road_ptr=0,car_x;
F64 t_last;
Bool crash;
U0 DrawIt(CTask *task,CDC *dc)
{
I64 w=task->pix_width,h=task->pix_height;
I64 i,x,y,xx;
xx=w>>1-car_x+road_x[road_ptr&(ROAD_NUM-1)];
dc->color=LTGRAY;
for (i=0;i<ROAD_NUM;i++) {
x=w>>1-car_x+road_x[(i+road_ptr)&(ROAD_NUM-1)];
y=h-0.5*i;
if (y<(h+FONT_HEIGHT)>>1) break;
GrPlot(dc,x+ROAD_WIDTH_BY_2-0.4*i,y);
GrPlot(dc,x-ROAD_WIDTH_BY_2+0.4*i,y);
}
dc->color=WHITE;
x=w>>1-CAR_WIDTH_BY_2;
if (x<xx-ROAD_WIDTH_BY_2)
crash=TRUE;
GrLine(dc,x-10,h,x-40,h-100);
GrLine(dc,x+10,h,x+40,h-100);
x=w>>1+CAR_WIDTH_BY_2;
if (x>xx+ROAD_WIDTH_BY_2)
crash=TRUE;
GrLine(dc,x-10,h,x-40,h-100);
GrLine(dc,x+10,h,x+40,h-100);
dc->color=YELLOW;
if (crash)
GrPrint(dc,w>>1-FONT_WIDTH*4,(h-FONT_HEIGHT)>>1,"Game Over");
}
U0 UpdateRoad()
{
F64 t0=tS;
distance+=speed*(t0-t_last);
t_last=t0;
while (distance>1.0) {
road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
road_x[road_ptr&(ROAD_NUM-1)]=
road_x[(road_ptr-1)&(ROAD_NUM-1)]+=road_trend/3;
road_ptr++;
distance-=1.0;
}
}
U0 Init()
{
I64 i,x=0;
DocClear;
"$$BG,DKGRAY$$%h*c",(TEXT_ROWS-1)/2,'\n';
speed=0;
distance=0;
road_trend=0;
road_ptr=0;
car_x=0;
for (i=0;i<ROAD_NUM;i++) {
road_x[i]=x;
road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
x+=road_trend/3;
}
t_last=tS;
crash=FALSE;
}
U0 Halogen()
{
I64 arg1,arg2,ch=0,sc=0;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=BLACK<<4+WHITE;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Accelerate(,,SC_CURSOR_UP);"
" Deccellerate(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
AutoComplete;
WinBorder;
WinMax;
DocCursor;
Init;
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
case MSG_KEY_DOWN:
ch=arg1;sc=arg2;
switch (ch) {
case '\n':
Init;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto ha_done;
}
break;
case MSG_KEY_UP:
ch=arg1;sc=arg2;
if (!ch)
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
case SC_CURSOR_LEFT:
case SC_CURSOR_UP:
case SC_CURSOR_DOWN:
sc=0;
break;
}
break;
}
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
car_x++;
break;
case SC_CURSOR_LEFT:
car_x--;
break;
case SC_CURSOR_UP:
if (++speed>200) speed=200;
break;
case SC_CURSOR_DOWN:
if (--speed<0) speed=0;
break;
}
if (crash)
Snd;
else {
if (speed)
Snd(Freq2Ona(speed+10));
else
Snd;
UpdateRoad;
}
Sleep(10);
}
ha_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
MenuPop;
DocClear;
SettingsPop;
}
Halogen;
+169
View File
@@ -0,0 +1,169 @@
class MyMass:CMass
{
F64 radius;
};
class MySpring:CSpring
{
};
CMathODE *ode=NULL;
U0 DrawIt(CTask *,CDC *dc)
{
MyMass *tmpm;
MySpring *tmps;
dc->color=RED;
tmps=ode->next_spring;
while (tmps!=&ode->next_spring) {
GrLine(dc,tmps->end1->x,tmps->end1->y,tmps->end2->x,tmps->end2->y);
tmps=tmps->next;
}
dc->color=BLACK;
tmpm=ode->next_mass;
while (tmpm!=&ode->next_mass) {
GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
tmpm=tmpm->next;
}
}
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
{//The forces due to springs and drag are
//automatically handled by the ode code.
//We can add new forces here.
F64 d,dd;
CD3 p;
MyMass *tmpm1,*tmpm2;
tmpm1=ode->next_mass;
while (tmpm1!=&ode->next_mass) {
tmpm2=tmpm1->next;
while (tmpm2!=&ode->next_mass) {
D3Sub(&p,&tmpm2->state->x,&tmpm1->state->x);
dd=D3NormSqr(&p);
if (dd<=Sqr(tmpm1->radius+tmpm2->radius)) {
d=Sqrt(dd)+0.0001;
dd=10.0*Sqr(Sqr(Sqr(tmpm1->radius+tmpm2->radius)-dd));
D3MulEqu(&p,dd/d);
D3AddEqu(&tmpm2->DstateDt->DxDt,&p);
D3SubEqu(&tmpm1->DstateDt->DxDt,&p);
}
tmpm2=tmpm2->next;
}
tmpm1=tmpm1->next;
}
}
U0 PlaceMass(I64 x, I64 y)
{
MyMass *tmpm=CAlloc(sizeof(MyMass));
tmpm->mass=1.0;
tmpm->drag_profile_factor=100.0;
tmpm->x=x;
tmpm->y=y;
tmpm->radius=10*(Rand+0.25);
QueIns(tmpm,ode->last_mass);
}
U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
{
MySpring *tmps=CAlloc(sizeof(MySpring));
tmps->end1=tmpm1;
tmps->end2=tmpm2;
tmps->const=10000;
tmps->rest_len=100;
QueIns(tmps,ode->last_spring);
}
U0 Init()
{
ode=ODENew(0,1e-4,ODEF_HAS_MASSES);
ode->derivative=&MyDerivative;
ode->drag_v2=0.002;
ode->drag_v3=0.00001;
ode->acceleration_limit=5e3;
QueIns(ode,Fs->last_ode);
}
U0 CleanUp()
{
QueRem(ode);
QueDel(&ode->next_mass,TRUE);
QueDel(&ode->next_spring,TRUE);
ODEDel(ode);
}
U0 MassSpringDemo()
{
I64 msg_code,arg1,arg2;
MyMass *tmpm1=NULL,*tmpm2=NULL;
PopUpOk("Left-Click to place mas\n"
"Right-Click and drag to\n"
"connect with spring.\n\n"
"Springs are 100 pixs long.\n");
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Fs->win_inhibit|=WIG_DBL_CLICK;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
"}"
);
Init;
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
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_MS_L_DOWN:
PlaceMass(arg1,arg2);
break;
case MSG_MS_R_DOWN:
tmpm1=MassFind(ode,arg1,arg2);
tmpm2=NULL;
break;
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 (arg1) {
case '\n':
CleanUp;
Init;
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto ms_done;
}
break;
}
}
ms_done: //Don't goto out of try
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
SettingsPop;
CleanUp;
MenuPop;
}
MassSpringDemo;
+112
View File
@@ -0,0 +1,112 @@
//See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
#define ATTR (BLACK<<12+WHITE<<8)
U32 text[TEXT_ROWS][TEXT_COLS];
U0 DrawIt(CTask *task,CDC *)
{ //$LK,"gr.text_base",A="MN:CGrGlbls"$ gets clear 30fps, so we must use our own permanent text array.
MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
// You can copy it this way, if you like:
// I64 i,j;
// for (j=0;j<TEXT_ROWS;j++)
// 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 bttn.");
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
}
#define STK_SIZE 2048
//We would put these as local vars
//in SolveMaze() but the system stk size
//is limited, so it's a bad habit. The heap
//is the normal TempleOS technique, but
//it's a pain in this case.
I64 stk_ptr,
stk_x [STK_SIZE],
stk_y [STK_SIZE],
stk_dir[STK_SIZE];
//Four directions:
// 0=Up,1=right,2=down,3=left
I64 dir_x[4]={ 0,+1, 0,-1}, // Could use $LK,"gr_x_offsets2",A="MN:gr_x_offsets2"$,$LK,"gr_y_offsets2",A="MN:gr_y_offsets2"$
dir_y[4]={+1, 0,-1, 0};
U0 SolveMaze(I64 x,I64 y)
{
I64 dir=0;
stk_ptr=0;
stk_x[stk_ptr]=x;
stk_y[stk_ptr]=y;
stk_dir[stk_ptr++]=dir;
while (TRUE) {
if (!(0<=x<MinI64(Fs->win_width,TEXT_COLS)) ||
!(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {
Beep;Beep;
break;
}
if (!text[y][x].u8[0])
text[y][x]='.'+ATTR;
x+=dir_x[dir];
y+=dir_y[dir];
//u8.[0] is the ASCII
if (text[y][x].u8[0]) {
x-=dir_x[dir];
y-=dir_y[dir];
if (++dir==4) {
if (--stk_ptr<0) return;
x=stk_x[stk_ptr];
y=stk_y[stk_ptr];
dir=stk_dir[stk_ptr];
}
} else {
dir=0;
stk_x[stk_ptr]=x;
stk_y[stk_ptr]=y;
stk_dir[stk_ptr++]=dir;
if (stk_ptr==STK_SIZE) return;
Sleep(100);
if (ScanChar)
throw;
}
}
}
U0 Maze()
{
I64 ch,x,y;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
try
do {
MemSet(text,0,sizeof(text));
while (!(ch=ScanChar)) {
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 (ms.rb&&!winmgr.grab_scroll) {
text[y][x]='*'+ATTR;
SolveMaze(x,y);
ch=GetChar;
break;
}
Refresh;
}
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
catch
PutExcept;
SettingsPop;
}
Maze;
+189
View File
@@ -0,0 +1,189 @@
I64 sc_1,sc_2;
#define DROPS_NUM 0x2000
class Drop
{
I32 x,y;
} drops[DROPS_NUM];
CDC *cur_dc;
U0 DrawFrame(CTask *task,CDC *dc)
{
I64 w=task->pix_width,h=task->pix_height,
cx=w>>1,cy=h>>1;
dc->color=LTRED;
GrLine(dc,cx-20,cy-50,cx,cy-150);
GrLine(dc,cx+20,cy-50,cx,cy-150);
dc->color=LTRED;
GrLine(dc,cx-100,cy-100,cx,cy);
GrLine(dc,cx+100,cy-100,cx,cy);
if (Bt(kbd.down_bitmap,sc_1)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy-2,5,5);
}
dc->color=BLACK;
GrPrint(dc,cx+10,cy,"Press '1'");
dc->color=LTRED;
GrRect(dc,cx-20,cy+60,41,21);
dc->color=LTRED;
GrLine(dc,cx-200,cy,cx,cy+100);
GrLine(dc,cx+200,cy,cx,cy+100);
if (Bt(kbd.down_bitmap,sc_2)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy+100-2,5,5);
}
dc->color=BLACK;
GrPrint(dc,cx+10,cy+100,"Press '2'");
dc->color=LTRED;
GrLine(dc,cx+400,cy+100,cx-250,cy+200);
}
U0 DrawDrops(CTask *,CDC *dc)
{
I64 i;
dc->color=BLUE;
for (i=0;i<DROPS_NUM;i++)
if (drops[i].y>=0 && GrPeek(dc,drops[i].x,drops[i].y)==WHITE)
GrPlot(dc,drops[i].x,drops[i].y);
}
U0 UpdateCurBase(CTask *task,CDC *dc)
{
cur_dc->color=ROP_EQU;
dc->flags|=DCF_NO_TRANSPARENTS;
GrBlot(cur_dc,-task->pix_left-task->scroll_x,
-task->pix_top-task->scroll_y,dc);
dc->flags&=~DCF_NO_TRANSPARENTS;
}
U0 DrawIt(CTask *task,CDC *dc)
{
DrawFrame(task,dc);
DrawDrops(task,dc);
UpdateCurBase(task,dc);
}
U0 AnimateTask(I64)
{
I64 i,j,cur_drop=0,c1,c2,x0,y0,x1,y1,w,h;
while (TRUE) {
w=Fs->parent_task->pix_width;
h=Fs->parent_task->pix_height;
for (i=0;i<2;i++) {
j=0;
do {
if (++cur_drop>=DROPS_NUM)
cur_drop=0;
if (drops[cur_drop].y<0)
break;
j++;
} while (j<=DROPS_NUM);
drops[cur_drop].x=RandU32%w;
drops[cur_drop].y=0;
}
for (i=0;i<DROPS_NUM;i++) {
if (drops[i].y>=0) {
if (drops[i].y>=h-1)
drops[i].y=-I32_MAX;
else {
x0=x1=drops[i].x;
y0=y1=drops[i].y;
if (GrPeek(cur_dc,x0,y0+1)==WHITE)
y1++;
else {
c1=GrPeek(cur_dc,x0+1,y0);
c2=GrPeek(cur_dc,x0-1,y0);
if (c1==WHITE && c2!=WHITE)
x1++;
else if (c2==WHITE && c1!=WHITE)
x1--;
else if (c1==WHITE && c2==WHITE) {
c1=GrPeek(cur_dc,x0+1,y0+1);
c2=GrPeek(cur_dc,x0-1,y0+1);
if (c1==WHITE && c2!=WHITE)
x1++;
else if (c2==WHITE && c1!=WHITE)
x1--;
else if (RandI16>=0)
x1++;
else
x1--;
}
if (GrPeek(cur_dc,x1,y1+1)==WHITE)
y1++;
}
if (GrPeek(cur_dc,x0,y0)==BLUE) {
cur_dc->color=WHITE;
GrPlot(cur_dc,x0,y0);
}
cur_dc->color=BLUE;
GrPlot(cur_dc,x1,y1);
drops[i].x=x1;
drops[i].y=y1;
}
}
}
Sleep(10);
}
}
U0 Init()
{
I64 i;
MemSet(drops,0,sizeof(drops));
for (i=0;i<DROPS_NUM;i++)
drops[i].y=-I32_MAX;
}
U0 RainDrops()
{
I64 ch,sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" OpenUpper(,'1');"
" OpenLower(,'2');"
"}"
);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);
sc_1=Char2ScanCode('1');
sc_2=Char2ScanCode('2');
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
do
switch (ch=GetKey(&sc)) {
case '\n':
Init;
break;
}
while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
} catch
PutExcept;
SettingsPop;
MenuPop;
DCDel(cur_dc);
}
RainDrops;
+803
View File
@@ -0,0 +1,803 @@
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
RegDft("TempleOS/RawHide","F64 best_score=9999;\n");
RegExe("TempleOS/RawHide");
F64 t0,tf;
I64 outside_cnt;
#define MAP_WIDTH 1000
#define MAP_HEIGHT 1000
#define FENCE_WIDTH 320
#define FENCE_HEIGHT 200
#define MAP_BORDER 3
CDC *map_dc;
#define GATE_WIDTH 22
#define GATE_HEIGHT 7
F64 gate_é,gate_t;
$SP,"<1>",BI=1$ $SP,"<2>",BI=2$ $SP,"<3>",BI=3$
$SP,"<4>",BI=4$ $SP,"<5>",BI=5$ $SP,"<6>",BI=6$
$SP,"<7>",BI=7$ $SP,"<8>",BI=8$
$SP,"<9>",BI=9$
$SP,"<10>",BI=10$
#define ANIMAL_WIDTH 20
#define ANIMAL_HEIGHT 16
U8 *cow_imgs[4] ={$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$},
*bull_imgs[4] ={$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$,$IB,"<5>",BI=5$},
*horse_imgs[4]={$IB,"<7>",BI=7$,$IB,"<8>",BI=8$,$IB,"<7>",BI=7$,$IB,"<8>",BI=8$};
#define ANIMALS_NUM 100
class Animal
{
I64 num,x,y,dx,dy;
U8 **imgs;
U32 buddy;
U8 type,frame0;
Bool dead,pad;
} *a;
//************************************
#define WATERFALL_HEIGHT (MAP_HEIGHT/20)
#define WATERFALL_DROPS 512
#define WATERFALL_ACCELERATION 10
I32 *r_x,*r_width,*wfd_x;
F64 *wfd_t0,waterfall_tf;
I64 waterfall_x,waterfall_y,waterfall_width;
U0 RiverNew()
{
r_x=MAlloc(MAP_HEIGHT*sizeof(I32));
r_width=MAlloc(MAP_HEIGHT*sizeof(I32));
wfd_x=MAlloc(WATERFALL_DROPS*sizeof(I32));
wfd_t0=MAlloc(WATERFALL_DROPS*sizeof(F64));
waterfall_tf=Sqrt(2*WATERFALL_HEIGHT/WATERFALL_ACCELERATION);
}
U0 RiverMake()
{
I64 i,x=2*MAP_WIDTH<<32/3,y,dx=0,w=15<<32;
waterfall_y=(MAP_HEIGHT-WATERFALL_HEIGHT)/2*Rand+
(MAP_HEIGHT-WATERFALL_HEIGHT)/4;
for (y=MAP_BORDER;y<MAP_HEIGHT-MAP_BORDER;y++) {
r_x[y]=x.i32[1]; r_width[y]=w.i32[1];
if (waterfall_y-5<y<waterfall_y+WATERFALL_HEIGHT+5) {
waterfall_width=r_width[y];
waterfall_x=r_x[y]-waterfall_width/2;
} else {
dx=ClampI64(dx+RandI32/64,-I32_MAX,I32_MAX)-I32_MAX/256;
w=ClampI64(w+RandI32*2,10*U32_MAX,150*U32_MAX);
x+=dx;
}
}
for (i=0;i<WATERFALL_DROPS;i++) {
wfd_x[i]=Rand*waterfall_width+waterfall_x;
wfd_t0[i]=tS-Rand*waterfall_tf;
}
//Plot waterfall cliff
Sprite3B(map_dc,waterfall_x,waterfall_y,0,$IB,"<10>",BI=10$);
//Plot sand bar
x=0;
for (y=MAP_BORDER;y<MAP_HEIGHT-MAP_BORDER;y++) {
if (!(waterfall_y-9<y<waterfall_y+WATERFALL_HEIGHT+9)) {
map_dc->color=YELLOW;
map_dc->pen_width=r_width[y]+10;
GrPlot3(map_dc,r_x[y]+x.i32[1],y,0);
}
x=ClampI64(x+RandI32,-6*U32_MAX,6*U32_MAX);
}
//Plot water
for (y=MAP_BORDER;y<MAP_HEIGHT-MAP_BORDER;y++) {
map_dc->color=BLUE;
map_dc->pen_width=r_width[y];
GrPlot3(map_dc,r_x[y],y,0);
}
}
U0 RiverDel()
{
Free(r_x);
Free(r_width);
Free(wfd_x);
Free(wfd_t0);
}
//************************************
class RiverDrop
{
RiverDrop *next,*last;
I64 y,dx,dy;
} rd_head;
Bool rd_lock;
U0 RiverDropsDel()
{
while (LBts(&rd_lock,0))
Yield;
QueDel(&rd_head,TRUE);
QueInit(&rd_head);
LBtr(&rd_lock,0);
}
U0 RiverDropsNext(CTask *mem_task)
{
RiverDrop *tmpr,*tmpr1;
while (LBts(&rd_lock,0))
Yield;
tmpr=rd_head.next;
while (tmpr!=&rd_head) {
tmpr1=tmpr->next;
if (++tmpr->y>=MAP_HEIGHT-MAP_BORDER) {
QueRem(tmpr);
Free(tmpr);
} else {
do {
if (RandU16&1 && GrPeek(map_dc,r_x[tmpr->y]+tmpr->dx,
tmpr->y+tmpr->dy)==BLUE)
break;
tmpr->dx=ClampI64(tmpr->dx+RandU16%3-1,-r_width[tmpr->y]/2,
r_width[tmpr->y]/2);
tmpr->dy=ClampI64(tmpr->dy+RandU16%3-1,-r_width[tmpr->y]/2,
r_width[tmpr->y]/2);
} while (GrPeek(map_dc,r_x[tmpr->y]+tmpr->dx,
tmpr->y+tmpr->dy)!=BLUE &&
GrPeek(map_dc,r_x[tmpr->y],tmpr->y)==BLUE);//Might be reiniting
}
tmpr=tmpr1;
}
tmpr=MAlloc(sizeof(RiverDrop),mem_task);
tmpr->y=MAP_BORDER;
tmpr->dx=0;
tmpr->dy=0;
QueIns(tmpr,rd_head.last);
LBtr(&rd_lock,0);
}
U0 RiverDropsDraw(CDC *dc,I64 cx,I64 cy)
{
I64 i;
F64 t=tS;
RiverDrop *tmpr;
while (LBts(&rd_lock,0))
Yield;
tmpr=rd_head.next;
dc->color=LTBLUE;
while (tmpr!=&rd_head) {
GrPlot(dc,r_x[tmpr->y]+tmpr->dx-cx,tmpr->y+tmpr->dy-cy);
tmpr=tmpr->next;
}
LBtr(&rd_lock,0);
dc->color=WHITE;
for (i=0;i<WATERFALL_DROPS;i++)
GrPlot(dc,wfd_x[i]-cx,waterfall_y+0.5*WATERFALL_ACCELERATION*
Sqr(waterfall_tf*Saw(t-wfd_t0[i],waterfall_tf))-cy);
}
//************************************
U0 DrawIt(CTask *task,CDC *dc)
{
static I64 last_pos_x=0;
static Bool left=TRUE;
F64 t;
I64 i,frame=4*tS,
cx=(MAP_WIDTH -task->pix_width)/2,
cy=(MAP_HEIGHT-task->pix_height)/2;
if (task->scroll_x+cx<0)
task->scroll_x=-cx;
if (task->scroll_x+cx>MAP_WIDTH-task->pix_width)
task->scroll_x=MAP_WIDTH-task->pix_width-cx;
if (task->scroll_y+cy<0)
task->scroll_y=-cy;
if (task->scroll_y+cy>MAP_HEIGHT-task->pix_height)
task->scroll_y=MAP_HEIGHT-task->pix_height-cy;
map_dc->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,-cx,-cy,map_dc);
RiverDropsDraw(dc,cx,cy);
for (i=0;i<ANIMALS_NUM;i++)
if (!a[i].dead) {
if (a[i].dx<0) {
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
DCSymmetrySet(dc,a[i].x.i32[1]-cx,0,a[i].x.i32[1]-cx,1);
}
Sprite3(dc,a[i].x.i32[1]-cx,a[i].y.i32[1]-cy,0,
a[i].imgs[(frame+a[i].frame0)&3]);
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
}
if (ms.pos.x-last_pos_x>0)
left=FALSE;
else if (ms.pos.x-last_pos_x<0)
left=TRUE;
if (left) {
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
DCSymmetrySet(dc,ms.pos.x-task->pix_left-task->scroll_x,0,
ms.pos.x-task->pix_left-task->scroll_x,1);
}
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=ms.pos.x;
if (tf) {
dc->color=RED;
t=tf-t0;
if (Blink)
GrPrint(dc,(task->pix_width-FONT_WIDTH*14)>>1-task->scroll_x,
(task->pix_height-FONT_HEIGHT)>>1-task->scroll_y,
"Game Completed");
} else {
dc->color=BLACK;
t=tS-t0;
}
GrPrint(dc,-task->scroll_x,-task->scroll_y,
"Outside:%03d Time:%7.2fs Best:%7.2fs",
outside_cnt,t,best_score);
}
U0 BuddySel(I64 i)
{
I64 b,best_b=i,score,best_score=I64_MAX;
for (b=0;b<ANIMALS_NUM;b++) {
if (b!=i && !a[b].dead) {
score=RandU32%(512*512)+
SqrI64(a[b].x.i32[1]-a[i].x.i32[1])+
SqrI64(a[b].y.i32[1]-a[i].y.i32[1]);
if (score<best_score) {
best_score=score;
best_b=b;
}
}
}
a[i].buddy=best_b;
}
U0 RedrawGate()
{
F64 tt=tS-gate_t;
I64 x1=FENCE_WIDTH-63,y1=FENCE_HEIGHT-1,dx,dy;
if (tt<0.5)
gate_é=Clamp(gate_é+0.02,0,ã/2);
else if (tt>5.0)
gate_é=Clamp(gate_é-0.02,0,ã/2);
dx=GATE_WIDTH*Cos(gate_é); dy=-0.8*GATE_WIDTH*Sin(gate_é);
map_dc->color=LTGREEN;
GrRect(map_dc,x1,y1-0.8*GATE_WIDTH-GATE_HEIGHT,
46,0.8*GATE_WIDTH+GATE_HEIGHT+3);
map_dc->color=BLACK;
GrLine(map_dc,x1,y1,x1+dx,y1+dy);
GrLine(map_dc,x1,y1,x1,y1-GATE_HEIGHT);
GrLine(map_dc,x1+dx,y1+dy,x1+dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1,y1-GATE_HEIGHT,x1+dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1,y1,x1+dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1,y1-GATE_HEIGHT,x1+dx,y1+dy);
GrLine(map_dc,x1+45,y1,x1+45-dx,y1+dy);
GrLine(map_dc,x1+45,y1,x1+45,y1-GATE_HEIGHT);
GrLine(map_dc,x1+45-dx,y1+dy,x1+45-dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1+45,y1-GATE_HEIGHT,x1+45-dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1+45,y1,x1+45-dx,y1+dy-GATE_HEIGHT);
GrLine(map_dc,x1+45,y1-GATE_HEIGHT,x1+45-dx,y1+dy);
}
Bool CheckMap(I64 x,I64 y)
{
I64 i,j,c;
if (SqrI64(x-(waterfall_x+waterfall_width/2))>>1+
SqrI64(y-(waterfall_y+WATERFALL_HEIGHT/2))<2500)
return FALSE;
for (j=-4;j<=2;j++)
for (i=-4;i<=4;i++) {
c=GrPeek(map_dc,x+i,y+j);
if (c==LTGRAY || c==BLACK)
return FALSE;
}
return TRUE;
}
U0 AnimateTask(CTask *parent)
{
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,cnt,max_speed=I64_MAX,updates=0,
my_outside_cnt;
F64 f,d,dx,dy,s,stress;
Animal *tmpa,*tmpa1;
while (TRUE) {
max_speed=ClampU64(max_speed,U32_MAX/3,200*U32_MAX);
cx=(MAP_WIDTH -parent->pix_width)/2,
cy=(MAP_HEIGHT-parent->pix_height)/2;
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)
gate_t=tS;
RedrawGate;
for (i=0;i<ANIMALS_NUM;i++) {
tmpa=&a[i];
if (!tmpa->dead) {
//Move away from horse
ddx=tmpa->x.i32[1]-cursor_x;
ddy=tmpa->y.i32[1]-cursor_y;
if (dd=SqrI64(ddx)+SqrI64(ddy)) {
d=Sqrt(dd);
dx=ddx/d;
dy=ddy/d;
f=5.0e2*U32_MAX/dd;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
//Resel buddy about every ANIMALS_NUM*10ms=5.12 seconds
tmpa1=&a[tmpa->buddy];
if (tmpa1->dead || i==updates%ANIMALS_NUM) {
BuddySel(i);
tmpa1=&a[tmpa->buddy];
}
//Move toward buddy
ddx=tmpa->x.i32[1]-tmpa1->x.i32[1];
ddy=tmpa->y.i32[1]-tmpa1->y.i32[1];
if (dd=SqrI64(ddx)+SqrI64(ddy)) {
d=Sqrt(dd);
s=d`1.25-80;
stress+=Abs(s);
dx=ddx/d;
dy=ddy/d;
f=-0.001*s*U32_MAX;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
//Make velocity similar to buddy
tmpa->dx+=0.1*(tmpa1->dx-tmpa->dx);
tmpa->dy+=0.1*(tmpa1->dy-tmpa->dy);
//Add random movement, limit speed and dampen speed
tmpa->dx=0.995*ClampI64(tmpa->dx+RandI32/32,-max_speed,max_speed);
tmpa->dy=0.995*ClampI64(tmpa->dy+RandI32/32,-max_speed,max_speed);
//Slow in river
if (GrPeek(map_dc,tmpa->x.i32[1],tmpa->y.i32[1])!=LTGREEN) {
tmpa->dx/=2;
tmpa->dy/=2;
}
if (CheckMap((tmpa->x+tmpa->dx)>>32,(tmpa->y+tmpa->dy)>>32)) {
tmpa->x+=tmpa->dx;
tmpa->y+=tmpa->dy;
}
//Keep on map
if (!(MAP_BORDER+ANIMAL_WIDTH/2
<=tmpa->x.i32[1]<MAP_WIDTH-MAP_BORDER-ANIMAL_WIDTH/2)) {
tmpa->x -=tmpa->dx;
tmpa->dx=-tmpa->dx;
}
if (!(MAP_BORDER+ANIMAL_HEIGHT
<=tmpa->y.i32[1]<MAP_HEIGHT-MAP_BORDER)) {
tmpa->y -=tmpa->dy;
tmpa->dy=-tmpa->dy;
}
cnt++;
if (tmpa->x>>32>=FENCE_WIDTH || tmpa->y>>32>=FENCE_HEIGHT)
my_outside_cnt++;
}
}
outside_cnt=my_outside_cnt;
if (!(updates&15))
RiverDropsNext(parent);
if (!tf && !outside_cnt) {
tf=tS;
music.mute=TRUE;
Snd(86);Sleep(200);Snd;Sleep(100);
if (tf-t0<best_score) {
best_score=tf-t0;
Snd(86);Sleep(200);Snd;Sleep(100);
}
music.mute=FALSE;
}
updates++;
if (cnt)
stress/=cnt;
else
stress=0;
if (stress>100.0) {
Yield;
max_speed=stress/5.0*U32_MAX; //Converge faster at start-up
} else {
Sleep(10);
max_speed=0; //Will be set to normal max speed
}
}
}
U0 SongTask(I64)
{//Randomly generated (by God :-)
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
Play("5qC4etG5DC4B5DCECFqFC4sA5D4A5D4qB");
Play("5C4etG5DC4B5DCECFqFC4sA5D4A5D4qB");
Play("4sGAGA5qG4etG5GD4eBBqB5F4eBA5qE");
Play("4sGAGA5qG4etG5GD4eBBqB5F4eBA5qE");
}
}
U0 ReInit()
{
I64 i;
RiverDropsDel;
map_dc->color=LTGREEN;
GrRect(map_dc,2,2,MAP_WIDTH-4,MAP_HEIGHT-4);
RiverMake;
//Plot fence
for (i=FENCE_WIDTH;i>0;i-=16)
Sprite3(map_dc,i,FENCE_HEIGHT,0,$IB,"<9>",BI=9$);
map_dc->pen_width=1;
map_dc->color=BROWN;
for (i=0;i<FENCE_HEIGHT-16;i+=16)
GrLine(map_dc,FENCE_WIDTH-1,i,FENCE_WIDTH-1,i+7);
map_dc->color=LTGRAY;
GrLine(map_dc,FENCE_WIDTH,0,FENCE_WIDTH,FENCE_HEIGHT-6);
RedrawGate;
map_dc->pen_width=MAP_BORDER;
map_dc->color=RED;
GrBorder(map_dc,MAP_BORDER/2,MAP_BORDER/2,
MAP_WIDTH-(MAP_BORDER+1)/2,MAP_HEIGHT-(MAP_BORDER+1)/2);
for (i=MAP_BORDER;i<=MAP_HEIGHT-MAP_BORDER;i++)
RiverDropsNext(Fs);
MemSet(a,0,ANIMALS_NUM*sizeof(Animal));
for (i=0;i<ANIMALS_NUM;i++) {
a[i].num=i;
do {
a[i].x=(64+RandU32%(MAP_WIDTH-128))<<32;
a[i].y=(64+RandU32%(MAP_WIDTH-128))<<32;
} while (!CheckMap(a[i].x>>32,a[i].y>>32));
if (i&1)
a[i].imgs=cow_imgs;
else
a[i].imgs=bull_imgs;
a[i].frame0=RandU16&3;
BuddySel(i);
}
outside_cnt=ANIMALS_NUM;
gate_t=0;
gate_é=0;
t0=tS;
tf=0;
}
U0 Init()
{
RiverNew;
rd_lock=0;
QueInit(&rd_head);
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
a=MAlloc(ANIMALS_NUM*sizeof(Animal));
ReInit;
}
U0 CleanUp()
{
DCDel(map_dc);
Free(a);
RiverDropsDel;
RiverDel;
}
U0 RawHide()
{
I64 msg_code,arg1,arg2;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
"}"
);
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
PopUpOk(
"Coral the cattle. The coral is in the\n"
"upper-left corner if you scroll.\n\n"
"Keep holding the $$GREEN$$<CTRL>$$FG$$ key and\n"
"scroll with $$GREEN$${CTRL-Left Grab}$$FG$$.");
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Init;
Fs->animate_task=Spawn(&AnimateTask,Fs,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_R_DOWN);
switch (msg_code) {
case MSG_MS_L_DOWN: //Doesn't do anything, yet.
break;
case MSG_MS_R_DOWN: //Doesn't do anything, yet.
break;
case MSG_KEY_DOWN:
switch (arg1) {
case '\n':
ReInit;
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto rh_done;
}
break;
}
}
rh_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
MenuPop;
SettingsPop;
CleanUp;
RegWrite("TempleOS/RawHide","F64 best_score=%5.4f;\n",best_score);
}
RawHide;
öÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ’öÿÿÿóÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÚöÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ d
ùÿÿÿ
úÿÿÿðÿÿÿúÿÿÿ
ÿÿÿÿðÿÿÿÿÿÿÿ
ðÿÿÿÿÿÿÿÿÿÿÿúÿÿÿ
ÿÿÿÿÿÿÿÿðÿÿÿúÿÿÿzöÿÿÿóÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿzöÿÿÿóÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÚöÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÚöÿÿÿïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿñÿÿÿêÿÿÿ" ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ò ÊÿÿÿõÿÿÿxDÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
 

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
 


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
 

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ




ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ    

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ 





ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ




ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  




ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
  


ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿ


ÿÿÿÿÿÿÿÿÿÿÿ



ÿÿÿÿÿÿÿÿÿÿ

  
 

ÿÿÿÿÿÿÿÿÿ


 
ÿÿÿÿÿÿÿÿ
  






 ÿÿÿÿÿÿÿ


 








ÿÿÿÿÿÿ




ÿÿÿÿÿ





ÿÿÿ



 


ÿÿÿ

 





ÿÿ
  



ÿ



 
 

  




 














 

 






 


 
 
 
 



 
 

  





   
 
     ÿ ÿÿÿÿ  ÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿ   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,33 @@
//Generate "StadiumBG.GR.Z" from "StadiumBG.DD.Z"
U0 StadiumGen()
{
U0 (*fp_old_update)(CDC *dc);
CDC *dc,*dc2;
Cd(__DIR__);
AutoComplete;
WinBorder;
WinMax;
DocCursor(OFF);
DocClear;
Type("StadiumBG.DD");
"$$CM,0,%d$$",TEXT_ROWS-3;
fp_old_update=gr.fp_final_scrn_update; //hide mouse cursor
gr.fp_final_scrn_update=NULL;
Refresh(2,TRUE);
dc2=DCScrnCapture;
dc=DCExt(dc2,0,FONT_HEIGHT,GR_WIDTH,GR_HEIGHT);
DCDel(dc2);
GRWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
DCDel(dc);
DocCursor(ON);
gr.fp_final_scrn_update=fp_old_update;
DocClear;
}
StadiumGen;
File diff suppressed because it is too large. Load diff
Binary file not shown.
+125
View File
@@ -0,0 +1,125 @@
I8 board [9];
I64 board_x[9]={150,250,350,150,250,350,150,250,350};
I64 board_y[9]={150,150,150,250,250,250,350,350,350};
U0 DrawX(CDC *dc,I64 x,I64 y)
{
dc->pen_width=5;
GrLine3(dc,x-20,y-20,0,x+20,y+20,0);
GrLine3(dc,x+20,y-20,0,x-20,y+20,0);
}
U0 DrawO(CDC *dc,I64 x,I64 y)
{
dc->pen_width=5;
GrCircle3(dc,x,y,0,25);
}
U0 DrawBoard(I64 player)
{
I64 i;
CDC *dc=DCAlias;
DCFill;
dc->pen_width=5;
GrLine3(dc,200,100,0,200,400,0);
GrLine3(dc,300,100,0,300,400,0);
GrLine3(dc,100,200,0,400,200,0);
GrLine3(dc,100,300,0,400,300,0);
for (i=0;i<9;i++)
switch (board[i]) {
case 1:
DrawX(dc,board_x[i],board_y[i]);
break;
case 2:
DrawO(dc,board_x[i],board_y[i]);
break;
}
//ms.pos.x,ms.pos.y are mouse x,y.
//ms.lb is mouse left bttn
if (player==1)
DrawX(dc,ms.pos.x-Fs->pix_left,ms.pos.y-Fs->pix_top);
else
DrawO(dc,ms.pos.x-Fs->pix_left,ms.pos.y-Fs->pix_top);
DCDel(dc);
}
U0 TakeTurn(I64 player)
{
I64 i,x=0,y=0;
while (!(100<=x<400) || !(100<=y<400) || board[i]) {
if (player==1)
Beep;
else
Beep(74);
while (!ms.lb) {
DrawBoard(player);
Refresh;
}
while (ms.lb) {
DrawBoard(player);
Refresh;
}
x=ms.pos.x-Fs->pix_left;
y=ms.pos.y-Fs->pix_top;
i=(x-100)/100+(y-100)/100*3;
}
board[i]=player;
}
Bool CheckWinner(I64 player)
{
if ( player==board[0]==board[1]==board[2] ||
player==board[3]==board[4]==board[5] ||
player==board[6]==board[7]==board[8] ||
player==board[0]==board[3]==board[6] ||
player==board[1]==board[4]==board[7] ||
player==board[2]==board[5]==board[8] ||
player==board[0]==board[4]==board[8] ||
player==board[2]==board[4]==board[6] )
return TRUE;
else
return FALSE;
}
U0 DoGame()
{
I64 moves=0;
MemSet(board,0,sizeof(board));
while (TRUE) {
TakeTurn(1);
if (CheckWinner(1)) {
Beep;
Beep;
Beep;
break;
}
if (++moves==9) break;
TakeTurn(2);
if (CheckWinner(2)) {
Beep(74);
Beep(74);
Beep(74);
break;
}
if (++moves==9) break;
}
}
U0 TicTacToe()
{
WinMax; //Maximize window
DocClear; //Clear window text.
"$$GREEN$$CTRL-ALT-c$$FG$$ to exit.\n";
try
while (TRUE)
DoGame;
catch
PutExcept;
DCFill;
}
TicTacToe;
+357
View File
@@ -0,0 +1,357 @@
U0 InitDefines()
{
I64 w=GR_WIDTH,h=GR_HEIGHT-FONT_HEIGHT,cols,rows,
size=PopUpRangeI64(1,9,,"Size\n"),rad=16-size;
if (size<0) throw;
DefinePrint("UNITS_NUM","%d",4096/SqrI64(rad)&~1);
DefinePrint("CIRCLE_RAD","%d",rad);
DefinePrint("MOVE_CIRCLES","%d",40/rad);
cols=(w-8-rad)/(2*rad)&~1-1;
DefinePrint("BORDER_X","%d",(w+rad-cols*2*rad)/2);
rows=(h-8)/(2*rad)&~1;
DefinePrint("BORDER_Y","%d",(h-rows*2*rad)/2);
} InitDefines;
class Unit
{
I64 num,x,y,player,link,color;
Bool alive,king;
} u[UNITS_NUM];
CDC *map_dc;
I64 cur_player,num_alive[2],start_x,start_y,end_x,end_y;
Bool show_start;
U0 S2Circle(I64 *_x,I64 *_y)
{
I64 i,j;
j=(*_y-BORDER_Y)/(CIRCLE_RAD*2);
if (j&1)
i=(*_x-CIRCLE_RAD-BORDER_X)/(CIRCLE_RAD*2);
else
i=(*_x-BORDER_X)/(CIRCLE_RAD*2);
*_y=j;
*_x=i;
}
U0 Circle2S(I64 *_x,I64 *_y)
{
I64 j=*_y,i=*_x;
*_y=j*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_Y;
*_x=i*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_X;
if (j&1) *_x+=CIRCLE_RAD;
}
U0 S2W(I64 *_x,I64 *_y)
{
S2Circle(_x,_y);
Circle2S(_x,_y);
}
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i;
map_dc->flags|=DCF_NO_TRANSPARENTS;
GrBlot(dc,0,0,map_dc);
if (cur_player==0) {
dc->color=LTCYAN;
GrFloodFill(dc,0,0);
dc->color=CYAN;
} else {
dc->color=LTPURPLE;
GrFloodFill(dc,0,0);
dc->color=PURPLE;
}
GrPrint(dc,2,2,"Player %d",cur_player+1);
for (i=0;i<UNITS_NUM;i++)
if (u[i].alive) {
dc->color=u[i].color;
GrFloodFill(dc,u[i].x,u[i].y);
}
for (i=0;i<UNITS_NUM;i++)
if (u[i].alive && !u[i].king) {
dc->color=BLACK;
GrLine(dc,u[i].x,u[i].y,u[u[i].link].x,u[u[i].link].y);
if (Blink) {
dc->color=BLUE;
dc->pen_width=6;
GrPlot3(dc,(u[i].x+u[u[i].link].x)>>1,(u[i].y+u[u[i].link].y)>>1,0);
}
}
if (show_start) {
dc->color=LTRED;
GrLine(dc,start_x-4,start_y-4,start_x+4,start_y+4);
GrLine(dc,start_x-4,start_y+4,start_x+4,start_y-4);
GrLine(dc,start_x,start_y,end_x,end_y);
}
if ((num_alive[0]==1 || num_alive[1]==1) && Blink(4)) {
dc->color=BLACK;
GrPrint(dc,(task->pix_width-FONT_WIDTH*9)>>1,
(task->pix_height-FONT_HEIGHT)>>1,"Game Over");
}
}
Unit *UnitFind(I64 x,I64 y,I64 player)
{
I64 i,dd,best_dd=I64_MAX;
Unit *res=NULL;
for (i=0;i<UNITS_NUM;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;
res=&u[i];
}
}
}
return res;
}
U0 KillsChk(I64 x1,I64 y1,I64 player)
{
I64 i,j,x2,y2,dd;
Bool found;
for (i=0;i<UNITS_NUM;i++) {
if (u[i].player!=player && u[i].alive && !u[i].king) {
x2=(u[i].x+u[u[i].link].x)>>1;
y2=(u[i].y+u[u[i].link].y)>>1;
dd=SqrI64(x2-x1)+SqrI64(y2-y1);
if (dd<=(CIRCLE_RAD+2)*(CIRCLE_RAD+2)) {
u[i].alive=FALSE;
Snd(62);Sleep(100);Snd;Sleep(25);
num_alive[u[i].player]--;
do {
found=FALSE;
for (j=0;j<UNITS_NUM;j++)
if (u[j].alive && u[j].player!=player && !u[j].king &&
!u[u[j].link].alive) {
found=TRUE;
u[j].alive=FALSE;
Snd(62);Sleep(100);Snd;Sleep(25);
num_alive[u[j].player]--;
}
} while (found);
}
}
}
}
Bool UnitMove(Unit *tmpu,I64 x2,I64 y2)
{
I64 i,r,c,r2,c2,x=start_x,y=start_y;
S2W(&x2,&y2);
c2=x2; r2=y2;
S2Circle(&c2,&r2);
for (i=0;i<MOVE_CIRCLES+1;i++) {
c=x; r=y;
S2Circle(&c,&r);
if (c==c2 && r==r2) {
end_x=tmpu->x=x2;
end_y=tmpu->y=y2;
return TRUE;
}
if (r2!=r) {
if (r&1) {
if (c<c2) c++;
} else {
if (c>c2) c--;
}
}
if (r2>r) {
x=c; y=++r;
Circle2S(&x,&y);
} else if (r2<r) {
x=c; y=--r;
Circle2S(&x,&y);
} else if (c2>c) {
x=++c; y=r;
Circle2S(&x,&y);
} else if (c2<c) {
x=--c; y=r;
Circle2S(&x,&y);
}
}
return FALSE;
}
CDC *DrawHexMap(I64 *_w,I64 *_h)
{
CDC *dc=DCNew(*_w,*_h);
I64 i,j,x,y;
*_w=(dc->width-BORDER_X*2-CIRCLE_RAD)/(CIRCLE_RAD*2);
*_h=(dc->height-BORDER_Y*2)/(CIRCLE_RAD*2);
DCFill(dc,WHITE);
dc->color=LTGRAY;
for (j=0;j<*_h;j++) {
for (i=0;i<*_w;i++) {
x=i*CIRCLE_RAD*2+BORDER_X+CIRCLE_RAD;
y=j*CIRCLE_RAD*2+BORDER_Y+CIRCLE_RAD;
if (j&1) x+=CIRCLE_RAD;
S2W(&x,&y);
GrCircle(dc,x,y,CIRCLE_RAD);
}
}
*_w*=CIRCLE_RAD*2;
*_h*=CIRCLE_RAD*2;
return dc;
}
U0 Init()
{
I64 i,j,j1,j2,dd,best_dd,best,w=Fs->pix_width,h=Fs->pix_height;
map_dc=DrawHexMap(&w,&h);
cur_player=0;
for (i=0;i<UNITS_NUM/2;i++) {
u[i].num=i;
u[i+UNITS_NUM/2].num=i+UNITS_NUM/2;
ti_restart:
u[i].y=FloorI64(RandU32%h,CIRCLE_RAD*2)+CIRCLE_RAD;
u[i+UNITS_NUM/2].y=h-1-u[i].y;
j1=u[i].y/(CIRCLE_RAD*2);
j2=u[i+UNITS_NUM/2].y/(CIRCLE_RAD*2);
u[i].y+=BORDER_Y;
u[i+UNITS_NUM/2].y+=BORDER_Y;
if (!i) {
u[i].x=CIRCLE_RAD;
if (j1&1)
goto ti_restart;
} else
u[i].x=FloorI64(RandU32%((w-CIRCLE_RAD*2*2)/2),CIRCLE_RAD*2)+CIRCLE_RAD;
u[i+UNITS_NUM/2].x=w-1-u[i].x;
if (j1&1)
u[i].x+=CIRCLE_RAD;
if (j2&1)
u[i+UNITS_NUM/2].x+=CIRCLE_RAD;
u[i].x+=BORDER_X;
u[i+UNITS_NUM/2].x+=BORDER_X;
S2W(&u[i].x,&u[i].y);
S2W(&u[i+UNITS_NUM/2].x,&u[i+UNITS_NUM/2].y);
u[i].player=0;
u[i+UNITS_NUM/2].player=1;
u[i].alive=TRUE;
u[i+UNITS_NUM/2].alive=TRUE;
if (!i) {
u[i].color=LTCYAN;
u[i+UNITS_NUM/2].color=LTPURPLE;
u[i].king=TRUE;
u[i+UNITS_NUM/2].king=TRUE;
} else {
u[i].color=CYAN;
u[i+UNITS_NUM/2].color=PURPLE;
u[i].king=FALSE;
u[i+UNITS_NUM/2].king=FALSE;
}
}
for (i=0;i<UNITS_NUM/2;i++) {
if (!u[i].king) {
best_dd=I64_MAX;
for (j=0;j<UNITS_NUM/2;j++) {
if (i!=j) {
dd=SqrI64(u[i].x-u[j].x)+SqrI64(u[i].y-u[j].y);
if (u[j].x<=u[i].x && dd<best_dd) {
best_dd=dd;
best=j;
}
}
}
u[i].link=best;
u[i+UNITS_NUM/2].link=best+UNITS_NUM/2;
}
}
num_alive[0]=UNITS_NUM/2;
num_alive[1]=UNITS_NUM/2;
}
U0 CleanUp()
{
DCDel(map_dc);
}
U0 TreeCheckers()
{
I64 msg_code,arg1,arg2,ch,sc;
Unit *tmpu;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
"}"
);
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
PopUpOk("Step on the link mid points.\n");
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
-WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU;
try {
cn_start:
Init;
tmpu=NULL;
show_start=FALSE;
Fs->draw_it=&DrawIt;
while (TRUE) {
msg_code=GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);
switch (msg_code) {
case MSG_KEY_DOWN:
switch (arg1) {
case '\n':
CleanUp;
goto cn_start;
case CH_ESC:
case CH_SHIFT_ESC:
goto cn_done;
}
break;
case MSG_MS_L_DOWN:
if (num_alive[0]>1 && num_alive[1]>1) {
tmpu=UnitFind(arg1,arg2,cur_player);
end_x=start_x=tmpu->x;
end_y=start_y=tmpu->y;
show_start=TRUE;
}
break;
case MSG_MS_MOVE:
if (tmpu)
UnitMove(tmpu,arg1,arg2);
break;
case MSG_MS_L_UP:
UnitMove(tmpu,arg1,arg2);
KillsChk(tmpu->x,tmpu->y,cur_player);
show_start=FALSE;
tmpu=NULL;
cur_player=1-cur_player;
break;
}
}
cn_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
PutExcept;
SettingsPop;
CleanUp;
MenuPop;
}
TreeCheckers;
+796
View File
@@ -0,0 +1,796 @@
$SP,"<1>",BI=1$
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
RegDft("TempleOS/Varoom","F64 best_score=9999;\n");
RegExe("TempleOS/Varoom");
F64 distance,t0,tf;
Bool game_over;
#define BORDER 7500
#define RADIUS 10000
#define WIDTH 2000
#define SHOULDER 200
#define D_é (2*ã/360) //Curve track slice is one degree.
#define D_S (2*ã*RADIUS/360) //Straight track is degree at 10000.
#define DIPS 5
#define DIP_DEPTH 50
class Track
{
Track *next,*last;
I32 num;
CColorROPU16 c,pad;
I64 x,z;
F64 é,d;
CD3I32 left[4],center[4],right[4];
} track_head,
*track_start[MP_PROCESSORS_NUM],*track_end[MP_PROCESSORS_NUM];
CDC *track_map;
#define MAP_BITS 9
I64 t_minx,t_maxx,t_minz,t_maxz;
#define BUSHES_NUM 512
class Bush
{
CD3I32 p;
Bool sym,pad[3];
U8 *img;
} b[BUSHES_NUM];
#define CARS_NUM 8
class Car
{
CD3I32 p;
F64 é,dé,speed;
U8 *img;
Track *t;
} c[CARS_NUM];
I64 DipY(I64 x,I64 z)
{
F64 m,a;
R2P(&m,&a,x,z);
return DIP_DEPTH*m*Cos(DIPS*a)/RADIUS;
}
#define CAR_LENGTH 400
F64 Dipé(I64 x,I64 z,F64 é)
{
F64 y_front,y_back;
y_front=DipY(x-CAR_LENGTH/2*Cos(é),z-CAR_LENGTH/2*Sin(é));
y_back =DipY(x+CAR_LENGTH/2*Cos(é),z+CAR_LENGTH/2*Sin(é));
return ASin((y_front-y_back)/CAR_LENGTH);
}
Track *TrackFind(Track *_tmpt,I64 x,I64 z)
{
Track *res=_tmpt,*tmpt;
I64 dd,best=SqrI64(res->x-x)+SqrI64(res->z-z);
tmpt=_tmpt;
while (TRUE) {
tmpt=tmpt->next;
if (tmpt==&track_head)
tmpt=tmpt->next;
dd=SqrI64(tmpt->x-x)+SqrI64(tmpt->z-z);
if (dd<best) {
best=dd;
res=tmpt;
} else
break;
}
tmpt=_tmpt;
while (TRUE) {
tmpt=tmpt->last;
if (tmpt==&track_head)
tmpt=tmpt->last;
dd=SqrI64(tmpt->x-x)+SqrI64(tmpt->z-z);
if (dd<best) {
best=dd;
res=tmpt;
} else
break;
}
return res;
}
U0 TrackSlice(F64 *_x,F64 *_z,F64 é,F64 d)
{
F64 x=*_x,z=*_z,c=Cos(é),s=Sin(é),dx=d*s,dz=-d*c;
Track *tmpt,*last=track_head.last;
if (last==&track_head)
last=NULL;
tmpt=CAlloc(sizeof(Track));
if (last) {
MemCpy(&tmpt->center[0],&last->center[3],sizeof(CD3I32));
MemCpy(&tmpt->center[1],&last->center[2],sizeof(CD3I32));
}
tmpt->center[2].x=x+(WIDTH/2)*c+dx;
tmpt->center[2].z=z+(WIDTH/2)*s+dz;
tmpt->center[2].y=DipY(tmpt->center[2].x,tmpt->center[2].z);
tmpt->center[3].x=x-(WIDTH/2)*c+dx;
tmpt->center[3].z=z-(WIDTH/2)*s+dz;
tmpt->center[3].y=DipY(tmpt->center[3].x,tmpt->center[3].z);
if (last) {
MemCpy(&tmpt->left[0],&last->left[3],sizeof(CD3I32));
MemCpy(&tmpt->left[1],&last->left[2],sizeof(CD3I32));
}
tmpt->left[2].x=x-(WIDTH/2)*c+dx;
tmpt->left[2].z=z-(WIDTH/2)*s+dz;
tmpt->left[2].y=DipY(tmpt->left[2].x,tmpt->left[2].z);
tmpt->left[3].x=x-(WIDTH/2+SHOULDER)*c+dx;
tmpt->left[3].z=z-(WIDTH/2+SHOULDER)*s+dz;
tmpt->left[3].y=DipY(tmpt->left[3].x,tmpt->left[3].z);
if (last) {
MemCpy(&tmpt->right[0],&last->right[3],sizeof(CD3I32));
MemCpy(&tmpt->right[1],&last->right[2],sizeof(CD3I32));
}
tmpt->right[2].x=x+(WIDTH/2+SHOULDER)*c+dx;
tmpt->right[2].z=z+(WIDTH/2+SHOULDER)*s+dz;
tmpt->right[2].y=DipY(tmpt->right[2].x,tmpt->right[2].z);
tmpt->right[3].x=x+(WIDTH/2)*c+dx;
tmpt->right[3].z=z+(WIDTH/2)*s+dz;
tmpt->right[3].y=DipY(tmpt->right[3].x,tmpt->right[3].z);
tmpt->x=x;
tmpt->z=z;
tmpt->é=é;
tmpt->num=track_head.last->num+1;
tmpt->d =track_head.last->d+d;
QueIns(tmpt,track_head.last);
if (tmpt->num&1)
tmpt->c=RED;
else
tmpt->c=WHITE;
if (x<t_minx) t_minx=x;
if (x>t_maxx) t_maxx=x;
if (z<t_minz) t_minz=z;
if (z>t_maxz) t_maxz=z;
x+=dx;
*_x=x;
z+=dz;
*_z=z;
if (x<t_minx) t_minx=x;
if (x>t_maxx) t_maxx=x;
if (z<t_minz) t_minz=z;
if (z>t_maxz) t_maxz=z;
}
U0 CoupleEnds()
{
Track *first=track_head.next,*last=track_head.last;
MemCpy(&first->center[0],&last->center[3],sizeof(CD3I32));
MemCpy(&first->center[1],&last->center[2],sizeof(CD3I32));
MemCpy(&first->left[0] ,&last->left[3] ,sizeof(CD3I32));
MemCpy(&first->left[1] ,&last->left[2] ,sizeof(CD3I32));
MemCpy(&first->right[0] ,&last->right[3] ,sizeof(CD3I32));
MemCpy(&first->right[1] ,&last->right[2] ,sizeof(CD3I32));
}
U0 InitTrack()
{
I64 i,j;
Track *tmpt;
F64 x,z,é,d;
MemSet(&track_head,0,sizeof(Track));
QueInit(&track_head);
t_minx=t_minz=I64_MAX;
t_maxx=t_maxz=I64_MIN;
x=0; z=0; é=0;
for (d=0;d<6*RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (d=0;d<RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<90;i++,é-=D_é)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (i=0;i<90;i++,é-=D_é)
TrackSlice(&x,&z,é,D_é*RADIUS);
for (d=0;d<RADIUS;d+=D_S)
TrackSlice(&x,&z,é,D_S);
for (i=0;i<180;i++,é+=D_é)
TrackSlice(&x,&z,é,D_é*RADIUS);
CoupleEnds;
tmpt=track_head.next;
for (i=0;i<mp_cnt;i++) {
j=(i+1)*track_head.last->num/mp_cnt+1;
track_start[i]=tmpt;
while (tmpt!=&track_head && tmpt->num!=j)
tmpt=tmpt->next;
track_end[i]=tmpt;
}
t_minx-=BORDER; t_minz-=BORDER;
t_maxx+=BORDER; t_maxz+=BORDER;
track_map=DCNew((t_maxx-t_minx+1<<MAP_BITS-1)>>MAP_BITS,
(t_maxz-t_minz+1<<MAP_BITS-1)>>MAP_BITS);
track_map->color=LTGRAY;
GrRect(track_map,0,0,track_map->width,track_map->height);
tmpt=track_head.next;
track_map->color=YELLOW;
track_map->pen_width=3;
while (tmpt!=&track_head) {
GrPlot3(track_map,track_map->width-(tmpt->x-t_minx)>>MAP_BITS,
(tmpt->z-t_minz)>>MAP_BITS,0);
tmpt=tmpt->next;
}
}
#define HORIZON_DIP 200
Bool PrepPoly(CD3I32 *p,I64 *r,I64 cx,I64 h,CD3I32 *poly)
{
I64 x,y,z,i;
F64 s;
for (i=0;i<4;i++) {
x=p[i].x-c[0].p.x;
y=p[i].y-c[0].p.y;
z=p[i].z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
s=100.0/(AbsI64(z)+50);
poly[i].y=s*y+h;
if (z<-200 || !(-h<poly[i].y<2*h))
return FALSE;
poly[i].x=s*x+cx;
poly[i].z=z+GR_Z_ALL;
}
return TRUE;
}
I64 mp_not_done_flags;
U0 MPUpdateWin(CDC *dc2)
{
CTask *task=dc2->win_task;
I64 i,x,y,z,
w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
F64 s,dip_é=Dipé(c[0].p.x,c[0].p.z,c[0].é);
Car *tmpc;
CD3I32 poly[4];
Track *tmpt,*tmpt1;
CDC *dc=DCAlias(gr.dc2,task);
Mat4x4IdentEqu(r);
Mat4x4RotY(r,ã-c[0].é);
Mat4x4RotX(r,75*ã/180-dip_é);
dc->depth_buf=dc2->depth_buf;
//Track
tmpt =track_start[Gs->num];
tmpt1=track_end [Gs->num];
while (tmpt!=tmpt1) {
dc->color=DKGRAY;
if (PrepPoly(&tmpt->center,r,cx,h,poly)) {
GrFillPoly3(dc,4,poly);
dc->color=tmpt->c;
if (PrepPoly(&tmpt->left,r,cx,h,poly))
GrFillPoly3(dc,4,poly);
if (PrepPoly(&tmpt->right,r,cx,h,poly))
GrFillPoly3(dc,4,poly);
}
tmpt=tmpt->next;
}
dc->flags|=DCF_TRANSFORMATION;
for (i=Gs->num;i<BUSHES_NUM;i+=mp_cnt) {
x=b[i].p.x-c[0].p.x; y=b[i].p.y-c[0].p.y; z=b[i].p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
if (z>0) {
s=100.0/(AbsI64(z)+50);
Mat4x4IdentEqu(dc->r);
Mat4x4Scale(dc->r,s*2);
DCMat4x4Set(dc,dc->r);
if (b[i].sym) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,s*x+cx,s*y+h,s*x+cx,s*y+h+10);
}
Sprite3B(dc,s*x+cx,s*y+h,z+GR_Z_ALL,b[i].img);
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
}
}
for (i=Gs->num+1;i<CARS_NUM;i+=mp_cnt) {
tmpc=&c[i];
x=tmpc->p.x-c[0].p.x; y=tmpc->p.y-c[0].p.y; z=tmpc->p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
if (z>0) {
s=100.0/(AbsI64(z)+50);
Mat4x4IdentEqu(dc->r);
Mat4x4Scale(dc->r,s*2);
Mat4x4RotX(dc->r,Dipé(tmpc->p.x,tmpc->p.z,-tmpc->é));
Mat4x4RotY(dc->r,tmpc->é-c[0].é);
DCMat4x4Set(dc,dc->r);
Sprite3B(dc,s*x+cx,s*y+h,z+GR_Z_ALL,tmpc->img);
}
}
dc->depth_buf=NULL;
DCDel(dc);
LBtr(&mp_not_done_flags,Gs->num);
}
U0 VRTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
Mat4x4MulXYZ(dc->r,x,y,z);
zz=400+*z;
if (zz<1) zz=1;
*x=400* *x/zz;
*y=400* *y/zz;
*x+=dc->x;
*y+=dc->y;
*z+=dc->z;
}
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,x,y,z,
w=task->pix_width,
h=task->pix_height,r[16],
cx=w>>1;
F64 s,dip_é=Dipé(c[0].p.x,c[0].p.z,c[0].é);
Car *tmpc=&c[0];
dc->color=LTCYAN;
GrRect(dc,0,0,w,HORIZON_DIP*Sin(dip_é)+FONT_HEIGHT*4.5);
Mat4x4IdentEqu(r);
Mat4x4RotY(r,ã-c[0].é);
Mat4x4RotX(r,75*ã/180-dip_é);
DCDepthBufAlloc(dc);
//Sun
x=c[0].p.x; y=0; z=1000000-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
s=100.0/(AbsI64(z)+50);
if (y<0) {
dc->color=BROWN;
GrCircle(dc,s*x+cx,15+HORIZON_DIP*Sin(dip_é),15);
dc->color=YELLOW;
GrFloodFill(dc,s*x+cx,15+HORIZON_DIP*Sin(dip_é));
}
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
JobQue(&MPUpdateWin,dc,i);
while (mp_not_done_flags)
Yield;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,tmpc->dé);
Mat4x4RotX(r,0.4-8*dip_é); //Made this up
dc->transform=&VRTransform;
dc->x=task->pix_width>>1;
dc->y=task->pix_height-150;
dc->z=GR_Z_ALL;
Sprite3Mat4x4B(dc,0,0,-100,c[0].img,r);
//Map
GrBlot(dc,w-track_map->width,h-track_map->height,track_map);
dc->pen_width=2;
for (i=0;i<CARS_NUM;i++) {
if (i)
dc->color=LTPURPLE;
else
dc->color=LTCYAN;
GrPlot3(dc,w-(c[i].p.x-t_minx)>>MAP_BITS,
h-track_map->height+(c[i].p.z-t_minz)>>MAP_BITS,0);
}
if (game_over) {
dc->color=LTRED;
if (tf) {
s=tf-t0;
if (Blink)
GrPrint(dc,(w-FONT_WIDTH*14)/2,(h-FONT_HEIGHT)/2,"Game Completed");
} else {
s=99.9;
if (Blink)
GrPrint(dc,(w-FONT_WIDTH*9)/2,(h-FONT_HEIGHT)/2,"Game Over");
}
} else
s=tS-t0;
dc->color=BLACK;
GrPrint(dc,0,0,"%0.1f%% Time:%0.2f Best:%0.2f",
100.0*distance/track_head.last->d,s,best_score);
}
U0 AnimateTask(I64)
{
Car *tmpc;
I64 i,x,z;
Bool on_track;
Track *tmpt,*tmpt2;
while (TRUE) {
if (!game_over)
Snd(12.0*Log2(c[0].speed/500+0.7));
else
Snd;
for (i=0;i<CARS_NUM;i++) {
tmpc=&c[i];
tmpc->p.x-=0.01*tmpc->speed*Cos(tmpc->é-ã/2);
tmpc->p.z+=0.01*tmpc->speed*Sin(tmpc->é-ã/2);
tmpt=TrackFind(tmpc->t,tmpc->p.x,tmpc->p.z);
if (i) {
if (tmpt!=tmpc->t) {
tmpt2=tmpt->next;
if (tmpt2==&track_head)
tmpt2=tmpt2->next;
tmpc->é=Arg(-tmpt2->z+tmpc->p.z,-tmpt2->x+tmpc->p.x);
}
} else {
tmpc->é+=0.01*tmpc->dé;
x=track_map->width-(tmpc->p.x-t_minx)>>MAP_BITS;
z=(tmpc->p.z-t_minz)>>MAP_BITS;
if (GrPeek(track_map,x,z)!=YELLOW) {
on_track=FALSE;
tmpc->speed-=0.01*tmpc->speed;
if (tmpc->speed<0) tmpc->speed=0;
} else
on_track=TRUE;
}
tmpc->t=tmpt;
tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
}
if (!game_over && on_track) {
for (i=1;i<CARS_NUM;i++)
if (D3I32DistSqr(&c[i].p,&c[0].p)<CAR_LENGTH>>1*CAR_LENGTH>>1) {
game_over=TRUE;
Noise(500,22,34);
Sleep(500);
break;
}
if (!game_over) {
distance+=0.01*c[0].speed;
if (distance>track_head.last->d&& c[0].t->num<track_head.last->num>>1) {
tf=tS;
game_over=TRUE;
Beep;
if (tf-t0<best_score) {
best_score=tf-t0;
Beep;
}
}
}
}
Sleep(10);
}
}
U8 *imgs[8]={$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<4>",BI=4$};
U0 InitBushes()
{
Bush *tmpb;
I64 i,j,x,z;
track_map->color=LTGREEN;
track_map->pen_width=1;
for (i=0;i<BUSHES_NUM;i++) {
tmpb=&b[i];
ib_restart:
tmpb->p.x=Rand*(t_maxx-t_minx)+t_minx;
tmpb->p.z=Rand*(t_maxz-t_minz)+t_minz;
x=track_map->width-(tmpb->p.x-t_minx)>>MAP_BITS;
z=(tmpb->p.z-t_minz)>>MAP_BITS;
for (j=0;j<8;j++)
if (GrPeek(track_map,x+gr_x_offsets[j],z+gr_y_offsets[j])!=LTGRAY)
goto ib_restart;
GrPlot(track_map,x,z);
tmpb->p.y=DipY(tmpb->p.x,tmpb->p.z);
tmpb->sym=RandU16&1;
tmpb->img=imgs[i&7];
}
}
U0 Init()
{
Car *tmpc;
Track *tmpt;
F64 d;
I64 i;
InitTrack;
InitBushes;
tmpt=track_head.next;
for (i=0;i<CARS_NUM;i++) {
tmpc=&c[i];
tmpc->t=tmpt;
tmpc->p.x=tmpt->x;
tmpc->p.z=tmpt->z;
tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
tmpc->é =-tmpt->é;
tmpc->dé=0;
if (!i) {
tmpc->img=$IB,"<5>",BI=5$;
tmpc->speed=0;
} else {
tmpc->img=$IB,"<6>",BI=6$;
tmpc->speed=2500.0;
}
d=(i+1)*track_head.last->d/CARS_NUM;
while (tmpt->next!=&track_head && tmpt->d<d)
tmpt=tmpt->next;
}
distance=0;
tf=0;
t0=tS;
game_over=FALSE;
}
U0 CleanUp()
{
while (mp_not_done_flags)
Yield;
QueDel(&track_head,TRUE);
DCDel(track_map);
}
U0 Varoom()
{
I64 sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" Accelerator(,,SC_CURSOR_UP);"
" Brake(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
try {
Fs->text_attr=YELLOW<<4+BLUE;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Init;
Fs->draw_it=&DrawIt;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
while (TRUE)
switch (GetKey(&sc)) {
case 0:
switch (sc.u8[0]) {
case SC_CURSOR_LEFT:
c[0].dé-=ã/60;
break;
case SC_CURSOR_RIGHT:
c[0].dé+=ã/60;
break;
case SC_CURSOR_UP:
c[0].speed+=300;
break;
case SC_CURSOR_DOWN:
c[0].speed-=900;
if (c[0].speed<0) c[0].speed=0;
break;
}
break;
case '\n':
CleanUp;
Init;
break;
case CH_SHIFT_ESC:
case CH_ESC:
goto vr_done;
}
vr_done: //Don't goto out of try
} catch
PutExcept;
CleanUp;
SettingsPop;
MenuPop;
RegWrite("TempleOS/Varoom","F64 best_score=%5.4f;\n",best_score);
}
Varoom;
ö
þÿÿÿèÿÿÿ
ôÿÿÿêÿÿÿ
þÿÿÿîÿÿÿúÿÿÿèÿÿÿ
øÿÿÿúÿÿÿôÿÿÿ
ôÿÿÿìÿÿÿ
âÿÿÿúÿÿÿèÿÿÿ
àÿÿÿ
ìÿÿÿ
îÿÿÿàÿÿÿ
üÿÿÿîÿÿÿ
øÿÿÿâÿÿÿ
øÿÿÿ
öÿÿÿúÿÿÿþÿÿÿ
úÿÿÿüÿÿÿÜÿÿÿ
úÿÿÿðÿÿÿúÿÿÿäÿÿÿã
æÿÿÿöÿÿÿäÿÿÿ
ìÿÿÿìÿÿÿæÿÿÿüÿÿÿ
äÿÿÿÖÿÿÿ
Öÿÿÿæÿÿÿ
æÿÿÿ"àÿÿÿ
êÿÿÿ$äÿÿÿ
ìÿÿÿ$æÿÿÿ
äÿÿÿúÿÿÿäÿÿÿúÿÿÿ
æÿÿÿüÿÿÿæÿÿÿüÿÿÿ
îÿÿÿúÿÿÿ êÿÿÿ
"Üÿÿÿ&æÿÿÿ
äÿÿÿ àÿÿÿ
þÿÿÿ
üÿÿÿ
üÿÿÿðÿÿÿ
êÿÿÿ øÿÿÿ
øÿÿÿèÿÿÿ
èÿÿÿþÿÿÿ
þÿÿÿîÿÿÿ
ìÿÿÿþÿÿÿ
þÿÿÿîÿÿÿ
öÿÿÿ ìÿÿÿ
êÿÿÿðÿÿÿ
ðÿÿÿäÿÿÿ
âÿÿÿðÿÿÿ
ðÿÿÿêÿÿÿ
êÿÿÿúÿÿÿ
 öÿÿÿ”
úÿÿÿÄÿÿÿ
úÿÿÿÄÿÿÿøÿÿÿúÿÿÿ
üÿÿÿÂÿÿÿüÿÿÿ
úÿÿÿÄÿÿÿæÿÿÿ¤ÿÿÿ
üÿÿÿÂÿÿÿäÿÿÿ¤ÿÿÿ
øÿÿÿ¼ÿÿÿúÿÿÿ†ÿÿÿ
Äÿÿÿüÿÿÿ„ÿÿÿ
þÿÿÿºÿÿÿ
Œÿÿÿ
Œÿÿÿüÿÿÿ¸ÿÿÿ
¦ÿÿÿšÿÿÿ
šÿÿÿzÿÿÿ
zÿÿÿ„ÿÿÿ
†ÿÿÿžÿÿÿ
žÿÿÿvÿÿÿ
vÿÿÿþÿÿÿ`ÿÿÿ
þÿÿÿ`ÿÿÿìÿÿÿ„ÿÿÿ
ìÿÿÿ„ÿÿÿöÿÿÿ¬ÿÿÿ
öÿÿÿ¬ÿÿÿâÿÿÿžÿÿÿ
âÿÿÿžÿÿÿØÿÿÿ¨ÿÿÿ
Øÿÿÿ¨ÿÿÿîÿÿÿºÿÿÿ
îÿÿÿºÿÿÿòÿÿÿºÿÿÿ
ôÿÿÿ¸ÿÿÿúÿÿÿ¸ÿÿÿ
–ÿÿÿˆÿÿÿ
„ÿÿÿŠÿÿÿ
þÿÿÿŽÿÿÿþÿÿÿjÿÿÿ
þÿÿÿjÿÿÿôÿÿÿ‚ÿÿÿ
ôÿÿÿ‚ÿÿÿøÿÿÿœÿÿÿ
ôÿÿÿ´ÿÿÿîÿÿÿ¦ÿÿÿ
èÿÿÿ²ÿÿÿÞÿÿÿ¦ÿÿÿ
œÿÿÿ–ÿÿÿ
øÿÿÿ€ÿÿÿhÿÿÿ
ˆÿÿÿ€ÿÿÿ
þÿÿÿ~ÿÿÿnÿÿÿ
~ÿÿÿ’ÿÿÿ
œÿÿÿ¨ÿÿÿ
öÿÿÿ²ÿÿÿðÿÿÿ‚ÿÿÿ
ðÿÿÿ‚ÿÿÿúÿÿÿjÿÿÿ
êÿÿÿ´ÿÿÿÞÿÿÿ ÿÿÿJ␍`ŒFçÿÿÿ}-çÿÿÿ}-çÿÿÿKFçÿÿÿK7ýÿÿÿ‡7ýÿÿÿ–ýÿÿÿ–(ýÿÿÿ‡(ýÿÿÿA7ýÿÿÿA7ýÿÿÿýÿÿÿF}-}-KFK7‡7––(‡(A7A7ºÿÿÿçÿÿÿ}Óÿÿÿçÿÿÿ}ÓÿÿÿçÿÿÿKºÿÿÿçÿÿÿKÉÿÿÿýÿÿÿ‡Éÿÿÿýÿÿÿ–ýÿÿÿ–Øÿÿÿýÿÿÿ‡ØÿÿÿýÿÿÿAÉÿÿÿýÿÿÿAÉÿÿÿýÿÿÿýÿÿÿºÿÿÿ}Óÿÿÿ}ÓÿÿÿKºÿÿÿKÉÿÿÿ‡Éÿÿÿ––Øÿÿÿ‡ØÿÿÿAÉÿÿÿAÉÿÿÿFçÿÿÿƒÿÿÿ-çÿÿÿƒÿÿÿ-çÿÿÿµÿÿÿFçÿÿÿµÿÿÿ7áÿÿÿyÿÿÿ7áÿÿÿjÿÿÿáÿÿÿjÿÿÿ(áÿÿÿyÿÿÿ(áÿÿÿ¿ÿÿÿ7áÿÿÿ¿ÿÿÿ7ýÿÿÿýÿÿÿFƒÿÿÿ-ƒÿÿÿ-µÿÿÿFµÿÿÿ7yÿÿÿ7jÿÿÿjÿÿÿ(yÿÿÿ(¿ÿÿÿ7¿ÿÿÿ7ºÿÿÿçÿÿÿƒÿÿÿÓÿÿÿçÿÿÿƒÿÿÿÓÿÿÿçÿÿÿµÿÿÿºÿÿÿçÿÿÿµÿÿÿÉÿÿÿáÿÿÿyÿÿÿÉÿÿÿáÿÿÿjÿÿÿáÿÿÿjÿÿÿØÿÿÿáÿÿÿyÿÿÿØÿÿÿáÿÿÿ¿ÿÿÿÉÿÿÿáÿÿÿ¿ÿÿÿÉÿÿÿýÿÿÿýÿÿÿºÿÿÿƒÿÿÿÓÿÿÿƒÿÿÿÓÿÿÿµÿÿÿºÿÿÿµÿÿÿÉÿÿÿyÿÿÿÉÿÿÿjÿÿÿjÿÿÿØÿÿÿyÿÿÿØÿÿÿ¿ÿÿÿÉÿÿÿ¿ÿÿÿÉÿÿÿ ␍ ␍   ␍␍
    
$%&&'$%$$$'$%%&&'&#!"!# #     /-.-/,/*,,*++)(+*)+(+ + +(!.-.!" + + ,*)*<=>>?<1033211=<<01<?330<1=2=>2>233?>;9:9;8867754765GEFEGDGBDDBCCA@CBA4C@C474C7C4@9FEF9:8C7C8D5BAB56TUVVWTIHKKJIIUTTHITWKKHTIUJUVJVJKKWVSRQQPSPONOLMOMN_^]]\__\Z\[Z[XY[YZLX[[OLLO[[XLQ]^^RQPO[[\PMYZZNM P88P654@@A5LMYYXLJ␍`ŒFçÿÿÿ}-çÿÿÿ}-çÿÿÿKFçÿÿÿK7ýÿÿÿ‡7ýÿÿÿ–ýÿÿÿ–(ýÿÿÿ‡(ýÿÿÿA7ýÿÿÿA7ýÿÿÿýÿÿÿF}-}-KFK7‡7––(‡(A7A7ºÿÿÿçÿÿÿ}Óÿÿÿçÿÿÿ}ÓÿÿÿçÿÿÿKºÿÿÿçÿÿÿKÉÿÿÿýÿÿÿ‡Éÿÿÿýÿÿÿ–ýÿÿÿ–Øÿÿÿýÿÿÿ‡ØÿÿÿýÿÿÿAÉÿÿÿýÿÿÿAÉÿÿÿýÿÿÿýÿÿÿºÿÿÿ}Óÿÿÿ}ÓÿÿÿKºÿÿÿKÉÿÿÿ‡Éÿÿÿ––Øÿÿÿ‡ØÿÿÿAÉÿÿÿAÉÿÿÿFçÿÿÿƒÿÿÿ-çÿÿÿƒÿÿÿ-çÿÿÿµÿÿÿFçÿÿÿµÿÿÿ7áÿÿÿyÿÿÿ7áÿÿÿjÿÿÿáÿÿÿjÿÿÿ(áÿÿÿyÿÿÿ(áÿÿÿ¿ÿÿÿ7áÿÿÿ¿ÿÿÿ7ýÿÿÿýÿÿÿFƒÿÿÿ-ƒÿÿÿ-µÿÿÿFµÿÿÿ7yÿÿÿ7jÿÿÿjÿÿÿ(yÿÿÿ(¿ÿÿÿ7¿ÿÿÿ7ºÿÿÿçÿÿÿƒÿÿÿÓÿÿÿçÿÿÿƒÿÿÿÓÿÿÿçÿÿÿµÿÿÿºÿÿÿçÿÿÿµÿÿÿÉÿÿÿáÿÿÿyÿÿÿÉÿÿÿáÿÿÿjÿÿÿáÿÿÿjÿÿÿØÿÿÿáÿÿÿyÿÿÿØÿÿÿáÿÿÿ¿ÿÿÿÉÿÿÿáÿÿÿ¿ÿÿÿÉÿÿÿýÿÿÿýÿÿÿºÿÿÿƒÿÿÿÓÿÿÿƒÿÿÿÓÿÿÿµÿÿÿºÿÿÿµÿÿÿÉÿÿÿyÿÿÿÉÿÿÿjÿÿÿjÿÿÿØÿÿÿyÿÿÿØÿÿÿ¿ÿÿÿÉÿÿÿ¿ÿÿÿÉÿÿÿ ␍ ␍   ␍␍
  
$%&&'$%$$$'$%%&&'&#!"!# #   /-.-/,/*,,*++)(+*)+(+ + +(!.-.!" + + ,*)*<=>>?<1033211=<<01<?330<1=2=>2>233?>;9:9;8867754765GEFEGDGBDDBCCA@CBA4C@C474C7C4@9FEF9:8C7C8D5BAB56TUVVWTIHKKJIIUTTHITWKKHTIUJUVJVJKKWVSRQQPSPONOLMOMN_^]]\__\Z\[Z[XY[YZLX[[OLLO[[XLQ]^^RQPO[[\PMYZZNM P88P654@@A5LMYYXL
+728
View File
@@ -0,0 +1,728 @@
RegDft("TempleOS/Wenceslas","F64 best_score=9999;\n");
RegExe("TempleOS/Wenceslas");
#define BORDER 5
#define KING_STEP 6
$SP,"<1>",BI=1$ //See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$ for making 3D men.
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
$SP,"<7>",BI=7$
$SP,"<8>",BI=8$
$SP,"<9>",BI=9$
$SP,"<10>",BI=10$
$SP,"<11>",BI=11$
U8 *king_imgs[4]={$IB,"<2>",BI=2$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$};
U8 *peasant_imgs[4]={$IB,"<5>",BI=5$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<6>",BI=6$};
#define TREES_NUM 8
class Tree
{
U16 x,y;
I64 fire_frame_idx;
} trees[TREES_NUM];
U64 snow_x,snow_y,new_snow_mS;
#define SNOW_TILE_SIZE 128
CDC *snow_tile;
I64 king_x,king_y,king_mS,king_phase,
not_stopped_cnt;
F64 king_timeout,king_é,t0,tf,door_open_t0;
I64 animate_mS,animate_phase;
#define PEASANTS_NUM 10
class Peasant
{
Peasant *next,*last;
F64 x,y,é,door_opened_t0;
Bool stopped;
} peasant_head;
class Step
{
Step *next,*last;
U16 x,y;
F64 t0;
} step_head,king_step_head;
U0 DrawIt(CTask *task,CDC *dc)
{
I64 r[16],i,w=task->pix_width,h=task->pix_height,x,y;
U8 *img,*tmps;
Step *tmpst;
Peasant *tmpp;
F64 tt;
dc->pen_width=1;
for (i=0;i<TREES_NUM;i++) {
if (trees[i].y<=h/2) {//Draw trees behind house
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
img=$IB,"<8>",BI=8$;
else
img=$IB,"<9>",BI=9$;
} else
img=$IB,"<7>",BI=7$;
Sprite3(dc,trees[i].x,trees[i].y,0,img);
}
}
Sprite3(dc,w/2,h/2,0,$IB,"<10>",BI=10$);
if (tS<door_open_t0+1.0)
Sprite3(dc,w/2,h/2,0,$IB,"<11>",BI=11$);
for (i=0;i<TREES_NUM;i++) {
if (trees[i].y>h/2) {//Draw trees in front of house
if (trees[i].fire_frame_idx) {
if (trees[i].fire_frame_idx++&1)
img=$IB,"<8>",BI=8$;
else
img=$IB,"<9>",BI=9$;
} else
img=$IB,"<7>",BI=7$;
Sprite3(dc,trees[i].x,trees[i].y,0,img);
}
}
tmpst=step_head.next;
while (tmpst!=&step_head) {
if (tS-tmpst->t0<2.0)
dc->color=DKGRAY;
else
dc->color=LTGRAY;
dc->pen_width=4;
GrPlot3(dc,tmpst->x,tmpst->y,0);
tmpst=tmpst->next;
}
DCDepthBufAlloc(dc);
dc->flags|=DCF_TRANSFORMATION;
dc->pen_width=1;
tmpp=peasant_head.next;
while (tmpp!=&peasant_head) {
Mat4x4IdentEqu(r);
Mat4x4RotY(r,tmpp->é+ã/2);
Mat4x4RotX(r,ã/6);
if (tmpp->stopped)
Sprite3Mat4x4B(dc,tmpp->x,tmpp->y,GR_Z_ALL,peasant_imgs[0],r);
else {
tmps=SpriteInterpolate(Saw(animate_mS/250.0,1.0),
peasant_imgs[ animate_phase &3],
peasant_imgs[(animate_phase+1)&3]);
Sprite3Mat4x4B(dc,tmpp->x,tmpp->y,GR_Z_ALL,tmps,r);
Free(tmps);
}
tmpp=tmpp->next;
}
dc->pen_width=1;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,king_é+ã/2);
Mat4x4RotX(r,ã/6);
if (tS>king_timeout)
Sprite3Mat4x4B(dc,king_x,king_y,GR_Z_ALL,king_imgs[0],r);
else {
tmps=SpriteInterpolate(Saw(king_mS/250.0,1.0),
king_imgs[ king_phase &3],
king_imgs[(king_phase+1)&3]);
Sprite3Mat4x4B(dc,king_x,king_y,GR_Z_ALL,tmps,r);
Free(tmps);
}
dc->pen_width=1;
dc->color=ROP_MONO|WHITE;
for (y=snow_y%SNOW_TILE_SIZE-SNOW_TILE_SIZE;y<=h;y+=SNOW_TILE_SIZE)
for (x=snow_x%SNOW_TILE_SIZE-SNOW_TILE_SIZE;x<=w;x+=SNOW_TILE_SIZE)
GrBlot(dc,x,y,snow_tile);
if (tf) {
dc->color=LTRED;
if (Blink)
GrPrint(dc,w/2-(FONT_WIDTH*14)/2,h/2+FONT_HEIGHT,"Game Completed");
tt=tf;
} else {
tt=tS;
}
dc->color=LTBLUE;
GrPrint(dc,0,0,"Freezing Peasants:%d Time:%3.2f Best:%3.2f",
not_stopped_cnt,tt-t0,best_score);
}
U0 StepNew(CTask *task,I64 x,I64 y,F64 é,Bool left_right,Bool king)
{
Step *tmps;
if (king) {
tmps=MAlloc(sizeof(Step),task);
tmps->x=x;
tmps->y=y;
tmps->t0=tS;
QueIns(tmps,king_step_head.last);
}
if (left_right) {
tmps=MAlloc(sizeof(Step),task);
tmps->x=x-3.5*Sin(é)+2.0*Cos(é);
tmps->y=y+3.5*Cos(é)+2.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x-3.5*Sin(é)+5.0*Cos(é);
tmps->y=y+3.5*Cos(é)+5.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
} else {
tmps=MAlloc(sizeof(Step),task);
tmps->x=x+3.5*Sin(é)+0.0*Cos(é);
tmps->y=y-3.5*Cos(é)+0.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x+3.5*Sin(é)+3.0*Cos(é);
tmps->y=y-3.5*Cos(é)+3.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
}
}
U0 Init()
{
I64 i,min_x,max_x,min_y,max_y,
w=Fs->pix_width,h=Fs->pix_height;
Peasant *tmpp;
snow_x=snow_y=0;
new_snow_mS=0;
snow_tile=DCNew(SNOW_TILE_SIZE,SNOW_TILE_SIZE);
SpriteExtents($IB,"<7>",BI=7$,&min_x,&max_x,&min_y,&max_y);
for (i=0;i<TREES_NUM;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_idx=0;
}
QueInit(&step_head);
QueInit(&king_step_head);
SpriteExtents($IB,"<12>",BI=12$,&min_x,&max_x,&min_y,&max_y);
QueInit(&peasant_head);
for (i=0;i<PEASANTS_NUM;i++) {
tmpp=MAlloc(sizeof(Peasant));
tmpp->x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
tmpp->y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
tmpp->é=ã*2*Rand;
tmpp->door_opened_t0=0;
tmpp->stopped=FALSE;
QueIns(tmpp,peasant_head.last);
}
animate_phase=0;
animate_mS=0;
king_phase=0;
king_mS=0;
king_timeout=0;
king_x=w/2;
king_y=h/2;
king_é=-ã/2;
door_open_t0=0;
t0=tS;
tf=0;
}
U0 CleanUp()
{
DCDel(snow_tile);
QueDel(&peasant_head,TRUE);
QueDel(&step_head,TRUE);
QueDel(&king_step_head,TRUE);
}
U0 Follow(CTask *,Peasant *tmpp)
{
Step *tmps=king_step_head.next;
F64 d,best_d=F64_MAX;
while (tmps!=&king_step_head) {
if ((d=Sqr(tmps->x-tmpp->x)+Sqr(tmps->y-tmpp->y)) &&
d<15*15) {
d+=1000*Sqr(tS-tmps->t0);
if (d<best_d) {
best_d=d;
tmpp->é=Arg(tmps->x-tmpp->x,tmps->y-tmpp->y);
}
}
tmps=tmps->next;
}
}
U0 AnimateTask(I64)
{
Step *tmps,*tmps1;
Peasant *tmpp;
I64 i,w,h;
while (TRUE) {
w=Fs->parent_task->pix_width;
h=Fs->parent_task->pix_height;
tmps=step_head.next;
while (tmps!=&step_head) {
tmps1=tmps->next;
if (tS-tmps->t0>5.0) {
QueRem(tmps);
Free(tmps);
}
tmps=tmps1;
}
tmps=king_step_head.next;
while (tmps!=&king_step_head) {
tmps1=tmps->next;
if (tS-tmps->t0>3.0) {
QueRem(tmps);
Free(tmps);
}
tmps=tmps1;
}
not_stopped_cnt=0;
tmpp=peasant_head.next;
while (tmpp!=&peasant_head) {
if (tmpp->stopped) {
if (tmpp->door_opened_t0 && tS>tmpp->door_opened_t0+1.0) {
tmpp->door_opened_t0=0;
tmpp->y=tmpp->x=-9999;
}
} else {
if (Sqr(tmpp->x-w/2)+Sqr(tmpp->y-h/2)<20*20) {
tmpp->stopped=TRUE;
tmpp->door_opened_t0=door_open_t0=tS;
}
for (i=0;i<TREES_NUM;i++) //Hang-out by fire
if (trees[i].fire_frame_idx &&
Sqr(tmpp->x-trees[i].x)+Sqr(tmpp->y-trees[i].y)<20*20) {
tmpp->stopped=TRUE;
break;
}
if (!tmpp->stopped) {
Follow(Fs->parent_task,tmpp);
tmpp->x+=Cos(tmpp->é)/100;
tmpp->y+=Sin(tmpp->é)/100;
if (!(BORDER/2<=tmpp->x<w-BORDER/2) ||
!(BORDER/2<=tmpp->y<h-BORDER/2)) {
tmpp->é+=ã;
tmpp->x+=3*Cos(tmpp->é)/100;
tmpp->y+=3*Sin(tmpp->é)/100;
}
if (!animate_mS && animate_phase&1)
StepNew(Fs->parent_task,tmpp->x,tmpp->y,tmpp->é,
animate_phase&2,FALSE);
not_stopped_cnt++;
}
}
tmpp=tmpp->next;
}
if (!not_stopped_cnt && !tf) {
tf=tS;
music.mute=TRUE;
Snd(86);Sleep(200);Snd;Sleep(100);
if (tf-t0<best_score) {
best_score=tf-t0;
Snd(86);Sleep(200);Snd;Sleep(100);
}
music.mute=FALSE;
}
snow_x+=RandU16%3-1;
snow_y+=1-SignI64(RandU16&3);
if (new_snow_mS++>8) {
new_snow_mS=0;
snow_tile->color=WHITE;
GrPlot(snow_tile,RandU16&(SNOW_TILE_SIZE-1),RandU16&(SNOW_TILE_SIZE-1));
}
Sleep(1);
if (animate_mS++>=250) {
animate_mS=0;
animate_phase=(animate_phase+1)&3;
}
if (tS<king_timeout) {
if (king_mS++>=250) {
king_mS=0;
king_phase|=1;
}
}
}
}
U0 BurnTrees()
{
I64 i;
for (i=0;i<TREES_NUM;i++)
if (Sqr(king_x-trees[i].x)+Sqr(king_y-trees[i].y)<10*10)
trees[i].fire_frame_idx=1;
}
U0 SongTask(I64)
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
while (TRUE) {
Play("5eCCCDCC4qGeAGAB5qCC");
Play("5eCCCDCC4qGeAGAB5qCC");
Play("5eGFEDEDqC4eAGAB5qCC");
}
}
U0 Wenceslas()
{
I64 sc;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Play {"
" Restart(,'\n');"
" BurnTree(,CH_SPACE);"
" Up(,,SC_CURSOR_UP);"
" Down(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
"}"
);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
DocCursor;
DocClear;
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
PopUpOk("
Good King Wenceslas looked out
On the feast of Stephen
When the snow lay round about
Deep and crisp and even
Brightly shone the moon that night
Though the frost was cruel
When a poor man came in sight
Gath'ring winter fuel
\"Hither, page, and stand by me
If thou know'st it, telling
Yonder peasant, who is he?
Where and what his dwelling?\"
\"Sire, he lives a good league hence
Underneath the mountain
Right against the forest fence
By Saint Agnes' fountain.\"
\"Bring me flesh and bring me wine
Bring me pine logs hither
Thou and I will see him dine
When we bear him thither.\"
Page and monarch forth they went
Forth they went together
Through the rude wind's wild lament
And the bitter weather
");
PopUpOk("
\"Sire, the night is darker now
And the wind blows stronger
Fails my heart, I know not how,
I can go no longer.\"
\"Mark my footsteps, my good page
Tread thou in them boldly
Thou shalt find the winter's rage
Freeze thy blood less coldly.\"
In his master's steps he trod
Where the snow lay dinted
Heat was in the very sod
Which the Saint had printed
Therefore, Christian men, be sure
Wealth or rank possessing
Ye who now will bless the poor
Shall yourselves find blessing
");
PopUpOk("
$$PURPLE$$$$TX+CX,\"Winceslas Game\"$$$$FG$$
Start fires by pressing $$GREEN$$<SPACE>$$FG$$
on trees. (Yule logs)
Lead peasants to fires.
");
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (GetKey(&sc)) {
case '\n':
CleanUp;
Init;
break;
case CH_ESC:
case CH_SHIFT_ESC:
goto ws_done;
case CH_SPACE:
BurnTrees;
break;
case 0:
switch (sc.u8[0]) {
start:
case SC_CURSOR_RIGHT:
if (king_x+KING_STEP<Fs->pix_width-BORDER)
king_x+=KING_STEP;
king_é=0;
break;
case SC_CURSOR_LEFT:
if (king_x-KING_STEP>=BORDER)
king_x-=KING_STEP;
king_é=ã;
break;
case SC_CURSOR_DOWN:
if (king_y+KING_STEP<Fs->pix_height-BORDER)
king_y+=KING_STEP;
king_é=-ã/2;
break;
case SC_CURSOR_UP:
if (king_y-KING_STEP>=BORDER)
king_y-=KING_STEP;
king_é=ã/2;
break;
end:
king_mS=0;
king_phase=(king_phase+2)&2;
StepNew(Fs,king_x,king_y,king_é,king_phase&2,TRUE);
king_timeout=tS+0.5;
break;
}
}
}
ws_done:
} catch
PutExcept;
SettingsPop;
MenuPop;
CleanUp;
RegWrite("TempleOS/Wenceslas","F64 best_score=%5.4f;\n",best_score);
}
Wenceslas;
y
þÿÿÿÚÿÿÿ
Êÿÿÿ
þÿÿÿÚÿÿÿ äÿÿÿ
Öÿÿÿ
Ðÿÿÿ
úÿÿÿÖÿÿÿôÿÿÿìÿÿÿ
üÿÿÿØÿÿÿúÿÿÿðÿÿÿ
üÿÿÿðÿÿÿÖÿÿÿ
üÿÿÿÔÿÿÿòÿÿÿæÿÿÿ
ÒÿÿÿöÿÿÿÂÿÿÿ
þÿÿÿÔÿÿÿòÿÿÿ¼ÿÿÿ
þÿÿÿÎÿÿÿ ¼ÿÿÿ
þÿÿÿÔÿÿÿÊÿÿÿ
þÿÿÿØÿÿÿäÿÿÿ
ÚÿÿÿÀÿÿÿ
þÿÿÿÎÿÿÿ´ÿÿÿ
Êÿÿÿªÿÿÿ
ÿÿÿøÿÿÿÈÿÿÿ
²ÿÿÿ¬ÿÿÿ
Æÿÿÿ
ÿÿÿ
Ìÿÿÿ Ìÿÿÿ
üÿÿÿÔÿÿÿèÿÿÿÚÿÿÿ
Öÿÿÿ *
ðÿÿÿüÿÿÿ
ðÿÿÿ
ðÿÿÿèÿÿÿ
þÿÿÿòÿÿÿüÿÿÿæÿÿÿ
þÿÿÿæÿÿÿàÿÿÿ
þÿÿÿèÿÿÿüÿÿÿòÿÿÿ
æÿÿÿðÿÿÿ
þÿÿÿâÿÿÿàÿÿÿ
àÿÿÿÞÿÿÿ
Þÿÿÿâÿÿÿ
ÞÿÿÿÞÿÿÿ
ýÿÿÿäÿÿÿâÿÿÿ
þÿÿÿäÿÿÿüÿÿÿèÿÿÿ
üÿÿÿèÿÿÿüÿÿÿòÿÿÿ
äÿÿÿêÿÿÿ
æÿÿÿþÿÿÿîÿÿÿ
ìÿÿÿòÿÿÿã
öÿÿÿðÿÿÿ
øÿÿÿ
ôÿÿÿ
ðÿÿÿòÿÿÿ
îÿÿÿ
êÿÿÿ
öÿÿÿæÿÿÿ
úÿÿÿæÿÿÿöÿÿÿèÿÿÿ
øÿÿÿæÿÿÿ
æÿÿÿ
øÿÿÿîÿÿÿ
þÿÿÿòÿÿÿ 
þÿÿÿöÿÿÿ
ôÿÿÿîÿÿÿ
ðÿÿÿ
ðÿÿÿþÿÿÿ
üÿÿÿþÿÿÿäÿÿÿ
þÿÿÿäÿÿÿîÿÿÿ
äÿÿÿöÿÿÿöÿÿÿ
öÿÿÿðÿÿÿøÿÿÿ
üÿÿÿüÿÿÿðÿÿÿ
ðÿÿÿøÿÿÿ
úÿÿÿ
þÿÿÿúÿÿÿúÿÿÿ
ðÿÿÿüÿÿÿ
úÿÿÿ
üÿÿÿ
üÿÿÿøÿÿÿ
úÿÿÿøÿÿÿúÿÿÿðÿÿÿ
òÿÿÿìÿÿÿ ô
öÿÿÿðÿÿÿ
øÿÿÿ
ôÿÿÿ
ðÿÿÿòÿÿÿ
îÿÿÿ
êÿÿÿ
öÿÿÿæÿÿÿ
úÿÿÿæÿÿÿöÿÿÿèÿÿÿ
øÿÿÿæÿÿÿ
æÿÿÿ
øÿÿÿîÿÿÿ
þÿÿÿòÿÿÿ 
þÿÿÿöÿÿÿ
ôÿÿÿîÿÿÿ
äÿÿÿ
úÿÿÿâÿÿÿúÿÿÿ
èÿÿÿúÿÿÿöÿÿÿ
òÿÿÿîÿÿÿöÿÿÿúÿÿÿ
öÿÿÿøÿÿÿðÿÿÿ
öÿÿÿäÿÿÿôÿÿÿôÿÿÿ
üÿÿÿêÿÿÿþÿÿÿþÿÿÿ
üÿÿÿôÿÿÿ
ôÿÿÿöÿÿÿ
òÿÿÿâÿÿÿ
þÿÿÿ
úÿÿÿ
öÿÿÿ
òÿÿÿüÿÿÿ
øÿÿÿðÿÿÿøÿÿÿ
ôÿÿÿ
üÿÿÿ
ÒbÎÿÿÿhÿÿÿŸžÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿLine truncated

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmokÊp¨ÝÿÿÿýÿÿÿýÿÿÿÝÿÿÿýÿÿÿáÿÿÿýÿÿÿýÿÿÿáÿÿÿýÿÿÿÝÿÿÿýÿÿÿÝÿÿÿáÿÿÿýÿÿÿáÿÿÿáÿÿÿýÿÿÿûÿÿÿáÿÿÿýÿÿÿðÿÿÿýÿÿÿûÿÿÿðÿÿÿýÿÿÿáÿÿÿûÿÿÿáÿÿÿðÿÿÿûÿÿÿðÿÿÿáÿÿÿâÿÿÿçÿÿÿüÿÿÿèÿÿÿüÿÿÿâÿÿÿãÿÿÿèÿÿÿýÿÿÿéÿÿÿýÿÿÿçÿÿÿüÿÿÿèÿÿÿüÿÿÿíÿÿÿùÿÿÿíÿÿÿùÿÿÿèÿÿÿýÿÿÿéÿÿÿýÿÿÿíÿÿÿúÿÿÿîÿÿÿúÿÿÿíÿÿÿùÿÿÿíÿÿÿùÿÿÿ ðÿÿÿøÿÿÿðÿÿÿøÿÿÿíÿÿÿúÿÿÿîÿÿÿúÿÿÿ ðÿÿÿùÿÿÿñÿÿÿùÿÿÿûÿÿÿãÿÿÿþÿÿÿúÿÿÿãÿÿÿþÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿûÿÿÿáÿÿÿúÿÿÿáÿÿÿúÿÿÿçÿÿÿøÿÿÿçÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿùÿÿÿíÿÿÿøÿÿÿíÿÿÿúÿÿÿçÿÿÿøÿÿÿçÿÿÿùÿÿÿêÿÿÿ øÿÿÿêÿÿÿ ùÿÿÿìÿÿÿøÿÿÿìÿÿÿùÿÿÿîÿÿÿ ÷ÿÿÿîÿÿÿ ùÿÿÿëÿÿÿøÿÿÿëÿÿÿùÿÿÿìÿÿÿ ÷ÿÿÿìÿÿÿ ðÿÿÿþÿÿÿñÿÿÿÿÿÿÿõÿÿÿöÿÿÿîÿÿÿïÿÿÿóÿÿÿôÿÿÿõÿÿÿöÿÿÿüÿÿÿýÿÿÿóÿÿÿôÿÿÿúÿÿÿûÿÿÿþÿÿÿþÿÿÿüÿÿÿ üÿÿÿ␍üÿÿÿüÿÿÿúÿÿÿ úÿÿÿ þÿÿÿïÿÿÿþÿÿÿüÿÿÿïÿÿÿÿÿÿÿþÿÿÿôÿÿÿúÿÿÿûÿÿÿôÿÿÿúÿÿÿþÿÿÿðÿÿÿüÿÿÿðÿÿÿþÿÿÿõÿÿÿûÿÿÿûÿÿÿõÿÿÿüÿÿÿþÿÿÿôÿÿÿúÿÿÿûÿÿÿôÿÿÿúÿÿÿýÿÿÿùÿÿÿõÿÿÿûÿÿÿùÿÿÿöÿÿÿþÿÿÿõÿÿÿûÿÿÿûÿÿÿõÿÿÿüÿÿÿýÿÿÿúÿÿÿ÷ÿÿÿûÿÿÿúÿÿÿøÿÿÿýÿÿÿûÿÿÿóÿÿÿûÿÿÿûÿÿÿóÿÿÿýÿÿÿøÿÿÿúÿÿÿøÿÿÿýÿÿÿøÿÿÿõÿÿÿûÿÿÿøÿÿÿõÿÿÿýÿÿÿýÿÿÿúÿÿÿúÿÿÿýÿÿÿúÿÿÿ 

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmokÊp¨ÝÿÿÿýÿÿÿýÿÿÿÝÿÿÿýÿÿÿáÿÿÿýÿÿÿýÿÿÿáÿÿÿýÿÿÿÝÿÿÿýÿÿÿÝÿÿÿáÿÿÿýÿÿÿáÿÿÿáÿÿÿýÿÿÿûÿÿÿáÿÿÿýÿÿÿðÿÿÿýÿÿÿûÿÿÿðÿÿÿýÿÿÿáÿÿÿûÿÿÿáÿÿÿðÿÿÿûÿÿÿðÿÿÿáÿÿÿþÿÿÿâÿÿÿþÿÿÿèÿÿÿþÿÿÿéÿÿÿþÿÿÿáÿÿÿâÿÿÿèÿÿÿéÿÿÿèÿÿÿþÿÿÿéÿÿÿþÿÿÿïÿÿÿþÿÿÿðÿÿÿþÿÿÿèÿÿÿéÿÿÿïÿÿÿðÿÿÿïÿÿÿÿÿÿÿðÿÿÿÿÿÿÿ òÿÿÿÿÿÿÿóÿÿÿÿÿÿÿïÿÿÿðÿÿÿ òÿÿÿóÿÿÿûÿÿÿâÿÿÿþÿÿÿúÿÿÿâÿÿÿþÿÿÿúÿÿÿéÿÿÿþÿÿÿøÿÿÿéÿÿÿþÿÿÿûÿÿÿâÿÿÿúÿÿÿâÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿúÿÿÿéÿÿÿþÿÿÿøÿÿÿéÿÿÿþÿÿÿùÿÿÿïÿÿÿþÿÿÿøÿÿÿïÿÿÿþÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿùÿÿÿïÿÿÿøÿÿÿïÿÿÿùÿÿÿïÿÿÿÿÿÿÿøÿÿÿïÿÿÿÿÿÿÿùÿÿÿòÿÿÿÿÿÿÿ÷ÿÿÿòÿÿÿÿÿÿÿùÿÿÿïÿÿÿøÿÿÿïÿÿÿùÿÿÿòÿÿÿ÷ÿÿÿòÿÿÿïÿÿÿþÿÿÿðÿÿÿþÿÿÿöÿÿÿþÿÿÿ÷ÿÿÿþÿÿÿïÿÿÿðÿÿÿöÿÿÿ÷ÿÿÿöÿÿÿþÿÿÿ÷ÿÿÿþÿÿÿýÿÿÿþÿÿÿýÿÿÿþÿÿÿöÿÿÿ÷ÿÿÿýÿÿÿýÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿýÿÿÿþÿÿÿýÿÿÿÿÿÿÿýÿÿÿýÿÿÿþÿÿÿðÿÿÿþÿÿÿüÿÿÿðÿÿÿþÿÿÿþÿÿÿöÿÿÿþÿÿÿûÿÿÿöÿÿÿþÿÿÿþÿÿÿðÿÿÿüÿÿÿðÿÿÿþÿÿÿöÿÿÿûÿÿÿöÿÿÿþÿÿÿöÿÿÿþÿÿÿûÿÿÿöÿÿÿþÿÿÿýÿÿÿýÿÿÿþÿÿÿûÿÿÿýÿÿÿþÿÿÿþÿÿÿöÿÿÿûÿÿÿöÿÿÿýÿÿÿýÿÿÿûÿÿÿýÿÿÿýÿÿÿÿÿÿÿþÿÿÿûÿÿÿÿÿÿÿþÿÿÿýÿÿÿÿÿÿÿúÿÿÿÿÿÿÿýÿÿÿýÿÿÿþÿÿÿûÿÿÿýÿÿÿþÿÿÿýÿÿÿýÿÿÿúÿÿÿýÿÿÿ 

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmokÊp¨ÝÿÿÿýÿÿÿýÿÿÿÝÿÿÿýÿÿÿáÿÿÿýÿÿÿýÿÿÿáÿÿÿýÿÿÿÝÿÿÿýÿÿÿÝÿÿÿáÿÿÿýÿÿÿáÿÿÿáÿÿÿýÿÿÿûÿÿÿáÿÿÿýÿÿÿðÿÿÿýÿÿÿûÿÿÿðÿÿÿýÿÿÿáÿÿÿûÿÿÿáÿÿÿðÿÿÿûÿÿÿðÿÿÿâÿÿÿþÿÿÿãÿÿÿÿÿÿÿèÿÿÿéÿÿÿàÿÿÿáÿÿÿçÿÿÿèÿÿÿéÿÿÿêÿÿÿìÿÿÿíÿÿÿæÿÿÿçÿÿÿêÿÿÿëÿÿÿ ìÿÿÿíÿÿÿ íÿÿÿ îÿÿÿ êÿÿÿëÿÿÿ ìÿÿÿ íÿÿÿ ûÿÿÿáÿÿÿÿÿÿÿúÿÿÿáÿÿÿúÿÿÿèÿÿÿûÿÿÿøÿÿÿèÿÿÿüÿÿÿûÿÿÿâÿÿÿúÿÿÿâÿÿÿúÿÿÿèÿÿÿýÿÿÿøÿÿÿèÿÿÿþÿÿÿúÿÿÿèÿÿÿûÿÿÿøÿÿÿèÿÿÿüÿÿÿùÿÿÿíÿÿÿøÿÿÿøÿÿÿíÿÿÿùÿÿÿúÿÿÿèÿÿÿýÿÿÿøÿÿÿèÿÿÿþÿÿÿùÿÿÿîÿÿÿúÿÿÿøÿÿÿîÿÿÿûÿÿÿùÿÿÿíÿÿÿùÿÿÿøÿÿÿíÿÿÿúÿÿÿùÿÿÿðÿÿÿøÿÿÿ÷ÿÿÿðÿÿÿøÿÿÿùÿÿÿîÿÿÿúÿÿÿøÿÿÿîÿÿÿúÿÿÿùÿÿÿñÿÿÿøÿÿÿ÷ÿÿÿñÿÿÿùÿÿÿîÿÿÿÿÿÿÿïÿÿÿÿÿÿÿóÿÿÿúÿÿÿôÿÿÿúÿÿÿðÿÿÿñÿÿÿõÿÿÿüÿÿÿöÿÿÿüÿÿÿóÿÿÿúÿÿÿôÿÿÿúÿÿÿøÿÿÿõÿÿÿùÿÿÿõÿÿÿõÿÿÿüÿÿÿöÿÿÿüÿÿÿúÿÿÿ÷ÿÿÿûÿÿÿ÷ÿÿÿúÿÿÿóÿÿÿûÿÿÿôÿÿÿÿÿÿÿøÿÿÿøÿÿÿøÿÿÿõÿÿÿùÿÿÿõÿÿÿýÿÿÿùÿÿÿýÿÿÿúÿÿÿþÿÿÿñÿÿÿÿÿÿÿüÿÿÿñÿÿÿÿÿÿÿþÿÿÿöÿÿÿûÿÿÿöÿÿÿþÿÿÿîÿÿÿüÿÿÿîÿÿÿþÿÿÿóÿÿÿûÿÿÿóÿÿÿþÿÿÿõÿÿÿûÿÿÿõÿÿÿýÿÿÿüÿÿÿûÿÿÿüÿÿÿþÿÿÿôÿÿÿûÿÿÿôÿÿÿýÿÿÿúÿÿÿûÿÿÿúÿÿÿýÿÿÿþÿÿÿûÿÿÿÿÿÿÿýÿÿÿüÿÿÿ úÿÿÿýÿÿÿ ýÿÿÿûÿÿÿûÿÿÿüÿÿÿýÿÿÿùÿÿÿ úÿÿÿúÿÿÿ  

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmokÊp¨ÝÿÿÿýÿÿÿýÿÿÿÝÿÿÿýÿÿÿáÿÿÿýÿÿÿýÿÿÿáÿÿÿýÿÿÿÝÿÿÿýÿÿÿÝÿÿÿáÿÿÿýÿÿÿáÿÿÿáÿÿÿýÿÿÿûÿÿÿáÿÿÿýÿÿÿðÿÿÿýÿÿÿûÿÿÿðÿÿÿýÿÿÿáÿÿÿûÿÿÿáÿÿÿðÿÿÿûÿÿÿðÿÿÿáÿÿÿþÿÿÿâÿÿÿþÿÿÿèÿÿÿþÿÿÿéÿÿÿþÿÿÿáÿÿÿâÿÿÿèÿÿÿéÿÿÿèÿÿÿþÿÿÿéÿÿÿþÿÿÿïÿÿÿþÿÿÿðÿÿÿþÿÿÿèÿÿÿéÿÿÿïÿÿÿðÿÿÿïÿÿÿÿÿÿÿðÿÿÿÿÿÿÿ òÿÿÿÿÿÿÿóÿÿÿÿÿÿÿïÿÿÿðÿÿÿ òÿÿÿóÿÿÿûÿÿÿâÿÿÿþÿÿÿúÿÿÿâÿÿÿþÿÿÿúÿÿÿéÿÿÿþÿÿÿøÿÿÿéÿÿÿþÿÿÿûÿÿÿâÿÿÿúÿÿÿâÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿúÿÿÿéÿÿÿþÿÿÿøÿÿÿéÿÿÿþÿÿÿùÿÿÿïÿÿÿþÿÿÿøÿÿÿïÿÿÿþÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿùÿÿÿïÿÿÿøÿÿÿïÿÿÿùÿÿÿïÿÿÿÿÿÿÿøÿÿÿïÿÿÿÿÿÿÿùÿÿÿòÿÿÿÿÿÿÿ÷ÿÿÿòÿÿÿÿÿÿÿùÿÿÿïÿÿÿøÿÿÿïÿÿÿùÿÿÿòÿÿÿ÷ÿÿÿòÿÿÿïÿÿÿþÿÿÿðÿÿÿþÿÿÿöÿÿÿþÿÿÿ÷ÿÿÿþÿÿÿïÿÿÿðÿÿÿöÿÿÿ÷ÿÿÿöÿÿÿþÿÿÿ÷ÿÿÿþÿÿÿýÿÿÿþÿÿÿýÿÿÿþÿÿÿöÿÿÿ÷ÿÿÿýÿÿÿýÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿýÿÿÿþÿÿÿýÿÿÿÿÿÿÿýÿÿÿýÿÿÿþÿÿÿðÿÿÿþÿÿÿüÿÿÿðÿÿÿþÿÿÿþÿÿÿöÿÿÿþÿÿÿûÿÿÿöÿÿÿþÿÿÿþÿÿÿðÿÿÿüÿÿÿðÿÿÿþÿÿÿöÿÿÿûÿÿÿöÿÿÿþÿÿÿöÿÿÿþÿÿÿûÿÿÿöÿÿÿþÿÿÿýÿÿÿýÿÿÿþÿÿÿûÿÿÿýÿÿÿþÿÿÿþÿÿÿöÿÿÿûÿÿÿöÿÿÿýÿÿÿýÿÿÿûÿÿÿýÿÿÿýÿÿÿÿÿÿÿþÿÿÿûÿÿÿÿÿÿÿþÿÿÿýÿÿÿÿÿÿÿúÿÿÿÿÿÿÿýÿÿÿýÿÿÿþÿÿÿûÿÿÿýÿÿÿþÿÿÿýÿÿÿýÿÿÿúÿÿÿýÿÿÿ 

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmokÊp¨ÝÿÿÿýÿÿÿýÿÿÿÝÿÿÿýÿÿÿáÿÿÿýÿÿÿýÿÿÿáÿÿÿýÿÿÿÝÿÿÿýÿÿÿÝÿÿÿáÿÿÿýÿÿÿáÿÿÿáÿÿÿýÿÿÿûÿÿÿáÿÿÿýÿÿÿðÿÿÿýÿÿÿûÿÿÿðÿÿÿýÿÿÿáÿÿÿûÿÿÿáÿÿÿðÿÿÿûÿÿÿðÿÿÿáÿÿÿâÿÿÿçÿÿÿüÿÿÿèÿÿÿüÿÿÿâÿÿÿãÿÿÿèÿÿÿýÿÿÿéÿÿÿýÿÿÿçÿÿÿüÿÿÿèÿÿÿüÿÿÿíÿÿÿùÿÿÿíÿÿÿùÿÿÿèÿÿÿýÿÿÿéÿÿÿýÿÿÿíÿÿÿúÿÿÿîÿÿÿúÿÿÿíÿÿÿùÿÿÿíÿÿÿùÿÿÿ ðÿÿÿøÿÿÿðÿÿÿøÿÿÿíÿÿÿúÿÿÿîÿÿÿúÿÿÿ ðÿÿÿùÿÿÿñÿÿÿùÿÿÿûÿÿÿãÿÿÿþÿÿÿúÿÿÿãÿÿÿþÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿûÿÿÿáÿÿÿúÿÿÿáÿÿÿúÿÿÿçÿÿÿøÿÿÿçÿÿÿúÿÿÿéÿÿÿøÿÿÿéÿÿÿùÿÿÿíÿÿÿøÿÿÿíÿÿÿúÿÿÿçÿÿÿøÿÿÿçÿÿÿùÿÿÿêÿÿÿ øÿÿÿêÿÿÿ ùÿÿÿìÿÿÿøÿÿÿìÿÿÿùÿÿÿîÿÿÿ ÷ÿÿÿîÿÿÿ ùÿÿÿëÿÿÿøÿÿÿëÿÿÿùÿÿÿìÿÿÿ ÷ÿÿÿìÿÿÿ ðÿÿÿþÿÿÿñÿÿÿÿÿÿÿõÿÿÿöÿÿÿîÿÿÿïÿÿÿóÿÿÿôÿÿÿõÿÿÿöÿÿÿüÿÿÿýÿÿÿóÿÿÿôÿÿÿúÿÿÿûÿÿÿþÿÿÿþÿÿÿüÿÿÿ üÿÿÿ␍üÿÿÿüÿÿÿúÿÿÿ úÿÿÿ þÿÿÿïÿÿÿþÿÿÿüÿÿÿïÿÿÿÿÿÿÿþÿÿÿôÿÿÿúÿÿÿûÿÿÿôÿÿÿúÿÿÿþÿÿÿðÿÿÿüÿÿÿðÿÿÿþÿÿÿõÿÿÿûÿÿÿûÿÿÿõÿÿÿüÿÿÿþÿÿÿôÿÿÿúÿÿÿûÿÿÿôÿÿÿúÿÿÿýÿÿÿùÿÿÿõÿÿÿûÿÿÿùÿÿÿöÿÿÿþÿÿÿõÿÿÿûÿÿÿûÿÿÿõÿÿÿüÿÿÿýÿÿÿúÿÿÿ÷ÿÿÿûÿÿÿúÿÿÿøÿÿÿýÿÿÿûÿÿÿóÿÿÿûÿÿÿûÿÿÿóÿÿÿýÿÿÿøÿÿÿúÿÿÿøÿÿÿýÿÿÿøÿÿÿõÿÿÿûÿÿÿøÿÿÿõÿÿÿýÿÿÿýÿÿÿúÿÿÿúÿÿÿýÿÿÿúÿÿÿ 

␍ ␍   ␍ 
 
  
 ␍␍    ! ""#!%$&&'%! $$%!#"&&'#" $$&"#!%%'#)(**+)-,../-)(,,-)+*../+*(,,.*+)--/+10223154667510445132667320446231557398::;9=<>>?=98<<=9;:>>?;:8<<>:;9==?;A@BBCAEDFFGEA@DDEACBFFGCB@DDFBCAEEGCIHJJKIMLNNOMIHLLMIKJNNOKJHLLNJKIMMOKQPRRSQUTVVWUQPTTUQSRVVWSRPTTVRSQUUWSYXZZ[Y]\^^_]YX\\]Y[Z^^_[ZX\\^Z[Y]]_[a`bbcaedffgea`ddeacbffgcb`ddfbcaeegcihjjkimlnnomihllmikjnnokjhllnjkimmok
+173
View File
@@ -0,0 +1,173 @@
#define BALLS_NUM 7
#define SPRINGS_NUM 3
#define STRETCH 500.0
#define GRAVITY 50.0 //not really gravity
#define BALL_RADIUS 5
#define BASE_SIZE 10
CMass balls[BALLS_NUM];
CSpring springs[SPRINGS_NUM];
F64 collision_t;
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,
cx=task->pix_width>>1,
cy=task->pix_height>>1;
Bool snd_on=FALSE;
dc->color=BLACK;
GrPrint(dc,0,0,"Protect your base.");
GrRect(dc,cx-BASE_SIZE,cy-BASE_SIZE,BASE_SIZE*2,BASE_SIZE*2);
dc->color=CYAN;
GrRect(dc,cx-BASE_SIZE+2,cy-BASE_SIZE+2,BASE_SIZE*2-4,BASE_SIZE*2-4);
dc->color=YELLOW;
GrLine(dc,balls[0].x,balls[0].y,
ms.pos.x-task->pix_left-task->scroll_x,
ms.pos.y-task->pix_top-task->scroll_y);
for (i=0;i<SPRINGS_NUM;i++)
GrLine(dc,springs[i].end1->x,springs[i].end1->y,
springs[i].end2->x,springs[i].end2->y);
dc->color=LTCYAN;
GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
GrFloodFill(dc,balls[0].x,balls[0].y,TRUE);
dc->color=BLACK;
GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
for (i=1;i<BALLS_NUM;i++) {
dc->color=LTPURPLE;
GrCircle(dc,balls[i].x,balls[i].y,BALL_RADIUS);
GrFloodFill(dc,balls[i].x,balls[i].y,TRUE);
if (cx-BASE_SIZE-BALL_RADIUS<=balls[i].x<=cx+BASE_SIZE+BALL_RADIUS &&
cy-BASE_SIZE-BALL_RADIUS<=balls[i].y<=cy+BASE_SIZE+BALL_RADIUS)
snd_on=TRUE;
dc->color=BLACK;
GrCircle(dc,balls[i].x,balls[i].y,BALL_RADIUS);
}
if (snd_on)
Snd(74);
else
Snd;
}
U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
{
I64 i,j;
F64 d,dd;
CD3 p,p2;
CTask *task=ode->win_task;
D3SubEqu(D3Equ(&p2,
ms.pos.x-task->pix_left-task->scroll_x,
ms.pos.y-task->pix_top-task->scroll_y,0),
&balls[0].state->x);
D3AddEqu(&balls[0].DstateDt->DxDt,D3MulEqu(&p2,STRETCH));
D3Equ(&p2,task->pix_width>>1,task->pix_height>>1,0);
for (i=1;i<BALLS_NUM;i++) {
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);
D3AddEqu(&balls[i].DstateDt->DxDt,&p);
}
}
for (i=0;i<BALLS_NUM;i++)
for (j=i+1;j<BALLS_NUM;j++) {
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) {
Noise(50,102,105);
collision_t=t;
}
d=Sqrt(dd)+0.0001;
dd=10.0*Sqr(Sqr((2*BALL_RADIUS)*(2*BALL_RADIUS)-dd));
D3MulEqu(&p,dd/d);
D3AddEqu(&balls[j].DstateDt->DxDt,&p);
D3SubEqu(&balls[i].DstateDt->DxDt,&p);
}
}
d=balls[0].state->x;
if (d-BALL_RADIUS<0)
balls[0].DstateDt->DxDt+=Sqr(Sqr(Sqr(d-BALL_RADIUS)));
if (d+BALL_RADIUS>task->pix_width)
balls[0].DstateDt->DxDt-=Sqr(Sqr(Sqr((d+BALL_RADIUS)-task->pix_width)));
d=balls[0].state->y;
if (d-BALL_RADIUS<0)
balls[0].DstateDt->DyDt+=Sqr(Sqr(Sqr(d-BALL_RADIUS)));
if (d+BALL_RADIUS>task->pix_height)
balls[0].DstateDt->DyDt-=Sqr(Sqr(Sqr((d+BALL_RADIUS)-task->pix_height)));
}
U0 Whap()
{
I64 i;
CMathODE *ode=ODENew(0,1e-2,ODEF_HAS_MASSES);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
AutoComplete;
WinBorder;
WinMax;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
);
ode->derivative=&MyDerivative;
ode->drag_v2=0.002;
ode->drag_v3=0.00001;
ode->acceleration_limit=5e3;
MemSet(balls,0,BALLS_NUM*sizeof(CMass));
D3Equ(&balls[0].x,100,100,0);
for (i=1;i<BALLS_NUM;i++)
D3Equ(&balls[i].x,
RandI16%500+Fs->pix_width>>1,RandI16%500+Fs->pix_height>>1,0);
balls[0].x=ms.pos.x-Fs->pix_left-Fs->scroll_x;
balls[0].y=ms.pos.y-Fs->pix_top-Fs->scroll_y;
for (i=0;i<BALLS_NUM;i++) {
balls[i].mass=1.0;
balls[i].drag_profile_factor=1.0;
QueIns(&balls[i],ode->last_mass);
}
balls[2].x=balls[1].x+15;
balls[2].y=balls[1].y;
balls[3].x=balls[1].x;
balls[3].y=balls[1].y+15;
MemSet(springs,0,SPRINGS_NUM*sizeof(CSpring));
springs[0].end1=&balls[1];
springs[0].end2=&balls[2];
springs[0].rest_len=15;
springs[0].const=10000;
QueIns(&springs[0],ode->last_spring);
springs[1].end1=&balls[1];
springs[1].end2=&balls[3];
springs[1].rest_len=15;
springs[1].const=10000;
QueIns(&springs[1],ode->last_spring);
springs[2].end1=&balls[2];
springs[2].end2=&balls[3];
springs[2].rest_len=sqrt2*15;
springs[2].const=10000;
QueIns(&springs[2],ode->last_spring);
collision_t=0;
QueIns(ode,Fs->last_ode);
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
GetChar;
SettingsPop;
QueRem(ode);
ODEDel(ode);
MenuPop;
}
Whap;
Binary file not shown.
Binary file not shown.
+76
View File
@@ -0,0 +1,76 @@
//Demonstrates dynamic initialization of vars.
//Static vars are, essentually, global vars.
class Test
{
I32 time;
U8 name[8];
};
Test g1[]={
{10,"Name1"},
{(tS%10.0)*100,"Name2"}, //Dynamic initialization
{30,"Name3"}
};
D(g1,sizeof(g1));
"Time 1:%d\n",g1[1].time;
U0 Main1()
{
static Test s1[]={
{10,"Static1"},
{(tS%10.0)*100,"Static2"}, //Dynamic initialization
{30,"Static3"}
};
D(s1,sizeof(s1));
"Time 2:%d\n",s1[1].time;
}
Main1;
/*Now, we'll use the data heap glbl option
to force global vars onto the data heap.
You can turn the data heap flag
on and off within your programs, leaving
ones which need initialization on the code heap.
You can't dynamically initialize data heap
glbls--they are consts. This might be a silly
point, but might res in odd differences, perhaps
from the order things are evaluated.
Data heap glbls are good for AOT modules
because they don't take-up room in the .BIN.Z file.
*/
#ifjit
#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
Test g2[]={
{10,"name1"},
{(tS%10.0)*100,"name2"}, //No dynamic initialization--cvted to const
{30,"name3"}
};
D(g2,sizeof(g2));
"Time 3:%d\n",g2[1].time;
U0 Main2()
{
static Test s2[]={
{10,"static1"},
{(tS%10.0)*100,"static2"}, //No dynamic initialization--cvted to const
{30,"static3"}
};
D(s2,sizeof(s2));
"Time 4:%d\n",s2[1].time;
}
Main2;
#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
#endif
'\n';
+117
View File
@@ -0,0 +1,117 @@
U0 Main()
{
F64 é=0,č=0,ę=0;
CD3I32 poly[4];
CDC *dc=DCAlias;
DCDepthBufAlloc(dc);
dc->flags|=DCF_TRANSFORMATION|DCF_SYMMETRY;
try {
while (!ScanChar) {
DCDepthBufRst(dc);
DCSymmetrySet(dc,Fs->pix_width/2,Fs->pix_height/2,
ms.pos.x-Fs->pix_left-Fs->scroll_x,
ms.pos.y-Fs->pix_top-Fs->scroll_y);
dc->color=LTBLUE;
GrLine(dc,Fs->pix_width/2,Fs->pix_height/2,
ms.pos.x-Fs->pix_left-Fs->scroll_x,
ms.pos.y-Fs->pix_top-Fs->scroll_y);
Mat4x4IdentEqu(dc->r);
Mat4x4RotX(dc->r,ę);
Mat4x4RotY(dc->r,č);
Mat4x4RotZ(dc->r,é);
DCMat4x4Set(dc,dc->r);
dc->x=Fs->pix_width/2;
dc->y=Fs->pix_height/2;
dc->z=500;
dc->color=GREEN;
poly[0].x=50;
poly[0].y=150;
poly[0].z=0;
poly[1].x=275;
poly[1].y=100;
poly[1].z=0;
poly[2].x=155;
poly[2].y=200;
poly[2].z=0;
poly[3].x=100;
poly[3].y=200;
poly[3].z=0;
GrFillPoly3(dc,4,poly);
dc->color=RED;
poly[0].x=50;
poly[0].y=150;
poly[0].z=50;
poly[1].x=275;
poly[1].y=100;
poly[1].z=50;
poly[2].x=155;
poly[2].y=200;
poly[2].z=50;
poly[3].x=100;
poly[3].y=200;
poly[3].z=50;
GrFillPoly3(dc,4,poly);
dc->color=BLUE;
poly[0].x=50;
poly[0].y=150;
poly[0].z=-50;
poly[1].x=275;
poly[1].y=100;
poly[1].z=-50;
poly[2].x=155;
poly[2].y=200;
poly[2].z=-50;
poly[3].x=100;
poly[3].y=200;
poly[3].z=-50;
GrFillPoly3(dc,4,poly);
dc->color=RED+GREEN<<16+ROPF_DITHER;
poly[0].x=50;
poly[0].y=150;
poly[0].z=50;
poly[1].x=275;
poly[1].y=100;
poly[1].z=50;
poly[2].x=275;
poly[2].y=100;
poly[2].z=0;
poly[3].x=50;
poly[3].y=150;
poly[3].z=0;
GrFillPoly3(dc,4,poly);
dc->color=BLUE+GREEN<<16+ROPF_DITHER;
poly[0].x=100;
poly[0].y=200;
poly[0].z=-50;
poly[1].x=155;
poly[1].y=200;
poly[1].z=-50;
poly[2].x=155;
poly[2].y=200;
poly[2].z=0;
poly[3].x=100;
poly[3].y=200;
poly[3].z=0;
GrFillPoly3(dc,4,poly);
Refresh;
DCFill;
é+=2.1*ă/180.0;
č+=1.1*ă/180.0;
ę+=0.5*ă/180.0;
}
} catch
PutExcept;
DCFill;
DCDel(dc);
}
Main;
+35
View File
@@ -0,0 +1,35 @@
#define PTS_NUM 16
U0 BSplineDemo()
{
CDC *dc=DCAlias;
I64 arg1,arg2,i=0,msg_code;
CD3I32 c[PTS_NUM];
SettingsPush;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
DocClear;
"Sel ctrl points with left mouse. Right when finished.\n";
DCFill;
do {
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP+1<<MSG_MS_R_UP);
if (msg_code==MSG_MS_L_UP) {
c[i].x=arg1; c[i].y=arg2; c[i].z=0;
dc->color=GREEN;
GrCircle(dc,arg1,arg2,10);
i++;
}
} while (i<PTS_NUM && msg_code!=MSG_MS_R_UP);
dc->color=RED;
Gr2BSpline(dc,c,i,TRUE);
dc->color=BLUE;
Gr3BSpline(dc,c,i,TRUE);
DCDel(dc);
SettingsPop;
PressAKey;
DCFill;
}
BSplineDemo;
+38
View File
@@ -0,0 +1,38 @@
// Classic Commodore 64 Sprite
U8 a[60]={0,127,0,1,255,192,3,255,224,3,231,224,
7,217,240,7,223,240,7,217,240,3,231,224,
3,255,224,3,255,224,2,255,160,1,127,64,
1,62,64,0,156,128,0,156,128,0,73,0,0,73,0,
0,62,0,0,62,0,0,28,0};
U0 Balloon()
{
I64 i,j,k;
CLI
OutU8(VGAP_IDX,VGAR_MAP_MASK);
OutU8(VGAP_DATA,0xF);
MemSetI64(text.vga_alias,0,640*480/64);
OutU8(VGAP_IDX,VGAR_MAP_MASK);
OutU8(VGAP_DATA,RED+GREEN+8);
for (k=100;k<150;k++) {
for (i=0;i<20;i++)
for (j=0;j<3;j++)
*(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
Busy(40000);
for (i=0;i<20;i++)
for (j=0;j<3;j++)
*(text.vga_alias(I64)+0x1000+(i+k)*640/8+j)(U8 *)=0;
}
STI
VGAFlush;
}
Balloon;
+41
View File
@@ -0,0 +1,41 @@
CDC *dc=DCAlias;
CDC *img1=DCNew(64,64);
CDC *img2=DCNew(512,512);
img1->color=COLOR_MONO;
img1->pen_width=3;
GrCircle(img1,30,30,20);
GrFloodFill3(img1,30,30,0,TRUE);
GrLine3(img1,60,0,0,0,60,0);
DCFill(img2);
img2->color=RED;
img2->brush=img1;
GrCircle(img2,256-30,256-30,128,67);
img2->color=BLUE;
img2->pen_width=6;
img2->brush=NULL;
GrLine3(img2,128,128,0,256+128,256+128,0);
GrLine3(img2,256+128,128,0,128,256+128,0);
img2->color=YELLOW;
GrRect(img2,256-20,256-20,40,40);
I64 i;
for (i=0;i<256;i+=4) {
Refresh;
DCFill;
GrBlot(dc,i-256,i-256,img2);
Sleep(10);
}
U8 *tmpg=DC2Sprite(img1);
Sprite(tmpg);
Free(tmpg);
"%h9c",'\n';
DCDel(img1);
DCDel(img2);
DCDel(dc);
PressAKey;
DCFill;
+47
View File
@@ -0,0 +1,47 @@
//Uses $LK,"fixed-point-arithmetic",A="FI:::/Demo/Lectures/FixedPoint.HC"$.
I64 x[16],y[16],dx[16],dy[16];
U0 Init()
{
I64 i;
F64 é;
MemSet(x,0,sizeof(x));
MemSet(y,0,sizeof(y));
for (i=0;i<16;i++) {
é=Rand*2*ã;
dx[i]=I32_MAX*Cos(é);
dy[i]=I32_MAX*Sin(é);
}
}
U0 Bounce()
{
CDC *dc=DCAlias;
I64 i,ch;
Init;
try {//Catch <CTRL-ALT-c>
do {
for (i=0;i<16;i++) {
dc->color=i;
GrPlot(dc,x[i].i32[1],y[i].i32[1]);
x[i]+=dx[i];
y[i]+=dy[i];
if (!(0<=x[i]<Fs->pix_width<<32)) {
x[i]-=dx[i];
dx[i]=-dx[i];
}
if (!(0<=y[i]<Fs->pix_height<<32)) {
y[i]-=dy[i];
dy[i]=-dy[i];
}
}
Yield;
} while (!(ch=ScanChar) || (ch!=CH_SHIFT_ESC && ch!=CH_ESC));
} catch
PutExcept;
DCFill(dc);
DCDel(dc);
}
Bounce;
+50
View File
@@ -0,0 +1,50 @@
I64 glbl_r[4][4];
U0 DrawIt(CTask *,CDC *dc)
{
I64 *old_r=dc->r;
dc->pen_width=2;
dc->color=RED;
dc->x=200;
dc->y=200;
dc->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc,glbl_r); //This assigns to dc->r and sets r_norm.
GrLine3(dc,-100,-100,-100, -100, 100,-100);
GrLine3(dc,-100, 100,-100, 100, 100,-100);
GrLine3(dc, 100, 100,-100, 100,-100,-100);
GrLine3(dc, 100,-100,-100, -100,-100,-100);
GrLine3(dc,-100,-100, 100, -100, 100, 100);
GrLine3(dc,-100, 100, 100, 100, 100, 100);
GrLine3(dc, 100, 100, 100, 100,-100, 100);
GrLine3(dc, 100,-100, 100, -100,-100, 100);
GrLine3(dc,-100,-100, 100, -100,-100,-100);
GrLine3(dc,-100, 100, 100, -100, 100,-100);
GrLine3(dc, 100, 100, 100, 100, 100,-100);
GrLine3(dc, 100,-100, 100, 100,-100,-100);
dc->r=old_r;
}
U0 Box()
{
F64 é=0,è=0,ê=0,s=1,s1=1.05;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
DocClear;
Fs->draw_it=&DrawIt;
while (!ScanChar) {
Mat4x4IdentEqu(glbl_r);
Mat4x4RotZ(glbl_r,é);
Mat4x4RotX(glbl_r,è);
Mat4x4RotZ(glbl_r,ê);
Mat4x4Scale(glbl_r,s);
Sleep(20);
é+=2*ã/70;
è+=2*ã/90;
ê+=2*ã/110;
s*=s1;
if ( !(0.2<s<1.4) ) s1=1/s1;
}
SettingsPop;
}
Box;
+48
View File
@@ -0,0 +1,48 @@
//x must be global.
//Might as well make y global.
F64 x,y,y_last;
U0 Cartesian()
{
U8 *st;
I64 ch=0,h,v;
Bool first;
CDC *dc=DCAlias;
do {
DocClear;
"Enter algebraic equation to graph.\n"
"Example: y=2*x\n"
"y=";
if (st=GetStr) {
if (*st) {
h=Fs->pix_width/2;
v=Fs->pix_height/2;
dc->color=RED;
GrLine(dc,h,0,h,2*v+1);
GrLine(dc,0,v,2*h+1,v);
first=TRUE;
dc->color=BLACK;
for (x=-h;x<=h;x++) {
y=-ExePrint("ToF64(%s);",st)(F64);
if (!first)
GrLine(dc,x-1+h,y_last+v,x+h,y+v);
y_last=y;
first=FALSE;
}
ch=GetChar;
} else
ch=CH_SHIFT_ESC;
Free(st);
} else
ch=CH_SHIFT_ESC;
DCFill;
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
DCDel(dc);
}
Cartesian;
//For better performance, compile the expression entered by the
//user one time with $LK,"LexExpression2Bin",A="MN:LexExpression2Bin"$() and use $LK,"Call",A="MN:Call"$().
//See $LK,"::/Demo/CompileDemo.HC"$.
+30
View File
@@ -0,0 +1,30 @@
U8 *old_font=text.font;
// See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScrnCodes.HC"$,
//$LK,"::/Demo/ExtChars.HC"$, and $LK,"::/Demo/Graphics/FontEd.HC"$.
U64 waves[4]={
0x0011AA440011AA44,0x0022558800225588,
0x0044AA110044AA11,0x0088552200885522};
U0 AnimateEndCB()
{
text.font=old_font;
Exit;
}
U0 AnimateTask(I64)
{
I64 i;
U64 *font=MAlloc(256*8);
Fs->task_end_cb=&AnimateEndCB;
MemCpy(font,text.font,256*8);
text.font=font;
while (TRUE) {
font[CH_SPACE]=waves[i++&0x3];
Sleep(100);
}
}
Spawn(&AnimateTask,NULL,"Animate",,Fs);
TaskRep;
Loaded 100 of 661 files, more files were not shown because too many files have changed in this diff. Show more