View Issue Details

IDProjectCategoryView StatusLast Update
0004213The Dark ModScript/Defpublic04.01.2016 19:21
ReporterVanishedOne Assigned ToSteveL  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.03 
Target VersionTDM 2.05Fixed in VersionTDM 2.05 
Summary0004213: "ambient_light" "0 0 0" doesn't work on info_location
DescriptionIf the ambient_light spawnarg on an info_location is zero, the global ambient will be used instead, to the mapper's likely surprise. (The obvious workaround is to set the ambient very low but not zero.)

It's because of the way nonexistent/unset keys are handled (quoting from script/tdm_location_settings.script):

// fade to the new location's color
    m_al_base_target = locEnt.getVectorKey("ambient_light");
// tels: can this be done simpler? == "0,0,0" doesn't work, tho
    if (m_al_base_target_x == 0 && m_al_base_target_y == 0 && m_al_base_target_z == 0)
    {
        // no value found, use the default
        // sys.print( "No new target, using default color '" + m_al_default_color + "'\n");
        m_al_base_target = m_al_default_color;
    }


Possible fix:

// fade to the new location's color
    m_al_base_target = locEnt.getVectorKey("ambient_light");
    if (locEnt.getKey("ambient_light") == "") m_al_base_target = m_al_default_color;
TagsNo tags attached.
Attached Files
amb.map (9,696 bytes)

Activities

SteveL

SteveL

13.09.2015 20:50

reporter   ~0007768

Good spot. For ease of reading I'd probably reword it to:

if ( locEnt.getKey("ambient_light") != "" )
{
   m_al_base_target = locEnt.getVectorKey("ambient_light");
}
else
{
   m_al_base_target = m_al_default_color;
}
tels

tels

25.09.2015 11:58

reporter   ~0007799

Sorry about that bug.

IIRC correctly, the way to compare a vector is:

if (m_al_base_target == '0,0,0') { ... }

(not "0,0,0", but '0,0,0') which I simply didn't know back then.

 The case of a non-existant key vs. 0,0,0 of course would still be present.
SteveL

SteveL

30.09.2015 19:00

reporter   ~0007816

Fantastic test map! Thanks, if every bug report came this well-equipped we'd churn through 50 a day :)

committed at rev 14396

script\tdm_location_settings.script

Issue History

Date Modified Username Field Change
10.09.2015 19:53 VanishedOne New Issue
10.09.2015 19:53 VanishedOne File Added: amb.map
10.09.2015 19:55 VanishedOne Description Updated
13.09.2015 20:40 SteveL Assigned To => SteveL
13.09.2015 20:40 SteveL Status new => assigned
13.09.2015 20:50 SteveL Note Added: 0007768
25.09.2015 11:58 tels Note Added: 0007799
30.09.2015 19:00 SteveL Note Added: 0007816
30.09.2015 19:00 SteveL Status assigned => resolved
30.09.2015 19:00 SteveL Resolution open => fixed
30.09.2015 19:00 SteveL Fixed in Version => TDM 2.04
30.09.2015 19:00 SteveL Target Version => TDM 2.04
04.01.2016 19:21 grayman Fixed in Version TDM 2.04 => TDM 2.05
04.01.2016 19:21 grayman Target Version TDM 2.04 => TDM 2.05