Skip to content

Commit

Permalink
Added cvar "inlude-patch-replacement" to control patch replacement in
Browse files Browse the repository at this point in the history
the intermission. Usage is analogous to "menu-patch-replacement" except
scoped to patches drawn in the intermission.
  • Loading branch information
danij-deng committed Jun 18, 2011
1 parent 2142e3a commit bf4c5e8
Show file tree
Hide file tree
Showing 23 changed files with 144 additions and 142 deletions.
6 changes: 3 additions & 3 deletions doomsday/plugins/common/src/hu_lib.c
Expand Up @@ -1087,7 +1087,7 @@ void MNText_Drawer(mn_object_t* obj, int x, int y)
const char* replacement = NULL;
if(!(obj->_flags & MNF_NO_ALTTEXT))
{
replacement = Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, *txt->patch, txt->text, true);
replacement = Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, *txt->patch, txt->text, true);
}
DGL_Enable(DGL_TEXTURE_2D);
WI_DrawPatch3(*txt->patch, replacement, x, y, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
Expand Down Expand Up @@ -1700,7 +1700,7 @@ void MNButton_Drawer(mn_object_t* obj, int x, int y)
const char* replacement = NULL;
if(!(obj->_flags & MNF_NO_ALTTEXT))
{
replacement = Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, *btn->patch, btn->text, true);
replacement = Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, *btn->patch, btn->text, true);
}
DGL_Enable(DGL_TEXTURE_2D);
WI_DrawPatch3(*btn->patch, replacement, x, y, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
Expand Down Expand Up @@ -1796,7 +1796,7 @@ void MNButton_UpdateDimensions(mn_object_t* obj, mn_page_t* page)
if(!(obj->_flags & MNF_NO_ALTTEXT))
{
// Use the replacement string?
text = Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, *btn->patch, btn->text, true);
text = Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, *btn->patch, btn->text, true);
}

if(NULL == text || text[0])
Expand Down
16 changes: 8 additions & 8 deletions doomsday/plugins/common/src/hu_menu.c
Expand Up @@ -1593,7 +1593,7 @@ cvartemplate_t menuCVars[] = {
{ "menu-glitter", 0, CVT_FLOAT, &cfg.menuTextGlitter, 0, 1 },
{ "menu-fog", 0, CVT_INT, &cfg.hudFog, 0, 5 },
{ "menu-shadow", 0, CVT_FLOAT, &cfg.menuShadow, 0, 1 },
{ "menu-patch-replacement", 0, CVT_INT, &cfg.usePatchReplacement, PRM_FIRST, PRM_LAST },
{ "menu-patch-replacement", 0, CVT_INT, &cfg.menuPatchReplaceMode, PRM_FIRST, PRM_LAST },
{ "menu-slam", 0, CVT_BYTE, &cfg.menuSlam, 0, 1 },
{ "menu-quick-ask", 0, CVT_BYTE, &cfg.confirmQuickGameSave, 0, 1 },
{ "menu-hotkeys", 0, CVT_BYTE, &cfg.menuShortcutsEnabled, 0, 1 },
Expand Down Expand Up @@ -2837,7 +2837,7 @@ void Hu_MenuDrawMainPage(mn_page_t* page, int x, int y)
FR_SetFont(FID(GF_FONTB));
FR_SetColorAndAlpha(1, 1, 1, mnRendState->pageAlpha);

WI_DrawPatch3(pMainTitle, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, pMainTitle), x + TITLEOFFSET_X, y + TITLEOFFSET_Y, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pMainTitle, Hu_ChoosePatchReplacement(cfg.menuPatchReplaceMode, pMainTitle), x + TITLEOFFSET_X, y + TITLEOFFSET_Y, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#if __JHEXEN__
GL_DrawPatch(pBullWithFire[(frame + 2) % 7], x - 73, y + 24);
GL_DrawPatch(pBullWithFire[frame], x + 168, y + 24);
Expand Down Expand Up @@ -2962,7 +2962,7 @@ void Hu_MenuDrawEpisodePage(mn_page_t* page, int x, int y)
FR_SetFont(FID(GF_FONTB));
FR_SetColorAndAlpha(cfg.menuTextColors[0][CR], cfg.menuTextColors[0][CG], cfg.menuTextColors[0][CB], mnRendState->pageAlpha);

WI_DrawPatch3(pEpisode, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pEpisode, "{case}Which Episode{scaley=1.25,y=-3}?", true), x + 7, y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pEpisode, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pEpisode, "{case}Which Episode{scaley=1.25,y=-3}?", true), x + 7, y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#endif

