Open Source Tomb Raider Engine
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

World.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*!
  2. * \file include/World.h
  3. * \brief The game world (model)
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _WORLD_H_
  9. #define _WORLD_H_
  10. #include <memory>
  11. #include <vector>
  12. #include "Entity.h"
  13. #include "Room.h"
  14. #include "SkeletalModel.h"
  15. #include "Sprite.h"
  16. #include "StaticMesh.h"
  17. /*!
  18. * \brief The game world (model)
  19. */
  20. class World {
  21. public:
  22. /*!
  23. * \brief Deconstructs an object of World
  24. */
  25. ~World();
  26. /*!
  27. * \brief Clears all data in world
  28. */
  29. void destroy();
  30. void addRoom(Room& room);
  31. unsigned long sizeRoom();
  32. Room& getRoom(unsigned long index);
  33. void addSprite(SpriteSequence& sprite);
  34. unsigned long sizeSprite();
  35. SpriteSequence& getSprite(unsigned long index);
  36. void addEntity(Entity& entity);
  37. unsigned long sizeEntity();
  38. Entity& getEntity(unsigned long index);
  39. void addSkeletalModel(SkeletalModel& model);
  40. unsigned long sizeSkeletalModel();
  41. SkeletalModel& getSkeletalModel(unsigned long index);
  42. void addStaticMesh(StaticMesh& model);
  43. unsigned long sizeStaticMesh();
  44. StaticMesh& getStaticMesh(unsigned long index);
  45. /*!
  46. * \brief Find room a location is in.
  47. *
  48. * If it fails to be in a room it gives closest overlapping room.
  49. * \param index Guessed room index
  50. * \param x X coordinate
  51. * \param y Y coordinate
  52. * \param z Z coordinate
  53. * \returns correct room index or -1 for unknown
  54. */
  55. long getRoomByLocation(long index, float x, float y, float z);
  56. /*!
  57. * \brief Find room a location is in.
  58. *
  59. * If it fails to be in a room it gives closest overlapping room.
  60. * \param x X coordinate
  61. * \param y Y coordinate
  62. * \param z Z coordinate
  63. * \returns correct room index or -1 for unknown
  64. */
  65. long getRoomByLocation(float x, float y, float z);
  66. private:
  67. std::vector<std::unique_ptr<Room>> mRooms;
  68. std::vector<std::unique_ptr<SpriteSequence>> mSprites;
  69. std::vector<std::unique_ptr<Entity>> mEntities;
  70. std::vector<std::unique_ptr<SkeletalModel>> mModels;
  71. std::vector<std::unique_ptr<StaticMesh>> mMeshes;
  72. };
  73. World& getWorld();
  74. #endif