Beispiel #1
0
        LevelItem FromString(String[] strs, ref int idx)
        {
            switch (strs[idx])
            {
            case "OBJ":
                return(NSMBObject.FromString(strs, ref idx, EdControl.Level.GFX));

            case "SPR":
                return(NSMBSprite.FromString(strs, ref idx, EdControl.Level));

            case "ENT":
                return(NSMBEntrance.FromString(strs, ref idx, EdControl.Level));

            case "VIW":
            case "ZON":
                return(NSMBView.FromString(strs, ref idx, EdControl.Level));

            // TODO: copy and paste with paths/path points
            //case "PTH":
            //    break;
            default:
                idx++;
                return(null);
            }
        }
Beispiel #2
0
        private void Write(NSMBView v, int value)
        {
            switch (PropNum)
            {
            case 1: v.Number = value; break;

            case 2: v.Music = value; break;

            case 3: v.Unknown1 = value; break;

            case 4: v.Unknown2 = value; break;

            case 5: v.Unknown3 = value; break;

            case 6: v.Lighting = value; break;

            case 7: v.FlagpoleID = value; break;

            case 8: v.CameraTop = value; break;

            case 9: v.CameraBottom = value; break;

            case 10: v.CameraTopSpin = value; break;

            case 11: v.CameraBottomSpin = value; break;

            case 12: v.CameraBottomStick = value; break;
            }
        }
Beispiel #3
0
        private int Read(NSMBView v)
        {
            switch (PropNum)
            {
            case 1: return(v.Number);

            case 2: return(v.Music);

            case 3: return(v.Unknown1);

            case 4: return(v.Unknown2);

            case 5: return(v.Unknown3);

            case 6: return(v.Lighting);

            case 7: return(v.FlagpoleID);

            case 8: return(v.CameraTop);

            case 9: return(v.CameraBottom);

            case 10: return(v.CameraTopSpin);

            case 11: return(v.CameraBottomSpin);

            case 12: return(v.CameraBottomStick);
            }
            return(0);
        }
Beispiel #4
0
        public int RemoveZIndex(LevelItem obj)
        {
            int idx = -1;

            if (obj is NSMBObject)
            {
                idx = Objects.IndexOf(obj as NSMBObject);
                Objects.Remove(obj as NSMBObject);
            }
            if (obj is NSMBSprite)
            {
                idx = Sprites.IndexOf(obj as NSMBSprite);
                Sprites.Remove(obj as NSMBSprite);
            }
            if (obj is NSMBEntrance)
            {
                idx = Entrances.IndexOf(obj as NSMBEntrance);
                Entrances.Remove(obj as NSMBEntrance);
            }
            if (obj is NSMBView)
            {
                NSMBView v = obj as NSMBView;
                if (v.isZone)
                {
                    idx = Zones.IndexOf(v);
                    Zones.Remove(v);
                }
                else
                {
                    idx = Views.IndexOf(v);
                    Views.Remove(v);
                }
            }
            if (obj is NSMBPathPoint)
            {
                NSMBPathPoint pp = obj as NSMBPathPoint;
                idx = pp.parent.points.IndexOf(pp);
                pp.parent.points.Remove(pp);
                if (pp.parent.points.Count == 0)
                {
                    if (pp.parent.isProgressPath)
                    {
                        ProgressPaths.Remove(pp.parent);
                    }
                    else
                    {
                        Paths.Remove(pp.parent);
                    }
                }
            }
            return(idx == -1 ? 0 : idx);
        }
Beispiel #5
0
 private void addViewButton_Click(object sender, EventArgs e)
 {
     NSMBView nv = new NSMBView();
     Rectangle va = EdControl.ViewableBlocks;
     nv.X = (va.X + (va.Width - 16) / 2) * 16;
     nv.Y = (va.Y + (va.Height - 12) / 2) * 16;
     nv.Height = 12 * 16;
     nv.Width = 16 * 16;
     nv.isZone = !EditingViews;
     nv.Number = EdControl.Level.getFreeViewNumber(lst);
     EdControl.UndoManager.Do(new AddLvlItemAction(UndoManager.ObjToList(nv)));
     EdControl.mode.SelectObject(nv);
 }