DGL_Disable(DGL_TEXTURE_2D);
Expand All @@ -2977,8 +2977,8 @@ void Hu_MenuDrawSkillPage(mn_page_t* page, int x, int y)
FR_SetColorAndAlpha(cfg.menuTextColors[0][CR], cfg.menuTextColors[0][CG], cfg.menuTextColors[0][CB], mnRendState->pageAlpha);

#if __JDOOM__ || __JDOOM64__
WI_DrawPatch3(pNewGame, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pNewGame, "{case}NEW GAME", true), x + 48, y - 49, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pSkill, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pSkill, "{case}Choose Skill Level:", true), x + 6, y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pNewGame, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pNewGame, "{case}NEW GAME", true), x + 48, y - 49, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pSkill, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pSkill, "{case}Choose Skill Level:", true), x + 6, y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#elif __JHEXEN__
FR_DrawText3("Choose Skill Level:", x - 46, y - 28, ALIGN_TOPLEFT, MN_MergeMenuEffectWithDrawTextFlags(0));
#endif
Expand Down Expand Up @@ -3249,7 +3249,7 @@ void Hu_MenuDrawLoadGamePage(mn_page_t* page, int x, int y)
#if __JHERETIC__ || __JHEXEN__
FR_DrawText3("Load Game", SCREENWIDTH/2, y-20, ALIGN_TOP, MN_MergeMenuEffectWithDrawTextFlags(0));
#else
WI_DrawPatch3(pLoadGame, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pLoadGame, "{case}Load game", true), x - 8, y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pLoadGame, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pLoadGame, "{case}Load game", true), x - 8, y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#endif

DGL_Disable(DGL_TEXTURE_2D);
Expand All @@ -3265,7 +3265,7 @@ void Hu_MenuDrawSaveGamePage(mn_page_t* page, int x, int y)
#if __JHERETIC__ || __JHEXEN__
FR_DrawText3("Save Game", SCREENWIDTH/2, y-20, ALIGN_TOP, MN_MergeMenuEffectWithDrawTextFlags(0));
#else
WI_DrawPatch3(pSaveGame, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pSaveGame, "{case}Save game", true), x - 8, y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pSaveGame, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pSaveGame, "{case}Save game", true), x - 8, y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#endif

DGL_Disable(DGL_TEXTURE_2D);
Expand All @@ -3290,7 +3290,7 @@ void Hu_MenuDrawOptionsPage(mn_page_t* page, int x, int y)
#if __JHERETIC__ || __JHEXEN__
FR_DrawText3("OPTIONS", x + 42, y - 38, ALIGN_TOP, MN_MergeMenuEffectWithDrawTextFlags(0));
#else
WI_DrawPatch3(pOptionsTitle, Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pOptionsTitle, "{case}OPTIONS", true), x + 42, y - 20, ALIGN_TOP, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
WI_DrawPatch3(pOptionsTitle, Hu_ChoosePatchReplacement2(cfg.menuPatchReplaceMode, pOptionsTitle, "{case}OPTIONS", true), x + 42, y - 20, ALIGN_TOP, 0, MN_MergeMenuEffectWithDrawTextFlags(0));
#endif

