mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -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;
|
break;
|
||||||
}//jff 3/27/98 end sky setting fix
|
}//jff 3/27/98 end sky setting fix
|
||||||
|
|
||||||
R_InitSkyMap(); // [FG] stretch short skies
|
|
||||||
|
|
||||||
levelstarttic = gametic; // for time calculation
|
levelstarttic = gametic; // for time calculation
|
||||||
|
|
||||||
playback_levelstarttic = playback_tic;
|
playback_levelstarttic = playback_tic;
|
||||||
@ -993,6 +991,8 @@ static void G_DoLoadLevel(void)
|
|||||||
MN_UpdateFreeLook(!mouselook && !padlook);
|
MN_UpdateFreeLook(!mouselook && !padlook);
|
||||||
HU_UpdateTurnFormat();
|
HU_UpdateTurnFormat();
|
||||||
|
|
||||||
|
R_InitSkyMap(); // SKYDEFS flatmapping
|
||||||
|
|
||||||
// [Woof!] Do not reset chosen player view across levels in multiplayer
|
// [Woof!] Do not reset chosen player view across levels in multiplayer
|
||||||
// demo playback. However, it must be reset when starting a new game.
|
// demo playback. However, it must be reset when starting a new game.
|
||||||
if (usergame)
|
if (usergame)
|
||||||
|
@ -345,7 +345,7 @@ void P_LoadSectors (int lump)
|
|||||||
ss->bottommap = ss->midmap = ss->topmap = 0;
|
ss->bottommap = ss->midmap = ss->topmap = 0;
|
||||||
|
|
||||||
// killough 10/98: sky textures coming from sidedefs:
|
// killough 10/98: sky textures coming from sidedefs:
|
||||||
ss->sky = 0;
|
ss->floorsky = ss->ceilingsky = 0;
|
||||||
|
|
||||||
// [AM] Sector interpolation. Even if we're
|
// [AM] Sector interpolation. Even if we're
|
||||||
// not running uncapped, the renderer still
|
// not running uncapped, the renderer still
|
||||||
|
@ -2630,7 +2630,7 @@ void P_SpawnSpecials (void)
|
|||||||
// Pre-calculate sky color
|
// Pre-calculate sky color
|
||||||
R_GetSkyColor(texturetranslation[sides[*lines[i].sidenum].toptexture]);
|
R_GetSkyColor(texturetranslation[sides[*lines[i].sidenum].toptexture]);
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(lines+i,s)) >= 0;)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ static void R_Subsector(int num)
|
|||||||
sectors[frontsector->heightsec].ceilingpic == skyflatnum) ?
|
sectors[frontsector->heightsec].ceilingpic == skyflatnum) ?
|
||||||
R_FindPlane(frontsector->interpfloorheight,
|
R_FindPlane(frontsector->interpfloorheight,
|
||||||
frontsector->floorpic == skyflatnum && // kilough 10/98
|
frontsector->floorpic == skyflatnum && // kilough 10/98
|
||||||
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
|
frontsector->floorsky & PL_SKYFLAT ? frontsector->floorsky :
|
||||||
frontsector->floorpic,
|
frontsector->floorpic,
|
||||||
floorlightlevel, // killough 3/16/98
|
floorlightlevel, // killough 3/16/98
|
||||||
frontsector->floor_xoffs, // killough 3/7/98
|
frontsector->floor_xoffs, // killough 3/7/98
|
||||||
@ -629,7 +629,7 @@ static void R_Subsector(int num)
|
|||||||
sectors[frontsector->heightsec].floorpic == skyflatnum) ?
|
sectors[frontsector->heightsec].floorpic == skyflatnum) ?
|
||||||
R_FindPlane(frontsector->interpceilingheight, // killough 3/8/98
|
R_FindPlane(frontsector->interpceilingheight, // killough 3/8/98
|
||||||
frontsector->ceilingpic == skyflatnum && // kilough 10/98
|
frontsector->ceilingpic == skyflatnum && // kilough 10/98
|
||||||
frontsector->sky & PL_SKYFLAT ? frontsector->sky :
|
frontsector->ceilingsky & PL_SKYFLAT ? frontsector->ceilingsky :
|
||||||
frontsector->ceilingpic,
|
frontsector->ceilingpic,
|
||||||
ceilinglightlevel, // killough 4/11/98
|
ceilinglightlevel, // killough 4/11/98
|
||||||
frontsector->ceiling_xoffs, // killough 3/7/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
|
// or ceilingpic, because the rest of Doom needs to know which is sky
|
||||||
// and which isn't, etc.
|
// and which isn't, etc.
|
||||||
|
|
||||||
int sky;
|
int floorsky, ceilingsky;
|
||||||
|
|
||||||
// list of mobjs that are at least partially in the sector
|
// list of mobjs that are at least partially in the sector
|
||||||
// thinglist is a subset of touching_thinglist
|
// thinglist is a subset of touching_thinglist
|
||||||
|
@ -488,7 +488,13 @@ static void do_draw_mbf_sky(visplane_t *pl)
|
|||||||
|
|
||||||
an = viewangle;
|
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
|
// Sky Linedef
|
||||||
const line_t *l = &lines[pl->picnum & ~PL_SKYFLAT];
|
const line_t *l = &lines[pl->picnum & ~PL_SKYFLAT];
|
||||||
@ -601,10 +607,19 @@ static void do_draw_plane(visplane_t *pl)
|
|||||||
|
|
||||||
// sky flat
|
// sky flat
|
||||||
|
|
||||||
if (pl->picnum == skyflatnum && sky)
|
if (sky)
|
||||||
{
|
{
|
||||||
DrawSkyDef(pl);
|
if ((pl->picnum & PL_FLATMAPPING) == PL_FLATMAPPING)
|
||||||
return;
|
{
|
||||||
|
do_draw_mbf_sky(pl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pl->picnum == skyflatnum)
|
||||||
|
{
|
||||||
|
DrawSkyDef(pl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT)
|
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;
|
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)
|
array_foreach(sky, skydefs->skies)
|
||||||
{
|
{
|
||||||
if (skytexture == R_CheckTextureNumForName(sky->skytex.name))
|
if (skytexture == R_CheckTextureNumForName(sky->skytex.name))
|
||||||
|
@ -39,6 +39,8 @@ extern boolean linearsky;
|
|||||||
extern int skytexture;
|
extern int skytexture;
|
||||||
extern int skytexturemid;
|
extern int skytexturemid;
|
||||||
|
|
||||||
|
#define PL_FLATMAPPING (0xC0000000) // (PL_SKYFLAT | 0x40000000)
|
||||||
|
|
||||||
extern sky_t *sky;
|
extern sky_t *sky;
|
||||||
|
|
||||||
// Called whenever the view size changes.
|
// Called whenever the view size changes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user