Jump to content
Cecillia

Mode7

Recommended Posts

I would like to have Mode7 work for not only being on an airship but just like overworld

9377f5c14b2a495620f7e4292dd5c4989707e6199de04ff7657a37b9c3b818086g.jpg

If you don't understand me, here is a picture.

Here is the script. It is in french though

 

 

#====================================================================

# Mode 7 Ace

# v.1.0

# Auteur : MGC

#

# Il s'agit d'un script de mode 7 basique pour RMVX Ace.

#

# - Permet une inclinaison de la carte de 0° à 89°

# - Toute la carte est inclinée, sans relief. Seuls les évènements

# paraissent dressés verticalement.

# - L'effet de colorisation à l'horizon est personnalisable.

# - Les tiles animés sont supportés, ainsi que le bouclage de la carte.

# - possibilité de zoomer (de 1:8 à 8:1) quand le mode 7 est activé.

#

# IMPORTANT : SI VOUS RENCONTREZ DU LAG, VEUILLEZ VOUS ASSURER D'AVOIR

# DECOCHER "REDUCE SCREEN FLICKERING" (F1).

#

# Nécessite :

# - le fichier MGC_Mode7_Ace.dll à la racine du projet

# - les 3 fichiers graphiques suivants, déposés dans Pictures/ :

# - autotiles_data.png

# - autotiles_data_small.png

# - autotiles_data_xsmall.png

#

# Configuration :

# - MODE7_MAPS_ID : Contient la liste des id des cartes pour lesquelles

# le mode 7 est appliqué dès l'entrée sur ces cartes

# - MODE7_DEFAULT_ZOOM : valeur de zoom par défaut qui s'applique dès le

# passage en mode 7. Compris entre 0.125 et 8.0.

# - MODE7_DEFAULT_ANGLE : valeur d'angle d'inclinaison par défaut qui

# s'applique dès le passage en mode 7. Compris entre 0 et 89.

# - MODE7_VIEW_LIMIT : nombre de tiles supplémentaires à afficher (en plus

# des 13 pour la vue normale de la carte en 544 * 416) avant l'horizon.

# - MODE7_FADING_DISTANCE : nombre de tiles avant l'horizon subissant un

# dégradé de ton et/ou d'opacité.

# - MODE7_FADING_TONE : composantes de couleur R, G, B vers lesquelles tend

# le dégradé de ton à l'horizon. Chaque composantes peut varier

# entre -255 et 255.

# - MODE7_FADING_OPACITY : opacité vers laquelle tend le dégradé d'opacité ton

# à l'horizon. Compris entre 255 (pas de dégradé d'opacité) et 0.

# - MODE7_SCAN_STEP : méthode de rafraîchissement de l'écran :

# - 1 : l'écran est entièrement redessiné en 1 frame. Déconseillé

# car extrêmement gourmand en ressources.

# - 2 : l'écran est redessiné en 2 frames (une ligne de l'écran sur

# deux est dessinée pour chaque frame).

# - 3 : l'écran est redessiné en 3 frames (une ligne de l'écran sur

# trois est dessinée pour chaque frame). Conseillé s'il y a

# trop de lag.

#

# Utilisation :

# Commandes utilisables comme commandes d'évènement avec Script... :

# - MGC.start_mode7 : lance le mode 7 pour la carte

# - MGC.to_mode7_angle(nouvel angle, durée de transition)

# - MGC.to_mode7_zoom(nouvelle valeur de zoom, durée de transition)

# - MGC.end_mode7 : quitte le mode 7

#====================================================================

module MGC

#--------------------------------------------------------------------------

# * CONFIGURATION

#--------------------------------------------------------------------------

MODE7_MAPS_ID = []

MODE7_DEFAULT_ZOOM = 1.0

MODE7_DEFAULT_ANGLE = 0

MODE7_VIEW_LIMIT = 26

MODE7_FADING_DISTANCE = 13

MODE7_FADING_TONE = Tone.new(64, 64, 128)

MODE7_FADING_OPACITY = 0

MODE7_SCAN_STEP = 2

#--------------------------------------------------------------------------

# * Initialisation

#--------------------------------------------------------------------------

@mode7_zoom = 1.0

@mode7_active = false

#--------------------------------------------------------------------------

# * Lancement du mode 7

#--------------------------------------------------------------------------

def self.start_mode7

@end_mode7 = false

@spriteset.start_mode7

end

#--------------------------------------------------------------------------

# * Fin du mode 7

#--------------------------------------------------------------------------

def self.end_mode7

@end_mode7 = true

self.to_mode7_zoom(1.0, 1)

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut spriteset

#--------------------------------------------------------------------------

def self.spriteset=(spriteset)

@spriteset = spriteset

end

#--------------------------------------------------------------------------

# * Initialisation des données du mode 7

#--------------------------------------------------------------------------

def self.initialize_mode7

self.mode7_angle = $game_system.mode7_angle ? $game_system.mode7_angle :

MODE7_DEFAULT_ANGLE

@mode7_angle_duration = 0

@mode7_zoom = $game_system.mode7_zoom ? $game_system.mode7_zoom :

MODE7_DEFAULT_ZOOM

