Skip to content

Commit

Permalink
removed needless code, improved function name scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
elf-alchemist committed Feb 10, 2025
1 parent 70c7ad6 commit 365230b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 35 deletions.
3 changes: 2 additions & 1 deletion src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ void D_PageTicker(void)

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

//
Expand Down
16 changes: 8 additions & 8 deletions src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static boolean MapInfo_Drawer(void)
{
V_DrawPatchFullScreen(
V_CachePatchName(
M_ApplyWidePatch(gamemapinfo->endpic), PU_CACHE));
W_CheckWidescreenPatch(gamemapinfo->endpic), PU_CACHE));
}
break;
case FINALE_STAGE_CAST:
Expand Down Expand Up @@ -771,7 +771,7 @@ static void F_CastDrawer(void)
// erase the entire screen to a background
// Ty 03/30/98 bg texture extern
V_DrawPatchFullScreen(
V_CachePatchName(M_ApplyWidePatch(bgcastcall), PU_CACHE));
V_CachePatchName(W_CheckWidescreenPatch(bgcastcall), PU_CACHE));

F_CastPrint (castorder[castnum].name);

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

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

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

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

//
Expand All @@ -449,13 +449,13 @@ static void M_DrawReadThis2(void)
// gameversion == exe_doom_1_9 and gamemode == registered

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

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

/////////////////////////////
Expand Down Expand Up @@ -1918,11 +1918,11 @@ static void M_DrawHelp(void)
int helplump;
if (gamemode == commercial)
{
helplump = W_CheckNumForName(M_ApplyWidePatch("HELP"));
helplump = W_CheckNumForName(W_CheckWidescreenPatch("HELP"));
}
else
{
helplump = W_CheckNumForName(M_ApplyWidePatch("HELP1"));
helplump = W_CheckNumForName(W_CheckWidescreenPatch("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(M_ApplyWidePatch("STBAR"), PU_CACHE);
patch_t *sbar = V_CachePatchName(W_CheckWidescreenPatch("STBAR"), PU_CACHE);
// [FG] temporarily draw status bar to background buffer
V_DrawPatch(-video.deltaw, 0, sbar);

Expand Down
20 changes: 2 additions & 18 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,31 +386,15 @@ int W_GetNumForName (const char* name) // killough -- const added
}

// [Nyan] Widescreen patches
const char *M_ApplyWidePatch(const char *lump_main)
const char *W_CheckWidescreenPatch(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);
strncpy(&lump_wide[2], lump_main, 6);

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

return lump_main;
}

Expand Down
2 changes: 1 addition & 1 deletion src/w_wad.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ 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);
const char *W_CheckWidescreenPatch(const char *lump);

void W_ExtractFileBase(const char *, char *); // killough
unsigned W_LumpNameHash(const char *s); // killough 1/31/98
Expand Down
3 changes: 2 additions & 1 deletion src/wi_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ void WI_slamBackground(void)
name = lump;
}

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

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

0 comments on commit 365230b

Please sign in to comment.