DGL_Disable(DGL_TEXTURE_2D);
Expand Down
17 changes: 11 additions & 6 deletions doomsday/plugins/common/src/hu_stuff.c
Expand Up @@ -1163,22 +1163,27 @@ const char* Hu_ChoosePatchReplacement2(patchreplacemode_t mode, patchid_t patchI
const char* replacement = NULL; // No replacement possible/wanted.
boolean isCustom = false;
patchinfo_t info;
if(patchId != 0 && R_GetPatchInfo(patchId, &info))

if(mode == PRM_NONE)
{
isCustom = info.isCustom;
return NULL;
}

if(patchId != 0)
{
if(R_GetPatchInfo(patchId, &info))
{
isCustom = info.isCustom;
}

if(altString && altString[0] && !builtin)
{ // We have already determined a string to replace this with.
if(!isCustom)
{
replacement = altString;
}
}
else if(mode != PRM_NONE)
else
{ // We might be able to replace the patch with a string replacement.
// A user replacement?
replacement = Hu_FindPatchReplacementString(patchId, PRF_NO_PWAD);
Expand Down Expand Up @@ -1498,7 +1503,7 @@ void Hu_Drawer(void)
FR_SetFont(FID(GF_FONTB));
FR_LoadDefaultAttrib();

WI_DrawPatch3(m_pause, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, m_pause), 0, 0, ALIGN_TOP, DPF_NO_OFFSET, 0);
WI_DrawPatch3(m_pause, Hu_ChoosePatchReplacement(PRM_ONLY_CUSTOM, m_pause), 0, 0, ALIGN_TOP, DPF_NO_OFFSET, 0);

DGL_Disable(DGL_TEXTURE_2D);

Expand Down Expand Up @@ -1567,7 +1572,7 @@ static void drawMapTitle(void)
# else // __JDOOM64__
mapnum = gameMap;
# endif
WI_DrawPatch3(pMapNames[mapnum], Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, pMapNames[mapnum], lname, false), 0, 0, ALIGN_TOP, 0, DTF_ONLY_SHADOW);
WI_DrawPatch3(pMapNames[mapnum], Hu_ChoosePatchReplacement2(PRM_CUSTOM_OR_BUILTIN, pMapNames[mapnum], lname, false), 0, 0, ALIGN_TOP, 0, DTF_ONLY_SHADOW);

y += 14;
#elif __JHERETIC__ || __JHEXEN__
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/jdoom/data/conhelp.txt
Expand Up @@ -901,3 +901,6 @@ desc = 1=Stop updating the automap rendering lists.

[inlude-stretch]
desc = Intermission stretch-scaling strategy 0=Smart, 1=Never, 2=Always.

[inlude-patch-replacement]
desc = Intermission Patch Replacement strings. 1=Enable external, 2=Enable built-in.
3 changes: 2 additions & 1 deletion doomsday/plugins/jdoom/include/d_config.h
Expand Up @@ -102,6 +102,7 @@ typedef struct jdoom_config_s {
byte menuSlam;
byte menuShortcutsEnabled;
byte menuScaleMode;
int menuPatchReplaceMode;
byte menuGameSaveSuggestName;
byte menuCursorRotate;
float menuTextColors[MENU_COLOR_COUNT][3];
Expand All @@ -110,6 +111,7 @@ typedef struct jdoom_config_s {
float menuTextGlitter;

byte inludeScaleMode;
int inludePatchReplaceMode;

byte confirmQuickGameSave;
byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility.
Expand All @@ -120,7 +122,6 @@ typedef struct jdoom_config_s {
float hudIconAlpha;
float hudTimer; // Number of seconds until the hud/statusbar auto-hides.
byte hudUnHide[NUMHUDUNHIDEEVENTS]; // when the hud/statusbar unhides.
int usePatchReplacement;
byte moveCheckZ; // if true, mobjs can move over/under each other.
byte weaponAutoSwitch;
byte noWeaponAutoSwitchIfFiring;
Expand Down
5 changes: 4 additions & 1 deletion doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -177,7 +177,7 @@ void D_PreInit(void)
cfg.echoMsg = true;
cfg.lookSpeed = 3;
cfg.turnSpeed = 1;
cfg.usePatchReplacement = 2; // Use built-in replacements if available.
cfg.menuPatchReplaceMode = PRM_CUSTOM_OR_BUILTIN;
cfg.menuScale = .9f;
cfg.menuTextGlitter = .5f;
cfg.menuShadow = 0.33f;
Expand All @@ -188,6 +188,9 @@ void D_PreInit(void)
cfg.menuTextFlashColor[2] = 1;
cfg.menuTextFlashSpeed = 4;
cfg.menuCursorRotate = true;

cfg.inludePatchReplaceMode = PRM_CUSTOM_OR_BUILTIN;

cfg.hudKeysCombine = false;
cfg.hudShown[HUD_HEALTH] = true;
cfg.hudShown[HUD_ARMOR] = true;
Expand Down
19 changes: 6 additions & 13 deletions doomsday/plugins/jdoom/src/st_stuff.c
Expand Up @@ -1481,10 +1481,7 @@ void SBarFace_Drawer(uiwidget_t* obj, int x, int y)

DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, iconAlpha);
FR_SetFont(FID(GF_FONTB));
FR_SetColorAndAlpha(1, 1, 1, iconAlpha);

WI_DrawPatch2(patchId, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, patchId), ORIGINX+ST_FACESX, ORIGINY+ST_FACESY, ALIGN_TOPLEFT);
GL_DrawPatch2(patchId, ORIGINX+ST_FACESX, ORIGINY+ST_FACESY, ALIGN_TOPLEFT);

DGL_Disable(DGL_TEXTURE_2D);
DGL_MatrixMode(DGL_MODELVIEW);
Expand Down Expand Up @@ -1582,13 +1579,11 @@ void KeySlot_Drawer(uiwidget_t* obj, int x, int y)

DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, iconAlpha);
FR_SetFont(FID(GF_FONTB));
FR_SetColorAndAlpha(1, 1, 1, iconAlpha);

WI_DrawPatch(kslt->patchId, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, kslt->patchId), loc->x + offset, loc->y + offset);
GL_DrawPatch(kslt->patchId, loc->x + offset, loc->y + offset);
if(kslt->patchId2 != 0)
{
WI_DrawPatch(kslt->patchId2, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, kslt->patchId2), loc->x - offset, loc->y - offset);
GL_DrawPatch(kslt->patchId2, loc->x - offset, loc->y - offset);
}