@mode7_zoom_incr = Math.log(@mode7_zoom) / Math.log(2)

@mode7_zoom_duration = 0

pivot = (Graphics.height >> 1) + 12

@mode7_data = [pivot, pivot.to_f / Graphics.height, 1.0, 1.0, 0,

Graphics.height, 0, 0, 0, 0]

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut mode7_data

#--------------------------------------------------------------------------

def self.mode7_data

return @mode7_data

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut mode7_zoom

#--------------------------------------------------------------------------

def self.mode7_zoom

return @mode7_zoom

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut mode7_angle

#--------------------------------------------------------------------------

def self.mode7_angle

return @mode7_angle

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut mode7_active

#--------------------------------------------------------------------------

def self.mode7_active

return @mode7_active

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut mode7_active

#--------------------------------------------------------------------------

def self.mode7_active=(flag)

$game_system.mode7_active = flag

@mode7_active = flag

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut mode7_zoom

#--------------------------------------------------------------------------

def self.mode7_zoom=(zoom_value)

unless mode7_zoom == zoom_value

if zoom_value < 0.125 || zoom_value > 8.0 then return end

@mode7_zoom = zoom_value

$game_system.mode7_zoom = @mode7_zoom

$game_player.center($game_player.x, $game_player.y)

end

end

#--------------------------------------------------------------------------

# * Incrémentation de la valeur du zoom du mode 7

#--------------------------------------------------------------------------

def self.incr_mode7_zoom(val = 0.02)

@mode7_zoom_incr += val

new_zoom = 2 ** @mode7_zoom_incr

self.mode7_zoom = new_zoom

end

#--------------------------------------------------------------------------

# * Pour aller progressivement vers une nouvelle valeur de zoom du mode 7

#--------------------------------------------------------------------------

def self.to_mode7_zoom(new_zoom, duration)

unless mode7_zoom == new_zoom

if new_zoom < 0.125 || new_zoom > 8.0 then return end

@mode7_zoom_duration = duration

target_zoom_incr = Math.log(new_zoom) / Math.log(2)

@mode7_zoom_step = (target_zoom_incr - @mode7_zoom_incr) / duration

@target_mode7_zoom = new_zoom

end

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut mode7_angle

#--------------------------------------------------------------------------

def self.mode7_angle=(new_angle)

unless new_angle == @mode7_angle

@mode7_angle = [[new_angle, 0].max, 89].min

@mode7_angle_real = @mode7_angle

$game_system.mode7_angle = @mode7_angle

end

end

#--------------------------------------------------------------------------

# * Autre setter pour l'attribut mode7_angle, ne réinitialisant pas @mode7_angle_real

#--------------------------------------------------------------------------

def self.set_mode7_angle(new_angle)

unless new_angle == @mode7_angle

@mode7_angle = [[new_angle, 0].max, 89].min

$game_system.mode7_angle = @mode7_angle

end

end

#--------------------------------------------------------------------------

# * Incrémentation de la valeur de l'angle du mode 7

#--------------------------------------------------------------------------

def self.incr_mode7_angle(val = 2)

@mode7_angle_real += @mode7_angle_step

self.set_mode7_angle(@mode7_angle_real.to_i)

end

#--------------------------------------------------------------------------

# * Pour aller progressivement vers une nouvelle valeur de l'angle du mode 7

#--------------------------------------------------------------------------

def self.to_mode7_angle(new_angle, duration)

unless @mode7_angle == new_angle

new_angle = [[new_angle, 0].max, 89].min

@mode7_angle_duration = duration

@mode7_angle_step = (new_angle - @mode7_angle).to_f / duration

@target_mode7_angle = new_angle

end

end

#--------------------------------------------------------------------------

# * Mise à jour du mode 7

#--------------------------------------------------------------------------

def self.update_mode7

if @mode7_active

if @mode7_zoom_duration > 0

@mode7_zoom_duration -= 1

if @mode7_zoom_duration == 0

self.mode7_zoom = @target_mode7_zoom

else

self.incr_mode7_zoom(@mode7_zoom_step)

end

elsif @mode7_angle_duration > 0

@mode7_angle_duration -= 1

if @mode7_angle_duration == 0

self.mode7_angle = @target_mode7_angle

else

self.incr_mode7_angle(@mode7_angle_step)

end

elsif @end_mode7

@spriteset.end_mode7

@end_mode7 = false

end

end

end

#--------------------------------------------------------------------------

# * Vérifie si un effet est en cours

#--------------------------------------------------------------------------

def self.effect?

return @mode7_active && (@mode7_zoom_duration > 0 ||

@mode7_angle_duration > 0)

end

#==============================================================================

# ** MGC::Tilemap

#==============================================================================

class Mode7_Map

#--------------------------------------------------------------------------

# * Attributs

#--------------------------------------------------------------------------

attr_reader :viewport, :visible, :ox, :oy, :opacity, :blend_type, :color,

:tone, :wave_amp, :wave_length, :wave_speed, :wave_phase, :zoom, :map_data,

:flags

attr_accessor :bitmaps, :flash_data

attr_reader :alpha, :parameters

#--------------------------------------------------------------------------

# * Constantes

#--------------------------------------------------------------------------

