- 220
- Posts
- 14
- Years
- Seen Nov 29, 2021
So this is a bit... "ehhh" in resolution, but here's a quick-fix for Voltorb flip not having the ability to mark memos for numbers 1 through 3:
Firstly, the replace the graphics with this:
Secondly, go to PSystem_Controls and add "ZERO", "ONE", "TWO", and "THREE" to "module Input".
Then under "def self.buttonToKey(button)" add
Thirdly, go to PMinigame_VoltorbFlip. Naturally we have the most to do here.
under def pbNewGame, replace @marks=[] with
Find def pbCreateSpirtes and replace "@sprites["mark"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)" with
then under def getInput find and replace the entire "elsif Input.trigger?(Input::C)" bit with
Finally we need to make sure the new marks go away at the end of games, so head to def pbShowAndDispose and replace "@sprites["mark"].bitmap.clear" with
and you're done!
Now while in memo mode, pressing 0 marks a Voltorb, 1 marks a 1, etc.
I'm open for any optimisation of the code people have to offer. I wasn't 100% sure of what I was doing, so tried to play it overly safe.
EDIT: Or how to map the numberpad numbers, which are apparently different?
Firstly, the replace the graphics with this:
![[PokeCommunity.com] Fixing Voltorb Flip to Support 1–3 in Memo Mode [PokeCommunity.com] Fixing Voltorb Flip to Support 1–3 in Memo Mode](https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/9d676854-ca16-4cea-9099-fd954e997e6d/ddnvq12-f8bb7fb3-2510-45e4-85c9-339051a6150f.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzlkNjc2ODU0LWNhMTYtNGNlYS05MDk5LWZkOTU0ZTk5N2U2ZFwvZGRudnExMi1mOGJiN2ZiMy0yNTEwLTQ1ZTQtODVjOS0zMzkwNTFhNjE1MGYucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.wPyPSlzk6y1mxmYW6J14V1go0wX99cWVnAUWUnhS_LA)
Secondly, go to PSystem_Controls and add "ZERO", "ONE", "TWO", and "THREE" to "module Input".
Then under "def self.buttonToKey(button)" add
Code:
when Input::ZERO; return [0x30] # 0
when Input::ONE; return [0x31] # 1
when Input::TWO; return [0x32] # 2
when Input::THREE; return [0x33] # 3
Thirdly, go to PMinigame_VoltorbFlip. Naturally we have the most to do here.
under def pbNewGame, replace @marks=[] with
Code:
@marks0=[]
@marks1=[]
@marks2=[]
@marks3=[]
Find def pbCreateSpirtes and replace "@sprites["mark"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)" with
Code:
@sprites["mark0"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@sprites["mark1"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@sprites["mark2"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@sprites["mark3"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
then under def getInput find and replace the entire "elsif Input.trigger?(Input::C)" bit with
Code:
elsif Input.trigger?(Input::ZERO)
if @cursor[0][3]==64 # If in mark mode
for i in [email protected]
if @index[0]*64+128==@squares[i][0] && @index[1]*64==@squares[i][1] && @squares[i][3]==false
pbSEPlay("Voltorb Flip mark")
end
end
for i in [email protected]+1
if @marks0[i]==nil
@marks0[i]=[@directory+"tiles",@index[0]*64+128,@index[1]*64,256,0,64,64]
elsif @marks0[i][1]==@index[0]*64+128 && @marks0[i][2]==@index[1]*64
@marks0.delete_at(i)
@marks0.compact!
@sprites["mark0"].bitmap.clear
break
end
end
pbDrawImagePositions(@sprites["mark0"].bitmap,@marks0)
pbWait(2)
end
elsif Input.trigger?(Input::ONE)
if @cursor[0][3]==64 # If in mark mode
for i in [email protected]
if @index[0]*64+128==@squares[i][0] && @index[1]*64==@squares[i][1] && @squares[i][3]==false
pbSEPlay("Voltorb Flip mark")
end
end
for i in [email protected]+1
if @marks1[i]==nil
@marks1[i]=[@directory+"tiles",@index[0]*64+128,@index[1]*64,960,0,64,64]
elsif @marks1[i][1]==@index[0]*64+128 && @marks1[i][2]==@index[1]*64
@marks1.delete_at(i)
@marks1.compact!
@sprites["mark1"].bitmap.clear
break
end
end
pbDrawImagePositions(@sprites["mark1"].bitmap,@marks1)
pbWait(2)
end
elsif Input.trigger?(Input::TWO)
if @cursor[0][3]==64 # If in mark mode
for i in [email protected]
if @index[0]*64+128==@squares[i][0] && @index[1]*64==@squares[i][1] && @squares[i][3]==false
pbSEPlay("Voltorb Flip mark")
end
end
for i in [email protected]+1
if @marks2[i]==nil
@marks2[i]=[@directory+"tiles",@index[0]*64+128,@index[1]*64,1024,0,64,64]
elsif @marks2[i][1]==@index[0]*64+128 && @marks2[i][2]==@index[1]*64
@marks2.delete_at(i)
@marks2.compact!
@sprites["mark2"].bitmap.clear
break
end
end
pbDrawImagePositions(@sprites["mark2"].bitmap,@marks2)
pbWait(2)
end
elsif Input.trigger?(Input::THREE)
if @cursor[0][3]==64 # If in mark mode
for i in [email protected]
if @index[0]*64+128==@squares[i][0] && @index[1]*64==@squares[i][1] && @squares[i][3]==false
pbSEPlay("Voltorb Flip mark")
end
end
for i in [email protected]+1
if @marks3[i]==nil
@marks3[i]=[@directory+"tiles",@index[0]*64+128,@index[1]*64,1088,0,64,64]
elsif @marks3[i][1]==@index[0]*64+128 && @marks3[i][2]==@index[1]*64
@marks3.delete_at(i)
@marks3.compact!
@sprites["mark3"].bitmap.clear
break
end
end
pbDrawImagePositions(@sprites["mark3"].bitmap,@marks3)
pbWait(2)
end
elsif Input.trigger?(Input::C) && @cursor[0][3]!=64
# Display the tile for the selected spot
icons=[]
for i in [email protected]
if @index[0]*64+128==@squares[i][0] && @index[1]*64==@squares[i][1] && @squares[i][3]==false
pbAnimateTile(@index[0]*64+128,@index[1]*64,@squares[i][2])
@squares[i][3]=true
# If Voltorb (0), display all tiles on the board
if @squares[i][2]==0
pbSEPlay("Voltorb Flip explosion")
# Play explosion animation
# Part1
animation=[]
for j in 0...3
animation[0]=icons[0]=[@directory+"tiles",@index[0]*64+128,@index[1]*64,704+(64*j),0,64,64]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
# Part2
animation=[]
for j in 0...6
animation[0]=[@directory+"explosion",@index[0]*64-32+128,@index[1]*64-32,j*128,0,128,128]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
# Unskippable text block, parameter 2 = wait time (corresponds to ME length)
Kernel.pbMessage(_INTL("\\me[Voltorb Flip game over]Oh no! You get 0 Coins!\\wtnp[50]"))
pbShowAndDispose
@sprites["mark0"].bitmap.clear
@sprites["mark1"].bitmap.clear
@sprites["mark2"].bitmap.clear
@sprites["mark3"].bitmap.clear
if @level>1
# Determine how many levels to reduce by
newLevel=0
for j in [email protected]
if @squares[j][3]==true && @squares[j][2]>1
newLevel+=1
end
end
if newLevel>@level
newLevel=@level
end
if @level>newLevel
@level=newLevel
@level=1 if @level<1
Kernel.pbMessage(_INTL("\\se[Voltorb Flip level down]Dropped to Game Lv. {1}!",@level.to_s))
end
end
# Update level text
@sprites["level"].bitmap.clear
pbDrawShadowText(@sprites["level"].bitmap,8,150,118,28,"Level "[email protected]_s,Color.new(60,60,60),Color.new(150,190,170),1)
@points=0
pbUpdateCoins
# Revert numbers to 0s
@sprites["numbers"].bitmap.clear
for i in 0...5
pbUpdateRowNumbers(0,0,i)
pbUpdateColumnNumbers(0,0,i)
end
pbDisposeSpriteHash(@sprites)
@firstRound=false
pbNewGame
else
# Play tile animation
animation=[]
for j in 0...4
animation[0]=[@directory+"flipAnimation",@index[0]*64-14+128,@index[1]*64-16,j*92,0,92,96]
pbDrawImagePositions(@sprites["animation"].bitmap,animation)
pbWait(3)
@sprites["animation"].bitmap.clear
end
if @points==0
@points+=@squares[i][2]
pbSEPlay("Voltorb Flip point")
elsif @squares[i][2]>1
@points*=@squares[i][2]
pbSEPlay("Voltorb Flip point")
end
break
end
end
Finally we need to make sure the new marks go away at the end of games, so head to def pbShowAndDispose and replace "@sprites["mark"].bitmap.clear" with
Code:
@sprites["mark0"].bitmap.clear
@sprites["mark1"].bitmap.clear
@sprites["mark2"].bitmap.clear
@sprites["mark3"].bitmap.clear
Now while in memo mode, pressing 0 marks a Voltorb, 1 marks a 1, etc.
I'm open for any optimisation of the code people have to offer. I wasn't 100% sure of what I was doing, so tried to play it overly safe.
EDIT: Or how to map the numberpad numbers, which are apparently different?
Last edited: