Merge branch 'master' of ssh://femoz.anipic.ru:222/Sunshine/mkxp-sunshine
This commit is contained in:
commit
35831c1c8e
|
|
@ -36,6 +36,7 @@ set(scripts
|
||||||
Game_System.rb
|
Game_System.rb
|
||||||
Game_Temp.rb
|
Game_Temp.rb
|
||||||
Game_Variables.rb
|
Game_Variables.rb
|
||||||
|
Game_Light.rb
|
||||||
Interpreter_1.rb
|
Interpreter_1.rb
|
||||||
Interpreter_2.rb
|
Interpreter_2.rb
|
||||||
Interpreter_3.rb
|
Interpreter_3.rb
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@ FOOTSTEP_SFX = [
|
||||||
['step_gravel',
|
['step_gravel',
|
||||||
'step_wood',
|
'step_wood',
|
||||||
'step_boat'],
|
'step_boat'],
|
||||||
|
# shkep this
|
||||||
|
["step_gravel",
|
||||||
|
"step_tile"],
|
||||||
]
|
]
|
||||||
|
|
||||||
FOOTSTEP_AMT = {
|
FOOTSTEP_AMT = {
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,31 @@
|
||||||
class DynamicLight
|
class DynamicLight
|
||||||
attr_accessor :done
|
|
||||||
attr_accessor :plr_light_power
|
|
||||||
attr_accessor :plr_light_color
|
|
||||||
|
|
||||||
def initialize(viewport)
|
def initialize(viewport)
|
||||||
@done = false # for events
|
|
||||||
@awaked = false
|
|
||||||
|
|
||||||
@light_npc = []
|
|
||||||
|
|
||||||
@ambient_light = 255
|
|
||||||
@ambient_light_lerped = 255
|
|
||||||
|
|
||||||
@plr_light_power = 0
|
|
||||||
@plr_light_radius = -1.0
|
|
||||||
@plr_light_radius_lerped = 5.0
|
|
||||||
@plr_light_color = Color.new(255, 255, 255)
|
|
||||||
@plr_light_table = [
|
|
||||||
# offset_x, offset_y, power_mult, radius mult
|
|
||||||
0.0, -0.5, 1.0, 1.0, # down
|
|
||||||
-0.25, -0.5, 1.0, 0.7, # left
|
|
||||||
0.25, -0.5, 1.0, 0.7, # right
|
|
||||||
0.0, 0.0, 0.0, 1.0 # up
|
|
||||||
]
|
|
||||||
|
|
||||||
@light_sprite = LightMap.new(viewport)
|
@light_sprite = LightMap.new(viewport)
|
||||||
@light_sprite.wallmap = Bitmap.new($game_map.width, $game_map.height)
|
#@light_sprite.wallmap = Bitmap.new($game_map.width, $game_map.height)
|
||||||
|
|
||||||
for x in 0...$game_map.width
|
#for x in 0...$game_map.width
|
||||||
for y in 0...$game_map.height
|
# for y in 0...$game_map.height
|
||||||
@light_sprite.wallmap.set_pixel(x, y, Color.new(
|
# @light_sprite.wallmap.set_pixel(x, y, Color.new(
|
||||||
b(light_passable($game_map.data[x, y, 0])),
|
# b(light_passable($game_map.data[x, y, 0])),
|
||||||
b(light_passable($game_map.data[x, y, 1])),
|
# b(light_passable($game_map.data[x, y, 1])),
|
||||||
b(light_passable($game_map.data[x, y, 2]))
|
# b(light_passable($game_map.data[x, y, 2]))
|
||||||
))
|
# ))
|
||||||
end
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
if $light == nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
@light_sprite.ambient = $light.ambient_light
|
||||||
|
$light.static_lights.each do |source|
|
||||||
|
@light_sprite.add_static_source(
|
||||||
|
source[0],
|
||||||
|
source[1],
|
||||||
|
source[2],
|
||||||
|
source[3],
|
||||||
|
source[4]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -44,11 +35,39 @@ class DynamicLight
|
||||||
|
|
||||||
def update
|
def update
|
||||||
# dont render light if its disabled or not awaked
|
# dont render light if its disabled or not awaked
|
||||||
@light_sprite.visible = Settings[:light] && @awaked
|
@light_sprite.visible = Settings[:light] && $light.awaked
|
||||||
if (!Settings[:light] && @awaked)
|
if (!Settings[:light] && $light.awaked)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if $light.update_clear_lights
|
||||||
|
@light_sprite.clear_static_sources()
|
||||||
|
@light_sprite.clear_dynamic_sources()
|
||||||
|
$light.update_clear_lights = false
|
||||||
|
end
|
||||||
|
if $light.update_ambient_light
|
||||||
|
@light_sprite.ambient = $light.ambient_light
|
||||||
|
$light.update_ambient_light = false
|
||||||
|
end
|
||||||
|
if $light.update_remove_static_light.length > 0
|
||||||
|
$light.update_remove_static_light.each do |source|
|
||||||
|
@light_sprite.remove_static_source(source[0], source[1])
|
||||||
|
end
|
||||||
|
$light.update_remove_static_light = []
|
||||||
|
end
|
||||||
|
if $light.update_static_lights.length > 0
|
||||||
|
$light.update_static_lights.each do |source|
|
||||||
|
@light_sprite.add_static_source(
|
||||||
|
source[0],
|
||||||
|
source[1],
|
||||||
|
source[2],
|
||||||
|
source[3],
|
||||||
|
source[4]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
$light.update_static_lights = []
|
||||||
|
end
|
||||||
|
|
||||||
# shader uniforms
|
# shader uniforms
|
||||||
@light_sprite.camera_x = $game_map.display_x / 4
|
@light_sprite.camera_x = $game_map.display_x / 4
|
||||||
@light_sprite.camera_y = $game_map.display_y / 4
|
@light_sprite.camera_y = $game_map.display_y / 4
|
||||||
|
|
@ -60,17 +79,15 @@ class DynamicLight
|
||||||
|
|
||||||
# player light
|
# player light
|
||||||
table_offset = ($game_player.direction - 2) * 2
|
table_offset = ($game_player.direction - 2) * 2
|
||||||
offset_x = @plr_light_table[table_offset]
|
offset_x = $light.plr_light_table[table_offset]
|
||||||
offset_y = @plr_light_table[table_offset + 1]
|
offset_y = $light.plr_light_table[table_offset + 1]
|
||||||
power_mult = @plr_light_table[table_offset + 2]
|
power_mult = $light.plr_light_table[table_offset + 2]
|
||||||
power_radius = @plr_light_table[table_offset + 3]
|
|
||||||
@plr_light_radius_lerped = @plr_light_radius_lerped * 0.8 + @plr_light_radius * 0.2 * power_radius
|
|
||||||
plr_light = [
|
plr_light = [
|
||||||
$game_player.real_x / 128.0 + offset_x,
|
$game_player.real_x / 128.0 + offset_x,
|
||||||
$game_player.real_y / 128.0 + offset_y,
|
$game_player.real_y / 128.0 + offset_y,
|
||||||
@plr_light_power * power_mult,
|
$light.plr_light_power * power_mult,
|
||||||
@plr_light_radius_lerped,
|
$light.plr_light_radius_lerped,
|
||||||
@plr_light_color
|
$light.plr_light_color
|
||||||
]
|
]
|
||||||
|
|
||||||
if has_effect(plr_light)
|
if has_effect(plr_light)
|
||||||
|
|
@ -78,109 +95,23 @@ class DynamicLight
|
||||||
end
|
end
|
||||||
|
|
||||||
# add npc light
|
# add npc light
|
||||||
@light_npc.each { |npc_light_source|
|
$light.dynamic_lights.each { |npc_light_source|
|
||||||
npc_light = [npc_light_source[0].real_x / 128.0, npc_light_source[0].real_y / 128.0, npc_light_source[1], npc_light_source[2], npc_light_source[3]]
|
npc_light = [$game_map.events[npc_light_source[0]].real_x / 128.0, $game_map.events[npc_light_source[0]].real_y / 128.0, npc_light_source[1], npc_light_source[2], npc_light_source[3]]
|
||||||
if has_effect(npc_light)
|
if has_effect(npc_light)
|
||||||
@light_sprite.add_dynamic_source(npc_light[0], npc_light[1] - 0.5, npc_light[2], npc_light[3], npc_light[4])
|
@light_sprite.add_dynamic_source(npc_light[0], npc_light[1] - 0.5, npc_light[2], npc_light[3], npc_light[4])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_lights
|
#def light_passable(tile_id)
|
||||||
@light_sprite.clear_static_sources()
|
# $game_map.passages[tile_id] & 15 == 0
|
||||||
@light_sprite.clear_dynamic_sources()
|
#end
|
||||||
end
|
|
||||||
|
|
||||||
def light_passable(tile_id)
|
#def b(val)
|
||||||
$game_map.passages[tile_id] & 15 == 0
|
# val ? 255 : 0
|
||||||
end
|
#end
|
||||||
|
|
||||||
def b(val)
|
|
||||||
val ? 255 : 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def add(x, y, power, radius, color = Color.new(255, 255, 255))
|
|
||||||
@awaked = true
|
|
||||||
@light_sprite.add_static_source(x, y, power, radius, color)
|
|
||||||
end
|
|
||||||
|
|
||||||
def add_npc(npc_id, power, radius, color = Color.new(255, 255, 255))
|
|
||||||
@awaked = true
|
|
||||||
@light_npc << [$game_map.events[npc_id], power, radius, color]
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove(x, y)
|
|
||||||
@light_sprite.remove_static_source(x, y)
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_npc(npc_id)
|
|
||||||
@light_npc.each do |npc|
|
|
||||||
if npc[0] == $game_map.events[npc_id]
|
|
||||||
@light_npc.delete(npc)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def has_effect(source)
|
def has_effect(source)
|
||||||
source[2] != 0 && source[3] > 0 && source[4].alpha >= 0 && (source[4].red != 0 || source[4].green != 0 || source[4].blue != 0)
|
source[2] != 0 && source[3] > 0 && source[4].alpha >= 0 && (source[4].red != 0 || source[4].green != 0 || source[4].blue != 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
#def remove(x, y)
|
|
||||||
# @light_sources.each do |sourse|
|
|
||||||
# if sourse[0] == x && sourse[1] == y
|
|
||||||
# @light_sources.delete(sourse)
|
|
||||||
# return true
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# return false
|
|
||||||
#end
|
|
||||||
|
|
||||||
def awake
|
|
||||||
@awaked = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def sleep # fully disables dynamic light system
|
|
||||||
@awaked = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def ambient_light
|
|
||||||
@ambient_light
|
|
||||||
end
|
|
||||||
def ambient_light=(val)
|
|
||||||
@ambient_light = val
|
|
||||||
@light_sprite.ambient = val
|
|
||||||
@awaked = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def plr_light_radius
|
|
||||||
@plr_light_radius
|
|
||||||
end
|
|
||||||
def plr_light_radius=(val)
|
|
||||||
if @plr_light_radius < 0
|
|
||||||
@plr_light_radius_lerped = val
|
|
||||||
end
|
|
||||||
@plr_light_radius = val
|
|
||||||
end
|
|
||||||
|
|
||||||
def plr_light_table
|
|
||||||
@plr_light_table
|
|
||||||
end
|
|
||||||
def plr_light_table=(val)
|
|
||||||
@plr_light_table[0] = val&.[](0) || 0
|
|
||||||
@plr_light_table[1] = val&.[](1) || 0
|
|
||||||
@plr_light_table[2] = val&.[](2) || 1
|
|
||||||
@plr_light_table[3] = val&.[](3) || 1
|
|
||||||
@plr_light_table[4] = val&.[](4) || 0
|
|
||||||
@plr_light_table[5] = val&.[](5) || 0
|
|
||||||
@plr_light_table[6] = val&.[](6) || 1
|
|
||||||
@plr_light_table[7] = val&.[](7) || 1
|
|
||||||
@plr_light_table[8] = val&.[](8) || 0
|
|
||||||
@plr_light_table[9] = val&.[](9) || 0
|
|
||||||
@plr_light_table[10] = val&.[](10) || 1
|
|
||||||
@plr_light_table[11] = val&.[](11) || 1
|
|
||||||
@plr_light_table[12] = val&.[](12) || 0
|
|
||||||
@plr_light_table[13] = val&.[](13) || 0
|
|
||||||
@plr_light_table[14] = val&.[](14) || 1
|
|
||||||
@plr_light_table[15] = val&.[](15) || 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
class Game_Light
|
||||||
|
attr_accessor :plr_light_power
|
||||||
|
attr_accessor :plr_light_color
|
||||||
|
|
||||||
|
attr_accessor :awaked
|
||||||
|
|
||||||
|
attr_accessor :update_clear_lights
|
||||||
|
attr_accessor :update_ambient_light
|
||||||
|
attr_accessor :update_static_lights
|
||||||
|
attr_accessor :update_remove_static_light
|
||||||
|
attr_reader :dynamic_lights
|
||||||
|
attr_reader :static_lights
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@done = false # deprecated
|
||||||
|
@awaked = false # means is light system enabled
|
||||||
|
|
||||||
|
@dynamic_lights = []
|
||||||
|
@static_lights = []
|
||||||
|
|
||||||
|
@ambient_light = 255
|
||||||
|
|
||||||
|
@plr_light_power = 0
|
||||||
|
@plr_light_radius = -1.0
|
||||||
|
@plr_light_radius_lerped = -1.0
|
||||||
|
@plr_light_color = Color.new(255, 255, 255)
|
||||||
|
@plr_light_table = [
|
||||||
|
# offset_x, offset_y, power_mult, radius mult
|
||||||
|
0.0, -0.5, 1.0, 1.0, # down
|
||||||
|
-0.25, -0.5, 1.0, 0.7, # left
|
||||||
|
0.25, -0.5, 1.0, 0.7, # right
|
||||||
|
0.0, 0.0, 0.0, 1.0 # up
|
||||||
|
]
|
||||||
|
|
||||||
|
@update_clear_lights = false
|
||||||
|
@update_ambient_light = false
|
||||||
|
@update_remove_static_light = []
|
||||||
|
@update_static_lights = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
table_offset = ($game_player.direction - 2) * 2
|
||||||
|
radius_mult = @plr_light_table[table_offset + 3]
|
||||||
|
@plr_light_radius_lerped = @plr_light_radius_lerped * 0.8 + @plr_light_radius * 0.2 * radius_mult
|
||||||
|
end
|
||||||
|
|
||||||
|
def add(x, y, power, radius, color = Color.new(255, 255, 255))
|
||||||
|
source = [x, y, power, radius, color]
|
||||||
|
@update_static_lights << source
|
||||||
|
@static_lights << source
|
||||||
|
awake
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_npc(npc_id, power, radius, color = Color.new(255, 255, 255))
|
||||||
|
@dynamic_lights << [npc_id, power, radius, color]
|
||||||
|
awake
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove(x, y)
|
||||||
|
@update_remove_static_light << [x, y]
|
||||||
|
@static_lights.each do |source|
|
||||||
|
if source[0] == x && source[1] == y
|
||||||
|
@static_lights.delete(source)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_npc(npc_id)
|
||||||
|
@dynamic_lights.each do |npc|
|
||||||
|
if npc[0] == $game_map.events[npc_id]
|
||||||
|
@dynamic_lights.delete(npc)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear_lights
|
||||||
|
clear_lights_no_signal
|
||||||
|
@update_clear_lights = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def clear_lights_no_signal
|
||||||
|
@static_lights = []
|
||||||
|
@dynamic_lights = []
|
||||||
|
@update_remove_static_light = []
|
||||||
|
@update_static_lights = []
|
||||||
|
end
|
||||||
|
|
||||||
|
def done
|
||||||
|
puts "variable \"done\" of $light is deprecated, please dont use it"
|
||||||
|
@done
|
||||||
|
end
|
||||||
|
def done=(val)
|
||||||
|
puts "variable \"done\" of $light is deprecated, please dont use it"
|
||||||
|
@done = val
|
||||||
|
end
|
||||||
|
|
||||||
|
def awake
|
||||||
|
@awaked = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def sleep # fully disables dynamic light system
|
||||||
|
@awaked = false
|
||||||
|
end
|
||||||
|
|
||||||
|
def ambient_light
|
||||||
|
@ambient_light
|
||||||
|
end
|
||||||
|
def ambient_light=(val)
|
||||||
|
@ambient_light = val
|
||||||
|
@update_ambient_light = true
|
||||||
|
awake
|
||||||
|
end
|
||||||
|
|
||||||
|
def plr_light_radius
|
||||||
|
@plr_light_radius
|
||||||
|
end
|
||||||
|
def plr_light_radius_lerped
|
||||||
|
@plr_light_radius_lerped
|
||||||
|
end
|
||||||
|
def plr_light_radius=(val)
|
||||||
|
if @plr_light_radius < 0
|
||||||
|
@plr_light_radius_lerped = val
|
||||||
|
end
|
||||||
|
@plr_light_radius = val
|
||||||
|
awake
|
||||||
|
end
|
||||||
|
|
||||||
|
def plr_light_table
|
||||||
|
@plr_light_table
|
||||||
|
end
|
||||||
|
def plr_light_table=(val)
|
||||||
|
@plr_light_table[0] = val&.[](0) || 0
|
||||||
|
@plr_light_table[1] = val&.[](1) || 0
|
||||||
|
@plr_light_table[2] = val&.[](2) || 1
|
||||||
|
@plr_light_table[3] = val&.[](3) || 1
|
||||||
|
@plr_light_table[4] = val&.[](4) || 0
|
||||||
|
@plr_light_table[5] = val&.[](5) || 0
|
||||||
|
@plr_light_table[6] = val&.[](6) || 1
|
||||||
|
@plr_light_table[7] = val&.[](7) || 1
|
||||||
|
@plr_light_table[8] = val&.[](8) || 0
|
||||||
|
@plr_light_table[9] = val&.[](9) || 0
|
||||||
|
@plr_light_table[10] = val&.[](10) || 1
|
||||||
|
@plr_light_table[11] = val&.[](11) || 1
|
||||||
|
@plr_light_table[12] = val&.[](12) || 0
|
||||||
|
@plr_light_table[13] = val&.[](13) || 0
|
||||||
|
@plr_light_table[14] = val&.[](14) || 1
|
||||||
|
@plr_light_table[15] = val&.[](15) || 1
|
||||||
|
awake
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -97,7 +97,8 @@ def write_save(filename)
|
||||||
Marshal.dump($game_followers, file)
|
Marshal.dump($game_followers, file)
|
||||||
Marshal.dump($game_oneshot, file)
|
Marshal.dump($game_oneshot, file)
|
||||||
Marshal.dump($game_fasttravel, file)
|
Marshal.dump($game_fasttravel, file)
|
||||||
Marshal.dump($game_temp.footstep_sfx , file)
|
Marshal.dump($game_temp.footstep_sfx, file)
|
||||||
|
Marshal.dump($light, file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -138,7 +139,8 @@ def load(filename)
|
||||||
$game_followers = Marshal.load(file)
|
$game_followers = Marshal.load(file)
|
||||||
$game_oneshot = Marshal.load(file)
|
$game_oneshot = Marshal.load(file)
|
||||||
$game_fasttravel = Marshal.load(file)
|
$game_fasttravel = Marshal.load(file)
|
||||||
$game_temp.footstep_sfx = Marshal.load(file)
|
$game_temp.footstep_sfx = Marshal.load(file)
|
||||||
|
$light = Marshal.load(file)
|
||||||
# If magic number is different from when saving
|
# If magic number is different from when saving
|
||||||
# (if editing was added with editor)
|
# (if editing was added with editor)
|
||||||
if $game_system.magic_number != $data_system.magic_number
|
if $game_system.magic_number != $data_system.magic_number
|
||||||
|
|
@ -210,28 +212,28 @@ end
|
||||||
def real_load
|
def real_load
|
||||||
|
|
||||||
#load save data
|
#load save data
|
||||||
begin
|
begin
|
||||||
load(SAVE_FILE_NAME)
|
load(SAVE_FILE_NAME)
|
||||||
rescue TypeError, ArgumentError => e
|
rescue TypeError, ArgumentError => e
|
||||||
puts "oops: #{e.message}"
|
puts "oops: #{e.message}"
|
||||||
EdText.err("save.dat corrupt. Attempting to load backup.")
|
EdText.err("save.dat corrupt. Attempting to load backup.")
|
||||||
for i in 1..6
|
for i in 1..6
|
||||||
if !File.exist?(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
if !File.exist?(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
||||||
EdText.err("All save backups corrupt! Deleting corrupt save and shutting down.")
|
EdText.err("All save backups corrupt! Deleting corrupt save and shutting down.")
|
||||||
File.delete(SAVE_FILE_NAME)
|
File.delete(SAVE_FILE_NAME)
|
||||||
Oneshot.allow_exit true
|
Oneshot.allow_exit true
|
||||||
Kernel.abort("All save backups corrupt! Deleting corrupt save file and shutting down.")
|
Kernel.abort("All save backups corrupt! Deleting corrupt save file and shutting down.")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
load(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
load(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
||||||
break
|
break
|
||||||
rescue TypeError, ArgumentError => e2
|
rescue TypeError, ArgumentError => e2
|
||||||
puts "oops: #{e2.message}"
|
puts "oops: #{e2.message}"
|
||||||
EdText.err("save" + (i).to_s + ".bk corrupt. Attempting to load backup.")
|
EdText.err("save" + (i).to_s + ".bk corrupt. Attempting to load backup.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
load_perma_flags
|
load_perma_flags
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class Scene_Map
|
||||||
@blackfade.visible = false
|
@blackfade.visible = false
|
||||||
@blackfade.z = 9999
|
@blackfade.z = 9999
|
||||||
|
|
||||||
RPG::Mod.exec_hooks("hooks/Scene_Map/main", binding)
|
RPG::Mod.exec_hooks("hooks/Scene_Map/main", binding)
|
||||||
|
|
||||||
# Transition run
|
# Transition run
|
||||||
Graphics.transition
|
Graphics.transition
|
||||||
|
|
@ -136,6 +136,9 @@ class Scene_Map
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
$light.update
|
||||||
|
|
||||||
# Loop
|
# Loop
|
||||||
while true
|
while true
|
||||||
if $game_temp.prompt_wait > 0
|
if $game_temp.prompt_wait > 0
|
||||||
|
|
@ -370,6 +373,8 @@ class Scene_Map
|
||||||
# If move destination is different than current map
|
# If move destination is different than current map
|
||||||
if $game_map.map_id != $game_temp.player_new_map_id
|
if $game_map.map_id != $game_temp.player_new_map_id
|
||||||
# Set up a new map
|
# Set up a new map
|
||||||
|
$light&.clear_lights_no_signal
|
||||||
|
$light.sleep
|
||||||
$game_map.setup($game_temp.player_new_map_id)
|
$game_map.setup($game_temp.player_new_map_id)
|
||||||
end
|
end
|
||||||
# Set up player/follower positions
|
# Set up player/follower positions
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,7 @@ class Scene_Title
|
||||||
$game_followers = []
|
$game_followers = []
|
||||||
$game_oneshot = Game_Oneshot.new
|
$game_oneshot = Game_Oneshot.new
|
||||||
$game_fasttravel = Game_FastTravel.new
|
$game_fasttravel = Game_FastTravel.new
|
||||||
|
$light = Game_Light.new
|
||||||
# Set up initial party
|
# Set up initial party
|
||||||
$game_party.setup_starting_members
|
$game_party.setup_starting_members
|
||||||
# Set up initial map position
|
# Set up initial map position
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ class Spriteset_Map
|
||||||
@bulb.opacity = has_lightbulb? ? 255 : 0
|
@bulb.opacity = has_lightbulb? ? 255 : 0
|
||||||
# Make dynamic light
|
# Make dynamic light
|
||||||
@dynamic_light = DynamicLight.new(@viewport_lights)
|
@dynamic_light = DynamicLight.new(@viewport_lights)
|
||||||
$light = @dynamic_light
|
|
||||||
# Panorama animation timer
|
# Panorama animation timer
|
||||||
@pan_animate_timer = 0
|
@pan_animate_timer = 0
|
||||||
RPG::Mod.exec_hooks("hooks/Spriteset_Map/init", binding)
|
RPG::Mod.exec_hooks("hooks/Spriteset_Map/init", binding)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ Game_Player
|
||||||
Game_Oneshot
|
Game_Oneshot
|
||||||
Game_Follower
|
Game_Follower
|
||||||
Game_FastTravel
|
Game_FastTravel
|
||||||
|
Game_Light
|
||||||
|
|
||||||
# yes.
|
# yes.
|
||||||
Settings
|
Settings
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,10 @@ void LightMap::draw(){
|
||||||
shader.applyViewportProj();
|
shader.applyViewportProj();
|
||||||
|
|
||||||
if (p->wallMap)
|
if (p->wallMap)
|
||||||
|
{
|
||||||
shader.setWallMapTexture(p->wallMap->getGLTypes().tex);
|
shader.setWallMapTexture(p->wallMap->getGLTypes().tex);
|
||||||
shader.setWallMapResolution(p->wallMap->width(), p->wallMap->height());
|
shader.setWallMapResolution(p->wallMap->width(), p->wallMap->height());
|
||||||
|
}
|
||||||
shader.setCameraPosition(p->cameraX, p->cameraY);
|
shader.setCameraPosition(p->cameraX, p->cameraY);
|
||||||
shader.setTileMapOffset(p->tilemapOffsetX, p->tilemapOffsetY);
|
shader.setTileMapOffset(p->tilemapOffsetX, p->tilemapOffsetY);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ void crash(Exception::Type t, const char *fmt, ...){
|
||||||
}catch(const std::exception& e){
|
}catch(const std::exception& e){
|
||||||
o << "Crashed before OpenGL initialization: " << e.what() << std::endl;
|
o << "Crashed before OpenGL initialization: " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
out << "[Versions of libs]" << std::endl;
|
o << "[Versions of libs]" << std::endl;
|
||||||
const int sdlcompiled = SDL_VERSION;
|
const int sdlcompiled = SDL_VERSION;
|
||||||
const int sdllinked = SDL_GetVersion();
|
const int sdllinked = SDL_GetVersion();
|
||||||
o << "SDL(compiled) version: " << SDL_VERSIONNUM_MAJOR(sdlcompiled) << "." << SDL_VERSIONNUM_MINOR(sdlcompiled) << "." << SDL_VERSIONNUM_MICRO(sdlcompiled) << std::endl;
|
o << "SDL(compiled) version: " << SDL_VERSIONNUM_MAJOR(sdlcompiled) << "." << SDL_VERSIONNUM_MINOR(sdlcompiled) << "." << SDL_VERSIONNUM_MICRO(sdlcompiled) << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -310,23 +310,28 @@ void DynamicLightShader::setTileMapOffset(int x, int y){
|
||||||
|
|
||||||
void DynamicLightShader::setLightSources(std::vector<LightSource> sources){
|
void DynamicLightShader::setLightSources(std::vector<LightSource> sources){
|
||||||
gl.Uniform1i(u_lightSourcesCount, sources.size());
|
gl.Uniform1i(u_lightSourcesCount, sources.size());
|
||||||
for(int i = 0; i < sources.size(); i++)
|
for(int i = 0; i < sources.size(); i++) {
|
||||||
{
|
if (i < 64) {
|
||||||
if (!sources[i].hasEffect())
|
if (!sources[i].hasEffect())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gl.Uniform4f(u_lightSources + i,
|
gl.Uniform4f(u_lightSources + i,
|
||||||
sources[i].x,
|
sources[i].x,
|
||||||
sources[i].y,
|
sources[i].y,
|
||||||
sources[i].power,
|
sources[i].power,
|
||||||
sources[i].radius
|
sources[i].radius
|
||||||
);
|
);
|
||||||
gl.Uniform4f(u_lightSourcesColors + i,
|
gl.Uniform4f(u_lightSourcesColors + i,
|
||||||
sources[i].color.red / 255.0,
|
sources[i].color.red / 255.0,
|
||||||
sources[i].color.green / 255.0,
|
sources[i].color.green / 255.0,
|
||||||
sources[i].color.blue / 255.0,
|
sources[i].color.blue / 255.0,
|
||||||
sources[i].color.alpha / 255.0
|
sources[i].color.alpha / 255.0
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Debug() << "The limit of light sources has been reached! (" << sources.size() << "/ 64 )";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue