735 lines
58 KiB
Plaintext
735 lines
58 KiB
Plaintext
|
<!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=cF0>
|
||
|
<a name="l2"></a>
|
||
|
<a name="l3"></a>
|
||
|
<a name="l4"></a>
|
||
|
<a name="l5"></a>
|
||
|
<a name="l6"></a> </span><span class=cFA><1>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<a name="l7"></a>
|
||
|
<a name="l8"></a>
|
||
|
<a name="l9"></a>
|
||
|
<a name="l10"></a> </span><span class=cFA><2>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<a name="l11"></a>
|
||
|
<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> </span><span class=cFA><3>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<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>
|
||
|
<a name="l39"></a> </span><span class=cFA><4>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<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> </span><span class=cFA><5>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<a name="l50"></a>
|
||
|
<a name="l51"></a>
|
||
|
<a name="l52"></a>
|
||
|
<a name="l53"></a>
|
||
|
<a name="l54"></a>
|
||
|
<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>
|
||
|
<a name="l66"></a>
|
||
|
<a name="l67"></a>
|
||
|
<a name="l68"></a>
|
||
|
<a name="l69"></a>
|
||
|
<a name="l70"></a>
|
||
|
<a name="l71"></a>
|
||
|
<a name="l72"></a>
|
||
|
<a name="l73"></a>
|
||
|
<a name="l74"></a>
|
||
|
<a name="l75"></a>
|
||
|
<a name="l76"></a>
|
||
|
<a name="l77"></a> </span><span class=cFA><6>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||
|
<a name="l78"></a>
|
||
|
<a name="l79"></a>
|
||
|
<a name="l80"></a>
|
||
|
<a name="l81"></a>
|
||
|
<a name="l82"></a>
|
||
|
<a name="l83"></a>
|
||
|
<a name="l84"></a>
|
||
|
<a name="l85"></a>
|
||
|
<a name="l86"></a>
|
||
|
<a name="l87"></a>
|
||
|
<a name="l88"></a>
|
||
|
<a name="l89"></a>
|
||
|
<a name="l90"></a></span><span class=cF5>RegDft</span><span class=cF0>(</span><span class=cF6>"TempleOS/Varoom"</span><span class=cF0>,</span><span class=cF6>"F64 best_score=9999;\n"</span><span class=cF0>);
|
||
|
<a name="l91"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>"TempleOS/Varoom"</span><span class=cF0>);
|
||
|
<a name="l92"></a>
|
||
|
<a name="l93"></a></span><span class=cF1>F64</span><span class=cF0> distance,t0,tf;
|
||
|
<a name="l94"></a></span><span class=cF1>Bool</span><span class=cF0> game_over;
|
||
|
<a name="l95"></a>
|
||
|
<a name="l96"></a>#</span><span class=cF1>define</span><span class=cF0> BORDER 7500
|
||
|
<a name="l97"></a>#</span><span class=cF1>define</span><span class=cF0> RADIUS 10000
|
||
|
<a name="l98"></a>#</span><span class=cF1>define</span><span class=cF0> WIDTH 2000
|
||
|
<a name="l99"></a>#</span><span class=cF1>define</span><span class=cF0> SHOULDER 200
|
||
|
<a name="l100"></a>#</span><span class=cF1>define</span><span class=cF0> D_theta (2*</span><span class=cF3>pi</span><span class=cF0>/360) </span><span class=cF2>//Curve track slice is one degree.</span><span class=cF0>
|
||
|
<a name="l101"></a>#</span><span class=cF1>define</span><span class=cF0> D_S (2*</span><span class=cF3>pi</span><span class=cF0>*RADIUS/360) </span><span class=cF2>//Straight track is degree at 10000.</span><span class=cF0>
|
||
|
<a name="l102"></a>#</span><span class=cF1>define</span><span class=cF0> DIPS 5
|
||
|
<a name="l103"></a>#</span><span class=cF1>define</span><span class=cF0> DIP_DEPTH 50
|
||
|
<a name="l104"></a></span><span class=cF1>class</span><span class=cF0> Track
|
||
|
<a name="l105"></a>{
|
||
|
<a name="l106"></a> Track *next,*last;
|
||
|
<a name="l107"></a> </span><span class=cF9>I32</span><span class=cF0> num;
|
||
|
<a name="l108"></a> </span><span class=cF9>CColorROPU16</span><span class=cF0> c,pad;
|
||
|
<a name="l109"></a> </span><span class=cF9>I64</span><span class=cF0> x,z;
|
||
|
<a name="l110"></a> </span><span class=cF1>F64</span><span class=cF0> theta,d;
|
||
|
<a name="l111"></a> </span><span class=cF9>CD3I32</span><span class=cF0> left[4],center[4],right[4];
|
||
|
<a name="l112"></a>} track_head,
|
||
|
<a name="l113"></a> *track_start[</span><span class=cF3>MP_PROCESSORS_NUM</span><span class=cF0>],*track_end[</span><span class=cF3>MP_PROCESSORS_NUM</span><span class=cF0>];
|
||
|
<a name="l114"></a>
|
||
|
<a name="l115"></a></span><span class=cF9>CDC</span><span class=cF0> *track_map;
|
||
|
<a name="l116"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_BITS 9
|
||
|
<a name="l117"></a></span><span class=cF9>I64</span><span class=cF0> t_minx,t_maxx,t_minz,t_maxz;
|
||
|
<a name="l118"></a>
|
||
|
<a name="l119"></a>#</span><span class=cF1>define</span><span class=cF0> BUSHES_NUM 512
|
||
|
<a name="l120"></a></span><span class=cF1>class</span><span class=cF0> Bush
|
||
|
<a name="l121"></a>{
|
||
|
<a name="l122"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p;
|
||
|
<a name="l123"></a> </span><span class=cF1>Bool</span><span class=cF0> sym,pad[3];
|
||
|
<a name="l124"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
||
|
<a name="l125"></a>} b[BUSHES_NUM];
|
||
|
<a name="l126"></a>
|
||
|
<a name="l127"></a>#</span><span class=cF1>define</span><span class=cF0> CARS_NUM 8
|
||
|
<a name="l128"></a></span><span class=cF1>class</span><span class=cF0> Car
|
||
|
<a name="l129"></a>{
|
||
|
<a name="l130"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p;
|
||
|
<a name="l131"></a> </span><span class=cF1>F64</span><span class=cF0> theta,dtheta,speed;
|
||
|
<a name="l132"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
||
|
<a name="l133"></a> Track *t;
|
||
|
<a name="l134"></a>} c[CARS_NUM];
|
||
|
<a name="l135"></a>
|
||
|
<a name="l136"></a></span><span class=cF9>I64</span><span class=cF0> DipY(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> z)
|
||
|
<a name="l137"></a>{
|
||
|
<a name="l138"></a> </span><span class=cF1>F64</span><span class=cF0> m,a;
|
||
|
<a name="l139"></a> </span><span class=cF5>R2P</span><span class=cF0>(&m,&a,x,z);
|
||
|
<a name="l140"></a> </span><span class=cF1>return</span><span class=cF0> DIP_DEPTH*m*</span><span class=cF5>Cos</span><span class=cF0>(DIPS*a)/RADIUS;
|
||
|
<a name="l141"></a>}
|
||
|
<a name="l142"></a>
|
||
|
<a name="l143"></a>#</span><span class=cF1>define</span><span class=cF0> CAR_LENGTH 400
|
||
|
<a name="l144"></a>
|
||
|
<a name="l145"></a></span><span class=cF1>F64</span><span class=cF0> Diptheta(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> z,</span><span class=cF1>F64</span><span class=cF0> theta)
|
||
|
<a name="l146"></a>{
|
||
|
<a name="l147"></a> </span><span class=cF1>F64</span><span class=cF0> y_front,y_back;
|
||
|
<a name="l148"></a> y_front=DipY(x-CAR_LENGTH/2*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,z-CAR_LENGTH/2*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l149"></a> y_back =DipY(x+CAR_LENGTH/2*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,z+CAR_LENGTH/2*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l150"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ASin</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>y_front-y_back</span><span class=cF7>)</span><span class=cF0>/CAR_LENGTH);
|
||
|
<a name="l151"></a>}
|
||
|
<a name="l152"></a>
|
||
|
<a name="l153"></a>Track *TrackFind(Track *_tmpt,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> z)
|
||
|
<a name="l154"></a>{
|
||
|
<a name="l155"></a> Track *res=_tmpt,*tmpt;
|
||
|
<a name="l156"></a> </span><span class=cF9>I64</span><span class=cF0> dd,best=</span><span class=cF5>SqrI64</span><span class=cF0>(res->x-x)+</span><span class=cF5>SqrI64</span><span class=cF0>(res->z-z);
|
||
|
<a name="l157"></a>
|
||
|
<a name="l158"></a> tmpt=_tmpt;
|
||
|
<a name="l159"></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="l160"></a> tmpt=tmpt->next;
|
||
|
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt==&track_head)
|
||
|
<a name="l162"></a> tmpt=tmpt->next;
|
||
|
<a name="l163"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(tmpt->x-x)+</span><span class=cF5>SqrI64</span><span class=cF0>(tmpt->z-z);
|
||
|
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best) {
|
||
|
<a name="l165"></a> best=dd;
|
||
|
<a name="l166"></a> res=tmpt;
|
||
|
<a name="l167"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l168"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l169"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l170"></a> tmpt=_tmpt;
|
||
|
<a name="l171"></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="l172"></a> tmpt=tmpt->last;
|
||
|
<a name="l173"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt==&track_head)
|
||
|
<a name="l174"></a> tmpt=tmpt->last;
|
||
|
<a name="l175"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(tmpt->x-x)+</span><span class=cF5>SqrI64</span><span class=cF0>(tmpt->z-z);
|
||
|
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best) {
|
||
|
<a name="l177"></a> best=dd;
|
||
|
<a name="l178"></a> res=tmpt;
|
||
|
<a name="l179"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l180"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l183"></a>}
|
||
|
<a name="l184"></a>
|
||
|
<a name="l185"></a></span><span class=cF1>U0</span><span class=cF0> TrackSlice(</span><span class=cF1>F64</span><span class=cF0> *_x,</span><span class=cF1>F64</span><span class=cF0> *_z,</span><span class=cF1>F64</span><span class=cF0> theta,</span><span class=cF1>F64</span><span class=cF0> d)
|
||
|
<a name="l186"></a>{
|
||
|
<a name="l187"></a> </span><span class=cF1>F64</span><span class=cF0> x=*_x,z=*_z,c=</span><span class=cF5>Cos</span><span class=cF0>(theta),s=</span><span class=cF5>Sin</span><span class=cF0>(theta),dx=d*s,dz=-d*c;
|
||
|
<a name="l188"></a> Track *tmpt,*last=track_head.last;
|
||
|
<a name="l189"></a> </span><span class=cF1>if</span><span class=cF0> (last==&track_head)
|
||
|
<a name="l190"></a> last=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l191"></a>
|
||
|
<a name="l192"></a> tmpt=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Track</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (last) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l194"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->center[0],&last->center[3],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l195"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->center[1],&last->center[2],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l197"></a> tmpt->center[2].x=x+(WIDTH/2)*c+dx;
|
||
|
<a name="l198"></a> tmpt->center[2].z=z+(WIDTH/2)*s+dz;
|
||
|
<a name="l199"></a> tmpt->center[2].y=DipY(tmpt->center[2].x,tmpt->center[2].z);
|
||
|
<a name="l200"></a> tmpt->center[3].x=x-(WIDTH/2)*c+dx;
|
||
|
<a name="l201"></a> tmpt->center[3].z=z-(WIDTH/2)*s+dz;
|
||
|
<a name="l202"></a> tmpt->center[3].y=DipY(tmpt->center[3].x,tmpt->center[3].z);
|
||
|
<a name="l203"></a>
|
||
|
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (last) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l205"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->left[0],&last->left[3],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l206"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->left[1],&last->left[2],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l207"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l208"></a> tmpt->left[2].x=x-(WIDTH/2)*c+dx;
|
||
|
<a name="l209"></a> tmpt->left[2].z=z-(WIDTH/2)*s+dz;
|
||
|
<a name="l210"></a> tmpt->left[2].y=DipY(tmpt->left[2].x,tmpt->left[2].z);
|
||
|
<a name="l211"></a> tmpt->left[3].x=x-(WIDTH/2+SHOULDER)*c+dx;
|
||
|
<a name="l212"></a> tmpt->left[3].z=z-(WIDTH/2+SHOULDER)*s+dz;
|
||
|
<a name="l213"></a> tmpt->left[3].y=DipY(tmpt->left[3].x,tmpt->left[3].z);
|
||
|
<a name="l214"></a>
|
||
|
<a name="l215"></a> </span><span class=cF1>if</span><span class=cF0> (last) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l216"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->right[0],&last->right[3],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l217"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&tmpt->right[1],&last->right[2],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l219"></a> tmpt->right[2].x=x+(WIDTH/2+SHOULDER)*c+dx;
|
||
|
<a name="l220"></a> tmpt->right[2].z=z+(WIDTH/2+SHOULDER)*s+dz;
|
||
|
<a name="l221"></a> tmpt->right[2].y=DipY(tmpt->right[2].x,tmpt->right[2].z);
|
||
|
<a name="l222"></a> tmpt->right[3].x=x+(WIDTH/2)*c+dx;
|
||
|
<a name="l223"></a> tmpt->right[3].z=z+(WIDTH/2)*s+dz;
|
||
|
<a name="l224"></a> tmpt->right[3].y=DipY(tmpt->right[3].x,tmpt->right[3].z);
|
||
|
<a name="l225"></a>
|
||
|
<a name="l226"></a> tmpt->x=x;
|
||
|
<a name="l227"></a> tmpt->z=z;
|
||
|
<a name="l228"></a> tmpt->theta=theta;
|
||
|
<a name="l229"></a> tmpt->num=track_head.last->num+1;
|
||
|
<a name="l230"></a> tmpt->d =track_head.last->d+d;
|
||
|
<a name="l231"></a>
|
||
|
<a name="l232"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpt,track_head.last);
|
||
|
<a name="l233"></a>
|
||
|
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt->num&1)
|
||
|
<a name="l235"></a> tmpt->c=</span><span class=cF3>RED</span><span class=cF0>;
|
||
|
<a name="l236"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l237"></a> tmpt->c=</span><span class=cF3>WHITE</span><span class=cF0>;
|
||
|
<a name="l238"></a>
|
||
|
<a name="l239"></a> </span><span class=cF1>if</span><span class=cF0> (x<t_minx) t_minx=x;
|
||
|
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (x>t_maxx) t_maxx=x;
|
||
|
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (z<t_minz) t_minz=z;
|
||
|
<a name="l242"></a> </span><span class=cF1>if</span><span class=cF0> (z>t_maxz) t_maxz=z;
|
||
|
<a name="l243"></a>
|
||
|
<a name="l244"></a> x+=dx;
|
||
|
<a name="l245"></a> *_x=x;
|
||
|
<a name="l246"></a> z+=dz;
|
||
|
<a name="l247"></a> *_z=z;
|
||
|
<a name="l248"></a>
|
||
|
<a name="l249"></a> </span><span class=cF1>if</span><span class=cF0> (x<t_minx) t_minx=x;
|
||
|
<a name="l250"></a> </span><span class=cF1>if</span><span class=cF0> (x>t_maxx) t_maxx=x;
|
||
|
<a name="l251"></a> </span><span class=cF1>if</span><span class=cF0> (z<t_minz) t_minz=z;
|
||
|
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (z>t_maxz) t_maxz=z;
|
||
|
<a name="l253"></a>}
|
||
|
<a name="l254"></a>
|
||
|
<a name="l255"></a></span><span class=cF1>U0</span><span class=cF0> CoupleEnds()
|
||
|
<a name="l256"></a>{
|
||
|
<a name="l257"></a> Track *first=track_head.next,*last=track_head.last;
|
||
|
<a name="l258"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->center[0],&last->center[3],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l259"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->center[1],&last->center[2],</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l260"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->left[0] ,&last->left[3] ,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l261"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->left[1] ,&last->left[2] ,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l262"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->right[0] ,&last->right[3] ,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l263"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&first->right[1] ,&last->right[2] ,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l264"></a>}
|
||
|
<a name="l265"></a>
|
||
|
<a name="l266"></a></span><span class=cF1>U0</span><span class=cF0> InitTrack()
|
||
|
<a name="l267"></a>{
|
||
|
<a name="l268"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
|
||
|
<a name="l269"></a> Track *tmpt;
|
||
|
<a name="l270"></a> </span><span class=cF1>F64</span><span class=cF0> x,z,theta,d;
|
||
|
<a name="l271"></a>
|
||
|
<a name="l272"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&track_head,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Track</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l273"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&track_head);
|
||
|
<a name="l274"></a>
|
||
|
<a name="l275"></a> t_minx=t_minz=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
||
|
<a name="l276"></a> t_maxx=t_maxz=</span><span class=cF3>I64_MIN</span><span class=cF0>;
|
||
|
<a name="l277"></a>
|
||
|
<a name="l278"></a> x=0; z=0; theta=0;
|
||
|
<a name="l279"></a> </span><span class=cF1>for</span><span class=cF0> (d=0;d<6*RADIUS;d+=D_S)
|
||
|
<a name="l280"></a> TrackSlice(&x,&z,theta,D_S);
|
||
|
<a name="l281"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<180;i++,theta+=D_theta)
|
||
|
<a name="l282"></a> TrackSlice(&x,&z,theta,D_theta*RADIUS);
|
||
|
<a name="l283"></a> </span><span class=cF1>for</span><span class=cF0> (d=0;d<RADIUS;d+=D_S)
|
||
|
<a name="l284"></a> TrackSlice(&x,&z,theta,D_S);
|
||
|
<a name="l285"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<90;i++,theta-=D_theta)
|
||
|
<a name="l286"></a> TrackSlice(&x,&z,theta,D_theta*RADIUS);
|
||
|
<a name="l287"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<180;i++,theta+=D_theta)
|
||
|
<a name="l288"></a> TrackSlice(&x,&z,theta,D_theta*RADIUS);
|
||
|
<a name="l289"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<90;i++,theta-=D_theta)
|
||
|
<a name="l290"></a> TrackSlice(&x,&z,theta,D_theta*RADIUS);
|
||
|
<a name="l291"></a> </span><span class=cF1>for</span><span class=cF0> (d=0;d<RADIUS;d+=D_S)
|
||
|
<a name="l292"></a> TrackSlice(&x,&z,theta,D_S);
|
||
|
<a name="l293"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<180;i++,theta+=D_theta)
|
||
|
<a name="l294"></a> TrackSlice(&x,&z,theta,D_theta*RADIUS);
|
||
|
<a name="l295"></a>
|
||
|
<a name="l296"></a> CoupleEnds;
|
||
|
<a name="l297"></a>
|
||
|
<a name="l298"></a> tmpt=track_head.next;
|
||
|
<a name="l299"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cFB>mp_cnt</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l300"></a> j=(i+1)*track_head.last->num/</span><span class=cFB>mp_cnt</span><span class=cF0>+1;
|
||
|
<a name="l301"></a> track_start[i]=tmpt;
|
||
|
<a name="l302"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&track_head && tmpt->num!=j)
|
||
|
<a name="l303"></a> tmpt=tmpt->next;
|
||
|
<a name="l304"></a> track_end[i]=tmpt;
|
||
|
<a name="l305"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l306"></a>
|
||
|
<a name="l307"></a> t_minx-=BORDER; t_minz-=BORDER;
|
||
|
<a name="l308"></a> t_maxx+=BORDER; t_maxz+=BORDER;
|
||
|
<a name="l309"></a> track_map=</span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>t_maxx-t_minx+1<<MAP_BITS-1</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS,
|
||
|
<a name="l310"></a> </span><span class=cF7>(</span><span class=cF0>t_maxz-t_minz+1<<MAP_BITS-1</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS);
|
||
|
<a name="l311"></a>
|
||
|
<a name="l312"></a> track_map->color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
|
||
|
<a name="l313"></a> </span><span class=cF5>GrRect</span><span class=cF0>(track_map,0,0,track_map->width,track_map->height);
|
||
|
<a name="l314"></a> tmpt=track_head.next;
|
||
|
<a name="l315"></a> track_map->color=</span><span class=cF3>YELLOW</span><span class=cF0>;
|
||
|
<a name="l316"></a> track_map->thick=3;
|
||
|
<a name="l317"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=&track_head) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l318"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(track_map,track_map->width-</span><span class=cF7>(</span><span class=cF0>tmpt->x-t_minx</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS,
|
||
|
<a name="l319"></a> </span><span class=cF7>(</span><span class=cF0>tmpt->z-t_minz</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS,0);
|
||
|
<a name="l320"></a> tmpt=tmpt->next;
|
||
|
<a name="l321"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l322"></a>}
|
||
|
<a name="l323"></a>
|
||
|
<a name="l324"></a>#</span><span class=cF1>define</span><span class=cF0> HORIZON_DIP 200
|
||
|
<a name="l325"></a>
|
||
|
<a name="l326"></a></span><span class=cF1>Bool</span><span class=cF0> PrepPoly(</span><span class=cF9>CD3I32</span><span class=cF0> *p,</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> h,</span><span class=cF9>CD3I32</span><span class=cF0> *poly)
|
||
|
<a name="l327"></a>{
|
||
|
<a name="l328"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z,i;
|
||
|
<a name="l329"></a> </span><span class=cF1>F64</span><span class=cF0> s;
|
||
|
<a name="l330"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<4;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l331"></a> x=p[i].x-c[0].p.x;
|
||
|
<a name="l332"></a> y=p[i].y-c[0].p.y;
|
||
|
<a name="l333"></a> z=p[i].z-c[0].p.z;
|
||
|
<a name="l334"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&x,&y,&z);
|
||
|
<a name="l335"></a> s=100.0/(</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>z</span><span class=cF7>)</span><span class=cF0>+50);
|
||
|
<a name="l336"></a> poly[i].y=s*y+h;
|
||
|
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (z<-200 || !</span><span class=cF7>(</span><span class=cF0>-h<poly[i].y<2*h</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l338"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l339"></a> poly[i].x=s*x+cx;
|
||
|
<a name="l340"></a> poly[i].z=z+</span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
|
||
|
<a name="l341"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l342"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l343"></a>}
|
||
|
<a name="l344"></a>
|
||
|
<a name="l345"></a></span><span class=cF9>I64</span><span class=cF0> mp_not_done_flags;
|
||
|
<a name="l346"></a>
|
||
|
<a name="l347"></a></span><span class=cF1>U0</span><span class=cF0> MPUpdateWin(</span><span class=cF9>CDC</span><span class=cF0> *dc2)
|
||
|
<a name="l348"></a>{
|
||
|
<a name="l349"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=dc2->win_task;
|
||
|
<a name="l350"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
|
||
|
<a name="l351"></a> w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
|
||
|
<a name="l352"></a> </span><span class=cF1>F64</span><span class=cF0> s,dip_theta=Diptheta(c[0].p.x,c[0].p.z,c[0].theta);
|
||
|
<a name="l353"></a> Car *tmpc;
|
||
|
<a name="l354"></a> </span><span class=cF9>CD3I32</span><span class=cF0> poly[4];
|
||
|
<a name="l355"></a> Track *tmpt,*tmpt1;
|
||
|
<a name="l356"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2,task);
|
||
|
<a name="l357"></a>
|
||
|
<a name="l358"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
||
|
<a name="l359"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,</span><span class=cF3>pi</span><span class=cF0>-c[0].theta);
|
||
|
<a name="l360"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,75*</span><span class=cF3>pi</span><span class=cF0>/180-dip_theta);
|
||
|
<a name="l361"></a>
|
||
|
<a name="l362"></a> dc->depth_buf=dc2->depth_buf;
|
||
|
<a name="l363"></a>
|
||
|
<a name="l364"></a> </span><span class=cF2>//Track</span><span class=cF0>
|
||
|
<a name="l365"></a> tmpt =track_start[</span><span class=cF5>Gs</span><span class=cF0>->num];
|
||
|
<a name="l366"></a> tmpt1=track_end [</span><span class=cF5>Gs</span><span class=cF0>->num];
|
||
|
<a name="l367"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt!=tmpt1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l368"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
||
|
<a name="l369"></a> </span><span class=cF1>if</span><span class=cF0> (PrepPoly</span><span class=cF7>(</span><span class=cF0>&tmpt->center,r,cx,h,poly</span><span class=cF7>)</span><span class=cF0>) {
|
||
|
<a name="l370"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
|
||
|
<a name="l371"></a> dc->color=tmpt->c;
|
||
|
<a name="l372"></a> </span><span class=cF1>if</span><span class=cF0> (PrepPoly</span><span class=cF7>(</span><span class=cF0>&tmpt->left,r,cx,h,poly</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l373"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
|
||
|
<a name="l374"></a> </span><span class=cF1>if</span><span class=cF0> (PrepPoly</span><span class=cF7>(</span><span class=cF0>&tmpt->right,r,cx,h,poly</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l375"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc,4,poly);
|
||
|
<a name="l376"></a> }
|
||
|
<a name="l377"></a> tmpt=tmpt->next;
|
||
|
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l379"></a>
|
||
|
<a name="l380"></a> dc->flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
||
|
<a name="l381"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF5>Gs</span><span class=cF0>->num;i<BUSHES_NUM;i+=</span><span class=cFB>mp_cnt</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l382"></a> x=b[i].p.x-c[0].p.x; y=b[i].p.y-c[0].p.y; z=b[i].p.z-c[0].p.z;
|
||
|
<a name="l383"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&x,&y,&z);
|
||
|
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (z>0) {
|
||
|
<a name="l385"></a> s=100.0/(</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>z</span><span class=cF7>)</span><span class=cF0>+50);
|
||
|
<a name="l386"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc->r);
|
||
|
<a name="l387"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(dc->r,s*2);
|
||
|
<a name="l388"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc,dc->r);
|
||
|
<a name="l389"></a> </span><span class=cF1>if</span><span class=cF0> (b[i].sym) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l390"></a> dc->flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>|</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>;
|
||
|
<a name="l391"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc,s*x+cx,s*y+h,s*x+cx,s*y+h+10);
|
||
|
<a name="l392"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l393"></a> </span><span class=cF5>Sprite3B</span><span class=cF0>(dc,s*x+cx,s*y+h,z+</span><span class=cF3>GR_Z_ALL</span><span class=cF0>,b[i].img);
|
||
|
<a name="l394"></a> dc->flags&=~(</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>|</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>);
|
||
|
<a name="l395"></a> }
|
||
|
<a name="l396"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l397"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF5>Gs</span><span class=cF0>->num+1;i<CARS_NUM;i+=</span><span class=cFB>mp_cnt</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l398"></a> tmpc=&c[i];
|
||
|
<a name="l399"></a> x=tmpc->p.x-c[0].p.x; y=tmpc->p.y-c[0].p.y; z=tmpc->p.z-c[0].p.z;
|
||
|
<a name="l400"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&x,&y,&z);
|
||
|
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (z>0) {
|
||
|
<a name="l402"></a> s=100.0/(</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>z</span><span class=cF7>)</span><span class=cF0>+50);
|
||
|
<a name="l403"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc->r);
|
||
|
<a name="l404"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(dc->r,s*2);
|
||
|
<a name="l405"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc->r,Diptheta</span><span class=cF7>(</span><span class=cF0>tmpc->p.x,tmpc->p.z,-tmpc->theta</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l406"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dc->r,tmpc->theta-c[0].theta);
|
||
|
<a name="l407"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc,dc->r);
|
||
|
<a name="l408"></a> </span><span class=cF5>Sprite3B</span><span class=cF0>(dc,s*x+cx,s*y+h,z+</span><span class=cF3>GR_Z_ALL</span><span class=cF0>,tmpc->img);
|
||
|
<a name="l409"></a> }
|
||
|
<a name="l410"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l411"></a> dc->depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l412"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
||
|
<a name="l413"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&mp_not_done_flags,</span><span class=cF5>Gs</span><span class=cF0>->num);
|
||
|
<a name="l414"></a>}
|
||
|
<a name="l415"></a>
|
||
|
<a name="l416"></a></span><span class=cF1>U0</span><span class=cF0> VRTransform(</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="l417"></a>{
|
||
|
<a name="l418"></a> </span><span class=cF9>I64</span><span class=cF0> zz;
|
||
|
<a name="l419"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(dc->r,x,y,z);
|
||
|
<a name="l420"></a> zz=400+*z;
|
||
|
<a name="l421"></a> </span><span class=cF1>if</span><span class=cF0> (zz<1) zz=1;
|
||
|
<a name="l422"></a> *x=400* *x/zz;
|
||
|
<a name="l423"></a> *y=400* *y/zz;
|
||
|
<a name="l424"></a> *x+=dc->x;
|
||
|
<a name="l425"></a> *y+=dc->y;
|
||
|
<a name="l426"></a> *z+=dc->z;
|
||
|
<a name="l427"></a>}
|
||
|
<a name="l428"></a>
|
||
|
<a name="l429"></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="l430"></a>{
|
||
|
<a name="l431"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
|
||
|
<a name="l432"></a> w=task->pix_width,
|
||
|
<a name="l433"></a> h=task->pix_height,r[16],
|
||
|
<a name="l434"></a> cx=w>>1;
|
||
|
<a name="l435"></a> </span><span class=cF1>F64</span><span class=cF0> s,dip_theta=Diptheta(c[0].p.x,c[0].p.z,c[0].theta);
|
||
|
<a name="l436"></a> Car *tmpc=&c[0];
|
||
|
<a name="l437"></a>
|
||
|
<a name="l438"></a> dc->color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
|
||
|
<a name="l439"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc,0,0,w,HORIZON_DIP*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>dip_theta</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF3>FONT_HEIGHT</span><span class=cF0>*4.5);
|
||
|
<a name="l440"></a>
|
||
|
<a name="l441"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
||
|
<a name="l442"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,</span><span class=cF3>pi</span><span class=cF0>-c[0].theta);
|
||
|
<a name="l443"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,75*</span><span class=cF3>pi</span><span class=cF0>/180-dip_theta);
|
||
|
<a name="l444"></a>
|
||
|
<a name="l445"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
||
|
<a name="l446"></a>
|
||
|
<a name="l447"></a> </span><span class=cF2>//Sun</span><span class=cF0>
|
||
|
<a name="l448"></a> x=c[0].p.x; y=0; z=1000000-c[0].p.z;
|
||
|
<a name="l449"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r,&x,&y,&z);
|
||
|
<a name="l450"></a> s=100.0/(</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>z</span><span class=cF7>)</span><span class=cF0>+50);
|
||
|
<a name="l451"></a> </span><span class=cF1>if</span><span class=cF0> (y<0) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l452"></a> dc->color=</span><span class=cF3>BROWN</span><span class=cF0>;
|
||
|
<a name="l453"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,s*x+cx,15+HORIZON_DIP*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>dip_theta</span><span class=cF7>)</span><span class=cF0>,15);
|
||
|
<a name="l454"></a> dc->color=</span><span class=cF3>YELLOW</span><span class=cF0>;
|
||
|
<a name="l455"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,s*x+cx,15+HORIZON_DIP*</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>dip_theta</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l456"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l457"></a>
|
||
|
<a name="l458"></a> mp_not_done_flags=1<<</span><span class=cFB>mp_cnt</span><span class=cF0>-1;
|
||
|
<a name="l459"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cFB>mp_cnt</span><span class=cF0>;i++)
|
||
|
<a name="l460"></a> </span><span class=cF5>JobQue</span><span class=cF0>(&MPUpdateWin,dc,i);
|
||
|
<a name="l461"></a> </span><span class=cF1>while</span><span class=cF0> (mp_not_done_flags)
|
||
|
<a name="l462"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l463"></a>
|
||
|
<a name="l464"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
||
|
<a name="l465"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,tmpc->dtheta);
|
||
|
<a name="l466"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,0.4-8*dip_theta); </span><span class=cF2>//Made this up</span><span class=cF0>
|
||
|
<a name="l467"></a> dc->transform=&VRTransform;
|
||
|
<a name="l468"></a> dc->x=task->pix_width>>1;
|
||
|
<a name="l469"></a> dc->y=task->pix_height-150;
|
||
|
<a name="l470"></a> dc->z=</span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
|
||
|
<a name="l471"></a> </span><span class=cF5>Sprite3Mat4x4B</span><span class=cF0>(dc,0,0,-100,c[0].img,r);
|
||
|
<a name="l472"></a>
|
||
|
<a name="l473"></a> </span><span class=cF2>//Map</span><span class=cF0>
|
||
|
<a name="l474"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc,w-track_map->width,h-track_map->height,track_map);
|
||
|
<a name="l475"></a>
|
||
|
<a name="l476"></a> dc->thick=2;
|
||
|
<a name="l477"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<CARS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l478"></a> </span><span class=cF1>if</span><span class=cF0> (i)
|
||
|
<a name="l479"></a> dc->color=</span><span class=cF3>LTPURPLE</span><span class=cF0>;
|
||
|
<a name="l480"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l481"></a> dc->color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
|
||
|
<a name="l482"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc,w-</span><span class=cF7>(</span><span class=cF0>c[i].p.x-t_minx</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS,
|
||
|
<a name="l483"></a> h-track_map->height+</span><span class=cF7>(</span><span class=cF0>c[i].p.z-t_minz</span><span class=cF7>)</span><span class=cF0>>>MAP_BITS,0);
|
||
|
<a name="l484"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l485"></a>
|
||
|
<a name="l486"></a> </span><span class=cF1>if</span><span class=cF0> (game_over) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l487"></a> dc->color=</span><span class=cF3>LTRED</span><span class=cF0>;
|
||
|
<a name="l488"></a> </span><span class=cF1>if</span><span class=cF0> (tf) {
|
||
|
<a name="l489"></a> s=tf-t0;
|
||
|
<a name="l490"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
||
|
<a name="l491"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>w-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*14</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF7>(</span><span class=cF0>h-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF6>"Game Completed"</span><span class=cF0>);
|
||
|
<a name="l492"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l493"></a> s=99.9;
|
||
|
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
||
|
<a name="l495"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>w-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*9</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF7>(</span><span class=cF0>h-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF6>"Game Over"</span><span class=cF0>);
|
||
|
<a name="l496"></a> }
|
||
|
<a name="l497"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l498"></a> s=</span><span class=cF5>tS</span><span class=cF0>-t0;
|
||
|
<a name="l499"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
||
|
<a name="l500"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>"%0.1f%% Time:%0.2f Best:%0.2f"</span><span class=cF0>,
|
||
|
<a name="l501"></a> 100.0*distance/track_head.last->d,s,best_score);
|
||
|
<a name="l502"></a>}
|
||
|
<a name="l503"></a>
|
||
|
<a name="l504"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
|
||
|
<a name="l505"></a>{
|
||
|
<a name="l506"></a> Car *tmpc;
|
||
|
<a name="l507"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,z;
|
||
|
<a name="l508"></a> </span><span class=cF1>Bool</span><span class=cF0> on_track;
|
||
|
<a name="l509"></a> Track *tmpt,*tmpt2;
|
||
|
<a name="l510"></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="l511"></a> </span><span class=cF1>if</span><span class=cF0> (!game_over)
|
||
|
<a name="l512"></a> </span><span class=cF5>Snd</span><span class=cF0>(12.0*</span><span class=cF5>Log2</span><span class=cF7>(</span><span class=cF0>c[0].speed/500+0.7</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l513"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l514"></a> </span><span class=cF5>Snd</span><span class=cF0>;
|
||
|
<a name="l515"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<CARS_NUM;i++) {
|
||
|
<a name="l516"></a> tmpc=&c[i];
|
||
|
<a name="l517"></a> tmpc->p.x-=0.01*tmpc->speed*</span><span class=cF5>Cos</span><span class=cF0>(tmpc->theta-</span><span class=cF3>pi</span><span class=cF0>/2);
|
||
|
<a name="l518"></a> tmpc->p.z+=0.01*tmpc->speed*</span><span class=cF5>Sin</span><span class=cF0>(tmpc->theta-</span><span class=cF3>pi</span><span class=cF0>/2);
|
||
|
<a name="l519"></a> tmpt=TrackFind(tmpc->t,tmpc->p.x,tmpc->p.z);
|
||
|
<a name="l520"></a> </span><span class=cF1>if</span><span class=cF0> (i) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l521"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt!=tmpc->t) {
|
||
|
<a name="l522"></a> tmpt2=tmpt->next;
|
||
|
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt2==&track_head)
|
||
|
<a name="l524"></a> tmpt2=tmpt2->next;
|
||
|
<a name="l525"></a> tmpc->theta=</span><span class=cF5>Arg</span><span class=cF0>(-tmpt2->z+tmpc->p.z,-tmpt2->x+tmpc->p.x);
|
||
|
<a name="l526"></a> }
|
||
|
<a name="l527"></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="l528"></a> tmpc->theta+=0.01*tmpc->dtheta;
|
||
|
<a name="l529"></a> x=track_map->width-(tmpc->p.x-t_minx)>>MAP_BITS;
|
||
|
<a name="l530"></a> z=(tmpc->p.z-t_minz)>>MAP_BITS;
|
||
|
<a name="l531"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrPeek</span><span class=cF7>(</span><span class=cF0>track_map,x,z</span><span class=cF7>)</span><span class=cF0>!=</span><span class=cF3>YELLOW</span><span class=cF0>) {
|
||
|
<a name="l532"></a> on_track=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l533"></a> tmpc->speed-=0.01*tmpc->speed;
|
||
|
<a name="l534"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->speed<0) tmpc->speed=0;
|
||
|
<a name="l535"></a> } </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l536"></a> on_track=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l537"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l538"></a> tmpc->t=tmpt;
|
||
|
<a name="l539"></a> tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
|
||
|
<a name="l540"></a> }
|
||
|
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (!game_over && on_track) {
|
||
|
<a name="l542"></a> </span><span class=cF1>for</span><span class=cF0> (i=1;i<CARS_NUM;i++)
|
||
|
<a name="l543"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3I32DistSqr</span><span class=cF7>(</span><span class=cF0>&c[i].p,&c[0].p</span><span class=cF7>)</span><span class=cF0><CAR_LENGTH>>1*CAR_LENGTH>>1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l544"></a> game_over=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l545"></a> </span><span class=cF5>Noise</span><span class=cF0>(500,22,34);
|
||
|
<a name="l546"></a> </span><span class=cF5>Sleep</span><span class=cF0>(500);
|
||
|
<a name="l547"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l548"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l549"></a> </span><span class=cF1>if</span><span class=cF0> (!game_over) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l550"></a> distance+=0.01*c[0].speed;
|
||
|
<a name="l551"></a> </span><span class=cF1>if</span><span class=cF0> (distance>track_head.last->d&& c[0].t->num<track_head.last->num>>1) {
|
||
|
<a name="l552"></a> tf=</span><span class=cF5>tS</span><span class=cF0>;
|
||
|
<a name="l553"></a> game_over=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l554"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
||
|
<a name="l555"></a> </span><span class=cF1>if</span><span class=cF0> (tf-t0<best_score) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l556"></a> best_score=tf-t0;
|
||
|
<a name="l557"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
||
|
<a name="l558"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l559"></a> }
|
||
|
<a name="l560"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l561"></a> }
|
||
|
<a name="l562"></a> </span><span class=cF5>Sleep</span><span class=cF0>(10);
|
||
|
<a name="l563"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l564"></a>}
|
||
|
<a name="l565"></a>
|
||
|
<a name="l566"></a></span><span class=cF1>U8</span><span class=cF0> *imgs[8]={</span><span class=cFA><1></span><span class=cF0>,</span><span class=cFA><1></span><span class=cF0>,</span><span class=cFA><2></span><span class=cF0>,</span><span class=cFA><2></span><span class=cF0>,</span><span class=cFA><3></span><span class=cF0>,</span><span class=cFA><4></span><span class=cF0>,</span><span class=cFA><4></span><span class=cF0>,</span><span class=cFA><4></span><span class=cF0>};
|
||
|
<a name="l567"></a>
|
||
|
<a name="l568"></a>
|
||
|
<a name="l569"></a></span><span class=cF1>U0</span><span class=cF0> InitBushes()
|
||
|
<a name="l570"></a>{
|
||
|
<a name="l571"></a> Bush *tmpb;
|
||
|
<a name="l572"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,x,z;
|
||
|
<a name="l573"></a> track_map->color=</span><span class=cF3>LTGREEN</span><span class=cF0>;
|
||
|
<a name="l574"></a> track_map->thick=1;
|
||
|
<a name="l575"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<BUSHES_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l576"></a> tmpb=&b[i];
|
||
|
<a name="l577"></a>
|
||
|
<a name="l578"></a>ib_restart:
|
||
|
<a name="l579"></a> tmpb->p.x=</span><span class=cF5>Rand</span><span class=cF0>*(t_maxx-t_minx)+t_minx;
|
||
|
<a name="l580"></a> tmpb->p.z=</span><span class=cF5>Rand</span><span class=cF0>*(t_maxz-t_minz)+t_minz;
|
||
|
<a name="l581"></a> x=track_map->width-(tmpb->p.x-t_minx)>>MAP_BITS;
|
||
|
<a name="l582"></a> z=(tmpb->p.z-t_minz)>>MAP_BITS;
|
||
|
<a name="l583"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<8;j++)
|
||
|
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrPeek</span><span class=cF7>(</span><span class=cF0>track_map,x+</span><span class=cFB>gr_x_offsets</span><span class=cF0>[j],z+</span><span class=cFB>gr_y_offsets</span><span class=cF0>[j]</span><span class=cF7>)</span><span class=cF0>!=</span><span class=cF3>LTGRAY</span><span class=cF0>)
|
||
|
<a name="l585"></a> </span><span class=cF1>goto</span><span class=cF0> ib_restart;
|
||
|
<a name="l586"></a>
|
||
|
<a name="l587"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(track_map,x,z);
|
||
|
<a name="l588"></a> tmpb->p.y=DipY(tmpb->p.x,tmpb->p.z);
|
||
|
<a name="l589"></a> tmpb->sym=</span><span class=cF5>RandU16</span><span class=cF0>&1;
|
||
|
<a name="l590"></a> tmpb->img=imgs[i&7];
|
||
|
<a name="l591"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l592"></a>}
|
||
|
<a name="l593"></a>
|
||
|
<a name="l594"></a>
|
||
|
<a name="l595"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
||
|
<a name="l596"></a>{
|
||
|
<a name="l597"></a> Car *tmpc;
|
||
|
<a name="l598"></a> Track *tmpt;
|
||
|
<a name="l599"></a> </span><span class=cF1>F64</span><span class=cF0> d;
|
||
|
<a name="l600"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l601"></a>
|
||
|
<a name="l602"></a> InitTrack;
|
||
|
<a name="l603"></a> InitBushes;
|
||
|
<a name="l604"></a> tmpt=track_head.next;
|
||
|
<a name="l605"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<CARS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l606"></a> tmpc=&c[i];
|
||
|
<a name="l607"></a> tmpc->t=tmpt;
|
||
|
<a name="l608"></a> tmpc->p.x=tmpt->x;
|
||
|
<a name="l609"></a> tmpc->p.z=tmpt->z;
|
||
|
<a name="l610"></a> tmpc->p.y=DipY(tmpc->p.x,tmpc->p.z);
|
||
|
<a name="l611"></a> tmpc->theta =-tmpt->theta;
|
||
|
<a name="l612"></a> tmpc->dtheta=0;
|
||
|
<a name="l613"></a> </span><span class=cF1>if</span><span class=cF0> (!i) {
|
||
|
<a name="l614"></a> tmpc->img=</span><span class=cFA><5></span><span class=cF0>;
|
||
|
<a name="l615"></a> tmpc->speed=0;
|
||
|
<a name="l616"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l617"></a> tmpc->img=</span><span class=cFA><6></span><span class=cF0>;
|
||
|
<a name="l618"></a> tmpc->speed=2500.0;
|
||
|
<a name="l619"></a> }
|
||
|
<a name="l620"></a> d=(i+1)*track_head.last->d/CARS_NUM;
|
||
|
<a name="l621"></a> </span><span class=cF1>while</span><span class=cF0> (tmpt->next!=&track_head && tmpt->d<d)
|
||
|
<a name="l622"></a> tmpt=tmpt->next;
|
||
|
<a name="l623"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l624"></a> distance=0;
|
||
|
<a name="l625"></a> tf=0;
|
||
|
<a name="l626"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
|
||
|
<a name="l627"></a> game_over=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l628"></a>}
|
||
|
<a name="l629"></a>
|
||
|
<a name="l630"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
|
||
|
<a name="l631"></a>{
|
||
|
<a name="l632"></a> </span><span class=cF1>while</span><span class=cF0> (mp_not_done_flags)
|
||
|
<a name="l633"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l634"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&track_head,</span><span class=cF3>TRUE</span><span class=cF0>);
|
||
|
<a name="l635"></a> </span><span class=cF5>DCDel</span><span class=cF0>(track_map);
|
||
|
<a name="l636"></a>}
|
||
|
<a name="l637"></a>
|
||
|
<a name="l638"></a></span><span class=cF1>U0</span><span class=cF0> Varoom()
|
||
|
<a name="l639"></a>{
|
||
|
<a name="l640"></a> </span><span class=cF9>I64</span><span class=cF0> sc;
|
||
|
<a name="l641"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
||
|
<a name="l642"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
||
|
<a name="l643"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
||
|
<a name="l644"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
||
|
<a name="l645"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
||
|
<a name="l646"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
||
|
<a name="l647"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
||
|
<a name="l648"></a> </span><span class=cF6>" Accelerator(,,SC_CURSOR_UP);"</span><span class=cF0>
|
||
|
<a name="l649"></a> </span><span class=cF6>" Brake(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
||
|
<a name="l650"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
||
|
<a name="l651"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
||
|
<a name="l652"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
||
|
<a name="l653"></a> );
|
||
|
<a name="l654"></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="l655"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l656"></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>BLUE</span><span class=cF0>;
|
||
|
<a name="l657"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>
|
||
|
<a name="l658"></a> -</span><span class=cF3>WIF_SELF_GRAB_SCROLL</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>;
|
||
|
<a name="l659"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
||
|
<a name="l660"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
||
|
<a name="l661"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
||
|
<a name="l662"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
||
|
<a name="l663"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
||
|
<a name="l664"></a> Init;
|
||
|
<a name="l665"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it=&</span><span class=cF5>DrawIt</span><span class=cF0>;
|
||
|
<a name="l666"></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="l667"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
||
|
<a name="l668"></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>) {
|
||
|
<a name="l669"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
||
|
<a name="l670"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l671"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
||
|
<a name="l672"></a> c[0].dtheta-=</span><span class=cF3>pi</span><span class=cF0>/60;
|
||
|
<a name="l673"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l674"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
||
|
<a name="l675"></a> c[0].dtheta+=</span><span class=cF3>pi</span><span class=cF0>/60;
|
||
|
<a name="l676"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l677"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
||
|
<a name="l678"></a> c[0].speed+=300;
|
||
|
<a name="l679"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l680"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
||
|
<a name="l681"></a> c[0].speed-=900;
|
||
|
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (c[0].speed<0) c[0].speed=0;
|
||
|
<a name="l683"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l684"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l685"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l686"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
||
|
<a name="l687"></a> CleanUp;
|
||
|
<a name="l688"></a> Init;
|
||
|
<a name="l689"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l690"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
||
|
<a name="l691"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
||
|
<a name="l692"></a> </span><span class=cF1>goto</span><span class=cF0> vr_done;
|
||
|
<a name="l693"></a> }
|
||
|
<a name="l694"></a>vr_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
|
||
|
<a name="l695"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
||
|
<a name="l696"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
||
|
<a name="l697"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
||
|
<a name="l698"></a> CleanUp;
|
||
|
<a name="l699"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
||
|
<a name="l700"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"TempleOS/Varoom"</span><span class=cF0>,</span><span class=cF6>"F64 best_score=%5.4f;\n"</span><span class=cF0>,best_score);
|
||
|
<a name="l701"></a>}
|
||
|
<a name="l702"></a>
|
||
|
<a name="l703"></a>Varoom;
|
||
|
</span></pre></body>
|
||
|
</html>
|