mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Migration - more progress
This commit is contained in:
@@ -113,7 +113,7 @@ def getEasterEggHeldItem()
|
||||
return "secrets/HOTDOG" if [141, 194].include?(map) #restaurant
|
||||
return "secrets/SNOWBALL" if [670, 693, 698, 694].include?(map)
|
||||
return "secrets/WALLET" if [432, 433, 434, 435, 436, 292].include?(map) #dept. store
|
||||
return "secrets/ALARMCLOCK" if [43, 48, 67, 68, 69, 70, 71, 73].include?(map) #Player room
|
||||
return "secrets/ALARMCLOCK" if [43, 48, 67, 68, 69, 70, 71, 73].include?(map) #Overrides room
|
||||
return "SAFARIBALL" if [445, 484, 485, 486, 107, 487, 488, 717, 82, 75, 74].include?(map) #Safari Zone
|
||||
return "secrets/WISP" if [401,402,403,467,468,469].include?(map) #Pokemon Tower
|
||||
return "secrets/SKULL" if [400].include?(map) #Pokemon Tower ground floor
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Scene_Map
|
||||
def reset_player_sprite
|
||||
@spritesetGlobal.playersprite.updateBitmap
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,176 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Sprite_Character
|
||||
attr_accessor :pending_bitmap
|
||||
attr_accessor :bitmap_override
|
||||
attr_accessor :charbitmap
|
||||
alias pokemonEssentials_spriteCharacter_initialize initialize
|
||||
def initialize(viewport, character = nil)
|
||||
pokemonEssentials_spriteCharacter_initialize(viewport, character)
|
||||
checkModifySpriteGraphics(@character) if @character
|
||||
end
|
||||
|
||||
def setSpriteToAppearance(trainerAppearance)
|
||||
#return if !@charbitmap || !@charbitmap.bitmap
|
||||
begin
|
||||
new_bitmap = AnimatedBitmap.new(getBaseOverworldSpriteFilename()) #@charbitmap
|
||||
new_bitmap.bitmap = generateNPCClothedBitmapStatic(trainerAppearance)
|
||||
@bitmap_override = new_bitmap
|
||||
updateBitmap
|
||||
rescue
|
||||
end
|
||||
end
|
||||
|
||||
def clearBitmapOverride()
|
||||
@bitmap_override = nil
|
||||
updateBitmap
|
||||
end
|
||||
|
||||
def setSurfingPokemon(pokemonSpecies)
|
||||
@surfingPokemon = pokemonSpecies
|
||||
@surfbase.setPokemon(pokemonSpecies) if @surfbase
|
||||
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.pending_bitmap = getClothedPlayerSprite(true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def checkModifySpriteGraphics(character)
|
||||
return if character == $game_player || !character.name
|
||||
if TYPE_EXPERTS_APPEARANCES.keys.include?(character.name.to_sym)
|
||||
typeExpert = character.name.to_sym
|
||||
setSpriteToAppearance(TYPE_EXPERTS_APPEARANCES[typeExpert])
|
||||
end
|
||||
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
|
||||
# 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
|
||||
# if @tile_id >= 384
|
||||
# @charbitmap.dispose if @charbitmap
|
||||
# @charbitmap = pbGetTileBitmap(@character.map.tileset_name, @tile_id,
|
||||
# @character_hue, @character.width, @character.height)
|
||||
# @charbitmapAnimated = false
|
||||
# @bushbitmap.dispose if @bushbitmap
|
||||
# @bushbitmap = nil
|
||||
# @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
|
||||
# @character.sprite_size = [@cw, @ch]
|
||||
# else
|
||||
# @charbitmap.dispose if @charbitmap
|
||||
#
|
||||
# @charbitmap = updateCharacterBitmap()
|
||||
# @charbitmap = @bitmap_override.clone if @bitmap_override
|
||||
#
|
||||
# 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[/fish/i] || @character_name[/dive/i] || @character_name[/surf/i]
|
||||
# @cw = @charbitmap.width / 4
|
||||
# @ch = @charbitmap.height / 4
|
||||
# self.ox = @cw / 2
|
||||
# @character.sprite_size = [@cw, @ch]
|
||||
# end
|
||||
# end
|
||||
# @charbitmap.update if @charbitmapAnimated
|
||||
# bushdepth = @character.bush_depth
|
||||
# if bushdepth == 0
|
||||
# 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
|
||||
# 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
|
||||
# self.x = @character.screen_x
|
||||
# self.y = @character.screen_y
|
||||
# self.z = @character.screen_z(@ch)
|
||||
# # self.zoom_x = Game_Map::TILE_WIDTH / 32.0
|
||||
# # self.zoom_y = Game_Map::TILE_HEIGHT / 32.0
|
||||
# self.opacity = @character.opacity
|
||||
# self.blend_type = @character.blend_type
|
||||
# # self.bush_depth = @character.bush_depth
|
||||
# if @character.animation_id != 0
|
||||
# animation = $data_animations[@character.animation_id]
|
||||
# animation(animation, true)
|
||||
# @character.animation_id = 0
|
||||
# end
|
||||
# @reflection.update if @reflection
|
||||
# @surfbase.update if @surfbase
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,131 @@
|
||||
class Sprite_Player < Sprite_Character
|
||||
def initialize(viewport, character = nil)
|
||||
super(viewport,character)
|
||||
@initialized_player=false
|
||||
end
|
||||
|
||||
def initialize_player()
|
||||
#@viewport = viewport
|
||||
@outfit_bitmap = nil
|
||||
|
||||
hatFilename = ""
|
||||
hairFilename = ""
|
||||
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3)
|
||||
@hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,2)
|
||||
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
|
||||
|
||||
@previous_skinTone = 0
|
||||
|
||||
@current_bitmap = nil
|
||||
@previous_action =nil
|
||||
echoln "initialized player sprite"
|
||||
getClothedPlayerSprite(true)
|
||||
end
|
||||
|
||||
def update
|
||||
super
|
||||
if !@initialized_custom && @charbitmap
|
||||
initialize_player
|
||||
@initialized_custom = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def applyDayNightTone
|
||||
super
|
||||
pbDayNightTint(@hat.sprite) if @hat && @hat.sprite.bitmap
|
||||
pbDayNightTint(@hat2.sprite) if @hat2 && @hat2.sprite.bitmap
|
||||
pbDayNightTint(@hair.sprite) if @hair && @hair.sprite.bitmap
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
super
|
||||
@hat.sprite.opacity= value if @hat && @hat.sprite.bitmap
|
||||
@hat2.sprite.opacity= value if @hat2 && @hat2.sprite.bitmap
|
||||
@hair.sprite.opacity= value if @hair && @hair.sprite.bitmap
|
||||
end
|
||||
|
||||
alias pokemon_essentials_spritePlayer_dispose dispose
|
||||
def dispose
|
||||
pokemon_essentials_spritePlayer_dispose
|
||||
super
|
||||
@hat.dispose if @hat
|
||||
@hat2.dispose if @hat2
|
||||
@hair.dispose if @hair
|
||||
end
|
||||
|
||||
###############
|
||||
# New methods #
|
||||
##############
|
||||
def updateCharacterBitmap
|
||||
skinTone = $player.skin_tone ? $player.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 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
|
||||
@hat2.animate(@character_name) if @hat2
|
||||
return @current_bitmap
|
||||
end
|
||||
|
||||
|
||||
def generateClothedBitmap()
|
||||
return if !@charbitmap
|
||||
@charbitmap.bitmap.clone #nekkid sprite
|
||||
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
|
||||
|
||||
outfitFilename = getOverworldOutfitFilename($player.clothes, @character_name) #
|
||||
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
|
||||
hairFilename = getOverworldHairFilename($player.hair)
|
||||
hatFilename = getOverworldHatFilename($player.hat)
|
||||
hat2Filename = getOverworldHatFilename($player.hat2)
|
||||
|
||||
hair_color_shift = $player.hair_color
|
||||
hat_color_shift = $player.hat_color
|
||||
hat2_color_shift = $player.hat2_color
|
||||
|
||||
clothes_color_shift = $player.clothes_color
|
||||
|
||||
hair_color_shift = 0 if !hair_color_shift
|
||||
hat_color_shift = 0 if !hat_color_shift
|
||||
hat2_color_shift = 0 if !hat2_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
|
||||
@hat2.update(@character_name, hat2Filename, hat2_color_shift) if @hat2
|
||||
|
||||
if !pbResolveBitmap(outfitFilename)
|
||||
raise "No temp clothes graphics available"
|
||||
end
|
||||
|
||||
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename)
|
||||
baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
|
||||
@previous_action = @character_name
|
||||
return baseBitmap
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbLoadOutfitBitmap(outfitFileName)
|
||||
begin
|
||||
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
|
||||
return outfitBitmap
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
class Spriteset_Global
|
||||
###################
|
||||
#Overwritten methods
|
||||
# #################
|
||||
def initialize
|
||||
@map_id = $game_map&.map_id || 0
|
||||
@follower_sprites = FollowerSprites.new(Spriteset_Map.viewport)
|
||||
@playersprite = Sprite_Player.new(Spriteset_Map.viewport, $game_player)
|
||||
@weather = RPG::Weather.new(Spriteset_Map.viewport)
|
||||
@picture_sprites = []
|
||||
(1..100).each do |i|
|
||||
@picture_sprites.push(Sprite_Picture.new(@@viewport2, $game_screen.pictures[i]))
|
||||
end
|
||||
@timer_sprite = Sprite_Timer.new
|
||||
update
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
class Sprite_Wearable < RPG::Sprite
|
||||
attr_accessor :filename
|
||||
attr_accessor :action
|
||||
attr_accessor :sprite
|
||||
|
||||
def initialize(player_sprite, filename, action, viewport, relative_z=0)
|
||||
@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=relative_z #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 adjustPositionForScreenScrolling
|
||||
return if !$game_map.scrolling? && !@was_just_scrolling
|
||||
if $game_map.scrolling?
|
||||
@was_just_scrolling=true
|
||||
else
|
||||
@was_just_scrolling=false
|
||||
end
|
||||
offset_x = 0
|
||||
offset_y = 0
|
||||
case $game_map.scroll_direction
|
||||
when DIRECTION_RIGHT
|
||||
offset_x=-8
|
||||
when DIRECTION_LEFT
|
||||
offset_x=8
|
||||
when DIRECTION_UP
|
||||
offset_y=8
|
||||
@sprite.z+=50 #weird layering glitch for some reason otherwise. It's reset to the correct value in the next animation frame
|
||||
when DIRECTION_DOWN
|
||||
offset_y=-8
|
||||
end
|
||||
@sprite.x+=offset_x
|
||||
@sprite.y+=offset_y
|
||||
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
|
||||
when "fish"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::FISH_OFFSETS_UP,current_frame)
|
||||
end
|
||||
else
|
||||
@sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
@sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
end
|
||||
adjustPositionForScreenScrolling()
|
||||
|
||||
@sprite.y -= 2 if current_frame % 2 == 1
|
||||
end
|
||||
|
||||
|
||||
def animate(action, frame=nil)
|
||||
@action = action
|
||||
current_frame = @player_sprite.character.pattern if !frame
|
||||
direction = @player_sprite.character.direction
|
||||
crop_spritesheet(direction)
|
||||
adjust_layer()
|
||||
set_sprite_position(@action, direction, current_frame)
|
||||
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
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
class Sprite_Hair < Sprite_Wearable
|
||||
def initialize(player_sprite, filename, action, viewport)
|
||||
super
|
||||
@relative_z = 1
|
||||
|
||||
#@sprite.z = @player_sprite.z + 1
|
||||
end
|
||||
|
||||
def animate(action, frame = nil)
|
||||
@action = action
|
||||
current_frame = @player_sprite.character.pattern if !frame
|
||||
direction = @player_sprite.character.direction
|
||||
crop_spritesheet(direction, current_frame, action)
|
||||
adjust_layer()
|
||||
set_sprite_position(@action, direction, current_frame)
|
||||
end
|
||||
|
||||
def crop_spritesheet(direction, current_frame, action)
|
||||
sprite_x = ((current_frame)) * @frameWidth
|
||||
# Don't animate surf
|
||||
sprite_x = 0 if action == "surf"
|
||||
|
||||
sprite_y = ((direction - 2) / 2) * @frameHeight
|
||||
@sprite.src_rect.set(sprite_x, sprite_y, @frameWidth, @frameHeight)
|
||||
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 # Always animate as if on the first frame
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN, 0)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_LEFT, 0)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_RIGHT, 0)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_UP, 0)
|
||||
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
|
||||
when "fish"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_DOWN, current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_LEFT, current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_RIGHT, current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset(Outfit_Offsets::FISH_OFFSETS_UP, current_frame)
|
||||
end
|
||||
end
|
||||
adjustPositionForScreenScrolling()
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class Sprite_Hat < Sprite_Wearable
|
||||
def initialize(player_sprite, filename, action, viewport, relative_z=2)
|
||||
super
|
||||
@relative_z = relative_z
|
||||
end
|
||||
end
|
||||
158
Data/Scripts/998_InfiniteFusion/Outfits/TrainerAppearance.rb
Normal file
158
Data/Scripts/998_InfiniteFusion/Outfits/TrainerAppearance.rb
Normal file
@@ -0,0 +1,158 @@
|
||||
class TrainerAppearance
|
||||
attr_accessor :skin_color
|
||||
attr_accessor :hat
|
||||
attr_accessor :hat2
|
||||
attr_accessor :clothes
|
||||
attr_accessor :hair
|
||||
|
||||
attr_accessor :hair_color
|
||||
attr_accessor :clothes_color
|
||||
attr_accessor :hat_color
|
||||
attr_accessor :hat2_color
|
||||
|
||||
|
||||
def initialize(skin_color, hat, clothes, hair, hair_color = 0, clothes_color = 0, hat_color = 0, hat2=nil, hat2_color=0)
|
||||
@skin_color = skin_color
|
||||
@hat = hat
|
||||
@hat2 = hat2
|
||||
@clothes = clothes
|
||||
@hair = hair
|
||||
@hair_color = hair_color
|
||||
@clothes_color = clothes_color
|
||||
@hat_color = hat_color
|
||||
@hat2_color = hat2_color
|
||||
end
|
||||
end
|
||||
|
||||
def getTypeExpertAppearance(trainer_type)
|
||||
return TYPE_EXPERTS_APPEARANCES[trainer_type]
|
||||
end
|
||||
|
||||
TYPE_EXPERTS_APPEARANCES = {
|
||||
:TYPE_EXPERT_NORMAL => TrainerAppearance.new(5, "snorlaxhat", "normal", "1_painter", 0, 0, 0), #todo TEAM
|
||||
:TYPE_EXPERT_FIGHTING => TrainerAppearance.new(1, "karateHeadband", "fighting", "4_samurai", 0, 0, 0), #OK
|
||||
# TYPE_EXPERT_FLYING =>#TODO NEEDS OUTFIT, LOCATION, TEAM
|
||||
:TYPE_EXPERT_POISON => TrainerAppearance.new(5, "parashroom", "deadlypoisondanger", "3_lowbraids", 270, 0, 0), #todo TEAM
|
||||
:TYPE_EXPERT_GROUND => TrainerAppearance.new(5, "sandshrewbeanie", "groundcowboy", "3_shortspike", 0, 0, 0), #todo TEAM
|
||||
# TYPE_EXPERT_ROCK =>#TODO NEEDS OUTFIT, LOCATION, TEAM
|
||||
:TYPE_EXPERT_BUG => TrainerAppearance.new("0", "bugantenna", "bughakama", "3_hime", 60, 0,), #OK
|
||||
#:TYPE_EXPERT_GHOST => TrainerAppearance.new(6,"duskullmask","gothhoodie","4_hime",0,0,0), #NO CLOTHES - DISABLED #TODO NEEDS OUTFIT, TEAM
|
||||
:TYPE_EXPERT_STEEL => TrainerAppearance.new(2, "veteranM", "steelworkerF", "4_highpony", 0, 0, 0), #todo TEAM
|
||||
:TYPE_EXPERT_FIRE => TrainerAppearance.new(4, "firefigther", "fire", "2_bob", 330, 0, 0), #todo TEAM
|
||||
:TYPE_EXPERT_WATER => TrainerAppearance.new(5, "waterdress", "waterdress", "1_pixie", 180, 0, 0),
|
||||
# TYPE_EXPERT_GRASS => TrainerAppearance.new("0","aerodactylSkull","red","","","") , #TODO NEEDS OUTFIT, LOCATION, TEAM
|
||||
:TYPE_EXPERT_ELECTRIC => TrainerAppearance.new(3, "designerheadphones", "urbanelectric", "1_dancer", 10, 0, 0), #OK
|
||||
# TYPE_EXPERT_PSYCHIC =># TODO NEEDS OUTFIT, LOCATION, TEAM
|
||||
:TYPE_EXPERT_ICE => TrainerAppearance.new(6,"skierF","iceoutfit","1_wavy",0,0,210),
|
||||
:TYPE_EXPERT_DRAGON => TrainerAppearance.new(5, "aerodactylSkull", "dragonconqueror", "2_SpecialLatias", 670, 0, 510), #todo NEEDS LOCATION, TEAM
|
||||
# TYPE_EXPERT_DARK => #TODO NEEDS OUTFIT, LOCATION, TEAM
|
||||
:TYPE_EXPERT_FAIRY => TrainerAppearance.new(6, "mikufairy", "mikufairyf", "5_mikufairy", 0, 0, 0) #OK
|
||||
}
|
||||
|
||||
TYPE_EXPERT_TRAINERS = {
|
||||
:QMARK => ["name", "loseText"],
|
||||
:ELECTRIC => ["Ray", "What a shocking turn of events!"],
|
||||
:BUG => ["Bea", "I’m bugging out of here!"],
|
||||
:FAIRY => ["Luna", "You outshined me!"],
|
||||
:DRAGON => ["Draco", "I shall scale back my plans."],
|
||||
:FIGHTING => ["Floyd", "I have to throw in the towel."],
|
||||
:GROUND => ["Pedro", "I’m buried under this loss."],
|
||||
:FIRE => ["Blaze", "I guess I got burned out."],
|
||||
:GRASS => ["Ivy", "ou really cut me down to size!"],
|
||||
:ICE => ["Crystal", "I’m skating on thin ice!"],
|
||||
:ROCK => ["Slate", "Looks like I’ve hit rock bottom..."],
|
||||
:WATER => ["Marina", "You really made a splash!"],
|
||||
:FLYING => ["Gale", "I guess I’m grounded for now."],
|
||||
:DARK => ["Raven", "I’ll slip back into the shadows"],
|
||||
:STEEL => ["Silvia", "I guess I was a bit rusty..."],
|
||||
:PSYCHIC => ["Carl", "I could not foresee this defeat."],
|
||||
:GHOST => ["Evangeline", "I can feel myself disappearing into thin air!"],
|
||||
:POISON => ["Marie", "I got a taste of my own medicine!"],
|
||||
:NORMAL => ["Tim", "This was anything but normal!"],
|
||||
}
|
||||
|
||||
TYPE_EXPERT_REWARDS = {
|
||||
:QMARK => [],
|
||||
:ELECTRIC => [CLOTHES_ELECTRIC],
|
||||
:BUG => [CLOTHES_BUG_1,CLOTHES_BUG_2],
|
||||
:FAIRY => [CLOTHES_FAIRY_F,CLOTHES_FAIRY_M],
|
||||
:DRAGON => [CLOTHES_DRAGON],
|
||||
:FIGHTING => [CLOTHES_FIGHTING],
|
||||
:GROUND => [CLOTHES_GROUND],
|
||||
:FIRE => [CLOTHES_FIRE],
|
||||
:GRASS => [CLOTHES_GRASS],
|
||||
:ICE => [CLOTHES_ICE],
|
||||
:ROCK => [CLOTHES_ROCK],
|
||||
:WATER => [CLOTHES_WATER],
|
||||
:FLYING => [CLOTHES_FLYING],
|
||||
:DARK => [CLOTHES_DARK],
|
||||
:STEEL => [CLOTHES_STEEL_F,CLOTHES_STEEL_M],
|
||||
:PSYCHIC => [CLOTHES_PSYCHIC],
|
||||
:GHOST => [CLOTHES_GHOST],
|
||||
:POISON => [CLOTHES_POISON],
|
||||
:NORMAL => [CLOTHES_NORMAL],
|
||||
}
|
||||
|
||||
TOTAL_NB_TYPE_EXPERTS = 12
|
||||
def type_expert_battle(type_id)
|
||||
type = GameData::Type.get(type_id)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("Ah! Can you feel the energy in here? This place is great for #{type.real_name}-Pokémon!")
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("I'm what you could call an expert on #{type.real_name}-Pokémon. I've grown with them for all of my life.")
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("I'll give you my \\C[5]special outfit\\C[0] if you can defeat my team using only #{type.real_name}-type Pokémon. ")
|
||||
pbCallBub(2, @event_id)
|
||||
if pbConfirmMessage("Do you think you can handle that?")
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("Select your team! Remember, only #{type.real_name}-type Pokémon are allowed!")
|
||||
|
||||
gym_randomizer_index = GYM_TYPES_CLASSIC.index(type_id)
|
||||
echoln gym_randomizer_index
|
||||
pbSet(VAR_CURRENT_GYM_TYPE, gym_randomizer_index)
|
||||
if PokemonSelection.choose(1, 4, true, true, proc { |poke| poke.hasType?(type_id) })
|
||||
#Level is equal to the highest level in player's party
|
||||
$game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]=true
|
||||
$game_switches[SWITCH_DONT_RANDOMIZE]=true
|
||||
|
||||
pbSet(Settings::OVERRIDE_BATTLE_LEVEL_VALUE_VAR, $player.highest_level_pokemon_in_party)
|
||||
trainer_class = "TYPE_EXPERT_#{type_id.to_s}".to_sym
|
||||
trainer_name = TYPE_EXPERT_TRAINERS[type_id][0]
|
||||
lose_text = TYPE_EXPERT_TRAINERS[type_id][1]
|
||||
if pbTrainerBattle(trainer_class, trainer_name, lose_text, false, 0, false)
|
||||
pbSet(VAR_TYPE_EXPERTS_BEATEN,pbGet(VAR_TYPE_EXPERTS_BEATEN)+1)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("Woah! You beat me at my own specialty! ")
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("It's a true testament to your mastery of Pokémon typings!")
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("Well then, I'll keep my word. You can have this very special outfit!")
|
||||
for clothes in TYPE_EXPERT_REWARDS[type_id]
|
||||
obtainClothes(clothes)
|
||||
end
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("When you wear it, you can sometimes find #{type.real_name}-type related items after battles!")
|
||||
show_nb_type_experts_defeated()
|
||||
PokemonSelection.restore
|
||||
$game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]=false
|
||||
$game_switches[SWITCH_DONT_RANDOMIZE]=false
|
||||
pbSet(VAR_CURRENT_GYM_TYPE, -1)
|
||||
return true
|
||||
end
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage("Remember, you're only allowed to use #{type.real_name}-type Pokémon!")
|
||||
end
|
||||
end
|
||||
PokemonSelection.restore
|
||||
$game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]=false
|
||||
$game_switches[SWITCH_DONT_RANDOMIZE]=false
|
||||
pbSet(VAR_CURRENT_GYM_TYPE, -1)
|
||||
return false
|
||||
end
|
||||
|
||||
def show_nb_type_experts_defeated()
|
||||
pbMEPlay("Register phone")
|
||||
pbCallBub(3)
|
||||
Kernel.pbMessage("Type experts defeated: #{pbGet(VAR_TYPE_EXPERTS_BEATEN)}/#{TOTAL_NB_TYPE_EXPERTS}")
|
||||
end
|
||||
@@ -53,14 +53,14 @@ class CharacterSelectionMenuView
|
||||
@sprites["select"].y = OPTIONS_START_Y
|
||||
@sprites["select"].visible = true
|
||||
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"] = AnimatedSprite.new(UI_FOLDER + "left_arrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = ARROW_LEFT_X_POSITION
|
||||
@sprites["leftarrow"].y = 0
|
||||
@sprites["leftarrow"].visible = false
|
||||
@sprites["leftarrow"].play
|
||||
|
||||
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"] = AnimatedSprite.new(UI_FOLDER + "right_arrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = ARROW_RIGHT_X_POSITION
|
||||
@sprites["rightarrow"].y = 0
|
||||
@sprites["rightarrow"].visible = false
|
||||
|
||||
Reference in New Issue
Block a user