mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 03:12:00 -04:00
implement SKYDEFS flatmapping feature (#2221)
* implement SKYDEFS flatmapping feature (floor and ceiling at once) * separate floor and ceiling sky * fix comment * call R_GetSkyColor() on each flatmapped sky texture * comment on PL_FLATMAPPING composition
This commit is contained in:
parent
b89a6ae954
commit
c25757267e
@ -950,8 +950,6 @@ 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
|
||||
|
||||
playback_levelstarttic = playback_tic;
|
||||
@ -993,6 +991,8 @@ static void G_DoLoadLevel(void)
|
||||
MN_UpdateFreeLook(!mouselook && !padlook);
|
||||
HU_UpdateTurnFormat();
|
||||
|
||||
R_InitSkyMap(); // SKYDEFS flatmapping
|
||||
|
||||
// [Woof!] Do not reset chosen player view across levels in multiplayer
|
||||
// demo playback. However, it must be reset when starting a new game.
|
||||
if (usergame)
|
||||
|
@ -345,7 +345,7 @@ void P_LoadSectors (int lump)
|
||||
ss->bottommap = ss->midmap = ss->topmap = 0;
|
||||
|
||||
// killough 10/98: sky textures coming from sidedefs:
|
||||
ss->sky = 0;
|
||||
ss->floorsky = ss->ceilingsky = 0;
|
||||
|
||||
// [AM] Sector interpolation. Even if we're
|
||||
// not running uncapped, the renderer still
|
||||
|
@ -2630,7 +2630,7 @@ void P_SpawnSpecials (void)
|
||||
// Pre-calculate sky color
|
||||
R_GetSkyColor(texturetranslation[sides[*lines[i].sidenum].toptexture]);
|
||||
for (s = -1; (s = P_FindSectorFromLineTag(lines+i,s)) >= 0;)
|
||||
sectors[s].sky = i | PL_SKYFLAT;
|
||||
sectors[s].floorsky = sectors[s].ceilingsky = i | PL_SKYFLAT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ static void R_Subsector(int num)
|
||||
sectors[frontsector->heightsec].ceilingpic == skyflatnum) ?
|
||||
R_FindPlane(frontsector->interpfloorheight,
|
||||
frontsector->floorpic == skyflatnum && // kilough 10/98
|
||||
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
|
||||
frontsector->floorsky & PL_SKYFLAT ? frontsector->floorsky :
|
||||
frontsector->floorpic,
|
||||
floorlightlevel, // killough 3/16/98
|
||||
frontsector->floor_xoffs, // killough 3/7/98
|
||||
@ -629,7 +629,7 @@ static void R_Subsector(int num)
|
||||
sectors[frontsector->heightsec].floorpic == skyflatnum) ?
|
||||
R_FindPlane(frontsector->interpceilingheight, // killough 3/8/98
|
||||
frontsector->ceilingpic == skyflatnum && // kilough 10/98
|
||||
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
|
||||
frontsector->ceilingsky & PL_SKYFLAT ? frontsector->ceilingsky :
|
||||
frontsector->ceilingpic,
|
||||
ceilinglightlevel, // killough 4/11/98
|
||||
frontsector->ceiling_xoffs, // killough 3/7/98
|
||||
|
@ -125,7 +125,7 @@ typedef struct sector_s
|
||||
// or ceilingpic, because the rest of Doom needs to know which is sky
|
||||
// and which isn't, etc.
|
||||
|
||||
int sky;
|
||||
int floorsky, ceilingsky;
|
||||
|
||||
// list of mobjs that are at least partially in the sector
|
||||
// thinglist is a subset of touching_thinglist
|
||||
|
@ -488,7 +488,13 @@ static void do_draw_mbf_sky(visplane_t *pl)
|
||||
|
||||
an = viewangle;
|
||||
|
||||
if (pl->picnum & PL_SKYFLAT)
|
||||
if ((pl->picnum & PL_FLATMAPPING) == PL_FLATMAPPING)
|
||||
{
|
||||
dc_texturemid = skytexturemid;
|
||||
texture = pl->picnum & ~PL_FLATMAPPING;
|
||||
flip = 0;
|
||||
}
|
||||
else if (pl->picnum & PL_SKYFLAT)
|
||||
{
|
||||
// Sky Linedef
|
||||
const line_t *l = &lines[pl->picnum & ~PL_SKYFLAT];
|
||||
@ -601,10 +607,19 @@ static void do_draw_plane(visplane_t *pl)
|
||||
|
||||
// sky flat
|
||||
|
||||
if (pl->picnum == skyflatnum && sky)
|
||||
if (sky)
|
||||
{
|
||||
DrawSkyDef(pl);
|
||||
return;
|
||||
if ((pl->picnum & PL_FLATMAPPING) == PL_FLATMAPPING)
|
||||
{
|
||||
do_draw_mbf_sky(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl->picnum == skyflatnum)
|
||||
{
|
||||
DrawSkyDef(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT)
|
||||
|
23
src/r_sky.c
23
src/r_sky.c
@ -137,6 +137,29 @@ static void InitSky(void)
|
||||
return;
|
||||
}
|
||||
|
||||
flatmap_t *flatmap = NULL;
|
||||
array_foreach(flatmap, skydefs->flatmapping)
|
||||
{
|
||||
int flatnum = R_FlatNumForName(flatmap->flat);
|
||||
int skytex = R_TextureNumForName(flatmap->sky);
|
||||
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
if (sectors[i].floorpic == flatnum)
|
||||
{
|
||||
sectors[i].floorpic = skyflatnum;
|
||||
sectors[i].floorsky = skytex | PL_FLATMAPPING;
|
||||
R_GetSkyColor(skytex);
|
||||
}
|
||||
if (sectors[i].ceilingpic == flatnum)
|
||||
{
|
||||
sectors[i].ceilingpic = skyflatnum;
|
||||
sectors[i].ceilingsky = skytex | PL_FLATMAPPING;
|
||||
R_GetSkyColor(skytex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_foreach(sky, skydefs->skies)
|
||||
{
|
||||
if (skytexture == R_CheckTextureNumForName(sky->skytex.name))
|
||||
|
@ -39,6 +39,8 @@ extern boolean linearsky;
|
||||
extern int skytexture;
|
||||
extern int skytexturemid;
|
||||
|
||||
#define PL_FLATMAPPING (0xC0000000) // (PL_SKYFLAT | 0x40000000)
|
||||
|
||||
extern sky_t *sky;
|
||||
|
||||
// Called whenever the view size changes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user