mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
- partial adjustments.
No point changing all the viewx/y/z stuff when that is about to get floatified next.
This commit is contained in:
parent
466c4c75df
commit
a27181cb0b
7 changed files with 35 additions and 35 deletions
|
@ -119,19 +119,19 @@ void gl_InitGlow(FScanner &sc)
|
||||||
// Checks whether a sprite should be affected by a glow
|
// Checks whether a sprite should be affected by a glow
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, int x, int y, int z)
|
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, const DVector3 &pos)
|
||||||
{
|
{
|
||||||
FTextureID floorpic = sec->GetTexture(sector_t::floor);
|
FTextureID floorpic = sec->GetTexture(sector_t::floor);
|
||||||
FTexture *tex = TexMan[floorpic];
|
FTexture *tex = TexMan[floorpic];
|
||||||
if (tex != NULL && tex->isGlowing())
|
if (tex != NULL && tex->isGlowing())
|
||||||
{
|
{
|
||||||
fixed_t floordiff = z - sec->floorplane.ZatPoint(x, y);
|
double floordiff = pos.Z - sec->floorplane.ZatPoint(pos);
|
||||||
if (floordiff < tex->gl_info.GlowHeight*FRACUNIT && tex->gl_info.GlowHeight != 0)
|
if (floordiff < tex->gl_info.GlowHeight && tex->gl_info.GlowHeight != 0)
|
||||||
{
|
{
|
||||||
int maxlight = (255 + lightlevel) >> 1;
|
int maxlight = (255 + lightlevel) >> 1;
|
||||||
fixed_t lightfrac = floordiff / tex->gl_info.GlowHeight;
|
double lightfrac = floordiff / tex->gl_info.GlowHeight;
|
||||||
if (lightfrac < 0) lightfrac = 0;
|
if (lightfrac < 0) lightfrac = 0;
|
||||||
lightlevel= (lightfrac*lightlevel + maxlight*(FRACUNIT-lightfrac))>>FRACBITS;
|
lightlevel = int(lightfrac*lightlevel + maxlight*(1 - lightfrac));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lightlevel;
|
return lightlevel;
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
struct sector_t;
|
struct sector_t;
|
||||||
|
|
||||||
void gl_InitGlow(const char * lumpnm);
|
void gl_InitGlow(const char * lumpnm);
|
||||||
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, int x, int y, int z);
|
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, const DVector3 &pos);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -656,17 +656,17 @@ void GLSkyboxPortal::DrawContents()
|
||||||
|
|
||||||
bool oldclamp = gl_RenderState.SetDepthClamp(false);
|
bool oldclamp = gl_RenderState.SetDepthClamp(false);
|
||||||
DVector3 viewpos = origin->InterpolatedPosition(r_TicFracF);
|
DVector3 viewpos = origin->InterpolatedPosition(r_TicFracF);
|
||||||
viewx = FLOAT2FIXED(viewpos.X);
|
|
||||||
viewy = FLOAT2FIXED(viewpos.Y);
|
|
||||||
viewz = FLOAT2FIXED(viewpos.Z);
|
|
||||||
viewangle += (origin->PrevAngles.Yaw + deltaangle(origin->PrevAngles.Yaw, origin->Angles.Yaw) * r_TicFracF).BAMs();
|
viewangle += (origin->PrevAngles.Yaw + deltaangle(origin->PrevAngles.Yaw, origin->Angles.Yaw) * r_TicFracF).BAMs();
|
||||||
|
|
||||||
// Don't let the viewpoint be too close to a floor or ceiling
|
// Don't let the viewpoint be too close to a floor or ceiling
|
||||||
fixed_t floorh = origin->Sector->floorplane.ZatPoint(origin->_f_Pos());
|
double floorh = origin->Sector->floorplane.ZatPoint(origin->Pos());
|
||||||
fixed_t ceilh = origin->Sector->ceilingplane.ZatPoint(origin->_f_Pos());
|
double ceilh = origin->Sector->ceilingplane.ZatPoint(origin->Pos());
|
||||||
if (viewz<floorh+4*FRACUNIT) viewz=floorh+4*FRACUNIT;
|
if (viewpos.Z < floorh + 4) viewpos.Z = floorh + 4;
|
||||||
if (viewz>ceilh-4*FRACUNIT) viewz=ceilh-4*FRACUNIT;
|
if (viewpos.Z > ceilh - 4) viewz = ceilh - 4;
|
||||||
|
|
||||||
|
viewx = FLOAT2FIXED(viewpos.X);
|
||||||
|
viewy = FLOAT2FIXED(viewpos.Y);
|
||||||
|
viewz = FLOAT2FIXED(viewpos.Z);
|
||||||
|
|
||||||
GLRenderer->mViewActor = origin;
|
GLRenderer->mViewActor = origin;
|
||||||
|
|
||||||
|
|
|
@ -186,8 +186,8 @@ struct GLLinePortal : public GLPortal
|
||||||
{
|
{
|
||||||
v1 = line->v1;
|
v1 = line->v1;
|
||||||
v2 = line->v2;
|
v2 = line->v2;
|
||||||
dx = line->fixDx();
|
dx = FLOAT2FIXED(line->Delta().X);
|
||||||
dy = line->fixDy();
|
dy = FLOAT2FIXED(line->Delta().Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLLinePortal(FGLLinePortal *line)
|
GLLinePortal(FGLLinePortal *line)
|
||||||
|
@ -198,8 +198,8 @@ struct GLLinePortal : public GLPortal
|
||||||
line_t *lline = line->reference->mDestination;
|
line_t *lline = line->reference->mDestination;
|
||||||
v1 = lline->v1;
|
v1 = lline->v1;
|
||||||
v2 = lline->v2;
|
v2 = lline->v2;
|
||||||
dx = lline->fixDy();
|
dx = FLOAT2FIXED(lline->Delta().X);
|
||||||
dy = lline->fixDy();
|
dy = FLOAT2FIXED(lline->Delta().Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -532,8 +532,8 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
{
|
{
|
||||||
if (!(thing->flags7 & MF7_FLYCHEAT) && thing->target==GLRenderer->mViewActor && GLRenderer->mViewActor != NULL)
|
if (!(thing->flags7 & MF7_FLYCHEAT) && thing->target==GLRenderer->mViewActor && GLRenderer->mViewActor != NULL)
|
||||||
{
|
{
|
||||||
fixed_t clipdist = FLOAT2FIXED(clamp(thing->Speed, thing->target->radius, thing->target->radius*2));
|
double clipdist = clamp(thing->Speed, thing->target->radius, thing->target->radius*2);
|
||||||
if (P_AproxDistance(FLOAT2FIXED(thingpos.X)-viewx, FLOAT2FIXED(thingpos.Y)-viewy) < clipdist) return;
|
if (P_AproxDistance(thingpos.X-viewx, thingpos.Y-viewy) < clipdist) return;
|
||||||
}
|
}
|
||||||
thing->flags7 |= MF7_FLYCHEAT; // do this only once for the very first frame, but not if it gets into range again.
|
thing->flags7 |= MF7_FLYCHEAT; // do this only once for the very first frame, but not if it gets into range again.
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ void GLSprite::Process(AActor* thing,sector_t * sector)
|
||||||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||||
foglevel = (BYTE)clamp<short>(rendersector->lightlevel, 0, 255);
|
foglevel = (BYTE)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||||
|
|
||||||
lightlevel = (byte)gl_CheckSpriteGlow(rendersector, lightlevel, FLOAT2FIXED(thingpos.X), FLOAT2FIXED(thingpos.Y), FLOAT2FIXED(thingpos.Z));
|
lightlevel = (byte)gl_CheckSpriteGlow(rendersector, lightlevel, thingpos);
|
||||||
|
|
||||||
ThingColor = (thing->RenderStyle.Flags & STYLEF_ColorIsFixed) ? thing->fillcolor : 0xffffff;
|
ThingColor = (thing->RenderStyle.Flags & STYLEF_ColorIsFixed) ? thing->fillcolor : 0xffffff;
|
||||||
ThingColor.a = 255;
|
ThingColor.a = 255;
|
||||||
|
|
|
@ -134,8 +134,8 @@ void GLWall::PutWall(bool translucent)
|
||||||
|
|
||||||
if (translucent) // translucent walls
|
if (translucent) // translucent walls
|
||||||
{
|
{
|
||||||
viewdistance = P_AproxDistance(((seg->linedef->v1->fixX() + seg->linedef->v2->fixX()) >> 1) - viewx,
|
viewdistance = P_AproxDistance(((seg->linedef->v1->fX() + seg->linedef->v2->fX()) /2) - viewx,
|
||||||
((seg->linedef->v1->fixY() + seg->linedef->v2->fixY()) >> 1) - viewy);
|
((seg->linedef->v1->fY() + seg->linedef->v2->fY()) /2) - viewy);
|
||||||
gl_drawinfo->drawlists[GLDL_TRANSLUCENT].AddWall(this);
|
gl_drawinfo->drawlists[GLDL_TRANSLUCENT].AddWall(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -250,7 +250,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
||||||
|
|
||||||
lightlevel = (1.0 - min_L) * 255;
|
lightlevel = (1.0 - min_L) * 255;
|
||||||
}
|
}
|
||||||
lightlevel = gl_CheckSpriteGlow(viewsector, lightlevel, playermo->_f_X(), playermo->_f_Y(), playermo->_f_Z());
|
lightlevel = gl_CheckSpriteGlow(viewsector, lightlevel, playermo->Pos());
|
||||||
|
|
||||||
// calculate colormap for weapon sprites
|
// calculate colormap for weapon sprites
|
||||||
if (viewsector->e->XFloor.ffloors.Size() && !glset.nocoloredspritelighting)
|
if (viewsector->e->XFloor.ffloors.Size() && !glset.nocoloredspritelighting)
|
||||||
|
|
Loading…
Reference in a new issue