예제 #1
0
        public RoomDlg(Room room, AdvData data, ViewMode mode, MainForm parent, Form mdiParent)
        {
            InitializeComponent();
            mRoom = room;
            mData = data;
            mMode = mode;
            updateRoom();

            this.ClientSize = new Size(data.WindowXRes, data.Settings.Resolution.y);
            this.Paint += new PaintEventHandler(RoomDlg_Paint);
            this.MouseDown += new MouseEventHandler(RoomDlg_MouseDown);
            this.MouseMove += new MouseEventHandler(RoomDlg_MouseMove);
            this.MouseUp += new MouseEventHandler(RoomDlg_MouseUp);
            this.DoubleClick += new EventHandler(RoomDlg_DoubleClick);
            this.KeyPress += new KeyPressEventHandler(RoomDlg_KeyPress);
            this.FormClosed += new FormClosedEventHandler(RoomDlg_FormClosed);
            this.DragOver += new DragEventHandler(RoomDlg_DragOver);
            this.DragDrop += new DragEventHandler(RoomDlg_DragDrop);
            mControl = new RoomCtrlDlg(room, data, parent);
            mControl.MdiParent = mdiParent;
            mControl.Location = new Point(Screen.GetWorkingArea(this).Width-mControl.Width, 0);
            mControl.StartPosition = FormStartPosition.Manual;
            mControl.Show();
            mControl.RedrawRoom += new RoomCtrlDlg.RedrawEventHandler(mControl_RedrawRoom);
            mTimer = new Timer();
            mTimer.Tick += new EventHandler(mTimer_Tick);
            mTimer.Interval = 50;
            mTimer.Start();
            mOwner = parent;
        }
예제 #2
0
 public CharacterInstance(AdvCharacter chr, AdvData data)
     : base(chr)
 {
     Character = chr;
     mAdvData = data;
     setName(chr.Name);
 }
예제 #3
0
 public MouseIcons(AdvData data)
 {
     InitializeComponent();
     mData = data;
     this.stateFrameImage1.StateChanged += new StateFrameImage.StateEventHandler(stateFrameImage1_StateChanged);
     this.stateFrameImage1.PictureBoxSize = new Size(96, 96);
     this.stateFrameImage1.PictureChanged += new EventHandler(stateFrameImage1_PictureChanged);
     this.command.SelectedIndexChanged += new EventHandler(command_SelectedIndexChanged);
     this.FormClosed += new FormClosedEventHandler(MouseIcons_FormClosed);
     this.rc_change.CheckedChanged += new EventHandler(rc_change_CheckedChanged);
     this.command.Items.Add("walkto (standard)");
     this.command.Items.Add("loading icon");
     foreach (KeyValuePair<string,string> pair in mData.Settings.Commands)
     {
         this.command.Items.Add(pair.Key);
     }
     this.command.SelectedIndex = 0;
     string[] labels = new string[10] { "S", "1", "2", "3", "4", "5", "6", "7", "8", "L"};
     this.stateFrameImage1.setStateLables(labels);
     this.stateFrameImage1.Data = mData.Cursor;
     switch (data.Settings.RightClick)
     {
         case 0:
             this.rc_change.Checked = true;
             break;
         case 1:
             this.rc_icon_one.Checked = true;
             break;
         case 2:
             this.rc_nothing.Checked = true;
             break;
     }
     this.mouse_wheel.Checked = data.Settings.UseMouseWheel;
 }
 public AdvFileWriter(AdvData data, TreeView gamepool, TreeView mediapool, string zipPassword)
 {
     ZipConstants.DefaultCodePage = 1252;
     mData = data;
     mGamepool = gamepool;
     mMediapool = mediapool;
     mZipPwd = zipPassword;
 }
 public AdvFileReader(AdvData data, TreeView mediapool, TreeView gamepool, Persistence persistence, string path)
 {
     ZipConstants.DefaultCodePage = 1252;
     mAdv = data;
     mMediaPool = mediapool;
     mGamePool = gamepool;
     mPath = path;
 }
