GameEdit.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __GAME_EDIT_H__
  21. #define __GAME_EDIT_H__
  22. /*
  23. ===============================================================================
  24. Ingame cursor.
  25. ===============================================================================
  26. */
  27. class idCursor3D : public idEntity {
  28. public:
  29. CLASS_PROTOTYPE( idCursor3D );
  30. idCursor3D( void );
  31. ~idCursor3D( void );
  32. void Spawn( void );
  33. void Present( void );
  34. void Think( void );
  35. idForce_Drag drag;
  36. idVec3 draggedPosition;
  37. };
  38. /*
  39. ===============================================================================
  40. Allows entities to be dragged through the world with physics.
  41. ===============================================================================
  42. */
  43. class idDragEntity {
  44. public:
  45. idDragEntity( void );
  46. ~idDragEntity( void );
  47. void Clear();
  48. void Update( idPlayer *player );
  49. void SetSelected( idEntity *ent );
  50. idEntity * GetSelected( void ) const { return selected.GetEntity(); }
  51. void DeleteSelected( void );
  52. void BindSelected( void );
  53. void UnbindSelected( void );
  54. private:
  55. idEntityPtr<idEntity> dragEnt; // entity being dragged
  56. jointHandle_t joint; // joint being dragged
  57. int id; // id of body being dragged
  58. idVec3 localEntityPoint; // dragged point in entity space
  59. idVec3 localPlayerPoint; // dragged point in player space
  60. idStr bodyName; // name of the body being dragged
  61. idCursor3D * cursor; // cursor entity
  62. idEntityPtr<idEntity> selected; // last dragged entity
  63. void StopDrag( void );
  64. };
  65. /*
  66. ===============================================================================
  67. Handles ingame entity editing.
  68. ===============================================================================
  69. */
  70. typedef struct selectedTypeInfo_s {
  71. idTypeInfo *typeInfo;
  72. idStr textKey;
  73. } selectedTypeInfo_t;
  74. class idEditEntities {
  75. public:
  76. idEditEntities( void );
  77. bool SelectEntity( const idVec3 &origin, const idVec3 &dir, const idEntity *skip );
  78. void AddSelectedEntity( idEntity *ent );
  79. void RemoveSelectedEntity( idEntity *ent );
  80. void ClearSelectedEntities( void );
  81. void DisplayEntities( void );
  82. bool EntityIsSelectable( idEntity *ent, idVec4 *color = NULL, idStr *text = NULL );
  83. private:
  84. int nextSelectTime;
  85. idList<selectedTypeInfo_t> selectableEntityClasses;
  86. idList<idEntity *> selectedEntities;
  87. };
  88. #endif /* !__GAME_EDIT_H__ */