mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
бырыбыб mirrors
This commit is contained in:
parent
0c8b23eae1
commit
681fc6a456
11 changed files with 102 additions and 72 deletions
|
|
@ -467,7 +467,7 @@ module RPG
|
|||
sprite.zoom_x = cell_data[i, 3] / 100.0
|
||||
sprite.zoom_y = cell_data[i, 3] / 100.0
|
||||
sprite.angle = cell_data[i, 4]
|
||||
sprite.mirror = (cell_data[i, 5] == 1)
|
||||
sprite.mirror_x = (cell_data[i, 5] == 1)
|
||||
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
|
||||
sprite.blend_type = cell_data[i, 7]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ DEF_PROP_F(Sprite, ZoomY)
|
|||
DEF_PROP_F(Sprite, Angle)
|
||||
DEF_PROP_F(Sprite, WavePhase)
|
||||
|
||||
DEF_PROP_B(Sprite, Mirror)
|
||||
DEF_PROP_B(Sprite, MirrorX)
|
||||
DEF_PROP_B(Sprite, MirrorY)
|
||||
DEF_PROP_B(Sprite, Obscured)
|
||||
|
||||
RB_METHOD(spriteWidth){
|
||||
|
|
@ -114,7 +115,8 @@ void spriteBindingInit(){
|
|||
INIT_PROP_BIND( Sprite, ZoomX, "zoom_x" );
|
||||
INIT_PROP_BIND( Sprite, ZoomY, "zoom_y" );
|
||||
INIT_PROP_BIND( Sprite, Angle, "angle" );
|
||||
INIT_PROP_BIND( Sprite, Mirror, "mirror" );
|
||||
INIT_PROP_BIND( Sprite, MirrorX, "mirror_x" );
|
||||
INIT_PROP_BIND( Sprite, MirrorY, "mirror_y" );
|
||||
INIT_PROP_BIND( Sprite, BushDepth, "bush_depth" );
|
||||
INIT_PROP_BIND( Sprite, Opacity, "opacity" );
|
||||
INIT_PROP_BIND( Sprite, BlendType, "blend_type" );
|
||||
|
|
|
|||
|
|
@ -10,22 +10,26 @@ class Game_Character
|
|||
# * Public Instance Variables
|
||||
#--------------------------------------------------------------------------
|
||||
attr_reader :id # ID
|
||||
attr_accessor :x # map x-coordinate (logical)
|
||||
attr_accessor :y # map y-coordinate (logical)
|
||||
attr_accessor :real_x # map x-coordinate (real * 128)
|
||||
attr_accessor :real_y # map y-coordinate (real * 128)
|
||||
attr_accessor :x # map x-coordinate (logical)
|
||||
attr_accessor :y # map y-coordinate (logical)
|
||||
attr_accessor :z
|
||||
attr_accessor :real_x # map x-coordinate (real * 128)
|
||||
attr_accessor :real_y # map y-coordinate (real * 128)
|
||||
attr_accessor :mirror_x
|
||||
attr_accessor :mirror_y
|
||||
attr_reader :tile_id # tile ID (invalid if 0)
|
||||
attr_reader :character_name # character file name
|
||||
attr_reader :character_hue # character hue
|
||||
attr_reader :opacity # opacity level
|
||||
attr_reader :blend_type # blending method
|
||||
attr_accessor :direction # direction
|
||||
attr_accessor :pattern # pattern
|
||||
attr_accessor :direction # direction
|
||||
attr_accessor :pattern # pattern
|
||||
attr_reader :move_route_forcing # forced move route flag
|
||||
attr_reader :through # through
|
||||
attr_accessor :animation_id # animation ID
|
||||
attr_accessor :transparent # transparent flag
|
||||
attr_accessor :shader
|
||||
attr_accessor :light_ignore_transition
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#--------------------------------------------------------------------------
|
||||
|
|
@ -33,6 +37,7 @@ class Game_Character
|
|||
@id = 0
|
||||
@x = 0
|
||||
@y = 0
|
||||
@z = 0
|
||||
@real_x = 0
|
||||
@real_y = 0
|
||||
@tile_id = 0
|
||||
|
|
@ -66,7 +71,11 @@ class Game_Character
|
|||
@locked = false
|
||||
@prelock_direction = 0
|
||||
@custom_flags = []
|
||||
@sprite = nil;
|
||||
@shader = Shader::Sprite
|
||||
@light_ignore_transition = false
|
||||
@mirror_x = false
|
||||
@mirror_y = false
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Determine if Moving
|
||||
|
|
@ -258,7 +267,7 @@ class Game_Character
|
|||
return 0
|
||||
end
|
||||
# Get screen coordinates from real coordinates and map display position
|
||||
z = (@real_y - $game_map.display_y + 3) / 4 + 32
|
||||
z = (@real_y - $game_map.display_y + 3) / 4 + 32 + @z
|
||||
# If tile
|
||||
if @tile_id > 0
|
||||
# Add tile priority * 32
|
||||
|
|
|
|||
|
|
@ -258,9 +258,28 @@ class Interpreter
|
|||
end
|
||||
# Continue
|
||||
begin
|
||||
eval(script)
|
||||
rescue
|
||||
STDERR.puts "[EVENT] Failed to execute script #{script}"
|
||||
eval(script, binding, "event")
|
||||
rescue => e
|
||||
event = get_character(0)
|
||||
event_info = "Event ID:#{event&.id || "???"} #{event&.name || "Unknown Event"}"
|
||||
error_line = e.backtrace.find { |line| line.include?("event") }
|
||||
line_number = error_line&.split(":")[1]
|
||||
|
||||
formated_script = ""
|
||||
script.each_line.with_index(1) do |line, index|
|
||||
if line_number.to_i == index
|
||||
formated_script << "%3d > %s\n" % [index, line.chomp]
|
||||
else
|
||||
formated_script << "%3d | %s\n" % [index, line.chomp]
|
||||
end
|
||||
end
|
||||
result = "[EVENT] Failed to execute event script | " + event_info
|
||||
result << "\n-----------------------------------------\n"
|
||||
result << formated_script
|
||||
result << "-----------------------------------------\n"
|
||||
result << e.message
|
||||
result << "\n-----------------------------------------\n"
|
||||
STDERR.puts result
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ class Scene_Map
|
|||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Misc operations
|
||||
#--------------------------------------------------------------------------
|
||||
#--------------------------------------------------------------------------
|
||||
def new_footprint(direction, x, y)
|
||||
if @spriteset != nil
|
||||
@spriteset.new_footprint(direction, x, y)
|
||||
|
|
|
|||
|
|
@ -234,28 +234,28 @@ module Script
|
|||
return cdown_update(0)
|
||||
end
|
||||
|
||||
def self.niko_reflection_update
|
||||
for event in $game_map.events.values
|
||||
if event.name == "niko reflection"
|
||||
event.real_y = 27*128/2 - ($game_player.real_y - 27*128/2)
|
||||
event.real_x = $game_player.real_x
|
||||
event.y = 14 - (($game_player.y - 13))
|
||||
event.x = $game_player.x
|
||||
if event.y > 14
|
||||
event.y = 14
|
||||
end
|
||||
if event.real_y > 14*128
|
||||
event.real_y = 14*128
|
||||
end
|
||||
event.direction = $game_player.direction
|
||||
event.pattern = $game_player.pattern
|
||||
case event.direction
|
||||
when 2
|
||||
event.direction = 8
|
||||
when 8
|
||||
event.direction = 2
|
||||
end
|
||||
return
|
||||
def self.reflection_update(npc_id, offset_x = 0, offset_y = 0, reverse_x = false, reverse_y = false)
|
||||
event = $game_map.events[npc_id]
|
||||
event.real_x = reverse_x ? offset_x * 128 - $game_player.real_x : $game_player.real_x + offset_x * 128
|
||||
event.real_y = reverse_y ? offset_y * 128 - $game_player.real_y : $game_player.real_y + offset_y * 128
|
||||
event.x = reverse_x ? offset_x - $game_player.x : $game_player.x + offset_x
|
||||
event.y = reverse_y ? offset_y - $game_player.y : $game_player.y + offset_y
|
||||
event.direction = $game_player.direction
|
||||
event.pattern = $game_player.pattern
|
||||
if reverse_x
|
||||
case event.direction
|
||||
when 4
|
||||
event.direction = 6
|
||||
when 6
|
||||
event.direction = 4
|
||||
end
|
||||
end
|
||||
if reverse_y
|
||||
case event.direction
|
||||
when 2
|
||||
event.direction = 8
|
||||
when 8
|
||||
event.direction = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,26 +33,28 @@ class Sprite_Character
|
|||
#--------------------------------------------------------------------------
|
||||
def update
|
||||
# Choose the appropriate light sprite
|
||||
@light_sprite.viewport = ($game_screen.tone.blank?) ? @viewport : @light_viewport
|
||||
@light_sprite.viewport = @character.light_ignore_transition ? @viewport : (($game_screen.tone.blank?) ? @viewport : @light_viewport)
|
||||
@light_sprite.shader = @sprite.shader =
|
||||
#idk what is this, maybe later i remake this
|
||||
@character.character_name.start_with?("en") || (Settings[:twm_shader] && @character.character_name.start_with?("niko") && $game_switches[160]) ? Shader::WorldMachine :
|
||||
@character.shader || Shader::Sprite
|
||||
@light_sprite.mirror_x = @sprite.mirror_x = @character.mirror_x
|
||||
@light_sprite.mirror_y = @sprite.mirror_y = @character.mirror_y
|
||||
|
||||
dir = (@character.direction - 2) / 2
|
||||
if Settings[:debug_text] && (@last_char_name != character.character_name || dir != @old_dir)
|
||||
@text_sprite.bitmap.clear
|
||||
@text_sprite.bitmap.draw_text(0, 0, 256, 12, "#{dir == 0 ? "↓" : dir == 1 ? "←" : dir == 2 ? "→" : "↑"} #{@character.character_name}")
|
||||
@last_char_name = character.character_name
|
||||
@last_char_name = @character.character_name
|
||||
@old_dir = dir
|
||||
elsif !Settings[:debug] && @last_char_name != "мямямя :3"
|
||||
elsif !Settings[:debug_text] && @last_char_name != "мямямя :3"
|
||||
@text_sprite.bitmap.clear
|
||||
@last_char_name = "мямямя :3"
|
||||
end
|
||||
if Settings[:debug]
|
||||
if Settings[:debug_text]
|
||||
@text_sprite.x = @character.screen_x
|
||||
@text_sprite.y = @character.screen_y
|
||||
@text_sprite.z = @character.screen_z + 2
|
||||
@text_sprite.z = 100
|
||||
end
|
||||
# Update sprites
|
||||
@sprite.update
|
||||
|
|
@ -208,7 +210,6 @@ class Sprite_Character
|
|||
sprite_attr :ox, :oy
|
||||
sprite_attr :zoom_x, :zoom_y
|
||||
sprite_attr :angle
|
||||
sprite_attr :mirror
|
||||
sprite_attr :bush_depth
|
||||
sprite_attr :opacity
|
||||
sprite_attr :color
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#==============================================================================
|
||||
|
||||
class Spriteset_Map
|
||||
attr_reader :character_sprites
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#--------------------------------------------------------------------------
|
||||
|
|
@ -76,15 +77,6 @@ class Spriteset_Map
|
|||
end
|
||||
# Make timer sprite
|
||||
@timer_sprite = Sprite_Timer.new
|
||||
# Make lightbulb sprite
|
||||
@bulb = Sprite.new(@viewport_lights)
|
||||
@bulb.x = 0
|
||||
if Graphics.width == 1280
|
||||
@bulb.bitmap = RPG::Cache.light('bulb_16')
|
||||
else
|
||||
@bulb.bitmap = RPG::Cache.light('bulb')
|
||||
end
|
||||
@bulb.opacity = has_lightbulb? ? 255 : 0
|
||||
# Make dynamic light
|
||||
@dynamic_light = DynamicLight.new(@viewport_lights)
|
||||
# Panorama animation timer
|
||||
|
|
@ -350,17 +342,6 @@ class Spriteset_Map
|
|||
for sprite in @picture_sprites
|
||||
sprite.update
|
||||
end
|
||||
# Update bulb if fading in
|
||||
@bulb.tone = $game_map.ambient
|
||||
if has_lightbulb?
|
||||
if @bulb.opacity < 255
|
||||
@bulb.opacity += 2.125
|
||||
end
|
||||
else
|
||||
if @bulb.opacity > 0
|
||||
@bulb.opacity -= 2.125
|
||||
end
|
||||
end
|
||||
|
||||
@dynamic_light.update
|
||||
# Update particles
|
||||
|
|
@ -368,7 +349,7 @@ class Spriteset_Map
|
|||
# Update timer sprite
|
||||
@timer_sprite.update
|
||||
# Set screen color tone and shake position
|
||||
@viewport.tone = $game_screen.tone + $game_map.ambient * (1.0 - @bulb.opacity / 255.0)
|
||||
@viewport.tone = $game_screen.tone + $game_map.ambient
|
||||
@viewport.ox = $game_screen.shake
|
||||
@viewport_lights.ox = $game_screen.shake
|
||||
# Set screen flash color
|
||||
|
|
|
|||
|
|
@ -238,9 +238,12 @@ struct FloatRect{
|
|||
Vec2 topRight() const { return Vec2(x+w, y); }
|
||||
Vec2 bottomRight() const { return Vec2(x+w, y+h); }
|
||||
|
||||
FloatRect hFlipped() const{
|
||||
FloatRect wFlipped() const{
|
||||
return FloatRect(x+w, y, -w, h);
|
||||
}
|
||||
FloatRect hFlipped() const{
|
||||
return FloatRect(x, y+h, w, -h);
|
||||
}
|
||||
};
|
||||
|
||||
/* Value between 0 and 255 with internal
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ struct SpritePrivate{
|
|||
Rect *srcRect;
|
||||
sigc::connection srcRectCon;
|
||||
|
||||
bool mirrored;
|
||||
bool mirrorX;
|
||||
bool mirrorY;
|
||||
int bushDepth;
|
||||
float efBushDepth;
|
||||
NormValue bushOpacity;
|
||||
|
|
@ -96,7 +97,8 @@ struct SpritePrivate{
|
|||
SpritePrivate()
|
||||
: bitmap(0),
|
||||
srcRect(&tmp.rect),
|
||||
mirrored(false),
|
||||
mirrorX(false),
|
||||
mirrorY(false),
|
||||
bushDepth(0),
|
||||
efBushDepth(0),
|
||||
bushOpacity(128),
|
||||
|
|
@ -150,7 +152,8 @@ struct SpritePrivate{
|
|||
rect.w = clamp<int>(rect.w, 0, bmSize.x-rect.x);
|
||||
rect.h = clamp<int>(rect.h, 0, bmSize.y-rect.y);
|
||||
|
||||
quad.setTexRect(mirrored ? rect.hFlipped() : rect);
|
||||
quad.setTexRect(mirrorX ? rect.wFlipped() : rect);
|
||||
quad.setTexRect(mirrorY ? rect.hFlipped() : rect);
|
||||
|
||||
quad.setPosRect(FloatRect(0, 0, rect.w, rect.h));
|
||||
recomputeBushDepth();
|
||||
|
|
@ -305,7 +308,8 @@ DEF_ATTR_RD_SIMPLE(Sprite, OY, int, p->trans.getOrigin().y)
|
|||
DEF_ATTR_RD_SIMPLE(Sprite, ZoomX, float, p->trans.getScale().x)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, ZoomY, float, p->trans.getScale().y)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, Angle, float, p->trans.getRotation())
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, Mirror, bool, p->mirrored)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, MirrorX, bool, p->mirrorX)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, MirrorY, bool, p->mirrorY)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, BushDepth, int, p->bushDepth)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, BlendType, int, p->blendType)
|
||||
DEF_ATTR_RD_SIMPLE(Sprite, Width, int, p->srcRect->width)
|
||||
|
|
@ -408,13 +412,23 @@ void Sprite::setAngle(float value){
|
|||
p->trans.setRotation(value);
|
||||
}
|
||||
|
||||
void Sprite::setMirror(bool mirrored){
|
||||
void Sprite::setMirrorX(bool mirrored){
|
||||
guardDisposed();
|
||||
|
||||
if (p->mirrored == mirrored)
|
||||
if (p->mirrorX == mirrored)
|
||||
return;
|
||||
|
||||
p->mirrored = mirrored;
|
||||
p->mirrorX = mirrored;
|
||||
p->onSrcRectChange();
|
||||
}
|
||||
|
||||
void Sprite::setMirrorY(bool mirrored){
|
||||
guardDisposed();
|
||||
|
||||
if (p->mirrorY == mirrored)
|
||||
return;
|
||||
|
||||
p->mirrorY = mirrored;
|
||||
p->onSrcRectChange();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ public:
|
|||
DECL_ATTR( ZoomX, float )
|
||||
DECL_ATTR( ZoomY, float )
|
||||
DECL_ATTR( Angle, float )
|
||||
DECL_ATTR( Mirror, bool )
|
||||
DECL_ATTR( MirrorX, bool )
|
||||
DECL_ATTR( MirrorY, bool )
|
||||
DECL_ATTR( BushDepth, int )
|
||||
DECL_ATTR( BushOpacity, int )
|
||||
DECL_ATTR( Opacity, int )
|
||||
|
|
|
|||
Loading…
Reference in a new issue