RENDER = Win32API.new("MGC_Mode7_Ace", "renderMode7", "l", "l")

#--------------------------------------------------------------------------

# * Initialisation

#--------------------------------------------------------------------------

def initialize(viewport)

@viewport = viewport

self.bitmaps = [0, 0, 0, 0, 0, 0, 0, 0, 0]

@map_data = 0

@flags = 0

self.flash_data = nil

@cx = Graphics.width >> 1

@cy = Graphics.height >> 1

@sprite_render = Sprite.new(viewport)

@render = Bitmap.new(Graphics.width, Graphics.height)

@sprite_render.bitmap = @render

@sprite_render.x = 0

@sprite_render.y = 0

@sprite_render.z = 0

@zoom = 1.0

@view_limit = MODE7_VIEW_LIMIT << 5

fading_dist = MODE7_FADING_DISTANCE << 5

fading_begin = Graphics.height + @view_limit - fading_dist

m7_data = Table.new(Graphics.width + 6, Graphics.height)

@parameters = [@render, 0, map_data, bitmaps,

Cache.picture('autotiles_data'), Cache.picture('autotiles_data_small'),

Cache.picture('autotiles_data_xsmall'), 0, 0, 0, 0, 0, 0, 0, 4096,

100, $game_map.loop_horizontal?, $game_map.loop_vertical?, MODE7_SCAN_STEP,

0, m7_data, 2048, 0, MGC.mode7_data[5], MGC.mode7_data[0], 0, 0, 0, 0, 0,

fading_begin, fading_dist, MODE7_FADING_TONE.red.to_i,

MODE7_FADING_TONE.green.to_i, MODE7_FADING_TONE.blue.to_i,

MODE7_FADING_OPACITY]

MGC.mode7_data[9] = m7_data

self.alpha = 0

self.visible = true

self.zoom = 1.0

self.ox = 0

self.oy = 0

self.opacity = 255

self.blend_type = 0

self.color = Color.new

self.tone = Tone.new

self.wave_amp = 0

self.wave_length = 180

self.wave_speed = 360

self.wave_phase = 0.0

@initialization = true

end

#--------------------------------------------------------------------------

# * Refresh all the parameters dependent on the angle of slant

#--------------------------------------------------------------------------

def refresh_alpha

# angle of slant

alpha_rad = (Math::PI * alpha) / 180

cos_alpha_real = Math.cos(alpha_rad)

sin_alpha_real = Math.sin(alpha_rad)

cos_alpha = (2048 * cos_alpha_real).to_i

sin_alpha = (2048 * sin_alpha_real).to_i

distance_h = MGC.mode7_data[5]

pivot = MGC.mode7_data[0]

# h0, z0 : intermediate values used to calculate the slope

h0 = (-distance_h * pivot * cos_alpha) / ((distance_h << 11) +

pivot * sin_alpha) + pivot

z0 = (distance_h << 11).to_f / ((distance_h << 11) + pivot * sin_alpha)

# slope

slope_value = (1.0 - z0) / (pivot - h0)

slope_value_map = (131072 * slope_value).to_i

corrective_value = 1.0 - pivot * slope_value

corrective_value_map = (131072 * corrective_value).to_i

last_line = ((-pivot - @view_limit) * zoom).to_i

height_limit = (distance_h * last_line * cos_alpha) /

((distance_h << 11) - last_line * sin_alpha) + pivot

height_limit = [height_limit.to_i, 0].max

parameters[21] = cos_alpha

parameters[22] = sin_alpha

parameters[25] = slope_value_map

parameters[26] = corrective_value_map

parameters[27] = height_limit

parameters[29] = MODE7_SCAN_STEP

MGC.mode7_data[3] = cos_alpha_real

MGC.mode7_data[4] = sin_alpha_real

MGC.mode7_data[6] = slope_value

MGC.mode7_data[7] = corrective_value

MGC.mode7_data[8] = height_limit

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut map_data

#--------------------------------------------------------------------------

def map_data=(new_map_data)

@map_data = new_map_data

parameters[2] = @map_data

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut flags

#--------------------------------------------------------------------------

def flags=(new_flags)

@flags = new_flags

parameters[7] = @flags

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut zoom

#--------------------------------------------------------------------------

def zoom=(new_zoom)

unless zoom == new_zoom

@zoom = new_zoom

parameters[14] = (4096.0 / new_zoom).to_i

MGC.mode7_data[2] = new_zoom

vox = @ox

@ox = nil

self.ox = vox

voy = @oy

@oy = nil

self.oy = voy

@need_refresh = true

parameters[29] = MODE7_SCAN_STEP

last_line = ((-parameters[24] - @view_limit) * zoom).to_i

height_limit = (parameters[23] * last_line * parameters[21]) /

((parameters[23] << 11) - last_line * parameters[22]) + parameters[24]

parameters[27] = [height_limit.to_i, 0].max

MGC.mode7_data[8] = parameters[27]

end

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut alpha

#--------------------------------------------------------------------------

def alpha=(new_alpha)

unless new_alpha == alpha

@alpha = new_alpha

refresh_alpha

end

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut shadow_opacity

#--------------------------------------------------------------------------

