*sad meow*
This commit is contained in:
parent
48dda7da8c
commit
1dce95ab70
|
|
@ -16,11 +16,12 @@ module Settings
|
||||||
:frameskip => true,
|
:frameskip => true,
|
||||||
:twm_shader => true,
|
:twm_shader => true,
|
||||||
:light => true,
|
:light => true,
|
||||||
|
# :light_layer_detect => true,
|
||||||
:scaling_mode => 0,
|
:scaling_mode => 0,
|
||||||
:vsync => 0,
|
:vsync => 0,
|
||||||
:max_firefly_count => 30,
|
:max_firefly_count => 30,
|
||||||
:footprints => true,
|
:footprints => true,
|
||||||
:footsplashes => true,
|
:footsplashes => true,
|
||||||
|
|
||||||
# ------------- UI --------------
|
# ------------- UI --------------
|
||||||
:in_game_timer => false,
|
:in_game_timer => false,
|
||||||
|
|
@ -230,6 +231,11 @@ class Window_Settings
|
||||||
:name => "Dynamic Light",
|
:name => "Dynamic Light",
|
||||||
:parameter => :light,
|
:parameter => :light,
|
||||||
},
|
},
|
||||||
|
#{
|
||||||
|
# :type => :bool,
|
||||||
|
# :name => "Light Layer Detecting",
|
||||||
|
# :parameter => :light_layer_detect,
|
||||||
|
#},
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "World machine shader",
|
:name => "World machine shader",
|
||||||
|
|
|
||||||
|
|
@ -106,14 +106,14 @@ class DynamicLight
|
||||||
$light.plr_light_color
|
$light.plr_light_color
|
||||||
]
|
]
|
||||||
|
|
||||||
if has_effect(plr_light)
|
if has_effect(plr_light, $game_player.real_y)
|
||||||
@light_sprite.add_dynamic_source(plr_light[0], plr_light[1], plr_light[3], plr_light[4], plr_light[5])
|
@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, $game_map.events[npc_light_source[0]].screen_z + 128, 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, $game_map.events[npc_light_source[0]].real_y)
|
||||||
@light_sprite.add_dynamic_source(npc_light[0], npc_light[1] - 0.5, npc_light[3], npc_light[4], npc_light[5])
|
@light_sprite.add_dynamic_source(npc_light[0], npc_light[1] - 0.5, npc_light[3], npc_light[4], npc_light[5])
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
@ -126,25 +126,53 @@ class DynamicLight
|
||||||
#def b(val)
|
#def b(val)
|
||||||
# val ? 255 : 0
|
# val ? 255 : 0
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
def tile_to_atlas(tile_id)
|
||||||
|
tile_id -= 384
|
||||||
|
y = tile_id / 8
|
||||||
|
x = tile_id - y * 8
|
||||||
|
[x * 32, y * 32]
|
||||||
|
end
|
||||||
|
|
||||||
def has_effect(source)
|
def has_effect(source, char_y = 0)
|
||||||
tile0_z = 99999
|
#if Settings[:light_layer_detect]
|
||||||
tile1_z = 99999
|
# #if source[4] < 3
|
||||||
tile2_z = 99999
|
# cz = (char_y - $game_map.display_y + 3) / 4 + 63
|
||||||
if source[4] < 3
|
# x = (source[0] + 0.5).floor
|
||||||
x = (source[0] + 0.5).floor
|
# y = (source[1] + 0.5).floor
|
||||||
y = (source[1] + 0.5).floor
|
# tile0 = $game_map.get_tile(x, y, 0)
|
||||||
tile0 = $game_map.get_tile(x, y, 0)
|
# tile1 = $game_map.get_tile(x, y, 1)
|
||||||
tile1 = $game_map.get_tile(x, y, 1)
|
# tile2 = $game_map.get_tile(x, y, 2)
|
||||||
tile2 = $game_map.get_tile(x, y, 2)
|
# tile0_priora = $game_map.priorities[tile0]
|
||||||
tile0_priora = $game_map.priorities[tile0]
|
# tile1_priora = $game_map.priorities[tile1]
|
||||||
tile0_z = tile0_priora == 0 ? 99999 : y * 32 + tile0_priora * 32 + 32 - $game_map.display_y / 4
|
# tile2_priora = $game_map.priorities[tile2]
|
||||||
tile1_priora = $game_map.priorities[tile1]
|
# tiles = [tile0, tile1, tile2]
|
||||||
tile1_z = tile1_priora == 0 ? 99999 : y * 32 + tile1_priora * 32 + 32 - $game_map.display_y / 4
|
# zeds = [
|
||||||
tile2_priora = $game_map.priorities[tile2]
|
# (y * 128 - $game_map.display_y + 3) / 4 + 32 + tile0_priora * 32,
|
||||||
tile2_z = tile2_priora == 0 ? 99999 : y * 32 + tile2_priora * 32 + 32 - $game_map.display_y / 4
|
# (y * 128 - $game_map.display_y + 3) / 4 + 32 + tile1_priora * 32,
|
||||||
end
|
# (y * 128 - $game_map.display_y + 3) / 4 + 32 + tile2_priora * 32
|
||||||
|
# ]
|
||||||
|
# (0..2).each do |i|
|
||||||
|
# if zeds[i] > cz
|
||||||
|
# if tiles[i] > 384 # <= 384
|
||||||
|
# # return false
|
||||||
|
# #else
|
||||||
|
# tileset_texture = RPG::Cache::tileset($game_map.tileset_name)
|
||||||
|
# tx, ty = tile_to_atlas(tiles[i])
|
||||||
|
# tx += (source[0] + 0.5 - x) * 32
|
||||||
|
# ty += (source[1] + 0.5 - y) * 32
|
||||||
|
# puts tx, " ", ty
|
||||||
|
# pixel_alpha = tileset_texture.get_pixel(tx, ty).alpha
|
||||||
|
# puts pixel_alpha
|
||||||
|
# if pixel_alpha > 127
|
||||||
|
# return false;
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# #end
|
||||||
|
#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)
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue