ZealOS/docs/Demo/Games/BomberGolf.CC.html
TomAwezome d639cdcdf6 Rename /0000Boot to /Boot.
Rename 0000Kernel.BIN.C to Kernel.BIN.C.
2021-07-24 00:48:21 -04:00

434 lines
41 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.09">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</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/BomberGolf&quot;</span><span class=cF0>, </span><span class=cF6>&quot;I64 best_score=99999;\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/BomberGolf&quot;</span><span class=cF0>);
<a name="l3"></a>
<a name="l4"></a>
<a name="l5"></a>
<a name="l6"></a> </span><span class=cFA>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a>
<a name="l9"></a>
<a name="l10"></a>
<a name="l11"></a> </span><span class=cFA>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l12"></a>
<a name="l13"></a>
<a name="l14"></a>
<a name="l15"></a> </span><span class=cFA>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l16"></a>
<a name="l17"></a>
<a name="l18"></a> </span><span class=cFA>&lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a>
<a name="l21"></a> </span><span class=cFA>&lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l22"></a>
<a name="l23"></a>
<a name="l24"></a>
<a name="l25"></a> </span><span class=cFA>&lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l26"></a>
<a name="l27"></a>
<a name="l28"></a>
<a name="l29"></a>
<a name="l30"></a> </span><span class=cFA>&lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l31"></a>
<a name="l32"></a>
<a name="l33"></a>
<a name="l34"></a>
<a name="l35"></a> </span><span class=cFA>&lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l36"></a>
<a name="l37"></a>
<a name="l38"></a>
<a name="l39"></a>
<a name="l40"></a> </span><span class=cFA>&lt;9&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l41"></a>
<a name="l42"></a>
<a name="l43"></a>
<a name="l44"></a>
<a name="l45"></a> </span><span class=cFA>&lt;10&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l46"></a>
<a name="l47"></a>
<a name="l48"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_WIDTH </span><span class=cFE>600</span><span class=cF0>
<a name="l49"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_HEIGHT </span><span class=cFE>600</span><span class=cF0>
<a name="l50"></a>
<a name="l51"></a>#</span><span class=cF1>define</span><span class=cF0> TREES_NUM </span><span class=cFE>64</span><span class=cF0>
<a name="l52"></a></span><span class=cF1>class</span><span class=cF0> Tree
<a name="l53"></a>{
<a name="l54"></a> </span><span class=cF9>I64</span><span class=cF0> x, y;
<a name="l55"></a>
<a name="l56"></a>} trees[TREES_NUM];
<a name="l57"></a>
<a name="l58"></a>
<a name="l59"></a></span><span class=cF9>I64</span><span class=cF0> target_count, key_count;
<a name="l60"></a>
<a name="l61"></a>
<a name="l62"></a>#</span><span class=cF1>define</span><span class=cF0> TARGETS_NUM </span><span class=cFE>10</span><span class=cF0>
<a name="l63"></a>
<a name="l64"></a>#</span><span class=cF1>define</span><span class=cF0> MDF_TANK </span><span class=cFE>0</span><span class=cF0>
<a name="l65"></a>#</span><span class=cF1>define</span><span class=cF0> MDF_BUNKER </span><span class=cFE>1</span><span class=cF0>
<a name="l66"></a>
<a name="l67"></a>#</span><span class=cF1>define</span><span class=cF0> TANK_V </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
<a name="l68"></a>
<a name="l69"></a></span><span class=cF1>class</span><span class=cF0> Target
<a name="l70"></a>{
<a name="l71"></a> </span><span class=cF1>F64</span><span class=cF0> x, y, theta;
<a name="l72"></a> </span><span class=cF1>U8</span><span class=cF0> *alive_img, *dead_img1, *dead_img2;
<a name="l73"></a> </span><span class=cF1>U8</span><span class=cF0> type;
<a name="l74"></a> </span><span class=cF1>Bool</span><span class=cF0> dead, pad[</span><span class=cFE>6</span><span class=cF0>];
<a name="l75"></a>
<a name="l76"></a>} targets[TARGETS_NUM];
<a name="l77"></a>
<a name="l78"></a>#</span><span class=cF1>define</span><span class=cF0> FALL_TIME </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0>
<a name="l79"></a>#</span><span class=cF1>define</span><span class=cF0> EXPLODE_TIME </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0>
<a name="l80"></a></span><span class=cF1>class</span><span class=cF0> Bomb
<a name="l81"></a>{
<a name="l82"></a> Bomb *next, *last;
<a name="l83"></a> </span><span class=cF1>F64</span><span class=cF0> x, y, t;
<a name="l84"></a> </span><span class=cF1>Bool</span><span class=cF0> exploding;
<a name="l85"></a>
<a name="l86"></a>} bomb_head;
<a name="l87"></a>
<a name="l88"></a></span><span class=cF1>F64</span><span class=cF0> v, x, y, theta, thetaf; </span><span class=cF2>//thetaf is the final theta. theta is gradually changed until it reaches thetaf.</span><span class=cF0>
<a name="l89"></a>
<a name="l90"></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="l91"></a>{
<a name="l92"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
<a name="l93"></a> Bomb *tmpb;
<a name="l94"></a> Target *tmpt;
<a name="l95"></a> </span><span class=cF1>F64</span><span class=cF0> ts = </span><span class=cF5>tS</span><span class=cF0>, dx, dy;
<a name="l96"></a>
<a name="l97"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0>|</span><span class=cF3>BROWN</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> | </span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF5>GrRect3</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=cFE>0</span><span class=cF0>, dc-&gt;width, dc-&gt;height);
<a name="l99"></a>
<a name="l100"></a> dc-&gt;x = task-&gt;pix_width &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l101"></a> dc-&gt;y = task-&gt;pix_height &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l102"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF5>Mat4x4TranslationEqu</span><span class=cF0>(dc-&gt;r, x, y, </span><span class=cFE>0</span><span class=cF0>);
<a name="l104"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc-&gt;r, theta);
<a name="l105"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l106"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, -MAP_WIDTH &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, -MAP_HEIGHT &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, MAP_WIDTH &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, MAP_HEIGHT &gt;&gt; </span><span class=cFE>1</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TARGETS_NUM; i++)
<a name="l108"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l109"></a> tmpt = &amp;targets[i];
<a name="l110"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;dead)
<a name="l111"></a> {
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l113"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l114"></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="l115"></a> </span><span class=cF5>DCSymmetry3Set</span><span class=cF0>(dc, tmpt-&gt;x, tmpt-&gt;y, </span><span class=cFE>0</span><span class=cF0>,
<a name="l116"></a> tmpt-&gt;x, tmpt-&gt;y, </span><span class=cFE>1</span><span class=cF0>,
<a name="l117"></a> tmpt-&gt;x + </span><span class=cFE>1024</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>tmpt-&gt;theta</span><span class=cF7>)</span><span class=cF0>, tmpt-&gt;y + </span><span class=cFE>1024</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>tmpt-&gt;theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>15</span><span class=cF7>)</span><span class=cF0>)
<a name="l120"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpt-&gt;x, tmpt-&gt;y, </span><span class=cFE>0</span><span class=cF0>, tmpt-&gt;dead_img1, tmpt-&gt;theta);
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l122"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpt-&gt;x, tmpt-&gt;y, </span><span class=cFE>0</span><span class=cF0>, tmpt-&gt;dead_img2, tmpt-&gt;theta);
<a name="l123"></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="l124"></a> }
<a name="l125"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l126"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpt-&gt;x, tmpt-&gt;y, </span><span class=cFE>0</span><span class=cF0>, tmpt-&gt;alive_img, tmpt-&gt;theta);
<a name="l127"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l128"></a>
<a name="l129"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TREES_NUM; i++)
<a name="l130"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, trees[i].x, trees[i].y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;2&gt;</span><span class=cF0>);
<a name="l131"></a>
<a name="l132"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TARGETS_NUM; i++)
<a name="l133"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l134"></a> tmpt = &amp;targets[i];
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt-&gt;dead)
<a name="l136"></a> {
<a name="l137"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; </span><span class=cFE>40</span><span class=cF0>; j++)
<a name="l138"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l139"></a> dc-&gt;thick = </span><span class=cFE>4</span><span class=cF0>;
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (j &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l141"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> | </span><span class=cF3>LTGRAY</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> | </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l142"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l143"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> | </span><span class=cF3>DKGRAY</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> | </span><span class=cF3>LTGRAY</span><span class=cF0>;
<a name="l144"></a> dx = </span><span class=cFE>15</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF0>(ts / </span><span class=cFE>4</span><span class=cF0> + j &lt;&lt; </span><span class=cFE>6</span><span class=cF0>) + j &gt;&gt; </span><span class=cFE>2</span><span class=cF0>;
<a name="l145"></a> dy = </span><span class=cFE>10</span><span class=cF0> * </span><span class=cF5>FullTri</span><span class=cF0>(ts / </span><span class=cFE>3</span><span class=cF0> + j / </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>20</span><span class=cF0>) + j &gt;&gt; </span><span class=cFE>2</span><span class=cF0>;
<a name="l146"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc, tmpt-&gt;x + </span><span class=cFE>5</span><span class=cF0> + dx + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * dy, tmpt-&gt;y + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * dx + dy, </span><span class=cFE>0</span><span class=cF0>);
<a name="l147"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l148"></a> }
<a name="l149"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l150"></a>
<a name="l151"></a> tmpb = bomb_head.next;
<a name="l152"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;bomb_head)
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;t + FALL_TIME &lt; </span><span class=cF5>tS</span><span class=cF0>)
<a name="l155"></a> {
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>10</span><span class=cF7>)</span><span class=cF0>)
<a name="l157"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpb-&gt;x, tmpb-&gt;y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;9&gt;</span><span class=cF0>);
<a name="l158"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l159"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpb-&gt;x, tmpb-&gt;y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;10&gt;</span><span class=cF0>);
<a name="l160"></a> }
<a name="l161"></a> tmpb = tmpb-&gt;next;
<a name="l162"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l163"></a>
<a name="l164"></a> dc-&gt;flags &amp;= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l165"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, task-&gt;pix_width &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, task-&gt;pix_height &gt;&gt; </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA>&lt;1&gt;</span><span class=cF0>);
<a name="l166"></a> dc-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l167"></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;Targets:%02d</span><span class=cF0> </span><span class=cF6>KeyStrokes:%04d Best:%04d&quot;</span><span class=cF0>, target_count, key_count, best_score);
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (!target_count &amp;&amp; </span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0>)
<a name="l169"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>task-&gt;pix_width - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>14</span><span class=cF7>)</span><span class=cF0> &gt;&gt; </span><span class=cFE>1</span><span class=cF0>,
<a name="l170"></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> &gt;&gt; </span><span class=cFE>1</span><span class=cF0> - </span><span class=cFE>32</span><span class=cF0>, </span><span class=cF6>&quot;Game Completed&quot;</span><span class=cF0>);
<a name="l171"></a>}
<a name="l172"></a>
<a name="l173"></a></span><span class=cF1>U0</span><span class=cF0> BombHit(Bomb *tmpb)
<a name="l174"></a>{
<a name="l175"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l176"></a>
<a name="l177"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TARGETS_NUM; i++)
<a name="l178"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (!targets[i].dead &amp;&amp; </span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>tmpb-&gt;x - targets[i].x</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>tmpb-&gt;y - targets[i].y</span><span class=cF7>)</span><span class=cF0> &lt; </span><span class=cFE>20</span><span class=cF0> * </span><span class=cFE>20</span><span class=cF0>)
<a name="l180"></a> {
<a name="l181"></a> targets[i].dead = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l182"></a> target_count--;
<a name="l183"></a> }
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l185"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpb);
<a name="l186"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
<a name="l187"></a>}
<a name="l188"></a>
<a name="l189"></a></span><span class=cF1>U0</span><span class=cF0> BombDrop(</span><span class=cF1>F64</span><span class=cF0> x, </span><span class=cF1>F64</span><span class=cF0> y)
<a name="l190"></a>{
<a name="l191"></a> Bomb *tmpb = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Bomb</span><span class=cF7>)</span><span class=cF0>);
<a name="l192"></a>
<a name="l193"></a> tmpb-&gt;x = x;
<a name="l194"></a> tmpb-&gt;y = y;
<a name="l195"></a> tmpb-&gt;t = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l196"></a> tmpb-&gt;exploding = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l197"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, bomb_head.last);
<a name="l198"></a> </span><span class=cF5>Sweep</span><span class=cF0>(FALL_TIME * </span><span class=cFE>1000</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>, </span><span class=cFE>62</span><span class=cF0>);
<a name="l199"></a>}
<a name="l200"></a>
<a name="l201"></a></span><span class=cF9>I64</span><span class=cF0> AnimateTask(</span><span class=cF9>CTask</span><span class=cF0> *)
<a name="l202"></a>{
<a name="l203"></a> </span><span class=cF1>F64</span><span class=cF0> last_t = </span><span class=cF5>tS</span><span class=cF0>, dt;
<a name="l204"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l205"></a> Bomb *tmpb, *tmpb1;
<a name="l206"></a> Target *tmpt;
<a name="l207"></a>
<a name="l208"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l209"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l210"></a> dt = </span><span class=cF5>tS</span><span class=cF0> - last_t;
<a name="l211"></a> last_t = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l212"></a>
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (bomb_head.next == &amp;bomb_head)
<a name="l214"></a> {
<a name="l215"></a> </span><span class=cF1>if</span><span class=cF0> (target_count)
<a name="l216"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cF5>Freq2Ona</span><span class=cF7>(</span><span class=cFE>100</span><span class=cF0> + </span><span class=cFE>60</span><span class=cF0> * </span><span class=cF5>Clamp</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0> * </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> + </span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>thetaf - theta, -</span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> ` </span><span class=cFE>4</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>3</span><span class=cF0>, </span><span class=cFE>3</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>);
<a name="l217"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (key_count &lt; best_score)
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l219"></a> best_score = key_count;
<a name="l220"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>150</span><span class=cF0>);
<a name="l221"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
<a name="l222"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>150</span><span class=cF0>);
<a name="l223"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l224"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>150</span><span class=cF0>);
<a name="l225"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
<a name="l226"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>150</span><span class=cF0>);
<a name="l227"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l229"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l230"></a> </span><span class=cF5>Sound</span><span class=cF0>;
<a name="l231"></a> }
<a name="l232"></a>
<a name="l233"></a> theta += dt * (thetaf - theta);
<a name="l234"></a> x += dt * v * </span><span class=cF5>Sin</span><span class=cF0>(theta);
<a name="l235"></a> y += dt * v * </span><span class=cF5>Cos</span><span class=cF0>(theta);
<a name="l236"></a>
<a name="l237"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TARGETS_NUM; i++)
<a name="l238"></a> {
<a name="l239"></a> tmpt = &amp;targets[i];
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpt-&gt;dead &amp;&amp; tmpt-&gt;type == MDF_TANK)
<a name="l241"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l242"></a> tmpt-&gt;x += dt * TANK_V * </span><span class=cF5>Cos</span><span class=cF0>(tmpt-&gt;theta);
<a name="l243"></a> tmpt-&gt;y += dt * TANK_V * </span><span class=cF5>Sin</span><span class=cF0>(tmpt-&gt;theta);
<a name="l244"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l245"></a> tmpt-&gt;theta += dt * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>;
<a name="l246"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l247"></a> tmpt-&gt;theta -= dt * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>;
<a name="l248"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l249"></a> }
<a name="l250"></a>
<a name="l251"></a> tmpb = bomb_head.next;
<a name="l252"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &amp;bomb_head)
<a name="l253"></a> {
<a name="l254"></a> tmpb1 = tmpb-&gt;next;
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;t + FALL_TIME + EXPLODE_TIME &lt; </span><span class=cF5>tS</span><span class=cF0>)
<a name="l256"></a> BombHit(tmpb);
<a name="l257"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;t + FALL_TIME &lt; </span><span class=cF5>tS</span><span class=cF0> &amp;&amp; !tmpb-&gt;exploding)
<a name="l258"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l259"></a> </span><span class=cF5>Noise</span><span class=cF0>(EXPLODE_TIME * </span><span class=cFE>1000</span><span class=cF0>, </span><span class=cFE>62</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>);
<a name="l260"></a> tmpb-&gt;exploding = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l262"></a> tmpb = tmpb1;
<a name="l263"></a> }
<a name="l264"></a>
<a name="l265"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>10</span><span class=cF0>);
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l267"></a>
<a name="l268"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l269"></a>}
<a name="l270"></a>
<a name="l271"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l272"></a>{
<a name="l273"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l274"></a> Target *tmpt;
<a name="l275"></a>
<a name="l276"></a> v = </span><span class=cFE>20</span><span class=cF0>;
<a name="l277"></a> x = -MAP_WIDTH &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l278"></a> y = -MAP_HEIGHT &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l279"></a> thetaf = theta = </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>;
<a name="l280"></a>
<a name="l281"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;bomb_head);
<a name="l282"></a>
<a name="l283"></a> </span><span class=cF5>MemSet</span><span class=cF0>(trees, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>trees</span><span class=cF7>)</span><span class=cF0>);
<a name="l284"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TREES_NUM; i++)
<a name="l285"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l286"></a> trees[i].x = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_WIDTH - MAP_WIDTH &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l287"></a> trees[i].y = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_HEIGHT - MAP_HEIGHT &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l288"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l289"></a>
<a name="l290"></a> </span><span class=cF5>MemSet</span><span class=cF0>(targets, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>targets</span><span class=cF7>)</span><span class=cF0>);
<a name="l291"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; TARGETS_NUM; i++)
<a name="l292"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l293"></a> tmpt = &amp;targets[i];
<a name="l294"></a> tmpt-&gt;x = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_WIDTH - MAP_WIDTH &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l295"></a> tmpt-&gt;y = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_HEIGHT - MAP_HEIGHT &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt; TARGETS_NUM / </span><span class=cFE>3</span><span class=cF0>)
<a name="l297"></a> {
<a name="l298"></a> tmpt-&gt;type = MDF_BUNKER;
<a name="l299"></a> tmpt-&gt;theta = (</span><span class=cF5>RandU16</span><span class=cF0> &amp; </span><span class=cFE>3</span><span class=cF0>) * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>;
<a name="l300"></a> tmpt-&gt;alive_img = </span><span class=cFA>&lt;6&gt;</span><span class=cF0>;
<a name="l301"></a> tmpt-&gt;dead_img1 = </span><span class=cFA>&lt;7&gt;</span><span class=cF0>;
<a name="l302"></a> tmpt-&gt;dead_img2 = </span><span class=cFA>&lt;8&gt;</span><span class=cF0>;
<a name="l303"></a> }
<a name="l304"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l305"></a> {
<a name="l306"></a> tmpt-&gt;type = MDF_TANK;
<a name="l307"></a> tmpt-&gt;theta = </span><span class=cF5>Rand</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0>;
<a name="l308"></a> tmpt-&gt;alive_img = </span><span class=cFA>&lt;3&gt;</span><span class=cF0>;
<a name="l309"></a> tmpt-&gt;dead_img1 = </span><span class=cFA>&lt;4&gt;</span><span class=cF0>;
<a name="l310"></a> tmpt-&gt;dead_img2 = </span><span class=cFA>&lt;5&gt;</span><span class=cF0>;
<a name="l311"></a> }
<a name="l312"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l313"></a> key_count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l314"></a> target_count = TARGETS_NUM;
<a name="l315"></a>}
<a name="l316"></a>
<a name="l317"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
<a name="l318"></a>{
<a name="l319"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&amp;bomb_head, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l320"></a>}
<a name="l321"></a>
<a name="l322"></a></span><span class=cF1>U0</span><span class=cF0> BomberGolf()
<a name="l323"></a>{
<a name="l324"></a> </span><span class=cF9>I64</span><span class=cF0> sc;
<a name="l325"></a>
<a name="l326"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l327"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l328"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l329"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l330"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l331"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l332"></a> </span><span class=cF6>&quot; Faster(,,SC_CURSOR_UP);&quot;</span><span class=cF0>
<a name="l333"></a> </span><span class=cF6>&quot; Slower(,,SC_CURSOR_DOWN);&quot;</span><span class=cF0>
<a name="l334"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l335"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l336"></a> </span><span class=cF6>&quot; Bomb(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l337"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l338"></a> );
<a name="l339"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l340"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l341"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l342"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l343"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l344"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l345"></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=cF5>Fs</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="l346"></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="l347"></a> Init;
<a name="l348"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l349"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l350"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l351"></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="l352"></a> {
<a name="l353"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
<a name="l354"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l355"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l356"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l357"></a> v += </span><span class=cFE>10</span><span class=cF0>;
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (v &gt; </span><span class=cFE>300</span><span class=cF0>)
<a name="l359"></a> v = </span><span class=cFE>300</span><span class=cF0>;
<a name="l360"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l361"></a>
<a name="l362"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l363"></a> v -= </span><span class=cFE>10</span><span class=cF0>;
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (v &lt; </span><span class=cFE>20</span><span class=cF0>)
<a name="l365"></a> v = </span><span class=cFE>20</span><span class=cF0>;
<a name="l366"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l367"></a>
<a name="l368"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l369"></a> key_count++;
<a name="l370"></a> thetaf += </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF5>Wrap</span><span class=cF0>(thetaf - theta, -</span><span class=cF3>pi</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0>);
<a name="l371"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l372"></a>
<a name="l373"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l374"></a> key_count++;
<a name="l375"></a> thetaf -= </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF5>Wrap</span><span class=cF0>(thetaf - theta, -</span><span class=cF3>pi</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0>);
<a name="l376"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l377"></a>
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l379"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l380"></a>
<a name="l381"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l382"></a> key_count++;
<a name="l383"></a> BombDrop(-x - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>8</span><span class=cF0> * FALL_TIME * v * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, -y - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>8</span><span class=cF0> * FALL_TIME * v * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>);
<a name="l384"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l385"></a>
<a name="l386"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l387"></a> CleanUp;
<a name="l388"></a> Init;
<a name="l389"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l390"></a>
<a name="l391"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l392"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l393"></a> </span><span class=cF1>goto</span><span class=cF0> bm_done;
<a name="l394"></a> }
<a name="l395"></a>bm_done:
<a name="l396"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l397"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l398"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l399"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l400"></a> CleanUp;
<a name="l401"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l402"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS/BomberGolf&quot;</span><span class=cF0>, </span><span class=cF6>&quot;I64 best_score=%d;\n&quot;</span><span class=cF0>, best_score);
<a name="l403"></a>}
<a name="l404"></a>
<a name="l405"></a>BomberGolf;
</span></pre></body>
</html>