def shadow_opacity=(value)

@parameters[15] = [[value, 0].max, 255].min

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut visible

#--------------------------------------------------------------------------

def visible=(flag)

@visible = flag

@sprite_render.visible = flag

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut ox

#--------------------------------------------------------------------------

def ox=(new_ox)

new_ox = new_ox.to_i

unless new_ox == @ox

@ox = new_ox

@need_refresh = true

parameters[8] = @ox

parameters[29] = MODE7_SCAN_STEP

end

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut oy

#--------------------------------------------------------------------------

def oy=(new_oy)

new_oy = new_oy.to_i

unless new_oy == @oy

@oy = new_oy

@need_refresh = true

parameters[9] = @oy

parameters[29] = MODE7_SCAN_STEP

end

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut opacity

#--------------------------------------------------------------------------

def opacity=(new_opacity)

@opacity = new_opacity

@sprite_render.opacity = new_opacity

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut blend_type

#--------------------------------------------------------------------------

def blend_type=(new_blend_type)

@blend_type = new_blend_type

@sprite_render.blend_type = new_blend_type

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut color

#--------------------------------------------------------------------------

def color=(new_color)

@color = new_color

@sprite_render.color = new_color

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut tone

#--------------------------------------------------------------------------

def tone=(new_tone)

@tone = new_tone

@sprite_render.tone = new_tone

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut wave_amp

#--------------------------------------------------------------------------

def wave_amp=(new_wave_amp)

@wave_amp = new_wave_amp

@sprite_render.wave_amp = new_wave_amp

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut wave_length

#--------------------------------------------------------------------------

def wave_length=(new_wave_length)

@wave_length = new_wave_length

@sprite_render.wave_length = new_wave_length

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut wave_speed

#--------------------------------------------------------------------------

def wave_speed=(new_wave_speed)

@wave_speed = new_wave_speed

@sprite_render.wave_speed = new_wave_speed

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut wave_phase

#--------------------------------------------------------------------------

def wave_phase=(new_wave_phase)

@wave_phase = new_wave_phase

@sprite_render.wave_phase = new_wave_phase

end

#--------------------------------------------------------------------------

# * Libération de l'instance

#--------------------------------------------------------------------------

def dispose

@render.dispose

@sprite_render.dispose

end

#--------------------------------------------------------------------------

# * Retourne true si l'instance a été libérée

#--------------------------------------------------------------------------

def disposed?

return @render.disposed?

end

#--------------------------------------------------------------------------

# * Mise à jour, appelée normalement à chaque frame

#--------------------------------------------------------------------------

def update

if @visible

self.alpha = MGC.mode7_angle

self.zoom = MGC.mode7_zoom

if Graphics.frame_count & 31 == 0

parameters[10] += 1

parameters[10] %= 3

parameters[29] = MODE7_SCAN_STEP

unless @need_refresh

@need_refresh_anim = true

end

end

if parameters[29] > 0 && !@need_refresh && !@need_refresh_anim

@need_refresh = true

end

begin

if @need_refresh

parameters[19] += 1

if parameters[19] == parameters[18]

parameters[19] = 0

end

parameters[11] = 0

RENDER.call(parameters.__id__)

parameters[29] -= 1

if parameters[29] == 0

@need_refresh = false

end

elsif @need_refresh_anim

parameters[19] += 1

if parameters[19] == parameters[18]

parameters[19] = 0

end

parameters[11] = 1

RENDER.call(parameters.__id__)

parameters[29] -= 1

if parameters[29] == 0

@need_refresh_anim = false

end

end

if @initialization && parameters[29] == 0

@initialization = false

end

end while @initialization

@sprite_render.update

end

end

#--------------------------------------------------------------------------

# * Flash des couches de la tilemap

#--------------------------------------------------------------------------

def flash(color, duration)

@sprite_render.flash(color, duration)

end

end

end

 

#==============================================================================

# ** Game_System

#==============================================================================

class Game_System

#--------------------------------------------------------------------------

# * Attributs

#--------------------------------------------------------------------------

attr_accessor :mode7_zoom, :mode7_angle, :mode7_active

end

 

#==============================================================================

# ** Game_Map

#==============================================================================

class Game_Map

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias set_display_pos_mgc_m7a set_display_pos

alias scroll_down_mgc_m7a scroll_down

alias scroll_left_mgc_m7a scroll_left

alias scroll_right_mgc_m7a scroll_right

alias scroll_up_mgc_m7a scroll_up

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Set Display Position

#--------------------------------------------------------------------------

def set_display_pos(x, y)

if MGC.mode7_active

if loop_horizontal?

@display_x = (x + width) % width

else

if MGC.mode7_zoom < 1.0 && width * MGC.mode7_zoom < screen_tile_x

@display_x = (width - screen_tile_x) / 2

else

x_min = screen_tile_x * (1.0 / MGC.mode7_zoom - 1.0) / 2

x_max = width + screen_tile_x * ((1.0 - 1.0 / MGC.mode7_zoom) / 2 - 1)

x = [x_min, [x, x_max].min].max

@display_x = x

end

end

if loop_vertical?

@display_y = (y + height) % height

else

