UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_cinematic.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25
26#include "cl_cinematic.h"
27#include "cl_cinematic_ogm.h"
28#include "cl_cinematic_roq.h"
29#include "../cl_console.h"
30#include "../sound/s_main.h"
31#include "../sound/s_music.h"
32/* trying to get rid of client.h ... */
33#include <assert.h>
34#include "../cl_video.h" /* viddef */
35#include "../../shared/shared.h" /* Q_strncpyz */
36
38{
39 OBJZERO(*cin);
40}
41
47void CIN_SetParameters (cinematic_t* cin, int x, int y, int w, int h, int status, bool noSound)
48{
49 cin->x = x * viddef.rx;
50 cin->y = y * viddef.ry;
51 cin->w = w * viddef.rx;
52 cin->h = h * viddef.ry;
53 if (status > CIN_STATUS_NONE)
54 cin->status = status;
55 cin->noSound = noSound;
56}
57
62{
63 assert(cin->status != CIN_STATUS_NONE);
64
65 /* Decode chunks until the desired frame is reached */
67 return;
69 return;
70
71 /* If we get here, the cinematic has either finished or failed */
72 if (cin->replay) {
73 char name[MAX_QPATH];
74 Q_strncpyz(name, cin->name, sizeof(name));
76 cin->replay = true;
77 } else {
79 }
80}
81
86void CIN_OpenCinematic (cinematic_t* cin, const char* fileName)
87{
88 char name[MAX_OSPATH];
89 int status = 1;
90
91 Com_StripExtension(fileName, name, sizeof(name));
92
93 /* If already playing a cinematic, stop it */
95
96 if (FS_CheckFile("%s.roq", name) >= 0)
97 status = CIN_ROQ_OpenCinematic(cin, va("%s.roq", name));
98 else if (FS_CheckFile("%s.ogm", name) >= 0)
99 status = CIN_OGM_OpenCinematic(cin, va("%s.ogm", name));
100
101 if (status != 0) {
102 Com_Printf("Could not load cinematic '%s'\n", name);
104 }
105}
106
112{
113 if (cin->status == CIN_STATUS_NONE)
114 return; /* Not playing */
115
116 cin->status = CIN_STATUS_NONE;
117
120 else if (cin->cinematicType == CINEMATIC_TYPE_OGM)
122
124}
125
126void CIN_Init (void)
127{
128 CIN_ROQ_Init();
129 CIN_OGM_Init();
130}
131
132void CIN_Shutdown (void)
133{
134}
void CIN_InitCinematic(cinematic_t *cin)
void CIN_RunCinematic(cinematic_t *cin)
void CIN_Shutdown(void)
void CIN_SetParameters(cinematic_t *cin, int x, int y, int w, int h, int status, bool noSound)
void CIN_OpenCinematic(cinematic_t *cin, const char *fileName)
Open a cinematic file and store status to a structure.
void CIN_Init(void)
void CIN_CloseCinematic(cinematic_t *cin)
Close a cinematic, and clean up status and memory.
Header file for cinematics.
@ CINEMATIC_TYPE_OGM
@ CINEMATIC_TYPE_ROQ
@ CIN_STATUS_NONE
@ CIN_STATUS_INVALID
bool CIN_OGM_RunCinematic(cinematic_t *cin)
void CIN_OGM_Init(void)
void CIN_OGM_CloseCinematic(cinematic_t *cin)
int CIN_OGM_OpenCinematic(cinematic_t *cin, const char *filename)
Header file for OGM cinematics.
int CIN_ROQ_OpenCinematic(cinematic_t *cin, const char *fileName)
void CIN_ROQ_CloseCinematic(cinematic_t *cin)
void CIN_ROQ_Init(void)
bool CIN_ROQ_RunCinematic(cinematic_t *cin)
Header file for ROQ cinematics.
Console header file.
viddef_t viddef
Definition cl_video.cpp:34
Video driver defs.
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
Definition files.cpp:298
#define MAX_OSPATH
Definition filesys.h:44
#define MAX_QPATH
Definition filesys.h:40
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
Specifies sound API?
Specifies music API.
#define OBJZERO(obj)
Definition shared.h:178
void Com_StripExtension(const char *in, char *out, const size_t size)
Removes the file extension from a filename.
Definition shared.cpp:259
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
Definition shared.cpp:457
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Definition shared.cpp:410
char name[MAX_QPATH]