Exemplo n.º 1
0
//
// Draw toggle value
//
static void FE_DrawToggleValue(femenuitem_t *item, int x, int y)
{
    const char *text;
    boolean val    = M_GetIntVariableDefault(item->verb);
    boolean invert = ((item->data & FE_TOGGLE_INVERT) == FE_TOGGLE_INVERT);

    text = (val ^ invert) ? "On" : "Off";
    item->valx = x;
    item->valy = y;

    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->valw = M_StringWidth(text);
        item->valh = 12;
        M_WriteText(x, y, text);
        break;
    case FE_FONT_BIG:
        item->valw = V_BigFontStringWidth(text);
        item->valh = 20;
        V_WriteBigText(text, x, y);
        break;
    default:
        item->valw = item->valh = 0;
        break;
    }
}
Exemplo n.º 2
0
//
// Draw lobby ready value
//
static void FE_DrawLobbyReadyValue(femenuitem_t *item, int x, int y)
{
    const char *text;
    boolean val = FE_GetLobbyReady();

    text = val ? "Ready" : "Not Ready";
    item->valx = x;
    item->valy = y;

    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->valw = M_StringWidth(text);
        item->valh = 12;
        M_WriteText(x, y, text);
        break;
    case FE_FONT_BIG:
        item->valw = V_BigFontStringWidth(text);
        item->valh = 20;
        V_WriteBigText(text, x, y);
        break;
    default:
        item->valw = item->valh = 0;
        break;
    }
}
Exemplo n.º 3
0
//
// Draw gamepad axis binding value
//
static void FE_DrawJAValue(femenuitem_t *item, int x, int y)
{
    int axis = M_GetIntVariable(item->verb);
    const char *name = FE_AxisNameForNum(axis);

    item->valx = x;
    item->valy = y;

    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->valw = M_StringWidth(name);
        item->valh = 12;
        M_WriteText(x, y, name);
        break;
    case FE_FONT_BIG:
        item->valw = V_BigFontStringWidth(name);
        item->valh = 20;
        V_WriteBigText(name, x, y);
        break;
    default:
        item->valw = item->valh = 0;
        break;
    }
}
Exemplo n.º 4
0
void HU_Start(void)
{
    char        *s = strdup(automaptitle);
    int         len = strlen(s);

    if (headsupactive)
        HU_Stop();

    plr = &players[0];
    message_on = false;
    message_dontfuckwithme = false;
    message_nottobefuckedwith = false;

    // create the message widget
    HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART,
        &message_on);

    // create the map title widget
    HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART);

    while (M_StringWidth(s) > ORIGINALWIDTH - 6)
    {
        s[len - 1] = s[len] = s[len + 1] = '.';
        s[len + 2] = '\0';
        --len;
    }

    while (*s)
        HUlib_addCharToTextLine(&w_title, *(s++));

    headsupactive = true;

    hudnumoffset = (16 - SHORT(tallnum[0]->height)) / 2;
}
Exemplo n.º 5
0
//
// Draw mouse binding value
//
static void FE_DrawMBValue(femenuitem_t *item, int x, int y)
{
    int feMVarNum    = item->data;
    int mbNum        = *(feMVars[feMVarNum]);
    const char *name = FE_NameForCfgMouseButton(mbNum);
    
    item->valx = x;
    item->valy = y;

    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->valw = M_StringWidth(name);
        item->valh = 12;
        M_WriteText(x, y, name);
        break;
    case FE_FONT_BIG:
        item->valw = V_BigFontStringWidth(name);
        item->valh = 20;
        V_WriteBigText(name, x, y);
        break;
    default:
        item->valw = item->valh = 0;
        break;
    }
}
Exemplo n.º 6
0
//
//  M_SaveGame & Cie.
//
void M_DrawSave(void)
{
	int             i;

	V_DrawPatchDirect (72,28,0,(patch_t*)W_CacheLumpName("M_SAVEG",PU_CACHE_SHARED));
	for (i = 0;i < load_end; i++)
	{
		M_DrawSaveLoadBorder(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i);
		M_WriteText(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i,::g->savegamestrings[i]);
	}

	if (::g->saveStringEnter)
	{
		i = M_StringWidth(::g->savegamestrings[::g->saveSlot]);
		M_WriteText(::g->LoadDef.x + i,::g->LoadDef.y+LINEHEIGHT*::g->saveSlot,"_");
	}
}
Exemplo n.º 7
0
//
// haleyjd: As above, but for the situation of a client waiting for the initial
// startup info packet from the server.
//
void NET_RenderSteamServerStart(void)
{
    const char *strConn = "Connecting Netgame";
    const char *strWait = "Waiting for server...";
    int strConnWidth    = V_BigFontStringWidth(strConn);
    int strWaitWidth    = M_StringWidth(strWait);

    if(use3drenderer)
        RB_ClearBuffer(GLCB_COLOR);

    V_DrawFilledBox(0, 0, SCREENWIDTH, SCREENHEIGHT, 0);
    V_WriteBigText(strConn, (SCREENWIDTH - strConnWidth)/2, 60);
    
    if(net_SteamNodeType != NET_STEAM_SERVER)
        M_WriteText((SCREENWIDTH - strWaitWidth)/2, 100, strWait);

    I_FinishUpdate();
}
Exemplo n.º 8
0
//
// Draw menu item description
//
static int FE_DrawDescription(femenuitem_t *item, int x, int y)
{
    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->w = M_StringWidth(item->description);
        item->h = 12;
        M_WriteText(x, y, item->description);
        break;
    case FE_FONT_BIG:
        item->w = V_BigFontStringWidth(item->description);
        item->h = 20;
        V_WriteBigText(item->description, x, y);
        break;
    default:
        item->w = item->h = 0;
        break;
    }

    return item->h;
}
Exemplo n.º 9
0
//
// Draw video mode string
//
static void FE_DrawVideoMode(femenuitem_t *item, int x, int y)
{
    const char *text = FE_CurrentVideoMode();

    item->valx = x;
    item->valy = y;

    switch(item->font)
    {
    case FE_FONT_SMALL:
        item->valw = M_StringWidth(text);
        item->valh = 12;
        M_WriteText(x, y, text);
        break;
    case FE_FONT_BIG:
        item->valw = V_BigFontStringWidth(text);
        item->valh = 20;
        V_WriteBigText(text, x, y);
        break;
    default:
        item->valw = item->valh = 0;
        break;
    }
}
Exemplo n.º 10
0
// Show map name and author.
void R_DrawLevelTitle(void)
{
	float   alpha = 1;
	int     y = 12;
	char   *lname, *lauthor, *ptr;

#if 0
	char    buf[80];

	//int st = players[consoleplayer].plr->psprites[0].state;
	sprintf(buf, "p0:%p/%p p1:%p/%p",	/*st==0? "bob" : st==1? "fire" : st==2? "down" : "up" */
			players[0].psprites[0].state, players[0].psprites[1].state,
			players[1].psprites[0].state, players[1].psprites[1].state);
	/*sprintf(buf, "p%i r%i", players[consoleplayer].pendingweapon,
	   players[consoleplayer].readyweapon); */
	M_WriteText(10, 50, buf);
#endif

	if(!cfg.levelTitle || actual_leveltime > 6 * 35)
		return;

	// Make the text a bit smaller.
	gl.MatrixMode(DGL_MODELVIEW);
	gl.PushMatrix();
	gl.Translatef(160, y, 0);
	gl.Scalef(.7f, .7f, 1);
	gl.Translatef(-160, -y, 0);

	if(actual_leveltime < 35)
		alpha = actual_leveltime / 35.0f;
	if(actual_leveltime > 5 * 35)
		alpha = 1 - (actual_leveltime - 5 * 35) / 35.0f;

	lname = (char *) Get(DD_MAP_NAME);
	lauthor = (char *) Get(DD_MAP_AUTHOR);
	// Plutonia and TNT are special cases.
	if(gamemission == pack_plut)
	{
		lname = mapnamesp[gamemap - 1];
		lauthor = PLUT_AUTHOR;
	}
	else if(gamemission == pack_tnt)
	{
		lname = mapnamest[gamemap - 1];
		lauthor = TNT_AUTHOR;
	}
	gl.Color4f(1, 1, 1, alpha);
	if(lname)
	{
		ptr = strchr(lname, ':');	// Skip the E#M# or Level #.
		if(ptr)
		{
			lname = ptr + 1;
			while(*lname && isspace(*lname))
				lname++;
		}
		M_WriteText2(160 - M_StringWidth(lname, hu_font_b) / 2, y, lname,
					 hu_font_b, -1, -1, -1);
		y += 14;				//9;
	}
	gl.Color4f(.5f, .5f, .5f, alpha);
	if(lauthor && (!cfg.hideAuthorIdSoft || stricmp(lauthor, "id software")))
	{
		M_WriteText2(160 - M_StringWidth(lauthor, hu_font) / 2, y, lauthor,
					 hu_font_a, -1, -1, -1);
	}

	gl.MatrixMode(DGL_MODELVIEW);
	gl.PopMatrix();
}
Exemplo n.º 11
0
//
// M_Drawer
// Called after the view has been rendered,
// but before it has been blitted.
//
void M_Drawer (void)
{
	unsigned short		i;
	short		max;
	char		string[40];
	int			start;

	::g->inhelpscreens = false;


	// Horiz. & Vertically center string and print it.
	if (::g->messageToPrint)
	{
		start = 0;
		::g->md_y = 100 - M_StringHeight(::g->messageString)/2;
		while(*(::g->messageString+start))
		{
			for (i = 0;i < strlen(::g->messageString+start);i++)
				if (*(::g->messageString+start+i) == '\n')
				{
					memset(string,0,40);
					strncpy(string,::g->messageString+start,i);
					start += i+1;
					break;
				}

				if (i == strlen(::g->messageString+start))
				{
					strcpy(string,::g->messageString+start);
					start += i;
				}

				::g->md_x = 160 - M_StringWidth(string)/2;
				M_WriteText(::g->md_x,::g->md_y,string);
				::g->md_y += SHORT(::g->hu_font[0]->height);
		}
		return;
	}


	if (!::g->menuactive)
		return;

	if (::g->currentMenu->routine)
		::g->currentMenu->routine();         // call Draw routine

	// DRAW MENU
	::g->md_x = ::g->currentMenu->x;
	::g->md_y = ::g->currentMenu->y;
	max = ::g->currentMenu->numitems;

	for (i=0;i<max;i++)
	{
		if (::g->currentMenu->menuitems[i].name[0])
			V_DrawPatchDirect (::g->md_x,::g->md_y,0,
			(patch_t*)W_CacheLumpName(::g->currentMenu->menuitems[i].name ,PU_CACHE_SHARED));
		::g->md_y += LINEHEIGHT;
	}


	// DRAW SKULL
	V_DrawPatchDirect(::g->md_x + SKULLXOFF,::g->currentMenu->y - 5 + ::g->itemOn*LINEHEIGHT, 0,
		(patch_t*)W_CacheLumpName(skullName[::g->whichSkull],PU_CACHE_SHARED));
}
Exemplo n.º 12
0
//
// M_Responder
//
qboolean M_Responder (event_t* ev)
{
	int             ch;
	int             i;

	ch = -1;

	if (ev->type == ev_joystick && ::g->joywait < I_GetTime())
	{
		if (ev->data3 == -1)
		{
			ch = KEY_UPARROW;
			::g->joywait = I_GetTime() + 5;
		}
		else if (ev->data3 == 1)
		{
			ch = KEY_DOWNARROW;
			::g->joywait = I_GetTime() + 5;
		}

		if (ev->data2 == -1)
		{
			ch = KEY_LEFTARROW;
			::g->joywait = I_GetTime() + 2;
		}
		else if (ev->data2 == 1)
		{
			ch = KEY_RIGHTARROW;
			::g->joywait = I_GetTime() + 2;
		}

		if (ev->data1&1)
		{
			ch = KEY_ENTER;
			::g->joywait = I_GetTime() + 5;
		}
		if (ev->data1&2)
		{
			ch = KEY_BACKSPACE;
			::g->joywait = I_GetTime() + 5;
		}
	}
	else
	{
		if (ev->type == ev_mouse && ::g->mousewait < I_GetTime())
		{
			::g->mmenu_mousey += ev->data3;
			if (::g->mmenu_mousey < ::g->lasty-30)
			{
				ch = KEY_DOWNARROW;
				::g->mousewait = I_GetTime() + 5;
				::g->mmenu_mousey = ::g->lasty -= 30;
			}
			else if (::g->mmenu_mousey > ::g->lasty+30)
			{
				ch = KEY_UPARROW;
				::g->mousewait = I_GetTime() + 5;
				::g->mmenu_mousey = ::g->lasty += 30;
			}

			::g->mmenu_mousex += ev->data2;
			if (::g->mmenu_mousex < ::g->lastx-30)
			{
				ch = KEY_LEFTARROW;
				::g->mousewait = I_GetTime() + 5;
				::g->mmenu_mousex = ::g->lastx -= 30;
			}
			else if (::g->mmenu_mousex > ::g->lastx+30)
			{
				ch = KEY_RIGHTARROW;
				::g->mousewait = I_GetTime() + 5;
				::g->mmenu_mousex = ::g->lastx += 30;
			}

			if (ev->data1&1)
			{
				ch = KEY_ENTER;
				::g->mousewait = I_GetTime() + 15;
			}

			if (ev->data1&2)
			{
				ch = KEY_BACKSPACE;
				::g->mousewait = I_GetTime() + 15;
			}
		} else 
	if (ev->type == ev_keydown)
		{
			ch = ev->data1;
		}
	}

	if (ch == -1)
		return false;


	// Save Game string input
	if (::g->saveStringEnter)
	{
		switch(ch)
		{
		case KEY_BACKSPACE:
			if (::g->saveCharIndex > 0)
			{
				::g->saveCharIndex--;
				::g->savegamestrings[::g->saveSlot][::g->saveCharIndex] = 0;
			}
			break;

		case KEY_ESCAPE:
			::g->saveStringEnter = 0;
			strcpy(&::g->savegamestrings[::g->saveSlot][0],::g->saveOldString);
			break;

		case KEY_ENTER:
			::g->saveStringEnter = 0;
			if (::g->savegamestrings[::g->saveSlot][0])
				M_DoSave(::g->saveSlot);
			break;

		default:
			ch = toupper(ch);
			if (ch != 32)
				if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE)
					break;
			if (ch >= 32 && ch <= 127 &&
				::g->saveCharIndex < SAVESTRINGSIZE-1 &&
				M_StringWidth(::g->savegamestrings[::g->saveSlot]) <
				(SAVESTRINGSIZE-2)*8)
			{
				::g->savegamestrings[::g->saveSlot][::g->saveCharIndex++] = ch;
				::g->savegamestrings[::g->saveSlot][::g->saveCharIndex] = 0;
			}
			break;
		}
		return true;
	}

	// Take care of any messages that need input
	if (::g->messageToPrint)
	{
		if (::g->messageNeedsInput == true &&
			!(ch == KEY_ENTER || ch == KEY_BACKSPACE || ch == KEY_ESCAPE))
			return false;

		::g->menuactive = ::g->messageLastMenuActive;
		::g->messageToPrint = 0;
		if (::g->messageRoutine)
			::g->messageRoutine(ch);

		S_StartSound(NULL,sfx_swtchx);
		return true;
	}
