示例#1
0
文件: editrchk.cpp 项目: Xangis/magma
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);
}
示例#2
0
文件: editqstu.cpp 项目: Xangis/magma
void editQuestPrompt(void)
{
  char numbStrn[256] = "\0";


  _outtext("\n");

  while (TRUE)
  {
    displayColorString("\n&+cEdit which mob's quest info (&+C? for list&n&+c): ");

    getStrn(numbStrn, 8, 1, 7, '°', numbStrn, FALSE, FALSE);

    if (!strcmp(numbStrn, "?"))
    {
      displayQuestList();

      strcpy(numbStrn, "\0");
    }
    else break;
  }

  _setbkcolor(0);

  if (strlen(numbStrn))
  {
    editQuestStrn(numbStrn);
  }
  else _outtext("\n\n");
}
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);
}
示例#4
0
文件: delqstu.cpp 项目: Xangis/magma
void deleteQuestUserPrompt(void)
{
  char numbStrn[32] = "\0";


  while (TRUE)
  {
    displayColorString("\n"
"&+cEnter number of mob type to delete quest info from (&+C? for list&n&+c): ");

    getStrn(numbStrn, 8, 1, 7, '°', numbStrn, FALSE, FALSE);

    if (!strcmp(numbStrn, "?"))
    {
      displayQuestList();

      strcpy(numbStrn, "\0");
    }
    else break;
  }

  _setbkcolor(0);

  if (strlen(numbStrn))
  {
    deleteQuestUser(numbStrn);
  }
  else _outtext("\n\n");
}
示例#5
0
文件: editdisp.cpp 项目: Xangis/magma
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);
}
示例#6
0
文件: reset.c 项目: CivilPol/sdcboot
void
main (void)
{
  /* reset colors, and exit */

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

  exit (0);
}
示例#7
0
文件: editotrp.cpp 项目: Xangis/magma
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;
}
示例#8
0
文件: editshpb.cpp 项目: Xangis/magma
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;
}
示例#9
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 );
   }
