Secondary Hat (WIP)

This commit is contained in:
chardub
2025-02-18 23:01:49 -05:00
parent 1c665bf636
commit 76ecb4e2e0
15 changed files with 247 additions and 219 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,7 +3,7 @@ class Sprite_Wearable < RPG::Sprite
attr_accessor :action attr_accessor :action
attr_accessor :sprite attr_accessor :sprite
def initialize(player_sprite, filename, action, viewport) def initialize(player_sprite, filename, action, viewport, relative_z=0)
@player_sprite = player_sprite @player_sprite = player_sprite
@viewport = viewport @viewport = viewport
@sprite = Sprite.new(@viewport) @sprite = Sprite.new(@viewport)
@@ -15,7 +15,7 @@ class Sprite_Wearable < RPG::Sprite
@frameWidth = 80 #@sprite.width @frameWidth = 80 #@sprite.width
@frameHeight = 80 #@sprite.height / 4 @frameHeight = 80 #@sprite.height / 4
@sprite.z = 0 @sprite.z = 0
@relative_z=0 #relative to player @relative_z=relative_z #relative to player
echoln(_INTL("init had at z = {1}, player sprite at {2}",@sprite.z,@player_sprite.z)) echoln(_INTL("init had at z = {1}, player sprite at {2}",@sprite.z,@player_sprite.z))
#Unused position offset #Unused position offset

View File

@@ -1,192 +1,8 @@
class Sprite_Hat < Sprite_Wearable class Sprite_Hat < Sprite_Wearable
def initialize(player_sprite, filename, action, viewport) def initialize(player_sprite, filename, action, viewport, relative_z=2)
super super
@relative_z = 2 @relative_z = relative_z
#@sprite.z = @player_sprite.z + 2 #@sprite.z = @player_sprite.z + 2
end 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 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

@@ -3,12 +3,14 @@ class Sprite_Player < Sprite_Character
super super
@viewport = viewport @viewport = viewport
@outfit_bitmap = nil @outfit_bitmap = nil
@hat_bitmap = nil # @hat_bitmap = nil
# @hat2_bitmap = nil
hatFilename = "" hatFilename = ""
hairFilename = "" hairFilename = ""
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport) @hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport) @hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport)
@hat2 = Sprite_Hat.new(self, hatFilename, @character_name, @viewport,3)
@previous_skinTone = 0 @previous_skinTone = 0
@@ -30,12 +32,14 @@ class Sprite_Player < Sprite_Character
def applyDayNightTone def applyDayNightTone
super super
pbDayNightTint(@hat.sprite) if @hat && @hat.sprite.bitmap pbDayNightTint(@hat.sprite) if @hat && @hat.sprite.bitmap
pbDayNightTint(@hat2.sprite) if @hat2 && @hat2.sprite.bitmap
pbDayNightTint(@hair.sprite) if @hair && @hair.sprite.bitmap pbDayNightTint(@hair.sprite) if @hair && @hair.sprite.bitmap
end end
def opacity=(value) def opacity=(value)
super super
@hat.sprite.opacity= value if @hat && @hat.sprite.bitmap @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 @hair.sprite.opacity= value if @hair && @hair.sprite.bitmap
end end
@@ -46,6 +50,7 @@ class Sprite_Player < Sprite_Character
@previous_action = @character_name @previous_action = @character_name
@hair.animate(@character_name) if @hair @hair.animate(@character_name) if @hair
@hat.animate(@character_name) if @hat @hat.animate(@character_name) if @hat
@hat2.animate(@character_name) if @hat2
return @current_bitmap return @current_bitmap
end end
@@ -58,22 +63,28 @@ class Sprite_Player < Sprite_Character
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename) outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
hairFilename = getOverworldHairFilename($Trainer.hair) hairFilename = getOverworldHairFilename($Trainer.hair)
hatFilename = getOverworldHatFilename($Trainer.hat) hatFilename = getOverworldHatFilename($Trainer.hat)
hat2Filename = getOverworldHatFilename($Trainer.hat2)
hair_color_shift = $Trainer.hair_color hair_color_shift = $Trainer.hair_color
hat_color_shift = $Trainer.hat_color hat_color_shift = $Trainer.hat_color
hat2_color_shift = $Trainer.hat2_color
clothes_color_shift = $Trainer.clothes_color clothes_color_shift = $Trainer.clothes_color
hair_color_shift = 0 if !hair_color_shift hair_color_shift = 0 if !hair_color_shift
hat_color_shift = 0 if !hat_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 clothes_color_shift = 0 if !clothes_color_shift
@hair.update(@character_name, hairFilename, hair_color_shift) if @hair @hair.update(@character_name, hairFilename, hair_color_shift) if @hair
@hat.update(@character_name, hatFilename, hat_color_shift) if @hat @hat.update(@character_name, hatFilename, hat_color_shift) if @hat
@hat2.update(@character_name, hat2Filename, hat2_color_shift) if @hat2
if !pbResolveBitmap(outfitFilename) if !pbResolveBitmap(outfitFilename)
raise "No temp clothes graphics available" raise "No temp clothes graphics available"
end end
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename) #pbLoadOutfitBitmap(outfitFilename) if pbResolveBitmap(outfitFilename) outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename)
baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
@previous_action = @character_name @previous_action = @character_name
return baseBitmap return baseBitmap
@@ -89,6 +100,7 @@ class Sprite_Player < Sprite_Character
def dispose def dispose
super super
@hat.dispose if @hat @hat.dispose if @hat
@hat2.dispose if @hat2
@hair.dispose if @hair @hair.dispose if @hair
end end

