View Issue Details

IDProjectCategoryView StatusLast Update
0005311The Dark ModGUIpublic30.07.2020 14:15
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Product VersionTDM 2.08 
Fixed in VersionTDM 2.09 
Summary0005311: Positive feedback highlight on lockpicking sometimes looks wrong
DescriptionWhen item is used appropriately, its icon is surrounded by green highlight.

It turned out this highlight is often wrong when applying lockpick successfully.
It can be yellow, overly bright, or just be fully opaque.

The problem happens very rarely.
But if it happens on some launch, then it seems to happen always until restart.
Steps To ReproduceTry to pick locks with proper lockpick.
Additional Informationhttps://forums.thedarkmod.com/index.php?/topic/20441-issues-in-208-final/
https://forums.thedarkmod.com/index.php?/topic/20291-beta-testing-208/&do=findComment&comment=450141
TagsNo tags attached.

Activities

stgatilov

stgatilov

30.07.2020 03:58

administrator   ~0012684

The highlight is generated by InventoryPositiveFeedback window in tdm_inv.gui:

        windowDef InventoryPositiveFeedback
        {
            rect 0, 10*S1, 110*S1, 100*S1
            background "guis/assets/hud/inventory_icons/inv_icon_overlay_positive"
            visible 1
            matcolor 1,1,1,0
            notime 1

            onTime 0 {
                transition "matcolor" "InventoryPositiveFeedback::matcolor" "1 1 1 0.7" "200";
            }

            onTime 200 {
                transition "matcolor" "1 1 1 0.7" "1 1 1 0" "500";
            }
        }

I have found in debug that its first transition has some garbage instead of InventoryPositiveFeedback::matcolor.
The same applies to negative feedback --- no idea why negative is not affected (maybe people just don't see it often).
stgatilov

stgatilov

30.07.2020 04:05

administrator   ~0012685

During game start, idWindow::Parse puts the transitions into timeLineEvents in with unparsed parms:

- parms [4] { {var=0x000001bbdcb387f0 {data="matcolor" } own=true }, {var=0x000001bbdcb389a0 {data="InventoryPositiveFeedback::matcolor" } own=true }, {var=0x000001bbdcb37290 {data="1 1 1 0.7" } own=true }, {var=0x000001bbdcb37dd0 {data="200" } own=true } } idList<idGSWinVar>
+ [0] {var=0x000001bbdcb387f0 {data="matcolor" } own=true } idGSWinVar
+ [1] {var=0x000001bbdcb389a0 {data="InventoryPositiveFeedback::matcolor" } own=true } idGSWinVar
+ [2] {var=0x000001bbdcb37290 {data="1 1 1 0.7" } own=true } idGSWinVar
+ [3] {var=0x000001bbdcb37dd0 {data="200" } own=true } idGSWinVar

Soon after that, idWindow::FixupParms is started, in turn calling idGuiScript::FixupParms.
It seems that in order to use variables in parameters, one has to prepend dollar:

        //
        // support variables as parameters
        int c;
        for ( c = 1; c < 3; c ++ ) {
            str = dynamic_cast<idWinStr*>(parms[c].var);

            idWinVec4 *v4 = new idWinVec4;
            parms[c].var = v4;
            parms[c].own = true;

            drawWin_t* owner;

            if ( (*str[0]) == '$' ) {
                dest = win->GetWinVarByName ( (const char*)(*str) + 1, true, &owner );
            } else {
                dest = NULL;
            }
stgatilov

stgatilov

30.07.2020 04:09

administrator   ~0012686

And the credit for missing dollar goes to greebo from 2009 =)
In other words, this bug has been present in TDM since lockpicking appeared.
stgatilov

stgatilov

30.07.2020 13:49

administrator   ~0012687

Fixed in svn rev 15983: added dollars to these two transitions.
stgatilov

stgatilov

30.07.2020 14:15

administrator   ~0012688

In order to avoid such problems in future, I committed a bunch of code changes too:
  r8902 Make sure all idWinVar objects are initialized with zeros. This should save us from similar reproducibility problems in future.
  r8903 + r8904 Hardening assignment of values to GUI variables. If we cannot parse value of appropriate type from the string in idWinVar::Set, complain with a warning.

Note that rev 8903 and 8904 can potentially break some incorrect GUI scripts.
On the other hand, now people will see warnings when they forget a dollar or "gui::".
The warnings looks like this:
  Wrong idWinVec4: "InventoryPositiveFeedback::matcolor"

Issue History

Date Modified Username Field Change
30.07.2020 03:56 stgatilov New Issue
30.07.2020 03:58 stgatilov Note Added: 0012684
30.07.2020 04:05 stgatilov Note Added: 0012685
30.07.2020 04:09 stgatilov Note Added: 0012686
30.07.2020 04:09 stgatilov Assigned To => stgatilov
30.07.2020 04:09 stgatilov Status new => assigned
30.07.2020 13:49 stgatilov Note Added: 0012687
30.07.2020 14:15 stgatilov Note Added: 0012688
30.07.2020 14:15 stgatilov Status assigned => resolved
30.07.2020 14:15 stgatilov Resolution open => fixed
30.07.2020 14:15 stgatilov Fixed in Version => TDM 2.09