示例#1
0
//==========================================================================
//
// Checks whether a sprite should be affected by a glow
//
//==========================================================================
int gl_CheckSpriteGlow(FTextureID floorpic, int lightlevel, fixed_t floordiff)
{
	FTexture *tex = TexMan[floorpic];
	if (tex != NULL && tex->isGlowing())
	{
		if (floordiff < tex->gl_info.GlowHeight*FRACUNIT && tex->gl_info.GlowHeight != 0)
		{
			int maxlight=(255+lightlevel)>>1;
			fixed_t lightfrac = floordiff / tex->gl_info.GlowHeight;
			if (lightfrac<0) lightfrac=0;
			lightlevel= (lightfrac*lightlevel + maxlight*(FRACUNIT-lightfrac))>>FRACBITS;
		}
	}
//==========================================================================
//
// Checks whether a sprite should be affected by a glow
//
//==========================================================================
int gl_CheckSpriteGlow(sector_t *sec, int lightlevel, int x, int y, int z)
{
	FTextureID floorpic = sec->GetTexture(sector_t::floor);
	FTexture *tex = TexMan[floorpic];
	if (tex != NULL && tex->isGlowing())
	{
		fixed_t floordiff = z - sec->floorplane.ZatPoint(x, y);
		if (floordiff < tex->gl_info.GlowHeight*FRACUNIT && tex->gl_info.GlowHeight != 0)
		{
			int maxlight = (255+lightlevel)>>1;
			fixed_t lightfrac = floordiff / tex->gl_info.GlowHeight;
			if (lightfrac<0) lightfrac=0;
			lightlevel= (lightfrac*lightlevel + maxlight*(FRACUNIT-lightfrac))>>FRACBITS;
		}