public override Rectangle scissor_rect()
        {
            Rectangle rect = base.scissor_rect();

            rect.Y      += (int)Text_Offset.Y;
            rect.Height -= (int)Text_Offset.Y;
            return(Scene_Map.fix_rect_to_screen(rect));
        }
 internal void set_map_sprite_texture(int team, string name)
 {
     MapSprite.texture = Scene_Map.get_team_map_sprite(team, name);
     if (MapSprite.texture != null)
     {
         MapSprite.offset = new Vector2(
             (MapSprite.texture.Width / MapSprite.frame_count) / 2,
             (MapSprite.texture.Height / MapSprite.facing_count) - 8);
     }
 }
示例#3
0
        private void set_images()
        {
            if (Team_Windows.Count == 0)
            {
                Cursor.loc    = TEAM_WINDOW_LOC;
                Cursor.height = 8;
            }
            else
            {
                Cursor.loc    = Team_Windows[Index].loc;
                Cursor.height = (Groups[Index].Value + 1) * 16 + 8;
            }
            int leader_id = -1;

            if (Groups.Count > 0)
            {
                leader_id = Global.game_map.team_leaders[Groups[Index].Key];
            }
            if (leader_id == -1 || Global.game_map.unit_defeated(leader_id) ||
                Global.game_map.unit_escaped(leader_id))
            {
                Leader_Name.text   = "";
                Lvl.text           = "--";
                Hp.text            = "--";
                Hp_Max.text        = "--";
                Rating.text        = "--";
                Map_Sprite.texture = null;
                Face.set_actor("");
                LeaderWeapon.set_image(null, null);
            }
            else
            {
                Game_Unit unit = Global.game_map.units[leader_id];
                Leader_Name.text     = unit.actor.name;
                Leader_Name.offset.X = Leader_Name.text_width / 2;
                Lvl.text             = unit.actor.level.ToString();
                Hp.text            = unit.actor.hp.ToString();
                Hp_Max.text        = unit.actor.maxhp.ToString();
                Rating.text        = unit.rating().ToString();
                Map_Sprite.texture = Scene_Map.get_team_map_sprite(unit.team, unit.map_sprite_name);
                if (Map_Sprite.texture != null)
                {
                    Map_Sprite.offset = new Vector2(
                        (Map_Sprite.texture.Width / Map_Sprite.frame_count) / 2,
                        (Map_Sprite.texture.Height / Map_Sprite.facing_count) - 8);
                }
                Map_Sprite.mirrored = unit.has_flipped_map_sprite;
                Face.set_actor(unit.actor);
                Face.mirrored = false;
                LeaderWeapon.set_image(unit.actor, unit.actor.weapon);
            }
        }
示例#4
0
        public void set_map_sprite(string filename, int team)
        {
            MapSprite.texture = Scene_Map.get_team_map_sprite(
                team, filename);
            MapSprite.mirrored = Constants.Team.flipped_map_sprite(team);

            if (MapSprite.texture != null)
            {
                MapSprite.offset = new Vector2(
                    (MapSprite.texture.Width / MapSprite.frame_count) / 2,
                    (MapSprite.texture.Height / MapSprite.facing_count) - 8);
            }
            MapSprite.frame = Global.game_system.unit_anim_idle_frame;
        }
        public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
        {
            if (texture != null)
            {
                if (visible)
                {
                    // Background/Sigil
                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    Rectangle src_rect = this.src_rect;
                    Vector2   offset   = this.offset;
                    if (mirrored)
                    {
                        offset.X = src_rect.Width - offset.X;
                    }
                    for (int y = 0; y < Loop; y++)
                    {
                        for (int x = 0; x < Loop; x++)
                        {
                            sprite_batch.Draw(texture, loc + draw_vector() + new Vector2(x * Bmp_Width, y * Bmp_Width),
                                              src_rect, tint, angle, offset, scale,
                                              mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z);
                        }
                    }
                    Sigil.draw(sprite_batch);
                    Banner_Bg.draw(sprite_batch);
                    sprite_batch.End();

                    // Banner
                    Effect text_shader = Global.effect_shader();
                    if (text_shader != null)
                    {
                        text_shader.CurrentTechnique = text_shader.Techniques["Technique2"];
                        text_shader.Parameters["color_shift"].SetValue(Banner_Color.ToVector4());
                    }
                    sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Text_Scissor_Rect);
                    if (sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0 && sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0)
                    {
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, Text_State, text_shader);
                        Banner.draw(sprite_batch);
                        sprite_batch.End();
                    }
                    // Text
                    if (text_shader != null)
                    {
                        text_shader.CurrentTechnique = text_shader.Techniques["Technique2"];
                        text_shader.Parameters["color_shift"].SetValue(Text_Color.ToVector4());
                    }
                    sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Text_Scissor_Rect);
                    if (sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0 && sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0)
                    {
                        sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, Text_State, text_shader);
                        Text.draw(sprite_batch);
                        sprite_batch.End();
                    }

                    // Alternate Title
                    if (AlternateTitle != null)
                    {
                        AlternateTitle.Draw(sprite_batch);
                    }

                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    // Black screen
                    Black_Fill.draw(sprite_batch);
                    sprite_batch.End();
                }
            }
        }
