Buttload of hacking.
authormdw <mdw>
Sun, 2 Mar 2003 12:18:50 +0000 (12:18 +0000)
committermdw <mdw>
Sun, 2 Mar 2003 12:18:50 +0000 (12:18 +0000)
14 files changed:
alg_gfx.c
alg_main.c
docked.c
elite.c
elite.h
file.c
keyboard.c
keyboard.h
missions.c
space.c
space.h
swat.c
threed.c
trade.c

index 222b0c0..2ca464e 100644 (file)
--- a/alg_gfx.c
+++ b/alg_gfx.c
@@ -83,7 +83,9 @@ int gfx_graphics_startup (void)
 #endif
 
 #else
-       rv = set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0);
+       rv = set_gfx_mode(prefer_window ?
+                           GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT,
+                         800, 600, 0, 0);
 #endif
 
        if (rv != 0)
@@ -584,7 +586,11 @@ void gfx_display_pretty_text (int tx, int ty, int bx, int by, char *txt)
 
 void gfx_draw_scanner (void)
 {
-       blit (scanner_image, gfx_screen, 0, 0, GFX_X_OFFSET, 385+GFX_Y_OFFSET, scanner_image->w, scanner_image->h);
+       set_clip(gfx_screen, GFX_X_OFFSET, 385 + GFX_Y_OFFSET,
+                GFX_X_OFFSET + scanner_image->w,
+                GFX_Y_OFFSET + scanner_image->h + 385);
+       blit (scanner_image, gfx_screen, 0, 0, GFX_X_OFFSET,
+             385+GFX_Y_OFFSET, scanner_image->w, scanner_image->h);
 }
 
 void gfx_set_clip_region (int tx, int ty, int bx, int by)
index ef1246e..b1cae7b 100644 (file)
@@ -63,6 +63,8 @@ int rolling;
 int climbing;
 int game_paused;
 int have_joystick;
+int identify;
+int scanner_zoom = 1;
 
 int find_input;
 char find_name[20];
@@ -132,6 +134,11 @@ void move_cross (int dx, int dy)
 {
        cross_timer = 5;
 
+       if (kbd_ctrl_pressed) {
+         dx *= 4;
+         dy *= 4;
+       }
+
        if (current_screen == SCR_SHORT_RANGE)
        {
                cross_x += (dx * 4);
@@ -863,6 +870,10 @@ void handle_flight_keys (void)
        if (kbd_n_pressed)
                n_pressed();
 
+       if (kbd_i_pressed == 1)
+         identify = !identify;
+       if (kbd_zoom_pressed == 1)
+         scanner_zoom ^= 3;
  
        if (kbd_fire_pressed)
        {
@@ -1087,6 +1098,7 @@ void run_first_intro_screen (void)
        snd_play_midi (SND_ELITE_THEME, TRUE);
 
        initialise_intro1();
+       identify = 0;
 
        for (;;)
        {
@@ -1120,6 +1132,7 @@ void run_second_intro_screen (void)
        
        snd_play_midi (SND_BLUE_DANUBE, TRUE);
                
+       identify = 0;
        initialise_intro2();
 
        flight_speed = 3;
@@ -1160,6 +1173,7 @@ void run_game_over_screen()
        flight_speed = 6;
        flight_roll = 0;
        flight_climb = 0;
+       identify = 0;
        clear_universe();
 
        set_init_matrix (rotmat);
index dc49754..52e1863 100644 (file)
--- a/docked.c
+++ b/docked.c
@@ -25,7 +25,7 @@
 #include "planet.h"
 #include "shipdata.h"
 #include "space.h"
-
+#include "keyboard.h"
 
 
 
@@ -497,6 +497,7 @@ static char *condition_txt[] =
        "Docked",
        "Green",
        "Yellow",
+       "Red",
        "Red"
 };
 
@@ -506,8 +507,6 @@ void display_commander_status (void)
        char str[100];
        int i;
        int x,y;
-       int condition;
-       int type;
        
        current_screen = SCR_CMDR_STATUS;
 
@@ -536,28 +535,6 @@ void display_commander_status (void)
        sprintf (str, "%s", planet_name);
        gfx_display_text (190, 74, str);
 
-       if (docked)
-               condition = 0;
-       else
-       {
-               condition = 1;
-
-               for (i = 0; i < MAX_UNIV_OBJECTS; i++)
-               {
-                       type = universe[i].type;
-               
-                       if ((type == SHIP_MISSILE) ||
-                               ((type > SHIP_ROCK) && (type < SHIP_DODEC)))
-                       {
-                               condition = 2;
-                               break;
-                       }
-               }
-               if ((condition == 2) && (energy < 128))
-                       condition = 3;
-       }
-       
        gfx_display_colour_text (16, 90, "Condition:", GFX_COL_GREEN_1);
        gfx_display_text (190, 90, condition_txt[condition]);
 
@@ -791,39 +768,43 @@ void buy_stock (void)
                return;
 
        item = &stock_market[hilite_item];
-               
-       if ((item->current_quantity == 0) ||
-           (cmdr.credits < item->current_price))
+
+       do {
+         if ((item->current_quantity == 0) ||
+                 (cmdr.credits < item->current_price))
                return;
 
-       cargo_held = total_cargo();
+         cargo_held = total_cargo();
        
-       if ((item->units == TONNES) &&
-               (cargo_held == cmdr.cargo_capacity))
+         if ((item->units == TONNES) &&
+                 (cargo_held == cmdr.cargo_capacity))
                return;
        
-       cmdr.current_cargo[hilite_item]++;
-       item->current_quantity--;
-       cmdr.credits -= item->current_price;    
+         cmdr.current_cargo[hilite_item]++;
+         item->current_quantity--;
+         cmdr.credits -= item->current_price;  
 
-       highlight_stock (hilite_item);
+         highlight_stock (hilite_item);
+       } while (kbd_ctrl_pressed);
 }
 
 
 void sell_stock (void)
 {
        struct stock_item *item;
-       
-       if ((!docked) || (cmdr.current_cargo[hilite_item] == 0))
+
+       do {
+         if ((!docked) || (cmdr.current_cargo[hilite_item] == 0))
                return;
 
-       item = &stock_market[hilite_item];
+         item = &stock_market[hilite_item];
 
-       cmdr.current_cargo[hilite_item]--;
-       item->current_quantity++;
-       cmdr.credits += item->current_price;    
+         cmdr.current_cargo[hilite_item]--;
+         item->current_quantity++;
+         cmdr.credits += item->current_price;  
 
-       highlight_stock (hilite_item);
+         highlight_stock (hilite_item);
+       } while (kbd_ctrl_pressed);
 }
 
 
diff --git a/elite.c b/elite.c
index e416937..3ced737 100644 (file)
--- a/elite.c
+++ b/elite.c
@@ -60,7 +60,11 @@ int energy;
 int laser_temp;
 int detonate_bomb;
 int auto_pilot;
+int prefer_window;
+int condition_x, condition_y, condition_r;
+int zoom_x, zoom_y;
 
+int condition = COND_DOCKED;
 
 struct commander saved_cmdr =
 {
diff --git a/elite.h b/elite.h
index f1396ef..ad6e7f1 100644 (file)
--- a/elite.h
+++ b/elite.h
@@ -62,7 +62,8 @@
 #define FLG_SLOW                       (2048)
 #define FLG_BOLD                       (4096)
 #define FLG_POLICE                     (8192)
-
+#define FLG_TACTICAL                   (16384)
+#define FLG_TARGET                     (32768)
 
 #define MAX_UNIV_OBJECTS       20
 
@@ -142,6 +143,14 @@ extern int scanner_cx;
 extern int scanner_cy;
 extern int compass_centre_x;
 extern int compass_centre_y;
+extern int prefer_window;
+extern int condition_x, condition_y, condition_r;
+extern int zoom_x, zoom_y;
+
+extern int condition;
+enum {
+  COND_DOCKED, COND_GREEN, COND_YELLOW, COND_RED, COND_ALERT
+};
 
 extern int planet_render_style;
 
@@ -159,7 +168,8 @@ extern int mcount;
 extern int detonate_bomb;
 extern int witchspace;
 extern int auto_pilot;
-
+extern int identify;
+extern int scanner_zoom;
 
 void restore_saved_commander (void);
 
diff --git a/file.c b/file.c
index f8469b4..3a38643 100644 (file)
--- a/file.c
+++ b/file.c
@@ -46,6 +46,7 @@ void write_config_file (void)
        fprintf (fp, "%d\t\t# Instant dock: 0 = off, 1 = on\n", instant_dock);
        
        fprintf (fp, "newscan.cfg\t# Name of scanner config file to use.\n");
+       fprintf (fp, "%d\t\t# Run in a window: 0 = off, 1 = on\n", prefer_window);
 
        fclose (fp);
 }
@@ -113,6 +114,14 @@ void read_scanner_config_file (char *filename)
        sscanf (str, "%d,%d", &compass_centre_x, &compass_centre_y);
        compass_centre_y += 385;
        
+       read_cfg_line (str, sizeof(str), fp);
+       sscanf (str, "%d,%d,%d", &condition_x, &condition_y, &condition_r);
+       condition_y += 385;
+
+       read_cfg_line (str, sizeof(str), fp);
+       sscanf (str, "%d,%d", &zoom_x, &zoom_y);
+       zoom_y += 385;
+
        fclose (fp);
 }
 
@@ -149,6 +158,9 @@ void read_config_file (void)
 
        read_cfg_line (str, sizeof(str), fp);
        read_scanner_config_file (str);
+
+       read_cfg_line (str, sizeof(str), fp);
+       sscanf (str, "%d", &prefer_window);
                
        fclose (fp);
 }
index d0dae25..b9ba958 100644 (file)
@@ -34,6 +34,7 @@ int kbd_F11_pressed;
 int kbd_F12_pressed;
 int kbd_y_pressed;
 int kbd_n_pressed;
+int kbd_zoom_pressed;
 int kbd_fire_pressed;
 int kbd_ecm_pressed;
 int kbd_energy_bomb_pressed;
@@ -51,6 +52,7 @@ int kbd_unarm_missile_pressed;
 int kbd_pause_pressed;
 int kbd_resume_pressed;
 int kbd_inc_speed_pressed;
+int kbd_i_pressed;
 int kbd_dec_speed_pressed;
 int kbd_up_pressed;
 int kbd_down_pressed;
@@ -60,6 +62,7 @@ int kbd_enter_pressed;
 int kbd_backspace_pressed;
 int kbd_space_pressed;
 
+static char old_key[KEY_MAX];
 
 int kbd_keyboard_startup (void)
 {
@@ -74,7 +77,16 @@ int kbd_keyboard_shutdown (void)
 
 void kbd_poll_keyboard (void)
 {
+       int i;
        poll_keyboard();
+       for (i = 0; i < KEY_MAX; i++) {
+         if (!key[i])
+           continue;
+         key[i] = 1;
+         if (key[i] && old_key[i])
+           key[i] |= 2;
+       }
+       memcpy(old_key, key, KEY_MAX);
 
        kbd_F1_pressed = key[KEY_F1];
        kbd_F2_pressed = key[KEY_F2];
@@ -91,6 +103,7 @@ void kbd_poll_keyboard (void)
 
        kbd_y_pressed = key[KEY_Y];
        kbd_n_pressed = key[KEY_N];
+       kbd_zoom_pressed = key[KEY_Z];
 
     kbd_fire_pressed = key[KEY_A];
        kbd_ecm_pressed = key[KEY_E];
@@ -105,6 +118,8 @@ void kbd_poll_keyboard (void)
        kbd_origin_pressed = key[KEY_O];
        kbd_find_pressed = key[KEY_F];
 
+       kbd_i_pressed = key[KEY_I];
+
        kbd_fire_missile_pressed = key[KEY_M];
        kbd_target_missile_pressed = key[KEY_T];
        kbd_unarm_missile_pressed = key[KEY_U];
index 7d0cdd2..d36f531 100644 (file)
@@ -32,6 +32,7 @@ extern int kbd_F11_pressed;
 extern int kbd_F12_pressed;
 extern int kbd_y_pressed;
 extern int kbd_n_pressed;
+extern int kbd_zoom_pressed;
 extern int kbd_fire_pressed;
 extern int kbd_ecm_pressed;
 extern int kbd_energy_bomb_pressed;
@@ -43,6 +44,7 @@ extern int kbd_dock_pressed;
 extern int kbd_d_pressed;
 extern int kbd_origin_pressed;
 extern int kbd_find_pressed;
+extern int kbd_i_pressed;
 extern int kbd_fire_missile_pressed;
 extern int kbd_target_missile_pressed;
 extern int kbd_unarm_missile_pressed;
index ea36df6..073cd40 100644 (file)
@@ -202,6 +202,7 @@ void constrictor_mission_brief (void)
        flight_roll = 0;
        flight_climb = 0;
        flight_speed = 0;
+       identify = 0;
 
        do
        {
diff --git a/space.c b/space.c
index 25129df..e95f50f 100644 (file)
--- a/space.c
+++ b/space.c
@@ -587,7 +587,8 @@ void update_universe (void)
                {
                        if (universe[i].flags & FLG_REMOVE)
                        {
-                               if (type == SHIP_VIPER)
+                               if (type == SHIP_VIPER ||
+                                   !(universe[i].flags & FLG_TARGET))
                                        cmdr.legal_status |= 64;
                        
                                bounty = ship_list[type]->bounty;
@@ -595,7 +596,7 @@ void update_universe (void)
                                if ((bounty != 0) && (!witchspace))
                                {
                                        cmdr.credits += bounty;
-                                       sprintf (str, "%d.%d CR", cmdr.credits / 10, cmdr.credits % 10);
+                                       sprintf (str, "Bounty: %d.%d CR", bounty / 10, bounty % 10);
                                        info_message (str);
                                }
                                
@@ -701,9 +702,9 @@ void update_scanner (void)
                        (universe[i].flags & FLG_CLOAKED))
                        continue;
        
-               x = universe[i].location.x / 256;
-               y = universe[i].location.y / 256;
-               z = universe[i].location.z / 256;
+               x = universe[i].location.x * scanner_zoom / 256;
+               y = universe[i].location.y * scanner_zoom / 256;
+               z = universe[i].location.z * scanner_zoom / 256;
 
                x1 = x;
                y1 = -z / 4;
@@ -962,9 +963,19 @@ void display_missiles (void)
 }
 
 
+
+void display_condition(void)
+{
+  static const int cc[] = { GFX_COL_BLACK, GFX_COL_GREEN_1, GFX_COL_YELLOW_1,
+                           GFX_COL_RED, GFX_COL_RED };
+  int c = cc[condition];
+  if (condition == COND_ALERT && (mcount & 4))
+    c = GFX_COL_BLACK;
+  gfx_draw_filled_circle(condition_x, condition_y, condition_r, c);
+}
+
 void update_console (void)
 {
-       gfx_set_clip_region (0, 0, 512, 512);
        gfx_draw_scanner();
        
        display_speed();
@@ -977,18 +988,30 @@ void update_console (void)
        display_laser_temp();
        display_fuel();
        display_missiles();
+       update_condition();
        
-       if (docked)
-               return;
+       if (docked) {
+         gfx_set_clip_region (0, 0, 512, 512);
+         return;
+       }
 
        update_scanner();
        update_compass();
+       display_condition();
+
+       {
+         char buf[5];
+         sprintf(buf, "x%d", scanner_zoom);
+         gfx_display_text(zoom_x, zoom_y, buf);
+       }
 
        if (ship_count[SHIP_CORIOLIS] || ship_count[SHIP_DODEC])
                gfx_draw_sprite (IMG_BIG_S, 387, 490);
 
        if (ecm_active)
                gfx_draw_sprite (IMG_BIG_E, 115, 490);
+
+       gfx_set_clip_region (0, 0, 512, 512);
 }
 
 void increase_flight_roll (void)
@@ -1025,7 +1048,13 @@ void start_hyperspace (void)
                
        hyper_distance = calc_distance_to_planet (docked_planet, hyperspace_planet);
 
-       if ((hyper_distance == 0) || (hyper_distance > cmdr.fuel))
+       if ((docked_planet.a == hyperspace_planet.a &&
+            docked_planet.b == hyperspace_planet.b &&
+            docked_planet.c == hyperspace_planet.c &&
+            docked_planet.d == hyperspace_planet.d &&
+            docked_planet.e == hyperspace_planet.e &&
+            docked_planet.f == hyperspace_planet.f) ||
+           (hyper_distance > cmdr.fuel))
                return;
 
        destination_planet = hyperspace_planet;
@@ -1274,6 +1303,8 @@ void launch_player (void)
        generate_landscape(docked_planet.a * 251 + docked_planet.b);
        set_init_matrix (rotmat);
        add_new_ship (SHIP_PLANET, 0, 0, 65536, rotmat, 0, 0);
+       identify = 0;
+       scanner_zoom = 1;
 
        rotmat[2].x = -rotmat[2].x;
        rotmat[2].y = -rotmat[2].y;
@@ -1295,9 +1326,40 @@ void engage_docking_computer (void)
 {
        if (ship_count[SHIP_CORIOLIS] || ship_count[SHIP_DODEC])
        {
-               snd_play_sample (SND_DOCK);                                     
+               snd_play_sample (SND_DOCK);
                dock_player();
                current_screen = SCR_BREAK_PATTERN;
        }
 }
 
+
+void update_condition(void)
+{
+  if (docked)
+    condition = COND_DOCKED;
+  else if (energy < 50 || myship.altitude < 32 || myship.cabtemp > 224)
+    condition = COND_ALERT;
+  else if (energy < 128 || myship.altitude < 64 || myship.cabtemp > 192)
+    condition = COND_RED;
+  else {
+    int i;
+    condition = COND_GREEN;
+    if (myship.altitude < 128 || myship.cabtemp >= 128)
+      condition = COND_YELLOW;
+    for (i = 0; i < MAX_UNIV_OBJECTS; i++) {
+      struct univ_object *un = &universe[i];
+      if (un->type <= 0)
+       continue;
+      if (un->flags & FLG_HOSTILE) {
+       condition = COND_RED;
+       break;
+      }
+      if (condition == COND_GREEN && 
+         un->type != SHIP_ASTEROID && un->type != SHIP_CARGO &&
+         un->type != SHIP_ALLOY && un->type != SHIP_ROCK &&
+         un->type != SHIP_BOULDER && un->type != SHIP_ESCAPE_CAPSULE &&
+         un->type != SHIP_CORIOLIS && un->type != SHIP_DODEC)
+       condition = COND_YELLOW;
+    }
+  }
+}
diff --git a/space.h b/space.h
index 1fa72b1..9cf281d 100644 (file)
--- a/space.h
+++ b/space.h
@@ -87,6 +87,8 @@ void jump_warp (void);
 void launch_player (void);
 
 void engage_docking_computer (void);
+void display_condition(void);
+void update_condition(void);
 
 #endif
 
diff --git a/swat.c b/swat.c
index e687021..d564db6 100644 (file)
--- a/swat.c
+++ b/swat.c
@@ -53,14 +53,14 @@ int ship_count[NO_OF_SHIPS + 1];  /* many */
 int initial_flags[NO_OF_SHIPS + 1] =
 {
        0,                                                                                      // NULL,
-       0,                                                                                      // missile 
+       FLG_TARGET,                                                                     // missile 
        0,                                                                                      // coriolis
        FLG_SLOW | FLG_FLY_TO_PLANET,                           // escape
-       FLG_INACTIVE,                                                           // alloy
-       FLG_INACTIVE,                                                           // cargo
-       FLG_INACTIVE,                                                           // boulder
-       FLG_INACTIVE,                                                           // asteroid
-       FLG_INACTIVE,                                                           // rock
+       FLG_INACTIVE | FLG_TARGET,                                      // alloy
+       FLG_INACTIVE | FLG_TARGET,                                      // cargo
+       FLG_INACTIVE | FLG_TARGET,                                      // boulder
+       FLG_INACTIVE | FLG_TARGET,                                      // asteroid
+       FLG_INACTIVE | FLG_TARGET,                                      // rock
        FLG_FLY_TO_PLANET | FLG_SLOW,                           // shuttle
        FLG_FLY_TO_PLANET | FLG_SLOW,                           // transporter
        0,                                                                                      // cobra3
@@ -69,20 +69,20 @@ int initial_flags[NO_OF_SHIPS + 1] =
        FLG_SLOW,                                                                       // anaconda
        FLG_SLOW,                                                                       // hermit
        FLG_BOLD | FLG_POLICE,                                          // viper
-       FLG_BOLD | FLG_ANGRY,                                           // sidewinder
-       FLG_BOLD | FLG_ANGRY,                                           // mamba
-       FLG_BOLD | FLG_ANGRY,                                           // krait
-       FLG_BOLD | FLG_ANGRY,                                           // adder
-       FLG_BOLD | FLG_ANGRY,                                           // gecko
-       FLG_BOLD | FLG_ANGRY,                                           // cobra1
-       FLG_SLOW | FLG_ANGRY,                                           // worm
-       FLG_BOLD | FLG_ANGRY,                                           // cobra3
-       FLG_BOLD | FLG_ANGRY,                                           // asp2
-       FLG_BOLD | FLG_ANGRY,                                           // python
-       FLG_POLICE,                                                                     // fer_de_lance
-       FLG_BOLD | FLG_ANGRY,                                           // moray
-       FLG_BOLD | FLG_ANGRY,                                           // thargoid
-       FLG_ANGRY,                                                                      // thargon
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // sidewinder
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // mamba
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // krait
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // adder
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // gecko
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // cobra1
+       FLG_SLOW | FLG_ANGRY | FLG_TARGET,                      // worm
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // cobra3
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // asp2
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // python
+       FLG_POLICE,                                                                 // fer_de_lance
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // moray
+       FLG_BOLD | FLG_ANGRY | FLG_TARGET,                      // thargoid
+       FLG_ANGRY | FLG_TARGET,                                         // thargon
        FLG_ANGRY,                                                                      // constrictor
        FLG_POLICE | FLG_CLOAKED,                                       // cougar
        0                                                                                       // dodec
@@ -311,9 +311,11 @@ void make_angry (int un)
        type = universe[un].type;
        flags = universe[un].flags;
 
-       if (flags & FLG_INACTIVE)
-               return;
-       
+       if (flags & FLG_INACTIVE) {
+         universe[un].flags |= FLG_TACTICAL;
+         return;
+       }
+
        if ((type == SHIP_CORIOLIS) || (type == SHIP_DODEC))
        {
                universe[un].flags |= FLG_ANGRY;
@@ -324,7 +326,7 @@ void make_angry (int un)
        {
                universe[un].rotx = 4;
                universe[un].acceleration = 2;
-               universe[un].flags |= FLG_ANGRY;
+               universe[un].flags |= FLG_ANGRY | FLG_TACTICAL;
        }
 }
 
@@ -459,7 +461,7 @@ void fire_missile (void)
        ns = &universe[newship];
        
        ns->velocity = flight_speed * 2;
-       ns->flags = FLG_ANGRY;
+       ns->flags |= FLG_TACTICAL;
        ns->target = missile_target;
 
        if (universe[missile_target].type > SHIP_ROCK)
@@ -573,7 +575,13 @@ void missile_tactics (int un)
                        activate_ecm (0);
                        return;
                }
-       }       
+       }
+
+       if ((rand255() < 16) &&
+               (ship_count[SHIP_CORIOLIS] || ship_count[SHIP_DODEC])) {
+         activate_ecm(0);
+         return;
+       }
 
        nvec = unit_vector(&vec);
        direction = vector_dot_product (&nvec, &missile->rotmat[2]); 
@@ -678,7 +686,7 @@ void tactics (int un)
                if (rand255() > 200)
                {
                        launch_enemy (un, SHIP_SIDEWINDER + (rand255() & 3), FLG_ANGRY | FLG_HAS_ECM, 113);
-                       ship->flags |= FLG_INACTIVE;
+                       ship->flags |= FLG_INACTIVE | FLG_TARGET;
                }
 
                return;
@@ -690,7 +698,7 @@ void tactics (int un)
 
        if ((type == SHIP_THARGLET) && (ship_count[SHIP_THARGOID] == 0))
        {
-               ship->flags = 0;
+               ship->flags &= FLG_TARGET | FLG_TACTICAL;
                ship->velocity /= 2;
                return;
        }
@@ -765,11 +773,13 @@ void tactics (int un)
                        (ship->missiles >= (rand255() & 31)))
                {
                        ship->missiles--;
+                       ship->flags |= FLG_TACTICAL;
                        if (type == SHIP_THARGOID)
                                launch_enemy (un, SHIP_THARGLET, FLG_ANGRY, ship->bravery);
                        else
                        {
                                launch_enemy (un, SHIP_MISSILE, FLG_ANGRY, 126);
+                               ship->flags |= FLG_HOSTILE;
                                info_message ("INCOMING MISSILE");
                        }
                        return;
@@ -783,7 +793,7 @@ void tactics (int un)
                 (ship_list[type]->laser_strength != 0))
        {
                if (direction <= -0.917)
-                       ship->flags |= FLG_FIRING | FLG_HOSTILE;                
+                       ship->flags |= FLG_FIRING | FLG_HOSTILE | FLG_TACTICAL;         
 
                if (direction <= -0.972)
                {
@@ -986,11 +996,13 @@ void create_thargoid (void)
        newship = create_other_ship (SHIP_THARGOID);
        if (newship != -1)
        {
-               universe[newship].flags = FLG_ANGRY | FLG_HAS_ECM;
+               universe[newship].flags = FLG_ANGRY | FLG_HAS_ECM | FLG_TARGET;
                universe[newship].bravery = 113;
 
                if (rand255() > 64)
-                       launch_enemy (newship, SHIP_THARGLET, FLG_ANGRY | FLG_HAS_ECM, 96);
+                       launch_enemy (newship, SHIP_THARGLET, FLG_ANGRY | FLG_HAS_ECM,
+                                                 96);
+               in_battle = 1;
        }       
 }
 
@@ -1036,8 +1048,8 @@ void create_trader (void)
                if (rnd & 1)
                        universe[newship].flags |= FLG_HAS_ECM;
 
-//             if (rnd & 2)
-//                     universe[newship].flags |= FLG_ANGRY
+               if (rnd > 200)
+                       universe[newship].flags |= FLG_ANGRY | FLG_TARGET
        }
 }
 
@@ -1064,12 +1076,24 @@ void create_lone_hunter (void)
 
        if (newship != -1)
        {
-               universe[newship].flags = FLG_ANGRY;
+               // universe[newship].flags = FLG_ANGRY;
                if ((rand255() > 200) || (type == SHIP_CONSTRICTOR))
                        universe[newship].flags |= FLG_HAS_ECM;
                
                universe[newship].bravery = ((rand255() * 2) | 64) & 127;
-               in_battle = 1;  
+               if (type == SHIP_FER_DE_LANCE) {
+                 if (rand255() > 160)
+                       universe[newship].flags |= FLG_ANGRY | FLG_TARGET;
+                 else {
+                       universe[newship].rotmat[2].z = -1.0;
+                       universe[newship].rotz = rand255() & 7;         
+                       rnd = rand255();
+                       universe[newship].velocity = (rnd & 31) | 16;
+                 }
+               }
+                       
+               if (universe[newship].flags & FLG_ANGRY)
+                 in_battle = 1;  
        }       
 }
 
@@ -1121,7 +1145,7 @@ void check_for_cops (void)
        
        if (newship != -1)
        {
-               universe[newship].flags = FLG_ANGRY;
+               universe[newship].flags |= FLG_ANGRY;
                if (rand255() > 245)
                        universe[newship].flags |= FLG_HAS_ECM;
                
@@ -1173,7 +1197,7 @@ void check_for_others (void)
                newship = add_new_ship (type, x, y, z, rotmat, 0, 0);
                if (newship != -1)
                {
-                       universe[newship].flags = FLG_ANGRY;
+                       universe[newship].flags |= FLG_ANGRY | FLG_TARGET;
                        if (rand255() > 245)
                                universe[newship].flags |= FLG_HAS_ECM;
                
index 1ea06a3..43a9da2 100644 (file)
--- a/threed.c
+++ b/threed.c
@@ -38,6 +38,38 @@ static unsigned char landscape[LAND_X_MAX+1][LAND_Y_MAX+1];
 
 static struct point point_list[100];
 
+static void identify_ship(struct univ_object *univ)
+{
+  char buf[64];
+  int lasv;
+
+  lasv = ship_list[univ->type]->front_laser;
+  if (!(univ->flags & FLG_TACTICAL)) {
+#ifdef HACKING
+    unsigned flags = univ->flags;
+    sprintf(buf, "%s %s%s%s%s", ship_list[univ->type]->name,
+           (flags & FLG_ANGRY) ? "A" : "",
+           (flags & FLG_TARGET) ? "T" : "",
+           (flags & FLG_HOSTILE) ? "H" : "",
+           (flags & FLG_POLICE) ? "P" : "");
+#else
+    sprintf(buf, "%s", ship_list[univ->type]->name);
+#endif
+  } else {
+#ifdef HACKING
+    unsigned flags = univ->flags;
+    sprintf(buf, "%s (%d) %s%s%s%s", ship_list[univ->type]->name,
+           univ->energy,
+           (flags & FLG_ANGRY) ? "A" : "",
+           (flags & FLG_TARGET) ? "T" : "",
+           (flags & FLG_HOSTILE) ? "H" : "",
+           (flags & FLG_POLICE) ? "P" : "");
+#else
+    sprintf(buf, "%s (%d)", ship_list[univ->type]->name, univ->energy);
+#endif
+  }
+  gfx_display_text(point_list[lasv].x + 4, point_list[lasv].y + 4, buf);
+}
 
 /*
  * The following routine is used to draw a wireframe represtation of a ship.
@@ -154,6 +186,9 @@ void draw_wireframe_ship (struct univ_object *univ)
                gfx_draw_line (point_list[lasv].x, point_list[lasv].y,
                                           univ->location.x > 0 ? 0 : 511, rand255() * 2);
        }
+
+       if (identify)
+         identify_ship(univ);
 }
 
 
@@ -331,6 +366,9 @@ void draw_solid_ship (struct univ_object *univ)
                                                 univ->location.x > 0 ? 0 : 511, rand255() * 2,
                                                 point_list[lasv].z, col);
        }
+
+       if (identify)
+         identify_ship(univ);
 }
 
 
diff --git a/trade.c b/trade.c
index 86c6863..5f8ac9e 100644 (file)
--- a/trade.c
+++ b/trade.c
@@ -162,6 +162,7 @@ void scoop_item (int un)
        if ((cmdr.fuel_scoop == 0) || (universe[un].location.y >= 0) ||
                (total_cargo() == cmdr.cargo_capacity))
        {
+               universe[un].flags |= FLG_TARGET;
                explode_object (un);
                damage_ship (128 + (universe[un].energy / 2), universe[un].location.z > 0);
                return;