Advertisement
Diego-Mertens

FaceSistem - Diego Mertens

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