release 6.2

This commit is contained in:
infinitefusion
2024-06-28 12:01:39 -04:00
parent 0b9e83f554
commit 3a488c9ba6
7249 changed files with 713866 additions and 136365 deletions

View File

@@ -5,6 +5,7 @@ class BushBitmap
@isTile = isTile
@isBitmap = @bitmap.is_a?(Bitmap)
@depth = depth
@manual_refresh=false
end
def dispose
@@ -63,9 +64,8 @@ class Sprite_Character < RPG::Sprite
def initialize(viewport, character = nil)
super(viewport)
@character = character
if darknessEffectOnCurrentMap()
if @character.is_a?(Game_Event)
if @character.is_a?(Game_Event)
$game_map.events[@character.id].erase if event_is_trainer(@character)
end
end
@@ -79,6 +79,11 @@ class Sprite_Character < RPG::Sprite
update
end
def setSurfingPokemon(pokemonSpecies)
@surfingPokemon = pokemonSpecies
@surfbase.setPokemon(pokemonSpecies) if @surfbase
end
def groundY
return @character.screen_y_ground
end
@@ -100,13 +105,57 @@ class Sprite_Character < RPG::Sprite
super
end
def updateBitmap
@manual_refresh=true
end
def pbLoadOutfitBitmap(outfitFileName)
# Construct the file path for the outfit bitmap based on the given value
#outfitFileName = sprintf("Graphics/Outfits/%s", value)
# Attempt to load the outfit bitmap
begin
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
return outfitBitmap
rescue
return nil
end
end
def generateClothedBitmap()
return
end
def applyDayNightTone()
if @character.is_a?(Game_Event) && @character.name[/regulartone/i]
self.tone.set(0, 0, 0, 0)
else
pbDayNightTint(self)
end
end
def updateCharacterBitmap
AnimatedBitmap.new('Graphics/Characters/' + @character_name, @character_hue)
end
def should_update?
return @tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_hue != @character.character_hue ||
@oldbushdepth != @character.bush_depth ||
@manual_refresh
end
def refreshOutfit()
self.bitmap = getClothedPlayerSprite(true)
end
def update
return if @character.is_a?(Game_Event) && !@character.should_update?
super
if @tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_hue != @character.character_hue ||
@oldbushdepth != @character.bush_depth
if should_update?
@manual_refresh=false
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
@@ -127,13 +176,14 @@ class Sprite_Character < RPG::Sprite
@character.sprite_size = [@cw, @ch]
else
@charbitmap.dispose if @charbitmap
@charbitmap = AnimatedBitmap.new(
'Graphics/Characters/' + @character_name, @character_hue)
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player
@charbitmapAnimated = true
@charbitmap = updateCharacterBitmap()
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @charbitmapAnimated = true
@bushbitmap.dispose if @bushbitmap
@bushbitmap = nil
@spriteoffset = @character_name[/offset/i]
#@spriteoffset = @character_name[/offset/i]
@spriteoffset = @character_name[/fish/i] || @character_name[/dive/i] || @character_name[/surf/i]
@cw = @charbitmap.width / 4
@ch = @charbitmap.height / 4
self.ox = @cw / 2
@@ -143,7 +193,11 @@ class Sprite_Character < RPG::Sprite
@charbitmap.update if @charbitmapAnimated
bushdepth = @character.bush_depth
if bushdepth == 0
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
if @character == $game_player
self.bitmap = getClothedPlayerSprite()#generateClothedBitmap()
else
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
end
else
@bushbitmap = BushBitmap.new(@charbitmap, (@tile_id >= 384), bushdepth) if !@bushbitmap
self.bitmap = @bushbitmap.bitmap
@@ -157,11 +211,7 @@ class Sprite_Character < RPG::Sprite
self.oy -= @character.bob_height
end
if self.visible
if @character.is_a?(Game_Event) && @character.name[/regulartone/i]
self.tone.set(0, 0, 0, 0)
else
pbDayNightTint(self)
end
applyDayNightTone()
end
self.x = @character.screen_x
self.y = @character.screen_y

View File

