示例#1
0
文件: ovr033.cs 项目: gowantervo/coab
        internal static Point[] BuildSizeMap(int size, Point pos)
        {
            var map = new System.Collections.Generic.List<Point>();
            foreach (var delta in Steps[size])
            {
                map.Add(pos + delta);
            }

            return map.ToArray();
        }
示例#2
0
文件: ovr024.cs 项目: gowantervo/coab
        // sub_63D03
        static Player sub_63D03(byte[] directions, int arraySize, List<GasCloud> list, Point mapPos)
        {
            var arg_6 = list.Find(cell =>
            {
                for (int i = 0; i < arraySize; i++)
                {
                    if (cell.present[i] == true &&
                        cell.targetPos + gbl.MapDirectionDelta[directions[i]] == mapPos)
                    {
                        return true;
                    }
                }

                return false;
            });

            Player player_base = (arg_6 != null) ? arg_6.player : gbl.TeamList[0];

            return player_base;
        }
示例#3
0
文件: ovr033.cs 项目: gowantervo/coab
        internal static bool sub_7515A(bool arg_0, Point pos, Player player)
        {
            bool ret_val;

            if (gbl.game_state == GameState.Combat)
            {
                ret_val = false;

                int player_index = GetPlayerIndex(player);

                gbl.CombatMap[player_index].size = (byte)(player.field_DE & 0x7F);
                gbl.CombatMap[player_index].pos = pos;

                int playerIdx;
                int ground_tile;
                getGroundInformation(out ground_tile, out playerIdx, 8, player);

                if (playerIdx != 0 ||
                    ground_tile == 0 ||
                    gbl.BackGroundTiles[ground_tile].move_cost == 0xff)
                {
                    gbl.CombatMap[player_index].size = 0;
                }
                else
                {
                    ret_val = true;

                    if (arg_0 == true &&
                        player.actions.nonTeamMember == false)
                    {
                        var downed = gbl.downedPlayers.FindLast(cell => cell.target == player && cell.originalBackgroundTile != 0x1f);
                        if (downed != null)
                        {
                            ground_tile = downed.originalBackgroundTile;
                        }
                        gbl.downedPlayers.RemoveAll(cell => cell.target == player);

                        bool found = gbl.downedPlayers.Exists(cell => cell.target != null && cell.map == pos);

                        if (found == false)
                        {
                            gbl.mapToBackGroundTile[pos] = ground_tile;
                        }
                    }

                    setup_mapToPlayerIndex_and_playerScreen();
                }
            }
            else
            {
                ret_val = true;
            }

            return ret_val;
        }
示例#4
0
文件: ovr033.cs 项目: gowantervo/coab
        // sub_7416E
        internal static void sub_7416E(Point pos)
        {
            var screenPos = pos - gbl.mapToBackGroundTile.mapScreenTopLeft;

            var map = BuildSizeMap(gbl.mapToBackGroundTile.size, new Point(0, 0));

            foreach (var p in map)
            {
                if (CoordOnScreen(screenPos + p) == true)
                {
                    int i = gbl.mapToBackGroundTile[p + pos];

                    ovr034.DrawIsoTile(gbl.BackGroundTiles[i].tile_index, (screenPos.y + p.y) * 3, (screenPos.x + p.x) * 3);

                    if (gbl.mapToBackGroundTile.drawTargetCursor == true)
                    {
                        // draws grey focus box
                        ovr034.draw_combat_icon(0x19, Icon.Normal, 0, screenPos.y + p.y, screenPos.x + p.x);
                    }
                }
            }

            int player_index = PlayerIndexAtMapXY(pos.y, pos.x);

            DrawPlayerIconIfOnScreen(player_index);
        }
