mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
337 lines
32 KiB
HTML
Executable file
337 lines
32 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.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.c70{color:#ffffff;background-color:#bcc0b9;}
|
|
.c7A{color:#82bc49;background-color:#bcc0b9;}
|
|
.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>"ZealOS/FlapBat"</span><span class=cF0>, </span><span class=cF6>"F64 best_score=9999;\n"</span><span class=cF0>);
|
|
<a name="l2"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>"ZealOS/FlapBat"</span><span class=cF0>);
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>
|
|
<a name="l5"></a></span><span class=c70>
|
|
<a name="l6"></a>
|
|
<a name="l7"></a>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a> </span><span class=c7A><1>/* Graphics Not Rendered in HTML */</span><span class=c70>
|
|
<a name="l10"></a>
|
|
<a name="l11"></a>
|
|
<a name="l12"></a> </span><span class=c7A><2>/* Graphics Not Rendered in HTML */</span><span class=c70>
|
|
<a name="l13"></a>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a>
|
|
<a name="l16"></a>
|
|
<a name="l17"></a>
|
|
<a name="l18"></a> </span><span class=c7A><3>/* Graphics Not Rendered in HTML */</span><span class=c70>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a>
|
|
<a name="l21"></a> </span><span class=c7A><4>/* Graphics Not Rendered in HTML */</span><span class=c70>
|
|
<a name="l22"></a>
|
|
<a name="l23"></a>
|
|
<a name="l24"></a> </span><span class=c7A><5>/* Graphics Not Rendered in HTML */</span><span class=c70>
|
|
<a name="l25"></a>
|
|
<a name="l26"></a>
|
|
<a name="l27"></a>
|
|
<a name="l28"></a></span><span class=cF0>
|
|
<a name="l29"></a>#</span><span class=cF1>define</span><span class=cF0> BORDER </span><span class=cFE>6</span><span class=cF0>
|
|
<a name="l30"></a>#</span><span class=cF1>define</span><span class=cF0> EAT_TIME </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l31"></a>#</span><span class=cF1>define</span><span class=cF0> FLAP_TIME </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l32"></a>#</span><span class=cF1>define</span><span class=cF0> BAT_BOX </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l33"></a>
|
|
<a name="l34"></a></span><span class=cF1>Bool</span><span class=cF0> flap_down, flap_up;
|
|
<a name="l35"></a></span><span class=cF1>F64</span><span class=cF0> flap_phase, delta_phase, bat_y, bat_x, eat_timeout, flap_time;
|
|
<a name="l36"></a></span><span class=cF1>F64</span><span class=cF0> frame_x, game_t0, game_tf;
|
|
<a name="l37"></a>
|
|
<a name="l38"></a>#</span><span class=cF1>define</span><span class=cF0> BUGS_NUM </span><span class=cFE>32</span><span class=cF0>
|
|
<a name="l39"></a></span><span class=cF9>I32</span><span class=cF0> bug_count, bugs_x[BUGS_NUM], bugs_y[BUGS_NUM];
|
|
<a name="l40"></a></span><span class=cF1>Bool</span><span class=cF0> bugs_dead[BUGS_NUM];
|
|
<a name="l41"></a>
|
|
<a name="l42"></a>#</span><span class=cF1>define</span><span class=cF0> GLOW_PERIOD </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l43"></a></span><span class=cF1>F64</span><span class=cF0> bugs_glow_phase[BUGS_NUM];
|
|
<a name="l44"></a>
|
|
<a name="l45"></a></span><span class=cF9>CDC</span><span class=cF0> *limit_flood_fill_dc; </span><span class=cF2>//Prevent uncontrolled flood-fill flicker.</span><span class=cF0>
|
|
<a name="l46"></a>
|
|
<a name="l47"></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="l48"></a>{
|
|
<a name="l49"></a> </span><span class=cF9>I64</span><span class=cF0> i, y, x,
|
|
<a name="l50"></a> h = </span><span class=cF5>MaxI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, task->pix_width - </span><span class=cFE>2</span><span class=cF0> * BORDER),
|
|
<a name="l51"></a> v = </span><span class=cF5>MaxI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, task->pix_height - </span><span class=cFE>2</span><span class=cF0> * BORDER);
|
|
<a name="l52"></a> </span><span class=cF1>U8</span><span class=cF0> *tmps, *tmps2, *tmps3;
|
|
<a name="l53"></a> </span><span class=cF1>F64</span><span class=cF0> tt = flap_phase * flap_phase * flap_phase, ts = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l54"></a>
|
|
<a name="l55"></a> bat_x = task->pix_width >> </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l56"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cFE>7</span><span class=cF0> * task->pix_width</span><span class=cF7>)</span><span class=cF0> >> </span><span class=cFE>3</span><span class=cF0>, </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><5></span><span class=cF0>);
|
|
<a name="l57"></a>
|
|
<a name="l58"></a> dc->color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l59"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, bat_x + </span><span class=cFE>5</span><span class=cF0> + </span><span class=cFE>20</span><span class=cF0> * </span><span class=cF5>Saw</span><span class=cF7>(</span><span class=cFE>15</span><span class=cF0> * </span><span class=cF5>tS</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, bat_y, </span><span class=cFE>10</span><span class=cF0> + </span><span class=cFE>20</span><span class=cF0> * </span><span class=cF5>Saw</span><span class=cF7>(</span><span class=cFE>15</span><span class=cF0> * </span><span class=cF5>tS</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>, -</span><span class=cF3>pi</span><span class=cF0>/</span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>pi</span><span class=cF0>/</span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l60"></a>
|
|
<a name="l61"></a> tmps = </span><span class=cF5>SpriteInterpolate</span><span class=cF0>(tt, </span><span class=cFA><1></span><span class=cF0>, </span><span class=cFA><2></span><span class=cF0>);
|
|
<a name="l62"></a> </span><span class=cF1>if</span><span class=cF0> (eat_timeout && </span><span class=cF5>tS</span><span class=cF0> < eat_timeout)
|
|
<a name="l63"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l64"></a> tmps2 = </span><span class=cF5>SpriteInterpolate</span><span class=cF0>(tt, </span><span class=cFA><3></span><span class=cF0>, </span><span class=cFA><4></span><span class=cF0>);
|
|
<a name="l65"></a> tmps3 = </span><span class=cF5>SpriteInterpolate</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - </span><span class=cF7>(</span><span class=cF0>eat_timeout - </span><span class=cF5>tS</span><span class=cF7>)</span><span class=cF0> / EAT_TIME, tmps2, tmps);
|
|
<a name="l66"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l67"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps2);
|
|
<a name="l68"></a> tmps = tmps3;
|
|
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l70"></a>
|
|
<a name="l71"></a> </span><span class=cF5>DCFill</span><span class=cF0>(limit_flood_fill_dc);
|
|
<a name="l72"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(limit_flood_fill_dc, </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>32</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmps);
|
|
<a name="l73"></a>
|
|
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrPeek</span><span class=cF7>(</span><span class=cF0>limit_flood_fill_dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
|
|
<a name="l75"></a> </span><span class=cF7>{</span><span class=cF2>//Did FloodFill go crazy?</span><span class=cF0>
|
|
<a name="l76"></a> limit_flood_fill_dc->color = </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
|
|
<a name="l77"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(limit_flood_fill_dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l79"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, bat_x - </span><span class=cFE>16</span><span class=cF0>, bat_y - </span><span class=cFE>32</span><span class=cF0>, limit_flood_fill_dc);
|
|
<a name="l80"></a>
|
|
<a name="l81"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l82"></a>
|
|
<a name="l83"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < BUGS_NUM; i++)
|
|
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (!bugs_dead[i])
|
|
<a name="l85"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l86"></a> x = (bugs_x[i] + frame_x) % h + BORDER;
|
|
<a name="l87"></a> y = bugs_y[i] % v + BORDER;
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Saw</span><span class=cF7>(</span><span class=cF0>ts + bugs_glow_phase[i], GLOW_PERIOD</span><span class=cF7>)</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l89"></a> {
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (i & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l91"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l92"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l93"></a> dc->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l94"></a> }
|
|
<a name="l95"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l96"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l97"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, x, y);
|
|
<a name="l98"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, x + </span><span class=cFE>1</span><span class=cF0>, y);
|
|
<a name="l99"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, x, y - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l101"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf)
|
|
<a name="l103"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l104"></a> dc->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l105"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>task->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> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>task->pix_height - </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>"Game Completed"</span><span class=cF0>);
|
|
<a name="l106"></a> tt = game_tf;
|
|
<a name="l107"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l108"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l110"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l111"></a> tt = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l113"></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>"Bugs:%3.1f%% Time:%3.2f Best:%3.2f"</span><span class=cF0>,
|
|
<a name="l114"></a> </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF0>BUGS_NUM - bug_count</span><span class=cF7>)</span><span class=cF0> / BUGS_NUM, tt-game_t0, best_score);
|
|
<a name="l115"></a>}
|
|
<a name="l116"></a>
|
|
<a name="l117"></a></span><span class=cF1>U0</span><span class=cF0> CheckBugs(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l118"></a>{
|
|
<a name="l119"></a> </span><span class=cF9>I64</span><span class=cF0> i, x, y,
|
|
<a name="l120"></a> h = </span><span class=cF5>MaxI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, task->pix_width - </span><span class=cFE>2</span><span class=cF0> * BORDER),
|
|
<a name="l121"></a> v = </span><span class=cF5>MaxI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, task->pix_height - </span><span class=cFE>2</span><span class=cF0> * BORDER);
|
|
<a name="l122"></a>
|
|
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (eat_timeout && eat_timeout - </span><span class=cF5>tS</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>75</span><span class=cF0> * EAT_TIME)
|
|
<a name="l124"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l125"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task->song_task, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> >= eat_timeout)
|
|
<a name="l127"></a> eat_timeout = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l129"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < BUGS_NUM; i++)
|
|
<a name="l130"></a> </span><span class=cF1>if</span><span class=cF0> (!bugs_dead[i])
|
|
<a name="l131"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l132"></a> x = (bugs_x[i] + frame_x) % h + BORDER;
|
|
<a name="l133"></a> y = bugs_y[i] % v + BORDER;
|
|
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>x - bat_x</span><span class=cF7>)</span><span class=cF0> < BAT_BOX && </span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>y - bat_y</span><span class=cF7>)</span><span class=cF0> < BAT_BOX)
|
|
<a name="l135"></a> {
|
|
<a name="l136"></a> bugs_dead[i] = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l137"></a> eat_timeout = </span><span class=cF5>tS</span><span class=cF0> + EAT_TIME;
|
|
<a name="l138"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l139"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task->song_task);
|
|
<a name="l140"></a> bug_count--;
|
|
<a name="l141"></a> }
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (!game_tf && !bug_count)
|
|
<a name="l144"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l145"></a> game_tf = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l146"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task->song_task);
|
|
<a name="l147"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf - game_t0 < best_score)
|
|
<a name="l149"></a> best_score = game_tf - game_t0;
|
|
<a name="l150"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l151"></a> frame_x -= </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (frame_x < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l153"></a> frame_x += h;
|
|
<a name="l154"></a>}
|
|
<a name="l155"></a>
|
|
<a name="l156"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l157"></a>{
|
|
<a name="l158"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l159"></a>
|
|
<a name="l160"></a> limit_flood_fill_dc = </span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cFE>32</span><span class=cF0>, </span><span class=cFE>40</span><span class=cF0>);
|
|
<a name="l161"></a> flap_down = flap_up = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l162"></a> flap_phase = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l163"></a> bat_x = </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l164"></a> bat_y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l165"></a> frame_x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l166"></a> bug_count = BUGS_NUM;
|
|
<a name="l167"></a>
|
|
<a name="l168"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < BUGS_NUM; i++)
|
|
<a name="l169"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l170"></a> bugs_dead[i] = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l171"></a> bugs_x[i] = </span><span class=cF5>RandU16</span><span class=cF0>;
|
|
<a name="l172"></a> bugs_y[i] = </span><span class=cF5>RandU16</span><span class=cF0>;
|
|
<a name="l173"></a> bugs_glow_phase[i] = GLOW_PERIOD * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l175"></a>
|
|
<a name="l176"></a> </span><span class=cF5>Suspend</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->song_task, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l177"></a> flap_time = eat_timeout = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l178"></a> delta_phase = game_tf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l179"></a> game_t0 = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l180"></a>}
|
|
<a name="l181"></a>
|
|
<a name="l182"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l183"></a>{</span><span class=cF2>//Song by Terry A. Davis</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb = &</span><span class=cF5>SoundTaskEndCB</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l187"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l188"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"4eB5E4B5C4B5EsEFqE4eB5E4B5C4B5EsEF"</span><span class=cF0>);
|
|
<a name="l189"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5qE4eA5D4ABA5DsDCqD4eB5E4B5C4B"</span><span class=cF0>);
|
|
<a name="l190"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5EsEDqE"</span><span class=cF0>);
|
|
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l192"></a>}
|
|
<a name="l193"></a>
|
|
<a name="l194"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l195"></a>{
|
|
<a name="l196"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l197"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l198"></a> </span><span class=cF1>if</span><span class=cF0> (flap_down)
|
|
<a name="l199"></a> {
|
|
<a name="l200"></a> flap_down = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l201"></a> delta_phase = -</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>005</span><span class=cF0> * </span><span class=cF5>Min</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF5>tS</span><span class=cF0> - flap_time</span><span class=cF7>)</span><span class=cF0> / FLAP_TIME);
|
|
<a name="l202"></a> flap_time = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l203"></a> }
|
|
<a name="l204"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (flap_up)
|
|
<a name="l205"></a> {
|
|
<a name="l206"></a> flap_up = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l207"></a> delta_phase = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>005</span><span class=cF0>;
|
|
<a name="l208"></a> }
|
|
<a name="l209"></a> </span><span class=cF1>if</span><span class=cF0> (delta_phase < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l210"></a> {
|
|
<a name="l211"></a> bat_y += </span><span class=cFE>75</span><span class=cF0> * delta_phase;
|
|
<a name="l212"></a> delta_phase += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000015</span><span class=cF0>;
|
|
<a name="l213"></a> }
|
|
<a name="l214"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l215"></a> bat_y += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l216"></a> bat_y = </span><span class=cF5>Clamp</span><span class=cF0>(bat_y, BORDER, </span><span class=cF5>Fs</span><span class=cF0>->parent_task->pix_height - BORDER);
|
|
<a name="l217"></a> flap_phase = </span><span class=cF5>Clamp</span><span class=cF0>(flap_phase + delta_phase, </span><span class=cFE>0</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=cFE>0</span><span class=cF0>);
|
|
<a name="l218"></a> CheckBugs(</span><span class=cF5>Fs</span><span class=cF0>->parent_task);
|
|
<a name="l219"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l220"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l221"></a>}
|
|
<a name="l222"></a>
|
|
<a name="l223"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
|
|
<a name="l224"></a>{
|
|
<a name="l225"></a> </span><span class=cF5>DCDel</span><span class=cF0>(limit_flood_fill_dc);
|
|
<a name="l226"></a>}
|
|
<a name="l227"></a>
|
|
<a name="l228"></a></span><span class=cF1>U0</span><span class=cF0> FlapBat()
|
|
<a name="l229"></a>{
|
|
<a name="l230"></a> </span><span class=cF1>Bool</span><span class=cF0> reset_space = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l231"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
|
|
<a name="l232"></a>
|
|
<a name="l233"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l235"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l236"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l237"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l238"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l239"></a> </span><span class=cF6>" Flap(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l240"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l241"></a> );
|
|
<a name="l242"></a>
|
|
<a name="l243"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(</span><span class=cF6>"Use $GREEN$<SPACE>$FG$ to flap.\nHold down to glide."</span><span class=cF0>);
|
|
<a name="l244"></a>
|
|
<a name="l245"></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="l246"></a> </span><span class=cF5>Fs</span><span class=cF0>->text_attr = </span><span class=cF3>LTGRAY</span><span class=cF0> << </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l247"></a> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
|
|
<a name="l248"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF3>TEXT_COLS</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l249"></a> </span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l250"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l251"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l252"></a> </span><span class=cF5>Fs</span><span class=cF0>->song_task = </span><span class=cF5>Spawn</span><span class=cF0>(&SongTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>"Song"</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l253"></a> Init;
|
|
<a name="l254"></a> </span><span class=cF5>Fs</span><span class=cF0>->animate_task = </span><span class=cF5>Spawn</span><span class=cF0>(&AnimateTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>"Animate"</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l255"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l256"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l257"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l258"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l259"></a> {
|
|
<a name="l260"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageGet</span><span class=cF7>(</span><span class=cF0>&arg1, &arg2, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l261"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l262"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l263"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l264"></a> {
|
|
<a name="l265"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (reset_space)
|
|
<a name="l267"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l268"></a> flap_down = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l269"></a> reset_space = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l270"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l271"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l272"></a>
|
|
<a name="l273"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l274"></a> CleanUp;
|
|
<a name="l275"></a> Init;
|
|
<a name="l276"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l277"></a>
|
|
<a name="l278"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l279"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l280"></a> </span><span class=cF1>goto</span><span class=cF0> bl_done;
|
|
<a name="l281"></a> }
|
|
<a name="l282"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l283"></a>
|
|
<a name="l284"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
|
|
<a name="l285"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l286"></a> {
|
|
<a name="l287"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l288"></a> flap_up = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l289"></a> reset_space = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l290"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l291"></a> }
|
|
<a name="l292"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l293"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l294"></a> }
|
|
<a name="l295"></a>bl_done:
|
|
<a name="l296"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
|
|
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l298"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l299"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l300"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l301"></a> CleanUp;
|
|
<a name="l302"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l303"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"ZealOS/FlapBat"</span><span class=cF0>, </span><span class=cF6>"F64 best_score=%5.4f;\n"</span><span class=cF0>, best_score);
|
|
<a name="l304"></a>}
|
|
<a name="l305"></a>
|
|
<a name="l306"></a>FlapBat;
|
|
</span></pre></body>
|
|
</html>
|