TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
@@ -22,7 +22,7 @@ U0 InsDirLinks()
|
||||
U8 *st=PopUpPickDir,*st2;
|
||||
st[0]=':'; //This is my personal code, not production. LOL
|
||||
st2=MStrPrint("%s/*",st);
|
||||
tempde=tempde1=FilesFind(st2,FUF_JUST_FILES|FUF_JUST_TXT);
|
||||
tempde=tempde1=FilesFind(st2,FUF_JUST_FILES);
|
||||
while (tempde) {
|
||||
tempde->full_name[0]=':';
|
||||
"$$LK,\"%s\",A=\"FI:%s\"$$\n",tempde->full_name+2,tempde->full_name;
|
||||
@@ -36,23 +36,23 @@ U0 InsDirLinks()
|
||||
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.TXT"$.
|
||||
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
|
||||
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
|
||||
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.TXT"$.
|
||||
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
|
||||
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"DocPutKey",A="MN:DocPutKey"$().
|
||||
//You can intercept any key.
|
||||
//You can customize keys. This routine
|
||||
//is called before the main editor
|
||||
//key handler $LK,"DocPutKey",A="MN:DocPutKey"$().
|
||||
//You can intercept any key.
|
||||
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
//Return TRUE if you completely
|
||||
//handled the key.
|
||||
I64 i,sc2=sc.u8[0];
|
||||
U8 *st1,*st2;
|
||||
|
||||
if (SC_F1<=sc2<=SC_F10 &&
|
||||
sc&SCF_ALT &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
sc&SCF_ALT &&
|
||||
!(sc & SCF_CTRL)) {
|
||||
switch (sc2) {
|
||||
case SC_F1:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
@@ -123,12 +123,21 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc & SCF_SHIFT)
|
||||
KeyDescSet("God Book Passage");
|
||||
else
|
||||
KeyDescSet("God Doodle File");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
FifoU8Flush(god.fifo);
|
||||
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
if (sc & SCF_SHIFT)
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT) {
|
||||
FifoU8Flush(god.fifo);
|
||||
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
GodBooksPassage("C:/Home/Wb2/Files/Text/*");
|
||||
} else {
|
||||
st1=PopUpPickFile;
|
||||
st2=FileRead(st1);
|
||||
GodDoodle(st2);
|
||||
Free(st2);
|
||||
Free(st1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_F8:
|
||||
@@ -203,7 +212,7 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"BF:%s\"$$",st1);
|
||||
} else
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"FL:%s,%d\"$$",
|
||||
st2,DocPut->cur_entry->y+1);
|
||||
st2,DocPut->cur_entry->y+1);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
}
|
||||
@@ -215,12 +224,12 @@ Bool MyPutKey(I64 ch,I64 sc)
|
||||
i=RandU32;
|
||||
ClipboardDel;
|
||||
DocPrint(sys_clipboard_doc,"$$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$$",
|
||||
DocPut->filename.name,i);
|
||||
DocPut->filename.name,i);
|
||||
"$$AN,\"<TODO>\",A=\"ANC%d\"$$",i;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
//Ins your own ALT-key plug-ins
|
||||
//Ins your own ALT-key plug-ins
|
||||
case 'b':
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd/Jump to Bad Code");
|
||||
|
||||
@@ -7,7 +7,8 @@ OptOn(OPTf_WARN_DUP_TYPES);
|
||||
KbdTypeMatic(0);
|
||||
|
||||
// Las Vegas is -7 during summer, -8 during winter
|
||||
local_time_offset=-8*60*60*CDATE_FREQ; //Pacific
|
||||
local_time_offset=-7*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
|
||||
mouse.scale.x=0.5;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "::/Apps/Psalmody/Load"
|
||||
#include "::/Demo/WebLogExample/WebLogRep"
|
||||
Cd("::/Home");;
|
||||
#include "::/Misc/ToDolDoc"
|
||||
#include "::/Home/TOSIDComputer"
|
||||
#include "::/Home/TOSCfg"
|
||||
#include "::/Home/TOSMisc"
|
||||
|
||||
@@ -15,7 +15,7 @@ U0 UserStartUp()
|
||||
"$$PURPLE$$DFT$$FG$$:";
|
||||
break;
|
||||
}
|
||||
"$TX,"79,905",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
|
||||
"$TX,"80,729",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
|
||||
CPURep;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -15,12 +15,7 @@ $WW,1$* Clean-up $LK,"FileNameAbs",A="MN:FileNameAbs"$().
|
||||
|
||||
* 1/?/2015 Macro select in Menu did not go to shell.
|
||||
|
||||
* Real World User Issues:
|
||||
QEMU runs maximized, but slow.
|
||||
If you move cursor off of bottom, macros don't work.
|
||||
Stutters in QEMU doing sound.
|
||||
|
||||
* $LK,"BMPRLE4To",A="MN:BMPRLE4To"$() has files_size too big by 108.
|
||||
* $LK,"BMPRLE4To",A="MN:BMPRLE4To"$() has files_size too big by 108. Did I fix it?
|
||||
|
||||
* Why is nontimer $LK,"Rand",A="MN:Rand"$() so bad?
|
||||
|
||||
@@ -28,22 +23,26 @@ $WW,1$* Clean-up $LK,"FileNameAbs",A="MN:FileNameAbs"$().
|
||||
|
||||
* More $LK,"CCtrl",A="MN:CCtrl"$.
|
||||
|
||||
* Add Redo to editor.
|
||||
|
||||
* PSect does not scan all task tables.
|
||||
|
||||
* No Compiler Warning: dc->palette48.r =palette24[i].r<<8;
|
||||
|
||||
* I think subswitch_start with a break in the preface fails.
|
||||
|
||||
* Add editor select just visible text for with filter.
|
||||
|
||||
* Add change-triangle-color to mesh editor.
|
||||
|
||||
* Add AVL binary tree support or red/black whatever that is. We have fixed-size stack. Auto-balancing binary tree is very needed. Where could we use?
|
||||
|
||||
* Maybe let committee decide if we want intern to make binary tree look-up using PSECT symbol addresses, so we can eliminate psect cache and wall-paper kludge. All HolyC functions and glbl vars would have left-right for address search.
|
||||
|
||||
* QEMU $LK,"tS",A="MN:tS"$ real-time-clock, slow Wenceslas.
|
||||
|
||||
* Is "GrSetSymmetry" or "GrSymmetry" better?
|
||||
|
||||
* DCF_TRANSFORMATION|DCF_SYMMETRY|DCF_JUST_MIRROR -- maybe not both needed at once.
|
||||
|
||||
* DiskCache during FileRead. CTRL-ALT-C, $LK,"Kill",A="MN:Kill"$().
|
||||
|
||||
* Help Index no mention of Symmetry in $LK,"GrLine",A="MN:GrLine"$() $LK,"GrLine3",A="MN:GrLine3"$().
|
||||
|
||||
* Get rid of BYTE WORD DWORD in opcode and replace with U8 U16 U32.
|
||||
|
||||
* 5/7/14:Something like AFSetIP.CPP caused hang, then reboot in TestSuite.
|
||||
@@ -57,6 +56,10 @@ $WW,1$* Clean-up $LK,"FileNameAbs",A="MN:FileNameAbs"$().
|
||||
* FlatTop is torpedo, not bombs.
|
||||
* BomberGolf is weird concept?
|
||||
|
||||
* Maybe, 3x3 instead of 4x4 matrices. <sigh>
|
||||
|
||||
* Get rid of text background color.
|
||||
|
||||
* Make a game, S.E.T.I., with radio telescope array. Put God on air.
|
||||
|
||||
* $LK,"Diff",A="MN:Diff"$() flags.
|
||||
@@ -65,6 +68,8 @@ $WW,1$* Clean-up $LK,"FileNameAbs",A="MN:FileNameAbs"$().
|
||||
|
||||
* MOV U8 [RSP+RCX],DL
|
||||
|
||||
* UAsm negative byte displacement, neg 32-bit disp.
|
||||
|
||||
* Might want HeapLog x Cnt
|
||||
|
||||
* Find-and-replace text on $$PT$$ line before it.
|
||||
@@ -83,7 +88,7 @@ $WW,1$* Clean-up $LK,"FileNameAbs",A="MN:FileNameAbs"$().
|
||||
|
||||
* Might want to move kernel code out of low 2Meg. Might be faster.
|
||||
|
||||
* F2 Macro on TestSuite
|
||||
* Add F2 Macro on TestSuite
|
||||
|
||||
* 4/13/14 Strut or RawHide crashed when sys_var_init_flag etc
|
||||
was set during testsuite.
|
||||
@@ -103,9 +108,6 @@ Looks like task_flags,locked_flags cause problems with neg offset.
|
||||
---------------------
|
||||
|
||||
* 3/19/14: RESET during RawHide
|
||||
* 2013? Wenceslas in TestSuite crashes, long time ago
|
||||
|
||||
* 12/26/13: Mountain in TestSuite didn't run right. Turned yellow, did nothing.
|
||||
|
||||
* FAQ frontloaded
|
||||
|
||||
@@ -124,13 +126,12 @@ COMPILER
|
||||
|
||||
* ATA/ATAPI ID in VMware, when not booted to CD? I forgot.
|
||||
|
||||
* I use fixed-point in $LK,"Circle",A="MN:Circle"$(), $LK,"Ellipse",A="MN:Ellipse"$(), $LK,"GrRot",A="MN:GrRot"$(), $LK,"GrMulMat",A="MN:GrMulMat"$() and others.
|
||||
* 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.CPP"$.
|
||||
$LK,"::/Demo/Lectures/FixedPointAdvanced.CPP"$.
|
||||
|
||||
* DOCF_DBL_DOLLARS in reindention
|
||||
* # in reindention
|
||||
|
||||
* HexEdit with odd size, ASCII cannot be edited.
|
||||
|
||||
@@ -260,7 +261,7 @@ registry-like routines... or registry I guess.
|
||||
|
||||
* New Editor widgets
|
||||
|
||||
* Make use of flag potential in SysFilesFind and possibly CFileAccess
|
||||
* Make use of flag potential in $LK,"FilesFind",A="MN:FilesFind"$() and possibly $LK,"DirContextNew",A="MN:DirContextNew"$()
|
||||
* implement fixed pos files
|
||||
|
||||
* new HolyC language features
|
||||
@@ -271,7 +272,7 @@ registry-like routines... or registry I guess.
|
||||
* Move stuff out of Kernel module.
|
||||
|
||||
* $LK,"ROP_XOR",A="MN:ROP_XOR"$ with pen_width>1 is broken.
|
||||
* RGB wrong in BMP files.
|
||||
* BGR wrong in BMP files.
|
||||
|
||||
* use width and height in line clipping for pen_width>1 or blot.
|
||||
* SIMD transformation
|
||||
@@ -287,7 +288,7 @@ registry-like routines... or registry I guess.
|
||||
* support r4u8 by adding 0x40 byte
|
||||
* static var off of data heap.
|
||||
* Might want to use U32*U32 multiplication.
|
||||
* could add "const" to not set LF_NOT_CONST flag for trig, etc.
|
||||
* could add "const" to not set CCF_NOT_CONST flag for trig, etc.
|
||||
* do r,rm ICCmp like ICBrCmp
|
||||
* could make glblvar imports use TY_RIP_DISP32.
|
||||
* PUSH_CMP allocs reg R9 or whatever
|
||||
@@ -296,7 +297,7 @@ assignments. Is ShiftNoPush fully implemented?
|
||||
* NOP1 might need to have diff ic_data's
|
||||
* in divequal, it assumes about ebx
|
||||
* error/warning line nums
|
||||
* ASM branch out warning of range off by 1 line--use lx->last_line_num
|
||||
* ASM branch out warning of range off by 1 line--use cc->last_line_num
|
||||
|
||||
* Switch statement with sparse cases (low priority)
|
||||
* maybe inline functions?
|
||||
@@ -310,76 +311,43 @@ assignments. Is ShiftNoPush fully implemented?
|
||||
* sort options for findfiles
|
||||
* Maybe, get rid of $LK,"0x20000",A="FF:::/Compiler/CMain.CPP,0x20000"$ in compiler.
|
||||
|
||||
It is love I desire: $LK,"Hosea,6:6",A="BF:Hosea,6:6"$ $TX,"Hosea 6:6",HTML="http://www.biblegateway.com/verse/en/Hosea%206:6"$
|
||||
|
||||
$LK,"Hosea,6:6",A="BF:Hosea,6:6"$
|
||||
Offer a sacrifice of praise: $LK,"Hebrews,13:15",A="BF:Hebrews,13:15"$ $TX,"Hebrews 13:15",HTML="http://www.biblegateway.com/verse/en/Hebrews%2013:15"$
|
||||
|
||||
$LK,"Hebrews,13:15",A="BF:Hebrews,13:15"$
|
||||
|
||||
$LK,"Psalms,50:14",A="BF:Psalms,50:14"$
|
||||
Do I drink blood of goats? Offer praise: $LK,"Psalms,50:14",A="BF:Psalms,50:14"$ $TX,"Psalms 50:14",HTML="http://www.biblegateway.com/verse/en/Psalms%2050:14"$
|
||||
|
||||
Runner's Stride: $LK,"Psalms,147:10",A="BF:Psalms,147:10"$ $TX,"Psalms 147:10",HTML="http://www.biblegateway.com/verse/en/Psalms%20147:10"$
|
||||
|
||||
Buckling Armor: $LK,"1 Kings,20:11",A="BF:1 Kings,20:11"$ $TX,"1 Kings 20:11",HTML="http://www.biblegateway.com/verse/en/1%20Kings%2020:11"$
|
||||
|
||||
>lspci -v
|
||||
|
||||
Size:$TX,"17594 KB",D="DD_TEMPLEOSCD_K_SIZE"$
|
||||
|
||||
$TX,"Let me Google NIST Random Beacon",HTML="http://lmgtfy.com?q=NIST+random+beacon"$
|
||||
|
||||
/*****************************************************************************/
|
||||
$WW,1$This is the transcript of a radio conversation of a US naval ship with Canadian authorities off the coast of Newfoundland in October, 1995. Radio conversation released by the Chief of Naval Operations 10-10-95.
|
||||
Commodore 64 Basic/Assembly
|
||||
$HC,"<object width=\"640\" height=\"520\"><param name=\"movie\" value=\"http://www.youtube.com/v/d8bZ92gIVms\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/d8bZ92gIVms\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" width=\"640\" height=\"520\"></embed></object>"$
|
||||
|
||||
Americans: Please divert your course 15 degrees to the North to avoid a Collision.
|
||||
|
||||
Canadians: Recommend you divert YOUR course 15 degrees to the South to avoid a collision.
|
||||
|
||||
Americans: This is the Captain of a US Navy ship. I say again, divert YOUR course.
|
||||
|
||||
Canadians: No. I say again, you divert YOUR course.
|
||||
|
||||
Americans: This is the aircraft carrier USS Lincoln, the second largest ship in the United States' Atlantic fleet. We are accompanied by three destroyers, three cruisers and numerous support vessels. I demand that YOU change your course 15 degrees north, that's one five degrees north, or countermeasures will be undertaken to ensure the safety of this ship.
|
||||
|
||||
Canadians: This is a lighthouse. Your call.[2]
|
||||
$WW,0$/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
char *words[10000]; //Single word list. No statistical weights allowed.
|
||||
int i=0;
|
||||
|
||||
while (true) {
|
||||
while (!keyboard_hit())
|
||||
i++;
|
||||
printf("%s ",words[i%10000]);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
Size:$TX,"17784 KB",D="DD_TEMPLEOSCD_K_SIZE"$
|
||||
|
||||
/************************** $TX,"Perfect Coin Toss",HTML="http://hackaday.com/2014/12/19/nist-randomness-beacon/"$ ********************************/
|
||||
$TX,"NIST Randomness Beacon",HTML="http://www.nist.gov/itl/csd/ct/nist_beacon.cfm"$ is a government certified random number. You can call
|
||||
the caretaker on that page, Rene Peralta 301-975-8702, $TX,"rene.peralta@nist.gov",HTML="mailto:rene.peralta@nist.gov"$.
|
||||
Once every minute, they have a random lottery and post the results to their
|
||||
site. You can go back and check old lottery numbers, by entering link+time.
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415440980",HTML="https:/beacon.nist.gov/rest/record/1415440980"$
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415445300",HTML="https:/beacon.nist.gov/rest/record/1415445300"$ To check old numbers, enter
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415529600",HTML="https:/beacon.nist.gov/rest/record/1415529600"$ Unix timestamp in the the URL.
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415531580",HTML="https:/beacon.nist.gov/rest/record/1415531580"$ (Seconds since 1-JAN-1970)
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415563680",HTML="https:/beacon.nist.gov/rest/record/1415563680"$ $TX,"Unix Timestamp Tool",HTML="http://www.epochconverter.com"$
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415565600",HTML="https:/beacon.nist.gov/rest/record/1415565600"$
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415566560",HTML="https:/beacon.nist.gov/rest/record/1415566560"$ They chain the numbers so they
|
||||
$TX,"https:/beacon.nist.gov/rest/record/1415568120",HTML="https:/beacon.nist.gov/rest/record/1415568120"$ cannot be tampered with.
|
||||
/*****************************************************************************/
|
||||
Bill Gates Predictions
|
||||
$HC,"<object width=\"640\" height=\"520\"><param name=\"movie\" value=\"http://www.youtube.com/v/4r9u_R0cCew\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/4r9u_R0cCew\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" width=\"640\" height=\"520\"></embed></object>"$
|
||||
|
||||
Cop tying shoe: (After drive-by shooting, God said kid was not innocent, LOL.)
|
||||
$HC,"<img src=\"https://goodtimestories.files.wordpress.com/2013/04/cop-tying-shoe-cambridge-county-pd.jpg\" width=\"480\" height=\"376\" alt=\"\">"$
|
||||
|
||||
$TX,"WWW.OSDEV.ORG",HTML="http://www.osdev.org"$
|
||||
$TX,"My Bookmarks",HTML="http://www.templeos.org/Wb/Home/Wb2/Files/Bookmarks"$
|
||||
$TX,"Perfect Coin Toss",HTML="http://hackaday.com/2014/12/19/nist-randomness-beacon/"$
|
||||
$TX,"Top 100 Movies",HTML="http://www.afi.com/100years/movies10.aspx"$
|
||||
$TX,"Dr. David Pheanis",HTML="https://webapp4.asu.edu/directory/person/77201"$
|
||||
$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,"Tom Foley",HTML="http://web.gccaz.edu/~tfoley/perspage.html"$
|
||||
$TX,"KeyPeele#1",HTML="http://www.youtube.com/watch?v=Dd7FixvoKBw"$
|
||||
$TX,"KeyPeele#2",HTML="http://www.youtube.com/watch?v=VHG_Gv_zLY4"$
|
||||
$TX,"ThePrisoner",HTML="http://www.youtube.com/watch?v=HRPDO63rI1E"$
|
||||
$TX,"Bible with LineNums",HTML="http://www.templeos.org/files/NumBible.TXT"$
|
||||
$TX,"WestWorld",HTML="http://www.youtube.com/watch?v=LcL3eP0Hfy4"$
|
||||
$TX,"Picard:FourLights",HTML="http://www.youtube.com/watch?v=o_eSwq1ewsU"$
|
||||
$TX,"Dwight:NerdTorture",HTML="http://www.noob.us/humor/the-office-dwight-faces-nerd-torture-of-the-highest-form"$
|
||||
@@ -388,16 +356,9 @@ $TX,"Dumb Guards",HTML="http://www.youtube.com/watch?v=OdKa9bXVinE"$
|
||||
$TX,"Mapping the Commodore 64",HTML="http://unusedino.de/ec64/technical/project64/mapping_c64.html"$
|
||||
Holy Grail: Lmq5PxHpLNw 1:28:27
|
||||
$TX,"ATA/ATAPI Spec",HTML="http://www.t13.org/Documents/UploadedDocuments/docs2007/D1532v1r4b-AT_Attachment_with_Packet_Interface_-_7_Volume_1.pdf"$
|
||||
$TX,"BBC",HTML="http://www.knpr.org/"$
|
||||
$TX,"BBC",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,"KNPR",HTML="http://www.knpr.org/"$
|
||||
$TX,"KNPR",HTML="http://www.knpr.org"$
|
||||
$TX,"C64 Users Guide",HTML="http://www.commodore.ca/manuals/c64_users_guide/c64-users_guide.htm"$
|
||||
$TX,"C64 Programmers Reference Guide",HTML="http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference.htm"$
|
||||
|
||||
|
||||
1) Strings, Opcode in Compiler
|
||||
2) FizzBuzz
|
||||
3) Negative displacements
|
||||
4) Multicore
|
||||
5) Preempt
|
||||
6) Graphics
|
||||
@@ -1,19 +1,27 @@
|
||||
$TR-UL,"Adam"$
|
||||
$ID,2$$TR,"SysMsgFlags"$
|
||||
$ID,2$sys_msg_flags[0]=0xFB;
|
||||
$ID,2$sys_msg_flags[0]=0xFF;
|
||||
$ID,-2$$TR,"SysRegVer"$
|
||||
$ID,2$registry_version=3.030;
|
||||
$ID,2$registry_version=3.070;
|
||||
$ID,-2$$ID,-2$$TR-C-UL,"TempleOS"$
|
||||
$ID,2$$TR,"CircleTrace"$
|
||||
$ID,2$F64 best_score=4.9425;
|
||||
$ID,-2$$TR,"TOS"$
|
||||
$ID,2$I64 tos_code_walk_thru=105,tos_after_egypt_in_action=46;
|
||||
$ID,-2$$TR,"DiningStars"$
|
||||
$ID,2$F64 best_score=9999.0000;
|
||||
$ID,-2$$TR,"BlackDiamond"$
|
||||
$ID,2$I64 best_score=1;
|
||||
$ID,-2$$TR,"EagleDive"$
|
||||
$ID,2$I64 best_score=4;
|
||||
$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=50.3318;
|
||||
$ID,-2$$TR,"Varoom"$
|
||||
$ID,2$F64 best_score=11.8623;
|
||||
$ID,-2$$TR,"BugBird"$
|
||||
$ID,2$F64 best_score=18.2332;
|
||||
$ID,-2$$TR,"TimeOut"$
|
||||
@@ -26,15 +34,12 @@ $ID,-2$$TR,"XCaliber"$
|
||||
$ID,2$I64 best_score=248;
|
||||
I64 msg_flags=1;
|
||||
$ID,-2$$TR,"Wenceslas"$
|
||||
$ID,2$F64 best_score=62.7035;
|
||||
$ID,2$F64 best_score=49.8074;
|
||||
$ID,-2$$TR,"BomberGolf"$
|
||||
$ID,2$I64 best_score=32;
|
||||
$ID,-2$$TR,"EagleDive"$
|
||||
$ID,2$I64 best_score=4;
|
||||
$ID,-2$$TR,"Varoom"$
|
||||
$ID,2$F64 best_score=11.8623;
|
||||
$ID,-2$$TR,"BlackDiamond"$
|
||||
$ID,2$I64 best_score=1;
|
||||
$ID,-2$$TR,"TOS"$
|
||||
$ID,2$I64 tos_code_walk_thru=101,tos_after_egypt_in_action=46;
|
||||
$ID,-2$$ID,-2$
|
||||
$ID,-2$$ID,-2$$TR,"DemoCompany"$
|
||||
$ID,2$$TR,"Game1"$
|
||||
$ID,2$F64 best_score=168.62557;
|
||||
$TR,"SimpleVal"$
|
||||
$ID,2$1250;
|
||||
$ID,-2$$ID,-2$$ID,-2$
|
||||
+16
-10
@@ -3,17 +3,18 @@ U0 TOSBootRescueDrv1()
|
||||
{
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrint("TOS_BOOT_RESCUE_DRV","0x%X",CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
|
||||
DefinePrint("TOS_BOOT_RESCUE_DRV","0x%X",
|
||||
CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
|
||||
DefinePrint("TOS_BOOT_RESCUE_DRV_END", "0x%X",FloorI64(
|
||||
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4<<4-
|
||||
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
|
||||
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4<<4-
|
||||
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
|
||||
DefinePrint("CFG_BOOT_RESCUE_DRV_FILE","\"/Temp/BootRescueDrv.BIN.Z\"");
|
||||
} TOSBootRescueDrv1;
|
||||
|
||||
U0 TOSBootRescueDrv2()
|
||||
{
|
||||
DefinePrint("CFG_BOOT_RESCUE_DRV","\"a10x%X\n0x%X\n\"",TOS_BOOT_RESCUE_DRV,
|
||||
(TOS_BOOT_RESCUE_DRV_END-TOS_BOOT_RESCUE_DRV)/BLK_SIZE);
|
||||
(TOS_BOOT_RESCUE_DRV_END-TOS_BOOT_RESCUE_DRV)/BLK_SIZE);
|
||||
DefinePrint("CFG_BOOT_RESCUE_DRV_START","\"0x%X\"",TOS_BOOT_RESCUE_DRV);
|
||||
} TOSBootRescueDrv2;
|
||||
|
||||
@@ -23,9 +24,10 @@ U0 TOSInit()
|
||||
CBlkDev *bd;
|
||||
switch (tos_cid) {
|
||||
case CID_DFT:
|
||||
DefinePrint("CFG_RAM_DRVS","\"b1\nScale2Mem(2048,0x280000,4*1024*1024*1024)\n\"");
|
||||
DefinePrint("CFG_RAM_DRVS",
|
||||
"\"b1\nScale2Mem(2048,0x280000,4*1024*1024*1024)\n\"");
|
||||
if (dsk.auto_mount_ide_cnt) {
|
||||
//If AutoMount was successful, No need to manually mount in next compile
|
||||
//If AutoMount was successful, No need to manually mount in next compile
|
||||
DefinePrint("CFG_HARD_DRVS","\"\"");
|
||||
DefinePrint("CFG_CDROM_DRVS","\"\"");
|
||||
} else {
|
||||
@@ -46,7 +48,7 @@ U0 TOSInit()
|
||||
try {
|
||||
bd=Let2BlkDev('C');
|
||||
DefinePrint("CFG_HARD_DRVS","\"c2s0x%X\n0x%X\n%d\"",
|
||||
bd->base0,bd->base1,bd->unit);
|
||||
bd->base0,bd->base1,bd->unit);
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
try {
|
||||
@@ -78,7 +80,11 @@ U0 TOSDrvTextAttrSet()
|
||||
"HeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
|
||||
#define CFG_DBGZ_OPTS "AutoMountIDE\nCT"\
|
||||
"HeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
|
||||
#define TOS_CFG "\n" CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS "\n" CFG_DSK_CACHE CFG_OPTS
|
||||
#define TOS_CFG "\n" CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS "\n"\
|
||||
CFG_DSK_CACHE CFG_OPTS
|
||||
#define TOS_CDROM_CFG "Tb1\n0x20000\nt3 \n\n\nAutoMountIDE\nCT\n"
|
||||
#define TOS_CDROM_DBG_CFG "A" CFG_BOOT_RESCUE_DRV "b1\nScale2Mem(2048,0x40000)\n\n\n"\
|
||||
"DontProbe\nBootRescueDrv\n" "C:" CFG_BOOT_RESCUE_DRV_FILE "\n" CFG_BOOT_RESCUE_DRV_START "\n\n"
|
||||
#define TOS_CDROM_DBG_CFG "A" CFG_BOOT_RESCUE_DRV\
|
||||
"b1\nScale2Mem(2048,0x40000)\n\n\n"\
|
||||
"DontProbe\nBootRescueDrv\n"\
|
||||
"C:" CFG_BOOT_RESCUE_DRV_FILE "\n"\
|
||||
CFG_BOOT_RESCUE_DRV_START "\n\n"
|
||||
@@ -20,7 +20,7 @@ U0 TOSMakeOSDrvBootInstall(U8 drv_let)
|
||||
|
||||
U0 TOSCopyDrv(U8 src,U8 dst)
|
||||
{
|
||||
U8 buf_s[128],buf_d[128];
|
||||
U8 buf_s[STR_LEN],buf_d[STR_LEN];
|
||||
src=ToUpper(src);
|
||||
dst=ToUpper(dst);
|
||||
|
||||
@@ -90,7 +90,8 @@ public U0 CopySongs(U8 threshold='7')
|
||||
{
|
||||
CDoc *s;
|
||||
CDocEntry *doc_e;
|
||||
CDirEntry *tempde=FilesFind("::/Home/Psalmody/*.CPP*",FUF_CLUSTER_ORDER),*tempde1=tempde;
|
||||
CDirEntry *tempde=FilesFind("::/Home/Psalmody/*.CPP*",FUF_CLUSTER_ORDER),
|
||||
*tempde1=tempde;
|
||||
DelTree("/Apps/Psalmody/Examples");
|
||||
MkDir("/Apps/Psalmody/Examples");
|
||||
while (tempde) {
|
||||
@@ -107,8 +108,10 @@ U0 DistroPrep()
|
||||
{
|
||||
Del("/Demo/WebLogExample/WebLogRep.TXT*");
|
||||
Del("/Demo/ReverseFileExample/PoemForeward.TXT*");
|
||||
Del("/Home/NumBible.TXT.Z");
|
||||
DelTree("/Home/*Temp.TXT.Z");
|
||||
CopySongs;
|
||||
if (FileFind("::/Home/Psalmody"))
|
||||
CopySongs;
|
||||
|
||||
DelTree("/Temp");
|
||||
MkDir("/Temp");
|
||||
@@ -125,10 +128,10 @@ U0 DistroPrep()
|
||||
DelTree("/Demo/AcctExample/Wb2");
|
||||
Del("/Demo/AcctExample/Test*");
|
||||
|
||||
//Once in a while, do these:
|
||||
// SortHeaders;
|
||||
// DocOpt("/*");
|
||||
// DblSpaceScan("/*");
|
||||
//Once in a while, do these:
|
||||
// SortHeaders;
|
||||
// DocOpt("/*");
|
||||
// DblSpaceScan("/*");
|
||||
|
||||
CursorRem("/*");
|
||||
DelTree("/Demo/*.BI*");
|
||||
@@ -140,7 +143,7 @@ U0 DistroPrep()
|
||||
U0 MakeBootRescueDrvFile()
|
||||
{
|
||||
try
|
||||
Let2Drv('A');
|
||||
Let2Drv('A');
|
||||
catch {
|
||||
Fs->catch_except=TRUE;
|
||||
Auto(CFG_BOOT_RESCUE_DRV "\n");
|
||||
@@ -168,7 +171,8 @@ U0 MakeBootRescueDrvFile()
|
||||
Copy("C:/Adam/AUtils.CPP.Z", "A:/Adam");
|
||||
Copy("C:/Adam/AMathODE.CPP.Z","A:/Adam");
|
||||
|
||||
FileWrite("C:" CFG_BOOT_RESCUE_DRV_FILE,bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
FileWrite("C:" CFG_BOOT_RESCUE_DRV_FILE,
|
||||
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
}
|
||||
|
||||
U0 MakeSymFiles()
|
||||
@@ -228,9 +232,9 @@ I64 MakeLineRepFile()
|
||||
}
|
||||
DocClear;
|
||||
official=LineRep("C:/*","-r")+
|
||||
LineRep("C:/Adam/*")+
|
||||
LineRep("C:/Compiler/*","-S+T")+
|
||||
LineRep("C:/Kernel/*");
|
||||
LineRep("C:/Adam/*")+
|
||||
LineRep("C:/Compiler/*","-S+T")+
|
||||
LineRep("C:/Kernel/*");
|
||||
DocClear;
|
||||
CopyTree("B:/TOS","C:/Home");
|
||||
DelTree("B:/TOS");
|
||||
@@ -239,7 +243,7 @@ I64 MakeLineRepFile()
|
||||
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_data_col=0;
|
||||
doc->cur_col=0;
|
||||
|
||||
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",result);
|
||||
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\");\n",official);
|
||||
@@ -270,14 +274,16 @@ website, too.
|
||||
MakeOSDrvBootInstall('C','T');
|
||||
DelTree(TOS_DISTRO_DIR);
|
||||
CopyTree("C:/",TOS_DISTRO_DIR "/");
|
||||
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
|
||||
}
|
||||
U0 MakeTOSDistro()
|
||||
{
|
||||
TOSDistroPrep;
|
||||
CDFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSTS_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
@@ -303,15 +309,17 @@ I call $LK,"MakeBootDrvFile",A="FF:::/Demo/AcctExample/TOSDistro.CPP,MakeBootRes
|
||||
MakeOSDrvBootInstall('C','T');
|
||||
DelTree(TOS_DISTRO_DIR);
|
||||
CopyTree("C:/",TOS_DISTRO_DIR "/");
|
||||
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
|
||||
Del("C:" CFG_BOOT_RESCUE_DRV_FILE);
|
||||
}
|
||||
U0 MakeDbgDistro()
|
||||
{
|
||||
DbgDistroPrep;
|
||||
CDFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSDBG_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
@@ -325,18 +333,20 @@ U0 StdDistroPrep()
|
||||
CopyTree("C:/",TOS_DISTRO_DIR "/");
|
||||
DelTree(TOS_DISTRO_DIR "/Home");
|
||||
MkDir(TOS_DISTRO_DIR "/Home");
|
||||
Del(TOS_DISTRO_DIR "/0000Boot/OldMBR.BIN.C");
|
||||
Del(TOS_DISTRO_DIR "/0000Boot/BootMHD2.BIN.C");
|
||||
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;
|
||||
CDFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 LiteDistroPrep()
|
||||
{/*Missing: Dictionary, Bible and TOSZ Utility. Still 100% OpenSource.
|
||||
{/*Missing: Dictionary, Bible and TOSZ Utility.Still 100% OpenSource.
|
||||
Includes: x86_64 64BitMultiCoredKernel, 64BitCompiler, Assembler,
|
||||
Unassembler, Debugger, Editor, VGAGraphics, Tools, BootLoaders,
|
||||
Keyboard&Mouse, HardDrives, FAT32, Partitioner, CD/DVD, ISO9660FileCreator,
|
||||
@@ -345,6 +355,7 @@ Demos, Documentation.
|
||||
*/
|
||||
StdDistroPrep;
|
||||
DelTree(TOS_DISTRO_DIR "/Linux");
|
||||
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
|
||||
Del(TOS_DISTRO_DIR "/Adam/AutoComplete/ACDefs.DAT*");
|
||||
Del(TOS_DISTRO_DIR "/Misc/PCIDevices.TXT.Z");
|
||||
Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
|
||||
@@ -352,15 +363,17 @@ Demos, Documentation.
|
||||
U0 MakeLiteDistro()
|
||||
{
|
||||
LiteDistroPrep;
|
||||
CDFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSLITE_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
U0 UltraDistroPrep()
|
||||
{/*Missing: Apps, Demos, Dictionary, Bible and TOSZ Utility. Still 100% OpenSource.
|
||||
{/*
|
||||
Missing: Apps, Demos, Dictionary, Bible and TOSZ Utility. Still 100%OpenSource.
|
||||
Includes: x86_64 64BitMultiCoredKernel, 64BitCompiler, Assembler,
|
||||
Unassembler, Debugger, Editor, VGAGraphics, Tools, BootLoaders,
|
||||
Keyboard&Mouse, HardDrives, FAT32, Partitioner, CD/DVD, ISO9660FileCreator,
|
||||
@@ -368,8 +381,10 @@ FileManager, WindowManager, PCSpeaker, Documentation.
|
||||
*/
|
||||
LiteDistroPrep;
|
||||
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.DAT*");
|
||||
Del(TOS_DISTRO_DIR "/Adam/God/Vocab.TXT.Z");
|
||||
Del(TOS_DISTRO_DIR "/Misc/OSTestSuite.CPP.Z");
|
||||
@@ -377,10 +392,11 @@ FileManager, WindowManager, PCSpeaker, Documentation.
|
||||
U0 MakeUltraDistro()
|
||||
{
|
||||
UltraDistroPrep;
|
||||
CDFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
ISOFileCreate(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
|
||||
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
|
||||
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
|
||||
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
|
||||
Drv('C');
|
||||
}
|
||||
|
||||
@@ -395,9 +411,10 @@ U0 TOSWebFile(U8 *name)
|
||||
Touch(name,"",,de.datetime);
|
||||
name2=ChgExt(name,"html");
|
||||
ToHtml(name,name2,
|
||||
"<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"
|
||||
);
|
||||
"<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");
|
||||
Touch(name2,"",,de.datetime);
|
||||
Free(name2);
|
||||
}
|
||||
@@ -415,11 +432,17 @@ U0 MakeWebSite()
|
||||
Touch("D:/Wb/Home/Wb2/index.TXT.Z","",,Now);
|
||||
Touch("D:/Wb/Home/Wb2/Downloads.TXT.Z","",,Now);
|
||||
Touch("D:/Wb/Home/Wb2/TempleOS.TXT.Z","",,Now);
|
||||
tempde=tempde1=FilesFind("*",FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
tempde=tempde1=FilesFind("*",
|
||||
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
TOSWebFile(tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
Copy( "D:/Wb/Home/Wb2/Files/Bin/TempleBot",
|
||||
"D:/Wb/Home/Wb2/Files/Bin/TempleBot.TXT");
|
||||
ToDolDoc("D:/Wb/Home/Wb2/Files/Bin/TempleBot.TXT");
|
||||
ToHtml("D:/Wb/Home/Wb2/Files/Bin/TempleBot.TXT");
|
||||
Del("D:/Wb/Home/Wb2/Files/Bin/TempleBot.TXT");
|
||||
DirTreeDel(tempde1);
|
||||
Drv('C');
|
||||
}
|
||||
@@ -456,15 +479,15 @@ U0 MakeWebSitePartial()
|
||||
U0 UpdateISODocDefines()
|
||||
{
|
||||
DefinePrint("DD_TEMPLEOSCD_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
|
||||
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
|
||||
"%d KB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
|
||||
"%d KB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
|
||||
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
|
||||
"Download $TX,"TempleOS V3.02",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
|
||||
"Download $TX,"TempleOS V3.07",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.1f MB)",
|
||||
0.1*(10*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
|
||||
DefinePrint("DD_TEMPLEOSULTRA_K_SIZE",
|
||||
"%d KB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
|
||||
"%d KB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
|
||||
}
|
||||
|
||||
UpdateISODocDefines;
|
||||
@@ -473,7 +496,7 @@ public U0 MakeDistrosAndBackUp()
|
||||
{
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
progress4=*progress4_desc=0;
|
||||
progress4_max=13;
|
||||
progress4_max=14;
|
||||
AutoComplete;
|
||||
WinMax;
|
||||
WinBorder;
|
||||
@@ -496,9 +519,15 @@ public U0 MakeDistrosAndBackUp()
|
||||
UpdateISODocDefines;
|
||||
|
||||
Cd("C:/");
|
||||
|
||||
if (LongLines)
|
||||
throw;
|
||||
progress4++;
|
||||
|
||||
if (LinkChk)
|
||||
throw;
|
||||
progress4++;
|
||||
|
||||
MakeSymFiles; progress4++;
|
||||
MakeWebSite; progress4++;
|
||||
|
||||
@@ -507,3 +536,12 @@ public U0 MakeDistrosAndBackUp()
|
||||
progress4=progress4_max=0;
|
||||
SettingsPop;
|
||||
}
|
||||
|
||||
public U0 PreBackUp()
|
||||
{
|
||||
Copy("D:/Home/Wb2/Files/Bookmarks.html","C:/Home/Wb2/Files");
|
||||
Del("C:/Home/Wb2/Files/Bin/*");
|
||||
Copy("D:/Home/Wb2/Files/Bin/*","C:/Home/Wb2/Files/Bin");
|
||||
Copy("D:/Home/Wb2/Files/Bin/TempleBot","C:/Linux");
|
||||
Copy("D:/Home/Wb2/Files/Bin/God*","C:/Linux");
|
||||
}
|
||||
+143
-101
@@ -1,6 +1,7 @@
|
||||
U0 BadCodeJump()
|
||||
{//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
CDirEntry *tempde1=FilesFind("/*",FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
|
||||
CDirEntry *tempde1=FilesFind("/*",
|
||||
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
|
||||
*tempde=tempde1;
|
||||
I64 cnt=0,num;
|
||||
CDoc *doc;
|
||||
@@ -38,11 +39,12 @@ public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
|
||||
U0 DCImgWrite(CDC *dc)
|
||||
{
|
||||
U8 *st1=FileNameNumNext("::/Home/Wb2/Imgs/Img*",
|
||||
"::/Home/Wb2/Imgs/Img%03d.BMP"),
|
||||
*st2=MStrPrint("http://www.templeos.org/Wb%s",st1+2);
|
||||
"::/Home/Wb2/Imgs/Img%03d.BMP"),
|
||||
*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;
|
||||
"$$HC,\"<img src=\\\"%s\\\" width=\\\"%d\\\" "
|
||||
"height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",st2,dc->width,dc->height;
|
||||
Free(st2);
|
||||
}
|
||||
|
||||
@@ -53,7 +55,7 @@ U0 BlogScreenShot()
|
||||
U8 *old_fp_draw_input_ptr=gr.fp_draw_input_ptr;
|
||||
gr.fp_draw_input_ptr=NULL;
|
||||
WinMgrSync(2);
|
||||
dc1=DCCaptureScreen;
|
||||
dc1=DCScreenCapture;
|
||||
dc2=DCExtract(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
|
||||
DCImgWrite(dc2);
|
||||
gr.fp_draw_input_ptr=old_fp_draw_input_ptr;
|
||||
@@ -62,18 +64,18 @@ U0 BlogScreenShot()
|
||||
DocCursor(old_cursor);
|
||||
}
|
||||
|
||||
U8 *WebBookMarks(U8 *filename="::/Home/Archive/Bookmarks.html")
|
||||
U8 *WebBookMarks(U8 *filename="::/Home/Wb2/Files/Bookmarks.html")
|
||||
{
|
||||
U8 *st;
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocNew;
|
||||
CLex *lx=LexNew(MStrPrint("#include \"%s\"",filename));
|
||||
while (Lex(lx))
|
||||
if (lx->token==TK_STR && *lx->cur_str(U32 *)=='http') {
|
||||
DocPrint(doc,"$$MU-UL,\"%Q\",LE=0x%X$$\n",lx->cur_str,lx->cur_str);
|
||||
lx->cur_str=NULL;
|
||||
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;
|
||||
}
|
||||
LexDel(lx);
|
||||
CmpCtrlDel(cc);
|
||||
|
||||
if ((st=PopUpMenu(doc))!=DOCM_CANCEL)
|
||||
st=StrNew(st);
|
||||
@@ -122,8 +124,8 @@ U8 *TopMoviesWrite(U8 *filename="C:/Home/Wb2/Files/Movies.TXT.Z",
|
||||
|
||||
class CTopMoviesForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136];
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN];
|
||||
I64 timestamp;
|
||||
I64 cert fmtstr "$$DA,32,A=\"Movie #1-100 :%d\"$$\n";
|
||||
I64 min;
|
||||
@@ -132,8 +134,8 @@ class CTopMoviesForm
|
||||
|
||||
class CWebBookMarkForm
|
||||
{
|
||||
U8 tag[136] fmtstr "$$DA-P,135,A=\"Tag Text :%s\"$$\n";
|
||||
U8 special[136];
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Tag Text :%s\"$$\n";
|
||||
U8 special[STR_LEN];
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -142,8 +144,8 @@ class CWebBookMarkForm
|
||||
|
||||
class CWebBibleForm
|
||||
{
|
||||
U8 tag[136] fmtstr "$$DA-P,135,A=\"Tag Text :%s\"$$\n";
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Bible Passage:%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Tag Text :%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Bible Passage:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -152,8 +154,8 @@ class CWebBibleForm
|
||||
|
||||
class CYouTubeForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"SerialNum:%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min fmtstr "$$DA,32,A=\"Minutes :%d\"$$\n";
|
||||
@@ -162,8 +164,8 @@ class CYouTubeForm
|
||||
|
||||
class CTopMoviesYouTubeForm
|
||||
{
|
||||
U8 tag[136] fmtstr "$$DA-P,135,A=\"Movie :%s\"$$\n";
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"SerialNum:%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Movie :%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min fmtstr "$$DA,32,A=\"Minutes :%d\"$$\n";
|
||||
@@ -172,8 +174,8 @@ class CTopMoviesYouTubeForm
|
||||
|
||||
class CImgurForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"SerialNum:%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min fmtstr "$$DA,32,A=\"Width :%d\"$$\n";
|
||||
@@ -182,8 +184,8 @@ class CImgurForm
|
||||
|
||||
class CWikipediaForm
|
||||
{
|
||||
U8 tag[136] fmtstr "$$DA-P,135,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Index :%s\"$$\n";
|
||||
U8 tag[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Tag Text:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Index :%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -192,8 +194,8 @@ class CWikipediaForm
|
||||
|
||||
class CRandDecForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Line (Dec):%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Dec):%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -202,8 +204,8 @@ class CRandDecForm
|
||||
|
||||
class CRandHexForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Line (Hex):%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Hex):%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -212,8 +214,8 @@ class CRandHexForm
|
||||
|
||||
class CRandCertForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Line (Dec) :%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Dec) :%s\"$$\n";
|
||||
I64 timestamp;
|
||||
I64 cert fmtstr "$$DA,32,A=\"Certificate:%d\"$$\n";
|
||||
I64 min;
|
||||
@@ -222,8 +224,8 @@ class CRandCertForm
|
||||
|
||||
class CRandHexBeaconForm
|
||||
{
|
||||
U8 tag[136];
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"Line (Hex):%s\"$$\n";
|
||||
U8 tag[STR_LEN];
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"Line (Hex):%s\"$$\n";
|
||||
I64 timestamp fmtstr "$$DA,32,A=\"TimeStamp :%d\"$$\n";
|
||||
I64 cert;
|
||||
I64 min;
|
||||
@@ -260,7 +262,8 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
|
||||
if (modulo) {
|
||||
if (radix==16)
|
||||
DocPrint(doc_out,"0x%s-->",st);
|
||||
DocPrint(doc_out,"(%d remainder when divided by %d)",i,ST_BIBLE_LINES-(num_lines-1));
|
||||
DocPrint(doc_out,"(%d remainder when divided by %d)",
|
||||
i,ST_BIBLE_LINES-(num_lines-1));
|
||||
start=i%(ST_BIBLE_LINES-(num_lines-1));
|
||||
} else {
|
||||
if (radix==16)
|
||||
@@ -275,7 +278,7 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
|
||||
DocPrint(doc_out,"-->Line:%d\n",start);
|
||||
|
||||
verse=BibleLine2Verse(start);
|
||||
DocPrint(doc_out,"$TX,"KingJamesBible",HTML="http://www.templeos.org/files/BIBLE.TXT"$ (%s) God says...\n$$RED$$",verse);
|
||||
DocPrint(doc_out,"$TX,"KingJamesBible",HTML="http://www.templeos.org/files/NumBible.TXT"$ (%s) God says...\n$$RED$$",verse);
|
||||
Free(verse);
|
||||
|
||||
doc_in=DocNew;
|
||||
@@ -308,9 +311,10 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
|
||||
}
|
||||
}
|
||||
|
||||
#define NIST_TIME_OFFSET 21082
|
||||
#define NIST_TIME_OFFSET (-7788-local_time_offset/CDATE_FREQ)
|
||||
#define NIST_TIME_TO_SWITCH 3
|
||||
|
||||
public U0 SyncNIST()
|
||||
public U0 NISTSync()
|
||||
{
|
||||
I64 i,j;
|
||||
CDate d;
|
||||
@@ -330,14 +334,16 @@ U0 InsMyURL()
|
||||
U8 *tag,*st,*st2;
|
||||
CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));
|
||||
url->timestamp=
|
||||
FloorI64((Now-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET,60);
|
||||
switch (PopUpPickLst("NISTBeacon\0WebBible\0YouTube\0Imgur\0Wikipedia\0RandomNumbers.info\0"
|
||||
"Random.org\0VirtualNotary\0Nist\0HotBits\0GenerateData\0WebBookMark\0"
|
||||
FloorI64((Now-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET-
|
||||
NIST_TIME_TO_SWITCH,60);
|
||||
switch (PopUpPickLst("NISTBeacon\0BibleGatewaySearch\0BibleGatewayVerse\0"
|
||||
"YouTube\0Imgur\0Wikipedia\0RandomNumbers.info\0Random.org\0PassWord\0"
|
||||
"VirtualNotary\0Nist\0HotBits\0GenerateData\0WebBookMark\0"
|
||||
"Roulette\0Movie\0")) {
|
||||
case 0:
|
||||
if (DocFormDo(url(CRandHexBeaconForm *))) {
|
||||
if (DocForm(url(CRandHexBeaconForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God.\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag=MStrPrint("https:/beacon.nist.gov/rest/record/%d",url->timestamp);
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
Free(tag);
|
||||
@@ -345,10 +351,11 @@ U0 InsMyURL()
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (DocFormDo(url(CWebBibleForm *))) {
|
||||
if (DocForm(url(CWebBibleForm *))) {
|
||||
tag=url->special;
|
||||
st2=URLPercentSpaces(url->special);
|
||||
st=MStrPrint("http://www.biblegateway.com/passage/?search=%s&version=NIV",st2);
|
||||
st=MStrPrint(
|
||||
"http://www.biblegateway.com/passage/?search=%s&version=NIV",st2);
|
||||
Free(st2);
|
||||
if (*url->tag)
|
||||
tag=url->tag;
|
||||
@@ -357,29 +364,46 @@ U0 InsMyURL()
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (DocFormDo(url(CYouTubeForm *))) {
|
||||
if (url->min || url->sec)
|
||||
st=MStrPrint("%s&hl=enUS&start=%d",url->special,url->min*60+url->sec);
|
||||
else
|
||||
st=StrNew(url->special);
|
||||
"$$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;
|
||||
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 3:
|
||||
if (DocFormDo(url(CImgurForm *))) {
|
||||
"$$HC,\"<img src=\\\"http://i.imgur.com/%s\\\" "
|
||||
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",
|
||||
url->special,url->min,url->sec;
|
||||
if (DocForm(url(CYouTubeForm *))) {
|
||||
if (url->min || url->sec)
|
||||
st=MStrPrint("%s&hl=enUS&start=%d",url->special,url->min*60+url->sec);
|
||||
else
|
||||
st=StrNew(url->special);
|
||||
"$$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);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (DocFormDo(url(CWikipediaForm *))) {
|
||||
if (DocForm(url(CImgurForm *))) {
|
||||
"$$HC,\"<img src=\\\"http://i.imgur.com/%s\\\" "
|
||||
"width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",
|
||||
url->special,url->min,url->sec;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (DocForm(url(CWikipediaForm *))) {
|
||||
tag=url->special;
|
||||
st=MStrPrint("http://en.wikipedia.org/wiki/%s",url->special);
|
||||
if (*url->tag)
|
||||
@@ -388,66 +412,76 @@ U0 InsMyURL()
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (DocFormDo(url(CRandDecForm *))) {
|
||||
case 6:
|
||||
if (DocForm(url(CRandDecForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="http://www.randomnumbers.info";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,10,FALSE,TRUE);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (DocFormDo(url(CRandDecForm *))) {
|
||||
case 7:
|
||||
if (DocForm(url(CRandDecForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="http://www.random.org";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,10,FALSE,FALSE);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (DocFormDo(url(CRandCertForm *))) {
|
||||
case 8:
|
||||
if (DocForm(url(CRandDecForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="https://passed.pw";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,10,FALSE,FALSE);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (DocForm(url(CRandCertForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
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",url->cert);
|
||||
st=MStrPrint("http://www.templeos.org/Certs/virtual-notary-cert"
|
||||
"-randomnum-%d.p12",url->cert);
|
||||
"\n$$TX,\"%Q: %d\",HTML=\"%Q\"$$.\n",tag,url->cert,st;
|
||||
Free(st);
|
||||
MyBibleLines(url->special,20,10,FALSE,FALSE);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if (DocFormDo(url(CRandHexForm *))) {
|
||||
case 10:
|
||||
if (DocForm(url(CRandHexForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="http://qrng.anu.edu.au/NIST.php";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,16,TRUE,TRUE);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (DocFormDo(url(CRandHexForm *))) {
|
||||
case 11:
|
||||
if (DocForm(url(CRandHexForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="https://www.fourmilab.ch/hotbits/secure_generate.html";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,16,TRUE,TRUE);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (DocFormDo(url(CRandDecForm *))) {
|
||||
case 12:
|
||||
if (DocForm(url(CRandDecForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="http://www.generatedata.com";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,10,FALSE,FALSE);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if (DocFormDo(url(CWebBookMarkForm *))) {
|
||||
case 13:
|
||||
if (DocForm(url(CWebBookMarkForm *))) {
|
||||
tag=st=WebBookMarks;
|
||||
if (*url->tag)
|
||||
tag=url->tag;
|
||||
@@ -455,24 +489,26 @@ U0 InsMyURL()
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
if (DocFormDo(url(CRandDecForm *))) {
|
||||
case 14:
|
||||
if (DocForm(url(CRandDecForm *))) {
|
||||
"$$TX,\"Guidelines for Talking with God\","
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="https://www.dublinbet.com/casino_game.html?mode=demo&game=136#gameId=136";
|
||||
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n";
|
||||
tag="https://www.dublinbet.com/casino_game.html"
|
||||
"?mode=demo&game=136#gameId=136";
|
||||
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
|
||||
MyBibleLines(url->special,20,10,FALSE,FALSE);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if (DocFormDo(url(CTopMoviesForm *)) && (st=TopMoviesRead(,url->cert*2))) {
|
||||
case 15:
|
||||
if (DocForm(url(CTopMoviesForm *)) && (st=TopMoviesRead(,url->cert*2))) {
|
||||
StrCpy(url->tag,st);
|
||||
Free(st);
|
||||
if (!(st=TopMoviesRead(,url->cert*2+1))||!*st) {
|
||||
Free(st);
|
||||
if (DocFormDo(url(CTopMoviesYouTubeForm *)) && *url->special) {
|
||||
if (DocForm(url(CTopMoviesYouTubeForm *)) && *url->special) {
|
||||
if (url->min || url->sec)
|
||||
st=MStrPrint("%s&hl=enUS&start=%d",url->special,url->min*60+url->sec);
|
||||
st=MStrPrint("%s&hl=enUS&start=%d",
|
||||
url->special,url->min*60+url->sec);
|
||||
else
|
||||
st=StrNew(url->special);
|
||||
TopMoviesWrite(,url->cert*2+1,st);
|
||||
@@ -480,15 +516,20 @@ U0 InsMyURL()
|
||||
st=NULL;
|
||||
}
|
||||
"God's response:\n"
|
||||
"$$TX,\"Top 100 Movies\",HTML=\"http://www.afi.com/100years/movies10.aspx\"$$\n"
|
||||
"#%s\n",url->tag;
|
||||
"$$TX,\"Top 100 Movies\","
|
||||
"HTML=\"http://www.afi.com/100years/movies10.aspx\"$$\n"
|
||||
"#%s\n",url->tag;
|
||||
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;
|
||||
"$$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);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +540,8 @@ U0 InsMyURL()
|
||||
|
||||
public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512)
|
||||
{//Make God pick a book passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
|
||||
CDirEntry *tempm=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
|
||||
CDirEntry *tempm=FilesFind(files_find_mask,
|
||||
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
|
||||
*tempm1=tempm;
|
||||
I64 i=0;
|
||||
U8 *st,*st2=NULL;
|
||||
@@ -529,5 +571,5 @@ public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512)
|
||||
DirTreeDel(tempm1);
|
||||
}
|
||||
|
||||
|
||||
//GodInit("C:/Home/Wb2/Files/Words/Happy.TXT*");
|
||||
if (FileFind("::/Home/Wb2/Files/Words/HappyWords.TXT"))
|
||||
GodInit("::/Home/Wb2/Files/Words/HappyWords.TXT");
|
||||
@@ -7,7 +7,7 @@ Bool IsDrvVMware(U8 drv_let)
|
||||
U8 *m=NULL;
|
||||
try
|
||||
if ((m=DrvModelNum(drv_let)) &&
|
||||
!MemCmp(m,"VMware",6))
|
||||
!MemCmp(m,"VMware",6))
|
||||
result=TRUE;
|
||||
catch
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -32,8 +32,8 @@ I64 IsDrvATAPI(U8 drv_let)
|
||||
Bool result=FALSE;
|
||||
CBlkDev *bd;
|
||||
try if ((bd=Let2BlkDev(drv_let)) &&
|
||||
bd->type==BDT_ATAPI)
|
||||
result=TRUE;
|
||||
bd->type==BDT_ATAPI)
|
||||
result=TRUE;
|
||||
catch
|
||||
Fs->catch_except=TRUE;
|
||||
return result;
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#define FG_JUST_AUDIO 0
|
||||
#define FG_BOOT_DRV 1
|
||||
#define FG_RAM_DRV 2
|
||||
I64 fg_mode=FG_JUST_AUDIO;
|
||||
I64 fg_mode=FG_RAM_DRV;
|
||||
Bool fg_on =FALSE;
|
||||
|
||||
U0 FrameGrabberTask(I64)
|
||||
{//ffmpeg -r 8 -i VID%05d.BMP -y Movie.avi
|
||||
I64 frame_num=0;
|
||||
U8 buf[136],buf2[136];
|
||||
U8 buf[STR_LEN],buf2[STR_LEN];
|
||||
F64 end_time=tS;
|
||||
Silent; //no output to screen
|
||||
if (fg_mode==FG_RAM_DRV) {
|
||||
@@ -17,7 +17,7 @@ U0 FrameGrabberTask(I64)
|
||||
while (fg_on) {
|
||||
StrPrint(buf,"B:/Temp/ScreenShots/VID%05d.BMP",frame_num++);
|
||||
StrCpy(buf2,buf);
|
||||
BMPCaptureScreen(buf);
|
||||
BMPScreenCapture(buf);
|
||||
while (TRUE) {
|
||||
end_time+=1.0/VIDEO_FRAME_RATE;
|
||||
if (end_time<tS) {
|
||||
@@ -33,7 +33,7 @@ U0 FrameGrabberTask(I64)
|
||||
while (fg_on) {
|
||||
StrPrint(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
|
||||
StrCpy(buf2,buf);
|
||||
BMPCaptureScreen(buf);
|
||||
BMPScreenCapture(buf);
|
||||
while (TRUE) {
|
||||
end_time+=1.0/VIDEO_FRAME_RATE;
|
||||
if (end_time<tS) {
|
||||
@@ -63,7 +63,8 @@ I64 CopyVideo()
|
||||
result=CopyTree("::/Temp/ScreenShots","D:/Temp/ScreenShots");
|
||||
Unzip("D:/Temp/ScreenShots/*.Z");
|
||||
}
|
||||
"$$BK,1$$Files Copied:%d$$BK,0$$ Time:%8.3fm\n",result,result/60.0/VIDEO_FRAME_RATE;
|
||||
"$$BK,1$$Files Copied:%d$$BK,0$$ Time:%8.3fm\n",
|
||||
result,result/60.0/VIDEO_FRAME_RATE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -109,7 +110,8 @@ public U0 ChkAll()
|
||||
public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
|
||||
{
|
||||
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;
|
||||
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));
|
||||
@@ -159,10 +161,10 @@ public U0 BMP2TXT(U8 *_in_name,U8 *_out_name=NULL)
|
||||
CDC *dc;
|
||||
CDoc *doc;
|
||||
in_name=DftExt(_in_name,"BMP"),
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT.Z");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT.Z");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"TXT.Z");
|
||||
out_name=ChgExt(_in_name,"TXT.Z");
|
||||
if (dc=BMPRead(in_name)) {
|
||||
for (dy=-3;dy<=4;dy++)
|
||||
for (dx=-3;dx<=4;dx++) {
|
||||
@@ -186,8 +188,8 @@ U0 DblSpaceScanFile(U8 *filename)
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE &&
|
||||
doc_e->next->type_u8==DOCT_NEW_LINE &&
|
||||
doc_e->next->next->type_u8==DOCT_NEW_LINE) {
|
||||
doc_e->next->type_u8==DOCT_NEW_LINE &&
|
||||
doc_e->next->next->type_u8==DOCT_NEW_LINE) {
|
||||
i=0;
|
||||
while (doc_e->type_u8==DOCT_NEW_LINE) {
|
||||
i++;
|
||||
@@ -227,19 +229,20 @@ public U0 DblSpaceScan(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
DblSpaceScanLst(FilesFind(files_find_mask,f));
|
||||
}
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/TOS",
|
||||
RegSetDftEntry("TempleOS/TOS",
|
||||
"I64 tos_code_walk_thru=1,tos_after_egypt_in_action=1;\n");
|
||||
AcctRegExeBranch("TempleOS/TOS");
|
||||
RegExeBranch("TempleOS/TOS");
|
||||
|
||||
U0 TOSRegInit()
|
||||
{
|
||||
DefinePrint("DD_CODE_WALK_THRU","Episode #%d",tos_code_walk_thru);
|
||||
DefinePrint("DD_AFTER_EGYPT_IN_ACTION","Episode #%d",tos_after_egypt_in_action);
|
||||
DefinePrint("DD_AFTER_EGYPT_IN_ACTION","Episode #%d",
|
||||
tos_after_egypt_in_action);
|
||||
} TOSRegInit;
|
||||
|
||||
U0 TOSRegWrite()
|
||||
{
|
||||
AcctRegWriteBranch("TempleOS/TOS",
|
||||
RegWriteBranch("TempleOS/TOS",
|
||||
"I64 tos_code_walk_thru=%d,tos_after_egypt_in_action=%d;\n",
|
||||
tos_code_walk_thru,tos_after_egypt_in_action);
|
||||
TOSRegInit;
|
||||
@@ -247,21 +250,23 @@ U0 TOSRegWrite()
|
||||
|
||||
class CYouTubeForm2
|
||||
{
|
||||
U8 special[136] fmtstr "$$DA-P,135,A=\"SerialNum:%s\"$$\n";
|
||||
U8 special[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"SerialNum:%s\"$$\n";
|
||||
};
|
||||
|
||||
U8 *TOSYouTube()
|
||||
{
|
||||
U8 *result;
|
||||
CYouTubeForm2 *url=CAlloc(sizeof(CYouTubeForm2));
|
||||
if (DocFormDo(url(CYouTubeForm2 *)) && *url->special)
|
||||
result=MStrPrint("$$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>\"$$",
|
||||
url->special,url->special);
|
||||
if (DocForm(url(CYouTubeForm2 *)) && *url->special)
|
||||
result=MStrPrint("$$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>\"$$",
|
||||
url->special,url->special);
|
||||
else
|
||||
result=NULL;
|
||||
Free(url);
|
||||
@@ -299,3 +304,13 @@ U0 CodeWalkThru()
|
||||
tos_code_walk_thru++;
|
||||
TOSRegWrite;
|
||||
}
|
||||
|
||||
U0 TOSJukeVideo(I64 start=0,I64 end=10)
|
||||
{
|
||||
U8 *buf=FileRead("::/Misc/Bible.TXT.Z"); //Put in cache
|
||||
Free(buf);
|
||||
AutoComplete;
|
||||
FrameGrabberToggle;
|
||||
JukeSongsPuppet("::/Apps/Psalmody/Examples",,start,end);
|
||||
FrameGrabberToggle;
|
||||
}
|
||||
+18
-21
@@ -9,12 +9,11 @@ asm {
|
||||
//Opcodes are slightly different to make writing my x86_64 assembler easier.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
|
||||
IMPORT Beep;
|
||||
|
||||
_BEEPS::
|
||||
//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
|
||||
//See $LK,"REGG_C_CLOBBERED",A="MN:REGG_C_CLOBBERED"$ and $LK,"REGG_C_TEMP_CLOBBERED",A="MN:REGG_C_TEMP_CLOBBERED"$.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HPP,SF_ARG1"$
|
||||
@@ -41,7 +40,7 @@ _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").
|
||||
//Check by unassembling with $LK,"Uf",A="MN:Uf"$("AsmAndC1").
|
||||
|
||||
i=GetI64("Num of beeps 1-5 (%d):",3,1,5);
|
||||
Beeps(i);
|
||||
@@ -49,31 +48,29 @@ I64 AsmAndC1()
|
||||
asm {
|
||||
//You can clobber RAX,RBX,RCX,RDX. The compiler expects that.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
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.
|
||||
|
||||
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
|
||||
@@05: PUSH RCX
|
||||
//U0 $LK,"Snd",A="MN:Snd"$(F64 freq);
|
||||
|
||||
MOV RAX,RCX //freq=loop*100.0+100.0
|
||||
IMUL2 RAX,100 //TempleOS uses nonstandard opcodes
|
||||
//to avoid multiple form of the same one.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
ADD RAX,100
|
||||
PUSH RAX
|
||||
FILD U64 [RSP] //Convert from int to floating
|
||||
FSTP U64 [RSP]
|
||||
MOV RAX,RCX //freq=loop*100.0+100.0
|
||||
IMUL2 RAX,100 //TempleOS uses nonstandard opcodes
|
||||
//to avoid multiple form of the same one.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
ADD RAX,100
|
||||
PUSH RAX
|
||||
FILD U64 [RSP] //Convert from int to floating
|
||||
FSTP U64 [RSP]
|
||||
|
||||
CALL Snd
|
||||
CALL Snd
|
||||
|
||||
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
|
||||
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
|
||||
@@10: LOOP @@10
|
||||
|
||||
POP RCX
|
||||
LOOP @@05
|
||||
POP RCX
|
||||
LOOP @@05
|
||||
}
|
||||
Snd(0);
|
||||
return i;
|
||||
|
||||
+15
-18
@@ -13,14 +13,13 @@ asm {
|
||||
//Opcodes are slightly different to make writing my x86_64 assembler easier.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
|
||||
JIFFIES_MSG: DU8 "Jiffies:",0;
|
||||
|
||||
//See $LK,"::/Kernel/StrA.CPP",A="FL:::/Kernel/StrA.CPP,1"$ and $LK,"::/Kernel/KUtils.CPP"$.
|
||||
|
||||
_BEEPS2::
|
||||
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
|
||||
//See $LK,"REGG_C_CLOBBERED",A="MN:REGG_C_CLOBBERED"$ and $LK,"REGG_C_TEMP_CLOBBERED",A="MN:REGG_C_TEMP_CLOBBERED"$.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HPP,SF_ARG1"$
|
||||
@@ -35,7 +34,7 @@ _BEEPS2::
|
||||
POP RCX
|
||||
LOOP @@05
|
||||
|
||||
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
|
||||
PUSH RSI //See $LK,"REGG_C_LOCAL_VARS",A="MN:REGG_C_LOCAL_VARS"$ & $LK,"REGG_C_LOCAL_NON_PTR_VARS",A="MN:REGG_C_LOCAL_NON_PTR_VARS"$
|
||||
MOV RSI,JIFFIES_MSG
|
||||
CALL PUT_STR
|
||||
POP RSI
|
||||
@@ -63,30 +62,28 @@ U0 AsmAndC2()
|
||||
Beeps2(i);
|
||||
|
||||
asm {
|
||||
LIST
|
||||
LIST
|
||||
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX. Preserve the rest.
|
||||
|
||||
MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX. Preserve the rest.
|
||||
|
||||
@@05: PUSH RCX
|
||||
@@05: PUSH RCX
|
||||
//U0 $LK,"Snd",A="MN:Snd"$(F64 freq);
|
||||
|
||||
MOV RAX,RCX //freq=loop*100.0+100.0
|
||||
IMUL2 RAX,glbl_hz_step //evaluated at compile ttime
|
||||
ADD RAX,U64 [&glbl_hz_base] //evaluated at run time
|
||||
PUSH RAX
|
||||
FILD U64 [RSP] //Convert from int to floating
|
||||
FSTP U64 [RSP]
|
||||
MOV RAX,RCX //freq=loop*100.0+100.0
|
||||
IMUL2 RAX,glbl_hz_step //evaluated at compile ttime
|
||||
ADD RAX,U64 [&glbl_hz_base] //evaluated at run time
|
||||
PUSH RAX
|
||||
FILD U64 [RSP] //Convert from int to floating
|
||||
FSTP U64 [RSP]
|
||||
|
||||
CALL &Snd //We can skip IMPORT with & if JIT compiling.
|
||||
CALL &Snd //We can skip IMPORT with & if JIT compiling.
|
||||
|
||||
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
|
||||
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
|
||||
@@10: LOOP @@10
|
||||
|
||||
POP RCX
|
||||
LOOP @@05
|
||||
POP RCX
|
||||
LOOP @@05
|
||||
}
|
||||
Snd(0);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ 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.
|
||||
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';
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ asm {
|
||||
//Opcodes are slightly different to make writing my x86_64 assembler easier.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
|
||||
MY_WORLD_MSG:
|
||||
//Define U8 does not put terminating zeros
|
||||
//on strings.
|
||||
@@ -33,7 +31,7 @@ MY_WORLD_MSG:
|
||||
//My convention is to put an underscore
|
||||
//on C callable asm routines.
|
||||
_HELLO_WORLD::
|
||||
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
|
||||
PUSH RSI //See $LK,"REGG_C_LOCAL_VARS",A="MN:REGG_C_LOCAL_VARS"$ & $LK,"REGG_C_LOCAL_NON_PTR_VARS",A="MN:REGG_C_LOCAL_NON_PTR_VARS"$
|
||||
MOV RCX,10
|
||||
@@05: MOV RAX,RCX
|
||||
CALL PUT_HEX_U8
|
||||
|
||||
@@ -8,7 +8,7 @@ asm {
|
||||
_BUZZ_FIZZ::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP //Always set-up stk frame. (Stack Gets Traced)
|
||||
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
|
||||
PUSH RSI //See $LK,"REGG_C_LOCAL_VARS",A="MN:REGG_C_LOCAL_VARS"$ & $LK,"REGG_C_LOCAL_NON_PTR_VARS",A="MN:REGG_C_LOCAL_NON_PTR_VARS"$
|
||||
PUSH RDI
|
||||
MOV RSI,FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1
|
||||
MOV RDI,BUZZ_SPAN-RANGE_START%BUZZ_SPAN+1
|
||||
|
||||
@@ -7,8 +7,6 @@ asm {
|
||||
//Opcodes are slightly different to make writing my x86_64 assembler easier.
|
||||
//See $LK,"::/Compiler/OpCodes.TXT"$.
|
||||
|
||||
USE64 //Defaults to 64, but this is a good habit.
|
||||
|
||||
//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.
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ PUT_DEC_U64::
|
||||
//but this function will be nice for ASM callers if it saves all regs.
|
||||
PUSH_C_REGS
|
||||
|
||||
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
|
||||
PUSH RSI //See $LK,"REGG_C_LOCAL_VARS",A="MN:REGG_C_LOCAL_VARS"$&$LK,"REGG_C_LOCAL_NON_PTR_VARS",A="MN:REGG_C_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
|
||||
@@ -38,7 +38,7 @@ PUT_DEC_U64::
|
||||
LEAVE
|
||||
RET
|
||||
|
||||
_DO_IT:: //The convention is C-callable routines have underscores.
|
||||
_DO_IT:: //The convention is C-callable routines have underscores.
|
||||
MOV RAX,122333221
|
||||
CALL PUT_DEC_U64
|
||||
MOV RAX,'\n'
|
||||
|
||||
+5
-5
@@ -40,21 +40,21 @@ U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
|
||||
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"$().
|
||||
//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.
|
||||
//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.
|
||||
//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.
|
||||
//$LK,"MemberMetaFind",A="MN:MemberMetaFind"$() and save a search.
|
||||
percentile=MemberMetaData("percentile",ml)(F64);
|
||||
" percentile: %5.2f",percentile;
|
||||
}
|
||||
|
||||
+11
-11
@@ -3,24 +3,24 @@ F64 glbl;
|
||||
F64 CompileDemo(U8 *st)
|
||||
{
|
||||
I64 type;
|
||||
U8 *ex;
|
||||
CLex *lx=LexNew(st,LF_DONT_FREE_BUF);
|
||||
U8 *machine_code;
|
||||
CCmpCtrl *cc=CmpCtrlNew(st,CCF_DONT_FREE_BUF);
|
||||
F64 result=0;
|
||||
Lex(lx); //Gotta get it started
|
||||
Lex(cc); //Gotta get it started
|
||||
"Compile \"%s\"\n",st;
|
||||
do {
|
||||
if (ex=LexExpression2Bin(lx,&type)) {
|
||||
if (machine_code=LexExpression2Bin(cc,&type)) {
|
||||
if (type!=RT_F64)
|
||||
result=ToF64(Call(ex));
|
||||
result=ToF64(Call(machine_code));
|
||||
else
|
||||
result=Call(ex)(F64);
|
||||
Free(ex);
|
||||
result=Call(machine_code)(F64);
|
||||
Free(machine_code);
|
||||
}
|
||||
"result=%9.4f\n",result;
|
||||
if (lx->token==';')
|
||||
Lex(lx);
|
||||
} while (lx->token!=TK_EOF); //end of file?
|
||||
LexDel(lx);
|
||||
if (cc->token==';')
|
||||
Lex(cc);
|
||||
} while (cc->token!=TK_EOF); //end of file?
|
||||
CmpCtrlDel(cc);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -1,8 +1,8 @@
|
||||
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.
|
||||
//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!!
|
||||
@@ -30,18 +30,18 @@ U0 DoIt()
|
||||
doc_e=DocPrint(bdoc,"$$TX+TC,\" \"$$");
|
||||
//The TC flag is "has tag callback".
|
||||
|
||||
//Flags are explained here:
|
||||
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
|
||||
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS"$
|
||||
//Flags are explained here:
|
||||
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
|
||||
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,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.
|
||||
//$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$$");
|
||||
@@ -50,9 +50,9 @@ U0 DoIt()
|
||||
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.
|
||||
//Send carriage return, new line, so
|
||||
//that the timer string is not part
|
||||
//of the next cmd on the cmd line.
|
||||
'\n';
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ U0 ClickCallBack()
|
||||
doc_e=DocPrint(DocPut,"\n$$MA+LC,\"Click Me\"$$ ");
|
||||
//The LC flag is "has left callback".
|
||||
|
||||
//Flags are explained here:
|
||||
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
|
||||
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS"$
|
||||
//Flags are explained here:
|
||||
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
|
||||
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS"$
|
||||
"(Not preserved when <CTRL-t> and back.)\n\n";
|
||||
doc_e->left_cb=&MyLeftCB1;
|
||||
DocUnlock(DocPut);
|
||||
|
||||
@@ -8,9 +8,9 @@ U0 CursorMovementDemo()
|
||||
"$$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.
|
||||
//+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";
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -29,24 +29,24 @@ U0 DataDemo()
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
|
||||
//This is the command line document.
|
||||
//This is the command line document.
|
||||
CDoc *doc=DocPut;
|
||||
|
||||
//We do this to prevent access to
|
||||
//doc_e->data before it is set.
|
||||
//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.
|
||||
//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.
|
||||
"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,32,RT=I16,A=\"%%7d\"$$\n");
|
||||
doc_e->data=&i;
|
||||
|
||||
|
||||
+25
-13
@@ -1,15 +1,15 @@
|
||||
public U0 DocProfile(U8 *filename,I64 flags)
|
||||
{
|
||||
I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_NUM_TYPES),
|
||||
*flags_stats=CAlloc(sizeof(I64)*64),
|
||||
*type_flags_stats=CAlloc(sizeof(I64)*64);
|
||||
*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"$().
|
||||
//doc->win_task when a $LK,"CDoc",A="MN:CDoc"$ is recalculated
|
||||
//use $LK,"DocRecalc",A="MN:DocRecalc"$().
|
||||
CDoc *doc=DocRead(filename,flags);
|
||||
|
||||
//doc->root which is equal to doc is the
|
||||
//header of the CQue and represents the end-of-file marker.
|
||||
//doc->root which is equal to doc is the
|
||||
//header of the CQue and represents the end-of-file marker.
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
cmd_stats[doc_e->type_u8]++;
|
||||
@@ -24,23 +24,35 @@ public U0 DocProfile(U8 *filename,I64 flags)
|
||||
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.CPP,ST_DOC_CMDS\"$$.\n$$FG$$";
|
||||
"$$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.CPP,ST_DOC_CMDS\"$$.\n"
|
||||
"$$FG$$";
|
||||
for (i=0;i<DOCT_NUM_TYPES;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 screen 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$$";
|
||||
"\n$$GREEN$$'$$PURPLE$$doc_e->type.u8[1]$$GREEN$$' is "
|
||||
"the screen 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.CPP,ST_DOC_FLAGS\"$$.\n$$FG$$";
|
||||
"See $$LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$$ and "
|
||||
"$$LK,\"Doc Flag Codes\","
|
||||
"A=\"FF:::/Adam/DolDoc/DocInit.CPP,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];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class FDStruct
|
||||
{//Use <CTRL-l> and select "Data" to generate the fmtstrs
|
||||
|
||||
//The number is the field from after the ':' to the end.
|
||||
//See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.CPP,DataTagWidth"$.
|
||||
//The number is the field from after the ':' to the end.
|
||||
//See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.CPP,DataTagWidth"$.
|
||||
|
||||
F64 num1 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 1:%12.8f\"$$\n";
|
||||
F64 num2 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 2:%12e\"$$\n";
|
||||
@@ -26,7 +26,7 @@ U0 FormDemo()
|
||||
StrCpy(&fds.name,"John");
|
||||
fds.datetime=Now;
|
||||
fds.check=TRUE;
|
||||
if (DocFormDo(&fds)) {
|
||||
if (DocForm(&fds)) {
|
||||
"#1\t=%e\n",fds.num1;
|
||||
"#2\t=%e\n",fds.num2;
|
||||
"#3\t=%d\n",fds.num3;
|
||||
@@ -41,7 +41,7 @@ U0 FormDemo()
|
||||
"\n\nClassRep Example\n";
|
||||
ClassRep(&fds);
|
||||
|
||||
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
|
||||
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
|
||||
}
|
||||
|
||||
FormDemo;
|
||||
@@ -40,9 +40,9 @@ U0 MenuButton()
|
||||
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=DocMenuDo(DocPut);
|
||||
"\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:
|
||||
@@ -67,7 +67,7 @@ U0 MenuButton()
|
||||
}
|
||||
} while (!done);
|
||||
DocPut->flags=DocPut->flags&~DOCF_FORM |
|
||||
old_flags & DOCF_FORM;
|
||||
old_flags & DOCF_FORM;
|
||||
DocClear;
|
||||
Snd(0);
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
// This makes a new Bible file
|
||||
//with line numbers.
|
||||
|
||||
U0 NumBible()
|
||||
{
|
||||
CDoc *doc_in=DocRead("::/Misc/Bible.TXT.Z",DOCF_PLAIN_TEXT_WITH_TABS),
|
||||
*doc_out=DocNew("::/Home/NumBible.TXT.Z");
|
||||
CDocEntry *doc_e=doc_in->root.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;
|
||||
}
|
||||
DocWrite(doc_out);
|
||||
DocDel(doc_out);
|
||||
DocDel(doc_in);
|
||||
}
|
||||
|
||||
NumBible;
|
||||
@@ -20,7 +20,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
DocPrint(doc,"$$TR,\"\"$$");
|
||||
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
tempde->name,tempde->full_name);
|
||||
if (tempde->sub) {
|
||||
DocPrint(doc,"$$ID,+2$$");
|
||||
TreeSub(doc,tempde->sub);
|
||||
@@ -28,10 +28,10 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
}
|
||||
} else
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
//Note there is also a routine
|
||||
//to delete an entire CDirEntry tree.
|
||||
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
|
||||
tempde->name,tempde->full_name);
|
||||
//Note there is also a routine
|
||||
//to delete an entire CDirEntry tree.
|
||||
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ U0 BlkDevRep()
|
||||
for (i=0;i<NUM_BLKDEVS;i++)
|
||||
if (dsk.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
|
||||
ClassRep(&dsk.blkdevs[i]);//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
|
||||
//The lastclass arg tells ClassRep the datatype.
|
||||
//lastclass is a language feature of $LK,"HolyC",A="FI:::/Doc/HolyC.TXT"$.
|
||||
//See $LK,"::/Demo/LastClass.CPP"$.
|
||||
//The lastclass arg tells ClassRep the datatype.
|
||||
//lastclass is a language feature of $LK,"HolyC",A="FI:::/Doc/HolyC.TXT"$.
|
||||
//See $LK,"::/Demo/LastClass.CPP"$.
|
||||
}
|
||||
|
||||
BlkDevRep;
|
||||
@@ -24,7 +24,7 @@ U0 WriteAcct()
|
||||
acctnum=GetI64("Acct #",-1);
|
||||
if (0<=acctnum<DB_MAX_ACCT) {
|
||||
MemSet(&a,0,BLK_SIZE);
|
||||
if (DocFormDo(&a)) {
|
||||
if (DocForm(&a)) {
|
||||
f=FOpen(DB_FILENAME,"w+");
|
||||
FWBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
|
||||
FClose(f);
|
||||
|
||||
@@ -12,7 +12,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
DocPrint(doc,"$$TR,\"\"$$");
|
||||
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
tempde->name,tempde->full_name);
|
||||
if (tempde->sub) {
|
||||
DocPrint(doc,"$$ID,+2$$");
|
||||
TreeSub(doc,tempde->sub);
|
||||
@@ -20,10 +20,10 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
}
|
||||
} else
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
//Note there is also a routine
|
||||
//to delete an entire CDirEntry tree.
|
||||
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
|
||||
tempde->name,tempde->full_name);
|
||||
//Note there is also a routine
|
||||
//to delete an entire CDirEntry tree.
|
||||
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ U0 SerializeTree()
|
||||
CDirEntry *tempde=FilesFind("/Demo/*.TXT*",FUF_RECURSE);
|
||||
I64 size;
|
||||
U8 *ptr;
|
||||
CArcCompress *ac;
|
||||
CArcCompress *arc;
|
||||
|
||||
LineRep1(tempde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
|
||||
LineRep2(DocPut,tempde);
|
||||
@@ -18,13 +18,13 @@ U0 SerializeTree()
|
||||
DirTreeDel(tempde);
|
||||
D(ptr,size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
ac=CompressBuf(ptr,size);
|
||||
arc=CompressBuf(ptr,size);
|
||||
Free(ptr);
|
||||
D(ac,ac->compressed_size);
|
||||
D(arc,arc->compressed_size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
ptr=ExpandBuf(ac);
|
||||
size=ac->expanded_size;
|
||||
Free(ac);
|
||||
ptr=ExpandBuf(arc);
|
||||
size=arc->expanded_size;
|
||||
Free(arc);
|
||||
D(ptr,size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
tempde=DirTreeUnserialize(ptr);
|
||||
|
||||
@@ -7,7 +7,7 @@ U0 UnusedSpaceRep()
|
||||
dv=Let2Drv(i+'A');
|
||||
if (dv->type==DVT_FAT32 || dv->type==DVT_REDSEA)
|
||||
"%C: %7.3f%% Free\n",
|
||||
Drv2Let(dv),UnusedDrvSpace(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE);
|
||||
Drv2Let(dv),UnusedDrvSpace(Drv2Let(dv))*100.0/(dv->size*BLK_SIZE);
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ U0 D2()
|
||||
if (Prompt(4)) throw('Point4');
|
||||
} catch {
|
||||
"D2 handler\n"
|
||||
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
|
||||
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
|
||||
if (Fs->except_ch=='Point1') {
|
||||
"Caught in D2\n";
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -39,7 +39,7 @@ U0 Demo()
|
||||
if (Prompt(3)) throw('Point3');
|
||||
} catch {
|
||||
"Demo handler\n"
|
||||
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
|
||||
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ SrcExample;
|
||||
//See $LK,"::/Demo/ScreenCodes.CPP"$, $LK,"::/Demo/Graphics/CharGraphics.CPP"$,
|
||||
//and $LK,"::/Demo/Graphics/FontEd.CPP"$.
|
||||
|
||||
//See $LK,"chars_bitmap_alpha",A="MN:chars_bitmap_alpha"$ and $LK,"chars_bitmap_alpha_numeric",A="MN:chars_bitmap_alpha_numeric"$.
|
||||
//See $LK,"chars_bmp_alpha",A="MN:chars_bmp_alpha"$ and $LK,"chars_bmp_alpha_numeric",A="MN:chars_bmp_alpha_numeric"$.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
|
||||
AcctRegExeBranch("TempleOS/CastleFrankenstein");
|
||||
RegSetDftEntry("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/CastleFrankenstein");
|
||||
|
||||
//Set snap to 4 and width to 4
|
||||
//if you edit this map.
|
||||
@@ -109,7 +109,7 @@ class Monster
|
||||
U0 CFTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
{
|
||||
I64 zz;
|
||||
GrRot(dc->r,x,y,z);
|
||||
Mat4x4MulXYZ(dc->r,x,y,z);
|
||||
zz=SCREEN_SCALE/3+*z;
|
||||
if (zz<1) zz=1;
|
||||
*x=SCREEN_SCALE/2* *x/zz;
|
||||
@@ -132,37 +132,38 @@ Bool LOSPlot(U8 *,I64 x,I64 y,I64)
|
||||
Bool LOS(I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{//Line of sight
|
||||
return Line(NULL,x1*LOS_SCALE/SCREEN_SCALE,y1*LOS_SCALE/SCREEN_SCALE,0,
|
||||
x2*LOS_SCALE/SCREEN_SCALE,y2*LOS_SCALE/SCREEN_SCALE,0,&LOSPlot);
|
||||
x2*LOS_SCALE/SCREEN_SCALE,y2*LOS_SCALE/SCREEN_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;
|
||||
c,x1w,y1w,x1h,y1h,xh,yh,zh,
|
||||
cx=task->pix_width/2,
|
||||
cy=task->pix_height/2;
|
||||
CSprite *temps;
|
||||
F64 tt;
|
||||
CD3I32 poly[4];
|
||||
Monster *tempm;
|
||||
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
MemSet(panels_processed_bitmap,0,(map_width*map_height+7)>>3);
|
||||
|
||||
//World to screen
|
||||
GrRotZEqu(dc->r,man_é+ã/2);
|
||||
GrRotXEqu(dc->r,ã/2);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4RotZ(dc->r,man_é+ã/2);
|
||||
Mat4x4RotX(dc->r,ã/2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
xh=-man_xx/SCREEN_SCALE; yh=-man_yy/SCREEN_SCALE; zh=0;
|
||||
GrRot(dc->r,&xh,&yh,&zh);
|
||||
GrSetTranslation(dc->r,xh,yh,zh);
|
||||
Mat4x4MulXYZ(dc->r,&xh,&yh,&zh);
|
||||
Mat4x4TranslationEqu(dc->r,xh,yh,zh);
|
||||
|
||||
//Screen to world
|
||||
s2w=GrRotXNew(-ã/2,task);
|
||||
GrRotZEqu(s2w,-man_é-ã/2);
|
||||
s2w=Mat4x4IdentNew(task);
|
||||
Mat4x4RotX(s2w,-ã/2);
|
||||
Mat4x4RotZ(s2w,-man_é-ã/2);
|
||||
xh=0; yh=0; zh=SCREEN_SCALE;
|
||||
GrRot(s2w,&xh,&yh,&zh);
|
||||
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
|
||||
|
||||
//Rotate light source
|
||||
xx=dc->ls.x; yy=dc->ls.y; zz=-dc->ls.z;
|
||||
@@ -173,15 +174,17 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->transform=&CFTransform;
|
||||
dc->x=cx;
|
||||
dc->y=cy;
|
||||
r1=GrRotXNew(-ã/2,task);
|
||||
GrRotZEqu(r1,tS);
|
||||
GrScaleEqu(r1,MONSTER_SCALE);
|
||||
r1=Mat4x4IdentNew(task);
|
||||
Mat4x4RotX(r1,-ã/2);
|
||||
Mat4x4RotZ(r1,tS);
|
||||
Mat4x4Scale(r1,MONSTER_SCALE);
|
||||
|
||||
r2=GrIdentNew(task);
|
||||
GrScaleEqu(r2,MONSTER_SCALE);
|
||||
r2=Mat4x4IdentNew(task);
|
||||
Mat4x4Scale(r2,MONSTER_SCALE);
|
||||
|
||||
r3=GrRotXNew(-ã/2,task);
|
||||
GrScaleEqu(r3,PLANT_SCALE);
|
||||
r3=Mat4x4IdentNew(task);
|
||||
Mat4x4RotX(r3,-ã/2);
|
||||
Mat4x4Scale(r3,PLANT_SCALE);
|
||||
|
||||
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);
|
||||
@@ -193,10 +196,10 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
xx=x1w/SCREEN_SCALE; yy=y1w/SCREEN_SCALE;
|
||||
x=xx*SCREEN_SCALE-man_xx; y=yy*SCREEN_SCALE-man_yy;
|
||||
if (1<=xx<map_width-1 && 1<=yy<map_height-1 &&
|
||||
!LBts(panels_processed_bitmap,yy*map_width+xx)) {
|
||||
!LBts(panels_processed_bitmap,yy*map_width+xx)) {
|
||||
if ((c=map[yy*map_width+xx]) &&
|
||||
LOS(xx*SCREEN_SCALE+SCREEN_SCALE/2,yy*SCREEN_SCALE+SCREEN_SCALE/2,
|
||||
man_xx,man_yy)) {
|
||||
LOS(xx*SCREEN_SCALE+SCREEN_SCALE/2,yy*SCREEN_SCALE+SCREEN_SCALE/2,
|
||||
man_xx,man_yy)) {
|
||||
if (c==YELLOW)
|
||||
dc->color=DKGRAY;
|
||||
else
|
||||
@@ -218,14 +221,14 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
x1=x+SCREEN_SCALE/2;
|
||||
y1=y+SCREEN_SCALE/2;
|
||||
z1=0;
|
||||
GrTransform(dc,&x1,&y1,&z1);
|
||||
DCTransform(dc,&x1,&y1,&z1);
|
||||
if (z1>0)
|
||||
SpriteMat3B(dc,x+SCREEN_SCALE/2,y+SCREEN_SCALE/2,0,$IB,"<5>",BI=5$,r3);
|
||||
} else if (c==YELLOW) {
|
||||
x1=x+SCREEN_SCALE/2;
|
||||
y1=y+SCREEN_SCALE/2;
|
||||
z1=0;
|
||||
GrTransform(dc,&x1,&y1,&z1);
|
||||
DCTransform(dc,&x1,&y1,&z1);
|
||||
if (z1>0)
|
||||
SpriteMat3B(dc,x+SCREEN_SCALE/2,y+SCREEN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
|
||||
}
|
||||
@@ -313,7 +316,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
xx=x;
|
||||
yy=y;
|
||||
zz=0;
|
||||
GrTransform(dc,&xx,&yy,&zz);
|
||||
DCTransform(dc,&xx,&yy,&zz);
|
||||
if (zz>0) {
|
||||
if (tempm->dead)
|
||||
SpriteMat3B(dc,x,y,0,$IB,"<2>",BI=2$,r2);
|
||||
@@ -332,11 +335,11 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
//Draw Map heads-up display, scaled 2 pixs
|
||||
Free(dc->r);
|
||||
GrSetRotMat(dc,GrIdentNew(task));
|
||||
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=&GrTransform;
|
||||
dc->transform=&DCTransform;
|
||||
dc->pen_width=2;
|
||||
for (i=0;i<map_height;i++)
|
||||
for (j=0;j<map_width;j++) {
|
||||
@@ -345,10 +348,11 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
|
||||
//Draw Things on heads-up Map
|
||||
dc->color=LTPURPLE;
|
||||
dc->color=LTPURPLE;
|
||||
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++)
|
||||
if (!tempm->dead)
|
||||
GrPlot3(dc,2*(tempm->x/SCREEN_SCALE),2*(map_height-1-tempm->y/SCREEN_SCALE),0);
|
||||
GrPlot3(dc,2*(tempm->x/SCREEN_SCALE),
|
||||
2*(map_height-1-tempm->y/SCREEN_SCALE),0);
|
||||
dc->color=LTCYAN;
|
||||
GrPlot3(dc,2*(man_xx/SCREEN_SCALE),2*(map_height-1-man_yy/SCREEN_SCALE),0);
|
||||
|
||||
@@ -363,7 +367,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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);
|
||||
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",
|
||||
monsters_left,tt-t0,best_score);
|
||||
Free(s2w);
|
||||
}
|
||||
|
||||
@@ -378,7 +383,7 @@ U0 Fire()
|
||||
x=tempm->x;
|
||||
y=tempm->y;
|
||||
if (!tempm->dead &&
|
||||
LOS(x,y,man_xx,man_yy)) {
|
||||
LOS(x,y,man_xx,man_yy)) {
|
||||
dx=x-man_xx;
|
||||
dy=man_yy-y;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
@@ -449,17 +454,17 @@ U0 AnimateTask(I64)
|
||||
else
|
||||
y+=dd;
|
||||
if (0<=x<=map_width*SCREEN_SCALE &&
|
||||
0<=y<=map_height*SCREEN_SCALE &&
|
||||
map[(y/SCREEN_SCALE)*map_width+x/SCREEN_SCALE]) {
|
||||
0<=y<=map_height*SCREEN_SCALE &&
|
||||
map[(y/SCREEN_SCALE)*map_width+x/SCREEN_SCALE]) {
|
||||
if (!map[(y/SCREEN_SCALE)*map_width+x/SCREEN_SCALE+1] &&
|
||||
x-RoundI64(x,SCREEN_SCALE)>SCREEN_SCALE/2 ||
|
||||
!map[(y/SCREEN_SCALE)*map_width+x/SCREEN_SCALE-1] &&
|
||||
x-RoundI64(x,SCREEN_SCALE)<SCREEN_SCALE/2)
|
||||
x-RoundI64(x,SCREEN_SCALE)>SCREEN_SCALE/2 ||
|
||||
!map[(y/SCREEN_SCALE)*map_width+x/SCREEN_SCALE-1] &&
|
||||
x-RoundI64(x,SCREEN_SCALE)<SCREEN_SCALE/2)
|
||||
x=RoundI64(x,SCREEN_SCALE)+SCREEN_SCALE/2;
|
||||
if (!map[(y/SCREEN_SCALE+1)*map_width+x/SCREEN_SCALE] &&
|
||||
y-RoundI64(y,SCREEN_SCALE)>SCREEN_SCALE/2 ||
|
||||
!map[(y/SCREEN_SCALE-1)*map_width+x/SCREEN_SCALE] &&
|
||||
y-RoundI64(y,SCREEN_SCALE)<SCREEN_SCALE/2)
|
||||
y-RoundI64(y,SCREEN_SCALE)>SCREEN_SCALE/2 ||
|
||||
!map[(y/SCREEN_SCALE-1)*map_width+x/SCREEN_SCALE] &&
|
||||
y-RoundI64(y,SCREEN_SCALE)<SCREEN_SCALE/2)
|
||||
y=RoundI64(y,SCREEN_SCALE)+SCREEN_SCALE/2;
|
||||
tempm->x=x;
|
||||
tempm->y=y;
|
||||
@@ -482,9 +487,9 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("2q.A#1eG2AeA#qAq.A#1eG2eAeA#qA");
|
||||
Play("q.A#1eG2A#A1qG2q.A#1eG2A#A1qG");
|
||||
Play("3eA#A2qG3eA#A2qG3eA#A2G3AA#A2qG");
|
||||
Play("2q.A#1eG2AeA#qAq.A#1eG2eAeA#qA");
|
||||
Play("q.A#1eG2A#A1qG2q.A#1eG2A#A1qG");
|
||||
Play("3eA#A2qG3eA#A2qG3eA#A2G3AA#A2qG");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,23 +525,23 @@ 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);"
|
||||
"}"
|
||||
);
|
||||
"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;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
@@ -583,7 +588,8 @@ fs_done:
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
MenuPop;
|
||||
AcctRegWriteBranch("TempleOS/CastleFrankenstein","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/CastleFrankenstein","F64 best_score=%5.4f;\n",
|
||||
best_score);
|
||||
}
|
||||
|
||||
CastleFrankenstein;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
//Giotto, a famous artist, drew a freehand circle as a portfolio for a job.
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/CircleTrace","F64 best_score=999;\n");
|
||||
AcctRegExeBranch("TempleOS/CircleTrace");
|
||||
RegSetDftEntry("TempleOS/CircleTrace","F64 best_score=999;\n");
|
||||
RegExeBranch("TempleOS/CircleTrace");
|
||||
|
||||
I64 cx,cy;
|
||||
F64 avg_error=0,elapsed_time=0,total_error=0,score=999;
|
||||
@@ -18,7 +18,8 @@ U0 SongTask(I64)
|
||||
|
||||
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);
|
||||
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
|
||||
@@ -55,7 +56,7 @@ U0 CircleTrace()
|
||||
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN);
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_UP:
|
||||
break;
|
||||
@@ -70,7 +71,7 @@ U0 CircleTrace()
|
||||
x1=a1; y1=a2;
|
||||
do {
|
||||
msg_code=ScanMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_UP:
|
||||
break;
|
||||
@@ -79,7 +80,7 @@ U0 CircleTrace()
|
||||
total_distance+=Sqrt(Sqr(x1-a1)+Sqr(y1-a2));
|
||||
Line(dc,x1,y1,0,a1,a2,0,&CTPlot);
|
||||
x1=a1;y1=a2;
|
||||
//undo overlapping pixs on segments
|
||||
//undo overlapping pixs on segments
|
||||
GrPlot(dc,x1,y1);
|
||||
rad=Sqrt(Sqr(x1-cx)+Sqr(y1-cy));
|
||||
total_error-=Abs(rad-CIRCLE_RADIUS);
|
||||
@@ -109,7 +110,7 @@ U0 CircleTrace()
|
||||
Snd(500);Sleep(50);
|
||||
}
|
||||
} else {
|
||||
Snd(100);Sleep(1000);
|
||||
Snd(100);Sleep(1000);
|
||||
}
|
||||
Snd(0); Sleep(200); music.mute=FALSE;
|
||||
break;
|
||||
@@ -119,7 +120,7 @@ U0 CircleTrace()
|
||||
SettingsPop;
|
||||
DCFill;
|
||||
DCDel(dc);
|
||||
AcctRegWriteBranch("TempleOS/CircleTrace","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/CircleTrace","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
CircleTrace; //Execute when #included
|
||||
Binary file not shown.
Binary file not shown.
@@ -28,12 +28,12 @@ U0 Digits()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->text_attr=DKGRAY<<4+WHITE;
|
||||
DocClear;
|
||||
//Set default background and foreground
|
||||
//Set default background and foreground
|
||||
"$$WW,1$$$$BD,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";
|
||||
"\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
|
||||
@@ -42,7 +42,7 @@ U0 Digits()
|
||||
while (TRUE) {
|
||||
restart:
|
||||
num=0;
|
||||
//Set to zeros so we have terminators
|
||||
//Set to zeros so we have terminators
|
||||
MemSet(answer,0,sizeof(answer));
|
||||
while (TRUE) {
|
||||
DocClear;
|
||||
|
||||
+67
-68
@@ -1,5 +1,5 @@
|
||||
AcctRegSetDftEntry("TempleOS/DunGen","F64 best_score=9999;\n");
|
||||
AcctRegExeBranch("TempleOS/DunGen");
|
||||
RegSetDftEntry("TempleOS/DunGen","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/DunGen");
|
||||
|
||||
//Set snap to 4 and width to 4
|
||||
//if you edit this map.
|
||||
@@ -43,17 +43,11 @@ $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 *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};
|
||||
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 SCREEN_SCALE 24
|
||||
#define SCREEN_WIDTH 24
|
||||
@@ -91,7 +85,7 @@ Bool LOSPlot(U8 *,I64 x,I64 y,I64)
|
||||
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);
|
||||
x2*LOS_SCALE+LOS_SCALE/2,y2*LOS_SCALE+LOS_SCALE/2,0,&LOSPlot);
|
||||
}
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
@@ -110,9 +104,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
_tiles=tiles2;
|
||||
|
||||
GrRotXEqu(dc_t->r,60*2*ã/360);
|
||||
GrRotZEqu(dc_t->r,15*2*ã/360);
|
||||
GrSetRotMat(dc_t,dc_t->r);
|
||||
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;
|
||||
@@ -133,7 +127,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
x1=x*SCREEN_SCALE;
|
||||
y1=y*SCREEN_SCALE;
|
||||
z1=0;
|
||||
GrTransform(dc_t,&x1,&y1,&z1);
|
||||
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*SCREEN_SCALE;
|
||||
@@ -167,14 +161,14 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
x1=x*SCREEN_SCALE;
|
||||
y1=y*SCREEN_SCALE;
|
||||
z1=0;
|
||||
GrTransform(dc_t,&x1,&y1,&z1);
|
||||
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*SCREEN_SCALE;
|
||||
y1=y*SCREEN_SCALE;
|
||||
z1=0;
|
||||
GrTransform(dc_t,&x1,&y1,&z1);
|
||||
DCTransform(dc_t,&x1,&y1,&z1);
|
||||
Sprite3(dc,x1,y1,z1,$IB,"<10>",BI=10$);
|
||||
}
|
||||
}
|
||||
@@ -187,10 +181,10 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
x1=(tempm->x-screen_x)*SCREEN_SCALE+SCREEN_SCALE/2;
|
||||
y1=(tempm->y-screen_y)*SCREEN_SCALE+SCREEN_SCALE/2;
|
||||
z1=0;
|
||||
GrTransform(dc_t,&x1,&y1,&z1);
|
||||
DCTransform(dc_t,&x1,&y1,&z1);
|
||||
if (tempm->dx<0) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
GrSetSymmetry(dc,x1,y1,x1,y1+1);
|
||||
DCSymmetrySet(dc,x1,y1,x1,y1+1);
|
||||
} else
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
Sprite3(dc,x1,y1,z1,$IB,"<4>",BI=4$);
|
||||
@@ -205,10 +199,10 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
if (man_dy!=1)
|
||||
y1-=Saw(tS-man_attack_t0,0.2)*SCREEN_SCALE;
|
||||
}
|
||||
GrTransform(dc_t,&x1,&y1,&z1);
|
||||
DCTransform(dc_t,&x1,&y1,&z1);
|
||||
if (man_dx<0) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
GrSetSymmetry(dc,x1,y1,x1,y1+1);
|
||||
DCSymmetrySet(dc,x1,y1,x1,y1+1);
|
||||
} else
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
|
||||
@@ -228,7 +222,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=LTGREEN;
|
||||
tt=tS;
|
||||
}
|
||||
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",monsters_left,tt-t0,best_score);
|
||||
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",
|
||||
monsters_left,tt-t0,best_score);
|
||||
}
|
||||
|
||||
U0 Attack()
|
||||
@@ -264,7 +259,7 @@ U0 Init()
|
||||
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);
|
||||
map[y*map_width+x]=GrPeek(dc,x*MAP_SCALE,y*MAP_SCALE);
|
||||
DCDel(dc);
|
||||
|
||||
man_attack_t0=0;
|
||||
@@ -323,23 +318,23 @@ 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);"
|
||||
"}"
|
||||
);
|
||||
"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;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
Init;
|
||||
@@ -370,14 +365,15 @@ U0 DunGen()
|
||||
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-screen_x>SCREEN_WIDTH/2-3) {
|
||||
screen_x+=SCREEN_WIDTH/2;
|
||||
if (screen_x+SCREEN_WIDTH/2>map_width)
|
||||
screen_x=map_width-SCREEN_WIDTH/2;
|
||||
if (man_x+1<map_width &&
|
||||
map[man_y*map_width+(man_x+1)]==DKGRAY) {
|
||||
man_x++;
|
||||
if (man_x-screen_x>SCREEN_WIDTH/2-3) {
|
||||
screen_x+=SCREEN_WIDTH/2;
|
||||
if (screen_x+SCREEN_WIDTH/2>map_width)
|
||||
screen_x=map_width-SCREEN_WIDTH/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_CURSOR_LEFT:
|
||||
if (man_attack) {
|
||||
@@ -385,14 +381,15 @@ U0 DunGen()
|
||||
man_dy=0;
|
||||
Attack;
|
||||
} else
|
||||
if (man_x-1>=0 && map[man_y*map_width+(man_x-1)]==DKGRAY) {
|
||||
man_x--;
|
||||
if (man_x-screen_x<-SCREEN_WIDTH/2+3) {
|
||||
screen_x-=SCREEN_WIDTH/2;
|
||||
if (screen_x-SCREEN_WIDTH/2<0)
|
||||
screen_x=SCREEN_WIDTH/2;
|
||||
if (man_x-1>=0 &&
|
||||
map[man_y*map_width+(man_x-1)]==DKGRAY) {
|
||||
man_x--;
|
||||
if (man_x-screen_x<-SCREEN_WIDTH/2+3) {
|
||||
screen_x-=SCREEN_WIDTH/2;
|
||||
if (screen_x-SCREEN_WIDTH/2<0)
|
||||
screen_x=SCREEN_WIDTH/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
if (man_attack) {
|
||||
@@ -400,14 +397,15 @@ U0 DunGen()
|
||||
man_dy=-1;
|
||||
Attack;
|
||||
} else
|
||||
if (man_y-1>=0 && map[(man_y-1)*map_width+man_x]==DKGRAY) {
|
||||
man_y--;
|
||||
if (man_y-screen_y<-SCREEN_HEIGHT/2+3) {
|
||||
screen_y-=SCREEN_HEIGHT/2;
|
||||
if (screen_y-SCREEN_HEIGHT/2<0)
|
||||
screen_y=SCREEN_HEIGHT/2;
|
||||
if (man_y-1>=0 &&
|
||||
map[(man_y-1)*map_width+man_x]==DKGRAY) {
|
||||
man_y--;
|
||||
if (man_y-screen_y<-SCREEN_HEIGHT/2+3) {
|
||||
screen_y-=SCREEN_HEIGHT/2;
|
||||
if (screen_y-SCREEN_HEIGHT/2<0)
|
||||
screen_y=SCREEN_HEIGHT/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_CURSOR_DOWN:
|
||||
if (man_attack) {
|
||||
@@ -415,14 +413,15 @@ U0 DunGen()
|
||||
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-screen_y>SCREEN_HEIGHT/2-3) {
|
||||
screen_y+=SCREEN_HEIGHT/2;
|
||||
if (screen_y+SCREEN_HEIGHT/2>map_height)
|
||||
screen_y=map_height-SCREEN_HEIGHT/2;
|
||||
if (man_y+1<map_height &&
|
||||
map[(man_y+1)*map_width+man_x]==DKGRAY) {
|
||||
man_y++;
|
||||
if (man_y-screen_y>SCREEN_HEIGHT/2-3) {
|
||||
screen_y+=SCREEN_HEIGHT/2;
|
||||
if (screen_y+SCREEN_HEIGHT/2>map_height)
|
||||
screen_y=map_height-SCREEN_HEIGHT/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -439,7 +438,7 @@ dg_done:
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
MenuPop;
|
||||
AcctRegWriteBranch("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
|
||||
CleanUp;
|
||||
}
|
||||
|
||||
|
||||
+123
-176
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/EagleDive","I64 best_score=0;\n");
|
||||
AcctRegExeBranch("TempleOS/EagleDive");
|
||||
RegSetDftEntry("TempleOS/EagleDive","I64 best_score=0;\n");
|
||||
RegExeBranch("TempleOS/EagleDive");
|
||||
|
||||
//Keep these power of two so shift is used instead of multiply
|
||||
//to index arrays.
|
||||
@@ -28,7 +28,7 @@ class Panel
|
||||
{
|
||||
Panel *next;
|
||||
I32 n, //num polygon sides
|
||||
num; //panel number
|
||||
num; //panel number
|
||||
CD3I32 *pts;
|
||||
I64 color,cnt;
|
||||
};
|
||||
@@ -68,8 +68,8 @@ Normally, just spawn a popup task,
|
||||
run it and kill it using an icon.
|
||||
*/
|
||||
I16 elevations[MAP_HEIGHT][MAP_WIDTH];
|
||||
I32 normals[MAP_HEIGHT][MAP_WIDTH*2];
|
||||
Panel *panels[MAP_HEIGHT][MAP_WIDTH*2];
|
||||
CD3 normals[MAP_HEIGHT][MAP_WIDTH];
|
||||
Panel *panels[MAP_HEIGHT][MAP_WIDTH];
|
||||
|
||||
I64 num_panels;
|
||||
Panel *panel_root;
|
||||
@@ -91,7 +91,7 @@ class MPCtrl {
|
||||
U0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
{
|
||||
I64 zz;
|
||||
GrRot(dc->r,x,y,z);
|
||||
Mat4x4MulXYZ(dc->r,x,y,z);
|
||||
*z=zz=-*z;
|
||||
if (zz>0) {
|
||||
*x = *x * DISPLAY_SCALE/ zz; //Foreshortening
|
||||
@@ -102,98 +102,48 @@ U0 EDTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
}
|
||||
|
||||
U0 CalcNormals()
|
||||
{
|
||||
/*The idea is that there are two tris
|
||||
forming every grid square and we find the normal
|
||||
vect with a curl.
|
||||
{/*Find the normal vect with a curl.
|
||||
|
||||
i j k
|
||||
0 1 dz2
|
||||
1 0 dz1
|
||||
i,j and k are the axis unit vectors,
|
||||
not to be confused with my local index variables.
|
||||
|
||||
Normal:
|
||||
dz1*i + dz2*j - k
|
||||
i j k
|
||||
0 1 dz2
|
||||
1 0 dz1
|
||||
|
||||
i j k
|
||||
-1 0 -dz3
|
||||
0 -1 -dz4
|
||||
|
||||
Normal:
|
||||
-dz3*i - dz4*j + k
|
||||
|
||||
|
||||
Basically, we want to combine grid
|
||||
locations with the same normals. These
|
||||
are not unit vects for one thing.
|
||||
|
||||
What I came-up with is dz1/dz2 and dz3/dz4.
|
||||
|
||||
It works pretty well. It combines
|
||||
more than it should, but that's good
|
||||
because it would result in too many
|
||||
panels.
|
||||
Normal: dz1*i + dz2*j - k
|
||||
*/
|
||||
I64 i,j,k,dz1,dz2;
|
||||
I64 i,j;
|
||||
for (j=0;j<MAP_HEIGHT-1;j++) {
|
||||
k=0;
|
||||
for (i=0;i<MAP_WIDTH-1;i++) {
|
||||
dz1=elevations[j][i+1]-elevations[j][i];
|
||||
dz2=elevations[j+1][i]-elevations[j][i];
|
||||
if (dz2)
|
||||
normals[j][k++]=dz1<<16/dz2;
|
||||
else {
|
||||
if (!dz1)
|
||||
normals[j][k++]=0;
|
||||
else if (dz1>0)
|
||||
normals[j][k++]=MAX_I32;
|
||||
else
|
||||
normals[j][k++]=MIN_I32;
|
||||
}
|
||||
|
||||
dz1=elevations[j+1][i+1]-elevations[j][i+1];
|
||||
dz2=elevations[j+1][i+1]-elevations[j+1][i];
|
||||
if (dz2)
|
||||
normals[j][k++]=dz1<<16/dz2;
|
||||
else {
|
||||
if (!dz1)
|
||||
normals[j][k++]=0;
|
||||
else if (dz1>0)
|
||||
normals[j][k++]=MAX_I32;
|
||||
else
|
||||
normals[j][k++]=MIN_I32;
|
||||
}
|
||||
normals[j][i].x=elevations[j][i+1]-elevations[j][i];
|
||||
normals[j][i].y=elevations[j+1][i]-elevations[j][i];
|
||||
normals[j][i].z=-1;
|
||||
D3Unit(&normals[j][i]);
|
||||
}
|
||||
normals[j][k++]=0;
|
||||
normals[j][k++]=0;
|
||||
}
|
||||
k=0;
|
||||
for (i=0;i<MAP_WIDTH-1;i++) {
|
||||
normals[j][k++]=0;
|
||||
normals[j][k++]=0;
|
||||
MemSet(&normals[j][i],0,sizeof(CD3));
|
||||
}
|
||||
for (i=0;i<MAP_WIDTH-1;i++)
|
||||
MemSet(&normals[j][i],0,sizeof(CD3));
|
||||
}
|
||||
|
||||
Bool TestSameSlope(I64 x,I64 y,I64 w,I64 h)
|
||||
{
|
||||
I64 k1,k2,xx,yy,s;
|
||||
CD3 p,*s;
|
||||
I64 k1,k2;
|
||||
if (!(0<=x && x+w<MAP_WIDTH && 0<=y && y+h<MAP_HEIGHT))
|
||||
return FALSE;
|
||||
//Works well averaging the two slopes of two tris.
|
||||
//If it is too picky, we get too many panels.
|
||||
s=normals[y][x*2]+normals[y][x*2+1];
|
||||
s=&normals[y][x];
|
||||
for (k2=0;k2<h;k2++)
|
||||
for (k1=0;k1<w;k1++) {
|
||||
xx=(x+k1)*2;
|
||||
yy=y+k2;
|
||||
if (normals[yy][xx]+normals[yy][xx+1]!=s)
|
||||
return FALSE;
|
||||
}
|
||||
for (k1=0;k1<w;k1++)
|
||||
if (D3NormSqr(D3Sub(&normals[y+k2][x+k1],s,&p))>.10)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U0 MPDoPanels(CTask *task)
|
||||
{
|
||||
I64 i,j,k,l,k1,k2,w,h,threshold,lo,hi;
|
||||
I64 i,j,l,k1,k2,w,h,threshold,lo,hi;
|
||||
Bool cont;
|
||||
Panel *tempp,*start_ptr=NULL,*end_ptr=NULL;
|
||||
CD3I32 *poly;
|
||||
@@ -202,9 +152,8 @@ U0 MPDoPanels(CTask *task)
|
||||
hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp.mp_cnt;
|
||||
for (threshold=8;threshold>=1;threshold--)
|
||||
for (j=lo;j<hi;j++) {
|
||||
k=0;
|
||||
for (i=0;i<MAP_WIDTH-1;i++) {
|
||||
if (!panels[j][k]) {
|
||||
if (!panels[j][i]) {
|
||||
w=1;
|
||||
h=1;
|
||||
do {
|
||||
@@ -223,9 +172,9 @@ U0 MPDoPanels(CTask *task)
|
||||
lock {tempp->num=num_panels++;}
|
||||
l=elevations[j][i];
|
||||
if (l<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j][i+w-1]<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j+h-1][i]<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j+h-1][i+w-1]<=WATER_ELEVATION*MAP_SCALE) {
|
||||
elevations[j][i+w-1]<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j+h-1][i]<=WATER_ELEVATION*MAP_SCALE &&
|
||||
elevations[j+h-1][i+w-1]<=WATER_ELEVATION*MAP_SCALE) {
|
||||
tempp->color=BLUE;
|
||||
if (Rand<0.05) {
|
||||
tempf=MAlloc(sizeof(Fish),task);
|
||||
@@ -286,13 +235,10 @@ U0 MPDoPanels(CTask *task)
|
||||
if (!end_ptr)
|
||||
end_ptr=tempp;
|
||||
for (k2=0;k2<h;k2++)
|
||||
for (k1=0;k1<w;k1++) {
|
||||
panels[j+k2][(i+k1)*2]=tempp;
|
||||
panels[j+k2][(i+k1)*2+1]=tempp;
|
||||
}
|
||||
for (k1=0;k1<w;k1++)
|
||||
panels[j+k2][i+k1]=tempp;
|
||||
}
|
||||
}
|
||||
k+=2;
|
||||
}
|
||||
}
|
||||
if (end_ptr) {
|
||||
@@ -338,15 +284,8 @@ U0 InitElevations()
|
||||
|
||||
U0 InitMap()
|
||||
{/*We make a topographic data structure "elevations[][]"
|
||||
and convert it to panels. The conversion to panels leaves
|
||||
gaps the way I did it, but it looks good, except for sky leaking through
|
||||
There is no wrong way to pick colors if it looks good, unless
|
||||
you wanted to do lighting.
|
||||
|
||||
"panels[][]" holds the flat and sloped panels for each spot, while
|
||||
"hstep_panels[][]" holds side panels in cases of step-like formations.
|
||||
They require a separate array because a single "elevation[][]" spot can
|
||||
have a panel on top and a panel on the side like stairs.
|
||||
and convert it to panels. "panels[][]" holds the panels
|
||||
for each spot.
|
||||
*/
|
||||
I64 i,x,y,xx,yy;
|
||||
|
||||
@@ -443,61 +382,63 @@ I64 update_jiffy_limit;
|
||||
U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 j,strip_width,*s2w,x1,y1,z1, xx,yy,
|
||||
xh,yh,zh,yh2,xh2,x1h,y1h,x1wa,y1wa,x1wb,y1wb,
|
||||
x3,y3,z3,
|
||||
cx=task->pix_width>>1,
|
||||
cy=task->pix_height>>1;
|
||||
xh,yh,zh,yh2,xh2,x1h,y1h,x1wa,y1wa,x1wb,y1wb,
|
||||
x3,y3,z3,
|
||||
cx=task->pix_width>>1,
|
||||
cy=task->pix_height>>1;
|
||||
Panel reg *tempp;
|
||||
|
||||
xx=x/(MAP_SCALE*COORDINATE_SCALE);
|
||||
yy=y/(MAP_SCALE*COORDINATE_SCALE);
|
||||
|
||||
//World to screen coordinates
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,é2);
|
||||
GrRotXEqu(dc->r,è);
|
||||
GrRotZEqu(dc->r,é1);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é2);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,é1);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
//Screen to world coordinates
|
||||
|
||||
//This gives us the vects for stepping through the grid in
|
||||
//the direction the plane is facing. we step horizontally and vertically
|
||||
//and use the reciprocal slope principle y=mx+b and y=(-1/m)x+b are perpendicular.
|
||||
//This gives us the vects for stepping through the grid in
|
||||
//the direction the plane is facing. we step horizontally and vertically
|
||||
//and use the reciprocal slope principle
|
||||
//y=mx+b and y=(-1/m)x+b are perpendicular.
|
||||
|
||||
s2w=GrIdentNew;
|
||||
GrRotZEqu(s2w,-é1);
|
||||
GrRotXEqu(s2w,-è);
|
||||
GrRotZEqu(s2w,-é2);
|
||||
s2w=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
xh=0;
|
||||
yh=0;
|
||||
zh=-256;
|
||||
GrRot(s2w,&xh,&yh,&zh);
|
||||
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
|
||||
|
||||
//The layer for core#1 is not cleared automatically
|
||||
//it is persistent. I have carefully syncronized to the update
|
||||
//cycle initiated by core#0 to prevent flicker.
|
||||
//The layer for core#1 is not cleared automatically
|
||||
//it is persistent. I have carefully syncronized to the update
|
||||
//cycle initiated by core#0 to prevent flicker.
|
||||
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
dc->transform=&EDTransform;
|
||||
dc->x=cx;
|
||||
dc->y=cy;
|
||||
|
||||
//dc->x and the translation part of dc->r are identical in effect,
|
||||
//but we use both to show-off. We could add offsets together and use one or the other.
|
||||
//dc->x and the translation part of dc->r are identical in effect,
|
||||
//but we use both to show-off. We could add offsets together and
|
||||
//use one or the other.
|
||||
|
||||
x1=-x>>COORDINATE_BITS;
|
||||
y1=-y>>COORDINATE_BITS;
|
||||
z1=-z>>COORDINATE_BITS;
|
||||
GrRot(dc->r,&x1,&y1,&z1);
|
||||
GrSetTranslation(dc->r,x1,y1,z1);
|
||||
Mat4x4MulXYZ(dc->r,&x1,&y1,&z1);
|
||||
Mat4x4TranslationEqu(dc->r,x1,y1,z1);
|
||||
|
||||
//This is a refinement.
|
||||
if (Abs(è*180/ã)>90) {
|
||||
x3=0;
|
||||
y3=-cy;
|
||||
z3=0;
|
||||
GrRot(s2w,&x3,&y3,&z3);
|
||||
Mat4x4MulXYZ(s2w,&x3,&y3,&z3);
|
||||
xx+=x3;
|
||||
yy+=y3;
|
||||
}
|
||||
@@ -528,13 +469,14 @@ U0 MPDrawIt(CTask *task,CDC *dc)
|
||||
for (j=0;j<strip_height && cnts.jiffies<update_jiffy_limit;j++) {
|
||||
x1=x1h>>8; y1=y1h>>8;
|
||||
if (0<=x1<MAP_WIDTH && 0<=y1<MAP_HEIGHT) {
|
||||
if ((tempp=panels[y1][x1*2]) && !LBts(panels_processed_bitmap,tempp->num)) {
|
||||
if (tempp->cnt>8*(1.1-Gs->idle_factor)) {
|
||||
dc->color=tempp->color;
|
||||
tempp->cnt=GrFillPoly3(dc,tempp->n,tempp->pts);
|
||||
} else
|
||||
tempp->cnt++;
|
||||
}
|
||||
if ((tempp=panels[y1][x1]) &&
|
||||
!LBts(panels_processed_bitmap,tempp->num)) {
|
||||
if (tempp->cnt>8*(1.1-Gs->idle_factor)) {
|
||||
dc->color=tempp->color;
|
||||
tempp->cnt=GrFillPoly3(dc,tempp->n,tempp->pts);
|
||||
} else
|
||||
tempp->cnt++;
|
||||
}
|
||||
}
|
||||
x1h+=xh;
|
||||
y1h+=yh;
|
||||
@@ -566,7 +508,7 @@ U0 APEagleDiveTask(CTask *master_task)
|
||||
MPDrawIt(master_task,dc);
|
||||
}
|
||||
|
||||
//We made an alias of this we don't want freed.
|
||||
//We made an alias of this we don't want freed.
|
||||
dc->depth_buf=NULL;
|
||||
|
||||
DCDel(dc);
|
||||
@@ -575,30 +517,30 @@ U0 APEagleDiveTask(CTask *master_task)
|
||||
|
||||
U0 DrawHorizon(CDC *dc)
|
||||
{
|
||||
I64 x1,y1,z1,x2,y2,z2,xh,yh,zh,*s2w=GrIdentNew,
|
||||
cx=Fs->pix_width>>1,
|
||||
cy=Fs->pix_height>>1;
|
||||
I64 x1,y1,z1,x2,y2,z2,xh,yh,zh,*s2w=Mat4x4IdentNew,
|
||||
cx=Fs->pix_width>>1,
|
||||
cy=Fs->pix_height>>1;
|
||||
CD3I32 p[4];
|
||||
I32 *old_db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,é2);
|
||||
GrRotXEqu(dc->r,è);
|
||||
GrRotZEqu(dc->r,é1);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é2);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,é1);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->transform=&EDTransform;
|
||||
dc->x=cx;
|
||||
dc->y=cy;
|
||||
|
||||
GrRotZEqu(s2w,-é1);
|
||||
GrRotXEqu(s2w,-è);
|
||||
GrRotZEqu(s2w,-é2);
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
xh=0;
|
||||
yh=0;
|
||||
zh=-256;
|
||||
GrRot(s2w,&xh,&yh,&zh);
|
||||
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
|
||||
Free(s2w);
|
||||
|
||||
x1=xh+yh*32; y1=yh-xh*32; z1=0;
|
||||
@@ -668,8 +610,8 @@ U0 BSPEagleDive()
|
||||
{
|
||||
CDC *dc=DCAlias(main_dc,Fs);
|
||||
I64 i,xx,yy,height,bkcolor,
|
||||
cx=Fs->pix_width>>1,
|
||||
cy=Fs->pix_height>>1;
|
||||
cx=Fs->pix_width>>1,
|
||||
cy=Fs->pix_height>>1;
|
||||
F64 min_strip_width;
|
||||
Fish *tempf;
|
||||
|
||||
@@ -716,7 +658,9 @@ U0 BSPEagleDive()
|
||||
min_strip_width=MAX_F64;
|
||||
for (i=0;i<mp.mp_cnt;i++)
|
||||
min_strip_width=Min(min_strip_width,32.0*mp.strip_width[i]/(i+32.0));
|
||||
strip_height=ClampI64(strip_height*Clamp(0.25*min_strip_width/strip_height,0.9,1.1),64,1024);
|
||||
strip_height=ClampI64(
|
||||
strip_height*Clamp(0.25*min_strip_width/strip_height,0.9,1.1),
|
||||
64,1024);
|
||||
} else {
|
||||
dc->color=bkcolor;
|
||||
GrRect(dc,0,0,dc->width,dc->height);
|
||||
@@ -730,19 +674,21 @@ U0 BSPEagleDive()
|
||||
GrLine3(dc,cx+5,cy,0,cx-5,cy,0);
|
||||
GrLine3(dc,cx,cy+5,0,cx,cy-5,0);
|
||||
GrPrint(dc,0,0,"é1:%5.1f è:%5.1f é2:%5.1f Strip:%5d",
|
||||
é1*180/ã,è*180/ã,é2*180/ã,strip_height);
|
||||
GrPrint(dc,0,FONT_HEIGHT,"x:%5.1f y:%5.1f z:%5.1f height:%3d score:%d high:%d",
|
||||
ToF64(x)/COORDINATE_SCALE,ToF64(y)/COORDINATE_SCALE,ToF64(z)/COORDINATE_SCALE,
|
||||
height,game_score,best_score);
|
||||
é1*180/ã,è*180/ã,é2*180/ã,strip_height);
|
||||
GrPrint(dc,0,FONT_HEIGHT,
|
||||
"x:%5.1f y:%5.1f z:%5.1f height:%3d score:%d high:%d",
|
||||
ToF64(x)/COORDINATE_SCALE,
|
||||
ToF64(y)/COORDINATE_SCALE,ToF64(z)/COORDINATE_SCALE,
|
||||
height,game_score,best_score);
|
||||
|
||||
if (game_over && Blink) {
|
||||
dc->color=RED;
|
||||
GrPrint(dc,(Fs->pix_width-9*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Game Over");
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Game Over");
|
||||
} else if (tS-game_t0<5.0 && Blink) {
|
||||
dc->color=WHITE;
|
||||
GrPrint(dc,(Fs->pix_width-10*FONT_WIDTH)/2,
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Catch Fish");
|
||||
(Fs->pix_height-FONT_HEIGHT)/2,"Catch Fish");
|
||||
}
|
||||
//We made an alias of this we don't want freed.
|
||||
dc->depth_buf=NULL;
|
||||
@@ -761,13 +707,13 @@ U0 AnimateTask(I64)
|
||||
mS=1000*(tS-t0);
|
||||
t0=tS;
|
||||
if (!game_over) {
|
||||
//Screen to world coordinates
|
||||
s2w=GrIdentNew;
|
||||
GrRotZEqu(s2w,-é1);
|
||||
GrRotXEqu(s2w,-è);
|
||||
GrRotZEqu(s2w,-é2);
|
||||
//Screen to world coordinates
|
||||
s2w=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(s2w,-é1);
|
||||
Mat4x4RotX(s2w,-è);
|
||||
Mat4x4RotZ(s2w,-é2);
|
||||
x1=0;y1=0;z1=-speed*mS*COORDINATE_SCALE;
|
||||
GrRot(s2w,&x1,&y1,&z1);
|
||||
Mat4x4MulXYZ(s2w,&x1,&y1,&z1);
|
||||
x+=x1;
|
||||
y+=y1;
|
||||
z+=z1;
|
||||
@@ -779,7 +725,8 @@ U0 AnimateTask(I64)
|
||||
tempf=fish_root.next;
|
||||
while (tempf!=&fish_root) {
|
||||
tempf1=tempf->next;
|
||||
if (SqrI64(tempf->p.x-x1)+SqrI64(tempf->p.y-y1)<MAP_SCALE*MAP_SCALE*5*5) {
|
||||
if (SqrI64(tempf->p.x-x1)+
|
||||
SqrI64(tempf->p.y-y1)<MAP_SCALE*MAP_SCALE*5*5) {
|
||||
game_score++;
|
||||
if (game_score>best_score)
|
||||
best_score=game_score;
|
||||
@@ -810,7 +757,7 @@ U0 MPEnd()
|
||||
update_jiffy_limit=0;
|
||||
mp.app_not_done_flags=1<<mp.mp_cnt-1-1;
|
||||
mp.app_done=TRUE;
|
||||
//Wait for all cores to exit
|
||||
//Wait for all cores to exit
|
||||
while (mp.app_not_done_flags)
|
||||
Sleep(1);
|
||||
}
|
||||
@@ -827,8 +774,8 @@ U0 SongTask(I64)
|
||||
MusicSettingsRst;
|
||||
music.stacatto_factor=0.2;
|
||||
while (TRUE) {
|
||||
Play("3eBDEDBDEDFEEDFEED");
|
||||
Play("BDEDBDEDFEEDFEED");
|
||||
Play("3eBDEDBDEDFEEDFEED");
|
||||
Play("BDEDBDEDFEEDFEED");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,7 +793,7 @@ U0 Init(I64 _mp_cnt)
|
||||
mp.mp_cnt=mp_cnt;
|
||||
QueInit(&fish_root);
|
||||
InitMap;
|
||||
DCAllocDepthBuf(main_dc);
|
||||
DCDepthBufAlloc(main_dc);
|
||||
|
||||
strip_height=128;
|
||||
è =-90.0*ã/180.0;
|
||||
@@ -895,18 +842,18 @@ U0 EagleDive(I64 _mp_cnt=MP_MAX_PROCESSORS)
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Down(,,SC_CURSOR_UP);"
|
||||
" Up(,,SC_CURSOR_DOWN);"
|
||||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
"}"
|
||||
);
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Down(,,SC_CURSOR_UP);"
|
||||
" Up(,,SC_CURSOR_DOWN);"
|
||||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
"}"
|
||||
);
|
||||
WinMax;
|
||||
WinBorder;
|
||||
"Initializing...\n";
|
||||
@@ -946,7 +893,7 @@ U0 EagleDive(I64 _mp_cnt=MP_MAX_PROCESSORS)
|
||||
Init(_mp_cnt);
|
||||
Fs->draw_it=&DrawIt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
é1=Wrap(é1);
|
||||
è =Wrap(è);
|
||||
é2=Wrap(é2);
|
||||
@@ -958,7 +905,7 @@ U0 EagleDive(I64 _mp_cnt=MP_MAX_PROCESSORS)
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
#ifjit
|
||||
AcctRegWriteBranch("TempleOS/EagleDive","I64 best_score=%d;\n",best_score);
|
||||
RegWriteBranch("TempleOS/EagleDive","I64 best_score=%d;\n",best_score);
|
||||
#endif
|
||||
MenuPop;
|
||||
}
|
||||
|
||||
Binary file not shown.
+73
-50
@@ -36,13 +36,13 @@ class Obj
|
||||
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;
|
||||
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];
|
||||
@@ -100,7 +100,7 @@ Obj *ObjFind(F64 x,F64 y,
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
while (tempo!=&obj_root) {
|
||||
if (tempo->flags&flag_mask==flag_val &&
|
||||
Bt(&type_mask,tempo->type)&&Bt(&player_mask,tempo->player)) {
|
||||
Bt(&type_mask,tempo->type)&&Bt(&player_mask,tempo->player)) {
|
||||
dd=Sqr(tempo->x-x)+Sqr(tempo->y-y);
|
||||
if (dd<best_dd) {
|
||||
best=tempo;
|
||||
@@ -162,7 +162,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
F64 d,cur_time=tS;
|
||||
Obj *tempo;
|
||||
Torpedo *tempt;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
tempt=torpedo_root.next;
|
||||
while (tempt!=&torpedo_root) {
|
||||
@@ -174,17 +174,21 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tempo=obj_root.next;
|
||||
while (tempo!=&obj_root) {
|
||||
if (tempo->flags&OF_ACTIVE && tempo->flags&OF_SHIP) {
|
||||
SpriteZ3B(dc,tempo->x,tempo->y,0,imgs[tempo->player][tempo->type],tempo->é+ã/2);
|
||||
SpriteZ3B(dc,tempo->x,tempo->y,0,
|
||||
imgs[tempo->player][tempo->type],tempo->é+ã/2);
|
||||
|
||||
k=0;
|
||||
for (j=0;j<FIRE_HEIGHT;j++)
|
||||
for (i=0;i<FIRE_WIDTH;i++)
|
||||
if (Bt(tempo->fire,k++)) {
|
||||
dc->color=fire_colors[ToI64(k+10*tS)&(FIRE_COLORS-1)];
|
||||
GrPlot(dc,tempo->x+FIRE_X_SCALE*(i-FIRE_WIDTH /2+(11*tS+i)%1.7)*Cos(tempo->é)-
|
||||
FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(12*tS+j)%1.7)*Sin(tempo->é),
|
||||
tempo->y+FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(19*tS+j)%1.7)*Cos(tempo->é)+
|
||||
FIRE_X_SCALE*(i-FIRE_WIDTH /2+(13*tS+i)%1.7)*Sin(tempo->é));
|
||||
GrPlot(dc,
|
||||
tempo->x+FIRE_X_SCALE*(i-FIRE_WIDTH /2+(11*tS+i)%1.7)
|
||||
*Cos(tempo->é)-
|
||||
FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(12*tS+j)%1.7)*Sin(tempo->é),
|
||||
tempo->y+FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(19*tS+j)%1.7)
|
||||
*Cos(tempo->é)+
|
||||
FIRE_X_SCALE*(i-FIRE_WIDTH /2+(13*tS+i)%1.7)*Sin(tempo->é));
|
||||
}
|
||||
if (Blink) {
|
||||
dc->color=BLACK;
|
||||
@@ -197,7 +201,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=YELLOW;
|
||||
else
|
||||
dc->color=GREEN;
|
||||
GrLine(dc,tempo->x+5,tempo->y,tempo->x+5+10*tempo->life_percent/100,tempo->y);
|
||||
GrLine(dc,tempo->x+5,tempo->y,
|
||||
tempo->x+5+10*tempo->life_percent/100,tempo->y);
|
||||
}
|
||||
|
||||
dc->color=BLACK;
|
||||
@@ -220,7 +225,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tempo=obj_root.next;
|
||||
while (tempo!=&obj_root) {
|
||||
if (tempo->flags&OF_ACTIVE && !(tempo->flags&OF_SHIP))
|
||||
SpriteZ3B(dc,tempo->x,tempo->y,0,imgs[tempo->player][tempo->type],tempo->é+ã/2);
|
||||
SpriteZ3B(dc,tempo->x,tempo->y,0,
|
||||
imgs[tempo->player][tempo->type],tempo->é+ã/2);
|
||||
if (tempo->flags&OF_SHOOTING) {
|
||||
dc->color=LTRED;
|
||||
GrLine(dc,tempo->x,tempo->y,tempo->target_x,tempo->target_y,3);
|
||||
@@ -231,23 +237,29 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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]);
|
||||
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]);
|
||||
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]) {
|
||||
@@ -266,7 +278,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
U0 Init()
|
||||
{
|
||||
I64 i,fighter,ship,player,squadron,
|
||||
w=Fs->pix_width,h=Fs->pix_height;
|
||||
w=Fs->pix_width,h=Fs->pix_height;
|
||||
Squadron *temps;
|
||||
Obj *tempo,*tempo1;
|
||||
QueInit(&obj_root);
|
||||
@@ -322,7 +334,8 @@ U0 Init()
|
||||
tempo1->next_action_time=0;
|
||||
QueIns(tempo1,obj_root.last);
|
||||
|
||||
for (squadron=0;squadron<num_squadrons_per_carrier[player];squadron++,num_squadrons++) {
|
||||
for (squadron=0;squadron<num_squadrons_per_carrier[player];
|
||||
squadron++,num_squadrons++) {
|
||||
for (fighter=0;fighter<num_planes_per_squadron[player];fighter++) {
|
||||
tempo=CAlloc(sizeof(Obj));
|
||||
num_alive[player]++;
|
||||
@@ -368,7 +381,8 @@ U0 CleanUp()
|
||||
Free(squadrons);
|
||||
}
|
||||
|
||||
Obj *ObjLaunch(I64 player,I64 squadron=-1,Obj *host=NULL,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
|
||||
Obj *ObjLaunch(I64 player,I64 squadron=-1,
|
||||
Obj *host=NULL,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
|
||||
{
|
||||
Obj *tempo;
|
||||
F64 cur_time=tS;
|
||||
@@ -379,9 +393,12 @@ Obj *ObjLaunch(I64 player,I64 squadron=-1,Obj *host=NULL,F64 x=MAX_F64,F64 y=MAX
|
||||
é=Arg(x-host->x,y-host->y);
|
||||
tempo=obj_root.next;
|
||||
while (tempo!=&obj_root) {
|
||||
if (tempo->host==host && (squadron<0||tempo->squadron==squadron) && !(tempo->flags&OF_ACTIVE) &&
|
||||
(tempo->squadron<0||squadrons[tempo->squadron].action==SA_PARKED||squadrons[tempo->squadron].action==SA_LAUNCHING)) {
|
||||
if (tempo->fuel<=0.0) //When low on fuel, not zero, gets launched and captured.
|
||||
if (tempo->host==host && (squadron<0||tempo->squadron==squadron) &&
|
||||
!(tempo->flags&OF_ACTIVE) &&
|
||||
(tempo->squadron<0||squadrons[tempo->squadron].action==SA_PARKED||
|
||||
squadrons[tempo->squadron].action==SA_LAUNCHING)) {
|
||||
if (tempo->fuel<=0.0)
|
||||
//When low on fuel, not zero, gets launched and captured.
|
||||
LBts(&squadrons[tempo->squadron].dead_mask,tempo->member_num);
|
||||
else {
|
||||
tempo->flags=tempo->flags&~OF_RETURNING|OF_ACTIVE;
|
||||
@@ -461,7 +478,8 @@ Squadron *SquadronReturn(I64 player,F64 x,F64 y)
|
||||
Obj *ObjSeté(I64 player,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
|
||||
{
|
||||
Obj *tempo;
|
||||
if ((tempo=ObjFind(x,y,,,,1<<player)) && tempo->flags&OF_ACTIVE && !(tempo->flags&OF_RETURNING)) {
|
||||
if ((tempo=ObjFind(x,y,,,,1<<player)) && tempo->flags&OF_ACTIVE &&
|
||||
!(tempo->flags&OF_RETURNING)) {
|
||||
if (é==MAX_F64)
|
||||
é=Arg(x-tempo->x,y-tempo->y);
|
||||
tempo->dé+=Wrap(é-(tempo->é+tempo->dé),-ã);
|
||||
@@ -553,7 +571,8 @@ U0 AI(I64 player,F64 period)
|
||||
if (tempo->player==player) {
|
||||
if (tempo->type==OT_CARRIER && Rand<5*period)
|
||||
SquadronLaunch(player,tempo->x,tempo->y);
|
||||
if (tempo->flags&OF_ACTIVE && !(tempo->flags&OF_RETURNING) && Rand<10.0*period)
|
||||
if (tempo->flags&OF_ACTIVE && !(tempo->flags&OF_RETURNING) &&
|
||||
Rand<10.0*period)
|
||||
SquadronSeté(player,tempo->x,tempo->y,tempo->é+pi/2*(Rand-0.5));
|
||||
}
|
||||
tempo=tempo->next;
|
||||
@@ -607,7 +626,8 @@ U0 Combat(F64 period)
|
||||
while (tempo!=&obj_root) {
|
||||
tempo->flags&=~OF_SHOOTING;
|
||||
if (tempo->flags&OF_ACTIVE &&
|
||||
(tempo1=ObjFind(tempo->x,tempo->y,OF_ACTIVE,OF_ACTIVE,,1<<(tempo->player^1),&d))) {
|
||||
(tempo1=ObjFind(tempo->x,tempo->y,OF_ACTIVE,OF_ACTIVE,,
|
||||
1<<(tempo->player^1),&d))) {
|
||||
tempo->target_x=tempo1->x;
|
||||
tempo->target_y=tempo1->y;
|
||||
if (tempo1->flags&OF_SHIP) {
|
||||
@@ -656,8 +676,9 @@ U0 Combat(F64 period)
|
||||
while (tempo!=&obj_root) {
|
||||
tempo1=tempo->next;
|
||||
if (tempo->type==OT_FIGHTER &&
|
||||
(tempo->life_percent<=0.0 || tempo->flags&OF_ACTIVE && tempo->fuel<=0.0 ||
|
||||
tempo->host && !(tempo->flags&OF_ACTIVE) && tempo->host->life_percent<=0.0))
|
||||
(tempo->life_percent<=0.0 || tempo->flags&OF_ACTIVE &&
|
||||
tempo->fuel<=0.0 || tempo->host &&
|
||||
!(tempo->flags&OF_ACTIVE) && tempo->host->life_percent<=0.0))
|
||||
ObjDel(tempo);
|
||||
tempo=tempo1;
|
||||
}
|
||||
@@ -746,7 +767,8 @@ U0 AnimateTask(I64)
|
||||
} else if (d>tempo->fuel-250)
|
||||
tempo->flags|=OF_RETURNING;
|
||||
if (tempo->flags&OF_RETURNING)
|
||||
tempo->dé+=Wrap(Arg(tempo->host->x-tempo->x,tempo->host->y-tempo->y)-(tempo->é+tempo->dé),-ã);
|
||||
tempo->dé+=Wrap(Arg(tempo->host->x-tempo->x,
|
||||
tempo->host->y-tempo->y)-(tempo->é+tempo->dé),-ã);
|
||||
} else if (tempo->type==OT_CARRIER)
|
||||
ShipFix(tempo,2.5*period);
|
||||
}
|
||||
@@ -771,28 +793,29 @@ U0 FlatTops()
|
||||
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 Screen\n");
|
||||
Preempt(OFF),
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Faster(,'+');"
|
||||
" Slower(,'-');"
|
||||
"}"
|
||||
);
|
||||
"$$GREEN$${Right-Mouse}$$FG$$\t\tLaunch Squadron\n"
|
||||
"$$GREEN$${Right-Double-Mouse}$$FG$$\tReturn Squadron\n"
|
||||
"$$GREEN$${Ctrl-Left Grab}$$FG$$\tScroll Screen\n");
|
||||
Preempt,
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Faster(,'+');"
|
||||
" Slower(,'-');"
|
||||
"}"
|
||||
);
|
||||
Fs->win_inhibit|=WIF_SELF_IP_L|WIF_SELF_IP_R;
|
||||
Init;
|
||||
Fs->draw_it=&DrawIt;
|
||||
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
|
||||
try {
|
||||
while (TRUE)
|
||||
switch(GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_IP_R_D_UP)) {
|
||||
switch(GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_IP_R_D_UP)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case '\n':
|
||||
|
||||
+16
-16
@@ -12,7 +12,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 w=task->pix_width,h=task->pix_height;
|
||||
I64 i,x,y,xx;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
xx=w>>1-car_x+road_x[road_ptr&(NUM_ROAD-1)];
|
||||
|
||||
dc->color=LTGRAY;
|
||||
@@ -24,7 +24,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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;
|
||||
@@ -51,7 +51,7 @@ U0 UpdateRoad()
|
||||
while (distance>1.0) {
|
||||
road_trend=ClampI64(road_trend+SignI64(RandU16%3-1),-5,5);
|
||||
road_x[road_ptr&(NUM_ROAD-1)]=
|
||||
road_x[(road_ptr-1)&(NUM_ROAD-1)]+=road_trend/3;
|
||||
road_x[(road_ptr-1)&(NUM_ROAD-1)]+=road_trend/3;
|
||||
road_ptr++;
|
||||
distance-=1.0;
|
||||
}
|
||||
@@ -82,19 +82,19 @@ U0 Halogen()
|
||||
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);"
|
||||
"}"
|
||||
);
|
||||
Preempt(OFF);
|
||||
"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);"
|
||||
"}"
|
||||
);
|
||||
Preempt;
|
||||
AutoComplete;
|
||||
WinMax;
|
||||
Init;
|
||||
|
||||
+18
-20
@@ -9,18 +9,16 @@ class MySpring:CSpring
|
||||
|
||||
CMathODE *ode=NULL;
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
U0 DrawIt(CTask *,CDC *dc)
|
||||
{
|
||||
Bool old_suspend;
|
||||
MyMass *tempm;
|
||||
MySpring *temps;
|
||||
|
||||
old_suspend=Suspend(task);
|
||||
dc->color=RED;
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
GrLine(dc,temps->end1->x,temps->end1->y,
|
||||
temps->end2->x,temps->end2->y);
|
||||
temps->end2->x,temps->end2->y);
|
||||
temps=temps->next;
|
||||
}
|
||||
|
||||
@@ -30,13 +28,12 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrCircle(dc,tempm->x,tempm->y,tempm->radius);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
Suspend(task,old_suspend);
|
||||
}
|
||||
|
||||
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.
|
||||
//We can add new forces here.
|
||||
F64 d,dd;
|
||||
CD3 p;
|
||||
MyMass *tempm1,*tempm2;
|
||||
@@ -106,13 +103,13 @@ U0 MassSpringDemo()
|
||||
MyMass *tempm1=NULL,*tempm2=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");
|
||||
"Right-Click and drag to\n"
|
||||
"connect with spring.\n\n"
|
||||
"Springs are 100 pixs long.\n");
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
|
||||
/*Preempt(OFF) eliminates a lot of hassles.
|
||||
/*Preempt eliminates a lot of hassles.
|
||||
The concern is about changing
|
||||
que links while the winmgr task
|
||||
is updating the ode or screen.
|
||||
@@ -124,20 +121,20 @@ preempt, we will not be interrupted.
|
||||
There is little downside to Preempt()
|
||||
since we will yield during GetMsg().
|
||||
*/
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
|
||||
Fs->win_inhibit|=WIG_DBL_CLICK;
|
||||
AutoComplete;
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
"}"
|
||||
);
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
"}"
|
||||
);
|
||||
|
||||
Init;
|
||||
DocCursor;
|
||||
@@ -146,7 +143,8 @@ since we will yield during GetMsg().
|
||||
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
PlaceMass(a1,a2);
|
||||
|
||||
+8
-8
@@ -8,11 +8,11 @@ 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]);
|
||||
// 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 button.");
|
||||
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
|
||||
@@ -43,7 +43,7 @@ U0 SolveMaze(I64 x,I64 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)) ) {
|
||||
!(0<=y<MinI64(Fs->win_height,TEXT_ROWS)) ) {
|
||||
Beep;Beep;
|
||||
break;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ U0 SolveMaze(I64 x,I64 y)
|
||||
text[y][x]='.'+ATTR;
|
||||
x+=dir_x[dir];
|
||||
y+=dir_y[dir];
|
||||
//u8.[0] is the ASCII
|
||||
//u8.[0] is the ASCII
|
||||
if (text[y][x].u8[0]) {
|
||||
x-=dir_x[dir];
|
||||
y-=dir_y[dir];
|
||||
@@ -91,7 +91,7 @@ U0 Maze()
|
||||
do {
|
||||
MemSet(text,0,sizeof(text));
|
||||
while (!(ch=ScanChar)) {
|
||||
//Input Ptr (mouse) text x,y coordinates.
|
||||
//Input Ptr (mouse) text x,y coordinates.
|
||||
x=ip.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
|
||||
y=ip.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
|
||||
if (ip.lb&&!winmgr.grab_scroll)
|
||||
|
||||
+15
-14
@@ -12,7 +12,7 @@ CDC *cur_dc;
|
||||
U0 DrawFrame(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 w=task->pix_width,h=task->pix_height,
|
||||
cx=w>>1,cy=h>>1;
|
||||
cx=w>>1,cy=h>>1;
|
||||
|
||||
dc->color=LTRED;
|
||||
GrLine(dc,cx-20,cy-50,cx,cy-150);
|
||||
@@ -56,10 +56,11 @@ U0 DrawDrops(CTask *,CDC *dc)
|
||||
|
||||
U0 UpdateCurBase(CTask *task,CDC *dc)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
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);
|
||||
GrBlot(cur_dc,-task->pix_left-task->scroll_x,
|
||||
-task->pix_top-task->scroll_y,dc);
|
||||
dc->flags&=~DCF_NO_TRANSPARENTS;
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
@@ -87,7 +88,7 @@ U0 AnimateTask(I64)
|
||||
break;
|
||||
j++;
|
||||
} while (j<=NUM_DROPS);
|
||||
|
||||
|
||||
drops[cur_drop].x=RandU32%w;
|
||||
drops[cur_drop].y=0;
|
||||
}
|
||||
@@ -150,16 +151,16 @@ U0 RainDrops()
|
||||
{
|
||||
I64 ch,sc;
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" OpenUpper(,'1');"
|
||||
" OpenLower(,'2');"
|
||||
"}"
|
||||
);
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" OpenUpper(,'1');"
|
||||
" OpenLower(,'2');"
|
||||
"}"
|
||||
);
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);
|
||||
|
||||
+62
-49
@@ -1,7 +1,7 @@
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/RawHide","F64 best_score=9999;\n");
|
||||
AcctRegExeBranch("TempleOS/RawHide");
|
||||
RegSetDftEntry("TempleOS/RawHide","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/RawHide");
|
||||
|
||||
F64 t0,tf;
|
||||
I64 outside_cnt;
|
||||
@@ -62,7 +62,7 @@ U0 RiverNew()
|
||||
U0 RiverMake()
|
||||
{
|
||||
I64 i,x,y,dx,dy,w,old_x,old_y;
|
||||
//Plan lower course of river
|
||||
//Plan lower course of river
|
||||
old_x=-1;old_y=-1;
|
||||
x=MAP_WIDTH<<32/2; y=MAP_HEIGHT<<32/2;
|
||||
dx=0; dy=1<<32;
|
||||
@@ -79,7 +79,7 @@ U0 RiverMake()
|
||||
x+=dx; y+=dy;
|
||||
w=ClampI64(w+RandI32*2,10*MAX_U32,150*MAX_U32);
|
||||
}
|
||||
//Plan upper course of river
|
||||
//Plan upper course of river
|
||||
old_x=-1;old_y=-1;
|
||||
x=MAP_WIDTH<<32/2; y=MAP_HEIGHT<<32/2;
|
||||
dx=0; dy=-1<<32;
|
||||
@@ -154,12 +154,17 @@ U0 RiverDropsNext(CTask *mem_task)
|
||||
} else {
|
||||
do {
|
||||
if (RandU16&1 &&
|
||||
GrPeek(map_dc,r_x[tempr->index]+tempr->dx,r_y[tempr->index]+tempr->dy)==BLUE)
|
||||
GrPeek(map_dc,r_x[tempr->index]+tempr->dx,
|
||||
r_y[tempr->index]+tempr->dy)==BLUE)
|
||||
break;
|
||||
tempr->dx=ClampI64(tempr->dx+RandU16%3-1,-r_width[tempr->index]/2,r_width[tempr->index]/2);
|
||||
tempr->dy=ClampI64(tempr->dy+RandU16%3-1,-r_width[tempr->index]/2,r_width[tempr->index]/2);
|
||||
} while (GrPeek(map_dc,r_x[tempr->index]+tempr->dx,r_y[tempr->index]+tempr->dy)!=BLUE &&
|
||||
GrPeek(map_dc,r_x[tempr->index] ,r_y[tempr->index]) ==BLUE); //Might be reinitializing
|
||||
tempr->dx=ClampI64(tempr->dx+RandU16%3-1,-r_width[tempr->index]/2,
|
||||
r_width[tempr->index]/2);
|
||||
tempr->dy=ClampI64(tempr->dy+RandU16%3-1,-r_width[tempr->index]/2,
|
||||
r_width[tempr->index]/2);
|
||||
} while (GrPeek(map_dc,r_x[tempr->index]+tempr->dx,
|
||||
r_y[tempr->index]+tempr->dy)!=BLUE &&
|
||||
GrPeek(map_dc,r_x[tempr->index],
|
||||
r_y[tempr->index])==BLUE); //Might be reinitializing
|
||||
}
|
||||
tempr=tempr1;
|
||||
}
|
||||
@@ -192,8 +197,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
static Bool left=TRUE;
|
||||
F64 t;
|
||||
I64 i,
|
||||
cx=(MAP_WIDTH -task->pix_width)/2,
|
||||
cy=(MAP_HEIGHT-task->pix_height)/2;
|
||||
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)
|
||||
@@ -212,7 +217,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
if (!a[i].dead) {
|
||||
if (a[i].dx<0) {
|
||||
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
|
||||
GrSetSymmetry(dc,a[i].x.i32[1]-cx,0,a[i].x.i32[1]-cx,1);
|
||||
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].ge->img);
|
||||
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
|
||||
@@ -224,11 +229,12 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
left=TRUE;
|
||||
if (left) {
|
||||
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
|
||||
GrSetSymmetry(dc,ip.pos.x-task->pix_left-task->scroll_x,0,ip.pos.x-task->pix_left-task->scroll_x,1);
|
||||
DCSymmetrySet(dc,ip.pos.x-task->pix_left-task->scroll_x,0,
|
||||
ip.pos.x-task->pix_left-task->scroll_x,1);
|
||||
}
|
||||
Sprite3(dc,
|
||||
ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top -task->scroll_y,0,rh_sprite[GE_HORSE].img);
|
||||
ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top -task->scroll_y,0,rh_sprite[GE_HORSE].img);
|
||||
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
|
||||
last_pos_x=ip.pos.x;
|
||||
|
||||
@@ -237,14 +243,15 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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");
|
||||
(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);
|
||||
GrPrint(dc,-task->scroll_x,-task->scroll_y,
|
||||
"Outside:%03d Time:%7.2fs Best:%7.2fs",
|
||||
outside_cnt,t,best_score);
|
||||
}
|
||||
|
||||
U0 BuddySelect(I64 i)
|
||||
@@ -253,8 +260,8 @@ U0 BuddySelect(I64 i)
|
||||
for (b=0;b<NUM_ANIMALS;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]);
|
||||
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;
|
||||
@@ -267,13 +274,13 @@ U0 BuddySelect(I64 i)
|
||||
U0 AnimateTask(CTask *parent)
|
||||
{
|
||||
I64 i,cx,cy,cursor_x,cursor_y,dd,ddx,ddy,cnt,max_speed=MAX_I64,updates=0,
|
||||
my_outside_cnt;
|
||||
my_outside_cnt;
|
||||
F64 f,d,dx,dy,s,stress;
|
||||
Animal *tempa,*tempa1;
|
||||
while (TRUE) {
|
||||
max_speed=ClampU64(max_speed,MAX_U32/3,200*MAX_U32);
|
||||
cx=(MAP_WIDTH -parent->pix_width)/2,
|
||||
cy=(MAP_HEIGHT-parent->pix_height)/2;
|
||||
cy=(MAP_HEIGHT-parent->pix_height)/2;
|
||||
cursor_x=ip.pos.x+cx-parent->pix_left-parent->scroll_x;
|
||||
cursor_y=ip.pos.y+cy-parent->pix_top -parent->scroll_y;
|
||||
cnt=0;stress=0;
|
||||
@@ -293,14 +300,14 @@ U0 AnimateTask(CTask *parent)
|
||||
tempa->dy+=f*dy;
|
||||
}
|
||||
|
||||
//Reselect buddy about every NUM_ANIMALS*10ms=5.12 seconds
|
||||
//Reselect buddy about every NUM_ANIMALS*10ms=5.12 seconds
|
||||
tempa1=&a[tempa->buddy];
|
||||
if (tempa1->dead || i==updates%NUM_ANIMALS) {
|
||||
BuddySelect(i);
|
||||
tempa1=&a[tempa->buddy];
|
||||
}
|
||||
|
||||
//Move toward buddy
|
||||
//Move toward buddy
|
||||
ddx=tempa->x.i32[1]-tempa1->x.i32[1];
|
||||
ddy=tempa->y.i32[1]-tempa1->y.i32[1];
|
||||
if (dd=SqrI64(ddx)+SqrI64(ddy)) {
|
||||
@@ -314,31 +321,34 @@ U0 AnimateTask(CTask *parent)
|
||||
tempa->dy+=f*dy;
|
||||
}
|
||||
|
||||
//Make velocity similar to buddy
|
||||
//Make velocity similar to buddy
|
||||
tempa->dx+=0.1*(tempa1->dx-tempa->dx);
|
||||
tempa->dy+=0.1*(tempa1->dy-tempa->dy);
|
||||
|
||||
//Add random movement, limit speed and dampen speed
|
||||
//Add random movement, limit speed and dampen speed
|
||||
tempa->dx=0.995*ClampI64(tempa->dx+RandI32/32,-max_speed,max_speed);
|
||||
tempa->dy=0.995*ClampI64(tempa->dy+RandI32/32,-max_speed,max_speed);
|
||||
|
||||
//Slow in river
|
||||
//Slow in river
|
||||
if (GrPeek(map_dc,tempa->x.i32[1],tempa->y.i32[1])!=LTGREEN) {
|
||||
tempa->dx/=2;
|
||||
tempa->dy/=2;
|
||||
}
|
||||
|
||||
if (GrPeek(map_dc,(tempa->x+tempa->dx)>>32,(tempa->y+tempa->dy)>>32)!=LTGRAY) {
|
||||
if (GrPeek(map_dc,(tempa->x+tempa->dx)>>32,(tempa->y+tempa->dy)>>32)
|
||||
!=LTGRAY) {
|
||||
tempa->x+=tempa->dx;
|
||||
tempa->y+=tempa->dy;
|
||||
}
|
||||
|
||||
//Keep on map
|
||||
if (!(MAP_BORDER-tempa->ge->min_x<=tempa->x.i32[1]<MAP_WIDTH-MAP_BORDER-tempa->ge->max_x)) {
|
||||
//Keep on map
|
||||
if (!(MAP_BORDER-tempa->ge->min_x
|
||||
<=tempa->x.i32[1]<MAP_WIDTH-MAP_BORDER-tempa->ge->max_x)) {
|
||||
tempa->x -=tempa->dx;
|
||||
tempa->dx=-tempa->dx;
|
||||
}
|
||||
if (!(MAP_BORDER-tempa->ge->min_y<=tempa->y.i32[1]<MAP_HEIGHT-MAP_BORDER-tempa->ge->max_y)) {
|
||||
if (!(MAP_BORDER-tempa->ge->min_y
|
||||
<=tempa->y.i32[1]<MAP_HEIGHT-MAP_BORDER-tempa->ge->max_y)) {
|
||||
tempa->y -=tempa->dy;
|
||||
tempa->dy=-tempa->dy;
|
||||
}
|
||||
@@ -384,10 +394,10 @@ U0 SongTask(I64)
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("3qC2etG3DCBDCECFqFCsADADqB");
|
||||
Play("C2etG3DCBDCECFqFCsADADqB");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
Play("3qC2etG3DCBDCECFqFCsADADqB");
|
||||
Play("C2etG3DCBDCECFqFCsADADqB");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
Play("2sG3A2G3AqG2etG3GDeBBqBFeBAqE");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +426,8 @@ U0 ReInit()
|
||||
|
||||
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);
|
||||
GrBorder(map_dc,MAP_BORDER/2,MAP_BORDER/2,
|
||||
MAP_WIDTH-(MAP_BORDER+1)/2,MAP_HEIGHT-(MAP_BORDER+1)/2);
|
||||
|
||||
for (i=river_lo;i<=river_hi;i++)
|
||||
RiverDropsNext(Fs);
|
||||
@@ -475,19 +486,20 @@ U0 RawHide()
|
||||
"upper-left corner if you scroll.\n\n"
|
||||
"Scroll with $$GREEN$${CTRL-Left Grab}$$FG$$.\n");
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
"}"
|
||||
);
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
"}"
|
||||
);
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
Init;
|
||||
Fs->animate_task=Spawn(&AnimateTask,Fs,"Animate",,Fs);
|
||||
DocCursor;
|
||||
@@ -495,7 +507,8 @@ U0 RawHide()
|
||||
Fs->draw_it=&DrawIt;
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_DOWN);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN: //Doesn't do anything, yet.
|
||||
break;
|
||||
@@ -520,7 +533,7 @@ rh_done:
|
||||
MenuPop;
|
||||
SettingsPop;
|
||||
CleanUp;
|
||||
AcctRegWriteBranch("TempleOS/RawHide","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/RawHide","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
RawHide;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -17,13 +17,13 @@ U0 StadiumGen()
|
||||
gr.fp_final_screen_update=NULL;
|
||||
|
||||
WinMgrSync(2,TRUE);
|
||||
dc2=DCCaptureScreen;
|
||||
dc2=DCScreenCapture;
|
||||
dc=DCExtract(dc2,0,FONT_HEIGHT,GR_WIDTH,GR_HEIGHT);
|
||||
DCDel(dc2);
|
||||
|
||||
GRAWrite("StadiumBG",dc);
|
||||
GRAWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
|
||||
DCDel(dc);
|
||||
|
||||
|
||||
DocCursor(ON);
|
||||
gr.fp_final_screen_update=fp_old_update;
|
||||
DocClear;
|
||||
|
||||
Binary file not shown.
@@ -36,7 +36,7 @@ U0 DrawBoard(I64 player)
|
||||
|
||||
}
|
||||
//ip.pos.x,ip.pos.y are input pointer (mouse) x,y.
|
||||
//ip.lb is mouse left button
|
||||
//ip.lb is mouse left button
|
||||
if (player==1)
|
||||
DrawX(dc,ip.pos.x-Fs->pix_left,ip.pos.y-Fs->pix_top);
|
||||
else
|
||||
|
||||
+46
-33
@@ -1,7 +1,19 @@
|
||||
#define BORDER 16
|
||||
#define NUM_UNITS 64
|
||||
#define CIRCLE_RAD 8
|
||||
#define MOVE_CIRCLES 5
|
||||
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("NUM_UNITS","%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
|
||||
{
|
||||
@@ -16,11 +28,11 @@ Bool show_start;
|
||||
U0 S2Circle(I64 *_x,I64 *_y)
|
||||
{
|
||||
I64 i,j;
|
||||
j=(*_y-BORDER)/(CIRCLE_RAD*2);
|
||||
j=(*_y-BORDER_Y)/(CIRCLE_RAD*2);
|
||||
if (j&1)
|
||||
i=(*_x-CIRCLE_RAD-BORDER)/(CIRCLE_RAD*2);
|
||||
i=(*_x-CIRCLE_RAD-BORDER_X)/(CIRCLE_RAD*2);
|
||||
else
|
||||
i=(*_x-BORDER)/(CIRCLE_RAD*2);
|
||||
i=(*_x-BORDER_X)/(CIRCLE_RAD*2);
|
||||
*_y=j;
|
||||
*_x=i;
|
||||
}
|
||||
@@ -28,8 +40,8 @@ U0 S2Circle(I64 *_x,I64 *_y)
|
||||
U0 Circle2S(I64 *_x,I64 *_y)
|
||||
{
|
||||
I64 j=*_y,i=*_x;
|
||||
*_y=j*CIRCLE_RAD*2+CIRCLE_RAD+BORDER;
|
||||
*_x=i*CIRCLE_RAD*2+CIRCLE_RAD+BORDER;
|
||||
*_y=j*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_Y;
|
||||
*_x=i*CIRCLE_RAD*2+CIRCLE_RAD+BORDER_X;
|
||||
if (j&1) *_x+=CIRCLE_RAD;
|
||||
}
|
||||
|
||||
@@ -80,7 +92,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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");
|
||||
(task->pix_height-FONT_HEIGHT)>>1,"Game Over");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +129,7 @@ U0 CheckForKills(I64 x1,I64 y1,I64 player)
|
||||
found=FALSE;
|
||||
for (j=0;j<NUM_UNITS;j++)
|
||||
if (u[j].alive && u[j].player!=player && !u[j].king &&
|
||||
!u[u[j].link].alive) {
|
||||
!u[u[j].link].alive) {
|
||||
found=TRUE;
|
||||
u[j].alive=FALSE;
|
||||
Snd(500);Sleep(100);Snd(0);Sleep(25);
|
||||
@@ -171,14 +183,14 @@ CDC *DrawHexMap(I64 *_w,I64 *_h)
|
||||
{
|
||||
CDC *dc=DCNew(*_w,*_h);
|
||||
I64 i,j,x,y;
|
||||
*_w=(dc->width-BORDER*2-CIRCLE_RAD)/(CIRCLE_RAD*2);
|
||||
*_h=(dc->height-BORDER*2)/(CIRCLE_RAD*2);
|
||||
*_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++) {
|
||||
y=j*CIRCLE_RAD*2+BORDER+CIRCLE_RAD;
|
||||
x=i*CIRCLE_RAD*2+BORDER+CIRCLE_RAD;
|
||||
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);
|
||||
@@ -191,30 +203,31 @@ CDC *DrawHexMap(I64 *_w,I64 *_h)
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
I64 i,j,dd,best_dd,best,w=Fs->pix_width,h=Fs->pix_height;
|
||||
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<NUM_UNITS/2;i++) {
|
||||
u[i].num=i;
|
||||
u[i+NUM_UNITS/2].num=i+NUM_UNITS/2;
|
||||
|
||||
u[i].y=RandU32%h;
|
||||
u[i].y=FloorI64(RandU32%h,CIRCLE_RAD*2)+CIRCLE_RAD;
|
||||
u[i+NUM_UNITS/2].y=h-1-u[i].y;
|
||||
j=u[i].y/(CIRCLE_RAD*2);
|
||||
u[i].y+=BORDER;
|
||||
u[i+NUM_UNITS/2].y+=BORDER;
|
||||
j1=u[i].y/(CIRCLE_RAD*2);
|
||||
j2=u[i+NUM_UNITS/2].y/(CIRCLE_RAD*2);
|
||||
u[i].y+=BORDER_Y;
|
||||
u[i+NUM_UNITS/2].y+=BORDER_Y;
|
||||
|
||||
if (!i)
|
||||
u[i].x=CIRCLE_RAD;
|
||||
else
|
||||
u[i].x=RandU32%((w-2*BORDER-CIRCLE_RAD*2)/2)+CIRCLE_RAD*2;
|
||||
u[i].x=FloorI64(RandU32%((w-CIRCLE_RAD*2*2)/2),CIRCLE_RAD*2)+CIRCLE_RAD;
|
||||
u[i+NUM_UNITS/2].x=w-1-u[i].x;
|
||||
if (j&1) {
|
||||
if (j1&1)
|
||||
u[i].x+=CIRCLE_RAD;
|
||||
if (j2&1)
|
||||
u[i+NUM_UNITS/2].x+=CIRCLE_RAD;
|
||||
}
|
||||
u[i].x+=BORDER;
|
||||
u[i+NUM_UNITS/2].x+=BORDER;
|
||||
u[i].x+=BORDER_X;
|
||||
u[i+NUM_UNITS/2].x+=BORDER_X;
|
||||
|
||||
S2W(&u[i].x,&u[i].y);
|
||||
S2W(&u[i+NUM_UNITS/2].x,&u[i+NUM_UNITS/2].y);
|
||||
@@ -243,7 +256,7 @@ U0 Init()
|
||||
for (j=0;j<NUM_UNITS/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) {
|
||||
if (u[j].x<=u[i].x && dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best=j;
|
||||
}
|
||||
@@ -268,7 +281,7 @@ U0 TreeCheckers()
|
||||
Unit *tempu;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
@@ -281,13 +294,12 @@ U0 TreeCheckers()
|
||||
WinMax;
|
||||
WinBorder;
|
||||
AutoComplete;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
DocCursor;
|
||||
DocClear;
|
||||
PopUpOk("Step on the link mid points.\n"
|
||||
"Make a computer player or\n"
|
||||
"modify the rules.\n");
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_FOCUS_TASK_MENU;
|
||||
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;
|
||||
@@ -295,7 +307,8 @@ cn_start:
|
||||
show_start=FALSE;
|
||||
Fs->draw_it=&DrawIt;
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
|
||||
+48
-42
@@ -87,8 +87,8 @@
|
||||
|
||||
|
||||
|
||||
AcctRegSetDftEntry("TempleOS/Varoom","F64 best_score=9999;\n");
|
||||
AcctRegExeBranch("TempleOS/Varoom");
|
||||
RegSetDftEntry("TempleOS/Varoom","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/Varoom");
|
||||
|
||||
F64 distance,t0,tf;
|
||||
Bool game_over;
|
||||
@@ -164,17 +164,17 @@ U0 InitTrack()
|
||||
I64 i;
|
||||
for (i=0;i<SLICES;i++) {
|
||||
InitTrackPoly(tempt++,DKGRAY,TRACK_INNER,TRACK_OUTER,
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
if (i&1) {
|
||||
InitTrackPoly(tempt++,RED,TRACK_INNER-SHOULDER,TRACK_INNER,
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
InitTrackPoly(tempt++,WHITE,TRACK_OUTER,TRACK_OUTER+SHOULDER,
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
} else {
|
||||
InitTrackPoly(tempt++,WHITE,TRACK_INNER-SHOULDER,TRACK_INNER,
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
InitTrackPoly(tempt++,RED,TRACK_OUTER,TRACK_OUTER+SHOULDER,
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
i*2*ã/SLICES,(i+1)*2*ã/SLICES);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,9 +187,9 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
{
|
||||
CTask *task=dc2->win_task;
|
||||
I64 i,j,x,y,z,lo,hi,
|
||||
w=task->pix_width,
|
||||
h=task->pix_height,r[16],
|
||||
cx=w>>1;
|
||||
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 *tempc;
|
||||
Bool draw;
|
||||
@@ -197,9 +197,9 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
TrackPoly *tempt;
|
||||
CDC *dc=DCAlias(gr.dc2,task);
|
||||
|
||||
GrIdentEqu(r);
|
||||
GrRotYEqu(r,ã-c[0].é);
|
||||
GrRotXEqu(r,75*ã/180-dip_é);
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,ã-c[0].é);
|
||||
Mat4x4RotX(r,75*ã/180-dip_é);
|
||||
|
||||
dc->depth_buf=dc2->depth_buf;
|
||||
|
||||
@@ -210,8 +210,10 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
dc->color=tempt->c;
|
||||
draw=TRUE;
|
||||
for (j=0;j<4;j++) {
|
||||
x=tempt->p[j].x-c[0].p.x; y=tempt->p[j].y-c[0].p.y; z=tempt->p[j].z-c[0].p.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
x=tempt->p[j].x-c[0].p.x;
|
||||
y=tempt->p[j].y-c[0].p.y;
|
||||
z=tempt->p[j].z-c[0].p.z;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
poly[j].y=s*y+h;
|
||||
if (z<-200 || !(-h<poly[j].y<2*h)) {
|
||||
@@ -228,15 +230,15 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
for (i=Gs->num;i<NUM_BUSHES;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;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
if (z>0) {
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
GrIdentEqu(dc->r);
|
||||
GrScaleEqu(dc->r,s*2);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
if (b[i].sym) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
GrSetSymmetry(dc,s*x+cx,s*y+h,s*x+cx,s*y+h+10);
|
||||
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);
|
||||
@@ -245,14 +247,14 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
for (i=Gs->num+1;i<NUM_CARS;i+=mp_cnt) {
|
||||
tempc=&c[i];
|
||||
x=tempc->p.x-c[0].p.x; y=tempc->p.y-c[0].p.y; z=tempc->p.z-c[0].p.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
if (z>0) {
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
GrIdentEqu(dc->r);
|
||||
GrScaleEqu(dc->r,s*2);
|
||||
GrRotXEqu(dc->r,Dipé(tempc->p.x,tempc->p.z,-tempc->é));
|
||||
GrRotYEqu(dc->r,tempc->é-c[0].é);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
Mat4x4RotX(dc->r,Dipé(tempc->p.x,tempc->p.z,-tempc->é));
|
||||
Mat4x4RotY(dc->r,tempc->é-c[0].é);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
Sprite3B(dc,s*x+cx,s*y+h,z+GR_Z_ALL,tempc->img);
|
||||
}
|
||||
}
|
||||
@@ -264,7 +266,7 @@ U0 MPUpdateWin(CDC *dc2)
|
||||
U0 VRTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
|
||||
{
|
||||
I64 zz;
|
||||
GrRot(dc->r,x,y,z);
|
||||
Mat4x4MulXYZ(dc->r,x,y,z);
|
||||
zz=400+*z;
|
||||
if (zz<1) zz=1;
|
||||
*x=400* *x/zz;
|
||||
@@ -285,15 +287,15 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=LTCYAN;
|
||||
GrRect(dc,0,0,w,HORIZON_DIP*Sin(dip_é)+FONT_HEIGHT*4.5);
|
||||
|
||||
GrIdentEqu(r);
|
||||
GrRotYEqu(r,ã-c[0].é);
|
||||
GrRotXEqu(r,75*ã/180-dip_é);
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,ã-c[0].é);
|
||||
Mat4x4RotX(r,75*ã/180-dip_é);
|
||||
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
|
||||
//Sun
|
||||
x=c[0].p.x; y=0; z=1000000-c[0].p.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
if (y<0) {
|
||||
dc->color=BROWN;
|
||||
@@ -314,9 +316,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
è=0.5;
|
||||
else
|
||||
è=0;
|
||||
GrIdentEqu(r);
|
||||
GrRotYEqu(r,è);
|
||||
GrRotXEqu(r,0.4-8*dip_é); //Made this up
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,è);
|
||||
Mat4x4RotX(r,0.4-8*dip_é); //Made this up
|
||||
dc->transform=&VRTransform;
|
||||
dc->x=task->pix_width>>1;
|
||||
dc->y=task->pix_height-150;
|
||||
@@ -328,7 +330,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrRect(dc,w-64,h-64,64,64);
|
||||
dc->color=LTGREEN;
|
||||
for (i=0;i<NUM_BUSHES;i++)
|
||||
GrPlot(dc,w-64+64*(0x5000-b[i].p.x)/0xA000,h-64*(-b[i].p.z+0x5000)/0xA000);
|
||||
GrPlot(dc,w-64+64*(0x5000-b[i].p.x)/0xA000,
|
||||
h-64*(-b[i].p.z+0x5000)/0xA000);
|
||||
|
||||
dc->pen_width=2;
|
||||
for (i=0;i<NUM_CARS;i++) {
|
||||
@@ -336,7 +339,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=LTPURPLE;
|
||||
else
|
||||
dc->color=LTCYAN;
|
||||
GrPlot3(dc,w-64+64*(0x5000-c[i].p.x)/0xA000,h-64*(-c[i].p.z+0x5000)/0xA000,0);
|
||||
GrPlot3(dc,w-64+64*(0x5000-c[i].p.x)/0xA000,
|
||||
h-64*(-c[i].p.z+0x5000)/0xA000,0);
|
||||
}
|
||||
|
||||
if (game_over) {
|
||||
@@ -354,7 +358,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
s=tS-t0;
|
||||
dc->color=BLACK;
|
||||
GrPrint(dc,0,0,"é:%0.1f %0.1f%% Time:%0.2f Best:%0.2f",
|
||||
180+180/ã*Arg(c[0].p.x,c[0].p.z),100.0*distance/(2*ã*TRACK_INNER),s,best_score);
|
||||
180+180/ã*Arg(c[0].p.x,c[0].p.z),
|
||||
100.0*distance/(2*ã*TRACK_INNER),s,best_score);
|
||||
}
|
||||
|
||||
U0 AnimateTask(I64)
|
||||
@@ -417,7 +422,7 @@ U0 Init()
|
||||
tempb->p.x=RandU32&0x7FFF-0x4000;
|
||||
tempb->p.z=RandU32&0x7FFF-0x4000;
|
||||
} while (TRACK_INNER-SHOULDER<=
|
||||
Sqrt(SqrI64(tempb->p.x)+SqrI64(tempb->p.z))<=TRACK_OUTER+SHOULDER);
|
||||
Sqrt(SqrI64(tempb->p.x)+SqrI64(tempb->p.z))<=TRACK_OUTER+SHOULDER);
|
||||
tempb->p.y=DipY(tempb->p.x,tempb->p.z);
|
||||
tempb->sym=RandU16&1;
|
||||
tempb->img=imgs[i&7];
|
||||
@@ -462,11 +467,12 @@ U0 Varoom()
|
||||
SettingsPush(,TSF_SAME_SONG); //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;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
|
||||
AutoComplete;
|
||||
WinMax;
|
||||
WinBorder;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
Init;
|
||||
DocCursor;
|
||||
DocClear;
|
||||
@@ -502,7 +508,7 @@ vr_done: //Don't goto out of try
|
||||
Fs->catch_except=TRUE;
|
||||
SettingsPop(,TSF_SAME_SONG);
|
||||
MenuPop;
|
||||
AcctRegWriteBranch("TempleOS/Varoom","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/Varoom","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
Varoom;
|
||||
|
||||
+25
-21
@@ -1,5 +1,5 @@
|
||||
AcctRegSetDftEntry("TempleOS/Wenceslas","F64 best_score=9999;\n");
|
||||
AcctRegExeBranch("TempleOS/Wenceslas");
|
||||
RegSetDftEntry("TempleOS/Wenceslas","F64 best_score=9999;\n");
|
||||
RegExeBranch("TempleOS/Wenceslas");
|
||||
|
||||
#define BORDER 5
|
||||
#define KING_STEP 6
|
||||
@@ -8,7 +8,8 @@ AcctRegExeBranch("TempleOS/Wenceslas");
|
||||
|
||||
|
||||
|
||||
$SP,"<1>",BI=1$
|
||||
$SP,"<1>",BI=1$ //See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$ for making 3D men.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -127,7 +128,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
Step *tempst;
|
||||
Peasant *tempp;
|
||||
F64 tt;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
dc->pen_width=1;
|
||||
for (i=0;i<NUM_TREES;i++) {
|
||||
@@ -171,14 +172,14 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tempst=tempst->next;
|
||||
}
|
||||
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
dc->pen_width=1;
|
||||
tempp=peasant_root.next;
|
||||
while (tempp!=&peasant_root) {
|
||||
GrIdentEqu(r);
|
||||
GrRotYEqu(r,tempp->é+ã/2);
|
||||
GrRotXEqu(r,ã/6);
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,tempp->é+ã/2);
|
||||
Mat4x4RotX(r,ã/6);
|
||||
if (tempp->stopped)
|
||||
SpriteMat3B(dc,tempp->x,tempp->y,GR_Z_ALL,peasant_imgs[0],r);
|
||||
else {
|
||||
@@ -193,9 +194,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
|
||||
dc->pen_width=1;
|
||||
GrIdentEqu(r);
|
||||
GrRotYEqu(r,king_é+ã/2);
|
||||
GrRotXEqu(r,ã/6);
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,king_é+ã/2);
|
||||
Mat4x4RotX(r,ã/6);
|
||||
if (tS>king_timeout)
|
||||
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,king_imgs[0],r);
|
||||
else {
|
||||
@@ -268,7 +269,7 @@ U0 StepNew(CTask *task,I64 x,I64 y,F64
|
||||
U0 Init()
|
||||
{
|
||||
I64 i,min_x,max_x,min_y,max_y,
|
||||
w=Fs->pix_width,h=Fs->pix_height;
|
||||
w=Fs->pix_width,h=Fs->pix_height;
|
||||
Peasant *tempp;
|
||||
snow_x=0;
|
||||
snow_y=0;
|
||||
@@ -324,7 +325,7 @@ U0 Follow(CTask *,Peasant *tempp)
|
||||
F64 d,best_d=MAX_F64;
|
||||
while (temps!=&king_step_root) {
|
||||
if ((d=Sqr(temps->x-tempp->x)+Sqr(temps->y-tempp->y)) &&
|
||||
d<15*15) {
|
||||
d<15*15) {
|
||||
d+=1000*Sqr(tS-temps->t0);
|
||||
if (d<best_d) {
|
||||
best_d=d;
|
||||
@@ -378,7 +379,8 @@ U0 AnimateTask(I64)
|
||||
tempp->door_opened_t0=door_open_t0=tS;
|
||||
}
|
||||
for (i=0;i<NUM_TREES;i++) //Hang-out by fire
|
||||
if (trees[i].fire_frame_index && Sqr(tempp->x-trees[i].x)+Sqr(tempp->y-trees[i].y)<20*20) {
|
||||
if (trees[i].fire_frame_index &&
|
||||
Sqr(tempp->x-trees[i].x)+Sqr(tempp->y-trees[i].y)<20*20) {
|
||||
tempp->stopped=TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -386,13 +388,15 @@ U0 AnimateTask(I64)
|
||||
Follow(Fs->parent_task,tempp);
|
||||
tempp->x+=Cos(tempp->é)/100;
|
||||
tempp->y+=Sin(tempp->é)/100;
|
||||
if (!(BORDER/2<=tempp->x<w-BORDER/2) || !(BORDER/2<=tempp->y<h-BORDER/2)) {
|
||||
if (!(BORDER/2<=tempp->x<w-BORDER/2) ||
|
||||
!(BORDER/2<=tempp->y<h-BORDER/2)) {
|
||||
tempp->é+=ã;
|
||||
tempp->x+=3*Cos(tempp->é)/100;
|
||||
tempp->y+=3*Sin(tempp->é)/100;
|
||||
}
|
||||
if (!animate_mS && animate_phase&1)
|
||||
StepNew(Fs->parent_task,tempp->x,tempp->y,tempp->é,animate_phase&2,FALSE);
|
||||
StepNew(Fs->parent_task,tempp->x,tempp->y,tempp->é,
|
||||
animate_phase&2,FALSE);
|
||||
not_stopped_cnt++;
|
||||
}
|
||||
}
|
||||
@@ -442,9 +446,9 @@ U0 SongTask(I64)
|
||||
music.tempo= 2.480;
|
||||
music.stacatto_factor= 0.902;
|
||||
while (TRUE) {
|
||||
Play("3eCCCDCC2qG3eA2G3ABqCC");
|
||||
Play("eCCCDCC2qG3eA2G3ABqCC");
|
||||
Play("eGFEDEDqCeA2G3ABqCC");
|
||||
Play("3eCCCDCC2qG3eA2G3ABqCC");
|
||||
Play("eCCCDCC2qG3eA2G3ABqCC");
|
||||
Play("eGFEDEDqCeA2G3ABqCC");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,7 +473,7 @@ U0 Wenceslas()
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
|
||||
PopUpOk("
|
||||
@@ -588,7 +592,7 @@ ws_done:
|
||||
SettingsPop;
|
||||
MenuPop;
|
||||
CleanUp;
|
||||
AcctRegWriteBranch("TempleOS/Wenceslas","F64 best_score=%5.4f;\n",best_score);
|
||||
RegWriteBranch("TempleOS/Wenceslas","F64 best_score=%5.4f;\n",best_score);
|
||||
}
|
||||
|
||||
Wenceslas;
|
||||
|
||||
+18
-16
@@ -13,8 +13,8 @@ F64 collision_t;
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 i,
|
||||
cx=task->pix_width>>1,
|
||||
cy=task->pix_height>>1;
|
||||
cx=task->pix_width>>1,
|
||||
cy=task->pix_height>>1;
|
||||
Bool snd_on=FALSE;
|
||||
dc->color=BLACK;
|
||||
GrPrint(dc,0,0,"Protect your base.");
|
||||
@@ -23,11 +23,11 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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,
|
||||
ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top-task->scroll_y);
|
||||
ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top-task->scroll_y);
|
||||
for (i=0;i<NUM_SPRINGS;i++)
|
||||
GrLine(dc,springs[i].end1->x,springs[i].end1->y,
|
||||
springs[i].end2->x,springs[i].end2->y);
|
||||
springs[i].end2->x,springs[i].end2->y);
|
||||
|
||||
dc->color=LTCYAN;
|
||||
GrCircle(dc,balls[0].x,balls[0].y,BALL_RADIUS);
|
||||
@@ -40,7 +40,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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)
|
||||
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);
|
||||
@@ -58,15 +58,17 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
|
||||
CD3 p,p2;
|
||||
CTask *task=ode->win_task;
|
||||
|
||||
D3SubEqu(D3Equ(&p2,ip.pos.x-task->pix_left-task->scroll_x,ip.pos.y-task->pix_top-task->scroll_y,0),
|
||||
&balls[0].state->x);
|
||||
D3SubEqu(D3Equ(&p2,
|
||||
ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.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<NUM_BALLS;i++) {
|
||||
D3Sub(&p2,&balls[i].state->x,&p);
|
||||
if (d=D3Norm(&p)) {
|
||||
//Gravity would be /(d*d*d), but that's too exponential.
|
||||
//Gravity would be /(d*d*d), but that's too exponential.
|
||||
D3MulEqu(&p,GRAVITY/d);
|
||||
D3AddEqu(&balls[i].DstateDt->DxDt,&p);
|
||||
}
|
||||
@@ -110,14 +112,14 @@ U0 Whap()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
);
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
);
|
||||
ode->derivative=&MyDerivative;
|
||||
ode->drag_v2=0.002;
|
||||
ode->drag_v3=0.00001;
|
||||
@@ -126,7 +128,7 @@ U0 Whap()
|
||||
D3Equ(&balls[0].x,100,100,0);
|
||||
for (i=1;i<NUM_BALLS;i++)
|
||||
D3Equ(&balls[i].x,
|
||||
RandI16%500+Fs->pix_width>>1,RandI16%500+Fs->pix_height>>1,0);
|
||||
RandI16%500+Fs->pix_width>>1,RandI16%500+Fs->pix_height>>1,0);
|
||||
balls[0].x=ip.pos.x-Fs->pix_left-Fs->scroll_x;
|
||||
balls[0].y=ip.pos.y-Fs->pix_top-Fs->scroll_y;
|
||||
for (i=0;i<NUM_BALLS;i++) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+7
-7
@@ -19,9 +19,9 @@ D(g1,sizeof(g1));
|
||||
U0 Main1()
|
||||
{
|
||||
static Test s1[]={
|
||||
{10,"Static1"},
|
||||
{(tS%10.0)*100,"Static2"}, //Dynamic initialization
|
||||
{30,"Static3"}
|
||||
{10,"Static1"},
|
||||
{(tS%10.0)*100,"Static2"}, //Dynamic initialization
|
||||
{30,"Static3"}
|
||||
};
|
||||
D(s1,sizeof(s1));
|
||||
"Time 2:%d\n",s1[1].time;
|
||||
@@ -50,7 +50,7 @@ because they don't take-up room in the .BIN.Z file.
|
||||
|
||||
Test g2[]={
|
||||
{10,"name1"},
|
||||
{(tS%10.0)*100,"name2"}, //No dynamic initialization--converted to a const
|
||||
{(tS%10.0)*100,"name2"}, //No dynamic initialization--cvted to const
|
||||
{30,"name3"}
|
||||
};
|
||||
|
||||
@@ -60,9 +60,9 @@ D(g2,sizeof(g2));
|
||||
U0 Main2()
|
||||
{
|
||||
static Test s2[]={
|
||||
{10,"static1"},
|
||||
{(tS%10.0)*100,"static2"}, //No dynamic initialization--converted to a const
|
||||
{30,"static3"}
|
||||
{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;
|
||||
|
||||
+13
-13
@@ -3,29 +3,29 @@ U0 Main()
|
||||
F64 é=0,è=0,ê=0;
|
||||
CD3I32 poly[4];
|
||||
CDC *dc=DCAlias;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
dc->flags|=DCF_TRANSFORMATION|DCF_SYMMETRY;
|
||||
try {
|
||||
while (!ScanChar) {
|
||||
DCDepthBufRst(dc);
|
||||
GrSetSymmetry(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
DCSymmetrySet(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
dc->color=LTBLUE;
|
||||
GrLine(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotXEqu(dc->r,ê);
|
||||
GrRotYEqu(dc->r,è);
|
||||
GrRotZEqu(dc->r,é);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.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;
|
||||
|
||||
+14
-14
@@ -12,24 +12,24 @@ U0 Balloon()
|
||||
|
||||
CLI
|
||||
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0xF);
|
||||
MemSetI64(0xA0000,0,640*480/64);
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0xF);
|
||||
MemSetI64(0xA0000,0,640*480/64);
|
||||
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,RED+GREEN+8);
|
||||
for (k=100;k<150;k++) {
|
||||
OutU8(VGAP_INDEX,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++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
|
||||
|
||||
BusyWait(40000);
|
||||
BusyWait(40000);
|
||||
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=0;
|
||||
}
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=0;
|
||||
}
|
||||
|
||||
STI
|
||||
VGAFlush;
|
||||
|
||||
@@ -2,7 +2,7 @@ CDC *dc;
|
||||
|
||||
U0 DrawIt(CTask *,CDC *)
|
||||
{//This technique is weird, but clever. In Box() we
|
||||
//created an alias of the system $LK,"gr.dc2",A="MN:CGrGlbls"$.
|
||||
//created an alias of the system $LK,"gr.dc2",A="MN:CGrGlbls"$.
|
||||
dc->pen_width=2;
|
||||
dc->color=RED;
|
||||
GrLine3(dc,-100,-100,-100, -100, 100,-100);
|
||||
@@ -27,18 +27,18 @@ U0 Box()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
DocClear;
|
||||
Fs->draw_it=&DrawIt;
|
||||
Preempt(OFF); //We don't want matrix used while we're changing it.
|
||||
Preempt; //We don't want matrix used while we're changing it.
|
||||
|
||||
dc->x=200;
|
||||
dc->y=200;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
while (!ScanChar) {
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,é);
|
||||
GrRotXEqu(dc->r,è);
|
||||
GrRotZEqu(dc->r,ê);
|
||||
GrScaleEqu(dc->r,s);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,ê);
|
||||
Mat4x4Scale(dc->r,s);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
Sleep(20);
|
||||
é+=2*ã/70;
|
||||
|
||||
Binary file not shown.
@@ -12,8 +12,8 @@ U0 Cartesian()
|
||||
do {
|
||||
DocClear;
|
||||
"Enter algebraic equation to graph.\n"
|
||||
"Example: y=2*x\n"
|
||||
"y=";
|
||||
"Example: y=2*x\n"
|
||||
"y=";
|
||||
if (st=GetStr) {
|
||||
if (*st) {
|
||||
h=Fs->pix_width/2;
|
||||
@@ -35,7 +35,7 @@ U0 Cartesian()
|
||||
ch=CH_SHIFT_ESC;
|
||||
Free(st);
|
||||
} else
|
||||
ch=CH_SHIFT_ESC;
|
||||
ch=CH_SHIFT_ESC;
|
||||
DCFill;
|
||||
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
|
||||
DCDel(dc);
|
||||
|
||||
Binary file not shown.
@@ -20,7 +20,8 @@ U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
if (tempn->left) {
|
||||
ShowTree(dc,tempn->left,&node_x,_tree_x,y+Y_SPACING);
|
||||
dc->color=BLUE;
|
||||
GrArrow3(dc,*_tree_x,y,0,node_x+ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
GrArrow3(dc,*_tree_x,y,0,
|
||||
node_x+ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
}
|
||||
if (tempn->n==n1 || tempn->n==n2) {
|
||||
if (tempn->n==common_ancestor)
|
||||
@@ -31,15 +32,16 @@ U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
dc->color=GREEN;
|
||||
else
|
||||
dc->color=BLUE;
|
||||
|
||||
|
||||
*_node_x=*_tree_x;
|
||||
GrPrint(dc,*_node_x,y,"%d",tempn->n);
|
||||
*_tree_x+=X_SPACING;
|
||||
|
||||
|
||||
if (tempn->right) {
|
||||
ShowTree(dc,tempn->right,&node_x,_tree_x,y+Y_SPACING);
|
||||
dc->color=BLUE;
|
||||
GrArrow3(dc,*_node_x,y,0,node_x-ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
GrArrow3(dc,*_node_x,y,0,
|
||||
node_x-ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,12 +72,12 @@ U0 TreeNew()
|
||||
for (i=0;i<N;i++) {
|
||||
tempn=CAlloc(sizeof(Node));
|
||||
tempn->n=RandU16%N;
|
||||
|
||||
|
||||
if (i==N-1)
|
||||
n1=tempn->n;
|
||||
else if (i==N-2)
|
||||
n2=tempn->n;
|
||||
|
||||
|
||||
TreeAdd(&root,tempn);
|
||||
Sleep(50);
|
||||
}
|
||||
@@ -96,7 +98,7 @@ U0 TreeCommonAncestor()
|
||||
{//Make tree and find common ancestor to n1 & n2.
|
||||
root=NULL;
|
||||
n1=n2=common_ancestor=0;
|
||||
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->draw_it=&DrawIt;
|
||||
DocClear;
|
||||
|
||||
@@ -4,7 +4,7 @@ U0 Doodle()
|
||||
{
|
||||
I64 msg_code,i,x1,y1,x2,y2,a1,a2,color=BLACK;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
|
||||
@@ -15,8 +15,8 @@ U0 Doodle()
|
||||
DocClear;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_UP:
|
||||
i=PopUpColor;
|
||||
@@ -30,7 +30,7 @@ U0 Doodle()
|
||||
while (msg_code!=MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+21
-19
@@ -1,9 +1,11 @@
|
||||
/*After making a font, you can save it as a binary
|
||||
file with:
|
||||
/*After making a font...
|
||||
|
||||
You can save it as a binary file with:
|
||||
FileWrite("filename.BIN.Z",text.font,256*FONT_HEIGHT);
|
||||
|
||||
You can load it with:
|
||||
U8 *myfont=FileRead("filename.BIN");
|
||||
text.font=myfont; //preserve text.font if you want to go back.
|
||||
U64 *my_font=FileRead("filename.BIN.Z");
|
||||
text.font=my_font; //preserve text.font if you want to go back.
|
||||
|
||||
If you want to change the system font permanently,
|
||||
save to a file with this font editor program
|
||||
@@ -33,7 +35,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
c=(BLUE<<4+WHITE)<<8 + k++;
|
||||
TextChar(task,,j,i,c);
|
||||
}
|
||||
|
||||
|
||||
k=0;
|
||||
for (i=0;i<FONT_HEIGHT;i++)
|
||||
for (j=0;j<FONT_WIDTH;j++) {
|
||||
@@ -42,8 +44,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
dc->color=BLUE;
|
||||
GrRect(dc,BLOW_UP_CHAR_X+j*FONT_WIDTH,
|
||||
BLOW_UP_CHAR_Y+i*FONT_HEIGHT,
|
||||
FONT_WIDTH,FONT_HEIGHT);
|
||||
BLOW_UP_CHAR_Y+i*FONT_HEIGHT,
|
||||
FONT_WIDTH,FONT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +53,10 @@ U0 FESave(Bool pmt)
|
||||
{
|
||||
U8 old_draw_it=Fs->draw_it;
|
||||
CDoc *doc=DocNew;
|
||||
I64 i,j,k=0;
|
||||
I64 i;
|
||||
for (i=0;i<256;i++) {
|
||||
for (j=0;j<FONT_HEIGHT;j++)
|
||||
DocPrint(doc,"0x%02X,",text.font(U8 *)[k++]);
|
||||
if (Bt(chars_bitmap_safe_dollar,i))
|
||||
DocPrint(doc,"0x%016X,",text.font[i]);
|
||||
if (Bt(chars_bmp_safe_dollar,i))
|
||||
DocPrint(doc,"//%c",i);
|
||||
else if (i=='$$')
|
||||
DocPrint(doc,"//$$$$",i);
|
||||
@@ -72,11 +73,11 @@ U0 FontEd()
|
||||
I64 msg_code,a1,a2,k;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
MenuPush(
|
||||
"File {"
|
||||
" SaveAs(,CH_CTRLA);"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}");
|
||||
"File {"
|
||||
" SaveAs(,CH_CTRLA);"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}");
|
||||
AutoComplete;
|
||||
DocClear;
|
||||
DocCursor;
|
||||
@@ -85,7 +86,8 @@ U0 FontEd()
|
||||
try {
|
||||
Fs->draw_it=&DrawIt;
|
||||
while (TRUE) {
|
||||
switch (msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE)) {
|
||||
switch (msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case 0:
|
||||
@@ -120,13 +122,13 @@ U0 FontEd()
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_IP_R_DOWN:
|
||||
if (0<=a1<FONT_WIDTH*16 &&
|
||||
0<=a2<FONT_HEIGHT*16) {
|
||||
0<=a2<FONT_HEIGHT*16) {
|
||||
cur_ch=(a2/FONT_HEIGHT)*16+a1/FONT_WIDTH;
|
||||
break;
|
||||
} //fall through
|
||||
case MSG_IP_MOVE:
|
||||
k=((a2-BLOW_UP_CHAR_Y)/FONT_HEIGHT)*FONT_WIDTH+
|
||||
(a1-BLOW_UP_CHAR_X)/FONT_WIDTH;
|
||||
(a1-BLOW_UP_CHAR_X)/FONT_WIDTH;
|
||||
if (0<=k<FONT_WIDTH*FONT_HEIGHT) {
|
||||
if (ip.lb||msg_code==MSG_IP_L_DOWN)
|
||||
Bts(&text.font[cur_ch],k);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#define GRID 5
|
||||
|
||||
U0 DrawMyInputPtr(CDC *dc,I64 x,I64 y)
|
||||
{
|
||||
dc->pen_width=1;
|
||||
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
|
||||
GrRect(dc,x,y,GRID,GRID);
|
||||
}
|
||||
|
||||
U0 GridDemo()
|
||||
{
|
||||
CGridGlbls old_grid;
|
||||
U0 (*old_draw_input_ptr)(CDC *dc,I64 x,I64 y); //Can't init this type of var.
|
||||
MemCpy(&old_grid,&ip_grid,sizeof(CGridGlbls));
|
||||
GridInit;
|
||||
ip_grid.snap=TRUE; //You can set other $LK,"stuff",A="MN:CGridGlbls"$.
|
||||
ip_grid.x=GRID;
|
||||
ip_grid.y=GRID;
|
||||
old_draw_input_ptr=gr.fp_draw_input_ptr;
|
||||
gr.fp_draw_input_ptr=&DrawMyInputPtr;
|
||||
while (!ip.lb) //Left button to exit.
|
||||
GrPlot(,ip.pos.x,ip.pos.y);
|
||||
DCFill;
|
||||
gr.fp_draw_input_ptr=old_draw_input_ptr;
|
||||
MemCpy(&ip_grid,&old_grid,sizeof(CGridGlbls));
|
||||
}
|
||||
|
||||
GridDemo;
|
||||
+26
-13
@@ -34,7 +34,8 @@ U0 SetDisksRestXY()
|
||||
I64 i;
|
||||
for (i=0;i<NUM_DISKS;i++) {
|
||||
disks_x[i]=poles_x[disks_pole[i]];
|
||||
disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
|
||||
disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT
|
||||
-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,22 +47,30 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
poles_x[i]=(1+i)*task->pix_width/4;
|
||||
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,poles_x[0]-50,task->pix_height-PEDESTAL_HEIGHT,poles_x[2]-poles_x[0]+100,PEDESTAL_HEIGHT-FONT_HEIGHT);
|
||||
GrRect(dc,poles_x[0]-50,task->pix_height-PEDESTAL_HEIGHT,
|
||||
poles_x[2]-poles_x[0]+100,PEDESTAL_HEIGHT-FONT_HEIGHT);
|
||||
dc->color=DKGRAY;
|
||||
GrRect(dc,poles_x[0]-49,task->pix_height-PEDESTAL_HEIGHT+1,poles_x[2]-poles_x[0]+98,PEDESTAL_HEIGHT-FONT_HEIGHT-2);
|
||||
GrRect(dc,poles_x[0]-49,task->pix_height-PEDESTAL_HEIGHT+1,
|
||||
poles_x[2]-poles_x[0]+98,PEDESTAL_HEIGHT-FONT_HEIGHT-2);
|
||||
|
||||
for (i=0;i<3;i++) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,poles_x[i]-3,task->pix_height-PEDESTAL_HEIGHT-(NUM_DISKS+1)*(DISK_HEIGHT+1),7,(NUM_DISKS+1)*(DISK_HEIGHT+1));
|
||||
GrRect(dc,poles_x[i]-3,
|
||||
task->pix_height-PEDESTAL_HEIGHT-(NUM_DISKS+1)*(DISK_HEIGHT+1),
|
||||
7,(NUM_DISKS+1)*(DISK_HEIGHT+1));
|
||||
dc->color=YELLOW;
|
||||
GrRect(dc,poles_x[i]-2,task->pix_height-PEDESTAL_HEIGHT+1-(NUM_DISKS+1)*(DISK_HEIGHT+1),5,(NUM_DISKS+1)*(DISK_HEIGHT+1)-1);
|
||||
GrRect(dc,poles_x[i]-2,
|
||||
task->pix_height-PEDESTAL_HEIGHT+1-(NUM_DISKS+1)*(DISK_HEIGHT+1),
|
||||
5,(NUM_DISKS+1)*(DISK_HEIGHT+1)-1);
|
||||
}
|
||||
|
||||
for (i=0;i<NUM_DISKS;i++) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH,disks_y[i]-DISK_HEIGHT/2,(i+1)*(DISK_UNIT_WIDTH*2)+1,DISK_HEIGHT);
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH,
|
||||
disks_y[i]-DISK_HEIGHT/2,(i+1)*(DISK_UNIT_WIDTH*2)+1,DISK_HEIGHT);
|
||||
dc->color=gr_rainbow_10[i];
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH+1,disks_y[i]-DISK_HEIGHT/2+1,(i+1)*(DISK_UNIT_WIDTH*2)-1,DISK_HEIGHT-2);
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH+1,
|
||||
disks_y[i]-DISK_HEIGHT/2+1,(i+1)*(DISK_UNIT_WIDTH*2)-1,DISK_HEIGHT-2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,23 +90,27 @@ U0 MoveDisks(I64 src_pole,I64 dst_pole,I64 num)
|
||||
"$$CM+BY,0,0$$Disk:%d from %d to %d\n",TopDisk(src_pole),src_pole,dst_pole;
|
||||
|
||||
top=TopDisk(src_pole);
|
||||
for (y=disks_y[top];y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-(DISK_HEIGHT+1)*(NUM_DISKS+2);y--) {
|
||||
for (y=disks_y[top];
|
||||
y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2
|
||||
-(DISK_HEIGHT+1)*(NUM_DISKS+2);y--) {
|
||||
disks_y[top]=y;
|
||||
MySleep;
|
||||
}
|
||||
if (src_pole<dst_pole)
|
||||
for (x=poles_x[src_pole];x<=poles_x[dst_pole];x++) {
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
}
|
||||
else
|
||||
for (x=poles_x[src_pole];x>=poles_x[dst_pole];x--) {
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
}
|
||||
|
||||
disks_pole[top]=dst_pole;
|
||||
for (y=disks_y[top];y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
|
||||
for (y=disks_y[top];
|
||||
y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1
|
||||
-(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
|
||||
disks_y[top]=y;
|
||||
MySleep;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
U0 InputPointer()
|
||||
{
|
||||
while (!ip.lb) //Left Button
|
||||
"Press left mouse button to exit.\n";
|
||||
while (!ip.lb) //Left button to exit.
|
||||
GrPlot(,ip.pos.x,ip.pos.y);
|
||||
DCFill;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ U0 TurtlePlot(CDC *dc,Turtle *t,CColorROPU16 edge,CColorROPU16 middle)
|
||||
if (w<0) w=0;
|
||||
dc->color=middle;
|
||||
GrLine3(dc,t->x+w*Cos(t->é+ã/2),t->y+w*Sin(t->é+ã/2),t->z,
|
||||
t->x+w*Cos(t->é-ã/2),t->y+w*Sin(t->é-ã/2),t->z);
|
||||
t->x+w*Cos(t->é-ã/2),t->y+w*Sin(t->é-ã/2),t->z);
|
||||
w=t->w/2.0;
|
||||
dc->color=edge;
|
||||
GrPlot3(dc,t->x+w*Cos(t->é+ã/2),t->y+w*Sin(t->é+ã/2),t->z);
|
||||
@@ -113,7 +113,7 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
U0 SetMenu()
|
||||
{
|
||||
I64 i;
|
||||
U8 buf[64];
|
||||
U8 buf[STR_LEN];
|
||||
CMenuEntry *tempse;
|
||||
for (i=0;i<=9;i++) {
|
||||
StrPrint(buf,"Settings/Layer%d",i);
|
||||
@@ -137,7 +137,7 @@ U0 Lattice()
|
||||
Bool aim=FALSE;
|
||||
I64 a1,a2;
|
||||
CDC *dc=DCAlias;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
@@ -169,7 +169,7 @@ U0 Lattice()
|
||||
"}"
|
||||
);
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
@@ -177,7 +177,8 @@ U0 Lattice()
|
||||
DocCursor;
|
||||
TurtleInit(&tt);
|
||||
SetMenu;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS_TASK_MENU-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS_TASK_MENU
|
||||
-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->draw_it=&DrawIt;
|
||||
try {
|
||||
while (TRUE) {
|
||||
|
||||
@@ -6,8 +6,8 @@ Bool restart;
|
||||
|
||||
U0 DrawIt(CTask *,CDC *dc2)
|
||||
{
|
||||
dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc2,0,0,dc[cur_dc]);
|
||||
dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc2,0,0,dc[cur_dc]);
|
||||
}
|
||||
|
||||
U0 AnimateTask(I64)
|
||||
|
||||
@@ -13,7 +13,8 @@ U0 FunDraw1(CDC *dc,F64 (*f)(F64 t))
|
||||
I64 i,w=Fs->pix_width,h=Fs->pix_height;
|
||||
F64 scale=h/5.0;
|
||||
for (i=-w/2;i<=w/2;i++)
|
||||
GrLine(dc,w/2+i,h/2-scale*f(i/scale*2*ã),w/2+i+1,h/2-scale*f((i+1)/scale*2*ã));
|
||||
GrLine(dc,w/2+i,h/2-scale*f(i/scale*2*ã),
|
||||
w/2+i+1,h/2-scale*f((i+1)/scale*2*ã));
|
||||
}
|
||||
|
||||
U0 FunDraw2(CDC *dc,F64 (*f)(F64 t,F64 p),F64 T)
|
||||
@@ -46,7 +47,8 @@ U0 Init(CDC *dc)
|
||||
GrLine(dc,w/2+scale*i,h/2-3,w/2+scale*i,h/2+3);
|
||||
if (i) {
|
||||
dc->color=DKGRAY;
|
||||
GrPrint(dc,w/2+scale*i-7*FONT_WIDTH/2,h/2+5+FONT_HEIGHT,"%5.1f*T",ToF64(i));
|
||||
GrPrint(dc,
|
||||
w/2+scale*i-7*FONT_WIDTH/2,h/2+5+FONT_HEIGHT,"%5.1f*T",ToF64(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
U0 PaletteDemo()
|
||||
{
|
||||
I64 i,j;
|
||||
CBGR bgr;
|
||||
for (i=0;i<16;i++)
|
||||
CBGR48 bgr;
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
"$$BLACK$$$$BG,%d$$__%-8Z__$$FG$$$$BG$$\n",i,i,"ST_COLORS";
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
//Alternatively, use $LK,"SetVGAPalette4",A="MN:SetVGAPalette4"$(vga_palette4_gray);
|
||||
for (i=0;i<16;i++) {
|
||||
j=0xFF*i/15;
|
||||
//Alternatively, use $LK,"GrPaletteSet",A="MN:GrPaletteSet"$(gr_palette_gray);
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
j=0xFFFF*i/(NUM_COLORS-1);
|
||||
bgr.b=j;
|
||||
bgr.g=j;
|
||||
bgr.r=j;
|
||||
SetVGAPaletteColor(i,bgr);
|
||||
GrPaletteColorSet(i,bgr);
|
||||
}
|
||||
PressAKey;
|
||||
|
||||
//You can do it this way, too.
|
||||
SetVGAPaletteColor(WHITE,0xFFFF00);
|
||||
GrPaletteColorSet(WHITE,0xFFFFFFFF0000);
|
||||
PressAKey;
|
||||
|
||||
//$LK,"SettingsPop",A="MN:SettingsPop"$() restores original palette
|
||||
//$LK,"SettingsPop",A="MN:SettingsPop"$() restores original palette
|
||||
SettingsPop;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+13
-10
@@ -35,7 +35,7 @@ F64 F(Complex *x)
|
||||
CPoly(&num, x,zeros,NUM_ZEROS);
|
||||
CPoly(&denom,x,poles,NUM_POLES);
|
||||
CDiv(&num,&denom,&n1);
|
||||
|
||||
|
||||
R2P(&m,&a,n1.x,n1.y);
|
||||
if (ip.rb)
|
||||
return ã+a;
|
||||
@@ -47,7 +47,7 @@ F64 MPDraw(CTask *task)
|
||||
{
|
||||
Complex xx;
|
||||
I64 x,y,w=task->pix_width,h=task->pix_height,cx=w/2,cy=h/2,
|
||||
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
|
||||
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
|
||||
F64 yy,y_total=0;
|
||||
CDC *dc=DCAlias(,task);
|
||||
for (y=lo;y<hi;y++) {
|
||||
@@ -58,7 +58,7 @@ F64 MPDraw(CTask *task)
|
||||
y_total+=Clamp(yy,-14,14);
|
||||
GrPlot(dc,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCDel(dc);
|
||||
return y_total;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ U0 Draw()
|
||||
tempm[i]=JobQue(&MPDraw,Fs,i,0);
|
||||
y_total=0;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
y_total+=GetResult(tempm[i])(F64);
|
||||
y_total+=JobResultGet(tempm[i])(F64);
|
||||
|
||||
if (!y_total) break;
|
||||
scale*=7*GR_WIDTH*GR_HEIGHT/y_total;
|
||||
@@ -100,13 +100,13 @@ U0 PoleZeros()
|
||||
PopUpOk(
|
||||
"Drag the poles and zeros with left mouse.\n"
|
||||
"Hold right mouse for phase plot.\n"
|
||||
);
|
||||
);
|
||||
WinMgrSync;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
SetVGAPalette4(vga_palette4_gray);
|
||||
SetVGAPaletteColor(15,0xFF0000); //White is red
|
||||
GrPaletteSet(gr_palette_gray);
|
||||
GrPaletteColorSet(15,0xFFFF00000000); //White is red
|
||||
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
@@ -119,7 +119,8 @@ U0 PoleZeros()
|
||||
try {
|
||||
Draw;
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
pz_msg:
|
||||
cx=Fs->pix_width/2;
|
||||
cy=Fs->pix_height/2;
|
||||
@@ -130,8 +131,10 @@ pz_msg:
|
||||
case MSG_IP_MOVE:
|
||||
if (tempc) {
|
||||
p11=a1;p22=a2;
|
||||
//get to last mouse move
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE))
|
||||
//get to last mouse move
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+
|
||||
1<<MSG_IP_R_UP+1<<MSG_IP_MOVE))
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
p11=a1;p22=a2;
|
||||
} else
|
||||
|
||||
@@ -10,7 +10,7 @@ I64 mp_not_done_flags;
|
||||
class State
|
||||
{
|
||||
F64 wabbits,hawks,
|
||||
d_wabbits,d_hawks; //Technically, these are not part of the state.
|
||||
d_wabbits,d_hawks; //Technically, these are not part of the state.
|
||||
};
|
||||
|
||||
U0 Steps(State *s)
|
||||
|
||||
Binary file not shown.
@@ -13,7 +13,7 @@ U0 Main()
|
||||
{
|
||||
"Capture screen...\n";
|
||||
PressAKey;
|
||||
GRACaptureScreen("::/Home/ScreenShot");
|
||||
GRAScreenCapture("::/Home/ScreenShot");
|
||||
|
||||
"View captured screen...\n";
|
||||
PressAKey;
|
||||
Binary file not shown.
+20
-20
@@ -14,8 +14,8 @@ U0 Lighting(CDC *dc,CD3I32 *ls,CD3I32 *poly,I64 color)
|
||||
v2.y=poly[2].y-poly[1].y;
|
||||
v2.z=poly[2].z-poly[1].z;
|
||||
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the polygon joined at point[1].
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the polygon joined at point[1].
|
||||
|
||||
vn_x=v1.y*v2.z-v1.z*v2.y;
|
||||
vn_y=v1.z*v2.x-v1.x*v2.z;
|
||||
@@ -27,19 +27,19 @@ U0 Lighting(CDC *dc,CD3I32 *ls,CD3I32 *poly,I64 color)
|
||||
vn_y*=d;
|
||||
vn_z*=d;
|
||||
//Vn is the cross product of V1 and V3
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
GrRot(r,&vn_x,&vn_y,&vn_z);
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
Mat4x4MulXYZ(r,&vn_x,&vn_y,&vn_z);
|
||||
i=(vn_x*ls->x+vn_y*ls->y+vn_z*ls->z)>>16;
|
||||
//The dot product of the light source
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
if (i<0) {
|
||||
dc->color=ROPF_PROBABILITY_DITHER+BLACK<<16+color;
|
||||
dc->dither_probability_u16=-i;
|
||||
@@ -58,19 +58,19 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
F64 tt=0.5*(Sin(ã*2*(tS%10.0)/10.0)+2.0),
|
||||
é,é2,è,è2,radius,d;
|
||||
é,é2,è,è2,radius,d;
|
||||
I64 i,j,cx=task->pix_width/2,cy=task->pix_height/2;
|
||||
CD3I32 poly[3],ls;
|
||||
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,s->az);
|
||||
GrRotYEqu(dc->r,s->ay);
|
||||
GrRotXEqu(dc->r,s->ax+ã);
|
||||
GrScaleEqu(dc->r,tt);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,s->az);
|
||||
Mat4x4RotY(dc->r,s->ay);
|
||||
Mat4x4RotX(dc->r,s->ax+ã);
|
||||
Mat4x4Scale(dc->r,tt);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
ls.x=-(ip.pos.x-task->pix_left-task->scroll_x-cx);
|
||||
ls.y=-(ip.pos.y-task->pix_top-task->scroll_y-cy);
|
||||
|
||||
Binary file not shown.
+20
-15
@@ -24,24 +24,29 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
|
||||
dc->color=BLUE;
|
||||
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,
|
||||
SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
dc->color=YELLOW;
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
}
|
||||
|
||||
U0 UpdateDerivedCtrlSlider(CCtrl *c)
|
||||
@@ -78,7 +83,7 @@ CCtrl *SliderNew()
|
||||
c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
Preempt(old_preempt);
|
||||
@@ -87,7 +92,7 @@ CCtrl *SliderNew()
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
Free(c);
|
||||
@@ -101,8 +106,8 @@ U0 Main()
|
||||
CCtrl *c=SliderNew;
|
||||
PressAKey;
|
||||
"Left: %d Right: %d\n",
|
||||
sld.left_pos*10/SLIDER_RANGE,
|
||||
sld.right_pos*10/SLIDER_RANGE;
|
||||
sld.left_pos*10/SLIDER_RANGE,
|
||||
sld.right_pos*10/SLIDER_RANGE;
|
||||
SliderDel(c);
|
||||
DocBottom;
|
||||
}
|
||||
|
||||
Loaded 100 of 554 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user