mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
d0cafb0198
Update and fix more documentation. Alter Splash messages and logo color.
1404 lines
131 KiB
HTML
Executable file
1404 lines
131 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.06">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>//Uses </span><a href="https://tomawezome.github.io/ZealOS/Demo/Lectures/FixedPoint.CC.html#l1"><span class=cF4>fixed-point</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>"ZealOS/Talons"</span><span class=cF0>, </span><span class=cF6>"F64 best_score=9999;\n"</span><span class=cF0>);
|
|
<a name="l4"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>"ZealOS/Talons"</span><span class=cF0>);
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF2>//Keep these power of two so shift is used instead of multiply</span><span class=cF0>
|
|
<a name="l7"></a></span><span class=cF2>//to index arrays.</span><span class=cF0>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_WIDTH </span><span class=cFE>1024</span><span class=cF0>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_HEIGHT </span><span class=cFE>1024</span><span class=cF0>
|
|
<a name="l10"></a>
|
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_SCALE </span><span class=cFE>150</span><span class=cF0>
|
|
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> DISPLAY_SCALE </span><span class=cFE>100</span><span class=cF0>
|
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> CTRLS_SCALE </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF2>//Terry thought he did these so the heads-up showed intelligable numbers.</span><span class=cF0>
|
|
<a name="l16"></a></span><span class=cF2>//Scaling is a mess.</span><span class=cF0>
|
|
<a name="l17"></a>#</span><span class=cF1>define</span><span class=cF0> COORDINATE_SCALE </span><span class=cFE>256</span><span class=cF0>
|
|
<a name="l18"></a>#</span><span class=cF1>define</span><span class=cF0> COORDINATE_BITS </span><span class=cFE>8</span><span class=cF0>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a>#</span><span class=cF1>define</span><span class=cF0> WATER_ELEVATION </span><span class=cFE>15</span><span class=cF0>
|
|
<a name="l21"></a>#</span><span class=cF1>define</span><span class=cF0> BIRD_ELEVATION </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l22"></a>#</span><span class=cF1>define</span><span class=cF0> ROCK_ELEVATION </span><span class=cFE>45</span><span class=cF0>
|
|
<a name="l23"></a>#</span><span class=cF1>define</span><span class=cF0> SNOW_ELEVATION </span><span class=cFE>55</span><span class=cF0>
|
|
<a name="l24"></a>
|
|
<a name="l25"></a></span><span class=cF2>//Too big makes off-screen draws take place.</span><span class=cF0>
|
|
<a name="l26"></a>#</span><span class=cF1>define</span><span class=cF0> PANEL_SIZE_MAX </span><span class=cFE>16</span><span class=cF0>
|
|
<a name="l27"></a>
|
|
<a name="l28"></a>
|
|
<a name="l29"></a>
|
|
<a name="l30"></a>
|
|
<a name="l31"></a>
|
|
<a name="l32"></a> </span><span class=cFA><1>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<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>
|
|
<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><2>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<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>
|
|
<a name="l78"></a> </span><span class=cFA><3>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<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>
|
|
<a name="l91"></a>
|
|
<a name="l92"></a>
|
|
<a name="l93"></a>
|
|
<a name="l94"></a>
|
|
<a name="l95"></a>
|
|
<a name="l96"></a>
|
|
<a name="l97"></a>
|
|
<a name="l98"></a>
|
|
<a name="l99"></a>
|
|
<a name="l100"></a> </span><span class=cFA><4>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l101"></a>
|
|
<a name="l102"></a>
|
|
<a name="l103"></a>
|
|
<a name="l104"></a>
|
|
<a name="l105"></a>
|
|
<a name="l106"></a>
|
|
<a name="l107"></a>
|
|
<a name="l108"></a>
|
|
<a name="l109"></a>
|
|
<a name="l110"></a>
|
|
<a name="l111"></a>
|
|
<a name="l112"></a>
|
|
<a name="l113"></a>
|
|
<a name="l114"></a>
|
|
<a name="l115"></a>
|
|
<a name="l116"></a> </span><span class=cFA><5>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l117"></a>
|
|
<a name="l118"></a>
|
|
<a name="l119"></a>
|
|
<a name="l120"></a>
|
|
<a name="l121"></a>
|
|
<a name="l122"></a>
|
|
<a name="l123"></a>
|
|
<a name="l124"></a>
|
|
<a name="l125"></a>
|
|
<a name="l126"></a>
|
|
<a name="l127"></a>
|
|
<a name="l128"></a>
|
|
<a name="l129"></a>
|
|
<a name="l130"></a>
|
|
<a name="l131"></a>
|
|
<a name="l132"></a> </span><span class=cFA><6>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l133"></a>
|
|
<a name="l134"></a>
|
|
<a name="l135"></a>
|
|
<a name="l136"></a>
|
|
<a name="l137"></a>
|
|
<a name="l138"></a>
|
|
<a name="l139"></a>
|
|
<a name="l140"></a>
|
|
<a name="l141"></a>
|
|
<a name="l142"></a>
|
|
<a name="l143"></a>
|
|
<a name="l144"></a>
|
|
<a name="l145"></a>
|
|
<a name="l146"></a>
|
|
<a name="l147"></a>#</span><span class=cF1>define</span><span class=cF0> LS_TYPES </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l148"></a></span><span class=cF1>U8</span><span class=cF0> *landscape_small_imgs[LS_TYPES] = {</span><span class=cFA><4></span><span class=cF0>, </span><span class=cFA><5></span><span class=cF0>, </span><span class=cFA><6></span><span class=cF0>}, *landscape_large_imgs[LS_TYPES];
|
|
<a name="l149"></a>
|
|
<a name="l150"></a>#</span><span class=cF1>define</span><span class=cF0> B_NUM </span><span class=cFE>256</span><span class=cF0>
|
|
<a name="l151"></a></span><span class=cF1>class</span><span class=cF0> Bird
|
|
<a name="l152"></a>{
|
|
<a name="l153"></a> Bird *next, *last;
|
|
<a name="l154"></a> </span><span class=cF9>CD3I64</span><span class=cF0> p;
|
|
<a name="l155"></a> </span><span class=cF1>F64</span><span class=cF0> theta;
|
|
<a name="l156"></a>
|
|
<a name="l157"></a>} b_head[</span><span class=cFB>mp_count</span><span class=cF0>];
|
|
<a name="l158"></a>
|
|
<a name="l159"></a></span><span class=cF1>class</span><span class=cF0> Obj
|
|
<a name="l160"></a>{
|
|
<a name="l161"></a> Obj *next, *last;
|
|
<a name="l162"></a> </span><span class=cF9>CD3I64</span><span class=cF0> p;
|
|
<a name="l163"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l164"></a> </span><span class=cF1>Bool</span><span class=cF0> fish;
|
|
<a name="l165"></a>};
|
|
<a name="l166"></a>
|
|
<a name="l167"></a></span><span class=cF1>class</span><span class=cF0> Panel
|
|
<a name="l168"></a>{</span><span class=cF2>//Polygon or Obj</span><span class=cF0>
|
|
<a name="l169"></a> Panel *next;
|
|
<a name="l170"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *pts;
|
|
<a name="l171"></a> </span><span class=cF9>I64</span><span class=cF0> count;
|
|
<a name="l172"></a> </span><span class=cF9>U16</span><span class=cF0> update, num_sides;
|
|
<a name="l173"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> color;
|
|
<a name="l174"></a> Obj *next_obj, *last_obj;
|
|
<a name="l175"></a>
|
|
<a name="l176"></a>} *panel_head, *panels[MAP_HEIGHT][MAP_WIDTH];
|
|
<a name="l177"></a>
|
|
<a name="l178"></a></span><span class=cF9>I64</span><span class=cF0> critical_section_flag;
|
|
<a name="l179"></a></span><span class=cF9>I16</span><span class=cF0> elevations[MAP_HEIGHT][MAP_WIDTH];
|
|
<a name="l180"></a></span><span class=cF9>CD3</span><span class=cF0> normals[MAP_HEIGHT][MAP_WIDTH];
|
|
<a name="l181"></a>
|
|
<a name="l182"></a></span><span class=cF1>class</span><span class=cF0> MPCtrl
|
|
<a name="l183"></a>{
|
|
<a name="l184"></a> </span><span class=cF9>I64</span><span class=cF0> init_not_done_flags, update_not_done_flags, app_not_done_flags;
|
|
<a name="l185"></a> </span><span class=cF9>I64</span><span class=cF0> strip_width[</span><span class=cF3>MP_PROCESSORS_NUM</span><span class=cF0>];
|
|
<a name="l186"></a> </span><span class=cF1>Bool</span><span class=cF0> app_done;
|
|
<a name="l187"></a>} mp;
|
|
<a name="l188"></a>
|
|
<a name="l189"></a></span><span class=cF1>F64</span><span class=cF0> game_t0, game_tf, pitch, roll, heading, phi, speed;
|
|
<a name="l190"></a></span><span class=cF1>Bool</span><span class=cF0> invert_pitch, rolled_over;
|
|
<a name="l191"></a></span><span class=cF9>I64</span><span class=cF0> strip_height, x, y, z, fish_left;
|
|
<a name="l192"></a></span><span class=cF9>CD3</span><span class=cF0> v;
|
|
<a name="l193"></a>
|
|
<a name="l194"></a></span><span class=cF1>U0</span><span class=cF0> WrapAngles()
|
|
<a name="l195"></a>{
|
|
<a name="l196"></a> </span><span class=cF9>I64</span><span class=cF0> r[</span><span class=cFE>4</span><span class=cF0>][</span><span class=cFE>4</span><span class=cF0>], x, y, z;
|
|
<a name="l197"></a>
|
|
<a name="l198"></a> phi = </span><span class=cF5>Wrap</span><span class=cF0>(phi);
|
|
<a name="l199"></a> pitch = </span><span class=cF5>Wrap</span><span class=cF0>(-phi - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>pitch</span><span class=cF7>)</span><span class=cF0> > </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l201"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l202"></a> invert_pitch = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l203"></a> pitch = </span><span class=cF5>Wrap</span><span class=cF0>(</span><span class=cF3>pi</span><span class=cF0> - pitch);
|
|
<a name="l204"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l205"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l206"></a> invert_pitch = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l207"></a> roll = </span><span class=cF5>Wrap</span><span class=cF0>(roll);
|
|
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (invert_pitch ^^ -</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> <= roll < </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l209"></a> rolled_over = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l210"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l211"></a> rolled_over = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l212"></a> heading = </span><span class=cF5>Wrap</span><span class=cF0>(heading, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l213"></a>
|
|
<a name="l214"></a> </span><span class=cF2>//World to screen coordinates</span><span class=cF0>
|
|
<a name="l215"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
|
<a name="l216"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, heading);
|
|
<a name="l217"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r, phi);
|
|
<a name="l218"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, roll);
|
|
<a name="l219"></a>
|
|
<a name="l220"></a> </span><span class=cF2>//We use velocity vector for dog-fighting.</span><span class=cF0>
|
|
<a name="l221"></a> x = </span><span class=cFE>0x100000000</span><span class=cF0> * speed;
|
|
<a name="l222"></a> y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l223"></a> z = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(r, &x, &y, &z);
|
|
<a name="l225"></a> v.x = x / </span><span class=cF5>ToF64</span><span class=cF0>(</span><span class=cFE>0x100000000</span><span class=cF0>);
|
|
<a name="l226"></a> v.y = y / </span><span class=cF5>ToF64</span><span class=cF0>(</span><span class=cFE>0x100000000</span><span class=cF0>);
|
|
<a name="l227"></a> v.z = z / </span><span class=cF5>ToF64</span><span class=cF0>(</span><span class=cFE>0x100000000</span><span class=cF0>);
|
|
<a name="l228"></a>}
|
|
<a name="l229"></a>
|
|
<a name="l230"></a></span><span class=cF1>U0</span><span class=cF0> EDTransform(</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="l231"></a>{
|
|
<a name="l232"></a> </span><span class=cF9>I64</span><span class=cF0> zz;
|
|
<a name="l233"></a>
|
|
<a name="l234"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(dc->r, x, y, z);
|
|
<a name="l235"></a> *z = zz = -*z;
|
|
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (zz > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l237"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l238"></a> *x = dc->x + *x * DISPLAY_SCALE / zz; </span><span class=cF2>//Foreshortening</span><span class=cF0>
|
|
<a name="l239"></a> *y = dc->y - *y * DISPLAY_SCALE / zz;
|
|
<a name="l240"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l241"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l242"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l243"></a> *x = dc->x + *x;
|
|
<a name="l244"></a> *y = dc->y - *y;
|
|
<a name="l245"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l246"></a>}
|
|
<a name="l247"></a>
|
|
<a name="l248"></a></span><span class=cF1>U0</span><span class=cF0> CalcNormals()
|
|
<a name="l249"></a>{</span><span class=cF2>/*Find the normal vect with a curl.</span><span class=cF0>
|
|
<a name="l250"></a>
|
|
<a name="l251"></a></span><span class=cF2>i,j and k are the axis unit vectors,</span><span class=cF0>
|
|
<a name="l252"></a></span><span class=cF2>not to be confused with local index variables.</span><span class=cF0>
|
|
<a name="l253"></a>
|
|
<a name="l254"></a></span><span class=cF2>i j</span><span class=cF0> </span><span class=cF2>k</span><span class=cF0>
|
|
<a name="l255"></a></span><span class=cF2>0 1</span><span class=cF0> </span><span class=cF2>dz2</span><span class=cF0>
|
|
<a name="l256"></a></span><span class=cF2>1 0</span><span class=cF0> </span><span class=cF2>dz1</span><span class=cF0>
|
|
<a name="l257"></a>
|
|
<a name="l258"></a></span><span class=cF2>Normal: dz1*i + dz2*j - k</span><span class=cF0>
|
|
<a name="l259"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l260"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l261"></a>
|
|
<a name="l262"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < MAP_HEIGHT - </span><span class=cFE>1</span><span class=cF0>; j++)
|
|
<a name="l263"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l264"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < MAP_WIDTH - </span><span class=cFE>1</span><span class=cF0>; i++)
|
|
<a name="l265"></a> {
|
|
<a name="l266"></a> normals[j][i].x = elevations[j][i + </span><span class=cFE>1</span><span class=cF0>] - elevations[j][i];
|
|
<a name="l267"></a> normals[j][i].y = elevations[j + </span><span class=cFE>1</span><span class=cF0>][i] - elevations[j][i];
|
|
<a name="l268"></a> normals[j][i].z = -</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l269"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&normals[j][i]);
|
|
<a name="l270"></a> }
|
|
<a name="l271"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&normals[j][i], </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l272"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l273"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < MAP_WIDTH - </span><span class=cFE>1</span><span class=cF0>; i++)
|
|
<a name="l274"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&normals[j][i], </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l275"></a>}
|
|
<a name="l276"></a>
|
|
<a name="l277"></a></span><span class=cF1>Bool</span><span class=cF0> TestSameSlope(</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> w, </span><span class=cF9>I64</span><span class=cF0> h)
|
|
<a name="l278"></a>{
|
|
<a name="l279"></a> </span><span class=cF9>CD3</span><span class=cF0> p, *s;
|
|
<a name="l280"></a> </span><span class=cF9>I64</span><span class=cF0> k1, k2;
|
|
<a name="l281"></a>
|
|
<a name="l282"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> <= x && x + w < MAP_WIDTH && </span><span class=cFE>0</span><span class=cF0> <= y && y + h < MAP_HEIGHT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l283"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l284"></a> s = &normals[y][x];
|
|
<a name="l285"></a> </span><span class=cF1>for</span><span class=cF0> (k2 = </span><span class=cFE>0</span><span class=cF0>; k2 < h; k2++)
|
|
<a name="l286"></a> </span><span class=cF1>for</span><span class=cF0> (k1 = </span><span class=cFE>0</span><span class=cF0>; k1 < w; k1++)
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&p, &normals[y + k2][x + k1], s)</span><span class=cF7>)</span><span class=cF0> > .</span><span class=cFE>10</span><span class=cF0>)
|
|
<a name="l288"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l289"></a>
|
|
<a name="l290"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l291"></a>}
|
|
<a name="l292"></a>
|
|
<a name="l293"></a></span><span class=cF1>U0</span><span class=cF0> MPDoPanels(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
<a name="l294"></a>{
|
|
<a name="l295"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, l, k1, k2, w, h, threshold, lo, hi;
|
|
<a name="l296"></a> </span><span class=cF1>Bool</span><span class=cF0> cont;
|
|
<a name="l297"></a> Panel *tmpp, *start_ptr = </span><span class=cF3>NULL</span><span class=cF0>, *end_ptr = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l298"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *poly;
|
|
<a name="l299"></a> Obj *tmpo;
|
|
<a name="l300"></a>
|
|
<a name="l301"></a> lo = </span><span class=cF5>Gs</span><span class=cF0>->num * (MAP_HEIGHT - </span><span class=cFE>1</span><span class=cF0>) / </span><span class=cFB>mp_count</span><span class=cF0>;
|
|
<a name="l302"></a> hi = (</span><span class=cF5>Gs</span><span class=cF0>->num + </span><span class=cFE>1</span><span class=cF0>) * (MAP_HEIGHT - </span><span class=cFE>1</span><span class=cF0>) / </span><span class=cFB>mp_count</span><span class=cF0>;
|
|
<a name="l303"></a> </span><span class=cF1>for</span><span class=cF0> (threshold = </span><span class=cFE>8</span><span class=cF0>; threshold >= </span><span class=cFE>1</span><span class=cF0>; threshold--)
|
|
<a name="l304"></a> </span><span class=cF1>for</span><span class=cF0> (j = lo; j < hi; j++)
|
|
<a name="l305"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l306"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < MAP_WIDTH - </span><span class=cFE>1</span><span class=cF0>; i++)
|
|
<a name="l307"></a> {
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (!panels[j][i])
|
|
<a name="l309"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l310"></a> w = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l311"></a> h = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l312"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l313"></a> {
|
|
<a name="l314"></a> cont = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l315"></a> </span><span class=cF1>if</span><span class=cF0> (w < PANEL_SIZE_MAX && TestSameSlope</span><span class=cF7>(</span><span class=cF0>i, j, w + </span><span class=cFE>1</span><span class=cF0>, h</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l317"></a> w++;
|
|
<a name="l318"></a> cont = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (h < PANEL_SIZE_MAX && TestSameSlope</span><span class=cF7>(</span><span class=cF0>i, j, w, h + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l321"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l322"></a> h++;
|
|
<a name="l323"></a> cont = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l324"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l325"></a> }
|
|
<a name="l326"></a> </span><span class=cF1>while</span><span class=cF0> (cont);
|
|
<a name="l327"></a>
|
|
<a name="l328"></a> </span><span class=cF1>if</span><span class=cF0> (w >= threshold || h >= threshold)
|
|
<a name="l329"></a> {
|
|
<a name="l330"></a> tmpp = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Panel</span><span class=cF7>)</span><span class=cF0>, task);
|
|
<a name="l331"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&tmpp->next_obj);
|
|
<a name="l332"></a> l = elevations[j][i];
|
|
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (l <= WATER_ELEVATION * MAP_SCALE &&
|
|
<a name="l334"></a> elevations[j][i + w - </span><span class=cFE>1</span><span class=cF0>] <= WATER_ELEVATION * MAP_SCALE &&
|
|
<a name="l335"></a> elevations[j + h - </span><span class=cFE>1</span><span class=cF0>][i] <= WATER_ELEVATION * MAP_SCALE &&
|
|
<a name="l336"></a> elevations[j + h - </span><span class=cFE>1</span><span class=cF0>][i + w - </span><span class=cFE>1</span><span class=cF0>] <= WATER_ELEVATION * MAP_SCALE)
|
|
<a name="l337"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l338"></a> tmpp->color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>05</span><span class=cF0>)
|
|
<a name="l340"></a> {
|
|
<a name="l341"></a> 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>, task);
|
|
<a name="l342"></a> tmpo->p.x = (i + w / </span><span class=cFE>2</span><span class=cF0>) * MAP_SCALE;
|
|
<a name="l343"></a> tmpo->p.y = (j + h / </span><span class=cFE>2</span><span class=cF0>) * MAP_SCALE;
|
|
<a name="l344"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l345"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l346"></a> tmpo->fish = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l347"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l348"></a> tmpo->img = landscape_large_imgs[</span><span class=cFE>0</span><span class=cF0>]; </span><span class=cF2>//Boat</span><span class=cF0>
|
|
<a name="l349"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l350"></a> tmpo->img = landscape_large_imgs[</span><span class=cFE>1</span><span class=cF0>]; </span><span class=cF2>//Boat</span><span class=cF0>
|
|
<a name="l351"></a> tmpo->p.z = (WATER_ELEVATION + </span><span class=cFE>2</span><span class=cF0>) * MAP_SCALE;
|
|
<a name="l352"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l353"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l354"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l355"></a> tmpo->fish = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l356"></a> tmpo->img = </span><span class=cFA><1></span><span class=cF0>; </span><span class=cF2>//Fish</span><span class=cF0>
|
|
<a name="l357"></a> tmpo->p.z = WATER_ELEVATION * MAP_SCALE;
|
|
<a name="l358"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l359"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpo, tmpp->last_obj);
|
|
<a name="l360"></a> }
|
|
<a name="l361"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l362"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l363"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (l < ROCK_ELEVATION * MAP_SCALE)
|
|
<a name="l365"></a> {
|
|
<a name="l366"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l367"></a> tmpp->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l368"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l369"></a> tmpp->color = </span><span class=cF3>GREEN</span><span class=cF0> + </span><span class=cF3>LTGREEN</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
|
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>03</span><span class=cF0>)
|
|
<a name="l371"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l372"></a> 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>,task);
|
|
<a name="l373"></a> tmpo->p.x = (i + w / </span><span class=cFE>2</span><span class=cF0>) * MAP_SCALE;
|
|
<a name="l374"></a> tmpo->p.y = (j + h / </span><span class=cFE>2</span><span class=cF0>) * MAP_SCALE;
|
|
<a name="l375"></a> tmpo->p.z = l;
|
|
<a name="l376"></a> tmpo->img = landscape_large_imgs[</span><span class=cFE>2</span><span class=cF0>]; </span><span class=cF2>//Tree</span><span class=cF0>
|
|
<a name="l377"></a> tmpo->fish = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l378"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpo, tmpp->last_obj);
|
|
<a name="l379"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l380"></a> }
|
|
<a name="l381"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (l < SNOW_ELEVATION * MAP_SCALE)
|
|
<a name="l382"></a> {
|
|
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF5>RandU16</span><span class=cF0> & </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l384"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l385"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l386"></a> tmpp->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l387"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l388"></a> tmpp->color = </span><span class=cF3>DKGRAY</span><span class=cF0> + </span><span class=cF3>LTGRAY</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
|
<a name="l389"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l390"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l391"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l392"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l393"></a> tmpp->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l394"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l395"></a> tmpp->color = </span><span class=cF3>GREEN</span><span class=cF0> + </span><span class=cF3>LTGREEN</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
|
<a name="l396"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l397"></a> }
|
|
<a name="l398"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l399"></a> {
|
|
<a name="l400"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF5>RandU16</span><span class=cF0> & </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l401"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l402"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l403"></a> tmpp->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l404"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l405"></a> tmpp->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l406"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l407"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l408"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l409"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RandI16</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l410"></a> tmpp->color = </span><span class=cF3>LTGRAY</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
|
<a name="l411"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l412"></a> tmpp->color = </span><span class=cF3>DKGRAY</span><span class=cF0> + </span><span class=cF3>LTGRAY</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
|
|
<a name="l413"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l414"></a> }
|
|
<a name="l415"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l416"></a> tmpp->num_sides = </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l417"></a> poly = tmpp->pts = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0> * tmpp->num_sides, task);
|
|
<a name="l418"></a> poly[</span><span class=cFE>0</span><span class=cF0>].x = MAP_SCALE * i;
|
|
<a name="l419"></a> poly[</span><span class=cFE>0</span><span class=cF0>].y = MAP_SCALE * j;
|
|
<a name="l420"></a> poly[</span><span class=cFE>0</span><span class=cF0>].z = elevations[j][i];
|
|
<a name="l421"></a> poly[</span><span class=cFE>1</span><span class=cF0>].x = MAP_SCALE * (i + w);
|
|
<a name="l422"></a> poly[</span><span class=cFE>1</span><span class=cF0>].y = MAP_SCALE * j;
|
|
<a name="l423"></a> poly[</span><span class=cFE>1</span><span class=cF0>].z = elevations[j][i + w];
|
|
<a name="l424"></a> poly[</span><span class=cFE>2</span><span class=cF0>].x = MAP_SCALE * (i + w);
|
|
<a name="l425"></a> poly[</span><span class=cFE>2</span><span class=cF0>].y = MAP_SCALE * (j + h);
|
|
<a name="l426"></a> poly[</span><span class=cFE>2</span><span class=cF0>].z = elevations[j + h][i + w];
|
|
<a name="l427"></a> poly[</span><span class=cFE>3</span><span class=cF0>].x = MAP_SCALE * i;
|
|
<a name="l428"></a> poly[</span><span class=cFE>3</span><span class=cF0>].y = MAP_SCALE * (j + h);
|
|
<a name="l429"></a> poly[</span><span class=cFE>3</span><span class=cF0>].z = elevations[j + h][i];
|
|
<a name="l430"></a> tmpp->next = start_ptr;
|
|
<a name="l431"></a> start_ptr = tmpp;
|
|
<a name="l432"></a> </span><span class=cF1>if</span><span class=cF0> (!end_ptr)
|
|
<a name="l433"></a> end_ptr = tmpp;
|
|
<a name="l434"></a> </span><span class=cF1>for</span><span class=cF0> (k2 = </span><span class=cFE>0</span><span class=cF0>; k2 < h; k2++)
|
|
<a name="l435"></a> </span><span class=cF1>for</span><span class=cF0> (k1 = </span><span class=cFE>0</span><span class=cF0>; k1 < w; k1++)
|
|
<a name="l436"></a> panels[j + k2][i + k1] = tmpp;
|
|
<a name="l437"></a> }
|
|
<a name="l438"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l439"></a> }
|
|
<a name="l440"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (end_ptr)
|
|
<a name="l442"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l443"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&critical_section_flag, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l444"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (end_ptr)
|
|
<a name="l446"></a> end_ptr->next = panel_head;
|
|
<a name="l447"></a> panel_head = start_ptr;
|
|
<a name="l448"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&critical_section_flag, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l449"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l450"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&mp.init_not_done_flags, </span><span class=cF5>Gs</span><span class=cF0>->num);
|
|
<a name="l451"></a>}
|
|
<a name="l452"></a>
|
|
<a name="l453"></a></span><span class=cF1>U0</span><span class=cF0> InitElevations()
|
|
<a name="l454"></a>{
|
|
<a name="l455"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, l, x, y, xx, yy, x1, y1, x2, y2;
|
|
<a name="l456"></a>
|
|
<a name="l457"></a> </span><span class=cF5>MemSet</span><span class=cF0>(elevations, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>elevations</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l458"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < MAP_WIDTH * MAP_HEIGHT / </span><span class=cFE>128</span><span class=cF0>; i++)
|
|
<a name="l459"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l460"></a> x = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_WIDTH;
|
|
<a name="l461"></a> y = </span><span class=cF5>RandU32</span><span class=cF0> % MAP_HEIGHT;
|
|
<a name="l462"></a> j = </span><span class=cFE>1</span><span class=cF0> << (</span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>6</span><span class=cF0>);
|
|
<a name="l463"></a> l = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l464"></a> </span><span class=cF1>while</span><span class=cF0> (j--)
|
|
<a name="l465"></a> {
|
|
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (!l && </span><span class=cF5>RandU16</span><span class=cF0> < </span><span class=cF3>U16_MAX</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l467"></a> l = </span><span class=cF5>RandU16</span><span class=cF0> % (j + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l468"></a> </span><span class=cF1>if</span><span class=cF0> (l)
|
|
<a name="l469"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l470"></a> x1 = </span><span class=cF5>ClampI64</span><span class=cF0>(x - j, </span><span class=cFE>0</span><span class=cF0>, MAP_WIDTH - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l471"></a> x2 = </span><span class=cF5>ClampI64</span><span class=cF0>(x + j, </span><span class=cFE>0</span><span class=cF0>, MAP_WIDTH - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l472"></a> y1 = </span><span class=cF5>ClampI64</span><span class=cF0>(y - j, </span><span class=cFE>0</span><span class=cF0>, MAP_HEIGHT - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l473"></a> y2 = </span><span class=cF5>ClampI64</span><span class=cF0>(y + j, </span><span class=cFE>0</span><span class=cF0>, MAP_HEIGHT - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l474"></a> </span><span class=cF1>for</span><span class=cF0> (yy = y1; yy < y2; yy++)
|
|
<a name="l475"></a> </span><span class=cF1>for</span><span class=cF0> (xx = x1; xx < x2; xx++)
|
|
<a name="l476"></a> elevations[yy][xx] += MAP_SCALE / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l477"></a> l--;
|
|
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l479"></a> }
|
|
<a name="l480"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l481"></a>
|
|
<a name="l482"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < MAP_HEIGHT; j++)
|
|
<a name="l483"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < MAP_WIDTH; i++)
|
|
<a name="l484"></a> </span><span class=cF1>if</span><span class=cF0> (elevations[j][i] < WATER_ELEVATION * MAP_SCALE)
|
|
<a name="l485"></a> elevations[j][i] = WATER_ELEVATION * MAP_SCALE;
|
|
<a name="l486"></a>}
|
|
<a name="l487"></a>
|
|
<a name="l488"></a></span><span class=cF1>U0</span><span class=cF0> InitMap()
|
|
<a name="l489"></a>{</span><span class=cF2>/*We make a topographic data structure "elevations[][]"</span><span class=cF0>
|
|
<a name="l490"></a></span><span class=cF2>and convert it to panels. "panels[][]" holds the panels</span><span class=cF0>
|
|
<a name="l491"></a></span><span class=cF2>for each spot.</span><span class=cF0>
|
|
<a name="l492"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l493"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l494"></a>
|
|
<a name="l495"></a> InitElevations;
|
|
<a name="l496"></a> </span><span class=cF5>MemSet</span><span class=cF0>(panels, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>panels</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l497"></a> CalcNormals;
|
|
<a name="l498"></a> panel_head = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l499"></a> mp.init_not_done_flags = </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFB>mp_count</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l500"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l501"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&MPDoPanels, </span><span class=cF5>Fs</span><span class=cF0>, </span><span class=cF6>"Do Panels"</span><span class=cF0>, i);
|
|
<a name="l502"></a> </span><span class=cF1>while</span><span class=cF0> (mp.init_not_done_flags)
|
|
<a name="l503"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l504"></a>}
|
|
<a name="l505"></a>
|
|
<a name="l506"></a></span><span class=cF1>F64</span><span class=cF0> claws_down;
|
|
<a name="l507"></a>
|
|
<a name="l508"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_X (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - claws_down) * (</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>3</span><span class=cF0> * w) + claws_down * (</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>4</span><span class=cF0> * w)
|
|
<a name="l509"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_Y (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - claws_down) * (h - </span><span class=cFE>125</span><span class=cF0>) + claws_down * h
|
|
<a name="l510"></a>
|
|
<a name="l511"></a>
|
|
<a name="l512"></a>
|
|
<a name="l513"></a></span><span class=cFA>
|
|
<a name="l514"></a><7>/* Graphics Not Rendered in HTML */
|
|
<a name="l515"></a><8>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l516"></a>
|
|
<a name="l517"></a>
|
|
<a name="l518"></a>
|
|
<a name="l519"></a></span><span class=cF1>U0</span><span class=cF0> ClawDraw(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> x2, </span><span class=cF9>I64</span><span class=cF0> y2, </span><span class=cF9>I64</span><span class=cF0> w, </span><span class=cF9>I64</span><span class=cF0> segments, </span><span class=cF1>Bool</span><span class=cF0> talon)
|
|
<a name="l520"></a>{
|
|
<a name="l521"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l522"></a>
|
|
<a name="l523"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, j = segments; i < segments; i++,j--)
|
|
<a name="l524"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l525"></a> dc->thick = w;
|
|
<a name="l526"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l527"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, j * x1 / segments + i * x2 / segments, j * y1 / segments + i * y2 / segments, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l528"></a> </span><span class=cF7>(</span><span class=cF0>j - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * x1 / segments + </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * x2 / segments, </span><span class=cF7>(</span><span class=cF0>j - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * y1 / segments + </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * y2 / segments, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l529"></a> dc->thick = w - </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l530"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l531"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, j * x1 / segments + i * x2 / segments, j * y1 / segments + i * y2 / segments, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l532"></a> </span><span class=cF7>(</span><span class=cF0>j - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * x1 / segments + </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * x2 / segments, </span><span class=cF7>(</span><span class=cF0>j - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * y1 / segments + </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * y2 / segments, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l533"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l534"></a> </span><span class=cF1>if</span><span class=cF0> (talon)
|
|
<a name="l535"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l536"></a> </span><span class=cF1>if</span><span class=cF0> (y1 < y2)
|
|
<a name="l537"></a> </span><span class=cF5>Sprite3B</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><7></span><span class=cF0>);
|
|
<a name="l538"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l539"></a> </span><span class=cF5>Sprite3B</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><8></span><span class=cF0>);
|
|
<a name="l540"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l541"></a>}
|
|
<a name="l542"></a>
|
|
<a name="l543"></a></span><span class=cF1>U0</span><span class=cF0> ClawsDraw(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l544"></a>{
|
|
<a name="l545"></a> </span><span class=cF1>F64</span><span class=cF0> claws_up = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - claws_down;
|
|
<a name="l546"></a> </span><span class=cF9>I64</span><span class=cF0> w = task->pix_width, h = task->pix_height;
|
|
<a name="l547"></a>
|
|
<a name="l548"></a> dc->flags |= </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
|
|
<a name="l549"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc, w >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, w >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l550"></a>
|
|
<a name="l551"></a> ClawDraw(dc, HAND_X - </span><span class=cFE>30</span><span class=cF0>, HAND_Y - </span><span class=cFE>50</span><span class=cF0> * claws_up, HAND_X - </span><span class=cFE>5</span><span class=cF0>, HAND_Y, </span><span class=cFE>22</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l552"></a> ClawDraw(dc, HAND_X - </span><span class=cFE>10</span><span class=cF0>, HAND_Y - </span><span class=cFE>60</span><span class=cF0> * claws_up, HAND_X, HAND_Y, </span><span class=cFE>22</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l553"></a> ClawDraw(dc, HAND_X + </span><span class=cFE>10</span><span class=cF0>, HAND_Y - </span><span class=cFE>60</span><span class=cF0> * claws_up, HAND_X, HAND_Y, </span><span class=cFE>22</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l554"></a> ClawDraw(dc, HAND_X + </span><span class=cFE>30</span><span class=cF0>, HAND_Y - </span><span class=cFE>50</span><span class=cF0> * claws_up, HAND_X + </span><span class=cFE>5</span><span class=cF0>, HAND_Y, </span><span class=cFE>22</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l555"></a> ClawDraw(dc, HAND_X + </span><span class=cFE>25</span><span class=cF0>, HAND_Y + </span><span class=cFE>40</span><span class=cF0> * claws_up, HAND_X + </span><span class=cFE>5</span><span class=cF0>, HAND_Y, </span><span class=cFE>22</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l556"></a>
|
|
<a name="l557"></a> ClawDraw(dc, HAND_X, HAND_Y, </span><span class=cFE>6</span><span class=cF0> * w / </span><span class=cFE>20</span><span class=cF0>, h, </span><span class=cFE>38</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l558"></a>}
|
|
<a name="l559"></a>
|
|
<a name="l560"></a></span><span class=cF9>CDC</span><span class=cF0> *main_dc;
|
|
<a name="l561"></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="l562"></a>{
|
|
<a name="l563"></a> main_dc->flags |= </span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
|
|
<a name="l564"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, main_dc);
|
|
<a name="l565"></a> </span><span class=cF1>if</span><span class=cF0> (claws_down)
|
|
<a name="l566"></a> ClawsDraw(task, dc);
|
|
<a name="l567"></a>}
|
|
<a name="l568"></a>
|
|
<a name="l569"></a></span><span class=cF2>/*</span><span class=cFA>
|
|
<a name="l570"></a><9>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l571"></a>
|
|
<a name="l572"></a>
|
|
<a name="l573"></a>
|
|
<a name="l574"></a>
|
|
<a name="l575"></a>
|
|
<a name="l576"></a>
|
|
<a name="l577"></a>
|
|
<a name="l578"></a>
|
|
<a name="l579"></a>
|
|
<a name="l580"></a>
|
|
<a name="l581"></a>
|
|
<a name="l582"></a>
|
|
<a name="l583"></a>
|
|
<a name="l584"></a>
|
|
<a name="l585"></a>
|
|
<a name="l586"></a>
|
|
<a name="l587"></a>
|
|
<a name="l588"></a></span><span class=cFA>
|
|
<a name="l589"></a><10>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
|
<a name="l590"></a>
|
|
<a name="l591"></a>
|
|
<a name="l592"></a>
|
|
<a name="l593"></a>
|
|
<a name="l594"></a>
|
|
<a name="l595"></a>
|
|
<a name="l596"></a>
|
|
<a name="l597"></a>
|
|
<a name="l598"></a>
|
|
<a name="l599"></a>
|
|
<a name="l600"></a>
|
|
<a name="l601"></a>
|
|
<a name="l602"></a>
|
|
<a name="l603"></a>
|
|
<a name="l604"></a>
|
|
<a name="l605"></a>
|
|
<a name="l606"></a>
|
|
<a name="l607"></a>
|
|
<a name="l608"></a>
|
|
<a name="l609"></a>
|
|
<a name="l610"></a>
|
|
<a name="l611"></a>
|
|
<a name="l612"></a>
|
|
<a name="l613"></a>
|
|
<a name="l614"></a>
|
|
<a name="l615"></a>
|
|
<a name="l616"></a>
|
|
<a name="l617"></a>
|
|
<a name="l618"></a>
|
|
<a name="l619"></a>
|
|
<a name="l620"></a>
|
|
<a name="l621"></a>
|
|
<a name="l622"></a></span><span class=cF2>Cores render strips that +/- 15%. The cores check the panel map array</span><span class=cF0>
|
|
<a name="l623"></a></span><span class=cF2>and render the panel for each square, marking-it done.</span><span class=cF0>
|
|
<a name="l624"></a>
|
|
<a name="l625"></a></span><span class=cF2>The depth buf is not locked in the graphic routines</span><span class=cF0>
|
|
<a name="l626"></a></span><span class=cF2>so we get some glitches.</span><span class=cF0>
|
|
<a name="l627"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l628"></a>
|
|
<a name="l629"></a></span><span class=cF9>I64</span><span class=cF0> update_jiffy_limit;
|
|
<a name="l630"></a>
|
|
<a name="l631"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MPDrawIt</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="l632"></a>{
|
|
<a name="l633"></a> </span><span class=cF9>I64</span><span class=cF0> j, update = </span><span class=cFB>winmgr</span><span class=cF0>.updates & </span><span class=cFE>65535</span><span class=cF0>, strip_width, *s2w, x1, y1, z1, xx, yy,
|
|
<a name="l634"></a> xh, yh, zh, yh2, xh2, x1h, y1h, x1wa, y1wa, x1wb, y1wb, x3, y3, z3, dd, dd_old,
|
|
<a name="l635"></a> cx = task->pix_width >> </span><span class=cFE>1</span><span class=cF0>, cy = task->pix_height >> </span><span class=cFE>1</span><span class=cF0>, r[</span><span class=cFE>16</span><span class=cF0>], *elems1, *elems_hard;
|
|
<a name="l636"></a> Panel </span><span class=cF1>reg</span><span class=cF0> *tmpp;
|
|
<a name="l637"></a> Bird *tmpb;
|
|
<a name="l638"></a> Obj *tmpo;
|
|
<a name="l639"></a> </span><span class=cF1>Bool</span><span class=cF0> w_on_map, h_on_map;
|
|
<a name="l640"></a>
|
|
<a name="l641"></a> xx = x / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l642"></a> yy = y / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l643"></a>
|
|
<a name="l644"></a> </span><span class=cF2>//World to screen coordinates</span><span class=cF0>
|
|
<a name="l645"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc->r);
|
|
<a name="l646"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc->r, heading);
|
|
<a name="l647"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc->r, phi);
|
|
<a name="l648"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc->r, roll);
|
|
<a name="l649"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc, dc->r);
|
|
<a name="l650"></a>
|
|
<a name="l651"></a> </span><span class=cF2>//Screen to world coordinates</span><span class=cF0>
|
|
<a name="l652"></a>
|
|
<a name="l653"></a> </span><span class=cF2>//This gives us the vects for stepping through the grid in</span><span class=cF0>
|
|
<a name="l654"></a> </span><span class=cF2>//the direction the plane is facing. we step horizontally and vertically</span><span class=cF0>
|
|
<a name="l655"></a> </span><span class=cF2>//and use the reciprocal slope principle</span><span class=cF0>
|
|
<a name="l656"></a> </span><span class=cF2>//y=mx+b and y=(-1/m)x+b are perpendicular.</span><span class=cF0>
|
|
<a name="l657"></a>
|
|
<a name="l658"></a> s2w = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
|
|
<a name="l659"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -roll);
|
|
<a name="l660"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(s2w, -phi);
|
|
<a name="l661"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -heading);
|
|
<a name="l662"></a>
|
|
<a name="l663"></a> xh = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l664"></a> yh = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l665"></a> zh = -</span><span class=cFE>256</span><span class=cF0>;
|
|
<a name="l666"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(s2w, &xh, &yh, &zh);
|
|
<a name="l667"></a>
|
|
<a name="l668"></a> </span><span class=cF2>//The layer for core1 is not cleared automatically</span><span class=cF0>
|
|
<a name="l669"></a> </span><span class=cF2>//it is persistent. Terry carefully syncronized the update</span><span class=cF0>
|
|
<a name="l670"></a> </span><span class=cF2>//cycle initiated by Core0 to prevent flicker.</span><span class=cF0>
|
|
<a name="l671"></a>
|
|
<a name="l672"></a> dc->flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l673"></a> dc->transform = &EDTransform;
|
|
<a name="l674"></a> dc->x = cx;
|
|
<a name="l675"></a> dc->y = cy;
|
|
<a name="l676"></a>
|
|
<a name="l677"></a> </span><span class=cF2>//dc->x and the translation part of dc->r are ident in effect,</span><span class=cF0>
|
|
<a name="l678"></a> </span><span class=cF2>//but we use both to show-off.</span><span class=cF0> </span><span class=cF2>We could add offsets together and</span><span class=cF0>
|
|
<a name="l679"></a> </span><span class=cF2>//use one or the other.</span><span class=cF0>
|
|
<a name="l680"></a>
|
|
<a name="l681"></a> x1 = -x >> COORDINATE_BITS;
|
|
<a name="l682"></a> y1 = -y >> COORDINATE_BITS;
|
|
<a name="l683"></a> z1 = -z >> COORDINATE_BITS;
|
|
<a name="l684"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(dc->r, &x1, &y1, &z1);
|
|
<a name="l685"></a> </span><span class=cF5>Mat4x4TranslationEqu</span><span class=cF0>(dc->r, x1, y1, z1);
|
|
<a name="l686"></a>
|
|
<a name="l687"></a> </span><span class=cF2>//This is a refinement.</span><span class=cF0>
|
|
<a name="l688"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>phi * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>90</span><span class=cF0>)
|
|
<a name="l689"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l690"></a> x3 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l691"></a> y3 = -cy;
|
|
<a name="l692"></a> z3 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l693"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(s2w, &x3, &y3, &z3);
|
|
<a name="l694"></a> xx += x3;
|
|
<a name="l695"></a> yy += y3;
|
|
<a name="l696"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l697"></a>
|
|
<a name="l698"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Gs</span><span class=cF0>->num & </span><span class=cFE>1</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF2>//alt left-right,right-left</span><span class=cF0>
|
|
<a name="l699"></a> yh2 = -yh;
|
|
<a name="l700"></a> xh2 = -xh;
|
|
<a name="l701"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l702"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l703"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l704"></a> yh2 = yh;
|
|
<a name="l705"></a> xh2 = xh;
|
|
<a name="l706"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l707"></a>
|
|
<a name="l708"></a> </span><span class=cF2>//Calc starting point.</span><span class=cF0>
|
|
<a name="l709"></a> x1wa = xx << </span><span class=cFE>8</span><span class=cF0> + xh * strip_height >> </span><span class=cFE>1</span><span class=cF0> / </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>3</span><span class=cF0> * (</span><span class=cF5>Gs</span><span class=cF0>->num + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>15</span><span class=cF0>);
|
|
<a name="l710"></a> y1wa = yy << </span><span class=cFE>8</span><span class=cF0> + yh * strip_height >> </span><span class=cFE>1</span><span class=cF0> / </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>3</span><span class=cF0> * (</span><span class=cF5>Gs</span><span class=cF0>->num + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>15</span><span class=cF0>);
|
|
<a name="l711"></a> x1wb = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l712"></a> y1wb = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l713"></a>
|
|
<a name="l714"></a> xh = -xh; </span><span class=cF2>//Back to front to help with depth.</span><span class=cF0>
|
|
<a name="l715"></a> yh = -yh;
|
|
<a name="l716"></a>
|
|
<a name="l717"></a> </span><span class=cF2>//Take half steps to cover whole grid.</span><span class=cF0>
|
|
<a name="l718"></a> xh >>= </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l719"></a> yh >>= </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l720"></a> xh2 >>= </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l721"></a> yh2 >>= </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l722"></a> w_on_map = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l723"></a> dd_old = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l724"></a> </span><span class=cF1>for</span><span class=cF0> (strip_width = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cFB>counts</span><span class=cF0>.jiffies < update_jiffy_limit; strip_width++)
|
|
<a name="l725"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l726"></a> x1h = x1wa;
|
|
<a name="l727"></a> y1h = y1wa;
|
|
<a name="l728"></a> h_on_map = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l729"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < strip_height && </span><span class=cFB>counts</span><span class=cF0>.jiffies < update_jiffy_limit; j++)
|
|
<a name="l730"></a> {
|
|
<a name="l731"></a> x1 = x1h >> </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l732"></a> y1 = y1h >> </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l733"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= x1 < MAP_WIDTH && </span><span class=cFE>0</span><span class=cF0> <= y1 < MAP_HEIGHT)
|
|
<a name="l734"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l735"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpp = panels[y1][x1]</span><span class=cF7>)</span><span class=cF0> && tmpp->update != update)
|
|
<a name="l736"></a> {
|
|
<a name="l737"></a> tmpp->update = update;
|
|
<a name="l738"></a> </span><span class=cF1>if</span><span class=cF0> (tmpp->count > </span><span class=cFE>8</span><span class=cF0> * </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0> - </span><span class=cF5>Gs</span><span class=cF0>->idle_factor</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l739"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l740"></a> dc->color = tmpp->color;
|
|
<a name="l741"></a> tmpp->count = </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc, tmpp->num_sides, tmpp->pts);
|
|
<a name="l742"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l743"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l744"></a> tmpp->count++;
|
|
<a name="l745"></a> tmpo = tmpp->next_obj;
|
|
<a name="l746"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &tmpp->next_obj)
|
|
<a name="l747"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l748"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpo->p.x, tmpo->p.y, tmpo->p.z, tmpo->img);
|
|
<a name="l749"></a> tmpo = tmpo->next;
|
|
<a name="l750"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l751"></a> }
|
|
<a name="l752"></a> h_on_map = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l753"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l754"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (h_on_map)
|
|
<a name="l755"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l756"></a> x1h += xh;
|
|
<a name="l757"></a> y1h += yh;
|
|
<a name="l758"></a> }
|
|
<a name="l759"></a> </span><span class=cF1>if</span><span class=cF0> (h_on_map)
|
|
<a name="l760"></a> w_on_map = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l761"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (w_on_map)
|
|
<a name="l762"></a> {
|
|
<a name="l763"></a> strip_width = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l764"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l765"></a> }
|
|
<a name="l766"></a> x1wb -= yh2;
|
|
<a name="l767"></a> y1wb += xh2;
|
|
<a name="l768"></a> </span><span class=cF1>if</span><span class=cF0> (strip_width & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l769"></a> {
|
|
<a name="l770"></a> x1wa -= x1wb;
|
|
<a name="l771"></a> y1wa -= y1wb;
|
|
<a name="l772"></a> }
|
|
<a name="l773"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l774"></a> {
|
|
<a name="l775"></a> x1wa += x1wb;
|
|
<a name="l776"></a> y1wa += y1wb;
|
|
<a name="l777"></a> }
|
|
<a name="l778"></a> </span><span class=cF1>if</span><span class=cF0> (!w_on_map)
|
|
<a name="l779"></a> {
|
|
<a name="l780"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(x1wa >> </span><span class=cFE>8</span><span class=cF0> - MAP_WIDTH >> </span><span class=cFE>1</span><span class=cF0>) + </span><span class=cF5>SqrI64</span><span class=cF0>(y1wa >> </span><span class=cFE>8</span><span class=cF0> - MAP_HEIGHT >> </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l781"></a> </span><span class=cF1>if</span><span class=cF0> (dd > dd_old)
|
|
<a name="l782"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l783"></a> dd_old = dd;
|
|
<a name="l784"></a> }
|
|
<a name="l785"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l786"></a>
|
|
<a name="l787"></a> tmpb = b_head[</span><span class=cF5>Gs</span><span class=cF0>->num].next;
|
|
<a name="l788"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &b_head[</span><span class=cF5>Gs</span><span class=cF0>->num])
|
|
<a name="l789"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l790"></a> elems1 = </span><span class=cF5>SpriteInterpolate</span><span class=cF0>(</span><span class=cF5>Tri</span><span class=cF7>(</span><span class=cF5>tS</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFA><2></span><span class=cF0>, </span><span class=cFA><3></span><span class=cF0>);
|
|
<a name="l791"></a>
|
|
<a name="l792"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
|
<a name="l793"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(r, tmpb->theta);
|
|
<a name="l794"></a> elems_hard = </span><span class=cF5>SpriteTransform</span><span class=cF0>(elems1, r);
|
|
<a name="l795"></a>
|
|
<a name="l796"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpb->p.x, tmpb->p.y, tmpb->p.z, elems_hard);
|
|
<a name="l797"></a> </span><span class=cF5>Free</span><span class=cF0>(elems_hard);
|
|
<a name="l798"></a> </span><span class=cF5>Free</span><span class=cF0>(elems1);
|
|
<a name="l799"></a>
|
|
<a name="l800"></a> tmpb = tmpb->next;
|
|
<a name="l801"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l802"></a>
|
|
<a name="l803"></a> </span><span class=cF5>Free</span><span class=cF0>(s2w);
|
|
<a name="l804"></a> mp.strip_width[</span><span class=cF5>Gs</span><span class=cF0>->num] = strip_width;
|
|
<a name="l805"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&mp.update_not_done_flags, </span><span class=cF5>Gs</span><span class=cF0>->num);
|
|
<a name="l806"></a>}
|
|
<a name="l807"></a>
|
|
<a name="l808"></a></span><span class=cF1>U0</span><span class=cF0> CoreAPTalonsTask(</span><span class=cF9>CTask</span><span class=cF0> *master_task)
|
|
<a name="l809"></a>{
|
|
<a name="l810"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>(main_dc, master_task);
|
|
<a name="l811"></a>
|
|
<a name="l812"></a> </span><span class=cF1>while</span><span class=cF0> (!mp.app_done)
|
|
<a name="l813"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l814"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&mp.update_not_done_flags, </span><span class=cF5>Gs</span><span class=cF0>->num</span><span class=cF7>)</span><span class=cF0> && !mp.app_done)
|
|
<a name="l815"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l816"></a> </span><span class=cF1>if</span><span class=cF0> (!mp.app_done)
|
|
<a name="l817"></a> </span><span class=cF5>MPDrawIt</span><span class=cF0>(master_task, dc);
|
|
<a name="l818"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l819"></a>
|
|
<a name="l820"></a> </span><span class=cF2>//We made an alias of this we don't want freed.</span><span class=cF0>
|
|
<a name="l821"></a> dc->depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l822"></a>
|
|
<a name="l823"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l824"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&mp.app_not_done_flags, </span><span class=cF5>Gs</span><span class=cF0>->num);
|
|
<a name="l825"></a>}
|
|
<a name="l826"></a>
|
|
<a name="l827"></a></span><span class=cF1>U0</span><span class=cF0> DrawHorizon(</span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l828"></a>{
|
|
<a name="l829"></a> </span><span class=cF9>I64</span><span class=cF0> x1, y1, z1, x2, y2, z2, xh, yh, zh, *s2w = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>,
|
|
<a name="l830"></a> cx = </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>1</span><span class=cF0>,
|
|
<a name="l831"></a> cy = </span><span class=cF5>Fs</span><span class=cF0>->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l832"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p[</span><span class=cFE>4</span><span class=cF0>];
|
|
<a name="l833"></a> </span><span class=cF9>I32</span><span class=cF0> *old_db = dc->depth_buf;
|
|
<a name="l834"></a> dc->depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l835"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> ground_color;
|
|
<a name="l836"></a>
|
|
<a name="l837"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf && fish_left)
|
|
<a name="l838"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc, </span><span class=cF3>BLACK</span><span class=cF0>);
|
|
<a name="l839"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</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=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>phi - </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0> < </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l840"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc, </span><span class=cF3>LTCYAN</span><span class=cF0>);
|
|
<a name="l841"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l842"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l843"></a> </span><span class=cF1>if</span><span class=cF0> (z / COORDINATE_SCALE < </span><span class=cF7>(</span><span class=cF0>WATER_ELEVATION + </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0> * MAP_SCALE)
|
|
<a name="l844"></a> ground_color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l845"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l846"></a> ground_color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l847"></a>
|
|
<a name="l848"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc->r);
|
|
<a name="l849"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc->r, heading);
|
|
<a name="l850"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc->r, phi);
|
|
<a name="l851"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc->r, roll);
|
|
<a name="l852"></a>
|
|
<a name="l853"></a> </span><span class=cF5>DCMat4x4Set</span><span class=cF0>(dc, dc->r);
|
|
<a name="l854"></a> dc->flags &= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l855"></a> dc->transform = &EDTransform;
|
|
<a name="l856"></a> dc->x = cx;
|
|
<a name="l857"></a> dc->y = cy;
|
|
<a name="l858"></a>
|
|
<a name="l859"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -roll);
|
|
<a name="l860"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(s2w, -phi);
|
|
<a name="l861"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -heading);
|
|
<a name="l862"></a>
|
|
<a name="l863"></a> xh = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l864"></a> yh = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l865"></a> zh = -</span><span class=cFE>256</span><span class=cF0>;
|
|
<a name="l866"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(s2w, &xh, &yh, &zh);
|
|
<a name="l867"></a> </span><span class=cF5>Free</span><span class=cF0>(s2w);
|
|
<a name="l868"></a>
|
|
<a name="l869"></a> x1 = xh + yh * </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l870"></a> y1 = yh - xh * </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l871"></a> z1 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l872"></a> (*dc->transform)(dc, &x1, &y1, &z1);
|
|
<a name="l873"></a> x2 = xh - yh * </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l874"></a> y2 = yh + xh * </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l875"></a> z2 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l876"></a> (*dc->transform)(dc, &x2, &y2, &z2);
|
|
<a name="l877"></a> </span><span class=cF5>DCClipLine</span><span class=cF0>(dc, &x1, &y1, &x2, &y2);
|
|
<a name="l878"></a>
|
|
<a name="l879"></a> </span><span class=cF5>MemSet</span><span class=cF0>(p, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>p</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l880"></a> </span><span class=cF1>if</span><span class=cF0> (x2 < x1)
|
|
<a name="l881"></a> {
|
|
<a name="l882"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&x1, &x2);
|
|
<a name="l883"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&y1, &y2);
|
|
<a name="l884"></a> }
|
|
<a name="l885"></a> </span><span class=cF1>if</span><span class=cF0> (!x1 && x2 == dc->width - </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l886"></a> {
|
|
<a name="l887"></a> p[</span><span class=cFE>0</span><span class=cF0>].x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l888"></a> p[</span><span class=cFE>0</span><span class=cF0>].y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l889"></a> p[</span><span class=cFE>1</span><span class=cF0>].x = dc->width - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l890"></a> p[</span><span class=cFE>1</span><span class=cF0>].y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l891"></a> p[</span><span class=cFE>2</span><span class=cF0>].x = dc->width - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l892"></a> p[</span><span class=cFE>2</span><span class=cF0>].y = y2;
|
|
<a name="l893"></a> p[</span><span class=cFE>3</span><span class=cF0>].x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l894"></a> p[</span><span class=cFE>3</span><span class=cF0>].y = y1;
|
|
<a name="l895"></a> </span><span class=cF1>if</span><span class=cF0> (rolled_over)
|
|
<a name="l896"></a> dc->color = ground_color;
|
|
<a name="l897"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l898"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l899"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc, </span><span class=cFE>4</span><span class=cF0>, p);
|
|
<a name="l900"></a> p[</span><span class=cFE>0</span><span class=cF0>].y = dc->height - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l901"></a> p[</span><span class=cFE>1</span><span class=cF0>].y = dc->height - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l902"></a> </span><span class=cF1>if</span><span class=cF0> (rolled_over)
|
|
<a name="l903"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l904"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l905"></a> dc->color = ground_color;
|
|
<a name="l906"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc, </span><span class=cFE>4</span><span class=cF0>, p);
|
|
<a name="l907"></a> }
|
|
<a name="l908"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l909"></a> {
|
|
<a name="l910"></a> </span><span class=cF1>if</span><span class=cF0> (y2 < y1)
|
|
<a name="l911"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l912"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&x1, &x2);
|
|
<a name="l913"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&y1, &y2);
|
|
<a name="l914"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l915"></a> </span><span class=cF1>if</span><span class=cF0> (!y1 && y2 == dc->height - </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l916"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l917"></a> p[</span><span class=cFE>0</span><span class=cF0>].x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l918"></a> p[</span><span class=cFE>0</span><span class=cF0>].y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l919"></a> p[</span><span class=cFE>1</span><span class=cF0>].x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l920"></a> p[</span><span class=cFE>1</span><span class=cF0>].y = dc->height - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l921"></a> p[</span><span class=cFE>2</span><span class=cF0>].x = x2;
|
|
<a name="l922"></a> p[</span><span class=cFE>2</span><span class=cF0>].y = dc->height - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l923"></a> p[</span><span class=cFE>3</span><span class=cF0>].x = x1;
|
|
<a name="l924"></a> p[</span><span class=cFE>3</span><span class=cF0>].y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l925"></a> </span><span class=cF1>if</span><span class=cF0> (x1 < x2 ^^ rolled_over)
|
|
<a name="l926"></a> dc->color = ground_color;
|
|
<a name="l927"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l928"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l929"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc, </span><span class=cFE>4</span><span class=cF0>, p);
|
|
<a name="l930"></a> p[</span><span class=cFE>0</span><span class=cF0>].x = dc->width - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l931"></a> p[</span><span class=cFE>1</span><span class=cF0>].x = dc->width - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l932"></a> </span><span class=cF1>if</span><span class=cF0> (x1 < x2 ^^ rolled_over)
|
|
<a name="l933"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l934"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l935"></a> dc->color = ground_color;
|
|
<a name="l936"></a> </span><span class=cF5>GrFillPoly3</span><span class=cF0>(dc, </span><span class=cFE>4</span><span class=cF0>, p);
|
|
<a name="l937"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l938"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l939"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc, </span><span class=cF3>LTCYAN</span><span class=cF0>); </span><span class=cF2>//Not correct.</span><span class=cF0>
|
|
<a name="l940"></a> }
|
|
<a name="l941"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l942"></a>
|
|
<a name="l943"></a> dc->depth_buf = old_db;
|
|
<a name="l944"></a>}
|
|
<a name="l945"></a>
|
|
<a name="l946"></a></span><span class=cF1>U0</span><span class=cF0> Core0Talons()
|
|
<a name="l947"></a>{
|
|
<a name="l948"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>(main_dc,</span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l949"></a> </span><span class=cF9>I64</span><span class=cF0> i, xx, yy, elev, height, cx = </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>1</span><span class=cF0>, cy = </span><span class=cF5>Fs</span><span class=cF0>->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l950"></a> </span><span class=cF1>F64</span><span class=cF0> min_strip_width, tt;
|
|
<a name="l951"></a>
|
|
<a name="l952"></a> update_jiffy_limit = </span><span class=cFB>counts</span><span class=cF0>.jiffies + </span><span class=cF3>JIFFY_FREQ</span><span class=cF0> / </span><span class=cFE>40</span><span class=cF0>;
|
|
<a name="l953"></a>
|
|
<a name="l954"></a> xx = x / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l955"></a> yy = y / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l956"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= xx < MAP_WIDTH && </span><span class=cFE>0</span><span class=cF0> <= yy < MAP_HEIGHT)
|
|
<a name="l957"></a> elev = elevations[yy][xx];
|
|
<a name="l958"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l959"></a> elev = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l960"></a>
|
|
<a name="l961"></a> height = z / COORDINATE_SCALE - elev;
|
|
<a name="l962"></a> </span><span class=cF1>if</span><span class=cF0> (height < </span><span class=cFE>0</span><span class=cF0> && elev > WATER_ELEVATION * MAP_SCALE && !game_tf)
|
|
<a name="l963"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l964"></a> </span><span class=cFB>music</span><span class=cF0>.mute = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l965"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l966"></a> game_tf = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l967"></a> </span><span class=cFB>music</span><span class=cF0>.mute = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l968"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l969"></a>
|
|
<a name="l970"></a> DrawHorizon(dc);
|
|
<a name="l971"></a>
|
|
<a name="l972"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf)
|
|
<a name="l973"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l974"></a> tt = game_tf - game_t0;
|
|
<a name="l975"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l976"></a> {
|
|
<a name="l977"></a> dc->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l978"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->pix_width - </span><span class=cFE>9</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->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 Over"</span><span class=cF0>);
|
|
<a name="l979"></a> }
|
|
<a name="l980"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l981"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l982"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l983"></a> </span><span class=cF5>DCDepthBufReset</span><span class=cF0>(dc);
|
|
<a name="l984"></a> mp.update_not_done_flags = </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFB>mp_count</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l985"></a> </span><span class=cF5>MPDrawIt</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>, dc);
|
|
<a name="l986"></a> </span><span class=cF1>while</span><span class=cF0> (mp.update_not_done_flags)
|
|
<a name="l987"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l988"></a>
|
|
<a name="l989"></a> min_strip_width = </span><span class=cF3>F64_MAX</span><span class=cF0>;
|
|
<a name="l990"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l991"></a> min_strip_width = </span><span class=cF5>Min</span><span class=cF0>(min_strip_width, </span><span class=cFE>32</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * mp.strip_width[i] / </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>32</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l992"></a> strip_height = </span><span class=cF5>ClampI64</span><span class=cF0>(strip_height * </span><span class=cF5>Clamp</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0> * min_strip_width / strip_height, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>9</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>64</span><span class=cF0>, </span><span class=cFE>1024</span><span class=cF0>);
|
|
<a name="l993"></a>
|
|
<a name="l994"></a> tt = </span><span class=cF5>tS</span><span class=cF0> - game_t0;
|
|
<a name="l995"></a> </span><span class=cF1>if</span><span class=cF0> (tt < </span><span class=cFE>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> && </span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l996"></a> {
|
|
<a name="l997"></a> dc->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l998"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->pix_width - </span><span class=cFE>13</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l999"></a> </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->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=cFE>4</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>"Catch 10 Fish"</span><span class=cF0>);
|
|
<a name="l1000"></a> }
|
|
<a name="l1001"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1002"></a>
|
|
<a name="l1003"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l1004"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf && fish_left)
|
|
<a name="l1005"></a> dc->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l1006"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1007"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l1008"></a> dc->flags &= ~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l1009"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, cx + </span><span class=cFE>5</span><span class=cF0>, cy, </span><span class=cFE>0</span><span class=cF0>, cx - </span><span class=cFE>5</span><span class=cF0>, cy, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1010"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, cx, cy + </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, cx, cy - </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1011"></a> </span><span class=cF1>if</span><span class=cF0> (invert_pitch)
|
|
<a name="l1012"></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>"Pitch:%5.1f Roll:%5.1f Heading:%5.1f "</span><span class=cF0>
|
|
<a name="l1013"></a> </span><span class=cF6>"Height:%5d [Core Strip:%3d]"</span><span class=cF0>,
|
|
<a name="l1014"></a> pitch * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1015"></a> </span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>roll + </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1016"></a> </span><span class=cF5>Wrap</span><span class=cF7>(</span><span class=cF0>heading + </span><span class=cF3>pi</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1017"></a> height,
|
|
<a name="l1018"></a> strip_height);
|
|
<a name="l1019"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1020"></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>"Pitch:%5.1f Roll:%5.1f Heading:%5.1f "</span><span class=cF0>
|
|
<a name="l1021"></a> </span><span class=cF6>"Height:%5d [Core Strip:%3d]"</span><span class=cF0>,
|
|
<a name="l1022"></a> pitch * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1023"></a> roll * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1024"></a> heading * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>,
|
|
<a name="l1025"></a> height,
|
|
<a name="l1026"></a> strip_height);
|
|
<a name="l1027"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>"Fish Remaining:%d Time:%3.2f Best:%3.2f"</span><span class=cF0>, fish_left, tt, best_score);
|
|
<a name="l1028"></a>
|
|
<a name="l1029"></a> </span><span class=cF2>//We made an alias of this we don't want freed.</span><span class=cF0>
|
|
<a name="l1030"></a> dc->depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1031"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l1032"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l1033"></a>}
|
|
<a name="l1034"></a>
|
|
<a name="l1035"></a>
|
|
<a name="l1036"></a>Obj *FishFind(</span><span class=cF9>I64</span><span class=cF0> x1, </span><span class=cF9>I64</span><span class=cF0> y1, </span><span class=cF9>I64</span><span class=cF0> *_dd)
|
|
<a name="l1037"></a>{
|
|
<a name="l1038"></a> </span><span class=cF9>I64</span><span class=cF0> dd, best_dd = </span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l1039"></a> Obj *res = </span><span class=cF3>NULL</span><span class=cF0>, *tmpo;
|
|
<a name="l1040"></a> Panel *tmpp = panel_head;
|
|
<a name="l1041"></a>
|
|
<a name="l1042"></a> </span><span class=cF1>while</span><span class=cF0> (tmpp)
|
|
<a name="l1043"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1044"></a> tmpo = tmpp->next_obj;
|
|
<a name="l1045"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo != &tmpp->next_obj)
|
|
<a name="l1046"></a> {
|
|
<a name="l1047"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo->fish)
|
|
<a name="l1048"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1049"></a> dd = </span><span class=cF5>SqrI64</span><span class=cF0>(tmpo->p.x - x1) + </span><span class=cF5>SqrI64</span><span class=cF0>(tmpo->p.y - y1);
|
|
<a name="l1050"></a> </span><span class=cF1>if</span><span class=cF0> (dd < best_dd)
|
|
<a name="l1051"></a> {
|
|
<a name="l1052"></a> best_dd = dd;
|
|
<a name="l1053"></a> res = tmpo;
|
|
<a name="l1054"></a> }
|
|
<a name="l1055"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1056"></a> tmpo = tmpo->next;
|
|
<a name="l1057"></a> }
|
|
<a name="l1058"></a> tmpp = tmpp->next;
|
|
<a name="l1059"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1060"></a> *_dd = best_dd;
|
|
<a name="l1061"></a>
|
|
<a name="l1062"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l1063"></a>}
|
|
<a name="l1064"></a>
|
|
<a name="l1065"></a>#</span><span class=cF1>define</span><span class=cF0> ANIMATE_MS </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l1066"></a>
|
|
<a name="l1067"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l1068"></a>{</span><span class=cF2>//Steadily moves the airplane forward.</span><span class=cF0>
|
|
<a name="l1069"></a> </span><span class=cF9>I64</span><span class=cF0> i, *s2w, x1, y1, z1, dx, dy, dz, dd;
|
|
<a name="l1070"></a> </span><span class=cF1>F64</span><span class=cF0> t0 = </span><span class=cF5>tS</span><span class=cF0>,</span><span class=cFB>mouse</span><span class=cF0>, theta, d;
|
|
<a name="l1071"></a> Obj *tmpo;
|
|
<a name="l1072"></a> Bird *tmpb;
|
|
<a name="l1073"></a>
|
|
<a name="l1074"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l1075"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1076"></a> </span><span class=cFB>mouse</span><span class=cF0> = </span><span class=cFE>1000</span><span class=cF0> * (</span><span class=cF5>tS</span><span class=cF0> - t0);
|
|
<a name="l1077"></a> t0 = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l1078"></a> </span><span class=cF1>if</span><span class=cF0> (!game_tf)
|
|
<a name="l1079"></a> {
|
|
<a name="l1080"></a> </span><span class=cF2>//Screen to world coordinates</span><span class=cF0>
|
|
<a name="l1081"></a> s2w = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
|
|
<a name="l1082"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -roll);
|
|
<a name="l1083"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(s2w, -phi);
|
|
<a name="l1084"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(s2w, -heading);
|
|
<a name="l1085"></a>
|
|
<a name="l1086"></a> dx = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1087"></a> dy = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1088"></a> dz = </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l1089"></a> </span><span class=cF5>Mat4x4MulXYZ</span><span class=cF0>(s2w, &dx, &dy, &dz);
|
|
<a name="l1090"></a> x -= speed * </span><span class=cFB>mouse</span><span class=cF0> * COORDINATE_SCALE * dx / </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l1091"></a> y -= speed * </span><span class=cFB>mouse</span><span class=cF0> * COORDINATE_SCALE * dy / </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l1092"></a> z -= speed * </span><span class=cFB>mouse</span><span class=cF0> * COORDINATE_SCALE * dz / </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l1093"></a> </span><span class=cF5>Free</span><span class=cF0>(s2w);
|
|
<a name="l1094"></a> x1 = x / COORDINATE_SCALE;
|
|
<a name="l1095"></a> y1 = y / COORDINATE_SCALE;
|
|
<a name="l1096"></a> z1 = z / COORDINATE_SCALE;
|
|
<a name="l1097"></a> </span><span class=cF1>if</span><span class=cF0> (z1 < </span><span class=cF7>(</span><span class=cF0>WATER_ELEVATION + </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0> * MAP_SCALE)
|
|
<a name="l1098"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1099"></a> </span><span class=cF1>if</span><span class=cF0> (z1 < WATER_ELEVATION * MAP_SCALE)
|
|
<a name="l1100"></a> {
|
|
<a name="l1101"></a> z = WATER_ELEVATION * MAP_SCALE * COORDINATE_SCALE;
|
|
<a name="l1102"></a> </span><span class=cF1>if</span><span class=cF0> (invert_pitch)
|
|
<a name="l1103"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1104"></a> </span><span class=cF1>if</span><span class=cF0> (pitch < -</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>)
|
|
<a name="l1105"></a> phi += </span><span class=cFB>mouse</span><span class=cF0> / </span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF5>Sign</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0> - phi);
|
|
<a name="l1106"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1107"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (pitch < -</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>)
|
|
<a name="l1108"></a> phi += </span><span class=cFB>mouse</span><span class=cF0> / </span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF5>Sign</span><span class=cF0>(-</span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0> - phi);
|
|
<a name="l1109"></a> WrapAngles;
|
|
<a name="l1110"></a> }
|
|
<a name="l1111"></a> speed = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1112"></a> </span><span class=cF1>if</span><span class=cF0> (rolled_over || !</span><span class=cF7>(</span><span class=cF0>tmpo = FishFind(x1, y1, &dd)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1113"></a> claws_down = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1114"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1115"></a> {
|
|
<a name="l1116"></a> d = </span><span class=cF5>Sqrt</span><span class=cF0>(dd);
|
|
<a name="l1117"></a> x1 -= tmpo->p.x;
|
|
<a name="l1118"></a> y1 -= tmpo->p.y;
|
|
<a name="l1119"></a> theta = </span><span class=cF5>ACos</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>dx * x1 + dy * y1</span><span class=cF7>)</span><span class=cF0> / </span><span class=cF7>(</span><span class=cF0>d * </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1120"></a> </span><span class=cF1>if</span><span class=cF0> (theta > </span><span class=cFE>0</span><span class=cF0> && d < MAP_SCALE * </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1121"></a> claws_down = </span><span class=cF5>Saw</span><span class=cF0>(d, MAP_SCALE * </span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l1122"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1123"></a> claws_down = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>01</span><span class=cF0>;
|
|
<a name="l1124"></a> </span><span class=cF1>if</span><span class=cF0> (d < MAP_SCALE * </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l1125"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1126"></a> </span><span class=cF1>if</span><span class=cF0> (!--fish_left)
|
|
<a name="l1127"></a> {
|
|
<a name="l1128"></a> game_tf = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l1129"></a> </span><span class=cF1>if</span><span class=cF0> (game_tf - game_t0 < best_score)
|
|
<a name="l1130"></a> best_score = game_tf - game_t0;
|
|
<a name="l1131"></a> }
|
|
<a name="l1132"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpo);
|
|
<a name="l1133"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo);
|
|
<a name="l1134"></a> </span><span class=cFB>music</span><span class=cF0>.mute = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1135"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l1136"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>200</span><span class=cF0>);
|
|
<a name="l1137"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l1138"></a> </span><span class=cFB>music</span><span class=cF0>.mute = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1140"></a> }
|
|
<a name="l1141"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1142"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1143"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1144"></a> claws_down = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1145"></a> </span><span class=cF1>if</span><span class=cF0> (-</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0> <= phi <= </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1146"></a> speed += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0>;
|
|
<a name="l1147"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (-</span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0> <= phi <= </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1148"></a> speed += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l1149"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1150"></a> speed -= </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l1151"></a> speed = </span><span class=cF5>Clamp</span><span class=cF0>(speed + </span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0005</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0002</span><span class=cF0> * </span><span class=cF5>Abs</span><span class=cF0>(phi) / (</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)</span><span class=cF7>)</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>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1152"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1153"></a>
|
|
<a name="l1154"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l1155"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1156"></a> tmpb = b_head[i].next;
|
|
<a name="l1157"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb != &b_head[i])
|
|
<a name="l1158"></a> {
|
|
<a name="l1159"></a> tmpb->p.x += </span><span class=cFE>10</span><span class=cF0> * </span><span class=cFB>mouse</span><span class=cF0> / </span><span class=cFE>1000</span><span class=cF0> * MAP_SCALE * </span><span class=cF5>Cos</span><span class=cF0>(tmpb->theta);
|
|
<a name="l1160"></a> tmpb->p.y += </span><span class=cFE>10</span><span class=cF0> * </span><span class=cFB>mouse</span><span class=cF0> / </span><span class=cFE>1000</span><span class=cF0> * MAP_SCALE * </span><span class=cF5>Sin</span><span class=cF0>(tmpb->theta);
|
|
<a name="l1161"></a> tmpb->p.z = BIRD_ELEVATION * MAP_SCALE + elevations[tmpb->p.y / MAP_SCALE][tmpb->p.x / MAP_SCALE];
|
|
<a name="l1162"></a> tmpb->theta += </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * </span><span class=cFB>mouse</span><span class=cF0> / </span><span class=cFE>1000</span><span class=cF0> / </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l1163"></a> tmpb = tmpb->next;
|
|
<a name="l1164"></a> }
|
|
<a name="l1165"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1166"></a> }
|
|
<a name="l1167"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l1168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1169"></a>}
|
|
<a name="l1170"></a>
|
|
<a name="l1171"></a></span><span class=cF1>U0</span><span class=cF0> MPEnd()
|
|
<a name="l1172"></a>{
|
|
<a name="l1173"></a> update_jiffy_limit = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1174"></a> mp.app_not_done_flags = </span><span class=cFE>1</span><span class=cF0> << </span><span class=cFB>mp_count</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1175"></a> mp.app_done = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1176"></a></span><span class=cF2>//Wait for all cores to exit</span><span class=cF0>
|
|
<a name="l1177"></a> </span><span class=cF1>while</span><span class=cF0> (mp.app_not_done_flags)
|
|
<a name="l1178"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1179"></a>}
|
|
<a name="l1180"></a>
|
|
<a name="l1181"></a></span><span class=cF1>U0</span><span class=cF0> TaskEndCB()
|
|
<a name="l1182"></a>{
|
|
<a name="l1183"></a> MPEnd;
|
|
<a name="l1184"></a> </span><span class=cF5>Exit</span><span class=cF0>;
|
|
<a name="l1185"></a>}
|
|
<a name="l1186"></a>
|
|
<a name="l1187"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l1188"></a>{
|
|
<a name="l1189"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb = &</span><span class=cF5>SoundTaskEndCB</span><span class=cF0>;
|
|
<a name="l1190"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
|
|
<a name="l1191"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l1192"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1193"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eCGFsD4A5e.C4sG5eGDqCDeGsGG4qG"</span><span class=cF0>);
|
|
<a name="l1194"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eCGFsD4A5e.C4sG5eGDqCDeGsGG4qG"</span><span class=cF0>);
|
|
<a name="l1195"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eGECGC4A5FCsC4B5C4B5e.GsG4qGB"</span><span class=cF0>);
|
|
<a name="l1196"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5eGECGC4A5FCsC4B5C4B5e.GsG4qGB"</span><span class=cF0>);
|
|
<a name="l1197"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1198"></a>}
|
|
<a name="l1199"></a>
|
|
<a name="l1200"></a></span><span class=cF1>U0</span><span class=cF0> PreInit()
|
|
<a name="l1201"></a>{
|
|
<a name="l1202"></a> </span><span class=cF9>I64</span><span class=cF0> i, *r = </span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
|
|
<a name="l1203"></a>
|
|
<a name="l1204"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r, </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1205"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < LS_TYPES; i++)
|
|
<a name="l1206"></a> landscape_large_imgs[i] = </span><span class=cF5>SpriteTransform</span><span class=cF0>(landscape_small_imgs[i], r);
|
|
<a name="l1207"></a> </span><span class=cF5>Free</span><span class=cF0>(r);
|
|
<a name="l1208"></a>}
|
|
<a name="l1209"></a>
|
|
<a name="l1210"></a></span><span class=cF1>U0</span><span class=cF0> PostCleanUp()
|
|
<a name="l1211"></a>{
|
|
<a name="l1212"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1213"></a>
|
|
<a name="l1214"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < LS_TYPES; i++)
|
|
<a name="l1215"></a> </span><span class=cF5>Free</span><span class=cF0>(landscape_large_imgs[i]);
|
|
<a name="l1216"></a>}
|
|
<a name="l1217"></a>
|
|
<a name="l1218"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l1219"></a>{
|
|
<a name="l1220"></a> </span><span class=cF9>I64</span><span class=cF0> i, xx, yy;
|
|
<a name="l1221"></a> Bird *tmpb;
|
|
<a name="l1222"></a>
|
|
<a name="l1223"></a> main_dc = </span><span class=cF5>DCNew</span><span class=cF0>(</span><span class=cF3>GR_WIDTH</span><span class=cF0>, </span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
|
|
<a name="l1224"></a> critical_section_flag = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1225"></a> game_tf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1226"></a> fish_left = </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l1227"></a>
|
|
<a name="l1228"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&mp, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MPCtrl</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1229"></a> InitMap;
|
|
<a name="l1230"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(main_dc);
|
|
<a name="l1231"></a>
|
|
<a name="l1232"></a> strip_height = </span><span class=cFE>128</span><span class=cF0>;
|
|
<a name="l1233"></a>
|
|
<a name="l1234"></a> phi = -</span><span class=cFE>90</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1235"></a> roll = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1236"></a> heading = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1237"></a> speed = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l1238"></a> claws_down = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1239"></a> WrapAngles;
|
|
<a name="l1240"></a>
|
|
<a name="l1241"></a> x = MAP_WIDTH >> </span><span class=cFE>1</span><span class=cF0> * COORDINATE_SCALE * MAP_SCALE;
|
|
<a name="l1242"></a> y = MAP_HEIGHT >> </span><span class=cFE>1</span><span class=cF0> * COORDINATE_SCALE * MAP_SCALE;
|
|
<a name="l1243"></a> z = </span><span class=cFE>64</span><span class=cF0> * COORDINATE_SCALE * MAP_SCALE;
|
|
<a name="l1244"></a>
|
|
<a name="l1245"></a> xx = x / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l1246"></a> yy = y / (MAP_SCALE * COORDINATE_SCALE);
|
|
<a name="l1247"></a> z += elevations[yy][xx] * COORDINATE_SCALE;
|
|
<a name="l1248"></a>
|
|
<a name="l1249"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l1250"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&b_head[i]);
|
|
<a name="l1251"></a>
|
|
<a name="l1252"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < B_NUM; i++)
|
|
<a name="l1253"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1254"></a> tmpb = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Bird</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1255"></a> tmpb->p.x = </span><span class=cF5>Rand</span><span class=cF0> * MAP_WIDTH * MAP_SCALE;
|
|
<a name="l1256"></a> tmpb->p.y = </span><span class=cF5>Rand</span><span class=cF0> * MAP_HEIGHT * MAP_SCALE;
|
|
<a name="l1257"></a> tmpb->p.z = BIRD_ELEVATION * MAP_SCALE + elevations[tmpb->p.y / MAP_SCALE][tmpb->p.x / MAP_SCALE];
|
|
<a name="l1258"></a> tmpb->theta = </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l1259"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, b_head[i % </span><span class=cFB>mp_count</span><span class=cF0>].last);
|
|
<a name="l1260"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1261"></a>
|
|
<a name="l1262"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l1263"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&CoreAPTalonsTask, </span><span class=cF5>Fs</span><span class=cF0>, </span><span class=cF6>"AP Talons"</span><span class=cF0>, i);
|
|
<a name="l1264"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb = &TaskEndCB;
|
|
<a name="l1265"></a> game_t0 = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l1266"></a>}
|
|
<a name="l1267"></a>
|
|
<a name="l1268"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
|
|
<a name="l1269"></a>{
|
|
<a name="l1270"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1271"></a> Panel *tmpp = panel_head, *tmpp1;
|
|
<a name="l1272"></a>
|
|
<a name="l1273"></a> MPEnd;
|
|
<a name="l1274"></a> </span><span class=cF1>while</span><span class=cF0> (tmpp)
|
|
<a name="l1275"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1276"></a> tmpp1 = tmpp->next;
|
|
<a name="l1277"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&tmpp->next_obj);
|
|
<a name="l1278"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpp->pts);
|
|
<a name="l1279"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpp);
|
|
<a name="l1280"></a> tmpp = tmpp1;
|
|
<a name="l1281"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1282"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFB>mp_count</span><span class=cF0>; i++)
|
|
<a name="l1283"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1284"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&b_head[i]);
|
|
<a name="l1285"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&b_head[i]);
|
|
<a name="l1286"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1287"></a> </span><span class=cF5>DCDel</span><span class=cF0>(main_dc);
|
|
<a name="l1288"></a>}
|
|
<a name="l1289"></a>
|
|
<a name="l1290"></a></span><span class=cF1>U0</span><span class=cF0> Talons()
|
|
<a name="l1291"></a>{
|
|
<a name="l1292"></a> </span><span class=cF9>I64</span><span class=cF0> ch, sc;
|
|
<a name="l1293"></a>
|
|
<a name="l1294"></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="l1295"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l1296"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l1297"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l1298"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l1299"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l1300"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l1301"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l1302"></a> </span><span class=cF6>" Down(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l1303"></a> </span><span class=cF6>" Up(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l1304"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l1305"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l1306"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l1307"></a> );
|
|
<a name="l1308"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l1309"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l1310"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l1311"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l1312"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l1313"></a> </span><span class=cF6>"Initializing...\n"</span><span class=cF0>;
|
|
<a name="l1314"></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="l1315"></a> PreInit;
|
|
<a name="l1316"></a> Init;
|
|
<a name="l1317"></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="l1318"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l1319"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF2>//in case <CTRL-ALT-c> is pressed.</span><span class=cF0>
|
|
<a name="l1320"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l1321"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1322"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>KeyScan</span><span class=cF7>(</span><span class=cF0>&ch, &sc</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1323"></a> {
|
|
<a name="l1324"></a> </span><span class=cF1>switch</span><span class=cF0> (ch)
|
|
<a name="l1325"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1326"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l1327"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l1328"></a> {
|
|
<a name="l1329"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1330"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l1331"></a> phi -= CTRLS_SCALE * </span><span class=cF5>Cos</span><span class=cF0>(roll);
|
|
<a name="l1332"></a> heading -= CTRLS_SCALE * </span><span class=cF5>Sin</span><span class=cF0>(roll) * </span><span class=cF5>Sin</span><span class=cF0>(phi);
|
|
<a name="l1333"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1334"></a>
|
|
<a name="l1335"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l1336"></a> phi += CTRLS_SCALE * </span><span class=cF5>Cos</span><span class=cF0>(roll);
|
|
<a name="l1337"></a> heading += CTRLS_SCALE * </span><span class=cF5>Sin</span><span class=cF0>(roll) * </span><span class=cF5>Sin</span><span class=cF0>(phi);
|
|
<a name="l1338"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1339"></a>
|
|
<a name="l1340"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l1341"></a> roll += CTRLS_SCALE;
|
|
<a name="l1342"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1343"></a>
|
|
<a name="l1344"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l1345"></a> roll -= CTRLS_SCALE;
|
|
<a name="l1346"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1347"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1348"></a> WrapAngles;
|
|
<a name="l1349"></a> }
|
|
<a name="l1350"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1351"></a>
|
|
<a name="l1352"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l1353"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1354"></a> CleanUp;
|
|
<a name="l1355"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l1356"></a> Init;
|
|
<a name="l1357"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l1358"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1359"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1360"></a> }
|
|
<a name="l1361"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1362"></a> Core0Talons;
|
|
<a name="l1363"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1364"></a> </span><span class=cF1>while</span><span class=cF0> (ch != </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0> && ch != </span><span class=cF3>CH_ESC</span><span class=cF0>);
|
|
<a name="l1365"></a>
|
|
<a name="l1366"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l1367"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l1368"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l1369"></a> CleanUp;
|
|
<a name="l1370"></a> PostCleanUp;
|
|
<a name="l1371"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l1372"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"ZealOS/Talons"</span><span class=cF0>, </span><span class=cF6>"F64 best_score=%5.4f;\n"</span><span class=cF0>, best_score);
|
|
<a name="l1373"></a>}
|
|
<a name="l1374"></a>
|
|
<a name="l1375"></a>Talons;
|
|
</span></pre></body>
|
|
</html>
|