mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
555 lines
49 KiB
HTML
Executable file
555 lines
49 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.00">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>F64</span><span class=cF0> SpanTime()
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
|
|
<a name="l4"></a> </span><span class=cF1>return</span><span class=cF0> a.elapsed_t + </span><span class=cF5>tS</span><span class=cF0> - a.start_wall_t;
|
|
<a name="l5"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF1>return</span><span class=cF0> a.elapsed_t;
|
|
<a name="l7"></a>}
|
|
<a name="l8"></a>
|
|
<a name="l9"></a></span><span class=cF1>F64</span><span class=cF0> Cost(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
|
|
<a name="l10"></a>{
|
|
<a name="l11"></a> MyMass *tmpm;
|
|
<a name="l12"></a> MySpring *tmps;
|
|
<a name="l13"></a> </span><span class=cF1>F64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l14"></a>
|
|
<a name="l15"></a> tmpm=ode->next_mass;
|
|
<a name="l16"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l18"></a> res += tmpm->cost;
|
|
<a name="l19"></a> tmpm = tmpm->next;
|
|
<a name="l20"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l21"></a> tmps = ode->next_spring;
|
|
<a name="l22"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l23"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l24"></a> res += tmps->cost;
|
|
<a name="l25"></a> tmps = tmps->next;
|
|
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l27"></a>
|
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l29"></a>}
|
|
<a name="l30"></a>
|
|
<a name="l31"></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="l32"></a>{
|
|
<a name="l33"></a> MyMass *tmpm;
|
|
<a name="l34"></a> MySpring *tmps;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> tmps = ode->next_spring;
|
|
<a name="l37"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l38"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmps->flags & </span><span class=cF3>SSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l40"></a> {
|
|
<a name="l41"></a> dc->color = tmps->color;
|
|
<a name="l42"></a> dc->thick = tmps->thick;
|
|
<a name="l43"></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>, tmps->end2->x, tmps->end2->y, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l44"></a> }
|
|
<a name="l45"></a> tmps = tmps->next;
|
|
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l47"></a>
|
|
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (cursor_mass)
|
|
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> dc->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l51"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l52"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFB>mouse</span><span class=cF0>.pos.x - task->pix_left - task->scroll_x,
|
|
<a name="l53"></a> </span><span class=cFB>mouse</span><span class=cF0>.pos.y - task->pix_top - task->scroll_y, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l54"></a> cursor_mass->x, cursor_mass->y, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l55"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l56"></a>
|
|
<a name="l57"></a> tmpm=ode->next_mass;
|
|
<a name="l58"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &ode->next_mass)
|
|
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpm->flags&</span><span class=cF3>MSF_INACTIVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l61"></a> {
|
|
<a name="l62"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l63"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm->x, tmpm->y, tmpm->radius);
|
|
<a name="l64"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmpm->x, tmpm->y, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l65"></a> dc->color = tmpm->color;
|
|
<a name="l66"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm->x, tmpm->y, tmpm->radius);
|
|
<a name="l67"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(dc, tmpm->x, tmpm->y, </span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l68"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l69"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc, tmpm->x, tmpm->y, tmpm->radius);
|
|
<a name="l70"></a> }
|
|
<a name="l71"></a> tmpm = tmpm->next;
|
|
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l73"></a>
|
|
<a name="l74"></a> dc->color = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l75"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Cost:%12.2,f"</span><span class=cF0>, Cost</span><span class=cF7>(</span><span class=cF0>ode</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l76"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>90</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cF6>"Time:%12.2f"</span><span class=cF0>, SpanTime);
|
|
<a name="l77"></a>}
|
|
<a name="l78"></a>
|
|
<a name="l79"></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="l80"></a>{
|
|
<a name="l81"></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="l82"></a>
|
|
<a name="l83"></a> tmpm->drag_profile_factor = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l84"></a> tmpm->x = x;
|
|
<a name="l85"></a> tmpm->y = y;
|
|
<a name="l86"></a> tmpm->mass = MASS_MASS;
|
|
<a name="l87"></a> tmpm->radius = MASS_RADIUS;
|
|
<a name="l88"></a> tmpm->cost = </span><span class=cFE>25</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * COST_SCALE;
|
|
<a name="l89"></a> tmpm->color = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpm, ode->last_mass);
|
|
<a name="l91"></a>
|
|
<a name="l92"></a> </span><span class=cF1>return</span><span class=cF0> tmpm;
|
|
<a name="l93"></a>}
|
|
<a name="l94"></a>
|
|
<a name="l95"></a></span><span class=cF1>U0</span><span class=cF0> NullSpring(MySpring *tmps, </span><span class=cF1>F64</span><span class=cF0> scale)
|
|
<a name="l96"></a>{
|
|
<a name="l97"></a> </span><span class=cF1>F64</span><span class=cF0> d = </span><span class=cF5>D3Dist</span><span class=cF0>(&tmps->end1->x, &tmps->end2->x);
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> tmps->rest_len = d * scale;
|
|
<a name="l100"></a> tmps->compression_strength = tmps->base_compression_strength / (tmps->rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l101"></a> tmps->tensile_strength = tmps->base_tensile_strength / (tmps->rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l102"></a> tmps->const = tmps->base_const / (tmps->rest_len + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l103"></a> tmps->cost = tmps->base_cost * tmps->rest_len;
|
|
<a name="l104"></a>}
|
|
<a name="l105"></a>
|
|
<a name="l106"></a></span><span class=cF1>U0</span><span class=cF0> MoveMass(MyMass *tmpm, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l107"></a>{
|
|
<a name="l108"></a> MySpring *tmps;
|
|
<a name="l109"></a>
|
|
<a name="l110"></a> tmpm->x = x;
|
|
<a name="l111"></a> tmpm->y = y;
|
|
<a name="l112"></a> tmpm->DxDt = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l113"></a> tmpm->DyDt = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l114"></a> tmps = ode->next_spring;
|
|
<a name="l115"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l116"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->end1 == tmpm || tmps->end2 == tmpm)
|
|
<a name="l118"></a> {
|
|
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->flags & </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF0>)
|
|
<a name="l120"></a> NullSpring(tmps, WIRE_PERCENT);
|
|
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l122"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l123"></a> }
|
|
<a name="l124"></a> tmps = tmps->next;
|
|
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l126"></a>}
|
|
<a name="l127"></a>
|
|
<a name="l128"></a></span><span class=cF1>U0</span><span class=cF0> DelSpring(MySpring *tmps)
|
|
<a name="l129"></a>{
|
|
<a name="l130"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmps);
|
|
<a name="l131"></a> </span><span class=cF5>Free</span><span class=cF0>(tmps);
|
|
<a name="l132"></a>}
|
|
<a name="l133"></a>
|
|
<a name="l134"></a></span><span class=cF1>U0</span><span class=cF0> DelMass(MyMass *tmpm)
|
|
<a name="l135"></a>{
|
|
<a name="l136"></a> MySpring *tmps, *tmps1;
|
|
<a name="l137"></a>
|
|
<a name="l138"></a> tmps = ode->next_spring;
|
|
<a name="l139"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l140"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l141"></a> tmps1 = tmps->next;
|
|
<a name="l142"></a> </span><span class=cF1>if</span><span class=cF0> (tmps->end1 == tmpm || tmps->end2 == tmpm)
|
|
<a name="l143"></a> DelSpring(tmps);
|
|
<a name="l144"></a> tmps = tmps1;
|
|
<a name="l145"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l146"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpm);
|
|
<a name="l147"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpm);
|
|
<a name="l148"></a>}
|
|
<a name="l149"></a>
|
|
<a name="l150"></a></span><span class=cF1>U0</span><span class=cF0> DrawSpring(</span><span class=cF9>CDC</span><span class=cF0> *dc, MyMass *tmpm, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l151"></a>{
|
|
<a name="l152"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
|
|
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l154"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
|
|
<a name="l155"></a> dc->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l156"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l157"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l158"></a>
|
|
<a name="l159"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
|
|
<a name="l160"></a> dc->color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l161"></a> dc->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l162"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l163"></a>
|
|
<a name="l164"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
|
|
<a name="l165"></a> dc->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l166"></a> dc->thick = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l167"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, tmpm->x, tmpm->y, </span><span class=cFE>0</span><span class=cF0>, x, y, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l170"></a>}
|
|
<a name="l171"></a>
|
|
<a name="l172"></a></span><span class=cF1>U0</span><span class=cF0> PlaceSpring(MyMass *tmpm1, MyMass *tmpm2)
|
|
<a name="l173"></a>{
|
|
<a name="l174"></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="l175"></a>
|
|
<a name="l176"></a> tmps->end1 = tmpm1;
|
|
<a name="l177"></a> tmps->end2 = tmpm2;
|
|
<a name="l178"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
|
|
<a name="l179"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l180"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
|
|
<a name="l181"></a> tmps->base_const = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * SPRING_SCALE;
|
|
<a name="l182"></a> tmps->base_compression_strength = </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
|
|
<a name="l183"></a> tmps->base_tensile_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>35</span><span class=cF0> * STRENGTH_SCALE;
|
|
<a name="l184"></a> tmps->base_cost = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>30</span><span class=cF0> * COST_SCALE;
|
|
<a name="l185"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l186"></a> tmps->color = </span><span class=cF3>LTGRAY</span><span class=cF0>;
|
|
<a name="l187"></a> tmps->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l188"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l189"></a>
|
|
<a name="l190"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
|
|
<a name="l191"></a> tmps->base_const = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * SPRING_SCALE;
|
|
<a name="l192"></a> tmps->base_compression_strength = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
|
|
<a name="l193"></a> tmps->base_tensile_strength = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * STRENGTH_SCALE;
|
|
<a name="l194"></a> tmps->base_cost = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0> * COST_SCALE;
|
|
<a name="l195"></a> NullSpring(tmps, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l196"></a> tmps->color = </span><span class=cF3>DKGRAY</span><span class=cF0>;
|
|
<a name="l197"></a> tmps->thick = </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l198"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l199"></a>
|
|
<a name="l200"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
|
|
<a name="l201"></a> tmps->base_const = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>25</span><span class=cF0> * SPRING_SCALE;
|
|
<a name="l202"></a> tmps->base_compression_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>00</span><span class=cF0>;
|
|
<a name="l203"></a> tmps->base_tensile_strength = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>50</span><span class=cF0> * STRENGTH_SCALE;
|
|
<a name="l204"></a> tmps->base_cost = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>10</span><span class=cF0> * COST_SCALE;
|
|
<a name="l205"></a> NullSpring(tmps, WIRE_PERCENT);
|
|
<a name="l206"></a> tmps->color = </span><span class=cF3>RED</span><span class=cF0>;
|
|
<a name="l207"></a> tmps->thick = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l208"></a> tmps->flags |= </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF0>;
|
|
<a name="l209"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l211"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmps, ode->last_spring);
|
|
<a name="l212"></a>}
|
|
<a name="l213"></a>
|
|
<a name="l214"></a></span><span class=cF1>U0</span><span class=cF0> AnimateTask(SpanAnimateStruct *a)
|
|
<a name="l215"></a>{
|
|
<a name="l216"></a> MySpring *tmps, *tmps1;
|
|
<a name="l217"></a> </span><span class=cF1>Bool</span><span class=cF0> old_run = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l218"></a> </span><span class=cF1>F64</span><span class=cF0> f;
|
|
<a name="l219"></a>
|
|
<a name="l220"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l221"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l222"></a> tmps = ode->next_spring;
|
|
<a name="l223"></a> </span><span class=cF1>while</span><span class=cF0> (tmps != &ode->next_spring)
|
|
<a name="l224"></a> {
|
|
<a name="l225"></a> tmps1 = tmps->next;
|
|
<a name="l226"></a> f = tmps->f;
|
|
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> ( f > </span><span class=cFE>0</span><span class=cF0> && f > tmps->compression_strength && !</span><span class=cF7>(</span><span class=cF0>tmps->flags & </span><span class=cF3>SSF_NO_COMPRESSION</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l228"></a> f < </span><span class=cFE>0</span><span class=cF0> && -f>tmps->tensile_strength && !</span><span class=cF7>(</span><span class=cF0>tmps->flags & </span><span class=cF3>SSF_NO_TENSION</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l229"></a> tmps->flags |= </span><span class=cF3>SSF_INACTIVE</span><span class=cF0>;
|
|
<a name="l230"></a> tmps = tmps1;
|
|
<a name="l231"></a> }
|
|
<a name="l232"></a> AdjustLoads(ode);
|
|
<a name="l233"></a> </span><span class=cF5>Refresh</span><span class=cF0>; </span><span class=cF2>//CMathODE updated once per refresh.</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (old_run != run_bttn.state)
|
|
<a name="l235"></a> {
|
|
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
|
|
<a name="l237"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (!a->elapsed_t || !a->saved_ode)
|
|
<a name="l239"></a> {
|
|
<a name="l240"></a> </span><span class=cF5>Free</span><span class=cF0>(a->saved_ode);
|
|
<a name="l241"></a> a->saved_ode = SpanSave(ode);
|
|
<a name="l242"></a> }
|
|
<a name="l243"></a> a->start_wall_t = </span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l244"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode, </span><span class=cF3>OFF</span><span class=cF0>);
|
|
<a name="l245"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l247"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l248"></a> </span><span class=cF5>ODEPause</span><span class=cF0>(ode);
|
|
<a name="l249"></a> a->elapsed_t += </span><span class=cF5>tS</span><span class=cF0> - a->start_wall_t;
|
|
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l251"></a> old_run = run_bttn.state;
|
|
<a name="l252"></a> }
|
|
<a name="l253"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l254"></a>}
|
|
<a name="l255"></a>
|
|
<a name="l256"></a></span><span class=cF1>U0</span><span class=cF0> Init(SpanAnimateStruct *a)
|
|
<a name="l257"></a>{
|
|
<a name="l258"></a> SpanDel(ode);
|
|
<a name="l259"></a> ode = SpanNew;
|
|
<a name="l260"></a>
|
|
<a name="l261"></a> run_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF5>Refresh</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0>); </span><span class=cF2>//Allow stop to reg in animate task.</span><span class=cF0>
|
|
<a name="l263"></a>
|
|
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (a->saved_ode)
|
|
<a name="l265"></a> SpanLoad(ode, a->saved_ode);
|
|
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l267"></a> SpanBridge1Init(ode);
|
|
<a name="l268"></a> a->elapsed_t = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l269"></a> cursor_mass = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l270"></a>}
|
|
<a name="l271"></a>
|
|
<a name="l272"></a></span><span class=cF1>U0</span><span class=cF0> SongTask(</span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l273"></a>{</span><span class=cF2>//Song by Terry A. Davis</span><span class=cF0>
|
|
<a name="l274"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb = &</span><span class=cF5>SoundTaskEndCB</span><span class=cF0>;
|
|
<a name="l275"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
|
|
<a name="l276"></a> </span><span class=cFB>music</span><span class=cF0>.tempo = </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>636</span><span class=cF0>;
|
|
<a name="l277"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>902</span><span class=cF0>;
|
|
<a name="l278"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l279"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l280"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5q.EeDqED4G5DhE"</span><span class=cF0>);
|
|
<a name="l281"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5q.EeDqED4G5DhE"</span><span class=cF0>);
|
|
<a name="l282"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5q.FeEFEqF4G5EhF"</span><span class=cF0>);
|
|
<a name="l283"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF6>"5q.FeEFEqF4G5EhF"</span><span class=cF0>);
|
|
<a name="l284"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l285"></a>}
|
|
<a name="l286"></a>
|
|
<a name="l287"></a></span><span class=cF1>U0</span><span class=cF0> Span()
|
|
<a name="l288"></a>{
|
|
<a name="l289"></a> </span><span class=cF9>I64</span><span class=cF0> message_code, arg1, arg2;
|
|
<a name="l290"></a> MyMass *tmpm1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l291"></a> MySpring *tmps;
|
|
<a name="l292"></a> </span><span class=cF9>CCtrl</span><span class=cF0> *bt_run, *bt_mode;
|
|
<a name="l293"></a> </span><span class=cF1>U8</span><span class=cF0> *src;
|
|
<a name="l294"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
|
|
<a name="l295"></a>
|
|
<a name="l296"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l297"></a> </span><span class=cF5>Fs</span><span class=cF0>->text_attr = </span><span class=cF3>BROWN</span><span class=cF0> << </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l298"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l299"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l300"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l301"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l302"></a> </span><span class=cF5>Fs</span><span class=cF0>->song_task = </span><span class=cF5>Spawn</span><span class=cF0>(&SongTask, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>"Song"</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l303"></a>
|
|
<a name="l304"></a> bt_run =</span><span class=cF5>CtrlBttnNew</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>80</span><span class=cF0>,, </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>"Stopped\0Running\0"</span><span class=cF0>, run_colors, &run_bttn);
|
|
<a name="l305"></a> bt_mode=</span><span class=cF5>CtrlBttnNew</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=cFE>0</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>, </span><span class=cFE>80</span><span class=cF0>,, MD_MODES_NUM, </span><span class=cF5>Define</span><span class=cF7>(</span><span class=cF6>"ST_SPAN_MODES"</span><span class=cF7>)</span><span class=cF0>, mode_colors, &mode_bttn);
|
|
<a name="l306"></a> a.saved_ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l307"></a>
|
|
<a name="l308"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit |= </span><span class=cF3>WIG_DBL_CLICK</span><span class=cF0>;
|
|
<a name="l309"></a>
|
|
<a name="l310"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l311"></a> </span><span class=cF6>" New(,CH_CTRLN);"</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF6>" Open(,CH_CTRLO);"</span><span class=cF0>
|
|
<a name="l313"></a> </span><span class=cF6>" SaveAs(,CH_CTRLA);"</span><span class=cF0>
|
|
<a name="l314"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l315"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l316"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l317"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l318"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l319"></a> </span><span class=cF6>" RunStop(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l320"></a> </span><span class=cF6>" Mass(,'m');"</span><span class=cF0>
|
|
<a name="l321"></a> </span><span class=cF6>" Concrete(,'c');"</span><span class=cF0>
|
|
<a name="l322"></a> </span><span class=cF6>" Steel(,'s');"</span><span class=cF0>
|
|
<a name="l323"></a> </span><span class=cF6>" Wire(,'w');"</span><span class=cF0>
|
|
<a name="l324"></a> </span><span class=cF6>" Move(,'v');"</span><span class=cF0>
|
|
<a name="l325"></a> </span><span class=cF6>" Delete(,'d');"</span><span class=cF0>
|
|
<a name="l326"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l327"></a> );
|
|
<a name="l328"></a>
|
|
<a name="l329"></a> ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l330"></a> Init(&a);
|
|
<a name="l331"></a> </span><span class=cF5>Fs</span><span class=cF0>->animate_task = </span><span class=cF5>Spawn</span><span class=cF0>(&AnimateTask, &a, </span><span class=cF6>"Animate"</span><span class=cF0>,, </span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l332"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l333"></a>
|
|
<a name="l334"></a> </span><span class=cF5>PopUpOk</span><span class=cF0>( </span><span class=cF6>"Build a bridge to hold-up the\n"</span><span class=cF0>
|
|
<a name="l335"></a> </span><span class=cF6>"red masses. Test your design\n"</span><span class=cF0>
|
|
<a name="l336"></a> </span><span class=cF6>"by pressing run/stop.\n\n"</span><span class=cF0>
|
|
<a name="l337"></a> </span><span class=cF6>"The lowest cost bridge that\n"</span><span class=cF0>
|
|
<a name="l338"></a> </span><span class=cF6>"stays standing wins.\n\n"</span><span class=cF0>
|
|
<a name="l339"></a> </span><span class=cF6>"For a variation, try without\n"</span><span class=cF0>
|
|
<a name="l340"></a> </span><span class=cF6>"using the center base point.\n"</span><span class=cF0>
|
|
<a name="l341"></a> </span><span class=cF6>"\n"</span><span class=cF0>
|
|
<a name="l342"></a> </span><span class=cF6>"Use\n"</span><span class=cF0>
|
|
<a name="l343"></a> </span><span class=cF6>"\t$GREEN$'m'$FG$ass\n"</span><span class=cF0>
|
|
<a name="l344"></a> </span><span class=cF6>"\t$GREEN$'c'$FG$oncrete\n"</span><span class=cF0>
|
|
<a name="l345"></a> </span><span class=cF6>"\t$GREEN$'s'$FG$teel\n"</span><span class=cF0>
|
|
<a name="l346"></a> </span><span class=cF6>"\t$GREEN$'w'$FG$ire\n"</span><span class=cF0>
|
|
<a name="l347"></a> </span><span class=cF6>"\nto sel materials.\n"</span><span class=cF0>);
|
|
<a name="l348"></a>
|
|
<a name="l349"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l350"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l351"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l352"></a> {
|
|
<a name="l353"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&arg1, &arg2, </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_R_DOWN</span><span class=cF0> |
|
|
<a name="l354"></a> </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_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>);
|
|
<a name="l355"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l356"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
|
|
<a name="l357"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
|
|
<a name="l359"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l360"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
|
|
<a name="l361"></a> {
|
|
<a name="l362"></a> </span><span class=cF1>case</span><span class=cF0> MD_MASS:
|
|
<a name="l363"></a> PlaceMass(arg1, arg2);
|
|
<a name="l364"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l365"></a>
|
|
<a name="l366"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
|
|
<a name="l367"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
|
|
<a name="l368"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
|
|
<a name="l369"></a> tmpm1 = </span><span class=cF5>MassFind</span><span class=cF0>(ode, arg1, arg2);
|
|
<a name="l370"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l371"></a>
|
|
<a name="l372"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
|
|
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (run_bttn.state)
|
|
<a name="l374"></a> cursor_mass = </span><span class=cF5>MassFind</span><span class=cF0>(ode, arg1, arg2);
|
|
<a name="l375"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l376"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1 = </span><span class=cF5>MassFind</span><span class=cF7>(</span><span class=cF0>ode, arg1, arg2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l377"></a> MoveMass(tmpm1, arg1, arg2);
|
|
<a name="l378"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l379"></a>
|
|
<a name="l380"></a> </span><span class=cF1>case</span><span class=cF0> MD_DELETE:
|
|
<a name="l381"></a> </span><span class=cF5>MassOrSpringFind</span><span class=cF0>(ode, &tmpm1, &tmps, arg1, arg2);
|
|
<a name="l382"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
|
|
<a name="l383"></a> DelMass(tmpm1);
|
|
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (tmps)
|
|
<a name="l385"></a> DelSpring(tmps);
|
|
<a name="l386"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l387"></a> }
|
|
<a name="l388"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l389"></a>
|
|
<a name="l390"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
|
|
<a name="l391"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
|
|
<a name="l392"></a> {
|
|
<a name="l393"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
|
|
<a name="l394"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
|
|
<a name="l395"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
|
|
<a name="l396"></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, arg1, arg2)</span><span class=cF7>)</span><span class=cF0> && tmpm1 != tmpm2)
|
|
<a name="l397"></a> PlaceSpring(tmpm1, tmpm2);
|
|
<a name="l398"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l399"></a>
|
|
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
|
|
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (!run_bttn.state && tmpm1)
|
|
<a name="l402"></a> MoveMass(tmpm1, arg1, arg2);
|
|
<a name="l403"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l404"></a> }
|
|
<a name="l405"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l406"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l407"></a>
|
|
<a name="l408"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
|
|
<a name="l409"></a> </span><span class=cF1>switch</span><span class=cF0> (mode_bttn.state)
|
|
<a name="l410"></a> {
|
|
<a name="l411"></a> </span><span class=cF1>case</span><span class=cF0> MD_MOVE:
|
|
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (!run_bttn.state && tmpm1)
|
|
<a name="l413"></a> MoveMass(tmpm1, arg1, arg2);
|
|
<a name="l414"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l415"></a>
|
|
<a name="l416"></a> </span><span class=cF1>case</span><span class=cF0> MD_CONCRETE:
|
|
<a name="l417"></a> </span><span class=cF1>case</span><span class=cF0> MD_STEEL:
|
|
<a name="l418"></a> </span><span class=cF1>case</span><span class=cF0> MD_WIRE:
|
|
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm1)
|
|
<a name="l420"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l421"></a> DrawSpring(dc, tmpm1, arg1, arg2);
|
|
<a name="l422"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l423"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l424"></a> }
|
|
<a name="l425"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l426"></a>
|
|
<a name="l427"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
|
|
<a name="l428"></a> mode_bttn.state++;
|
|
<a name="l429"></a> </span><span class=cF1>if</span><span class=cF0> (mode_bttn.state >= MD_MODES_NUM)
|
|
<a name="l430"></a> mode_bttn.state = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l431"></a> cursor_mass = tmpm1 = tmpm2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l432"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l433"></a>
|
|
<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>'\n'</span><span class=cF0>:
|
|
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
|
|
<a name="l439"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l440"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
|
|
<a name="l441"></a> a.saved_ode = SpanSave(ode);
|
|
<a name="l442"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l443"></a> Init(&a);
|
|
<a name="l444"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l445"></a>
|
|
<a name="l446"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLN</span><span class=cF0>:
|
|
<a name="l447"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
|
|
<a name="l448"></a> a.saved_ode = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l449"></a> Init(&a);
|
|
<a name="l450"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l451"></a>
|
|
<a name="l452"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLO</span><span class=cF0>:
|
|
<a name="l453"></a> </span><span class=cF1>if</span><span class=cF0> (src = SpanRead)
|
|
<a name="l454"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l455"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
|
|
<a name="l456"></a> a.saved_ode = src;
|
|
<a name="l457"></a> Init(&a);
|
|
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l459"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l460"></a>
|
|
<a name="l461"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_CTRLA</span><span class=cF0>:
|
|
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
|
|
<a name="l463"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l464"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
|
|
<a name="l465"></a> a.saved_ode = SpanSave(ode);
|
|
<a name="l466"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l467"></a> Init(&a);
|
|
<a name="l468"></a> SpanWrite(ode);
|
|
<a name="l469"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l470"></a>
|
|
<a name="l471"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l472"></a> run_bttn.state = !run_bttn.state;
|
|
<a name="l473"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l474"></a>
|
|
<a name="l475"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
|
|
<a name="l476"></a> mode_bttn.state = MD_CONCRETE;
|
|
<a name="l477"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l478"></a>
|
|
<a name="l479"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>:
|
|
<a name="l480"></a> mode_bttn.state = MD_STEEL;
|
|
<a name="l481"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l482"></a>
|
|
<a name="l483"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>:
|
|
<a name="l484"></a> mode_bttn.state = MD_WIRE;
|
|
<a name="l485"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l486"></a>
|
|
<a name="l487"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'m'</span><span class=cF0>:
|
|
<a name="l488"></a> mode_bttn.state = MD_MASS;
|
|
<a name="l489"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l490"></a>
|
|
<a name="l491"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'v'</span><span class=cF0>:
|
|
<a name="l492"></a> mode_bttn.state = MD_MOVE;
|
|
<a name="l493"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l494"></a>
|
|
<a name="l495"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'d'</span><span class=cF0>:
|
|
<a name="l496"></a> mode_bttn.state = MD_DELETE;
|
|
<a name="l497"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l498"></a>
|
|
<a name="l499"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l500"></a> </span><span class=cF1>if</span><span class=cF0> (!SpanTime || !a.saved_ode)
|
|
<a name="l501"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l502"></a> </span><span class=cF5>Free</span><span class=cF0>(a.saved_ode);
|
|
<a name="l503"></a> a.saved_ode = SpanSave(ode);
|
|
<a name="l504"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l505"></a> Init(&a);
|
|
<a name="l506"></a> SpanWrite(ode);
|
|
<a name="l507"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l508"></a> </span><span class=cF1>goto</span><span class=cF0> span_done;
|
|
<a name="l509"></a> }
|
|
<a name="l510"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l511"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l512"></a> }
|
|
<a name="l513"></a>span_done: </span><span class=cF2>//Don't goto out of try</span><span class=cF0>
|
|
<a name="l514"></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="l515"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l516"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l517"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l518"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l519"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l520"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_run);
|
|
<a name="l521"></a> </span><span class=cF5>CtrlBttnDel</span><span class=cF0>(bt_mode);
|
|
<a name="l522"></a> SpanDel(ode);
|
|
<a name="l523"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l524"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l525"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l526"></a>}
|
|
</span></pre></body>
|
|
</html>
|