View Issue Details

IDProjectCategoryView StatusLast Update
0000294Gameplay + OpenGL(No Category)public2017-02-19 11:15
ReporterMajor Cooke 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0000294: ListMenuItems cannot inherit from other items
DescriptionIf you try plugging this into zscript and then plugging it into menudef, it'll error saying it does not recognize it. If you try giving it the exact same init and initdirect functions, it'll give a bunch of 'cannot convert <x> to <y>' error.

This leaves little choice but to continuously copy/paste the ListMenuItemTextItem itself directly with only one rename, and perform everything else from there, introducing lots of code bloat.

OptionMenuItems on the other hand don't have this problem.

Class ListMenuItemTextItemBlink : ListMenuItemTextItem
{
    const moveFraction = 7;
    const initialDirection = 0.1;
    double glowAlpha;
    double glowDir;
    double widest;
    int activeTimer;
    bool triggered;
        
    //==========================================================================
    // The following are vastly modified from their originals.
    //==========================================================================
    
    override void Drawer(bool selected)
    {
        if (glowDir == 0.0)
        {
            glowAlpha = 1.0;
            glowDir = -initialDirection;
        }
        
        screen.DrawText(mFont, mColor, mXpos, mYpos, mText, DTA_Clean, true);
        
        if (selected)
        {
            glowAlpha += glowDir;
            if (glowAlpha >= 1.0 || glowAlpha <= 0.0)
            {
                glowDir = -glowDir;
                glowAlpha += glowDir;
            }
            screen.DrawText(mFont, mColorSelected, mXpos, mYpos, mText, DTA_Clean, true, DTA_Alpha, glowAlpha);
        
}
        else
        {
            glowAlpha = 1.0;
            glowDir = -initialDirection;
        }
    }
    
    //==========================================================================
    //
    //==========================================================================
    
    override bool Activate()
    {
        let tm = ListMenuScroller(Menu.GetCurrentMenu());
        if (tm)
        {
            tm.TriggerMovement();
            triggered = true;
            return true;
        }
        else
        {
            triggered = false;
            return false;
        }
    }
    
    override void Ticker()
    {
        if (triggered)
        {
            if (activeTimer < moveFraction)
                activeTimer++;
            else
            {
                triggered = false;
                activeTimer = 0;
                Menu.SetMenu(mAction, mParam);
            }
        }
        Super.Ticker();
    }
}
TagsNo tags attached.

Relationships

Activities

Major Cooke

Major Cooke

2017-02-18 19:33

reporter   ~0000652

...completely forgot to set the categories, whoops.
Graf Zahl

Graf Zahl

2017-02-19 02:51

administrator   ~0000653

Please post testable examples, not code fragments!
Major Cooke

Major Cooke

2017-02-19 06:21

reporter   ~0000654

Here. Download this file.

TestMenu.pk3 (521 bytes)

Issue History

Date Modified Username Field Change
2017-02-18 19:33 Major Cooke New Issue
2017-02-18 19:33 Major Cooke Note Added: 0000652
2017-02-19 02:51 Graf Zahl Note Added: 0000653
2017-02-19 06:21 Major Cooke File Added: TestMenu.pk3
2017-02-19 06:21 Major Cooke Note Added: 0000654
2017-02-19 11:15 Graf Zahl Status new => resolved
2017-02-19 11:15 Graf Zahl Resolution open => fixed