Exemple #1
0
        static void rest_heal(bool show_text) /* reset_heal */
        {
            gbl.rest_10_seconds++;

            if (gbl.rest_10_seconds >= (8 * 36))
            {
                bool update_ui = false;

                foreach (Player player in gbl.TeamList)
                {
                    if (ovr024.heal_player(0, 1, player) == true)
                    {
                        update_ui = true;
                    }
                }

                if (show_text == true)
                {
                    display_resting_time(0);
                }

                Seg041.DisplayString("The Whole Party Is Healed", 0, 10, 19, 1);

                if (update_ui)
                {
                    ovr025.PartySummary(gbl.SelectedPlayer);
                }

                Seg041.GameDelay();
                ovr025.ClearPlayerTextArea();
                gbl.rest_10_seconds = 0;
            }
        }
Exemple #2
0
        static void display_resting_time(int highlight_time) /* sub_58615 */
        {
            int[] colors = new int[6];

            for (int index = 0; index < 6; index++)
            {
                colors[index] = 10;
            }

            colors[highlight_time] = 15;

            Seg041.DisplayString("Rest Time:", 0, 10, 17, 1);
            int col_x = 11;

            string text = format_time(gbl.timeToRest.field_8);

            Seg041.DisplayString(text, 0, colors[4], 0x11, col_x + 1);
            Seg041.DisplayString(":", 0, 10, 17, col_x + 3);
            col_x += 3;

            text = format_time(gbl.timeToRest.field_6);
            Seg041.DisplayString(text, 0, colors[3], 0x11, col_x + 1);
            Seg041.DisplayString(":", 0, 10, 17, col_x + 3);
            col_x += 3;

            text = format_time((gbl.timeToRest.field_4 * 10) + gbl.timeToRest.field_2);

            Seg041.DisplayString(text, 0, colors[2], 0x11, col_x + 1);
        }
Exemple #3
0
        internal static void game_speed()
        {
            char inputKey;

            do
            {
                Seg041.DisplayString(string.Format("Game Speed = {0} (0=fastest 9=slowest)", gbl.game_speed_var), 0, 10,
                                     18, 1);

                string text = string.Empty;

                if (gbl.game_speed_var > 0)
                {
                    text += " Faster";
                }

                if (gbl.game_speed_var < 9)
                {
                    text += " Slower";
                }

                text += " Exit";

                bool controlKey;
                inputKey = ovr027.displayInput(out controlKey, true, 1, gbl.defaultMenuColors, text, "Game Speed:");

                if (controlKey == true)
                {
                    if (inputKey == 0x50)
                    {
                        if (gbl.game_speed_var > 0)
                        {
                            gbl.game_speed_var--;
                        }
                    }
                    else if (inputKey == 0x48)
                    {
                        if (gbl.game_speed_var < 9)
                        {
                            gbl.game_speed_var++;
                        }
                    }
                }
                else
                {
                    if (inputKey == 0x46)
                    {
                        gbl.game_speed_var--;
                    }
                    else if (inputKey == 0x53)
                    {
                        gbl.game_speed_var++;
                    }
                }
            } while (AlterSet.MemberOf(inputKey) == false);

            ovr025.ClearPlayerTextArea();
        }
Exemple #4
0
        internal static void string_print01(string text)
        {
            ovr027.ClearPromptAreaNoUpdate();

            Seg041.DisplayString(text, 0, 10, 0x18, 0);

            Seg041.GameDelay();

            ovr027.ClearPromptAreaNoUpdate();
        }
Exemple #5
0
        internal static void BattleSetup() // battle_begins
        {
            gbl.DelayBetweenCharacters = false;

            ovr030.DaxArrayFreeDaxBlocks(gbl.byte_1D556);

            gbl.headX_dax       = null;
            gbl.bodyX_dax       = null;
            gbl.bigpic_dax      = null;
            gbl.bigpic_block_id = 0xff;
            gbl.current_head_id = 0xff;
            gbl.current_body_id = 0xff;
            ovr027.ClearPromptArea();
            Seg041.GameDelay();

            Seg041.DisplayString("A battle begins...", 0, 0x0a, 0x18, 0);

            gbl.AutoPCsCastMagic             = false; // TODO review this...
            gbl.combat_round                 = 0;
            gbl.combat_round_no_action_limit = gbl.combat_round_no_action_value;
            gbl.attack_roll = 0;

            gbl.StinkingCloud  = new List <GasCloud>();
            gbl.CloudKillCloud = new List <GasCloud>();
            gbl.item_ptr       = null;

            gbl.downedPlayers = new List <DownedPlayerTile>();

            gbl.area2_ptr.field_666 = 0;

            SetupGroundTiles();

            SetupCombatActions();
            PlaceCombatants();

            seg043.clear_one_keypress();

            gbl.missile_dax = new DaxBlock(4, 3, 0x18);

            Point pos = ovr033.PlayerMapPos(gbl.TeamList[0]);

            gbl.mapToBackGroundTile.mapScreenTopLeft = pos - Point.ScreenCenter;

            ovr025.RedrawCombatScreen();
            foreach (Player player in gbl.TeamList)
            {
                ovr024.CheckAffectsEffect(player, CheckType.Type_8);
                ovr024.CheckAffectsEffect(player, CheckType.Type_22);
            }

            ovr014.calc_enemy_health_percentage();
            gbl.game_state = GameState.Combat;
        }
Exemple #6
0
        static void ListItemHighlighted(int index, List <MenuItem> stringList, int yCol, int xCol, int bgColor)
        {
            MenuItem menu_item = getStringListEntry(stringList, index);

            int stringStart = getBegingOfString(menu_item.Text);

            Seg041.DisplayString(
                menu_item.Text.Trim(),
                bgColor,
                0,
                yCol + (index - gbl.menuScreenIndex),
                xCol + stringStart);
        }
Exemple #7
0
        internal static void PartySummary(Player player)
        {
            if (gbl.game_state == GameState.WildernessMap)
            {
                return;
            }

            int x_pos = (gbl.game_state == GameState.StartGameMenu) ? 1 : 17;
            int y_pos = 2;

            Seg041.DisplayString("Name", 0, 15, y_pos, x_pos);
            Seg041.DisplayString("AC  HP", 0, 15, y_pos, 0x21);

            y_pos += 2;

            foreach (Player tmp_player in gbl.TeamList)
            {
                seg037.draw8x8_clear_area(y_pos, 0x26, y_pos, x_pos);

                if (tmp_player == player)
                {
                    Seg041.DisplayString(tmp_player.name, 0, 15, y_pos, x_pos);
                }
                else
                {
                    displayPlayerName(false, y_pos, x_pos, tmp_player);
                }

                Seg041.DisplayString(string.Format("{0,-3}", tmp_player.DisplayAc), 0, 10, y_pos, 0x1F);

                int hpXPos = 0;
                if (tmp_player.hit_point_current >= 0 && tmp_player.hit_point_current <= 9)
                {
                    hpXPos = 2;
                }
                else if (tmp_player.hit_point_current >= 10 && tmp_player.hit_point_current <= 99)
                {
                    hpXPos = 1;
                }

                display_hp(false, y_pos, hpXPos + 0x24, tmp_player);
                y_pos++;
            }

            //seg037.draw8x8_clear_area(y_pos, 0x26, y_pos, x_pos);
        }
