Beispiel #1
0
void deinitialise_hind_mfd (void)
{
	// reset texture coordinates
	if (upper_left_texture_uv)
	{
		upper_left_texture_uv->u = 0.0;
		upper_left_texture_uv->v = 0.0;
	}
	if (upper_right_texture_uv)
	{
		upper_right_texture_uv->u = 1.0;
		upper_right_texture_uv->v = 0.0;
	}
	if (lower_left_texture_uv)
	{
		lower_left_texture_uv->u = 0.0;
		lower_left_texture_uv->v = 1.0;
	}
	if (lower_right_texture_uv)
	{
		lower_right_texture_uv->u = 1.0;
		lower_right_texture_uv->v = 1.0;
	}

	destroy_2d_environment (mfd_env);

	destroy_screen (mfd_texture_screen);
	destroy_screen (eo_texture_screen);

//	destroy_screen (overlaid_mfd_texture_screen);
}
Beispiel #2
0
void deinitialise_default_virtual_cockpit_wiper_and_rain_effect (void)
{
	destruct_3d_object (virtual_cockpit_wiper_inst3d);

	destruct_3d_object (virtual_cockpit_rain_effect_inst3d);

	destroy_screen (pilot_wiped_rain_texture_screen);

	destroy_screen (co_pilot_wiped_rain_texture_screen);
}
Beispiel #3
0
void	power_off(int signal)
{
  if (signal != 0 && gl_info.mode_gfx == 1)
    my_putstr("\nHit escape key for exit\n");
  else
    {
      (void)signal;
      my_putstr("\nDestroy thread...\n");
#ifdef __SDL__
      if (gl_info.mode_gfx == 1)
	{
	  destroy_surface(gl_info.gfx.status);
	  destroy_surface(gl_info.gfx.character);
	  destroy_surface(gl_info.gfx.backdrop);
	  destroy_surface(gl_info.gfx.video);
	  destroy_screen();
	}
#endif /* !__SDL__ */
      gl_info.end = 1;
      free(gl_info.stick);
      free(gl_info.status);
      free(gl_info.hp);
      free(gl_info.threads);
      my_putstr(PWR_OFF_MESG);
      exit(0);
    }
}
Beispiel #4
0
void deinitialise_default_lamp_screen (void)
{
	destroy_2d_environment (lamp1_env);

	destroy_screen (lamp1_texture_screen);

//	destroy_screen (lamp1_overlaid_texture_screen);
}
Beispiel #5
0
static void
exit_error(const char* where, int err_no)
{
  destroy_screen();

  const char* what = strerror(err_no);

  fprintf(stderr, "%s: %s\n", where, (what) ? what : "unknown error");
  exit(1);
}
Beispiel #6
0
void deinitialise_havoc_virtual_cockpit_wiper_and_rain_effect (void)
{
	destruct_3d_object (virtual_cockpit_wiper_arm_inst3d);

	destruct_3d_object (virtual_cockpit_wiper_rod_inst3d);

	destruct_3d_object (virtual_cockpit_large_hud_wiper_arm_inst3d);

	destruct_3d_object (virtual_cockpit_large_hud_wiper_rod_inst3d);

	destruct_3d_object (virtual_cockpit_rain_effect_inst3d);

	destruct_3d_object (virtual_cockpit_large_hud_rain_effect_inst3d);

	destroy_screen (pilot_wiped_rain_texture_screen);
}
Beispiel #7
0
void deinitialise_hind_hud (void)
{
	destroy_2d_environment (hud_env);

	destroy_screen (hud_texture_screen);

	if (hud_texture_uv_coordinates)
	{
		// copy back original coordinates
		size_t mem_size = 6 * sizeof(object_3d_short_textured_point);
		memcpy(hud_display_model->surface_texture_points, hud_texture_uv_coordinates, mem_size);

		safe_free(hud_texture_uv_coordinates);
		hud_texture_uv_coordinates = NULL;
	}
}
Beispiel #8
0
int
main(int argc, char** argv)
{
  const char* portname = "/dev/ttyS0";
  int         c;

  while ((c = getopt(argc, argv, "p:?")) != -1)
    switch (c)
    {
      case 'p': portname = optarg; break;
      case '?': exit_usage();
      default:  abort();
    }

  if (optind < argc)
    exit_usage();

  setlocale(LC_ALL, "");
  init_screen();

  int portfd = open(portname, O_RDWR | O_NOCTTY | O_NONBLOCK);
  if (portfd < 0)
    exit_error(portname, errno);

  init_serial_port(portfd, portname);

  int flags = fcntl(portfd, F_GETFL, 0);
  if (flags < 0 || fcntl(portfd, F_SETFL, flags & ~O_NONBLOCK) < 0)
    exit_error(portname, errno);

  wprintw(win_header, "Using serial port %s.\nPress CTRL-D to quit.", portname);
  waddch(win_prompt, '>');
  wnoutrefresh(win_header);
  wnoutrefresh(win_prompt);
  wnoutrefresh(win_input);
  doupdate();

  input_loop(portfd);

  while (close(portfd) < 0)
    if (errno != EINTR)
      exit_error(portname, errno);

  destroy_screen();
  return 0;
}
Beispiel #9
0
static void
init_serial_port(int portfd, const char* portname)
{
  struct termios portattr;

  if (tcgetattr(portfd, &portattr) < 0)
    exit_error(portname, errno);

  portattr.c_iflag &= ~(BRKINT | ISTRIP | INLCR | ICRNL | IXON | IXOFF);
  portattr.c_iflag |= INPCK | IGNBRK | IGNPAR | PARMRK | IGNCR;

  portattr.c_oflag &= ~(OPOST | OCRNL | OFILL);

  portattr.c_cflag &= ~(CSIZE | CSTOPB | PARENB);
  portattr.c_cflag |= CLOCAL | CREAD | CS8 | HUPCL | CRTSCTS; /* not in POSIX */

  portattr.c_lflag &= ~(ICANON | IEXTEN | ISIG | ECHO | NOFLSH | TOSTOP);

  portattr.c_cc[VINTR] = 3;
  portattr.c_cc[VMIN]  = 1;
  portattr.c_cc[VTIME] = 0;

  cfsetispeed(&portattr, BAUDRATE_KEYBOARD);
  cfsetospeed(&portattr, BAUDRATE_KEYBOARD);

  if (tcsetattr(portfd, TCSAFLUSH, &portattr) < 0
      || tcgetattr(portfd, &portattr) < 0)
    exit_error(portname, errno);

  if ((portattr.c_cflag & (CSIZE | CSTOPB | PARENB | CRTSCTS)) != (CS8 | CRTSCTS)
      || cfgetispeed(&portattr) != BAUDRATE_KEYBOARD
      || cfgetospeed(&portattr) != BAUDRATE_KEYBOARD)
  {
    destroy_screen();
    fprintf(stderr, "%s: serial port configuration not supported\n", portname);
    exit(1);
  }
}
Beispiel #10
0
static void
input_loop(int portfd)
{
  if (portfd >= FD_SETSIZE)
  {
    destroy_screen();
    fputs("File descriptor too large\n", stderr);
    exit(1);
  }

  for (;;)
  {
    fd_set fds;

    FD_ZERO(&fds);
    FD_SET(STDIN_FILENO, &fds);
    FD_SET(portfd, &fds);

    int rc = select(portfd + 1, &fds, 0, 0, 0);
    if (rc <= 0)
    {
      if (rc < 0 && errno != EINTR)
        exit_error("select", errno);
      continue;
    }

    if (FD_ISSET(portfd, &fds))
      receive_kctext(portfd, win_output);

    if (FD_ISSET(STDIN_FILENO, &fds)
        && handle_key_input(portfd, win_input))
      break;

    wnoutrefresh(win_input);
    doupdate();
  }
}
Beispiel #11
0
static void
init_screen(void)
{
  initscr();
  nonl();
  raw();
  noecho();
  intrflush(stdscr, FALSE);
  wnoutrefresh(stdscr);

  if (!(win_header = newwin(2, 0, 0, 0)) ||
      !(win_prompt = newwin(1, 2, 3, 0)) ||
      !(win_input  = newwin(1, 0, 3, 2)) ||
      !(win_output = newwin(0, 0, 5, 0)))
  {
    destroy_screen();
    fputs("Failed to configure terminal screen\n", stderr);
    exit(1);
  }

  keypad(win_input, TRUE);
  idlok(win_output, TRUE);
  scrollok(win_output, TRUE);
}
Beispiel #12
0
void deinitialise_common_crew_skins (void)
{
	destroy_screen (us_pilot_high_detail_face);
	destroy_screen (us_pilot_low_detail_face);
	destroy_screen (us_pilot_neck);
	destroy_screen (us_pilot_hands);
	destroy_screen (us_co_pilot_high_detail_face);
	destroy_screen (us_co_pilot_low_detail_face);
	destroy_screen (us_co_pilot_neck);
	destroy_screen (us_co_pilot_hands);

	destroy_screen (russian_pilot_high_detail_face);
	destroy_screen (russian_pilot_low_detail_face);
	destroy_screen (russian_pilot_neck);
	destroy_screen (russian_pilot_hands);
	destroy_screen (russian_co_pilot_high_detail_face);
	destroy_screen (russian_co_pilot_low_detail_face);
	destroy_screen (russian_co_pilot_neck);
	destroy_screen (russian_co_pilot_hands);
}
Beispiel #13
0
void deinitialise_ka50_virtual_cockpit_wiper_and_rain_effect (void)
{
    destroy_screen (pilot_wiped_rain_texture_screen);
}
Beispiel #14
0
void deinitialise_altitude_counter(void)
{
	destroy_screen(altitude_counter_screen);	
}
Beispiel #15
0
void deinitialise_apache_upfront_display (void)
{
	destroy_screen (texture_screen);
}
Beispiel #16
0
static void destroy_area_ui_object (ui_object *obj)
{

   ui_object
		*parent,
		*next,
		*prev,
      *succ,
      *pred,
      *stack_next,
      *stack_prev;

   area_ui_object
		*parent_area,
      *area;

   ////////////////////////////////////////
   //
   // REMOVE FROM SYSTEM
   //
   ////////////////////////////////////////

   ////////////////////////////////////////
   //
   // FREE UI_OBJECT DATA
   //
   ////////////////////////////////////////

   area = (area_ui_object*) obj->data;

	// sort out parent

	parent = area->parent;

	if (parent)
	{

		parent_area = (area_ui_object *) parent->data;
	
		if (parent_area->child == obj)
		{
	
			if (area->next)
			{
	
				parent_area->child = area->next;
			}
			else
			{
	
				parent_area->child = NULL;
			}
		}
	}

	// do entity header
	
	stack_next = obj->stack_next;

	stack_prev = obj->stack_prev;

   succ = obj->succ;

   pred = obj->pred;

   if (succ)
   {

      if (pred)
      {

         succ->pred = pred;
   
         pred->succ = succ;
      }
      else
      {

         succ->pred = NULL;
      }
   }
   else
   {

      if (pred)
      {

         pred->succ = NULL;
      }
   }

   if (stack_next)
   {

      if (stack_prev)
      {

         stack_next->stack_prev = stack_prev;
   
         stack_prev->stack_next = stack_next;
      }
      else
      {

         stack_next->stack_prev = NULL;
      }
   }
   else
   {

      if (stack_prev)
      {

         pred->stack_next = NULL;
      }
   }

	// do area pointers

   next = area->next;
   prev = area->prev;

   if (next)
   {

      if (prev)
      {

         set_ui_object_prev (next, prev);
   
         set_ui_object_next (prev, next);
      }
      else
      {

         set_ui_object_prev (next, NULL);
      }
   }
   else
   {

      if (prev)
      {

         set_ui_object_next (prev, NULL);
      }
   }

	if (area->child)
	{

		destroy_ui_object (area->child);
	}

   // free text

   if (area->text)
   {

      safe_free (area->text);
   }

   if (area->tool_tips)
   {

      safe_free (area->tool_tips);
   }

	// free memory graphic

   if (get_ui_object_graphic_type (obj) == UI_OBJECT_MEMORY_GRAPHIC)
   {

      destroy_screen (area->memory_graphic);
   }

   // free ui_object

   safe_free (obj->data);

	decrease_ui_object_counter ();
}