Skip to content

Commit

Permalink
Heretic|Intermission: Using a patch image as background
Browse files Browse the repository at this point in the history
The Intermission Background of a Map Info can now be set to a patch in Heretic.

Instead of attempting to solve this at a lower level, the intermission drawing routine now checks whether the defined image is a flat or a patch, and draws it with bespoke code for the type of resource.

IssueID #2427
  • Loading branch information
skyjake committed May 31, 2020
1 parent fd39927 commit d64f14e
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions doomsday/apps/plugins/heretic/src/intermission.cpp
Expand Up @@ -256,14 +256,14 @@ static void tickNoState()
}
}

static void drawBackground()
static void drawBackground(patchid_t patch)
{
if(!haveLocationMap) return;

DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, 1);

GL_DrawPatch(pBackground, Vector2i(0, 0), ALIGN_TOPLEFT, DPF_NO_OFFSET);
GL_DrawPatch(patch, Vector2i(0, 0), ALIGN_TOPLEFT, DPF_NO_OFFSET);

DGL_Disable(DGL_TEXTURE_2D);
}
Expand Down Expand Up @@ -792,18 +792,28 @@ static void drawStats()
}
}

// Draw the background.
DGL_SetMaterialUI((world_Material *)P_ToPtr(DMU_MATERIAL, Materials_ResolveUriCString(bgMaterial)), DGL_REPEAT, DGL_REPEAT);
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, 1);
DGL_DrawRectf2Tiled(0, 0, SCREENWIDTH, SCREENHEIGHT, 64, 64);
DGL_Disable(DGL_TEXTURE_2D);
if (bgMaterial.startsWith("Flats:") || bgMaterial.startsWith("flats:"))
{
// Draw a background flat.
DGL_SetMaterialUI(
(world_Material *) P_ToPtr(DMU_MATERIAL, Materials_ResolveUriCString(bgMaterial)),
DGL_REPEAT,
DGL_REPEAT);
DGL_Enable(DGL_TEXTURE_2D);
DGL_Color4f(1, 1, 1, 1);
DGL_DrawRectf2Tiled(0, 0, SCREENWIDTH, SCREENHEIGHT, 64, 64);
DGL_Disable(DGL_TEXTURE_2D);
}
else if (bgMaterial.startsWith("Patches:") || bgMaterial.startsWith("patches:"))
{
drawBackground(R_DeclarePatch(bgMaterial.constData() + strlen("Patches:")));
}

switch(gameType)
switch (gameType)
{
case SINGLE: drawSinglePlayerStats(); break;
case COOPERATIVE: drawNetgameStats(); break;
case DEATHMATCH: drawDeathmatchStats(); break;
case SINGLE: drawSinglePlayerStats(); break;
case COOPERATIVE: drawNetgameStats(); break;
case DEATHMATCH: drawDeathmatchStats(); break;
}
}

Expand Down Expand Up @@ -996,19 +1006,19 @@ void IN_Drawer()
break;

case 1: // Leaving old level.
drawBackground();
drawBackground(pBackground);
drawLocationMarks();
drawFinishedTitle();
break;

case 2: // Going to the next level.
drawBackground();
drawBackground(pBackground);
drawLocationMarks(!(interTime & 16) || inState == 3, false /*don't flash current location mark*/);
drawEnteringTitle();
break;

case 3: // Waiting before going to the next level.
drawBackground();
drawBackground(pBackground);
break;

default:
Expand Down

0 comments on commit d64f14e

Please sign in to comment.