示例#5
0
文件: ovr033.cs 项目: gowantervo/coab
        /// <summary>
        /// check's a given position is visable within the current display screen (via a radius)
        /// </summary>
        /// <param name="radius">if this is 0xff the re-check is forced</param>
        /// <returns></returns>
        internal static bool ScreenMapCheck(int radius, Point pos)
        {
            Point screenCentre = gbl.mapToBackGroundTile.mapScreenTopLeft + Point.ScreenCenter;

            int var_2 = (radius == 0xff) ? 0 : radius;

            int minX = screenCentre.x - var_2;
            int maxX = screenCentre.x + var_2;

            int minY = screenCentre.y - var_2;
            int maxY = screenCentre.y + var_2;

            if (radius == 0xff ||
                pos.x < minX ||
                pos.x > maxX ||
                pos.y < minY ||
                pos.y > maxY)
            {
                if (pos.x < minX)
                {
                    while (pos.x < screenCentre.x && screenCentre.x > (Point.MapMinX + Point.ScreenHalfX))
                    {
                        screenCentre.x -= 1;
                    }
                }
                else if (pos.x > maxX)
                {
                    while (pos.x > screenCentre.x && screenCentre.x < (Point.MapMaxX - Point.ScreenHalfX - 1))
                    {
                        screenCentre.x += 1;
                    }
                }

                if (pos.y < minY)
                {
                    while (pos.y < screenCentre.y && screenCentre.y > (Point.MapMinY + Point.ScreenHalfY))
                    {
                        screenCentre.y -= 1;
                    }
                }
                else if (pos.y > maxY)
                {
                    while (pos.y > screenCentre.y && screenCentre.y < (Point.MapMaxY - Point.ScreenHalfY - 1))
                    {
                        screenCentre.y += 1;
                    }
                }

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

                int screenRowY = 0;
                int mapY = gbl.mapToBackGroundTile.mapScreenTopLeft.y;
                const int IconColumnSize = 3;

                for (int i = 0; i <= 6; i++)
                {
                    int screenColX = 0;
                    int mapX = gbl.mapToBackGroundTile.mapScreenTopLeft.x;

                    for (int j = 0; j <= 6; j++)
                    {
                        ovr034.DrawIsoTile(gbl.BackGroundTiles[gbl.mapToBackGroundTile[mapX, mapY]].tile_index, screenRowY, screenColX);

                        screenColX += IconColumnSize;
                        mapX++;
                    }
                    screenRowY += IconColumnSize;
                    mapY++;
                }
                calculatePlayerScreenPositions();

                return true;
            }

            return false;
        }
示例#6
0
文件: ovr033.cs 项目: gowantervo/coab
        // sub_7431C
        internal static void RedrawPosition(Point pos)
        {
            int playerIndex = PlayerIndexAtMapXY(pos.y, pos.x);

            RedrawPlayerBackground(playerIndex, pos);

            DrawPlayerIconIfOnScreen(playerIndex);
        }
示例#7
0
文件: ovr033.cs 项目: gowantervo/coab
        /* sub_74572 */
        internal static void RedrawPlayerBackground(int player_index, Point map)
        {
            var screen = map - gbl.mapToBackGroundTile.mapScreenTopLeft;

            if (player_index > 0)
            {
                RedrawPlayerBackground(player_index);
            }
            else if (CoordOnScreen(screen) == true)
            {
                var tileIdx = gbl.mapToBackGroundTile[map];
                ovr034.DrawIsoTile(gbl.BackGroundTiles[tileIdx].tile_index, screen.y * 3, screen.x * 3);
            }
        }
示例#8
0
文件: ovr033.cs 项目: gowantervo/coab
 internal static void AtMapXY(out int groundTile, out int playerIndex, Point pos)
 {
     AtMapXY(out groundTile, out playerIndex, pos.y, pos.x);
 }
示例#9
0
文件: ovr033.cs 项目: gowantervo/coab
        /*sub_749DD*/
        internal static void redrawCombatArea(int dir, int radius, Point map)
        {
            var newPos = map + gbl.MapDirectionDelta[dir];

            if (ScreenMapCheck(radius, newPos) == true)
            {
                for (int index = 1; index <= gbl.CombatantCount; index++)
                {
                    Player player = gbl.player_array[index];

                    if (player.in_combat == true &&
                        gbl.CombatMap[index].size > 0 &&
                        PlayerOnScreen(false, player) == true)
                    {
                        var pos = gbl.CombatMap[index].screenPos;
                        ovr034.draw_combat_icon(player.icon_id, 0, player.actions.direction, pos.y, pos.x);
                    }
                }
            }

            RedrawPosition(map);

            if (CoordOnScreen(newPos - gbl.mapToBackGroundTile.mapScreenTopLeft) == false)
            {
                newPos.MapBoundaryTrunc();
            }

            sub_7416E(newPos);
            seg040.DrawOverlay();
        }
示例#10
0
 public static Point Move(Point p, int dx, int dy)
 {
     return new Point(p.X + dx, p.Y + dy);
 }
示例#11
0
文件: ovr033.cs 项目: gowantervo/coab
 /* sub_74730 */
 internal static bool CoordOnScreen(Point pos)
 {
     return (pos.x >= 0 && pos.x <= Point.ScreenMaxX && pos.y >= 0 && pos.y <= Point.ScreenMaxY);
 }
示例#12
0
 private static Point Move(Point p, int dx, int dy)
 {
     return StaticClass.Move(p, dx, dy);
 }
示例#13
0
 public void Move(int dx, int dy)
 {
     this.Point = MovePoint.Move(this.Point, dx, dy);
 }
示例#14
0
文件: ovr010.cs 项目: gowantervo/coab
        // sub_352AF
        internal static bool ShouldCastSpellX_sub1(int spell_id, Point pos)
        {
            bool result = false;
            var spell_entry = gbl.spellCastingTable[spell_id];

            if (spell_entry.damageOnSave != DamageOnSave.Zero)
            {
                int save_bonus = (gbl.SelectedPlayer.combat_team == CombatTeam.Ours) ? -2 : 8;
                var opp = gbl.SelectedPlayer.OppositeTeam();

                var sortedCombatants = ovr032.Rebuild_SortedCombatantList(1, spell_entry.field_F, pos, p => p.combat_team != opp);

                foreach (var sc in sortedCombatants)
                {
                    Player tmpPlayer = sc.player;

                    if (ovr024.RollSavingThrow(save_bonus, spell_entry.saveVerse, sc.player) == false)
                    {
                        result = true;
                    }
                }
            }
            return result;
        }
示例#15
0
文件: ovr014.cs 项目: gowantervo/coab
        /* sub_41B25 */
        internal static bool aim_menu(Struct_1D183 arg_0, bool allowTarget, bool canTargetEmptyGround, bool showRange, int maxRange, Player attacker)
        {
            Player target; /* var_E5 */

            ovr025.load_missile_dax(false, 0, 0, 0x19);

            arg_0.Clear();

            bool arg_4 = false;

            if (maxRange == -1 || maxRange == 0xff)
            {
                if (attacker.activeItems.primaryWeapon != null)
                {
                    maxRange = gbl.ItemDataTable[attacker.activeItems.primaryWeapon.type].range - 1;
                }
                else
                {
                    maxRange = 1;
                }
            }

            if (maxRange == 0 ||
                maxRange == -1 || maxRange == 0xff)
            {
                maxRange = 1;
            }

            SortedCombatant[] sorted_list = copy_sorted_players(attacker);

            int list_index = 1;
            int next_prev_step = 0;
            int target_step = 0;

            Point attackerPos = new Point();

            target = step_combat_list(true, next_prev_step, ref list_index, ref attackerPos, sorted_list);

            next_prev_step = 1;
            char input = ' ';

            while (arg_4 == false && unk_41AE5.MemberOf(input) == false)
            {
                if (CanSeeTargetA(target, attacker) == false)
                {
                    target = step_combat_list(false, next_prev_step, ref list_index, ref attackerPos, sorted_list);
                }
                else
                {
                    input = aim_sub_menu(allowTarget, showRange, maxRange, target, attacker);

                    if (gbl.displayInput_specialKeyPressed == false)
                    {
                        switch (input)
                        {
                            case 'N':
                                next_prev_step = 1;
                                target_step = 1;
                                break;

                            case 'P':
                                next_prev_step = -1;
                                target_step = -1;
                                break;

                            case 'M':
                            case 'H':
                            case 'K':
                            case 'G':
                            case 'O':
                            case 'Q':
                            case 'I':
                                arg_4 = Target(arg_0, allowTarget, canTargetEmptyGround, showRange, maxRange, target, attacker);
                                ovr025.load_missile_dax(false, 0, 0, 0x19);

                                sorted_list = copy_sorted_players(attacker);
                                target_step = 0;
                                break;

                            case 'T':
                                arg_4 = sub_411D8(arg_0, showRange, target, attacker);
                                ovr025.load_missile_dax(false, 0, 0, 0x19);

                                sorted_list = copy_sorted_players(attacker);
                                target_step = 0;
                                break;

                            case 'C':
                                ovr033.redrawCombatArea(8, 0, ovr033.PlayerMapPos(target));
                                target_step = 0;
                                break;
                        }
                    }
                    else if (unk_41B05.MemberOf(input) == true)
                    {
                        arg_4 = Target(arg_0, allowTarget, canTargetEmptyGround, showRange, maxRange, target, attacker);
                        ovr025.load_missile_dax(false, 0, 0, 0x19);
                        sorted_list = copy_sorted_players(attacker);
                        target_step = 0;
                    }

                    ovr033.RedrawPosition(ovr033.PlayerMapPos(target));

                    target = step_combat_list((arg_4 == false && unk_41AE5.MemberOf(input) == false), target_step,
                       ref list_index, ref attackerPos, sorted_list);
                }
            }

            if (showRange)
            {
                seg037.draw8x8_clear_area(0x17, 0x27, 0x17, 0);
            }

            return arg_4;
        }
示例#16
0
文件: ovr014.cs 项目: gowantervo/coab
        /* sub_41932 */
        internal static Player step_combat_list(bool arg_2, int step, ref int list_index, ref Point attackerPos, SortedCombatant[] sorted_list)
        {
            if (arg_2 == true)
            {
                attackerPos = sorted_list[list_index - 1].pos;
            }
            else
            {
                ovr033.RedrawPosition(attackerPos);
            }

            list_index += step;

            if (list_index == 0)
            {
                list_index = sorted_list.GetLength(0);
            }

            if (list_index > sorted_list.GetLength(0))
            {
                list_index = 1;
            }

            Player newTarget = sorted_list[list_index - 1].player;

            var targetPos = sorted_list[list_index - 1].pos;

            if (arg_2 == true)
            {
                ovr025.draw_missile_attack(0, 1, targetPos, attackerPos);
                attackerPos = targetPos;
            }

            return newTarget;
        }