Skip to content

Commit

Permalink
- made status bar offset fixing unconditional.
Browse files Browse the repository at this point in the history
I think it is inevitable that such status bars will appear in mods sooner or later and with the old code it is virtually impossible to create a wide status bar that displays properly but gets subjected to this code.
  • Loading branch information
coelckers committed Oct 24, 2020
1 parent ce17f1a commit 79944ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
34 changes: 9 additions & 25 deletions src/d_main.cpp
Expand Up @@ -2964,32 +2964,16 @@ static void CheckForHacks(BuildInfo& buildinfo)
}
}

static void FixUnityStatusBar()
static void FixWideStatusBar()
{
if (gameinfo.flags & GI_FIXUNITYSBAR)
{
FGameTexture* sbartex = TexMan.FindGameTexture("stbar", ETextureType::MiscPatch);

// texture not found, we're not here to operate on a non-existent texture so just exit
if (!sbartex)
return;
FGameTexture* sbartex = TexMan.FindGameTexture("stbar", ETextureType::MiscPatch);

// where is this texture located? if it's not in an iwad, then exit
int lumpnum = sbartex->GetSourceLump();
if (lumpnum >= 0 && lumpnum < fileSystem.GetNumEntries())
{
int wadno = fileSystem.GetFileContainer(lumpnum);
if (!(wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum()))
return;
}

// only adjust offsets if none already exist
if (sbartex->GetTexelWidth() > 320 &&
!sbartex->GetTexelLeftOffset(0) && !sbartex->GetTexelTopOffset(0))
{
sbartex->SetOffsets(0, (sbartex->GetTexelWidth() - 320) / 2, 0);
sbartex->SetOffsets(1, (sbartex->GetTexelWidth() - 320) / 2, 0);
}
// only adjust offsets if none already exist
if (sbartex && sbartex->GetTexelWidth() > 320 &&
!sbartex->GetTexelLeftOffset(0) && !sbartex->GetTexelTopOffset(0))
{
sbartex->SetOffsets(0, (sbartex->GetTexelWidth() - 320) / 2, 0);
sbartex->SetOffsets(1, (sbartex->GetTexelWidth() - 320) / 2, 0);
}
}

Expand Down Expand Up @@ -3374,7 +3358,7 @@ static int D_DoomMain_Internal (void)
TexAnim.Init();
C_InitConback();

FixUnityStatusBar();
FixWideStatusBar();

StartScreen->Progress();
V_InitFonts();
Expand Down
1 change: 0 additions & 1 deletion wadsrc/static/mapinfo/common.txt
Expand Up @@ -359,7 +359,6 @@ Intermission Inter_Bunny

Intermission TheEnd
{
// no backgrounds are set here so this will reuse the previous one.
Image
{
Draw = "END0", 108, 68
Expand Down

5 comments on commit 79944ca

@Blue-Shadow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean the IWADINFO flag/property is useless now?

@coelckers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that it means. I always felt it was a needless complication just to handle a nearly improbable edge case. I haven't cleaned it up yet, though - just in case it is needed after all.

@Blue-Shadow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. Thanks for the answer.

@rawr51919
Copy link
Contributor

@rawr51919 rawr51919 commented on 79944ca Oct 25, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coelckers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't mean anything. It was just a needlessly overcautious approach to adjust for the Unity widescreen status bar.
The whole thing was done in a way that would have prevented other mods from integrating a status bar that's compatible with both GZDoom and Unity Doom.
The case this guarded against would never have worked in GZDoom previously so it was rather pointless.

Please sign in to comment.