View File

@@ -10,9 +10,13 @@ class Player < Trainer
attr_accessor :skin_tone attr_accessor :skin_tone
attr_accessor :clothes attr_accessor :clothes
attr_accessor :hat attr_accessor :hat
attr_accessor :hat2
attr_accessor :hair attr_accessor :hair
attr_accessor :hair_color attr_accessor :hair_color
attr_accessor :hat_color attr_accessor :hat_color
attr_accessor :hat2_color
attr_accessor :clothes_color attr_accessor :clothes_color
attr_accessor :unlocked_clothes attr_accessor :unlocked_clothes
attr_accessor :unlocked_hats attr_accessor :unlocked_hats
@@ -113,6 +117,14 @@ class Player < Trainer
refreshPlayerOutfit() refreshPlayerOutfit()
end end
def hat2=(value)
if value.is_a?(Symbol)
value = HATS[value].id
end
@hat2=value
refreshPlayerOutfit()
end
def hair=(value) def hair=(value)
if value.is_a?(Symbol) if value.is_a?(Symbol)
value = HAIRSTYLES[value].id value = HAIRSTYLES[value].id
@@ -268,6 +280,8 @@ class Player < Trainer
@character_ID = -1 @character_ID = -1
@outfit = 0 @outfit = 0
@hat = 0 @hat = 0
@hat2 = 0
@hair = 0 @hair = 0
@clothes = 0 @clothes = 0
@hair_color = 0 @hair_color = 0
@@ -295,6 +309,7 @@ class Player < Trainer
@dyed_clothes = {} @dyed_clothes = {}
@favorite_hat = nil @favorite_hat = nil
@favorite_hat2 =nil
@favorite_clothes = nil @favorite_clothes = nil
@card_background = Settings::DEFAULT_TRAINER_CARD_BG @card_background = Settings::DEFAULT_TRAINER_CARD_BG

View File

