hiding light and in-events scripts gluing
This commit is contained in:
parent
3710713d6d
commit
2d10910141
|
|
@ -85,20 +85,21 @@ class DynamicLight
|
||||||
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,
|
||||||
|
$game_player.screen_z + 128,
|
||||||
$light.plr_light_power * power_mult,
|
$light.plr_light_power * power_mult,
|
||||||
$light.plr_light_radius_lerped,
|
$light.plr_light_radius_lerped,
|
||||||
$light.plr_light_color
|
$light.plr_light_color
|
||||||
]
|
]
|
||||||
|
|
||||||
if has_effect(plr_light)
|
if has_effect(plr_light)
|
||||||
@light_sprite.add_dynamic_source(plr_light[0], plr_light[1], plr_light[2], plr_light[3], plr_light[4])
|
@light_sprite.add_dynamic_source(plr_light[0], plr_light[1], plr_light[3], plr_light[4], plr_light[5])
|
||||||
end
|
end
|
||||||
|
|
||||||
# add npc light
|
# add npc light
|
||||||
$light.dynamic_lights.each { |npc_light_source|
|
$light.dynamic_lights.each { |npc_light_source|
|
||||||
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]]
|
npc_light = [$game_map.events[npc_light_source[0]].real_x / 128.0, $game_map.events[npc_light_source[0]].real_y / 128.0, $game_map.events[npc_light_source[0]].screen_z + 128, 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[3], npc_light[4], npc_light[5])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -112,6 +113,23 @@ class DynamicLight
|
||||||
#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)
|
tile0_z = 99999
|
||||||
|
tile1_z = 99999
|
||||||
|
tile2_z = 99999
|
||||||
|
if source[4] < 3
|
||||||
|
x = (source[0] + 0.5).floor
|
||||||
|
y = (source[1] + 0.5).floor
|
||||||
|
tile0 = $game_map.get_tile(x, y, 0)
|
||||||
|
tile1 = $game_map.get_tile(x, y, 1)
|
||||||
|
tile2 = $game_map.get_tile(x, y, 2)
|
||||||
|
tile0_priora = $game_map.priorities[tile0]
|
||||||
|
tile0_z = tile0_priora == 0 ? 99999 : y * 32 + tile0_priora * 32 + 32 - $game_map.display_y / 4
|
||||||
|
tile1_priora = $game_map.priorities[tile1]
|
||||||
|
tile1_z = tile1_priora == 0 ? 99999 : y * 32 + tile1_priora * 32 + 32 - $game_map.display_y / 4
|
||||||
|
tile2_priora = $game_map.priorities[tile2]
|
||||||
|
tile2_z = tile2_priora == 0 ? 99999 : y * 32 + tile2_priora * 32 + 32 - $game_map.display_y / 4
|
||||||
|
end
|
||||||
|
|
||||||
|
!(source[2] > tile0_z || source[2] > tile1_z || source[2] > tile2_z) && source[3] != 0 && source[4] > 0 && source[5].alpha >= 0 && (source[5].red != 0 || source[5].green != 0 || source[5].blue != 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -538,9 +538,15 @@ class Game_Map
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_tile(x, y, z, tile)
|
def set_tile(x, y, z, tile)
|
||||||
if z < 0 || z > 2 || x < 0 || x >= width || y < 0 || y >= height
|
if z < 0 || z > 2 || !valid?(x, y)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@map.data[x, y, z] = tile
|
@map.data[x, y, z] = tile
|
||||||
end
|
end
|
||||||
|
def get_tile(x, y, z)
|
||||||
|
if z < 0 || z > 2 || !valid?(x, y)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
@map.data[x, y, z]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ class Interpreter
|
||||||
# Loop
|
# Loop
|
||||||
while true
|
while true
|
||||||
# If next event command is second line of script or after
|
# If next event command is second line of script or after
|
||||||
if @list[@index+1].code == 655
|
if @list[@index+1].code == 655 || @list[@index+1].code == 355
|
||||||
# Add second line or after to script
|
# Add second line or after to script
|
||||||
script += @list[@index+1].parameters[0] + "\n"
|
script += @list[@index+1].parameters[0] + "\n"
|
||||||
# If event command is not second line or after
|
# If event command is not second line or after
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue