mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-21 06:19:56 +00:00
*sad meow*
This commit is contained in:
parent
48dda7da8c
commit
1dce95ab70
2 changed files with 56 additions and 22 deletions
|
|
@ -16,11 +16,12 @@ module Settings
|
|||
:frameskip => true,
|
||||
:twm_shader => true,
|
||||
:light => true,
|
||||
# :light_layer_detect => true,
|
||||
:scaling_mode => 0,
|
||||
:vsync => 0,
|
||||
:max_firefly_count => 30,
|
||||
:footprints => true,
|
||||
:footsplashes => true,
|
||||
:footprints => true,
|
||||
:footsplashes => true,
|
||||
|
||||
# ------------- UI --------------
|
||||
:in_game_timer => false,
|
||||
|
|
@ -230,6 +231,11 @@ class Window_Settings
|
|||
:name => "Dynamic Light",
|
||||
:parameter => :light,
|
||||
},
|
||||
#{
|
||||
# :type => :bool,
|
||||
# :name => "Light Layer Detecting",
|
||||
# :parameter => :light_layer_detect,
|
||||
#},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "World machine shader",
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ class DynamicLight
|
|||
$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])
|
||||
end
|
||||
|
||||
# add npc light
|
||||
$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]]
|
||||
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])
|
||||
end
|
||||
}
|
||||
|
|
@ -126,25 +126,53 @@ class DynamicLight
|
|||
#def b(val)
|
||||
# val ? 255 : 0
|
||||
#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)
|
||||
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
|
||||
def has_effect(source, char_y = 0)
|
||||
#if Settings[:light_layer_detect]
|
||||
# #if source[4] < 3
|
||||
# cz = (char_y - $game_map.display_y + 3) / 4 + 63
|
||||
# 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]
|
||||
# tile1_priora = $game_map.priorities[tile1]
|
||||
# tile2_priora = $game_map.priorities[tile2]
|
||||
# tiles = [tile0, tile1, tile2]
|
||||
# zeds = [
|
||||
# (y * 128 - $game_map.display_y + 3) / 4 + 32 + tile0_priora * 32,
|
||||
# (y * 128 - $game_map.display_y + 3) / 4 + 32 + tile1_priora * 32,
|
||||
# (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
|
||||
|
|
|
|||
Loading…
Reference in a new issue