Exemplo n.º 1
0
// ////////////////////////////////////////////////////////////////////////////
static void displayLoadSlot(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
{

    UDWORD	x = xOffset + psWidget->x;
    UDWORD	y = yOffset + psWidget->y;
    char  butString[64];

    drawBlueBox(x, y, psWidget->width, psWidget->height);	//draw box

    if (((W_BUTTON *)psWidget)->pText)
    {
        sstrcpy(butString, ((W_BUTTON *)psWidget)->pText);

        iV_SetFont(font_regular);									// font
        iV_SetTextColour(WZCOL_TEXT_BRIGHT);

        while (iV_GetTextWidth(butString) > psWidget->width)
        {
            butString[strlen(butString)-1] = '\0';
        }

        //draw text
        iV_DrawText(butString, x + 4, y + 17);
    }
}
Exemplo n.º 2
0
// ////////////////////////////////////////////////////////////////////////////
static void displayLoadSlot(struct _widget *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
{
	
	UDWORD	x = xOffset+psWidget->x;
	UDWORD	y = yOffset+psWidget->y;
	UWORD	im = (UWORD)UNPACKDWORD_TRI_B((UDWORD)psWidget->pUserData);
	UWORD	im2= (UWORD)(UNPACKDWORD_TRI_C((UDWORD)psWidget->pUserData));
	STRING  butString[64];

	UNUSEDPARAMETER(pColours);
	drawBlueBox(x,y,psWidget->width,psWidget->height);	//draw box
	if(((W_BUTTON *)psWidget)->pTip )
	{
		strcpy(butString,((W_BUTTON *)psWidget)->pTip);
		
		iV_SetFont(WFont);									// font
		iV_SetTextColour(-1);								//colour

		while(iV_GetTextWidth(butString) > psWidget->width)
		{
			butString[strlen(butString)-1]='\0';
		}

		//draw text								
		iV_DrawText( butString, x+4, y+17);

	}
}
Exemplo n.º 3
0
// ////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{

	UDWORD	x = xOffset+psWidget->x;
	UDWORD	y = yOffset+psWidget->y;
	UDWORD	count;
	char  butString[255];

	strcpy(butString,((W_BUTTON *)psWidget)->pTip);

	drawBlueBox(x,y,psWidget->width,psWidget->height);	//draw box

	iV_SetFont(font_regular);					// font
	iV_SetTextColour(WZCOL_TEXT_BRIGHT);

	while(iV_GetTextWidth(butString) > psWidget->width -10 )
	{
		butString[strlen(butString)-1]='\0';
	}

	iV_DrawText(butString, x + 6, y + 12);	//draw text

	// if map, then draw no. of players.
	for(count=0;count<psWidget->UserData;count++)
	{
		iV_DrawImage(FrontImages,IMAGE_WEE_GUY,(x+(6*count)+6),y+16);
	}
}
Exemplo n.º 4
0
// ////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
void displayRequestOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
	LEVEL_DATASET *mapData = (LEVEL_DATASET *)psWidget->pUserData;

	int x = xOffset + psWidget->x();
	int y = yOffset + psWidget->y();
	char  butString[255];

	sstrcpy(butString, ((W_BUTTON *)psWidget)->pTip.toUtf8().constData());

	drawBlueBox(x, y, psWidget->width(), psWidget->height());

	iV_SetFont(font_regular);					// font
	iV_SetTextColour(WZCOL_TEXT_BRIGHT);

	while (iV_GetTextWidth(butString) > psWidget->width() - 10)
	{
		butString[strlen(butString)-1]='\0';
	}

	iV_DrawText(butString, x + 6, y + 12);	//draw text

	if (mapData != NULL)
	{
		// Display map hash, so we can see the difference between identically named maps.
		Sha256 hash = mapData->realFileHash;  // levGetFileHash can be slightly expensive.
		static uint32_t lastHashTime = 0;
		if (lastHashTime != realTime && hash.isZero())
		{
			hash = levGetFileHash(mapData);
			if (!hash.isZero())
			{
				lastHashTime = realTime;  // We just calculated a hash. Don't calculate any more hashes this frame.
			}
		}
		if (!hash.isZero())
		{
			iV_SetFont(font_small);
			iV_SetTextColour(WZCOL_TEXT_DARK);
			sstrcpy(butString, hash.toString().c_str());
			while (iV_GetTextWidth(butString) > psWidget->width() - 10 - (8 + mapData->players*6))
			{
				butString[strlen(butString) - 1] = '\0';
			}
			iV_DrawText(butString, x + 6 + 8 + mapData->players*6, y + 26);
			iV_SetFont(font_regular);
		}

		// if map, then draw no. of players.
		for (int count = 0; count < mapData->players; ++count)
		{
			iV_DrawImage(FrontImages, IMAGE_WEE_GUY, x + 6*count + 6, y + 16);
		}
	}
}
Exemplo n.º 5
0
static void displayCamTypeBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
	UDWORD	x = xOffset+psWidget->x;
	UDWORD	y = yOffset+psWidget->y;
	char buffer[8];

	drawBlueBox(x,y,psWidget->width,psWidget->height);	//draw box
	sprintf(buffer, "T%i", (int)(psWidget->UserData));
	if ((unsigned int)(psWidget->UserData) == current_tech) {
		iV_SetTextColour(WZCOL_TEXT_BRIGHT);
	} else {
		iV_SetTextColour(WZCOL_TEXT_MEDIUM);
	}
	iV_DrawText(buffer, x+2, y+12);
}
Exemplo n.º 6
0
static void displayStructureBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
	int x = xOffset + psWidget->x();
	int y = yOffset + psWidget->y();
	int w = psWidget->width();
	int h = psWidget->height();
	STRUCTURE_STATS	*stat = asStructureStats + psWidget->UserData;
	Position position;
	Vector3i rotation;
	char str[20];

	UDWORD scale,Radius;

	drawBlueBox(x,y,w,h);

	// draw image
	pie_SetGeometricOffset(x + 35, y + psWidget->height()/2 + 9);
	rotation.x = -15;
	rotation.y = ((realTime/45)%360) ; //45
	rotation.z = 0;
	position.x = 0;
	position.y = 0;
	position.z = BUTTON_DEPTH*2;//getStructureStatSize(stat)  * 38 * OBJECT_RADIUS;

	Radius = getStructureStatSizeMax(stat);
	if(Radius <= 128) {
		scale = SMALL_STRUCT_SCALE;
	} else if(Radius <= 256) {
		scale = MED_STRUCT_SCALE;
	} else {
		scale = LARGE_STRUCT_SCALE;
	}

	pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
	displayStructureStatButton(stat, &rotation, &position, true, scale);
	pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);

	// draw name
	iV_SetFont(font_regular);											// font
	iV_SetTextColour(WZCOL_TEXT_BRIGHT);
	iV_DrawText(_(getName(stat->pName)), x + 80, y + psWidget->height()/2 + 3);

	// draw limit
	ssprintf(str, "%d", ((W_SLIDER *)widgGetFromID(psWScreen, psWidget->id + 1))->pos);
	iV_DrawText(str, x + 270, y + psWidget->height()/2 + 3);

	return;
}
Exemplo n.º 7
0
/** Displays all the console messages */
void	displayConsoleMessages(void)
{
    // Check if we have any messages we want to show
    if (!getNumberConsoleMessages() && !bConsoleDropped && !InfoMessages.size())
    {
        return;
    }

    // scripts can disable the console
    if (!bConsoleDisplayEnabled && !InfoMessages.size())
    {
        return;
    }

    iV_SetFont(font_regular);

    pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON);
    pie_SetFogStatus(false);

    if (bConsoleDropped)
    {
        displayOldMessages(HistoryMode);
    }

    std::lock_guard<wz::mutex> lck(mtx);  // Don't iterate without a lock.
    if (InfoMessages.size())
    {
        auto i = InfoMessages.end() - 1;		// we can only show the last one...
        setConsoleTextColor(i->player);

        int tmp = pie_GetVideoBufferWidth();
        drawBlueBox(0, 0,tmp, 18);
        tmp -= iV_GetTextWidth(i->text.c_str());
        iV_DrawFormattedText(i->text.c_str(), tmp - 6, linePitch - 2, iV_GetTextWidth(i->text.c_str()), i->JustifyType);
    }
    int TextYpos = mainConsole.topY;
    // Draw the blue background for the text (only in game, not lobby)
    if (bTextBoxActive && GetGameMode() == GS_NORMAL)
    {
        iV_TransBoxFill(mainConsole.topX - CON_BORDER_WIDTH, mainConsole.topY - mainConsole.textDepth - CON_BORDER_HEIGHT,
                        mainConsole.topX + mainConsole.width, mainConsole.topY + (getNumberConsoleMessages() * linePitch) + CON_BORDER_HEIGHT - linePitch);
    }
    for (auto i = ActiveMessages.begin(); i != ActiveMessages.end(); ++i)
    {
        setConsoleTextColor(i->player);
        TextYpos = iV_DrawFormattedText(i->text.c_str(), mainConsole.topX, TextYpos, mainConsole.width, i->JustifyType);
    }
}
Exemplo n.º 8
0
static void displayCamTypeBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
	int x = xOffset + psWidget->x();
	int y = yOffset + psWidget->y();
	char buffer[8];

	iV_SetFont(font_regular);
	drawBlueBox(x, y, psWidget->width(), psWidget->height());
	sprintf(buffer, "T%i", (int)(psWidget->UserData));
	if ((unsigned int)(psWidget->UserData) == current_tech) {
		iV_SetTextColour(WZCOL_TEXT_BRIGHT);
	} else {
		iV_SetTextColour(WZCOL_TEXT_MEDIUM);
	}
	iV_DrawText(buffer, x+2, y+12);
}
Exemplo n.º 9
0
static void displayNumPlayersBut(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
	UDWORD	x = xOffset+psWidget->x;
	UDWORD	y = yOffset+psWidget->y;
	char buffer[8];

	drawBlueBox(x,y,psWidget->width,psWidget->height);	//draw box
	if ((unsigned int)(psWidget->UserData) == current_numplayers) {
		iV_SetTextColour(WZCOL_TEXT_BRIGHT);
	} else {
		iV_SetTextColour(WZCOL_TEXT_MEDIUM);
	}
	if ((unsigned int)(psWidget->UserData) == 0) {
		sprintf(buffer, " *");
	} else {
		sprintf(buffer, "%iP", (int)(psWidget->UserData));
		buffer[2] = '\0';  // Truncate 'P' if 2 digits, since there isn't room.
	}
	iV_DrawText(buffer, x+2, y+12);

}
Exemplo n.º 10
0
// ////////////////////////////////////////////////////////////////////////////
// display a keymap on the interface.
static void displayKeyMap(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours)
{
	UDWORD		x = xOffset+psWidget->x;
	UDWORD		y = yOffset+psWidget->y;
	UDWORD		w = psWidget->width;
	UDWORD		h = psWidget->height;
	KEY_MAPPING *psMapping = (KEY_MAPPING*)psWidget->pUserData;
	char		sKey[MAX_STR_LENGTH];

	if(psMapping == selectedKeyMap)
	{
		pie_BoxFill(x, y, x + w, y + h, WZCOL_KEYMAP_ACTIVE);
	}
	else if(psMapping->status == KEYMAP_ALWAYS || psMapping->status == KEYMAP_ALWAYS_PROCESS)
	{
		// when user can't edit something...
		pie_BoxFill(x, y , x + w, y + h, WZCOL_KEYMAP_FIXED);
	}
	else
	{
		drawBlueBox(x,y,w,h);
	}

	// draw name
	iV_SetFont(font_regular);											// font type
	iV_SetTextColour(WZCOL_FORM_TEXT);

	iV_DrawText(_(psMapping->pName), x + 2, y + (psWidget->height / 2) + 3);

	// draw binding
	keyMapToString(sKey, psMapping);
	// Check to see if key is on the numpad, if so tell user and change color
	if (psMapping->subKeyCode >= KEY_KP_0 && psMapping->subKeyCode <= KEY_KPENTER)
	{
		iV_SetTextColour(WZCOL_YELLOW);
		sstrcat(sKey, " (numpad)");
	}
	iV_DrawText(sKey, x + 364, y + (psWidget->height / 2) + 3);
}
Exemplo n.º 11
0
// ////////////////////////////////////////////////////////////////////////////
static void displayLoadSlot(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
	int x = xOffset + psWidget->x();
	int y = yOffset + psWidget->y();
	char  butString[64];

	drawBlueBox(x, y, psWidget->width(), psWidget->height());  //draw box

	if (!((W_BUTTON *)psWidget)->pText.isEmpty())
	{
		sstrcpy(butString, ((W_BUTTON *)psWidget)->pText.toUtf8().constData());

		iV_SetFont(font_regular);									// font
		iV_SetTextColour(WZCOL_FORM_TEXT);

		while(iV_GetTextWidth(butString) > psWidget->width())
		{
			butString[strlen(butString)-1]='\0';
		}

		//draw text
		iV_DrawText( butString, x+4, y+17);
	}
}
Exemplo n.º 12
0
// ////////////////////////////////////////////////////////////////////////////
// display a keymap on the interface.
VOID displayKeyMap(struct _widget *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours)
{
	UDWORD		x = xOffset+psWidget->x;
	UDWORD		y = yOffset+psWidget->y;
	UDWORD		w = psWidget->width;
	UDWORD		h = psWidget->height; 
	KEY_MAPPING *psMapping = (KEY_MAPPING*)psWidget->pUserData;
	STRING		sKey[MAX_NAME_SIZE];// was just 40
	UNUSEDPARAMETER(pColours);
	
	
	if(psMapping == selectedKeyMap)
	{
		pie_BoxFillIndex(x,y,x+w,y+h,COL_GREEN);
	}
	else if(psMapping->status == KEYMAP_ALWAYS OR psMapping->status == KEYMAP_ALWAYS_PROCESS)
	{
		pie_BoxFillIndex(x,y,x+w,y+h,COL_RED);
	}
	else
	{
		drawBlueBox(x,y,w,h);
	}

	// draw name
	iV_SetFont(WFont);											// font
	iV_SetTextColour(-1);										//colour

	pie_DrawText((UCHAR*)psMapping->pName, x+2, y+(psWidget->height/2)+3);

	// draw binding
	keyMapToString(sKey,psMapping);
	pie_DrawText((UCHAR*)sKey, x+370, y+(psWidget->height/2)+3);

	return;
}