]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/game/PlayerView.h
hello world
[icculus/iodoom3.git] / neo / game / PlayerView.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 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.
23
24 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.
25
26 ===========================================================================
27 */
28
29 #ifndef __GAME_PLAYERVIEW_H__
30 #define __GAME_PLAYERVIEW_H__
31
32 /*
33 ===============================================================================
34
35   Player view.
36
37 ===============================================================================
38 */
39
40 // screenBlob_t are for the on-screen damage claw marks, etc
41 typedef struct {
42         const idMaterial *      material;
43         float                           x, y, w, h;
44         float                           s1, t1, s2, t2;
45         int                                     finishTime;
46         int                                     startFadeTime;
47         float                           driftAmount;
48 } screenBlob_t;
49
50 #define MAX_SCREEN_BLOBS        8
51
52 class idPlayerView {
53 public:
54                                                 idPlayerView();
55
56         void                            Save( idSaveGame *savefile ) const;
57         void                            Restore( idRestoreGame *savefile );
58
59         void                            SetPlayerEntity( class idPlayer *playerEnt );
60
61         void                            ClearEffects( void );
62
63         void                            DamageImpulse( idVec3 localKickDir, const idDict *damageDef );
64
65         void                            WeaponFireFeedback( const idDict *weaponDef );
66
67         idAngles                        AngleOffset( void ) const;                      // returns the current kick angle
68
69         idMat3                          ShakeAxis( void ) const;                        // returns the current shake angle
70
71         void                            CalculateShake( void );
72
73         // this may involve rendering to a texture and displaying
74         // that with a warp model or in double vision mode
75         void                            RenderPlayerView( idUserInterface *hud );
76
77         void                            Fade( idVec4 color, int time );
78
79         void                            Flash( idVec4 color, int time );
80
81         void                            AddBloodSpray( float duration );
82
83         // temp for view testing
84         void                            EnableBFGVision( bool b ) { bfgVision = b; };
85
86 private:
87         void                            SingleView( idUserInterface *hud, const renderView_t *view );
88         void                            DoubleVision( idUserInterface *hud, const renderView_t *view, int offset );
89         void                            BerserkVision( idUserInterface *hud, const renderView_t *view );
90         void                            InfluenceVision( idUserInterface *hud, const renderView_t *view );
91         void                            ScreenFade();
92
93         screenBlob_t *          GetScreenBlob();
94
95         screenBlob_t            screenBlobs[MAX_SCREEN_BLOBS];
96
97         int                                     dvFinishTime;           // double vision will be stopped at this time
98         const idMaterial *      dvMaterial;                     // material to take the double vision screen shot
99
100         int                                     kickFinishTime;         // view kick will be stopped at this time
101         idAngles                        kickAngles;                     
102
103         bool                            bfgVision;                      // 
104
105         const idMaterial *      tunnelMaterial;         // health tunnel vision
106         const idMaterial *      armorMaterial;          // armor damage view effect
107         const idMaterial *      berserkMaterial;        // berserk effect
108         const idMaterial *      irGogglesMaterial;      // ir effect
109         const idMaterial *      bloodSprayMaterial; // blood spray
110         const idMaterial *      bfgMaterial;            // when targeted with BFG
111         const idMaterial *      lagoMaterial;           // lagometer drawing
112         float                           lastDamageTime;         // accentuate the tunnel effect for a while
113
114         idVec4                          fadeColor;                      // fade color
115         idVec4                          fadeToColor;            // color to fade to
116         idVec4                          fadeFromColor;          // color to fade from
117         float                           fadeRate;                       // fade rate
118         int                                     fadeTime;                       // fade time
119
120         idAngles                        shakeAng;                       // from the sound sources
121
122         idPlayer *                      player;
123         renderView_t            view;
124 };
125
126 #endif /* !__GAME_PLAYERVIEW_H__ */