mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16:31 +00:00
203 lines
24 KiB
HTML
Executable file
203 lines
24 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.01">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> BALLS_NUM </span><span class=cFE>7</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> SPRINGS_NUM </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> STRETCH </span><span class=cFE>500</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> GRAVITY </span><span class=cFE>50</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> </span><span class=cF2>//not really gravity</span><span class=cF0>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> BALL_RADIUS </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> BASE_SIZE </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF9>CMass</span><span class=cF0> balls[BALLS_NUM];
|
|
<a name="l10"></a></span><span class=cF9>CSpring</span><span class=cF0> springs[SPRINGS_NUM];
|
|
<a name="l11"></a></span><span class=cF1>F64</span><span class=cF0> collision_t;
|
|
<a name="l12"></a>
|
|
<a name="l13"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawIt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l14"></a>{
|
|
<a name="l15"></a> </span><span class=cF9>I64</span><span class=cF0> i, cx = task->pix_width >> </span><span class=cFE>1</span><span class=cF0>, cy = task->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l16"></a> </span><span class=cF1>Bool</span><span class=cF0> sound_on = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l17"></a>
|
|
<a name="l18"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l19"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Protect your base."</span><span class=cF0>);
|
|
<a name="l20"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, cx - BASE_SIZE, cy - BASE_SIZE, BASE_SIZE * </span><span class=cFE>2</span><span class=cF0>, BASE_SIZE * </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l21"></a> dc->color = </span><span class=cF3>CYAN</span><span class=cF0>;
|
|
<a name="l22"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, cx - BASE_SIZE + </span><span class=cFE>2</span><span class=cF0>, cy - BASE_SIZE + </span><span class=cFE>2</span><span class=cF0>, BASE_SIZE * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0>, BASE_SIZE * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l23"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l24"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, balls[</span><span class=cFE>0</span><span class=cF0>].x, balls[</span><span class=cFE>0</span><span class=cF0>].y,
|
|
<a name="l25"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task->pix_left - task->scroll_x,
|
|
<a name="l26"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task->pix_top - task->scroll_y);
|
|
<a name="l27"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < SPRINGS_NUM; i++)
|
|
<a name="l28"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, springs[i].end1->x, springs[i].end1->y, springs[i].end2->x, springs[i].end2->y);
|
|
<a name="l29"></a>
|
|
<a name="l30"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l31"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, balls[</span><span class=cFE>0</span><span class=cF0>].x, balls[</span><span class=cFE>0</span><span class=cF0>].y, BALL_RADIUS);
|
|
<a name="l32"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, balls[</span><span class=cFE>0</span><span class=cF0>].x, balls[</span><span class=cFE>0</span><span class=cF0>].y, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l33"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l34"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, balls[</span><span class=cFE>0</span><span class=cF0>].x, balls[</span><span class=cFE>0</span><span class=cF0>].y, BALL_RADIUS);
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < BALLS_NUM; i++)
|
|
<a name="l37"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l38"></a> dc->color = </span><span class=cF3>LTPURPLE</span><span class=cF0>;
|
|
<a name="l39"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, balls[i].x, balls[i].y, BALL_RADIUS);
|
|
<a name="l40"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, balls[i].x, balls[i].y, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> ( cx - BASE_SIZE - BALL_RADIUS <= balls[i].x <= cx + BASE_SIZE + BALL_RADIUS &&
|
|
<a name="l42"></a> cy - BASE_SIZE - BALL_RADIUS <= balls[i].y <= cy + BASE_SIZE + BALL_RADIUS)
|
|
<a name="l43"></a> sound_on = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l44"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l45"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, balls[i].x, balls[i].y, BALL_RADIUS);
|
|
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (sound_on)
|
|
<a name="l48"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l49"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l51"></a>}
|
|
<a name="l52"></a>
|
|
<a name="l53"></a></span><span class=cF1>U0</span><span class=cF0> MyDerivative(</span><span class=cF9>CMathODE</span><span class=cF0> *ode, </span><span class=cF1>F64</span><span class=cF0> t, </span><span class=cF9>COrder2D3</span><span class=cF0> *, </span><span class=cF9>COrder2D3</span><span class=cF0> *)
|
|
<a name="l54"></a>{
|
|
<a name="l55"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l56"></a> </span><span class=cF1>F64</span><span class=cF0> d, dd;
|
|
<a name="l57"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p2;
|
|
<a name="l58"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = ode->win_task;
|
|
<a name="l59"></a>
|
|
<a name="l60"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(</span><span class=cF5>D3Equ</span><span class=cF7>(</span><span class=cF0>&p2,
|
|
<a name="l61"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task->pix_left - task->scroll_x,
|
|
<a name="l62"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task->pix_top - task->scroll_y, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>, &balls[</span><span class=cFE>0</span><span class=cF0>].state->x);
|
|
<a name="l63"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&balls[</span><span class=cFE>0</span><span class=cF0>].DstateDt->DxDt, </span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF0>&p2, STRETCH</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l64"></a>
|
|
<a name="l65"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&p2, task->pix_width >> </span><span class=cFE>1</span><span class=cF0>, task->pix_height >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l66"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < BALLS_NUM; i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &p2, &balls[i].state->x);
|
|
<a name="l68"></a> </span><span class=cF1>if</span><span class=cF0> (d = </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF0>&p</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l69"></a> {
|
|
<a name="l70"></a> </span><span class=cF2>//Gravity would be /(d*d*d), but that's too exponential.</span><span class=cF0>
|
|
<a name="l71"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, GRAVITY/d);
|
|
<a name="l72"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&balls[i].DstateDt->DxDt, &p);
|
|
<a name="l73"></a> }
|
|
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < BALLS_NUM; i++)
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (j = i + </span><span class=cFE>1</span><span class=cF0>; j < BALLS_NUM; j++)
|
|
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &balls[j].state->x, &balls[i].state->x);
|
|
<a name="l80"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p);
|
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (dd <= </span><span class=cF7>(</span><span class=cFE>2</span><span class=cF0> * BALL_RADIUS</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF7>(</span><span class=cFE>2</span><span class=cF0> * BALL_RADIUS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l82"></a> {
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (t-collision_t > </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0>)
|
|
<a name="l84"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l85"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>50</span><span class=cF0>, </span><span class=cFE>102</span><span class=cF0>, </span><span class=cFE>105</span><span class=cF0>);
|
|
<a name="l86"></a> collision_t = t;
|
|
<a name="l87"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l88"></a> d = </span><span class=cF5>Sqrt</span><span class=cF0>(dd) + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l89"></a> dd = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0> * BALL_RADIUS) * (</span><span class=cFE>2</span><span class=cF0> * BALL_RADIUS) - dd</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l90"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, dd / d);
|
|
<a name="l91"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&balls[j].DstateDt->DxDt, &p);
|
|
<a name="l92"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&balls[i].DstateDt->DxDt, &p);
|
|
<a name="l93"></a> }
|
|
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l95"></a>
|
|
<a name="l96"></a> d = balls[</span><span class=cFE>0</span><span class=cF0>].state->x;
|
|
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (d - BALL_RADIUS < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l98"></a> balls[</span><span class=cFE>0</span><span class=cF0>].DstateDt->DxDt += </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(d - BALL_RADIUS)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l99"></a> </span><span class=cF1>if</span><span class=cF0> (d + BALL_RADIUS > task->pix_width)
|
|
<a name="l100"></a> balls[</span><span class=cFE>0</span><span class=cF0>].DstateDt->DxDt -= </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>d + BALL_RADIUS</span><span class=cF7>)</span><span class=cF0> - task->pix_width)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l101"></a>
|
|
<a name="l102"></a> d = balls[</span><span class=cFE>0</span><span class=cF0>].state->y;
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (d - BALL_RADIUS < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l104"></a> balls[</span><span class=cFE>0</span><span class=cF0>].DstateDt->DyDt += </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(d - BALL_RADIUS)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (d + BALL_RADIUS > task->pix_height)
|
|
<a name="l106"></a> balls[</span><span class=cFE>0</span><span class=cF0>].DstateDt->DyDt -= </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>d + BALL_RADIUS</span><span class=cF7>)</span><span class=cF0> - task->pix_height)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l107"></a>}
|
|
<a name="l108"></a>
|
|
<a name="l109"></a></span><span class=cF1>U0</span><span class=cF0> Whap()
|
|
<a name="l110"></a>{
|
|
<a name="l111"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l112"></a> </span><span class=cF9>CMathODE</span><span class=cF0> *ode = </span><span class=cF5>ODENew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>e-</span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
|
|
<a name="l113"></a>
|
|
<a name="l114"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l115"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l116"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l117"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l118"></a>
|
|
<a name="l119"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l120"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l123"></a> );
|
|
<a name="l124"></a> ode->derive = &MyDerivative;
|
|
<a name="l125"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>002</span><span class=cF0>;
|
|
<a name="l126"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>00001</span><span class=cF0>;
|
|
<a name="l127"></a> ode->acceleration_limit = </span><span class=cFE>5</span><span class=cF0>e3;
|
|
<a name="l128"></a> </span><span class=cF5>MemSet</span><span class=cF0>(balls, </span><span class=cFE>0</span><span class=cF0>, BALLS_NUM * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CMass</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l129"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&balls[</span><span class=cFE>0</span><span class=cF0>].x, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l130"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < BALLS_NUM; i++)
|
|
<a name="l131"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&balls[i].x, </span><span class=cF5>RandI16</span><span class=cF0> % </span><span class=cFE>500</span><span class=cF0> + </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF5>RandI16</span><span class=cF0> % </span><span class=cFE>500</span><span class=cF0> + </span><span class=cF5>Fs</span><span class=cF0>->pix_height >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l132"></a> balls[</span><span class=cFE>0</span><span class=cF0>].x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cF5>Fs</span><span class=cF0>->pix_left - </span><span class=cF5>Fs</span><span class=cF0>->scroll_x;
|
|
<a name="l133"></a> balls[</span><span class=cFE>0</span><span class=cF0>].y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cF5>Fs</span><span class=cF0>->pix_top - </span><span class=cF5>Fs</span><span class=cF0>->scroll_y;
|
|
<a name="l134"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < BALLS_NUM; i++)
|
|
<a name="l135"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l136"></a> balls[i].mass = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l137"></a> balls[i].drag_profile_factor = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&balls[i], ode->last_mass);
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a> balls[</span><span class=cFE>2</span><span class=cF0>].x = balls[</span><span class=cFE>1</span><span class=cF0>].x + </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l141"></a> balls[</span><span class=cFE>2</span><span class=cF0>].y = balls[</span><span class=cFE>1</span><span class=cF0>].y;
|
|
<a name="l142"></a> balls[</span><span class=cFE>3</span><span class=cF0>].x = balls[</span><span class=cFE>1</span><span class=cF0>].x;
|
|
<a name="l143"></a> balls[</span><span class=cFE>3</span><span class=cF0>].y = balls[</span><span class=cFE>1</span><span class=cF0>].y + </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l144"></a> </span><span class=cF5>MemSet</span><span class=cF0>(springs, </span><span class=cFE>0</span><span class=cF0>, SPRINGS_NUM * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSpring</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l145"></a> springs[</span><span class=cFE>0</span><span class=cF0>].end1 = &balls[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l146"></a> springs[</span><span class=cFE>0</span><span class=cF0>].end2 = &balls[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l147"></a> springs[</span><span class=cFE>0</span><span class=cF0>].rest_len = </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l148"></a> springs[</span><span class=cFE>0</span><span class=cF0>].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l149"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&springs[</span><span class=cFE>0</span><span class=cF0>], ode->last_spring);
|
|
<a name="l150"></a> springs[</span><span class=cFE>1</span><span class=cF0>].end1 = &balls[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l151"></a> springs[</span><span class=cFE>1</span><span class=cF0>].end2 = &balls[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l152"></a> springs[</span><span class=cFE>1</span><span class=cF0>].rest_len = </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l153"></a> springs[</span><span class=cFE>1</span><span class=cF0>].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l154"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&springs[</span><span class=cFE>1</span><span class=cF0>], ode->last_spring);
|
|
<a name="l155"></a> springs[</span><span class=cFE>2</span><span class=cF0>].end1 = &balls[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l156"></a> springs[</span><span class=cFE>2</span><span class=cF0>].end2 = &balls[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l157"></a> springs[</span><span class=cFE>2</span><span class=cF0>].rest_len = </span><span class=cF3>sqrt2</span><span class=cF0> * </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l158"></a> springs[</span><span class=cFE>2</span><span class=cF0>].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l159"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&springs[</span><span class=cFE>2</span><span class=cF0>], ode->last_spring);
|
|
<a name="l160"></a>
|
|
<a name="l161"></a> collision_t = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l162"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(ode, </span><span class=cF5>Fs</span><span class=cF0>->last_ode);
|
|
<a name="l163"></a>
|
|
<a name="l164"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l165"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l166"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l167"></a> </span><span class=cF5>CharGet</span><span class=cF0>;
|
|
<a name="l168"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l169"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(ode);
|
|
<a name="l170"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
|
|
<a name="l171"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l172"></a>}
|
|
<a name="l173"></a>
|
|
<a name="l174"></a>Whap;
|
|
</span></pre></body>
|
|
</html>
|