LTCD_060719.ISO
This commit is contained in:
commit
f86e69648b
156 files changed
+49537
No files matched your search
@@ -0,0 +1,15 @@
|
||||
/* To run this, do a directory, right click on
|
||||
this file's name and select "AutoFile".
|
||||
Or, type $LK,"AutoFile","MN:AutoFile"$(filename);
|
||||
See $LK,"AutoFile","FF:::/LT/DOC/OSGlossary.GLZ,AutoFile"$ in the glossary for more info.
|
||||
*/
|
||||
|
||||
|
||||
//This is to demo autofiles.
|
||||
I4 i;
|
||||
for (i=0;i<3;i++)
|
||||
PutS("Dir;\r");
|
||||
PutS("$$FG RED$$//Press a letter to complete the mask$$FG$$\r");
|
||||
PutS("Dir(\"*.");
|
||||
I1 ch=GetKey; //Prompt for first digit of mask
|
||||
PrintF("%c*\");\r",ch);
|
||||
@@ -0,0 +1,9 @@
|
||||
/* To run this, do a directory, right click on
|
||||
this file's name and select "AutoFile".
|
||||
Or, type $LK,"AutoFile","MN:AutoFile"$(filename);
|
||||
See $LK,"AutoFile","FF:::/LT/DOC/OSGlossary.GLZ,AutoFile"$ in the glossary for more info.
|
||||
*/
|
||||
PutS("$$FG RED$$Prof(&GrUpdateScreen,0x2000);$$FG$$\r");
|
||||
PutS("$$FG RED$$//Collecting Data, Press A Key$$FG$$");
|
||||
GetKey;
|
||||
PutS("\r$$FG RED$$ProfRep;$$FG$$\r");
|
||||
@@ -0,0 +1,26 @@
|
||||
/* To run this, do a directory, right click on
|
||||
this file's name and select "AutoFile".
|
||||
Or, type $LK,"AutoFile","MN:AutoFile"$(filename);
|
||||
See $LK,"AutoFile","FF:::/LT/DOC/OSGlossary.GLZ,AutoFile"$ in the glossary for more info.
|
||||
|
||||
This autofile will renumber the defines in
|
||||
Demo3.TXZ. Test it by numbering a few wrong
|
||||
and running this demo.
|
||||
|
||||
*/
|
||||
|
||||
U1 i;
|
||||
|
||||
PutS("Edit(\"Demo3.TXZ\");\r");
|
||||
//Go to start of file
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
|
||||
for (i=0;i<=0xD6;i++) {
|
||||
PrintF("%c0x%c",6,CH_ESC); //ctrl F
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
|
||||
PrintF("%02X",i);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
|
||||
Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);
|
||||
PrintF("%c%c",CH_BACKSPACE,CH_BACKSPACE);
|
||||
Sleep(5);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
/* This is not an AutoFile. It uses $LK,"AutoString","MN:AutoString"$
|
||||
to run text as though from an AutoFile.
|
||||
|
||||
This example shows how you can drive pop-up
|
||||
windows.
|
||||
*/
|
||||
|
||||
Auto(" ");
|
||||
coutln "PopUp #1:",PopUpNoYes;
|
||||
|
||||
AutoString("Msg(MSG_KEY_DOWN,0,SC_CURSOR_RIGHT);PutChar(CH_SPACE);");
|
||||
coutln "PopUp #2:",PopUpNoYes;
|
||||
@@ -0,0 +1,23 @@
|
||||
void Lowest(U8 i)
|
||||
{
|
||||
PrintF("%d,%P %P\r\n",i,Caller,CallerCaller);
|
||||
}
|
||||
|
||||
void Mid1()
|
||||
{
|
||||
Lowest(1);
|
||||
}
|
||||
|
||||
void Mid2()
|
||||
{
|
||||
Lowest(2);
|
||||
}
|
||||
|
||||
void Top()
|
||||
{
|
||||
Mid1;
|
||||
Mid2;
|
||||
Lowest(3);
|
||||
}
|
||||
|
||||
Top;
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
// COM port Terminal
|
||||
void CommTerm(U4 port=1,U4 baud=9600)
|
||||
{
|
||||
U8 sc;
|
||||
U8 ch=0;
|
||||
coutln "ESC to exit";
|
||||
CommOpen8N1(port,baud);
|
||||
while (ch!=CH_ESC) {
|
||||
if (CommScanChar(port,&ch))
|
||||
PutChar(ch);
|
||||
ch=0;
|
||||
if (ScanChar(&sc,&ch))
|
||||
CommPutChar(port,ch);
|
||||
SwapInNext;
|
||||
}
|
||||
CommClose(port);
|
||||
}
|
||||
|
||||
CommTerm;
|
||||
@@ -0,0 +1,9 @@
|
||||
LTDate d=GetCurTimeLTDate;
|
||||
|
||||
I4 i;
|
||||
for (i=0;i<48;i++)
|
||||
PrintF("%%h%dD:%h*D\r\n",i,i,d.date);
|
||||
CrLf;
|
||||
for (i=0;i<20;i++)
|
||||
PrintF("%%h%dT:%h*T\r\n",i,i,d);
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
//This program does a fractel-like thing with
|
||||
//integer arithmetic, since floating is not
|
||||
//supported.
|
||||
|
||||
class Simplex
|
||||
{
|
||||
U8 x,y;
|
||||
};
|
||||
|
||||
void Norm(U4 *lo,U4 *hi,Simplex *n1)
|
||||
{
|
||||
U8 result=n1->x+n1->y;
|
||||
*lo=result.u4[0];
|
||||
*hi=result.u4[1];
|
||||
}
|
||||
|
||||
Simplex *CopySimplex(Simplex *dst, Simplex *src)
|
||||
{
|
||||
MemCpy(dst,src,sizeof(Simplex));
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
Simplex *Mix(Simplex *result,Simplex *n1,Simplex *n2)
|
||||
{
|
||||
result->x=MulU8(n1->x,n2->x);
|
||||
result->y=MulU8(n1->y,n2->y);
|
||||
return result;
|
||||
}
|
||||
|
||||
Simplex *Mangle(Simplex *result,Simplex *n1,Simplex *n2)
|
||||
{
|
||||
result->x=MulU8(n1->x,n2->y);
|
||||
result->y=MulU8(n1->y,n2->x);
|
||||
return result;
|
||||
}
|
||||
|
||||
Simplex *Add(Simplex *result,Simplex *n1,Simplex *n2)
|
||||
{
|
||||
result->x=n1->x+n2->x;
|
||||
result->y=n1->y+n2->y;
|
||||
return result;
|
||||
}
|
||||
|
||||
Simplex *Sub(Simplex *result,Simplex *n1,Simplex *n2)
|
||||
{
|
||||
result->x=n1->x-n2->x;
|
||||
result->y=n1->y-n2->y;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void DrawIt()
|
||||
{
|
||||
U1 old_attr=Fs->text_attribute;
|
||||
Fs->text_attribute=(BLACK<<4)+WHITE;
|
||||
ClearWindowText;
|
||||
Fs->text_attribute=old_attr;
|
||||
}
|
||||
|
||||
|
||||
void BigDawg()
|
||||
{
|
||||
U4 old_update,d_lo,d_hi;
|
||||
U8 sc,ch;
|
||||
I4 i,j,k,cnt;
|
||||
Simplex n1,n2,n3,n4,n5,n6,n7,n8;
|
||||
U4 in_color,key_hit;
|
||||
U8 timeout_jiffies;
|
||||
GrBitMap *base=GrNew(grbase);
|
||||
|
||||
old_update=Fs->update_window;
|
||||
Fs->update_window=&DrawIt;
|
||||
|
||||
MaximizeWindow;
|
||||
GrClear;
|
||||
do {
|
||||
n2.x=RandU4;
|
||||
SwapInNext;
|
||||
n2.y=RandU4;
|
||||
cnt=RandU4;
|
||||
SwapInNext;
|
||||
|
||||
n8.x=RandU4;
|
||||
SwapInNext;
|
||||
n8.y=RandU4;
|
||||
SwapInNext;
|
||||
|
||||
in_color=RandU2 & 1;
|
||||
|
||||
key_hit=FALSE;
|
||||
timeout_jiffies=jiffies+JIFFY_FREQ/8;
|
||||
for (j=0;j<grheight;j++) {
|
||||
if (jiffies>timeout_jiffies && j<20) {
|
||||
key_hit=TRUE;
|
||||
ch=0;
|
||||
break;
|
||||
}
|
||||
if (ScanChar(&sc,&ch)) {
|
||||
key_hit=TRUE;
|
||||
break;
|
||||
}
|
||||
for (i=0;i<grwidth;i++) {
|
||||
if (jiffies>timeout_jiffies && j<20) {
|
||||
key_hit=TRUE;
|
||||
ch=0;
|
||||
break;
|
||||
}
|
||||
n1.x.u4[0]=i;
|
||||
n1.y.u4[0]=j;
|
||||
n1.x.u4[1]=0;
|
||||
n1.y.u4[1]=0;
|
||||
CopySimplex(&n3,&n1);
|
||||
|
||||
k=0;
|
||||
Norm(&d_lo,&d_hi,&n3);
|
||||
while (d_lo<cnt && k<0x100) {
|
||||
if (jiffies>timeout_jiffies && j<20) {
|
||||
key_hit=TRUE;
|
||||
ch=0;
|
||||
break;
|
||||
}
|
||||
Mangle(&n7,Mix(&n4,&n3,&n1),
|
||||
Add(&n5,&n3,&n2));
|
||||
k++;
|
||||
Norm(&d_lo,&d_hi,
|
||||
Add(&n3,&n7,Mangle(&n6,&n3,&n8)));
|
||||
}
|
||||
if (!in_color)
|
||||
k=(k!=1)?15:0;
|
||||
base->color=ROP_EQU+k;
|
||||
GrPlot(base,i,j);
|
||||
}
|
||||
SwapInNext;
|
||||
}
|
||||
|
||||
if (!key_hit)
|
||||
ch=GetChar;
|
||||
GrClear;
|
||||
} while (ch!=CH_ESC && ch!=CH_CTRLQ);
|
||||
Fs->update_window=old_update;
|
||||
GrDel(base);
|
||||
}
|
||||
|
||||
BigDawg; //Autostart when included
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
$HD,5$$FO,5$$LM,0$$RM,28$$WW,1$This is page 1.This is page 2.
|
||||
This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc.
|
||||
This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc.$RM,58$$LM,32$$CM+LX+TY+PRY+MRX,0,5,,$ This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc.
|
||||
This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc.$LM,0$ This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc. This is a demo doc.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
GrBitMap *b=GrNew(grbase);
|
||||
GrBitMap *img1=GrBitMapNew(BMT_MONO,128,128);
|
||||
GrBitMap *img2=GrBitMapNew(BMT_COLOR4,512,512);
|
||||
|
||||
img1->color=GR_WHITE;
|
||||
img1->pen_width=3;
|
||||
GrLine3(img1,60,0,0,0,60,0);
|
||||
GrCircle(img1,30,30,20);
|
||||
|
||||
img2->color=GR_RED^GR_WHITE|ROP_OR;
|
||||
img2->brush=img1;
|
||||
GrCircle(img2,256-30,256-30,128,67);
|
||||
img2->color=GR_BLUE^GR_WHITE;
|
||||
img2->pen_width=6;
|
||||
img2->brush=NULL;
|
||||
GrLine3(img2,128,128,0,256+128,256+128,0);
|
||||
GrLine3(img2,256+128,128,0,128,256+128,0);
|
||||
|
||||
I8 i;
|
||||
for (i=0;i<256;i+=4) {
|
||||
GrClear;
|
||||
GrBlot(b,i-256,i-256,img2);
|
||||
Sleep(20);
|
||||
}
|
||||
|
||||
GrDel(img1);
|
||||
GrDel(img2);
|
||||
GrDel(b);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
GrBitMap *base=GrNew(grbase2);
|
||||
|
||||
void DrawIt()
|
||||
{
|
||||
ClearWindowText;
|
||||
base->pen_width=2;
|
||||
base->color=GR_RED;
|
||||
GrLine3(base,-100,-100,-100, -100, 100,-100);
|
||||
GrLine3(base,-100, 100,-100, 100, 100,-100);
|
||||
GrLine3(base, 100, 100,-100, 100,-100,-100);
|
||||
GrLine3(base, 100,-100,-100, -100,-100,-100);
|
||||
|
||||
GrLine3(base,-100,-100, 100, -100, 100, 100);
|
||||
GrLine3(base,-100, 100, 100, 100, 100, 100);
|
||||
GrLine3(base, 100, 100, 100, 100,-100, 100);
|
||||
GrLine3(base, 100,-100, 100, -100,-100, 100);
|
||||
|
||||
GrLine3(base,-100,-100, 100, -100,-100,-100);
|
||||
GrLine3(base,-100, 100, 100, -100, 100,-100);
|
||||
GrLine3(base, 100, 100, 100, 100, 100,-100);
|
||||
GrLine3(base, 100,-100, 100, 100,-100,-100);
|
||||
}
|
||||
|
||||
void Box()
|
||||
{
|
||||
double theta=0,phi=0,zeta=0,s=1,s1=1.05;
|
||||
I8 *r1,*r2,*r3,*r4,*r5;
|
||||
U8 sc,ch;
|
||||
U4 *old_update_window=Fs->update_window;
|
||||
Fs->update_window=&DrawIt;
|
||||
|
||||
base->x=200;
|
||||
base->y=200;
|
||||
base->flags|=BMF_TRANSFORMATION;
|
||||
while (TRUE) {
|
||||
if (ScanChar(&sc,&ch)) break;
|
||||
r1=GrTheta(theta);
|
||||
r2=GrPhi(phi);
|
||||
r3=GrTheta(zeta);
|
||||
r4=GrMulMat(r1,r2);
|
||||
r5=GrMulMat(r4,r3);
|
||||
Free(base->r);
|
||||
base->r=GrScaleMat(r5,s);
|
||||
Free(r1);
|
||||
Free(r2);
|
||||
Free(r3);
|
||||
Free(r4);
|
||||
Free(r5);
|
||||
|
||||
Sleep(60);
|
||||
theta+=pi2/70;
|
||||
phi +=pi2/90;
|
||||
zeta +=pi2/110;
|
||||
s *=s1;
|
||||
if (s<0.2|| s>1.4) s1=1/s1;
|
||||
}
|
||||
Fs->update_window=old_update_window;
|
||||
}
|
||||
|
||||
Box;
|
||||
@@ -0,0 +1,12 @@
|
||||
void DotNet()
|
||||
{
|
||||
I8 i;
|
||||
GrBitMap *base=GrNew(grbase);
|
||||
PrintF("$$CL$$"); //Clear text
|
||||
base->color=GR_RED^GR_WHITE; //Printed on white background
|
||||
for (i=0;i<600;i+=20)
|
||||
GrLine(base,i,0,0,600-i,3);
|
||||
}
|
||||
|
||||
DotNet; //Run when #included
|
||||
//Type "GrClear;" to get rid of it
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
void MsgLoop()
|
||||
{
|
||||
U8 p1=0,p2=0,cmd=0;
|
||||
coutln "Use $$LK \"these\",\"MN:MSG_CMD\"$$ defines "
|
||||
"in your programs instead of hardcoded numbers.";
|
||||
coutln "Press ESC to Exit";
|
||||
while (cmd!=MSG_KEY_DOWN || (p1!=CH_ESC && p1!=CH_CTRLQ)) {
|
||||
cmd=GetMsg(&p1,&p2,-2);
|
||||
// The following fixes the cursor position
|
||||
LtfBottom(Fs->cur_ltf);
|
||||
PrintF("CMD:%02X P1:%08X P2:%08X\r\n",cmd,p1,p2);
|
||||
}
|
||||
}
|
||||
|
||||
MsgLoop;
|
||||
@@ -0,0 +1,20 @@
|
||||
void SoundOff()
|
||||
{
|
||||
Sound(0);
|
||||
Exit;
|
||||
}
|
||||
|
||||
|
||||
void MusicDemoTsk()
|
||||
{
|
||||
Fs->end_task_cb=&SoundOff;
|
||||
while (TRUE) {
|
||||
Play("1wCqDsEFG2AB");
|
||||
Play("wCqDsEFG3AB");
|
||||
Play("wCqDsEFG4AB");
|
||||
Play("wCqDsEFG5AB");
|
||||
Play("wCqDsEFG6AB");
|
||||
}
|
||||
}
|
||||
|
||||
Spawn(&MusicDemoTsk,"MUSIC");
|
||||
@@ -0,0 +1,15 @@
|
||||
//Practice your ASCII knowledge ;-)
|
||||
|
||||
void Organ()
|
||||
{
|
||||
U1 ch;
|
||||
coutln "Press keys to make sounds";
|
||||
coutln "and press ESC to exit.";
|
||||
do {
|
||||
ch=GetKey;
|
||||
Sound((ch-28)*25);
|
||||
} while (ch!=CH_ESC);
|
||||
Sound(0);
|
||||
}
|
||||
|
||||
Organ;
|
||||
@@ -0,0 +1,15 @@
|
||||
void Spy(TssStruct *tss)
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
SysHashTable *old_hash=Fs->hash_table;
|
||||
Fs->hash_table=tss->hash_table;
|
||||
while (!ScanChar) {
|
||||
LtfBottom(Fs->cur_ltf);
|
||||
PrintF("$$CL$$");
|
||||
TssRep(tss);
|
||||
StackRep(tss->esp);
|
||||
WinSync;
|
||||
}
|
||||
Fs->hash_table=old_hash;
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
void TreeSub(Ltf *l,LTDirEntry *tempm)
|
||||
{
|
||||
LTDirEntry *tempm1;
|
||||
while (tempm) {
|
||||
tempm1=tempm->next;
|
||||
if (tempm->attr & LT_ATTR_DIR) {
|
||||
LtfPutS(l,"$$TR \"\"$$");
|
||||
LtfPrintF(l,"$$MA +A \"%s\",\"Cd(\\\"%s\\\");Dir;\r\"$$\r\n",
|
||||
tempm->name,tempm->full_name);
|
||||
if (tempm->sub) {
|
||||
LtfPutS(l,"$$ID,+2$$");
|
||||
TreeSub(l,tempm->sub);
|
||||
LtfPutS(l,"$$ID,-2$$");
|
||||
}
|
||||
} else {
|
||||
LtfPrintF(l,"$$LK \"%12s\",\"FI:%s\"$$\r\n",
|
||||
tempm->name,tempm->full_name);
|
||||
}
|
||||
DelLTDirEntry(tempm);
|
||||
tempm=tempm1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
//This is an alternative window manager.
|
||||
//It augments the existing one found
|
||||
//in $LK,"::/LT/ADAM/WINDOW.CPZ","FI:::/LT/ADAM/WINDOW.CPZ"$. It uses
|
||||
//the real-time differential equation
|
||||
//solver to reposition windows as though
|
||||
//they were repulsively charged particles.
|
||||
|
||||
//I find this window manager to be a
|
||||
//novelty, not desirable for actual
|
||||
//use. You're welcome to add it, or
|
||||
//some variation to your start-up
|
||||
//scripts if you like it. It's not
|
||||
//fully debugged.
|
||||
|
||||
//I had to cheat to make this work.
|
||||
//I added $LK,"CRTf_HAS_BEEN_RESIZED2","MN:CRTf_HAS_BEEN_RESIZED2"$ and
|
||||
//modified $LK,"::/LT/ADAM/WINDOW.CPZ","FI:::/LT/ADAM/WINDOW.CPZ"$.
|
||||
|
||||
Ode *o=NULL;
|
||||
I8 tss_cnt=0;
|
||||
TssStruct *tss_map=NULL;
|
||||
|
||||
void EndTsk()
|
||||
{
|
||||
RemQue(o);
|
||||
OdeDel(o);
|
||||
Free(tss_map);
|
||||
Exit;
|
||||
}
|
||||
|
||||
void MyDerivative(Ode *o,double t,Order2D3 *state,Order2D3 *DstateDt)
|
||||
{
|
||||
U8 i,j;
|
||||
double f,d,dd,dx,dy;
|
||||
|
||||
MemSet(DstateDt,0,sizeof(Order2D3)*tss_cnt);
|
||||
for (i=0;i<tss_cnt;i++) {
|
||||
DstateDt[i].x=state[i].DxDt;
|
||||
DstateDt[i].y=state[i].DyDt;
|
||||
for (j=0;j<tss_cnt;j++) {
|
||||
if (i!=j) {
|
||||
dx=state[i].x-state[j].x;
|
||||
dy=state[i].y-state[j].y;
|
||||
dd=Sqr(dx)+Sqr(dy)+1.0;
|
||||
d=Sqrt(dd);
|
||||
|
||||
dx/=d;
|
||||
dy/=d;
|
||||
|
||||
f=1000000.0/dd;
|
||||
|
||||
DstateDt[i].DxDt+=f*dx;
|
||||
DstateDt[i].DyDt+=f*dy;
|
||||
}
|
||||
}
|
||||
DstateDt[i].DxDt-=1.0*state[i].DxDt; //damping
|
||||
DstateDt[i].DyDt-=1.0*state[i].DyDt;
|
||||
}
|
||||
}
|
||||
|
||||
void WinMngTsk()
|
||||
{
|
||||
BoolU4 same;
|
||||
I8 i,x,y,j,cnt;
|
||||
Order2D3 *tempo;
|
||||
TssStruct *tss;
|
||||
|
||||
//This makes so this task doesn't get
|
||||
//swapped-out unless voluntarily.
|
||||
Preempt(OFF);
|
||||
|
||||
Fs->end_task_cb=&EndTsk;
|
||||
while (TRUE) {
|
||||
cnt=0;
|
||||
tss=Fs->next_tss;
|
||||
while (tss!=Fs) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW))
|
||||
cnt++;
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
|
||||
if (cnt==tss_cnt) {
|
||||
same=TRUE;
|
||||
i=0;
|
||||
tss=Fs->next_tss;
|
||||
while (tss!=Fs) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW))
|
||||
if (tss_map[i++]!=tss)
|
||||
same=FALSE;
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
} else
|
||||
same=FALSE;
|
||||
if (!same) {
|
||||
tss_cnt=cnt;
|
||||
if (o) {
|
||||
RemQue(o);
|
||||
OdeDel(o);
|
||||
Free(tss_map);
|
||||
}
|
||||
o=OdeNew(cnt*sizeof(Order2D3));
|
||||
tss_map=MAlloc(sizeof(U4)*cnt);
|
||||
i=0;
|
||||
tss=Fs->next_tss;
|
||||
while (tss!=Fs) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW)) {
|
||||
tss_map[i]=tss;
|
||||
tempo=o->state+sizeof(Order2D3)*i;
|
||||
tempo->x=(tss->window_left+tss->window_right)>>1;
|
||||
tempo->y=(tss->window_top+tss->window_bottom)>>1;
|
||||
tempo->z=0;
|
||||
tempo->DxDt=0;
|
||||
tempo->DyDt=0;
|
||||
tempo->DzDt=0;
|
||||
i++;
|
||||
}
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
o->derivative=&MyDerivative;
|
||||
o->tolerance_start=.1;
|
||||
InsQue(o,Fs->last_ode);
|
||||
}
|
||||
Sleep(60);
|
||||
cnt=0;
|
||||
tss=Fs->next_tss;
|
||||
while (tss!=Fs) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW))
|
||||
cnt++;
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
if (cnt==tss_cnt) {
|
||||
same=TRUE;
|
||||
i=0;
|
||||
tss=Fs->next_tss;
|
||||
while (tss!=Fs) {
|
||||
if (Bt(&tss->crt_flags,CRTf_SHOW))
|
||||
if (tss_map[i++]!=tss)
|
||||
same=FALSE;
|
||||
tss=tss->next_tss;
|
||||
}
|
||||
} else
|
||||
same=FALSE;
|
||||
if (same) {
|
||||
Bts(&sys_flags,SYSf_CLEAR_SCREEN_TEXT);
|
||||
for (i=0;i<tss_cnt;i++) {
|
||||
tss=tss_map[i];
|
||||
tempo=o->state+sizeof(Order2D3)*i;
|
||||
x=tss->window_right-tss->window_left;
|
||||
y=tss->window_bottom-tss->window_top;
|
||||
if (Bt(&tss->crt_flags,CRTf_HAS_BEEN_RESIZED2)) {
|
||||
tempo->x=(tss->window_left+tss->window_right)>>1;
|
||||
tempo->y=(tss->window_top+tss->window_bottom)>>1;
|
||||
tempo->DxDt=0;
|
||||
tempo->DyDt=0;
|
||||
} else {
|
||||
j=tempo->x-x>>1;
|
||||
j&=-4;
|
||||
if (j<4) j=4;
|
||||
if (j+x>tss->crt_width-12) j=tss->crt_width-x-12;
|
||||
SetWindowHor(tss,j,j+x);
|
||||
j=tempo->y-y>>1;
|
||||
if (j<2) j=2;
|
||||
if (j+y>tss->crt_height-3) j=tss->crt_height-y-3;
|
||||
SetWindowVert(tss,j,j+y);
|
||||
|
||||
x=(tss->window_left+tss->window_right)>>1;
|
||||
y=(tss->window_top+tss->window_bottom)>>1;
|
||||
if (tempo->x>x+8) tempo->x=x+8;
|
||||
if (tempo->y>y+2) tempo->y=y+2;
|
||||
if (tempo->x<x-8) tempo->x=x-8;
|
||||
if (tempo->y<y-2) tempo->y=y-2;
|
||||
if (tempo->DxDt>32.0) tempo->DxDt=32.0;
|
||||
if (tempo->DyDt>8.0) tempo->DyDt=8.0;
|
||||
if (tempo->DxDt<-32.0) tempo->DxDt=-32.0;
|
||||
if (tempo->DyDt<-8.0) tempo->DyDt=-8.0;
|
||||
}
|
||||
Btr(&tss->crt_flags,CRTf_HAS_BEEN_RESIZED2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spawn(&WinMngTsk,"WINMGR2");
|
||||
Reference in new issue
Block a user