コード例 #1
0
/* Full screen character sheet, crime sheet */
void printliberalcrimes(Creature &cr)
{
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   char str[200];
   char num[5];

   // Add name
   move(2,0);
   if(strcmp(cr.propername,cr.name)!=0)
   {
      addstr("Code name: ");
   }
   else
   {
      addstr("Name: ");
   }
   set_color(COLOR_WHITE,COLOR_BLACK,1);
   addstr(cr.name);
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   addstr(", ");
   gettitle(str,cr);
   addstr(str);
   addstr(" (");
   getrecruitcreature(str,cr.type);
   addstr(str);
   addstr(")");

   // Add all crimes
   for(int i = 0;i < LAWFLAGNUM; i++)
   {
      if(i%2==0 && i<4)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(4,40*(i/2));
         addstr("CRIME");
         move(4,30+40*(i/2));
         addstr("NUM");
      }

      // Commited crimes are yellow
      if(cr.crimes_suspected[i] > 0)
      {
         set_color(COLOR_YELLOW,COLOR_BLACK,1);
      }
      else
      {
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      }

      move(5+i/2,40*(i%2));
      getlawflag(str,i);
      strcat(str,": ");
      addstr(str);
      move(5+i/2,30+40*(i%2));
      sprintf(num,"%2d",cr.crimes_suspected[i]);
      addstr(num);
   }

   set_color(COLOR_WHITE,COLOR_BLACK,0);
}
コード例 #2
0
ファイル: sdl_vid.c プロジェクト: davecahill/digger
void vgatitle(void)
{
	SDL_Surface *tmp=NULL;

	vgageti(0, 0, (uint8_t *)&tmp, 80, 200);
	gettitle(tmp->pixels);
	vgaputi(0, 0, (uint8_t *)&tmp, 80, 200);
	SDL_FreeSurface(tmp);
}
コード例 #3
0
ファイル: sdl_vid.cpp プロジェクト: z-10/digger
void vgatitle(void)
{
	SDL_Surface *tmp=NULL;

	vgageti(0, 0, (Uint3 *)&tmp, 80, 200);
	gettitle((unsigned char*)tmp->pixels);
	vgaputi(0, 0, (Uint3 *)&tmp, 80, 200);
	SDL_FreeSurface(tmp);
}
コード例 #4
0
ファイル: moc_codesobject.cpp プロジェクト: KOPOJI/codes_new
int CodesObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = TSqlObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getid(); break;
        case 1: *reinterpret_cast< QString*>(_v) = gettitle(); break;
        case 2: *reinterpret_cast< QString*>(_v) = getcode(); break;
        case 3: *reinterpret_cast< QString*>(_v) = getcode_url(); break;
        case 4: *reinterpret_cast< int*>(_v) = getstatus(); break;
        case 5: *reinterpret_cast< QDateTime*>(_v) = getcreated_at(); break;
        case 6: *reinterpret_cast< QDateTime*>(_v) = getupdated_at(); break;
        case 7: *reinterpret_cast< int*>(_v) = geteditable(); break;
        case 8: *reinterpret_cast< int*>(_v) = getuser_id(); break;
        case 9: *reinterpret_cast< QString*>(_v) = getshow_from(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setid(*reinterpret_cast< int*>(_v)); break;
        case 1: settitle(*reinterpret_cast< QString*>(_v)); break;
        case 2: setcode(*reinterpret_cast< QString*>(_v)); break;
        case 3: setcode_url(*reinterpret_cast< QString*>(_v)); break;
        case 4: setstatus(*reinterpret_cast< int*>(_v)); break;
        case 5: setcreated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 6: setupdated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 7: seteditable(*reinterpret_cast< int*>(_v)); break;
        case 8: setuser_id(*reinterpret_cast< int*>(_v)); break;
        case 9: setshow_from(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 10)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #5
0
ファイル: fbsd_vid.c プロジェクト: LibreGames/digger
void
vgatitle(void)
{
    VGLBitmap      *tmp = NULL;

    vgageti(0, 0, (uint8_t *) & tmp, 80, 200);
    gettitle(tmp->Bitmap);
    vgaputi(0, 0, (uint8_t *) & tmp, 80, 200);
    VGLBitmapDestroy(tmp);
}
コード例 #6
0
int PostObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = TSqlObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getid(); break;
        case 1: *reinterpret_cast< int*>(_v) = getblog_id(); break;
        case 2: *reinterpret_cast< QString*>(_v) = gettitle(); break;
        case 3: *reinterpret_cast< QString*>(_v) = getcontent(); break;
        case 4: *reinterpret_cast< QDateTime*>(_v) = getcreated_at(); break;
        case 5: *reinterpret_cast< QDateTime*>(_v) = getupdated_at(); break;
        case 6: *reinterpret_cast< int*>(_v) = getlock_revision(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setid(*reinterpret_cast< int*>(_v)); break;
        case 1: setblog_id(*reinterpret_cast< int*>(_v)); break;
        case 2: settitle(*reinterpret_cast< QString*>(_v)); break;
        case 3: setcontent(*reinterpret_cast< QString*>(_v)); break;
        case 4: setcreated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 5: setupdated_at(*reinterpret_cast< QDateTime*>(_v)); break;
        case 6: setlock_revision(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #7
0
ファイル: tuthelp.c プロジェクト: E-LLP/VICAR
FUNCTION static CODE tut_h_prep 
(
    struct CONTXT	*pctx,		/* in: proc context			*/
    struct SFILE	*hf,		/* in/out: help file			*/
    struct TXTSTOR	*title		/* out: blodk of .TITLE text		*/

 )
    {
    IMPORT struct VARIABLE *char_gbl;	/* system characteristics		*/

    struct CONTXT	*ctx;
    TEXT		libe[FLIBRSIZ+1];
    struct DIRBLK	db;		/* directive ctrl blk for d_  package	*/
    struct CP_HEADER	header;		/* compiled PDF header record		*/
    COUNT		recsize;
    CODE		code;
    TEXT		field[STRINGSIZ+1];
    TEXT		dirtyp[STRINGSIZ+1];
    TEXT		ttlmsg[STRINGSIZ+1];
    TEXT		ttlkey[STRINGSIZ+1];

    for (ctx = pctx; (s_equal((*ctx).pdf.libr,"/LOCAL/"));
	    ctx = (*ctx).backlink);
    s_copy ((*ctx).pdf.libr, libe);
    d_init(&db, hf, libe,
	(TEXT **) (*char_gbl).v_cvp, (*char_gbl).v_count);	/* init directive block	*/
    if ((*pctx).compiled)			/* if compiled PDF		*/
	{
	f_rewind(hf);
	f_read(hf, field);			/* dummy read -- space to header*/
	code = f_bread(hf, (GENPTR)&header, sizeof(struct CP_HEADER), &recsize);
	if (code != SUCCESS)
	    goto read_err;
	if (header.type != C_HEADER)
	    goto hdr_type_err;
	if (header.title.possav)		/* if .TITLE text exists			*/
	    {
	    f_setpos(hf, &header.title);	/* position to .TITLE			*/
	    code = f_read(hf, field);		/* read the .TITLE record		*/
	    if (code != SUCCESS)
		goto read_err;
	    code = gettitle(&db, title, ttlmsg, ttlkey);
	    if (code != SUCCESS)
		goto title_err;
	    }
	if (header.help.possav)			/* if .HELP text exists		*/
	    {
	    MOVE_STRUCT(header.help, tutctx.hlppos); /* save .HELP posit	*/
	    tutctx.hlpexist = TRUE;
	    }
	if (header.level2.possav)		/* if .LEVEL2 help text exists	*/
	    {
	    f_setpos(hf, &header.level2);	/* posit to .LEVEL2		*/
	    f_read(hf, field);
	    f_read(hf, field);			/* dummy reads to pass .LEVEL2	*/
	    f_movpos(&(*hf).posctx, &tutctx.lasth2pos);
	    f_movpos(&(*hf).posctx, &tutctx.lev2start);
	    tutctx.h2exist = TRUE;
	    }
	if (header.level1.possav)		/* if .LEVEL1 help text exists	*/
	    {
	    f_setpos(hf, &header.level1);	/* posit to .LEVEL1		*/
	    f_read(hf, field);
	    f_read(hf, field);			/* dummy reads to pass .LEVEL1	*/
	    f_movpos(&(*hf).posctx, &tutctx.lasth1pos); /* save as last level 1 help posit*/
	    f_movpos(&(*hf).posctx, &tutctx.lev1start); /* & permanently as start of .LEVEL section*/
	    tutctx.h1exist = TRUE;
	    }
	tutctx.nohelpf= !tutctx.hlpexist && !tutctx.h1exist && !tutctx.h2exist;
	}
    else					/* not in compiled PDF		*/
	{
	while ((code = d_dirctv(&db, dirtyp, field)) == SUCCESS)
	    {
	    if (s_equal(dirtyp, ".TITLE"))		    /* if .TITLE text present 	*/
		{
		if (gettitle(&db, title, ttlmsg, ttlkey) != SUCCESS)
		    goto title_err;
		}
	    else if (s_equal(dirtyp, ".HELP"))
		{
		f_movpos(&(*hf).posctx, &tutctx.hlppos);    /* save .HELP posit*/
		tutctx.hlpexist = TRUE;
		}
	    else if (s_equal(dirtyp, ".LEVEL1"))
		{
		f_read(hf, field);		/* dummy read to get past .LEVEL1	*/
		f_movpos(&(*hf).posctx, &tutctx.lasth1pos);	/* save as last level 1 help posit*/
		f_movpos(&(*hf).posctx, &tutctx.lev1start);	/* & permanently as start of .LEVEL section*/
		tutctx.h1exist = TRUE;
		break;
		}
	    else if (s_equal(dirtyp, ".LEVEL2"))
		{
		f_read(hf, field);		/* dummy read to get past .LEVEL2	*/
		f_movpos(&(*hf).posctx, &tutctx.lasth2pos);
		f_movpos(&(*hf).posctx, &tutctx.lev2start);
		tutctx.h2exist = TRUE;
		}
	    else if (s_equal(dirtyp, ".END"))
		{
		tutctx.nohelpf=	!tutctx.hlpexist  &&
				!tutctx.h1exist  &&  !tutctx.h2exist;
		break;
		}
	    else
		goto struct_err;		/* otherwise badly structured help file	*/
	    }
	if (code != SUCCESS)
	    goto dir_err;
	}
    return(SUCCESS);

title_err:
    tutmsg(ttlmsg, ttlkey, 0, 0, 0, 0, 0);		/* help file title read error     */
    goto close_err;

struct_err:
    tutmsg("Unrecognized directive '%s' in help file.", "TAE-BADHLPDIR", 
	   (uintptr_t) dirtyp, 0, 0, 0, 0);
    fretxt(title);
    goto close_err;

dir_err:
    tutmsg(msg_hrde, key_hrde, (uintptr_t) (*pctx).pdf.name, 0, 0, 0, 0);	/* help file read error			*/
    fretxt(title);
    goto close_err;

read_err:
    tutmsg(msg_hrde, key_hrde, (uintptr_t) (*pctx).pdf.name, 0, 0, 0, 0);	/* help file read error			*/
    goto close_err;

hdr_type_err:
    tutmsg("Compiled PDF has bad header record.", "TAE-CPDFBHDR", 0, 0, 0, 0, 0);
    goto close_err;

close_err:
    return(FAIL);
    }
コード例 #8
0
/* Full screen character sheet, skills only edition */
void printliberalskills(Creature &cr)
{
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   char str[200];
   char num[5];

   // Add name
   move(2,0);
   if(strcmp(cr.propername,cr.name)!=0)
   {
      addstr("Code name: ");
   }
   else
   {
      addstr("Name: ");
   }
   set_color(COLOR_WHITE,COLOR_BLACK,1);
   addstr(cr.name);
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   addstr(", ");
   gettitle(str,cr);
   addstr(str);
   addstr(" (");
   getrecruitcreature(str,cr.type);
   addstr(str);
   addstr(")");

   // Add all skills
   for(int s=0;s<SKILLNUM;s++)
   {
      if(s%3==0 && s<9)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(4,27*(s/3));
         addstr("SKILL");
         move(4,15+27*(s/3));
         addstr("NOW   MAX");
      }

      // Maxed skills are green
      if(cr.skill_cap(s,true)!=0 && cr.get_skill(s)>=cr.skill_cap(s,true))set_color(COLOR_CYAN,COLOR_BLACK,1);
      // About to level up skills are white
      else if(cr.get_skill_ip(s)>=100+(10*cr.get_skill(s))&&
         cr.get_skill(s)<cr.skill_cap(s,true))set_color(COLOR_WHITE,COLOR_BLACK,1);
      // <1 skills are dark gray
      else if(cr.get_skill(s)<1)set_color(COLOR_BLACK,COLOR_BLACK,1);
      // >=1 skills are light gray
      else set_color(COLOR_WHITE,COLOR_BLACK,0);

      move(5+s/3,27*(s%3));
      strcpy(str,Skill::get_name(s).c_str());
      strcat(str,": ");
      addstr(str);
      move(5+s/3,14+27*(s%3));
      sprintf(num,"%2d.",cr.get_skill(s));
      addstr(num);
      if(cr.get_skill_ip(s)<100+(10*cr.get_skill(s)))
      {
         if ((cr.get_skill_ip(s)*100)/(100+(10*cr.get_skill(s)))!=0)
         {
            itoa((cr.get_skill_ip(s)*100)/(100+(10*cr.get_skill(s))),num,10);
            if ((cr.get_skill_ip(s)*100)/(100+(10*cr.get_skill(s)))<10)
            {
               addstr("0");
            }
            addstr(num);
         }
         else addstr("00");
      }
      else
      {
         addstr("99+");
      }

      if(cr.skill_cap(s,true)==0 || cr.get_skill(s)<cr.skill_cap(s,true))
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(5+s/3,20+27*(s%3));
      sprintf(str,"%2d.00",cr.skill_cap(s,true));
      addstr(str);
   }
   set_color(COLOR_WHITE,COLOR_BLACK,0);
}
コード例 #9
0
/* character info at top of screen */
void printcreatureinfo(Creature *cr, unsigned char knowledge)
{
   char num[20],str[200];

   makedelimiter(1,0);

   set_color(COLOR_WHITE,COLOR_BLACK,0);
   move(1,2);
   addstr(cr->name);
   addstr(", ");
   gettitle(str,*cr);
   addstr(str);

   if(cr->prisoner!=NULL)
   {
      addstr(", holding ");
      switch(cr->prisoner->type)
      {
      case CREATURE_CORPORATE_CEO:addstr("a squirming CEO");break;
      case CREATURE_RADIOPERSONALITY:addstr("a crying Radio Personality");break;
      case CREATURE_NEWSANCHOR:addstr("smarmy News Anchor");break;
      case CREATURE_SCIENTIST_EMINENT:addstr("a frightened Eminent Scientist");break;
      case CREATURE_JUDGE_CONSERVATIVE:addstr("an angry Hangin' Judge");break;
      default:
         addstr(cr->prisoner->name);
         break;
      }
   }

   move(2,0);addstr("Hrt:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_HEART,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(3,0);addstr("Int:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_INTELLIGENCE,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(4,0);addstr("Wis:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_WISDOM,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(5,0);addstr("Hlth:   ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_HEALTH,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(2,11);addstr("Agi:    ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_AGILITY,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(3,11);addstr("Str:    ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_STRENGTH,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(4,11);addstr("Char:   ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_CHARISMA,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(5,11);
   addstr("Trans: ");
   long v=-1;
   if(showcarprefs==1)v=id_getcar(cr->pref_carid);
   else v=id_getcar(cr->carid);
   if(v!=-1&&showcarprefs!=-1)
   {
      strcpy(str,vehicle[v]->shortname().c_str());
      char d;
      if(showcarprefs==1)d=cr->pref_is_driver;
      else d=cr->is_driver;
      if(d)strcat(str,"-D");
   }
   else
   {
      int legok=2;
      if((cr->wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)||
         (cr->wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--;
      if((cr->wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)||
         (cr->wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--;
      if(cr->flag & CREATUREFLAG_WHEELCHAIR)strcpy(str,"Wheelchair");
      else if(legok>=1)strcpy(str,"On Foot");
      else strcpy(str,"On \"Foot\"");
   }
   addstr(str);
   move(6,0);
   if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
   else
      switch(weaponcheck(*cr))
   {
      case -1:
      case 0:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
      case 1:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
      case 2:set_color(COLOR_RED,COLOR_BLACK,1);break;
   }
   addstr("Weapon: ");
   addstr(cr->get_weapon_string(1).c_str());
   

   if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
   else
   {
      switch(hasdisguise(*cr))
      {
      case 1:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
      case 2:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
      default:
         if(cr->get_armor().get_stealth_value() > 1)
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         else
            set_color(COLOR_RED,COLOR_BLACK,1);
      }
      if(sitealarmtimer>=0 || sitealarm==1)
         if(cr->get_armor().get_stealth_value() > 1)
            set_color(COLOR_BLACK,COLOR_BLACK,1);
   }
   move(7,0);
   addstr("Clothes: ");
   addstr(cr->get_armor_string(false).c_str());

   set_color(COLOR_WHITE,COLOR_BLACK,0);

   char used[SKILLNUM];
   memset(used,0,sizeof(char)*SKILLNUM);

   int snum=5;
   char printed=1;

   while(snum>0&&printed)
   {
      printed=0;

      int max=0;
      long maxs=-1;
      for(int s=0;s<SKILLNUM;s++)
      {
         if(cr->get_skill(s)>max && !used[s])
         {
            max=cr->get_skill(s);
            maxs=s;
         }
      }

      if(maxs!=-1)
      {
         used[maxs]=1;
         printed=1;

         if(cr->get_skill_ip(maxs)>=100+(10*cr->get_skill(maxs))&&
            cr->get_skill(maxs)<cr->skill_cap(maxs,true))set_color(COLOR_WHITE,COLOR_BLACK,1);
         else set_color(COLOR_WHITE,COLOR_BLACK,0);

         move(3+5-snum,31);
         if(knowledge>5-snum)
            strcpy(str,Skill::get_name(maxs).c_str());
         else
            strcpy(str,"???????");
         strcat(str,": ");
         if(knowledge>7-snum)
            itoa(cr->get_skill(maxs),num,10);
         else
            strcpy(num,"?");
         strcat(str,num);
         addstr(str);

         if(snum==5&&printed)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(2,31);
            addstr("Top Skills:");
         }
      }

      snum--;
   }

   int woundsum=0;
   for(int w=0;w<BODYPARTNUM;w++)
   {
      if(cr->wound[w]!=0)woundsum++;
   }

   printhealthstat(*cr,1,49,FALSE);

   if(woundsum>0)
   {
      for(int w=0;w<BODYPARTNUM;w++)
      {
         if(cr->wound[w] & WOUND_BLEEDING)set_color(COLOR_RED,COLOR_BLACK,1);
         else set_color(COLOR_WHITE,COLOR_BLACK,0);

         move(2+w,49);
         switch(w)
         {
         case BODYPART_HEAD:addstr("Head:");break;
         case BODYPART_BODY:addstr("Body:");break;
         case BODYPART_ARM_RIGHT:addstr("Right Arm:");break;
         case BODYPART_ARM_LEFT:addstr("Left Arm:");break;
         case BODYPART_LEG_RIGHT:addstr("Right Leg:");break;
         case BODYPART_LEG_LEFT:addstr("Left Leg:");break;
         }

         move(2+w,61);
         if(cr->wound[w] & WOUND_NASTYOFF)addstr("Ripped off");
         else if(cr->wound[w] & WOUND_CLEANOFF)addstr("Clean sever");
         else
         {
            int sum=0;

            if(cr->wound[w] & WOUND_SHOT)sum++;
            if(cr->wound[w] & WOUND_CUT)sum++;
            if(cr->wound[w] & WOUND_BRUISED)sum++;
            if(cr->wound[w] & WOUND_BURNED)sum++;
            if(cr->wound[w] & WOUND_TORN)sum++;

            if(sum==0)
            {
               set_color(COLOR_GREEN,COLOR_BLACK,1);
               if(cr->animalgloss==ANIMALGLOSS_ANIMAL)
                  addstr("Animal");
               else
                  addstr("Liberal");
            }

            if(cr->wound[w] & WOUND_SHOT){addstr("Sht");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_BRUISED){addstr("Brs");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_CUT){addstr("Cut");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_TORN){addstr("Trn");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_BURNED){addstr("Brn");sum--;if(sum>0)addstr(",");}
         }
      }
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }
}
コード例 #10
0
/* full screen character sheet */
void printliberalstats(Creature &cr)
{
   set_color(COLOR_WHITE,COLOR_BLACK,0);

   char num[20],str[200];

   // Add name
   move(2,0);
   addstr("Name: ");
   set_color(COLOR_WHITE,COLOR_BLACK,1);
   addstr(cr.name);
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   if(strcmp(cr.propername,cr.name)!=0)
   {
      //The names do not match, print real name as well
      addstr(" (");
      addstr(cr.propername);
      addstr(")");
   }
   addstr(", ");
   gettitle(str,cr);
   addstr(str);
   addstr(" (");
   getrecruitcreature(str,cr.type);
   addstr(str);
   addstr(")");
   move(3,0);



   // Add birthdate
   addstr("Born ");
   switch(cr.birthday_month)
   {
   case 1:addstr("January");break;
   case 2:addstr("February");break;
   case 3:addstr("March");break;
   case 4:addstr("April");break;
   case 5:addstr("May");break;
   case 6:addstr("June");break;
   case 7:addstr("July");break;
   case 8:addstr("August");break;
   case 9:addstr("September");break;
   case 10:addstr("October");break;
   case 11:addstr("November");break;
   case 12:addstr("December");break;
   }
   addstr(" ");
   itoa(cr.birthday_day,num,10);
   addstr(num);
   addstr(", ");
   if(cr.birthday_month < month ||
      (cr.birthday_month == month && cr.birthday_day <= day))
   {
      itoa(year-cr.age,num,10);
   }
   else
   {
      itoa(year-1-cr.age,num,10);
   }
   addstr(num);
   // Add age
   addstr(" (Age ");
   itoa(cr.age,num,10);
   addstr(num);
   addstr(", ");
   // Add Liberal gender
   if(cr.gender_liberal == GENDER_FEMALE)
      addstr("Female");
   else if(cr.gender_liberal == GENDER_MALE)
      addstr("Male");
   else
      addstr("Androgynous");
   // Note if there's some conflict with Conservative society's perceptions
   //if(cr.gender_liberal != cr.gender_conservative)
   //   addstr("*");
   addstr(")");

   move(3,46);
   statebrokenlaws(cr);
   set_color(COLOR_WHITE,COLOR_BLACK,0);

   // Add juice
   move(10,16);
   addstr("Juice: ");
   itoa(cr.juice,num,10);
   addstr(num);
   if(cr.juice<1000)
   {
      move(11,16);addstr("Next:  ");
      if(cr.juice<0)addstr("0");
      else if(cr.juice<10)addstr("10");
      else if(cr.juice<50)addstr("50");
      else if(cr.juice<100)addstr("100");
      else if(cr.juice<200)addstr("200");
      else if(cr.juice<500)addstr("500");
      else addstr("1000");
   }
   // Add attributes
   move(5,0);addstr("Heart: ");
   itoa(cr.get_attribute(ATTRIBUTE_HEART,true),num,10);
   addstr(num);
   move(6,0);addstr("Intelligence: ");
   itoa(cr.get_attribute(ATTRIBUTE_INTELLIGENCE,true),num,10);
   addstr(num);
   move(7,0);addstr("Wisdom: ");
   itoa(cr.get_attribute(ATTRIBUTE_WISDOM,true),num,10);
   addstr(num);
   move(8,0);addstr("Health: ");
   itoa(cr.get_attribute(ATTRIBUTE_HEALTH,true),num,10);
   addstr(num);
   move(9,0);addstr("Agility: ");
   itoa(cr.get_attribute(ATTRIBUTE_AGILITY,true),num,10);
   addstr(num);
   move(10,0);addstr("Strength: ");
   itoa(cr.get_attribute(ATTRIBUTE_STRENGTH,true),num,10);
   addstr(num);
   move(11,0);addstr("Charisma: ");
   itoa(cr.get_attribute(ATTRIBUTE_CHARISMA,true),num,10);
   addstr(num);

   // Add highest skills
   char used[SKILLNUM];
   memset(used,0,sizeof(char)*SKILLNUM);

   int skills_max=16;
   char printed=1;

   move(5,28);
   addstr("SKILL");
   move(5,43);
   addstr("NOW   MAX");
   for(int skills_shown=0;skills_shown<skills_max&&printed;skills_shown++)
   {
      printed=0;

      int max=0;
      long maxs=-1;
      for(int s=0;s<SKILLNUM;s++)
      {
         if((cr.get_skill(s)*10000+cr.get_skill_ip(s))>max && !used[s])
         {
            max=(cr.get_skill(s)*10000+cr.get_skill_ip(s));
            maxs=s;
         }
      }

      if(maxs!=-1)
      {
         used[maxs]=1;
         printed=1;

         // Maxed skills are green
         if(cr.skill_cap(maxs,true)!=0 && cr.get_skill(maxs)>=cr.skill_cap(maxs,true))set_color(COLOR_CYAN,COLOR_BLACK,1);
         // About to level up skills are white
         else if(cr.get_skill_ip(maxs)>=100+(10*cr.get_skill(maxs))&&
            cr.get_skill(maxs)<cr.skill_cap(maxs,true))set_color(COLOR_WHITE,COLOR_BLACK,1);
         // <1 skills are dark gray
         else if(cr.get_skill(maxs)<1)set_color(COLOR_BLACK,COLOR_BLACK,1);
         // >=1 skills are light gray
         else set_color(COLOR_WHITE,COLOR_BLACK,0);

         move(6+skills_shown,28);
         strcpy(str,Skill::get_name(maxs).c_str());
         strcat(str,": ");
         addstr(str);
         move(6+skills_shown,42);
         sprintf(num,"%2d.",cr.get_skill(maxs));
         addstr(num);
         if(cr.get_skill_ip(maxs)<100+(10*cr.get_skill(maxs)))
         {
            if ((cr.get_skill_ip(maxs)*100)/(100+(10*cr.get_skill(maxs)))!=0)
            {
               itoa((cr.get_skill_ip(maxs)*100)/(100+(10*cr.get_skill(maxs))),num,10);
               if ((cr.get_skill_ip(maxs)*100)/(100+(10*cr.get_skill(maxs)))<10)
               {
                  addstr("0");
               }
               addstr(num);
            }
            else addstr("00");
         }
         else
         {
            addstr("99+");
         }

         if(cr.skill_cap(maxs,true)==0 || cr.get_skill(maxs)<cr.skill_cap(maxs,true))
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(6+skills_shown,48);
         sprintf(str,"%2d.00",cr.skill_cap(maxs,true));
         addstr(str);
      }
   }

   set_color(COLOR_WHITE,COLOR_BLACK,0);

   // Add weapon
   move(13,0);
   addstr("Weapon: ");
   addstr(cr.get_weapon_string(0).c_str());

   // Add clothing
   move(14,0);
   addstr("Clothes: ");
   addstr(cr.get_armor_string(true).c_str());


   // Add vehicle
   move(15,0);
   addstr("Car: ");
   long v=-1;
   if(showcarprefs==1)v=id_getcar(cr.pref_carid);
   else v=id_getcar(cr.carid);
   if(v!=-1&&showcarprefs!=-1)
   {
      strcpy(str,vehicle[v]->shortname().c_str());
      char d;
      if(showcarprefs==1)d=cr.pref_is_driver;
      else d=cr.is_driver;
      if(d)strcat(str,"-D");
   }
   else
   {
      int legok=2;
      if((cr.wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)||
         (cr.wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--;
      if((cr.wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)||
         (cr.wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--;
      if(cr.flag & CREATUREFLAG_WHEELCHAIR)strcpy(str,"Wheelchair");
      else if(legok>=1)strcpy(str,"On Foot");
      else strcpy(str,"On \"Foot\"");
   }
   addstr(str);

   // Add recruit stats
   if(cr.flag!=CREATUREFLAG_BRAINWASHED)
   {
      move(18,0);
      itoa(maxsubordinates(cr)-subordinatesleft(cr),num,10);
      addstr(num);
      addstr(" Recruits / ");
      itoa(maxsubordinates(cr),num,10);
      addstr(num);
      addstr(" Max");
   }
   else
   {
      move(18,0);
      addstr("Enlightened ");
      addstr("Can't Recruit");
   }
   // Any meetings with potential recruits scheduled?
   int recruiting = scheduledmeetings(cr);
   if(recruiting)
   {
      move(18,55);
      itoa(recruiting,num,10);
      addstr("Scheduled Meetings: ");
      addstr(num);
   }
   // Add seduction stats
   move(19,0); 
   int lovers = loveslaves(cr);
   if(cr.flag & CREATUREFLAG_LOVESLAVE)
      lovers++;
   if(lovers)
   {
      itoa(lovers,num,10);
      addstr(num);
      addstr(" Romantic Interest");
      if(lovers>1)addstr("s");
   }
   // Any dates with potential love interests scheduled?
   int wooing = scheduleddates(cr);
   if(wooing)
   {
      move(19,55);
      itoa(wooing,num,10);
      addstr("Scheduled Dates:    ");
      addstr(num);
   }

   // Add wound status
   for(int w=0;w<BODYPARTNUM;w++)
   {
      if(cr.wound[w] & WOUND_BLEEDING)set_color(COLOR_RED,COLOR_BLACK,1);
      else set_color(COLOR_WHITE,COLOR_BLACK,0);

      move(5+w,55);
      switch(w)
      {
      case BODYPART_HEAD:addstr("Head:");break;
      case BODYPART_BODY:addstr("Body:");break;
      case BODYPART_ARM_RIGHT:addstr("Right Arm:");break;
      case BODYPART_ARM_LEFT:addstr("Left Arm:");break;
      case BODYPART_LEG_RIGHT:addstr("Right Leg:");break;
      case BODYPART_LEG_LEFT:addstr("Left Leg:");break;
      }

      move(5+w,66);
      if(cr.wound[w] & WOUND_NASTYOFF)addstr("Ripped off");
      else if(cr.wound[w] & WOUND_CLEANOFF)addstr("Severed");
      else
      {
         int sum=0;

         if(cr.wound[w] & WOUND_SHOT)sum++;
         if(cr.wound[w] & WOUND_CUT)sum++;
         if(cr.wound[w] & WOUND_BRUISED)sum++;
         if(cr.wound[w] & WOUND_BURNED)sum++;
         if(cr.wound[w] & WOUND_TORN)sum++;

         if(sum==0)
         {
            set_color(COLOR_GREEN,COLOR_BLACK,1);
            if(cr.animalgloss==ANIMALGLOSS_ANIMAL)
               addstr("Animal");
            else
               addstr("Liberal");
         }

         if(cr.wound[w] & WOUND_SHOT){addstr("Shot");sum--;if(sum>0)addstr(",");}
         if(cr.wound[w] & WOUND_BRUISED){addstr("Bruised");sum--;if(sum>0)addstr(",");}
         if(cr.wound[w] & WOUND_CUT){addstr("Cut");sum--;if(sum>0)addstr(",");}
         if(cr.wound[w] & WOUND_TORN){addstr("Torn");sum--;if(sum>0)addstr(",");}
         if(cr.wound[w] & WOUND_BURNED){addstr("Burned");sum--;if(sum>0)addstr(",");}
      }
   }
   set_color(COLOR_WHITE,COLOR_BLACK,0);

   //SPECIAL WOUNDS
   set_color(COLOR_RED,COLOR_BLACK,0);

   int y=12;
   int x=55;
   if(cr.special[SPECIALWOUND_HEART]!=1)
   {
      move(y++,x);
      addstr("Heart Punctured");
   }
   if(cr.special[SPECIALWOUND_RIGHTLUNG]!=1)
   {
      move(y++,x);
      addstr("R. Lung Collapsed");
   }
   if(cr.special[SPECIALWOUND_LEFTLUNG]!=1)
   {
      move(y++,x);
      addstr("L. Lung Collapsed");
   }
   if(cr.special[SPECIALWOUND_NECK]!=1)
   {
      move(y++,x);
      addstr("Broken Neck");
   }
   if(cr.special[SPECIALWOUND_UPPERSPINE]!=1)
   {
      move(y++,x);
      addstr("Broken Up Spine");
   }
   if(cr.special[SPECIALWOUND_LOWERSPINE]!=1)
   {
      move(y++,x);
      addstr("Broken Lw Spine");
   }
   if(cr.special[SPECIALWOUND_RIGHTEYE]!=1)
   {
      move(y++,x);
      addstr("No Right Eye");
   }
   if(cr.special[SPECIALWOUND_LEFTEYE]!=1)
   {
      move(y++,x);
      addstr("No Left Eye");
   }
   if(cr.special[SPECIALWOUND_NOSE]!=1)
   {
      move(y++,x);
      addstr("No Nose");
   }
   if(cr.special[SPECIALWOUND_TONGUE]!=1)
   {
      move(y++,x);
      addstr("No Tongue");
   }
   if(cr.special[SPECIALWOUND_TEETH]!=TOOTHNUM)
   {
      move(y++,x);
      if(cr.special[SPECIALWOUND_TEETH]==0)addstr("No Teeth");
      else if(cr.special[SPECIALWOUND_TEETH]==TOOTHNUM-1)addstr("Missing a Tooth");
      else if(cr.special[SPECIALWOUND_TEETH]<TOOTHNUM)addstr("Missing Teeth");
   }
   if(cr.special[SPECIALWOUND_LIVER]!=1)
   {
      move(y++,x);
      addstr("Liver Damaged");
   }
   if(cr.special[SPECIALWOUND_RIGHTKIDNEY]!=1)
   {
      move(y++,x);
      addstr("R. Kidney Damaged");
   }
   if(cr.special[SPECIALWOUND_LEFTKIDNEY]!=1)
   {
      move(y++,x);
      addstr("L. Kidney Damaged");
   }
   if(cr.special[SPECIALWOUND_STOMACH]!=1)
   {
      move(y++,x);
      addstr("Stomach Injured");
   }
   if(cr.special[SPECIALWOUND_SPLEEN]!=1)
   {
      move(y++,x);
      addstr("Busted Spleen");
   }
   if(cr.special[SPECIALWOUND_RIBS]!=RIBNUM)
   {
      move(y++,x);
      if(cr.special[SPECIALWOUND_RIBS]==0)addstr("All Ribs Broken");
      else if(cr.special[SPECIALWOUND_RIBS]==RIBNUM-1)addstr("Broken Rib");
      else if(cr.special[SPECIALWOUND_RIBS]<RIBNUM)addstr("Broken Ribs");
   }

   set_color(COLOR_WHITE,COLOR_BLACK,0);
}
コード例 #11
0
ファイル: addmgrform.cpp プロジェクト: grcjamezz/boinctui
void AddAccMgrForm::genfields(int& line, Item* mgr) //создаст массив полей
{
    FIELD* f;
    delfields();
    //сообщение об ошибке
    errmsgfield = getfieldcount();
    f = addfield(new_field(1, getwidth()-2, line++, 0, 0, 0));
    set_field_buffer(f, 0, "Errr");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_RED) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    field_opts_off(f, O_VISIBLE); //по умолчанию невидима
    //получить url и имя менеджера (или из конфига или от boinc клиента
    if (mgr != NULL)
    {
        Item* url = mgr->findItem("url");
        if (url !=NULL)
	    mgrurl = url->getsvalue();
    }
    else
    {
        //взять url из конфига (если есть)
	Item* boinctui_cfg = gCfg->getcfgptr();
	if (boinctui_cfg != NULL)
	{
	    std::vector<Item*> mgrlist = boinctui_cfg->getItems("accmgr");
	    std::vector<Item*>::iterator it;
	    for (it = mgrlist.begin(); it != mgrlist.end(); it++)
	    {
		Item* name = (*it)->findItem("name");
		if (name != NULL)
		    if (name->getsvalue() == mgrname)
		    {
			Item* url = (*it)->findItem("url");
			if (url != NULL)
			{
			    mgrurl = url->getsvalue();
			    break;
			}
		    }
	    }
	}
    }
    //имя менеджера
    f = addfield(new_field(1, getwidth()-4, line, 2, 0, 0));
    set_field_buffer(f, 0, "Description  ");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    namefield = getfieldcount();
    f = addfield(new_field(1, 40, line++, 15, 0, 0));
    if (mgr != NULL)
    {
	field_opts_off(f, O_STATIC);
	field_opts_off(f, O_ACTIVE); //статический текст
    }
    else
	set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_CYAN) | A_BOLD);
    field_opts_off(f, O_AUTOSKIP);
    set_max_field(f,128); //max width 128
    char buf[129];
    strncpy(buf, gettitle(), 128);
    buf[128] = '\0';
    char* p;
    p = ltrim(buf);
    rtrim(buf);
    set_field_buffer(f, 0, p);
    //url
    line++;
    f = addfield(new_field(1, getwidth()-4, line, 2, 0, 0));
    set_field_buffer(f, 0, "URL          ");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    urlfield = getfieldcount();
    f = addfield(new_field(1, 40, line++, 15, 0, 0));
    if (mgr != NULL)
    {
	field_opts_off(f, O_STATIC);
	field_opts_off(f, O_ACTIVE); //статический текст
    }
    else
	set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_CYAN) | A_BOLD);
    field_opts_off(f, O_AUTOSKIP);
    set_max_field(f,128); //max width 128
    set_field_buffer(f, 0, mgrurl.c_str());
    //help
    line++;
    f = addfield(new_field(3, getwidth()-4, line++, 2, 0, 0));
    set_field_buffer(f, 0,  "If you have not yet registered with this account manager" \
    			"     please do so before proceeding.");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    line = line + 2;
    //user name
    line++;
    f = addfield(new_field(1, 10, line, 2 , 0, 0));
    set_field_buffer(f, 0, "username");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    usernamefield = getfieldcount();
    f = addfield(new_field(1, 40, line++, 15, 0, 0));
    field_opts_off(f, O_AUTOSKIP);
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_CYAN) | A_BOLD);
    //password
    line++;
    f = addfield(new_field(1, 10, line, 2 , 0, 0));
    set_field_buffer(f, 0, "password");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    passwfield = getfieldcount();
    f = addfield(new_field(1, 40, line++, 15, 0, 0));
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_CYAN) | A_BOLD);
    field_opts_off(f, O_AUTOSKIP);
    //подсказки
    line++;
    f = addfield(new_field(1, getwidth()-25, line++, 20 , 0, 0));
    set_field_buffer(f, 0, "Enter-Ok    Esc-Cancel");
    set_field_back(f, getcolorpair(COLOR_WHITE,COLOR_BLACK) | A_BOLD);
    field_opts_off(f, O_ACTIVE); //статический текст
    //финализация списка полей
    addfield(NULL);
}
コード例 #12
0
ファイル: hardcopy.c プロジェクト: noikiy/VICAR
FUNCTION CODE hard_help
(
    struct   SFILE	*fctx,		/* In: file context block for opened file	*/
    TEXT  		curlib[],	/* In: library name of opened file		*/
    TEXT		procname[],	/* In: proc name for LHS of help display	*/
    TEXT		outname[],	/* In: name of output file			*/
    struct  HELPBLK	*helpblk	/* out: help output control block		*/

)
{

    IMPORT  struct  VARIABLE *char_gbl;		/* system characteristics	*/

    struct DIRBLK	dirblk;		/* directive control block		*/
    struct TXTSTOR	title;		/* context for dynamically stored title text */
    struct SFILE	f;
    struct POSCTX	saved_pos;
    struct POSCTX	level2_pos;
    BOOL		has_level2;
    TEXT		str[STRINGSIZ+1];
    CODE		code;
    TEXT		field[STRINGSIZ+1];	/* text field after a directive	*/
    TEXT		name[STRINGSIZ+1];
    TEXT		key[KEYSIZ+1];
    TEXT		msg[STRINGSIZ+1];

    /* If no output name was given,	*/
    if (NULLSTR(outname))		/* use pdf or command name	*/
    {
        f_name(procname, outname);
        s_append(".MEM", outname);	/* procname.MEM for output	*/
    }

    /* note -- SAVELUN is safe because |save| qual is not allowed for this command */
    code = f_ophf(&f, SAVELUN, outname, F_WRITE);	/* open output file	*/
    if (code != SUCCESS)
    {
        sprintf(msg, "Error opening output, host code = %d", f.host_code);
        store_help_error(helpblk, msg, "TAE-OPNWRT");
        return(FAIL);
    }

    d_init(&dirblk, fctx, curlib, (TEXT **)(*char_gbl).v_cvp,
           (*char_gbl).v_count);    		/* init directive block		*/
    if ((*helpblk).compiled)			/* if PDF is compiled		*/
    {
        if ((code = prep_c_help(&dirblk, &title, msg, key)) != SUCCESS)	/* prepare*/
            goto put_error;
        str[0] = EOS;
    }
    else					/* PDF is not compiled		*/
    {
        code = d_dirctv(&dirblk, str, field);
        if (s_equal(str, ".TITLE"))
        {   /* read the title into dynamic store			*/
            if ((code = gettitle(&dirblk, &title, msg, key))!= SUCCESS)
                goto put_error;
            code = d_dirctv(&dirblk, str, field);
        }
        else				/* no title */
        {
            title.numline = 0;
        }
    }

    code = put_title(&f, &title, msg, key);  /* start filling output file */
    if (code != SUCCESS) goto put_error;

    if (title.tp != NULL) fretxt(&title); /* free the dyamically-stored title	*/

    /* str should contain .HELP directive now.  If not, find it	*/
    if (! s_equal( str, ".HELP"))
    {
        code = d_search(&dirblk, ".HELP", field);
        if (code != SUCCESS)
        {
            store_help_error(helpblk, "No help available on '%s'.", "TAE-NOHELP");
            return (FAIL);
        }
    }

    code = put_text_block(&f, &dirblk, msg, key);	/* output general help	*/
    if (code != SUCCESS) goto put_error;

    code = d_search(&dirblk, ".LEVEL1", field);
    if (code != SUCCESS)		/* if there is no level1 help then */
        goto return_success;		/* assume we are done and exit	   */

    f_movpos(CURRENT_POS, &saved_pos);		/* save position in input */
    code = d_search(&dirblk, ".LEVEL2", field); /* find detailed help */
    has_level2 = (code == SUCCESS);
    if (has_level2)				/* if detailed help exists,  */
        f_movpos(CURRENT_POS, &level2_pos);	/* save the position in file */

    f_setpos(dirblk.sfileptr, &saved_pos);	/* reset position to curr pos */
    code = d_dirctv(&dirblk, str, name);	/* gives str=".TITLE"	     */

    while (1)
    {
        code = d_dirctv(&dirblk, str, name);
        if (code != SUCCESS)			/* if no more directives, we */
            break;				/* are done		     */

        if (s_equal(str, ".END") || s_equal(str, ".LEVEL2")) /* done */
            break;

        code = put_header(&f, &dirblk, str, name, msg, key);
        if (code != SUCCESS) goto put_error;
        if (has_level2)
            code = put_level2_text(&f, &dirblk, &level2_pos,
                                   str, name, msg, key);
        if (code != SUCCESS) goto put_error;
    }

return_success:
    f_close(&f, F_KEEP);
    s_lower(outname);
    sprintf(msg, "Wrote file \"%s\".", outname);
    put_stdout(msg);
    return (SUCCESS);

put_error:
    store_help_error(helpblk, msg, key);
    return (FAIL);
}