|
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_t |
| struct | sequence_t |
| struct | seqCamera_t |
| struct | seqEnt_t |
| struct | seq2D_t |
| Represents a text object or image object. More... | |
| struct | sequenceContext_t |
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 | |
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, bool backgroundObjects) |
| Renders text and images. | |
| void | SEQ_SendClickEvent (sequenceContext_t *context) |
| Unlock a click event for the current sequence or ends the current sequence if not locked. | |
| void | SEQ_SetView (sequenceContext_t *context, vec2_t pos, vec2_t size) |
| Define the position of the viewport on the screen. | |
| bool | SEQ_InitContext (sequenceContext_t *context, const char *name) |
| Initialize a sequence context from data of a named script sequence. | |
| 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. | |
| bool | SEQ_Render (sequenceContext_t *context) |
| Execute and render a sequence. | |
| sequenceContext_t * | SEQ_AllocContext (void) |
| Allocate a sequence context. | |
| void | SEQ_FreeContext (sequenceContext_t *context) |
| Free a sequence context. | |
| 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_ExecuteAnimSpeed (sequenceContext_t *context, const char *name, const char *data) |
| Set the animation speed, default value is 1000. | |
| 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_ExecuteObj2D (sequenceContext_t *context, const char *name, const char *data) |
| Parse 2D objects like text and images. | |
| static int | SEQ_ExecuteDelete (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. | |
| 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. | |
| 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 | |
| static const value_t | seqEnt_vals [] |
| valid entity names for a sequence | |
| static const value_t | seq2D_vals [] |
| valid id names for 2d entity | |
| static char const *const | seqCmdName [] |
| static sequenceHandler_t | seqCmdFunc [] |
| Function to exeute all available commands. | |
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 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) | ) |
References seqCmdFunc, and 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(), data, seqCmd_t::data, ERR_DROP, ERR_FATAL, seqCmd_t::handler, i, sequence_t::length, LIST_Delete(), MAX_DATA_LENGTH, MAX_SEQCMDS, MAX_SEQUENCES, Mem_PoolAllocTypeN, name, seqCmd_t::name, sequence_t::name, linkedList_t::next, numSeqCmds, numSequences, OBJZERO, Q_streq, Q_strncpyz(), seqCmdFunc, seqCmds, sequences, sequence_t::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_t::currentCmd, seqCmd_t::data, sequenceContext_t::endClickLoop, sequenceContext_t::endCmd, seqCmd_t::handler, seqCmd_t::name, SEQ_StopSequence(), seqCmds, and sequenceContext_t::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_t::animspeed, data, and name.
|
static |
Parse the values for the camera like given in seqCamera.
Definition at line 628 of file cl_sequence.cpp.
References sequenceContext_t::camera, Com_EParseValue(), Com_Printf(), data, name, value_t::ofs, Q_streq, seqCamera_vals, value_t::size, value_t::string, and value_t::type.
|
static |
Wait until someone clicks with the mouse.
Definition at line 567 of file cl_sequence.cpp.
References data, sequenceContext_t::endClickLoop, name, and sequenceContext_t::time.
|
static |
Executes a sequence command.
Definition at line 813 of file cl_sequence.cpp.
References Cbuf_AddText(), data, and name.
|
static |
Removed a sequence entity from the current sequence.
Definition at line 789 of file cl_sequence.cpp.
References Com_Printf(), data, seq2D_t::inuse, seqEnt_t::inuse, Mem_Free, name, SEQ_Find2D(), SEQ_FindEnt(), and seq2D_t::text.
|
static |
Parse values for a sequence model.
Definition at line 653 of file cl_sequence.cpp.
References seqEnt_t::as, seqEnt_t::color, Com_DPrintf(), Com_EParseValue(), Com_Error(), Com_Printf(), data, DEBUG_CLIENT, sequenceContext_t::ents, ERR_FATAL, i, seqEnt_t::inuse, MAX_SEQENTS, seqEnt_t::model, name, seqEnt_t::name, sequenceContext_t::numEnts, OBJZERO, value_t::ofs, Q_streq, Q_strncpyz(), R_AnimChange(), R_FindModel(), SEQ_FindEnt(), seqEnt_vals, value_t::size, value_t::string, value_t::type, and VectorSet.
|
static |
Changes the music in the sequence.
Definition at line 710 of file cl_sequence.cpp.
References Com_DPrintf(), Cvar_Set(), data, DEBUG_CLIENT, and name.
|
static |
Parse 2D objects like text and images.
Definition at line 733 of file cl_sequence.cpp.
References cl_genericPool, seq2D_t::color, Com_EParseValue(), Com_Error(), Com_GetValue(), Com_Printf(), data, ERR_FATAL, seq2D_t::font, i, seq2D_t::inuse, MAX_SEQ2DS, Mem_PoolStrDupTo, name, seq2D_t::name, sequenceContext_t::numObj2Ds, sequenceContext_t::obj2Ds, OBJZERO, value_t::ofs, Q_streq, Q_strncpyz(), seq2D_vals, SEQ_Find2D(), value_t::size, value_t::string, value_t::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(), data, DEBUG_CLIENT, name, Q_streq, R_FindModel(), and R_FindPics().
|
static |
Plays a sound in a sequence.
Definition at line 721 of file cl_sequence.cpp.
References data, name, S_StartLocalSample(), and SND_VOLUME_DEFAULT.
|
static |
Increase the sequence time.
Definition at line 584 of file cl_sequence.cpp.
References data, name, and sequenceContext_t::time.
|
static |
Finds a given 2d object in the current sequence data.
Definition at line 266 of file cl_sequence.cpp.
References i, seq2D_t::inuse, name, seq2D_t::name, sequenceContext_t::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_t::ents, i, seqEnt_t::inuse, name, seqEnt_t::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_t::animspeed, cl, Com_Printf(), sequenceContext_t::currentCmd, sequenceContext_t::endCmd, i, sequence_t::length, name, sequence_t::name, sequenceContext_t::numEnts, sequenceContext_t::numObj2Ds, numSequences, OBJZERO, Q_streq, sequences, sequence_t::start, and sequenceContext_t::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_t::pos, SEQ_Execute(), SEQ_Render2D(), SEQ_Render3D(), sequenceContext_t::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_t::align, seq2D_t::bgcolor, seq2D_t::border, seq2D_t::bordercolor, CL_Translate(), cls, seq2D_t::color, seq2D_t::enlarge, seq2D_t::fade, seq2D_t::font, i, seq2D_t::image, seq2D_t::inBackground, int(), seq2D_t::inuse, it_pic, sequenceContext_t::numObj2Ds, sequenceContext_t::obj2Ds, seq2D_t::pos, R_Color(), R_DrawFill(), R_DrawImage(), R_DrawRect(), R_FindImage(), seq2D_t::relativePos, seq2D_t::size, seq2D_t::speed, seq2D_t::text, UI_DrawString(), and VID_NORM_WIDTH.
Referenced by SEQ_Render().
|
static |
Definition at line 286 of file cl_sequence.cpp.
References entity_t::alpha, seqEnt_t::alpha, entity_t::angles, seqEnt_t::angles, sequenceContext_t::animspeed, entity_t::as, seqEnt_t::as, cl, CL_ViewUpdateRenderData(), cls, sequenceContext_t::ents, seqEnt_t::ep, i, seqEnt_t::inuse, entity_t::model, seqEnt_t::model, sequenceContext_t::numEnts, entity_t::oldorigin, seqEnt_t::omega, seqEnt_t::origin, seqEnt_t::parent, sequenceContext_t::pos, R_AddEntity(), R_AnimRun(), R_EntitySetOrigin(), R_GetFreeEntity(), R_PopMatrix(), R_PushMatrix(), R_RenderFrame(), RDF_NOWORLDMODEL, refdef, RF_NONE, SEQ_FindEnt(), SEQ_SetCamera(), sequenceContext_t::size, seqEnt_t::skin, entity_t::skinnum, seqEnt_t::speed, seqEnt_t::tag, entity_t::tagent, entity_t::tagname, VectorCopy, VectorMA(), and viddef.
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_t::endClickLoop.
Referenced by uiSequenceNode::onLeftClick().
|
static |
Set the camera values for a sequence.
Definition at line 219 of file cl_sequence.cpp.
References seqCamera_t::angles, AngleVectors(), sequenceContext_t::camera, cl, cl_isometric, CL_ViewCalcFieldOfViewX(), cls, seqCamera_t::ddist, seqCamera_t::dist, seqCamera_t::dzoom, MIN_ZOOM, seqCamera_t::omega, seqCamera_t::origin, sequenceContext_t::size, seqCamera_t::speed, VectorCopy, VectorMA(), and seqCamera_t::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_t::pos, and sequenceContext_t::size.
Referenced by uiSequenceNode::draw().
Definition at line 998 of file cl_sequence.cpp.
References numSeqCmds, numSequences, OBJZERO, seqCmds, and sequences.
Referenced by CL_Shutdown().
|
static |
Definition at line 476 of file cl_sequence.cpp.
References sequenceContext_t::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.
Referenced by SEQ_ExecuteObj2D().
|
static |
valid id names for camera
Definition at line 167 of file cl_sequence.cpp.
Referenced by SEQ_ExecuteCamera().
|
static |
Function to exeute all available commands.
Definition at line 843 of file cl_sequence.cpp.
Referenced by CASSERT(), and CL_ParseSequence().
|
static |
Definition at line 822 of file cl_sequence.cpp.
Referenced by CASSERT(), and CL_FindSequenceCommand().
|
static |
Store all sequence commands
Definition at line 130 of file cl_sequence.cpp.
Referenced by CL_ParseSequence(), SEQ_Execute(), and SEQ_Shutdown().
|
static |
valid entity names for a sequence
Definition at line 180 of file cl_sequence.cpp.
Referenced by SEQ_ExecuteModel().
|
static |
Global content
Store main sequence entries
Definition at line 126 of file cl_sequence.cpp.
Referenced by CL_ParseSequence(), SEQ_InitContext(), and SEQ_Shutdown().