mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
353 lines
34 KiB
HTML
Executable file
353 lines
34 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.07">
|
|
<style type="text/css">
|
|
body {background-color:#1f1f1f;}
|
|
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
|
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
|
.cF2{color:#73a255;background-color:#1f1f1f;}
|
|
.cF3{color:#297582;background-color:#1f1f1f;}
|
|
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
|
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
|
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
|
.cF7{color:#444444;background-color:#1f1f1f;}
|
|
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
|
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
|
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
|
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
|
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
|
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
|
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
|
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> AttackHeader(Unit *tmpu, </span><span class=cF1>U8</span><span class=cF0> *st, Unit *target)
|
|
<a name="l2"></a>{
|
|
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>9</span><span class=cF0> + </span><span class=cF5>StrLen</span><span class=cF0>(st);
|
|
<a name="l4"></a>
|
|
<a name="l5"></a> </span><span class=cF1>if</span><span class=cF0> (target)
|
|
<a name="l6"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l7"></a> i += </span><span class=cFE>9</span><span class=cF0>;
|
|
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (target->armor)
|
|
<a name="l9"></a> i += </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l10"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l11"></a> i += </span><span class=cFE>10</span><span class=cF0>;
|
|
<a name="l12"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l13"></a> </span><span class=cF6>'\n\n'</span><span class=cF0>;
|
|
<a name="l14"></a> </span><span class=cF6>"$BLACK$%h*c$FG$\n"</span><span class=cF0>, i, </span><span class=cF6>'-'</span><span class=cF0>;
|
|
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->player)
|
|
<a name="l16"></a> </span><span class=cF6>"$PURPLE$Player 2$FG$ "</span><span class=cF0>;
|
|
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF6>"$CYAN$Player 1$FG$ "</span><span class=cF0>;
|
|
<a name="l19"></a> </span><span class=cF6>"%s"</span><span class=cF0>, st;
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (target)
|
|
<a name="l21"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (target->player)
|
|
<a name="l23"></a> </span><span class=cF6>" $PURPLE$Player 2"</span><span class=cF0>;
|
|
<a name="l24"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF6>" $CYAN$Player 1"</span><span class=cF0>;
|
|
<a name="l26"></a> </span><span class=cF1>if</span><span class=cF0> (target->armor)
|
|
<a name="l27"></a> </span><span class=cF6>" Armored"</span><span class=cF0>;
|
|
<a name="l28"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF6>" Unarmored"</span><span class=cF0>;
|
|
<a name="l30"></a> </span><span class=cF6>'$FG$'</span><span class=cF0>;
|
|
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l33"></a> </span><span class=cF6>"$BLACK$%h*c$FG$\n"</span><span class=cF0>, i, </span><span class=cF6>'-'</span><span class=cF0>;
|
|
<a name="l34"></a>}
|
|
<a name="l35"></a>
|
|
<a name="l36"></a></span><span class=cF1>F64</span><span class=cF0> HitDamage(Unit *tmpu, Unit *target, </span><span class=cF9>I64</span><span class=cF0> facing=</span><span class=cFE>1</span><span class=cF0>, </span><span class=cF1>F64</span><span class=cF0> range_factor=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l37"></a>{
|
|
<a name="l38"></a> </span><span class=cF1>F64</span><span class=cF0> d, res = </span><span class=cFE>200</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l39"></a>
|
|
<a name="l40"></a> </span><span class=cF6>"\nRoll Out of 200\t\t:%6.2f Damage\n"</span><span class=cF0>, res;
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (target->armor)
|
|
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l43"></a> d = target->armor / </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * (</span><span class=cFE>5</span><span class=cF0> - facing) / </span><span class=cFE>5</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (d >= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l45"></a> {
|
|
<a name="l46"></a> </span><span class=cF6>"Armor Attack\t\t:%6.2f\n"</span><span class=cF0>, </span><span class=cF5>ToF64</span><span class=cF0>(tmpu->armored_attack);
|
|
<a name="l47"></a> res *= (tmpu->armored_attack / </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>) / d;
|
|
<a name="l48"></a> }
|
|
<a name="l49"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l50"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l51"></a> </span><span class=cF6>"Armor(%z) Defense\t:%6.2f\n"</span><span class=cF0>, facing,
|
|
<a name="l52"></a> </span><span class=cF6>"Front\0FrontSide\0RearSide\0Rear\0"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * d;
|
|
<a name="l53"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> d = </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - range_factor;
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (d > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l58"></a> {
|
|
<a name="l59"></a> </span><span class=cF6>"Unarmored Attack\t:%6.2f\n"</span><span class=cF0>, </span><span class=cF5>ToF64</span><span class=cF0>(tmpu->unarmored_attack);
|
|
<a name="l60"></a> </span><span class=cF6>"Range Adjust\t\t:%6.2f%%\n"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * d;
|
|
<a name="l61"></a> res *= (tmpu->unarmored_attack / </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>) * d;
|
|
<a name="l62"></a> }
|
|
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l64"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cF6>"Attack/Defense Adjusted\t:%6.2f Damage\n"</span><span class=cF0>, res;
|
|
<a name="l67"></a>
|
|
<a name="l68"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Round</span><span class=cF0>(res);
|
|
<a name="l69"></a>}
|
|
<a name="l70"></a>
|
|
<a name="l71"></a></span><span class=cF1>Bool</span><span class=cF0> DamageDo(Unit *target, </span><span class=cF1>F64</span><span class=cF0> damage)
|
|
<a name="l72"></a>{
|
|
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (damage > </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l74"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (target->armor)
|
|
<a name="l76"></a> </span><span class=cF6>"Armor Hit Score %6.2f\t:"</span><span class=cF0>, damage;
|
|
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l78"></a> </span><span class=cF6>"%3d Life - %3f Damage\t="</span><span class=cF0>, target->life, damage;
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (damage >= target->life)
|
|
<a name="l80"></a> {
|
|
<a name="l81"></a> </span><span class=cF6>"$RED$Killed$FG$\n"</span><span class=cF0>;
|
|
<a name="l82"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay, </span><span class=cFE>74</span><span class=cF0>, </span><span class=cFE>98</span><span class=cF0>);
|
|
<a name="l83"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay);
|
|
<a name="l84"></a> target->life = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l85"></a> VisRecalc(VR_FRIENDLY_UNIT_DIED, target);
|
|
<a name="l86"></a> alive_count[target->player]--;
|
|
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l88"></a> }
|
|
<a name="l89"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l90"></a> {
|
|
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (target->armor)
|
|
<a name="l92"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (damage > </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>6</span><span class=cF0> * target->life)
|
|
<a name="l94"></a> {
|
|
<a name="l95"></a> target->movement = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l96"></a> </span><span class=cF6>"$RED$Immobilized$FG$\n"</span><span class=cF0>;
|
|
<a name="l97"></a> }
|
|
<a name="l98"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l99"></a> </span><span class=cF6>"$GREEN$No Penetration$FG$\n"</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l101"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l102"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l103"></a> target->life -= damage;
|
|
<a name="l104"></a> </span><span class=cF6>"$RED$%6.2f Life$FG$\n"</span><span class=cF0>, </span><span class=cF5>ToF64</span><span class=cF0>(target->life);
|
|
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l106"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l107"></a> }
|
|
<a name="l108"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l109"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l111"></a>}
|
|
<a name="l112"></a>
|
|
<a name="l113"></a></span><span class=cF1>U0</span><span class=cF0> IndirectAdd(Unit *tmpu, </span><span class=cF9>I64</span><span class=cF0> row, </span><span class=cF9>I64</span><span class=cF0> col)
|
|
<a name="l114"></a>{
|
|
<a name="l115"></a> IndirectOrders *tmpi;
|
|
<a name="l116"></a>
|
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->life <= </span><span class=cFE>0</span><span class=cF0> || tmpu->range <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l118"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l119"></a> tmpu->fired = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l120"></a> tmpi=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>IndirectOrders</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l121"></a> tmpi->attacker = tmpu;
|
|
<a name="l122"></a> tmpi->row = row;
|
|
<a name="l123"></a> tmpi->col = col;
|
|
<a name="l124"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpi, indirect_head.last);
|
|
<a name="l125"></a>}
|
|
<a name="l126"></a>
|
|
<a name="l127"></a></span><span class=cF1>Bool</span><span class=cF0> BulletPlot(</span><span class=cF1>U0</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0>)
|
|
<a name="l128"></a>{
|
|
<a name="l129"></a> fire_x = x;
|
|
<a name="l130"></a> fire_y = y;
|
|
<a name="l131"></a> firing = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l132"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>3</span><span class=cF0> * animation_delay);
|
|
<a name="l133"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l134"></a>}
|
|
<a name="l135"></a>
|
|
<a name="l136"></a></span><span class=cF1>U0</span><span class=cF0> UnitDirectFire(Unit *tmpu, Unit *target)
|
|
<a name="l137"></a>{
|
|
<a name="l138"></a> </span><span class=cF9>I64</span><span class=cF0> r, c, facing, t1 = terrain[tmpu->row][tmpu->col], t2 = terrain[target->row][target->col];
|
|
<a name="l139"></a> </span><span class=cF1>F64</span><span class=cF0> x1, y1, x2, y2, d, a, range_factor;
|
|
<a name="l140"></a>
|
|
<a name="l141"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->life <= </span><span class=cFE>0</span><span class=cF0> || target->life <= </span><span class=cFE>0</span><span class=cF0> || tmpu->range <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l142"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l143"></a> AttackHeader(tmpu, </span><span class=cF6>"DirectFire"</span><span class=cF0>, target);
|
|
<a name="l144"></a> RowCol2XY(&x1, &y1, tmpu->row, tmpu->col);
|
|
<a name="l145"></a> RowCol2XY(&x2, &y2, target->row, target->col);
|
|
<a name="l146"></a> d = </span><span class=cFE>100</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l147"></a> </span><span class=cF6>"+%5.2f Roll\n"</span><span class=cF0>, d;
|
|
<a name="l148"></a> d += tmpu->accuracy;
|
|
<a name="l149"></a> </span><span class=cF6>"+%2d.00 Accuracy\n"</span><span class=cF0>, tmpu->accuracy;
|
|
<a name="l150"></a>
|
|
<a name="l151"></a> range_factor = </span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>x2 - x1</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>y2 - y1</span><span class=cF7>)</span><span class=cF0>) / (tmpu->range * </span><span class=cFE>2</span><span class=cF0> * DSIN);
|
|
<a name="l152"></a> </span><span class=cF6>"-%5.2f%% of Range\n"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * range_factor;
|
|
<a name="l153"></a> d -= </span><span class=cFE>100</span><span class=cF0> * range_factor;
|
|
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (t2 == TREES)
|
|
<a name="l155"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF6>"-30.00 Target in Trees Penalty\n"</span><span class=cF0>;
|
|
<a name="l157"></a> d -= </span><span class=cFE>30</span><span class=cF0>;
|
|
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (t1 == MOUNTAINS && t2 != MOUNTAINS)
|
|
<a name="l160"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF6>"+30.00 High Ground Bonus\n"</span><span class=cF0>;
|
|
<a name="l162"></a> d += </span><span class=cFE>30</span><span class=cF0>;
|
|
<a name="l163"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF6>"_______\n"</span><span class=cF0>;
|
|
<a name="l165"></a> target_unit=target;
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (d >= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l167"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l168"></a> </span><span class=cF6>"+%5.2f Hit\n"</span><span class=cF0>, d;
|
|
<a name="l169"></a> target_hit = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay, </span><span class=cFE>34</span><span class=cF0>, </span><span class=cFE>41</span><span class=cF0>);
|
|
<a name="l171"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay);
|
|
<a name="l172"></a> </span><span class=cF5>Line</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, x1, y1, </span><span class=cFE>0</span><span class=cF0>, x2, y2, </span><span class=cFE>0</span><span class=cF0>, &BulletPlot);
|
|
<a name="l173"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l174"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l175"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l176"></a> </span><span class=cF6>"-%5.2f Miss\n"</span><span class=cF0>, -d;
|
|
<a name="l177"></a> target_hit = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l178"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay, </span><span class=cFE>69</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l179"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay);
|
|
<a name="l180"></a> a = </span><span class=cF3>pi</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l181"></a> d = (</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0> - d / </span><span class=cFE>100</span><span class=cF0>) * HEX_SIDE;
|
|
<a name="l182"></a> </span><span class=cF5>Line</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, x1, y1, </span><span class=cFE>0</span><span class=cF0>, x2 + d * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>a</span><span class=cF7>)</span><span class=cF0>, y2 + d * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>a</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, &BulletPlot);
|
|
<a name="l183"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l184"></a> firing = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l185"></a> tmpu->fired = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (target_hit)
|
|
<a name="l187"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l188"></a> r = target->row;
|
|
<a name="l189"></a> c = target->col;
|
|
<a name="l190"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>facing = HexMoveOne(&r, &c, x1, y1)</span><span class=cF7>)</span><span class=cF0> >= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l191"></a> facing = FacingChange(facing, target->facing);
|
|
<a name="l192"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l193"></a> facing = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l194"></a> DamageDo(target, HitDamage</span><span class=cF7>(</span><span class=cF0>tmpu, target, facing, range_factor</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l195"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l196"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>screencast</span><span class=cF0>.ona) </span><span class=cF2>//see </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.ZC.html#l129"><span class=cF4>Sound</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l197"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l198"></a> target_unit = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l199"></a>}
|
|
<a name="l200"></a>
|
|
<a name="l201"></a></span><span class=cF1>Bool</span><span class=cF0> HexOccupy(</span><span class=cF1>Bool</span><span class=cF0> overrun, Unit *tmpu, Unit *target)
|
|
<a name="l202"></a>{
|
|
<a name="l203"></a> </span><span class=cF9>I64</span><span class=cF0> t2 = terrain[target->row][target->col];
|
|
<a name="l204"></a> </span><span class=cF1>F64</span><span class=cF0> damage;
|
|
<a name="l205"></a>
|
|
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (tmpu->life <= </span><span class=cFE>0</span><span class=cF0> || target->life <= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l207"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (overrun)
|
|
<a name="l209"></a> AttackHeader(tmpu, </span><span class=cF6>"OverRun"</span><span class=cF0>, target);
|
|
<a name="l210"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l211"></a> AttackHeader(tmpu, </span><span class=cF6>"CloseAssault"</span><span class=cF0>, target);
|
|
<a name="l212"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay, </span><span class=cFE>34</span><span class=cF0>, </span><span class=cFE>41</span><span class=cF0>);
|
|
<a name="l213"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay);
|
|
<a name="l214"></a> tmpu->fired = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l215"></a> target->fired = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l216"></a> damage=HitDamage(tmpu, target);
|
|
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (overrun)
|
|
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l219"></a> damage *= </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l220"></a> </span><span class=cF6>"x2 OverRun Bonus\t=%6.2f Damage\n"</span><span class=cF0>, damage;
|
|
<a name="l221"></a> </span><span class=cF1>if</span><span class=cF0> (t2 != PLAINS)
|
|
<a name="l222"></a> {
|
|
<a name="l223"></a> damage /= </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF6>"/2 Terrain Penalty\t=%6.2f Damage\n"</span><span class=cF0>, damage;
|
|
<a name="l225"></a> }
|
|
<a name="l226"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l227"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l228"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l229"></a> damage *= </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l230"></a> </span><span class=cF6>"x3 CloseAssault Bonus\t=%6.2f Damage\n"</span><span class=cF0>, damage;
|
|
<a name="l231"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (DamageDo</span><span class=cF7>(</span><span class=cF0>target, </span><span class=cF5>Round</span><span class=cF0>(damage)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l233"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l234"></a> </span><span class=cF6>"$RED$Success$FG$\n"</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>screencast</span><span class=cF0>.ona) </span><span class=cF2>//see </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.ZC.html#l129"><span class=cF4>Sound</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l236"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l237"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l238"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l240"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l241"></a> tmpu->life = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l242"></a> VisRecalc(VR_FRIENDLY_UNIT_DIED, tmpu);
|
|
<a name="l243"></a> alive_count[tmpu->player]--;
|
|
<a name="l244"></a> </span><span class=cF6>"$RED$Failure$FG$\n"</span><span class=cF0>;
|
|
<a name="l245"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>screencast</span><span class=cF0>.ona) </span><span class=cF2>//see </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.ZC.html#l129"><span class=cF4>Sound</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l247"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l248"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l249"></a>}
|
|
<a name="l250"></a>
|
|
<a name="l251"></a></span><span class=cF1>U0</span><span class=cF0> IndirectResolveAll()
|
|
<a name="l252"></a>{
|
|
<a name="l253"></a> </span><span class=cF9>I64</span><span class=cF0> i, r, c;
|
|
<a name="l254"></a> </span><span class=cF1>F64</span><span class=cF0> x1, y1, x2, y2, d, range_factor;
|
|
<a name="l255"></a> Unit *tmpu, *target;
|
|
<a name="l256"></a> IndirectOrders *tmpi = indirect_head.next, *tmpi1;
|
|
<a name="l257"></a>
|
|
<a name="l258"></a> </span><span class=cF1>while</span><span class=cF0> (tmpi != *indirect_head)
|
|
<a name="l259"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l260"></a> tmpi1 = tmpi->next;
|
|
<a name="l261"></a> tmpu = tmpi->attacker;
|
|
<a name="l262"></a> AttackHeader(tmpu, </span><span class=cF6>"IndirectFire"</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>);
|
|
<a name="l263"></a> RowCol2XY(&x1, &y1, tmpu->row, tmpu->col);
|
|
<a name="l264"></a> RowCol2XY(&x2, &y2, tmpi->row, tmpi->col);
|
|
<a name="l265"></a> d = </span><span class=cFE>100</span><span class=cF0> * </span><span class=cF5>Rand</span><span class=cF0>;
|
|
<a name="l266"></a> </span><span class=cF6>"+%5.2f Roll\n"</span><span class=cF0>, d;
|
|
<a name="l267"></a> d += tmpu->accuracy;
|
|
<a name="l268"></a> </span><span class=cF6>"+%2d.00 Accuracy\n"</span><span class=cF0>, tmpu->accuracy;
|
|
<a name="l269"></a> range_factor = </span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>x2 - x1</span><span class=cF7>)</span><span class=cF0> + </span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>y2 - y1</span><span class=cF7>)</span><span class=cF0>) / (tmpu->range * </span><span class=cFE>2</span><span class=cF0> * DSIN);
|
|
<a name="l270"></a> </span><span class=cF6>"-%5.2f%% of Range\n"</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0> * range_factor;
|
|
<a name="l271"></a> d -= </span><span class=cFE>100</span><span class=cF0> * range_factor;
|
|
<a name="l272"></a> </span><span class=cF6>'_______\n'</span><span class=cF0>;
|
|
<a name="l273"></a>
|
|
<a name="l274"></a>
|
|
<a name="l275"></a> </span><span class=cF1>if</span><span class=cF0> (d >= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l276"></a> {
|
|
<a name="l277"></a> </span><span class=cF6>"+%5.2f Hit\n"</span><span class=cF0>, d;
|
|
<a name="l278"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay, </span><span class=cFE>34</span><span class=cF0>, </span><span class=cFE>41</span><span class=cF0>);
|
|
<a name="l279"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>500</span><span class=cF0> * animation_delay);
|
|
<a name="l280"></a> }
|
|
<a name="l281"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l282"></a> {
|
|
<a name="l283"></a> </span><span class=cF6>"-%5.2f Miss\n"</span><span class=cF0>, -d;
|
|
<a name="l284"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay, </span><span class=cFE>69</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l285"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1000</span><span class=cF0> * animation_delay);
|
|
<a name="l286"></a> i = </span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cFE>6</span><span class=cF0>;
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->row & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l288"></a> tmpi->col += col_offsets_odd[i];
|
|
<a name="l289"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l290"></a> tmpi->col += col_offsets_even[i];
|
|
<a name="l291"></a> tmpi->row += row_offsets[i];
|
|
<a name="l292"></a> RowCol2XY(&x2, &y2, tmpi->row, tmpi->col);
|
|
<a name="l293"></a> }
|
|
<a name="l294"></a>
|
|
<a name="l295"></a> </span><span class=cF5>Line</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, x1, y1, </span><span class=cFE>0</span><span class=cF0>, x2, y2, </span><span class=cFE>0</span><span class=cF0>, &BulletPlot);
|
|
<a name="l296"></a> firing = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l297"></a> tmpu->fired = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l298"></a> indirect_row = tmpi->row;
|
|
<a name="l299"></a> indirect_col = tmpi->col;
|
|
<a name="l300"></a> indirect_explosion = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l301"></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>7</span><span class=cF0>; i++)
|
|
<a name="l302"></a> {
|
|
<a name="l303"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->row & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l304"></a> c = tmpi->col + col_offsets_odd[i];
|
|
<a name="l305"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l306"></a> c = tmpi->col + col_offsets_even[i];
|
|
<a name="l307"></a> r = tmpi->row + row_offsets[i];
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> <= r < map_rows && </span><span class=cFE>0</span><span class=cF0> <= c < map_cols && </span><span class=cF7>(</span><span class=cF0>target = UnitFind(r, c)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l309"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l310"></a> AttackHeader(tmpu, </span><span class=cF6>"IndirectFire"</span><span class=cF0>, target);
|
|
<a name="l311"></a> DamageDo(target, HitDamage</span><span class=cF7>(</span><span class=cF0>tmpu, target</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l312"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l313"></a> }
|
|
<a name="l314"></a> </span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cFE>2000</span><span class=cF0> * animation_delay, </span><span class=cFE>70</span><span class=cF0>, </span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l315"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>2000</span><span class=cF0> * animation_delay);
|
|
<a name="l316"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>screencast</span><span class=cF0>.ona) </span><span class=cF2>//see </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.ZC.html#l129"><span class=cF4>Sound</span></a><span class=cF2>()</span><span class=cF0>
|
|
<a name="l317"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
|
<a name="l318"></a> indirect_explosion = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l319"></a>
|
|
<a name="l320"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpi);
|
|
<a name="l321"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpi);
|
|
<a name="l322"></a> tmpi = tmpi1;
|
|
<a name="l323"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l324"></a>}
|
|
</span></pre></body>
|
|
</html>
|