예제 #6
0
        public CharacterDlg(AdvCharacter chr, AdvData data)
        {
            InitializeComponent();
            this.stateFrameImage1.ClientSizeChanged += new EventHandler(stateFrameImage1_ClientSizeChanged);
            mCharacter = chr;
            updateCharacter();
            string[] labels = new string[36];
            labels[0] = "Stand front";
            labels[1] = "Stand back";
            labels[2] = "Stand right";
            labels[3] = "Walk front";
            labels[4] = "Walk back";
            labels[5] = "Walk right";
            labels[6] = "Talk, Stand front";
            labels[7] = "Talk, Stand back";
            labels[8] = "Talk, Stand right";
            labels[9] = "Talk, Walk front";
            labels[10] = "Talk, Walk back";
            labels[11] = "Talk, Walk right";
            labels[12] = "Bored 1";
            labels[13] = "Bored 2";
            labels[14] = "Pickup front";
            labels[15] = "Pickup right";
            for (int i = 16; i < 36; ++i)
            {
                labels[i] = chr.getStateName(i);
            }
            this.font.Items.Add("Default");
            for (int i = 0; i < data.Settings.Fonts.Count; ++i)
            {
                FontInfo fi = (FontInfo)data.Settings.Fonts[i];
                this.font.Items.Add(fi.name+ " ("+fi.size+")");
            }
            for (int i = 1; i < 10; ++i)
            {
                this.walkspeed.Items.Add(i);
            }
            this.stateFrameImage1.setStateLables(labels);
            this.stateFrameImage1.Data = chr;
            this.stateFrameImage1.BackgroundColor = data.Persistence.CharBackColor;

            this.text_color.BackColor = Color.FromArgb(Utilities.convertColor(chr.TextColor));
            this.font.SelectedIndex = chr.Font;
            this.walksound.Text = chr.Walksound;
            this.walkspeed.SelectedIndex = chr.WalkSpeed - 1;
            this.nozoom.Checked = chr.NoZoom;
            this.leftanim.Checked = chr.RealLeftAnimations;
            this.memory_resistant.Checked = chr.MemoryReistent;
            this.ghostmode.Checked = chr.Ghost;
            this.startzoom.Value = chr.Zoom;

            mData = data;
        }
예제 #7
0
        public Fonts(AdvData data)
        {
            InitializeComponent();
            mData = data;
            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily fam in fonts.Families)
            {
                if (fam.IsStyleAvailable(FontStyle.Regular))
                    font.Items.Add(fam.Name);
            }
            mFonts = data.Settings.Fonts;
            fontlist.SelectedIndexChanged += new EventHandler(fontlist_SelectedIndexChanged);
            preview.Paint += new PaintEventHandler(preview_Paint);
            font.DrawItem += new DrawItemEventHandler(font_DrawItem);

            for (int i = 0; i < mFonts.Count; ++i)
            {
                fontlist.Items.Add("");
                setListName(i, mFonts[i] as FontInfo);
            }

            charset.Items.Add("Western");
            charset.Items.Add("East european");
            charset.Items.Add("Russian");
            charset.Items.Add("Greek");
            charset.Items.Add("Turkish");
            charset.Items.Add("Arabic");
            charset.Items.Add("Hebrew");
            charset.Items.Add("Vietnamese");
            charset.Items.Add("Thai");
            charset.Items.Add("Baltic");
            charset.Items.Add("Japanese ShiftJIS");
            charset.Items.Add("Dos OEM");
            charset.Items.Add("Symbol");

            for (int i = 6; i <= 40; ++i)
            {
                fontsize.Items.Add(Convert.ToString(i));
            }

            for (int i = -5; i <= 5; ++i)
            {
                letterspacing.Items.Add(Convert.ToString(i));
            }

            if (fontlist.Items.Count > 0)
                fontlist.SelectedIndex = 0;
            else
            {
                //TODO disable controls
            }
        }
