- use explicit virtual screen sizes for the scripted intermission backgrounds 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.
This commit is contained in:
Christoph Oelckers 2021-09-18 09:19:13 +02:00
parent 914b54ffd5
commit a6819bfe62
7 changed files with 27 additions and 7 deletions

View file

@ -92,6 +92,7 @@ static const char *WI_Cmd[] = {
"Pic", "Pic",
"NoAutostartMap", "NoAutostartMap",
"Screensize",
NULL NULL
}; };
@ -169,7 +170,10 @@ private:
FGameTexture *background = nullptr; FGameTexture *background = nullptr;
wbstartstruct_t *wbs; wbstartstruct_t *wbs;
level_info_t *exitlevel; level_info_t *exitlevel;
int bgwidth = -1;
int bgheight = -1;
public: public:
DInterBackground(wbstartstruct_t *wbst); DInterBackground(wbstartstruct_t *wbst);
@ -456,6 +460,13 @@ bool DInterBackground::LoadBackground(bool isenterpic)
noautostartmap = true; noautostartmap = true;
break; break;
case 15: // screensize
sc.MustGetNumber();
bgwidth = sc.Number;
sc.MustGetNumber();
bgheight = sc.Number;
break;
readanimation: readanimation:
sc.MustGetString(); sc.MustGetString();
an.LevelName = sc.String; an.LevelName = sc.String;
@ -591,20 +602,23 @@ DEFINE_ACTION_FUNCTION(DInterBackground, updateAnimatedBack)
void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointeron) void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointeron)
{ {
unsigned int i; unsigned int i;
double animwidth = 320; // For a flat fill or clear background scale animations to 320x200 double animwidth = bgwidth; // For a flat fill or clear background scale animations to 320x200
double animheight = 200; double animheight = bgheight;
if (background) if (background)
{ {
// background // background
if (background->isMiscPatch()) 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 // The base pic is always scaled to fit the screen so this allows
// placing the animations precisely where they belong on the base pic // placing the animations precisely where they belong on the base pic
animwidth = background->GetDisplayWidth(); if (bgwidth < 0 || bgheight < 0)
animheight = background->GetDisplayHeight(); {
if (animheight == 200) animwidth = 320; // deal with widescreen replacements that keep the original coordinates. 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); DrawTexture(twod, background, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
} }
else else

View file

@ -1,4 +1,5 @@
Background wimap0 Background wimap0
Screensize 320 200
Splat wisplat Splat wisplat
Pointer wiurh0 wiurh1 Pointer wiurh0 wiurh1

View file

@ -1,4 +1,5 @@
Background wimap1 Background wimap1
Screensize 320 200
Splat wisplat Splat wisplat
Pointer wiurh0 wiurh1 Pointer wiurh0 wiurh1

View file

@ -1,4 +1,5 @@
Background wimap2 Background wimap2
Screensize 320 200
Splat wisplat Splat wisplat
Pointer wiurh0 wiurh1 Pointer wiurh0 wiurh1

View file

@ -1,5 +1,6 @@
NoAutostartMap NoAutostartMap
Background mape1 Background mape1
Screensize 320 200
Splat in_x Splat in_x
Pointer in_yah Pointer in_yah

View file

@ -1,5 +1,6 @@
NoAutostartMap NoAutostartMap
Background mape2 Background mape2
Screensize 320 200
Splat in_x Splat in_x
Pointer in_yah Pointer in_yah

View file

@ -1,5 +1,6 @@
NoAutostartMap NoAutostartMap
Background mape3 Background mape3
Screensize 320 200
Splat in_x Splat in_x
Pointer in_yah Pointer in_yah