Exemple #8
0
        internal static void CombatDisplayPlayerSummary(Player player) /* hitpoint_ac */
        {
            if (gbl.display_hitpoints_ac == true)
            {
                gbl.display_hitpoints_ac = false;
                seg037.draw8x8_clear_area(TextRegion.CombatSummary);

                int line = 1;

                DisplayPlayerStatusString(false, line, " ", player);

                line++;

                Seg041.DisplayString("Hitpoints", 0, 10, line + 1, 0x17);

                display_hp(false, line + 1, 0x21, player);
                line += 2;

                Seg041.DisplayString("AC", 0, 10, line + 1, 0x17);
                display_AC(line + 1, 0x1A, player);

                gbl.textYCol = line + 1;

                if (player.activeItems.primaryWeapon != null)
                {
                    line += 2;
                    /*var_1 = 0x17;*/
                    ItemDisplayNameBuild(false, false, 0, 0, player.activeItems.primaryWeapon);

                    Seg041.press_any_key(player.activeItems.primaryWeapon.name, true, 10, line + 3, 0x26, line + 1,
                                         0x17);
                }

                line = gbl.textYCol + 1;

                if (player.in_combat == false)
                {
                    Seg041.DisplayString(ovr020.statusString[(int)player.health_status], 0, 15, line + 1, 0x17);
                }
                else if (player.IsHeld() == true)
                {
                    Seg041.DisplayString("(Helpless)", 0, 15, line + 1, 0x17);
                }
            }
        }
Exemple #9
0
        static void ListItemNormal(int index, List <MenuItem> list, int yCol, int xCol, int normalColor,
                                   int headingColor)
        {
            MenuItem menu_item = getStringListEntry(list, index);

            int var_5 = getBegingOfString(menu_item.Text);

            string text = menu_item.Text.Trim();

            if (menu_item.Heading)
            {
                Seg041.DisplayString(text, 0, headingColor, yCol + (index - gbl.menuScreenIndex), xCol + var_5);
            }
            else
            {
                Seg041.DisplayString(text, 0, normalColor, yCol + (index - gbl.menuScreenIndex), xCol + var_5);
            }
        }
Exemple #10
0
        internal static void ItemDisplayNameBuild(bool display_new_name, bool displayReadied,
                                                  int yCol, int xCol, Item item) /*id_item*/
        {
            item.name = string.Empty;

            if (displayReadied == true)
            {
                if (item.readied)
                {
                    item.name = " Yes  ";
                }
                else
                {
                    item.name = " No   ";
                }
            }

            bool detectMagic = gbl.TeamList.Exists(pla => pla.HasAffect(Affects.detect_magic));

            if (detectMagic == true &&
                (item.plus > 0 || item.plus_save > 0 || item.cursed == true))
            {
                item.name += "* ";
            }

            if (item.count > 0)
            {
                item.name += item.count.ToString() + " ";
            }

            int hidden_names_flag = item.hidden_names_flag;

            if (Cheats.display_full_item_names)
            {
                hidden_names_flag = 0;
            }

            item.name += item.GenerateName(hidden_names_flag);

            if (display_new_name)
            {
                Seg041.DisplayString(item.name, 0, 10, yCol, xCol);
            }
        }
Exemple #11
0
        static void credits()
        {
            Display.UpdateStop();

            seg037.draw8x8_02();

            Seg041.DisplayString("based on the tsr novel 'azure bonds'", 0, 10, 1, 2);
            Seg041.DisplayString("by:", 0, 10, 2, 6);
            Seg041.DisplayString("kate novak", 0, 11, 2, 9);
            Seg041.DisplayString("and", 0, 10, 2, 0x14);
            Seg041.DisplayString("jeff grubb", 0, 11, 2, 0x18);
            Seg041.DisplayString("scenario created by:", 0, 10, 4, 0x0a);
            Seg041.DisplayString("tsr, inc.", 0, 0x0e, 5, 0x0b);
            Seg041.DisplayString("and", 0, 0x0a, 5, 0x15);
            Seg041.DisplayString("ssi", 0, 0x0e, 5, 0x19);
            Seg041.DisplayString("jeff grubb", 0, 0x0b, 6, 0x0e);
            Seg041.DisplayString("george mac donald", 0x0, 0x0B, 0x7, 0x0B);
            Seg041.DisplayString("game created by:", 0x0, 0x0A, 0x9, 0x1);
            Seg041.DisplayString("ssi special projects", 0x0, 0x0E, 0x9, 0x12);
            Seg041.DisplayString("project leader:", 0x0, 0x0E, 0x0B, 0x2);
            Seg041.DisplayString("george mac donald", 0x0, 0x0B, 0x0C, 0x2);
            Seg041.DisplayString("programming:", 0x0, 0x0E, 0x0E, 0x2);
            Seg041.DisplayString("scot bayless", 0x0, 0x0B, 0x0F, 0x2);
            Seg041.DisplayString("russ brown", 0x0, 0x0B, 0x10, 0x2);
            Seg041.DisplayString("michael mancuso", 0x0, 0x0B, 0x11, 0x2);
            Seg041.DisplayString("development:", 0x0, 0x0E, 0x13, 0x2);
            Seg041.DisplayString("david shelley", 0x0, 0x0B, 0x14, 0x2);
            Seg041.DisplayString("michael mancuso", 0x0, 0x0B, 0x15, 0x2);
            Seg041.DisplayString("oran kangas", 0x0, 0x0B, 0x16, 0x2);
            Seg041.DisplayString("graphic arts:", 0x0, 0x0E, 0x0B, 0x16);
            Seg041.DisplayString("tom wahl", 0x0, 0x0B, 0x0C, 0x16);
            Seg041.DisplayString("fred butts", 0x0, 0x0B, 0x0D, 0x16);
            Seg041.DisplayString("susan manley", 0x0, 0x0B, 0x0E, 0x16);
            Seg041.DisplayString("mark johnson", 0x0, 0x0B, 0x0F, 0x16);
            Seg041.DisplayString("cyrus lum", 0x0, 0x0B, 0x10, 0x16);
            Seg041.DisplayString("playtesting:", 0x0, 0x0E, 0x12, 0x16);
            Seg041.DisplayString("jim jennings", 0x0, 0x0B, 0x13, 0x16);
            Seg041.DisplayString("james kucera", 0x0, 0x0B, 0x14, 0x16);
            Seg041.DisplayString("rick white", 0x0, 0x0B, 0x15, 0x16);
            Seg041.DisplayString("robert daly", 0x0, 0x0B, 0x16, 0x16);

            Display.UpdateStart();
        }
Exemple #12
0
        internal static void display_hp(bool hightlighted, int y_pos, int x_pos, Player player)
        {
            int colour;

            if (player.hit_point_current < player.hit_point_max)
            {
                colour = 0x0E;
            }
            else
            {
                colour = 0x0A;
            }

            if (hightlighted == true)
            {
                colour = 0x0D;
            }

            Seg041.DisplayString(player.hit_point_current.ToString(), 0, colour, y_pos, x_pos);
        }
Exemple #13
0
        internal static void load_ecl_dax(byte block_id)
        {
            byte[] block_mem;
            short  block_size = 0;

            gbl.ecl_ptr.Clear();

            do
            {
                ovr027.ClearPromptArea();
                Seg041.DisplayString("Loading...Please Wait", 0, 10, 0x18, 0);

                seg042.load_decode_dax(out block_mem, out block_size, block_id,
                                       string.Format("ECL{0}.dax", gbl.game_area));
            } while (block_size < 2);

            gbl.ecl_ptr.SetData(block_mem, 2, block_size - 2);

            ovr027.ClearPromptArea();
        }
Exemple #14
0
        internal static void displayPlayerName(bool pural, int y_offset, int x_offset, Player player) /*sub_678A2*/
        {
            int color;

            if (player.in_combat == false)
            {
                color = 0x0C;
            }
            else if (player.combat_team == CombatTeam.Enemy)
            {
                color = 0x0E;
            }
            else
            {
                color = 0x0B;
            }

            string name = player.name + ((pural) ? "'s" : "");

            Seg041.DisplayString(name, 0, color, y_offset, x_offset);
        }
Exemple #15
0
        internal static void display_map_position_time() // camping_search
        {
            if (gbl.game_state != GameState.WildernessMap)
            {
                string output = string.Empty;

                string hours   = gbl.area_ptr.time_hour.ToString("00");
                string minutes =
                    ((gbl.area_ptr.time_minutes_tens * 10) + gbl.area_ptr.time_minutes_ones).ToString("00");

                if (gbl.area_ptr.block_area_view == 0 ||
                    Cheats.always_show_areamap)
                {
                    output = string.Format("{0},{1} ", gbl.mapPosX, gbl.mapPosY);
                }

                output += direction(gbl.mapDirection) + " " + hours + ":" + minutes;

                if (gbl.printCommands == true)
                {
                    output += "*";
                }

                if (gbl.game_state == GameState.Camping)
                {
                    output += " camping";
                }
                else if ((gbl.area2_ptr.search_flags & 1) > 0)
                {
                    output += " search";
                }

                seg037.draw8x8_clear_area(15, 0x26, 15, 17);

                Seg041.DisplayString(output, 0, 10, 15, 17);
            }
        }
Exemple #16
0
        static void sub_6C897(int index,
                              int yEnd, int xEnd, int yStart, int xStart, List <MenuItem> list,
                              int normalColor, int headingColor, int displayFillWidth) // sub_6C897
        {
            seg037.draw8x8_clear_area(yEnd, xEnd, yStart, xStart);

            MenuItem var_4 = getStringListEntry(list, index);

            int yCol  = yStart;
            int count = System.Math.Min(yEnd - yStart + 1, list.Count - index);

            foreach (var menu in list.GetRange(index, count))
            {
                Seg041.DisplayString(menu.Text, 0, menu.Heading ? headingColor : normalColor, yCol, xStart);

                if (menu.Text.Length < displayFillWidth)
                {
                    Seg041.DisplayChar(' ', displayFillWidth - menu.Text.Length, 0, 0, yCol,
                                       menu.Text.Length + xStart);
                }

                yCol++;
            }
        }
Exemple #17
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();
            }
        }
Exemple #18
0
 internal static void display_AC(int y_offset, int x_offset, Player player)
 {
     Seg041.DisplayString(player.DisplayAc.ToString(), 0, 10, y_offset, x_offset);
 }
Exemple #19
0
        internal static char displayInput(out bool specialKeyPressed, bool useOverlay, byte accept_ctrlkeys,
                                          MenuColorSet colors, string displayInputString, string displayExtraString)
        {
            int highlistCount;

            gbl.displayInput_specialKeyPressed = false;

            bool var_8F = (colors.foreground != 0) || (colors.highlight != 0);

            HighlightSet highlights = BuildInputKeys(displayInputString, out highlistCount);

            if (gbl.menuSelectedWord >= highlistCount)
            {
                gbl.menuSelectedWord = 0;
            }

            char input_key = '\0';

            specialKeyPressed = false;
            bool stopLoop = false;

            var timeStart     = DateTime.Now;
            var timeCursorOn  = timeStart.AddMilliseconds(300);
            var timeCursorOff = timeCursorOn.AddMilliseconds(500);

            if (displayExtraString.Length != 0)
            {
                Seg041.DisplayString(displayExtraString, 0, colors.prompt, 0x18, 0);
            }

            int displayInputXOffset = displayExtraString.Length;

            display_highlighed_text(gbl.menuSelectedWord, colors.highlight,
                                    displayInputString, displayInputXOffset, colors.foreground, highlights);

            if (gbl.game_state == GameState.WildernessMap &&
                gbl.bigpic_block_id == 0x79 &&
                gbl.lastDaxBlockId != 0x50)
            {
                MapCursor.SetPosition(gbl.area_ptr.current_city);
                MapCursor.Draw();
                MapCursor.Restore();
            }

            do
            {
                if (gbl.game_state == GameState.WildernessMap &&
                    gbl.bigpic_block_id == 0x79 &&
                    gbl.lastDaxBlockId != 0x50 &&
                    DateTime.Now >= timeCursorOn)
                {
                    MapCursor.Draw();
                    timeCursorOn = timeCursorOff.AddMilliseconds(300);
                }

                if ((gbl.area_ptr.picture_fade != 0 || useOverlay == true) &&
                    gbl.byte_1D556.curFrame > 0)
                {
                    ovr030.DrawMaybeOverlayed(gbl.byte_1D556.CurrentPicture(), useOverlay, 3, 3);

                    int delay = gbl.byte_1D556.CurrentDelay() * 100;

                    if ((DateTime.Now.Subtract(timeStart).TotalMilliseconds) >= delay ||
                        gbl.area_ptr.picture_fade != 0)
                    {
                        gbl.byte_1D556.NextFrame();

                        timeStart = DateTime.Now;
                    }
                }

                if (gbl.displayInputSecondsToWait > 0 &&
                    DateTime.Now.Subtract(timeStart).TotalSeconds >= gbl.displayInputSecondsToWait)
                {
                    input_key = gbl.displayInputTimeoutValue;
                    stopLoop  = true;
                }
                else if (seg049.KEYPRESSED() == true)
                {
                    input_key = (char)seg043.GetInputKey();

                    if (input_key == 0)
                    {
                        input_key = (char)seg043.GetInputKey();

                        if (accept_ctrlkeys != 0)
                        {
                            specialKeyPressed = true;
                            stopLoop          = true;
                        }
                    }
                    else if (input_key == 0x1B)
                    {
                        stopLoop  = true;
                        input_key = '\0';
                    }
                    else if (input_key == 13)
                    {
                        if (var_8F)
                        {
                            if (highlights[gbl.menuSelectedWord].start != -1)
                            {
                                input_key = displayInputString[highlights[gbl.menuSelectedWord].start];
                            }
                            else
                            {
                                input_key = '\r';
                            }

                            stopLoop = true;
                        }
                    }
                    else if (input_key == ',')
                    {
                        if (gbl.menuSelectedWord == 0)
                        {
                            gbl.menuSelectedWord = highlistCount - 1;
                        }
                        else
                        {
                            gbl.menuSelectedWord--;
                        }

                        display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString,
                                                displayInputXOffset, colors.foreground, highlights);
                    }
                    else if (input_key == '.')
                    {
                        gbl.menuSelectedWord++;

                        if (gbl.menuSelectedWord >= highlistCount)
                        {
                            gbl.menuSelectedWord = 0;
                        }

                        display_highlighed_text(gbl.menuSelectedWord, colors.highlight, displayInputString,
                                                displayInputXOffset, colors.foreground, highlights);
                    }
                    else
                    {
                        input_key = char.ToUpper(input_key);
                        if (alpha_number_input.MemberOf(input_key) == true)
                        {
                            if (input_key == 0x20)
                            {
                                stopLoop = true;
                            }
                            else
                            {
                                for (int var_62 = 0; var_62 < displayInputString.Length; var_62++)
                                {
                                    if (displayInputString[var_62] == input_key)
                                    {
                                        stopLoop = true;
                                        int var_61 = 0;

                                        while (highlights[var_61].start != var_62)
                                        {
                                            var_61++;
                                        }

                                        gbl.menuSelectedWord = var_61;

                                        display_highlighed_text(gbl.menuSelectedWord, colors.highlight,
                                                                displayInputString, displayInputXOffset, colors.foreground, highlights);
                                    }
                                }
                            }
                        }

                        if (accept_ctrlkeys != 0 &&
                            number_input.MemberOf(input_key) == true)
                        {
                            if (input_key == 'W')
                            {
                                input_key = '7';
                            }
                            else
                            {
                                input_key = keypad_ctrl_codes[input_key - 0x31];
                            }

                            specialKeyPressed = true;
                            stopLoop          = true;
                        }
                    }
                }

                if (gbl.game_state == GameState.WildernessMap &&
                    gbl.bigpic_block_id == 0x79 &&
                    gbl.lastDaxBlockId != 0x50 &&
                    DateTime.Now >= timeCursorOff)
                {
                    MapCursor.Restore();

                    timeCursorOff = timeCursorOn.AddMilliseconds(500);
                }

                System.Threading.Thread.Sleep(20);
            } while (stopLoop == false);

            gbl.area_ptr.picture_fade = 0;

            if (gbl.game_state == GameState.WildernessMap &&
                gbl.bigpic_block_id == 0x79 &&
                gbl.lastDaxBlockId != 0x50)
            {
                MapCursor.Restore();
            }

            gbl.displayInput_specialKeyPressed = specialKeyPressed;

            return(input_key);
        }
Exemple #20
0
        internal static void displayCombatResults(int exp) /* sub_2DABC */
        {
            seg037.DrawFrame_Outer();

            if (gbl.byte_1AB14 == true ||
                gbl.combat_type == CombatType.duel)
            {
                if (gbl.party_fled == true)
                {
                    Seg041.DisplayString("The party has fled.", 0, 10, 3, 1);

                    exp = 0;

                    gbl.items_pointer.Clear();

                    gbl.pooled_money.ClearAll();
                }
                else
                {
                    if ((gbl.combat_type == CombatType.duel && gbl.battleWon == false) ||
                        (gbl.battleWon == false && gbl.area2_ptr.isDuel == true))
                    {
                        gbl.area2_ptr.field_58E = 0x80;
                        Seg041.DisplayString("You have lost the fight.", 0, 10, 3, 1);

                        exp = 0;
                    }
                    else
                    {
                        if (gbl.combat_type == CombatType.duel)
                        {
                            Seg041.DisplayString("You have won the duel.", 0, 10, 3, 1);
                        }
                        else
                        {
                            Seg041.DisplayString("The party has won.", 0, 10, 3, 1);
                        }
                    }
                }
            }
            else
            {
                Seg041.DisplayString("The party has found Treasure!", 0, 10, 3, 1);
            }

            string text;

            if (gbl.combat_type == CombatType.duel)
            {
                text = "The duelist receives " + exp.ToString();
            }
            else
            {
                text = "Each character receives " + exp.ToString();
            }

            Seg041.DisplayString(text, 0, 10, 5, 1);
            Seg041.DisplayString("experience points.", 0, 10, 7, 1);

            ovr027.displayInput(false, 1, new MenuColorSet(15, 15, 15), "press <enter>/<return> to continue",
                                string.Empty);
        }
Exemple #21
0
        internal static void load_pic_final(ref DaxArray daxArray, bool shouldMask, byte block_id, string file_name)
        {
            if (file_name != gbl.lastDaxFile ||
                block_id != gbl.lastDaxBlockId)
            {
                if (block_id != 0xff)
                {
                    if (gbl.AnimationsOn)
                    {
                        ovr027.ClearPromptAreaNoUpdate();
                        Seg041.DisplayString("Loading...Please Wait", 0, 10, 0x18, 0);
                    }

                    DaxArrayFreeDaxBlocks(daxArray);

                    gbl.lastDaxFile    = file_name;
                    gbl.lastDaxBlockId = block_id;

                    bool is_pic_or_final = (file_name == "PIC" || file_name == "FINAL");

                    short  uncompressed_size;
                    byte[] uncompressed_data;

                    seg042.load_decode_dax(out uncompressed_data, out uncompressed_size, block_id,
                                           file_name + gbl.game_area.ToString() + ".dax");

                    if (uncompressed_size == 0)
                    {
                        Seg041.DisplayAndPause("PIC not found", 14);
                    }
                    else
                    {
                        int src_offset = 0;

                        daxArray.numFrames = uncompressed_data[src_offset];
                        src_offset++;
                        daxArray.curFrame = 1;

                        byte frames_count = 0; // kind of pointless...

                        if (gbl.AnimationsOn == false && is_pic_or_final == true)
                        {
                            daxArray.numFrames = 1;
                        }

                        byte[] first_frame_ega_layout = null;

                        for (int frame = 0; frame < daxArray.numFrames; frame++)
                        {
                            daxArray.frames[frame].delay = Sys.ArrayToInt(uncompressed_data, src_offset);
                            src_offset += 4;

                            short height = Sys.ArrayToShort(uncompressed_data, src_offset);
                            src_offset += 2;

                            short width = Sys.ArrayToShort(uncompressed_data, src_offset);
                            src_offset += 2;

                            frames_count++;

                            daxArray.frames[frame].picture = new DaxBlock(1, width, height);

                            DaxBlock dax_block = daxArray.frames[frame].picture;

                            dax_block.XPos = Sys.ArrayToShort(uncompressed_data, src_offset);
                            src_offset    += 2;

                            dax_block.YPos = Sys.ArrayToShort(uncompressed_data, src_offset);
                            src_offset    += 3;

                            // Skipping unused bytes
                            src_offset += 8;

                            int ega_encoded_size = (daxArray.frames[frame].picture.Bpp / 2) - 1;

                            if (is_pic_or_final == true)
                            {
                                if (frame == 0)
                                {
                                    first_frame_ega_layout = new byte[ega_encoded_size + 1];

                                    System.Array.Copy(uncompressed_data, src_offset, first_frame_ega_layout, 0,
                                                      ega_encoded_size + 1);
                                }
                                else
                                {
                                    for (int i = 0; i < ega_encoded_size; i++)
                                    {
                                        byte b = first_frame_ega_layout[i];
                                        uncompressed_data[src_offset + i] ^= b;
                                    }
                                }
                            }

                            daxArray.frames[frame].picture.DaxToPicture(0, shouldMask, src_offset, uncompressed_data);

                            if (shouldMask)
                            {
                                daxArray.frames[frame].picture
                                .Recolor(false, transparentNewColors, transparentOldColors);
                            }

                            src_offset += ega_encoded_size + 1;
                        }

                        daxArray.numFrames = frames_count; // also pointless

                        uncompressed_data = null;
                        seg043.clear_keyboard();

                        if (gbl.AnimationsOn)
                        {
                            ovr027.ClearPromptAreaNoUpdate();
                        }
                    }
                }
            }
        }
