templeos-info/public/Wb/Apps/X-Caliber/X-Caliber.HC.HTML

1550 lines
138 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.c00{color:#000000;background-color:#000000;}
.c0A{color:#55ff55;background-color:#000000;}
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> XMSGF_ANTISPIN 0
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> XMSGF_SOLAR_STORM 1
<a name="l3"></a></span><span class=cF5>RegDft</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/XCaliber&quot;</span><span class=cF0>,
<a name="l4"></a> </span><span class=cF6>&quot;I64 best_score=0;\n&quot;</span><span class=cF0>
<a name="l5"></a> </span><span class=cF6>&quot;I64 msg_flags=0;\n&quot;</span><span class=cF0>
<a name="l6"></a> );
<a name="l7"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/XCaliber&quot;</span><span class=cF0>);
<a name="l8"></a>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> MT_HUMAN_SHIP 0
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ENEMY_SHIP 1
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> MT_SOLAR_FLARE 2
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ION 3
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ANTIMATTER_BALL 4
<a name="l14"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ANTIMATTER_SPLAT 5
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> MT_MISSILE 6
<a name="l16"></a>
<a name="l17"></a></span><span class=cF1>class</span><span class=cF0> MyMass:</span><span class=cF9>CMass</span><span class=cF0>
<a name="l18"></a>{
<a name="l19"></a> </span><span class=cF1>F64</span><span class=cF0> temperature,radius,die_timeout;
<a name="l20"></a> </span><span class=cF9>I64</span><span class=cF0> type;
<a name="l21"></a> </span><span class=cF1>Bool</span><span class=cF0> no_overlap;
<a name="l22"></a>};
<a name="l23"></a>
<a name="l24"></a></span><span class=cF1>class</span><span class=cF0> MySpring:</span><span class=cF9>CSpring</span><span class=cF0>
<a name="l25"></a>{
<a name="l26"></a> </span><span class=cF1>F64</span><span class=cF0> strength;
<a name="l27"></a> </span><span class=cF9>I64</span><span class=cF0> color;
<a name="l28"></a>};
<a name="l29"></a>
<a name="l30"></a>#</span><span class=cF1>define</span><span class=cF0> SPIN_GAIN 0.25
<a name="l31"></a>#</span><span class=cF1>define</span><span class=cF0> MASSES_NUM 8
<a name="l32"></a>#</span><span class=cF1>define</span><span class=cF0> SPRINGS_NUM 16
<a name="l33"></a>#</span><span class=cF1>define</span><span class=cF0> MISSILES_NUM 2
<a name="l34"></a>#</span><span class=cF1>define</span><span class=cF0> ST_HUMAN1 0
<a name="l35"></a>#</span><span class=cF1>define</span><span class=cF0> ST_ENEMY1 1
<a name="l36"></a>#</span><span class=cF1>define</span><span class=cF0> ST_ENEMY2 2
<a name="l37"></a></span><span class=cF1>extern</span><span class=cF0> </span><span class=cF1>class</span><span class=cF0> Ship;
<a name="l38"></a>
<a name="l39"></a>#</span><span class=cF1>define</span><span class=cF0> MISSILE_LEN 5
<a name="l40"></a></span><span class=cF1>class</span><span class=cF0> Missile
<a name="l41"></a>{
<a name="l42"></a> Missile *next,*last;
<a name="l43"></a> </span><span class=cF1>F64</span><span class=cF0> tons,fuse_time,die_timeout;
<a name="l44"></a> MyMass p_front,p_back;
<a name="l45"></a> MySpring s[5];
<a name="l46"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
<a name="l47"></a> Ship *owner,*target;
<a name="l48"></a> </span><span class=cF1>Bool</span><span class=cF0> active,launched,exploding;
<a name="l49"></a> </span><span class=cF1>U8</span><span class=cF0> label[5];
<a name="l50"></a>} missile_head;
<a name="l51"></a>
<a name="l52"></a></span><span class=cF1>class</span><span class=cF0> Ship
<a name="l53"></a>{
<a name="l54"></a> Ship *next,*last;
<a name="l55"></a> </span><span class=cF9>I64</span><span class=cF0> type,masses,springs;
<a name="l56"></a> MyMass p[MASSES_NUM];
<a name="l57"></a> MySpring s[SPRINGS_NUM];
<a name="l58"></a> </span><span class=cF1>F64</span><span class=cF0> fire_rate;
<a name="l59"></a> </span><span class=cF1>F64</span><span class=cF0> reload_timeout,spacewalk_timeout;
<a name="l60"></a> </span><span class=cF1>F64</span><span class=cF0> die_time,die_timeout;
<a name="l61"></a> </span><span class=cF9>I64</span><span class=cF0> spacewalk_side;
<a name="l62"></a> </span><span class=cF1>F64</span><span class=cF0> laser_temperature;
<a name="l63"></a> Missile missiles[MISSILES_NUM];
<a name="l64"></a> </span><span class=cF1>Bool</span><span class=cF0> lasering,exploding,laser_overheat;
<a name="l65"></a>} ship_head,*human;
<a name="l66"></a>
<a name="l67"></a></span><span class=cF1>F64</span><span class=cF0> human_t_left,human_t_right,human_antispin;
<a name="l68"></a>
<a name="l69"></a></span><span class=cF1>class</span><span class=cF0> Shot
<a name="l70"></a>{
<a name="l71"></a> Shot *next,*last;
<a name="l72"></a> </span><span class=cF1>F64</span><span class=cF0> radius,fuse_time;
<a name="l73"></a> </span><span class=cF9>I64</span><span class=cF0> splats;
<a name="l74"></a> MyMass p;
<a name="l75"></a>} shot_head;
<a name="l76"></a>
<a name="l77"></a></span><span class=cF1>F64</span><span class=cF0> t_solar_storm;
<a name="l78"></a></span><span class=cF1>Bool</span><span class=cF0> alarm;
<a name="l79"></a>
<a name="l80"></a>#</span><span class=cF1>define</span><span class=cF0> THRUST_MAX 200.0
<a name="l81"></a>#</span><span class=cF1>define</span><span class=cF0> ANTISPIN_MAX 25.0
<a name="l82"></a>#</span><span class=cF1>define</span><span class=cF0> SPACEWALK_TIME 7.5
<a name="l83"></a>
<a name="l84"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_NULL 0
<a name="l85"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_SPIN_LEFT 1
<a name="l86"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_SPIN_RIGHT 2
<a name="l87"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_THRUST 3
<a name="l88"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_FIRE 4
<a name="l89"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_EXIT 5
<a name="l90"></a></span><span class=cF1>Bool</span><span class=cF0> game_over,show_level_msg;
<a name="l91"></a>
<a name="l92"></a>#</span><span class=cF1>define</span><span class=cF0> STARS_NUM 100
<a name="l93"></a></span><span class=cF9>I64</span><span class=cF0> stars_x[STARS_NUM],stars_y[STARS_NUM];
<a name="l94"></a>
<a name="l95"></a></span><span class=cF9>CMathODE</span><span class=cF0> *ode=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l96"></a></span><span class=cF9>I64</span><span class=cF0> level,score,remaining;
<a name="l97"></a>
<a name="l98"></a></span><span class=c0A>
<a name="l99"></a>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l100"></a></span><span class=c0A>
<a name="l101"></a>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l102"></a></span><span class=c0A>
<a name="l103"></a>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l104"></a></span><span class=c0A>
<a name="l105"></a>&lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l106"></a>
<a name="l107"></a></span><span class=c0A>
<a name="l108"></a>&lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l109"></a></span><span class=c0A>
<a name="l110"></a>&lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l111"></a></span><span class=c0A>
<a name="l112"></a>&lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l113"></a></span><span class=c0A>
<a name="l114"></a>&lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l115"></a>
<a name="l116"></a></span><span class=cF0>
<a name="l117"></a></span><span class=cF2>//********************************** Ship</span><span class=cF0>
<a name="l118"></a></span><span class=cF1>Bool</span><span class=cF0> CheckOverlap()
<a name="l119"></a>{
<a name="l120"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
<a name="l121"></a> MyMass *tmpm,*tmpm1;
<a name="l122"></a> tmpm=ode-&gt;next_mass;
<a name="l123"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l124"></a> tmpm1=ode-&gt;next_mass;
<a name="l125"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1!=&amp;ode-&gt;next_mass) {
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm!=tmpm1 &amp;&amp; !tmpm-&gt;no_overlap &amp;&amp; !tmpm1-&gt;no_overlap) </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p,&amp;tmpm-&gt;x,&amp;tmpm1-&gt;x);
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&amp;p</span><span class=cF7>)</span><span class=cF0>&lt;=</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;radius+tmpm1-&gt;radius</span><span class=cF7>)</span><span class=cF0>)
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l131"></a> tmpm1=tmpm1-&gt;next;
<a name="l132"></a> }
<a name="l133"></a> tmpm=tmpm-&gt;next;
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l135"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l136"></a>}
<a name="l137"></a>
<a name="l138"></a></span><span class=cF1>U0</span><span class=cF0> MissileNew(Ship *tmpsp,</span><span class=cF9>I64</span><span class=cF0> n)
<a name="l139"></a>{
<a name="l140"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l141"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l142"></a> Missile *tmpmi=&amp;tmpsp-&gt;missiles[n];
<a name="l143"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpmi,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Missile</span><span class=cF7>)</span><span class=cF0>);
<a name="l144"></a>
<a name="l145"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&amp;tmpmi-&gt;p_front.x,
<a name="l146"></a> </span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;p[n+1].x+tmpsp-&gt;p[n+3].x</span><span class=cF7>)</span><span class=cF0>/2,
<a name="l147"></a> </span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;p[n+1].y+tmpsp-&gt;p[n+3].y</span><span class=cF7>)</span><span class=cF0>/2,0);
<a name="l148"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmpmi-&gt;p_back.x,&amp;tmpmi-&gt;p_front.x);
<a name="l149"></a>
<a name="l150"></a> </span><span class=cF1>if</span><span class=cF0> (n&amp;1)
<a name="l151"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(tmpmi-&gt;label,</span><span class=cF6>&quot;L&quot;</span><span class=cF0>);
<a name="l152"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l153"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(tmpmi-&gt;label,</span><span class=cF6>&quot;R&quot;</span><span class=cF0>);
<a name="l154"></a> tmpmi-&gt;owner=tmpsp;
<a name="l155"></a> tmpmi-&gt;tons=0.5;
<a name="l156"></a> tmpmi-&gt;p_front.mass=0.1;
<a name="l157"></a> tmpmi-&gt;p_front.type=MT_MISSILE;
<a name="l158"></a> tmpmi-&gt;p_back.mass =0.1;
<a name="l159"></a> tmpmi-&gt;p_back.type =MT_MISSILE;
<a name="l160"></a> tmpmi-&gt;p_front.radius=2;
<a name="l161"></a> tmpmi-&gt;p_back.radius =2;
<a name="l162"></a> tmpmi-&gt;p_front.no_overlap=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l163"></a> tmpmi-&gt;p_back.no_overlap =</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[1].x);
<a name="l165"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[2].x);
<a name="l166"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l167"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpmi-&gt;p_front.x,</span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&amp;p1,&amp;p),MISSILE_LEN/2+1</span><span class=cF7>)</span><span class=cF0>);
<a name="l168"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&amp;tmpmi-&gt;p_back.x ,</span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&amp;p1,&amp;p),MISSILE_LEN/2-1</span><span class=cF7>)</span><span class=cF0>);
<a name="l169"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmpmi-&gt;p_front.DxDt,&amp;tmpsp-&gt;p[n].DxDt);
<a name="l170"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmpmi-&gt;p_back.DxDt,&amp;tmpsp-&gt;p[n].DxDt);
<a name="l171"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpmi-&gt;p_front,ode-&gt;last_mass);
<a name="l172"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpmi-&gt;p_back, ode-&gt;last_mass);
<a name="l173"></a>
<a name="l174"></a> tmpmi-&gt;s[0].end1=&amp;tmpmi-&gt;p_front;
<a name="l175"></a> tmpmi-&gt;s[0].end2=&amp;tmpmi-&gt;p_back;
<a name="l176"></a> tmpmi-&gt;s[1].end1=&amp;tmpmi-&gt;p_front;
<a name="l177"></a> tmpmi-&gt;s[1].end2=&amp;tmpsp-&gt;p[n+1];
<a name="l178"></a> tmpmi-&gt;s[2].end1=&amp;tmpmi-&gt;p_back;
<a name="l179"></a> tmpmi-&gt;s[2].end2=&amp;tmpsp-&gt;p[n+1];
<a name="l180"></a> tmpmi-&gt;s[3].end1=&amp;tmpmi-&gt;p_front;
<a name="l181"></a> tmpmi-&gt;s[3].end2=&amp;tmpsp-&gt;p[n+3];
<a name="l182"></a> tmpmi-&gt;s[4].end1=&amp;tmpmi-&gt;p_back;
<a name="l183"></a> tmpmi-&gt;s[4].end2=&amp;tmpsp-&gt;p[n+3];
<a name="l184"></a>
<a name="l185"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;5;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l186"></a> tmpmi-&gt;s[i].const=10000;
<a name="l187"></a> tmpmi-&gt;s[i].strength =20000;
<a name="l188"></a> tmpmi-&gt;s[i].color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l189"></a> tmpmi-&gt;s[i].rest_len=</span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmpmi-&gt;s[i].end1-&gt;x,&amp;tmpmi-&gt;s[i].end2-&gt;x);
<a name="l190"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpmi-&gt;s[i],ode-&gt;last_spring);
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l192"></a> tmpmi-&gt;img=</span><span class=cFA>&lt;7&gt;</span><span class=cF0>;
<a name="l193"></a> tmpmi-&gt;active=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l194"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpmi,missile_head.last);
<a name="l195"></a>}
<a name="l196"></a>
<a name="l197"></a>Ship *ShipNew(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> type)
<a name="l198"></a>{
<a name="l199"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l200"></a> Ship *tmpsp=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Ship</span><span class=cF7>)</span><span class=cF0>);
<a name="l201"></a>
<a name="l202"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp-&gt;type=type) </span><span class=cF7>{</span><span class=cF0>
<a name="l203"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
<a name="l204"></a> tmpsp-&gt;fire_rate=25;
<a name="l205"></a> tmpsp-&gt;masses=5;
<a name="l206"></a> tmpsp-&gt;p[0].x=x;
<a name="l207"></a> tmpsp-&gt;p[0].y=y;
<a name="l208"></a> tmpsp-&gt;p[1].x=x+3;
<a name="l209"></a> tmpsp-&gt;p[1].y=y+10;
<a name="l210"></a> tmpsp-&gt;p[2].x=x-3;
<a name="l211"></a> tmpsp-&gt;p[2].y=y+10;
<a name="l212"></a> tmpsp-&gt;p[3].x=x+20;
<a name="l213"></a> tmpsp-&gt;p[3].y=y+20;
<a name="l214"></a> tmpsp-&gt;p[4].x=x-20;
<a name="l215"></a> tmpsp-&gt;p[4].y=y+20;
<a name="l216"></a>
<a name="l217"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++) {
<a name="l218"></a> tmpsp-&gt;p[i].mass=1;
<a name="l219"></a> tmpsp-&gt;p[i].type=MT_HUMAN_SHIP;
<a name="l220"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;3)
<a name="l221"></a> tmpsp-&gt;p[i].radius=2.5;
<a name="l222"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l223"></a> tmpsp-&gt;p[i].radius=4;
<a name="l224"></a> tmpsp-&gt;p[i].drag_profile_factor=3;
<a name="l225"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;p[i],ode-&gt;last_mass);
<a name="l226"></a> }
<a name="l227"></a> tmpsp-&gt;p[3].mass/=10.0;
<a name="l228"></a> tmpsp-&gt;p[4].mass/=10.0;
<a name="l229"></a>
<a name="l230"></a> tmpsp-&gt;springs=7;
<a name="l231"></a> tmpsp-&gt;s[0].end1=&amp;tmpsp-&gt;p[0];
<a name="l232"></a> tmpsp-&gt;s[0].end2=&amp;tmpsp-&gt;p[1];
<a name="l233"></a> tmpsp-&gt;s[1].end1=&amp;tmpsp-&gt;p[2];
<a name="l234"></a> tmpsp-&gt;s[1].end2=&amp;tmpsp-&gt;p[0];
<a name="l235"></a> tmpsp-&gt;s[2].end1=&amp;tmpsp-&gt;p[1];
<a name="l236"></a> tmpsp-&gt;s[2].end2=&amp;tmpsp-&gt;p[2];
<a name="l237"></a> tmpsp-&gt;s[3].end1=&amp;tmpsp-&gt;p[1];
<a name="l238"></a> tmpsp-&gt;s[3].end2=&amp;tmpsp-&gt;p[3];
<a name="l239"></a> tmpsp-&gt;s[4].end1=&amp;tmpsp-&gt;p[0];
<a name="l240"></a> tmpsp-&gt;s[4].end2=&amp;tmpsp-&gt;p[3];
<a name="l241"></a> tmpsp-&gt;s[5].end1=&amp;tmpsp-&gt;p[2];
<a name="l242"></a> tmpsp-&gt;s[5].end2=&amp;tmpsp-&gt;p[4];
<a name="l243"></a> tmpsp-&gt;s[6].end1=&amp;tmpsp-&gt;p[0];
<a name="l244"></a> tmpsp-&gt;s[6].end2=&amp;tmpsp-&gt;p[4];
<a name="l245"></a>
<a name="l246"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++) {
<a name="l247"></a> tmpsp-&gt;s[i].rest_len=
<a name="l248"></a> </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmpsp-&gt;s[i].end1-&gt;x,&amp;tmpsp-&gt;s[i].end2-&gt;x);
<a name="l249"></a> tmpsp-&gt;s[i].const=10000;
<a name="l250"></a> tmpsp-&gt;s[i].strength =30000;
<a name="l251"></a> </span><span class=cF1>if</span><span class=cF0> (i&lt;=2)
<a name="l252"></a> tmpsp-&gt;s[i].color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l253"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l254"></a> tmpsp-&gt;s[i].color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l255"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;s[i],ode-&gt;last_spring);
<a name="l256"></a> }
<a name="l257"></a> MissileNew(tmpsp,0);
<a name="l258"></a> MissileNew(tmpsp,1);
<a name="l259"></a> remaining=0;
<a name="l260"></a>
<a name="l261"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY1:
<a name="l263"></a> tmpsp-&gt;fire_rate=2.5;
<a name="l264"></a> tmpsp-&gt;masses=3;
<a name="l265"></a> tmpsp-&gt;p[0].x=x;
<a name="l266"></a> tmpsp-&gt;p[0].y=y;
<a name="l267"></a> tmpsp-&gt;p[1].x=x+15;
<a name="l268"></a> tmpsp-&gt;p[1].y=y;
<a name="l269"></a> tmpsp-&gt;p[2].x=x;
<a name="l270"></a> tmpsp-&gt;p[2].y=y+15;
<a name="l271"></a>
<a name="l272"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++) {
<a name="l273"></a> tmpsp-&gt;p[i].mass=1;
<a name="l274"></a> tmpsp-&gt;p[i].type=MT_ENEMY_SHIP;
<a name="l275"></a> tmpsp-&gt;p[i].radius=7;
<a name="l276"></a> tmpsp-&gt;p[i].drag_profile_factor=3;
<a name="l277"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;p[i],ode-&gt;last_mass);
<a name="l278"></a> }
<a name="l279"></a>
<a name="l280"></a> tmpsp-&gt;springs=3;
<a name="l281"></a> tmpsp-&gt;s[0].end1=&amp;tmpsp-&gt;p[0];
<a name="l282"></a> tmpsp-&gt;s[0].end2=&amp;tmpsp-&gt;p[1];
<a name="l283"></a> tmpsp-&gt;s[1].end1=&amp;tmpsp-&gt;p[1];
<a name="l284"></a> tmpsp-&gt;s[1].end2=&amp;tmpsp-&gt;p[2];
<a name="l285"></a> tmpsp-&gt;s[2].end1=&amp;tmpsp-&gt;p[2];
<a name="l286"></a> tmpsp-&gt;s[2].end2=&amp;tmpsp-&gt;p[0];
<a name="l287"></a>
<a name="l288"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++) {
<a name="l289"></a> tmpsp-&gt;s[i].rest_len=
<a name="l290"></a> </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmpsp-&gt;s[i].end1-&gt;x,&amp;tmpsp-&gt;s[i].end2-&gt;x);
<a name="l291"></a> tmpsp-&gt;s[i].const=10000;
<a name="l292"></a> tmpsp-&gt;s[i].strength =20000;
<a name="l293"></a> tmpsp-&gt;s[i].color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l294"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;s[i],ode-&gt;last_spring);
<a name="l295"></a> }
<a name="l296"></a> remaining++;
<a name="l297"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY2:
<a name="l299"></a> tmpsp-&gt;fire_rate=5.0;
<a name="l300"></a> tmpsp-&gt;masses=5;
<a name="l301"></a> tmpsp-&gt;p[0].x=x;
<a name="l302"></a> tmpsp-&gt;p[0].y=y;
<a name="l303"></a> tmpsp-&gt;p[1].x=x-7;
<a name="l304"></a> tmpsp-&gt;p[1].y=y+10;
<a name="l305"></a> tmpsp-&gt;p[2].x=x+7;
<a name="l306"></a> tmpsp-&gt;p[2].y=y+10;
<a name="l307"></a> tmpsp-&gt;p[3].x=x-14;
<a name="l308"></a> tmpsp-&gt;p[3].y=y+20;
<a name="l309"></a> tmpsp-&gt;p[4].x=x+14;
<a name="l310"></a> tmpsp-&gt;p[4].y=y+20;
<a name="l311"></a>
<a name="l312"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++) {
<a name="l313"></a> tmpsp-&gt;p[i].mass=1;
<a name="l314"></a> tmpsp-&gt;p[i].type=MT_ENEMY_SHIP;
<a name="l315"></a> tmpsp-&gt;p[i].radius=6;
<a name="l316"></a> tmpsp-&gt;p[i].drag_profile_factor=5;
<a name="l317"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;p[i],ode-&gt;last_mass);
<a name="l318"></a> }
<a name="l319"></a>
<a name="l320"></a> tmpsp-&gt;springs=7;
<a name="l321"></a> tmpsp-&gt;s[0].end1=&amp;tmpsp-&gt;p[0];
<a name="l322"></a> tmpsp-&gt;s[0].end2=&amp;tmpsp-&gt;p[1];
<a name="l323"></a> tmpsp-&gt;s[1].end1=&amp;tmpsp-&gt;p[0];
<a name="l324"></a> tmpsp-&gt;s[1].end2=&amp;tmpsp-&gt;p[2];
<a name="l325"></a> tmpsp-&gt;s[2].end1=&amp;tmpsp-&gt;p[1];
<a name="l326"></a> tmpsp-&gt;s[2].end2=&amp;tmpsp-&gt;p[2];
<a name="l327"></a> tmpsp-&gt;s[3].end1=&amp;tmpsp-&gt;p[1];
<a name="l328"></a> tmpsp-&gt;s[3].end2=&amp;tmpsp-&gt;p[3];
<a name="l329"></a> tmpsp-&gt;s[4].end1=&amp;tmpsp-&gt;p[2];
<a name="l330"></a> tmpsp-&gt;s[4].end2=&amp;tmpsp-&gt;p[4];
<a name="l331"></a> tmpsp-&gt;s[5].end1=&amp;tmpsp-&gt;p[2];
<a name="l332"></a> tmpsp-&gt;s[5].end2=&amp;tmpsp-&gt;p[3];
<a name="l333"></a> tmpsp-&gt;s[6].end1=&amp;tmpsp-&gt;p[1];
<a name="l334"></a> tmpsp-&gt;s[6].end2=&amp;tmpsp-&gt;p[4];
<a name="l335"></a>
<a name="l336"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++) {
<a name="l337"></a> tmpsp-&gt;s[i].rest_len=
<a name="l338"></a> </span><span class=cF5>D3Dist</span><span class=cF0>(&amp;tmpsp-&gt;s[i].end1-&gt;x,&amp;tmpsp-&gt;s[i].end2-&gt;x);
<a name="l339"></a> tmpsp-&gt;s[i].const= 40000;
<a name="l340"></a> tmpsp-&gt;s[i].strength =75000;
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;=3)
<a name="l342"></a> tmpsp-&gt;s[i].color=</span><span class=cF3>LTPURPLE</span><span class=cF0>;
<a name="l343"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l344"></a> tmpsp-&gt;s[i].color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l345"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmpsp-&gt;s[i],ode-&gt;last_spring);
<a name="l346"></a> }
<a name="l347"></a> remaining++;
<a name="l348"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l350"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpsp,ship_head.last);
<a name="l351"></a> </span><span class=cF1>return</span><span class=cF0> tmpsp;
<a name="l352"></a>}
<a name="l353"></a>
<a name="l354"></a></span><span class=cF1>U0</span><span class=cF0> MissileDel(Missile *tmpmi)
<a name="l355"></a>{
<a name="l356"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l357"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;active) </span><span class=cF7>{</span><span class=cF0>
<a name="l358"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpmi);
<a name="l359"></a> </span><span class=cF1>for</span><span class=cF0>(i=0;i&lt;5;i++)
<a name="l360"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmpmi-&gt;s[i]);
<a name="l361"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmpmi-&gt;p_front);
<a name="l362"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmpmi-&gt;p_back);
<a name="l363"></a> tmpmi-&gt;active=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l364"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l365"></a>}
<a name="l366"></a>
<a name="l367"></a></span><span class=cF1>U0</span><span class=cF0> ShipDel(Ship *tmpsp)
<a name="l368"></a>{
<a name="l369"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp) </span><span class=cF1>return</span><span class=cF0>;
<a name="l371"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++)
<a name="l372"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmpsp-&gt;p[i]);
<a name="l373"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++)
<a name="l374"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmpsp-&gt;s[i]);
<a name="l375"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;2;i++)
<a name="l376"></a> MissileDel(&amp;tmpsp-&gt;missiles[i]);
<a name="l377"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpsp);
<a name="l378"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpsp);
<a name="l379"></a> remaining--;
<a name="l380"></a>}
<a name="l381"></a>
<a name="l382"></a></span><span class=cF1>U0</span><span class=cF0> PlaceShip(</span><span class=cF9>I64</span><span class=cF0> type)
<a name="l383"></a>{
<a name="l384"></a> Ship *tmpsp;
<a name="l385"></a> </span><span class=cF1>if</span><span class=cF0> (CheckOverlap)
<a name="l386"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l388"></a> tmpsp=ShipNew(</span><span class=cF5>RandU16</span><span class=cF0>%</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width-20</span><span class=cF7>)</span><span class=cF0>+10,
<a name="l389"></a> </span><span class=cF5>RandU16</span><span class=cF0>%</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height-20</span><span class=cF7>)</span><span class=cF0>+10,type);
<a name="l390"></a> </span><span class=cF1>if</span><span class=cF0> (CheckOverlap)
<a name="l391"></a> ShipDel(tmpsp);
<a name="l392"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l393"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l394"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l395"></a>}
<a name="l396"></a>
<a name="l397"></a></span><span class=cF2>//********************************** Human Ship</span><span class=cF0>
<a name="l398"></a>
<a name="l399"></a></span><span class=cF9>I64</span><span class=cF0> Tweaked()
<a name="l400"></a>{
<a name="l401"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l402"></a> </span><span class=cF1>if</span><span class=cF0> (human) </span><span class=cF7>{</span><span class=cF0>
<a name="l403"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[0].x,&amp;human-&gt;p[1].x);
<a name="l404"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;human-&gt;p[0].x,&amp;human-&gt;p[2].x);
<a name="l405"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l406"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[0].x,&amp;human-&gt;p[3].x);
<a name="l407"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;human-&gt;p[0].x,&amp;human-&gt;p[4].x);
<a name="l408"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p1);
<a name="l409"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p2);
<a name="l410"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[3].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1</span><span class=cF7>)</span><span class=cF0>&gt;</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>20*</span><span class=cF3>pi</span><span class=cF0>/180</span><span class=cF7>)</span><span class=cF0>)
<a name="l411"></a> </span><span class=cF1>return</span><span class=cF0> 3;
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[5].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p2</span><span class=cF7>)</span><span class=cF0>&gt;</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>20*</span><span class=cF3>pi</span><span class=cF0>/180</span><span class=cF7>)</span><span class=cF0>)
<a name="l413"></a> </span><span class=cF1>return</span><span class=cF0> 4;
<a name="l414"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l415"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l416"></a>}
<a name="l417"></a>
<a name="l418"></a></span><span class=cF1>U0</span><span class=cF0> AllDel(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
<a name="l419"></a>{
<a name="l420"></a> Ship *tmpsp,*tmpsp1;
<a name="l421"></a> </span><span class=cF5>QueRem</span><span class=cF0>(ode);
<a name="l422"></a> tmpsp=ship_head.next;
<a name="l423"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l424"></a> tmpsp1=tmpsp-&gt;next;
<a name="l425"></a> ShipDel(tmpsp);
<a name="l426"></a> tmpsp=tmpsp1;
<a name="l427"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l428"></a> human=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l429"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;shot_head,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l430"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
<a name="l431"></a>}
<a name="l432"></a>
<a name="l433"></a></span><span class=cF1>Bool</span><span class=cF0> LaserPlot(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0>)
<a name="l434"></a>{
<a name="l435"></a> </span><span class=cF9>I64</span><span class=cF0> c;
<a name="l436"></a> c=</span><span class=cF5>GrPeek</span><span class=cF0>(dc,x,y);
<a name="l437"></a> </span><span class=cF1>if</span><span class=cF0> (c!=</span><span class=cF3>BLACK</span><span class=cF0> &amp;&amp; c!=</span><span class=cF3>WHITE</span><span class=cF0>)
<a name="l438"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l439"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l440"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x,y);
<a name="l441"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l442"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l443"></a>}
<a name="l444"></a>
<a name="l445"></a></span><span class=cF2>//**********************************</span><span class=cF0>
<a name="l446"></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="l447"></a>{
<a name="l448"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
<a name="l449"></a> </span><span class=cF1>F64</span><span class=cF0> arg;
<a name="l450"></a> Ship *tmpsp;
<a name="l451"></a> Shot *tmps;
<a name="l452"></a> Missile *tmpmi;
<a name="l453"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l454"></a> </span><span class=cF1>F64</span><span class=cF0> t_left,t_right,spin,d,x,y;
<a name="l455"></a> MySpring *tmpsps;
<a name="l456"></a> MyMass *tmpm;
<a name="l457"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
<a name="l458"></a> </span><span class=cF1>Bool</span><span class=cF0> draw_laser_line=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l459"></a>
<a name="l460"></a> </span><span class=cF1>if</span><span class=cF0> (ode!=task-&gt;last_ode) </span><span class=cF1>return</span><span class=cF0>;
<a name="l461"></a>
<a name="l462"></a> dc-&gt;color=</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l463"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>&quot;Level:%d Score:%d High Score:%d&quot;</span><span class=cF0>,level,score,best_score);
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (game_over) </span><span class=cF7>{</span><span class=cF0>
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l466"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>task-&gt;pix_width-9*</span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0>/2,
<a name="l467"></a> </span><span class=cF7>(</span><span class=cF0>task-&gt;pix_height-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF6>&quot;Game Over&quot;</span><span class=cF0>);
<a name="l468"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (show_level_msg) </span><span class=cF7>{</span><span class=cF0>
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l470"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>task-&gt;pix_width-8*</span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0>/2,
<a name="l471"></a> </span><span class=cF7>(</span><span class=cF0>task-&gt;pix_height-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>/2+50,</span><span class=cF6>&quot;Level %d&quot;</span><span class=cF0>,level);
<a name="l472"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l473"></a>
<a name="l474"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;STARS_NUM;i++)
<a name="l475"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,stars_x[i],stars_y[i]);
<a name="l476"></a>
<a name="l477"></a> tmpm=ode-&gt;next_mass;
<a name="l478"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_ANTIMATTER_SPLAT) {
<a name="l480"></a> dc-&gt;color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,tmpm-&gt;x,tmpm-&gt;y);
<a name="l482"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_ION) {
<a name="l483"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l484"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,tmpm-&gt;x,tmpm-&gt;y);
<a name="l485"></a> }
<a name="l486"></a> tmpm=tmpm-&gt;next;
<a name="l487"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l488"></a>
<a name="l489"></a> tmpsps=ode-&gt;next_spring;
<a name="l490"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsps!=&amp;ode-&gt;next_spring) </span><span class=cF7>{</span><span class=cF0>
<a name="l491"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsps-&gt;flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> &amp;&amp; tmpsps-&gt;color) {
<a name="l492"></a> dc-&gt;color=tmpsps-&gt;color;
<a name="l493"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,tmpsps-&gt;end1-&gt;x,tmpsps-&gt;end1-&gt;y,
<a name="l494"></a> tmpsps-&gt;end2-&gt;x,tmpsps-&gt;end2-&gt;y);
<a name="l495"></a> }
<a name="l496"></a> tmpsps=tmpsps-&gt;next;
<a name="l497"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l498"></a>
<a name="l499"></a> tmpmi=missile_head.next;
<a name="l500"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi!=&amp;missile_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;active) {
<a name="l502"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;launched &amp;&amp; tmpmi-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l503"></a> d=(</span><span class=cF5>tS</span><span class=cF0>-tmpmi-&gt;fuse_time)/(tmpmi-&gt;die_timeout-tmpmi-&gt;fuse_time);
<a name="l504"></a> d=70*</span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF3>pi</span><span class=cF0>*d)*tmpmi-&gt;tons+1;
<a name="l505"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;d;i++) {
<a name="l506"></a> </span><span class=cF1>if</span><span class=cF0> (i&amp;1)
<a name="l507"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l508"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l509"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l510"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpmi-&gt;p_front.x,tmpmi-&gt;p_front.y,i);
<a name="l511"></a> }
<a name="l512"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l513"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>tmpmi-&gt;p_front.x+tmpmi-&gt;p_back.x</span><span class=cF7>)</span><span class=cF0>/2,
<a name="l514"></a> </span><span class=cF7>(</span><span class=cF0>tmpmi-&gt;p_front.y+tmpmi-&gt;p_back.y</span><span class=cF7>)</span><span class=cF0>/2,0,tmpmi-&gt;img,
<a name="l515"></a> </span><span class=cF5>Arg</span><span class=cF7>(</span><span class=cF0>tmpmi-&gt;p_front.x-tmpmi-&gt;p_back.x,
<a name="l516"></a> tmpmi-&gt;p_front.y-tmpmi-&gt;p_back.y</span><span class=cF7>)</span><span class=cF0>);
<a name="l517"></a> }
<a name="l518"></a> tmpmi=tmpmi-&gt;next;
<a name="l519"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l520"></a>
<a name="l521"></a> tmpsp=ship_head.next;
<a name="l522"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp-&gt;exploding) {
<a name="l524"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp-&gt;type) </span><span class=cF7>{</span><span class=cF0>
<a name="l525"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;spacewalk_side) {
<a name="l527"></a> t_left=0;
<a name="l528"></a> t_right=0;
<a name="l529"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (d=</span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[1].x)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l531"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].DxDt,&amp;tmpsp-&gt;p[1].DxDt);
<a name="l532"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l533"></a> spin=p.z/d;
<a name="l534"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l535"></a> spin=0;
<a name="l536"></a> t_left =</span><span class=cF5>Clamp</span><span class=cF0>(human_t_left+SPIN_GAIN*spin*human_antispin,
<a name="l537"></a> 0,THRUST_MAX);
<a name="l538"></a>
<a name="l539"></a> </span><span class=cF1>if</span><span class=cF0> (d=</span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[2].x)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l540"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].DxDt,&amp;tmpsp-&gt;p[2].DxDt);
<a name="l541"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l542"></a> spin=p.z/d;
<a name="l543"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l544"></a> spin=0;
<a name="l545"></a> t_right=</span><span class=cF5>Clamp</span><span class=cF0>(human_t_right-SPIN_GAIN*spin*human_antispin,
<a name="l546"></a> 0,THRUST_MAX);
<a name="l547"></a> }
<a name="l548"></a>
<a name="l549"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[1].x,&amp;tmpsp-&gt;p[0].x);
<a name="l550"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[2].x,&amp;tmpsp-&gt;p[0].x);
<a name="l551"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l552"></a>
<a name="l553"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[3].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>) {
<a name="l554"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l555"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3Mul</span><span class=cF7>(</span><span class=cF0>&amp;p1,t_left/25,&amp;p</span><span class=cF7>)</span><span class=cF0>,&amp;tmpsp-&gt;p[3].x);
<a name="l556"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,tmpsp-&gt;p[1].x,tmpsp-&gt;p[1].y,p1.x,p1.y);
<a name="l557"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p.x,p.y);
<a name="l558"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[3].x,tmpsp-&gt;p[3].y,0,</span><span class=cFA>&lt;thruster&gt;</span><span class=cF0>,arg);
<a name="l559"></a> }
<a name="l560"></a>
<a name="l561"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[5].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>) {
<a name="l562"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l563"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3Mul</span><span class=cF7>(</span><span class=cF0>&amp;p2,t_right/25,&amp;p</span><span class=cF7>)</span><span class=cF0>,&amp;tmpsp-&gt;p[4].x);
<a name="l564"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,tmpsp-&gt;p[2].x,tmpsp-&gt;p[2].y,p2.x,p2.y);
<a name="l565"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p.x,p.y);
<a name="l566"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[4].x,tmpsp-&gt;p[4].y,0,</span><span class=cFA>&lt;thruster&gt;</span><span class=cF0>,arg);
<a name="l567"></a> }
<a name="l568"></a>
<a name="l569"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmpsp-&gt;reload_timeout)
<a name="l570"></a> img=</span><span class=cFA>&lt;gun_ready&gt;</span><span class=cF0>;
<a name="l571"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l572"></a> img=</span><span class=cFA>&lt;gun_busy&gt;</span><span class=cF0>;
<a name="l573"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p.x,p.y);
<a name="l574"></a> </span><span class=cF1>switch</span><span class=cF0> (level) {
<a name="l575"></a> </span><span class=cF1>case</span><span class=cF0> 3:
<a name="l576"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[3].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l577"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[3].x,tmpsp-&gt;p[3].y,0,img,arg);
<a name="l578"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[5].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l579"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[4].x,tmpsp-&gt;p[4].y,0,img,arg);
<a name="l580"></a> </span><span class=cF1>case</span><span class=cF0> 2:
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[1].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l582"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[1].x,tmpsp-&gt;p[1].y,0,img,arg);
<a name="l583"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[2].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l584"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[2].x,tmpsp-&gt;p[2].y,0,img,arg);
<a name="l585"></a> </span><span class=cF1>case</span><span class=cF0> 1:
<a name="l586"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[0].x,tmpsp-&gt;p[0].y,0,img,arg);
<a name="l587"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l588"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l589"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[0].x,tmpsp-&gt;p[0].y,0,</span><span class=cFA>&lt;Laser&gt;</span><span class=cF0>,arg);
<a name="l590"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;lasering &amp;&amp; !tmpsp-&gt;laser_overheat) </span><span class=cF7>{</span><span class=cF0>
<a name="l591"></a> draw_laser_line=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l592"></a> </span><span class=cF5>Snd</span><span class=cF0>(74);
<a name="l593"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l594"></a> }
<a name="l595"></a>
<a name="l596"></a> ctrl_panel.laser_temperature=tmpsp-&gt;laser_temperature;
<a name="l597"></a>
<a name="l598"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;spacewalk_side) {
<a name="l599"></a> d=1.0-(tmpsp-&gt;spacewalk_timeout-</span><span class=cF5>tS</span><span class=cF0>)/SPACEWALK_TIME;
<a name="l600"></a> </span><span class=cF1>if</span><span class=cF0> (d&gt;1.0) </span><span class=cF7>{</span><span class=cF0>
<a name="l601"></a> tmpsp-&gt;spacewalk_side=0;
<a name="l602"></a> ctrl_panel.spacewalk=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l603"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l604"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;0.5) {
<a name="l605"></a> d=d*2;
<a name="l606"></a> x=tmpsp-&gt;p[0].x*(1.0-d)+
<a name="l607"></a> tmpsp-&gt;p[tmpsp-&gt;spacewalk_side].x*(d);
<a name="l608"></a> y=tmpsp-&gt;p[0].y*(1.0-d)+
<a name="l609"></a> tmpsp-&gt;p[tmpsp-&gt;spacewalk_side].y*(d);
<a name="l610"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l611"></a> d=(d-0.5)*2;
<a name="l612"></a> x=tmpsp-&gt;p[tmpsp-&gt;spacewalk_side].x*(1.0-d)+
<a name="l613"></a> tmpsp-&gt;p[0].x*(d);
<a name="l614"></a> y=tmpsp-&gt;p[tmpsp-&gt;spacewalk_side].y*(1.0-d)+
<a name="l615"></a> tmpsp-&gt;p[0].y*(d);
<a name="l616"></a> }
<a name="l617"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,x,y,0,</span><span class=cFA>&lt;spacewalk&gt;</span><span class=cF0>,arg+0.75*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF5>tS</span><span class=cF0>*2</span><span class=cF7>)</span><span class=cF0>);
<a name="l618"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l619"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l620"></a> </span><span class=cF1>if</span><span class=cF0> (ctrl_panel.spacewalk) </span><span class=cF7>{</span><span class=cF0>
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;spacewalk_side=Tweaked)
<a name="l622"></a> tmpsp-&gt;spacewalk_timeout=</span><span class=cF5>tS</span><span class=cF0>+SPACEWALK_TIME;
<a name="l623"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l624"></a> ctrl_panel.spacewalk=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l625"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l626"></a> }
<a name="l627"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l628"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY2:
<a name="l629"></a> </span><span class=cF1>for</span><span class=cF0> (i=3;i&lt;tmpsp-&gt;masses;i++) {
<a name="l630"></a> dc-&gt;color=</span><span class=cF3>PURPLE</span><span class=cF0>;
<a name="l631"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpsp-&gt;p[i].x,tmpsp-&gt;p[i].y,tmpsp-&gt;p[i].radius);
<a name="l632"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,tmpsp-&gt;p[i].x,tmpsp-&gt;p[i].y+2,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l633"></a> dc-&gt;color=</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l634"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpsp-&gt;p[i].x,tmpsp-&gt;p[i].y,tmpsp-&gt;p[i].radius);
<a name="l635"></a> }
<a name="l636"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY1:
<a name="l637"></a> </span><span class=cF5>D3DivEqu</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&amp;p1,&amp;tmpsp-&gt;p[1].x,&amp;tmpsp-&gt;p[0].x</span><span class=cF7>)</span><span class=cF0>,2.0);
<a name="l638"></a> </span><span class=cF5>D3DivEqu</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&amp;p2,&amp;tmpsp-&gt;p[2].x,&amp;tmpsp-&gt;p[0].x</span><span class=cF7>)</span><span class=cF0>,2.0);
<a name="l639"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l640"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmpsp-&gt;reload_timeout)
<a name="l641"></a> img=</span><span class=cFA>&lt;gun_ready&gt;</span><span class=cF0>;
<a name="l642"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l643"></a> img=</span><span class=cFA>&lt;gun_busy&gt;</span><span class=cF0>;
<a name="l644"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p.x,p.y);
<a name="l645"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[0].x,tmpsp-&gt;p[0].y,0,img,arg);
<a name="l646"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p1.x,p1.y);
<a name="l647"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[0].x+p1.x,tmpsp-&gt;p[0].y+p1.y,0,
<a name="l648"></a> </span><span class=cFA>&lt;EnemySide&gt;</span><span class=cF0>,arg);
<a name="l649"></a> arg=</span><span class=cF5>Arg</span><span class=cF0>(p2.x,p2.y);
<a name="l650"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpsp-&gt;p[0].x+p2.x,tmpsp-&gt;p[0].y+p2.y,0,
<a name="l651"></a> </span><span class=cFA>&lt;EnemySide&gt;</span><span class=cF0>,arg);
<a name="l652"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l653"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l654"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l655"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l656"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;p[i].temperature&gt;=1.0)
<a name="l657"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpsp-&gt;p[i].x,tmpsp-&gt;p[i].y,
<a name="l658"></a> tmpsp-&gt;p[i].temperature);
<a name="l659"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l660"></a> }
<a name="l661"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;die_time&lt;=</span><span class=cF5>tS</span><span class=cF0>&lt;=tmpsp-&gt;die_timeout)
<a name="l662"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;tmpsp-&gt;masses;j++) {
<a name="l663"></a> d=(</span><span class=cF5>tS</span><span class=cF0>-tmpsp-&gt;die_time)/(tmpsp-&gt;die_timeout-tmpsp-&gt;die_time);
<a name="l664"></a> d=7*</span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF3>pi</span><span class=cF0>*d)*(6+j)+1;
<a name="l665"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;d;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l666"></a> </span><span class=cF1>if</span><span class=cF0> (i&amp;1)
<a name="l667"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l668"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l669"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l670"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpsp-&gt;p[j].x,tmpsp-&gt;p[j].y,i);
<a name="l671"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l672"></a> }
<a name="l673"></a> tmpsp=tmpsp-&gt;next;
<a name="l674"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l675"></a>
<a name="l676"></a> tmps=shot_head.next;
<a name="l677"></a> </span><span class=cF1>while</span><span class=cF0> (tmps!=&amp;shot_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l678"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;radius&lt;1.0) {
<a name="l679"></a> dc-&gt;color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l680"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,tmps-&gt;p.x,tmps-&gt;p.y);
<a name="l681"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l682"></a> dc-&gt;color=</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l683"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmps-&gt;p.x,tmps-&gt;p.y,tmps-&gt;radius);
<a name="l684"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;radius&gt;=2.0)
<a name="l685"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,tmps-&gt;p.x,tmps-&gt;p.y,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l686"></a> dc-&gt;color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l687"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmps-&gt;p.x,tmps-&gt;p.y,tmps-&gt;radius);
<a name="l688"></a> }
<a name="l689"></a> tmps=tmps-&gt;next;
<a name="l690"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l691"></a>
<a name="l692"></a> </span><span class=cF1>if</span><span class=cF0> (human &amp;&amp; draw_laser_line) </span><span class=cF7>{</span><span class=cF0>
<a name="l693"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[1].x,&amp;human-&gt;p[0].x);
<a name="l694"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;human-&gt;p[2].x,&amp;human-&gt;p[0].x);
<a name="l695"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l696"></a> dc-&gt;color=</span><span class=cF3>LTBLUE</span><span class=cF0>;
<a name="l697"></a> </span><span class=cF5>Line</span><span class=cF0>(dc,human-&gt;p[0].x-10*p.x,human-&gt;p[0].y-10*p.y,0,
<a name="l698"></a> human-&gt;p[0].x-800*p.x,human-&gt;p[0].y-800*p.y,0,&amp;LaserPlot);
<a name="l699"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l700"></a>
<a name="l701"></a> tmpmi=missile_head.next;
<a name="l702"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi!=&amp;missile_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l703"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp=tmpmi-&gt;target) {
<a name="l704"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l705"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpsp-&gt;p[0].x,tmpsp-&gt;p[0].y,10);
<a name="l706"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,tmpsp-&gt;p[0].x+12,tmpsp-&gt;p[0].y-4,tmpmi-&gt;label);
<a name="l707"></a> }
<a name="l708"></a> tmpmi=tmpmi-&gt;next;
<a name="l709"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l710"></a>}
<a name="l711"></a>
<a name="l712"></a></span><span class=cF1>U0</span><span class=cF0> Explosion(MyMass *tmpm1,MyMass *tmpm2,</span><span class=cF1>F64</span><span class=cF0> tons)
<a name="l713"></a>{
<a name="l714"></a> MyMass *tmpm;
<a name="l715"></a> </span><span class=cF9>CD3</span><span class=cF0> p1;
<a name="l716"></a> </span><span class=cF1>F64</span><span class=cF0> d;
<a name="l717"></a>
<a name="l718"></a> tmpm=ode-&gt;next_mass;
<a name="l719"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l720"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm!=tmpm1 &amp;&amp; tmpm!=tmpm2) {
<a name="l721"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpm-&gt;state-&gt;x,&amp;tmpm1-&gt;state-&gt;x);
<a name="l722"></a> d=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p1)-tmpm-&gt;radius*tmpm-&gt;radius;
<a name="l723"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;100.0*100.0) </span><span class=cF7>{</span><span class=cF0>
<a name="l724"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;1)
<a name="l725"></a> d=1;
<a name="l726"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l727"></a> d=</span><span class=cF5>Sqrt</span><span class=cF0>(d);
<a name="l728"></a> d=250000*tons/d`2;
<a name="l729"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p1,d);
<a name="l730"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpm-&gt;DstateDt-&gt;DxDt,&amp;p1);
<a name="l731"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l732"></a> }
<a name="l733"></a> tmpm=tmpm-&gt;next;
<a name="l734"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l735"></a>}
<a name="l736"></a>
<a name="l737"></a>Ship TargetGet(Missile *tmpmi)
<a name="l738"></a>{
<a name="l739"></a> Ship *tmpsp,*res=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l740"></a> </span><span class=cF1>F64</span><span class=cF0> dd,best_dd=</span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l741"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l742"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l743"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;tmpmi-&gt;p_front.state-&gt;x,&amp;tmpmi-&gt;p_back.state-&gt;x</span><span class=cF7>)</span><span class=cF0>);
<a name="l744"></a> tmpsp=ship_head.next;
<a name="l745"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l746"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp-&gt;exploding &amp;&amp; tmpsp!=tmpmi-&gt;owner)
<a name="l747"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++) {
<a name="l748"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[i].state-&gt;x,&amp;tmpmi-&gt;p_front.state-&gt;x);
<a name="l749"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Copy</span><span class=cF7>(</span><span class=cF0>&amp;p2,&amp;p1</span><span class=cF7>)</span><span class=cF0>);
<a name="l750"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p1,&amp;p,&amp;p2);
<a name="l751"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p2</span><span class=cF7>)</span><span class=cF0>&gt;0 &amp;&amp; </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF0>&amp;p1</span><span class=cF7>)</span><span class=cF0>&lt;=</span><span class=cF3>pi</span><span class=cF0>/16) </span><span class=cF7>{</span><span class=cF0>
<a name="l752"></a> dd=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p1);
<a name="l753"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;best_dd) {
<a name="l754"></a> best_dd=dd;
<a name="l755"></a> res=tmpsp;
<a name="l756"></a> }
<a name="l757"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l758"></a> }
<a name="l759"></a> tmpsp=tmpsp-&gt;next;
<a name="l760"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l761"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l762"></a>}
<a name="l763"></a>
<a name="l764"></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="l765"></a>{
<a name="l766"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l767"></a> </span><span class=cF1>F64</span><span class=cF0> d,dd,dd2,spin,t_left,t_right,theta_err,theta_thrust,DthetaDt;
<a name="l768"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=ode-&gt;win_task;
<a name="l769"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l770"></a> Ship *tmpsp;
<a name="l771"></a> Missile *tmpmi;
<a name="l772"></a> MyMass *tmpm,*tmpm1;
<a name="l773"></a>
<a name="l774"></a> tmpm=ode-&gt;next_mass;
<a name="l775"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l776"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type!=MT_SOLAR_FLARE &amp;&amp; tmpm-&gt;type!=MT_ION) {
<a name="l777"></a> d=tmpm-&gt;state-&gt;x;
<a name="l778"></a> </span><span class=cF1>if</span><span class=cF0> (d-tmpm-&gt;radius&lt;0)
<a name="l779"></a> tmpm-&gt;DstateDt-&gt;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-tmpm-&gt;radius)</span><span class=cF7>)</span><span class=cF0>);
<a name="l780"></a> </span><span class=cF1>if</span><span class=cF0> (d+tmpm-&gt;radius&gt;task-&gt;pix_width)
<a name="l781"></a> tmpm-&gt;DstateDt-&gt;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+tmpm-&gt;radius</span><span class=cF7>)</span><span class=cF0>-task-&gt;pix_width)</span><span class=cF7>)</span><span class=cF0>);
<a name="l782"></a> d=tmpm-&gt;state-&gt;y;
<a name="l783"></a> </span><span class=cF1>if</span><span class=cF0> (d-tmpm-&gt;radius&lt;0)
<a name="l784"></a> tmpm-&gt;DstateDt-&gt;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-tmpm-&gt;radius)</span><span class=cF7>)</span><span class=cF0>);
<a name="l785"></a> </span><span class=cF1>if</span><span class=cF0> (d+tmpm-&gt;radius&gt;task-&gt;pix_height)
<a name="l786"></a> tmpm-&gt;DstateDt-&gt;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+tmpm-&gt;radius</span><span class=cF7>)</span><span class=cF0>-task-&gt;pix_height)</span><span class=cF7>)</span><span class=cF0>);
<a name="l787"></a> }
<a name="l788"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type!=MT_ION &amp;&amp; tmpm-&gt;type!=MT_ANTIMATTER_SPLAT) {
<a name="l789"></a> tmpm1=ode-&gt;next_mass;
<a name="l790"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l791"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm!=tmpm1) {
<a name="l792"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1-&gt;type==MT_ANTIMATTER_SPLAT) </span><span class=cF7>{</span><span class=cF0>
<a name="l793"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_HUMAN_SHIP || tmpm-&gt;type==MT_ENEMY_SHIP) {
<a name="l794"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p,&amp;tmpm-&gt;state-&gt;x,&amp;tmpm1-&gt;state-&gt;x);
<a name="l795"></a> dd=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p)+1;
<a name="l796"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;100000) </span><span class=cF7>{</span><span class=cF0>
<a name="l797"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p,100000/dd);
<a name="l798"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpm1-&gt;DstateDt-&gt;DxDt,&amp;p);
<a name="l799"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l800"></a> }
<a name="l801"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm1-&gt;type!=MT_ION) </span><span class=cF7>{</span><span class=cF0>
<a name="l802"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p,&amp;tmpm-&gt;state-&gt;x,&amp;tmpm1-&gt;state-&gt;x);
<a name="l803"></a> dd=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p);
<a name="l804"></a> dd2=</span><span class=cF5>Sqr</span><span class=cF0>(tmpm-&gt;radius+tmpm1-&gt;radius);
<a name="l805"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;=dd2) {
<a name="l806"></a> d=</span><span class=cF5>Sqrt</span><span class=cF0>(dd)+0.0001;
<a name="l807"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p,</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(dd2-dd)</span><span class=cF7>)</span><span class=cF0>/d);
<a name="l808"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpm -&gt;DstateDt-&gt;DxDt,&amp;p);
<a name="l809"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&amp;tmpm1-&gt;DstateDt-&gt;DxDt,&amp;p);
<a name="l810"></a> }
<a name="l811"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l812"></a> }
<a name="l813"></a> tmpm1=tmpm1-&gt;next;
<a name="l814"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l815"></a> }
<a name="l816"></a> tmpm=tmpm-&gt;next;
<a name="l817"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l818"></a>
<a name="l819"></a> tmpsp=ship_head.next;
<a name="l820"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l821"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;exploding &amp;&amp; tmpsp-&gt;die_time&lt;=</span><span class=cF5>tS</span><span class=cF0>&lt;=tmpsp-&gt;die_timeout)
<a name="l822"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++)
<a name="l823"></a> Explosion(&amp;tmpsp-&gt;p[i],</span><span class=cF3>NULL</span><span class=cF0>,tmpsp-&gt;p[i].radius/250.0);
<a name="l824"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp-&gt;type) {
<a name="l825"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
<a name="l826"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l827"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;spacewalk_side) {
<a name="l828"></a> t_left=0;
<a name="l829"></a> t_right=0;
<a name="l830"></a> d=1.0-(tmpsp-&gt;spacewalk_timeout-</span><span class=cF5>tS</span><span class=cF0>)/SPACEWALK_TIME;
<a name="l831"></a> </span><span class=cF1>if</span><span class=cF0> (0.485&lt;d&lt;0.515) </span><span class=cF7>{</span><span class=cF0>
<a name="l832"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;tmpsp-&gt;p[2].state-&gt;x,&amp;tmpsp-&gt;p[1].state-&gt;x</span><span class=cF7>)</span><span class=cF0>);
<a name="l833"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;spacewalk_side==3) {
<a name="l834"></a> tmpsp-&gt;p[3].DstateDt-&gt;DxDt-=10*THRUST_MAX*p.x;
<a name="l835"></a> tmpsp-&gt;p[3].DstateDt-&gt;DyDt-=10*THRUST_MAX*p.y;
<a name="l836"></a> tmpsp-&gt;p[1].DstateDt-&gt;DxDt+=10*THRUST_MAX*p.x;
<a name="l837"></a> tmpsp-&gt;p[1].DstateDt-&gt;DyDt+=10*THRUST_MAX*p.y;
<a name="l838"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l839"></a> tmpsp-&gt;p[4].DstateDt-&gt;DxDt+=10*THRUST_MAX*p.x;
<a name="l840"></a> tmpsp-&gt;p[4].DstateDt-&gt;DyDt+=10*THRUST_MAX*p.y;
<a name="l841"></a> tmpsp-&gt;p[2].DstateDt-&gt;DxDt-=10*THRUST_MAX*p.x;
<a name="l842"></a> tmpsp-&gt;p[2].DstateDt-&gt;DyDt-=10*THRUST_MAX*p.y;
<a name="l843"></a> }
<a name="l844"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l845"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l846"></a> </span><span class=cF1>if</span><span class=cF0> (d=</span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].state-&gt;x,
<a name="l847"></a> &amp;tmpsp-&gt;p[1].state-&gt;x)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l848"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].state-&gt;DxDt,&amp;tmpsp-&gt;p[1].state-&gt;DxDt);
<a name="l849"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l850"></a> spin=p.z/d;
<a name="l851"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l852"></a> spin=0;
<a name="l853"></a> t_left =</span><span class=cF5>Clamp</span><span class=cF0>(human_t_left+SPIN_GAIN*spin*human_antispin,
<a name="l854"></a> 0,THRUST_MAX);
<a name="l855"></a>
<a name="l856"></a> </span><span class=cF1>if</span><span class=cF0> (d=</span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].state-&gt;x,
<a name="l857"></a> &amp;tmpsp-&gt;p[2].state-&gt;x)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l858"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].state-&gt;DxDt,&amp;tmpsp-&gt;p[2].state-&gt;DxDt);
<a name="l859"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l860"></a> spin=p.z/d;
<a name="l861"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l862"></a> spin=0;
<a name="l863"></a> t_right=</span><span class=cF5>Clamp</span><span class=cF0>(human_t_right-SPIN_GAIN*spin*human_antispin,
<a name="l864"></a> 0,THRUST_MAX);
<a name="l865"></a>
<a name="l866"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].state-&gt;x,&amp;tmpsp-&gt;p[1].state-&gt;x);
<a name="l867"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].state-&gt;x,&amp;tmpsp-&gt;p[2].state-&gt;x);
<a name="l868"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l869"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[3].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l870"></a> </span><span class=cF5>D3Mul</span><span class=cF0>(&amp;p1,t_left,&amp;p);
<a name="l871"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpsp-&gt;p[3].DstateDt-&gt;DxDt,&amp;p1);
<a name="l872"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l873"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[5].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l874"></a> </span><span class=cF5>D3Mul</span><span class=cF0>(&amp;p2,t_right,&amp;p);
<a name="l875"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpsp-&gt;p[4].DstateDt-&gt;DxDt,&amp;p2);
<a name="l876"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l877"></a> }
<a name="l878"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l879"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l880"></a> }
<a name="l881"></a> tmpsp=tmpsp-&gt;next;
<a name="l882"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l883"></a>
<a name="l884"></a> tmpmi=missile_head.next;
<a name="l885"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi!=&amp;missile_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l886"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;active) {
<a name="l887"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;launched) </span><span class=cF7>{</span><span class=cF0>
<a name="l888"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;exploding)
<a name="l889"></a> Explosion(&amp;tmpmi-&gt;p_front,&amp;tmpmi-&gt;p_back,tmpmi-&gt;tons);
<a name="l890"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l891"></a></span><span class=cF2>//Guide missile</span><span class=cF0>
<a name="l892"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp=tmpmi-&gt;target) </span><span class=cF7>{</span><span class=cF0>
<a name="l893"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;tmpmi-&gt;p_front.state-&gt;x,
<a name="l894"></a> &amp;tmpmi-&gt;p_back.state-&gt;x</span><span class=cF7>)</span><span class=cF0>);
<a name="l895"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].state-&gt;x,&amp;tmpmi-&gt;p_front.state-&gt;x);
<a name="l896"></a> d=</span><span class=cF5>D3Norm</span><span class=cF0>(&amp;p1);
<a name="l897"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p1);
<a name="l898"></a> theta_err=</span><span class=cF5>D3Dot</span><span class=cF0>(&amp;p,&amp;p1);
<a name="l899"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpmi-&gt;p_front.state-&gt;DxDt,&amp;tmpmi-&gt;p_back.state-&gt;DxDt);
<a name="l900"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&amp;p2,&amp;p,&amp;p1);
<a name="l901"></a> DthetaDt=</span><span class=cF5>D3Norm</span><span class=cF0>(&amp;p2);
<a name="l902"></a> </span><span class=cF1>if</span><span class=cF0> (p2.z&lt;0)
<a name="l903"></a> DthetaDt=-DthetaDt;
<a name="l904"></a> theta_thrust=</span><span class=cF5>Clamp</span><span class=cF0>(200*</span><span class=cF7>(</span><span class=cF0>theta_err+2*DthetaDt</span><span class=cF7>)</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>d+200</span><span class=cF7>)</span><span class=cF0>,-</span><span class=cF3>pi</span><span class=cF0>/8,</span><span class=cF3>pi</span><span class=cF0>/8);
<a name="l905"></a> p2.x=p.x*</span><span class=cF5>Cos</span><span class=cF0>(theta_thrust)-p.y*</span><span class=cF5>Sin</span><span class=cF0>(theta_thrust);
<a name="l906"></a> p2.y=p.y*</span><span class=cF5>Cos</span><span class=cF0>(theta_thrust)+p.x*</span><span class=cF5>Sin</span><span class=cF0>(theta_thrust);
<a name="l907"></a> p2.z=0;
<a name="l908"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmpmi-&gt;p_back.DstateDt-&gt;DxDt,</span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF0>&amp;p2,THRUST_MAX</span><span class=cF7>)</span><span class=cF0>);
<a name="l909"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l910"></a> }
<a name="l911"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l912"></a> tmpmi-&gt;target=TargetGet(tmpmi);
<a name="l913"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l914"></a> tmpmi-&gt;target=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l915"></a> tmpmi=tmpmi-&gt;next;
<a name="l916"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l917"></a>}
<a name="l918"></a>
<a name="l919"></a></span><span class=cF1>U0</span><span class=cF0> CheckDamage()
<a name="l920"></a>{
<a name="l921"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,death_score;
<a name="l922"></a> Ship *tmpsp,*tmpsp1;
<a name="l923"></a> MyMass *tmpm,*tmpm1,*best_mass;
<a name="l924"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l925"></a> </span><span class=cF1>F64</span><span class=cF0> d,best_distance;
<a name="l926"></a> </span><span class=cF1>Bool</span><span class=cF0> facing_sun=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l927"></a>
<a name="l928"></a> </span><span class=cF1>if</span><span class=cF0> (human) </span><span class=cF7>{</span><span class=cF0>
<a name="l929"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[1].x,&amp;human-&gt;p[0].x);
<a name="l930"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;human-&gt;p[2].x,&amp;human-&gt;p[0].x);
<a name="l931"></a> </span><span class=cF5>D3Add</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l932"></a> </span><span class=cF1>if</span><span class=cF0> (p.x&gt;0)
<a name="l933"></a> facing_sun=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l934"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l935"></a>
<a name="l936"></a> tmpm=ode-&gt;next_mass;
<a name="l937"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l938"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_ION) {
<a name="l939"></a> </span><span class=cF1>if</span><span class=cF0> (facing_sun) </span><span class=cF7>{</span><span class=cF0>
<a name="l940"></a> tmpm1=ode-&gt;next_mass;
<a name="l941"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1!=&amp;ode-&gt;next_mass) {
<a name="l942"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1-&gt;type==MT_HUMAN_SHIP) </span><span class=cF7>{</span><span class=cF0>
<a name="l943"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p,&amp;tmpm1-&gt;x,&amp;tmpm-&gt;x);
<a name="l944"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&amp;p</span><span class=cF7>)</span><span class=cF0>&lt;</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm1-&gt;radius</span><span class=cF7>)</span><span class=cF0>)
<a name="l945"></a> tmpm1-&gt;temperature+=3.0;
<a name="l946"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l947"></a> tmpm1=tmpm1-&gt;next;
<a name="l948"></a> }
<a name="l949"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l950"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_ANTIMATTER_SPLAT) {
<a name="l951"></a> tmpm1=ode-&gt;next_mass;
<a name="l952"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l953"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1-&gt;type!=MT_ION &amp;&amp; tmpm1-&gt;type!=MT_ANTIMATTER_SPLAT) {
<a name="l954"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p,&amp;tmpm1-&gt;x,&amp;tmpm-&gt;x);
<a name="l955"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&amp;p</span><span class=cF7>)</span><span class=cF0>&lt;</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm1-&gt;radius</span><span class=cF7>)</span><span class=cF0>)
<a name="l956"></a> tmpm1-&gt;temperature+=0.4;
<a name="l957"></a> }
<a name="l958"></a> tmpm1=tmpm1-&gt;next;
<a name="l959"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l960"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l961"></a> tmpm-&gt;temperature*=0.9;
<a name="l962"></a> tmpm=tmpm-&gt;next;
<a name="l963"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l964"></a>
<a name="l965"></a> </span><span class=cF1>if</span><span class=cF0> (human) </span><span class=cF7>{</span><span class=cF0>
<a name="l966"></a> human-&gt;laser_temperature*=0.975;
<a name="l967"></a>
<a name="l968"></a> </span><span class=cF1>if</span><span class=cF0> (human-&gt;laser_overheat) {
<a name="l969"></a> </span><span class=cF1>if</span><span class=cF0> (human-&gt;laser_temperature&lt;LASER_THRESHOLD_TEMP)
<a name="l970"></a> human-&gt;laser_overheat=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l971"></a> }
<a name="l972"></a> </span><span class=cF1>if</span><span class=cF0> (!human-&gt;laser_overheat &amp;&amp; human-&gt;lasering) {
<a name="l973"></a> </span><span class=cF1>if</span><span class=cF0> (human-&gt;laser_temperature&gt;=LASER_TEMP_MAX) </span><span class=cF7>{</span><span class=cF0>
<a name="l974"></a> human-&gt;laser_overheat=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l975"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l976"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l977"></a> human-&gt;laser_temperature+=1.0;
<a name="l978"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[0].x,&amp;human-&gt;p[1].x);
<a name="l979"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;human-&gt;p[0].x,&amp;human-&gt;p[2].x);
<a name="l980"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l981"></a> p2.x=p.y;
<a name="l982"></a> p2.y=-p.x;
<a name="l983"></a> p2.z=0;
<a name="l984"></a> best_mass=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l985"></a> best_distance=</span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l986"></a> tmpm=ode-&gt;next_mass;
<a name="l987"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) {
<a name="l988"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[0].x,&amp;tmpm-&gt;x);
<a name="l989"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF5>D3Dot</span><span class=cF0>(&amp;p1,&amp;p2)</span><span class=cF7>)</span><span class=cF0>&lt;tmpm-&gt;radius &amp;&amp;
<a name="l990"></a> </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&amp;p1,&amp;p</span><span class=cF7>)</span><span class=cF0>&lt;0.0) </span><span class=cF7>{</span><span class=cF0>
<a name="l991"></a> d=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&amp;p1);
<a name="l992"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;best_distance) {
<a name="l993"></a> best_distance=d;
<a name="l994"></a> best_mass=tmpm;
<a name="l995"></a> }
<a name="l996"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l997"></a> tmpm=tmpm-&gt;next;
<a name="l998"></a> }
<a name="l999"></a> </span><span class=cF1>if</span><span class=cF0> (best_mass)
<a name="l1000"></a> best_mass-&gt;temperature+=1.0;
<a name="l1001"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1002"></a> }
<a name="l1003"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1004"></a>
<a name="l1005"></a> tmpsp=ship_head.next;
<a name="l1006"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l1007"></a> tmpsp1=tmpsp-&gt;next;
<a name="l1008"></a> death_score=0;
<a name="l1009"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp-&gt;type) {
<a name="l1010"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
<a name="l1011"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l1012"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmpsp-&gt;die_timeout) {
<a name="l1013"></a> ShipDel(tmpsp);
<a name="l1014"></a> human=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1015"></a> }
<a name="l1016"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1017"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1018"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[i].f</span><span class=cF7>)</span><span class=cF0>&gt;tmpsp-&gt;s[i].strength) {
<a name="l1019"></a> tmpsp-&gt;s[i].flags|=</span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
<a name="l1020"></a> </span><span class=cF1>if</span><span class=cF0> (i==4)
<a name="l1021"></a> MissileDel(&amp;tmpsp-&gt;missiles[0]);
<a name="l1022"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i==5)
<a name="l1023"></a> MissileDel(&amp;tmpsp-&gt;missiles[1]);
<a name="l1024"></a> }
<a name="l1025"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;s[i].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF0> &amp;&amp; i&lt;3)
<a name="l1026"></a> death_score++;
<a name="l1027"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1028"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1029"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l1030"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l1031"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmpsp-&gt;die_timeout) {
<a name="l1032"></a> ShipDel(tmpsp);
<a name="l1033"></a> score+=level;
<a name="l1034"></a> </span><span class=cF1>if</span><span class=cF0> (score&gt;best_score)
<a name="l1035"></a> best_score=score;
<a name="l1036"></a> }
<a name="l1037"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1038"></a> j=0;
<a name="l1039"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;springs;i++) {
<a name="l1040"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;s[i].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF0>)
<a name="l1041"></a> j++;
<a name="l1042"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>tmpsp-&gt;s[i].f</span><span class=cF7>)</span><span class=cF0>&gt;tmpsp-&gt;s[i].strength) </span><span class=cF7>{</span><span class=cF0>
<a name="l1043"></a> tmpsp-&gt;s[i].flags|=</span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
<a name="l1044"></a> j++;
<a name="l1045"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1046"></a> }
<a name="l1047"></a> </span><span class=cF1>if</span><span class=cF0> (j&gt;1)
<a name="l1048"></a> death_score++;
<a name="l1049"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1050"></a> }
<a name="l1051"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp-&gt;exploding) {
<a name="l1052"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpsp-&gt;masses;i++)
<a name="l1053"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;p[i].temperature&gt;MASS_TEMP_MAX)
<a name="l1054"></a> death_score++;
<a name="l1055"></a> </span><span class=cF1>if</span><span class=cF0> (death_score) </span><span class=cF7>{</span><span class=cF0>
<a name="l1056"></a> tmpsp-&gt;exploding=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1057"></a> tmpsp-&gt;die_time=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l1058"></a> tmpsp-&gt;die_timeout=</span><span class=cF5>tS</span><span class=cF0>+0.75;
<a name="l1059"></a> </span><span class=cF5>Noise</span><span class=cF0>(750,74,93);
<a name="l1060"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp-&gt;type==ST_HUMAN1)
<a name="l1061"></a> game_over=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1062"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1063"></a> }
<a name="l1064"></a> tmpsp=tmpsp1;
<a name="l1065"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1066"></a>}
<a name="l1067"></a>
<a name="l1068"></a></span><span class=cF2>//********************************** Shots</span><span class=cF0>
<a name="l1069"></a>
<a name="l1070"></a>Shot *ShotNew(</span><span class=cF9>I64</span><span class=cF0> type,</span><span class=cF9>CD3</span><span class=cF0> *_p,</span><span class=cF9>CD3</span><span class=cF0> *_v,</span><span class=cF1>F64</span><span class=cF0> r,</span><span class=cF1>F64</span><span class=cF0> fuse_time,
<a name="l1071"></a> </span><span class=cF9>CD3</span><span class=cF0> *_p_gun_offset=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l1072"></a>{
<a name="l1073"></a> Shot *tmps=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Shot</span><span class=cF7>)</span><span class=cF0>);
<a name="l1074"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmps-&gt;p.x,_p);
<a name="l1075"></a> tmps-&gt;radius=r;
<a name="l1076"></a> tmps-&gt;splats=20*r;
<a name="l1077"></a> tmps-&gt;fuse_time=</span><span class=cF5>tS</span><span class=cF0>+fuse_time;
<a name="l1078"></a> tmps-&gt;p.mass=0.3*r*r*r;
<a name="l1079"></a> tmps-&gt;p.type=type;
<a name="l1080"></a> </span><span class=cF1>if</span><span class=cF0> (_p_gun_offset)
<a name="l1081"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&amp;tmps-&gt;p.x,_p_gun_offset);
<a name="l1082"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmps-&gt;p.DxDt,_v);
<a name="l1083"></a> </span><span class=cF5>QueIns</span><span class=cF0>(&amp;tmps-&gt;p,ode-&gt;last_mass);
<a name="l1084"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmps,shot_head.last);
<a name="l1085"></a>}
<a name="l1086"></a>
<a name="l1087"></a></span><span class=cF1>U0</span><span class=cF0> SolarFlares()
<a name="l1088"></a>{
<a name="l1089"></a> </span><span class=cF9>CD3</span><span class=cF0> p,v,p1,p2;
<a name="l1090"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=ode-&gt;win_task;
<a name="l1091"></a> </span><span class=cF1>if</span><span class=cF0> (!alarm &amp;&amp; t_solar_storm-2.0&lt;</span><span class=cF5>tS</span><span class=cF0>&lt;t_solar_storm+1.0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1092"></a> </span><span class=cF5>Sweep</span><span class=cF0>(2000,74,93);
<a name="l1093"></a> alarm=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1094"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1095"></a> </span><span class=cF1>if</span><span class=cF0> (t_solar_storm&lt;</span><span class=cF5>tS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//If solar storm has arrived</span><span class=cF0>
<a name="l1096"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&lt;t_solar_storm+5.0) { </span><span class=cF2>//If solar storm not over</span><span class=cF0>
<a name="l1097"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0>&lt;.1) </span><span class=cF7>{</span><span class=cF0>
<a name="l1098"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&amp;p,-300,</span><span class=cF5>Rand</span><span class=cF0>*task-&gt;pix_height,0);
<a name="l1099"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&amp;v,200.0,0,0);
<a name="l1100"></a> ShotNew(MT_SOLAR_FLARE,&amp;p,&amp;v,25,0.1);
<a name="l1101"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1102"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1103"></a> t_solar_storm=</span><span class=cF5>tS</span><span class=cF0>+25*</span><span class=cF5>Rand</span><span class=cF0>; </span><span class=cF2>//Schedule next solar storm</span><span class=cF0>
<a name="l1104"></a> alarm=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1105"></a> }
<a name="l1106"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1107"></a>}
<a name="l1108"></a>
<a name="l1109"></a></span><span class=cF1>U0</span><span class=cF0> FireOneGun(Ship *tmpsp,</span><span class=cF9>I64</span><span class=cF0> n,</span><span class=cF1>F64</span><span class=cF0> r,</span><span class=cF1>F64</span><span class=cF0> fuse_time)
<a name="l1110"></a>{
<a name="l1111"></a> </span><span class=cF9>I64</span><span class=cF0> ona;
<a name="l1112"></a> </span><span class=cF9>CD3</span><span class=cF0> p,v,p1,p2;
<a name="l1113"></a> Shot *tmps;
<a name="l1114"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[1].x);
<a name="l1115"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[2].x);
<a name="l1116"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&amp;p,&amp;p1,&amp;p2</span><span class=cF7>)</span><span class=cF0>);
<a name="l1117"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(</span><span class=cF5>D3Copy</span><span class=cF7>(</span><span class=cF0>&amp;p1,&amp;p</span><span class=cF7>)</span><span class=cF0>,r+tmpsp-&gt;p[0].radius+5);
<a name="l1118"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&amp;v,&amp;p),1000/(r+1)</span><span class=cF7>)</span><span class=cF0>,&amp;tmpsp-&gt;p[n].DxDt);
<a name="l1119"></a> tmps=ShotNew(MT_ANTIMATTER_BALL,&amp;tmpsp-&gt;p[n].x,&amp;v,r,fuse_time,&amp;p1);
<a name="l1120"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&amp;p,tmps-&gt;p.mass/tmpsp-&gt;p[n].mass/100.0);
<a name="l1121"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&amp;tmpsp-&gt;p[n].DxDt,&amp;p);
<a name="l1122"></a> tmpsp-&gt;reload_timeout=</span><span class=cF5>tS</span><span class=cF0>+r/tmpsp-&gt;fire_rate;
<a name="l1123"></a> ona=</span><span class=cF5>Freq2Ona</span><span class=cF0>(500/r);
<a name="l1124"></a> </span><span class=cF5>Noise</span><span class=cF0>(100,ona,ona+12);
<a name="l1125"></a>}
<a name="l1126"></a>
<a name="l1127"></a></span><span class=cF1>U0</span><span class=cF0> FireOneMissile(Ship *tmpsp,</span><span class=cF9>I64</span><span class=cF0> n)
<a name="l1128"></a>{
<a name="l1129"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1130"></a> Missile *tmpmi=&amp;tmpsp-&gt;missiles[n];
<a name="l1131"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpmi-&gt;launched &amp;&amp; tmpmi-&gt;target) </span><span class=cF7>{</span><span class=cF0>
<a name="l1132"></a> tmpmi-&gt;fuse_time=</span><span class=cF5>tS</span><span class=cF0>+1.0;
<a name="l1133"></a> tmpmi-&gt;die_timeout=tmpmi-&gt;fuse_time+0.125;
<a name="l1134"></a> tmpmi-&gt;img=</span><span class=cFA>&lt;8&gt;</span><span class=cF0>;
<a name="l1135"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i&lt;5;i++)
<a name="l1136"></a> tmpmi-&gt;s[i].flags|=</span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
<a name="l1137"></a> tmpmi-&gt;launched=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1138"></a> </span><span class=cF5>Sweep</span><span class=cF0>(250,53,56);
<a name="l1139"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1140"></a>}
<a name="l1141"></a>
<a name="l1142"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireGunBegin()
<a name="l1143"></a>{
<a name="l1144"></a> </span><span class=cF1>F64</span><span class=cF0> r=3.0*ctrl_panel.shot_radius/CTRL_PANEL_RANGE+0.5,
<a name="l1145"></a> fuse_time=</span><span class=cF5>ToF64</span><span class=cF0>(ctrl_panel.fuse_time+1)/CTRL_PANEL_RANGE;
<a name="l1146"></a> </span><span class=cF1>if</span><span class=cF0> (human) </span><span class=cF7>{</span><span class=cF0>
<a name="l1147"></a> </span><span class=cF1>if</span><span class=cF0> (!human-&gt;exploding &amp;&amp; !human-&gt;spacewalk_side &amp;&amp; </span><span class=cF5>tS</span><span class=cF0>&gt;human-&gt;reload_timeout)
<a name="l1148"></a> </span><span class=cF1>switch</span><span class=cF0> (level) {
<a name="l1149"></a> </span><span class=cF1>case</span><span class=cF0> 3:
<a name="l1150"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[3].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1151"></a> FireOneGun(human,3,r,fuse_time);
<a name="l1152"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[5].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1153"></a> FireOneGun(human,4,r,fuse_time);
<a name="l1154"></a> </span><span class=cF1>case</span><span class=cF0> 2:
<a name="l1155"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[1].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1156"></a> FireOneGun(human,1,r,fuse_time);
<a name="l1157"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human-&gt;s[2].flags&amp;</span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1158"></a> FireOneGun(human,2,r,fuse_time);
<a name="l1159"></a> </span><span class=cF1>case</span><span class=cF0> 1:
<a name="l1160"></a> FireOneGun(human,0,r,fuse_time);
<a name="l1161"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1162"></a> }
<a name="l1163"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1164"></a>}
<a name="l1165"></a>
<a name="l1166"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireMissileBegin(</span><span class=cF9>I64</span><span class=cF0> n)
<a name="l1167"></a>{
<a name="l1168"></a> </span><span class=cF1>if</span><span class=cF0> (human &amp;&amp; !human-&gt;exploding &amp;&amp;
<a name="l1169"></a> !human-&gt;spacewalk_side &amp;&amp; </span><span class=cF5>tS</span><span class=cF0>&gt;human-&gt;reload_timeout)
<a name="l1170"></a> FireOneMissile(human,n);
<a name="l1171"></a>}
<a name="l1172"></a>
<a name="l1173"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireLaserBegin()
<a name="l1174"></a>{
<a name="l1175"></a> </span><span class=cF1>if</span><span class=cF0> (human &amp;&amp; !human-&gt;exploding &amp;&amp;
<a name="l1176"></a> !human-&gt;spacewalk_side &amp;&amp; </span><span class=cF5>tS</span><span class=cF0>&gt;human-&gt;reload_timeout)
<a name="l1177"></a> human-&gt;lasering=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1178"></a>}
<a name="l1179"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireLaserEnd()
<a name="l1180"></a>{
<a name="l1181"></a> </span><span class=cF1>if</span><span class=cF0> (human &amp;&amp; !human-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l1182"></a> human-&gt;lasering=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1183"></a> </span><span class=cF5>Snd</span><span class=cF0>;
<a name="l1184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1185"></a>}
<a name="l1186"></a>
<a name="l1187"></a></span><span class=cF1>U0</span><span class=cF0> SplatNew(Shot *tmps,</span><span class=cF1>F64</span><span class=cF0> die_time,</span><span class=cF1>F64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>,</span><span class=cF1>F64</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0>)
<a name="l1188"></a>{
<a name="l1189"></a> MyMass *tmpm;
<a name="l1190"></a> </span><span class=cF1>F64</span><span class=cF0> theta=</span><span class=cF5>Arg</span><span class=cF0>(tmps-&gt;p.DxDt,tmps-&gt;p.DyDt);
<a name="l1191"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1192"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmps-&gt;splats;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1193"></a> 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="l1194"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmpm-&gt;x,&amp;tmps-&gt;p.x);
<a name="l1195"></a> tmpm-&gt;radius=1;
<a name="l1196"></a> tmpm-&gt;mass=1;
<a name="l1197"></a> tmpm-&gt;die_timeout=</span><span class=cF5>tS</span><span class=cF0>+die_time;
<a name="l1198"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;p.type==MT_SOLAR_FLARE)
<a name="l1199"></a> tmpm-&gt;type=MT_ION;
<a name="l1200"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1201"></a> tmpm-&gt;type=MT_ANTIMATTER_SPLAT;
<a name="l1202"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&amp;tmpm-&gt;DxDt,&amp;tmps-&gt;p.DxDt);
<a name="l1203"></a> tmpm-&gt;DxDt+=50*</span><span class=cF5>Sqr</span><span class=cF0>(tmps-&gt;radius)*</span><span class=cF5>Rand</span><span class=cF0>*
<a name="l1204"></a> </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0>+theta+</span><span class=cF7>(</span><span class=cF1>end</span><span class=cF0>-</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>*i/tmps-&gt;splats);
<a name="l1205"></a> tmpm-&gt;DyDt+=50*</span><span class=cF5>Sqr</span><span class=cF0>(tmps-&gt;radius)*</span><span class=cF5>Rand</span><span class=cF0>*
<a name="l1206"></a> </span><span class=cF5>Cos</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0>+theta+</span><span class=cF7>(</span><span class=cF1>end</span><span class=cF0>-</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>*i/tmps-&gt;splats);
<a name="l1207"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpm,ode-&gt;last_mass);
<a name="l1208"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1209"></a>}
<a name="l1210"></a>
<a name="l1211"></a></span><span class=cF1>U0</span><span class=cF0> ExpireShots()
<a name="l1212"></a>{
<a name="l1213"></a> Shot *tmps=shot_head.next,*tmps1;
<a name="l1214"></a> </span><span class=cF1>while</span><span class=cF0> (tmps!=&amp;shot_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l1215"></a> tmps1=tmps-&gt;next;
<a name="l1216"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmps-&gt;fuse_time) {
<a name="l1217"></a> </span><span class=cF1>if</span><span class=cF0> (tmps-&gt;p.type==MT_SOLAR_FLARE)
<a name="l1218"></a> SplatNew(tmps,1.0,3*</span><span class=cF3>pi</span><span class=cF0>/8,5*</span><span class=cF3>pi</span><span class=cF0>/8);
<a name="l1219"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1220"></a> SplatNew(tmps,.2,0,2*</span><span class=cF3>pi</span><span class=cF0>);
<a name="l1221"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmps);
<a name="l1222"></a> </span><span class=cF5>QueRem</span><span class=cF0>(&amp;tmps-&gt;p);
<a name="l1223"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
<a name="l1224"></a> }
<a name="l1225"></a> tmps=tmps1;
<a name="l1226"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1227"></a>}
<a name="l1228"></a>
<a name="l1229"></a></span><span class=cF1>U0</span><span class=cF0> ExpireSplats()
<a name="l1230"></a>{
<a name="l1231"></a> MyMass *tmpm,*tmpm1;
<a name="l1232"></a> tmpm=ode-&gt;next_mass;
<a name="l1233"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l1234"></a> tmpm1=tmpm-&gt;next;
<a name="l1235"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;type==MT_ION || tmpm-&gt;type==MT_ANTIMATTER_SPLAT</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l1236"></a> </span><span class=cF5>tS</span><span class=cF0>&gt;tmpm-&gt;die_timeout) {
<a name="l1237"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpm);
<a name="l1238"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
<a name="l1239"></a> }
<a name="l1240"></a> tmpm=tmpm1;
<a name="l1241"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1242"></a>}
<a name="l1243"></a>
<a name="l1244"></a></span><span class=cF1>U0</span><span class=cF0> ExpireMissiles()
<a name="l1245"></a>{
<a name="l1246"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1247"></a> </span><span class=cF1>F64</span><span class=cF0> dd,best_dd;
<a name="l1248"></a> Missile *tmpmi=missile_head.next,*tmpm1;
<a name="l1249"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi!=&amp;missile_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l1250"></a> tmpm1=tmpmi-&gt;next;
<a name="l1251"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;launched) {
<a name="l1252"></a> best_dd=</span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l1253"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi-&gt;target)
<a name="l1254"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;tmpmi-&gt;target-&gt;masses;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1255"></a> dd=</span><span class=cF5>D3DistSqr</span><span class=cF0>(&amp;tmpmi-&gt;p_front.x,&amp;tmpmi-&gt;target-&gt;p[i].x);
<a name="l1256"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;best_dd)
<a name="l1257"></a> best_dd=dd;
<a name="l1258"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1259"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpmi-&gt;exploding &amp;&amp; </span><span class=cF7>(</span><span class=cF0>best_dd&lt;30*30 || </span><span class=cF5>tS</span><span class=cF0>&gt;tmpmi-&gt;fuse_time</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1260"></a> tmpmi-&gt;p_front.mass=10.0; </span><span class=cF2>//They go flying, if too light.</span><span class=cF0>
<a name="l1261"></a> tmpmi-&gt;p_back.mass =10.0;
<a name="l1262"></a> tmpmi-&gt;exploding=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1263"></a> </span><span class=cF5>Noise</span><span class=cF0>(50,93,105);
<a name="l1264"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&gt;tmpmi-&gt;die_timeout)
<a name="l1265"></a> MissileDel(tmpmi);
<a name="l1266"></a> }
<a name="l1267"></a> tmpmi=tmpm1;
<a name="l1268"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1269"></a>}
<a name="l1270"></a>
<a name="l1271"></a></span><span class=cF2>//********************************** AI</span><span class=cF0>
<a name="l1272"></a>
<a name="l1273"></a></span><span class=cF1>U0</span><span class=cF0> AI()
<a name="l1274"></a>{
<a name="l1275"></a> </span><span class=cF9>CD3</span><span class=cF0> p,p1,p2;
<a name="l1276"></a> Ship *tmpsp=ship_head.next;
<a name="l1277"></a> </span><span class=cF1>if</span><span class=cF0> (human &amp;&amp; !human-&gt;exploding) </span><span class=cF7>{</span><span class=cF0>
<a name="l1278"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp!=&amp;ship_head) {
<a name="l1279"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[1].x);
<a name="l1280"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p2,&amp;tmpsp-&gt;p[0].x,&amp;tmpsp-&gt;p[2].x);
<a name="l1281"></a> </span><span class=cF5>D3Add</span><span class=cF0>(&amp;p,&amp;p1,&amp;p2);
<a name="l1282"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&amp;p1,&amp;human-&gt;p[0].x,&amp;tmpsp-&gt;p[0].x);
<a name="l1283"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p),</span><span class=cF5>D3Unit</span><span class=cF0>(&amp;p1)</span><span class=cF7>)</span><span class=cF0>&gt;0.995 &amp;&amp;
<a name="l1284"></a> </span><span class=cF5>tS</span><span class=cF0>&gt;tmpsp-&gt;reload_timeout) </span><span class=cF7>{</span><span class=cF0>
<a name="l1285"></a> FireOneGun(tmpsp,0,1.5+.5,.4);
<a name="l1286"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1287"></a> tmpsp=tmpsp-&gt;next;
<a name="l1288"></a> }
<a name="l1289"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1290"></a>}
<a name="l1291"></a>
<a name="l1292"></a></span><span class=cF2>//********************************** Init</span><span class=cF0>
<a name="l1293"></a></span><span class=cF1>U0</span><span class=cF0> InitLevel()
<a name="l1294"></a>{
<a name="l1295"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1296"></a> MyMass *tmpm,*tmpm1;
<a name="l1297"></a>
<a name="l1298"></a> t_solar_storm=0;
<a name="l1299"></a>
<a name="l1300"></a> tmpm=ode-&gt;next_mass;
<a name="l1301"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm!=&amp;ode-&gt;next_mass) </span><span class=cF7>{</span><span class=cF0>
<a name="l1302"></a> tmpm1=tmpm-&gt;next;
<a name="l1303"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;type==MT_ION || tmpm-&gt;type==MT_ANTIMATTER_SPLAT) {
<a name="l1304"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpm);
<a name="l1305"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
<a name="l1306"></a> }
<a name="l1307"></a> tmpm=tmpm1;
<a name="l1308"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1309"></a> </span><span class=cF1>if</span><span class=cF0> (level==1)
<a name="l1310"></a> </span><span class=cF5>OneTimePopUp</span><span class=cF0>(&amp;msg_flags,XMSGF_SOLAR_STORM,
<a name="l1311"></a> </span><span class=cF6>&quot;Face away from Sun in solar storm.\n&quot;</span><span class=cF0>);
<a name="l1312"></a> </span><span class=cF1>if</span><span class=cF0> (level==4)
<a name="l1313"></a> </span><span class=cF5>OneTimePopUp</span><span class=cF0>(&amp;msg_flags,XMSGF_ANTISPIN,
<a name="l1314"></a> </span><span class=cF6>&quot;Press $GREEN$&lt;CURSOR-DOWN&gt;$FG$ for anti-spin stabilizer.\n&quot;</span><span class=cF0>);
<a name="l1315"></a> human=ShipNew(</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2,ST_HUMAN1);
<a name="l1316"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;level+2;i++)
<a name="l1317"></a> PlaceShip(ST_ENEMY1);
<a name="l1318"></a> PlaceShip(ST_ENEMY2);
<a name="l1319"></a> show_level_msg=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1320"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
<a name="l1321"></a>}
<a name="l1322"></a>
<a name="l1323"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l1324"></a>{
<a name="l1325"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l1326"></a> game_over=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1327"></a> score=0;
<a name="l1328"></a> level=1;
<a name="l1329"></a>
<a name="l1330"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;ship_head);
<a name="l1331"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;shot_head);
<a name="l1332"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&amp;missile_head);
<a name="l1333"></a>
<a name="l1334"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;STARS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1335"></a> stars_x[i]=</span><span class=cF5>RandU16</span><span class=cF0>%</span><span class=cF3>GR_WIDTH</span><span class=cF0>;
<a name="l1336"></a> stars_y[i]=</span><span class=cF5>RandU16</span><span class=cF0>%</span><span class=cF3>GR_HEIGHT</span><span class=cF0>;
<a name="l1337"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1338"></a>
<a name="l1339"></a> human_t_left=0;
<a name="l1340"></a> human_t_right=0;
<a name="l1341"></a> human_antispin=0;
<a name="l1342"></a>
<a name="l1343"></a> InitLevel;
<a name="l1344"></a>}
<a name="l1345"></a>
<a name="l1346"></a></span><span class=cF2>//********************************** Main</span><span class=cF0>
<a name="l1347"></a></span><span class=cF1>U0</span><span class=cF0> XCaliber()
<a name="l1348"></a>{
<a name="l1349"></a> </span><span class=cF9>I64</span><span class=cF0> ch,msg_code,arg1,arg2,sc;
<a name="l1350"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *cp=CtrlPanelNew;
<a name="l1351"></a>
<a name="l1352"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l1353"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr=</span><span class=cF3>BLACK</span><span class=cF0>&lt;&lt;4+</span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l1354"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l1355"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l1356"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l1357"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l1358"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1359"></a> </span><span class=cF6>&quot;Game {&quot;</span><span class=cF0>
<a name="l1360"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l1361"></a> </span><span class=cF6>&quot; LevelUp(,'+');&quot;</span><span class=cF0>
<a name="l1362"></a> </span><span class=cF6>&quot; LevelDown(,'-');&quot;</span><span class=cF0>
<a name="l1363"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1364"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l1365"></a> </span><span class=cF6>&quot; Fire(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l1366"></a> </span><span class=cF6>&quot; Thrust(,,SC_CURSOR_UP);&quot;</span><span class=cF0>
<a name="l1367"></a> </span><span class=cF6>&quot; StopSpin(,,SC_CURSOR_DOWN);&quot;</span><span class=cF0>
<a name="l1368"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l1369"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l1370"></a> </span><span class=cF6>&quot; LeftMissile(,,SC_CURSOR_LEFT|SCF_CTRL);&quot;</span><span class=cF0>
<a name="l1371"></a> </span><span class=cF6>&quot; RightMissile(,,SC_CURSOR_RIGHT|SCF_CTRL);&quot;</span><span class=cF0>
<a name="l1372"></a> </span><span class=cF6>&quot; Spackwalk(,'w');&quot;</span><span class=cF0>
<a name="l1373"></a> </span><span class=cF6>&quot; LongerFuse(,,SC_CURSOR_RIGHT|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l1374"></a> </span><span class=cF6>&quot; ShorterFuse(,,SC_CURSOR_LEFT|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l1375"></a> </span><span class=cF6>&quot; LargerShot(,,SC_CURSOR_UP|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l1376"></a> </span><span class=cF6>&quot; SmallerShot(,,SC_CURSOR_DOWN|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l1377"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l1378"></a> );
<a name="l1379"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l1380"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l1381"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l1382"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l1383"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l1384"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>
<a name="l1385"></a> -</span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>-</span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>;
<a name="l1386"></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="l1387"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1388"></a> ode=</span><span class=cF5>ODENew</span><span class=cF0>(0,0.01,</span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
<a name="l1389"></a> ode-&gt;derive=&amp;MyDerivative;
<a name="l1390"></a> ode-&gt;min_tolerance=1e-9;
<a name="l1391"></a> ode-&gt;drag_v3=0.00001;
<a name="l1392"></a> Init;
<a name="l1393"></a> </span><span class=cF5>QueIns</span><span class=cF0>(ode,</span><span class=cF5>Fs</span><span class=cF0>-&gt;last_ode);
<a name="l1394"></a> ch=0;
<a name="l1395"></a> </span><span class=cF1>do</span><span class=cF0> {
<a name="l1396"></a> </span><span class=cF1>while</span><span class=cF0> (!game_over &amp;&amp; !show_level_msg &amp;&amp;
<a name="l1397"></a> </span><span class=cF7>(</span><span class=cF0>msg_code=</span><span class=cF5>ScanMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1398"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) {
<a name="l1399"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l1400"></a> ch=arg1; sc=arg2;
<a name="l1401"></a> </span><span class=cF1>switch</span><span class=cF0> (ch) </span><span class=cF7>{</span><span class=cF0>
<a name="l1402"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l1403"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) {
<a name="l1404"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l1405"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l1406"></a> HumanFireMissileBegin(0);
<a name="l1407"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1408"></a> ctrl_panel.fuse_time+=2;
<a name="l1409"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1410"></a> human_t_right=THRUST_MAX;
<a name="l1411"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1412"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l1413"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l1414"></a> HumanFireMissileBegin(1);
<a name="l1415"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1416"></a> ctrl_panel.fuse_time-=2;
<a name="l1417"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1418"></a> human_t_left =THRUST_MAX;
<a name="l1419"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1420"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l1421"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1422"></a> ctrl_panel.shot_radius+=2;
<a name="l1423"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1424"></a> human_t_right=THRUST_MAX;
<a name="l1425"></a> human_t_left =THRUST_MAX;
<a name="l1426"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1427"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1428"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l1429"></a> </span><span class=cF1>if</span><span class=cF0> (sc&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l1430"></a> ctrl_panel.shot_radius-=2;
<a name="l1431"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1432"></a> human_antispin=ANTISPIN_MAX;
<a name="l1433"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1434"></a> }
<a name="l1435"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1436"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l1437"></a> </span><span class=cF1>if</span><span class=cF0> (level&lt;4)
<a name="l1438"></a> HumanFireGunBegin;
<a name="l1439"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1440"></a> HumanFireLaserBegin;
<a name="l1441"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1442"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>:
<a name="l1443"></a> ctrl_panel.spacewalk=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1444"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1445"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
<a name="l1446"></a> level++;
<a name="l1447"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1448"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>:
<a name="l1449"></a> level--;
<a name="l1450"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1451"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1452"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1453"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_UP</span><span class=cF0>:
<a name="l1454"></a> ch=arg1; sc=arg2;
<a name="l1455"></a> </span><span class=cF1>switch</span><span class=cF0> (ch) </span><span class=cF7>{</span><span class=cF0>
<a name="l1456"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l1457"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) {
<a name="l1458"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l1459"></a> human_t_right=0;
<a name="l1460"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1461"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l1462"></a> human_t_left =0;
<a name="l1463"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1464"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l1465"></a> human_t_right=0;
<a name="l1466"></a> human_t_left =0;
<a name="l1467"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1468"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l1469"></a> human_antispin=0;
<a name="l1470"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1471"></a> }
<a name="l1472"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1473"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l1474"></a> ch=0;
<a name="l1475"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1476"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l1477"></a> </span><span class=cF1>if</span><span class=cF0> (level&gt;=4)
<a name="l1478"></a> HumanFireLaserEnd;
<a name="l1479"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1480"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1481"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1482"></a> }
<a name="l1483"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1484"></a> AI;
<a name="l1485"></a> SolarFlares;
<a name="l1486"></a> ExpireShots;
<a name="l1487"></a> ExpireSplats;
<a name="l1488"></a> ExpireMissiles;
<a name="l1489"></a> CheckDamage;
<a name="l1490"></a> </span><span class=cF5>Refresh</span><span class=cF0>; </span><span class=cF2>//msgs are only qued by winmgr</span><span class=cF0>
<a name="l1491"></a> </span><span class=cF1>if</span><span class=cF0> (show_level_msg) </span><span class=cF7>{</span><span class=cF0>
<a name="l1492"></a> ch=</span><span class=cF5>GetKey</span><span class=cF0>(&amp;sc);
<a name="l1493"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'\n'</span><span class=cF0>)
<a name="l1494"></a> ch=0;
<a name="l1495"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode,</span><span class=cF3>OFF</span><span class=cF0>);
<a name="l1496"></a> show_level_msg=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1497"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (game_over) </span><span class=cF7>{</span><span class=cF0>
<a name="l1498"></a> ch=</span><span class=cF5>ScanChar</span><span class=cF0>;
<a name="l1499"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1500"></a> </span><span class=cF1>if</span><span class=cF0> (!remaining) {
<a name="l1501"></a> level++;
<a name="l1502"></a> ShipDel(human);
<a name="l1503"></a> human=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1504"></a> InitLevel;
<a name="l1505"></a> }
<a name="l1506"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1507"></a> } </span><span class=cF1>while</span><span class=cF0> (ch!=</span><span class=cF3>CH_ESC</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF6>'\n'</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>);
<a name="l1508"></a> AllDel(ode);
<a name="l1509"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (ch!=</span><span class=cF3>CH_ESC</span><span class=cF0> &amp;&amp; ch!=</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>);
<a name="l1510"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l1511"></a> CtrlPanelDel(cp);
<a name="l1512"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l1513"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/XCaliber&quot;</span><span class=cF0>,
<a name="l1514"></a> </span><span class=cF6>&quot;I64 best_score=%d;\n&quot;</span><span class=cF0>
<a name="l1515"></a> </span><span class=cF6>&quot;I64 msg_flags=%d;\n&quot;</span><span class=cF0>,best_score,msg_flags);
<a name="l1516"></a>}
</span></pre></body>
</html>