mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
This commit is contained in:
commit
9001009fcf
6 changed files with 33 additions and 29 deletions
|
@ -612,9 +612,9 @@ void FGLRenderer::CreateTonemapPalette()
|
|||
{
|
||||
PalEntry color = GPalette.BaseColors[(uint8_t)PTM_BestColor((uint32_t *)GPalette.BaseColors, (r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4), 0, 256)];
|
||||
int index = ((r * 64 + g) * 64 + b) * 4;
|
||||
lut[index] = color.r;
|
||||
lut[index] = color.b;
|
||||
lut[index + 1] = color.g;
|
||||
lut[index + 2] = color.b;
|
||||
lut[index + 2] = color.r;
|
||||
lut[index + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,8 +271,8 @@ void SWCanvas::FillSimplePoly(DCanvas *canvas, FTexture *tex, FVector2 *points,
|
|||
|
||||
viewport->RenderTarget->Lock(true);
|
||||
|
||||
scalex /= tex->Scale.X;
|
||||
scaley /= tex->Scale.Y;
|
||||
scalex = tex->Scale.X / scalex;
|
||||
scaley = tex->Scale.Y / scaley;
|
||||
|
||||
// Use the CRT's functions here.
|
||||
cosrot = cos(rotation.Radians());
|
||||
|
|
|
@ -103,34 +103,29 @@ vec4 getTexel(vec2 st)
|
|||
//===========================================================================
|
||||
float R_DoomLightingEquation(float light)
|
||||
{
|
||||
// Calculated from r_visibility. It differs between walls, floor and sprites.
|
||||
// globVis = WallVisibility / r_viewwindow.FocalTangent / 32.0
|
||||
//
|
||||
// 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;
|
||||
// WallVisibility is calculated in LightVisibility::SetVisibility
|
||||
// 1706 is the default value for WallVisibility on 1080p 16:9 displays.
|
||||
float globVis = 1706.0 / 1.3333333333333333 / 32.0;
|
||||
|
||||
/* L is the integer light level used in the game */
|
||||
// L is the integer light level used in the game
|
||||
float L = light * 255.0;
|
||||
|
||||
/* z is the depth in view/eye space, positive going into the screen */
|
||||
// z is the depth in view/eye space, positive going into the screen
|
||||
float z = pixelpos.w;
|
||||
|
||||
/* The zdoom light equation */
|
||||
float vis = globVis / z;
|
||||
float shade = 64.0 - (L + 12.0) * 32.0/128.0;
|
||||
// The zdoom light equation
|
||||
float vis = min(globVis / z, 24.0 / 32.0);
|
||||
float shade = 2.0 - (L + 12.0) / 128.0;
|
||||
float lightscale;
|
||||
if (uPalLightLevels != 0)
|
||||
lightscale = clamp(float(int(shade - min(24.0, vis))) / 32.0, 0.0, 31.0/32.0);
|
||||
lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0;
|
||||
else
|
||||
lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
|
||||
lightscale = shade - vis;
|
||||
|
||||
// Result is the normalized colormap index (0 bright .. 1 dark)
|
||||
return lightscale;
|
||||
return clamp(lightscale, 0.0, 31.0 / 32.0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -449,7 +449,7 @@ struct DropItem native
|
|||
native readonly DropItem Next;
|
||||
native readonly name Name;
|
||||
native readonly int Probability;
|
||||
native int Amount;
|
||||
native readonly int Amount;
|
||||
}
|
||||
|
||||
class SpotState : Object native
|
||||
|
|
|
@ -318,11 +318,12 @@ extend class Actor
|
|||
{
|
||||
if (di.Name != 'None')
|
||||
{
|
||||
if (di.Amount < 0)
|
||||
int amt = di.Amount;
|
||||
if (amt < 0)
|
||||
{
|
||||
di.Amount = 1; // default value is -1, we need a positive value.
|
||||
amt = 1; // default value is -1, we need a positive value.
|
||||
}
|
||||
n += di.Amount; // this is how we can weight the list.
|
||||
n += amt; // this is how we can weight the list.
|
||||
}
|
||||
}
|
||||
di = drop;
|
||||
|
@ -331,7 +332,12 @@ extend class Actor
|
|||
{
|
||||
if (di.Name != 'none')
|
||||
{
|
||||
n -= di.Amount; // logically, none of the -1 values have survived by now.
|
||||
int amt = di.Amount;
|
||||
if (amt < 0)
|
||||
{
|
||||
amt = 1;
|
||||
}
|
||||
n -= amt;
|
||||
}
|
||||
if ((di.Next != null) && (n >= 0))
|
||||
{
|
||||
|
|
|
@ -48,8 +48,9 @@ class RandomSpawner : Actor
|
|||
{
|
||||
if (!nomonsters || !IsMonster(di))
|
||||
{
|
||||
if (di.Amount < 0) di.Amount = 1; // default value is -1, we need a positive value.
|
||||
n += di.Amount; // this is how we can weight the list.
|
||||
int amt = di.Amount;
|
||||
if (amt < 0) amt = 1; // default value is -1, we need a positive value.
|
||||
n += amt; // this is how we can weight the list.
|
||||
}
|
||||
di = di.Next;
|
||||
}
|
||||
|
@ -69,7 +70,9 @@ class RandomSpawner : Actor
|
|||
if (di.Name != 'None' &&
|
||||
(!nomonsters || !IsMonster(di)))
|
||||
{
|
||||
n -= di.Amount;
|
||||
int amt = di.Amount;
|
||||
if (amt < 0) amt = 1;
|
||||
n -= amt;
|
||||
if ((di.Next != null) && (n > -1))
|
||||
di = di.Next;
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue