This commit is contained in:
nashmuhandes 2016-07-25 13:26:43 +08:00
commit f13fe55562
12 changed files with 67 additions and 30 deletions

View file

@ -2507,7 +2507,7 @@ static bool DoDehPatch()
cont = 0;
if (0 == strncmp (PatchFile, "Patch File for DeHackEd v", 25))
{
if (PatchFile[25] < '3')
if (PatchFile[25] < '3' && PatchFile[25] != '2' && PatchFile[27] != '3')
{
Printf (PRINT_BOLD, "\"%s\" is an old and unsupported DeHackEd patch\n", PatchName);
delete[] PatchName;
@ -2544,7 +2544,7 @@ static bool DoDehPatch()
{}
}
if (pversion != 6)
if (pversion != 5 && pversion != 6)
{
Printf ("DeHackEd patch version is %d.\nUnexpected results may occur.\n", pversion);
}

View file

@ -79,6 +79,7 @@ static void UnclipSubsector(subsector_t *sub)
if (startAngle-endAngle >= ANGLE_180)
{
clipper.SafeRemoveClipRange(startAngle, endAngle);
clipper.SetBlocked(false);
}
seg++;
}
@ -444,6 +445,7 @@ static void DoSubsector(subsector_t * sub)
// range this subsector spans before going on.
UnclipSubsector(sub);
}
if (clipper.IsBlocked()) return; // if we are inside a stacked sector portal which hasn't unclipped anything yet.
fakesector=gl_FakeFlat(sector, &fake, false);

View file

@ -92,6 +92,7 @@ void Clipper::Clear()
ClipNode *node = cliphead;
ClipNode *temp;
blocked = false;
while (node != NULL)
{
temp = node;

View file

@ -54,6 +54,7 @@ class Clipper
ClipNode * clipnodes;
ClipNode * cliphead;
ClipNode * silhouette; // will be preserved even when RemoveClipRange is called
bool blocked;
static angle_t AngleToPseudo(angle_t ang);
bool IsRangeVisible(angle_t startangle, angle_t endangle);
@ -68,6 +69,7 @@ public:
Clipper()
{
blocked = false;
clipnodes=cliphead=NULL;
}
@ -129,6 +131,16 @@ public:
SafeRemoveClipRange(AngleToPseudo(startangle), AngleToPseudo(endangle));
}
void SetBlocked(bool on)
{
blocked = on;
}
bool IsBlocked() const
{
return blocked;
}
bool CheckBox(const float *bspcoord);
};

View file

@ -756,6 +756,16 @@ void GLSectorStackPortal::DrawContents()
SaveMapSection();
SetupCoverage();
ClearClipper();
// If the viewpoint is not within the portal, we need to invalidate the entire clip area.
// The portal will re-validate the necessary parts when its subsectors get traversed.
subsector_t *sub = R_PointInSubsector(ViewPos);
if (!(gl_drawinfo->ss_renderflags[sub - ::subsectors] & SSRF_SEEN))
{
clipper.SafeAddClipRange(0, ANGLE_MAX);
clipper.SetBlocked(true);
}
GLRenderer->DrawScene(DM_PORTAL);
RestoreMapSection();

View file

@ -71,7 +71,7 @@ CCMD(gl_flush)
CUSTOM_CVAR(Int, gl_texture_filter, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
{
if (self < 0 || self > 5) self=4;
if (self < 0 || self > 6) self=4;
if (GLRenderer != NULL && GLRenderer->mSamplerManager != NULL) GLRenderer->mSamplerManager->SetTextureFilterMode();
}
@ -105,6 +105,7 @@ TexFilter_s TexFilter[]={
{GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR, true},
{GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST, true},
{GL_LINEAR_MIPMAP_LINEAR, GL_NEAREST, true},
};
int TexFormat[]={

View file

@ -373,6 +373,7 @@ enum // P_RailAttack / A_RailAttack / A_CustomRailgun / P_DrawRailTrail flags
RAF_EXPLICITANGLE = 4,
RAF_FULLBRIGHT = 8,
RAF_CENTERZ = 16,
RAF_NORANDOMPUFFZ = 32,
};

View file

@ -4726,6 +4726,12 @@ void P_RailAttack(FRailParams *p)
}
}
int puffflags = 0;
if (p->flags & RAF_NORANDOMPUFFZ)
{
puffflags |= PF_NORANDOMZ;
}
DVector2 xy = source->Vec2Angle(p->offset_xy, angle - 90.);
RailData rail_data;
@ -4778,7 +4784,7 @@ void P_RailAttack(FRailParams *p)
bool spawnpuff;
bool bleed = false;
int puffflags = PF_HITTHING;
int actorpuffflags = puffflags | PF_HITTHING;
AActor *hitactor = rail_data.RailHits[i].HitActor;
DVector3 &hitpos = rail_data.RailHits[i].HitPos;
DAngle hitangle = rail_data.RailHits[i].HitAngle;
@ -4791,7 +4797,7 @@ void P_RailAttack(FRailParams *p)
else
{
spawnpuff = (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF);
puffflags |= PF_HITTHINGBLEED; // [XA] Allow for puffs to jump to XDeath state.
actorpuffflags |= PF_HITTHINGBLEED; // [XA] Allow for puffs to jump to XDeath state.
if (!(puffDefaults->flags3 & MF3_BLOODLESSIMPACT))
{
bleed = true;
@ -4799,7 +4805,7 @@ void P_RailAttack(FRailParams *p)
}
if (spawnpuff)
{
P_SpawnPuff(source, puffclass, hitpos, hitangle, hitangle - 90, 1, puffflags, hitactor);
P_SpawnPuff(source, puffclass, hitpos, hitangle, hitangle - 90, 1, actorpuffflags, hitactor);
}
int dmgFlagPass = DMG_INFLICTOR_IS_PUFF;
@ -4828,7 +4834,7 @@ void P_RailAttack(FRailParams *p)
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, 0);
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, puffflags);
if (puff && (trace.Line != NULL) && (trace.Line->special == Line_Horizon) && !(puff->flags3 & MF3_SKYEXPLODE))
puff->Destroy();
}
@ -4843,7 +4849,7 @@ void P_RailAttack(FRailParams *p)
AActor* puff = NULL;
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, 0);
puff = P_SpawnPuff(source, puffclass, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget - 90, 1, puffflags);
if (puff && !(puff->flags3 & MF3_SKYEXPLODE) &&
(((trace.HitType == TRACE_HitFloor) && (puff->floorpic == skyflatnum)) ||
((trace.HitType == TRACE_HitCeiling) && (puff->ceilingpic == skyflatnum))))

View file

@ -171,6 +171,7 @@ const int RGF_NOPIERCING = 2;
const int RGF_EXPLICITANGLE = 4;
const int RGF_FULLBRIGHT = 8;
const int RGF_CENTERZ = 16;
const int RGF_NORANDOMPUFFZ = 32;
// Flags for A_Mushroom
const int MSF_Standard = 0;

View file

@ -2625,6 +2625,7 @@ OPTVAL_INFRAREDANDTORCH = "Infrared and torch";
OPTVAL_ANYFIXEDCOLORMAP = "Any fixed colormap";
OPTVAL_NONENEARESTMIPMAP = "None (nearest mipmap)";
OPTVAL_NONELINEARMIPMAP = "None (linear mipmap)";
OPTVAL_NONETRILINEAR = "None (trilinear)";
OPTVAL_BILINEAR = "Bilinear";
OPTVAL_TRILINEAR = "Trilinear";
OPTVAL_RGBA8 = "RGBA8";

View file

@ -19,6 +19,7 @@ OptionValue "FilterModes"
0, "$OPTVAL_NONE"
1, "$OPTVAL_NONENEARESTMIPMAP"
5, "$OPTVAL_NONELINEARMIPMAP"
6, "$OPTVAL_NONETRILINEAR"
2, "$OPTVAL_LINEAR"
3, "$OPTVAL_BILINEAR"
4, "$OPTVAL_TRILINEAR"

View file

@ -117,34 +117,35 @@ vec4 getTexel(vec2 st)
//===========================================================================
//
// Doom lighting equation ripped from EDGE.
// Big thanks to EDGE developers for making the only port
// that actually replicates software renderer's lighting in OpenGL.
// Float version.
// Basically replace int with float and divide all constants by 31.
// Doom lighting equation exactly as calculated by zdoom.
//
//===========================================================================
float R_DoomLightingEquation(float light, float dist)
float R_DoomLightingEquation(float light)
{
// Changing this constant gives results very similar to changing r_visibility.
// Default is 232, it seems to give exactly the same light bands as software renderer.
#define DOOMLIGHTFACTOR 232.0
// Calculated from r_visibility. It differs between walls, floor and sprites.
//
// Wall: globVis = r_WallVisibility
// Floor: r_FloorVisibility / abs(plane.Zat0 - ViewPos.Z)
// Sprite: same as wall
// All are calculated in R_SetVisibility and seem to be decided by the
// aspect ratio amongst other things.
//
// 1706 is the value for walls on 1080p 16:9 displays.
float globVis = 1706.0;
/* L in the range 0 to 63 */
float L = light * 63.0/31.0;
/* L is the integer light level used in the game */
float L = light * 255.0;
float min_L = clamp(36.0/31.0 - L, 0.03, 1.0);
/* z is the depth in view/eye space, positive going into the screen */
float z = pixelpos.w;
// Fix objects getting totally black when close.
if (dist < 0.0001)
dist = 0.0001;
/* The zdoom light equation */
float vis = globVis / z;
float shade = 64.0 - (L + 12.0) * 32.0/128.0;
float lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
float scale = 1.0 / dist;
float index = (59.0/31.0 - L) - (scale * DOOMLIGHTFACTOR/31.0 - DOOMLIGHTFACTOR/31.0);
/* result is colormap index (0 bright .. 31 dark) */
return clamp(index, min_L, 1.0);
// Result is the normalized colormap index (0 bright .. 1 dark)
return lightscale;
}
//===========================================================================
@ -167,7 +168,7 @@ vec4 getLightColor(float fogdist, float fogfactor)
if (uLightLevel >= 0.0)
{
float newlightlevel = 1.0 - R_DoomLightingEquation(uLightLevel, gl_FragCoord.z);
float newlightlevel = 1.0 - R_DoomLightingEquation(uLightLevel);
color.rgb *= newlightlevel;
}
else if (uFogEnabled > 0)