mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-13 07:31:04 +00:00
Added LightLevel.
- Setting it to any value > -1 will override the sector's light level.
This commit is contained in:
parent
f235dcc38e
commit
d5e448671d
7 changed files with 18 additions and 6 deletions
|
@ -941,8 +941,8 @@ CCMD(currentpos)
|
||||||
AActor *mo = players[consoleplayer].mo;
|
AActor *mo = players[consoleplayer].mo;
|
||||||
if(mo)
|
if(mo)
|
||||||
{
|
{
|
||||||
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
|
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, sector lightlevel: %d, actor lightlevel\n",
|
||||||
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw.Normalized360().Degrees, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel);
|
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw.Normalized360().Degrees, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel, mo->LightLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1112,6 +1112,7 @@ public:
|
||||||
int16_t movecount; // when 0, select a new dir
|
int16_t movecount; // when 0, select a new dir
|
||||||
|
|
||||||
int16_t strafecount; // for MF3_AVOIDMELEE
|
int16_t strafecount; // for MF3_AVOIDMELEE
|
||||||
|
int16_t LightLevel; // Allows for overriding sector light levels.
|
||||||
uint16_t SpawnAngle;
|
uint16_t SpawnAngle;
|
||||||
|
|
||||||
TObjPtr<AActor*> target; // thing being chased/attacked (or NULL)
|
TObjPtr<AActor*> target; // thing being chased/attacked (or NULL)
|
||||||
|
|
|
@ -371,6 +371,7 @@ void AActor::Serialize(FSerializer &arc)
|
||||||
A("friction", Friction)
|
A("friction", Friction)
|
||||||
A("SpriteOffset", SpriteOffset)
|
A("SpriteOffset", SpriteOffset)
|
||||||
("viewpos", ViewPos)
|
("viewpos", ViewPos)
|
||||||
|
A("lightlevel", LightLevel)
|
||||||
A("userlights", UserLights)
|
A("userlights", UserLights)
|
||||||
A("WorldOffset", WorldOffset);
|
A("WorldOffset", WorldOffset);
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,8 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
int rel = fullbright ? 0 : getExtraLight();
|
int rel = fullbright ? 0 : getExtraLight();
|
||||||
auto &vp = di->Viewpoint;
|
auto &vp = di->Viewpoint;
|
||||||
|
|
||||||
|
const bool UseActorLight = (actor && actor->LightLevel > -1);
|
||||||
|
|
||||||
if (translucent)
|
if (translucent)
|
||||||
{
|
{
|
||||||
// The translucent pass requires special setup for the various modes.
|
// The translucent pass requires special setup for the various modes.
|
||||||
|
@ -240,7 +242,6 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
// set up the light slice
|
// set up the light slice
|
||||||
secplane_t *topplane = i == 0 ? &topp : &(*lightlist)[i].plane;
|
secplane_t *topplane = i == 0 ? &topp : &(*lightlist)[i].plane;
|
||||||
secplane_t *lowplane = i == (*lightlist).Size() - 1 ? &bottomp : &(*lightlist)[i + 1].plane;
|
secplane_t *lowplane = i == (*lightlist).Size() - 1 ? &bottomp : &(*lightlist)[i + 1].plane;
|
||||||
|
|
||||||
int thislight = (*lightlist)[i].caster != nullptr ? hw_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel;
|
int thislight = (*lightlist)[i].caster != nullptr ? hw_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel;
|
||||||
int thisll = actor == nullptr ? thislight : (uint8_t)actor->Sector->CheckSpriteGlow(thislight, actor->InterpolatedPosition(vp.TicFrac));
|
int thisll = actor == nullptr ? thislight : (uint8_t)actor->Sector->CheckSpriteGlow(thislight, actor->InterpolatedPosition(vp.TicFrac));
|
||||||
|
|
||||||
|
@ -1002,9 +1003,13 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
||||||
fullbright = (thing->flags5 & MF5_BRIGHT) ||
|
fullbright = (thing->flags5 & MF5_BRIGHT) ||
|
||||||
((thing->renderflags & RF_FULLBRIGHT) && (!texture || !texture->isFullbrightDisabled()));
|
((thing->renderflags & RF_FULLBRIGHT) && (!texture || !texture->isFullbrightDisabled()));
|
||||||
|
|
||||||
lightlevel = fullbright ? 255 :
|
if (fullbright) lightlevel = 255;
|
||||||
hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
else if (thing->LightLevel > -1)
|
||||||
|
lightlevel = thing->LightLevel;
|
||||||
|
else
|
||||||
|
lightlevel = hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||||
|
|
||||||
foglevel = (uint8_t)clamp<short>(rendersector->lightlevel, 0, 255);
|
foglevel = (uint8_t)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||||
|
|
||||||
lightlevel = rendersector->CheckSpriteGlow(lightlevel, thingpos);
|
lightlevel = rendersector->CheckSpriteGlow(lightlevel, thingpos);
|
||||||
|
|
|
@ -955,7 +955,8 @@ namespace swrenderer
|
||||||
auto nc = !!(thing->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
|
auto nc = !!(thing->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
|
||||||
thingColormap = GetSpriteColorTable(thing->Sector->Colormap, thing->Sector->SpecialColors[sector_t::sprites], nc);
|
thingColormap = GetSpriteColorTable(thing->Sector->Colormap, thing->Sector->SpecialColors[sector_t::sprites], nc);
|
||||||
}
|
}
|
||||||
|
if (thing->LightLevel > -1)
|
||||||
|
thinglightlevel = thing->LightLevel;
|
||||||
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
||||||
{
|
{
|
||||||
RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, thinglightlevel, foggy, thingColormap);
|
RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, thinglightlevel, foggy, thingColormap);
|
||||||
|
|
|
@ -2026,6 +2026,7 @@ DEFINE_FIELD(AActor, ViewPos)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Yaw, viewangle)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Yaw, viewangle)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Pitch, viewpitch)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Pitch, viewpitch)
|
||||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
|
DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
|
||||||
|
DEFINE_FIELD(AActor, LightLevel)
|
||||||
|
|
||||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
|
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
|
||||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
|
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
|
||||||
|
|
|
@ -255,6 +255,7 @@ class Actor : Thinker native
|
||||||
native int RenderHidden;
|
native int RenderHidden;
|
||||||
native int RenderRequired;
|
native int RenderRequired;
|
||||||
native int FriendlySeeBlocks;
|
native int FriendlySeeBlocks;
|
||||||
|
native int16 lightlevel;
|
||||||
native readonly int SpawnTime;
|
native readonly int SpawnTime;
|
||||||
private native int InventoryID; // internal counter.
|
private native int InventoryID; // internal counter.
|
||||||
|
|
||||||
|
@ -356,6 +357,7 @@ class Actor : Thinker native
|
||||||
property RenderRequired: RenderRequired;
|
property RenderRequired: RenderRequired;
|
||||||
property FriendlySeeBlocks: FriendlySeeBlocks;
|
property FriendlySeeBlocks: FriendlySeeBlocks;
|
||||||
property ThruBits: ThruBits;
|
property ThruBits: ThruBits;
|
||||||
|
property LightLevel: LightLevel;
|
||||||
|
|
||||||
// need some definition work first
|
// need some definition work first
|
||||||
//FRenderStyle RenderStyle;
|
//FRenderStyle RenderStyle;
|
||||||
|
@ -380,6 +382,7 @@ class Actor : Thinker native
|
||||||
|
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
|
LightLevel -1;
|
||||||
Scale 1;
|
Scale 1;
|
||||||
Health DEFAULT_HEALTH;
|
Health DEFAULT_HEALTH;
|
||||||
Reactiontime 8;
|
Reactiontime 8;
|
||||||
|
|
Loading…
Reference in a new issue