Esempio n. 1
0
bool MGEFRecord::VisitFormIDs(FormIDOp &op)
    {
    if(!IsLoaded())
        return false;

    if(OBME.IsLoaded())
        {
        //Conditional resolution of mgefCode's based on JRoush's OBME mod
        //It's resolved just like a formID, except it uses the lower byte instead of the upper
        if(*(MGEFCODE *)&OBME->EDDX.value.mgefCode[0] >= 0x80000000)
            {
            MGEFCODE tempMgef = *(MGEFCODE *)&OBME->EDDX.value.mgefCode[0];
            op.AcceptMGEF(tempMgef);
            memcpy(&OBME->EDDX.value.mgefCode[0], &tempMgef, sizeof(OBME->EDDX.value.mgefCode) - 1);
            OBME->EDDX.value.mgefCode[4] = 0;
            }

        if(OBME->OBME.IsLoaded())
            {
            switch(OBME->OBME.value.mgefParamAInfo)
                {
                case 1: //It's a regular formID, so nothing fancy.
                    op.Accept(DATA.value.associated);
                    break;
                case 2: //It's a mgefCode, and not a formID at all.
                    //Conditional resolution of mgefCode's based on JRoush's OBME mod
                    //It's resolved just like a formID, except it uses the lower byte instead of the upper
                    if(DATA.value.associated >= 0x80000000)
                        op.AcceptMGEF(DATA.value.associated);
                    break;
                case 3: //It's an actor value, and not a formID at all.
                    //Conditional resolution of av's based on JRoush's OBME/AV mod(s)
                    //It's resolved just like a formID
                    if(DATA.value.associated >= 0x800)
                        op.Accept(DATA.value.associated);
                    break;
                default: //It's not a formID, mgefCode, or fancied up actor value
                    //so do nothing
                    break;
                }
            switch(OBME->OBME.value.mgefParamBInfo)
                {
                case 1: //It's a regular formID, so nothing fancy.
                    op.Accept(OBME->OBME.value.mgefParamB);
                    break;
                case 2: //It's a mgefCode, and not a formID at all.
                    //Conditional resolution of mgefCode's based on JRoush's OBME mod
                    //It's resolved just like a formID, except it uses the lower byte instead of the upper
                    if(OBME->OBME.value.mgefParamB >= 0x80000000)
                        op.AcceptMGEF(OBME->OBME.value.mgefParamB);
                    break;
                case 3: //It's an actor value, and not a formID at all.
                    //Conditional resolution of av's based on JRoush's OBME/AV mod(s)
                    //It's resolved just like a formID
                    if(OBME->OBME.value.mgefParamB >= 0x800)
                        op.Accept(OBME->OBME.value.mgefParamB);
                    break;
                default: //It's not a formID, mgefCode, or fancied up actor value
                    //so do nothing
                    break;
                }
            }

        op.Accept(DATA.value.light);
        op.Accept(DATA.value.effectShader);
        op.Accept(DATA.value.enchantEffect);
        op.Accept(DATA.value.castingSound);
        op.Accept(DATA.value.boltSound);
        op.Accept(DATA.value.hitSound);
        op.Accept(DATA.value.areaSound);

        if(DATA.value.resistValue >= 0x800)
            op.Accept(DATA.value.resistValue);

        for(UINT32 ListIndex = 0; ListIndex < ESCE.value.size(); ++ListIndex)
            if(ESCE.value[ListIndex] >= 0x80000000)
                op.AcceptMGEF(ESCE.value[ListIndex]);
        }
    else
        {
        op.Accept(DATA.value.associated);
        op.Accept(DATA.value.light);
        op.Accept(DATA.value.effectShader);
        op.Accept(DATA.value.enchantEffect);
        op.Accept(DATA.value.castingSound);
        op.Accept(DATA.value.boltSound);
        op.Accept(DATA.value.hitSound);
        op.Accept(DATA.value.areaSound);
        }

    return op.Stop();
    }