static string GetNameFast(uint addr)
        {
            if (!U.isSafetyOffset(addr))
            {
                return("");
            }
            uint textid = Program.ROM.u32(addr + 4);

            return(TextForm.DirectAndStripAllCode(textid));
        }
Esempio n. 2
0
        private void ParamSrc_ValueChanged(object sender, EventArgs e)
        {
            EventScript.OneCode code;
            int selectID;
            int argindex;

            if (!Get_Select_ParamSrc_Object(sender, out code, out selectID, out argindex))
            {
                return;
            }
            if (selectID < 0 || selectID > ScriptEditSetTables.Length)
            {
                return;
            }

            EventScript.Arg arg   = code.Script.Args[argindex];
            uint            value = EventScriptForm.WriteOneScriptEditSetTables(ScriptEditSetTables[selectID], arg, code);

            EventScriptForm.WriteAliasScriptEditSetTables(ScriptEditSetTables[selectID], arg, code);

            bool   isOrderOfHuman  = (this.ActiveControl == sender); //人間の操作によるものか
            string text            = "";
            Bitmap backgroundImage = null;
            string errorMessage    = "";

            if (arg.Type == EventScript.ArgType.TEXT ||
                arg.Type == EventScript.ArgType.CONVERSATION_TEXT ||
                arg.Type == EventScript.ArgType.SYSTEM_TEXT ||
                arg.Type == EventScript.ArgType.ONELINE_TEXT
                )
            {
                text = TextForm.DirectAndStripAllCode((value));
            }
            else if (arg.Type == EventScript.ArgType.POINTER_TEXT)
            {
                text = TextForm.Direct(value);
            }
            else if (arg.Type == EventScript.ArgType.POINTER_PROCS)
            {
                text = Program.AsmMapFileAsmCache.GetASMName(value, AsmMapFileAsmCache.ASMTYPE.NONE, out errorMessage);
            }
            else if (arg.Type == EventScript.ArgType.POINTER_ASM)
            {
                text = Program.AsmMapFileAsmCache.GetASMName(value, AsmMapFileAsmCache.ASMTYPE.THUMB, out errorMessage);
            }
            else if (arg.Type == EventScript.ArgType.FSEC)
            {//FSEC
                text = InputFormRef.GetFSEC(value);
            }
            else if (arg.Type == EventScript.ArgType.MAPXY)
            {//MAPXY
                if (arg.Size == 4)
                {
                    text = InputFormRef.GetMAPXY32(value);
                }
                else
                {
                    text = InputFormRef.GetMAPXY16(value);
                }
            }

            ScriptEditSetTables[selectID].ParamValue.Text            = text;
            ScriptEditSetTables[selectID].ParamValue.BackgroundImage = backgroundImage;
            ScriptEditSetTables[selectID].ParamValue.ErrorMessage    = errorMessage;

            if (isOrderOfHuman)
            {//現在このコントロールから値を入力している場合は、他のコントロールも連動して変更する
                this.ASMTextBox.Text = U.convertByteToStringDump(code.ByteData);

                //変更があったので、変更ボタンを光らせる.
                InputFormRef.WriteButtonToYellow(this.UpdateButton, true);
                InputFormRef.WriteButtonToYellow(this.NewButton, true);
            }
        }
        private string EventToTextOne(int number)
        {
            StringBuilder sb = new StringBuilder();

            EventScript.OneCode code = this.ProcsScript[number];
            for (int n = 0; n < code.ByteData.Length; n++)
            {
                sb.Append(U.ToHexString(code.ByteData[n]));
            }
            sb.Append("\t//");

            //スクリプト名.
            sb.Append(code.Script.Info[0]);

            for (int i = 1; i < code.Script.Info.Length; i += 2)
            {
                char symbol = ' ';
                if (code.Script.Info[i].Length > 2)
                {// [X みたいな文字列が入る. 2文字目のXが シンボル名.
                    symbol = code.Script.Info[i][1];
                }

                for (int n = 0; n < code.Script.Args.Length; n++)
                {
                    EventScript.Arg arg = code.Script.Args[n];
                    if (EventScript.IsFixedArg(arg))
                    {
                        continue;
                    }
                    if (symbol != arg.Symbol)
                    {
                        continue;
                    }

                    sb.Append("[");

                    uint   v;
                    string hexstring = EventScript.GetArg(code, n, out v);
                    sb.Append(arg.Name);
                    sb.Append(":");

                    sb.Append(hexstring);

                    if (arg.Type == EventScript.ArgType.TEXT ||
                        arg.Type == EventScript.ArgType.CONVERSATION_TEXT ||
                        arg.Type == EventScript.ArgType.SYSTEM_TEXT ||
                        arg.Type == EventScript.ArgType.ONELINE_TEXT ||
                        arg.Type == EventScript.ArgType.POINTER_TEXT
                        )
                    {
                        sb.Append(" ");
                        string text = TextForm.DirectAndStripAllCode((v));
                        if (text.Length > 30)
                        {//長いテキストは省略
                            sb.Append(U.escape_return(U.strimwidth(text, 0, 20)));
                        }
                        else
                        {//長くないテキストはすぐ横に表示
                            sb.Append(U.escape_return(text));
                        }
                    }
                    else if (arg.Type == EventScript.ArgType.UNIT)
                    {
                        sb.Append(" ");
                        sb.Append(UnitForm.GetUnitName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.CLASS)
                    {
                        sb.Append(" ");
                        sb.Append(ClassForm.GetClassName(v));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_PROCS)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, true, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.POINTER_ASM)
                    {
                        sb.Append(" ");
                        string dummy;
                        sb.Append(Program.AsmMapFileAsmCache.GetASMName(v, false, out dummy));
                    }
                    else if (arg.Type == EventScript.ArgType.FSEC)
                    {//FSEC
                        sb.Append(" ");
                        sb.Append(InputFormRef.GetFSEC(v));
                    }
                    sb.Append("]");
                    break;
                }
            }
            sb.AppendLine("");

            return(sb.ToString());
        }