static void
showTimeLeft(int t, int max)
{
    char    buf[BUFSIZ];
    int     cx, cy, ex, ey, tx, ty;

    if ((max - t) < 10 && t & 1) {
	W_Beep();
	W_Deiconify(baseWin);
    }
    if (iconified)
	drawIcon();
    /* XFIX */
    W_ClearArea(qwin, 0, 0, BOXSIDE, BOXSIDE);

    W_DrawImageNoClip(qwin, 0, 0, 0, getImage(I_CLOCK), foreColor);

    cx = BOXSIDE / 2;
    cy = BOXSIDE / 2 - 6;
    ex = cx - 35 * Sin[((255 * t) / max + 64) % 256];
    ey = cy - 35 * Cos[((255 * t) / max + 64) % 256];
    W_MakeLine(qwin, cx, cy, ex, ey, foreColor);

    sprintf(buf, "%d", max - t);
    cy = BOXSIDE / 2 - 1;
    tx = cx - (int)W_StringWidth(buf, W_RegularFont) / 2;
    ty = cy - W_Textheight;
    W_WriteText(qwin, tx, ty, textColor, buf, strlen(buf), W_RegularFont);
}
Exemple #2
0
static void box(int filled, int x, int y, int wid, int hei, W_Color color)
{
  if (wid == 0)
    return;

  if (filled)
    {
      /* XFIX */
      W_FillArea(statwin, x, y, wid + 1, hei + 1, color);
      return;
    }

  W_MakeLine(statwin, x, y, x + wid, y, color);
  W_MakeLine(statwin, x + wid, y, x + wid, y + hei, color);
  W_MakeLine(statwin, x + wid, y + hei, x, y + hei, color);
  W_MakeLine(statwin, x, y + hei, x, y, color);
}
static void
showPics(W_Window win)
{
    struct piclist *temp;
    int     page;

    page = currpage->page;
    temp = motdPics;

    while (temp != NULL) {
	if (page == temp->page) {
	    if (temp->thepic)
		W_DrawImage(win, temp->x, temp->y, 0, temp->thepic, foreColor);
	    else {
		W_MakeLine(win, temp->x, temp->y,
			   temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey);
		W_MakeLine(win, temp->x, temp->y + temp->height - 1,
			   temp->x + temp->width - 1, temp->y, W_Grey);
		W_MakeLine(win, temp->x, temp->y,
			   temp->x + temp->width - 1, temp->y, W_Grey);
		W_MakeLine(win, temp->x, temp->y,
			   temp->x, temp->y + temp->height - 1, W_Grey);
		W_MakeLine(win, temp->x, temp->y + temp->height - 1,
			   temp->x + temp->width - 1, temp->y + temp->height - 1, W_Grey);
		W_MakeLine(win, temp->x + temp->width - 1, temp->y + temp->height - 1,
			   temp->x + temp->width - 1, temp->y, W_Grey);
	    }
	}
	temp = temp->next;
    }
}
void
drawIcon(void)
{
    if (!iconified) {
	me_messages = 0;
	team_messages = 0;
	all_messages = 0;
    }
	iconified = 1;
    if (!infoIcon) {
        W_DrawImageNoClip(iconWin, 0, 0, 0, getImage(I_ICON), W_White);
    } else {			/* code for information icon 1/15 [BDyess] */
	int     side, bottom, top, digits, x, i;
	char    buf[50];
	W_Image *iconimage = getImage(I_ICON);

	W_ClearWindow(iconWin);
	side = iconimage->width / number_of_teams;
	bottom = 0 + side;
	top = 0;
	W_MakeLine(iconWin, 0, bottom, iconimage->width,bottom,W_White);
	for (i = 0; i <= number_of_teams; i++) {	/* draw the vertical
							   lines */
	    x = i * side;
	    x = (x > iconimage->width) ? iconimage->width : x;
	    W_MakeLine(iconWin, x, bottom, x, top, W_White);
	}
	for (i = 0; i < number_of_teams; i++) {
	    sprintf(buf, "%d", numShips(i));
	    digits = strlen(buf);
	    W_WriteText(iconWin, i * side + side / 2 - digits * W_Textwidth / 2,
			bottom - side / 2 - W_Textheight / 2,
			shipCol[i + 1], buf, digits, W_RegularFont);
	}
	if (me->p_status == PALIVE) {
#define TOP iconimage->height-10
	    if (me->p_flags & PFGREEN)
		W_FillArea(iconWin, 0, TOP, iconimage->width,
			   iconimage->height, W_Green);
	    else if (me->p_flags & PFYELLOW)
		W_FillArea(iconWin, 0, TOP,
			   iconimage->width, iconimage->height,
			   W_Yellow);
	    else if (me->p_flags & PFRED)
		W_FillArea(iconWin, 0, TOP,
			   iconimage->width, iconimage->height,
			   W_Red);
	}
	if (me_messages) {
	    sprintf(buf, "Personal: %d", me_messages);
	    W_WriteText(iconWin, 1, bottom + 2, W_White, buf, strlen(buf),
			W_RegularFont);
	}
	if (team_messages) {
	    sprintf(buf, "Team:     %d", team_messages);
	    W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
	if (all_messages) {
	    sprintf(buf, "All:      %d", all_messages);
	    W_WriteText(iconWin, 1, bottom + 2 + 2 * W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
	if (me->p_status == POUTFIT) {
	    sprintf(buf, "Time left: %d", autoQuit - elapsed);
	    W_WriteText(iconWin, 1, bottom + 2 + W_Textheight, W_White, buf,
			strlen(buf), W_RegularFont);
	}
    }
}
Exemple #5
0
static void
        db_bar(char *l, int x, int y, int w, int h, int m, int t, int v, int b)
{
  int     i, hgt, val_pix, tmax_pix, yellow_pix, red_pix;
  int     label_len;
  char    label[32];


  W_ClearArea(tstatw, x, y, w, h);

  if (b)
    {
      val_pix = (w * v) / m;
    }
  else
    {
      val_pix = (w * (m - v)) / m;
    }

  tmax_pix = (w * t) / m;
  yellow_pix = w / 3;
  red_pix = (2 * w) / 3;

  if ((t < 0) ||
      (t > m) ||
      (v < 0) ||
      (v > m))
    {
      W_FillArea(tstatw, x, y, w, h, W_Red);

      W_MaskText(tstatw,
     x + w - (3 * W_Textwidth) - 2,
     y + h - W_Textheight - 2,
     W_White, l, 3, W_BoldFont);

      label_len = db_itoa(label, v);

      W_MaskText(tstatw,
     x, y,
     W_White, label, label_len, W_BoldFont);

      label_len = db_itoa(label, t);

      if (t == m)
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_Grey, label, label_len, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_White, label, label_len, W_RegularFont);
  }
    }
  else
    {
      for (i = 0; i < w; i++)
  {
    hgt = h - ((h * i) / w);

    if ((i >= tmax_pix) && (i % 2))
      {
        W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Grey);
      }
    else if (i <= val_pix)
      {
        if (i < yellow_pix)
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Green);
    }
        else if (i < red_pix)
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Yellow);
    }
        else
    {
      W_MakeLine(tstatw, x + i, y + hgt, x + i, y + h, W_Red);
    }
      }
  }

      if (b ? (v > (m / 2)) : (v < (m / 2)))
  {
    W_MaskText(tstatw,
         x + w - (3 * W_Textwidth) - 2,
         y + h - W_Textheight - 2,
         W_White, l, 3, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x + w - (3 * W_Textwidth) - 2,
         y + h - W_Textheight - 2,
         W_Grey, l, 3, W_RegularFont);
  }

      label_len = db_itoa(label, v);

      if (b ? (v > (m / 2)) : (v < (m / 2)))
  {
    W_MaskText(tstatw,
         x, y,
         W_White, label, label_len, W_BoldFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y,
         W_Grey, label, label_len, W_BoldFont);
  }

      label_len = db_itoa(label, t);

      if (t == m)
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_Grey, label, label_len, W_RegularFont);
  }
      else
  {
    W_MaskText(tstatw,
         x, y + W_Textheight + 2,
         W_White, label, label_len, W_RegularFont);
  }
    }

  W_MakeLine(tstatw, x, y + h, x + w, y + h, W_Grey);
  W_MakeLine(tstatw, x + w, y, x + w, y + h, W_Grey);
}