Exemple #22
0
        /// <summary>
        /// Turns if pictures need re-loading
        /// </summary>
        internal static bool appraiseGemsJewels()
        {
            bool   special_key;
            short  value;
            string sell_text;

            if (gbl.SelectedPlayer.Money.Gems == 0 && gbl.SelectedPlayer.Money.Jewels == 0)
            {
                ovr025.string_print01("No Gems or Jewelry");
                return(false);
            }

            bool stop_loop;

            do
            {
                if (gbl.SelectedPlayer.Money.Gems == 0 && gbl.SelectedPlayer.Money.Jewels == 0)
                {
                    stop_loop = true;
                }
                else
                {
                    stop_loop = false;

                    string gem_text   = gbl.SelectedPlayer.Money.Gems.ToString();
                    string jewel_text = gbl.SelectedPlayer.Money.Jewels.ToString();

                    if (gbl.SelectedPlayer.Money.Gems == 0)
                    {
                        gem_text = string.Empty;
                    }
                    else if (gbl.SelectedPlayer.Money.Gems == 1)
                    {
                        gem_text += " Gem";
                    }
                    else
                    {
                        gem_text += " Gems";
                    }

                    if (gbl.SelectedPlayer.Money.Jewels == 0)
                    {
                        jewel_text = string.Empty;
                    }
                    else if (gbl.SelectedPlayer.Money.Jewels == 1)
                    {
                        jewel_text += " piece of Jewelry";
                    }
                    else
                    {
                        jewel_text += " pieces of Jewelry";
                    }

                    seg037.draw8x8_clear_area(0x16, 0x26, 1, 1);
                    ovr025.displayPlayerName(false, 1, 1, gbl.SelectedPlayer);

                    Seg041.DisplayString("You have a fine collection of:", 0, 0xf, 7, 1);
                    Seg041.DisplayString(gem_text, 0, 0x0f, 9, 1);
                    Seg041.DisplayString(jewel_text, 0, 0x0f, 0x0a, 1);
                    string prompt = string.Empty;

                    if (gbl.SelectedPlayer.Money.Gems != 0)
                    {
                        prompt = "  Gems";
                    }

                    if (gbl.SelectedPlayer.Money.Jewels != 0)
                    {
                        prompt += " Jewelry";
                    }

                    prompt += " Exit";

                    char input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, prompt,
                                                         "Appraise : ");

                    if (input_key == 'G')
                    {
                        if (gbl.SelectedPlayer.Money.Gems > 0)
                        {
                            gbl.SelectedPlayer.Money.AddCoins(Money.Gems, -1);

                            int roll = ovr024.roll_dice(100, 1);

                            if (roll >= 1 && roll <= 25)
                            {
                                value = 10;
                            }
                            else if (roll >= 26 && roll <= 50)
                            {
                                value = 50;
                            }
                            else if (roll >= 51 && roll <= 70)
                            {
                                value = 100;
                            }
                            else if (roll >= 71 && roll <= 90)
                            {
                                value = 500;
                            }
                            else if (roll >= 91 && roll <= 99)
                            {
                                value = 1000;
                            }
                            else if (roll == 100)
                            {
                                value = 5000;
                            }
                            else
                            {
                                value = 0;
                            }

                            string value_text = "The Gem is Valued at " + value.ToString() + " gp.";

                            Seg041.DisplayString(value_text, 0, 15, 12, 1);

                            bool must_sell;

                            if (willOverload(1, gbl.SelectedPlayer) == true ||
                                gbl.SelectedPlayer.items.Count >= Player.MaxItems)
                            {
                                sell_text = "Sell";
                                must_sell = true;
                            }
                            else
                            {
                                sell_text = "Sell Keep";
                                must_sell = false;
                            }

                            input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, sell_text,
                                                            "You can : ");

                            if (input_key == 'K' && must_sell == false)
                            {
                                Item gem_item = new Item(0, 0, 0, value, 0, 1, false, 0, false, 0, 0, 0x65, 0, 0,
                                                         ItemType.Necklace, true);

                                gbl.SelectedPlayer.items.Add(gem_item);
                            }
                            else
                            {
                                value /= 5;
                                addPlayerGold(value);
                            }
                        }
                    }
                    else if (input_key == 'J')
                    {
                        if (gbl.SelectedPlayer.Money.Jewels > 0)
                        {
                            gbl.SelectedPlayer.Money.AddCoins(Money.Jewelry, -1);

                            int roll = ovr024.roll_dice(100, 1);

                            if (roll >= 1 && roll <= 10)
                            {
                                value = (short)(seg051.Random(900) + 100);
                            }
                            else if (roll >= 11 && roll <= 20)
                            {
                                value = (short)(seg051.Random(1000) + 200);
                            }
                            else if (roll >= 21 && roll <= 40)
                            {
                                value = (short)(seg051.Random(1500) + 300);
                            }
                            else if (roll >= 41 && roll <= 50)
                            {
                                value = (short)(seg051.Random(2500) + 500);
                            }
                            else if (roll >= 51 && roll <= 70)
                            {
                                value = (short)(seg051.Random(5000) + 1000);
                            }
                            else if (roll >= 0x47 && roll <= 0x5A)
                            {
                                value = (short)(seg051.Random(6000) + 2000);
                            }
                            else if (roll >= 0x5B && roll <= 0x64)
                            {
                                value = (short)(seg051.Random(10000) + 2000);
                            }
                            else
                            {
                                value = 0;
                            }

                            string value_text = string.Format("The Jewel is Valued at {0} gp.", value);
                            Seg041.DisplayString(value_text, 0, 15, 12, 1);

                            bool must_sell;
                            if (willOverload(1, gbl.SelectedPlayer) == true ||
                                gbl.SelectedPlayer.items.Count >= Player.MaxItems)
                            {
                                sell_text = "Sell";
                                must_sell = true;
                            }
                            else
                            {
                                sell_text = "Sell Keep";
                                must_sell = false;
                            }

                            input_key = ovr027.displayInput(out special_key, false, 1, gbl.defaultMenuColors, sell_text,
                                                            "You can : ");

                            if (input_key == 'K' && must_sell == false)
                            {
                                Item jewel_item = new Item(0, 0, 0, value, 0, 1, false, 0, false, 0, 0, 0xd6, 0, 0,
                                                           ItemType.Necklace, true);

                                gbl.SelectedPlayer.items.Add(jewel_item);
                            }
                            else
                            {
                                value /= 5;
                                addPlayerGold(value);
                            }
                        }
                    }
                    else if (input_key == 'E' || input_key == 0)
                    {
                        stop_loop = true;
                    }

                    ovr025.reclac_player_values(gbl.SelectedPlayer);
                }
            } while (stop_loop == false);

            return(true);
        }
