0
0
Fork 0
mirror of https://github.com/ZDoom/gzdoom-gles.git synced 2025-02-27 21:51:00 +00:00

- tested and fixed the attachable lights.

# Conflicts:
#	src/g_shared/a_dynlight.cpp
This commit is contained in:
Christoph Oelckers 2019-07-07 09:50:02 +02:00 committed by drfrag
parent 0c4fc385cc
commit 26863bfd94
3 changed files with 23 additions and 5 deletions
src/g_shared
wadsrc/static/zscript/actors

View file

@ -791,6 +791,12 @@ void AActor::SetDynamicLights()
unsigned int count = 0; unsigned int count = 0;
if (state == NULL) return; if (state == NULL) return;
for (const auto def : UserLights)
{
AttachLight(count++, def);
}
if (LightAssociations.Size() > 0) if (LightAssociations.Size() > 0)
{ {
unsigned int i; unsigned int i;
@ -871,7 +877,7 @@ int AttachLightDef(AActor *self, int _lightid, int _lightname)
// Todo: Optimize. This may be too slow. // Todo: Optimize. This may be too slow.
auto lightdef = LightDefaults.FindEx([=](const auto &a) { auto lightdef = LightDefaults.FindEx([=](const auto &a) {
return a->GetName() == lightid; return a->GetName() == lightname;
}); });
if (lightdef < LightDefaults.Size()) if (lightdef < LightDefaults.Size())
{ {
@ -907,7 +913,7 @@ int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radiu
userlight->SetArg(LIGHT_INTENSITY, radius1); userlight->SetArg(LIGHT_INTENSITY, radius1);
userlight->SetArg(LIGHT_SECONDARY_INTENSITY, radius2); userlight->SetArg(LIGHT_SECONDARY_INTENSITY, radius2);
userlight->SetFlags(LightFlags::FromInt(flags)); 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->SetOffset(of);
userlight->SetParameter(type == PulseLight? param*TICRATE : param*360.); userlight->SetParameter(type == PulseLight? param*TICRATE : param*360.);
userlight->SetSpotInnerAngle(spoti); userlight->SetSpotInnerAngle(spoti);

View file

@ -1158,9 +1158,9 @@ class Actor : Thinker native
action native void A_OverlayAlpha(int layer, double alph); action native void A_OverlayAlpha(int layer, double alph);
action native void A_OverlayRenderStyle(int layer, int style); action native void A_OverlayRenderStyle(int layer, int style);
action native bool A_AttachLightDef(Name lightid, Name lightdef); 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); 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);
action mative bool A_RemoveLight(Name lightid); native bool A_RemoveLight(Name lightid);
int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0) int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0)
{ {

View file

@ -26,6 +26,18 @@ class DynamicLight : Actor
LIGHT_SCALE = 3, 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 enum ELightType
{ {
PointLight, PointLight,