Beispiel #1
0
        public bool SetState(MobjState state)
        {
            var ta = world.ThingAllocation;

            MobjStateDef st;

            do
            {
                if (state == MobjState.Null)
                {
                    State = DoomInfo.States[(int)MobjState.Null];
                    ta.RemoveMobj(this);
                    return(false);
                }

                st     = DoomInfo.States[(int)state];
                State  = st;
                Tics   = GetTics(st);
                Sprite = st.Sprite;
                Frame  = st.Frame;

                // Modified handling.
                // Call action functions when the state is set
                if (st.MobjAction != null)
                {
                    st.MobjAction(world, this);
                }

                state = st.Next;
            }while (Tics == 0);

            return(true);
        }
Beispiel #2
0
        public bool SetState(MobjState state)
        {
            do
            {
                if (state == MobjState.Null)
                {
                    this.state = DoomInfo.States[(int)MobjState.Null];
                    world.ThingAllocation.RemoveMobj(this);
                    return(false);
                }

                var st = DoomInfo.States[(int)state];
                this.state = st;
                tics       = GetTics(st);
                sprite     = st.Sprite;
                frame      = st.Frame;

                // Modified handling.
                // Call action functions when the state is set.
                if (st.MobjAction != null)
                {
                    st.MobjAction(world, this);
                }

                state = st.Next;
            }while (tics == 0);

            return(true);
        }
Beispiel #3
0
 public WeaponComponentInfo(int slot, MobjState upState, MobjState downState, MobjState readyState, MobjState attackState, MobjState flashState)
 {
     this.Slot        = slot;
     this.UpState     = upState;
     this.DownState   = downState;
     this.ReadyState  = readyState;
     this.AttackState = attackState;
     this.FlashState  = flashState;
 }
Beispiel #4
0
 public MobjInfo(
     string name,
     int doomEdNum,
     MobjState spawnState,
     int spawnHealth,
     MobjState seeState,
     Sfx seeSound,
     int reactionTime,
     Sfx attackSound,
     MobjState painState,
     int painChance,
     Sfx painSound,
     MobjState meleeState,
     MobjState missileState,
     MobjState deathState,
     MobjState xdeathState,
     Sfx deathSound,
     int speed,
     Fixed radius,
     Fixed height,
     int mass,
     int damage,
     Sfx activeSound,
     MobjFlags flags,
     MobjState raiseState
     )
 {
     this.Name         = name;
     this.doomEdNum    = doomEdNum;
     this.spawnState   = spawnState;
     this.spawnHealth  = spawnHealth;
     this.seeState     = seeState;
     this.seeSound     = seeSound;
     this.reactionTime = reactionTime;
     this.attackSound  = attackSound;
     this.painState    = painState;
     this.painChance   = painChance;
     this.painSound    = painSound;
     this.meleeState   = meleeState;
     this.missileState = missileState;
     this.deathState   = deathState;
     this.xdeathState  = xdeathState;
     this.deathSound   = deathSound;
     this.speed        = speed;
     this.radius       = radius;
     this.height       = height;
     this.mass         = mass;
     this.damage       = damage;
     this.activeSound  = activeSound;
     this.flags        = flags;
     this.raiseState   = raiseState;
 }
Beispiel #5
0
 public WeaponInfo(
     AmmoType ammo,
     MobjState upState,
     MobjState downState,
     MobjState readyState,
     MobjState attackState,
     MobjState flashState)
 {
     this.ammo        = ammo;
     this.upState     = upState;
     this.downState   = downState;
     this.readyState  = readyState;
     this.attackState = attackState;
     this.flashState  = flashState;
 }
Beispiel #6
0
 public WeaponInfo(
     AmmoType ammo,
     MobjState upState,
     MobjState downState,
     MobjState readyState,
     MobjState attackState,
     MobjState flashState)
 {
     Ammo        = ammo;
     UpState     = upState;
     DownState   = downState;
     ReadyState  = readyState;
     AttackState = attackState;
     FlashState  = flashState;
 }
Beispiel #7
0
        /// <summary>
        /// Change the player's weapon sprite.
        /// </summary>
        public void SetPlayerSprite(Player player, PlayerSprite position, MobjState state)
        {
            var psp = player.PlayerSprites[(int)position];

            do
            {
                if (state == MobjState.Null)
                {
                    // Object removed itself.
                    psp.State = null;

                    break;
                }

                var stateDef = DoomInfo.States[(int)state];
                psp.State = stateDef;
                psp.Tics  = stateDef.Tics;                // Could be 0.

                if (stateDef.Misc1 != 0)
                {
                    // Coordinate set.
                    psp.Sx = Fixed.FromInt(stateDef.Misc1);
                    psp.Sy = Fixed.FromInt(stateDef.Misc2);
                }

                // Call action routine.
                // Modified handling.
                if (stateDef.PlayerAction != null)
                {
                    stateDef.PlayerAction(this.world, player, psp);

                    if (psp.State == null)
                    {
                        break;
                    }
                }

                state = psp.State.Next;
            }while (psp.Tics == 0);

            // An initial state of 0 could cycle through.
        }
Beispiel #8
0
 public MobjStateDef(
     int number,
     Sprite sprite,
     int frame,
     int tics,
     Action <World, Player, PlayerSpriteDef> playerAction,
     Action <World, Mobj> mobjAction,
     MobjState next,
     int misc1,
     int misc2)
 {
     this.number       = number;
     this.sprite       = sprite;
     this.frame        = frame;
     this.tics         = tics;
     this.playerAction = playerAction;
     this.mobjAction   = mobjAction;
     this.next         = next;
     this.misc1        = misc1;
     this.misc2        = misc2;
 }
Beispiel #9
0
        public MobjStateDef(
            int number,
            Sprite sprite,
            int frame,
            int tics,
            Action <World, Player, PlayerSpriteDef> playerAction,
            Action <World, Mobj> mobjAction,
            MobjState next,
            int misc1,
            int misc2)
        {
            Number = number;

            Sprite       = sprite;
            Frame        = frame;
            Tics         = tics;
            PlayerAction = playerAction;
            MobjAction   = mobjAction;

            Next  = next;
            Misc1 = misc1;
            Misc2 = misc2;
        }