Skip to content

Commit

Permalink
Doom: Use Patch Replacement for the weapon slot head-up displays
Browse files Browse the repository at this point in the history
Replace the owned weapon slot Patches with text strings so they look
as sharp as the rest of the displays, for consistency.

Todo: Implement patch replacement functionality for all displays.
  • Loading branch information
danij-deng committed Jan 3, 2012
1 parent 11a3208 commit a567f85
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
22 changes: 22 additions & 0 deletions doomsday/plugins/jdoom/defs/values.ded
Expand Up @@ -248,5 +248,27 @@ Values {
WIBP2 = "{tracking=2}P2";
WIBP3 = "{tracking=2}P3";
WIBP4 = "{tracking=2}P4";

STGNUM0 = "{font=game:index,r=0.5,g=0.5,b=0.5}0";
STGNUM1 = "{font=game:index,r=0.5,g=0.5,b=0.5}1";
STGNUM2 = "{font=game:index,r=0.5,g=0.5,b=0.5}2";
STGNUM3 = "{font=game:index,r=0.5,g=0.5,b=0.5}3";
STGNUM4 = "{font=game:index,r=0.5,g=0.5,b=0.5}4";
STGNUM5 = "{font=game:index,r=0.5,g=0.5,b=0.5}5";
STGNUM6 = "{font=game:index,r=0.5,g=0.5,b=0.5}6";
STGNUM7 = "{font=game:index,r=0.5,g=0.5,b=0.5}7";
STGNUM8 = "{font=game:index,r=0.5,g=0.5,b=0.5}8";
STGNUM9 = "{font=game:index,r=0.5,g=0.5,b=0.5}9";

STYSNUM0 = "{font=game:index,r=1,g=0.9,b=0.4}0";
STYSNUM1 = "{font=game:index,r=1,g=0.9,b=0.4}1";
STYSNUM2 = "{font=game:index,r=1,g=0.9,b=0.4}2";
STYSNUM3 = "{font=game:index,r=1,g=0.9,b=0.4}3";
STYSNUM4 = "{font=game:index,r=1,g=0.9,b=0.4}4";
STYSNUM5 = "{font=game:index,r=1,g=0.9,b=0.4}5";
STYSNUM6 = "{font=game:index,r=1,g=0.9,b=0.4}6";
STYSNUM7 = "{font=game:index,r=1,g=0.9,b=0.4}7";
STYSNUM8 = "{font=game:index,r=1,g=0.9,b=0.4}8";
STYSNUM9 = "{font=game:index,r=1,g=0.9,b=0.4}9";
};
}
20 changes: 18 additions & 2 deletions doomsday/plugins/jdoom/src/st_stuff.c
Expand Up @@ -1496,7 +1496,11 @@ void WeaponSlot_Drawer(uiwidget_t* obj, const Point2Raw* offset)
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, textAlpha);

GL_DrawPatch(wpns->patchId, element);
FR_SetFont(obj->font);
FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], textAlpha);

WI_DrawPatch3(wpns->patchId, Hu_ChoosePatchReplacement(cfg.hudPatchReplaceMode, wpns->patchId),
element, ALIGN_TOPLEFT, 0, DTF_NO_EFFECTS);

DGL_Disable(DGL_TEXTURE_2D);
DGL_MatrixMode(DGL_MODELVIEW);
Expand All @@ -1509,15 +1513,27 @@ void WeaponSlot_Drawer(uiwidget_t* obj, const Point2Raw* offset)
void WeaponSlot_UpdateGeometry(uiwidget_t* obj)
{
guidata_weaponslot_t* wpns = (guidata_weaponslot_t*)obj->typedata;
const char* text = Hu_ChoosePatchReplacement(cfg.hudPatchReplaceMode, wpns->patchId);
patchinfo_t info;

Rect_SetWidthHeight(obj->geometry, 0, 0);

if(deathmatch) return;
if(ST_AutomapIsActive(obj->player) && cfg.automapHudDisplay == 0) return;
if(P_MobjIsCamera(players[obj->player].plr->mo) && Get(DD_PLAYBACK)) return;
if(!R_GetPatchInfo(wpns->patchId, &info)) return;
if(!text && !R_GetPatchInfo(wpns->patchId, &info)) return;

if(text)
{
Size2Raw textSize;
FR_SetFont(obj->font);
FR_TextSize(&textSize, text);
Rect_SetWidthHeight(obj->geometry, textSize.width * cfg.statusbarScale,
textSize.height * cfg.statusbarScale);
return;
}

R_GetPatchInfo(wpns->patchId, &info);
Rect_SetWidthHeight(obj->geometry, info.geometry.size.width * cfg.statusbarScale,
info.geometry.size.height * cfg.statusbarScale);
}
Expand Down

0 comments on commit a567f85

Please sign in to comment.