// ----------------------------------------------------------------------------------- void dispAdditionalInfo( void ) { /* We now need to display the mission time, game time, average unit experience level an number of artefacts found */ /* Firstly, top of the screen, number of artefacts found */ sprintf( text, _("ARTIFACTS RECOVERED: %d"), missionData.artefactsFound ); iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 300 + D_H ); /* Get the mission result time in a string - and write it out */ getAsciiTime( (char*)&text2, gameTime - missionData.missionStarted ); sprintf( text, _("Mission Time - %s"), text2 ); iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 320 + D_H); /* Write out total game time so far */ getAsciiTime( (char*)&text2, gameTime ); sprintf( text, _("Total Game Time - %s"), text2 ); iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 340 + D_H ); if (Cheated) { // A quick way to flash the text ((gameTime2 / 250) % 2) ? iV_SetTextColour(WZCOL_RED) : iV_SetTextColour(WZCOL_YELLOW); sprintf( text, _("You cheated!")); iV_DrawText( text, (pie_GetVideoBufferWidth() - iV_GetTextWidth(text))/2, 360 + D_H ); iV_SetTextColour(WZCOL_TEXT_BRIGHT); } }
/** Sets console text color depending on message type */ static void setConsoleTextColor(SDWORD player) { // System messages if(player == SYSTEM_MESSAGE) { iV_SetTextColour(WZCOL_CONS_TEXT_SYSTEM); } else if (player == NOTIFY_MESSAGE) { iV_SetTextColour(WZCOL_YELLOW); } else { // Don't use friend-foe colors in the lobby if(bEnemyAllyRadarColor && (GetGameMode() == GS_NORMAL)) { if(aiCheckAlliances(player,selectedPlayer)) { iV_SetTextColour(WZCOL_CONS_TEXT_USER_ALLY); } else { iV_SetTextColour(WZCOL_CONS_TEXT_USER_ENEMY); } } else { // Friend-foe is off iV_SetTextColour(WZCOL_CONS_TEXT_USER); } } }
//full screenvideo functions static bool seq_StartFullScreenVideo(const char* videoName, const char* audioName, VIDEO_RESOLUTION resolution) { const char* aAudioName = NULL; int chars_printed; bHoldSeqForAudio = false; chars_printed = ssprintf(aVideoName, "%s%s", aHardPath, videoName); ASSERT(chars_printed < sizeof(aVideoName), "sequence path + name greater than max string"); //set audio path if (audioName != NULL) { sasprintf((char**)&aAudioName, "sequenceaudio/%s", audioName); } cdAudio_Pause(); iV_SetFont(font_regular); iV_SetTextColour(WZCOL_TEXT_BRIGHT); /* We do not want to enter loop_SetVideoPlaybackMode() when we are * doing intelligence videos. */ if (resolution == VIDEO_USER_CHOSEN_RESOLUTION) { //start video mode if (loop_GetVideoMode() == 0) { // check to see if we need to pause, and set font each time cdAudio_Pause(); loop_SetVideoPlaybackMode(); iV_SetFont(font_regular); iV_SetTextColour(WZCOL_TEXT_BRIGHT); } // set the dimensions to show full screen or native or ... seq_SetUserResolution(); } if (!seq_Play(aVideoName)) { seq_Shutdown(); return false; } if (audioName == NULL) { bAudioPlaying = false; } else { // NOT controlled by sliders for now? static const float maxVolume = 1.f; bAudioPlaying = audio_PlayStream(aAudioName, maxVolume, NULL, NULL) ? true : false; ASSERT(bAudioPlaying == true, "unable to initialise sound %s", aAudioName); } return true; }
// //////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////// 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); } } }
//full screenvideo functions static bool seq_StartFullScreenVideo(QString videoName, QString audioName, VIDEO_RESOLUTION resolution) { QString aAudioName("sequenceaudio/" + audioName); bHoldSeqForAudio = false; aVideoName = QString("sequences/" + videoName); cdAudio_Pause(); iV_SetFont(font_scaled); iV_SetTextColour(WZCOL_TEXT_BRIGHT); /* We do not want to enter loop_SetVideoPlaybackMode() when we are * doing intelligence videos. */ if (resolution == VIDEO_USER_CHOSEN_RESOLUTION) { //start video mode if (loop_GetVideoMode() == 0) { // check to see if we need to pause, and set font each time cdAudio_Pause(); loop_SetVideoPlaybackMode(); iV_SetFont(font_scaled); iV_SetTextColour(WZCOL_TEXT_BRIGHT); } // set the dimensions to show full screen or native or ... seq_SetUserResolution(); } if (!seq_Play(aVideoName.toUtf8().constData())) { seq_Shutdown(); return false; } if (audioName.isEmpty()) { bAudioPlaying = false; } else { // NOT controlled by sliders for now? static const float maxVolume = 1.f; bAudioPlaying = audio_PlayStream(aAudioName.toUtf8().constData(), maxVolume, NULL, NULL) ? true : false; ASSERT(bAudioPlaying == true, "unable to initialise sound %s", aAudioName.toUtf8().constData()); } return true; }
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); }
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); }
// //////////////////////////////////////////////////////////////////////////// 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); } }
void W_LABEL::display(int xOffset, int yOffset) { iV_SetTextColour(fontColour); QByteArray text = aText.toUtf8(); int fx; if (style & WLAB_ALIGNCENTRE) { int fw = iV_GetTextWidth(text.constData(), FontID); fx = xOffset + x() + (width() - fw) / 2; } else if (style & WLAB_ALIGNRIGHT) { int fw = iV_GetTextWidth(text.constData(), FontID); fx = xOffset + x() + width() - fw; } else { fx = xOffset + x(); } int fy; if ((style & WLAB_ALIGNTOPLEFT) != 0) // Align top { fy = yOffset + y() - iV_GetTextAboveBase(FontID); } else if ((style & WLAB_ALIGNBOTTOMLEFT) != 0) // Align bottom { fy = yOffset + y() - iV_GetTextAboveBase(FontID) + (height() - iV_GetTextLineSize(FontID)); } else { fy = yOffset + y() - iV_GetTextAboveBase(FontID) + (height() - iV_GetTextLineSize(FontID)) / 2; } iV_DrawText(text.constData(), fx, fy, FontID); }
/* label display function */ void labelDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours) { SDWORD fx,fy, fw; W_LABEL *psLabel; // PROP_FONT *psFont; int FontID; psLabel = (W_LABEL *)psWidget; // psFont = psLabel->psFont; FontID = psLabel->FontID; iV_SetFont(FontID); // fontSetCacheColour(*(pColours + WCOL_TEXT)); iV_SetTextColour((UWORD)*(pColours + WCOL_TEXT)); if (psLabel->style & WLAB_ALIGNCENTRE) { fw = iV_GetTextWidth(psLabel->aText); fx = xOffset + psLabel->x + (psLabel->width - fw) / 2; } else if (psLabel->style & WLAB_ALIGNRIGHT) { fw = iV_GetTextWidth(psLabel->aText); fx = xOffset + psLabel->x + psLabel->width - fw; } else { fx = xOffset + psLabel->x; } fy = yOffset + psLabel->y + (psLabel->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); // fy = yOffset + psLabel->y + (psLabel->height - // psFont->height + psFont->baseLine) / 2; iV_DrawText(psLabel->aText,fx,fy); // fontPrint(fx,fy, psLabel->aText); }
/* label display function */ void labelDisplay(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { SDWORD fx,fy, fw; W_LABEL *psLabel; enum iV_fonts FontID; psLabel = (W_LABEL *)psWidget; FontID = psLabel->FontID; iV_SetFont(FontID); iV_SetTextColour(pColours[WCOL_TEXT]); if (psLabel->style & WLAB_ALIGNCENTRE) { fw = iV_GetTextWidth(psLabel->aText); fx = xOffset + psLabel->x + (psLabel->width - fw) / 2; } else if (psLabel->style & WLAB_ALIGNRIGHT) { fw = iV_GetTextWidth(psLabel->aText); fx = xOffset + psLabel->x + psLabel->width - fw; } else { fx = xOffset + psLabel->x; } fy = yOffset + psLabel->y + (psLabel->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); iV_DrawText(psLabel->aText,fx,fy); }
// //////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////// 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); } }
// //////////////////////////////////////////////////////////////////////////// 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); } }
// //////////////////////////////////////////////////////////////////////////// // show text. static void displayText(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours) { SDWORD fx,fy, fw; W_LABEL *psLab; psLab = (W_LABEL *)psWidget; iV_SetFont(psLab->FontID); fw = iV_GetTextWidth(psLab->aText); fy = yOffset + psWidget->y; if (psWidget->style & WLAB_ALIGNCENTRE) //check for centering, calculate offset. { fx = xOffset + psWidget->x + ((psWidget->width - fw) / 2); } else { fx = xOffset + psWidget->x; } iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_DrawText( psLab->aText, fx, fy); return; }
// //////////////////////////////////////////////////////////////////////////// // show a text option. void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours) { SDWORD fx,fy, fw; W_BUTTON *psBut; bool hilight = false; bool greyOut = psWidget->UserData; // if option is unavailable. psBut = (W_BUTTON *)psWidget; iV_SetFont(psBut->FontID); if(widgGetMouseOver(psWScreen) == psBut->id) // if mouse is over text then hilight. { hilight = true; } fw = iV_GetTextWidth(psBut->pText); fy = yOffset + psWidget->y + (psWidget->height - iV_GetTextLineSize())/2 - iV_GetTextAboveBase(); if (psWidget->style & WBUT_TXTCENTRE) //check for centering, calculate offset. { fx = xOffset + psWidget->x + ((psWidget->width - fw) / 2); } else { fx = xOffset + psWidget->x; } if(greyOut) // unavailable { iV_SetTextColour(WZCOL_TEXT_DARK); } else // available { if(hilight) // hilight { iV_SetTextColour(WZCOL_TEXT_BRIGHT); } else // dont highlight { iV_SetTextColour(WZCOL_TEXT_MEDIUM); } } iV_DrawText( psBut->pText, fx, fy); return; }
// //////////////////////////////////////////////////////////////////////////// // show text written on its side. static void displayTextAt270(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours) { SDWORD fx,fy; W_LABEL *psLab; psLab = (W_LABEL *)psWidget; iV_SetFont(font_large); fx = xOffset + psWidget->x; fy = yOffset + psWidget->y + iV_GetTextWidth(psLab->aText) ; iV_SetTextColour(WZCOL_GREY); iV_DrawTextRotated(psLab->aText, fx+2, fy+2, 270.f); iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_DrawTextRotated(psLab->aText, fx, fy, 270.f); }
static void barGraphDisplayText(W_BARGRAPH *barGraph, int x0, int x1, int y1) { if (!barGraph->text.isEmpty()) { QByteArray utf = barGraph->text.toUtf8(); iV_SetFont(font_small); int textWidth = iV_GetTextWidth(utf.constData()); Vector2i pos((x0 + x1 - textWidth) / 2, y1); iV_SetTextColour(WZCOL_BLACK); // Add a shadow, to make it visible against any background. for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) { iV_DrawText(utf.constData(), pos.x + dx * 1.25f, pos.y + dy * 1.25f); } iV_SetTextColour(barGraph->textCol); iV_DrawText(utf.constData(), pos.x, pos.y - 0.25f); iV_DrawText(utf.constData(), pos.x, pos.y + 0.25f); // Draw twice, to make it more visible. } }
/* Renders a video sequence specified by filename to a buffer*/ bool seq_RenderVideoToBuffer(const char* sequenceName, int seqCommand) { static enum { VIDEO_NOT_PLAYING, VIDEO_PLAYING, VIDEO_FINISHED, } videoPlaying = VIDEO_NOT_PLAYING; static enum { VIDEO_LOOP, VIDEO_HOLD_LAST_FRAME, } frameHold = VIDEO_LOOP; if (seqCommand == SEQUENCE_KILL) { //stop the movie seq_Shutdown(); bSeqPlaying = false; frameHold = VIDEO_LOOP; videoPlaying = VIDEO_NOT_PLAYING; return true; } if (!bSeqPlaying && frameHold == VIDEO_LOOP) { //start the ball rolling iV_SetFont(font_regular); iV_SetTextColour(WZCOL_TEXT_BRIGHT); /* We do *NOT* want to use the user-choosen resolution when we * are doing intelligence videos. */ videoPlaying = seq_StartFullScreenVideo(sequenceName, NULL, VIDEO_PRESELECTED_RESOLUTION) ? VIDEO_PLAYING : VIDEO_FINISHED; bSeqPlaying = true; } if (videoPlaying != VIDEO_FINISHED) { videoPlaying = seq_Update() ? VIDEO_PLAYING : VIDEO_FINISHED; } if (videoPlaying == VIDEO_FINISHED) { seq_Shutdown(); bSeqPlaying = false; frameHold = VIDEO_HOLD_LAST_FRAME; videoPlaying = VIDEO_NOT_PLAYING; return false; } return true; }
void screen_Display() { pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_OFF); // Draw backdrop glColor3f(1, 1, 1); backdropGfx->draw(); if (mappreview) { int s1 = screenWidth / preview_width; int s2 = screenHeight / preview_height; int scale = MIN(s1, s2); int w = preview_width * scale; int h = preview_height * scale; for (int i = 0; i < MAX_PLAYERS; i++) { int x = player_pos[i].x; int y = player_pos[i].y; char text[5]; if (x == 0x77777777) { continue; } x = screenWidth / 2 - w / 2 + x * scale; y = screenHeight / 2 - h / 2 + y * scale; ssprintf(text, "%d", i); iV_SetFont(font_large); iV_SetTextColour(WZCOL_BLACK); iV_DrawText(text, x - 1, y - 1); iV_DrawText(text, x + 1, y - 1); iV_DrawText(text, x - 1, y + 1); iV_DrawText(text, x + 1, y + 1); iV_SetTextColour(WZCOL_WHITE); iV_DrawText(text, x, y); } } pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON); }
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); }
/* Sets the player's text color depending on if alliance formed, or if dead. * \param mode the specified alliance * \param player the specified player */ static void SetPlayerTextColor( int mode, UDWORD player ) { // override color if they are dead... if (!apsDroidLists[player] && !apsStructLists[player]) { iV_SetTextColour(WZCOL_GREY); // dead text color } // the colors were chosen to match the FRIEND/FOE radar map colors. else if (mode == ALLIANCE_FORMED) { iV_SetTextColour(WZCOL_YELLOW); // Human alliance text color } else if (isHumanPlayer(player)) // Human player, no alliance { iV_SetTextColour(WZCOL_TEXT_BRIGHT); // Normal text color } else { iV_SetTextColour(WZCOL_RED); // Enemy color } }
// //////////////////////////////////////////////////////////////////////////// // 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); }
// show a background piccy (currently used for version and mods labels) static void displayTitleBitmap(WZ_DECL_UNUSED WIDGET *psWidget, WZ_DECL_UNUSED UDWORD xOffset, WZ_DECL_UNUSED UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours) { char modListText[MAX_STR_LENGTH] = ""; iV_SetFont(font_regular); iV_SetTextColour(WZCOL_GREY); iV_DrawTextRotated(version_getFormattedVersionString(), pie_GetVideoBufferWidth() - 9, pie_GetVideoBufferHeight() - 14, 270.f); if (*getModList()) { sstrcat(modListText, _("Mod: ")); sstrcat(modListText, getModList()); iV_DrawText(modListText, 9, 14); } iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_DrawTextRotated(version_getFormattedVersionString(), pie_GetVideoBufferWidth() - 10, pie_GetVideoBufferHeight() - 15, 270.f); if (*getModList()) { iV_DrawText(modListText, 10, 15); } }
/** * Draws the text for the intelligence display window. */ static BOOL intDisplaySeqTextViewPage(VIEW_REPLAY *psViewReplay, UDWORD x0, UDWORD y0, UDWORD width, UDWORD height, BOOL render, size_t *cur_seq, size_t *cur_seqpage) { UDWORD i, cur_y; UDWORD sequence; if (!psViewReplay) { return true; /* nothing to do */ } iV_SetFont(font_regular); iV_SetTextColour(WZCOL_TEXT_BRIGHT); cur_y = y0 + iV_GetTextLineSize()/2 + 2*TEXT_YINDENT; /* add each message */ for (sequence = *cur_seq, i = *cur_seqpage; sequence < psViewReplay->numSeq; sequence++) { SEQ_DISPLAY *psSeqDisplay = &psViewReplay->pSeqList[sequence]; for (; i < psSeqDisplay->numText; i++) { if (render) { cur_y = iV_DrawFormattedText(psSeqDisplay->ppTextMsg[i], x0 + TEXT_XINDENT, cur_y, width, false); } else { cur_y += iV_GetTextLineSize(); } if (cur_y > y0 + height) { /* run out of room - need to make new tab */ *cur_seq = sequence; *cur_seqpage = i; return false; } } i = 0; } return true; /* done */ }
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; }
static void displayDebugMenu(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours) { char str[128]; UDWORD x = xOffset+psWidget->x; UDWORD y = yOffset+psWidget->y; UDWORD index = psWidget->UserData; iV_SetFont(font_regular); // font iV_SetTextColour(WZCOL_TEXT_BRIGHT); if(strcmp(debugMenuEntry[index],"")) { sprintf(str,"%s", debugMenuEntry[index]); iV_DrawText(str, x, y+MULTIMENU_FONT_OSET); } }
/** * Displays the TEXT view for the current message. * If this function breaks, please merge it with intDisplaySeqTextViewPage * which presumably does almost the same. */ void intDisplayTEXTView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours) { W_TABFORM *Form = (W_TABFORM*)psWidget; MESSAGE *psMessage = (MESSAGE *)Form->pUserData; UDWORD x0, y0, x1, y1, i, linePitch; UDWORD ty; x0 = xOffset+Form->x; y0 = yOffset+Form->y; x1 = x0 + Form->width; y1 = y0 + Form->height; ty = y0; RenderWindowFrame(FRAME_NORMAL, x0, y0, x1 - x0, y1 - y0); if (psMessage) { iV_SetFont(font_regular); /* Get the travel to the next line */ linePitch = iV_GetTextLineSize(); /* Fix for spacing.... */ linePitch+=3; ty+=3; /* Fix for spacing.... */ iV_SetTextColour(WZCOL_TEXT_BRIGHT); //add each message for (i = 0; i < ((VIEWDATA *)psMessage->pViewData)->numText; i++) { //check haven't run out of room first! if (i * linePitch > Form->height) { ASSERT( false, "intDisplayTEXTView: Run out of room!" ); return; } //need to check the string will fit! iV_DrawText(_(((VIEWDATA *)psMessage->pViewData)->ppTextMsg[i]), x0 + TEXT_XINDENT, (ty + TEXT_YINDENT*3) + (i * linePitch)); } } }
// //////////////////////////////////////////////////////////////////////////// // 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; }
// //////////////////////////////////////////////////////////////////////////// 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); } }
// Show global (mode=true) or team (mode=false) history messages void displayOldMessages(bool mode) { int startpos = 0; std::deque<CONSOLE_MESSAGE> *WhichMessages; if (mode) { WhichMessages = &TeamMessages; } else { WhichMessages = &HistoryMessages; } if (!WhichMessages->empty()) { unsigned int count = WhichMessages->size(); // total number of messages if (count > NumDisplayLines) // if we have more than we can display { startpos = count - NumDisplayLines; // show last X lines startpos += updatepos; // unless user wants to start at something else if (startpos < 0) // don't underflow { startpos = 0; updatepos = (count - NumDisplayLines) * -1; // reset back to first entry count = NumDisplayLines; } else if (count + updatepos <= count) { count += updatepos; // user may want something different } else { // reset all, we got overflow count = WhichMessages->size(); updatepos = 0; startpos = count - NumDisplayLines; } } int nudgeright = 0; int TextYpos = historyConsole.topY + linePitch - 2; if (isSecondaryWindowUp()) // see if (build/research/...)window is up { nudgeright = RET_FORMWIDTH + 2; // move text over } // if user wants to add a bit more contrast to the text if (showBackgroundColor) { iV_TransBoxFill(historyConsole.topX + nudgeright - CON_BORDER_WIDTH, historyConsole.topY - historyConsole.textDepth - CON_BORDER_HEIGHT, historyConsole.topX + historyConsole.width, historyConsole.topY + (NumDisplayLines * linePitch) + CON_BORDER_HEIGHT); } for (int i = startpos; i < count; ++i) { // Set text color depending on message type if (mode) { iV_SetTextColour(WZCOL_CONS_TEXT_USER_ALLY); } else { setConsoleTextColor((*WhichMessages)[i].player); } TextYpos = iV_DrawFormattedText((*WhichMessages)[i].text.c_str(), historyConsole.topX + nudgeright, TextYpos, historyConsole.width, (*WhichMessages)[i].JustifyType); } } }