997 lines
81 KiB
HTML
Executable File
997 lines
81 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cE0{color:#000000;background-color:#ffff55;}
|
|
.cE1{color:#0000aa;background-color:#ffff55;}
|
|
.cEA{color:#55ff55;background-color:#ffff55;}
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF5>RegDft</span><span class=cF0>(</span><span class=cF6>"TempleOS/Titanium"</span><span class=cF0>,</span><span class=cF6>"I64 best_score=0;\n"</span><span class=cF0>);
|
|
<a name="l2"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>"TempleOS/Titanium"</span><span class=cF0>);
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> MAP_HEIGHT 4096
|
|
<a name="l5"></a>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> B_LEN 10
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> B_SPEED 5
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> B_NUM 128
|
|
<a name="l9"></a></span><span class=cF1>class</span><span class=cF0> Bullet
|
|
<a name="l10"></a>{
|
|
<a name="l11"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,dx,dy,dx2,dy2;
|
|
<a name="l12"></a> </span><span class=cF1>Bool</span><span class=cF0> dead,missile,pad[6];
|
|
<a name="l13"></a>} b[B_NUM];
|
|
<a name="l14"></a></span><span class=cF9>I64</span><span class=cF0> bullets_fired,missile_bmp;
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF9>I64</span><span class=cF0> x,y,dx,dy,finish_line;
|
|
<a name="l17"></a></span><span class=cF1>F64</span><span class=cF0> theta,t0,tf,snd_timeout;
|
|
<a name="l18"></a>
|
|
<a name="l19"></a>#</span><span class=cF1>define</span><span class=cF0> PHASES_GROUPS 8
|
|
<a name="l20"></a>#</span><span class=cF1>define</span><span class=cF0> HACK_DIST 5
|
|
<a name="l21"></a>
|
|
<a name="l22"></a>#</span><span class=cF1>define</span><span class=cF0> U_ENEMY_NUM (PHASES_GROUPS*64)
|
|
<a name="l23"></a>#</span><span class=cF1>define</span><span class=cF0> U_FRIENDLY_NUM (PHASES_GROUPS*16)
|
|
<a name="l24"></a>#</span><span class=cF1>define</span><span class=cF0> U_NUM (U_FRIENDLY_NUM+U_ENEMY_NUM)
|
|
<a name="l25"></a></span><span class=cF1>class</span><span class=cF0> Unit
|
|
<a name="l26"></a>{
|
|
<a name="l27"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,best_dd;
|
|
<a name="l28"></a> </span><span class=cF1>F64</span><span class=cF0> theta,phase;
|
|
<a name="l29"></a> </span><span class=cF1>Bool</span><span class=cF0> friendly,dead,tank,CIA,pad[4];
|
|
<a name="l30"></a>} u[U_NUM];
|
|
<a name="l31"></a>
|
|
<a name="l32"></a>#</span><span class=cF1>define</span><span class=cF0> ET_MAN 0
|
|
<a name="l33"></a>#</span><span class=cF1>define</span><span class=cF0> ET_TANK 1
|
|
<a name="l34"></a>#</span><span class=cF1>define</span><span class=cF0> ET_MISSILE 2
|
|
<a name="l35"></a>#</span><span class=cF1>define</span><span class=cF0> ET_BUILDING 3
|
|
<a name="l36"></a>#</span><span class=cF1>define</span><span class=cF0> E_NUM 512
|
|
<a name="l37"></a></span><span class=cF1>class</span><span class=cF0> Explosion
|
|
<a name="l38"></a>{
|
|
<a name="l39"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,num,type;
|
|
<a name="l40"></a> </span><span class=cF1>F64</span><span class=cF0> t0,tf;
|
|
<a name="l41"></a> </span><span class=cF1>Bool</span><span class=cF0> dead,pad[7];
|
|
<a name="l42"></a>} e[E_NUM];
|
|
<a name="l43"></a>
|
|
<a name="l44"></a></span><span class=cF9>I64</span><span class=cF0> total_score,friendly_fire,enemy_by_friendly,friendly_left,enemy_left,
|
|
<a name="l45"></a> main_loop_pass;
|
|
<a name="l46"></a></span><span class=cF1>Bool</span><span class=cF0> game_over;
|
|
<a name="l47"></a></span><span class=cE0>
|
|
<a name="l48"></a>
|
|
<a name="l49"></a>
|
|
<a name="l50"></a>
|
|
<a name="l51"></a>
|
|
<a name="l52"></a> </span><span class=cEA><1>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l53"></a>
|
|
<a name="l54"></a>
|
|
<a name="l55"></a>
|
|
<a name="l56"></a>
|
|
<a name="l57"></a>
|
|
<a name="l58"></a> </span><span class=cEA><2>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l59"></a>
|
|
<a name="l60"></a> </span><span class=cEA><3>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l61"></a>
|
|
<a name="l62"></a>
|
|
<a name="l63"></a>
|
|
<a name="l64"></a>
|
|
<a name="l65"></a> </span><span class=cEA><4>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l66"></a>
|
|
<a name="l67"></a>
|
|
<a name="l68"></a>
|
|
<a name="l69"></a> </span><span class=cEA><5>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l70"></a>
|
|
<a name="l71"></a>
|
|
<a name="l72"></a>
|
|
<a name="l73"></a> </span><span class=cEA><6>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l74"></a>
|
|
<a name="l75"></a>
|
|
<a name="l76"></a>
|
|
<a name="l77"></a></span><span class=cE1>U8</span><span class=cE0> *friendly_imgs[4]={</span><span class=cEA><5></span><span class=cE0>,</span><span class=cEA><4></span><span class=cE0>,</span><span class=cEA><5></span><span class=cE0>,</span><span class=cEA><6></span><span class=cE0>};
|
|
<a name="l78"></a>
|
|
<a name="l79"></a>
|
|
<a name="l80"></a>
|
|
<a name="l81"></a>
|
|
<a name="l82"></a> </span><span class=cEA><7>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l83"></a>
|
|
<a name="l84"></a>
|
|
<a name="l85"></a>
|
|
<a name="l86"></a> </span><span class=cEA><8>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l87"></a>
|
|
<a name="l88"></a>
|
|
<a name="l89"></a>
|
|
<a name="l90"></a> </span><span class=cEA><9>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l91"></a>
|
|
<a name="l92"></a>
|
|
<a name="l93"></a>
|
|
<a name="l94"></a></span><span class=cE1>U8</span><span class=cE0> *CIA_neeger_imgs[4]={</span><span class=cEA><8></span><span class=cE0>,</span><span class=cEA><7></span><span class=cE0>,</span><span class=cEA><8></span><span class=cE0>,</span><span class=cEA><9></span><span class=cE0>};
|
|
<a name="l95"></a>
|
|
<a name="l96"></a>
|
|
<a name="l97"></a>
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> </span><span class=cEA><10>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l100"></a>
|
|
<a name="l101"></a>
|
|
<a name="l102"></a>
|
|
<a name="l103"></a>
|
|
<a name="l104"></a> </span><span class=cEA><11>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l105"></a>
|
|
<a name="l106"></a>
|
|
<a name="l107"></a>
|
|
<a name="l108"></a>
|
|
<a name="l109"></a> </span><span class=cEA><12>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l110"></a>
|
|
<a name="l111"></a>
|
|
<a name="l112"></a>
|
|
<a name="l113"></a>
|
|
<a name="l114"></a></span><span class=cE1>U8</span><span class=cE0> *friendly_hacking_imgs[4]={</span><span class=cEA><10></span><span class=cE0>,</span><span class=cEA><11></span><span class=cE0>,</span><span class=cEA><10></span><span class=cE0>,</span><span class=cEA><12></span><span class=cE0>};
|
|
<a name="l115"></a>
|
|
<a name="l116"></a>
|
|
<a name="l117"></a>
|
|
<a name="l118"></a>
|
|
<a name="l119"></a> </span><span class=cEA><13>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l120"></a>
|
|
<a name="l121"></a>
|
|
<a name="l122"></a>
|
|
<a name="l123"></a> </span><span class=cEA><14>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l124"></a>
|
|
<a name="l125"></a>
|
|
<a name="l126"></a>
|
|
<a name="l127"></a> </span><span class=cEA><15>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l128"></a>
|
|
<a name="l129"></a>
|
|
<a name="l130"></a>
|
|
<a name="l131"></a></span><span class=cE1>U8</span><span class=cE0> *enemy_imgs[4]={</span><span class=cEA><14></span><span class=cE0>,</span><span class=cEA><13></span><span class=cE0>,</span><span class=cEA><14></span><span class=cE0>,</span><span class=cEA><15></span><span class=cE0>};
|
|
<a name="l132"></a>
|
|
<a name="l133"></a>
|
|
<a name="l134"></a>
|
|
<a name="l135"></a>
|
|
<a name="l136"></a> </span><span class=cEA><16>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l137"></a>
|
|
<a name="l138"></a>
|
|
<a name="l139"></a>
|
|
<a name="l140"></a>
|
|
<a name="l141"></a> </span><span class=cEA><17>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l142"></a>
|
|
<a name="l143"></a>
|
|
<a name="l144"></a>
|
|
<a name="l145"></a>
|
|
<a name="l146"></a> </span><span class=cEA><18>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l147"></a>
|
|
<a name="l148"></a>
|
|
<a name="l149"></a>
|
|
<a name="l150"></a>
|
|
<a name="l151"></a>
|
|
<a name="l152"></a>
|
|
<a name="l153"></a>
|
|
<a name="l154"></a>
|
|
<a name="l155"></a>
|
|
<a name="l156"></a>
|
|
<a name="l157"></a>
|
|
<a name="l158"></a> </span><span class=cEA><19>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l159"></a>
|
|
<a name="l160"></a>
|
|
<a name="l161"></a>
|
|
<a name="l162"></a>
|
|
<a name="l163"></a>
|
|
<a name="l164"></a>
|
|
<a name="l165"></a>
|
|
<a name="l166"></a>
|
|
<a name="l167"></a>
|
|
<a name="l168"></a></span><span class=cE1>U8</span><span class=cE0> *enemy_hacking_imgs[4]={</span><span class=cEA><17></span><span class=cE0>,</span><span class=cEA><16></span><span class=cE0>,</span><span class=cEA><17></span><span class=cE0>,</span><span class=cEA><18></span><span class=cE0>};
|
|
<a name="l169"></a>
|
|
<a name="l170"></a>
|
|
<a name="l171"></a>
|
|
<a name="l172"></a>
|
|
<a name="l173"></a>
|
|
<a name="l174"></a>
|
|
<a name="l175"></a>
|
|
<a name="l176"></a> </span><span class=cEA><20>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l177"></a>
|
|
<a name="l178"></a>
|
|
<a name="l179"></a>
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cEA><21>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l182"></a>
|
|
<a name="l183"></a>
|
|
<a name="l184"></a>
|
|
<a name="l185"></a>
|
|
<a name="l186"></a>
|
|
<a name="l187"></a>
|
|
<a name="l188"></a>
|
|
<a name="l189"></a>
|
|
<a name="l190"></a> </span><span class=cEA><22>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l191"></a>
|
|
<a name="l192"></a>
|
|
<a name="l193"></a>
|
|
<a name="l194"></a>
|
|
<a name="l195"></a> </span><span class=cEA><23>/* Graphics Not Rendered in HTML */</span><span class=cE0>
|
|
<a name="l196"></a>
|
|
<a name="l197"></a>
|
|
<a name="l198"></a>
|
|
<a name="l199"></a>
|
|
<a name="l200"></a></span><span class=cF0>
|
|
<a name="l201"></a>#</span><span class=cF1>define</span><span class=cF0> LS_APTS_NUM 20
|
|
<a name="l202"></a>#</span><span class=cF1>define</span><span class=cF0> LS_MOUNTAINS_NUM 3
|
|
<a name="l203"></a>#</span><span class=cF1>define</span><span class=cF0> LS_NUM 128
|
|
<a name="l204"></a></span><span class=cF1>class</span><span class=cF0> LandScapeItem
|
|
<a name="l205"></a>{
|
|
<a name="l206"></a> </span><span class=cF9>I64</span><span class=cF0> x,y;
|
|
<a name="l207"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l208"></a>} ls[LS_NUM];
|
|
<a name="l209"></a>
|
|
<a name="l210"></a>#</span><span class=cF1>define</span><span class=cF0> LS_TYPES 4
|
|
<a name="l211"></a></span><span class=cF1>U8</span><span class=cF0> *landscape_imgs[LS_TYPES]=
|
|
<a name="l212"></a> {</span><span class=cFA><20></span><span class=cF0>,</span><span class=cFA><21></span><span class=cF0>,</span><span class=cFA><22></span><span class=cF0>,</span><span class=cFA><23></span><span class=cF0>};
|
|
<a name="l213"></a>
|
|
<a name="l214"></a></span><span class=cF1>U0</span><span class=cF0> ExplosionDraw(</span><span class=cF9>CDC</span><span class=cF0> *dc,Explosion *tmpe,</span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l215"></a>{
|
|
<a name="l216"></a> </span><span class=cF9>I64</span><span class=cF0> i,n1,n2,n3,n4,n5;
|
|
<a name="l217"></a> </span><span class=cF1>F64</span><span class=cF0> t=(</span><span class=cF5>tS</span><span class=cF0>-tmpe->t0)/(tmpe->tf-tmpe->t0);
|
|
<a name="l218"></a> </span><span class=cF5>Seed</span><span class=cF0>(tmpe->num+1);
|
|
<a name="l219"></a>
|
|
<a name="l220"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpe->type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l221"></a> </span><span class=cF1>case</span><span class=cF0> ET_MAN: n1=8; n2=0; n3=0; n4=18; n5=28; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l222"></a> </span><span class=cF1>case</span><span class=cF0> ET_TANK: n1=64; n2=14; n3=24; n4=60; n5=90; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l223"></a> </span><span class=cF1>case</span><span class=cF0> ET_MISSILE: n1=128; n2=30; n3=60; n4=100; n5=200; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF1>case</span><span class=cF0> ET_BUILDING: n1=128; n2=80; n3=80; n4=200; n5=300; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l225"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l226"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<n1;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (i&2)
|
|
<a name="l228"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpe->type) {
|
|
<a name="l229"></a> </span><span class=cF1>case</span><span class=cF0> ET_MAN:
|
|
<a name="l230"></a> </span><span class=cF1>if</span><span class=cF0> (i&1)
|
|
<a name="l231"></a> dc->color=</span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l232"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l233"></a> dc->color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l234"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>case</span><span class=cF0> ET_MISSILE:
|
|
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (i&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (i&4)
|
|
<a name="l238"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l240"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l242"></a> dc->color=</span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l243"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l244"></a> </span><span class=cF1>case</span><span class=cF0> ET_TANK:
|
|
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (i&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (i&4)
|
|
<a name="l247"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l248"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l249"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l251"></a> dc->color=</span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l252"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l253"></a> </span><span class=cF1>case</span><span class=cF0> ET_BUILDING:
|
|
<a name="l254"></a> </span><span class=cF1>if</span><span class=cF0> (i&1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF1>if</span><span class=cF0> (i&4)
|
|
<a name="l256"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l257"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l258"></a> dc->color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l259"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l260"></a> dc->color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l261"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l262"></a> }
|
|
<a name="l263"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i&1)
|
|
<a name="l264"></a> dc->color=</span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l265"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l266"></a> dc->color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l267"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,tmpe->x+n2*</span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0>-.5</span><span class=cF7>)</span><span class=cF0>,y+n3/2*</span><span class=cF5>Rand</span><span class=cF0>,
|
|
<a name="l268"></a> tmpe->x+n4*t*</span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0>-.5</span><span class=cF7>)</span><span class=cF0>,y-n5/2*t*</span><span class=cF5>Rand</span><span class=cF0>);
|
|
<a name="l269"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l270"></a>}
|
|
<a name="l271"></a>
|
|
<a name="l272"></a></span><span class=cF9>I64</span><span class=cF0> mp_not_done_flags;
|
|
<a name="l273"></a></span><span class=cF1>U0</span><span class=cF0> MPMenDraw(</span><span class=cF9>CDC</span><span class=cF0> *dc2)
|
|
<a name="l274"></a>{
|
|
<a name="l275"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=dc2->win_task;
|
|
<a name="l276"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>(dc2,task);
|
|
<a name="l277"></a> </span><span class=cF9>I64</span><span class=cF0> i,r[16],lo=</span><span class=cF5>Gs</span><span class=cF0>->num*U_NUM/</span><span class=cFB>mp_cnt</span><span class=cF0>,hi=(</span><span class=cF5>Gs</span><span class=cF0>->num+1)*U_NUM/</span><span class=cFB>mp_cnt</span><span class=cF0>,
|
|
<a name="l278"></a> yy,phase,scroll_y=MAP_HEIGHT-100-100*(</span><span class=cF5>tS</span><span class=cF0>-t0);
|
|
<a name="l279"></a> Unit *tmpu;
|
|
<a name="l280"></a> Explosion *tmpe;
|
|
<a name="l281"></a> </span><span class=cF1>U8</span><span class=cF0> *tmps,**_tmps;
|
|
<a name="l282"></a> </span><span class=cF1>F64</span><span class=cF0> tt,ts=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l283"></a>
|
|
<a name="l284"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF5>Gs</span><span class=cF0>->num;i<E_NUM;i+=</span><span class=cFB>mp_cnt</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l285"></a> tmpe=&e[i];
|
|
<a name="l286"></a> yy=(tmpe->y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (-32<=yy<=task->pix_bottom+32 && !tmpe->dead) {
|
|
<a name="l288"></a> ExplosionDraw(dc,tmpe,yy);
|
|
<a name="l289"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>>tmpe->tf)
|
|
<a name="l290"></a> tmpe->dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l291"></a> }
|
|
<a name="l292"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l293"></a> </span><span class=cF1>for</span><span class=cF0> (i=lo;i<hi;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l294"></a> tmpu=&u[i];
|
|
<a name="l295"></a> yy=(tmpu->y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (-32<=yy<=task->pix_bottom+32) {
|
|
<a name="l297"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpu->dead) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l298"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(r);
|
|
<a name="l299"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(r,tmpu->theta);
|
|
<a name="l300"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(r,</span><span class=cF3>pi</span><span class=cF0>/6);
|
|
<a name="l301"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(r,0.3);
|
|
<a name="l302"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->tank)
|
|
<a name="l303"></a> </span><span class=cF5>Sprite3Mat4x4B</span><span class=cF0>(dc,tmpu->x,yy,</span><span class=cF3>GR_Z_ALL</span><span class=cF0>,</span><span class=cFA><19></span><span class=cF0>,r);
|
|
<a name="l304"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->best_dd<</span><span class=cF7>(</span><span class=cF0>2*HACK_DIST</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF7>(</span><span class=cF0>2*HACK_DIST</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF2>//It's neat so times 2</span><span class=cF0>
|
|
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->friendly)
|
|
<a name="l307"></a> _tmps=friendly_hacking_imgs;
|
|
<a name="l308"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l309"></a> _tmps=enemy_hacking_imgs;
|
|
<a name="l310"></a> tt=4*</span><span class=cF5>Wrap</span><span class=cF0>(tmpu->phase+20*ts,0)/(2*</span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l311"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->friendly) {
|
|
<a name="l313"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->CIA && </span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l314"></a> _tmps=CIA_neeger_imgs;
|
|
<a name="l315"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l316"></a> _tmps=friendly_imgs;
|
|
<a name="l317"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l318"></a> _tmps=enemy_imgs;
|
|
<a name="l319"></a> tt=4*</span><span class=cF5>Wrap</span><span class=cF0>(tmpu->phase+5*ts,0)/(2*</span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l320"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l321"></a> phase=tt; tt%=1.0;
|
|
<a name="l322"></a> tmps=</span><span class=cF5>SpriteInterpolate</span><span class=cF0>(tt,_tmps[phase&3],_tmps[</span><span class=cF7>(</span><span class=cF0>phase+1</span><span class=cF7>)</span><span class=cF0>&3]);
|
|
<a name="l323"></a> </span><span class=cF5>Sprite3Mat4x4B</span><span class=cF0>(dc,tmpu->x,yy,</span><span class=cF3>GR_Z_ALL</span><span class=cF0>,tmps,r);
|
|
<a name="l324"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l325"></a> }
|
|
<a name="l326"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l327"></a> }
|
|
<a name="l328"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l329"></a>
|
|
<a name="l330"></a> dc->depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l331"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l332"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&mp_not_done_flags,</span><span class=cF5>Gs</span><span class=cF0>->num);
|
|
<a name="l333"></a> </span><span class=cF5>Seed</span><span class=cF0>; </span><span class=cF2>//Return Seth task to timer-based.</span><span class=cF0>
|
|
<a name="l334"></a>}
|
|
<a name="l335"></a>
|
|
<a name="l336"></a></span><span class=cF1>U0</span><span class=cF0> MissilePos(</span><span class=cF9>I64</span><span class=cF0> m,</span><span class=cF1>F64</span><span class=cF0> theta,</span><span class=cF9>I64</span><span class=cF0> *_x,</span><span class=cF9>I64</span><span class=cF0> *_y)
|
|
<a name="l337"></a>{
|
|
<a name="l338"></a> </span><span class=cF9>I64</span><span class=cF0> n;
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (m<2)
|
|
<a name="l340"></a> n=-1;
|
|
<a name="l341"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l342"></a> n=1;
|
|
<a name="l343"></a> *_x=x+3.0*</span><span class=cF5>Cos</span><span class=cF0>(theta)-(15.0-</span><span class=cF7>(</span><span class=cF0>m&1</span><span class=cF7>)</span><span class=cF0><<3)*</span><span class=cF5>Cos</span><span class=cF0>(theta-n*</span><span class=cF3>pi</span><span class=cF0>/2);
|
|
<a name="l344"></a> *_y=y+3.0*</span><span class=cF5>Sin</span><span class=cF0>(theta)-(15.0-</span><span class=cF7>(</span><span class=cF0>m&1</span><span class=cF7>)</span><span class=cF0><<3)*</span><span class=cF5>Sin</span><span class=cF0>(theta-n*</span><span class=cF3>pi</span><span class=cF0>/2);
|
|
<a name="l345"></a>}
|
|
<a name="l346"></a>
|
|
<a name="l347"></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="l348"></a>{
|
|
<a name="l349"></a> </span><span class=cF9>I64</span><span class=cF0> i,m,xx,yy,scroll_y=MAP_HEIGHT-100-100*(</span><span class=cF5>tS</span><span class=cF0>-t0);
|
|
<a name="l350"></a> </span><span class=cF1>F64</span><span class=cF0> tt,ts=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l351"></a> Bullet *tmpb;
|
|
<a name="l352"></a>
|
|
<a name="l353"></a> dc->color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>|</span><span class=cF3>BROWN</span><span class=cF0><<16|</span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l354"></a> </span><span class=cF5>GrRect3</span><span class=cF0>(dc,0,0,0,dc->width,dc->height);
|
|
<a name="l355"></a>
|
|
<a name="l356"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l357"></a> yy=(ls[i].y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (-32<=yy<=task->pix_bottom+32)
|
|
<a name="l359"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,ls[i].x,yy,0,ls[i].img);
|
|
<a name="l360"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l361"></a>
|
|
<a name="l362"></a> dc->thick=3;
|
|
<a name="l363"></a> dc->color=</span><span class=cF3>BROWN</span><span class=cF0>;
|
|
<a name="l364"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc,0, </span><span class=cF7>(</span><span class=cF0>finish_line-scroll_y</span><span class=cF7>)</span><span class=cF0>&</span><span class=cF7>(</span><span class=cF0>MAP_HEIGHT-1</span><span class=cF7>)</span><span class=cF0>,0,
|
|
<a name="l365"></a> </span><span class=cF3>GR_WIDTH</span><span class=cF0>,</span><span class=cF7>(</span><span class=cF0>finish_line-scroll_y</span><span class=cF7>)</span><span class=cF0>&</span><span class=cF7>(</span><span class=cF0>MAP_HEIGHT-1</span><span class=cF7>)</span><span class=cF0>,0);
|
|
<a name="l366"></a>
|
|
<a name="l367"></a> dc->color=</span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l368"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpb=b;i<B_NUM;i++,tmpb++)
|
|
<a name="l369"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpb->dead) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb->missile)
|
|
<a name="l371"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,tmpb->x>>32,tmpb->y>>32,0,</span><span class=cFA><2></span><span class=cF0>,</span><span class=cF3>pi</span><span class=cF0>/2+</span><span class=cF5>Arg</span><span class=cF7>(</span><span class=cF0>tmpb->dx,tmpb->dy</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l372"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l373"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,tmpb->x>>32,tmpb->y>>32,
|
|
<a name="l374"></a> </span><span class=cF7>(</span><span class=cF0>tmpb->x+tmpb->dy*B_LEN</span><span class=cF7>)</span><span class=cF0>>>32,
|
|
<a name="l375"></a> </span><span class=cF7>(</span><span class=cF0>tmpb->y+tmpb->dx*B_LEN</span><span class=cF7>)</span><span class=cF0>>>32);
|
|
<a name="l376"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l377"></a>
|
|
<a name="l378"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
|
<a name="l379"></a> mp_not_done_flags=1<<</span><span class=cFB>mp_cnt</span><span class=cF0>-1;
|
|
<a name="l380"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cFB>mp_cnt</span><span class=cF0>;i++)
|
|
<a name="l381"></a> </span><span class=cF5>JobQue</span><span class=cF0>(&MPMenDraw,dc,i);
|
|
<a name="l382"></a> </span><span class=cF1>while</span><span class=cF0> (mp_not_done_flags)
|
|
<a name="l383"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l384"></a> </span><span class=cF5>Free</span><span class=cF0>(dc->depth_buf);
|
|
<a name="l385"></a> dc->depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l386"></a>
|
|
<a name="l387"></a> </span><span class=cF1>for</span><span class=cF0> (m=0;m<4;m++)
|
|
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&missile_bmp,m</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l389"></a> MissilePos(m,theta,&xx,&yy);
|
|
<a name="l390"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,xx,yy,0,</span><span class=cFA><3></span><span class=cF0>,theta);
|
|
<a name="l391"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l392"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc,x,y,0,</span><span class=cFA><1></span><span class=cF0>,theta);
|
|
<a name="l393"></a>
|
|
<a name="l394"></a> </span><span class=cF1>if</span><span class=cF0> (tf) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l395"></a> tt=tf;
|
|
<a name="l396"></a> dc->color=</span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l397"></a> </span><span class=cF1>if</span><span class=cF0> (game_over && </span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l398"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,task->pix_width/2-9*</span><span class=cF3>FONT_WIDTH</span><span class=cF0>/2,task->pix_height/2,
|
|
<a name="l399"></a> </span><span class=cF6>"Game Over"</span><span class=cF0>);
|
|
<a name="l400"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l401"></a> tt=ts;
|
|
<a name="l402"></a> </span><span class=cF1>if</span><span class=cF0> (!enemy_left || !friendly_left)
|
|
<a name="l403"></a> game_over=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l404"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l405"></a> dc->color=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l406"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>"Enemy:%d Friends:%d Friendly Fire:%d Time:%6.2f Bullets:%d"</span><span class=cF0>,
|
|
<a name="l407"></a> enemy_left,friendly_left,friendly_fire,tt-t0,bullets_fired);
|
|
<a name="l408"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,8,</span><span class=cF6>"Total Score:%,d High Score:%,d"</span><span class=cF0>,
|
|
<a name="l409"></a> total_score,best_score);
|
|
<a name="l410"></a>}
|
|
<a name="l411"></a>
|
|
<a name="l412"></a>Explosion *ExplosionNew(</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l413"></a>{
|
|
<a name="l414"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l415"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<E_NUM;i++)
|
|
<a name="l416"></a> </span><span class=cF1>if</span><span class=cF0> (e[i].dead) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l417"></a> e[i].x=x;
|
|
<a name="l418"></a> e[i].y=y;
|
|
<a name="l419"></a> e[i].dead=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l420"></a> </span><span class=cF1>return</span><span class=cF0> &e[i];
|
|
<a name="l421"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l422"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l423"></a>}
|
|
<a name="l424"></a>
|
|
<a name="l425"></a></span><span class=cF1>U0</span><span class=cF0> ManDie(Unit *tmpu,</span><span class=cF1>Bool</span><span class=cF0> by_human)
|
|
<a name="l426"></a>{
|
|
<a name="l427"></a> Explosion *tmpe;
|
|
<a name="l428"></a>
|
|
<a name="l429"></a> tmpu->dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (by_human) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l431"></a> </span><span class=cF1>if</span><span class=cF0> (tmpe=ExplosionNew</span><span class=cF7>(</span><span class=cF0>tmpu->x,tmpu->y</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l432"></a> tmpe->t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l433"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->tank) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l434"></a> tmpe->type=ET_TANK;
|
|
<a name="l435"></a> tmpe->tf=tmpe->t0+0.40;
|
|
<a name="l436"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l437"></a> tmpe->type=ET_MAN;
|
|
<a name="l438"></a> tmpe->tf=tmpe->t0+0.20;
|
|
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l440"></a> }
|
|
<a name="l441"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l442"></a>
|
|
<a name="l443"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->friendly) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l444"></a> friendly_left--;
|
|
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (by_human)
|
|
<a name="l446"></a> friendly_fire++;
|
|
<a name="l447"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l448"></a> enemy_left--;
|
|
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (!by_human)
|
|
<a name="l450"></a> enemy_by_friendly++;
|
|
<a name="l451"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l452"></a> </span><span class=cF1>if</span><span class=cF0> (by_human && !snd_timeout) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l453"></a> snd_timeout=</span><span class=cF5>tS</span><span class=cF0>+0.01;
|
|
<a name="l454"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->friendly)
|
|
<a name="l455"></a> </span><span class=cF5>Snd</span><span class=cF0>(46);
|
|
<a name="l456"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l457"></a> </span><span class=cF5>Snd</span><span class=cF0>(22);
|
|
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l459"></a>}
|
|
<a name="l460"></a>
|
|
<a name="l461"></a></span><span class=cF1>U0</span><span class=cF0> ExplosionDo(</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> scroll_y)
|
|
<a name="l462"></a>{
|
|
<a name="l463"></a> </span><span class=cF9>I64</span><span class=cF0> i,x2,y2;
|
|
<a name="l464"></a> Explosion *tmpe;
|
|
<a name="l465"></a> Unit *tmpu;
|
|
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (tmpe=ExplosionNew</span><span class=cF7>(</span><span class=cF0>x,y+scroll_y</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l467"></a> tmpe->t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l468"></a> tmpe->type=ET_MISSILE;
|
|
<a name="l469"></a> tmpe->tf=tmpe->t0+1.0;
|
|
<a name="l470"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l471"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpu=u;i<U_NUM;i++,tmpu++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpu->dead) {
|
|
<a name="l473"></a> x2=tmpu->x;
|
|
<a name="l474"></a> y2=(tmpu->y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l475"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x-x2</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y-y2</span><span class=cF7>)</span><span class=cF0><100*100)
|
|
<a name="l476"></a> ManDie(tmpu,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l477"></a> }
|
|
<a name="l478"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l479"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LS_APTS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l480"></a> x2=ls[i].x;
|
|
<a name="l481"></a> y2=(ls[i].y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x-x2</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y-y2</span><span class=cF7>)</span><span class=cF0><100*100) {
|
|
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (tmpe=ExplosionNew</span><span class=cF7>(</span><span class=cF0>x2,y2+scroll_y</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l484"></a> tmpe->t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l485"></a> tmpe->type=ET_BUILDING;
|
|
<a name="l486"></a> tmpe->tf=tmpe->t0+2.0;
|
|
<a name="l487"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l488"></a> }
|
|
<a name="l489"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l490"></a>}
|
|
<a name="l491"></a>
|
|
<a name="l492"></a></span><span class=cF1>U0</span><span class=cF0> CheckCollisions()
|
|
<a name="l493"></a>{
|
|
<a name="l494"></a> </span><span class=cF9>I64</span><span class=cF0> i,n1,x,y,scroll_y=MAP_HEIGHT-100-100*(</span><span class=cF5>tS</span><span class=cF0>-t0);
|
|
<a name="l495"></a> Unit *tmpu;
|
|
<a name="l496"></a> Bullet *tmpb;
|
|
<a name="l497"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc2=</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="l498"></a> dc2->color=</span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l499"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpb=b;i<B_NUM;i++,tmpb++)
|
|
<a name="l500"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpb->dead && !tmpb->missile) </span><span class=cF2>//Bullets not missiles</span><span class=cF0>
|
|
<a name="l501"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc2,tmpb->x>>32,tmpb->y>>32,
|
|
<a name="l502"></a> </span><span class=cF7>(</span><span class=cF0>tmpb->x+tmpb->dx*B_LEN</span><span class=cF7>)</span><span class=cF0>>>32,
|
|
<a name="l503"></a> </span><span class=cF7>(</span><span class=cF0>tmpb->y+tmpb->dy*B_LEN</span><span class=cF7>)</span><span class=cF0>>>32);
|
|
<a name="l504"></a>
|
|
<a name="l505"></a> dc2->color =</span><span class=cF3>ROP_COLLISION</span><span class=cF0>;
|
|
<a name="l506"></a> dc2->bkcolor=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l507"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpu=u;i<U_NUM;i++,tmpu++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l508"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpu->dead) {
|
|
<a name="l509"></a> x=tmpu->x;
|
|
<a name="l510"></a> y=(tmpu->y-scroll_y)&(MAP_HEIGHT-1);
|
|
<a name="l511"></a> </span><span class=cF1>if</span><span class=cF0> (0<=x<</span><span class=cF3>GR_WIDTH</span><span class=cF0> && 0<=y<</span><span class=cF3>GR_HEIGHT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l512"></a> dc2->collision_cnt=0;
|
|
<a name="l513"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc2,x-3,y-9,6,8);
|
|
<a name="l514"></a> </span><span class=cF1>if</span><span class=cF0> (dc2->collision_cnt)
|
|
<a name="l515"></a> ManDie(tmpu,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l516"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l517"></a> }
|
|
<a name="l518"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l519"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc2);
|
|
<a name="l520"></a>
|
|
<a name="l521"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpb=b;i<B_NUM;i++,tmpb++)
|
|
<a name="l522"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpb->dead && tmpb->missile) </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//Missiles not bullets</span><span class=cF0>
|
|
<a name="l523"></a> x=tmpb->x>>32;
|
|
<a name="l524"></a> y=tmpb->y>>32;
|
|
<a name="l525"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpu=u;i<U_NUM;i++,tmpu++) {
|
|
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->tank)
|
|
<a name="l527"></a> n1=16;
|
|
<a name="l528"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l529"></a> n1=6;
|
|
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpu->dead && </span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>x-tmpu->x-n1</span><span class=cF7>)</span><span class=cF0>+
|
|
<a name="l531"></a> </span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>y-(tmpu->y-scroll_y)&(MAP_HEIGHT-1)+n1</span><span class=cF7>)</span><span class=cF0><n1<<1) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l532"></a> tmpb->dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l533"></a> ExplosionDo(x,y,scroll_y);
|
|
<a name="l534"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l535"></a> }
|
|
<a name="l536"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpb->dead)
|
|
<a name="l537"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LS_APTS_NUM;i++)
|
|
<a name="l538"></a> </span><span class=cF1>if</span><span class=cF0> (2*</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>x-ls[i].x</span><span class=cF7>)</span><span class=cF0>+
|
|
<a name="l539"></a> 3*</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>y+35-(ls[i].y-scroll_y)&(MAP_HEIGHT-1)</span><span class=cF7>)</span><span class=cF0><2*60*60) {
|
|
<a name="l540"></a> tmpb->dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l541"></a> ExplosionDo(x,y,scroll_y);
|
|
<a name="l542"></a> }
|
|
<a name="l543"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l544"></a>}
|
|
<a name="l545"></a>
|
|
<a name="l546"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l547"></a>{
|
|
<a name="l548"></a> </span><span class=cF9>I64</span><span class=cF0> i,xx,yy,scroll_y=MAP_HEIGHT-100;
|
|
<a name="l549"></a> Unit *tmpu;
|
|
<a name="l550"></a>
|
|
<a name="l551"></a> snd_timeout=0;
|
|
<a name="l552"></a> </span><span class=cF5>Snd</span><span class=cF0>;
|
|
<a name="l553"></a>
|
|
<a name="l554"></a> total_score=0;
|
|
<a name="l555"></a> game_over=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l556"></a> main_loop_pass=0;
|
|
<a name="l557"></a>
|
|
<a name="l558"></a> x=</span><span class=cF5>Fs</span><span class=cF0>->pix_width>>1;
|
|
<a name="l559"></a> y=0.9*</span><span class=cF5>Fs</span><span class=cF0>->pix_height;
|
|
<a name="l560"></a> finish_line=scroll_y+y;
|
|
<a name="l561"></a> dx=0;
|
|
<a name="l562"></a> dy=0;
|
|
<a name="l563"></a> theta=-</span><span class=cF3>pi</span><span class=cF0>/2;
|
|
<a name="l564"></a>
|
|
<a name="l565"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l566"></a> ls[i].x=(</span><span class=cF5>Fs</span><span class=cF0>->pix_width-100)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>+50;
|
|
<a name="l567"></a> ls[i].y=(MAP_HEIGHT-100)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>+50;
|
|
<a name="l568"></a> ls[i].img=landscape_imgs[</span><span class=cF5>RandU16</span><span class=cF0>%(LS_TYPES-2)];
|
|
<a name="l569"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l570"></a>
|
|
<a name="l571"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<LS_APTS_NUM;i++)
|
|
<a name="l572"></a> ls[i].img=landscape_imgs[LS_TYPES-1]; </span><span class=cF2>//Apartment</span><span class=cF0>
|
|
<a name="l573"></a>
|
|
<a name="l574"></a> </span><span class=cF1>for</span><span class=cF0> (;i<LS_APTS_NUM+LS_MOUNTAINS_NUM;i++)
|
|
<a name="l575"></a> ls[i].img=landscape_imgs[LS_TYPES-2]; </span><span class=cF2>//mountain</span><span class=cF0>
|
|
<a name="l576"></a>
|
|
<a name="l577"></a> </span><span class=cF5>MemSet</span><span class=cF0>(u,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>u</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l578"></a> </span><span class=cF1>for</span><span class=cF0> (i=0,tmpu=u;i<U_NUM;i++,tmpu++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l579"></a> </span><span class=cF1>if</span><span class=cF0> (i<U_FRIENDLY_NUM) {
|
|
<a name="l580"></a> tmpu->friendly=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i&7</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l582"></a> xx=(</span><span class=cF5>Fs</span><span class=cF0>->pix_width-200)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>;
|
|
<a name="l583"></a> yy=(MAP_HEIGHT-200)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>;
|
|
<a name="l584"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l585"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i&63</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l586"></a> tmpu->CIA=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l587"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l588"></a> tmpu->CIA
|
|
<a name="l589"></a>
|
|
<a name="l590"></a>
|
|
<a name="l591"></a>
|
|
<a name="l592"></a>
|
|
<a name="l593"></a>
|
|
<a name="l594"></a>
|
|
<a name="l595"></a>=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l596"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l597"></a> tmpu->friendly=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l598"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i&31</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l599"></a> xx=(</span><span class=cF5>Fs</span><span class=cF0>->pix_width-200)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>;
|
|
<a name="l600"></a> yy=(MAP_HEIGHT-200)*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>U32_MAX</span><span class=cF0>;
|
|
<a name="l601"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l602"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i&15</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l603"></a> tmpu->tank=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l604"></a> }
|
|
<a name="l605"></a> tmpu->dead=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l606"></a> tmpu->x=xx+64*</span><span class=cF5>RandI32</span><span class=cF0>/</span><span class=cF3>I32_MAX</span><span class=cF0>+100;
|
|
<a name="l607"></a> tmpu->y=yy+64*</span><span class=cF5>RandU32</span><span class=cF0>/</span><span class=cF3>I32_MAX</span><span class=cF0>-64+100;
|
|
<a name="l608"></a> tmpu->best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l609"></a> tmpu->theta=</span><span class=cF3>pi</span><span class=cF0>/2;
|
|
<a name="l610"></a> tmpu->phase=2*</span><span class=cF3>pi</span><span class=cF0>*</span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l611"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l612"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<B_NUM;i++)
|
|
<a name="l613"></a> b[i].dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l614"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<E_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l615"></a> e[i].dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l616"></a> e[i].num=i;
|
|
<a name="l617"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l618"></a> friendly_left=U_FRIENDLY_NUM;
|
|
<a name="l619"></a> enemy_left =U_ENEMY_NUM;
|
|
<a name="l620"></a> enemy_by_friendly=0;
|
|
<a name="l621"></a> bullets_fired=0;
|
|
<a name="l622"></a> missile_bmp =15;
|
|
<a name="l623"></a> friendly_fire=0;
|
|
<a name="l624"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l625"></a> tf=0;
|
|
<a name="l626"></a>}
|
|
<a name="l627"></a>
|
|
<a name="l628"></a></span><span class=cF1>U0</span><span class=cF0> FireBullet()
|
|
<a name="l629"></a>{
|
|
<a name="l630"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
|
|
<a name="l631"></a> </span><span class=cF1>F64</span><span class=cF0> a;
|
|
<a name="l632"></a> Bullet *tmpb;
|
|
<a name="l633"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<B_NUM-1;i++)
|
|
<a name="l634"></a> </span><span class=cF1>if</span><span class=cF0> (b[i].dead)
|
|
<a name="l635"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l636"></a> tmpb=&b[i];
|
|
<a name="l637"></a>
|
|
<a name="l638"></a> j=x+28.0*</span><span class=cF5>Cos</span><span class=cF0>(theta);
|
|
<a name="l639"></a> tmpb->x=j<<32;
|
|
<a name="l640"></a> j=y+28.0*</span><span class=cF5>Sin</span><span class=cF0>(theta);
|
|
<a name="l641"></a> tmpb->y=j<<32;
|
|
<a name="l642"></a>
|
|
<a name="l643"></a> tmpb->dx2=(B_SPEED*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>+dx)*0x100000000;
|
|
<a name="l644"></a> tmpb->dy2= B_SPEED*</span><span class=cF5>Sin</span><span class=cF0>(theta)*0x100000000;
|
|
<a name="l645"></a> a=</span><span class=cF5>Arg</span><span class=cF0>(tmpb->dx2,tmpb->dy2);
|
|
<a name="l646"></a> tmpb->dx=</span><span class=cF5>Sin</span><span class=cF0>(a)*0x100000000;
|
|
<a name="l647"></a> tmpb->dy=</span><span class=cF5>Cos</span><span class=cF0>(a)*0x100000000;
|
|
<a name="l648"></a> bullets_fired++;
|
|
<a name="l649"></a> tmpb->dead=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l650"></a> tmpb->missile=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l651"></a> </span><span class=cF1>if</span><span class=cF0> (!snd_timeout) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l652"></a> snd_timeout=</span><span class=cF5>tS</span><span class=cF0>+0.0005;
|
|
<a name="l653"></a> </span><span class=cF5>Snd</span><span class=cF0>(74);
|
|
<a name="l654"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l655"></a>}
|
|
<a name="l656"></a>
|
|
<a name="l657"></a></span><span class=cF1>Bool</span><span class=cF0> FireMissile(</span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l658"></a>{
|
|
<a name="l659"></a> </span><span class=cF9>I64</span><span class=cF0> i,m;
|
|
<a name="l660"></a> </span><span class=cF1>F64</span><span class=cF0> a;
|
|
<a name="l661"></a> Bullet *tmpb;
|
|
<a name="l662"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l663"></a>
|
|
<a name="l664"></a> m=n;
|
|
<a name="l665"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&missile_bmp,++m</span><span class=cF7>)</span><span class=cF0> || </span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&missile_bmp,++m</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l666"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l667"></a>
|
|
<a name="l668"></a> </span><span class=cF1>if</span><span class=cF0> (res) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l669"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<B_NUM-1;i++)
|
|
<a name="l670"></a> </span><span class=cF1>if</span><span class=cF0> (b[i].dead)
|
|
<a name="l671"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l672"></a> tmpb=&b[i];
|
|
<a name="l673"></a>
|
|
<a name="l674"></a> MissilePos(m,theta,&tmpb->x,&tmpb->y);
|
|
<a name="l675"></a> tmpb->x<<=32;
|
|
<a name="l676"></a> tmpb->y<<=32;
|
|
<a name="l677"></a>
|
|
<a name="l678"></a> tmpb->dx2=(B_SPEED*</span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>+dx)*0x100000000;
|
|
<a name="l679"></a> tmpb->dy2= B_SPEED*</span><span class=cF5>Sin</span><span class=cF0>(theta)*0x100000000;
|
|
<a name="l680"></a> a=</span><span class=cF5>Arg</span><span class=cF0>(tmpb->dx2,tmpb->dy2);
|
|
<a name="l681"></a> tmpb->dx=</span><span class=cF5>Sin</span><span class=cF0>(a)*0x100000000;
|
|
<a name="l682"></a> tmpb->dy=</span><span class=cF5>Cos</span><span class=cF0>(a)*0x100000000;
|
|
<a name="l683"></a> tmpb->dead=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l684"></a> tmpb->missile=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l685"></a> </span><span class=cF1>if</span><span class=cF0> (!snd_timeout) {
|
|
<a name="l686"></a> snd_timeout=</span><span class=cF5>tS</span><span class=cF0>+0.0005;
|
|
<a name="l687"></a> </span><span class=cF5>Snd</span><span class=cF0>(74);
|
|
<a name="l688"></a> }
|
|
<a name="l689"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l690"></a>}
|
|
<a name="l691"></a>
|
|
<a name="l692"></a></span><span class=cF1>U0</span><span class=cF0> MenMove(</span><span class=cF9>I64</span><span class=cF0> phase_group)
|
|
<a name="l693"></a>{
|
|
<a name="l694"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,dd,best,best_dd;
|
|
<a name="l695"></a> </span><span class=cF1>for</span><span class=cF0> (i=phase_group;i<U_FRIENDLY_NUM;i+=PHASES_GROUPS) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l696"></a> </span><span class=cF1>if</span><span class=cF0> (!u[i].dead) {
|
|
<a name="l697"></a> best=U_FRIENDLY_NUM;
|
|
<a name="l698"></a> best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l699"></a> </span><span class=cF1>for</span><span class=cF0> (j=U_FRIENDLY_NUM;j<U_NUM;j++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l700"></a> </span><span class=cF1>if</span><span class=cF0> (!u[j].dead) {
|
|
<a name="l701"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].x-u[j].x)+</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].y-u[j].y);
|
|
<a name="l702"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best_dd) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l703"></a> best_dd=dd;
|
|
<a name="l704"></a> best=j;
|
|
<a name="l705"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l706"></a> }
|
|
<a name="l707"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l708"></a> u[i].best_dd=best_dd;
|
|
<a name="l709"></a> </span><span class=cF1>if</span><span class=cF0> (best_dd!=</span><span class=cF3>I64_MAX</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l710"></a> u[i].x+=4*</span><span class=cF5>SignI64</span><span class=cF0>(u[best].x-u[i].x);
|
|
<a name="l711"></a> u[i].y+=4*</span><span class=cF5>SignI64</span><span class=cF0>(u[best].y-u[i].y);
|
|
<a name="l712"></a> u[i].theta=</span><span class=cF5>Arg</span><span class=cF0>(u[best].x-u[i].x,u[best].y-u[i].y);
|
|
<a name="l713"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l714"></a> }
|
|
<a name="l715"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l716"></a> </span><span class=cF1>for</span><span class=cF0> (i=U_FRIENDLY_NUM+phase_group;i<U_NUM;i+=PHASES_GROUPS) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l717"></a> </span><span class=cF1>if</span><span class=cF0> (!u[i].dead) {
|
|
<a name="l718"></a> best=0;
|
|
<a name="l719"></a> best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l720"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<U_FRIENDLY_NUM;j++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l721"></a> </span><span class=cF1>if</span><span class=cF0> (!u[j].dead) {
|
|
<a name="l722"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].x-u[j].x)+</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].y-u[j].y);
|
|
<a name="l723"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best_dd) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l724"></a> best_dd=dd;
|
|
<a name="l725"></a> best=j;
|
|
<a name="l726"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l727"></a> }
|
|
<a name="l728"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l729"></a> u[i].best_dd=best_dd;
|
|
<a name="l730"></a> </span><span class=cF1>if</span><span class=cF0> (best_dd!=</span><span class=cF3>I64_MAX</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l731"></a> u[i].x+=4*</span><span class=cF5>SignI64</span><span class=cF0>(u[best].x-u[i].x);
|
|
<a name="l732"></a> u[i].y+=4*</span><span class=cF5>SignI64</span><span class=cF0>(u[best].y-u[i].y);
|
|
<a name="l733"></a> u[i].theta=</span><span class=cF5>Arg</span><span class=cF0>(u[best].x-u[i].x,u[best].y-u[i].y);
|
|
<a name="l734"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l735"></a> }
|
|
<a name="l736"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l737"></a>}
|
|
<a name="l738"></a>
|
|
<a name="l739"></a></span><span class=cF1>U0</span><span class=cF0> MenFight(</span><span class=cF9>I64</span><span class=cF0> phase_group)
|
|
<a name="l740"></a>{
|
|
<a name="l741"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,dd,best,best_dd;
|
|
<a name="l742"></a> </span><span class=cF1>for</span><span class=cF0> (i=phase_group;i<U_FRIENDLY_NUM;i+=PHASES_GROUPS) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l743"></a> </span><span class=cF1>if</span><span class=cF0> (!u[i].dead) {
|
|
<a name="l744"></a> best=U_FRIENDLY_NUM;
|
|
<a name="l745"></a> best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l746"></a> </span><span class=cF1>for</span><span class=cF0> (j=U_FRIENDLY_NUM;j<U_NUM;j++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l747"></a> </span><span class=cF1>if</span><span class=cF0> (!u[j].dead && u[i].y-u[j].y<8) {
|
|
<a name="l748"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].x-u[j].x)+</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].y-u[j].y);
|
|
<a name="l749"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best_dd) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l750"></a> best_dd=dd;
|
|
<a name="l751"></a> best=j;
|
|
<a name="l752"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l753"></a> }
|
|
<a name="l754"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l755"></a> u[i].best_dd=best_dd;
|
|
<a name="l756"></a> </span><span class=cF1>if</span><span class=cF0> (best_dd<HACK_DIST*HACK_DIST && !</span><span class=cF7>(</span><span class=cF5>RandU16</span><span class=cF0>&1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l757"></a> ManDie(&u[best],</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l758"></a> }
|
|
<a name="l759"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l760"></a> </span><span class=cF1>for</span><span class=cF0> (i=U_FRIENDLY_NUM+phase_group;i<U_NUM;i+=PHASES_GROUPS) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l761"></a> </span><span class=cF1>if</span><span class=cF0> (!u[i].dead) {
|
|
<a name="l762"></a> best=0;
|
|
<a name="l763"></a> best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
|
|
<a name="l764"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<U_FRIENDLY_NUM;j++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l765"></a> </span><span class=cF1>if</span><span class=cF0> (!u[j].dead&& u[i].y-u[j].y<8) {
|
|
<a name="l766"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].x-u[j].x)+</span><span class=cF5>SqrI64</span><span class=cF0>(u[i].y-u[j].y);
|
|
<a name="l767"></a> </span><span class=cF1>if</span><span class=cF0> (dd<best_dd) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l768"></a> best_dd=dd;
|
|
<a name="l769"></a> best=j;
|
|
<a name="l770"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l771"></a> }
|
|
<a name="l772"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l773"></a> u[i].best_dd=best_dd;
|
|
<a name="l774"></a> </span><span class=cF1>if</span><span class=cF0> (best_dd<HACK_DIST*HACK_DIST && !</span><span class=cF7>(</span><span class=cF5>RandU16</span><span class=cF0>&1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l775"></a> ManDie(&u[best],</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l776"></a> }
|
|
<a name="l777"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l778"></a>}
|
|
<a name="l779"></a>
|
|
<a name="l780"></a></span><span class=cF1>U0</span><span class=cF0> Titanium()
|
|
<a name="l781"></a>{
|
|
<a name="l782"></a> </span><span class=cF9>I64</span><span class=cF0> i,msg_code,ch,sc;
|
|
<a name="l783"></a> </span><span class=cF1>Bool</span><span class=cF0> gun_on;
|
|
<a name="l784"></a>
|
|
<a name="l785"></a> </span><span class=cF9>I64</span><span class=cF0> next_update_jiffy;
|
|
<a name="l786"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l787"></a>
|
|
<a name="l788"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l789"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l790"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l791"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l792"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l793"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l794"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l795"></a> </span><span class=cF6>" Fire(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l796"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l797"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l798"></a> </span><span class=cF6>" LeftMissile(,,SC_CURSOR_LEFT|SCF_CTRL);"</span><span class=cF0>
|
|
<a name="l799"></a> </span><span class=cF6>" RightMissile(,,SC_CURSOR_RIGHT|SCF_CTRL);"</span><span class=cF0>
|
|
<a name="l800"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l801"></a> );
|
|
<a name="l802"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l803"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l804"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l805"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l806"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l807"></a>
|
|
<a name="l808"></a> </span><span class=cF6>"\nScoring:\n"</span><span class=cF0>
|
|
<a name="l809"></a> </span><span class=cF6>"\tEnemy Killed\t\t+3\n"</span><span class=cF0>
|
|
<a name="l810"></a> </span><span class=cF6>"\tEnemy by Friendly\t+5\n"</span><span class=cF0>
|
|
<a name="l811"></a> </span><span class=cF6>"\tFriendly Fire\t\t-100\n"</span><span class=cF0>
|
|
<a name="l812"></a> </span><span class=cF6>"\tBullets Fired\t\t-1\n"</span><span class=cF0>
|
|
<a name="l813"></a> </span><span class=cF6>"\tGame Time\t\t-10 per second\n"</span><span class=cF0>
|
|
<a name="l814"></a> </span><span class=cF6>"\tSurviving Friendlies\t+250\n\n"</span><span class=cF0>
|
|
<a name="l815"></a> </span><span class=cF6>"Sweep side-to-side while shooting, "</span><span class=cF0>
|
|
<a name="l816"></a> </span><span class=cF6>"holding down $GREEN$<SPACE>$FG$.\n\n"</span><span class=cF0>;
|
|
<a name="l817"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l818"></a>
|
|
<a name="l819"></a> Init;
|
|
<a name="l820"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l821"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it=&</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l822"></a>
|
|
<a name="l823"></a> gun_on=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l824"></a>
|
|
<a name="l825"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l826"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l827"></a> next_update_jiffy=</span><span class=cFB>cnts</span><span class=cF0>.jiffies+</span><span class=cF3>JIFFY_FREQ</span><span class=cF0>/100;
|
|
<a name="l828"></a> </span><span class=cF1>while</span><span class=cF0> (msg_code=</span><span class=cF5>ScanMsg</span><span class=cF7>(</span><span class=cF0>&ch,&sc,1<<</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>+1<<</span><span class=cF3>MSG_KEY_UP</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l829"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) {
|
|
<a name="l830"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l831"></a> </span><span class=cF1>switch</span><span class=cF0> (ch) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l832"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
|
<a name="l833"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[0]) {
|
|
<a name="l834"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l835"></a> </span><span class=cF1>if</span><span class=cF0> (sc&</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l836"></a> FireMissile(1);
|
|
<a name="l837"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l838"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l839"></a> </span><span class=cF1>if</span><span class=cF0> (sc&</span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l840"></a> FireMissile(-1);
|
|
<a name="l841"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l842"></a> }
|
|
<a name="l843"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l844"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l845"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l846"></a> </span><span class=cF1>goto</span><span class=cF0> to_done;
|
|
<a name="l847"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l848"></a> Init;
|
|
<a name="l849"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l850"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l851"></a> gun_on=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l852"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l853"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l854"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l855"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_UP</span><span class=cF0>:
|
|
<a name="l856"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF3>CH_SPACE</span><span class=cF0>)
|
|
<a name="l857"></a> gun_on=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l858"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc.u8[0]==</span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>||sc.u8[0]==</span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>)
|
|
<a name="l859"></a> theta=-</span><span class=cF3>pi</span><span class=cF0>/2;
|
|
<a name="l860"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l861"></a> }
|
|
<a name="l862"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l863"></a>
|
|
<a name="l864"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<B_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l865"></a> </span><span class=cF1>if</span><span class=cF0> (!b[i].dead) {
|
|
<a name="l866"></a> b[i].x+=b[i].dx2;
|
|
<a name="l867"></a> b[i].y+=b[i].dy2;
|
|
<a name="l868"></a> </span><span class=cF1>if</span><span class=cF0> (b[i].y<0||b[i].x<0||
|
|
<a name="l869"></a> b[i].x>>32>=</span><span class=cF5>Fs</span><span class=cF0>->pix_width||
|
|
<a name="l870"></a> b[i].y>>32>=</span><span class=cF5>Fs</span><span class=cF0>->pix_height)
|
|
<a name="l871"></a> b[i].dead=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l872"></a> }
|
|
<a name="l873"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l874"></a>
|
|
<a name="l875"></a> dx=0;
|
|
<a name="l876"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap,</span><span class=cF3>SC_CTRL</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l877"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap,</span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l878"></a> theta=-</span><span class=cF3>pi</span><span class=cF0>/2-15.0*</span><span class=cF3>pi</span><span class=cF0>/180.0;
|
|
<a name="l879"></a> dx=-2;
|
|
<a name="l880"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap,</span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l881"></a> theta=-</span><span class=cF3>pi</span><span class=cF0>/2+15.0*</span><span class=cF3>pi</span><span class=cF0>/180.0;
|
|
<a name="l882"></a> dx=2;
|
|
<a name="l883"></a> }
|
|
<a name="l884"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l885"></a> x+=dx;
|
|
<a name="l886"></a> </span><span class=cF1>while</span><span class=cF0> (x>=</span><span class=cF5>Fs</span><span class=cF0>->pix_width)
|
|
<a name="l887"></a> x-=</span><span class=cF5>Fs</span><span class=cF0>->pix_width;
|
|
<a name="l888"></a> </span><span class=cF1>while</span><span class=cF0> (x<0)
|
|
<a name="l889"></a> x+=</span><span class=cF5>Fs</span><span class=cF0>->pix_width;
|
|
<a name="l890"></a>
|
|
<a name="l891"></a> </span><span class=cF2>//It takes too much CPU do do all these all the time.</span><span class=cF0>
|
|
<a name="l892"></a> </span><span class=cF1>switch</span><span class=cF0> [main_loop_pass&7] </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l893"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
|
<a name="l894"></a> </span><span class=cF1>switch</span><span class=cF0> [main_loop_pass>>3&7] {
|
|
<a name="l895"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
|
<a name="l896"></a> </span><span class=cF1>if</span><span class=cF0> (--y<20)
|
|
<a name="l897"></a> game_over=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l898"></a> </span><span class=cF1>case</span><span class=cF0> 2:
|
|
<a name="l899"></a> </span><span class=cF1>case</span><span class=cF0> 4:
|
|
<a name="l900"></a> </span><span class=cF1>case</span><span class=cF0> 6:
|
|
<a name="l901"></a> MenFight(main_loop_pass>>4%PHASES_GROUPS);
|
|
<a name="l902"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l903"></a> </span><span class=cF1>case</span><span class=cF0> 1:
|
|
<a name="l904"></a> </span><span class=cF1>case</span><span class=cF0> 3:
|
|
<a name="l905"></a> </span><span class=cF1>case</span><span class=cF0> 5:
|
|
<a name="l906"></a> </span><span class=cF1>case</span><span class=cF0> 7:
|
|
<a name="l907"></a> MenMove (main_loop_pass>>4%PHASES_GROUPS);
|
|
<a name="l908"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l909"></a> }
|
|
<a name="l910"></a> </span><span class=cF1>case</span><span class=cF0> 4:
|
|
<a name="l911"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l912"></a> </span><span class=cF1>case</span><span class=cF0> 2:
|
|
<a name="l913"></a> </span><span class=cF1>case</span><span class=cF0> 6:
|
|
<a name="l914"></a> </span><span class=cF1>if</span><span class=cF0> (gun_on)
|
|
<a name="l915"></a> FireBullet;
|
|
<a name="l916"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l917"></a> </span><span class=cF1>case</span><span class=cF0> 1:
|
|
<a name="l918"></a> </span><span class=cF1>case</span><span class=cF0> 3:
|
|
<a name="l919"></a> </span><span class=cF1>case</span><span class=cF0> 5:
|
|
<a name="l920"></a> </span><span class=cF1>case</span><span class=cF0> 7:
|
|
<a name="l921"></a> CheckCollisions;
|
|
<a name="l922"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l923"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l924"></a> main_loop_pass++;
|
|
<a name="l925"></a>
|
|
<a name="l926"></a> </span><span class=cF1>if</span><span class=cF0> (snd_timeout && </span><span class=cF5>tS</span><span class=cF0>>snd_timeout) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l927"></a> snd_timeout=0;
|
|
<a name="l928"></a> </span><span class=cF5>Snd</span><span class=cF0>;
|
|
<a name="l929"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l930"></a> </span><span class=cF5>SleepUntil</span><span class=cF0>(next_update_jiffy);
|
|
<a name="l931"></a>
|
|
<a name="l932"></a> total_score=3*(U_ENEMY_NUM-enemy_left)+5*enemy_by_friendly
|
|
<a name="l933"></a> -100*friendly_fire-10*(</span><span class=cF5>tS</span><span class=cF0>-t0)-bullets_fired;
|
|
<a name="l934"></a> </span><span class=cF1>if</span><span class=cF0> (game_over) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l935"></a> tf=</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l936"></a> </span><span class=cF5>Sleep</span><span class=cF0>(750);
|
|
<a name="l937"></a> </span><span class=cF5>FlushMsgs</span><span class=cF0>;
|
|
<a name="l938"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>ScanKey</span><span class=cF7>(</span><span class=cF0>&ch</span><span class=cF7>)</span><span class=cF0>&&friendly_left||</span><span class=cF5>tS</span><span class=cF0>-tf<1.5) {
|
|
<a name="l939"></a> total_score+=250;
|
|
<a name="l940"></a> </span><span class=cF5>Snd</span><span class=cF0>(86); </span><span class=cF5>Sleep</span><span class=cF0>(150);
|
|
<a name="l941"></a> </span><span class=cF5>Snd</span><span class=cF0>; </span><span class=cF5>Sleep</span><span class=cF0>(50);
|
|
<a name="l942"></a> friendly_left--;
|
|
<a name="l943"></a> }
|
|
<a name="l944"></a> total_score+=250*friendly_left;
|
|
<a name="l945"></a> </span><span class=cF1>if</span><span class=cF0> (total_score>best_score)
|
|
<a name="l946"></a> best_score=total_score;
|
|
<a name="l947"></a> </span><span class=cF1>if</span><span class=cF0> (!ch) ch=</span><span class=cF5>GetChar</span><span class=cF0>(,</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l948"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF3>CH_ESC</span><span class=cF0>||ch==</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>)
|
|
<a name="l949"></a> </span><span class=cF1>goto</span><span class=cF0> to_done;
|
|
<a name="l950"></a> gun_on=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l951"></a> Init;
|
|
<a name="l952"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l953"></a> }
|
|
<a name="l954"></a>to_done:
|
|
<a name="l955"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(,,1<<</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
|
|
<a name="l956"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l957"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l958"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l959"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l960"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l961"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"TempleOS/Titanium"</span><span class=cF0>,</span><span class=cF6>"I64 best_score=%d;\n"</span><span class=cF0>,best_score);
|
|
<a name="l962"></a>}
|
|
</span></pre></body>
|
|
</html>
|