ScreenTest
от ForeverZer0


v.2.1
(13 февраля 2011г.)


Описание: позволяет проверять различные экранные эффекты прямо во время теста игры. По картинкам сразу поймёте о чём речь.

Скриншоты:
Спойлер некоторые экраны настроек:










Текст скрипта:
Спойлер 21Кб:

Код:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Zer0 ScreenTest
# Автор: ForeverZer0
# Перевод: mephis
# Версия: 2.1
# Дата: 13.02.2011
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# История изменений — убрана за ненадобностью
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Совместимость:
#   - Никаких известных проблем с совместимостью.
#
# Пояснение:
#   По сути, это просто меню отладки экранных эффектов. Позволяет игроку
#   менять/проверять в реальном времени множество разных экранных эффектов,
#   с тем, чтобы подобрать наиболее подходящие настройки.
#
# Возможности:
#   - Во время теста игры можно влиять на следующие параметры:
#     - Изменять оттенок экрана (R, G, B, Gr)
#     - Менять погоду (Тип, Сила, Длительность, Изменчивость)
#     - Проверять тряску экрана (Сила, Скорость, Длительность)
#     - Менять туман (Тип, Прозрачность, Тип смешивания, Масштаб,
#                     Оттенок, Прокрутка)
#     - Менять панораму (Имя, Оттенок)
#     - Проверять анимации (Имя, X, Y)
#     - Проверять картинки (Имя, X, Y, Прозрачность, Масштаб,
#                           Тип смешивания, Поворот)
#
# Инструкция:
#  - Поместите скрипт выше Main и ниже других стандартных скриптов.
#  - Во время теста меню вызывается на клавишу F8 (по умолчанию). 
#
# Примечание:
#  - Помните, что сделанные изменения сохранятся, так что этот инструмент
#    упрощает подбор подходящих экранных эффектов.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

#===============================================================================
# ** Scene_ScreenTest
#===============================================================================

class Scene_ScreenTest
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#                         НАЧАЛО НАСТРОЕК
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

  WEATHER_TYPES = 32
  # Количество типов погоды в вашей игре. Если вы используете скрипт
  # Zer0 Advanced Weather версии 2.0 или выше, то вам тут ничего менять не надо.
  
  WINDOW = ['Georgia', 20, 160] # [ИМЯ ШРИФТА, РАЗМЕР ШРИФТА, НЕПРОЗРАЧНОСТЬ]
  # Настройки окна. Просто его внешний вид. Игроки его не увидят.
  
  CALL_BUTTON = Input::F8
  # Клавиша вызова из Scene_Map.
  
  HIDE_BUTTON = Input::SHIFT
  # Клавиша для скрытия окон. Они не будут отображаться при удерживании
  # этой клавиши.
  
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#                         КОНЕЦ НАСТРОЕК
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

  def main
    # Make map sprite.
    @map = Spriteset_Map.new
    # Set current screen tone. 
    @tone = [$game_screen.tone.red, $game_screen.tone.green, 
      $game_screen.tone.blue, $game_screen.tone.gray]
    # Set current weather type, power, and duration.
    @weather = [$game_screen.weather_type, $game_screen.weather_max, 0]
    # Set name, hue, opacity, zoom, blend type, sx, and sy of current fog.
    @fog = [$game_map.fog_name, $game_map.fog_hue, $game_map.fog_opacity, 
      $game_map.fog_zoom, $game_map.fog_blend_type, $game_map.fog_sx, $game_map.fog_sy]
    # Set name and hue of current panorama.
    @panorama = [$game_map.panorama_name, $game_map.panorama_hue]
    # Set shake.
    @shake = [0, 0, 0]
    # Set animation.
    @animation = ['Нет', 0, 0]
    # Set picture.
    @picture = ['Нет', 0, 0, 255, 1.0, 0, 0]
    # Find all filenames of panoramas, fogs, and pictures in the game.
    find_graphics
    # Create the main window.
    commands = %w{ Оттенок Погода Туман Панорама Тряска Анимация Картинка }
    @main_window = Window_Command.new(128, commands)
    # Set strings for the menu options.
    @commands = [
      ['Красный', 'Зелёный', 'Синий', 'Серый'],
      ['Тип', 'Сила', 'Длительность'],
      ['Имя', 'Оттенок', 'Непрозрачность', 'Масштаб', 'Тип смешивания', 'Прокрутка по X', 'Прокрутка по Y'],
      ['Имя', 'Оттенок'],
      ['Сила', 'Скорость', 'Длительность'],
      ['Имя', 'X на карте', 'Y на карте', 'Проиграть анимацию'],
      ['Имя', 'X', 'Y', 'Непрозрачность', 'Масштаб', 'Тип смешивания', 'Поворот']
    ]
    # Check for variable used in Zer0 Advanced Weather and MAWS.
    if defined?($game_screen.weather_variation)
      @weather.push($game_screen.weather_variation)
      @commands[1].push('Variation')
    end
    # Create window array. Holds all created windows for easy handling.
    @windows = [@main_window]
    # Set font name, font size, and opacity of main window.
    set_window_info(@main_window)
    # Transition graphics and begin main loop.
    Graphics.transition
    loop { Graphics.update; Input.update; update; break if $scene != self }
    # Dispose of the sprites.
    (@windows + [@map]).each {|sprite| sprite.dispose }
  end
