cl_cinematic.c
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "cl_cinematic.h"
00027 #include "cl_cinematic_ogm.h"
00028 #include "cl_cinematic_roq.h"
00029 #include "../cl_console.h"
00030 #include "../sound/s_main.h"
00031 #include "../sound/s_music.h"
00032
00033 void CIN_InitCinematic (cinematic_t *cin)
00034 {
00035 memset(cin, 0, sizeof(*cin));
00036 }
00037
00043 void CIN_SetParameters (cinematic_t *cin, int x, int y, int w, int h, int status, qboolean noSound)
00044 {
00045 cin->x = x * viddef.rx;
00046 cin->y = y * viddef.ry;
00047 cin->w = w * viddef.rx;
00048 cin->h = h * viddef.ry;
00049 if (status > CIN_STATUS_NONE)
00050 cin->status = status;
00051 cin->noSound = noSound;
00052 }
00053
00057 void CIN_RunCinematic (cinematic_t *cin)
00058 {
00059 assert(cin->status != CIN_STATUS_NONE);
00060
00061
00062 if (cin->cinematicType == CINEMATIC_TYPE_ROQ && CIN_ROQ_RunCinematic(cin))
00063 return;
00064 else if (cin->cinematicType == CINEMATIC_TYPE_OGM && CIN_OGM_RunCinematic(cin))
00065 return;
00066
00067
00068 if (cin->replay) {
00069 char name[MAX_QPATH];
00070 Q_strncpyz(name, cin->name, sizeof(name));
00071 CIN_PlayCinematic(cin, name);
00072 cin->replay = qtrue;
00073 } else {
00074 CIN_StopCinematic(cin);
00075 }
00076 }
00077
00081 void CIN_PlayCinematic (cinematic_t *cin, const char *fileName)
00082 {
00083 char name[MAX_OSPATH];
00084
00085 Com_StripExtension(fileName, name, sizeof(name));
00086
00087
00088 CIN_StopCinematic(cin);
00089
00090 if (FS_CheckFile("%s.roq", name) >= 0)
00091 CIN_ROQ_PlayCinematic(cin, va("%s.roq", name));
00092 else if (FS_CheckFile("%s.ogm", name) >= 0)
00093 CIN_OGM_PlayCinematic(cin, va("%s.ogm", name));
00094 else
00095 Com_Printf("Could not find cinematic '%s'\n", name);
00096 }
00097
00101 void CIN_StopCinematic (cinematic_t *cin)
00102 {
00103 if (cin->status == CIN_STATUS_NONE)
00104 return;
00105
00106 cin->status = CIN_STATUS_NONE;
00107
00108 if (cin->cinematicType == CINEMATIC_TYPE_ROQ)
00109 CIN_ROQ_StopCinematic(cin);
00110 else if (cin->cinematicType == CINEMATIC_TYPE_OGM)
00111 CIN_OGM_StopCinematic(cin);
00112
00113 CIN_InitCinematic(cin);
00114 }
00115
00116 void CIN_Init (void)
00117 {
00118 CIN_ROQ_Init();
00119 CIN_OGM_Init();
00120 }
00121
00122 void CIN_Shutdown (void)
00123 {
00124 }