mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +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;
|
||||
if(mo)
|
||||
{
|
||||
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
|
||||
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw.Normalized360().Degrees, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel);
|
||||
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->LightLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1112,6 +1112,7 @@ public:
|
|||
int16_t movecount; // when 0, select a new dir
|
||||
|
||||
int16_t strafecount; // for MF3_AVOIDMELEE
|
||||
int16_t LightLevel; // Allows for overriding sector light levels.
|
||||
uint16_t SpawnAngle;
|
||||
|
||||
TObjPtr<AActor*> target; // thing being chased/attacked (or NULL)
|
||||
|
|
|
@ -371,6 +371,7 @@ void AActor::Serialize(FSerializer &arc)
|
|||
A("friction", Friction)
|
||||
A("SpriteOffset", SpriteOffset)
|
||||
("viewpos", ViewPos)
|
||||
A("lightlevel", LightLevel)
|
||||
A("userlights", UserLights)
|
||||
A("WorldOffset", WorldOffset);
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
int rel = fullbright ? 0 : getExtraLight();
|
||||
auto &vp = di->Viewpoint;
|
||||
|
||||
const bool UseActorLight = (actor && actor->LightLevel > -1);
|
||||
|
||||
if (translucent)
|
||||
{
|
||||
// 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
|
||||
secplane_t *topplane = i == 0 ? &topp : &(*lightlist)[i].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 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) ||
|
||||
((thing->renderflags & RF_FULLBRIGHT) && (!texture || !texture->isFullbrightDisabled()));
|
||||
|
||||
lightlevel = fullbright ? 255 :
|
||||
hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
if (fullbright) lightlevel = 255;
|
||||
else if (thing->LightLevel > -1)
|
||||
lightlevel = thing->LightLevel;
|
||||
else
|
||||
lightlevel = hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
rendersector->GetCeilingLight() : rendersector->GetFloorLight());
|
||||
|
||||
foglevel = (uint8_t)clamp<short>(rendersector->lightlevel, 0, 255);
|
||||
|
||||
lightlevel = rendersector->CheckSpriteGlow(lightlevel, thingpos);
|
||||
|
|
|
@ -955,7 +955,8 @@ namespace swrenderer
|
|||
auto nc = !!(thing->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING);
|
||||
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)
|
||||
{
|
||||
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.Pitch, viewpitch)
|
||||
DEFINE_FIELD_NAMED(AActor, ViewAngles.Roll, viewroll)
|
||||
DEFINE_FIELD(AActor, LightLevel)
|
||||
|
||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
|
||||
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
|
||||
|
|
|
@ -255,6 +255,7 @@ class Actor : Thinker native
|
|||
native int RenderHidden;
|
||||
native int RenderRequired;
|
||||
native int FriendlySeeBlocks;
|
||||
native int16 lightlevel;
|
||||
native readonly int SpawnTime;
|
||||
private native int InventoryID; // internal counter.
|
||||
|
||||
|
@ -356,6 +357,7 @@ class Actor : Thinker native
|
|||
property RenderRequired: RenderRequired;
|
||||
property FriendlySeeBlocks: FriendlySeeBlocks;
|
||||
property ThruBits: ThruBits;
|
||||
property LightLevel: LightLevel;
|
||||
|
||||
// need some definition work first
|
||||
//FRenderStyle RenderStyle;
|
||||
|
@ -380,6 +382,7 @@ class Actor : Thinker native
|
|||
|
||||
Default
|
||||
{
|
||||
LightLevel -1;
|
||||
Scale 1;
|
||||
Health DEFAULT_HEALTH;
|
||||
Reactiontime 8;
|
||||
|
|
Loading…
Reference in a new issue