#-------------------------------------------------------------------------------
  def update
    
    if Input.trigger?(Input::Z)
      p 'Fogs', "", @fogs, '', 
      'Panoramas', "", @panoramas, '', 
      'Pictures', "Index: #{@pic_index}", @pictures
    end
    # Update window and map sprites.
    (@windows + [@map, $game_screen, $game_map]).each {|object| object.update }
    # Check for input. 
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      if @main_window.active
        # Return to map if main window is active.
        $scene = Scene_Map.new
      else
        # Else find active window, deactivate it, and return to main window.
        active_window = @windows.find {|window| window.active }
        active_window.active = active_window.visible = false
        @main_window.active = true
      end
      return
    elsif Input.trigger?(Input::LEFT) || Input.repeat?(Input::LEFT) 
      $game_system.se_play($data_system.cursor_se)
      @value = Input.trigger?(Input::LEFT) ? -1 : -5
    elsif Input.trigger?(Input::RIGHT) || Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @value = Input.trigger?(Input::RIGHT) ? 1 : 5
    elsif Input.press?(HIDE_BUTTON)
      memory = @windows.collect {|window| window.visible }
      @windows.each {|window| window.visible = false }
      while Input.press?(HIDE_BUTTON)
        Graphics.update; Input.update; update
      end
      @windows.each_index {|i| @windows[i].visible = memory[i] }
    end
    # Branch update method by what window is active.
    if @main_window.active
      update_main
    elsif @tone_window != nil && @tone_window.active
      update_tone
    elsif @weather_window != nil && @weather_window.active
      update_weather
    elsif @fog_window != nil && @fog_window.active
      update_fog
    elsif @panorama_window != nil && @panorama_window.active
      update_panorama
    elsif @shake_window != nil && @shake_window.active
      update_shake
    elsif @animation_window != nil && @animation_window.active
      update_animation
    elsif @picture_window != nil && @picture_window.active
      update_picture
    end
    # Reset @value variable at end of every update
    @value = nil
  end
