mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-01-24 16:51:08 +00:00
If arg0str is used for a spotlight's color, convert that string to an int and pass that value as the light color. UDB's color picker interface uses the arg0str field for spotlight color.
This commit is contained in:
parent
bfb23302ef
commit
a0935ba604
3 changed files with 23 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "framework/tarray.h"
|
#include "framework/tarray.h"
|
||||||
#include "framework/templates.h"
|
#include "framework/templates.h"
|
||||||
|
#include "framework/zstring.h"
|
||||||
#include "math/mathlib.h"
|
#include "math/mathlib.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -237,6 +238,7 @@ struct IntThing
|
||||||
short flags;
|
short flags;
|
||||||
int special;
|
int special;
|
||||||
int args[5];
|
int args[5];
|
||||||
|
FString arg0str;
|
||||||
|
|
||||||
short pitch; // UDMF
|
short pitch; // UDMF
|
||||||
float height; // UDMF
|
float height; // UDMF
|
||||||
|
|
|
@ -116,6 +116,15 @@ void FLevel::SetupLights()
|
||||||
|
|
||||||
// sun color
|
// sun color
|
||||||
lightcolor = thing->args[0];
|
lightcolor = thing->args[0];
|
||||||
|
/*
|
||||||
|
// disabled for now, because I'm unsure if UDB will use the color picker interface for the sun color
|
||||||
|
if (thing->arg0str.Len() > 0)
|
||||||
|
{
|
||||||
|
FString hex = "0x" + thing->arg0str;
|
||||||
|
int rgb = hex.ToULong();
|
||||||
|
lightcolor = (uint32_t)rgb;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// sample distance
|
// sample distance
|
||||||
Samples = thing->args[1];
|
Samples = thing->args[1];
|
||||||
|
@ -306,8 +315,14 @@ void FLevel::CreateLights()
|
||||||
{
|
{
|
||||||
lightcolor = (uint32_t)thing->args[0];
|
lightcolor = (uint32_t)thing->args[0];
|
||||||
|
|
||||||
// to do: UDB's color picker will assign the color as a hex string, stored
|
// UDB's color picker will assign the color as a hex string, stored
|
||||||
// in the arg0str field. detect this, so that it can be converted into an int
|
// in the arg0str field. detect this, so that it can be converted into an int
|
||||||
|
if (thing->arg0str.Len() > 0)
|
||||||
|
{
|
||||||
|
FString hex = "0x" + thing->arg0str;
|
||||||
|
int rgb = hex.ToULong();
|
||||||
|
lightcolor = (uint32_t)rgb;
|
||||||
|
}
|
||||||
|
|
||||||
innerAngleCos = std::cos((float)thing->args[1] * 3.14159265359f / 180.0f);
|
innerAngleCos = std::cos((float)thing->args[1] * 3.14159265359f / 180.0f);
|
||||||
outerAngleCos = std::cos((float)thing->args[2] * 3.14159265359f / 180.0f);
|
outerAngleCos = std::cos((float)thing->args[2] * 3.14159265359f / 180.0f);
|
||||||
|
|
|
@ -224,6 +224,11 @@ void FProcessor::ParseThing(IntThing *th)
|
||||||
{
|
{
|
||||||
th->alpha = CheckFloat(key);
|
th->alpha = CheckFloat(key);
|
||||||
}
|
}
|
||||||
|
if (!stricmp(key, "arg0str"))
|
||||||
|
{
|
||||||
|
th->arg0str = value;
|
||||||
|
th->arg0str.StripChars("\"");
|
||||||
|
}
|
||||||
|
|
||||||
// now store the key in its unprocessed form
|
// now store the key in its unprocessed form
|
||||||
UDMFKey k = {key, value};
|
UDMFKey k = {key, value};
|
||||||
|
|
Loading…
Reference in a new issue