Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2. @plugindesc 3D rendering in RPG Maker MV with babylon.js
  3. version 0.4.4.4
  4. @author Dread/Nyanak
  5. @help
  6.  
  7. If you are making a game with this plugin, please consider supporting my
  8. patreon.  
  9. https://www.patreon.com/cutievirus  
  10. You can also unlock some patron-only features by becoming a patron, such as
  11. Dynamic Shadows.  
  12. A list of patrons can be found at the bottom of this file.
  13.  
  14. ## Getting started
  15.  
  16. To use the plugin on a new or existing project, download [plugin.zip] and
  17. extract the files into your project directory.
  18. Then, load `babylon.js` and `mv3d-babylon.js` as plugins in that order.
  19.  
  20. [plugin.zip]:
  21. https://github.com/Dread-chan/MV3D/blob/master/plugin.zip
  22.  
  23.  
  24. Now when you run your game, the map should be rendered in 3D.
  25.  
  26. The A3 and A4 tiles will be rendered as walls. You can also change the height
  27. of tiles using regions and terrain tags.
  28.  
  29. By default, regions 1-7 are configured to affect the height.
  30.  
  31. Terrain tag 1 is configured to use a cross shape, so tiles with this tag will
  32. stand up like a tree.
  33.  
  34. Terrain tag 2 is configured to use a fence shape. Try putting this tag on the
  35. fence autotiles that come with MV.
  36.  
  37. The regions and terrain tags can be reconfigured however you want.
  38.  
  39. ---
  40.  
  41. ## Configuration
  42.  
  43. Tileset and map configurations are placed in the note area.
  44. Event configurations are placed either in the event note or in comments.
  45. Region and terrain tags are configured through the plugin parameters.
  46.  
  47. In order for the plugin to recognize configurations, they need to be wrapped
  48. properly.  
  49. Tileset and map configurations need to be wrapped in a <mv3d> </mv3d> block,
  50. while event configurations need to be inside a <mv3d:  > tag.  
  51. Region and terrain tag configurations don't need to wrapped at all.
  52.  
  53. ### Using configuration functions
  54.  
  55. Configuration functions are used to configure tilesets, regions, terrain tags,
  56. events, and maps.
  57.  
  58. The following is an example of a basic configuration function. Each function
  59. is passed a list of parameters.
  60.  
  61.     top(A1,0,0)
  62.  
  63. Some functions can take a large number of parameters. In these cases the
  64. parameter list is separated into groups. A vertical bar can be used instead of
  65. a comma to jump to the next group. You can also jump to a parameter by name
  66. using a colon.  
  67. Here are some examples:
  68.  
  69.     ceiling(A4,0,0|2)
  70.     camera(0,60,dist:5,height:0.75)
  71.  
  72. Parameter groups can also have names, and can be jumped to in the same way you
  73. jump to a named parameter.
  74.  
  75. ---
  76.  
  77. ## Tileset Configuration
  78.  
  79. Each line in the tileset configuration should start by identifying the tile
  80. you want to configure, followed by a colon, and then a list of configuration
  81. functions.
  82.  
  83. Choosing a tile is done with the format `img,x,y`, where img is name of the
  84. tileset image (A1, A2, B, C, etc.), and x and y are the position of that tile
  85. on the tileset. For example, `A2,0,0` would be the top left A2 tile. On the
  86. outdoor tileset, this would be the grass autotile.
  87.  
  88. Here are some exapmle tileset configurations.  
  89.  
  90. This first one will make our outdoor water sink into the ground a little.
  91.  
  92.     <mv3d>
  93.     A1,0,0:top(A1,0,0),side(A1,31,54,31,14),depth(0.3),float(0.1)
  94.     </mv3d>
  95.  
  96. But this example won't look very good if we place the water at the edge of a
  97. cliff, so let's configure it to use a waterfall texture on the outside walls.
  98.  
  99.     <mv3d>
  100.     A1,0,0:top(A1,0,0),side(A1,1,1),inside(A1,31,54,31,14),depth(0.3),float(0.1)
  101.     </mv3d>
  102.  
  103.  
  104. ### Setting tile textures
  105.  
  106. A tile can have up to four different textures. These are the Top texture,
  107. the Side texture, the Inside texture, and the Bottom texture.  
  108. If unset, the inside texture will be the same as the side texture and the
  109. bottom texture will be the same as the top texture.  
  110. Inside textures are only used if a tile has a depth() specified.
  111.  
  112. Each texture can be set with the respective top(), side(), inside(), and
  113. bottom() function. Texture() can be used to set both the top and side texture.
  114.  
  115. Parameter list:
  116. img,x,y,w,h|alpha|glow[anim]animx,animy
  117.  
  118. The number of parameters passed to the first group will alter the behavior of
  119. these functions.  
  120.  
  121. With only 2 parameters, it will act as an offset. For example, top(0,1) will
  122. use the texture of the tile below the configured tile.  
  123.  
  124. With 3 parameters, you specify the tileset image name and tile coordinates of
  125. the tile to use the texture from. For example, top(A1,0,0) will use the top
  126. left tile of the A1 tileset image.  
  127.  
  128. With 5 parameters, you specify a region with pixel coordinates on the
  129. specified tileset image. For example, top(A1,24,72,48,48).  
  130.  
  131. The alpha parameter can be used to make the texture partially transparent. Or,
  132. you can set alpha to 1 to turn on alpha blending.  
  133. Examples: texture(|1), texture(alpha:0.5)
  134.  
  135. The glow parameter will make the texture glow in the dark. Good for lava.  
  136. Example: texture(||1), texture(glow:1)
  137.  
  138. [Anim] is a named parameter group for defining custom animated tiles.  
  139. The number supplied to animx and animy will be the offset used by the
  140. animation. The final offset will be equal to the anim offset times the
  141. current frame.  
  142. Animx has frames 0,1,2,1, while animy has frames 0,1,2.  
  143. Examples: texture(|||1,0), texture(anim:0,1)
  144.  
  145.  
  146.  
  147. ### Setting tile height
  148.  
  149. Height and depth can be used to set the height of the tile. A tile's height
  150. is equal to its height minus its depth. Tiles with depth will use their inside
  151. texture on their sides. Depth is good for making pits.  
  152. Examples: height(2), depth(1)  
  153.  
  154. The float function will make water vehicles float above the surface. If you've
  155. given your water tiles some depth(), this will unsink your ships.  
  156. Example: float(0.3)
  157.  
  158. The fringe function will change the height of your star tiles.  
  159. Example: fringe(2)
  160.  
  161.  
  162.  
  163. ### Changing tile shapes
  164.  
  165. There are a few special shapes which can be given to your tiles using the
  166. shape() function. Valid shapes are FLAT, FENCE, CROSS, and XCROSS.  
  167. Examples: shape(fence), shape(xcross)
  168.  
  169.  
  170.  
  171. ### Slope Tiles
  172.  
  173. Slope tiles can be used to make hills or stairs to move between elevations.
  174. The slope tiles will automatically try to choose their direction.  
  175. Directional passage will prevent the slope tile from facing certain
  176. directions.  
  177. Second parameter forces slope to face certain direction.
  178. Directions are n, s, e, and w.
  179. Shadow pen can be used to force slope to face a certain direction.
  180. Draw a shadow on the side you want the slope to face.
  181. Example: slope(1), slope(0.45,n), slope(2,e)
  182.  
  183. ### Tile Passage
  184.  
  185. The pass function will change the passage rules for the tile.  
  186. This can be used to get star passage on A tiles, or to have different passage
  187. rules depending on if 3D is enabled.
  188. Examples: pass(o), pass(x), pass(*)
  189.  
  190. ---
  191.  
  192.  
  193. ## Event Configuration
  194.  
  195. Event configurations can be placed in either the event note or comments, and
  196. mush be wrapped in a <mv3d:   > tag.
  197. A few configuration functions, such as pos, will behave slightly differently
  198. depending on whether they're placed in the note or comments.
  199.  
  200. Here's some examples.
  201.  
  202. First let's make an event that displays on the edge of a wall.
  203.  
  204.     <mv3d:shape(fence),scale(0.9,1.3),y(0.51),rot(0),z(0)>
  205.  
  206. Next let's attach a flashlight to an event.
  207.  
  208.     <mv3d:flashlight(white,2,6,30)>
  209.  
  210.  
  211.  
  212. ### Adjust event position
  213.  
  214. The x() and y() functions will offset the x and y position of the event's
  215. mesh.  
  216. Example: y(0.51)
  217.  
  218. The height() function will adjust the event's height above the ground.  
  219. Example: height(2)
  220.  
  221. The z() function will set the event's absolute z position, ignoring ground
  222. level.  
  223. Example: z(0)
  224.  
  225. The pos() function will change the position of the event. This can be used to
  226. make two events occupy the same space. Prefix numbers with + to use relative
  227. coordinates.  
  228. Examples: pos(1,2), pos(+0,+-1)
  229.  
  230.  
  231.  
  232. ### Change event shape
  233.  
  234. Use the shape function to set what shape the event should use. Valid event
  235. shapes are FLAT, SPRITE, TREE, WALL, FENCE, CROSS, and XCROSS.  
  236. FLAT will make the event lie flat on the ground like a tile.  
  237. SPRITE will make the event rotate to always face the camera.  
  238. TREE will make the event stand up, but rotate horizontally toward camera.  
  239. WALL and FENCE will make the tile stand up without rotating. FENCE is an
  240. alias of WALL.  
  241. CROSS and XCROSS will make the event use a cross mesh. XCROSS is rotated
  242. 45 degrees.  
  243. Example: shape(tree)
  244.  
  245. The scale function can change the size of the event.  
  246. Examples: scale(2,2), scale(1.5,3)
  247.  
  248. The yaw function will rotate the event's mesh horizontally. Rotation applies
  249. before pitch. Doesn't work with Sprite or Tree shapes.  
  250. 0 is south, 90 is east, 180 is north, and 270 is west.  
  251. Example: yaw(45)
  252.  
  253. The pitch function will tilt the event's mesh vertically. Doesn't worth with
  254. Sprite shapes.  
  255. Example: pitch(20)
  256.  
  257. The rot function will rotate the event's mesh horizontally. Rotation applies
  258. after pitch. Doesn't work with Sprite or Tree shapes.  
  259. Example: rot(45)
  260.  
  261.  
  262.  
  263. ### Event Lights
  264.  
  265. The lamp function attaches a point light to the event.
  266. Parameter list: color,intensity,range
  267. Examples: lamp(white,0.5,1), lamp(#ff8888,1,3)
  268.  
  269.  
  270. The flashlight function attaches a spotlight to the event.
  271. Parameter list: color,intensity,range,angle|yaw,pitch
  272. Examples: flashlight(#ffffff,2,6,30), flashlight(red,2,6,45|90)
  273.  
  274.  
  275. The height and offset of the lights can be set with lightHeight() and
  276. lightOffset().  
  277. Examples: lightHeight(0.5), lightOffset(0,1.01)
  278.  
  279.  
  280.  
  281. ### Other event settings
  282.  
  283. You can set whether the event is affected by bush tiles using the bush
  284. function.  
  285. Examples: bush(true), bush(false)
  286.  
  287. You can disable or change the size of the event's shadow using the shadow
  288. function.  
  289. Examples: shadow(0), shadow(3)
  290.  
  291. The alpha function is used to make the event partially transparent or to turn
  292. on alpha blending.  
  293. Examples: alpha(0.5), alpha(1)
  294.  
  295. The dirfix function will set whether the event rotates depending on the camera
  296. angle.  
  297. Examples: dirfix(true), dirfix(false)
  298.  
  299. The platform function will set whether the event can be walked on.  
  300. Example: platform(true)
  301.  
  302. The gravity function will set the fall speed of the event.
  303. Example: gravity(10)
  304.  
  305. The collide will set the event's collision height.  
  306. collide(false) acts as a shorthand for collide(0),platform(false)  
  307. Examples: collide(0), collide(1), collide(1.5)
  308.  
  309. The trigger event will set the height range the event can be triggered from.
  310. The first parameter is the height above the event, and the second is the
  311. height below the event.
  312. Examples: trigger(Infinity,Infinity), trigger(0), trigger(2,1)
  313.  
  314. The pass function when used on events acts as a shorthand for platform and
  315. collide.  
  316. pass(o) turns on platform
  317. pass(x) turns off platform and turns on collision.
  318. pass(*) turns off platform and collision.
  319.  
  320. ---
  321.  
  322. ## Map Configuration
  323.  
  324. Map configuration goes in the note area of the map settings. Configurations
  325. should be placed in an <mv3d></mv3d> block, which should contain a list of
  326. configuration functions.
  327.  
  328. Some of these configurations apply when the map is loaded, while others affect
  329. how the map is rendered.
  330.  
  331. ---
  332.  
  333. ### Light and Fog
  334.  
  335. The light function will set the ambient light level for the map.  
  336. The ambient function is an alias for the light function.  
  337. Examples: light(white), ambient(gray), ambient(#222222), light(rebeccaPurple)
  338.  
  339. The fog function sets the color and distance of the fog.  
  340. Parameter list: color|near,far  
  341. Examples: fog(white|10,20), fog(#e1feff), fog(black|20,30)
  342.  
  343.  
  344.  
  345. ### Camera Settings
  346.  
  347. The camera function can be used to set various properties of the camera,
  348. including the rotation, distance, height, and projection mode.  
  349. Parameter list: yaw,pitch|dist|height|mode  
  350. Examples: camera(0,60,dist:5,height:0.75), camera(45,45),
  351.     camera(mode:orthographic), camera(mode:perspective)
  352.  
  353.  
  354.  
  355. ### Setting a ceiling for the map
  356.  
  357. The ceiling function sets a ceiling texture and height, and also supports
  358. all the other properties from the texture function like alpha and animation.  
  359. Parameter List:  
  360. img,x,y,w,h|height|alpha|glow[anim]animx,animy  
  361. Example: ceiling(A4,0,0|2)
  362.  
  363.  
  364.  
  365. ### Other map settings
  366.  
  367. The edge function sets whether to render walls at the map edge.  
  368. Examples: edge(true), edge(false)
  369.  
  370. The disable function will turn off the 3D rendering for the map.  
  371. Example: disable()
  372.  
  373.  
  374. ---
  375.  
  376.  
  377. ## Plugin Commands
  378.  
  379. In this documentation, the parts surrounded with angle bracks like <n> are
  380. parameters.  
  381. <n> means number.  
  382. <t> means time.  
  383.  
  384. Some commands (like lamp and flashlight) act on a character. By default the
  385. target character will be the current event.
  386. You can define your own target using the following syntax:
  387.  
  388.     mv3d @target rest of the command
  389.  
  390. If the second word in the command starts with `@`, that will be interpreted
  391. as the target.
  392.  
  393. Valid targets:
  394.  
  395. - @p or @player: Targets $gamePlayer.
  396. - @e0, @e1, @e2, @e25 etc: Targets event with specified id.
  397. - @f0, @f1, @f2, etc: Targets first, second, third follower, etc.
  398. - @v0, @v1, @v2: Boat, Ship, Airship.
  399.  
  400. Some parameters can be prefixed with + to be set relative to the current
  401. value.
  402.  
  403. For example:
  404.  
  405.     mv3d camera yaw +-45 0.5
  406.  
  407. ---
  408.  
  409.     mv3d camera pitch <n> <t>
  410.     mv3d camera yaw <n> <t>
  411.     mv3d camera dist <n> <t>
  412.     mv3d camera height <n> <t>
  413.  
  414. Sets the camera properties, where <n> is the new value and <t> is the time to
  415. interpolate to the new value.  
  416. Prefix <n> with + to modify the current value instead of setting a new
  417. value.
  418.  
  419. ---
  420.  
  421.     mv3d camera mode <mode>
  422.  
  423. Set camera mode to PERSPECTIVE or ORTHOGRAPHIC
  424.  
  425. ---
  426.  
  427.     mv3d allowRotation <true/false>
  428.     mv3d allowPitch <true/false>
  429.  
  430. Sets whether keyboard control for rotation / pitch is enabled.  
  431. allowRotation is ignored in 1st person mode.
  432.  
  433.     mv3d lockCamera <true/false>
  434.  
  435. Locks the camera, preventing keyboard control of rotation & pitch.  
  436.  
  437. ---
  438.  
  439.     mv3d fog color <color> <t>
  440.     mv3d fog near <n> <t>
  441.     mv3d fog far <n> <t>
  442.     mv3d fog dist <near> <far> <t>
  443.     mv3d fog <color> <near> <far> <t>
  444.  
  445. <t> is time.  
  446. Prefix values with + to modify the current values instead of setting new
  447. values.
  448.  
  449. ---
  450.  
  451.     mv3d light <color> <t>
  452.     mv3d ambient <color> <t>
  453.  
  454. Sets the color for the ambient light.
  455.  
  456. ---
  457.  
  458.     mv3d @t lamp color <color> <t>
  459.     mv3d @t lamp intensity <n> <t>
  460.     mv3d @t lamp dist <n> <t>
  461.     mv3d @t lamp <color> <intensity> <dist> <t>
  462.  
  463. ---
  464.  
  465.     mv3d @t flashlight color <color> <t>
  466.     mv3d @t flashlight intensity <n> <t>
  467.     mv3d @t flashlight dist <n> <t>
  468.     mv3d @t flashlight angle <deg> <t>
  469.     mv3d @t flashlight pitch <deg> <t>
  470.     mv3d @t flashlight yaw <deg> <t>
  471.     mv3d @t flashlight <color> <intensity> <dist> <angle> <t>
  472.  
  473. Angle is beam width of the flashlight.
  474.  
  475. ---
  476.  
  477.     mv3d camera target @t <t>
  478.  
  479. Change the camera's target.
  480. Camera will transition to the new target over time <t>.
  481.  
  482. ---
  483.  
  484.     mv3d camera pan <x> <y> <t>
  485.     mv3d pan <x> <y> <t>
  486.  
  487. Pans the camera view, relative to current target.
  488.  
  489. ---
  490.  
  491.     mv3d disable
  492.     mv3d enable
  493.  
  494. Turns 3D rendering on or off.
  495.  
  496. ---
  497.  
  498.     mv3d @t elevation <n> <t>
  499.  
  500. Sets the elevation of the target character.
  501.  
  502. ---
  503.  
  504. ### Vehicle Commands
  505.  
  506.     mv3d <vehicle> speed <n>
  507.     mv3d airship height <n>
  508.  
  509. The vehicles are boat, ship, and airship.  
  510. Speed of the vehicle should be 1-6. It works the same as event speed.  
  511. A higher airship can fly over higher mountains. Perhaps you could let the
  512. player upgrade their airship's height and speed.
  513.  
  514.  
  515. ---
  516.  
  517. ## Patron Supporters:
  518.  
  519. - Yorae Rasante
  520. - JosephSeraph
  521. - HuskyTrooper
  522. - rpgmakerunion.ru
  523. - CrysHistory
  524. - GamesOfShadows
  525. - 中华国哥
  526. - FREELANDLOL (LvUp)
  527. - J. Dewar
  528. - Goomy
  529. - omegamer
  530. - Mercylessly
  531. - 르붐바 차
  532. - Anger & Rage Interactive
  533. - CoopNinjask
  534.  
  535. ## Patron Knights:
  536.  
  537. - Whitely
  538. - Izybelle
  539. - Pumpkin Boss
  540. - 冬空 橙
  541.  
  542. ## Patron Heroes:
  543.  
  544. - A Memory of Eternity
  545. - zxc
  546. - Fyoha
  547.  
  548. @param options
  549. @text Option Settings
  550.  
  551. @param 3dMenu
  552. @text 3D Options Menu
  553. @desc Whether 3D options will be in a submenu, regular options menu, or disabled.
  554. @type combo
  555. @option SUBMENU
  556. @option ENABLE
  557. @option DISABLE
  558. @default SUBMENU
  559.  
  560. @param renderDist
  561. @text Default Render Distance
  562. @desc The maximum distance that can be rendered by the camera.
  563. @parent options
  564. @type Number
  565. @default 25
  566.  
  567. @param mipmap
  568. @text Mipmap Default
  569. @parent options
  570. @type Boolean
  571. @default true
  572.  
  573. @param mipmapOption
  574. @text Mipmap Option
  575. @desc Should Mipmapping appear on options menu?
  576. @parent options
  577. @type Boolean
  578. @default true
  579.  
  580. @param graphics
  581. @text Graphics
  582.  
  583. @param antialiasing
  584. @text Antialiasing
  585. @parent graphics
  586. @type Boolean
  587. @default true
  588.  
  589. @param fov
  590. @text FOV
  591. @parent graphics
  592. @type Number
  593. @default 65
  594.  
  595. @param edgefix
  596. @text Edge Fix
  597. @desc Fixes rendering issues at the edges of tiles.
  598. @parent graphics
  599. @type Number
  600. @decimals 1
  601. @default 0.5
  602.  
  603. @param alphatest
  604. @text Alpha Cutoff
  605. @desc Pixels with alpha below this value will not be rendered.
  606. @parent graphics
  607. @type Number
  608. @decimals 2
  609. @min 0.01 @max 1
  610. @default 0.51
  611.  
  612. @param lightLimit
  613. @text Lights Per Mesh
  614. @parent graphics
  615. @type Number
  616. @min 4
  617. @default auto
  618.  
  619. @param map
  620. @text Map Settings
  621.  
  622. @param enabledDefault
  623. @text Enabled by Default
  624. @desc Whether 3D map rendering is enabled by default.
  625. @parent map
  626. @type Boolean
  627. @default true
  628.  
  629. @param cellSize
  630. @text Cell Size
  631. @desc The size of the chunks the map is divided into.
  632. @parent map
  633. @type Number
  634. @default 10
  635.  
  636. @param unloadCells
  637. @text Unload Far Cells
  638. @desc Unload cells outside the render distance.
  639. @parent map
  640. @type Boolean
  641. @default false
  642.  
  643. @param fog
  644. @text Fog
  645.  
  646. @param fogColor
  647. @text Fog Color
  648. @desc The color of the fog. Use css color code or name (example: #ffffff)
  649. @parent fog
  650. @type Color
  651. @default black
  652.  
  653. @param fogNear
  654. @text Fog Start Distance
  655. @desc The distance in tiles at which the fog will start.
  656. @parent fog
  657. @type Number
  658. @decimals 1
  659. @default 20.0
  660.  
  661. @param fogFar
  662. @text Fog End Distance
  663. @desc The distance in tiles at which the fog will finish. Maybe set this to the same as render distance.
  664. @parent fog
  665. @type Number
  666. @decimals 1
  667. @default 25.0
  668.  
  669. @param input
  670. @text Input & Gameplay
  671.  
  672. @param keyboardPitch
  673. @text Control pitch with keyboard
  674. @parent input
  675. @desc Allow player to change pitch with pageup & pagedown.
  676. @type Boolean
  677. @default true
  678.  
  679. @param keyboardTurn
  680. @text Rotate camera with keyboard
  681. @parent input
  682. @desc In 3rd person mode, Q&E will rotate camera.
  683. @type Boolean
  684. @default true
  685.  
  686. @param keyboardStrafe
  687. @text Enable Strafing
  688. @parent input
  689. @desc In 1st person mode, Q&E will strafe left and right.
  690. @type Boolean
  691. @default true
  692.  
  693. @param stairThresh
  694. @text Stair Threshold
  695. @desc If the distance in height between two tiles is less than this, they will be passable.
  696. @parent input
  697. @type Number
  698. @decimals 2
  699. @default 0.1
  700.  
  701. @param walkOffEdge
  702. @text Walk off Edge
  703. @parent input
  704. @type Boolean
  705. @default false
  706.  
  707. @param walkOnEvents
  708. @text Walk on Events
  709. @parent input
  710. @type Boolean
  711. @default true
  712.  
  713. @param gravity
  714. @text Gravity
  715. @desc The speed characters will fall, in tiles per second.
  716. @parent input
  717. @type Number
  718. @decimals 2
  719. @default 8
  720.  
  721. @param tileconfig
  722. @text Tile Config
  723.  
  724. @param wallHeight
  725. @text Wall Height
  726. @desc The default height for wall tiles
  727. @parent tileconfig
  728. @type Number
  729. @min -9999 @max 9999
  730. @decimals 1
  731. @default 2.0
  732.  
  733. @param tableHeight
  734. @text Table Height
  735. @desc The default height for table tiles
  736. @parent tileconfig
  737. @type Number
  738. @min -9999 @max 9999
  739. @decimals 2
  740. @default 0.33
  741.  
  742. @param fringeHeight
  743. @text Fringe Height
  744. @parent tileconfig
  745. @type Number
  746. @min -9999 @max 9999
  747. @decimals 1
  748. @default 2.0
  749.  
  750. @param ceilingHeight
  751. @text Ceiling Height
  752. @desc Default height of ceiling for maps with ceiling enabled.
  753. @parent tileconfig
  754. @type Number
  755. @min -9999 @max 9999
  756. @decimals 1
  757. @default 2.0
  758.  
  759. @param layerDist
  760. @text Layering Distance
  761. @desc The distance between tile layers. If this is too small
  762. there may be z-fighting issues. (default: 0.0100)
  763. @parent tileconfig
  764. @type Number
  765. @decimals 4
  766. @default 0.0100
  767.  
  768. @param animDelay
  769. @text Animation Speed
  770. @desc The number of milliseconds between each frame in tile animations.
  771. @parent tileconfig
  772. @type Number
  773. @default 333
  774.  
  775. @param regions
  776. @text Regions
  777. @desc use regions to determine tile height.
  778. @parent tileconfig
  779. @type struct<RegionHeight>[]
  780. @default ["{\"regionId\":\"1\",\"conf\":\"height(1)\"}","{\"regionId\":\"2\",\"conf\":\"height(2)\"}","{\"regionId\":\"3\",\"conf\":\"height(3)\"}","{\"regionId\":\"4\",\"conf\":\"height(4)\"}","{\"regionId\":\"5\",\"conf\":\"height(5)\"}","{\"regionId\":\"6\",\"conf\":\"height(6)\"}","{\"regionId\":\"7\",\"conf\":\"height(7)\"}"]
  781.  
  782. @param ttags
  783. @text Terrain Tags
  784. @desc use terrain tags to determine tile height.
  785. @parent tileconfig
  786. @type struct<TTagHeight>[]
  787. @default ["{\"terrainTag\":\"1\",\"conf\":\"shape(xcross),height(1),fringe(0)\"}","{\"terrainTag\":\"2\",\"conf\":\"shape(fence),height(1)\"}"]
  788.  
  789. @param characters
  790. @text Characters
  791.  
  792. @param eventCharDefaults
  793. @text Character Event Settings
  794. @parent characters
  795. @type Text
  796. @default shadow(0.8,4),shape(sprite),scale(1)
  797.  
  798. @param eventObjDefaults
  799. @text Object Event Settings
  800. @parent characters
  801. @type Text
  802. @default shadow(0),shape(sprite),scale(1)
  803.  
  804. @param eventTileDefaults
  805. @text Tile Event Settings
  806. @parent characters
  807. @type Text
  808. @default shadow(0),shape(flat),scale(1)
  809.  
  810. @param eventHeight
  811. @text Event "Above Characters" Default Height
  812. @parent characters
  813. @type Number
  814. @decimals 1
  815. @default 2.0
  816.  
  817. @param boatSettings
  818. @text Boat Settings
  819. @parent characters
  820. @type struct<BoatStruct>
  821. @default {"conf":"shadow(0.8,4),shape(sprite),scale(1),bush(false)"}
  822.  
  823. @param shipSettings
  824. @text Ship Settings
  825. @parent characters
  826. @type struct<BoatStruct>
  827. @default {"conf":"shadow(0.8,4),shape(sprite),scale(1),bush(false)"}
  828.  
  829. @param airshipSettings
  830. @text Airship Settings
  831. @parent characters
  832. @type struct<AirshipStruct>
  833. @default {"conf":"shadow(1,6),shape(sprite),scale(1),bush(false)","height":"2.0","bushLanding":"false"}
  834.  
  835. @param allowGlide
  836. @text Allow Glide
  837. @desc If true, collision detection for flying characters will use only current elevation and not target elevation.
  838. @parent characters
  839. @type Boolean
  840. @default true
  841.  
  842. @param spriteOffset
  843. @text Sprite Offset
  844. @parent characters
  845. @type Number
  846. @min 0 @max 1
  847. @decimals 2
  848. @default 0.9
  849. */
  850. /*~struct~RegionHeight:
  851. @param regionId
  852. @text Region Id
  853. @type Number
  854. @min 1 @max 255
  855. @default 1
  856.  
  857. @param conf
  858. @text Configuration Functions
  859. @desc See tileset configuration for list of functions
  860. @type Text
  861. @default height(2)
  862. */
  863. /*~struct~TTagHeight:
  864. @param terrainTag
  865. @text Terrain Tag
  866. @type Number
  867. @min 1 @max 7
  868. @default 1
  869.  
  870. @param conf
  871. @text Configuration Functions
  872. @desc See tileset configuration for list of functions
  873. @type Text
  874. @default shape(flat),height(0)
  875. */
  876. /*~struct~BoatStruct:
  877. @param conf
  878. @text Settings
  879. @type Text
  880. @default shadow(0.8,4),shape(sprite),scale(1),bush(false)
  881.  
  882. */
  883. /*~struct~AirshipStruct:
  884. @param conf
  885. @text Settings
  886. @type Text
  887. @default shadow(1,6),shape(sprite),scale(1),bush(false)
  888.  
  889. @param height
  890. @text Elevation
  891. @type Number
  892. @decimals 1
  893. @default 2.0
  894.  
  895. @param bushLanding
  896. @text Land on Bush Tiles
  897. @desc Whether the airship can land on bush tiles.
  898. @type Boolean
  899. @default false
  900.  
  901. */
  902. ! function (t)
  903. {
  904.     var e = {};
  905.  
  906.     function i(a)
  907.     {
  908.         if (e[a]) return e[a].exports;
  909.         var s = e[a] = {
  910.             i: a,
  911.             l: !1,
  912.             exports:
  913.             {}
  914.         };
  915.         return t[a].call(s.exports, s, s.exports, i), s.l = !0, s.exports
  916.     }
  917.     i.m = t, i.c = e, i.d = function (t, e, a)
  918.     {
  919.         i.o(t, e) || Object.defineProperty(t, e,
  920.         {
  921.             enumerable: !0,
  922.             get: a
  923.         })
  924.     }, i.r = function (t)
  925.     {
  926.         "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag,
  927.         {
  928.             value: "Module"
  929.         }), Object.defineProperty(t, "__esModule",
  930.         {
  931.             value: !0
  932.         })
  933.     }, i.t = function (t, e)
  934.     {
  935.         if (1 & e && (t = i(t)), 8 & e) return t;
  936.         if (4 & e && "object" == typeof t && t && t.__esModule) return t;
  937.         var a = Object.create(null);
  938.         if (i.r(a), Object.defineProperty(a, "default",
  939.             {
  940.                 enumerable: !0,
  941.                 value: t
  942.             }), 2 & e && "string" != typeof t)
  943.             for (var s in t) i.d(a, s, function (e)
  944.             {
  945.                 return t[e]
  946.             }.bind(null, s));
  947.         return a
  948.     }, i.n = function (t)
  949.     {
  950.         var e = t && t.__esModule ? function ()
  951.         {
  952.             return t.default
  953.         } : function ()
  954.         {
  955.             return t
  956.         };
  957.         return i.d(e, "a", e), e
  958.     }, i.o = function (t, e)
  959.     {
  960.         return Object.prototype.hasOwnProperty.call(t, e)
  961.     }, i.p = "", i(i.s = 10)
  962. }([function (t, e, i)
  963. {
  964.     "use strict";
  965.     var a = i(2),
  966.         s = i(1);
  967.     const r = {
  968.         util: s.h,
  969.         setup()
  970.         {
  971.             if (this.setupParameters(), Object(a.A)(), this.canvas = document.createElement("canvas"), this.texture = PIXI.Texture.fromCanvas(this.canvas), this.engine = new a.d(this.canvas, this.ANTIALIASING), this.scene = new a.p(this.engine), this.scene.clearColor.set(0, 0, 0, 0), this.cameraStick = new a.v("cameraStick", this.scene), this.cameraNode = new a.v("cameraNode", this.scene), this.cameraNode.parent = this.cameraStick, this.camera = new a.g("camera", new a.x(0, 0, 0), this.scene), this.camera.parent = this.cameraNode, this.camera.fov = Object(s.i)(r.FOV), this.camera.minZ = .1, this.camera.maxZ = this.RENDER_DIST, this.scene.ambientColor = new a.b(1, 1, 1), this.scene.fogMode = a.e, this.map = new a.k("map", this.scene), this.cells = {}, this.characters = [], this.setupBlenders(), this.setupInput(), this.setupSpriteMeshes(), this.callFeatures("setup"), isNaN(this.LIGHT_LIMIT))
  972.             {
  973.                 const t = BABYLON.Scene.prototype.sortLightsByPriority;
  974.                 BABYLON.Scene.prototype.sortLightsByPriority = function ()
  975.                 {
  976.                     t.apply(this, arguments), r.updateAutoLightLimit()
  977.                 }
  978.             }
  979.         },
  980.         updateCanvas()
  981.         {
  982.             this.canvas.width = Graphics._width, this.canvas.height = Graphics._height
  983.         },
  984.         render()
  985.         {
  986.             this.scene.render(), this.texture.update()
  987.         },
  988.         lastMapUpdate: 0,
  989.         update()
  990.         {
  991.             performance.now() - this.lastMapUpdate > 1e3 && !this.mapUpdating && (this.updateMap(), this.lastMapUpdate = performance.now()), this.updateAnimations(), this.updateCharacters(), this.updateBlenders(), this.isDisabled() || this.loadData("cameraLocked") || ((this.loadData("allowRotation", r.KEYBOARD_TURN) || this.is1stPerson()) && (Input.isTriggered("rotleft") ? this.blendCameraYaw.setValue(this.blendCameraYaw.targetValue() + 90, .5) : Input.isTriggered("rotright") && this.blendCameraYaw.setValue(this.blendCameraYaw.targetValue() - 90, .5), this.is1stPerson() && (Input.isTriggered("rotleft") || Input.isTriggered("rotright")) && this.playerFaceYaw()), this.loadData("allowPitch", r.KEYBOARD_PITCH) && (Input.isPressed("pageup") && Input.isPressed("pagedown") || (Input.isPressed("pageup") ? this.blendCameraPitch.setValue(Math.min(180, this.blendCameraPitch.targetValue() + 1.5), .1) : Input.isPressed("pagedown") && this.blendCameraPitch.setValue(Math.max(0, this.blendCameraPitch.targetValue() - 1.5), .1))));
  992.             for (const t in this.cells) this.cells[t].update();
  993.             this.callFeatures("update"), this.updateData()
  994.         },
  995.         loadData: (t, e) => $gameVariables && $gameVariables.mv3d && t in $gameVariables.mv3d ? $gameVariables.mv3d[t] : e,
  996.         saveData(t, e)
  997.         {
  998.             if (!$gameVariables) return console.warn(`MV3D: Couldn't save data ${t}:${e}`);
  999.             $gameVariables.mv3d || ($gameVariables.mv3d = {}), $gameVariables.mv3d[t] = e
  1000.         },
  1001.         updateCameraMode()
  1002.         {
  1003.             let t = !1;
  1004.             this.cameraMode.startsWith("O") ? this.camera.mode !== a.l && (this.camera.mode = a.l, t = !0) : this.camera.mode !== a.m && (this.camera.mode = a.m, t = !0), t && (this.updateBlenders(!0), this.callFeatures("updateCameraMode"), this.updateParameters())
  1005.         },
  1006.         get cameraMode()
  1007.         {
  1008.             return this.loadData("cameraMode", this.CAMERA_MODE).toUpperCase()
  1009.         },
  1010.         set cameraMode(t)
  1011.         {
  1012.             t = String(t).toUpperCase().startsWith("O") ? "ORTHOGRAPHIC" : "PERSPECTIVE", this.saveData("cameraMode", t), this.updateBlenders(!0)
  1013.         },
  1014.         is1stPerson(t)
  1015.         {
  1016.             const e = t ? "currentValue" : "targetValue";
  1017.             return this.getCameraTarget() === $gamePlayer && this.blendCameraTransition[e]() <= 0 && this.blendCameraDist[e]() <= 0 && 0 === this.blendPanX[e]() && 0 === this.blendPanY[e]()
  1018.         },
  1019.         isDisabled()
  1020.         {
  1021.             return this.loadData("disabled", this.getMapConfig("disabled", !r.ENABLED_DEFAULT))
  1022.         },
  1023.         disable(t = 2)
  1024.         {
  1025.             r.saveData("disabled", !0), $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y, $gamePlayer.direction(), t)
  1026.         },
  1027.         enable(t = 2)
  1028.         {
  1029.             r.saveData("disabled", !1), $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y, $gamePlayer.direction(), t), r.createCharacters()
  1030.         },
  1031.         loopCoords(t, e)
  1032.         {
  1033.             if ($gameMap.isLoopHorizontal())
  1034.             {
  1035.                 const e = $gameMap.width(),
  1036.                     i = this.cameraStick.x - e / 2;
  1037.                 t = (t - i).mod(e) + i
  1038.             }
  1039.             if ($gameMap.isLoopVertical())
  1040.             {
  1041.                 const t = $gameMap.height(),
  1042.                     i = this.cameraStick.y - t / 2;
  1043.                 e = (e - i).mod(t) + i
  1044.             }
  1045.             return new a.w(t, e)
  1046.         },
  1047.         playerFaceYaw()
  1048.         {
  1049.             let t = Math.floor((45 - r.blendCameraYaw.targetValue()) / 90).mod(4);
  1050.             t > 1 && (t += (t + 1) % 2 * 2 - 1), t = 10 - (2 * t + 2), $gamePlayer.setDirection(t)
  1051.         },
  1052.         dirToYaw(t)
  1053.         {
  1054.             let e = t / 2 - 1;
  1055.             return e > 1 && (e += (e + 1) % 2 * 2 - 1), e = -90 * e + 180
  1056.         },
  1057.         transformDirectionYaw(t, e = this.blendCameraYaw.currentValue(), i = !1)
  1058.         {
  1059.             if (0 == t) return 0;
  1060.             (t = t / 2 - 1) > 1 && (t += (t + 1) % 2 * 2 - 1);
  1061.             const a = Math.floor((e + 45) / 90);
  1062.             return (t = i ? (t - a).mod(4) : (t + a).mod(4)) > 1 && (t += (t + 1) % 2 * 2 - 1), 2 * t + 2
  1063.         },
  1064.         autoLightLimit(t)
  1065.         {
  1066.             return isNaN(this.LIGHT_LIMIT) ? Math.max(4, t) : this.LIGHT_LIMIT
  1067.         },
  1068.         updateAutoLightLimit()
  1069.         {
  1070.             const t = this.autoLightLimit(r.scene.lights.length);
  1071.             for (const e of Object.values(r.materialCache)) e.maxSimultaneousLights = t;
  1072.             for (const t of this.characters) t.material && (t.material.maxSimultaneousLights = this.autoLightLimit(t.mesh.lightSources.length))
  1073.         },
  1074.         getFieldSize(t = r.blendCameraDist.currentValue())
  1075.         {
  1076.             const e = Math.tan(r.camera.fov / 2) * t * 2;
  1077.             return {
  1078.                 width: e * r.engine.getAspectRatio(r.camera),
  1079.                 height: e
  1080.             }
  1081.         },
  1082.         getScaleForDist(t = r.blendCameraDist.currentValue())
  1083.         {
  1084.             return Graphics.height / this.getFieldSize(t).height / 48
  1085.         },
  1086.         getScreenPosition(t, e = a.x.Zero())
  1087.         {
  1088.             const i = t.parent ? t.parent.getWorldMatrix() : BABYLON.Matrix.Identity(),
  1089.                 s = t instanceof a.x ? t.add(e) : t.position.add(e),
  1090.                 n = a.x.Project(s, i, r.scene.getTransformMatrix(), r.camera.viewport);
  1091.             return {
  1092.                 x: n.x * Graphics.width,
  1093.                 y: n.y * Graphics.height,
  1094.                 behindCamera: n.z > 1
  1095.             }
  1096.         }
  1097.     };
  1098.     window.mv3d = r, e.a = r
  1099. }, function (t, e, i)
  1100. {
  1101.     "use strict";
  1102.     i.d(e, "k", (function ()
  1103.     {
  1104.         return h
  1105.     })), i.d(e, "o", (function ()
  1106.     {
  1107.         return l
  1108.     })), i.d(e, "e", (function ()
  1109.     {
  1110.         return c
  1111.     })), i.d(e, "f", (function ()
  1112.     {
  1113.         return p
  1114.     })), i.d(e, "j", (function ()
  1115.     {
  1116.         return u
  1117.     })), i.d(e, "q", (function ()
  1118.     {
  1119.         return d
  1120.     })), i.d(e, "i", (function ()
  1121.     {
  1122.         return g
  1123.     })), i.d(e, "n", (function ()
  1124.     {
  1125.         return m
  1126.     })), i.d(e, "p", (function ()
  1127.     {
  1128.         return f
  1129.     })), i.d(e, "g", (function ()
  1130.     {
  1131.         return _
  1132.     })), i.d(e, "u", (function ()
  1133.     {
  1134.         return b
  1135.     })), i.d(e, "s", (function ()
  1136.     {
  1137.         return T
  1138.     })), i.d(e, "t", (function ()
  1139.     {
  1140.         return C
  1141.     })), i.d(e, "r", (function ()
  1142.     {
  1143.         return y
  1144.     })), i.d(e, "b", (function ()
  1145.     {
  1146.         return S
  1147.     })), i.d(e, "c", (function ()
  1148.     {
  1149.         return M
  1150.     })), i.d(e, "d", (function ()
  1151.     {
  1152.         return E
  1153.     })), i.d(e, "a", (function ()
  1154.     {
  1155.         return I
  1156.     })), i.d(e, "l", (function ()
  1157.     {
  1158.         return L
  1159.     })), i.d(e, "m", (function ()
  1160.     {
  1161.         return D
  1162.     }));
  1163.     var a = i(0);
  1164.     const
  1165.     {
  1166.         Vector2: s,
  1167.         Vector3: r,
  1168.         Color3: n,
  1169.         Color4: o
  1170.     } = window.BABYLON, h = t =>
  1171.     {
  1172.         if ("number" == typeof t) return {
  1173.             r: (t >> 16) / 255,
  1174.             g: (t >> 8 & 255) / 255,
  1175.             b: (255 & t) / 255,
  1176.             a: 1
  1177.         };
  1178.         if (t instanceof n) return t.toColor4();
  1179.         if (t instanceof o) return t;
  1180.         {
  1181.             const e = document.createElement("canvas");
  1182.             e.width = 1, e.height = 1;
  1183.             const i = e.getContext("2d");
  1184.             i.fillStyle = t, i.fillRect(0, 0, 1, 1);
  1185.             const a = i.getImageData(0, 0, 1, 1).data;
  1186.             return new o(a[0] / 255, a[1] / 255, a[2] / 255, a[3] / 255)
  1187.         }
  1188.     }, l = (t, e) =>
  1189.     {
  1190.         if ("" === e) return +t;
  1191.         const i = /^[+]/.test(e);
  1192.         return i && (e = e.substr(1)), e = Number(e), Number.isNaN(e) ? +t : i ? +t + e : +e
  1193.     }, c = t => isNaN(t) ? p(t) : Number(t), p = t => Boolean(u(t)), u = t =>
  1194.     {
  1195.         if (!t) return !1;
  1196.         "string" != typeof t && (t = String(t));
  1197.         const e = t.toUpperCase();
  1198.         return !u.values.includes(e) && t
  1199.     };
  1200.     u.values = ["OFF", "FALSE", "UNDEFINED", "NULL", "DISABLE", "DISABLED"];
  1201.     const d = (t = 0) => new Promise(e => setTimeout(e, t)),
  1202.         g = t => t * Math.PI / 180,
  1203.         m = t => 180 * t / Math.PI,
  1204.         f = t => b(Math.sin(t)),
  1205.         _ = t => b(Math.cos(t)),
  1206.         b = t => Math.round(1e3 * t) / 1e3,
  1207.         T = () => C(),
  1208.         C = () => Game_Map.prototype.tileWidth(),
  1209.         y = () => Game_Map.prototype.tileHeight(),
  1210.         S = new r(1, 0, 0),
  1211.         M = new r(0, 1, 0),
  1212.         E = new r(0, 0, 1),
  1213.         v = new s(0, 0),
  1214.         O = new r(0, 0, 0),
  1215.         I = Math.PI,
  1216.         w = 2 * Math.PI,
  1217.         L = t =>
  1218.         {
  1219.             const e = function ()
  1220.             {
  1221.                 const e = arguments.length;
  1222.                 return "function" == typeof t[e] ? t[e].apply(this, arguments) : "function" == typeof t.default ? t.default.apply(this, arguments) : void console.warn("Unsupported number of arguments.")
  1223.             };
  1224.             for (const i in t) e[i] = t[i].bind;
  1225.             return e
  1226.         },
  1227.         A = () => !a.a.isDisabled(),
  1228.         D = (t, e, i, a = A) =>
  1229.         {
  1230.             const s = t[e],
  1231.                 r = i(s);
  1232.             return t[e] = function ()
  1233.             {
  1234.                 return ("function" == typeof a ? a() : a) ? r.apply(this, arguments) : s.apply(this, arguments)
  1235.             }
  1236.         },
  1237.         x = {
  1238.             makeColor: h,
  1239.             hexNumber: t => ((t = String(t)).startsWith("#") && (t = t.substr(1)), Number.parseInt(t, 16)),
  1240.             relativeNumber: l,
  1241.             booleanString: p,
  1242.             falseString: u,
  1243.             booleanNumber: c,
  1244.             sleep: d,
  1245.             degtorad: g,
  1246.             radtodeg: m,
  1247.             sin: f,
  1248.             cos: _,
  1249.             unround: b,
  1250.             tileSize: T,
  1251.             tileWidth: C,
  1252.             tileHeight: y,
  1253.             XAxis: S,
  1254.             YAxis: M,
  1255.             ZAxis: E,
  1256.             v2origin: v,
  1257.             v3origin: O,
  1258.             PI: I,
  1259.             PI2: w,
  1260.             overload: L,
  1261.             override: D
  1262.         };
  1263.     e.h = x
  1264. }, function (t, e, i)
  1265. {
  1266.     "use strict";
  1267.     var a = i(0),
  1268.         s = i(1);
  1269.  
  1270.     function r(t)
  1271.     {
  1272.         n(t, "if (texture2D(diffuseSampler,vUV).a<0.4)", `if (texture2D(diffuseSampler,vUV).a<${mv3d.ALPHA_CUTOFF})`)
  1273.     }
  1274.  
  1275.     function n(t, e, i)
  1276.     {
  1277.         BABYLON.Effect.ShadersStore[t] = BABYLON.Effect.ShadersStore[t].replace(e, i)
  1278.     }
  1279.     i.d(e, "p", (function ()
  1280.     {
  1281.         return h
  1282.     })), i.d(e, "d", (function ()
  1283.     {
  1284.         return l
  1285.     })), i.d(e, "g", (function ()
  1286.     {
  1287.         return c
  1288.     })), i.d(e, "q", (function ()
  1289.     {
  1290.         return d
  1291.     })), i.d(e, "o", (function ()
  1292.     {
  1293.         return g
  1294.     })), i.d(e, "w", (function ()
  1295.     {
  1296.         return f
  1297.     })), i.d(e, "x", (function ()
  1298.     {
  1299.         return _
  1300.     })), i.d(e, "b", (function ()
  1301.     {
  1302.         return T
  1303.     })), i.d(e, "n", (function ()
  1304.     {
  1305.         return y
  1306.     })), i.d(e, "k", (function ()
  1307.     {
  1308.         return S
  1309.     })), i.d(e, "v", (function ()
  1310.     {
  1311.         return M
  1312.     })), i.d(e, "u", (function ()
  1313.     {
  1314.         return E
  1315.     })), i.d(e, "t", (function ()
  1316.     {
  1317.         return v
  1318.     })), i.d(e, "i", (function ()
  1319.     {
  1320.         return w
  1321.     })), i.d(e, "y", (function ()
  1322.     {
  1323.         return L
  1324.     })), i.d(e, "j", (function ()
  1325.     {
  1326.         return A
  1327.     })), i.d(e, "r", (function ()
  1328.     {
  1329.         return P
  1330.     })), i.d(e, "s", (function ()
  1331.     {
  1332.         return F
  1333.     })), i.d(e, "f", (function ()
  1334.     {
  1335.         return N
  1336.     })), i.d(e, "a", (function ()
  1337.     {
  1338.         return H
  1339.     })), i.d(e, "c", (function ()
  1340.     {
  1341.         return R
  1342.     })), i.d(e, "m", (function ()
  1343.     {
  1344.         return B
  1345.     })), i.d(e, "l", (function ()
  1346.     {
  1347.         return V
  1348.     })), i.d(e, "e", (function ()
  1349.     {
  1350.         return z
  1351.     })), i.d(e, "z", (function ()
  1352.     {
  1353.         return Y
  1354.     })), i.d(e, "h", (function ()
  1355.     {
  1356.         return k
  1357.     })), i.d(e, "A", (function ()
  1358.     {
  1359.         return J
  1360.     }));
  1361.     const o = window.BABYLON,
  1362.         {
  1363.             Scene: h,
  1364.             Engine: l,
  1365.             FreeCamera: c,
  1366.             HemisphericLight: p,
  1367.             DirectionalLight: u,
  1368.             SpotLight: d,
  1369.             PointLight: g,
  1370.             ShadowGenerator: m,
  1371.             Vector2: f,
  1372.             Vector3: _,
  1373.             Vector4: b,
  1374.             Color3: T,
  1375.             Color4: C,
  1376.             Plane: y,
  1377.             Node: S,
  1378.             TransformNode: M,
  1379.             Texture: E,
  1380.             StandardMaterial: v,
  1381.             ShaderMaterial: O,
  1382.             Effect: I,
  1383.             Mesh: w,
  1384.             VertexData: L,
  1385.             MeshBuilder: A,
  1386.             AssetsManager: D,
  1387.             SceneSerializer: x,
  1388.             Sprite: P,
  1389.             SpriteManager: F
  1390.         } = o,
  1391.         {
  1392.             FRONTSIDE: N,
  1393.             BACKSIDE: H,
  1394.             DOUBLESIDE: R
  1395.         } = w,
  1396.         {
  1397.             PERSPECTIVE_CAMERA: B,
  1398.             ORTHOGRAPHIC_CAMERA: V
  1399.         } = o.Camera,
  1400.         {
  1401.             FOGMODE_NONE: G,
  1402.             FOGMODE_EXP: j,
  1403.             FOGMODE_EXP2: $,
  1404.             FOGMODE_LINEAR: z
  1405.         } = h,
  1406.         Y = o.Space.WORLD,
  1407.         k = o.Space.LOCAL;
  1408.     o.Space.BONE;
  1409.     E.prototype.crop = function (t = 0, e = 0, i = 0, s = 0)
  1410.     {
  1411.         const
  1412.         {
  1413.             width: r,
  1414.             height: n
  1415.         } = this.getBaseSize();
  1416.         i || (i = r - t), s || (s = n - e), a.a.EDGE_FIX && (t += a.a.EDGE_FIX, e += a.a.EDGE_FIX, i -= 2 * a.a.EDGE_FIX, s -= 2 * a.a.EDGE_FIX), this.uScale = i / r, this.vScale = s / n, this.uOffset = t / r, this.vOffset = 1 - e / n - this.vScale
  1417.     };
  1418.     const W = {
  1419.             x:
  1420.             {
  1421.                 get()
  1422.                 {
  1423.                     return this.position ? this.position.x : void 0
  1424.                 },
  1425.                 set(t)
  1426.                 {
  1427.                     this.position && (this.position.x = t)
  1428.                 }
  1429.             },
  1430.             y:
  1431.             {
  1432.                 get()
  1433.                 {
  1434.                     return this.position ? -this.position.z : void 0
  1435.                 },
  1436.                 set(t)
  1437.                 {
  1438.                     this.position && (this.position.z = -t)
  1439.                 }
  1440.             },
  1441.             z:
  1442.             {
  1443.                 get()
  1444.                 {
  1445.                     return this.position ? this.position.y : void 0
  1446.                 },
  1447.                 set(t)
  1448.                 {
  1449.                     this.position && (this.position.y = t)
  1450.                 }
  1451.             }
  1452.         },
  1453.         X = {
  1454.             pitch:
  1455.             {
  1456.                 get()
  1457.                 {
  1458.                     return this.rotation ? -Object(s.n)(this.rotation.x) : void 0
  1459.                 },
  1460.                 set(t)
  1461.                 {
  1462.                     this.rotation && (this.rotation.x = -Object(s.i)(t))
  1463.                 }
  1464.             },
  1465.             yaw:
  1466.             {
  1467.                 get()
  1468.                 {
  1469.                     return this.rotation ? -Object(s.n)(this.rotation.y) : void 0
  1470.                 },
  1471.                 set(t)
  1472.                 {
  1473.                     this.rotation && (this.rotation.y = -Object(s.i)(t))
  1474.                 }
  1475.             },
  1476.             roll:
  1477.             {
  1478.                 get()
  1479.                 {
  1480.                     return this.rotation ? -Object(s.n)(this.rotation.z) : void 0
  1481.                 },
  1482.                 set(t)
  1483.                 {
  1484.                     this.rotation && (this.rotation.z = -Object(s.i)(t))
  1485.                 }
  1486.             }
  1487.         };
  1488.     Object.defineProperties(S.prototype, W), Object.defineProperties(S.prototype, X), Object.defineProperties(P.prototype, W), Object.defineProperty(w.prototype, "order",
  1489.     {
  1490.         get()
  1491.         {
  1492.             return this._order
  1493.         },
  1494.         set(t)
  1495.         {
  1496.             this._order = t, this._scene.sortMeshes()
  1497.         }
  1498.     });
  1499.     const U = (t, e) => (0 | t._order) - (0 | e._order);
  1500.     h.prototype.sortMeshes = function ()
  1501.     {
  1502.         this.meshes.sort(U)
  1503.     };
  1504.     const Z = h.prototype.addMesh;
  1505.     h.prototype.addMesh = function (t)
  1506.     {
  1507.         Z.apply(this, arguments), "number" == typeof t._order && this.sortMeshes()
  1508.     };
  1509.     const K = h.prototype.removeMesh;
  1510.  
  1511.     function J()
  1512.     {
  1513.         r("shadowMapPixelShader"), r("depthPixelShader")
  1514.     }
  1515.     h.prototype.removeMesh = function (t)
  1516.     {
  1517.         K.apply(this, arguments), this.sortMeshes()
  1518.     }, T.prototype.toNumber = C.prototype.toNumber = function ()
  1519.     {
  1520.         return 255 * this.r << 16 | 255 * this.g << 8 | 255 * this.b
  1521.     }
  1522. }, function (t, e)
  1523. {
  1524.     t.exports = require("fs")
  1525. }, function (t, e)
  1526. {
  1527.     t.exports = require("path")
  1528. }, function (t, e, i)
  1529. {
  1530.     i(6), i(8)
  1531. }, function (t, e, i)
  1532. {
  1533.     "use strict";
  1534.     i.r(e);
  1535.     var a = i(0);
  1536.     a.a["option-store"] = {}, a.a.options = {
  1537.         "mv3d-renderDist":
  1538.         {
  1539.             name: "Render Distance",
  1540.             min: 10,
  1541.             max: 100,
  1542.             increment: 5,
  1543.             wrap: !1,
  1544.             apply(t)
  1545.             {
  1546.                 a.a.RENDER_DIST = t
  1547.             },
  1548.             default: a.a.RENDER_DIST
  1549.         }
  1550.     }, a.a.MIPMAP_OPTION && (a.a.options["mv3d-mipmap"] = {
  1551.         name: "Mipmapping",
  1552.         type: "bool",
  1553.         apply(t)
  1554.         {
  1555.             a.a.MIPMAP = t, a.a.needReloadMap = !0
  1556.         },
  1557.         default: a.a.MIPMAP
  1558.     }), a.a.ENABLE_3D_OPTIONS && i(7)
  1559. }, function (t, e, i)
  1560. {
  1561.     "use strict";
  1562.     i.r(e);
  1563.     var a = i(0),
  1564.         s = i(1);
  1565.     const r = Window_Options.prototype.makeCommandList;
  1566.     Window_Options.prototype.makeCommandList = function ()
  1567.     {
  1568.         if (r.apply(this, arguments), 2 === a.a.ENABLE_3D_OPTIONS) this.addCommand("3D Options", "mv3d-options");
  1569.         else if (1 === a.a.ENABLE_3D_OPTIONS)
  1570.             for (const t in a.a.options) this.addCommand(a.a.options[t].name, t)
  1571.     };
  1572.     const n = Window_Options.prototype.statusText;
  1573.     Window_Options.prototype.statusText = function (t)
  1574.     {
  1575.         const e = this.commandSymbol(t);
  1576.         this.getConfigValue(e);
  1577.         return "mv3d-options" === e ? "" : n.apply(this, arguments)
  1578.     }, Object.defineProperty(ConfigManager, "mv3d-options",
  1579.     {
  1580.         get()
  1581.         {},
  1582.         set(t)
  1583.         {
  1584.             SceneManager.push(Scene_3D_Options)
  1585.         },
  1586.         configurable: !0
  1587.     });
  1588.     const o = ConfigManager.makeData;
  1589.     ConfigManager.makeData = function ()
  1590.     {
  1591.         const t = o.apply(this, arguments);
  1592.         return Object.assign(t, a.a["option-store"]), t
  1593.     };
  1594.     const h = ConfigManager.applyData;
  1595.     ConfigManager.applyData = function (t)
  1596.     {
  1597.         h.apply(this, arguments);
  1598.         for (const e in a.a.options) e in t && (a.a["option-store"][e] = t[e], a.a.options[e].apply(t[e]));
  1599.         a.a.updateParameters()
  1600.     };
  1601.     class Scene_3D_Options extends Scene_Options
  1602.     {
  1603.         createOptionsWindow()
  1604.         {
  1605.             this._optionsWindow = new Window_3D_Options, this._optionsWindow.setHandler("cancel", this.popScene.bind(this)), this.addWindow(this._optionsWindow)
  1606.         }
  1607.         terminate()
  1608.         {
  1609.             super.terminate(), a.a.updateParameters()
  1610.         }
  1611.     }
  1612.     class Window_3D_Options extends Window_Options
  1613.     {
  1614.         makeCommandList()
  1615.         {
  1616.             for (const t in a.a.options) this.addCommand(a.a.options[t].name, t)
  1617.         }
  1618.     }
  1619.     1 === a.a.ENABLE_3D_OPTIONS && Object(s.m)(Scene_Options.prototype, "terminate", t => (function ()
  1620.     {
  1621.         t.apply(this, arguments), a.a.updateParameters()
  1622.     }), !0), Window_Options.prototype._is_mv3d_option = function (t)
  1623.     {
  1624.         return t in a.a.options
  1625.     }, Window_Options.prototype._mv3d_cursor = function (t, e)
  1626.     {
  1627.         const i = this.index(),
  1628.             s = this.commandSymbol(i);
  1629.         let r = this.getConfigValue(s);
  1630.         const n = a.a.options[s];
  1631.         if (n)
  1632.             if ("bool" === n.type) this.changeValue(s, e > 0);
  1633.             else
  1634.             {
  1635.                 const i = n.min || 0,
  1636.                     a = n.values ? n.values.length - 1 : n.max || 1;
  1637.                 r += (n.increment || 1) * e, t && n.wrap || "ok" === t ? (r > a && (r = i), r < i && (r = a)) : r = r.clamp(i, a), this.changeValue(s, r)
  1638.             }
  1639.     }, Object(s.m)(Window_Options.prototype, "statusText", t => (function (e)
  1640.     {
  1641.         const i = this.commandSymbol(e);
  1642.         if (!this._is_mv3d_option(i)) return t.apply(this, arguments);
  1643.         const s = this.getConfigValue(i),
  1644.             r = a.a.options[i];
  1645.         return "bool" === r.type ? this.booleanStatusText(s) : r.values ? r.values[s] : String(s)
  1646.     }), !0), Object(s.m)(Window_Options.prototype, "setConfigValue", t => (function (e, i)
  1647.     {
  1648.         if (!this._is_mv3d_option(e)) return t.apply(this, arguments);
  1649.         a.a["option-store"][e] = i;
  1650.         const s = a.a.options[e];
  1651.         s.apply && s.apply(i)
  1652.     }), !0), Object(s.m)(Window_Options.prototype, "getConfigValue", t => (function (e)
  1653.     {
  1654.         if (!this._is_mv3d_option(e)) return t.apply(this, arguments);
  1655.         const i = a.a.options[e];
  1656.         let s = a.a["option-store"][e];
  1657.         return null == s && (s = i.default || i.min || 0), s
  1658.     }), !0), Object(s.m)(Window_Options.prototype, "cursorLeft", t => (function (e)
  1659.     {
  1660.         const i = this.commandSymbol(this.index());
  1661.         return this._is_mv3d_option(i) ? this._mv3d_cursor(e, -1) : t.apply(this, arguments)
  1662.     }), !0), Object(s.m)(Window_Options.prototype, "cursorRight", t => (function (e)
  1663.     {
  1664.         const i = this.commandSymbol(this.index());
  1665.         return this._is_mv3d_option(i) ? this._mv3d_cursor(e, 1) : t.apply(this, arguments)
  1666.     }), !0), Object(s.m)(Window_Options.prototype, "processOk", t => (function ()
  1667.     {
  1668.         const e = this.index(),
  1669.             i = this.commandSymbol(e);
  1670.         if (!this._is_mv3d_option(i)) return t.apply(this, arguments);
  1671.         let s = this.getConfigValue(i);
  1672.         const r = a.a.options[i];
  1673.         "bool" === r.type ? this.changeValue(i, !s) : this._mv3d_cursor("ok", 1)
  1674.     }), !0)
  1675. }, function (t, e, i)
  1676. {
  1677.     "use strict";
  1678.     i.r(e);
  1679.     var a = i(0),
  1680.         s = i(1);
  1681.     Object.assign(a.a,
  1682.     {
  1683.         vehicleObstructed: (t, ...e) => vehicleObstructed.apply(t, e),
  1684.         tileCollision(t, e, i, s = !1, r = !1)
  1685.         {
  1686.             if (!(t instanceof a.a.Character))
  1687.             {
  1688.                 if (!t.mv3d_sprite) return !1;
  1689.                 t = t.mv3d_sprite
  1690.             }
  1691.             const n = "number" == typeof r ? r : r ? t.targetElevation : t.z,
  1692.                 o = t.getCollisionHeight(n),
  1693.                 h = this.getCollisionHeights(e, i);
  1694.             2 == s && (o.z1 += a.a.STAIR_THRESH, o.z2 += a.a.STAIR_THRESH);
  1695.             for (const n of h)
  1696.                 if (o.z1 < n.z2 && o.z2 > n.z1) return 1 != s || !a.a.STAIR_THRESH || this.tileCollision(t, e, i, 2, r);
  1697.             return !1
  1698.         },
  1699.         charCollision(t, e, i = !1, s = !1, r = s, n = !1)
  1700.         {
  1701.             if (!(t instanceof a.a.Character))
  1702.             {
  1703.                 if (!t.mv3d_sprite) return !1;
  1704.                 t = t.mv3d_sprite
  1705.             }
  1706.             if (!(e instanceof a.a.Character))
  1707.             {
  1708.                 if (!e.mv3d_sprite) return !1;
  1709.                 e = e.mv3d_sprite
  1710.             }
  1711.             if (!(n || t.char._mv3d_hasCollide() && e.char._mv3d_hasCollide())) return !1;
  1712.             const o = "number" == typeof s ? s : s ? t.targetElevation : t.z,
  1713.                 h = "number" == typeof r ? r : r ? e.targetElevation : e.z,
  1714.                 l = t.getCollisionHeight(o),
  1715.                 c = n ? e.getTriggerHeight(h) : e.getCollisionHeight(h);
  1716.             return 2 == i && (l.z1 += a.a.STAIR_THRESH, l.z2 += a.a.STAIR_THRESH), !!(!n && l.z1 < c.z2 && l.z2 > c.z1 || n && l.z1 <= c.z2 && l.z2 >= c.z1) && (1 != i || !a.a.STAIR_THRESH || this.charCollision(t, e, 2, s, r))
  1717.         },
  1718.         getPlatformForCharacter(t, e, i)
  1719.         {
  1720.             if (!(t instanceof a.a.Character))
  1721.             {
  1722.                 if (!t.mv3d_sprite) return !1;
  1723.                 t = t.mv3d_sprite
  1724.             }
  1725.             const s = t.getCHeight(),
  1726.                 r = a.a.STAIR_THRESH >= s;
  1727.             return this.getPlatformAtLocation(e, i, t.z + Math.max(s, a.a.STAIR_THRESH),
  1728.             {
  1729.                 char: t,
  1730.                 gte: r
  1731.             })
  1732.         },
  1733.         getPlatformAtLocation(t, e, i, a = {})
  1734.         {
  1735.             const s = a.char,
  1736.                 r = this.getCollisionHeights(t, e);
  1737.             r.push(...$gameMap.eventsXyNt(Math.round(t), Math.round(e)).filter(t =>
  1738.             {
  1739.                 if (!(t.mv3d_sprite && t._mv3d_isPlatform() && t._mv3d_hasCollide() && t.mv3d_sprite.visible)) return !1;
  1740.                 if (s)
  1741.                 {
  1742.                     if (s.char === t) return !1;
  1743.                     let e = t.mv3d_sprite;
  1744.                     for (; e = e.platformChar;)
  1745.                         if (e === s || e === t.mv3d_sprite) return !1
  1746.                 }
  1747.                 return !0
  1748.             }).map(t => t.mv3d_sprite.getCollisionHeight()));
  1749.             let n = r[0];
  1750.             for (const t of r) t.z2 > n.z2 && (a.gte ? t.z2 <= i : t.z2 < i) && (n = t);
  1751.             return n
  1752.         },
  1753.         isRampAt(t, e, i)
  1754.         {
  1755.             const a = this.getTileData(t, e);
  1756.             let s = 0;
  1757.             for (let r = 0; r < 4; ++r)
  1758.             {
  1759.                 s += this.getTileFringe(t, e, r), s += this.getTileHeight(t, e, r);
  1760.                 const n = this.getTileConfig(a[r], t, e, r);
  1761.                 if (n.shape !== this.configurationShapes.SLOPE) continue;
  1762.                 const o = n.slopeHeight || 1;
  1763.                 if (i >= s - o && i <= s) return {
  1764.                     id: a[r],
  1765.                     x: t,
  1766.                     y: e,
  1767.                     l: r,
  1768.                     conf: n,
  1769.                     z1: s - o,
  1770.                     z2: s
  1771.                 }
  1772.             }
  1773.             return !1
  1774.         },
  1775.         canPassRamp(t, e)
  1776.         {
  1777.             const
  1778.             {
  1779.                 dir: i
  1780.             } = a.a.getSlopeDirection(e.x, e.y, e.l, !0), s = $gameMap.roundXWithDirection(e.x, t), r = $gameMap.roundYWithDirection(e.y, t), n = this.isRampAt(s, r, i === t ? e.z1 : i === 10 - t ? e.z2 : (e.z1 + e.z2) / 2);
  1781.             if (n)
  1782.             {
  1783.                 const
  1784.                 {
  1785.                     dir: o
  1786.                 } = a.a.getSlopeDirection(s, r, n.l, !0);
  1787.                 return i !== t && i !== 10 - t ? i === o && e.z1 === n.z1 && e.z2 === n.z2 : i === o && (i === t ? e.z1 === n.z2 : e.z2 === n.z1)
  1788.             }
  1789.             if (i !== t && i !== 10 - t) return !1;
  1790.             const o = this.getPlatformAtLocation(s, r, (i === t ? e.z1 : e.z2) + a.a.STAIR_THRESH).z2;
  1791.             return Math.abs(o - (i === t ? e.z1 : e.z2)) <= a.a.STAIR_THRESH
  1792.         }
  1793.     }), Game_CharacterBase.prototype._mv3d_isFlying = function ()
  1794.     {
  1795.         return this.mv3d_sprite && this.mv3d_sprite.blendElevation.currentValue() > 0
  1796.     }, Game_Vehicle.prototype._mv3d_isFlying = function ()
  1797.     {
  1798.         return this.isAirship() || Game_CharacterBase.prototype._mv3d_isFlying.apply(this, arguments)
  1799.     }, Game_Player.prototype._mv3d_isFlying = function ()
  1800.     {
  1801.         return !(!this.isInVehicle() || !this.vehicle().isAirship()) || Game_CharacterBase.prototype._mv3d_isFlying.apply(this, arguments)
  1802.     }, Game_CharacterBase.prototype._mv3d_isPlatform = function ()
  1803.     {
  1804.         return this.mv3d_sprite && this.mv3d_sprite.getConfig("platform", a.a.WALK_ON_EVENTS)
  1805.     }, Game_CharacterBase.prototype._mv3d_hasCollide = function ()
  1806.     {
  1807.         const t = this.mv3d_sprite;
  1808.         return !(!t || !1 === t.getConfig("collide")) && (this._mv3d_isPlatform() || Boolean(t.getCHeight()))
  1809.     }, i(9);
  1810.     const r = Game_Map.prototype.isAirshipLandOk;
  1811.     Game_Map.prototype.isAirshipLandOk = function (t, e)
  1812.     {
  1813.         return a.a.isDisabled() ? r.apply(this, arguments) : a.a.AIRSHIP_SETTINGS.bushLanding ? this.checkPassage(t, e, 15) : r.apply(this, arguments)
  1814.     };
  1815.     const n = Game_Player.prototype.updateVehicleGetOn;
  1816.     Game_Player.prototype.updateVehicleGetOn = function ()
  1817.     {
  1818.         if (a.a.isDisabled()) return n.apply(this, arguments);
  1819.         const t = this.vehicle(),
  1820.             e = a.a.loadData(`${t._type}_speed`, t._moveSpeed);
  1821.         t.setMoveSpeed(e), n.apply(this, arguments), this.setThrough(!1)
  1822.     };
  1823.     const o = Game_CharacterBase.prototype.jump;
  1824.     Game_CharacterBase.prototype.jump = function (t, e)
  1825.     {
  1826.         if (a.a.isDisabled()) return o.apply(this, arguments);
  1827.         this.mv3d_jumpHeightStart = a.a.getWalkHeight(this.x, this.y), this.mv3d_jumpHeightEnd = a.a.getWalkHeight(this.x + t, this.y + e), o.apply(this, arguments)
  1828.     };
  1829.     const h = Game_Player.prototype.getOnVehicle;
  1830.     Game_Player.prototype.getOnVehicle = function ()
  1831.     {
  1832.         if (a.a.isDisabled()) return h.apply(this, arguments);
  1833.         var t = this.direction(),
  1834.             e = this.x,
  1835.             i = this.y,
  1836.             s = $gameMap.roundXWithDirection(e, t),
  1837.             r = $gameMap.roundYWithDirection(i, t);
  1838.         return $gameMap.airship().pos(e, i) && a.a.charCollision(this, $gameMap.airship(), !1, !1, !1, !0) ? this._vehicleType = "airship" : $gameMap.ship().pos(s, r) && a.a.charCollision(this, $gameMap.ship()) ? this._vehicleType = "ship" : $gameMap.boat().pos(s, r) && a.a.charCollision(this, $gameMap.boat()) && (this._vehicleType = "boat"), this.isInVehicle() && (this._vehicleGettingOn = !0, this.isInAirship() || this.forceMoveForward(), this.gatherFollowers()), this._vehicleGettingOn
  1839.     }, Object(s.m)(Game_Vehicle.prototype, "isLandOk", t => (function (e, i, s)
  1840.     {
  1841.         $gameTemp._mv3d_collision_char = $gamePlayer.mv3d_sprite;
  1842.         let r = t.apply(this, arguments);
  1843.         if (delete $gameTemp._mv3d_collision_char, this.isAirship()) return r;
  1844.         var n = $gameMap.roundXWithDirection(e, s),
  1845.             o = $gameMap.roundYWithDirection(i, s);
  1846.         const h = a.a.getPlatformForCharacter($gamePlayer, n, o);
  1847.         h.char && (r = !0);
  1848.         const l = Math.abs(h.z2 - this.z);
  1849.         return r && l < Math.max($gamePlayer.mv3d_sprite.getCHeight(), this.mv3d_sprite.getCHeight())
  1850.     }))
  1851. }, function (t, e, i)
  1852. {
  1853.     "use strict";
  1854.     i.r(e);
  1855.     var a = i(0),
  1856.         s = i(1);
  1857.     const r = Game_CharacterBase.prototype.canPass;
  1858.  
  1859.     function n(t, e, i, s)
  1860.     {
  1861.         return e.some(e =>
  1862.         {
  1863.             const r = e._mv3d_isPlatform();
  1864.             if (a.a.WALK_OFF_EDGE && !r)
  1865.             {
  1866.                 const r = a.a.getPlatformForCharacter(t, i, s).z2;
  1867.                 if (a.a.charCollision(t, e, !1, r)) return !0
  1868.             }
  1869.             return a.a.charCollision(t, e, r, !0)
  1870.         })
  1871.     }
  1872.     Game_CharacterBase.prototype.canPass = function (t, e, i)
  1873.     {
  1874.         return !!r.apply(this, arguments) && (a.a.isDisabled() || this.isDebugThrough() || this.isThrough(), !0)
  1875.     };
  1876.     const o = t => (function (t, e)
  1877.     {
  1878.         return n(this, $gameMap.eventsXyNt(t, e), t, e)
  1879.     });
  1880.     Object(s.m)(Game_CharacterBase.prototype, "isCollidedWithEvents", o), Object(s.m)(Game_Event.prototype, "isCollidedWithEvents", o), Object(s.m)(Game_Event.prototype, "isCollidedWithPlayerCharacters", t => (function (t, e)
  1881.     {
  1882.         if ($gamePlayer.isThrough()) return !1;
  1883.         return n(this, [$gamePlayer, ...$gamePlayer.followers()._data.filter(t => t.isVisible() && t.mv3d_sprite.visible)].filter(i => i.pos(t, e)), t, e)
  1884.     })), Object(s.m)(Game_CharacterBase.prototype, "isCollidedWithVehicles", t => (function (t, e)
  1885.     {
  1886.         const i = $gameMap.boat(),
  1887.             s = $gameMap.ship();
  1888.         return i.posNt(t, e) && a.a.charCollision(this, i, i._mv3d_isPlatform(), !0) || s.posNt(t, e) && a.a.charCollision(this, s, s._mv3d_isPlatform(), !0)
  1889.     }));
  1890.     const h = t => (function (e, i, r)
  1891.     {
  1892.         const n = this.mv3d_sprite;
  1893.         if (!n) return t.apply(this, arguments);
  1894.         $gameTemp._mv3d_collision_char = n;
  1895.         let o, h = !t.apply(this, arguments);
  1896.         if (delete $gameTemp._mv3d_collision_char, h) return !1;
  1897.         if ((o = a.a.isRampAt(e, i, n.z)) && a.a.canPassRamp(r, o)) return !0;
  1898.         var l = $gameMap.roundXWithDirection(e, r),
  1899.             c = $gameMap.roundYWithDirection(i, r);
  1900.         if ((o = a.a.isRampAt(l, c, n.z)) && a.a.canPassRamp(10 - r, o)) return !0;
  1901.         if (this._mv3d_isFlying())
  1902.         {
  1903.             if (!a.a.ALLOW_GLIDE && a.a.tileCollision(this, l, c, !0, !0) || a.a.tileCollision(this, l, c, !0, !1)) return !1
  1904.         }
  1905.         else
  1906.         {
  1907.             if (a.a.tileCollision(this, l, c, !0, !0)) return !1;
  1908.             if (n.falling) return !1;
  1909.             if (!a.a.WALK_OFF_EDGE)
  1910.             {
  1911.                 let t = a.a.getPlatformForCharacter(this, l, c).z2;
  1912.                 if (n.hasFloat && (t += a.a.getFloatHeight(l, c, n.z + n.getCHeight())), Object(s.u)(Math.abs(t - n.targetElevation)) > a.a.STAIR_THRESH) return !1
  1913.             }
  1914.         }
  1915.         return !0
  1916.     });
  1917.     Object(s.m)(Game_CharacterBase.prototype, "isMapPassable", h), Object(s.m)(Game_Vehicle.prototype, "isMapPassable", h), Object(s.m)(Game_Player.prototype, "startMapEvent", t => (function (t, e, i, s)
  1918.     {
  1919.         $gameMap.isEventRunning() || $gameMap.eventsXy(t, e).filter(t => a.a.charCollision(this, t, !1, !1, !1, !0)).forEach(t =>
  1920.         {
  1921.             t.isTriggerIn(i) && t.isNormalPriority() === s && t.start()
  1922.         })
  1923.     }));
  1924.     const l = Game_Map.prototype.checkPassage;
  1925.     Game_Map.prototype.checkPassage = function (t, e, i)
  1926.     {
  1927.         if (!("_mv3d_collision_char" in $gameTemp)) return l.apply(this, arguments);
  1928.         const s = $gameTemp._mv3d_collision_char,
  1929.             r = s.z + Math.max(s.getCHeight(), a.a.STAIR_THRESH),
  1930.             n = a.a.getPlatformForCharacter(s, t, e);
  1931.         if (n.char) return !0;
  1932.         var o = this.tilesetFlags();
  1933.         const h = a.a.getTileLayers(t, e, r),
  1934.             c = a.a.getTileData(t, e);
  1935.         for (var p = h.length - 1; p >= 0; --p)
  1936.         {
  1937.             const s = h[p];
  1938.             if (15 & i)
  1939.             {
  1940.                 const i = a.a.getTileConfig(t, e, s);
  1941.                 if ("pass" in i)
  1942.                 {
  1943.                     if (i.pass === a.a.configurationPassage.THROUGH) continue;
  1944.                     if (i.pass === a.a.configurationPassage.FLOOR) return !0;
  1945.                     if (i.pass === a.a.configurationPassage.WALL) return !1
  1946.                 }
  1947.             }
  1948.             const r = o[c[s]];
  1949.             if (0 == (16 & r))
  1950.             {
  1951.                 if (0 == (r & i)) return !0;
  1952.                 if ((r & i) === i) return !1
  1953.             }
  1954.         }
  1955.         return !1
  1956.     }
  1957. }, function (t, e, i)
  1958. {
  1959.     "use strict";
  1960.     i.r(e);
  1961.     var a = i(0),
  1962.         s = i(2);
  1963.     const r = Graphics._createCanvas;
  1964.     Graphics._createCanvas = function ()
  1965.     {
  1966.         a.a.setup(), a.a.updateCanvas(), r.apply(this, arguments)
  1967.     };
  1968.     const n = Graphics._updateAllElements;
  1969.     Graphics._updateAllElements = function ()
  1970.     {
  1971.         n.apply(this, arguments), a.a.updateCanvas()
  1972.     };
  1973.     const o = Graphics.render;
  1974.     Graphics.render = function ()
  1975.     {
  1976.         a.a.render(), o.apply(this, arguments)
  1977.     };
  1978.     const h = Scene_Map.prototype.update;
  1979.     Scene_Map.prototype.update = function ()
  1980.     {
  1981.         h.apply(this, arguments), a.a.isDisabled() || a.a.update()
  1982.     };
  1983.     const l = ShaderTilemap.prototype.renderWebGL;
  1984.     ShaderTilemap.prototype.renderWebGL = function (t)
  1985.     {
  1986.         a.a.mapDisabled && l.apply(this, arguments)
  1987.     };
  1988.     const c = Spriteset_Map.prototype.createTilemap;
  1989.     Spriteset_Map.prototype.createTilemap = function ()
  1990.     {
  1991.         c.apply(this, arguments), a.a.mapDisabled = a.a.isDisabled(), a.a.mapDisabled || (this._tilemap.visible = !1, a.a.pixiSprite = new PIXI.Sprite(a.a.texture), this._baseSprite.addChild(a.a.pixiSprite))
  1992.     };
  1993.     const p = Sprite_Character.prototype.setCharacter;
  1994.     Sprite_Character.prototype.setCharacter = function (t)
  1995.     {
  1996.         p.apply(this, arguments), Object.defineProperty(t, "mv_sprite",
  1997.         {
  1998.             value: this,
  1999.             configurable: !0
  2000.         })
  2001.     };
  2002.     const u = Game_Player.prototype.performTransfer;
  2003.     Game_Player.prototype.performTransfer = function ()
  2004.     {
  2005.         const t = this._newMapId !== $gameMap.mapId();
  2006.         t && ($gameVariables.mv3d && delete $gameVariables.mv3d.disabled, a.a.clearMap()), u.apply(this, arguments), a.a.is1stPerson() && a.a.blendCameraYaw.setValue(a.a.dirToYaw($gamePlayer.direction(), 0))
  2007.     };
  2008.     const d = Scene_Map.prototype.onMapLoaded;
  2009.     Scene_Map.prototype.onMapLoaded = function ()
  2010.     {
  2011.         a.a.needClearMap ? (a.a.clearMap(), a.a.needClearMap = !1) : a.a.needReloadMap && (a.a.reloadMap(), a.a.needReloadMap = !1), a.a.loadMapSettings(), d.apply(this, arguments), a.a.mapLoaded || (a.a.applyMapSettings(), a.a.loadTilesetSettings(), a.a.isDisabled() ? a.a.mapReady = !0 : (a.a.mapReady = !1, a.a.loadMap())), a.a.updateBlenders(!0)
  2012.     };
  2013.     const g = Scene_Load.prototype.onLoadSuccess;
  2014.     Scene_Load.prototype.onLoadSuccess = function ()
  2015.     {
  2016.         g.apply(this, arguments), a.a.needClearMap = !0
  2017.     };
  2018.     const m = Scene_Map.prototype.isReady;
  2019.     Scene_Map.prototype.isReady = function ()
  2020.     {
  2021.         let t = m.apply(this, arguments);
  2022.         return t && a.a.mapReady
  2023.     };
  2024.     const f = Scene_Title.prototype.start;
  2025.     Scene_Title.prototype.start = function ()
  2026.     {
  2027.         f.apply(this, arguments), a.a.clearMap(), a.a.clearCameraTarget()
  2028.     };
  2029.     var _ = i(1);
  2030.     const b = PluginManager.parameters("mv3d-babylon");
  2031.     Object.assign(a.a,
  2032.     {
  2033.         CAMERA_MODE: "PERSPECTIVE",
  2034.         ORTHOGRAPHIC_DIST: 100,
  2035.         MV3D_FOLDER: "img/MV3D",
  2036.         ANIM_DELAY: Number(b.animDelay),
  2037.         ALPHA_CUTOFF: Math.max(.01, b.alphatest),
  2038.         EDGE_FIX: Number(b.edgefix),
  2039.         ANTIALIASING: Object(_.f)(b.antialiasing),
  2040.         FOV: Number(b.fov),
  2041.         WALL_HEIGHT: Number(b.wallHeight),
  2042.         TABLE_HEIGHT: Number(b.tableHeight),
  2043.         FRINGE_HEIGHT: Number(b.fringeHeight),
  2044.         CEILING_HEIGHT: Number(b.ceilingHeight),
  2045.         LAYER_DIST: Number(b.layerDist),
  2046.         ENABLED_DEFAULT: Object(_.f)(b.enabledDefault),
  2047.         UNLOAD_CELLS: Object(_.f)(b.unloadCells),
  2048.         CELL_SIZE: Number(b.cellSize),
  2049.         RENDER_DIST: Number(b.renderDist),
  2050.         MIPMAP: Object(_.f)(b.mipmap),
  2051.         MIPMAP_OPTION: Object(_.f)(b.mipmapOption),
  2052.         STAIR_THRESH: Number(b.stairThresh),
  2053.         WALK_OFF_EDGE: Object(_.f)(b.walkOffEdge),
  2054.         WALK_ON_EVENTS: Object(_.f)(b.walkOnEvents),
  2055.         GRAVITY: Number(b.gravity),
  2056.         FOG_COLOR: Object(_.k)(b.fogColor).toNumber(),
  2057.         FOG_NEAR: Number(b.fogNear),
  2058.         FOG_FAR: Number(b.fogFar),
  2059.         LIGHT_LIMIT: Number(b.lightLimit),
  2060.         LIGHT_HEIGHT: .5,
  2061.         LIGHT_DECAY: 1,
  2062.         LIGHT_DIST: 3,
  2063.         LIGHT_ANGLE: 45,
  2064.         FLASHLIGHT_EXTRA_ANGLE: 10,
  2065.         KEYBOARD_PITCH: Object(_.f)(b.keyboardPitch),
  2066.         KEYBOARD_TURN: Object(_.f)(b.keyboardTurn),
  2067.         KEYBOARD_STRAFE: Object(_.f)(b.keyboardStrafe),
  2068.         REGION_DATA:
  2069.         {},
  2070.         TTAG_DATA:
  2071.         {},
  2072.         EVENT_HEIGHT: Number(b.eventHeight),
  2073.         BOAT_SETTINGS: JSON.parse(b.boatSettings),
  2074.         SHIP_SETTINGS: JSON.parse(b.shipSettings),
  2075.         AIRSHIP_SETTINGS: JSON.parse(b.airshipSettings),
  2076.         ALLOW_GLIDE: Object(_.f)(b.allowGlide),
  2077.         SPRITE_OFFSET: Number(b.spriteOffset) / 2,
  2078.         ENABLE_3D_OPTIONS:
  2079.         {
  2080.             disable: 0,
  2081.             enable: 1,
  2082.             submenu: 2
  2083.         } [b["3dMenu"].toLowerCase()],
  2084.         setupParameters()
  2085.         {
  2086.             for (let t of JSON.parse(b.regions))
  2087.             {
  2088.                 t = JSON.parse(t);
  2089.                 const e = this.readConfigurationFunctions(t.conf, this.tilesetConfigurationFunctions);
  2090.                 this.REGION_DATA[t.regionId] = e
  2091.             }
  2092.             for (let t of JSON.parse(b.ttags)) t = JSON.parse(t), this.TTAG_DATA[t.terrainTag] = this.readConfigurationFunctions(t.conf, this.tilesetConfigurationFunctions);
  2093.             this.EVENT_CHAR_SETTINGS = this.readConfigurationFunctions(b.eventCharDefaults, this.eventConfigurationFunctions), this.EVENT_OBJ_SETTINGS = this.readConfigurationFunctions(b.eventObjDefaults, this.eventConfigurationFunctions), this.EVENT_TILE_SETTINGS = this.readConfigurationFunctions(b.eventTileDefaults, this.eventConfigurationFunctions), this.BOAT_SETTINGS.big = Object(_.f)(this.BOAT_SETTINGS.big), this.SHIP_SETTINGS.big = Object(_.f)(this.SHIP_SETTINGS.big), this.AIRSHIP_SETTINGS.height = Number(this.AIRSHIP_SETTINGS.height), this.AIRSHIP_SETTINGS.big = Object(_.f)(this.AIRSHIP_SETTINGS.big), this.AIRSHIP_SETTINGS.bushLanding = Object(_.f)(this.AIRSHIP_SETTINGS.bushLanding), this.BOAT_SETTINGS.conf = this.readConfigurationFunctions(this.BOAT_SETTINGS.conf, this.eventConfigurationFunctions), this.SHIP_SETTINGS.conf = this.readConfigurationFunctions(this.SHIP_SETTINGS.conf, this.eventConfigurationFunctions), this.AIRSHIP_SETTINGS.conf = this.readConfigurationFunctions(this.AIRSHIP_SETTINGS.conf, this.eventConfigurationFunctions)
  2094.         },
  2095.         updateParameters()
  2096.         {
  2097.             this.camera.mode === s.l ? (this.camera.maxZ = this.RENDER_DIST, this.camera.minZ = -this.RENDER_DIST) : (this.camera.maxZ = this.RENDER_DIST, this.camera.minZ = .1), this.callFeatures("updateParameters")
  2098.         }
  2099.     }), Object.defineProperties(a.a,
  2100.     {
  2101.         AMBIENT_COLOR:
  2102.         {
  2103.             get: () => a.a.featureEnabled("dynamicShadows") ? 8947848 : 16777215
  2104.         }
  2105.     }), Object.assign(a.a,
  2106.     {
  2107.         cameraTargets: [],
  2108.         getCameraTarget()
  2109.         {
  2110.             return this.cameraTargets[0]
  2111.         },
  2112.         setCameraTarget(t, e)
  2113.         {
  2114.             t ? (this.cameraTargets.unshift(t), this.cameraTargets.length > 2 && (this.cameraTargets.length = 2), this.saveData("cameraTarget", this.getTargetString(t)), this.blendCameraTransition.value = 1, this.blendCameraTransition.setValue(0, e)) : this.cameraTargets.length = 0
  2115.         },
  2116.         clearCameraTarget()
  2117.         {
  2118.             this.cameraTargets.length = 0
  2119.         },
  2120.         resetCameraTarget()
  2121.         {
  2122.             this.clearCameraTarget(), this.setCameraTarget($gamePlayer, 0)
  2123.         },
  2124.         rememberCameraTarget()
  2125.         {
  2126.             const t = this.loadData("cameraTarget");
  2127.             t && this.setCameraTarget(this.targetChar(t), 0)
  2128.         },
  2129.         setupBlenders()
  2130.         {
  2131.             this.blendFogColor = new ColorBlender("fogColor", this.FOG_COLOR), this.blendFogNear = new blenders_Blender("fogNear", this.FOG_NEAR), this.blendFogFar = new blenders_Blender("fogFar", this.FOG_FAR), this.blendCameraYaw = new blenders_Blender("cameraYaw", 0), this.blendCameraYaw.cycle = 360, this.blendCameraPitch = new blenders_Blender("cameraPitch", 60), this.blendCameraPitch.min = 0, this.blendCameraPitch.max = 180, this.blendCameraDist = new blenders_Blender("cameraDist", 10), this.blendCameraHeight = new blenders_Blender("cameraHeight", .7), this.blendAmbientColor = new ColorBlender("ambientColor", this.AMBIENT_COLOR), this.blendPanX = new blenders_Blender("panX", 0), this.blendPanY = new blenders_Blender("panY", 0), this.blendCameraTransition = new blenders_Blender("cameraTransition", 0)
  2132.         },
  2133.         updateBlenders(t)
  2134.         {
  2135.             if (this.updateCameraMode(), this.cameraTargets.length || $gamePlayer && (this.cameraTargets[0] = $gamePlayer), this.blendCameraTransition.update() && this.cameraTargets.length >= 2)
  2136.             {
  2137.                 const t = this.blendCameraTransition.currentValue();
  2138.                 let e = this.cameraTargets[0],
  2139.                     i = this.cameraTargets[1];
  2140.                 this.cameraStick.x = e._realX * (1 - t) + i._realX * t, this.cameraStick.y = e._realY * (1 - t) + i._realY * t, e.mv3d_sprite && i.mv3d_sprite ? this.cameraStick.z = e.mv3d_sprite.z * (1 - t) + i.mv3d_sprite.z * t : e.mv3d_sprite && (this.cameraStick.z = e.mv3d_sprite.z)
  2141.             }
  2142.             else if (this.cameraTargets.length)
  2143.             {
  2144.                 let t = this.getCameraTarget();
  2145.                 this.cameraStick.x = t._realX, this.cameraStick.y = t._realY, t.mv3d_sprite && (this.cameraStick.z = t.mv3d_sprite.z)
  2146.             }
  2147.             if (this.blendPanX.update(), this.blendPanY.update(), this.cameraStick.x += this.blendPanX.currentValue(), this.cameraStick.y += this.blendPanY.currentValue(), t | this.blendCameraPitch.update() | this.blendCameraYaw.update() | this.blendCameraDist.update() | this.blendCameraHeight.update() | 0 !== $gameScreen._shake)
  2148.             {
  2149.                 if (this.cameraNode.pitch = this.blendCameraPitch.currentValue() - 90, this.cameraNode.yaw = this.blendCameraYaw.currentValue(), this.cameraNode.position.set(0, 0, 0), this.cameraNode.translate(_.d, -this.blendCameraDist.currentValue(), s.h), this.camera.mode === s.l)
  2150.                 {
  2151.                     const t = this.getFieldSize();
  2152.                     this.camera.orthoLeft = -t.width / 2, this.camera.orthoRight = t.width / 2, this.camera.orthoTop = t.height / 2, this.camera.orthoBottom = -t.height / 2
  2153.                 }
  2154.                 else this.cameraNode.z < 0 && (this.cameraNode.z = 0);
  2155.                 this.cameraNode.z += this.blendCameraHeight.currentValue(), this.cameraNode.translate(_.b, -$gameScreen._shake / 48, s.h)
  2156.             }
  2157.             t | this.blendFogColor.update() | this.blendFogNear.update() | this.blendFogFar.update() && (a.a.featureEnabled("alphaFog") ? (this.scene.fogStart = this.blendFogNear.currentValue(), this.scene.fogEnd = this.blendFogFar.currentValue()) : (this.scene.fogStart = Math.min(a.a.RENDER_DIST - 1, this.blendFogNear.currentValue()), this.scene.fogEnd = Math.min(a.a.RENDER_DIST, this.blendFogFar.currentValue())), this.scene.fogColor.copyFromFloats(this.blendFogColor.r.currentValue() / 255, this.blendFogColor.g.currentValue() / 255, this.blendFogColor.b.currentValue() / 255)), t | this.blendAmbientColor.update() && this.scene.ambientColor.copyFromFloats(this.blendAmbientColor.r.currentValue() / 255, this.blendAmbientColor.g.currentValue() / 255, this.blendAmbientColor.b.currentValue() / 255), this.callFeatures("blend", t)
  2158.         }
  2159.     });
  2160.     class blenders_Blender
  2161.     {
  2162.         constructor(t, e)
  2163.         {
  2164.             this.key = t, this.dfault = a.a.loadData(t, e), this.value = e, this.speed = 1, this.max = 1 / 0, this.min = -1 / 0, this.cycle = !1
  2165.         }
  2166.         setValue(t, e = 0)
  2167.         {
  2168.             let i = (t = Math.min(this.max, Math.max(this.min, t))) - this.value;
  2169.             if (i)
  2170.             {
  2171.                 if (this.saveValue(this.key, t), this.cycle)
  2172.                     for (; Math.abs(i) > this.cycle / 2;) this.value += Math.sign(i) * this.cycle, i = t - this.value;
  2173.                 this.speed = Math.abs(i) / (60 * e)
  2174.             }
  2175.         }
  2176.         currentValue()
  2177.         {
  2178.             return this.value
  2179.         }
  2180.         targetValue()
  2181.         {
  2182.             return this.loadValue(this.key)
  2183.         }
  2184.         defaultValue()
  2185.         {
  2186.             return this.dfault
  2187.         }
  2188.         update()
  2189.         {
  2190.             const t = this.targetValue();
  2191.             if (this.value === t) return !1;
  2192.             const e = t - this.value;
  2193.             return this.speed > Math.abs(e) ? this.value = t : this.value += this.speed * Math.sign(e), !0
  2194.         }
  2195.         storageLocation()
  2196.         {
  2197.             return $gameVariables ? ($gameVariables.mv3d || ($gameVariables.mv3d = {}), $gameVariables.mv3d) : (console.warn("MV3D: Couldn't get Blend storage location."),
  2198.             {})
  2199.         }
  2200.         loadValue(t)
  2201.         {
  2202.             const e = this.storageLocation();
  2203.             return t in e ? e[t] : this.dfault
  2204.         }
  2205.         saveValue(t, e)
  2206.         {
  2207.             this.storageLocation()[t] = e
  2208.         }
  2209.     }
  2210.     class ColorBlender
  2211.     {
  2212.         constructor(t, e)
  2213.         {
  2214.             this.dfault = e, this.r = new blenders_Blender(`${t}_r`, e >> 16), this.g = new blenders_Blender(`${t}_g`, e >> 8 & 255), this.b = new blenders_Blender(`${t}_b`, 255 & e)
  2215.         }
  2216.         setValue(t, e)
  2217.         {
  2218.             this.r.setValue(t >> 16, e), this.g.setValue(t >> 8 & 255, e), this.b.setValue(255 & t, e)
  2219.         }
  2220.         currentValue()
  2221.         {
  2222.             return this.r.value << 16 | this.g.value << 8 | this.b.value
  2223.         }
  2224.         targetValue()
  2225.         {
  2226.             return this.r.targetValue() << 16 | this.g.targetValue() << 8 | this.b.targetValue()
  2227.         }
  2228.         defaultValue()
  2229.         {
  2230.             return this.dfault
  2231.         }
  2232.         update()
  2233.         {
  2234.             let t = 0;
  2235.             return t |= this.r.update(), t |= this.g.update(), t |= this.b.update(), Boolean(t)
  2236.         }
  2237.         get storageLocation()
  2238.         {
  2239.             return this.r.storageLocation
  2240.         }
  2241.         set storageLocation(t)
  2242.         {
  2243.             this.r.storageLocation = t, this.g.storageLocation = t, this.b.storageLocation = t
  2244.         }
  2245.         currentComponents()
  2246.         {
  2247.             return [this.r.currentValue() / 255, this.g.currentValue() / 255, this.b.currentValue() / 255]
  2248.         }
  2249.         targetComponents()
  2250.         {
  2251.             return [this.r.targetValue() / 255, this.g.targetValue() / 255, this.b.targetValue() / 255]
  2252.         }
  2253.     }
  2254.  
  2255.     function T(t, e, i)
  2256.     {
  2257.         let s = void 0;
  2258.         return {
  2259.             configurable: !0,
  2260.             get: () => null != s ? s : SceneManager._scene instanceof Scene_Map ? a.a.isDisabled() ? e : a.a.is1stPerson() ? i : e : t,
  2261.             set(t)
  2262.             {
  2263.                 s = t
  2264.             }
  2265.         }
  2266.     }
  2267.     a.a.Blender = blenders_Blender, a.a.ColorBlender = ColorBlender, a.a.blendModes = {
  2268.         [PIXI.BLEND_MODES.NORMAL]: BABYLON.Engine.ALPHA_COMBINE,
  2269.         [PIXI.BLEND_MODES.ADD]: BABYLON.Engine.ALPHA_ADD,
  2270.         [PIXI.BLEND_MODES.MULTIPLY]: BABYLON.Engine.ALPHA_MULTIPLY,
  2271.         [PIXI.BLEND_MODES.SCREEN]: BABYLON.Engine.ALPHA_SCREENMODE
  2272.     }, Object.assign(Input.keyMapper,
  2273.     {
  2274.         81: "rotleft",
  2275.         69: "rotright",
  2276.         87: "up",
  2277.         65: "left",
  2278.         83: "down",
  2279.         68: "right"
  2280.     }), a.a.setupInput = function ()
  2281.     {
  2282.         const t = {
  2283.             left: T("left", "left", "rotleft"),
  2284.             rotleft: T("pageup", "rotleft", a.a.KEYBOARD_STRAFE ? "left" : void 0),
  2285.             right: T("right", "right", "rotright"),
  2286.             rotright: T("pagedown", "rotright", a.a.KEYBOARD_STRAFE ? "right" : void 0)
  2287.         };
  2288.         Object.defineProperties(Input.keyMapper,
  2289.         {
  2290.             37: t.left,
  2291.             39: t.right,
  2292.             81: t.rotleft,
  2293.             69: t.rotright,
  2294.             65: t.left,
  2295.             68: t.right
  2296.         })
  2297.     };
  2298.     const C = Game_Player.prototype.getInputDirection;
  2299.     Game_Player.prototype.getInputDirection = function ()
  2300.     {
  2301.         if (a.a.isDisabled()) return C.apply(this, arguments);
  2302.         let t = Input.dir4;
  2303.         return a.a.transformDirectionYaw(t, a.a.blendCameraYaw.currentValue(), !0)
  2304.     };
  2305.     const y = Game_Player.prototype.updateMove;
  2306.     Game_Player.prototype.updateMove = function ()
  2307.     {
  2308.         y.apply(this, arguments), a.a.isDisabled() || !this.isMoving() && a.a.is1stPerson() && a.a.playerFaceYaw()
  2309.     };
  2310.     const S = Game_Player.prototype.moveStraight;
  2311.     Game_Player.prototype.moveStraight = function (t)
  2312.     {
  2313.         S.apply(this, arguments), a.a.isDisabled() || !this.isMovementSucceeded() && a.a.is1stPerson() && a.a.playerFaceYaw()
  2314.     };
  2315.     const M = t => !!(t.isEnabled() && t.isVisible && t.isPickable) && (!t.character || !t.character.isFollower && !t.character.isPlayer),
  2316.         E = Scene_Map.prototype.processMapTouch;
  2317.     Scene_Map.prototype.processMapTouch = function ()
  2318.     {
  2319.         if (a.a.isDisabled()) return E.apply(this, arguments);
  2320.         if (TouchInput.isTriggered() || this._touchCount > 0)
  2321.             if (TouchInput.isPressed())
  2322.             {
  2323.                 if (0 === this._touchCount || this._touchCount >= 15)
  2324.                 {
  2325.                     const t = a.a.scene.pick(TouchInput.x, TouchInput.y, M);
  2326.                     if (t.hit)
  2327.                     {
  2328.                         const e = {
  2329.                                 x: t.pickedPoint.x,
  2330.                                 y: -t.pickedPoint.z
  2331.                             },
  2332.                             i = t.pickedMesh;
  2333.                         i.character && (e.x = i.character.x, e.y = i.character.y), $gameTemp.setDestination(Math.round(e.x), Math.round(e.y))
  2334.                     }
  2335.                 }
  2336.                 this._touchCount++
  2337.             }
  2338.         else this._touchCount = 0
  2339.     };
  2340.     const v = Game_Player.prototype.findDirectionTo;
  2341.     Game_Player.prototype.findDirectionTo = function ()
  2342.     {
  2343.         const t = v.apply(this, arguments);
  2344.         if (a.a.isDisabled()) return t;
  2345.         if (a.a.is1stPerson() && t)
  2346.         {
  2347.             let e = a.a.dirToYaw(t);
  2348.             a.a.blendCameraYaw.setValue(e, .25)
  2349.         }
  2350.         return t
  2351.     };
  2352.     class ConfigurationFunction
  2353.     {
  2354.         constructor(t, e)
  2355.         {
  2356.             this.groups = t.match(/\[?[^[\]|]+\]?/g), this.labels = {};
  2357.             for (let t = 0; t < this.groups.length; ++t)
  2358.             {
  2359.                 for (; this.groups[t] && "[" === this.groups[t][0];) this.labels[this.groups[t].slice(1, -1)] = t, this.groups.splice(t, 1);
  2360.                 if (t > this.groups.length) break;
  2361.                 this.groups[t] = this.groups[t].split(",").map(t => t.trim())
  2362.             }
  2363.             this.func = e
  2364.         }
  2365.         run(t, e)
  2366.         {
  2367.             const i = /([,|]+)? *(?:(\w+) *: *)?([^,|\r\n]+)/g;
  2368.             let a, s = 0,
  2369.                 r = 0;
  2370.             const n = {};
  2371.             for (let t = 0; t < this.groups.length; ++t) n[`group${t+1}`] = [];
  2372.             for (; a = i.exec(e);)
  2373.             {
  2374.                 if (a[1])
  2375.                     for (const t of a[1]) "," === t && ++s, ("|" === t || s >= this.groups[r].length) && (s = 0, ++r);
  2376.                 if (a[2])
  2377.                     if (a[2] in this.labels) r = this.labels[a[2]];
  2378.                     else
  2379.                     {
  2380.                         let t = !1;
  2381.                         t: for (let e = 0; e < this.groups.length; ++e)
  2382.                             for (let i = 0; i < this.groups[e].length; ++i)
  2383.                                 if (this.groups[e][i] === a[2])
  2384.                                 {
  2385.                                     t = !0, r = e, s = i;
  2386.                                     break t
  2387.                                 }
  2388.                         if (!t) break
  2389.                     } if (r > this.groups.length) break;
  2390.                 n[this.groups[r][s]] = n[`group${r+1}`][s] = a[3].trim()
  2391.             }
  2392.             this.func(t, n)
  2393.         }
  2394.     }
  2395.  
  2396.     function O(t, e = "")
  2397.     {
  2398.         return new ConfigurationFunction(`img,x,y,w,h|${e}|alpha|glow[anim]animx,animy`, (function (e, i)
  2399.         {
  2400.             if (5 === i.group1.length)
  2401.             {
  2402.                 const [s, r, n, o, h] = i.group1;
  2403.                 e[`${t}_id`] = a.a.constructTileId(s, 0, 0), e[`${t}_rect`] = new PIXI.Rectangle(r, n, o, h)
  2404.             }
  2405.             else if (3 === i.group1.length)
  2406.             {
  2407.                 const [s, r, n] = i.group1;
  2408.                 e[`${t}_id`] = a.a.constructTileId(s, r, n)
  2409.             }
  2410.             else if (2 === i.group1.length)
  2411.             {
  2412.                 const [a, r] = i.group1;
  2413.                 e[`${t}_offset`] = new s.w(Number(a), Number(r))
  2414.             }
  2415.             i.animx && i.animy && (e[`${t}_animData`] = {
  2416.                 animX: Number(i.animx),
  2417.                 animY: Number(i.animy)
  2418.             }), i.height && (e[`${t}_height`] = Number(i.height)), i.alpha && (e[`${t}_alpha`] = Number(i.alpha)), i.glow && (e[`${t}_glow`] = Number(i.glow))
  2419.         }))
  2420.     }
  2421.     a.a.ConfigurationFunction = ConfigurationFunction, Object.assign(a.a,
  2422.     {
  2423.         tilesetConfigurations:
  2424.         {},
  2425.         loadTilesetSettings()
  2426.         {
  2427.             this.tilesetConfigurations = {};
  2428.             const t = this.readConfigurationBlocks($gameMap.tileset().note),
  2429.                 e = /^\s*([abcde]\d?)\s*,\s*(\d+(?:-\d+)?)\s*,\s*(\d+(?:-\d+)?)\s*:(.*)$/gim;
  2430.             let i;
  2431.             for (; i = e.exec(t);)
  2432.             {
  2433.                 const t = this.readConfigurationFunctions(i[4], this.tilesetConfigurationFunctions),
  2434.                     e = i[2].split("-").map(t => Number(t)),
  2435.                     a = i[3].split("-").map(t => Number(t));
  2436.                 for (let s = e[0]; s <= e[e.length - 1]; ++s)
  2437.                     for (let e = a[0]; e <= a[a.length - 1]; ++e)
  2438.                     {
  2439.                         const a = `${i[1]},${s},${e}`,
  2440.                             r = this.constructTileId(...a.split(","));
  2441.                         r in this.tilesetConfigurations || (this.tilesetConfigurations[r] = {}), Object.assign(this.tilesetConfigurations[r], t)
  2442.                     }
  2443.             }
  2444.         },
  2445.         mapConfigurations:
  2446.         {},
  2447.         loadMapSettings()
  2448.         {
  2449.             const t = this.mapConfigurations = {};
  2450.             this.readConfigurationFunctions(this.readConfigurationBlocks($dataMap.note), this.mapConfigurationFunctions, t)
  2451.         },
  2452.         applyMapSettings()
  2453.         {
  2454.             const t = this.mapConfigurations;
  2455.             if ("fog" in t)
  2456.             {
  2457.                 const e = t.fog;
  2458.                 "color" in e && this.blendFogColor.setValue(e.color, 0), "near" in e && this.blendFogNear.setValue(e.near, 0), "far" in e && this.blendFogFar.setValue(e.far, 0)
  2459.             }
  2460.             "light" in t && this.blendAmbientColor.setValue(t.light.color, 0), "cameraDist" in t && this.blendCameraDist.setValue(t.cameraDist, 0), "cameraHeight" in t && this.blendCameraHeight.setValue(t.cameraHeight, 0), "cameraMode" in t && (this.cameraMode = t.cameraMode), "cameraPitch" in t && this.blendCameraPitch.setValue(t.cameraPitch, 0), "cameraYaw" in t && this.blendCameraYaw.setValue(t.cameraYaw, 0), $gameMap.parallaxName() ? a.a.scene.clearColor.set(0, 0, 0, 0) : a.a.scene.clearColor.set(...a.a.blendFogColor.currentComponents(), 1), this.callFeatures("applyMapSettings", t)
  2461.         },
  2462.         getMapConfig(t, e)
  2463.         {
  2464.             return t in this.mapConfigurations ? this.mapConfigurations[t] : e
  2465.         },
  2466.         getCeilingConfig()
  2467.         {
  2468.             let t = {};
  2469.             for (const e in this.mapConfigurations) e.startsWith("ceiling_") && (t[e.replace("ceiling_", "bottom_")] = this.mapConfigurations[e]);
  2470.             return t.bottom_id = this.getMapConfig("ceiling_id", 0), t.height = this.getMapConfig("ceiling_height", this.CEILING_HEIGHT), t.skylight = this.getMapConfig("ceiling_skylight", !1), t
  2471.         },
  2472.         readConfigurationBlocks(t)
  2473.         {
  2474.             const e = /<MV3D>([\s\S]*?)<\/MV3D>/gi;
  2475.             let i, a = "";
  2476.             for (; i = e.exec(t);) a += i[1] + "\n";
  2477.             return a
  2478.         },
  2479.         readConfigurationTags(t)
  2480.         {
  2481.             const e = /<MV3D:([\s\S]*?)>/gi;
  2482.             let i, a = "";
  2483.             for (; i = e.exec(t);) a += i[1] + "\n";
  2484.             return a
  2485.         },
  2486.         readConfigurationFunctions(t, e = a.a.configurationFunctions, i = {})
  2487.         {
  2488.             const s = /(\w+)\((.*?)\)/g;
  2489.             let r;
  2490.             for (; r = s.exec(t);)
  2491.             {
  2492.                 const t = r[1].toLowerCase();
  2493.                 if (t in e)
  2494.                     if (e[t] instanceof ConfigurationFunction) e[t].run(i, r[2]);
  2495.                     else
  2496.                     {
  2497.                         const a = r[2].split(",");
  2498.                         1 === a.length && "" === a[0] && (a.length = 0), e[t](i, ...a)
  2499.                     }
  2500.             }
  2501.             return i
  2502.         },
  2503.         configurationSides:
  2504.         {
  2505.             front: s.f,
  2506.             back: s.a,
  2507.             double: s.c
  2508.         },
  2509.         configurationShapes:
  2510.         {
  2511.             FLAT: 1,
  2512.             TREE: 2,
  2513.             SPRITE: 3,
  2514.             FENCE: 4,
  2515.             WALL: 4,
  2516.             CROSS: 5,
  2517.             XCROSS: 6,
  2518.             SLOPE: 7
  2519.         },
  2520.         configurationPassage:
  2521.         {
  2522.             WALL: 0,
  2523.             FLOOR: 1,
  2524.             THROUGH: 2
  2525.         },
  2526.         tilesetConfigurationFunctions:
  2527.         {
  2528.             height(t, e)
  2529.             {
  2530.                 t.height = Number(e)
  2531.             },
  2532.             depth(t, e)
  2533.             {
  2534.                 t.depth = Number(e)
  2535.             },
  2536.             fringe(t, e)
  2537.             {
  2538.                 t.fringe = Number(e)
  2539.             },
  2540.             float(t, e)
  2541.             {
  2542.                 t.float = Number(e)
  2543.             },
  2544.             slope(t, e = 1, i = null)
  2545.             {
  2546.                 t.shape = a.a.configurationShapes.SLOPE, t.slopeHeight = Number(e), i && (t.slopeDirection = {
  2547.                     n: 2,
  2548.                     s: 8,
  2549.                     e: 4,
  2550.                     w: 6
  2551.                 } [i.toLowerCase()[0]])
  2552.             },
  2553.             top: O("top"),
  2554.             side: O("side"),
  2555.             inside: O("inside"),
  2556.             bottom: O("bottom"),
  2557.             texture: Object.assign(O("hybrid"),
  2558.             {
  2559.                 func(t, e)
  2560.                 {
  2561.                     a.a.tilesetConfigurationFunctions.top.func(t, e), a.a.tilesetConfigurationFunctions.side.func(t, e)
  2562.                 }
  2563.             }),
  2564.             shape(t, e)
  2565.             {
  2566.                 t.shape = a.a.configurationShapes[e.toUpperCase()]
  2567.             },
  2568.             alpha(t, e)
  2569.             {
  2570.                 t.transparent = !0, t.alpha = Number(e)
  2571.             },
  2572.             glow(t, e)
  2573.             {
  2574.                 t.glow = Number(e)
  2575.             },
  2576.             pass(t, e = "")
  2577.             {
  2578.                 (e = Object(_.j)(e.toLowerCase())) && "x" !== e[0] ? "o" === e[0] ? t.pass = a.a.configurationPassage.FLOOR : t.pass = a.a.configurationPassage.THROUGH : t.pass = a.a.configurationPassage.WALL
  2579.             }
  2580.         },
  2581.         eventConfigurationFunctions:
  2582.         {
  2583.             height(t, e)
  2584.             {
  2585.                 t.height = Number(e)
  2586.             },
  2587.             z(t, e)
  2588.             {
  2589.                 t.z = Number(e)
  2590.             },
  2591.             x(t, e)
  2592.             {
  2593.                 t.x = Number(e)
  2594.             },
  2595.             y(t, e)
  2596.             {
  2597.                 t.y = Number(e)
  2598.             },
  2599.             scale(t, e, i = e)
  2600.             {
  2601.                 t.scale = new s.w(Number(e), Number(i))
  2602.             },
  2603.             rot(t, e)
  2604.             {
  2605.                 t.rot = Number(e)
  2606.             },
  2607.             yaw(t, e)
  2608.             {
  2609.                 t.yaw = Number(e)
  2610.             },
  2611.             pitch(t, e)
  2612.             {
  2613.                 t.pitch = Number(e)
  2614.             },
  2615.             bush(t, e)
  2616.             {
  2617.                 t.bush = Object(_.f)(e)
  2618.             },
  2619.             shadow(t, e, i)
  2620.             {
  2621.                 t.shadow = Object(_.e)(e), null != i && (t.shadowDist = Number(i))
  2622.             },
  2623.             shape(t, e)
  2624.             {
  2625.                 t.shape = a.a.configurationShapes[e.toUpperCase()]
  2626.             },
  2627.             pos(t, e, i)
  2628.             {
  2629.                 t.pos = {
  2630.                     x: e,
  2631.                     y: i
  2632.                 }
  2633.             },
  2634.             lamp: new ConfigurationFunction("color,intensity,range", (function (t, e)
  2635.             {
  2636.                 const
  2637.                 {
  2638.                     color: i = "white",
  2639.                     intensity: s = 1,
  2640.                     range: r = a.a.LIGHT_DIST
  2641.                 } = e;
  2642.                 t.lamp = {
  2643.                     color: Object(_.k)(i).toNumber(),
  2644.                     intensity: Number(s),
  2645.                     distance: Number(r)
  2646.                 }
  2647.             })),
  2648.             flashlight: new ConfigurationFunction("color,intensity,range,angle[dir]yaw,pitch", (function (t, e)
  2649.             {
  2650.                 const
  2651.                 {
  2652.                     color: i = "white",
  2653.                     intensity: s = 1,
  2654.                     range: r = a.a.LIGHT_DIST,
  2655.                     angle: n = a.a.LIGHT_ANGLE
  2656.                 } = e;
  2657.                 t.flashlight = {
  2658.                     color: Object(_.k)(i).toNumber(),
  2659.                     intensity: Number(s),
  2660.                     distance: Number(r),
  2661.                     angle: Number(n)
  2662.                 }, e.yaw && (t.flashlightYaw = e.yaw), e.pitch && (t.flashlightPitch = Number(e.pitch))
  2663.             })),
  2664.             flashlightpitch(t, e = "90")
  2665.             {
  2666.                 t.flashlightPitch = Number(e)
  2667.             },
  2668.             flashlightyaw(t, e = "+0")
  2669.             {
  2670.                 t.flashlightYaw = e
  2671.             },
  2672.             lightheight(t, e = 1)
  2673.             {
  2674.                 t.lightHeight = Number(e)
  2675.             },
  2676.             lightoffset(t, e = 0, i = 0)
  2677.             {
  2678.                 t.lightOffset = {
  2679.                     x: +e,
  2680.                     y: +i
  2681.                 }
  2682.             },
  2683.             alpha(t, e)
  2684.             {
  2685.                 t.alpha = Number(e)
  2686.             },
  2687.             glow(t, e)
  2688.             {
  2689.                 t.glow = Number(e)
  2690.             },
  2691.             dirfix(t, e)
  2692.             {
  2693.                 t.dirfix = Object(_.f)(e)
  2694.             },
  2695.             gravity(t, e)
  2696.             {
  2697.                 t.gravity = Object(_.e)(e)
  2698.             },
  2699.             platform(t, e)
  2700.             {
  2701.                 t.platform = Object(_.f)(e)
  2702.             },
  2703.             collide(t, e)
  2704.             {
  2705.                 t.collide = Object(_.e)(e)
  2706.             },
  2707.             trigger(t, e, i = 0)
  2708.             {
  2709.                 t.trigger = {
  2710.                     up: Number(e),
  2711.                     down: Number(i)
  2712.                 }
  2713.             },
  2714.             pass(t, e = "")
  2715.             {
  2716.                 (e = Object(_.j)(e.toLowerCase())) && "x" !== e[0] ? "o" === e[0] ? t.platform = !0 : (t.platform = !1, t.collide = !1) : (t.platform = !1, t.collide = !0)
  2717.             }
  2718.         },
  2719.         mapConfigurationFunctions:
  2720.         {
  2721.             get ambient()
  2722.             {
  2723.                 return this.light
  2724.             },
  2725.             light(t, e)
  2726.             {
  2727.                 e = "default" === e.toLowerCase() ? a.a.AMBIENT_COLOR : Object(_.k)(e).toNumber(), t.light = {
  2728.                     color: e
  2729.                 }
  2730.             },
  2731.             fog: new ConfigurationFunction("color|near,far", (function (t, e)
  2732.             {
  2733.                 const
  2734.                 {
  2735.                     color: i,
  2736.                     near: a,
  2737.                     far: s
  2738.                 } = e;
  2739.                 t.fog || (t.fog = {}), i && (t.fog.color = Object(_.k)(i).toNumber()), a && (t.fog.near = Number(a)), s && (t.fog.far = Number(s))
  2740.             })),
  2741.             camera: new ConfigurationFunction("yaw,pitch|dist|height|mode", (function (t, e)
  2742.             {
  2743.                 const
  2744.                 {
  2745.                     yaw: i,
  2746.                     pitch: a,
  2747.                     dist: s,
  2748.                     height: r,
  2749.                     mode: n
  2750.                 } = e;
  2751.                 i && (t.cameraYaw = Number(i)), a && (t.cameraPitch = Number(a)), s && (t.cameraDist = Number(s)), r && (t.cameraHeight = Number(r)), n && (t.cameraMode = n)
  2752.             })),
  2753.             ceiling: O("ceiling", "height,skylight"),
  2754.             edge(t, e)
  2755.             {
  2756.                 t.edge = Object(_.f)(e)
  2757.             },
  2758.             disable(t, e = !0)
  2759.             {
  2760.                 t.disabled = Object(_.f)(e)
  2761.             },
  2762.             enable(t, e = !0)
  2763.             {
  2764.                 t.disabled = !Object(_.f)(e)
  2765.             }
  2766.         }
  2767.     });
  2768.     const I = Game_Event.prototype.setupPage;
  2769.     Game_Event.prototype.setupPage = function ()
  2770.     {
  2771.         I.apply(this, arguments), this.mv3d_sprite && (this.mv3d_needsConfigure = !0, this.mv3d_sprite.eventConfigure())
  2772.     };
  2773.     const w = Game_Event.prototype.initialize;
  2774.     Game_Event.prototype.initialize = function ()
  2775.     {
  2776.         w.apply(this, arguments), a.a.mapLoaded && a.a.createCharacterFor(this);
  2777.         const t = this.event();
  2778.         let e = {};
  2779.         a.a.readConfigurationFunctions(a.a.readConfigurationTags(t.note), a.a.eventConfigurationFunctions, e), "pos" in e && this.locate(Object(_.o)(t.x, e.pos.x), Object(_.o)(t.y, e.pos.y)), this.mv3d_blenders || (this.mv3d_blenders = {}), "lamp" in e && (this.mv3d_blenders.lampColor_r = e.lamp.color >> 16, this.mv3d_blenders.lampColor_g = e.lamp.color >> 8 & 255, this.mv3d_blenders.lampColor_b = 255 & e.lamp.color, this.mv3d_blenders.lampIntensity = e.lamp.intensity, this.mv3d_blenders.lampDistance = e.lamp.distance), "flashlight" in e && (this.mv3d_blenders.flashlightColor_r = e.flashlight.color >> 16, this.mv3d_blenders.flashlightColor_g = e.flashlight.color >> 8 & 255, this.mv3d_blenders.flashlightColor_b = 255 & e.flashlight.color, this.mv3d_blenders.flashlightIntensity = e.flashlight.intensity, this.mv3d_blenders.flashlightDistance = e.flashlight.distance, this.mv3d_blenders.flashlightAngle = e.flashlight.angle), "flashlightPitch" in e && (this.mv3d_blenders.flashlightPitch = Number(e.flashlightPitch)), "flashlightYaw" in e && (this.mv3d_blenders.flashlightYaw = e.flashlightYaw), this.mv3d_needsConfigure = !0
  2780.     };
  2781.     const L = Game_Interpreter.prototype.pluginCommand;
  2782.     Game_Interpreter.prototype.pluginCommand = function (t, e)
  2783.     {
  2784.         if ("mv3d" !== t.toLowerCase()) return L.apply(this, arguments);
  2785.         const i = new a.a.PluginCommand;
  2786.         if (i.INTERPRETER = this, i.FULL_COMMAND = [t, ...e].join(" "), e = e.filter(t => t), i.CHAR = $gameMap.event(this._eventId), e[0])
  2787.         {
  2788.             const t = e[0][0];
  2789.             "@" !== t && "" !== t || (i.CHAR = i.TARGET_CHAR(e.shift()))
  2790.         }
  2791.         const s = e.shift().toLowerCase();
  2792.         s in i && i[s](...e)
  2793.     }, a.a.PluginCommand = class
  2794.     {
  2795.         async camera(...t)
  2796.         {
  2797.             var e = this._TIME(t[2]);
  2798.             switch (t[0].toLowerCase())
  2799.             {
  2800.             case "pitch":
  2801.                 return void this.pitch(t[1], e);
  2802.             case "yaw":
  2803.                 return void this.yaw(t[1], e);
  2804.             case "dist":
  2805.             case "distance":
  2806.                 return void this.dist(t[1], e);
  2807.             case "height":
  2808.                 return void this.height(t[1], e);
  2809.             case "mode":
  2810.                 return void this.cameramode(t[1]);
  2811.             case "target":
  2812.                 return void this._cameraTarget(t[1], e);
  2813.             case "pan":
  2814.                 return void this.pan(t[1], t[2], t[3])
  2815.             }
  2816.         }
  2817.         yaw(t, e = 1)
  2818.         {
  2819.             this._RELATIVE_BLEND(a.a.blendCameraYaw, t, e), a.a.is1stPerson() && a.a.playerFaceYaw()
  2820.         }
  2821.         pitch(t, e = 1)
  2822.         {
  2823.             this._RELATIVE_BLEND(a.a.blendCameraPitch, t, e)
  2824.         }
  2825.         dist(t, e = 1)
  2826.         {
  2827.             this._RELATIVE_BLEND(a.a.blendCameraDist, t, e)
  2828.         }
  2829.         height(t, e = 1)
  2830.         {
  2831.             this._RELATIVE_BLEND(a.a.blendCameraHeight, t, e)
  2832.         }
  2833.         _cameraTarget(t, e)
  2834.         {
  2835.             a.a.setCameraTarget(this.TARGET_CHAR(t), e)
  2836.         }
  2837.         pan(t, e, i = 1)
  2838.         {
  2839.             console.log(t, e, i), i = this._TIME(i), this._RELATIVE_BLEND(a.a.blendPanX, t, i), this._RELATIVE_BLEND(a.a.blendPanY, e, i)
  2840.         }
  2841.         get rotationmode()
  2842.         {
  2843.             return this.allowrotation
  2844.         }
  2845.         get pitchmode()
  2846.         {
  2847.             return this.allowpitch
  2848.         }
  2849.         allowrotation(t)
  2850.         {
  2851.             a.a.saveData("allowRotation", Object(_.f)(t))
  2852.         }
  2853.         allowpitch(t)
  2854.         {
  2855.             a.a.saveData("allowPitch", Object(_.f)(t))
  2856.         }
  2857.         lockcamera(t)
  2858.         {
  2859.             a.a.saveData("cameraLocked", Object(_.f)(t))
  2860.         }
  2861.         _VEHICLE(t, e, i)
  2862.         {
  2863.             e = e.toLowerCase();
  2864.             const s = `${Vehicle}_${e}`;
  2865.             i = "big" === e ? Object(_.f)(i) : Object(_.o)(a.a.loadData(s, 0), i), a.a.saveData(s, i)
  2866.         }
  2867.         boat(t, e)
  2868.         {
  2869.             this._VEHICLE("boat", t, e)
  2870.         }
  2871.         ship(t, e)
  2872.         {
  2873.             this._VEHICLE("ship", t, e)
  2874.         }
  2875.         airship(t, e)
  2876.         {
  2877.             this._VEHICLE("airship", t, e)
  2878.         }
  2879.         cameramode(t)
  2880.         {
  2881.             a.a.cameraMode = t
  2882.         }
  2883.         fog(...t)
  2884.         {
  2885.             var e = this._TIME(t[2]);
  2886.             switch (t[0].toLowerCase())
  2887.             {
  2888.             case "color":
  2889.                 return void this._fogColor(t[1], e);
  2890.             case "near":
  2891.                 return void this._fogNear(t[1], e);
  2892.             case "far":
  2893.                 return void this._fogFar(t[1], e);
  2894.             case "dist":
  2895.             case "distance":
  2896.                 return e = this._TIME(t[3]), this._fogNear(t[1], e), void this._fogFar(t[2], e)
  2897.             }
  2898.             e = this._TIME(t[3]), this._fogColor(t[0], e), this._fogNear(t[1], e), this._fogFar(t[2], e)
  2899.         }
  2900.         _fogColor(t, e)
  2901.         {
  2902.             a.a.blendFogColor.setValue(Object(_.k)(t).toNumber(), e)
  2903.         }
  2904.         _fogNear(t, e)
  2905.         {
  2906.             this._RELATIVE_BLEND(a.a.blendFogNear, t, e)
  2907.         }
  2908.         _fogFar(t, e)
  2909.         {
  2910.             this._RELATIVE_BLEND(a.a.blendFogFar, t, e)
  2911.         }
  2912.         get ambient()
  2913.         {
  2914.             return this.light
  2915.         }
  2916.         light(...t)
  2917.         {
  2918.             var e = this._TIME(t[2]);
  2919.             switch (t[0].toLowerCase())
  2920.             {
  2921.             case "color":
  2922.                 return void this._lightColor(t[1], e)
  2923.             }
  2924.             e = this._TIME(t[1]), this._lightColor(t[0], e)
  2925.         }
  2926.         _lightColor(t, e = 1)
  2927.         {
  2928.             a.a.blendAmbientColor.setValue(Object(_.k)(t).toNumber(), e)
  2929.         }
  2930.         async lamp(...t)
  2931.         {
  2932.             const e = await this.AWAIT_CHAR(this.CHAR);
  2933.             e.setupLamp();
  2934.             var i = this._TIME(t[2]);
  2935.             switch (t[0].toLowerCase())
  2936.             {
  2937.             case "color":
  2938.                 return void this._lampColor(e, t[1], i);
  2939.             case "intensity":
  2940.                 return void this._lampIntensity(e, t[1], i);
  2941.             case "dist":
  2942.             case "distance":
  2943.                 return void this._lampDistance(e, t[1], i)
  2944.             }
  2945.             i = this._TIME(t[3]), this._lampColor(e, t[0], i), this._lampIntensity(e, t[1], i), this._lampDistance(e, t[2], i)
  2946.         }
  2947.         _lampColor(t, e, i = 1)
  2948.         {
  2949.             t.blendLampColor.setValue(Object(_.k)(e).toNumber(), i)
  2950.         }
  2951.         _lampIntensity(t, e, i = 1)
  2952.         {
  2953.             this._RELATIVE_BLEND(t.blendLampIntensity, e, i)
  2954.         }
  2955.         _lampDistance(t, e, i = 1)
  2956.         {
  2957.             this._RELATIVE_BLEND(t.blendLampDistance, e, i)
  2958.         }
  2959.         async flashlight(...t)
  2960.         {
  2961.             const e = await this.AWAIT_CHAR(this.CHAR);
  2962.             e.setupFlashlight();
  2963.             var i = this._TIME(t[2]);
  2964.             switch (t[0].toLowerCase())
  2965.             {
  2966.             case "color":
  2967.                 return void this._flashlightColor(e, t[1], i);
  2968.             case "intensity":
  2969.                 return void this._flashlightIntensity(e, t[1], i);
  2970.             case "dist":
  2971.             case "distance":
  2972.                 return void this._flashlightDistance(e, t[1], i);
  2973.             case "angle":
  2974.                 return void this._flashlightAngle(e, t[1], i);
  2975.             case "yaw":
  2976.                 return void this._flashlightYaw(e, t[1], i);
  2977.             case "pitch":
  2978.                 return void this._flashlightPitch(e, t[1], i)
  2979.             }
  2980.             i = this._TIME(t[4]), this._flashlightColor(e, t[0], i), this._flashlightIntensity(e, t[1], i), this._flashlightDistance(e, t[2], i), this._flashlightAngle(e, t[3], i)
  2981.         }
  2982.         _flashlightColor(t, e, i)
  2983.         {
  2984.             t.blendFlashlightColor.setValue(Object(_.k)(e).toNumber(), i)
  2985.         }
  2986.         _flashlightIntensity(t, e, i)
  2987.         {
  2988.             this._RELATIVE_BLEND(t.blendFlashlightIntensity, e, i)
  2989.         }
  2990.         _flashlightDistance(t, e, i)
  2991.         {
  2992.             this._RELATIVE_BLEND(t.blendFlashlightDistance, e, i)
  2993.         }
  2994.         _flashlightAngle(t, e, i)
  2995.         {
  2996.             this._RELATIVE_BLEND(t.blendFlashlightAngle, e, i)
  2997.         }
  2998.         _flashlightPitch(t, e, i)
  2999.         {
  3000.             this._RELATIVE_BLEND(t.blendFlashlightPitch, e, i)
  3001.         }
  3002.         _flashlightYaw(t, e, i)
  3003.         {
  3004.             t.flashlightTargetYaw = e
  3005.         }
  3006.         async elevation(...t)
  3007.         {
  3008.             const e = await this.AWAIT_CHAR(this.CHAR);
  3009.             let i = this._TIME(t[1]);
  3010.             this._RELATIVE_BLEND(e.blendElevation, t[0], i)
  3011.         }
  3012.         disable(t)
  3013.         {
  3014.             a.a.disable(t)
  3015.         }
  3016.         enable(t)
  3017.         {
  3018.             a.a.enable(t)
  3019.         }
  3020.         _RELATIVE_BLEND(t, e, i)
  3021.         {
  3022.             t.setValue(Object(_.o)(t.targetValue(), e), Number(i))
  3023.         }
  3024.         _TIME(t)
  3025.         {
  3026.             return "number" == typeof t ? t : (t = Number(t), Number.isNaN(t) ? 1 : t)
  3027.         }
  3028.         ERROR_CHAR()
  3029.         {
  3030.             console.warn(`MV3D: Plugin command \`${this.FULL_COMMAND}\` failed because target character was invalid.`)
  3031.         }
  3032.         async AWAIT_CHAR(t)
  3033.         {
  3034.             if (!t) return this.ERROR_CHAR();
  3035.             let e = 0;
  3036.             for (; !t.mv3d_sprite;)
  3037.                 if (await sleep(100), ++e > 10) return this.ERROR_CHAR();
  3038.             return t.mv3d_sprite
  3039.         }
  3040.         TARGET_CHAR(t)
  3041.         {
  3042.             return a.a.targetChar(t, $gameMap.event(this.INTERPRETER._eventId), this.CHAR)
  3043.         }
  3044.     }, a.a.targetChar = function (t, e = null, i = null)
  3045.     {
  3046.         if (!t) return i;
  3047.         let a = t.toLowerCase().match(/[a-z]+/);
  3048.         const s = a ? a[0] : "e",
  3049.             r = (a = t.match(/\d+/)) ? Number(a[0]) : 0;
  3050.         switch (s[0])
  3051.         {
  3052.         case "s":
  3053.             return e;
  3054.         case "p":
  3055.             return $gamePlayer;
  3056.         case "e":
  3057.             return r ? $gameMap.event(r) : e;
  3058.         case "v":
  3059.             return $gameMap.vehicle(r);
  3060.         case "f":
  3061.             return $gamePlayer.followers()._data[r]
  3062.         }
  3063.         return char
  3064.     }, a.a.getTargetString = function (t)
  3065.     {
  3066.         return t instanceof Game_Player ? "@p" : t instanceof Game_Event ? `@e${t._eventId}` : t instanceof Game_Follower ? `@f${$gamePlayer._followers._data.indexOf(t)}` : t instanceof Game_Vehicle ? `@v${$gameMap._vehicles.indexOf(t)}` : void 0
  3067.     };
  3068.     class MapCellBuilder_CellMeshBuilder
  3069.     {
  3070.         constructor()
  3071.         {
  3072.             this.submeshBuilders = {}
  3073.         }
  3074.         build()
  3075.         {
  3076.             const t = Object.values(this.submeshBuilders);
  3077.             if (!t.length) return null;
  3078.             const e = t.map(t => t.build()),
  3079.                 i = e.reduce((t, e) => ("number" != typeof t && (t = t.getTotalVertices()), t + e.getTotalVertices()));
  3080.             return s.i.MergeMeshes(e, !0, i > 65536, void 0, !1, !0)
  3081.         }
  3082.         getBuilder(t)
  3083.         {
  3084.             return t.name in this.submeshBuilders || (this.submeshBuilders[t.name] = new MapCellBuilder_SubMeshBuilder(t)), this.submeshBuilders[t.name]
  3085.         }
  3086.         addWallFace(t, e, i, a, s, r, n, o, h, l, c, p = {})
  3087.         {
  3088.             const u = this.getBuilder(t),
  3089.                 d = MapCellBuilder_SubMeshBuilder.getUvRect(t.diffuseTexture, e, i, a, s);
  3090.             u.addWallFace(r, n, o, h, l, c, d, p), p.double && (p.flip = !p.flip, u.addWallFace(r, n, o, h, l, c, d, p))
  3091.         }
  3092.         addFloorFace(t, e, i, a, s, r, n, o, h, l, c = {})
  3093.         {
  3094.             const p = this.getBuilder(t),
  3095.                 u = MapCellBuilder_SubMeshBuilder.getUvRect(t.diffuseTexture, e, i, a, s);
  3096.             p.addFloorFace(r, n, o, h, l, u, c), c.double && (c.flip = !c.flip, p.addFloorFace(r, n, o, h, l, u, c))
  3097.         }
  3098.         addSlopeFace(t, e, i, a, s, r, n, o, h, l, c, p = {})
  3099.         {
  3100.             const u = this.getBuilder(t),
  3101.                 d = MapCellBuilder_SubMeshBuilder.getUvRect(t.diffuseTexture, e, i, a, s);
  3102.             u.addSlopeFace(r, n, o, h, l, c, d, p), p.double && (p.flip = !p.flip, u.addSlopeFace(r, n, o, h, l, c, d, p))
  3103.         }
  3104.         addSlopeSide(t, e, i, a, s, r, n, o, h, l, c, p = {})
  3105.         {
  3106.             const u = this.getBuilder(t),
  3107.                 d = MapCellBuilder_SubMeshBuilder.getUvRect(t.diffuseTexture, e, i, a, s);
  3108.             u.addSlopeSide(r, n, o, h, l, c, d, p), p.double && (p.flip = !p.flip, u.addSlopeSide(r, n, o, h, l, c, d, p))
  3109.         }
  3110.     }
  3111.     class MapCellBuilder_SubMeshBuilder
  3112.     {
  3113.         constructor(t)
  3114.         {
  3115.             this.material = t, this.positions = [], this.indices = [], this.normals = [], this.uvs = []
  3116.         }
  3117.         build()
  3118.         {
  3119.             const t = new s.i("cell mesh", a.a.scene),
  3120.                 e = new s.y;
  3121.             return e.positions = this.positions, e.indices = this.indices, e.normals = this.normals, e.uvs = this.uvs, e.applyToMesh(t), t.material = this.material, t
  3122.         }
  3123.         addWallFace(t, e, i, a, s, r, n, o)
  3124.         {
  3125.             e = -e, i = i;
  3126.             const h = Object(_.g)(r),
  3127.                 l = Object(_.p)(r),
  3128.                 c = a / 2,
  3129.                 p = s / 2,
  3130.                 u = [t - c * h, i + p, e + c * l, t + c * h, i + p, e - c * l, t - c * h, i - p, e + c * l, t + c * h, i - p, e - c * l];
  3131.             let d = [-l, 0, -h, -l, 0, -h, -l, 0, -h, -l, 0, -h];
  3132.             const g = MapCellBuilder_SubMeshBuilder.getDefaultUvs(n),
  3133.                 m = MapCellBuilder_SubMeshBuilder.getDefaultIndices();
  3134.             o.flip && MapCellBuilder_SubMeshBuilder.flipFace(m, d), o.abnormal && (d = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]), this.pushNewData(u, m, d, g)
  3135.         }
  3136.         addFloorFace(t, e, i, a, s, r, n)
  3137.         {
  3138.             const o = a / 2,
  3139.                 h = s / 2,
  3140.                 l = [t - o, i = i, (e = -e) + h, t + o, i, e + h, t - o, i, e - h, t + o, i, e - h],
  3141.                 c = [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0],
  3142.                 p = MapCellBuilder_SubMeshBuilder.getDefaultUvs(r),
  3143.                 u = MapCellBuilder_SubMeshBuilder.getDefaultIndices();
  3144.             n.flip && MapCellBuilder_SubMeshBuilder.flipFace(u, c), this.pushNewData(l, u, c, p)
  3145.         }
  3146.         addSlopeFace(t, e, i, a, s, r, n, o)
  3147.         {
  3148.             e = -e, i = i;
  3149.             const h = Object(_.g)(r),
  3150.                 l = Object(_.p)(r),
  3151.                 c = a / 2,
  3152.                 p = s / 2,
  3153.                 u = o.autotile ? [t - c, i + p + p * Math.round(Object(_.p)(-r + 1 * _.a / 4)), e + p, t + c, i + p + p * Math.round(Object(_.p)(-r + 3 * _.a / 4)), e + p, t - c, i + p + p * Math.round(Object(_.p)(-r + 7 * _.a / 4)), e - p, t + c, i + p + p * Math.round(Object(_.p)(-r + 5 * _.a / 4)), e - p] : [t - c * h + c * l, i + s, e + c * l + c * h, t + c * h + c * l, i + s, e - c * l + c * h, t - c * h - c * l, i, e + c * l - c * h, t + c * h - c * l, i, e - c * l - c * h],
  3154.                 d = Math.pow(2, -s),
  3155.                 g = 1 - d,
  3156.                 m = [-l * g, d, -h * g, -l * g, d, -h * g, -l * g, d, -h * g, -l * g, d, -h * g];
  3157.             let f = MapCellBuilder_SubMeshBuilder.getDefaultUvs(n);
  3158.             const b = MapCellBuilder_SubMeshBuilder.getDefaultIndices();
  3159.             o.flip && MapCellBuilder_SubMeshBuilder.flipFace(b, m), this.pushNewData(u, b, m, f)
  3160.         }
  3161.         addSlopeSide(t, e, i, a, s, r, n, o)
  3162.         {
  3163.             e = -e, i = i;
  3164.             const h = Object(_.g)(r),
  3165.                 l = Object(_.p)(r),
  3166.                 c = a / 2,
  3167.                 p = [t - c * h, i + s, e + c * l, t - c * h, i, e + c * l, t + c * h, i, e - c * l],
  3168.                 u = [-l, 0, -h, -l, 0, -h, -l, 0, -h],
  3169.                 d = [n.x1, n.y1, n.x1, n.y2, n.x2, n.y2],
  3170.                 g = [0, 1, 2];
  3171.             o.flip && MapCellBuilder_SubMeshBuilder.flipFace(g, u), this.pushNewData(p, g, u, d)
  3172.         }
  3173.         pushNewData(t, e, i, a)
  3174.         {
  3175.             this.indices.push(...e.map(t => t + this.positions.length / 3)), this.positions.push(...t), this.normals.push(...i), this.uvs.push(...a)
  3176.         }
  3177.         static getUvRect(t, e, i, s, r)
  3178.         {
  3179.             const
  3180.             {
  3181.                 width: n,
  3182.                 height: o
  3183.             } = t.getBaseSize();
  3184.             return a.a.EDGE_FIX && (e += a.a.EDGE_FIX, i += a.a.EDGE_FIX, s -= 2 * a.a.EDGE_FIX, r -= 2 * a.a.EDGE_FIX),
  3185.             {
  3186.                 x1: e / n,
  3187.                 y1: (o - i) / o,
  3188.                 x2: (e + s) / n,
  3189.                 y2: (o - i - r) / o
  3190.             }
  3191.         }
  3192.         static getDefaultUvs(t)
  3193.         {
  3194.             return [t.x1, t.y1, t.x2, t.y1, t.x1, t.y2, t.x2, t.y2]
  3195.         }
  3196.         static getDefaultIndices()
  3197.         {
  3198.             return [1, 0, 2, 1, 2, 3]
  3199.         }
  3200.         static flipFace(t, e)
  3201.         {
  3202.             t.reverse();
  3203.             for (let t = 0; t < e.length; ++t) e[t] *= -1
  3204.         }
  3205.     }
  3206.     new s.n(0, 1, -Math.pow(.1, 100), 0), new s.n(0, 0, -1, 0);
  3207.     class mapCell_MapCell extends s.v
  3208.     {
  3209.         constructor(t, e)
  3210.         {
  3211.             const i = [t, e].toString();
  3212.             super(`MapCell[${i}]`, a.a.scene), this.parent = a.a.map, this.cx = t, this.cy = e, this.ox = t * a.a.CELL_SIZE, this.oy = e * a.a.CELL_SIZE, this.x = this.ox, this.y = this.oy, this.key = i
  3213.         }
  3214.         update()
  3215.         {
  3216.             const t = a.a.loopCoords((this.cx + .5) * a.a.CELL_SIZE, (this.cy + .5) * a.a.CELL_SIZE);
  3217.             this.x = t.x - a.a.CELL_SIZE / 2, this.y = t.y - a.a.CELL_SIZE / 2
  3218.         }
  3219.         async load()
  3220.         {
  3221.             const t = a.a.configurationShapes;
  3222.             this.builder = new MapCellBuilder_CellMeshBuilder;
  3223.             const e = Math.min(a.a.CELL_SIZE, $gameMap.width() - this.cx * a.a.CELL_SIZE),
  3224.                 i = Math.min(a.a.CELL_SIZE, $gameMap.height() - this.cy * a.a.CELL_SIZE),
  3225.                 s = a.a.getCeilingConfig();
  3226.             for (let r = 0; r < i; ++r)
  3227.                 for (let i = 0; i < e; ++i)
  3228.                 {
  3229.                     s.cull = !1;
  3230.                     let e = !1;
  3231.                     const n = a.a.getTileData(this.ox + i, this.oy + r);
  3232.                     let o = 1 / 0;
  3233.                     for (let h = 3; h >= 0; --h)
  3234.                     {
  3235.                         if (a.a.isTileEmpty(n[h])) continue;
  3236.                         let l = a.a.getStackHeight(this.ox + i, this.oy + r, h);
  3237.                         const c = a.a.getTileTextureOffsets(n[h], this.ox + i, this.oy + r, h),
  3238.                             p = c.shape;
  3239.                         a.a.isSpecialShape(p) && (e = !0), c.realId = n[h];
  3240.                         let u = a.a.getTileHeight(this.ox + i, this.oy + r, h) || c.height || 0,
  3241.                             d = !1;
  3242.                         if (o < l && (d = !0), a.a.getTileFringe(this.ox + i, this.oy + r, h) || (o = l), !p || p === t.FLAT || p === t.SLOPE)
  3243.                         {
  3244.                             const n = u || 0 === h;
  3245.                             if (p && p !== t.FLAT)
  3246.                             {
  3247.                                 if (p === t.SLOPE)
  3248.                                 {
  3249.                                     const t = c.slopeHeight || 1;
  3250.                                     u -= t, await this.loadSlope(c, i, r, l, h, t), (u || 0 === h) && await this.loadWalls(c, i, r, l - t, h, u)
  3251.                                 }
  3252.                             }
  3253.                             else d || await this.loadTile(c, i, r, l + h * a.a.LAYER_DIST * !n, h), (u || 0 === h) && await this.loadWalls(c, i, r, l, h, u);
  3254.                             (u > 0 && e || c.fringe > 0) && await this.loadTile(c, i, r, l - u, h, !0), l >= s.height && (s.cull = !0)
  3255.                         }
  3256.                         p === t.FENCE ? await this.loadFence(c, i, r, l, h, u) : p !== t.CROSS && p !== t.XCROSS || await this.loadCross(c, i, r, l, h, u)
  3257.                     }
  3258.                     a.a.isTileEmpty(s.bottom_id) || s.cull || await this.loadTile(s, i, r, s.height, 0, !0, !s.skylight)
  3259.                 }
  3260.             this.mesh = this.builder.build(), this.mesh && (this.mesh.parent = this, this.mesh.alphaIndex = 0, a.a.callFeatures("createCellMesh", this.mesh)), delete this.builder
  3261.         }
  3262.         dispose()
  3263.         {
  3264.             super.dispose(...arguments), this.mesh && a.a.callFeatures("destroyCellMesh", this.mesh)
  3265.         }
  3266.         async loadTile(t, e, i, s, r, n = !1, o = !1)
  3267.         {
  3268.             const h = n ? t.bottom_id : t.top_id;
  3269.             if (a.a.isTileEmpty(h)) return;
  3270.             const l = n ? t.bottom_rect : t.top_rect,
  3271.                 c = Tilemap.isAutotile(h) && !l;
  3272.             let p;
  3273.             p = l ? [l] : a.a.getTileRects(h);
  3274.             const u = await a.a.getCachedTilesetMaterialForTile(t, n ? "bottom" : "top");
  3275.             for (const t of p) this.builder.addFloorFace(u, t.x, t.y, t.width, t.height, e + (0 | t.ox) / Object(_.s)() - .25 * c, i + (0 | t.oy) / Object(_.s)() - .25 * c, s, 1 - c / 2, 1 - c / 2,
  3276.             {
  3277.                 flip: n,
  3278.                 double: o
  3279.             })
  3280.         }
  3281.         async loadWalls(t, e, i, a, s, r)
  3282.         {
  3283.             for (const n of mapCell_MapCell.neighborPositions) await this.loadWall(t, e, i, a, s, r, n)
  3284.         }
  3285.         async loadWall(t, e, i, r, n, o, h)
  3286.         {
  3287.             const l = a.a.isFringeTile(t.realId) || t.fringe > 0;
  3288.             if (!a.a.getMapConfig("edge", !0) && ((this.ox + e + h.x >= $dataMap.width || this.ox + e + h.x < 0) && !$gameMap.isLoopHorizontal() || (this.oy + i + h.y >= $dataMap.height || this.oy + i + h.y < 0) && !$gameMap.isLoopVertical())) return;
  3289.             let c, p = o,
  3290.                 u = t.side_id,
  3291.                 d = "side";
  3292.             if (a.a.isTileEmpty(u)) return;
  3293.             if ((p = r - a.a.getCullingHeight(this.ox + e + h.x, this.oy + i + h.y, t.depth > 0 ? 3 : n, !(t.depth > 0))) > 0 && (n > 0 || l) && (p = Math.min(o, p)), t.depth > 0 && p < 0)
  3294.             {
  3295.                 if (a.a.tileHasPit(this.ox + e + h.x, this.oy + i + h.y, n)) return;
  3296.                 p = Math.max(p, -t.depth), t.hasInsideConf && (d = "inside")
  3297.             }
  3298.             else if (p <= 0) return;
  3299.             "inside" === d ? (u = t.inside_id, t.inside_rect && (c = t.inside_rect)) : t.side_rect && (c = t.side_rect);
  3300.             const g = await a.a.getCachedTilesetMaterialForTile(t, d),
  3301.                 m = new s.x(e + h.x / 2, i + h.y / 2, r),
  3302.                 f = -Math.atan2(h.x, h.y);
  3303.             if (c || !Tilemap.isAutotile(u))
  3304.             {
  3305.                 const t = c || a.a.getTileRects(u)[0],
  3306.                     e = {};
  3307.                 p < 0 && (e.flip = !0), this.builder.addWallFace(g, t.x, t.y, t.width, t.height, m.x, m.y, r - p / 2, 1, Math.abs(p), f, e)
  3308.             }
  3309.             else
  3310.             {
  3311.                 const l = new s.w(-h.y, h.x),
  3312.                     c = new s.w(h.y, -h.x),
  3313.                     d = a.a.getStackHeight(this.ox + e + l.x, this.oy + i + l.y, n),
  3314.                     b = a.a.getStackHeight(this.ox + e + c.x, this.oy + i + c.y, n),
  3315.                     {
  3316.                         x: T,
  3317.                         y: C
  3318.                     } = this.getAutotileCorner(u, t.realId, !0);
  3319.                 let y = Math.max(1, Math.abs(Math.round(2 * p))),
  3320.                     S = Math.abs(p / y),
  3321.                     M = Object(_.s)() / 2,
  3322.                     E = Object(_.s)() / 2;
  3323.                 a.a.isTableTile(t.realId) && (E = Object(_.s)() / 3, y = 1, S = o);
  3324.                 for (let e = -1; e <= 1; e += 2)
  3325.                     for (let i = 0; i < y; ++i)
  3326.                     {
  3327.                         let s, n, o, h;
  3328.                         a.a.isTableTile(t.realId) ? (s = d != r, n = b != r) : (s = d < r - i * S, n = b < r - i * S), o = T * Object(_.s)(), h = C * Object(_.s)(), o = (T + (e > 0 ? .5 + n : 1 - s)) * Object(_.s)(), h = a.a.isWaterfallTile(u) ? (C + i % 2 / 2) * Object(_.s)() : a.a.isTableTile(u) ? (C + 5 / 3) * Object(_.s)() : (C + (0 === i ? 0 : i === y - 1 ? 1.5 : 1 - i % 2 * .5)) * Object(_.s)();
  3329.                         const l = {};
  3330.                         p < 0 && (l.flip = !0), this.builder.addWallFace(g, o, h, M, E, m.x + .25 * e * Math.cos(f), m.y + .25 * e * Math.sin(f), r - p * (p < 0) - S / 2 - S * i, .5, S, f, l)
  3331.                     }
  3332.             }
  3333.         }
  3334.         async loadFence(t, e, i, s, r, n)
  3335.         {
  3336.             const o = t.side_id;
  3337.             if (a.a.isTileEmpty(o)) return;
  3338.             const h = t.side_rect,
  3339.                 l = await a.a.getCachedTilesetMaterialForTile(t, "side"),
  3340.                 c = Tilemap.isAutotile(o),
  3341.                 p = [];
  3342.             for (let t = 0; t < mapCell_MapCell.neighborPositions.length; ++t)
  3343.             {
  3344.                 const s = mapCell_MapCell.neighborPositions[t];
  3345.                 a.a.getTileHeight(this.ox + e + s.x, this.oy + i + s.y, r) !== n && p.push(t)
  3346.             }
  3347.             for (let r = 0; r < mapCell_MapCell.neighborPositions.length; ++r)
  3348.             {
  3349.                 const u = mapCell_MapCell.neighborPositions[r],
  3350.                     d = p.includes(r);
  3351.                 if (d && p.length < 4 && !c) continue;
  3352.                 const g = u.x > 0 || u.y > 0;
  3353.                 let m = Math.atan2(u.x, u.y) + Math.PI / 2;
  3354.                 if (g && (m -= Math.PI), c && !h)
  3355.                 {
  3356.                     const
  3357.                     {
  3358.                         x: r,
  3359.                         y: h
  3360.                     } = this.getAutotileCorner(o, t.realId, !0);
  3361.                     for (let t = 0; t <= 1; ++t) this.builder.addWallFace(l, (d ? r + 1.5 * g : r + 1 - .5 * g) * Object(_.t)(), (h + 1.5 * t) * Object(_.r)(), Object(_.t)() / 2, Object(_.r)() / 2, e + u.x / 4, i + u.y / 4, s - n / 4 - t * n / 2, .5, n / 2, -m,
  3362.                     {
  3363.                         double: !0,
  3364.                         abnormal: a.a.ABNORMAL
  3365.                     })
  3366.                 }
  3367.                 else
  3368.                 {
  3369.                     const t = h || a.a.getTileRects(o)[0];
  3370.                     this.builder.addWallFace(l, t.x + t.width / 2 * g, t.y, t.width / 2, t.height, e + u.x / 4, i + u.y / 4, s - n / 2, .5, n, m,
  3371.                     {
  3372.                         double: !0
  3373.                     })
  3374.                 }
  3375.             }
  3376.         }
  3377.         async loadCross(t, e, i, s, r, n)
  3378.         {
  3379.             const o = t.side_id;
  3380.             if (a.a.isTileEmpty(o)) return;
  3381.             const h = t.side_rect,
  3382.                 l = await a.a.getCachedTilesetMaterialForTile(t, "side"),
  3383.                 c = Tilemap.isAutotile(o);
  3384.             let p;
  3385.             p = h ? [h] : a.a.getTileRects(o);
  3386.             const u = t.shape === a.a.configurationShapes.XCROSS ? Math.PI / 4 : 0,
  3387.                 d = c ? n / 2 : n;
  3388.             for (let t = 0; t <= 1; ++t)
  3389.                 for (const r of p)
  3390.                 {
  3391.                     const o = -Math.PI / 2 * t + u,
  3392.                         h = -.25 * c + (0 | r.ox) / Object(_.t)();
  3393.                     this.builder.addWallFace(l, r.x, r.y, r.width, r.height, e + h * Math.cos(o), i + h * Math.sin(o), s - (0 | r.oy) / Object(_.r)() * n - d / 2, 1 - c / 2, d, o,
  3394.                     {
  3395.                         double: !0,
  3396.                         abnormal: a.a.ABNORMAL
  3397.                     })
  3398.                 }
  3399.         }
  3400.         async loadSlope(t, e, i, r, n, o)
  3401.         {
  3402.             const h = a.a.getSlopeDirection(this.ox + e, this.oy + i, n),
  3403.                 l = new s.w(-Object(_.p)(h + Math.PI), Object(_.g)(h + Math.PI));
  3404.             a.a.getCullingHeight(this.ox + e + l.x, this.oy + i + l.y, n) < r && await this.loadWall(t, e, i, r, n + 1, o, l);
  3405.             const c = new s.w(l.y, -l.x);
  3406.             a.a.getCullingHeight(this.ox + e + c.x, this.oy + i + c.y, n) < r && await this.loadSlopeSide(t, e + c.x / 2, i + c.y / 2, r, n, o, h + Math.PI / 2);
  3407.             const p = new s.w(-l.y, l.x);
  3408.             a.a.getCullingHeight(this.ox + e + p.x, this.oy + i + p.y, n) < r && await this.loadSlopeSide(t, e + p.x / 2, i + p.y / 2, r, n, o, h + Math.PI / 2,
  3409.             {
  3410.                 flip: !0
  3411.             }), await this.loadSlopeTop(t, e, i, r, n, o, h)
  3412.         }
  3413.         async loadSlopeTop(t, e, i, s, r, n, o)
  3414.         {
  3415.             const h = t.top_id,
  3416.                 l = await a.a.getCachedTilesetMaterialForTile(t, "top");
  3417.             if (Tilemap.isAutotile(h) && !t.top_rect)
  3418.             {
  3419.                 const t = a.a.getTileRects(h);
  3420.                 for (let a = 0; a < t.length; ++a)
  3421.                 {
  3422.                     const r = t[a],
  3423.                         h = (a + 1) % 2 * -2 + 1,
  3424.                         c = (Math.floor(a / 2) + 1) % 2 * 2 - 1,
  3425.                         p = Math.max(0, Object(_.p)(o) * h) * n / 2,
  3426.                         u = Math.max(0, Object(_.g)(o) * c) * n / 2;
  3427.                     this.builder.addSlopeFace(l, r.x, r.y, r.width, r.height, e + r.ox / Object(_.s)() - .25, i + r.oy / Object(_.s)() - .25, s - n + p + u, .5, n / 2, o,
  3428.                     {
  3429.                         autotile: !0
  3430.                     })
  3431.                 }
  3432.             }
  3433.             else
  3434.             {
  3435.                 const r = t.top_rect ? t.top_rect : a.a.getTileRects(h)[0];
  3436.                 this.builder.addSlopeFace(l, r.x, r.y, r.width, r.height, e, i, s - n, 1, n, o,
  3437.                 {})
  3438.             }
  3439.         }
  3440.         async loadSlopeSide(t, e, i, s, r, n, o, h = {})
  3441.         {
  3442.             const l = t.side_id,
  3443.                 c = await a.a.getCachedTilesetMaterialForTile(t, "side");
  3444.             let p;
  3445.             if (Tilemap.isAutotile(l) && !t.side_rect)
  3446.             {
  3447.                 const
  3448.                 {
  3449.                     x: e,
  3450.                     y: i
  3451.                 } = this.getAutotileCorner(l, t.realId, !0);
  3452.                 p = {
  3453.                     x: (e + .5) * Object(_.t)(),
  3454.                     y: (i + .5) * Object(_.r)(),
  3455.                     width: Object(_.t)(),
  3456.                     height: Object(_.r)()
  3457.                 }
  3458.             }
  3459.             else p = t.side_rect ? t.side_rect : a.a.getTileRects(l)[0];
  3460.             this.builder.addSlopeSide(c, p.x, p.y, p.width, p.height, e, i, s - n, 1, n, o, h)
  3461.         }
  3462.         getAutotileCorner(t, e = t, i = !0)
  3463.         {
  3464.             const s = Tilemap.getAutotileKind(t);
  3465.             let r = s % 8,
  3466.                 n = Math.floor(s / 8);
  3467.             var o, h;
  3468.             return t === e && 1 == a.a.isWallTile(t) && ++n, o = 2 * r, h = n, Tilemap.isTileA1(t) ? (s < 4 ? (o = 6 * Math.floor(s / 2), h = s % 2 * 3 + i) : (o = 8 * Math.floor(r / 4) + s % 2 * 6, h = 6 * n + 3 * Math.floor(r % 4 / 2) + i * !(r % 2)), i && s >= 4 && !(s % 2) && (h += 1)) : Tilemap.isTileA2(t) ? h = 3 * (n - 2) + i : Tilemap.isTileA3(t) ? h = 2 * (n - 6) : Tilemap.isTileA4(t) && (h = i ? Math.ceil(2.5 * (n - 10) + .5) : 2.5 * (n - 10) + (n % 2 ? .5 : 0)),
  3469.             {
  3470.                 x: o,
  3471.                 y: h
  3472.             }
  3473.         }
  3474.     }
  3475.     mapCell_MapCell.neighborPositions = [new s.w(0, 1), new s.w(1, 0), new s.w(0, -1), new s.w(-1, 0)], mapCell_MapCell.meshCache = {};
  3476.     Object.assign(a.a,
  3477.     {
  3478.         _tilemap: null,
  3479.         getTilemap()
  3480.         {
  3481.             return SceneManager._scene && SceneManager._scene._spriteset && (this._tilemap = SceneManager._scene._spriteset._tilemap), this._tilemap
  3482.         },
  3483.         getDataMap()
  3484.         {
  3485.             return $dataMap && (this._dataMap = $dataMap), this._dataMap
  3486.         },
  3487.         getRegion(t, e)
  3488.         {
  3489.             return this.getTileId(t, e, 5)
  3490.         },
  3491.         getSetNumber: t => Tilemap.isAutotile(t) ? Tilemap.isTileA1(t) ? 0 : Tilemap.isTileA2(t) ? 1 : Tilemap.isTileA3(t) ? 2 : 3 : Tilemap.isTileA5(t) ? 4 : 5 + Math.floor(t / 256),
  3492.         getShadowBits(t, e)
  3493.         {
  3494.             return this.getTilemap()._readMapData(t, e, 4)
  3495.         },
  3496.         getTerrainTag: t => $gameMap.tilesetFlags()[t] >> 12,
  3497.         getTilePassage: Object(_.l)(
  3498.         {
  3499.             1(t)
  3500.             {
  3501.                 return this.getTilePassage(t, this.getTileConfig(t))
  3502.             },
  3503.             2(t, e)
  3504.             {
  3505.                 if ("pass" in e) return e.pass;
  3506.                 const i = $gameMap.tilesetFlags()[t];
  3507.                 return 16 & i ? this.configurationPassage.THROUGH : 15 == (15 & i) ? this.configurationPassage.WALL : this.configurationPassage.FLOOR
  3508.             },
  3509.             3(t, e, i)
  3510.             {
  3511.                 const a = this.getTileData(t, e)[i];
  3512.                 return this.getTilePassage(a, this.getTileConfig(a, t, e, i))
  3513.             }
  3514.         }),
  3515.         getMaterialOptions(t, e)
  3516.         {
  3517.             const i = {};
  3518.             return "alpha" in t && (i.alpha = t.alpha), "glow" in t && (i.glow = t.glow), e && (`${e}_alpha` in t && (i.alpha = t[`${e}_alpha`]), `${e}_glow` in t && (i.glow = t[`${e}_glow`])), "alpha" in i && (i.transparent = !0), i
  3519.         },
  3520.         getTileAnimationData(t, e)
  3521.         {
  3522.             const i = t[`${e}_id`];
  3523.             if (`${e}_animData` in t) return t[`${e}_animData`];
  3524.             const a = {
  3525.                 animX: 0,
  3526.                 animY: 0
  3527.             };
  3528.             if (Tilemap.isTileA1(i))
  3529.             {
  3530.                 const t = Tilemap.getAutotileKind(i);
  3531.                 a.animX = t <= 1 ? 2 : t <= 3 ? 0 : t % 2 ? 0 : 2, a.animY = t <= 3 ? 0 : t % 2 ? 1 : 0
  3532.             }
  3533.             return a
  3534.         },
  3535.         getTileConfig: Object(_.l)(
  3536.         {
  3537.             3(t, e, i)
  3538.             {
  3539.                 return this.getTileConfig(this.getTileData(t, e)[i], t, e, i)
  3540.             },
  3541.             default (t, e, i, s)
  3542.             {
  3543.                 const r = {};
  3544.                 if (!this.isTileEmpty(t))
  3545.                 {
  3546.                     const e = this.getTerrainTag(t);
  3547.                     e && e in this.TTAG_DATA && Object.assign(r, this.TTAG_DATA[e]);
  3548.                     const i = this.tilesetConfigurations[this.normalizeAutotileId(t)];
  3549.                     i && Object.assign(r, i)
  3550.                 }
  3551.                 if (0 === s)
  3552.                 {
  3553.                     const t = this.getRegion(e, i);
  3554.                     t && t in a.a.REGION_DATA && Object.assign(r, this.REGION_DATA[t])
  3555.                 }
  3556.                 return r
  3557.             }
  3558.         }),
  3559.         getTileTextureOffsets(t, e, i, a)
  3560.         {
  3561.             const s = this.getTileConfig(t, e, i, a),
  3562.                 r = Tilemap.isAutotile(t) ? 48 : 1;
  3563.             this.getTilemap();
  3564.             return s.hasInsideConf = Boolean(s.inside_offset || s.rectInside || "inside_id" in s), s.hasBottomConf = Boolean(s.bottom_offset || s.rectBottom || "bottom_id" in s), null == s.top_id && (s.top_id = t, s.top_offset && (s.top_id = t + s.top_offset.x * r + s.top_offset.y * r * 8)), null == s.side_id && (s.side_id = t, s.side_offset && (s.side_id = t + s.side_offset.x * r + s.side_offset.y * r * 8)), null == s.inside_id && (s.inside_id = s.side_id, s.inside_offset && (s.inside_id = t + s.inside_offset.x * r + s.inside_offset.y * r * 8)), null == s.bottom_id && (s.bottom_id = s.top_id, s.bottom_offset && (s.bottom_id = t + s.bottom_offset.x * r + s.bottom_offset.y * r * 8)), s
  3565.         },
  3566.         getTileId(t, e, i = 0)
  3567.         {
  3568.             const a = this.getDataMap();
  3569.             return a.data[(i * a.height + e) * a.width + t] || 0
  3570.         },
  3571.         getTileData(t, e)
  3572.         {
  3573.             if (!$dataMap || !$dataMap.data) return [0, 0, 0, 0];
  3574.             const i = $dataMap.data,
  3575.                 a = $dataMap.width,
  3576.                 s = $dataMap.height;
  3577.             if ($gameMap.isLoopHorizontal() && (t = t.mod(a)), $gameMap.isLoopVertical() && (e = e.mod(s)), t < 0 || t >= a || e < 0 || e >= s) return [0, 0, 0, 0];
  3578.             const r = [];
  3579.             for (let n = 0; n < 4; ++n) r[n] = i[(n * s + e) * a + t] || 0;
  3580.             return r
  3581.         },
  3582.         getTileHeight(t, e, i = 0)
  3583.         {
  3584.             if (!$dataMap) return 0;
  3585.             $gameMap.isLoopHorizontal() && (t = t.mod($dataMap.width)), $gameMap.isLoopVertical() && (e = e.mod($dataMap.height));
  3586.             const a = this.getTileData(t, e)[i];
  3587.             if (this.isTileEmpty(a) && i > 0) return 0;
  3588.             const s = this.getTilemap(),
  3589.                 r = this.configurationShapes,
  3590.                 n = this.getTileConfig(a, t, e, i);
  3591.             let o = 0;
  3592.             if ("height" in n) o = n.height;
  3593.             else if (this.isWallTile(a)) o = this.WALL_HEIGHT;
  3594.             else if (s && s._isTableTile(a)) o = this.TABLE_HEIGHT;
  3595.             else if (this.isSpecialShape(n.shape)) switch (n.shape)
  3596.             {
  3597.             case r.SLOPE:
  3598.                 o = 0;
  3599.                 break;
  3600.             default:
  3601.                 o = 1
  3602.             }
  3603.             return "depth" in n && (o -= n.depth), n.shape === r.SLOPE && (o += n.slopeHeight || 1), o
  3604.         },
  3605.         getStackHeight(t, e, i = 3)
  3606.         {
  3607.             let a = 0;
  3608.             for (let s = 0; s <= i; ++s) a += this.getTileFringe(t, e, s), a += this.getTileHeight(t, e, s);
  3609.             return a
  3610.         },
  3611.         getSlopeDirection(t, e, i, s = !1)
  3612.         {
  3613.             const r = this.getTileHeight(t, e, i),
  3614.                 n = this.getStackHeight(t, e, i),
  3615.                 o = this.getTileData(t, e)[i],
  3616.                 h = this.getTileConfig(o, t, e, i),
  3617.                 l = mapCell_MapCell.neighborPositions,
  3618.                 c = $gameMap.tilesetFlags()[o],
  3619.                 p = this.getShadowBits(t, e),
  3620.                 u = [0, 3, 10, 5, 12];
  3621.             let d;
  3622.             for (let i = 0; i < l.length; ++i)
  3623.             {
  3624.                 const s = l[i],
  3625.                     o = {
  3626.                         neighbor: s,
  3627.                         favor: 0
  3628.                     };
  3629.                 o.dir = 5 - 3 * s.y + s.x;
  3630.                 const g = this.getWalkHeight(t + s.x, e + s.y, !0),
  3631.                     m = this.getWalkHeight(t - s.x, e - s.y, !0);
  3632.                 Math.abs(n - m) <= a.a.STAIR_THRESH && (o.favor += 1), Math.abs(n - r - g) <= a.a.STAIR_THRESH && (o.favor += 1), (p & u[o.dir / 2]) === u[o.dir / 2] && (o.favor += 3), c & 1 << o.dir / 2 - 1 && (o.favor = -2), c & 1 << (10 - o.dir) / 2 - 1 && (o.favor = -1), h.slopeDirection === o.dir && (o.favor = 100), (!d || o.favor > d.favor) && (d = o)
  3633.             }
  3634.             return d.rot = Object(_.i)(180 - this.dirToYaw(d.dir)), s ? d : d.rot
  3635.         },
  3636.         getWalkHeight(t, e, i = !1)
  3637.         {
  3638.             const a = Math.round(t),
  3639.                 s = Math.round(e),
  3640.                 r = this.getTileData(a, s);
  3641.             let n = 0,
  3642.                 o = 0;
  3643.             for (let h = 0; h <= 3; ++h)
  3644.             {
  3645.                 const l = r[h];
  3646.                 if (this.isTileEmpty(l) && h > 0) continue;
  3647.                 n += o;
  3648.                 const c = this.getTileConfig(l, a, s, h),
  3649.                     p = c.shape;
  3650.                 if (p === this.configurationShapes.SLOPE)
  3651.                     if (i) o = c.slopeHeight || 1, n += this.getTileHeight(a, s, h) - o;
  3652.                     else
  3653.                     {
  3654.                         const i = this.getSlopeHeight(t, e, h, c);
  3655.                         n += this.getTileHeight(a, s, h) - (c.slopeHeight || 1) + i, o = 0
  3656.                     }
  3657.                 else o = this.getTileHeight(a, s, h);
  3658.                 o += this.getTileFringe(a, s, h), this.isSpecialShape(p) || (n += o, o = 0)
  3659.             }
  3660.             return n
  3661.         },
  3662.         getSlopeHeight(t, e, i, a = null)
  3663.         {
  3664.             const s = Math.round(t),
  3665.                 r = Math.round(e);
  3666.             null == a && (a = this.getTileConfig(this.getTileData(s, r)[i], s, r, i));
  3667.             const n = this.getSlopeDirection(s, r, i),
  3668.                 o = Object(_.p)(n),
  3669.                 h = -Object(_.g)(n);
  3670.             let l = (t + .5) % 1,
  3671.                 c = (e + .5) % 1;
  3672.             Math.sign(o < 0) && (l = 1 - l), Math.sign(h < 0) && (c = 1 - c);
  3673.             const p = Math.abs(o) * l + Math.abs(h) * c;
  3674.             return (a.slopeHeight || 1) * p
  3675.         },
  3676.         getCollisionHeights(t, e)
  3677.         {
  3678.             const i = Math.round(t),
  3679.                 a = Math.round(e);
  3680.             let s = 0;
  3681.             const r = [
  3682.             {
  3683.                 z1: -1 / 0,
  3684.                 z2: 0
  3685.             }];
  3686.             for (let n = 0; n <= 3; ++n)
  3687.             {
  3688.                 let o = this.getTileHeight(i, a, n);
  3689.                 const h = this.getTileData(i, a)[n],
  3690.                     l = this.getTileConfig(h, i, a, n),
  3691.                     c = l.shape;
  3692.                 let p = !1;
  3693.                 this.getTilePassage(h, l) === this.configurationPassage.THROUGH ? (o = 0, p = !0) : c === this.configurationShapes.SLOPE && (o = o - (l.slopeHeight || 1) + this.getSlopeHeight(t, e, n, l));
  3694.                 const u = this.getTileFringe(i, a, n);
  3695.                 if (s += u, !p && (o || u))
  3696.                 {
  3697.                     if (o < 0)
  3698.                     {
  3699.                         if (u + o >= 0) continue;
  3700.                         r[r.length - 1].z2 += u + o
  3701.                     }
  3702.                     else 0 === n ? r[0].z2 = s + o : r.push(
  3703.                     {
  3704.                         z1: s,
  3705.                         z2: s + o
  3706.                     });
  3707.                     s += o
  3708.                 }
  3709.             }
  3710.             return r
  3711.         },
  3712.         getTileLayers(t, e, i)
  3713.         {
  3714.             let a = 1 / 0,
  3715.                 s = [0],
  3716.                 r = 0;
  3717.             for (let n = 0; n <= 3; ++n)
  3718.             {
  3719.                 if (this.getTilePassage(t, e, n) === this.configurationPassage.THROUGH) continue;
  3720.                 const o = i - (r += this.getTileFringe(t, e, n) + this.getTileHeight(t, e, n));
  3721.                 i >= r && (o < a ? (s = [n], a = o) : o === a && s.push(n))
  3722.             }
  3723.             return s
  3724.         },
  3725.         getFloatHeight(t, e, i = null)
  3726.         {
  3727.             const a = this.getTileData(t, e),
  3728.                 s = null == i ? [0, 1, 2, 3] : this.getTileLayers(t, e, i);
  3729.             let r = 0;
  3730.             for (const i of s)
  3731.             {
  3732.                 const s = a[i];
  3733.                 if (this.isTileEmpty(s)) continue;
  3734.                 const n = this.getTileConfig(s, t, e, i);
  3735.                 n && "float" in n && (r += n.float)
  3736.             }
  3737.             return r
  3738.         },
  3739.         getStackFringeHeight(t, e, i = 3)
  3740.         {
  3741.             return this.getStackHeight(t, e, i)
  3742.         },
  3743.         getTileFringe(t, e, i)
  3744.         {
  3745.             const a = this.getTileData(t, e)[i];
  3746.             if (this.isTileEmpty(a)) return 0;
  3747.             const s = this.getTileConfig(a, t, e, i);
  3748.             return s && "fringe" in s ? s.fringe : this.getTilemap()._isHigherTile(a) ? this.FRINGE_HEIGHT : 0
  3749.         },
  3750.         getCullingHeight(t, e, i = 3, a = !1)
  3751.         {
  3752.             const s = this.getTileData(t, e);
  3753.             let r = 0;
  3754.             for (let n = 0; n <= i; ++n)
  3755.             {
  3756.                 if (this.getTileFringe(t, e, n)) return r;
  3757.                 const i = s[n],
  3758.                     o = this.getTileConfig(i, t, e, n),
  3759.                     h = o.shape;
  3760.                 if (this.isSpecialShape(h)) return h === this.configurationShapes.SLOPE && (r += this.getTileHeight(t, e, n), r -= o.slopeHeight || 1), r;
  3761.                 a && o.depth > 0 && (r += o.depth), r += this.getTileHeight(t, e, n)
  3762.             }
  3763.             return r
  3764.         },
  3765.         tileHasPit(t, e, i = 3)
  3766.         {
  3767.             const a = this.getTileData(t, e);
  3768.             for (let s = 0; s <= i; ++s)
  3769.             {
  3770.                 const i = a[s];
  3771.                 if (this.getTileConfig(i, t, e, s).depth > 0) return !0
  3772.             }
  3773.             return !1
  3774.         },
  3775.         isTilePit(t, e, i)
  3776.         {
  3777.             const a = this.getTileData(t, e)[i];
  3778.             return this.getTileConfig(a, t, e, i).depth > 0
  3779.         },
  3780.         getTileRects(t)
  3781.         {
  3782.             const e = [],
  3783.                 i = this.getTilemap(),
  3784.                 a = i._isTableTile(t);
  3785.             if (i._drawTile(
  3786.                 {
  3787.                     addRect: (t, i, a, s, r, n, o, h, l) =>
  3788.                     {
  3789.                         e.push(
  3790.                         {
  3791.                             setN: t,
  3792.                             x: i,
  3793.                             y: a,
  3794.                             width: n,
  3795.                             height: o,
  3796.                             ox: s,
  3797.                             oy: r
  3798.                         })
  3799.                     }
  3800.                 }, t, 0, 0), a)
  3801.                 for (let t = e.length - 1; t >= 0; --t) e[t].oy > Object(_.s)() / 2 && (e[t - 1].y += 2 * Object(_.s)() / 3, e.splice(t, 1));
  3802.             return e
  3803.         },
  3804.         isTileEmpty: t => !t || 1544 === t,
  3805.         isWallTile(t)
  3806.         {
  3807.             const e = Tilemap.getAutotileKind(t),
  3808.                 i = Math.floor(e / 8),
  3809.                 a = Tilemap.isTileA3(t) || Tilemap.isTileA4(t);
  3810.             return a && i % 2 ? 2 : a
  3811.         },
  3812.         isTableTile(t)
  3813.         {
  3814.             return Boolean(this.getTilemap()._isTableTile(t))
  3815.         },
  3816.         isFringeTile(t)
  3817.         {
  3818.             return Boolean(this.getTilemap()._isHigherTile(t))
  3819.         },
  3820.         isWaterfallTile(t)
  3821.         {
  3822.             const e = Tilemap.getAutotileKind(t);
  3823.             return Tilemap.isTileA1(t) && e >= 4 && e % 2
  3824.         },
  3825.         isSpecialShape(t)
  3826.         {
  3827.             const e = a.a.configurationShapes;
  3828.             return t === e.FENCE || t === e.CROSS || t === e.XCROSS || t === e.SLOPE
  3829.         },
  3830.         isPlatformShape(t)
  3831.         {
  3832.             const e = a.a.configurationShapes;
  3833.             return null == t || t === e.FLAT || t === e.SLOPE
  3834.         },
  3835.         constructTileId(t, e, i)
  3836.         {
  3837.             const a = `TILE_ID_${t.toUpperCase()}`;
  3838.             let s = a in Tilemap ? Tilemap[a] : 0;
  3839.             const r = Tilemap.isAutotile(s) ? 48 : 1;
  3840.             return s += Number(e) * r + Number(i) * r * 8
  3841.         },
  3842.         normalizeAutotileId(t)
  3843.         {
  3844.             if (!Tilemap.isAutotile(t)) return t;
  3845.             const e = Tilemap.getAutotileKind(t);
  3846.             return Tilemap.TILE_ID_A1 + 48 * e
  3847.         }
  3848.     }), Object.assign(a.a,
  3849.     {
  3850.         mapLoaded: !1,
  3851.         mapReady: !1,
  3852.         clearMap()
  3853.         {
  3854.             this.mapLoaded = !1, this.clearMapCells();
  3855.             for (let t = this.characters.length - 1; t >= 0; --t) this.characters[t].dispose(!1, !0);
  3856.             this.characters.length = 0, this.resetCameraTarget(), this.callFeatures("clearMap")
  3857.         },
  3858.         clearMapCells()
  3859.         {
  3860.             for (const t in this.textureCache) this.textureCache[t].dispose();
  3861.             for (const t in this.materialCache) this.materialCache[t].dispose();
  3862.             this.animatedTextures.length = 0, this.textureCache = {}, this.materialCache = {};
  3863.             for (const t in this.cells) this.cells[t].dispose(!1, !0);
  3864.             this.cells = {}
  3865.         },
  3866.         reloadMap()
  3867.         {
  3868.             this.clearMapCells(), this.callFeatures("reloadMap")
  3869.         },
  3870.         loadMap()
  3871.         {
  3872.             this.updateBlenders(), this.updateMap(), this.createCharacters(), this.rememberCameraTarget(), this.callFeatures("loadMap")
  3873.         },
  3874.         async updateMap()
  3875.         {
  3876.             if (this.mapUpdating) return;
  3877.             this.mapLoaded = !0, this.mapUpdating = !0;
  3878.             for (const t in this.cells) this.cells[t].unload = !0;
  3879.             const t = {
  3880.                 left: Math.floor((this.cameraStick.x - this.RENDER_DIST) / this.CELL_SIZE),
  3881.                 right: Math.floor((this.cameraStick.x + this.RENDER_DIST) / this.CELL_SIZE),
  3882.                 top: Math.floor((this.cameraStick.y - this.RENDER_DIST) / this.CELL_SIZE),
  3883.                 bottom: Math.floor((this.cameraStick.y + this.RENDER_DIST) / this.CELL_SIZE)
  3884.             };
  3885.             $gameMap.isLoopHorizontal() || (t.left = Math.max(0, t.left), t.right = Math.min(t.right, Math.floor($gameMap.width() / a.a.CELL_SIZE))), $gameMap.isLoopVertical() || (t.top = Math.max(0, t.top), t.bottom = Math.min(t.bottom, Math.floor($gameMap.height() / a.a.CELL_SIZE)));
  3886.             const e = [];
  3887.             for (let i = t.left; i <= t.right; ++i)
  3888.                 for (let r = t.top; r <= t.bottom; ++r)
  3889.                 {
  3890.                     let t = i,
  3891.                         n = r;
  3892.                     $gameMap.isLoopHorizontal() && (t = t.mod(Math.ceil($gameMap.width() / a.a.CELL_SIZE))), $gameMap.isLoopVertical() && (n = n.mod(Math.ceil($gameMap.height() / a.a.CELL_SIZE)));
  3893.                     const o = [t, n].toString();
  3894.                     o in this.cells ? this.cells[o].unload = !1 : e.push(new s.w(t, n))
  3895.                 }
  3896.             for (const t in this.cells) a.a.UNLOAD_CELLS && this.cells[t].unload && (this.cells[t].dispose(), delete this.cells[t]);
  3897.             const i = new s.w(Math.round(this.cameraStick.x / this.CELL_SIZE - .5), Math.round(this.cameraStick.y / this.CELL_SIZE - .5));
  3898.             e.sort((t, e) => s.w.DistanceSquared(t, i) - s.w.DistanceSquared(e, i)), this.mapReady && (e.length = Math.min(25, e.length));
  3899.             for (const t of e)
  3900.             {
  3901.                 let
  3902.                 {
  3903.                     x: e,
  3904.                     y: i
  3905.                 } = t;
  3906.                 if (await this.loadMapCell(e, i), this.mapReady && await Object(_.q)(), !this.mapLoaded) return void this.endMapUpdate()
  3907.             }
  3908.             this.endMapUpdate()
  3909.         },
  3910.         endMapUpdate()
  3911.         {
  3912.             this.mapUpdating = !1, this.mapReady = !0
  3913.         },
  3914.         async loadMapCell(t, e)
  3915.         {
  3916.             const i = [t, e].toString();
  3917.             if (i in this.cells) return;
  3918.             const a = new mapCell_MapCell(t, e);
  3919.             this.cells[i] = a, await a.load()
  3920.         }
  3921.     }), Object.assign(a.a,
  3922.     {
  3923.         animatedTextures: [],
  3924.         textureCache:
  3925.         {},
  3926.         materialCache:
  3927.         {},
  3928.         getCachedTilesetTexture(t, e = 0, i = 0)
  3929.         {
  3930.             const r = `TS:${t}|${e},${i}`;
  3931.             if (r in this.textureCache) return this.textureCache[r];
  3932.             const n = $gameMap.tileset().tilesetNames[t];
  3933.             if (!n) return this.getErrorTexture();
  3934.             const o = `img/tilesets/${n}.png`,
  3935.                 h = new s.u(o, this.scene, !a.a.MIPMAP);
  3936.             return h.hasAlpha = !0, h.onLoadObservable.addOnce(() =>
  3937.             {
  3938.                 if (this.textureCache[r] === h && (h.updateSamplingMode(1), e || i))
  3939.                 {
  3940.                     const
  3941.                     {
  3942.                         width: t,
  3943.                         height: a
  3944.                     } = h.getBaseSize();
  3945.                     h.frameData = {
  3946.                         x: 0,
  3947.                         y: 0,
  3948.                         w: t,
  3949.                         h: a
  3950.                     }, h.animX = e, h.animY = i, this.animatedTextures.push(h)
  3951.                 }
  3952.             }), this.textureCache[r] = h, h
  3953.         },
  3954.         getCachedTilesetTextureAsync(t, e = 0, i = 0)
  3955.         {
  3956.             return new Promise((a, s) =>
  3957.             {
  3958.                 const r = this.getCachedTileTexture(t, e, i);
  3959.                 r.isReady() ? a(r) : r.onLoadObservable.addOnce(() =>
  3960.                 {
  3961.                     a(r)
  3962.                 })
  3963.             })
  3964.         },
  3965.         getErrorTexture()
  3966.         {
  3967.             return this.errorTexture ? this.errorTexture : (this.errorTexture = new s.u(`${a.a.MV3D_FOLDER}/errorTexture.png`, this.scene), this.errorTexture.isError = !0, this.errorTexture)
  3968.         },
  3969.         getBushAlphaTexture()
  3970.         {
  3971.             return this.bushAlphaTexture ? this.bushAlphaTexture : (this.bushAlphaTexture = new s.u(`${a.a.MV3D_FOLDER}/bushAlpha.png`, this.scene), this.bushAlphaTexture.getAlphaFromRGB = !0, this.bushAlphaTexture)
  3972.         },
  3973.         getCachedTilesetMaterial(t, e = 0, i = 0, r = {})
  3974.         {
  3975.             this.processMaterialOptions(r);
  3976.             const n = `TS:${t}|${e},${i}|${this.getExtraBit(r)}`;
  3977.             if (n in this.materialCache) return this.materialCache[n];
  3978.             const o = this.getCachedTilesetTexture(t, e, i),
  3979.                 h = new s.t(n, this.scene);
  3980.             return h.diffuseTexture = o, r.transparent && (h.opacityTexture = o, h.alpha = r.alpha), h.alphaCutOff = a.a.ALPHA_CUTOFF, h.ambientColor.set(1, 1, 1), h.emissiveColor.set(r.glow, r.glow, r.glow), h.specularColor.set(0, 0, 0), isNaN(this.LIGHT_LIMIT) || (h.maxSimultaneousLights = this.LIGHT_LIMIT), this.materialCache[n] = h, h
  3981.         },
  3982.         getCachedTilesetMaterialAsync(t, e = 0, i = 0, a = {})
  3983.         {
  3984.             return new Promise((s, r) =>
  3985.             {
  3986.                 const n = this.getCachedTilesetMaterial(t, e, i, a),
  3987.                     o = n.diffuseTexture;
  3988.                 o.isReady() ? s(n) : o.onLoadObservable.addOnce(() =>
  3989.                 {
  3990.                     s(n)
  3991.                 })
  3992.             })
  3993.         },
  3994.         async getCachedTilesetMaterialForTile(t, e)
  3995.         {
  3996.             const i = a.a.getSetNumber(t[`${e}_id`]),
  3997.                 s = a.a.getMaterialOptions(t, e),
  3998.                 r = a.a.getTileAnimationData(t, e);
  3999.             return await a.a.getCachedTilesetMaterialAsync(i, r.animX, r.animY, s)
  4000.         },
  4001.         processMaterialOptions(t)
  4002.         {
  4003.             "alpha" in t ? (t.alpha = Math.round(7 * t.alpha) / 7, t.alph < 1 && (t.transparent = !0)) : t.alpha = 1, t.glow = "glow" in t ? Math.round(7 * t.glow) / 7 : 0
  4004.         },
  4005.         getExtraBit(t)
  4006.         {
  4007.             let e = 0;
  4008.             return e |= Boolean(t.transparent) << 0, e |= 7 - 7 * t.alpha << 1, (e |= 7 * t.glow << 1).toString(36)
  4009.         },
  4010.         lastAnimUpdate: 0,
  4011.         animXFrame: 0,
  4012.         animYFrame: 0,
  4013.         animDirection: 1,
  4014.         updateAnimations()
  4015.         {
  4016.             if (!(performance.now() - this.lastAnimUpdate <= this.ANIM_DELAY))
  4017.             {
  4018.                 this.lastAnimUpdate = performance.now(), this.animXFrame <= 0 ? this.animDirection = 1 : this.animXFrame >= 2 && (this.animDirection = -1), this.animXFrame += this.animDirection, this.animYFrame = (this.animYFrame + 1) % 3;
  4019.                 for (const t of this.animatedTextures) t.crop(t.frameData.x + t.animX * this.animXFrame * Object(_.t)(), t.frameData.y + t.animY * this.animYFrame * Object(_.r)(), t.frameData.w, t.frameData.h)
  4020.             }
  4021.         }
  4022.     }), Object.assign(a.a,
  4023.     {
  4024.         createCharacters()
  4025.         {
  4026.             const t = $gameMap.events();
  4027.             for (const e of t) this.createCharacterFor(e, 0);
  4028.             const e = $gameMap.vehicles();
  4029.             for (const t of e) this.createCharacterFor(t, 1);
  4030.             const i = $gamePlayer.followers()._data;
  4031.             for (let t = i.length - 1; t >= 0; --t) this.createCharacterFor(i[t], 29 - t);
  4032.             this.createCharacterFor($gamePlayer, 30)
  4033.         },
  4034.         createCharacterFor(t, e)
  4035.         {
  4036.             if (!t.mv3d_sprite)
  4037.             {
  4038.                 const i = new characters_Character(t, e);
  4039.                 return Object.defineProperty(t, "mv3d_sprite",
  4040.                 {
  4041.                     value: i,
  4042.                     configurable: !0
  4043.                 }), this.characters.push(i), i
  4044.             }
  4045.             return t.mv3d_sprite
  4046.         },
  4047.         updateCharacters()
  4048.         {
  4049.             for (let t = this.characters.length - 1; t >= 0; --t) this.characters[t].update()
  4050.         },
  4051.         setupSpriteMeshes()
  4052.         {
  4053.             characters_Sprite.Meshes = {}, characters_Sprite.Meshes.FLAT = s.i.MergeMeshes([s.j.CreatePlane("sprite mesh",
  4054.             {
  4055.                 sideOrientation: s.c
  4056.             }, a.a.scene).rotate(_.b, Math.PI / 2, s.z)]), characters_Sprite.Meshes.SPRITE = s.i.MergeMeshes([s.j.CreatePlane("sprite mesh",
  4057.             {
  4058.                 sideOrientation: s.c
  4059.             }, a.a.scene).translate(_.c, .5, s.z)]), characters_Sprite.Meshes.CROSS = s.i.MergeMeshes([characters_Sprite.Meshes.SPRITE.clone(), characters_Sprite.Meshes.SPRITE.clone().rotate(_.c, Math.PI / 2, s.z)]), characters_Sprite.Meshes.SHADOW = characters_Sprite.Meshes.FLAT.clone("shadow mesh");
  4060.             const t = new s.u(`${a.a.MV3D_FOLDER}/shadow.png`),
  4061.                 e = new s.t("shadow material", a.a.scene);
  4062.             e.diffuseTexture = t, e.opacityTexture = t, e.specularColor.set(0, 0, 0), characters_Sprite.Meshes.SHADOW.material = e;
  4063.             for (const t in characters_Sprite.Meshes) a.a.scene.removeMesh(characters_Sprite.Meshes[t])
  4064.         }
  4065.     });
  4066.     class characters_Sprite extends s.v
  4067.     {
  4068.         constructor()
  4069.         {
  4070.             super("sprite", a.a.scene), this.spriteOrigin = new s.v("sprite origin", a.a.scene), this.spriteOrigin.parent = this, this.mesh = characters_Sprite.Meshes.FLAT.clone(), this.mesh.parent = this.spriteOrigin
  4071.         }
  4072.         setMaterial(t)
  4073.         {
  4074.             this.disposeMaterial(), this.texture = new s.u(t, a.a.scene), this.bitmap = this.texture._texture, this.texture.hasAlpha = !0, this.texture.onLoadObservable.addOnce(() => this.onTextureLoaded()), this.material = new s.t("sprite material", a.a.scene), this.material.diffuseTexture = this.texture, this.material.alphaCutOff = a.a.ALPHA_CUTOFF, this.material.ambientColor.set(1, 1, 1), this.material.specularColor.set(0, 0, 0), isNaN(this.LIGHT_LIMIT) || (this.material.maxSimultaneousLights = this.LIGHT_LIMIT), this.mesh.material = this.material
  4075.         }
  4076.         onTextureLoaded()
  4077.         {
  4078.             this.texture.updateSamplingMode(1)
  4079.         }
  4080.         disposeMaterial()
  4081.         {
  4082.             this.material && (this.material.dispose(), this.texture.dispose(), this.material = null, this.texture = null, this.bitmap = null)
  4083.         }
  4084.         dispose(...t)
  4085.         {
  4086.             this.disposeMaterial(), super.dispose(...t)
  4087.         }
  4088.     }
  4089.     const A = {
  4090.             configurable: !0,
  4091.             get()
  4092.             {
  4093.                 return this._mv3d_z
  4094.             },
  4095.             set(t)
  4096.             {
  4097.                 this._mv3d_z = t, this.mv3d_sprite && (this.mv3d_sprite.position.y = t)
  4098.             }
  4099.         },
  4100.         D = {
  4101.             configurable: !0,
  4102.             get()
  4103.             {
  4104.                 return this.char._mv3d_z
  4105.             },
  4106.             set(t)
  4107.             {
  4108.                 this.char._mv3d_z = t, this.position.y = t
  4109.             }
  4110.         };
  4111.     class characters_Character extends characters_Sprite
  4112.     {
  4113.         constructor(t, e)
  4114.         {
  4115.             super(), this.order = e, this.mesh.order = this.order, this.mesh.character = this, this._character = this.char = t, this.charName = "", this.charIndex = 0, this.updateCharacter(), this.updateShape(), this.isVehicle = this.char instanceof Game_Vehicle, this.isBoat = this.isVehicle && this.char.isBoat(), this.isShip = this.isVehicle && this.char.isShip(), this.isAirship = this.isVehicle && this.char.isAirship(), this.isEvent = this.char instanceof Game_Event, this.isPlayer = this.char instanceof Game_Player, this.isFollower = this.char instanceof Game_Follower, "_mv3d_z" in this.char || (this.char._mv3d_z = a.a.getWalkHeight(this.char.x, this.char.y)), Object.defineProperty(this.char, "z", A), Object.defineProperty(this, "z", D), this.z = this.z, this.platformHeight = this.z, this.targetElevation = this.z, this.prevZ = this.z, this.needsPositionUpdate = !0, this.char.mv3d_blenders || (this.char.mv3d_blenders = {}), this.shadow = characters_Sprite.Meshes.SHADOW.clone(), this.shadow.parent = this, this.blendElevation = this.makeBlender("elevation", 0), this.lightOrigin = new s.v("light origin", a.a.scene), this.lightOrigin.parent = this, this.setupLights(), this.isEvent ? this.eventConfigure() : (this.initialConfigure(), this.configureTexture())
  4116.         }
  4117.         isTextureReady()
  4118.         {
  4119.             return Boolean(this.texture && this.texture.isReady())
  4120.         }
  4121.         setTileMaterial()
  4122.         {
  4123.             const t = a.a.getSetNumber(this._tileId),
  4124.                 e = $gameMap.tileset().tilesetNames[t];
  4125.             if (e)
  4126.             {
  4127.                 const t = `img/tilesets/${e}.png`;
  4128.                 this.setMaterial(t)
  4129.             }
  4130.             else this.setMaterial("MV3D/errorTexture.png")
  4131.         }
  4132.         onTextureLoaded()
  4133.         {
  4134.             super.onTextureLoaded(), this.updateFrame(), this.updateScale(), this.configureTexture()
  4135.         }
  4136.         updateCharacter()
  4137.         {
  4138.             this._tilesetId = $gameMap.tilesetId(), this._tileId = this._character.tileId(), this._characterName = this._character.characterName(), this._characterIndex = this._character.characterIndex(), this._isBigCharacter = ImageManager.isBigCharacter(this._characterName), this._tileId > 0 ? this.setTileMaterial(this._tileId) : this._characterName ? this.setMaterial(`img/characters/${this._characterName}.png`) : (this.setEnabled(!1), this.spriteWidth = 1, this.spriteHeight = 0)
  4139.         }
  4140.         updateCharacterFrame()
  4141.         {
  4142.             if (this.px = this.characterPatternX(), this.py = this.characterPatternY(), !this.isTextureReady()) return;
  4143.             const t = this.patternWidth(),
  4144.                 e = this.patternHeight(),
  4145.                 i = (this.characterBlockX() + this.px) * t,
  4146.                 a = (this.characterBlockY() + this.py) * e;
  4147.             this.setFrame(i, a, t, e)
  4148.         }
  4149.         patternChanged()
  4150.         {
  4151.             return this.px !== this.characterPatternX() || this.py !== this.characterPatternY()
  4152.         }
  4153.         characterPatternY()
  4154.         {
  4155.             if (this.getConfig("dirfix", this.isEvent && this.char.isObjectCharacter())) return this.char.direction() / 2 - 1;
  4156.             return a.a.transformDirectionYaw(this.char.direction()) / 2 - 1
  4157.         }
  4158.         setFrame(t, e, i, a)
  4159.         {
  4160.             this.isTextureReady() && this.texture.crop(t, e, i, a)
  4161.         }
  4162.         updateScale()
  4163.         {
  4164.             if (!this.isTextureReady()) return;
  4165.             const t = this.getConfig("scale", new s.w(1, 1));
  4166.             this.spriteWidth = this.patternWidth() / Object(_.s)() * t.x, this.spriteHeight = this.patternHeight() / Object(_.s)() * t.y;
  4167.             const e = this.spriteWidth,
  4168.                 i = this.spriteHeight;
  4169.             this.mesh.scaling.set(e, i, i)
  4170.         }
  4171.         getDefaultConfigObject()
  4172.         {
  4173.             return this.isVehicle ? a.a[`${this.char._type.toUpperCase()}_SETTINGS`].conf : this.char.isTile() ? a.a.EVENT_TILE_SETTINGS : this.isEvent && this.char.isObjectCharacter() ? a.a.EVENT_OBJ_SETTINGS : a.a.EVENT_CHAR_SETTINGS
  4174.         }
  4175.         getConfig(t, e)
  4176.         {
  4177.             if (this.settings_event_page && t in this.settings_event_page) return this.settings_event_page[t];
  4178.             if (this.settings_event && t in this.settings_event) return this.settings_event[t];
  4179.             const i = this.getDefaultConfigObject();
  4180.             return t in i ? i[t] : e
  4181.         }
  4182.         hasConfig(t)
  4183.         {
  4184.             return this.settings_event_page && t in this.settings_event_page || this.settings_event && t in this.settings_event || t in this.getDefaultConfigObject()
  4185.         }
  4186.         eventConfigure()
  4187.         {
  4188.             if (!this.settings_event)
  4189.             {
  4190.                 this.settings_event = {};
  4191.                 const t = this.char.event().note;
  4192.                 a.a.readConfigurationFunctions(a.a.readConfigurationTags(t), a.a.eventConfigurationFunctions, this.settings_event), this.initialConfigure()
  4193.             }
  4194.             this.settings_event_page = {};
  4195.             const t = this.char.page();
  4196.             if (!t) return;
  4197.             let e = "";
  4198.             for (const i of t.list) 108 !== i.code && 408 !== i.code || (e += i.parameters[0]);
  4199.             a.a.readConfigurationFunctions(a.a.readConfigurationTags(e), a.a.eventConfigurationFunctions, this.settings_event_page), this.updateScale(), this.updateShape(), this.char.mv3d_needsConfigure && (this.char.mv3d_needsConfigure = !1, this.needsPositionUpdate = !0, this.pageConfigure(), this.configureTexture())
  4200.         }
  4201.         initialConfigure()
  4202.         {
  4203.             this.configureHeight()
  4204.         }
  4205.         pageConfigure()
  4206.         {
  4207.             if ("pos" in this.settings_event_page)
  4208.             {
  4209.                 const t = this.char.event(),
  4210.                     e = this.settings_event_page.pos;
  4211.                 this.char.locate(Object(_.o)(t.x, e.x), Object(_.o)(t.y, e.y))
  4212.             }
  4213.             if (this.setupEventLights(), "lamp" in this.settings_event_page)
  4214.             {
  4215.                 const t = this.getConfig("lamp");
  4216.                 this.blendLampColor.setValue(t.color, .5), this.blendLampIntensity.setValue(t.intensity, .5), this.blendLampDistance.setValue(t.distance, .5)
  4217.             }
  4218.             if ("flashlight" in this.settings_event_page)
  4219.             {
  4220.                 const t = this.getConfig("flashlight");
  4221.                 this.blendFlashlightColor.setValue(t.color, .5), this.blendFlashlightIntensity.setValue(t.intensity, .5), this.blendFlashlightDistance.setValue(t.distance, .5), this.blendFlashlightAngle.setValue(t.angle, .5), this.blendFlashlightPitch.setValue(this.getConfig("flashlightPitch", 90), .25), this.flashlightTargetYaw = this.getConfig("flashlightYaw", "+0")
  4222.             }("height" in this.settings_event_page || this.isAbove !== (2 === this.char._priorityType)) && this.configureHeight()
  4223.         }
  4224.         configureTexture()
  4225.         {
  4226.             if (this.material)
  4227.             {
  4228.                 const t = this.getConfig("glow", 0);
  4229.                 this.material.emissiveColor.set(t, t, t)
  4230.             }
  4231.         }
  4232.         configureHeight()
  4233.         {
  4234.             this.isAbove = 2 === this.char._priorityType;
  4235.             let t = Math.max(0, this.getConfig("height", this.isAbove && !this.hasConfig("z") ? a.a.EVENT_HEIGHT : 0));
  4236.             this.blendElevation.setValue(t, 0), this.z = this.platformHeight + t
  4237.         }
  4238.         setupMesh()
  4239.         {
  4240.             this.mesh.mv3d_isSetup || (a.a.callFeatures("createCharMesh", this.mesh), this.mesh.parent = this.spriteOrigin, this.mesh.character = this, this.mesh.order = this.order, this.material && (this.mesh.material = this.material), this.mesh.mv3d_isSetup = !0), this.flashlight && (this.flashlight.excludedMeshes.splice(0, 1 / 0), this.flashlight.excludedMeshes.push(this.mesh))
  4241.         }
  4242.         setupEventLights()
  4243.         {
  4244.             const t = this.getConfig("flashlight"),
  4245.                 e = this.getConfig("lamp");
  4246.             t && !this.flashlight && this.setupFlashlight(), e && !this.lamp && this.setupLamp()
  4247.         }
  4248.         setupLights()
  4249.         {
  4250.             "flashlightColor" in this.char.mv3d_blenders && this.setupFlashlight(), "lampColor" in this.char.mv3d_blenders && this.setupLamp()
  4251.         }
  4252.         setupFlashlight()
  4253.         {
  4254.             if (this.flashlight) return;
  4255.             const t = this.getConfig("flashlight",
  4256.             {
  4257.                 color: 16777215,
  4258.                 intensity: 1,
  4259.                 distance: a.a.LIGHT_DIST,
  4260.                 angle: a.a.LIGHT_ANGLE
  4261.             });
  4262.             this.blendFlashlightColor = this.makeColorBlender("flashlightColor", t.color), this.blendFlashlightIntensity = this.makeBlender("flashlightIntensity", t.intensity), this.blendFlashlightDistance = this.makeBlender("flashlightDistance", t.distance), this.blendFlashlightAngle = this.makeBlender("flashlightAngle", t.angle), this.flashlight = new s.q("flashlight", s.x.Zero(), s.x.Zero(), Object(_.i)(this.blendFlashlightAngle.targetValue() + a.a.FLASHLIGHT_EXTRA_ANGLE), 0, a.a.scene), this.flashlight.renderPriority = 2, this.updateFlashlightExp(), this.flashlight.range = this.blendFlashlightDistance.targetValue(), this.flashlight.intensity = this.blendFlashlightIntensity.targetValue(), this.flashlight.diffuse.set(...this.blendFlashlightColor.targetComponents()), this.flashlight.direction.y = -1, this.flashlightOrigin = new s.v("flashlight origin", a.a.scene), this.flashlightOrigin.parent = this.lightOrigin, this.flashlight.parent = this.flashlightOrigin, this.blendFlashlightPitch = this.makeBlender("flashlightPitch", 70), this.blendFlashlightYaw = this.makeBlender("flashlightYaw", 0), this.blendFlashlightYaw.cycle = 360, this.flashlightTargetYaw = this.getConfig("flashlightYaw", "+0"), this.updateFlashlightDirection(), this.setupMesh()
  4263.         }
  4264.         updateFlashlightExp()
  4265.         {
  4266.             this.flashlight.exponent = 64800 * Math.pow(this.blendFlashlightAngle.targetValue(), -2)
  4267.         }
  4268.         setupLamp()
  4269.         {
  4270.             if (this.lamp) return;
  4271.             const t = this.getConfig("lamp",
  4272.             {
  4273.                 color: 16777215,
  4274.                 intensity: 1,
  4275.                 distance: a.a.LIGHT_DIST
  4276.             });
  4277.             this.blendLampColor = this.makeColorBlender("lampColor", t.color), this.blendLampIntensity = this.makeBlender("lampIntensity", t.intensity), this.blendLampDistance = this.makeBlender("lampDistance", t.distance), this.lamp = new s.o("lamp", s.x.Zero(), a.a.scene), this.lamp.renderPriority = 1, this.lamp.diffuse.set(...this.blendLampColor.targetComponents()), this.lamp.intensity = this.blendLampIntensity.targetValue(), this.lamp.range = this.blendLampDistance.targetValue(), this.lamp.parent = this.lightOrigin
  4278.         }
  4279.         updateFlashlightDirection()
  4280.         {
  4281.             this.flashlightOrigin.yaw = this.blendFlashlightYaw.currentValue(), this.flashlightOrigin.pitch = -this.blendFlashlightPitch.currentValue(), this.flashlightOrigin.position.set(0, 0, 0);
  4282.             let t = Math.tan(Object(_.i)(90 - this.blendFlashlightAngle.currentValue() - Math.max(90, this.blendFlashlightPitch.currentValue()) + 90)) * a.a.LIGHT_HEIGHT;
  4283.             t = Math.max(0, Math.min(1, t)), this.flashlight.range += t, this.flashlightOrigin.translate(_.c, t, s.h)
  4284.         }
  4285.         updateLights()
  4286.         {
  4287.             if (this.flashlight)
  4288.             {
  4289.                 const t = 180 + Object(_.o)(a.a.dirToYaw(this.char.direction()), this.flashlightTargetYaw);
  4290.                 t !== this.blendFlashlightYaw.targetValue() && this.blendFlashlightYaw.setValue(t, .25), this.blendFlashlightColor.update() | this.blendFlashlightIntensity.update() | this.blendFlashlightDistance.update() | this.blendFlashlightAngle.update() | this.blendFlashlightYaw.update() | this.blendFlashlightPitch.update() && (this.flashlight.diffuse.set(...this.blendFlashlightColor.currentComponents()), this.flashlight.intensity = this.blendFlashlightIntensity.currentValue(), this.flashlight.range = this.blendFlashlightDistance.currentValue(), this.flashlight.angle = Object(_.i)(this.blendFlashlightAngle.currentValue() + a.a.FLASHLIGHT_EXTRA_ANGLE), this.updateFlashlightExp(), this.updateFlashlightDirection())
  4291.             }
  4292.             this.lamp && this.blendLampColor.update() | this.blendLampIntensity.update() | this.blendLampDistance.update() && (this.lamp.diffuse.set(...this.blendLampColor.currentComponents()), this.lamp.intensity = this.blendLampIntensity.currentValue(), this.lamp.range = this.blendLampDistance.currentValue())
  4293.         }
  4294.         makeBlender(t, e, i = blenders_Blender)
  4295.         {
  4296.             t in this.char.mv3d_blenders ? e = this.char.mv3d_blenders[t] : this.char.mv3d_blenders[t] = e;
  4297.             const a = new i(t, e);
  4298.             return a.storageLocation = () => this.char.mv3d_blenders, a
  4299.         }
  4300.         makeColorBlender(t, e)
  4301.         {
  4302.             return this.makeBlender(t, e, ColorBlender)
  4303.         }
  4304.         hasBush()
  4305.         {
  4306.             return !this.platformChar && (this.getConfig("bush", !(this.char.isTile() || this.isVehicle || this.isEvent && this.char.isObjectCharacter())) && !(this.blendElevation.currentValue() || this.falling))
  4307.         }
  4308.         getShape()
  4309.         {
  4310.             return this.getConfig("shape", a.a.configurationShapes.SPRITE)
  4311.         }
  4312.         updateShape()
  4313.         {
  4314.             const t = this.getShape();
  4315.             if (this.shape === t) return;
  4316.             this.shape = t;
  4317.             let e = characters_Sprite.Meshes.SPRITE;
  4318.             const i = a.a.configurationShapes;
  4319.             switch (this.shape)
  4320.             {
  4321.             case i.FLAT:
  4322.                 e = characters_Sprite.Meshes.FLAT;
  4323.                 break;
  4324.             case i.XCROSS:
  4325.             case i.CROSS:
  4326.                 e = characters_Sprite.Meshes.CROSS;
  4327.                 break;
  4328.             case i.WALL:
  4329.             case i.FENCE:
  4330.             }
  4331.             a.a.callFeatures("destroyCharMesh", this.mesh), this.mesh.dispose(), this.mesh = e.clone(), this.setupMesh(), this.spriteOrigin.rotation.set(0, 0, 0)
  4332.         }
  4333.         update()
  4334.         {
  4335.             this.needsPositionUpdate = !1, this.char._erased && this.dispose(), this.visible = this.char.mv_sprite.visible, "function" == typeof this.char.isVisible && (this.visible = this.visible && this.char.isVisible()), this.disabled = !this.visible, (this.char.isTransparent() || !this._characterName && !this._tileId) && (this.visible = !1), this._isEnabled ? this.visible || this.setEnabled(!1) : this.visible && (this.setEnabled(!0), this.needsPositionUpdate = !0), this.isImageChanged() && (this.updateCharacter(), this.needsPositionUpdate = !0), this.patternChanged() && this.updateFrame(), this.blendElevation.update() ? this.needsPositionUpdate = !0 : (this.x !== this.char._realX || this.y !== this.char._realY || this.falling || this.prevZ !== this.z || this.platformChar && this.platformChar.needsPositionUpdate || this.isPlayer || this.char === $gamePlayer.vehicle()) && (this.needsPositionUpdate = !0, this.prevZ = this.z), this.material ? this.updateNormal() : this.updateEmpty(), this.updateAnimations()
  4336.         }
  4337.         updateNormal()
  4338.         {
  4339.             const t = a.a.configurationShapes;
  4340.             this.shape === t.SPRITE ? (this.mesh.pitch = a.a.blendCameraPitch.currentValue() - 90, this.mesh.yaw = a.a.blendCameraYaw.currentValue()) : this.shape === t.TREE ? (this.spriteOrigin.pitch = this.getConfig("pitch", 0), this.mesh.yaw = a.a.blendCameraYaw.currentValue()) : (this.mesh.yaw = this.getConfig("rot", 0), this.spriteOrigin.pitch = this.getConfig("pitch", 0), this.spriteOrigin.yaw = this.getConfig("yaw", 0), this.shape === t.XCROSS && (this.mesh.yaw += 45)), this.char === $gamePlayer && (this.mesh.visibility = +!a.a.is1stPerson(!0)), this.updateAlpha(), this.updatePosition(), this.updateElevation(), this.shadow && this.updateShadow(), this.updateLights()
  4341.         }
  4342.         updateEmpty()
  4343.         {
  4344.             this.updatePosition(), this.updateElevation(), this.updateLights()
  4345.         }
  4346.         updateAlpha()
  4347.         {
  4348.             let t = this.hasConfig("alpha") || this.char.opacity() < 255;
  4349.             this.bush = Boolean(this.char.bushDepth()), this.bush && this.hasBush() ? (t = !0, this.material.opacityTexture || (this.material.opacityTexture = a.a.getBushAlphaTexture(), this.material.useAlphaFromDiffuseTexture = !0)) : this.material.opacityTexture && (this.material.opacityTexture = null, this.material.useAlphaFromDiffuseTexture = !1), t ? (this.material.useAlphaFromDiffuseTexture = !0, this.material.alpha = this.getConfig("alpha", 1) * this.char.opacity() / 255) : (this.material.useAlphaFromDiffuseTexture = !1, this.material.alpha = 1)
  4350.         }
  4351.         updatePositionOffsets()
  4352.         {
  4353.             this.spriteOrigin.position.set(0, 0, 0), this.lightOrigin.position.set(0, 0, 0), this.shape === a.a.configurationShapes.FLAT ? this.spriteOrigin.z = 4 * a.a.LAYER_DIST : this.shape === a.a.configurationShapes.SPRITE ? this.spriteOrigin.z = 4 * a.a.LAYER_DIST * (1 - Math.max(0, Math.min(90, a.a.blendCameraPitch.currentValue())) / 90) : this.spriteOrigin.z = 0, this.lightOrigin.z = this.getConfig("lightHeight", a.a.LIGHT_HEIGHT);
  4354.             const t = new s.w(Math.sin(-a.a.cameraNode.rotation.y), Math.cos(a.a.cameraNode.rotation.y)).multiplyByFloats(a.a.SPRITE_OFFSET, a.a.SPRITE_OFFSET),
  4355.                 e = this.getConfig("lightOffset", null);
  4356.             this.shape === a.a.configurationShapes.SPRITE ? (this.spriteOrigin.x = t.x, this.spriteOrigin.y = t.y, this.lightOrigin.x = t.x, this.lightOrigin.y = t.y) : e || (this.lightOrigin.x = t.x / 2, this.lightOrigin.y = t.y / 2), e && (this.lightOrigin.x += e.x, this.lightOrigin.y += e.y), this.spriteOrigin.x += this.getConfig("x", 0), this.spriteOrigin.y += this.getConfig("y", 0);
  4357.             const i = this.getConfig("height", 0);
  4358.             i < 0 && (this.spriteOrigin.z += i)
  4359.         }
  4360.         updatePosition()
  4361.         {
  4362.             if (this.updatePositionOffsets(), !this.needsPositionUpdate) return;
  4363.             const t = a.a.loopCoords(this.char._realX, this.char._realY);
  4364.             this.x = t.x, this.y = t.y
  4365.         }
  4366.         updateElevation()
  4367.         {
  4368.             if (!this.needsPositionUpdate) return;
  4369.             if (this.falling = !1, this.isPlayer)
  4370.             {
  4371.                 const t = this.char.vehicle();
  4372.                 if (t && (this.z = t.z, this.targetElevation = t.targetElevation, this.platformChar = t.platformChar, this.platformHeight = t.platformHeight, t._driving)) return
  4373.             }
  4374.             if (this.hasConfig("z")) return this.z = this.getConfig("z", 0), void(this.z += this.blendElevation.currentValue());
  4375.             const t = a.a.getPlatformForCharacter(this, this.char._realX, this.char._realY);
  4376.             this.platformHeight = t.z2, this.platformChar = t.char, this.targetElevation = this.platformHeight + this.blendElevation.currentValue();
  4377.             let e = this.getConfig("gravity", a.a.GRAVITY) / 60;
  4378.             if (this.hasFloat = this.isVehicle || (this.isPlayer || this.isFollower) && $gamePlayer.vehicle(), this.hasFloat && !this.platformChar && (this.targetElevation += a.a.getFloatHeight(Math.round(this.char._realX), Math.round(this.char._realY), this.z + this.spriteHeight)), this.isAirship && $gamePlayer.vehicle() === this.char && (this.targetElevation += a.a.loadData("airship_height", a.a.AIRSHIP_SETTINGS.height) * this.char._altitude / this.char.maxAltitude()), this.char.isJumping())
  4379.             {
  4380.                 let t = 1 - this.char._jumpCount / (2 * this.char._jumpPeak),
  4381.                     e = -4 * Math.pow(t - .5, 2) + 1,
  4382.                     i = Math.abs(this.char.mv3d_jumpHeightEnd - this.char.mv3d_jumpHeightStart);
  4383.                 this.z = this.char.mv3d_jumpHeightStart * (1 - t) + this.char.mv3d_jumpHeightEnd * t + e * i / 2 + this.char.jumpHeight() / Object(_.s)()
  4384.             }
  4385.             else if (e)
  4386.             {
  4387.                 const t = Math.abs(this.targetElevation - this.z);
  4388.                 t < e && (e = t), this.z < this.platformHeight && (this.z = this.platformHeight), this.z > this.targetElevation ? (this.z -= e, a.a.tileCollision(this, this.char._realX, this.char._realY, !1, !1) && (this.z = this.platformHeight)) : this.z < this.targetElevation && (this.z += e, a.a.tileCollision(this, this.char._realX, this.char._realY, !1, !1) && (this.z -= e)), this.falling = this.z > this.targetElevation
  4389.             }
  4390.         }
  4391.         updateShadow()
  4392.         {
  4393.             let t = Boolean(this.getConfig("shadow", this.shape != a.a.configurationShapes.FLAT));
  4394.             if (t && (this.isPlayer || this.isFollower))
  4395.             {
  4396.                 const e = a.a.characters.indexOf(this);
  4397.                 if (e >= 0)
  4398.                     for (let i = e + 1; i < a.a.characters.length; ++i)
  4399.                     {
  4400.                         const e = a.a.characters[i];
  4401.                         if (e.shadow && e.visible && (e.char._realX === this.char._realX && e.char._realY === this.char._realY))
  4402.                         {
  4403.                             t = !1;
  4404.                             break
  4405.                         }
  4406.                     }
  4407.             }
  4408.             if (this.shadow._isEnabled ? t || this.shadow.setEnabled(!1) : t && this.shadow.setEnabled(!0), !t) return;
  4409.             const e = Math.min(0, this.getConfig("height", 0)),
  4410.                 i = Math.max(this.z - this.platformHeight, e),
  4411.                 s = this.getConfig("shadowDist", 4),
  4412.                 r = Math.max(0, 1 - Math.abs(i) / s);
  4413.             this.shadow.z = -i + 3.5 * a.a.LAYER_DIST, this.shadow.x = this.spriteOrigin.x, this.shadow.y = this.spriteOrigin.y;
  4414.             const n = this.getConfig("shadow", 1);
  4415.             this.shadow.scaling.setAll(n * r), this.shadow.isAnInstance || (this.shadow.visibility = r - .5 * this.bush)
  4416.         }
  4417.         updateAnimations()
  4418.         {
  4419.             this.char.isBalloonPlaying() ? (this._balloon || (this._balloon = a.a.showBalloon(this)), this._balloon.update()) : this._balloon && (this._balloon.dispose(), this._balloon = null)
  4420.         }
  4421.         dispose(...t)
  4422.         {
  4423.             super.dispose(...t), delete this.char.mv3d_sprite;
  4424.             const e = a.a.characters.indexOf(this);
  4425.             a.a.characters.splice(e, 1)
  4426.         }
  4427.         getCHeight()
  4428.         {
  4429.             let t = this.getConfig("collide", this.shape === a.a.configurationShapes.FLAT || 0 === this.char._priorityType ? 0 : this.spriteHeight);
  4430.             return !0 === t ? this.spriteHeight : Number(t)
  4431.         }
  4432.         getCollisionHeight(t = this.z)
  4433.         {
  4434.             if (this.hasConfig("height"))
  4435.             {
  4436.                 const e = this.getConfig("height");
  4437.                 e < 0 && (t += e)
  4438.             }
  4439.             return {
  4440.                 z1: t,
  4441.                 z2: t + this.getCHeight(),
  4442.                 char: this
  4443.             }
  4444.         }
  4445.         getTriggerHeight(t = this.z)
  4446.         {
  4447.             const e = this.getConfig("trigger");
  4448.             return e ?
  4449.             {
  4450.                 z1: t - e.down,
  4451.                 z2: t + e.up
  4452.             } : this.getCollisionHeight()
  4453.         }
  4454.     }
  4455.     for (const t of ["characterBlockX", "characterBlockY", "characterPatternX", "isImageChanged", "patternWidth", "patternHeight", "updateTileFrame", "updateFrame"]) characters_Character.prototype[t] = Sprite_Character.prototype[t];
  4456.     a.a.Sprite = characters_Sprite, a.a.Character = characters_Character;
  4457.     const x = Game_CharacterBase.prototype.isOnBush;
  4458.     Game_CharacterBase.prototype.isOnBush = function ()
  4459.     {
  4460.         if (a.a.isDisabled() || !this.mv3d_sprite) return x.apply(this, arguments);
  4461.         const t = Math.round(this._realX),
  4462.             e = Math.round(this._realY),
  4463.             i = a.a.getTileData(t, e),
  4464.             s = a.a.getTileLayers(t, e, this.mv3d_sprite.z + this.mv3d_sprite.getCHeight()),
  4465.             r = $gameMap.tilesetFlags();
  4466.         for (const t of s)
  4467.             if (0 != (64 & r[i[t]])) return !0;
  4468.         return !1
  4469.     }, Object.assign(a.a,
  4470.     {
  4471.         showAnimation(t)
  4472.         {
  4473.             t || (t = $gamePlayer.mv3d_sprite)
  4474.         },
  4475.         showBalloon: t => (t || (t = $gamePlayer.mv3d_sprite), new animations_Balloon(t))
  4476.     });
  4477.     class animations_Balloon extends s.r
  4478.     {
  4479.         constructor(t)
  4480.         {
  4481.             super("balloon", animations_Balloon.Manager()), animations_Balloon.list.push(this), this.char = t
  4482.         }
  4483.         update()
  4484.         {
  4485.             if (!this.char) return;
  4486.             const t = s.x.TransformCoordinates(new s.x(0, 1 + .5 / this.char.mesh.scaling.y, 0), this.char.mesh.getWorldMatrix());
  4487.             this.position.copyFrom(t);
  4488.             const e = this.char.char.mv_sprite._balloonSprite;
  4489.             e && (this.cellIndex = 8 * (e._balloonId - 1) + Math.max(0, e.frameIndex()))
  4490.         }
  4491.         dispose()
  4492.         {
  4493.             super.dispose();
  4494.             const t = animations_Balloon.list.indexOf(this);
  4495.             t >= 0 && animations_Balloon.list.splice(t, 1), this._manager.markedForDisposal && !this._manager.sprites.length && this._manager.dispose()
  4496.         }
  4497.     }
  4498.     animations_Balloon.list = [], animations_Balloon.Manager = function ()
  4499.     {
  4500.         return (!animations_Balloon.manager || animations_Balloon.manager.mapId != $gameMap.mapId() || animations_Balloon.manager._capacity < $gameMap.events().length) && (animations_Balloon.manager && (animations_Balloon.manager.sprites.length ? animations_Balloon.manager.markedForDisposal = !0 : animations_Balloon.manager.dispose()), animations_Balloon.manager = new s.s("balloonManager", "img/system/Balloon.png", $gameMap.events().length, 48, a.a.scene), animations_Balloon.manager.texture.onLoadObservable.addOnce(() =>
  4501.         {
  4502.             animations_Balloon.manager.texture.updateSamplingMode(1)
  4503.         }), animations_Balloon.manager.mapId = $gameMap.mapId()), animations_Balloon.manager
  4504.     };
  4505.     const P = Sprite_Character.prototype.startAnimation;
  4506.     Sprite_Character.prototype.startAnimation = function ()
  4507.     {
  4508.         if (P.apply(this, arguments), a.a.mapDisabled || !(SceneManager._scene instanceof Scene_Map)) return;
  4509.         const t = this._animationSprites[this._animationSprites.length - 1];
  4510.         a.a.pixiSprite.addChild(t)
  4511.     };
  4512.     const F = Sprite_Animation.prototype.updateScreenFlash;
  4513.     Sprite_Animation.prototype.updateScreenFlash = function ()
  4514.     {
  4515.         F.apply(this, arguments), !a.a.mapDisabled && SceneManager._scene instanceof Scene_Map && (this._screenFlashSprite.x = 0, this._screenFlashSprite.y = 0)
  4516.     };
  4517.     const N = Sprite_Character.prototype.updateAnimationSprites;
  4518.     Sprite_Character.prototype.updateAnimationSprites = function ()
  4519.     {
  4520.         if (N.apply(this, arguments), !a.a.mapDisabled && this._animationSprites.length && SceneManager._scene instanceof Scene_Map && this._character.mv3d_sprite)
  4521.             for (const t of this._animationSprites)
  4522.             {
  4523.                 const e = t._animation.position,
  4524.                     i = new s.x(0, 3 == e ? 0 : 1 === e ? .5 : 0 === e ? 1 : 0, 0),
  4525.                     r = s.x.TransformCoordinates(i, this._character.mv3d_sprite.mesh.getWorldMatrix()),
  4526.                     n = a.a.getScreenPosition(r),
  4527.                     o = s.x.Distance(a.a.camera.globalPosition, r),
  4528.                     h = a.a.camera.mode === s.l ? a.a.getScaleForDist() : a.a.getScaleForDist(o);
  4529.                 t.behindCamera = n.behindCamera, t.update(), t.x = n.x, t.y = n.y, t.scale.set(h, h)
  4530.             }
  4531.     };
  4532.     const H = Sprite_Animation.prototype.updateCellSprite;
  4533.     Sprite_Animation.prototype.updateCellSprite = function (t, e)
  4534.     {
  4535.         H.apply(this, arguments), this.behindCamera && (t.visible = !1)
  4536.     };
  4537.     const R = Game_Map.prototype.parallaxOx;
  4538.     Game_Map.prototype.parallaxOx = function ()
  4539.     {
  4540.         let t = R.apply(this, arguments);
  4541.         return a.a.mapDisabled ? t : this._parallaxLoopX ? t - 816 * a.a.blendCameraYaw.currentValue() / 90 : t
  4542.     };
  4543.     const B = Game_Map.prototype.parallaxOy;
  4544.     Game_Map.prototype.parallaxOy = function ()
  4545.     {
  4546.         let t = B.apply(this, arguments);
  4547.         return a.a.mapDisabled ? t : this._parallaxLoopY ? t - 816 * a.a.blendCameraPitch.currentValue() / 90 : t
  4548.     }, ["setDisplayPos", "scrollUp", "scrollDown", "scrollLeft", "scrollRight"].forEach(t =>
  4549.     {
  4550.         const e = Game_Map.prototype[t];
  4551.         Game_Map.prototype[t] = function ()
  4552.         {
  4553.             a.a.isDisabled() && e.apply(this, arguments)
  4554.         }
  4555.     });
  4556.     const V = Game_Map.prototype.updateScroll;
  4557.     Game_Map.prototype.updateScroll = function ()
  4558.     {
  4559.         if (a.a.mapDisabled) return V.apply(this, arguments);
  4560.         this._displayX = 816 * -a.a.blendCameraYaw.currentValue() / 3600, this._displayY = 816 * -a.a.blendCameraPitch.currentValue() / 3600
  4561.     }, Game_CharacterBase.prototype.isNearTheScreen = function ()
  4562.     {
  4563.         return Math.abs(this.x - a.a.cameraStick.x) <= a.a.RENDER_DIST && Math.abs(this.y - a.a.cameraStick.y) <= a.a.RENDER_DIST
  4564.     }, Object(_.m)(Game_Screen.prototype, "shake", t => (function ()
  4565.     {
  4566.         return 0
  4567.     }));
  4568.     const G = Utils.isOptionValid("test"),
  4569.         j = async (t, e) =>
  4570.         {
  4571.             const a = i(3),
  4572.                 s = i(4),
  4573.                 r = s.resolve(global.__dirname, t);
  4574.             await $(s.dirname(r)), await new Promise((t, i) =>
  4575.             {
  4576.                 a.writeFile(r, e, e =>
  4577.                 {
  4578.                     e ? i(e) : t()
  4579.                 })
  4580.             })
  4581.         }, $ = t => new Promise((e, a) =>
  4582.         {
  4583.             const s = i(3),
  4584.                 r = i(4);
  4585.             s.mkdir(r.resolve(global.__dirname, t),
  4586.             {
  4587.                 recursive: !0
  4588.             }, t =>
  4589.             {
  4590.                 t && "EEXIST" !== t.code ? a(t) : e()
  4591.             })
  4592.         }), z = DataManager.loadDataFile;
  4593.     DataManager.loadDataFile = function (t, e)
  4594.     {
  4595.         e.startsWith("Test_mv3d_") && (e = e.replace("Test_mv3d_", "mv3d_")), z.call(this, t, e)
  4596.     };
  4597.     class DataProxy
  4598.     {
  4599.         constructor(t, e, a = {})
  4600.         {
  4601.             if (this.varName = t, this.fileName = e, G)
  4602.             {
  4603.                 const t = i(3),
  4604.                     s = i(4).resolve(nw.__dirname, "data", e);
  4605.                 t.existsSync(s) || t.writeFileSync(s, JSON.stringify("function" == typeof a ? a() : a))
  4606.             }
  4607.             DataManager._databaseFiles.push(
  4608.             {
  4609.                 name: t,
  4610.                 src: e
  4611.             }), this._dirty = !1, this._data_handler = {
  4612.                 get: (t, e) => t[e] && "object" == typeof t[e] ? new Proxy(t[e], data_handler) : t[e],
  4613.                 set: (t, e, i) =>
  4614.                 {
  4615.                     this._dirty = !0, t[e] = i
  4616.                 },
  4617.                 deleteProperty: (t, e) =>
  4618.                 {
  4619.                     this._dirty = !0, delete t[e]
  4620.                 }
  4621.             }, this.writing = !1, DataProxy.list.push(this)
  4622.         }
  4623.         setup()
  4624.         {
  4625.             this._data = window[this.varName], G && (window[this.varName] = new Proxy(this._data, this._data_handler))
  4626.         }
  4627.         async update()
  4628.         {
  4629.             G && this._dirty && !this.writing && (this.writing = !0, this._dirty = !1, await j(`data/${this.fileName}`, JSON.stringify(this._data)), this.writing = !1)
  4630.         }
  4631.     }
  4632.     DataProxy.list = [], a.a.DataProxy = DataProxy;
  4633.     const Y = Scene_Boot.prototype.start;
  4634.     Scene_Boot.prototype.start = function ()
  4635.     {
  4636.         Y.apply(this, arguments), a.a.setupData()
  4637.     }, Object.assign(a.a,
  4638.     {
  4639.         setupData()
  4640.         {
  4641.             for (const t of DataProxy.list) t.setup()
  4642.         },
  4643.         updateData()
  4644.         {
  4645.             for (const t of DataProxy.list) t.update()
  4646.         }
  4647.     }), new DataProxy("mv3d_data", "mv3d_data.json", () => (
  4648.     {
  4649.         id: crypto.getRandomValues(new Uint32Array(1))[0]
  4650.     })), a.a.features = {}, a.a.callFeature = function (t, e, ...i)
  4651.     {
  4652.         if (!this.featureEnabled(t)) return;
  4653.         const a = this.features[t];
  4654.         e in a.methods && a.methods[e](...i)
  4655.     }, a.a.callFeatures = function (t, ...e)
  4656.     {
  4657.         for (const i in this.features) this.callFeature(i, t, ...e)
  4658.     }, a.a.featureEnabled = function (t)
  4659.     {
  4660.         return t in this.features && !!this.features[t].enabled()
  4661.     };
  4662.     a.a.Feature = class features_Feature
  4663.     {
  4664.         constructor(t, e, i = !0)
  4665.         {
  4666.             Object.assign(this,
  4667.             {
  4668.                 name: t,
  4669.                 condition: i,
  4670.                 methods: e
  4671.             }), a.a.features[t] = this
  4672.         }
  4673.         enabled()
  4674.         {
  4675.             return "function" == typeof this.condition ? this.condition() : Boolean(this.condition)
  4676.         }
  4677.     };
  4678.     i(5)
  4679. }]);
  4680. //# sourceMappingURL=mv3d-babylon.js.map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement