Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 <list>
  11. #include <vector>
  12. #include "Entity.h"
  13. #include "Room.h"
  14. #include "SkeletalModel.h"
  15. #include "Sprite.h"
  16. #include "WorldData.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 int sizeRoom();
  32. Room &getRoom(unsigned int index);
  33. void addSprite(SpriteSequence &sprite);
  34. unsigned int sizeSprite();
  35. SpriteSequence &getSprite(unsigned int index);
  36. void addEntity(Entity &entity);
  37. unsigned int sizeEntity();
  38. Entity &getEntity(unsigned int index);
  39. void addSkeletalModel(SkeletalModel &model);
  40. unsigned int sizeSkeletalModel();
  41. SkeletalModel &getSkeletalModel(unsigned int index);
  42. /*!
  43. * \brief Adds mesh to world
  44. * \param model mesh to add
  45. */
  46. void addMesh(model_mesh_t *model);
  47. model_mesh_t *getMesh(int index);
  48. /*!
  49. * \brief Find room a location is in.
  50. *
  51. * If it fails to be in a room it gives closest overlapping room.
  52. * \param index Guessed room index
  53. * \param x X coordinate
  54. * \param y Y coordinate
  55. * \param z Z coordinate
  56. * \returns correct room index or -1 for unknown
  57. */
  58. int getRoomByLocation(int index, float x, float y, float z);
  59. /*!
  60. * \brief Find room a location is in.
  61. *
  62. * If it fails to be in a room it gives closest overlapping room.
  63. * \param x X coordinate
  64. * \param y Y coordinate
  65. * \param z Z coordinate
  66. * \returns correct room index or -1 for unknown
  67. */
  68. int getRoomByLocation(float x, float y, float z);
  69. private:
  70. // Old World
  71. std::vector<model_mesh_t *> mMeshes; //!< Unanimated meshes
  72. // New World
  73. std::vector<Room *> mRooms;
  74. std::vector<SpriteSequence *> mSprites;
  75. std::vector<Entity *> mEntities;
  76. std::vector<SkeletalModel *> mModels;
  77. };
  78. World &getWorld();
  79. #endif