Example #1
0
        public void Update(int number, WClip clip, EditorHAMFile hamFile, PIGFile piggyFile, Palette palette)
        {
            isLocked              = true;
            wclipID               = number;
            this.clip             = clip;
            this.hamFile          = hamFile;
            this.palette          = palette;
            TotalTimeTextBox.Text = clip.PlayTime.ToString();
            UIUtil.SafeFillComboBox(OpenSoundComboBox, clip.OpenSound + 1);
            UIUtil.SafeFillComboBox(CloseSoundComboBox, clip.CloseSound + 1);
            FilenameTextBox.Text  = new string(clip.Filename);
            NumFramesTextBox.Text = clip.NumFrames.ToString();

            ExplodesCheckBox.Checked      = clip.Explodes;
            ShootableCheckBox.Checked     = clip.Blastable;
            OnPrimaryTMapCheckBox.Checked = clip.PrimaryTMap;
            HiddenCheckBox.Checked        = clip.SecretDoor;

            if (!transactionManager.TransactionInProgress)
            {
                FrameSpinner.Value = 0;
                UpdateWallFrame(0);
            }
            else
            {
                UpdateWallFrame((int)FrameSpinner.Value);
            }
            isLocked = false;
        }
Example #2
0
        public void Update(EditorHAMFile datafile, PIGFile piggyFile, int textureID, TMAPInfo info)
        {
            isLocked       = true;
            this.textureID = textureID;
            this.datafile  = datafile;
            this.piggyFile = piggyFile;
            this.info      = info;

            TextureIDTextBox.Text        = datafile.Textures[textureID].ToString();
            txtTexLight.Text             = info.Lighting.ToString();
            txtTexDamage.Text            = info.Damage.ToString();
            cbTexEClip.SelectedIndex     = info.EClipNum + 1;
            txtTexSlideU.Text            = GetFloatFromFixed88(info.SlideU).ToString();
            txtTexSlideV.Text            = GetFloatFromFixed88(info.SlideV).ToString();
            TextureDestroyedTextBox.Text = info.DestroyedID.ToString();
            cbTexLava.Checked            = info.Volatile;
            cbTexWater.Checked           = info.Water;
            cbTexForcefield.Checked      = info.ForceField;
            cbTexRedGoal.Checked         = info.RedGoal;
            cbTexBlueGoal.Checked        = info.BlueGoal;
            cbTexHoardGoal.Checked       = info.HoardGoal;

            UpdatePictureBox(PiggyBitmapUtilities.GetBitmap(piggyFile, palette, datafile.Textures[textureID]), pbTexPrev);
            isLocked = false;
        }
Example #3
0
 public TMapInfoEClipTransaction(string label, int page, int tab, EditorHAMFile datafile, PIGFile pigfile, int index, int newEClip) : base(label, null, "", page, tab)
 {
     newValue      = newEClip;
     tmapIndex     = index;
     this.datafile = datafile;
     this.pigfile  = pigfile;
 }
 public TMapInfoTransaction(string label, int page, int tab, EditorHAMFile datafile, PIGFile pigfile, int index, int newtexture) : base(label, null, "", page, tab)
 {
     newValue = Math.Max(0, Math.Min(pigfile.Bitmaps.Count-1, newtexture));
     this.index = index;
     this.datafile = datafile;
     this.pigfile = pigfile;
 }
