Пример #1
0
        public bool DoEvent(DoomEvent e)
        {
            if (this.stage != 2)
            {
                return(false);
            }

            if (e.Type == EventType.KeyDown)
            {
                if (this.castDeath)
                {
                    // Already in dying frames.
                    return(true);
                }

                // Go into death frame.
                this.castDeath     = true;
                this.castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathState];
                this.castTics      = this.castState.Tics;
                this.castFrames    = 0;
                this.castAttacking = false;

                if (DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathSound != 0)
                {
                    this.StartSound(DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].DeathSound);
                }

                return(true);
            }

            return(false);
        }
Пример #2
0
        private void StartCast()
        {
            this.stage = 2;

            this.castNumber    = 0;
            this.castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeState];
            this.castTics      = this.castState.Tics;
            this.castFrames    = 0;
            this.castDeath     = false;
            this.castOnMelee   = false;
            this.castAttacking = false;

            this.updateResult = UpdateResult.NeedWipe;

            this.options.Music.StartMusic(Bgm.EVIL, true);
        }
Пример #3
0
        private void UpdateCast()
        {
            if (--this.castTics > 0)
            {
                // Not time to change state yet.
                return;
            }

            if (this.castState.Tics == -1 || this.castState.Next == MobjState.Null)
            {
                // Switch from deathstate to next monster.
                this.castNumber++;
                this.castDeath = false;

                if (this.castNumber == Finale.castorder.Length)
                {
                    this.castNumber = 0;
                }

                if (DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeSound != 0)
                {
                    this.StartSound(DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeSound);
                }

                this.castState  = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeState];
                this.castFrames = 0;
            }
            else
            {
                // Just advance to next state in animation.
                if (this.castState == DoomInfo.States[(int)MobjState.PlayAtk1])
                {
                    // Oh, gross hack!
                    this.castAttacking = false;
                    this.castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeState];
                    this.castFrames    = 0;

                    goto stopAttack;
                }

                var st = this.castState.Next;
                this.castState = DoomInfo.States[(int)st];
                this.castFrames++;

                // Sound hacks....
                Sfx sfx;

                switch (st)
                {
                case MobjState.PlayAtk1:
                    sfx = Sfx.DSHTGN;

                    break;

                case MobjState.PossAtk2:
                    sfx = Sfx.PISTOL;

                    break;

                case MobjState.SposAtk2:
                    sfx = Sfx.SHOTGN;

                    break;

                case MobjState.VileAtk2:
                    sfx = Sfx.VILATK;

                    break;

                case MobjState.SkelFist2:
                    sfx = Sfx.SKESWG;

                    break;

                case MobjState.SkelFist4:
                    sfx = Sfx.SKEPCH;

                    break;

                case MobjState.SkelMiss2:
                    sfx = Sfx.SKEATK;

                    break;

                case MobjState.FattAtk8:
                case MobjState.FattAtk5:
                case MobjState.FattAtk2:
                    sfx = Sfx.FIRSHT;

                    break;

                case MobjState.CposAtk2:
                case MobjState.CposAtk3:
                case MobjState.CposAtk4:
                    sfx = Sfx.SHOTGN;

                    break;

                case MobjState.TrooAtk3:
                    sfx = Sfx.CLAW;

                    break;

                case MobjState.SargAtk2:
                    sfx = Sfx.SGTATK;

                    break;

                case MobjState.BossAtk2:
                case MobjState.Bos2Atk2:
                case MobjState.HeadAtk2:
                    sfx = Sfx.FIRSHT;

                    break;

                case MobjState.SkullAtk2:
                    sfx = Sfx.SKLATK;

                    break;

                case MobjState.SpidAtk2:
                case MobjState.SpidAtk3:
                    sfx = Sfx.SHOTGN;

                    break;

                case MobjState.BspiAtk2:
                    sfx = Sfx.PLASMA;

                    break;

                case MobjState.CyberAtk2:
                case MobjState.CyberAtk4:
                case MobjState.CyberAtk6:
                    sfx = Sfx.RLAUNC;

                    break;

                case MobjState.PainAtk3:
                    sfx = Sfx.SKLATK;

                    break;

                default:
                    sfx = 0;

                    break;
                }

                if (sfx != 0)
                {
                    this.StartSound(sfx);
                }
            }

            if (this.castFrames == 12)
            {
                // Go into attack frame.
                this.castAttacking = true;

                if (this.castOnMelee)
                {
                    this.castState = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].MeleeState];
                }
                else
                {
                    this.castState = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].MissileState];
                }

                this.castOnMelee = !this.castOnMelee;

                if (this.castState == DoomInfo.States[(int)MobjState.Null])
                {
                    if (this.castOnMelee)
                    {
                        this.castState = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].MeleeState];
                    }
                    else
                    {
                        this.castState = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].MissileState];
                    }
                }
            }

            if (this.castAttacking)
            {
                if (this.castFrames == 24 || this.castState == DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeState])
                {
                    this.castAttacking = false;
                    this.castState     = DoomInfo.States[(int)DoomInfo.MobjInfos[(int)Finale.castorder[this.castNumber].Type].SeeState];
                    this.castFrames    = 0;
                }
            }

stopAttack:

            this.castTics = this.castState.Tics;

            if (this.castTics == -1)
            {
                this.castTics = 15;
            }
        }