09-03-2025, 10:11 PM
(This post was last modified: 09-05-2025, 09:05 PM by 5Brainplay.)
I've not figured out a way to make events not clip through walls when rotating, it seems to be a bug from the [VXA]FPLE_Ace_1_5 build.
https://forums.rpgmakerweb.com/index.php...217/page-3
If does anyone know how to fix that, & the the rotation bleeding thru the background.
Or would that be a dll engine limitation issue, that I'll have to figure out a fix for.
EDIT:Yami Anti-Lag is required for the DOOR TAG STUFF INTO THE SCRIPT, DOOR TAG STUFF CAN BE REMOVED.
Didn't realize so many of scripts higher up were impacting the FPLE SCRIPT, As I didn't prompt the AI anything from either of these.
Oops the above code has an private refresh call without the background addon.
https://forums.rpgmakerweb.com/index.php...217/page-3
If does anyone know how to fix that, & the the rotation bleeding thru the background.
Or would that be a dll engine limitation issue, that I'll have to figure out a fix for.
EDIT:Yami Anti-Lag is required for the DOOR TAG STUFF INTO THE SCRIPT, DOOR TAG STUFF CAN BE REMOVED.
Didn't realize so many of scripts higher up were impacting the FPLE SCRIPT, As I didn't prompt the AI anything from either of these.
Oops the above code has an private refresh call without the background addon.
Code:
#==============================================================================
# ** FPLE Background Picture Addon - Enhanced
#==============================================================================
# This addon creates a background picture that renders behind all FPLE surfaces
# but in front of the engine's default background to prevent color bleeding.
# The background now positions itself at VIEW_DISTANCE + 1 for proper depth.
#==============================================================================
module FPLE
#--------------------------------------------------------------------------
# * Background Picture Configuration
#--------------------------------------------------------------------------
BACKGROUND_ENABLED = true # Enable/disable background picture
BACKGROUND_COLOR = Color.new(115, 181, 212, 255) # Default color (R,G,B,A)
BACKGROUND_PICTURE_FILE = nil # Optional: use "filename" for custom image
BACKGROUND_Z_DEPTH = -500 # Z-depth (negative = behind everything)
end
#==============================================================================
# ** FPLE Core - Modified
#==============================================================================
module FPLE
#--------------------------------------------------------------------------
# * Aliased initialization method
#--------------------------------------------------------------------------
class << self
unless @background_addon_aliased
alias initialize_fple_background initialize_fple
@background_addon_aliased = true
end
end
#--------------------------------------------------------------------------
# * Initialize with background
#--------------------------------------------------------------------------
def self.initialize_fple(spriteset, viewport)
initialize_fple_background(spriteset, viewport)
if BACKGROUND_ENABLED
create_background_picture(viewport)
end
end
#--------------------------------------------------------------------------
# * Create background picture with view distance integration
#--------------------------------------------------------------------------
def self.create_background_picture(viewport)
@background_sprite = Sprite.new(viewport)
@background_sprite.z = BACKGROUND_Z_DEPTH
if BACKGROUND_PICTURE_FILE && FileTest.exist?("Graphics/Pictures/#{BACKGROUND_PICTURE_FILE}.png")
# Use custom image file
@background_sprite.bitmap = Cache.picture(BACKGROUND_PICTURE_FILE)
else
# Create solid color background
@background_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@background_sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, BACKGROUND_COLOR)
end
# Position behind everything but visible
@background_sprite.x = 0
@background_sprite.y = 0
# Add background surface to the surfaces array for proper depth rendering
create_background_surface
end
#--------------------------------------------------------------------------
# * Create background surface at VIEW_DISTANCE + 1
#--------------------------------------------------------------------------
def self.create_background_surface
# Calculate the distance to render the background at (VIEW_DISTANCE + 1)
background_distance = ($game_system.fple_view_distance + 1) << 7
# Create a background surface that will be processed by the 3D engine
@background_surface = [
0, # texture_id (0 = no texture, use solid color)
background_distance, # dy (depth distance)
0, # dx (horizontal offset)
6, # type (6 = background plane, custom type)
0, # secondary texture
0, # z-order placeholder
0, # textureset_id
8, # textureset_width
BACKGROUND_COLOR.red, # red component
BACKGROUND_COLOR.green, # green component
BACKGROUND_COLOR.blue, # blue component
BACKGROUND_COLOR.alpha # alpha component
]
end
#--------------------------------------------------------------------------
# * Add background surface to game map surfaces
#--------------------------------------------------------------------------
def self.add_background_to_surfaces
return unless BACKGROUND_ENABLED && @background_surface
# Calculate proper z-depth for background
distance = ($game_system.fple_view_distance) << 1
@background_surface[5] = distance << 5 # Set z-order
# Add background surface to the main surfaces array if not already present
unless $game_map.surfaces.any? { |surface| surface[3] == 6 }
$game_map.surfaces.push(@background_surface.dup)
end
end
#--------------------------------------------------------------------------
# * Aliased dispose method
#--------------------------------------------------------------------------
class << self
unless @dispose_background_aliased
alias dispose_background dispose
@dispose_background_aliased = true
end
end
#--------------------------------------------------------------------------
# * Dispose with background cleanup
#--------------------------------------------------------------------------
def self.dispose
dispose_background
if @background_sprite
@background_sprite.dispose
@background_sprite = nil
end
@background_surface = nil
end
#--------------------------------------------------------------------------
# * Update background (called during movement/rotation)
#--------------------------------------------------------------------------
def self.update_background
return unless @background_surface && BACKGROUND_ENABLED
# Update the background distance based on current view distance
background_distance = ($game_system.fple_view_distance) << 7
@background_surface[1] = background_distance
# Update z-order
distance = ($game_system.fple_view_distance) << 1
@background_surface[5] = distance << 5
# Add parallax effects if desired
if @angle != 0
# Slight horizontal shift based on rotation
@background_surface[2] = (@angle * 2) # Adjust multiplier as needed
else
@background_surface[2] = 0
end
# Adjust for movement offsets if desired (subtle parallax)
# @background_surface[2] += @offset_x / 8
end
#--------------------------------------------------------------------------
# * Aliased update method
#--------------------------------------------------------------------------
class << self
unless @update_background_aliased
alias update_fple_background update
@update_background_aliased = true
end
end
#--------------------------------------------------------------------------
# * Update with background
#--------------------------------------------------------------------------
def self.update
update_fple_background
if BACKGROUND_ENABLED
update_background
add_background_to_surfaces
end
end
end
#==============================================================================
# ** Game_Map - Background Integration
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Aliased refresh_surfaces method
#--------------------------------------------------------------------------
unless @background_surfaces_aliased
alias refresh_surfaces_background refresh_surfaces
@background_surfaces_aliased = true
end
#--------------------------------------------------------------------------
# * Refresh surfaces with background integration
#--------------------------------------------------------------------------
def refresh_surfaces
refresh_surfaces_background
# Ensure background is included if enabled
if $game_system.fple && FPLE::BACKGROUND_ENABLED
FPLE.add_background_to_surfaces
# Re-sort surfaces to ensure proper rendering order
surfaces.sort! { |a, b| b[5] - a[5] } if surfaces.any? { |s| s[3] == 6 }
end
end
end
#==============================================================================
# ** Game_Interpreter - Script Commands
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Change FPLE Background Color
#--------------------------------------------------------------------------
def change_fple_background_color(red, green, blue, alpha = 255)
return unless $game_system.fple && FPLE::BACKGROUND_ENABLED
# Update the background surface color
if FPLE.instance_variable_get(:@background_surface)
surface = FPLE.instance_variable_get(:@background_surface)
surface[8] = red
surface[9] = green
surface[10] = blue
surface[11] = alpha
end
# Also update the sprite for immediate visual feedback
if FPLE.instance_variable_get(:@background_sprite)
sprite = FPLE.instance_variable_get(:@background_sprite)
color = Color.new(red, green, blue, alpha)
sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, color)
end
$game_temp.force_render = true
end
#--------------------------------------------------------------------------
# * Change FPLE Background Picture
#--------------------------------------------------------------------------
def change_fple_background_picture(filename)
return unless $game_system.fple && FPLE::BACKGROUND_ENABLED
if FPLE.instance_variable_get(:@background_sprite)
sprite = FPLE.instance_variable_get(:@background_sprite)
sprite.bitmap.dispose if sprite.bitmap
if filename && FileTest.exist?("Graphics/Pictures/#{filename}.png")
sprite.bitmap = Cache.picture(filename)
# When using a picture, set surface type to use texture instead of color
if FPLE.instance_variable_get(:@background_surface)
surface = FPLE.instance_variable_get(:@background_surface)
surface[0] = 1 # Enable texture rendering
end
else
# Fallback to solid color
sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, FPLE::BACKGROUND_COLOR)
# Reset to color mode
if FPLE.instance_variable_get(:@background_surface)
surface = FPLE.instance_variable_get(:@background_surface)
surface[0] = 0 # Disable texture, use color
end
end
end
$game_temp.force_render = true
end
#--------------------------------------------------------------------------
# * Toggle FPLE Background
#--------------------------------------------------------------------------
def toggle_fple_background(enabled)
return unless $game_system.fple
if FPLE.instance_variable_get(:@background_sprite)
sprite = FPLE.instance_variable_get(:@background_sprite)
sprite.visible = enabled
end
# Remove or add background surface based on enabled state
if enabled
FPLE.add_background_to_surfaces
else
$game_map.surfaces.reject! { |surface| surface[3] == 6 }
end
$game_temp.force_render = true
end
#--------------------------------------------------------------------------
# * Update Background Distance (call when VIEW_DISTANCE changes)
#--------------------------------------------------------------------------
def update_background_distance
return unless $game_system.fple && FPLE::BACKGROUND_ENABLED
if FPLE.instance_variable_get(:@background_surface)
FPLE.update_background
$game_temp.force_render = true
end
end
end
#==============================================================================
# ** Game_Temp - Background Integration
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Aliased set_view method to update background distance
#--------------------------------------------------------------------------
unless @background_view_aliased
alias set_view_background set_view
@background_view_aliased = true
end
#--------------------------------------------------------------------------
# * Set view distance with background update
#--------------------------------------------------------------------------
def set_view(distance)
set_view_background(distance)
# Update background distance when view distance changes
if $game_system.fple && FPLE::BACKGROUND_ENABLED
FPLE.update_background
end
end
end
#==============================================================================
# ** Usage Instructions
#==============================================================================
# Place this script below the main FPLE script but above Main.
#
# Configuration:
# - BACKGROUND_ENABLED: Set to true/false to enable/disable
# - BACKGROUND_COLOR: Set the RGB color (0-255 for each value)
# - BACKGROUND_PICTURE_FILE: Optional - use a picture file instead of solid color
# - BACKGROUND_Z_DEPTH: Z-depth value (negative = behind surfaces)
#
# The background will automatically render at VIEW_DISTANCE + 1, providing
# a backdrop that appears behind all game surfaces but maintains proper depth.
#
# Script Commands (use in events):
# - change_fple_background_color(255, 0, 0) # Change to red
# - change_fple_background_picture("sunset") # Use Graphics/Pictures/sunset.png
# - toggle_fple_background(false) # Hide background
# - toggle_fple_background(true) # Show background
# - update_background_distance # Refresh after VIEW_DISTANCE changes
#==============================================================================