예제 #8
0
 public LanguageDlg(AdvData data)
 {
     InitializeComponent();
     mData = data;
     Language orig = mData.Languages["origin"];
     ArrayList speech = orig.getWords(Language.Section.Speech);
     ArrayList speechsounds = orig.getWords(Language.Section.Speech_Sounds);
     for (int i = 0; i < speech.Count; ++i){
         string origtxt = (string)speech[i];
         string origvoice = (string)speechsounds[i];
         speechGrid.Rows.Add(origvoice, origtxt);
     }
     ArrayList offspeech = orig.getWords(Language.Section.Offspeech);
     ArrayList offspeechsounds = orig.getWords(Language.Section.Offspeech_Sounds);
     for (int i = 0; i < offspeech.Count; ++i)
     {
         string origtxt = (string)offspeech[i];
         string origvoice = (string)offspeechsounds[i];
         offspeechGrid.Rows.Add(origvoice, origtxt);
     }
     ArrayList showinfo = orig.getWords(Language.Section.Showinfo);
     foreach (string str in showinfo)
     {
         showinfoGrid.Rows.Add("", str);
     }
     ArrayList textout = orig.getWords(Language.Section.Textout);
     foreach (string str in textout)
     {
         textoutGrid.Rows.Add("", str);
     }
     ArrayList setstring = orig.getWords(Language.Section.Setstring);
     foreach (string str in setstring)
     {
         setstringGrid.Rows.Add("", str);
     }
     ArrayList textscenes = orig.getWords(Language.Section.Textscenes);
     foreach (string str in textscenes)
     {
         textsceneGrid.Rows.Add("", str);
     }
     ArrayList commands = orig.getWords(Language.Section.Commands);
     foreach (string str in commands)
     {
         commandsGrid.Rows.Add("", str);
     }
 }
예제 #9
0
 public RoomCtrlDlg(Room room, AdvData data, MainForm mf)
 {
     InitializeComponent();
     mRoom = room;
     mData = data;
     mParent = mf;
     for (int i = 1; i <= 9; ++i)
     {
         zoomfactor.Items.Add(i);
     }
     for (int i = 0; i <= 10; ++i)
     {
         obj_state.Items.Add(i);
     }
     zoomfactor.SelectedItem = mRoom.Zoom;
     doublewalkmap.Checked = mRoom.DoubleWalkmap;
     roomwidth.Minimum = data.WindowXRes;
     roomwidth.Maximum = data.Settings.Resolution.x * 3;
     roomheight.Minimum = data.Settings.Resolution.y;
     roomheight.Maximum = data.Settings.Resolution.y * 2;
     roomwidth.Value = mRoom.Size.x < roomwidth.Minimum ? roomwidth.Minimum : mRoom.Size.x;
     roomheight.Value = mRoom.Size.y;
     light_color.BackColor = mRoom.Lighting;
     mDragOffset.x = -1;
     scroller.Paint += new PaintEventHandler(scroller_Paint);
     scroller.MouseDown += new MouseEventHandler(scroller_MouseDown);
     scroller.MouseMove += new MouseEventHandler(scroller_MouseMove);
     scroller.MouseUp += new MouseEventHandler(scroller_MouseUp);
     roomwidth.ValueChanged += new EventHandler(roomwidth_ValueChanged);
     roomheight.ValueChanged += new EventHandler(roomheight_ValueChanged);
     mFxShapes = new FxShapeTabCtrl(mRoom.FXShapes, this);
     mFxShapes.Visible = false;
     mFxShapes.Location = objectgroup.Location;
     this.Controls.Add(mFxShapes);
     mInvSpacing = new NumericUpDown();
     mInvSpacing.Visible = false;
     mInvSpacing.Location = objectgroup.Location;
     mInvSpacing.Value = room.InvSpacing;
     mInvSpacing.Minimum = 2;
     mInvSpacing.Maximum = 20;
     this.Controls.Add(mInvSpacing);
     mInvSpacing.ValueChanged += new EventHandler(mInvSpacing_ValueChanged);
 }