Example #5
0
        public HAMEditor(EditorHAMFile data, StandardUI host, PIGFile piggyFile, Palette palette, SaveHandler saveHandler)
        {
            InitializeComponent();

            this.palette   = palette;
            this.piggyFile = piggyFile;

            datafile         = data;
            this.host        = host;
            this.saveHandler = saveHandler;

            texturePanel        = new TMAPInfoPanel(transactionManager); components.Add(texturePanel);
            texturePanel.Dock   = DockStyle.Fill;
            vclipPanel          = new VClipPanel(transactionManager); components.Add(vclipPanel);
            vclipPanel.Dock     = DockStyle.Fill;
            eclipPanel          = new EClipPanel(transactionManager); components.Add(eclipPanel);
            eclipPanel.Dock     = DockStyle.Fill;
            wclipPanel          = new WClipPanel(transactionManager); components.Add(wclipPanel);
            wclipPanel.Dock     = DockStyle.Fill;
            robotPanel          = new RobotPanel(transactionManager, 4); components.Add(robotPanel);
            robotPanel.Dock     = DockStyle.Fill;
            weaponPanel         = new WeaponPanel(transactionManager, 5); components.Add(weaponPanel);
            weaponPanel.Dock    = DockStyle.Fill;
            polymodelPanel      = new PolymodelPanel(transactionManager, 6, piggyFile, palette, data); components.Add(polymodelPanel);
            polymodelPanel.Dock = DockStyle.Fill;
            soundPanel          = new SoundPanel(transactionManager, 7, datafile, host.DefaultSoundFile); components.Add(soundPanel);
            soundPanel.Dock     = DockStyle.Fill;
            reactorPanel        = new ReactorPanel(transactionManager, 8); components.Add(reactorPanel);
            reactorPanel.Dock   = DockStyle.Fill;
            TextureTabPage.Controls.Add(texturePanel);
            VClipTabPage.Controls.Add(vclipPanel);
            EffectsTabPage.Controls.Add(eclipPanel);
            DoorTabPage.Controls.Add(wclipPanel);
            RobotTabPage.Controls.Add(robotPanel);
            WeaponTabPage.Controls.Add(weaponPanel);
            ModelTabPage.Controls.Add(polymodelPanel);
            SoundTabPage.Controls.Add(soundPanel);
            ReactorTabPage.Controls.Add(reactorPanel);

            string currentFilename = "Untitled";

            if (saveHandler != null)
            {
                currentFilename = saveHandler.GetUIName();
            }

            this.Text = string.Format("{0} - HAM Editor", currentFilename);

            transactionManager.undoEvent += DoUndoEvent;

            datafile.CompatObjBitmaps = StandardUI.options.GetOption("CompatObjBitmaps", bool.FalseString) == bool.TrueString;
        }
Example #6
0
        public HAMEditor(EditorHAMFile data, StandardUI host, PIGFile piggyFile, Palette palette, string filename)
        {
            InitializeComponent();
            this.glControl1             = new OpenTK.GLControl();
            this.glControl1.BackColor   = System.Drawing.Color.Black;
            this.glControl1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.glControl1.Location    = new System.Drawing.Point(452, 61);
            this.glControl1.Name        = "glControl1";
            this.glControl1.Size        = new System.Drawing.Size(256, 256);
            this.glControl1.TabIndex    = 0;
            this.glControl1.VSync       = false;
            this.glControl1.Load       += new System.EventHandler(this.glControl1_Load);
            this.glControl1.Paint      += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);

            texturePanel      = new TMAPInfoPanel(transactionManager); components.Add(texturePanel);
            texturePanel.Dock = DockStyle.Fill;
            vclipPanel        = new VClipPanel(transactionManager); components.Add(vclipPanel);
            vclipPanel.Dock   = DockStyle.Fill;
            eclipPanel        = new EClipPanel(transactionManager); components.Add(eclipPanel);
            eclipPanel.Dock   = DockStyle.Fill;
            wclipPanel        = new WClipPanel(transactionManager); components.Add(wclipPanel);
            wclipPanel.Dock   = DockStyle.Fill;
            robotPanel        = new RobotPanel(); components.Add(robotPanel);
            robotPanel.Dock   = DockStyle.Fill;
            weaponPanel       = new WeaponPanel(); components.Add(weaponPanel);
            weaponPanel.Dock  = DockStyle.Fill;
            TextureTabPage.Controls.Add(texturePanel);
            VClipTabPage.Controls.Add(vclipPanel);
            EffectsTabPage.Controls.Add(eclipPanel);
            DoorTabPage.Controls.Add(wclipPanel);
            RobotTabPage.Controls.Add(robotPanel);
            WeaponTabPage.Controls.Add(weaponPanel);

            this.palette   = palette;
            this.piggyFile = piggyFile;

            if (!noPMView)
            {
                this.ModelTabPage.Controls.Add(this.glControl1);
            }
            datafile        = data;
            this.host       = host;
            modelRenderer   = new ModelRenderer(datafile, piggyFile, palette);
            currentFilename = filename;
            this.Text       = string.Format("{0} - HAM Editor", currentFilename);

            transactionManager.undoEvent += DoUndoEvent;
        }