/*
	if (::g->devparm && ch == KEY_F1)
	{
		G_ScreenShot ();
		return true;
	}

	// F-Keys
	if (!::g->menuactive)
		switch(ch)
	{
		case KEY_MINUS:         // Screen size down
			if (::g->automapactive || ::g->chat_on)
				return false;
			//M_SizeDisplay(0);
			S_StartSound(NULL,sfx_stnmov);
			return true;

		case KEY_EQUALS:        // Screen size up
			if (::g->automapactive || ::g->chat_on)
				return false;
			//M_SizeDisplay(1);
			S_StartSound(NULL,sfx_stnmov);
			return true;

		case KEY_F1:            // Help key
			M_StartControlPanel ();

			if ( ::g->gamemode == retail )
				::g->currentMenu = &::g->ReadDef2;
			else
				::g->currentMenu = &::g->ReadDef1;

			::g->itemOn = 0;
			S_StartSound(NULL,sfx_swtchn);
			return true;

		case KEY_F2:            // Save
			M_StartControlPanel();
			S_StartSound(NULL,sfx_swtchn);
			M_SaveGame(0);
			return true;

		case KEY_F3:            // Load
			M_StartControlPanel();
			S_StartSound(NULL,sfx_swtchn);
			M_LoadGame(0);
			return true;

		case KEY_F4:            // Sound Volume
			M_StartControlPanel ();
			::g->currentMenu = &::g->SoundDef;
			::g->itemOn = sfx_vol;
			S_StartSound(NULL,sfx_swtchn);
			return true;

		case KEY_F5:            // Detail toggle
			M_ChangeDetail(0);
			S_StartSound(NULL,sfx_swtchn);
			return true;

		case KEY_F6:            // Quicksave
			S_StartSound(NULL,sfx_swtchn);
			M_QuickSave();
			return true;

		case KEY_F7:            // End game
			S_StartSound(NULL,sfx_swtchn);
			M_EndGame(0);
			return true;

		case KEY_F8:            // Toggle messages
			M_ChangeMessages(0);
			S_StartSound(NULL,sfx_swtchn);
			return true;

		case KEY_F9:            // Quickload
			S_StartSound(NULL,sfx_swtchn);
			M_QuickLoad();
			return true;

		case KEY_F10:           // Quit DOOM
			S_StartSound(NULL,sfx_swtchn);
			M_QuitDOOM(0);
			return true;

		case KEY_F11:           // gamma toggle
			::g->usegamma++;
			if (::g->usegamma > 4)
				::g->usegamma = 0;
			::g->players[::g->consoleplayer].message = gammamsg[::g->usegamma];
			I_SetPalette ((byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
			return true;

	}
*/

	// Pop-up menu?
	if (!::g->menuactive)
	{
		if (ch == KEY_ESCAPE && ( ::g->gamestate == GS_LEVEL || ::g->gamestate == GS_INTERMISSION || ::g->gamestate == GS_FINALE  ) )
		{
			M_StartControlPanel ();

			S_StartSound(NULL,sfx_swtchn);
			return true;
		}
		
		return false;
	}

	// Keys usable within menu
	switch (ch)
	{
	case KEY_DOWNARROW:
		do
		{
			if (::g->itemOn+1 > ::g->currentMenu->numitems-1)
				::g->itemOn = 0;
			else ::g->itemOn++;
			S_StartSound(NULL,sfx_pstop);
		} while(::g->currentMenu->menuitems[::g->itemOn].status==-1);
		return true;

	case KEY_UPARROW:
		do
		{
			if (!::g->itemOn)
				::g->itemOn = ::g->currentMenu->numitems-1;
			else ::g->itemOn--;
			S_StartSound(NULL,sfx_pstop);
		} while(::g->currentMenu->menuitems[::g->itemOn].status==-1);
		return true;

	case KEY_LEFTARROW:
		if (::g->currentMenu->menuitems[::g->itemOn].routine &&
			::g->currentMenu->menuitems[::g->itemOn].status == 2)
		{
			S_StartSound(NULL,sfx_stnmov);
			::g->currentMenu->menuitems[::g->itemOn].routine(0);
		}
		return true;

	case KEY_RIGHTARROW:
		if (::g->currentMenu->menuitems[::g->itemOn].routine &&
			::g->currentMenu->menuitems[::g->itemOn].status == 2)
		{
			S_StartSound(NULL,sfx_stnmov);
			::g->currentMenu->menuitems[::g->itemOn].routine(1);
		}
		return true;

	case KEY_ENTER:
		if (::g->currentMenu->menuitems[::g->itemOn].routine &&
			::g->currentMenu->menuitems[::g->itemOn].status)
		{
			::g->currentMenu->lastOn = ::g->itemOn;
			if (::g->currentMenu->menuitems[::g->itemOn].status == 2)
			{
				::g->currentMenu->menuitems[::g->itemOn].routine(1);      // right arrow
				S_StartSound(NULL,sfx_stnmov);
			}
			else
			{
				::g->currentMenu->menuitems[::g->itemOn].routine(::g->itemOn);
				S_StartSound(NULL,sfx_pistol);
			}
		}
		return true;

	case KEY_ESCAPE:
	case KEY_BACKSPACE:
		::g->currentMenu->lastOn = ::g->itemOn;
		if (::g->currentMenu->prevMenu)
		{
			::g->currentMenu = ::g->currentMenu->prevMenu;
			::g->itemOn = ::g->currentMenu->lastOn;
			S_StartSound(NULL,sfx_swtchn);
		} else if ( ::g->currentMenu == &::g->MainDef && ( !::g->demoplayback && ::g->gamestate != GS_DEMOSCREEN ) ) {
			M_ClearMenus();
			::g->paused = false;
		}
		return true;

	default:
		for (i = ::g->itemOn+1;i < ::g->currentMenu->numitems;i++)
			if (::g->currentMenu->menuitems[i].alphaKey == ch)
			{
				::g->itemOn = i;
				S_StartSound(NULL,sfx_pstop);
				return true;
			}
			for (i = 0;i <= ::g->itemOn;i++)
				if (::g->currentMenu->menuitems[i].alphaKey == ch)
				{
					::g->itemOn = i;
					S_StartSound(NULL,sfx_pstop);
					return true;
				}
				break;

	}

	return false;
}
Exemplo n.º 13
0
int ConTextWidth(char *text)
{
	return M_StringWidth(text, hu_font_a);
}
Exemplo n.º 14
0
//
// M_Drawer
// Called after the view has been rendered,
// but before it has been blitted.
//
void M_Drawer (void)
{
  static short	x;
  static short	y;
  short			i;
  short			max;
  char			string[40];
  int				start;

  inhelpscreens = false;


  // Horiz. & Vertically center string and print it.
  if (messageToPrint)
  {
    start = 0;
    y = (short)(100 - M_StringHeight(messageString)/2);
    while(*(messageString+start))
    {
      for (i = 0;i < CGDstrlen(messageString+start);i++)
        if (*(messageString+start+i) == '\n')
        {
          memset(string,0,40);
          CGDstrncpy(string,messageString+start,i);
          start += i+1;
          break;
        }

        if (i == CGDstrlen(messageString+start))
        {
          CGDstrcpy(string,messageString+start);
          start += i;
        }

        x = (short)(160 - M_StringWidth(string)/2);
        M_WriteText(x,y,string);
        y = y + SHORT(hu_font[0]->height);
    }
    return;
  }

  if (!menuactive)
    return;

  if (currentMenu->routine)
    currentMenu->routine();         // call Draw routine

  // DRAW MENU
  x = currentMenu->x;
  y = currentMenu->y;
  max = currentMenu->numitems;

  for (i=0;i<max;i++)
  {
    if (currentMenu->menuitems[i].name[0])
      V_DrawPatchDirect (x,y,0,W_CacheLumpNamePatch(currentMenu->menuitems[i].name ,PU_CACHE));
    y += LINEHEIGHT;
  }


  // DRAW SKULL
  V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0,W_CacheLumpNamePatch(skullName[whichSkull],PU_CACHE));
}
Exemplo n.º 15
0
/*
 * Draw a string of text controlled by parameter blocks.
 */
