Пример #1
0
        public int FillInSubKeywords(ref Reader reader, LinkedList <KeyWord> keywords, int thisIndex)
        {
            isFunction = true;
            int keywordsRead = 1;

            switch (FunctionType)
            {
            case InputFunctions.FunctionType.Not:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[0].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                break;

            case InputFunctions.FunctionType.And:
            case InputFunctions.FunctionType.Or:
                subkeywords    = new KeyWord[2];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[0].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[1].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                break;

            case InputFunctions.FunctionType.KeyPressed:
            case InputFunctions.FunctionType.KeyReleased:
            case InputFunctions.FunctionType.KeyJustPressed:
            case InputFunctions.FunctionType.KeyJustReleased:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.Sequence:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                int sequenceLength = subkeywords[0].indexOrKeyCode;

                if (sequenceLength > 0)
                {
                    Array.Resize(ref subkeywords, sequenceLength + 1);
                    for (int i = 0; i < sequenceLength; i++)
                    {
                        subkeywords[1 + i] = keywords[thisIndex + keywordsRead];
                        keywordsRead      += subkeywords[1 + i].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                    }
                }
                break;

            case InputFunctions.FunctionType.SequenceKey:
            case InputFunctions.FunctionType.SequenceKeyEnd:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];     // Keycode
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.SequencePad:
            case InputFunctions.FunctionType.SequencePadEnd:
                if (Settings.s.game == Settings.Game.LargoWinch)
                {
                    subkeywords    = new KeyWord[3];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];     // 0
                    keywordsRead  += 1;
                    subkeywords[2] = keywords[thisIndex + keywordsRead];     // Keycode
                    keywordsRead  += 1;
                }
                else
                {
                    subkeywords    = new KeyWord[2];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];     // 0
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];     // Keycode
                    keywordsRead  += 1;
                }
                break;

            case InputFunctions.FunctionType.MouseAxeValue:
            case InputFunctions.FunctionType.MouseAxePosition:
                subkeywords    = new KeyWord[3];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[2] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.MousePressed:
            case InputFunctions.FunctionType.MouseJustPressed:
            case InputFunctions.FunctionType.MouseJustReleased:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.PadPressed:
            case InputFunctions.FunctionType.PadReleased:
            case InputFunctions.FunctionType.PadJustPressed:
            case InputFunctions.FunctionType.PadJustReleased:
            case InputFunctions.FunctionType.JoystickPressed:
            case InputFunctions.FunctionType.JoystickReleased:
            case InputFunctions.FunctionType.JoystickJustPressed:
            case InputFunctions.FunctionType.JoystickJustReleased:
            case InputFunctions.FunctionType.JoystickOrPadPressed:
            case InputFunctions.FunctionType.JoystickOrPadReleased:
            case InputFunctions.FunctionType.JoystickOrPadJustPressed:
            case InputFunctions.FunctionType.JoystickOrPadJustReleased:
                if (Settings.s.game == Settings.Game.LargoWinch)
                {
                    subkeywords    = new KeyWord[3];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[2] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                }
                else
                {
                    subkeywords    = new KeyWord[2];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                }
                break;

            case InputFunctions.FunctionType.JoystickAxeValue:
                if (Settings.s.game == Settings.Game.LargoWinch)
                {
                    subkeywords    = new KeyWord[5];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[2] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[3] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[4] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                }
                else
                {
                    subkeywords    = new KeyWord[4];
                    subkeywords[0] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[1] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[2] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                    subkeywords[3] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += 1;
                }
                break;

            case InputFunctions.FunctionType.JoystickAngularValue:
            case InputFunctions.FunctionType.JoystickTrueNormValue:
            case InputFunctions.FunctionType.JoystickCorrectedNormValue:
                subkeywords    = new KeyWord[5];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[2] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[3] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[4] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.ActionValidated:
            case InputFunctions.FunctionType.ActionInvalidated:
            case InputFunctions.FunctionType.ActionJustValidated:
            case InputFunctions.FunctionType.ActionJustInvalidated:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                if (subkeywords[0] != null && Settings.s.game == Settings.Game.TT)
                {
                    EntryAction.FromOffsetOrRead(subkeywords[0].valueAsPointer, reader);
                }
                keywordsRead += 1;
                break;
            }
            return(keywordsRead);
        }
Пример #2
0
        public int FillInSubKeywords(ref Reader reader, LinkedList <KeyWord> keywords, int thisIndex)
        {
            isFunction = true;
            int keywordsRead = 1;

            switch (FunctionType)
            {
            case InputFunctions.FunctionType.Not:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[0].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                break;

            case InputFunctions.FunctionType.And:
            case InputFunctions.FunctionType.Or:
                subkeywords    = new KeyWord[2];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[0].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += subkeywords[1].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                break;

            case InputFunctions.FunctionType.KeyPressed:
            case InputFunctions.FunctionType.KeyReleased:
            case InputFunctions.FunctionType.KeyJustPressed:
            case InputFunctions.FunctionType.KeyJustReleased:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.Sequence:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                int sequenceLength = subkeywords[0].indexOrKeyCode;
                if (sequenceLength > 0)
                {
                    Array.Resize(ref subkeywords, sequenceLength * 2 + 2);
                    subkeywords[1] = keywords[thisIndex + keywordsRead];
                    keywordsRead  += subkeywords[1].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                    for (int i = 0; i < sequenceLength; i++)
                    {
                        subkeywords[2 + i * 2] = keywords[thisIndex + keywordsRead];     // Keycode
                        keywordsRead          += 1;
                        if (i < sequenceLength - 1)
                        {
                            subkeywords[3 + i * 2] = keywords[thisIndex + keywordsRead];     // SequenceKey
                            keywordsRead          += subkeywords[3 + i * 2].FillInSubKeywords(ref reader, keywords, thisIndex + keywordsRead);
                        }
                    }
                }
                break;

            case InputFunctions.FunctionType.JoystickPressed:
            case InputFunctions.FunctionType.JoystickReleased:
            case InputFunctions.FunctionType.JoystickJustPressed:
            case InputFunctions.FunctionType.JoystickJustReleased:
            case InputFunctions.FunctionType.JoystickOrPadPressed:
            case InputFunctions.FunctionType.JoystickOrPadReleased:
            case InputFunctions.FunctionType.JoystickOrPadJustPressed:
            case InputFunctions.FunctionType.JoystickOrPadJustReleased:
                subkeywords    = new KeyWord[2];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.JoystickAxeValue:
                subkeywords    = new KeyWord[4];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[1] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[2] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                subkeywords[3] = keywords[thisIndex + keywordsRead];
                keywordsRead  += 1;
                break;

            case InputFunctions.FunctionType.ActionValidated:
            case InputFunctions.FunctionType.ActionInvalidated:
            case InputFunctions.FunctionType.ActionJustValidated:
            case InputFunctions.FunctionType.ActionJustInvalidated:
                subkeywords    = new KeyWord[1];
                subkeywords[0] = keywords[thisIndex + keywordsRead];
                if (subkeywords[0] != null && Settings.s.game == Settings.Game.TT)
                {
                    EntryAction.FromOffsetOrRead(subkeywords[0].valueAsPointer, reader);
                }
                keywordsRead += 1;
                break;
            }
            return(keywordsRead);
        }