3 Commits

Author SHA1 Message Date
chardub
46f0c898e0 increments version number 2025-03-17 10:41:09 -04:00
chardub
65d0bcc7c9 Handles exception when failing to create savefil backups 2025-03-17 10:37:22 -04:00
chardub
455bebbd1b Improves npc appearance generation algorithm 2025-03-17 10:36:36 -04:00
17 changed files with 42 additions and 24 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,8 +5,8 @@
#==============================================================================# #==============================================================================#
module Settings module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format. # The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '6.5' GAME_VERSION = '6.5.1'
GAME_VERSION_NUMBER = "6.5.0" GAME_VERSION_NUMBER = "6.5.1"
LATEST_GAME_RELEASE = "6.5" LATEST_GAME_RELEASE = "6.5"
POKERADAR_LIGHT_ANIMATION_RED_ID = 17 POKERADAR_LIGHT_ANIMATION_RED_ID = 17

View File

@@ -87,6 +87,7 @@ end
def shiftHairColor(incr) def shiftHairColor(incr)
$Trainer.hair_color = 0 if !$Trainer.hair_color $Trainer.hair_color = 0 if !$Trainer.hair_color
$Trainer.hair_color += incr $Trainer.hair_color += incr
echoln "Hair color: #{$Trainer.hair_color}"
refreshPlayerOutfit() refreshPlayerOutfit()
end end
@@ -248,20 +249,6 @@ def generateNPCClothedBitmapStatic(trainerAppearance,action = "walk")
hatBitmapWrapper = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename) hatBitmapWrapper = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename)
hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename) hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)
if hatBitmapWrapper
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
hat_frame_bitmap = duplicateHatForFrames(hatBitmapWrapper.bitmap, frame_count)
frame_width = baseSprite.bitmap.width / frame_count # Calculate frame width
frame_count.times do |i|
# Calculate offset for each frame
frame_offset = [i * frame_width, 0]
# Adjust Y offset if frame index is odd
frame_offset[1] -= 2 if i.odd?
positionHat(baseBitmap, hat_frame_bitmap, frame_offset, i, frame_width)
end
end
if hat2BitmapWrapper if hat2BitmapWrapper
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
@@ -278,6 +265,21 @@ def generateNPCClothedBitmapStatic(trainerAppearance,action = "walk")
end end
end end
if hatBitmapWrapper
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
hat_frame_bitmap = duplicateHatForFrames(hatBitmapWrapper.bitmap, frame_count)
frame_width = baseSprite.bitmap.width / frame_count # Calculate frame width
frame_count.times do |i|
# Calculate offset for each frame
frame_offset = [i * frame_width, 0]
# Adjust Y offset if frame index is odd
frame_offset[1] -= 2 if i.odd?
positionHat(baseBitmap, hat_frame_bitmap, frame_offset, i, frame_width)
end
end
return baseBitmap return baseBitmap
end end

View File

