mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- tested and fixed the attachable lights.
This commit is contained in:
parent
5df8919b90
commit
8b4d85f0d7
3 changed files with 23 additions and 5 deletions
|
@ -758,6 +758,12 @@ void AActor::SetDynamicLights()
|
|||
unsigned int count = 0;
|
||||
|
||||
if (state == nullptr) return;
|
||||
|
||||
for (const auto def : UserLights)
|
||||
{
|
||||
AttachLight(count++, def);
|
||||
}
|
||||
|
||||
if (LightAssociations.Size() > 0)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -838,7 +844,7 @@ int AttachLightDef(AActor *self, int _lightid, int _lightname)
|
|||
|
||||
// Todo: Optimize. This may be too slow.
|
||||
auto lightdef = LightDefaults.FindEx([=](const auto &a) {
|
||||
return a->GetName() == lightid;
|
||||
return a->GetName() == lightname;
|
||||
});
|
||||
if (lightdef < LightDefaults.Size())
|
||||
{
|
||||
|
@ -874,7 +880,7 @@ int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radiu
|
|||
userlight->SetArg(LIGHT_INTENSITY, radius1);
|
||||
userlight->SetArg(LIGHT_SECONDARY_INTENSITY, radius2);
|
||||
userlight->SetFlags(LightFlags::FromInt(flags));
|
||||
float of[] = { float(ofs_x), float(ofs_y), float(ofs_z)};
|
||||
float of[] = { float(ofs_x), float(ofs_z), float(ofs_y)};
|
||||
userlight->SetOffset(of);
|
||||
userlight->SetParameter(type == PulseLight? param*TICRATE : param*360.);
|
||||
userlight->SetSpotInnerAngle(spoti);
|
||||
|
|
|
@ -1163,9 +1163,9 @@ class Actor : Thinker native
|
|||
action native void A_OverlayAlpha(int layer, double alph);
|
||||
action native void A_OverlayRenderStyle(int layer, int style);
|
||||
|
||||
action native bool A_AttachLightDef(Name lightid, Name lightdef);
|
||||
action native bool A_AttachLight(Name lightid, int type, Color lightcolor, int radius1, int radius2, int flags, Vector3 ofs, double param, double spoti, double spoto, double spotp);
|
||||
action mative bool A_RemoveLight(Name lightid);
|
||||
native bool A_AttachLightDef(Name lightid, Name lightdef);
|
||||
native bool A_AttachLight(Name lightid, int type, Color lightcolor, int radius1, int radius2, int flags = 0, Vector3 ofs = (0,0,0), double param = 0, double spoti = 10, double spoto = 25, double spotp = 0);
|
||||
native bool A_RemoveLight(Name lightid);
|
||||
|
||||
int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,18 @@ class DynamicLight : Actor
|
|||
LIGHT_SCALE = 3,
|
||||
};
|
||||
|
||||
// These are for use in A_AttachLight calls.
|
||||
enum LightFlag
|
||||
{
|
||||
LF_SUBTRACTIVE = 1,
|
||||
LF_ADDITIVE = 2,
|
||||
LF_DONTLIGHTSELF = 4,
|
||||
LF_ATTENUATE = 8,
|
||||
LF_NOSHADOWMAP = 16,
|
||||
LF_DONTLIGHTACTORS = 32,
|
||||
LF_SPOT = 64
|
||||
};
|
||||
|
||||
enum ELightType
|
||||
{
|
||||
PointLight,
|
||||
|
|
Loading…
Reference in a new issue