private void removeToolStripButton_Click(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 0) { return; } int selectedIndex = listView1.SelectedIndices.OfType <int>().FirstOrDefault(); if (selectedIndex >= 0 && selectedIndex < this.wordWrapOptions.WordWrapOptionsProfiles.Count && this.wordWrapOptions.WordWrapOptionsProfiles.Count > 1) { var profile = this.wordWrapOptions.WordWrapOptionsProfiles.GetOrNull(selectedIndex); var item = this.listView1.Items[selectedIndex]; item.Tag = null; if (currentProfile == profile) { currentProfile = null; } listView1.Items.RemoveAt(selectedIndex); this.wordWrapOptions.WordWrapOptionsProfiles.RemoveAt(selectedIndex); var focusedItem = listView1.FocusedItem; if (focusedItem != null) { focusedItem.Selected = true; } else { listView1.Items[0].Selected = true; } } }
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (_ignoreEvents) { return; } SetFields(); this.currentProfile = GetSelectedProfile(); ReadFields(); }
private void addNodeToolStripButton_Click(object sender, EventArgs e) { var newProfile = new WordWrapOptionsProfile(); newProfile.ProfileName = "New wordwrap settings"; var newListItem = new ListViewItem(newProfile.ProfileName, listView1.Groups[0]); wordWrapOptions.WordWrapOptionsProfiles.Add(newProfile); listView1.Items.Add(newListItem); newListItem.Selected = true; newListItem.Focused = true; newListItem.BeginEdit(); }
private static void TryDalkGaiden(AinFile ainFile, ref WordWrapOptions wordWrapOptions) { //DALK Gaiden: //void StructMessage::func293(int nNo, int nEffect, int nTime) if (ContainsFunction(ainFile, "StructMessage@func293", DataType.Int, "nNo", DataType.Int, "nEffect", DataType.Int, "nTime")) { wordWrapOptions = new WordWrapOptions(); wordWrapOptions.IgnoreAngleBraces = true; //game is DALK Gaiden var profile = wordWrapOptions.WordWrapOptionsProfiles[0]; profile.MaxCharactersPerLine = 46; profile.MaxLinesPerMessage = 3; profile = wordWrapOptions.WordWrapOptionsProfiles[1]; profile.MaxCharactersPerLine = 46; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "Msg.func293(1, VISMES_EF, VISMES_EFW);", "Msg.func293(2, VISMES_EF, VISMES_EFW);", "Msg.func293(3, VISMES_EF, VISMES_EFW);", "Msg.func293(4, VISMES_EF, VISMES_EFW);", "Msg.func293(6, VISMES_EF, VISMES_EFW);", "Msg.func293(7, VISMES_EF, VISMES_EFW);", "Msg.func293(8, VISMES_EF, VISMES_EFW);"); profile = wordWrapOptions.WordWrapOptionsProfiles[2]; profile.ProfileName = "Wide 1"; profile.MaxCharactersPerLine = 62; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "Msg.func293(5, VISMES_EF, VISMES_EFW);", "Msg.func293(20, VISMES_EF, VISMES_EFW);"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Wide 2"; profile.MaxCharactersPerLine = 60; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "Msg.func293(9, VISMES_EF, VISMES_EFW);"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Narrow"; profile.MaxCharactersPerLine = 32; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "Msg.func293(10, VISMES_EF, VISMES_EFW);", "Msg.func293(11, VISMES_EF, VISMES_EFW);"); } }
private static void TrySengokuRance(AinFile ainFile, ref WordWrapOptions wordWrapOptions) { //Sengoku Rance: //44 wide //void 台詞枠(int nNameNo, int nEffectNo, int nSpeed) //void 思考枠(int nNameNo, int nEffectNo, int nSpeed) //void ト書き枠(int nEffectNo, int nSpeed) //void 全画面枠(int nEffectNo, int nSpeed) //void 全画面枠2(int nBlendRate, int nEffectNo, int nSpeed) //void 枠(int nType, int nNameNo, int nBlendRate, int nEffectNo, int nSpeed) if (ContainsFunction(ainFile, "台詞枠", DataType.Int, "nNameNo", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "思考枠", DataType.Int, "nNameNo", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "ト書き枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "全画面枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "全画面枠2", DataType.Int, "nBlendRate", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "枠", DataType.Int, "nType", DataType.Int, "nNameNo", DataType.Int, "nBlendRate", DataType.Int, "nEffectNo", DataType.Int, "nSpeed")) { wordWrapOptions = new WordWrapOptions(); //game is Sengoku Rance var profile = wordWrapOptions.WordWrapOptionsProfiles[0]; profile.MaxCharactersPerLine = 44; profile.MaxLinesPerMessage = 3; profile = wordWrapOptions.WordWrapOptionsProfiles[1]; profile.MaxCharactersPerLine = 44; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "CALLFUNC 台詞枠", "CALLFUNC 思考枠", "CALLFUNC ト書き枠"); profile = wordWrapOptions.WordWrapOptionsProfiles[2]; profile.ProfileName = "Fullscreen 1"; profile.MaxCharactersPerLine = 96; profile.MaxLinesPerMessage = 31; profile.SetTriggerCodes(ainFile, "CALLFUNC 全画面枠"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Fullscreen 2"; profile.MaxCharactersPerLine = 62; profile.MaxLinesPerMessage = 21; profile.SetTriggerCodes(ainFile, "CALLFUNC 全画面枠2"); } }
private void WordWrapForm2_Load(object sender, EventArgs e) { try { _ignoreEvents = true; ListProfiles(); if (listView1.Items.Count > 0) { listView1.Items[0].Selected = true; listView1.Items[0].Focused = true; } } finally { _ignoreEvents = false; } this.currentProfile = GetSelectedProfile(); ReadFields(); }
public string[] WordWrapLines(IEnumerable <string> lines) { if (WordWrapOptions == null || CurrentProfile == null || WordWrapOptions.Disabled) { return(lines.ToArray()); } this.maxLinesPerMessage = CurrentProfile.MaxLinesPerMessage; this.maxCharactersPerLine = CurrentProfile.MaxCharactersPerLine; //scale = 1.0; //bool sizeTerminatedSameLine = false; //bool isFirstLine = true; doNotWrapThis = false; List <string> outputLines = new List <string>(); string remainingCharacters = ""; foreach (var line in lines) { //NEW: ignore fake lines that are actually code patches if (line.StartsWith("\0@CODE")) { WordWrapLine(null, ref remainingCharacters, outputLines); outputLines.Add(line); continue; } WordWrapLine(line, ref remainingCharacters, outputLines); if (line == "@" && SwitchToNormalProfileOnA) { CurrentProfile = NormalProfile; this.maxLinesPerMessage = CurrentProfile.MaxLinesPerMessage; this.maxCharactersPerLine = CurrentProfile.MaxCharactersPerLine; } //if (sizeTerminatedSameLine && isFirstLine) //{ // WordWrapLine(null, ref remainingCharacters, outputLines); // this.maxCharactersPerLine = CurrentProfile.MaxCharactersPerLine; // this.maxLinesPerMessage = CurrentProfile.MaxLinesPerMessage; //} //isFirstLine = false; } WordWrapLine(null, ref remainingCharacters, outputLines); if (!doNotWrapThis) { //next count lines and add page breaks as needed int i = 0; int currentLineCount = 0; while (i < outputLines.Count) { string line = outputLines[i]; if (line == "@") { currentLineCount = 0; } else if (line.StartsWith("\0@CODE")) { //NEW: ignore fake lines that are actually code patches } else { currentLineCount++; if (currentLineCount > maxLinesPerMessage) { outputLines.Insert(i, "@"); currentLineCount = 1; } } i++; } } return(outputLines.ToArray()); }
private static void TryRance6(AinFile ainFile, ref WordWrapOptions wordWrapOptions) { //void 依頼書画面前処理(); //void 枠(int n枠番号, int nキャラ番号, int n効果番号, int n所要時間) if (ContainsFunction(ainFile, "依頼書画面前処理") && ContainsFunction(ainFile, "枠", DataType.Int, "n枠番号", DataType.Int, "nキャラ番号", DataType.Int, "n効果番号", DataType.Int, "n所要時間")) { wordWrapOptions = new WordWrapOptions(); var profile = wordWrapOptions.WordWrapOptionsProfiles[0]; profile.MaxLinesPerMessage = 65535; profile.MaxCharactersPerLine = 44; profile = wordWrapOptions.WordWrapOptionsProfiles[1]; profile.ProfileName = "#4, 5, 6: Normal (3 lines)"; profile.MaxLinesPerMessage = 3; profile.MaxCharactersPerLine = 44; profile.SetTriggerCodes(ainFile, //"PUSH 4 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠", //"PUSH 5 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠", //"PUSH 6 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(4, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);", "枠(5, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);", "枠(6, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); profile = wordWrapOptions.WordWrapOptionsProfiles[2]; profile.ProfileName = "#3: Stage directions (4 lines)"; profile.MaxLinesPerMessage = 4; profile.MaxCharactersPerLine = 44; profile.SetTriggerCodes(ainFile, //"PUSH 3 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(3, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "#7: Report"; profile.MaxLinesPerMessage = 2; profile.MaxCharactersPerLine = 44; profile.SetTriggerCodes(ainFile, //"PUSH 7 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(7, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "#8: Warning (?)"; profile.MaxLinesPerMessage = 5; profile.MaxCharactersPerLine = 58; profile.SetTriggerCodes(ainFile, //"PUSH 8 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(8, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "#9: 2 lines"; profile.MaxLinesPerMessage = 2; profile.MaxCharactersPerLine = 46; profile.SetTriggerCodes(ainFile, //"PUSH 9 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(9, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "#10: Explanation (?)"; profile.MaxLinesPerMessage = 65535; profile.MaxCharactersPerLine = 78; profile.SetTriggerCodes(ainFile, //"PUSH 10 PUSH 0xDEADBEEF PUSH 0xDEADBEEF PUSH 0xDEADBEEF CALLFUNC 枠" "枠(10, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF);" ); //3 g_tト書き (stage directions) //4 g_t台詞 (speech) //5 g_t思惑 (speculation) //6 g_tGET //7 g_t報告 (report) //8 g_t警告 (warning) //9 g_t2行 (2line) //10 g_t説明 (explanation) //3 stage directions // g_tト書き.Build(2003, 54, 10); about 528x108 44 x 4 // g_tト書き.SetPos(3, 355); // fontsize 24 face 0 //4 speech // g_t台詞.Build(2004, 54, 6); about 528x82 44 x 3 // g_t台詞.SetPos(3, 355); // fontsize 24 face 0 //5 speculation // g_t思惑.Build(2005, 54, 6); about 528x82 44 x 3 // g_t思惑.SetPos(3, 355); // fontsize 24 face 0 //6 GET // g_tGET.Build(2006, 62, 16); about 512x96 44 x 3 (previously thought to be 42 x 3) // g_tGET.SetPos(3, 355); // fontsize 24 face 0 //7 report // g_t報告.Build(2567, 56, 10, 640, 80, 0, 0, 0, 127); about 528x56 44 x 2 // g_t報告.SetPos(3, 407); // fontsize 24 face 0 //8 warning // g_t警告.Build(2028, 0, 0); unknown, 58 x 5 // g_t警告.SetPos(0, 172); // fontsize 22 face 0 //9 2line // g_t2行.Build(2706, 8, 42, 640, 80, 0, 0, 0, 127); about 466x55 46 x 2 // g_t2行.SetPos(4, 380); // fontsize 20 face 0 //10 explanation // g_t説明.Build(0, 8, 8, 640, 480, 20, 20, 20, 192); unknown, 80 x 26 // g_t説明.SetPos(0, 0); // fontsize 16 face 0 profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Notes Screen"; //font size: 14x16 //dimensions of area: //approx 86,50, width = 470, height = 360 profile.MaxCharactersPerLine = 74; profile.MaxLinesPerMessage = 65535; profile.SetTriggerCodes(ainFile, "CALLFUNC 依頼書画面前処理"); } return; }
private static void TryGalzooIsland(AinFile ainFile, ref WordWrapOptions wordWrapOptions) { //void ト書き枠(int nEffectNo, int nSpeed) //void SP台詞枠(int nEffectNo, int nSpeed) //void 顔枠(int nEffectNo, int nSpeed) //void SP思考枠(int nEffectNo, int nSpeed) //void 顔思考枠(int nEffectNo, int nSpeed) //void ビジュアル枠(int nEffectNo, int nSpeed) //void 全画面枠(int nEffectNo, int nSpeed) //void 捕獲枠(int nCharaNo) //void ys迷宮環境設定_ポリゴン描画設定(int nSelect) //枠(91, true, 0, 0); if (ContainsFunction(ainFile, "ト書き枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "SP台詞枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "顔枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "SP思考枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "顔思考枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "ビジュアル枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "全画面枠", DataType.Int, "nEffectNo", DataType.Int, "nSpeed") && ContainsFunction(ainFile, "捕獲枠", DataType.Int, "nCharaNo") && ContainsFunction(ainFile, "ys迷宮環境設定_ポリゴン描画設定", DataType.Int, "nSelect")) { wordWrapOptions = new WordWrapOptions(); var profile = wordWrapOptions.WordWrapOptionsProfiles[0]; profile.MaxCharactersPerLine = 40; profile.MaxLinesPerMessage = 65535; profile = wordWrapOptions.WordWrapOptionsProfiles[1]; profile.MaxCharactersPerLine = 30; profile.MaxLinesPerMessage = 4; profile.SetTriggerCodes(ainFile, "CALLFUNC ト書き枠", "CALLFUNC SP台詞枠", "CALLFUNC 顔枠", "CALLFUNC SP思考枠", "CALLFUNC 顔思考枠" ); profile = wordWrapOptions.WordWrapOptionsProfiles[2]; profile.ProfileName = "Visual"; profile.MaxCharactersPerLine = 40; profile.MaxLinesPerMessage = 3; profile.SetTriggerCodes(ainFile, "CALLFUNC ビジュアル枠"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Fullscreen"; profile.MaxCharactersPerLine = 96; profile.MaxLinesPerMessage = 31; profile.SetTriggerCodes(ainFile, "CALLFUNC 全画面枠"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Catch"; profile.MaxCharactersPerLine = 33; profile.MaxLinesPerMessage = 4; profile.SetTriggerCodes(ainFile, "CALLFUNC 捕獲枠"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Polygon drawing settings"; profile.MaxCharactersPerLine = 47; profile.MaxLinesPerMessage = 12; profile.SetTriggerCodes(ainFile, "枠(91, true, 0, 0);"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Font size 16"; profile.MaxCharactersPerLine = 52; profile.MaxLinesPerMessage = 7; profile.SetTriggerCodes(ainFile, "PUSH 16 CALLFUNC 文字サイズ"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Font size 18"; profile.MaxCharactersPerLine = 46; profile.MaxLinesPerMessage = 6; profile.SetTriggerCodes(ainFile, "PUSH 18 CALLFUNC 文字サイズ"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "Font size 20"; profile.MaxCharactersPerLine = 42; profile.MaxLinesPerMessage = 6; profile.SetTriggerCodes(ainFile, "PUSH 20 CALLFUNC 文字サイズ"); profile = new WordWrapOptionsProfile(); wordWrapOptions.WordWrapOptionsProfiles.Add(profile); profile.ProfileName = "PREVIOUS PROFILE"; profile.MaxCharactersPerLine = 65535; profile.MaxLinesPerMessage = 65535; profile.SetTriggerCodes(ainFile, "PUSH -1 CALLFUNC 文字サイズ"); } //default font size: 28 //1 ト書き枠 stage directions frame (425x128), 30x4 //2 SP台詞枠 SP Speech frame (425x128), 30x4 //3 顔枠 face frame (425x128), 30x4 //4 SP思考枠 SP Idea frame (425x128), 30x4 //5 顔思考枠 face idea frame (425x128), 30x4 //6 ビジュアル枠 Visual frame (563x96), 40,3 //11 全画面枠 Fullscreen frame 96x31 //12 捕獲枠 catch frame (473x128), 33x4 //91 ys迷宮環境設定_ポリゴン描画設定 polygon drawing settings 47x12 ///////////////////////////no, cg, z, x, y, w, h, r, g, b, bl, tx, ty,tx2,ty2,lsp,fontsize,fontface,fontbold,r,g,b,l,u,r,d,r,g,b,icon,nameflag //this.m_asData[idx++].set(1, 1005, 1100, 240, 390, 560, 210, 0, 0, 0, 0, 70, 60, 70, 60, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(2, 1006, 1100, 240, 390, 560, 210, 0, 0, 0, 0, 70, 60, 70, 60, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(3, 1007, 1100, 240, 390, 560, 210, 0, 0, 0, 0, 70, 60, 70, 60, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(4, 1008, 1100, 240, 390, 560, 210, 0, 0, 0, 0, 70, 60, 70, 60, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(5, 1009, 1100, 240, 390, 560, 210, 0, 0, 0, 0, 70, 60, 70, 60, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(6, 1010, 1100, 0, 470, 800, 130, 0, 0, 0, 0, 115, 20,115, 20, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 2, 0); //this.m_asData[idx++].set(11, 0, 1200, 0, 0, 800, 600, 0, 0, 0,255, 16, 16, 16, 16, 2, 16, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 3, 0); //this.m_asData[idx++].set(12, 1916,1100, 0, 420, 800, 180, 0, 0, 0, 0, 260, 30,260, 30, 2, 28, 0, 0, 255, 255, 255, 1, 1, 1, 1, 0, 0, 0, 1, 0); //this.m_asData[idx++].set(91, 0, 2000, 110, 136, 580, 324, 0, 0, 0, 64, 16, 16, 16, 16, 2, 24, 0, 0, 255, 255, 255, 2, 2, 2, 0, 0, 0, 0, 3, 0); //this.m_asData[idx++].set(99, 0, 1100, 0, 420, 800, 130, 0, 0, 0, 0, 150, 20,150, 20, 2, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); return; }