示例#6
0
        private bool is_scene_battle(int id1, int id2, bool fighting, Combat_Data data)
        {
            if (Skip_Battle)
            {
                return(false);
            }
            if (Global.game_temp.scripted_battle)
            {
                return(Global.game_temp.scripted_battle_stats.scene_battle);
            }
            if (Scene_Map.intro_chapter_options_blocked())
            {
                return(true);
            }

            // If map animation forced, for various reasons
            else if ((In_Staff_Use && ((Staff_Data)data).mode == Staff_Modes.Torch) ||
                     Units[id1].trample_activated) // make this not hardcoded //Debug
            {
                return(false);
            }
            // If either battler is a boss, or it's a scripted battle with animations forced, always go to the full battle scene
            else if (fighting && (Global.game_temp.scripted_battle || is_boss_anim_forced(id1, id2)))
            {
                return(true);
            }

            bool scene_battle = true;

            switch ((Constants.Animation_Modes)Global.game_options.animation_mode)
            {
            // If solo animation mode, get the animation mode the fighting units should use
            case Constants.Animation_Modes.Solo:
                scene_battle = false;
                // Healing staff use or Dancing
                if ((In_Staff_Use || Global.game_state.dance_active) && id2 != -1 &&
                    !Units[id1].is_attackable_team(Units[id2]))
                {
                    foreach (int id in new int[] { id1 })
                    {
                        if (id != -1 && !scene_battle)
                        {
                            if (Units.ContainsKey(id) && Units[id].is_ally &&
                                !Global.game_actors.is_temp_actor(Units[id].actor))
                            {
                                if (Units[id].actor.individual_animation != (int)Constants.Animation_Modes.Map)
                                {
                                    scene_battle = (Constants.Animation_Modes)Units[id].actor.individual_animation ==
                                                   Constants.Animation_Modes.Full;
                                }
                            }
                        }
                    }
                }
                // Anything else
                else
                {
                    foreach (int id in new int[] { id1, id2 })
                    {
                        if (id != -1 && !scene_battle)
                        {
                            if (Units.ContainsKey(id) && Units[id].is_ally &&
                                !Global.game_actors.is_temp_actor(Units[id].actor))
                            {
                                if (Units[id].actor.individual_animation != (int)Constants.Animation_Modes.Map)
                                {
                                    scene_battle = (Constants.Animation_Modes)Units[id].actor.individual_animation ==
                                                   Constants.Animation_Modes.Full;
                                }
                            }
                        }
                    }
                }
                break;

            case Constants.Animation_Modes.Full:
                scene_battle = true;
                break;

            case Constants.Animation_Modes.Map:
                scene_battle = false;
                break;

            case Constants.Animation_Modes.Player_Only:
                scene_battle = Constants.Team.PLAYABLE_TEAMS.Contains(Team_Turn);
                break;
            }
            // Switch animation mode if holding L
            // Also switch modes if pressing on the screen? //Debug
            if (Global.Input.pressed(Inputs.L) || Global.Input.touch_pressed(false))
            {
                scene_battle = !scene_battle;
            }
            return(scene_battle);
        }