Beispiel #1
0
        private static Dialog JpnEscapeCustomCodes(byte[] data)
        {
            Dialog        dialog = new Dialog();
            StringBuilder sb     = new StringBuilder();

            GetUnescapedJpnChars(data, out ushort[] chrRaw, out char[] chr);

            for (int i = 0; i < chrRaw.Length; i++)
            {
                switch (chrRaw[i])
                {
                    #region SpecialChars
                case 0x839F: sb.Append(ConvertSpecialChars((byte)chrRaw[i])); break;

                case 0x83A0: goto case 0x839F;    // "[B]";

                case 0x83A1: goto case 0x839F;    // "[C]";

                case 0x83A2: goto case 0x839F;    // "[L]";

                case 0x83A3: goto case 0x839F;    // "[R]";

                case 0x83A4: goto case 0x839F;    // "[Z]";

                case 0x83A5: goto case 0x839F;    // "[C-Up]";

                case 0x83A6: goto case 0x839F;    // "[C-Down]";

                case 0x83A7: goto case 0x839F;    // "[C-Left]";

                case 0x83A8: goto case 0x839F;    // "[C-Right]";

                case 0x83A9: goto case 0x839F;    // "[Triangle]";

                case 0x83AA: goto case 0x839F;    // "[Control Stick]";

                case 0x83AB: goto case 0x839F;    // "[D-Pad]";
                    #endregion

                //[00]		---

                //[01]		line break
                case 0x000A:
                    dialog.Append(new LineBreak()); break;

                //[02]		end marker
                case 0x8170: i = chr.Length; dialog.Complete(); break;

                //[03]		---
                //[04]		wait for keypress / box break
                case 0x81A5:
                    dialog.Append(new BoxBreak()); break;

                //[05 xx]		use text color xx
                case 0x000B: i++; dialog.Append(new SetTextColor((byte)chrRaw[i])); break;

                //[06 xx]		print xx spaces
                case 0x86C7: i++; dialog.Append(new CustomCode(0x86C7, chrRaw[i])); break;

                //[07 xx xx]	continue with message with id xx xx (ex. 033a)
                case 0x81CB: dialog.Append(new GotoDialog(chrRaw[++i])); break;

                //[08]		pring following text instantly
                case 0x8189: dialog.Append(new CustomCode(0x8189)); break;

                //[09]		disable 08, instant text printing
                case 0x818A: dialog.Append(new CustomCode(0x818A)); break;

                //[0a]		keep box opened, no reaction to keypresses (used in shop item descriptions)
                case 0x86C8: dialog.Append(new CustomCode(chrRaw[i])); break;

                //[0b]		(wait for external action? used in minigame texts)
                case 0x819F: dialog.Append(new CustomCode(chrRaw[i])); break;

                //[0c xx]		delay text printing by xx
                case 0x81A3: dialog.Append(new CustomCode(chrRaw[i], chrRaw[i + 1])); i++; break;
                //[0d]		wait for keypress / continue in same box/line

                //[0e xx]		fade out interface and wait until xx maxes out(??), ignore all following text
                case 0x819E: dialog.Append(new CustomCode(chrRaw[i], chrRaw[i + 1])); i++; break;

                //[0f]		show player name
                case 0x874F: dialog.Append("[Link]"); break;

                //[10]		init ocarina playing
                case 0x81F0: dialog.Append(new CustomCode(chrRaw[i])); break;
                //[11]		(fade out interface and wait, ignore all following text, no parameters?)

                //[12 xx xx]	play sound xx xx
                case 0x81F3: i++; dialog.Append(new Sound(chrRaw[i])); break;

                //[13 xx]		show item icon xx
                case 0x819A: i++; dialog.Append(new ItemIcon((byte)chrRaw[i])); break;

                //  xx: 00 = deku stick
                //      01 = deku nut
                //      ...
                //[14 xx]		delay printing of each letter by xx
                case 0x86C9: dialog.Append(new CustomCode(chrRaw[i], chrRaw[i + 1])); i++; break;

                //[15 xx yy zz]	load box background image (valid values unknown, 00 20 00 gives red 'X' mark)
                case 0x86B3: dialog.Append(new Background(chrRaw[i], chrRaw[i + 1])); i++; break;

                //[16]		(show result time of something?)
                case 0x8791: dialog.Append("[Marathon Time]"); break;

                //[17]		(show result time of something else?)
                case 0x8792: dialog.Append("[Race Time]"); break;

                //[18]		(show result count of something?)
                case 0x879B: dialog.Append("[Points]"); break;

                //[19]		show golden skulltula count
                case 0x86A3: dialog.Append("[Gold Skulltulas]"); break;

                //[1a]		following text can't be skipped with B button
                case 0x8199: dialog.Append("[No Skip]"); break;

                //[1b]		init two-choice answer selection (i.e. yes/no arrow)
                case 0x81BC: dialog.Append(new CustomCode(chrRaw[i])); break;

                //[1c]		init three-choice answer selection
                case 0x81B8: dialog.Append(new CustomCode(chrRaw[i])); break;

                //[1d]		(show result count of something?)
                case 0x86A4: dialog.Append("[Fish Score]"); break;

                //[1e xx]		show minigame result xx
                case 0x869F: i++; dialog.Append(DisplayValue((byte)chrRaw[i])); break;

                //  xx: 00 = horseback archery points
                //      02 = largest fish caught
                //      03 = horse race time
                //      04 = marathon time
                //      06 = dampé race time
                //      ...?
                //[1f]		show current hyrule time
                case 0x81A1: dialog.Append("[World Time]"); break;

                default:
                    dialog.Append(chr[i]);
                    break;
                }
            }
            return(dialog);
        }
