QGearsFLevelFile.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. namespace QGears
  35. {
  36. // TODO: move flevel stuff to ff7 as it is ff7 related!?
  37. using FF7::ModelListFile;
  38. using FF7::ModelListFilePtr;
  39. class FLevelTextureLoader;
  40. class FLevelBackground2DLoader;
  41. class FLevelFile : public Resource
  42. {
  43. public:
  44. FLevelFile( Ogre::ResourceManager *creator, const String &name
  45. ,Ogre::ResourceHandle handle, const String &group
  46. ,bool isManual = false, Ogre::ManualResourceLoader *loader = NULL );
  47. virtual ~FLevelFile();
  48. static const String RESOURCE_TYPE;
  49. virtual const BackgroundFilePtr& getBackground ( void ) const;
  50. virtual const CameraMatrixFilePtr& getCameraMatrix( void ) const;
  51. virtual const ModelListFilePtr& getModelList ( void ) const;
  52. virtual const PaletteFilePtr& getPalette ( void ) const;
  53. virtual const WalkmeshFilePtr& getWalkmesh ( void ) const;
  54. virtual void setBackground ( const BackgroundFilePtr &background );
  55. virtual void setCameraMatrix( const CameraMatrixFilePtr &camera_matrix );
  56. virtual void setModelList ( const ModelListFilePtr &model_list );
  57. virtual void setPalette ( const PaletteFilePtr &palette );
  58. virtual void setWalkmesh ( const WalkmeshFilePtr &walkmesh );
  59. virtual String getBackground2DName( void ) const;
  60. virtual String getBackgroundTextureName( void ) const;
  61. protected:
  62. typedef std::vector<HRCFilePtr> HRCList;
  63. typedef ModelListFile::ModelList ModelList;
  64. typedef ModelListFile::AnimationList AnimationList;
  65. static const String SUFFIX_BACKGROUND_TEXTURE;
  66. static const String SUFFIX_BACKGROUND_2D;
  67. virtual void loadImpl( void );
  68. virtual void loadModels( void );
  69. virtual void loadAnimations( const HRCFilePtr &model, const AnimationList &animations );
  70. virtual void unloadImpl( void );
  71. virtual size_t calculateSize( void ) const;
  72. virtual const String& getResourceType( void ) const;
  73. private:
  74. BackgroundFilePtr m_background;
  75. CameraMatrixFilePtr m_camera_matrix;
  76. ModelListFilePtr m_model_list;
  77. PaletteFilePtr m_palette;
  78. WalkmeshFilePtr m_walkmesh;
  79. FLevelTextureLoader *m_background_texture_loader;
  80. Ogre::TexturePtr m_background_texture;
  81. FLevelBackground2DLoader *m_background_2d_loader;
  82. Background2DFilePtr m_background_2d;
  83. HRCList m_hrc_files;
  84. };
  85. typedef Ogre::SharedPtr<FLevelFile> FLevelFilePtr;
  86. }
  87. #endif // __QGearsFLevelFile_H__