ZealOS/docs/Demo/Games/ZoneOut.CC.html
2021-12-04 05:03:02 -05:00

380 lines
30 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.06">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS/ZoneOut&quot;</span><span class=cF0>, </span><span class=cF6>&quot;F64 best_score=9999;\n&quot;</span><span class=cF0>);
<a name="l2"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS/ZoneOut&quot;</span><span class=cF0>);
<a name="l3"></a>
<a name="l4"></a>
<a name="l5"></a>
<a name="l6"></a>
<a name="l7"></a>
<a name="l8"></a>
<a name="l9"></a>
<a name="l10"></a>
<a name="l11"></a>
<a name="l12"></a>
<a name="l13"></a> </span><span class=cFA>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l14"></a>
<a name="l15"></a>
<a name="l16"></a>
<a name="l17"></a>
<a name="l18"></a>
<a name="l19"></a>
<a name="l20"></a>
<a name="l21"></a>
<a name="l22"></a>
<a name="l23"></a>
<a name="l24"></a>
<a name="l25"></a>
<a name="l26"></a>
<a name="l27"></a>
<a name="l28"></a>
<a name="l29"></a>
<a name="l30"></a>
<a name="l31"></a>
<a name="l32"></a>
<a name="l33"></a>
<a name="l34"></a>
<a name="l35"></a>
<a name="l36"></a>
<a name="l37"></a>
<a name="l38"></a> </span><span class=cFA>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l39"></a>
<a name="l40"></a>
<a name="l41"></a>
<a name="l42"></a>
<a name="l43"></a>
<a name="l44"></a>
<a name="l45"></a>
<a name="l46"></a>
<a name="l47"></a>
<a name="l48"></a>
<a name="l49"></a>
<a name="l50"></a>
<a name="l51"></a>
<a name="l52"></a> </span><span class=cFA>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l53"></a></span><span class=cFA>
<a name="l54"></a>/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l55"></a>
<a name="l56"></a>
<a name="l57"></a>
<a name="l58"></a>
<a name="l59"></a>
<a name="l60"></a>
<a name="l61"></a>
<a name="l62"></a>
<a name="l63"></a>
<a name="l64"></a>
<a name="l65"></a>#</span><span class=cF1>define</span><span class=cF0> THEM_NUM </span><span class=cFE>10</span><span class=cF0>
<a name="l66"></a>
<a name="l67"></a></span><span class=cF1>class</span><span class=cF0> Obj
<a name="l68"></a>{
<a name="l69"></a> Obj *next, *last;
<a name="l70"></a> </span><span class=cF1>F64</span><span class=cF0> t0, theta;
<a name="l71"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, z;
<a name="l72"></a> </span><span class=cF1>Bool</span><span class=cF0> hit, pad[</span><span class=cFE>7</span><span class=cF0>];
<a name="l73"></a>
<a name="l74"></a>} us, them[THEM_NUM], shots;
<a name="l75"></a>
<a name="l76"></a></span><span class=cF9>I64</span><span class=cF0> num_them;
<a name="l77"></a></span><span class=cF1>F64</span><span class=cF0> t0, tf;
<a name="l78"></a>
<a name="l79"></a>#</span><span class=cF1>define</span><span class=cF0> SCREEN_SCALE </span><span class=cFE>512</span><span class=cF0>
<a name="l80"></a>#</span><span class=cF1>define</span><span class=cF0> TANK_HEIGHT </span><span class=cFE>32</span><span class=cF0>
<a name="l81"></a>
<a name="l82"></a></span><span class=cF1>U0</span><span class=cF0> ZOTransform(</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> *z)
<a name="l83"></a>{
<a name="l84"></a> </span><span class=cF9>I64</span><span class=cF0> zz;
<a name="l85"></a>
<a name="l86"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(dc-&gt;r, x, y, z);
<a name="l87"></a> zz = *z;
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (zz &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l89"></a> zz = </span><span class=cFE>1</span><span class=cF0>;
<a name="l90"></a> *x = SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0> * *x / zz;
<a name="l91"></a> *y = SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0> * (*y + TANK_HEIGHT) / zz;
<a name="l92"></a> *x += dc-&gt;x;
<a name="l93"></a> *y += dc-&gt;y;
<a name="l94"></a> *z += dc-&gt;z;
<a name="l95"></a>}
<a name="l96"></a>
<a name="l97"></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="l98"></a>{
<a name="l99"></a> Obj *tmpo;
<a name="l100"></a> </span><span class=cF9>I64</span><span class=cF0> i, dd, y, w = task-&gt;pix_width, h = task-&gt;pix_height, cx = w &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, cy = h &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l101"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
<a name="l102"></a> </span><span class=cF1>F64</span><span class=cF0> tt, theta;
<a name="l103"></a>
<a name="l104"></a> theta = </span><span class=cFE>640</span><span class=cF0> * </span><span class=cF5>Wrap</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0> * us.theta) / </span><span class=cF3>pi</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, theta - </span><span class=cFE>1280</span><span class=cF0>, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;4&gt;</span><span class=cF0>);
<a name="l106"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, theta, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;4&gt;</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, theta + </span><span class=cFE>1280</span><span class=cF0>, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;4&gt;</span><span class=cF0>);
<a name="l108"></a>
<a name="l109"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l110"></a> dc-&gt;transform = &amp;ZOTransform;
<a name="l111"></a> dc-&gt;x = cx;
<a name="l112"></a> dc-&gt;y = cy;
<a name="l113"></a> </span><span class=cF5>Mat4x4TranslationEqu</span><span class=cF0>(dc-&gt;r, -us.x, -us.y, -us.z);
<a name="l114"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dc-&gt;r, us.theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>);
<a name="l115"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc-&gt;r, </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>);
<a name="l116"></a>
<a name="l117"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l118"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; THEM_NUM; i++)
<a name="l119"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l120"></a> y = them[i].y;
<a name="l121"></a> tmpo = shots.next;
<a name="l122"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &amp;shots)
<a name="l123"></a> {
<a name="l124"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(them[i].x - tmpo-&gt;x) + </span><span class=cF5>SqrI64</span><span class=cF0>(them[i].z - tmpo-&gt;z);
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (dd &lt; SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0> * SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0>)
<a name="l126"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> y -= </span><span class=cF5>Sqrt</span><span class=cF0>(dd);
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (!them[i].hit)
<a name="l129"></a> {
<a name="l130"></a> them[i].hit = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (!--num_them)
<a name="l132"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> tf = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (tf - t0 &lt; best_score)
<a name="l135"></a> best_score = tf - t0;
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l137"></a> }
<a name="l138"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l139"></a> tmpo = tmpo-&gt;next;
<a name="l140"></a> }
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (them[i].hit)
<a name="l142"></a> img = </span><span class=cFA>&lt;2&gt;</span><span class=cF0>;
<a name="l143"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l144"></a> img = </span><span class=cFA>&lt;1&gt;</span><span class=cF0>;
<a name="l145"></a> </span><span class=cF5>Sprite3YB</span><span class=cF0>(dc, them[i].x, y, them[i].z, img, -them[i].theta);
<a name="l146"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l147"></a> tmpo = shots.next;
<a name="l148"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &amp;shots)
<a name="l149"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l150"></a> </span><span class=cF5>Sprite3YB</span><span class=cF0>(dc, tmpo-&gt;x, tmpo-&gt;y, tmpo-&gt;z, </span><span class=cFA>&lt;3&gt;</span><span class=cF0>, -tmpo-&gt;theta);
<a name="l151"></a> tmpo = tmpo-&gt;next;
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l153"></a> dc-&gt;flags &amp;= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l154"></a> dc-&gt;color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l155"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, cx - </span><span class=cFE>5</span><span class=cF0>, cy, cx + </span><span class=cFE>5</span><span class=cF0>, cy);
<a name="l156"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, cx, cy - </span><span class=cFE>5</span><span class=cF0>, cx, cy + </span><span class=cFE>5</span><span class=cF0>);
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (tf)
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l161"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, cx - </span><span class=cF7>(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>14</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, cy - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>&quot;Game Completed&quot;</span><span class=cF0>);
<a name="l162"></a> tt = tf;
<a name="l163"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l164"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l165"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l166"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l167"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, cx - </span><span class=cFE>5</span><span class=cF0>, cy, cx + </span><span class=cFE>5</span><span class=cF0>, cy);
<a name="l168"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, cx, cy - </span><span class=cFE>5</span><span class=cF0>, cx, cy + </span><span class=cFE>5</span><span class=cF0>);
<a name="l169"></a> tt = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l171"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l172"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>&quot;Enemy:%d Time:%3.2f Best:%3.2f&quot;</span><span class=cF0>, num_them, tt - t0, best_score);
<a name="l173"></a>}
<a name="l174"></a>
<a name="l175"></a></span><span class=cF1>U0</span><span class=cF0> Fire()
<a name="l176"></a>{
<a name="l177"></a> Obj *tmpo = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Obj</span><span class=cF7>)</span><span class=cF0>);
<a name="l178"></a>
<a name="l179"></a> tmpo-&gt;x = us.x;
<a name="l180"></a> tmpo-&gt;y = TANK_HEIGHT;
<a name="l181"></a> tmpo-&gt;z = us.z;
<a name="l182"></a> tmpo-&gt;theta = us.theta;
<a name="l183"></a> tmpo-&gt;t0 = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l184"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpo, shots.last);
<a name="l185"></a>}
<a name="l186"></a>
<a name="l187"></a></span><span class=cF1>U0</span><span class=cF0> MoveUs(</span><span class=cF1>F64</span><span class=cF0> theta)
<a name="l188"></a>{
<a name="l189"></a> us.x += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0> * SCREEN_SCALE * </span><span class=cF5>Cos</span><span class=cF0>(theta);
<a name="l190"></a> us.z += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0> * SCREEN_SCALE * </span><span class=cF5>Sin</span><span class=cF0>(theta);
<a name="l191"></a>}
<a name="l192"></a>
<a name="l193"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l194"></a>{
<a name="l195"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l196"></a> Obj *tmpo, *tmpo1;
<a name="l197"></a>
<a name="l198"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l199"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l200"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; THEM_NUM; i++)
<a name="l201"></a> {
<a name="l202"></a> them[i].x += SCREEN_SCALE / </span><span class=cFE>32</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF0>(them[i].theta);
<a name="l203"></a> them[i].z += SCREEN_SCALE / </span><span class=cFE>32</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF0>(them[i].theta);
<a name="l204"></a> them[i].theta += </span><span class=cF5>Rand</span><span class=cF0> / </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l205"></a> }
<a name="l206"></a> tmpo = shots.next;
<a name="l207"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &amp;shots)
<a name="l208"></a> {
<a name="l209"></a> tmpo1 = tmpo-&gt;next;
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> - tmpo-&gt;t0 &gt; </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
<a name="l211"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l212"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpo);
<a name="l213"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo);
<a name="l214"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l215"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l216"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l217"></a> tmpo-&gt;x += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0> * SCREEN_SCALE *</span><span class=cF5>Cos</span><span class=cF0>(tmpo-&gt;theta);
<a name="l218"></a> tmpo-&gt;z += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0> * SCREEN_SCALE * </span><span class=cF5>Sin</span><span class=cF0>(tmpo-&gt;theta);
<a name="l219"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l220"></a> tmpo = tmpo1;
<a name="l221"></a> }
<a name="l222"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>20</span><span class=cF0>);
<a name="l223"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l224"></a>}
<a name="l225"></a>
<a name="l226"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l227"></a>{
<a name="l228"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l229"></a>
<a name="l230"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l231"></a> </span><span class=cF6>&quot;$BG, LTCYAN$%h12c&quot;</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l232"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;shots);
<a name="l233"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;us, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>us</span><span class=cF7>)</span><span class=cF0>);
<a name="l234"></a> </span><span class=cF5>MemSet</span><span class=cF0>(them, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>them</span><span class=cF7>)</span><span class=cF0>);
<a name="l235"></a> num_them = THEM_NUM;
<a name="l236"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; THEM_NUM; i++)
<a name="l237"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l238"></a> them[i].x = </span><span class=cFE>10000</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0> - </span><span class=cFE>5000</span><span class=cF0>;
<a name="l239"></a> them[i].z = </span><span class=cFE>10000</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0> - </span><span class=cFE>5000</span><span class=cF0>;
<a name="l240"></a> them[i].theta = </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
<a name="l241"></a> them[i].hit = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l243"></a> tf = </span><span class=cFE>0</span><span class=cF0>;
<a name="l244"></a> t0 = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l245"></a>}
<a name="l246"></a>
<a name="l247"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
<a name="l248"></a>{
<a name="l249"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;shots, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l250"></a>}
<a name="l251"></a>
<a name="l252"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l253"></a>{</span><span class=cF2>//Randomly generate (by God :-)</span><span class=cF0>
<a name="l254"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_end_cb = &amp;</span><span class=cF5>SoundTaskEndCB</span><span class=cF0>;
<a name="l255"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
<a name="l256"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l257"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l258"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG&quot;</span><span class=cF0>);
<a name="l259"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG&quot;</span><span class=cF0>);
<a name="l260"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA&quot;</span><span class=cF0>);
<a name="l261"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>&quot;5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA&quot;</span><span class=cF0>);
<a name="l262"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l263"></a>}
<a name="l264"></a>
<a name="l265"></a></span><span class=cF1>U0</span><span class=cF0> ZoneOut()
<a name="l266"></a>{
<a name="l267"></a> </span><span class=cF9>I64</span><span class=cF0> sc;
<a name="l268"></a>
<a name="l269"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>( </span><span class=cF6>&quot;Terry refused to rip-off the original\n&quot;</span><span class=cF0>
<a name="l270"></a> </span><span class=cF6>&quot;so this is intentionally crappy\n&quot;</span><span class=cF0>
<a name="l271"></a> </span><span class=cF6>&quot;and included for demonstration\n&quot;</span><span class=cF0>
<a name="l272"></a> </span><span class=cF6>&quot;purposes.\n\n&quot;</span><span class=cF0>
<a name="l273"></a> </span><span class=cF6>&quot;Write games, don't play them.\n&quot;</span><span class=cF0>);
<a name="l274"></a>
<a name="l275"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l276"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l277"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l278"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l279"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l280"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l281"></a> </span><span class=cF6>&quot; Fwd(,,SC_CURSOR_UP);&quot;</span><span class=cF0>
<a name="l282"></a> </span><span class=cF6>&quot; Bwd(,,SC_CURSOR_DOWN);&quot;</span><span class=cF0>
<a name="l283"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l284"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l285"></a> </span><span class=cF6>&quot; Fire(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l286"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l287"></a> );
<a name="l288"></a>
<a name="l289"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l290"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr = </span><span class=cF3>YELLOW</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l291"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l292"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l293"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l294"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l295"></a> Init;
<a name="l296"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;animate_task = </span><span class=cF5>Spawn</span><span class=cF0>(&amp;AnimateTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>&quot;Animate&quot;</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l297"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;song_task = </span><span class=cF5>Spawn</span><span class=cF0>(&amp;SongTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>&quot;Song&quot;</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
<a name="l298"></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="l299"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l300"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l301"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l302"></a> {
<a name="l303"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>KeyGet</span><span class=cF7>(</span><span class=cF0>&amp;sc</span><span class=cF7>)</span><span class=cF0>)
<a name="l304"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l305"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l306"></a> Fire;
<a name="l307"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l308"></a>
<a name="l309"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l310"></a> CleanUp;
<a name="l311"></a> Init;
<a name="l312"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l313"></a>
<a name="l314"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l315"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l316"></a> </span><span class=cF1>goto</span><span class=cF0> zo_done;
<a name="l317"></a>
<a name="l318"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
<a name="l319"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l320"></a> {
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l322"></a> us.theta -= </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>256</span><span class=cF0>;
<a name="l323"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l324"></a>
<a name="l325"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l326"></a> us.theta += </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>256</span><span class=cF0>;
<a name="l327"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l328"></a>
<a name="l329"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l330"></a> MoveUs(us.theta);
<a name="l331"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l332"></a>
<a name="l333"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l334"></a> MoveUs(us.theta + </span><span class=cF3>pi</span><span class=cF0>);
<a name="l335"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l336"></a> }
<a name="l337"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l338"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l339"></a> }
<a name="l340"></a>zo_done:
<a name="l341"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l342"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l343"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l344"></a> CleanUp;
<a name="l345"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l346"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l347"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l348"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS/ZoneOut&quot;</span><span class=cF0>, </span><span class=cF6>&quot;F64 best_score=%5.4f;\n&quot;</span><span class=cF0>, best_score);
<a name="l349"></a>}
<a name="l350"></a>
<a name="l351"></a>ZoneOut;
</span></pre></body>
</html>