DGL_Disable(DGL_TEXTURE_2D);
Expand Down Expand Up @@ -1722,10 +1717,8 @@ void WeaponSlot_Drawer(uiwidget_t* obj, int x, int y)

DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, textAlpha);
FR_SetFont(FID(GF_FONTB));
FR_SetColorAndAlpha(1, 1, 1, textAlpha);

WI_DrawPatch(wpns->patchId, Hu_ChoosePatchReplacement(cfg.usePatchReplacement, wpns->patchId), element->x, element->y);
GL_DrawPatch(wpns->patchId, element->x, element->y);

DGL_Disable(DGL_TEXTURE_2D);
DGL_MatrixMode(DGL_MODELVIEW);
Expand Down Expand Up @@ -2842,7 +2835,7 @@ void MapName_Drawer(uiwidget_t* obj, int x, int y)
const float scale = .75f;
const float textAlpha = uiRendState->pageAlpha;
const patchid_t patch = P_FindMapTitlePatch(gameEpisode, gameMap);
const char* text = Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, patch, P_GetMapNiceName(), false);
const char* text = Hu_ChoosePatchReplacement2(PRM_CUSTOM_OR_BUILTIN, patch, P_GetMapNiceName(), false);

if(NULL == text && 0 == patch)
return;
Expand Down Expand Up @@ -2870,7 +2863,7 @@ void MapName_UpdateDimensions(uiwidget_t* obj)
assert(NULL != obj && obj->type == GUI_MAPNAME);
{
const patchid_t patch = P_FindMapTitlePatch(gameEpisode, gameMap);
const char* text = Hu_ChoosePatchReplacement2(cfg.usePatchReplacement, patch, P_GetMapNiceName(), false);
const char* text = Hu_ChoosePatchReplacement2(PRM_CUSTOM_OR_BUILTIN, patch, P_GetMapNiceName(), false);
const float scale = .75f;
patchinfo_t info;

Expand Down

0 comments on commit bf4c5e8

Please sign in to comment.