q3factory.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*!
  2. Model Factory.
  3. create the additional scenenodes for ( bullets, health... )
  4. Defines the Entities for Quake3
  5. */
  6. #ifndef __QUAKE3_FACTORY__H_INCLUDED__
  7. #define __QUAKE3_FACTORY__H_INCLUDED__
  8. using namespace irr;
  9. using namespace scene;
  10. using namespace gui;
  11. using namespace video;
  12. using namespace core;
  13. using namespace quake3;
  14. using namespace io;
  15. //! Defines to which group the entities belong
  16. enum eItemGroup
  17. {
  18. WEAPON,
  19. AMMO,
  20. ARMOR,
  21. HEALTH,
  22. POWERUP
  23. };
  24. //! define a supgroup for the item. for e.q the Weapons
  25. enum eItemSubGroup
  26. {
  27. SUB_NONE = 0,
  28. GAUNTLET,
  29. MACHINEGUN,
  30. SHOTGUN,
  31. GRENADE_LAUNCHER,
  32. ROCKET_LAUNCHER,
  33. LIGHTNING,
  34. RAILGUN,
  35. PLASMAGUN,
  36. BFG,
  37. GRAPPLING_HOOK,
  38. NAILGUN,
  39. PROX_LAUNCHER,
  40. CHAINGUN,
  41. };
  42. //! apply a special effect to the shader
  43. enum eItemSpecialEffect
  44. {
  45. SPECIAL_SFX_NONE = 0,
  46. SPECIAL_SFX_ROTATE = 1,
  47. SPECIAL_SFX_BOUNCE = 2,
  48. SPECIAL_SFX_ROTATE_1 = 4,
  49. };
  50. // a list for defining a model
  51. struct SItemElement
  52. {
  53. const c8 *key;
  54. const c8 *model[2];
  55. const c8 *sound;
  56. const c8 *icon;
  57. const c8 *pickup;
  58. s32 value;
  59. eItemGroup group;
  60. eItemSubGroup sub;
  61. u32 special;
  62. };
  63. //! Get's an entity based on it's key
  64. const SItemElement * getItemElement ( const stringc& key );
  65. /*!
  66. Quake3 Model Factory.
  67. Takes the mesh buffers and creates scenenodes for their associated shaders
  68. */
  69. void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
  70. IrrlichtDevice *device,
  71. IQ3LevelMesh* mesh,
  72. eQ3MeshIndex meshIndex,
  73. ISceneNode *parent,
  74. IMetaTriangleSelector *meta,
  75. bool showShaderName
  76. );
  77. /*!
  78. Creates Model based on the entity list
  79. */
  80. void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
  81. IrrlichtDevice *device,
  82. IQ3LevelMesh* masterMesh,
  83. ISceneNode *parent,
  84. bool showShaderName
  85. );
  86. /*!
  87. so we need a good starting Position in the level.
  88. we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
  89. */
  90. s32 Q3StartPosition ( IQ3LevelMesh* mesh,
  91. ICameraSceneNode* camera,
  92. s32 startposIndex,
  93. const vector3df &translation
  94. );
  95. /*!
  96. gets a accumulated force on a given surface
  97. */
  98. vector3df getGravity ( const c8 * surface );
  99. /*
  100. Dynamically load the Irrlicht Library
  101. */
  102. funcptr_createDevice load_createDevice ( const c8 * filename);
  103. funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename);
  104. //! Macro for save Dropping an Element
  105. #define dropElement(x) if (x) { x->remove(); x = 0; }
  106. /*
  107. get the current collision response camera animator
  108. */
  109. ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device );
  110. //! internal animation
  111. enum eTimeFireFlag
  112. {
  113. FIRED = 1,
  114. };
  115. struct TimeFire
  116. {
  117. u32 flags;
  118. u32 next;
  119. u32 delta;
  120. };
  121. void setTimeFire ( TimeFire *t, u32 delta, u32 flags = 0 );
  122. void checkTimeFire ( TimeFire *t, u32 listSize, u32 now );
  123. #endif // __QUAKE3_FACTORY__H_INCLUDED__