@@ -133,28 +133,34 @@ def getCurrentPokeball(allowEasterEgg=true)
end end
def generate_front_trainer_sprite_bitmap_from_appearance(trainerAppearance) def generate_front_trainer_sprite_bitmap_from_appearance(trainerAppearance)
echoln caller
echoln trainerAppearance.hat echoln trainerAppearance.hat
return generate_front_trainer_sprite_bitmap(false,nil,trainerAppearance.clothes,trainerAppearance.hat, return generate_front_trainer_sprite_bitmap(false,nil,trainerAppearance.clothes,trainerAppearance.hat,nil,
trainerAppearance.hair,trainerAppearance.skin_color, trainerAppearance.hair,trainerAppearance.skin_color,
trainerAppearance.hair_color,trainerAppearance.hat_color,trainerAppearance.clothes_color) trainerAppearance.hair_color,trainerAppearance.hat_color,trainerAppearance.clothes_color)
end end
def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil, clothes_id = nil, hat_id = nil, hair_id = nil, def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil,
skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil) clothes_id = nil, hat_id = nil, hat2_id=nil, hair_id = nil,
skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil,
hat2_color = nil)
echoln hat_id echoln hat_id
clothes_id = $Trainer.clothes if !clothes_id clothes_id = $Trainer.clothes if !clothes_id
hat_id = $Trainer.hat if !hat_id hat_id = $Trainer.hat if !hat_id
hat2_id = $Trainer.hat if !hat2_id
hair_id = $Trainer.hair if !hair_id hair_id = $Trainer.hair if !hair_id
skin_tone_id = $Trainer.skin_tone if !skin_tone_id skin_tone_id = $Trainer.skin_tone if !skin_tone_id
hair_color = $Trainer.hair_color if !hair_color hair_color = $Trainer.hair_color if !hair_color
hat_color = $Trainer.hat_color if !hat_color hat_color = $Trainer.hat_color if !hat_color
hat2_color = $Trainer.hat2_color if !hat2_color
clothes_color = $Trainer.clothes_color if !clothes_color clothes_color = $Trainer.clothes_color if !clothes_color
hairFilename = getTrainerSpriteHairFilename(hair_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER + "/hair_trainer_{1}", $Trainer.hair) hairFilename = getTrainerSpriteHairFilename(hair_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER + "/hair_trainer_{1}", $Trainer.hair)
outfitFilename = getTrainerSpriteOutfitFilename(clothes_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_CLOTHES_FOLDER + "/clothes_trainer_{1}", $Trainer.clothes) outfitFilename = getTrainerSpriteOutfitFilename(clothes_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_CLOTHES_FOLDER + "/clothes_trainer_{1}", $Trainer.clothes)
hatFilename = getTrainerSpriteHatFilename(hat_id) # _INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAT_FOLDER + "/hat_trainer_{1}", $Trainer.hat) hatFilename = getTrainerSpriteHatFilename(hat_id)
hat2Filename = getTrainerSpriteHatFilename(hat2_id)
pokeball = getCurrentPokeball(allowEasterEgg) if !pokeball pokeball = getCurrentPokeball(allowEasterEgg) if !pokeball
ballFilename = getTrainerSpriteBallFilename(pokeball) if pokeball ballFilename = getTrainerSpriteBallFilename(pokeball) if pokeball
@@ -162,10 +168,13 @@ def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil, cl
hair_color_shift = hair_color hair_color_shift = hair_color
hat_color_shift = hat_color hat_color_shift = hat_color
hat2_color_shift = hat2_color
clothes_color_shift = clothes_color clothes_color_shift = clothes_color
hair_color_shift = 0 if !hair_color_shift hair_color_shift = 0 if !hair_color_shift
hat_color_shift = 0 if !hat_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 clothes_color_shift = 0 if !clothes_color_shift
baseBitmap = AnimatedBitmap.new(baseFilePath) if pbResolveBitmap(baseFilePath) baseBitmap = AnimatedBitmap.new(baseFilePath) if pbResolveBitmap(baseFilePath)
@@ -181,7 +190,8 @@ def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil, cl
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename) #pb outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename) #pb
hairBitmapWrapper = AnimatedBitmap.new(hairFilename, hair_color_shift) if pbResolveBitmap(hairFilename) hairBitmapWrapper = AnimatedBitmap.new(hairFilename, hair_color_shift) if pbResolveBitmap(hairFilename)
hatBitmap = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename) #pbLoadOutfitBitmap(hatFilename) if pbResolveBitmap(hatFilename) hatBitmap = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename)
hat2Bitmap = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)
baseBitmap.bitmap = baseBitmap.bitmap.clone baseBitmap.bitmap = baseBitmap.bitmap.clone
if outfitBitmap if outfitBitmap
@@ -193,6 +203,7 @@ def generate_front_trainer_sprite_bitmap(allowEasterEgg=true, pokeball = nil, cl
end end
baseBitmap.bitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect) if hairBitmapWrapper baseBitmap.bitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect) if hairBitmapWrapper
baseBitmap.bitmap.blt(0, 0, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap baseBitmap.bitmap.blt(0, 0, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap
baseBitmap.bitmap.blt(0, 0, hat2Bitmap.bitmap, hat2Bitmap.bitmap.rect) if hat2Bitmap
baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap
return baseBitmap return baseBitmap

View File

@@ -1,5 +1,5 @@
class TrainerClothesPreview class TrainerClothesPreview
attr_writer :pokeball, :clothes, :hat, :hair, :skin_tone, :hair_color, :hat_color, :clothes_color attr_writer :pokeball, :clothes, :hat, :hat2, :hair, :skin_tone, :hair_color, :hat_color, :clothes_color
def initialize(x = 0, y = 0, windowed = true, pokeball = nil) def initialize(x = 0, y = 0, windowed = true, pokeball = nil)
@playerBitmap = nil @playerBitmap = nil
@@ -15,19 +15,22 @@ class TrainerClothesPreview
def resetOutfits() def resetOutfits()
@clothes = $Trainer.clothes @clothes = $Trainer.clothes
@hat = $Trainer.hat @hat = $Trainer.hat
@hat2 = $Trainer.hat2
@hair = $Trainer.hair @hair = $Trainer.hair
@skin_tone = $Trainer.skin_tone @skin_tone = $Trainer.skin_tone
@hair_color = $Trainer.hair_color @hair_color = $Trainer.hair_color
@hat_color = $Trainer.hat_color @hat_color = $Trainer.hat_color
@hat2_color = $Trainer.hat2_color
@clothes_color = $Trainer.clothes_color @clothes_color = $Trainer.clothes_color
end end
def show() def show()
@playerBitmap = generate_front_trainer_sprite_bitmap(false, @playerBitmap = generate_front_trainer_sprite_bitmap(false,
@pokeball, @pokeball,
@clothes, @hat, @hair, @clothes,
@hat,@hat2, @hair,
@skin_tone, @skin_tone,
@hair_color, @hat_color, @clothes_color) @hair_color, @hat_color, @clothes_color, @hat2_color)
initialize_preview() initialize_preview()
end end

View File

@@ -71,8 +71,38 @@ def hairShop(outfits_list = [],free=false, customMessage=nil)
genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage) genericOutfitsShopMenu(stock, :HAIR, true,!free,customMessage)
end end
SWAP_HAT_POSITIONS_CAPTION = "Switch hats position"
def set_hat_adapter_options(adapter)
slot1_hat = $Trainer.hat ? "Swap #{get_hat_by_id($Trainer.hat).name}" : "(Empty slot)"
slot2_hat = $Trainer.hat2 ? "Swap #{get_hat_by_id($Trainer.hat2).name}" : "(Empty slot)"
options = [slot1_hat,slot2_hat]
options << SWAP_HAT_POSITIONS_CAPTION if $Trainer.hat && $Trainer.hat2
options << "Cancel"
hat_options_choice = optionsMenu(options)
if options[hat_options_choice] == SWAP_HAT_POSITIONS_CAPTION
hat1 = $Trainer.hat
hat2 = $Trainer.hat2
$Trainer.hat = hat2
$Trainer.hat2 = hat1
pbSEPlay("GUI naming tab swap start")
return set_hat_adapter_options(adapter)
end
if hat_options_choice == options.length #cancel
return nil
end
is_secondary = hat_options_choice ==1
adapter.set_secondary_hat(is_secondary)
return adapter
end
def openSelectOutfitMenu(stock = [], itemType) def openSelectOutfitMenu(stock = [], itemType)
adapter = getAdapter(itemType, stock, false) adapter = getAdapter(itemType, stock, false)
if adapter.is_a?(HatsMartAdapter)
adapter = set_hat_adapter_options(adapter)
return if !adapter
end
view = ClothesShopView.new() view = ClothesShopView.new()
presenter = ClothesShopPresenter.new(view, stock, adapter) presenter = ClothesShopPresenter.new(view, stock, adapter)
presenter.pbBuyScreen presenter.pbBuyScreen

View File

@@ -2,23 +2,38 @@ class HatsMartAdapter < OutfitsMartAdapter
DEFAULT_NAME = "[unknown]" DEFAULT_NAME = "[unknown]"
DEFAULT_DESCRIPTION = "A headgear that trainers can wear." DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
def initialize(stock = nil, isShop = nil) def initialize(stock = nil, isShop = nil, isSecondaryHat = false)
super super(stock,isShop)
@is_secondary_hat = isSecondaryHat
end end
def toggleEvent(item) def toggleEvent(item)
if !@isShop if !@isShop
$Trainer.hat = nil if @is_secondary_hat
@worn_clothes = nil $Trainer.hat2 = nil
@worn_clothes = nil
if pbConfirmMessage(_INTL("Do you want to take off your hat?")) if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
$Trainer.hat2 = nil
@worn_clothes = nil
end
else
$Trainer.hat = nil $Trainer.hat = nil
@worn_clothes = nil @worn_clothes = nil
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
$Trainer.hat = nil
@worn_clothes = nil
end
end end
end end
end end
def set_secondary_hat(value)
@is_secondary_hat = value
end
def toggleText() def toggleText()
return return
# return if @isShop # return if @isShop
@@ -48,14 +63,27 @@ class HatsMartAdapter < OutfitsMartAdapter
end end
def updateTrainerPreview(item, previewWindow) def updateTrainerPreview(item, previewWindow)
if item.is_a?(Outfit) if @is_secondary_hat
previewWindow.hat = item.id if item.is_a?(Outfit)
$Trainer.hat = item.id# unless $Trainer.hat==nil previewWindow.hat2 = item.id
set_dye_color(item,previewWindow) $Trainer.hat2 = item.id# unless $Trainer.hat==nil
set_dye_color(item,previewWindow)
else
$Trainer.hat2=nil
previewWindow.hat2= nil
end
else else
$Trainer.hat=nil if item.is_a?(Outfit)
previewWindow.hat= nil previewWindow.hat = item.id
$Trainer.hat = item.id# unless $Trainer.hat==nil
set_dye_color(item,previewWindow)
else
$Trainer.hat=nil
previewWindow.hat= nil
end
end end
pbRefreshSceneMap pbRefreshSceneMap
previewWindow.updatePreview() previewWindow.updatePreview()
end end
@@ -91,7 +119,7 @@ class HatsMartAdapter < OutfitsMartAdapter
def addItem(item) def addItem(item)
return unless item.is_a?(Outfit) return unless item.is_a?(Outfit)
changed_clothes = obtainHat(item.id) changed_clothes = obtainHat(item.id,@is_secondary_hat)
if changed_clothes if changed_clothes
@worn_clothes = item.id @worn_clothes = item.id
end end
@@ -103,13 +131,23 @@ class HatsMartAdapter < OutfitsMartAdapter
def putOnOutfit(item) def putOnOutfit(item)
return unless item.is_a?(Outfit) return unless item.is_a?(Outfit)
putOnHat(item.id) if @is_secondary_hat
echoln "broder"
putOnSecondaryHat(item.id)
else
putOnHat(item.id)
end
@worn_clothes = item.id @worn_clothes = item.id
end end
def reset_player_clothes() def reset_player_clothes()
$Trainer.hat = @worn_clothes if @is_secondary_hat
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes] $Trainer.hat2 = @worn_clothes
$Trainer.hat2_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
else
$Trainer.hat = @worn_clothes
$Trainer.hat_color = $Trainer.dyed_hats[@worn_clothes] if $Trainer.dyed_hats && $Trainer.dyed_hats[@worn_clothes]
end
end end
def get_unlocked_items_list() def get_unlocked_items_list()

