1 ///////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2004-2011 by The Allacrost Project 3 // Copyright (C) 2012-2016 by Bertram (Valyria Tear) 4 // All Rights Reserved 5 // 6 // This code is licensed under the GNU GPL version 2. It is free software 7 // and you may modify it and/or redistribute it under the terms of this license. 8 // See https://www.gnu.org/copyleft/gpl.html for details. 9 /////////////////////////////////////////////////////////////////////////////// 10 11 /** **************************************************************************** 12 *** \file map_mode.h 13 *** \author Tyler Olsen, roots@allacrost.org 14 *** \author Yohann Ferreira, yohann ferreira orange fr 15 *** \brief Header file for map mode interface. 16 *** 17 *** This file contains the interface for map mode, active when the player is 18 *** exploring town or dungeon maps. The map environments are 19 *** quite extensive, thus this code is responsible for processing many things. 20 *** This includes handling all tile images, objects, sprites, map events, 21 *** dialogue, and more. 22 *** 23 *** Each individual map is represented by it's own object of the MapMode class. 24 *** It is our intention in the future to retain more than one map in memory at 25 *** once to reduce or eliminate loading times when the player transitions 26 *** between maps. 27 *** ***************************************************************************/ 28 29 #ifndef __MAP_HEADER__ 30 #define __MAP_HEADER__ 31 32 #include "engine/mode_manager.h" 33 #include "engine/system.h" 34 35 #include "map_utils.h" 36 #include "map_minimap.h" 37 #include "map_status_effects.h" 38 39 #include "engine/audio/audio_descriptor.h" 40 41 namespace vt_defs { 42 void BindModeCode(); 43 } 44 45 namespace vt_global { 46 class GlobalEnemy; 47 class GlobalObject; 48 } 49 50 //! All calls to map mode are wrapped in this namespace. 51 namespace vt_map 52 { 53 54 //! The stamina maximum value. 55 const uint32_t STAMINA_FULL = 10000; 56 57 //! An internal namespace to be used only within the map code. Don't use this namespace anywhere else! 58 namespace private_map 59 { 60 class MapDialogueSupervisor; 61 class EventSupervisor; 62 class Light; 63 class MapObject; 64 class MapSprite; 65 class EnemySprite; 66 class MapZone; 67 class Minimap; 68 class ObjectSupervisor; 69 class PhysicalObject; 70 class SoundObject; 71 class TileSupervisor; 72 class TreasureObject; 73 class TreasureSupervisor; 74 class EscapeSupervisor; 75 struct MapLocation; 76 } // namespace private_map 77 78 /** **************************************************************************** 79 *** \brief Handles the game execution while the player is exploring maps. 80 *** 81 *** This class contains all of the structures that together compose each map. 82 *** Each map has a Lua script file in which the map data is permanently retained 83 *** and various script subroutines exist that modify the map's behavior. Keep in 84 *** mind that this class alone does not represent all of the data nor all of the 85 *** code that is used in a particular map, as the map's Lua file likely retains 86 *** additional information about the map that is not represented in this class. 87 *** 88 *** Maps are composed by a series of tiles and objects. Tiles are 32x32 pixel 89 *** squares that are adjacent to one another on a map, and together make up the 90 *** map's background environment. Objects are variable sized entities that are 91 *** usually living, animated creatures (sprites), but may be something static 92 *** such as a large tree. Tiles and objects are drawn in multiple interwieving 93 *** layers to emulate a 3D environment for the game. Additionally each map has 94 *** a collision grid composed of 16x16 pixel elements that determine which 95 *** quadrants of each tile may be occupied by sprites or other objects. 96 *** 97 *** Another important concept to MapMode is that of contexts. Each map has at 98 *** least one context and can have up to a maximum of 32 contexts. Every context 99 *** has its own collision grid and its own set of tiles. Map objects and sprites 100 *** exist in one of these context and may change their context at any time. 101 *** Objects and sprites can not interact with one another when they are not 102 *** within the same context, and typically only objects that are in the same 103 *** context as the map camera are visible on the screen. You can think of each 104 *** context as essentially its own map, and the set of contexts as a set of maps 105 *** that work with one another to create a cohesive environment. 106 *** 107 *** Because this game mode is so complex, the MapMode class shares its 108 *** responsibilities with several small singleton classes that manage a 109 *** particular area of map code, such as tiles or objects. These sub-manager 110 *** classes should be viewed as extensions of the MapMode class. 111 *** ***************************************************************************/ 112 class MapMode : public vt_mode_manager::GameMode 113 { 114 friend void vt_defs::BindModeCode(); 115 116 public: 117 //! \param data_filename The name of the Lua file that retains all data about the map to create 118 //! \param script_filename The name of the Lua file that retains all data about script to load 119 //! \param stamina The amount of stamina the map character sprite will start with. 120 //! \param permit_autosave Whether an autosave can happen at map load time. 121 //! \note the last parameter is usually set to carry the current stamina value from one map to another. 122 MapMode(const std::string &data_filename, const std::string& script_filename, 123 uint32_t stamina = STAMINA_FULL, bool permit_autosave = true); 124 125 ~MapMode(); 126 127 //! \brief Resets appropriate class members. Called whenever the MapMode object is made the active game mode. 128 void Reset(); 129 130 //! \brief Called when a map mode is deactivated. 131 //! Note that this is called twice when doing a battle transition. 132 void Deactivate(); 133 134 //! \brief Updates the game and calls various sub-update functions depending on the current state of map mode. 135 void Update(); 136 137 //! \brief The highest level draw function that will call the appropriate lower-level draw functions 138 void Draw(); 139 140 //! \brief The highest level draw function for stuff unaffected by light and fade effects. 141 void DrawPostEffects(); 142 143 // The methods below this line are not intended to be used outside of the map code 144 145 //! \brief Empties the state stack and places an invalid state on top 146 void ResetState(); 147 148 /** \brief Pushes a state type to the top of the state stack, making it the active state 149 *** \param state The state to push onto the stack 150 **/ 151 void PushState(private_map::MAP_STATE state); 152 153 //! \brief Removes the highest item in the state stack 154 void PopState(); 155 156 /** \brief Retrieves the current map state 157 *** \return The top-most item on the map state stack 158 **/ 159 private_map::MAP_STATE CurrentState(); 160 161 //! \brief Removes an object from memory 162 void DeleteMapObject(private_map::MapObject* obj); 163 164 //! \brief Vectors containing the save points animations (when the character is in or not). 165 std::vector<vt_video::AnimatedImage> active_save_point_animations; 166 std::vector<vt_video::AnimatedImage> inactive_save_point_animations; 167 168 //! \brief Vectors containing the escape points animations (when the character is in or not). 169 vt_video::AnimatedImage active_escape_point_anim; 170 vt_video::AnimatedImage inactive_escape_point_anim; 171 172 //! \brief Class member accessor functions 173 //@{ CurrentInstance()174 static MapMode *CurrentInstance() { 175 return _current_instance; 176 } 177 GetMapHudName()178 const vt_utils::ustring &GetMapHudName() const { 179 return _map_hud_name.GetString(); 180 } 181 GetStamina()182 uint32_t GetStamina() const { 183 return _run_stamina; 184 } 185 SetStamina(uint32_t new_stamina)186 void SetStamina(uint32_t new_stamina) { 187 _run_stamina = new_stamina; 188 } 189 IsStaminaUnlimited()190 bool IsStaminaUnlimited() const { 191 return _unlimited_stamina; 192 } 193 SetUnlimitedStamina(bool unlimited)194 void SetUnlimitedStamina(bool unlimited) { 195 _unlimited_stamina = unlimited; 196 } 197 IsRunningEnabled()198 bool IsRunningEnabled() const { 199 return _running_enabled; 200 } 201 SetRunningEnabled(bool enabled)202 void SetRunningEnabled(bool enabled) { 203 _running_enabled = enabled; 204 } 205 206 // Note: The map script is only valid while in loading the map file. 207 // The file is closed afterward to permit the save menu to open it, for instance. GetMapScript()208 vt_script::ReadScriptDescriptor &GetMapScript() { 209 return _map_script; 210 } 211 212 /** \brief Opens the map tablespace of the map script 213 *** \param use_global Has the same effect as in ReadScriptDescriptor#OpenTable 214 *** \returns whether the tablespace opening was successful. 215 **/ 216 bool OpenMapTablespace(bool use_global = false) { 217 return _map_script.OpenTable(_map_script_tablespace, use_global); 218 } 219 GetMapScriptFilename()220 const std::string& GetMapScriptFilename() const { 221 return _map_script_filename; 222 } 223 GetTileSupervisor()224 private_map::TileSupervisor* GetTileSupervisor() const { 225 return _tile_supervisor; 226 } 227 GetObjectSupervisor()228 private_map::ObjectSupervisor* GetObjectSupervisor() const { 229 return _object_supervisor; 230 } 231 GetEventSupervisor()232 private_map::EventSupervisor* GetEventSupervisor() const { 233 return _event_supervisor; 234 } 235 GetDialogueSupervisor()236 private_map::MapDialogueSupervisor* GetDialogueSupervisor() const { 237 return _dialogue_supervisor; 238 } 239 GetTreasureSupervisor()240 private_map::TreasureSupervisor* GetTreasureSupervisor() const { 241 return _treasure_supervisor; 242 } 243 GetEscapeSupervisor()244 private_map::EscapeSupervisor* GetEscapeSupervisor() const { 245 return _escape_supervisor; 246 } 247 GetMapFrame()248 const private_map::MapFrame& GetMapFrame() const { 249 return _map_frame; 250 } 251 GetCamera()252 private_map::VirtualSprite* GetCamera() const { 253 return _camera; 254 } 255 SetCamera(private_map::VirtualSprite * sprite)256 void SetCamera(private_map::VirtualSprite* sprite) { 257 _camera = sprite; 258 } 259 260 void SetCamera(private_map::VirtualSprite* sprite, uint32_t duration); 261 262 void MoveVirtualFocus(float loc_x, float loc_y); 263 264 void MoveVirtualFocus(float loc_x, float loc_y, uint32_t duration); 265 266 bool IsCameraOnVirtualFocus(); 267 IsCameraMoving()268 bool IsCameraMoving() { 269 return _camera_timer.IsRunning(); 270 } 271 IsCameraXAxisInMapCorner()272 bool IsCameraXAxisInMapCorner() const { 273 return _camera_x_in_map_corner; 274 } 275 IsCameraYAxisInMapCorner()276 bool IsCameraYAxisInMapCorner() const { 277 return _camera_y_in_map_corner; 278 } 279 280 /** \brief Tells the object supervisor that the given sprite pointer 281 *** is the party member object. 282 *** This later permits to refresh the sprite shown based on the battle 283 *** formation front party member. 284 **/ 285 void SetPartyMemberVisibleSprite(private_map::MapSprite* sprite); 286 287 /** \brief Changes the state of every registered enemy sprite to 'dead' 288 *** Typically used just before a battle begins so that when the player returns to the map, they 289 *** are not swarmed by nearby enemies and quickly forced into another battle. This applies to enemies 290 *** on all object layers and in any context. Exercise caution when invoking this method. 291 **/ 292 void SetAllEnemyStatesToDead(); 293 294 //! \brief Returns the virtual focus sprite. GetVirtualFocus()295 private_map::VirtualSprite* GetVirtualFocus() { 296 return _virtual_focus; 297 } 298 IsShowGUI()299 bool IsShowGUI() const { 300 return _show_gui; 301 } 302 SetShowGUI(bool state)303 void SetShowGUI(bool state) { 304 _show_gui = state; 305 } 306 GetDialogueIcon()307 const vt_video::AnimatedImage &GetDialogueIcon() const { 308 return _dialogue_icon; 309 } 310 GetMapImage()311 const vt_video::StillImage &GetMapImage() const { 312 return _map_image; 313 } 314 315 //! \brief Tells whether a battle can start 316 bool AttackAllowed(); 317 318 //! \brief Applies a potential malus when the map stamina is low. 319 //! This is applied as an active status effect on stamina. 320 void ApplyPotentialStaminaMalus(); 321 322 //! \brief Returns in standard screen coordinates (1024x768), 323 //! the x position of a tile position on the X axis. 324 // NOTE: We round the value to a multiple of the current pixel size. 325 // See MapMode::_UpdateMapFrame() for a better explanation. 326 float GetScreenXCoordinate(float tile_position_x) const; 327 328 //! \brief Returns in standard screen coordinates (1024x768), 329 //! the x position of a tile position on the Y axis. 330 // NOTE: We round the value to a multiple of the current pixel size. 331 // See MapMode::_UpdateMapFrame() for a better explanation. 332 float GetScreenYCoordinate(float tile_position_y) const; 333 334 //! \brief Returns the tile offset x value, GetMapXOffset()335 float GetMapXOffset() const { 336 return _map_frame.screen_edges.left; 337 } 338 339 //! \brief Returns the tile offset y value, GetMapYOffset()340 float GetMapYOffset() const { 341 return _map_frame.screen_edges.top; 342 } 343 344 //! \brief Returns the map x size in tiles, 345 uint16_t GetMapWidth() const; 346 347 //! \brief Returns the map y size in tiles, 348 uint16_t GetMapHeight() const; 349 350 //! \brief Gives the current map pixel lengths. 351 //! Used to properly place sprites and avoid glitches. 352 //! \see _UpdateMapFrame() for a better explanation. GetMapPixelXLength()353 float GetMapPixelXLength() const { 354 return _pixel_length.x; 355 } 356 GetMapPixelYLength()357 float GetMapPixelYLength() const { 358 return _pixel_length.y; 359 } 360 361 //! \brief toggles visibility of the minimap 362 //! \param the new state of the minimap visibility ShowMinimap(bool visibility)363 void ShowMinimap(bool visibility) { 364 _show_minimap = visibility; 365 } 366 367 //! \brief Tells the system to load a custom minimap image. SetMinimapImage(const std::string & filename)368 void SetMinimapImage(const std::string& filename) { 369 _minimap_custom_image_file = filename; 370 // Force reloading the minimap at the end of map load time 371 if (_minimap) { 372 delete _minimap; 373 _minimap = nullptr; 374 } 375 376 // This also implies the minimap will be shown 377 ShowMinimap(true); 378 } 379 380 //! \brief A function telling the engine the minimap should be reloaded if visible. ReloadMinimap()381 void ReloadMinimap() { 382 if (_show_minimap && !_minimap) 383 _CreateMinimap(); 384 } 385 386 //! \brief Sets whether the menu mode is available from the map mode. SetMenuEnabled(bool enabled)387 void SetMenuEnabled(bool enabled) { 388 _menu_enabled = enabled; 389 } 390 391 //! \brief Tells whether the menu mode is available from the map mode. IsMenuEnabled()392 bool IsMenuEnabled() const { 393 return _menu_enabled; 394 } 395 396 //! \brief Sets whether the map points are enabled in the map mode. SetMapPointsEnabled(bool enabled)397 void SetMapPointsEnabled(bool enabled) { 398 _map_points_enabled = enabled; 399 } 400 401 //! \brief Tells whether the map points are enabled in the map mode. AreMapPointsEnabled()402 bool AreMapPointsEnabled() const { 403 return _map_points_enabled; 404 } 405 406 //! \brief Sets whether the auto-save is enabled. SetAutoSaveEnabled(bool enabled)407 void SetAutoSaveEnabled(bool enabled) { 408 _auto_save_enabled = enabled; 409 } 410 411 //! \brief Tells whether the auto-save is enabled. GetAutoSaveEnabled()412 bool GetAutoSaveEnabled() const { 413 return _auto_save_enabled; 414 } 415 416 //! \brief Sets whether the status effects can run in the map mode. SetStatusEffectsEnabled(bool enabled)417 void SetStatusEffectsEnabled(bool enabled) { 418 _status_effects_enabled = enabled; 419 } 420 421 //! \brief Tells whether the status effects can run in the map mode. AreStatusEffectsEnabled()422 bool AreStatusEffectsEnabled() const { 423 return _status_effects_enabled; 424 } 425 426 //! \brief Proxy function used to set up a character status effect from the map mode. ChangeActiveStatusEffect(vt_global::GlobalCharacter * character,vt_global::GLOBAL_STATUS status_type,vt_global::GLOBAL_INTENSITY intensity,uint32_t duration)427 bool ChangeActiveStatusEffect(vt_global::GlobalCharacter* character, 428 vt_global::GLOBAL_STATUS status_type, 429 vt_global::GLOBAL_INTENSITY intensity, 430 uint32_t duration) { 431 return _status_effect_supervisor.ChangeActiveStatusEffect(character, 432 status_type, 433 intensity, 434 duration, 435 0, true); 436 } 437 438 //! \brief Proxy function used to obtain the currently applied intensity 439 //! of an active status effect applied on the character. GetActiveStatusEffectIntensity(vt_global::GlobalCharacter * character,vt_global::GLOBAL_STATUS status_type)440 vt_global::GLOBAL_INTENSITY GetActiveStatusEffectIntensity(vt_global::GlobalCharacter* character, 441 vt_global::GLOBAL_STATUS status_type) const { 442 return _status_effect_supervisor.GetActiveStatusEffectIntensity(character, status_type); 443 } 444 445 //! \brief Remove any negative active status effect RemoveNegativeActiveStatusEffects()446 void RemoveNegativeActiveStatusEffects() { 447 _status_effect_supervisor.RemoveNegativeActiveStatusEffects(); 448 } 449 450 /** \brief Starts a enemy encounter battle or event with a given enemy 451 *** \param enemy The enemy sprite the character has collided or spoken with. 452 *** \param hero_init_boost Hero stamina boost applied when the team took the initiative to "talk" to enemy first. 453 *** \param enemy_init_boost Enemy stamina boost applied when the enemy sprite caught the heroes by surprise. 454 **/ 455 void StartEnemyEncounter(vt_map::private_map::EnemySprite* enemy, 456 bool hero_init_boost = false, bool enemy_init_boost = false); 457 //@} 458 459 private: 460 // ----- Members : Names and Identifiers ----- 461 462 /** \brief A reference to the current instance of MapMode 463 *** This is used by other map classes to be able to refer to the map that they exist in. 464 **/ 465 static MapMode* _current_instance; 466 467 //! Tells whether the mode is activated. It is true by calling Reset(), 468 //! and false when calling Deactivate(). This member exists to prevent 469 //! the triggering of deactivate more than once. 470 bool _activated; 471 472 //! \brief The name of the Lua file that contains the map data 473 std::string _map_data_filename; 474 475 /** \brief The map's data unique name as it is used to identify a Lua namespace table 476 *** To avoid Lua naming conflicts between multiple scripting files, all map data is encompassed within 477 *** a namespace (a Lua table) that is unique to each map. 478 **/ 479 std::string _map_data_tablespace; 480 481 //! \brief The name of the Lua file that contains the map script 482 std::string _map_script_filename; 483 484 //! \brief The map's script unique name as it is used to identify a Lua namespace table 485 std::string _map_script_tablespace; 486 487 //! \brief The TextImages used to render the map hud names and subnames 488 vt_video::TextImage _map_hud_name; 489 vt_video::TextImage _map_hud_subname; 490 491 /** \brief The interface to the file which contains all the map's stored data and subroutines. 492 *** This class generally performs a large amount of communication with this script continuously. 493 *** The script remains open for as long as the MapMode object exists. 494 **/ 495 vt_script::ReadScriptDescriptor _map_script; 496 497 // ----- Members : Supervisor Class Objects and Script Functions ----- 498 499 //! \brief Instance of helper class to map mode. Responsible for tile related operations. 500 private_map::TileSupervisor* _tile_supervisor; 501 502 //! \brief Instance of helper class to map mode. Responsible for object and sprite related operations. 503 private_map::ObjectSupervisor* _object_supervisor; 504 505 //! \brief Instance of helper class to map mode. Responsible for updating and managing active map events. 506 private_map::EventSupervisor* _event_supervisor; 507 508 //! \brief Instance of helper class to map mode. Responsible for dialogue execution and display operations. 509 private_map::MapDialogueSupervisor* _dialogue_supervisor; 510 511 //! \brief Instance of helper class to map mode. Responsible for processing all information related to treasure discovery. 512 private_map::TreasureSupervisor* _treasure_supervisor; 513 514 //! \brief Handles escape map sub-menu. 515 private_map::EscapeSupervisor* _escape_supervisor; 516 517 /** \brief A script function which assists with the MapMode#Update method 518 *** This function implements any custom update code that the specific map needs to be performed. 519 *** The most common operation that this script function performs is to check for trigger conditions 520 *** that cause map events to occur 521 **/ 522 luabind::object _update_function; 523 524 // ----- Members : Properties and State ----- 525 526 //! \brief Retains information needed to correctly draw the next map frame 527 private_map::MapFrame _map_frame; 528 529 /** \brief Indicates whether we are in a map corner for one of the other axis, 530 *** thus disabling any sprite shifting parallax for this axis 531 *** since the map view won't move in that direction. 532 **/ 533 bool _camera_x_in_map_corner; 534 bool _camera_y_in_map_corner; 535 536 //! \brief A pointer to the map sprite that the map camera will focus on 537 private_map::VirtualSprite* _camera; 538 539 /** \brief A "virtual sprite" that can serve as a focus point for the camera. 540 *** This sprite is not visible to the player nor does it have any collision 541 *** detection properties. Usually, the camera focuses on the player's sprite 542 *** rather than this object, but it is useful for scripted sequences and other 543 *** things. 544 **/ 545 private_map::VirtualSprite* _virtual_focus; 546 547 //! \brief the camera position debug text 548 vt_video::TextImage _debug_camera_position; 549 550 //! \brief The direction the camera will move on next update 551 vt_common::Position2D _camera_move; 552 553 //! \brief A time for camera movement 554 vt_system::SystemTimer _camera_timer; 555 556 //! \brief The pixel length depending on the current resolution. 557 //! This is used to avoid seeing jumping objects when scrolling the map view 558 //! and/or sprite's vibrating edges by using only scrolling values which are 559 //! a multiple of the pixel size. 560 //! \note Those are computed once at the first map tile frame update 561 //! and kept in memory to avoid useless recomputations. 562 //! This also should be dropped once the map mode uses a standard coordinate system. 563 //! \see _UpdateMapFrame() for more info. 564 vt_common::Position2D _pixel_length; 565 566 //! \brief If true, the player is allowed to run. 567 bool _running_enabled; 568 569 //! \brief If true, the player's stamina will not drain for actions and the stamina bar will not be shown 570 bool _unlimited_stamina; 571 572 //! \brief When false, dialogue icons, stamina bar, and other GUI elements will not be drawn to the screen 573 bool _show_gui; 574 575 /** \brief A counter for the player's stamina 576 *** This value ranges from 0 to STAMINA_FULL. It takes twice as long to regenerate stamina as 577 *** it does to consume it when running. 578 **/ 579 uint32_t _run_stamina; 580 581 /** \brief the alpha value used to create fade in/out of the map GUI when switching in 582 *** or out of the STATE_SCENE or DIALOGUE state. 583 **/ 584 float _gui_alpha; 585 586 /** \brief Maintains a stack state for the different modes of operation that the map may be in 587 *** The top (back) of the stack is the active mode 588 **/ 589 std::vector<private_map::MAP_STATE> _state_stack; 590 591 // ----- Members : Timing and Graphics ----- 592 593 /** \brief A timer used for when the player first enters the map 594 *** This timer is set to 7000 ms (7 seconds) and is used to display the map's location graphic 595 *** and name at the top center of the screen. The graphic and text are faded in for the first 596 *** two seconds, drawn opaquely for the next three seconds, and faded out in the final two seconds. 597 **/ 598 vt_system::SystemTimer _intro_timer; 599 600 //! \brief Freestyle art image of the current map 601 vt_video::StillImage _map_image; 602 603 //! \brief An icon graphic which appears over the heads of NPCs who have dialogue that has not been read by the player 604 vt_video::AnimatedImage _dialogue_icon; 605 606 //! \brief Image which underlays the stamina bar for running 607 //! \note This pointer is a reference handled by the GlobalMedia class, don't delete it! 608 vt_video::StillImage* _stamina_bar_background; 609 610 //! \brief The stamina bar representing the current stamina 611 //! \note This pointer is a reference handled by the GlobalMedia class, don't delete it! 612 vt_video::StillImage* _stamina_bar; 613 614 //! \brief Image which overlays the stamina bar to show that the player has unlimited running 615 //! \note This pointer is a reference handled by the GlobalMedia class, don't delete it! 616 vt_video::StillImage* _stamina_bar_infinite_overlay; 617 618 /** \brief A container for the various foes which may appear on this map 619 *** These enemies are kept at their initial stats. When they are passed to battle mode, 620 *** a copy of each enemy is made and initialized there. 621 **/ 622 std::vector<vt_global::GlobalEnemy *> _enemies; 623 624 /** 625 *** Stores the first music filename loaded by the map. 626 *** Used to auto-play it at map startup. 627 *** NOTE: Other audio handling will have to be used through scripting. 628 **/ 629 std::string _music_filename; 630 vt_audio::AUDIO_STATE _music_audio_state; 631 uint32_t _music_audio_sample; 632 633 //! \brief the minimap for the current map instance 634 private_map::Minimap* _minimap; 635 636 //! \brief flag that enables minimap rendering or not 637 bool _show_minimap; 638 639 //! \brief Stores the potential custom minimap image filename 640 std::string _minimap_custom_image_file; 641 642 //! \brief The character party status effects supervisor 643 private_map::MapStatusEffectsSupervisor _status_effect_supervisor; 644 645 //! \brief Tells whether the menu mode is available from the map mode. 646 bool _menu_enabled; 647 648 //! \brief Tells whether the map points are enabled in the map mode. 649 bool _map_points_enabled; 650 651 //! \brief Tells whether the status effects can run in the map mode. 652 bool _status_effects_enabled; 653 654 //! \brief Tells whether the auto save is allowed once the map mode has loaded. 655 bool _auto_save_enabled; 656 657 // ----- Methods ----- 658 659 //! \brief Loads all map data contained in the Lua file that defines the map 660 bool _Load(); 661 662 /** Triggers the minimap creation either by trying to load the minimap file given. 663 *** Or by creating a minimap procedurally. 664 **/ 665 void _CreateMinimap(); 666 667 //! \brief A helper function to Update() that is called only when the map is in the explore state 668 void _UpdateExplore(); 669 670 //! \brief Update the map frame coordinates 671 void _UpdateMapFrame(); 672 673 //! \brief Draws all visible map tiles and sprites to the screen 674 void _DrawMapLayers(); 675 676 //! \brief Draws all GUI visuals, such as dialogue icons and the stamina bar 677 void _DrawGUI(); 678 679 //! \brief Draws the stamina bar, part of DrawGUI() 680 void _DrawStaminaBar(const vt_video::Color &blending = vt_video::Color::white); 681 682 //! \brief Draws the map layer tile and collision grid. 683 void _DrawDebugGrid(); 684 685 //! \brief Restores the music state on ::Reset() calls. 686 void _ResetMusicState(); 687 688 //! \brief Inits map resources. 689 void _InitResources(); 690 }; // class MapMode 691 692 } // namespace vt_map; 693 694 #endif 695