mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
Added scolor
property, allowing for colorizing ZSprites.
- fixed ZSprites not updating important variables while frozen.
This commit is contained in:
parent
052b3cd89c
commit
0b6bae59ee
4 changed files with 27 additions and 13 deletions
|
@ -1006,6 +1006,7 @@ DZSprite::DZSprite()
|
||||||
Translation = Flags = 0;
|
Translation = Flags = 0;
|
||||||
sub = nullptr;
|
sub = nullptr;
|
||||||
cursector = nullptr;
|
cursector = nullptr;
|
||||||
|
scolor = 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DZSprite::CallPostBeginPlay()
|
void DZSprite::CallPostBeginPlay()
|
||||||
|
@ -1054,6 +1055,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SpawnZSprite, SpawnZSprite)
|
||||||
ACTION_RETURN_OBJECT(zs);
|
ACTION_RETURN_OBJECT(zs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DZSprite::UpdateSpriteInfo()
|
||||||
|
{
|
||||||
|
PT.color = scolor;
|
||||||
|
PT.Pos = Pos;
|
||||||
|
PT.Vel = Vel;
|
||||||
|
PT.Roll = Roll;
|
||||||
|
PT.alpha = Alpha;
|
||||||
|
PT.texture = Texture;
|
||||||
|
PT.style = ERenderStyle(GetRenderStyle());
|
||||||
|
PT.flags = Flags;
|
||||||
|
PT.subsector = sub;
|
||||||
|
PT.sprite = this;
|
||||||
|
}
|
||||||
|
|
||||||
// This runs just like Actor's, make sure to call Super.Tick() in ZScript.
|
// This runs just like Actor's, make sure to call Super.Tick() in ZScript.
|
||||||
void DZSprite::Tick()
|
void DZSprite::Tick()
|
||||||
|
@ -1070,8 +1084,10 @@ void DZSprite::Tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFrozen())
|
if (isFrozen())
|
||||||
|
{ // needed here because it won't retroactively update like actors do.
|
||||||
|
UpdateSpriteInfo();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Prev = Pos;
|
Prev = Pos;
|
||||||
PrevRoll = Roll;
|
PrevRoll = Roll;
|
||||||
// Handle crossing a line portal
|
// Handle crossing a line portal
|
||||||
|
@ -1101,17 +1117,7 @@ void DZSprite::Tick()
|
||||||
cursector = nullptr;
|
cursector = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PT.color = 0xffffff;
|
UpdateSpriteInfo();
|
||||||
PT.Pos = Pos;
|
|
||||||
PT.Vel = Vel;
|
|
||||||
PT.Roll = Roll;
|
|
||||||
PT.size = Scale.X;
|
|
||||||
PT.alpha = Alpha;
|
|
||||||
PT.texture = Texture;
|
|
||||||
PT.style = ERenderStyle(GetRenderStyle());
|
|
||||||
PT.flags = Flags;
|
|
||||||
PT.subsector = sub;
|
|
||||||
PT.sprite = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int DZSprite::GetLightLevel(sector_t* rendersector) const
|
int DZSprite::GetLightLevel(sector_t* rendersector) const
|
||||||
|
@ -1218,6 +1224,7 @@ void DZSprite::Serialize(FSerializer& arc)
|
||||||
("style", Style)
|
("style", Style)
|
||||||
("translation", Translation)
|
("translation", Translation)
|
||||||
("cursector", cursector)
|
("cursector", cursector)
|
||||||
|
("scolor", scolor)
|
||||||
("flipx", bXFlip)
|
("flipx", bXFlip)
|
||||||
("flipy", bYFlip)
|
("flipy", bYFlip)
|
||||||
("dontinterpolate", bDontInterpolate)
|
("dontinterpolate", bDontInterpolate)
|
||||||
|
@ -1239,6 +1246,7 @@ DEFINE_FIELD(DZSprite, Texture);
|
||||||
DEFINE_FIELD(DZSprite, Translation);
|
DEFINE_FIELD(DZSprite, Translation);
|
||||||
DEFINE_FIELD(DZSprite, Flags);
|
DEFINE_FIELD(DZSprite, Flags);
|
||||||
DEFINE_FIELD(DZSprite, LightLevel);
|
DEFINE_FIELD(DZSprite, LightLevel);
|
||||||
|
DEFINE_FIELD(DZSprite, scolor);
|
||||||
DEFINE_FIELD(DZSprite, cursector);
|
DEFINE_FIELD(DZSprite, cursector);
|
||||||
DEFINE_FIELD(DZSprite, bXFlip);
|
DEFINE_FIELD(DZSprite, bXFlip);
|
||||||
DEFINE_FIELD(DZSprite, bYFlip);
|
DEFINE_FIELD(DZSprite, bYFlip);
|
||||||
|
|
|
@ -155,6 +155,8 @@ public:
|
||||||
double Roll, PrevRoll, Alpha;
|
double Roll, PrevRoll, Alpha;
|
||||||
int16_t LightLevel;
|
int16_t LightLevel;
|
||||||
|
|
||||||
|
int scolor;
|
||||||
|
|
||||||
FRenderStyle Style;
|
FRenderStyle Style;
|
||||||
FTextureID Texture;
|
FTextureID Texture;
|
||||||
uint32_t Translation;
|
uint32_t Translation;
|
||||||
|
@ -186,6 +188,7 @@ public:
|
||||||
float InterpolatedRoll(double ticFrac) const;
|
float InterpolatedRoll(double ticFrac) const;
|
||||||
|
|
||||||
void Tick() override;
|
void Tick() override;
|
||||||
|
void UpdateSpriteInfo();
|
||||||
void Serialize(FSerializer& arc) override;
|
void Serialize(FSerializer& arc) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1410,7 +1410,9 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
||||||
rendered_sprites++;
|
rendered_sprites++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [MC] ZSprites are to be rendered akin to actor sprites.
|
// [MC] ZSprites are to be rendered akin to actor sprites. The reason this whole system
|
||||||
|
// is hitching a ride on particle_t is because of the large number of checks with
|
||||||
|
// HWSprite elsewhere in the draw lists.
|
||||||
void HWSprite::AdjustZSprite(HWDrawInfo* di, DZSprite* spr, sector_t* sector)
|
void HWSprite::AdjustZSprite(HWDrawInfo* di, DZSprite* spr, sector_t* sector)
|
||||||
{
|
{
|
||||||
translation = spr->Translation;
|
translation = spr->Translation;
|
||||||
|
|
|
@ -10,6 +10,7 @@ Class ZSprite : Thinker native
|
||||||
native bool bXFlip, bYFlip,
|
native bool bXFlip, bYFlip,
|
||||||
bDontInterpolate,
|
bDontInterpolate,
|
||||||
bAddLightLevel;
|
bAddLightLevel;
|
||||||
|
native Color scolor;
|
||||||
|
|
||||||
native Sector CurSector; // can be null!
|
native Sector CurSector; // can be null!
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue