示例#1
0
void display_message (int message, int lives, int level, int score)
{
  char text [80];
  int height = MAX_SCR_MESSAGE_Y;
  int y1 = (MAX_SCR_ROWS - height) / 2 - MSG_BORDER_Y;

  if ((message == MSG_FLOOR) || (message == MSG_COLLISION) || (message == MSG_FIRE) || (message == MSG_WATER))
    {
      if (lives == 0)
	draw_message (MAX_SCR_GAMEOVER_X, gameover);
      else
	draw_message (MAX_SCR_CRASH_X, crash);
      sprintf (text, "Caused by %s", crash_messages [message]);
      ansi_SetAttr (ATTR_reverse);
      centre_text (text, y1 + MAX_SCR_MESSAGE_Y + 2 * MSG_BORDER_Y, MAX_SCR_COLS);
      centre_text ("Press <5> <Enter> or <Space>", y1 + MAX_SCR_MESSAGE_Y + 2 * MSG_BORDER_Y + 1, MAX_SCR_COLS);
      centre_text ("to continue....", y1 + MAX_SCR_MESSAGE_Y + 2 * MSG_BORDER_Y + 2, MAX_SCR_COLS); 
      ansi_Position (1, MAX_SCR_ROWS);
      ansi_printf (" Game Info  -  Score: [%6d]  Lives Remaining: [%2d]  Next Level: [%2d]    ", score, lives, level);
      ansi_SetAttr (ATTR_normal);
    }
  else if (message == MSG_WINLEVEL)
    draw_message (MAX_SCR_WINLEVEL_X, winlevel);
  wait_for_select ();
}
示例#2
0
void options_bottom_title( void )
{
	char temp[60];

	DISCARD_EOL

	sprintf(temp,"^v<> TO MOVE, <> or %s to TOGGLE",prog_defaults.toggle_key_text);
	centre_text(temp,line_buffer,prog_defaults.columns,' ');
	AT(bottom_title_row,0)
	REVERSE_VIDEO
	printf("%s",line_buffer);
	NORMAL_VIDEO

	centre_text("RETURN to Select",line_buffer,prog_defaults.columns,' ');
	AT(bottom_title_row+1,0)
	REVERSE_VIDEO
	printf("%s",line_buffer);
	NORMAL_VIDEO

	WRAP_EOL
}
示例#3
0
void edit_bottom_title( void )
{
	
	char temp[80];

	DISCARD_EOL

	sprintf( temp,	"CURSOR-<>, INSERT/OVERWRITE-INSERT");
	AT(bottom_title_row,0)
	REVERSE_VIDEO
	centre_text(temp,line_buffer,prog_defaults.columns,' ');
	printf("%s",line_buffer);


	sprintf( temp,"ABORT EDIT-ESC, ACCEPT EDIT-RETURN");
	AT(bottom_title_row+1,0)
	REVERSE_VIDEO
	centre_text(temp,line_buffer,prog_defaults.columns,' ');
	printf("%s",line_buffer);

	NORMAL_VIDEO
	WRAP_EOL
}
示例#4
0
int main (void)
#endif // __ANDROID__
{
  char version_string [80];

  /* We need to install a handler for SIGSEGV and friends so rowan and his
     friends can't drop a core file! */

  signal (SIGSEGV, signal_handler);
  signal (SIGBUS, signal_handler);
  signal (SIGQUIT, signal_handler);

  store_term_default ();
  set_term_raw ();

#ifndef __ANDROID__
  log_usage ();
#endif
  init_level_maps ();

  draw_frame ();
  put_screen (intro_pixmap);
  
  sprintf (version_string, "Version %s - %s %d, %d", GLIDER_VERSION, GLIDER_MONTHSTR, GLIDER_DAY, GLIDER_YEAR);
  centre_text (version_string, 12, MAX_SCR_COLS);
  
  park_cursor ();
  wait_for_key ();
  put_screen (notes_0);
  park_cursor ();
  wait_for_key ();
  put_screen (notes_1);
  park_cursor ();
  wait_for_key ();
  put_screen (notes_2);
  park_cursor ();
  wait_for_key ();

  menu ();

  ansi_Position (1, 1);
  ansi_ClearScreen ();
  set_term_default ();

  return (0); /* Exit cleanly */
}
SET *create_set( void )
{
/*	long k;*/
	SET *new_set;

	new_set=(SET *)malloc(sizeof(SET));

	if(new_set==NULL)
	{
		AT(0,0)
		REVERSE_VIDEO
		centre_text(" ERROR: NOT ENOUGH MEMORY FOR A NEW SET ",line_buffer,prog_defaults.columns,' ');
		printf("%s",line_buffer);
		NORMAL_VIDEO
/*		AT(bottom_title_row+1,0)
		REVERSE_VIDEO
		centre_text(" PRESS ANY KEY ",line_buffer,prog_defaults.columns,' ');
		printf("%s",line_buffer);
		NORMAL_VIDEO	
		while(!Bconstat(2))
			;
		Bconin(2);*/
		return NULL;
	}
示例#6
0
void options_screen()
{

	/* options are */
	/*		17 Lines			-7 -1025

		0 New Progs			 ON    OFF   SAME
		1 New Accs			 ON	 OFF   SAME

		2 Auto Window		PAGING	SCROLLING
		3 Accs Window		PAGING	SCROLLING
		4 Sets Window		PAGING	SCROLLING		
		5 Other Window		PAGING	SCROLLING		

		6 Auto Path   
		 --------------------------------------

		7 Accs Path 
		 --------------------------------------					 
	
		8 <Set Keys>				9 <Resolution Info>

		10	[   OK   ]   11[ CANCEL ]   12[ SAVE ]

	*/

#define MAX_OPTIONS	12

int options_y, options_x, curr_option, old_option, exit_options;
long key; int upk,lowk;
/*char temp[60];
*/
/* local defaults */
	int lnew_progs_flag;	/* 1 = ON, 2 = OFF, 3 = SAME */
	int lnew_accs_flag;
	int lauto_paging;		/* 1 = paging, 2 = scrolling */
	int laccs_paging;
	int lsets_paging;
	int lother_paging;
	char lauto_path[FILENAME_MAX];
	char laccs_path[FILENAME_MAX];

	curr_option=0;
	old_option=11;

	lnew_progs_flag=prog_defaults.new_progs_flag;
	lnew_accs_flag=prog_defaults.new_accs_flag;
	lauto_paging=prog_defaults.auto_paging;		
	laccs_paging=prog_defaults.accs_paging;
	lsets_paging=prog_defaults.sets_paging;
	lother_paging=prog_defaults.other_paging;
	strcpy(lauto_path,prog_defaults.auto_path);
	strcpy(laccs_path,prog_defaults.accs_path);

	options_y=prog_defaults.rows-3-17+1;
	if(options_y>0)
		options_y=options_y/2;
	else
		options_y=1;

	options_x=prog_defaults.columns-40;
	if(options_x>0)
		options_x=options_x/2;
	else
		options_x=0;

	CLEAR_SCREEN

	centre_text("OPTIONS",line_buffer,prog_defaults.columns,' ');
	
	DISCARD_EOL
	AT(title_row,0)
	REVERSE_VIDEO
	printf("%s",line_buffer);
	NORMAL_VIDEO

	options_bottom_title();

	AT(options_y,options_x+1)
	printf("New Progs");
	print_on_off_same(options_y,options_x+1,lnew_progs_flag);
	AT(options_y+1,options_x+1)
	printf("New Accs");
	print_on_off_same(options_y+1,options_x+1,lnew_accs_flag);

	AT(options_y+3,options_x+1)
	printf("Auto Window");
	print_paging_scrolling(options_y+3,options_x+1,lauto_paging);
	AT(options_y+4,options_x+1)
	printf("Accs Window");
	print_paging_scrolling(options_y+4,options_x+1,laccs_paging);
	AT(options_y+5,options_x+1)
	printf("Sets Window");
	print_paging_scrolling(options_y+5,options_x+1,lsets_paging);
	AT(options_y+6,options_x+1)
	printf("Other Window");
	print_paging_scrolling(options_y+6,options_x+1,lother_paging);

	remove_extension(lauto_path);
	AT(options_y+8,options_x+1)
	printf("Auto Path");
/*	AT(options_y+9,options_x+1)
	printf("--------------------------------------");
*/	AT(options_y+9,options_x+1)
	printf("%s",lauto_path);

	remove_extension(laccs_path);
	AT(options_y+11,options_x+1)
	printf("Accs Path");
/*	AT(options_y+12,options_x+1)
	printf("--------------------------------------");
*/	AT(options_y+12,options_x+1)
	printf("%s",laccs_path);

	AT(options_y+14,options_x+1)
	printf("<Set Keys>");

	AT(options_y+14,options_x+22)
	printf("<Resolution Info>");
	
	AT(options_y+16,options_x+3)
	printf("[   OK   ]");

	AT(options_y+16,options_x+15)
	printf("[ CANCEL ]");

	AT(options_y+16,options_x+27)
	printf("[  SAVE  ]");

	upk=0;lowk=0;exit_options=0;
	print_option(options_y,options_x,old_option, curr_option);

	while(exit_options==0)
	{
			while(!Bconstat(2))
			;

			key=Bconin(2);
			upk=(int)(key>>16);
			lowk=(int)(key%256);

			if(upk==0x48 )	/* up arrow */
			{
				old_option=curr_option;
				switch(curr_option)
				{
				case 11:
				case 10:
						curr_option=8;
						break;
				case 12:
						curr_option=9;
						break;
				case 9:
						curr_option=7;
						break;
				default:
						curr_option=curr_option-1;
						break;
				}

				if(curr_option<0)
					curr_option=MAX_OPTIONS;
				print_option(options_y,options_x,old_option, curr_option);
			}
			else
			{
			if(upk==0x50)	/* down arrow */
				{
					old_option=curr_option;

					switch(curr_option)
					{
					case 8: 
							curr_option=10;
							break;
					case 9:
							curr_option =12;
							break;
					case 10:
					case 11:
					case 12:
							curr_option=0;
							break;		
					default:
							curr_option=curr_option+1;
							break;
					}
					if(curr_option>MAX_OPTIONS)
						curr_option=0;
					print_option(options_y,options_x,old_option, curr_option);
				}	
				else
				{	
					if(upk==0x4D)	/* right arrow */
					{
					old_option=curr_option;

						switch(curr_option)
						{
						case 0:
								lnew_progs_flag++;
								if(lnew_progs_flag>3)
									lnew_progs_flag=1;
								print_on_off_same(options_y,options_x+1,lnew_progs_flag);
								break;
						case 1:
								lnew_accs_flag++;
								if(lnew_accs_flag>3)
									lnew_accs_flag=1;
								print_on_off_same(options_y+1,options_x+1,lnew_accs_flag);
								break;
						case 2:
								lauto_paging++;
								if(lauto_paging>SCROLLING)
									lauto_paging=PAGING;
								print_paging_scrolling(options_y+3,options_x+1,lauto_paging);
								break;
						case 3:
								laccs_paging++;
								if(laccs_paging>SCROLLING)
									laccs_paging=PAGING;
								print_paging_scrolling(options_y+4,options_x+1,laccs_paging);
								break;
						case 4:
								lsets_paging++;
								if(lsets_paging>SCROLLING)
									lsets_paging=PAGING;
								print_paging_scrolling(options_y+5,options_x+1,lsets_paging);
								break;
						case 5:
								lother_paging++;
								if(lother_paging>SCROLLING)
									lother_paging=PAGING;
								print_paging_scrolling(options_y+6,options_x+1,lother_paging);
								break;

						case 8:
						case 10:
						case 11:
								curr_option++;
								break;
						}
						if(curr_option>MAX_OPTIONS)
							curr_option=0;
						print_option(options_y,options_x,old_option, curr_option);
					}	
					else
						{
							if(upk==0x4B)	/* left arrow */
							{
								old_option=curr_option;

								switch(curr_option)
								{
								case 0:
										lnew_progs_flag--;
										if(lnew_progs_flag<1)
											lnew_progs_flag=3;
										print_on_off_same(options_y,options_x+1,lnew_progs_flag);
										break;
								case 1:
										lnew_accs_flag--;
										if(lnew_accs_flag<1)
											lnew_accs_flag=3;
										print_on_off_same(options_y+1,options_x+1,lnew_accs_flag);
										break;
								case 2:
										lauto_paging--;
										if(lauto_paging<PAGING)
											lauto_paging=SCROLLING;
										print_paging_scrolling(options_y+3,options_x+1,lauto_paging);
										break;
								case 3:
										laccs_paging--;
										if(laccs_paging<PAGING)
											laccs_paging=SCROLLING;
										print_paging_scrolling(options_y+4,options_x+1,laccs_paging);
										break;
								case 4:
										lsets_paging--;
										if(lsets_paging<PAGING)
											lsets_paging=SCROLLING;
										print_paging_scrolling(options_y+5,options_x+1,lsets_paging);
										break;
								case 5:
										lother_paging--;
										if(lother_paging<PAGING)
											lother_paging=SCROLLING;
										print_paging_scrolling(options_y+6,options_x+1,lother_paging);
										break;
								case 9:
								case 11:
								case 12:
								curr_option--;
								break;
								}
								if(curr_option<0)
									curr_option=MAX_OPTIONS;
								print_option(options_y,options_x,old_option, curr_option);
							}
							else
							{
							if(upk==0x1C) /* return */
							{
								switch(curr_option)
								{
								case 6:
										edit_at(options_y+9,options_x+1,FILENAME_MAX,37,lauto_path,'-',0,valid_filename_char,1);
										options_bottom_title();
										break;
								case 7:
										edit_at(options_y+12,options_x+1,FILENAME_MAX,37,laccs_path,'-',0,valid_filename_char,1);
										options_bottom_title();
										break;
								case 8:
										/* set keys */
										break;
								case 9:
										/* set res stuff */
										break;
								case 10:
										/* set defaults */
										prog_defaults.new_progs_flag=lnew_progs_flag;
										prog_defaults.new_accs_flag=lnew_accs_flag;
										prog_defaults.auto_paging=lauto_paging;		
										prog_defaults.accs_paging=laccs_paging;
										prog_defaults.sets_paging=lsets_paging;
										prog_defaults.other_paging=lother_paging;
										strcpy(prog_defaults.auto_path,lauto_path);
										strcpy(prog_defaults.accs_path,laccs_path);
										exit_options=1;	
										break;
								case 11:
										exit_options=1;	
										break;
								case 12:
										/* save defaults */
										break;
								}
							}
							else
							{
								if(upk==prog_defaults.toggle_key_high)
								{
									switch(curr_option)
									{
									case 0:
										lnew_progs_flag++;
										if(lnew_progs_flag>3)
											lnew_progs_flag=1;
										print_on_off_same(options_y,options_x+1,lnew_progs_flag);
										break;
									case 1:
											lnew_accs_flag++;
											if(lnew_accs_flag>3)
											lnew_accs_flag=1;
											print_on_off_same(options_y+1,options_x+1,lnew_accs_flag);
											break;
									case 2:
											lauto_paging++;
											if(lauto_paging>SCROLLING)
												lauto_paging=PAGING;
											print_paging_scrolling(options_y+3,options_x+1,lauto_paging);
											break;
									case 3:
											laccs_paging++;
											if(laccs_paging>SCROLLING)
												laccs_paging=PAGING;
											print_paging_scrolling(options_y+4,options_x+1,laccs_paging);
											break;
									case 4:
											lsets_paging++;
											if(lsets_paging>SCROLLING)
												lsets_paging=PAGING;
											print_paging_scrolling(options_y+5,options_x+1,lsets_paging);
											break;
									case 5:
											lother_paging++;
											if(lother_paging>SCROLLING)
												lother_paging=PAGING;
											print_paging_scrolling(options_y+6,options_x+1,lother_paging);
											break;
									}
								}
							}

							}	
						}				
				}
			}

	}

}