@@ -315,13 +315,16 @@ def randomizePlayerOutfitUnlocked()
end end
def convert_letter_to_number(letter, max_number = nil) def convert_letter_to_number(letter, max_number = nil)
return 0 if !letter return 0 unless letter
return letter.ord if !max_number base_value = (letter.ord * 31) & 0xFFFFFFFF # Use a prime multiplier to spread values
return letter.ord % max_number return base_value unless max_number
return base_value % max_number
end end
def generate_appearance_from_name(name) def generate_appearance_from_name(name)
name_seed_length = 11 name_seed_length = 13
max_dye_color=360
seed = name[0, name_seed_length] # Truncate if longer than 8 seed = name[0, name_seed_length] # Truncate if longer than 8
seed += seed[0, name_seed_length - seed.length] while seed.length < name_seed_length # Repeat first characters if shorter seed += seed[0, name_seed_length - seed.length] while seed.length < name_seed_length # Repeat first characters if shorter
@@ -333,17 +336,24 @@ def generate_appearance_from_name(name)
hairstyles_list = $PokemonGlobal.hairstyles_data.keys hairstyles_list = $PokemonGlobal.hairstyles_data.keys
hat = hats_list[convert_letter_to_number(seed[0],hats_list.length)] hat = hats_list[convert_letter_to_number(seed[0],hats_list.length)]
hat_color = convert_letter_to_number(seed[1],200) hat_color = convert_letter_to_number(seed[1],max_dye_color)
hat2_color = convert_letter_to_number(seed[2],max_dye_color)
hat_color = 0 if convert_letter_to_number(seed[2]) % 2 == 0 #1/2 chance of no dyed hat hat_color = 0 if convert_letter_to_number(seed[2]) % 2 == 0 #1/2 chance of no dyed hat
hat2 = hats_list[convert_letter_to_number(seed[10],hats_list.length)]
hat2_color = 0 if convert_letter_to_number(seed[11]) % 2 == 0 #1/2 chance of no dyed ha
hat2 = "" if convert_letter_to_number(seed[12]) % 2 == 0 #1/2 chance of no 2nd hat
clothes = clothes_list[convert_letter_to_number(seed[3],clothes_list.length)] clothes = clothes_list[convert_letter_to_number(seed[3],clothes_list.length)]
clothes_color = convert_letter_to_number(seed[4],200) clothes_color = convert_letter_to_number(seed[4],max_dye_color)
clothes_color = 0 if convert_letter_to_number(seed[5]) % 2 == 0 #1/2 chance of no dyed clothes clothes_color = 0 if convert_letter_to_number(seed[5]) % 2 == 0 #1/2 chance of no dyed clothes
hair_base = hairstyles_list[convert_letter_to_number(seed[6],hairstyles_list.length)] hair_base = hairstyles_list[convert_letter_to_number(seed[6],hairstyles_list.length)]
hair_number = [1,2,3,4][convert_letter_to_number(seed[7],3)] hair_number = [1,2,3,4][convert_letter_to_number(seed[7],3)]
echoln "hair_number: #{hair_number}"
hair=getFullHairId(hair_base,hair_number) hair=getFullHairId(hair_base,hair_number)
hair_color = convert_letter_to_number(seed[8],200) hair_color = convert_letter_to_number(seed[8],max_dye_color)
hair_color = 0 if convert_letter_to_number(seed[9]) % 2 == 0 #1/2 chance of no dyed hair hair_color = 0 if convert_letter_to_number(seed[9]) % 2 == 0 #1/2 chance of no dyed hair
echoln hair_color echoln hair_color
@@ -352,7 +362,8 @@ def generate_appearance_from_name(name)
skin_tone = [1,2,3,4,5,6][convert_letter_to_number(seed[10],5)] skin_tone = [1,2,3,4,5,6][convert_letter_to_number(seed[10],5)]
return TrainerAppearance.new(skin_tone,hat,clothes, hair, return TrainerAppearance.new(skin_tone,hat,clothes, hair,
hair_color, clothes_color, hat_color) hair_color, clothes_color, hat_color,
hat2,hat2_color)
end end

View File

@@ -810,6 +810,7 @@ module Game
end end
def self.backup_savefile(save_path, slot) def self.backup_savefile(save_path, slot)
begin
backup_dir = File.join(File.dirname(save_path), "backups") backup_dir = File.join(File.dirname(save_path), "backups")
Dir.mkdir(backup_dir) if !Dir.exist?(backup_dir) Dir.mkdir(backup_dir) if !Dir.exist?(backup_dir)
@@ -838,6 +839,10 @@ module Game
excess_backups.each { |old_backup| File.delete(old_backup) } excess_backups.each { |old_backup| File.delete(old_backup) }
end end
end end
rescue => e
echoln ("There was an error while creating a backup savefile.")
echoln("Error: #{e.message}")
end
end end
# Saves the game. Returns whether the operation was successful. # Saves the game. Returns whether the operation was successful.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.