From 5343792f8ca355f62aae41b76ba355117db6456f Mon Sep 17 00:00:00 2001 From: chardub Date: Fri, 14 Mar 2025 11:06:44 -0400 Subject: [PATCH] Fixes swapping hats visual glitch when only wearing one hat --- .../UI/clothesShop/ClothesMartAdapter.rb | 5 + .../UI/clothesShop/ClothesShopPresenter.rb | 16 +- .../ClothesShopPresenter_HatsMenu.rb | 2 + .../050_Outfits/UI/clothesShop/HatShopView.rb | 21 +- .../UI/clothesShop/HatsMartAdapter.rb | 8 + Data/System.rxdata | Bin 31696 -> 31696 bytes Data/pokedex/dex.json | 14814 ++-------------- Data/sprites/sprites_rate_limit.log | 3 +- Data/sprites/updated_spritesheets_cache | 128 + 9 files changed, 1253 insertions(+), 13744 deletions(-) diff --git a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesMartAdapter.rb b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesMartAdapter.rb index 9e71f4fa5..60f39bb2d 100644 --- a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesMartAdapter.rb +++ b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesMartAdapter.rb @@ -81,6 +81,11 @@ class ClothesMartAdapter < OutfitsMartAdapter $Trainer.clothes != @worn_clothes end + def putOnSelectedOutfit() + putOnClothes($Trainer.clothes) + @worn_clothes = $Trainer.clothes + end + def putOnOutfit(item) putOnClothes(item.id) if item @worn_clothes = item.id if item diff --git a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter.rb b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter.rb index 4c0ef6efe..d3faafdce 100644 --- a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter.rb +++ b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter.rb @@ -48,7 +48,7 @@ class ClothesShopPresenter < PokemonMartScreen end - # returns if should stay in the menu + # returns true if should stay in the menu def playerClothesActionsMenu(item) cmd_wear = "Wear" cmd_dye = "Dye Kit" @@ -59,9 +59,9 @@ class ClothesShopPresenter < PokemonMartScreen choice = pbMessage("What would you like to do?", options, -1) if options[choice] == cmd_wear - putOnClothes(item) + putOnClothes(item,false) $Trainer.clothes_color = @adapter.get_dye_color(item.id) - return false + return true elsif options[choice] == cmd_dye dyeClothes() end @@ -72,8 +72,8 @@ class ClothesShopPresenter < PokemonMartScreen putOnClothes(item) end - def quitMenuPrompt(item) - return true if !@adapter.is_a?(HatsMartAdapter) + def quitMenuPrompt() + return true if !(@adapter.is_a?(HatsMartAdapter) || @adapter.is_a?(ClothesMartAdapter)) boolean_changes_detected = @adapter.player_changed_clothes? return true if !boolean_changes_detected pbPlayCancelSE @@ -81,10 +81,10 @@ class ClothesShopPresenter < PokemonMartScreen cmd_discard = "Discard changes" cmd_cancel = "Cancel" options = [cmd_confirm,cmd_discard,cmd_cancel] - choice = pbMessage("You have unsaved changes!",options,2) + choice = pbMessage("You have unsaved changes!",options,3) case options[choice] when cmd_confirm - confirmPutClothes(item) + @adapter.putOnSelectedOutfit pbPlayDecisionSE return true when cmd_discard @@ -104,7 +104,7 @@ class ClothesShopPresenter < PokemonMartScreen #break if !item if !item break if @adapter.isShop? - quit_menu_choice = quitMenuPrompt(item) + quit_menu_choice = quitMenuPrompt() break if quit_menu_choice item = @scene.pbChooseBuyItem end diff --git a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter_HatsMenu.rb b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter_HatsMenu.rb index 6ef657f5e..0e3d188f2 100644 --- a/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter_HatsMenu.rb +++ b/Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopPresenter_HatsMenu.rb @@ -125,6 +125,8 @@ class ClothesShopPresenter < PokemonMartScreen end def playerHatActionsMenu(item) + echoln caller + cmd_confirm = "Confirm" cmd_remove = "Remove hat" cmd_cancel = "Cancel" diff --git a/Data/Scripts/050_Outfits/UI/clothesShop/HatShopView.rb b/Data/Scripts/050_Outfits/UI/clothesShop/HatShopView.rb index 881e10c2a..07979c5f3 100644 --- a/Data/Scripts/050_Outfits/UI/clothesShop/HatShopView.rb +++ b/Data/Scripts/050_Outfits/UI/clothesShop/HatShopView.rb @@ -38,15 +38,28 @@ class HatShopView < ClothesShopView return @stock[itemwindow.index] end - def displayLayerIcons(selected_item=nil) + def handleHatlessLayerIcons(selected_item) + other_hat = @adapter.is_secondary_hat ? $Trainer.hat : $Trainer.hat2 if !selected_item.is_a?(Hat) if @adapter.is_secondary_hat @sprites["wornHat_layer2"].bitmap=nil else @sprites["wornHat_layer1"].bitmap=nil end - return end + if !other_hat.is_a?(Hat) + if @adapter.is_secondary_hat + @sprites["wornHat_layer1"].bitmap=nil + else + @sprites["wornHat_layer2"].bitmap=nil + end + end + + end + def displayLayerIcons(selected_item=nil) + echoln selected_item + handleHatlessLayerIcons(selected_item) + hat1Filename = getOverworldHatFilename($Trainer.hat) hat2Filename = getOverworldHatFilename($Trainer.hat2) @@ -65,6 +78,10 @@ class HatShopView < ClothesShopView @sprites["wornHat_layer1"].src_rect.set(0, 0, frame_width, frame_height) if hatBitmapWrapper @sprites["wornHat_layer2"].src_rect.set(0, 0, frame_width, frame_height) if hat2BitmapWrapper + + echoln hatBitmapWrapper + echoln hat2BitmapWrapper + end diff --git a/Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb b/Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb index 87d7b4676..d778f29c9 100644 --- a/Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb +++ b/Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb @@ -157,6 +157,14 @@ class HatsMartAdapter < OutfitsMartAdapter $Trainer.hat != @worn_clothes || $Trainer.hat2 != @worn_clothes2 end + def putOnSelectedOutfit() + putOnHat($Trainer.hat,true,false) if $Trainer.hat + putOnHat($Trainer.hat2,true,true) if $Trainer.hat2 + + @worn_clothes = $Trainer.hat + @worn_clothes2 = $Trainer.hat2 + end + def putOnOutfit(item) return unless item.is_a?(Outfit) putOnHat(item.id,false,@is_secondary_hat) diff --git a/Data/System.rxdata b/Data/System.rxdata index 35f7c6fb6f75a9d62581d2c6c5abd7b04dac6fba..a31fe9436c7e6f7a6b32dcb889f4cb2fb3a66e01 100644 GIT binary patch delta 31 ncmccco$