Skip to content

Commit

Permalink
- use explicit virtual screen sizes for the scripted intermission bac…
Browse files Browse the repository at this point in the history
…kgrounds to better cope with background replacements.

A new command, "screensize", has been added to allow setting it explicitly, and this has been used for all the stock animations.
  • Loading branch information
coelckers committed Sep 18, 2021
1 parent 914b54f commit a6819bf
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/wi_stuff.cpp
Expand Up @@ -92,6 +92,7 @@ static const char *WI_Cmd[] = {
"Pic",

"NoAutostartMap",
"Screensize",

NULL
};
Expand Down Expand Up @@ -169,7 +170,10 @@ class DInterBackground : public DObject
FGameTexture *background = nullptr;
wbstartstruct_t *wbs;
level_info_t *exitlevel;

int bgwidth = -1;
int bgheight = -1;


public:

DInterBackground(wbstartstruct_t *wbst);
Expand Down Expand Up @@ -456,6 +460,13 @@ bool DInterBackground::LoadBackground(bool isenterpic)
noautostartmap = true;
break;

case 15: // screensize
sc.MustGetNumber();
bgwidth = sc.Number;
sc.MustGetNumber();
bgheight = sc.Number;
break;

readanimation:
sc.MustGetString();
an.LevelName = sc.String;
Expand Down Expand Up @@ -591,20 +602,23 @@ DEFINE_ACTION_FUNCTION(DInterBackground, updateAnimatedBack)
void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointeron)
{
unsigned int i;
double animwidth = 320; // For a flat fill or clear background scale animations to 320x200
double animheight = 200;
double animwidth = bgwidth; // For a flat fill or clear background scale animations to 320x200
double animheight = bgheight;

if (background)
{
// background
if (background->isMiscPatch())
{
// scale all animations below to fit the size of the base pic
// if no explicit size was set scale all animations below to fit the size of the base pic
// The base pic is always scaled to fit the screen so this allows
// placing the animations precisely where they belong on the base pic
animwidth = background->GetDisplayWidth();
animheight = background->GetDisplayHeight();
if (animheight == 200) animwidth = 320; // deal with widescreen replacements that keep the original coordinates.
if (bgwidth < 0 || bgheight < 0)
{
animwidth = background->GetDisplayWidth();
animheight = background->GetDisplayHeight();
if (animheight == 200) animwidth = 320; // deal with widescreen replacements that keep the original coordinates.
}
DrawTexture(twod, background, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
}
else
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_epi1.txt
@@ -1,4 +1,5 @@
Background wimap0
Screensize 320 200
Splat wisplat
Pointer wiurh0 wiurh1

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_epi2.txt
@@ -1,4 +1,5 @@
Background wimap1
Screensize 320 200
Splat wisplat
Pointer wiurh0 wiurh1

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_epi3.txt
@@ -1,4 +1,5 @@
Background wimap2
Screensize 320 200
Splat wisplat
Pointer wiurh0 wiurh1

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_htc1.txt
@@ -1,5 +1,6 @@
NoAutostartMap
Background mape1
Screensize 320 200
Splat in_x
Pointer in_yah

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_htc2.txt
@@ -1,5 +1,6 @@
NoAutostartMap
Background mape2
Screensize 320 200
Splat in_x
Pointer in_yah

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/in_htc3.txt
@@ -1,5 +1,6 @@
NoAutostartMap
Background mape3
Screensize 320 200
Splat in_x
Pointer in_yah

Expand Down

0 comments on commit a6819bf

Please sign in to comment.