if MGC.mode7_zoom < 1.0 && height * MGC.mode7_zoom < screen_tile_y

@display_y = (height - screen_tile_y) * MGC.mode7_data[1]

else

y_min = screen_tile_y * (1.0 / MGC.mode7_zoom - 1.0) * MGC.mode7_data[1]

y_max = height + screen_tile_y *

((1.0 - 1.0 / MGC.mode7_zoom) * (1 - MGC.mode7_data[1]) - 1)

y = [y_min, [y, y_max].min].max

@display_y = y

end

end

@parallax_x = x

@parallax_y = y

else

set_display_pos_mgc_m7a(x, y)

end

end

#--------------------------------------------------------------------------

# * Scroll Down

#--------------------------------------------------------------------------

def scroll_down(distance)

if MGC.mode7_active

if loop_vertical?

@display_y += distance

@display_y %= @map.height

@parallax_y += distance if @parallax_loop_y

else

last_y = @display_y

if MGC.mode7_zoom < 1.0 && height * MGC.mode7_zoom < screen_tile_y

@display_y = (height - screen_tile_y) * MGC.mode7_data[1]

else

max = height + screen_tile_y *

((1.0 - 1.0 / MGC.mode7_zoom) * (1 - MGC.mode7_data[1]) - 1)

@display_y = [@display_y + distance, max].min

end

@parallax_y += @display_y - last_y

end

else

scroll_down_mgc_m7a(distance)

end

end

#--------------------------------------------------------------------------

# * Scroll Left

#--------------------------------------------------------------------------

def scroll_left(distance)

if MGC.mode7_active

if loop_horizontal?

@display_x += @map.width - distance

@display_x %= @map.width

@parallax_x -= distance if @parallax_loop_x

else

last_x = @display_x

if MGC.mode7_zoom < 1.0 && width * MGC.mode7_zoom < screen_tile_x

@display_x = (width - screen_tile_x) / 2

else

min = screen_tile_x * (1.0 / MGC.mode7_zoom - 1.0) / 2

@display_x = [@display_x - distance, min].max

end

@parallax_x += @display_x - last_x

end

else

scroll_left_mgc_m7a(distance)

end

end

#--------------------------------------------------------------------------

# * Scroll Right

#--------------------------------------------------------------------------

def scroll_right(distance)

if MGC.mode7_active

if loop_horizontal?

@display_x += distance

@display_x %= @map.width

@parallax_x += distance if @parallax_loop_x

else

last_x = @display_x

if MGC.mode7_zoom < 1.0 && width * MGC.mode7_zoom < screen_tile_x

@display_x = (width - screen_tile_x) / 2

else

max = width + screen_tile_x * ((1.0 - 1.0 / MGC.mode7_zoom) / 2 - 1)

@display_x = [@display_x + distance, max].min

end

@parallax_x += @display_x - last_x

end

else

scroll_right_mgc_m7a(distance)

end

end

#--------------------------------------------------------------------------

# * Scroll Up

#--------------------------------------------------------------------------

def scroll_up(distance)

if MGC.mode7_active

if loop_vertical?

@display_y += @map.height - distance

@display_y %= @map.height

@parallax_y -= distance if @parallax_loop_y

else

last_y = @display_y

if MGC.mode7_zoom < 1.0 && height * MGC.mode7_zoom < screen_tile_y

@display_y = (height - screen_tile_y) * MGC.mode7_data[1]

else

min = screen_tile_y * (1.0 / MGC.mode7_zoom - 1.0) * MGC.mode7_data[1]

@display_y = [@display_y - distance, min].max

end

@parallax_y += @display_y - last_y

end

else

scroll_up_mgc_m7a(distance)

end

end

end

 

#==============================================================================

# ** Game_CharacterBase

#==============================================================================

class Game_CharacterBase

#--------------------------------------------------------------------------

# * Public Instance Variables

#--------------------------------------------------------------------------

attr_accessor :sprite

end

 

#==============================================================================

# ** Serialisation

#==============================================================================

[:Sprite, :Viewport, :Bitmap, :Font].each {|classname|

eval(

"class #{classname}

def marshal_dump

return []

end

def marshal_load(array)

end

end")

}

 

#==============================================================================

# ** Sprite

#==============================================================================

class Sprite

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias initialize_mgc_m7a initialize

alias zoom_x_mgc_m7a= zoom_x=

alias zoom_y_mgc_m7a= zoom_y=

alias zoom_x_mgc_m7a zoom_x

alias zoom_y_mgc_m7a zoom_y

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Initialisation

#--------------------------------------------------------------------------

def initialize(*args)

initialize_mgc_m7a(*args)

@phase_mode7 = false

self.zoom_x = 1.0

self.zoom_y = 1.0

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut zoom_x

#--------------------------------------------------------------------------

def zoom_x=(new_zoom_x)

unless @phase_mode7

@base_zoom_x = new_zoom_x

end

self.zoom_x_mgc_m7a = new_zoom_x

end

#--------------------------------------------------------------------------

# * Setter pour l'attribut zoom_y

#--------------------------------------------------------------------------

def zoom_y=(new_zoom_y)

unless @phase_mode7

@base_zoom_y = new_zoom_y

end

self.zoom_y_mgc_m7a = new_zoom_y

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut zoom_x

#--------------------------------------------------------------------------

def zoom_x

return @base_zoom_x

end

#--------------------------------------------------------------------------

# * Getter pour l'attribut zoom_y

#--------------------------------------------------------------------------

def zoom_y

return @base_zoom_y

end

#--------------------------------------------------------------------------

# * Valeur réelle du zoom_x en prenant en compte le zoom de la carte

#--------------------------------------------------------------------------

def zoom_x_real

return zoom_x_mgc_m7a

end

#--------------------------------------------------------------------------

# * Valeur réelle du zoom_y en prenant en compte le zoom de la carte

#--------------------------------------------------------------------------

def zoom_y_real

return zoom_y_mgc_m7a

end

end

 

#==============================================================================

# ** Sprite_Base

#==============================================================================

class Sprite_Base

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias animation_set_sprites_mgc_m7a_aprite_base animation_set_sprites

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Set Animation Sprite

# frame : Frame data (RPG::Animation::Frame)

#--------------------------------------------------------------------------

def animation_set_sprites(frame)

if MGC.mode7_active

cell_data = frame.cell_data

@ani_sprites.each_with_index do |sprite, i|

next unless sprite

pattern = cell_data[i, 0]

if !pattern || pattern < 0

sprite.visible = false

next

end

sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2

sprite.visible = true

sprite.src_rect.set(pattern % 5 * 192,

pattern % 100 / 5 * 192, 192, 192)

if @ani_mirror

sprite.x = @ani_ox - cell_data[i, 1] * zoom_y_real

sprite.y = @ani_oy + cell_data[i, 2] * zoom_y_real

sprite.angle = (360 - cell_data[i, 4])

sprite.mirror = (cell_data[i, 5] == 0)

else

sprite.x = @ani_ox + cell_data[i, 1] * zoom_y_real

sprite.y = @ani_oy + cell_data[i, 2] * zoom_y_real

sprite.angle = cell_data[i, 4]

sprite.mirror = (cell_data[i, 5] == 1)

end

sprite.z = self.z + 300 + i

sprite.ox = 96

sprite.oy = 96

sprite.zoom_x = cell_data[i, 3] * zoom_y_real / 100.0

sprite.zoom_y = cell_data[i, 3] * zoom_y_real / 100.0

sprite.opacity = cell_data[i, 6] * self.opacity / 255.0

sprite.blend_type = cell_data[i, 7]

end

else

animation_set_sprites_mgc_m7a_aprite_base(frame)

end

end

end

 

#==============================================================================

# ** Sprite_Character

#==============================================================================

class Sprite_Character < Sprite_Base

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias initialize_mgc_m7a_aprite_character initialize

alias update_position_mgc_m7a_aprite_character update_position

alias update_other_mgc_m7a_aprite_character update_other

alias update_balloon_mgc_m7a_aprite_character update_balloon

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Object Initialization

# character : Game_Character

#--------------------------------------------------------------------------

def initialize(viewport, character = nil)

initialize_mgc_m7a_aprite_character(viewport, character)

character.sprite = self

end

#--------------------------------------------------------------------------

# * Update Position

#--------------------------------------------------------------------------

def update_position

if MGC.mode7_active

old_x = x

old_y = y

update_mode7

self.z = @character.screen_z

move_animation(x - old_x, y - old_y)

else

update_position_mgc_m7a_aprite_character

end

end

#--------------------------------------------------------------------------

# * Update Other

#--------------------------------------------------------------------------

def update_other

update_other_mgc_m7a_aprite_character

if MGC.mode7_active && visible

if y >= MGC.mode7_data[8] && (y - height * zoom_y_real) < Graphics.height

self.visible = true

if y < Graphics.height

dat = MGC.mode7_data[9]

self.opacity += dat[5, y]

self.tone.set(dat[2, y], dat[3, y], dat[4, y])

end

else

self.visible = false

end

end

end

#--------------------------------------------------------------------------

# * Update Position In Mode7

#--------------------------------------------------------------------------

def update_mode7

y_screen = character.screen_y +

(character.is_a?(Game_Vehicle) ? character.altitude : 0)

y_init = MGC.mode7_data[2] * (y_screen - MGC.mode7_data[0])

x_init = MGC.mode7_data[2] * (character.screen_x - (Graphics.width >> 1))

self.y = (MGC.mode7_data[0] + (MGC.mode7_data[5] * y_init *

MGC.mode7_data[3]) / (MGC.mode7_data[5] - y_init * MGC.mode7_data[4])).to_i

zx = MGC.mode7_data[6] * y + MGC.mode7_data[7]

self.x = ((Graphics.width >> 1) + zx * x_init).to_i

@phase_mode7 = true

self.zoom_x = MGC.mode7_data[2] * zx

self.zoom_y = zoom_x_real

@phase_mode7 = false

if character.is_a?(Game_Vehicle)

self.y -= character.altitude * zoom_y_real

end

end

#--------------------------------------------------------------------------

# * Update Balloon Icon

#--------------------------------------------------------------------------

def update_balloon

update_balloon_mgc_m7a_aprite_character

if MGC.mode7_active && @balloon_duration > 0

@balloon_sprite.y = y - height * zoom_y_real

@balloon_sprite.zoom_x = zoom_x_real

@balloon_sprite.zoom_y = zoom_y_real

end

end

end

 

#==============================================================================

# ** Spriteset_Map

#==============================================================================

class Spriteset_Map

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias initialize_mgc_m7a initialize

alias create_tilemap_mgc_m7a create_tilemap

alias update_mgc_m7a update

alias update_shadow_mgc_m7a update_shadow

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize

MGC.spriteset = self

initialize_mgc_m7a

end

#--------------------------------------------------------------------------

# * Lance le mode 7

#--------------------------------------------------------------------------

def start_mode7

unless @tilemap_mode7

MGC.initialize_mode7

@tilemap_classic = @tilemap

@tilemap_mode7 = MGC::Mode7_Map.new(@viewport1)

@tilemap_mode7.map_data = $game_map.data

@tilemap = @tilemap_mode7

load_tileset

end

@tilemap_mode7.visible = true

@tilemap_classic.visible = false

@tilemap = @tilemap_mode7

MGC.mode7_active = true

end

#--------------------------------------------------------------------------

# * Met fin au mode 7

#--------------------------------------------------------------------------

def end_mode7

@tilemap_mode7.visible = false

@tilemap_classic.visible = true

@tilemap = @tilemap_classic

MGC.mode7_active = false

end

#--------------------------------------------------------------------------

# * Create Tilemap

#--------------------------------------------------------------------------

def create_tilemap

create_tilemap_mgc_m7a

unless $game_system.mode7_active

MGC.mode7_active = false

end

if MGC::MODE7_MAPS_ID.include?($game_map.map_id) ||

$game_system.mode7_active

then

start_mode7

end

end

#--------------------------------------------------------------------------

# * Update

#--------------------------------------------------------------------------

def update

MGC.update_mode7

update_mgc_m7a

end

#--------------------------------------------------------------------------

# * Update Airship Shadow Sprite

#--------------------------------------------------------------------------

def update_shadow

if MGC.mode7_active

airship_sprite = $game_map.airship.sprite

@shadow_sprite.x = airship_sprite.x

@shadow_sprite.y = airship_sprite.y + $game_map.airship.altitude *

airship_sprite.zoom_y_real

@shadow_sprite.opacity = $game_map.airship.altitude * 8 *

airship_sprite.opacity

@shadow_sprite.zoom_x = airship_sprite.zoom_x_real

@shadow_sprite.zoom_y = airship_sprite.zoom_y_real

@shadow_sprite.update

else

update_shadow_mgc_m7a

end

end

end

 

#==============================================================================

# ** Scene_Map

#==============================================================================

class Scene_Map < Scene_Base

#--------------------------------------------------------------------------

# * Aliased methods

#--------------------------------------------------------------------------

unless @already_aliased_mgc_m7a

alias update_call_menu_mgc_m7a update_call_menu

@already_aliased_mgc_m7a = true

end

#--------------------------------------------------------------------------

# * Determine if Menu is Called due to Cancel Button

#--------------------------------------------------------------------------

def update_call_menu

unless MGC.effect?

update_call_menu_mgc_m7a

end

end

end

 

Share this post


Link to post
Share on other sites

I don't get what you mean by your question.

 

You say you're wanting it to work "not only in airship". So I assme you mean that on your overworld, you want to ALWAYS have Mode7, even on foot? But from the screenshot it looks like you already have that... Do you mean you only want it when you ARE in the airship?

Share this post


Link to post
Share on other sites

I don't get what you mean by your question.

 

You say you're wanting it to work "not only in airship". So I assme you mean that on your overworld, you want to ALWAYS have Mode7, even on foot? But from the screenshot it looks like you already have that... Do you mean you only want it when you ARE in the airship?

 

I only want it in my overworld.

Share this post


Link to post
Share on other sites

Here > MODE7_MAPS_ID = []

Put the ID of your map betwenn []

The script will looking in there to apply the effect on the map.

You should've asked your question directly on his blog, he understand english ^^

  • Like 1

Share this post


Link to post
Share on other sites

Here > MODE7_MAPS_ID = []

Put the ID of your map betwenn []

The script will looking in there to apply the effect on the map.

You should've asked your question directly on his blog, he understand english ^^

 

Ahh! I didn't knowthat! Thanks for the feedback and help too, Chaos

Also Idk if i'm doing it right

MODE7_MAPS_ID = [001] i did this but it doesn't work

Edited by Cecillia

Share this post


Link to post
Share on other sites

Maybe, try without the zero ? Ususally scripts don't take in account zero.

If it's still doesnt work, try to do > make an event > use call script > MGC.start_mode7

 

Also here're the requirement you need to have in your project

- autotiles_data.png

- autotiles_data_small.png

- autotiles_data_xsmall.png

Put them in you folder Pictures

 

Last requirement is the dll, you need to put it with the exe of your game and not in a folder.

 

I hope, it will work.

 

EDIT : he made a demo if you didn't saw on his blog > http://www.mediafire.com/?z7dxic1jbm65umi

Edited by Chaos17

Share this post


Link to post
Share on other sites

Maybe, try without the zero ? Ususally scripts don't take in account zero.

If it's still doesnt work, try to do > make an event > use call script > MGC.start_mode7

 

Also here're the requirement you need to have in your project

- autotiles_data.png

- autotiles_data_small.png

- autotiles_data_xsmall.png

Put them in you folder Pictures

 

Last requirement is the dll, you need to put it with the exe of your game and not in a folder.

 

I hope, it will work.

 

EDIT : he made a demo if you didn't saw on his blog > http://www.mediafire...z7dxic1jbm65umi

The demo only makes it work on the airship though X_X and it doesnt work

Share this post


Link to post
Share on other sites

First, download the V.1.1 : LINK

Then remove the addon "Mode 7 Ace Addon Airship" because you don't want the mode7 to be automatically applied when boarding an airship.

Like Chaos17 wrote, add your Worldmap id in MODE7_MAPS_ID (MODE7_MAPS_ID = [1] : it's useless to put '0').

And choose the default angle : MODE7_DEFAULT_ANGLE = 50, or whatever you want.

  • Like 2

Share this post


Link to post
Share on other sites

First, download the V.1.1 : LINK

Then remove the addon "Mode 7 Ace Addon Airship" because you don't want the mode7 to be automatically applied when boarding an airship.

Like Chaos17 wrote, add your Worldmap id in MODE7_MAPS_ID (MODE7_MAPS_ID = [1] : it's useless to put '0').

And choose the default angle : MODE7_DEFAULT_ANGLE = 50, or whatever you want.

 

OMG THANK YOU SO MUCH <3 That definitely helped!

 

Also what can i do to fix this

http://i.imgur.com/FSB2t.png

Edited by Cecillia

Share this post


Link to post
Share on other sites

About this error, could you give the values of all the configuration constants, and the dimensions of your map ?

Share this post


Link to post
Share on other sites

About this error, could you give the values of all the configuration constants, and the dimensions of your map ?

 

Uhm this is what i typed

 

 

#--------------------------------------------------------------------------

# * CONFIGURATION

#--------------------------------------------------------------------------

MODE7_MAPS_ID = [1]

MODE7_DEFAULT_ZOOM = 1.0

MODE7_DEFAULT_ANGLE = 30

MODE7_VIEW_LIMIT = 26

MODE7_FADING_DISTANCE = 13

MODE7_FADING_TONE = Tone.new(64, 64, 128)

MODE7_FADING_OPACITY = 0

MODE7_SCAN_STEP = 2

 

 

and here is the map size. it only occurs when I enter a different map and for some reason when i enter atown like the mode 7 is still on then I walk foreward and it does that crash.

25x30 is the size

Share this post


Link to post
Share on other sites

I managed to get this type of error, but not exactly with your configuration.

Could you test if you still have the error with the v.1.2 ?

  • Like 1

Share this post


Link to post
Share on other sites

I managed to get this type of error, but not exactly with your configuration.

Could you test if you still have the error with the v.1.2 ?

Thank you! It works now :)

Share this post


Link to post
Share on other sites

It doesn't work for me, alas. RGSS3 player crashes when walking up on a Mode 7 map for me :/ Reliability history reports the mode 7 .dll as the guilty party.

Edited by Maus Merryjest

Share this post


Link to post
Share on other sites

Hi, I'm new to this forum (but not to RPGMaker).

 

I'm very interested in a solid Mode 7 script and I really like yours, Morngalad.

However, I still have some issues with it;

 

I don't like how you start out at an angle even when you're not in your vehicle yet.

I've put MODE7_DEFAULT_ANGLE at 0, but then the GFX get choppy between the transition from normal mode to M7.

 

In addition, if you press a directional button while the angle is still in transition to M7, it tends to switch back to normal mode while you're in the vehicle and sometimes even messes up the GFX completely.

 

Is there a way to fix these issues?

Because other than that I really like this script and in some ways it is an improvement over the M7 script of RMVX; in RMVX if you put an object on an M7 map, it tends to just 'float' around, which seems to be fixed here.

Edited by masterp

Share this post


Link to post
Share on other sites

Since you didn't respond on your site to my comment (not even approving it), here it is:

 

 

I have question: Could you make it so we can use map names to enable M&? Not visible ones that are showed when entering map, but « real maps name »?

E.g. we can do map named [M7][A45][FT0,34,55][FO128]House which will:

enable [M7]

Set angle to 45 degrees [A45]

Set fading tone to 0,34,55 values [FT0,34,55]

Set opacity to 128

It’ll help with configuration. Also would be possible to autostart m7 just after clicking New Game or after loading it from titlescreen, so we won't have to use quirky script call?

 

Plus question: What autotiles_data*.png are for?

Share this post


Link to post
Share on other sites

I do not understand how the forms work or if this is still in progress but I have mode 7 1.4 and i put in what i want but it comes up with 

 

Script 'mode 7 ace' line 1030: NoMethodError occurred

 

undefined method Move animation for

#<sprite_character:0x8c30534>

 

any help would be great!  :)

Share this post


Link to post
Share on other sites

soz, please don't necropost. If you need script support, please post in the script support section. Thanks

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted