TempleOSCDV4.12.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:56 +02:00
1 parent 93ca216483
commit b84bbff6db
381 files changed
+18356 -18798

No files matched your search

+4 -4
View File
@@ -37,11 +37,11 @@ U0 DoOnce()
}
break;
}
if (FileFind("D:/Temp/Logs/access.log")) {
Auto("\n\n%C",CH_ESC);
if (FileFind("D:/Tmp/Logs/access.log")) {
In("\n\n%C",CH_ESC);
RunFile("::/Demo/WebLogDemo/WebLogRep",,
"D:/Temp/Logs/*.log","D:/Home/WebLogRep.DD");
Del("D:/Temp/Logs/*.log");
"D:/Tmp/Logs/*.log","D:/Home/WebLogRep.DD");
Del("D:/Tmp/Logs/*.log");
}
}
+9 -9
View File
@@ -18,17 +18,17 @@ U0 InsFileLink()
U0 InsDirLinks()
{
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
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);
while (tempde) {
tempde->full_name[0]=':';
"$$LK,\"%s\",A=\"FI:%s\"$$\n",tempde->full_name+2,tempde->full_name;
tempde=tempde->next;
tmpde=tmpde1=FilesFind(st2,FUF_JUST_FILES);
while (tmpde) {
tmpde->full_name[0]=':';
"$$LK,\"%s\",A=\"FI:%s\"$$\n",tmpde->full_name+2,tmpde->full_name;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
Free(st);
Free(st2);
}
@@ -309,9 +309,9 @@ Bool MyPutKey(I64 ch,I64 sc)
return TRUE;
case 'g':
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/BlogScreenShot");
KeyDescSet("Edit/BlogScrnShot");
else
BlogScreenShot;
BlogScrnShot;
return TRUE;
case 'p':
if (sc&SCF_KEY_DESC)
+3 -3
View File
@@ -9,7 +9,7 @@ U0 UserStartUp()
WinToTop;
WinZBufUpdate;
Dir;
"$TX,"81,208",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
"$TX,"81,223",D="DD_TEMPLEOS_LOC_OFFICIAL"$LOC:";
CPURep;
}
@@ -38,8 +38,8 @@ U0 StartUpTasks()
}
if (DrvIsWritable(':')) {
DelTree("::/Temp/ScreenShots");
MkDir("::/Temp/ScreenShots");
DelTree("::/Tmp/ScrnShots");
MkDir("::/Tmp/ScrnShots");
}
StartUpTasks;
+1 -1
View File
@@ -2,7 +2,7 @@
#define FILEMASK_OFF_LIMITS "!*/Misc/PCIDevices.DD*;!*/Misc/Bible.TXT*;"\
"!*/Sup1/Sup1Texts/*;!*/Sup1/Sup1Words/*;!*/Sup1/Sup1Bin/*;"\
"!*/God/Vocab.DD*"
"!*/Sup1/Sup1Blog/NumBible.TXT*;!*/God/Vocab.DD*"
public I64 F(U8 *needle_str,U8 *fu_flags=NULL)
{//Find text in all text files.
+3 -3
View File
@@ -6,9 +6,9 @@ $LK+X,"ChangeLg",A="FI:::/Doc/ChangeLog.DD"$$MA,"Blog ",LM="Blog;\n"$$MA,"EdG
$MA,"Web ",LM="Cd(\"/Home/Web\");Dir;\n"$$MA,"TAD ",LM="Cd(\"/Home/Web/TAD\");Dir;\n"$$MA,"Sup1 ",LM="Cd(\"/Home/Sup1\");Dir;\n"$$MA,"Blog ",LM="Cd(\"/Home/Sup1/Sup1Blog\");Dir;\n"$$MA,"Code ",LM="Cd(\"/Home/Sup1/Sup1CodeScraps\");Dir;\n"$$MA,"Dist ",LM="Cd(\"/Home/Sup1/Sup1Distro\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Home/Sup1/Sup1Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Home/Sup1/Sup1Graphics\");Dir;\n"$$MA,"Psalmody",LM="Cd(\"/Home/Sup1/Sup1Psalmody\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Home/Sup1/Sup1Utils\");Dir;\n"$
$MA,"Apps ",LM="Cd(\"/Apps\");Dir;\n"$$MA,"AfterEgp",LM="Cd(\"/Apps/AfterEgypt\");Dir;\n"$$MA,"Budget ",LM="Cd(\"/Apps/Budget\");Dir;\n"$$MA,"GrModels",LM="Cd(\"/Apps/GrModels\");Dir;\n"$$MA,"KeepAway",LM="Cd(\"/Apps/KeepAway\");Dir;\n"$$MA,"Logic ",LM="Cd(\"/Apps/Logic\");Dir;\n"$$MA,"Psalmody",LM="Cd(\"/Apps/Psalmody\");Dir;\n"$$MA,"Span ",LM="Cd(\"/Apps/Span\");Dir;\n"$$MA,"Strut ",LM="Cd(\"/Apps/Strut\");Dir;\n"$$MA,"TimeClk ",LM="Cd(\"/Apps/TimeClock\");Dir;\n"$
$MA,"TimeOut ",LM="Cd(\"/Apps/TimeOut\");Dir;\n"$$MA,"ToTheFrt",LM="Cd(\"/Apps/ToTheFront\");Dir;\n"$$MA,"Vocab ",LM="Cd(\"/Apps/Vocabulary\");Dir;\n"$$MA,"XCaliber",LM="Cd(\"/Apps/X-Caliber\");Dir;\n"$$SP,"",BI=1$
$MA,"Demo ",LM="Cd(\"/Demo\");Dir;\n"$$MA,"AcctEmpl",LM="Cd(\"/Demo/AcctExample\");Dir;\n"$$MA,"Asm ",LM="Cd(\"/Demo/Asm\");Dir;\n"$$MA,"AutoFile",LM="Cd(\"/Demo/AutoFile\");Dir;\n"$$MA,"DocDoc ",LM="Cd(\"/Demo/DolDoc\");Dir;\n"$$MA,"Dsk ",LM="Cd(\"/Demo/Dsk\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Demo/Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Demo/Graphics\");Dir;\n"$$MA,"Lectures",LM="Cd(\"/Demo/Lectures\");Dir;\n"$$MA,"MultCore",LM="Cd(\"/Demo/MultiCore\");Dir;\n"$
$MA,"Demo ",LM="Cd(\"/Demo\");Dir;\n"$$MA,"AcctEmpl",LM="Cd(\"/Demo/AcctExample\");Dir;\n"$$MA,"Asm ",LM="Cd(\"/Demo/Asm\");Dir;\n"$$MA,"DocDoc ",LM="Cd(\"/Demo/DolDoc\");Dir;\n"$$MA,"Dsk ",LM="Cd(\"/Demo/Dsk\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Demo/Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Demo/Graphics\");Dir;\n"$$MA,"InFile ",LM="Cd(\"/Demo/InFile\");Dir;\n"$$MA,"Lectures",LM="Cd(\"/Demo/Lectures\");Dir;\n"$$MA,"MultCore",LM="Cd(\"/Demo/MultiCore\");Dir;\n"$
$MA,"RevFile ",LM="Cd(\"/Demo/RevFileDemo\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Demo/Snd\");Dir;\n"$$MA,"SortFile",LM="Cd(\"/Demo/SortFileDemo\");Dir;\n"$$MA,"Template",LM="Cd(\"/Demo/Templates\");Dir;\n"$$MA,"HtmlTXT ",LM="Cd(\"/Demo/ToHtmlToTXTDemo\");Dir;\n"$$MA,"WebLog ",LM="Cd(\"/Demo/WebLogDemo\");Dir;\n"$$MA,"Stadium ",LM="Cd(\"/Demo/Games/Stadium\");Dir;\n"$
$MA,"Doc ",LM="Cd(\"/Doc\");Dir;\n"$$MA,"Misc ",LM="Cd(\"/Misc\");Dir;\n"$$MA,"Tour ",LM="Cd(\"/Misc/Tour\");Dir;\n"$$MA,"Temp ",LM="Cd(\"/Temp\");Dir;\n"$$MA,"ScrnShot",LM="Cd(\"/Temp/ScreenShots\");Dir;\n"$$MA,"DelScrSt",LM="Del(\"D:/Temp/*.SND\");DelTree(\"D:/Temp/ScreenShots\");MkDir(\"D:/Temp/ScreenShots\");Del(\"C:/Temp/*.SND\");DelTree(\"C:/Temp/ScreenShots\");MkDir(\"C:/Temp/ScreenShots\");\n"$$MA,"0000Boot",LM="Cd(\"/0000Boot\");Dir;\n"$$MA,"Linux ",LM="Cd(\"/Linux\");Dir;\n"$
$MA,"Doc ",LM="Cd(\"/Doc\");Dir;\n"$$MA,"Misc ",LM="Cd(\"/Misc\");Dir;\n"$$MA,"Tour ",LM="Cd(\"/Misc/Tour\");Dir;\n"$$MA,"Tmp ",LM="Cd(\"/Tmp\");Dir;\n"$$MA,"ScrnShot",LM="Cd(\"/Tmp/ScrnShots\");Dir;\n"$$MA,"DelScrSt",LM="Del(\"D:/Tmp/*.SND\");DelTree(\"D:/Tmp/ScrnShots\");MkDir(\"D:/Tmp/ScrnShots\");Del(\"C:/Tmp/*.SND\");DelTree(\"C:/Tmp/ScrnShots\");MkDir(\"C:/Tmp/ScrnShots\");\n"$$MA,"0000Boot",LM="Cd(\"/0000Boot\");Dir;\n"$$MA,"Linux ",LM="Cd(\"/Linux\");Dir;\n"$
$MA,"LinxDict",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/LinuxDict.TXT**\\\");\");\n"$$MA,"August ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/AugustWords.TXT**\\\");\");\n"$$MA,"Happy ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HappyWords.TXT*\\\");\");\n"$$MA,"Bible ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/BibleWords.TXT*\\\");\");\n"$$MA,"Huck ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HuckWords.TXT*\\\");\");\n"$$MA,"Ingreds ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Ingredients.TXT*\\\");\");\n"$$MA,"Chess ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Chess.DD*\\\");\");\n"$$MA,"Texts ",LM="Cd(\"/Home/Sup1/Sup1Texts\");Dir;\n"$$MA,"Words ",LM="Cd(\"/Home/Sup1/Sup1Words\");Dir;\n"$
$MA,"MakeStd ",LM="MakeStdDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSCD.ISO\");\n"$$MA,"MakeStRS",LM="MakeStdRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSCDRS.ISO\");\n"$$MA,"MakeUlt ",LM="MakeUltraDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSUltra.ISO\");\n"$$MA,"MakeUtRS",LM="MakeUltraRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSUltraRS.ISO\");\n"$$MA,"MakeStaf",LM="MakeStaffDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSStaff.ISO\");\n"$$MA,"MakeDbg ",LM="MakeDbgDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSDbg.ISO\");\n"$
$MA,"BurnStd ",LM="MakeStdDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnStRS",LM="MakeStdRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnUlt ",LM="MakeUltraDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnUtRS",LM="MakeUltraRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnStaf",LM="MakeStaffDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnDbg ",LM="MakeDbgDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$
@@ -75,7 +75,7 @@ $SP+PU,"JukeBox",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmo
$SP+PU,"BigGuns",LM="#include \"::/Demo/Games/BigGuns\"",BI=27$ $SP+PU,"Budget",LM="#include \"::/Apps/Budget/Run\"",BI=28$ $SP+PU,"Digits",LM="#include \"::/Demo/Games/Digits\"",BI=29$ $SP+PU,"Checkers",LM="#include \"::/Demo/Games/TreeCheckers.HC.Z\"",BI=30$
$MA,"TestSuit",LM="#include \"::/Misc/OSTestSuite\";\n"$$MA,"TakeTour",LM="Cd(\"::/Misc/Tour\");;AutoFile(\"Tour\");\n"$$MA+PU,"PsalSup1",LM="#include \"::/Apps/Psalmody/Load\";Psalmody(\"~/Sup1/Sup1Psalmody\");"$$MA,"Comics ",LM="Cd(\"/Home/Sup1/Sup1Comics\");Dir;\n"$$MA-X+PU,"SymAlpha",LM="DocMax;Who;View;"$$MA-X+PU,"SymNum ",LM="DocMax;Who(\"+m\");View;"$
$MA,"TestSuit",LM="#include \"::/Misc/OSTestSuite\";\n"$$MA,"TakeTour",LM="Cd(\"::/Misc/Tour\");;InFile(\"Tour\");\n"$$MA+PU,"PsalSup1",LM="#include \"::/Apps/Psalmody/Load\";Psalmody(\"~/Sup1/Sup1Psalmody\");"$$MA,"Comics ",LM="Cd(\"/Home/Sup1/Sup1Comics\");Dir;\n"$$MA-X+PU,"SymAlpha",LM="DocMax;Who;View;"$$MA-X+PU,"SymNum ",LM="DocMax;Who(\"+m\");View;"$
yÓÿÿÿÜÿÿÿ<H÷ÿÿÿ'ûÿÿÿ÷ÿÿÿõÿÿÿüÿÿÿ õÿÿÿ'ûÿÿÿ '
èÿÿÿòÿÿÿèÿÿÿüÿÿÿèÿÿÿèÿÿÿáÿÿÿúÿÿÿáÿÿÿúÿÿÿ èÿÿÿáÿÿÿèÿÿÿüÿÿÿèÿÿÿòÿÿÿèÿÿÿüÿÿÿúÿÿÿõÿÿÿ÷ÿÿÿ  $$÷ÿÿÿ$õÿÿÿ$ èÿÿÿõÿÿÿèÿÿÿòÿÿÿüÿÿÿõÿÿÿüÿÿÿ üÿÿÿéÿÿÿ üÿÿÿéÿÿÿ ÿÿÿÿéÿÿÿ ÿÿÿÿéÿÿÿõÿÿÿÿÿÿÿòÿÿÿÿÿÿÿûÿÿÿãÿÿÿýÿÿÿåÿÿÿãÿÿÿÿÿÿÿãÿÿÿåÿÿÿúÿÿÿáÿÿÿþÿÿÿãÿÿÿõÿÿÿ$÷ÿÿÿ$÷ÿÿÿ' $$õÿÿÿ''
' '
+11 -10
View File
@@ -1,4 +1,6 @@
$WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* $LK,"::/Demo/RandDemo.HC"$ Rand is kinda crappy.
* Cursor in $LK,"::/Home/TOSToHtml.HC"$.
* Investigate why packet loss $LK,"Training Sleep(1)",A="FF:::/Adam/Training.HC,Sleep(1)"$.
@@ -139,7 +141,7 @@ $FG,5$$TX+CX,"Bugs"$$FG$
$FG,5$$TX+CX,"3rd Party Bugs"$$FG$
* VMware: Stretch to full screen
* VMware: Stretch to full scrn
* VMware: PC speaker sound distorted.
* VMware: 8/2/2015 start-up. Probably multicore.
* VMware: $LK,"CtrlAltDel",A="FF:::/Kernel/SerialDev/Keyboard.HC,CtrlAltDel"$ on <CTRL-ALT-INS>
@@ -149,7 +151,7 @@ $FG,5$$TX+CX,"3rd Party Bugs"$$FG$
$FG,5$$TX+CX,"Bugs? Not really sure."$$FG$
* $LK,"Mount",A="MN:Mount"$() crashes on bad drive.
* Graphics clipping: screen y+top<0 for top<0?
* Graphics clipping: scrn y+top<0 for top<0?
* 1/1/2015 Bug messing-up keyboard, like no CTRL key. Was working on Sprites.
@@ -159,9 +161,8 @@ $FG,5$$TX+CX,"Bugs? Not really sure."$$FG$
* 1/?/2015,8/10/2015 Macro sel in Menu did not go to shell? No, I think just <CTRL-m> twice. Not a bug.
* 5/7/14:Something like $LK,"AFSetIP",A="MN:AFSetIP"$ caused hang, then reboot in TestSuite.
* 5/7/14:Something like $LK,"InSetIP",A="MN:InSetIP"$ caused hang, then reboot in TestSuite.
* 5/7/14:#63 Maybe, $LK,"::/Demo/Graphics/Pick3D.HC"$ crashed in TestSuite.
* 6/8/14:After or in $LK,"PageTableEntries",A="FF:::/Misc/OSTestSuite.HC,PageTableEntries"$ in TestSuite crash.
* $LK,"StrPrintJoin",A="MN:StrPrintJoin"$(,st); With st="\n\\"; (Forgot what this is talking about.)
@@ -264,7 +265,7 @@ $FG,5$$TX+CX,"Committee Needed"$$FG$
* Note: We will never put multiple $LK,"Keyboard Tables",A="FI:::/Kernel/SerialDev/Keyboard.HC"$. Each country must make their own version of TempleOS. The $LK,"Intel Factory ROM",A="FF:::/Doc/Demands.DD,English"$ will have just English. Our $LK,"Charter",A="FI:::/Doc/Charter.DD"$ bans multiple country or architectures in the same version.
* 12 border chars in screen font codes 0x02-0x0D. $LK,"TextBorder",A="MN:TextBorder"$() $LK,"RawDr",A="MN:RawDr"$() $LK,"::/Demo/Games/CharDemo.HC"$. LineFeed shows-up in $FG,2$<CTRL-m>$FG$ PersonalMenu.
* 12 border chars in scrn font codes 0x02-0x0D. $LK,"TextBorder",A="MN:TextBorder"$() $LK,"RawDr",A="MN:RawDr"$() $LK,"::/Demo/Games/CharDemo.HC"$. LineFeed shows-up in $FG,2$<CTRL-m>$FG$ PersonalMenu.
* Super-simple high speed serial needs flow control. $FG,2$<CTRL-s>$FG$ and $FG,2$<CTRL-q>$FG$?
@@ -338,7 +339,7 @@ $FG,5$$TX+CX,"Test"$$FG$
* $LK,"ICDivEqu",A="MN:ICDivEqu"$() assumes RBX. Is it okay?
* Autofile PopUp of PopUp?
* InFile PopUp of PopUp?
* $LK,"FileMgr",A="MN:FileMgr"$() help link scrolls out of window.
@@ -359,8 +360,8 @@ $FG,5$$TX+CX,"Uncategorized"$$FG$
* MOV U8 [RSP+RCX],DL
* $LK,"gr.screen_image",A="MN:CGrGlbls"$
>Might want to do ZOOM in U8 graphics and convert screen capture to U8
* $LK,"gr.scrn_image",A="MN:CGrGlbls"$
>Might want to do ZOOM in U8 graphics and convert scrn capture to U8
>Might want to rev bit order
* This $LK,"Fs->catch_except=TRUE",A="FF:::/Kernel/SrvCmd.HC,Fs->catch_except=TRUE"$ causes problems because it
@@ -410,7 +411,7 @@ $FG,5$$TX+CX,"Misc Notes"$$FG$
Erik van der Karbargenbok: $LK,"TempleBot",A="PI:::/Home/Sup1/Sup1Bin/TempleBot"$.
Intel CEO's name: Brian Krzanich
>$FG,2$lspci -v$FG$
Size:$TX,"20932 KB",D="DD_TEMPLEOSCD_K_SIZE"$
Size:$TX,"17416KB",D="DD_TEMPLEOSCD_K_SIZE"$
$FG,5$$TX+CX,"My Web Bookmarks"$$FG$$WW,0$
$TX,"My FireFox Bookmarks",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/Bookmarks"$
@@ -444,7 +445,7 @@ $TX,"The sins of Newton",HTML="https://www.brainpickings.org/2012/01/04/isaac-ne
$TX,"Stalin's Tanks",HTML="https://boardgamegeek.com/boardgame/5198/stalins-tanks"$
$TX,"Lamp shades",HTML="http://www.lampsplus.com/products/lamp-shades"$
$TX,"The Original Jewish Temple",HTML="http://www.jewishvirtuallibrary.org/jsource/Judaism/The_Temple.html"$
$TX,"KingJamesBible with LineNums",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.DD"$
$TX,"KingJamesBible with LineNums",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.TXT"$
$TX,"Higgs 5-Sigma Proof",HTML="http://understandinguncertainty.org/explaining-5-sigma-higgs-how-well-did-they-do"$
$TX,"The Number Bleem",HTML="http://www.strangehorizons.com/2000/20001120/secret_number.shtml"$
$TX,"Dwight: Nerd torture",HTML="http://www.noob.us/humor/the-office-dwight-faces-nerd-torture-of-the-highest-form"$
+7 -7
View File
@@ -2,7 +2,7 @@ $TR-UL,"Adam"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0xFF;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=4.110;
$ID,2$registry_version=4.120;
$ID,-2$$ID,-2$$TR-UL,"TempleOS"$
$ID,2$$TR,"TOS"$
$ID,2$I64 tos_code_walk_thru=105,tos_after_egypt_in_action=46;
@@ -10,6 +10,9 @@ $ID,-2$$TR,"CircleTrace"$
$ID,2$F64 best_score=4.9425;
$ID,-2$$TR,"DiningStars"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"Staff"$
$ID,2$#define PERSONAL_INITIALS "TAD"
#define MACHINE_CFG 0
$ID,-2$$TR,"BlackDiamond"$
$ID,2$I64 best_score=1;
$ID,-2$$TR,"EagleDive"$
@@ -25,7 +28,7 @@ $ID,2$F64 best_score=46.2643;
$ID,-2$$TR,"FlapBat"$
$ID,2$F64 best_score=16.3077;
$ID,-2$$TR,"TimeOut"$
$ID,2$I64 best_score=22202;
$ID,2$I64 best_score=28128;
$ID,-2$$TR,"RawHide"$
$ID,2$F64 best_score=96.1279;
$ID,-2$$TR,"KeepAway"$
@@ -37,13 +40,10 @@ $ID,-2$$TR,"Wenceslas"$
$ID,2$F64 best_score=43.9944;
$ID,-2$$TR,"BomberGolf"$
$ID,2$I64 best_score=175;
$ID,-2$$TR,"Staff"$
$ID,2$#define PERSONAL_INITIALS "TAD"
#define MACHINE_CFG 0
$ID,-2$$ID,-2$$TR,"DemoCompany"$
$ID,2$
$TR,"Game1"$
$ID,2$F64 best_score=197.62089;
$ID,2$F64 best_score=511.36611;
$TR,"SimpleVal"$
$ID,2$1344;
$ID,2$1387;
$ID,-2$$ID,-2$
+6 -6
View File
@@ -46,9 +46,9 @@ U8 *BlogWebFile(CDate cdt=0)
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
{
CDirEntry *tempde=FilesFind(files_find_mask);
U8 *res=MStrPrint(fmt,FileCnt(tempde));
DirTreeDel(tempde);
CDirEntry *tmpde=FilesFind(files_find_mask);
U8 *res=MStrPrint(fmt,FileCnt(tmpde));
DirTreeDel(tmpde);
return res;
}
@@ -67,14 +67,14 @@ U0 BlogDCImgWrite(CDC *dc,CDate cdt=0)
Free(st2);
}
U0 BlogScreenShot()
U0 BlogScrnShot()
{
Bool old_cursor=DocCursor;
CDC *dc1,*dc2;
U8 *old_fp_draw_input_ptr=gr.fp_draw_input_ptr;
gr.fp_draw_input_ptr=NULL;
WinMgrSync(2);
dc1=DCScreenCapture;
Refresh(2);
dc1=DCScrnCapture;
dc2=DCExt(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
BlogDCImgWrite(dc2);
gr.fp_draw_input_ptr=old_fp_draw_input_ptr;
+1 -1
View File
@@ -22,7 +22,7 @@ U0 TOSBootRescueDrv1()
DefinePrint("TOS_BOOT_RESCUE_DRV_END", "0x%X",FloorI64(
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4<<4-
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
DefinePrint("CFG_BOOT_RESCUE_DRV_FILE","\"/Temp/BootRescueDrv.BIN.Z\"");
DefinePrint("CFG_BOOT_RESCUE_DRV_FILE","\"/Tmp/BootRescueDrv.BIN.Z\"");
} TOSBootRescueDrv1;
U0 TOSBootRescueDrv2()
+38 -40
View File
@@ -14,7 +14,7 @@ U8 TOSGetDrv()
U0 TOSBootHDIns(U8 drv_let)
{
drv_let=ToUpper(drv_let);
Auto(TOS_CFG);
In(TOS_CFG);
BootHDIns(drv_let);
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
BootMHDIns(drv_let);
@@ -51,31 +51,31 @@ public U0 CopySongs(U8 threshold='7')
{
CDoc *doc;
CDocEntry *doc_e;
CDirEntry *tempde=FilesFind("/Home/Sup1/Sup1Psalmody/*.HC*",
FUF_CLUSTER_ORDER),*tempde1=tempde;
CDirEntry *tmpde=FilesFind("/Home/Sup1/Sup1Psalmody/*.HC*",
FUF_CLUSTER_ORDER),*tmpde1=tmpde;
DelTree("/Apps/Psalmody/Examples");
MkDir("/Apps/Psalmody/Examples");
while (tempde) {
doc=DocRead(tempde->full_name);
while (tmpde) {
doc=DocRead(tmpde->full_name);
doc_e=doc->head.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tempde->full_name,"/Apps/Psalmody/Examples");
Copy(tmpde->full_name,"/Apps/Psalmody/Examples");
DocDel(doc);
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
U0 DistroPrep()
{
Del("/Home/Demo*");
DelTree("/Home/*Temp.DD.Z");
DelTree("/Home/*Tmp.DD.Z");
if (FileFind("/Home/Sup1/Sup1Psalmody"))
CopySongs;
DelTree("/Temp");
MkDir("/Temp");
MkDir("/Temp/ScreenShots");
DelTree("/Tmp");
MkDir("/Tmp");
MkDir("/Tmp/ScrnShots");
Touch("/PersonalMenu.DD.Z","+T");
Touch("/Home/PersonalMenu.DD.Z","+T");
@@ -108,7 +108,7 @@ U0 MakeBootRescueDrvFile()
{
CBlkDev *bd;
if (!Let2Drv('A',FALSE)) {
Auto(CFG_BOOT_RESCUE_DRV "\n");
In(CFG_BOOT_RESCUE_DRV "\n");
Mount;
}
bd=Let2BlkDev('A');
@@ -198,7 +198,7 @@ I64 MakeLineRepFile()
DocClear;
official=LineRep("C:/*","-r")+
LineRep("C:/Adam/*")+
LineRep("C:/Compiler/*","-S+T")+
LineRep("C:/Compiler/*","-S+$$")+
LineRep("C:/Kernel/*");
DocClear;
CopyTree("B:/TOS","C:/Home");
@@ -225,7 +225,7 @@ U0 StaffDistroPrep()
{
Drv('C');
DistroPrep;
Auto(TOS_DVD_CFG);
In(TOS_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
@@ -238,7 +238,7 @@ U0 MakeStaffDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSSTAFF_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -248,7 +248,7 @@ U0 DbgDistroPrep()
Drv('C');
DistroPrep;
MakeBootRescueDrvFile;
Auto(TOS_DVD_DBG_CFG);
In(TOS_DVD_DBG_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
@@ -266,7 +266,7 @@ U0 MakeDbgDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSDBG_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -275,7 +275,7 @@ U0 StdDistroPrep()
{
Drv('C');
DistroPrep;
Auto(STD_DISTRO_DVD_CFG);
In(STD_DISTRO_DVD_CFG);
BootDVDIns('C');
Fmt('B',,FALSE,FSt_REDSEA);
DelTree(TOS_DISTRO_DIR);
@@ -292,7 +292,7 @@ U0 MakeStdDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -301,7 +301,7 @@ U0 MakeStdRedSeaDistro()
StdDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
0.1*(10*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -311,7 +311,7 @@ U0 UltraDistroPrep()
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 "/Adam/AutoComplete/ACDefs.DATA*");
Del(TOS_DISTRO_DIR "/Misc/PCIDevices.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
@@ -320,7 +320,7 @@ U0 UltraDistroPrep()
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/AutoComplete/ACWords.DATA*");
Del(TOS_DISTRO_DIR "/Adam/God/Vocab.DD.Z");
Del(TOS_DISTRO_DIR "/Misc/OSTestSuite.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/UltraMenu.DD.Z",
@@ -334,7 +334,7 @@ U0 MakeUltraDistro()
ISO9660ISO(TOS_ISO_NAME,TOS_DISTRO_DIR "/*",,
TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -343,7 +343,7 @@ U0 MakeUltraRedSeaDistro()
UltraDistroPrep;
RedSeaISO(TOS_ISO_C_NAME,TOS_DISTRO_DIR,TOS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSULTRA_RS_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -351,8 +351,7 @@ U0 MakeUltraRedSeaDistro()
U0 MakeSup1ISO()
{
RedSeaISO(TOS_ISO_C_NAME,"::/Home/Sup1");
DefinePrint("DD_TEMPLEOS_SUP1_SIZE",
"Supplemental ISO #1 (%0.2f MB)",
DefinePrint("DD_TEMPLEOS_SUP1_SIZE","Supplemental ISO #1 (%0.2fMB)",
0.01*(100*Size(TOS_ISO_C_NAME,"+s")/1024/1024));
Drv('C');
}
@@ -361,40 +360,39 @@ U0 UpdateISODocDefines()
{
try {
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1fMB)",
0.1*(10*Size("D:/Wb/TempleOSCD.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_K_SIZE",
"%d KB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
"%dKB",Size("D:/Wb/TempleOSCD.ISO","+s")/1024);
// DefinePrint("DD_TEMPLEOSCD_RS_SIZE",
// "Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1f MB)",
// "Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Standard RedSea Distro (%0.1fMB)",
// 0.1*(10*Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024/1024));
// DefinePrint("DD_TEMPLEOSCD_RS_K_SIZE",
// "%d KB",Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024);
// "%dKB",Size("D:/Wb/TempleOSCDRS.ISO","+s")/1024);
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2f MB)",
"Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - UltraSmall Distro (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSUltra.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSULTRA_K_SIZE",
"%d KB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
"%dKB",Size("D:/Wb/TempleOSUltra.ISO","+s")/1024);
// DefinePrint("DD_TEMPLEOSULTRA_RS_SIZE",
// "Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2f MB)",
// "Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - UltraSmall RedSea Distro (%0.2fMB)",
// 0.01*(100*Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024/1024));
// DefinePrint("DD_TEMPLEOSULTRA_RS_K_SIZE",
// "%d KB",Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024);
// "%dKB",Size("D:/Wb/TempleOSUltraRS.ISO","+s")/1024);
// DefinePrint("DD_TEMPLEOSDBG_SIZE",
// "Download $TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.2f MB)",
// "Download $TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.2fMB)",
// 0.01*(100*Size("D:/Wb/TempleOSDbg.ISO","+s")/1024/1024));
// DefinePrint("DD_TEMPLEOSDBG_K_SIZE",
// "%d KB",Size("D:/Wb/TempleOSDbg.ISO","+s")/1024);
// "%dKB",Size("D:/Wb/TempleOSDbg.ISO","+s")/1024);
DefinePrint("DD_TEMPLEOS_SUP1_SIZE",
"Supplemental ISO #1 (%0.2f MB)",
DefinePrint("DD_TEMPLEOS_SUP1_SIZE","Supplemental ISO #1 (%0.2fMB)",
0.01*(100*Size("D:/Wb/TempleOSSup1.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOS_SUP1_K_SIZE",
"%d KB",Size("D:/Wb/TempleOSSup1.ISO","+s")/1024);
"%dKB",Size("D:/Wb/TempleOSSup1.ISO","+s")/1024);
} catch
Fs->catch_except=TRUE;
}
+39 -39
View File
@@ -76,11 +76,11 @@ U0 TOSBibleLines(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/Wb/Home/Sup1/Sup1Blog/NumBible.DD"$ (%s)\n\nGod says...\n$$RED$$",verse);
DocPrint(doc_out,"$TX,"KingJamesBible",HTML="http://www.templeos.org/Wb/Home/Sup1/Sup1Blog/NumBible.TXT"$ (%s)\n\nGod says...\n$$RED$$",verse);
Free(verse);
doc_in=DocNew;
BibleLines(doc_in,start,num_lines,"::/Home/Sup1/Sup1Blog/NumBible.DD");
BibleLines(doc_in,start,num_lines,"::/Home/Sup1/Sup1Blog/NumBible.TXT");
while (TRUE) {//Del leading blanks
doc_e=doc_in->head.next;
if (doc_e==doc_in)
@@ -116,23 +116,23 @@ U0 TOSBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512,
I64 rand_i32=MIN_I64,I64 verbosity=GBP_SHORT)
{//Make God pick a book passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.DD"$
CDirEntry *tempde=FilesFind(files_find_mask,
CDirEntry *tmpde=FilesFind(files_find_mask,
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
*tempde1=tempde;
*tmpde1=tmpde;
I64 i=0;
U8 *st,*st2=NULL;
while (tempde) {
st=FileRead(tempde->full_name);
tempde->user_data=StrLen(st);
while (tmpde) {
st=FileRead(tmpde->full_name);
tmpde->user_data=StrLen(st);
if (verbosity==GBP_LONG)
"%08X-",i;
if (tempde->user_data>=len)
i+=tempde->user_data+1-len;
if (tmpde->user_data>=len)
i+=tmpde->user_data+1-len;
if (verbosity==GBP_LONG)
"%08X:$$LK,\"%s\",A=\"FI:%s\"$$\n",
i-1,tempde->full_name+2,tempde->full_name;
i-1,tmpde->full_name+2,tmpde->full_name;
Free(st);
tempde=tempde->next;
tmpde=tmpde->next;
}
if (rand_i32<0)
rand_i32=GodBits(32);
@@ -144,21 +144,21 @@ public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512,
if (verbosity>=GBP_MEDIUM)
"=%08X.%08X\n",i.u32[1],i.u32[0];
i=i.u32[1];
tempde=tempde1;
while (tempde) {
if (!st2 && tempde->user_data>=len) {
i-=tempde->user_data+1-len;
tmpde=tmpde1;
while (tmpde) {
if (!st2 && tmpde->user_data>=len) {
i-=tmpde->user_data+1-len;
if (i<0) {
st=FileRead(tempde->full_name);
st2=st+(tempde->user_data+1-len)+i;
st=FileRead(tmpde->full_name);
st2=st+(tmpde->user_data+1-len)+i;
st2[len]=0;
"%s\nGod says...\n$$RED$$%s$$FG$$\n",tempde->full_name,st2;
"%s\nGod says...\n$$RED$$%s$$FG$$\n",tmpde->full_name,st2;
Free(st);
}
}
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
U8 *GodVideoRead(U8 *filename,I64 line)
@@ -386,20 +386,20 @@ class CCertRandDec5Form
U0 GodWordBatch(CHexWordForm *url)
{
I64 i=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
FifoU8Flush(god.fifo);
GodHexIns(url->rnd0);
GodHexIns(url->rnd1);
GodHexIns(url->rnd2);
GodHexIns(url->rnd3);
tempde=tempde1=FilesFind(god.word_file_mask,god.word_fuf_flags);
while (tempde) {
PutFileLink(tempde->full_name);
tmpde=tmpde1=FilesFind(god.word_file_mask,god.word_fuf_flags);
while (tmpde) {
PutFileLink(tmpde->full_name);
'\n';
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
"\n$$RED$$";
if (*url->rnd0)
@@ -443,7 +443,7 @@ U0 NISTBeaconURL(I64 timestamp)
U8 *tag;
CDateStruct ds;
CDate dt=(timestamp-NIST_TIME_OFFSET)*CDATE_FREQ+Str2Date("1/1/1970");
Date2Struct(&ds,dt+local_time_offset);
Date2Struct(&ds,dt+local_time_offset+30*CDATE_FREQ);
"$$TX,\"NIST Beacon Date:%D Time:%02d:%02d Unix TimeStamp:%u\","
"HTML=\"https://beacon.nist.gov/home\"$$\n",dt,ds.hour,ds.min,timestamp;
tag=MStrPrint("https:/beacon.nist.gov/rest/record/%d",timestamp);
@@ -816,34 +816,34 @@ U0 TOSInsMisc()
U0 GodCodeJmp()
{//$LK,"::/Adam/God/HSNotes.DD"$
CDirEntry *tempde1=FilesFind("/*",
CDirEntry *tmpde1=FilesFind("/*",
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
*tempde=tempde1;
*tmpde=tmpde1;
I64 cnt=0,num;
CDoc *doc;
U8 *st;
while (tempde) {
doc=DocRead(tempde->full_name);
tempde->user_data=doc->head.y;
while (tmpde) {
doc=DocRead(tmpde->full_name);
tmpde->user_data=doc->head.y;
cnt+=doc->head.y;
DocDel(doc);
tempde=tempde->next;
tmpde=tmpde->next;
}
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
num=GodBits(GOD_GOOD_BITS)%cnt;
tempde=tempde1;
while (tempde) {
num-=tempde->user_data;
tmpde=tmpde1;
while (tmpde) {
num-=tmpde->user_data;
if (num<0) {
st=MStrPrint("FL:%s,%d",tempde->full_name,-num);
st=MStrPrint("FL:%s,%d",tmpde->full_name,-num);
break;
}
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
Ed(st);
Free(st);
}
+24 -24
View File
@@ -10,13 +10,13 @@ public U0 CursorRem(U8 *files_find_mask="*")
{
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
while (tempde) {
CursorRemFile(tempde->full_name);
Touch(tempde->full_name,"",,tempde->datetime);
tempde=tempde->next;
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
while (tmpde) {
CursorRemFile(tmpde->full_name);
Touch(tmpde->full_name,"",,tmpde->datetime);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
U0 UncollapseFile(U8 *filename,I64 *)
@@ -29,15 +29,15 @@ U0 UncollapseFile(U8 *filename,I64 *)
public U0 Uncollapse(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T+O");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+$$+O");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
UncollapseFile(tempde->full_name,&fuf_flags);
Touch(tempde->full_name,"",,tempde->datetime);
tempde=tempde->next;
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
UncollapseFile(tmpde->full_name,&fuf_flags);
Touch(tmpde->full_name,"",,tmpde->datetime);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
#define VIDEO_FRAME_RATE 30
@@ -50,21 +50,21 @@ Bool fg_on =FALSE;
U0 FrameGrabberTask(I64)
{//#!/bin/bash
//for f in ./ScreenShots/*.Z; do ./Bin/TOSZ $$f; done
//for f in ./ScrnShots/*.Z; do ./Bin/TOSZ $$f; done
//ffmpeg -r 8 -i VID%05d.BMP -y Movie.avi
I64 frame_num=0;
U8 buf[STR_LEN],buf2[STR_LEN],*st_dir;
F64 end_time=tS;
Silent; //no output to screen
Silent; //no output to scrn
if (fg_mode==FG_RAM_DRV)
st_dir="B:/Temp/ScreenShots";
st_dir="B:/Tmp/ScrnShots";
else
st_dir="::/Temp/ScreenShots";
st_dir="::/Tmp/ScrnShots";
MkDir(st_dir);
while (fg_on) {
StrPrint(buf,"%s/VID%05d.BMP.Z",st_dir,frame_num++);
StrCpy(buf2,buf);
BMPScreenCapture(buf);
BMPScrnCapture(buf);
while (TRUE) {
end_time+=1.0/VIDEO_FRAME_RATE;
if (end_time<tS) {
@@ -80,17 +80,17 @@ U0 FrameGrabberTask(I64)
I64 CopyVideo()
{
I64 res=0;
Del("D:/Temp/*.SND");
Del("D:/Tmp/*.SND");
if (fg_mode==FG_JUST_AUDIO)
SndFileCreate("D:/Temp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35,2.5);
SndFileCreate("D:/Tmp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35,2.5);
else {
SndFileCreate("D:/Temp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35);
DelTree("D:/Temp/ScreenShots");
SndFileCreate("D:/Tmp/Audio",0.115,0.0,WF_SQUARE,0.45,0.35);
DelTree("D:/Tmp/ScrnShots");
if (fg_mode==FG_RAM_DRV) {
res=CopyTree("B:/Temp/ScreenShots","D:/Temp/ScreenShots");
res=CopyTree("B:/Tmp/ScrnShots","D:/Tmp/ScrnShots");
"Unused Space: %12.6fMeg\n",UnusedDrvSpace('B')/1024.0/1024.0;
} else
res=CopyTree("::/Temp/ScreenShots","D:/Temp/ScreenShots");
res=CopyTree("::/Tmp/ScrnShots","D:/Tmp/ScrnShots");
"$$BK,1$$Files Copied:%d$$BK,0$$ Time:%8.3fm\n",
res,res/60.0/VIDEO_FRAME_RATE;
}
+14 -14
View File
@@ -171,7 +171,7 @@ public CDoc *Doc2Html(CDoc *doc_in,U8 *html_header=NULL,U8 *body_header=NULL,
"<head>\n"
"<meta http-equiv=\"Content-Type\" "
"content=\"text/html;charset=US-ASCII\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$\">\n";
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$\">\n";
if (!body_header) body_header=
"<body>\n"
"<pre style=\"font-family:courier;font-size:10pt\">\n";
@@ -393,7 +393,7 @@ U0 TOSWebFile(U8 *name)
"<meta name=\"keywords\" "
"content=\"Operating System,64-Bit,64 Bit,"
"Temple,OS,TempleOS,Free,Open Source,Public Domain,x86_64\">\n"
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.10",D="DD_OS_NAME_VERSION"$\">\n",
"<meta name=\"generator\" content=\"$TX,"TempleOS V4.12",D="DD_OS_NAME_VERSION"$\">\n",
"<body style=\"background-color:#55FFFF; border-style:solid;
border-width:8px; border-color:#0000AA;
@@ -410,7 +410,7 @@ U0 TOSWebFile(U8 *name)
public U0 MakeWebSite()
{
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
DocClear;
Cd("D:/Wb");
DelTree("D:/Wb/Home/Budget");
@@ -419,19 +419,19 @@ public U0 MakeWebSite()
Touch("D:/Wb/Home/Web/index.DD.Z","");
Touch("D:/Wb/Home/Web/DownloadOS.DD.Z","");
Touch("D:/Wb/Home/Web/TempleOS.DD.Z","");
tempde=tempde1=FilesFind("*",
tmpde=tmpde1=FilesFind("*",
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tempde) {
TOSWebFile(tempde->full_name);
tempde=tempde->next;
while (tmpde) {
TOSWebFile(tmpde->full_name);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
Drv('C');
}
U0 FreshenWebDir(U8 *dirname)
{//No recurse
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
U8 *src,*dst;
src=MStrPrint("D:/Wb%s",dirname);
@@ -449,11 +449,11 @@ U0 FreshenWebDir(U8 *dirname)
Free(dst);
src=MStrPrint("D:/Wb%s/*",dirname);
tempde=tempde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tempde) {
TOSWebFile(tempde->full_name);
tempde=tempde->next;
tmpde=tmpde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tmpde) {
TOSWebFile(tmpde->full_name);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
+1 -1
View File
@@ -13,7 +13,7 @@ asm {
_BEEPS::
//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TEMP",A="MN:REGG_STK_TEMP"$.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
+1 -1
View File
@@ -19,7 +19,7 @@ JIFFIES_MSG: DU8 "Jiffies:",0;
_BEEPS2::
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TEMP",A="MN:REGG_STK_TEMP"$.
//See $LK,"REGG_CLOBBERED",A="MN:REGG_CLOBBERED"$ and $LK,"REGG_STK_TMP",A="MN:REGG_STK_TMP"$.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/KernelA.HH,SF_ARG1"$
-12
View File
@@ -1,12 +0,0 @@
/* This is not an AutoFile. It uses $LK,"AutoStr",A="MN:AutoStr"$
to run text as though from an AutoFile.
This example shows how you can drive pop-up
windows.
*/
Auto(" ");
"PopUp #1:%X\n",PopUpNoYes;
AutoStr("Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);'' CH_SPACE;");
"PopUp #2:%X\n",PopUpNoYes;
-11
View File
@@ -1,11 +0,0 @@
/* To run this, do a directory, right click on
this file's name and sel "AutoFile".
Or, type $LK,"AutoFile",A="MN:AutoFile"$(filename);
See $LK,"AutoFile",A="FF:::/Doc/Glossary.DD,AutoFile"$ in the glossary for more info.
Profiling does not $UL,1$require$UL,0$ autofiles.
*/
"$$RED$$Prof;$$FG$$\n";
"$$RED$$//Collecting Data$$FG$$";
PressAKey;
"\n$$RED$$ProfRep;$$FG$$\n";
+4 -4
View File
@@ -31,15 +31,15 @@ BigShift;
U0 Branch()
{
U64 i=0xFFCC3311,j;
"Branch\n";
'Branch\n';
for (j=0;j<64;j++) {
i<<=1;
if (Carry)
"1";
'1';
else
"0";
'0';
}
"\n";
'\n';
}
Branch;
+3 -3
View File
@@ -29,14 +29,14 @@ class Test2Struct
U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
{//lastclass is keyword. See $LK,"::/Demo/LastClass.HC"$.
CHashClass *tempc=HashFind(class_name,Fs->hash_table,HTT_CLASS);
CHashClass *tmpc=HashFind(class_name,Fs->hash_table,HTT_CLASS);
U8 *print_str;
I64 *q,dft_val;
U0 (* fp_output_fun)(I64 i);
F64 percentile;
if (!tempc) return;
if (!tmpc) return;
CMemberLst *ml;
ml=tempc->member_lst_and_root;
ml=tmpc->member_lst_and_root;
while (ml) {
"%s:",ml->str;
+8 -8
View File
@@ -1,13 +1,13 @@
U0 Directives()
{
"Date :%s\n",__DATE__;
"Time :%s\n",__TIME__;
"File :%s\n",__FILE__;
"Dir :%s\n",__DIR__;
"Line :%d\n",__LINE__;
"CmdLine:%d\n",__CMD_LINE__;
"Inst1 :%P:%08X\n",$$,$$;
"Inst2 :%P:%08X\n",$$,$$;
"Date\t:%s\n",__DATE__;
"Time\t:%s\n",__TIME__;
"File\t:%s\n",__FILE__;
"Dir\t:%s\n",__DIR__;
"Line\t:%d\n",__LINE__;
"CmdLine\t:%d\n",__CMD_LINE__;
"Inst1\t:%P:%08X\n",$$,$$;
"Inst2\t:%P:%08X\n",$$,$$;
}
Directives;
+1 -1
View File
@@ -38,7 +38,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
"%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 "
"the scrn color attr of the "
"entry. '$$PURPLE$$doc_e->type.u16[1]"
"$$GREEN$$' is some flags for blinking and "
"stuff. See $$LK,\"Doc Type Flag "
+11 -11
View File
@@ -1,25 +1,25 @@
U0 TreeSub(CDoc *doc,CDirEntry *tempde)
U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
{
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr & RS_ATTR_DIR) {
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tempde->name,tempde->full_name);
if (tempde->sub) {
tmpde->name,tmpde->full_name);
if (tmpde->sub) {
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,tempde->sub);
TreeSub(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
}
} else
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
tempde->name,tempde->full_name);
tmpde->name,tmpde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tempde);
tempde=tempde1;
DirEntryDel(tmpde);
tmpde=tmpde1;
}
}
+12 -12
View File
@@ -16,7 +16,7 @@ U0 UnusedDefineScan()
CDoc *old_put_doc,*old_display_doc,*doc;
I64 i,cnt=0;
CHashTable *table;
CHash *temph;
CHash *tmph;
CDocEntry *doc_e,*doc_e2;
Bool old_silent=IsSilent;
@@ -24,11 +24,11 @@ U0 UnusedDefineScan()
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
temph=table->body[i];
while (temph) {
if (temph->type&HTT_DEFINE_STR)
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR)
cnt++;
temph=temph->next;
tmph=tmph->next;
}
}
table=table->next;
@@ -41,22 +41,22 @@ U0 UnusedDefineScan()
table=Fs->hash_table;
while (table) {
for (i=0;i<=table->mask;i++) {
temph=table->body[i];
while (temph) {
if (temph->type&HTT_DEFINE_STR) {
tmph=table->body[i];
while (tmph) {
if (tmph->type&HTT_DEFINE_STR) {
progress1++;
if (FileOcc(temph->str,"/*","+l-i+T")==1) {
if (FileOcc(tmph->str,"/*","+l-i+$$")==1) {
doc=DocNew;
old_put_doc=DocPut;
old_display_doc=DocDisplay;
Fs->put_doc=Fs->display_doc=doc;
Find(temph->str,"/*","+l-i+T");
Find(tmph->str,"/*","+l-i+$$");
Fs->put_doc=old_put_doc;
Fs->display_doc=old_display_doc;
doc_e=doc->head.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_LINK) {
"%s ",temph->str;
"%s ",tmph->str;
doc_e2=DocEntryCopy(doc,doc_e);
DocInsEntry(old_put_doc,doc_e2);
'\n';
@@ -66,7 +66,7 @@ U0 UnusedDefineScan()
DocDel(doc);
}
}
temph=temph->next;
tmph=tmph->next;
}
}
table=table->next;
+11 -11
View File
@@ -4,28 +4,28 @@ hold the file until you are done. The $LK,"CDoc",A="MN:CDoc"$
framework is convenient for this.
*/
U0 TreeSub(CDoc *doc,CDirEntry *tempde)
U0 TreeSub(CDoc *doc,CDirEntry *tmpde)
{
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr & RS_ATTR_DIR) {
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tempde->name,tempde->full_name);
if (tempde->sub) {
tmpde->name,tmpde->full_name);
if (tmpde->sub) {
DocPrint(doc,"$$ID,+2$$");
TreeSub(doc,tempde->sub);
TreeSub(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
}
} else
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
tempde->name,tempde->full_name);
tmpde->name,tmpde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tempde);
tempde=tempde1;
DirEntryDel(tmpde);
tmpde=tmpde1;
}
}
+8 -8
View File
@@ -6,16 +6,16 @@ other end.
U0 SerializeTree()
{
CDirEntry *tempde=FilesFind("/Demo/*.DD*",FUF_RECURSE);
CDirEntry *tmpde=FilesFind("/Demo/*.DD*",FUF_RECURSE);
I64 size;
U8 *ptr;
CArcCompress *arc;
LineRep1(tempde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
LineRep2(DocPut,tempde);
LineRep1(tmpde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
LineRep2(DocPut,tmpde);
"$$GREEN$$***************$$FG$$\n";
ptr=DirTreeSerialize(tempde,&size);
DirTreeDel(tempde);
ptr=DirTreeSerialize(tmpde,&size);
DirTreeDel(tmpde);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
arc=CompressBuf(ptr,size);
@@ -27,9 +27,9 @@ U0 SerializeTree()
Free(arc);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
tempde=DirTreeUnserialize(ptr);
LineRep2(DocPut,tempde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
DirTreeDel(tempde);
tmpde=DirTreeUnserialize(ptr);
LineRep2(DocPut,tmpde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
DirTreeDel(tmpde);
}
SerializeTree;
+1 -2
View File
@@ -1,4 +1,3 @@
U8 face[8]={
0b00111100,
@@ -30,7 +29,7 @@ U0 SrcExample()
}
SrcExample;
//See $LK,"::/Demo/ScreenCodes.HC"$, $LK,"::/Demo/Graphics/CharAnimation.HC"$,
//See $LK,"::/Demo/ScrnCodes.HC"$, $LK,"::/Demo/Graphics/CharAnimation.HC"$,
//$LK,"::/Demo/Games/CharDemo.HC"$ and $LK,"::/Demo/Graphics/FontEd.HC"$.
//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.
+100 -100
View File
@@ -83,7 +83,7 @@ $SP,"<1>",BI=1$
#define SCREEN_SCALE 512
#define SCRN_SCALE 512
#define PLOT_GRID_WIDTH 24
#define PLOT_GRID_HEIGHT 24
#define MAN_HEIGHT 125
@@ -110,10 +110,10 @@ U0 CFTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
Mat4x4MulXYZ(dc->r,x,y,z);
zz=SCREEN_SCALE/3+*z;
zz=SCRN_SCALE/3+*z;
if (zz<1) zz=1;
*x=SCREEN_SCALE/2* *x/zz;
*y=SCREEN_SCALE/2* (*y+MAN_HEIGHT)/zz;
*x=SCRN_SCALE/2* *x/zz;
*y=SCRN_SCALE/2* (*y+MAN_HEIGHT)/zz;
*x+=dc->x;
*y+=dc->y;
*z+=dc->z;
@@ -131,8 +131,8 @@ 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);
return Line(NULL,x1*LOS_SCALE/SCRN_SCALE,y1*LOS_SCALE/SCRN_SCALE,0,
x2*LOS_SCALE/SCRN_SCALE,y2*LOS_SCALE/SCRN_SCALE,0,&LOSPlot);
}
U0 DrawIt(CTask *task,CDC *dc)
@@ -141,28 +141,28 @@ U0 DrawIt(CTask *task,CDC *dc)
c,x1w,y1w,x1h,y1h,xh,yh,zh,
cx=task->pix_width/2,
cy=task->pix_height/2;
U8 *temps;
U8 *tmps;
F64 tt;
CD3I32 poly[4];
Monster *tempm;
Monster *tmpm;
DCDepthBufAlloc(dc);
MemSet(panels_processed_bitmap,0,(map_width*map_height+7)>>3);
//World to screen
//World to scrn
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;
xh=-man_xx/SCRN_SCALE; yh=-man_yy/SCRN_SCALE; zh=0;
Mat4x4MulXYZ(dc->r,&xh,&yh,&zh);
Mat4x4TranslationEqu(dc->r,xh,yh,zh);
//Screen to world
//Scrn to world
s2w=Mat4x4IdentNew(task);
Mat4x4RotX(s2w,-ã/2);
Mat4x4RotZ(s2w,-man_é-ã/2);
xh=0; yh=0; zh=SCREEN_SCALE;
xh=0; yh=0; zh=SCRN_SCALE;
Mat4x4MulXYZ(s2w,&xh,&yh,&zh);
//Rotate light source
@@ -194,12 +194,12 @@ U0 DrawIt(CTask *task,CDC *dc)
x1w=x1h;
y1w=y1h;
for (i=0;i<PLOT_GRID_WIDTH*4;i++) {
xx=x1w/SCREEN_SCALE; yy=y1w/SCREEN_SCALE;
x=xx*SCREEN_SCALE-man_xx; y=yy*SCREEN_SCALE-man_yy;
xx=x1w/SCRN_SCALE; yy=y1w/SCRN_SCALE;
x=xx*SCRN_SCALE-man_xx; y=yy*SCRN_SCALE-man_yy;
if (1<=xx<map_width-1 && 1<=yy<map_height-1 &&
!LBts(panels_processed_bitmap,yy*map_width+xx)) {
if ((c=map[yy*map_width+xx]) &&
LOS(xx*SCREEN_SCALE+SCREEN_SCALE/2,yy*SCREEN_SCALE+SCREEN_SCALE/2,
LOS(xx*SCRN_SCALE+SCRN_SCALE/2,yy*SCRN_SCALE+SCRN_SCALE/2,
man_xx,man_yy)) {
if (c==YELLOW)
dc->color=DKGRAY;
@@ -208,62 +208,62 @@ U0 DrawIt(CTask *task,CDC *dc)
poly[0].x=x;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCREEN_SCALE;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y;
poly[1].z=0;
poly[2].x=x+SCREEN_SCALE;
poly[2].y=y+SCREEN_SCALE;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=0;
poly[3].x=x;
poly[3].y=y+SCREEN_SCALE;
poly[3].y=y+SCRN_SCALE;
poly[3].z=0;
GrFillPoly3(dc,4,poly);
if (c==GREEN) {
x1=x+SCREEN_SCALE/2;
y1=y+SCREEN_SCALE/2;
x1=x+SCRN_SCALE/2;
y1=y+SCRN_SCALE/2;
z1=0;
DCTransform(dc,&x1,&y1,&z1);
if (z1>0)
SpriteMat3B(dc,x+SCREEN_SCALE/2,y+SCREEN_SCALE/2,0,$IB,"<5>",BI=5$,r3);
SpriteMat3B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<5>",BI=5$,r3);
} else if (c==YELLOW) {
x1=x+SCREEN_SCALE/2;
y1=y+SCREEN_SCALE/2;
x1=x+SCRN_SCALE/2;
y1=y+SCRN_SCALE/2;
z1=0;
DCTransform(dc,&x1,&y1,&z1);
if (z1>0)
SpriteMat3B(dc,x+SCREEN_SCALE/2,y+SCREEN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
SpriteMat3B(dc,x+SCRN_SCALE/2,y+SCRN_SCALE/2,0,$IB,"<6>",BI=6$,r3);
}
if (!map[(yy+1)*map_width+xx]) {
dc->color=LTGRAY;
poly[0].x=x;
poly[0].y=y+SCREEN_SCALE;
poly[0].y=y+SCRN_SCALE;
poly[0].z=0;
poly[1].x=x+SCREEN_SCALE;
poly[1].y=y+SCREEN_SCALE;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x+SCREEN_SCALE;
poly[2].y=y+SCREEN_SCALE;
poly[2].z=SCREEN_SCALE;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y+SCREEN_SCALE;
poly[3].z=SCREEN_SCALE;
poly[3].y=y+SCRN_SCALE;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[yy*map_width+xx+1]) {
dc->color=WHITE;
poly[0].x=x+SCREEN_SCALE;
poly[0].x=x+SCRN_SCALE;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCREEN_SCALE;
poly[1].y=y+SCREEN_SCALE;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x+SCREEN_SCALE;
poly[2].y=y+SCREEN_SCALE;
poly[2].z=SCREEN_SCALE;
poly[3].x=x+SCREEN_SCALE;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x+SCRN_SCALE;
poly[3].y=y;
poly[3].z=SCREEN_SCALE;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[(yy-1)*map_width+xx]) {
@@ -271,15 +271,15 @@ U0 DrawIt(CTask *task,CDC *dc)
poly[0].x=x;
poly[0].y=y;
poly[0].z=0;
poly[1].x=x+SCREEN_SCALE;
poly[1].x=x+SCRN_SCALE;
poly[1].y=y;
poly[1].z=0;
poly[2].x=x+SCREEN_SCALE;
poly[2].x=x+SCRN_SCALE;
poly[2].y=y;
poly[2].z=SCREEN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y;
poly[3].z=SCREEN_SCALE;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
if (!map[yy*map_width+xx-1]) {
@@ -288,14 +288,14 @@ U0 DrawIt(CTask *task,CDC *dc)
poly[0].y=y;
poly[0].z=0;
poly[1].x=x;
poly[1].y=y+SCREEN_SCALE;
poly[1].y=y+SCRN_SCALE;
poly[1].z=0;
poly[2].x=x;
poly[2].y=y+SCREEN_SCALE;
poly[2].z=SCREEN_SCALE;
poly[2].y=y+SCRN_SCALE;
poly[2].z=SCRN_SCALE;
poly[3].x=x;
poly[3].y=y;
poly[3].z=SCREEN_SCALE;
poly[3].z=SCRN_SCALE;
GrFillPoly3(dc,4,poly);
}
}
@@ -308,9 +308,9 @@ U0 DrawIt(CTask *task,CDC *dc)
}
//Draw Monsters
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++) {
x=tempm->x;
y=tempm->y;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (LOS(x,y,man_xx,man_yy)) {
x-=man_xx;
y-=man_yy;
@@ -319,13 +319,13 @@ U0 DrawIt(CTask *task,CDC *dc)
zz=0;
DCTransform(dc,&xx,&yy,&zz);
if (zz>0) {
if (tempm->dead)
if (tmpm->dead)
SpriteMat3B(dc,x,y,0,$IB,"<2>",BI=2$,r2);
else {
tt=Tri(tS,1.0);
temps=SpriteInterpolate(tt,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$);
SpriteMat3B(dc,x,y,0,temps,r1);
Free(temps);
tmps=SpriteInterpolate(tt,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$);
SpriteMat3B(dc,x,y,0,tmps,r1);
Free(tmps);
}
}
}
@@ -350,12 +350,12 @@ U0 DrawIt(CTask *task,CDC *dc)
//Draw Things on heads-up Map
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);
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
if (!tmpm->dead)
GrPlot3(dc,2*(tmpm->x/SCRN_SCALE),
2*(map_height-1-tmpm->y/SCRN_SCALE),0);
dc->color=LTCYAN;
GrPlot3(dc,2*(man_xx/SCREEN_SCALE),2*(map_height-1-man_yy/SCREEN_SCALE),0);
GrPlot3(dc,2*(man_xx/SCRN_SCALE),2*(map_height-1-man_yy/SCRN_SCALE),0);
if (tf) {
dc->color=LTRED;
@@ -378,13 +378,13 @@ U0 Fire()
{
I64 i,x,y;
F64 d,dx,dy,xx=Cos(man_é),yy=Sin(man_é);
Monster *tempm;
Monster *tmpm;
Noise(100,300,1000);
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++) {
x=tempm->x;
y=tempm->y;
if (!tempm->dead &&
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
x=tmpm->x;
y=tmpm->y;
if (!tmpm->dead &&
LOS(x,y,man_xx,man_yy)) {
dx=x-man_xx;
dy=man_yy-y;
@@ -392,7 +392,7 @@ U0 Fire()
dx/=d;
dy/=d;
if (dx*xx+dy*yy>0.995) {
tempm->dead=TRUE;
tmpm->dead=TRUE;
if (!--monsters_left) {
tf=tS;
if (tf-t0<best_score)
@@ -408,7 +408,7 @@ U0 Init()
{
I64 i,x,y;
CDC *dc;
Monster *tempm;
Monster *tmpm;
DocClear;
"$$BG,BLACK$$%h*c",TEXT_ROWS/2,'\n';
@@ -424,16 +424,16 @@ U0 Init()
for (x=0;x<map_width-2;x++)
map[(map_height-2-y)*map_width+x+1]=GrPeek(dc,x*MAP_SCALE,y*MAP_SCALE);
DCDel(dc);
man_xx=(1+MAN_START_X)*SCREEN_SCALE;
man_yy=(map_height-1-MAN_START_Y)*SCREEN_SCALE;
man_xx=(1+MAN_START_X)*SCRN_SCALE;
man_yy=(map_height-1-MAN_START_Y)*SCRN_SCALE;
man_é=0;
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++) {
tempm->dead=FALSE;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
tmpm->dead=FALSE;
do {
tempm->x=RandU64%((map_width-2)*SCREEN_SCALE)+SCREEN_SCALE;
tempm->y=RandU64%((map_height-2)*SCREEN_SCALE)+SCREEN_SCALE;
} while (!map[(tempm->y/SCREEN_SCALE)*map_width+tempm->x/SCREEN_SCALE]);
tmpm->x=RandU64%((map_width-2)*SCRN_SCALE)+SCRN_SCALE;
tmpm->y=RandU64%((map_height-2)*SCRN_SCALE)+SCRN_SCALE;
} while (!map[(tmpm->y/SCRN_SCALE)*map_width+tmpm->x/SCRN_SCALE]);
}
monsters_left=NUM_MONSTERS;
tf=0;
@@ -443,33 +443,33 @@ U0 Init()
U0 AnimateTask(I64)
{
I64 i,x,y,dd;
Monster *tempm;
Monster *tmpm;
while (TRUE) {
dd=0.25*SCREEN_SCALE*Sin(tS/2);
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++)
if (!tempm->dead) {
x=tempm->x;
y=tempm->y;
dd=0.25*SCRN_SCALE*Sin(tS/2);
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
if (!tmpm->dead) {
x=tmpm->x;
y=tmpm->y;
if (i&1)
x+=dd;
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]) {
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;
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;
tempm->x=x;
tempm->y=y;
if (0<=x<=map_width*SCRN_SCALE &&
0<=y<=map_height*SCRN_SCALE &&
map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE]) {
if (!map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE+1] &&
x-RoundI64(x,SCRN_SCALE)>SCRN_SCALE/2 ||
!map[(y/SCRN_SCALE)*map_width+x/SCRN_SCALE-1] &&
x-RoundI64(x,SCRN_SCALE)<SCRN_SCALE/2)
x=RoundI64(x,SCRN_SCALE)+SCRN_SCALE/2;
if (!map[(y/SCRN_SCALE+1)*map_width+x/SCRN_SCALE] &&
y-RoundI64(y,SCRN_SCALE)>SCRN_SCALE/2 ||
!map[(y/SCRN_SCALE-1)*map_width+x/SCRN_SCALE] &&
y-RoundI64(y,SCRN_SCALE)<SCRN_SCALE/2)
y=RoundI64(y,SCRN_SCALE)+SCRN_SCALE/2;
tmpm->x=x;
tmpm->y=y;
}
}
Sleep(20);
@@ -497,13 +497,13 @@ U0 SongTask(I64)
U0 MoveMan(F64 é)
{
I64 x,y,color,step=SCREEN_SCALE/2;
I64 x,y,color,step=SCRN_SCALE/2;
do {
x=man_xx+step*Cos(é);
y=man_yy-step*Sin(é);
x=Clamp(x,0,map_width*SCREEN_SCALE);
y=Clamp(y,0,map_height*SCREEN_SCALE);
color=map[y/SCREEN_SCALE*map_width+x/SCREEN_SCALE];
x=Clamp(x,0,map_width*SCRN_SCALE);
y=Clamp(y,0,map_height*SCRN_SCALE);
color=map[y/SCRN_SCALE*map_width+x/SCRN_SCALE];
if (color==DKGRAY || color==GREEN) {
man_xx=x;
man_yy=y;
+13 -13
View File
@@ -1,7 +1,7 @@
/*
Char graphics are how games on the C64 were made. You don't need to do it
this way, unless for fun. You can just make device context bigger than
the screen and scroll around.
the scrn and scroll around.
See $LK,"::/Demo/Games/RawHide.HC"$ or $LK,"::/Demo/Games/BigGuns.HC"$.
@@ -17,17 +17,17 @@ The nice thing about character graphics are the animations.
U16 map[MAP_HEIGHT][MAP_WIDTH];
I64 screen_pix_x,screen_pix_y;
I64 scrn_pix_x,scrn_pix_y;
U0 DrawIt(CTask *task,CDC *)
{
U16 *ptr;
I64 i,j,y=screen_pix_y>>3;
I64 i,j,y=scrn_pix_y>>3;
gr.hide_col=gr.hide_row=TRUE;
gr.pan_text_x=7-screen_pix_x&7;
gr.pan_text_y=7-screen_pix_y&7;
gr.pan_text_x=7-scrn_pix_x&7;
gr.pan_text_y=7-scrn_pix_y&7;
for (i=0;i<task->win_height;i++) {
ptr=&map[y++][screen_pix_x>>3];
ptr=&map[y++][scrn_pix_x>>3];
for (j=0;j<task->win_width;j++)
//By the time you clip to window and handle Fs->scroll_x,Fs->scroll_y,
//it is too much trouble to do raw access to gr.text_base like we do
@@ -58,7 +58,7 @@ U0 AnimateTask(I64)
while (TRUE) {
font[CH_WATER]=waves[i++&0x3];
Sleep(200);
WinMgrSync;
Refresh;
}
}
@@ -66,9 +66,9 @@ U0 ScrollTaskX(I64 sign)
{
I64 i;
for (i=0;i<32;i++) {
screen_pix_x=ClampI64(screen_pix_x+sign,0,
scrn_pix_x=ClampI64(scrn_pix_x+sign,0,
(MAP_WIDTH-TEXT_COLS+1)*FONT_WIDTH);
WinMgrSync;
Refresh;
}
}
@@ -76,17 +76,17 @@ U0 ScrollTaskY(I64 sign)
{
I64 i;
for (i=0;i<32;i++) {
screen_pix_y=ClampI64(screen_pix_y+sign,0,
scrn_pix_y=ClampI64(scrn_pix_y+sign,0,
(MAP_HEIGHT-TEXT_ROWS+2)*FONT_HEIGHT);
WinMgrSync;
Refresh;
}
}
U0 Init()
{
I64 i,j,x,y;
screen_pix_x=(MAP_WIDTH-TEXT_COLS)>>1*FONT_WIDTH;
screen_pix_y=(MAP_HEIGHT-TEXT_ROWS)>>1*FONT_HEIGHT;
scrn_pix_x=(MAP_WIDTH-TEXT_COLS)>>1*FONT_WIDTH;
scrn_pix_y=(MAP_HEIGHT-TEXT_ROWS)>>1*FONT_HEIGHT;
MemSetU16(map,CH_WATER+(BLUE<<4+LTBLUE)<<8,MAP_WIDTH*MAP_HEIGHT);
for (i=1;i<MAP_WIDTH-1;i++)
+1 -1
View File
@@ -98,7 +98,7 @@ U0 CircleTrace()
//window mgr calls the UpdateWin() routine
//and places msgs in the que, so there's
//no need to do anything until the window mgr runs.
WinMgrSync;
Refresh;
} while (msg_code!=MSG_IP_L_UP);
music.mute=TRUE; Sleep(200);
+77 -77
View File
@@ -49,10 +49,10 @@ U8 *tiles1[16]={NULL,$IB,"<7>",BI=7$ ,$IB,"<5>",BI=5$ ,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
#define SCREEN_HEIGHT 24
I64 screen_x,screen_y;
#define SCRN_SCALE 24
#define SCRN_WIDTH 24
#define SCRN_HEIGHT 24
I64 scrn_x,scrn_y;
#define MAP_SCALE 4
I64 map_width,map_height;
@@ -97,7 +97,7 @@ U0 DrawIt(CTask *task,CDC *dc)
CD3I32 poly[4];
U8 **_tiles;
F64 tt;
Monster *tempm;
Monster *tmpm;
if (Blink(5))
_tiles=tiles1;
@@ -115,32 +115,32 @@ U0 DrawIt(CTask *task,CDC *dc)
//if you did it like $LK,"::/Demo/Games/BigGuns.HC"$
//with a $LK,"CDC",A="MN:CDC"$.
for (y=-SCREEN_HEIGHT/2;y<SCREEN_HEIGHT/2;y++) {
yy=y+screen_y;
for (y=-SCRN_HEIGHT/2;y<SCRN_HEIGHT/2;y++) {
yy=y+scrn_y;
if (0<=yy<map_height)
for (x=-SCREEN_WIDTH/2;x<SCREEN_WIDTH/2;x++) {
xx=x+screen_x;
for (x=-SCRN_WIDTH/2;x<SCRN_WIDTH/2;x++) {
xx=x+scrn_x;
if (0<=xx<map_width) {
if ((color=map[yy*map_width+xx]) &&
LOS(xx,yy,man_x,man_y)) {
if (_tiles[color]) {
x1=x*SCREEN_SCALE;
y1=y*SCREEN_SCALE;
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,_tiles[color]);
} else {//If no tile defined, do solid color.
poly[0].x=x*SCREEN_SCALE;
poly[0].y=y*SCREEN_SCALE;
poly[0].x=x*SCRN_SCALE;
poly[0].y=y*SCRN_SCALE;
poly[0].z=0;
poly[1].x=(x+1)*SCREEN_SCALE-1;
poly[1].y=y*SCREEN_SCALE;
poly[1].x=(x+1)*SCRN_SCALE-1;
poly[1].y=y*SCRN_SCALE;
poly[1].z=0;
poly[2].x=(x+1)*SCREEN_SCALE;
poly[2].y=(y+1)*SCREEN_SCALE-1;
poly[2].x=(x+1)*SCRN_SCALE;
poly[2].y=(y+1)*SCRN_SCALE-1;
poly[2].z=0;
poly[3].x=x*SCREEN_SCALE-1;
poly[3].y=(y+1)*SCREEN_SCALE-1;
poly[3].x=x*SCRN_SCALE-1;
poly[3].y=(y+1)*SCRN_SCALE-1;
poly[3].z=0;
dc_t->color=color;
GrFillPoly3(dc_t,4,poly);
@@ -150,23 +150,23 @@ U0 DrawIt(CTask *task,CDC *dc)
}
}
for (y=-SCREEN_HEIGHT/2;y<SCREEN_HEIGHT/2;y++) {
yy=y+screen_y;
for (y=-SCRN_HEIGHT/2;y<SCRN_HEIGHT/2;y++) {
yy=y+scrn_y;
if (0<=yy<map_height)
for (x=-SCREEN_WIDTH/2;x<SCREEN_WIDTH/2;x++) {
xx=x+screen_x;
for (x=-SCRN_WIDTH/2;x<SCRN_WIDTH/2;x++) {
xx=x+scrn_x;
if (0<=xx<map_width) {
if (!map[yy*map_width+xx]) {
if (yy+1<map_height && LOS(xx,yy+1,man_x,man_y)) {
x1=x*SCREEN_SCALE;
y1=y*SCREEN_SCALE;
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,$IB,"<9>",BI=9$);
}
if (xx+1<map_width && LOS(xx+1,yy,man_x,man_y)) {
x1=x*SCREEN_SCALE;
y1=y*SCREEN_SCALE;
x1=x*SCRN_SCALE;
y1=y*SCRN_SCALE;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,$IB,"<10>",BI=10$);
@@ -176,13 +176,13 @@ U0 DrawIt(CTask *task,CDC *dc)
}
}
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++)
if (!tempm->dead && LOS(tempm->x,tempm->y,man_x,man_y)) {
x1=(tempm->x-screen_x)*SCREEN_SCALE+SCREEN_SCALE/2;
y1=(tempm->y-screen_y)*SCREEN_SCALE+SCREEN_SCALE/2;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
if (!tmpm->dead && LOS(tmpm->x,tmpm->y,man_x,man_y)) {
x1=(tmpm->x-scrn_x)*SCRN_SCALE+SCRN_SCALE/2;
y1=(tmpm->y-scrn_y)*SCRN_SCALE+SCRN_SCALE/2;
z1=0;
DCTransform(dc_t,&x1,&y1,&z1);
if (tempm->dx<0) {
if (tmpm->dx<0) {
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
DCSymmetrySet(dc,x1,y1,x1,y1+1);
} else
@@ -190,14 +190,14 @@ U0 DrawIt(CTask *task,CDC *dc)
Sprite3(dc,x1,y1,z1,$IB,"<4>",BI=4$);
}
x1=(man_x-screen_x)*SCREEN_SCALE+SCREEN_SCALE/2;
y1=(man_y-screen_y)*SCREEN_SCALE+SCREEN_SCALE/2;
x1=(man_x-scrn_x)*SCRN_SCALE+SCRN_SCALE/2;
y1=(man_y-scrn_y)*SCRN_SCALE+SCRN_SCALE/2;
z1=0;
if (tS-man_attack_t0<0.2) {
x1+=Tri(tS-man_attack_t0,0.2)*SCREEN_SCALE*man_dx;
y1+=Tri(tS-man_attack_t0,0.2)*SCREEN_SCALE*man_dy;
x1+=Tri(tS-man_attack_t0,0.2)*SCRN_SCALE*man_dx;
y1+=Tri(tS-man_attack_t0,0.2)*SCRN_SCALE*man_dy;
if (man_dy!=1)
y1-=Saw(tS-man_attack_t0,0.2)*SCREEN_SCALE;
y1-=Saw(tS-man_attack_t0,0.2)*SCRN_SCALE;
}
DCTransform(dc_t,&x1,&y1,&z1);
if (man_dx<0) {
@@ -229,14 +229,14 @@ U0 DrawIt(CTask *task,CDC *dc)
U0 Attack()
{
I64 i;
Monster *tempm;
Monster *tmpm;
man_attack_t0=tS;
Noise(100,300,1000);
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++) {
if (!tempm->dead &&
man_x+man_dx==tempm->x && man_y+man_dy==tempm->y) {
tempm->dead=TRUE;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
if (!tmpm->dead &&
man_x+man_dx==tmpm->x && man_y+man_dy==tmpm->y) {
tmpm->dead=TRUE;
if (!--monsters_left) {
tf=tS;
if (tf-t0<best_score)
@@ -250,7 +250,7 @@ U0 Init()
{
I64 i,x,y;
CDC *dc;
Monster *tempm;
Monster *tmpm;
dc=Sprite2DC($IB,"<1>",BI=1$);
map_width =dc->width/MAP_SCALE;
@@ -268,16 +268,16 @@ U0 Init()
man_y=4;
man_dx=0;
man_dy=0;
screen_x=0;
screen_y=0;
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++) {
tempm->dead=FALSE;
tempm->dx=0;
tempm->dy=0;
scrn_x=0;
scrn_y=0;
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++) {
tmpm->dead=FALSE;
tmpm->dx=0;
tmpm->dy=0;
do {
tempm->x=RandU64%(map_width-2)+1;
tempm->y=RandU64%(map_height-2)+1;
} while (!map[(tempm->y)*map_width+tempm->x]);
tmpm->x=RandU64%(map_width-2)+1;
tmpm->y=RandU64%(map_height-2)+1;
} while (!map[(tmpm->y)*map_width+tmpm->x]);
}
monsters_left=NUM_MONSTERS;
tf=0;
@@ -293,20 +293,20 @@ U0 CleanUp()
U0 AnimateTask(I64)
{
I64 i,x,y,dx,dy;
Monster *tempm;
Monster *tmpm;
while (TRUE) {
for (i=0,tempm=monsters;i<NUM_MONSTERS;i++,tempm++)
if (!tempm->dead) {
for (i=0,tmpm=monsters;i<NUM_MONSTERS;i++,tmpm++)
if (!tmpm->dead) {
dx=RandU16%3-1;
dy=RandU16%3-1;
x=tempm->x+dx;
y=tempm->y+dy;
x=tmpm->x+dx;
y=tmpm->y+dy;
if (0<=x<map_width && 0<=y<map_height && map[y*map_width+x]) {
tempm->x=x;
tempm->y=y;
tempm->dx=dx;
tempm->dy=dy;
tmpm->x=x;
tmpm->y=y;
tmpm->dx=dx;
tmpm->dy=dy;
}
}
Sleep(1000);
@@ -368,10 +368,10 @@ U0 DunGen()
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-scrn_x>SCRN_WIDTH/2-3) {
scrn_x+=SCRN_WIDTH/2;
if (scrn_x+SCRN_WIDTH/2>map_width)
scrn_x=map_width-SCRN_WIDTH/2;
}
}
break;
@@ -384,10 +384,10 @@ U0 DunGen()
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-scrn_x<-SCRN_WIDTH/2+3) {
scrn_x-=SCRN_WIDTH/2;
if (scrn_x-SCRN_WIDTH/2<0)
scrn_x=SCRN_WIDTH/2;
}
}
break;
@@ -400,10 +400,10 @@ U0 DunGen()
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-scrn_y<-SCRN_HEIGHT/2+3) {
scrn_y-=SCRN_HEIGHT/2;
if (scrn_y-SCRN_HEIGHT/2<0)
scrn_y=SCRN_HEIGHT/2;
}
}
break;
@@ -416,10 +416,10 @@ U0 DunGen()
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-scrn_y>SCRN_HEIGHT/2-3) {
scrn_y+=SCRN_HEIGHT/2;
if (scrn_y+SCRN_HEIGHT/2>map_height)
scrn_y=map_height-SCRN_HEIGHT/2;
}
}
break;
+82 -82
View File
@@ -21,7 +21,7 @@ RegExeBranch("TempleOS/EagleDive");
#define ROCK_ELEVATION 45
#define SNOW_ELEVATION 55
//Too big makes off-screen draws take place.
//Too big makes off-scrn draws take place.
#define MAX_PANEL_SIZE 16
@@ -294,9 +294,9 @@ U0 MPDoPanels(CTask *task)
{
I64 i,j,l,k1,k2,w,h,threshold,lo,hi;
Bool cont;
Panel *tempp,*start_ptr=NULL,*end_ptr=NULL;
Panel *tmpp,*start_ptr=NULL,*end_ptr=NULL;
CD3I32 *poly;
Obj *tempo;
Obj *tmpo;
lo=Gs->num*(MAP_HEIGHT-1)/mp_cnt;
hi=(Gs->num+1)*(MAP_HEIGHT-1)/mp_cnt;
for (threshold=8;threshold>=1;threshold--)
@@ -317,75 +317,75 @@ U0 MPDoPanels(CTask *task)
}
} while (cont);
if (w>=threshold || h>=threshold) {
tempp=CAlloc(sizeof(Panel),task);
QueInit(&tempp->next_obj);
tmpp=CAlloc(sizeof(Panel),task);
QueInit(&tmpp->next_obj);
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) {
tempp->color=BLUE;
tmpp->color=BLUE;
if (Rand<0.05) {
tempo=MAlloc(sizeof(Obj),task);
tempo->p.x=(i+w/2)*MAP_SCALE;
tempo->p.y=(j+h/2)*MAP_SCALE;
tmpo=MAlloc(sizeof(Obj),task);
tmpo->p.x=(i+w/2)*MAP_SCALE;
tmpo->p.y=(j+h/2)*MAP_SCALE;
if (Rand<0.1) {
tempo->fish=FALSE;
tmpo->fish=FALSE;
if (RandI16&1)
tempo->img=$IB,"<2>",BI=2$; //Boat
tmpo->img=$IB,"<2>",BI=2$; //Boat
else
tempo->img=$IB,"<3>",BI=3$; //Boat
tempo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;
tmpo->img=$IB,"<3>",BI=3$; //Boat
tmpo->p.z=(WATER_ELEVATION+2)*MAP_SCALE;
} else {
tempo->fish=TRUE;
tempo->img=$IB,"<1>",BI=1$; //Fish
tempo->p.z=WATER_ELEVATION*MAP_SCALE;
tmpo->fish=TRUE;
tmpo->img=$IB,"<1>",BI=1$; //Fish
tmpo->p.z=WATER_ELEVATION*MAP_SCALE;
}
QueIns(tempo,tempp->last_obj);
QueIns(tmpo,tmpp->last_obj);
}
} else {
if (l<ROCK_ELEVATION*MAP_SCALE) {
if (RandI16&1)
tempp->color=LTGREEN;
tmpp->color=LTGREEN;
else
tempp->color=GREEN+LTGREEN<<16+ROPF_DITHER;
tmpp->color=GREEN+LTGREEN<<16+ROPF_DITHER;
if (Rand<0.03) {
tempo=MAlloc(sizeof(Obj),task);
tempo->p.x=(i+w/2)*MAP_SCALE;
tempo->p.y=(j+h/2)*MAP_SCALE;
tempo->p.z=l;
tempo->img=$IB,"<4>",BI=4$; //Tree
tempo->fish=FALSE;
QueIns(tempo,tempp->last_obj);
tmpo=MAlloc(sizeof(Obj),task);
tmpo->p.x=(i+w/2)*MAP_SCALE;
tmpo->p.y=(j+h/2)*MAP_SCALE;
tmpo->p.z=l;
tmpo->img=$IB,"<4>",BI=4$; //Tree
tmpo->fish=FALSE;
QueIns(tmpo,tmpp->last_obj);
}
} else if (l<SNOW_ELEVATION*MAP_SCALE) {
if (!(RandU16&3)) {
if (RandI16&1)
tempp->color=LTGRAY;
tmpp->color=LTGRAY;
else
tempp->color=DKGRAY+LTGRAY<<16+ROPF_DITHER;
tmpp->color=DKGRAY+LTGRAY<<16+ROPF_DITHER;
} else {
if (RandI16&1)
tempp->color=LTGREEN;
tmpp->color=LTGREEN;
else
tempp->color=GREEN+LTGREEN<<16+ROPF_DITHER;
tmpp->color=GREEN+LTGREEN<<16+ROPF_DITHER;
}
} else {
if (!(RandU16&3)) {
if (RandI16&1)
tempp->color=WHITE;
tmpp->color=WHITE;
else
tempp->color=LTGRAY;
tmpp->color=LTGRAY;
} else {
if (RandI16&1)
tempp->color=LTGRAY+WHITE<<16+ROPF_DITHER;
tmpp->color=LTGRAY+WHITE<<16+ROPF_DITHER;
else
tempp->color=DKGRAY+LTGRAY<<16+ROPF_DITHER;
tmpp->color=DKGRAY+LTGRAY<<16+ROPF_DITHER;
}
}
}
tempp->num_sides=4;
poly=tempp->pts=MAlloc(sizeof(CD3I32)*tempp->num_sides,task);
tmpp->num_sides=4;
poly=tmpp->pts=MAlloc(sizeof(CD3I32)*tmpp->num_sides,task);
poly[0].x=MAP_SCALE*i;
poly[0].y=MAP_SCALE*j;
poly[0].z=elevations[j][i];
@@ -398,13 +398,13 @@ U0 MPDoPanels(CTask *task)
poly[3].x=MAP_SCALE*i;
poly[3].y=MAP_SCALE*(j+h);
poly[3].z=elevations[j+h][i];
tempp->next=start_ptr;
start_ptr=tempp;
tmpp->next=start_ptr;
start_ptr=tmpp;
if (!end_ptr)
end_ptr=tempp;
end_ptr=tmpp;
for (k2=0;k2<h;k2++)
for (k1=0;k1<w;k1++)
panels[j+k2][i+k1]=tempp;
panels[j+k2][i+k1]=tmpp;
}
}
}
@@ -602,21 +602,21 @@ U0 MPDrawIt(CTask *task,CDC *dc)
x3,y3,z3,dd,dd_old,
cx=task->pix_width>>1,
cy=task->pix_height>>1;
Panel reg *tempp;
Obj *tempo;
Panel reg *tmpp;
Obj *tmpo;
Bool w_on_map,h_on_map;
xx=x/(MAP_SCALE*COORDINATE_SCALE);
yy=y/(MAP_SCALE*COORDINATE_SCALE);
//World to screen coordinates
//World to scrn coordinates
Mat4x4IdentEqu(dc->r);
Mat4x4RotZ(dc->r,heading);
Mat4x4RotX(dc->r,è);
Mat4x4RotZ(dc->r,roll);
DCMat4x4Set(dc,dc->r);
//Screen to world coordinates
//Scrn 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
@@ -635,7 +635,7 @@ U0 MPDrawIt(CTask *task,CDC *dc)
//The layer for core1 is not cleared automatically
//it is persistent. I have carefully syncronized to the update
//cycle initiated by core0 to prevent flicker.
//cycle initiated by Core0 to prevent flicker.
dc->flags|=DCF_TRANSFORMATION;
dc->transform=&EDTransform;
@@ -691,17 +691,17 @@ 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]) && tempp->update!=update) {
tempp->update=update;
if (tempp->cnt>8*(1.1-Gs->idle_factor)) {
dc->color=tempp->color;
tempp->cnt=GrFillPoly3(dc,tempp->num_sides,tempp->pts);
if ((tmpp=panels[y1][x1]) && tmpp->update!=update) {
tmpp->update=update;
if (tmpp->cnt>8*(1.1-Gs->idle_factor)) {
dc->color=tmpp->color;
tmpp->cnt=GrFillPoly3(dc,tmpp->num_sides,tmpp->pts);
} else
tempp->cnt++;
tempo=tempp->next_obj;
while (tempo!=&tempp->next_obj) {
Sprite3(dc,tempo->p.x,tempo->p.y,tempo->p.z,tempo->img);
tempo=tempo->next;
tmpp->cnt++;
tmpo=tmpp->next_obj;
while (tmpo!=&tmpp->next_obj) {
Sprite3(dc,tmpo->p.x,tmpo->p.y,tmpo->p.z,tmpo->img);
tmpo=tmpo->next;
}
}
h_on_map=TRUE;
@@ -938,28 +938,28 @@ U0 Core0EagleDive()
//We made an alias of this we don't want freed.
dc->depth_buf=NULL;
DCDel(dc);
WinMgrSync;
Refresh;
}
Obj *FishFind(I64 x1,I64 y1,I64 *_dd)
{
I64 dd,best_dd=MAX_I64;
Obj *res=NULL,*tempo;
Panel *tempp=panel_head;
while (tempp) {
tempo=tempp->next_obj;
while (tempo!=&tempp->next_obj) {
if (tempo->fish) {
dd=SqrI64(tempo->p.x-x1)+SqrI64(tempo->p.y-y1);
Obj *res=NULL,*tmpo;
Panel *tmpp=panel_head;
while (tmpp) {
tmpo=tmpp->next_obj;
while (tmpo!=&tmpp->next_obj) {
if (tmpo->fish) {
dd=SqrI64(tmpo->p.x-x1)+SqrI64(tmpo->p.y-y1);
if (dd<best_dd) {
best_dd=dd;
res=tempo;
res=tmpo;
}
}
tempo=tempo->next;
tmpo=tmpo->next;
}
tempp=tempp->next;
tmpp=tmpp->next;
}
*_dd=best_dd;
return res;
@@ -971,12 +971,12 @@ U0 AnimateTask(I64)
{//Steadily moves the airplane fwd.
I64 *s2w,x1,y1,z1,dx,dy,dz,dd;
F64 t0=tS,ms,é,d;
Obj *tempo;
Obj *tmpo;
while (TRUE) {
ms=1000*(tS-t0);
t0=tS;
if (!game_tf) {
//Screen to world coordinates
//Scrn to world coordinates
s2w=Mat4x4IdentNew;
Mat4x4RotZ(s2w,-roll);
Mat4x4RotX(s2w,-è);
@@ -1000,12 +1000,12 @@ U0 AnimateTask(I64)
WrapAngles;
}
speed=1.0;
if (rolled_over || !(tempo=FishFind(x1,y1,&dd)))
if (rolled_over || !(tmpo=FishFind(x1,y1,&dd)))
claws_down=0;
else {
d=Sqrt(dd);
x1-=tempo->p.x;
y1-=tempo->p.y;
x1-=tmpo->p.x;
y1-=tmpo->p.y;
é=ACos((dx*x1+dy*y1)/(d*1<<16));
if (é>0 && d<MAP_SCALE*4)
claws_down=Saw(d,MAP_SCALE*4);
@@ -1017,8 +1017,8 @@ U0 AnimateTask(I64)
if (game_tf-game_t0<best_score)
best_score=game_tf-game_t0;
}
QueRem(tempo);
Free(tempo);
QueRem(tmpo);
Free(tmpo);
music.mute=TRUE;
Snd(1000); Sleep(200); Snd(0);
music.mute=FALSE;
@@ -1035,7 +1035,7 @@ U0 AnimateTask(I64)
speed=Clamp(speed+(0.0005-0.0002*Abs(è)/(ã/4)),0.1,5.0);
}
}
WinMgrSync;
Refresh;
}
}
@@ -1104,14 +1104,14 @@ U0 Init()
U0 CleanUp()
{
Panel *tempp=panel_head,*tempp1;
Panel *tmpp=panel_head,*tmpp1;
MPEnd;
while (tempp) {
tempp1=tempp->next;
QueDel(&tempp->next_obj);
Free(tempp->pts);
Free(tempp);
tempp=tempp1;
while (tmpp) {
tmpp1=tmpp->next;
QueDel(&tmpp->next_obj);
Free(tmpp->pts);
Free(tmpp);
tmpp=tmpp1;
}
DCDel(main_dc);
}
@@ -1171,7 +1171,7 @@ U0 EagleDive()
case '\n':
Fs->draw_it=NULL;
CleanUp;
WinMgrSync;
Refresh;
Init;
Fs->draw_it=&DrawIt;
break;
Binary file not shown.
Binary file not shown.
+331 -331
View File
@@ -96,36 +96,36 @@ Obj *ObjFind(F64 x,F64 y,
I64 flag_mask=OF_ACTIVE|OF_RETURNING,I64 flag_val=OF_ACTIVE,
I64 type_mask=-1,I64 player_mask=-1,F64 *_d=NULL)
{
Obj *tempo=obj_head.next,*best=NULL;
Obj *tmpo=obj_head.next,*best=NULL;
F64 dd,best_dd=MAX_F64;
while (tempo!=&obj_head) {
if (tempo->flags&flag_mask==flag_val &&
Bt(&type_mask,tempo->type)&&Bt(&player_mask,tempo->player)) {
dd=Sqr(tempo->x-x)+Sqr(tempo->y-y);
while (tmpo!=&obj_head) {
if (tmpo->flags&flag_mask==flag_val &&
Bt(&type_mask,tmpo->type)&&Bt(&player_mask,tmpo->player)) {
dd=Sqr(tmpo->x-x)+Sqr(tmpo->y-y);
if (dd<best_dd) {
best=tempo;
best=tmpo;
best_dd=dd;
}
}
tempo=tempo->next;
tmpo=tmpo->next;
}
if (_d) *_d=Sqrt(best_dd);
return best;
}
U0 ObjDel(Obj *tempo)
U0 ObjDel(Obj *tmpo)
{
if (tempo) {
if (tS<tempo->death_time)
tempo->flags&=~OF_ACTIVE;
if (tmpo) {
if (tS<tmpo->death_time)
tmpo->flags&=~OF_ACTIVE;
else {
if (tempo->squadron>=0)
SquadronRem(tempo);
QueRem(tempo);
if (tempo->squadron>=0)
LBts(&squadrons[tempo->squadron].dead_mask,tempo->member_num);
num_alive[tempo->player]--;
Free(tempo);
if (tmpo->squadron>=0)
SquadronRem(tmpo);
QueRem(tmpo);
if (tmpo->squadron>=0)
LBts(&squadrons[tmpo->squadron].dead_mask,tmpo->member_num);
num_alive[tmpo->player]--;
Free(tmpo);
}
}
}
@@ -160,53 +160,53 @@ U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,j,k;
F64 d,cur_time=tS;
Obj *tempo;
Torpedo *tempt;
Obj *tmpo;
Torpedo *tmpt;
tempt=torpedo_head.next;
while (tempt!=&torpedo_head) {
tmpt=torpedo_head.next;
while (tmpt!=&torpedo_head) {
dc->color=WHITE;
GrPlot(dc,tempt->x,tempt->y);
tempt=tempt->next;
GrPlot(dc,tmpt->x,tmpt->y);
tmpt=tmpt->next;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->flags&OF_ACTIVE && tempo->flags&OF_SHIP) {
SpriteZ3B(dc,tempo->x,tempo->y,0,
imgs[tempo->player][tempo->type],tempo->é+ã/2);
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && tmpo->flags&OF_SHIP) {
SpriteZ3B(dc,tmpo->x,tmpo->y,0,
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
k=0;
for (j=0;j<FIRE_HEIGHT;j++)
for (i=0;i<FIRE_WIDTH;i++)
if (Bt(tempo->fire,k++)) {
if (Bt(tmpo->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->é));
tmpo->x+FIRE_X_SCALE*(i-FIRE_WIDTH /2+(11*tS+i)%1.7)
*Cos(tmpo->é)-
FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(12*tS+j)%1.7)*Sin(tmpo->é),
tmpo->y+FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(19*tS+j)%1.7)
*Cos(tmpo->é)+
FIRE_X_SCALE*(i-FIRE_WIDTH /2+(13*tS+i)%1.7)*Sin(tmpo->é));
}
if (Blink) {
dc->color=BLACK;
GrLine(dc,tempo->x+5,tempo->y,tempo->x+5+10,tempo->y);
GrLine(dc,tmpo->x+5,tmpo->y,tmpo->x+5+10,tmpo->y);
if (tempo->life_percent>0) {
if (tempo->life_percent<33)
if (tmpo->life_percent>0) {
if (tmpo->life_percent<33)
dc->color=RED;
else if (tempo->life_percent<66)
else if (tmpo->life_percent<66)
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,tmpo->x+5,tmpo->y,
tmpo->x+5+10*tmpo->life_percent/100,tmpo->y);
}
dc->color=BLACK;
GrLine(dc,tempo->x+5,tempo->y+2,tempo->x+5+10,tempo->y+2);
d=tempo->fuel*100/tempo->max_fuel;
GrLine(dc,tmpo->x+5,tmpo->y+2,tmpo->x+5+10,tmpo->y+2);
d=tmpo->fuel*100/tmpo->max_fuel;
if (d>0) {
if (d<33)
dc->color=RED;
@@ -214,23 +214,23 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->color=YELLOW;
else
dc->color=GREEN;
GrLine(dc,tempo->x+5,tempo->y+2,tempo->x+5+10*d/100,tempo->y+2);
GrLine(dc,tmpo->x+5,tmpo->y+2,tmpo->x+5+10*d/100,tmpo->y+2);
}
}
}
tempo=tempo->next;
tmpo=tmpo->next;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->flags&OF_ACTIVE && !(tempo->flags&OF_SHIP))
SpriteZ3B(dc,tempo->x,tempo->y,0,
imgs[tempo->player][tempo->type],tempo->é+ã/2);
if (tempo->flags&OF_SHOOTING) {
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && !(tmpo->flags&OF_SHIP))
SpriteZ3B(dc,tmpo->x,tmpo->y,0,
imgs[tmpo->player][tmpo->type],tmpo->é+ã/2);
if (tmpo->flags&OF_SHOOTING) {
dc->color=LTRED;
GrLine(dc,tempo->x,tempo->y,tempo->target_x,tempo->target_y,3);
GrLine(dc,tmpo->x,tmpo->y,tmpo->target_x,tmpo->target_y,3);
}
tempo=tempo->next;
tmpo=tmpo->next;
}
dc->flags|=DCF_TRANSFORMATION;
@@ -277,8 +277,8 @@ U0 Init()
{
I64 i,fighter,ship,player,squadron,
w=Fs->pix_width,h=Fs->pix_height;
Squadron *temps;
Obj *tempo,*tempo1;
Squadron *tmps;
Obj *tmpo,*tmpo1;
QueInit(&obj_head);
QueInit(&torpedo_head);
@@ -292,83 +292,83 @@ U0 Init()
for (player=0;player<NUM_PLAYERS;player++) {
num_alive[player]=0;
for (ship=0;ship<num_cruisers[player];ship++) {
tempo1=CAlloc(sizeof(Obj));
tmpo1=CAlloc(sizeof(Obj));
num_alive[player]++;
tempo1->type=OT_CRUISER; tempo1->player=player;
tempo1->squadron=-1; tempo1->member_num=ship;
tempo1->flags=OF_ACTIVE|OF_SHIP;
tempo1->x=0.8*w*(Rand-0.5)+w>>1; tempo1->y=0.8*h*(Rand-0.5)+h>>1;
tempo1->host=NULL;
tempo1->speed=35.0; tempo1->turn_rate=2.5;
tempo1->é=2*ã*(Rand-0.5); tempo1->dé=0;
tempo1->life_percent=100.0;
tempo1->fuel=tempo1->max_fuel=100000;
tempo1->fuel_burn_rate=100.0;
tempo1->air_guns =5000; tempo1->air_guns_range =30.0;
tempo1->ship_guns=10000; tempo1->ship_guns_range=30.0;
tempo1->torpedos =tempo1->max_torpedos=0;
tempo1->torpedos_range =0.0;
tempo1->next_action_time=0;
QueIns(tempo1,obj_head.last);
tmpo1->type=OT_CRUISER; tmpo1->player=player;
tmpo1->squadron=-1; tmpo1->member_num=ship;
tmpo1->flags=OF_ACTIVE|OF_SHIP;
tmpo1->x=0.8*w*(Rand-0.5)+w>>1; tmpo1->y=0.8*h*(Rand-0.5)+h>>1;
tmpo1->host=NULL;
tmpo1->speed=35.0; tmpo1->turn_rate=2.5;
tmpo1->é=2*ã*(Rand-0.5); tmpo1->dé=0;
tmpo1->life_percent=100.0;
tmpo1->fuel=tmpo1->max_fuel=100000;
tmpo1->fuel_burn_rate=100.0;
tmpo1->air_guns =5000; tmpo1->air_guns_range =30.0;
tmpo1->ship_guns=10000; tmpo1->ship_guns_range=30.0;
tmpo1->torpedos =tmpo1->max_torpedos=0;
tmpo1->torpedos_range =0.0;
tmpo1->next_action_time=0;
QueIns(tmpo1,obj_head.last);
}
for (ship=0;ship<num_carriers[player];ship++) {
tempo1=CAlloc(sizeof(Obj));
tmpo1=CAlloc(sizeof(Obj));
num_alive[player]++;
tempo1->type=OT_CARRIER; tempo1->player=player;
tempo1->squadron=-1; tempo1->member_num=ship;
tempo1->flags=OF_ACTIVE|OF_SHIP;
tempo1->x=0.8*w*(Rand-0.5)+w>>1; tempo1->y=0.8*h*(Rand-0.5)+h>>1;
tempo1->host=NULL;
tempo1->speed=28.0; tempo1->turn_rate=1.0;
tempo1->é=2*ã*(Rand-0.5); tempo1->dé=0;
tempo1->life_percent=100.0;
tempo1->fuel=tempo1->max_fuel=750000;
tempo1->fuel_burn_rate=500.0;
tempo1->air_guns =5000; tempo1->air_guns_range =20.0;
tempo1->ship_guns=2000; tempo1->ship_guns_range=30.0;
tempo1->torpedos =tempo1->max_torpedos=0;
tempo1->torpedos_range =0.0;
tempo1->next_action_time=0;
QueIns(tempo1,obj_head.last);
tmpo1->type=OT_CARRIER; tmpo1->player=player;
tmpo1->squadron=-1; tmpo1->member_num=ship;
tmpo1->flags=OF_ACTIVE|OF_SHIP;
tmpo1->x=0.8*w*(Rand-0.5)+w>>1; tmpo1->y=0.8*h*(Rand-0.5)+h>>1;
tmpo1->host=NULL;
tmpo1->speed=28.0; tmpo1->turn_rate=1.0;
tmpo1->é=2*ã*(Rand-0.5); tmpo1->dé=0;
tmpo1->life_percent=100.0;
tmpo1->fuel=tmpo1->max_fuel=750000;
tmpo1->fuel_burn_rate=500.0;
tmpo1->air_guns =5000; tmpo1->air_guns_range =20.0;
tmpo1->ship_guns=2000; tmpo1->ship_guns_range=30.0;
tmpo1->torpedos =tmpo1->max_torpedos=0;
tmpo1->torpedos_range =0.0;
tmpo1->next_action_time=0;
QueIns(tmpo1,obj_head.last);
for (squadron=0;squadron<num_squadrons_per_carrier[player];
squadron++,num_squadrons++) {
for (fighter=0;fighter<num_planes_per_squadron[player];fighter++) {
tempo=CAlloc(sizeof(Obj));
tmpo=CAlloc(sizeof(Obj));
num_alive[player]++;
tempo->type=OT_FIGHTER; tempo->player=player;
tempo->squadron=num_squadrons; tempo->member_num=fighter;
tempo->flags=0;
tempo->host=tempo1;
tempo->speed=300.0; tempo->turn_rate=25.0;
tempo->life_percent=100.0;
tempo->fuel=tempo->max_fuel=1000;
tempo->fuel_burn_rate=1.0;
tempo->air_guns =35000; tempo->air_guns_range =8.0;
tempo->ship_guns=0; tempo->ship_guns_range=0.0;
tempo->torpedos =tempo->max_torpedos=1;
tempo->torpedos_range =20.0;
QueIns(tempo,obj_head.last);
tmpo->type=OT_FIGHTER; tmpo->player=player;
tmpo->squadron=num_squadrons; tmpo->member_num=fighter;
tmpo->flags=0;
tmpo->host=tmpo1;
tmpo->speed=300.0; tmpo->turn_rate=25.0;
tmpo->life_percent=100.0;
tmpo->fuel=tmpo->max_fuel=1000;
tmpo->fuel_burn_rate=1.0;
tmpo->air_guns =35000; tmpo->air_guns_range =8.0;
tmpo->ship_guns=0; tmpo->ship_guns_range=0.0;
tmpo->torpedos =tmpo->max_torpedos=1;
tmpo->torpedos_range =20.0;
QueIns(tmpo,obj_head.last);
}
}
}
}
squadrons=CAlloc(num_squadrons*sizeof(Squadron));
for (i=0,temps=squadrons;i<num_squadrons;i++,temps++) {
temps->next_in_squadron=temps->last_in_squadron=temps;
temps->squadron=i;
for (i=0,tmps=squadrons;i<num_squadrons;i++,tmps++) {
tmps->next_in_squadron=tmps->last_in_squadron=tmps;
tmps->squadron=i;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->squadron>=0) {
temps=&squadrons[tempo->squadron];
temps->host =tempo->host;
temps->player=tempo->player;
temps->total_mask=1<<num_planes_per_squadron[tempo->player]-1;
SquadronIns(tempo,temps->last_in_squadron);
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
tmps->host =tmpo->host;
tmps->player=tmpo->player;
tmps->total_mask=1<<num_planes_per_squadron[tmpo->player]-1;
SquadronIns(tmpo,tmps->last_in_squadron);
}
tempo=tempo->next;
tmpo=tmpo->next;
}
}
@@ -382,36 +382,36 @@ U0 CleanUp()
Obj *ObjLaunch(I64 player,I64 squadron=-1,
Obj *host=NULL,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
{
Obj *tempo;
Obj *tmpo;
F64 cur_time=tS;
if (!host)
host=ObjFind(x,y,,,1<<OT_CARRIER,1<<player);
if (host && cur_time>host->next_action_time) {
if (é==MAX_F64)
é=Arg(x-host->x,y-host->y);
tempo=obj_head.next;
while (tempo!=&obj_head) {
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)
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->host==host && (squadron<0||tmpo->squadron==squadron) &&
!(tmpo->flags&OF_ACTIVE) &&
(tmpo->squadron<0||squadrons[tmpo->squadron].action==SA_PARKED||
squadrons[tmpo->squadron].action==SA_LAUNCHING)) {
if (tmpo->fuel<=0.0)
//When low on fuel, not zero, gets launched and captured.
LBts(&squadrons[tempo->squadron].dead_mask,tempo->member_num);
LBts(&squadrons[tmpo->squadron].dead_mask,tmpo->member_num);
else {
tempo->flags=tempo->flags&~OF_RETURNING|OF_ACTIVE;
tempo->é=host->é;
tmpo->flags=tmpo->flags&~OF_RETURNING|OF_ACTIVE;
tmpo->é=host->é;
if (x==MAX_F64 || y==MAX_F64 || Sqr(x-host->x)+Sqr(y-host->y)>3*3)
tempo->dé=Wrap(é-tempo->é,-ã);
tmpo->dé=Wrap(é-tmpo->é,-ã);
else
tempo->dé=0;
tempo->x=host->x;
tempo->y=host->y;
tmpo->dé=0;
tmpo->x=host->x;
tmpo->y=host->y;
host->next_action_time=cur_time+0.25/game_speed;
return tempo;
return tmpo;
}
}
tempo=tempo->next;
tmpo=tmpo->next;
}
}
return NULL;
@@ -419,23 +419,23 @@ Obj *ObjLaunch(I64 player,I64 squadron=-1,
Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
{
Squadron *temps;
Obj *tempo;
if (tempo=ObjLaunch(player,,,x,y)) {
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjLaunch(player,,,x,y)) {
if (player==0) {
launch_unit_x1=tempo->x;
launch_unit_y1=tempo->y;
launch_unit_x1=tmpo->x;
launch_unit_y1=tmpo->y;
launch_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
launch_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
launch_t=tS+0.5;
}
if (tempo->squadron>=0) {
temps=&squadrons[tempo->squadron];
if (temps->action==SA_PARKED) {
temps->action=SA_LAUNCHING;
temps->é=tempo->é+tempo->dé;
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_PARKED) {
tmps->action=SA_LAUNCHING;
tmps->é=tmpo->é+tmpo->dé;
}
return temps;
return tmps;
}
}
return NULL;
@@ -443,31 +443,31 @@ Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
Obj *ObjReturn(I64 player,F64 x,F64 y)
{
Obj *tempo;
if (tempo=ObjFind(x,y,OF_ACTIVE,OF_ACTIVE,1<<OT_FIGHTER,1<<player))
tempo->flags|=OF_RETURNING;
return tempo;
Obj *tmpo;
if (tmpo=ObjFind(x,y,OF_ACTIVE,OF_ACTIVE,1<<OT_FIGHTER,1<<player))
tmpo->flags|=OF_RETURNING;
return tmpo;
}
Squadron *SquadronReturn(I64 player,F64 x,F64 y)
{
Squadron *temps;
Obj *tempo;
if (tempo=ObjReturn(player,x,y)) {
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjReturn(player,x,y)) {
if (player==0) {
return_unit_x1=tempo->x;
return_unit_y1=tempo->y;
if (tempo->host) {
return_unit_x2=tempo->host->x;
return_unit_y2=tempo->host->y;
return_unit_x1=tmpo->x;
return_unit_y1=tmpo->y;
if (tmpo->host) {
return_unit_x2=tmpo->host->x;
return_unit_y2=tmpo->host->y;
return_t=tS+0.5;
}
}
if (tempo->squadron>=0) {
temps=&squadrons[tempo->squadron];
if (temps->action==SA_FLYING)
temps->action=SA_RETURNING;
return temps;
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_FLYING)
tmps->action=SA_RETURNING;
return tmps;
}
}
return NULL;
@@ -475,36 +475,36 @@ 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)) {
Obj *tmpo;
if ((tmpo=ObjFind(x,y,,,,1<<player)) && tmpo->flags&OF_ACTIVE &&
!(tmpo->flags&OF_RETURNING)) {
if (é==MAX_F64)
é=Arg(x-tempo->x,y-tempo->y);
tempo->dé+=Wrap(é-(tempo->é+tempo->dé),-ã);
return tempo;
é=Arg(x-tmpo->x,y-tmpo->y);
tmpo->dé+=Wrap(é-(tmpo->é+tmpo->dé),-ã);
return tmpo;
}
return NULL;
}
Squadron *SquadronSeté(I64 player,F64 x=MAX_F64,F64 y=MAX_F64,F64 é=MAX_F64)
{
Squadron *temps;
Obj *tempo;
if (tempo=ObjSeté(player,x,y,é)) {
Squadron *tmps;
Obj *tmpo;
if (tmpo=ObjSeté(player,x,y,é)) {
if (player==0) {
set_é_unit_x1=tempo->x;
set_é_unit_y1=tempo->y;
set_é_unit_x1=tmpo->x;
set_é_unit_y1=tmpo->y;
set_é_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
set_é_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
set_é_t=tS+0.5;
}
if (tempo->squadron>=0) {
temps=&squadrons[tempo->squadron];
if (temps->action==SA_FLYING) {
temps->action=SA_SET_é;
temps->é=tempo->é+tempo->dé;
if (tmpo->squadron>=0) {
tmps=&squadrons[tmpo->squadron];
if (tmps->action==SA_FLYING) {
tmps->action=SA_SET_é;
tmps->é=tmpo->é+tmpo->dé;
}
return temps;
return tmps;
}
}
return NULL;
@@ -513,76 +513,76 @@ Squadron *SquadronSet
U0 SquadronActions()
{
I64 i,completed_mask;
Obj *tempo;
Squadron *temps;
for (i=0,temps=squadrons;i<num_squadrons;i++,temps++) {
Obj *tmpo;
Squadron *tmps;
for (i=0,tmps=squadrons;i<num_squadrons;i++,tmps++) {
completed_mask=0;
switch (temps->action) {
switch (tmps->action) {
case SA_LAUNCHING:
ObjLaunch(temps->player,i,temps->host,,,temps->é);
tempo=temps->next_in_squadron;
while (tempo!=temps) {
LBEqu(&completed_mask,tempo->member_num,tempo->flags&OF_ACTIVE);
tempo=tempo->next_in_squadron;
ObjLaunch(tmps->player,i,tmps->host,,,tmps->é);
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
LBEqu(&completed_mask,tmpo->member_num,tmpo->flags&OF_ACTIVE);
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|temps->dead_mask==temps->total_mask)
temps->action=SA_FLYING;
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_FLYING;
break;
case SA_FLYING:
tempo=temps->next_in_squadron;
while (tempo!=temps) {
LBEqu(&completed_mask,tempo->member_num,!(tempo->flags&OF_ACTIVE));
tempo=tempo->next_in_squadron;
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
LBEqu(&completed_mask,tmpo->member_num,!(tmpo->flags&OF_ACTIVE));
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|temps->dead_mask==temps->total_mask)
temps->action=SA_PARKED;
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_PARKED;
break;
case SA_SET_é:
tempo=temps->next_in_squadron;
while (tempo!=temps) {
tempo->dé+=Wrap(temps->é-(tempo->é+tempo->dé),-ã);
tempo=tempo->next_in_squadron;
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
tmpo->dé+=Wrap(tmps->é-(tmpo->é+tmpo->dé),-ã);
tmpo=tmpo->next_in_squadron;
}
temps->action=SA_FLYING;
tmps->action=SA_FLYING;
break;
case SA_RETURNING:
tempo=temps->next_in_squadron;
while (tempo!=temps) {
tempo->flags|=OF_RETURNING;
LBEqu(&completed_mask,tempo->member_num,!(tempo->flags&OF_ACTIVE));
tempo=tempo->next_in_squadron;
tmpo=tmps->next_in_squadron;
while (tmpo!=tmps) {
tmpo->flags|=OF_RETURNING;
LBEqu(&completed_mask,tmpo->member_num,!(tmpo->flags&OF_ACTIVE));
tmpo=tmpo->next_in_squadron;
}
if (completed_mask|temps->dead_mask==temps->total_mask)
temps->action=SA_PARKED;
if (completed_mask|tmps->dead_mask==tmps->total_mask)
tmps->action=SA_PARKED;
break;
}
if (temps->dead_mask==temps->total_mask)
temps->action=SA_DEAD;
if (tmps->dead_mask==tmps->total_mask)
tmps->action=SA_DEAD;
}
}
U0 AI(I64 player,F64 period)
{
Obj *tempo;
tempo=obj_head.next;
while (tempo!=&obj_head) {
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) &&
Obj *tmpo;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->player==player) {
if (tmpo->type==OT_CARRIER && Rand<5*period)
SquadronLaunch(player,tmpo->x,tmpo->y);
if (tmpo->flags&OF_ACTIVE && !(tmpo->flags&OF_RETURNING) &&
Rand<10.0*period)
SquadronSeté(player,tempo->x,tempo->y,tempo->é+pi/2*(Rand-0.5));
SquadronSeté(player,tmpo->x,tmpo->y,tmpo->é+pi/2*(Rand-0.5));
}
tempo=tempo->next;
tmpo=tmpo->next;
}
}
U0 ShipDammage(Obj *tempo,F64 d)
U0 ShipDamage(Obj *tmpo,F64 d)
{
I64 i,x=Rand*FIRE_WIDTH,y=Rand*FIRE_HEIGHT;
tempo->life_percent-=d;
tmpo->life_percent-=d;
while (d>0) {
if (!Bts(tempo->fire,y*FIRE_WIDTH+x))
if (!Bts(tmpo->fire,y*FIRE_WIDTH+x))
d-=500.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=25.0/(FIRE_WIDTH*FIRE_HEIGHT);
@@ -600,16 +600,16 @@ U0 ShipDammage(Obj *tempo,F64 d)
}
}
U0 ShipFix(Obj *tempo,F64 d)
U0 ShipFix(Obj *tmpo,F64 d)
{
tempo->life_percent+=d;
if (tempo->life_percent>=100.0) {
tempo->life_percent=100.0;
MemSet(tempo->fire,0,sizeof(Obj.fire));
tmpo->life_percent+=d;
if (tmpo->life_percent>=100.0) {
tmpo->life_percent=100.0;
MemSet(tmpo->fire,0,sizeof(Obj.fire));
return;
}
while (d>0)
if (Btr(tempo->fire,FIRE_WIDTH*FIRE_HEIGHT*Rand))
if (Btr(tmpo->fire,FIRE_WIDTH*FIRE_HEIGHT*Rand))
d-=400.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=20.0/(FIRE_WIDTH*FIRE_HEIGHT);
@@ -618,35 +618,35 @@ U0 ShipFix(Obj *tempo,F64 d)
U0 Combat(F64 period)
{
F64 d;
Obj *tempo,*tempo1;
Torpedo *tempt;
tempo=obj_head.next;
while (tempo!=&obj_head) {
tempo->flags&=~OF_SHOOTING;
if (tempo->flags&OF_ACTIVE &&
(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) {
if (tempo->torpedos && d<tempo->torpedos_range && Rand<125*period) {
tempo->torpedos--;
tempt=CAlloc(sizeof(Torpedo));
tempt->x=tempo->x;
tempt->y=tempo->y;
tempt->speed=100;
d/=tempt->speed*(GAME_SPEED_SCALE*game_speed);
tempo1->death_time=tempt->timeout=tS+d;
tempt->target=tempo1;
tempt->é=Arg(tempo1->x-tempo->x,tempo1->y-tempo->y);
QueIns(tempt,torpedo_head.last);
Obj *tmpo,*tmpo1;
Torpedo *tmpt;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo->flags&=~OF_SHOOTING;
if (tmpo->flags&OF_ACTIVE &&
(tmpo1=ObjFind(tmpo->x,tmpo->y,OF_ACTIVE,OF_ACTIVE,,
1<<(tmpo->player^1),&d))) {
tmpo->target_x=tmpo1->x;
tmpo->target_y=tmpo1->y;
if (tmpo1->flags&OF_SHIP) {
if (tmpo->torpedos && d<tmpo->torpedos_range && Rand<125*period) {
tmpo->torpedos--;
tmpt=CAlloc(sizeof(Torpedo));
tmpt->x=tmpo->x;
tmpt->y=tmpo->y;
tmpt->speed=100;
d/=tmpt->speed*(GAME_SPEED_SCALE*game_speed);
tmpo1->death_time=tmpt->timeout=tS+d;
tmpt->target=tmpo1;
tmpt->é=Arg(tmpo1->x-tmpo->x,tmpo1->y-tmpo->y);
QueIns(tmpt,torpedo_head.last);
Sweep(2000,2000,300);
} else if (tempo->ship_guns>0 && d<tempo->ship_guns_range) {
tempo->flags|=OF_SHOOTING;
} else if (tmpo->ship_guns>0 && d<tmpo->ship_guns_range) {
tmpo->flags|=OF_SHOOTING;
if (Rand<125.0*period) {
ShipDammage(tempo1,tempo->ship_guns*Rand*period);
ShipDamage(tmpo1,tmpo->ship_guns*Rand*period);
if (Rand<10.0*period)
tempo1->fuel*=0.75*Rand+0.25;
tmpo1->fuel*=0.75*Rand+0.25;
}
if (tS>next_noise) {
Noise(100,75,200);
@@ -654,12 +654,12 @@ U0 Combat(F64 period)
}
}
} else {
if (tempo->air_guns>0 && d<tempo->air_guns_range) {
tempo->flags|=OF_SHOOTING;
if (tmpo->air_guns>0 && d<tmpo->air_guns_range) {
tmpo->flags|=OF_SHOOTING;
if (Rand<125.0*period) {
tempo1->life_percent-=tempo->air_guns*Rand*period;
tmpo1->life_percent-=tmpo->air_guns*Rand*period;
if (Rand<10.0*period)
tempo1->fuel*=0.75*Rand+0.25;
tmpo1->fuel*=0.75*Rand+0.25;
}
if (tS>next_noise) {
Noise(25,500,2000);
@@ -668,109 +668,109 @@ U0 Combat(F64 period)
}
}
}
tempo=tempo->next;
tmpo=tmpo->next;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
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))
ObjDel(tempo);
tempo=tempo1;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo1=tmpo->next;
if (tmpo->type==OT_FIGHTER &&
(tmpo->life_percent<=0.0 || tmpo->flags&OF_ACTIVE &&
tmpo->fuel<=0.0 || tmpo->host &&
!(tmpo->flags&OF_ACTIVE) && tmpo->host->life_percent<=0.0))
ObjDel(tmpo);
tmpo=tmpo1;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
tempo1=tempo->next;
if (tempo->life_percent<=0.0)
ObjDel(tempo);
tempo=tempo1;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
tmpo1=tmpo->next;
if (tmpo->life_percent<=0.0)
ObjDel(tmpo);
tmpo=tmpo1;
}
}
#define ANIMATE_FREQ 50
U0 AnimateTask(I64)
{
Obj *tempo;
Torpedo *tempt,*tempt1;
Obj *tmpo;
Torpedo *tmpt,*tmpt1;
F64 d,period;
while (TRUE) {
period=GAME_SPEED_SCALE*game_speed/ANIMATE_FREQ;
SquadronActions;
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->flags&OF_ACTIVE && tempo->fuel>0) {
if (tempo->dé) {
d=tempo->dé;
if (d> tempo->turn_rate*period) d= tempo->turn_rate*period;
if (d<-tempo->turn_rate*period) d=-tempo->turn_rate*period;
tempo->é +=d;
tempo->dé-=d;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE && tmpo->fuel>0) {
if (tmpo->dé) {
d=tmpo->dé;
if (d> tmpo->turn_rate*period) d= tmpo->turn_rate*period;
if (d<-tmpo->turn_rate*period) d=-tmpo->turn_rate*period;
tmpo->é +=d;
tmpo->dé-=d;
}
tempo->x+=tempo->speed*Cos(tempo->é)*period*tempo->life_percent/100.0;
tempo->y+=tempo->speed*Sin(tempo->é)*period*tempo->life_percent/100.0;
tempo->fuel-=tempo->speed*tempo->fuel_burn_rate*period;
tmpo->x+=tmpo->speed*Cos(tmpo->é)*period*tmpo->life_percent/100.0;
tmpo->y+=tmpo->speed*Sin(tmpo->é)*period*tmpo->life_percent/100.0;
tmpo->fuel-=tmpo->speed*tmpo->fuel_burn_rate*period;
}
tempo=tempo->next;
tmpo=tmpo->next;
}
tempt=torpedo_head.next;
while (tempt!=&torpedo_head) {
tempt1=tempt->next;
if (tS>tempt->timeout) {
tempo=tempt->target;
tmpt=torpedo_head.next;
while (tmpt!=&torpedo_head) {
tmpt1=tmpt->next;
if (tS>tmpt->timeout) {
tmpo=tmpt->target;
if (Rand<0.333333) {
ShipDammage(tempo,150*Rand*Rand);
ShipDamage(tmpo,150*Rand*Rand);
if (Rand<0.333333)
tempo->fuel*=0.75*Rand+0.25;
tmpo->fuel*=0.75*Rand+0.25;
}
QueRem(tempt);
Free(tempt);
QueRem(tmpt);
Free(tmpt);
} else {
tempt->x+=tempt->speed*Cos(tempt->é)*period;
tempt->y+=tempt->speed*Sin(tempt->é)*period;
tmpt->x+=tmpt->speed*Cos(tmpt->é)*period;
tmpt->y+=tmpt->speed*Sin(tmpt->é)*period;
}
tempt=tempt1;
tmpt=tmpt1;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->host && !(tempo->flags&OF_ACTIVE)) {
tempo->x=tempo->host->x;
tempo->y=tempo->host->y;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->host && !(tmpo->flags&OF_ACTIVE)) {
tmpo->x=tmpo->host->x;
tmpo->y=tmpo->host->y;
}
tempo=tempo->next;
tmpo=tmpo->next;
}
tempo=obj_head.next;
while (tempo!=&obj_head) {
if (tempo->flags&OF_ACTIVE) {
if (tempo->host) {
d=Sqrt(Sqr(tempo->x-tempo->host->x)+Sqr(tempo->y-tempo->host->y));
if (d<8 && tempo->max_fuel-tempo->fuel>30) {
tempo->life_percent=100.0;
if (tempo->host->fuel>0) {
d=tempo->max_fuel-tempo->fuel;
if (d>tempo->host->fuel) d=tempo->host->fuel;
tempo->host->fuel-=d;
tempo->fuel+=d;
tmpo=obj_head.next;
while (tmpo!=&obj_head) {
if (tmpo->flags&OF_ACTIVE) {
if (tmpo->host) {
d=Sqrt(Sqr(tmpo->x-tmpo->host->x)+Sqr(tmpo->y-tmpo->host->y));
if (d<8 && tmpo->max_fuel-tmpo->fuel>30) {
tmpo->life_percent=100.0;
if (tmpo->host->fuel>0) {
d=tmpo->max_fuel-tmpo->fuel;
if (d>tmpo->host->fuel) d=tmpo->host->fuel;
tmpo->host->fuel-=d;
tmpo->fuel+=d;
}
tempo->torpedos=tempo->max_torpedos;
tempo->x=tempo->host->x;
tempo->y=tempo->host->y;
tempo->flags&=~OF_ACTIVE;
} 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é),-ã);
} else if (tempo->type==OT_CARRIER)
ShipFix(tempo,2.5*period);
tmpo->torpedos=tmpo->max_torpedos;
tmpo->x=tmpo->host->x;
tmpo->y=tmpo->host->y;
tmpo->flags&=~OF_ACTIVE;
} else if (d>tmpo->fuel-250)
tmpo->flags|=OF_RETURNING;
if (tmpo->flags&OF_RETURNING)
tmpo->dé+=Wrap(Arg(tmpo->host->x-tmpo->x,
tmpo->host->y-tmpo->y)-(tmpo->é+tmpo->dé),-ã);
} else if (tmpo->type==OT_CARRIER)
ShipFix(tmpo,2.5*period);
}
tempo=tempo->next;
tmpo=tmpo->next;
}
AI(1,period);
@@ -793,7 +793,7 @@ U0 FlatTops()
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");
"$$GREEN$${Ctrl-Left Grab}$$FG$$\tScroll Scrn\n");
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
+43 -43
View File
@@ -11,22 +11,22 @@ CMathODE *ode=NULL;
U0 DrawIt(CTask *,CDC *dc)
{
MyMass *tempm;
MySpring *temps;
MyMass *tmpm;
MySpring *tmps;
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=temps->next;
tmps=ode->next_spring;
while (tmps!=&ode->next_spring) {
GrLine(dc,tmps->end1->x,tmps->end1->y,
tmps->end2->x,tmps->end2->y);
tmps=tmps->next;
}
dc->color=BLACK;
tempm=ode->next_mass;
while (tempm!=&ode->next_mass) {
GrCircle(dc,tempm->x,tempm->y,tempm->radius);
tempm=tempm->next;
tmpm=ode->next_mass;
while (tmpm!=&ode->next_mass) {
GrCircle(dc,tmpm->x,tmpm->y,tmpm->radius);
tmpm=tmpm->next;
}
}
@@ -36,46 +36,46 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
//We can add new forces here.
F64 d,dd;
CD3 p;
MyMass *tempm1,*tempm2;
MyMass *tmpm1,*tmpm2;
tempm1=ode->next_mass;
while (tempm1!=&ode->next_mass) {
tempm2=tempm1->next;
while (tempm2!=&ode->next_mass) {
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
tmpm1=ode->next_mass;
while (tmpm1!=&ode->next_mass) {
tmpm2=tmpm1->next;
while (tmpm2!=&ode->next_mass) {
D3Sub(&p,&tmpm2->state->x,&tmpm1->state->x);
dd=D3NormSqr(&p);
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
if (dd<=Sqr(tmpm1->radius+tmpm2->radius)) {
d=Sqrt(dd)+0.0001;
dd=10.0*Sqr(Sqr(Sqr(tempm1->radius+tempm2->radius)-dd));
dd=10.0*Sqr(Sqr(Sqr(tmpm1->radius+tmpm2->radius)-dd));
D3MulEqu(&p,dd/d);
D3AddEqu(&tempm2->DstateDt->DxDt,&p);
D3SubEqu(&tempm1->DstateDt->DxDt,&p);
D3AddEqu(&tmpm2->DstateDt->DxDt,&p);
D3SubEqu(&tmpm1->DstateDt->DxDt,&p);
}
tempm2=tempm2->next;
tmpm2=tmpm2->next;
}
tempm1=tempm1->next;
tmpm1=tmpm1->next;
}
}
U0 PlaceMass(I64 x, I64 y)
{
MyMass *tempm=CAlloc(sizeof(MyMass));
tempm->mass=1.0;
tempm->drag_profile_factor=100.0;
tempm->x=x;
tempm->y=y;
tempm->radius=10*(Rand+0.25);
QueIns(tempm,ode->last_mass);
MyMass *tmpm=CAlloc(sizeof(MyMass));
tmpm->mass=1.0;
tmpm->drag_profile_factor=100.0;
tmpm->x=x;
tmpm->y=y;
tmpm->radius=10*(Rand+0.25);
QueIns(tmpm,ode->last_mass);
}
U0 PlaceSpring(MyMass *tempm1,MyMass *tempm2)
U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
{
MySpring *temps=CAlloc(sizeof(MySpring));
temps->end1=tempm1;
temps->end2=tempm2;
temps->const=10000;
temps->rest_len=100;
QueIns(temps,ode->last_spring);
MySpring *tmps=CAlloc(sizeof(MySpring));
tmps->end1=tmpm1;
tmps->end2=tmpm2;
tmps->const=10000;
tmps->rest_len=100;
QueIns(tmps,ode->last_spring);
}
U0 Init()
@@ -100,7 +100,7 @@ U0 CleanUp()
U0 MassSpringDemo()
{
I64 msg_code,a1,a2;
MyMass *tempm1=NULL,*tempm2=NULL;
MyMass *tmpm1=NULL,*tmpm2=NULL;
PopUpOk("Left-Click to place mas\n"
"Right-Click and drag to\n"
@@ -137,13 +137,13 @@ U0 MassSpringDemo()
PlaceMass(a1,a2);
break;
case MSG_IP_R_DOWN:
tempm1=MassFind(ode,a1,a2);
tempm2=NULL;
tmpm1=MassFind(ode,a1,a2);
tmpm2=NULL;
break;
case MSG_IP_R_UP:
if (tempm1 && (tempm2=MassFind(ode,a1,a2)) && tempm1!=tempm2)
PlaceSpring(tempm1,tempm2);
tempm1=tempm2=NULL;
if (tmpm1 && (tmpm2=MassFind(ode,a1,a2)) && tmpm1!=tmpm2)
PlaceSpring(tmpm1,tmpm2);
tmpm1=tmpm2=NULL;
break;
case MSG_KEY_DOWN:
switch (a1) {
+1 -1
View File
@@ -102,7 +102,7 @@ U0 Maze()
ch=GetChar;
break;
}
WinMgrSync;
Refresh;
}
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
catch
+59 -64
View File
@@ -17,23 +17,18 @@ CDC *map_dc;
#define GATE_HEIGHT 7
F64 gate_é,gate_t;
$BG,10$#define GE_COW 0
$BG,10$
$SP,"<1>",BI=1$ $SP,"<2>",BI=2$ $SP,"<3>",BI=3$
#define GE_BULL 1
$SP,"<4>",BI=4$ $SP,"<5>",BI=5$ $SP,"<6>",BI=6$
#define GE_HORSE 2
$SP,"<7>",BI=7$ $SP,"<8>",BI=8$
#define GE_NUM 3
$SP,"<9>",BI=9$
$SP,"<10>",BI=10$
@@ -148,35 +143,35 @@ U0 RiverDropsDel()
U0 RiverDropsNext(CTask *mem_task)
{
RiverDrop *tempr,*tempr1;
RiverDrop *tmpr,*tmpr1;
while (LBts(&rd_lock,0))
Yield;
tempr=rd_head.next;
while (tempr!=&rd_head) {
tempr1=tempr->next;
if (++tempr->y>=MAP_HEIGHT-MAP_BORDER) {
QueRem(tempr);
Free(tempr);
tmpr=rd_head.next;
while (tmpr!=&rd_head) {
tmpr1=tmpr->next;
if (++tmpr->y>=MAP_HEIGHT-MAP_BORDER) {
QueRem(tmpr);
Free(tmpr);
} else {
do {
if (RandU16&1 && GrPeek(map_dc,r_x[tempr->y]+tempr->dx,
tempr->y+tempr->dy)==BLUE)
if (RandU16&1 && GrPeek(map_dc,r_x[tmpr->y]+tmpr->dx,
tmpr->y+tmpr->dy)==BLUE)
break;
tempr->dx=ClampI64(tempr->dx+RandU16%3-1,-r_width[tempr->y]/2,
r_width[tempr->y]/2);
tempr->dy=ClampI64(tempr->dy+RandU16%3-1,-r_width[tempr->y]/2,
r_width[tempr->y]/2);
} while (GrPeek(map_dc,r_x[tempr->y]+tempr->dx,
tempr->y+tempr->dy)!=BLUE &&
GrPeek(map_dc,r_x[tempr->y],tempr->y)==BLUE);//Might be reiniting
tmpr->dx=ClampI64(tmpr->dx+RandU16%3-1,-r_width[tmpr->y]/2,
r_width[tmpr->y]/2);
tmpr->dy=ClampI64(tmpr->dy+RandU16%3-1,-r_width[tmpr->y]/2,
r_width[tmpr->y]/2);
} while (GrPeek(map_dc,r_x[tmpr->y]+tmpr->dx,
tmpr->y+tmpr->dy)!=BLUE &&
GrPeek(map_dc,r_x[tmpr->y],tmpr->y)==BLUE);//Might be reiniting
}
tempr=tempr1;
tmpr=tmpr1;
}
tempr=MAlloc(sizeof(RiverDrop),mem_task);
tempr->y=MAP_BORDER;
tempr->dx=0;
tempr->dy=0;
QueIns(tempr,rd_head.last);
tmpr=MAlloc(sizeof(RiverDrop),mem_task);
tmpr->y=MAP_BORDER;
tmpr->dx=0;
tmpr->dy=0;
QueIns(tmpr,rd_head.last);
LBtr(&rd_lock,0);
}
@@ -184,14 +179,14 @@ U0 RiverDropsDraw(CDC *dc,I64 cx,I64 cy)
{
I64 i;
F64 t=tS;
RiverDrop *tempr;
RiverDrop *tmpr;
while (LBts(&rd_lock,0))
Yield;
tempr=rd_head.next;
tmpr=rd_head.next;
dc->color=LTBLUE;
while (tempr!=&rd_head) {
GrPlot(dc,r_x[tempr->y]+tempr->dx-cx,tempr->y+tempr->dy-cy);
tempr=tempr->next;
while (tmpr!=&rd_head) {
GrPlot(dc,r_x[tmpr->y]+tmpr->dx-cx,tmpr->y+tmpr->dy-cy);
tmpr=tmpr->next;
}
LBtr(&rd_lock,0);
@@ -336,7 +331,7 @@ 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;
F64 f,d,dx,dy,s,stress;
Animal *tempa,*tempa1;
Animal *tmpa,*tmpa1;
while (TRUE) {
max_speed=ClampU64(max_speed,MAX_U32/3,200*MAX_U32);
cx=(MAP_WIDTH -parent->pix_width)/2,
@@ -349,30 +344,30 @@ U0 AnimateTask(CTask *parent)
gate_t=tS;
RedrawGate;
for (i=0;i<NUM_ANIMALS;i++) {
tempa=&a[i];
if (!tempa->dead) {
tmpa=&a[i];
if (!tmpa->dead) {
//Move away from horse
ddx=tempa->x.i32[1]-cursor_x;
ddy=tempa->y.i32[1]-cursor_y;
ddx=tmpa->x.i32[1]-cursor_x;
ddy=tmpa->y.i32[1]-cursor_y;
if (dd=SqrI64(ddx)+SqrI64(ddy)) {
d=Sqrt(dd);
dx=ddx/d;
dy=ddy/d;
f=5.0e2*MAX_U32/dd;
tempa->dx+=f*dx;
tempa->dy+=f*dy;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
//Resel buddy about every NUM_ANIMALS*10ms=5.12 seconds
tempa1=&a[tempa->buddy];
if (tempa1->dead || i==updates%NUM_ANIMALS) {
tmpa1=&a[tmpa->buddy];
if (tmpa1->dead || i==updates%NUM_ANIMALS) {
BuddySel(i);
tempa1=&a[tempa->buddy];
tmpa1=&a[tmpa->buddy];
}
//Move toward buddy
ddx=tempa->x.i32[1]-tempa1->x.i32[1];
ddy=tempa->y.i32[1]-tempa1->y.i32[1];
ddx=tmpa->x.i32[1]-tmpa1->x.i32[1];
ddy=tmpa->y.i32[1]-tmpa1->y.i32[1];
if (dd=SqrI64(ddx)+SqrI64(ddy)) {
d=Sqrt(dd);
s=d`1.25-80;
@@ -380,42 +375,42 @@ U0 AnimateTask(CTask *parent)
dx=ddx/d;
dy=ddy/d;
f=-0.001*s*MAX_U32;
tempa->dx+=f*dx;
tempa->dy+=f*dy;
tmpa->dx+=f*dx;
tmpa->dy+=f*dy;
}
//Make velocity similar to buddy
tempa->dx+=0.1*(tempa1->dx-tempa->dx);
tempa->dy+=0.1*(tempa1->dy-tempa->dy);
tmpa->dx+=0.1*(tmpa1->dx-tmpa->dx);
tmpa->dy+=0.1*(tmpa1->dy-tmpa->dy);
//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);
tmpa->dx=0.995*ClampI64(tmpa->dx+RandI32/32,-max_speed,max_speed);
tmpa->dy=0.995*ClampI64(tmpa->dy+RandI32/32,-max_speed,max_speed);
//Slow in river
if (GrPeek(map_dc,tempa->x.i32[1],tempa->y.i32[1])!=LTGREEN) {
tempa->dx/=2;
tempa->dy/=2;
if (GrPeek(map_dc,tmpa->x.i32[1],tmpa->y.i32[1])!=LTGREEN) {
tmpa->dx/=2;
tmpa->dy/=2;
}
if (CheckMap((tempa->x+tempa->dx)>>32,(tempa->y+tempa->dy)>>32)) {
tempa->x+=tempa->dx;
tempa->y+=tempa->dy;
if (CheckMap((tmpa->x+tmpa->dx)>>32,(tmpa->y+tmpa->dy)>>32)) {
tmpa->x+=tmpa->dx;
tmpa->y+=tmpa->dy;
}
//Keep on map
if (!(MAP_BORDER+ANIMAL_WIDTH/2
<=tempa->x.i32[1]<MAP_WIDTH-MAP_BORDER-ANIMAL_WIDTH/2)) {
tempa->x -=tempa->dx;
tempa->dx=-tempa->dx;
<=tmpa->x.i32[1]<MAP_WIDTH-MAP_BORDER-ANIMAL_WIDTH/2)) {
tmpa->x -=tmpa->dx;
tmpa->dx=-tmpa->dx;
}
if (!(MAP_BORDER+ANIMAL_HEIGHT
<=tempa->y.i32[1]<MAP_HEIGHT-MAP_BORDER)) {
tempa->y -=tempa->dy;
tempa->dy=-tempa->dy;
<=tmpa->y.i32[1]<MAP_HEIGHT-MAP_BORDER)) {
tmpa->y -=tmpa->dy;
tmpa->dy=-tmpa->dy;
}
cnt++;
if (tempa->x>>32>=FENCE_WIDTH || tempa->y>>32>=FENCE_HEIGHT)
if (tmpa->x>>32>=FENCE_WIDTH || tmpa->y>>32>=FENCE_HEIGHT)
my_outside_cnt++;
}
}
Binary file not shown.
Binary file not shown.
File renamed without changes.
+7 -7
View File
@@ -1,4 +1,4 @@
//Generate "StadiumBG.GRA.Z" from "StadiumBG.DD.Z"
//Generate "StadiumBG.GR.Z" from "StadiumBG.DD.Z"
U0 StadiumGen()
{
@@ -13,19 +13,19 @@ U0 StadiumGen()
DocClear;
Type("StadiumBG.DD");
"$$CM,0,%d$$",TEXT_ROWS-3;
fp_old_update=gr.fp_final_screen_update; //hide mouse cursor
gr.fp_final_screen_update=NULL;
fp_old_update=gr.fp_final_scrn_update; //hide mouse cursor
gr.fp_final_scrn_update=NULL;
WinMgrSync(2,TRUE);
dc2=DCScreenCapture;
Refresh(2,TRUE);
dc2=DCScrnCapture;
dc=DCExt(dc2,0,FONT_HEIGHT,GR_WIDTH,GR_HEIGHT);
DCDel(dc2);
GRAWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
GRWrite("StadiumBG",dc,DCSF_COMPRESSED|DCSF_PALETTE_GET);
DCDel(dc);
DocCursor(ON);
gr.fp_final_screen_update=fp_old_update;
gr.fp_final_scrn_update=fp_old_update;
DocClear;
}
+2 -2
View File
@@ -54,11 +54,11 @@ U0 TakeTurn(I64 player)
Beep(1000);
while (!ip.lb) {
DrawBoard(player);
WinMgrSync;
Refresh;
}
while (ip.lb) {
DrawBoard(player);
WinMgrSync;
Refresh;
}
x=ip.pos.x-Fs->pix_left;
y=ip.pos.y-Fs->pix_top;
+15 -15
View File
@@ -96,7 +96,7 @@ U0 DrawIt(CTask *task,CDC *dc)
}
}
Unit *FindUnit(I64 x,I64 y,I64 player)
Unit *UnitFind(I64 x,I64 y,I64 player)
{
I64 i,dd,best_dd=MAX_I64;
Unit *res=NULL;
@@ -112,7 +112,7 @@ Unit *FindUnit(I64 x,I64 y,I64 player)
return res;
}
U0 CheckForKills(I64 x1,I64 y1,I64 player)
U0 KillsChk(I64 x1,I64 y1,I64 player)
{
I64 i,j,x2,y2,dd;
Bool found;
@@ -141,7 +141,7 @@ U0 CheckForKills(I64 x1,I64 y1,I64 player)
}
}
Bool MoveUnit(Unit *tempu,I64 x2,I64 y2)
Bool UnitMove(Unit *tmpu,I64 x2,I64 y2)
{
I64 i,r,c,r2,c2,x=start_x,y=start_y;
S2W(&x2,&y2);
@@ -151,8 +151,8 @@ Bool MoveUnit(Unit *tempu,I64 x2,I64 y2)
c=x; r=y;
S2Circle(&c,&r);
if (c==c2 && r==r2) {
end_x=tempu->x=x2;
end_y=tempu->y=y2;
end_x=tmpu->x=x2;
end_y=tmpu->y=y2;
return TRUE;
}
if (r2!=r) {
@@ -284,7 +284,7 @@ U0 CleanUp()
U0 TreeCheckers()
{
I64 msg_code,a1,a2,ch,sc;
Unit *tempu;
Unit *tmpu;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
MenuPush(
@@ -307,7 +307,7 @@ U0 TreeCheckers()
try {
cn_start:
Init;
tempu=NULL;
tmpu=NULL;
show_start=FALSE;
Fs->draw_it=&DrawIt;
while (TRUE) {
@@ -326,21 +326,21 @@ cn_start:
break;
case MSG_IP_L_DOWN:
if (num_alive[0]>1 && num_alive[1]>1) {
tempu=FindUnit(a1,a2,cur_player);
end_x=start_x=tempu->x;
end_y=start_y=tempu->y;
tmpu=UnitFind(a1,a2,cur_player);
end_x=start_x=tmpu->x;
end_y=start_y=tmpu->y;
show_start=TRUE;
}
break;
case MSG_IP_MOVE:
if (tempu)
MoveUnit(tempu,a1,a2);
if (tmpu)
UnitMove(tmpu,a1,a2);
break;
case MSG_IP_L_UP:
MoveUnit(tempu,a1,a2);
CheckForKills(tempu->x,tempu->y,cur_player);
UnitMove(tmpu,a1,a2);
KillsChk(tmpu->x,tmpu->y,cur_player);
show_start=FALSE;
tempu=NULL;
tmpu=NULL;
cur_player=1-cur_player;
break;
}
+120 -120
View File
@@ -150,32 +150,32 @@ F64 Dip
return ASin((y_front-y_back)/CAR_LENGTH);
}
Track *TrackFind(Track *_tempt,I64 x,I64 z)
Track *TrackFind(Track *_tmpt,I64 x,I64 z)
{
Track *res=_tempt,*tempt;
Track *res=_tmpt,*tmpt;
I64 dd,best=SqrI64(res->x-x)+SqrI64(res->z-z);
tempt=_tempt;
tmpt=_tmpt;
while (TRUE) {
tempt=tempt->next;
if (tempt==&track_head)
tempt=tempt->next;
dd=SqrI64(tempt->x-x)+SqrI64(tempt->z-z);
tmpt=tmpt->next;
if (tmpt==&track_head)
tmpt=tmpt->next;
dd=SqrI64(tmpt->x-x)+SqrI64(tmpt->z-z);
if (dd<best) {
best=dd;
res=tempt;
res=tmpt;
} else
break;
}
tempt=_tempt;
tmpt=_tmpt;
while (TRUE) {
tempt=tempt->last;
if (tempt==&track_head)
tempt=tempt->last;
dd=SqrI64(tempt->x-x)+SqrI64(tempt->z-z);
tmpt=tmpt->last;
if (tmpt==&track_head)
tmpt=tmpt->last;
dd=SqrI64(tmpt->x-x)+SqrI64(tmpt->z-z);
if (dd<best) {
best=dd;
res=tempt;
res=tmpt;
} else
break;
}
@@ -185,56 +185,56 @@ Track *TrackFind(Track *_tempt,I64 x,I64 z)
U0 TrackSlice(F64 *_x,F64 *_z,F64 é,F64 d)
{
F64 x=*_x,z=*_z,c=Cos(é),s=Sin(é),dx=d*s,dz=-d*c;
Track *tempt,*last=track_head.last;
Track *tmpt,*last=track_head.last;
if (last==&track_head)
last=NULL;
tempt=CAlloc(sizeof(Track));
tmpt=CAlloc(sizeof(Track));
if (last) {
MemCpy(&tempt->center[0],&last->center[3],sizeof(CD3I32));
MemCpy(&tempt->center[1],&last->center[2],sizeof(CD3I32));
MemCpy(&tmpt->center[0],&last->center[3],sizeof(CD3I32));
MemCpy(&tmpt->center[1],&last->center[2],sizeof(CD3I32));
}
tempt->center[2].x=x+(WIDTH/2)*c+dx;
tempt->center[2].z=z+(WIDTH/2)*s+dz;
tempt->center[2].y=DipY(tempt->center[2].x,tempt->center[2].z);
tempt->center[3].x=x-(WIDTH/2)*c+dx;
tempt->center[3].z=z-(WIDTH/2)*s+dz;
tempt->center[3].y=DipY(tempt->center[3].x,tempt->center[3].z);
tmpt->center[2].x=x+(WIDTH/2)*c+dx;
tmpt->center[2].z=z+(WIDTH/2)*s+dz;
tmpt->center[2].y=DipY(tmpt->center[2].x,tmpt->center[2].z);
tmpt->center[3].x=x-(WIDTH/2)*c+dx;
tmpt->center[3].z=z-(WIDTH/2)*s+dz;
tmpt->center[3].y=DipY(tmpt->center[3].x,tmpt->center[3].z);
if (last) {
MemCpy(&tempt->left[0],&last->left[3],sizeof(CD3I32));
MemCpy(&tempt->left[1],&last->left[2],sizeof(CD3I32));
MemCpy(&tmpt->left[0],&last->left[3],sizeof(CD3I32));
MemCpy(&tmpt->left[1],&last->left[2],sizeof(CD3I32));
}
tempt->left[2].x=x-(WIDTH/2)*c+dx;
tempt->left[2].z=z-(WIDTH/2)*s+dz;
tempt->left[2].y=DipY(tempt->left[2].x,tempt->left[2].z);
tempt->left[3].x=x-(WIDTH/2+SHOULDER)*c+dx;
tempt->left[3].z=z-(WIDTH/2+SHOULDER)*s+dz;
tempt->left[3].y=DipY(tempt->left[3].x,tempt->left[3].z);
tmpt->left[2].x=x-(WIDTH/2)*c+dx;
tmpt->left[2].z=z-(WIDTH/2)*s+dz;
tmpt->left[2].y=DipY(tmpt->left[2].x,tmpt->left[2].z);
tmpt->left[3].x=x-(WIDTH/2+SHOULDER)*c+dx;
tmpt->left[3].z=z-(WIDTH/2+SHOULDER)*s+dz;
tmpt->left[3].y=DipY(tmpt->left[3].x,tmpt->left[3].z);
if (last) {
MemCpy(&tempt->right[0],&last->right[3],sizeof(CD3I32));
MemCpy(&tempt->right[1],&last->right[2],sizeof(CD3I32));
MemCpy(&tmpt->right[0],&last->right[3],sizeof(CD3I32));
MemCpy(&tmpt->right[1],&last->right[2],sizeof(CD3I32));
}
tempt->right[2].x=x+(WIDTH/2+SHOULDER)*c+dx;
tempt->right[2].z=z+(WIDTH/2+SHOULDER)*s+dz;
tempt->right[2].y=DipY(tempt->right[2].x,tempt->right[2].z);
tempt->right[3].x=x+(WIDTH/2)*c+dx;
tempt->right[3].z=z+(WIDTH/2)*s+dz;
tempt->right[3].y=DipY(tempt->right[3].x,tempt->right[3].z);
tmpt->right[2].x=x+(WIDTH/2+SHOULDER)*c+dx;
tmpt->right[2].z=z+(WIDTH/2+SHOULDER)*s+dz;
tmpt->right[2].y=DipY(tmpt->right[2].x,tmpt->right[2].z);
tmpt->right[3].x=x+(WIDTH/2)*c+dx;
tmpt->right[3].z=z+(WIDTH/2)*s+dz;
tmpt->right[3].y=DipY(tmpt->right[3].x,tmpt->right[3].z);
tempt->x=x;
tempt->z=z;
tempt->é=é;
tempt->num=track_head.last->num+1;
tempt->d =track_head.last->d+d;
tmpt->x=x;
tmpt->z=z;
tmpt->é=é;
tmpt->num=track_head.last->num+1;
tmpt->d =track_head.last->d+d;
QueIns(tempt,track_head.last);
QueIns(tmpt,track_head.last);
if (tempt->num&1)
tempt->c=RED;
if (tmpt->num&1)
tmpt->c=RED;
else
tempt->c=WHITE;
tmpt->c=WHITE;
if (x<t_minx) t_minx=x;
if (x>t_maxx) t_maxx=x;
@@ -266,7 +266,7 @@ U0 CoupleEnds()
U0 InitTrack()
{
I64 i,j;
Track *tempt;
Track *tmpt;
F64 x,z,é,d;
MemSet(&track_head,0,sizeof(Track));
@@ -295,13 +295,13 @@ U0 InitTrack()
CoupleEnds;
tempt=track_head.next;
tmpt=track_head.next;
for (i=0;i<mp_cnt;i++) {
j=(i+1)*track_head.last->num/mp_cnt+1;
track_start[i]=tempt;
while (tempt!=&track_head && tempt->num!=j)
tempt=tempt->next;
track_end[i]=tempt;
track_start[i]=tmpt;
while (tmpt!=&track_head && tmpt->num!=j)
tmpt=tmpt->next;
track_end[i]=tmpt;
}
t_minx-=BORDER; t_minz-=BORDER;
@@ -311,13 +311,13 @@ U0 InitTrack()
track_map->color=LTGRAY;
GrRect(track_map,0,0,track_map->width,track_map->height);
tempt=track_head.next;
tmpt=track_head.next;
track_map->color=YELLOW;
track_map->pen_width=3;
while (tempt!=&track_head) {
GrPlot3(track_map,track_map->width-(tempt->x-t_minx)>>MAP_BITS,
(tempt->z-t_minz)>>MAP_BITS,0);
tempt=tempt->next;
while (tmpt!=&track_head) {
GrPlot3(track_map,track_map->width-(tmpt->x-t_minx)>>MAP_BITS,
(tmpt->z-t_minz)>>MAP_BITS,0);
tmpt=tmpt->next;
}
}
@@ -350,9 +350,9 @@ U0 MPUpdateWin(CDC *dc2)
I64 i,x,y,z,
w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
F64 s,dip_é=Dipé(c[0].p.x,c[0].p.z,c[0].é);
Car *tempc;
Car *tmpc;
CD3I32 poly[4];
Track *tempt,*tempt1;
Track *tmpt,*tmpt1;
CDC *dc=DCAlias(gr.dc2,task);
Mat4x4IdentEqu(r);
@@ -362,19 +362,19 @@ U0 MPUpdateWin(CDC *dc2)
dc->depth_buf=dc2->depth_buf;
//Track
tempt =track_start[Gs->num];
tempt1=track_end [Gs->num];
while (tempt!=tempt1) {
tmpt =track_start[Gs->num];
tmpt1=track_end [Gs->num];
while (tmpt!=tmpt1) {
dc->color=DKGRAY;
if (PrepPoly(&tempt->center,r,cx,h,poly)) {
if (PrepPoly(&tmpt->center,r,cx,h,poly)) {
GrFillPoly3(dc,4,poly);
dc->color=tempt->c;
if (PrepPoly(&tempt->left,r,cx,h,poly))
dc->color=tmpt->c;
if (PrepPoly(&tmpt->left,r,cx,h,poly))
GrFillPoly3(dc,4,poly);
if (PrepPoly(&tempt->right,r,cx,h,poly))
if (PrepPoly(&tmpt->right,r,cx,h,poly))
GrFillPoly3(dc,4,poly);
}
tempt=tempt->next;
tmpt=tmpt->next;
}
dc->flags|=DCF_TRANSFORMATION;
@@ -395,17 +395,17 @@ 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;
tmpc=&c[i];
x=tmpc->p.x-c[0].p.x; y=tmpc->p.y-c[0].p.y; z=tmpc->p.z-c[0].p.z;
Mat4x4MulXYZ(r,&x,&y,&z);
if (z>0) {
s=100.0/(AbsI64(z)+50);
Mat4x4IdentEqu(dc->r);
Mat4x4Scale(dc->r,s*2);
Mat4x4RotX(dc->r,Dipé(tempc->p.x,tempc->p.z,-tempc->é));
Mat4x4RotY(dc->r,tempc->é-c[0].é);
Mat4x4RotX(dc->r,Dipé(tmpc->p.x,tmpc->p.z,-tmpc->é));
Mat4x4RotY(dc->r,tmpc->é-c[0].é);
DCMat4x4Set(dc,dc->r);
Sprite3B(dc,s*x+cx,s*y+h,z+GR_Z_ALL,tempc->img);
Sprite3B(dc,s*x+cx,s*y+h,z+GR_Z_ALL,tmpc->img);
}
}
dc->depth_buf=NULL;
@@ -433,7 +433,7 @@ U0 DrawIt(CTask *task,CDC *dc)
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=&c[0];
Car *tmpc=&c[0];
dc->color=LTCYAN;
GrRect(dc,0,0,w,HORIZON_DIP*Sin(dip_é)+FONT_HEIGHT*4.5);
@@ -462,7 +462,7 @@ U0 DrawIt(CTask *task,CDC *dc)
Yield;
Mat4x4IdentEqu(r);
Mat4x4RotY(r,tempc->dé);
Mat4x4RotY(r,tmpc->dé);
Mat4x4RotX(r,0.4-8*dip_é); //Made this up
dc->transform=&VRTransform;
dc->x=task->pix_width>>1;
@@ -503,40 +503,40 @@ U0 DrawIt(CTask *task,CDC *dc)
U0 AnimateTask(I64)
{
Car *tempc;
Car *tmpc;
I64 i,x,z;
Bool on_track;
Track *tempt,*tempt2;
Track *tmpt,*tmpt2;
while (TRUE) {
if (!game_over)
Snd(0.01*c[0].speed*3+10);
else
Snd(0);
for (i=0;i<NUM_CARS;i++) {
tempc=&c[i];
tempc->p.x-=0.01*tempc->speed*Cos(tempc->é-ã/2);
tempc->p.z+=0.01*tempc->speed*Sin(tempc->é-ã/2);
tempt=TrackFind(tempc->t,tempc->p.x,tempc->p.z);
tmpc=&c[i];
tmpc->p.x-=0.01*tmpc->speed*Cos(tmpc->é-ã/2);
tmpc->p.z+=0.01*tmpc->speed*Sin(tmpc->é-ã/2);
tmpt=TrackFind(tmpc->t,tmpc->p.x,tmpc->p.z);
if (i) {
if (tempt!=tempc->t) {
tempt2=tempt->next;
if (tempt2==&track_head)
tempt2=tempt2->next;
tempc->é=Arg(-tempt2->z+tempc->p.z,-tempt2->x+tempc->p.x);
if (tmpt!=tmpc->t) {
tmpt2=tmpt->next;
if (tmpt2==&track_head)
tmpt2=tmpt2->next;
tmpc->é=Arg(-tmpt2->z+tmpc->p.z,-tmpt2->x+tmpc->p.x);
}
} else {
tempc->é+=0.01*tempc->dé;
x=track_map->width-(tempc->p.x-t_minx)>>MAP_BITS;
z=(tempc->p.z-t_minz)>>MAP_BITS;
tmpc->é+=0.01*tmpc->dé;
x=track_map->width-(tmpc->p.x-t_minx)>>MAP_BITS;
z=(tmpc->p.z-t_minz)>>MAP_BITS;
if (GrPeek(track_map,x,z)!=YELLOW) {
on_track=FALSE;
tempc->speed-=0.01*tempc->speed;
if (tempc->speed<0) tempc->speed=0;
tmpc->speed-=0.01*tmpc->speed;
if (tmpc->speed<0) tmpc->speed=0;
} else
on_track=TRUE;
}
tempc->t=tempt;
tempc->p.y=DipY(tempc->p.x,tempc->p.z);
tmpc->t=tmpt;
tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
}
if (!game_over && on_track) {
for (i=1;i<NUM_CARS;i++)
@@ -568,58 +568,58 @@ U8 *imgs[8]={$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<2>",BI=2$,$IB
U0 InitBushes()
{
Bush *tempb;
Bush *tmpb;
I64 i,j,x,z;
track_map->color=LTGREEN;
track_map->pen_width=1;
for (i=0;i<NUM_BUSHES;i++) {
tempb=&b[i];
tmpb=&b[i];
ib_restart:
tempb->p.x=Rand*(t_maxx-t_minx)+t_minx;
tempb->p.z=Rand*(t_maxz-t_minz)+t_minz;
x=track_map->width-(tempb->p.x-t_minx)>>MAP_BITS;
z=(tempb->p.z-t_minz)>>MAP_BITS;
tmpb->p.x=Rand*(t_maxx-t_minx)+t_minx;
tmpb->p.z=Rand*(t_maxz-t_minz)+t_minz;
x=track_map->width-(tmpb->p.x-t_minx)>>MAP_BITS;
z=(tmpb->p.z-t_minz)>>MAP_BITS;
for (j=0;j<8;j++)
if (GrPeek(track_map,x+gr_x_offsets[j],z+gr_y_offsets[j])!=LTGRAY)
goto ib_restart;
GrPlot(track_map,x,z);
tempb->p.y=DipY(tempb->p.x,tempb->p.z);
tempb->sym=RandU16&1;
tempb->img=imgs[i&7];
tmpb->p.y=DipY(tmpb->p.x,tmpb->p.z);
tmpb->sym=RandU16&1;
tmpb->img=imgs[i&7];
}
}
U0 Init()
{
Car *tempc;
Track *tempt;
Car *tmpc;
Track *tmpt;
F64 d;
I64 i;
InitTrack;
InitBushes;
tempt=track_head.next;
tmpt=track_head.next;
for (i=0;i<NUM_CARS;i++) {
tempc=&c[i];
tempc->t=tempt;
tempc->p.x=tempt->x;
tempc->p.z=tempt->z;
tempc->p.y=DipY(tempc->p.x,tempc->p.z);
tempc->é =-tempt->é;
tempc->dé=0;
tmpc=&c[i];
tmpc->t=tmpt;
tmpc->p.x=tmpt->x;
tmpc->p.z=tmpt->z;
tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
tmpc->é =-tmpt->é;
tmpc->dé=0;
if (!i) {
tempc->img=$IB,"<5>",BI=5$;
tempc->speed=0;
tmpc->img=$IB,"<5>",BI=5$;
tmpc->speed=0;
} else {
tempc->img=$IB,"<6>",BI=6$;
tempc->speed=2500.0;
tmpc->img=$IB,"<6>",BI=6$;
tmpc->speed=2500.0;
}
d=(i+1)*track_head.last->d/NUM_CARS;
while (tempt->next!=&track_head && tempt->d<d)
tempt=tempt->next;
while (tmpt->next!=&track_head && tmpt->d<d)
tmpt=tmpt->next;
}
distance=0;
tf=0;
+99 -99
View File
@@ -121,9 +121,9 @@ class Step
U0 DrawIt(CTask *task,CDC *dc)
{
I64 r[16],i,w=task->pix_width,h=task->pix_height,x,y;
U8 *img,*temps;
Step *tempst;
Peasant *tempp;
U8 *img,*tmps;
Step *tmpst;
Peasant *tmpp;
F64 tt;
dc->pen_width=1;
@@ -157,35 +157,35 @@ U0 DrawIt(CTask *task,CDC *dc)
}
}
tempst=step_head.next;
while (tempst!=&step_head) {
if (tS-tempst->t0<2.0)
tmpst=step_head.next;
while (tmpst!=&step_head) {
if (tS-tmpst->t0<2.0)
dc->color=DKGRAY;
else
dc->color=LTGRAY;
dc->pen_width=4;
GrPlot3(dc,tempst->x,tempst->y,0);
tempst=tempst->next;
GrPlot3(dc,tmpst->x,tmpst->y,0);
tmpst=tmpst->next;
}
DCDepthBufAlloc(dc);
dc->flags|=DCF_TRANSFORMATION;
dc->pen_width=1;
tempp=peasant_head.next;
while (tempp!=&peasant_head) {
tmpp=peasant_head.next;
while (tmpp!=&peasant_head) {
Mat4x4IdentEqu(r);
Mat4x4RotY(r,tempp->é+ã/2);
Mat4x4RotY(r,tmpp->é+ã/2);
Mat4x4RotX(r,ã/6);
if (tempp->stopped)
SpriteMat3B(dc,tempp->x,tempp->y,GR_Z_ALL,peasant_imgs[0],r);
if (tmpp->stopped)
SpriteMat3B(dc,tmpp->x,tmpp->y,GR_Z_ALL,peasant_imgs[0],r);
else {
temps=SpriteInterpolate(Saw(animate_mS/250.0,1.0),
tmps=SpriteInterpolate(Saw(animate_mS/250.0,1.0),
peasant_imgs[ animate_phase &3],
peasant_imgs[(animate_phase+1)&3]);
SpriteMat3B(dc,tempp->x,tempp->y,GR_Z_ALL,temps,r);
Free(temps);
SpriteMat3B(dc,tmpp->x,tmpp->y,GR_Z_ALL,tmps,r);
Free(tmps);
}
tempp=tempp->next;
tmpp=tmpp->next;
}
dc->pen_width=1;
@@ -195,11 +195,11 @@ U0 DrawIt(CTask *task,CDC *dc)
if (tS>king_timeout)
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,king_imgs[0],r);
else {
temps=SpriteInterpolate(Saw(king_mS/250.0,1.0),
tmps=SpriteInterpolate(Saw(king_mS/250.0,1.0),
king_imgs[ king_phase &3],
king_imgs[(king_phase+1)&3]);
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,temps,r);
Free(temps);
SpriteMat3B(dc,king_x,king_y,GR_Z_ALL,tmps,r);
Free(tmps);
}
dc->pen_width=1;
@@ -223,38 +223,38 @@ U0 DrawIt(CTask *task,CDC *dc)
U0 StepNew(CTask *task,I64 x,I64 y,F64 é,Bool left_right,Bool king)
{
Step *temps;
Step *tmps;
if (king) {
temps=MAlloc(sizeof(Step),task);
temps->x=x;
temps->y=y;
temps->t0=tS;
QueIns(temps,king_step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x;
tmps->y=y;
tmps->t0=tS;
QueIns(tmps,king_step_head.last);
}
if (left_right) {
temps=MAlloc(sizeof(Step),task);
temps->x=x-3.5*Sin(é)+2.0*Cos(é);
temps->y=y+3.5*Cos(é)+2.0*Sin(é);
temps->t0=tS;
QueIns(temps,step_head.last);
temps=MAlloc(sizeof(Step),task);
temps->x=x-3.5*Sin(é)+5.0*Cos(é);
temps->y=y+3.5*Cos(é)+5.0*Sin(é);
temps->t0=tS;
QueIns(temps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x-3.5*Sin(é)+2.0*Cos(é);
tmps->y=y+3.5*Cos(é)+2.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x-3.5*Sin(é)+5.0*Cos(é);
tmps->y=y+3.5*Cos(é)+5.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
} else {
temps=MAlloc(sizeof(Step),task);
temps->x=x+3.5*Sin(é)+0.0*Cos(é);
temps->y=y-3.5*Cos(é)+0.0*Sin(é);
temps->t0=tS;
QueIns(temps,step_head.last);
temps=MAlloc(sizeof(Step),task);
temps->x=x+3.5*Sin(é)+3.0*Cos(é);
temps->y=y-3.5*Cos(é)+3.0*Sin(é);
temps->t0=tS;
QueIns(temps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x+3.5*Sin(é)+0.0*Cos(é);
tmps->y=y-3.5*Cos(é)+0.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
tmps=MAlloc(sizeof(Step),task);
tmps->x=x+3.5*Sin(é)+3.0*Cos(é);
tmps->y=y-3.5*Cos(é)+3.0*Sin(é);
tmps->t0=tS;
QueIns(tmps,step_head.last);
}
}
@@ -262,7 +262,7 @@ U0 Init()
{
I64 i,min_x,max_x,min_y,max_y,
w=Fs->pix_width,h=Fs->pix_height;
Peasant *tempp;
Peasant *tmpp;
snow_x=snow_y=0;
new_snow_mS=0;
@@ -281,13 +281,13 @@ U0 Init()
SpriteExtents($IB,"<12>",BI=12$,&min_x,&max_x,&min_y,&max_y);
QueInit(&peasant_head);
for (i=0;i<NUM_PEASANTS;i++) {
tempp=MAlloc(sizeof(Peasant));
tempp->x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
tempp->y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
tempp->é=ã*2*Rand;
tempp->door_opened_t0=0;
tempp->stopped=FALSE;
QueIns(tempp,peasant_head.last);
tmpp=MAlloc(sizeof(Peasant));
tmpp->x=RandU16%(w-2*BORDER-(max_x-min_x+1))+BORDER-min_x;
tmpp->y=RandU16%(h-2*BORDER-(max_y-min_y+1))+BORDER-min_y;
tmpp->é=ã*2*Rand;
tmpp->door_opened_t0=0;
tmpp->stopped=FALSE;
QueIns(tmpp,peasant_head.last);
}
animate_phase=0;
animate_mS=0;
@@ -310,88 +310,88 @@ U0 CleanUp()
QueDel(&king_step_head,TRUE);
}
U0 Follow(CTask *,Peasant *tempp)
U0 Follow(CTask *,Peasant *tmpp)
{
Step *temps=king_step_head.next;
Step *tmps=king_step_head.next;
F64 d,best_d=MAX_F64;
while (temps!=&king_step_head) {
if ((d=Sqr(temps->x-tempp->x)+Sqr(temps->y-tempp->y)) &&
while (tmps!=&king_step_head) {
if ((d=Sqr(tmps->x-tmpp->x)+Sqr(tmps->y-tmpp->y)) &&
d<15*15) {
d+=1000*Sqr(tS-temps->t0);
d+=1000*Sqr(tS-tmps->t0);
if (d<best_d) {
best_d=d;
tempp->é=Arg(temps->x-tempp->x,temps->y-tempp->y);
tmpp->é=Arg(tmps->x-tmpp->x,tmps->y-tmpp->y);
}
}
temps=temps->next;
tmps=tmps->next;
}
}
U0 AnimateTask(I64)
{
Step *temps,*temps1;
Peasant *tempp;
Step *tmps,*tmps1;
Peasant *tmpp;
I64 i,w,h;
while (TRUE) {
w=Fs->parent_task->pix_width;
h=Fs->parent_task->pix_height;
temps=step_head.next;
while (temps!=&step_head) {
temps1=temps->next;
if (tS-temps->t0>5.0) {
QueRem(temps);
Free(temps);
tmps=step_head.next;
while (tmps!=&step_head) {
tmps1=tmps->next;
if (tS-tmps->t0>5.0) {
QueRem(tmps);
Free(tmps);
}
temps=temps1;
tmps=tmps1;
}
temps=king_step_head.next;
while (temps!=&king_step_head) {
temps1=temps->next;
if (tS-temps->t0>3.0) {
QueRem(temps);
Free(temps);
tmps=king_step_head.next;
while (tmps!=&king_step_head) {
tmps1=tmps->next;
if (tS-tmps->t0>3.0) {
QueRem(tmps);
Free(tmps);
}
temps=temps1;
tmps=tmps1;
}
not_stopped_cnt=0;
tempp=peasant_head.next;
while (tempp!=&peasant_head) {
if (tempp->stopped) {
if (tempp->door_opened_t0 && tS>tempp->door_opened_t0+1.0) {
tempp->door_opened_t0=0;
tempp->y=tempp->x=-9999;
tmpp=peasant_head.next;
while (tmpp!=&peasant_head) {
if (tmpp->stopped) {
if (tmpp->door_opened_t0 && tS>tmpp->door_opened_t0+1.0) {
tmpp->door_opened_t0=0;
tmpp->y=tmpp->x=-9999;
}
} else {
if (Sqr(tempp->x-w/2)+Sqr(tempp->y-h/2)<20*20) {
tempp->stopped=TRUE;
tempp->door_opened_t0=door_open_t0=tS;
if (Sqr(tmpp->x-w/2)+Sqr(tmpp->y-h/2)<20*20) {
tmpp->stopped=TRUE;
tmpp->door_opened_t0=door_open_t0=tS;
}
for (i=0;i<NUM_TREES;i++) //Hang-out by fire
if (trees[i].fire_frame_idx &&
Sqr(tempp->x-trees[i].x)+Sqr(tempp->y-trees[i].y)<20*20) {
tempp->stopped=TRUE;
Sqr(tmpp->x-trees[i].x)+Sqr(tmpp->y-trees[i].y)<20*20) {
tmpp->stopped=TRUE;
break;
}
if (!tempp->stopped) {
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)) {
tempp->é+=ã;
tempp->x+=3*Cos(tempp->é)/100;
tempp->y+=3*Sin(tempp->é)/100;
if (!tmpp->stopped) {
Follow(Fs->parent_task,tmpp);
tmpp->x+=Cos(tmpp->é)/100;
tmpp->y+=Sin(tmpp->é)/100;
if (!(BORDER/2<=tmpp->x<w-BORDER/2) ||
!(BORDER/2<=tmpp->y<h-BORDER/2)) {
tmpp->é+=ã;
tmpp->x+=3*Cos(tmpp->é)/100;
tmpp->y+=3*Sin(tmpp->é)/100;
}
if (!animate_mS && animate_phase&1)
StepNew(Fs->parent_task,tempp->x,tempp->y,tempp->é,
StepNew(Fs->parent_task,tmpp->x,tmpp->y,tmpp->é,
animate_phase&2,FALSE);
not_stopped_cnt++;
}
}
tempp=tempp->next;
tmpp=tmpp->next;
}
if (!not_stopped_cnt && !tf) {
tf=tS;
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -101,7 +101,7 @@ U0 Main()
poly[3].z=0;
GrFillPoly3(dc,4,poly);
WinMgrSync;
Refresh;
DCFill;
é+=2.1*ă/180.0;
č+=1.1*ă/180.0;
+4 -2
View File
@@ -1,8 +1,10 @@
#define MAX_PTS 16
U0 BSplineDemo()
{
CDC *dc=DCAlias;
I64 a1,a2,i=0,msg_code;
CD3I32 c[64];
CD3I32 c[MAX_PTS];
SettingsPush;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
@@ -18,7 +20,7 @@ U0 BSplineDemo()
GrCircle(dc,a1,a2,10);
i++;
}
} while (msg_code!=MSG_IP_R_UP);
} while (i<MAX_PTS && msg_code!=MSG_IP_R_UP);
dc->color=RED;
Gr2BSpline(dc,c,i,TRUE);
dc->color=BLUE;
+4 -4
View File
@@ -23,14 +23,14 @@ GrRect(img2,256-20,256-20,40,40);
I64 i;
for (i=0;i<256;i+=4) {
WinMgrSync;
Refresh;
DCFill;
GrBlot(dc,i-256,i-256,img2);
Sleep(10);
}
U8 *tempg=DC2Sprite(img1);
Sprite(tempg);
Free(tempg);
U8 *tmpg=DC2Sprite(img1);
Sprite(tmpg);
Free(tmpg);
"%h9c",'\n';
DCDel(img1);
+14 -17
View File
@@ -1,10 +1,14 @@
CDC *dc;
I64 glbl_r[4][4];
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"$.
U0 DrawIt(CTask *,CDC *dc)
{
I64 *old_r=dc->r;
dc->pen_width=2;
dc->color=RED;
dc->x=200;
dc->y=200;
dc->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc,glbl_r); //This assigns to dc->r and sets r_norm.
GrLine3(dc,-100,-100,-100, -100, 100,-100);
GrLine3(dc,-100, 100,-100, 100, 100,-100);
GrLine3(dc, 100, 100,-100, 100,-100,-100);
@@ -17,27 +21,21 @@ U0 DrawIt(CTask *,CDC *)
GrLine3(dc,-100, 100, 100, -100, 100,-100);
GrLine3(dc, 100, 100, 100, 100, 100,-100);
GrLine3(dc, 100,-100, 100, 100,-100,-100);
dc->r=old_r;
}
U0 Box()
{
F64 é=0,è=0,ê=0,s=1,s1=1.05;
dc=DCAlias(gr.dc2,Fs);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
DocClear;
Fs->draw_it=&DrawIt;
dc->x=200;
dc->y=200;
dc->flags|=DCF_TRANSFORMATION;
while (!ScanChar) {
Mat4x4IdentEqu(dc->r);
Mat4x4RotZ(dc->r,é);
Mat4x4RotX(dc->r,è);
Mat4x4RotZ(dc->r,ê);
Mat4x4Scale(dc->r,s);
DCMat4x4Set(dc,dc->r);
Mat4x4IdentEqu(glbl_r);
Mat4x4RotZ(glbl_r,é);
Mat4x4RotX(glbl_r,è);
Mat4x4RotZ(glbl_r,ê);
Mat4x4Scale(glbl_r,s);
Sleep(20);
é+=2*ã/70;
@@ -47,7 +45,6 @@ U0 Box()
if ( !(0.2<s<1.4) ) s1=1/s1;
}
SettingsPop;
DCDel(dc);
}
Box;
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
U8 *old_font=text.font;
// See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScreenCodes.HC"$,
// See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScrnCodes.HC"$,
//$LK,"::/Demo/ExtChars.HC"$, and $LK,"::/Demo/Graphics/FontEd.HC"$.
U64 waves[4]={
+23 -23
View File
@@ -13,32 +13,32 @@ Node *root;
#define Y_SPACING 45
#define ARROW_SPACING 3
U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
U0 ShowTree(CDC *dc,Node *tmpn,I64 *_node_x,I64 *_tree_x,I64 y)
{
I64 node_x;
if (tempn) {
if (tempn->left) {
ShowTree(dc,tempn->left,&node_x,_tree_x,y+Y_SPACING);
if (tmpn) {
if (tmpn->left) {
ShowTree(dc,tmpn->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);
}
if (tempn->n==n1 || tempn->n==n2) {
if (tempn->n==common_ancestor)
if (tmpn->n==n1 || tmpn->n==n2) {
if (tmpn->n==common_ancestor)
dc->color=YELLOW;
else
dc->color=RED;
} else if (tempn->n==common_ancestor)
} else if (tmpn->n==common_ancestor)
dc->color=GREEN;
else
dc->color=BLUE;
*_node_x=*_tree_x;
GrPrint(dc,*_node_x,y,"%d",tempn->n);
GrPrint(dc,*_node_x,y,"%d",tmpn->n);
*_tree_x+=X_SPACING;
if (tempn->right) {
ShowTree(dc,tempn->right,&node_x,_tree_x,y+Y_SPACING);
if (tmpn->right) {
ShowTree(dc,tmpn->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);
@@ -52,33 +52,33 @@ U0 DrawIt(CTask *,CDC *dc)
ShowTree(dc,root,&node_x,&tree_x,20);
}
U0 TreeAdd(Node **_root,Node *tempn)
U0 TreeAdd(Node **_root,Node *tmpn)
{
Node *root=*_root;
if (!root)
*_root=tempn;
else if (tempn->n==root->n)
Free(tempn);
else if (tempn->n<root->n)
TreeAdd(&root->left,tempn);
*_root=tmpn;
else if (tmpn->n==root->n)
Free(tmpn);
else if (tmpn->n<root->n)
TreeAdd(&root->left,tmpn);
else
TreeAdd(&root->right,tempn);
TreeAdd(&root->right,tmpn);
}
U0 TreeNew()
{
I64 i;
Node *tempn;
Node *tmpn;
for (i=0;i<N;i++) {
tempn=CAlloc(sizeof(Node));
tempn->n=RandU16%N;
tmpn=CAlloc(sizeof(Node));
tmpn->n=RandU16%N;
if (i==N-1)
n1=tempn->n;
n1=tmpn->n;
else if (i==N-2)
n2=tempn->n;
n2=tmpn->n;
TreeAdd(&root,tempn);
TreeAdd(&root,tmpn);
Sleep(50);
}
}
+1 -3
View File
@@ -14,9 +14,7 @@ U0 Doodle()
DocClear;
DCFill;
do {
msg_code=GetMsg(&a1,&a2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
1<<MSG_IP_R_UP);
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_UP);
switch (msg_code) {
case MSG_IP_R_UP:
i=PopUpColor;
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -15,7 +15,7 @@ and cut and paste the code into $LK,"::/Kernel/FontStd.HC"$.
You will need to recompile Kernel by calling $LK,"BootHDIns",A="MN:BootHDIns"$().
See $LK,"::/Demo/ExtChars.HC"$, $LK,"::/Demo/Games/CharDemo.HC"$,
$LK,"::/Demo/Graphics/CharAnimation.HC"$ and $LK,"::/Demo/ScreenCodes.HC"$.
$LK,"::/Demo/Graphics/CharAnimation.HC"$ and $LK,"::/Demo/ScrnCodes.HC"$.
*/
#define BLOW_UP_CHAR_X (18*FONT_WIDTH)
+3 -1
View File
@@ -1,8 +1,10 @@
U0 InputPointer()
{
"Press left mouse button to exit.\n";
while (!ip.lb) //Left button to exit.
while (!ip.lb) { //Left button to exit.
GrPlot(,ip.pos.x,ip.pos.y);
Refresh;
}
DCFill;
}
+7 -7
View File
@@ -114,21 +114,21 @@ U0 SetMenu()
{
I64 i;
U8 buf[STR_LEN];
CMenuEntry *tempse;
CMenuEntry *tmpse;
for (i=0;i<=9;i++) {
StrPrint(buf,"Settings/Layer%d",i);
if (tempse=MenuEntryFind(Fs->cur_menu,buf)) {
if (tmpse=MenuEntryFind(Fs->cur_menu,buf)) {
if (i==tt.z)
tempse->checked=TRUE;
tmpse->checked=TRUE;
else
tempse->checked=FALSE;
tmpse->checked=FALSE;
}
}
if (tempse=MenuEntryFind(Fs->cur_menu,"Settings/Ends")) {
if (tmpse=MenuEntryFind(Fs->cur_menu,"Settings/Ends")) {
if (tt.ends)
tempse->checked=TRUE;
tmpse->checked=TRUE;
else
tempse->checked=FALSE;
tmpse->checked=FALSE;
}
}
Binary file not shown.
Binary file not shown.
+14 -14
View File
@@ -65,16 +65,16 @@ F64 MPDraw(CTask *task)
U0 Draw()
{
CSrvCmd *tempm[MP_MAX_PROCESSORS];
CSrvCmd *tmpm[MP_MAX_PROCESSORS];
F64 y_total,old_y_total=MAX_F64;
I64 i,w=Fs->pix_width,h=Fs->pix_height,cx=w/2,cy=h/2;
CDC *dc=DCAlias;
while (TRUE) {
for (i=0;i<mp_cnt;i++)
tempm[i]=JobQue(&MPDraw,Fs,i,0);
tmpm[i]=JobQue(&MPDraw,Fs,i,0);
y_total=0;
for (i=0;i<mp_cnt;i++)
y_total+=JobResGet(tempm[i])(F64);
y_total+=JobResGet(tmpm[i])(F64);
if (!y_total) break;
scale*=7*GR_WIDTH*GR_HEIGHT/y_total;
@@ -95,13 +95,13 @@ U0 Draw()
U0 PoleZeros()
{
I64 msg_code,a1,a2,p11,p22,cx,cy;
Complex *tempc=NULL;
Complex *tmpc=NULL;
PopUpOk(
"Drag the poles and zeros with left mouse.\n"
"Hold right mouse for phase plot.\n"
);
WinMgrSync;
Refresh;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
@@ -125,10 +125,10 @@ pz_msg:
cy=Fs->pix_height/2;
switch (msg_code) {
case MSG_IP_L_DOWN:
tempc=PoleZeroFind(a1-cx,cy-a2);
tmpc=PoleZeroFind(a1-cx,cy-a2);
break;
case MSG_IP_MOVE:
if (tempc) {
if (tmpc) {
p11=a1;p22=a2;
//get to last mouse move
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
@@ -139,16 +139,16 @@ pz_msg:
} else
goto pz_msg;
tempc->x=p11-cx;
tempc->y=cy-p22;
tmpc->x=p11-cx;
tmpc->y=cy-p22;
Draw;
}
break;
case MSG_IP_L_UP:
if (tempc) {
tempc->x=a1-cx;
tempc->y=cy-a2;
tempc=NULL;
if (tmpc) {
tmpc->x=a1-cx;
tmpc->y=cy-a2;
tmpc=NULL;
Draw;
}
break;
@@ -160,7 +160,7 @@ pz_msg:
if (a1==CH_SHIFT_ESC||a1==CH_ESC)
goto pz_done;
}
WinMgrSync;
Refresh;
}
pz_done:
GetMsg(,,1<<MSG_KEY_UP);
+1 -1
View File
@@ -59,7 +59,7 @@ U0 PredatorPrey()
WinBorder;
WinMax;
DocClear;
WinMgrSync;
Refresh;
dc->color=BLACK;
GrLine(dc,OX,0,OX,GR_HEIGHT-FONT_HEIGHT-1);
Binary file not shown.
@@ -1,9 +1,9 @@
//See $LK,"::/Demo/Games/Stadium/StadiumGen.HC"$.
U0 ViewScreenCapture(U8 *filename)
U0 ViewScrnCapture(U8 *filename)
{
CDC *dc=DCAlias(,Fs),
*dc2=GRARead(filename);
*dc2=GRRead(filename);
GrBlot(dc,0,0,dc2);
DCDel(dc2);
DCDel(dc);
@@ -11,13 +11,13 @@ U0 ViewScreenCapture(U8 *filename)
U0 Main()
{
"Capture screen...\n";
"Capture scrn...\n";
PressAKey;
GRAScreenCapture("~/DemoScreenShot");
GRScrnCapture("~/DemoScrnShot");
"View captured screen...\n";
"View captured scrn...\n";
PressAKey;
ViewScreenCapture("~/DemoScreenShot");
ViewScrnCapture("~/DemoScrnShot");
PressAKey;
DCFill;
Binary file not shown.
+1 -3
View File
@@ -15,9 +15,7 @@ public U0 SpeedLineDemo()
DocClear;
DCFill;
do {
msg_code=GetMsg(&a1,&a2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
1<<MSG_IP_R_UP);
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_UP);
switch (msg_code) {
case MSG_IP_R_UP:
color=PopUpColor;
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -5,7 +5,7 @@ $$IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$$
That imports an external sprite. It's
called a $LK,"DOCEF_BIN_PTR_LINK",A="MN:DOCEF_BIN_PTR_LINK"$. See $LK,"BP=\"\"",A="FF:::/Doc/DolDocOverview.DD,BP=\"\""$.
Press <CTRL-r> and "pointer to sprite".
Press <CTRL-r> and "Ptr to Sprite".
Then, enter a file and the number of
the sprite in the file. Note: the
number can get messed-up if you change
@@ -19,7 +19,7 @@ U0 SpritePutExt()
for (i=0;i<3;i++) {
"US Map:";
Sprite($IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$);
"%h12c",'\n';
"%h12c",'\n'; //"h" is a secondary arg. $LK,"Print",A="FI:::/Doc/Print.DD"$ 12 newline chars.
}
}
Binary file not shown.
+1 -1
View File
@@ -33,7 +33,7 @@ U0 SunMoon()
gr.dc->dither_probability_u16=2*i; //U16 can be [0,65535]
GrFloodFill(gr.dc,x-0.75*radius,y);
WinMgrSync; //Typically 30 fps
Refresh; //Typically 30 fps
DCFill;
}
Binary file not shown.
@@ -1,7 +1,7 @@
/* To run this, do a directory, right click on
this file's name and sel "AutoFile".
Or, type $LK,"AutoFile",A="MN:AutoFile"$(filename);
See $LK,"AutoFile",A="FF:::/Doc/Glossary.DD,AutoFile"$ in the glossary for more info.
this file's name and sel "InFile".
Or, type $LK,"InFile",A="MN:InFile"$(filename);
See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info.
*/
I64 i;
@@ -99,7 +99,7 @@
#define IC_JMP 0x52
#define IC_SWITCH 0x53
#define IC_NOBOUND_SWITCH 0x54
#define IC_NOBOUND_SWITCH 0x54
#define IC_ADD_RSP 0x55
#define IC_ADD_RSP1 0xC1
@@ -1,17 +1,17 @@
/* To run this, do a directory, right click on
this file's name and sel "AutoFile".
Or, type $LK,"AutoFile",A="MN:AutoFile"$(filename);
See $LK,"AutoFile",A="FF:::/Doc/Glossary.DD,AutoFile"$ in the glossary for more info.
this file's name and sel "InFile".
Or, type $LK,"InFile",A="MN:InFile"$(filename);
See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info.
This autofile will renum the defines in
AFEd.DD.Z. Test it by numbering a few wrong
This InFile will renum the defines in
INEd.DD.Z. Test it by numbering a few wrong
and running this demo.
*/
U8 i;
"Ed(\"AFEd.DD.Z\");\n";
"Ed(\"INEd.DD.Z\");\n";
//Go to start of file
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
for (i=0;i<=0xC3;i++) {
+12
View File
@@ -0,0 +1,12 @@
/* This is not an InFile. It uses $LK,"InStr",A="MN:InStr"$
to run text as though from an InFile.
This example shows how you can drive pop-up
windows.
*/
In(" ");
"PopUp #1:%X\n",PopUpNoYes;
InStr("Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);'' CH_SPACE;");
"PopUp #2:%X\n",PopUpNoYes;
File renamed without changes.
+11
View File
@@ -0,0 +1,11 @@
/* To run this, do a directory, right click on
this file's name and sel "InFile".
Or, type $LK,"InFile",A="MN:InFile"$(filename);
See $LK,"InFile",A="FF:::/Doc/Glossary.DD,InFile"$ in the glossary for more info.
Profiling does not $UL,1$require$UL,0$ InFiles.
*/
"$$RED$$Prof;$$FG$$\n";
"$$RED$$//Collecting Data$$FG$$";
PressAKey;
"\n$$RED$$ProfRep;$$FG$$\n";
@@ -1,13 +1,13 @@
U0 AFSetIPDemo()
U0 INSetIPDemo()
{
I64 t,l;
WinBorder(ON);
l=Fs->pix_left+Fs->scroll_x;
t=Fs->pix_top+Fs->scroll_y;
IPSet(,,,FALSE,FALSE); //Mouse unclicked
AFSetIP(,l-4,t-4);
AFSetIP(20,l+20,t+20,,TRUE);
InSetIP(,l-4,t-4);
InSetIP(20,l+20,t+20,,TRUE);
IPSet(,,,FALSE,FALSE);
}
AFSetIPDemo;
INSetIPDemo;
+1 -1
View File
@@ -74,7 +74,7 @@ ANSWERS:
7) You can access the lowest byte of any reg. You can access AH but not the second-to-lowest byte of ESI.
8) To call a subroutine farther than 2 Gig away, you put the address into RAX, then CALL RAX.
8) To call a subroutine farther than 2Gig away, you put the address into RAX, then CALL RAX.
9) CALL REL32 is significantly faster. See $LK,"::/Demo/Lectures/InterruptDemo.HC"$.
+3 -3
View File
@@ -5,7 +5,7 @@
U0 TimeIns()
{
I64 start1,end1,start2,end2,overhead_time,test_time;
I64 reg i,reg temp;
I64 reg i,reg tmp;
CPURep;
@@ -19,7 +19,7 @@ U0 TimeIns()
//Measure remainder...
start2=GetTSC;
for (i=0;i<SAMPLE_SIZE;i++)
temp=i%0x400;
tmp=i%0x400;
end2=GetTSC;
test_time=end2-start2;
"Remainder Version #1 Cycles\t: %10.5f\n",
@@ -28,7 +28,7 @@ U0 TimeIns()
//Measure remainder...
start2=GetTSC;
for (i=0;i<SAMPLE_SIZE;i++)
temp=i&0x3FF;
tmp=i&0x3FF;
end2=GetTSC;
test_time=end2-start2;
"Remainder Version #2 Cycles\t: %10.5f\n",
+16 -18
View File
@@ -6,8 +6,7 @@ instead of dollars with a float.
Fixed-point used to be much $TX,"faster",HTML="http://en.wikipedia.org/wiki/X87"$,
but modern processors do well with
floats. It also depends on the compiler
and my compiler used to do floats poorly.
It's a little better.
and my compiler is poor with floats.
I often use 64-bit ints with upper 32-bits
as int and lower 32-bits as fraction.
@@ -17,7 +16,6 @@ to access upper or lower 32-bits.
For a complete lst of nonstandard compiler
features, see $LK,"::/Doc/HolyC.DD"$.
*/
U0 Main()
@@ -29,23 +27,23 @@ U0 Main()
t0=tS;
for (i=1000000000;i;i--)
i_sum+=i_val;
"Int Sum:%.9f Time:%7.3fs\n",i_sum/ToF64(0x100000000),tS-t0;
"Int Sum\t\t:%.9f Time:%7.3fs\n",i_sum/ToF64(0x100000000),tS-t0;
f_val= 2.0000002;
t0=tS;
for (i=1000000000;i;i--)
f_sum+=f_val;
"Float Sum:%.9f Time:%7.3fs\n",f_sum,tS-t0;
"Float Sum\t:%.9f Time:%7.3fs\n",f_sum,tS-t0;
'\n';
}
U0 DoIt2()
{
I64 i=0x123456789ABCDEF0;
"i =%X\n",i;
"i\t\t=%X\n",i;
"i&0xFFFFFFFF=%X\n",i&0xFFFFFFFF;
"i>>32 =%X\n",i>>32;
"i&0xFFFFFFFF\t=%X\n",i&0xFFFFFFFF;
"i>>32\t\t=%X\n",i>>32;
/* Standard int types are declared
with a special compiler feature which
@@ -74,8 +72,8 @@ For a complete lst of nonstandard compiler
features, see $LK,"::/Doc/HolyC.DD"$.
*/
"i.u32[0] =%X\n",i.u32[0];
"i.u32[1] =%X\n",i.u32[1];
"i.u32[0]\t=%X\n",i.u32[0];
"i.u32[1]\t=%X\n",i.u32[1];
}
CPURep;
@@ -86,13 +84,13 @@ DoIt2;
/*Program Output$HL,0$$WW+H,1$$FD,1$
8 Cores 2.660GHz
Int Sum:2000000199.768689408 Time: 0.787s
Float Sum:2000000225.656126208 Time: 3.918s
$FG$$BG$16 Cores 3.500GHz
Int Sum :2000000199.768690240 Time: 0.803s
Float Sum :2000000225.656127040 Time: 3.615s
i =123456789ABCDEF0
i&0xFFFFFFFF=9ABCDEF0
i>>32 =12345678
i.u32[0] =9ABCDEF0
i.u32[1] =12345678
i =123456789ABCDEF0
i&0xFFFFFFFF =9ABCDEF0
i>>32 =12345678
i.u32[0] =9ABCDEF0
i.u32[1] =12345678
$HL,1$*/
+6 -6
View File
@@ -3,18 +3,18 @@ that are scaled by a value. A common
example would be using number of pennies
instead of dollars with a float.
Fixed-point used to be much faster,
Fixed-point used to be much $TX,"faster",HTML="http://en.wikipedia.org/wiki/X87"$,
but modern processors do well with
floats. It also depends on the compiler
and my compiler used to do floats poorly.
and my compiler is poor with floats.
I often use 64-bit ints with upper 32-bits
as int and lower 32-bits as fraction.
See $LK,"::/Demo/SubIntAccess.HC"$ for how
to access upper or lower 32-bits.
*/
#define SAMPLE_SIZE 10000000
I32 coordinates[65536];
@@ -77,7 +77,7 @@ U0 Main()
{
I64 start,end,overhead_time,test_time;
F64 d1,fsum;
I64 reg i,temp,reg d2,reg sum;
I64 reg i,tmp,reg d2,reg sum;
CPURep;
@@ -113,8 +113,8 @@ U0 Main()
sum=0;
start=GetTSC;
for (i=SAMPLE_SIZE-1;i>=0;i--) {
temp=d2*coordinates[i&65535];
sum+=temp.i32[1];
tmp=d2*coordinates[i&65535];
sum+=tmp.i32[1];
}
end=GetTSC;
test_time=end-start;
+2 -2
View File
@@ -1,4 +1,4 @@
//This is the fastest you can update the whole screen.
//This is the fastest you can update the whole scrn.
//See $LK,"::/Demo/Lectures/MiniGrLib.HC"$ if this interests you.
F64 VGAPattern(I64 p)
@@ -27,7 +27,7 @@ U0 GrDemo()
"$$GREEN$$Rate:$$RED$$%5.1f FPS$$FG$$"
" $$GREEN$$Load@30Hz:$$RED$$%5.1f%%$$FG$$\n",1/t,100*t*30.0;
}
//<CTRL-ALT-v> will flush screen VGA cache.
//<CTRL-ALT-v> will flush scrn VGA cache.
VGAFlush;
}
-202
View File
@@ -1,202 +0,0 @@
//This file is required by $LK,"::/Demo/Lectures/Mem/Uncached.HC"$.
U8 *Mem2MegAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
(Linking to a task means they will be freed when the task dies.)
It might give you more than you asked for
so a ptr to a page count is passed.
Return: NULL if out of memory.
*/
I64 i,j,*pte,num=*_pages2Meg;
CMemBlk *res=NULL,*m,*m1;
if (!bp) bp=sys_code_bp;
PUSHFD
CLI
while (LBts(&bp->locked_flags,BPlf_LOCKED))
PAUSE
num<<=21-MEM_PAGE_BITS;
m=&bp->mem_free_2meg_lst;
while (TRUE) {
if (!(res=m->next))
break;
if (res->pages<num)
m=res;
else {
if (res->pages==num) {
m->next=res->next;
goto am_done;
} else {
res->pages-=num;
res(U8 *)+=res->pages<<MEM_PAGE_BITS;
res->pages=num;
goto am_done;
}
}
}
m=&bp->mem_free_lst;
while (TRUE) {
if (!(res=m->next)) {
num=0;
res=NULL; //Out of memory
goto am_done;
}
if (res->pages<num)
m=res;
else {
if (res->pages==num) {
if (res(U8 *)&0x1FFFFF)
m=res;
else {
m->next=res->next;
goto am_done;
}
} else {
if (i=(res(U8 *)&0x1FFFFF)>>MEM_PAGE_BITS) {
j=1<<(21-MEM_PAGE_BITS)-i;
if (res->pages<num+j)
m=res;
else if (res->pages==num+j) {
res->pages-=num;
res(U8 *)+=res->pages<<MEM_PAGE_BITS;
res->pages=num;
goto am_done;
} else {
m1=res;
res(U8 *)+=j<<MEM_PAGE_BITS;
res->pages=num;
m=res(U8 *)+num<<MEM_PAGE_BITS;
m->pages=m1->pages-num-j;
m1->pages=j;
m->next=m1->next;
m1->next=m;
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
goto am_done;
}
} else {
m=m->next=res(U8 *)+num<<MEM_PAGE_BITS;
m->next=res->next;
m->pages=res->pages-num;
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
res->pages=num;
goto am_done;
}
}
}
}
am_done:
i=num<<MEM_PAGE_BITS;
bp->used_u8s+=i;
num>>=21-MEM_PAGE_BITS;
*_pages2Meg=num;
m=res;
m1=m(U8 *)+i;
while (m<m1) {
pte=MemPageTable(m);
*pte &= ~0x18;
InvlPg(m);
m(U8 *)+=0x200000;
}
LBtr(&bp->locked_flags,BPlf_LOCKED);
POPFD
return res;
}
U8 *Mem2MegUncachedAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
(Linking to a task means they will be freed when the task dies.)
It will be marked uncached. It might give you more than you asked for
so a ptr to a page count is passed.
Return: NULL if out of memory.
*/
CMemBlk *res,*m,*m1;
I64 num=*_pages2Meg,*pte;
if (res=Mem2MegAlloc(_pages2Meg,bp)) {
num=*_pages2Meg;
m=res;
m1=m(U8 *)+num<<21;
while (m<m1) {
pte=MemPageTable(m);
*pte= *pte& ~0x18 |0x10;
InvlPg(m);
m(U8 *)+=0x200000;
}
}
return res;
}
U8 *Mem2MegWriteThruAlloc(I64 *_pages2Meg,CBlkPool *bp=NULL)
{/*Alloc 2Meg pages from BlkPool. Don't link to task.
(Linking to a task means they will be freed when the task dies.)
It will be marked write-through. It might give you more than you asked for
so a ptr to a page count is passed.
Return: NULL if out of memory.
*/
CMemBlk *res,*m,*m1;
I64 num=*_pages2Meg,*pte;
if (res=Mem2MegAlloc(_pages2Meg,bp)) {
num=*_pages2Meg;
m=res;
m1=m(U8 *)+num<<21;
while (m<m1) {
pte=MemPageTable(m);
*pte= *pte& ~0x18 |8;
InvlPg(m);
m(U8 *)+=0x200000;
}
}
return res;
}
U0 Mem2MegFree(CMemBlk *m,I64 pages2Meg,CBlkPool *bp=NULL)
{//Return non-task 2Meg pages to BlkPool.
I64 *pte;
CMemBlk *m1,*m2;
if (m) {
if (!bp) bp=sys_code_bp;
m2=m;
m1=m(U8 *)+pages2Meg<<21;
while (m2<m1) {
pte=MemPageTable(m2);
*pte=*pte & ~0x18;
InvlPg(m2);
m2(U8 *)+=0x200000;
}
PUSHFD
CLI
while (LBts(&bp->locked_flags,BPlf_LOCKED))
PAUSE
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
m->pages=pages2Meg<<(21-MEM_PAGE_BITS);
bp->used_u8s-=pages2Meg<<21;
m->next=bp->mem_free_2meg_lst;
bp->mem_free_2meg_lst=m;
LBtr(&bp->locked_flags,BPlf_LOCKED);
POPFD
}
}
CHeapCtrl *HeapCtrlBPInit(CBlkPool *bp,I64 pages512)
{//Make mem chunk into HeapCtrl and BlkPool.
I64 num;
CMemBlk *m;
CHeapCtrl *hc;
MemSet(bp,0,sizeof(CBlkPool)+sizeof(CHeapCtrl));
hc=HeapCtrlInit(bp(U8 *)+sizeof(CBlkPool),,bp);
m=(bp(U8 *)+sizeof(CBlkPool)+sizeof(CHeapCtrl)+MEM_PAGE_SIZE-1)&
~(MEM_PAGE_SIZE-1);
num=(bp(U8 *)+pages512<<MEM_PAGE_BITS-m(U8 *))>>MEM_PAGE_BITS;
bp->alloced_u8s=(pages512-num)<<MEM_PAGE_BITS;
BlkPoolAdd(bp,m,num);
return hc;
}
/* PCI hardware devices, when they require uncached memory buffers, need
this code. TempleOS, however, has a law requiring only IN/OUT port hardware
access except VGA, handled here: $LK,"::/Kernel/Mem/PageTables.HC"$.
*/
-37
View File
@@ -1,37 +0,0 @@
I64 *addr=text.vga_alias,
*pte_addr=MemPageTable(addr),
err_code=0,
*reported_fault_addr;
/*
0[RBP]=old base ptr
8[RBP]=err code
16[RBP]=RIP
24[RBP]=RIP_SELECTOR
32[RBP]=RFLAGS
40[RBP]=RSP
48[RBP]=STK_SELECTOR
*/
interrupt haserrcode U0 IntPageFault()
{
I64 reg *rbp=GetRBP;
*pte_addr|=1;
InvlPg(addr);
err_code=rbp[1];
MOV_RAX_CR2
reported_fault_addr=GetRAX;
}
U0 PageTableDemo()
{
U8 *old_idte=IntEntrySet(I_PAGE_FAULT,&IntPageFault,IDTET_IRQ);
err_code=0;
*pte_addr &=~1; //Not present
InvlPg(addr);
WinMgrSync; //wait for VGA update
WinMgrSync;
IntEntrySet(I_PAGE_FAULT,old_idte,IDTET_IRQ);
"Err Code:%X Addr:%X\n",err_code,reported_fault_addr;
}
PageTableDemo;
-46
View File
@@ -1,46 +0,0 @@
// Requires $LK,"::/Demo/Lectures/Mem/Mem2Meg.HC"$.
Cd(__DIR__);;
#include "Mem2Meg"
#define SAMPLE_SIZE 100000
U0 TimeIns()
{
I64 i,start,end;
I64 *cached_I64=MAlloc(sizeof(I64)),
shared_blks,*uncached_I64;
CBlkPool *bp;
CHeapCtrl *hc;
"$$RED$$Now, this demo seems broken, perhaps,\n"
"because I run in a virtual machine.$$FG$$\n\n";
CPURep;
shared_blks=1;
bp=Mem2MegUncachedAlloc(&shared_blks);
hc=HeapCtrlBPInit(bp,shared_blks<<12);
uncached_I64=MAlloc(sizeof(I64),hc);
//Measure cached time
start=GetTSC;
for (i=0;i<SAMPLE_SIZE;i++)
*cached_I64=i;
end=GetTSC;
" Cached Cycles: %10,d\n",end-start;
//Measure uncached time
start=GetTSC;
for (i=0;i<SAMPLE_SIZE;i++)
*uncached_I64=i;
end=GetTSC;
"Uncached Cycles: %10,d\n",end-start;
"$$GREEN$$The difference is even greater\n"
"because the loop overhead was not subtracted.$$FG$$\n\n";
Free(cached_I64);
Free(uncached_I64);
Mem2MegFree(bp,shared_blks);
}
TimeIns;
+2 -2
View File
@@ -8,7 +8,7 @@ The main compiler optimizes See $LK,"Intermediate Code Attributes",A="MN:inter
The main compiler makes machine code in the back end. See $LK,"IC Struct",A="MN:CIntermediateCode"$, $LK,"COCCompile",A="MN:COCCompile"$ and $LK,"OptPass789A",A="FF:::/Compiler/OptPass789A.HC,IC_MUL"$(), $LK,"BackEnd",A="FF:::/Compiler/BackA.HC,ICMul"$. Set $LK,"Trace",A="MN:Trace"$(ON) to see the output of the backend.
$ID,-2$
$TR,"Mini Compiler"$
$TR-C,"Mini Compiler"$
$ID,2$For this mini compiler, some things you should know about 64-bit asm:
* Putting a 0x48, known as the REX byte, in front of an inst makes it 64-bit size.
@@ -98,7 +98,7 @@ U0 PrsTerm(U8 **_src,U8 **_dst,I64 prec)
src2=*_src;
dst2=*_dst;
while (TRUE) {
//This is inefficient. The main compiler doesn't back-up.
//This is inefficient. The main compiler doesn't back-up like this.
i=Parse(&src2,&dst2);
if (PREC_MUL<=i<prec) {
*_src=src2;
+3 -3
View File
@@ -119,14 +119,14 @@ U0 MiniGrLibDemo()
We are returning graphics to normal operations under TempleOS.
It is not normal to by-pass the TempleOS graphcis routines.
The TempleOS graphics don't know VGA has changed.
This bit tells TempleOS to update whole screen.
This bit tells TempleOS to update whole scrn.
*/
//<CTRL-ALT-v> will flush screen VGA cache.
//<CTRL-ALT-v> will flush scrn VGA cache.
VGAFlush;
}
MiniGrLibDemo;
//See $LK,"RawPutChar",A="MN:RawPutChar"$() for text.
//See $LK,"::/Demo/Lectures/ScreenMemory.HC"$ for color.
//See $LK,"::/Demo/Lectures/ScrnMemory.HC"$ for color.
//See $LK,"::/Demo/Lectures/GraphicsCPULoad.HC"$.
@@ -1,9 +1,9 @@
//This just shows how screen memory works.
//This just shows how scrn memory works.
//See $LK,"::/Demo/Lectures/MiniGrLib.HC"$
U0 PlotXY(I64 x,I64 y)
{
//Screen bits are revd
//Scrn bits are revd
LBts(text.vga_alias,y*GR_WIDTH+x^7);
}
@@ -37,9 +37,9 @@ That means no read-modify-writes, too.
*/
BusyWait(4000000);
//TempleOS has a 4 plane memory duplicate of the screen, $LK,"gr.screen_image",A="MN:CGrGlbls"$,
//TempleOS has a 4 plane memory duplicate of the scrn, $LK,"gr.scrn_image",A="MN:CGrGlbls"$,
//and only writes actual changes. See $LK,"GrUpdateVGAGraphics",A="MN:GrUpdateVGAGraphics"$().
//<CTRL-ALT-v> will flush screen VGA cache.
//<CTRL-ALT-v> will flush scrn VGA cache.
VGAFlush;
}
+2 -2
View File
@@ -88,7 +88,7 @@ U0 AnimateTask(I64)
Cloud *c;
CloudPen *cp;
while (TRUE) {
WinMgrSync;
Refresh;
for (i=0,cp=cloud_pens;i<CLOUD_PENS;i++,cp++) {
DCClear(cp->img);
@@ -193,7 +193,7 @@ U0 CloudScene()
Fs->draw_it=&DrawIt;
GetChar;
WinMgrSync;
Refresh;
} catch
PutExcept;
SettingsPop;
+10 -10
View File
@@ -20,12 +20,12 @@ U0 MPUnlockedInc(I64)
U0 UnlockedInc()
{
CSrvCmd *tempm0,*tempm1;
CSrvCmd *tmpm0,*tmpm1;
glbl=0;
tempm0=JobQue(&MPUnlockedInc,NULL,0,0);
tempm1=JobQue(&MPUnlockedInc,NULL,1,0);
JobResGet(tempm0);
JobResGet(tempm1);
tmpm0=JobQue(&MPUnlockedInc,NULL,0,0);
tmpm1=JobQue(&MPUnlockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
}
@@ -39,12 +39,12 @@ U0 MPLockedInc(I64)
U0 LockedInc()
{
CSrvCmd *tempm0,*tempm1;
CSrvCmd *tmpm0,*tmpm1;
glbl=0;
tempm0=JobQue(&MPLockedInc,NULL,0,0);
tempm1=JobQue(&MPLockedInc,NULL,1,0);
JobResGet(tempm0);
JobResGet(tempm1);
tmpm0=JobQue(&MPLockedInc,NULL,0,0);
tmpm1=JobQue(&MPLockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Cnt:%X Actual Cnt:%X\n",CNT*2,glbl;
}
+3 -3
View File
@@ -12,13 +12,13 @@ I64 MPSum(I64 my_mp_cnt)
I64 Sum(I64 n,I64 my_mp_cnt)
{
CSrvCmd *tempm[MP_MAX_PROCESSORS];
CSrvCmd *tmpm[MP_MAX_PROCESSORS];
I64 res=0,i;
mp_n=n+1;
for (i=0;i<my_mp_cnt;i++)
tempm[i]=JobQue(&MPSum,my_mp_cnt,i,0);
tmpm[i]=JobQue(&MPSum,my_mp_cnt,i,0);
for (i=0;i<my_mp_cnt;i++)
res+=JobResGet(tempm[i]);
res+=JobResGet(tmpm[i]);
return res;
}
+1 -1
View File
@@ -4,7 +4,7 @@ U8 char_map[26]="22233344455566677778889999";
Fmt of word lst entry:
U8 ACD_WORD_CHAR
U8 word[] with terminating zero
I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DAT
I16 block; //definition offset in ::/Adam/AutoComplete/ACDefs.DATA
*/
U0 PhoneNumWords(U8 *num)
{
Loaded 100 of 381 files, more files were not shown because too many files have changed in this diff. Show more