1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2011 by The Allacrost Project
3 //            Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 //                         All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See http://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 /** ****************************************************************************
12 *** \file    shake.h
13 *** \author  Raj Sharma, roos@allacrost.org
14 *** \author  Yohann Ferreira, yohann ferreira orange fr
15 *** \brief   Header file for screen shaking code
16 *** ***************************************************************************/
17 
18 #ifndef __SHAKE_HEADER__
19 #define __SHAKE_HEADER__
20 
21 #include "interpolator.h"
22 
23 namespace vt_mode_manager
24 {
25 
26 //! \brief Screen shake fall-off modes, which control the behavior of a screen shake.
27 enum ShakeFalloff {
28     SHAKE_FALLOFF_INVALID = -1,
29 
30     //! Shake remains at constant force
31     SHAKE_FALLOFF_NONE = 0,
32 
33     //! Shake starts out small, builds up, then dies down
34     SHAKE_FALLOFF_EASE = 1,
35 
36     //! Shake strength decreases linearly until the end
37     SHAKE_FALLOFF_LINEAR = 2,
38 
39     //! Shake decreases slowly and drops off quickly at the end
40     SHAKE_FALLOFF_GRADUAL = 3,
41 
42     //! Shake suddenly falls off, used for "impacts"
43     SHAKE_FALLOFF_SUDDEN = 4,
44 
45     SHAKE_FALLOFF_TOTAL = 5
46 };
47 
48 /** ****************************************************************************
49 *** \brief Represents the force of a screen shake
50 ***
51 *** The ShakeForce class holds information about a screen shake, and it is used
52 *** by the video engine to keep track of how to shake the screen.
53 *** ***************************************************************************/
54 class ShakeForce
55 {
56 public:
57     //! \brief The initial force of the shake
58     float initial_force;
59 
60     //! \brief Used to interpolate the shaking motion
61     Interpolator interpolator;
62 
63     //! milliseconds that passed since this shake started
64     uint32_t current_time;
65 
66     //! milliseconds that this shake was set to last for
67     uint32_t end_time;
68 };
69 
70 }  // namespace vt_mode_manager
71 
72 #endif  // __SHAKE_HEADER__
73