Exemple #23
0
        internal static void moralFailureEscape(Player player) // sub_359D1
        {
            int var_2 = 0;                                     /* Simeon */
            int dir;

            string prompt = string.Format("Move/Attack, Move Left = {0} ", player.actions.move / 2);

            Seg041.DisplayString(prompt, 0, 10, 0x18, 0);

            if (process_input_in_monsters_turn(player))
            {
                return;
            }

            if ((player.actions.move / 2) > 0 &&
                player.actions.delay > 0)
            {
                if (player.control_morale < Control.NPC_Base ||
                    (player.control_morale >= Control.NPC_Base &&
                     gbl.enemyHealthPercentage <= (ovr024.roll_dice(100, 1) + gbl.monster_morale)) ||
                    player.combat_team == CombatTeam.Enemy)
                {
                    if (player.actions.moral_failure == true ||
                        player.activeItems.armor != null ||
                        player._class != ClassId.magic_user)
                    {
                        if (player.actions.moral_failure == false)
                        {
                            dir = ovr014.getTargetDirection(player.actions.target, player);
                        }
                        else
                        {
                            player.actions.field_15 = ovr024.roll_dice(2, 1);
                            dir = gbl.mapDirection - (((gbl.mapDirection + 2) % 4) / 2) + 8;

                            if (player.combat_team == CombatTeam.Ours)
                            {
                                dir += 4;
                            }

                            dir %= 8;
                        }

                        bool zeroTitle = false;
                        bool var_5     = false;
                        int  dirStep   = 1;

                        while (dirStep < 6 && var_5 == false &&
                               CanMove(out zeroTitle, dir, dirStep, player) == false)
                        {
                            if (player.actions.moral_failure == true &&
                                zeroTitle == true)
                            {
                                var_5 = true;
                                ovr014.flee_battle(player);
                            }
                            else
                            {
                                dirStep++;
                            }
                        }

                        if (var_5 == true)
                        {
                            player.actions.move          = 0;
                            player.actions.moral_failure = false;
                            ovr025.clear_actions(player);
                        }
                        else
                        {
                            var_2 = (data_2B8[player.actions.field_15, dirStep - 1] + dir) % 8;

                            if (dirStep == 6 || ((var_2 + 4) % 8) == byte_1AB18)
                            {
                                byte_1AB19++;
                                player.actions.field_15 = (player.actions.field_15 % 6) + 1;

                                if (byte_1AB19 > 1)
                                {
                                    player.actions.target = null;

                                    if (byte_1AB19 > 2)
                                    {
                                        player.actions.move = 0;
                                        var_5 = true;
                                    }
                                    else if (ovr014.find_target(false, 1, 0xFF, player) == false)
                                    {
                                        var_5 = true;
                                        TryGuarding(player);
                                    }
                                }
                            }

                            if (dirStep < 6)
                            {
                                byte_1AB18 = var_2;
                            }
                            else
                            {
                                var_5 = true;
                            }
                        }

                        if (var_5 == false)
                        {
                            gbl.focusCombatAreaOnPlayer =
                                (gbl.byte_1D90E || ovr033.PlayerOnScreen(false, player) ||
                                 player.combat_team == CombatTeam.Ours);

                            ovr033.draw_74B3F(false, Icon.Normal, var_2, player);
                            ovr014.move_step_away_attack(player.actions.direction, player);

                            if (player.in_combat == false)
                            {
                                var_5 = true;
                                ovr025.clear_actions(player);
                            }
                            else
                            {
                                if (player.actions.move > 0)
                                {
                                    ovr014.sub_3E748(player.actions.direction, player);
                                }

                                if (player.in_combat == false)
                                {
                                    var_5 = true;
                                    ovr025.clear_actions(player);
                                }

                                ovr024.in_poison_cloud(1, player);
                            }
                        }

                        return;
                    }
                }
            }

            TryGuarding(player);
        }
Exemple #24
0
        static bool BuildMemorizeSpellText() // sub_445D4
        {
            const int MaxSpellLevel = 5;
            const int MaxSpellClass = 3;

            string[,] var_60 = new string[MaxSpellClass, MaxSpellLevel];

            bool[] canLearnSpellClass = new bool[MaxSpellClass];

            bool found = false;

            for (var spellClass = SpellClass.Cleric; spellClass < SpellClass.Monster; spellClass++)
            {
                canLearnSpellClass[(int)spellClass] = false;

                for (int spellLevel = 0; spellLevel < MaxSpellLevel; spellLevel++)
                {
                    var_60[(int)spellClass, spellLevel] =
                        HowManySpellsPlayerCanLearn(spellClass, spellLevel + 1).ToString();

                    if (gbl.SelectedPlayer.spellCastCount[(int)spellClass, spellLevel] == 0)
                    {
                        var_60[(int)spellClass, spellLevel] = " ";
                    }
                    else
                    {
                        canLearnSpellClass[(int)spellClass] = true;
                        found = true;
                    }
                }
            }

            if (found == true)
            {
                ovr025.DisplayPlayerStatusString(false, 10, "can memorize:", gbl.SelectedPlayer);
                int y_col = 3;
                for (int spellClass = 0; spellClass < MaxSpellClass; spellClass++)
                {
                    if (canLearnSpellClass[spellClass])
                    {
                        string text = string.Empty;

                        switch (spellClass)
                        {
                        case 0:
                            text = "    Cleric Spells:";
                            break;

                        case 1:
                            text = "     Druid Spells:";
                            break;

                        case 2:
                            text = "Magic-User Spells:";
                            break;
                        }

                        Seg041.DisplayString(text, 0, 10, y_col + 17, 1);
                        int x_col = 0x13;
                        for (int spellLevel = 0; spellLevel < MaxSpellLevel; spellLevel++)
                        {
                            Seg041.DisplayString(var_60[spellClass, spellLevel], 0, 10, y_col + 0x11, x_col + 1);
                            x_col += 3;
                        }

                        y_col++;
                    }
                }
            }

            return(found);
        }