Example #7
0
        public ElementList(EditorHAMFile datafile, HAMType type)
        {
            InitializeComponent();
            switch (type)
            {
            case HAMType.VClip:
                foreach (String name in datafile.VClipNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;

            case HAMType.EClip:
                foreach (String name in datafile.EClipNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;

            case HAMType.Robot:
                foreach (String name in datafile.RobotNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;

            case HAMType.Weapon:
                foreach (String name in datafile.WeaponNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;

            case HAMType.Model:
                foreach (String name in datafile.ModelNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;

            case HAMType.Sound:
                foreach (String name in datafile.SoundNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;
            }
        }
Example #8
0
        public ElementList(EditorHAMFile datafile, HAMType type)
        {
            InitializeComponent();
            switch (type)
            {
            case HAMType.VClip:
                foreach (VClip vclip in datafile.VClips)
                {
                    ElementListBox.Items.Add(vclip.Name);
                }
                break;

            case HAMType.EClip:
                foreach (EClip clip in datafile.EClips)
                {
                    ElementListBox.Items.Add(clip.Name);
                }
                break;

            case HAMType.Robot:
                foreach (Robot robot in datafile.Robots)
                {
                    ElementListBox.Items.Add(robot.Name);
                }
                break;

            case HAMType.Weapon:
                foreach (Weapon weapon in datafile.Weapons)
                {
                    ElementListBox.Items.Add(weapon.Name);
                }
                break;

            case HAMType.Model:
                foreach (Polymodel model in datafile.Models)
                {
                    ElementListBox.Items.Add(model.Name);
                }
                break;

            case HAMType.Sound:
                foreach (String name in datafile.SoundNames)
                {
                    ElementListBox.Items.Add(name);
                }
                break;
            }
        }
Example #9
0
        public SoundPanel(TransactionManager transactionManager, int tabPage, EditorHAMFile datafile, SNDFile soundFile)
        {
            InitializeComponent();
            this.transactionManager = transactionManager;
            this.tabPage            = tabPage;
            this.datafile           = datafile;

            SoundIDComboBox.Items.Clear();
            SoundIDComboBox.Items.Add("None");

            //TODO: This is slow, but is only done once for now. Should be fixed, though.
            foreach (SoundData sound in soundFile.Sounds)
            {
                SoundIDComboBox.Items.Add(sound.Name);
            }
        }
Example #10
0
 public DeleteTMAPInfoTransaction(EditorHAMFile hamfile, int num, int tab) : base("Delete texture", null, null, num, tab)
 {
     deleteNum = num;
     datafile  = hamfile;
 }
        public List <int> LoadPolymodelTextures(Polymodel model, PIGFile pigFile, Palette palette, EditorHAMFile hamFile)
        {
            List <int> textureIDs = new List <int>();
            Bitmap     image; EClip clip;

            foreach (string textureName in model.TextureList)
            {
                if (hamFile.EClipNameMapping.ContainsKey(textureName.ToLower()))
                {
                    clip  = hamFile.EClipNameMapping[textureName.ToLower()];
                    image = PiggyBitmapUtilities.GetBitmap(pigFile, palette, clip.Clip.Frames[0]);
                }
                else
                {
                    image = PiggyBitmapUtilities.GetBitmap(pigFile, palette, textureName);
                }
                textureIDs.Add(LoadTexture(image));
            }

            return(textureIDs);
        }
Example #12
0
        public static EditorHAMFile TranslatePIGToHam(Descent1PIGFile pigfile, PIGFile convertedPigFile)
        {
            HAMFile file = new HAMFile();

            foreach (ushort texture in pigfile.Textures)
            {
                file.Textures.Add(texture);
            }
            foreach (TMAPInfo tmapInfo in pigfile.TMapInfo)
            {
                file.TMapInfo.Add(tmapInfo);
            }

            for (int i = 0; i < pigfile.SoundIDs.Length; i++)
            {
                file.Sounds[i] = pigfile.SoundIDs[i];
            }
            for (int i = 0; i < pigfile.AltSounds.Length; i++)
            {
                file.AltSounds[i] = pigfile.AltSounds[i];
            }
            foreach (VClip clip in pigfile.VClips)
            {
                file.VClips.Add(clip);
            }
            foreach (EClip clip in pigfile.EClips)
            {
                file.EClips.Add(clip);
            }
            foreach (WClip clip in pigfile.WClips)
            {
                file.WClips.Add(clip);
            }
            foreach (Robot robot in pigfile.Robots)
            {
                file.Robots.Add(robot);
            }
            foreach (JointPos joint in pigfile.Joints)
            {
                file.Joints.Add(joint);
            }
            foreach (Weapon weapon in pigfile.Weapons)
            {
                if (weapon.ModelNum == 255)
                {
                    weapon.ModelNum = 0;
                }
                if (weapon.ModelNumInner == 255)
                {
                    weapon.ModelNumInner = 0;
                }
                file.Weapons.Add(weapon);
            }
            foreach (Polymodel model in pigfile.Models)
            {
                if (model != null)
                {
                    file.Models.Add(model);
                }
            }
            foreach (ushort gauge in pigfile.Gauges)
            {
                file.Gauges.Add(gauge);
                file.GaugesHires.Add(gauge);
            }
            foreach (ushort cockpit in pigfile.Cockpits)
            {
                file.Cockpits.Add(cockpit);
            }
            for (int i = 0; i < pigfile.ObjBitmaps.Length; i++)
            {
                file.ObjBitmaps.Add(pigfile.ObjBitmaps[i]);
                file.ObjBitmapPointers.Add(pigfile.ObjBitmapPointers[i]);
            }
            foreach (Powerup powerup in pigfile.Powerups)
            {
                file.Powerups.Add(powerup);
            }
            file.PlayerShip = pigfile.PlayerShip;
            file.Reactors.Add(pigfile.reactor);
            file.FirstMultiBitmapNum = pigfile.FirstMultiBitmapNum;
            for (int i = 0; i < pigfile.BitmapXLATData.Length; i++)
            {
                file.BitmapXLATData[i] = pigfile.BitmapXLATData[i];
            }

            EditorHAMFile res = new EditorHAMFile(file, convertedPigFile);

            res.CreateLocalLists();
            res.GenerateDefaultNamelists();
            res.TranslateData();
            return(res);
        }
Example #13
0
        public PolymodelPanel(TransactionManager transactionManager, int tabPage, PIGFile piggyFile, Palette palette, EditorHAMFile datafile = null)
        {
            InitializeComponent();
            this.transactionManager = transactionManager;
            this.tabPage            = tabPage;

            //Create the model viewer baround the template control
            ModelViewControl             = new OpenTK.GLControl();
            ModelViewControl.BackColor   = System.Drawing.Color.Black;
            ModelViewControl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            ModelViewControl.Location    = new System.Drawing.Point(452, 61);
            ModelViewControl.Anchor      = GLControlStandin.Anchor;
            ModelViewControl.Name        = "glControl1";
            ModelViewControl.Size        = new System.Drawing.Size(256, 256);
            ModelViewControl.TabIndex    = 0;
            ModelViewControl.VSync       = false;
            ModelViewControl.Load       += new System.EventHandler(this.ModelViewControl_Load);
            ModelViewControl.Paint      += new System.Windows.Forms.PaintEventHandler(this.ModelViewControl_Paint);
            Controls.Add(ModelViewControl);

            if (datafile != null)
            {
                modelRenderer = new ModelRenderer(datafile, piggyFile, palette);
            }
            else
            {
                modelRenderer = new ModelRenderer(piggyFile, palette);
            }
        }
 public DeleteVClipTransaction(EditorHAMFile hamfile, int num, int tab) : base("Delete vclip", null, null, num, tab)
 {
     deleteNum = num;
     datafile  = hamfile;
 }