stretch short skies (#481)

* stretch short skies

While at it, remove the "Files Preloaded at Game Startup" section
from the General menu. More menu clean-up will be due with the follow-up
commits, though.

Unfortunately, I couldn't simplify the code path in do_draw_plane() any
further, because there are maps like Ancient Aliens MAP11 which have
a short F_SKY1 texture but tall PL_SKYFLAT textures,
which have to be taken into account.

* fix vertical position for tall sky textures
This commit is contained in:
Fabian Greffrath 2022-03-25 12:52:12 +01:00 committed by GitHub
parent 7e2ece5a95
commit f621df8f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 30 deletions

View File

@ -602,6 +602,8 @@ static void G_DoLoadLevel(void)
break;
}//jff 3/27/98 end sky setting fix
R_InitSkyMap(); // [FG] stretch short skies
levelstarttic = gametic; // for time calculation
if (!demo_compatibility && demo_version < 203) // killough 9/29/98

View File

@ -56,6 +56,7 @@
#include "p_saveg.h" // saveg_compat
#include "m_input.h"
#include "r_draw.h" // [FG] R_SetFuzzColumnMode
#include "r_sky.h" // [FG] R_InitSkyMap()
// [crispy] remove DOS reference from the game quit confirmation dialogs
#include "SDL_platform.h"
@ -3666,19 +3667,13 @@ enum {
general_leds
};
enum {
general_wad1,
general_wad2,
general_deh1,
general_deh2
};
enum {
general_corpse,
general_realtic,
general_skill,
general_comp,
general_endoom,
general_stretchsky,
general_end
};
@ -3709,38 +3704,25 @@ setup_menu_t gen_settings2[] = { // General Settings screen2
{"Double Click acts as \"Use\"", S_YESNO, m_null, G_X,
G_Y + general_leds*8, {"dclick_use"}},
#if 0
{"Keyboard LEDs Always Off", S_YESNO, m_null, G_X,
G_Y + general_leds*8, {"leds_always_off"}, 0, 0, I_ResetLEDs},
#endif
{"Files Preloaded at Game Startup",S_SKIP|S_TITLE, m_null, G_X,
G_Y3 - 12},
{"WAD # 1", S_FILE, m_null, GF_X, G_Y3 + general_wad1*8, {"wadfile_1"}},
{"WAD #2", S_FILE, m_null, GF_X, G_Y3 + general_wad2*8, {"wadfile_2"}},
{"DEH/BEX # 1", S_FILE, m_null, GF_X, G_Y3 + general_deh1*8, {"dehfile_1"}},
{"DEH/BEX #2", S_FILE, m_null, GF_X, G_Y3 + general_deh2*8, {"dehfile_2"}},
{"Miscellaneous" ,S_SKIP|S_TITLE, m_null, G_X, G_Y4 - 12},
{"Miscellaneous" ,S_SKIP|S_TITLE, m_null, G_X, G_Y3 - 12},
{"Maximum number of player corpses", S_NUM|S_PRGWARN, m_null, G_X,
G_Y4 + general_corpse*8, {"max_player_corpse"}},
G_Y3 + general_corpse*8, {"max_player_corpse"}},
{"Game speed, percentage of normal", S_NUM|S_PRGWARN, m_null, G_X,
G_Y4 + general_realtic*8, {"realtic_clock_rate"}},
G_Y3 + general_realtic*8, {"realtic_clock_rate"}},
{"Default skill level", S_CHOICE|S_LEVWARN, m_null, G_X,
G_Y4 + general_skill*8, {"default_skill"}, 0, NULL, default_skill_strings},
G_Y3 + general_skill*8, {"default_skill"}, 0, NULL, default_skill_strings},
{"Default compatibility", S_CHOICE|S_LEVWARN, m_null, G_X,
G_Y4 + general_comp*8, {"default_complevel"}, 0, NULL, default_compatibility_strings},
G_Y3 + general_comp*8, {"default_complevel"}, 0, NULL, default_compatibility_strings},
{"Show ENDOOM screen", S_CHOICE, m_null, G_X,
G_Y4 + general_endoom*8, {"show_endoom"}, 0, NULL, default_endoom_strings},
G_Y3 + general_endoom*8, {"show_endoom"}, 0, NULL, default_endoom_strings},
{"Stretch short Skies", S_YESNO, m_null, G_X,
G_Y3 + general_stretchsky*8, {"stretchsky"}, 0, R_InitSkyMap},
{"<- PREV",S_SKIP|S_PREV, m_null, KB_PREV, KB_Y+20*8, {gen_settings1}},

View File

@ -49,6 +49,7 @@
#include "sounds.h"
#include "d_main.h"
#include "r_draw.h" // [FG] fuzzcolumn_mode
#include "r_sky.h" // [FG] stretchsky
#include "d_io.h"
#include <errno.h>
@ -173,6 +174,13 @@ default_t defaults[] = {
"show ENDOOM 0=off, 1=on, 2=PWAD only"
},
{
"stretchsky",
(config_t *) &stretchsky, NULL,
{0}, {0,1}, number, ss_gen, wad_no,
"1 to stretch short skies"
},
{ // killough 2/21/98
"pitched_sounds",
(config_t *) &pitched_sounds, NULL,

View File

@ -398,6 +398,13 @@ static void do_draw_plane(visplane_t *pl)
dc_texheight = textureheight[texture]>>FRACBITS; // killough
dc_iscale = pspriteiscale;
// [FG] stretch short skies
if (stretchsky && dc_texheight < 200)
{
dc_iscale = dc_iscale * dc_texheight / SKYSTRETCH_HEIGHT;
dc_texturemid = dc_texturemid * dc_texheight / SKYSTRETCH_HEIGHT;
}
// killough 10/98: Use sky scrolling offset, and possibly flip picture
for (x = pl->minx; (dc_x = x) <= pl->maxx; x++)
if ((unsigned)(dc_yl = pl->top[x]) <= (dc_yh = pl->bottom[x])) // [FG] 32-bit integer math

View File

@ -31,13 +31,17 @@
//-----------------------------------------------------------------------------
#include "r_sky.h"
#include "r_state.h" // [FG] textureheight[]
// [FG] stretch short skies
boolean stretchsky;
//
// sky mapping
//
int skyflatnum;
int skytexture;
int skytexture = -1; // [crispy] initialize
int skytexturemid;
//
@ -46,6 +50,20 @@ int skytexturemid;
//
void R_InitSkyMap (void)
{
int skyheight;
// [crispy] initialize
if (skytexture == -1)
return;
// [FG] stretch short skies
skyheight = textureheight[skytexture]>>FRACBITS;
if (stretchsky && skyheight < 200)
skytexturemid = -28*FRACUNIT;
else if (skyheight >= 200)
skytexturemid = 200*FRACUNIT;
else
skytexturemid = 100*FRACUNIT;
}

View File

@ -37,6 +37,10 @@
// The sky map is 256*128*4 maps.
#define ANGLETOSKYSHIFT 22
// [FG] stretch short skies
#define SKYSTRETCH_HEIGHT 228
extern boolean stretchsky;
extern int skytexture;
extern int skytexturemid;