Exemple #25
0
        internal static void loadSaveGame(string file_name)
        {
            Classes.File file;
            seg042.find_and_open_file(out file, true, file_name);

            ovr027.ClearPromptArea();
            Seg041.DisplayString("Loading...Please Wait", 0, 10, 0x18, 0);
            gbl.reload_ecl_and_pictures = true;

            byte[] data = new byte[0x2000];

            seg051.BlockRead(1, data, file);
            gbl.game_area = data[0];

            seg051.BlockRead(0x800, data, file);
            gbl.area_ptr = new Area1(data, 0);

            seg051.BlockRead(0x800, data, file);
            gbl.area2_ptr = new Area2(data, 0);

            seg051.BlockRead(0x400, data, file);
            gbl.stru_1B2CA = new Struct_1B2CA(data, 0);

            seg051.BlockRead(0x1E00, data, file);
            gbl.ecl_ptr = new EclBlock(data, 0);

            seg051.BlockRead(5, data, file);
            gbl.mapPosX      = (sbyte)data[0];
            gbl.mapPosY      = (sbyte)data[1];
            gbl.mapDirection = data[2];
            gbl.mapWallType  = data[3];
            gbl.mapWallRoof  = data[4];

            seg051.BlockRead(1, data, file);
            gbl.last_game_state = (GameState)data[0];

            seg051.BlockRead(1, data, file);
            gbl.game_state = (GameState)data[0];

            for (int i = 0; i < 3; i++)
            {
                seg051.BlockRead(2, data, file);
                gbl.setBlocks[i].blockId = Sys.ArrayToShort(data, 0);

                seg051.BlockRead(2, data, file);
                gbl.setBlocks[i].setId = Sys.ArrayToShort(data, 0);
            }

            seg051.BlockRead(1, data, file);
            int number_of_players = data[0];

            seg051.BlockRead(0x148, data, file);
            string[] var_148 = Sys.ArrayToStrings(data, 0, System.Math.Min(0x148, 0x29 * number_of_players), 0x29);

            seg051.Close(file);

            //gbl.PicsOn = ((gbl.area_ptr.pics_on >> 1) != 0);
            //gbl.AnimationsOn = ((gbl.area_ptr.pics_on & 1) != 0);
            gbl.game_speed_var       = gbl.area_ptr.game_speed;
            gbl.area2_ptr.party_size = 0;

            for (int index = 0; index < number_of_players; index++)
            {
                string var_1F6 = seg042.clean_string(var_148[index]);

                if (seg042.file_find(Path.Combine(Config.GetSavePath(), var_1F6 + ".sav")) == true)
                {
                    Player player = new Player();

                    import_char01(ref player, var_1F6 + ".sav");
                    AssignPlayerIconId(player);
                }
            }

            foreach (Player tmp_player in gbl.TeamList)
            {
                remove_player_file(tmp_player);
            }

            foreach (Player tmp_player in gbl.TeamList)
            {
                gbl.SelectedPlayer = tmp_player;

                if (gbl.SelectedPlayer.control_morale < Control.NPC_Base)
                {
                    LoadPlayerCombatIcon(true);
                }
                else
                {
                    ovr034.chead_cbody_comspr_icon(gbl.SelectedPlayer.icon_id, gbl.SelectedPlayer.mod_id, "CPIC");
                }
            }


            gbl.SelectedPlayer = gbl.TeamList[0];

            gbl.game_area = gbl.area2_ptr.game_area;

            if (gbl.area_ptr.inDungeon != 0)
            {
                if (gbl.game_state != GameState.StartGameMenu)
                {
                    if (gbl.setBlocks[0].blockId > 0)
                    {
                        ovr031.Load3DMap(gbl.area_ptr.current_3DMap_block_id);
                    }

                    for (int i = 0; i < 3; i++)
                    {
                        if (gbl.setBlocks[i].blockId > 0)
                        {
                            ovr031.LoadWalldef(gbl.setBlocks[i].setId, gbl.setBlocks[i].blockId);
                        }
                    }
                }
            }
            else
            {
                ovr030.load_bigpic(0x79);
            }

            seg043.clear_keyboard();
            ovr027.ClearPromptArea();

            gbl.last_game_state = gbl.game_state;

            gbl.game_state = GameState.StartGameMenu;
        }
Exemple #26
0
        /// <summary>
        /// returns if the party is interrupted
        /// </summary>
        internal static bool resting(bool interactive_resting) /* reseting */
        {
            bool stop_resting;
            bool resting_intetrupted = false;

            System.Array.Clear(spellLaernTimeout, 0, gbl.TeamList.Count);

            for (int i = 0; i < 0x48; i++)
            {
                gbl.affects_timed_out[i] = true;
            }

            int var_C           = 0;
            int display_counter = 0;

            if (interactive_resting == true)
            {
                seg037.draw8x8_clear_area(TextRegion.NormalBottom);
                display_resting_time(0);
            }

            gbl.displayPlayerStatusLine18 = true;

            if (interactive_resting == true)
            {
                stop_resting = !resting_time_menu();
            }
            else
            {
                stop_resting = false;
            }

            while (stop_resting == false &&
                   (gbl.timeToRest.field_8 > 0 ||
                    gbl.timeToRest.field_6 > 0 ||
                    gbl.timeToRest.field_4 > 0 ||
                    gbl.timeToRest.field_2 > 0))
            {
                if (interactive_resting == true &&
                    seg049.KEYPRESSED() == true)
                {
                    display_resting_time(0);

                    if (ovr027.yes_no(gbl.defaultMenuColors, "Stop Resting? ") == 'Y')
                    {
                        stop_resting = true;
                    }
                    else
                    {
                        ovr027.ClearPromptArea();
                    }
                }

                if (stop_resting == false)
                {
                    rest_time_5849F(1, 5);
                    display_counter++;

                    if (interactive_resting == true &&
                        display_counter >= 5)
                    {
                        display_resting_time(0);
                        display_counter = 0;
                    }

                    step_game_time(1, 5);
                    rest_heal(interactive_resting);
                    CheckForSpellLearning();
                    sub_58C03(ref var_C);

                    if (gbl.area2_ptr.rest_incounter_period > 0)
                    {
                        gbl.rest_incounter_count++;

                        if (gbl.rest_incounter_count >= gbl.area2_ptr.rest_incounter_period)
                        {
                            gbl.rest_incounter_count = 0;

                            if (ovr024.roll_dice(100, 1) <= gbl.area2_ptr.rest_incounter_percentage)
                            {
                                ovr025.ClearPlayerTextArea();
                                display_resting_time(0);
                                Seg041.DisplayString("Your repose is suddenly interrupted!", 0, 15, 0x13, 1);
                                stop_resting        = true;
                                resting_intetrupted = true;
                                Seg041.GameDelay();
                            }
                        }
                    }
                }
            }

            seg037.draw8x8_clear_area(TextRegion.NormalBottom);
            gbl.displayPlayerStatusLine18 = false;

            return(resting_intetrupted);
        }
Exemple #27
0
        /// <summary>
        /// Does Camp menu, returns if interrupted
        /// </summary>
        internal static bool MakeCamp() // make_camp
        {
            var game_state_bkup = gbl.game_state;

            gbl.game_state      = GameState.Camping;
            gbl.rest_10_seconds = 0;

            gbl.timeToRest.Clear();

            gbl.byte_1D5AB = gbl.lastDaxFile;
            gbl.byte_1D5B5 = gbl.lastDaxBlockId;

            ovr025.LoadPic();
            seg037.draw8x8_clear_area(TextRegion.NormalBottom);

            Seg041.DisplayString("The party makes camp...", 0, 10, 18, 1);
            cancel_spells();
            bool actionInterrupted = false;
            char input_key         = ' ';

            while (actionInterrupted == false &&
                   unk_463F4.MemberOf(input_key) == false)
            {
                bool special_key;
                input_key = ovr027.displayInput(out special_key, true, 1, gbl.defaultMenuColors,
                                                "Save View Magic Rest Alter Fix Exit", "Camp:");

                if (special_key == true)
                {
                    ovr020.scroll_team_list(input_key);
                    ovr025.PartySummary(gbl.SelectedPlayer);
                }
                else
                {
                    switch (input_key)
                    {
                    case 'S':
                        ovr017.SaveGame();
                        if (ovr027.yes_no(gbl.alertMenuColors, "Quit TO DOS ") == 'Y')
                        {
                            seg043.print_and_exit();
                        }

                        break;

                    case 'V':
                        gbl.menuSelectedWord = 1;
                        ovr020.viewPlayer();
                        break;

                    case 'M':
                        gbl.menuSelectedWord = 1;
                        actionInterrupted    = magic_menu();
                        break;

                    case 'R':
                        gbl.menuSelectedWord = 1;
                        actionInterrupted    = rest_menu();
                        break;

                    case 'F':
                        actionInterrupted = FixTeam();
                        break;

                    case 'A':
                        gbl.menuSelectedWord = 1;
                        alter_menu();
                        break;
                    }
                }
            }

            if (seg051.Copy(3, 1, gbl.byte_1D5AB) == "PIC")
            {
                ovr030.load_pic_final(ref gbl.byte_1D556, false, gbl.byte_1D5B5, gbl.byte_1D5AB);
            }

            cancel_spells();
            gbl.lastSelectetSpellTarget = null;
            gbl.game_state = game_state_bkup;
            ovr025.display_map_position_time();
            ovr025.ClearPlayerTextArea();
            ovr027.ClearPromptArea();

            return(actionInterrupted);
        }
