templeos-info/public/Wb/Demo/Games/BigGuns.HC.HTML

347 lines
27 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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">
.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=cF2>//Uses </span><a href="/Wb/Demo/Lectures/FixedPoint.HC.HTML#l1"><span class=cF4>fixed-point</span></a><span class=cF2>.</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>class</span><span class=cF0> MyMass:</span><span class=cF9>CMass</span><span class=cF0>
<a name="l4"></a>{
<a name="l5"></a> </span><span class=cF1>Bool</span><span class=cF0> collision;
<a name="l6"></a>};
<a name="l7"></a>
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_WIDTH 2048
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_HEIGHT (</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-3*</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l10"></a>
<a name="l11"></a></span><span class=cF9>I64</span><span class=cF0> gun_x,gun_y,active_map=0,gun_recoil;
<a name="l12"></a></span><span class=cF1>F64</span><span class=cF0> gun_theta;
<a name="l13"></a></span><span class=cF9>CDC</span><span class=cF0> *map_dcs[2]={</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>};
<a name="l14"></a></span><span class=cF9>I16</span><span class=cF0> elevs[MAP_WIDTH];
<a name="l15"></a>
<a name="l16"></a></span><span class=cF1>F64</span><span class=cF0> wind_x;
<a name="l17"></a>#</span><span class=cF1>define</span><span class=cF0> DUST_NUM 512
<a name="l18"></a></span><span class=cF9>I64</span><span class=cF0> dust_x[DUST_NUM],dust_y[DUST_NUM];
<a name="l19"></a>
<a name="l20"></a></span><span class=cF9>CMathODE</span><span class=cF0> *ode=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l21"></a>
<a name="l22"></a> </span><span class=cFA>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l23"></a>
<a name="l24"></a>
<a name="l25"></a> </span><span class=cFA>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l26"></a>
<a name="l27"></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="l28"></a>{
<a name="l29"></a> </span><span class=cF9>CDC</span><span class=cF0> *map=map_dcs[active_map&amp;1];
<a name="l30"></a> MyMass *tmpm;
<a name="l31"></a> </span><span class=cF1>F64</span><span class=cF0> theta=gun_theta;
<a name="l32"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,w,
<a name="l33"></a> h=-task-&gt;horz_scroll.pos,
<a name="l34"></a> v=-task-&gt;vert_scroll.pos;
<a name="l35"></a> task-&gt;horz_scroll.min=0;
<a name="l36"></a> task-&gt;horz_scroll.max=MAP_WIDTH-task-&gt;pix_width;
<a name="l37"></a> task-&gt;vert_scroll.min=0;
<a name="l38"></a> task-&gt;vert_scroll.max=MAP_HEIGHT-task-&gt;pix_height;
<a name="l39"></a> map-&gt;flags|=</span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc,h,v,map);
<a name="l41"></a>
<a name="l42"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,gun_x+h,gun_y+v,0,</span><span class=cFA>&lt;2&gt;</span><span class=cF0>);
<a name="l43"></a>
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (theta&lt;-</span><span class=cF3>pi</span><span class=cF0>/2) </span><span class=cF7>{</span><span class=cF0>
<a name="l45"></a> dc-&gt;flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>|</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc,gun_x+h,0,gun_x+h,1);
<a name="l47"></a> theta=-</span><span class=cF3>pi</span><span class=cF0>-theta;
<a name="l48"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l49"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,
<a name="l50"></a> gun_x+h-gun_recoil*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,
<a name="l51"></a> gun_y+v-gun_recoil*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>-10,0,</span><span class=cFA>&lt;1&gt;</span><span class=cF0>,theta);
<a name="l52"></a> dc-&gt;flags&amp;=~(</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>|</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>);
<a name="l53"></a>
<a name="l54"></a> tmpm=ode-&gt;next_mass;
<a name="l55"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l56"></a> map-&gt;color=</span><span class=cF3>ROP_COLLISION</span><span class=cF0>;
<a name="l57"></a> map-&gt;bkcolor=</span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l58"></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="l59"></a> map-&gt;collision_cnt=0;
<a name="l60"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(map,tmpm-&gt;x,tmpm-&gt;y,2);
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (map-&gt;collision_cnt)
<a name="l62"></a> tmpm-&gt;collision=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l63"></a>
<a name="l64"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,tmpm-&gt;x+h,tmpm-&gt;y+v,2);
<a name="l65"></a>
<a name="l66"></a> tmpm=tmpm-&gt;next;
<a name="l67"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l68"></a>
<a name="l69"></a> dc-&gt;color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l70"></a> w=</span><span class=cF5>tS</span><span class=cF0>*wind_x;
<a name="l71"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;DUST_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> x=(dust_x[i]+w)%MAP_WIDTH;
<a name="l73"></a> y=dust_y[i];
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (y&lt;elevs[x])
<a name="l75"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x+h,y+v);
<a name="l76"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l77"></a>}
<a name="l78"></a>
<a name="l79"></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="l80"></a>{
<a name="l81"></a> MyMass *tmpm=ode-&gt;next_mass;
<a name="l82"></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="l83"></a> tmpm-&gt;DstateDt-&gt;DyDt+=1000.0*tmpm-&gt;mass;
<a name="l84"></a> tmpm-&gt;DstateDt-&gt;DxDt+=25.0*wind_x;
<a name="l85"></a> tmpm=tmpm-&gt;next;
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l87"></a>}
<a name="l88"></a>
<a name="l89"></a></span><span class=cF1>U0</span><span class=cF0> DrawMap()
<a name="l90"></a>{
<a name="l91"></a> </span><span class=cF9>CDC</span><span class=cF0> *map=map_dcs[(active_map+1)&amp;1];
<a name="l92"></a> </span><span class=cF9>I64</span><span class=cF0> x;
<a name="l93"></a>
<a name="l94"></a> map-&gt;color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF5>GrRect</span><span class=cF0>(map,0,0,MAP_WIDTH,MAP_HEIGHT);
<a name="l96"></a>
<a name="l97"></a> map-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF1>for</span><span class=cF0> (x=1;x&lt;MAP_WIDTH;x++)
<a name="l99"></a> </span><span class=cF5>GrLine</span><span class=cF0>(map,x-1,elevs[x-1],x,elevs[x]);
<a name="l100"></a>
<a name="l101"></a> map-&gt;color=</span><span class=cF3>BROWN</span><span class=cF0>;
<a name="l102"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(map,0,MAP_HEIGHT-1,</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l103"></a>
<a name="l104"></a> active_map++;
<a name="l105"></a>}
<a name="l106"></a>
<a name="l107"></a></span><span class=cF1>U0</span><span class=cF0> FireTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l108"></a>{
<a name="l109"></a> MyMass *tmpm;
<a name="l110"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (gun_recoil) </span><span class=cF1>return</span><span class=cF0>;
<a name="l112"></a>
<a name="l113"></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>,</span><span class=cF5>Fs</span><span class=cF0>-&gt;parent_task);
<a name="l114"></a> tmpm-&gt;mass=10.0;
<a name="l115"></a> tmpm-&gt;drag_profile_factor=0.1;
<a name="l116"></a> tmpm-&gt;x=gun_x+27*</span><span class=cF5>Cos</span><span class=cF0>(gun_theta);
<a name="l117"></a> tmpm-&gt;y=gun_y-15+27*</span><span class=cF5>Sin</span><span class=cF0>(gun_theta);
<a name="l118"></a> tmpm-&gt;DxDt=600.0*</span><span class=cF5>Cos</span><span class=cF0>(gun_theta);
<a name="l119"></a> tmpm-&gt;DyDt=600.0*</span><span class=cF5>Sin</span><span class=cF0>(gun_theta);
<a name="l120"></a> tmpm-&gt;collision=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l121"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>sys_task_being_scrn_updated</span><span class=cF0>==</span><span class=cF5>Fs</span><span class=cF0>-&gt;parent_task)
<a name="l122"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l123"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpm,ode-&gt;last_mass);
<a name="l124"></a>
<a name="l125"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_end_cb=&amp;</span><span class=cF5>SndTaskEndCB</span><span class=cF0>;
<a name="l126"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;60;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> </span><span class=cF5>Snd</span><span class=cF0>(50*</span><span class=cF5>Rand</span><span class=cF0>+10);
<a name="l128"></a> </span><span class=cF5>Sleep</span><span class=cF0>(2);
<a name="l129"></a> gun_recoil=i/12;
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=60;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l132"></a> </span><span class=cF5>Sleep</span><span class=cF0>(1);
<a name="l133"></a> gun_recoil=5-i/12;
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l135"></a>}
<a name="l136"></a>
<a name="l137"></a></span><span class=cF1>U0</span><span class=cF0> ManageShots()
<a name="l138"></a>{
<a name="l139"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l140"></a> MyMass *tmpm,*tmpm1;
<a name="l141"></a> </span><span class=cF1>Bool</span><span class=cF0> chged=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l142"></a> tmpm=ode-&gt;next_mass;
<a name="l143"></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="l144"></a> tmpm1=tmpm-&gt;next;
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0&lt;=tmpm-&gt;x&lt;MAP_WIDTH</span><span class=cF7>)</span><span class=cF0> ||
<a name="l146"></a> tmpm-&gt;collision) {
<a name="l147"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpm);
<a name="l148"></a> </span><span class=cF1>for</span><span class=cF0> (i=tmpm-&gt;x-4;i&lt;=tmpm-&gt;x+4;i++)
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=i&lt;MAP_WIDTH)
<a name="l150"></a> elevs[i]=</span><span class=cF5>ClampI64</span><span class=cF0>(elevs[i]+10-2*</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>i-tmpm-&gt;x</span><span class=cF7>)</span><span class=cF0>,0,MAP_HEIGHT-2);
<a name="l151"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
<a name="l152"></a> chged=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l153"></a> }
<a name="l154"></a> tmpm=tmpm1;
<a name="l155"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (chged)
<a name="l157"></a> DrawMap;
<a name="l158"></a>}
<a name="l159"></a>
<a name="l160"></a></span><span class=cF1>U0</span><span class=cF0> MoveTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l161"></a>{
<a name="l162"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> quit_time=0;
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (quit_time)
<a name="l164"></a> quit_time=</span><span class=cF5>tS</span><span class=cF0>+0.1;
<a name="l165"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l166"></a> </span><span class=cF5>Snd</span><span class=cF0>(34);
<a name="l167"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_end_cb=&amp;</span><span class=cF5>SndTaskEndCB</span><span class=cF0>;
<a name="l168"></a> quit_time=</span><span class=cF5>tS</span><span class=cF0>+0.1;
<a name="l169"></a> </span><span class=cF1>while</span><span class=cF0> (quit_time&gt;</span><span class=cF5>tS</span><span class=cF0>)
<a name="l170"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l171"></a> quit_time=0;
<a name="l172"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l173"></a>}
<a name="l174"></a>
<a name="l175"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l176"></a>{
<a name="l177"></a> </span><span class=cF9>CDC</span><span class=cF0> *map;
<a name="l178"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,dy;
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (!map_dcs[0])
<a name="l180"></a> map_dcs[0]=</span><span class=cF5>DCNew</span><span class=cF0>(MAP_WIDTH,MAP_HEIGHT);
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (!map_dcs[1])
<a name="l182"></a> map_dcs[1]=</span><span class=cF5>DCNew</span><span class=cF0>(MAP_WIDTH,MAP_HEIGHT);
<a name="l183"></a> map=map_dcs[active_map&amp;1];
<a name="l184"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.pos=0;
<a name="l185"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.pos=0;
<a name="l186"></a>
<a name="l187"></a> y=</span><span class=cF5>ToI64</span><span class=cF0>(0.7*MAP_HEIGHT)&lt;&lt;32;
<a name="l188"></a> dy=0;
<a name="l189"></a> </span><span class=cF1>for</span><span class=cF0> (x=0;x&lt;MAP_WIDTH;x++) </span><span class=cF7>{</span><span class=cF0>
<a name="l190"></a> dy=</span><span class=cF5>ClampI64</span><span class=cF0>(</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF5>RandI16</span><span class=cF7>)</span><span class=cF0>&lt;&lt;30+dy,-3&lt;&lt;32,3&lt;&lt;32);
<a name="l191"></a> y=</span><span class=cF5>ClampI64</span><span class=cF0>(y+dy,</span><span class=cF5>ToI64</span><span class=cF7>(</span><span class=cF0>0.3*MAP_HEIGHT</span><span class=cF7>)</span><span class=cF0>&lt;&lt;32,</span><span class=cF7>(</span><span class=cF0>MAP_HEIGHT-2</span><span class=cF7>)</span><span class=cF0>&lt;&lt;32);
<a name="l192"></a> elevs[x]=y.i32[1];
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l194"></a> gun_x=</span><span class=cF5>RandU32</span><span class=cF0>%(MAP_WIDTH-100)+50;
<a name="l195"></a> gun_y=elevs[gun_x];
<a name="l196"></a> gun_theta=0;
<a name="l197"></a> gun_recoil=0;
<a name="l198"></a> </span><span class=cF1>for</span><span class=cF0> (x=gun_x-20;x&lt;=gun_x+20;x++)
<a name="l199"></a> elevs[x]=gun_y;
<a name="l200"></a>
<a name="l201"></a> wind_x=</span><span class=cF5>RandI16</span><span class=cF0>/250.0;
<a name="l202"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;DUST_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l203"></a> dust_x[i]=</span><span class=cF5>RandU16</span><span class=cF0>%MAP_WIDTH;
<a name="l204"></a> dust_y[i]=</span><span class=cF5>RandU16</span><span class=cF0>%MAP_HEIGHT;
<a name="l205"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l206"></a>
<a name="l207"></a> ode=</span><span class=cF5>ODENew</span><span class=cF0>(0,1e-4,</span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
<a name="l208"></a> ode-&gt;derive=&amp;MyDerivative;
<a name="l209"></a> ode-&gt;drag_v2=0.002;
<a name="l210"></a> ode-&gt;drag_v3=0.0001;
<a name="l211"></a> ode-&gt;acceleration_limit=5e5;
<a name="l212"></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="l213"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.min=0;
<a name="l214"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.max=MAP_WIDTH-</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width;
<a name="l215"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;horz_scroll.pos=gun_x-</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2;
<a name="l216"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.min=0;
<a name="l217"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.max=MAP_HEIGHT-</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height;
<a name="l218"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;vert_scroll.pos=0;
<a name="l219"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>;
<a name="l220"></a>
<a name="l221"></a> DrawMap;
<a name="l222"></a>}
<a name="l223"></a>
<a name="l224"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
<a name="l225"></a>{
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (ode) </span><span class=cF7>{</span><span class=cF0>
<a name="l227"></a> </span><span class=cF5>QueRem</span><span class=cF0>(ode);
<a name="l228"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&amp;ode-&gt;next_mass,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l229"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
<a name="l230"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l231"></a>}
<a name="l232"></a>
<a name="l233"></a></span><span class=cF1>U0</span><span class=cF0> BigGuns()
<a name="l234"></a>{
<a name="l235"></a> </span><span class=cF9>I64</span><span class=cF0> ch,sc;
<a name="l236"></a>
<a name="l237"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(
<a name="l238"></a> </span><span class=cF6>&quot;I refuse to rip-off the original\n&quot;</span><span class=cF0>
<a name="l239"></a> </span><span class=cF6>&quot;so this is intentionally crappy\n&quot;</span><span class=cF0>
<a name="l240"></a> </span><span class=cF6>&quot;and included for demonstration\n&quot;</span><span class=cF0>
<a name="l241"></a> </span><span class=cF6>&quot;purposes.\n\n&quot;</span><span class=cF0>
<a name="l242"></a> </span><span class=cF6>&quot;Write games, don't play them.\n&quot;</span><span class=cF0>);
<a name="l243"></a>
<a name="l244"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(</span><span class=cF6>&quot;The map scrolls.\n&quot;</span><span class=cF0>);
<a name="l245"></a>
<a name="l246"></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="l247"></a>
<a name="l248"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l249"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l250"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l251"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l252"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l253"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l254"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l255"></a> </span><span class=cF6>&quot; Fire(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l256"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l257"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l258"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l259"></a> );
<a name="l260"></a>
<a name="l261"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
<a name="l263"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l264"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l265"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l266"></a> </span><span class=cF5>DocScroll</span><span class=cF0>;
<a name="l267"></a> Init;
<a name="l268"></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="l269"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l270"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l271"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>ScanKey</span><span class=cF7>(</span><span class=cF0>&amp;ch,&amp;sc</span><span class=cF7>)</span><span class=cF0>)
<a name="l272"></a> </span><span class=cF1>switch</span><span class=cF0> (ch) </span><span class=cF7>{</span><span class=cF0>
<a name="l273"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l274"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) {
<a name="l275"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l276"></a> gun_theta+=2.0*</span><span class=cF3>pi</span><span class=cF0>/180;
<a name="l277"></a> </span><span class=cF1>if</span><span class=cF0> (gun_theta&gt;0)
<a name="l278"></a> gun_theta=0;
<a name="l279"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l280"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;MoveTask,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>&quot;Move&quot;</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
<a name="l281"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l283"></a> gun_theta-=2.0*</span><span class=cF3>pi</span><span class=cF0>/180;
<a name="l284"></a> </span><span class=cF1>if</span><span class=cF0> (gun_theta&lt;-</span><span class=cF3>pi</span><span class=cF0>)
<a name="l285"></a> gun_theta=-</span><span class=cF3>pi</span><span class=cF0>;
<a name="l286"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l287"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;MoveTask,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>&quot;Move&quot;</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
<a name="l288"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l289"></a> }
<a name="l290"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l291"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l292"></a> CleanUp(ode);
<a name="l293"></a> Init;
<a name="l294"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l295"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l296"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;FireTask,</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF6>&quot;Fire&quot;</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
<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> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l299"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l300"></a> </span><span class=cF1>goto</span><span class=cF0> bg_done;
<a name="l301"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l302"></a> ManageShots;
<a name="l303"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l304"></a> }
<a name="l305"></a>bg_done:
<a name="l306"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l307"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l308"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l309"></a> </span><span class=cF5>DCDel</span><span class=cF0>(map_dcs[0]); map_dcs[0]=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l310"></a> </span><span class=cF5>DCDel</span><span class=cF0>(map_dcs[1]); map_dcs[1]=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l311"></a> CleanUp(ode);
<a name="l312"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l313"></a>}
<a name="l314"></a>
<a name="l315"></a>BigGuns;
</span></pre></body>
</html>