cl_sequence.c File Reference

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"
Include dependency graph for cl_sequence.c:

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_tSEQ_FindEnt (sequenceContext_t *context, const char *name)
 Finds a given entity in all sequence entities.
static seq2D_tSEQ_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.

Detailed Description

Non-interactive sequence rendering and AVI recording.

Note:
Sequences are rendered on top of a menu node - the default menu is stored in mn_sequence cvar

Definition in file cl_sequence.c.


Define Documentation

#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 Documentation

typedef struct seq2D_s seq2D_t

Represents a text object or image object.

typedef struct seqCamera_s seqCamera_t
typedef struct seqCmd_s seqCmd_t
typedef struct seqEnt_s seqEnt_t

Render entities that represents an (animated) model

typedef struct sequence_s sequence_t

Sequence context

typedef int(* sequenceHandler_t)(struct sequenceContext_s *context, const char *name, const char *data)

execution function of a command

Returns:
0 if the same command should be executed again - or 1 to execute the next event

Definition at line 48 of file cl_sequence.c.


Function Documentation

CASSERT ( lengthof(seqCmdFunc = =lengthof(seqCmdName)  ) 
void CL_ParseSequence ( const char *  name,
const char **  text 
)
static void CL_SequenceClick_f ( void   )  [static]

Unlock a click event for the current sequence or ends the current sequence if not locked.

Note:
Script binding for seq_click
See also:
menu sequence in menu_main.ufo

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.

See also:
CL_SequenceStart_f

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   ) 
static void CL_SequenceStart_f ( void   )  [static]
static void SEQ_ClickEvent ( sequenceContext_t context  )  [static]

Unlock a click event for the current sequence or ends the current sequence if not locked.

Note:
Script binding for seq_click
See also:
menu sequence in menu_main.ufo

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.

Parameters:
context 
Returns:
True is the sequence is alive, false if it is the end of the sequence

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]
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.

Returns:
0 if you wait for the click
1 if the click occurred

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.

Returns:
1 - increase the command position of the sequence by one
See also:
Cbuf_AddText

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]
static int SEQ_ExecuteMusic ( sequenceContext_t context,
const char *  name,
const char *  data 
) [static]

Changes the music in the sequence.

Returns:
1 - increase the command position of the sequence by one

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.

Returns:
1 - increase the command position of the sequence by one
See also:
R_RegisterModelShort
R_RegisterImage

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.

Returns:
1 - increase the command position of the sequence by one
See also:
CL_SequenceFind2D
CL_SequenceFindEnt

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.

Returns:
1 - increase the command position of the sequence by one

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.

Returns:
1 - increase the command position of the sequence by one

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.

See also:
CL_SequenceFindEnt

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.

See also:
CL_SequenceFind2D

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]
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]
static void SEQ_Render3D ( sequenceContext_t context  )  [static]
static void SEQ_SetCamera ( sequenceContext_t context  )  [static]
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().


Variable Documentation

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().

Note:
Here to reduce the scope

Definition at line 723 of file cl_sequence.c.

const value_t seq2D_vals[] [static]
Initial value:
 {
    {"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]
Initial value:
 {
    {"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.

Initial value:

Function to exeute all available commands.

Definition at line 844 of file cl_sequence.c.

Referenced by CL_ParseSequence().

const char* seqCmdName[] [static]
Initial value:
 {
    "end",
    "wait",
    "click",
    "precache",
    "camera",
    "model",
    "2dobj",
    "music",
    "sound",
    "rem",
    "cmd"
}

Definition at line 825 of file cl_sequence.c.

Referenced by CL_ParseSequence().

seqCmd_t seqCmds[MAX_SEQCMDS] [static]

Store all sequence commands

Definition at line 126 of file cl_sequence.c.

const value_t seqEnt_vals[] [static]
Initial value:
 {
    {"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

Todo:
move it to cls?

Store main sequence entries

Definition at line 122 of file cl_sequence.c.


Generated by  doxygen 1.6.2