ui_node_video.c
Go to the documentation of this file.00001
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "../ui_nodes.h"
00032 #include "../ui_parse.h"
00033 #include "../ui_draw.h"
00034 #include "ui_node_video.h"
00035 #include "ui_node_abstractnode.h"
00036
00037 #include "../../client.h"
00038 #include "../../cinematic/cl_cinematic.h"
00039
00040 #define EXTRADATA_TYPE videoExtraData_t
00041 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
00042 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
00043
00044 static void UI_VideoNodeDrawOverWindow (uiNode_t *node)
00045 {
00046 if (EXTRADATA(node).cin.status == CIN_STATUS_NONE) {
00047 vec2_t pos;
00048 qboolean nosound = UI_VIDEOEXTRADATACONST(node).nosound;
00049
00050 CIN_PlayCinematic(&(EXTRADATA(node).cin), va("videos/%s", (const char *)node->image));
00051
00052 UI_GetNodeAbsPos(node, pos);
00053 CIN_SetParameters(&(EXTRADATA(node).cin), pos[0], pos[1], node->size[0], node->size[1], CIN_STATUS_PLAYING, nosound);
00054 }
00055
00056 if (EXTRADATA(node).cin.status) {
00057
00058 CIN_RunCinematic(&(EXTRADATA(node).cin));
00059 }
00060 }
00061
00062 static void UI_VideoNodeDraw (uiNode_t *node)
00063 {
00064 if (!node->image)
00065 return;
00066
00067 if (EXTRADATA(node).cin.fullScreen) {
00068 UI_CaptureDrawOver(node);
00069 return;
00070 }
00071
00072 UI_VideoNodeDrawOverWindow(node);
00073 }
00074
00075 static void UI_VideoNodeInit (uiNode_t *node)
00076 {
00077 CIN_InitCinematic(&(EXTRADATA(node).cin));
00078 }
00079
00080 static void UI_VideoNodeClose (uiNode_t *node)
00081 {
00082
00083 CIN_StopCinematic(&(EXTRADATA(node).cin));
00084 }
00085
00086 static const value_t properties[] = {
00088 {"src", V_CVAR_OR_STRING, offsetof(uiNode_t, image), 0},
00089 {"nosound", V_BOOL, UI_EXTRADATA_OFFSETOF(EXTRADATA_TYPE, nosound), MEMBER_SIZEOF(EXTRADATA_TYPE, nosound)},
00090 {NULL, V_NULL, 0, 0}
00091 };
00092
00093 void UI_RegisterVideoNode (uiBehaviour_t* behaviour)
00094 {
00095 behaviour->name = "video";
00096 behaviour->draw = UI_VideoNodeDraw;
00097 behaviour->properties = properties;
00098 behaviour->init = UI_VideoNodeInit;
00099 behaviour->close = UI_VideoNodeClose;
00100 behaviour->drawOverWindow = UI_VideoNodeDrawOverWindow;
00101 behaviour->extraDataSize = sizeof(EXTRADATA_TYPE);
00102 }