QGearsFLevelFile.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. -----------------------------------------------------------------------------
  3. The MIT License (MIT)
  4. Copyright (c) 2013-08-24 Tobias Peters <tobias.peters@kreativeffekt.at>
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. -----------------------------------------------------------------------------
  21. */
  22. #ifndef __QGearsFLevelFile_H__
  23. #define __QGearsFLevelFile_H__
  24. #include <OgreTexture.h>
  25. #include "common/QGearsResource.h"
  26. #include "common/TypeDefine.h"
  27. #include "map/QGearsBackground2DFile.h"
  28. #include "map/QGearsWalkmeshFile.h"
  29. #include "data/FF7ModelListFile.h"
  30. #include "QGearsBackgroundFile.h"
  31. #include "QGearsCameraMatrixFile.h"
  32. #include "QGearsPaletteFile.h"
  33. #include "QGearsHRCFile.h"
  34. #include "QGearsTriggersFile.h"
  35. namespace QGears
  36. {
  37. // TODO: move flevel stuff to ff7 as it is ff7 related!?
  38. using FF7::ModelListFile;
  39. using FF7::ModelListFilePtr;
  40. class FLevelTextureLoader;
  41. class FLevelBackground2DLoader;
  42. class FLevelFile : public Resource
  43. {
  44. public:
  45. FLevelFile( Ogre::ResourceManager *creator, const String &name
  46. ,Ogre::ResourceHandle handle, const String &group
  47. ,bool isManual = false, Ogre::ManualResourceLoader *loader = NULL );
  48. virtual ~FLevelFile();
  49. static const String RESOURCE_TYPE;
  50. const std::vector<u8>& getRawScript() const;
  51. const BackgroundFilePtr& getBackground() const;
  52. const CameraMatrixFilePtr& getCameraMatrix() const;
  53. const ModelListFilePtr& getModelList() const;
  54. const PaletteFilePtr& getPalette() const;
  55. const WalkmeshFilePtr& getWalkmesh() const;
  56. const TriggersFilePtr& getTriggers() const;
  57. void setRawScript(const std::vector<u8>& scriptData);
  58. void setBackground ( const BackgroundFilePtr &background );
  59. void setCameraMatrix( const CameraMatrixFilePtr &camera_matrix );
  60. void setModelList ( const ModelListFilePtr &model_list );
  61. void setPalette ( const PaletteFilePtr &palette );
  62. void setWalkmesh ( const WalkmeshFilePtr &walkmesh );
  63. void setTriggers(const TriggersFilePtr& triggers);
  64. String getBackground2DName( void ) const;
  65. String getBackgroundTextureName( void ) const;
  66. protected:
  67. typedef std::vector<HRCFilePtr> HRCList;
  68. typedef ModelListFile::ModelList ModelList;
  69. typedef ModelListFile::AnimationList AnimationList;
  70. static const String SUFFIX_BACKGROUND_TEXTURE;
  71. static const String SUFFIX_BACKGROUND_2D;
  72. virtual void loadImpl( void ) override;
  73. void loadModels( void );
  74. void loadAnimations( const HRCFilePtr &model, const AnimationList &animations );
  75. virtual void unloadImpl( void ) override;
  76. virtual size_t calculateSize( void ) const override;
  77. virtual const String& getResourceType( void ) const;
  78. private:
  79. BackgroundFilePtr m_background;
  80. CameraMatrixFilePtr m_camera_matrix;
  81. ModelListFilePtr m_model_list;
  82. PaletteFilePtr m_palette;
  83. WalkmeshFilePtr m_walkmesh;
  84. TriggersFilePtr m_triggers;
  85. std::vector<u8> m_rawScript;
  86. FLevelTextureLoader *m_background_texture_loader;
  87. Ogre::TexturePtr m_background_texture;
  88. FLevelBackground2DLoader *m_background_2d_loader;
  89. Background2DFilePtr m_background_2d;
  90. HRCList m_hrc_files;
  91. };
  92. typedef Ogre::SharedPtr<FLevelFile> FLevelFilePtr;
  93. }
  94. #endif // __QGearsFLevelFile_H__