mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
139 lines
14 KiB
HTML
Executable file
139 lines
14 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=cF0>#</span><span class=cF1>define</span><span class=cF0> MAP_WIDTH </span><span class=cFE>640</span><span class=cF0> </span><span class=cF2>//Change this, if you like.</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> UNITS_NUM </span><span class=cFE>32</span><span class=cF0> </span><span class=cF2>//Change this, if you like.</span><span class=cF0>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> HEX_SIDE </span><span class=cFE>11</span><span class=cF0>
|
|
<a name="l4"></a>
|
|
<a name="l5"></a></span><span class=cF1>U0</span><span class=cF0> InitDefines()
|
|
<a name="l6"></a>{
|
|
<a name="l7"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"MAP_HEIGHT"</span><span class=cF0>, </span><span class=cF6>"%d"</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0> * MAP_WIDTH / </span><span class=cF3>GR_WIDTH</span><span class=cF0>);
|
|
<a name="l8"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"DCOS"</span><span class=cF0>, </span><span class=cF6>"%12.9f"</span><span class=cF0>, HEX_SIDE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cFE>60</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l9"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"DSIN"</span><span class=cF0>, </span><span class=cF6>"%12.9f"</span><span class=cF0>, HEX_SIDE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cFE>60</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l10"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"HEX_RADIUS"</span><span class=cF0>, </span><span class=cF6>"%12.9f"</span><span class=cF0>, HEX_SIDE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cFE>60</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / </span><span class=cFE>180</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>01</span><span class=cF0>); </span><span class=cF2>//Slop</span><span class=cF0>
|
|
<a name="l11"></a>} InitDefines;
|
|
<a name="l12"></a>
|
|
<a name="l13"></a></span><span class=cF9>I64</span><span class=cF0> map_cols = (MAP_WIDTH - DCOS)/(</span><span class=cFE>2</span><span class=cF0> * HEX_SIDE + </span><span class=cFE>2</span><span class=cF0> * DCOS),
|
|
<a name="l14"></a> map_rows = </span><span class=cF5>ToI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>MAP_HEIGHT - DSIN</span><span class=cF7>)</span><span class=cF0> / DSIN) & ~</span><span class=cFE>1</span><span class=cF0>,
|
|
<a name="l15"></a> map_width = map_cols * (</span><span class=cFE>2</span><span class=cF0> * HEX_SIDE + </span><span class=cFE>2</span><span class=cF0> * DCOS) + DCOS,
|
|
<a name="l16"></a> map_height = map_rows * DSIN + DSIN + </span><span class=cFE>1</span><span class=cF0>,
|
|
<a name="l17"></a> x0, y0;
|
|
<a name="l18"></a>
|
|
<a name="l19"></a></span><span class=cF9>CDC</span><span class=cF0> *map_dc;
|
|
<a name="l20"></a></span><span class=cF1>U8</span><span class=cF0> terrain[map_rows][map_cols];
|
|
<a name="l21"></a>
|
|
<a name="l22"></a></span><span class=cF2>//Centers of hexes</span><span class=cF0>
|
|
<a name="l23"></a></span><span class=cF1>class</span><span class=cF0> Pt
|
|
<a name="l24"></a>{
|
|
<a name="l25"></a> </span><span class=cF1>F64</span><span class=cF0> x, y;
|
|
<a name="l26"></a>};
|
|
<a name="l27"></a>Pt hex_centers[map_rows][map_cols];
|
|
<a name="l28"></a>
|
|
<a name="l29"></a></span><span class=cF9>I64</span><span class=cF0> show_vis_row, show_vis_col;
|
|
<a name="l30"></a></span><span class=cF1>Bool</span><span class=cF0> roads[map_rows][map_cols],
|
|
<a name="l31"></a> rivers[map_rows][map_cols],
|
|
<a name="l32"></a> vis_map[map_rows][map_cols];
|
|
<a name="l33"></a>
|
|
<a name="l34"></a></span><span class=cF2>//Other options for PLAINS are WHITE or YELLOW</span><span class=cF0>
|
|
<a name="l35"></a>#</span><span class=cF1>define</span><span class=cF0> PLAINS </span><span class=cF3>LTGREEN</span><span class=cF0>
|
|
<a name="l36"></a>#</span><span class=cF1>define</span><span class=cF0> TREES </span><span class=cF3>GREEN</span><span class=cF0>
|
|
<a name="l37"></a>#</span><span class=cF1>define</span><span class=cF0> MOUNTAINS </span><span class=cF3>DKGRAY</span><span class=cF0>
|
|
<a name="l38"></a>
|
|
<a name="l39"></a></span><span class=cF2>//These are used to display a range circle when they player</span><span class=cF0>
|
|
<a name="l40"></a></span><span class=cF2>//is firing.</span><span class=cF0>
|
|
<a name="l41"></a></span><span class=cF1>F64</span><span class=cF0> fire_radius, fire_radius_x, fire_radius_y;
|
|
<a name="l42"></a>
|
|
<a name="l43"></a></span><span class=cF2>//These display "phase", "turn" and "game over".</span><span class=cF0>
|
|
<a name="l44"></a></span><span class=cF1>U8</span><span class=cF0> message_buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
|
|
<a name="l45"></a></span><span class=cF9>I64</span><span class=cF0> message_off_timeout; </span><span class=cF2>//Jiffies. Goes away after a time.</span><span class=cF0>
|
|
<a name="l46"></a>
|
|
<a name="l47"></a></span><span class=cF2>//Unit types</span><span class=cF0>
|
|
<a name="l48"></a>#</span><span class=cF1>define</span><span class=cF0> UT_INFANTRY </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l49"></a>#</span><span class=cF1>define</span><span class=cF0> UT_ARTILLERY </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l50"></a>#</span><span class=cF1>define</span><span class=cF0> UT_LT_TANK </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l51"></a>#</span><span class=cF1>define</span><span class=cF0> UT_MD_TANK </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l52"></a>
|
|
<a name="l53"></a></span><span class=cF1>class</span><span class=cF0> Unit
|
|
<a name="l54"></a>{
|
|
<a name="l55"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
|
|
<a name="l56"></a> </span><span class=cF9>I64</span><span class=cF0> num, row, col,
|
|
<a name="l57"></a> armored_attack, unarmored_attack, armor;
|
|
<a name="l58"></a> </span><span class=cF1>I8</span><span class=cF0> type, player, facing, movement, life,
|
|
<a name="l59"></a> range, remaining_movement, accuracy;
|
|
<a name="l60"></a> </span><span class=cF1>Bool</span><span class=cF0> vis[</span><span class=cFE>2</span><span class=cF0>], fired, infantry, indirect_fire, pad[</span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l61"></a>};
|
|
<a name="l62"></a>
|
|
<a name="l63"></a>Unit units[</span><span class=cFE>2</span><span class=cF0>][UNITS_NUM];
|
|
<a name="l64"></a>
|
|
<a name="l65"></a></span><span class=cF2>// Bt(vis_unit_bitmap,player1+player0*((UNITS_NUM+7)&~7))</span><span class=cF0>
|
|
<a name="l66"></a></span><span class=cF1>U8</span><span class=cF0> vis_unit_bitmap[</span><span class=cFE>2</span><span class=cF0>][(</span><span class=cF7>(</span><span class=cF0>(UNITS_NUM + </span><span class=cFE>7</span><span class=cF0>) & ~</span><span class=cFE>7</span><span class=cF7>)</span><span class=cF0>*UNITS_NUM) >> </span><span class=cFE>3</span><span class=cF0>];
|
|
<a name="l67"></a>
|
|
<a name="l68"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_START </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l69"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_INDIRECT </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l70"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_INDIRECT0 </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l71"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_INDIRECT1 </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l72"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_MOVE </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l73"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_MOVE0 </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l74"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_MOVE1 </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l75"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_DIRECT </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l76"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_DIRECT0 </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l77"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_DIRECT1 </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l78"></a>#</span><span class=cF1>define</span><span class=cF0> PHASE_END </span><span class=cFE>6</span><span class=cF0>
|
|
<a name="l79"></a>
|
|
<a name="l80"></a></span><span class=cF9>I64</span><span class=cF0> phase, cur_player, enemy_player, view_player, turn,
|
|
<a name="l81"></a> cursor_row, cursor_col, alive_count[</span><span class=cFE>2</span><span class=cF0>],
|
|
<a name="l82"></a> player_indirect[</span><span class=cFE>2</span><span class=cF0>], player_move[</span><span class=cFE>2</span><span class=cF0>], player_direct[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l83"></a></span><span class=cF1>F64</span><span class=cF0> animation_delay = </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l84"></a>
|
|
<a name="l85"></a></span><span class=cF1>Bool</span><span class=cF0> moving = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l86"></a></span><span class=cF9>I64</span><span class=cF0> move_x, move_y;
|
|
<a name="l87"></a></span><span class=cF1>F64</span><span class=cF0> move_facing;
|
|
<a name="l88"></a>Unit *moving_unit;
|
|
<a name="l89"></a>
|
|
<a name="l90"></a></span><span class=cF1>extern</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> HexMoveOne(</span><span class=cF9>I64</span><span class=cF0> *_row, </span><span class=cF9>I64</span><span class=cF0> *_col, </span><span class=cF1>F64</span><span class=cF0> x, </span><span class=cF1>F64</span><span class=cF0> y);
|
|
<a name="l91"></a>
|
|
<a name="l92"></a></span><span class=cF1>class</span><span class=cF0> IndirectOrders
|
|
<a name="l93"></a>{
|
|
<a name="l94"></a> IndirectOrders *next, *last;
|
|
<a name="l95"></a> Unit *attacker;
|
|
<a name="l96"></a> </span><span class=cF9>I64</span><span class=cF0> row, col;
|
|
<a name="l97"></a>
|
|
<a name="l98"></a>} indirect_head;
|
|
<a name="l99"></a>
|
|
<a name="l100"></a></span><span class=cF1>Bool</span><span class=cF0> firing = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l101"></a></span><span class=cF9>I64</span><span class=cF0> fire_x, fire_y;
|
|
<a name="l102"></a>Unit *target_unit;
|
|
<a name="l103"></a></span><span class=cF1>Bool</span><span class=cF0> target_hit;
|
|
<a name="l104"></a>
|
|
<a name="l105"></a></span><span class=cF1>Bool</span><span class=cF0> indirect_explosion = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l106"></a></span><span class=cF9>I64</span><span class=cF0> indirect_row, indirect_col;
|
|
<a name="l107"></a>
|
|
<a name="l108"></a></span><span class=cF9>I64</span><span class=cF0> row_offsets[</span><span class=cFE>7</span><span class=cF0>] = {-</span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>2</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=cFE>2</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>};
|
|
<a name="l109"></a></span><span class=cF9>I64</span><span class=cF0> col_offsets_even[</span><span class=cFE>7</span><span class=cF0>] = {-</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, -</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>};
|
|
<a name="l110"></a></span><span class=cF9>I64</span><span class=cF0> col_offsets_odd [</span><span class=cFE>7</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>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>};
|
|
</span></pre></body>
|
|
</html>
|