Пример #1
0
        // Constructor.
        public RoomState() : base()
        {
            LevelDataPtr        = 0;
            TileSet             = 0;
            SongSet             = 0;
            PlayIndex           = 0;
            FxPtr               = 0;
            EnemySetPtr         = 0;
            EnemyGfxPtr         = 0;
            BackgroundScrolling = 0;
            ScrollSetPtr        = 0;
            UnusedPtr           = 0;
            MainAsmPtr          = 0;
            PlmSetPtr           = 0;
            BackgroundPtr       = 0;
            SetupAsmPtr         = 0;

            MyPlmSet     = null;
            MyScrollSet  = null;
            MyBackground = null;
            MyFx         = null;
            MyLevelData  = null;
            MyEnemySet   = null;
            MyEnemyGfx   = null;
            MyRoom       = null;
        }
Пример #2
0
 // Constructor, copy from existing PLM set.
 public PlmSet(PlmSet source) : base()
 {
     Plms         = new List <Plm> ();
     MyRoomStates = new List <RoomState> ();
     foreach (Plm p in source.Plms)
     {
         Plms.Add(new Plm(p));
     }
 }
Пример #3
0
        // Renders PLMs on a screen.
        private void RenderScreenPlms(BlitImage screenImage, int rowMin, int colMin)
        {
            PlmSet plms = ActiveRoomState?.MyPlmSet;

            if (plms != null)
            {
                foreach (Plm p in plms.Plms)
                {
                    BlitImage graphics = p.MyPlmType?.Graphics ?? PlmTypes [0].Graphics;
                    screenImage.Blit(graphics,
                                     16 * (p.PosX - colMin),
                                     16 * (p.PosY - rowMin),
                                     false, false);
                }
            }
        }
Пример #4
0
        // Add room state to active room.
        private bool ForceAddRoomState(StateType type)
        {
            if (ActiveRoom == null)
            {
                return(false);
            }
            RoomStateHeader newHeader = new RoomStateHeader();

            newHeader.SetDefault();
            newHeader.HeaderType = type;

            var newState     = new RoomState();
            var newLevelData = new LevelData(RoomWidthInScreens, RoomHeightInScreens);
            var newPlmSet    = new PlmSet();
            var newEnemySet  = new EnemySet();
            var newEnemyGfx  = new EnemyGfx();
            var newFx        = new Fx();

            newState.SetDefault();
            newLevelData.SetDefault();
            newPlmSet.SetDefault();
            newEnemySet.SetDefault();
            newEnemyGfx.SetDefault();
            newFx.SetDefault();

            newState.SetLevelData(newLevelData, out var ignore1);
            newState.SetScrollSet(null, out var ignore2);
            newState.SetPlmSet(newPlmSet, out var ignore3);
            newState.SetEnemySet(newEnemySet, out var ignore4);
            newState.SetEnemyGfx(newEnemyGfx, out var ignore5);
            newState.SetFx(newFx, out var ignore6);
            newState.SetBackground(null, out var ignore7);
            newState.SetSetupAsm(null, out var ignore8);
            newState.SetMainAsm(null, out var ignore9);

            ActiveRoom.RoomStateHeaders.Insert(0, newHeader);
            ActiveRoom.RoomStates.Insert(0, newState);
            LevelDatas.Add(newState.MyLevelData);
            PlmSets.Add(newState.MyPlmSet);
            EnemySets.Add(newState.MyEnemySet);
            EnemyGfxs.Add(newState.MyEnemyGfx);
            Fxs.Add(newState.MyFx);
            ChangesMade = true;
            return(true);
        }
Пример #5
0
 public void SetPlmSet(PlmSet target, out PlmSet deletePlmSet)
 {
     SetReference(ref MyPlmSet, target, out deletePlmSet);
 }
Пример #6
0
        public bool Connect(List <Data> PlmSets,
                            List <Data> ScrollSets,
                            List <Data> Backgrounds,
                            List <Data> Fxs,
                            List <Data> LevelDatas,
                            List <Data> EnemySets,
                            List <Data> EnemyGfxs,
                            List <Data> SetupAsms,
                            List <Data> MainAsms)
        {
            bool success = true;

            if (PlmSetPtr >= 0x8F8000)
            {
                MyPlmSet = (PlmSet)PlmSets.Find(x => x.StartAddressLR == PlmSetPtr);
                if (MyPlmSet != null)
                {
                    MyPlmSet.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (ScrollSetPtr >= 0x8F8000)
            {
                MyScrollSet = (ScrollSet)ScrollSets.Find(x => x.StartAddressLR == ScrollSetPtr);
                if (MyScrollSet != null)
                {
                    MyScrollSet.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (BackgroundPtr >= 0x8F8000)
            {
                MyBackground = (Background)Backgrounds.Find(x => x.StartAddressLR == BackgroundPtr);
                if (MyBackground != null)
                {
                    MyBackground.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (FxPtr >= 0x838000)
            {
                MyFx = (Fx)Fxs.Find(x => x.StartAddressLR == FxPtr);
                if (MyFx != null)
                {
                    MyFx.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (SetupAsmPtr >= 0x8F8000)
            {
                MySetupAsm = (Asm)SetupAsms.Find(x => x.StartAddressLR == SetupAsmPtr);
                if (MySetupAsm != null)
                {
                    MySetupAsm.MyReferringData.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (MainAsmPtr >= 0x8F8000)
            {
                MyMainAsm = (Asm)MainAsms.Find(x => x.StartAddressLR == MainAsmPtr);
                if (MyMainAsm != null)
                {
                    MyMainAsm.MyReferringData.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            MyLevelData = (LevelData)LevelDatas.Find(x => x.StartAddressLR == LevelDataPtr);
            if (MyLevelData != null)
            {
                MyLevelData.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            MyEnemySet = (EnemySet)EnemySets.Find(x => x.StartAddressLR == EnemySetPtr);
            if (MyEnemySet != null)
            {
                MyEnemySet.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            MyEnemyGfx = (EnemyGfx)EnemyGfxs.Find(x => x.StartAddressLR == EnemyGfxPtr);
            if (MyEnemyGfx != null)
            {
                MyEnemyGfx.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            return(success);
        }