Cinematic.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 __CINEMATIC_H__
  21. #define __CINEMATIC_H__
  22. /*
  23. ===============================================================================
  24. RoQ cinematic
  25. Multiple idCinematics can run simultaniously.
  26. A single idCinematic can be reused for multiple files if desired.
  27. ===============================================================================
  28. */
  29. // cinematic states
  30. typedef enum {
  31. FMV_IDLE,
  32. FMV_PLAY, // play
  33. FMV_EOF, // all other conditions, i.e. stop/EOF/abort
  34. FMV_ID_BLT,
  35. FMV_ID_IDLE,
  36. FMV_LOOPED,
  37. FMV_ID_WAIT
  38. } cinStatus_t;
  39. // a cinematic stream generates an image buffer, which the caller will upload to a texture
  40. typedef struct {
  41. int imageWidth, imageHeight; // will be a power of 2
  42. const byte * image; // RGBA format, alpha will be 255
  43. int status;
  44. } cinData_t;
  45. class idCinematic {
  46. public:
  47. // initialize cinematic play back data
  48. static void InitCinematic( void );
  49. // shutdown cinematic play back data
  50. static void ShutdownCinematic( void );
  51. // allocates and returns a private subclass that implements the methods
  52. // This should be used instead of new
  53. static idCinematic *Alloc();
  54. // frees all allocated memory
  55. virtual ~idCinematic();
  56. // returns false if it failed to load
  57. virtual bool InitFromFile( const char *qpath, bool looping );
  58. // returns the length of the animation in milliseconds
  59. virtual int AnimationLength();
  60. // the pointers in cinData_t will remain valid until the next UpdateForTime() call
  61. virtual cinData_t ImageForTime( int milliseconds );
  62. // closes the file and frees all allocated memory
  63. virtual void Close();
  64. // closes the file and frees all allocated memory
  65. virtual void ResetTime(int time);
  66. };
  67. /*
  68. ===============================================
  69. Sound meter.
  70. ===============================================
  71. */
  72. class idSndWindow : public idCinematic {
  73. public:
  74. idSndWindow() { showWaveform = false; }
  75. ~idSndWindow() {}
  76. bool InitFromFile( const char *qpath, bool looping );
  77. cinData_t ImageForTime( int milliseconds );
  78. int AnimationLength();
  79. private:
  80. bool showWaveform;
  81. };
  82. #endif /* !__CINEMATIC_H__ */