Changed: TilemapXP @@ -16,0 +16,2 @@ + +#Console::setup_console @@ -114,0 +116,1 @@ + #echoln "changing tone" @@ -117,1 +120,1 @@ - sprite.tone=@tone + sprite.tone=@tone if sprite.is_a?(Sprite) @@ -125,0 +128,1 @@ + #echoln "changing color" @@ -128,1 +132,1 @@ - sprite.color=@color + sprite.color=@color if sprite.is_a?(Sprite) @@ -135,0 +139,1 @@ +# echoln @autosprites.length+@tiles.length @@ -665,0 +670,1 @@ + #echo "refreshing priorectautos" @@ -668,0 +674,1 @@ + # "next" means "return" here @@ -672,0 +679,1 @@ + #echoln "checking #{@priorectautos.length} of #{@prioautotiles.length}" @@ -678,1 +686,1 @@ - bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000 + bitmap.fill_rect(xpos,ypos,0,0,trans) @@ -686,3 +694,1 @@ - if overallcount>2000 - count=addTile(@autosprites,count,xpos,ypos,id) - elsif id>=384 + if id>=384 @@ -708,1 +714,1 @@ - Graphics.frame_reset if overallcount>2000 + Graphics.frame_reset if overallcount>500 Changed: PokemonOption @@ -197,0 +197,1 @@ + oldscreensize=$PokemonSystem.screensize @@ -201,0 +202,1 @@ + oldtilemap=$PokemonSystem.tilemap @@ -203,4 +205,6 @@ - ObjectSpace.each_object(TilemapLoader){|o| - next if o.disposed? - o.updateClass - } + if oldscreensize!=option[5] || oldtilemap!=option[6] + ObjectSpace.each_object(TilemapLoader){|o| + next if o.disposed? + o.updateClass + } + end Changed: PokemonAnimEditor @@ -709,1 +709,1 @@ -def pbSpriteHitTest(sprite,x,y,usealpha=true,debug=false) +def pbSpriteHitTest(sprite,x,y,usealpha=true,wholecanvas=false) @@ -716,0 +716,9 @@ + if !wholecanvas + xwidth=width-128 + xheight=height-128 + width=128 if width>128 + height=128 if height>128 + else + xwidth=0 + xheight=0 + end @@ -720,0 +729,2 @@ + spritex+=xwidth + spritey+=xheight @@ -1034,2 +1045,0 @@ - @animbitmap=BitmapCache.animation( - @animation.graphic,@animation.hue) @@ -1037,3 +1046,0 @@ - # The cache creates a 32x32 bitmap when given - # an empty string. Dispose it. - @animbitmap.dispose if @animbitmap @@ -1041,0 +1047,7 @@ + else + begin + @animbitmap=BitmapCache.animation( + @animation.graphic,@animation.hue) + rescue + @animbitmap=nil + end @@ -1076,1 +1089,1 @@ - @player=PBAnimationPlayer.new(self.animation, + @player=PBAnimationPlayer.new(@animation, @@ -1237,0 +1250,4 @@ + def getCurrentFrame + return nil if @currentframe>=@animation.length + return @animation[@currentframe] + end @@ -1240,1 +1257,1 @@ - if mousepos && pbSpriteHitTest(self,mousepos[0],mousepos[1]) + if mousepos && pbSpriteHitTest(self,mousepos[0],mousepos[1],false,true) @@ -1246,1 +1263,1 @@ - if pbSpriteHitTest(@sprites[j],mousepos[0],mousepos[1],usealpha,true) + if pbSpriteHitTest(@sprites[j],mousepos[0],mousepos[1],usealpha,false) @@ -1262,2 +1279,7 @@ - @selectOffsetX=cel[AnimFrame::X]-mousepos[0] - @selectOffsetY=cel[AnimFrame::Y]-mousepos[1] + if @animation.position==3 || cel[AnimFrame::PATTERN]<0 + @selectOffsetX=cel[AnimFrame::X]-mousepos[0] + @selectOffsetY=cel[AnimFrame::Y]-mousepos[1] + else + @selectOffsetX=cel[AnimFrame::X]-mousepos[0]+352 + @selectOffsetY=cel[AnimFrame::Y]-mousepos[1]+108 + end @@ -1268,0 +1290,10 @@ + currentFrame=getCurrentFrame + if currentFrame && !@selecting && Input.repeatex?(0x09) # Tab + currentFrame.length.times { + @currentcel+=1 + @currentcel=0 if @currentcel>=currentFrame.length + break if currentFrame[@currentcel] + } + invalidate + return + end @@ -1269,2 +1301,7 @@ - cel[AnimFrame::X]=mousepos[0]+@selectOffsetX - cel[AnimFrame::Y]=mousepos[1]+@selectOffsetY + if @animation.position==3 || cel[AnimFrame::PATTERN]<0 + cel[AnimFrame::X]=mousepos[0]+@selectOffsetX + cel[AnimFrame::Y]=mousepos[1]+@selectOffsetY + else + cel[AnimFrame::X]=mousepos[0]+@selectOffsetX-352 + cel[AnimFrame::Y]=mousepos[1]+@selectOffsetY-108 + end @@ -1317,0 +1354,1 @@ + cel[AnimFrame::X]-=(cel[AnimFrame::X]%increment) @@ -1318,1 +1356,3 @@ - cel[AnimFrame::X]=0 if cel[AnimFrame::X]<0 + if @animation.position==3 || cel[AnimFrame::PATTERN]<0 + cel[AnimFrame::X]=0 if cel[AnimFrame::X]<0 + end @@ -1322,0 +1362,1 @@ + cel[AnimFrame::X]-=(cel[AnimFrame::X]%increment) @@ -1328,1 +1369,3 @@ - cel[AnimFrame::Y]=0 if cel[AnimFrame::Y]<0 + if @animation.position==3 || cel[AnimFrame::PATTERN]<0 + cel[AnimFrame::Y]=0 if cel[AnimFrame::Y]<0 + end @@ -1350,0 +1393,1 @@ + count=0 @@ -1351,1 +1395,1 @@ - if @dirty[i] && @sprites[i] + if @dirty[i] && @sprites[i] @@ -1354,0 +1398,6 @@ + if @animation.position!=3 && + @animation[@currentframe][i] && + @animation[@currentframe][i][AnimFrame::PATTERN]>=0 + @sprites[i].x+=352 + @sprites[i].y+=108 + end @@ -2002,1 +2052,4 @@ - window.text=sprintf("(%d,%d)",mouse[0],mouse[1]) + newtext=sprintf("(%d,%d)",mouse[0],mouse[1]) + if window.text!=newtext + window.text=nextext + end @@ -2276,0 +2329,67 @@ + +def dumpBase64Anim(s) + return [Zlib::Deflate.deflate(Marshal.dump(s))].pack("m").gsub(/\n/,"\r\n") +end +def loadBase64Anim(s) + return Marshal.restore(StringInput.new(Zlib::Inflate.inflate(s.unpack("m")[0]))) +end + +def pbExportAnim(animations) +filename=Kernel.pbMessageFreeText(_INTL("Enter a filename."),"",false,32) +if filename!="" + begin + filename+=".anm" + File.open(filename,"wb"){|f| + f.write(dumpBase64Anim(animations[animations.selected])) + } + failed=false + rescue + Kernel.pbMessage(_INTL("Couldn't save the animation to {1}.",filename)) + failed=true + end + if !failed + Kernel.pbMessage(_INTL("Animation was saved to {1} in the game folder.",filename)) + Kernel.pbMessage(_INTL("It's a text file, so it can be transferred to others easily.")) + end +end +end +def pbImportAnim(animations,canvas,animwin) + animfiles=[] + pbRgssChdir(".") { + animfiles.concat(Dir.glob("*.anm")) + } + cmdwin=AdaptedCommand.new(animfiles,320) + cmdwin.opacity=200 + cmdwin.height=480 + cmdwin.viewport=canvas.viewport + loop do + Graphics.update + Input.update + cmdwin.update + if (Input.trigger?(Input::C) || cmdwin.doubleclick?) && animfiles.length>0 + begin + textdata=loadBase64Anim(IO.read(animfiles[cmdwin.index])) + throw "Bad data" if !textdata.is_a?(PBAnimation) + animations[animations.selected]=textdata + rescue + Kernel.pbMessage(_INTL("The animation is invalid or could not be loaded.")) + next + end + graphic=animations[animations.selected].graphic + graphic="Graphics/Animations/#{graphic}" + if graphic && graphic!="" && !FileTest.image_exist?(graphic) + Kernel.pbMessage(_INTL("The animation file {1} was not found. The animation will load anyway.",graphic)) + end + canvas.loadAnimation(animations[animations.selected]) + animwin.animbitmap=canvas.animbitmap + animations.selected=cmdwin.index + break + end + if Input.trigger?(Input::B) + break + end + end + cmdwin.dispose + return +end + @@ -2447,3 +2567,2 @@ - "from being moved or deleted.\nHolding Alt will enable finer selection of "+ - "cels on the canvas." - cmdwin=Window_SimpleTextPokemon.newWithSize(helptext,0,0,480,480) + "from being moved or deleted.\nAlso press TAB to select a cell on the canvas." + cmdwin=Window_SimpleTextPokemon.newWithSize("",0,0,480,480) @@ -2452,0 +2571,1 @@ + cmdwin.text=helptext @@ -2477,0 +2597,1 @@ + @oldname=nil @@ -2481,1 +2602,5 @@ - @window.text=_INTL("Name: {1}",@canvas.animation.name) + newtext=_INTL("Name: {1}",@canvas.animation.name) + if @oldname!=newtext + @window.text=newtext + @oldname=newtext + end @@ -2628,1 +2753,1 @@ - sidewin.addControl(Button.new(_INTL("Help"))) + sidewin.addButton(_INTL("More Commands")) @@ -2652,1 +2777,4 @@ - if Input.triggerex?(0x02) && sliderwin.hittest?(0) # Right mouse button + if Input.trigger?(Input::F5) + pbHelpWindow + next + elsif Input.triggerex?(0x02) && sliderwin.hittest?(0) # Right mouse button @@ -2680,2 +2808,1 @@ - end - if Input.triggerex?(0x51) # Q + elsif Input.triggerex?(0x51) # Q @@ -2687,2 +2814,1 @@ - end - if Input.triggerex?(0x02) # Right mouse button + elsif Input.triggerex?(0x02) # Right mouse button @@ -2770,1 +2896,10 @@ - pbHelpWindow + cmd=Kernel.pbShowCommands(nil,[ + _INTL("Import Animation"), + _INTL("Export Animation"), + _INTL("Help") + ]) + case cmd + when 0;pbImportAnim(animation,canvas,animwin); + when 1;pbExportAnim(animation) + when 2;pbHelpWindow + end Added: PokemonBerries Changed: PerspectiveTilemap @@ -380,1 +380,3 @@ - prio=[2,@priorities[pos]].min + priopos=@priorities[pos] + priopos=0 if !priopos + prio=(2= 2 - Audio.se_play("Audio/SE/Choose.wav") - @index = (@index + 1) % digits - refresh - end - elsif Input.repeat?(Input::LEFT) - if digits >= 2 - Audio.se_play("Audio/SE/Choose.wav") - @index = (@index + digits - 1) % digits - refresh - end - end - end - private - def textHelper(x,y,text,i) - textwidth=self.contents.text_size(text).width - self.contents.font.color=@shadowColor - pbDrawShadow(self.contents,x+(12-textwidth/2),y, textwidth+4, 32, text) - self.contents.font.color=@baseColor - self.contents.draw_text(x+(12-textwidth/2),y, textwidth+4, 32, text) - if @index==i - self.contents.fill_rect(x+(12-textwidth/2),y+30,textwidth,2,Color.new(0,0,0)) - end - end Changed: Game_Event* @@ -86,0 +86,3 @@ + def setVariable(variable) + $PokemonGlobal.eventvars[[@map_id,@event.id]]=variable + end Changed: PBAnimation @@ -397,1 +397,1 @@ - MAXSPRITES=24 + MAXSPRITES=30 @@ -462,2 +462,0 @@ - else - @array[pos][i]=nil Changed: Audio @@ -213,0 +213,1 @@ + rescue Hangup Changed: Game_Character 1 @@ -1,6 +1,0 @@ -#============================================================================== -# ■ Game_Character (分割定義 1) -#------------------------------------------------------------------------------ -#  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event -# クラスのスーパークラスとして使用されます。 -#============================================================================== @@ -9,19 +3,16 @@ - #-------------------------------------------------------------------------- - # ● 公開インスタンス変数 - #-------------------------------------------------------------------------- - attr_reader :id # ID - attr_reader :x # マップ X 座標 (論理座標) - attr_reader :y # マップ Y 座標 (論理座標) - attr_reader :real_x # マップ X 座標 (実座標 * 128) - attr_reader :real_y # マップ Y 座標 (実座標 * 128) - attr_reader :tile_id # タイル ID (0 なら無効) - attr_accessor :character_name # キャラクター ファイル名 - attr_accessor :character_hue # キャラクター 色相 - attr_reader :opacity # 不透明度 - attr_reader :blend_type # 合成方法 - attr_reader :direction # 向き - attr_reader :pattern # パターン - attr_reader :move_route_forcing # 移動ルート強制フラグ - attr_accessor :through # すり抜け - attr_accessor :animation_id # アニメーション ID - attr_accessor :transparent # 透明状態 + attr_reader :id + attr_reader :x + attr_reader :y + attr_reader :real_x + attr_reader :real_y + attr_reader :tile_id + attr_accessor :character_name + attr_accessor :character_hue + attr_reader :opacity + attr_reader :blend_type + attr_reader :direction + attr_reader :pattern + attr_reader :move_route_forcing + attr_accessor :through + attr_accessor :animation_id + attr_accessor :transparent @@ -31,3 +22,0 @@ - #-------------------------------------------------------------------------- - # ● オブジェクト初期化 - #-------------------------------------------------------------------------- @@ -79,3 +67,0 @@ - #-------------------------------------------------------------------------- - # ● 移動中判定 - #-------------------------------------------------------------------------- @@ -83,1 +68,0 @@ - # 論理座標と実座標が違っていれば移動中 @@ -86,3 +70,0 @@ - #-------------------------------------------------------------------------- - # ● ジャンプ中判定 - #-------------------------------------------------------------------------- @@ -90,1 +71,0 @@ - # ジャンプカウントが 0 より大きければジャンプ中 @@ -93,3 +73,0 @@ - #-------------------------------------------------------------------------- - # ● 姿勢の矯正 - #-------------------------------------------------------------------------- @@ -97,1 +74,0 @@ - # 移動時アニメまたは停止時アニメが ON の場合 @@ -99,1 +75,0 @@ - # パターンを 0 に設定 @@ -102,1 +77,0 @@ - # アニメカウントをクリア @@ -104,1 +78,0 @@ - # ロック前の向きをクリア @@ -107,4 +80,0 @@ - #-------------------------------------------------------------------------- - # ● 移動ルートの強制 - # move_route : 新しい移動ルート - #-------------------------------------------------------------------------- @@ -112,1 +81,0 @@ - # オリジナルの移動ルートを保存 @@ -117,1 +85,0 @@ - # 移動ルートを変更 @@ -120,1 +87,0 @@ - # 移動ルート強制フラグをセット @@ -122,1 +88,0 @@ - # ロック前の向きをクリア @@ -124,1 +89,0 @@ - # ウェイトカウントをクリア @@ -126,1 +90,0 @@ - # カスタム移動 @@ -129,6 +92,0 @@ - #-------------------------------------------------------------------------- - # ● 通行可能判定 - # x : X 座標 - # y : Y 座標 - # d : 方向 (0,2,4,6,8) ※ 0 = 全方向通行不可の場合を判定 (ジャンプ用) - #-------------------------------------------------------------------------- @@ -167,3 +124,0 @@ - #-------------------------------------------------------------------------- - # ● ロック - #-------------------------------------------------------------------------- @@ -171,1 +125,0 @@ - # すでにロックされている場合 @@ -173,1 +126,0 @@ - # メソッド終了 @@ -176,1 +128,0 @@ - # ロック前の向きを保存 @@ -178,1 +129,0 @@ - # プレイヤーの方を向く @@ -180,1 +130,0 @@ - # ロック中フラグをセット @@ -183,3 +132,0 @@ - #-------------------------------------------------------------------------- - # ● ロック中判定 - #-------------------------------------------------------------------------- Changed: PokemonMessages @@ -1,0 +1,29 @@ +######### + +class Game_Temp + attr_writer :message_window_showing + attr_writer :player_transferring + attr_writer :transition_processing + def message_window_showing + @message_window_showing=false if !@message_window_showing + return @message_window_showing + end + def player_transferring + @player_transferring=false if !@player_transferring + return @player_transferring + end + def transition_processing + @transition_processing=false if !@transition_processing + return @transition_processing + end +end + +class Game_System + attr_writer :message_position + def message_position + @message_position=2 if !@message_position + return @message_position + end +end + + @@ -11,1 +40,5 @@ - $game_screen.update + if $game_screen + $game_screen.update + else + $game_map.screen.update + end @@ -28,19 +61,32 @@ - oldmws=$game_temp.message_window_showing - $game_temp.message_window_showing=true - # Update system (timer) and screen - $game_system.update - $game_screen.update - # If timer has reached 0 - if $game_system.timer_working and $game_system.timer == 0 - # Abort battle - $game_temp.battle_abort = true - end - # Update windows - @help_window.update - @party_command_window.update - @actor_command_window.update - @status_window.update - $game_temp.message_window_showing=oldmws - @message_window.update - # Update sprite set - @spriteset.update + if self.respond_to?("update_basic") + update_basic(true) + update_info_viewport # Update information viewport + if $game_message.visible + @info_viewport.visible = false + @message_window.visible = true + end + else + oldmws=$game_temp.message_window_showing + $game_temp.message_window_showing=true + # Update system (timer) and screen + $game_system.update + if $game_screen + $game_screen.update + else + $game_map.screen.update + end + # If timer has reached 0 + if $game_system.timer_working and $game_system.timer == 0 + # Abort battle + $game_temp.battle_abort = true + end + # Update windows + @help_window.update + @party_command_window.update + @actor_command_window.update + @status_window.update + $game_temp.message_window_showing=oldmws + @message_window.update + # Update sprite set + @spriteset.update + end @@ -78,1 +124,1 @@ - return "frlgtextskin" + return MessageConfig::TextSkinName @@ -156,4 +202,1 @@ - -class Interpreter - # Gets the next index in the interpreter, ignoring - # certain events between messages +module InterpreterMixin @@ -208,0 +251,2 @@ + # Gets the next index in the interpreter, ignoring + # certain events between messages @@ -232,0 +277,129 @@ + def pbShowPicture(number,name,origin,x,y,zoomX=100,zoomY=100,opacity=255,blendType=0) + number = number + ($game_temp.in_battle ? 50 : 0) + $game_screen.pictures[number].show(name,origin, + x, y, zoomX,zoomY,opacity,blendType) + end + def pbEraseThisEvent + $game_map.events[@event_id].erase + $PokemonMap.addErasedEvent(@event_id) if $PokemonMap + @index+=1 + return true + end + def pbCommonEvent(id) + if $game_temp.in_battle + $game_temp.common_event_id = id + else + commonEvent = $data_common_events[id] + $game_system.battle_interpreter.setup(commonEvent.list, 0) + end + end + def pbSetSelfSwitch(event,swtch,value) + $game_self_switches[[@map_id,event,swtch]]=value + $game_map.need_refresh = true + end + def pbPushThisEvent + event=get_character(0) + oldx=event.x + oldy=event.y + # Apply strict version of passable, which makes impassable + # tiles that are passable only from certain directions + if !event.passableStrict?(event.x,event.y,$game_player.direction) + return + end + case $game_player.direction + when 2 # down + event.move_down + when 4 # left + event.move_left + when 6 # right + event.move_right + when 8 # up + event.move_up + end + $PokemonMap.addMovedEvent(@event_id) if $PokemonMap + if oldx!=event.x || oldy!=event.y + $game_player.lock + begin + Graphics.update + Input.update + pbUpdateSceneMap + end until !event.moving? + $game_player.unlock + end + end +end + +class Game_Interpreter + include InterpreterMixin + def command_101 + if $game_temp.message_window_showing + return false + end + message="" + commands=nil + numInputVar=nil + numInputDigitsMax=nil + text="" + facename=@list[@index].parameters[0] + faceindex=@list[@index].parameters[1] + if facename && facename!="" + text+="\\ff[#{facename},#{faceindex}]" + end + $game_message.background=@list[@index].parameters[2] + $game_system.message_position=@list[@index].parameters[3] + message+=text + messageend="" + loop do + nextIndex=pbNextIndex(@index) + code=@list[nextIndex].code + if code == 401 + text=@list[nextIndex].parameters[0] + text+=" " if text[text.length-1,1]!=" " + message+=text + @index=nextIndex + else + if code == 102 + commands=@list[nextIndex].parameters + @index=nextIndex + elsif code == 103 + numInputVar=@list[nextIndex].parameters[0] + numInputDigitsMax=@list[nextIndex].parameters[1] + @index=nextIndex + elsif code == 101 + messageend="\1" + end + break + end + end + message=_MAPINTL($game_map.map_id,message) + defaultskin=PokemonSkins.getDefaultTextSkin + if commands + cmdlist=[] + for cmd in commands[0] + cmdlist.push(_MAPINTL($game_map.map_id,cmd)) + end + command=Kernel.pbMessage(message+messageend,cmdlist,commands[1],defaultskin) + @branch[@list[@index].indent] = command + elsif numInputVar + Kernel.pbMessageChooseNumberVarNew(message+messageend,numInputVar,numInputDigitsMax,defaultskin) + else + Kernel.pbMessage(message+messageend,nil,0,defaultskin) + end + return true + end + def command_102 + command=Kernel.pbShowCommands(nil,@list[@index].parameters[0],@list[@index].parameters[1]) + @branch[@list[@index].indent] = command + Input.update # Must call Input.update again to avoid extra triggers + return true + end + def command_103 + varnumber=@list[@index].parameters[0] + $game_variables[varnumber]=Kernel.pbChooseNumberNew(nil,$game_variables[varnumber],@list[@index].parameters[1]) + Input.update # Must call Input.update again to avoid extra triggers + return true + end +end + +class Interpreter + include InterpreterMixin @@ -294,54 +468,3 @@ - def pbShowPicture(number,name,origin,x,y,zoomX=100,zoomY=100,opacity=255,blendType=0) - number = number + ($game_temp.in_battle ? 50 : 0) - $game_screen.pictures[number].show(name,origin, - x, y, zoomX,zoomY,opacity,blendType) - end - def pbEraseThisEvent - $game_map.events[@event_id].erase - $PokemonMap.addErasedEvent(@event_id) if $PokemonMap - @index+=1 - return true - end - def pbCommonEvent(id) - if $game_temp.in_battle - $game_temp.common_event_id = id - else - commonEvent = $data_common_events[id] - $game_system.battle_interpreter.setup(commonEvent.list, 0) - end - end - def pbSetSelfSwitch(event,swtch,value) - $game_self_switches[[@map_id,event,swtch]]=value - $game_map.need_refresh = true - end - def pbPushThisEvent - event=get_character(0) - oldx=event.x - oldy=event.y - # Apply strict version of passable, which makes impassable - # tiles that are passable only from certain directions - if !event.passableStrict?(event.x,event.y,$game_player.direction) - return - end - case $game_player.direction - when 2 # down - event.move_down - when 4 # left - event.move_left - when 6 # right - event.move_right - when 8 # up - event.move_up - end - $PokemonMap.addMovedEvent(@event_id) if $PokemonMap - if oldx!=event.x || oldy!=event.y - $game_player.lock - begin - Graphics.update - Input.update - pbUpdateSceneMap - end until !event.moving? - $game_player.unlock - end - end -end +end + + @@ -571,1 +694,2 @@ - if bitmap.width==192 && bitmap.height==128 + if (bitmap.width==192 && bitmap.height==128) || # RPGXP Windowskin + (bitmap.width==128 && bitmap.height==128) # RPGVX Windowskin @@ -714,1 +838,2 @@ - if $game_temp && $game_temp.in_battle + if $game_temp && $game_temp.in_battle && + !$scene.respond_to?("update_basic") @@ -732,0 +857,67 @@ + +def isDarkWindowskin(windowskin) + if !windowskin || windowskin.disposed? + return true + end + if windowskin.width==192 && windowskin.height==128 + y=8 + r=0; g=0; b=0 + 16.times { + x=8 + 16.times { + clr=windowskin.get_pixel(x,y) + r+=clr.red; g+=clr.green; b+=clr.blue + x+=16 + } + y+=16 + } + r/=256 + g/=256 + b/=256 + return (r+g+b)/3<128 + elsif windowskin.width==128 && windowskin.height==128 + y=4 + r=0; g=0; b=0 + 16.times { + x=4 + 16.times { + clr=windowskin.get_pixel(x,y) + r+=clr.red; g+=clr.green; b+=clr.blue + x+=8 + } + y+=8 + } + r/=256 + g/=256 + b/=256 + return (r+g+b)/3<128 + else + clr=windowskin.get_pixel(windowskin.width/2, windowskin.height/2) + return (clr.red+clr.green+clr.blue)/3<128 + end +end + +class FaceWindowVX < SpriteWindow_Base + def initialize(face) + super(0,0,128,128) + faceinfo=face.split(",") + begin + facebitmaptmp=RPG::Cache.load_bitmap("Graphics/Faces/",faceinfo[0]) + rescue + facebitmaptmp=RPG::Cache.load_bitmap("Graphics/Pictures/",faceinfo[0]) + end + self.contents.dispose if self.contents + faceIndex=faceinfo[1].to_i + @facebitmap=Bitmap.new(96,96) + @facebitmap.blt(0,0,facebitmaptmp,Rect.new( + (faceIndex % 4) * 96, + (faceIndex / 4) * 96, 96, 96 + )) + self.contents=@facebitmap + end + def dispose + @facebitmap.dispose if @facebitmap + super + end +end + @@ -753,1 +945,2 @@ - linecount=(Graphics.height>420) ? 3 : 2 + msgback=nil + linecount=(Graphics.height>400) ? 3 : 2 @@ -755,0 +948,6 @@ + if $game_actors + text.gsub!(/\\[Nn]\[([0-8])\]/){ + m=$1.to_i + next $game_actors[m].name + } + end @@ -773,0 +972,7 @@ + if isDarkWindowskin(msgwindow.windowskin) || + ($game_message && $game_message.background>0) || + ($game_system && $game_system.respond_to?("message_frame") && + $game_system.message_frame != 0) + textcolors[0]="" + text=""+text + end @@ -791,1 +997,1 @@ - while text[/(?:\\([WwFf]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Ww][Dd]|[Ww][Mm]|[Ww][Uu])())/i] + while text[/(?:\\([WwFf]|[Ff][Ff]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Ww][Dd]|[Ww][Mm]|[Ww][Uu])())/i] @@ -820,0 +1026,3 @@ + elsif control=="ff" + facewindow.dispose if facewindow + facewindow=FaceWindowVX.new(param) @@ -835,0 +1044,1 @@ + msgwindow.y=(Graphics.height)-(msgwindow.height) @@ -836,1 +1046,2 @@ - if $game_temp && $game_temp.in_battle + if $game_temp && $game_temp.in_battle && + !$scene.respond_to?("update_basic") @@ -855,0 +1066,12 @@ + if $game_message + case $game_message.background + when 1 # dim + msgwindow.opacity=0 + msgback=Sprite.new(msgwindow.viewport) + msgback.z=msgwindow.z-1 + msgback.bitmap=RPG::Cache.load_bitmap("Graphics/System/","MessageBack") + msgback.y=msgwindow.y + when 2 # transparent + msgwindow.opacity=0 + end + end @@ -862,0 +1085,1 @@ + Graphics.frame_reset if Graphics.frame_count>40 @@ -876,0 +1100,6 @@ + elsif control=="ff" + facewindow.dispose if facewindow + facewindow=FaceWindowVX.new(param) + pbPositionNearMsgWindow(facewindow,msgwindow,:left) + facewindow.viewport=msgwindow.viewport + facewindow.z=msgwindow.z @@ -881,2 +1111,6 @@ - else - moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold) + else + if $data_system.respond_to?("words") + moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold) + else + moneyString=_INTL("{1} {2}",$game_party.gold,Vocab.gold) + end @@ -896,0 +1130,1 @@ + msgback.y=msgwindow.y if msgback @@ -898,0 +1133,1 @@ + msgback.y=msgwindow.y if msgback @@ -900,0 +1136,1 @@ + msgback.y=msgwindow.y if msgback @@ -960,0 +1197,1 @@ + msgback.dispose if msgback Changed: SpriteWindow @@ -1,2 +1,14 @@ - -######################### +############################# +############################# + +module MessageConfig + FontName="Pokemon Emerald" + # in Graphics/Windowskins/ + TextSkinName="frlgtextskin.png" + # full path to file + ChoiceSkinName="skin1.png" +end + + +############################# +############################# @@ -11,1 +23,1 @@ - return $PokemonSystem ? $PokemonSystem.textspeed : 3 + return $PokemonSystem ? $PokemonSystem.textspeed : ((Graphics.frame_rate>40) ? 2 : 3) @@ -17,2 +29,7 @@ - if !$data_system || !$data_system.respond_to?("decision_se") || - $data_system.decision_se.name=="" + if $data_system && $data_system.respond_to?("decision_se") && + $data_system.decision_se.name!="" + return "Audio/SE/"+$data_system.decision_se.name + elsif $data_system && $data_system.respond_to?("sounds") && + $data_system.sounds[1] && $data_system.sounds[1].name!="" + return "Audio/SE/"+$data_system.sounds[1].name + else @@ -20,2 +37,0 @@ - else - return "Audio/SE/"+$data_system.decision_se.name @@ -26,1 +41,1 @@ - ["Pokemon Emerald"], + [MessageConfig::FontName], @@ -34,28 +49,28 @@ -"Graphics/Pictures/skin1.png", -"Graphics/Pictures/skin2.png", -"Graphics/Pictures/skin3.png", -"Graphics/Pictures/skin4.png", -"Graphics/Pictures/skin5.png", -"Graphics/Pictures/skin6.png", -"Graphics/Pictures/skin7.png", -"Graphics/Pictures/skin8.png", -"Graphics/Pictures/skin9.png", -"Graphics/Pictures/skin10.png", -"Graphics/Pictures/skin11.png", -"Graphics/Pictures/skin12.png", -"Graphics/Pictures/skin13.png", -"Graphics/Pictures/skin14.png", -"Graphics/Pictures/skin15.png", -"Graphics/Pictures/skin16.png", -"Graphics/Pictures/skin17.png", -"Graphics/Pictures/skin18.png", -"Graphics/Pictures/skin19.png", -"Graphics/Pictures/skin20.png", -"Graphics/Pictures/skin21.png", -"Graphics/Pictures/skin22.png", -"Graphics/Pictures/skin23.png", -"Graphics/Pictures/skin24.png", -"Graphics/Pictures/skin25.png", -"Graphics/Pictures/skin26.png", -"Graphics/Pictures/skin27.png", -"Graphics/Pictures/skin28.png" +"Graphics/Windowskins/"+MessageConfig::ChoiceSkinName, +"Graphics/Windowskins/skin2.png", +"Graphics/Windowskins/skin3.png", +"Graphics/Windowskins/skin4.png", +"Graphics/Windowskins/skin5.png", +"Graphics/Windowskins/skin6.png", +"Graphics/Windowskins/skin7.png", +"Graphics/Windowskins/skin8.png", +"Graphics/Windowskins/skin9.png", +"Graphics/Windowskins/skin10.png", +"Graphics/Windowskins/skin11.png", +"Graphics/Windowskins/skin12.png", +"Graphics/Windowskins/skin13.png", +"Graphics/Windowskins/skin14.png", +"Graphics/Windowskins/skin15.png", +"Graphics/Windowskins/skin16.png", +"Graphics/Windowskins/skin17.png", +"Graphics/Windowskins/skin18.png", +"Graphics/Windowskins/skin19.png", +"Graphics/Windowskins/skin20.png", +"Graphics/Windowskins/skin21.png", +"Graphics/Windowskins/skin22.png", +"Graphics/Windowskins/skin23.png", +"Graphics/Windowskins/skin24.png", +"Graphics/Windowskins/skin25.png", +"Graphics/Windowskins/skin26.png", +"Graphics/Windowskins/skin27.png", +"Graphics/Windowskins/skin28.png" @@ -125,0 +140,3 @@ + end + if bitmap.font && bitmap.font.respond_to?("shadow") + bitmap.font.shadow=false @@ -714,1 +732,1 @@ - @compat=!(self.is_a?(SpriteWindow)) + @compat=true @@ -917,0 +935,1 @@ + # Body = X, Y, width, height of body rectangle within windowskin @@ -918,0 +937,1 @@ + # Trim = X, Y, width, height of trim rectangle within windowskin @@ -928,0 +948,3 @@ + rescue Errno::ENOENT + p @skinrect, @trim + # ignore @@ -1385,1 +1408,10 @@ - self.windowskin=@sysframe + __setWindowskin(@sysframe) + end + def __setWindowskin(skin) + if skin && (skin.width==192 && skin.height==128) || # RPGXP Windowskin + (skin.width==128 && skin.height==128) # RPGVX Windowskin + self.skinformat=0 + else + self.skinformat=1 + end + self.windowskin=skin @@ -1390,1 +1422,1 @@ - self.windowskin=@customskin + __setWindowskin(@customskin) @@ -1394,1 +1426,1 @@ - self.windowskin=@sysframe + __setWindowskin(@sysframe) @@ -1403,1 +1435,1 @@ - self.windowskin=@sysframe + __setWindowskin(@sysframe) @@ -2230,0 +2262,96 @@ +class Window_InputNumberPokemon < SpriteWindow_Base + attr_reader :number + attr_reader :sign + def initialize(digits_max) + @digits_max=digits_max + @number=0 + @sign=false + @negative=false + super(0,0,digits_max*24+40,64) + @baseColor=Color.new(12<<3,12<<3,12<<3) + @shadowColor=Color.new(26<<3,26<<3,26<<3) + @selarrow=BitmapCache.load_bitmap("Graphics/Pictures/selarrow.png") + @index=digits_max-1 + refresh + end + def number + @number*(@sign && @negative ? -1 : 1) + end + def sign=(value) + @sign=value + self.width=@digits_max*24+40+(@sign ? 24 : 0) + @index=(@digits_max-1)+(@sign ? 1 : 0) + refresh + end + def dispose + @selarrow.dispose + super + end + def number=(number) + if @sign + @number = [number, 10 ** @digits_max - 1].min + else + @number = [[number, 0].max, 10 ** @digits_max - 1].min + end + refresh + end + def refresh + self.contents=pbDoEnsureBitmap(self.contents,self.width-32,self.height-32) + pbSetSystemFont(self.contents) + self.contents.clear + s=sprintf("%0*d",@digits_max,@number.abs) + x=0 + if @sign + textHelper(0,0,@negative ? "-" : "+",0) + end + for i in 0...@digits_max + index=i+(@sign ? 1 : 0) + textHelper(index*24,0,s[i,1],index) + end + end + def update + super + digits=@digits_max+(@sign ? 1 : 0) + if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN) + Audio.se_play(pbGetDecisionSE) + if @index==0 && @sign + @negative=!@negative + else + place = 10 ** (digits - 1 - @index) + n = @number / place % 10 + @number -= n*place + if Input.repeat?(Input::UP) + n = (n + 1) % 10 + elsif Input.repeat?(Input::DOWN) + n = (n + 9) % 10 + end + @number += n*place + end + refresh + elsif Input.repeat?(Input::RIGHT) + if digits >= 2 + Audio.se_play(pbGetDecisionSE) + @index = (@index + 1) % digits + refresh + end + elsif Input.repeat?(Input::LEFT) + if digits >= 2 + Audio.se_play(pbGetDecisionSE) + @index = (@index + digits - 1) % digits + refresh + end + end + end + private + def textHelper(x,y,text,i) + textwidth=self.contents.text_size(text).width + self.contents.font.color=@shadowColor + pbDrawShadow(self.contents,x+(12-textwidth/2),y, textwidth+4, 32, text) + self.contents.font.color=@baseColor + self.contents.draw_text(x+(12-textwidth/2),y, textwidth+4, 32, text) + if @index==i + self.contents.fill_rect(x+(12-textwidth/2),y+30,textwidth,2,Color.new(0,0,0)) + end + end +end + Changed: PokemonUtilities @@ -119,1 +119,3 @@ - def pbCreatePokemon + +#For demonstration purposes only, not to be used in a real game. +def pbCreatePokemon @@ -129,1 +131,1 @@ - end +end @@ -1093,0 +1095,1 @@ + return false if id<0 @@ -1292,0 +1295,73 @@ + + +def pbGetCurrentRegion + mappos=!$game_map ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition) + if !mappos + return -1 # No region defined + else + return mappos[0] + end +end + +class RegionalStorage + def initialize + @storages=[] + @lastmap=-1 + @rgnmap=-1 + end + def getCurrentStorage + if !$game_map + raise _INTL("The player is not on a map, so the region could not be determined.") + end + if @lastmap!=$game_map.map_id + @rgnmap=pbGetCurrentRegion # may access file IO, so caching result + @lastmap=$game_map.map_id + end + if @rgnmap<0 + raise _INTL("The current map has no region set. Please set the MapPosition metadata setting for this map.") + end + if !@storages[@rgnmap] + @storages[@rgnmap]=PokemonStorage.new + end + return @storages[@rgnmap] + end + def boxes + return getCurrentStorage.boxes + end + def party + return getCurrentStorage.party + end + def currentBox + return getCurrentStorage.currentBox + end + def currentBox=(value) + getCurrentStorage.currentBox=value + end + def [](x,y=nil) + getCurrentStorage[x,y] + end + def []=(x,y,value) + getCurrentStorage[x,y]=value + end + def full? + getCurrentStorage.full? + end + def pbFirstFreePos(box) + getCurrentStorage.pbFirstFreePos(box) + end + def pbCopy(boxDst,indexDst,boxSrc,indexSrc) + getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc) + end + def pbMove(boxDst,indexDst,boxSrc,indexSrc) + getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc) + end + def pbMoveCaughtToParty(pkmn) + getCurrentStorage.pbMoveCaughtToParty(pkmn) + end + def pbStoreCaught(pkmn) + getCurrentStorage.pbStoreCaught(pkmn) + end + def pbDelete(box,index) + getCurrentStorage.pbDelete(pkmn) + end +end Changed: PokemonBag @@ -936,0 +936,20 @@ + return item + end + def pbChooseBerryScreen + oldlastpocket=@bag.lastpocket + @bag.lastpocket=4 + @scene.pbStartScene(@bag) + item=0 + loop do + item=@scene.pbChooseItem + break if item==0 + itemname=PBItems.getName(item) + if $ItemData[item][ITEMPOCKET]!=4 + @scene.pbDisplay(_INTL("That's not a Berry.",itemname)) + next + else + break + end + end + @scene.pbEndScene + @bag.lastpocket=oldlastpocket Changed: TilemapXP Changed: PokemonOption Changed: PokemonAnimEditor Added: PokemonBerries Changed: PerspectiveTilemap Changed: PokemonField Changed: PokeBattle_ActualScene Changed: PokemonTrainers Changed: SpriteResizer Changed: BitmapCache Changed: Game_Character 3* Changed: PokemonEntry Changed: Game_Event* Changed: PBAnimation Changed: Audio Changed: Game_Character 1 Changed: PokemonMessages Changed: SpriteWindow Changed: PokemonUtilities Changed: PokemonBag