ZealOS/docs/Apps/Strut/Strut.ZC.html
2021-12-11 06:10:58 -05:00

769 lines
75 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.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.c00{color:#e3e3e3;background-color:#e3e3e3;}
.c0A{color:#a1ce97;background-color:#e3e3e3;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=c0A>
<a name="l2"></a>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l3"></a></span><span class=c0A>
<a name="l4"></a>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l5"></a>
<a name="l6"></a></span><span class=c0A>
<a name="l7"></a>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l8"></a>
<a name="l9"></a></span><span class=cF0>
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> STARS_NUM </span><span class=cFE>8192</span><span class=cF0>
<a name="l11"></a></span><span class=cF9>I64</span><span class=cF0> stars_x[STARS_NUM], stars_y[STARS_NUM];
<a name="l12"></a>
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> RADIUS </span><span class=cFE>7</span><span class=cF0>
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> MyMass:</span><span class=cF9>CMass</span><span class=cF0>
<a name="l16"></a>{
<a name="l17"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
<a name="l18"></a>};
<a name="l19"></a>
<a name="l20"></a></span><span class=cF1>class</span><span class=cF0> MySpring:</span><span class=cF9>CSpring</span><span class=cF0>
<a name="l21"></a>{
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> type, action_key;
<a name="l23"></a>};
<a name="l24"></a>
<a name="l25"></a></span><span class=cF2>//Main Modses</span><span class=cF0>
<a name="l26"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_EDIT </span><span class=cFE>0</span><span class=cF0>
<a name="l27"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_PLAY </span><span class=cFE>1</span><span class=cF0>
<a name="l28"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_MODES_NUM </span><span class=cFE>2</span><span class=cF0>
<a name="l29"></a>
<a name="l30"></a></span><span class=cF9>CColorROPU32</span><span class=cF0> main_mode_colors[MMD_MODES_NUM] = {</span><span class=cF3>LTRED</span><span class=cF0>, </span><span class=cF3>LTGREEN</span><span class=cF0>};
<a name="l31"></a>
<a name="l32"></a></span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_MAIN_MODES&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Edit\0Play\0&quot;</span><span class=cF0>);
<a name="l33"></a>
<a name="l34"></a></span><span class=cF9>CCtrlBttnState</span><span class=cF0> main_mode_bttn;
<a name="l35"></a>
<a name="l36"></a></span><span class=cF2>//Edit Modes</span><span class=cF0>
<a name="l37"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MASS </span><span class=cFE>0</span><span class=cF0>
<a name="l38"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_SPRING </span><span class=cFE>1</span><span class=cF0>
<a name="l39"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_CONNECTOR </span><span class=cFE>2</span><span class=cF0>
<a name="l40"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_THRUSTER </span><span class=cFE>3</span><span class=cF0>
<a name="l41"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MOVE </span><span class=cFE>4</span><span class=cF0>
<a name="l42"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MODES_NUM </span><span class=cFE>5</span><span class=cF0>
<a name="l43"></a>
<a name="l44"></a></span><span class=cF9>CColorROPU32</span><span class=cF0> edit_mode_colors[EMD_MODES_NUM] = {</span><span class=cF3>LTGRAY</span><span class=cF0>, </span><span class=cF3>LTCYAN</span><span class=cF0>, </span><span class=cF3>CYAN</span><span class=cF0>, </span><span class=cF3>YELLOW</span><span class=cF0>, </span><span class=cF3>LTBLUE</span><span class=cF0>};
<a name="l45"></a>
<a name="l46"></a></span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_EDIT_MODES&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Mass\0Spring\0Connector\0Thruster\0Move\0&quot;</span><span class=cF0>);
<a name="l47"></a>
<a name="l48"></a></span><span class=cF9>CCtrlBttnState</span><span class=cF0> edit_mode_bttn;
<a name="l49"></a>
<a name="l50"></a></span><span class=cF9>CTask</span><span class=cF0> *task;
<a name="l51"></a></span><span class=cF1>F64</span><span class=cF0> zoom;
<a name="l52"></a></span><span class=cF9>I64</span><span class=cF0> next_action_key, action_scan_codes[</span><span class=cFE>10</span><span class=cF0>];
<a name="l53"></a></span><span class=cF9>CMathODE</span><span class=cF0> *ode = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l54"></a>
<a name="l55"></a></span><span class=cF1>U0</span><span class=cF0> S2W(</span><span class=cF1>F64</span><span class=cF0> sx, </span><span class=cF1>F64</span><span class=cF0> sy, </span><span class=cF1>F64</span><span class=cF0> *_wx, </span><span class=cF1>F64</span><span class=cF0> *_wy)
<a name="l56"></a>{
<a name="l57"></a> sx -= task-&gt;pix_left + task-&gt;scroll_x;
<a name="l58"></a> sy -= task-&gt;pix_top + task-&gt;scroll_y;
<a name="l59"></a> *_wx = sx / zoom;
<a name="l60"></a> *_wy = sy / zoom;
<a name="l61"></a>}
<a name="l62"></a>
<a name="l63"></a></span><span class=cF1>U0</span><span class=cF0> W2S(</span><span class=cF1>F64</span><span class=cF0> wx, </span><span class=cF1>F64</span><span class=cF0> wy, </span><span class=cF1>F64</span><span class=cF0> *_sx, </span><span class=cF1>F64</span><span class=cF0> *_sy)
<a name="l64"></a>{
<a name="l65"></a> *_sx = wx * zoom;
<a name="l66"></a> *_sy = wy * zoom;
<a name="l67"></a>}
<a name="l68"></a>
<a name="l69"></a>#</span><span class=cF1>define</span><span class=cF0> ZOOM_STEPS </span><span class=cFE>20</span><span class=cF0>
<a name="l70"></a>
<a name="l71"></a></span><span class=cF1>U0</span><span class=cF0> Zoom(</span><span class=cF1>F64</span><span class=cF0> d)
<a name="l72"></a>{
<a name="l73"></a> </span><span class=cF1>F64</span><span class=cF0> sx, sy, wx, wy;
<a name="l74"></a> </span><span class=cF9>I64</span><span class=cF0> i, x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x, y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y;
<a name="l75"></a>
<a name="l76"></a> d = </span><span class=cF5>Exp</span><span class=cF0>(</span><span class=cF5>Ln</span><span class=cF7>(</span><span class=cF0>d</span><span class=cF7>)</span><span class=cF0> / ZOOM_STEPS);
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; ZOOM_STEPS; i++)
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l79"></a> S2W(x, y, &amp;wx, &amp;wy);
<a name="l80"></a> zoom = </span><span class=cF5>Clamp</span><span class=cF0>(zoom * d, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>02</span><span class=cF0>, </span><span class=cFE>50</span><span class=cF0>);
<a name="l81"></a> W2S(wx, wy, &amp;sx, &amp;sy);
<a name="l82"></a> task-&gt;scroll_x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - sx-task-&gt;pix_left;
<a name="l83"></a> task-&gt;scroll_y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - sy-task-&gt;pix_top;
<a name="l84"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>10</span><span class=cF0>);
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l86"></a>}
<a name="l87"></a>
<a name="l88"></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> *, </span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l89"></a>{
<a name="l90"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l91"></a> </span><span class=cF1>F64</span><span class=cF0> theta, d, x1, y1, x2, y2;
<a name="l92"></a> MyMass *tmpm;
<a name="l93"></a> MySpring *tmps;
<a name="l94"></a>
<a name="l95"></a> tmpm = ode-&gt;next_mass;
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm != &amp;ode-&gt;next_mass)
<a name="l97"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l98"></a> task-&gt;scroll_x = -tmpm-&gt;x * zoom + task-&gt;pix_width &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l99"></a> task-&gt;scroll_y = -tmpm-&gt;y * zoom + task-&gt;pix_height &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l100"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l101"></a>
<a name="l102"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(dc-&gt;r, zoom);
<a name="l104"></a>
<a name="l105"></a> </span><span class=cF1>switch</span><span class=cF0> (main_mode_bttn.state)
<a name="l106"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l107"></a> </span><span class=cF1>case</span><span class=cF0> MMD_EDIT:
<a name="l108"></a> task-&gt;text_attr = </span><span class=cF3>DKGRAY</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l109"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l110"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l111"></a>
<a name="l112"></a> </span><span class=cF1>case</span><span class=cF0> MMD_PLAY:
<a name="l113"></a> task-&gt;text_attr = </span><span class=cF3>BLACK</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l114"></a> dc-&gt;color = </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l115"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; STARS_NUM; i++)
<a name="l116"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc, stars_x[i], stars_y[i], </span><span class=cFE>0</span><span class=cF0>);
<a name="l117"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l119"></a>
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (main_mode_bttn.state == MMD_EDIT)
<a name="l121"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (edit_mode_bttn.state == EMD_CONNECTOR)
<a name="l123"></a> {
<a name="l124"></a> dc-&gt;color = </span><span class=cF3>CYAN</span><span class=cF0>;
<a name="l125"></a> S2W(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>11</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>7</span><span class=cF0>, &amp;x1, &amp;y1);
<a name="l126"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, next_action_key);
<a name="l127"></a> }
<a name="l128"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (edit_mode_bttn.state == EMD_THRUSTER)
<a name="l129"></a> {
<a name="l130"></a> dc-&gt;color = </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l131"></a> S2W(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>11</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>7</span><span class=cF0>, &amp;x1, &amp;y1);
<a name="l132"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, next_action_key);
<a name="l133"></a> }
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l135"></a>
<a name="l136"></a> tmps = ode-&gt;next_spring;
<a name="l137"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l138"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;type == EMD_SPRING)
<a name="l140"></a> {
<a name="l141"></a> dc-&gt;color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l142"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmps-&gt;end1-&gt;x, tmps-&gt;end1-&gt;y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l143"></a> tmps-&gt;end2-&gt;x, tmps-&gt;end2-&gt;y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l144"></a> }
<a name="l145"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;type == EMD_CONNECTOR)
<a name="l146"></a> {
<a name="l147"></a> dc-&gt;color = </span><span class=cF3>CYAN</span><span class=cF0>;
<a name="l148"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmps-&gt;end1-&gt;x, tmps-&gt;end1-&gt;y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l149"></a> tmps-&gt;end2-&gt;x, tmps-&gt;end2-&gt;y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l150"></a> }
<a name="l151"></a> tmps = tmps-&gt;next;
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l153"></a>
<a name="l154"></a> dc-&gt;color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l155"></a> tmpm = ode-&gt;next_mass;
<a name="l156"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &amp;ode-&gt;next_mass)
<a name="l157"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l158"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpm-&gt;x, tmpm-&gt;y, </span><span class=cFE>0</span><span class=cF0>, tmpm-&gt;img);
<a name="l159"></a> tmpm = tmpm-&gt;next;
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l161"></a>
<a name="l162"></a> tmps = ode-&gt;next_spring;
<a name="l163"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l164"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l165"></a> x1 = tmps-&gt;end1-&gt;x;
<a name="l166"></a> y1 = tmps-&gt;end1-&gt;y;
<a name="l167"></a> x2 = tmps-&gt;end2-&gt;x;
<a name="l168"></a> y2 = tmps-&gt;end2-&gt;y;
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;type == EMD_THRUSTER)
<a name="l170"></a> {
<a name="l171"></a> theta = </span><span class=cF5>Arg</span><span class=cF0>(x2 - x1, y2 - y1);
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps-&gt;action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l174"></a> dc-&gt;flags |= </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l175"></a> </span><span class=cF5>DCSymmetry3Set</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>256</span><span class=cF0>, x1, y1, </span><span class=cFE>0</span><span class=cF0>, x1 - </span><span class=cFE>256</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>256</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l176"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>8</span><span class=cF0>; i++)
<a name="l177"></a> {
<a name="l178"></a> d = </span><span class=cFE>20</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0> + </span><span class=cFE>6</span><span class=cF0>;
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt; </span><span class=cFE>10</span><span class=cF0>)
<a name="l180"></a> dc-&gt;color = </span><span class=cF3>BLUE</span><span class=cF0>;
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (d &lt; </span><span class=cFE>16</span><span class=cF0>)
<a name="l182"></a> dc-&gt;color = </span><span class=cF3>LTBLUE</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l184"></a> dc-&gt;color = </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l185"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1 - </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l186"></a> x1 - d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,
<a name="l187"></a> y1 - d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l188"></a>
<a name="l189"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1 - </span><span class=cFE>2</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>2</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l190"></a> x1 - d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,
<a name="l191"></a> y1 - d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l192"></a> }
<a name="l193"></a> dc-&gt;flags &amp;= ~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l194"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l195"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;3&gt;</span><span class=cF0>, theta);
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (zoom &gt; </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
<a name="l197"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l198"></a> dc-&gt;color = </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l199"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>x1 * </span><span class=cFE>7</span><span class=cF0> + x2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>y1 * </span><span class=cFE>7</span><span class=cF0> + y2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmps-&gt;action_key);
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l201"></a> }
<a name="l202"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;type == EMD_CONNECTOR)
<a name="l203"></a> {
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (zoom &gt; </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
<a name="l205"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l206"></a> dc-&gt;color = </span><span class=cF3>CYAN</span><span class=cF0>;
<a name="l207"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>x1 * </span><span class=cFE>7</span><span class=cF0> + x2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>y1 * </span><span class=cFE>7</span><span class=cF0> + y2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmps-&gt;action_key);
<a name="l208"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l209"></a> }
<a name="l210"></a> tmps = tmps-&gt;next;
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l212"></a>}
<a name="l213"></a>
<a name="l214"></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>, </span><span class=cF9>COrder2D3</span><span class=cF0> *, </span><span class=cF9>COrder2D3</span><span class=cF0> *)
<a name="l215"></a>{
<a name="l216"></a> </span><span class=cF2>//The forces due to springs and drag are</span><span class=cF0>
<a name="l217"></a> </span><span class=cF2>//automatically handled by the</span><span class=cF0>
<a name="l218"></a> </span><span class=cF2>//ode code. We can add new forces</span><span class=cF0>
<a name="l219"></a> </span><span class=cF2>//here.</span><span class=cF0>
<a name="l220"></a> </span><span class=cF1>F64</span><span class=cF0> d, dd;
<a name="l221"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
<a name="l222"></a> MyMass *tmpm1, *tmpm2;
<a name="l223"></a> MySpring *tmps;
<a name="l224"></a>
<a name="l225"></a> tmpm1 = ode-&gt;next_mass;
<a name="l226"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &amp;ode-&gt;next_mass)
<a name="l227"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l228"></a> tmpm2 = tmpm1-&gt;next;
<a name="l229"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm2 != &amp;ode-&gt;next_mass)
<a name="l230"></a> {
<a name="l231"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p, &amp;tmpm2-&gt;state-&gt;x, &amp;tmpm1-&gt;state-&gt;x);
<a name="l232"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p);
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (dd &lt;= </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cFE>2</span><span class=cF0> * RADIUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l235"></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="l236"></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=cF5>Sqr</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0> * RADIUS) - dd</span><span class=cF7>)</span><span class=cF0>);
<a name="l237"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p, dd / d);
<a name="l238"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpm2-&gt;DstateDt-&gt;DxDt, &amp;p);
<a name="l239"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&amp;tmpm1-&gt;DstateDt-&gt;DxDt, &amp;p);
<a name="l240"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l241"></a> tmpm2 = tmpm2-&gt;next;
<a name="l242"></a> }
<a name="l243"></a> tmpm1 = tmpm1-&gt;next;
<a name="l244"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l245"></a>
<a name="l246"></a> tmps = ode-&gt;next_spring;
<a name="l247"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l248"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l249"></a> </span><span class=cF1>if</span><span class=cF0> (main_mode_bttn.state == MMD_PLAY &amp;&amp; tmps-&gt;type == EMD_THRUSTER &amp;&amp;
<a name="l250"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps-&gt;action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
<a name="l251"></a> {
<a name="l252"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p, &amp;tmps-&gt;end2-&gt;state-&gt;x, &amp;tmps-&gt;end1-&gt;state-&gt;x);
<a name="l253"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p);
<a name="l254"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p, </span><span class=cFE>2000</span><span class=cF0>);
<a name="l255"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmps-&gt;end1-&gt;DstateDt-&gt;DxDt, &amp;p);
<a name="l256"></a> }
<a name="l257"></a> tmps = tmps-&gt;next;
<a name="l258"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l259"></a>}
<a name="l260"></a>
<a name="l261"></a>MyMass *PlaceMass(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l262"></a>{
<a name="l263"></a> MyMass *tmpm=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MyMass</span><span class=cF7>)</span><span class=cF0>);
<a name="l264"></a>
<a name="l265"></a> tmpm-&gt;mass = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l266"></a> tmpm-&gt;drag_profile_factor = </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l267"></a> tmpm-&gt;x = x;
<a name="l268"></a> tmpm-&gt;y = y;
<a name="l269"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpm, ode-&gt;last_mass);
<a name="l270"></a>
<a name="l271"></a> </span><span class=cF1>return</span><span class=cF0> tmpm;
<a name="l272"></a>}
<a name="l273"></a>
<a name="l274"></a>MySpring *PlaceSpring(MyMass *tmpm1, MyMass *tmpm2, </span><span class=cF9>I64</span><span class=cF0> type)
<a name="l275"></a>{
<a name="l276"></a> MySpring *tmps = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MySpring</span><span class=cF7>)</span><span class=cF0>);
<a name="l277"></a> </span><span class=cF1>F64</span><span class=cF0> d = </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmpm1-&gt;x, &amp;tmpm2-&gt;x);
<a name="l278"></a>
<a name="l279"></a> tmps-&gt;end1 = tmpm1;
<a name="l280"></a> tmps-&gt;end2 = tmpm2;
<a name="l281"></a> tmps-&gt;rest_len = d;
<a name="l282"></a> tmps-&gt;type = type;
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (type == EMD_THRUSTER)
<a name="l284"></a> tmps-&gt;const = </span><span class=cFE>0</span><span class=cF0>;
<a name="l285"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l286"></a> tmps-&gt;const = </span><span class=cFE>2500000</span><span class=cF0>/</span><span class=cF5>Sqr</span><span class=cF0>(d);
<a name="l287"></a> tmps-&gt;action_key = next_action_key;
<a name="l288"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmps, ode-&gt;last_spring);
<a name="l289"></a>
<a name="l290"></a> </span><span class=cF1>return</span><span class=cF0> tmps;
<a name="l291"></a>}
<a name="l292"></a>
<a name="l293"></a></span><span class=cF1>U0</span><span class=cF0> CenterMasses()
<a name="l294"></a>{
<a name="l295"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
<a name="l296"></a> MyMass *tmpm1, *tmpm2;
<a name="l297"></a>
<a name="l298"></a> tmpm1 = ode-&gt;next_mass;
<a name="l299"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 != &amp;ode-&gt;next_mass)
<a name="l300"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l301"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;p, &amp;tmpm1-&gt;x);
<a name="l302"></a> tmpm2 = ode-&gt;next_mass;
<a name="l303"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm2 != &amp;ode-&gt;next_mass)
<a name="l304"></a> {
<a name="l305"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&amp;tmpm2-&gt;x, &amp;p);
<a name="l306"></a> tmpm2 = tmpm2-&gt;next;
<a name="l307"></a> }
<a name="l308"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l309"></a>}
<a name="l310"></a>
<a name="l311"></a></span><span class=cF1>U0</span><span class=cF0> NullSprings()
<a name="l312"></a>{
<a name="l313"></a> MySpring *tmps = ode-&gt;next_spring;
<a name="l314"></a>
<a name="l315"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l317"></a> tmps-&gt;rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmps-&gt;end1-&gt;x, &amp;tmps-&gt;end2-&gt;x);
<a name="l318"></a> tmps = tmps-&gt;next;
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l320"></a>}
<a name="l321"></a>
<a name="l322"></a></span><span class=cF1>U0</span><span class=cF0> BreakConnectors()
<a name="l323"></a>{
<a name="l324"></a> MySpring *tmps = ode-&gt;next_spring, *tmps1;
<a name="l325"></a>
<a name="l326"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &amp;ode-&gt;next_spring)
<a name="l327"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l328"></a> tmps1 = tmps-&gt;next;
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;type == EMD_CONNECTOR &amp;&amp; </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps-&gt;action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
<a name="l330"></a> {
<a name="l331"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmps);
<a name="l332"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
<a name="l333"></a> }
<a name="l334"></a> tmps = tmps1;
<a name="l335"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l336"></a>}
<a name="l337"></a>
<a name="l338"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l339"></a>{
<a name="l340"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l341"></a>
<a name="l342"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l343"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt;= </span><span class=cFE>9</span><span class=cF0>; i++)
<a name="l344"></a> action_scan_codes[i] = </span><span class=cF5>Char2ScanCode</span><span class=cF0>(</span><span class=cF6>'0'</span><span class=cF0> + i);
<a name="l345"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; STARS_NUM; i++)
<a name="l346"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l347"></a> stars_x[i] = </span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>8192</span><span class=cF0> - </span><span class=cFE>4096</span><span class=cF0>;
<a name="l348"></a> stars_y[i] = </span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>8192</span><span class=cF0> - </span><span class=cFE>4096</span><span class=cF0>;
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l350"></a> next_action_key = </span><span class=cF6>'1'</span><span class=cF0>;
<a name="l351"></a> zoom = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l352"></a> 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>4</span><span class=cF0>, </span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
<a name="l353"></a> ode-&gt;derive = &amp;MyDerivative;
<a name="l354"></a> ode-&gt;acceleration_limit = </span><span class=cFE>5</span><span class=cF0>e3;
<a name="l355"></a> ode-&gt;drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
<a name="l356"></a> ode-&gt;drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
<a name="l357"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(ode, </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_ode);
<a name="l358"></a>}
<a name="l359"></a>
<a name="l360"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
<a name="l361"></a>{
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (ode)
<a name="l363"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l364"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(ode);
<a name="l365"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;ode-&gt;next_mass, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l366"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;ode-&gt;next_spring, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l367"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
<a name="l368"></a> ode = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l369"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l370"></a>}
<a name="l371"></a>
<a name="l372"></a></span><span class=cF1>U0</span><span class=cF0> PlayShip()
<a name="l373"></a>{
<a name="l374"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
<a name="l375"></a> </span><span class=cF1>F64</span><span class=cF0> last_noise = </span><span class=cFE>0</span><span class=cF0>;
<a name="l376"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
<a name="l377"></a>
<a name="l378"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
<a name="l379"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l380"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l381"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l382"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l383"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l384"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l385"></a> </span><span class=cF6>&quot; EditShip(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l386"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l387"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l388"></a> </span><span class=cF6>&quot; Center(,'c');&quot;</span><span class=cF0>
<a name="l389"></a> </span><span class=cF6>&quot; Damp(,'d');&quot;</span><span class=cF0>
<a name="l390"></a> </span><span class=cF6>&quot; Action0(,'0');&quot;</span><span class=cF0>
<a name="l391"></a> </span><span class=cF6>&quot; Action1(,'1');&quot;</span><span class=cF0>
<a name="l392"></a> </span><span class=cF6>&quot; Action2(,'2');&quot;</span><span class=cF0>
<a name="l393"></a> </span><span class=cF6>&quot; Action3(,'3');&quot;</span><span class=cF0>
<a name="l394"></a> </span><span class=cF6>&quot; Action4(,'4');&quot;</span><span class=cF0>
<a name="l395"></a> </span><span class=cF6>&quot; Action5(,'5');&quot;</span><span class=cF0>
<a name="l396"></a> </span><span class=cF6>&quot; Action6(,'6');&quot;</span><span class=cF0>
<a name="l397"></a> </span><span class=cF6>&quot; Action7(,'7');&quot;</span><span class=cF0>
<a name="l398"></a> </span><span class=cF6>&quot; Action8(,'8');&quot;</span><span class=cF0>
<a name="l399"></a> </span><span class=cF6>&quot; Action9(,'9');&quot;</span><span class=cF0>
<a name="l400"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l401"></a> </span><span class=cF6>&quot;View {&quot;</span><span class=cF0>
<a name="l402"></a> </span><span class=cF6>&quot; ZoomIn(,'z');&quot;</span><span class=cF0>
<a name="l403"></a> </span><span class=cF6>&quot; ZoomOut(,'Z');&quot;</span><span class=cF0>
<a name="l404"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l405"></a> );
<a name="l406"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l407"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l408"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l409"></a> </span><span class=cF1>while</span><span class=cF0> (main_mode_bttn.state == MMD_PLAY)
<a name="l410"></a> {
<a name="l411"></a> BreakConnectors;
<a name="l412"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>| </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
<a name="l413"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l414"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l415"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l416"></a> {
<a name="l417"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> &gt; last_noise + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0>)
<a name="l419"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l420"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>18</span><span class=cF0>, </span><span class=cFE>46</span><span class=cF0>);
<a name="l421"></a> last_noise = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l422"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l423"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l424"></a>
<a name="l425"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
<a name="l426"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;Zoom, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l427"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l428"></a>
<a name="l429"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
<a name="l430"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;Zoom, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l431"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l432"></a>
<a name="l433"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
<a name="l434"></a> CenterMasses;
<a name="l435"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l436"></a>
<a name="l437"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
<a name="l438"></a> ode-&gt;drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>002</span><span class=cF0>;
<a name="l439"></a> ode-&gt;drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
<a name="l440"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l441"></a>
<a name="l442"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l443"></a> </span><span class=cF1>if</span><span class=cF0> (++main_mode_bttn.state == MMD_MODES_NUM)
<a name="l444"></a> main_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
<a name="l445"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l446"></a> </span><span class=cF1>goto</span><span class=cF0> ps_done;
<a name="l447"></a>
<a name="l448"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l449"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l450"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l451"></a> }
<a name="l452"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l453"></a>
<a name="l454"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
<a name="l455"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l456"></a> {
<a name="l457"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
<a name="l458"></a> ode-&gt;drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
<a name="l459"></a> ode-&gt;drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
<a name="l460"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l461"></a> }
<a name="l462"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l463"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l464"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l465"></a> }
<a name="l466"></a>ps_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
<a name="l467"></a> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l468"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l469"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l470"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l471"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l472"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l473"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l474"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (!okay)
<a name="l476"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l477"></a>}
<a name="l478"></a>
<a name="l479"></a></span><span class=cF1>U0</span><span class=cF0> EditShip()
<a name="l480"></a>{
<a name="l481"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
<a name="l482"></a> </span><span class=cF1>F64</span><span class=cF0> wx, wy;
<a name="l483"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
<a name="l484"></a> MyMass *tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l485"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_edit_mode = </span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, EMD_MODES_NUM,
<a name="l486"></a> </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_EDIT_MODES&quot;</span><span class=cF7>)</span><span class=cF0>, edit_mode_colors, &amp;edit_mode_bttn);
<a name="l487"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
<a name="l488"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l489"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l490"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l491"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l492"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l493"></a> </span><span class=cF6>&quot; PlayShip(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l494"></a> </span><span class=cF6>&quot; Center(,'c');&quot;</span><span class=cF0>
<a name="l495"></a> </span><span class=cF6>&quot; Damp(,'d');&quot;</span><span class=cF0>
<a name="l496"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l497"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l498"></a> </span><span class=cF6>&quot; Move(,'v');&quot;</span><span class=cF0>
<a name="l499"></a> </span><span class=cF6>&quot; Mass(,'m');&quot;</span><span class=cF0>
<a name="l500"></a> </span><span class=cF6>&quot; Spring(,'s');&quot;</span><span class=cF0>
<a name="l501"></a> </span><span class=cF6>&quot; Connector(,'n');&quot;</span><span class=cF0>
<a name="l502"></a> </span><span class=cF6>&quot; Thruster(,'t');&quot;</span><span class=cF0>
<a name="l503"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l504"></a> </span><span class=cF6>&quot; Action0(,'0');&quot;</span><span class=cF0>
<a name="l505"></a> </span><span class=cF6>&quot; Action1(,'1');&quot;</span><span class=cF0>
<a name="l506"></a> </span><span class=cF6>&quot; Action2(,'2');&quot;</span><span class=cF0>
<a name="l507"></a> </span><span class=cF6>&quot; Action3(,'3');&quot;</span><span class=cF0>
<a name="l508"></a> </span><span class=cF6>&quot; Action4(,'4');&quot;</span><span class=cF0>
<a name="l509"></a> </span><span class=cF6>&quot; Action5(,'5');&quot;</span><span class=cF0>
<a name="l510"></a> </span><span class=cF6>&quot; Action6(,'6');&quot;</span><span class=cF0>
<a name="l511"></a> </span><span class=cF6>&quot; Action7(,'7');&quot;</span><span class=cF0>
<a name="l512"></a> </span><span class=cF6>&quot; Action8(,'8');&quot;</span><span class=cF0>
<a name="l513"></a> </span><span class=cF6>&quot; Action9(,'9');&quot;</span><span class=cF0>
<a name="l514"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l515"></a> </span><span class=cF6>&quot;View {&quot;</span><span class=cF0>
<a name="l516"></a> </span><span class=cF6>&quot; ZoomIn(,'z');&quot;</span><span class=cF0>
<a name="l517"></a> </span><span class=cF6>&quot; ZoomOut(,'Z');&quot;</span><span class=cF0>
<a name="l518"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l519"></a> );
<a name="l520"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l521"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l522"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l523"></a> </span><span class=cF1>while</span><span class=cF0> (main_mode_bttn.state == MMD_EDIT)
<a name="l524"></a> {
<a name="l525"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2,
<a name="l526"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>|
<a name="l527"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
<a name="l528"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l529"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
<a name="l530"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
<a name="l531"></a> {
<a name="l532"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MASS:
<a name="l533"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &amp;wx, &amp;wy);
<a name="l534"></a> tmpm1 = PlaceMass(wx, wy);
<a name="l535"></a> </span><span class=cF1>if</span><span class=cF0> (ode-&gt;next_mass == tmpm1)
<a name="l536"></a> tmpm1-&gt;img = </span><span class=cFA>&lt;1&gt;</span><span class=cF0>;
<a name="l537"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l538"></a> tmpm1-&gt;img = </span><span class=cFA>&lt;2&gt;</span><span class=cF0>;
<a name="l539"></a> tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l540"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l541"></a>
<a name="l542"></a> </span><span class=cF1>case</span><span class=cF0> EMD_SPRING:
<a name="l543"></a> </span><span class=cF1>case</span><span class=cF0> EMD_CONNECTOR:
<a name="l544"></a> </span><span class=cF1>case</span><span class=cF0> EMD_THRUSTER:
<a name="l545"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
<a name="l546"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &amp;wx, &amp;wy);
<a name="l547"></a> tmpm1 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, wx, wy);
<a name="l548"></a> tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l549"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l550"></a> }
<a name="l551"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l552"></a>
<a name="l553"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
<a name="l554"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
<a name="l555"></a> {
<a name="l556"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MASS:
<a name="l557"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l558"></a>
<a name="l559"></a> </span><span class=cF1>case</span><span class=cF0> EMD_SPRING:
<a name="l560"></a> </span><span class=cF1>case</span><span class=cF0> EMD_CONNECTOR:
<a name="l561"></a> </span><span class=cF1>case</span><span class=cF0> EMD_THRUSTER:
<a name="l562"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &amp;wx, &amp;wy);
<a name="l563"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 &amp;&amp; </span><span class=cF7>(</span><span class=cF0>tmpm2 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, wx, wy)</span><span class=cF7>)</span><span class=cF0> &amp;&amp; tmpm1 != tmpm2)
<a name="l564"></a> PlaceSpring(tmpm1, tmpm2, edit_mode_bttn.state);
<a name="l565"></a> tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l566"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l567"></a>
<a name="l568"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
<a name="l569"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &amp;wx, &amp;wy);
<a name="l570"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
<a name="l571"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l572"></a> tmpm1-&gt;x = wx;
<a name="l573"></a> tmpm1-&gt;y = wy;
<a name="l574"></a> tmpm1-&gt;z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l575"></a> NullSprings;
<a name="l576"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l577"></a> tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l578"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l579"></a> }
<a name="l580"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l581"></a>
<a name="l582"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
<a name="l583"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
<a name="l584"></a> {
<a name="l585"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
<a name="l586"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &amp;wx, &amp;wy);
<a name="l587"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
<a name="l588"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l589"></a> tmpm1-&gt;x = wx;
<a name="l590"></a> tmpm1-&gt;y = wy;
<a name="l591"></a> tmpm1-&gt;z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l592"></a> NullSprings;
<a name="l593"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l594"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l595"></a> }
<a name="l596"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l597"></a>
<a name="l598"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
<a name="l599"></a> </span><span class=cF1>if</span><span class=cF0> (++edit_mode_bttn.state == EMD_MODES_NUM)
<a name="l600"></a> edit_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
<a name="l601"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l602"></a>
<a name="l603"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>:
<a name="l604"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l605"></a>
<a name="l606"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l607"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l608"></a> {
<a name="l609"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l610"></a> CleanUp;
<a name="l611"></a> Init;
<a name="l612"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l613"></a>
<a name="l614"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
<a name="l615"></a> next_action_key = arg1;
<a name="l616"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l617"></a>
<a name="l618"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
<a name="l619"></a> CenterMasses;
<a name="l620"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l621"></a>
<a name="l622"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
<a name="l623"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
<a name="l624"></a> ode-&gt;drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>002</span><span class=cF0>;
<a name="l625"></a> ode-&gt;drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
<a name="l626"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l627"></a>
<a name="l628"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
<a name="l629"></a> edit_mode_bttn.state = EMD_MOVE;
<a name="l630"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l631"></a>
<a name="l632"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
<a name="l633"></a> edit_mode_bttn.state = EMD_MASS;
<a name="l634"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l635"></a>
<a name="l636"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
<a name="l637"></a> edit_mode_bttn.state = EMD_CONNECTOR;
<a name="l638"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l639"></a>
<a name="l640"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
<a name="l641"></a> edit_mode_bttn.state = EMD_SPRING;
<a name="l642"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l643"></a>
<a name="l644"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
<a name="l645"></a> edit_mode_bttn.state = EMD_THRUSTER;
<a name="l646"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l647"></a>
<a name="l648"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
<a name="l649"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;Zoom, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l650"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l651"></a>
<a name="l652"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
<a name="l653"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;Zoom, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
<a name="l654"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l655"></a>
<a name="l656"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l657"></a> </span><span class=cF1>if</span><span class=cF0> (++main_mode_bttn.state == MMD_MODES_NUM)
<a name="l658"></a> main_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
<a name="l659"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l660"></a> </span><span class=cF1>goto</span><span class=cF0> es_done;
<a name="l661"></a>
<a name="l662"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l663"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l664"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l665"></a> }
<a name="l666"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l667"></a>
<a name="l668"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
<a name="l669"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l670"></a> {
<a name="l671"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
<a name="l672"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
<a name="l673"></a> ode-&gt;drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
<a name="l674"></a> ode-&gt;drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
<a name="l675"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l676"></a> }
<a name="l677"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l678"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l679"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l680"></a> }
<a name="l681"></a>es_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
<a name="l682"></a> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l683"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l684"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l685"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l686"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l687"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l688"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l689"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l690"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_edit_mode);
<a name="l691"></a> </span><span class=cF1>if</span><span class=cF0> (!okay)
<a name="l692"></a> </span><span class=cF5>throw</span><span class=cF0>;
<a name="l693"></a>}
<a name="l694"></a>
<a name="l695"></a></span><span class=cF1>U0</span><span class=cF0> Strut()
<a name="l696"></a>{
<a name="l697"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_main_mode;
<a name="l698"></a>
<a name="l699"></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.ZC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l700"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit |= </span><span class=cF3>WIF_SELF_MS_L</span><span class=cF0> | </span><span class=cF3>WIF_SELF_MS_R</span><span class=cF0> | </span><span class=cF3>WIG_DBL_CLICK</span><span class=cF0>;
<a name="l701"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l702"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l703"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l704"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l705"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l706"></a> </span><span class=cF6>&quot;\n$WW,1$$PURPLE$$TX+CX,\&quot;Build a ship.\&quot;$$FG$\n\n&quot;</span><span class=cF0>
<a name="l707"></a> </span><span class=cF6>&quot;Sel mass mode.\tLeft-click to place masses.\n&quot;</span><span class=cF0>
<a name="l708"></a> </span><span class=cF6>&quot;Sel spring mode.\tLeft-drag to make members.\n&quot;</span><span class=cF0>
<a name="l709"></a> </span><span class=cF6>&quot;Sel thruster mode.\tPress a digit, 0-9. Drag to make thruster.\n&quot;</span><span class=cF0>
<a name="l710"></a> </span><span class=cF6>&quot;Sel connector mode.\tPress a digit, 0-9. &quot;</span><span class=cF0>
<a name="l711"></a> </span><span class=cF6>&quot;Drag to make breakable connector.\n\n&quot;</span><span class=cF0>
<a name="l712"></a> </span><span class=cF6>&quot;Press $GREEN$&lt;SPACE&gt;$FG$ to run the game. Press digits to operate &quot;</span><span class=cF0>
<a name="l713"></a> </span><span class=cF6>&quot;thrusters and break connectors.\n\n&quot;</span><span class=cF0>
<a name="l714"></a> </span><span class=cF6>&quot;Press $GREEN$&lt;z&gt;$FG$ or $GREEN$&lt;SHIFT-Z&gt;$FG$ to zoom in/out.\n\n&quot;</span><span class=cF0>;
<a name="l715"></a>
<a name="l716"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
<a name="l717"></a> bt_main_mode = </span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>16</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, MMD_MODES_NUM,
<a name="l718"></a> </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>&quot;ST_MAIN_MODES&quot;</span><span class=cF7>)</span><span class=cF0>, main_mode_colors, &amp;main_mode_bttn);
<a name="l719"></a> </span><span class=cF5>PaletteSetLight</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l720"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l721"></a> Init;
<a name="l722"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;draw_it = &amp;</span><span class=cF5>DrawIt</span><span class=cF0>;
<a name="l723"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l724"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l725"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l726"></a> {
<a name="l727"></a> EditShip;
<a name="l728"></a> PlayShip;
<a name="l729"></a> }
<a name="l730"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l731"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l732"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l733"></a> CleanUp;
<a name="l734"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l735"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l736"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l737"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_main_mode);
<a name="l738"></a>}
</span></pre></body>
</html>