void MHIngredient::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHRoot::Initialise(p, engine);
    MHParseNode *pIA = p->GetNamedArg(C_INITIALLY_ACTIVE);

    if (pIA)
    {
        m_fInitiallyActive = pIA->GetArgN(0)->GetBoolValue();
    }

    MHParseNode *pCHook = p->GetNamedArg(C_CONTENT_HOOK);

    if (pCHook)
    {
        m_nContentHook = pCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pOrigContent = p->GetNamedArg(C_ORIGINAL_CONTENT);

    if (pOrigContent)
    {
        MHParseNode *pArg = pOrigContent->GetArgN(0);

        // Either a string - included content.
        if (pArg->m_nNodeType == MHParseNode::PNString)
        {
            m_ContentType = IN_IncludedContent;
            pArg->GetStringValue(m_OrigIncludedContent);
        }
        else   // or a sequence - referenced content.
        {
            // In the text version this is tagged with :ContentRef
            m_ContentType = IN_ReferencedContent;
            m_OrigContentRef.Initialise(pArg->GetArgN(0), engine);
            MHParseNode *pContentSize = pArg->GetNamedArg(C_CONTENT_SIZE);

            if (pContentSize)
            {
                m_nOrigContentSize = pContentSize->GetArgN(0)->GetIntValue();
            }

            MHParseNode *pCCPrio = pArg->GetNamedArg(C_CONTENT_CACHE_PRIORITY);

            if (pCCPrio)
            {
                m_nOrigCCPrio = pCCPrio->GetArgN(0)->GetIntValue();
            }
        }
    }

    MHParseNode *pShared = p->GetNamedArg(C_SHARED);

    if (pShared)
    {
        m_fShared = pShared->GetArgN(0)->GetBoolValue();
    }
}
Exemple #2
0
void MHContentRefVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be a content reference.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    // and this should be a ContentRef node.
    MHParseNode *pArg = pInitial->GetNamedArg(C_CONTENT_REFERENCE);
    m_OriginalValue.Initialise(pArg->GetArgN(0), engine);
}
Exemple #3
0
void MHObjectRefVar::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHVariable::Initialise(p, engine);
    // Original value should be an object reference.
    MHParseNode *pInitial = p->GetNamedArg(C_ORIGINAL_VALUE);
    // and this should be a ObjRef node.
    if (pInitial) {
        MHParseNode *pArg = pInitial->GetNamedArg(C_OBJECT_REFERENCE);
        if (pArg) m_OriginalValue.Initialise(pArg->GetArgN(0), engine);
    }
}
Exemple #4
0
void MHApplication::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHGroup::Initialise(p, engine);
    // OnSpawnCloseDown
    MHParseNode *pOnSpawn = p->GetNamedArg(C_ON_SPAWN_CLOSE_DOWN);

    if (pOnSpawn)
    {
        m_OnSpawnCloseDown.Initialise(pOnSpawn, engine);
    }

    // OnRestart
    MHParseNode *pOnRestart = p->GetNamedArg(C_ON_RESTART);

    if (pOnRestart)
    {
        m_OnRestart.Initialise(pOnRestart, engine);
    }

    // Default attributes.  These are encoded in a group in binary.
    MHParseNode *pDefattrs = p->GetNamedArg(C_DEFAULT_ATTRIBUTES);

    // but in the text form they're encoded in the Application block.
    if (pDefattrs == NULL)
    {
        pDefattrs = p;
    }

    MHParseNode *pCharSet = pDefattrs->GetNamedArg(C_CHARACTER_SET);

    if (pCharSet)
    {
        m_nCharSet = pCharSet->GetArgN(0)->GetIntValue();
    }

    // Colours
    MHParseNode *pBGColour = pDefattrs->GetNamedArg(C_BACKGROUND_COLOUR);

    if (pBGColour)
    {
        m_BGColour.Initialise(pBGColour->GetArgN(0), engine);
    }

    MHParseNode *pTextColour = pDefattrs->GetNamedArg(C_TEXT_COLOUR);

    if (pTextColour)
    {
        m_TextColour.Initialise(pTextColour->GetArgN(0), engine);
    }

    MHParseNode *pButtonRefColour = pDefattrs->GetNamedArg(C_BUTTON_REF_COLOUR);

    if (pButtonRefColour)
    {
        m_ButtonRefColour.Initialise(pButtonRefColour->GetArgN(0), engine);
    }

    MHParseNode *pHighlightRefColour = pDefattrs->GetNamedArg(C_HIGHLIGHT_REF_COLOUR);

    if (pHighlightRefColour)
    {
        m_HighlightRefColour.Initialise(pHighlightRefColour->GetArgN(0), engine);
    }

    MHParseNode *pSliderRefColour = pDefattrs->GetNamedArg(C_SLIDER_REF_COLOUR);

    if (pSliderRefColour)
    {
        m_SliderRefColour.Initialise(pSliderRefColour->GetArgN(0), engine);
    }

    // Content hooks
    MHParseNode *pTextCHook = pDefattrs->GetNamedArg(C_TEXT_CONTENT_HOOK);

    if (pTextCHook)
    {
        m_nTextCHook = pTextCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pIPCHook = pDefattrs->GetNamedArg(C_IP_CONTENT_HOOK);

    if (pIPCHook)
    {
        m_nIPCHook = pIPCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pStrCHook = pDefattrs->GetNamedArg(C_STREAM_CONTENT_HOOK);

    if (pStrCHook)
    {
        m_nStrCHook = pStrCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pBitmapCHook = pDefattrs->GetNamedArg(C_BITMAP_CONTENT_HOOK);

    if (pBitmapCHook)
    {
        m_nBitmapCHook = pBitmapCHook->GetArgN(0)->GetIntValue();
    }

    MHParseNode *pLineArtCHook = pDefattrs->GetNamedArg(C_LINE_ART_CONTENT_HOOK);

    if (pLineArtCHook)
    {
        m_nLineArtCHook = pLineArtCHook->GetArgN(0)->GetIntValue();
    }

    // Font.  This is a little tricky.  There are two attributes both called Font.
    // In the binary notation the font here is encoded as 42 whereas the text form
    // finds the first occurrence of :Font in the table and returns 13.
    MHParseNode *pFont = pDefattrs->GetNamedArg(C_FONT2);

    if (pFont == NULL)
    {
        pFont = pDefattrs->GetNamedArg(C_FONT);
    }

    if (pFont)
    {
        m_Font.Initialise(pFont->GetArgN(0), engine);
    }

    // Font attributes.
    MHParseNode *pFontAttrs = pDefattrs->GetNamedArg(C_FONT_ATTRIBUTES);

    if (pFontAttrs)
    {
        pFontAttrs->GetArgN(0)->GetStringValue(m_FontAttrs);
    }
}