# *****************************************************************************
# *    Tiny Overworld Sprites ACE v1.1
# *      by ldida1
# *    *Based on Tiny Over World Sprites VX by ccoa*
# *****************************************************************************

# Miniturizes Sprites of both the player and the players followers when on the
# world map

# Size of the World Map Player & Follower Sprites:
ZOOM = 0.3 
# Size of the mini World Map Event Sprites:
EVENTZOOM = 0.5
# If an event on the world map has this in its name, it will be mini:
EVENTNAME = '\mini'
# If a map contains this in its name, it will be treated as a world map:
WORLD_IND = '*WORLD*'

class Game_Map
  attr_reader :name
  attr_reader :isworldmap
  
  alias tinysprites_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  def setup(map_id)
    tinysprites_setup(map_id)
    @name = load_data("Data/MapInfos.rvdata2")[@map_id].name
    if @name.include?(WORLD_IND)
      @isworldmap = true
      @name.sub!(WORLD_IND, '')
    else
      @isworldmap = false
    end
  end
end

  #--------------------------------------------------------------------------
class Game_Event < Game_Character
  def getName
    return @event.name
  end
end

class Sprite_Character < Sprite_Base 
  alias tinysprites_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    tinysprites_update
    # Default ZOOM:
    self.zoom_x = 1.0
    self.zoom_y = 1.0
    # Change zoom if the sprite is player or follower
    if $game_map.isworldmap 
      if @character.is_a?(Game_Player) or @character.is_a?(Game_Follower)
        self.zoom_x = ZOOM
        self.zoom_y = ZOOM
      end
    end
    # Change zoom if sprite is event with 'EVENTNAME' in name
    if @character.is_a?(Game_Event)and @character.getName.include?(EVENTNAME)
      self.zoom_x = ZOOM
      self.zoom_y = ZOOM
    end
  end # End Update
end # End Class Sprite Charactor