68 static Bitmap hud_left_air;
69 static Bitmap hud_right_air;
70 static Bitmap hud_left_fighter;
71 static Bitmap hud_right_fighter;
72 static Bitmap hud_left_starship;
73 static Bitmap hud_right_starship;
86 static Bitmap pitch_ladder_pos;
87 static Bitmap pitch_ladder_neg;
91 static Bitmap chase_bottom;
95 static BYTE* hud_left_shade_air = 0;
96 static BYTE* hud_right_shade_air = 0;
97 static BYTE* hud_left_shade_fighter = 0;
98 static BYTE* hud_right_shade_fighter = 0;
99 static BYTE* hud_left_shade_starship = 0;
100 static BYTE* hud_right_shade_starship = 0;
101 static BYTE* instr_left_shade = 0;
102 static BYTE* instr_right_shade = 0;
103 static BYTE* warn_left_shade = 0;
104 static BYTE* warn_right_shade = 0;
105 static BYTE* lead_shade = 0;
106 static BYTE* cross_shade = 0;
107 static BYTE* cross1_shade = 0;
108 static BYTE* cross2_shade = 0;
109 static BYTE* cross3_shade = 0;
110 static BYTE* cross4_shade = 0;
111 static BYTE* fpm_shade = 0;
112 static BYTE* hpm_shade = 0;
113 static BYTE* pitch_ladder_pos_shade = 0;
114 static BYTE* pitch_ladder_neg_shade = 0;
115 static BYTE* chase_left_shade = 0;
116 static BYTE* chase_right_shade = 0;
117 static BYTE* chase_top_shade = 0;
118 static BYTE* chase_bottom_shade = 0;
119 static BYTE* icon_ship_shade = 0;
120 static BYTE* icon_target_shade = 0;
122 static Sprite* hud_left_sprite = 0;
123 static Sprite* hud_right_sprite = 0;
124 static Sprite* fpm_sprite = 0;
125 static Sprite* hpm_sprite = 0;
126 static Sprite* lead_sprite = 0;
127 static Sprite* aim_sprite = 0;
128 static Sprite* tgt1_sprite = 0;
129 static Sprite* tgt2_sprite = 0;
130 static Sprite* tgt3_sprite = 0;
131 static Sprite* tgt4_sprite = 0;
132 static Sprite* chase_sprite = 0;
133 static Sprite* instr_left_sprite = 0;
134 static Sprite* instr_right_sprite = 0;
135 static Sprite* warn_left_sprite = 0;
136 static Sprite* warn_right_sprite = 0;
137 static Sprite* icon_ship_sprite = 0;
138 static Sprite* icon_target_sprite = 0;
140 static Sound* missile_lock_sound;
168 static Font* hud_font = 0;
169 static Font* big_font = 0;
171 static bool mouse_in =
false;
172 static int mouse_latch = 0;
173 static int mouse_index = -1;
256 if (n > 250) n = 250;
259 for (i = 0; i < n; i++) {
260 if (upcase && islower(txt[i]))
261 txt_buf[i] = toupper(txt[i]);
269 ht.
font->
DrawText(txt_buf, n, rect, DT_LEFT | DT_SINGLELINE | DT_CALCRECT);
271 if ((align & DT_CENTER) != 0) {
273 rect.
x = cx - rect.
w/2;
292 ht.
font != big_font) {
298 int w2 = s->
Width() / 2;
302 txt_rect.
x -= (cx-w2);
303 txt_rect.
y -= (cy-h2);
306 txt_rect =
Rect(0, 500, 128, 12);
309 txt_rect =
Rect(128, 500, 128, 12);
317 ht.
font->
DrawText(txt_buf, n, rect, align | DT_SINGLELINE);
335 hud_text[index].
hidden =
true;
349 :
View(c), projector(0), camview(0),
350 sim(0), ship(0), target(0), mode(HUD_MODE_TAC),
351 tactical(0), overlay(0), cockpit_hud_texture(0),
352 threat(0), active_region(0), transition(false), docking(false),
353 az_ring(0), az_pointer(0), el_ring(0), el_pointer(0), compass_scale(1),
354 show_warn(false), show_inst(false), inst_page(0)
370 PrepareBitmap(
"HUDleftA.pcx", hud_left_air, hud_left_shade_air);
371 PrepareBitmap(
"HUDrightA.pcx", hud_right_air, hud_right_shade_air);
372 PrepareBitmap(
"HUDleft.pcx", hud_left_fighter, hud_left_shade_fighter);
373 PrepareBitmap(
"HUDright.pcx", hud_right_fighter, hud_right_shade_fighter);
374 PrepareBitmap(
"HUDleft1.pcx", hud_left_starship, hud_left_shade_starship);
375 PrepareBitmap(
"HUDright1.pcx", hud_right_starship, hud_right_shade_starship);
376 PrepareBitmap(
"INSTR_left.pcx", instr_left, instr_left_shade);
377 PrepareBitmap(
"INSTR_right.pcx", instr_right, instr_right_shade);
378 PrepareBitmap(
"CAUTION_left.pcx", warn_left, warn_left_shade);
379 PrepareBitmap(
"CAUTION_right.pcx", warn_right, warn_right_shade);
381 PrepareBitmap(
"hud_icon.pcx", icon_target, icon_target_shade);
392 PrepareBitmap(
"chase_r.pcx", chase_right, chase_right_shade);
394 PrepareBitmap(
"chase_b.pcx", chase_bottom, chase_bottom_shade);
396 pitch_ladder_pos_shade);
398 pitch_ladder_neg_shade);
427 hud_left_sprite =
new(__FILE__,__LINE__)
Sprite(&hud_left_fighter);
428 hud_right_sprite =
new(__FILE__,__LINE__)
Sprite(&hud_right_fighter);
429 instr_left_sprite =
new(__FILE__,__LINE__)
Sprite(&instr_left);
430 instr_right_sprite =
new(__FILE__,__LINE__)
Sprite(&instr_right);
431 warn_left_sprite =
new(__FILE__,__LINE__)
Sprite(&warn_left);
432 warn_right_sprite =
new(__FILE__,__LINE__)
Sprite(&warn_right);
433 icon_ship_sprite =
new(__FILE__,__LINE__)
Sprite(&icon_ship);
434 icon_target_sprite =
new(__FILE__,__LINE__)
Sprite(&icon_target);
435 fpm_sprite =
new(__FILE__,__LINE__)
Sprite(&fpm);
436 hpm_sprite =
new(__FILE__,__LINE__)
Sprite(&hpm);
437 lead_sprite =
new(__FILE__,__LINE__)
Sprite(&lead);
438 aim_sprite =
new(__FILE__,__LINE__)
Sprite(&cross);
439 tgt1_sprite =
new(__FILE__,__LINE__)
Sprite(&cross1);
440 tgt2_sprite =
new(__FILE__,__LINE__)
Sprite(&cross2);
441 tgt3_sprite =
new(__FILE__,__LINE__)
Sprite(&cross3);
442 tgt4_sprite =
new(__FILE__,__LINE__)
Sprite(&cross4);
443 chase_sprite =
new(__FILE__,__LINE__)
Sprite(&chase_left);
465 double pitch_ladder_UV[8] = { 0.125,0.0625, 0.875,0.0625, 0.875,0, 0.125,0 };
468 for (i = 0; i < 15; i++) {
471 CopyMemory(UV, pitch_ladder_UV,
sizeof(UV));
472 UV[1] = UV[3] = (pitch_ladder_UV[1] * (i ));
473 UV[5] = UV[7] = (pitch_ladder_UV[1] * (i+1));
487 UV[1] = UV[3] = (pitch_ladder_UV[1] * (i+1));
488 UV[5] = UV[7] = (pitch_ladder_UV[1] * (i ));
496 for (i = 16; i < 31; i++) {
499 CopyMemory(UV, pitch_ladder_UV,
sizeof(UV));
500 UV[1] = UV[3] = (pitch_ladder_UV[1] * (30 - i ));
501 UV[5] = UV[7] = (pitch_ladder_UV[1] * (30 - i+1));
509 for (i = 0; i < 3; i++)
579 chase_sprite->
Hide();
592 hud_text[i].
font = hud_font;
628 if (missile_lock_sound) {
629 missile_lock_sound->
Stop();
631 missile_lock_sound = 0;
634 for (
int i = 0; i < 3; i++) {
639 for (
int i = 0; i < 32; i++) {
672 delete [] lead_shade;
673 delete [] cross_shade;
674 delete [] cross1_shade;
675 delete [] cross2_shade;
676 delete [] cross3_shade;
677 delete [] cross4_shade;
678 delete [] hud_left_shade_air;
679 delete [] hud_right_shade_air;
680 delete [] hud_left_shade_fighter;
681 delete [] hud_right_shade_fighter;
682 delete [] hud_left_shade_starship;
683 delete [] hud_right_shade_starship;
684 delete [] instr_left_shade;
685 delete [] instr_right_shade;
686 delete [] warn_left_shade;
687 delete [] warn_right_shade;
688 delete [] icon_ship_shade;
689 delete [] icon_target_shade;
690 delete [] chase_left_shade;
691 delete [] chase_right_shade;
692 delete [] chase_top_shade;
693 delete [] chase_bottom_shade;
694 delete [] pitch_ladder_pos_shade;
695 delete [] pitch_ladder_neg_shade;
709 hud_left_shade_air = 0;
710 hud_right_shade_air = 0;
711 hud_left_shade_fighter = 0;
712 hud_right_shade_fighter = 0;
713 hud_left_shade_starship = 0;
714 hud_right_shade_starship = 0;
715 instr_left_shade = 0;
716 instr_right_shade = 0;
718 warn_right_shade = 0;
720 icon_target_shade = 0;
721 chase_left_shade = 0;
722 chase_right_shade = 0;
724 chase_bottom_shade = 0;
725 pitch_ladder_pos_shade = 0;
726 pitch_ladder_neg_shade = 0;
758 for (
int i = 0; i <
TXT_LAST; i++) {
759 hud_text[i].
font = hud_font;
760 hud_text[i].
color = standard_txt_colors[
color];
784 hud_left_sprite->
Hide();
785 hud_right_sprite->
Hide();
787 for (
int i = 0; i < 31; i++)
791 hud_left_sprite->
Show();
792 hud_right_sprite->
Show();
816 for (
int i = 0; i < 3; i++)
822 PrepareBitmap(
"hud_icon.pcx", icon_target, icon_target_shade);
843 for (
int i = 0; i < 3; i++)
861 int c_iff = contact->
GetIFF(ship);
919 for (
int i = 0; i < ctl-1; i++) {
936 int x = (int) mark_pt.
x;
937 int y = (
int) mark_pt.
y;
939 if (x > 4 && x <
width-4 &&
945 Rect self_rect(x+8, y-4, 200, 12);
951 Rect net_name_rect(x+8, y+6, 120, 12);
973 if (mark_pt.
z > 1.0) {
976 int x = (int) mark_pt.
x;
982 if (x > 4 && x <
width-4 &&
985 const int BAR_LENGTH = 40;
988 int sx = x - BAR_LENGTH/2;
993 int hw = (int) (BAR_LENGTH * hull_strength);
994 int sw = (int) (BAR_LENGTH * (tgt_ship->
ShieldStrength() / 100.0));
1023 double distance = 0;
1025 if (!c_ship && !c_shot || c_ship ==
ship)
1035 mark_pt +=
Point(0,150,0);
1044 if (mark_pt.
z > 1.0) {
1045 distance = mark_pt.
length();
1049 int x = (int) mark_pt.
x;
1050 int y = (
int) mark_pt.
y;
1052 if (x > 4 && x <
width-4 &&
1066 bool name_crowded =
false;
1081 double limit = 75e3;
1086 double range = contact->
Range(
ship, limit);
1088 char contact_buf[256];
1089 Rect contact_rect(x+8, y-4, 120, 12);
1092 sprintf_s(contact_buf,
"%c *", code);
1097 if (range > 999e3) {
1101 else if (range < 1e3)
1108 strcpy_s(contact_buf, c_ship->
Name());
1110 sprintf_s(contact_buf,
"%c %d", code, (
int) range);
1112 sprintf_s(contact_buf,
"%c %.1f M", code, range);
1127 sprintf_s(contact_buf,
"%c %d%c", code, (
int) range, closing);
1129 sprintf_s(contact_buf,
"%c %.1f M", code, range);
1137 name_crowded = distance > 50e3;
1140 name_crowded =
true;
1144 bool name_drawn =
false;
1147 if (netp && strcmp(netp->
Name(),
"Server A.I. Ship")) {
1148 Rect contact_rect(x+8, y+6, 120, 12);
1154 if (!name_drawn && !name_crowded && c_ship && c_iff < 10 && !
arcade) {
1155 Rect contact_rect(x+8, y+6, 120, 12);
1162 if (threat < 1 && c_ship && !c_ship->IsStarship())
1180 const double CLIP_Z = 0.1;
1182 if (t1.
z < CLIP_Z && t2.
z < CLIP_Z)
1185 if (t1.
z < CLIP_Z && t2.
z >= CLIP_Z) {
1186 double dx = t2.
x - t1.
x;
1187 double dy = t2.
y - t1.
y;
1188 double s = (CLIP_Z - t1.
z) / (t2.
z - t1.
z);
1195 else if (t2.
z < CLIP_Z && t1.
z >= CLIP_Z) {
1196 double dx = t1.
x - t2.
x;
1197 double dy = t1.
y - t2.
y;
1198 double s = (CLIP_Z - t2.
z) / (t1.
z - t2.
z);
1205 if (t1.
z >= CLIP_Z && t2.
z >= CLIP_Z) {
1236 for (
int i = 0; i < ctl-1; i++) {
1257 c = ((
Shot*) targ)->MarkerColor();
1259 if (r.
w > 0 && r.
h > 0) {
1276 if (mark_pt.
z < 1.0)
1281 int x = (int) mark_pt.
x;
1282 int y = (
int) mark_pt.
y;
1284 if (x < 4 || x >
width-4 || y < 4 || y >
height-4)
1312 lead_sprite->
Hide();
1314 tgt1_sprite->
Hide();
1315 tgt2_sprite->
Hide();
1316 tgt3_sprite->
Hide();
1317 tgt4_sprite->
Hide();
1318 chase_sprite->
Hide();
1320 for (
int i = 0; i < 31; i++)
1323 const int bar_width = 256;
1324 const int bar_height = 192;
1325 const int box_width = 120;
1329 int l = cx - bar_width/2;
1330 int r = cx + bar_width/2;
1331 int t = cy - bar_height/2;
1332 int b = cy + bar_height/2;
1333 int align = DT_LEFT;
1351 r =
width - box_width - 16;
1354 Rect speed_rect(l-box_width-8, cy-5, box_width, 12);
1356 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1364 if (alt_agl <= 1000)
1365 sprintf_s(txt,
"R %4d", (
int) alt_agl);
1372 char arcade_txt[32];
1373 sprintf_s(arcade_txt,
"%s %s",
Game::GetText(
"HUDView.altitude").data(), txt);
1374 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1378 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1386 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1398 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1403 if (heading_degrees < 0) heading_degrees += 360;
1404 sprintf_s(txt,
"%s: %03d",
Game::GetText(
"HUDView.Heading").data(), heading_degrees);
1412 Rect heading_rect(l, t+5, bar_width, 12);
1414 if (heading_degrees < 0) heading_degrees += 360;
1415 sprintf_s(txt,
"%d", heading_degrees);
1430 speed_rect.
y = cy+76;
1440 Rect gear_rect(l, b+20, box_width, 12);
1448 const char* threat_warn =
Game::GetText(
"HUDView.threat-warn");
1449 bool show_msg =
true;
1451 if (quantum && quantum->
JumpTime() > 0) {
1452 static char buf[64];
1463 Rect lock_rect(l, t-25, box_width, 12);
1469 Rect auto_rect(l, t-40, box_width, 12);
1480 Rect range_rect(r-20, cy-5, box_width, 12);
1488 speed_rect.
x = l-box_width-8;
1489 speed_rect.
y = cy-5 +20;
1490 speed_rect.
w = box_width;
1491 align = (
tactical) ? DT_LEFT : DT_RIGHT;
1500 speed_rect.
y = cy-5 +30;
1501 sprintf_s(txt,
"%s %d", missile->
Name(), missile->
Ammo());
1507 Rect shoot_rect(l, b+5, box_width, 12);
1514 speed_rect.
y = cy-5+40;
1519 speed_rect.
y = cy-5+40;
1525 Rect eta_rect = speed_rect;
1535 for (
int i = 0; i < 2; i++) {
1538 int minutes = (eta/60) % 60;
1539 int seconds = (eta ) % 60;
1542 sprintf_s(eta_buf,
"T %d:%02d", minutes, seconds);
1550 if (netgame && !netgame->
IsActive()) {
1551 Rect shoot_rect(l, b+5, box_width, 12);
1556 Rect shoot_rect(l, b+5, box_width, 12);
1589 int behind = tloc.
z < 0;
1610 for (
int i = 0; i < 31; i++)
1623 if (svel.
x == 0 && svel.
z == 0)
1632 const double baseline = 1e9;
1633 const double clip_angle = 20*
DEGREES;
1635 Point tloc = gloc + svel * baseline;
1647 double roll_angle = 0;
1648 double pitch_angle = 0;
1653 if (heading.
x != 0 || heading.
z != 0) {
1654 Point gheading = heading;
1658 double dot = gheading * heading;
1660 if (heading.y < 0) dot = -dot;
1662 pitch_angle = acos(dot);
1664 if (pitch_angle >
PI/2)
1667 double s0 = sin(pitch_angle);
1668 double c0 = cos(pitch_angle);
1669 double s1 = sin(pitch_angle + 10*
DEGREES);
1670 double c1 = cos(pitch_angle + 10*
DEGREES);
1672 tloc = gloc + (svel * baseline * c0) + (uvec * baseline * s0);
1678 tloc = gloc + (svel * baseline * c1) + (uvec * baseline * s1);
1687 roll_angle = atan2(-dy,dx) +
PI/2;
1690 const double alias_limit = 0.1*
DEGREES;
1692 if (fabs(roll_angle) <= alias_limit) {
1694 roll_angle = alias_limit;
1696 roll_angle = -alias_limit;
1699 else if (fabs(roll_angle-
PI) <= alias_limit) {
1700 roll_angle =
PI - alias_limit;
1703 if (fabs(pitch_angle) <= clip_angle) {
1709 for (
int i = 1; i <= 15; i++) {
1710 double angle = i * 5 *
DEGREES;
1713 angle = (60 + (i-12)*10) *
DEGREES;
1715 double s = sin(angle);
1716 double c = cos(angle);
1718 if (fabs(pitch_angle - angle) <= clip_angle) {
1720 tloc = gloc + (svel * baseline * c) + (uvec * baseline * s);
1731 if (fabs(pitch_angle + angle) <= clip_angle) {
1733 tloc = gloc + (svel * baseline * c) + (uvec * -baseline * s);
1763 Point hvec =
Point(sin(az), sin(el), cos(az));
1770 int behind = tloc.
z < 0;
1825 bool show_az = fabs(helm_heading - curr_heading) > 5*
DEGREES;
1826 bool show_el = fabs(helm_pitch - curr_pitch) > 5*
DEGREES;
1830 if (show_az || show_el) {
1834 if (show_el || fabs(helm_pitch) > 5 *
DEGREES) {
1837 ring_orient.
Yaw(helm_heading +
PI);
1843 pointer_orient.
Yaw(helm_heading +
PI);
1844 pointer_orient.
Pitch(-helm_pitch);
1845 pointer_orient.
Roll(
PI/2);
1852 pointer_orient.
Yaw(helm_heading +
PI);
1865 lead_sprite->
Hide();
1867 chase_sprite->
Hide();
1879 int behind = tloc.
z < 0;
1889 tloc.
x <= 0 || tloc.
x >=
width-1 ||
1890 tloc.
y <= 0 || tloc.
y >=
height-1) {
1893 if (tloc.
x <= 0 || (behind && tloc.
x <
width/2)) {
1894 if (tloc.
y <
ah) tloc.
y =
ah;
1897 chase_sprite->
Show();
1903 else if (tloc.
x >=
width-1 || behind) {
1904 if (tloc.
y <
ah) tloc.
y =
ah;
1907 chase_sprite->
Show();
1912 if (tloc.
x <
aw) tloc.
x =
aw;
1917 chase_sprite->
Show();
1923 else if (tloc.
y >=
height-1) {
1924 chase_sprite->
Show();
1939 double shot_speed = shot_vel.
length();
1942 double time = dist / shot_speed;
1953 Point delta = impact - dest;
1982 lead_sprite->
Show();
1994 const int bar_width = 256;
1995 const int bar_height = 192;
1996 const int box_width = 120;
2002 if (controller && !
target)
2016 int l = cx - bar_width/2;
2017 int r = cx + bar_width/2;
2018 int t = cy - bar_height/2;
2019 int b = cy + bar_height/2;
2021 double distance = delta.
length();
2023 double speed = delta_v.
length();
2028 distance = delta.
length();
2040 Rect range_rect(r-20, cy-5, box_width, 12);
2043 range_rect.
x =
width - range_rect.
w - 8;
2047 double limit = 75e3;
2080 range_rect.
y = cy-76;
2084 range_rect.
x =
width - 2*box_width - 8;
2085 range_rect.
y = cy-76;
2086 range_rect.
w = 2*box_width;
2121 if (blink_delta < 250)
2122 stat =
Color(8,8,8);
2126 if (blink_delta > 500)
2142 int eta = tgt_drone->
GetEta();
2145 int minutes = (eta/60) % 60;
2146 int seconds = (eta ) % 60;
2149 sprintf_s(eta_buf,
"T %d:%02d", minutes, seconds);
2163 const int bar_width = 256;
2164 const int bar_height = 192;
2165 const int box_width = 120;
2169 Rect info_rect(
width/2-box_width,
height/2+bar_height, box_width*2, 12);
2187 int l = cx - bar_width/2;
2188 int r = cx + bar_width/2;
2189 int t = cy - bar_height/2;
2190 int b = cy + bar_height/2;
2199 etr = (int) (distance/speed);
2201 Rect info_rect(r-20, cy+32, box_width, 12);
2204 info_rect.
x =
width - info_rect.
w - 8;
2209 sprintf_s(txt,
"%s %d",
Game::GetText(
"HUDView.Nav").data(), index);
2222 sprintf_s(txt,
"%s XX:XX",
Game::GetText(
"HUDView.time-enroute").data());
2228 int minutes = (etr/60) % 60;
2229 int seconds = (etr ) % 60;
2230 sprintf_s(txt,
"%s %2d:%02d",
Game::GetText(
"HUDView.time-enroute").data(), minutes, seconds);
2237 int hold = (int) navpt->
HoldTime();
2238 int minutes = (hold/60) % 60;
2239 int seconds = (hold ) % 60;
2240 sprintf_s(txt,
"%s %2d:%02d",
Game::GetText(
"HUDView.HOLD").data(), minutes, seconds);
2253 double distance = delta.
length();
2273 tgt1_sprite->
Hide();
2274 tgt2_sprite->
Hide();
2275 tgt3_sprite->
Hide();
2276 tgt4_sprite->
Hide();
2292 tloc +=
Point(0,150,0);
2303 if (xtarg>0 && xtarg<width-1 && ytarg>0 && ytarg<
height-1) {
2308 tgt4_sprite->
Show();
2314 tgt1_sprite->
Show();
2325 while (!t3 && ++w) {
2332 sprite = tgt1_sprite;
2337 sprite = tgt2_sprite;
2345 sprite = tgt3_sprite;
2347 if (t3 == t1 || t3 == t2)
2365 if (xtarg>0 && xtarg<width-1 && ytarg>0 && ytarg<
height-1) {
2369 if (sprite == tgt1_sprite) {
2371 sprite = tgt4_sprite;
2416 static int GetReactorStatus(
Ship* ship)
2428 if (s->
Status() < status)
2438 static int GetDriveStatus(
Ship* ship)
2450 if (s->
Status() < status)
2463 static int GetQuantumStatus(
Ship* ship)
2472 static int GetThrusterStatus(
Ship* ship)
2481 static int GetShieldStatus(
Ship* ship)
2496 if (s->
Status() < status)
2504 if (d->
Status() < status)
2517 static int GetWeaponStatus(
Ship* ship,
int index)
2531 if (s->
Status() < status)
2544 static int GetSensorStatus(
Ship* ship)
2552 int status = s->
Status();
2556 if (p->
Status() < status)
2569 static int GetComputerStatus(
Ship* ship)
2581 if (s->
Status() < status)
2591 if (s->
Status() < status)
2604 static int GetFlightDeckStatus(
Ship* ship)
2616 if (s->
Status() < status)
2633 int box_height = 17;
2634 int row_height = 28;
2635 int box_left =
width/2 - box_width*2;
2645 warn_left_sprite->
Show();
2646 warn_right_sprite->
Show();
2655 for (
int index = 0; index < 12; index++) {
2660 case 0: stat = GetReactorStatus(ship); abrv =
Game::GetText(
"HUDView.REACTOR");
break;
2661 case 1: stat = GetDriveStatus(ship); abrv =
Game::GetText(
"HUDView.DRIVE");
break;
2662 case 2: stat = GetQuantumStatus(ship); abrv =
Game::GetText(
"HUDView.QUANTUM");
break;
2663 case 3: stat = GetShieldStatus(ship); abrv =
Game::GetText(
"HUDView.SHIELD");
2671 case 7: stat = GetWeaponStatus(ship, index-4);
2678 case 8: stat = GetSensorStatus(ship); abrv =
Game::GetText(
"HUDView.SENSOR");
break;
2679 case 9: stat = GetComputerStatus(ship); abrv =
Game::GetText(
"HUDView.COMPUTER");
break;
2680 case 10: stat = GetThrusterStatus(ship); abrv =
Game::GetText(
"HUDView.THRUSTER");
break;
2681 case 11: stat = GetFlightDeckStatus(ship);abrv =
Game::GetText(
"HUDView.FLTDECK");
break;
2684 Rect warn_rect(x, y, box_width, box_height);
2701 Rect r2 = warn_rect;
2712 DT_CENTER | DT_SINGLELINE,
2752 instr_left_sprite->
Show();
2753 instr_right_sprite->
Show();
2768 int npages = ninst/6 + (ninst%6 ? 1 : 0);
2776 int last = first + 6;
2777 if (last > ninst) last = ninst;
2781 for (
int i = first; i < last; i++) {
2782 hud_text[n].
color = standard_txt_colors[
color];
2788 sprintf_s(page,
"%d / %d",
inst_page+1, npages);
2796 for (
int i = 0; i < nobj; i++) {
2799 hud_text[n].
color = standard_txt_colors[
color];
2817 return (
const char*) instr;
2819 static char result[256];
2821 const char* s = (
const char*) instr;
2831 while (*s && (isupper(*s) || isdigit(*s) || *s ==
'_')) *a++ = *s++;
2838 if (!s2) s2 = action;
2839 while (*s2) *d++ = *s2++;
2867 int message_queue_empty =
true;
2870 for (
int i = 0; i <
MAX_MSG; i++) {
2879 message_queue_empty =
false;
2883 if (!message_queue_empty) {
2885 for (
int i = 0; i <
MAX_MSG; i++) {
2887 for (
int j = 0; j < MAX_MSG-1; j++) {
2898 for (
int i = 0; i <
MAX_MSG; i++) {
2902 Rect msg_rect(10, 95 + i*10,
width-20, 12);
2946 bool hoops_drawn =
false;
2947 bool same_sector =
false;
2964 int x = (int) dst.
x;
2965 int y = (
int) dst.
y;
2967 if (x > 4 && x <
width-4 &&
2978 for (
int h = 0; h < fd->
NumHoops(); h++) {
2980 if (hoop && scene) {
3002 (carrier->
GetIFF() == 0);
3015 int x = (int) dst.
x;
3016 int y = (
int) dst.
y;
3018 if (x > 4 && x <
width-4 &&
3029 for (
int h = 0; h < fd->
NumHoops(); h++) {
3031 if (hoop && scene) {
3062 int x = (int) obj.
x;
3063 int y = (
int) obj.
y;
3065 if (x > 4 && x <
width-4 &&
3082 int x = (int) obj.
x;
3083 int y = (
int) obj.
y;
3085 if (x > 4 && x <
width-4 &&
3102 if (index >= 15 || !navpt.
Region())
return;
3121 int x = (int) npt.
x;
3122 int y = (
int) npt.
y;
3125 if (x > 4 && x <
width-4 &&
3141 Rect npt_rect(x+10, y-4, 200, 12);
3146 sprintf_s(npt_buf,
"%d %s", index, hold_time);
3149 sprintf_s(npt_buf,
"%d", index);
3163 int behind = tloc.
z < 0;
3173 tloc.
x <= 0 || tloc.
x >=
width-1 ||
3174 tloc.
y <= 0 || tloc.
y >=
height-1) {
3177 if (tloc.
x <= 0 || (behind && tloc.
x <
width/2)) {
3178 if (tloc.
y <
ah) tloc.
y =
ah;
3181 chase_sprite->
Show();
3187 else if (tloc.
x >=
width-1 || behind) {
3188 if (tloc.
y <
ah) tloc.
y =
ah;
3191 chase_sprite->
Show();
3196 if (tloc.
x <
aw) tloc.
x =
aw;
3201 chase_sprite->
Show();
3207 else if (tloc.
y >=
height-1) {
3208 chase_sprite->
Show();
3223 double new_scale = 1;
3234 new_scale = 1.1 * ship->
Radius() / 64;
3272 bool update =
false;
3279 if (s != ship_status) {
3290 if (ship && ship->
Cockpit()) {
3293 bool change =
false;
3308 if (cockpit_model) {
3325 bool update =
false;
3342 if (s != tgt_status) {
3354 PrepareBitmap(
"hud_icon.pcx", icon_target, icon_target_shade);
3367 if (n >= 0 && n < 3)
3390 int mouse_index_old = mouse_index;
3408 int bmp_w = hud_bmp->
Width();
3409 int bmp_h = hud_bmp->
Height();
3416 int bmp_w = hud_bmp->
Width();
3417 int bmp_h = hud_bmp->
Height();
3428 int bmp_w = hud_bmp->
Width();
3429 int bmp_h = hud_bmp->
Height();
3441 int bmp_w = hud_bmp->
Width();
3442 int bmp_h = hud_bmp->
Height();
3448 for (
int i = 8; i < 32; i++) {
3454 int w2 = s->
Width() / 2;
3455 int h2 = s->
Height() / 2;
3462 for (
int i = 0; i < 32; i++) {
3468 int w2 = s->
Width() / 2;
3469 int h2 = s->
Height() / 2;
3477 for (
int i = 0; i < 31; i++) {
3545 if (missile_lock_sound) {
3548 long volume = -1500;
3550 if (volume > max_vol)
3554 missile_lock_sound->
Play();
3557 missile_lock_sound->
Stop();
3571 if (fov_degrees > 90)
3580 instr_left_sprite->
Hide();
3581 instr_right_sprite->
Hide();
3582 warn_left_sprite->
Hide();
3583 warn_right_sprite->
Hide();
3606 icon_rect.
x =
width - 248;
3624 if (mouse_index > -1 && mouse_index_old != mouse_index)
3631 for (
int i = 0; i < 3; i++) {
3664 float r = (float) body->
Radius();
3698 hud_left_sprite->
Hide();
3699 hud_right_sprite->
Hide();
3702 else if (hud_left_sprite->
Frame() != &hud_left_starship) {
3712 if (ship->
IsAirborne() && hud_left_sprite->
Frame() != &hud_left_air) {
3717 else if (!ship->
IsAirborne() && hud_left_sprite->
Frame() != &hud_left_fighter) {
3725 hud_left_sprite->
Show();
3726 hud_right_sprite->
Show();
3749 icon_ship_sprite->
Show();
3750 icon_target_sprite->
Show();
3753 icon_ship_sprite->
Hide();
3754 icon_target_sprite->
Hide();
3762 hud_left_sprite->
Hide();
3763 hud_right_sprite->
Hide();
3764 instr_left_sprite->
Hide();
3765 instr_right_sprite->
Hide();
3766 warn_left_sprite->
Hide();
3767 warn_right_sprite->
Hide();
3768 icon_ship_sprite->
Hide();
3769 icon_target_sprite->
Hide();
3772 lead_sprite->
Hide();
3774 tgt1_sprite->
Hide();
3775 tgt2_sprite->
Hide();
3776 tgt3_sprite->
Hide();
3777 tgt4_sprite->
Hide();
3778 chase_sprite->
Hide();
3780 for (
int i = 0; i < 3; i++)
3783 for (
int i = 0; i < 31; i++)
3795 if (mfd_index < 0 || mfd_index > 2)
return;
3800 if (mfd_index == 2) {
3923 for (
int i = 0; i < 3; i++)
3927 icon_ship_sprite->
Show();
3928 icon_target_sprite->
Show();
3931 icon_ship_sprite->
Hide();
3932 icon_target_sprite->
Hide();
3936 hud_left_sprite->
Show();
3937 hud_right_sprite->
Show();
3948 lead_sprite->
Show();
3955 for (
int i = 0; i < 3; i++)
3958 hud_left_sprite->
Hide();
3959 hud_right_sprite->
Hide();
3960 instr_left_sprite->
Hide();
3961 instr_right_sprite->
Hide();
3962 warn_left_sprite->
Hide();
3963 warn_right_sprite->
Hide();
3964 icon_ship_sprite->
Hide();
3965 icon_target_sprite->
Hide();
3968 lead_sprite->
Hide();
3970 tgt1_sprite->
Hide();
3971 tgt2_sprite->
Hide();
3972 tgt3_sprite->
Hide();
3973 tgt4_sprite->
Hide();
3974 chase_sprite->
Hide();
3978 for (
int i = 0; i < 31; i++)
3981 if (missile_lock_sound)
3982 missile_lock_sound->
Stop();
4008 return night_vision_colors[
color];
4064 for (
int i = 0; i < 3; i++)
4082 vsprintf(msg, fmt, (
char *)(&fmt+1));
4084 char* newline = strchr(msg,
'\n');
4093 for (
int i = 0; i <
MAX_MSG; i++) {
4102 for (
int i = 0; i < MAX_MSG-1; i++) {
4122 for (
int i = 0; i <
MAX_MSG-1; i++) {
4146 int w = img.
Width();
4149 shades =
new(__FILE__,__LINE__) BYTE[w*h];
4151 for (
int y = 0; y < h; y++)
4152 for (
int x = 0; x < w; x++)
4153 shades[y*w+x] = (BYTE) (img.
GetColor(x,y).
Red() * 0.66);
4168 int w = img.
Width();
4171 shades =
new(__FILE__,__LINE__) BYTE[w*h];
4173 for (
int y = 0; y < h; y++)
4174 for (
int x = 0; x < w; x++)
4175 shades[y*w+x] = (BYTE) (img.
GetColor(x,y).
Red() * 0.5);
4181 if (!shades)
return;
4185 if (max_tex_size < 128)
4193 for (
int y = 0; y < img.
Height(); y++) {
4194 for (
int x = 0; x < img.
Width(); x++) {
4196 *dst = color.
dim(*src/200.0);
4212 if (max_tex_size < 128)
4222 if (ctrl && ctrl->
Active())
4299 bool result = mouse_in;
4304 for (
int i = 0; i < 3; i++)
4324 int d = dx*dx + dy*dy;
4337 int d = dx*dx + dy*dy;