Diego-Mertens

FaceSistem - Diego Mertens

Jun 30th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.70 KB | None | 0 0
  1. #===============================================================================
  2. # Message variables
  3. #===============================================================================
  4. class Game_Temp
  5. attr_accessor :background
  6. attr_writer :message_window_showing
  7. attr_writer :player_transferring
  8. attr_writer :transition_processing
  9.  
  10. def message_window_showing
  11. @message_window_showing = false if !@message_window_showing
  12. return @message_window_showing
  13. end
  14.  
  15. def player_transferring
  16. @player_transferring = false if !@player_transferring
  17. return @player_transferring
  18. end
  19.  
  20. def transition_processing
  21. @transition_processing = false if !@transition_processing
  22. return @transition_processing
  23. end
  24. end
  25.  
  26.  
  27.  
  28. class Game_Message
  29. attr_writer :background
  30. attr_writer :visible
  31.  
  32. def visible
  33. @visible = false if !@visible
  34. return @visible
  35. end
  36.  
  37. def background
  38. @background = 0 if !@background
  39. return @background
  40. end
  41. end
  42.  
  43.  
  44.  
  45. class Game_System
  46. attr_writer :message_position
  47.  
  48. def message_position
  49. @message_position = 2 if !@message_position
  50. return @message_position
  51. end
  52. end
  53.  
  54.  
  55.  
  56. #===============================================================================
  57. #
  58. #===============================================================================
  59. class Scene_Map
  60. def updatemini
  61. oldmws=$game_temp.message_window_showing
  62. oldvis=$game_message ? $game_message.visible : false
  63. $game_temp.message_window_showing=true
  64. $game_message.visible=true if $game_message
  65. loop do
  66. $game_map.update
  67. $game_player.update
  68. $game_system.update
  69. if $game_screen
  70. $game_screen.update
  71. else
  72. $game_map.screen.update
  73. end
  74. break unless $game_temp.player_transferring
  75. transfer_player
  76. break if $game_temp.transition_processing
  77. end
  78. $game_temp.message_window_showing=oldmws
  79. $game_message.visible=oldvis if $game_message
  80. @spriteset.update if @spriteset
  81. @message_window.update if @message_window
  82. end
  83. end
  84.  
  85.  
  86.  
  87. class Scene_Battle
  88. def updatemini
  89. if self.respond_to?("update_basic")
  90. update_basic(true)
  91. update_info_viewport # Update information viewport
  92. if $game_message && $game_message.visible
  93. @info_viewport.visible = false
  94. @message_window.visible = true
  95. end
  96. else
  97. oldmws=$game_temp.message_window_showing
  98. $game_temp.message_window_showing=true
  99. # Update system (timer) and screen
  100. $game_system.update
  101. if $game_screen
  102. $game_screen.update
  103. else
  104. $game_map.screen.update
  105. end
  106. # If timer has reached 0
  107. if $game_system.timer_working and $game_system.timer == 0
  108. # Abort battle
  109. $game_temp.battle_abort = true
  110. end
  111. # Update windows
  112. @help_window.update if @help_window
  113. @party_command_window.update if @party_command_window
  114. @actor_command_window.update if @actor_command_window
  115. @status_window.update if @status_window
  116. $game_temp.message_window_showing=oldmws
  117. @message_window.update if @message_window
  118. # Update sprite set
  119. @spriteset.update if @spriteset
  120. end
  121. end
  122. end
  123.  
  124.  
  125.  
  126. def pbMapInterpreter
  127. if $game_map && $game_map.respond_to?("interpreter")
  128. return $game_map.interpreter
  129. elsif $game_system
  130. return $game_system.map_interpreter
  131. end
  132. return nil
  133. end
  134.  
  135. def pbMapInterpreterRunning?
  136. interp=pbMapInterpreter
  137. return interp && interp.running?
  138. end
  139.  
  140. def pbRefreshSceneMap
  141. if $scene && $scene.is_a?(Scene_Map)
  142. if $scene.respond_to?("miniupdate")
  143. $scene.miniupdate
  144. else
  145. $scene.updatemini
  146. end
  147. elsif $scene && $scene.is_a?(Scene_Battle)
  148. $scene.updatemini
  149. end
  150. end
  151.  
  152. def pbUpdateSceneMap
  153. if $scene && $scene.is_a?(Scene_Map) && !pbIsFaded?
  154. if $scene.respond_to?("miniupdate")
  155. $scene.miniupdate
  156. else
  157. $scene.updatemini
  158. end
  159. elsif $scene && $scene.is_a?(Scene_Battle)
  160. $scene.updatemini
  161. end
  162. end
  163.  
  164.  
  165.  
  166. #===============================================================================
  167. #
  168. #===============================================================================
  169. def pbEventCommentInput(*args)
  170. parameters = []
  171. list = *args[0].list # Event or event page
  172. elements = *args[1] # Number of elements
  173. trigger = *args[2] # Trigger
  174. return nil if list == nil
  175. return nil unless list.is_a?(Array)
  176. for item in list
  177. next unless item.code == 108 || item.code == 408
  178. if item.parameters[0] == trigger
  179. start = list.index(item) + 1
  180. finish = start + elements
  181. for id in start...finish
  182. next if !list[id]
  183. parameters.push(list[id].parameters[0])
  184. end
  185. return parameters
  186. end
  187. end
  188. return nil
  189. end
  190.  
  191. def pbCurrentEventCommentInput(elements,trigger)
  192. return nil if !pbMapInterpreterRunning?
  193. event=pbMapInterpreter.get_character(0)
  194. return nil if !event
  195. return pbEventCommentInput(event,elements,trigger)
  196. end
  197.  
  198. def pbButtonInputProcessing(variableNumber=0,timeoutFrames=0)
  199. ret=0
  200. loop do
  201. Graphics.update
  202. Input.update
  203. pbUpdateSceneMap
  204. for i in 1..18
  205. if Input.trigger?(i)
  206. ret=i
  207. end
  208. end
  209. break if ret!=0
  210. if timeoutFrames && timeoutFrames>0
  211. i+=1
  212. break if i>=timeoutFrames
  213. end
  214. end
  215. Input.update
  216. if variableNumber && variableNumber>0
  217. $game_variables[variableNumber]=ret
  218. $game_map.need_refresh = true if $game_map
  219. end
  220. return ret
  221. end
  222.  
  223.  
  224.  
  225. #===============================================================================
  226. # Interpreter functions for displaying messages
  227. #===============================================================================
  228. module InterpreterMixin
  229. def pbGlobalLock # Freezes all events on the map (for use at the beginning of common events)
  230. for event in $game_map.events.values
  231. event.minilock
  232. end
  233. end
  234.  
  235. def pbGlobalUnlock # Unfreezes all events on the map (for use at the end of common events)
  236. for event in $game_map.events.values
  237. event.unlock
  238. end
  239. end
  240.  
  241. def pbRepeatAbove(index)
  242. index=@list[index].indent
  243. loop do
  244. index-=1
  245. if @list[index].indent==indent
  246. return index+1
  247. end
  248. end
  249. end
  250.  
  251. def pbBreakLoop(index)
  252. indent = @list[index].indent
  253. temp_index=index
  254. # Copy index to temporary variables
  255. loop do
  256. # Advance index
  257. temp_index += 1
  258. # If a fitting loop was not found
  259. if temp_index >= @list.size-1
  260. return index+1
  261. end
  262. if @list[temp_index].code == 413 and @list[temp_index].indent < indent
  263. return temp_index+1
  264. end
  265. end
  266. end
  267.  
  268. def pbJumpToLabel(index,label_name)
  269. temp_index = 0
  270. loop do
  271. if temp_index >= @list.size-1
  272. return index+1
  273. end
  274. if @list[temp_index].code == 118 and
  275. @list[temp_index].parameters[0] == label_name
  276. return temp_index+1
  277. end
  278. temp_index += 1
  279. end
  280. end
  281.  
  282. # Gets the next index in the interpreter, ignoring
  283. # certain events between messages
  284. def pbNextIndex(index)
  285. return -1 if !@list || @list.length==0
  286. i=index+1
  287. loop do
  288. return i
  289. end
  290. code=@list[i].code
  291. case code
  292. when 118, 108, 408 # Label, Comment
  293. i+=1
  294. when 413 # Repeat Above
  295. i=pbRepeatAbove(i)
  296. when 113 # Break Loop
  297. i=pbBreakLoop(i)
  298. when 119 # Jump to Label
  299. newI=pbJumpToLabel(i,@list[i].parameters[0])
  300. if newI>i
  301. i=newI
  302. else
  303. i+=1
  304. end
  305. else
  306. return i
  307. end
  308. end
  309. end
  310.  
  311. # Helper function that shows a picture in a script. To be used in
  312. # a script event command.
  313. def pbShowPicture(number,name,origin,x,y,zoomX=100,zoomY=100,opacity=255,blendType=0)
  314. number = number + ($game_temp.in_battle ? 50 : 0)
  315. $game_screen.pictures[number].show(name,origin,
  316. x, y, zoomX,zoomY,opacity,blendType)
  317. end
  318.  
  319. # Erases an event and adds it to the list of erased events so that
  320. # it can stay erased when the game is saved then loaded again. To be used in
  321. # a script event command.
  322. def pbEraseThisEvent
  323. if $game_map.events[@event_id]
  324. $game_map.events[@event_id].erase
  325. $PokemonMap.addErasedEvent(@event_id) if $PokemonMap
  326. end
  327. @index+=1
  328. return true
  329. end
  330.  
  331. # Runs a common event. To be used in a script event command.
  332. def pbCommonEvent(id)
  333. if $game_temp.in_battle
  334. $game_temp.common_event_id = id
  335. else
  336. commonEvent = $data_common_events[id]
  337. $game_system.battle_interpreter.setup(commonEvent.list, 0)
  338. end
  339. end
  340.  
  341. # Sets another event's self switch (eg. pbSetSelfSwitch(20,"A",true) ).
  342. # To be used in a script event command.
  343. def pbSetSelfSwitch(event,swtch,value,mapid=-1)
  344. mapid = @map_id if mapid<0
  345. $game_self_switches[[mapid,event,swtch]] = value
  346. $game_map.need_refresh = true
  347. end
  348.  
  349. # Must use this approach to share the methods because the methods already
  350. # defined in a class override those defined in an included module
  351. CustomEventCommands=<<_END_
  352.  
  353. def command_242
  354. pbBGMFade(pbParams[0])
  355. return true
  356. end
  357.  
  358. def command_246
  359. pbBGSFade(pbParams[0])
  360. return true
  361. end
  362.  
  363. def command_251
  364. pbSEStop
  365. return true
  366. end
  367.  
  368. def command_241
  369. pbBGMPlay(pbParams[0])
  370. return true
  371. end
  372.  
  373. def command_245
  374. pbBGSPlay(pbParams[0])
  375. return true
  376. end
  377.  
  378. def command_249
  379. pbMEPlay(pbParams[0])
  380. return true
  381. end
  382.  
  383. def command_250
  384. pbSEPlay(pbParams[0])
  385. return true
  386. end
  387. _END_
  388. end
  389.  
  390.  
  391.  
  392. class Game_Interpreter # Used by RMVX
  393. include InterpreterMixin
  394. eval(InterpreterMixin::CustomEventCommands)
  395. @@immediateDisplayAfterWait=false
  396. @buttonInput=false
  397.  
  398. def pbParams
  399. return @params
  400. end
  401.  
  402. def command_105
  403. return false if @buttonInput
  404. @buttonInput=true
  405. pbButtonInputProcessing(@list[@index].parameters[0])
  406. @buttonInput=false
  407. @index+=1
  408. return true
  409. end
  410.  
  411. def command_101
  412. if $game_temp.message_window_showing
  413. return false
  414. end
  415. $game_message=Game_Message.new if !$game_message
  416. message=""
  417. commands=nil
  418. numInputVar=nil
  419. numInputDigitsMax=nil
  420. text=""
  421. facename=@list[@index].parameters[0]
  422. faceindex=@list[@index].parameters[1]
  423. if facename && facename!=""
  424. text+="\\ff[#{facename},#{faceindex}]"
  425. end
  426. if $game_message
  427. $game_message.background=@list[@index].parameters[2]
  428. end
  429. $game_system.message_position=@list[@index].parameters[3]
  430. message+=text
  431. messageend=""
  432. loop do
  433. nextIndex=pbNextIndex(@index)
  434. code=@list[nextIndex].code
  435. if code == 401
  436. text=@list[nextIndex].parameters[0]
  437. text+=" " if text!="" && text[text.length-1,1]!=" "
  438. message+=text
  439. @index=nextIndex
  440. else
  441. if code == 102
  442. commands=@list[nextIndex].parameters
  443. @index=nextIndex
  444. elsif code == 106 && @@immediateDisplayAfterWait
  445. params=@list[nextIndex].parameters
  446. if params[0]<=10
  447. nextcode=@list[nextIndex+1].code
  448. if nextcode==101||nextcode==102||nextcode==103
  449. @index=nextIndex
  450. else
  451. break
  452. end
  453. else
  454. break
  455. end
  456. elsif code == 103
  457. numInputVar=@list[nextIndex].parameters[0]
  458. numInputDigitsMax=@list[nextIndex].parameters[1]
  459. @index=nextIndex
  460. elsif code == 101
  461. messageend="\1"
  462. end
  463. break
  464. end
  465. end
  466. message=_MAPINTL($game_map.map_id,message)
  467. @message_waiting=true
  468. if commands
  469. cmdlist=[]
  470. for cmd in commands[0]
  471. cmdlist.push(_MAPINTL($game_map.map_id,cmd))
  472. end
  473. command=Kernel.pbMessage(message+messageend,cmdlist,commands[1])
  474. @branch[@list[@index].indent] = command
  475. elsif numInputVar
  476. params=ChooseNumberParams.new
  477. params.setMaxDigits(numInputDigitsMax)
  478. params.setDefaultValue($game_variables[numInputVar])
  479. $game_variables[numInputVar]=Kernel.pbMessageChooseNumber(message+messageend,params)
  480. $game_map.need_refresh = true if $game_map
  481. else
  482. Kernel.pbMessage(message+messageend)
  483. end
  484. @message_waiting=false
  485. return true
  486. end
  487.  
  488. def command_102
  489. @message_waiting=true
  490. command=Kernel.pbShowCommands(nil,@list[@index].parameters[0],@list[@index].parameters[1])
  491. @message_waiting=false
  492. @branch[@list[@index].indent] = command
  493. Input.update # Must call Input.update again to avoid extra triggers
  494. return true
  495. end
  496.  
  497. def command_103
  498. varnumber=@list[@index].parameters[0]
  499. @message_waiting=true
  500. params=ChooseNumberParams.new
  501. params.setMaxDigits(@list[@index].parameters[1])
  502. params.setDefaultValue($game_variables[varnumber])
  503. $game_variables[varnumber]=Kernel.pbChooseNumber(nil,params)
  504. $game_map.need_refresh = true if $game_map
  505. @message_waiting=false
  506. return true
  507. end
  508. end
  509.  
  510.  
  511.  
  512. class Interpreter # Used by RMXP
  513. include InterpreterMixin
  514. eval(InterpreterMixin::CustomEventCommands)
  515. @@immediateDisplayAfterWait=false
  516. @buttonInput=false
  517.  
  518. def pbParams
  519. return @parameters
  520. end
  521.  
  522. def command_105
  523. return false if @buttonInput
  524. @buttonInput=true
  525. pbButtonInputProcessing(@list[@index].parameters[0])
  526. @buttonInput=false
  527. @index+=1
  528. return true
  529. end
  530.  
  531. def command_101
  532. if $game_temp.message_window_showing
  533. return false
  534. end
  535. message=""
  536. commands=nil
  537. numInputVar=nil
  538. numInputDigitsMax=nil
  539. text=""
  540. firstText=nil
  541. if @list[@index].parameters.length==1
  542. text+=@list[@index].parameters[0]
  543. firstText=@list[@index].parameters[0]
  544. text+=" " if text[text.length-1,1]!=" "
  545. message+=text
  546. else
  547. facename=@list[@index].parameters[0]
  548. faceindex=@list[@index].parameters[1]
  549. if facename && facename!=""
  550. text+="\\ff[#{facename},#{faceindex}]"
  551. message+=text
  552. end
  553. end
  554. messageend=""
  555. loop do
  556. nextIndex=pbNextIndex(@index)
  557. code=@list[nextIndex].code
  558. if code == 401
  559. text=@list[nextIndex].parameters[0]
  560. text+=" " if text[text.length-1,1]!=" "
  561. message+=text
  562. @index=nextIndex
  563. else
  564. if code == 102
  565. commands=@list[nextIndex].parameters
  566. @index=nextIndex
  567. elsif code == 106 && @@immediateDisplayAfterWait
  568. params=@list[nextIndex].parameters
  569. if params[0]<=10
  570. nextcode=@list[nextIndex+1].code
  571. if nextcode==101 || nextcode==102 || nextcode==103
  572. @index=nextIndex
  573. else
  574. break
  575. end
  576. else
  577. break
  578. end
  579. elsif code == 103
  580. numInputVar=@list[nextIndex].parameters[0]
  581. numInputDigitsMax=@list[nextIndex].parameters[1]
  582. @index=nextIndex
  583. elsif code == 101
  584. if @list[@index].parameters.length==1
  585. text=@list[@index].parameters[0]
  586. if text[/\A\\ignr/] && text==firstText
  587. text+=" " if text[text.length-1,1]!=" "
  588. message+=text
  589. @index=nextIndex
  590. continue
  591. end
  592. end
  593. messageend="\1"
  594. end
  595. break
  596. end
  597. end
  598. @message_waiting=true # needed to allow parallel process events to work while
  599. # a message is displayed
  600. message=_MAPINTL($game_map.map_id,message)
  601. if commands
  602. cmdlist=[]
  603. for cmd in commands[0]
  604. cmdlist.push(_MAPINTL($game_map.map_id,cmd))
  605. end
  606. command=Kernel.pbMessage(message+messageend,cmdlist,commands[1])
  607. @branch[@list[@index].indent] = command
  608. elsif numInputVar
  609. params=ChooseNumberParams.new
  610. params.setMaxDigits(numInputDigitsMax)
  611. params.setDefaultValue($game_variables[numInputVar])
  612. $game_variables[numInputVar]=Kernel.pbMessageChooseNumber(message+messageend,params)
  613. $game_map.need_refresh = true if $game_map
  614. else
  615. Kernel.pbMessage(message+messageend,nil)
  616. end
  617. @message_waiting=false
  618. return true
  619. end
  620.  
  621. def command_102
  622. @message_waiting=true
  623. command=Kernel.pbShowCommands(nil,@list[@index].parameters[0],@list[@index].parameters[1])
  624. @message_waiting=false
  625. @branch[@list[@index].indent] = command
  626. Input.update # Must call Input.update again to avoid extra triggers
  627. return true
  628. end
  629.  
  630. def command_103
  631. varnumber=@list[@index].parameters[0]
  632. @message_waiting=true
  633. params=ChooseNumberParams.new
  634. params.setMaxDigits(@list[@index].parameters[1])
  635. params.setDefaultValue($game_variables[varnumber])
  636. $game_variables[varnumber]=Kernel.pbChooseNumber(nil,params)
  637. $game_map.need_refresh = true if $game_map
  638. @message_waiting=false
  639. return true
  640. end
  641. end
  642.  
  643.  
  644.  
  645. #===============================================================================
  646. #
  647. #===============================================================================
  648. class ChooseNumberParams
  649. def initialize
  650. @maxDigits=0
  651. @minNumber=0
  652. @maxNumber=0
  653. @skin=nil
  654. @messageSkin=nil
  655. @negativesAllowed=false
  656. @initialNumber=0
  657. @cancelNumber=nil
  658. end
  659.  
  660. def setMessageSkin(value)
  661. @messageSkin=value
  662. end
  663.  
  664. def messageSkin # Set the full path for the message's window skin
  665. @messageSkin
  666. end
  667.  
  668. def setSkin(value)
  669. @skin=value
  670. end
  671.  
  672. def skin
  673. @skin
  674. end
  675.  
  676. def setNegativesAllowed(value)
  677. @negativeAllowed=value
  678. end
  679.  
  680. def negativesAllowed
  681. @negativeAllowed ? true : false
  682. end
  683.  
  684. def setRange(minNumber,maxNumber)
  685. maxNumber=minNumber if minNumber>maxNumber
  686. @maxDigits=0
  687. @minNumber=minNumber
  688. @maxNumber=maxNumber
  689. end
  690.  
  691. def setDefaultValue(number)
  692. @initialNumber=number
  693. @cancelNumber=nil
  694. end
  695.  
  696. def setInitialValue(number)
  697. @initialNumber=number
  698. end
  699.  
  700. def setCancelValue(number)
  701. @cancelNumber=number
  702. end
  703.  
  704. def initialNumber
  705. return clamp(@initialNumber,self.minNumber,self.maxNumber)
  706. end
  707.  
  708. def cancelNumber
  709. return @cancelNumber ? @cancelNumber : self.initialNumber
  710. end
  711.  
  712. def minNumber
  713. ret=0
  714. if @maxDigits>0
  715. ret=-((10**@maxDigits)-1)
  716. elsif
  717. ret=@minNumber
  718. end
  719. ret=0 if !@negativeAllowed && ret<0
  720. return ret
  721. end
  722.  
  723. def maxNumber
  724. ret=0
  725. if @maxDigits>0
  726. ret=((10**@maxDigits)-1)
  727. elsif
  728. ret=@maxNumber
  729. end
  730. ret=0 if !@negativeAllowed && ret<0
  731. return ret
  732. end
  733.  
  734. def setMaxDigits(value)
  735. @maxDigits=[1,value].max
  736. end
  737.  
  738. def maxDigits
  739. if @maxDigits>0
  740. return @maxDigits
  741. else
  742. return [numDigits(self.minNumber),numDigits(self.maxNumber)].max
  743. end
  744. end
  745.  
  746. private
  747.  
  748. def clamp(v,mn,mx)
  749. return v<mn ? mn : (v>mx ? mx : v)
  750. end
  751.  
  752. def numDigits(number)
  753. ans = 1
  754. number=number.abs
  755. while number >= 10
  756. ans+=1
  757. number/=10
  758. end
  759. return ans
  760. end
  761. end
  762.  
  763.  
  764.  
  765. def pbChooseNumber(msgwindow,params)
  766. return 0 if !params
  767. ret=0
  768. maximum=params.maxNumber
  769. minimum=params.minNumber
  770. defaultNumber=params.initialNumber
  771. cancelNumber=params.cancelNumber
  772. cmdwindow=Window_InputNumberPokemon.new(params.maxDigits)
  773. cmdwindow.z=99999
  774. cmdwindow.visible=true
  775. cmdwindow.setSkin(params.skin) if params.skin
  776. cmdwindow.sign=params.negativesAllowed # must be set before number
  777. cmdwindow.number=defaultNumber
  778. curnumber=defaultNumber
  779. pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
  780. command=0
  781. loop do
  782. Graphics.update
  783. Input.update
  784. pbUpdateSceneMap
  785. cmdwindow.update
  786. msgwindow.update if msgwindow
  787. yield if block_given?
  788. if Input.trigger?(Input::C)
  789. ret=cmdwindow.number
  790. if ret>maximum
  791. pbPlayBuzzerSE()
  792. elsif ret<minimum
  793. pbPlayBuzzerSE()
  794. else
  795. pbPlayDecisionSE()
  796. break
  797. end
  798. elsif Input.trigger?(Input::B)
  799. pbPlayCancelSE()
  800. ret=cancelNumber
  801. break
  802. end
  803. end
  804. cmdwindow.dispose
  805. Input.update
  806. return ret
  807. end
  808.  
  809.  
  810.  
  811. #===============================================================================
  812. #
  813. #===============================================================================
  814. class FaceWindowVX < SpriteWindow_Base
  815. def initialize(face)
  816. super(0,0,128,128)
  817. faceinfo=face.split(",")
  818. facefile=pbResolveBitmap("Graphics/Faces/"+faceinfo[0])
  819. facefile=pbResolveBitmap("Graphics/Pictures/"+faceinfo[0]) if !facefile
  820. self.contents.dispose if self.contents
  821. @faceIndex=faceinfo[1].to_i
  822. @facebitmaptmp=AnimatedBitmap.new(facefile)
  823. @facebitmap=BitmapWrapper.new(96,96)
  824. @facebitmap.blt(0,0,@facebitmaptmp.bitmap,Rect.new(
  825. (@faceIndex % 4) * 96,
  826. (@faceIndex / 4) * 96, 96, 96
  827. ))
  828. self.contents=@facebitmap
  829. end
  830.  
  831. def update
  832. super
  833. if @facebitmaptmp.totalFrames>1
  834. @facebitmaptmp.update
  835. @facebitmap.blt(0,0,@facebitmaptmp.bitmap,Rect.new(
  836. (@faceIndex % 4) * 96,
  837. (@faceIndex / 4) * 96, 96, 96
  838. ))
  839. end
  840. end
  841.  
  842. def dispose
  843. @facebitmaptmp.dispose
  844. @facebitmap.dispose if @facebitmap
  845. super
  846. end
  847. end
  848.  
  849.  
  850.  
  851. #===============================================================================
  852. #
  853. #===============================================================================
  854. def pbGetBasicMapNameFromId(id)
  855. begin
  856. map = pbLoadRxData("Data/MapInfos")
  857. return "" if !map
  858. return map[id].name
  859. rescue
  860. return ""
  861. end
  862. end
  863.  
  864. def pbGetMapNameFromId(id)
  865. map=pbGetBasicMapNameFromId(id)
  866. map.gsub!(/\\PN/,$Trainer.name) if $Trainer
  867. return map
  868. end
  869.  
  870. def pbCsvField!(str)
  871. ret=""
  872. str.sub!(/\A\s*/,"")
  873. if str[0,1]=="\""
  874. str[0,1]=""
  875. escaped=false
  876. fieldbytes=0
  877. str.scan(/./) do |s|
  878. fieldbytes+=s.length
  879. break if s=="\"" && !escaped
  880. if s=="\\" && !escaped
  881. escaped=true
  882. else
  883. ret+=s
  884. escaped=false
  885. end
  886. end
  887. str[0,fieldbytes]=""
  888. if !str[/\A\s*,/] && !str[/\A\s*$/]
  889. raise _INTL("Invalid quoted field (in: {1})",ret)
  890. end
  891. str[0,str.length]=$~.post_match
  892. else
  893. if str[/,/]
  894. str[0,str.length]=$~.post_match
  895. ret=$~.pre_match
  896. else
  897. ret=str.clone
  898. str[0,str.length]=""
  899. end
  900. ret.gsub!(/\s+$/,"")
  901. end
  902. return ret
  903. end
  904.  
  905. def pbCsvPosInt!(str)
  906. ret=pbCsvField!(str)
  907. if !ret[/\A\d+$/]
  908. raise _INTL("Field {1} is not a positive integer",ret)
  909. end
  910. return ret.to_i
  911. end
  912.  
  913.  
  914.  
  915. #===============================================================================
  916. # Money and coins windows
  917. #===============================================================================
  918. # internal function
  919. def pbGetGoldString
  920. moneyString=""
  921. if $Trainer
  922. moneyString=_INTL("${1}",pbCommaNumber($Trainer.money))
  923. else
  924. if $data_system.respond_to?("words")
  925. moneyString=_INTL("{1} {2}",$game_party.gold,$data_system.words.gold)
  926. else
  927. moneyString=_INTL("{1} {2}",$game_party.gold,Vocab.gold)
  928. end
  929. end
  930. return moneyString
  931. end
  932.  
  933. def pbDisplayGoldWindow(msgwindow)
  934. moneyString=pbGetGoldString()
  935. goldwindow=Window_AdvancedTextPokemon.new(_INTL("Money:\n<ar>{1}</ar>",moneyString))
  936. goldwindow.setSkin("Graphics/Windowskins/goldskin")
  937. goldwindow.resizeToFit(goldwindow.text,Graphics.width)
  938. goldwindow.width=160 if goldwindow.width<=160
  939. if msgwindow.y==0
  940. goldwindow.y=Graphics.height-goldwindow.height
  941. else
  942. goldwindow.y=0
  943. end
  944. goldwindow.viewport=msgwindow.viewport
  945. goldwindow.z=msgwindow.z
  946. return goldwindow
  947. end
  948.  
  949. def pbDisplayCoinsWindow(msgwindow,goldwindow)
  950. coinString=($PokemonGlobal) ? pbCommaNumber($PokemonGlobal.coins) : "0"
  951. coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>",coinString))
  952. coinwindow.setSkin("Graphics/Windowskins/goldskin")
  953. coinwindow.resizeToFit(coinwindow.text,Graphics.width)
  954. coinwindow.width=160 if coinwindow.width<=160
  955. if msgwindow.y==0
  956. coinwindow.y=(goldwindow) ? goldwindow.y-coinwindow.height : Graphics.height-coinwindow.height
  957. else
  958. coinwindow.y=(goldwindow) ? goldwindow.height : 0
  959. end
  960. coinwindow.viewport=msgwindow.viewport
  961. coinwindow.z=msgwindow.z
  962. return coinwindow
  963. end
  964.  
  965.  
  966.  
  967. #===============================================================================
  968. #
  969. #===============================================================================
  970. def Kernel.pbCreateStatusWindow(viewport=nil)
  971. msgwindow=Window_AdvancedTextPokemon.new("")
  972. if !viewport
  973. msgwindow.z=99999
  974. else
  975. msgwindow.viewport=viewport
  976. end
  977. msgwindow.visible=false
  978. msgwindow.letterbyletter=false
  979. pbBottomLeftLines(msgwindow,2)
  980. skinfile=MessageConfig.pbGetSpeechFrame()
  981. msgwindow.setSkin(skinfile)
  982. return msgwindow
  983. end
  984.  
  985. def Kernel.pbCreateMessageWindow(viewport=nil,skin=nil)
  986. msgwindow=Window_AdvancedTextPokemon.new("")
  987. if !viewport
  988. msgwindow.z=99999
  989. else
  990. msgwindow.viewport=viewport
  991. end
  992. msgwindow.visible=true
  993. msgwindow.letterbyletter=true
  994. msgwindow.back_opacity=MessageConfig::WindowOpacity
  995. pbBottomLeftLines(msgwindow,2)
  996. $game_temp.message_window_showing=true if $game_temp
  997. $game_message.visible=true if $game_message
  998. skin=MessageConfig.pbGetSpeechFrame() if !skin
  999. msgwindow.setSkin(skin)
  1000. return msgwindow
  1001. end
  1002.  
  1003. def Kernel.pbDisposeMessageWindow(msgwindow)
  1004. $game_temp.message_window_showing=false if $game_temp
  1005. $game_message.visible=false if $game_message
  1006. msgwindow.dispose
  1007. end
  1008.  
  1009.  
  1010.  
  1011. #===============================================================================
  1012. # Main message-displaying function
  1013. #===============================================================================
  1014. def Kernel.pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
  1015. return if !msgwindow
  1016. oldletterbyletter=msgwindow.letterbyletter
  1017. msgwindow.letterbyletter=(letterbyletter) ? true : false
  1018. ret=nil
  1019. count=0
  1020. commands=nil
  1021. facewindow=nil
  1022. goldwindow=nil
  1023. coinwindow=nil
  1024. cmdvariable=0
  1025. cmdIfCancel=0
  1026. msgwindow.waitcount=0
  1027. autoresume=false
  1028. text=message.clone
  1029. msgback=nil
  1030. linecount=(Graphics.height>400) ? 3 : 2
  1031. ### Text replacement
  1032. text.gsub!(/\\\\/,"\5")
  1033. if $game_actors
  1034. text.gsub!(/\\[Nn]\[([1-8])\]/){
  1035. m=$1.to_i
  1036. next $game_actors[m].name
  1037. }
  1038. end
  1039. text.gsub!(/\\[Ss][Ii][Gg][Nn]\[([^\]]*)\]/){
  1040. next "\\op\\cl\\ts[]\\w["+$1+"]"
  1041. }
  1042. text.gsub!(/\\[Pp][Nn]/,$Trainer.name) if $Trainer
  1043. text.gsub!(/\\[Pp][Mm]/,_INTL("${1}",pbCommaNumber($Trainer.money))) if $Trainer
  1044. text.gsub!(/\\[Nn]/,"\n")
  1045. text.gsub!(/\\\[([0-9A-Fa-f]{8,8})\]/){ "<c2="+$1+">" }
  1046. text.gsub!(/\\[Pp][Gg]/,"\\b") if $Trainer && $Trainer.isMale?
  1047. text.gsub!(/\\[Pp][Gg]/,"\\r") if $Trainer && $Trainer.isFemale?
  1048. text.gsub!(/\\[Pp][Oo][Gg]/,"\\r") if $Trainer && $Trainer.isMale?
  1049. text.gsub!(/\\[Pp][Oo][Gg]/,"\\b") if $Trainer && $Trainer.isFemale?
  1050. text.gsub!(/\\[Pp][Gg]/,"")
  1051. text.gsub!(/\\[Pp][Oo][Gg]/,"")
  1052. text.gsub!(/\\[Bb]/,"<c2=6546675A>")
  1053. text.gsub!(/\\[Rr]/,"<c2=043C675A>")
  1054. text.gsub!(/\\1/,"\1")
  1055. colortag=""
  1056. isDarkSkin=isDarkWindowskin(msgwindow.windowskin)
  1057. if ($game_message && $game_message.background>0) ||
  1058. ($game_system && $game_system.respond_to?("message_frame") &&
  1059. $game_system.message_frame != 0)
  1060. colortag=getSkinColor(msgwindow.windowskin,0,true)
  1061. else
  1062. colortag=getSkinColor(msgwindow.windowskin,0,isDarkSkin)
  1063. end
  1064. text.gsub!(/\\[Cc]\[([0-9]+)\]/){
  1065. m=$1.to_i
  1066. next getSkinColor(msgwindow.windowskin,m,isDarkSkin)
  1067. }
  1068. begin
  1069. last_text = text.clone
  1070. text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  1071. end until text == last_text
  1072. begin
  1073. last_text = text.clone
  1074. text.gsub!(/\\[Ll]\[([0-9]+)\]/) {
  1075. linecount=[1,$1.to_i].max;
  1076. next ""
  1077. }
  1078. end until text == last_text
  1079. text=colortag+text
  1080. ### Controls
  1081. textchunks=[]
  1082. controls=[]
  1083. while text[/(?:\\([Dm][Mm]|[WwFf]|[Ff][Ff]|[Tt][Ss]|[Cc][Ll]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Cc][Nn]|[Ww][Dd]|[Ww][Mm]|[Oo][Pp]|[Cc][Ll]|[Ww][Uu]|[\.]|[\|]|[\!]|[\x5E])())/i]
  1084. textchunks.push($~.pre_match)
  1085. if $~[1]
  1086. controls.push([$~[1].downcase,$~[2],-1])
  1087. else
  1088. controls.push([$~[3].downcase,"",-1])
  1089. end
  1090. text=$~.post_match
  1091. end
  1092. textchunks.push(text)
  1093. for chunk in textchunks
  1094. chunk.gsub!(/\005/,"\\")
  1095. end
  1096. textlen=0
  1097. for i in 0...controls.length
  1098. control=controls[i][0]
  1099. if control=="wt" || control=="wtnp" || control=="." || control=="|"
  1100. textchunks[i]+="\2"
  1101. elsif control=="!"
  1102. textchunks[i]+="\1"
  1103. end
  1104. textlen+=toUnformattedText(textchunks[i]).scan(/./m).length
  1105. controls[i][2]=textlen
  1106. end
  1107. text=textchunks.join("")
  1108. unformattedText=toUnformattedText(text)
  1109. signWaitCount=0
  1110. haveSpecialClose=false
  1111. specialCloseSE=""
  1112. for i in 0...controls.length
  1113. control=controls[i][0]
  1114. param=controls[i][1]
  1115. if control=="dm"
  1116. facewindow.dispose if facewindow
  1117. facewindow=PictureWindow.new("Graphics/Pictures/#{param}")
  1118. elsif control=="f"
  1119. facewindow.dispose if facewindow
  1120. facewindow=PictureWindow.new("Graphics/Pictures/#{param}")
  1121. elsif control=="op"
  1122. signWaitCount=21
  1123. elsif control=="cl"
  1124. text=text.sub(/\001\z/,"") # fix: '$' can match end of line as well
  1125. haveSpecialClose=true
  1126. specialCloseSE=param
  1127. elsif control=="se" && controls[i][2]==0
  1128. startSE=param
  1129. controls[i]=nil
  1130. elsif control=="ff"
  1131. facewindow.dispose if facewindow
  1132. facewindow=FaceWindowVX.new(param)
  1133. elsif control=="ch"
  1134. cmds=param.clone
  1135. cmdvariable=pbCsvPosInt!(cmds)
  1136. cmdIfCancel=pbCsvField!(cmds).to_i
  1137. commands=[]
  1138. while cmds.length>0
  1139. commands.push(pbCsvField!(cmds))
  1140. end
  1141. elsif control=="wtnp" || control=="^"
  1142. text=text.sub(/\001\z/,"") # fix: '$' can match end of line as well
  1143. end
  1144. end
  1145. if startSE!=nil
  1146. pbSEPlay(pbStringToAudioFile(startSE))
  1147. elsif signWaitCount==0 && letterbyletter
  1148. pbPlayDecisionSE()
  1149. end
  1150. ########## Position message window ##############
  1151. pbRepositionMessageWindow(msgwindow,linecount)
  1152. if $game_message && $game_message.background==1
  1153. msgback=IconSprite.new(0,msgwindow.y,msgwindow.viewport)
  1154. msgback.z=msgwindow.z-1
  1155. msgback.setBitmap("Graphics/System/MessageBack")
  1156. end
  1157. if facewindow
  1158. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1159. facewindow.viewport=msgwindow.viewport
  1160. facewindow.z=msgwindow.z
  1161. end
  1162. atTop=(msgwindow.y==0)
  1163. ########## Show text #############################
  1164. msgwindow.text=text
  1165. Graphics.frame_reset if Graphics.frame_rate>40
  1166. begin
  1167. if signWaitCount>0
  1168. signWaitCount-=1
  1169. if atTop
  1170. msgwindow.y=-(msgwindow.height*(signWaitCount)/20)
  1171. else
  1172. msgwindow.y=Graphics.height-(msgwindow.height*(20-signWaitCount)/20)
  1173. end
  1174. end
  1175. for i in 0...controls.length
  1176. if controls[i] && controls[i][2]<=msgwindow.position && msgwindow.waitcount==0
  1177. control=controls[i][0]
  1178. param=controls[i][1]
  1179. case control
  1180. when "dm"
  1181. facewindow.dispose if facewindow
  1182. facewindow=PictureWindow.new("Graphics/Pictures/#{param}")
  1183. pbPositionNearMsgWindow(facewindow,msgwindow,:right)
  1184. facewindow.viewport=msgwindow.viewport
  1185. facewindow.z=msgwindow.z
  1186. facewindow.windowskin=nil
  1187. facewindow.x=0
  1188. facewindow.y=msgwindow.y
  1189. when "f"
  1190. facewindow.dispose if facewindow
  1191. facewindow=PictureWindow.new("Graphics/Pictures/#{param}")
  1192. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1193. facewindow.viewport=msgwindow.viewport
  1194. facewindow.z=msgwindow.z
  1195. when "ts"
  1196. if param==""
  1197. msgwindow.textspeed=-999
  1198. else
  1199. msgwindow.textspeed=param.to_i
  1200. end
  1201. when "ff"
  1202. facewindow.dispose if facewindow
  1203. facewindow=FaceWindowVX.new(param)
  1204. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1205. facewindow.viewport=msgwindow.viewport
  1206. facewindow.z=msgwindow.z
  1207. when "g" # Display gold window
  1208. goldwindow.dispose if goldwindow
  1209. goldwindow=pbDisplayGoldWindow(msgwindow)
  1210. when "cn" # Display coins window
  1211. coinwindow.dispose if coinwindow
  1212. coinwindow=pbDisplayCoinsWindow(msgwindow,goldwindow)
  1213. when "wu"
  1214. msgwindow.y=0
  1215. atTop=true
  1216. msgback.y=msgwindow.y if msgback
  1217. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1218. msgwindow.y=-(msgwindow.height*(signWaitCount)/20)
  1219. when "wm"
  1220. atTop=false
  1221. msgwindow.y=(Graphics.height/2)-(msgwindow.height/2)
  1222. msgback.y=msgwindow.y if msgback
  1223. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1224. when "wd"
  1225. atTop=false
  1226. msgwindow.y=(Graphics.height)-(msgwindow.height)
  1227. msgback.y=msgwindow.y if msgback
  1228. pbPositionNearMsgWindow(facewindow,msgwindow,:left)
  1229. msgwindow.y=Graphics.height-(msgwindow.height*(20-signWaitCount)/20)
  1230. when "."
  1231. msgwindow.waitcount+=Graphics.frame_rate/4
  1232. when "|"
  1233. msgwindow.waitcount+=Graphics.frame_rate
  1234. when "wt" # Wait
  1235. param=param.sub(/\A\s+/,"").sub(/\s+\z/,"")
  1236. msgwindow.waitcount+=param.to_i*2
  1237. when "w" # Windowskin
  1238. if param==""
  1239. msgwindow.windowskin=nil
  1240. else
  1241. msgwindow.setSkin("Graphics/Windowskins/#{param}")
  1242. end
  1243. msgwindow.width=msgwindow.width # Necessary evil
  1244. when "^" # Wait, no pause
  1245. autoresume=true
  1246. when "wtnp" # Wait, no pause
  1247. param=param.sub(/\A\s+/,"").sub(/\s+\z/,"")
  1248. msgwindow.waitcount=param.to_i*2
  1249. autoresume=true
  1250. when "se" # Play SE
  1251. pbSEPlay(pbStringToAudioFile(param))
  1252. when "me" # Play ME
  1253. pbMEPlay(pbStringToAudioFile(param))
  1254. end
  1255. controls[i]=nil
  1256. end
  1257. end
  1258. break if !letterbyletter
  1259. Graphics.update
  1260. Input.update
  1261. facewindow.update if facewindow
  1262. if $DEBUG && Input.trigger?(Input::F6)
  1263. pbRecord(unformattedText)
  1264. end
  1265. if autoresume && msgwindow.waitcount==0
  1266. msgwindow.resume if msgwindow.busy?
  1267. break if !msgwindow.busy?
  1268. end
  1269. if (Input.trigger?(Input::C) || Input.trigger?(Input::B))
  1270. if msgwindow.busy?
  1271. pbPlayDecisionSE() if msgwindow.pausing?
  1272. msgwindow.resume
  1273. else
  1274. break if signWaitCount==0
  1275. end
  1276. end
  1277. pbUpdateSceneMap
  1278. msgwindow.update
  1279. yield if block_given?
  1280. end until (!letterbyletter || commandProc || commands) && !msgwindow.busy?
  1281. Input.update # Must call Input.update again to avoid extra triggers
  1282. msgwindow.letterbyletter=oldletterbyletter
  1283. if commands
  1284. $game_variables[cmdvariable]=Kernel.pbShowCommands(
  1285. msgwindow,commands,cmdIfCancel)
  1286. $game_map.need_refresh = true if $game_map
  1287. end
  1288. if commandProc
  1289. ret=commandProc.call(msgwindow)
  1290. end
  1291. msgback.dispose if msgback
  1292. goldwindow.dispose if goldwindow
  1293. coinwindow.dispose if coinwindow
  1294. facewindow.dispose if facewindow
  1295. if haveSpecialClose
  1296. pbSEPlay(pbStringToAudioFile(specialCloseSE))
  1297. atTop=(msgwindow.y==0)
  1298. for i in 0..20
  1299. if atTop
  1300. msgwindow.y=-(msgwindow.height*(i)/20)
  1301. else
  1302. msgwindow.y=Graphics.height-(msgwindow.height*(20-i)/20)
  1303. end
  1304. Graphics.update
  1305. Input.update
  1306. pbUpdateSceneMap
  1307. msgwindow.update
  1308. end
  1309. end
  1310. return ret
  1311. end
  1312.  
  1313.  
  1314.  
  1315. #===============================================================================
  1316. # Message-displaying functions
  1317. #===============================================================================
  1318. def Kernel.pbMessage(message,commands=nil,cmdIfCancel=0,skin=nil,defaultCmd=0,&block)
  1319. ret=0
  1320. msgwindow=Kernel.pbCreateMessageWindow(nil,skin)
  1321. if commands
  1322. ret=Kernel.pbMessageDisplay(msgwindow,message,true,
  1323. proc {|msgwindow|
  1324. next Kernel.pbShowCommands(msgwindow,commands,cmdIfCancel,defaultCmd,&block)
  1325. },&block)
  1326. else
  1327. Kernel.pbMessageDisplay(msgwindow,message,&block)
  1328. end
  1329. Kernel.pbDisposeMessageWindow(msgwindow)
  1330. Input.update
  1331. return ret
  1332. end
  1333.  
  1334. def Kernel.pbConfirmMessage(message,&block)
  1335. return (Kernel.pbMessage(message,[_INTL("Yes"),_INTL("No")],2,&block)==0)
  1336. end
  1337.  
  1338. def Kernel.pbConfirmMessageSerious(message,&block)
  1339. return (Kernel.pbMessage(message,[_INTL("No"),_INTL("Yes")],1,&block)==1)
  1340. end
  1341.  
  1342. def Kernel.pbMessageChooseNumber(message,params,&block)
  1343. msgwindow=Kernel.pbCreateMessageWindow(nil,params.messageSkin)
  1344. ret=Kernel.pbMessageDisplay(msgwindow,message,true,
  1345. proc {|msgwindow|
  1346. next Kernel.pbChooseNumber(msgwindow,params,&block)
  1347. },&block)
  1348. Kernel.pbDisposeMessageWindow(msgwindow)
  1349. return ret
  1350. end
  1351.  
  1352. def Kernel.pbShowCommands(msgwindow,commands=nil,cmdIfCancel=0,defaultCmd=0)
  1353. ret=0
  1354. if commands
  1355. cmdwindow=Window_CommandPokemonEx.new(commands)
  1356. cmdwindow.z=99999
  1357. cmdwindow.visible=true
  1358. cmdwindow.resizeToFit(cmdwindow.commands)
  1359. pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
  1360. cmdwindow.index=defaultCmd
  1361. command=0
  1362. loop do
  1363. Graphics.update
  1364. Input.update
  1365. cmdwindow.update
  1366. msgwindow.update if msgwindow
  1367. yield if block_given?
  1368. if Input.trigger?(Input::B)
  1369. if cmdIfCancel>0
  1370. command=cmdIfCancel-1
  1371. break
  1372. elsif cmdIfCancel<0
  1373. command=cmdIfCancel
  1374. break
  1375. end
  1376. end
  1377. if Input.trigger?(Input::C)
  1378. command=cmdwindow.index
  1379. break
  1380. end
  1381. pbUpdateSceneMap
  1382. end
  1383. ret=command
  1384. cmdwindow.dispose
  1385. Input.update
  1386. end
  1387. return ret
  1388. end
  1389.  
  1390. def Kernel.pbShowCommandsWithHelp(msgwindow,commands,help,cmdIfCancel=0,defaultCmd=0)
  1391. msgwin=msgwindow
  1392. msgwin=Kernel.pbCreateMessageWindow(nil) if !msgwindow
  1393. oldlbl=msgwin.letterbyletter
  1394. msgwin.letterbyletter=false
  1395. if commands
  1396. cmdwindow=Window_CommandPokemonEx.new(commands)
  1397. cmdwindow.z=99999
  1398. cmdwindow.visible=true
  1399. cmdwindow.resizeToFit(cmdwindow.commands)
  1400. cmdwindow.height=msgwin.y if cmdwindow.height>msgwin.y
  1401. cmdwindow.index=defaultCmd
  1402. command=0
  1403. msgwin.text=help[cmdwindow.index]
  1404. msgwin.width=msgwin.width # Necessary evil to make it use the proper margins.
  1405. loop do
  1406. Graphics.update
  1407. Input.update
  1408. oldindex=cmdwindow.index
  1409. cmdwindow.update
  1410. if oldindex!=cmdwindow.index
  1411. msgwin.text=help[cmdwindow.index]
  1412. end
  1413. msgwin.update
  1414. yield if block_given?
  1415. if Input.trigger?(Input::B)
  1416. if cmdIfCancel>0
  1417. command=cmdIfCancel-1
  1418. break
  1419. elsif cmdIfCancel<0
  1420. command=cmdIfCancel
  1421. break
  1422. end
  1423. end
  1424. if Input.trigger?(Input::C)
  1425. command=cmdwindow.index
  1426. break
  1427. end
  1428. pbUpdateSceneMap
  1429. end
  1430. ret=command
  1431. cmdwindow.dispose
  1432. Input.update
  1433. end
  1434. msgwin.letterbyletter=oldlbl
  1435. msgwin.dispose if !msgwindow
  1436. return ret
  1437. end
  1438.  
  1439. def pbMessageWaitForInput(msgwindow,frames,showPause=false)
  1440. return if !frames || frames<=0
  1441. msgwindow.startPause if msgwindow && showPause
  1442. frames.times do
  1443. Graphics.update
  1444. Input.update
  1445. msgwindow.update if msgwindow
  1446. pbUpdateSceneMap
  1447. if Input.trigger?(Input::C) || Input.trigger?(Input::B)
  1448. break
  1449. end
  1450. yield if block_given?
  1451. end
  1452. msgwindow.stopPause if msgwindow && showPause
  1453. end
Advertisement
Add Comment
Please, Sign In to add comment