void WI_DrawParamText(int x, int y, char *string, dpatch_t * defFont,
					  float defRed, float defGreen, float defBlue,
					  boolean defCase, boolean defTypeIn)
{
	char    temp[256], *end;
	dpatch_t *font = defFont;
	float   r = defRed, g = defGreen, b = defBlue;
	float   offX = 0, offY = 0;
	float   scaleX = 1, scaleY = 1, angle = 0, extraScale;
	float   cx = x, cy = y;
	int     charCount = 0;
	boolean typeIn = defTypeIn;
	boolean caseScale = defCase;
	struct {
		float   scale, offset;
	} caseMod[2];				// 1=upper, 0=lower
	int     curCase;

	caseMod[0].scale = 1;
	caseMod[0].offset = 3;
	caseMod[1].scale = 1.25f;
	caseMod[1].offset = 0;

	while(*string)
	{
		// Parse and draw the replacement string.
		if(*string == '{')		// Parameters included?
		{
			string++;
			while(*string && *string != '}')
			{
				string = M_SkipWhite(string);

				// What do we have here?
				if(!strnicmp(string, "fonta", 5))
				{
					font = hu_font_a;
					string += 5;
				}
				else if(!strnicmp(string, "fontb", 5))
				{
					font = hu_font_b;
					string += 5;
				}
				else if(!strnicmp(string, "flash", 5))
				{
					string += 5;
					typeIn = true;
				}
				else if(!strnicmp(string, "noflash", 7))
				{
					string += 7;
					typeIn = false;
				}
				else if(!strnicmp(string, "case", 4))
				{
					string += 4;
					caseScale = true;
				}
				else if(!strnicmp(string, "nocase", 6))
				{
					string += 6;
					caseScale = false;
				}
				else if(!strnicmp(string, "ups", 3))
				{
					string += 3;
					caseMod[1].scale = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "upo", 3))
				{
					string += 3;
					caseMod[1].offset = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "los", 3))
				{
					string += 3;
					caseMod[0].scale = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "loo", 3))
				{
					string += 3;
					caseMod[0].offset = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "break", 5))
				{
					string += 5;
					cx = x;
					cy += scaleY * SHORT(font[0].height);
				}
				else if(!strnicmp(string, "r", 1))
				{
					string++;
					r = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "g", 1))
				{
					string++;
					g = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "b", 1))
				{
					string++;
					b = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "x", 1))
				{
					string++;
					offX = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "y", 1))
				{
					string++;
					offY = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "scalex", 6))
				{
					string += 6;
					scaleX = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "scaley", 6))
				{
					string += 6;
					scaleY = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "scale", 5))
				{
					string += 5;
					scaleX = scaleY = WI_ParseFloat(&string);
				}
				else if(!strnicmp(string, "angle", 5))
				{
					string += 5;
					angle = WI_ParseFloat(&string);
				}
				else
				{
					// Unknown, skip it.
					if(*string != '}')
						string++;
				}
			}

			// Skip over the closing brace.
			if(*string)
				string++;
		}

		for(end = string; *end && *end != '{';)
		{
			if(caseScale)
			{
				curCase = -1;
				// Select a substring with characters of the same case
				// (or whitespace).
				for(; *end && *end != '{'; end++)
				{
					// We can skip whitespace.
					if(isspace(*end))
						continue;

					if(curCase < 0)
						curCase = (isupper(*end) != 0);
					else if(curCase != (isupper(*end) != 0))
						break;
				}
			}
			else
			{
				// Find the end of the visible part of the string.
				for(; *end && *end != '{'; end++);
			}

			strncpy(temp, string, end - string);
			temp[end - string] = 0;
			string = end;		// Continue from here.

			// Setup the scaling.
			gl.MatrixMode(DGL_MODELVIEW);
			gl.PushMatrix();

			// Rotate.
			if(angle != 0)
			{
				// The origin is the specified (x,y) for the patch.
				// We'll undo the VGA aspect ratio (otherwise the result would
				// be skewed).
				gl.Translatef(x, y, 0);
				gl.Scalef(1, 200.0f / 240.0f, 1);
				gl.Rotatef(angle, 0, 0, 1);
				gl.Scalef(1, 240.0f / 200.0f, 1);
				gl.Translatef(-x, -y, 0);
			}

			gl.Translatef(cx + offX,
						  cy + offY +
						  (caseScale ? caseMod[curCase].offset : 0), 0);
			extraScale = (caseScale ? caseMod[curCase].scale : 1);
			gl.Scalef(scaleX, scaleY * extraScale, 1);

			// Draw it.
			M_WriteText3(0, 0, temp, font, r, g, b, typeIn,
						 typeIn ? charCount : 0);
			charCount += strlen(temp);

			// Advance the current position.
			cx += scaleX * M_StringWidth(temp, font);

			gl.MatrixMode(DGL_MODELVIEW);
			gl.PopMatrix();
		}
	}
}
Exemplo n.º 16
0
//
// haleyjd 20141022: [SVE] Alternate waiting on Steam clients
//
void NET_WaitForSteamLaunch(void)
{
    boolean isServer = (net_SteamNodeType == NET_STEAM_SERVER);
    const char *strConn = "Connecting Netgame";
    char numConn[64];
    char pressStr[64];
    char pressStr2[64];
    int strConnWidth, pressStrWidth, pressStrX, numConnWidth;
    const char *keyActivateName = GetNameForKey(key_menu_activate);
    const char *keyForwardName  = GetNameForKey(key_menu_forward);

    if(!keyActivateName)
        keyActivateName = "key_menu_activate";
    if(!keyForwardName)
        keyForwardName  = "key_menu_forward";

    M_snprintf(pressStr, sizeof(pressStr), "(Press %s to cancel%c",
               keyActivateName, isServer ? ',' : ')');
    if(isServer)
    {
        M_snprintf(pressStr2, sizeof(pressStr2), "%s to start now)",
                   keyForwardName);
    }
    strConnWidth  = V_BigFontStringWidth(strConn);
    pressStrWidth = M_StringWidth(pressStr);
    pressStrX     = (SCREENWIDTH - pressStrWidth) / 2;

    expected_nodes = net_SteamNumNodes;

    while(net_waiting_for_launch)
    {
        event_t *ev;

        CheckAutoLaunch();

        I_StartTic();
        
        while((ev = D_PopEvent()))
        {
            switch(ev->type)
            {
            case ev_keydown:
                if(ev->data1 == key_menu_activate)
                    I_Quit();
                if(ev->data1 == key_menu_forward && isServer)
                    StartGame(NULL, NULL);
                break;
            default:
                break;
            }
        }

        if(use3drenderer)
            RB_ClearBuffer(GLCB_COLOR);

        M_snprintf(numConn, sizeof(numConn), "%d of %d nodes connected",
                   NumConnected(), net_SteamNumNodes);
        numConnWidth = M_StringWidth(numConn);

        V_DrawFilledBox(0, 0, SCREENWIDTH, SCREENHEIGHT, 0);
        V_WriteBigText(strConn, (SCREENWIDTH - strConnWidth)/2, 60);
        M_WriteText((SCREENWIDTH - numConnWidth)/2, 100, numConn);
        M_WriteText(pressStrX, 112, pressStr);
        if(isServer)
            M_WriteText(pressStrX+12, 124, pressStr2);

        NET_CL_Run();
        NET_SV_Run();

        if(!net_client_connected)
            I_Error("Lost connection to server");

        I_FinishUpdate();
        I_Sleep(100);        
    }
}