Utilize dynamiclight_spawnstatic on csaddon and fixes a problem with spawning lights on x64 builds (#293)

* Fixed first 32 lights not working on csaddon on 64 bits builds

* Added a comment back...

* fix the fix for the comment. I love Git

* double check that the new selectedlight is not the same as the old selectedlight (oldl) just in case.
This commit is contained in:
Yo Soy Freeman 2024-11-08 13:03:28 +01:00 committed by GitHub
parent b0e74e893c
commit 4b943f9a9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -383,14 +383,13 @@ float(float keyc, float unic, vector m) editor_lights_key =
} }
else if (unic == 'i' || unic == 'I') else if (unic == 'i' || unic == 'I')
{ {
traceline(o, t, TRUE, world);
float oldl = selectedlight; float oldl = selectedlight;
for (selectedlight = 32; ; selectedlight+=1) selectedlight = dynamiclight_spawnstatic(trace_endpos + trace_plane_normal*4f, 300, '1 1 1');
if ((float)dynamiclight_get(oldl, LFIELD_RADIUS) != 0f && oldl != selectedlight)
{ {
if (!(float)dynamiclight_get(selectedlight, LFIELD_RADIUS)) //dupe the current light
{
if (oldl >= 32 && (!((float)dynamiclight_get(selectedlight, LFIELD_RADIUS) > 50)))
{
/*dupe the current light*/
dynamiclight_set(selectedlight, LFIELD_RADIUS, dynamiclight_get(oldl, LFIELD_RADIUS)); dynamiclight_set(selectedlight, LFIELD_RADIUS, dynamiclight_get(oldl, LFIELD_RADIUS));
dynamiclight_set(selectedlight, LFIELD_COLOUR, dynamiclight_get(oldl, LFIELD_COLOUR)); dynamiclight_set(selectedlight, LFIELD_COLOUR, dynamiclight_get(oldl, LFIELD_COLOUR));
dynamiclight_set(selectedlight, LFIELD_FOV, dynamiclight_get(oldl, LFIELD_FOV)); dynamiclight_set(selectedlight, LFIELD_FOV, dynamiclight_get(oldl, LFIELD_FOV));
@ -404,8 +403,7 @@ float(float keyc, float unic, vector m) editor_lights_key =
dynamiclight_set(selectedlight, LFIELD_CORONA, dynamiclight_get(oldl, LFIELD_CORONA)); dynamiclight_set(selectedlight, LFIELD_CORONA, dynamiclight_get(oldl, LFIELD_CORONA));
dynamiclight_set(selectedlight, LFIELD_CORONASCALE, dynamiclight_get(oldl, LFIELD_CORONASCALE)); dynamiclight_set(selectedlight, LFIELD_CORONASCALE, dynamiclight_get(oldl, LFIELD_CORONASCALE));
dynamiclight_set(selectedlight, LFIELD_ROTATION, dynamiclight_get(oldl, LFIELD_ROTATION)); dynamiclight_set(selectedlight, LFIELD_ROTATION, dynamiclight_get(oldl, LFIELD_ROTATION));
} }else
else
{ {
/*reset the light's properties*/ /*reset the light's properties*/
dynamiclight_set(selectedlight, LFIELD_RADIUS, 300); dynamiclight_set(selectedlight, LFIELD_RADIUS, 300);
@ -422,13 +420,6 @@ float(float keyc, float unic, vector m) editor_lights_key =
dynamiclight_set(selectedlight, LFIELD_CORONASCALE, 1); dynamiclight_set(selectedlight, LFIELD_CORONASCALE, 1);
dynamiclight_set(selectedlight, LFIELD_ROTATION, '0 0 0'); dynamiclight_set(selectedlight, LFIELD_ROTATION, '0 0 0');
} }
/*place it at the pointed location*/
traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, trace_endpos + trace_plane_normal*4f);
break;
}
}
} }
else if (unic == '[') else if (unic == '[')
{ {