#-------------------------------------------------------------------------------
  def update_main
    if Input.trigger?(Input::C)
      # Play SE and deactivate main window.
      $game_system.se_play($data_system.decision_se)
      @main_window.active = false      
      # Branch by main window index, creating new windows when needed.
      case @main_window.index
      when 0 # Tone
        if @tone_window == nil
          @tone_window = Window_Command.new(160, @commands[0])
          set_window_info(@tone_window)
          @windows.push(@tone_window)
        end
        @tone_window.active = @tone_window.visible = true
      when 1 # Weather
        if @weather_window == nil
          @weather_window = Window_Command.new(190, @commands[1])
          set_window_info(@weather_window)
          @windows.push(@weather_window)
          @weather_index = @weather[0]
          # Create an array of possible weather types.
          if $zer0_adv_weather != nil && $zer0_adv_weather >= 2.0
            @weather_types = $weather_cache.bitmaps.keys.sort
          else
            @weather_types = []
            (0..WEATHER_TYPES).each {|i| @weather_types.push(i) }
          end
        end
        @weather_window.active = @weather_window.visible = true
      when 2 # Fog
        if @fog_window == nil
          @fog[0] = 'Нет' if @fog[0] == ''
          @fog_index = @fogs.index(@fog[0])
          @fog_window = Window_Command.new(256, @commands[2])
          set_window_info(@fog_window)
          @windows.push(@fog_window)
        end
        @fog_window.active = @fog_window.visible = true
      when 3 # Panorama
        if @panorama_window == nil 
          @panorama[0] = 'Нет' if @fog[0] == ''
          @panorama_index = @panoramas.index(@panorama[0])
          @panorama_window = Window_Command.new(256, @commands[3])
          set_window_info(@panorama_window)
          @windows.push(@panorama_window)
        end
        @panorama_window.active = @panorama_window.visible = true
      when 4 # Shake
        if @shake_window == nil
          @shake_window = Window_Command.new(190, @commands[4])
          set_window_info(@shake_window)
          @windows.push(@shake_window)
        end
        @shake_window.active = @shake_window.visible = true
      when 5 # Animation
        if @animation_window == nil
          @animation_index = 0
          @animation_window = Window_Command.new(256, @commands[5])
          set_window_info(@animation_window)
          @windows.push(@animation_window)
        end
        @animation_window.active = @animation_window.visible = true
      when 6 # Picture
        if @picture_window == nil
          @pic_index = 0
          @picture_window = Window_Command.new(256, @commands[6])
          set_window_info(@picture_window)
          @windows.push(@picture_window)
        end
        @picture_window.active = @picture_window.visible = true
      end
      # Set value to nil and refresh the activated window
      @value = nil
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def refresh_window
    # Refresh active window.
    case @main_window.index
    when 0 # Tone
      @tone_window.contents.clear
      @tone.each_index {|i|
        @tone_window.contents.draw_text(4, i*32, 128, 32, @commands[0][i])
        @tone_window.contents.draw_text(-4, i*32, 128, 32, @tone[i].to_i.to_s, 2) \
      }
    when 1 # Weather
      @weather_window.contents.clear
      @weather.each_index {|i| 
        @weather_window.contents.draw_text(4, i*32, 128, 32, @commands[1][i])
        @weather_window.contents.draw_text(-4, i*32, 158, 32, @weather[i].to_i.to_s, 2)
      }
    when 2 # Fog
      @fog_window.contents.clear
      @fog.each_index {|i|
        @fog_window.contents.draw_text(4, i*32, 224, 32, @commands[2][i])
        @fog_window.contents.draw_text(-4, i*32, 224, 32, @fog[i].to_s, 2)
      }
    when 3 # Panorama
      @panorama_window.contents.clear
      @panorama.each_index {|i|
        @panorama_window.contents.draw_text(4, i*32, 224, 32, @commands[3][i])
        @panorama_window.contents.draw_text(-4, i*32, 224, 32, @panorama[i].to_s, 2)
      }
    when 4 # Shake
      @shake_window.contents.clear
      @shake.each_index {|i|
        @shake_window.contents.draw_text(4, i*32, 128, 32, @commands[4][i])
        @shake_window.contents.draw_text(-4, i*32, 158, 32, @shake[i].to_s, 2)
      }
    when 5 # Animation
      @animation_window.contents.clear
      @commands[5].each_index {|i|
        @animation_window.contents.draw_text(4, i*32, 224, 32, @commands[5][i])
        @animation_window.contents.draw_text(-4, i*32, 224, 32, @animation[i].to_s, 2)
      }
    when 6 # Picture
      @picture_window.contents.clear
      @picture.each_index {|i|
        @picture_window.contents.draw_text(4, i*32, 224, 32, @commands[6][i])
        @picture_window.contents.draw_text(-4, i*32, 224, 32, @picture[i].to_s, 2)
      }
    end
  end
