350 lines
25 KiB
HTML
Executable File
350 lines
25 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF5>RegDft</span><span class=cF0>(</span><span class=cF6>"TempleOS/ZoneOut"</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>"TempleOS/ZoneOut"</span><span class=cF0>);
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a>
|
|
<a name="l7"></a>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a>
|
|
<a name="l10"></a>
|
|
<a name="l11"></a>
|
|
<a name="l12"></a>
|
|
<a name="l13"></a> </span><span class=cFA><1>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a>
|
|
<a name="l16"></a>
|
|
<a name="l17"></a>
|
|
<a name="l18"></a>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a>
|
|
<a name="l21"></a>
|
|
<a name="l22"></a>
|
|
<a name="l23"></a>
|
|
<a name="l24"></a>
|
|
<a name="l25"></a>
|
|
<a name="l26"></a>
|
|
<a name="l27"></a>
|
|
<a name="l28"></a>
|
|
<a name="l29"></a>
|
|
<a name="l30"></a>
|
|
<a name="l31"></a>
|
|
<a name="l32"></a>
|
|
<a name="l33"></a>
|
|
<a name="l34"></a>
|
|
<a name="l35"></a>
|
|
<a name="l36"></a>
|
|
<a name="l37"></a>
|
|
<a name="l38"></a> </span><span class=cFA><2>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l39"></a>
|
|
<a name="l40"></a>
|
|
<a name="l41"></a>
|
|
<a name="l42"></a>
|
|
<a name="l43"></a>
|
|
<a name="l44"></a>
|
|
<a name="l45"></a>
|
|
<a name="l46"></a>
|
|
<a name="l47"></a>
|
|
<a name="l48"></a>
|
|
<a name="l49"></a>
|
|
<a name="l50"></a>
|
|
<a name="l51"></a>
|
|
<a name="l52"></a> </span><span class=cFA><3>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l53"></a></span><span class=cFA>
|
|
<a name="l54"></a>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l55"></a>
|
|
<a name="l56"></a>
|
|
<a name="l57"></a>
|
|
<a name="l58"></a>
|
|
<a name="l59"></a>
|
|
<a name="l60"></a>
|
|
<a name="l61"></a>
|
|
<a name="l62"></a>
|
|
<a name="l63"></a>
|
|
<a name="l64"></a>
|
|
<a name="l65"></a>#</span><span class=cF1>define</span><span class=cF0> THEM_NUM 10
|
|
<a name="l66"></a>
|
|
<a name="l67"></a></span><span class=cF1>class</span><span class=cF0> Obj
|
|
<a name="l68"></a>{
|
|
<a name="l69"></a> Obj *next,*last;
|
|
<a name="l70"></a> </span><span class=cF1>F64</span><span class=cF0> t0,theta;
|
|
<a name="l71"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z;
|
|
<a name="l72"></a> </span><span class=cF1>Bool</span><span class=cF0> hit,pad[7];
|
|
<a name="l73"></a>} us,them[THEM_NUM],shots;
|
|
<a name="l74"></a></span><span class=cF9>I64</span><span class=cF0> num_them;
|
|
<a name="l75"></a></span><span class=cF1>F64</span><span class=cF0> t0,tf;
|
|
<a name="l76"></a>
|
|
<a name="l77"></a>#</span><span class=cF1>define</span><span class=cF0> SCRN_SCALE 512
|
|
<a name="l78"></a>#</span><span class=cF1>define</span><span class=cF0> TANK_HEIGHT 32
|
|
<a name="l79"></a>
|
|
<a name="l80"></a></span><span class=cF1>U0</span><span class=cF0> ZOTransform(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> *x,</span><span class=cF9>I64</span><span class=cF0> *y,</span><span class=cF9>I64</span><span class=cF0> *z)
|
|
<a name="l81"></a>{
|
|
<a name="l82"></a> </span><span class=cF9>I64</span><span class=cF0> zz;
|
|
<a name="l83"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(dc->r,x,y,z);
|
|
<a name="l84"></a> zz=*z;
|
|
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (zz<1) zz=1;
|
|
<a name="l86"></a> *x=SCRN_SCALE/2* *x/zz;
|
|
<a name="l87"></a> *y=SCRN_SCALE/2* (*y+TANK_HEIGHT)/zz;
|
|
<a name="l88"></a> *x+=dc->x;
|
|
<a name="l89"></a> *y+=dc->y;
|
|
<a name="l90"></a> *z+=dc->z;
|
|
<a name="l91"></a>}
|
|
<a name="l92"></a>
|
|
<a name="l93"></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="l94"></a>{
|
|
<a name="l95"></a> Obj *tmpo;
|
|
<a name="l96"></a> </span><span class=cF9>I64</span><span class=cF0> i,dd,y,w=task->pix_width,h=task->pix_height,cx=w>>1,cy=h>>1;
|
|
<a name="l97"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l98"></a> </span><span class=cF1>F64</span><span class=cF0> tt,theta;
|
|
<a name="l99"></a>
|
|
<a name="l100"></a> theta=640*</span><span class=cF5>Wrap</span><span class=cF0>(2*us.theta)/</span><span class=cF3>pi</span><span class=cF0>;
|
|
<a name="l101"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,theta-1280,90,0,</span><span class=cFA><4></span><span class=cF0>);
|
|
<a name="l102"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,theta ,90,0,</span><span class=cFA><4></span><span class=cF0>);
|
|
<a name="l103"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,theta+1280,90,0,</span><span class=cFA><4></span><span class=cF0>);
|
|
<a name="l104"></a>
|
|
<a name="l105"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
|
<a name="l106"></a> dc->transform=&ZOTransform;
|
|
<a name="l107"></a> dc->x=cx;
|
|
<a name="l108"></a> dc->y=cy;
|
|
<a name="l109"></a> </span><span class=cF5>Mat4x4TranslationEqu</span><span class=cF0>(dc->r,-us.x,-us.y,-us.z);
|
|
<a name="l110"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dc->r,us.theta-</span><span class=cF3>pi</span><span class=cF0>/2);
|
|
<a name="l111"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc->r,</span><span class=cF3>pi</span><span class=cF0>/16);
|
|
<a name="l112"></a>
|
|
<a name="l113"></a> dc->flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l114"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<THEM_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l115"></a> y=them[i].y;
|
|
<a name="l116"></a> tmpo=shots.next;
|
|
<a name="l117"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&shots) {
|
|
<a name="l118"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(them[i].x-tmpo->x)+</span><span class=cF5>SqrI64</span><span class=cF0>(them[i].z-tmpo->z);
|
|
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (dd<SCRN_SCALE/2*SCRN_SCALE/2) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l120"></a> y-=</span><span class=cF5>Sqrt</span><span class=cF0>(dd);
|
|
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (!them[i].hit) {
|
|
<a name="l122"></a> them[i].hit=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (!--num_them) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l124"></a> tf=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (tf-t0<best_score)
|
|
<a name="l126"></a> best_score=tf-t0;
|
|
<a name="l127"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l128"></a> }
|
|
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l130"></a> tmpo=tmpo->next;
|
|
<a name="l131"></a> }
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (them[i].hit)
|
|
<a name="l133"></a> img=</span><span class=cFA><2></span><span class=cF0>;
|
|
<a name="l134"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l135"></a> img=</span><span class=cFA><1></span><span class=cF0>;
|
|
<a name="l136"></a> </span><span class=cF5>Sprite3YB</span><span class=cF0>(dc,them[i].x,y,them[i].z,img,-them[i].theta);
|
|
<a name="l137"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l138"></a> tmpo=shots.next;
|
|
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&shots) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l140"></a> </span><span class=cF5>Sprite3YB</span><span class=cF0>(dc,tmpo->x,tmpo->y,tmpo->z,</span><span class=cFA><3></span><span class=cF0>,-tmpo->theta);
|
|
<a name="l141"></a> tmpo=tmpo->next;
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a> dc->flags&=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l144"></a> dc->color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l145"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,cx-5,cy,cx+5,cy);
|
|
<a name="l146"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,cx,cy-5,cx,cy+5);
|
|
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (tf) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l148"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l150"></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>*14</span><span class=cF7>)</span><span class=cF0>/2,cy-</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>/2,</span><span class=cF6>"Game Completed"</span><span class=cF0>);
|
|
<a name="l151"></a> tt=tf;
|
|
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l153"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l154"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,cx-5,cy,cx+5,cy);
|
|
<a name="l155"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,cx,cy-5,cx,cy+5);
|
|
<a name="l156"></a> tt=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l157"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l158"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l159"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>"Enemy:%d Time:%3.2f Best:%3.2f"</span><span class=cF0>,num_them,tt-t0,best_score);
|
|
<a name="l160"></a>}
|
|
<a name="l161"></a>
|
|
<a name="l162"></a></span><span class=cF1>U0</span><span class=cF0> Fire()
|
|
<a name="l163"></a>{
|
|
<a name="l164"></a> Obj *tmpo=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Obj</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l165"></a> tmpo->x=us.x;
|
|
<a name="l166"></a> tmpo->y=TANK_HEIGHT;
|
|
<a name="l167"></a> tmpo->z=us.z;
|
|
<a name="l168"></a> tmpo->theta=us.theta;
|
|
<a name="l169"></a> tmpo->t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpo,shots.last);
|
|
<a name="l171"></a>}
|
|
<a name="l172"></a>
|
|
<a name="l173"></a></span><span class=cF1>U0</span><span class=cF0> MoveUs(</span><span class=cF1>F64</span><span class=cF0> theta)
|
|
<a name="l174"></a>{
|
|
<a name="l175"></a> us.x+=0.1*SCRN_SCALE*</span><span class=cF5>Cos</span><span class=cF0>(theta);
|
|
<a name="l176"></a> us.z+=0.1*SCRN_SCALE*</span><span class=cF5>Sin</span><span class=cF0>(theta);
|
|
<a name="l177"></a>}
|
|
<a name="l178"></a>
|
|
<a name="l179"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l180"></a>{
|
|
<a name="l181"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l182"></a> Obj *tmpo,*tmpo1;
|
|
<a name="l183"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<THEM_NUM;i++) {
|
|
<a name="l185"></a> them[i].x+=SCRN_SCALE/32*</span><span class=cF5>Cos</span><span class=cF0>(them[i].theta);
|
|
<a name="l186"></a> them[i].z+=SCRN_SCALE/32*</span><span class=cF5>Sin</span><span class=cF0>(them[i].theta);
|
|
<a name="l187"></a> them[i].theta+=</span><span class=cF5>Rand</span><span class=cF0>/100.0;
|
|
<a name="l188"></a> }
|
|
<a name="l189"></a> tmpo=shots.next;
|
|
<a name="l190"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&shots) {
|
|
<a name="l191"></a> tmpo1=tmpo->next;
|
|
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>-tmpo->t0>1.0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l193"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpo);
|
|
<a name="l194"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo);
|
|
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l196"></a> tmpo->x+=0.25*SCRN_SCALE*</span><span class=cF5>Cos</span><span class=cF0>(tmpo->theta);
|
|
<a name="l197"></a> tmpo->z+=0.25*SCRN_SCALE*</span><span class=cF5>Sin</span><span class=cF0>(tmpo->theta);
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a> tmpo=tmpo1;
|
|
<a name="l200"></a> }
|
|
<a name="l201"></a> </span><span class=cF5>Sleep</span><span class=cF0>(20);
|
|
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l203"></a>}
|
|
<a name="l204"></a>
|
|
<a name="l205"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l206"></a>{
|
|
<a name="l207"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l208"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l209"></a> </span><span class=cF6>"$BG,LTCYAN$%h12c"</span><span class=cF0>,</span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l210"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&shots);
|
|
<a name="l211"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&us,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>us</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l212"></a> </span><span class=cF5>MemSet</span><span class=cF0>(them,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>them</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l213"></a> num_them=THEM_NUM;
|
|
<a name="l214"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<THEM_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l215"></a> them[i].x=10000*</span><span class=cF5>Rand</span><span class=cF0>-5000;
|
|
<a name="l216"></a> them[i].z=10000*</span><span class=cF5>Rand</span><span class=cF0>-5000;
|
|
<a name="l217"></a> them[i].theta=2*</span><span class=cF3>pi</span><span class=cF0>*</span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l218"></a> them[i].hit=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l219"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l220"></a> tf=0;
|
|
<a name="l221"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l222"></a>}
|
|
<a name="l223"></a>
|
|
<a name="l224"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
|
|
<a name="l225"></a>{
|
|
<a name="l226"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&shots,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l227"></a>}
|
|
<a name="l228"></a>
|
|
<a name="l229"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l230"></a>{</span><span class=cF2>//Randomly generate (by God :-)</span><span class=cF0>
|
|
<a name="l231"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb=&</span><span class=cF5>SndTaskEndCB</span><span class=cF0>;
|
|
<a name="l232"></a> </span><span class=cF5>MusicSettingsRst</span><span class=cF0>;
|
|
<a name="l233"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG"</span><span class=cF0>);
|
|
<a name="l235"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5sD4B5D4B5qEsG4B5G4B5eD4GsB5F4B5FeD4A5qFG"</span><span class=cF0>);
|
|
<a name="l236"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA"</span><span class=cF0>);
|
|
<a name="l237"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eGDsFGFGqDE4eB5E4sG5D4G5DqF4sGAGA"</span><span class=cF0>);
|
|
<a name="l238"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l239"></a>}
|
|
<a name="l240"></a>
|
|
<a name="l241"></a></span><span class=cF1>U0</span><span class=cF0> ZoneOut()
|
|
<a name="l242"></a>{
|
|
<a name="l243"></a> </span><span class=cF9>I64</span><span class=cF0> sc;
|
|
<a name="l244"></a>
|
|
<a name="l245"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(
|
|
<a name="l246"></a> </span><span class=cF6>"I refuse to rip-off the original\n"</span><span class=cF0>
|
|
<a name="l247"></a> </span><span class=cF6>"so this is intentionally crappy\n"</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF6>"and included for demonstration\n"</span><span class=cF0>
|
|
<a name="l249"></a> </span><span class=cF6>"purposes.\n\n"</span><span class=cF0>
|
|
<a name="l250"></a> </span><span class=cF6>"Write games, don't play them.\n"</span><span class=cF0>);
|
|
<a name="l251"></a>
|
|
<a name="l252"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l253"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l254"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l256"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l257"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l258"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l259"></a> </span><span class=cF6>" Fwd(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l260"></a> </span><span class=cF6>" Bwd(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l261"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l262"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l263"></a> </span><span class=cF6>" Fire(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l264"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l265"></a> );
|
|
<a name="l266"></a>
|
|
<a name="l267"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l268"></a> </span><span class=cF5>Fs</span><span class=cF0>->text_attr=</span><span class=cF3>YELLOW</span><span class=cF0><<4+</span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l269"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l270"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l271"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l272"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l273"></a> Init;
|
|
<a name="l274"></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="l275"></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="l276"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it=&</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l277"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l278"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l279"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>GetKey</span><span class=cF7>(</span><span class=cF0>&sc</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l280"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l281"></a> Fire;
|
|
<a name="l282"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l283"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l284"></a> CleanUp;
|
|
<a name="l285"></a> Init;
|
|
<a name="l286"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l287"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l288"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l289"></a> </span><span class=cF1>goto</span><span class=cF0> zo_done;
|
|
<a name="l290"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
|
<a name="l291"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) {
|
|
<a name="l292"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l293"></a> us.theta-=</span><span class=cF3>pi</span><span class=cF0>/256;
|
|
<a name="l294"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l295"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l296"></a> us.theta+=</span><span class=cF3>pi</span><span class=cF0>/256;
|
|
<a name="l297"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l298"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l299"></a> MoveUs(us.theta);
|
|
<a name="l300"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l301"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l302"></a> MoveUs(us.theta+</span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l303"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l304"></a> }
|
|
<a name="l305"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l306"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l307"></a> }
|
|
<a name="l308"></a>zo_done:
|
|
<a name="l309"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l310"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l311"></a> CleanUp;
|
|
<a name="l312"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l313"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l314"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l315"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"TempleOS/ZoneOut"</span><span class=cF0>,</span><span class=cF6>"F64 best_score=%5.4f;\n"</span><span class=cF0>,best_score);
|
|
<a name="l316"></a>}
|
|
<a name="l317"></a>
|
|
<a name="l318"></a>ZoneOut;
|
|
</span></pre></body>
|
|
</html>
|