View File

@@ -6,7 +6,7 @@ def obtainNewClothes(outfit_id)
return obtainClothes(outfit_id) return obtainClothes(outfit_id)
end end
def obtainHat(outfit_id) def obtainHat(outfit_id,secondary=false)
echoln "obtained new hat: " + outfit_id echoln "obtained new hat: " + outfit_id
outfit = get_hat_by_id(outfit_id) outfit = get_hat_by_id(outfit_id)
if !outfit if !outfit
@@ -16,7 +16,8 @@ def obtainHat(outfit_id)
$Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id) $Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id)
obtainOutfitMessage(outfit) obtainOutfitMessage(outfit)
if pbConfirmMessage("Would you like to put it on right now?") if pbConfirmMessage("Would you like to put it on right now?")
putOnHat(outfit_id, false) putOnHat(outfit_id, false, ) if !secondary
putOnSecondaryHat(outfit_id, false, ) if secondary
return true return true
end end
return false return false
@@ -70,6 +71,7 @@ def putOnHat(outfit_id, silent = false)
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats $Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.last_worn_hat = $Trainer.hat $Trainer.last_worn_hat = $Trainer.hat
outfit = get_hat_by_id(outfit_id) outfit = get_hat_by_id(outfit_id)
$Trainer.hat = outfit_id $Trainer.hat = outfit_id
dye_color = $Trainer.dyed_hats[outfit_id] dye_color = $Trainer.dyed_hats[outfit_id]
@@ -83,6 +85,25 @@ def putOnHat(outfit_id, silent = false)
putOnOutfitMessage(outfit) if !silent putOnOutfitMessage(outfit) if !silent
end end
def putOnSecondaryHat(outfit_id, silent = false)
$Trainer.dyed_hats= {} if ! $Trainer.dyed_hats
$Trainer.last_worn_hat = $Trainer.hat2
outfit = get_hat_by_id(outfit_id)
$Trainer.hat2 = outfit_id
dye_color = $Trainer.dyed_hats[outfit_id]
if dye_color
$Trainer.hat2_color = dye_color
else
$Trainer.hat2_color = nil
end
$game_map.refreshPlayerOutfit()
putOnOutfitMessage(outfit) if !silent
end
def putOnHairFullId(full_outfit_id) def putOnHairFullId(full_outfit_id)
outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1] outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1]
outfit = get_hair_by_id(outfit_id) outfit = get_hair_by_id(outfit_id)
@@ -306,6 +327,7 @@ end
def randomizePlayerOutfit() def randomizePlayerOutfit()
$Trainer.hat = $PokemonGlobal.hats_data.keys.sample $Trainer.hat = $PokemonGlobal.hats_data.keys.sample
$Trainer.hat2 = $PokemonGlobal.hats_data.keys.sample
$Trainer.clothes = $PokemonGlobal.clothes_data.keys.sample $Trainer.clothes = $PokemonGlobal.clothes_data.keys.sample
$Trainer.hat_color = rand(2)==0 ? rand(255) : 0 $Trainer.hat_color = rand(2)==0 ? rand(255) : 0
$Trainer.clothes_color = rand(2)==0 ? rand(255) : 0 $Trainer.clothes_color = rand(2)==0 ? rand(255) : 0

