Skip to content

Commit

Permalink
added NyanDoom widescreen patch support
Browse files Browse the repository at this point in the history
  • Loading branch information
elf-alchemist committed Feb 9, 2025
1 parent 6240a6e commit 010882b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void D_PageTicker(void)

void D_PageDrawer(void)
{
V_DrawPatchFullScreen(V_CachePatchName(pagename, PU_CACHE));
V_DrawPatchFullScreen(V_CachePatchName(M_ApplyWidePatch(pagename), PU_CACHE));
}

//
Expand Down
25 changes: 16 additions & 9 deletions src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ static boolean MapInfo_Drawer(void)
else if (gamemapinfo->endpic[0])
{
V_DrawPatchFullScreen(
V_CachePatchName(gamemapinfo->endpic, PU_CACHE));
V_CachePatchName(
M_ApplyWidePatch(gamemapinfo->endpic), PU_CACHE));
}
break;
case FINALE_STAGE_CAST:
Expand Down Expand Up @@ -768,7 +769,9 @@ static void F_CastDrawer(void)
patch_t* patch;

// erase the entire screen to a background
V_DrawPatchFullScreen (V_CachePatchName (bgcastcall, PU_CACHE)); // Ty 03/30/98 bg texture extern
// Ty 03/30/98 bg texture extern
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch(bgcastcall), PU_CACHE));

F_CastPrint (castorder[castnum].name);

Expand Down Expand Up @@ -797,8 +800,8 @@ static void F_BunnyScroll(void)
int stage;
static int laststage;

p1 = V_CachePatchName ("PFUB1", PU_LEVEL);
p2 = V_CachePatchName ("PFUB2", PU_LEVEL);
p1 = V_CachePatchName(M_ApplyWidePatch("PFUB1"), PU_LEVEL);
p2 = V_CachePatchName(M_ApplyWidePatch("PFUB2"), PU_LEVEL);

scrolled = 320 - (finalecount-230)/2;

Expand Down Expand Up @@ -883,18 +886,22 @@ void F_Drawer (void)
{
case 1:
if ( gamemode == retail || gamemode == commercial )
V_DrawPatchFullScreen (V_CachePatchName("CREDIT",PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("CREDIT"),PU_CACHE));
else
V_DrawPatchFullScreen (V_CachePatchName("HELP2",PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("HELP2"),PU_CACHE));
break;
case 2:
V_DrawPatchFullScreen (V_CachePatchName("VICTORY2",PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("VICTORY2"),PU_CACHE));
break;
case 3:
F_BunnyScroll ();
F_BunnyScroll();
break;
case 4:
V_DrawPatchFullScreen (V_CachePatchName("ENDPIC",PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("ENDPIC"),PU_CACHE));
break;
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ static void M_FinishHelp(int choice) // killough 10/98

static void M_DrawReadThis1(void)
{
V_DrawPatchFullScreen(V_CachePatchName("HELP2", PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("HELP2"), PU_CACHE));
}

//
Expand All @@ -447,12 +448,14 @@ static void M_DrawReadThis2(void)
// We only ever draw the second page if this is
// gameversion == exe_doom_1_9 and gamemode == registered

V_DrawPatchFullScreen(V_CachePatchName("HELP1", PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("HELP1"), PU_CACHE));
}

static void M_DrawReadThisCommercial(void)
{
V_DrawPatchFullScreen(V_CachePatchName("HELP", PU_CACHE));
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch("HELP"), PU_CACHE));
}

/////////////////////////////
Expand Down Expand Up @@ -1915,11 +1918,11 @@ static void M_DrawHelp(void)
int helplump;
if (gamemode == commercial)
{
helplump = W_CheckNumForName("HELP");
helplump = W_CheckNumForName(M_ApplyWidePatch("HELP"));
}
else
{
helplump = W_CheckNumForName("HELP1");
helplump = W_CheckNumForName(M_ApplyWidePatch("HELP1"));
}

V_DrawPatchFullScreen(V_CachePatchNum(helplump, PU_CACHE));
Expand Down
2 changes: 1 addition & 1 deletion src/st_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ static void DrawSolidBackground(void)
// [FG] calculate average color of the 16px left and right of the status bar
const int vstep[][2] = { {0, 1}, {1, 2}, {2, ST_HEIGHT} };

patch_t *sbar = V_CachePatchName("STBAR", PU_CACHE);
patch_t *sbar = V_CachePatchName(M_ApplyWidePatch("STBAR"), PU_CACHE);
// [FG] temporarily draw status bar to background buffer
V_DrawPatch(-video.deltaw, 0, sbar);

Expand Down
33 changes: 33 additions & 0 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,39 @@ int W_GetNumForName (const char* name) // killough -- const added
return i;
}

// [Nyan] Widescreen patches
const char *M_ApplyWidePatch(const char *lump_main)
{
char *buffer;
char lump_short[7];
size_t main_size, prefix_size;

memcpy(lump_short, lump_main, strnlen(lump_main,7));

if (strlen(lump_main) > 6)
{
lump_short[6] = 0;
}
else
{
lump_short[strlen(lump_main)] = 0;
}

main_size = strlen(lump_short);
prefix_size = strlen("W_");

buffer = Z_Malloc(prefix_size + main_size + 1, PU_STATIC, NULL);
memcpy(buffer, "W_", prefix_size);
memcpy(buffer + prefix_size, lump_short, main_size + 1);

if (W_CheckNumForName(buffer) >= 0)
{
return buffer;
}

return lump_main;
}

//
// W_InitMultipleFiles
// Pass a null terminated list of files to use.
Expand Down
2 changes: 2 additions & 0 deletions src/w_wad.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ void *W_CacheLumpNum(int lump, pu_tag tag);

#define W_CacheLumpName(name,tag) W_CacheLumpNum (W_GetNumForName(name),(tag))

const char *M_ApplyWidePatch(const char *lump);

void W_ExtractFileBase(const char *, char *); // killough
unsigned W_LumpNameHash(const char *s); // killough 1/31/98

Expand Down
2 changes: 1 addition & 1 deletion src/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ void WI_slamBackground(void)
name = lump;
}

V_DrawPatchFullScreen(V_CachePatchName(name, PU_CACHE));
V_DrawPatchFullScreen(V_CachePatchName(M_ApplyWidePatch(name), PU_CACHE));
}

// ====================================================================
Expand Down

0 comments on commit 010882b

Please sign in to comment.