mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 03:02:21 +00:00
This commit is contained in:
parent
b6f0bc0da3
commit
36bfb54547
7 changed files with 20 additions and 7 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
|
||||
{
|
||||
|
|
|
@ -1103,6 +1103,7 @@ public:
|
|||
int8_t visdir;
|
||||
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)
|
||||
// also the originator for missiles
|
||||
|
|
|
@ -371,6 +371,7 @@ void AActor::Serialize(FSerializer &arc)
|
|||
A("friction", Friction)
|
||||
A("SpriteOffset", SpriteOffset)
|
||||
("viewpos", ViewPos)
|
||||
A("lightlevel", LightLevel)
|
||||
A("userlights", UserLights);
|
||||
|
||||
SerializeTerrain(arc, "floorterrain", floorterrain, &def->floorterrain);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
@ -988,16 +989,21 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
// light calculation
|
||||
|
||||
bool enhancedvision = false;
|
||||
bool UseActorLight = (thing->LightLevel > -1);
|
||||
|
||||
// allow disabling of the fullbright flag by a brightmap definition
|
||||
// (e.g. to do the gun flashes of Doom's zombies correctly.
|
||||
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 (UseActorLight)
|
||||
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);
|
||||
|
||||
foglevel = (uint8_t)clamp<short>((UseActorLight) ? thing->LightLevel : 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);
|
||||
|
|
|
@ -2025,6 +2025,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);
|
||||
|
|
|
@ -254,6 +254,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.
|
||||
|
||||
|
@ -355,6 +356,7 @@ class Actor : Thinker native
|
|||
property RenderRequired: RenderRequired;
|
||||
property FriendlySeeBlocks: FriendlySeeBlocks;
|
||||
property ThruBits: ThruBits;
|
||||
property LightLevel: LightLevel;
|
||||
|
||||
// need some definition work first
|
||||
//FRenderStyle RenderStyle;
|
||||
|
@ -379,6 +381,7 @@ class Actor : Thinker native
|
|||
|
||||
Default
|
||||
{
|
||||
LightLevel -1;
|
||||
Scale 1;
|
||||
Health DEFAULT_HEALTH;
|
||||
Reactiontime 8;
|
||||
|
|
Loading…
Reference in a new issue