示例#10
0
文件: editomsc.cpp 项目: Xangis/magma
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;
}
示例#11
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  */
示例#12
0
文件: editobj.cpp 项目: Xangis/magma
char jumpObj(const dikuObject *obj, ulong *numb)
{
  struct rccoord coords;
  char strn[128], numbStrn[64];
  ulong numb2;


  coords = _gettextposition();
//  coords.row -= 2;

  _settextposition(coords.row, 1);
  clrline(coords.row);

  while (TRUE)
  {
    sprintf(strn, "&+CJump to which object (%u-%u, ? for list, $ to search): &n",
            getLowestObjNumber(), getHighestObjNumber());
    displayColorString(strn);

    itoa(obj->objNumber, numbStrn, 10);

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strcmp(strn, "?"))
    {
      displayObjectTypeList();
    }
    else
    if (!strcmp(strn, "$"))
    {
      strn[0] = 0;

      _setbkcolor(0);
      displayColorString("\n&+CEnter substring to search object list for: &n");
      getStrn(strn, 25, 1, 7, '°', strn, FALSE, FALSE);
      upstrn(strn);

      displayObjectTypeList(strn, FALSE);
    }
    else
    {
      numb2 = strtoul(strn, NULL, 10);

      if ((!strnumer(strn)) || (numb2 >= numbLookupEntries) ||
          (!findObj(numb2)))
      {
        clrline(coords.row, 7, 0);
        _settextposition(coords.row, 1);
        _setbkcolor(0);

        displayColorString(getMenuPromptName());

        return MENU_JUMP_ERROR;
      }
      else
      {
        *numb = numb2;
        return MENU_JUMP_VALID;
      }
    }
  }
}
示例#13
0
文件: editobj.cpp 项目: Xangis/magma
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;
}
示例#14
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);
}
示例#15
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++);
}
示例#16
0
文件: editobj.cpp 项目: Xangis/magma
char interpEditObjTypeMenu(usint ch, dikuObject *obj, dikuObject *origObj,
                           char *addedIdentKeyword)
{
  struct rccoord coords;
  char strn[256], numbStrn[32], newName[256];
  stringNode *strnN;
  ulong i;


 // edit obj short name

  if (ch == 'A')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object short name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objShortName, MAX_OBJSNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objShortName, FALSE, FALSE);

    remTrailingSpaces(obj->objShortName);
    remLeadingSpaces(obj->objShortName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj long name

  if (ch == 'B')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object long name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objLongName, MAX_OBJLNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objLongName, FALSE, FALSE);

    remTrailingSpaces(obj->objLongName);
    remLeadingSpaces(obj->objLongName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj keywords

  if (ch == 'C')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object keywords: &n");

    createKeywordString(obj->keywordListHead, strn);
    strn[strlen(strn) - 1] = '\0';  // get rid of tilde

    getStrn(strn, MAX_OBJKEY_LEN - 1, 1, 7, '°', strn, FALSE, FALSE);

    remTrailingSpaces(strn);
    remLeadingSpaces(strn);
    strcat(strn, "~");

    deleteStringNodes(obj->keywordListHead);
    obj->keywordListHead = createKeywordList(strn);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra flags

  if (ch == 'D')
  {
    editObjExtraFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra2 flags

  if (ch == 'E')
  {
    editObjExtra2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj wear flags

  if (ch == 'F')
  {
    editObjWearFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti flags

  if (ch == 'G')
  {
    editObjAntiFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti2 flags

  if (ch == 'H')
  {
    editObjAnti2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj type, applies, values

  if (ch == 'I')
  {
    editObjMisc(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj weight, dam bonus, etc

  if (ch == 'J')
  {
    editObjMisc2(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra descs

  if (ch == 'K')
  {
    if (editObjExtraDesc(obj, addedIdentKeyword))
    {
     // user aborted, check for _id_ keyword and remove it

      if (*addedIdentKeyword)
      {
        strnN = obj->keywordListHead;
        while (strnN)
        {
          if (!strcmp(strnN->string, "_ID_"))
          {
            if (!strnN->Last) // head of list
            {
              obj->keywordListHead = obj->keywordListHead->Next;
              obj->keywordListHead->Last = NULL;

              delete strnN;
            }
            else
            {
              strnN->Last->Next = strnN->Next;
              strnN->Next->Last = strnN->Last;

              delete strnN;
            }
          }

          strnN = strnN->Next;
        }
      }
    }

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj trap info

  if (ch == 'M')
  {
    editObjTrapInfo(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // if allowed, edit aff1 flag

  if (getObjAffectVal() && (ch == 'N'))
  {
    editObjAffect1Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff2 flag

  if (getObjAffectVal() && (ch == 'O'))
  {
    editObjAffect2Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff3 flag

  if (getObjAffectVal() && (ch == 'P'))
  {
    editObjAffect3Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff4 flag

  if (getObjAffectVal() && (ch == 'Q'))
  {
    editObjAffect4Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // change limit

  if (ch == 'L')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, i, obj->globalmaxload);
    obj->maxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }
  else
  if (ch == 'R')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew MUD-wide limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, obj->maxload, i);
    obj->globalmaxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }

  else

 // change vnum

  if ((ch == 'V') && !obj->defaultObj)
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    sprintf(strn, "&+YNew object vnum (highest allowed %u): &n",
            numbLookupEntries - 1);
    displayColorString(strn);

    itoa(obj->objNumber, numbStrn, 10);

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if ((!strnumer(strn)) || (atoi(strn) >= numbLookupEntries) ||
        (findObj(atoi(strn))))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);

    resetAllObjHere(obj->objNumber, i, roomHead);
    resetNumbLoaded(ENTITY_OBJECT, obj->objNumber, i);

    checkAndFixRefstoObj(obj->objNumber, i);

    objLookup[i] = origObj;
    objLookup[obj->objNumber] = NULL;

    obj->objNumber = i;

    resetEntityPointersByNumb(TRUE, FALSE);

    _settextposition(1, 1);

    clrline(1, 0, 0);
    fixObjName(obj->objShortName, newName);

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

    displayColorString(strn);

    clrline(coords.row, 7, 0);
    _settextposition(coords.row, 1);

    displayColorString(getMenuPromptName());
  }
  else

 // quit

  if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}
/* 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;
}