Exemple #28
0
        internal static short AskNumberValue(byte fgColor, string prompt, int maxValue) // sub_592AD
        {
            ovr027.ClearPromptAreaNoUpdate();
            Seg041.DisplayString(prompt, 0, fgColor, 0x18, 0);

            int prompt_width = prompt.Length;
            int xCol         = prompt_width;

            char   inputKey;
            string maxValueStr     = maxValue.ToString();
            string currentValueStr = string.Empty;

            do
            {
                inputKey = (char)seg043.GetInputKey();

                if (inputKey >= 0x30 &&
                    inputKey <= 0x39)
                {
                    currentValueStr += inputKey.ToString();

                    int tmpValue = int.Parse(currentValueStr);

                    if (maxValue >= tmpValue)
                    {
                        xCol++;
                    }
                    else
                    {
                        currentValueStr = maxValueStr;

                        xCol = maxValueStr.Length + prompt_width;
                    }

                    Seg041.DisplayString(currentValueStr, 0, 15, 0x18, prompt_width);
                }
                else if (inputKey == 8 && currentValueStr.Length > 0)
                {
                    int i = currentValueStr.Length - 1;
                    currentValueStr = seg051.Copy(i, 0, currentValueStr);

                    Seg041.DisplaySpaceChar(0x18, xCol - 1);
                    xCol--;
                }
            } while (inputKey != 0x0D && inputKey != 0x1B);

            ovr027.ClearPromptAreaNoUpdate();

            int var_44;

            if (inputKey == 0x1B ||
                (inputKey == 0x0D && currentValueStr.Length == 0))
            {
                var_44 = 0;
            }
            else
            {
                var_44 = int.Parse(currentValueStr);
            }

            return((short)var_44);
        }
Exemple #29
0
        internal static void temple_heal()
        {
            int sl_index = 0;

            bool end_shop = false;

            List <MenuItem> stringList = new List <MenuItem>(10);

            for (int i = 0; i < 10; i++)
            {
                stringList.Add(new MenuItem(temple_sl[i]));
            }

            ovr027.ClearPromptAreaNoUpdate();
            bool redrawMenuItems = true;

            seg037.DrawFrame_WildernessMap();

            do
            {
                string text = gbl.SelectedPlayer.name + ", how can we help you?";
                Seg041.DisplayString(text, 0, 15, 1, 1);
                MenuItem dummySelected;

                char sl_output = ovr027.sl_select_item(out dummySelected, ref sl_index, ref redrawMenuItems, false,
                                                       stringList, 15, 0x26, 4, 2, gbl.defaultMenuColors, "Heal Exit", string.Empty);

                if (sl_output == 'H' || sl_output == 0x0d)
                {
                    switch (sl_index)
                    {
                    case 0:
                        cure_blindness();
                        break;

                    case 1:
                        cure_disease();
                        break;

                    case 2:
                        cure_wounds(1);
                        break;

                    case 3:
                        cure_wounds(2);
                        break;

                    case 4:
                        cure_wounds(3);
                        break;

                    case 5:
                        cure_wounds(4);
                        break;

                    case 6:
                        cure_poison2();
                        break;

                    case 7:
                        raise_dead();
                        break;

                    case 8:
                        remove_curse();
                        break;

                    case 9:
                        stone_to_flesh();
                        break;

                    case 10:
                        end_shop = true;
                        break;
                    }
                }
                else if (sl_output == 0)
                {
                    end_shop = true;
                }
            } while (end_shop == false);

            stringList.Clear();

            ovr025.LoadPic();
            ovr025.PartySummary(gbl.SelectedPlayer);
        }
Exemple #30
0
        internal static void import_char01(ref Player player, string arg_8)
        {
            Classes.File file;

            seg042.find_and_open_file(out file, false, Path.Combine(Config.GetSavePath(), arg_8));

            Seg041.DisplayString("Loading...Please Wait", 0, 10, 0x18, 0);


            if (gbl.import_from == ImportSource.Curse)
            {
                byte[] data = new byte[Player.StructSize];
                seg051.BlockRead(Player.StructSize, data, file);
                seg051.Close(file);

                player = new Player(data, 0);
            }
            else if (gbl.import_from == ImportSource.Pool)
            {
                byte[] data = new byte[PoolRadPlayer.StructSize];
                seg051.BlockRead(PoolRadPlayer.StructSize, data, file);
                seg051.Close(file);

                PoolRadPlayer poolRadPlayer = new PoolRadPlayer(data);

                player = ConvertPoolRadPlayer(poolRadPlayer);
            }
            else if (gbl.import_from == ImportSource.Hillsfar)
            {
                byte[] data = new byte[HillsFarPlayer.StructSize];
                seg051.BlockRead(HillsFarPlayer.StructSize, data, file);
                seg051.Close(file);

                HillsFarPlayer var_1C4 = new HillsFarPlayer(data);

                player = ConvertHillsFarPlayer(var_1C4, arg_8);

                var_1C4 = null;
            }

            if (gbl.import_from == ImportSource.Curse)
            {
                arg_8 = System.IO.Path.GetFileNameWithoutExtension(arg_8);
            }
            else
            {
                arg_8 = seg042.clean_string(player.name);
            }

            string filename = Path.Combine(Config.GetSavePath(), arg_8 + ".swg");

            if (seg042.file_find(filename) == true)
            {
                byte[] data = new byte[Item.StructSize];

                seg042.find_and_open_file(out file, false, filename);

                while (true)
                {
                    if (seg051.BlockRead(Item.StructSize, data, file) == Item.StructSize)
                    {
                        player.items.Add(new Item(data, 0));
                    }
                    else
                    {
                        break;
                    }
                }

                seg051.Close(file);
            }

            filename = Path.Combine(Config.GetSavePath(), arg_8 + ".fx");
            if (seg042.file_find(filename) == true)
            {
                byte[] data = new byte[Affect.StructSize];
                seg042.find_and_open_file(out file, false, filename);

                while (true)
                {
                    if (seg051.BlockRead(Affect.StructSize, data, file) == Affect.StructSize)
                    {
                        Affect tmp_affect = new Affect(data, 0);

                        player.affects.Add(new Affect(data, 0));
                    }
                    else
                    {
                        break;
                    }
                }

                seg051.Close(file);
            }

            filename = Path.Combine(Config.GetSavePath(), arg_8 + ".spc");
            if (gbl.import_from == ImportSource.Pool)
            {
                if (seg042.file_find(filename) == true)
                {
                    byte[] data = new byte[Affect.StructSize];
                    seg042.find_and_open_file(out file, false, filename);

                    while (true)
                    {
                        if (seg051.BlockRead(Affect.StructSize, data, file) == Affect.StructSize)
                        {
                            if (asc_49280.MemberOf(data[0]) == true)
                            {
                                Affect tmpAffect = new Affect(data, 0);
                                player.affects.Add(tmpAffect);
                            }
                        }
                        else
                        {
                            break;
                        }
                    }

                    seg051.Close(file);
                }
            }

            seg043.clear_keyboard();
            ovr025.reclac_player_values(player);
            ovr026.ReclacClassBonuses(player);
        }