#-------------------------------------------------------------------------------
  def update_tone
    if @value != nil
      index = @tone_window.index
      @tone[index] += @value
      if index == 3
        @tone[index] %= 256
      else
        @tone[index] = 255 if @tone[index] < -255
        @tone[index] = -255 if @tone[index] > 255
      end
      tone = Tone.new(@tone[0], @tone[1], @tone[2], @tone[3])
      @tone[3] = 0 if @tone[3] < 0
      $game_screen.start_tone_change(tone, 0)
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_weather
    if @value != nil
      index = @weather_window.index
      case index
      when 0
        @weather_index = (@weather_index + @value) % @weather_types.size
        @weather[0] = @weather_types[@weather_index]
      when 1
        @weather[1] = (@weather[1] + @value) % 51
      when 2, 3
        @weather[index] = (@weather[index] + @value) % 1000
      end
      # Apply weather effect to screen.
      if @weather.size == 4
        $game_screen.weather(@weather[0], @weather[1], @weather[2], @weather[3])
      else
        $game_screen.weather(@weather[0], @weather[1], @weather[2])
      end
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_fog
    if @value != nil
      index = @fog_window.index
      if index == 0
        @fog_index = (@fog_index + @value) % @fogs.size
        @fog[0] = @fogs[@fog_index]
      else
        @fog[index] += @value
      end
      @fog[1] %= 360
      @fog [2] %= 256
      @fog[3] = [[@fog[3], 100].max, 800].min
      @fog[4] %= 3
      $game_map.fog_name = @fog[0] == 'Нет' ? '' : @fog[0]
      $game_map.fog_opacity, $game_map.fog_zoom = @fog[2], @fog[3]
      $game_map.fog_blend_type, $game_map.fog_hue = @fog[4], @fog[1]
      $game_map.fog_sx, $game_map.fog_sy = @fog[5], @fog[6]
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_panorama
    if @value != nil
      if @panorama_window.index == 0
        @panorama_index = (@value + @panorama_index) % @panoramas.size
        @panorama[0] = @panoramas[@panorama_index]
      else
        @panorama[1] += @value
      end
      @panorama[1] %= 360
      $game_map.panorama_name = @panorama[0] == 'Нет' ? '' : @panorama[0]
      $game_map.panorama_hue = @panorama[1]
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_shake
    if @value != nil
      $game_system.se_play($data_system.cursor_se)
      index = @shake_window.index
      @shake[index] += @value
      [0, 1].each {|i| @shake[i] %= 30 }
      @shake[2] %= 1000
      $game_screen.start_shake(@shake[0], @shake[1], @shake[2])
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_animation
    if Input.trigger?(Input::C) && @animation_window.index == 3
      animation = $data_animations[@animation_index]
      return if animation == nil
      @map.make_animation(@animation_index, @animation[1], @animation[2])
    end
    if @value != nil
      case @animation_window.index
      when 0
        @animation_index = (@animation_index + @value) % $data_animations.size
        if $data_animations[@animation_index] == nil
          @animation[0] = 'Нет'
        else
          name = $data_animations[@animation_index].name
          @animation[0] = name == '' ? "(#{@animation_index})" : name
        end
      when 1
        @animation[1] = (@animation[1] + @value) % $game_map.width
      when 2
        @animation[2] = (@animation[2] + @value) % $game_map.height
      end
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def update_picture
    if @value != nil
      index = @picture_window.index
      if index == 0
        @pic_index = (@pic_index + @value) % @pictures.size
      elsif index == 4
        @picture[4] += (@value / 10.0)
      else
        @picture[index] += @value
      end
      @picture[0] = @pic_index == 0 ? 'Нет' : @pictures[@pic_index]
      @picture[3] %= 256
      @picture[4] = [[@picture[4], 1.0].max, 10.0].min 
      @picture[5] %= 3
      @picture[6] %= 360 
      # Draw sprite.
      @map.make_picture(@picture)
      refresh_window
    end
  end
