templeos-info/public/Wb/Home/Src/Apps/KeepAway/KeepAway.HC.HTML

741 lines
61 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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;}
.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=cF2>//The ball and men were generated</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>//with </span><a href="/Wb/Apps/GrModels/Run.HC.HTML#l1"><span class=cF4>::/Apps/GrModels/Run.HC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l3"></a></span><span class=cF2>//They were cut-and-pasted here.</span><span class=cF0>
<a name="l4"></a>
<a name="l5"></a></span><span class=cE0>
<a name="l6"></a> </span><span class=cEA>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l7"></a>
<a name="l8"></a>
<a name="l9"></a>
<a name="l10"></a>
<a name="l11"></a>
<a name="l12"></a> </span><span class=cEA>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l13"></a>
<a name="l14"></a>
<a name="l15"></a>
<a name="l16"></a>
<a name="l17"></a>
<a name="l18"></a>
<a name="l19"></a> </span><span class=cEA>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l20"></a>
<a name="l21"></a>
<a name="l22"></a>
<a name="l23"></a>
<a name="l24"></a>
<a name="l25"></a>
<a name="l26"></a> </span><span class=cEA>&lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l27"></a>
<a name="l28"></a>
<a name="l29"></a>
<a name="l30"></a>
<a name="l31"></a>
<a name="l32"></a>
<a name="l33"></a> </span><span class=cEA>&lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l48"></a>
<a name="l49"></a>
<a name="l50"></a>
<a name="l51"></a>
<a name="l52"></a>
<a name="l53"></a>
<a name="l54"></a> </span><span class=cEA>&lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;9&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;10&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;11&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l76"></a>
<a name="l77"></a>
<a name="l78"></a>
<a name="l79"></a>
<a name="l80"></a>
<a name="l81"></a>
<a name="l82"></a> </span><span class=cEA>&lt;12&gt;/* 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>
<a name="l87"></a>
<a name="l88"></a> </span><span class=cEA>&lt;13&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;14&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l96"></a>
<a name="l97"></a>
<a name="l98"></a>
<a name="l99"></a>
<a name="l100"></a>
<a name="l101"></a> </span><span class=cEA>&lt;15&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l102"></a>
<a name="l103"></a>
<a name="l104"></a>
<a name="l105"></a>
<a name="l106"></a>
<a name="l107"></a> </span><span class=cEA>&lt;16&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;17&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l115"></a>
<a name="l116"></a>
<a name="l117"></a>
<a name="l118"></a>
<a name="l119"></a>
<a name="l120"></a>
<a name="l121"></a> </span><span class=cEA>&lt;18&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;19&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l129"></a>
<a name="l130"></a>
<a name="l131"></a>
<a name="l132"></a>
<a name="l133"></a>
<a name="l134"></a>
<a name="l135"></a> </span><span class=cEA>&lt;20&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;21&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l143"></a>
<a name="l144"></a>
<a name="l145"></a>
<a name="l146"></a>
<a name="l147"></a>
<a name="l148"></a>
<a name="l149"></a> </span><span class=cEA>&lt;22&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<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> </span><span class=cEA>&lt;23&gt;/* Graphics Not Rendered in HTML */</span><span class=cE0>
<a name="l157"></a>
<a name="l158"></a>
<a name="l159"></a>
<a name="l160"></a></span><span class=cF1>class</span><span class=cF0> Frame
<a name="l161"></a>{
<a name="l162"></a> </span><span class=cF1>U8</span><span class=cF0> *img[2];
<a name="l163"></a> </span><span class=cF1>F64</span><span class=cF0> dt;
<a name="l164"></a>};
<a name="l165"></a>
<a name="l166"></a>#</span><span class=cF1>define</span><span class=cF0> COURT_BORDER 10
<a name="l167"></a>#</span><span class=cF1>define</span><span class=cF0> COLLISION_DAMP 0.8
<a name="l168"></a>#</span><span class=cF1>define</span><span class=cF0> AIR_VISCOSITY 0.1
<a name="l169"></a>
<a name="l170"></a>#</span><span class=cF1>define</span><span class=cF0> GRAVITY_ACCELERATION 500
<a name="l171"></a>#</span><span class=cF1>define</span><span class=cF0> SHOT_VELOCITY 400
<a name="l172"></a>#</span><span class=cF1>define</span><span class=cF0> DRIBBLE_T 0.25
<a name="l173"></a>#</span><span class=cF1>define</span><span class=cF0> MAN_VELOCITY 150
<a name="l174"></a>#</span><span class=cF1>define</span><span class=cF0> MAN_SQR_RADIUS (20*20)
<a name="l175"></a>#</span><span class=cF1>define</span><span class=cF0> FOUL_VELOCITY_THRESHOLD 50
<a name="l176"></a>#</span><span class=cF1>define</span><span class=cF0> JUMP_VELOCITY 250
<a name="l177"></a>#</span><span class=cF1>define</span><span class=cF0> ROLL_VELOCITY_THRESHOLD 100
<a name="l178"></a>#</span><span class=cF1>define</span><span class=cF0> RANDOM_MAN_ACCELERATION 30
<a name="l179"></a>
<a name="l180"></a>#</span><span class=cF1>define</span><span class=cF0> HEAD_Z_OFFSET 200
<a name="l181"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_X_OFFSET 30
<a name="l182"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_Y_OFFSET 20
<a name="l183"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_SQR_OFFSET \
<a name="l184"></a> (HAND_X_OFFSET*HAND_X_OFFSET+HAND_Y_OFFSET*HAND_Y_OFFSET)
<a name="l185"></a>#</span><span class=cF1>define</span><span class=cF0> HAND_Z_OFFSET 110
<a name="l186"></a>
<a name="l187"></a>#</span><span class=cF1>define</span><span class=cF0> FIRST_STANDING 0
<a name="l188"></a>
<a name="l189"></a>#</span><span class=cF1>define</span><span class=cF0> RUNNING_IMGS_NUM 4
<a name="l190"></a>#</span><span class=cF1>define</span><span class=cF0> FIRST_RUNNING 0
<a name="l191"></a>#</span><span class=cF1>define</span><span class=cF0> LAST_RUNNING (FIRST_RUNNING+RUNNING_IMGS_NUM-1)
<a name="l192"></a>
<a name="l193"></a>#</span><span class=cF1>define</span><span class=cF0> SHOOTING_IMGS_NUM 5
<a name="l194"></a>#</span><span class=cF1>define</span><span class=cF0> FIRST_SHOOTING (LAST_RUNNING+1)
<a name="l195"></a>#</span><span class=cF1>define</span><span class=cF0> LAST_SHOOTING (FIRST_SHOOTING+SHOOTING_IMGS_NUM-1)
<a name="l196"></a>
<a name="l197"></a>#</span><span class=cF1>define</span><span class=cF0> DRIBBLING_IMGS_NUM 4
<a name="l198"></a>#</span><span class=cF1>define</span><span class=cF0> FIRST_DRIBBLING (LAST_SHOOTING+1)
<a name="l199"></a>#</span><span class=cF1>define</span><span class=cF0> LAST_DRIBBLING (FIRST_DRIBBLING+DRIBBLING_IMGS_NUM-1)
<a name="l200"></a>
<a name="l201"></a>#</span><span class=cF1>define</span><span class=cF0> STOPPED_DRIBBLING_IMGS_NUM 2
<a name="l202"></a>#</span><span class=cF1>define</span><span class=cF0> FIRST_STOPPED_DRIBBLING (LAST_DRIBBLING+1)
<a name="l203"></a>#</span><span class=cF1>define</span><span class=cF0> LAST_STOPPED_DRIBBLING \
<a name="l204"></a> (FIRST_STOPPED_DRIBBLING+STOPPED_DRIBBLING_IMGS_NUM-1)
<a name="l205"></a>
<a name="l206"></a>Frame imgs[LAST_STOPPED_DRIBBLING+1]={
<a name="l207"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;6&gt;</span><span class=cF0>,</span><span class=cFA>&lt;7&gt;</span><span class=cF0>},2*DRIBBLE_T/RUNNING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l208"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;2&gt;</span><span class=cF0>,</span><span class=cFA>&lt;3&gt;</span><span class=cF0>},2*DRIBBLE_T/RUNNING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l209"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;6&gt;</span><span class=cF0>,</span><span class=cFA>&lt;7&gt;</span><span class=cF0>},2*DRIBBLE_T/RUNNING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l210"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;4&gt;</span><span class=cF0>,</span><span class=cFA>&lt;5&gt;</span><span class=cF0>},2*DRIBBLE_T/RUNNING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l211"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;8&gt;</span><span class=cF0>,</span><span class=cFA>&lt;9&gt;</span><span class=cF0>},0.1</span><span class=cF7>}</span><span class=cF0>,</span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;10&gt;</span><span class=cF0>,</span><span class=cFA>&lt;11&gt;</span><span class=cF0>},0.2</span><span class=cF7>}</span><span class=cF0>,
<a name="l212"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;12&gt;</span><span class=cF0>,</span><span class=cFA>&lt;13&gt;</span><span class=cF0>},0.2</span><span class=cF7>}</span><span class=cF0>,</span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;12&gt;</span><span class=cF0>,</span><span class=cFA>&lt;13&gt;</span><span class=cF0>},0.1</span><span class=cF7>}</span><span class=cF0>,</span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;14&gt;</span><span class=cF0>,</span><span class=cFA>&lt;15&gt;</span><span class=cF0>},0.1</span><span class=cF7>}</span><span class=cF0>,
<a name="l213"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;20&gt;</span><span class=cF0>,</span><span class=cFA>&lt;21&gt;</span><span class=cF0>},2*DRIBBLE_T/DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l214"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;16&gt;</span><span class=cF0>,</span><span class=cFA>&lt;17&gt;</span><span class=cF0>},2*DRIBBLE_T/DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l215"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;20&gt;</span><span class=cF0>,</span><span class=cFA>&lt;21&gt;</span><span class=cF0>},2*DRIBBLE_T/DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l216"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;18&gt;</span><span class=cF0>,</span><span class=cFA>&lt;19&gt;</span><span class=cF0>},2*DRIBBLE_T/DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l217"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;20&gt;</span><span class=cF0>,</span><span class=cFA>&lt;21&gt;</span><span class=cF0>},DRIBBLE_T/STOPPED_DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>{</span><span class=cFA>&lt;22&gt;</span><span class=cF0>,</span><span class=cFA>&lt;23&gt;</span><span class=cF0>},DRIBBLE_T/STOPPED_DRIBBLING_IMGS_NUM</span><span class=cF7>}</span><span class=cF0>,
<a name="l219"></a>};
<a name="l220"></a>
<a name="l221"></a></span><span class=cF5>RegDft</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/KeepAway&quot;</span><span class=cF0>,</span><span class=cF6>&quot;I64 best_score0=0,best_score1=9999;\n&quot;</span><span class=cF0>);
<a name="l222"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/KeepAway&quot;</span><span class=cF0>);
<a name="l223"></a>
<a name="l224"></a></span><span class=cF1>F64</span><span class=cF0> game_t_end,foul_t_end;
<a name="l225"></a></span><span class=cF9>I64</span><span class=cF0> score0,score1;
<a name="l226"></a>
<a name="l227"></a>#</span><span class=cF1>define</span><span class=cF0> PER_SIDE_NUM 3
<a name="l228"></a>#</span><span class=cF1>define</span><span class=cF0> OBJS_NUM (PER_SIDE_NUM*2+1)
<a name="l229"></a></span><span class=cF1>Bool</span><span class=cF0> someone_shooting,someone_has_ball;
<a name="l230"></a></span><span class=cF1>F64</span><span class=cF0> shot_land_t;
<a name="l231"></a>
<a name="l232"></a></span><span class=cF1>class</span><span class=cF0> Obj
<a name="l233"></a>{
<a name="l234"></a> </span><span class=cF9>I64</span><span class=cF0> team; </span><span class=cF2>//-1 is ball</span><span class=cF0>
<a name="l235"></a> </span><span class=cF1>F64</span><span class=cF0> x,y,z,DxDt,DyDt,DzDt,theta,radius,stolen_t0;
<a name="l236"></a> </span><span class=cF1>F64</span><span class=cF0> get_ball_dt,get_ball_theta,nearest_man_dd,last_t0,next_t0,foul_t0;
<a name="l237"></a> </span><span class=cF9>I64</span><span class=cF0> last_img,next_img;
<a name="l238"></a> </span><span class=cF1>Bool</span><span class=cF0> stopped,shooting,has_ball,nearest_ball,pad[4];
<a name="l239"></a>} objs[OBJS_NUM],*ball,*human,*last_owner;
<a name="l240"></a>
<a name="l241"></a></span><span class=cF2>/*Just to be different, I didn't use the built-in</span><span class=cF0>
<a name="l242"></a></span><span class=cF2>DCF_TRANSFORMATION flag in this game.</span><span class=cF0>
<a name="l243"></a></span><span class=cF2>Instead, I chose a 45 degree angle</span><span class=cF0>
<a name="l244"></a></span><span class=cF2>between Y and Z as the view point.</span><span class=cF0>
<a name="l245"></a></span><span class=cF2>If I had used the transform, I would</span><span class=cF0>
<a name="l246"></a></span><span class=cF2>have to make all my men taller.</span><span class=cF0>
<a name="l247"></a></span><span class=cF2>This is a little simpler, and faster,</span><span class=cF0>
<a name="l248"></a></span><span class=cF2>but adds lots of factor 2 vals.</span><span class=cF0>
<a name="l249"></a>
<a name="l250"></a></span><span class=cF2>I also didn't use the </span><a href="/Wb/Kernel/KernelA.HH.HTML#l251"><span class=cF4>CMathODE</span></a><span class=cF2> feat,</span><span class=cF0>
<a name="l251"></a></span><span class=cF2>just to be different.</span><span class=cF0>
<a name="l252"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l253"></a>
<a name="l254"></a></span><span class=cF1>U0</span><span class=cF0> DrawObj(</span><span class=cF9>CDC</span><span class=cF0> *dc,Obj *o,</span><span class=cF1>F64</span><span class=cF0> tt)
<a name="l255"></a>{
<a name="l256"></a> </span><span class=cF1>U8</span><span class=cF0> *tmps;
<a name="l257"></a> </span><span class=cF1>F64</span><span class=cF0> r1=</span><span class=cF5>Max</span><span class=cF0>(9-0.1*o-&gt;z,1),r2=</span><span class=cF5>Max</span><span class=cF0>(r1/4,1);
<a name="l258"></a>
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (o==human)
<a name="l260"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l261"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l262"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l263"></a> </span><span class=cF5>GrEllipse</span><span class=cF0>(dc,o-&gt;x,o-&gt;y/2,r1,r2);
<a name="l264"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,o-&gt;x,o-&gt;y/2);
<a name="l265"></a>
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball)
<a name="l267"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,o-&gt;x,</span><span class=cF7>(</span><span class=cF0>o-&gt;y-o-&gt;z</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF3>GR_Z_ALL</span><span class=cF0>-o-&gt;y,</span><span class=cFA>&lt;1&gt;</span><span class=cF0>);
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l269"></a> tmps=</span><span class=cF5>SpriteInterpolate</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>tt-o-&gt;last_t0</span><span class=cF7>)</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>o-&gt;next_t0-o-&gt;last_t0</span><span class=cF7>)</span><span class=cF0>,
<a name="l270"></a> imgs[o-&gt;last_img].img[o-&gt;team],
<a name="l271"></a> imgs[o-&gt;next_img].img[o-&gt;team]);
<a name="l272"></a> </span><span class=cF5>Sprite3YB</span><span class=cF0>(dc,o-&gt;x,</span><span class=cF7>(</span><span class=cF0>o-&gt;y-o-&gt;z</span><span class=cF7>)</span><span class=cF0>/2,</span><span class=cF3>GR_Z_ALL</span><span class=cF0>-o-&gt;y,tmps,o-&gt;theta);
<a name="l273"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
<a name="l274"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l275"></a>}
<a name="l276"></a>
<a name="l277"></a></span><span class=cF9>I64</span><span class=cF0> ObjCompare(Obj *o1,Obj *o2)
<a name="l278"></a>{
<a name="l279"></a> </span><span class=cF1>return</span><span class=cF0> o1-&gt;y-o2-&gt;y;
<a name="l280"></a>}
<a name="l281"></a>
<a name="l282"></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="l283"></a>{
<a name="l284"></a> </span><span class=cF1>F64</span><span class=cF0> tt=</span><span class=cF5>tS</span><span class=cF0>,d,d_down,d_up;
<a name="l285"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l286"></a> Obj *o_sort[OBJS_NUM],*o;
<a name="l287"></a>
<a name="l288"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l289"></a> dc-&gt;ls.x=10000;
<a name="l290"></a> dc-&gt;ls.y=60000;
<a name="l291"></a> dc-&gt;ls.z=10000;
<a name="l292"></a> d=65535/</span><span class=cF5>D3I32Norm</span><span class=cF0>(&amp;dc-&gt;ls);
<a name="l293"></a> dc-&gt;ls.x*=d;
<a name="l294"></a> dc-&gt;ls.y*=d;
<a name="l295"></a> dc-&gt;ls.z*=d;
<a name="l296"></a>
<a name="l297"></a> dc-&gt;thick=2;
<a name="l298"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l299"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc,COURT_BORDER,COURT_BORDER,
<a name="l300"></a> task-&gt;pix_width -1-COURT_BORDER,
<a name="l301"></a> task-&gt;pix_height-1-COURT_BORDER);
<a name="l302"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;OBJS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l303"></a> o=o_sort[i]=&amp;objs[i];
<a name="l304"></a> </span><span class=cF1>if</span><span class=cF0> (o!=ball) {
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;has_ball) </span><span class=cF7>{</span><span class=cF0>
<a name="l306"></a> ball-&gt;x=o-&gt;x+HAND_X_OFFSET*</span><span class=cF5>Cos</span><span class=cF0>(o-&gt;theta-</span><span class=cF3>pi</span><span class=cF0>/2)+HAND_Y_OFFSET*</span><span class=cF5>Cos</span><span class=cF0>(o-&gt;theta);
<a name="l307"></a></span><span class=cF2>//The factor 2 is because the man is not transformed.</span><span class=cF0>
<a name="l308"></a> ball-&gt;y=o-&gt;y+HAND_X_OFFSET*</span><span class=cF5>Sin</span><span class=cF0>(o-&gt;theta-</span><span class=cF3>pi</span><span class=cF0>/2)/2+HAND_Y_OFFSET*</span><span class=cF5>Sin</span><span class=cF0>(o-&gt;theta)/2;
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (ball-&gt;z+ball-&gt;radius*2&gt;o-&gt;z+HAND_Z_OFFSET)
<a name="l310"></a> ball-&gt;z=o-&gt;z+HAND_Z_OFFSET-ball-&gt;radius*2;
<a name="l311"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (o-&gt;shooting) </span><span class=cF7>{</span><span class=cF0>
<a name="l312"></a> ball-&gt;x=o-&gt;x;
<a name="l313"></a> ball-&gt;y=o-&gt;y;
<a name="l314"></a> ball-&gt;z=o-&gt;z+HEAD_Z_OFFSET;
<a name="l315"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (tt&gt;o-&gt;next_t0) </span><span class=cF7>{</span><span class=cF0>
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;has_ball &amp;&amp; </span><span class=cF7>(</span><span class=cF0>ball-&gt;z+ball-&gt;radius*2&gt;=o-&gt;z+HAND_Z_OFFSET ||
<a name="l318"></a> </span><span class=cF5>Abs</span><span class=cF0>(ball-&gt;DzDt)&lt;30</span><span class=cF7>)</span><span class=cF0>) {
<a name="l319"></a></span><span class=cF2>//This is an approximation. My instinct tells me the viscosity term</span><span class=cF0>
<a name="l320"></a> </span><span class=cF2>//needs an </span><a href="/Wb/Kernel/KernelB.HH.HTML#l128"><span class=cF4>Exp</span></a><span class=cF2>(). However, we should be syncronized to img frames,</span><span class=cF0>
<a name="l321"></a> </span><span class=cF2>//so we don't have to be perfect.</span><span class=cF0>
<a name="l322"></a> d_down=1.0;
<a name="l323"></a> d_up =1.0/COLLISION_DAMP;
<a name="l324"></a></span><span class=cF2>//Up bounce takes higher % because speed lost in collision.</span><span class=cF0>
<a name="l325"></a> ball-&gt;DzDt=-(</span><span class=cF7>(</span><span class=cF0>d_down+d_up</span><span class=cF7>)</span><span class=cF0>*
<a name="l326"></a> </span><span class=cF7>(</span><span class=cF0>o-&gt;z+HAND_Z_OFFSET-ball-&gt;radius*4</span><span class=cF7>)</span><span class=cF0>/</span><span class=cF7>(</span><span class=cF0>1.0-AIR_VISCOSITY</span><span class=cF7>)</span><span class=cF0>+
<a name="l327"></a> 0.5*GRAVITY_ACCELERATION*</span><span class=cF7>(</span><span class=cF0>
<a name="l328"></a> </span><span class=cF5>Sqr</span><span class=cF0>(DRIBBLE_T*d_up/</span><span class=cF7>(</span><span class=cF0>d_down+d_up</span><span class=cF7>)</span><span class=cF0>)-
<a name="l329"></a> </span><span class=cF5>Sqr</span><span class=cF0>(DRIBBLE_T*d_down/</span><span class=cF7>(</span><span class=cF0>d_down+d_up</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>)</span><span class=cF0>)/DRIBBLE_T;
<a name="l330"></a> }
<a name="l331"></a> o-&gt;last_t0=tt;
<a name="l332"></a> o-&gt;last_img=o-&gt;next_img++;
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;stopped) {
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;has_ball) </span><span class=cF7>{</span><span class=cF0>
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>FIRST_STOPPED_DRIBBLING&lt;=o-&gt;next_img&lt;=LAST_STOPPED_DRIBBLING</span><span class=cF7>)</span><span class=cF0>)
<a name="l336"></a> o-&gt;next_img=FIRST_STOPPED_DRIBBLING;
<a name="l337"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l338"></a> o-&gt;next_img=FIRST_STANDING;
<a name="l339"></a> o-&gt;stopped=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l340"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (o-&gt;shooting) {
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>FIRST_SHOOTING&lt;=o-&gt;last_img&lt;=LAST_SHOOTING</span><span class=cF7>)</span><span class=cF0>)
<a name="l342"></a> o-&gt;next_img=FIRST_SHOOTING;
<a name="l343"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;next_img&gt;LAST_SHOOTING) </span><span class=cF7>{</span><span class=cF0>
<a name="l344"></a> o-&gt;next_img=FIRST_STANDING;
<a name="l345"></a> someone_has_ball=someone_shooting=o-&gt;has_ball=o-&gt;shooting=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l346"></a> ball-&gt;DxDt=o-&gt;DxDt+SHOT_VELOCITY/</span><span class=cF3>sqrt2</span><span class=cF0>*</span><span class=cF5>Cos</span><span class=cF0>(o-&gt;theta-</span><span class=cF3>pi</span><span class=cF0>/2);
<a name="l347"></a> ball-&gt;DyDt=o-&gt;DyDt+SHOT_VELOCITY/</span><span class=cF3>sqrt2</span><span class=cF0>*</span><span class=cF5>Sin</span><span class=cF0>(o-&gt;theta-</span><span class=cF3>pi</span><span class=cF0>/2);
<a name="l348"></a> ball-&gt;DzDt=o-&gt;DzDt+SHOT_VELOCITY/</span><span class=cF3>sqrt2</span><span class=cF0>;
<a name="l349"></a> shot_land_t=tt+(ball-&gt;DzDt+</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(ball-&gt;DzDt)+
<a name="l350"></a> 2*GRAVITY_ACCELERATION*ball-&gt;z</span><span class=cF7>)</span><span class=cF0>)/GRAVITY_ACCELERATION;
<a name="l351"></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="l352"></a> ball-&gt;DxDt=0;
<a name="l353"></a> ball-&gt;DyDt=0;
<a name="l354"></a> ball-&gt;DzDt=0;
<a name="l355"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l356"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (o-&gt;has_ball) {
<a name="l357"></a> </span><span class=cF1>if</span><span class=cF0> (FIRST_RUNNING&lt;=o-&gt;next_img&lt;=LAST_RUNNING)
<a name="l358"></a> o-&gt;next_img+=FIRST_DRIBBLING-FIRST_RUNNING;
<a name="l359"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>FIRST_DRIBBLING&lt;=o-&gt;next_img&lt;=LAST_DRIBBLING</span><span class=cF7>)</span><span class=cF0>)
<a name="l360"></a> o-&gt;next_img=FIRST_DRIBBLING;
<a name="l361"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (FIRST_DRIBBLING&lt;=o-&gt;next_img&lt;=LAST_DRIBBLING)
<a name="l363"></a> o-&gt;next_img+=FIRST_RUNNING-FIRST_DRIBBLING;
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>FIRST_RUNNING&lt;=o-&gt;next_img&lt;=LAST_RUNNING</span><span class=cF7>)</span><span class=cF0>)
<a name="l365"></a> o-&gt;next_img=FIRST_RUNNING;
<a name="l366"></a> }
<a name="l367"></a> o-&gt;next_t0+=imgs[o-&gt;last_img].dt;
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;next_t0&lt;=tt)
<a name="l369"></a> o-&gt;next_t0=tt+imgs[o-&gt;last_img].dt;
<a name="l370"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l371"></a> }
<a name="l372"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l373"></a>
<a name="l374"></a> </span><span class=cF5>QSortI64</span><span class=cF0>(o_sort,OBJS_NUM,&amp;ObjCompare);
<a name="l375"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;OBJS_NUM;i++)
<a name="l376"></a> DrawObj(dc,o_sort[i],tt);
<a name="l377"></a> tt=(game_t_end-</span><span class=cF5>tS</span><span class=cF0>)/60;
<a name="l378"></a> </span><span class=cF1>if</span><span class=cF0> (tt&lt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l379"></a> dc-&gt;color=</span><span class=cF3>RED</span><span class=cF0>;
<a name="l380"></a> tt=0;
<a name="l381"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l382"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>task-&gt;pix_width-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*9</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1,
<a name="l383"></a> </span><span class=cF7>(</span><span class=cF0>task-&gt;pix_height-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1,</span><span class=cF6>&quot;Game Over&quot;</span><span class=cF0>);
<a name="l384"></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="l385"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0>&lt;foul_t_end) {
<a name="l386"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l387"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
<a name="l388"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF7>(</span><span class=cF0>task-&gt;pix_width-</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*4</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1,
<a name="l389"></a> </span><span class=cF7>(</span><span class=cF0>task-&gt;pix_height-</span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1,</span><span class=cF6>&quot;Foul&quot;</span><span class=cF0>);
<a name="l390"></a> }
<a name="l391"></a> dc-&gt;color=</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l392"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l393"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>&quot;Time:%d:%04.1f Score:&quot;</span><span class=cF0>,</span><span class=cF5>ToI64</span><span class=cF7>(</span><span class=cF0>tt</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF7>(</span><span class=cF0>tt-</span><span class=cF5>ToI64</span><span class=cF0>(tt)</span><span class=cF7>)</span><span class=cF0>*60);
<a name="l394"></a> </span><span class=cF5>GrPrint</span><span class=cF0> (dc,</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*27,0,</span><span class=cF6>&quot;Best Score:&quot;</span><span class=cF0>);
<a name="l395"></a>
<a name="l396"></a> dc-&gt;color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l397"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*20,0,</span><span class=cF6>&quot;%02d&quot;</span><span class=cF0>,score0);
<a name="l398"></a> dc-&gt;color=</span><span class=cF3>LTPURPLE</span><span class=cF0>;
<a name="l399"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*23,0,</span><span class=cF6>&quot;%02d&quot;</span><span class=cF0>,score1);
<a name="l400"></a>
<a name="l401"></a> dc-&gt;color=</span><span class=cF3>LTCYAN</span><span class=cF0>;
<a name="l402"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*39,0,</span><span class=cF6>&quot;%02d&quot;</span><span class=cF0>,best_score0);
<a name="l403"></a> dc-&gt;color=</span><span class=cF3>LTPURPLE</span><span class=cF0>;
<a name="l404"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,</span><span class=cF3>FONT_WIDTH</span><span class=cF0>*42,0,</span><span class=cF6>&quot;%02d&quot;</span><span class=cF0>,best_score1);
<a name="l405"></a>}
<a name="l406"></a>
<a name="l407"></a></span><span class=cF1>U0</span><span class=cF0> Shoot(Obj *o)
<a name="l408"></a>{
<a name="l409"></a> </span><span class=cF1>if</span><span class=cF0> (!someone_shooting &amp;&amp; o-&gt;has_ball) </span><span class=cF7>{</span><span class=cF0>
<a name="l410"></a> someone_shooting=o-&gt;stopped=o-&gt;shooting=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l411"></a> o-&gt;has_ball=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l412"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l413"></a>}
<a name="l414"></a>
<a name="l415"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(</span><span class=cF9>CTask</span><span class=cF0> *parent_task)
<a name="l416"></a>{
<a name="l417"></a> </span><span class=cF1>F64</span><span class=cF0> d,dx,dy,dt,dx2,dy2,t0=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l418"></a> </span><span class=cF9>I64</span><span class=cF0> i,j;
<a name="l419"></a> </span><span class=cF1>Bool</span><span class=cF0> gets_ball;
<a name="l420"></a> Obj *o,*nearest_ball[2];
<a name="l421"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l422"></a> dt=</span><span class=cF5>tS</span><span class=cF0>-t0;
<a name="l423"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l424"></a>
<a name="l425"></a> </span><span class=cF1>if</span><span class=cF0> (game_t_end &amp;&amp; game_t_end&lt;t0) {
<a name="l426"></a> game_t_end=0;
<a name="l427"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l428"></a> </span><span class=cF1>if</span><span class=cF0> (score0-score1&gt;best_score0-best_score1) </span><span class=cF7>{</span><span class=cF0>
<a name="l429"></a> best_score0=score0;
<a name="l430"></a> best_score1=score1;
<a name="l431"></a> </span><span class=cF5>Snd</span><span class=cF0>(86);</span><span class=cF5>Sleep</span><span class=cF0>(100); </span><span class=cF5>Snd</span><span class=cF0>;</span><span class=cF5>Sleep</span><span class=cF0>(100);
<a name="l432"></a> </span><span class=cF5>Snd</span><span class=cF0>(86);</span><span class=cF5>Sleep</span><span class=cF0>(100); </span><span class=cF5>Snd</span><span class=cF0>;</span><span class=cF5>Sleep</span><span class=cF0>(100);
<a name="l433"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l434"></a> }
<a name="l435"></a>
<a name="l436"></a> </span><span class=cF1>if</span><span class=cF0> (game_t_end) {
<a name="l437"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;nearest_ball,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>nearest_ball</span><span class=cF7>)</span><span class=cF0>);
<a name="l438"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;OBJS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l439"></a> o=&amp;objs[i];
<a name="l440"></a> o-&gt;nearest_ball=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l441"></a> </span><span class=cF1>if</span><span class=cF0> (o!=ball) {
<a name="l442"></a> d=0;
<a name="l443"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;5;j++) </span><span class=cF2>//Iterative estimate of how long to get ball.</span><span class=cF0>
<a name="l444"></a> d=</span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>ball-&gt;DxDt*d+ball-&gt;x-o-&gt;x</span><span class=cF7>)</span><span class=cF0>+
<a name="l445"></a> </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>ball-&gt;DyDt*d+ball-&gt;y-o-&gt;y</span><span class=cF7>)</span><span class=cF0>)/MAN_VELOCITY;
<a name="l446"></a> o-&gt;get_ball_dt=d;
<a name="l447"></a> o-&gt;get_ball_theta=</span><span class=cF5>Arg</span><span class=cF0>(ball-&gt;DxDt*d+ball-&gt;x-o-&gt;x,
<a name="l448"></a> ball-&gt;DyDt*d+ball-&gt;y-o-&gt;y);
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (o!=last_owner &amp;&amp; !nearest_ball[o-&gt;team] ||
<a name="l450"></a> o-&gt;get_ball_dt&lt;nearest_ball[o-&gt;team]-&gt;get_ball_dt)
<a name="l451"></a> nearest_ball[o-&gt;team]=o;
<a name="l452"></a> }
<a name="l453"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l454"></a> nearest_ball[0]-&gt;nearest_ball=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l455"></a> nearest_ball[1]-&gt;nearest_ball=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l456"></a>
<a name="l457"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;OBJS_NUM;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l458"></a> o=&amp;objs[i];
<a name="l459"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball) {
<a name="l460"></a> o-&gt;x+=dt*o-&gt;DxDt;
<a name="l461"></a> o-&gt;y+=dt*o-&gt;DyDt;
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (!someone_shooting)
<a name="l463"></a> o-&gt;z+=dt*(o-&gt;DzDt-0.5*GRAVITY_ACCELERATION*dt);
<a name="l464"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (!o-&gt;has_ball) </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (t0-o-&gt;stolen_t0&gt;2.0 &amp;&amp; !someone_shooting) {
<a name="l467"></a> dx=ball-&gt;x-o-&gt;x;
<a name="l468"></a> dy=ball-&gt;y-o-&gt;y;
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (dx*dx+dy*dy&lt;HAND_SQR_OFFSET &amp;&amp; ball-&gt;z&lt;o-&gt;z+HAND_Z_OFFSET) </span><span class=cF7>{</span><span class=cF0>
<a name="l470"></a> gets_ball=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l471"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;PER_SIDE_NUM*2;j++)
<a name="l472"></a> </span><span class=cF1>if</span><span class=cF0> (j!=i &amp;&amp; objs[j].has_ball) {
<a name="l473"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0>&lt;2.0*dt) </span><span class=cF7>{</span><span class=cF0>
<a name="l474"></a> objs[j].stolen_t0=t0;
<a name="l475"></a> objs[j].has_ball=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l476"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l477"></a> gets_ball=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l478"></a> }
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (gets_ball) {
<a name="l480"></a> someone_has_ball=o-&gt;has_ball=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (o!=last_owner) </span><span class=cF7>{</span><span class=cF0>
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;team) {
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (t0&lt;shot_land_t+0.1)
<a name="l484"></a> score1+=6;
<a name="l485"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l486"></a> score1+=2;
<a name="l487"></a> </span><span class=cF5>Noise</span><span class=cF0>(250,74,74);
<a name="l488"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (t0&lt;shot_land_t+0.1)
<a name="l490"></a> score0+=6;
<a name="l491"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l492"></a> score0+=2;
<a name="l493"></a> </span><span class=cF5>Noise</span><span class=cF0>(250,86,86);
<a name="l494"></a> }
<a name="l495"></a> last_owner=o;
<a name="l496"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l497"></a> }
<a name="l498"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l499"></a> }
<a name="l500"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (o!=human &amp;&amp; </span><span class=cF5>Rand</span><span class=cF0>&lt;0.25*dt)
<a name="l501"></a> Shoot(o);
<a name="l502"></a> </span><span class=cF1>if</span><span class=cF0> (!o-&gt;shooting) </span><span class=cF7>{</span><span class=cF0>
<a name="l503"></a> </span><span class=cF1>if</span><span class=cF0> (o==human) {
<a name="l504"></a> dx=(</span><span class=cFB>ms</span><span class=cF0>.pos.x-parent_task-&gt;pix_left-parent_task-&gt;scroll_x)-o-&gt;x;
<a name="l505"></a> dy=(</span><span class=cFB>ms</span><span class=cF0>.pos.y-parent_task-&gt;pix_top-parent_task-&gt;scroll_y)*2-o-&gt;y;
<a name="l506"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l507"></a> </span><span class=cF1>if</span><span class=cF0> (!someone_has_ball &amp;&amp; o-&gt;nearest_man_dd&gt;4*MAN_SQR_RADIUS &amp;&amp;
<a name="l508"></a> o-&gt;nearest_ball) </span><span class=cF7>{</span><span class=cF0>
<a name="l509"></a> dx=o-&gt;DxDt=MAN_VELOCITY*</span><span class=cF5>Cos</span><span class=cF0>(o-&gt;get_ball_theta);
<a name="l510"></a> dy=o-&gt;DyDt=MAN_VELOCITY*</span><span class=cF5>Sin</span><span class=cF0>(o-&gt;get_ball_theta);
<a name="l511"></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="l512"></a> dx=o-&gt;DxDt+=RANDOM_MAN_ACCELERATION/</span><span class=cF3>sqrt2</span><span class=cF0>*</span><span class=cF5>RandI16</span><span class=cF0>/</span><span class=cF3>I16_MAX</span><span class=cF0>*dt;
<a name="l513"></a> dy=o-&gt;DyDt+=RANDOM_MAN_ACCELERATION/</span><span class=cF3>sqrt2</span><span class=cF0>*</span><span class=cF5>RandI16</span><span class=cF0>/</span><span class=cF3>I16_MAX</span><span class=cF0>*dt;
<a name="l514"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l515"></a> }
<a name="l516"></a> d=</span><span class=cF5>Sqrt</span><span class=cF0>(dx*dx+dy*dy);
<a name="l517"></a> </span><span class=cF1>if</span><span class=cF0> (d&gt;=1.0) {
<a name="l518"></a> o-&gt;theta=</span><span class=cF5>Arg</span><span class=cF0>(dx,dy)+</span><span class=cF3>pi</span><span class=cF0>/2;
<a name="l519"></a> dx*=MAN_VELOCITY/</span><span class=cF3>sqrt2</span><span class=cF0>*dt/d;
<a name="l520"></a> dy*=MAN_VELOCITY/</span><span class=cF3>sqrt2</span><span class=cF0>*dt/d;
<a name="l521"></a> o-&gt;nearest_man_dd=</span><span class=cF3>F64_MAX</span><span class=cF0>;
<a name="l522"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;PER_SIDE_NUM*2;j++)
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (j!=i) </span><span class=cF7>{</span><span class=cF0>
<a name="l524"></a> dx2=objs[j].x-o-&gt;x;
<a name="l525"></a> dy2=objs[j].y-o-&gt;y;
<a name="l526"></a> d=</span><span class=cF5>Sqr</span><span class=cF0>(dx2)+</span><span class=cF5>Sqr</span><span class=cF0>(dy2);
<a name="l527"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;o-&gt;nearest_man_dd)
<a name="l528"></a> o-&gt;nearest_man_dd=d;
<a name="l529"></a> </span><span class=cF1>if</span><span class=cF0> (d&lt;MAN_SQR_RADIUS) {
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (d) </span><span class=cF7>{</span><span class=cF0>
<a name="l531"></a> d=</span><span class=cF5>Sqrt</span><span class=cF0>(d);
<a name="l532"></a> dx2/=d;
<a name="l533"></a> dy2/=d;
<a name="l534"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l535"></a> </span><span class=cF1>if</span><span class=cF0> (t0&gt;o-&gt;foul_t0+0.15) </span><span class=cF7>{</span><span class=cF0>
<a name="l536"></a> d=(dx-objs[j].DxDt)*dx2+(dy-objs[j].DyDt)*dy2;
<a name="l537"></a> </span><span class=cF1>if</span><span class=cF0> (o==human &amp;&amp; t0&gt;o-&gt;foul_t0+1.0 &amp;&amp;
<a name="l538"></a> dt &amp;&amp; d/dt&gt;FOUL_VELOCITY_THRESHOLD &amp;&amp;
<a name="l539"></a> objs[j].team) {
<a name="l540"></a> </span><span class=cF5>Noise</span><span class=cF0>(250,62,62);
<a name="l541"></a> score1+=1;
<a name="l542"></a> foul_t_end=t0+1.0;
<a name="l543"></a> }
<a name="l544"></a> o-&gt;foul_t0=t0;
<a name="l545"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l546"></a> }
<a name="l547"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l548"></a> </span><span class=cF1>if</span><span class=cF0> (t0&lt;o-&gt;foul_t0+0.15) </span><span class=cF7>{</span><span class=cF0>
<a name="l549"></a> dx=-dx;
<a name="l550"></a> dy=-dy;
<a name="l551"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l552"></a> o-&gt;x+=dx;
<a name="l553"></a> o-&gt;y+=dy;
<a name="l554"></a> o-&gt;stopped=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l555"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l556"></a> o-&gt;stopped=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l557"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l558"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;DzDt)
<a name="l559"></a> o-&gt;z+=dt*(o-&gt;DzDt-0.5*GRAVITY_ACCELERATION*dt);
<a name="l560"></a> }
<a name="l561"></a>
<a name="l562"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;x+o-&gt;radius&gt;=parent_task-&gt;pix_width-COURT_BORDER) {
<a name="l563"></a> o-&gt;x=parent_task-&gt;pix_width-COURT_BORDER-1-o-&gt;radius;
<a name="l564"></a> o-&gt;DxDt=-COLLISION_DAMP*o-&gt;DxDt;
<a name="l565"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball)
<a name="l566"></a> </span><span class=cF5>Noise</span><span class=cF0>(10,74,86);
<a name="l567"></a> }
<a name="l568"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;x-o-&gt;radius&lt;COURT_BORDER) {
<a name="l569"></a> o-&gt;x=COURT_BORDER+o-&gt;radius;
<a name="l570"></a> o-&gt;DxDt=-COLLISION_DAMP*o-&gt;DxDt;
<a name="l571"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball)
<a name="l572"></a> </span><span class=cF5>Noise</span><span class=cF0>(10,74,86);
<a name="l573"></a> }
<a name="l574"></a>
<a name="l575"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;y+o-&gt;radius*2&gt;=</span><span class=cF7>(</span><span class=cF0>parent_task-&gt;pix_height-COURT_BORDER</span><span class=cF7>)</span><span class=cF0>*2) {
<a name="l576"></a> o-&gt;y=(parent_task-&gt;pix_height-COURT_BORDER)*2-1-o-&gt;radius*2;
<a name="l577"></a> o-&gt;DyDt=-COLLISION_DAMP*o-&gt;DyDt;
<a name="l578"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball)
<a name="l579"></a> </span><span class=cF5>Noise</span><span class=cF0>(10,74,86);
<a name="l580"></a> }
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;y-o-&gt;radius*2&lt;2*COURT_BORDER) {
<a name="l582"></a> o-&gt;y=COURT_BORDER*2+o-&gt;radius*2;
<a name="l583"></a> o-&gt;DyDt=-COLLISION_DAMP*o-&gt;DyDt;
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball)
<a name="l585"></a> </span><span class=cF5>Noise</span><span class=cF0>(10,74,86);
<a name="l586"></a> }
<a name="l587"></a>
<a name="l588"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;z-o-&gt;radius*2&lt;0) {
<a name="l589"></a> o-&gt;z=o-&gt;radius*2;
<a name="l590"></a> o-&gt;DzDt=-COLLISION_DAMP*o-&gt;DzDt;
<a name="l591"></a> </span><span class=cF1>if</span><span class=cF0> (o-&gt;DzDt&gt;ROLL_VELOCITY_THRESHOLD)
<a name="l592"></a> </span><span class=cF5>Noise</span><span class=cF0>(10,74,86);
<a name="l593"></a> </span><span class=cF1>if</span><span class=cF0> (o!=ball)
<a name="l594"></a> o-&gt;DzDt=0;
<a name="l595"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (o-&gt;z-o-&gt;radius*2&gt;0)
<a name="l596"></a> o-&gt;DzDt-=GRAVITY_ACCELERATION*dt;
<a name="l597"></a> </span><span class=cF1>if</span><span class=cF0> (o==ball) {
<a name="l598"></a> d=</span><span class=cF5>Exp</span><span class=cF0>(-AIR_VISCOSITY*dt);
<a name="l599"></a> o-&gt;DxDt*=d;
<a name="l600"></a> o-&gt;DyDt*=d;
<a name="l601"></a> o-&gt;DzDt*=d;
<a name="l602"></a> }
<a name="l603"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l604"></a> }
<a name="l605"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l606"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l607"></a>}
<a name="l608"></a>
<a name="l609"></a></span><span class=cF1>U0</span><span class=cF0> Init()
<a name="l610"></a>{
<a name="l611"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l612"></a> someone_shooting=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l613"></a> shot_land_t=0;
<a name="l614"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;objs,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>objs</span><span class=cF7>)</span><span class=cF0>);
<a name="l615"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;PER_SIDE_NUM*2;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l616"></a> objs[i].team=i&amp;1;
<a name="l617"></a> objs[i].x=</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2;
<a name="l618"></a> objs[i].y=2*</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2;
<a name="l619"></a> objs[i].next_img=objs[i].last_img=FIRST_RUNNING;
<a name="l620"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l621"></a> last_owner=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l622"></a> human=&amp;objs[0];
<a name="l623"></a> ball =&amp;objs[i];
<a name="l624"></a> ball-&gt;team=-1;
<a name="l625"></a> ball-&gt;x=0.5*</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width/2;
<a name="l626"></a> ball-&gt;y=0.5*2*</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height/2;
<a name="l627"></a> ball-&gt;radius=11;
<a name="l628"></a> ball-&gt;z=ball-&gt;radius;
<a name="l629"></a> score0=score1=0;
<a name="l630"></a> game_t_end=</span><span class=cF5>tS</span><span class=cF0>+3*60;
<a name="l631"></a> foul_t_end=0;
<a name="l632"></a>}
<a name="l633"></a>
<a name="l634"></a></span><span class=cF1>U0</span><span class=cF0> KeepAway()
<a name="l635"></a>{
<a name="l636"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2;
<a name="l637"></a>
<a name="l638"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>(
<a name="l639"></a> </span><span class=cF6>&quot;Pass or hand-off to your team to score points.$FG$\n\n&quot;</span><span class=cF0>
<a name="l640"></a> </span><span class=cF6>&quot;\t2 points for successful hand-off.\n&quot;</span><span class=cF0>
<a name="l641"></a> </span><span class=cF6>&quot;\t6 points for successful pass.\n&quot;</span><span class=cF0>
<a name="l642"></a> </span><span class=cF6>&quot;\t1 point penalty for foul.\n\n&quot;</span><span class=cF0>
<a name="l643"></a> </span><span class=cF6>&quot;Left-Click\tto pass.\n\n&quot;</span><span class=cF0>
<a name="l644"></a> </span><span class=cF6>&quot;Right-Click\tto jump.\n&quot;</span><span class=cF0>);
<a name="l645"></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="l646"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr=</span><span class=cF3>BLACK</span><span class=cF0>+</span><span class=cF3>YELLOW</span><span class=cF0>&lt;&lt;4;
<a name="l647"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit|=</span><span class=cF3>WIG_DBL_CLICK</span><span class=cF0>;
<a name="l648"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l649"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l650"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l651"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
<a name="l652"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l653"></a>
<a name="l654"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l655"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l656"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l657"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l658"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l659"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l660"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l661"></a> </span><span class=cF6>&quot; Shoot(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l662"></a> </span><span class=cF6>&quot; Jump(,'j');&quot;</span><span class=cF0>
<a name="l663"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l664"></a> );
<a name="l665"></a>
<a name="l666"></a> Init;
<a name="l667"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;draw_it=&amp;</span><span class=cF5>DrawIt</span><span class=cF0>;
<a name="l668"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;animate_task=</span><span class=cF5>Spawn</span><span class=cF0>(&amp;AnimateTask,</span><span class=cF5>Fs</span><span class=cF0>,</span><span class=cF6>&quot;Animate&quot;</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
<a name="l669"></a>
<a name="l670"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l671"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l672"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,
<a name="l673"></a> 1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>);
<a name="l674"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) </span><span class=cF7>{</span><span class=cF0>
<a name="l675"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
<a name="l676"></a>ka_shoot:
<a name="l677"></a> Shoot(human);
<a name="l678"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l679"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>:
<a name="l680"></a>ka_jump:
<a name="l681"></a> human-&gt;DzDt=JUMP_VELOCITY;
<a name="l682"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l683"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l684"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) {
<a name="l685"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l686"></a> Init;
<a name="l687"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l688"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'j'</span><span class=cF0>:
<a name="l689"></a> </span><span class=cF1>goto</span><span class=cF0> ka_jump;
<a name="l690"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l691"></a> </span><span class=cF1>goto</span><span class=cF0> ka_shoot;
<a name="l692"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l693"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l694"></a> </span><span class=cF1>goto</span><span class=cF0> ka_done;
<a name="l695"></a> }
<a name="l696"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l697"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l698"></a> }
<a name="l699"></a>ka_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
<a name="l700"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(,,1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
<a name="l701"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l702"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l703"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l704"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l705"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;TempleOS/KeepAway&quot;</span><span class=cF0>,</span><span class=cF6>&quot;I64 best_score0=%d,best_score1=%d;\n&quot;</span><span class=cF0>,
<a name="l706"></a> best_score0,best_score1);
<a name="l707"></a>}
</span></pre></body>
</html>