TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
@@ -22,7 +22,6 @@ class MySpring:CSpring
|
||||
I32 pen_width;
|
||||
};
|
||||
|
||||
|
||||
CMathODE *ode=NULL;
|
||||
|
||||
CCtrlButtonState run_button,mode_button;
|
||||
@@ -46,6 +45,5 @@ class SpanAnimateStruct
|
||||
F64 elapsed_t,start_wall_t;
|
||||
} a;
|
||||
|
||||
|
||||
extern MyMass PlaceMass(I64 x, I64 y);
|
||||
extern F64 SpanTime();
|
||||
@@ -45,20 +45,18 @@ U0 SpanBridge1Init(CMathODE *)
|
||||
}
|
||||
|
||||
DocClear;
|
||||
"$$BG,LTCYAN$$"; NewLine(SKY_LINES);
|
||||
"$$BG,LTCYAN$$%h*c",SKY_LINES,'\n';
|
||||
for (i=0;i<10;i++) {
|
||||
"$$BG,BROWN$$"; Spaces(RIVER_BANK_COLS);
|
||||
"$$BG,LTCYAN$$"; Spaces(TEXT_COLS-2*RIVER_BANK_COLS);
|
||||
"$$BG,BROWN$$"; Spaces(RIVER_BANK_COLS);
|
||||
NewLine;
|
||||
"$$BG,BROWN$$%h*c",RIVER_BANK_COLS,CH_SPACE;
|
||||
"$$BG,LTCYAN$$%h*c",TEXT_COLS-2*RIVER_BANK_COLS,CH_SPACE;
|
||||
"$$BG,BROWN$$%h*c\n",RIVER_BANK_COLS,CH_SPACE;
|
||||
}
|
||||
for (i=0;i<5;i++) {
|
||||
"$$BG,BROWN$$"; Spaces(RIVER_BANK_COLS+i);
|
||||
"$$BG,BLUE$$"; Spaces(TEXT_COLS/2-RIVER_BANK_COLS-2*i);
|
||||
"$$BG,BROWN$$"; Spaces(2*i);
|
||||
"$$BG,BLUE$$"; Spaces(TEXT_COLS/2-RIVER_BANK_COLS-2*i);
|
||||
"$$BG,BROWN$$"; Spaces(RIVER_BANK_COLS+i);
|
||||
NewLine;
|
||||
"$$BG,BROWN$$%h*c",RIVER_BANK_COLS+i,CH_SPACE;
|
||||
"$$BG,BLUE$$%h*c",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;
|
||||
"$$BG,BROWN$$%h*c",2*i,CH_SPACE;
|
||||
"$$BG,BLUE$$%h*c",TEXT_COLS/2-RIVER_BANK_COLS-2*i,CH_SPACE;
|
||||
"$$BG,BROWN$$%h*c\n",RIVER_BANK_COLS+i,CH_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
tempm2=tempm1->next;
|
||||
while (tempm2!=&ode->next_mass) {
|
||||
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
|
||||
dd=D3SqrNorm(&p);
|
||||
dd=D3NormSqr(&p);
|
||||
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
|
||||
d=Sqrt(dd)+0.0001;
|
||||
dd=10.0*Sqr(Sqr(Sqr(tempm1->radius+tempm2->radius)-dd));
|
||||
@@ -36,11 +36,11 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
}
|
||||
|
||||
if (cursor_mass) {
|
||||
p2.x=ipx-task->pix_left-task->scroll_x;
|
||||
p2.y=ipy-task->pix_top-task->scroll_y;
|
||||
p2.x=ip.pos.x-task->pix_left-task->scroll_x;
|
||||
p2.y=ip.pos.y-task->pix_top-task->scroll_y;
|
||||
p2.z=0;
|
||||
D3Sub(&p2,&cursor_mass->state->x,&p);
|
||||
d=10.0*D3SqrNorm(&p);
|
||||
d=10.0*D3NormSqr(&p);
|
||||
D3MulEqu(&p,d);
|
||||
D3AddEqu(&cursor_mass->DstateDt->DxDt,&p);
|
||||
}
|
||||
|
||||
+19
-21
@@ -24,7 +24,6 @@ F64 Cost(CMathODE *ode)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
Bool old_suspend1,old_suspend2;
|
||||
@@ -48,7 +47,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
if (cursor_mass) {
|
||||
dc->color=RED;
|
||||
dc->pen_width=2;
|
||||
GrLine3(dc,ipx-task->pix_left-task->scroll_x,ipy-task->pix_top-task->scroll_y,0,
|
||||
GrLine3(dc,ip.pos.x-task->pix_left-task->scroll_x,ip.pos.y-task->pix_top-task->scroll_y,0,
|
||||
cursor_mass->x,cursor_mass->y,0);
|
||||
}
|
||||
|
||||
@@ -195,7 +194,7 @@ U0 PlaceSpring(MyMass *tempm1,MyMass *tempm2)
|
||||
}
|
||||
|
||||
U0 AnimateTask(SpanAnimateStruct *a)
|
||||
{ //Preemption is off by default.
|
||||
{//Preemption is off by default.
|
||||
MySpring *temps,*temps1;
|
||||
Bool old_run=FALSE;
|
||||
F64 f;
|
||||
@@ -245,11 +244,11 @@ U0 Init(SpanAnimateStruct *a)
|
||||
}
|
||||
|
||||
U0 SongTask(I64)
|
||||
{ //Song by Terry A. Davis
|
||||
{//Song by Terry A. Davis
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
music_tempo= 3.636;
|
||||
music_stacatto_factor= 0.902;
|
||||
music.tempo= 3.636;
|
||||
music.stacatto_factor= 0.902;
|
||||
while (TRUE) {
|
||||
Play("3q.EeDqED2G3DhE");
|
||||
Play("q.EeDqED2G3DhE");
|
||||
@@ -260,7 +259,7 @@ U0 SongTask(I64)
|
||||
|
||||
U0 Span()
|
||||
{
|
||||
I64 msg_code,p1,p2;
|
||||
I64 msg_code,a1,a2;
|
||||
MyMass *tempm1=NULL,*tempm2=NULL;
|
||||
MySpring *temps;
|
||||
CCtrl *bt_run,*bt_mode;
|
||||
@@ -276,7 +275,7 @@ U0 Span()
|
||||
bt_mode=CtrlButtonNew(0,3.0*FONT_HEIGHT,80,,MD_NUM_MODES,Define("ST_SPAN_MODES"),mode_colors,&mode_button);
|
||||
a.saved_ode=NULL;
|
||||
|
||||
//This Preempt() eliminates a lot of hassles.
|
||||
//Preempt(OFF) eliminates a lot of hassles.
|
||||
//The concern is about changing
|
||||
//que links while the winmgr task
|
||||
//is updating the ode or screen.
|
||||
@@ -289,7 +288,6 @@ U0 Span()
|
||||
//since we will yield during GetMsg().
|
||||
Preempt(OFF);
|
||||
|
||||
|
||||
DocCursor;
|
||||
WinBorder;
|
||||
WordStat;
|
||||
@@ -338,29 +336,29 @@ U0 Span()
|
||||
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_L_UP|1<<MSG_KEY_DOWN|1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_L_UP|1<<MSG_KEY_DOWN|1<<MSG_IP_MOVE);
|
||||
DCFill(dc);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
cursor_mass=tempm1=tempm2=NULL;
|
||||
switch (mode_button.state) {
|
||||
case MD_MASS:
|
||||
PlaceMass(p1,p2);
|
||||
PlaceMass(a1,a2);
|
||||
break;
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
tempm1=MassFind(ode,p1,p2);
|
||||
tempm1=MassFind(ode,a1,a2);
|
||||
break;
|
||||
case MD_MOVE:
|
||||
if (run_button.state)
|
||||
cursor_mass=MassFind(ode,p1,p2);
|
||||
cursor_mass=MassFind(ode,a1,a2);
|
||||
else
|
||||
if (tempm1=MassFind(ode,p1,p2))
|
||||
MoveMass(tempm1,p1,p2);
|
||||
if (tempm1=MassFind(ode,a1,a2))
|
||||
MoveMass(tempm1,a1,a2);
|
||||
break;
|
||||
case MD_DELETE:
|
||||
MassOrSpringFind(ode,&tempm1,&temps,p1,p2);
|
||||
MassOrSpringFind(ode,&tempm1,&temps,a1,a2);
|
||||
if (tempm1)
|
||||
DelMass(tempm1);
|
||||
if (temps)
|
||||
@@ -373,12 +371,12 @@ U0 Span()
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
if (tempm1 && (tempm2=MassFind(ode,p1,p2)) && tempm1!=tempm2)
|
||||
if (tempm1 && (tempm2=MassFind(ode,a1,a2)) && tempm1!=tempm2)
|
||||
PlaceSpring(tempm1,tempm2);
|
||||
break;
|
||||
case MD_MOVE:
|
||||
if (!run_button.state && tempm1)
|
||||
MoveMass(tempm1,p1,p2);
|
||||
MoveMass(tempm1,a1,a2);
|
||||
break;
|
||||
}
|
||||
cursor_mass=tempm1=tempm2=NULL;
|
||||
@@ -387,13 +385,13 @@ U0 Span()
|
||||
switch (mode_button.state) {
|
||||
case MD_MOVE:
|
||||
if (!run_button.state && tempm1)
|
||||
MoveMass(tempm1,p1,p2);
|
||||
MoveMass(tempm1,a1,a2);
|
||||
break;
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
if (tempm1) {
|
||||
DrawSpring(dc,tempm1,p1,p2);
|
||||
DrawSpring(dc,tempm1,a1,a2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -405,7 +403,7 @@ U0 Span()
|
||||
cursor_mass=tempm1=tempm2=NULL;
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (p1) {
|
||||
switch (a1) {
|
||||
case '\n':
|
||||
if (!SpanTime || !a.saved_ode) {
|
||||
Free(a.saved_ode);
|
||||
|
||||
@@ -19,7 +19,6 @@ U0 SpanDel(CMathODE *ode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define M_SIZE (sizeof(MyMass) -offset(CMass.start_saved_area))
|
||||
#define S_SIZE (sizeof(MySpring)-offset(CSpring.start_saved_area))
|
||||
|
||||
|
||||
Reference in new issue
Block a user