#-------------------------------------------------------------------------------
  def set_window_info(window)
    # Set the configured look to all the windows as they are made.
    window.contents.font.name = WINDOW[0]
    window.contents.font.size = WINDOW[1]
    window.back_opacity = WINDOW[2]
    window.x = window == @main_window ? 0 : 128
    window.refresh
  end
#-------------------------------------------------------------------------------
  def find_graphics
    # Search "Fogs", "Panoramas", and "Pictures" folder for files.
    @fogs = Dir.entries('Graphics/Fogs')
    @panoramas = Dir.entries('Graphics/Panoramas')
    @pictures = Dir.entries('Graphics/Pictures')
    # Add all files from RTP into their respective arrays.
    rtp_paths.each {|path|
      @fogs += Dir.entries(path + '\Graphics\Fogs')
      @panoramas += Dir.entries(path + '\Graphics\Panoramas')
    }
    # Iterate through combined folders, and omit all non-image files.
    [@fogs, @panoramas, @pictures].each {|folder|
      folder.collect! {|file| 
       if ['.png', '.jpg'].include?(File.extname(file)) 
         # Remove file extension.
         file.gsub!(/.png|.jpg/) {''} 
       end
      }
      # Remove nil elements and add 'None' string to each array.
      folder.unshift('Нет').compact!
    }
  end
#-------------------------------------------------------------------------------
  def rtp_paths    
    paths = []
    [1, 2, 3].each {|id| 
      paths.push(RGSSGetPathWithRTP.call(RGSSGetRTPPath.call(id))) }
    return paths.find_all {|path| path != '' }
  end
#-------------------------------------------------------------------------------
end

  # DO NOT edit any of these lines. They are used to gather the RTP data.

  # Get the dll used for the game.
  GPPSA = Win32API.new('kernel32', 'GetPrivateProfileStringA', 'PPPPLP', 'L')
  dll = "\0" * 255
  GPPSA.call('Game', 'Library', '', dll, 255, '.\\Game.ini')
  dll.delete!("\0")
  # Set constants to call path with.
  RGSSGetRTPPath = Win32API.new(dll, 'RGSSGetRTPPath', 'L', 'L')
  RGSSGetPathWithRTP = Win32API.new(dll, 'RGSSGetPathWithRTP', 'L', 'P')
  
#===============================================================================
# ** Scene_Map
#===============================================================================

class Scene_Map
  
  # Add call button to Scene_Map
  alias zer0_screentest_map_upd update
  def update
    zer0_screentest_map_upd
    if $DEBUG && Input.trigger?(Scene_ScreenTest::CALL_BUTTON)
      $scene = Scene_ScreenTest.new
    end
  end
end

#===============================================================================
# ** Spriteset_Map
#===============================================================================

class Spriteset_Map
  
  # Creates an event on the fly, plays the animation, then disposes it.
  def make_animation(animation_id, x, y)
    event = Game_Event.new($game_map.map_id, RPG::Event.new(x, y))
    event.animation_id = animation_id
    sprite = Sprite_Character.new(@viewport1, event)
    # Loop Graphics and sprite update as long as animation is occurring.
    while sprite.effect?
      sprite.update
      Graphics.update
    end
    sprite.dispose
  end
  
  def make_picture(data)
    # Create sprite if it does not exist.
    if @pic == nil 
      @pic = Sprite.new(@viewport2)
      # Add to picture array, so it automatically updates and disposes.
      @picture_sprites.push(@pic)
    end
    # Clear bitmap and end method if no bitmap is defined.
    if data[0] == 'Нет' 
      @pic.bitmap.clear if @pic.bitmap != nil
      return
    end
    # Set the configured data to the picture.
    @pic.bitmap = RPG::Cache.picture(data[0]).clone
    @pic.x, @pic.y, @pic.opacity, @pic.angle = data[1], data[2], data[3], data[6]
    @pic.zoom_x, @pic.zoom_y, @pic.blend_type = data[4], data[4], data[5]
  end
end



Скачать демонстрацию:
ScreenTest v.2.1.rar

Ссылка на оригинал:
HBGames.org