void IN_DrawYAH(void) { uint i; FR_SetFont(FID(GF_FONTA)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", 160, 10, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColor(defFontRGB[0], defFontRGB[1], defFontRGB[2]); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->nextMap), 160, 20, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } if(!(interTime & 16) || interState == 3) { // Draw the destination 'X' GL_DrawPatch(dpGoingThere, &YAHspot[wbs->episode][wbs->nextMap]); } }
void IN_DrawYAH() { FR_SetFont(FID(GF_FONTA)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", 160, 10, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColor(defFontRGB[0], defFontRGB[1], defFontRGB[2]); FR_DrawTextXY3(G_MapTitle(&wbs->nextMap).toUtf8().constData(), 160, 20, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Color4f(1, 1, 1, 1); uint const nextMap = G_MapNumberFor(wbs->nextMap); for(uint i = 0; i < nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } if(!(interTime & 16) || interState == 3) { // Draw the destination 'X' GL_DrawPatch(dpGoingThere, &YAHspot[::gameEpisode][nextMap]); } }
void IN_DrawOldLevel() { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(G_MapTitle(&wbs->currentMap).toUtf8().constData(), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1],defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); if(G_MapNumberFor(wbs->currentMap) == 8) { DGL_Color4f(1, 1, 1, 1); uint const nextMap = G_MapNumberFor(wbs->nextMap); for(uint i = 0; i < nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } } else { DGL_Color4f(1, 1, 1, 1); uint const currentMap = G_MapNumberFor(wbs->currentMap); for(uint i = 0; i < currentMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][8]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[::gameEpisode][currentMap]); } } DGL_Disable(DGL_TEXTURE_2D); }
void IN_DrawOldLevel(void) { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1],defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); if(wbs->currentMap == 8) { uint i; DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->nextMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } } else { uint i; DGL_Color4f(1, 1, 1, 1); for(i = 0; i < wbs->currentMap; ++i) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][i]); } if(players[CONSOLEPLAYER].didSecret) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][8]); } if(!(interTime & 16)) { GL_DrawPatch(dpBeenThere, &YAHspot[wbs->episode][wbs->currentMap]); } } DGL_Disable(DGL_TEXTURE_2D); }
static void drawBackground(void) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); GL_DrawPatchXY3(pBackground, 0, 0, ALIGN_TOPLEFT, DPF_NO_OFFSET); if(!(gameModeBits & GM_ANY_DOOM2) && wbs->episode < 3) { patchid_t patchId; int i; FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); for(i = 0; i < animCounts[wbs->episode]; ++i) { wianimdef_t const *def = &animDefs[wbs->episode][i]; wianimstate_t *state = &animStates[i]; // Has the animation begun yet? if(state->frame < 0) continue; patchId = state->patches[state->frame]; WI_DrawPatch3(patchId, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId), &def->origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } DGL_Disable(DGL_TEXTURE_2D); }
static void drawLocationMarks(void) { if((gameModeBits & GM_ANY_DOOM) && wbs->episode < 3) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); // Draw a splat on taken cities. { int i, last = (wbs->currentMap == 8) ? wbs->nextMap-1 : wbs->currentMap; for(i = 0; i <= last; ++i) { drawPatchIfFits(pSplat, &locations[wbs->episode][i]); }} // Splat the secret map? if(wbs->didSecret) { drawPatchIfFits(pSplat, &locations[wbs->episode][8]); } if(drawYouAreHere) { const Point2Raw* origin = &locations[wbs->episode][wbs->nextMap]; patchid_t patchId = chooseYouAreHerePatch(origin); if(0 != patchId) { WI_DrawPatch3(patchId, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } DGL_Disable(DGL_TEXTURE_2D); } }
static void drawEnteringTitle(void) { int x = SCREENWIDTH/2, y = WI_TITLEY; char* mapName = NULL; uint mapNum; ddmapinfo_t minfo; patchid_t patchId; patchinfo_t info; AutoStr* mapPath; Uri* mapUri; /// @kludge We need to properly externalize the map progression. if((gameModeBits & (GM_DOOM2|GM_DOOM2_PLUT|GM_DOOM2_TNT)) && wbs->nextMap == 30) { return; } /// kludge end. // See if there is a map name. mapUri = G_ComposeMapUri(wbs->episode, wbs->nextMap); mapPath = Uri_Compose(mapUri); if(Def_Get(DD_DEF_MAP_INFO, Str_Text(mapPath), &minfo) && minfo.name) { if(Def_Get(DD_DEF_TEXT, minfo.name, &mapName) == -1) mapName = minfo.name; } Uri_Delete(mapUri); // Skip the E#M# or Map #. if(mapName) { char* ptr = strchr(mapName, ':'); if(ptr) { mapName = M_SkipWhite(ptr + 1); } } DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); // Draw "Entering" WI_DrawPatchXY3(pEntering, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pEntering), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); if(R_GetPatchInfo(pMapNames[wbs->nextMap], &info)) y += (5 * info.geometry.size.height) / 4; // Draw map. mapNum = (wbs->episode * 9) + wbs->nextMap; patchId = (mapNum < pMapNamesSize? pMapNames[mapNum] : 0); FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); WI_DrawPatchXY3(patchId, Hu_ChoosePatchReplacement2(cfg.inludePatchReplaceMode, patchId, mapName), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); }
void UIChat_UpdateGeometry(uiwidget_t* obj) { const char* text = UIChat_Text(obj); assert(obj->type == GUI_CHAT); Rect_SetWidthHeight(obj->geometry, 0, 0); if(!UIChat_IsActive(obj)) return; FR_SetFont(obj->font); Rect_SetWidthHeight(obj->geometry, cfg.msgScale * (FR_TextWidth(text) + FR_CharWidth('_')), cfg.msgScale * (MAX_OF(FR_TextHeight(text), FR_CharHeight('_')))); }
void InlineListWidget::draw() const { const Item * item = items()[selection()]; const Vector4f color = selectionFlashColor(mnRendState->textColors[this->color()]); DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(mnRendState->textFonts[font()]); FR_SetColorAndAlpha(color.x, color.y, color.z, color.w * scrollingFadeout()); FR_DrawTextXY3(item->text().toUtf8().constData(), geometry().topLeft.x, geometry().topLeft.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); }
static void drawSinglePlayerStats(void) { int lh; lh = (3 * FR_CharHeight('0')) / 2; // Line height. DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); WI_DrawPatchXY3(pKills, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pKills), SP_STATSX, SP_STATSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pItems, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pItems), SP_STATSX, SP_STATSY + lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pSecretSP, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pSecretSP), SP_STATSX, SP_STATSY + 2 * lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pTime, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pTime), SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); if(wbs->parTime != -1) { WI_DrawPatchXY3(pPar, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pPar), SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } FR_SetFont(FID(GF_SMALL)); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cntKills[0]); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + lh, cntItems[0]); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + 2 * lh, cntSecret[0]); if(cntTime >= 0) { drawTime(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY, cntTime / TICRATE); } if(wbs->parTime != -1 && cntPar >= 0) { drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cntPar / TICRATE); } DGL_Disable(DGL_TEXTURE_2D); }
void IN_DrawDMStats(void) { #define TRACKING (1) static int sounds; int i, j, ypos = 55, xpos = 90, kpos; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("TOTAL", 265, 30, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("VICTIMS", 140, 8, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); for(i = 0; i < 7; ++i) { FR_DrawTextXY3(killersText[i], 10, 80 + 9 * i, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); } DGL_Disable(DGL_TEXTURE_2D); if(interTime < 20) { DGL_Enable(DGL_TEXTURE_2D); for(i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].members) { M_DrawShadowedPatch(dpFaceAlive[i], 40, ((ypos << FRACBITS) + dSlideY[i] * interTime) >> FRACBITS); M_DrawShadowedPatch(dpFaceDead[i], ((xpos << FRACBITS) + dSlideX[i] * interTime) >> FRACBITS, 18); } }
void InlineListWidget::updateGeometry() { FR_PushAttrib(); FR_SetFont(page().predefinedFont(mn_page_fontid_t(font()))); Size2Raw maxSize{}; Size2Raw size; for (int i = 0; i < items().size(); ++i) { FR_TextSize(&size, items().at(i)->text().toUtf8().constData()); maxSize.width = de::max(maxSize.width, size.width); maxSize.height = de::max(maxSize.height, size.height); } geometry().setSize(Vector2ui(maxSize.width, maxSize.height)); FR_PopAttrib(); }
void LabelWidget::updateGeometry() { /// @todo What if patch replacement is disabled? if(d->patch) { patchinfo_t info; R_GetPatchInfo(*d->patch, &info); geometry().setSize(Vector2ui(info.geometry.size.width, info.geometry.size.height)); return; } FR_PushAttrib(); Size2Raw size; FR_SetFont(page().predefinedFont(mn_page_fontid_t(font()))); FR_TextSize(&size, d->text.toUtf8().constData()); geometry().setSize(Vector2ui(size.width, size.height)); FR_PopAttrib(); }
static void drawFinishedTitle(void) { int x = SCREENWIDTH/2, y = WI_TITLEY; patchid_t patchId; patchinfo_t info; char *mapName; uint mapNum; if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) mapNum = wbs->currentMap; else mapNum = (wbs->episode * 9) + wbs->currentMap; mapName = (char *) DD_GetVariable(DD_MAP_NAME); // Skip the E#M# or Map #. if(mapName) { char* ptr = strchr(mapName, ':'); if(ptr) { mapName = M_SkipWhite(ptr + 1); } } DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); // Draw <MapName> patchId = (mapNum < pMapNamesSize? pMapNames[mapNum] : 0); WI_DrawPatchXY3(patchId, Hu_ChoosePatchReplacement2(cfg.inludePatchReplaceMode, patchId, mapName), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); if(R_GetPatchInfo(patchId, &info)) y += (5 * info.geometry.size.height) / 4; // Draw "Finished!" FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); WI_DrawPatchXY3(pFinished, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFinished), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); }
void LabelWidget::draw() const { fontid_t fontId = mnRendState->textFonts[font()]; Vector4f const &textColor = mnRendState->textColors[color()]; // float t = (isFocused()? 1 : 0); // // Flash if focused. // if(isFocused() && cfg.common.menuTextFlashSpeed > 0) // { // float const speed = cfg.common.menuTextFlashSpeed / 2.f; // t = (1 + sin(page().timer() / (float)TICSPERSEC * speed * DD_PI)) / 2; // } // Vector4f const color = de::lerp(textColor, Vector4f(Vector3f(cfg.common.menuTextFlashColor), textColor.w), t); const Vector4f color = selectionFlashColor(textColor); const float fadeout = scrollingFadeout(); if (fadeout < .001f) return; DGL_Color4f(1, 1, 1, color.w * fadeout); FR_SetFont(fontId); FR_SetColorAndAlpha(color.x, color.y, color.z, color.w * fadeout); if (d->patch) { String replacement; if(!(d->flags & MNTEXT_NO_ALTTEXT)) { replacement = Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.common.menuPatchReplaceMode), *d->patch, d->text); } DGL_Enable(DGL_TEXTURE_2D); WI_DrawPatch(*d->patch, replacement, geometry().topLeft, ALIGN_TOPLEFT, 0, Hu_MenuMergeEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); return; } DGL_Enable(DGL_TEXTURE_2D); FR_DrawTextXY3(d->text.toUtf8().constData(), geometry().topLeft.x, geometry().topLeft.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); }
void UIChat_Drawer(uiwidget_t* obj, const Point2Raw* offset) { //guidata_chat_t* chat = (guidata_chat_t*)obj->typedata; const float textAlpha = uiRendState->pageAlpha * cfg.hudColor[3]; //const float iconAlpha = uiRendState->pageAlpha * cfg.hudIconAlpha; const char* text = UIChat_Text(obj); int xOffset, textWidth, cursorWidth; assert(obj->type == GUI_CHAT); if(!UIChat_IsActive(obj)) return; DGL_MatrixMode(DGL_MODELVIEW); DGL_PushMatrix(); if(offset) DGL_Translatef(offset->x, offset->y, 0); DGL_Scalef(cfg.msgScale, cfg.msgScale, 1); FR_SetFont(obj->font); FR_SetColorAndAlpha(cfg.hudColor[CR], cfg.hudColor[CG], cfg.hudColor[CB], textAlpha); textWidth = FR_TextWidth(text); cursorWidth = FR_CharWidth('_'); if(cfg.msgAlign == 1) xOffset = -(textWidth + cursorWidth)/2; else if(cfg.msgAlign == 2) xOffset = -(textWidth + cursorWidth); else xOffset = 0; DGL_Enable(DGL_TEXTURE_2D); FR_DrawTextXY(text, xOffset, 0); if(actualMapTime & 12) { FR_DrawCharXY('_', xOffset + textWidth, 0); } DGL_Disable(DGL_TEXTURE_2D); DGL_MatrixMode(DGL_MODELVIEW); DGL_PopMatrix(); }
void LineEditWidget::updateGeometry() { FR_SetFont(mnRendState->textFonts[font()]); geometry().setSize(Vector2ui(FR_CharWidth('w') * d->maxLength - MNDATA_EDIT_BACKGROUND_OFFSET_X*2, 14)); }
void LineEditWidget::draw() const { fontid_t fontId = mnRendState->textFonts[font()]; Vector2i origin = geometry().topLeft + Vector2i(MNDATA_EDIT_OFFSET_X, MNDATA_EDIT_OFFSET_Y); String useText; float light = 1, textOpacity = mnRendState->pageAlpha; if(!d->text.isEmpty()) { useText = d->text; } else if(!(isActive() && isFocused())) { useText = d->emptyText; light *= .5f; textOpacity = mnRendState->pageAlpha * .75f; } DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(fontId); const float fadeout = scrollingFadeout(); //int const numVisCharacters = de::clamp(0, useText.isNull()? 0 : useText.length(), d->maxVisibleChars); drawEditBackground(origin + Vector2i(MNDATA_EDIT_BACKGROUND_OFFSET_X, MNDATA_EDIT_BACKGROUND_OFFSET_Y), geometry().width(), mnRendState->pageAlpha * fadeout); //if(string) { // float t = 0; Vector4f color = Vector4f(Vector3f(cfg.common.menuTextColors[MNDATA_EDIT_TEXT_COLORIDX]), 1.f); // Flash if focused? if (!isActive()) /* && isFocused() && cfg.common.menuTextFlashSpeed > 0) { float const speed = cfg.common.menuTextFlashSpeed / 2.f; t = (1 + sin(page().timer() / (float)TICSPERSEC * speed * DD_PI)) / 2; }*/ { color = selectionFlashColor(color); } // Vector4f color = de::lerp(Vector3f(cfg.common.menuTextColors[MNDATA_EDIT_TEXT_COLORIDX]), Vector3f(cfg.common.menuTextFlashColor), t); color *= light; color.w = textOpacity; // Draw the text: FR_SetColorAndAlpha(color.x, color.y, color.z, color.w * fadeout); FR_DrawTextXY3(useText.toUtf8().constData(), origin.x, origin.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); // Are we drawing a cursor? if(isActive() && isFocused() && (menuTime & 8) && (!d->maxLength || d->text.length() < d->maxLength)) { origin.x += FR_TextWidth(useText.toUtf8().constData()); FR_DrawCharXY3('_', origin.x, origin.y, ALIGN_TOPLEFT, Hu_MenuMergeEffectWithDrawTextFlags(0)); } } DGL_Disable(DGL_TEXTURE_2D); }
static void drawDeathmatchStats(void) { int i, j, x, y, w;// lh = WI_SPACINGY; // Line height. DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); // Draw stat titles (top line). { patchinfo_t info; if(R_GetPatchInfo(pTotal, &info)) WI_DrawPatchXY3(pTotal, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pTotal), DM_TOTALSX - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } WI_DrawPatchXY3(pKillers, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pKillers), DM_KILLERSX, DM_KILLERSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pVictims, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pVictims), DM_VICTIMSX, DM_VICTIMSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); x = DM_MATRIXX + DM_SPACINGX; y = DM_MATRIXY; for(i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].playerCount > 0) { patchid_t patchId = pTeamBackgrounds[i]; const char* replacement; patchinfo_t info; FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); R_GetPatchInfo(patchId, &info); replacement = Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId); WI_DrawPatchXY3(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); if(i == inPlayerTeam) { WI_DrawPatchXY3(pFaceDead, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFaceDead), x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pFaceAlive, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFaceAlive), DM_MATRIXX - info.geometry.size.width / 2, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } // If more than 1 member, show the member count. if(1 > teamInfo[i].playerCount) { char tmp[20]; sprintf(tmp, "%i", teamInfo[i].playerCount); FR_SetFont(FID(GF_FONTA)); FR_DrawTextXY3(tmp, x - info.geometry.size.width / 2 + 1, DM_MATRIXY - WI_SPACINGY + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); FR_DrawTextXY3(tmp, DM_MATRIXX - info.geometry.size.width / 2 + 1, y + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); } } else { patchid_t patchId = pTeamIcons[i]; const char* replacement = Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, patchId); patchinfo_t info; FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); R_GetPatchInfo(patchId, &info); WI_DrawPatchXY3(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } x += DM_SPACINGX; y += WI_SPACINGY; } // Draw stats. y = DM_MATRIXY + 10; FR_SetFont(FID(GF_SMALL)); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); w = FR_CharWidth('0'); for(i = 0; i < NUMTEAMS; ++i) { x = DM_MATRIXX + DM_SPACINGX; if(teamInfo[i].playerCount > 0) { char buf[20]; for(j = 0; j < NUMTEAMS; ++j) { if(teamInfo[j].playerCount > 0) { dd_snprintf(buf, 20, "%i", dmFrags[i][j]); FR_DrawTextXY3(buf, x + w, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } x += DM_SPACINGX; } dd_snprintf(buf, 20, "%i", dmTotals[i]); FR_DrawTextXY3(buf, DM_TOTALSX + w, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } y += WI_SPACINGY; } DGL_Disable(DGL_TEXTURE_2D); }
void IN_DrawCoopStats(void) { #define TRACKING (1) static int sounds; int i, ypos; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("KILLS", 95, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("BONUS", 155, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("SECRET", 232, 35, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), SCREENWIDTH/2, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("FINISHED", SCREENWIDTH/2, 25, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetTracking(TRACKING); ypos = 50; for(i = 0; i < NUMTEAMS; ++i) { if(teamInfo[i].members) { char buf[20]; DGL_Color4f(0, 0, 0, .4f); GL_DrawPatchXY(dpFaceAlive[i], 27, ypos+2); DGL_Color4f(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); GL_DrawPatchXY(dpFaceAlive[i], 25, ypos); if(interTime < 40) { sounds = 0; ypos += 37; continue; } else if(interTime >= 40 && sounds < 1) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } dd_snprintf(buf, 20, "%i", killPercent[i]); M_DrawTextFragmentShadowed(buf, 121, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 121, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", bonusPercent[i]); M_DrawTextFragmentShadowed(buf, 196, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 196, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", secretPercent[i]); M_DrawTextFragmentShadowed(buf, 273, ypos + 10, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("%", 273, ypos + 10, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); ypos += 37; } } DGL_Disable(DGL_TEXTURE_2D); #undef TRACKING }
void IN_DrawSingleStats(void) { #define TRACKING (1) static int sounds; char buf[20]; DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("KILLS", 50, 65, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("ITEMS", 50, 90, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3("SECRETS", 50, 115, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->currentMap), 160, 3, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTA)); FR_SetColor(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2]); FR_DrawTextXY3("FINISHED", 160, 25, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 30) { sounds = 0; return; } if(sounds < 1 && interTime >= 30) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].killCount); FR_SetFont(FID(GF_FONTB)); FR_SetTracking(TRACKING); M_DrawTextFragmentShadowed(buf, 236, 65, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 65, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalKills); M_DrawTextFragmentShadowed(buf, 284, 65, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 60) return; if(sounds < 2 && interTime >= 60) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].itemCount); FR_SetFont(FID(GF_FONTB)); M_DrawTextFragmentShadowed(buf, 236, 90, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 90, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalItems); M_DrawTextFragmentShadowed(buf, 284, 90, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 90) return; if(sounds < 3 && interTime >= 90) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } DGL_Enable(DGL_TEXTURE_2D); dd_snprintf(buf, 20, "%i", players[CONSOLEPLAYER].secretCount); FR_SetFont(FID(GF_FONTB)); M_DrawTextFragmentShadowed(buf, 236, 115, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); M_DrawTextFragmentShadowed("/", 241, 115, ALIGN_TOPLEFT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); dd_snprintf(buf, 20, "%i", totalSecret); M_DrawTextFragmentShadowed(buf, 284, 115, ALIGN_TOPRIGHT, 0, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); if(interTime < 150) { return; } if(sounds < 4 && interTime >= 150) { S_LocalSound(SFX_DORCLS, NULL); sounds++; } if(gameMode != heretic_extended || wbs->episode < 3) { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3("TIME", 85, 160, ALIGN_TOPLEFT, DTF_ONLY_SHADOW); IN_DrawTime(284, 160, hours, minutes, seconds, defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); DGL_Disable(DGL_TEXTURE_2D); } else { DGL_Enable(DGL_TEXTURE_2D); FR_SetFont(FID(GF_FONTA)); FR_SetColorAndAlpha(defFontRGB3[0], defFontRGB3[1], defFontRGB3[2], 1); FR_DrawTextXY3("NOW ENTERING:", SCREENWIDTH/2, 160, ALIGN_TOP, DTF_ONLY_SHADOW); FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(defFontRGB[0], defFontRGB[1], defFontRGB[2], 1); FR_DrawTextXY3(P_GetShortMapName(wbs->episode, wbs->nextMap), 160, 170, ALIGN_TOP, DTF_ONLY_SHADOW); DGL_Disable(DGL_TEXTURE_2D); skipIntermission = false; } #undef TRACKING }
static void drawNetgameStats(void) { #define ORIGINX (NG_STATSX + starWidth/2 + NG_STATSX*!doFrags) int i, x, y, starWidth, pwidth; patchinfo_t info; DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); FR_SetFont(FID(GF_FONTB)); FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); pwidth = FR_CharWidth('%'); R_GetPatchInfo(pFaceAlive, &info); starWidth = info.geometry.size.width; // Draw stat titles (top line). R_GetPatchInfo(pKills, &info); WI_DrawPatchXY3(pKills, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pKills), ORIGINX + NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); y = NG_STATSY + info.geometry.size.height; WI_DrawPatchXY3(pItems, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pItems), ORIGINX + 2 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); WI_DrawPatchXY3(pSecret, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pSecret), ORIGINX + 3 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); if(doFrags) { WI_DrawPatchXY3(pFrags, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFrags), ORIGINX + 4 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); } // Draw stats. for(i = 0; i < NUMTEAMS; ++i) { patchinfo_t info; if(0 == teamInfo[i].playerCount) continue; FR_SetFont(FID(GF_FONTA)); FR_SetColorAndAlpha(1, 1, 1, 1); x = ORIGINX; R_GetPatchInfo(pTeamBackgrounds[i], &info); WI_DrawPatchXY3(pTeamBackgrounds[i], Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pTeamBackgrounds[i]), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); // If more than 1 member, show the member count. if(1 != teamInfo[i].playerCount) { char tmp[40]; sprintf(tmp, "%i", teamInfo[i].playerCount); FR_DrawTextXY3(tmp, x - info.geometry.size.width + 1, y + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); } FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); if(i == inPlayerTeam) WI_DrawPatchXY3(pFaceAlive, Hu_ChoosePatchReplacement(cfg.inludePatchReplaceMode, pFaceAlive), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); x += NG_SPACINGX; FR_SetFont(FID(GF_SMALL)); drawPercent(x - pwidth, y + 10, cntKills[i]); x += NG_SPACINGX; drawPercent(x - pwidth, y + 10, cntItems[i]); x += NG_SPACINGX; drawPercent(x - pwidth, y + 10, cntSecret[i]); x += NG_SPACINGX; if(doFrags) { char buf[20]; dd_snprintf(buf, 20, "%i", cntFrags[i]); FR_DrawTextXY3(buf, x, y + 10, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } y += WI_SPACINGY; } DGL_Disable(DGL_TEXTURE_2D); #undef ORIGINX }
void FR_DrawText3(const char* text, const Point2Raw* _origin, int alignFlags, short _textFlags) { fontid_t origFont = FR_Font(); float cx, cy, extraScale; drawtextstate_t state; const char* fragment; int pass, curCase; Point2Raw origin; Size2Raw textSize; size_t charCount; float origColor[4]; char* str, *end; boolean escaped = false; errorIfNotInited("FR_DrawText"); if(!text || !text[0]) return; origin.x = _origin? _origin->x : 0; origin.y = _origin? _origin->y : 0; _textFlags &= ~(DTF_INTERNAL_MASK); // If we aren't aligning to top-left we need to know the dimensions. if(alignFlags & ALIGN_RIGHT) FR_TextSize(&textSize, text); DENG_ASSERT_IN_MAIN_THREAD(); DENG_ASSERT_GL_CONTEXT_ACTIVE(); // We need to change the current color, so remember for restore. glGetFloatv(GL_CURRENT_COLOR, origColor); for(pass = ((_textFlags & DTF_NO_SHADOW) != 0? 1 : 0); pass < ((_textFlags & DTF_NO_GLITTER) != 0? 2 : 3); ++pass) { short textFlags = 0; // Configure the next pass. cx = (float) origin.x; cy = (float) origin.y; curCase = -1; charCount = 0; switch(pass) { case 0: textFlags = _textFlags | (DTF_NO_GLITTER|DTF_NO_CHARACTER); break; case 1: textFlags = _textFlags | (DTF_NO_SHADOW |DTF_NO_GLITTER); break; case 2: textFlags = _textFlags | (DTF_NO_SHADOW |DTF_NO_CHARACTER); break; } // Apply defaults. initDrawTextState(&state, textFlags); str = (char*)text; while(*str) { if(*str == FR_FORMAT_ESCAPE_CHAR) { escaped = true; ++str; continue; } if(!escaped && *str == '{') // Paramaters included? { fontid_t lastFont = state.fontNum; int lastTracking = state.tracking; float lastLeading = state.leading; float lastShadowStrength = state.shadowStrength; float lastGlitterStrength = state.glitterStrength; boolean lastCaseScale = state.caseScale; float lastRGBA[4]; int numBreaks = 0; lastRGBA[CR] = state.rgba[CR]; lastRGBA[CG] = state.rgba[CG]; lastRGBA[CB] = state.rgba[CB]; lastRGBA[CA] = state.rgba[CA]; parseParamaterBlock(&str, &state, &numBreaks); if(numBreaks != 0) { do { cx = (float) origin.x; cy += state.lastLineHeight * (1+lastLeading); } while(--numBreaks > 0); } if(state.fontNum != lastFont) FR_SetFont(state.fontNum); if(state.tracking != lastTracking) FR_SetTracking(state.tracking); if(state.leading != lastLeading) FR_SetLeading(state.leading); if(state.rgba[CR] != lastRGBA[CR] || state.rgba[CG] != lastRGBA[CG] || state.rgba[CB] != lastRGBA[CB] || state.rgba[CA] != lastRGBA[CA]) FR_SetColorAndAlphav(state.rgba); if(state.shadowStrength != lastShadowStrength) FR_SetShadowStrength(state.shadowStrength); if(state.glitterStrength != lastGlitterStrength) FR_SetGlitterStrength(state.glitterStrength); if(state.caseScale != lastCaseScale) FR_SetCaseScale(state.caseScale); } for(end = str; *end && *end != FR_FORMAT_ESCAPE_CHAR && (escaped || *end != '{');) { int newlines = 0, fragmentAlignFlags; float alignx = 0; // Find the end of the next fragment. if(FR_CaseScale()) { curCase = -1; // Select a substring with characters of the same case (or whitespace). for(; *end && *end != FR_FORMAT_ESCAPE_CHAR && (escaped || *end != '{') && *end != '\n'; end++) { escaped = false; // We can skip whitespace. if(isspace(*end)) continue; if(curCase < 0) curCase = (isupper(*end) != 0); else if(curCase != (isupper(*end) != 0)) break; } } else { curCase = 0; for(; *end && *end != FR_FORMAT_ESCAPE_CHAR && (escaped || *end != '{') && *end != '\n'; end++) { escaped = false; } } // No longer escaped. escaped = false; { char* buffer = enlargeTextBuffer(end - str); memcpy(buffer, str, end - str); buffer[end - str] = '\0'; fragment = buffer; } while(*end == '\n') { newlines++; end++; } // Continue from here. str = end; if(!(alignFlags & (ALIGN_LEFT|ALIGN_RIGHT))) { fragmentAlignFlags = alignFlags; } else { // We'll take care of horizontal positioning of the fragment so align left. fragmentAlignFlags = (alignFlags & ~(ALIGN_RIGHT)) | ALIGN_LEFT; if(alignFlags & ALIGN_RIGHT) alignx = -textSize.width * state.scaleX; } // Setup the scaling. glMatrixMode(GL_MODELVIEW); glPushMatrix(); // Rotate. if(state.angle != 0) { // The origin is the specified (x,y) for the patch. // We'll undo the aspect ratio (otherwise the result would be skewed). /// @todo Do not assume the aspect ratio and therefore whether // correction is even needed. glTranslatef((float)origin.x, (float)origin.y, 0); glScalef(1, 200.0f / 240.0f, 1); glRotatef(state.angle, 0, 0, 1); glScalef(1, 240.0f / 200.0f, 1); glTranslatef(-(float)origin.x, -(float)origin.y, 0); } glTranslatef(cx + state.offX + alignx, cy + state.offY + (FR_CaseScale() ? state.caseMod[curCase].offset : 0), 0); extraScale = (FR_CaseScale() ? state.caseMod[curCase].scale : 1); glScalef(state.scaleX, state.scaleY * extraScale, 1); // Draw it. if(fr.fontNum) { textFragmentDrawer(fragment, 0, 0, fragmentAlignFlags, textFlags, state.typeIn ? (int) charCount : DEFAULT_INITIALCOUNT); } charCount += strlen(fragment); // Advance the current position? if(newlines == 0) { cx += ((float) textFragmentWidth(fragment) + currentAttribs()->tracking) * state.scaleX; } else { if(strlen(fragment) > 0) state.lastLineHeight = textFragmentHeight(fragment); cx = (float) origin.x; cy += newlines * (float) state.lastLineHeight * (1+FR_Leading()); } glMatrixMode(GL_MODELVIEW); glPopMatrix(); } } FR_PopAttrib(); } freeTextBuffer(); FR_SetFont(origFont); glColor4fv(origColor); }