More characters customization

This commit is contained in:
chardub
2025-04-27 12:17:35 -04:00
parent 4a19fbc754
commit 6536fcda77
10 changed files with 333 additions and 55 deletions

View File

@@ -149,7 +149,6 @@ class TilemapRenderer
# Try to load expanded autotile from cache first
cached_path = File.join("Graphics", "Autotiles/ExpandedAutotiles", "#{filename}.png")
if FileTest.exist?(cached_path)
echoln "Loading cached expanded autotile for #{filename}"
bitmap = RPG::Cache.load_bitmap(EXPANDED_AUTOTILES_FOLDER, filename)
duration = AUTOTILE_FRAME_DURATION

View File

@@ -16,7 +16,8 @@ class UI::TrainerCardVisuals < UI::BaseVisuals
# Trainer card
add_icon_sprite(:card, 0, 0, graphics_folder + gendered_filename(_INTL("trainer_card")))
# Overrides sprite (coordinates are the bottom middle of the sprite)
add_icon_sprite(:player, 400, 240, GameData::TrainerType.player_front_sprite_filename($player.trainer_type))
@sprites[:player] = IconSprite.new(400, 240, @viewport)
@sprites[:player].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
if !@sprites[:player].bitmap
raise _INTL("No trainer front sprite exists for the player character, expected a file at {1}.",
"Graphics/Trainers/" + $player.trainer_type.to_s + ".png")

View File

@@ -199,7 +199,7 @@ class Window_PokemonMart < Window_DrawableCommand
@stock = stock
@adapter = adapter
super(x, y, width, height, viewport)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/martSel")
@selarrow = AnimatedBitmap.new("Graphics/UI/Mart/martSel")
@baseColor = Color.new(88, 88, 80)
@shadowColor = Color.new(168, 184, 184)
self.windowskin = nil

View File

@@ -0,0 +1,20 @@
# frozen_string_literal: true
class Game_Map
alias pokemonEssentials_GameMap_setup setup
def scroll_direction
return 0 if @scroll_distance_x == 0 && @scroll_distance_y == 0
if @scroll_distance_x < 0
return DIRECTION_LEFT
elsif @scroll_distance_x > 0
return DIRECTION_RIGHT
elsif @scroll_distance_y < 0
return DIRECTION_UP
elsif @scroll_distance_y > 0
return DIRECTION_DOWN
end
return 0
end
end

View File

@@ -81,10 +81,6 @@ 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

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
class IconSprite
def setBitmapDirectly(bitmap)
oldrc = self.src_rect
clearBitmaps()
@name = ""
return if bitmap == nil
@_iconbitmap = bitmap
# for compatibility
#
self.bitmap = @_iconbitmap ? @_iconbitmap.bitmap : nil
self.src_rect = oldrc
end
end

View File

@@ -0,0 +1,33 @@
# frozen_string_literal: true
module RPG
module Cache
def self.load_bitmap_path(path, hue = 0)
cached = true
ret = fromCache(path)
if !ret
if path == ""
ret = BitmapWrapper.new(32, 32)
else
ret = BitmapWrapper.new(path)
end
@cache[path] = ret
cached = false
end
if hue == 0
ret.addRef if cached
return ret
end
key = [path, hue]
ret2 = fromCache(key)
if ret2
ret2.addRef
else
ret2 = ret.copy
ret2.hue_change(hue)
@cache[key] = ret2
end
return ret2
end
end
end

View File

