Exemplo n.º 1
0
void far customer_id()
{
int i,a_color;
long a_delay;



/* turn off cursor */
	my_input_regs.h.ah = 1;
	my_input_regs.x.cx = 0x2000;

	int86(0x10,&my_input_regs,&my_output_regs);


	_settextcolor(2);
	_settextposition(23,26);
	_outtext("Press Any Key...");


	for(a_color = 1 ; kbhit() == 0 ; a_color++)
	{
		if(a_color > 15)
			a_color = 1;


		_settextcolor(a_color);


	
		for(i = 0 ; i < 11 ; i++)
		{
			_settextposition(i + 7,26);
			_outtext(release_info[i]);
		}
	

		for(a_delay = 0L ; a_delay < 50000L ; a_delay = a_delay + 1L)
			;
	}




/* turn on cursor */
	my_input_regs.h.ah = 1;
	my_input_regs.h.ch = 6;
	my_input_regs.h.cl = 7;

	int86(0x10,&my_input_regs,&my_output_regs);
}
Exemplo n.º 2
0
void main()
{
  _clearscreen(0);
  for (i=0; i<8; i++)
  {
    _settextcolor(i);
    _outtext("FARBTEST!\n");
  }
  _settextwindow(1,10,25,80);
  for (i=8; i<16; i++)
  {
    _settextcolor(i);
    _outtext("FARBTEST!\n");
  }
}
Exemplo n.º 3
0
void displayEditRoomCheckMenu(void)
{
  char strn[4096];


  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  sprintf(strn,
"&+gEditing room checking options\n"
"\n"
"   &+YA&+L.&n &+wCheck for 'stranded' rooms/rooms with no exits in/out?    %s&n\n"
"   &+YB&+L.&n &+wCheck for missing/extraneous keys?                        %s&n\n"
"   &+YC&+L.&n &+wCheck for rooms with illegal values/no descs?             %s&n\n"
"   &+YD&+L.&n &+wCheck for exits with illegal values?                      %s&n\n"
"   &+YE&+L.&n &+wCheck for exits with no descriptions?                     %s&n\n"
"\n"
" &+YY/Z&+L.&n &+wTurn all room check options off/on\n"
"\n"
MENU_COMMON
"\n"
"%s",
             getYesNoStrn(getCheckLoneRoomVal()),
             getYesNoStrn(getCheckMissingKeysVal()),
             getYesNoStrn(getCheckRoomVal()),
             getYesNoStrn(getCheckExitVal()),
             getYesNoStrn(getCheckExitDescVal()),

             getMenuPromptName());

  displayColorString(strn);
}
void Ausg_Punkt_Inv(char nr,char maxbr,char *basisadr,char x,char y)
{
   char memstr[40];
   short oldtxtcol=_gettextcolor();
   long  oldbkcol =_getbkcolor();

   _settextposition(y,x);
   strcpy(memstr,basisadr+nr*maxbr);
   _settextcolor((short)oldbkcol); /*0*/
   _setbkcolor((long)oldtxtcol);	/*15*/
   /* TM_Prot(); */
   _outtext(memstr);
   /* TM_Prot(); */
   _settextcolor(oldtxtcol);
   _setbkcolor(oldbkcol);
}
Exemplo n.º 5
0
main(int argc, char **argv)
{
     int color;
     char outtext_string[MAX_LINE_LENGTH];

     for (color=0; color<=15; color++)
     {
          _settextcolor(color);
          sprintf(outtext_string, "%s", BANNER);
          _outtext(outtext_string);
          _settextcolor(7);
          sprintf(outtext_string, "%s", COPYRIGHT);
          _outtext(outtext_string);
          sprintf(outtext_string, "\n");
          _outtext(outtext_string);
     }
     fprintf(stdout, "done.");
}
Exemplo n.º 6
0
void displayEditDisplayMenu(void)
{
  char strn[4096];


  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  sprintf(strn,
"&+gEditing display options\n"
"\n"
"   &+YA&+L.&n &+wInterpret Diku color codes?                               %s&n\n"
"   &+YB&+L.&n &+wDisplay Diku color codes?                                 %s&n\n"
"\n"
"   &+YC&+L.&n &+wShow room 'extra info' (sector type and flags)?           %s&n\n"
"   &+YD&+L.&n &+wShow room vnum after room name?                           %s&n\n"
"   &+YE&+L.&n &+wShow exit flags after exit name?                          %s&n\n"
"   &+YF&+L.&n &+wShow exit room vnum dest after exit name?                 %s&n\n"
"\n"
"   &+YG&+L.&n &+wShow object flags info before name?                       %s&n\n"
"   &+YH&+L.&n &+wShow object vnum after object name?                       %s&n\n"
"\n"
"   &+YI&+L.&n &+wShow mob flags info before name?                          %s&n\n"
"   &+YJ&+L.&n &+wShow mob default pos after name?                          %s&n\n"
"   &+YK&+L.&n &+wShow mob vnum after mob name?                             %s&n\n"
"   &+YL&+L.&n &+wShow mobs following/riding/ridden by others?              %s&n\n"
"\n"
" &+YY/Z&+L.&n &+wTurn all vnum/extra info display options off/on\n"
"\n"
MENU_COMMON
"\n"
"%s",
             getYesNoStrn(getInterpColorVal()),
             getYesNoStrn(getShowColorVal()),

             getYesNoStrn(getShowRoomExtraVal()),
             getYesNoStrn(getShowRoomVnumVal()),
             getYesNoStrn(getShowExitFlagsVal()),
             getYesNoStrn(getShowExitDestVal()),

             getYesNoStrn(getShowObjFlagsVal()),
             getYesNoStrn(getShowObjVnumVal()),

             getYesNoStrn(getShowMobFlagsVal()),
             getYesNoStrn(getShowMobPosVal()),
             getYesNoStrn(getShowMobVnumVal()),
             getYesNoStrn(getShowMobRideFollowVal()),

             getMenuPromptName());

  displayColorString(strn);
}
Exemplo n.º 7
0
void
main (void)
{
  /* reset colors, and exit */

  _settextcolor (_WHITE_);
  _setbkcolor (_BLACK_);
  _clearscreen (_GCLEARSCREEN);

  exit (0);
}
Exemplo n.º 8
0
void displayEditObjTrapInfoMenu(const dikuObject *obj)
{
  char strn[256], newName[256], *outStrn = new char[2048];


  _clearscreen(7, 0);

  if (!outStrn)
  {
    _outtext("\n\nError allocating outStrn in displayblah()...\n\n");

    return;
  }

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixObjName(obj->objShortName, newName);

  sprintf(strn, "&+gEditing trap info for obj #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
          obj->objNumber, newName);

  displayColorString(strn);

  sprintf(outStrn,
"   &+YA&+L.&n &+wTrap affect flag (0 = no trap)    %u (%s)&n\n"
"\n"
"   &+YB&+L.&n &+wTrap damage type/effect           %d (%s)&n\n"
"   &+YC&+L.&n &+wNumber of charges (-1 = infinite) %d&n\n"
"\n"
"   &+YD&+L.&n &+wTrap level                        %u&n\n"
"   &+YE&+L.&n &+wPercentage chance of setting off  %d&n\n"
"\n"
MENU_COMMON
"\n"
"%s",
                   obj->trapAff, getObjTrapAffStrn(obj->trapAff, newName),
                   obj->trapDam, getObjTrapDamStrn(obj->trapDam),
                   obj->trapCharge,
                   obj->trapLevel,
                   obj->trapPercent,

                   getMenuPromptName());

  displayColorString(outStrn);

  delete[] outStrn;
}
void ZeileAusgabe(short ip)
{

   if (ip!=0) SUBZeileAusgabe(ip-1,23);
	 else {
		_settextposition(23,1);
		_outtext("                                                                     ");
	      }
   SYS_PushColor();
   _settextcolor(2);
   SUBZeileAusgabe(ip,24);
   SYS_PopColor();
   if (ip<max_line-2) SUBZeileAusgabe(ip+1,25);
      else {
	     _settextposition(25,1);
	     _outtext("                                                                     ");
	   }
}
Exemplo n.º 10
0
void displayEditShopBooleansMenu(shop *shp, const char *mobName,
                                 const long mobNumb)
{
  char newName[256], *strn;


  strn = new char[4096];
  if (!strn)
  {
    _outtext("\n\nout of memory - cannot alloc strn in displayEditShopBooleansMenu\n\n");
    return;
  }

  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixMobName(mobName, newName);

  sprintf(strn, "&+gEditing shop toggles for mob #&+c%d&+w, &+L\"&n%s&+L\"&n\n\n",
          mobNumb, newName);

  displayColorString(strn);

  sprintf(strn,
  "   &+YA&+L.&n &+wDoes shop roam?                            %s\n"
  "   &+YB&+L.&n &+wIs shop's room NO_MAGIC?                   %s\n"
  "   &+YC&+L.&n &+wAllow shopkeeper to be killed?             %s\n"
  "\n"
  MENU_COMMON
  "\n"
  "%s", getYesNoStrn(shp->roaming),
        getYesNoStrn(shp->noMagic),
        getYesNoStrn(shp->killable),

        getMenuPromptName());

  displayColorString(strn);

  delete[] strn;
}
Exemplo n.º 11
0
void
bwx_terminate( void )
   {
#if MS_CMDS

   if ( reset_mode == TRUE )
      {

      _setvideomode( _DEFAULTMODE );

      /* Restore original foreground and background. */

      _settextcolor( oldfgd );
      _setbkcolor( oldbgd );

      }

#endif

   exit( 0 );
   }
/* Durchmesser & Laenge eingeben & umwandeln */
char Hole_DMuLNG(void)
{
  struct LE_parameter edt={NULL,"0123456789 ",36,0,0,0,0,0,0,0,0,1,0,0};
  char feld=1,ret,zw_dm[6],zw_lng[6],raus=0,zw_idm[6];

  SYS_PushColor();
  _settextcolor(10);
  _setbkcolor(4);
  TW_Open_Window(18,14,44,7, TW_RAHMEN_S1,TW_TITEL_OBEN,15,"Simulation");
  _outtext("Programmsimulation:\n��������������������\nBitte Werkst�ckdaten eingeben:\n\n");
  _outtext("Durchmesser (1/100 mm : 100 =1 mm):");
  _outtext(st_durchmesser);
  _outtext("\nL�nge       (1/100 mm)            :");
  _outtext(st_laenge);
  _outtext("\nInnendurchmesser                  :");
  _outtext(st_innendm);

  strcpy(zw_dm,st_durchmesser);
  strcpy(zw_lng,st_laenge);
  strcpy(zw_idm,st_innendm);

  do {
	/* Eing. & Test */
	SYS_CursorOn();
	/* eventl neue Werte ausgeben */
	_settextposition(5,36);
	_outtext(st_durchmesser);
	_settextposition(6,36);
	_outtext(st_laenge);

	do {
	     /* Eingabeschleife */

	     switch(feld)
	     {
	       case 1:
		{
		  edt.y=5;
		  edt.raus_oben=0;
		  edt.raus_unten=1;
		  edt.editstr=st_durchmesser;
		  ret=LE_LineEdit(&edt);
		  if (ret==LE_UNTEN_RAUS || ret==LE_OK)
		    {
		      feld=0;
		      ret=0;
		    }
		} break;
	       case 0:
		{
		  edt.y=6;
		  edt.raus_oben=1;
		  edt.raus_unten=1;
		  edt.editstr=st_laenge;
		  ret=LE_LineEdit(&edt);
		  if (ret==LE_OBEN_RAUS)
		    {
		      feld=1;
		      ret=0;
		    }
		  if (ret==LE_UNTEN_RAUS || ret==LE_OK)
		    {
		      feld=2;
		      ret=0;
		    }
		} break;
	       case 2:
		{
		  edt.y=7;
		  edt.raus_oben=1;
		  edt.raus_unten=0;
		  edt.editstr=st_innendm;
		  ret=LE_LineEdit(&edt);
		  if (ret==LE_OBEN_RAUS)
		    {
		      feld=0;
		      ret=0;
		    }
		} break;
	     } /* von switch */

	   } while (ret!=LE_ESC && ret!=LE_OK); /* Eingabeschleife */

       SYS_CursorOff();
       if (ret==LE_ESC)
	 {
	   /* bei ESC ->UNDO */
	   strcpy(st_durchmesser,zw_dm);
	   strcpy(st_laenge,zw_lng);
	   strcpy(st_innendm,zw_idm);
	   TW_Close_Window();
	   SYS_PopColor();
	   return 1;
	 }
	 else {
		/* Zahlen umwandeln & testen */
		durchm=atoi(st_durchmesser);
		idurchm=atoi(st_innendm);
		radius=(short)(durchm/2);
		laenge=atoi(st_laenge);
		sprintf(st_durchmesser,"%-05d",durchm);
		sprintf(st_innendm,"%-05d",idurchm);
		sprintf(st_laenge,"%-05d",laenge);

		raus=1;
		if (laenge<1000 || laenge>15000 || durchm>8000 || durchm<300 ||
		    idurchm>durchm-700 || (idurchm<1000 && idurchm!=0) || idurchm>10000)
		    {
		      _settextcolor(4);
		      _setbkcolor(10);
		      TW_Open_Window(10,10,45,6, TW_RAHMEN_S1,TW_NO_TITEL,0,NULL);
		      _outtext("          ***** ACHTUNG *****\n");
		      _outtext(" Grenzwerte: Durchmesser: 300 bis 8000\n");
		      _outtext("                         (3 mm - 50 mm)\n");
		      _outtext("             L�nge      : 1000 bis 15000\n");
		      _outtext("                         (10 mm - 150 mm)\n");
		      _outtext("             Innen�     : 0 / 1000 bis 10000\n");
		      _outtext("                         (Innen� < Aussen�)");
		      getch();
		      TW_Close_Window();
		      _settextcolor(10);
		      _setbkcolor(4);
		      raus=0;
		    }
	      }
     } while (!raus);

  TW_Close_Window();
  return 0;
}
Exemplo n.º 13
0
void
progressbar (int current, int total)
{
  /* display a progress bar on screen */

  char bar[51];
  int percent;
  int width;
  int col;
  int row;

  /* assumes current >= 0, current <= total, and both current & total
     are non-negative, otherwise behavior may not be as expected. */

  if (total > 0)
    {
      percent = 100 * current / total;
    }
  else
    {
      percent = 0;
    }

  if (percent < 0)
    {
      percent = 0;
    }
  else if (percent > 100)
    {
      percent = 100;
    }

  width = percent / 2;

  /* generate a string to display */

  for (col = 0; col < width; col++)
    {
      /* bar[col] = '#'; */
      bar[col] = 219;				/* filled box */
    }

  for ( ; col < 50; col++)
    {
      /* bar[col] = '-'; */
      bar[col] = 176;				/* shaded box */
    }

  bar[50] = 0;

  /* print the string */

  /* bar is 50 cols wide, so offset is 80 - 50 = 30 ; 30 / 2 = 15 */

  _settextwindow (15,1 , 20,80);		/* y1,x1 , y2,x2 */

  _settextcolor (_YELLOW_);
  _setbkcolor (_BLUE_);

  /* only initalize/clear screen if 'current' is 0 */

  if (current == 0)
    {
      _clearscreen (_GWINDOW);
    }

  for (row = 1; row <= 3; row++)
    {
      _settextposition (row, 15);		/* relative to window */
      cputs (bar);
    }

  _settextposition (3, 67);			/* relative to window */
  cprintf ("%d%%", percent);
}
Exemplo n.º 14
0
void displayEditObjMiscMenu(const dikuObject *obj)
{
  char strn[256], newName[256], *outStrn = new char[2048],
       vstrn1[256], vstrn2[256], vstrn3[256], vstrn4[256],
       vstrn5[256], vstrn6[256], vstrn7[256], vstrn8[256],
       v2strn1[256], v2strn2[256], v2strn3[256], v2strn4[256],
       v2strn5[256], v2strn6[256], v2strn7[256], v2strn8[256];


  _clearscreen(7, 0);

  if (!outStrn)
  {
    _outtext("\n\nError allocating outStrn in displayblah()...\n\n");

    return;
  }

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixObjName(obj->objShortName, newName);

  sprintf(strn, "&+gEditing miscellany for obj #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
          obj->objNumber, newName);

  displayColorString(strn);

  sprintf(outStrn,
"   &+YA&+L.&n &+wObject type                       %u (%s)&n\n"
"\n"
"   &+YB&+L.&n &+wObject value #1                   %d (%s)&n\n"
"   &+YC&+L.&n &+wObject value #2                   %d (%s)&n\n"
"   &+YD&+L.&n &+wObject value #3                   %d (%s)&n\n"
"   &+YE&+L.&n &+wObject value #4                   %d (%s)&n\n"
"   &+YF&+L.&n &+wObject value #5                   %d (%s)&n\n"
"   &+YG&+L.&n &+wObject value #6                   %d (%s)&n\n"
"   &+YH&+L.&n &+wObject value #7                   %d (%s)&n\n"
"   &+YI&+L.&n &+wObject value #8                   %d (%s)&n\n"
"\n"
"   &+YJ&+L.&n &+wObject apply #1 - what            %u (%s)&n\n"
"   &+YK&+L.&n &+wObject apply #1 - value           %d&n\n"
"\n"
"   &+YL&+L.&n &+wObject apply #2 - what            %u (%s)&n\n"
"   &+YM&+L.&n &+wObject apply #2 - value           %d&n\n"
"\n"
MENU_COMMON
"\n"
"%s",
                   obj->objType, getObjTypeStrn(obj->objType),

                   obj->objValues[0],
                    getObjValueStrn(obj->objType, 0, obj->objValues[0],
                                    vstrn1, v2strn1, TRUE, obj),
                   obj->objValues[1],
                    getObjValueStrn(obj->objType, 1, obj->objValues[1],
                                    vstrn2, v2strn2, TRUE, obj),
                   obj->objValues[2],
                    getObjValueStrn(obj->objType, 2, obj->objValues[2],
                                    vstrn3, v2strn3, TRUE, obj),
                   obj->objValues[3],
                    getObjValueStrn(obj->objType, 3, obj->objValues[3],
                                    vstrn4, v2strn4, TRUE, obj),
                   obj->objValues[4],
                    getObjValueStrn(obj->objType, 4, obj->objValues[4],
                                    vstrn5, v2strn5, TRUE, obj),
                   obj->objValues[5],
                    getObjValueStrn(obj->objType, 5, obj->objValues[5],
                                    vstrn6, v2strn6, TRUE, obj),
                   obj->objValues[6],
                    getObjValueStrn(obj->objType, 6, obj->objValues[6],
                                    vstrn7, v2strn7, TRUE, obj),
                   obj->objValues[7],
                    getObjValueStrn(obj->objType, 7, obj->objValues[7],
                                    vstrn8, v2strn8, TRUE, obj),

                   obj->objApply[0].applyWhere,
                    getObjApplyStrn(obj->objApply[0].applyWhere),
                   obj->objApply[0].applyModifier,

                   obj->objApply[1].applyWhere,
                    getObjApplyStrn(obj->objApply[1].applyWhere),
                   obj->objApply[1].applyModifier,

                   getMenuPromptName());

  displayColorString(outStrn);

  delete[] outStrn;
}
Exemplo n.º 15
0
main()
{
   char  channels[80],
         color_transform[80],
         file_name[80],
         response[80];

   int   a,
         b,
         c,
	 channel,
	 double_display,
	 horizontal,
         ie,
         il,
         key,
         le,
         ll,
         not_finished,
	 r,
	 vertical,
	 x_offset,
	 y_offset;


   unsigned int block,
                color,
                i,
                j,
                x,
                y;

   unsigned long histogram[256];


   _setvideomode(_TEXTC80);         /* MSC 6.0 statements */
   _setbkcolor(1);
   _settextcolor(7);
   _clearscreen(_GCLEARSCREEN);

   strcpy(file_name, "d:/images/nbrite.dat");
   strcpy(channels, "Single channel");
   strcpy(color_transform, "Modified transform");
   channel = 1;
   il      = 1;
   ll      = 100;
   ie      = 1;
   le	   = 100;
   horizontal = 5;
   vertical   = 4;
   double_display = 0;

   printf("\nThis is the display program.");
   printf("\nThis program can either display a 300x500 section of");
   printf("\nan image or three channels of a 100x500 section of an");
   printf("\nimage. The parameters entered describe the upper left");
   printf("\n100x100 corner of the display.");

   not_finished = 1;
   while(not_finished){

      display_menu(channels, color_transform);
      get_image_name(file_name);
      get_parameters(&channel, &il, &ie, &ll, &le,
		     &horizontal, &vertical, &double_display);


	/*******************************************
	*
	*   we want to set an offset so the image is
	*   centered on the CRT
	*
	********************************************/

	   x_offset = 0;
	   y_offset = 0;
	   x_offset = (6-horizontal)*100;
	   x_offset = 20 + x_offset/2;
	   y_offset = (4-vertical)*100;
	   y_offset = 40 + y_offset/2;



           /*********************************************
           *
           *   If the color_transform requires histogram
           *   equalization, then calculate the histogram
           *   from the four corners of the image.  You
           *   will use this in the display loop below
           *   to equalize the image.
           *
           **********************************************/

      if(color_transform[0] == 'H'){
         printf("\nCalculating histograms");
         zero_long_histogram(histogram);
         printf("\n\t1");
         read_image(image, file_name, channel, il, ie, ll, le);
         calculate_long_histogram(image, histogram);
         printf("\n\t2");
	 read_image(image, file_name, channel, il+400, ie,
		    ll+400, le);
         calculate_long_histogram(image, histogram);
         printf("\n\t3");
	 read_image(image, file_name, channel, il,
		    ie+400, ll, le+400);
         calculate_long_histogram(image, histogram);
         printf("\n\t4");
         read_image(image, file_name, channel, il+400, ie+400,
		    ll+400, le+400);
         calculate_long_histogram(image, histogram);
for(a=0; a<256; a++)
printf("\nh[%4d] = %8d", a, histogram[a]);
      }  /* ends if color_transform == H */


           /*********************************************
           *
           *   Find out what the key should be. This
           *   requires looking at the name of the image
           *   that is being displayed. Use a different
           *   key for the three different channels of
           *   the image.
           *
           **********************************************/

      key = 0;
      if(file_name[16] == '1')
         key = 1;
      if(file_name[16] == '2')
         key = 2;
      if(file_name[16] == '3')
         key = 3;
      if( (file_name[16] == '.') &&
          (channel == 1))
         key = 1;
      if( (file_name[16] == '.') &&
          (channel == 2))
         key = 2;
      if( (file_name[16] == '.') &&
          (channel == 3))
         key = 3;

  /* set graphics mode */
/*******
     map_16_shades_of_gray(_VRES16COLOR);
     blank_out_display();
********/

my_set_colors();




	  /***************************************************
          *
          *   If a single channel is desired then display a 300x500
	  *   section of one channel. If multiple channels
	  *   are desired then display one 100x500 section
	  *   of the image three times.
          *
	  *****************************************************/

      if( (channels[0] == 'S')  ||
	  (channels[0] == 's')){

	 for(a=0; a<horizontal; a++){
	    for(b=0; b<vertical; b++){
               x = a*100;
               y = b*100;
               read_image(image, file_name, channel, il+y, ie+x,
			   ll+y, le+x);

               if(color_transform[0] == 'H')
                  perform_histogram_equalization(image, histogram,
					      16, 40000);

	       if(double_display == 1){

		  if( (a==0) && (b==0)){
		    x_offset = 120;
		    y_offset = 40;
		  }

		  if( (a==0) && (b==1)){
		    x_offset = 120;
		    y_offset = 140;
		  }

		  if( (a==1) && (b==0)){
		    x_offset = 220;
		    y_offset = 40;
		  }

		  if( (a==1) && (b==1)){
		    x_offset = 220;
		    y_offset = 140;
		  }
	       }

               display_image_portion(image, key, color_transform,
				x, y, x_offset, y_offset,
				double_display);
            }  /* ends loop over b                   */
	 }     /* ends loop over a		     */

      }        /* ends if channels == Single channel */



      else{    /* else display three channels        */
         for(a=0; a<5; a++){    /*  Channel 1  */
            x = a*100;
            y =     0;
            read_image(image, file_name, 1, il+y, ie+x, ll+y,
			le+x);
            display_image_portion(image, key, color_transform, x,
				  y, x_offset, y_offset,
				  double_display);
         }  /* ends loop over a  */

         for(a=0; a<5; a++){    /*  Channel 2  */
            x = a*100;
            y =     0;
            color_transform[0] = 'S';
            read_image(image, file_name, 2, il+y, ie+x, ll+y,
		       le+x);
            display_image_portion(image, key, color_transform, x,
				  y+100, x_offset, y_offset,
				  double_display);
         }  /* ends loop over a  */

         for(a=0; a<5; a++){    /*  Channel 3  */
            x = a*100;
            y =     0;
            color_transform[0] = 'S';
            read_image(image, file_name, 3, il+y, ie+x, ll+y,
			le+x);
            display_image_portion(image, key, color_transform, x,
				  y+200, x_offset, y_offset,
				  double_display);
         }  /* ends loop over a  */
      }     /* ends else display multiple channels  */


/******************
      setlinestyle(SOLID_LINE, 0, THICK_WIDTH);
      for(i=0; i<5; i++){
         line(0, i*100, 500, i*100);
      }

      for(i=0; i<6; i++){
         line(i*100, 0, i*100, 300);
      }


      setlinestyle(SOLID_LINE, 0, NORM_WIDTH);
      for(i=0; i<13; i++){
         line(0, i*25, 500, i*25);
      }

      for(i=0; i<21; i++){
         line(i*25, 0, i*25, 300);
      }
******************/


/***********
setusercharsize(1, 2, 1, 2);
settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 0);
outtextxy(10, 320, "done");
***********/


/******************
    The following label the objects in the lower portion of the
image
outtextxy(400, 200, "041 house");
outtextxy(100, 25, "041 house");
outtextxy(100, 200, "040 apartments/hotel");
outtextxy(350, 50, "040 apartments/hotel");
outtextxy(10, 100, "200 decidous");
outtextxy(175, 150, "200 decidous");
*******************/


      read_string(response);
      printf("\nEnter 0 to quit 1 to do again");
      get_integer(&not_finished);

          /* set display back to text mode */
   _setvideomode(_TEXTC80);         /* MSC 6.0 statements */
   _setbkcolor(1);
   _settextcolor(7);
   _clearscreen(_GCLEARSCREEN);


   }  /* ends while not_finished  */

}  /* ends main  */
Exemplo n.º 16
0
void Terrain()
{
    // Allocate the offscreen bitmap
    offMap = CreateBitmap(256, 200);
    if (!offMap) return;

    // Allocate the surface maps
    if (!ISurface()) return;

	// Build tables
	BuildProjectionTable();
                
    // Attempt to randomize
    gSeed = time(NULL) + clock();
        
    // Generate the fractal surface
    Fractify(0, 0, 256, 256);
	Smoothify();
	
    // Build obelisk
    for (int j=-3; j<4; j++)
    	for (int i=-3; i<4; i++)
        	Point(128+i, 128+j) = 240;
        
    // Generate the palette
    BuildPalette();
    // Colorize the surface (w/ sealevel  parameter)
    Colorize(80);

    // Initialize values
	int elev = 10 << (YFIX+FIX);
    gX = gY = gZ = 0;
   	gY = HeightAt(gX, gZ) + elev;

    // Do some display
    int  mx, my;
    char q = 0, clr=0;
    int  c, f = 0;
    char msg[80];
	
    clock_t clk = clock();
    while (!q)
    {
		// Count the frame
        f++;

        //------------Refresh the display-------------
        // Clear the offmap
        ClearScreen(254, 256, 200, offMap);
        // Draw the surface
		Caster();
        // Copy the offmap to the screen                
        Display(offMap, 256, 200);

        //------------Handle user input-------------
        MouseMove(&mx, &my);
        if (mx || my)
        {
            gZ -= my;
            gZ = gZ & 4095;
                        
            gX += mx;
            gX = gX & 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }
        else if (kbhit())
        {
            c = getch();
            switch (c)
            {
                case 0:
                	c = getch();
                    switch (c)
                    {
                        case UP_ARROW_KEY:
                                gZ += 1;
                                break;

                        case DN_ARROW_KEY:
                                gZ -= 1;
                                break;
                                        
                        case LF_ARROW_KEY:
                                gX -= 1;
                                break;

                        case RT_ARROW_KEY:
                                gX += 1;
                            break;
                    }   
                    break;
                                
                case 'w':
                	elev += 8;
                	break;

                case 'x':
                	elev -= 8;
                	 break;

                case ESC_KEY:
                	q = 1;
               		break;
            }

            gZ &= 4095;
            gX &= 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }                                   
    }
    clk = clock() - clk;
    
    _settextposition(1, 2);
    _settextcolor(255);
    sprintf(msg, "Frames: %ld,  Time: %5.2fs,  FPS: %5.2f\n", f, clk/(float)CLOCKS_PER_SEC, f * (float)CLOCKS_PER_SEC / clk);
    _outtext(msg);
}
Exemplo n.º 17
0
void displayEditObjTypeMenu(dikuObject *obj)
{
  char strn[512], newName[256], *outStrn = new char[4096];


  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixObjName(obj->objShortName, newName);

  sprintf(strn, "&n&+gEditing object type #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
          obj->objNumber, newName);

  displayColorString(strn);

  if (getShowMenuInfoVal())
  {
    sprintf(outStrn,
  " &+YA/B&+L.&n &+wEdit object short/long name&n\n"
  "   &+YC&+L.&n &+wEdit object keywords &+c(%s)&n\n"
  " &+YD/E&+L.&n &+wEdit object extra/extra2 flags &+c(%u/%u)&n\n"
  "   &+YF&+L.&n &+wEdit object wear flags &+c(%u)&n\n"
  " &+YG/H&+L.&n &+wEdit object anti/anti2 flags &+c(%u/%u)&n\n"
  "   &+YI&+L.&n &+wEdit type &+c(%s)&n, values &+c(%d %d %d %d %d %d %d %d)&n,\n"
  "      and applies &+c(%s %d, %s %d)&n\n"
  "   &+YJ&+L.&n &+wEdit material &+c(%s&+c)&n, weight &+c(%d)&n, craftsmanship &+c(%d)&n\n"
  "   &+YK&+L.&n &+wEdit object extra descs &+c(%u)&n\n"
  "   &+YM&+L.&n &+wEdit object trap info &+c(%s&+c %s&+c [%d charge%s, level %u])&n\n",

    getReadableKeywordStrn(obj->keywordListHead, strn),

    obj->extraBits.longIntFlags,
    obj->extra2Bits.longIntFlags,
    obj->wearBits.longIntFlags,
    obj->antiBits.longIntFlags,
    obj->anti2Bits.longIntFlags,

    getObjTypeStrnShort(obj->objType),
    obj->objValues[0], obj->objValues[1], obj->objValues[2],
    obj->objValues[3], obj->objValues[4], obj->objValues[5],
    obj->objValues[6], obj->objValues[7],
      getObjApplyStrnShort(obj->objApply[0].applyWhere),
      obj->objApply[0].applyModifier,
      getObjApplyStrnShort(obj->objApply[1].applyWhere),
      obj->objApply[1].applyModifier,

    getMaterialStrn(obj->material),
    obj->weight,
    obj->craftsmanship,

    getNumbExtraDescs(obj->extraDescHead),

    getObjTrapAffStrn(obj->trapAff, newName), getObjTrapDamStrn(obj->trapDam),
      obj->trapCharge, plural(obj->trapCharge), obj->trapLevel);


    if (getObjAffectVal())
    {
      sprintf(strn,
  " &+YN/O&+L.&n &+wEdit object affect1/affect2 flags &+c(%u/%u)&n\n",
            obj->affect1Bits.longIntFlags,
            obj->affect2Bits.longIntFlags);

      strcat(outStrn, strn);

      sprintf(strn,
  " &+YP/Q&+L.&n &+wEdit object affect3/affect4 flags &+c(%u/%u)&n\n",
            obj->affect3Bits.longIntFlags,
            obj->affect4Bits.longIntFlags);

      strcat(outStrn, strn);
    }

    sprintf(strn,
  "\n"
  "   &+YL&+L.&n &+wSet limit of loads for all objs of type &+c(%u/%u)&n\n"
  "   &+YR&+L.&n &+wSet mud-wide object load limit &+c(%u) (0=no limit)&n\n"
  "   &+YV&+L.&n &+wChange object's vnum&n\n"
  "\n"
  MENU_COMMON
//  "\n"
  "\n", getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE),
        obj->maxload, obj->globalmaxload );

    strcat(outStrn, strn);

    strcat(outStrn, getMenuPromptName());
  }
  else  // no extra info
  {
    strcpy(outStrn,
  " &+YA/B&+L.&n &+wEdit object short/long name&n\n"
  "   &+YC&+L.&n &+wEdit object keywords&n\n"
  "   &+YD&+L.&n &+wEdit object extra flags&n\n"
  "   &+YE&+L.&n &+wEdit object extra2 flags&n\n"
  "   &+YF&+L.&n &+wEdit object wear flags&n\n"
  "   &+YG&+L.&n &+wEdit object anti flags&n\n"
  "   &+YH&+L.&n &+wEdit object anti2 flags&n\n"
  "   &+YI&+L.&n &+wEdit object type, values, and applies\n"
  "   &+YJ&+L.&n &+wEdit object material, weight, craftsmanship&n\n"
  "   &+YK&+L.&n &+wEdit object extra descs\n"
  "   &+YM&+L.&n &+wEdit object trap info\n");

    if (getObjAffectVal())
    {
    strcat(outStrn,
  "   &+YN&+L.&n &+wEdit object affect1 flags&n\n"
  "   &+YO&+L.&n &+wEdit object affect2 flags&n\n");
    strcat(outStrn,
  "   &+YP&+L.&n &+wEdit object affect3 flags&n\n"
  "   &+YQ&+L.&n &+wEdit object affect4 flags&n\n");
    }

    strcat(outStrn,
  "\n"
  "   &+YL&+L.&n &+wSet limit of loads for all objs of type&n\n"
  "   &+YV&+L.&n &+wChange object's vnum&n\n"
  "\n"
  MENU_COMMON
//  "\n"
  "\n");

    strcat(outStrn, getMenuPromptName());
  }

  displayColorString(outStrn);

  delete[] outStrn;
}
Exemplo n.º 18
0
int main(int argc, char **argv)
 {
     int setup( int, char **, Promptfile, long *, long *, boolean *,
                boolean *, boolean *, boolean *, boolean *, boolean *,
                boolean *, boolean *, boolean *, int *, Sellstar_system * );
     int help( void );
     int check( char *, boolean, long *, char * );
     int print_check_report(int, char *, long, char);
     int list( char *, Promptfile, long, long, boolean, boolean, boolean );
     int convert ( char *, Promptfile, Sellstar_system );
     int make_screen_prints ( char *, Promptfile, Sellstar_system, boolean );
     int linenumber( char *, long );
     int un_setup_printer( void );
     int bbdd( Promptfile prompt, int starting_at );

     Promptfile prompt;

     int rc, checkresult;
     boolean nocheck;
     boolean convert_file;
     boolean report_only;
     boolean list_only;
     boolean extended_report;
     boolean file_only;
     boolean laser_option;
     boolean screen_print_option;
     boolean convert_data_dictionary;
     int starting_where;

     Sellstar_system main_m;

     long startlistline, endlistline, errline;
     char errchar;
     char outtext_string[MAX_LINE_LENGTH];
     int text_color;
     int rand_color_1, rand_color_2;
     struct dostime_t randomtime;

     /*
     **  Print an informative message on the screen, in color.
     */

     sprintf(outtext_string, "\n");
     _outtext(outtext_string);
     text_color = _gettextcolor();

     _dos_gettime(&randomtime);
     rand_color_1 = ( randomtime.second % 6 ) + 9;
     _settextcolor(rand_color_1);
     sprintf(outtext_string, "%s", BANNER);
     _outtext(outtext_string);

     _dos_gettime(&randomtime);
     rand_color_2 = ( ( randomtime.second + 2 ) % 6 ) + 9;
     _settextcolor(rand_color_2);
     sprintf(outtext_string, "%s", COPYRIGHT);
     _outtext(outtext_string);

     _settextcolor(text_color);
     sprintf(outtext_string, "\n");
     _outtext(outtext_string);

     /*
     **  Give the user Help if desired.
     */

     if ( argc == 1 )
     {
          fprintf(stdout, USAGE);
          exit(-1);
     }

     if ( argc == 2 )
     {
          help();                   /* give the user Help here. */
          exit(-1);
     }

     /*
     ** allocate an array of struct pfile to hold the prompt file.
     */

     if ( (prompt = (Promptfile)malloc((long)(MAX_NUM_PROMPTS + 1) *
                                                sizeof(struct pfile))) == NULL )
     {
          fprintf(stdout, "Insufficient memory to run LIST.\n");
          exit(-1);
     }

     /*
     **  Get the filename to process.
     */

     strcpy(filename, argv[argc-1]);

     /*
     **  Look for it on disk.
     */

     _splitpath(filename, drive, subdir, file, ext);

     if (strlen(subdir) == 0)
          if (strcmp(strupr(ext), ".SCN") == 0)
               strcpy(subdir, SCREENS);
          else if (strcmp(strupr(ext), ".FRM") == 0)
               strcpy(subdir, FORMS);

     sprintf(pathname, "%s%s", drive, subdir);

     sprintf(longfilename, "%s%s%s%s", drive, subdir, file, ext);

     /*
     **  Before taking the time to read in the prompt file, check to make sure
     **  we can find the indicated input file.
     */

     if ((done = _dos_findfirst(longfilename, 47, &dta)) != 0)
     {
          perror("LIST");

          exit(-1);
     }

     /*
     **  Otherwise, call SETUP() and begin.
     */

     rc = setup( argc, argv, prompt, &startlistline, &endlistline, &nocheck,
                 &report_only, &list_only, &extended_report, &file_only,
                 &convert_file, &laser_option, &screen_print_option,
                 &convert_data_dictionary, &starting_where, &main_m
     );

     if ( convert_data_dictionary ) {
        bbdd(prompt, starting_where);
        fcloseall();
        goto all_done;
     }

     /*
     **  Get the filename [ again ] to hand off to List().
     */

     strcpy(filename, argv[argc-1]);

     _splitpath(filename, drive, subdir, file, ext);

     if (strlen(subdir) == 0)
          if (strcmp(strupr(ext), ".SCN") == 0)
               strcpy(subdir, SCREENS);
          else if (strcmp(strupr(ext), ".FRM") == 0)
               strcpy(subdir, FORMS);

     sprintf(pathname, "%s%s", drive, subdir);

     sprintf(longfilename, "%s%s%s%s", drive, subdir, file, ext);

     if ((done = _dos_findfirst(longfilename, 47, &dta)) != 0)
     {
          perror("LIST");

          exit(-1);
     }

     if ( convert_file ) {
        if (strcmp(strupr(ext), ".SCN") == 0)
           fprintf(stdout, "Converting screen file to BRANCHBANKER format . . .\n");
        else {
           fprintf(stdout, "BRANCHBANKER conversion does not apply to forms.\n");

          exit(-1);
        }
     }
     else
        fprintf(stdout, "Running . . .\n");

     /*
     **  (There may be more than one file.)
     */

     while ( !done )
     {
          strcpy(name, pathname);
          strcat(name, dta.name);
          strupr(name);

          /*
          **  First CHECK the file.  Only if it passes do we actually LIST it.
          */

          if ((checkresult=check(name, nocheck, &errline, &errchar))==0)
          {
                if ( convert_file ) {
                        convert ( name, prompt, main_m );
                }
                else {
                        if ( ( screen_print_option ) &&
                             (strcmp(strupr(ext), ".SCN") == 0) ) {
                                make_screen_prints( name, prompt, main_m,
                                                    laser_option );
                        }
                        else {
                                list( name, prompt, startlistline, endlistline,
                                      report_only, list_only, extended_report );
                        }
                }
          }
          else
                if (checkresult != (-1))
                        print_check_report(checkresult, name, errline, errchar);

          /*
          **  If sending this file to a file, print a formfeed here (since it
          **  is presumably NOT going directly to DOS Print).
          */

          if ( ( file_only ) && ( !convert_file ) )
               fprintf(fp_output, "\f");

          /*
          **  Check to see if the user wants to escape out and exit.
          */

          if ( kbhit() )
          {
               if ( getch() == 27 )
               {
                    fprintf(stdout, "\nAre you sure you want to exit? (Y/N) ");
                    console_input = getch();

                    if ( ( console_input == 13 ) || ( console_input == 27 ) ||
                         ( console_input == 'Y') || ( console_input == 'y' ) )
                    {
                         fclose(fp_input);
                         fclose(fp_output);
                         fclose(fp_prompt);
                         fclose(fp_check);
                         fprintf(stdout, "\nOkay.\n");

                         exit(-2);
                    }
               }
               else
                    fprintf(stdout, "\nContinuing . . .\n");

          }  /* end of user exit loop */

          /*
          **  Otherwise, look for the next file.
          */

          done = _dos_findnext(&dta);

     }  /* end of MAIN while loop */

     if ( !convert_file )
        un_setup_printer();          /* turn off automatic perforation skip */

     if ( laser_option ) {
        fputc(27, fp_output);        /* RESET IBM LASER PRINTER TO HP MODE! */
        fputc(91, fp_output);
        fputc(75, fp_output);
        fputc( 3, fp_output);
        fputc( 0, fp_output);
        fputc( 1, fp_output);
        fputc(49, fp_output);
        fputc( 2, fp_output);
     }

     /*
     **  Clean up, free memory, and exit.
     */

     fclose(fp_output);
     fclose(fp_input);
     fclose(fp_prompt);
     fclose(fp_check);
     fclose(fp_main);

     /*
     **  Send the whole mess to the printer, cancelling any previous job
     **  left in the print queue BY THIS PROGRAM ONLY, to avoid locking up
     **  the machine on a file-access conflict.
     */

     if ( file_only )
     {
          fprintf(stdout, "Output has been sent to the file C:\\LISTFILE.RJL\n");

          if ( laser_option ) {
             fprintf(stdout, "\n");
             fprintf(stdout, "To print to the IBM Laser Printer, you must first be logged on to the LAN.\n");
             fprintf(stdout, "Restart the computer with the LAN diskette, log on and exit to DOS.\n");
             fprintf(stdout, "Then use NPRINT C:\\LISTFILE.RJL /nb /noff /S=WA001HME01 /Q=BKS_01 to print.\n");
          }
     }
     else if ( !convert_file )
     {
          system(CANCEL_PRINTING);

          system(SEND_TO_PRINTER);
     }

     /*
     **  And we're outa here.
     */
all_done:
     return(0);
}
Exemplo n.º 19
0
int create_window( Window how_big, char *title, short border_color,
                    long background_color, short foreground_color ) {
   static int window_counter;
   int i, j;

#ifdef DIAGNOSTICS
   fprintf(stderr, "entering CREATE_WINDOW\n");
#endif

   _settextwindow(how_big.row1-1, how_big.col1-1, how_big.row2+1, how_big.col2+1);
   _wrapon ( _GWRAPOFF );
   _setbkcolor ( background_color );
   _clearscreen ( _GWINDOW );
   _settextwindow(how_big.row1-1, how_big.col1-1, how_big.row2+2, how_big.col2+4);

   _settextcolor( border_color );
   _settextposition(1,1);
   _outtext("É");
   for (i=1; i<=(how_big.col2-how_big.col1) / 2 - strlen(title) / 2 - 1; i++)
      _outtext("Í");
   if ( strlen ( title ) % 2 == 0 )
      _outtext("Í");
   _outtext(" ");
   _settextcolor( BRIGHT_WHITE );
   _outtext(strupr(title));
   _settextcolor( border_color );
   _outtext(" ");
   for (i=1; i<=(how_big.col2-how_big.col1) / 2 - strlen(title) / 2 - 1; i++)
      _outtext("Í");
   if ( strlen ( title ) % 2 == 0 )
      _outtext("Í");
   _outtext("»");

   for (j=2; j<=how_big.row2-how_big.row1+2; j++) {
      _settextposition(j, 1);
      _outtext("º");
      _settextposition(j, how_big.col2-how_big.col1+3);
      _outtext("º");
   }

   _settextposition(how_big.row2-how_big.row1+3, 1);
   _outtext("È");
   for (i=1; i<=how_big.col2-how_big.col1+1; i++)
      _outtext("Í");
   _outtext("¼");

   /*
   **  Draw shadows (shadows are necessary to avoid end-of-window wrapping).
   */

   _setbkcolor ( BLACK );
   for (i=2; i<=how_big.row2+2; i++) {
      _settextposition ( i, how_big.col2-how_big.col1+4 );
      _outtext ( "  " );
   }
   for (j=2; j<=how_big.col2-how_big.col1+3; j++) {
      _settextposition ( how_big.row2+2, j );
      _outtext ( " " );
   }

   _setbkcolor ( background_color );
   _settextcolor ( foreground_color );

   _settextwindow(how_big.row1, how_big.col1, how_big.row2, how_big.col2);
   _settextposition(1,1);

   return(0);

#ifdef DIAGNOSTICS
   fprintf(stderr, "exit CREATE_WINDOW\n");
#endif

   return(window_counter++);
}