Added: RandomMap Changed: PokemonOption @@ -220,1 +220,1 @@ - @sprites["title"]=Window_SimpleTextPokemon.newWithSize( + @sprites["title"]=Window_UnformattedTextPokemon.newWithSize( Changed: PokemonDayCare @@ -266,1 +266,2 @@ - isConst?(babyspecies,PBSpecies,:PICHU) + isConst?(babyspecies,PBSpecies,:PICHU) && + hasConst?(PBMoves,:VOLTTACKLE) Changed: PokemonPokedex @@ -259,2 +259,2 @@ - @sprites["infowindow"]=Window_SimpleTextPokemon.newWithSize("",0,160,160,160,@viewport) - @sprites["messagebox"]=Window_SimpleTextPokemon.new("") + @sprites["infowindow"]=Window_UnformattedTextPokemon.newWithSize("",0,160,160,160,@viewport) + @sprites["messagebox"]=Window_UnformattedTextPokemon.new("") Changed: PokemonAnimEditor @@ -2022,1 +2022,2 @@ - window=Window_SimpleTextPokemon.new("") + # This window displays the mouse's current position + window=Window_UnformattedTextPokemon.new("") @@ -2107,6 +2108,2 @@ - window=Window_SimpleTextPokemon.new("") - window.x=0 - window.y=320-64 - window.width=128 - window.height=64 - window.viewport=canvas.viewport + window=Window_UnformattedTextPokemon.newWithSize("", + 0, 320-64, 128, 64, canvas.viewport) @@ -2232,1 +2229,1 @@ - helpwindow=Window_SimpleTextPokemon.newWithSize( + helpwindow=Window_UnformattedTextPokemon.newWithSize( @@ -2568,1 +2565,1 @@ - cmdwin=Window_SimpleTextPokemon.newWithSize("",0,0,480,480) + cmdwin=Window_UnformattedTextPokemon.newWithSize("",0,0,480,480) @@ -2598,1 +2595,1 @@ - @window=Window_SimpleTextPokemon.newWithSize(_INTL("Name: {1}",@canvas.animation.name),240,416,400,64) + @window=Window_UnformattedTextPokemon.newWithSize(_INTL("Name: {1}",@canvas.animation.name),240,416,400,64) Changed: PokemonMenu @@ -51,1 +51,1 @@ - @sprites["infowindow"]=Window_ColoredTextPokemon.newWithSize("",0,0,32,32,@viewport) + @sprites["infowindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport) @@ -53,1 +53,1 @@ - @sprites["helpwindow"]=Window_ColoredTextPokemon.newWithSize("",0,0,32,32,@viewport) + @sprites["helpwindow"]=Window_UnformattedTextPokemon.newWithSize("",0,0,32,32,@viewport) Changed: DrawText @@ -61,1 +61,1 @@ - if maxheight==0 || texty=0 && chars.length>=@maxlength + return true + end @@ -384,0 +392,5 @@ + def canDelete? + chars=self.text.scan(/./m) + return false if chars.length<=0 || @cursor<=0 + return true + end @@ -410,1 +423,0 @@ - @@ -413,0 +425,3 @@ + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] @@ -536,0 +551,425 @@ + end + end +end + def getLineBrokenText(bitmap,value,width,dims) + x=0 + y=0 + textheight=0 + ret=[] + if dims + dims[0]=0 + dims[1]=0 + end + line=0 + position=0 + column=0 + return ret if !bitmap || bitmap.disposed? || width<=0 + textmsg=value.clone + lines=0 + color=Font.default_color + ret.push(["",0,0,0,bitmap.text_size("X").height,0,0,0,0]) + while ((c = textmsg.slice!(/\n|(\S*([ \r\t\f]?))/)) != nil) + break if c=="" + length=c.scan(/./m).length + ccheck=c + if ccheck=="\n" + ret.push(["\n",x,y,0,textheight,line,position,column,0]) + x=0 + y+=(textheight==0) ? bitmap.text_size("X").height : textheight + line+=1 + textheight=0 + column=0 + position+=length + ret.push(["",x,y,0,textheight,line,position,column,0]) + next + end + textcols=[] + words=[ccheck] + for i in 0...words.length + word=words[i] + if word && word!="" + textSize=bitmap.text_size(word) + textwidth=textSize.width + if x>0 && x+textwidth>=width-2 + # Zero-length word break + ret.push(["",x,y,0,textheight,line,position,column,0]) + x=0 + column=0 + y+=(textheight==0) ? bitmap.text_size("X").height : textheight + line+=1 + textheight=0 + end + textheight=[textheight,textSize.height].max + ret.push([word,x,y,textwidth,textheight,line,position,column,length]) + x+=textwidth + dims[0]=x if dims && dims[0]=totallines + maximumY=0 + for i in 0...textchars.length + thisline=textchars[i][5] + y=textchars[i][2] + return y if thisline==line + maximumY=y if maximumY=totallines + endpos=0 + for i in 0...textchars.length + thisline=textchars[i][5] + thispos=textchars[i][6] + thislength=textchars[i][8] + if thisline==line + endpos+=thislength + end + end + return endpos + end + end + def getPosFromLineAndColumn(line,column) + textchars=getTextChars + if textchars.length==0 + return 0 + else + totallines=getTotalLines() + line=0 if line<0 + line=totallines-1 if line>=totallines + endpos=0 + for i in 0...textchars.length + thisline=textchars[i][5] + thispos=textchars[i][6] + thiscolumn=textchars[i][7] + thislength=textchars[i][8] + if thisline==line + endpos=thispos+thislength +# echoln [endpos,thispos+(column-thiscolumn),textchars[i]] + if column>=thiscolumn && column<=thiscolumn+thislength && thislength>0 + return thispos+(column-thiscolumn) + end + end + end + if endpos==0 +# echoln [totallines,line,column] +# echoln textchars + end +# echoln "endpos=#{endpos}" + return endpos + end + end + def getLastVisibleLine + textchars=getTextChars() + textheight=[1,self.contents.text_size("X").height].max + lastVisible=@firstline+((self.height-32)/textheight)-1 + return lastVisible + end + def updateCursorPos(doRefresh) + # Calculate new cursor position + @helper.cursor=getPosFromLineAndColumn( + @cursorLine,@cursorColumn) + if doRefresh + @frame=0 + self.refresh + end + if @cursorLine<@firstline + @firstline=@cursorLine + end + lastVisible=getLastVisibleLine() + if @cursorLine>lastVisible + @firstline+=(@cursorLine-lastVisible) + end + end + def moveCursor(lineOffset, columnOffset) + # Move column offset first, then lines (since column offset + # can affect line offset) +# echoln ["beforemoving",@cursorLine,@cursorColumn] + totalColumns=getColumnsInLine(@cursorLine) # check current line + totalLines=getTotalLines() + oldCursorLine=@cursorLine + oldCursorColumn=@cursorColumn + @cursorColumn+=columnOffset + if @cursorColumn<0 && @cursorLine>0 + # Will happen if cursor is moved left from the beginning + # of a line + @cursorLine-=1 + @cursorColumn=getColumnsInLine(@cursorLine) + elsif @cursorColumn>totalColumns && @cursorLinetotalColumns + @cursorColumn=0 if @cursorColumn<0 # totalColumns can be 0 + # Move line offset + @cursorLine+=lineOffset + @cursorLine=0 if @cursorLine<0 + @cursorLine=totalLines-1 if @cursorLine>=totalLines + # Ensure column bounds again + totalColumns=getColumnsInLine(@cursorLine) + @cursorColumn=totalColumns if @cursorColumn>totalColumns + @cursorColumn=0 if @cursorColumn<0 # totalColumns can be 0 + updateCursorPos( + oldCursorLine!=@cursorLine || + oldCursorColumn!=@cursorColumn + ) +# echoln ["aftermoving",@cursorLine,@cursorColumn] + end + def update + @frame+=1 + @frame%=20 + self.refresh if ((@frame%10)==0) + # Moving cursor + if Input.repeat?(Input::LEFT) + moveCursor(0,-1) + return + elsif Input.repeat?(Input::UP) + moveCursor(-1,0) + return + elsif Input.repeat?(Input::DOWN) + moveCursor(1,0) + return + elsif Input.repeat?(Input::RIGHT) + moveCursor(0,1) + return + elsif Input.pressex?(0x11) && Input.triggerex?(0x24) # Ctrl + Home + # Move cursor to beginning + @cursorLine=0 + @cursorColumn=0 + updateCursorPos(true) + return + elsif Input.pressex?(0x11) && Input.triggerex?(0x23) # Ctrl + End + # Move cursor to end + @cursorLine=getTotalLines()-1 + @cursorColumn=getColumnsInLine(@cursorLine) + updateCursorPos(true) + return + elsif Input.repeatex?(13) + self.insert("\n") + return + elsif Input.repeatex?(8) || Input.repeatex?(0x2E) + # Backspace + self.delete + return + end + # Letter keys + for i in 65..90 + if Input.repeatex?(i) + shift=(Input.press?(Input::SHIFT)) ? 0x41 : 0x61 + insert((shift+(i-65)).chr) + return + end + end + # Number keys + shifted=")!@\#$%^&*(" + unshifted="0123456789" + for i in 48..57 + if Input.repeatex?(i) + insert((Input.press?(Input::SHIFT)) ? shifted[i-48].chr : unshifted[i-48].chr) + return + end + end + keys=[ + [32," "," "], + [106,"*","*"], + [107,"+","+"], + [109,"-","-"], + [111,"/","/"], + [186,";",":"], + [187,"=","+"], + [189,"-","_"], + [191,"/","?"], + [219,"[","{"], + [190,".",">"], + [188,",","<"], + [220,"\\","|"], + [190,".",""], + [188,",",""], + [221,"]","}"], + [222,"'","\""] + ] + for i in keys + if Input.repeatex?(i[0]) + insert((Input.press?(Input::SHIFT)) ? i[2] : i[1]) + return + end + end + end + def refresh + if !self.contents || self.contents.disposed? || + self.contents.width!=self.width-32 || + self.contents.height!=self.height-32 + # Re-create bitmap if necessary + self.contents.dispose if self.contents + self.contents=Bitmap.new([1,self.width-32].max,[1,self.height-32].max) + pbSetSystemFont(self.contents) + @textchars=nil + end + bitmap=self.contents + bitmap.clear + x=0 + y=0 + getTextChars + x+=4 + width=self.width-32 + height=self.height-32 + cursorcolor=Color.new(0,0,0) + textchars=getTextChars() + scanlength=@helper.length + startY=getLineY(@firstline) + lastheight=32 + for i in 0...textchars.length + thisline=textchars[i][5] + thispos=textchars[i][6] + thiscolumn=textchars[i][7] + thislength=textchars[i][8] + textY=textchars[i][2]-startY + # Don't draw lines before the first or zero-length segments + next if thisline<@firstline || thislength==0 + # Don't draw lines beyond the window's height + break if textY >= height + c=textchars[i][0] + # Don't draw spaces + next if c==" " + textwidth=textchars[i][3]+4 # add 4 to prevent draw_text from stretching text + textheight=textchars[i][4] + lastheight=textheight + # Draw text + bitmap.font.color=@shadowColor + pbDrawShadow(bitmap,textchars[i][1],textY, textwidth, textheight, c) + bitmap.font.color=@baseColor + bitmap.draw_text(textchars[i][1],textY, textwidth, textheight, c) + end + # Draw cursor + if ((@frame/10)&1) == 0 + textheight=bitmap.text_size("X").height + cursorY=(textheight*@cursorLine)-startY + cursorX=0 + for i in 0...textchars.length + thisline=textchars[i][5] + thispos=textchars[i][6] + thiscolumn=textchars[i][7] + thislength=textchars[i][8] + if thisline==@cursorLine && + @cursorColumn>=thiscolumn && @cursorColumn<=thiscolumn+thislength + cursorY=textchars[i][2]-startY + cursorX=textchars[i][1] + textheight=textchars[i][4] + posToCursor=@cursorColumn-thiscolumn + if posToCursor>=0 + partialString=textchars[i][0].scan(/./m)[0,posToCursor].join("") + cursorX+=bitmap.text_size(partialString).width + end + break + end + end + cursorY+=4 + cursorHeight=[4,textheight-4,bitmap.text_size("X").height-4].max + bitmap.fill_rect(cursorX,cursorY,2,cursorHeight,cursorcolor) @@ -678,1 +1118,1 @@ - @sprites["helpwindow"]=Window_SimpleTextPokemon.new( + @sprites["helpwindow"]=Window_UnformattedTextPokemon.new( @@ -682,1 +1122,1 @@ - @sprites["helpwindow"]=Window_SimpleTextPokemon.new( + @sprites["helpwindow"]=Window_UnformattedTextPokemon.new( @@ -725,1 +1165,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -730,1 +1170,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -735,1 +1175,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -742,1 +1182,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1077,1 +1517,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1093,1 +1533,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1098,1 +1538,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1101,1 +1541,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1118,1 +1558,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) Changed: Compiler @@ -720,6 +720,15 @@ - record.push(csvInt!(line,lineno)) - record.push(csvEnumFieldOrInt!(line,hashenum,"",_INTL("(line {1})",lineno))) - record.push(csvInt!(line,lineno)) - record.push(csvInt!(line,lineno)) - record.push(csvEnumFieldOrInt!(line,hashenum,"",_INTL("(line {1})",lineno))) - record.push(csvInt!(line,lineno)) + thisline=line.dup + record.push(csvInt!(thisline,lineno)) + record.push(csvEnumFieldOrInt!(thisline,hashenum,"",_INTL("(line {1})",lineno))) + record.push(csvInt!(thisline,lineno)) + record.push(csvInt!(thisline,lineno)) + record.push(csvEnumFieldOrInt!(thisline,hashenum,"",_INTL("(line {1})",lineno))) + record.push(csvInt!(thisline,lineno)) + if !FileTest.exist?(sprintf("Data/Map%03d.rxdata",record[0])) && + !FileTest.exist?(sprintf("Data/Map%03d.rvdata",record[0])) + print _INTL("Warning: Map {1}, as mentioned in the map\r\nconnection data, was not found.\r\n{2}",record[0],FileLineData.linereport) + end + if !FileTest.exist?(sprintf("Data/Map%03d.rxdata",record[3])) && + !FileTest.exist?(sprintf("Data/Map%03d.rvdata",record[3])) + print _INTL("Warning: Map {1}, as mentioned in the map\r\nconnection data, was not found.\r\n{2}",record[3],FileLineData.linereport) + end @@ -2228,5 +2237,0 @@ -# elsif key=="Machines" -# raise _INTL("Invalid machine value: {1} (section {2})",value,currentmap) if value<=0||value>58 -# value-=1 -# machines[currentmap]=[0,0,0,0,0,0,0,0] if !machines[currentmap] -# machines[currentmap][value>>3]|=(1<<(value&7)) @@ -2633,0 +2637,4 @@ + # Run trainer check now, except in editor + if !$INEDITOR + pbTrainerCheck(trtype,trname,battles.length) + end @@ -2867,0 +2875,18 @@ + +=begin + window=Window_MultilineTextEntry.new("",0,0,480,320) + window.maxlength=2000 + window.z=0 + window.visible=true + window.text="ooias saopdop sadopop asopdsa aopopdsa saopopdsa pdsapds dsapspd sap" + ret="" + loop do + Graphics.update + Input.update + window.update + if Input.triggerex?(0x1B) + break + end + end + window.dispose +=end Changed: PokeBattle_BattlePalace @@ -268,0 +268,165 @@ + + +class PokeBattle_Move_Blitz < PokeBattle_Move + # Maps keys to numbers. + KEYHASH={ + :A=>0x41,:B=>0x42,:C=>0x43,:D=>0x44, + :E=>0x45,:F=>0x46,:G=>0x47,:H=>0x48, + :I=>0x49,:J=>0x4a,:K=>0x4b,:L=>0x4c, + :M=>0x4D,:N=>0x4e,:O=>0x4f,:P=>0x50, + :Q=>0x51,:R=>0x52,:S=>0x53,:T=>0x54, + :U=>0x55,:V=>0x56,:W=>0x57,:X=>0x58, + :Y=>0x59,:Z=>0x5a,:NUM_0=>0x30,:NUM_1=>0x31, + :NUM_2=>0x32,:NUM_3=>0x33,:NUM_4=>0x34,:NUM_5=>0x35, + :NUM_6=>0x36,:NUM_7=>0x37,:NUM_8=>0x38,:NUM_9=>0x39, + :UP=>0x26,:DOWN=>0x28,:LEFT=>0x25,:RIGHT=>0x27, + :SPACE=>0x20,:ENTER=>0x0D,:TAB=>0x09 + } + # Calls the blitz function + def pbDisplayUseMessage(attacker) + ret=super + if @battle.pbOwnedByPlayer?(attacker.index) + @time=@battle.scene.pbBlitz(@keys) + if @time<0 + @battle.pbDisplay(_INTL("But it failed!")) + return -1 + end + else + @time=@battle.pbRandom(30)*@keys.length + end + return ret + end + # Calculates the base damage based on the time + # it took to input the key combination. The shorter + # the time, the greater the damage. + def pbBaseDamage(basedmg,attacker,opponent) + return 10 if !@time || @time<0 + timeAverage=@time/[1,@keys.length].max + return 10 if timeAverage>30 + return 20 if timeAverage>25 + return 40 if timeAverage>20 + return 60 if timeAverage>16 + return 80 if timeAverage>12 + return 100 if timeAverage>8 + return 150 if timeAverage>4 + return 200 + end + def self.triggerKeyState(key) + # -1: no keys pressed; 0: wrong key pressed; 1: correct key pressed + correctKey=(KEYHASH[key]) ? KEYHASH[key] : 0x20 + # check wrong keys first + for i in KEYHASH.values + if i!=correctKey + return 0 if Input.triggerex?(i) + end + end + # then check correct key + return (Input.triggerex?(correctKey)) ? 1 : -1 + end + def self.getKey(key) + return (KEYHASH[key]) ? KEYHASH[key] : 0x20 + end +end + +# Fire Blitz +class PokeBattle_Move_110 < PokeBattle_Move_Blitz + def initialize(battle,move) + super + @keys=[:A,:B,:UP,:DOWN] + end +end + +# Ice Blitz +class PokeBattle_Move_111 < PokeBattle_Move_Blitz + def initialize(battle,move) + super + @keys=[:X,:W,:LEFT,:RIGHT] + end +end + +# ThunderBlitz +class PokeBattle_Move_112 < PokeBattle_Move_Blitz + def initialize(battle,move) + super + @keys=[:Z,:Q,:P,:M] + end +end + + +class PokeBattle_Scene + # Processes the blitz function with the array of keys. Each key will + # display after 30 frames. If no keys were pressed after all keys are + # shown, or if all keys pressed were wrong, the move fails. If an + # incorrect key was pressed, a time penalty of 30 frames will be added. + # For blitz moves, the shorter the time, the greater the damage. + def pbBlitz(keys) + @briefmessage=false + blitzwindow=Window_AdvancedTextPokemon.newWithSize("",0,Graphics.height-96-64,Graphics.width*2/3,64) + blitzwindow.z=100001 + keystates=[0,0,0,0] + start=Graphics.frame_count + time=0 + penalty=0 + blitzCount=0 + blitzCurrent=0 + shownTime=0 + failures=0 + loop do + Graphics.update + Input.update + blitzwindow.update + needRefresh=false + if shownTime%30 == 0 + blitzCount+=1 + needRefresh=true + if blitzCount>keys.length + Audio.se_play("Audio/SE/buzzer.wav") + penalty=0 + time=-1 + break + end + end + keyState=PokeBattle_Move_Blitz.triggerKeyState(keys[blitzCurrent]) + if keyState>=0 # Either correct or incorrect + if keyState==1 # Correct + Audio.se_play(pbGetDecisionSE) + keystates[blitzCurrent]=1 + else # Incorrect + Audio.se_play("Audio/SE/buzzer.wav") + keystates[blitzCurrent]=2 + penalty+=30 + failures+=1 + end + blitzCurrent+=1 + if blitzCurrent>=keys.length + if failures==keys.length + time=-1 + penalty=0 + end + break + end + shownTime=0 + blitzCount=blitzCurrent+1 if blitzCount0 + if keystates[i]==1 #Correct + newtext+=""+keys[i].to_s+"" + elsif keystates[i]==2 # Incorrect + newtext+=""+keys[i].to_s+"" + else + newtext+=keys[i].to_s + end + end + blitzwindow.text=newtext + end + time+=1 + shownTime+=1 + end + blitzwindow.dispose + return time+penalty + end +end Changed: PokemonEvolution @@ -402,1 +402,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -422,1 +422,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) Changed: Audio @@ -12,70 +12,0 @@ -class Mutex - def initialize - @waiting = [] - @locked = false; - @waiting.taint # enable tainted comunication - self.taint - end - def locked? - @locked - end - def try_lock - result = false - Thread.critical = true - unless @locked - @locked = true - result = true - end - Thread.critical = false - result - end - def lock - while (Thread.critical = true; @locked) - @waiting.push Thread.current - Thread.stop - end - @locked = true - Thread.critical = false - self - end - def unlock - return unless @locked - Thread.critical = true - @locked = false - begin - t = @waiting.shift - t.wakeup if t - rescue ThreadError - retry - end - Thread.critical = false - begin - t.run if t - rescue ThreadError - end - self - end - def synchronize - lock - begin - yield - ensure - unlock - end - end - def exclusive_unlock - return unless @locked - Thread.exclusive do - @locked = false - begin - t = @waiting.shift - t.wakeup if t - rescue ThreadError - retry - end - yield - end - self - end -end - @@ -180,3 +110,1 @@ - Thread.critical=true - @waitingBGM=value; - Thread.critical=false + Thread.exclusive { @waitingBGM=value; } Changed: PokemonEditor @@ -427,2 +427,5 @@ - -def pbChooseMoveList +# Displays a sorted list of moves, and returns the ID of the move +# selected or 0 if the selection was canceled. +# defaultMoveID, if specified, indicates the ID of the move +# initially shown on the list. +def pbChooseMoveList(defaultMoveID=0) @@ -431,0 +434,1 @@ + moveDefault=0 @@ -435,0 +439,5 @@ + if defaultMoveID>0 + commands.each_with_index {|item,index| + moveDefault=index if index[0]==defaultMoveID + } + end @@ -439,1 +448,1 @@ - ret=pbCommands2(cmdwin,realcommands,-1,0,true) + ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true) @@ -443,0 +452,61 @@ + + + +# Displays a sorted list of items, and returns the ID of the item +# selected or 0 if the selection was canceled. +# defaultItemID, if specified, indicates the ID of the item +# initially shown on the list. +def pbChooseItemList(defaultItemID=0) + cmdwin=pbListWindow([],200) + commands=[] + moveDefault=0 + for c in PBItems.constants + i=PBItems.const_get(c) + if i.is_a?(Integer) + commands.push([i,PBItems.getName(i)]) + end + end + commands.sort! {|a,b| a[1]<=>b[1]} + if defaultItemID>0 + commands.each_with_index {|item,index| + moveDefault=index if index[0]==defaultItemID + } + end + realcommands=[] + for command in commands + realcommands.push(_ISPRINTF("{2:s}",command[0],command[1])) + end + ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true) + cmdwin.dispose + return ret>=0 ? commands[ret][0] : 0 +end + +# Displays a sorted list of Pokemon species, and returns the ID of the species +# selected or 0 if the selection was canceled. +# defaultMoveID, if specified, indicates the ID of the species +# initially shown on the list. +def pbChooseSpeciesList(defaultItemID=0) + cmdwin=pbListWindow([],200) + commands=[] + moveDefault=0 + for c in PBSpecies.constants + i=PBSpecies.const_get(c) + if i.is_a?(Integer) + commands.push([i,PBSpecies.getName(i)]) + end + end + commands.sort! {|a,b| a[1]<=>b[1]} + if defaultItemID>0 + commands.each_with_index {|item,index| + moveDefault=index if index[0]==defaultItemID + } + end + realcommands=[] + for command in commands + realcommands.push(_ISPRINTF("{2:s}",command[0],command[1])) + end + ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true) + cmdwin.dispose + return ret>=0 ? commands[ret][0] : 0 +end + @@ -622,1 +692,2 @@ - enchelp=Window_SimpleTextPokemon.new("") + # This window displays the help text + enchelp=Window_UnformattedTextPokemon.new("") @@ -670,1 +741,1 @@ - title=Window_SimpleTextPokemon.new(title) + title=Window_UnformattedTextPokemon.new(title) @@ -719,1 +790,1 @@ - title=Window_SimpleTextPokemon.new(title) + title=Window_UnformattedTextPokemon.new(title) @@ -1010,1 +1081,1 @@ - title=Window_SimpleTextPokemon.new(_INTL("Click a point on the map.")) + title=Window_UnformattedTextPokemon.new(_INTL("Click a point on the map.")) @@ -1056,0 +1127,25 @@ + def defaultValue + return 0 + end +end + +class LimitProperty + def initialize(maxvalue) + @maxvalue=maxvalue + end + def set(settingname,oldsetting) + oldsetting=1 if !oldsetting + while true + ret=Kernel.pbMessageChooseNumberNew( + _INTL("Set the value for {1}.",settingname),oldsetting,3) + return ret if ret==oldsetting + return ret if ret<=@maxvalue + Kernel.pbMessage(_INTL("That value can't be higher than {1}. Please try again.",@maxvalue)) + end + end + def format(value) + return value.inspect + end + def defaultValue + return 0 + end @@ -1114,0 +1210,13 @@ + def self.defaultValue + return 0 + end +end + +module StringProperty + def self.set(settingname,oldsetting) + message=Kernel.pbMessageFreeText(_INTL("Set the value for {1}.",settingname), + oldsetting ? oldsetting : "",false,256) + end + def self.format(value) + return value + end @@ -1183,1 +1292,1 @@ -module StringProperty +module SpeciesProperty @@ -1185,2 +1294,2 @@ - message=Kernel.pbMessageFreeText(_INTL("Set the value for {1}.",settingname), - oldsetting ? oldsetting : "",false,256) + ret=pbChooseSpeciesList(oldsetting ? oldsetting : 1) + return (ret<=0) ? (oldsetting ? oldsetting : 0) : ret @@ -1189,1 +1298,28 @@ - return value + return value ? PBSpecies.getName(value) : "-" + end + def self.defaultValue + return 0 + end +end +module MoveProperty + def self.set(settingname,oldsetting) + ret=pbChooseMoveList(oldsetting ? oldsetting : 1) + return (ret<=0) ? (oldsetting ? oldsetting : 0) : ret + end + def self.format(value) + return value ? PBMoves.getName(value) : "-" + end + def self.defaultValue + return 0 + end +end +module ItemProperty + def self.set(settingname,oldsetting) + ret=pbChooseItemList(oldsetting ? oldsetting : 1) + return (ret<=0) ? (oldsetting ? oldsetting : 0) : ret + end + def self.format(value) + return value ? PBItems.getName(value) : "-" + end + def self.defaultValue + return 0 @@ -1327,1 +1463,1 @@ - title=Window_SimpleTextPokemon.new(title) + title=Window_UnformattedTextPokemon.new(title) @@ -1334,1 +1470,1 @@ - desc=Window_SimpleTextPokemon.new("") + desc=Window_UnformattedTextPokemon.new("") @@ -1363,1 +1499,6 @@ - data[selectedmap]=nil + propobj=properties[selectedmap][1] + if propobj.respond_to?("defaultValue") + data[selectedmap]=propobj.defaultValue + else + data[selectedmap]=nil + end @@ -1656,1 +1797,1 @@ - @sprites["title"]=Window_SimpleTextPokemon.new(_INTL("F5: Help")) + @sprites["title"]=Window_UnformattedTextPokemon.new(_INTL("F5: Help")) @@ -1718,1 +1859,1 @@ - title=Window_SimpleTextPokemon.new(helptext) + title=Window_UnformattedTextPokemon.new(helptext) @@ -1781,1 +1922,5 @@ - _INTL("Default windowskin for speech messages.")] + _INTL("Default windowskin for speech messages.")], + ["SurfBGM",BGMProperty, + _INTL("BGM played while surfing.")], + ["BicycleBGM",BGMProperty, + _INTL("BGM played while on a bicycle.")] @@ -2063,0 +2208,262 @@ + +class TrainerBattleLister + def initialize(selection,includeNew) + @sprite=SpriteWrapper.new + @sprite.bitmap=nil + @sprite.z=2 + @selection=selection + @commands=[] + @ids=[] + @includeNew=includeNew + @trainers=nil + @index=0 + end + def setViewport(viewport) + @sprite.viewport=viewport + end + def startIndex + return @index + end + def commands + @commands.clear + @ids.clear + @trainers=load_data("Data/trainers.dat") + if @includeNew + @commands.push(_ISPRINTF("[NEW TRAINER BATTLE]")) + @ids.push(-1) + end + @trainers.length.times do |i| + next if !@trainers[i] + # Index: TrainerType TrainerName + @commands.push(_ISPRINTF("{1:3d}: {2:s} {3:s}",i, + PBTrainers.getName(@trainers[i][0]),@trainers[i][1])) # Trainer's name must not be localized + # Trainer type ID + @ids.push(@trainers[i][0]) + end + @index=@selection + @index=@commands.length-1 if @index>=@commands.length + @index=0 if @index<0 + return @commands + end + def value(index) + return nil if (index<0) + return [-1,nil] if index==0 && @includeNew + realIndex=(@includeNew) ? index-1 : index + return [realIndex,@trainers[realIndex]] + end + def dispose + @sprite.bitmap.dispose if @sprite.bitmap + @sprite.dispose + end + def refresh(index) + @sprite.bitmap.dispose if @sprite.bitmap + return if index<0 + begin + @sprite.bitmap=BitmapCache.character(sprintf("trainer%03d",@ids[index]),0) + rescue + @sprite.bitmap=Bitmap.new(32,32) + end + ww=@sprite.bitmap.width + wh=@sprite.bitmap.height + sx=224.0/ww + sy=416.0/wh + if sx<1.0 || sy<1.0 + if sx>sy + ww=sy*ww + wh=416.0 + else + wh=sx*wh + ww=224.0 + end + end + @sprite.zoom_x=ww*1.0/@sprite.bitmap.width + @sprite.zoom_y=wh*1.0/@sprite.bitmap.height + @sprite.x=368-(ww/2) + @sprite.y=192-(wh/2) + end +end + +module TrainerPokemonProperty + def self.set(settingname,oldsetting) + oldsetting=[0,10,10,0,0,0,0,0] if !oldsetting + properties=[ + [_INTL("Species"),SpeciesProperty, + _INTL("Species of this Pokemon.")], + [_INTL("Level"),LimitProperty.new(100), + _INTL("Level of the Pokemon.")], + [_INTL("IVs"),LimitProperty.new(31), + _INTL("Individual values of each of the Pokemon's stats.")], + [_INTL("Held item"),ItemProperty, + _INTL("Item held by the Pokemon.")], + [_INTL("Move 1"),MoveProperty, + _INTL("First move. Leave all moves blank (use Z key) to give it a wild move set.")], + [_INTL("Move 2"),MoveProperty, + _INTL("Second move. Leave all moves blank (use Z key) to give it a wild move set.")], + [_INTL("Move 3"),MoveProperty, + _INTL("Third move. Leave all moves blank (use Z key) to give it a wild move set.")], + [_INTL("Move 4"),MoveProperty, + _INTL("Fourth move. Leave all moves blank (use Z key) to give it a wild move set.")] + ] + pbPropertyList(settingname,oldsetting,properties,false) + for i in 0...8 + oldsetting[i]=0 if !oldsetting[i] + end + moves=[] + moves.push(oldsetting[4]) if oldsetting[4]!=0 + moves.push(oldsetting[5]) if oldsetting[5]!=0 + moves.push(oldsetting[6]) if oldsetting[6]!=0 + moves.push(oldsetting[7]) if oldsetting[7]!=0 + oldsetting[4]=moves[0] ? moves[0] : 0 + oldsetting[5]=moves[1] ? moves[1] : 0 + oldsetting[6]=moves[2] ? moves[2] : 0 + oldsetting[7]=moves[3] ? moves[3] : 0 + oldsetting=nil if !oldsetting[0] || oldsetting[0]==0 + return oldsetting + end + def self.format(value) + return (!value || !value[0] || value[0]==0) ? "-" : PBSpecies.getName(value[0]) + end +end + +module TrainerBattleProperty + def self.set(settingname,oldsetting) + if !oldsetting + return oldsetting + end + properties=[ + [_INTL("Trainer Type"),TrainerTypeProperty, + _INTL("Name of the trainer type for this Trainer.")], + [_INTL("Trainer Name"),StringProperty, + _INTL("Name of the Trainer.")], + [_INTL("Battle ID"),LimitProperty.new(255), + _INTL("ID used to distinguish Trainers with the same name and trainer type")], + [_INTL("Pokemon 1"),TrainerPokemonProperty, + _INTL("First Pokemon.")], + [_INTL("Pokemon 2"),TrainerPokemonProperty, + _INTL("Second Pokemon.")], + [_INTL("Pokemon 3"),TrainerPokemonProperty, + _INTL("Third Pokemon.")], + [_INTL("Pokemon 4"),TrainerPokemonProperty, + _INTL("Fourth Pokemon.")], + [_INTL("Pokemon 5"),TrainerPokemonProperty, + _INTL("Fifth Pokemon.")], + [_INTL("Pokemon 6"),TrainerPokemonProperty, + _INTL("Sixth Pokemon.")], + [_INTL("Item 1"),ItemProperty, + _INTL("Item used by the trainer during battle.")], + [_INTL("Item 2"),ItemProperty, + _INTL("Item used by the trainer during battle.")], + [_INTL("Item 3"),ItemProperty, + _INTL("Item used by the trainer during battle.")], + [_INTL("Item 4"),ItemProperty, + _INTL("Item used by the trainer during battle.")] + ] + if !pbPropertyList(settingname,oldsetting,properties,true) + oldsetting=nil + else + oldsetting=nil if !oldsetting[0] || oldsetting[0]==0 + end + return oldsetting + end + def self.format(value) + return value.inspect + end +end + +def pbTrainerBattleEditor + selection=0 + pbListScreenBlock(_INTL("Trainer Battles"),TrainerBattleLister.new(selection,true)){|button,trtype| + if trtype + index=trtype[0] + trainerdata=trtype[1] + if button==Input::A + if index>=0 + command=Kernel.pbMessage("Delete this trainer battle?",[_INTL("NO"),_INTL("YES")],1) + if command==1 + data=load_data("Data/trainers.dat") + data.delete_at(index) + save_data(data,"Data/trainers.dat") + pbConvertTrainerData + Kernel.pbMessage(_INTL("The Trainer battle was deleted.")) + end + end + elsif button==Input::C + selection=index + if selection<0 + ret=Kernel.pbMessage(_INTL("First, define the type of trainer."),[ + _INTL("USE EXISTING TYPE"),_INTL("USE NEW TYPE"),_INTL("CANCEL") + ],3) + trainertype=-1 + trainername="" + if ret==0 + trainertype=pbListScreen(_INTL("Trainer Type"),TrainerTypeLister.new(0,false)) + next if !trainertype + trainertype=trainertype[0] + next if trainertype<0 + elsif ret==1 + trainertype=pbTrainerTypeEditorNew(nil) + next if trainertype<0 + else + next + end + trainername=Kernel.pbMessageFreeText(_INTL("Now enter the trainer's name."),"",false,32) + if trainername=="" + next + end + trainerparty=pbGetFreeTrainerParty(trainertype,trainername) + if trainerparty<0 + Kernel.pbMessage(_INTL("There is no room to create a trainer of that type and name.")) + next + end + ############### + pbNewTrainer(trainertype,trainername,trainerparty) + else + data=[ + trainerdata[0],trainerdata[1], + trainerdata[4], + trainerdata[3][0], + trainerdata[3][1], + trainerdata[3][2], + trainerdata[3][3], + trainerdata[3][4], + trainerdata[3][5], + trainerdata[2][0], + trainerdata[2][1], + trainerdata[2][2], + trainerdata[2][3] + ] + save=false + while true + data=TrainerBattleProperty.set(trainerdata[1],data) + if data + trainerdata=[ + data[0],data[1], + [data[9],data[10],data[11],data[12]].find_all {|i| i && i!=0 }, + [data[3],data[4],data[5], + data[6],data[7],data[8]].find_all {|i| i && i!=0 }, + data[2] + ] + if trainerdata[3].length==0 + Kernel.pbMessage(_INTL("Can't save. The Pokemon list is empty.")) + elsif !trainerdata[1] || trainerdata[1].length==0 + Kernel.pbMessage(_INTL("Can't save. No name was entered.")) + else + save=true + break + end + else + break + end + end + if save + data=load_data("Data/trainers.dat") + data[index]=trainerdata + save_data(data,"Data/trainers.dat") + pbConvertTrainerData + end + end + end + end + } +end + Changed: PokemonMessages @@ -277,0 +277,2 @@ + # Helper function that shows a picture in a script. To be used in + # a script event command. @@ -282,0 +284,3 @@ + # Erases an event and adds it to the list of erased events so that + # it can stay erased when the game is saved then loaded again. To be used in + # a script event command. @@ -288,0 +293,2 @@ + # Runs a common event. To be used in + # a script event command. @@ -296,0 +303,2 @@ + # Sets another event's self switch (eg. pbSetSelfSwitch(20,"A",true)). To be used in + # a script event command. @@ -300,0 +309,2 @@ + # Used in boulder events. Allows an event to be pushed. To be used in + # a script event command. @@ -581,1 +592,1 @@ - cmdwindow=Window_SimpleTextPokemon.new("0"*maxDigits) + cmdwindow=Window_UnformattedTextPokemon.new("0"*maxDigits) @@ -1183,1 +1194,1 @@ - goldwindow=Window_SimpleTextPokemon.newWithSize( + goldwindow=Window_UnformattedTextPokemon.newWithSize( Changed: PBDebug @@ -12,1 +12,1 @@ - #pbPrintException($!) + pbPrintException($!) Changed: SpriteWindow @@ -1856,1 +1856,4 @@ -class Window_ColoredTextPokemon < SpriteWindow_Base +# Represents a window with no formatting capabilities. Its +# text color can be set, though, and line breaks are supported, +# but the text is generally unformatted. +class Window_UnformattedTextPokemon < SpriteWindow_Base @@ -1860,0 +1863,2 @@ + # Letter-by-letter mode. This mode is not supported + # in this class. @@ -2269,6 +2274,0 @@ -class Window_SimpleTextPokemon < Window_AdvancedTextPokemon - def text=(value) - super(fmtescape(value)) - end -end - @@ -2457,0 +2456,2 @@ + +#A simple sprite class that displays an icon. @@ -2470,0 +2471,1 @@ + # Sets the icon's filename. Alias for setBitmap. @@ -2473,0 +2475,1 @@ + # Sets the icon's filename. Changed: PokemonSystem @@ -98,3 +98,0 @@ -$havetraceproc=false -$trace=nil -$lastcall="" Changed: PokemonSummary @@ -557,1 +557,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -569,1 +569,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -673,1 +673,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -683,1 +683,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) Changed: PokemonUtilities @@ -3,0 +3,1 @@ + # Screen tints for each hour of the day. @@ -46,1 +47,1 @@ - now=Time.now + now=Time.now # Get the current system time @@ -51,0 +52,2 @@ + # Calculate current tint according to current and next hour's tint and + # depending on current minute @@ -352,1 +355,1 @@ - if pokemon.species==PBSpecies::SPINDA && !back + if isConst?(pokemon.species,PBSpecies,:SPINDA) && !back @@ -376,1 +379,1 @@ - if pokemon.species==PBSpecies::SPINDA && !back + if isConst?(pokemon.species,PBSpecies,:SPINDA) && !back Changed: PokemonBag @@ -256,1 +256,4 @@ - +# Common UI functions used in both the bag and item storage screens. + +# Allows the user to choose a number. The window _helpwindow_ will +# display the _helptext_. @@ -263,1 +266,1 @@ - using(numwindow=Window_ColoredTextPokemon.new(_INTL("x000"))){ + using(numwindow=Window_UnformattedTextPokemon.new(_INTL("x000"))){ @@ -268,1 +271,1 @@ - pbBottomRight(numwindow) + pbBottomRight(numwindow) # Move number window to the bottom right @@ -270,1 +273,1 @@ - pbBottomLeft(helpwindow) + pbBottomLeft(helpwindow) # Move help window to the bottom left @@ -305,0 +308,2 @@ +# Letter by letter display of the message _msg_ +# by the window _helpwindow_. @@ -328,0 +333,3 @@ +# Letter by letter display of the message _msg_ +# by the window _helpwindow_, waiting until the +# user confirms the message. @@ -346,1 +354,3 @@ - +# Letter by letter display of the message _msg_ +# by the window _helpwindow_, used to ask questions. +# Returns true if the user chose yes, false if no. @@ -413,0 +423,11 @@ +################################# +## Configuration +ITEMLISTBASECOLOR=Color.new(72,72,72) +ITEMLISTSHADOWCOLOR=Color.new(208,208,208) +ITEMTEXTBASECOLOR=Color.new(31*8,31*8,31*8) +ITEMTEXTSHADOWCOLOR=Color.new(12*8,12*8,12*8) +POCKETNAMEBASECOLOR=Color.new(31*8,31*8,31*8) +POCKETNAMESHADOWCOLOR=Color.new(12*8,12*8,12*8) +ITEMSVISIBLE=6 + +################################# @@ -432,1 +453,1 @@ - @sprites["itemwindow"]=Window_PokemonBag.new(@bag,lastpocket,160,0,304,224) + @sprites["itemwindow"]=Window_PokemonBag.new(@bag,lastpocket,160,0,304,32+ITEMSVISIBLE*32) @@ -436,0 +457,2 @@ + @sprites["itemwindow"].baseColor=ITEMLISTBASECOLOR + @sprites["itemwindow"].shadowColor=ITEMLISTSHADOWCOLOR @@ -442,1 +465,1 @@ - @sprites["itemtextwindow"]=Window_ColoredTextPokemon.new("") + @sprites["itemtextwindow"]=Window_UnformattedTextPokemon.new("") @@ -445,1 +468,1 @@ - @sprites["itemtextwindow"].width=480-64 + @sprites["itemtextwindow"].width=Graphics.width-64 @@ -447,2 +470,2 @@ - @sprites["itemtextwindow"].baseColor=Color.new(31*8,31*8,31*8) - @sprites["itemtextwindow"].shadowColor=Color.new(12*8,12*8,12*8) + @sprites["itemtextwindow"].baseColor=ITEMTEXTBASECOLOR + @sprites["itemtextwindow"].shadowColor=ITEMTEXTSHADOWCOLOR @@ -452,1 +475,1 @@ - @sprites["helpwindow"]=Window_ColoredTextPokemon.new("") + @sprites["helpwindow"]=Window_UnformattedTextPokemon.new("") @@ -493,1 +516,0 @@ - @@ -504,0 +526,1 @@ + # Set the bitmap for the currently selected bag @@ -505,2 +528,4 @@ - base=Color.new(31*8,31*8,31*8) - shadow=Color.new(12*8,12*8,12*8) + base=POCKETNAMEBASECOLOR + shadow=POCKETNAMESHADOWCOLOR + # Draw the pocket name on the upper left corner + # of the screen @@ -510,0 +535,1 @@ + # Reset positions of left/right arrows around the bag @@ -515,0 +541,1 @@ + # Set the icon for the currently selected item @@ -517,0 +544,1 @@ + # Display the item's description @@ -519,0 +547,1 @@ + # Refresh the item window @@ -522,2 +551,2 @@ - - +# Called when the item screen wants an item to be chosen +# from the screen @@ -536,0 +565,1 @@ + # Update item icon and description @@ -541,0 +571,1 @@ + # Change pockets if Left/Right pressed @@ -548,0 +579,1 @@ + # Select item for switching if A is pressed @@ -558,0 +590,1 @@ + # Cancel switching or cancel the item screen @@ -566,0 +599,1 @@ + # Confirm selection or item switch @@ -593,0 +627,13 @@ + +################################# +## Configuration +ITEMLISTBASECOLOR=Color.new(72,72,72) +ITEMLISTSHADOWCOLOR=Color.new(208,208,208) +ITEMTEXTBASECOLOR=Color.new(31*8,31*8,31*8) +ITEMTEXTSHADOWCOLOR=Color.new(12*8,12*8,12*8) +TITLEBASECOLOR=Color.new(31*8,31*8,31*8) +TITLESHADOWCOLOR=Color.new(12*8,12*8,12*8) +ITEMSVISIBLE=6 + +################################# + @@ -609,1 +656,2 @@ - @sprites["itemwindow"]=Window_PokemonItemStorage.new(@bag,96,0,304,224) + # Item list + @sprites["itemwindow"]=Window_PokemonItemStorage.new(@bag,96,0,304,32+ITEMSVISIBLE*32) @@ -612,0 +660,2 @@ + @sprites["itemwindow"].baseColor=ITEMLISTBASECOLOR + @sprites["itemwindow"].shadowColor=ITEMLISTSHADOWCOLOR @@ -613,0 +663,1 @@ + # Title @@ -618,3 +669,4 @@ - @sprites["itemtextwindow"]=Window_ColoredTextPokemon.newWithSize("",64,208,480-64,128,@viewport) - @sprites["itemtextwindow"].baseColor=Color.new(31*8,31*8,31*8) - @sprites["itemtextwindow"].shadowColor=Color.new(12*8,12*8,12*8) + # Item description + @sprites["itemtextwindow"]=Window_UnformattedTextPokemon.newWithSize("",64,208,480-64,128,@viewport) + @sprites["itemtextwindow"].baseColor=ITEMTEXTBASECOLOR + @sprites["itemtextwindow"].shadowColor=ITEMTEXTSHADOWCOLOR @@ -622,1 +674,1 @@ - @sprites["helpwindow"]=Window_ColoredTextPokemon.new("") + @sprites["helpwindow"]=Window_UnformattedTextPokemon.new("") @@ -625,0 +677,1 @@ + # Letter-by-letter message window @@ -641,0 +694,1 @@ + # Draw title at upper left corner ("Toss Item/Withdraw Item") @@ -642,2 +696,2 @@ - Color.new(31*8,31*8,31*8), - Color.new(12*8,12*8,12*8) + TITLEBASECOLOR, + TITLESHADOWCOLOR @@ -723,0 +777,3 @@ + # Implements methods that act on arrays of items. Each element + # in an item array is itself an array of [itemID, itemCount] + # Determines the quantity of an item from item array, maximum size per slot, and item ID @@ -733,0 +790,1 @@ + # Deletes an item from item array, maximum size per slot, item, and number of items to delete @@ -795,2 +853,2 @@ - MAXPERSLOT=99 - MAXPOCKETSIZE=[0,256,-1,-1,-1,-1] + MAXPERSLOT=99 # Maximum number of items per item slot + MAXPOCKETSIZE=[0,256,-1,-1,-1,-1] # Maximum size per pocket @@ -800,0 +858,1 @@ + # Initialize each pocket of the array @@ -809,0 +868,1 @@ + # Gets the index of the current selected item in the pocket @@ -813,0 +873,1 @@ + # Clears the entire bag @@ -818,0 +879,1 @@ + # Sets the index of the current selected item in the pocket @@ -822,0 +884,1 @@ + # Registers the item as a key item. Can be retrieved with $PokemonBag.registeredItem @@ -869,0 +932,1 @@ + # Start storage with a Potion @@ -927,0 +991,1 @@ + # UI logic for the item screen when an item is to be held by a Pokemon. @@ -934,0 +999,1 @@ + # Key items and hidden machines can't be held @@ -944,0 +1010,1 @@ + # UI logic for the item screen for choosing a Berry @@ -964,0 +1031,1 @@ + # UI logic for tossing an item in the item screen. @@ -993,0 +1061,1 @@ + # UI logic for withdrawing an item in the item screen. @@ -1034,0 +1103,1 @@ + # If the item was held, delete the item from storage @@ -1045,0 +1115,1 @@ + # UI logic for depositing an item in the item screen. @@ -1090,0 +1161,1 @@ + # Generate command list depending on current pocket @@ -1122,2 +1194,2 @@ -begin - itemname=PBItems.getName(item) + # Show commands generated above + itemname=PBItems.getName(item) # Get item name @@ -1126,1 +1198,1 @@ - if pocket==3 + if pocket==3 # TMs/HMs @@ -1141,2 +1213,2 @@ - elsif cmdTag>=0 && command==cmdTag - elsif cmdRegister>=0 && command==cmdRegister + elsif cmdTag>=0 && command==cmdTag # Berry tag + elsif cmdRegister>=0 && command==cmdRegister # Register key item @@ -1145,1 +1217,1 @@ - elsif cmdGive>=0 && command==cmdGive + elsif cmdGive>=0 && command==cmdGive # Give item to Pokemon @@ -1151,0 +1223,1 @@ + # Give item to a Pokemon @@ -1169,3 +1242,0 @@ -rescue - p $!.message, $!.backtrace -end Changed: PokemonItems @@ -16,1 +16,1 @@ - window=Window_SimpleTextPokemon.new(text) + window=Window_UnformattedTextPokemon.new(text) @@ -21,2 +21,1 @@ - window.letterbyletter=false - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) Changed: PokemonScreen @@ -1,6 +1,1 @@ - - - - - - +# Data structure representing mail that the Pokemon can hold @@ -10,3 +5,3 @@ - @item=item - @message=message - @sender=sender + @item=item # Item represented by this mail + @message=message # Message text + @sender=sender # Name of the message's sender @@ -543,1 +538,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -561,1 +556,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -581,2 +576,1 @@ -# @sprites["messagebox"].baseColor=Color.new(72,72,72) -# @sprites["messagebox"].shadowColor=Color.new(208,208,208) + @@ -592,2 +586,2 @@ - @sprites["messagebox"]=Window_SimpleTextPokemon.new("") - @sprites["helpwindow"]=Window_ColoredTextPokemon.new(starthelptext) + @sprites["messagebox"]=Window_AdvancedTextPokemon.new("") + @sprites["helpwindow"]=Window_UnformattedTextPokemon.new(starthelptext) @@ -740,1 +734,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -768,1 +762,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -774,1 +768,1 @@ - Audio.se_play("Audio/SE/Choose.wav") if @sprites["messagebox"].pausing? + Audio.se_play(pbGetDecisionSE) if @sprites["messagebox"].pausing? @@ -911,0 +905,1 @@ + # Store mail if a message was written @@ -987,1 +982,1 @@ - if !pbIsMail?(item) || pbMailScreen(item,pkmn) + if !pbIsMail?(item) || pbMailScreen(item,pkmn) # Open the mail screen if necessary @@ -1051,0 +1046,1 @@ +# Checks for identical species @@ -1059,0 +1055,1 @@ +# Checks for identical held items @@ -1216,0 +1213,1 @@ + # Build the commands @@ -1218,0 +1216,1 @@ + # Commands for debug mode only @@ -1223,0 +1222,1 @@ + # Check for hidden moves and add any that were found @@ -1324,1 +1324,1 @@ - when 1 + when 1 # Cheat Codes @@ -1327,1 +1327,1 @@ - when 2 + when 2 # Set Level @@ -1336,1 +1336,1 @@ - when 3 + when 3 # Change Species @@ -1347,1 +1347,1 @@ - when 4 + when 4 # Set Nature @@ -1370,1 +1370,1 @@ - when 5 + when 5 # Set Gender @@ -1402,1 +1402,1 @@ - when 6 + when 6 # Duplicate @@ -1408,1 +1408,1 @@ - when 7 + when 7 # Delete Changed: PokemonStorage @@ -1486,1 +1486,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1671,1 +1671,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) @@ -1881,1 +1881,1 @@ - msgwindow=Window_SimpleTextPokemon.new(message) + msgwindow=Window_UnformattedTextPokemon.new(message) @@ -1920,1 +1920,1 @@ - msgwindow=Window_SimpleTextPokemon.new(message) + msgwindow=Window_UnformattedTextPokemon.new(message) Changed: PokemonTrading @@ -165,1 +165,1 @@ - Audio.se_play("Audio/SE/Choose.wav") + Audio.se_play(pbGetDecisionSE) Changed: PokemonDebug @@ -801,1 +801,2 @@ - _INTL("USE PC") + _INTL("USE PC"), + _INTL("CLEAR BOXES") @@ -939,1 +940,1 @@ - Kernel.pbMessage(_INTL("Please put a save from Pokemon Ruby US, name it ruby.sav, and try again.")) + Kernel.pbMessage(_INTL("Please put a save from Pokemon Ruby/Emerald/Sapphire, name it ruby.sav, and try again.")) @@ -941,1 +942,1 @@ - File.open("Ruby.sav","rb"){|f| + File.open("Ruby.sav","rb"){|f| @@ -943,0 +944,5 @@ + realpos=0 + f.pos=4 + if f.read(13)=="SharkPortSave" + realpos=0x6C + end @@ -944,1 +950,1 @@ - f.pos=0x1000*i-12 + f.pos=0x1000*i-12+realpos @@ -950,2 +956,4 @@ - f.pos=index*0x1000 - data+=f.read(0xF80) + if index>=0 + f.pos=index*0x1000+realpos + data+=f.read(0xF80) + end @@ -960,-1 +968,10 @@ + end + if Kernel.pbConfirmMessage(_INTL("Use this save file's party?")) + partyIndex=findIndex(positions){|item| item==1} + if partyIndex>=0 + f.pos=partyIndex*0x1000+0x234+realpos + count=f.fgetdw + for i in 0...count + $Trainer.party[i]=pbLoadFromFile(f.read(80)) + f.pos+=20 + end @@ -1014,0 +1033,7 @@ + elsif ret==23 + for i in 0...PokemonStorage::MAXBOXES + for j in 0...PokemonBox::MAXPOKEMON + $PokemonStorage[i,j]=nil + end + end + Kernel.pbMessage(_INTL("The Boxes were cleared.")) Added: RandomMap Changed: PokemonOption Changed: PokemonDayCare Changed: PokemonPokedex Changed: PokemonAnimEditor Changed: PokemonMenu Changed: DrawText Changed: Scene_Map Changed: PokemonPhone Changed: Pokegear Changed: EventScene Changed: PokemonField Changed: Game_Map* Changed: PokemonMart Changed: PokeBattle_ActualScene Changed: PokemonTrainers Changed: PokemonTilesetEditor Changed: PokemonEntry Changed: Compiler Changed: PokeBattle_BattlePalace Changed: PokemonEvolution Changed: Audio Changed: PokemonEditor Changed: PokemonMessages Changed: PBDebug Changed: SpriteWindow Changed: PokemonSystem Changed: PokemonSummary Changed: PokemonUtilities Changed: PokemonBag Changed: PokemonItems Changed: PokemonScreen Changed: PokemonStorage Changed: PokemonTrading Changed: PokemonDebug