コード例 #1
0
        internal static void copy_protection()
        {
            string code_path_str;
            char   input_expected;
            char   input_key;

            ovr034.Load24x24Set(0x1A, 0, 1, "tiles");
            ovr034.Load24x24Set(0x16, 0x1A, 2, "tiles");

            seg037.DrawFrame_Outer();

            Seg041.DisplayString("Align the espruar and dethek runes", 0, 10, 2, 3);
            Seg041.DisplayString("shown below, on translation wheel", 0, 10, 3, 3);
            Seg041.DisplayString("like this:", 0, 10, 4, 3);
            int attempt = 0;

            do
            {
                int var_6 = seg051.Random(26);
                int var_7 = seg051.Random(22);

                ovr034.DrawIsoTile(var_6, 3, 0x11);
                ovr034.DrawIsoTile(var_7 + 0x1a, 7, 0x11);

                seg040.DrawOverlay();
                int code_path = seg051.Random(3);

                switch (code_path)
                {
                case 0:
                    code_path_str = "-..-..-..";
                    break;

                case 1:
                    code_path_str = "- - - - -";
                    break;

                case 2:
                    code_path_str = ".........";
                    break;

                default:
                    code_path_str = string.Empty;
                    break;
                }

                int code_row = seg051.Random(6);

                string text = "Type the character in box number " + (6 - code_row);

                Seg041.DisplayString(text, 0, 10, 12, 3);

                Seg041.DisplayString("under the ", 0, 10, 13, 3);
                Seg041.DisplayString(code_path_str, 0, 15, 13, 14);
                Seg041.DisplayString("path.", 0, 10, 13, 0x19);

                int code_index = var_6 + 0x22 - var_7 + (code_path * 12) + ((5 - code_row) << 1);

                while (code_index < 0)
                {
                    code_index += 36;
                }

                while (code_index > 35)
                {
                    code_index -= 36;
                }

                input_expected = codeWheel[code_row][code_index];

                string input = Seg041.GetUserInputString(1, 0, 13, "type character and press return: ");

                input_key = (input == null || input.Length == 0) ? ' ' : input[0];
                attempt++;

                if (input_key != input_expected)
                {
                    Seg041.DisplayStatusText(0, 14, "Sorry, that's incorrect.");
                }
                else
                {
                    return;
                }
            } while (input_key != input_expected && attempt < 3);

            if (attempt >= 3)
            {
                seg044.PlaySound(Sound.sound_1);
                seg044.PlaySound(Sound.sound_5);
                gbl.game_speed_var = 9;
                Seg041.DisplayStatusText(0, 14, "An unseen force hurls you into the abyss!");
                seg049.SysDelay(0x3E8);
                seg043.print_and_exit();
            }
        }
コード例 #2
0
        internal static void SavePlayer(string arg_0, Player player) // sub_47DFC
        {
            char input_key;

            Classes.File file = new Classes.File();

            gbl.import_from = ImportSource.Curse;

            string ext_text;
            string file_text;

            if (arg_0 == "")
            {
                ext_text  = ".guy";
                file_text = seg042.clean_string(player.name);
            }
            else
            {
                ext_text  = ".sav";
                file_text = arg_0;
            }

            input_key = 'N';

            while (input_key == 'N' &&
                   arg_0.Length == 0 &&
                   seg042.file_find(Path.Combine(Config.GetSavePath(), file_text) + ext_text) == true)
            {
                input_key = ovr027.yes_no(gbl.alertMenuColors, "Overwrite " + file_text + "? ");

                if (input_key == 'N')
                {
                    file_text = string.Empty;

                    while (file_text == string.Empty)
                    {
                        file_text = Seg041.GetUserInputString(8, 0, 10, "New file name: ");
                    }
                }
            }

            string filePath = Path.Combine(Config.GetSavePath(), file_text);

            file.Assign(filePath + ext_text);

            seg051.Rewrite(file);

            seg051.BlockWrite(Player.StructSize, player.ToByteArray(), file);
            seg051.Close(file);

            seg042.delete_file(filePath + ".swg");

            if (player.items.Count > 0)
            {
                file.Assign(filePath + ".swg");
                seg051.Rewrite(file);

                player.items.ForEach(item => seg051.BlockWrite(Item.StructSize, item.ToByteArray(), file));

                seg051.Close(file);
            }

            seg042.delete_file(filePath + ".fx");

            if (player.affects.Count > 0)
            {
                file.Assign(filePath + ".fx");
                seg051.Rewrite(file);

                foreach (Affect affect in player.affects)
                {
                    seg051.BlockWrite(Affect.StructSize, affect.ToByteArray(), file);
                }

                seg051.Close(file);
            }
        }