Exemplo n.º 1
0
        private void TestAddEnvelope()
        {
            int hr;

            MPEnvelopeSegment [] pSeg = new MPEnvelopeSegment[2];
            MPData mp1 = new MPData();
            MPData mp2 = new MPData();

            mp1.vFloat = 40;
            mp2.vFloat = 60;

            pSeg[0].flags    = MPFlags.Standard;
            pSeg[0].iCurve   = MPCaps.Jump;
            pSeg[0].rtStart  = 0;
            pSeg[0].rtEnd    = 1000000;
            pSeg[0].valStart = mp1;
            pSeg[0].valEnd   = mp2;

            pSeg[1].flags    = MPFlags.Standard;
            pSeg[1].iCurve   = MPCaps.Jump;
            pSeg[1].rtStart  = 1000001;
            pSeg[1].rtEnd    = 2000000;
            pSeg[1].valStart = mp2;
            pSeg[1].valEnd   = mp1;

            hr = m_imp.AddEnvelope(0, 2, pSeg);
            DMOError.ThrowExceptionForHR(hr);
        }
 private static void HandleTiebreakerRolled(MPData data)
 {
     if (data is not TiebreakerRolled rolled)
     {
         return;
     }
     // If another player in our party has rolled a tiebreaker die
     if (GameData.Instance.celestenetIDs.Contains(rolled.ID) && rolled.ID != MultiplayerSingleton.Instance.GetPlayerID())
     {
         if (Engine.Scene is not Level level)
         {
             return;
         }
         foreach (LeftButton button in level.Entities.FindAll <LeftButton>())
         {
             // Find a close button
             if ((button.Position - rolled.ButtonPosition).LengthSquared() < 1)
             {
                 button.SetCurrentMode(LeftButton.Modes.Inactive);
                 level.Entities.FindFirst <TiebreakerController>()?.RollDice(rolled.ButtonPosition, GameData.Instance.playerSelectTriggers[rolled.ID]);
                 return;
             }
         }
     }
 }
Exemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////////////
        // Construction and Initializing methods                                     //
        ///////////////////////////////////////////////////////////////////////////////
        #region CONSTRUCTION

        /// <summary>
        /// Initializes a new instance of the MPEnvelopes class.
        /// </summary>
        /// <param name="newDefaultValue">An <see cref="MPData"/> with the default value</param>
        /// <param name="newValidCaps">The valid capabilities</param>
        /// <param name="newMPType">The <see cref="MPType"/> of the envelope.</param>
        /// <param name="newMinValue">The <see cref="MPData"/> with the minimal value for the envelope.</param>
        /// <param name="newMaxValue">The <see cref="MPData"/> with the maximal value for the envelope.</param>
        public MPEnvelopes(
            MPData newDefaultValue,
            MPCaps newValidCaps,
            MPType newMPType,
            MPData newMinValue,
            MPData newMaxValue)
        {
            // Store the neutralValue, min/max value range, data type and supported curve types
            this.defaultValue = newDefaultValue;
            this.validCaps    = (int)newValidCaps;
            this.dataType     = newMPType;
            this.minValue     = newMinValue;
            this.maxValue     = newMaxValue;

            // Create an array to hold the segments (size = 3 was chosen arbitrarily)
            this.envelope = new ArrayList(3);

            // Create one segment that spans all time containing the default values
            MPEnvelopeSegment e = new MPEnvelopeSegment();

            e.flags    = MPFlags.BeginNeutralVal;
            e.iCurve   = MPCaps.Jump;
            e.rtStart  = 0;
            e.rtEnd    = MaxTime;
            e.valStart = this.defaultValue;
            e.valEnd   = this.defaultValue;

            this.envelope.Add(e);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the parameter connection for the gaze and mouse location
        /// properties of the dmo filter.
        /// </summary>
        /// <param name="dmoWrapperFilter">
        /// The <see cref="IBaseFilter"/> interface
        /// of the dmo wrapper filter.
        /// </param>
        private void SetDMOParams(IBaseFilter dmoWrapperFilter)
        {
            if (dmoWrapperFilter == null)
            {
                return;
            }

            int hr;

            this.dmoParams = dmoWrapperFilter as IMediaParams;

            this.gazeX      = new MPData();
            this.gazeX.vInt = 0;
            hr = this.dmoParams.SetParam(0, this.gazeX);
            DMOError.ThrowExceptionForHR(hr);

            this.gazeY      = new MPData();
            this.gazeY.vInt = 0;
            hr = this.dmoParams.SetParam(1, this.gazeY);
            DMOError.ThrowExceptionForHR(hr);

            this.mouseX      = new MPData();
            this.mouseX.vInt = 0;
            hr = this.dmoParams.SetParam(2, this.mouseX);
            DMOError.ThrowExceptionForHR(hr);

            this.mouseY      = new MPData();
            this.mouseY.vInt = 0;
            hr = this.dmoParams.SetParam(3, this.mouseY);
            DMOError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 5
0
 private void HandlePlayerChoice(MPData data)
 {
     if (data is not PlayerChoice playerChoice)
     {
         return;
     }
     // If another player in our party has changed the turn count
     if (GameData.Instance.celestenetIDs.Contains(playerChoice.ID) && playerChoice.ID != MultiplayerSingleton.Instance.GetPlayerID() && playerChoice.choiceType.Equals("GOBUTTON"))
     {
         OnDashed(SceneAs <Level>().Tracker.GetEntity <Player>(), default);
     }
 }
 private void HandleMinigameStatus(MPData data)
 {
     if (data is not MinigameStatus status)
     {
         return;
     }
     // If another player in our party is sending out a minigame status update
     if (GameData.Instance.celestenetIDs.Contains(status.ID) && status.ID != MultiplayerSingleton.Instance.GetPlayerID())
     {
         GameData.Instance.minigameStatus[GameData.Instance.playerSelectTriggers[status.ID]] = status.results;
         Logger.Log("MadelineParty", "Player " + status.DisplayName + " has updated their minigame status with a result of " + status.results);
     }
 }
Exemplo n.º 7
0
 private void HandlePlayerChoice(MPData data)
 {
     if (data is not PlayerChoice playerChoice)
     {
         return;
     }
     // If another player in our party has changed the turn count
     if (GameData.Instance.celestenetIDs.Contains(playerChoice.ID) && playerChoice.ID != MultiplayerSingleton.Instance.GetPlayerID() && playerChoice.choiceType.Equals("TURNCOUNTSELECT"))
     {
         valueIdx = playerChoice.choice;
         GameData.Instance.maxTurns = Value;
     }
 }
 private void HandleMinigameEnd(MPData data)
 {
     if (data is not MinigameEnd end)
     {
         return;
     }
     // If another player in our party has beaten a minigame
     if (GameData.Instance.celestenetIDs.Contains(end.ID) && end.ID != MultiplayerSingleton.Instance.GetPlayerID())
     {
         GameData.Instance.minigameResults.Add(new Tuple <int, uint>(GameData.Instance.playerSelectTriggers[end.ID], end.results));
         Logger.Log("MadelineParty", "Player " + end.DisplayName + " has finished the minigame with a result of " + end.results);
     }
 }
 private void HandleRandomSeed(MPData data)
 {
     if (data is not RandomSeed seed)
     {
         return;
     }
     // If another player in our party is distributing the randomization seeds
     if (GameData.Instance.celestenetIDs.Contains(seed.ID) && seed.ID != MultiplayerSingleton.Instance.GetPlayerID())
     {
         GameData.Instance.turnOrderSeed  = seed.turnOrderSeed;
         GameData.Instance.tieBreakerSeed = seed.tieBreakerSeed;
         BoardController.generateTurnOrderRolls();
     }
 }
Exemplo n.º 10
0
        private void TestParam()
        {
            int    hr;
            MPData pData = new MPData();

            pData.vFloat = 51;

            hr = m_imp.SetParam(0, pData);
            DMOError.ThrowExceptionForHR(hr);

            hr = m_imp.GetParam(0, out pData);
            DMOError.ThrowExceptionForHR(hr);

            Debug.Assert(pData.vFloat == 51, "GetParam");
        }
Exemplo n.º 11
0
        void DMOBoolParam_CheckedChanged(object sender, EventArgs e)
        {
            MPData val = new MPData();

            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                val.vBool = Checked;
            }
            else
            {
                val.vFloat = Checked ? 1f : 0f;
            }

            _param.SetParam(_paramNum, val);
        }
Exemplo n.º 12
0
 private static void HandleMinigameVector2(MPData data)
 {
     if (data is not MinigameVector2 vector2)
     {
         return;
     }
     // If another player in our party is sending out minigame vector2 data
     if (GameData.Instance.celestenetIDs.Contains(vector2.ID) && vector2.ID != MultiplayerSingleton.Instance.GetPlayerID())
     {
         MinigameEntity mge;
         if ((mge = Engine.Scene?.Tracker.GetEntity <MinigameEntity>()) != null)
         {
             mge.MultiplayerReceiveVector2(vector2.vec, vector2.extra);
         }
     }
 }
Exemplo n.º 13
0
        void DMOEnumParam_SelectedIndexChanged(object sender, EventArgs e)
        {
            MPData val = new MPData();

            if (_pInfo.mopCaps == MPCaps.Jump)
            {
                val.vInt = SelectedIndex;
            }
            else
            {
                if (SelectedIndex == 0)
                {
                    val.vFloat = 0f;
                }
                else
                {
                    val.vFloat = (float)SelectedIndex / (float)(Items.Count - 1);
                }
            }
            _param.SetParam(_paramNum, val);
        }
Exemplo n.º 14
0
        void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            if (!colorTrackBar1.Tracking)
            {
                colorTrackBar1.Value = (int)((((0 - numericUpDown1.Minimum) + numericUpDown1.Value) / ((0 - numericUpDown1.Minimum) + numericUpDown1.Maximum)) * 1000);
            }

            if (_initialzed)
            {
                // only set the value if the control is fully inititalized
                MPData val = new MPData();
                if (_pInfo.mopCaps == MPCaps.Jump)
                {
                    val.vInt = (int)numericUpDown1.Value;
                }
                else
                {
                    val.vFloat = (float)numericUpDown1.Value;
                }
                _param.SetParam(_paramNum, val);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// See if the specified parameter value falls within the allowable range
        /// </summary>
        /// <param name="m">Value to check</param>
        /// <returns>true if the parameter value is valid</returns>
        private bool CheckRange(MPData m)
        {
            bool returnValue;

            switch (this.dataType)
            {
            case MPType.BOOL:
            case MPType.ENUM:
            case MPType.INT:
                returnValue = m.vInt >= this.minValue.vInt && m.vInt <= this.maxValue.vInt;
                break;

            case MPType.FLOAT:
                returnValue = m.vFloat >= this.minValue.vFloat && m.vFloat <= this.maxValue.vFloat;
                break;

            default:
                Debug.Assert(false, "Invalid Type");
                returnValue = false;
                break;
            }

            return(returnValue);
        }
Exemplo n.º 16
0
 public void Initialize(MPData args) => data = args as Party;
Exemplo n.º 17
0
        /// <summary>
        /// Given output buffers, process the input buffers into the output buffers.
        /// </summary>
        /// <param name="flags">A <see cref="DMOProcessOutput"/> Flags</param>
        /// <param name="outputBufferCount">Number of buffers (will be one per output stream)</param>
        /// <param name="outputBufferPointers">The buffers</param>
        /// <param name="pdwStatus">Reserved: 0</param>
        /// <returns>S_FALSE if there is no output, S_OK otherwise</returns>
        protected override int InternalProcessOutput(
            DMOProcessOutput flags,
            int outputBufferCount,
            [In, Out] DMOOutputDataBuffer[] outputBufferPointers,
            out int pdwStatus)
        {
            // Check buffer
            IntPtr outputPointer;
            int    outputByteCount;
            int    currentByteCount;
            int    hr = SOK;

            pdwStatus = 0;

            // No input buffers to process
            if (this.buffer != null)
            {
                if (outputBufferPointers[0].pBuffer != null)
                {
                    // Get a pointer to the output buffer
                    hr = outputBufferPointers[0].pBuffer.GetBufferAndLength(out outputPointer, out currentByteCount);
                    if (hr >= 0)
                    {
                        hr = outputBufferPointers[0].pBuffer.GetMaxLength(out outputByteCount);
                        if (hr >= 0)
                        {
                            // Make sure we have room
                            if (outputByteCount >= currentByteCount + OutputType(0).sampleSize)
                            {
                                // Get the mode for the current timecode
                                MPData gazeX  = ParamCalcValueForTime(0, this.bufferTimeStamp);
                                MPData gazeY  = ParamCalcValueForTime(1, this.bufferTimeStamp);
                                MPData mouseX = ParamCalcValueForTime(2, this.bufferTimeStamp);
                                MPData mouseY = ParamCalcValueForTime(3, this.bufferTimeStamp);

                                // Process from input to output according to the mode
                                this.DoOverlay(
                                    (IntPtr)(outputPointer.ToInt32() + currentByteCount),
                                    this.bufferByteCount,
                                    this.bufferPointer,
                                    this.streamBBP,
                                    new Point(gazeX.vInt, gazeY.vInt),
                                    new Point(mouseX.vInt, mouseY.vInt));

                                // Keep the flags & time info from the input
                                outputBufferPointers[0].dwStatus     = this.bufferFlags;
                                outputBufferPointers[0].rtTimelength = this.bufferTimeLength;
                                outputBufferPointers[0].rtTimestamp  = this.bufferTimeStamp;

                                // Release the buffer.  Since we are always processing one buffer at
                                // a time, we always release on completion.  If our input might be
                                // more than one buffer, we would only release the input when it had
                                // be complete processed.
                                this.ReleaseInputBuffs();

                                // Say we've filled the buffer
                                hr = outputBufferPointers[0].pBuffer.SetLength(outputByteCount);
                            }
                            else
                            {
                                hr = EINVALIDARG;
                            }
                        }
                    }
                }
                else
                {
                    // No output buffer provided.  Happens in the DMO Wrapper if one of
                    // the output pins is not connected.
                    outputBufferPointers[0].dwStatus     = this.bufferFlags;
                    outputBufferPointers[0].rtTimelength = this.bufferTimeLength;
                    outputBufferPointers[0].rtTimestamp  = this.bufferTimeStamp;

                    // Release the buffer.  Since we are always processing one buffer at
                    // a time, we always release on completion.  If our input might be
                    // more than one buffer, we would only release the input when it had
                    // be complete processed.
                    this.ReleaseInputBuffs();
                }
            }
            else
            {
                hr = SFALSE;
            }

            return(hr);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Given output buffers, process the input buffers into the output buffers.
        /// </summary>
        /// <param name="flags">A <see cref="DMOProcessOutput"/> Flags</param>
        /// <param name="outputBufferCount">Number of buffers (will be one per output stream)</param>
        /// <param name="outputBufferPointers">The buffers</param>
        /// <param name="pdwStatus">Reserved: 0</param>
        /// <returns>S_FALSE if there is no output, S_OK otherwise</returns>
        protected override int InternalProcessOutput(
            DMOProcessOutput flags,
            int outputBufferCount,
            [In, Out] DMOOutputDataBuffer[] outputBufferPointers,
            out int pdwStatus)
        {
            // Check buffer
            IntPtr outputPointer;
            int    outputByteCount;
            int    currentByteCount;
            int    hr = SOK;

            pdwStatus = 0;

            // Check for no input buffers to process
            for (int i = 0; i < InputPinCount; i++)
            {
                if (this.inputStreams[i].Buffer == null)
                {
                    return(SFALSE);
                }
            }

            if (outputBufferPointers[0].pBuffer != null)
            {
                // Get a pointer to the output buffer
                hr = outputBufferPointers[0].pBuffer.GetBufferAndLength(out outputPointer, out currentByteCount);
                if (hr >= 0)
                {
                    hr = outputBufferPointers[0].pBuffer.GetMaxLength(out outputByteCount);
                    if (hr >= 0)
                    {
                        // Make sure we have room
                        if (outputByteCount >= currentByteCount + OutputType(0).sampleSize)
                        {
                            long timeStamp = this.inputStreams[0].BufferTimeStamp;

                            MPData backgroundColor = ParamCalcValueForTime(0, timeStamp);

                            // Get the mode for the current timecode
                            for (int i = 0; i < InputPinCount; i++)
                            {
                                MPData     streamLeft     = ParamCalcValueForTime((i * 5) + 1, timeStamp);
                                MPData     streamTop      = ParamCalcValueForTime((i * 5) + 2, timeStamp);
                                MPData     streamWidth    = ParamCalcValueForTime((i * 5) + 3, timeStamp);
                                MPData     streamHeight   = ParamCalcValueForTime((i * 5) + 4, timeStamp);
                                MPData     streamAlpha    = ParamCalcValueForTime((i * 5) + 5, timeStamp);
                                RectangleF streamPosition = new RectangleF(
                                    streamLeft.vFloat,
                                    streamTop.vFloat,
                                    streamWidth.vFloat,
                                    streamHeight.vFloat);
                                this.inputStreams[i].Alpha    = streamAlpha.vFloat;
                                this.inputStreams[i].Position = streamPosition;
                            }

                            // Process from input to output according to the mode
                            this.DoOverlay(
                                (IntPtr)(outputPointer.ToInt32() + currentByteCount),
                                outputByteCount,
                                this.inputStreams,
                                backgroundColor.vInt);

                            // Keep the flags & time info from the input
                            outputBufferPointers[0].dwStatus     = this.bufferFlags;
                            outputBufferPointers[0].rtTimelength = this.inputStreams[0].BufferTimeLength;
                            outputBufferPointers[0].rtTimestamp  = timeStamp;

                            // Release the buffer.  Since we are always processing one buffer at
                            // a time, we always release on completion.  If our input might be
                            // more than one buffer, we would only release the input when it had
                            // be complete processed.
                            this.ReleaseAllInputBuffers();

                            // Say we've filled the buffer
                            hr = outputBufferPointers[0].pBuffer.SetLength(outputByteCount);
                        }
                        else
                        {
                            hr = EINVALIDARG;
                        }
                    }
                }
            }
            else
            {
                // No output buffer provided.  Happens in the DMO Wrapper if one of
                // the output pins is not connected.
                outputBufferPointers[0].dwStatus     = this.bufferFlags;
                outputBufferPointers[0].rtTimelength = this.inputStreams[0].BufferTimeLength;
                outputBufferPointers[0].rtTimestamp  = this.inputStreams[0].BufferTimeStamp;

                // Release the buffer.  Since we are always processing one buffer at
                // a time, we always release on completion.  If our input might be
                // more than one buffer, we would only release the input when it had
                // be complete processed.
                this.ReleaseAllInputBuffers();
            }

            return(hr);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Given output buffers, process the input buffers into the output buffers.
        /// </summary>
        /// <param name="dwFlags">Flags</param>
        /// <param name="cOutputBufferCount">Number of buffers (will be one per output stream)</param>
        /// <param name="pOutputBuffers">The buffers</param>
        /// <param name="pdwStatus">Reserved: 0</param>
        /// <returns>S_FALSE if there is no output, S_OK otherwise</returns>
        override protected int InternalProcessOutput(
            DMOProcessOutput dwFlags,
            int cOutputBufferCount,
            [In, Out] DMOOutputDataBuffer [] pOutputBuffers,
            out int pdwStatus)
        {
            //  Check buffer
            IntPtr pbOutData;
            int    cbOutData;
            int    cbCurrent;
            int    hr = S_OK;

            pdwStatus = 0;

            // No input buffers to process
            if (m_pBuffer != null)
            {
                if (pOutputBuffers[0].pBuffer != null)
                {
                    // Get a pointer to the output buffer
                    hr = pOutputBuffers[0].pBuffer.GetBufferAndLength(out pbOutData, out cbCurrent);
                    if (hr >= 0)
                    {
                        hr = pOutputBuffers[0].pBuffer.GetMaxLength(out cbOutData);
                        if (hr >= 0)
                        {
                            // Make sure we have room
                            if (cbOutData >= cbCurrent + OutputType(0).sampleSize)
                            {
                                // Get the mode for the current timecode
                                MPData m = ParamCalcValueForTime(0, m_TimeStamp);

                                // Process from input to output according to the mode
                                DoFlip((IntPtr)(pbOutData.ToInt32() + cbCurrent), m_cbInData, m_InBuffer, m_BPP, (FlipMode)m.vInt);

                                // Keep the flags & time info from the input
                                pOutputBuffers[0].dwStatus     = m_Flags;
                                pOutputBuffers[0].rtTimelength = m_TimeLength;
                                pOutputBuffers[0].rtTimestamp  = m_TimeStamp;

                                // Release the buffer.  Since we are always processing one buffer at
                                // a time, we always release on completion.  If our input might be
                                // more than one buffer, we would only release the input when it had
                                // be complete processed.
                                ReleaseInputBuffs();

                                //  Say we've filled the buffer
                                hr = pOutputBuffers[0].pBuffer.SetLength(cbOutData);
                            }
                            else
                            {
                                hr = E_INVALIDARG;
                            }
                        }
                    }
                }
                else
                {
                    // No output buffer provided.  Happens in the DMO Wrapper if one of
                    // the output pins is not connected.
                    pOutputBuffers[0].dwStatus     = m_Flags;
                    pOutputBuffers[0].rtTimelength = m_TimeLength;
                    pOutputBuffers[0].rtTimestamp  = m_TimeStamp;

                    // Release the buffer.  Since we are always processing one buffer at
                    // a time, we always release on completion.  If our input might be
                    // more than one buffer, we would only release the input when it had
                    // be complete processed.
                    ReleaseInputBuffs();
                }
            }
            else
            {
                hr = S_FALSE;
            }

            return(hr);
        }
Exemplo n.º 20
0
 public void Initialize(MPData args) => data = args as DieRoll;
Exemplo n.º 21
0
 public void Initialize(MPData args) => data = args as TiebreakerRolled;
Exemplo n.º 22
0
        private void SetDMOParams(IBaseFilter dmoWrapperFilter)
        {
            int             hr;
            Guid            g;
            int             i;
            int             pc;
            ParamInfo       pInfo;
            IMediaParamInfo paramInfo = dmoWrapperFilter as IMediaParamInfo;

            // With a little effort, a generic parameter handling routine
            // could be produced.  You know the number of parameters (GetParamCount),
            // the type of the parameter (pInfo.mpType), the range of values for
            // int and float (pInfo.mpdMinValue, pInfo.mpdMaxValue), if the parameter is an
            // enum, you have the strings (GetParamText).

            hr = paramInfo.GetParamCount(out pc);
            DMOError.ThrowExceptionForHR(hr);

            // Walk all the parameters
            for (int pCur = 0; pCur < pc; pCur++)
            {
                IntPtr ip;

                hr = paramInfo.GetParamInfo(pCur, out pInfo);
                DMOError.ThrowExceptionForHR(hr);

                hr = paramInfo.GetParamText(0, out ip);
                DMOError.ThrowExceptionForHR(hr);

                try
                {
                    string    sName, sUnits;
                    string [] sEnum;
                    ParseParamText(ip, out sName, out sUnits, out sEnum);

                    Debug.WriteLine(string.Format("Parameter name: {0}", sName));
                    Debug.WriteLine(string.Format("Parameter units: {0}", sUnits));

                    // Not all params will have enumerated strings.
                    if (pInfo.mpType == MPType.ENUM)
                    {
                        // The final entry in "splitted" will be a blank (used to terminate the list).
                        for (int x = 0; x < sEnum.Length; x++)
                        {
                            Debug.WriteLine(string.Format("Parameter Enum strings: {0} = {1}", x, sEnum[x]));
                        }
                    }
                }
                finally
                {
                    Marshal.FreeCoTaskMem(ip);
                }
            }

            hr = paramInfo.GetCurrentTimeFormat(out g, out i);
            DMOError.ThrowExceptionForHR(hr);

            hr = paramInfo.GetSupportedTimeFormat(0, out g);
            DMOError.ThrowExceptionForHR(hr);

            MPData o = new MPData();

            m_param = dmoWrapperFilter as IMediaParams;

            o.vInt = 0;
            hr     = m_param.SetParam(0, o);
            DMOError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Sets the parameters for the mixer DMO according to
        /// the given <see cref="VideoExportProperties"/>
        /// </summary>
        /// <param name="dmoWrapperFilter">The <see cref="IBaseFilter"/>
        /// that contains the DMO.</param>
        /// <param name="exportProperties">The <see cref="VideoExportProperties"/>
        /// to use.</param>
        private void SetDMOParams(IBaseFilter dmoWrapperFilter, VideoExportProperties exportProperties)
        {
            int hr;

            IMediaParams dmoParams        = dmoWrapperFilter as IMediaParams;
            MPData       outputBackground = new MPData();
            MPData       streamTop        = new MPData();
            MPData       streamLeft       = new MPData();
            MPData       streamHeight     = new MPData();
            MPData       streamWidth      = new MPData();
            MPData       streamAlpha      = new MPData();

            // Get Background color
            Color bkg = exportProperties.OutputVideoColor;

            // Convert to integer value AARRGGBB
            outputBackground.vInt = bkg.ToArgb();

            // Set DMO param
            hr = dmoParams.SetParam(0, outputBackground);
            DMOError.ThrowExceptionForHR(hr);

            streamLeft.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Left;
            hr = dmoParams.SetParam(1, streamLeft);
            DMOError.ThrowExceptionForHR(hr);

            streamTop.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Top;
            hr = dmoParams.SetParam(2, streamTop);
            DMOError.ThrowExceptionForHR(hr);

            streamWidth.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Width;
            hr = dmoParams.SetParam(3, streamWidth);
            DMOError.ThrowExceptionForHR(hr);

            streamHeight.vFloat = exportProperties.GazeVideoProperties.StreamPosition.Height;
            hr = dmoParams.SetParam(4, streamHeight);
            DMOError.ThrowExceptionForHR(hr);

            streamAlpha.vFloat = exportProperties.GazeVideoProperties.StreamAlpha;
            hr = dmoParams.SetParam(5, streamAlpha);
            DMOError.ThrowExceptionForHR(hr);

            streamLeft.vFloat = exportProperties.UserVideoProperties.StreamPosition.Left;
            hr = dmoParams.SetParam(6, streamLeft);
            DMOError.ThrowExceptionForHR(hr);

            streamTop.vFloat = exportProperties.UserVideoProperties.StreamPosition.Top;
            hr = dmoParams.SetParam(7, streamTop);
            DMOError.ThrowExceptionForHR(hr);

            streamWidth.vFloat = exportProperties.UserVideoProperties.StreamPosition.Width;
            hr = dmoParams.SetParam(8, streamWidth);
            DMOError.ThrowExceptionForHR(hr);

            streamHeight.vFloat = exportProperties.UserVideoProperties.StreamPosition.Height;
            hr = dmoParams.SetParam(9, streamHeight);
            DMOError.ThrowExceptionForHR(hr);

            streamAlpha.vFloat = exportProperties.UserVideoProperties.StreamAlpha;
            hr = dmoParams.SetParam(10, streamAlpha);
            DMOError.ThrowExceptionForHR(hr);
        }
Exemplo n.º 24
0
 public void Initialize(MPData args) => data = args as MinigameVector2;
Exemplo n.º 25
0
        private void HandleParty(MPData data)
        {
            if (data is not Party party)
            {
                return;
            }
            if (!IsSIDMadelineParty(level.Session.Area.GetSID()))
            {
                return;
            }
            Logger.Log("MadelineParty", "Recieved PartyData. My ID: " + MultiplayerSingleton.Instance.GetPlayerID() + " Player ID: " + party.ID + " Looking for party of size " + party.lookingForParty);
            if (party.lookingForParty == GameData.Instance.playerNumber && // if they want the same party size
                party.version.Equals(Metadata.VersionString) && // and our versions match
                GameData.Instance.celestenetIDs.Count < GameData.Instance.playerNumber - 1 && // and we aren't full up
                !GameData.Instance.celestenetIDs.Contains(party.ID) && // and they aren't in our party
                party.ID != MultiplayerSingleton.Instance.GetPlayerID())      // and they aren't us

            {
                string joinMsg = party.DisplayName + " has joined the party!";
                // If they think they're the host and are broadcasting
                if (party.respondingTo < 0 && party.partyHost)
                {
                    // Tell them that they aren't the host and are instead joining our party
                    MultiplayerSingleton.Instance.Send(new Party {
                        respondingTo    = (int)party.ID,
                        lookingForParty = (byte)GameData.Instance.playerNumber,
                        partyHost       = GameData.Instance.gnetHost
                    });

                    GameData.Instance.celestenetIDs.Add(party.ID);


                    Logger.Log("MadelineParty", joinMsg);
                    MultiplayerSingleton.Instance.SendChat(joinMsg);

                    if (GameData.Instance.currentPlayerSelection != null)
                    {
                        MultiplayerSingleton.Instance.Send(new Party {
                            respondingTo        = (int)party.ID,
                            playerSelectTrigger = GameData.Instance.currentPlayerSelection.playerID
                        });
                    }
                }
                else if (party.respondingTo == MultiplayerSingleton.Instance.GetPlayerID())
                {
                    GameData.Instance.gnetHost = false;
                    GameData.Instance.celestenetIDs.Add(party.ID);

                    Logger.Log("MadelineParty", joinMsg);
                    MultiplayerSingleton.Instance.SendChat(joinMsg);
                }
            }

            // If the other player entered a player select trigger
            if (party.playerSelectTrigger != -2 && GameData.Instance.celestenetIDs.Contains(party.ID) && (party.respondingTo < 0 || party.respondingTo == MultiplayerSingleton.Instance.GetPlayerID()))
            {
                Logger.Log("MadelineParty", "Player ID: " + party.ID + " entered player select trigger " + party.playerSelectTrigger);
                GameData.Instance.playerSelectTriggers[party.ID] = party.playerSelectTrigger;
                if (GameData.Instance.currentPlayerSelection != null)
                {
                    // -1 so it doesn't count me as a player
                    int left = GameData.Instance.playerNumber - 1;
                    foreach (KeyValuePair <uint, int> kvp1 in GameData.Instance.playerSelectTriggers)
                    {
                        // Check if another player is trying to choose the same spot
                        bool duplicate = false;
                        foreach (KeyValuePair <uint, int> kvp2 in GameData.Instance.playerSelectTriggers)
                        {
                            duplicate |= (kvp2.Key != kvp1.Key && kvp2.Value == kvp1.Value);
                        }
                        if (!duplicate && kvp1.Value != -1 && kvp1.Value != GameData.Instance.currentPlayerSelection.playerID)
                        {
                            left--;
                        }
                    }

                    if (left <= 0)
                    {
                        GameData.Instance.currentPlayerSelection.AllTriggersOccupied();
                    }
                }
            }
        }
Exemplo n.º 26
0
 public void Initialize(MPData args) => data = args as MinigameStatus;
Exemplo n.º 27
0
        /// <summary>
        /// Calculate the parameter value at a specified time
        /// <para></para>
        /// While there are routines written for all the curve types, I'm not enough
        /// of a math whiz to feel comfortable that I got it right.  I stole the code
        /// from elsewhere and converted it to c#, so there's a chance I messed up.
        /// </summary>
        /// <param name="rt">Time at which to calculate</param>
        /// <returns>MPData value for that time based in the specified Curve</returns>
        public MPData CalcValueForTime(long rt)
        {
            long              ir, ic;
            float             p;
            MPData            ret;
            MPEnvelopeSegment m = this.FindEnvelopeForTime(rt);

            switch (m.iCurve)
            {
            case MPCaps.Jump:

                // Not quite sure how I want to do this.  Consider an envelope
                // that goes from time 0 to 10, and value 55 to 99.  Obviously
                // at time 0, you return 55.  At times 1 thru 9, I assume you
                // also return 55 (although one could argue they should return
                // 99).  At time 10, you return 99.

                // If you never have a timestamp that exactly equals 10, you
                // would never get the new value.  Seems odd.  Well, that's
                // how I've written it, anyway.
                if (rt < m.rtEnd)
                {
                    ret = m.valStart;
                }
                else
                {
                    ret = m.valEnd;
                }

                break;

            case MPCaps.Linear:
                ir  = m.rtEnd - m.rtStart;
                ic  = rt - m.rtStart;
                p   = ic / ir;
                ret = new MPData();

                if (this.dataType == MPType.FLOAT)
                {
                    ret.vFloat = (m.valEnd.vFloat - m.valStart.vFloat) * p;
                }
                else
                {
                    ret.vInt = (int)((m.valEnd.vInt - m.valStart.vInt) * p);
                }

                break;

            case MPCaps.InvSquare:
                ir  = m.rtEnd - m.rtStart;
                ic  = rt - m.rtStart;
                p   = ic / ir;
                p   = (float)Math.Sqrt(p);
                ret = new MPData();

                if (this.dataType == MPType.FLOAT)
                {
                    ret.vFloat = (m.valEnd.vFloat - m.valStart.vFloat) * p;
                }
                else
                {
                    ret.vInt = (int)((m.valEnd.vInt - m.valStart.vInt) * p);
                }

                break;

            case MPCaps.Sine:
                ir  = m.rtEnd - m.rtStart;
                ic  = rt - m.rtStart;
                p   = ic / ir;
                p   = (float)((Math.Sin((p * Math.PI) - (Math.PI / 2)) + 1) / 2);
                ret = new MPData();

                if (this.dataType == MPType.FLOAT)
                {
                    ret.vFloat = (m.valEnd.vFloat - m.valStart.vFloat) * p;
                }
                else
                {
                    ret.vInt = (int)((m.valEnd.vInt - m.valStart.vInt) * p);
                }

                break;

            case MPCaps.Square:
                ir  = m.rtEnd - m.rtStart;
                ic  = rt - m.rtStart;
                p   = ic / ir;
                p   = p * p;
                ret = new MPData();

                if (this.dataType == MPType.FLOAT)
                {
                    ret.vFloat = (m.valEnd.vFloat - m.valStart.vFloat) * p;
                }
                else
                {
                    ret.vInt = (int)((m.valEnd.vInt - m.valStart.vInt) * p);
                }

                break;

            default:
                Debug.Assert(false, "Invalid flag!");
                ret = new MPData();
                break;
            }

            return(ret);
        }
Exemplo n.º 28
0
 public void Initialize(MPData args) => data = args as RandomSeed;
Exemplo n.º 29
0
 public void Initialize(MPData args) => data = args as PlayerChoice;