Open Source Tomb Raider Engine
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

World.h 2.0KB

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