doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Cinematic.h
Go to the documentation of this file.
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 __CINEMATIC_H__
30 #define __CINEMATIC_H__
31 
32 /*
33 ===============================================================================
34 
35  RoQ cinematic
36 
37  Multiple idCinematics can run simultaniously.
38  A single idCinematic can be reused for multiple files if desired.
39 
40 ===============================================================================
41 */
42 
43 // cinematic states
44 typedef enum {
46  FMV_PLAY, // play
47  FMV_EOF, // all other conditions, i.e. stop/EOF/abort
52 } cinStatus_t;
53 
54 // a cinematic stream generates an image buffer, which the caller will upload to a texture
55 typedef struct {
56  int imageWidth, imageHeight; // will be a power of 2
57  const byte * image; // RGBA format, alpha will be 255
58  int status;
59 } cinData_t;
60 
61 class idCinematic {
62 public:
63  // initialize cinematic play back data
64  static void InitCinematic( void );
65 
66  // shutdown cinematic play back data
67  static void ShutdownCinematic( void );
68 
69  // allocates and returns a private subclass that implements the methods
70  // This should be used instead of new
71  static idCinematic *Alloc();
72 
73  // frees all allocated memory
74  virtual ~idCinematic();
75 
76  // returns false if it failed to load
77  virtual bool InitFromFile( const char *qpath, bool looping );
78 
79  // returns the length of the animation in milliseconds
80  virtual int AnimationLength();
81 
82  // the pointers in cinData_t will remain valid until the next UpdateForTime() call
83  virtual cinData_t ImageForTime( int milliseconds );
84 
85  // closes the file and frees all allocated memory
86  virtual void Close();
87 
88  // closes the file and frees all allocated memory
89  virtual void ResetTime(int time);
90 };
91 
92 /*
93 ===============================================
94 
95  Sound meter.
96 
97 ===============================================
98 */
99 
100 class idSndWindow : public idCinematic {
101 public:
102 
103  idSndWindow() { showWaveform = false; }
105 
106  bool InitFromFile( const char *qpath, bool looping );
107  cinData_t ImageForTime( int milliseconds );
108  int AnimationLength();
109 
110 private:
112 };
113 
114 #endif /* !__CINEMATIC_H__ */
static void ShutdownCinematic(void)
Definition: Cinematic.cpp:183
static void InitCinematic(void)
Definition: Cinematic.cpp:153
cinData_t ImageForTime(int milliseconds)
Definition: Cinematic.cpp:1763
virtual int AnimationLength()
Definition: Cinematic.cpp:226
virtual void Close()
Definition: Cinematic.cpp:254
static idCinematic * Alloc()
Definition: Cinematic.cpp:199
virtual void ResetTime(int time)
Definition: Cinematic.cpp:235
int status
Definition: Cinematic.h:58
virtual bool InitFromFile(const char *qpath, bool looping)
Definition: Cinematic.cpp:217
int AnimationLength()
Definition: Cinematic.cpp:1772
cinStatus_t
Definition: Cinematic.h:44
const byte * image
Definition: Cinematic.h:57
virtual ~idCinematic()
Definition: Cinematic.cpp:208
bool showWaveform
Definition: Cinematic.h:111
unsigned char byte
Definition: Lib.h:75
bool InitFromFile(const char *qpath, bool looping)
Definition: Cinematic.cpp:1746
virtual cinData_t ImageForTime(int milliseconds)
Definition: Cinematic.cpp:243
int imageWidth
Definition: Cinematic.h:56