Binary file not shown.

View File

@@ -1,2 +1,2 @@
1739897397 1739937414
1739897397 1739937415

View File

@@ -132,3 +132,84 @@ Graphics/CustomBattlers/spritesheets/spritesheets_base/105.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/105/105.png Graphics/CustomBattlers/spritesheets/spritesheets_custom/105/105.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/14.png Graphics/CustomBattlers/spritesheets/spritesheets_base/14.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/381/381b.png Graphics/CustomBattlers/spritesheets/spritesheets_custom/381/381b.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/123.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/430.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/430/430.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/296.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/296/296.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/3.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/218.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/218/218.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/244.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/473.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/287.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/148.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/148/148a.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/190.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/339/339.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/239.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/449.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/449/449.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/415.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/279.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/97/97.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/156.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/84.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/22.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/22/22.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/404.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/104.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/210.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/210/210.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/174.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/190/190.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/149.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/19.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/19/19.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/72.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/358.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/358/358.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/126.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/194.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/194/194.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/94.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/262.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/51.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/375.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/375/375.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/68.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/448.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/423.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/423/423.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/113.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/456.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/196.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/196/196.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/403.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/343.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/127.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/12.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/12/12.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/313.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/273.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/273/273.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/168.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/344.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/111.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/111/111.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/294.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/470.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/470/470.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/86.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/86/86a.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/107.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/242.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/242/242.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/278.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/28.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/28/28.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/436.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/6.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/6/6.png
Graphics/CustomBattlers/spritesheets/spritesheets_base/282.png
Graphics/CustomBattlers/spritesheets/spritesheets_custom/282/282.png