Non-interactive sequence rendering and AVI recording. More...
#include "client.h"
#include "cl_sequence.h"
#include "battlescape/cl_localentity.h"
#include "battlescape/cl_view.h"
#include "renderer/r_main.h"
#include "renderer/r_draw.h"
#include "renderer/r_mesh_anim.h"
#include "../shared/parse.h"
#include "ui/ui_main.h"
#include "ui/ui_nodes.h"
#include "ui/ui_render.h"
Go to the source code of this file.
Data Structures | |
struct | seqCmd_s |
struct | sequence_s |
struct | seqCamera_s |
struct | seqEnt_s |
struct | seq2D_s |
Represents a text object or image object. More... | |
struct | sequenceContext_s |
Defines | |
#define | MAX_DATA_LENGTH 2048 |
#define | MAX_SEQCMDS 8192 |
#define | MAX_SEQUENCES 32 |
#define | MAX_SEQENTS 128 |
#define | MAX_SEQ2DS 128 |
#define | SEQ_NUMCMDS lengthof(seqCmdName) |
Typedefs | |
typedef int(* | sequenceHandler_t )(struct sequenceContext_s *context, const char *name, const char *data) |
execution function of a command | |
typedef struct seqCmd_s | seqCmd_t |
typedef struct sequence_s | sequence_t |
typedef struct seqCamera_s | seqCamera_t |
typedef struct seqEnt_s | seqEnt_t |
typedef struct seq2D_s | seq2D_t |
Represents a text object or image object. | |
typedef struct sequenceContext_s | sequenceContext_t |
Functions | |
static void | SEQ_SetCamera (sequenceContext_t *context) |
Set the camera values for a sequence. | |
static seqEnt_t * | SEQ_FindEnt (sequenceContext_t *context, const char *name) |
Finds a given entity in all sequence entities. | |
static seq2D_t * | SEQ_Find2D (sequenceContext_t *context, const char *name) |
Finds a given 2d object in the current sequence data. | |
static void | SEQ_Render3D (sequenceContext_t *context) |
static void | SEQ_Render2D (sequenceContext_t *context) |
Renders text and images. | |
static void | SEQ_ClickEvent (sequenceContext_t *context) |
Unlock a click event for the current sequence or ends the current sequence if not locked. | |
static qboolean | SEQ_InitSequence (sequenceContext_t *context, const char *name) |
static void | SEQ_StopSequence (sequenceContext_t *context) |
static qboolean | SEQ_Execute (sequenceContext_t *context) |
Move the sequence to the right position according to the current time. | |
static int | SEQ_ExecuteClick (sequenceContext_t *context, const char *name, const char *data) |
Wait until someone clicks with the mouse. | |
static int | SEQ_ExecuteWait (sequenceContext_t *context, const char *name, const char *data) |
Increase the sequence time. | |
static int | SEQ_ExecutePrecache (sequenceContext_t *context, const char *name, const char *data) |
Precaches the models and images for a sequence. | |
static int | SEQ_ExecuteCamera (sequenceContext_t *context, const char *name, const char *data) |
Parse the values for the camera like given in seqCamera. | |
static int | SEQ_ExecuteModel (sequenceContext_t *context, const char *name, const char *data) |
Parse values for a sequence model. | |
static int | SEQ_ExecuteMusic (sequenceContext_t *context, const char *name, const char *data) |
Changes the music in the sequence. | |
static int | SEQ_ExecuteSound (sequenceContext_t *context, const char *name, const char *data) |
Plays a sound in a sequence. | |
static int | SEQ_Execute2Dobj (sequenceContext_t *context, const char *name, const char *data) |
Parse 2D objects like text and images. | |
static int | SEQ_ExecuteRemove (sequenceContext_t *context, const char *name, const char *data) |
Removed a sequence entity from the current sequence. | |
static int | SEQ_ExecuteCommand (sequenceContext_t *context, const char *name, const char *data) |
Executes a sequence command. | |
static void | CL_SequenceClick_f (void) |
Unlock a click event for the current sequence or ends the current sequence if not locked. | |
static void | CL_SequenceStart_f (void) |
Start a sequence. | |
static void | CL_SequenceEnd_f (void) |
Sets the client state to ca_disconnected. | |
void | CL_SequenceRender (void) |
void | SEQ_InitStartup (void) |
CASSERT (lengthof(seqCmdFunc)==lengthof(seqCmdName)) | |
void | CL_ParseSequence (const char *name, const char **text) |
Reads the sequence values from given text-pointer. | |
Variables | |
static sequence_t | sequences [MAX_SEQUENCES] |
static int | numSequences |
static seqCmd_t | seqCmds [MAX_SEQCMDS] |
static int | numSeqCmds |
static const value_t | seqCamera_vals [] |
valid id names for camera | |
static const value_t | seqEnt_vals [] |
valid entity names for a sequence | |
static const value_t | seq2D_vals [] |
valid id names for 2d entity | |
sequenceContext_t | seq |
static const char * | seqCmdName [] |
static sequenceHandler_t | seqCmdFunc [] |
Function to exeute all available commands. |
Non-interactive sequence rendering and AVI recording.
Definition in file cl_sequence.c.
#define MAX_DATA_LENGTH 2048 |
Definition at line 40 of file cl_sequence.c.
Referenced by CL_ParseSequence().
#define MAX_SEQ2DS 128 |
Definition at line 116 of file cl_sequence.c.
Referenced by SEQ_Execute2Dobj().
#define MAX_SEQCMDS 8192 |
Definition at line 113 of file cl_sequence.c.
Referenced by CL_ParseSequence().
#define MAX_SEQENTS 128 |
Definition at line 115 of file cl_sequence.c.
Referenced by SEQ_ExecuteModel().
#define MAX_SEQUENCES 32 |
Definition at line 114 of file cl_sequence.c.
Referenced by CL_ParseSequence().
#define SEQ_NUMCMDS lengthof(seqCmdName) |
Definition at line 839 of file cl_sequence.c.
Referenced by CL_ParseSequence().
typedef struct seqCamera_s seqCamera_t |
typedef struct sequence_s sequence_t |
typedef struct sequenceContext_s sequenceContext_t |
Sequence context
typedef int(* sequenceHandler_t)(struct sequenceContext_s *context, const char *name, const char *data) |
execution function of a command
Definition at line 48 of file cl_sequence.c.
CASSERT | ( | lengthof(seqCmdFunc) | = =lengthof(seqCmdName) |
) |
void CL_ParseSequence | ( | const char * | name, | |
const char ** | text | |||
) |
Reads the sequence values from given text-pointer.
Definition at line 863 of file cl_sequence.c.
References Com_EParse(), Com_Error(), Com_Parse(), Com_Printf(), seqCmd_s::data, data, ERR_FATAL, seqCmd_s::handler, i, sequence_s::length, MAX_DATA_LENGTH, MAX_SEQCMDS, MAX_SEQUENCES, seqCmd_s::name, sequence_s::name, numSeqCmds, numSequences, Q_strncpyz(), SEQ_NUMCMDS, seqCmdFunc, seqCmdName, and sequence_s::start.
Referenced by CL_ParseClientData().
static void CL_SequenceClick_f | ( | void | ) | [static] |
Unlock a click event for the current sequence or ends the current sequence if not locked.
Definition at line 730 of file cl_sequence.c.
References SEQ_ClickEvent().
Referenced by SEQ_InitStartup().
static void CL_SequenceEnd_f | ( | void | ) | [static] |
Sets the client state to ca_disconnected.
Definition at line 775 of file cl_sequence.c.
References ca_disconnected, ca_sequence, CL_SetClientState(), cls, and client_static_s::state.
Referenced by CL_SequenceRender(), and SEQ_InitStartup().
void CL_SequenceRender | ( | void | ) |
Definition at line 781 of file cl_sequence.c.
References rendererData_t::aliasCount, rendererData_t::brushCount, cl, CL_SequenceEnd_f(), CL_ViewUpdateRenderData(), rendererData_t::mapTiles, rendererData_t::numEntities, qfalse, R_RenderFrame(), RDF_NOWORLDMODEL, rendererData_t::ready, refdef, rendererData_t::rendererFlags, SEQ_Execute(), SEQ_Render2D(), SEQ_Render3D(), UI_PopWindow(), viddef, viddef_t::viewHeight, and viddef_t::viewWidth.
Referenced by SCR_UpdateScreen().
static void CL_SequenceStart_f | ( | void | ) | [static] |
Start a sequence.
Definition at line 739 of file cl_sequence.c.
References ca_sequence, CL_Disconnect(), CL_SetClientState(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), mn_sequence, name, qfalse, SEQ_InitSequence(), cvar_s::string, SV_Shutdown(), and UI_PushWindow().
Referenced by SEQ_InitStartup().
static void SEQ_ClickEvent | ( | sequenceContext_t * | context | ) | [static] |
Unlock a click event for the current sequence or ends the current sequence if not locked.
Definition at line 395 of file cl_sequence.c.
References sequenceContext_s::endClickLoop, and qtrue.
Referenced by CL_SequenceClick_f().
static qboolean SEQ_Execute | ( | sequenceContext_t * | context | ) | [static] |
Move the sequence to the right position according to the current time.
context |
Definition at line 435 of file cl_sequence.c.
References cl, sequenceContext_s::currentCmd, seqCmd_s::data, sequenceContext_s::endClickLoop, sequenceContext_s::endCmd, seqCmd_s::handler, seqCmd_s::name, qfalse, qtrue, SEQ_StopSequence(), and sequenceContext_s::time.
Referenced by CL_SequenceRender().
static int SEQ_Execute2Dobj | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Parse 2D objects like text and images.
Definition at line 623 of file cl_sequence.c.
References cl_genericPool, seq2D_s::color, Com_EParseValue(), Com_Error(), Com_Printf(), ERR_FATAL, seq2D_s::font, i, seq2D_s::inuse, MAX_SEQ2DS, Mem_PoolStrDupTo, seq2D_s::name, sequenceContext_s::numObj2Ds, sequenceContext_s::obj2Ds, value_s::ofs, Q_strncpyz(), qtrue, SEQ_Find2D(), value_s::size, value_s::string, value_s::type, V_CLIENT_HUNK_STRING, and V_TRANSLATION_STRING.
static int SEQ_ExecuteCamera | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Parse the values for the camera like given in seqCamera.
Definition at line 522 of file cl_sequence.c.
References sequenceContext_s::camera, Com_EParseValue(), Com_Printf(), value_s::ofs, value_s::size, value_s::string, and value_s::type.
static int SEQ_ExecuteClick | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Wait until someone clicks with the mouse.
Definition at line 471 of file cl_sequence.c.
References sequenceContext_s::endClickLoop, qfalse, and sequenceContext_s::time.
static int SEQ_ExecuteCommand | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Executes a sequence command.
Definition at line 711 of file cl_sequence.c.
References Cbuf_AddText().
static int SEQ_ExecuteModel | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Parse values for a sequence model.
Definition at line 547 of file cl_sequence.c.
References seqEnt_s::as, seqEnt_s::color, Com_DPrintf(), Com_EParseValue(), Com_Error(), Com_Printf(), DEBUG_CLIENT, sequenceContext_s::ents, ERR_FATAL, i, seqEnt_s::inuse, MAX_SEQENTS, seqEnt_s::model, seqEnt_s::name, sequenceContext_s::numEnts, value_s::ofs, Q_strncpyz(), qtrue, R_AnimChange(), R_RegisterModelShort(), SEQ_FindEnt(), value_s::size, value_s::string, value_s::type, and VectorSet.
static int SEQ_ExecuteMusic | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Changes the music in the sequence.
Definition at line 600 of file cl_sequence.c.
References Com_Printf(), and Cvar_Set().
static int SEQ_ExecutePrecache | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Precaches the models and images for a sequence.
Definition at line 500 of file cl_sequence.c.
References Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, R_RegisterImage(), and R_RegisterModelShort().
static int SEQ_ExecuteRemove | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Removed a sequence entity from the current sequence.
Definition at line 682 of file cl_sequence.c.
References Com_Printf(), seq2D_s::inuse, seqEnt_s::inuse, Mem_Free, qfalse, SEQ_Find2D(), SEQ_FindEnt(), and seq2D_s::text.
static int SEQ_ExecuteSound | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Plays a sound in a sequence.
Definition at line 611 of file cl_sequence.c.
References S_StartLocalSample(), and SND_VOLUME_DEFAULT.
static int SEQ_ExecuteWait | ( | sequenceContext_t * | context, | |
const char * | name, | |||
const char * | data | |||
) | [static] |
Increase the sequence time.
Definition at line 488 of file cl_sequence.c.
References sequenceContext_s::time.
static seq2D_t* SEQ_Find2D | ( | sequenceContext_t * | context, | |
const char * | name | |||
) | [static] |
Finds a given 2d object in the current sequence data.
Definition at line 254 of file cl_sequence.c.
References i, seq2D_s::inuse, seq2D_s::name, and sequenceContext_s::obj2Ds.
Referenced by SEQ_Execute2Dobj(), and SEQ_ExecuteRemove().
static seqEnt_t* SEQ_FindEnt | ( | sequenceContext_t * | context, | |
const char * | name | |||
) | [static] |
Finds a given entity in all sequence entities.
Definition at line 235 of file cl_sequence.c.
References sequenceContext_s::ents, i, seqEnt_s::inuse, MAX_VAR, and seqEnt_s::name.
Referenced by SEQ_ExecuteModel(), SEQ_ExecuteRemove(), and SEQ_Render3D().
static qboolean SEQ_InitSequence | ( | sequenceContext_t * | context, | |
const char * | name | |||
) | [static] |
Definition at line 400 of file cl_sequence.c.
References sequenceContext_s::animspeed, cl, Com_Printf(), sequenceContext_s::currentCmd, Cvar_Get(), sequenceContext_s::endCmd, i, sequence_s::length, sequence_s::name, sequenceContext_s::numEnts, sequenceContext_s::numObj2Ds, numSequences, qfalse, qtrue, sequence_s::start, and sequenceContext_s::time.
Referenced by CL_SequenceStart_f().
void SEQ_InitStartup | ( | void | ) |
Definition at line 815 of file cl_sequence.c.
References CL_SequenceClick_f(), CL_SequenceEnd_f(), CL_SequenceStart_f(), and Cmd_AddCommand().
Referenced by CL_InitLocal().
static void SEQ_Render2D | ( | sequenceContext_t * | context | ) | [static] |
Renders text and images.
Definition at line 323 of file cl_sequence.c.
References _, seq2D_s::align, seq2D_s::bgcolor, cls, seq2D_s::color, seq2D_s::enlarge, seq2D_s::fade, seq2D_s::font, client_static_s::frametime, i, seq2D_s::image, int(), seq2D_s::inuse, it_pic, LONGLINES_WRAP, sequenceContext_s::obj2Ds, seq2D_s::pos, pos, qfalse, R_Color(), R_DrawFill(), R_DrawImage(), R_FindImage(), seq2D_s::relativePos, seq2D_s::size, seq2D_s::speed, seq2D_s::text, UI_DrawString(), UI_Transform(), VID_NORM_HEIGHT, VID_NORM_WIDTH, viddef, viddef_t::virtualHeight, and viddef_t::virtualWidth.
Referenced by CL_SequenceRender().
static void SEQ_Render3D | ( | sequenceContext_t * | context | ) | [static] |
Definition at line 275 of file cl_sequence.c.
References seqEnt_s::alpha, seqEnt_s::angles, sequenceContext_s::animspeed, seqEnt_s::as, cls, sequenceContext_s::ents, seqEnt_s::ep, client_static_s::frametime, i, cvar_s::integer, seqEnt_s::inuse, seqEnt_s::model, seqEnt_s::omega, seqEnt_s::origin, seqEnt_s::parent, R_AddEntity(), R_AnimRun(), R_EntitySetOrigin(), R_GetFreeEntity(), SEQ_FindEnt(), SEQ_SetCamera(), seqEnt_s::skin, seqEnt_s::speed, seqEnt_s::tag, VectorCopy, and VectorMA().
Referenced by CL_SequenceRender().
static void SEQ_SetCamera | ( | sequenceContext_t * | context | ) | [static] |
Set the camera values for a sequence.
Definition at line 206 of file cl_sequence.c.
References seqCamera_s::angles, AngleVectors(), sequenceContext_s::camera, cl, cl_isometric, CL_ViewCalcFieldOfViewX(), cls, seqCamera_s::ddist, seqCamera_s::dist, seqCamera_s::dzoom, client_static_s::frametime, cvar_s::integer, MIN_ZOOM, seqCamera_s::omega, seqCamera_s::origin, seqCamera_s::speed, VectorCopy, VectorMA(), viddef, viddef_t::viewHeight, viddef_t::viewWidth, and seqCamera_s::zoom.
Referenced by SEQ_Render3D().
static void SEQ_StopSequence | ( | sequenceContext_t * | context | ) | [static] |
Definition at line 425 of file cl_sequence.c.
References sequenceContext_s::endClickLoop, and qtrue.
Referenced by SEQ_Execute().
int numSeqCmds [static] |
Definition at line 127 of file cl_sequence.c.
Referenced by CL_ParseSequence().
int numSequences [static] |
Definition at line 123 of file cl_sequence.c.
Referenced by CL_ParseSequence(), and SEQ_InitSequence().
Definition at line 723 of file cl_sequence.c.
const value_t seq2D_vals[] [static] |
{ {"name", V_STRING, offsetof(seq2D_t, name), 0}, {"text", V_TRANSLATION_STRING, offsetof(seq2D_t, text), 0}, {"font", V_STRING, offsetof(seq2D_t, font), 0}, {"image", V_STRING, offsetof(seq2D_t, image), 0}, {"pos", V_POS, offsetof(seq2D_t, pos), MEMBER_SIZEOF(seq2D_t, pos)}, {"speed", V_POS, offsetof(seq2D_t, speed), MEMBER_SIZEOF(seq2D_t, speed)}, {"size", V_POS, offsetof(seq2D_t, size), MEMBER_SIZEOF(seq2D_t, size)}, {"enlarge", V_POS, offsetof(seq2D_t, enlarge), MEMBER_SIZEOF(seq2D_t, enlarge)}, {"bgcolor", V_COLOR, offsetof(seq2D_t, bgcolor), MEMBER_SIZEOF(seq2D_t, bgcolor)}, {"color", V_COLOR, offsetof(seq2D_t, color), MEMBER_SIZEOF(seq2D_t, color)}, {"fade", V_COLOR, offsetof(seq2D_t, fade), MEMBER_SIZEOF(seq2D_t, fade)}, {"align", V_ALIGN, offsetof(seq2D_t, align), MEMBER_SIZEOF(seq2D_t, align)}, {"relative", V_BOOL, offsetof(seq2D_t, relativePos), MEMBER_SIZEOF(seq2D_t, relativePos)}, {NULL, 0, 0, 0}, }
valid id names for 2d entity
Definition at line 185 of file cl_sequence.c.
const value_t seqCamera_vals[] [static] |
{ {"origin", V_VECTOR, offsetof(seqCamera_t, origin), MEMBER_SIZEOF(seqCamera_t, origin)}, {"speed", V_VECTOR, offsetof(seqCamera_t, speed), MEMBER_SIZEOF(seqCamera_t, speed)}, {"angles", V_VECTOR, offsetof(seqCamera_t, angles), MEMBER_SIZEOF(seqCamera_t, angles)}, {"omega", V_VECTOR, offsetof(seqCamera_t, omega), MEMBER_SIZEOF(seqCamera_t, omega)}, {"dist", V_FLOAT, offsetof(seqCamera_t, dist), MEMBER_SIZEOF(seqCamera_t, dist)}, {"ddist", V_FLOAT, offsetof(seqCamera_t, ddist), MEMBER_SIZEOF(seqCamera_t, ddist)}, {"zoom", V_FLOAT, offsetof(seqCamera_t, zoom), MEMBER_SIZEOF(seqCamera_t, zoom)}, {"dzoom", V_FLOAT, offsetof(seqCamera_t, dzoom), MEMBER_SIZEOF(seqCamera_t, dzoom)}, {NULL, 0, 0, 0} }
valid id names for camera
Definition at line 157 of file cl_sequence.c.
sequenceHandler_t seqCmdFunc[] [static] |
{ NULL, SEQ_ExecuteWait, SEQ_ExecuteClick, SEQ_ExecutePrecache, SEQ_ExecuteCamera, SEQ_ExecuteModel, SEQ_Execute2Dobj, SEQ_ExecuteMusic, SEQ_ExecuteSound, SEQ_ExecuteRemove, SEQ_ExecuteCommand }
Function to exeute all available commands.
Definition at line 844 of file cl_sequence.c.
Referenced by CL_ParseSequence().
const char* seqCmdName[] [static] |
{ "end", "wait", "click", "precache", "camera", "model", "2dobj", "music", "sound", "rem", "cmd" }
Definition at line 825 of file cl_sequence.c.
Referenced by CL_ParseSequence().
Store all sequence commands
Definition at line 126 of file cl_sequence.c.
const value_t seqEnt_vals[] [static] |
{ {"name", V_STRING, offsetof(seqEnt_t, name), 0}, {"skin", V_INT, offsetof(seqEnt_t, skin), MEMBER_SIZEOF(seqEnt_t, skin)}, {"alpha", V_FLOAT, offsetof(seqEnt_t, alpha), MEMBER_SIZEOF(seqEnt_t, alpha)}, {"origin", V_VECTOR, offsetof(seqEnt_t, origin), MEMBER_SIZEOF(seqEnt_t, origin)}, {"speed", V_VECTOR, offsetof(seqEnt_t, speed), MEMBER_SIZEOF(seqEnt_t, speed)}, {"angles", V_VECTOR, offsetof(seqEnt_t, angles), MEMBER_SIZEOF(seqEnt_t, angles)}, {"omega", V_VECTOR, offsetof(seqEnt_t, omega), MEMBER_SIZEOF(seqEnt_t, omega)}, {"color", V_VECTOR, offsetof(seqEnt_t, color), MEMBER_SIZEOF(seqEnt_t, color)}, {"parent", V_STRING, offsetof(seqEnt_t, parent), 0}, {"tag", V_STRING, offsetof(seqEnt_t, tag), 0}, {NULL, 0, 0, 0} }
valid entity names for a sequence
Definition at line 170 of file cl_sequence.c.
sequence_t sequences[MAX_SEQUENCES] [static] |
Global content
Store main sequence entries
Definition at line 122 of file cl_sequence.c.