mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
1775 lines
188 KiB
HTML
Executable file
1775 lines
188 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.c00{color:#ffffff;background-color:#ffffff;}
|
|
.c0A{color:#82bc49;background-color:#ffffff;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> XMESSAGEF_ANTISPIN </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> XMESSAGEF_SOLAR_STORM </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a></span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>"ZealOS/XCaliber"</span><span class=cF0>,
|
|
<a name="l5"></a> </span><span class=cF6>"I64 best_score=0;\n"</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF6>"I64 message_flags=0;\n"</span><span class=cF0>);
|
|
<a name="l7"></a></span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>"ZealOS/XCaliber"</span><span class=cF0>);
|
|
<a name="l8"></a>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> MT_HUMAN_SHIP </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ENEMY_SHIP </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> MT_SOLAR_FLARE </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ION </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ANTIMATTER_BALL </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l14"></a>#</span><span class=cF1>define</span><span class=cF0> MT_ANTIMATTER_SPLAT </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> MT_MISSILE </span><span class=cFE>6</span><span class=cF0>
|
|
<a name="l16"></a>
|
|
<a name="l17"></a></span><span class=cF1>class</span><span class=cF0> MyMass:</span><span class=cF9>CMass</span><span class=cF0>
|
|
<a name="l18"></a>{
|
|
<a name="l19"></a> </span><span class=cF1>F64</span><span class=cF0> temperature, radius, die_timeout;
|
|
<a name="l20"></a> </span><span class=cF9>I64</span><span class=cF0> type;
|
|
<a name="l21"></a> </span><span class=cF1>Bool</span><span class=cF0> no_overlap;
|
|
<a name="l22"></a>};
|
|
<a name="l23"></a>
|
|
<a name="l24"></a></span><span class=cF1>class</span><span class=cF0> MySpring:</span><span class=cF9>CSpring</span><span class=cF0>
|
|
<a name="l25"></a>{
|
|
<a name="l26"></a> </span><span class=cF1>F64</span><span class=cF0> strength;
|
|
<a name="l27"></a> </span><span class=cF9>I64</span><span class=cF0> color;
|
|
<a name="l28"></a>};
|
|
<a name="l29"></a>
|
|
<a name="l30"></a>#</span><span class=cF1>define</span><span class=cF0> SPIN_GAIN </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0>
|
|
<a name="l31"></a>#</span><span class=cF1>define</span><span class=cF0> MASSES_NUM </span><span class=cFE>8</span><span class=cF0>
|
|
<a name="l32"></a>#</span><span class=cF1>define</span><span class=cF0> SPRINGS_NUM </span><span class=cFE>16</span><span class=cF0>
|
|
<a name="l33"></a>#</span><span class=cF1>define</span><span class=cF0> MISSILES_NUM </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l34"></a>#</span><span class=cF1>define</span><span class=cF0> ST_HUMAN1 </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l35"></a>#</span><span class=cF1>define</span><span class=cF0> ST_ENEMY1 </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l36"></a>#</span><span class=cF1>define</span><span class=cF0> ST_ENEMY2 </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l37"></a></span><span class=cF1>extern</span><span class=cF0> </span><span class=cF1>class</span><span class=cF0> Ship;
|
|
<a name="l38"></a>
|
|
<a name="l39"></a>#</span><span class=cF1>define</span><span class=cF0> MISSILE_LEN </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l40"></a></span><span class=cF1>class</span><span class=cF0> Missile
|
|
<a name="l41"></a>{
|
|
<a name="l42"></a> Missile *next, *last;
|
|
<a name="l43"></a> </span><span class=cF1>F64</span><span class=cF0> tons, fuse_time, die_timeout;
|
|
<a name="l44"></a> MyMass p_front, p_back;
|
|
<a name="l45"></a> MySpring s[</span><span class=cFE>5</span><span class=cF0>];
|
|
<a name="l46"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l47"></a> Ship *owner, *target;
|
|
<a name="l48"></a> </span><span class=cF1>Bool</span><span class=cF0> active, launched, exploding;
|
|
<a name="l49"></a> </span><span class=cF1>U8</span><span class=cF0> label[</span><span class=cFE>5</span><span class=cF0>];
|
|
<a name="l50"></a>
|
|
<a name="l51"></a>} missile_head;
|
|
<a name="l52"></a>
|
|
<a name="l53"></a></span><span class=cF1>class</span><span class=cF0> Ship
|
|
<a name="l54"></a>{
|
|
<a name="l55"></a> Ship *next, *last;
|
|
<a name="l56"></a> </span><span class=cF9>I64</span><span class=cF0> type, masses, springs;
|
|
<a name="l57"></a> MyMass p[MASSES_NUM];
|
|
<a name="l58"></a> MySpring s[SPRINGS_NUM];
|
|
<a name="l59"></a> </span><span class=cF1>F64</span><span class=cF0> fire_rate;
|
|
<a name="l60"></a> </span><span class=cF1>F64</span><span class=cF0> reload_timeout, spacewalk_timeout;
|
|
<a name="l61"></a> </span><span class=cF1>F64</span><span class=cF0> die_time, die_timeout;
|
|
<a name="l62"></a> </span><span class=cF9>I64</span><span class=cF0> spacewalk_side;
|
|
<a name="l63"></a> </span><span class=cF1>F64</span><span class=cF0> laser_temperature;
|
|
<a name="l64"></a> Missile missiles[MISSILES_NUM];
|
|
<a name="l65"></a> </span><span class=cF1>Bool</span><span class=cF0> lasering, exploding, laser_overheat;
|
|
<a name="l66"></a>
|
|
<a name="l67"></a>} ship_head, *human;
|
|
<a name="l68"></a>
|
|
<a name="l69"></a></span><span class=cF1>F64</span><span class=cF0> human_t_left, human_t_right, human_antispin;
|
|
<a name="l70"></a>
|
|
<a name="l71"></a></span><span class=cF1>class</span><span class=cF0> Shot
|
|
<a name="l72"></a>{
|
|
<a name="l73"></a> Shot *next, *last;
|
|
<a name="l74"></a> </span><span class=cF1>F64</span><span class=cF0> radius, fuse_time;
|
|
<a name="l75"></a> </span><span class=cF9>I64</span><span class=cF0> splats;
|
|
<a name="l76"></a> MyMass p;
|
|
<a name="l77"></a>
|
|
<a name="l78"></a>} shot_head;
|
|
<a name="l79"></a>
|
|
<a name="l80"></a></span><span class=cF1>F64</span><span class=cF0> t_solar_storm;
|
|
<a name="l81"></a></span><span class=cF1>Bool</span><span class=cF0> alarm;
|
|
<a name="l82"></a>
|
|
<a name="l83"></a>#</span><span class=cF1>define</span><span class=cF0> THRUST_MAX </span><span class=cFE>200</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l84"></a>#</span><span class=cF1>define</span><span class=cF0> ANTISPIN_MAX </span><span class=cFE>25</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l85"></a>#</span><span class=cF1>define</span><span class=cF0> SPACEWALK_TIME </span><span class=cFE>7</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l86"></a>
|
|
<a name="l87"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_NULL </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l88"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_SPIN_LEFT </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l89"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_SPIN_RIGHT </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l90"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_THRUST </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l91"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_FIRE </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l92"></a>#</span><span class=cF1>define</span><span class=cF0> CMD_EXIT </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l93"></a>
|
|
<a name="l94"></a></span><span class=cF1>Bool</span><span class=cF0> game_over, show_level_message;
|
|
<a name="l95"></a>
|
|
<a name="l96"></a>#</span><span class=cF1>define</span><span class=cF0> STARS_NUM </span><span class=cFE>100</span><span class=cF0>
|
|
<a name="l97"></a></span><span class=cF9>I64</span><span class=cF0> stars_x[STARS_NUM], stars_y[STARS_NUM];
|
|
<a name="l98"></a>
|
|
<a name="l99"></a></span><span class=cF9>CMathODE</span><span class=cF0> *ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l100"></a></span><span class=cF9>I64</span><span class=cF0> level, score, remaining;
|
|
<a name="l101"></a>
|
|
<a name="l102"></a></span><span class=c0A>
|
|
<a name="l103"></a><1>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l104"></a></span><span class=c0A>
|
|
<a name="l105"></a><2>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l106"></a></span><span class=c0A>
|
|
<a name="l107"></a><3>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l108"></a></span><span class=c0A>
|
|
<a name="l109"></a><4>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l110"></a>
|
|
<a name="l111"></a></span><span class=c0A>
|
|
<a name="l112"></a><5>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l113"></a></span><span class=c0A>
|
|
<a name="l114"></a><6>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l115"></a></span><span class=c0A>
|
|
<a name="l116"></a><7>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l117"></a></span><span class=c0A>
|
|
<a name="l118"></a><8>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l119"></a>
|
|
<a name="l120"></a></span><span class=cF0>
|
|
<a name="l121"></a></span><span class=cF2>//********************************** Ship</span><span class=cF0>
|
|
<a name="l122"></a></span><span class=cF1>Bool</span><span class=cF0> CheckOverlap()
|
|
<a name="l123"></a>{
|
|
<a name="l124"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
|
|
<a name="l125"></a> MyMass *tmpm, *tmpm1;
|
|
<a name="l126"></a>
|
|
<a name="l127"></a> tmpm = ode->next_mass;
|
|
<a name="l128"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l129"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l130"></a> tmpm1 = ode->next_mass;
|
|
<a name="l131"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l132"></a> {
|
|
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm != tmpm1 && !tmpm->no_overlap && !tmpm1->no_overlap)
|
|
<a name="l134"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l135"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm->x, &tmpm1->x);
|
|
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&p</span><span class=cF7>)</span><span class=cF0> <= </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm->radius + tmpm1->radius</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l137"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l139"></a> tmpm1 = tmpm1->next;
|
|
<a name="l140"></a> }
|
|
<a name="l141"></a> tmpm = tmpm->next;
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a>
|
|
<a name="l144"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l145"></a>}
|
|
<a name="l146"></a>
|
|
<a name="l147"></a></span><span class=cF1>U0</span><span class=cF0> MissileNew(Ship *tmpsp, </span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l148"></a>{
|
|
<a name="l149"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l150"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l151"></a> Missile *tmpmi = &tmpsp->missiles[n];
|
|
<a name="l152"></a>
|
|
<a name="l153"></a> </span><span class=cF5>MemSet</span><span class=cF0>(tmpmi, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Missile</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l154"></a>
|
|
<a name="l155"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&tmpmi->p_front.x,
|
|
<a name="l156"></a> </span><span class=cF7>(</span><span class=cF0>tmpsp->p[n + </span><span class=cFE>1</span><span class=cF0>].x + tmpsp->p[n + </span><span class=cFE>3</span><span class=cF0>].x</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l157"></a> </span><span class=cF7>(</span><span class=cF0>tmpsp->p[n + </span><span class=cFE>1</span><span class=cF0>].y + tmpsp->p[n + </span><span class=cFE>3</span><span class=cF0>].y</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l158"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmpmi->p_back.x, &tmpmi->p_front.x);
|
|
<a name="l159"></a>
|
|
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (n & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l161"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(tmpmi->label, </span><span class=cF6>"L"</span><span class=cF0>);
|
|
<a name="l162"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(tmpmi->label, </span><span class=cF6>"R"</span><span class=cF0>);
|
|
<a name="l164"></a> tmpmi->owner = tmpsp;
|
|
<a name="l165"></a> tmpmi->tons = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l166"></a> tmpmi->p_front.mass = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l167"></a> tmpmi->p_front.type = MT_MISSILE;
|
|
<a name="l168"></a> tmpmi->p_back.mass = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l169"></a> tmpmi->p_back.type = MT_MISSILE;
|
|
<a name="l170"></a> tmpmi->p_front.radius = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l171"></a> tmpmi->p_back.radius = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l172"></a> tmpmi->p_front.no_overlap = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l173"></a> tmpmi->p_back.no_overlap = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l174"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x);
|
|
<a name="l175"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x);
|
|
<a name="l176"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l177"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpmi->p_front.x, </span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&p1, &p), MISSILE_LEN / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l178"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&tmpmi->p_back.x , </span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&p1, &p), MISSILE_LEN / </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l179"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmpmi->p_front.DxDt, &tmpsp->p[n].DxDt);
|
|
<a name="l180"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmpmi->p_back.DxDt, &tmpsp->p[n].DxDt);
|
|
<a name="l181"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpmi->p_front, ode->last_mass);
|
|
<a name="l182"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpmi->p_back, ode->last_mass);
|
|
<a name="l183"></a>
|
|
<a name="l184"></a> tmpmi->s[</span><span class=cFE>0</span><span class=cF0>].end1 = &tmpmi->p_front;
|
|
<a name="l185"></a> tmpmi->s[</span><span class=cFE>0</span><span class=cF0>].end2 = &tmpmi->p_back;
|
|
<a name="l186"></a> tmpmi->s[</span><span class=cFE>1</span><span class=cF0>].end1 = &tmpmi->p_front;
|
|
<a name="l187"></a> tmpmi->s[</span><span class=cFE>1</span><span class=cF0>].end2 = &tmpsp->p[n + </span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l188"></a> tmpmi->s[</span><span class=cFE>2</span><span class=cF0>].end1 = &tmpmi->p_back;
|
|
<a name="l189"></a> tmpmi->s[</span><span class=cFE>2</span><span class=cF0>].end2 = &tmpsp->p[n + </span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l190"></a> tmpmi->s[</span><span class=cFE>3</span><span class=cF0>].end1 = &tmpmi->p_front;
|
|
<a name="l191"></a> tmpmi->s[</span><span class=cFE>3</span><span class=cF0>].end2 = &tmpsp->p[n + </span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l192"></a> tmpmi->s[</span><span class=cFE>4</span><span class=cF0>].end1 = &tmpmi->p_back;
|
|
<a name="l193"></a> tmpmi->s[</span><span class=cFE>4</span><span class=cF0>].end2 = &tmpsp->p[n + </span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l194"></a>
|
|
<a name="l195"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>5</span><span class=cF0>; i++)
|
|
<a name="l196"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l197"></a> tmpmi->s[i].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l198"></a> tmpmi->s[i].strength = </span><span class=cFE>20000</span><span class=cF0>;
|
|
<a name="l199"></a> tmpmi->s[i].color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l200"></a> tmpmi->s[i].rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmpmi->s[i].end1->x, &tmpmi->s[i].end2->x);
|
|
<a name="l201"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpmi->s[i], ode->last_spring);
|
|
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l203"></a> tmpmi->img = </span><span class=cFA><7></span><span class=cF0>;
|
|
<a name="l204"></a> tmpmi->active = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l205"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpmi, missile_head.last);
|
|
<a name="l206"></a>}
|
|
<a name="l207"></a>
|
|
<a name="l208"></a>Ship *ShipNew(</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> type)
|
|
<a name="l209"></a>{
|
|
<a name="l210"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l211"></a> Ship *tmpsp = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Ship</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l212"></a>
|
|
<a name="l213"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp->type=type)
|
|
<a name="l214"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l215"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
|
|
<a name="l216"></a> tmpsp->fire_rate = </span><span class=cFE>25</span><span class=cF0>;
|
|
<a name="l217"></a> tmpsp->masses = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l218"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x = x;
|
|
<a name="l219"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y = y;
|
|
<a name="l220"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x = x + </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l221"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].y = y + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l222"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x = x - </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l223"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].y = y + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l224"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].x = x + </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l225"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].y = y + </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l226"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].x = x - </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l227"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].y = y + </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l228"></a>
|
|
<a name="l229"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l230"></a> {
|
|
<a name="l231"></a> tmpsp->p[i].mass = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l232"></a> tmpsp->p[i].type = MT_HUMAN_SHIP;
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (i < </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l234"></a> tmpsp->p[i].radius = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l236"></a> tmpsp->p[i].radius = </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l237"></a> tmpsp->p[i].drag_profile_factor = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l238"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->p[i], ode->last_mass);
|
|
<a name="l239"></a> }
|
|
<a name="l240"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].mass /= </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l241"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].mass /= </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l242"></a>
|
|
<a name="l243"></a> tmpsp->springs = </span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l244"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l245"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l246"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l247"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l248"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l249"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l250"></a> tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l251"></a> tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l252"></a> tmpsp->s[</span><span class=cFE>4</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l253"></a> tmpsp->s[</span><span class=cFE>4</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l254"></a> tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l255"></a> tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>4</span><span class=cF0>];
|
|
<a name="l256"></a> tmpsp->s[</span><span class=cFE>6</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l257"></a> tmpsp->s[</span><span class=cFE>6</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>4</span><span class=cF0>];
|
|
<a name="l258"></a>
|
|
<a name="l259"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l260"></a> {
|
|
<a name="l261"></a> tmpsp->s[i].rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmpsp->s[i].end1->x, &tmpsp->s[i].end2->x);
|
|
<a name="l262"></a> tmpsp->s[i].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l263"></a> tmpsp->s[i].strength = </span><span class=cFE>30000</span><span class=cF0>;
|
|
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (i <= </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l265"></a> tmpsp->s[i].color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l267"></a> tmpsp->s[i].color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l268"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->s[i], ode->last_spring);
|
|
<a name="l269"></a> }
|
|
<a name="l270"></a> MissileNew(tmpsp, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l271"></a> MissileNew(tmpsp, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l272"></a> remaining = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l273"></a>
|
|
<a name="l274"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l275"></a>
|
|
<a name="l276"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY1:
|
|
<a name="l277"></a> tmpsp->fire_rate = </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l278"></a> tmpsp->masses = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l279"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x = x;
|
|
<a name="l280"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y = y;
|
|
<a name="l281"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x = x + </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l282"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].y = y;
|
|
<a name="l283"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x = x;
|
|
<a name="l284"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].y = y + </span><span class=cFE>15</span><span class=cF0>;
|
|
<a name="l285"></a>
|
|
<a name="l286"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l287"></a> {
|
|
<a name="l288"></a> tmpsp->p[i].mass = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l289"></a> tmpsp->p[i].type = MT_ENEMY_SHIP;
|
|
<a name="l290"></a> tmpsp->p[i].radius = </span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l291"></a> tmpsp->p[i].drag_profile_factor = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l292"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->p[i], ode->last_mass);
|
|
<a name="l293"></a> }
|
|
<a name="l294"></a>
|
|
<a name="l295"></a> tmpsp->springs = </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l296"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l297"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l298"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l299"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l300"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l301"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l302"></a>
|
|
<a name="l303"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l304"></a> {
|
|
<a name="l305"></a> tmpsp->s[i].rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmpsp->s[i].end1->x, &tmpsp->s[i].end2->x);
|
|
<a name="l306"></a> tmpsp->s[i].const = </span><span class=cFE>10000</span><span class=cF0>;
|
|
<a name="l307"></a> tmpsp->s[i].strength = </span><span class=cFE>20000</span><span class=cF0>;
|
|
<a name="l308"></a> tmpsp->s[i].color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l309"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->s[i], ode->last_spring);
|
|
<a name="l310"></a> }
|
|
<a name="l311"></a> remaining++;
|
|
<a name="l312"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l313"></a>
|
|
<a name="l314"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY2:
|
|
<a name="l315"></a> tmpsp->fire_rate = </span><span class=cFE>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l316"></a> tmpsp->masses = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l317"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x = x;
|
|
<a name="l318"></a> tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y = y;
|
|
<a name="l319"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x = x - </span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l320"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].y = y + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l321"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x = x + </span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l322"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].y = y + </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l323"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].x = x - </span><span class=cFE>14</span><span class=cF0>;
|
|
<a name="l324"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].y = y + </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l325"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].x = x + </span><span class=cFE>14</span><span class=cF0>;
|
|
<a name="l326"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].y = y + </span><span class=cFE>20</span><span class=cF0>;
|
|
<a name="l327"></a>
|
|
<a name="l328"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l329"></a> {
|
|
<a name="l330"></a> tmpsp->p[i].mass = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l331"></a> tmpsp->p[i].type = MT_ENEMY_SHIP;
|
|
<a name="l332"></a> tmpsp->p[i].radius = </span><span class=cFE>6</span><span class=cF0>;
|
|
<a name="l333"></a> tmpsp->p[i].drag_profile_factor = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l334"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->p[i], ode->last_mass);
|
|
<a name="l335"></a> }
|
|
<a name="l336"></a>
|
|
<a name="l337"></a> tmpsp->springs = </span><span class=cFE>7</span><span class=cF0>;
|
|
<a name="l338"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l339"></a> tmpsp->s[</span><span class=cFE>0</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l340"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l341"></a> tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l342"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l343"></a> tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l344"></a> tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l345"></a> tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l346"></a> tmpsp->s[</span><span class=cFE>4</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l347"></a> tmpsp->s[</span><span class=cFE>4</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>4</span><span class=cF0>];
|
|
<a name="l348"></a> tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l349"></a> tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l350"></a> tmpsp->s[</span><span class=cFE>6</span><span class=cF0>].end1 = &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>];
|
|
<a name="l351"></a> tmpsp->s[</span><span class=cFE>6</span><span class=cF0>].end2 = &tmpsp->p[</span><span class=cFE>4</span><span class=cF0>];
|
|
<a name="l352"></a>
|
|
<a name="l353"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l354"></a> {
|
|
<a name="l355"></a> tmpsp->s[i].rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmpsp->s[i].end1->x, &tmpsp->s[i].end2->x);
|
|
<a name="l356"></a> tmpsp->s[i].const = </span><span class=cFE>40000</span><span class=cF0>;
|
|
<a name="l357"></a> tmpsp->s[i].strength = </span><span class=cFE>75000</span><span class=cF0>;
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (i >= </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l359"></a> tmpsp->s[i].color = </span><span class=cF3>LTPURPLE</span><span class=cF0>;
|
|
<a name="l360"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l361"></a> tmpsp->s[i].color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l362"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmpsp->s[i], ode->last_spring);
|
|
<a name="l363"></a> }
|
|
<a name="l364"></a> remaining++;
|
|
<a name="l365"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l366"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l367"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpsp, ship_head.last);
|
|
<a name="l368"></a>
|
|
<a name="l369"></a> </span><span class=cF1>return</span><span class=cF0> tmpsp;
|
|
<a name="l370"></a>}
|
|
<a name="l371"></a>
|
|
<a name="l372"></a></span><span class=cF1>U0</span><span class=cF0> MissileDel(Missile *tmpmi)
|
|
<a name="l373"></a>{
|
|
<a name="l374"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l375"></a>
|
|
<a name="l376"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->active)
|
|
<a name="l377"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l378"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpmi);
|
|
<a name="l379"></a> </span><span class=cF1>for</span><span class=cF0>(i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>5</span><span class=cF0>; i++)
|
|
<a name="l380"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmpmi->s[i]);
|
|
<a name="l381"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmpmi->p_front);
|
|
<a name="l382"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmpmi->p_back);
|
|
<a name="l383"></a> tmpmi->active = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l384"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l385"></a>}
|
|
<a name="l386"></a>
|
|
<a name="l387"></a></span><span class=cF1>U0</span><span class=cF0> ShipDel(Ship *tmpsp)
|
|
<a name="l388"></a>{
|
|
<a name="l389"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l390"></a>
|
|
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp)
|
|
<a name="l392"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l393"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l394"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmpsp->p[i]);
|
|
<a name="l395"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l396"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmpsp->s[i]);
|
|
<a name="l397"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>2</span><span class=cF0>; i++)
|
|
<a name="l398"></a> MissileDel(&tmpsp->missiles[i]);
|
|
<a name="l399"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpsp);
|
|
<a name="l400"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpsp);
|
|
<a name="l401"></a> remaining--;
|
|
<a name="l402"></a>}
|
|
<a name="l403"></a>
|
|
<a name="l404"></a></span><span class=cF1>U0</span><span class=cF0> PlaceShip(</span><span class=cF9>I64</span><span class=cF0> type)
|
|
<a name="l405"></a>{
|
|
<a name="l406"></a> Ship *tmpsp;
|
|
<a name="l407"></a>
|
|
<a name="l408"></a> </span><span class=cF1>if</span><span class=cF0> (CheckOverlap)
|
|
<a name="l409"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l410"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l411"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l412"></a> tmpsp = ShipNew(</span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->pix_width - </span><span class=cFE>20</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->pix_height - </span><span class=cFE>20</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>10</span><span class=cF0>, type);
|
|
<a name="l413"></a> </span><span class=cF1>if</span><span class=cF0> (CheckOverlap)
|
|
<a name="l414"></a> ShipDel(tmpsp);
|
|
<a name="l415"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l416"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l417"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l418"></a>}
|
|
<a name="l419"></a>
|
|
<a name="l420"></a></span><span class=cF2>//********************************** Human Ship</span><span class=cF0>
|
|
<a name="l421"></a>
|
|
<a name="l422"></a></span><span class=cF9>I64</span><span class=cF0> Tweaked()
|
|
<a name="l423"></a>{
|
|
<a name="l424"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l425"></a> </span><span class=cF1>if</span><span class=cF0> (human)
|
|
<a name="l426"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l427"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>1</span><span class=cF0>].x);
|
|
<a name="l428"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>2</span><span class=cF0>].x);
|
|
<a name="l429"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l430"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>3</span><span class=cF0>].x);
|
|
<a name="l431"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>4</span><span class=cF0>].x);
|
|
<a name="l432"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&p1);
|
|
<a name="l433"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&p2);
|
|
<a name="l434"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>3</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&p, &p1</span><span class=cF7>)</span><span class=cF0> > </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cFE>20</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l435"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l436"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>5</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&p, &p2</span><span class=cF7>)</span><span class=cF0> > </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cFE>20</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l437"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l438"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l440"></a>}
|
|
<a name="l441"></a>
|
|
<a name="l442"></a></span><span class=cF1>U0</span><span class=cF0> AllDel(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
|
|
<a name="l443"></a>{
|
|
<a name="l444"></a> Ship *tmpsp, *tmpsp1;
|
|
<a name="l445"></a>
|
|
<a name="l446"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(ode);
|
|
<a name="l447"></a> tmpsp = ship_head.next;
|
|
<a name="l448"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l449"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l450"></a> tmpsp1 = tmpsp->next;
|
|
<a name="l451"></a> ShipDel(tmpsp);
|
|
<a name="l452"></a> tmpsp = tmpsp1;
|
|
<a name="l453"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l454"></a> human = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l455"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&shot_head, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l456"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
|
|
<a name="l457"></a>}
|
|
<a name="l458"></a>
|
|
<a name="l459"></a></span><span class=cF1>Bool</span><span class=cF0> LaserPlot(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l460"></a>{
|
|
<a name="l461"></a> </span><span class=cF9>I64</span><span class=cF0> c;
|
|
<a name="l462"></a>
|
|
<a name="l463"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(dc, x, y);
|
|
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (c != </span><span class=cF3>BLACK</span><span class=cF0> && c != </span><span class=cF3>WHITE</span><span class=cF0>)
|
|
<a name="l465"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l466"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l467"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l468"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, x, y);
|
|
<a name="l469"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l470"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l471"></a>}
|
|
<a name="l472"></a>
|
|
<a name="l473"></a></span><span class=cF2>//**********************************</span><span class=cF0>
|
|
<a name="l474"></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="l475"></a>{
|
|
<a name="l476"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l477"></a> </span><span class=cF1>F64</span><span class=cF0> arg;
|
|
<a name="l478"></a> Ship *tmpsp;
|
|
<a name="l479"></a> Shot *tmps;
|
|
<a name="l480"></a> Missile *tmpmi;
|
|
<a name="l481"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l482"></a> </span><span class=cF1>F64</span><span class=cF0> t_left, t_right, spin, d, x, y;
|
|
<a name="l483"></a> MySpring *tmpsps;
|
|
<a name="l484"></a> MyMass *tmpm;
|
|
<a name="l485"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l486"></a> </span><span class=cF1>Bool</span><span class=cF0> draw_laser_line = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l487"></a>
|
|
<a name="l488"></a> </span><span class=cF1>if</span><span class=cF0> (ode != task->last_ode)
|
|
<a name="l489"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l490"></a>
|
|
<a name="l491"></a> dc->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l492"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Level:%d Score:%d High Score:%d"</span><span class=cF0>, level, score, best_score);
|
|
<a name="l493"></a> </span><span class=cF1>if</span><span class=cF0> (game_over)
|
|
<a name="l494"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l495"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l496"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>task->pix_width - </span><span class=cFE>9</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l497"></a> </span><span class=cF7>(</span><span class=cF0>task->pix_height - </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>"Game Over"</span><span class=cF0>);
|
|
<a name="l498"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l499"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (show_level_message)
|
|
<a name="l500"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l501"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Blink</span><span class=cF0>)
|
|
<a name="l502"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>task->pix_width - </span><span class=cFE>8</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l503"></a> </span><span class=cF7>(</span><span class=cF0>task->pix_height - </span><span class=cF3>FONT_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>50</span><span class=cF0>, </span><span class=cF6>"Level %d"</span><span class=cF0>, level);
|
|
<a name="l504"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l505"></a>
|
|
<a name="l506"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < STARS_NUM; i++)
|
|
<a name="l507"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, stars_x[i], stars_y[i]);
|
|
<a name="l508"></a>
|
|
<a name="l509"></a> tmpm = ode->next_mass;
|
|
<a name="l510"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l511"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l512"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_ANTIMATTER_SPLAT)
|
|
<a name="l513"></a> {
|
|
<a name="l514"></a> dc->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l515"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, tmpm->x, tmpm->y);
|
|
<a name="l516"></a> }
|
|
<a name="l517"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_ION)
|
|
<a name="l518"></a> {
|
|
<a name="l519"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l520"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, tmpm->x, tmpm->y);
|
|
<a name="l521"></a> }
|
|
<a name="l522"></a> tmpm = tmpm->next;
|
|
<a name="l523"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l524"></a>
|
|
<a name="l525"></a> tmpsps = ode->next_spring;
|
|
<a name="l526"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsps != &ode->next_spring)
|
|
<a name="l527"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l528"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsps->flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0> && tmpsps->color)
|
|
<a name="l529"></a> {
|
|
<a name="l530"></a> dc->color = tmpsps->color;
|
|
<a name="l531"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, tmpsps->end1->x, tmpsps->end1->y, tmpsps->end2->x, tmpsps->end2->y);
|
|
<a name="l532"></a> }
|
|
<a name="l533"></a> tmpsps = tmpsps->next;
|
|
<a name="l534"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l535"></a>
|
|
<a name="l536"></a> tmpmi = missile_head.next;
|
|
<a name="l537"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi != &missile_head)
|
|
<a name="l538"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l539"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->active)
|
|
<a name="l540"></a> {
|
|
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->launched && tmpmi->exploding)
|
|
<a name="l542"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l543"></a> d = (</span><span class=cF5>tS</span><span class=cF0>-tmpmi->fuse_time) / (tmpmi->die_timeout - tmpmi->fuse_time);
|
|
<a name="l544"></a> d = </span><span class=cFE>70</span><span class=cF0> *</span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF3>pi</span><span class=cF0> * d) * tmpmi->tons + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l545"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < d; i++)
|
|
<a name="l546"></a> {
|
|
<a name="l547"></a> </span><span class=cF1>if</span><span class=cF0> (i & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l548"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l549"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l550"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l551"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpmi->p_front.x, tmpmi->p_front.y, i);
|
|
<a name="l552"></a> }
|
|
<a name="l553"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l554"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l555"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>tmpmi->p_front.x + tmpmi->p_back.x</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l556"></a> </span><span class=cF7>(</span><span class=cF0>tmpmi->p_front.y + tmpmi->p_back.y</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpmi->img,
|
|
<a name="l557"></a> </span><span class=cF5>Arg</span><span class=cF7>(</span><span class=cF0>tmpmi->p_front.x - tmpmi->p_back.x,
|
|
<a name="l558"></a> tmpmi->p_front.y - tmpmi->p_back.y</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l559"></a> }
|
|
<a name="l560"></a> tmpmi = tmpmi->next;
|
|
<a name="l561"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l562"></a>
|
|
<a name="l563"></a> tmpsp = ship_head.next;
|
|
<a name="l564"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l565"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l566"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp->exploding)
|
|
<a name="l567"></a> {
|
|
<a name="l568"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp->type)
|
|
<a name="l569"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l570"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
|
|
<a name="l571"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->spacewalk_side)
|
|
<a name="l572"></a> {
|
|
<a name="l573"></a> t_left = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l574"></a> t_right = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l575"></a> }
|
|
<a name="l576"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l577"></a> {
|
|
<a name="l578"></a> </span><span class=cF1>if</span><span class=cF0> (d = </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l579"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l580"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].DxDt, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].DxDt);
|
|
<a name="l581"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l582"></a> spin = p.z / d;
|
|
<a name="l583"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l584"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l585"></a> spin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l586"></a> t_left = </span><span class=cF5>Clamp</span><span class=cF0>(human_t_left + SPIN_GAIN * spin * human_antispin, </span><span class=cFE>0</span><span class=cF0>, THRUST_MAX);
|
|
<a name="l587"></a>
|
|
<a name="l588"></a> </span><span class=cF1>if</span><span class=cF0> (d = </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l589"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l590"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].DxDt, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].DxDt);
|
|
<a name="l591"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l592"></a> spin = p.z / d;
|
|
<a name="l593"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l594"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l595"></a> spin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l596"></a> t_right = </span><span class=cF5>Clamp</span><span class=cF0>(human_t_right - SPIN_GAIN * spin * human_antispin, </span><span class=cFE>0</span><span class=cF0>, THRUST_MAX);
|
|
<a name="l597"></a> }
|
|
<a name="l598"></a>
|
|
<a name="l599"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l600"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l601"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l602"></a>
|
|
<a name="l603"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l604"></a> {
|
|
<a name="l605"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l606"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3Mul</span><span class=cF7>(</span><span class=cF0>&p1, t_left / </span><span class=cFE>25</span><span class=cF0>, &p</span><span class=cF7>)</span><span class=cF0>, &tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].x);
|
|
<a name="l607"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].y, p1.x, p1.y);
|
|
<a name="l608"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p.x, p.y);
|
|
<a name="l609"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><thruster></span><span class=cF0>, arg);
|
|
<a name="l610"></a> }
|
|
<a name="l611"></a>
|
|
<a name="l612"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l613"></a> {
|
|
<a name="l614"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l615"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3Mul</span><span class=cF7>(</span><span class=cF0>&p2, t_right / </span><span class=cFE>25</span><span class=cF0>, &p</span><span class=cF7>)</span><span class=cF0>, &tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].x);
|
|
<a name="l616"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].y, p2.x, p2.y);
|
|
<a name="l617"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p.x, p.y);
|
|
<a name="l618"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><thruster></span><span class=cF0>, arg);
|
|
<a name="l619"></a> }
|
|
<a name="l620"></a>
|
|
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmpsp->reload_timeout)
|
|
<a name="l622"></a> img = </span><span class=cFA><gun_ready></span><span class=cF0>;
|
|
<a name="l623"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l624"></a> img = </span><span class=cFA><gun_busy></span><span class=cF0>;
|
|
<a name="l625"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p.x, p.y);
|
|
<a name="l626"></a> </span><span class=cF1>switch</span><span class=cF0> (level)
|
|
<a name="l627"></a> {
|
|
<a name="l628"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>:
|
|
<a name="l629"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l630"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l631"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l632"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l633"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
|
<a name="l634"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>1</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l635"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l636"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>2</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l637"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l638"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
|
<a name="l639"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l640"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l641"></a>
|
|
<a name="l642"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l643"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><Laser></span><span class=cF0>, arg);
|
|
<a name="l644"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->lasering && !tmpsp->laser_overheat)
|
|
<a name="l645"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l646"></a> draw_laser_line = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l647"></a> </span><span class=cF5>Sound</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l648"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l649"></a> }
|
|
<a name="l650"></a>
|
|
<a name="l651"></a> ctrl_panel.laser_temperature = tmpsp->laser_temperature;
|
|
<a name="l652"></a>
|
|
<a name="l653"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->spacewalk_side)
|
|
<a name="l654"></a> {
|
|
<a name="l655"></a> d = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - (tmpsp->spacewalk_timeout - </span><span class=cF5>tS</span><span class=cF0>) / SPACEWALK_TIME;
|
|
<a name="l656"></a> </span><span class=cF1>if</span><span class=cF0> (d > </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l657"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l658"></a> tmpsp->spacewalk_side = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l659"></a> ctrl_panel.spacewalk = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l660"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l661"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l662"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l663"></a> </span><span class=cF1>if</span><span class=cF0> (d < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
|
|
<a name="l664"></a> {
|
|
<a name="l665"></a> d = d * </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l666"></a> x = tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x * (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - d) + tmpsp->p[tmpsp->spacewalk_side].x * (d);
|
|
<a name="l667"></a> y = tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y * (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - d) + tmpsp->p[tmpsp->spacewalk_side].y * (d);
|
|
<a name="l668"></a> }
|
|
<a name="l669"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l670"></a> {
|
|
<a name="l671"></a> d = (d - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>) * </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l672"></a> x = tmpsp->p[tmpsp->spacewalk_side].x * (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - d) + tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x * (d);
|
|
<a name="l673"></a> y = tmpsp->p[tmpsp->spacewalk_side].y * (</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - d) + tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y * (d);
|
|
<a name="l674"></a> }
|
|
<a name="l675"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, x, y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><spacewalk></span><span class=cF0>, arg + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>75</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF5>tS</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l676"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l677"></a> }
|
|
<a name="l678"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l679"></a> {
|
|
<a name="l680"></a> </span><span class=cF1>if</span><span class=cF0> (ctrl_panel.spacewalk)
|
|
<a name="l681"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->spacewalk_side = Tweaked)
|
|
<a name="l683"></a> tmpsp->spacewalk_timeout = </span><span class=cF5>tS</span><span class=cF0> + SPACEWALK_TIME;
|
|
<a name="l684"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l685"></a> ctrl_panel.spacewalk = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l686"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l687"></a> }
|
|
<a name="l688"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l689"></a>
|
|
<a name="l690"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY2:
|
|
<a name="l691"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>3</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l692"></a> {
|
|
<a name="l693"></a> dc->color = </span><span class=cF3>PURPLE</span><span class=cF0>;
|
|
<a name="l694"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpsp->p[i].x, tmpsp->p[i].y, tmpsp->p[i].radius);
|
|
<a name="l695"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmpsp->p[i].x, tmpsp->p[i].y + </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l696"></a> dc->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l697"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpsp->p[i].x, tmpsp->p[i].y, tmpsp->p[i].radius);
|
|
<a name="l698"></a> }
|
|
<a name="l699"></a>
|
|
<a name="l700"></a> </span><span class=cF1>case</span><span class=cF0> ST_ENEMY1:
|
|
<a name="l701"></a> </span><span class=cF5>D3DivEqu</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&p1, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l702"></a> </span><span class=cF5>D3DivEqu</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&p2, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l703"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l704"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmpsp->reload_timeout)
|
|
<a name="l705"></a> img = </span><span class=cFA><gun_ready></span><span class=cF0>;
|
|
<a name="l706"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l707"></a> img = </span><span class=cFA><gun_busy></span><span class=cF0>;
|
|
<a name="l708"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p.x, p.y);
|
|
<a name="l709"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y, </span><span class=cFE>0</span><span class=cF0>, img, arg);
|
|
<a name="l710"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p1.x, p1.y);
|
|
<a name="l711"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x + p1.x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y + p1.y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><EnemySide></span><span class=cF0>, arg);
|
|
<a name="l712"></a> arg = </span><span class=cF5>Arg</span><span class=cF0>(p2.x, p2.y);
|
|
<a name="l713"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x + p2.x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y + p2.y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><EnemySide></span><span class=cF0>, arg);
|
|
<a name="l714"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<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 = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l717"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l718"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l719"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->p[i].temperature >= </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l720"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpsp->p[i].x, tmpsp->p[i].y, tmpsp->p[i].temperature);
|
|
<a name="l721"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l722"></a> }
|
|
<a name="l723"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpsp->die_time <= </span><span class=cF5>tS</span><span class=cF0> <= tmpsp->die_timeout)
|
|
<a name="l724"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < tmpsp->masses; j++)
|
|
<a name="l725"></a> {
|
|
<a name="l726"></a> d = (</span><span class=cF5>tS</span><span class=cF0> - tmpsp->die_time) / (tmpsp->die_timeout - tmpsp->die_time);
|
|
<a name="l727"></a> d = </span><span class=cFE>7</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF3>pi</span><span class=cF0> * d) * (</span><span class=cFE>6</span><span class=cF0> + j) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l728"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < d; i++)
|
|
<a name="l729"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l730"></a> </span><span class=cF1>if</span><span class=cF0> (i & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l731"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l732"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l733"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l734"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpsp->p[j].x, tmpsp->p[j].y, i);
|
|
<a name="l735"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l736"></a> }
|
|
<a name="l737"></a> tmpsp = tmpsp->next;
|
|
<a name="l738"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l739"></a>
|
|
<a name="l740"></a> tmps = shot_head.next;
|
|
<a name="l741"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &shot_head)
|
|
<a name="l742"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l743"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->radius < </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l744"></a> {
|
|
<a name="l745"></a> dc->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l746"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc, tmps->p.x, tmps->p.y);
|
|
<a name="l747"></a> }
|
|
<a name="l748"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l749"></a> {
|
|
<a name="l750"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l751"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmps->p.x, tmps->p.y, tmps->radius);
|
|
<a name="l752"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->radius >= </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l753"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmps->p.x, tmps->p.y, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l754"></a> dc->color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
|
|
<a name="l755"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmps->p.x, tmps->p.y, tmps->radius);
|
|
<a name="l756"></a> }
|
|
<a name="l757"></a> tmps = tmps->next;
|
|
<a name="l758"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l759"></a>
|
|
<a name="l760"></a> </span><span class=cF1>if</span><span class=cF0> (human && draw_laser_line)
|
|
<a name="l761"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l762"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>1</span><span class=cF0>].x, &human->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l763"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &human->p[</span><span class=cFE>2</span><span class=cF0>].x, &human->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l764"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l765"></a> dc->color = </span><span class=cF3>LTBLUE</span><span class=cF0>;
|
|
<a name="l766"></a> </span><span class=cF5>Line</span><span class=cF0>(dc, human->p[</span><span class=cFE>0</span><span class=cF0>].x - </span><span class=cFE>10</span><span class=cF0> * p.x, human->p[</span><span class=cFE>0</span><span class=cF0>].y - </span><span class=cFE>10</span><span class=cF0> * p.y, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l767"></a> human->p[</span><span class=cFE>0</span><span class=cF0>].x - </span><span class=cFE>800</span><span class=cF0> * p.x, human->p[</span><span class=cFE>0</span><span class=cF0>].y - </span><span class=cFE>800</span><span class=cF0> * p.y, </span><span class=cFE>0</span><span class=cF0>, &LaserPlot);
|
|
<a name="l768"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l769"></a>
|
|
<a name="l770"></a> tmpmi = missile_head.next;
|
|
<a name="l771"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi != &missile_head)
|
|
<a name="l772"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l773"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp = tmpmi->target)
|
|
<a name="l774"></a> {
|
|
<a name="l775"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l776"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y, </span><span class=cFE>10</span><span class=cF0>);
|
|
<a name="l777"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x + </span><span class=cFE>12</span><span class=cF0>, tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].y - </span><span class=cFE>4</span><span class=cF0>, tmpmi->label);
|
|
<a name="l778"></a> }
|
|
<a name="l779"></a> tmpmi = tmpmi->next;
|
|
<a name="l780"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l781"></a>}
|
|
<a name="l782"></a>
|
|
<a name="l783"></a></span><span class=cF1>U0</span><span class=cF0> Explosion(MyMass *tmpm1, MyMass *tmpm2, </span><span class=cF1>F64</span><span class=cF0> tons)
|
|
<a name="l784"></a>{
|
|
<a name="l785"></a> MyMass *tmpm;
|
|
<a name="l786"></a> </span><span class=cF9>CD3</span><span class=cF0> p1;
|
|
<a name="l787"></a> </span><span class=cF1>F64</span><span class=cF0> d;
|
|
<a name="l788"></a>
|
|
<a name="l789"></a> tmpm = ode->next_mass;
|
|
<a name="l790"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l791"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l792"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm != tmpm1 && tmpm != tmpm2)
|
|
<a name="l793"></a> {
|
|
<a name="l794"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpm->state->x, &tmpm1->state->x);
|
|
<a name="l795"></a> d=</span><span class=cF5>D3NormSqr</span><span class=cF0>(&p1) - tmpm->radius * tmpm->radius;
|
|
<a name="l796"></a> </span><span class=cF1>if</span><span class=cF0> (d < </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l797"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l798"></a> </span><span class=cF1>if</span><span class=cF0> (d < </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l799"></a> d = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l800"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l801"></a> d = </span><span class=cF5>Sqrt</span><span class=cF0>(d);
|
|
<a name="l802"></a> d = </span><span class=cFE>250000</span><span class=cF0> * tons / d ` </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l803"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p1, d);
|
|
<a name="l804"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpm->DstateDt->DxDt, &p1);
|
|
<a name="l805"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l806"></a> }
|
|
<a name="l807"></a> tmpm = tmpm->next;
|
|
<a name="l808"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l809"></a>}
|
|
<a name="l810"></a>
|
|
<a name="l811"></a>Ship TargetGet(Missile *tmpmi)
|
|
<a name="l812"></a>{
|
|
<a name="l813"></a> Ship *tmpsp, *res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l814"></a> </span><span class=cF1>F64</span><span class=cF0> dd, best_dd = </span><span class=cF3>F64_MAX</span><span class=cF0>;
|
|
<a name="l815"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l816"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l817"></a>
|
|
<a name="l818"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&p, &tmpmi->p_front.state->x, &tmpmi->p_back.state->x</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l819"></a> tmpsp = ship_head.next;
|
|
<a name="l820"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l821"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l822"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp->exploding && tmpsp != tmpmi->owner)
|
|
<a name="l823"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l824"></a> {
|
|
<a name="l825"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[i].state->x, &tmpmi->p_front.state->x);
|
|
<a name="l826"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Copy</span><span class=cF7>(</span><span class=cF0>&p2, &p1</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l827"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p1, &p, &p2);
|
|
<a name="l828"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&p, &p2</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>0</span><span class=cF0> && </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF0>&p1</span><span class=cF7>)</span><span class=cF0> <= </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>16</span><span class=cF0>)
|
|
<a name="l829"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l830"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p1);
|
|
<a name="l831"></a> </span><span class=cF1>if</span><span class=cF0> (dd < best_dd)
|
|
<a name="l832"></a> {
|
|
<a name="l833"></a> best_dd = dd;
|
|
<a name="l834"></a> res = tmpsp;
|
|
<a name="l835"></a> }
|
|
<a name="l836"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l837"></a> }
|
|
<a name="l838"></a> tmpsp = tmpsp->next;
|
|
<a name="l839"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l840"></a>
|
|
<a name="l841"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l842"></a>}
|
|
<a name="l843"></a>
|
|
<a name="l844"></a></span><span class=cF1>U0</span><span class=cF0> MyDerivative(</span><span class=cF9>CMathODE</span><span class=cF0> *ode, </span><span class=cF1>F64</span><span class=cF0>, </span><span class=cF9>COrder2D3</span><span class=cF0> *, </span><span class=cF9>COrder2D3</span><span class=cF0> *)
|
|
<a name="l845"></a>{
|
|
<a name="l846"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l847"></a> </span><span class=cF1>F64</span><span class=cF0> d, dd, dd2, spin, t_left, t_right, theta_err, theta_thrust, DthetaDt;
|
|
<a name="l848"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = ode->win_task;
|
|
<a name="l849"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l850"></a> Ship *tmpsp;
|
|
<a name="l851"></a> Missile *tmpmi;
|
|
<a name="l852"></a> MyMass *tmpm, *tmpm1;
|
|
<a name="l853"></a>
|
|
<a name="l854"></a> tmpm = ode->next_mass;
|
|
<a name="l855"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l856"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l857"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type != MT_SOLAR_FLARE && tmpm->type != MT_ION)
|
|
<a name="l858"></a> {
|
|
<a name="l859"></a> d = tmpm->state->x;
|
|
<a name="l860"></a> </span><span class=cF1>if</span><span class=cF0> (d - tmpm->radius < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l861"></a> tmpm->DstateDt->DxDt += </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(d - tmpm->radius)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l862"></a>
|
|
<a name="l863"></a> </span><span class=cF1>if</span><span class=cF0> (d + tmpm->radius > task->pix_width)
|
|
<a name="l864"></a> tmpm->DstateDt->DxDt -= </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>d + tmpm->radius</span><span class=cF7>)</span><span class=cF0> - task->pix_width)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l865"></a>
|
|
<a name="l866"></a> d = tmpm->state->y;
|
|
<a name="l867"></a> </span><span class=cF1>if</span><span class=cF0> (d - tmpm->radius < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l868"></a> tmpm->DstateDt->DyDt += </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(d - tmpm->radius)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l869"></a>
|
|
<a name="l870"></a> </span><span class=cF1>if</span><span class=cF0> (d + tmpm->radius > task->pix_height)
|
|
<a name="l871"></a> tmpm->DstateDt->DyDt -= </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>d + tmpm->radius</span><span class=cF7>)</span><span class=cF0> - task->pix_height)</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l872"></a> }
|
|
<a name="l873"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type != MT_ION && tmpm->type != MT_ANTIMATTER_SPLAT)
|
|
<a name="l874"></a> {
|
|
<a name="l875"></a> tmpm1 = ode->next_mass;
|
|
<a name="l876"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l877"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l878"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm != tmpm1)
|
|
<a name="l879"></a> {
|
|
<a name="l880"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1->type == MT_ANTIMATTER_SPLAT)
|
|
<a name="l881"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l882"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_HUMAN_SHIP || tmpm->type == MT_ENEMY_SHIP)
|
|
<a name="l883"></a> {
|
|
<a name="l884"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm->state->x, &tmpm1->state->x);
|
|
<a name="l885"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l886"></a> </span><span class=cF1>if</span><span class=cF0> (dd < </span><span class=cFE>100000</span><span class=cF0>)
|
|
<a name="l887"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l888"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, </span><span class=cFE>100000</span><span class=cF0> / dd);
|
|
<a name="l889"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpm1->DstateDt->DxDt, &p);
|
|
<a name="l890"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l891"></a> }
|
|
<a name="l892"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l893"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm1->type != MT_ION)
|
|
<a name="l894"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l895"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm->state->x, &tmpm1->state->x);
|
|
<a name="l896"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p);
|
|
<a name="l897"></a> dd2 = </span><span class=cF5>Sqr</span><span class=cF0>(tmpm->radius+tmpm1->radius);
|
|
<a name="l898"></a> </span><span class=cF1>if</span><span class=cF0> (dd <= dd2)
|
|
<a name="l899"></a> {
|
|
<a name="l900"></a> d = </span><span class=cF5>Sqrt</span><span class=cF0>(dd) + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l901"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF5>Sqr</span><span class=cF0>(dd2 - dd)</span><span class=cF7>)</span><span class=cF0> / d);
|
|
<a name="l902"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpm ->DstateDt->DxDt, &p);
|
|
<a name="l903"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&tmpm1->DstateDt->DxDt, &p);
|
|
<a name="l904"></a> }
|
|
<a name="l905"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l906"></a> }
|
|
<a name="l907"></a> tmpm1 = tmpm1->next;
|
|
<a name="l908"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l909"></a> }
|
|
<a name="l910"></a> tmpm = tmpm->next;
|
|
<a name="l911"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l912"></a>
|
|
<a name="l913"></a> tmpsp = ship_head.next;
|
|
<a name="l914"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l915"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l916"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->exploding && tmpsp->die_time <= </span><span class=cF5>tS</span><span class=cF0> <= tmpsp->die_timeout)
|
|
<a name="l917"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l918"></a> Explosion(&tmpsp->p[i], </span><span class=cF3>NULL</span><span class=cF0>, tmpsp->p[i].radius / </span><span class=cFE>250</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l919"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp->type)
|
|
<a name="l920"></a> {
|
|
<a name="l921"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
|
|
<a name="l922"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp->exploding)
|
|
<a name="l923"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l924"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->spacewalk_side)
|
|
<a name="l925"></a> {
|
|
<a name="l926"></a> t_left = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l927"></a> t_right = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l928"></a> d = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - (tmpsp->spacewalk_timeout - </span><span class=cF5>tS</span><span class=cF0>) / SPACEWALK_TIME;
|
|
<a name="l929"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>485</span><span class=cF0> < d < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>515</span><span class=cF0>)
|
|
<a name="l930"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l931"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&p, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].state->x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].state->x</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l932"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->spacewalk_side == </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l933"></a> {
|
|
<a name="l934"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].DstateDt->DxDt -= </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.x;
|
|
<a name="l935"></a> tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].DstateDt->DyDt -= </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.y;
|
|
<a name="l936"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].DstateDt->DxDt += </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.x;
|
|
<a name="l937"></a> tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].DstateDt->DyDt += </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.y;
|
|
<a name="l938"></a> }
|
|
<a name="l939"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l940"></a> {
|
|
<a name="l941"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].DstateDt->DxDt += </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.x;
|
|
<a name="l942"></a> tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].DstateDt->DyDt += </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.y;
|
|
<a name="l943"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].DstateDt->DxDt -= </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.x;
|
|
<a name="l944"></a> tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].DstateDt->DyDt -= </span><span class=cFE>10</span><span class=cF0> * THRUST_MAX * p.y;
|
|
<a name="l945"></a> }
|
|
<a name="l946"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l947"></a> }
|
|
<a name="l948"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l949"></a> {
|
|
<a name="l950"></a> </span><span class=cF1>if</span><span class=cF0> (d = </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].state->x)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l951"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l952"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->DxDt, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].state->DxDt);
|
|
<a name="l953"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l954"></a> spin = p.z / d;
|
|
<a name="l955"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l956"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l957"></a> spin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l958"></a> t_left = </span><span class=cF5>Clamp</span><span class=cF0>(human_t_left + SPIN_GAIN * spin * human_antispin, </span><span class=cFE>0</span><span class=cF0>, THRUST_MAX);
|
|
<a name="l959"></a>
|
|
<a name="l960"></a> </span><span class=cF1>if</span><span class=cF0> (d = </span><span class=cF5>D3Norm</span><span class=cF7>(</span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].state->x)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l961"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l962"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->DxDt, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].state->DxDt);
|
|
<a name="l963"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l964"></a> spin = p.z / d;
|
|
<a name="l965"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l966"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l967"></a> spin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l968"></a> t_right = </span><span class=cF5>Clamp</span><span class=cF0>(human_t_right - SPIN_GAIN * spin * human_antispin, </span><span class=cFE>0</span><span class=cF0>, THRUST_MAX);
|
|
<a name="l969"></a>
|
|
<a name="l970"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].state->x);
|
|
<a name="l971"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].state->x);
|
|
<a name="l972"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l973"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>3</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l974"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l975"></a> </span><span class=cF5>D3Mul</span><span class=cF0>(&p1, t_left, &p);
|
|
<a name="l976"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpsp->p[</span><span class=cFE>3</span><span class=cF0>].DstateDt->DxDt, &p1);
|
|
<a name="l977"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l978"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpsp->s[</span><span class=cFE>5</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l979"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l980"></a> </span><span class=cF5>D3Mul</span><span class=cF0>(&p2, t_right, &p);
|
|
<a name="l981"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpsp->p[</span><span class=cFE>4</span><span class=cF0>].DstateDt->DxDt, &p2);
|
|
<a name="l982"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l983"></a> }
|
|
<a name="l984"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l985"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l986"></a> }
|
|
<a name="l987"></a> tmpsp = tmpsp->next;
|
|
<a name="l988"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l989"></a>
|
|
<a name="l990"></a> tmpmi = missile_head.next;
|
|
<a name="l991"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi != &missile_head)
|
|
<a name="l992"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l993"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->active)
|
|
<a name="l994"></a> {
|
|
<a name="l995"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->launched)
|
|
<a name="l996"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l997"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->exploding)
|
|
<a name="l998"></a> Explosion(&tmpmi->p_front, &tmpmi->p_back, tmpmi->tons);
|
|
<a name="l999"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1000"></a> {</span><span class=cF2>//Guide missile</span><span class=cF0>
|
|
<a name="l1001"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp = tmpmi->target)
|
|
<a name="l1002"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1003"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Sub</span><span class=cF7>(</span><span class=cF0>&p, &tmpmi->p_front.state->x, &tmpmi->p_back.state->x</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1004"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].state->x, &tmpmi->p_front.state->x);
|
|
<a name="l1005"></a> d =</span><span class=cF5>D3Norm</span><span class=cF0>(&p1);
|
|
<a name="l1006"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&p1);
|
|
<a name="l1007"></a> theta_err = </span><span class=cF5>D3Dot</span><span class=cF0>(&p, &p1);
|
|
<a name="l1008"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpmi->p_front.state->DxDt, &tmpmi->p_back.state->DxDt);
|
|
<a name="l1009"></a> </span><span class=cF5>D3Cross</span><span class=cF0>(&p2, &p, &p1);
|
|
<a name="l1010"></a> DthetaDt = </span><span class=cF5>D3Norm</span><span class=cF0>(&p2);
|
|
<a name="l1011"></a> </span><span class=cF1>if</span><span class=cF0> (p2.z < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1012"></a> DthetaDt = -DthetaDt;
|
|
<a name="l1013"></a> theta_thrust = </span><span class=cF5>Clamp</span><span class=cF0>(</span><span class=cFE>200</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF0>theta_err + </span><span class=cFE>2</span><span class=cF0> * DthetaDt</span><span class=cF7>)</span><span class=cF0> / </span><span class=cF7>(</span><span class=cF0>d + </span><span class=cFE>200</span><span class=cF7>)</span><span class=cF0>, -</span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>);
|
|
<a name="l1014"></a> p2.x = p.x * </span><span class=cF5>Cos</span><span class=cF0>(theta_thrust) - p.y * </span><span class=cF5>Sin</span><span class=cF0>(theta_thrust);
|
|
<a name="l1015"></a> p2.y = p.y * </span><span class=cF5>Cos</span><span class=cF0>(theta_thrust) + p.x * </span><span class=cF5>Sin</span><span class=cF0>(theta_thrust);
|
|
<a name="l1016"></a> p2.z = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1017"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpmi->p_back.DstateDt->DxDt, </span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF0>&p2, THRUST_MAX</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1018"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1019"></a> }
|
|
<a name="l1020"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1021"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1022"></a> tmpmi->target = TargetGet(tmpmi);
|
|
<a name="l1023"></a> }
|
|
<a name="l1024"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1025"></a> tmpmi->target = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1026"></a> tmpmi = tmpmi->next;
|
|
<a name="l1027"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1028"></a>}
|
|
<a name="l1029"></a>
|
|
<a name="l1030"></a></span><span class=cF1>U0</span><span class=cF0> MyNoise(</span><span class=cF9>I64</span><span class=cF0> mS, </span><span class=cF1>F64</span><span class=cF0> min_ona, </span><span class=cF1>F64</span><span class=cF0> max_ona)
|
|
<a name="l1031"></a>{</span><span class=cF2>//Make white noise for given number of mS.</span><span class=cF0>
|
|
<a name="l1032"></a></span><span class=cF2>// See </span><span class=cF4><u>Noise</u></span><span class=cF2>. On bare-metal, Spawn() hogs CPU.</span><span class=cF0>
|
|
<a name="l1033"></a> </span><span class=cF9>CSoundEffectFrame</span><span class=cF0> *ns;
|
|
<a name="l1034"></a>
|
|
<a name="l1035"></a> </span><span class=cF1>if</span><span class=cF0> (mS > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1036"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1037"></a> ns = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSoundEffectFrame</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1038"></a> ns->type = </span><span class=cF3>SE_NOISE</span><span class=cF0>;
|
|
<a name="l1039"></a> ns->duration = mS / </span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1040"></a> ns->ona1 = min_ona;
|
|
<a name="l1041"></a> ns->ona2 = max_ona;
|
|
<a name="l1042"></a> </span><span class=cFB>music</span><span class=cF0>.mute++;
|
|
<a name="l1043"></a> </span><span class=cF5>SoundEffectTask</span><span class=cF0>(ns);
|
|
<a name="l1044"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l1045"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1046"></a>
|
|
<a name="l1047"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l1048"></a>}
|
|
<a name="l1049"></a>
|
|
<a name="l1050"></a></span><span class=cF1>U0</span><span class=cF0> CheckDamage()
|
|
<a name="l1051"></a>{
|
|
<a name="l1052"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, death_score;
|
|
<a name="l1053"></a> Ship *tmpsp, *tmpsp1;
|
|
<a name="l1054"></a> MyMass *tmpm, *tmpm1, *best_mass;
|
|
<a name="l1055"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l1056"></a> </span><span class=cF1>F64</span><span class=cF0> d, best_distance;
|
|
<a name="l1057"></a> </span><span class=cF1>Bool</span><span class=cF0> facing_sun = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1058"></a>
|
|
<a name="l1059"></a> </span><span class=cF1>if</span><span class=cF0> (human)
|
|
<a name="l1060"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1061"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>1</span><span class=cF0>].x, &human->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l1062"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &human->p[</span><span class=cFE>2</span><span class=cF0>].x, &human->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l1063"></a> </span><span class=cF5>D3Add</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l1064"></a> </span><span class=cF1>if</span><span class=cF0> (p.x></span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1065"></a> facing_sun = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1066"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1067"></a>
|
|
<a name="l1068"></a> tmpm = ode->next_mass;
|
|
<a name="l1069"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l1070"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1071"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_ION)
|
|
<a name="l1072"></a> {
|
|
<a name="l1073"></a> </span><span class=cF1>if</span><span class=cF0> (facing_sun)
|
|
<a name="l1074"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1075"></a> tmpm1 = ode->next_mass;
|
|
<a name="l1076"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l1077"></a> {
|
|
<a name="l1078"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1->type == MT_HUMAN_SHIP)
|
|
<a name="l1079"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1080"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm1->x, &tmpm->x);
|
|
<a name="l1081"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&p</span><span class=cF7>)</span><span class=cF0> < </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm1->radius</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1082"></a> tmpm1->temperature += </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1083"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1084"></a> tmpm1 = tmpm1->next;
|
|
<a name="l1085"></a> }
|
|
<a name="l1086"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1087"></a> }
|
|
<a name="l1088"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_ANTIMATTER_SPLAT)
|
|
<a name="l1089"></a> {
|
|
<a name="l1090"></a> tmpm1 = ode->next_mass;
|
|
<a name="l1091"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l1092"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1093"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1->type != MT_ION && tmpm1->type != MT_ANTIMATTER_SPLAT)
|
|
<a name="l1094"></a> {
|
|
<a name="l1095"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm1->x, &tmpm->x);
|
|
<a name="l1096"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3NormSqr</span><span class=cF7>(</span><span class=cF0>&p</span><span class=cF7>)</span><span class=cF0><</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>tmpm1->radius</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1097"></a> tmpm1->temperature += </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>4</span><span class=cF0>;
|
|
<a name="l1098"></a> }
|
|
<a name="l1099"></a> tmpm1 = tmpm1->next;
|
|
<a name="l1100"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1101"></a> }
|
|
<a name="l1102"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1103"></a> tmpm->temperature *= </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>9</span><span class=cF0>;
|
|
<a name="l1104"></a> tmpm = tmpm->next;
|
|
<a name="l1105"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1106"></a>
|
|
<a name="l1107"></a> </span><span class=cF1>if</span><span class=cF0> (human)
|
|
<a name="l1108"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1109"></a> human->laser_temperature *= </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>975</span><span class=cF0>;
|
|
<a name="l1110"></a>
|
|
<a name="l1111"></a> </span><span class=cF1>if</span><span class=cF0> (human->laser_overheat)
|
|
<a name="l1112"></a> {
|
|
<a name="l1113"></a> </span><span class=cF1>if</span><span class=cF0> (human->laser_temperature < LASER_THRESHOLD_TEMP)
|
|
<a name="l1114"></a> human->laser_overheat = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1115"></a> }
|
|
<a name="l1116"></a> </span><span class=cF1>if</span><span class=cF0> (!human->laser_overheat && human->lasering)
|
|
<a name="l1117"></a> {
|
|
<a name="l1118"></a> </span><span class=cF1>if</span><span class=cF0> (human->laser_temperature >= LASER_TEMP_MAX)
|
|
<a name="l1119"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1120"></a> human->laser_overheat = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1121"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l1122"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1123"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1124"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1125"></a> human->laser_temperature += </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1126"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>1</span><span class=cF0>].x);
|
|
<a name="l1127"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &human->p[</span><span class=cFE>2</span><span class=cF0>].x);
|
|
<a name="l1128"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1129"></a> p2.x = p.y;
|
|
<a name="l1130"></a> p2.y = -p.x;
|
|
<a name="l1131"></a> p2.z = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1132"></a> best_mass = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1133"></a> best_distance = </span><span class=cF3>F64_MAX</span><span class=cF0>;
|
|
<a name="l1134"></a> tmpm = ode->next_mass;
|
|
<a name="l1135"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l1136"></a> {
|
|
<a name="l1137"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpm->x);
|
|
<a name="l1138"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF5>D3Dot</span><span class=cF0>(&p1, &p2)</span><span class=cF7>)</span><span class=cF0> < tmpm->radius && </span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF0>&p1, &p</span><span class=cF7>)</span><span class=cF0> < </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1139"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1140"></a> d = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p1);
|
|
<a name="l1141"></a> </span><span class=cF1>if</span><span class=cF0> (d < best_distance)
|
|
<a name="l1142"></a> {
|
|
<a name="l1143"></a> best_distance = d;
|
|
<a name="l1144"></a> best_mass = tmpm;
|
|
<a name="l1145"></a> }
|
|
<a name="l1146"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1147"></a> tmpm = tmpm->next;
|
|
<a name="l1148"></a> }
|
|
<a name="l1149"></a> </span><span class=cF1>if</span><span class=cF0> (best_mass)
|
|
<a name="l1150"></a> best_mass->temperature += </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1151"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1152"></a> }
|
|
<a name="l1153"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1154"></a>
|
|
<a name="l1155"></a> tmpsp = ship_head.next;
|
|
<a name="l1156"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l1157"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1158"></a> tmpsp1 = tmpsp->next;
|
|
<a name="l1159"></a> death_score = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1160"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpsp->type)
|
|
<a name="l1161"></a> {
|
|
<a name="l1162"></a> </span><span class=cF1>case</span><span class=cF0> ST_HUMAN1:
|
|
<a name="l1163"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->exploding)
|
|
<a name="l1164"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1165"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmpsp->die_timeout)
|
|
<a name="l1166"></a> {
|
|
<a name="l1167"></a> ShipDel(tmpsp);
|
|
<a name="l1168"></a> human = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1169"></a> }
|
|
<a name="l1170"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1171"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1172"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l1173"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1174"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>tmpsp->s[i].f</span><span class=cF7>)</span><span class=cF0> > tmpsp->s[i].strength)
|
|
<a name="l1175"></a> {
|
|
<a name="l1176"></a> tmpsp->s[i].flags |= </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
|
|
<a name="l1177"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1178"></a> MissileDel(&tmpsp->missiles[</span><span class=cFE>0</span><span class=cF0>]);
|
|
<a name="l1179"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cFE>5</span><span class=cF0>)
|
|
<a name="l1180"></a> MissileDel(&tmpsp->missiles[</span><span class=cFE>1</span><span class=cF0>]);
|
|
<a name="l1181"></a> }
|
|
<a name="l1182"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->s[i].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF0> && i < </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l1183"></a> death_score++;
|
|
<a name="l1184"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1185"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1186"></a>
|
|
<a name="l1187"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l1188"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->exploding)
|
|
<a name="l1189"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1190"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmpsp->die_timeout)
|
|
<a name="l1191"></a> {
|
|
<a name="l1192"></a> ShipDel(tmpsp);
|
|
<a name="l1193"></a> score += level;
|
|
<a name="l1194"></a> </span><span class=cF1>if</span><span class=cF0> (score > best_score)
|
|
<a name="l1195"></a> best_score = score;
|
|
<a name="l1196"></a> }
|
|
<a name="l1197"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1198"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1199"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1200"></a> j = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1201"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->springs; i++)
|
|
<a name="l1202"></a> {
|
|
<a name="l1203"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->s[i].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>)
|
|
<a name="l1204"></a> j++;
|
|
<a name="l1205"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>tmpsp->s[i].f</span><span class=cF7>)</span><span class=cF0> > tmpsp->s[i].strength)
|
|
<a name="l1206"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1207"></a> tmpsp->s[i].flags |= </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
|
|
<a name="l1208"></a> j++;
|
|
<a name="l1209"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1210"></a> }
|
|
<a name="l1211"></a> </span><span class=cF1>if</span><span class=cF0> (j > </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l1212"></a> death_score++;
|
|
<a name="l1213"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1214"></a> }
|
|
<a name="l1215"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpsp->exploding)
|
|
<a name="l1216"></a> {
|
|
<a name="l1217"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpsp->masses; i++)
|
|
<a name="l1218"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->p[i].temperature > MASS_TEMP_MAX)
|
|
<a name="l1219"></a> death_score++;
|
|
<a name="l1220"></a> </span><span class=cF1>if</span><span class=cF0> (death_score)
|
|
<a name="l1221"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1222"></a> tmpsp->exploding = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1223"></a> tmpsp->die_time = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l1224"></a> tmpsp->die_timeout = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>75</span><span class=cF0>;
|
|
<a name="l1225"></a> MyNoise(</span><span class=cFE>750</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>, </span><span class=cFE>93</span><span class=cF0>);
|
|
<a name="l1226"></a> </span><span class=cF1>if</span><span class=cF0> (tmpsp->type == ST_HUMAN1)
|
|
<a name="l1227"></a> game_over = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1228"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1229"></a> }
|
|
<a name="l1230"></a> tmpsp = tmpsp1;
|
|
<a name="l1231"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1232"></a>}
|
|
<a name="l1233"></a>
|
|
<a name="l1234"></a></span><span class=cF2>//********************************** Shots</span><span class=cF0>
|
|
<a name="l1235"></a>
|
|
<a name="l1236"></a>Shot *ShotNew(</span><span class=cF9>I64</span><span class=cF0> type, </span><span class=cF9>CD3</span><span class=cF0> *_p, </span><span class=cF9>CD3</span><span class=cF0> *_v, </span><span class=cF1>F64</span><span class=cF0> r, </span><span class=cF1>F64</span><span class=cF0> fuse_time, </span><span class=cF9>CD3</span><span class=cF0> *_p_gun_offset=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l1237"></a>{
|
|
<a name="l1238"></a> Shot *tmps = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Shot</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1239"></a>
|
|
<a name="l1240"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmps->p.x, _p);
|
|
<a name="l1241"></a> tmps->radius = r;
|
|
<a name="l1242"></a> tmps->splats = </span><span class=cFE>20</span><span class=cF0> * r;
|
|
<a name="l1243"></a> tmps->fuse_time = </span><span class=cF5>tS</span><span class=cF0> + fuse_time;
|
|
<a name="l1244"></a> tmps->p.mass = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>3</span><span class=cF0> * r * r * r;
|
|
<a name="l1245"></a> tmps->p.type = type;
|
|
<a name="l1246"></a> </span><span class=cF1>if</span><span class=cF0> (_p_gun_offset)
|
|
<a name="l1247"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmps->p.x, _p_gun_offset);
|
|
<a name="l1248"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmps->p.DxDt, _v);
|
|
<a name="l1249"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(&tmps->p, ode->last_mass);
|
|
<a name="l1250"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmps, shot_head.last);
|
|
<a name="l1251"></a>}
|
|
<a name="l1252"></a>
|
|
<a name="l1253"></a></span><span class=cF1>U0</span><span class=cF0> SolarFlares()
|
|
<a name="l1254"></a>{
|
|
<a name="l1255"></a> </span><span class=cF9>CD3</span><span class=cF0> p, v, p1, p2;
|
|
<a name="l1256"></a> </span><span class=cF9>CTask</span><span class=cF0> *task = ode->win_task;
|
|
<a name="l1257"></a>
|
|
<a name="l1258"></a> </span><span class=cF1>if</span><span class=cF0> (!alarm && t_solar_storm - </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> < </span><span class=cF5>tS</span><span class=cF0> < t_solar_storm + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1259"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1260"></a> </span><span class=cF5>Sweep</span><span class=cF0>(</span><span class=cFE>2000</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>, </span><span class=cFE>93</span><span class=cF0>);
|
|
<a name="l1261"></a> alarm = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1262"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1263"></a> </span><span class=cF1>if</span><span class=cF0> (t_solar_storm < </span><span class=cF5>tS</span><span class=cF0>)
|
|
<a name="l1264"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//If solar storm has arrived</span><span class=cF0>
|
|
<a name="l1265"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> < t_solar_storm + </span><span class=cFE>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l1266"></a> { </span><span class=cF2>//If solar storm not over</span><span class=cF0>
|
|
<a name="l1267"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Rand</span><span class=cF0> < .</span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l1268"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1269"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&p, -</span><span class=cFE>300</span><span class=cF0>, </span><span class=cF5>Rand</span><span class=cF0> * task->pix_height, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1270"></a> </span><span class=cF5>D3Equ</span><span class=cF0>(&v, </span><span class=cFE>200</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1271"></a> ShotNew(MT_SOLAR_FLARE, &p, &v, </span><span class=cFE>25</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1272"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1273"></a> }
|
|
<a name="l1274"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1275"></a> {
|
|
<a name="l1276"></a> t_solar_storm = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>25</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>; </span><span class=cF2>//Schedule next solar storm</span><span class=cF0>
|
|
<a name="l1277"></a> alarm = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1278"></a> }
|
|
<a name="l1279"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1280"></a>}
|
|
<a name="l1281"></a>
|
|
<a name="l1282"></a></span><span class=cF1>U0</span><span class=cF0> FireOneGun(Ship *tmpsp, </span><span class=cF9>I64</span><span class=cF0> n, </span><span class=cF1>F64</span><span class=cF0> r, </span><span class=cF1>F64</span><span class=cF0> fuse_time)
|
|
<a name="l1283"></a>{
|
|
<a name="l1284"></a> </span><span class=cF9>I64</span><span class=cF0> ona;
|
|
<a name="l1285"></a> </span><span class=cF9>CD3</span><span class=cF0> p, v, p1, p2;
|
|
<a name="l1286"></a> Shot *tmps;
|
|
<a name="l1287"></a>
|
|
<a name="l1288"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x);
|
|
<a name="l1289"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x);
|
|
<a name="l1290"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(</span><span class=cF5>D3Add</span><span class=cF7>(</span><span class=cF0>&p, &p1, &p2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1291"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(</span><span class=cF5>D3Copy</span><span class=cF7>(</span><span class=cF0>&p1, &p</span><span class=cF7>)</span><span class=cF0>, r + tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].radius + </span><span class=cFE>5</span><span class=cF0>);
|
|
<a name="l1292"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(</span><span class=cF5>D3MulEqu</span><span class=cF7>(</span><span class=cF5>D3Copy</span><span class=cF0>(&v, &p), </span><span class=cFE>1000</span><span class=cF0> / (r + </span><span class=cFE>1</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>, &tmpsp->p[n].DxDt);
|
|
<a name="l1293"></a> tmps=ShotNew(MT_ANTIMATTER_BALL, &tmpsp->p[n].x, &v, r, fuse_time, &p1);
|
|
<a name="l1294"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, tmps->p.mass / tmpsp->p[n].mass / </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1295"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&tmpsp->p[n].DxDt, &p);
|
|
<a name="l1296"></a> tmpsp->reload_timeout = </span><span class=cF5>tS</span><span class=cF0> + r / tmpsp->fire_rate;
|
|
<a name="l1297"></a> ona = </span><span class=cF5>Freq2Ona</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> / r);
|
|
<a name="l1298"></a> MyNoise(</span><span class=cFE>100</span><span class=cF0>, ona, ona + </span><span class=cFE>12</span><span class=cF0>);
|
|
<a name="l1299"></a>}
|
|
<a name="l1300"></a>
|
|
<a name="l1301"></a></span><span class=cF1>U0</span><span class=cF0> FireOneMissile(Ship *tmpsp, </span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l1302"></a>{
|
|
<a name="l1303"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1304"></a> Missile *tmpmi = &tmpsp->missiles[n];
|
|
<a name="l1305"></a>
|
|
<a name="l1306"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpmi->launched && tmpmi->target)
|
|
<a name="l1307"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1308"></a> tmpmi->fuse_time = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1309"></a> tmpmi->die_timeout = tmpmi->fuse_time + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>125</span><span class=cF0>;
|
|
<a name="l1310"></a> tmpmi->img = </span><span class=cFA><8></span><span class=cF0>;
|
|
<a name="l1311"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>1</span><span class=cF0>; i < </span><span class=cFE>5</span><span class=cF0>; i++)
|
|
<a name="l1312"></a> tmpmi->s[i].flags |= </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
|
|
<a name="l1313"></a> tmpmi->launched = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1314"></a> </span><span class=cF5>Sweep</span><span class=cF0>(</span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>53</span><span class=cF0>, </span><span class=cFE>56</span><span class=cF0>);
|
|
<a name="l1315"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1316"></a>}
|
|
<a name="l1317"></a>
|
|
<a name="l1318"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireGunBegin()
|
|
<a name="l1319"></a>{
|
|
<a name="l1320"></a> </span><span class=cF1>F64</span><span class=cF0> r = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * ctrl_panel.shot_radius / CTRL_PANEL_RANGE + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>,
|
|
<a name="l1321"></a> fuse_time = </span><span class=cF5>ToF64</span><span class=cF0>(ctrl_panel.fuse_time + </span><span class=cFE>1</span><span class=cF0>) / CTRL_PANEL_RANGE;
|
|
<a name="l1322"></a>
|
|
<a name="l1323"></a> </span><span class=cF1>if</span><span class=cF0> (human)
|
|
<a name="l1324"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1325"></a> </span><span class=cF1>if</span><span class=cF0> (!human->exploding && !human->spacewalk_side && </span><span class=cF5>tS</span><span class=cF0> > human->reload_timeout)
|
|
<a name="l1326"></a> </span><span class=cF1>switch</span><span class=cF0> (level)
|
|
<a name="l1327"></a> {
|
|
<a name="l1328"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>:
|
|
<a name="l1329"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>3</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1330"></a> FireOneGun(human, </span><span class=cFE>3</span><span class=cF0>, r, fuse_time);
|
|
<a name="l1331"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>5</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1332"></a> FireOneGun(human, </span><span class=cFE>4</span><span class=cF0>, r, fuse_time);
|
|
<a name="l1333"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
|
<a name="l1334"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>1</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1335"></a> FireOneGun(human, </span><span class=cFE>1</span><span class=cF0>, r, fuse_time);
|
|
<a name="l1336"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>human->s[</span><span class=cFE>2</span><span class=cF0>].flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1337"></a> FireOneGun(human, </span><span class=cFE>2</span><span class=cF0>, r, fuse_time);
|
|
<a name="l1338"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
|
<a name="l1339"></a> FireOneGun(human, </span><span class=cFE>0</span><span class=cF0>, r, fuse_time);
|
|
<a name="l1340"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1341"></a> }
|
|
<a name="l1342"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1343"></a>}
|
|
<a name="l1344"></a>
|
|
<a name="l1345"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireMissileBegin(</span><span class=cF9>I64</span><span class=cF0> n)
|
|
<a name="l1346"></a>{
|
|
<a name="l1347"></a> </span><span class=cF1>if</span><span class=cF0> (human && !human->exploding && !human->spacewalk_side && </span><span class=cF5>tS</span><span class=cF0> > human->reload_timeout)
|
|
<a name="l1348"></a> FireOneMissile(human, n);
|
|
<a name="l1349"></a>}
|
|
<a name="l1350"></a>
|
|
<a name="l1351"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireLaserBegin()
|
|
<a name="l1352"></a>{
|
|
<a name="l1353"></a> </span><span class=cF1>if</span><span class=cF0> (human && !human->exploding && !human->spacewalk_side && </span><span class=cF5>tS</span><span class=cF0> > human->reload_timeout)
|
|
<a name="l1354"></a> human->lasering = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1355"></a>}
|
|
<a name="l1356"></a></span><span class=cF1>U0</span><span class=cF0> HumanFireLaserEnd()
|
|
<a name="l1357"></a>{
|
|
<a name="l1358"></a> </span><span class=cF1>if</span><span class=cF0> (human && !human->exploding)
|
|
<a name="l1359"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1360"></a> human->lasering = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1361"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l1362"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1363"></a>}
|
|
<a name="l1364"></a>
|
|
<a name="l1365"></a></span><span class=cF1>U0</span><span class=cF0> SplatNew(Shot *tmps, </span><span class=cF1>F64</span><span class=cF0> die_time, </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>, </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF1>end</span><span class=cF0>)
|
|
<a name="l1366"></a>{
|
|
<a name="l1367"></a> MyMass *tmpm;
|
|
<a name="l1368"></a> </span><span class=cF1>F64</span><span class=cF0> theta = </span><span class=cF5>Arg</span><span class=cF0>(tmps->p.DxDt, tmps->p.DyDt);
|
|
<a name="l1369"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1370"></a>
|
|
<a name="l1371"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmps->splats; i++)
|
|
<a name="l1372"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1373"></a> tmpm = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MyMass</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1374"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmpm->x, &tmps->p.x);
|
|
<a name="l1375"></a> tmpm->radius = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1376"></a> tmpm->mass = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1377"></a> tmpm->die_timeout = </span><span class=cF5>tS</span><span class=cF0> + die_time;
|
|
<a name="l1378"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->p.type == MT_SOLAR_FLARE)
|
|
<a name="l1379"></a> tmpm->type = MT_ION;
|
|
<a name="l1380"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1381"></a> tmpm->type = MT_ANTIMATTER_SPLAT;
|
|
<a name="l1382"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&tmpm->DxDt, &tmps->p.DxDt);
|
|
<a name="l1383"></a> tmpm->DxDt += </span><span class=cFE>50</span><span class=cF0> * </span><span class=cF5>Sqr</span><span class=cF0>(tmps->radius) * </span><span class=cF5>Rand</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0> + theta + </span><span class=cF7>(</span><span class=cF1>end</span><span class=cF0> - </span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0> * i / tmps->splats);
|
|
<a name="l1384"></a> tmpm->DyDt += </span><span class=cFE>50</span><span class=cF0> * </span><span class=cF5>Sqr</span><span class=cF0>(tmps->radius) * </span><span class=cF5>Rand</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF0>(</span><span class=cF1>start</span><span class=cF0> + theta + </span><span class=cF7>(</span><span class=cF1>end</span><span class=cF0> - </span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0> * i / tmps->splats);
|
|
<a name="l1385"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpm, ode->last_mass);
|
|
<a name="l1386"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1387"></a>}
|
|
<a name="l1388"></a>
|
|
<a name="l1389"></a></span><span class=cF1>U0</span><span class=cF0> ExpireShots()
|
|
<a name="l1390"></a>{
|
|
<a name="l1391"></a> Shot *tmps = shot_head.next, *tmps1;
|
|
<a name="l1392"></a>
|
|
<a name="l1393"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &shot_head)
|
|
<a name="l1394"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1395"></a> tmps1 = tmps->next;
|
|
<a name="l1396"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmps->fuse_time)
|
|
<a name="l1397"></a> {
|
|
<a name="l1398"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->p.type == MT_SOLAR_FLARE)
|
|
<a name="l1399"></a> SplatNew(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>);
|
|
<a name="l1400"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1401"></a> SplatNew(tmps, .</span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l1402"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmps);
|
|
<a name="l1403"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(&tmps->p);
|
|
<a name="l1404"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l1405"></a> }
|
|
<a name="l1406"></a> tmps = tmps1;
|
|
<a name="l1407"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1408"></a>}
|
|
<a name="l1409"></a>
|
|
<a name="l1410"></a></span><span class=cF1>U0</span><span class=cF0> ExpireSplats()
|
|
<a name="l1411"></a>{
|
|
<a name="l1412"></a> MyMass *tmpm, *tmpm1;
|
|
<a name="l1413"></a>
|
|
<a name="l1414"></a> tmpm = ode->next_mass;
|
|
<a name="l1415"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l1416"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1417"></a> tmpm1 = tmpm->next;
|
|
<a name="l1418"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpm->type == MT_ION || tmpm->type == MT_ANTIMATTER_SPLAT</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>tS</span><span class=cF0> > tmpm->die_timeout)
|
|
<a name="l1419"></a> {
|
|
<a name="l1420"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpm);
|
|
<a name="l1421"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
|
|
<a name="l1422"></a> }
|
|
<a name="l1423"></a> tmpm = tmpm1;
|
|
<a name="l1424"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1425"></a>}
|
|
<a name="l1426"></a>
|
|
<a name="l1427"></a></span><span class=cF1>U0</span><span class=cF0> ExpireMissiles()
|
|
<a name="l1428"></a>{
|
|
<a name="l1429"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1430"></a> </span><span class=cF1>F64</span><span class=cF0> dd, best_dd;
|
|
<a name="l1431"></a> Missile *tmpmi = missile_head.next, *tmpm1;
|
|
<a name="l1432"></a>
|
|
<a name="l1433"></a> </span><span class=cF1>while</span><span class=cF0> (tmpmi != &missile_head)
|
|
<a name="l1434"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1435"></a> tmpm1 = tmpmi->next;
|
|
<a name="l1436"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->launched)
|
|
<a name="l1437"></a> {
|
|
<a name="l1438"></a> best_dd = </span><span class=cF3>F64_MAX</span><span class=cF0>;
|
|
<a name="l1439"></a> </span><span class=cF1>if</span><span class=cF0> (tmpmi->target)
|
|
<a name="l1440"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < tmpmi->target->masses; i++)
|
|
<a name="l1441"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1442"></a> dd = </span><span class=cF5>D3DistSqr</span><span class=cF0>(&tmpmi->p_front.x, &tmpmi->target->p[i].x);
|
|
<a name="l1443"></a> </span><span class=cF1>if</span><span class=cF0> (dd < best_dd)
|
|
<a name="l1444"></a> best_dd = dd;
|
|
<a name="l1445"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1446"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpmi->exploding && </span><span class=cF7>(</span><span class=cF0>best_dd < </span><span class=cFE>30</span><span class=cF0> * </span><span class=cFE>30</span><span class=cF0> || </span><span class=cF5>tS</span><span class=cF0> > tmpmi->fuse_time</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1447"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1448"></a> tmpmi->p_front.mass = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>//They go flying, if too light.</span><span class=cF0>
|
|
<a name="l1449"></a> tmpmi->p_back.mass = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1450"></a> tmpmi->exploding = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1451"></a> MyNoise(</span><span class=cFE>50</span><span class=cF0>, </span><span class=cFE>93</span><span class=cF0>, </span><span class=cFE>105</span><span class=cF0>);
|
|
<a name="l1452"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1453"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > tmpmi->die_timeout)
|
|
<a name="l1454"></a> MissileDel(tmpmi);
|
|
<a name="l1455"></a> }
|
|
<a name="l1456"></a> tmpmi = tmpm1;
|
|
<a name="l1457"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1458"></a>}
|
|
<a name="l1459"></a>
|
|
<a name="l1460"></a></span><span class=cF2>//********************************** AI</span><span class=cF0>
|
|
<a name="l1461"></a>
|
|
<a name="l1462"></a></span><span class=cF1>U0</span><span class=cF0> AI()
|
|
<a name="l1463"></a>{
|
|
<a name="l1464"></a> </span><span class=cF9>CD3</span><span class=cF0> p, p1, p2;
|
|
<a name="l1465"></a> Ship *tmpsp = ship_head.next;
|
|
<a name="l1466"></a>
|
|
<a name="l1467"></a> </span><span class=cF1>if</span><span class=cF0> (human && !human->exploding)
|
|
<a name="l1468"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1469"></a> </span><span class=cF1>while</span><span class=cF0> (tmpsp != &ship_head)
|
|
<a name="l1470"></a> {
|
|
<a name="l1471"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>1</span><span class=cF0>].x);
|
|
<a name="l1472"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p2, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>2</span><span class=cF0>].x);
|
|
<a name="l1473"></a> </span><span class=cF5>D3Add</span><span class=cF0>(&p, &p1, &p2);
|
|
<a name="l1474"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p1, &human->p[</span><span class=cFE>0</span><span class=cF0>].x, &tmpsp->p[</span><span class=cFE>0</span><span class=cF0>].x);
|
|
<a name="l1475"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>D3Dot</span><span class=cF7>(</span><span class=cF5>D3Unit</span><span class=cF0>(&p), </span><span class=cF5>D3Unit</span><span class=cF0>(&p1)</span><span class=cF7>)</span><span class=cF0>></span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>995</span><span class=cF0> && </span><span class=cF5>tS</span><span class=cF0> > tmpsp->reload_timeout)
|
|
<a name="l1476"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1477"></a> FireOneGun(tmpsp, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> + .</span><span class=cFE>5</span><span class=cF0>, .</span><span class=cFE>4</span><span class=cF0>);
|
|
<a name="l1478"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1479"></a> tmpsp = tmpsp->next;
|
|
<a name="l1480"></a> }
|
|
<a name="l1481"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1482"></a>}
|
|
<a name="l1483"></a>
|
|
<a name="l1484"></a></span><span class=cF2>//********************************** Init</span><span class=cF0>
|
|
<a name="l1485"></a></span><span class=cF1>U0</span><span class=cF0> InitLevel()
|
|
<a name="l1486"></a>{
|
|
<a name="l1487"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1488"></a> MyMass *tmpm, *tmpm1;
|
|
<a name="l1489"></a>
|
|
<a name="l1490"></a> t_solar_storm = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1491"></a>
|
|
<a name="l1492"></a> tmpm = ode->next_mass;
|
|
<a name="l1493"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l1494"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1495"></a> tmpm1 = tmpm->next;
|
|
<a name="l1496"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->type == MT_ION || tmpm->type == MT_ANTIMATTER_SPLAT)
|
|
<a name="l1497"></a> {
|
|
<a name="l1498"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpm);
|
|
<a name="l1499"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
|
|
<a name="l1500"></a> }
|
|
<a name="l1501"></a> tmpm = tmpm1;
|
|
<a name="l1502"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1503"></a> </span><span class=cF1>if</span><span class=cF0> (level == </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l1504"></a> </span><span class=cF5>OneTimePopUp</span><span class=cF0>(&message_flags, XMESSAGEF_SOLAR_STORM,
|
|
<a name="l1505"></a> </span><span class=cF6>"Face away from Sun in solar storm.\n"</span><span class=cF0>);
|
|
<a name="l1506"></a> </span><span class=cF1>if</span><span class=cF0> (level == </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1507"></a> </span><span class=cF5>OneTimePopUp</span><span class=cF0>(&message_flags, XMESSAGEF_ANTISPIN,
|
|
<a name="l1508"></a> </span><span class=cF6>"Press $GREEN$<CURSOR-DOWN>$FG$ for anti-spin stabilizer.\n"</span><span class=cF0>);
|
|
<a name="l1509"></a> human = ShipNew(</span><span class=cF5>Fs</span><span class=cF0>->pix_width / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->pix_height / </span><span class=cFE>2</span><span class=cF0>, ST_HUMAN1);
|
|
<a name="l1510"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < level + </span><span class=cFE>2</span><span class=cF0>; i++)
|
|
<a name="l1511"></a> PlaceShip(ST_ENEMY1);
|
|
<a name="l1512"></a> PlaceShip(ST_ENEMY2);
|
|
<a name="l1513"></a> show_level_message = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1514"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
|
|
<a name="l1515"></a>}
|
|
<a name="l1516"></a>
|
|
<a name="l1517"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l1518"></a>{
|
|
<a name="l1519"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l1520"></a> game_over = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1521"></a> score = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1522"></a> level = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1523"></a>
|
|
<a name="l1524"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&ship_head);
|
|
<a name="l1525"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&shot_head);
|
|
<a name="l1526"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&missile_head);
|
|
<a name="l1527"></a>
|
|
<a name="l1528"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < STARS_NUM; i++)
|
|
<a name="l1529"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1530"></a> stars_x[i] = </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF3>GR_WIDTH</span><span class=cF0>;
|
|
<a name="l1531"></a> stars_y[i] = </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF3>GR_HEIGHT</span><span class=cF0>;
|
|
<a name="l1532"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1533"></a>
|
|
<a name="l1534"></a> human_t_left = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1535"></a> human_t_right = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1536"></a> human_antispin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1537"></a>
|
|
<a name="l1538"></a> InitLevel;
|
|
<a name="l1539"></a>}
|
|
<a name="l1540"></a>
|
|
<a name="l1541"></a></span><span class=cF2>//********************************** Main</span><span class=cF0>
|
|
<a name="l1542"></a></span><span class=cF1>U0</span><span class=cF0> XCaliber()
|
|
<a name="l1543"></a>{
|
|
<a name="l1544"></a> </span><span class=cF9>I64</span><span class=cF0> ch, message_code, arg1, arg2, sc;
|
|
<a name="l1545"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *cp = CtrlPanelNew;
|
|
<a name="l1546"></a>
|
|
<a name="l1547"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l1548"></a> </span><span class=cF5>Fs</span><span class=cF0>->text_attr = </span><span class=cF3>BLACK</span><span class=cF0> << </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l1549"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l1550"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l1551"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l1552"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l1553"></a> </span><span class=cF6>"Game {"</span><span class=cF0>
|
|
<a name="l1554"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l1555"></a> </span><span class=cF6>" LevelUp(,'+');"</span><span class=cF0>
|
|
<a name="l1556"></a> </span><span class=cF6>" LevelDown(,'-');"</span><span class=cF0>
|
|
<a name="l1557"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l1558"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l1559"></a> </span><span class=cF6>" Fire(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l1560"></a> </span><span class=cF6>" Thrust(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l1561"></a> </span><span class=cF6>" StopSpin(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l1562"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l1563"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l1564"></a> </span><span class=cF6>" LeftMissile(,,SC_CURSOR_LEFT|SCF_CTRL);"</span><span class=cF0>
|
|
<a name="l1565"></a> </span><span class=cF6>" RightMissile(,,SC_CURSOR_RIGHT|SCF_CTRL);"</span><span class=cF0>
|
|
<a name="l1566"></a> </span><span class=cF6>" Spackwalk(,'w');"</span><span class=cF0>
|
|
<a name="l1567"></a> </span><span class=cF6>" LongerFuse(,,SC_CURSOR_RIGHT|SCF_SHIFT);"</span><span class=cF0>
|
|
<a name="l1568"></a> </span><span class=cF6>" ShorterFuse(,,SC_CURSOR_LEFT|SCF_SHIFT);"</span><span class=cF0>
|
|
<a name="l1569"></a> </span><span class=cF6>" LargerShot(,,SC_CURSOR_UP|SCF_SHIFT);"</span><span class=cF0>
|
|
<a name="l1570"></a> </span><span class=cF6>" SmallerShot(,,SC_CURSOR_DOWN|SCF_SHIFT);"</span><span class=cF0>
|
|
<a name="l1571"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l1572"></a> );
|
|
<a name="l1573"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l1574"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l1575"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l1576"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l1577"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l1578"></a> </span><span class=cF5>PaletteSetLight</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l1579"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit = </span><span class=cF3>WIG_TASK_DEFAULT</span><span class=cF0> - </span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0> - </span><span class=cF3>WIF_SELF_BORDER</span><span class=cF0> - </span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0> - </span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>;
|
|
<a name="l1580"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l1581"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l1582"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1583"></a> ode = </span><span class=cF5>ODENew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>01</span><span class=cF0>, </span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
|
|
<a name="l1584"></a> ode->derive = &MyDerivative;
|
|
<a name="l1585"></a> ode->min_tolerance = </span><span class=cFE>1</span><span class=cF0>e-</span><span class=cFE>9</span><span class=cF0>;
|
|
<a name="l1586"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>00001</span><span class=cF0>;
|
|
<a name="l1587"></a> Init;
|
|
<a name="l1588"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(ode, </span><span class=cF5>Fs</span><span class=cF0>->last_ode);
|
|
<a name="l1589"></a> ch = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1590"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l1591"></a> {
|
|
<a name="l1592"></a> </span><span class=cF1>while</span><span class=cF0> (!game_over && !show_level_message &&
|
|
<a name="l1593"></a> </span><span class=cF7>(</span><span class=cF0>message_code = </span><span class=cF5>MessageScan</span><span class=cF0>(&arg1, &arg2, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1594"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1595"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
|
|
<a name="l1596"></a> {
|
|
<a name="l1597"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l1598"></a> ch = arg1;
|
|
<a name="l1599"></a> sc = arg2;
|
|
<a name="l1600"></a> </span><span class=cF1>switch</span><span class=cF0> (ch)
|
|
<a name="l1601"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1602"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l1603"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l1604"></a> {
|
|
<a name="l1605"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l1606"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l1607"></a> HumanFireMissileBegin(</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1608"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l1609"></a> ctrl_panel.fuse_time += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l1610"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1611"></a> human_t_right = THRUST_MAX;
|
|
<a name="l1612"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1613"></a>
|
|
<a name="l1614"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l1615"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l1616"></a> HumanFireMissileBegin(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1617"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l1618"></a> ctrl_panel.fuse_time -= </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l1619"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1620"></a> human_t_left = THRUST_MAX;
|
|
<a name="l1621"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1622"></a>
|
|
<a name="l1623"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l1624"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l1625"></a> ctrl_panel.shot_radius += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l1626"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1627"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1628"></a> human_t_right = THRUST_MAX;
|
|
<a name="l1629"></a> human_t_left = THRUST_MAX;
|
|
<a name="l1630"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1631"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1632"></a>
|
|
<a name="l1633"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l1634"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l1635"></a> ctrl_panel.shot_radius -= </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l1636"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1637"></a> human_antispin = ANTISPIN_MAX;
|
|
<a name="l1638"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1639"></a> }
|
|
<a name="l1640"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1641"></a>
|
|
<a name="l1642"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l1643"></a> </span><span class=cF1>if</span><span class=cF0> (level < </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1644"></a> HumanFireGunBegin;
|
|
<a name="l1645"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1646"></a> HumanFireLaserBegin;
|
|
<a name="l1647"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1648"></a>
|
|
<a name="l1649"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>:
|
|
<a name="l1650"></a> ctrl_panel.spacewalk = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l1651"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1652"></a>
|
|
<a name="l1653"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
|
|
<a name="l1654"></a> level++;
|
|
<a name="l1655"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1656"></a>
|
|
<a name="l1657"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>:
|
|
<a name="l1658"></a> level--;
|
|
<a name="l1659"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1660"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1661"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1662"></a>
|
|
<a name="l1663"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
|
|
<a name="l1664"></a> ch = arg1;
|
|
<a name="l1665"></a> sc = arg2;
|
|
<a name="l1666"></a> </span><span class=cF1>switch</span><span class=cF0> (ch)
|
|
<a name="l1667"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1668"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l1669"></a> </span><span class=cF1>switch</span><span class=cF0> (sc.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l1670"></a> {
|
|
<a name="l1671"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l1672"></a> human_t_right = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1673"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1674"></a>
|
|
<a name="l1675"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l1676"></a> human_t_left = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1677"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1678"></a>
|
|
<a name="l1679"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l1680"></a> human_t_right = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1681"></a> human_t_left = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1682"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1683"></a>
|
|
<a name="l1684"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l1685"></a> human_antispin = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1686"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1687"></a> }
|
|
<a name="l1688"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1689"></a>
|
|
<a name="l1690"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l1691"></a> ch = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1692"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1693"></a>
|
|
<a name="l1694"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l1695"></a> </span><span class=cF1>if</span><span class=cF0> (level >= </span><span class=cFE>4</span><span class=cF0>)
|
|
<a name="l1696"></a> HumanFireLaserEnd;
|
|
<a name="l1697"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1698"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1699"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1700"></a> }
|
|
<a name="l1701"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1702"></a> AI;
|
|
<a name="l1703"></a> SolarFlares;
|
|
<a name="l1704"></a> ExpireShots;
|
|
<a name="l1705"></a> ExpireSplats;
|
|
<a name="l1706"></a> ExpireMissiles;
|
|
<a name="l1707"></a> CheckDamage;
|
|
<a name="l1708"></a> </span><span class=cF5>Refresh</span><span class=cF0>; </span><span class=cF2>//messages are only qued by winmgr</span><span class=cF0>
|
|
<a name="l1709"></a> </span><span class=cF1>if</span><span class=cF0> (show_level_message)
|
|
<a name="l1710"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1711"></a> ch = </span><span class=cF5>KeyGet</span><span class=cF0>(&sc);
|
|
<a name="l1712"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\n'</span><span class=cF0>)
|
|
<a name="l1713"></a> ch = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1714"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
|
|
<a name="l1715"></a> show_level_message = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l1716"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1717"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (game_over)
|
|
<a name="l1718"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1719"></a> ch = </span><span class=cF5>CharScan</span><span class=cF0>;
|
|
<a name="l1720"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1721"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1722"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1723"></a> </span><span class=cF1>if</span><span class=cF0> (!remaining)
|
|
<a name="l1724"></a> {
|
|
<a name="l1725"></a> level++;
|
|
<a name="l1726"></a> ShipDel(human);
|
|
<a name="l1727"></a> human = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1728"></a> InitLevel;
|
|
<a name="l1729"></a> }
|
|
<a name="l1730"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1731"></a> }
|
|
<a name="l1732"></a> </span><span class=cF1>while</span><span class=cF0> (ch != </span><span class=cF3>CH_ESC</span><span class=cF0> && ch != </span><span class=cF6>'\n'</span><span class=cF0> && ch != </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>);
|
|
<a name="l1733"></a>
|
|
<a name="l1734"></a> AllDel(ode);
|
|
<a name="l1735"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1736"></a> </span><span class=cF1>while</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="l1737"></a>
|
|
<a name="l1738"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l1739"></a> CtrlPanelDel(cp);
|
|
<a name="l1740"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l1741"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>"ZealOS/XCaliber"</span><span class=cF0>,
|
|
<a name="l1742"></a> </span><span class=cF6>"I64 best_score=%d;\n"</span><span class=cF0>
|
|
<a name="l1743"></a> </span><span class=cF6>"I64 message_flags=%d;\n"</span><span class=cF0>, best_score, message_flags);
|
|
<a name="l1744"></a>}
|
|
</span></pre></body>
|
|
</html>
|