linear horizontal sky scrolling

This is mostly this PR which I rejected for Crispy:
https://github.com/fabiangreffrath/crispy-doom/pull/629

Thank you very much @kitchen-ace for preparing this!
This commit is contained in:
Fabian Greffrath 2022-03-25 13:35:31 +01:00
parent 5b3f15a53e
commit e463f0b3ab
6 changed files with 46 additions and 12 deletions

View File

@ -57,6 +57,7 @@
#include "m_input.h" #include "m_input.h"
#include "r_draw.h" // [FG] R_SetFuzzColumnMode #include "r_draw.h" // [FG] R_SetFuzzColumnMode
#include "r_sky.h" // [FG] R_InitSkyMap() #include "r_sky.h" // [FG] R_InitSkyMap()
#include "r_plane.h" // [FG] R_InitPlanes()
// [crispy] remove DOS reference from the game quit confirmation dialogs // [crispy] remove DOS reference from the game quit confirmation dialogs
#include "SDL_platform.h" #include "SDL_platform.h"
@ -3598,8 +3599,8 @@ static const char *midi_player_strings[] = {
#define G_X 250 #define G_X 250
#define G_Y 44 #define G_Y 44
#define G_Y2 (G_Y+92+8) // [FG] remove sound and music card items #define G_Y2 (G_Y+92+8) // [FG] remove sound and music card items
#define G_Y3 (G_Y+44) #define G_Y3 (G_Y+44-8)
#define G_Y4 (G_Y3+52) #define G_Y4 (G_Y3+52-16)
#define GF_X 76 #define GF_X 76
setup_menu_t gen_settings1[] = { // General Settings screen1 setup_menu_t gen_settings1[] = { // General Settings screen1
@ -3665,6 +3666,11 @@ enum {
general_mouse2 general_mouse2
}; };
enum {
general_sky1,
general_sky2
};
enum { enum {
general_corpse, general_corpse,
general_realtic, general_realtic,
@ -3700,25 +3706,30 @@ setup_menu_t gen_settings2[] = { // General Settings screen2
{"Invert vertical axis", S_YESNO, m_null, G_X, {"Invert vertical axis", S_YESNO, m_null, G_X,
G_Y + general_mouse2*8, {"mouse_y_invert"}}, G_Y + general_mouse2*8, {"mouse_y_invert"}},
{"Miscellaneous" ,S_SKIP|S_TITLE, m_null, G_X, G_Y3 - 12}, {"Sky Drawing" ,S_SKIP|S_TITLE, m_null, G_X, G_Y3 - 12},
{"Stretch Short Skies", S_YESNO, m_null, G_X,
G_Y3 + general_sky1*8, {"stretchsky"}, 0, R_InitSkyMap},
{"Linear Horizontal Scrolling", S_YESNO, m_null, G_X,
G_Y3 + general_sky2*8, {"linearsky"}, 0, R_InitPlanes},
{"Miscellaneous" ,S_SKIP|S_TITLE, m_null, G_X, G_Y4 - 12},
{"Maximum number of player corpses", S_NUM|S_PRGWARN, m_null, G_X, {"Maximum number of player corpses", S_NUM|S_PRGWARN, m_null, G_X,
G_Y3 + general_corpse*8, {"max_player_corpse"}}, G_Y4 + general_corpse*8, {"max_player_corpse"}},
{"Game speed, percentage of normal", S_NUM|S_PRGWARN, m_null, G_X, {"Game speed, percentage of normal", S_NUM|S_PRGWARN, m_null, G_X,
G_Y3 + general_realtic*8, {"realtic_clock_rate"}}, G_Y4 + general_realtic*8, {"realtic_clock_rate"}},
{"Default skill level", S_CHOICE|S_LEVWARN, m_null, G_X, {"Default skill level", S_CHOICE|S_LEVWARN, m_null, G_X,
G_Y3 + general_skill*8, {"default_skill"}, 0, NULL, default_skill_strings}, G_Y4 + general_skill*8, {"default_skill"}, 0, NULL, default_skill_strings},
{"Default compatibility", S_CHOICE|S_LEVWARN, m_null, G_X, {"Default compatibility", S_CHOICE|S_LEVWARN, m_null, G_X,
G_Y3 + general_comp*8, {"default_complevel"}, 0, NULL, default_compatibility_strings}, G_Y4 + general_comp*8, {"default_complevel"}, 0, NULL, default_compatibility_strings},
{"Show ENDOOM screen", S_CHOICE, m_null, G_X, {"Show ENDOOM screen", S_CHOICE, m_null, G_X,
G_Y3 + general_endoom*8, {"show_endoom"}, 0, NULL, default_endoom_strings}, G_Y4 + 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}}, {"<- PREV",S_SKIP|S_PREV, m_null, KB_PREV, KB_Y+20*8, {gen_settings1}},

View File

@ -181,6 +181,13 @@ default_t defaults[] = {
"1 to stretch short skies" "1 to stretch short skies"
}, },
{
"linearsky",
(config_t *) &linearsky, NULL,
{0}, {0,1}, number, ss_gen, wad_no,
"1 for linear horizontal sky scrolling "
},
{ // killough 2/21/98 { // killough 2/21/98
"pitched_sounds", "pitched_sounds",
(config_t *) &pitched_sounds, NULL, (config_t *) &pitched_sounds, NULL,

View File

@ -78,6 +78,9 @@ int viewangletox[FINEANGLES/2];
angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98 angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
// [FG] linear horizontal sky scrolling
angle_t linearskyangle[MAX_SCREENWIDTH+1];
// killough 3/20/98: Support dynamic colormaps, e.g. deep water // killough 3/20/98: Support dynamic colormaps, e.g. deep water
// killough 4/4/98: support dynamic number of them as well // killough 4/4/98: support dynamic number of them as well
@ -294,6 +297,8 @@ static void R_InitTextureMapping (void)
for (i=0; viewangletox[i] > x; i++) for (i=0; viewangletox[i] > x; i++)
; ;
xtoviewangle[x] = (i<<ANGLETOFINESHIFT)-ANG90; xtoviewangle[x] = (i<<ANGLETOFINESHIFT)-ANG90;
// [FG] linear horizontal sky scrolling
linearskyangle[x] = ((viewwidth/2-x)*((SCREENWIDTH<<6)/viewwidth))*(ANG90/(NONWIDEWIDTH<<6));
} }
// Take out the fencepost cases from viewangletox. // Take out the fencepost cases from viewangletox.

View File

@ -96,12 +96,17 @@ static fixed_t xoffs,yoffs; // killough 2/28/98: flat offsets
fixed_t *yslope, yslopes[LOOKDIRS][MAX_SCREENHEIGHT], distscale[MAX_SCREENWIDTH]; fixed_t *yslope, yslopes[LOOKDIRS][MAX_SCREENHEIGHT], distscale[MAX_SCREENWIDTH];
// [FG] linear horizontal sky scrolling
boolean linearsky;
static angle_t *xtoskyangle;
// //
// R_InitPlanes // R_InitPlanes
// Only at game startup. // Only at game startup.
// //
void R_InitPlanes (void) void R_InitPlanes (void)
{ {
xtoskyangle = linearsky ? linearskyangle : xtoviewangle;
} }
// //
@ -409,7 +414,7 @@ static void do_draw_plane(visplane_t *pl)
for (x = pl->minx; (dc_x = x) <= pl->maxx; x++) 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 if ((unsigned)(dc_yl = pl->top[x]) <= (dc_yh = pl->bottom[x])) // [FG] 32-bit integer math
{ {
dc_source = R_GetColumn(texture, ((an + xtoviewangle[x])^flip) >> dc_source = R_GetColumn(texture, ((an + xtoskyangle[x])^flip) >>
ANGLETOSKYSHIFT); ANGLETOSKYSHIFT);
colfunc(); colfunc();
} }

View File

@ -41,6 +41,9 @@
#define SKYSTRETCH_HEIGHT 228 #define SKYSTRETCH_HEIGHT 228
extern boolean stretchsky; extern boolean stretchsky;
// [FG] linear horizontal sky scrolling
extern boolean linearsky;
extern int skytexture; extern int skytexture;
extern int skytexturemid; extern int skytexturemid;

View File

@ -107,6 +107,9 @@ extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
extern fixed_t rw_distance; extern fixed_t rw_distance;
extern angle_t rw_normalangle; extern angle_t rw_normalangle;
// [FG] linear horizontal sky scrolling
extern angle_t linearskyangle[MAX_SCREENWIDTH+1];
// angle to line origin // angle to line origin
extern int rw_angle1; extern int rw_angle1;