예제 #1
0
        internal static void head_body(byte body_id, byte head_id)
        {
            string text = gbl.game_area.ToString();

            if (head_id != 0xff &&
                (gbl.current_head_id == 0xff || gbl.current_head_id != head_id))
            {
                gbl.headX_dax = seg040.LoadDax(0, false, head_id, "HEAD" + text);

                if (gbl.headX_dax == null)
                {
                    Seg041.DisplayAndPause("head not found", 14);
                }

                gbl.current_head_id = head_id;
            }

            if (body_id != 0xff &&
                (gbl.current_body_id == 0xff || gbl.current_body_id != body_id))
            {
                gbl.bodyX_dax = seg040.LoadDax(0, false, body_id, "BODY" + text);
                if (gbl.bodyX_dax == null)
                {
                    Seg041.DisplayAndPause("body not found", 14);
                }

                gbl.current_body_id = body_id;
            }

            seg043.clear_keyboard();
        }
예제 #2
0
 internal static void lose_item(Item item, Player player)
 {
     if (!player.items.Remove(item))
     {
         Seg041.DisplayAndPause("Tried to Lose item & couldn't find it!", 14);
     }
 }
예제 #3
0
        internal static void AfterCombatExpAndTreasure() // sub_2E7A2
        {
            gbl.area2_ptr.field_58E = 0;
            gbl.byte_1AB14          = false;

            if (gbl.inDemo == false)
            {
                CleanupPlayersStateAfterCombat();
            }

            gbl.game_state = GameState.AfterCombat;

            DeallocateNonTeamMemebers();

            if (gbl.inDemo == false)
            {
                foreach (Player player in gbl.TeamList)
                {
                    ovr025.reclac_player_values(player);
                }

                if (gbl.party_killed == false ||
                    gbl.combat_type == CombatType.duel)
                {
                    if (gbl.party_fled == true)
                    {
                        gbl.items_pointer.Clear();
                    }

                    if (gbl.inDemo == false)
                    {
                        distributeNpcTreasure();
                        displayCombatResults(gbl.exp_to_add);
                        distributeCombatTreasure();
                    }

                    gbl.items_pointer.Clear();
                }
                else
                {
                    gbl.area2_ptr.field_58E = 0x80;
                    seg037.DrawFrame_Outer();
                    gbl.textXCol = 2;
                    gbl.textYCol = 6;
                    Seg041.press_any_key("The monsters rejoice for the party has been destroyed", true, 10, 0x16, 0x25,
                                         5, 2);
                    Seg041.DisplayAndPause("Press any key to continue", 13);
                }

                gbl.DelayBetweenCharacters = true;
                gbl.area2_ptr.field_6E0    = 0;
                gbl.area2_ptr.field_6E2    = 0;
                gbl.area2_ptr.field_6E4    = 0;
                gbl.area2_ptr.field_5C6    = 0;
                gbl.area2_ptr.isDuel       = false;
            }
        }
예제 #4
0
        internal static Player load_mob(int monster_id, bool exit)
        {
            string area_text = gbl.game_area.ToString();

            byte[] data;
            short  decode_size;

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "CHA.dax");

            if (decode_size == 0)
            {
                if (exit)
                {
                    Seg041.DisplayAndPause("Unable to load monster", 15);
                    seg043.print_and_exit();
                }
                else
                {
                    return(null);
                }
            }

            Player player = new Player(data, 0);

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "SPC.dax");

            if (decode_size != 0)
            {
                int offset = 0;

                do
                {
                    Affect affect = new Affect(data, offset);
                    player.affects.Add(affect);

                    offset += 9;
                } while (offset < decode_size);
            }

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "ITM.dax");

            if (decode_size != 0)
            {
                for (int offset = 0; offset < decode_size; offset += Item.StructSize)
                {
                    player.items.Add(new Item(data, offset));
                }
            }

            seg043.clear_keyboard();

            return(player);
        }
예제 #5
0
        internal static void sub_32200(Player player, int damage) /* sub_32200 */
        {
            if (player.health_status != Status.dead)
            {
                string text;
                bool   clear_text_area = false;

                if ((player.hit_point_current + 10) < damage)
                {
                    text = string.Format("  {0} dies. ", player.name);
                }
                else
                {
                    text = string.Format("  {0} is hit FOR {1} points of Damage.", player.name, damage);
                }

                if (gbl.textYCol > 0x16)
                {
                    gbl.textYCol    = 0x11;
                    clear_text_area = true;
                    Seg041.DisplayAndPause("press <enter>/<return> to continue", 15);
                }
                else
                {
                    clear_text_area = false;
                }

                gbl.textXCol = 0x26;

                Seg041.press_any_key(text, clear_text_area, 15, 0x16, 0x26, 17, 1);

                ovr025.damage_player(damage, player);
                seg037.draw8x8_clear_area(0x0f, 0x26, 1, 0x11);

                ovr025.PartySummary(player);
            }
        }
