Beispiel #1
0
void MN_DrawCredits(void)
{
   static int cat_width = -1, val_width = -1, line_x;
   int i, y;
   const char *str;

   if(cat_width == -1)
   {
      // determine widest category string
      int w;

      for(i = 0; i < NUMCATS; ++i)
      {
         w = V_FontStringWidth(menu_font_normal, cat_strs[i]);

         if(w > cat_width)
            cat_width = w;
      }

      // determine widest value string
      for(i = 0; i < NUMCATS; ++i)
      {
         w = V_FontStringWidth(menu_font_normal, val_strs[i]);

         if(w > val_width)
            val_width = w;
      }

      // determine line position
      line_x = (SCREENWIDTH - (cat_width + val_width + 16)) >> 1;
   }
Beispiel #2
0
//
// HU_CenterMessage
//
// haleyjd 04/27/04: rewritten to use qstring
//
void HU_CenterMessage(const char *s)
{
   static qstring qstr(128);
   int st_height = GameModeInfo->StatusBar->height;

   qstr.clear();

   // haleyjd 02/28/06: colored center message
   if(centermsg_color)
   {
      qstr += centermsg_color;
      centermsg_color = NULL;
   }
   
   qstr += s;
  
   centermessage_widget.setMessage(qstr.constPtr(),
      (SCREENWIDTH - V_FontStringWidth(hud_font, s)) / 2,
      (SCREENHEIGHT - V_FontStringHeight(hud_font, s) -
       ((scaledwindow.height == SCREENHEIGHT) ? 0 : st_height - 8)) / 2,
       leveltime + (message_timer * 35) / 1000);
   
   // print message to console also
   C_Printf("%s\n", s);
}
Beispiel #3
0
//
// HU_MessageDraw
//
// Drawer for the player message widget.
//
static void HU_MessageDraw(hu_widget_t *widget)
{
   int i, y;
   hu_msgwidget_t *mw = (hu_msgwidget_t *)widget;
   
   if(!showMessages)
      return;
   
   // go down a bit if chat active
   y = chat_active ? 8 : 0;
   
   for(i = 0; i < mw->current_messages; i++, y += 8)
   {
      int x = 0;
      char *msg = mw->messages[i];

      // haleyjd 12/26/02: center messages in proper gamemodes
      // haleyjd 08/26/12: center also if in widescreen modes
      if(GameModeInfo->flags & GIF_CENTERHUDMSG || 
         vbscreen.getVirtualAspectRatio() > 4 * FRACUNIT / 3)
      {
         x = (SCREENWIDTH - V_FontStringWidth(hud_font, msg)) >> 1;
      }
      
      // haleyjd 06/04/05: use V_FontWriteTextColored like it should.
      // Color codes within strings will still override the default.
      V_FontWriteTextColored(hud_font, msg, mess_colour, x, y, &subscreen43);
   }
Beispiel #4
0
//
// MN_SkinInstructions
//
// Draws some v_font strings to the screen to tell the user how
// to operate this beast.
//
static void MN_SkinInstructions()
{
   const char *msg = FC_RED "skin viewer";

   int x = 160 - V_FontStringWidth(menu_font_big, msg) / 2;
   int y = 8;
   int color = GameModeInfo->titleColor;

   // draw a title at the top, too
   if(GameModeInfo->flags & GIF_SHADOWTITLES)
   {
      V_FontWriteTextShadowed(menu_font_big, msg, x, y, &subscreen43, color);
   }
   else
   {
      V_FontWriteTextColored(menu_font_big, msg, color, x, y, &subscreen43);
   }

   // haleyjd 05/29/06: rewrote to be binding neutral and to draw all of
   // it with one call to V_FontWriteText instead of five.
   V_FontWriteText(menu_font_normal, 
               "Instructions:\n"
               FC_GRAY "left"  FC_RED " = rotate left, "
               FC_GRAY "right" FC_RED " = rotate right\n"
               FC_GRAY "ctrl"  FC_RED " = fire, "
               FC_GRAY "p"     FC_RED " = pain, "
               FC_GRAY "d"     FC_RED " = die, "
               FC_GRAY "x"     FC_RED " = gib\n"
               FC_GRAY "space" FC_RED " = respawn, "
               FC_GRAY "h"     FC_RED " = half-speed\n"
               FC_GRAY "toggle or previous" FC_RED " = exit", 
               4, INSTR_Y, &subscreen43);
}
Beispiel #5
0
//
// HI_drawOldLevelName
//
// Draws previous level name and "FINISHED" centered,
// starting at the given y coordinate.
//
static void HI_drawOldLevelName(int y)
{
   int x;
   const char *oldLevelName;

   if(mapName)
      oldLevelName = mapName;
   else
      oldLevelName = "new level";

   x = (SCREENWIDTH - V_FontStringWidth(in_bigfont, oldLevelName)) / 2;
   V_FontWriteTextShadowed(in_bigfont, oldLevelName, x, y, &subscreen43);

   x = (SCREENWIDTH - V_FontStringWidth(in_font, HIS_FINISHED)) / 2;
   V_FontWriteText(in_font, HIS_FINISHED, x, y + 22, &subscreen43);
}
Beispiel #6
0
//
// HI_drawNewLevelName
//
// Draws "NOW ENTERING:" and the destination level name centered,
// starting at the given y coordinate.
//
static void HI_drawNewLevelName(int y)
{
   int x;
   const char *thisLevelName;

   x = (SCREENWIDTH - V_FontStringWidth(in_font, HIS_NOWENTERING)) >> 1;
   V_FontWriteText(in_font, HIS_NOWENTERING, x, y, &subscreen43);

   if(nextMapName)
      thisLevelName = nextMapName;
   else
      thisLevelName = "new level";

   x = (SCREENWIDTH - V_FontStringWidth(in_bigfont, thisLevelName)) >> 1;
   V_FontWriteTextShadowed(in_bigfont, thisLevelName, x, y + 10, &subscreen43);
}
Beispiel #7
0
//
// WriteCenteredText
//
// Local routine to draw centered messages. Candidate for
// absorption into future generalized font code. Rewritten
// 02/22/04 to use qstring module. 
//
static void WriteCenteredText(char *message)
{
   static qstring qstr;
   char *rover;
   const char *buffer;
   int x, y;
   int w, h;

   qstr.clearOrCreate(128);
   
   // rather than reallocate memory every time we draw it,
   // use one buffer and increase the size as neccesary
   // haleyjd 02/22/04: qstring handles this for us now

   w = V_FontStringWidth(menu_font_normal, popup_message);
   h = V_FontStringHeight(menu_font_normal, popup_message);

   x = (SCREENWIDTH  - w) / 2;
   y = (SCREENHEIGHT - h) / 2;
   qstr.clear();
   rover = message;

   if(popup_widget.prev) // up over another widget?
      V_DrawBox(x - 8, y - 8, w + 16, h + 16);

   while(*rover)
   {
      if(*rover == '\n')
      {
         buffer = qstr.constPtr();
         x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
         V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);         
         qstr.clear(); // clear buffer
         y += menu_font_normal->absh; // next line
      }
      else      // add next char
         qstr += *rover;

      ++rover;
   }

   // dont forget the last line.. prob. not \n terminated
   buffer = qstr.constPtr();
   x = (SCREENWIDTH - V_FontStringWidth(menu_font_normal, buffer)) / 2;
   V_FontWriteText(menu_font_normal, buffer, x, y, &subscreen43);   
}
Beispiel #8
0
//
// HUDLevelTimeWidget::clear
//
// Handles HU_Start actions for the level time widget
//
void HUDLevelTimeWidget::clear()
{
   if(GameModeInfo->flags & GIF_HUDSTATBARNAME && LevelInfo.levelName)
   {
      int len = V_FontStringWidth(hud_font, LevelInfo.levelName);

      // If level name is too long, move the timer up one row;
      // otherwise, restore to the normal position.
      if(len >= x)
         y = SCREENHEIGHT - ST_HEIGHT - (hud_font->absh * 2 + 1);
      else
         y = SCREENHEIGHT - ST_HEIGHT - hud_font->absh;
   }
}
Beispiel #9
0
//
// G_BindDrawer
//
// Draw the prompt box
//
void G_BindDrawer(void)
{
   const char *msg = "\n -= input new key =- \n";
   int x, y, width, height;
   
   // draw the menu in the background   
   MN_DrawMenu(current_menu);
   
   width  = V_FontStringWidth(menu_font_normal, msg);
   height = V_FontStringHeight(menu_font_normal, msg);
   x = (SCREENWIDTH  - width)  / 2;
   y = (SCREENHEIGHT - height) / 2;
   
   // draw box   
   V_DrawBox(x - 4, y - 4, width + 8, height + 8);

   // write text in box   
   V_FontWriteText(menu_font_normal, msg, x, y, &subscreen43);
}
Beispiel #10
0
//
// HUDTextWidget::drawer
//
// Default drawing function for a text widget.
//
void HUDTextWidget::drawer()
{
   // Do not ever draw automap-only widgets if not in automap mode.
   // This fixes a long-standing bug automatically.
   if(flags & TW_AUTOMAP_ONLY && !automapactive)
      return;

   // 10/08/05: boxed message support
   if(flags & TW_BOXED)
   {
      int width, height;

      width  = V_FontStringWidth (font, message);
      height = V_FontStringHeight(font, message);

      V_DrawBox(x - 4, y - 4, width + 8, height + 8);
   }

   if(message && (!cleartic || leveltime < cleartic))
   {
      edefstructvar(vtextdraw_t, vdt);
      
      vdt.font   = font;
      vdt.s      = message;
      vdt.x      = x;
      vdt.y      = y;
      vdt.screen = &subscreen43;
      if(color)
      {
         vdt.flags       = VTXT_FIXEDCOLOR;
         vdt.fixedColNum = color - 1;
      }
      else
         vdt.flags = VTXT_NORMAL;

      V_FontWriteTextEx(vdt);
   }
}
Beispiel #11
0
//
// HUDMessageWidget::drawer
//
// Drawer for the player message widget.
//
void HUDMessageWidget::drawer()
{
   if(!showMessages)
      return;

   edefstructvar(vtextdraw_t, vtd);

   vtd.font        = hud_font;
   vtd.screen      = &subscreen43;
   vtd.flags       = VTXT_FIXEDCOLOR;
   vtd.fixedColNum = mess_colour;
   
   // go down a bit if chat active
   vtd.y = chat_active ? hud_font->absh : 0;
   
   for(int i = 0; i < current_messages; i++)
   {
      char *msg = messages[i];
      
      // haleyjd 12/26/02: center messages in proper gamemodes
      // haleyjd 08/26/12: center also if in widescreen modes
      if(GameModeInfo->flags & GIF_CENTERHUDMSG || 
         vbscreen.getVirtualAspectRatio() > 4 * FRACUNIT / 3)
      {
         vtd.x = (SCREENWIDTH - V_FontStringWidth(hud_font, msg)) / 2;
         vtd.flags |= VTXT_ABSCENTER;
      }
      else
         vtd.x = 0;
      
      vtd.s = msg;

      V_FontWriteTextEx(vtd);

      vtd.y += V_FontStringHeight(hud_font, msg);
   }
}