UFO: Alien Invasion
|
Non-interactive sequence rendering and AVI recording. More...
#include "cl_sequence.h"
#include "../client.h"
#include "../battlescape/cl_localentity.h"
#include "../battlescape/cl_view.h"
#include "../renderer/r_main.h"
#include "../renderer/r_draw.h"
#include "../renderer/r_misc.h"
#include "../renderer/r_mesh_anim.h"
#include "../cl_language.h"
#include "../../shared/parse.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 |
Macros | |
#define | MAX_DATA_LENGTH 512 |
#define | MAX_SEQCMDS 768 |
#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 More... | |
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. More... | |
typedef struct sequenceContext_s | sequenceContext_t |
Functions | |
static void | SEQ_SetCamera (sequenceContext_t *context) |
Set the camera values for a sequence. More... | |
static seqEnt_t * | SEQ_FindEnt (sequenceContext_t *context, const char *name) |
Finds a given entity in all sequence entities. More... | |
static seq2D_t * | SEQ_Find2D (sequenceContext_t *context, const char *name) |
Finds a given 2d object in the current sequence data. More... | |
static void | SEQ_Render3D (sequenceContext_t *context) |
static void | SEQ_Render2D (sequenceContext_t *context, bool backgroundObjects) |
Renders text and images. More... | |
void | SEQ_SendClickEvent (sequenceContext_t *context) |
Unlock a click event for the current sequence or ends the current sequence if not locked. More... | |
void | SEQ_SetView (sequenceContext_t *context, vec2_t pos, vec2_t size) |
Define the position of the viewport on the screen. More... | |
bool | SEQ_InitContext (sequenceContext_t *context, const char *name) |
Initialize a sequence context from data of a named script sequence. More... | |
static void | SEQ_StopSequence (sequenceContext_t *context) |
static bool | SEQ_Execute (sequenceContext_t *context) |
Move the sequence to the right position according to the current time. More... | |
bool | SEQ_Render (sequenceContext_t *context) |
Execute and render a sequence. More... | |
sequenceContext_t * | SEQ_AllocContext (void) |
Allocate a sequence context. More... | |
void | SEQ_FreeContext (sequenceContext_t *context) |
Free a sequence context. More... | |
static int | SEQ_ExecuteClick (sequenceContext_t *context, const char *name, const char *data) |
Wait until someone clicks with the mouse. More... | |
static int | SEQ_ExecuteWait (sequenceContext_t *context, const char *name, const char *data) |
Increase the sequence time. More... | |
static int | SEQ_ExecuteAnimSpeed (sequenceContext_t *context, const char *name, const char *data) |
Set the animation speed, default value is 1000. More... | |
static int | SEQ_ExecutePrecache (sequenceContext_t *context, const char *name, const char *data) |
Precaches the models and images for a sequence. More... | |
static int | SEQ_ExecuteCamera (sequenceContext_t *context, const char *name, const char *data) |
Parse the values for the camera like given in seqCamera. More... | |
static int | SEQ_ExecuteModel (sequenceContext_t *context, const char *name, const char *data) |
Parse values for a sequence model. More... | |
static int | SEQ_ExecuteMusic (sequenceContext_t *context, const char *name, const char *data) |
Changes the music in the sequence. More... | |
static int | SEQ_ExecuteSound (sequenceContext_t *context, const char *name, const char *data) |
Plays a sound in a sequence. More... | |
static int | SEQ_ExecuteObj2D (sequenceContext_t *context, const char *name, const char *data) |
Parse 2D objects like text and images. More... | |
static int | SEQ_ExecuteDelete (sequenceContext_t *context, const char *name, const char *data) |
Removed a sequence entity from the current sequence. More... | |
static int | SEQ_ExecuteCommand (sequenceContext_t *context, const char *name, const char *data) |
Executes a sequence command. More... | |
CASSERT (lengthof(seqCmdFunc)==lengthof(seqCmdName)) | |
static int | CL_FindSequenceCommand (const char *commandName) |
void | CL_ParseSequence (const char *name, const char **text) |
Reads the sequence values from given text-pointer. More... | |
void | SEQ_Shutdown (void) |
Variables | |
static sequence_t | sequences [MAX_SEQUENCES] |
static int | numSequences |
static seqCmd_t * | seqCmds |
static int | numSeqCmds |
static const value_t | seqCamera_vals [] |
valid id names for camera More... | |
static const value_t | seqEnt_vals [] |
valid entity names for a sequence More... | |
static const value_t | seq2D_vals [] |
valid id names for 2d entity More... | |
static char const *const | seqCmdName [] |
static sequenceHandler_t | seqCmdFunc [] |
Function to exeute all available commands. More... | |
Non-interactive sequence rendering and AVI recording.
Definition in file cl_sequence.cpp.
#define MAX_DATA_LENGTH 512 |
Definition at line 41 of file cl_sequence.cpp.
Referenced by CL_ParseSequence().
#define MAX_SEQ2DS 128 |
Definition at line 120 of file cl_sequence.cpp.
Referenced by SEQ_ExecuteObj2D().
#define MAX_SEQCMDS 768 |
Definition at line 117 of file cl_sequence.cpp.
Referenced by CL_ParseSequence().
#define MAX_SEQENTS 128 |
Definition at line 119 of file cl_sequence.cpp.
Referenced by SEQ_ExecuteModel().
#define MAX_SEQUENCES 32 |
Definition at line 118 of file cl_sequence.cpp.
Referenced by CL_ParseSequence().
#define SEQ_NUMCMDS lengthof(seqCmdName) |
Definition at line 838 of file cl_sequence.cpp.
Referenced by CL_FindSequenceCommand().
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
0
if the same command should be executed again - or 1
to execute the next event Definition at line 49 of file cl_sequence.cpp.
CASSERT | ( | lengthof(seqCmdFunc) | = =lengthof(seqCmdName) | ) |
|
static |
Find a sequence command by name
Definition at line 864 of file cl_sequence.cpp.
References i, Q_streq, SEQ_NUMCMDS, and seqCmdName.
Referenced by CL_ParseSequence().
void CL_ParseSequence | ( | const char * | name, |
const char ** | text | ||
) |
Reads the sequence values from given text-pointer.
Definition at line 878 of file cl_sequence.cpp.
References CL_FindSequenceCommand(), cl_genericPool, Com_EParse(), Com_Error(), Com_Parse(), Com_ParseList(), Com_Printf(), Com_UnParseLastToken(), seqCmd_s::data, ERR_DROP, ERR_FATAL, seqCmd_s::handler, i, sequence_s::length, LIST_Delete(), MAX_DATA_LENGTH, MAX_SEQCMDS, MAX_SEQUENCES, Mem_PoolAllocTypeN, seqCmd_s::name, sequence_s::name, linkedList_t::next, numSeqCmds, numSequences, OBJZERO, Q_streq, Q_strncpyz(), seqCmdFunc, sequence_s::start, and v.
Referenced by CL_ParseClientData().
sequenceContext_t* SEQ_AllocContext | ( | void | ) |
Allocate a sequence context.
Definition at line 545 of file cl_sequence.cpp.
References Mem_AllocType.
Referenced by uiSequenceNode::onWindowOpened().
|
static |
Move the sequence to the right position according to the current time.
context |
Definition at line 486 of file cl_sequence.cpp.
References cl, sequenceContext_s::currentCmd, seqCmd_s::data, sequenceContext_s::endClickLoop, sequenceContext_s::endCmd, seqCmd_s::handler, seqCmd_s::name, SEQ_StopSequence(), clientBattleScape_s::time, and sequenceContext_s::time.
Referenced by SEQ_Render().
|
static |
Set the animation speed, default value is 1000.
Definition at line 594 of file cl_sequence.cpp.
References sequenceContext_s::animspeed.
|
static |
Parse the values for the camera like given in seqCamera.
Definition at line 628 of file cl_sequence.cpp.
References sequenceContext_s::camera, Com_EParseValue(), Com_Printf(), value_s::ofs, Q_streq, value_s::size, value_s::string, and value_s::type.
|
static |
Wait until someone clicks with the mouse.
Definition at line 567 of file cl_sequence.cpp.
References sequenceContext_s::endClickLoop, and sequenceContext_s::time.
|
static |
Executes a sequence command.
Definition at line 813 of file cl_sequence.cpp.
References Cbuf_AddText().
|
static |
Removed a sequence entity from the current sequence.
Definition at line 789 of file cl_sequence.cpp.
References Com_Printf(), seqEnt_s::inuse, seq2D_s::inuse, Mem_Free, SEQ_Find2D(), SEQ_FindEnt(), and seq2D_s::text.
|
static |
Parse values for a sequence model.
Definition at line 653 of file cl_sequence.cpp.
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, OBJZERO, value_s::ofs, Q_streq, Q_strncpyz(), R_AnimChange(), R_FindModel(), SEQ_FindEnt(), value_s::size, value_s::string, value_s::type, and VectorSet.
|
static |
Changes the music in the sequence.
Definition at line 710 of file cl_sequence.cpp.
References Com_DPrintf(), Cvar_Set(), and DEBUG_CLIENT.
|
static |
Parse 2D objects like text and images.
Definition at line 733 of file cl_sequence.cpp.
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, OBJZERO, value_s::ofs, Q_streq, Q_strncpyz(), SEQ_Find2D(), value_s::size, value_s::string, value_s::type, V_HUNK_STRING, and V_TRANSLATION_STRING.
|
static |
Precaches the models and images for a sequence.
Definition at line 606 of file cl_sequence.cpp.
References Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, Q_streq, R_FindModel(), and R_FindPics().
|
static |
Plays a sound in a sequence.
Definition at line 721 of file cl_sequence.cpp.
References S_StartLocalSample(), and SND_VOLUME_DEFAULT.
|
static |
Increase the sequence time.
Definition at line 584 of file cl_sequence.cpp.
References sequenceContext_s::time.
|
static |
Finds a given 2d object in the current sequence data.
Definition at line 266 of file cl_sequence.cpp.
References i, seq2D_s::inuse, seq2D_s::name, sequenceContext_s::obj2Ds, and Q_streq.
Referenced by SEQ_ExecuteDelete(), and SEQ_ExecuteObj2D().
|
static |
Finds a given entity in all sequence entities.
Definition at line 248 of file cl_sequence.cpp.
References sequenceContext_s::ents, i, seqEnt_s::inuse, seqEnt_s::name, and Q_streq.
Referenced by SEQ_ExecuteDelete(), SEQ_ExecuteModel(), and SEQ_Render3D().
void SEQ_FreeContext | ( | sequenceContext_t * | context | ) |
Free a sequence context.
Definition at line 555 of file cl_sequence.cpp.
References Mem_Free.
Referenced by uiSequenceNode::onWindowClosed().
bool SEQ_InitContext | ( | sequenceContext_t * | context, |
const char * | name | ||
) |
Initialize a sequence context from data of a named script sequence.
context | |
name |
Definition at line 451 of file cl_sequence.cpp.
References sequenceContext_s::animspeed, cl, Com_Printf(), sequenceContext_s::currentCmd, sequenceContext_s::endCmd, i, sequence_s::length, sequence_s::name, sequenceContext_s::numEnts, sequenceContext_s::numObj2Ds, numSequences, OBJZERO, Q_streq, sequence_s::start, clientBattleScape_s::time, and sequenceContext_s::time.
Referenced by uiSequenceNode::onWindowOpened().
bool SEQ_Render | ( | sequenceContext_t * | context | ) |
Execute and render a sequence.
context | Sequence context |
Definition at line 518 of file cl_sequence.cpp.
References sequenceContext_s::pos, SEQ_Execute(), SEQ_Render2D(), SEQ_Render3D(), sequenceContext_s::size, UI_Transform(), VID_NORM_HEIGHT, and VID_NORM_WIDTH.
Referenced by uiSequenceNode::draw().
|
static |
Renders text and images.
[in] | context | Sequence context |
[in] | backgroundObjects | if true, draw background objects, else display foreground objects |
Definition at line 356 of file cl_sequence.cpp.
References seq2D_s::align, seq2D_s::bgcolor, seq2D_s::border, seq2D_s::bordercolor, CL_Translate(), cls, seq2D_s::color, seq2D_s::enlarge, seq2D_s::fade, seq2D_s::font, client_static_s::frametime, i, seq2D_s::image, seq2D_s::inBackground, int(), seq2D_s::inuse, it_pic, sequenceContext_s::numObj2Ds, sequenceContext_s::obj2Ds, seq2D_s::pos, R_Color(), R_DrawFill(), R_DrawImage(), R_DrawRect(), R_FindImage(), seq2D_s::relativePos, seq2D_s::size, seq2D_s::speed, seq2D_s::text, UI_DrawString(), and VID_NORM_WIDTH.
Referenced by SEQ_Render().
|
static |
Definition at line 286 of file cl_sequence.cpp.
References seqEnt_s::alpha, seqEnt_s::angles, sequenceContext_s::animspeed, seqEnt_s::as, cl, CL_ViewUpdateRenderData(), cls, sequenceContext_s::ents, seqEnt_s::ep, client_static_s::frametime, i, seqEnt_s::inuse, clientBattleScape_s::mapTiles, rendererData_t::mapTiles, seqEnt_s::model, rendererData_t::numEntities, sequenceContext_s::numEnts, seqEnt_s::omega, seqEnt_s::origin, seqEnt_s::parent, sequenceContext_s::pos, R_AddEntity(), R_AnimRun(), R_EntitySetOrigin(), R_GetFreeEntity(), R_PopMatrix(), R_PushMatrix(), R_RenderFrame(), RDF_NOWORLDMODEL, refdef, rendererData_t::rendererFlags, RF_NONE, SEQ_FindEnt(), SEQ_SetCamera(), sequenceContext_s::size, seqEnt_s::skin, seqEnt_s::speed, seqEnt_s::tag, VectorCopy, VectorMA(), viddef, viddef_t::viewHeight, viddef_t::viewWidth, viddef_t::x, and viddef_t::y.
Referenced by SEQ_Render().
void SEQ_SendClickEvent | ( | sequenceContext_t * | context | ) |
Unlock a click event for the current sequence or ends the current sequence if not locked.
Definition at line 426 of file cl_sequence.cpp.
References sequenceContext_s::endClickLoop.
Referenced by uiSequenceNode::onLeftClick().
|
static |
Set the camera values for a sequence.
Definition at line 219 of file cl_sequence.cpp.
References camera_s::angles, seqCamera_s::angles, AngleVectors(), camera_s::axis, clientBattleScape_s::cam, sequenceContext_s::camera, camera_s::camorg, 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, camera_s::origin, seqCamera_s::origin, sequenceContext_s::size, seqCamera_s::speed, VectorCopy, VectorMA(), camera_s::zoom, and seqCamera_s::zoom.
Referenced by SEQ_Render3D().
void SEQ_SetView | ( | sequenceContext_t * | context, |
vec2_t | pos, | ||
vec2_t | size | ||
) |
Define the position of the viewport on the screen.
context | Context |
pos | Position of the context screen |
size | Size of the context screen |
Definition at line 437 of file cl_sequence.cpp.
References sequenceContext_s::pos, and sequenceContext_s::size.
Referenced by uiSequenceNode::draw().
Definition at line 998 of file cl_sequence.cpp.
References numSeqCmds, numSequences, and OBJZERO.
Referenced by CL_Shutdown().
|
static |
Definition at line 476 of file cl_sequence.cpp.
References sequenceContext_s::endClickLoop.
Referenced by SEQ_Execute().
|
static |
Definition at line 131 of file cl_sequence.cpp.
Referenced by CL_ParseSequence(), and SEQ_Shutdown().
|
static |
Definition at line 127 of file cl_sequence.cpp.
Referenced by CL_ParseSequence(), SEQ_InitContext(), and SEQ_Shutdown().
|
static |
valid id names for 2d entity
Definition at line 195 of file cl_sequence.cpp.
|
static |
valid id names for camera
Definition at line 167 of file cl_sequence.cpp.
|
static |
Function to exeute all available commands.
Definition at line 843 of file cl_sequence.cpp.
Referenced by CL_ParseSequence().
|
static |
Definition at line 822 of file cl_sequence.cpp.
Referenced by CL_FindSequenceCommand().
|
static |
Store all sequence commands
Definition at line 130 of file cl_sequence.cpp.
|
static |
valid entity names for a sequence
Definition at line 180 of file cl_sequence.cpp.
|
static |
Global content
Store main sequence entries
Definition at line 126 of file cl_sequence.cpp.