Right, this happens because the RPG hack hijacks mushroom, feather, fire flower, 1-up mushroom, and star sprites to tweak HPs and MPs in addition to add the power ups. When you are using custom shop blocks, you are not directly accessing those sprites, instead the blocks try to replicate their code.
To have the exact same behaviour of the power up items, you have two possibilities:
Another reasonable solution would be having shop blocks that restore your HP and MP only, in addition to the shop blocks that give you special power ups (cape and fire). This way you don't need to replicate the entire logic of the hijacked items: Feather and Fire Flower items gives Mario cape and fire respectively if he doesn't already have them, otherwise they restores half of the MP restore value; IMO this is quite a weird behaviour for a shop block. Instead you could rely on simpler shop block, for example, you could have one that restores HPs to the max by doing this
and a block for restoring MPs to the max
or combine the two to get both effects
Note that the defines !Health, !MaxHealth, !MP, and !MaxMP should be the same as those in "HP_Counter_Patch.asm". If you want to restore only a fixed amount of HPs/MPs the code becomes more complex because you would have to check that the added value doesn't exceed the max value or 999/99.
This is a design choice, but if you ask me, the ideal solution would be the alternative one, having shop blocks that have distinct and easily predictable outcomes (i.e., one block always give cape, one block always give fire, one block always restores HPs, etc.). Spawning item sprites (1) might also be reasonable. I don't like having shop blocks behaving like items (2), because their behaviour is context-dependent and might mislead the player (e.g., the player wants to restore HPs, but doesn't buy the mushroom because he think it's pointless since they are already big).
ROM Hack Manager - SMW Resources - SMW Toolbox
To have the exact same behaviour of the power up items, you have two possibilities:
- Have shop blocks than spawn the power up sprite: This would work like a normal question block, but it activates only if you have enough coins. Instead of getting the power up or the HP/MP restore directly when hitting the block, the blocks would spawn a sprite that you collect (and in your case should have the exact same behaviour as defined by the RPG patch).
- Implement the same exact logic present in the RPG patch in the shop blocks: This would make it so that when Mario hits the block, he gets the power up or HP/MP restore directly, without the risk of the item running away. The problem with this approach, is that you would have to keep the blocks and sprites aligned (e.g., amount of HP restored); if you change one, you need to change the other.
Another reasonable solution would be having shop blocks that restore your HP and MP only, in addition to the shop blocks that give you special power ups (cape and fire). This way you don't need to replicate the entire logic of the hijacked items: Feather and Fire Flower items gives Mario cape and fire respectively if he doesn't already have them, otherwise they restores half of the MP restore value; IMO this is quite a weird behaviour for a shop block. Instead you could rely on simpler shop block, for example, you could have one that restores HPs to the max by doing this
Code
REP #$20 ; Set A to 16-bit LDA !MaxHealth ; Then set it to max health STA !Health ; Replace health with new health SEP #$20 ; Set A back to 8-bit
and a block for restoring MPs to the max
Code
REP #$20 ; Set A to 16-bit LDA !MaxMP ; Then set it to max health STA !MP ; Replace health with new health SEP #$20 ; Set A back to 8-bit
or combine the two to get both effects
Code
REP #$20 ; Set A to 16-bit LDA !MaxHealth ; Then set it to max health STA !Health ; Replace health with new health LDA !MaxMP ; Then set it to max health STA !MP ; Replace health with new health SEP #$20 ; Set A back to 8-bit
Note that the defines !Health, !MaxHealth, !MP, and !MaxMP should be the same as those in "HP_Counter_Patch.asm". If you want to restore only a fixed amount of HPs/MPs the code becomes more complex because you would have to check that the added value doesn't exceed the max value or 999/99.
This is a design choice, but if you ask me, the ideal solution would be the alternative one, having shop blocks that have distinct and easily predictable outcomes (i.e., one block always give cape, one block always give fire, one block always restores HPs, etc.). Spawning item sprites (1) might also be reasonable. I don't like having shop blocks behaving like items (2), because their behaviour is context-dependent and might mislead the player (e.g., the player wants to restore HPs, but doesn't buy the mushroom because he think it's pointless since they are already big).
ROM Hack Manager - SMW Resources - SMW Toolbox