62 :
View(c), gamescreen(parent), ship(0), camview(0), projector(0),
63 mouse_down(0), right_down(0), shift_down(0),
64 show_move(0), show_action(0), active_menu(0), menu_view(0),
65 msg_ship(0), base_alt(0), move_alt(0)
123 return "TacticalView";
140 bool rebuild =
false;
181 if (selection && selection->
Rep())
191 if (sel.
size() == 1) {
250 Color c = hud_color * 0.66;
275 if (mark_pt.
z > 1.0) {
278 int x = (int) mark_pt.
x;
284 if (x > 4 && x <
width-4 &&
287 const int BAR_LENGTH = 40;
290 int sx = x - BAR_LENGTH/2;
295 int hw = (int) (BAR_LENGTH * hull_strength);
307 Color sc = hud_color;
320 if (!
ship || !seln)
return;
331 static char name[64];
332 static char design[64];
333 static char shield[32];
334 static char hull[32];
335 static char range[32];
336 static char heading[32];
337 static char speed[32];
338 static char orders[64];
342 int show_labels =
width > 640;
343 int full_info =
true;
347 if (shield_val < 0) shield_val = 0;
348 if (hull_val < 0) hull_val = 0;
350 sprintf_s(name,
"%s", seln->
Name());
353 sprintf_s(shield,
"%s %03d",
Game::GetText(
"HUDView.symbol.shield").data(), shield_val);
354 sprintf_s(hull,
"%s %03d",
Game::GetText(
"HUDView.symbol.hull").data(), hull_val);
357 sprintf_s(shield,
"%03d", shield_val);
358 sprintf_s(hull,
"%03d", hull_val);
362 strcat_s(range,
" km");
370 strcat_s(speed,
" m/s");
460 if (instr && instr->
Action()) {
464 strcat_s(orders,
" ");
484 sprintf_s(psv,
"%03d", (
int) (contact->
PasReturn() * 100.0));
485 sprintf_s(act,
"%03d", (
int) (contact->
ActReturn() * 100.0));
512 sprintf_s(name,
"%s", seln->
Name());
542 static DWORD rbutton_latch = 0;
588 if (!mouse_con || !mouse_con->
Active()) {
651 int dx = (int) fabs((
double) (mouse_x -
mouse_start.x));
652 int dy = (int) fabs((
double) (mouse_y -
mouse_start.y));
654 static DWORD click_time = 0;
656 if (dx < 3 && dy < 3) {
657 bool hit =
SelectAt(mouse_x, mouse_y);
684 if (!
ship)
return false;
691 else if (
sim && selection)
694 return selection != 0;
704 if (!
ship || !
sim)
return result;
706 if (rect.
w > 8 || rect.
h > 8)
713 Ship* test = contact_list[i]->GetShip();
715 if (test && test !=
ship) {
720 if (test_loc.
z > 1) {
723 if (rect.
Contains((
int) test_loc.
x, (
int) test_loc.
y)) {
746 if (test_loc.
z > 1) {
749 if (rect.
Contains((
int) test_loc.
x, (
int) test_loc.
y)) {
771 Ship* test = contact_list[i]->GetShip();
784 if (r.
x == 2000 && r.
y == 2000 && r.
w == 0 && r.
h == 0) {
795 if (r.
w < 20 || r.
h < 20)
834 if (
sim && approach) {
839 if (selection !=
ship) {
865 double az = atan2(fabs(delta.
x), delta.
z);
866 double el = asin(delta.
y);
885 static Menu* main_menu = 0;
886 static Menu* view_menu = 0;
887 static Menu* emcon_menu = 0;
889 static Menu* fighter_menu = 0;
890 static Menu* starship_menu = 0;
891 static Menu* action_menu = 0;
892 static Menu* formation_menu = 0;
893 static Menu* sensors_menu = 0;
894 static Menu* quantum_menu = 0;
895 static Menu* farcast_menu = 0;
918 static int initialized = 0;
919 if (initialized)
return;
929 quantum_menu =
new(__FILE__,__LINE__)
Menu(
Game::GetText(
"TacView.menu.quantum"));
930 farcast_menu =
new(__FILE__,__LINE__)
Menu(
Game::GetText(
"TacView.menu.farcast"));
941 formation_menu =
new(__FILE__,__LINE__)
Menu(
Game::GetText(
"TacView.menu.formation"));
953 fighter_menu =
new(__FILE__,__LINE__)
Menu(
Game::GetText(
"TacView.menu.context"));
964 starship_menu =
new(__FILE__,__LINE__)
Menu(
Game::GetText(
"TacView.menu.context"));
983 delete starship_menu;
985 delete formation_menu;
1238 if (fabs(focal_vect.x) > fabs(focal_vect.z)) {
1266 if (fabs(focal_vect.y) > 1e-5) {
1273 while (t <= 0 && my <
height-1) {
1310 double distance = (dest - origin).length();
1315 int x0 = (int) origin.
x;
1316 int y0 = (
int) origin.
y;
1321 int x = (int) dest.
x;
1322 int y = (
int) dest.
y;
1328 Rect range_rect(x+12, y-8, 120, 20);
1338 int x1 = (int) dest.
x;
1339 int y1 = (
int) dest.
y;
1345 range_rect.
x = x1+12;
1346 range_rect.
y = y1-8;
1351 font->
DrawText(range, 0, range_rect, DT_LEFT | DT_SINGLELINE);
1374 static int invalid_action =
false;
1385 int x0 = (int) origin.
x;
1386 int y0 = (
int) origin.
y;
1409 if (tgt_iff ==
ship->
GetIFF() || tgt_iff == 0)
1418 if (tgt_iff == enemy)
1443 invalid_action =
false;
1448 invalid_action =
true;