@@ -1,28 +1,29 @@
class Sprite_SurfBase
attr_reader :visible
attr_reader :visible
attr_accessor :event
def initialize(sprite,event,viewport=nil)
@rsprite = sprite
@sprite = nil
@event = event
def initialize(sprite, event, viewport = nil)
@rsprite = sprite
@sprite = nil
@event = event
@viewport = viewport
@disposed = false
@surfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
@divebitmap = AnimatedBitmap.new("Graphics/Characters/base_dive")
RPG::Cache.retain("Graphics/Characters/base_surf")
RPG::Cache.retain("Graphics/Characters/base_dive")
@cws = @surfbitmap.width/4
@chs = @surfbitmap.height/4
@cwd = @divebitmap.width/4
@chd = @divebitmap.height/4
#@surfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
@surfbitmap = update_surf_bitmap(:SURF)
@divebitmap = update_surf_bitmap(:DIVE)
# RPG::Cache.retain("Graphics/Characters/base_surf")
# RPG::Cache.retain("Graphics/Characters/base_dive")
@cws = @surfbitmap.width / 4
@chs = @surfbitmap.height / 4
@cwd = @divebitmap.width / 4
@chd = @divebitmap.height / 4
update
end
def dispose
return if @disposed
@sprite.dispose if @sprite
@sprite = nil
@sprite = nil
@surfbitmap.dispose
@divebitmap.dispose
@disposed = true
@@ -37,6 +38,70 @@ class Sprite_SurfBase
@sprite.visible = value if @sprite && !@sprite.disposed?
end
def update_surf_bitmap(type)
species = $Trainer.surfing_pokemon
path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_board" if type == :SURF
#path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_scuba" if type == :DIVE
path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_Head" if type == :DIVE
if species
shape = species.shape
basePath = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER
action = "divemon" if type == :DIVE
action = "surfmon" if type == :SURF
path = "#{basePath}#{action}_#{shape.to_s}"
end
return AnimatedBitmap.new(path)
end
# case species.shape
# when :Head
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_Head" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_Head" if type == :SURF
# when :Serpentine
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Finned
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :HeadArms
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :HeadBase
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :BipedalTail
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :HeadLegs
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Quadruped
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Winged
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Multiped
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :MultiBody
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Bipedal
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :MultiWinged
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# when :Insectoid
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
# else
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_01"
# end
def update
return if disposed?
if !$PokemonGlobal.surfing && !$PokemonGlobal.diving
@@ -51,32 +116,34 @@ class Sprite_SurfBase
@sprite = Sprite.new(@viewport) if !@sprite
if @sprite
if $PokemonGlobal.surfing
@surfbitmap = update_surf_bitmap(:SURF)
@sprite.bitmap = @surfbitmap.bitmap
cw = @cws
ch = @chs
elsif $PokemonGlobal.diving
@divebitmap = update_surf_bitmap(:DIVE)
@sprite.bitmap = @divebitmap.bitmap
cw = @cwd
ch = @chd
end
sx = @event.pattern_surf*cw
sy = ((@event.direction-2)/2)*ch
@sprite.src_rect.set(sx,sy,cw,ch)
sx = @event.pattern_surf * cw
sy = ((@event.direction - 2) / 2) * ch
@sprite.src_rect.set(sx, sy, cw, ch)
if $PokemonTemp.surfJump
@sprite.x = ($PokemonTemp.surfJump[0]*Game_Map::REAL_RES_X-@event.map.display_x+3)/4+(Game_Map::TILE_WIDTH/2)
@sprite.y = ($PokemonTemp.surfJump[1]*Game_Map::REAL_RES_Y-@event.map.display_y+3)/4+(Game_Map::TILE_HEIGHT/2)+16
@sprite.x = ($PokemonTemp.surfJump[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ($PokemonTemp.surfJump[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16
else
@sprite.x = @rsprite.x
@sprite.y = @rsprite.y
end
@sprite.ox = cw/2
@sprite.oy = ch-16 # Assume base needs offsetting
@sprite.oy -= @event.bob_height
@sprite.z = @event.screen_z(ch)-1
@sprite.zoom_x = @rsprite.zoom_x
@sprite.zoom_y = @rsprite.zoom_y
@sprite.tone = @rsprite.tone
@sprite.color = @rsprite.color
@sprite.ox = cw / 2
@sprite.oy = ch - 16 # Assume base needs offsetting
@sprite.oy -= @event.bob_height
@sprite.z = @event.screen_z(ch) - 1
@sprite.zoom_x = @rsprite.zoom_x
@sprite.zoom_y = @rsprite.zoom_y
@sprite.tone = @rsprite.tone
@sprite.color = @rsprite.color
@sprite.opacity = @rsprite.opacity
end
end

View File

@@ -4,7 +4,7 @@ class Spriteset_Global
@@viewport2.z = 200
def initialize
@playersprite = Sprite_Character.new(Spriteset_Map.viewport, $game_player)
@playersprite = Sprite_Player.new(Spriteset_Map.viewport, $game_player)
@picture_sprites = []
for i in 1..100
@picture_sprites.push(Sprite_Picture.new(@@viewport2, $game_screen.pictures[i]))

View File

@@ -51,6 +51,7 @@ class Spriteset_Map
@panorama = AnimatedPlane.new(@@viewport0)
@fog = AnimatedPlane.new(@@viewport1)
@fog.z = 3000
@fog2=nil
@character_sprites = []
for i in @map.events.keys.sort
sprite = Sprite_Character.new(@@viewport1,@map.events[i])
@@ -61,6 +62,18 @@ class Spriteset_Map
update
end
def setFog2(filename="010-Water04")
disposeFog2()
@fog2 = AnimatedPlane.new(@@viewport1)
@fog2.z = 3001
@fog2.setFog(filename)
end
def disposeFog2()
@fog2.dispose if @fog2
@fog2 =nil
end
def dispose
if $scene.is_a?(Scene_Map)
$scene.map_renderer.remove_tileset(@map.tileset_name)
@@ -68,6 +81,7 @@ class Spriteset_Map
end
@panorama.dispose
@fog.dispose
@fog2.dispose if @fog2
for sprite in @character_sprites
sprite.dispose
end
@@ -116,8 +130,18 @@ class Spriteset_Map
@fog.opacity = @map.fog_opacity
@fog.blend_type = @map.fog_blend_type
@fog.tone = @map.fog_tone
@fog2.ox = tmox+@map.fog2_ox if @fog2
@fog2.oy = tmoy+@map.fog2_oy if @fog2
@fog2.zoom_x = @map.fog_zoom/100.0 if @fog2
@fog2.zoom_y = @map.fog_zoom/100.0 if @fog2
@fog2.opacity = @map.fog2_opacity if @fog2
@panorama.update
@fog.update
@fog2.update if @fog2
for sprite in @character_sprites
sprite.update
end

View File

@@ -0,0 +1,27 @@
#[FRAME1 [x,y]],[FRAME2 [x,y], etc.]
module Outfit_Offsets
BASE_OFFSET = [[0, 0], [0, 0], [0, 0], [0, 0]]
RUN_OFFSETS_DOWN = [[0, 2], [0, 6], [0, 2], [0, 6]]
RUN_OFFSETS_LEFT = [[-2, -2], [-2, -2], [-2, -2], [-2, -2]]
RUN_OFFSETS_RIGHT = [[4, -2], [4, -2], [4, -2], [4, -2]]
RUN_OFFSETS_UP = [[0, -2], [0, -2], [0, -2], [0, -2]]
SURF_OFFSETS_DOWN = [[0, -6], [0, -4], [0, -6], [0, -4]]
SURF_OFFSETS_LEFT = [[-2, -10], [-2, -8], [-2, -10], [-2, -8]]
SURF_OFFSETS_RIGHT = [[4, -10], [4, -8], [4, -10], [4, -8]]
SURF_OFFSETS_UP = [[0, -6], [0, -4], [0, -6], [0, -4]]
DIVE_OFFSETS_DOWN = [[0, -6], [0, -4], [0, -6], [0, -4]]
DIVE_OFFSETS_LEFT = [[6, -8], [6, -6], [6, -8], [6, -6]]
DIVE_OFFSETS_RIGHT = [[-6, -8], [-6, -6], [-6, -8], [-6, -6]]
DIVE_OFFSETS_UP = [[0, -2], [0, 0], [0, -2], [0, 0]]
BIKE_OFFSETS_DOWN = [[0, -2], [2, 0], [0, -2], [-2, 0]]
BIKE_OFFSETS_LEFT = [[-4, -4], [-2, -2], [-4, -4], [-6, -2]]
BIKE_OFFSETS_RIGHT = [[4, -4], [2, -2], [4, -4], [6, -2]]
BIKE_OFFSETS_UP = [[0, -2], [-2, 0], [0, -2], [2, 0]]
end

View File

@@ -0,0 +1,181 @@
class Sprite_Wearable < RPG::Sprite
attr_accessor :filename
attr_accessor :action
attr_accessor :sprite
def initialize(player_sprite, filename, action, viewport)
@player_sprite = player_sprite
@viewport = viewport
@sprite = Sprite.new(@viewport)
@wearableBitmap = AnimatedBitmap.new(filename) if pbResolveBitmap(filename)
@filename = filename
@sprite.bitmap = @wearableBitmap.bitmap if @wearableBitmap
@action = action
@color = 0
@frameWidth = 80 #@sprite.width
@frameHeight = 80 #@sprite.height / 4
@sprite.z = 0
@relative_z=0 #relative to player
echoln(_INTL("init had at z = {1}, player sprite at {2}",@sprite.z,@player_sprite.z))
#Unused position offset
# @x_pos_base_offset = 0
# @y_pos_base_offset = 0
end
def apply_sprite_offset(offsets_array, current_frame)
@sprite.x += offsets_array[current_frame][0]
@sprite.y += offsets_array[current_frame][1]
end
def set_sprite_position(action, direction, current_frame)
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
case action
when "run"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
end
when "surf"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
end
when "dive"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
end
when "bike"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
end
else
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
end
@sprite.y -= 2 if current_frame % 2 == 1
end
def animate(action)
@action = action
current_frame = @player_sprite.character.pattern
direction = @player_sprite.character.direction
crop_spritesheet(direction)
set_sprite_position(@action, direction, current_frame)
adjust_layer()
end
def update(action, filename,color)
@sprite.opacity = @player_sprite.opacity if @wearableBitmap
if filename != @filename || color != @color
if pbResolveBitmap(filename)
#echoln pbResolveBitmap(filename)
@wearableBitmap = AnimatedBitmap.new(filename,color)
@sprite.bitmap = @wearableBitmap.bitmap
else
@wearableBitmap = nil
@sprite.bitmap = nil
end
@color =color
@filename = filename
end
animate(action)
end
def adjust_layer()
if @sprite.z != @player_sprite.z+@relative_z
@sprite.z = @player_sprite.z+@relative_z
end
end
def crop_spritesheet(direction)
sprite_x = 0
sprite_y = ((direction - 2) / 2) * @frameHeight
@sprite.src_rect.set(sprite_x, sprite_y, @frameWidth, @frameHeight)
end
def dispose
return if @disposed
@sprite.dispose if @sprite
@sprite = nil
@disposed = true
end
def disposed?
@disposed
end
# def getCurrentSpriteOffset()
# direction = @character.direction
# current_frame = @character.pattern
# case @character_name
# when "run"
# if direction == DIRECTION_DOWN
# return Outfit_Offsets::RUN_OFFSETS_DOWN[current_frame]
# elsif direction == DIRECTION_LEFT
# return Outfit_Offsets::RUN_OFFSETS_LEFT[current_frame]
# elsif direction == DIRECTION_RIGHT
# return Outfit_Offsets::RUN_OFFSETS_RIGHT[current_frame]
# elsif direction == DIRECTION_UP
# return Outfit_Offsets::RUN_OFFSETS_UP[current_frame]
# end
# when "surf"
# #when "dive"
# if direction == DIRECTION_DOWN
# return Outfit_Offsets::SURF_OFFSETS_DOWN[current_frame]
# elsif direction == DIRECTION_LEFT
# return Outfit_Offsets::SURF_OFFSETS_LEFT[current_frame]
# elsif direction == DIRECTION_RIGHT
# return Outfit_Offsets::SURF_OFFSETS_RIGHT[current_frame]
# elsif direction == DIRECTION_UP
# return Outfit_Offsets::SURF_OFFSETS_UP[current_frame]
# end
# when "dive"
# if direction == DIRECTION_DOWN
# return Outfit_Offsets::DIVE_OFFSETS_DOWN[current_frame]
# elsif direction == DIRECTION_LEFT
# return Outfit_Offsets::DIVE_OFFSETS_LEFT[current_frame]
# elsif direction == DIRECTION_RIGHT
# return Outfit_Offsets::DIVE_OFFSETS_RIGHT[current_frame]
# elsif direction == DIRECTION_UP
# return Outfit_Offsets::DIVE_OFFSETS_UP[current_frame]
# end
# when "bike"
# if direction == DIRECTION_DOWN
# return Outfit_Offsets::BIKE_OFFSETS_DOWN[current_frame]
# elsif direction == DIRECTION_LEFT
# return Outfit_Offsets::BIKE_OFFSETS_LEFT[current_frame]
# elsif direction == DIRECTION_RIGHT
# return Outfit_Offsets::BIKE_OFFSETS_RIGHT[current_frame]
# elsif direction == DIRECTION_UP
# return Outfit_Offsets::BIKE_OFFSETS_UP[current_frame]
# end
# end
# return Outfit_Offsets::BASE_OFFSET[current_frame]
# end
end

View File

@@ -0,0 +1,8 @@
class Sprite_Hair < Sprite_Wearable
def initialize(player_sprite, filename, action, viewport)
super
@relative_z = 1
#@sprite.z = @player_sprite.z + 1
end
end

View File

@@ -0,0 +1,192 @@
class Sprite_Hat < Sprite_Wearable
def initialize(player_sprite, filename, action, viewport)
super
@relative_z = 2
#@sprite.z = @player_sprite.z + 2
end
def set_sprite_position(action, direction, current_frame)
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
case action
when "run"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
end
when "surf"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
end
when "dive"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
end
when "bike"
if direction == DIRECTION_DOWN
apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
elsif direction == DIRECTION_LEFT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
elsif direction == DIRECTION_RIGHT
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
elsif direction == DIRECTION_UP
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
end
else
@sprite.x = @player_sprite.x - @player_sprite.ox
@sprite.y = @player_sprite.y - @player_sprite.oy
end
@sprite.y -= 2 if current_frame % 2 == 1
end
end
# class Sprite_Hat < RPG::Sprite
# attr_accessor :filename
# attr_accessor :action
# attr_accessor :hat_sprite
#
# def initialize(player_sprite, filename, action, viewport)
# @player_sprite = player_sprite
# @viewport = viewport
# @hat_sprite = Sprite.new(@viewport)
# @hatBitmap = AnimatedBitmap.new(filename) if pbResolveBitmap(filename)
# @filename = filename
# @hat_sprite.bitmap = @hatBitmap.bitmap if @hatBitmap
# @action = action
# @color = 0
# @frameWidth = 80 #@hat_sprite.width
# @frameHeight = 80 #@hat_sprite.height / 4
# @hat_sprite.z = @player_sprite.z + 2
# echoln(_INTL("init had at z = {1}, player sprite at {2}",@hat_sprite.z,@player_sprite.z))
#
# #Unused position offset
# # @x_pos_base_offset = 0
# # @y_pos_base_offset = 0
# end
#
# def apply_sprite_offset(offsets_array, current_frame)
# @hat_sprite.x += offsets_array[current_frame][0]
# @hat_sprite.y += offsets_array[current_frame][1]
# end
#
# def set_sprite_position(action, direction, current_frame)
# @hat_sprite.x = @player_sprite.x - @player_sprite.ox
# @hat_sprite.y = @player_sprite.y - @player_sprite.oy
# case action
# when "run"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
# end
# when "surf"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
# end
# when "dive"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
# end
# when "bike"
# if direction == DIRECTION_DOWN
# apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
# elsif direction == DIRECTION_LEFT
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
# elsif direction == DIRECTION_RIGHT
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
# elsif direction == DIRECTION_UP
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
# end
# else
# @hat_sprite.x = @player_sprite.x - @player_sprite.ox
# @hat_sprite.y = @player_sprite.y - @player_sprite.oy
# end
# @hat_sprite.y -= 2 if current_frame % 2 == 1
# end
#
# def animate(action)
# @action = action
# current_frame = @player_sprite.character.pattern
# direction = @player_sprite.character.direction
# crop_spritesheet(direction)
# set_sprite_position(@action, direction, current_frame)
# adjust_hat_layer()
# end
#
# def update(action, hatFilename,color)
# @hat_sprite.opacity = @player_sprite.opacity if @hatBitmap
# if hatFilename != @filename || color != @color
# if pbResolveBitmap(hatFilename)
# #echoln pbResolveBitmap(hatFilename)
# @hatBitmap = AnimatedBitmap.new(hatFilename,color)
# @hat_sprite.bitmap = @hatBitmap.bitmap
# else
# @hatBitmap = nil
# @hat_sprite.bitmap = nil
# end
# @color =color
# @filename = hatFilename
# end
# animate(action)
# end
#
# def adjust_hat_layer()
# if @hat_sprite.z != @player_sprite.z
# @hat_sprite.z = @player_sprite.z
# end
# end
#
# def crop_spritesheet(direction)
# sprite_x = 0
# sprite_y = ((direction - 2) / 2) * @frameHeight
# @hat_sprite.src_rect.set(sprite_x, sprite_y, @frameWidth, @frameHeight)
# end
#
# def dispose
# return if @disposed
# @hat_sprite.dispose if @hat_sprite
# @hat_sprite = nil
# @disposed = true
# end
#
# def disposed?
# @disposed
# end
#
# end

View File

@@ -0,0 +1,104 @@
class Sprite_Player < Sprite_Character
def initialize(viewport, character = nil)
super
@viewport = viewport
@outfit_bitmap = nil
@hat_bitmap = nil
hatFilename = ""
hairFilename = ""
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport)
@previous_skinTone = 0
@current_bitmap = nil
@previous_action =nil
getClothedPlayerSprite(true)
end
def updateCharacterBitmap
skinTone = $Trainer.skin_tone ? $Trainer.skin_tone : 0
baseBitmapFilename = getBaseOverworldSpriteFilename(@character_name, skinTone)
if !pbResolveBitmap(baseBitmapFilename)
baseBitmapFilename = Settings::PLAYER_GRAPHICS_FOLDER + @character_name
end
AnimatedBitmap.new(baseBitmapFilename, @character_hue)
end
def applyDayNightTone
super
pbDayNightTint(@hat.sprite) if @hat && @hat.sprite.bitmap
pbDayNightTint(@hair.sprite) if @hair && @hair.sprite.bitmap
end
def opacity=(value)
super
@hat.sprite.opacity= value if @hat && @hat.sprite.bitmap
@hair.sprite.opacity= value if @hair && @hair.sprite.bitmap
end
def getClothedPlayerSprite(forceUpdate=false)
if @previous_action != @character_name || forceUpdate
@current_bitmap = generateClothedBitmap
end
@previous_action = @character_name
@hair.animate(@character_name) if @hair
@hat.animate(@character_name) if @hat
return @current_bitmap
end
def generateClothedBitmap()
@charbitmap.bitmap.clone #nekkid sprite
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
outfitFilename = getOverworldOutfitFilename($Trainer.clothes, @character_name) #
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
hairFilename = getOverworldHairFilename($Trainer.hair)
hatFilename = getOverworldHatFilename($Trainer.hat)
hair_color_shift = $Trainer.hair_color
hat_color_shift = $Trainer.hat_color
clothes_color_shift = $Trainer.clothes_color
hair_color_shift = 0 if !hair_color_shift
hat_color_shift = 0 if !hat_color_shift
clothes_color_shift = 0 if !clothes_color_shift
@hair.update(@character_name, hairFilename, hair_color_shift) if @hair
@hat.update(@character_name, hatFilename, hat_color_shift) if @hat
if !pbResolveBitmap(outfitFilename)
raise "No temp clothes graphics available"
end
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename) #pbLoadOutfitBitmap(outfitFilename) if pbResolveBitmap(outfitFilename)
baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
@previous_action = @character_name
return baseBitmap
end
def positionHair(baseBitmap, hairBirmap, offset)
baseBitmap.blt(offset[0], offset[1], hairBirmap, hairBirmap.rect)
end
def update
super
end
def dispose
super
@hat.dispose if @hat
@hair.dispose if @hair
end
def pbLoadOutfitBitmap(outfitFileName)
begin
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
return outfitBitmap
rescue
return nil
end
end
end