- fixed: Sector_SetLink did incorrect checks for the returned control sector

- added Sector_SetTranslucent special so set translucency of portal planes at run time.
- added 'additive' information for portal planes. This is no-op at the moment because the flat drawers can't handle additive translucency yet though.


SVN r3149 (trunk)
This commit is contained in:
Christoph Oelckers 2011-02-12 09:53:40 +00:00
parent 16878f6bb4
commit 1806e47e43
9 changed files with 84 additions and 23 deletions

View File

@ -162,6 +162,10 @@ Note: All <bool> fields default to false unless mentioned otherwise.
// relative to the owning sector's light level.
alphafloor = <float>; // translucency of floor plane (only has meaning with Sector_SetPortal) Default is 1.0.
alphaceiling = <float>; // translucency of ceiling plane (only has meaning with Sector_SetPortal) Default is 1.0.
renderstylefloor = <string>; // floor plane renderstyle (only has meaning with Sector_SetPortal); not implemented yet in software renderer
// can be "translucent" or "add", default is "translucent".
renderstyleceiling = <string>; // ceiling plane renderstyle (only has meaning with Sector_SetPortal); not implemented yet in software renderer
// can be "translucent" or "add", default is "translucent".
gravity = <float>; // Sector's gravity. Default is 1.0.
lightcolor = <integer>; // Sector's light color as RRGGBB value, default = 0xffffff.
fadecolor = <integer>; // Sector's fog color as RRGGBB value, default = 0x000000.
@ -176,7 +180,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
* Note about dropactors
The spec requires this to be false by default. Currently, however ZDoom assumes this to be true
The spec requires this to be false by default. Currently, however, ZDoom assumes this to be true
for Doom format maps so any map converter converting to the ZDoomTranslated namespace should
set this flag for each tagged sector.
@ -208,6 +212,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
181: Plane_Align, arg2
215: Teleport_Line, arg0
222: Scroll_Texture_Model, arg0 (arg0 must be preserved)
160: Sector_3DFloor, arg4 (both uses as high-byte of tag and line ID are not supported in UDMF and must be remapped)
Some specials also allow setting the extended flags. These must also be
converted to explicitly setting the flags through the defined map fields.
@ -290,9 +295,14 @@ Added 'countsecret' actor property.
Added vertex floor and ceiling height properties
1.16 23.01.2011
Added alphaceiling and alphafloor sector properties
Added blocksight linedef flag
Removed remarks of 8 being the maximum number of player classes/skill levels the menu can handle so the spec now properly lists 16 as limit.
1.17 12.02.2011
Added renderstyleceiling and renderstylefloor sector properties
Added Sector_Set3DFloor to list of specials that need to be handled for line ID remapping
===============================================================================
EOF
===============================================================================

View File

@ -96,6 +96,7 @@ DEFINE_SPECIAL(Pillar_BuildAndCrush, 94, 4, 5, 5)
DEFINE_SPECIAL(FloorAndCeiling_LowerByValue, 95, 3, 3, 3)
DEFINE_SPECIAL(FloorAndCeiling_RaiseByValue, 96, 3, 3, 3)
DEFINE_SPECIAL(Ceiling_LowerAndCrushDist, 97, 3, 5, 5)
DEFINE_SPECIAL(Sector_SetTranslucent, 98, 3, 4, 4)
DEFINE_SPECIAL(Scroll_Texture_Left, 100, -1, -1, 2)
DEFINE_SPECIAL(Scroll_Texture_Right, 101, -1, -1, 2)

View File

@ -423,6 +423,8 @@ xx(Dropactors)
xx(NoRespawn)
xx(Alphafloor)
xx(Alphaceiling)
xx(Renderstylefloor)
xx(Renderstyleceiling)
xx(offsetx_top)
xx(offsety_top)

View File

@ -1943,13 +1943,30 @@ FUNC(LS_Sector_SetFriction)
return true;
}
FUNC(LS_Sector_SetTranslucent)
// Sector_SetTranslucent (tag, plane, amount, type)
{
if (arg0 != 0)
{
int secnum = -1;
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
{
sectors[secnum].SetAlpha(arg1, Scale(arg2, OPAQUE, 255));
sectors[secnum].ChangeFlags(arg1, ~PLANEF_ADDITIVE, arg3? PLANEF_ADDITIVE:0);
}
return true;
}
return false;
}
FUNC(LS_Sector_SetLink)
// Sector_SetLink (controltag, linktag, floor/ceiling, movetype)
{
if (arg0 != 0) // control tag == 0 is for static initialization and must not be handled here
{
int control = P_FindSectorFromTag(arg0, -1);
if (control != 0)
if (control >= 0)
{
return P_AddSectorLinks(&sectors[control], arg1, arg2, arg3);
}
@ -3166,7 +3183,7 @@ lnSpecFunc LineSpecials[256] =
/* 95 */ LS_FloorAndCeiling_LowerByValue,
/* 96 */ LS_FloorAndCeiling_RaiseByValue,
/* 97 */ LS_Ceiling_LowerAndCrushDist,
/* 98 */ LS_NOP,
/* 98 */ LS_Sector_SetTranslucent,
/* 99 */ LS_NOP,
/* 100 */ LS_NOP, // Scroll_Texture_Left
/* 101 */ LS_NOP, // Scroll_Texture_Right

View File

@ -1200,6 +1200,24 @@ public:
sec->SetAlpha(sector_t::ceiling, CheckFixed(key));
continue;
case NAME_Renderstylefloor:
{
const char *str = CheckString(key);
if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::floor, PLANEF_ADDITIVE, 0);
else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ADDITIVE);
else sc.ScriptMessage("Unknown value \"%s\" for 'renderstylefloor'\n", str);
continue;
}
case NAME_Renderstyleceiling:
{
const char *str = CheckString(key);
if (!stricmp(str, "translucent")) sec->ChangeFlags(sector_t::ceiling, PLANEF_ADDITIVE, 0);
else if (!stricmp(str, "add")) sec->ChangeFlags(sector_t::ceiling, 0, PLANEF_ADDITIVE);
else sc.ScriptMessage("Unknown value \"%s\" for 'renderstyleceiling'\n", str);
continue;
}
case NAME_Lightfloorabsolute:
if (CheckBool(key)) sec->ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
else sec->ChangeFlags(sector_t::floor, PLANEF_ABSLIGHTING, 0);

View File

@ -1193,6 +1193,7 @@ void R_Subsector (subsector_t *sub)
frontsector->GetTexture(sector_t::ceiling),
ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->GetAlpha(sector_t::ceiling),
!!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetXScale(sector_t::ceiling),
@ -1226,6 +1227,7 @@ void R_Subsector (subsector_t *sub)
frontsector->GetTexture(sector_t::floor),
floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->GetAlpha(sector_t::floor),
!!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::floor), // killough 3/7/98
frontsector->GetYOffset(sector_t::floor), // killough 3/7/98
frontsector->GetXScale(sector_t::floor),
@ -1285,6 +1287,7 @@ void R_Subsector (subsector_t *sub)
frontsector->GetTexture(sector_t::floor),
floorlightlevel + r_actualextralight, // killough 3/16/98
frontsector->GetAlpha(sector_t::floor),
!!(frontsector->GetFlags(sector_t::floor) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::floor), // killough 3/7/98
frontsector->GetYOffset(sector_t::floor), // killough 3/7/98
frontsector->GetXScale(sector_t::floor),
@ -1349,6 +1352,7 @@ void R_Subsector (subsector_t *sub)
frontsector->GetTexture(sector_t::ceiling),
ceilinglightlevel + r_actualextralight, // killough 4/11/98
frontsector->GetAlpha(sector_t::ceiling),
!!(frontsector->GetFlags(sector_t::ceiling) & PLANEF_ADDITIVE),
frontsector->GetXOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetYOffset(sector_t::ceiling), // killough 3/7/98
frontsector->GetXScale(sector_t::ceiling),

View File

@ -322,7 +322,8 @@ inline FArchive &operator<< (FArchive &arc, secplane_t &plane)
enum
{
PLANEF_ABSLIGHTING = 1, // floor/ceiling light is absolute, not relative
PLANEF_BLOCKED = 2 // can not be moved anymore.
PLANEF_BLOCKED = 2, // can not be moved anymore.
PLANEF_ADDITIVE = 4, // rendered additive
};
// Internal sector flags

View File

@ -152,7 +152,7 @@ extern "C" void R_SetSpanColormap_ASM (BYTE *colormap);
extern "C" void R_SetTiltedSpanSource_ASM (const BYTE *flat);
extern "C" BYTE *ds_curcolormap, *ds_cursource, *ds_curtiltedsource;
#endif
void R_DrawSinglePlane (visplane_t *, fixed_t alpha, bool masked);
void R_DrawSinglePlane (visplane_t *, fixed_t alpha, bool additive, bool masked);
//==========================================================================
//
@ -527,7 +527,7 @@ static visplane_t *new_visplane (unsigned hash)
// killough 2/28/98: Add offsets
//==========================================================================
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, fixed_t alpha,
visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightlevel, fixed_t alpha, bool additive,
fixed_t xoffs, fixed_t yoffs,
fixed_t xscale, fixed_t yscale, angle_t angle,
int sky, ASkyViewpoint *skybox)
@ -546,6 +546,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
yscale = 0;
angle = 0;
alpha = 0;
additive = false;
plane.a = plane.b = plane.d = 0;
// [RH] Map floor skies and ceiling skies to separate visplanes. This isn't
// always necessary, but it is needed if a floor and ceiling sky are in the
@ -572,6 +573,7 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
else sky = 0; // not skyflatnum so it can't be a sky
skybox = NULL;
alpha = FRACUNIT;
additive = false;
}
// New visplane algorithm uses hash table -- killough
@ -595,7 +597,8 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
// headache inducing logic... :(
(!(skybox->flags & MF_JUSTATTACKED)) ||
(
check->alpha == alpha &&
check->Alpha == alpha &&
check->Additive == additive &&
(alpha == 0 || // if alpha is > 0 everything needs to be checked
(plane == check->height &&
picnum == check->picnum &&
@ -663,7 +666,8 @@ visplane_t *R_FindPlane (const secplane_t &height, FTextureID picnum, int lightl
check->viewy = stacked_viewy;
check->viewz = stacked_viewz;
check->viewangle = stacked_angle;
check->alpha = alpha;
check->Alpha = alpha;
check->Additive = additive;
check->CurrentMirror = CurrentMirror;
check->MirrorFlags = MirrorFlags;
check->CurrentSkybox = CurrentSkybox;
@ -751,7 +755,8 @@ visplane_t *R_CheckPlane (visplane_t *pl, int start, int stop)
new_pl->viewz = pl->viewz;
new_pl->viewangle = pl->viewangle;
new_pl->sky = pl->sky;
new_pl->alpha = pl->alpha;
new_pl->Alpha = pl->Alpha;
new_pl->Additive = pl->Additive;
new_pl->CurrentMirror = pl->CurrentMirror;
new_pl->MirrorFlags = pl->MirrorFlags;
new_pl->CurrentSkybox = pl->CurrentSkybox;
@ -993,7 +998,7 @@ void R_DrawPlanes ()
// kg3D - draw only real planes now
if(pl->sky >= 0) {
vpcount++;
R_DrawSinglePlane (pl, OPAQUE, false);
R_DrawSinglePlane (pl, OPAQUE, false, false);
}
}
}
@ -1019,7 +1024,7 @@ void R_DrawHeightPlanes(fixed_t height)
viewy = pl->viewy;
viewangle = pl->viewangle;
MirrorFlags = pl->MirrorFlags;
R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, true);
R_DrawSinglePlane (pl, pl->sky & 0x7FFFFFFF, false, true);
}
}
}
@ -1034,7 +1039,7 @@ void R_DrawHeightPlanes(fixed_t height)
//
//==========================================================================
void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
{
// pl->angle = pa<<ANGLETOFINESHIFT;
@ -1059,7 +1064,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
return;
}
if (!masked)
if (!masked && !additive)
{ // If we're not supposed to see through this plane, draw it opaque.
alpha = OPAQUE;
}
@ -1077,11 +1082,11 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
if (r_drawflat || ((pl->height.a == 0 && pl->height.b == 0) && !tilt))
{
R_DrawNormalPlane (pl, alpha, masked);
R_DrawNormalPlane (pl, alpha, additive, masked);
}
else
{
R_DrawTiltedPlane (pl, alpha, masked);
R_DrawTiltedPlane (pl, alpha, additive, masked);
}
}
NetUpdate ();
@ -1151,7 +1156,7 @@ void R_DrawSkyBoxes ()
if (pl->maxx < pl->minx || !r_skyboxes || numskyboxes == MAX_SKYBOX_PLANES)
{
R_DrawSinglePlane (pl, OPAQUE, false);
R_DrawSinglePlane (pl, OPAQUE, false, false);
*freehead = pl;
freehead = &pl->next;
continue;
@ -1270,9 +1275,9 @@ void R_DrawSkyBoxes ()
vissprite_p = firstvissprite;
visplaneStack.Pop (pl);
if (pl->alpha > 0)
if (pl->Alpha > 0)
{
R_DrawSinglePlane (pl, pl->alpha, true);
R_DrawSinglePlane (pl, pl->Alpha, pl->Additive, true);
}
*freehead = pl;
freehead = &pl->next;
@ -1438,7 +1443,7 @@ void R_DrawSkyPlane (visplane_t *pl)
//
//==========================================================================
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked)
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
{
#ifdef X86_ASM
if (ds_source != ds_cursource)
@ -1500,6 +1505,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked)
else
plane_shade = true;
// Additive not supported yet because the drawer function doesn't look like it can handle it.
if (spanfunc != R_FillSpan)
{
if (masked)
@ -1538,7 +1544,7 @@ void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked)
//
//==========================================================================
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked)
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked)
{
static const float ifloatpow2[16] =
{

View File

@ -54,7 +54,8 @@ struct visplane_s
float visibility;
fixed_t viewx, viewy, viewz;
angle_t viewangle;
fixed_t alpha;
fixed_t Alpha;
bool Additive;
// kg3D - keep track of mirror and skybox owner
int CurrentSkybox;
@ -90,8 +91,8 @@ void R_ClearPlanes (bool fullclear);
void R_DrawPlanes ();
void R_DrawSkyBoxes ();
void R_DrawSkyPlane (visplane_t *pl);
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked);
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked);
void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked);
void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked);
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
visplane_t *R_FindPlane
@ -99,6 +100,7 @@ visplane_t *R_FindPlane
FTextureID picnum,
int lightlevel,
fixed_t alpha,
bool additive,
fixed_t xoffs, // killough 2/28/98: add x-y offsets
fixed_t yoffs,
fixed_t xscale,