Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NyanDoom widescreen patch support #2191

Merged
merged 4 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -147,7 +147,7 @@
CHOICE_VALUE = 0,
} mchoice_t;

typedef struct

Check warning on line 150 in src/mn_menu.c

View workflow job for this annotation

GitHub Actions / Clang-Tidy

src/mn_menu.c:150:9 [clang-analyzer-optin.performance.Padding]

Excessive padding in 'menuitem_t' (15 padding bytes, where 7 is optimal). Optimal fields order: routine, alttext, flags, status, rect, alphaKey, name, consider reordering the fields or adding explicit padding members
{
short status; // 0 = no cursor here, 1 = ok, 2 = arrows ok
char name[10];
Expand Down Expand Up @@ -434,7 +434,8 @@

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 @@
// 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 @@
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
29 changes: 29 additions & 0 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,35 @@ int W_GetNumForName (const char* name) // killough -- const added
return i;
}

// [Nyan] Widescreen patches
const char *M_ApplyWidePatch(const char *lump_main)
{
static char lump_wide[9] = "W_";
char lump_short[7];

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;
}

size_t short_size = strlen(lump_short);

memcpy(&lump_wide[2], lump_short, short_size + 1);

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

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