mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Overworld Outfits
This commit is contained in:
@@ -86,8 +86,98 @@ class Sprite_Character
|
||||
end
|
||||
end
|
||||
|
||||
def refresh_graphic
|
||||
return if !should_update?
|
||||
@manual_refresh=false
|
||||
@tile_id = @character.tile_id
|
||||
@character_name = @character.character_name
|
||||
@character_hue = @character.character_hue
|
||||
@oldbushdepth = @character.bush_depth
|
||||
@charbitmap&.dispose
|
||||
@charbitmap = nil
|
||||
@bushbitmap&.dispose
|
||||
@bushbitmap = nil
|
||||
|
||||
if @tile_id >= 384
|
||||
@charbitmap = pbGetTileBitmap(@character.map.tileset_name, @tile_id,
|
||||
@character_hue, @character.width, @character.height)
|
||||
@charbitmapAnimated = false
|
||||
@spriteoffset = false
|
||||
@cw = Game_Map::TILE_WIDTH * @character.width
|
||||
@ch = Game_Map::TILE_HEIGHT * @character.height
|
||||
self.src_rect.set(0, 0, @cw, @ch)
|
||||
self.ox = @cw / 2
|
||||
self.oy = @ch
|
||||
elsif @character_name != ""
|
||||
|
||||
@charbitmap = updateCharacterBitmap()
|
||||
|
||||
RPG::Cache.retain("Graphics/Characters/", @character_name, @character_hue) if @character == $game_player
|
||||
@charbitmapAnimated = true
|
||||
|
||||
@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
|
||||
else
|
||||
self.bitmap = nil
|
||||
@cw = 0
|
||||
@ch = 0
|
||||
@reflection&.update
|
||||
end
|
||||
@character.sprite_size = [@cw, @ch]
|
||||
end
|
||||
def update
|
||||
if self.pending_bitmap
|
||||
self.bitmap = self.pending_bitmap
|
||||
self.pending_bitmap = nil
|
||||
end
|
||||
return if @character.is_a?(Game_Event) && !@character.should_update?
|
||||
super
|
||||
refresh_graphic
|
||||
#return if !@charbitmap
|
||||
@charbitmap.update if @charbitmapAnimated
|
||||
bushdepth = @character.bush_depth
|
||||
if bushdepth == 0
|
||||
if @character == $game_player
|
||||
self.bitmap = getClothedPlayerSprite()
|
||||
else
|
||||
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
|
||||
end
|
||||
else
|
||||
@bushbitmap = BushBitmap.new(@charbitmap, (@tile_id >= 384), bushdepth) if !@bushbitmap
|
||||
self.bitmap = @bushbitmap.bitmap
|
||||
end
|
||||
|
||||
self.visible = !@character.transparent
|
||||
if @tile_id == 0
|
||||
sx = @character.pattern * @cw
|
||||
sy = ((@character.direction - 2) / 2) * @ch
|
||||
self.src_rect.set(sx, sy, @cw, @ch)
|
||||
self.oy = (@spriteoffset rescue false) ? @ch - 16 : @ch
|
||||
self.oy -= @character.bob_height
|
||||
end
|
||||
if self.visible
|
||||
applyDayNightTone()
|
||||
end
|
||||
this_x = @character.screen_x
|
||||
this_x = ((this_x - (Graphics.width / 2)) * TilemapRenderer::ZOOM_X) + (Graphics.width / 2) if TilemapRenderer::ZOOM_X != 1
|
||||
self.x = this_x
|
||||
this_y = @character.screen_y
|
||||
this_y = ((this_y - (Graphics.height / 2)) * TilemapRenderer::ZOOM_Y) + (Graphics.height / 2) if TilemapRenderer::ZOOM_Y != 1
|
||||
self.y = this_y
|
||||
self.z = @character.screen_z(@ch)
|
||||
self.opacity = @character.opacity
|
||||
self.blend_type = @character.blend_type
|
||||
if @character.animation_id && @character.animation_id != 0
|
||||
animation = $data_animations[@character.animation_id]
|
||||
animation(animation, true, @character.animation_height || 3, @character.animation_regular_tone || false)
|
||||
@character.animation_id = 0
|
||||
end
|
||||
@reflection&.update
|
||||
@surfbase&.update
|
||||
end
|
||||
# def update
|
||||
# if self.pending_bitmap
|
||||
# self.bitmap = self.pending_bitmap
|
||||
|
||||
@@ -81,6 +81,10 @@ class Sprite_Player < Sprite_Character
|
||||
|
||||
|
||||
def generateClothedBitmap()
|
||||
echoln "yo!"
|
||||
echoln @charbitmap.path
|
||||
|
||||
|
||||
return if !@charbitmap
|
||||
@charbitmap.bitmap.clone #nekkid sprite
|
||||
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Sprite_SurfBase
|
||||
|
||||
def initialize(parent_sprite, viewport = nil)
|
||||
@parent_sprite = parent_sprite
|
||||
@sprite = nil
|
||||
@viewport = viewport
|
||||
@disposed = false
|
||||
|
||||
@surfbitmap = update_surf_bitmap(:SURF)
|
||||
@divebitmap = update_surf_bitmap(:DIVE)
|
||||
|
||||
@cws = @surfbitmap.width / 4
|
||||
@chs = @surfbitmap.height / 4
|
||||
@cwd = @divebitmap.width / 4
|
||||
@chd = @divebitmap.height / 4
|
||||
update
|
||||
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_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
|
||||
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
#[FRAME1 [x,y]],[FRAME2 [x,y], etc.]
|
||||
#
|
||||
# exact number of pixels that the sprite needs to be moved for each frame
|
||||
# add 2 pixels on even frames
|
||||
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 = [[2, -2], [2, -2], [2, -2], [2, -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]]
|
||||
SURF_OFFSETS_UP = [[0, -10], [0, -8], [0, -10], [0, -8]]
|
||||
|
||||
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]]
|
||||
|
||||
FISH_OFFSETS_DOWN = [[0, -6], [0, -2], [0, -8], [2, -6]]
|
||||
FISH_OFFSETS_LEFT = [[0, -8], [-6, -6], [0, -8], [2, -8]]
|
||||
FISH_OFFSETS_RIGHT = [[0, -8], [6, -6], [0, -8], [-2, -8]]
|
||||
FISH_OFFSETS_UP = [[0, -6], [0, -6], [0, -6], [2, -4]]
|
||||
end
|
||||
Reference in New Issue
Block a user