ZealOS/docs/Demo/Games/DunGen.CC.html
TomAwezome 1b75d91002 Fix Mount AHCI Port selection.
Add arg to SATARep to specify drive types to show.
Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
2021-08-02 16:40:05 -04:00

527 lines
53 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.13">
<style type="text/css">
body {background-color:#fef1f0;}
.c00{color:#000000;background-color:#000000;}
.c0A{color:#82bc49;background-color:#000000;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</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/DunGen&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/DunGen&quot;</span><span class=cF0>);
<a name="l3"></a>
<a name="l4"></a></span><span class=cF2>//Set snap to 4 and width to 4</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>//if you edit this map.</span><span class=cF0>
<a name="l6"></a>
<a name="l7"></a></span><span class=cF2>//Don't forget to change the</span><span class=cF0>
<a name="l8"></a></span><span class=cF2>//starting pos.</span><span class=cF0>
<a name="l9"></a></span><span class=c00>
<a name="l10"></a></span><span class=c0A>
<a name="l11"></a>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l12"></a>
<a name="l13"></a>
<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></span><span class=c0A>
<a name="l21"></a>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l22"></a>
<a name="l23"></a>
<a name="l24"></a></span><span class=c0A>
<a name="l25"></a>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l26"></a>
<a name="l27"></a> </span><span class=c0A>
<a name="l28"></a>&lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l29"></a></span><span class=c0A>
<a name="l30"></a>&lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l31"></a></span><span class=c0A>
<a name="l32"></a>&lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l33"></a></span><span class=c0A>
<a name="l34"></a>&lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l35"></a></span><span class=c0A>
<a name="l36"></a>&lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l37"></a></span><span class=c0A>
<a name="l38"></a>&lt;9&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l39"></a></span><span class=c0A>
<a name="l40"></a>&lt;10&gt;/* Graphics Not Rendered in HTML */</span><span class=c00>
<a name="l41"></a>
<a name="l42"></a>
<a name="l43"></a></span><span class=cF2>//These are indexed by color #.</span><span class=cF0>
<a name="l44"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3625"><span class=cF4>COLORS</span></a><span class=cF2>.</span><span class=cF0>
<a name="l45"></a>
<a name="l46"></a></span><span class=cF1>U8</span><span class=cF0> *tiles1[</span><span class=cFE>16</span><span class=cF0>]={</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cFA>&lt;7&gt;</span><span class=cF0> , </span><span class=cFA>&lt;5&gt;</span><span class=cF0> , </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cFA>&lt;6&gt;</span><span class=cF0> , </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>};
<a name="l47"></a>
<a name="l48"></a></span><span class=cF1>U8</span><span class=cF0> *tiles2[</span><span class=cFE>16</span><span class=cF0>]={</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cFA>&lt;8&gt;</span><span class=cF0> , </span><span class=cFA>&lt;5&gt;</span><span class=cF0> , </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cFA>&lt;6&gt;</span><span class=cF0> , </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>};
<a name="l49"></a>
<a name="l50"></a>#</span><span class=cF1>define</span><span class=cF0> SCREEN_SCALE </span><span class=cFE>24</span><span class=cF0>
<a name="l51"></a>#</span><span class=cF1>define</span><span class=cF0> SCREEN_WIDTH </span><span class=cFE>24</span><span class=cF0>
<a name="l52"></a>#</span><span class=cF1>define</span><span class=cF0> SCREEN_HEIGHT </span><span class=cFE>24</span><span class=cF0>
<a name="l53"></a></span><span class=cF9>I64</span><span class=cF0> screen_x, screen_y;
<a name="l54"></a>
<a name="l55"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_SCALE </span><span class=cFE>4</span><span class=cF0>
<a name="l56"></a></span><span class=cF9>I64</span><span class=cF0> map_width, map_height;
<a name="l57"></a></span><span class=cF1>U8</span><span class=cF0> *map = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l58"></a>
<a name="l59"></a></span><span class=cF9>I64</span><span class=cF0> man_x, man_y, man_dx, man_dy;
<a name="l60"></a></span><span class=cF1>Bool</span><span class=cF0> man_attack;
<a name="l61"></a></span><span class=cF1>F64</span><span class=cF0> man_attack_t0;
<a name="l62"></a>
<a name="l63"></a>#</span><span class=cF1>define</span><span class=cF0> MONSTERS_NUM </span><span class=cFE>10</span><span class=cF0>
<a name="l64"></a></span><span class=cF9>I64</span><span class=cF0> monsters_left;
<a name="l65"></a></span><span class=cF1>class</span><span class=cF0> Monster
<a name="l66"></a>{
<a name="l67"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, dx, dy;
<a name="l68"></a> </span><span class=cF1>Bool</span><span class=cF0> dead, pad[</span><span class=cFE>7</span><span class=cF0>];
<a name="l69"></a>
<a name="l70"></a>} monsters[MONSTERS_NUM];
<a name="l71"></a>
<a name="l72"></a></span><span class=cF1>F64</span><span class=cF0> t0, tf;
<a name="l73"></a>
<a name="l74"></a>#</span><span class=cF1>define</span><span class=cF0> LOS_SCALE </span><span class=cFE>4</span><span class=cF0>
<a name="l75"></a>
<a name="l76"></a></span><span class=cF1>Bool</span><span class=cF0> LOSPlot(</span><span class=cF1>U8</span><span class=cF0> *, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0>)
<a name="l77"></a>{
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (!map[</span><span class=cF7>(</span><span class=cF0>y / LOS_SCALE</span><span class=cF7>)</span><span class=cF0> * map_width + </span><span class=cF7>(</span><span class=cF0>x / LOS_SCALE</span><span class=cF7>)</span><span class=cF0>])
<a name="l79"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l80"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l81"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l82"></a>}
<a name="l83"></a>
<a name="l84"></a></span><span class=cF1>Bool</span><span class=cF0> LOS(</span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> x2, </span><span class=cF9>I64</span><span class=cF0> y2)
<a name="l85"></a>{</span><span class=cF2>//Line of sight</span><span class=cF0>
<a name="l86"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Line</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, x1 * LOS_SCALE + LOS_SCALE / </span><span class=cFE>2</span><span class=cF0>, y1 * LOS_SCALE + LOS_SCALE / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l87"></a> x2 * LOS_SCALE + LOS_SCALE / </span><span class=cFE>2</span><span class=cF0>, y2 * LOS_SCALE + LOS_SCALE / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &amp;LOSPlot);
<a name="l88"></a>}
<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>CDC</span><span class=cF0> *dc_t = </span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2, task);
<a name="l93"></a> </span><span class=cF9>I64</span><span class=cF0> i, x, y, xx, yy, x1, y1, z1, color,
<a name="l94"></a> cx = task-&gt;pix_width / </span><span class=cFE>2</span><span class=cF0>,
<a name="l95"></a> cy = task-&gt;pix_height / </span><span class=cFE>2</span><span class=cF0>;
<a name="l96"></a> </span><span class=cF9>CD3I32</span><span class=cF0> poly[</span><span class=cFE>4</span><span class=cF0>];
<a name="l97"></a> </span><span class=cF1>U8</span><span class=cF0> **_tiles;
<a name="l98"></a> </span><span class=cF1>F64</span><span class=cF0> tt;
<a name="l99"></a> Monster *tmpm;
<a name="l100"></a>
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF7>(</span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0>)
<a name="l102"></a> _tiles = tiles1;
<a name="l103"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l104"></a> _tiles = tiles2;
<a name="l105"></a>
<a name="l106"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc_t-&gt;r, </span><span class=cFE>60</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>360</span><span class=cF0>);
<a name="l107"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc_t-&gt;r, </span><span class=cFE>15</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>360</span><span class=cF0>);
<a name="l108"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc_t, dc_t-&gt;r);
<a name="l109"></a> dc_t-&gt;x = task-&gt;pix_width / </span><span class=cFE>2</span><span class=cF0>;
<a name="l110"></a> dc_t-&gt;y = task-&gt;pix_height / </span><span class=cFE>2</span><span class=cF0>;
<a name="l111"></a> dc_t-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l112"></a>
<a name="l113"></a> </span><span class=cF2>//You could make it much more efficient</span><span class=cF0>
<a name="l114"></a> </span><span class=cF2>//if you did it like </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/Games/BigGuns.CC.html#l1"><span class=cF4>::/Demo/Games/BigGuns.CC</span></a><span class=cF0>
<a name="l115"></a> </span><span class=cF2>//with a </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4304"><span class=cF4>CDC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF1>for</span><span class=cF0> (y = -SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>; y &lt; SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>; y++)
<a name="l118"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> yy = y + screen_y;
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= yy &lt; map_height)
<a name="l121"></a> </span><span class=cF1>for</span><span class=cF0> (x = -SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>; x &lt; SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>; x++)
<a name="l122"></a> {
<a name="l123"></a> xx = x + screen_x;
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= xx &lt; map_width)
<a name="l125"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>color = map[yy * map_width + xx]</span><span class=cF7>)</span><span class=cF0> &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>xx, yy, man_x, man_y</span><span class=cF7>)</span><span class=cF0>)
<a name="l127"></a> {
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (_tiles[color])
<a name="l129"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l130"></a> x1 = x * SCREEN_SCALE;
<a name="l131"></a> y1 = y * SCREEN_SCALE;
<a name="l132"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l133"></a> </span><span class=cF5>DCTransform</span><span class=cF0>(dc_t, &amp;x1, &amp;y1, &amp;z1);
<a name="l134"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, _tiles[color]);
<a name="l135"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l136"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l137"></a> </span><span class=cF7>{</span><span class=cF2>//If no tile defined, do solid color.</span><span class=cF0>
<a name="l138"></a> poly[</span><span class=cFE>0</span><span class=cF0>].x = x * SCREEN_SCALE;
<a name="l139"></a> poly[</span><span class=cFE>0</span><span class=cF0>].y = y * SCREEN_SCALE;
<a name="l140"></a> poly[</span><span class=cFE>0</span><span class=cF0>].z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l141"></a> poly[</span><span class=cFE>1</span><span class=cF0>].x = (x + </span><span class=cFE>1</span><span class=cF0>) * SCREEN_SCALE - </span><span class=cFE>1</span><span class=cF0>;
<a name="l142"></a> poly[</span><span class=cFE>1</span><span class=cF0>].y = y * SCREEN_SCALE;
<a name="l143"></a> poly[</span><span class=cFE>1</span><span class=cF0>].z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l144"></a> poly[</span><span class=cFE>2</span><span class=cF0>].x = (x + </span><span class=cFE>1</span><span class=cF0>) * SCREEN_SCALE;
<a name="l145"></a> poly[</span><span class=cFE>2</span><span class=cF0>].y = (y + </span><span class=cFE>1</span><span class=cF0>) * SCREEN_SCALE - </span><span class=cFE>1</span><span class=cF0>;
<a name="l146"></a> poly[</span><span class=cFE>2</span><span class=cF0>].z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l147"></a> poly[</span><span class=cFE>3</span><span class=cF0>].x = x * SCREEN_SCALE - </span><span class=cFE>1</span><span class=cF0>;
<a name="l148"></a> poly[</span><span class=cFE>3</span><span class=cF0>].y = (y + </span><span class=cFE>1</span><span class=cF0>) * SCREEN_SCALE - </span><span class=cFE>1</span><span class=cF0>;
<a name="l149"></a> poly[</span><span class=cFE>3</span><span class=cF0>].z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l150"></a> dc_t-&gt;color = color;
<a name="l151"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc_t, </span><span class=cFE>4</span><span class=cF0>, poly);
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l153"></a> }
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l155"></a> }
<a name="l156"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l157"></a>
<a name="l158"></a> </span><span class=cF1>for</span><span class=cF0> (y = -SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>; y &lt; SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>; y++)
<a name="l159"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l160"></a> yy = y + screen_y;
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= yy &lt; map_height)
<a name="l162"></a> </span><span class=cF1>for</span><span class=cF0> (x = -SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>; x &lt; SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>; x++)
<a name="l163"></a> {
<a name="l164"></a> xx = x + screen_x;
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= xx &lt; map_width)
<a name="l166"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (!map[yy * map_width + xx])
<a name="l168"></a> {
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (yy + </span><span class=cFE>1</span><span class=cF0> &lt; map_height &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>xx, yy + </span><span class=cFE>1</span><span class=cF0>, man_x, man_y</span><span class=cF7>)</span><span class=cF0>)
<a name="l170"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l171"></a> x1 = x * SCREEN_SCALE;
<a name="l172"></a> y1 = y * SCREEN_SCALE;
<a name="l173"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l174"></a> </span><span class=cF5>DCTransform</span><span class=cF0>(dc_t, &amp;x1, &amp;y1, &amp;z1);
<a name="l175"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, </span><span class=cFA>&lt;9&gt;</span><span class=cF0>);
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (xx + </span><span class=cFE>1</span><span class=cF0> &lt; map_width &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>xx + </span><span class=cFE>1</span><span class=cF0>, yy, man_x, man_y</span><span class=cF7>)</span><span class=cF0>)
<a name="l178"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l179"></a> x1 = x * SCREEN_SCALE;
<a name="l180"></a> y1 = y * SCREEN_SCALE;
<a name="l181"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l182"></a> </span><span class=cF5>DCTransform</span><span class=cF0>(dc_t, &amp;x1, &amp;y1, &amp;z1);
<a name="l183"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, </span><span class=cFA>&lt;10&gt;</span><span class=cF0>);
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l185"></a> }
<a name="l186"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l187"></a> }
<a name="l188"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l189"></a>
<a name="l190"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, tmpm = monsters; i &lt; MONSTERS_NUM; i++, tmpm++)
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpm-&gt;dead &amp;&amp; LOS</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;x, tmpm-&gt;y, man_x, man_y</span><span class=cF7>)</span><span class=cF0>)
<a name="l192"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l193"></a> x1 = (tmpm-&gt;x - screen_x) * SCREEN_SCALE + SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0>;
<a name="l194"></a> y1 = (tmpm-&gt;y - screen_y) * SCREEN_SCALE + SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0>;
<a name="l195"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l196"></a> </span><span class=cF5>DCTransform</span><span class=cF0>(dc_t, &amp;x1, &amp;y1, &amp;z1);
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;dx &lt; </span><span class=cFE>0</span><span class=cF0>) {
<a name="l198"></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="l199"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc, x1, y1, x1, y1 + </span><span class=cFE>1</span><span class=cF0>);
<a name="l200"></a> }
<a name="l201"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l202"></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="l203"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, </span><span class=cFA>&lt;4&gt;</span><span class=cF0>);
<a name="l204"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l205"></a>
<a name="l206"></a> x1 = (man_x - screen_x) * SCREEN_SCALE + SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0>;
<a name="l207"></a> y1 = (man_y - screen_y) * SCREEN_SCALE + SCREEN_SCALE / </span><span class=cFE>2</span><span class=cF0>;
<a name="l208"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> - man_attack_t0 &lt; </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>)
<a name="l210"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l211"></a> x1 += </span><span class=cF5>Tri</span><span class=cF0>(</span><span class=cF5>tS</span><span class=cF0> - man_attack_t0, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>) * SCREEN_SCALE * man_dx;
<a name="l212"></a> y1 += </span><span class=cF5>Tri</span><span class=cF0>(</span><span class=cF5>tS</span><span class=cF0> - man_attack_t0, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>) * SCREEN_SCALE * man_dy;
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (man_dy != </span><span class=cFE>1</span><span class=cF0>)
<a name="l214"></a> y1 -= </span><span class=cF5>Saw</span><span class=cF0>(</span><span class=cF5>tS</span><span class=cF0> - man_attack_t0, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>) * SCREEN_SCALE;
<a name="l215"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l216"></a> </span><span class=cF5>DCTransform</span><span class=cF0>(dc_t, &amp;x1, &amp;y1, &amp;z1);
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (man_dx &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l219"></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="l220"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc, x1, y1, x1, y1 + </span><span class=cFE>1</span><span class=cF0>);
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l222"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l223"></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="l224"></a>
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> - man_attack_t0 &lt; </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>)
<a name="l226"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, </span><span class=cFA>&lt;3&gt;</span><span class=cF0>);
<a name="l227"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l228"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x1, y1, z1, </span><span class=cFA>&lt;2&gt;</span><span class=cF0>);
<a name="l229"></a>
<a name="l230"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc_t);
<a name="l231"></a>
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (tf)
<a name="l233"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l234"></a> dc-&gt;color = </span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l236"></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="l237"></a> tt = tf;
<a name="l238"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l240"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l241"></a> dc-&gt;color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l242"></a> tt = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l243"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l244"></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>, monsters_left, tt - t0, best_score);
<a name="l245"></a>}
<a name="l246"></a>
<a name="l247"></a></span><span class=cF1>U0</span><span class=cF0> Attack()
<a name="l248"></a>{
<a name="l249"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l250"></a> Monster *tmpm;
<a name="l251"></a>
<a name="l252"></a> man_attack_t0 = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l253"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>53</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>);
<a name="l254"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, tmpm = monsters; i &lt; MONSTERS_NUM; i++, tmpm++)
<a name="l255"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l256"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpm-&gt;dead &amp;&amp; man_x + man_dx == tmpm-&gt;x &amp;&amp; man_y + man_dy == tmpm-&gt;y)
<a name="l257"></a> {
<a name="l258"></a> tmpm-&gt;dead = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (!--monsters_left)
<a name="l260"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l261"></a> tf = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (tf - t0 &lt; best_score)
<a name="l263"></a> best_score = tf - t0;
<a name="l264"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l265"></a> }
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l267"></a>}
<a name="l268"></a>
<a name="l269"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l270"></a>{
<a name="l271"></a> </span><span class=cF9>I64</span><span class=cF0> i, x, y;
<a name="l272"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc;
<a name="l273"></a> Monster *tmpm;
<a name="l274"></a>
<a name="l275"></a> dc = </span><span class=cF5>Sprite2DC</span><span class=cF0>(</span><span class=cFA>&lt;1&gt;</span><span class=cF0>);
<a name="l276"></a> map_width = dc-&gt;width / MAP_SCALE;
<a name="l277"></a> map_height = dc-&gt;height / MAP_SCALE;
<a name="l278"></a> </span><span class=cF5>Free</span><span class=cF0>(map);
<a name="l279"></a> map = </span><span class=cF5>MAlloc</span><span class=cF0>(map_width * map_height * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF7>)</span><span class=cF0>);
<a name="l280"></a> </span><span class=cF1>for</span><span class=cF0> (y = </span><span class=cFE>0</span><span class=cF0>; y &lt; map_height; y++)
<a name="l281"></a> </span><span class=cF1>for</span><span class=cF0> (x = </span><span class=cFE>0</span><span class=cF0>; x &lt; map_width; x++)
<a name="l282"></a> map[y * map_width + x] = </span><span class=cF5>GrPeek</span><span class=cF0>(dc, x * MAP_SCALE, y * MAP_SCALE);
<a name="l283"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l284"></a>
<a name="l285"></a> man_attack_t0 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l286"></a> man_attack = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l287"></a> man_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l288"></a> man_y = </span><span class=cFE>4</span><span class=cF0>;
<a name="l289"></a> man_dx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l290"></a> man_dy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l291"></a> screen_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l292"></a> screen_y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l293"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, tmpm = monsters; i &lt; MONSTERS_NUM; i++, tmpm++)
<a name="l294"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l295"></a> tmpm-&gt;dead = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l296"></a> tmpm-&gt;dx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l297"></a> tmpm-&gt;dy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l299"></a> {
<a name="l300"></a> tmpm-&gt;x = </span><span class=cF5>RandU64</span><span class=cF0> % (map_width - </span><span class=cFE>2</span><span class=cF0>) + </span><span class=cFE>1</span><span class=cF0>;
<a name="l301"></a> tmpm-&gt;y = </span><span class=cF5>RandU64</span><span class=cF0> % (map_height - </span><span class=cFE>2</span><span class=cF0>) + </span><span class=cFE>1</span><span class=cF0>;
<a name="l302"></a> }
<a name="l303"></a> </span><span class=cF1>while</span><span class=cF0> (!map[</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;y</span><span class=cF7>)</span><span class=cF0> * map_width + tmpm-&gt;x]);
<a name="l304"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l305"></a> monsters_left = MONSTERS_NUM;
<a name="l306"></a> tf = </span><span class=cFE>0</span><span class=cF0>;
<a name="l307"></a> t0 = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l308"></a>}
<a name="l309"></a>
<a name="l310"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
<a name="l311"></a>{
<a name="l312"></a> </span><span class=cF5>Free</span><span class=cF0>(map);
<a name="l313"></a> map = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l314"></a>}
<a name="l315"></a>
<a name="l316"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l317"></a>{
<a name="l318"></a> </span><span class=cF9>I64</span><span class=cF0> i, x, y, dx, dy;
<a name="l319"></a> Monster *tmpm;
<a name="l320"></a>
<a name="l321"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l322"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l323"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, tmpm = monsters; i &lt; MONSTERS_NUM; i++, tmpm++)
<a name="l324"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpm-&gt;dead)
<a name="l325"></a> {
<a name="l326"></a> dx = </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cFE>3</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l327"></a> dy = </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cFE>3</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l328"></a> x = tmpm-&gt;x + dx;
<a name="l329"></a> y = tmpm-&gt;y + dy;
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= x &lt; map_width &amp;&amp; </span><span class=cFE>0</span><span class=cF0> &lt;= y &lt; map_height &amp;&amp; map[y * map_width + x])
<a name="l331"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l332"></a> tmpm-&gt;x = x;
<a name="l333"></a> tmpm-&gt;y = y;
<a name="l334"></a> tmpm-&gt;dx = dx;
<a name="l335"></a> tmpm-&gt;dy = dy;
<a name="l336"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l337"></a> }
<a name="l338"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0>);
<a name="l339"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l340"></a>}
<a name="l341"></a>
<a name="l342"></a></span><span class=cF1>U0</span><span class=cF0> DunGen()
<a name="l343"></a>{
<a name="l344"></a> </span><span class=cF9>I64</span><span class=cF0> ch, sc;
<a name="l345"></a>
<a name="l346"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l347"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l348"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l349"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l350"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l351"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l352"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l353"></a> </span><span class=cF6>&quot; Up(,,SC_CURSOR_UP);&quot;</span><span class=cF0>
<a name="l354"></a> </span><span class=cF6>&quot; Down(,,SC_CURSOR_DOWN);&quot;</span><span class=cF0>
<a name="l355"></a> </span><span class=cF6>&quot; Left(,,SC_CURSOR_LEFT);&quot;</span><span class=cF0>
<a name="l356"></a> </span><span class=cF6>&quot; Right(,,SC_CURSOR_RIGHT);&quot;</span><span class=cF0>
<a name="l357"></a> </span><span class=cF6>&quot; Attack(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l358"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l359"></a> );
<a name="l360"></a>
<a name="l361"></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="l362"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr = </span><span class=cF3>BLACK</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l363"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l364"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l365"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l366"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l367"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l368"></a> Init;
<a name="l369"></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="l370"></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="l371"></a>
<a name="l372"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l373"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l374"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l375"></a> {
<a name="l376"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageGet</span><span class=cF7>(</span><span class=cF0>&amp;ch, &amp;sc, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
<a name="l377"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l378"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l379"></a> </span><span class=cF1>switch</span><span class=cF0> (ch)
<a name="l380"></a> {
<a name="l381"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l382"></a> Init;
<a name="l383"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l384"></a>
<a name="l385"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l386"></a> man_attack = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l388"></a>
<a name="l389"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l390"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l391"></a> </span><span class=cF1>goto</span><span class=cF0> dg_done;
<a name="l392"></a>
<a name="l393"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
<a name="l394"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l395"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l396"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
<a name="l397"></a> </span><span class=cF1>if</span><span class=cF0> (man_attack)
<a name="l398"></a> {
<a name="l399"></a> man_dx = </span><span class=cFE>1</span><span class=cF0>;
<a name="l400"></a> man_dy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l401"></a> Attack;
<a name="l402"></a> }
<a name="l403"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l404"></a> </span><span class=cF1>if</span><span class=cF0> (man_x + </span><span class=cFE>1</span><span class=cF0> &lt; map_width &amp;&amp; map[man_y * map_width + </span><span class=cF7>(</span><span class=cF0>man_x + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>] == </span><span class=cF3>DKGRAY</span><span class=cF0>)
<a name="l405"></a> {
<a name="l406"></a> man_x++;
<a name="l407"></a> </span><span class=cF1>if</span><span class=cF0> (man_x - screen_x &gt; SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>3</span><span class=cF0>)
<a name="l408"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l409"></a> screen_x += SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>;
<a name="l410"></a> </span><span class=cF1>if</span><span class=cF0> (screen_x + SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0> &gt; map_width)
<a name="l411"></a> screen_x = map_width - SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>;
<a name="l412"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l413"></a> }
<a name="l414"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l415"></a>
<a name="l416"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
<a name="l417"></a> </span><span class=cF1>if</span><span class=cF0> (man_attack)
<a name="l418"></a> {
<a name="l419"></a> man_dx = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l420"></a> man_dy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l421"></a> Attack;
<a name="l422"></a> }
<a name="l423"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l424"></a> </span><span class=cF1>if</span><span class=cF0> (man_x - </span><span class=cFE>1</span><span class=cF0> &gt;= </span><span class=cFE>0</span><span class=cF0> &amp;&amp; map[man_y * map_width + </span><span class=cF7>(</span><span class=cF0>man_x - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>] == </span><span class=cF3>DKGRAY</span><span class=cF0>)
<a name="l425"></a> {
<a name="l426"></a> man_x--;
<a name="l427"></a> </span><span class=cF1>if</span><span class=cF0> (man_x - screen_x &lt; -SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>)
<a name="l428"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l429"></a> screen_x -= SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>;
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (screen_x - SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0> &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l431"></a> screen_x = SCREEN_WIDTH / </span><span class=cFE>2</span><span class=cF0>;
<a name="l432"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l433"></a> }
<a name="l434"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l435"></a>
<a name="l436"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
<a name="l437"></a> </span><span class=cF1>if</span><span class=cF0> (man_attack)
<a name="l438"></a> {
<a name="l439"></a> man_dx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l440"></a> man_dy = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l441"></a> Attack;
<a name="l442"></a> }
<a name="l443"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l444"></a> </span><span class=cF1>if</span><span class=cF0> (man_y - </span><span class=cFE>1</span><span class=cF0> &gt;= </span><span class=cFE>0</span><span class=cF0> &amp;&amp; map[</span><span class=cF7>(</span><span class=cF0>man_y - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * map_width + man_x] == </span><span class=cF3>DKGRAY</span><span class=cF0>)
<a name="l445"></a> {
<a name="l446"></a> man_y--;
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (man_y - screen_y &lt; -SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>3</span><span class=cF0>)
<a name="l448"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l449"></a> screen_y -= SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>;
<a name="l450"></a> </span><span class=cF1>if</span><span class=cF0> (screen_y - SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0> &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l451"></a> screen_y = SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>;
<a name="l452"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l453"></a> }
<a name="l454"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l455"></a>
<a name="l456"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
<a name="l457"></a> </span><span class=cF1>if</span><span class=cF0> (man_attack)
<a name="l458"></a> {
<a name="l459"></a> man_dx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l460"></a> man_dy = </span><span class=cFE>1</span><span class=cF0>;
<a name="l461"></a> Attack;
<a name="l462"></a> }
<a name="l463"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (man_y + </span><span class=cFE>1</span><span class=cF0> &lt; map_height &amp;&amp; map[</span><span class=cF7>(</span><span class=cF0>man_y + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * map_width + man_x] == </span><span class=cF3>DKGRAY</span><span class=cF0>)
<a name="l465"></a> {
<a name="l466"></a> man_y++;
<a name="l467"></a> </span><span class=cF1>if</span><span class=cF0> (man_y - screen_y &gt; SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>3</span><span class=cF0>)
<a name="l468"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l469"></a> screen_y += SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>;
<a name="l470"></a> </span><span class=cF1>if</span><span class=cF0> (screen_y + SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0> &gt; map_height)
<a name="l471"></a> screen_y = map_height - SCREEN_HEIGHT / </span><span class=cFE>2</span><span class=cF0>;
<a name="l472"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l473"></a> }
<a name="l474"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l475"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l476"></a> }
<a name="l477"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l478"></a>
<a name="l479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
<a name="l480"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l481"></a> man_attack = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l482"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l483"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l484"></a> }
<a name="l485"></a>dg_done:
<a name="l486"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l487"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l488"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l489"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l490"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l491"></a> CleanUp;
<a name="l492"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l493"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;ZealOS/DunGen&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="l494"></a>}
<a name="l495"></a>
<a name="l496"></a>DunGen;
</span></pre></body>
</html>