mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-29 16:56:30 +00:00
789 lines
77 KiB
HTML
Executable file
789 lines
77 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.05">
|
|
<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=c0A>
|
|
<a name="l2"></a><1>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l3"></a></span><span class=c0A>
|
|
<a name="l4"></a><2>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=c0A>
|
|
<a name="l7"></a><3>/* Graphics Not Rendered in HTML */</span><span class=c00>
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF0>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> STARS_NUM </span><span class=cFE>8192</span><span class=cF0>
|
|
<a name="l11"></a></span><span class=cF9>I64</span><span class=cF0> stars_x[STARS_NUM], stars_y[STARS_NUM];
|
|
<a name="l12"></a>
|
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> RADIUS </span><span class=cFE>7</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> MyMass:</span><span class=cF9>CMass</span><span class=cF0>
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l18"></a>};
|
|
<a name="l19"></a>
|
|
<a name="l20"></a></span><span class=cF1>class</span><span class=cF0> MySpring:</span><span class=cF9>CSpring</span><span class=cF0>
|
|
<a name="l21"></a>{
|
|
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> type, action_key;
|
|
<a name="l23"></a>};
|
|
<a name="l24"></a>
|
|
<a name="l25"></a></span><span class=cF2>//Main Modses</span><span class=cF0>
|
|
<a name="l26"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_EDIT </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l27"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_PLAY </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l28"></a>#</span><span class=cF1>define</span><span class=cF0> MMD_MODES_NUM </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l29"></a>
|
|
<a name="l30"></a></span><span class=cF9>CColorROPU32</span><span class=cF0> main_mode_colors[MMD_MODES_NUM] = {</span><span class=cF3>LTRED</span><span class=cF0>, </span><span class=cF3>LTGREEN</span><span class=cF0>};
|
|
<a name="l31"></a>
|
|
<a name="l32"></a></span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>"ST_MAIN_MODES"</span><span class=cF0>, </span><span class=cF6>"Edit\0Play\0"</span><span class=cF0>);
|
|
<a name="l33"></a>
|
|
<a name="l34"></a></span><span class=cF9>CCtrlBttnState</span><span class=cF0> main_mode_bttn;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a></span><span class=cF2>//Edit Modes</span><span class=cF0>
|
|
<a name="l37"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MASS </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l38"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_SPRING </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l39"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_CONNECTOR </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l40"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_THRUSTER </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l41"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MOVE </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l42"></a>#</span><span class=cF1>define</span><span class=cF0> EMD_MODES_NUM </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l43"></a>
|
|
<a name="l44"></a></span><span class=cF9>CColorROPU32</span><span class=cF0> edit_mode_colors[EMD_MODES_NUM] = {</span><span class=cF3>LTGRAY</span><span class=cF0>, </span><span class=cF3>LTCYAN</span><span class=cF0>, </span><span class=cF3>CYAN</span><span class=cF0>, </span><span class=cF3>YELLOW</span><span class=cF0>, </span><span class=cF3>LTBLUE</span><span class=cF0>};
|
|
<a name="l45"></a>
|
|
<a name="l46"></a></span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>"ST_EDIT_MODES"</span><span class=cF0>, </span><span class=cF6>"Mass\0Spring\0Connector\0Thruster\0Move\0"</span><span class=cF0>);
|
|
<a name="l47"></a>
|
|
<a name="l48"></a></span><span class=cF9>CCtrlBttnState</span><span class=cF0> edit_mode_bttn;
|
|
<a name="l49"></a>
|
|
<a name="l50"></a></span><span class=cF9>CTask</span><span class=cF0> *task;
|
|
<a name="l51"></a></span><span class=cF1>F64</span><span class=cF0> zoom;
|
|
<a name="l52"></a></span><span class=cF9>I64</span><span class=cF0> next_action_key, action_scan_codes[</span><span class=cFE>10</span><span class=cF0>];
|
|
<a name="l53"></a></span><span class=cF9>CMathODE</span><span class=cF0> *ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l54"></a>
|
|
<a name="l55"></a></span><span class=cF1>U0</span><span class=cF0> S2W(</span><span class=cF1>F64</span><span class=cF0> sx, </span><span class=cF1>F64</span><span class=cF0> sy, </span><span class=cF1>F64</span><span class=cF0> *_wx, </span><span class=cF1>F64</span><span class=cF0> *_wy)
|
|
<a name="l56"></a>{
|
|
<a name="l57"></a> sx -= task->pix_left + task->scroll_x;
|
|
<a name="l58"></a> sy -= task->pix_top + task->scroll_y;
|
|
<a name="l59"></a> *_wx = sx / zoom;
|
|
<a name="l60"></a> *_wy = sy / zoom;
|
|
<a name="l61"></a>}
|
|
<a name="l62"></a>
|
|
<a name="l63"></a></span><span class=cF1>U0</span><span class=cF0> W2S(</span><span class=cF1>F64</span><span class=cF0> wx, </span><span class=cF1>F64</span><span class=cF0> wy, </span><span class=cF1>F64</span><span class=cF0> *_sx, </span><span class=cF1>F64</span><span class=cF0> *_sy)
|
|
<a name="l64"></a>{
|
|
<a name="l65"></a> *_sx = wx * zoom;
|
|
<a name="l66"></a> *_sy = wy * zoom;
|
|
<a name="l67"></a>}
|
|
<a name="l68"></a>
|
|
<a name="l69"></a>#</span><span class=cF1>define</span><span class=cF0> ZOOM_STEPS </span><span class=cFE>20</span><span class=cF0>
|
|
<a name="l70"></a>
|
|
<a name="l71"></a></span><span class=cF1>U0</span><span class=cF0> Zoom(</span><span class=cF1>F64</span><span class=cF0> d)
|
|
<a name="l72"></a>{
|
|
<a name="l73"></a> </span><span class=cF1>F64</span><span class=cF0> sx, sy, wx, wy;
|
|
<a name="l74"></a> </span><span class=cF9>I64</span><span class=cF0> i, x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x, y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y;
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> d = </span><span class=cF5>Exp</span><span class=cF0>(</span><span class=cF5>Ln</span><span class=cF7>(</span><span class=cF0>d</span><span class=cF7>)</span><span class=cF0> / ZOOM_STEPS);
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < ZOOM_STEPS; i++)
|
|
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> S2W(x, y, &wx, &wy);
|
|
<a name="l80"></a> zoom = </span><span class=cF5>Clamp</span><span class=cF0>(zoom * d, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>02</span><span class=cF0>, </span><span class=cFE>50</span><span class=cF0>);
|
|
<a name="l81"></a> W2S(wx, wy, &sx, &sy);
|
|
<a name="l82"></a> task->scroll_x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - sx-task->pix_left;
|
|
<a name="l83"></a> task->scroll_y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - sy-task->pix_top;
|
|
<a name="l84"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>10</span><span class=cF0>);
|
|
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l86"></a>}
|
|
<a name="l87"></a>
|
|
<a name="l88"></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> *, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l89"></a>{
|
|
<a name="l90"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l91"></a> </span><span class=cF1>F64</span><span class=cF0> theta, d, x1, y1, x2, y2;
|
|
<a name="l92"></a> MyMass *tmpm;
|
|
<a name="l93"></a> MySpring *tmps;
|
|
<a name="l94"></a>
|
|
<a name="l95"></a> tmpm = ode->next_mass;
|
|
<a name="l96"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l97"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l98"></a> task->scroll_x = -tmpm->x * zoom + task->pix_width >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l99"></a> task->scroll_y = -tmpm->y * zoom + task->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l101"></a>
|
|
<a name="l102"></a> dc->flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
|
|
<a name="l103"></a> </span><span class=cF5>Mat4x4Scale</span><span class=cF0>(dc->r, zoom);
|
|
<a name="l104"></a>
|
|
<a name="l105"></a> </span><span class=cF1>switch</span><span class=cF0> (main_mode_bttn.state)
|
|
<a name="l106"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cF1>case</span><span class=cF0> MMD_EDIT:
|
|
<a name="l108"></a> task->text_attr = </span><span class=cF3>DKGRAY</span><span class=cF0> << </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l109"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l110"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l111"></a>
|
|
<a name="l112"></a> </span><span class=cF1>case</span><span class=cF0> MMD_PLAY:
|
|
<a name="l113"></a> task->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="l114"></a> dc->color = </span><span class=cF3>WHITE</span><span class=cF0>;
|
|
<a name="l115"></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="l116"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc, stars_x[i], stars_y[i], </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l117"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l119"></a>
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (main_mode_bttn.state == MMD_EDIT)
|
|
<a name="l121"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (edit_mode_bttn.state == EMD_CONNECTOR)
|
|
<a name="l123"></a> {
|
|
<a name="l124"></a> dc->color = </span><span class=cF3>CYAN</span><span class=cF0>;
|
|
<a name="l125"></a> S2W(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>11</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>7</span><span class=cF0>, &x1, &y1);
|
|
<a name="l126"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, next_action_key);
|
|
<a name="l127"></a> }
|
|
<a name="l128"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (edit_mode_bttn.state == EMD_THRUSTER)
|
|
<a name="l129"></a> {
|
|
<a name="l130"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l131"></a> S2W(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>11</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>7</span><span class=cF0>, &x1, &y1);
|
|
<a name="l132"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, next_action_key);
|
|
<a name="l133"></a> }
|
|
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l135"></a>
|
|
<a name="l136"></a> tmps = ode->next_spring;
|
|
<a name="l137"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l138"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->type == EMD_SPRING)
|
|
<a name="l140"></a> {
|
|
<a name="l141"></a> dc->color = </span><span class=cF3>LTCYAN</span><span class=cF0>;
|
|
<a name="l142"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmps->end1->x, tmps->end1->y, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l143"></a> tmps->end2->x, tmps->end2->y, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l144"></a> }
|
|
<a name="l145"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmps->type == EMD_CONNECTOR)
|
|
<a name="l146"></a> {
|
|
<a name="l147"></a> dc->color = </span><span class=cF3>CYAN</span><span class=cF0>;
|
|
<a name="l148"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmps->end1->x, tmps->end1->y, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l149"></a> tmps->end2->x, tmps->end2->y, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l150"></a> }
|
|
<a name="l151"></a> tmps = tmps->next;
|
|
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l153"></a>
|
|
<a name="l154"></a> dc->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l155"></a> tmpm = ode->next_mass;
|
|
<a name="l156"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l157"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l158"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, tmpm->x, tmpm->y, </span><span class=cFE>0</span><span class=cF0>, tmpm->img);
|
|
<a name="l159"></a> tmpm = tmpm->next;
|
|
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l161"></a>
|
|
<a name="l162"></a> tmps = ode->next_spring;
|
|
<a name="l163"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l164"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l165"></a> x1 = tmps->end1->x;
|
|
<a name="l166"></a> y1 = tmps->end1->y;
|
|
<a name="l167"></a> x2 = tmps->end2->x;
|
|
<a name="l168"></a> y2 = tmps->end2->y;
|
|
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->type == EMD_THRUSTER)
|
|
<a name="l170"></a> {
|
|
<a name="l171"></a> theta = </span><span class=cF5>Arg</span><span class=cF0>(x2 - x1, y2 - y1);
|
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps->action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l173"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l174"></a> dc->flags |= </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
|
|
<a name="l175"></a> </span><span class=cF5>DCSymmetry3Set</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>256</span><span class=cF0>, x1, y1, </span><span class=cFE>0</span><span class=cF0>, x1 - </span><span class=cFE>256</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>256</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l176"></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>8</span><span class=cF0>; i++)
|
|
<a name="l177"></a> {
|
|
<a name="l178"></a> d = </span><span class=cFE>20</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0> + </span><span class=cFE>6</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF1>if</span><span class=cF0> (d < </span><span class=cFE>10</span><span class=cF0>)
|
|
<a name="l180"></a> dc->color = </span><span class=cF3>BLUE</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (d < </span><span class=cFE>16</span><span class=cF0>)
|
|
<a name="l182"></a> dc->color = </span><span class=cF3>LTBLUE</span><span class=cF0>;
|
|
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l184"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l185"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1 - </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>3</span><span class=cF0> * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l186"></a> x1 - d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l187"></a> y1 - d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l188"></a>
|
|
<a name="l189"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1 - </span><span class=cFE>2</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, y1 - </span><span class=cFE>2</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l190"></a> x1 - d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l191"></a> y1 - d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0> - </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> * d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>theta</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l192"></a> }
|
|
<a name="l193"></a> dc->flags &= ~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
|
|
<a name="l194"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l195"></a> </span><span class=cF5>Sprite3ZB</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFA><3></span><span class=cF0>, theta);
|
|
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (zoom > </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
|
|
<a name="l197"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l198"></a> dc->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l199"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>x1 * </span><span class=cFE>7</span><span class=cF0> + x2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>y1 * </span><span class=cFE>7</span><span class=cF0> + y2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmps->action_key);
|
|
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l201"></a> }
|
|
<a name="l202"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmps->type == EMD_CONNECTOR)
|
|
<a name="l203"></a> {
|
|
<a name="l204"></a> </span><span class=cF1>if</span><span class=cF0> (zoom > </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>)
|
|
<a name="l205"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l206"></a> dc->color = </span><span class=cF3>CYAN</span><span class=cF0>;
|
|
<a name="l207"></a> </span><span class=cF5>GrPutChar3</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF0>x1 * </span><span class=cFE>7</span><span class=cF0> + x2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>y1 * </span><span class=cFE>7</span><span class=cF0> + y2</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmps->action_key);
|
|
<a name="l208"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l209"></a> }
|
|
<a name="l210"></a> tmps = tmps->next;
|
|
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l212"></a>}
|
|
<a name="l213"></a>
|
|
<a name="l214"></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="l215"></a>{
|
|
<a name="l216"></a> </span><span class=cF2>//The forces due to springs and drag are</span><span class=cF0>
|
|
<a name="l217"></a> </span><span class=cF2>//automatically handled by the</span><span class=cF0>
|
|
<a name="l218"></a> </span><span class=cF2>//ode code. We can add new forces</span><span class=cF0>
|
|
<a name="l219"></a> </span><span class=cF2>//here.</span><span class=cF0>
|
|
<a name="l220"></a> </span><span class=cF1>F64</span><span class=cF0> d, dd;
|
|
<a name="l221"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
|
|
<a name="l222"></a> MyMass *tmpm1, *tmpm2;
|
|
<a name="l223"></a> MySpring *tmps;
|
|
<a name="l224"></a>
|
|
<a name="l225"></a> tmpm1 = ode->next_mass;
|
|
<a name="l226"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l227"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l228"></a> tmpm2 = tmpm1->next;
|
|
<a name="l229"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm2 != &ode->next_mass)
|
|
<a name="l230"></a> {
|
|
<a name="l231"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmpm2->state->x, &tmpm1->state->x);
|
|
<a name="l232"></a> dd = </span><span class=cF5>D3NormSqr</span><span class=cF0>(&p);
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (dd <= </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cFE>2</span><span class=cF0> * RADIUS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l235"></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="l236"></a> dd = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </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=cFE>2</span><span class=cF0> * RADIUS) - dd</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l237"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, dd / d);
|
|
<a name="l238"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmpm2->DstateDt->DxDt, &p);
|
|
<a name="l239"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&tmpm1->DstateDt->DxDt, &p);
|
|
<a name="l240"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l241"></a> tmpm2 = tmpm2->next;
|
|
<a name="l242"></a> }
|
|
<a name="l243"></a> tmpm1 = tmpm1->next;
|
|
<a name="l244"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> tmps = ode->next_spring;
|
|
<a name="l247"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l248"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l249"></a> </span><span class=cF1>if</span><span class=cF0> (main_mode_bttn.state == MMD_PLAY && tmps->type == EMD_THRUSTER &&
|
|
<a name="l250"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps->action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l251"></a> {
|
|
<a name="l252"></a> </span><span class=cF5>D3Sub</span><span class=cF0>(&p, &tmps->end2->state->x, &tmps->end1->state->x);
|
|
<a name="l253"></a> </span><span class=cF5>D3Unit</span><span class=cF0>(&p);
|
|
<a name="l254"></a> </span><span class=cF5>D3MulEqu</span><span class=cF0>(&p, </span><span class=cFE>2000</span><span class=cF0>);
|
|
<a name="l255"></a> </span><span class=cF5>D3AddEqu</span><span class=cF0>(&tmps->end1->DstateDt->DxDt, &p);
|
|
<a name="l256"></a> }
|
|
<a name="l257"></a> tmps = tmps->next;
|
|
<a name="l258"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l259"></a>}
|
|
<a name="l260"></a>
|
|
<a name="l261"></a>MyMass *PlaceMass(</span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l262"></a>{
|
|
<a name="l263"></a> MyMass *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="l264"></a>
|
|
<a name="l265"></a> tmpm->mass = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l266"></a> tmpm->drag_profile_factor = </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l267"></a> tmpm->x = x;
|
|
<a name="l268"></a> tmpm->y = y;
|
|
<a name="l269"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpm, ode->last_mass);
|
|
<a name="l270"></a>
|
|
<a name="l271"></a> </span><span class=cF1>return</span><span class=cF0> tmpm;
|
|
<a name="l272"></a>}
|
|
<a name="l273"></a>
|
|
<a name="l274"></a>MySpring *PlaceSpring(MyMass *tmpm1, MyMass *tmpm2, </span><span class=cF9>I64</span><span class=cF0> type)
|
|
<a name="l275"></a>{
|
|
<a name="l276"></a> MySpring *tmps = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>MySpring</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l277"></a> </span><span class=cF1>F64</span><span class=cF0> d = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmpm1->x, &tmpm2->x);
|
|
<a name="l278"></a>
|
|
<a name="l279"></a> tmps->end1 = tmpm1;
|
|
<a name="l280"></a> tmps->end2 = tmpm2;
|
|
<a name="l281"></a> tmps->rest_len = d;
|
|
<a name="l282"></a> tmps->type = type;
|
|
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (type == EMD_THRUSTER)
|
|
<a name="l284"></a> tmps->const = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l285"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l286"></a> tmps->const = </span><span class=cFE>2500000</span><span class=cF0>/</span><span class=cF5>Sqr</span><span class=cF0>(d);
|
|
<a name="l287"></a> tmps->action_key = next_action_key;
|
|
<a name="l288"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmps, ode->last_spring);
|
|
<a name="l289"></a>
|
|
<a name="l290"></a> </span><span class=cF1>return</span><span class=cF0> tmps;
|
|
<a name="l291"></a>}
|
|
<a name="l292"></a>
|
|
<a name="l293"></a></span><span class=cF1>U0</span><span class=cF0> CenterMasses()
|
|
<a name="l294"></a>{
|
|
<a name="l295"></a> </span><span class=cF9>CD3</span><span class=cF0> p;
|
|
<a name="l296"></a> MyMass *tmpm1, *tmpm2;
|
|
<a name="l297"></a>
|
|
<a name="l298"></a> tmpm1 = ode->next_mass;
|
|
<a name="l299"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 != &ode->next_mass)
|
|
<a name="l300"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l301"></a> </span><span class=cF5>D3Copy</span><span class=cF0>(&p, &tmpm1->x);
|
|
<a name="l302"></a> tmpm2 = ode->next_mass;
|
|
<a name="l303"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm2 != &ode->next_mass)
|
|
<a name="l304"></a> {
|
|
<a name="l305"></a> </span><span class=cF5>D3SubEqu</span><span class=cF0>(&tmpm2->x, &p);
|
|
<a name="l306"></a> tmpm2 = tmpm2->next;
|
|
<a name="l307"></a> }
|
|
<a name="l308"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l309"></a>}
|
|
<a name="l310"></a>
|
|
<a name="l311"></a></span><span class=cF1>U0</span><span class=cF0> NullSprings()
|
|
<a name="l312"></a>{
|
|
<a name="l313"></a> MySpring *tmps = ode->next_spring;
|
|
<a name="l314"></a>
|
|
<a name="l315"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l317"></a> tmps->rest_len = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmps->end1->x, &tmps->end2->x);
|
|
<a name="l318"></a> tmps = tmps->next;
|
|
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l320"></a>}
|
|
<a name="l321"></a>
|
|
<a name="l322"></a></span><span class=cF1>U0</span><span class=cF0> BreakConnectors()
|
|
<a name="l323"></a>{
|
|
<a name="l324"></a> MySpring *tmps = ode->next_spring, *tmps1;
|
|
<a name="l325"></a>
|
|
<a name="l326"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l327"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l328"></a> tmps1 = tmps->next;
|
|
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->type == EMD_CONNECTOR && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, action_scan_codes[tmps->action_key - </span><span class=cF6>'0'</span><span class=cF0>]</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l330"></a> {
|
|
<a name="l331"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmps);
|
|
<a name="l332"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l333"></a> }
|
|
<a name="l334"></a> tmps = tmps1;
|
|
<a name="l335"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l336"></a>}
|
|
<a name="l337"></a>
|
|
<a name="l338"></a></span><span class=cF1>U0</span><span class=cF0> Init()
|
|
<a name="l339"></a>{
|
|
<a name="l340"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l341"></a>
|
|
<a name="l342"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
<a name="l343"></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>9</span><span class=cF0>; i++)
|
|
<a name="l344"></a> action_scan_codes[i] = </span><span class=cF5>Char2ScanCode</span><span class=cF0>(</span><span class=cF6>'0'</span><span class=cF0> + i);
|
|
<a name="l345"></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="l346"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l347"></a> stars_x[i] = </span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>8192</span><span class=cF0> - </span><span class=cFE>4096</span><span class=cF0>;
|
|
<a name="l348"></a> stars_y[i] = </span><span class=cF5>RandU32</span><span class=cF0> % </span><span class=cFE>8192</span><span class=cF0> - </span><span class=cFE>4096</span><span class=cF0>;
|
|
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l350"></a> next_action_key = </span><span class=cF6>'1'</span><span class=cF0>;
|
|
<a name="l351"></a> zoom = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l352"></a> ode = </span><span class=cF5>ODENew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>e-</span><span class=cFE>4</span><span class=cF0>, </span><span class=cF3>ODEF_HAS_MASSES</span><span class=cF0>);
|
|
<a name="l353"></a> ode->derive = &MyDerivative;
|
|
<a name="l354"></a> ode->acceleration_limit = </span><span class=cFE>5</span><span class=cF0>e3;
|
|
<a name="l355"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
|
|
<a name="l356"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
|
|
<a name="l357"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(ode, </span><span class=cF5>Fs</span><span class=cF0>->last_ode);
|
|
<a name="l358"></a>}
|
|
<a name="l359"></a>
|
|
<a name="l360"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp()
|
|
<a name="l361"></a>{
|
|
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (ode)
|
|
<a name="l363"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l364"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(ode);
|
|
<a name="l365"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&ode->next_mass, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l366"></a> </span><span class=cF5>QueueDel</span><span class=cF0>(&ode->next_spring, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l367"></a> </span><span class=cF5>ODEDel</span><span class=cF0>(ode);
|
|
<a name="l368"></a> ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l369"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l370"></a>}
|
|
<a name="l371"></a>
|
|
<a name="l372"></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="l373"></a>{</span><span class=cF2>//Make white noise for given number of mS.</span><span class=cF0>
|
|
<a name="l374"></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="l375"></a> </span><span class=cF9>CSoundEffectFrame</span><span class=cF0> *ns;
|
|
<a name="l376"></a>
|
|
<a name="l377"></a> </span><span class=cF1>if</span><span class=cF0> (mS > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l378"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l379"></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="l380"></a> ns->type = </span><span class=cF3>SE_NOISE</span><span class=cF0>;
|
|
<a name="l381"></a> ns->duration = mS / </span><span class=cFE>1000</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l382"></a> ns->ona1 = min_ona;
|
|
<a name="l383"></a> ns->ona2 = max_ona;
|
|
<a name="l384"></a> </span><span class=cFB>music</span><span class=cF0>.mute++;
|
|
<a name="l385"></a> </span><span class=cF5>SoundEffectTask</span><span class=cF0>(ns);
|
|
<a name="l386"></a> </span><span class=cF5>Sound</span><span class=cF0>;
|
|
<a name="l387"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l388"></a>
|
|
<a name="l389"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l390"></a>}
|
|
<a name="l391"></a>
|
|
<a name="l392"></a></span><span class=cF1>U0</span><span class=cF0> PlayShip()
|
|
<a name="l393"></a>{
|
|
<a name="l394"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
|
|
<a name="l395"></a> </span><span class=cF1>F64</span><span class=cF0> last_noise = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l396"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
|
|
<a name="l397"></a>
|
|
<a name="l398"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
|
|
<a name="l399"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l400"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l401"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l402"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l403"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l404"></a> </span><span class=cF6>"Edit {"</span><span class=cF0>
|
|
<a name="l405"></a> </span><span class=cF6>" EditShip(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l406"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l407"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l408"></a> </span><span class=cF6>" Center(,'c');"</span><span class=cF0>
|
|
<a name="l409"></a> </span><span class=cF6>" Damp(,'d');"</span><span class=cF0>
|
|
<a name="l410"></a> </span><span class=cF6>" Action0(,'0');"</span><span class=cF0>
|
|
<a name="l411"></a> </span><span class=cF6>" Action1(,'1');"</span><span class=cF0>
|
|
<a name="l412"></a> </span><span class=cF6>" Action2(,'2');"</span><span class=cF0>
|
|
<a name="l413"></a> </span><span class=cF6>" Action3(,'3');"</span><span class=cF0>
|
|
<a name="l414"></a> </span><span class=cF6>" Action4(,'4');"</span><span class=cF0>
|
|
<a name="l415"></a> </span><span class=cF6>" Action5(,'5');"</span><span class=cF0>
|
|
<a name="l416"></a> </span><span class=cF6>" Action6(,'6');"</span><span class=cF0>
|
|
<a name="l417"></a> </span><span class=cF6>" Action7(,'7');"</span><span class=cF0>
|
|
<a name="l418"></a> </span><span class=cF6>" Action8(,'8');"</span><span class=cF0>
|
|
<a name="l419"></a> </span><span class=cF6>" Action9(,'9');"</span><span class=cF0>
|
|
<a name="l420"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l421"></a> </span><span class=cF6>"View {"</span><span class=cF0>
|
|
<a name="l422"></a> </span><span class=cF6>" ZoomIn(,'z');"</span><span class=cF0>
|
|
<a name="l423"></a> </span><span class=cF6>" ZoomOut(,'Z');"</span><span class=cF0>
|
|
<a name="l424"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l425"></a> );
|
|
<a name="l426"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l427"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l428"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l429"></a> </span><span class=cF1>while</span><span class=cF0> (main_mode_bttn.state == MMD_PLAY)
|
|
<a name="l430"></a> {
|
|
<a name="l431"></a> BreakConnectors;
|
|
<a name="l432"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageScan</span><span class=cF7>(</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=cF7>)</span><span class=cF0>)
|
|
<a name="l433"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l434"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l435"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l436"></a> {
|
|
<a name="l437"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
|
|
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> > last_noise + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0>)
|
|
<a name="l439"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l440"></a> MyNoise(</span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>18</span><span class=cF0>, </span><span class=cFE>46</span><span class=cF0>);
|
|
<a name="l441"></a> last_noise = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l442"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l443"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l444"></a>
|
|
<a name="l445"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
|
|
<a name="l446"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&Zoom, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l447"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l448"></a>
|
|
<a name="l449"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
|
|
<a name="l450"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&Zoom, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l451"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l452"></a>
|
|
<a name="l453"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
|
|
<a name="l454"></a> CenterMasses;
|
|
<a name="l455"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l456"></a>
|
|
<a name="l457"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
|
|
<a name="l458"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>002</span><span class=cF0>;
|
|
<a name="l459"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l460"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l461"></a>
|
|
<a name="l462"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (++main_mode_bttn.state == MMD_MODES_NUM)
|
|
<a name="l464"></a> main_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l465"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
|
|
<a name="l466"></a> </span><span class=cF1>goto</span><span class=cF0> ps_done;
|
|
<a name="l467"></a>
|
|
<a name="l468"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l469"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l470"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l471"></a> }
|
|
<a name="l472"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l473"></a>
|
|
<a name="l474"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
|
|
<a name="l475"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l476"></a> {
|
|
<a name="l477"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
|
|
<a name="l478"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
|
|
<a name="l479"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
|
|
<a name="l480"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l481"></a> }
|
|
<a name="l482"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l483"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l484"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l485"></a> }
|
|
<a name="l486"></a>ps_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
|
|
<a name="l487"></a> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l488"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l489"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l490"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l491"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l492"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l493"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l494"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l495"></a> </span><span class=cF1>if</span><span class=cF0> (!okay)
|
|
<a name="l496"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l497"></a>}
|
|
<a name="l498"></a>
|
|
<a name="l499"></a></span><span class=cF1>U0</span><span class=cF0> EditShip()
|
|
<a name="l500"></a>{
|
|
<a name="l501"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
|
|
<a name="l502"></a> </span><span class=cF1>F64</span><span class=cF0> wx, wy;
|
|
<a name="l503"></a> </span><span class=cF1>Bool</span><span class=cF0> okay;
|
|
<a name="l504"></a> MyMass *tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l505"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_edit_mode = </span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, EMD_MODES_NUM,
|
|
<a name="l506"></a> </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_EDIT_MODES"</span><span class=cF7>)</span><span class=cF0>, edit_mode_colors, &edit_mode_bttn);
|
|
<a name="l507"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
|
|
<a name="l508"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l509"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l510"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l511"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l512"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l513"></a> </span><span class=cF6>" PlayShip(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l514"></a> </span><span class=cF6>" Center(,'c');"</span><span class=cF0>
|
|
<a name="l515"></a> </span><span class=cF6>" Damp(,'d');"</span><span class=cF0>
|
|
<a name="l516"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l517"></a> </span><span class=cF6>"Edit {"</span><span class=cF0>
|
|
<a name="l518"></a> </span><span class=cF6>" Move(,'v');"</span><span class=cF0>
|
|
<a name="l519"></a> </span><span class=cF6>" Mass(,'m');"</span><span class=cF0>
|
|
<a name="l520"></a> </span><span class=cF6>" Spring(,'s');"</span><span class=cF0>
|
|
<a name="l521"></a> </span><span class=cF6>" Connector(,'n');"</span><span class=cF0>
|
|
<a name="l522"></a> </span><span class=cF6>" Thruster(,'t');"</span><span class=cF0>
|
|
<a name="l523"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l524"></a> </span><span class=cF6>" Action0(,'0');"</span><span class=cF0>
|
|
<a name="l525"></a> </span><span class=cF6>" Action1(,'1');"</span><span class=cF0>
|
|
<a name="l526"></a> </span><span class=cF6>" Action2(,'2');"</span><span class=cF0>
|
|
<a name="l527"></a> </span><span class=cF6>" Action3(,'3');"</span><span class=cF0>
|
|
<a name="l528"></a> </span><span class=cF6>" Action4(,'4');"</span><span class=cF0>
|
|
<a name="l529"></a> </span><span class=cF6>" Action5(,'5');"</span><span class=cF0>
|
|
<a name="l530"></a> </span><span class=cF6>" Action6(,'6');"</span><span class=cF0>
|
|
<a name="l531"></a> </span><span class=cF6>" Action7(,'7');"</span><span class=cF0>
|
|
<a name="l532"></a> </span><span class=cF6>" Action8(,'8');"</span><span class=cF0>
|
|
<a name="l533"></a> </span><span class=cF6>" Action9(,'9');"</span><span class=cF0>
|
|
<a name="l534"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l535"></a> </span><span class=cF6>"View {"</span><span class=cF0>
|
|
<a name="l536"></a> </span><span class=cF6>" ZoomIn(,'z');"</span><span class=cF0>
|
|
<a name="l537"></a> </span><span class=cF6>" ZoomOut(,'Z');"</span><span class=cF0>
|
|
<a name="l538"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l539"></a> );
|
|
<a name="l540"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l541"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l542"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l543"></a> </span><span class=cF1>while</span><span class=cF0> (main_mode_bttn.state == MMD_EDIT)
|
|
<a name="l544"></a> {
|
|
<a name="l545"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&arg1, &arg2,
|
|
<a name="l546"></a> </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>|
|
|
<a name="l547"></a> </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> | </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=cF7>)</span><span class=cF0>)
|
|
<a name="l548"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l549"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
|
|
<a name="l550"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
|
|
<a name="l551"></a> {
|
|
<a name="l552"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MASS:
|
|
<a name="l553"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &wx, &wy);
|
|
<a name="l554"></a> tmpm1 = PlaceMass(wx, wy);
|
|
<a name="l555"></a> </span><span class=cF1>if</span><span class=cF0> (ode->next_mass == tmpm1)
|
|
<a name="l556"></a> tmpm1->img = </span><span class=cFA><1></span><span class=cF0>;
|
|
<a name="l557"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l558"></a> tmpm1->img = </span><span class=cFA><2></span><span class=cF0>;
|
|
<a name="l559"></a> tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l560"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l561"></a>
|
|
<a name="l562"></a> </span><span class=cF1>case</span><span class=cF0> EMD_SPRING:
|
|
<a name="l563"></a> </span><span class=cF1>case</span><span class=cF0> EMD_CONNECTOR:
|
|
<a name="l564"></a> </span><span class=cF1>case</span><span class=cF0> EMD_THRUSTER:
|
|
<a name="l565"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
|
|
<a name="l566"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &wx, &wy);
|
|
<a name="l567"></a> tmpm1 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, wx, wy);
|
|
<a name="l568"></a> tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l569"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l570"></a> }
|
|
<a name="l571"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l572"></a>
|
|
<a name="l573"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
|
|
<a name="l574"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
|
|
<a name="l575"></a> {
|
|
<a name="l576"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MASS:
|
|
<a name="l577"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l578"></a>
|
|
<a name="l579"></a> </span><span class=cF1>case</span><span class=cF0> EMD_SPRING:
|
|
<a name="l580"></a> </span><span class=cF1>case</span><span class=cF0> EMD_CONNECTOR:
|
|
<a name="l581"></a> </span><span class=cF1>case</span><span class=cF0> EMD_THRUSTER:
|
|
<a name="l582"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &wx, &wy);
|
|
<a name="l583"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 && </span><span class=cF7>(</span><span class=cF0>tmpm2 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, wx, wy)</span><span class=cF7>)</span><span class=cF0> && tmpm1 != tmpm2)
|
|
<a name="l584"></a> PlaceSpring(tmpm1, tmpm2, edit_mode_bttn.state);
|
|
<a name="l585"></a> tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l586"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l587"></a>
|
|
<a name="l588"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
|
|
<a name="l589"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &wx, &wy);
|
|
<a name="l590"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
|
|
<a name="l591"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l592"></a> tmpm1->x = wx;
|
|
<a name="l593"></a> tmpm1->y = wy;
|
|
<a name="l594"></a> tmpm1->z = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l595"></a> NullSprings;
|
|
<a name="l596"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l597"></a> tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l598"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l599"></a> }
|
|
<a name="l600"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l601"></a>
|
|
<a name="l602"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
|
|
<a name="l603"></a> </span><span class=cF1>switch</span><span class=cF0> (edit_mode_bttn.state)
|
|
<a name="l604"></a> {
|
|
<a name="l605"></a> </span><span class=cF1>case</span><span class=cF0> EMD_MOVE:
|
|
<a name="l606"></a> S2W(</span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y, &wx, &wy);
|
|
<a name="l607"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
|
|
<a name="l608"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l609"></a> tmpm1->x = wx;
|
|
<a name="l610"></a> tmpm1->y = wy;
|
|
<a name="l611"></a> tmpm1->z = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l612"></a> NullSprings;
|
|
<a name="l613"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l614"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l615"></a> }
|
|
<a name="l616"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l617"></a>
|
|
<a name="l618"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
|
|
<a name="l619"></a> </span><span class=cF1>if</span><span class=cF0> (++edit_mode_bttn.state == EMD_MODES_NUM)
|
|
<a name="l620"></a> edit_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l621"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l622"></a>
|
|
<a name="l623"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>:
|
|
<a name="l624"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l625"></a>
|
|
<a name="l626"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l627"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l628"></a> {
|
|
<a name="l629"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l630"></a> CleanUp;
|
|
<a name="l631"></a> Init;
|
|
<a name="l632"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l633"></a>
|
|
<a name="l634"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
|
|
<a name="l635"></a> next_action_key = arg1;
|
|
<a name="l636"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l637"></a>
|
|
<a name="l638"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
|
|
<a name="l639"></a> CenterMasses;
|
|
<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>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
|
|
<a name="l643"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
|
|
<a name="l644"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>002</span><span class=cF0>;
|
|
<a name="l645"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0001</span><span class=cF0>;
|
|
<a name="l646"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l647"></a>
|
|
<a name="l648"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
|
|
<a name="l649"></a> edit_mode_bttn.state = EMD_MOVE;
|
|
<a name="l650"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l651"></a>
|
|
<a name="l652"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
|
|
<a name="l653"></a> edit_mode_bttn.state = EMD_MASS;
|
|
<a name="l654"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l655"></a>
|
|
<a name="l656"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'n'</span><span class=cF0>:
|
|
<a name="l657"></a> edit_mode_bttn.state = EMD_CONNECTOR;
|
|
<a name="l658"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l659"></a>
|
|
<a name="l660"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
|
|
<a name="l661"></a> edit_mode_bttn.state = EMD_SPRING;
|
|
<a name="l662"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l663"></a>
|
|
<a name="l664"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>:
|
|
<a name="l665"></a> edit_mode_bttn.state = EMD_THRUSTER;
|
|
<a name="l666"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l667"></a>
|
|
<a name="l668"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'z'</span><span class=cF0>:
|
|
<a name="l669"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&Zoom, </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l670"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l671"></a>
|
|
<a name="l672"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'Z'</span><span class=cF0>:
|
|
<a name="l673"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&Zoom, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l674"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l675"></a>
|
|
<a name="l676"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l677"></a> </span><span class=cF1>if</span><span class=cF0> (++main_mode_bttn.state == MMD_MODES_NUM)
|
|
<a name="l678"></a> main_mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l679"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
|
|
<a name="l680"></a> </span><span class=cF1>goto</span><span class=cF0> es_done;
|
|
<a name="l681"></a>
|
|
<a name="l682"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l683"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l684"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l685"></a> }
|
|
<a name="l686"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l687"></a>
|
|
<a name="l688"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>:
|
|
<a name="l689"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l690"></a> {
|
|
<a name="l691"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
|
|
<a name="l692"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
|
|
<a name="l693"></a> ode->drag_v2 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>000002</span><span class=cF0>;
|
|
<a name="l694"></a> ode->drag_v3 = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0000001</span><span class=cF0>;
|
|
<a name="l695"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l696"></a> }
|
|
<a name="l697"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l698"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l699"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l700"></a> }
|
|
<a name="l701"></a>es_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
|
|
<a name="l702"></a> okay = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l703"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l704"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l705"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l706"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l707"></a> okay = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l708"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l709"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l710"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_edit_mode);
|
|
<a name="l711"></a> </span><span class=cF1>if</span><span class=cF0> (!okay)
|
|
<a name="l712"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l713"></a>}
|
|
<a name="l714"></a>
|
|
<a name="l715"></a></span><span class=cF1>U0</span><span class=cF0> Strut()
|
|
<a name="l716"></a>{
|
|
<a name="l717"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_main_mode;
|
|
<a name="l718"></a>
|
|
<a name="l719"></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="l720"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit |= </span><span class=cF3>WIF_SELF_MS_L</span><span class=cF0> | </span><span class=cF3>WIF_SELF_MS_R</span><span class=cF0> | </span><span class=cF3>WIG_DBL_CLICK</span><span class=cF0>;
|
|
<a name="l721"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l722"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l723"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l724"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l725"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l726"></a> </span><span class=cF6>"\n$WW,1$$PURPLE$$TX+CX,\"Build a ship.\"$$FG$\n\n"</span><span class=cF0>
|
|
<a name="l727"></a> </span><span class=cF6>"Sel mass mode.\tLeft-click to place masses.\n"</span><span class=cF0>
|
|
<a name="l728"></a> </span><span class=cF6>"Sel spring mode.\tLeft-drag to make members.\n"</span><span class=cF0>
|
|
<a name="l729"></a> </span><span class=cF6>"Sel thruster mode.\tPress a digit, 0-9. Drag to make thruster.\n"</span><span class=cF0>
|
|
<a name="l730"></a> </span><span class=cF6>"Sel connector mode.\tPress a digit, 0-9. "</span><span class=cF0>
|
|
<a name="l731"></a> </span><span class=cF6>"Drag to make breakable connector.\n\n"</span><span class=cF0>
|
|
<a name="l732"></a> </span><span class=cF6>"Press $GREEN$<SPACE>$FG$ to run the game. Press digits to operate "</span><span class=cF0>
|
|
<a name="l733"></a> </span><span class=cF6>"thrusters and break connectors.\n\n"</span><span class=cF0>
|
|
<a name="l734"></a> </span><span class=cF6>"Press $GREEN$<z>$FG$ or $GREEN$<SHIFT-Z>$FG$ to zoom in/out.\n\n"</span><span class=cF0>;
|
|
<a name="l735"></a>
|
|
<a name="l736"></a> </span><span class=cF5>PressAKey</span><span class=cF0>;
|
|
<a name="l737"></a> bt_main_mode = </span><span class=cF5>CtrlBttnNew</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>16</span><span class=cF7>)</span><span class=cF0> >> </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, MMD_MODES_NUM,
|
|
<a name="l738"></a> </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_MAIN_MODES"</span><span class=cF7>)</span><span class=cF0>, main_mode_colors, &main_mode_bttn);
|
|
<a name="l739"></a> </span><span class=cF5>PaletteSetLight</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l740"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l741"></a> Init;
|
|
<a name="l742"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l743"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l744"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l745"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l746"></a> {
|
|
<a name="l747"></a> EditShip;
|
|
<a name="l748"></a> PlayShip;
|
|
<a name="l749"></a> }
|
|
<a name="l750"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l751"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l752"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l753"></a> CleanUp;
|
|
<a name="l754"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l755"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l756"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l757"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_main_mode);
|
|
<a name="l758"></a>}
|
|
</span></pre></body>
|
|
</html>
|