Beispiel #6
0
        public static NSMBView read(ByteArrayInputStream inp, ByteArrayInputStream cam)
        {
            NSMBView v = new NSMBView();

            v.X      = inp.readUShort();
            v.Y      = inp.readUShort();
            v.Width  = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            int camID = inp.readByte();

            v.Music      = inp.readByte();
            v.Unknown1   = inp.readByte();
            v.Unknown2   = inp.readByte();
            v.Unknown3   = inp.readByte();
            v.Lighting   = inp.readByte();
            v.FlagpoleID = inp.readByte();

            cam.seek(0);
            int camCount = (int)cam.available / 24;
//            Console.Out.WriteLine("CamCount: " + camCount);
            int goodCam = -1;

            for (int i = 0; i < camCount; i++)
            {
                cam.seek(i * 24 + 16);
                int thisCam = cam.readUShort();
//                Console.Out.WriteLine("Cam ID: " + thisCam);
                if (thisCam == camID)
                {
                    goodCam = i;
                    break;
                }
            }

            if (goodCam == -1)
            {
                Console.Out.WriteLine("Warning: Could not find camera ID " + camID);
            }
            else
            {
                cam.seek(goodCam * 24);
                v.CameraTop        = cam.readInt();
                v.CameraBottom     = cam.readInt();
                v.CameraTopSpin    = cam.readInt();
                v.CameraBottomSpin = cam.readInt();
                cam.skip(2);
                v.CameraBottomStick = cam.readUShort();
            }
            return(v);
        }
Beispiel #7
0
        private void addViewButton_Click(object sender, EventArgs e)
        {
            NSMBView  nv = new NSMBView();
            Rectangle va = EdControl.ViewableBlocks;

            nv.X      = (va.X + (va.Width - 16) / 2) * 16;
            nv.Y      = (va.Y + (va.Height - 12) / 2) * 16;
            nv.Height = 12 * 16;
            nv.Width  = 16 * 16;
            nv.isZone = !EditingViews;
            nv.Number = EdControl.Level.getFreeViewNumber(lst);
            EdControl.UndoManager.Do(new AddLvlItemAction(UndoManager.ObjToList(nv)));
            EdControl.mode.SelectObject(nv);
        }
Beispiel #8
0
        public static NSMBView readZone(ByteArrayInputStream inp)
        {
            NSMBView v = new NSMBView();

            v.X      = inp.readUShort();
            v.Y      = inp.readUShort();
            v.Width  = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            v.isZone = true;
            inp.skip(3);

            return(v);
        }
Beispiel #9
0
        private Rectangle GetViewTextRect(LevelItem view)
        {
            Rectangle visible = EdControl.ViewablePixels;

            visible = new Rectangle(visible.X, visible.Y, visible.Width, visible.Height);
            if (!visible.IntersectsWith(new Rectangle(view.x, view.y, view.width, view.height)))
            {
                return(Rectangle.Empty);
            }
            NSMBView  v        = view as NSMBView;
            Rectangle viewText = new Rectangle(new Point(Math.Max(v.x, visible.X), Math.Max(v.y, visible.Y) + (v.isZone ? 16 : 0)), TextRenderer.MeasureText(v.GetDisplayString(), NSMBGraphics.SmallInfoFont));

            return(viewText);
        }
Beispiel #10
0
        public void UpdateInfo()
        {
            UpdateList();

            if (SelectedObjects == null || SelectedObjects.Count == 0)
            {
                panel2.Visible            = false;
                tableLayoutPanel1.Visible = false;
                deleteViewButton.Enabled  = false;
                return;
            }
            panel2.Visible            = true;
            tableLayoutPanel1.Visible = EditingViews;
            deleteViewButton.Enabled  = true;

            NSMBView v = SelectedObjects[0] as NSMBView;

            DataUpdateFlag = true;

            foreach (LevelItem obj in SelectedObjects)
            {
                viewsList.SelectedIndices.Add(lst.IndexOf(obj as NSMBView));
            }
            viewID.Value = v.Number;

            music.SelectedIndex = 0;
            for (int findmusic = 0; findmusic < music.Items.Count; findmusic++)
            {
                int check = int.Parse((music.Items[findmusic] as string).Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
                if (check == v.Music)
                {
                    music.SelectedIndex = findmusic;
                    break;
                }
            }
            unk1.Value       = v.Unknown1;
            unk2.Value       = v.Unknown2;
            unk3.Value       = v.Unknown3;
            light.Value      = v.Lighting;
            progressID.Value = v.FlagpoleID;

            camTop.Value           = v.CameraTop;
            camTopSpecial.Value    = v.CameraTopSpin;
            camBottom.Value        = v.CameraBottom;
            camBottomSpecial.Value = v.CameraBottomSpin;
            camStick.Value         = v.CameraBottomStick;
            DataUpdateFlag         = false;
        }
Beispiel #11
0
 public void Add(LevelItem obj)
 {
     if (obj is NSMBObject)
     {
         Objects.Add(obj as NSMBObject);
     }
     if (obj is NSMBSprite)
     {
         Sprites.Add(obj as NSMBSprite);
     }
     if (obj is NSMBEntrance)
     {
         Entrances.Add(obj as NSMBEntrance);
     }
     if (obj is NSMBView)
     {
         NSMBView v = obj as NSMBView;
         if (v.isZone)
         {
             Zones.Add(v);
         }
         else
         {
             Views.Add(v);
         }
     }
     if (obj is NSMBPathPoint)
     {
         NSMBPathPoint pp = obj as NSMBPathPoint;
         pp.parent.points.Add(pp);
         if (pp.parent.isProgressPath)
         {
             if (!ProgressPaths.Contains(pp.parent))
             {
                 ProgressPaths.Add(pp.parent);
             }
         }
         else
         {
             if (!Paths.Contains(pp.parent))
             {
                 Paths.Add(pp.parent);
             }
         }
     }
 }
Beispiel #12
0
 public void Remove(LevelItem obj)
 {
     if (obj is NSMBObject)
     {
         Objects.Remove(obj as NSMBObject);
     }
     if (obj is NSMBSprite)
     {
         Sprites.Remove(obj as NSMBSprite);
     }
     if (obj is NSMBEntrance)
     {
         Entrances.Remove(obj as NSMBEntrance);
     }
     if (obj is NSMBView)
     {
         NSMBView v = obj as NSMBView;
         if (v.isZone)
         {
             Zones.Remove(v);
         }
         else
         {
             Views.Remove(v);
         }
     }
     if (obj is NSMBPathPoint)
     {
         NSMBPathPoint pp = obj as NSMBPathPoint;
         pp.parent.points.Remove(pp);
         if (pp.parent.points.Count == 0)
         {
             if (pp.parent.isProgressPath)
             {
                 ProgressPaths.Remove(pp.parent);
             }
             else
             {
                 Paths.Remove(pp.parent);
             }
         }
     }
 }
Beispiel #13
0
        public NSMBView(NSMBView v)
        {
            X = v.X;
            Y = v.Y;
            Width = v.Width;
            Height = v.Height;
            Number = v.Number;
//            Camera = v.Camera;
            Music = v.Music;
            Unknown1 = v.Unknown1;
            Unknown2 = v.Unknown2;
            Unknown3 = v.Unknown3;
            Lighting = v.Lighting;
            FlagpoleID = v.FlagpoleID;
            isZone = v.isZone;
            CameraTop = v.CameraTop;
            CameraTopSpin = v.CameraTopSpin;
            CameraBottom = v.CameraBottom;
            CameraBottomSpin = v.CameraBottomSpin;
            CameraBottomStick = v.CameraBottomStick;
        }
Beispiel #14
0
        public NSMBView(NSMBView v)
        {
            X      = v.X;
            Y      = v.Y;
            Width  = v.Width;
            Height = v.Height;
            Number = v.Number;
//            Camera = v.Camera;
            Music             = v.Music;
            Unknown1          = v.Unknown1;
            Unknown2          = v.Unknown2;
            Unknown3          = v.Unknown3;
            Lighting          = v.Lighting;
            FlagpoleID        = v.FlagpoleID;
            isZone            = v.isZone;
            CameraTop         = v.CameraTop;
            CameraTopSpin     = v.CameraTopSpin;
            CameraBottom      = v.CameraBottom;
            CameraBottomSpin  = v.CameraBottomSpin;
            CameraBottomStick = v.CameraBottomStick;
        }
Beispiel #15
0
        public static NSMBView FromString(string[] strs, ref int idx, NSMBLevel lvl)
        {
            NSMBView v = new NSMBView();

            v.X      = int.Parse(strs[1 + idx]);
            v.Y      = int.Parse(strs[2 + idx]);
            v.Width  = int.Parse(strs[3 + idx]);
            v.Height = int.Parse(strs[4 + idx]);
            v.Number = int.Parse(strs[5 + idx]);
            if (strs[idx] == "ZON")
            {
                idx     += 6;
                v.isZone = true;
                if (lvl.isViewNumberUsed(v.Number, lvl.Zones))
                {
                    v.Number = lvl.getFreeViewNumber(lvl.Zones);
                }
            }
            else
            {
                v.Music             = int.Parse(strs[6 + idx]);
                v.Unknown1          = int.Parse(strs[7 + idx]);
                v.Unknown2          = int.Parse(strs[8 + idx]);
                v.Unknown3          = int.Parse(strs[9 + idx]);
                v.Lighting          = int.Parse(strs[10 + idx]);
                v.FlagpoleID        = int.Parse(strs[11 + idx]);
                v.CameraTop         = int.Parse(strs[12 + idx]);
                v.CameraTopSpin     = int.Parse(strs[13 + idx]);
                v.CameraBottom      = int.Parse(strs[14 + idx]);
                v.CameraBottomSpin  = int.Parse(strs[15 + idx]);
                v.CameraBottomStick = int.Parse(strs[16 + idx]);
                idx += 17;
                if (lvl.isViewNumberUsed(v.Number, lvl.Views))
                {
                    v.Number = lvl.getFreeViewNumber(lvl.Views);
                }
            }
            return(v);
        }
Beispiel #16
0
        public void SelectObjects(List <LevelItem> objs, LevelItem selectedTabType)
        {
            if (objs.Contains(selectedTabType))
            {
                objs.Remove(selectedTabType);
                objs.Insert(0, selectedTabType);
            }
            SelectedObjs = objs;
            ClearTabs();
            int tabIndex = -1;

            foreach (LevelItem obj in objs)
            {
                if (obj is NSMBObject)
                {
                    AddTab(objects);
                }
                if (obj is NSMBSprite)
                {
                    AddTab(sprites);
                }
                if (obj is NSMBEntrance)
                {
                    AddTab(entrances);
                }
                if (obj is NSMBView)
                {
                    NSMBView v = obj as NSMBView;
                    if (v.isZone)
                    {
                        AddTab(zones);
                    }
                    else
                    {
                        AddTab(views);
                    }
                }
                if (obj is NSMBPathPoint)
                {
                    NSMBPathPoint pp = obj as NSMBPathPoint;
                    if (pp.parent.isProgressPath)
                    {
                        AddTab(progresspaths);
                    }
                    else
                    {
                        AddTab(paths);
                    }
                }

                if (selectedTabType != null && obj.GetType() == selectedTabType.GetType() && tabIndex == -1)
                {
                    tabIndex = tabControl1.TabCount - 1;
                }
            }
            if (tabControl1.TabCount == 0)
            {
                SelectNone();
            }
            if (tabIndex > -1)
            {
                tabControl1.SelectedIndex = tabIndex;
            }
            EdControl.Focus();
        }
Beispiel #17
0
        public static NSMBView readZone(ByteArrayInputStream inp)
        {
            NSMBView v = new NSMBView();

            v.X = inp.readUShort();
            v.Y = inp.readUShort();
            v.Width = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            v.isZone = true;
            inp.skip(3);

            return v;
        }
Beispiel #18
0
 public static NSMBView FromString(string[] strs, ref int idx, NSMBLevel lvl)
 {
     NSMBView v = new NSMBView();
     v.X = int.Parse(strs[1 + idx]);
     v.Y = int.Parse(strs[2 + idx]);
     v.Width = int.Parse(strs[3 + idx]);
     v.Height = int.Parse(strs[4 + idx]);
     v.Number = int.Parse(strs[5 + idx]);
     if (strs[idx] == "ZON") {
         idx += 6;
         v.isZone = true;
         if (lvl.isViewNumberUsed(v.Number, lvl.Zones))
             v.Number = lvl.getFreeViewNumber(lvl.Zones);
     } else {
         v.Music = int.Parse(strs[6 + idx]);
         v.Unknown1 = int.Parse(strs[7 + idx]);
         v.Unknown2 = int.Parse(strs[8 + idx]);
         v.Unknown3 = int.Parse(strs[9 + idx]);
         v.Lighting = int.Parse(strs[10 + idx]);
         v.FlagpoleID = int.Parse(strs[11 + idx]);
         v.CameraTop = int.Parse(strs[12 + idx]);
         v.CameraTopSpin = int.Parse(strs[13 + idx]);
         v.CameraBottom = int.Parse(strs[14 + idx]);
         v.CameraBottomSpin = int.Parse(strs[15 + idx]);
         v.CameraBottomStick = int.Parse(strs[16 + idx]);
         idx += 17;
         if (lvl.isViewNumberUsed(v.Number, lvl.Views))
             v.Number = lvl.getFreeViewNumber(lvl.Views);
     }
     return v;
 }
Beispiel #19
0
        private void LoadLevel(byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX)
        {
            this.GFX = GFX;

            int FilePos;

            for (int x = 0; x < 512; x++)
            {
                for (int y = 0; y < 256; y++)
                {
                    levelTilemap[x, y] = (x + y) % 512;
                }
            }

            // Level loading time yay.
            // Since I don't know the format for every block, I will just load them raw.
            Blocks = new byte[][] { null, null, null, null, null, null, null, null, null, null, null, null, null, null };

            FilePos = 0;
            for (int BlockIdx = 0; BlockIdx < 14; BlockIdx++)
            {
                int BlockOffset = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24;
                FilePos += 4;
                int BlockSize = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24;
                FilePos += 4;

                Blocks[BlockIdx] = new byte[BlockSize];
                Array.Copy(eLevelFile, BlockOffset, Blocks[BlockIdx], 0, BlockSize);
            }

            // Now objects.

            int ObjectCount = eBGFile.Length / 10;

            Objects = new List <NSMBObject>(ObjectCount);
            FilePos = 0;
            for (int ObjectIdx = 0; ObjectIdx < ObjectCount; ObjectIdx++)
            {
                int ObjID     = eBGFile[FilePos] | (eBGFile[FilePos + 1] << 8);
                int ObjX      = eBGFile[FilePos + 2] | (eBGFile[FilePos + 3] << 8);
                int ObjY      = eBGFile[FilePos + 4] | (eBGFile[FilePos + 5] << 8);
                int ObjWidth  = eBGFile[FilePos + 6] | (eBGFile[FilePos + 7] << 8);
                int ObjHeight = eBGFile[FilePos + 8] | (eBGFile[FilePos + 9] << 8);
                Objects.Add(new NSMBObject(ObjID & 4095, (ObjID & 61440) >> 12, ObjX, ObjY, ObjWidth, ObjHeight, GFX));
                FilePos += 10;
            }

            /*
             * Sprite struct:
             * Offs Len Dat
             * 0x0   2   Sprite id
             * 0x2   2   X
             * 0x4   2   Y
             * 0x6   6   Dat
             * 0xD   end
             */

            // Sprites
            byte[] SpriteBlock = Blocks[6];
            int    SpriteCount = (SpriteBlock.Length - 2) / 12;

            Sprites = new List <NSMBSprite>(SpriteCount);
            FilePos = 0;
            for (int SpriteIdx = 0; SpriteIdx < SpriteCount; SpriteIdx++)
            {
                NSMBSprite Sprite = new NSMBSprite(this);
                Sprite.Type    = SpriteBlock[FilePos] | (SpriteBlock[FilePos + 1] << 8);
                Sprite.X       = SpriteBlock[FilePos + 2] | (SpriteBlock[FilePos + 3] << 8);
                Sprite.Y       = SpriteBlock[FilePos + 4] | (SpriteBlock[FilePos + 5] << 8);
                Sprite.Data    = new byte[6];
                FilePos       += 6;
                Sprite.Data[0] = SpriteBlock[FilePos + 1];
                Sprite.Data[1] = SpriteBlock[FilePos + 0];
                Sprite.Data[2] = SpriteBlock[FilePos + 5];
                Sprite.Data[3] = SpriteBlock[FilePos + 4];
                Sprite.Data[4] = SpriteBlock[FilePos + 3];
                Sprite.Data[5] = SpriteBlock[FilePos + 2];
//                Array.Copy(SpriteBlock, FilePos + 6, Sprite.Data, 0, 6);
                Sprites.Add(Sprite);
                FilePos += 6;
            }

            // Entrances.
            byte[] EntranceBlock = Blocks[5];
            int    EntranceCount = EntranceBlock.Length / 20;

            Entrances = new List <NSMBEntrance>(EntranceCount);
            FilePos   = 0;
            for (int EntIdx = 0; EntIdx < EntranceCount; EntIdx++)
            {
                NSMBEntrance Entrance = new NSMBEntrance();
                Entrance.X               = EntranceBlock[FilePos] | (EntranceBlock[FilePos + 1] << 8);
                Entrance.Y               = EntranceBlock[FilePos + 2] | (EntranceBlock[FilePos + 3] << 8);
                Entrance.CameraX         = EntranceBlock[FilePos + 4] | (EntranceBlock[FilePos + 5] << 8);
                Entrance.CameraY         = EntranceBlock[FilePos + 6] | (EntranceBlock[FilePos + 7] << 8);
                Entrance.Number          = EntranceBlock[FilePos + 8];
                Entrance.DestArea        = EntranceBlock[FilePos + 9];
                Entrance.ConnectedPipeID = EntranceBlock[FilePos + 10];
                Entrance.DestEntrance    = EntranceBlock[FilePos + 12];
                Entrance.Type            = EntranceBlock[FilePos + 14];
                Entrance.Settings        = EntranceBlock[FilePos + 15];
                Entrance.Unknown1        = EntranceBlock[FilePos + 16];
                Entrance.EntryView       = EntranceBlock[FilePos + 18];
                Entrance.Unknown2        = EntranceBlock[FilePos + 19];
                //Array.Copy(EntranceBlock, FilePos, Entrance.Data, 0, 20);
                Entrances.Add(Entrance);
                FilePos += 20;
            }

            // Views
            ByteArrayInputStream ViewBlock = new ByteArrayInputStream(Blocks[7]);
            ByteArrayInputStream CamBlock  = new ByteArrayInputStream(Blocks[1]);

            Views = new List <NSMBView>();
            while (ViewBlock.lengthAvailable(16))
            {
                Views.Add(NSMBView.read(ViewBlock, CamBlock));
            }

            // Zones
            ByteArrayInputStream ZoneBlock = new ByteArrayInputStream(Blocks[8]);

            Zones = new List <NSMBView>();
            while (ZoneBlock.lengthAvailable(12))
            {
                Zones.Add(NSMBView.readZone(ZoneBlock));
            }

            // Paths

            ByteArrayInputStream PathBlock     = new ByteArrayInputStream(Blocks[10]);
            ByteArrayInputStream PathNodeBlock = new ByteArrayInputStream(Blocks[12]);

            Paths = new List <NSMBPath>();
            while (!PathBlock.end())
            {
                Paths.Add(NSMBPath.read(PathBlock, PathNodeBlock, false));
            }

            PathBlock     = new ByteArrayInputStream(Blocks[9]);
            PathNodeBlock = new ByteArrayInputStream(Blocks[11]);

            ProgressPaths = new List <NSMBPath>();
            while (!PathBlock.end())
            {
                ProgressPaths.Add(NSMBPath.read(PathBlock, PathNodeBlock, true));
            }


            CalculateSpriteModifiers();
            repaintAllTilemap();
        }
Beispiel #20
0
        public static NSMBView read(ByteArrayInputStream inp, ByteArrayInputStream cam)
        {
            NSMBView v = new NSMBView();

            v.X = inp.readUShort();
            v.Y = inp.readUShort();
            v.Width = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            int camID = inp.readByte();
            v.Music = inp.readByte();
            v.Unknown1 = inp.readByte();
            v.Unknown2 = inp.readByte();
            v.Unknown3 = inp.readByte();
            v.Lighting = inp.readByte();
            v.FlagpoleID = inp.readByte();

            cam.seek(0);
            int camCount = (int)cam.available / 24;
//            Console.Out.WriteLine("CamCount: " + camCount);
            int goodCam = -1;
            for (int i = 0; i < camCount; i++)
            {
                cam.seek(i * 24 + 16);
                int thisCam = cam.readUShort();
//                Console.Out.WriteLine("Cam ID: " + thisCam);
                if (thisCam == camID)
                {
                    goodCam = i;
                    break;
                }
            }

            if (goodCam == -1)
                Console.Out.WriteLine("Warning: Could not find camera ID " + camID);
            else
            {
                cam.seek(goodCam * 24);
                v.CameraTop = cam.readInt();
                v.CameraBottom = cam.readInt();
                v.CameraTopSpin = cam.readInt();
                v.CameraBottomSpin = cam.readInt();
                cam.skip(2);
                v.CameraBottomStick = cam.readUShort();
            }
            return v;
        }
Beispiel #21
0
 private int Read(NSMBView v)
 {
     switch (PropNum) {
         case 1: return v.Number;
         case 2: return v.Music;
         case 3: return v.Unknown1;
         case 4: return v.Unknown2;
         case 5: return v.Unknown3;
         case 6: return v.Lighting;
         case 7: return v.FlagpoleID;
         case 8: return v.CameraTop;
         case 9: return v.CameraBottom;
         case 10: return v.CameraTopSpin;
         case 11: return v.CameraBottomSpin;
         case 12: return v.CameraBottomStick;
     }
     return 0;
 }
Beispiel #22
0
 private void Write(NSMBView v, int value)
 {
     switch (PropNum) {
         case 1: v.Number = value; break;
         case 2: v.Music = value; break;
         case 3: v.Unknown1 = value; break;
         case 4: v.Unknown2 = value; break;
         case 5: v.Unknown3 = value; break;
         case 6: v.Lighting = value; break;
         case 7: v.FlagpoleID = value; break;
         case 8: v.CameraTop = value; break;
         case 9: v.CameraBottom = value; break;
         case 10: v.CameraTopSpin = value; break;
         case 11: v.CameraBottomSpin= value; break;
         case 12: v.CameraBottomStick = value; break;
     }
 }