PlayerView.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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_PLAYERVIEW_H__
  21. #define __GAME_PLAYERVIEW_H__
  22. /*
  23. ===============================================================================
  24. Player view.
  25. ===============================================================================
  26. */
  27. // screenBlob_t are for the on-screen damage claw marks, etc
  28. typedef struct {
  29. const idMaterial * material;
  30. float x, y, w, h;
  31. float s1, t1, s2, t2;
  32. int finishTime;
  33. int startFadeTime;
  34. float driftAmount;
  35. } screenBlob_t;
  36. #define MAX_SCREEN_BLOBS 8
  37. class idPlayerView {
  38. public:
  39. idPlayerView();
  40. void Save( idSaveGame *savefile ) const;
  41. void Restore( idRestoreGame *savefile );
  42. void SetPlayerEntity( class idPlayer *playerEnt );
  43. void ClearEffects( void );
  44. void DamageImpulse( idVec3 localKickDir, const idDict *damageDef );
  45. void WeaponFireFeedback( const idDict *weaponDef );
  46. idAngles AngleOffset( void ) const; // returns the current kick angle
  47. idMat3 ShakeAxis( void ) const; // returns the current shake angle
  48. void CalculateShake( void );
  49. // this may involve rendering to a texture and displaying
  50. // that with a warp model or in double vision mode
  51. void RenderPlayerView( idUserInterface *hud );
  52. void Fade( idVec4 color, int time );
  53. void Flash( idVec4 color, int time );
  54. void AddBloodSpray( float duration );
  55. // temp for view testing
  56. void EnableBFGVision( bool b ) { bfgVision = b; };
  57. private:
  58. void SingleView( idUserInterface *hud, const renderView_t *view );
  59. void DoubleVision( idUserInterface *hud, const renderView_t *view, int offset );
  60. void BerserkVision( idUserInterface *hud, const renderView_t *view );
  61. void InfluenceVision( idUserInterface *hud, const renderView_t *view );
  62. void ScreenFade();
  63. screenBlob_t * GetScreenBlob();
  64. screenBlob_t screenBlobs[MAX_SCREEN_BLOBS];
  65. int dvFinishTime; // double vision will be stopped at this time
  66. const idMaterial * dvMaterial; // material to take the double vision screen shot
  67. int kickFinishTime; // view kick will be stopped at this time
  68. idAngles kickAngles;
  69. bool bfgVision; //
  70. const idMaterial * tunnelMaterial; // health tunnel vision
  71. const idMaterial * armorMaterial; // armor damage view effect
  72. const idMaterial * berserkMaterial; // berserk effect
  73. const idMaterial * irGogglesMaterial; // ir effect
  74. const idMaterial * bloodSprayMaterial; // blood spray
  75. const idMaterial * bfgMaterial; // when targeted with BFG
  76. const idMaterial * lagoMaterial; // lagometer drawing
  77. float lastDamageTime; // accentuate the tunnel effect for a while
  78. idVec4 fadeColor; // fade color
  79. idVec4 fadeToColor; // color to fade to
  80. idVec4 fadeFromColor; // color to fade from
  81. float fadeRate; // fade rate
  82. int fadeTime; // fade time
  83. idAngles shakeAng; // from the sound sources
  84. idPlayer * player;
  85. renderView_t view;
  86. };
  87. #endif /* !__GAME_PLAYERVIEW_H__ */