예제 #10
0
 public ScriptDlg(Script scr, AdvData data)
 {
     mData = data;
     mScript = scr;
     InitializeComponent();
     int[] tabs = { 20, 40, 60, 80, 100, 120, 140 };
     scripttext.SelectionTabs = tabs;
     linenumberbox.Paint += new PaintEventHandler(linenumberbox_Paint);
     scripttext.VScroll += new EventHandler(scripttext_VScroll);
     scripttext.TextChanged += new EventHandler(scripttext_TextChanged);
     scripttext.MouseDown += new MouseEventHandler(scripttext_MouseDown);
     scripttext.KeyUp += new KeyEventHandler(scripttext_KeyUp);
     scripttext.KeyDown += new KeyEventHandler(scripttext_KeyDown);
     matches.SelectedIndexChanged += new EventHandler(matches_SelectedIndexChanged);
     this.FormClosed += new FormClosedEventHandler(ScriptDlg_FormClosed);
     //scripttext
     updateScript();
     //parsing stuff
     mParser = new PcdkParser(data.Settings.ScriptingLanguage);
     mParser.initSyntax();
     mParser.Comment += new PcdkParser.commentCB(colorComment);
     mParser.Function += new PcdkParser.functionCB(colorFunction);
     mParser.ParseError += new PcdkParser.parseError(mParser_ParseError);
     mKeywordFont = new Font(scripttext.Font, FontStyle.Bold);
     parseScript();
     if (!mHistory.Contains(scr))
     {
         if (mHistory.Count > 4)
             mHistory.RemoveAt(4);
         mHistory.Insert(0, scr);
     }
     else
     {
         mHistory.Remove(scr);
         mHistory.Insert(0, scr);
     }
 }
예제 #11
0
 public static void endRefresh(AdvData data)
 {
     for (int i = 0; i < (int)Language.Section.NumSections; ++i)
     {
         ArrayList encountersToRemove = new ArrayList();
         for (int j = 0; j < mEncountered[i].Count; ++j)
         {
             if (!(bool)mEncountered[i][j])
             {
                 encountersToRemove.Add(j);
             }
         }
         for (int c = encountersToRemove.Count-1; c >= 0; --c)
         {
             int removeMe = (int)encountersToRemove[c];
             mEncountered[i].RemoveRange(removeMe, 1);
             foreach (KeyValuePair<string,Language> langpair in data.Languages)
             {
                 Language lang = langpair.Value;
                 lang.mSections[i].RemoveRange(removeMe, 1);
             }
         }
     }
 }
예제 #12
0
 public AdvCharacter(AdvData data, int numStates)
 {
     mData = data;
     Name = "Character" + (mData.NumCharacters+1);
     mWalkSpeed = 5;
     mZoom = 100;
     mTextColor = (UInt32)(mRand.Next(255) << 16 | mRand.Next(255) << 8 | mRand.Next(255));
     for (int i = 1; i <= numStates - 16; ++i)
     {
         mExtraStateNames.Add("");
     }
     for (int state = 0; state < numStates; ++state)
     {
         CharacterState cst = new CharacterState();
         cst.frames = new System.Collections.ArrayList();
         cst.size = new Vec2i(120, 200);
         cst.basepoint = new Vec2i(60, 198);
         cst.fpsDivider = 20;
         Add(cst);
     }
 }
예제 #13
0
 public AdvCharacter(AdvData data)
 {
     mData = data;
 }
예제 #14
0
 public static string toScriptName(int x, int y, string room, AdvData data)
 {
     if (data != null && data.Reader.MajorVersion < 3)
         return String.Format("{0:D2}{1:D2}{2}", x + 1, y + 1, room);
     else
         return String.Format("#{0:D3}{1:D3}{2}", x + 1, y + 1, room);
 }
예제 #15
0
 public Item(AdvData data, int numStates)
 {
     mData = data;
     Name = "Item" + (mData.NumItems+1);
     for (int state = 0; state < numStates; ++state)
     {
         ItemState ist;
         ist.frames = new System.Collections.ArrayList();
         ist.scripts = new System.Collections.ArrayList();
         ist.fpsDivider = 20;
         Add(ist);
     }
 }
예제 #16
0
 public Item(AdvData data)
 {
     mData = data;
 }
예제 #17
0
 public Cursor(AdvData data)
 {
     mData = data;
 }
예제 #18
0
 public AdvObject(AdvData data, int numStates)
 {
     mData = data;
     Name = "Object" + (mData.NumObjects + 1);
     mSize = new Vec2i(100, 100);
     for (int state = 0; state < numStates; ++state)
     {
         ObjectState ost = new ObjectState();
         ost.frames = new System.Collections.ArrayList();
         ost.fpsDivider = 20;
         Add(ost);
     }
 }