Beispiel #2
0
        private static Dialog NesEscapeCustomCodes(byte[] s)
        {
            Dialog dialog = new Dialog();

            for (int i = 0; i < s.Length; i++)
            {
                switch (s[i])
                {
                //[00]		---
                case 0x00: break;

                //[01]		line break
                case 0x01:
                    dialog.Append(new LineBreak());
                    break;

                //[02]		end marker
                case 0x02: dialog.Complete(); i = s.Length; break;

                //[03]		---
                //[04]		wait for keypress / box break
                case 0x04:
                    dialog.Append(new BoxBreak());
                    break;

                //[05 xx]		use text color xx
                case 0x05:
                    i++;
                    dialog.Append(new SetTextColor((byte)(s[i] & 0x0F)));
                    break;

                //  xx: 40 = white
                //      41 = red
                //      42 = green
                //      43 = blue
                //      44 = light blue
                //      45 = pink
                //      46 = yellow
                //      47 = black
                //[06 xx]		print xx spaces
                case 0x06:
                    i++;
                    dialog.Append(new Padding(s[i]));
                    break;

                //[07 xx xx]	continue with message with id xxxx
                case 0x07: i++; dialog.Append(new GotoDialog(Endian.ConvertUShort(s, i))); i++; break;

                //[08]		pring following text instantly
                case 0x08: dialog.Append(new CustomCode(0x08)); break;

                //[09]		disable 08, instant text printing
                case 0x09: dialog.Append(new CustomCode(0x09)); break;

                //[0a]		keep box opened, no reaction to keypresses (used in shop item descriptions)
                case 0x0A: dialog.Append(new CustomCode(0x0A)); break;

                //[0b]		(wait for external action? used in minigame texts)
                case 0x0B: dialog.Append(new CustomCode(0x0B)); break;

                //[0c xx]		delay text printing by xx
                case 0x0C: i++; dialog.Append(new CustomCode(0x0C, s[i])); break;

                //[0d]		wait for keypress / continue in same box/line
                case 0x0D: dialog.Append(new CustomCode(0x0D)); break;

                //[0e xx]		fade out interface and wait until xx maxes out(??), ignore all following text
                case 0x0E: i++; dialog.Append(new CustomCode(0x0E, s[i])); break;

                //[0f]		show player name
                case 0x0F: dialog.Append("[Link]"); break;

                //[10]		init ocarina playing
                case 0x10: dialog.Append(new CustomCode(0x10)); break;

                //[11]		(fade out interface and wait, ignore all following text, no parameters?)
                case 0x11: dialog.Append(new CustomCode(0x11)); break;

                //[12 xx xx]	play sound xx xx
                case 0x12: i++; dialog.Append(new Sound(Endian.ConvertUShort(s, i))); i++; break;

                //[13 xx]		show item icon xx
                case 0x13: i++; dialog.Append(new ItemIcon(s[i])); break;

                //  xx: 00 = deku stick
                //      01 = deku nut
                //      ...
                //[14 xx]		delay printing of each letter by xx
                case 0x14: i++; dialog.Append(new CustomCode(0x14, s[i])); break;

                //[15 xx yy zz]	load box background image (valid values unknown, 00 20 00 gives red 'X' mark)
                case 0x15: dialog.Append(new Background(s[i + 1], s[i + 2], s[i + 3])); i += 3; break;

                //[16]		(show result time of something?)
                case 0x16: dialog.Append("[Marathon Time]"); break;

                //[17]		(show result time of something else?)
                case 0x17: dialog.Append("[Race Time]"); break;

                //[18]		(show result count of something?)
                case 0x18: dialog.Append("[Points]"); break;

                //[19]		show golden skulltula count
                case 0x19: dialog.Append("[Gold Skulltulas]"); break;

                //[1a]		following text can't be skipped with B button
                case 0x1A: dialog.Append("[No Skip]"); break;

                //[1b]		init two-choice answer selection (i.e. yes/no arrow)
                case 0x1B: dialog.Append(new CustomCode(0x1B)); break;

                //[1c]		init three-choice answer selection
                case 0x1C: dialog.Append(new CustomCode(0x1C)); break;

                //[1d]		(show result count of something?)
                case 0x1D: dialog.Append("[Fish Score]"); break;

                //[1e xx]		show minigame result xx
                case 0x1E: i++; dialog.Append(DisplayValue(s[i])); break;

                //  xx: 00 = horseback archery points
                //      02 = largest fish caught
                //      03 = horse race time
                //      04 = marathon time
                //      06 = dampé race time
                //      ...?
                //[1f]		show current hyrule time
                case 0x1F: dialog.Append("[World Time]"); break;

                default: dialog.Append(ConvertSpecialChars(s[i])); break;
                }
            }
            return(dialog);
        }