@@ -4,12 +4,13 @@ MenuHandlers.add(:pause_menu, :outfit, {
"condition" => proc { $player.can_change_outfit },
"effect" => proc { |menu|
pbFadeOutIn do
#pbCommonEvent(COMMON_EVENT_OUTFIT)
#todo give Favorite outfit (used to be done through common event)
changeOutfit()
menu.silent_end_screen
end
changeOutfit()
# pbFadeOutIn do
# #pbCommonEvent(COMMON_EVENT_OUTFIT)
# #todo give Favorite outfit (used to be done through common event)
# changeOutfit()
# menu.silent_end_screen
# end
next false

View File

@@ -0,0 +1,221 @@
PluginManager.register({
:name => "Carmaniac's Speech Bubbles",
:version => "1.1",
:credits => ["Carmaniac","Avery","Boonzeet"],
:link => "https://reliccastle.com/resources/461/"
})
#-------------------------------------------------------------------------------
# Carmaniac's Speech Bubbles for v18
# Updated by Avery
#-------------------------------------------------------------------------------
# To use, call pbCallBub(type, eventID)
#
# Where type is either 1 or 2:
# 1 - floating bubble
# 2 - speech bubble with arrow
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Class modifiers
#-------------------------------------------------------------------------------
class Game_Temp
attr_accessor :speechbubble_bubble
attr_accessor :speechbubble_vp
attr_accessor :speechbubble_arrow
attr_accessor :speechbubble_outofrange
attr_accessor :speechbubble_talking
attr_accessor :speechbubble_alwaysDown
attr_accessor :speechbubble_alwaysUp
end
module MessageConfig
BUBBLETEXTBASE = Color.new(22,22,22)
BUBBLETEXTSHADOW = Color.new(166,160,151)
WindowOpacity = 255
end
#-------------------------------------------------------------------------------
# Function modifiers
#-------------------------------------------------------------------------------
class Window_AdvancedTextPokemon
def text=(value)
if value != nil && value != "" && $game_temp.speechbubble_bubble && $game_temp.speechbubble_bubble > 0
if $game_temp.speechbubble_bubble == 1
$game_temp.speechbubble_bubble = 0
resizeToFit2(value,400,100)
@x = $game_map.events[$game_temp.speechbubble_talking].screen_x
@y = $game_map.events[$game_temp.speechbubble_talking].screen_y - (32 + @height)
if @y>(Graphics.height-@height-2)
@y = (Graphics.height-@height)
elsif @y<2
@y=2
end
if @x>(Graphics.width-@width-2)
@x = ($game_map.events[$game_temp.speechbubble_talking].screen_x-@width)
elsif @x<2
@x=2
end
elsif $game_temp.speechbubble_bubble == 3
@x=$game_player.x+32
@y=$game_player.y+36
else
$game_temp.speechbubble_bubble = 0
end
end
setText(value)
end
end
def pbRepositionMessageWindow(msgwindow, linecount=2)
msgwindow.height=32*linecount+msgwindow.borderY
msgwindow.y=(Graphics.height)-(msgwindow.height)
if $game_temp && $game_temp.in_battle && !$scene.respond_to?("update_basic")
msgwindow.y=0
elsif $game_system && $game_system.respond_to?("message_position")
case $game_system.message_position
when 0 # up
msgwindow.y=0
when 1 # middle
msgwindow.y=(Graphics.height/2)-(msgwindow.height/2)
when 2
if $game_temp.speechbubble_bubble == 1 || $game_temp.speechbubble_bubble == 3
msgwindow.setSkin("Graphics/windowskins/frlgtextskin")
msgwindow.height = 100
msgwindow.width = 400
elsif $game_temp.speechbubble_bubble==2
msgwindow.setSkin("Graphics/windowskins/frlgtextskin")
msgwindow.height = 102
msgwindow.width = Graphics.width
if ($game_player.direction==8 && !$game_temp.speechbubble_alwaysDown) || $game_temp.speechbubble_alwaysUp
$game_temp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, 280)
msgwindow.y = 6
else
$game_temp.speechbubble_vp = Viewport.new(0, 6 + msgwindow.height, Graphics.width, 280)
msgwindow.y = (Graphics.height - msgwindow.height) - 6
if $game_temp.speechbubble_outofrange==true
msgwindow.y = 6
end
end
else
msgwindow.height = 102
msgwindow.y = Graphics.height - msgwindow.height - 6
end
end
end
if $game_system && $game_system.respond_to?("message_frame")
if $game_system.message_frame != 0
msgwindow.opacity = 0
end
end
if $game_message
case $game_message.background
when 1 # dim
msgwindow.opacity=0
when 2 # transparent
msgwindow.opacity=0
end
end
end
SPEECH_BUBBLE_FOLDER_PATH = "Graphics/UI/SpeechBubbles/"
def pbCreateMessageWindow(viewport=nil,skin=nil)
arrow = nil
if $game_temp.speechbubble_bubble==2 && $game_map.events[$game_temp.speechbubble_talking] != nil # Message window set to floating bubble.
if ($game_player.direction==8 && !$game_temp.speechbubble_alwaysDown) || $game_temp.speechbubble_alwaysUp# Player facing up, message window top.
$game_temp.speechbubble_vp = Viewport.new(0, 104, Graphics.width, 280)
$game_temp.speechbubble_vp.z = 999999
arrow = Sprite.new($game_temp.speechbubble_vp)
arrow.x = $game_map.events[$game_temp.speechbubble_talking].screen_x - Graphics.width
arrow.y = ($game_map.events[$game_temp.speechbubble_talking].screen_y - Graphics.height) - 136
arrow.z = 999999
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow4")
arrow.zoom_x = 2
arrow.zoom_y = 2
if arrow.x<-230
arrow.x = $game_map.events[$game_temp.speechbubble_talking].screen_x
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow3")
end
else # Player facing left, down, right, message window bottom.
$game_temp.speechbubble_vp = Viewport.new(0, 0, Graphics.width, 280)
$game_temp.speechbubble_vp.z = 999999
arrow = Sprite.new($game_temp.speechbubble_vp)
arrow.x = $game_map.events[$game_temp.speechbubble_talking].screen_x
arrow.y = $game_map.events[$game_temp.speechbubble_talking].screen_y
arrow.z = 999999
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow1")
if arrow.y>=Graphics.height-120 # Change arrow direction.
$game_temp.speechbubble_outofrange=true
$game_temp.speechbubble_vp.rect.y+=104
arrow.x = $game_map.events[$game_temp.speechbubble_talking].screen_x - Graphics.width
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow4")
arrow.y = ($game_map.events[$game_temp.speechbubble_talking].screen_y - Graphics.height) - 136
if arrow.x<-250
arrow.x = $game_map.events[$game_temp.speechbubble_talking].screen_x
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow3")
end
if arrow.x>=256
arrow.x-=15# = $game_map.events[$game_temp.speechbubble_talking].screen_x-Graphics.width
arrow.bitmap = RPG::Cache.load_bitmap_path(SPEECH_BUBBLE_FOLDER_PATH + "Arrow3")
end
else
$game_temp.speechbubble_outofrange=false
end
arrow.zoom_x = 2
arrow.zoom_y = 2
end
end
$game_temp.speechbubble_arrow = arrow
msgwindow=Window_AdvancedTextPokemon.new("")
if !viewport
msgwindow.z=99999
else
msgwindow.viewport=viewport
end
msgwindow.visible=true
msgwindow.letterbyletter=true
msgwindow.back_opacity=MessageConfig::WindowOpacity
pbBottomLeftLines(msgwindow,2)
$game_temp.message_window_showing=true if $game_temp
$game_message.visible=true if $game_message
skin=MessageConfig.pbGetSpeechFrame() if !skin
msgwindow.setSkin(skin)
return msgwindow
end
def pbDisposeMessageWindow(msgwindow)
$game_temp.message_window_showing=false if $game_temp
$game_message.visible=false if $game_message
msgwindow.dispose
$game_temp.speechbubble_arrow.dispose if $game_temp.speechbubble_arrow
$game_temp.speechbubble_vp.dispose if $game_temp.speechbubble_vp
$game_temp.speechbubble_bubble=nil
end
def pbCallBubUp(status=0,value=0)
pbCallBub(status,value,false,true)
end
def pbCallBubDown(status=0,value=0)
pbCallBub(status,value,true,false)
end
#always_down, always_up is not ideal but used everywhere in game so too late to change
def pbCallBub(status=0,value=0,always_down=false, always_up=false)
begin
$game_temp.speechbubble_talking=get_character(value).id
$game_temp.speechbubble_bubble=status
$game_temp.speechbubble_alwaysDown=always_down
$game_temp.speechbubble_alwaysUp=always_up
rescue
return #Let's not crash the game if error
end
end

View File

@@ -3,33 +3,27 @@
# Necessary dor setting the various events within the pokemart map, uses the numbers as wondertrade
def get_city_numerical_id(city_sym)
current_city_numerical = {
:PEWTER => 1,
:CERULEAN => 2,
:VERMILLION => 3,
:LAVENDER => 4,
:CELADON => 5,
:FUCHSIA => 6,
:SAFFRON => 7,
:CINNABAR => 8,
:LEAGUE => 9,
:VIOLET => 10,
:AZALEA => 11,
:GOLDENROD => 12,
:ECRUTEAK => 13,
:MAHOGANY => 14,
:BLACKTHORN => 15,
:OLIVINE => 16,
:CIANWOOD => 17,
:KNOTISLAND => 18,
:BOONISLAND => 19,
:KINISLAND => 20,
:CHRONOISLAND => 21,
:CRIMSON => 22,
:LITTLEROOT => 1,
:OLDALE => 2,
:PETALBURG => 3,
:RUSTBORO => 4,
:DEWFORD => 5,
:SLATEPORT => 6,
:MAUVILLE => 7,
:VERDANTURF => 8,
:FALLARBOR => 9,
:LAVARIDGE => 10,
:FORTREE => 11,
:LILYCOVE => 12,
:MOSSDEEP => 13,
:SOOTOPOLIS => 14,
:PACIFIDLOG => 15,
:EVERGRANDE => 16
}
return current_city_numerical[city_sym]
end
POKEMART_MAP_ID = 357
POKEMART_MAP_ID = 18
POKEMART_DOOR_POS = [12, 12]
# city -> Symbol
def enter_pokemart(city)
@@ -48,27 +42,26 @@ end
def exit_pokemart()
pokemart_entrances = {
:PEWTER => [380, 43, 24],
:CERULEAN => [1, 24, 22],
:VERMILLION => [19, 32, 13],
:LAVENDER => [50, 20, 23],
:CELADON => [95, 18, 15], # not a real pokemart
:FUCHSIA => [472, 7, 17],
:SAFFRON => [108, 53, 24],
:CINNABAR => [98, 30, 30],
:CRIMSON => [167, 21, 36],
:GOLDENROD => [237, 36, 33], # not a real pokemart
:AZALEA => [278, 34, 17],
:AZALEA_FLOODED => [338, 34, 17],
:VIOLET => [230, 20, 31],
:BLACKTHORN => [329, 16, 36],
:MAHOGANY => [631, 19, 19], # not a real pokemart
:ECRUTEAK => [359, 46, 38],
:OLIVINE => [138, 33, 23],
:CIANWOOD => [709.8, 46],
:LITTLEROOT => [1, 0, 0],
:OLDALE => [1, 0, 0],
:VERMILLION => [1, 0, 0],
:PETALBURG => [7, 32, 19],
:RUSTBORO => [1, 0, 0],
:DEWFORD => [1, 0, 0],
:SLATEPORT => [1, 0, 0],
:MAUVILLE => [1, 0, 0],
:VERDANTURF => [1, 0, 0],
:FALLARBOR => [1, 0, 0],
:LAVARIDGE => [1, 0, 0],
:FORTREE => [1, 0, 0],
:LILYCOVE => [1, 0, 0],
:MOSSDEEP => [1, 0, 0],
:SOOTOPOLIS => [1, 0, 0],
:PACIFIDLOG => [1, 0, 0],
:EVERGRANDE => [1, 0, 0],
}
current_city = pbGet(VAR_CURRENT_MART)
current_city = :PEWTER if !current_city.is_a?(Symbol)
current_city = :PETALBURG if !current_city.is_a?(Symbol)
entrance_map = pokemart_entrances[current_city][0]
entrance_x = pokemart_entrances[current_city][1]