예제 #19
0
 public AdvObject(AdvData data)
 {
     mData = data;
 }
예제 #20
0
        public AdvFileReader(string filename, TreeView mediapool, TreeView gamepool, Persistence persistence)
            : this(persistence)
        {
            ZipConstants.DefaultCodePage = 1252;
            mAdv = new AdvData(this, persistence);
            mMediaPool = mediapool;
            mGamePool = gamepool;

            if (System.IO.Path.GetExtension(filename) == ".dat")
            {
                mIsAdv = false;
                mAdv.Settings.Projectname = "game";
                string dir = System.IO.Path.GetDirectoryName(filename);
                try
                {
                    FileInfo[] files = System.IO.Directory.GetParent(dir).GetFiles("*.exe");
                    foreach (FileInfo file in files)
                    {
                        if (file.Name != "Setup.exe")
                        {
                            mAdv.Settings.Projectname = System.IO.Path.GetFileNameWithoutExtension(file.Name);
                        }
                    }
                }
                catch (DirectoryNotFoundException e)
                {
                    throw new FileNotFoundException("cannot load game.dat: Directory not found", e);
                }
            }
            else
            {
                mIsAdv = true;
                mAdv.Settings.Projectname = Path.GetFileNameWithoutExtension(filename);
            }

            ZipInputStream zis = new ZipInputStream(File.OpenRead(filename));
            ZipEntry entry;
            int ver_major = 0, ver_minor = 0;
            while ((entry = zis.GetNextEntry()) != null)
            {
                if (Path.GetExtension(entry.Name) == ".001")
                {
                    readSettings(zis, out ver_major, out ver_minor);
                }
                else if (Path.GetExtension(entry.Name) == ".002")
                {
                    readObjects(zis, ver_major, ver_minor);
                }
                else if (Path.GetExtension(entry.Name) == ".003")
                {
                    readScripts(zis);
                }
                else if (Path.GetExtension(entry.Name) == ".004")
                {
                    readLanguages(zis);
                }
                else if (Path.GetExtension(entry.Name) == ".005")
                {
                    readPassword(zis);
                }
                else if (Path.GetExtension(entry.Name) == ".010")
                {
                    readAdvancedSettings(zis);
                }
            }
            zis.Close();
            mPath = System.IO.Path.GetDirectoryName(filename);
        }
예제 #21
0
 public Room(AdvData data)
 {
     mData = data;
     Name = "Room" + (data.NumRooms + 1);
     Size = new Vec2i(data.WindowXRes, data.Settings.Resolution.y);
     Depthmap = new Vec2i(5, 10);
     Zoom = 3;
     Background = "";
     ParallaxBackground = "";
     FXShapes = new ArrayList();
     for (int i = 0; i < 3; ++i)
     {
         FxShape fs = new FxShape(i);
         FXShapes.Add(fs);
     }
     Vec2i wmsize = data.Settings.Resolution / data.WalkGridSize;
     wmsize.x *= 3 * 2;
     wmsize.y *= 2 * 2;
     Walkmap = new WalkMapEntry[wmsize.x, wmsize.y];
     Lighting = Color.White;
     InvScale = new Vec2f(1.0f, 1.0f);
     InvSpacing = 10;
 }
예제 #22
0
 public Settings(AdvData data)
 {
     InitializeComponent();
     mData = data;
     setControls();
 }
예제 #23
0
 public ObjectInstance(AdvObject obj, AdvData data)
     : base(obj)
 {
     Object = obj;
     mAdvData = data;
 }
예제 #24
0
 public static void drawDepthHandle(Graphics g, AdvData data, Vec2i position, float depth, Color color)
 {
     int ycenter = (int)(depth * data.WalkGridSize/2 - data.WalkGridSize / 4);
     Pen cp = new Pen(color);
     g.DrawLine(cp, position.x, position.y, position.x, ycenter);
     g.FillRectangle(new SolidBrush(color), position.x - 2, ycenter - 2, 5, 5);
     g.DrawRectangle(cp, position.x - 5, ycenter - 5, 10, 10);
 }
 public CommandsAndBools(AdvData data)
 {
     InitializeComponent();
     mData = data;
     setControls();
 }