예제 #6
0
        internal static void end_game_text()
        {
            gbl.last_game_state = gbl.game_state;
            gbl.game_state      = GameState.EndGame;

            Seg041.press_any_key(aTyranthraxusSp, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aStormGiant_You, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aTheAmuletOfLyt, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aYouOfYourVicto, false, 10, TextRegion.NormalBottom);
            Seg041.DisplayAndPause("Press any key to continue.", 13);

            Seg041.press_any_key(aAsYouReachForT, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aOutKeepTheGaun, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aWillUnleashDan, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aGauntletContac, false, 10, TextRegion.NormalBottom);

            ShowAnimation(1, 0x4a, 3, 3);

            Seg041.DisplayAndPause("Press any key to continue.", 13);
            ovr027.ClearPromptArea();

            Seg041.press_any_key(aIAmTrappedWith, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aWhereArmiesHav, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aIsSlainThisDay, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aNothingness_, false, 10, TextRegion.NormalBottom);

            ShowAnimation(1, 0x4B, 3, 3);

            Seg041.DisplayAndPause("Press any key to continue.", 13);
            ovr027.ClearPromptArea();

            Seg041.press_any_key(aYouAreCertainH, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aFinalBondFades, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aHasFinallyBeen, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aLast, false, 10, TextRegion.NormalBottom);

            gbl.area_ptr.picture_fade = 1;

            ShowAnimation((10 - gbl.game_speed_var) * 2, 0x4d, 3, 3);

            gbl.area_ptr.picture_fade = 0;

            ovr030.head_body(0x41, 0x41);
            ovr030.draw_head_and_body(true, 3, 3);

            Seg041.press_any_key(aTheKnightsOfMy, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aCongratulati_0, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aWithThePowerOf, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aThisFoulPlaceT, false, 10, TextRegion.NormalBottom);

            Seg041.DisplayAndPause("Press any key to continue.", 13);
            ovr027.ClearPromptArea();
            ovr030.load_bigpic(0x7A);

            ovr030.draw_bigpic();

            Seg041.press_any_key(aYouAreTeleport, true, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aHaveAlreadyBeg, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aGharriAndNacac, false, 10, TextRegion.NormalBottom);
            Seg041.press_any_key(aFromTheNearbyS, false, 10, TextRegion.NormalBottom);
            endgame_529F4();

            gbl.game_state = gbl.last_game_state;
            ovr025.LoadPic();
        }
예제 #7
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();
                        }
                    }
                }
            }
        }
예제 #8
0
        internal static void SaveGame()
        {
            char inputKey;

            Classes.File save_file = new Classes.File();
            string[]     var_171   = new string[9];

            do
            {
                inputKey = ovr027.displayInput((gbl.game_state == GameState.Camping), 0, gbl.defaultMenuColors,
                                               "A B C D E F G H I J", "Save Which Game: ");
            } while (unk_4AEA0.MemberOf(inputKey) == false);

            if (inputKey != '\0')
            {
                gbl.import_from = ImportSource.Curse;

                short var_1FC;

                do
                {
                    save_file.Assign(Path.Combine(Config.GetSavePath(), "savgam" + inputKey + ".dat"));
                    seg051.Rewrite(save_file);
                    var_1FC = gbl.FIND_result;

                    if (unk_4AEEF.MemberOf(var_1FC) == false)
                    {
                        Seg041.DisplayAndPause("Unexpected error during save: " + var_1FC.ToString(), 14);
                        seg051.Close(save_file);
                        return;
                    }
                } while (unk_4AEEF.MemberOf(var_1FC) == false);

                ovr027.ClearPromptArea();
                Seg041.DisplayString("Saving...Please Wait", 0, 10, 0x18, 0);

                gbl.area_ptr.game_speed = (byte)gbl.game_speed_var;
                gbl.area_ptr.pics_on    = (byte)(((gbl.PicsOn) ? 0x02 : 0) | ((gbl.AnimationsOn) ? 0x01 : 0));
                gbl.area2_ptr.game_area = gbl.game_area;

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

                data[0] = gbl.game_area;
                seg051.BlockWrite(1, data, save_file);

                seg051.BlockWrite(0x800, gbl.area_ptr.ToByteArray(), save_file);
                seg051.BlockWrite(0x800, gbl.area2_ptr.ToByteArray(), save_file);
                seg051.BlockWrite(0x400, gbl.stru_1B2CA.ToByteArray(), save_file);
                seg051.BlockWrite(0x1E00, gbl.ecl_ptr.ToByteArray(), save_file);

                data[0] = (byte)gbl.mapPosX;
                data[1] = (byte)gbl.mapPosY;
                data[2] = gbl.mapDirection;
                data[3] = gbl.mapWallType;
                data[4] = gbl.mapWallRoof;
                seg051.BlockWrite(5, data, save_file);

                data[0] = (byte)gbl.last_game_state;
                seg051.BlockWrite(1, data, save_file);
                data[0] = (byte)gbl.game_state;
                seg051.BlockWrite(1, data, save_file);

                for (int i = 0; i < 3; i++)
                {
                    Sys.ShortToArray((short)gbl.setBlocks[i].blockId, data, (i * 4) + 0);
                    Sys.ShortToArray((short)gbl.setBlocks[i].setId, data, (i * 4) + 2);
                }

                seg051.BlockWrite(12, data, save_file);

                int party_count = 0;
                foreach (Player tmp_player in gbl.TeamList)
                {
                    party_count++;
                    var_171[party_count - 1] = "CHRDAT" + inputKey + party_count.ToString();
                }

                data[0] = (byte)party_count;
                seg051.BlockWrite(1, data, save_file);

                for (int i = 0; i < party_count; i++)
                {
                    Sys.StringToArray(data, 0x29 * i, 0x29, var_171[i]);
                }

                seg051.BlockWrite(0x148, data, save_file);
                seg051.Close(save_file);

                party_count = 0;
                foreach (Player tmp_player in gbl.TeamList)
                {
                    party_count++;
                    SavePlayer("CHRDAT" + inputKey + party_count.ToString(), tmp_player);
                    remove_player_file(tmp_player);
                }

                gbl.gameSaved = true;
                ovr027.ClearPromptArea();
            }
        }