123
This commit is contained in:
179
CryMovie/AnimCameraNode.cpp
Normal file
179
CryMovie/AnimCameraNode.cpp
Normal file
@@ -0,0 +1,179 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animcameranode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 16/8/2002 by Lennert.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "animcameranode.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
namespace
|
||||
{
|
||||
bool s_nodeParamsInitialized = false;
|
||||
std::vector<IAnimNode::SParamInfo> s_nodeParams;
|
||||
|
||||
void AddSupportedParam( const char *sName,int paramId,EAnimValue valueType )
|
||||
{
|
||||
IAnimNode::SParamInfo param;
|
||||
param.name = sName;
|
||||
param.paramId = paramId;
|
||||
param.valueType = valueType;
|
||||
s_nodeParams.push_back( param );
|
||||
}
|
||||
};
|
||||
|
||||
CAnimCameraNode::CAnimCameraNode( IMovieSystem *sys )
|
||||
: CAnimEntityNode(sys)
|
||||
{
|
||||
m_dwSupportedTracks = PARAM_BIT(APARAM_POS)|PARAM_BIT(APARAM_ROT)|
|
||||
PARAM_BIT(APARAM_EVENT)|PARAM_BIT(APARAM_FOV);
|
||||
m_pMovie=sys;
|
||||
m_fFOV = 60.0f;
|
||||
|
||||
if (!s_nodeParamsInitialized)
|
||||
{
|
||||
s_nodeParamsInitialized = true;
|
||||
AddSupportedParam( "Position",APARAM_POS,AVALUE_VECTOR );
|
||||
AddSupportedParam( "Rotation",APARAM_ROT,AVALUE_QUAT );
|
||||
AddSupportedParam( "Fov",APARAM_FOV,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Event",APARAM_EVENT,AVALUE_EVENT );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimCameraNode::~CAnimCameraNode()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimCameraNode::GetParamCount() const
|
||||
{
|
||||
return s_nodeParams.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCameraNode::GetParamInfo( int nIndex, SParamInfo &info ) const
|
||||
{
|
||||
if (nIndex >= 0 && nIndex < s_nodeParams.size())
|
||||
{
|
||||
info = s_nodeParams[nIndex];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCameraNode::GetParamInfoFromId( int paramId, SParamInfo &info ) const
|
||||
{
|
||||
for (int i = 0; i < s_nodeParams.size(); i++)
|
||||
{
|
||||
if (s_nodeParams[i].paramId == paramId)
|
||||
{
|
||||
info = s_nodeParams[i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCameraNode::CreateDefaultTracks()
|
||||
{
|
||||
CreateTrack(APARAM_POS);
|
||||
CreateTrack(APARAM_ROT);
|
||||
CreateTrack(APARAM_FOV);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCameraNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
CAnimEntityNode::Animate(ec);
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (!anim)
|
||||
return;
|
||||
IAnimTrack *pFOVTrack = anim->GetTrack(APARAM_FOV);
|
||||
|
||||
float fov = m_fFOV;
|
||||
|
||||
// is this camera active ? if so, set the current fov
|
||||
if (m_pMovie->GetCameraParams().cameraNode == this)
|
||||
{
|
||||
if (pFOVTrack)
|
||||
pFOVTrack->GetValue(ec.time, fov);
|
||||
|
||||
SCameraParams CamParams = m_pMovie->GetCameraParams();
|
||||
CamParams.fFOV = DEG2RAD(fov);
|
||||
m_pMovie->SetCameraParams(CamParams);
|
||||
}
|
||||
|
||||
if (fov != m_fFOV)
|
||||
{
|
||||
m_fFOV = fov;
|
||||
if (m_callback)
|
||||
{
|
||||
m_callback->OnNodeAnimated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCameraNode::Reset()
|
||||
{
|
||||
CAnimEntityNode::Reset();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCameraNode::SetParamValue( float time,AnimParamType param,float value )
|
||||
{
|
||||
if (param == APARAM_FOV)
|
||||
{
|
||||
// Set default value.
|
||||
m_fFOV = value;
|
||||
}
|
||||
return CAnimEntityNode::SetParamValue( time,param,value );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCameraNode::GetParamValue( float time,AnimParamType param,float &value )
|
||||
{
|
||||
if (CAnimEntityNode::GetParamValue(time,param,value))
|
||||
return true;
|
||||
value = m_fFOV;
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimTrack* CAnimCameraNode::CreateTrack(AnimParamType nParamType)
|
||||
{
|
||||
IAnimTrack *pTrack = CAnimEntityNode::CreateTrack(nParamType);
|
||||
if (nParamType == APARAM_FOV)
|
||||
{
|
||||
if (pTrack)
|
||||
pTrack->SetValue(0,m_fFOV,true);
|
||||
}
|
||||
return pTrack;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCameraNode::Serialize( XmlNodeRef &xmlNode,bool bLoading )
|
||||
{
|
||||
CAnimEntityNode::Serialize( xmlNode,bLoading );
|
||||
if (bLoading)
|
||||
{
|
||||
xmlNode->getAttr( "FOV",m_fFOV );
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNode->setAttr( "FOV",m_fFOV );
|
||||
}
|
||||
}
|
||||
55
CryMovie/AnimCameraNode.h
Normal file
55
CryMovie/AnimCameraNode.h
Normal file
@@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animcameranode.h
|
||||
// Version: v1.00
|
||||
// Created: 16/8/2002 by Lennert.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __animcameranode_h__
|
||||
#define __animcameranode_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "entitynode.h"
|
||||
|
||||
/** Camera node controls camera entity.
|
||||
*/
|
||||
class CAnimCameraNode : public CAnimEntityNode
|
||||
{
|
||||
private:
|
||||
IMovieSystem *m_pMovie;
|
||||
// Field of view in DEGREES! To Display it nicely for user.
|
||||
float m_fFOV;
|
||||
public:
|
||||
CAnimCameraNode(IMovieSystem *sys );
|
||||
virtual ~CAnimCameraNode();
|
||||
virtual EAnimNodeType GetType() const { return ANODE_CAMERA; }
|
||||
virtual void Animate( SAnimContext &ec );
|
||||
virtual void CreateDefaultTracks();
|
||||
virtual void Reset();
|
||||
float GetFOV() { return m_fFOV; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int GetParamCount() const;
|
||||
bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool SetParamValue( float time,AnimParamType param,float value );
|
||||
bool GetParamValue( float time,AnimParamType param,float &value );
|
||||
|
||||
IAnimTrack* CreateTrack(AnimParamType nParamType);
|
||||
void Serialize( XmlNodeRef &xmlNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __animcameranode_h__
|
||||
499
CryMovie/AnimNode.cpp
Normal file
499
CryMovie/AnimNode.cpp
Normal file
@@ -0,0 +1,499 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animnode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "AnimNode.h"
|
||||
#include "Animtrack.h"
|
||||
#include "CharacterTrack.h"
|
||||
#include "AnimSplineTrack.h"
|
||||
#include "BoolTrack.h"
|
||||
#include "SelectTrack.h"
|
||||
#include "EventTrack.h"
|
||||
#include "SoundTrack.h"
|
||||
#include "ExprTrack.h"
|
||||
#include "ConsoleTrack.h"
|
||||
#include "MusicTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CAnimBlock
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimBlock::GetTrackCount() const
|
||||
{
|
||||
return m_tracks.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimBlock::GetTrackInfo( int index,int ¶mId,IAnimTrack **pTrack ) const
|
||||
{
|
||||
if (index < 0 && index >= m_tracks.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
paramId = m_tracks[index].paramId;
|
||||
if (pTrack)
|
||||
*pTrack = m_tracks[index].track;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* CAnimBlock::GetParamName( AnimParamType param ) const
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case APARAM_FOV:
|
||||
return "FOV";
|
||||
case APARAM_POS:
|
||||
return "Position";
|
||||
case APARAM_ROT:
|
||||
return "Rotation";
|
||||
case APARAM_SCL:
|
||||
return "Scale";
|
||||
case APARAM_VISIBLE:
|
||||
return "Visiblity";
|
||||
case APARAM_EVENT:
|
||||
return "Events";
|
||||
case APARAM_CAMERA:
|
||||
return "Camera";
|
||||
|
||||
// Sound tracks.
|
||||
case APARAM_SOUND1:
|
||||
return "Sound1";
|
||||
case APARAM_SOUND2:
|
||||
return "Sound2";
|
||||
case APARAM_SOUND3:
|
||||
return "Sound3";
|
||||
|
||||
// Character tracks.
|
||||
case APARAM_CHARACTER1:
|
||||
return "Animation1";
|
||||
case APARAM_CHARACTER2:
|
||||
return "Animation2";
|
||||
case APARAM_CHARACTER3:
|
||||
return "Animation3";
|
||||
|
||||
case APARAM_EXPRESSION1:
|
||||
return "Expression1";
|
||||
case APARAM_EXPRESSION2:
|
||||
return "Expression2";
|
||||
case APARAM_EXPRESSION3:
|
||||
return "Expression3";
|
||||
|
||||
case APARAM_SEQUENCE:
|
||||
return "Sequence";
|
||||
case APARAM_CONSOLE:
|
||||
return "Console";
|
||||
case APARAM_MUSIC:
|
||||
return "Music";
|
||||
|
||||
case APARAM_FLOAT_1:
|
||||
return "Value";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
IAnimTrack* CAnimBlock::GetTrack( int param ) const
|
||||
{
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
if (m_tracks[i].paramId == param)
|
||||
return m_tracks[i].track;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CAnimBlock::SetTrack( int param,IAnimTrack *track )
|
||||
{
|
||||
if (track)
|
||||
{
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
if (m_tracks[i].paramId == param)
|
||||
{
|
||||
m_tracks[i].track = track;
|
||||
return;
|
||||
}
|
||||
}
|
||||
AddTrack( param,track );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove track at this id.
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
if (m_tracks[i].paramId == param)
|
||||
{
|
||||
m_tracks.erase( m_tracks.begin() + i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimBlock::AddTrack( int param,IAnimTrack *track )
|
||||
{
|
||||
TrackDesc td;
|
||||
td.paramId = param;
|
||||
td.track = track;
|
||||
m_tracks.push_back(td);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimBlock::RemoveTrack( IAnimTrack *pTrack )
|
||||
{
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
if (m_tracks[i].track == pTrack)
|
||||
{
|
||||
m_tracks.erase( m_tracks.begin() + i );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimTrack* CAnimBlock::CreateTrack( int paramId,EAnimValue valueType )
|
||||
{
|
||||
IAnimTrack *pTrack = NULL;
|
||||
switch (valueType)
|
||||
{
|
||||
case AVALUE_FLOAT: pTrack=new CTcbFloatTrack; break;
|
||||
case AVALUE_VECTOR: pTrack=new CTcbVectorTrack; break;
|
||||
case AVALUE_QUAT: pTrack=new CTcbQuatTrack; break;
|
||||
case AVALUE_EVENT: pTrack=new CEventTrack; break;
|
||||
case AVALUE_BOOL: pTrack=new CBoolTrack; break;
|
||||
case AVALUE_SELECT: pTrack=new CSelectTrack; break;
|
||||
case AVALUE_SOUND: pTrack=new CSoundTrack; break;
|
||||
case AVALUE_CHARACTER: pTrack=new CCharacterTrack; break;
|
||||
case AVALUE_EXPRESSION:pTrack=new CExprTrack; break;
|
||||
case AVALUE_CONSOLE: pTrack=new CConsoleTrack; break;
|
||||
case AVALUE_MUSIC: pTrack=new CMusicTrack; break;
|
||||
}
|
||||
if (pTrack)
|
||||
AddTrack( paramId,pTrack );
|
||||
return pTrack;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimBlock::Serialize( IAnimNode *pNode,XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
// Delete all tracks.
|
||||
m_tracks.clear();
|
||||
|
||||
IAnimNode::SParamInfo info;
|
||||
// Loading.
|
||||
int paramId = -1;
|
||||
int num = xmlNode->getChildCount();
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
XmlNodeRef trackNode = xmlNode->getChild(i);
|
||||
trackNode->getAttr( "ParamId",paramId );
|
||||
if (!pNode->GetParamInfoFromId( paramId,info ))
|
||||
continue;
|
||||
|
||||
IAnimTrack *track = CreateTrack( paramId,info.valueType );
|
||||
if (track)
|
||||
{
|
||||
if (!track->Serialize( trackNode,bLoading,bLoadEmptyTracks ))
|
||||
{
|
||||
// Boolean tracks must always be loaded even if empty.
|
||||
if (track->GetType() != ATRACK_BOOL)
|
||||
{
|
||||
RemoveTrack(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Saving.
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
IAnimTrack *track = m_tracks[i].track;
|
||||
if (track)
|
||||
{
|
||||
int paramid = m_tracks[i].paramId;
|
||||
XmlNodeRef trackNode = xmlNode->newChild( "Track" );
|
||||
trackNode->setAttr( "ParamId",m_tracks[i].paramId );
|
||||
track->Serialize( trackNode,bLoading );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimBlock::SetTimeRange( Range timeRange )
|
||||
{
|
||||
for (int i = 0; i < m_tracks.size(); i++)
|
||||
{
|
||||
if (m_tracks[i].track)
|
||||
{
|
||||
m_tracks[i].track->SetTimeRange( timeRange );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CAnimNode.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimNode::CAnimNode( IMovieSystem *sys )
|
||||
{
|
||||
m_dwSupportedTracks=0;
|
||||
m_id = 0;
|
||||
m_animBlock = 0;
|
||||
m_callback = 0;
|
||||
m_parent = 0;
|
||||
m_pMovieSystem = sys;
|
||||
m_pMovieSystem->Callback(CBR_ADDNODE);
|
||||
m_flags = 0;
|
||||
strcpy(m_name,"");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimNode::~CAnimNode()
|
||||
{
|
||||
m_pMovieSystem->Callback(CBR_REMOVENODE);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::SetFlags( int flags )
|
||||
{
|
||||
m_flags = flags;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimNode::GetFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimNode::FindTrack(IAnimTrack *pInTrack)
|
||||
{
|
||||
if (!m_animBlock)
|
||||
return -1;
|
||||
|
||||
int paramCount = m_animBlock->GetTrackCount();
|
||||
for (int paramIndex = 0; paramIndex < paramCount; paramIndex++)
|
||||
{
|
||||
int paramId;
|
||||
IAnimTrack *pTrack;
|
||||
if (!m_animBlock->GetTrackInfo( paramIndex,paramId,&pTrack ))
|
||||
continue;
|
||||
if (pTrack == pInTrack)
|
||||
return paramId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimTrack* CAnimNode::CreateTrack( int paramId )
|
||||
{
|
||||
if (!m_animBlock)
|
||||
return 0;
|
||||
|
||||
SParamInfo info;
|
||||
if (GetParamInfoFromId(paramId,info))
|
||||
{
|
||||
IAnimTrack *pTrack = m_animBlock->CreateTrack( paramId,info.valueType );
|
||||
if (pTrack)
|
||||
m_pMovieSystem->Callback(CBR_CHANGENODE);
|
||||
return pTrack;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimNode::RemoveTrack( IAnimTrack *pTrack )
|
||||
{
|
||||
if (!m_animBlock)
|
||||
return false;
|
||||
if (m_animBlock->RemoveTrack( pTrack ))
|
||||
{
|
||||
m_pMovieSystem->Callback(CBR_CHANGENODE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CAnimNode::GetChild( int i ) const
|
||||
{
|
||||
assert( i >= 0 && i < (int)m_childs.size() );
|
||||
return m_childs[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimNode::IsChildOf( IAnimNode *node )
|
||||
{
|
||||
CAnimNode *p = m_parent;
|
||||
while (p && p != node) {
|
||||
p = p->m_parent;
|
||||
}
|
||||
if (p == node)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::AttachChild( IAnimNode* child )
|
||||
{
|
||||
assert( child );
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
CAnimNode *childNode = (CAnimNode*)child;
|
||||
|
||||
// If not already attached to this node.
|
||||
if (childNode->m_parent == this)
|
||||
return;
|
||||
|
||||
// Add to child list first to make sure node not get deleted while reattaching.
|
||||
m_childs.push_back( childNode );
|
||||
if (childNode->m_parent)
|
||||
childNode->DetachThis(); // Detach node if attached to other parent.
|
||||
childNode->m_parent = this; // Assign this node as parent to child node.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::DetachAll()
|
||||
{
|
||||
for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
|
||||
{
|
||||
(*c)->m_parent = 0;
|
||||
}
|
||||
m_childs.clear();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::DetachThis()
|
||||
{
|
||||
if (m_parent)
|
||||
{
|
||||
// Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
|
||||
CAnimNode* parent = m_parent;
|
||||
m_parent = 0;
|
||||
parent->RemoveChild( this );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::RemoveChild( CAnimNode *node )
|
||||
{
|
||||
Childs::iterator it = std::find( m_childs.begin(),m_childs.end(),node );
|
||||
if (it != m_childs.end())
|
||||
m_childs.erase( it );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimNode::IsParamValid( int paramId ) const
|
||||
{
|
||||
SParamInfo info;
|
||||
if (GetParamInfoFromId(paramId,info))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimNode::SetParamValue( float time,AnimParamType param,float value )
|
||||
{
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (anim)
|
||||
{
|
||||
IAnimTrack *track = anim->GetTrack(param);
|
||||
if (track && track->GetValueType() == AVALUE_FLOAT)
|
||||
{
|
||||
// Float track.
|
||||
bool bDefault = !(m_pMovieSystem->IsRecording() && (m_flags&ANODE_FLAG_SELECTED)); // Only selected nodes can be recorded
|
||||
track->SetValue( time,value,bDefault );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimNode::GetParamValue( float time,AnimParamType param,float &value )
|
||||
{
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (anim)
|
||||
{
|
||||
IAnimTrack *track = anim->GetTrack(param);
|
||||
if (track && track->GetValueType() == AVALUE_FLOAT)
|
||||
{
|
||||
// Float track.
|
||||
track->GetValue( time,value );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimTrack* CAnimNode::GetTrack( int nParamId ) const
|
||||
{
|
||||
if (!m_animBlock)
|
||||
return 0;
|
||||
return m_animBlock->GetTrack( nParamId );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::SetTrack( int nParamId,IAnimTrack *track )
|
||||
{
|
||||
if (!m_animBlock)
|
||||
return;
|
||||
m_animBlock->SetTrack( nParamId,track );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::Serialize( XmlNodeRef &xmlNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
xmlNode->getAttr( "Id",m_id );
|
||||
const char *name = xmlNode->getAttr("Name");
|
||||
if (name)
|
||||
SetName(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNode->setAttr( "Id",m_id );
|
||||
xmlNode->setAttr("Type", GetType() );
|
||||
xmlNode->setAttr("Name", GetName() );
|
||||
IAnimNode *pTgt = GetTarget();
|
||||
if (pTgt)
|
||||
{
|
||||
xmlNode->setAttr("TargetId", pTgt->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimNode::SetAnimBlock( IAnimBlock *block )
|
||||
{
|
||||
m_animBlock = block;
|
||||
if (m_animBlock)
|
||||
m_animBlock->SetId( m_id );
|
||||
};
|
||||
199
CryMovie/AnimNode.h
Normal file
199
CryMovie/AnimNode.h
Normal file
@@ -0,0 +1,199 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animnode.h
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description: Base of all Animation Nodes
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __animnode_h__
|
||||
#define __animnode_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
/*
|
||||
// Common parameter-bits of animation node.
|
||||
enum AnimParamTypeBits
|
||||
{
|
||||
APARAMBIT_POS = 0x00000001, //!< Position parameter id.
|
||||
APARAMBIT_ROT = 0x00000002, //!< Rotation parameter id.
|
||||
APARAMBIT_SCL = 0x00000004, //!< Scale parameter id.
|
||||
APARAMBIT_ENTITY = 0x00000008, //!< Entity parameter id.
|
||||
APARAMBIT_VISIBLE = 0x00000010, //!< Visibilty parameter id.
|
||||
APARAMBIT_CAMERA = 0x00000020, //!< Camera parameter id.
|
||||
APARAMBIT_FOV = 0x00000040, //!< FOV parameter id.
|
||||
};*/
|
||||
|
||||
#define PARAM_BIT(param) (1<<(param))
|
||||
|
||||
class CAnimBlock : public IAnimBlock
|
||||
{
|
||||
public:
|
||||
void SetId( int id ) { m_id = id; };
|
||||
int GetId() const { return m_id; };
|
||||
|
||||
int GetTrackCount() const;
|
||||
bool GetTrackInfo( int index,int ¶mId,IAnimTrack **pTrack ) const;
|
||||
|
||||
const char* GetParamName( AnimParamType param ) const;
|
||||
|
||||
IAnimTrack* GetTrack( int paramId ) const;
|
||||
void SetTrack( int paramId,IAnimTrack *track );
|
||||
IAnimTrack* CreateTrack( int paramId,EAnimValue valueType );
|
||||
|
||||
void SetTimeRange( Range timeRange );
|
||||
|
||||
bool RemoveTrack( IAnimTrack *track );
|
||||
|
||||
void Serialize( IAnimNode *pNode,XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks=true );
|
||||
|
||||
private:
|
||||
void AddTrack( int param,IAnimTrack *track );
|
||||
|
||||
struct TrackDesc
|
||||
{
|
||||
int paramId; // Track parameter id.
|
||||
TSmartPtr<IAnimTrack> track; // Track pointer.
|
||||
};
|
||||
std::vector<TrackDesc> m_tracks;
|
||||
int m_id;
|
||||
};
|
||||
|
||||
/*!
|
||||
Base class for all Animation nodes,
|
||||
can host multiple animation tracks, and execute them other time.
|
||||
Animation node is reference counted.
|
||||
*/
|
||||
class CAnimNode : public IAnimNode
|
||||
{
|
||||
public:
|
||||
CAnimNode( IMovieSystem *sys );
|
||||
~CAnimNode();
|
||||
|
||||
void SetName( const char *name ) { strncpy(m_name,name,sizeof(m_name)-1); int nLen=strlen(name); if (nLen>sizeof(m_name)-1) nLen=sizeof(m_name)-1; m_name[nLen]=0; m_pMovieSystem->Callback(CBR_CHANGENODE); };
|
||||
const char* GetName() { return m_name; };
|
||||
|
||||
void SetId( int id ) { m_id = id; };
|
||||
int GetId() const { return m_id; };
|
||||
|
||||
void SetEntity( int Id) {}
|
||||
void SetEntity( IEntity *entity ) {}
|
||||
IEntity* GetEntity() { return NULL; }
|
||||
|
||||
void SetFlags( int flags );
|
||||
int GetFlags() const;
|
||||
|
||||
virtual IAnimTrack* CreateTrack( int paramId );
|
||||
virtual void CreateDefaultTracks() {};
|
||||
virtual bool RemoveTrack( IAnimTrack *pAnimTrack );
|
||||
int FindTrack(IAnimTrack *pTrack);
|
||||
|
||||
IMovieSystem* GetMovieSystem() { return m_pMovieSystem; };
|
||||
|
||||
virtual void Reset() {}
|
||||
virtual void Pause() {}
|
||||
virtual void Resume() {}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Space position/orientation scale.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetPos( float time,const Vec3 &pos ) {};
|
||||
void SetRotate( float time,const Quat &quat ) {};
|
||||
void SetScale( float time,const Vec3 &scale ) {};
|
||||
|
||||
Vec3 GetPos() { return Vec3(0,0,0); };
|
||||
Quat GetRotate() { return Quat(0,0,0,0); };
|
||||
Vec3 GetScale() { return Vec3(0,0,0); };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool SetParamValue( float time,AnimParamType param,float val );
|
||||
bool GetParamValue( float time,AnimParamType param,float &val );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void GetWorldTM( Matrix44 &tm ) { tm.SetIdentity(); };
|
||||
|
||||
void SetTarget( IAnimNode *node ) {};
|
||||
IAnimNode* GetTarget() const { return 0; };
|
||||
|
||||
void Animate( SAnimContext &ec );
|
||||
|
||||
IAnimBlock* GetAnimBlock() const { return m_animBlock; };
|
||||
void SetAnimBlock( IAnimBlock *block );
|
||||
IAnimBlock* CreateAnimBlock() { return new CAnimBlock; };
|
||||
|
||||
IAnimTrack* GetTrack( int nParamId ) const;
|
||||
void SetTrack( int nParamId,IAnimTrack *track );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Support Child nodes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Return true if node have childs.
|
||||
virtual bool HaveChilds() const { return !m_childs.empty(); }
|
||||
//! Return true if have attached childs.
|
||||
virtual int GetChildCount() const { return m_childs.size(); }
|
||||
|
||||
//! Get child by index.
|
||||
virtual IAnimNode* GetChild( int i ) const;
|
||||
//! Return parent node if exist.
|
||||
virtual IAnimNode* GetParent() const { return m_parent; }
|
||||
//! Scans hiearachy up to determine if we child of specified node.
|
||||
virtual bool IsChildOf( IAnimNode *node );
|
||||
|
||||
//! Attach new child node.
|
||||
virtual void AttachChild( IAnimNode* child );
|
||||
|
||||
//! Detach all childs of this node.
|
||||
virtual void DetachAll();
|
||||
|
||||
//! Detach this node from parent.
|
||||
//! Warning, if node is only referenced from parent, calling this will delete node.
|
||||
virtual void DetachThis();
|
||||
|
||||
virtual void Serialize( XmlNodeRef &xmlNode,bool bLoading );
|
||||
|
||||
void RegisterCallback( IAnimNodeCallback *callback ) { m_callback = callback; m_pMovieSystem->Callback(CBR_REGISTERNODECB); };
|
||||
void UnregisterCallback( IAnimNodeCallback *callback ) { m_callback = NULL; m_pMovieSystem->Callback(CBR_UNREGISTERNODECB); };
|
||||
|
||||
bool IsParamValid( int paramId ) const;
|
||||
|
||||
private:
|
||||
// Remove child from our childs list.
|
||||
void RemoveChild( CAnimNode *node );
|
||||
|
||||
//! Id of animation node.
|
||||
int m_id;
|
||||
|
||||
//! Name of animation node.
|
||||
char m_name[64];
|
||||
|
||||
//! Pointer to parent node.
|
||||
CAnimNode *m_parent;
|
||||
|
||||
//! Child animation nodes.
|
||||
typedef std::vector<TSmartPtr<CAnimNode> > Childs;
|
||||
Childs m_childs;
|
||||
|
||||
typedef std::vector<SAnimParam> Params;
|
||||
Params m_params;
|
||||
|
||||
TSmartPtr<IAnimBlock> m_animBlock;
|
||||
|
||||
protected:
|
||||
IAnimNodeCallback* m_callback;
|
||||
IMovieSystem* m_pMovieSystem;
|
||||
unsigned int m_dwSupportedTracks;
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
#endif // __animnode_h__
|
||||
420
CryMovie/AnimSequence.cpp
Normal file
420
CryMovie/AnimSequence.cpp
Normal file
@@ -0,0 +1,420 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animsequence.cpp
|
||||
// Version: v1.00
|
||||
// Created: 29/4/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "AnimSequence.h"
|
||||
#include "SceneNode.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimSequence::CAnimSequence( IMovieSystem *pMovieSystem )
|
||||
{
|
||||
m_pMovieSystem = pMovieSystem;
|
||||
m_flags = 0;
|
||||
m_pSceneNode=NULL;
|
||||
m_timeRange.Set( 0,10 );
|
||||
m_bPaused = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::SetName( const char *name )
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CAnimSequence::GetName()
|
||||
{
|
||||
return m_name.c_str();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::SetFlags( int flags )
|
||||
{
|
||||
m_flags = flags;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimSequence::GetFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimSequence::GetNodeCount() const
|
||||
{
|
||||
return m_nodes.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CAnimSequence::GetNode( int index ) const
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_nodes.size() );
|
||||
return m_nodes[index].node;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimBlock* CAnimSequence::GetAnimBlock( int index ) const
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_nodes.size() );
|
||||
return m_nodes[index].anim;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimSequence::AddNode( IAnimNode *node )
|
||||
{
|
||||
assert( node != 0 );
|
||||
|
||||
// Check if this node already in sequence.
|
||||
for (int i = 0; i < (int)m_nodes.size(); i++)
|
||||
{
|
||||
if (node == m_nodes[i].node)
|
||||
{
|
||||
// Fail to add node second time.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ANode an;
|
||||
an.node = node;
|
||||
an.anim = new CAnimBlock;//node->CreateAnimBlock();
|
||||
an.anim->SetTimeRange( m_timeRange );
|
||||
an.node->SetAnimBlock( an.anim );
|
||||
m_nodes.push_back( an );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::RemoveNode( IAnimNode *node )
|
||||
{
|
||||
assert( node != 0 );
|
||||
for (int i = 0; i < (int)m_nodes.size(); i++)
|
||||
{
|
||||
if (node == m_nodes[i].node)
|
||||
{
|
||||
if (node->GetAnimBlock() == m_nodes[i].anim)
|
||||
node->SetAnimBlock( 0 );
|
||||
m_nodes.erase( m_nodes.begin()+i );
|
||||
if (node && (node==m_pSceneNode))
|
||||
m_pSceneNode=NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CAnimSequence::AddSceneNode()
|
||||
{
|
||||
if (m_pSceneNode)
|
||||
return NULL;
|
||||
m_pSceneNode=new CAnimSceneNode(GetMovieSystem());
|
||||
m_pSceneNode->SetName("Scene");
|
||||
AddNode(m_pSceneNode);
|
||||
return m_pSceneNode;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::RemoveAll()
|
||||
{
|
||||
m_nodes.clear();
|
||||
m_pSceneNode=NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Reset()
|
||||
{
|
||||
// Animation sequence should not be animated on Reset.
|
||||
Activate();
|
||||
|
||||
SAnimContext ec;
|
||||
ec.bSingleFrame = true;
|
||||
ec.bResetting = true;
|
||||
ec.sequence = this;
|
||||
ec.time = m_timeRange.start;
|
||||
Animate( ec );
|
||||
|
||||
Deactivate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Pause()
|
||||
{
|
||||
if (m_bPaused)
|
||||
return;
|
||||
m_bPaused = true;
|
||||
// Detach animation block from all nodes in this sequence.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
it->node->Pause();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Resume()
|
||||
{
|
||||
if (!m_bPaused)
|
||||
return;
|
||||
m_bPaused = false;
|
||||
// Detach animation block from all nodes in this sequence.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
it->node->Resume();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Animate( SAnimContext &ec )
|
||||
{
|
||||
ec.sequence = this;
|
||||
// Evaluate all animation nodes in sequence.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
// Make sure correct animation block is binded to node.
|
||||
IAnimBlock *ablock = it->anim;
|
||||
if (it->node->GetAnimBlock() != ablock)
|
||||
{
|
||||
ablock->SetTimeRange( m_timeRange );
|
||||
it->node->SetAnimBlock( ablock );
|
||||
}
|
||||
// Animate node.
|
||||
it->node->Animate( ec );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Activate()
|
||||
{
|
||||
// Assign animation block to all nodes in this sequence.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimBlock *ablock = it->anim;
|
||||
ablock->SetTimeRange( m_timeRange );
|
||||
it->node->SetAnimBlock( ablock );
|
||||
}
|
||||
|
||||
// If this sequence is cut scene disable player.
|
||||
if (m_flags & CUT_SCENE)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Deactivate()
|
||||
{
|
||||
// Detach animation block from all nodes in this sequence.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
it->node->Reset();
|
||||
it->node->SetAnimBlock( 0 );
|
||||
}
|
||||
// If this sequence is cut scene, enable player.
|
||||
if (m_flags & CUT_SCENE)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
// Load.
|
||||
RemoveAll();
|
||||
|
||||
Range timeRange;
|
||||
const char *name = xmlNode->getAttr( "Name" );
|
||||
xmlNode->getAttr( "Flags",m_flags );
|
||||
xmlNode->getAttr( "StartTime",timeRange.start );
|
||||
xmlNode->getAttr( "EndTime",timeRange.end );
|
||||
|
||||
SetName( name );
|
||||
SetTimeRange( timeRange );
|
||||
// Loading.
|
||||
XmlNodeRef nodes = xmlNode->findChild( "Nodes" );
|
||||
if (nodes)
|
||||
{
|
||||
int id;
|
||||
int type;
|
||||
for (int i = 0; i < nodes->getChildCount(); i++)
|
||||
{
|
||||
XmlNodeRef xn = nodes->getChild(i);
|
||||
xn->getAttr( "Id",id );
|
||||
IAnimNode *node=NULL;
|
||||
if (!id) // scene-node-id
|
||||
{
|
||||
if (m_pSceneNode)
|
||||
node=m_pSceneNode;
|
||||
else
|
||||
node=AddSceneNode();
|
||||
}else
|
||||
{
|
||||
node = m_pMovieSystem->GetNode(id);
|
||||
}
|
||||
if (!node)
|
||||
{
|
||||
if (!xn->getAttr( "Type",type ))
|
||||
continue;
|
||||
node = m_pMovieSystem->CreateNode( type );
|
||||
if (!node)
|
||||
continue;
|
||||
const char *sName = xn->getAttr( "Name" );
|
||||
if (sName)
|
||||
node->SetName(sName);
|
||||
}
|
||||
|
||||
// Add nodes to sequence and intialize its animation block for this sequence.
|
||||
if (node!=m_pSceneNode)
|
||||
AddNode(node);
|
||||
|
||||
IAnimBlock *ablock = node->GetAnimBlock();
|
||||
if (ablock)
|
||||
{
|
||||
ablock->Serialize( node,xn,bLoading,bLoadEmptyTracks );
|
||||
}
|
||||
}
|
||||
}
|
||||
Deactivate();
|
||||
//ComputeTimeRange();
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNode->setAttr( "Name",GetName() );
|
||||
xmlNode->setAttr( "Flags",m_flags );
|
||||
xmlNode->setAttr( "StartTime",m_timeRange.start );
|
||||
xmlNode->setAttr( "EndTime",m_timeRange.end );
|
||||
|
||||
// Save.
|
||||
XmlNodeRef nodes = xmlNode->newChild( "Nodes" );
|
||||
int num = GetNodeCount();
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
IAnimNode *node = GetNode(i);
|
||||
if (!node)
|
||||
continue;
|
||||
XmlNodeRef xn = nodes->newChild( "Node" );
|
||||
xn->setAttr( "Id",node->GetId() );
|
||||
xn->setAttr( "Type",node->GetType() );
|
||||
xn->setAttr( "Name",node->GetName() );
|
||||
|
||||
IAnimBlock *ablock = GetAnimBlock(i);
|
||||
if (!ablock)
|
||||
continue;
|
||||
|
||||
ablock->Serialize( node,xn,bLoading );
|
||||
}
|
||||
/*
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimNode *node = it->node;
|
||||
if (!node)
|
||||
continue;
|
||||
IAnimBlock *ablock = it->anim;
|
||||
XmlNodeRef xn = nodes->newChild( "Node" );
|
||||
xn->setAttr( "Id",node->GetId() );
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::SetTimeRange( Range timeRange )
|
||||
{
|
||||
m_timeRange = timeRange;
|
||||
// Set this time range for every track in animation.
|
||||
// Set time range to be in range of largest animation track.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimBlock *ablock = it->anim;
|
||||
if (!ablock)
|
||||
continue;
|
||||
ablock->SetTimeRange( timeRange );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::ScaleTimeRange( const Range &timeRange )
|
||||
{
|
||||
// Calculate scale ratio.
|
||||
float scale = timeRange.Length() / m_timeRange.Length();
|
||||
m_timeRange = timeRange;
|
||||
|
||||
// Set time range to be in range of largest animation track.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimBlock *ablock = it->anim;
|
||||
if (!ablock)
|
||||
continue;
|
||||
|
||||
int paramCount = ablock->GetTrackCount();
|
||||
for (int paramIndex = 0; paramIndex < paramCount; paramIndex++)
|
||||
{
|
||||
int trackType;
|
||||
IAnimTrack *pTrack;
|
||||
if (!ablock->GetTrackInfo( paramIndex,trackType,&pTrack ))
|
||||
continue;
|
||||
if (pTrack)
|
||||
{
|
||||
int nkey = pTrack->GetNumKeys();
|
||||
for (int k = 0; k < nkey; k++)
|
||||
{
|
||||
float keytime = pTrack->GetKeyTime(k);
|
||||
keytime = keytime*scale;
|
||||
pTrack->SetKeyTime(k,keytime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSequence::ComputeTimeRange()
|
||||
{
|
||||
Range timeRange;
|
||||
//timeRange.start = FLT_MAX;
|
||||
//timeRange.end = FLT_MIN;
|
||||
|
||||
timeRange = m_timeRange;
|
||||
|
||||
// Set time range to be in range of largest animation track.
|
||||
for (AnimNodes::iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimBlock *ablock = it->anim;
|
||||
if (!ablock)
|
||||
continue;
|
||||
|
||||
int paramCount = ablock->GetTrackCount();
|
||||
for (int paramIndex = 0; paramIndex < paramCount; paramIndex++)
|
||||
{
|
||||
int trackType;
|
||||
IAnimTrack *pTrack;
|
||||
if (!ablock->GetTrackInfo( paramIndex,trackType,&pTrack ))
|
||||
continue;
|
||||
if (pTrack)
|
||||
{
|
||||
int nkey = pTrack->GetNumKeys();
|
||||
if (nkey > 0)
|
||||
{
|
||||
timeRange.start = min( timeRange.start,pTrack->GetKeyTime(0) );
|
||||
timeRange.end = max( timeRange.end,pTrack->GetKeyTime(nkey-1) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timeRange.start > 0)
|
||||
timeRange.start = 0;
|
||||
|
||||
m_timeRange = timeRange;
|
||||
}
|
||||
92
CryMovie/AnimSequence.h
Normal file
92
CryMovie/AnimSequence.h
Normal file
@@ -0,0 +1,92 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animsequence.h
|
||||
// Version: v1.00
|
||||
// Created: 26/4/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description: Implementation of IAnimSequence interface.
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __animsequence_h__
|
||||
#define __animsequence_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
|
||||
class CAnimSequence : public IAnimSequence
|
||||
{
|
||||
public:
|
||||
CAnimSequence( IMovieSystem *pMovieSystem );
|
||||
|
||||
// Movie system.
|
||||
IMovieSystem* GetMovieSystem() const { return m_pMovieSystem; };
|
||||
|
||||
void SetName( const char *name );
|
||||
const char* GetName();
|
||||
|
||||
virtual void SetFlags( int flags );
|
||||
virtual int GetFlags() const;
|
||||
|
||||
void SetTimeRange( Range timeRange );
|
||||
Range GetTimeRange() { return m_timeRange; };
|
||||
|
||||
void ScaleTimeRange( const Range &timeRange );
|
||||
|
||||
//! Return number of animation nodes in sequence.
|
||||
int GetNodeCount() const;
|
||||
//! Get specified animation node.
|
||||
IAnimNode* GetNode( int index ) const;
|
||||
//! Get Animation assigned to node at specified index.
|
||||
IAnimBlock* GetAnimBlock( int index ) const;
|
||||
|
||||
void Reset();
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
//! Add animation node to sequence.
|
||||
bool AddNode( IAnimNode *node );
|
||||
//! Remove animation node from sequence.
|
||||
void RemoveNode( IAnimNode *node );
|
||||
//! Add scene node to sequence.
|
||||
IAnimNode* AddSceneNode();
|
||||
void RemoveAll();
|
||||
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
void Animate( SAnimContext &ec );
|
||||
|
||||
void Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks=true );
|
||||
|
||||
private:
|
||||
void ComputeTimeRange();
|
||||
|
||||
struct ANode
|
||||
{
|
||||
TSmartPtr<IAnimNode> node;
|
||||
TSmartPtr<IAnimBlock> anim;
|
||||
};
|
||||
typedef std::vector<ANode> AnimNodes;
|
||||
AnimNodes m_nodes;
|
||||
|
||||
AnimString m_name;
|
||||
Range m_timeRange;
|
||||
|
||||
int m_flags;
|
||||
|
||||
TSmartPtr<IAnimNode> m_pSceneNode;
|
||||
|
||||
//
|
||||
IMovieSystem *m_pMovieSystem;
|
||||
bool m_bPaused;
|
||||
};
|
||||
|
||||
#endif // __animsequence_h__
|
||||
18
CryMovie/AnimSplineTrack.cpp
Normal file
18
CryMovie/AnimSplineTrack.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animtrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 22/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "AnimSplineTrack.h"
|
||||
|
||||
461
CryMovie/AnimSplineTrack.h
Normal file
461
CryMovie/AnimSplineTrack.h
Normal file
@@ -0,0 +1,461 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animsplinetrack.h
|
||||
// Version: v1.00
|
||||
// Created: 22/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __animsplinetrack_h__
|
||||
#define __animsplinetrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "Spline.h"
|
||||
|
||||
#define MIN_TIME_PRECISION 0.01f
|
||||
|
||||
/*!
|
||||
Templated class that used as a base for all Tcb spline tracks.
|
||||
*/
|
||||
template <class ValueType>
|
||||
class TAnimTcbTrack : public IAnimTrack
|
||||
{
|
||||
public:
|
||||
TAnimTcbTrack()
|
||||
{
|
||||
AllocSpline();
|
||||
m_flags = 0;
|
||||
}
|
||||
~TAnimTcbTrack()
|
||||
{
|
||||
delete m_spline;
|
||||
}
|
||||
|
||||
int GetNumKeys()
|
||||
{
|
||||
return m_spline->num_keys();
|
||||
}
|
||||
|
||||
void SetNumKeys( int numKeys )
|
||||
{
|
||||
m_spline->resize(numKeys);
|
||||
}
|
||||
|
||||
void RemoveKey( int num )
|
||||
{
|
||||
m_spline->erase(num);
|
||||
}
|
||||
|
||||
void GetKey( int index,IKey *key )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
assert( key != 0 );
|
||||
Spline::key_type &k = m_spline->key(index);
|
||||
ITcbKey *tcbkey = (ITcbKey*)key;
|
||||
tcbkey->time = k.time;
|
||||
tcbkey->flags = k.flags;
|
||||
|
||||
tcbkey->tens = k.tens;
|
||||
tcbkey->cont = k.cont;
|
||||
tcbkey->bias = k.bias;
|
||||
tcbkey->easeto = k.easeto;
|
||||
tcbkey->easefrom = k.easefrom;
|
||||
|
||||
tcbkey->SetValue( k.value );
|
||||
}
|
||||
|
||||
void SetKey( int index,IKey *key )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
assert( key != 0 );
|
||||
Spline::key_type &k = m_spline->key(index);
|
||||
ITcbKey *tcbkey = (ITcbKey*)key;
|
||||
k.time = tcbkey->time;
|
||||
k.flags = tcbkey->flags;
|
||||
k.tens = tcbkey->tens;
|
||||
k.cont = tcbkey->cont;
|
||||
k.bias = tcbkey->bias;
|
||||
k.easeto = tcbkey->easeto;
|
||||
k.easefrom = tcbkey->easefrom;
|
||||
tcbkey->GetValue( k.value );
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
float GetKeyTime( int index )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
return m_spline->time(index);
|
||||
}
|
||||
void SetKeyTime( int index,float time )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
m_spline->key(index).time = time;
|
||||
Invalidate();
|
||||
}
|
||||
int GetKeyFlags( int index )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
return m_spline->key(index).flags;
|
||||
}
|
||||
void SetKeyFlags( int index,int flags )
|
||||
{
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
m_spline->key(index).flags = flags;
|
||||
}
|
||||
|
||||
virtual EAnimTrackType GetType() { assert(0); return 0; }
|
||||
virtual EAnimValue GetValueType() { assert(0); return 0; }
|
||||
|
||||
virtual void GetValue( float time,float &value ) { assert(0); }
|
||||
virtual void GetValue( float time,Vec3 &value ) { assert(0); }
|
||||
virtual void GetValue( float time,Quat &value ) { assert(0); }
|
||||
virtual void GetValue( float time,bool &value ) { assert(0); }
|
||||
|
||||
virtual void SetValue( float time,const float &value,bool bDefault=false ) { assert(0); }
|
||||
virtual void SetValue( float time,const Vec3 &value,bool bDefault=false ) { assert(0); }
|
||||
virtual void SetValue( float time,const Quat &value,bool bDefault=false ) { assert(0); }
|
||||
virtual void SetValue( float time,const bool &value,bool bDefault=false ) { assert(0); }
|
||||
|
||||
bool Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks );
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
description = 0;
|
||||
duration = 0;
|
||||
}
|
||||
|
||||
//! Sort keys in track (after time of keys was modified).
|
||||
void SortKeys() {
|
||||
m_spline->sort_keys();
|
||||
};
|
||||
|
||||
//! Get track flags.
|
||||
int GetFlags() { return m_flags; };
|
||||
|
||||
//! Set track flags.
|
||||
void SetFlags( int flags )
|
||||
{
|
||||
m_flags = flags;
|
||||
if (m_flags & ATRACK_LOOP)
|
||||
{
|
||||
m_spline->ORT( Spline::ORT_LOOP );
|
||||
}
|
||||
else if (m_flags & ATRACK_CYCLE)
|
||||
{
|
||||
m_spline->ORT( Spline::ORT_CYCLE );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spline->ORT( Spline::ORT_CONSTANT );
|
||||
}
|
||||
if (m_flags & ATRACK_LINEAR)
|
||||
{
|
||||
//m_spline->flag_set( ORT_LINEAR );
|
||||
}
|
||||
}
|
||||
|
||||
void Invalidate() {
|
||||
m_spline->flag_set( Spline::MODIFIED );
|
||||
};
|
||||
|
||||
void SetTimeRange( const Range &timeRange )
|
||||
{
|
||||
m_spline->SetRange( timeRange.start,timeRange.end );
|
||||
}
|
||||
|
||||
int FindKey( float time )
|
||||
{
|
||||
// Find key with givven time.
|
||||
int num = m_spline->num_keys();
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
float keyt = m_spline->key(i).time;
|
||||
if (fabs(keyt-time) < MIN_TIME_PRECISION)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! Create key at givven time, and return its index.
|
||||
int CreateKey( float time )
|
||||
{
|
||||
ValueType value;
|
||||
|
||||
int nkey = GetNumKeys();
|
||||
|
||||
if (nkey > 0)
|
||||
GetValue( time,value );
|
||||
else
|
||||
value = m_defaultValue;
|
||||
|
||||
SetNumKeys( nkey+1 );
|
||||
|
||||
ITcbKey key;
|
||||
key.time = time;
|
||||
key.SetValue(value);
|
||||
SetKey( nkey,&key );
|
||||
|
||||
return nkey;
|
||||
}
|
||||
|
||||
int CloneKey( int srcKey )
|
||||
{
|
||||
ITcbKey key;
|
||||
GetKey( srcKey,&key );
|
||||
int nkey = GetNumKeys();
|
||||
SetNumKeys( nkey+1 );
|
||||
SetKey( nkey,&key );
|
||||
|
||||
return nkey;
|
||||
}
|
||||
|
||||
int CopyKey( IAnimTrack *pFromTrack, int nFromKey )
|
||||
{
|
||||
ITcbKey key;
|
||||
pFromTrack->GetKey( nFromKey,&key );
|
||||
int nkey = GetNumKeys();
|
||||
SetNumKeys( nkey+1 );
|
||||
SetKey( nkey,&key );
|
||||
return nkey;
|
||||
}
|
||||
|
||||
//! Get key at givven time,
|
||||
//! If key not exist adds key at this time.
|
||||
void SetKeyAtTime( float time,IKey *key )
|
||||
{
|
||||
assert( key != 0 );
|
||||
|
||||
key->time = time;
|
||||
|
||||
bool found = false;
|
||||
// Find key with givven time.
|
||||
for (int i = 0; i < m_spline->num_keys(); i++)
|
||||
{
|
||||
float keyt = m_spline->key(i).time;
|
||||
if (fabs(keyt-time) < MIN_TIME_PRECISION)
|
||||
{
|
||||
SetKey( i,key );
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
//if (keyt > time)
|
||||
//break;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
// Key with this time not found.
|
||||
// Create a new one.
|
||||
m_spline->resize( m_spline->num_keys()+1 );
|
||||
SetKey( m_spline->num_keys()-1,key );
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
//! Spawns new instance of Tcb spline.
|
||||
void AllocSpline()
|
||||
{
|
||||
m_spline = new Spline;
|
||||
}
|
||||
|
||||
typedef TCBSpline<ValueType> Spline;
|
||||
Spline* m_spline;
|
||||
ValueType m_defaultValue;
|
||||
|
||||
//! Keys of float track.
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool TAnimTcbTrack<T>::Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
int num = xmlNode->getChildCount();
|
||||
|
||||
int flags = m_flags;
|
||||
xmlNode->getAttr( "Flags",flags );
|
||||
SetFlags( flags );
|
||||
|
||||
T value;
|
||||
SetNumKeys( num );
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
ITcbKey key; // Must be inside loop.
|
||||
|
||||
XmlNodeRef keyNode = xmlNode->getChild(i);
|
||||
keyNode->getAttr( "time",key.time );
|
||||
|
||||
if (keyNode->getAttr( "value",value ))
|
||||
key.SetValue( value );
|
||||
|
||||
keyNode->getAttr( "tens",key.tens );
|
||||
keyNode->getAttr( "cont",key.cont );
|
||||
keyNode->getAttr( "bias",key.bias );
|
||||
keyNode->getAttr( "easeto",key.easeto );
|
||||
keyNode->getAttr( "easefrom",key.easefrom );
|
||||
|
||||
SetKey( i,&key );
|
||||
}
|
||||
|
||||
if ((!num) && (!bLoadEmptyTracks))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = GetNumKeys();
|
||||
xmlNode->setAttr( "Flags",GetFlags() );
|
||||
ITcbKey key;
|
||||
T value;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
GetKey( i,&key );
|
||||
XmlNodeRef keyNode = xmlNode->newChild( "Key" );
|
||||
keyNode->setAttr( "time",key.time );
|
||||
|
||||
key.GetValue( value );
|
||||
keyNode->setAttr( "value",value );
|
||||
|
||||
if (key.tens != 0)
|
||||
keyNode->setAttr( "tens",key.tens );
|
||||
if (key.cont != 0)
|
||||
keyNode->setAttr( "cont",key.cont );
|
||||
if (key.bias != 0)
|
||||
keyNode->setAttr( "bias",key.bias );
|
||||
if (key.easeto != 0)
|
||||
keyNode->setAttr( "easeto",key.easeto );
|
||||
if (key.easefrom != 0)
|
||||
keyNode->setAttr( "easefrom",key.easefrom );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Specialize for single float track.
|
||||
template <> TAnimTcbTrack<float>::TAnimTcbTrack<float>()
|
||||
{
|
||||
AllocSpline();
|
||||
m_flags = 0;
|
||||
m_defaultValue = 0;
|
||||
}
|
||||
template <> void TAnimTcbTrack<float>::GetValue( float time,float &value ) { m_spline->interpolate(time,value); }
|
||||
template <> EAnimTrackType TAnimTcbTrack<float>::GetType() { return ATRACK_TCB_FLOAT; }
|
||||
template <> EAnimValue TAnimTcbTrack<float>::GetValueType() { return AVALUE_FLOAT; }
|
||||
template <> void TAnimTcbTrack<float>::SetValue( float time,const float &value,bool bDefault )
|
||||
{
|
||||
if (!bDefault)
|
||||
{
|
||||
ITcbKey key;
|
||||
key.SetValue( value );
|
||||
SetKeyAtTime( time,&key );
|
||||
}
|
||||
else
|
||||
m_defaultValue = value;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template<> void TAnimTcbTrack<float>::GetKeyInfo( int index,const char* &description,float &duration )
|
||||
{
|
||||
duration = 0;
|
||||
|
||||
static char str[64];
|
||||
description = str;
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
Spline::key_type &k = m_spline->key(index);
|
||||
sprintf( str,"%g",k.value );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Specialize for Vector track.
|
||||
template <> TAnimTcbTrack<Vec3>::TAnimTcbTrack<Vec3>()
|
||||
{
|
||||
AllocSpline();
|
||||
m_flags = 0;
|
||||
m_defaultValue = Vec3(0,0,0);
|
||||
}
|
||||
template <> void TAnimTcbTrack<Vec3>::GetValue( float time,Vec3 &value ) { m_spline->interpolate(time,value); }
|
||||
template <> EAnimTrackType TAnimTcbTrack<Vec3>::GetType() { return ATRACK_TCB_VECTOR; }
|
||||
template <> EAnimValue TAnimTcbTrack<Vec3>::GetValueType() { return AVALUE_VECTOR; }
|
||||
template <> void TAnimTcbTrack<Vec3>::SetValue( float time,const Vec3 &value,bool bDefault )
|
||||
{
|
||||
if (!bDefault)
|
||||
{
|
||||
ITcbKey key;
|
||||
key.SetValue( value );
|
||||
SetKeyAtTime( time,&key );
|
||||
}
|
||||
else
|
||||
m_defaultValue = value;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <> void TAnimTcbTrack<Vec3>::GetKeyInfo( int index,const char* &description,float &duration )
|
||||
{
|
||||
duration = 0;
|
||||
|
||||
static char str[64];
|
||||
description = str;
|
||||
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
Spline::key_type &k = m_spline->key(index);
|
||||
sprintf( str,"%g,%g,%g",k.value[0],k.value[1],k.value[2] );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Specialize for Quaternion track.
|
||||
//! Spezialize spline creation for quaternion.
|
||||
template <> TAnimTcbTrack<Quat>::TAnimTcbTrack<Quat>()
|
||||
{
|
||||
m_spline = new TCBQuatSpline;
|
||||
m_flags = 0;
|
||||
m_defaultValue.SetIdentity();
|
||||
}
|
||||
|
||||
template <> void TAnimTcbTrack<Quat>::GetValue( float time,Quat &value ) { m_spline->interpolate(time,value); }
|
||||
template <> EAnimTrackType TAnimTcbTrack<Quat>::GetType() { return ATRACK_TCB_QUAT; }
|
||||
template <> EAnimValue TAnimTcbTrack<Quat>::GetValueType() { return AVALUE_QUAT; }
|
||||
template <> void TAnimTcbTrack<Quat>::SetValue( float time,const Quat &value,bool bDefault )
|
||||
{
|
||||
if (!bDefault)
|
||||
{
|
||||
ITcbKey key;
|
||||
key.SetValue( value );
|
||||
SetKeyAtTime( time,&key );
|
||||
}
|
||||
else
|
||||
m_defaultValue = value;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <> void TAnimTcbTrack<Quat>::GetKeyInfo( int index,const char* &description,float &duration )
|
||||
{
|
||||
duration = 0;
|
||||
|
||||
static char str[64];
|
||||
description = str;
|
||||
|
||||
assert( index >= 0 && index < GetNumKeys() );
|
||||
Spline::key_type &k = m_spline->key(index);
|
||||
Vec3 Angles=RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(k.value)));
|
||||
sprintf( str,"%g,%g,%g",Angles.x, Angles.y, Angles.z );
|
||||
}
|
||||
|
||||
typedef TAnimTcbTrack<float> CTcbFloatTrack;
|
||||
typedef TAnimTcbTrack<Vec3> CTcbVectorTrack;
|
||||
typedef TAnimTcbTrack<Quat> CTcbQuatTrack;
|
||||
|
||||
#endif // __animsplinetrack_h__
|
||||
17
CryMovie/AnimTrack.cpp
Normal file
17
CryMovie/AnimTrack.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animtrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 22/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "AnimTrack.h"
|
||||
405
CryMovie/AnimTrack.h
Normal file
405
CryMovie/AnimTrack.h
Normal file
@@ -0,0 +1,405 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: animtrack.h
|
||||
// Version: v1.00
|
||||
// Created: 22/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __animtrack_h__
|
||||
#define __animtrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//forward declarations.
|
||||
#include "IMovieSystem.h"
|
||||
|
||||
/** General templated track for event type keys.
|
||||
KeyType class must be derived from IKey.
|
||||
*/
|
||||
template <class KeyType>
|
||||
class TAnimTrack : public IAnimTrack
|
||||
{
|
||||
public:
|
||||
TAnimTrack();
|
||||
|
||||
//! Return number of keys in track.
|
||||
virtual int GetNumKeys() { return m_keys.size(); };
|
||||
|
||||
//! Set number of keys in track.
|
||||
//! If needed adds empty keys at end or remove keys from end.
|
||||
virtual void SetNumKeys( int numKeys ) { m_keys.resize(numKeys); };
|
||||
|
||||
//! Remove specified key.
|
||||
virtual void RemoveKey( int num );
|
||||
|
||||
int CreateKey( float time );
|
||||
int CloneKey( int fromKey );
|
||||
int CopyKey( IAnimTrack *pFromTrack, int nFromKey );
|
||||
|
||||
//! Get key at specified location.
|
||||
//! @param key Must be valid pointer to compatable key structure, to be filled with specified key location.
|
||||
virtual void GetKey( int index,IKey *key );
|
||||
|
||||
//! Get time of specified key.
|
||||
//! @return key time.
|
||||
virtual float GetKeyTime( int index );
|
||||
|
||||
//! Find key at givven time.
|
||||
//! @return Index of found key, or -1 if key with this time not found.
|
||||
virtual int FindKey( float time );
|
||||
|
||||
//! Get flags of specified key.
|
||||
//! @return key time.
|
||||
virtual int GetKeyFlags( int index );
|
||||
|
||||
//! Set key at specified location.
|
||||
//! @param key Must be valid pointer to compatable key structure.
|
||||
virtual void SetKey( int index,IKey *key );
|
||||
|
||||
//! Set time of specified key.
|
||||
virtual void SetKeyTime( int index,float time );
|
||||
|
||||
//! Set flags of specified key.
|
||||
virtual void SetKeyFlags( int index,int flags );
|
||||
|
||||
//! Sort keys in track (after time of keys was modified).
|
||||
virtual void SortKeys();
|
||||
|
||||
//! Get track flags.
|
||||
virtual int GetFlags() { return m_flags; };
|
||||
|
||||
//! Set track flags.
|
||||
virtual void SetFlags( int flags ) { m_flags = flags; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Get track value at specified time.
|
||||
// Interpolates keys if needed.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void GetValue( float time,float &value ) { assert(0); };
|
||||
virtual void GetValue( float time,Vec3 &value ) { assert(0); };
|
||||
virtual void GetValue( float time,Quat &value ) { assert(0); };
|
||||
virtual void GetValue( float time,bool &value ) { assert(0); };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set track value at specified time.
|
||||
// Adds new keys if required.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetValue( float time,const float &value,bool bDefault=false ) { assert(0); };
|
||||
virtual void SetValue( float time,const Vec3 &value,bool bDefault=false ) { assert(0); };
|
||||
virtual void SetValue( float time,const Quat &value,bool bDefault=false ) { assert(0); };
|
||||
virtual void SetValue( float time,const bool &value,bool bDefault=false ) { assert(0); };
|
||||
|
||||
/** Assign active time range for this track.
|
||||
*/
|
||||
virtual void SetTimeRange( const Range &timeRange ) { m_timeRange = timeRange; };
|
||||
|
||||
/** Serialize this animation track to XML.
|
||||
Do not ovveride this method, prefere to override SerializeKey.
|
||||
*/
|
||||
virtual bool Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bLoadEmptyTracks=true );
|
||||
|
||||
/** Serialize single key of this track.
|
||||
Ovvride this in derived classes.
|
||||
Do not save time attribute, it is already saved in Serialize of the track.
|
||||
*/
|
||||
virtual void SerializeKey( KeyType &key,XmlNodeRef &keyNode,bool bLoading ) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** Get last key before specified time.
|
||||
@return Index of key, or -1 if such key not exist.
|
||||
*/
|
||||
int GetActiveKey( float time,KeyType *key );
|
||||
|
||||
protected:
|
||||
void CheckValid()
|
||||
{
|
||||
if (m_bModified)
|
||||
SortKeys();
|
||||
};
|
||||
void Invalidate() { m_bModified = true; };
|
||||
|
||||
typedef std::vector<KeyType> Keys;
|
||||
Keys m_keys;
|
||||
Range m_timeRange;
|
||||
|
||||
int m_currKey;
|
||||
bool m_bModified;
|
||||
|
||||
float m_lastTime;
|
||||
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline TAnimTrack<KeyType>::TAnimTrack()
|
||||
{
|
||||
m_currKey = 0;
|
||||
m_flags = 0;
|
||||
m_lastTime = -1;
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::RemoveKey( int index )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
m_keys.erase( m_keys.begin() + index );
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::GetKey( int index,IKey *key )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
assert( key != 0 );
|
||||
*(KeyType*)key = m_keys[index];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::SetKey( int index,IKey *key )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
assert( key != 0 );
|
||||
m_keys[index] = *(KeyType*)key;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline float TAnimTrack<KeyType>::GetKeyTime( int index )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
return m_keys[index].time;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::SetKeyTime( int index,float time )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
m_keys[index].time = time;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::FindKey( float time )
|
||||
{
|
||||
for (int i = 0; i < (int)m_keys.size(); i++)
|
||||
{
|
||||
if (m_keys[i].time == time)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::GetKeyFlags( int index )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
return m_keys[index].flags;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::SetKeyFlags( int index,int flags )
|
||||
{
|
||||
assert( index >= 0 && index < (int)m_keys.size() );
|
||||
m_keys[index].flags = flags;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline void TAnimTrack<KeyType>::SortKeys()
|
||||
{
|
||||
std::sort( m_keys.begin(),m_keys.end() );
|
||||
m_bModified = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline bool TAnimTrack<KeyType>::Serialize( XmlNodeRef &xmlNode,bool bLoading,bool bLoadEmptyTracks )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
int num = xmlNode->getChildCount();
|
||||
|
||||
Range timeRange;
|
||||
int flags = m_flags;
|
||||
xmlNode->getAttr( "Flags",flags );
|
||||
xmlNode->getAttr( "StartTime",timeRange.start );
|
||||
xmlNode->getAttr( "EndTime",timeRange.end );
|
||||
SetFlags( flags );
|
||||
SetTimeRange(timeRange);
|
||||
|
||||
SetNumKeys( num );
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
XmlNodeRef keyNode = xmlNode->getChild(i);
|
||||
keyNode->getAttr( "time",m_keys[i].time );
|
||||
|
||||
SerializeKey( m_keys[i],keyNode,bLoading );
|
||||
}
|
||||
|
||||
if ((!num) && (!bLoadEmptyTracks))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = GetNumKeys();
|
||||
CheckValid();
|
||||
xmlNode->setAttr( "Flags",GetFlags() );
|
||||
xmlNode->setAttr( "StartTime",m_timeRange.start );
|
||||
xmlNode->setAttr( "EndTime",m_timeRange.end );
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
XmlNodeRef keyNode = xmlNode->newChild( "Key" );
|
||||
keyNode->setAttr( "time",m_keys[i].time );
|
||||
|
||||
SerializeKey( m_keys[i],keyNode,bLoading );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::CreateKey( float time )
|
||||
{
|
||||
KeyType key,akey;
|
||||
int nkey = GetNumKeys();
|
||||
SetNumKeys( nkey+1 );
|
||||
key.time = time;
|
||||
SetKey( nkey,&key );
|
||||
|
||||
return nkey;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::CloneKey( int fromKey )
|
||||
{
|
||||
KeyType key;
|
||||
GetKey( fromKey,&key );
|
||||
int nkey = GetNumKeys();
|
||||
SetNumKeys( nkey+1 );
|
||||
SetKey( nkey,&key );
|
||||
return nkey;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::CopyKey( IAnimTrack *pFromTrack, int nFromKey )
|
||||
{
|
||||
KeyType key;
|
||||
pFromTrack->GetKey( nFromKey,&key );
|
||||
int nkey = GetNumKeys();
|
||||
SetNumKeys( nkey+1 );
|
||||
SetKey( nkey,&key );
|
||||
return nkey;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
template <class KeyType>
|
||||
inline int TAnimTrack<KeyType>::GetActiveKey( float time,KeyType *key )
|
||||
{
|
||||
CheckValid();
|
||||
|
||||
int nkeys = m_keys.size();
|
||||
if (nkeys == 0)
|
||||
{
|
||||
m_lastTime = time;
|
||||
m_currKey = -1;
|
||||
return m_currKey;
|
||||
}
|
||||
|
||||
bool bTimeWrap = false;
|
||||
|
||||
if ((m_flags&ATRACK_CYCLE) || (m_flags&ATRACK_LOOP))
|
||||
{
|
||||
// Warp time.
|
||||
const char *desc = 0;
|
||||
float duration = 0;
|
||||
GetKeyInfo( nkeys-1,desc,duration );
|
||||
float endtime = GetKeyTime(nkeys-1) + duration;
|
||||
time = cry_fmod( time,endtime );
|
||||
if (time < m_lastTime)
|
||||
{
|
||||
// Time is wrapped.
|
||||
bTimeWrap = true;
|
||||
}
|
||||
}
|
||||
m_lastTime = time;
|
||||
|
||||
// Time is before first key.
|
||||
if (m_keys[0].time > time)
|
||||
{
|
||||
if (bTimeWrap)
|
||||
{
|
||||
// If time wrapped, active key is last key.
|
||||
m_currKey = nkeys-1;
|
||||
*key = m_keys[m_currKey];
|
||||
}
|
||||
else
|
||||
m_currKey = -1;
|
||||
return m_currKey;
|
||||
}
|
||||
|
||||
if (m_currKey < 0)
|
||||
m_currKey = 0;
|
||||
|
||||
// Start from current key.
|
||||
int i;
|
||||
for (i = m_currKey; i < nkeys; i++)
|
||||
{
|
||||
if (time >= m_keys[i].time)
|
||||
{
|
||||
if ((i >= nkeys-1) || (time < m_keys[i+1].time))
|
||||
{
|
||||
m_currKey = i;
|
||||
*key = m_keys[m_currKey];
|
||||
return m_currKey;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Start from begining.
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (time >= m_keys[i].time)
|
||||
{
|
||||
if ((i >= nkeys-1) || (time < m_keys[i+1].time))
|
||||
{
|
||||
m_currKey = i;
|
||||
*key = m_keys[m_currKey];
|
||||
return m_currKey;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
m_currKey = -1;
|
||||
return m_currKey;
|
||||
}
|
||||
|
||||
#endif // __animtrack_h__
|
||||
48
CryMovie/BoolTrack.cpp
Normal file
48
CryMovie/BoolTrack.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: booltrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 4/6/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "BoolTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBoolTrack::GetKeyInfo( int index,const char* &description,float &duration )
|
||||
{
|
||||
description = 0;
|
||||
duration = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBoolTrack::GetValue( float time,bool &value )
|
||||
{
|
||||
value = true; // True by default.
|
||||
|
||||
CheckValid();
|
||||
|
||||
int nkeys = m_keys.size();
|
||||
if (nkeys < 1)
|
||||
return;
|
||||
|
||||
int key = 0;
|
||||
while ((key < nkeys) && (time >= m_keys[key].time))
|
||||
key++;
|
||||
|
||||
value = !(key & 1); // True if even key.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBoolTrack::SetValue( float time,const bool &value,bool bDefault )
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
49
CryMovie/BoolTrack.h
Normal file
49
CryMovie/BoolTrack.h
Normal file
@@ -0,0 +1,49 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: booltrack.h
|
||||
// Version: v1.00
|
||||
// Created: 4/6/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __booltrack_h__
|
||||
#define __booltrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
//! Boolean key.
|
||||
struct IBoolKey : public IKey
|
||||
{
|
||||
IBoolKey() {};
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** Boolean track, every key on this track negates boolean value.
|
||||
*/
|
||||
class CBoolTrack : public TAnimTrack<IBoolKey>
|
||||
{
|
||||
public:
|
||||
virtual EAnimTrackType GetType() { return ATRACK_BOOL; };
|
||||
virtual EAnimValue GetValueType() { return AVALUE_BOOL; };
|
||||
|
||||
virtual void GetValue( float time,bool &value );
|
||||
virtual void SetValue( float time,const bool &value,bool bDefault=false );
|
||||
|
||||
void SerializeKey( IBoolKey &key,XmlNodeRef &keyNode,bool bLoading ) {};
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
};
|
||||
|
||||
#endif // __booltrack_h__
|
||||
105
CryMovie/CVarNode.cpp
Normal file
105
CryMovie/CVarNode.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: CVarNode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 10/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "CVarNode.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <IConsole.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimCVarNode::CAnimCVarNode( IMovieSystem *sys )
|
||||
: CAnimNode(sys)
|
||||
{
|
||||
SetFlags( GetFlags()|ANODE_FLAG_CAN_CHANGE_NAME );
|
||||
m_dwSupportedTracks = PARAM_BIT(APARAM_FLOAT_1);
|
||||
m_value = 0;
|
||||
}
|
||||
|
||||
void CAnimCVarNode::CreateDefaultTracks()
|
||||
{
|
||||
CreateTrack(APARAM_FLOAT_1);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimCVarNode::GetParamCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCVarNode::GetParamInfo( int nIndex, SParamInfo &info ) const
|
||||
{
|
||||
if (nIndex == 0)
|
||||
{
|
||||
info.flags = 0;
|
||||
info.name = "Value";
|
||||
info.paramId = APARAM_FLOAT_1;
|
||||
info.valueType = AVALUE_FLOAT;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimCVarNode::GetParamInfoFromId( int paramId, SParamInfo &info ) const
|
||||
{
|
||||
if (paramId == APARAM_FLOAT_1)
|
||||
{
|
||||
GetParamInfo( 0,info );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCVarNode::SetName( const char *name )
|
||||
{
|
||||
// Name of node is used as a name of console var.
|
||||
CAnimNode::SetName(name);
|
||||
ICVar *pVar = m_pMovieSystem->GetSystem()->GetIConsole()->GetCVar( GetName(),false );
|
||||
if (pVar)
|
||||
{
|
||||
m_value = pVar->GetFVal();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimCVarNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (!anim)
|
||||
return;
|
||||
|
||||
float value = m_value;
|
||||
|
||||
IAnimTrack *pValueTrack = anim->GetTrack(APARAM_FLOAT_1);
|
||||
if (pValueTrack)
|
||||
{
|
||||
pValueTrack->GetValue(ec.time, value);
|
||||
}
|
||||
|
||||
if (value != m_value)
|
||||
{
|
||||
m_value = value;
|
||||
// Change console var value.
|
||||
ICVar *pVar = m_pMovieSystem->GetSystem()->GetIConsole()->GetCVar( GetName(),false );
|
||||
if (pVar)
|
||||
{
|
||||
pVar->Set( m_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
45
CryMovie/CVarNode.h
Normal file
45
CryMovie/CVarNode.h
Normal file
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: CVarNode.h
|
||||
// Version: v1.00
|
||||
// Created: 10/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __CVarNode_h__
|
||||
#define __CVarNode_h__
|
||||
#pragma once
|
||||
|
||||
#include "AnimNode.h"
|
||||
|
||||
class CAnimCVarNode : public CAnimNode
|
||||
{
|
||||
public:
|
||||
CAnimCVarNode( IMovieSystem *sys );
|
||||
|
||||
virtual EAnimNodeType GetType() const { return ANODE_CVAR; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides from CAnimNode
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetName( const char *name );
|
||||
void Animate( SAnimContext &ec );
|
||||
void CreateDefaultTracks();
|
||||
|
||||
virtual int GetParamCount() const;
|
||||
virtual bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
virtual bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
private:
|
||||
float m_value;
|
||||
};
|
||||
|
||||
#endif // __CVarNode_h__
|
||||
|
||||
83
CryMovie/CharacterTrack.cpp
Normal file
83
CryMovie/CharacterTrack.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: charactertrack.h.cpp
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "CharacterTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCharacterTrack::SerializeKey( ICharacterKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
str = keyNode->getAttr( "anim" );
|
||||
strncpy( key.animation,str,sizeof(key.animation) );
|
||||
key.animation[sizeof(key.animation)-1] = 0;
|
||||
|
||||
key.duration = 0;
|
||||
key.blendTime = 0;
|
||||
key.startTime = 0;
|
||||
key.bLoop = false;
|
||||
key.speed = 1;
|
||||
keyNode->getAttr( "length",key.duration );
|
||||
keyNode->getAttr( "blend",key.blendTime );
|
||||
keyNode->getAttr( "speed",key.speed );
|
||||
keyNode->getAttr( "loop",key.bLoop );
|
||||
keyNode->getAttr( "unload",key.bUnload );
|
||||
keyNode->getAttr( "start",key.startTime );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(key.animation) > 0)
|
||||
keyNode->setAttr( "anim",key.animation );
|
||||
if (key.duration > 0)
|
||||
keyNode->setAttr( "length",key.duration );
|
||||
if (key.blendTime > 0)
|
||||
keyNode->setAttr( "blend",key.blendTime );
|
||||
if (key.speed != 1)
|
||||
keyNode->setAttr( "speed",key.speed );
|
||||
if (key.bLoop)
|
||||
keyNode->setAttr( "loop",key.bLoop );
|
||||
if (key.bUnload)
|
||||
keyNode->setAttr( "unload",key.bUnload );
|
||||
if (key.startTime != 0)
|
||||
keyNode->setAttr( "start",key.startTime );
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = 0;
|
||||
if (strlen(m_keys[key].animation) > 0)
|
||||
{
|
||||
description = m_keys[key].animation;
|
||||
if (m_keys[key].bLoop)
|
||||
{
|
||||
float lastTime = m_timeRange.end;
|
||||
if (key+1 < (int)m_keys.size())
|
||||
{
|
||||
lastTime = m_keys[key+1].time;
|
||||
}
|
||||
// duration is unlimited but cannot last past end of track or time of next key on track.
|
||||
duration = lastTime - m_keys[key].time;
|
||||
}
|
||||
else
|
||||
duration = (m_keys[key].duration - m_keys[key].startTime) / m_keys[key].speed;
|
||||
}
|
||||
}
|
||||
42
CryMovie/CharacterTrack.h
Normal file
42
CryMovie/CharacterTrack.h
Normal file
@@ -0,0 +1,42 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: charactertrack.h
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __charactertrack_h__
|
||||
#define __charactertrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//forward declarations.
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
/** CCharacterTrack contains entity keys, when time reach event key, it fires script event or start animation etc...
|
||||
*/
|
||||
class CCharacterTrack : public TAnimTrack<ICharacterKey>
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides of IAnimTrack.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EAnimTrackType GetType() { return ATRACK_CHARACTER; };
|
||||
EAnimValue GetValueType() { return AVALUE_CHARACTER; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( ICharacterKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __charactertrack_h__
|
||||
45
CryMovie/ConsoleTrack.cpp
Normal file
45
CryMovie/ConsoleTrack.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: consoletrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 12/6/2003 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ConsoleTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CConsoleTrack::SerializeKey( IConsoleKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *str;
|
||||
str = keyNode->getAttr( "command" );
|
||||
strncpy( key.command,str,sizeof(key.command) );
|
||||
key.command[sizeof(key.command)-1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(key.command) > 0)
|
||||
keyNode->setAttr( "command",key.command );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CConsoleTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = 0;
|
||||
if (strlen(m_keys[key].command) > 0)
|
||||
description = m_keys[key].command;
|
||||
}
|
||||
40
CryMovie/ConsoleTrack.h
Normal file
40
CryMovie/ConsoleTrack.h
Normal file
@@ -0,0 +1,40 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: consoletrack.h
|
||||
// Version: v1.00
|
||||
// Created: 12/6/2003 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __consoletrack_h__
|
||||
#define __consoletrack_h__
|
||||
#pragma once
|
||||
|
||||
//forward declarations.
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
#include "AnimKey.h"
|
||||
|
||||
/** EntityTrack contains entity keys, when time reach event key, it fires script event or start animation etc...
|
||||
*/
|
||||
class CConsoleTrack : public TAnimTrack<IConsoleKey>
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides of IAnimTrack.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EAnimTrackType GetType() { return ATRACK_CONSOLE; };
|
||||
EAnimValue GetValueType() { return AVALUE_CONSOLE; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( IConsoleKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __consoletrack_h__
|
||||
38
CryMovie/CryMovie.cpp
Normal file
38
CryMovie/CryMovie.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// CryMovie.cpp : Defines the entry point for the DLL application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CryMovie.h"
|
||||
#include "movie.h"
|
||||
#include <CrtDebugStats.h>
|
||||
|
||||
#ifdef USING_CRY_MEMORY_MANAGER
|
||||
_ACCESS_POOL
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
BOOL APIENTRY DllMain( HANDLE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif //WIN32
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
CRYMOVIE_API IMovieSystem *CreateMovieSystem(ISystem *pSystem)
|
||||
{
|
||||
return new CMovieSystem(pSystem);
|
||||
};
|
||||
}
|
||||
27
CryMovie/CryMovie.h
Normal file
27
CryMovie/CryMovie.h
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the CRYMOVIE_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// CRYMOVIE_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
#ifdef WIN32
|
||||
#ifdef CRYMOVIE_EXPORTS
|
||||
#define CRYMOVIE_API __declspec(dllexport)
|
||||
#else
|
||||
#define CRYMOVIE_API __declspec(dllimport)
|
||||
#endif
|
||||
#else //WIN32
|
||||
#define CRYMOVIE_API
|
||||
#endif //WIN32
|
||||
|
||||
struct ISystem;
|
||||
struct IMovieSystem;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
CRYMOVIE_API IMovieSystem *CreateMovieSystem(ISystem *pSystem);
|
||||
CRYMOVIE_API void DeleteMovieSystem(IMovieSystem *pMM);
|
||||
|
||||
}
|
||||
553
CryMovie/CryMovie.vcproj
Normal file
553
CryMovie/CryMovie.vcproj
Normal file
@@ -0,0 +1,553 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="CryMovie"
|
||||
ProjectGUID="{119CC33C-E31E-4A39-A38E-4AE64B8A359F}"
|
||||
SccProjectName="Perforce Project"
|
||||
SccAuxPath=""
|
||||
SccLocalPath="."
|
||||
SccProvider="MSSCCI:Perforce SCM">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="D:\Games\FC\Bin32"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="0"
|
||||
AdditionalIncludeDirectories="..\CryCommon"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CRYMOVIE_EXPORTS"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/CryMovie.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ImportLibrary="$(IntDir)/$(TargetName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/CryMovie.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1031"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="D:\Games\FC\Bin32"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
EnableFiberSafeOptimizations="FALSE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="..\CryCommon,."
|
||||
PreprocessorDefinitions="_RELEASE;WIN32;NDEBUG;_WINDOWS;_USRDLL;CRYMOVIE_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
EnableFunctionLevelLinking="FALSE"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Release/CryMovie.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
OutputFile=".\Release/CryMovie.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ProgramDatabaseFile=".\Release/CryMovie.pdb"
|
||||
ImportLibrary="$(IntDir)/$(TargetName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/CryMovie.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1031"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Profile|Win32"
|
||||
OutputDirectory="D:\Games\FC\Bin32"
|
||||
IntermediateDirectory="Profile"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
EnableFiberSafeOptimizations="FALSE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories="..\CryCommon,."
|
||||
PreprocessorDefinitions="_RELEASE;WIN32;NDEBUG;_WINDOWS;_USRDLL;CRYMOVIE_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
EnableFunctionLevelLinking="FALSE"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Release/CryMovie.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
BaseAddress="0x34000000"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/CryMovie.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1031"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug64|Win32"
|
||||
OutputDirectory="D:\Games\FC\Bin32"
|
||||
IntermediateDirectory="Debug64"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\CryCommon"
|
||||
PreprocessorDefinitions="WIN64;_DEBUG;_WINDOWS;_USRDLL;CRYMOVIE_EXPORTS"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="1"
|
||||
BufferSecurityCheck="FALSE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"
|
||||
AssemblerListingLocation="$(IntDir)/"
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:AMD64"
|
||||
AdditionalDependencies="../CryCommon/fSinCos64.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
LargeAddressAware="2"
|
||||
ImportLibrary="$(OutDir)/$(ProjectName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/CryMovie.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1031"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release64|Win32"
|
||||
OutputDirectory="D:\Games\FC\Bin32"
|
||||
IntermediateDirectory="Release64"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
AdditionalIncludeDirectories="..\CryCommon"
|
||||
PreprocessorDefinitions="_RELEASE;NDEBUG;WIN64;WIN32;_AMD64_;_WINDOWS;_USRDLL;CRYMOVIE_EXPORTS"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="FALSE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)/$(ProjectName).pch"
|
||||
AssemblerListingLocation="$(IntDir)/"
|
||||
ObjectFile="$(IntDir)/"
|
||||
ProgramDataBaseFileName="$(IntDir)/$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:AMD64"
|
||||
AdditionalDependencies="../CryCommon/fSinCos64.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
LargeAddressAware="2"
|
||||
ImportLibrary="$(OutDir)/$(ProjectName).lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/CryMovie.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1031"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="AnimCameraNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSequence.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSplineTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BoolTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CharacterTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ConsoleTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CryMovie.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CVarNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EntityNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EventTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ExprTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MaterialNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Movie.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MusicTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SceneNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScriptVarNode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SelectTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SequenceIt.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SoundTrack.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug64|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release64|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="AnimCameraNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSequence.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSplineTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BoolTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CharacterTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ConsoleTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CryMovie.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\CVarNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EntityNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EventTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ExprTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MaterialNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Movie.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MusicTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SceneNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScriptVarNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SelectTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SequenceIt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="smartptr.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SoundTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Spline.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
10
CryMovie/CryMovie.vcproj.vspscc
Normal file
10
CryMovie/CryMovie.vcproj.vspscc
Normal file
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = "file:F:\\Crytek\\CryMovie\\CryMovie.vcproj"
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
|
||||
}
|
||||
597
CryMovie/CryMovie_XBox.vcproj
Normal file
597
CryMovie/CryMovie_XBox.vcproj
Normal file
@@ -0,0 +1,597 @@
|
||||
<?xml version="1.0" encoding = "windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.00"
|
||||
Name="CryMovie_XBox"
|
||||
SccProjectName=""$/Game01/CryMovie", YREBAAAA"
|
||||
SccAuxPath=""
|
||||
SccLocalPath="."
|
||||
SccProvider="MSSCCI:Microsoft Visual SourceSafe">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Xbox"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Xbox"
|
||||
OutputDirectory="Debug_XBox"
|
||||
IntermediateDirectory="Debug_XBox"
|
||||
ConfigurationType="4">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\;..\CryCommon"
|
||||
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
AssemblerListingLocation=".\Debug_XBox/"
|
||||
ObjectFile=".\Debug_XBox/"
|
||||
ProgramDataBaseFileName=".\Debug_XBox/"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/CryMovie.lib"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Xbox"
|
||||
OutputDirectory="Release_XBox"
|
||||
IntermediateDirectory="Release_XBox"
|
||||
ConfigurationType="4">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".\;..\CryCommon"
|
||||
PreprocessorDefinitions="_RELEASE;NDEBUG;_XBOX;_LIB"
|
||||
DebugInformationFormat="2"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/CryMovie.lib"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Profile|Xbox"
|
||||
OutputDirectory="Profile"
|
||||
IntermediateDirectory="Profile"
|
||||
ConfigurationType="4">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".\;..\CryCommon"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB"
|
||||
StringPooling="TRUE"
|
||||
BufferSecurityCheck="FALSE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/CryMovie.lib"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="AnimCameraNode.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimNode.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSequence.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSplineTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BoolTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CharacterTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CryMovie.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EntityNode.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EventTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ExprTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Movie.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SceneNode.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SelectTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SequenceIt.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SoundTrack.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="AnimCameraNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSequence.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimSplineTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="AnimTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BoolTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CharacterTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CryMovie.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EntityNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="EventTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ExprTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Movie.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SceneNode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SelectTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SequenceIt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="SoundTrack.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Spline.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="smartptr.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="xml"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="xml\xml.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Profile|Xbox">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\xml.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="expat"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="xml\Expat\ascii.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\asciitab.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\config.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\expat.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\iasciitab.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\latin1tab.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\nametab.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\utf8tab.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\winconfig.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmlparse.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmlrole.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmlrole.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmltok.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmltok.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="xml\Expat\xmltok_impl.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
10
CryMovie/CryMovie_XBox.vcproj.vspscc
Normal file
10
CryMovie/CryMovie_XBox.vcproj.vspscc
Normal file
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = "file:F:\\Crytek\\CryMovie\\CryMovie_XBox.vcproj"
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
|
||||
}
|
||||
1007
CryMovie/EntityNode.cpp
Normal file
1007
CryMovie/EntityNode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
133
CryMovie/EntityNode.h
Normal file
133
CryMovie/EntityNode.h
Normal file
@@ -0,0 +1,133 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: entitynode.h
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __entitynode_h__
|
||||
#define __entitynode_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
//#pragma once
|
||||
#endif
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "AnimNode.h"
|
||||
#include "SoundTrack.h"
|
||||
|
||||
#define ENTITY_SOUNDTRACKS 3
|
||||
#define ENTITY_EXPRTRACKS 3
|
||||
|
||||
typedef std::set<string> TStringSet;
|
||||
typedef TStringSet::iterator TStringSetIt;
|
||||
|
||||
class CAnimEntityNode : public CAnimNode, ICharInstanceSink
|
||||
{
|
||||
public:
|
||||
CAnimEntityNode( IMovieSystem *sys );
|
||||
~CAnimEntityNode();
|
||||
|
||||
virtual EAnimNodeType GetType() const { return ANODE_ENTITY; }
|
||||
|
||||
void SetEntity( int Id) { m_EntityId=Id; m_entity=NULL; }
|
||||
void SetEntity( IEntity *entity );
|
||||
IEntity* GetEntity();
|
||||
|
||||
void SetTarget( IAnimNode *node );
|
||||
IAnimNode* GetTarget() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides from CAnimNode
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void Animate( SAnimContext &ec );
|
||||
virtual void CreateDefaultTracks();
|
||||
|
||||
void SetPos( float time,const Vec3 &pos );
|
||||
void SetRotate( float time,const Quat &quat );
|
||||
void SetScale( float time,const Vec3 &scale );
|
||||
|
||||
Vec3 GetPos() { return m_pos; };
|
||||
Quat GetRotate() { return m_rotate; };
|
||||
Vec3 GetScale() { return m_scale; };
|
||||
|
||||
void GetWorldTM( Matrix44 &tm );
|
||||
|
||||
// ovverided from IAnimNode
|
||||
// IAnimBlock* CreateAnimBlock();
|
||||
|
||||
// Ovveride SetAnimBlock
|
||||
void SetAnimBlock( IAnimBlock *block );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Serialize( XmlNodeRef &xmlNode,bool bLoading );
|
||||
void Reset();
|
||||
void Pause();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetParamCount() const;
|
||||
virtual bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
virtual bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
static void AddSupportedParams( std::vector<IAnimNode::SParamInfo> &nodeParams );
|
||||
|
||||
private:
|
||||
void CalcLocalMatrix();
|
||||
void InvalidateTM();
|
||||
|
||||
void ReleaseSounds();
|
||||
void ApplyEventKey( class CEventTrack *track,int keyIndex,IEventKey &key );
|
||||
void ApplySoundKey( IAnimTrack *pTrack,int nCurrKey,int nLayer, ISoundKey &key, SAnimContext &ec);
|
||||
void AnimateCharacterTrack( class CCharacterTrack* track,SAnimContext &ec,int layer );
|
||||
void StopExpressions();
|
||||
void AnimateExpressionTrack(class CExprTrack *pTrack, SAnimContext &ec);
|
||||
|
||||
void ReleaseAllAnims();
|
||||
virtual void OnStartAnimation(const char *sAnimation) {}
|
||||
virtual void OnAnimationEvent(const char *sAnimation, AnimSinkEventData pUserData) {}
|
||||
virtual void OnEndAnimation(const char *sAnimation);
|
||||
|
||||
//! Search entity system for specified entityid, return true if entity found and assigned to m_entity.
|
||||
bool ResolveEntity();
|
||||
|
||||
//! Reference to game entity.
|
||||
IEntity *m_entity;
|
||||
EntityId m_EntityId;
|
||||
|
||||
TStringSet m_setAnimationSinks;
|
||||
|
||||
IMovieSystem *m_pMovie;
|
||||
|
||||
//! Pointer to target animation node.
|
||||
TSmartPtr<IAnimNode> m_target;
|
||||
|
||||
// Cached parameters of node at givven time.
|
||||
float m_time;
|
||||
Vec3 m_pos;
|
||||
Quat m_rotate;
|
||||
Vec3 m_scale;
|
||||
|
||||
bool m_visible;
|
||||
|
||||
//! Last animated key in Entity track.
|
||||
int m_lastEntityKey;
|
||||
int m_lastCharacterKey[3];
|
||||
SSoundInfo m_SoundInfo[ENTITY_SOUNDTRACKS];
|
||||
TStringSet m_setExpressions;
|
||||
|
||||
//! World transformation matrix.
|
||||
Matrix44 m_worldTM;
|
||||
unsigned m_bMatrixValid : 1; //!< True if current world transformation matrix is valid.
|
||||
unsigned m_bMatrixInWorldSpace : 1; //!< True if current matrix is in world space.
|
||||
};
|
||||
|
||||
#endif // __entitynode_h__
|
||||
55
CryMovie/EventTrack.cpp
Normal file
55
CryMovie/EventTrack.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: entitytrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "EventTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEventTrack::SerializeKey( IEventKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *str;
|
||||
str = keyNode->getAttr( "event" );
|
||||
strncpy( key.event,str,sizeof(key.event) );
|
||||
key.event[sizeof(key.event)-1] = 0;
|
||||
|
||||
str = keyNode->getAttr( "anim" );
|
||||
strncpy( key.animation,str,sizeof(key.animation) );
|
||||
key.animation[sizeof(key.animation)-1] = 0;
|
||||
|
||||
key.duration = 0;
|
||||
keyNode->getAttr( "length",key.duration );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(key.event) > 0)
|
||||
keyNode->setAttr( "event",key.event );
|
||||
if (strlen(key.animation) > 0)
|
||||
keyNode->setAttr( "anim",key.animation );
|
||||
if (key.duration > 0)
|
||||
keyNode->setAttr( "length",key.duration );
|
||||
}
|
||||
}
|
||||
|
||||
void CEventTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = 0;
|
||||
if (strlen(m_keys[key].event) > 0)
|
||||
description = m_keys[key].event;
|
||||
}
|
||||
44
CryMovie/EventTrack.h
Normal file
44
CryMovie/EventTrack.h
Normal file
@@ -0,0 +1,44 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: entitytrack.h
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __entitytrack_h__
|
||||
#define __entitytrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
//forward declarations.
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
#include "AnimKey.h"
|
||||
|
||||
/** EntityTrack contains entity keys, when time reach event key, it fires script event or start animation etc...
|
||||
*/
|
||||
class CEventTrack : public TAnimTrack<IEventKey>
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides of IAnimTrack.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EAnimTrackType GetType() { return ATRACK_EVENT; };
|
||||
EAnimValue GetValueType() { return AVALUE_EVENT; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( IEventKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __entitytrack_h__
|
||||
53
CryMovie/ExprTrack.cpp
Normal file
53
CryMovie/ExprTrack.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: selecttrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Lennert Schneider.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ExprTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CExprTrack::SerializeKey( IExprKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *desc;
|
||||
desc=keyNode->getAttr( "name");
|
||||
strncpy(key.pszName, desc, sizeof(key.pszName));
|
||||
key.pszName[sizeof(key.pszName)-1]=0;
|
||||
keyNode->getAttr("amp", key.fAmp);
|
||||
keyNode->getAttr("blendin", key.fBlendIn);
|
||||
keyNode->getAttr("hold", key.fHold);
|
||||
keyNode->getAttr("blendout", key.fBlendOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyNode->setAttr("name", key.pszName);
|
||||
keyNode->setAttr("amp", key.fAmp);
|
||||
keyNode->setAttr("blendin", key.fBlendIn);
|
||||
keyNode->setAttr("hold", key.fHold);
|
||||
keyNode->setAttr("blendout", key.fBlendOut);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CExprTrack::GetKeyInfo( int key,const char* &description, float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
duration=m_keys[key].fBlendIn+m_keys[key].fHold+m_keys[key].fBlendOut;
|
||||
if (strlen(m_keys[key].pszName) > 0)
|
||||
description=m_keys[key].pszName;
|
||||
else
|
||||
description=0;
|
||||
}
|
||||
14
CryMovie/ExprTrack.h
Normal file
14
CryMovie/ExprTrack.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
class CExprTrack : public TAnimTrack<IExprKey>
|
||||
{
|
||||
public:
|
||||
EAnimTrackType GetType() { return ATRACK_EXPRESSION; };
|
||||
EAnimValue GetValueType() { return AVALUE_EXPRESSION; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( IExprKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
5
CryMovie/MSSCCPRJ.SCC
Normal file
5
CryMovie/MSSCCPRJ.SCC
Normal file
@@ -0,0 +1,5 @@
|
||||
SCC = This is a source code control file
|
||||
|
||||
[CryMovie.vcproj]
|
||||
SCC_Aux_Path = "P4SCC#perforce:1666##marcoc_code##PC018"
|
||||
SCC_Project_Name = Perforce Project
|
||||
185
CryMovie/MaterialNode.cpp
Normal file
185
CryMovie/MaterialNode.cpp
Normal file
@@ -0,0 +1,185 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: MaterialNode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 11/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "MaterialNode.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <IRenderer.h>
|
||||
#include <IShader.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
bool s_nodeParamsInitialized = false;
|
||||
std::vector<IAnimNode::SParamInfo> s_nodeParams;
|
||||
|
||||
void AddSupportedParam( const char *sName,int paramId,EAnimValue valueType )
|
||||
{
|
||||
IAnimNode::SParamInfo param;
|
||||
param.name = sName;
|
||||
param.paramId = paramId;
|
||||
param.valueType = valueType;
|
||||
s_nodeParams.push_back( param );
|
||||
}
|
||||
}
|
||||
|
||||
enum EMaterialNodeParam
|
||||
{
|
||||
MTL_PARAM_OPACITY = APARAM_USER + 1,
|
||||
MTL_PARAM_AMBIENT = APARAM_USER + 2,
|
||||
MTL_PARAM_DIFFUSE = APARAM_USER + 3,
|
||||
MTL_PARAM_SPECULAR = APARAM_USER + 4,
|
||||
MTL_PARAM_EMMISION = APARAM_USER + 5,
|
||||
MTL_PARAM_SHININESS = APARAM_USER + 6,
|
||||
|
||||
MTL_PARAM_SHADER_PARAM1 = APARAM_USER + 100,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimMaterialNode::CAnimMaterialNode( IMovieSystem *sys )
|
||||
: CAnimNode(sys)
|
||||
{
|
||||
SetFlags( GetFlags()|ANODE_FLAG_CAN_CHANGE_NAME );
|
||||
m_dwSupportedTracks = PARAM_BIT(APARAM_FLOAT_1);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// One time initialization of material node supported params.
|
||||
if (!s_nodeParamsInitialized)
|
||||
{
|
||||
s_nodeParamsInitialized = true;
|
||||
|
||||
AddSupportedParam( "Opacity",MTL_PARAM_OPACITY,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Ambient",MTL_PARAM_AMBIENT,AVALUE_VECTOR );
|
||||
AddSupportedParam( "Diffuse",MTL_PARAM_DIFFUSE,AVALUE_VECTOR );
|
||||
AddSupportedParam( "Specular",MTL_PARAM_SPECULAR,AVALUE_VECTOR );
|
||||
AddSupportedParam( "Emission",MTL_PARAM_EMMISION,AVALUE_VECTOR );
|
||||
AddSupportedParam( "Shininess",MTL_PARAM_SHININESS,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 1",MTL_PARAM_SHADER_PARAM1,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 2",MTL_PARAM_SHADER_PARAM1+1,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 3",MTL_PARAM_SHADER_PARAM1+2,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 4",MTL_PARAM_SHADER_PARAM1+3,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 5",MTL_PARAM_SHADER_PARAM1+4,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 6",MTL_PARAM_SHADER_PARAM1+5,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 7",MTL_PARAM_SHADER_PARAM1+6,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 8",MTL_PARAM_SHADER_PARAM1+7,AVALUE_FLOAT );
|
||||
AddSupportedParam( "Shader Param 9",MTL_PARAM_SHADER_PARAM1+8,AVALUE_FLOAT );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimMaterialNode::GetParamCount() const
|
||||
{
|
||||
return s_nodeParams.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimMaterialNode::GetParamInfo( int nIndex, SParamInfo &info ) const
|
||||
{
|
||||
if (nIndex >= 0 && nIndex < s_nodeParams.size())
|
||||
{
|
||||
info = s_nodeParams[nIndex];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimMaterialNode::GetParamInfoFromId( int paramId, SParamInfo &info ) const
|
||||
{
|
||||
for (int i = 0; i < s_nodeParams.size(); i++)
|
||||
{
|
||||
if (s_nodeParams[i].paramId == paramId)
|
||||
{
|
||||
info = s_nodeParams[i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimMaterialNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (!anim)
|
||||
return;
|
||||
|
||||
int paramCount = anim->GetTrackCount();
|
||||
if (paramCount <= 0)
|
||||
return;
|
||||
|
||||
// Find material.
|
||||
IMatInfo *pMtl = m_pMovieSystem->GetSystem()->GetI3DEngine()->FindMaterial( GetName() );
|
||||
if (!pMtl)
|
||||
return;
|
||||
|
||||
SRenderShaderResources *pShaderResources = pMtl->GetShaderItem().m_pShaderResources;
|
||||
if (!pShaderResources)
|
||||
return;
|
||||
|
||||
float fValue;
|
||||
Vec3 vValue;
|
||||
for (int paramIndex = 0; paramIndex < paramCount; paramIndex++)
|
||||
{
|
||||
int paramId;
|
||||
IAnimTrack *pTrack;
|
||||
if (!anim->GetTrackInfo( paramIndex,paramId,&pTrack ))
|
||||
continue;
|
||||
switch (paramId)
|
||||
{
|
||||
case MTL_PARAM_OPACITY:
|
||||
pTrack->GetValue( ec.time,fValue );
|
||||
pShaderResources->m_Opacity = fValue;
|
||||
break;
|
||||
case MTL_PARAM_AMBIENT:
|
||||
pTrack->GetValue( ec.time,vValue );
|
||||
if (pShaderResources->m_LMaterial)
|
||||
pShaderResources->m_LMaterial->Front.m_Ambient = CFColor(vValue.x,vValue.y,vValue.z);
|
||||
break;
|
||||
case MTL_PARAM_DIFFUSE:
|
||||
pTrack->GetValue( ec.time,vValue );
|
||||
if (pShaderResources->m_LMaterial)
|
||||
pShaderResources->m_LMaterial->Front.m_Diffuse = CFColor(vValue.x,vValue.y,vValue.z);
|
||||
break;
|
||||
case MTL_PARAM_SPECULAR:
|
||||
pTrack->GetValue( ec.time,vValue );
|
||||
if (pShaderResources->m_LMaterial)
|
||||
pShaderResources->m_LMaterial->Front.m_Specular = CFColor(vValue.x,vValue.y,vValue.z);
|
||||
break;
|
||||
case MTL_PARAM_EMMISION:
|
||||
pTrack->GetValue( ec.time,vValue );
|
||||
if (pShaderResources->m_LMaterial)
|
||||
pShaderResources->m_LMaterial->Front.m_Emission = CFColor(vValue.x,vValue.y,vValue.z);
|
||||
break;
|
||||
case MTL_PARAM_SHININESS:
|
||||
pTrack->GetValue( ec.time,fValue );
|
||||
if (pShaderResources->m_LMaterial)
|
||||
pShaderResources->m_LMaterial->Front.m_SpecShininess = fValue;
|
||||
break;
|
||||
default:
|
||||
if (paramId >= MTL_PARAM_SHADER_PARAM1)
|
||||
{
|
||||
int id = paramId - MTL_PARAM_SHADER_PARAM1;
|
||||
if (id < pShaderResources->m_ShaderParams.size())
|
||||
{
|
||||
pTrack->GetValue( ec.time,fValue );
|
||||
pShaderResources->m_ShaderParams[id].m_Value.m_Float = fValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
45
CryMovie/MaterialNode.h
Normal file
45
CryMovie/MaterialNode.h
Normal file
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: MaterialNode.h
|
||||
// Version: v1.00
|
||||
// Created: 11/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __MaterialNode_h__
|
||||
#define __MaterialNode_h__
|
||||
#pragma once
|
||||
|
||||
#include "AnimNode.h"
|
||||
|
||||
class CAnimMaterialNode : public CAnimNode
|
||||
{
|
||||
public:
|
||||
CAnimMaterialNode( IMovieSystem *sys );
|
||||
|
||||
virtual EAnimNodeType GetType() const { return ANODE_MATERIAL; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides from CAnimNode
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Animate( SAnimContext &ec );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Supported tracks description.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetParamCount() const;
|
||||
virtual bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
virtual bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
private:
|
||||
void SetScriptValue();
|
||||
};
|
||||
|
||||
#endif // __MaterialNode_h__
|
||||
796
CryMovie/Movie.cpp
Normal file
796
CryMovie/Movie.cpp
Normal file
@@ -0,0 +1,796 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: movie.cpp
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "Movie.h"
|
||||
#include "AnimSplineTrack.h"
|
||||
#include "AnimSequence.h"
|
||||
#include "SequenceIt.h"
|
||||
#include "EntityNode.h"
|
||||
#include "CVarNode.h"
|
||||
#include "ScriptVarNode.h"
|
||||
#include "AnimCameraNode.h"
|
||||
#include "SceneNode.h"
|
||||
#include "MaterialNode.h"
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <io.h>
|
||||
#include <ILog.h>
|
||||
#include <IConsole.h>
|
||||
#include <ITimer.h>
|
||||
|
||||
int CMovieSystem::m_mov_NoCutscenes = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMovieSystem::CMovieSystem( ISystem *system )
|
||||
{
|
||||
m_system = system;
|
||||
m_bRecording = false;
|
||||
m_pCallback=NULL;
|
||||
m_pUser=NULL;
|
||||
m_bPaused = false;
|
||||
m_bLastFrameAnimateOnStop = true;
|
||||
m_lastGenId = 1;
|
||||
m_sequenceStopBehavior = ONSTOP_GOTO_END_TIME;
|
||||
|
||||
system->GetIConsole()->Register( "mov_NoCutscenes",&m_mov_NoCutscenes,0,0,"Disable playing of Cut-Scenes" );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMovieSystem::~CMovieSystem()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CMovieSystem::Load(const char *pszFile, const char *pszMission)
|
||||
{
|
||||
XmlNodeRef rootNode = m_system->LoadXmlFile(pszFile);
|
||||
if (!rootNode)
|
||||
return false;
|
||||
XmlNodeRef Node=NULL;
|
||||
for (int i=0;i<rootNode->getChildCount();i++)
|
||||
{
|
||||
XmlNodeRef missionNode=rootNode->getChild(i);
|
||||
XmlString sName;
|
||||
if (!(sName = missionNode->getAttr("Name")))
|
||||
continue;
|
||||
if (stricmp(sName.c_str(), pszMission))
|
||||
continue;
|
||||
Node=missionNode;
|
||||
break;
|
||||
}
|
||||
if (!Node)
|
||||
return false;
|
||||
Serialize(Node, true, true, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CMovieSystem::CreateNode( int nodeType,int nodeId )
|
||||
{
|
||||
CAnimNode *node = NULL;
|
||||
if (!nodeId)
|
||||
{
|
||||
// Make uniq id.
|
||||
do {
|
||||
nodeId = m_lastGenId++;
|
||||
} while (GetNode(nodeId) != 0);
|
||||
}
|
||||
switch (nodeType)
|
||||
{
|
||||
case ANODE_ENTITY:
|
||||
node = new CAnimEntityNode(this);
|
||||
break;
|
||||
case ANODE_CAMERA:
|
||||
node = new CAnimCameraNode(this);
|
||||
break;
|
||||
case ANODE_CVAR:
|
||||
node = new CAnimCVarNode(this);
|
||||
break;
|
||||
case ANODE_SCRIPTVAR:
|
||||
node = new CAnimScriptVarNode(this);
|
||||
break;
|
||||
case ANODE_SCENE:
|
||||
node = new CAnimSceneNode(this);
|
||||
nodeId = 0;
|
||||
return node;
|
||||
break;
|
||||
case ANODE_MATERIAL:
|
||||
node = new CAnimMaterialNode(this);
|
||||
break;
|
||||
}
|
||||
if (node)
|
||||
{
|
||||
node->SetId(nodeId);
|
||||
m_nodes[nodeId] = node;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimTrack* CMovieSystem::CreateTrack( EAnimTrackType type )
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ATRACK_TCB_FLOAT:
|
||||
return new CTcbFloatTrack;
|
||||
case ATRACK_TCB_VECTOR:
|
||||
return new CTcbVectorTrack;
|
||||
case ATRACK_TCB_QUAT:
|
||||
return new CTcbQuatTrack;
|
||||
};
|
||||
//ATRACK_TCB_FLOAT,
|
||||
//ATRACK_TCB_VECTOR,
|
||||
//ATRACK_TCB_QUAT,
|
||||
//ATRACK_BOOL,
|
||||
// Unknown type of track.
|
||||
// CLogFile::WriteLine( "Error: Requesting unknown type of animation track!" );
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMovieSystem::ChangeAnimNodeId( int nodeId,int newNodeId )
|
||||
{
|
||||
if (nodeId == newNodeId)
|
||||
return;
|
||||
Nodes::iterator it = m_nodes.find(nodeId);
|
||||
if (it != m_nodes.end())
|
||||
{
|
||||
IAnimNode *node = GetNode( nodeId );
|
||||
((CAnimNode*)node)->SetId( newNodeId );
|
||||
m_nodes[newNodeId] = node;
|
||||
m_nodes.erase(it);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimSequence* CMovieSystem::CreateSequence( const char *sequenceName )
|
||||
{
|
||||
IAnimSequence *seq = new CAnimSequence( this );
|
||||
seq->SetName( sequenceName );
|
||||
m_sequences.push_back( seq );
|
||||
return seq;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimSequence* CMovieSystem::LoadSequence( const char *pszFilePath )
|
||||
{
|
||||
XmlNodeRef sequenceNode = m_system->LoadXmlFile( pszFilePath );
|
||||
if (sequenceNode)
|
||||
{
|
||||
return LoadSequence( sequenceNode );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimSequence* CMovieSystem::LoadSequence( XmlNodeRef &xmlNode, bool bLoadEmpty )
|
||||
{
|
||||
IAnimSequence *seq = new CAnimSequence( this );
|
||||
seq->Serialize( xmlNode,true,bLoadEmpty );
|
||||
// Delete previous sequence with the same name.
|
||||
IAnimSequence *pPrevSeq = FindSequence( seq->GetName() );
|
||||
if (pPrevSeq)
|
||||
RemoveSequence( pPrevSeq );
|
||||
m_sequences.push_back( seq );
|
||||
return seq;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimSequence* CMovieSystem::FindSequence( const char *sequence )
|
||||
{
|
||||
for (Sequences::iterator it = m_sequences.begin(); it != m_sequences.end(); ++it)
|
||||
{
|
||||
IAnimSequence *seq = *it;
|
||||
if (stricmp(seq->GetName(),sequence) == 0)
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ISequenceIt* CMovieSystem::GetSequences()
|
||||
{
|
||||
CSequenceIt *It=new CSequenceIt();
|
||||
for (Sequences::iterator it = m_sequences.begin(); it != m_sequences.end(); ++it)
|
||||
{
|
||||
It->add( *it );
|
||||
}
|
||||
return It;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::RemoveSequence( IAnimSequence *seq )
|
||||
{
|
||||
assert( seq != 0 );
|
||||
if (seq)
|
||||
{
|
||||
IMovieCallback *pCallback=GetCallback();
|
||||
SetCallback(NULL);
|
||||
StopSequence(seq);
|
||||
|
||||
for (Sequences::iterator it = m_sequences.begin(); it != m_sequences.end(); ++it)
|
||||
{
|
||||
if (seq == *it)
|
||||
{
|
||||
m_sequences.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetCallback(pCallback);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CMovieSystem::GetNode( int nodeId ) const
|
||||
{
|
||||
Nodes::const_iterator it = m_nodes.find(nodeId);
|
||||
if (it != m_nodes.end())
|
||||
return it->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimNode* CMovieSystem::FindNode( const char *nodeName ) const
|
||||
{
|
||||
for (Nodes::const_iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimNode *node = it->second;
|
||||
// Case insesentivy name comparasion.
|
||||
if (stricmp(node->GetName(),nodeName) == 0)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::RemoveNode( IAnimNode* node )
|
||||
{
|
||||
assert( node != 0 );
|
||||
|
||||
{
|
||||
// Remove this node from all sequences that reference this node.
|
||||
for (Sequences::iterator sit = m_sequences.begin(); sit != m_sequences.end(); ++sit)
|
||||
{
|
||||
(*sit)->RemoveNode( node );
|
||||
}
|
||||
}
|
||||
|
||||
Nodes::iterator it = m_nodes.find(node->GetId());
|
||||
if (it != m_nodes.end())
|
||||
m_nodes.erase( it );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::RemoveAllSequences()
|
||||
{
|
||||
m_bLastFrameAnimateOnStop = false;
|
||||
IMovieCallback *pCallback=GetCallback();
|
||||
SetCallback(NULL);
|
||||
StopAllSequences();
|
||||
m_sequences.clear();
|
||||
SetCallback(pCallback);
|
||||
m_bLastFrameAnimateOnStop = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::RemoveAllNodes()
|
||||
{
|
||||
m_bLastFrameAnimateOnStop = false;
|
||||
IMovieCallback *pCallback=GetCallback();
|
||||
SetCallback(NULL);
|
||||
StopAllSequences();
|
||||
m_nodes.clear();
|
||||
SetCallback(pCallback);
|
||||
m_bLastFrameAnimateOnStop = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::SaveNodes(XmlNodeRef nodesNode)
|
||||
{
|
||||
for (Nodes::iterator It=m_nodes.begin();It!=m_nodes.end();++It)
|
||||
{
|
||||
XmlNodeRef nodeNode=nodesNode->newChild("Node");
|
||||
IAnimNode *pNode=It->second;
|
||||
nodeNode->setAttr("Id", pNode->GetId());
|
||||
nodeNode->setAttr("Type", pNode->GetType());
|
||||
nodeNode->setAttr("Name", pNode->GetName());
|
||||
switch (pNode->GetType())
|
||||
{
|
||||
case ANODE_CAMERA: // FALL THROUGH
|
||||
case ANODE_ENTITY:
|
||||
IAnimNode *pTgt=pNode->GetTarget();
|
||||
if (pTgt)
|
||||
nodeNode->setAttr("TargetId", pTgt->GetId());
|
||||
break;
|
||||
}
|
||||
pNode->Serialize( nodeNode,false );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::PlaySequence( const char *sequenceName,bool bResetFx )
|
||||
{
|
||||
IAnimSequence *seq = FindSequence(sequenceName);
|
||||
if (seq)
|
||||
{
|
||||
PlaySequence(seq,bResetFx);
|
||||
}
|
||||
else
|
||||
GetSystem ()->GetILog()->Log ("CMovieSystem::PlaySequence: Error: Sequence \"%s\" not found", sequenceName);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::PlaySequence( IAnimSequence *seq,bool bResetFx )
|
||||
{
|
||||
assert( seq != 0 );
|
||||
if (!seq || IsPlaying(seq))
|
||||
return;
|
||||
|
||||
if ((seq->GetFlags() & IAnimSequence::CUT_SCENE) || (seq->GetFlags() & IAnimSequence::NO_HUD))
|
||||
{
|
||||
// Dont play cut-scene if this console variable set.
|
||||
if (m_mov_NoCutscenes != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
//GetSystem ()->GetILog()->Log ("TEST: Playing Sequence (%s)", seq->GetName());
|
||||
|
||||
// If this sequence is cut scene disable player.
|
||||
if (seq->GetFlags() & IAnimSequence::CUT_SCENE)
|
||||
{
|
||||
if (m_pUser)
|
||||
m_pUser->BeginCutScene(seq->GetFlags(),bResetFx);
|
||||
}
|
||||
|
||||
seq->Activate();
|
||||
PlayingSequence ps;
|
||||
ps.sequence = seq;
|
||||
ps.time = seq->GetTimeRange().start;
|
||||
m_playingSequences.push_back(ps);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::StopSequence( const char *sequenceName )
|
||||
{
|
||||
IAnimSequence *seq = FindSequence(sequenceName);
|
||||
if (seq)
|
||||
StopSequence(seq);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::StopSequence( IAnimSequence *seq )
|
||||
{
|
||||
assert( seq != 0 );
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
|
||||
{
|
||||
if (it->sequence == seq)
|
||||
{
|
||||
m_playingSequences.erase( it );
|
||||
|
||||
if (m_bLastFrameAnimateOnStop)
|
||||
{
|
||||
if (m_sequenceStopBehavior == ONSTOP_GOTO_END_TIME)
|
||||
{
|
||||
SAnimContext ac;
|
||||
ac.bSingleFrame = true;
|
||||
ac.time = seq->GetTimeRange().end;
|
||||
seq->Animate(ac);
|
||||
}
|
||||
else if (m_sequenceStopBehavior == ONSTOP_GOTO_START_TIME)
|
||||
{
|
||||
SAnimContext ac;
|
||||
ac.bSingleFrame = true;
|
||||
ac.time = seq->GetTimeRange().start;
|
||||
seq->Animate(ac);
|
||||
}
|
||||
seq->Deactivate();
|
||||
}
|
||||
|
||||
// If this sequence is cut scene end it.
|
||||
if (seq->GetFlags() & IAnimSequence::CUT_SCENE)
|
||||
{
|
||||
if (m_pUser)
|
||||
m_pUser->EndCutScene();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::StopAllSequences()
|
||||
{
|
||||
while (!m_playingSequences.empty())
|
||||
{
|
||||
StopSequence( m_playingSequences.begin()->sequence );
|
||||
}
|
||||
m_playingSequences.clear();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::StopAllCutScenes()
|
||||
{
|
||||
PlayingSequences::iterator next;
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); it = next)
|
||||
{
|
||||
next = it; ++next;
|
||||
IAnimSequence *seq = it->sequence;
|
||||
if (seq->GetFlags() & IAnimSequence::CUT_SCENE)
|
||||
StopSequence( seq );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CMovieSystem::IsPlaying( IAnimSequence *seq ) const
|
||||
{
|
||||
for (PlayingSequences::const_iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it)
|
||||
{
|
||||
if (it->sequence == seq)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Reset( bool bPlayOnReset )
|
||||
{
|
||||
m_bLastFrameAnimateOnStop = false;
|
||||
StopAllSequences();
|
||||
m_bLastFrameAnimateOnStop = true;
|
||||
|
||||
// Reset all sequences.
|
||||
for (Sequences::iterator sit = m_sequences.begin(); sit != m_sequences.end(); ++sit)
|
||||
{
|
||||
IAnimSequence *seq = *sit;
|
||||
seq->Reset();
|
||||
}
|
||||
|
||||
// Reset all nodes.
|
||||
for (Nodes::const_iterator it = m_nodes.begin(); it != m_nodes.end(); ++it)
|
||||
{
|
||||
IAnimNode *node = it->second;
|
||||
node->Reset();
|
||||
}
|
||||
|
||||
// Force end Cut-Scene on the reset.
|
||||
/* if (m_pUser) // lennert why is this here ??? if there was a cutscene playing it will be stopped above...
|
||||
{
|
||||
m_pUser->EndCutScene();
|
||||
}*/
|
||||
|
||||
if (bPlayOnReset)
|
||||
{
|
||||
for (Sequences::iterator sit = m_sequences.begin(); sit != m_sequences.end(); ++sit)
|
||||
{
|
||||
IAnimSequence *seq = *sit;
|
||||
if (seq->GetFlags() & IAnimSequence::PLAY_ONRESET)
|
||||
PlaySequence(seq);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset camera.
|
||||
SCameraParams CamParams=GetCameraParams();
|
||||
CamParams.cameraNode=NULL;
|
||||
CamParams.nCameraId=0;
|
||||
SetCameraParams(CamParams);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::PlayOnLoadSequences()
|
||||
{
|
||||
for (Sequences::iterator sit = m_sequences.begin(); sit != m_sequences.end(); ++sit)
|
||||
{
|
||||
IAnimSequence *seq = *sit;
|
||||
if (seq->GetFlags() & IAnimSequence::PLAY_ONRESET)
|
||||
PlaySequence(seq);
|
||||
}
|
||||
|
||||
// Reset camera.
|
||||
SCameraParams CamParams=GetCameraParams();
|
||||
CamParams.cameraNode=NULL;
|
||||
CamParams.nCameraId=0;
|
||||
SetCameraParams(CamParams);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Update( float dt )
|
||||
{
|
||||
if (m_bPaused)
|
||||
return;
|
||||
|
||||
SAnimContext ac;
|
||||
float fps = 60;
|
||||
Range timeRange;
|
||||
|
||||
std::vector<IAnimSequence*> stopSequences;
|
||||
|
||||
// cap delta time.
|
||||
dt = max( 0,min(0.5f,dt) );
|
||||
|
||||
PlayingSequences::iterator next;
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); it = next)
|
||||
{
|
||||
next = it; ++next;
|
||||
|
||||
PlayingSequence &ps = *it;
|
||||
|
||||
ac.time = ps.time;
|
||||
ac.sequence = ps.sequence;
|
||||
ac.dt = dt;
|
||||
ac.fps = fps;
|
||||
|
||||
// Increase play time.
|
||||
ps.time += dt;
|
||||
|
||||
// Check time out of range.
|
||||
timeRange = ps.sequence->GetTimeRange();
|
||||
if (ps.time > timeRange.end)
|
||||
{
|
||||
int seqFlags = ps.sequence->GetFlags();
|
||||
if (seqFlags & IAnimSequence::ORT_LOOP)
|
||||
{
|
||||
// Time wrap's back to the start of the time range.
|
||||
ps.time = timeRange.start;
|
||||
}
|
||||
else if (seqFlags & IAnimSequence::ORT_CONSTANT)
|
||||
{
|
||||
// Time just continues normally past the end of time range.
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no out-of-range type specified sequence stopped when time reaches end of range.
|
||||
// Que sequence for stopping.
|
||||
stopSequences.push_back(ps.sequence);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Animate sequence. (Can invalidate iterator)
|
||||
ps.sequence->Animate( ac );
|
||||
}
|
||||
|
||||
// Stop quied sequencs.
|
||||
for (int i = 0; i < (int)stopSequences.size(); i++)
|
||||
{
|
||||
StopSequence( stopSequences[i] );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Callback(ECallbackReason Reason)
|
||||
{
|
||||
if (!m_pCallback)
|
||||
return;
|
||||
switch (Reason)
|
||||
{
|
||||
case CBR_ADDNODE:
|
||||
m_pCallback->OnAddNode();
|
||||
break;
|
||||
case CBR_REMOVENODE:
|
||||
m_pCallback->OnRemoveNode();
|
||||
break;
|
||||
case CBR_CHANGENODE:
|
||||
m_pCallback->OnChangeNode();
|
||||
break;
|
||||
case CBR_REGISTERNODECB:
|
||||
m_pCallback->OnRegisterNodeCallback();
|
||||
break;
|
||||
case CBR_UNREGISTERNODECB:
|
||||
m_pCallback->OnUnregisterNodeCallback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Serialize( XmlNodeRef &xmlNode,bool bLoading,bool bRemoveOldNodes,bool bLoadEmpty )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
RemoveAllSequences();
|
||||
if (bRemoveOldNodes)
|
||||
{
|
||||
RemoveAllNodes();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load animation nodes from XML.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef nodeNode=xmlNode->findChild("NodeData");
|
||||
if (nodeNode)
|
||||
{
|
||||
std::map<int,int> mapNodeTarget;
|
||||
for (int i=0;i<nodeNode->getChildCount();i++)
|
||||
{
|
||||
XmlNodeRef node=nodeNode->getChild(i);
|
||||
IAnimNode *pAnimNode = NULL;
|
||||
string sTarget;
|
||||
|
||||
int nodeId = atoi(node->getAttr("Id"));
|
||||
// If node with such ID already exists. skip it.
|
||||
if (!GetNode(nodeId))
|
||||
{
|
||||
int nodeType = atoi(node->getAttr("Type"));
|
||||
pAnimNode = CreateNode( nodeType,nodeId );
|
||||
if (pAnimNode)
|
||||
{
|
||||
pAnimNode->SetName(node->getAttr("Name"));
|
||||
int entityId = -1;
|
||||
if (node->getAttr("EntityId",entityId))
|
||||
{
|
||||
pAnimNode->SetEntity(entityId);
|
||||
}
|
||||
pAnimNode->Serialize( node,true );
|
||||
|
||||
int targetId = -1;
|
||||
if (node->getAttr("TargetId",targetId))
|
||||
{
|
||||
if (!sTarget.empty())
|
||||
mapNodeTarget.insert(std::map<int,int>::value_type( pAnimNode->GetId(), targetId ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// After all nodes loaded,Bind targets.
|
||||
for (std::map<int,int>::iterator It=mapNodeTarget.begin();It!=mapNodeTarget.end();++It)
|
||||
{
|
||||
IAnimNode *pAnimNode=GetNode(It->first);
|
||||
assert(pAnimNode);
|
||||
pAnimNode->SetTarget(GetNode(It->second));
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load sequences from XML.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef seqNode=xmlNode->findChild("SequenceData");
|
||||
if (seqNode)
|
||||
{
|
||||
for (int i=0;i<seqNode->getChildCount();i++)
|
||||
{
|
||||
if (!LoadSequence(seqNode->getChild(i), bLoadEmpty))
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Reset();
|
||||
}else
|
||||
{
|
||||
// Save animation nodes to xml.
|
||||
XmlNodeRef nodesNode = xmlNode->newChild("NodeData");
|
||||
for (Nodes::iterator nodeIt = m_nodes.begin(); nodeIt != m_nodes.end(); ++nodeIt)
|
||||
{
|
||||
XmlNodeRef nodeNode = nodesNode->newChild("Node");
|
||||
IAnimNode *pNode = nodeIt->second;
|
||||
pNode->Serialize( nodeNode,false );
|
||||
}
|
||||
|
||||
XmlNodeRef sequencesNode=xmlNode->newChild("SequenceData");
|
||||
ISequenceIt *It=GetSequences();
|
||||
IAnimSequence *seq=It->first();;
|
||||
while (seq)
|
||||
{
|
||||
XmlNodeRef sequenceNode=sequencesNode->newChild("Sequence");
|
||||
seq->Serialize(sequenceNode, false);
|
||||
seq=It->next();
|
||||
}
|
||||
It->Release();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::SetCameraParams( const SCameraParams &Params )
|
||||
{
|
||||
m_ActiveCameraParams = Params;
|
||||
if (m_pUser)
|
||||
m_pUser->SetActiveCamera(m_ActiveCameraParams);
|
||||
if (m_pCallback)
|
||||
m_pCallback->OnSetCamera( m_ActiveCameraParams );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::SendGlobalEvent( const char *pszEvent )
|
||||
{
|
||||
if (m_pUser)
|
||||
m_pUser->SendGlobalEvent(pszEvent);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Pause()
|
||||
{
|
||||
if (m_bPaused)
|
||||
return;
|
||||
m_bPaused = true;
|
||||
|
||||
/*
|
||||
PlayingSequences::iterator next;
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); it = next)
|
||||
{
|
||||
next = it; ++next;
|
||||
PlayingSequence &ps = *it;
|
||||
ps.sequence->Pause();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::Resume()
|
||||
{
|
||||
if (!m_bPaused)
|
||||
return;
|
||||
|
||||
m_bPaused = false;
|
||||
|
||||
/*
|
||||
PlayingSequences::iterator next;
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); it = next)
|
||||
{
|
||||
next = it; ++next;
|
||||
PlayingSequence &ps = *it;
|
||||
ps.sequence->Resume();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMovieSystem::OnPlaySound( ISound *pSound )
|
||||
{
|
||||
if (m_pUser)
|
||||
m_pUser->PlaySubtitles( pSound );
|
||||
}
|
||||
|
||||
float CMovieSystem::GetPlayingTime(IAnimSequence * pSeq)
|
||||
{
|
||||
if (!pSeq)
|
||||
return -1;
|
||||
|
||||
if (!IsPlaying(pSeq))
|
||||
return -1;
|
||||
|
||||
PlayingSequences::const_iterator itend = m_playingSequences.end();
|
||||
for (PlayingSequences::const_iterator it = m_playingSequences.begin(); it != itend; ++it)
|
||||
{
|
||||
if (it->sequence == pSeq)
|
||||
return it->time;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CMovieSystem::SetPlayingTime(IAnimSequence * pSeq, float fTime)
|
||||
{
|
||||
if (!pSeq)
|
||||
return false;
|
||||
|
||||
if (!IsPlaying(pSeq))
|
||||
return false;
|
||||
|
||||
PlayingSequences::iterator itend = m_playingSequences.end();
|
||||
for (PlayingSequences::iterator it = m_playingSequences.begin(); it != itend; ++it)
|
||||
{
|
||||
if (it->sequence == pSeq)
|
||||
it->time = fTime;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMovieSystem::SetSequenceStopBehavior( ESequenceStopBehavior behavior )
|
||||
{
|
||||
m_sequenceStopBehavior = behavior;
|
||||
}
|
||||
153
CryMovie/Movie.h
Normal file
153
CryMovie/Movie.h
Normal file
@@ -0,0 +1,153 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: movie.h
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __movie_h__
|
||||
#define __movie_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
|
||||
/** This is descirption of currently playing sequence.
|
||||
*/
|
||||
struct PlayingSequence
|
||||
{
|
||||
//! Sequence playnig.
|
||||
TSmartPtr<IAnimSequence> sequence;
|
||||
//! Current playing time for this sequence.
|
||||
float time;
|
||||
};
|
||||
|
||||
struct string_less : public std::binary_function<string,string,bool>
|
||||
{
|
||||
bool operator()( const string &s1,const string &s2 ) const
|
||||
{
|
||||
return stricmp(s1.c_str(),s2.c_str()) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CMovieSystem : public IMovieSystem
|
||||
{
|
||||
public:
|
||||
CMovieSystem( ISystem *system );
|
||||
~CMovieSystem();
|
||||
|
||||
void Release() { delete this; };
|
||||
|
||||
void SetUser(IMovieUser *pUser) { m_pUser=pUser; }
|
||||
IMovieUser* GetUser() { return m_pUser; }
|
||||
|
||||
bool Load(const char *pszFile, const char *pszMission);
|
||||
|
||||
ISystem* GetSystem() { return m_system; }
|
||||
|
||||
IAnimNode* CreateNode( int nodeType,int nodeId=0 );
|
||||
IAnimTrack* CreateTrack( EAnimTrackType type );
|
||||
|
||||
void ChangeAnimNodeId( int nodeId,int newNodeId );
|
||||
|
||||
IAnimSequence* CreateSequence( const char *sequence );
|
||||
IAnimSequence* LoadSequence( const char *pszFilePath );
|
||||
IAnimSequence* LoadSequence( XmlNodeRef &xmlNode, bool bLoadEmpty=true );
|
||||
|
||||
void RemoveSequence( IAnimSequence *seq );
|
||||
IAnimSequence* FindSequence( const char *sequence );
|
||||
ISequenceIt* GetSequences();
|
||||
|
||||
void RemoveAllSequences();
|
||||
void RemoveAllNodes();
|
||||
|
||||
void SaveNodes(XmlNodeRef nodesNode);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sequence playback.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void PlaySequence( const char *sequence,bool bResetFX=true );
|
||||
void PlaySequence( IAnimSequence *seq,bool bResetFX=true );
|
||||
void PlayOnLoadSequences();
|
||||
|
||||
void StopSequence( const char *sequence );
|
||||
void StopSequence( IAnimSequence *seq );
|
||||
void StopAllSequences();
|
||||
void StopAllCutScenes();
|
||||
void Pause( bool bPause );
|
||||
|
||||
void Reset( bool bPlayOnReset=true );
|
||||
void Update( float dt );
|
||||
|
||||
bool IsPlaying( IAnimSequence *seq ) const;
|
||||
|
||||
virtual void Pause();
|
||||
virtual void Resume();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Nodes.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void RemoveNode( IAnimNode* node );
|
||||
IAnimNode* GetNode( int nodeId ) const;
|
||||
IAnimNode* FindNode( const char *nodeName ) const;
|
||||
|
||||
void SetRecording( bool recording ) { m_bRecording = recording; };
|
||||
bool IsRecording() const { return m_bRecording; };
|
||||
|
||||
void SetCallback( IMovieCallback *pCallback ) { m_pCallback=pCallback; }
|
||||
IMovieCallback* GetCallback() { return m_pCallback; }
|
||||
void Callback(ECallbackReason Reason);
|
||||
|
||||
void Serialize( XmlNodeRef &xmlNode,bool bLoading, bool bRemoveOldNodes=false, bool bLoadEmpty=true );
|
||||
|
||||
const SCameraParams& GetCameraParams() const { return m_ActiveCameraParams; }
|
||||
void SetCameraParams( const SCameraParams &Params );
|
||||
|
||||
void SendGlobalEvent( const char *pszEvent );
|
||||
void OnPlaySound( ISound *pSound );
|
||||
void SetSequenceStopBehavior( ESequenceStopBehavior behavior );
|
||||
|
||||
private:
|
||||
ISystem* m_system;
|
||||
|
||||
IMovieUser *m_pUser;
|
||||
IMovieCallback *m_pCallback;
|
||||
|
||||
int m_lastGenId;
|
||||
|
||||
typedef std::vector<TSmartPtr<IAnimSequence> > Sequences;
|
||||
Sequences m_sequences;
|
||||
|
||||
typedef std::map<int,TSmartPtr<IAnimNode> > Nodes;
|
||||
Nodes m_nodes;
|
||||
|
||||
typedef std::list<PlayingSequence> PlayingSequences;
|
||||
PlayingSequences m_playingSequences;
|
||||
|
||||
bool m_bRecording;
|
||||
bool m_bPaused;
|
||||
|
||||
bool m_bLastFrameAnimateOnStop;
|
||||
|
||||
SCameraParams m_ActiveCameraParams;
|
||||
|
||||
ESequenceStopBehavior m_sequenceStopBehavior;
|
||||
|
||||
static int m_mov_NoCutscenes;
|
||||
public:
|
||||
float GetPlayingTime(IAnimSequence * pSeq);
|
||||
bool SetPlayingTime(IAnimSequence * pSeq, float fTime);
|
||||
};
|
||||
|
||||
#endif // __movie_h__
|
||||
69
CryMovie/MusicTrack.cpp
Normal file
69
CryMovie/MusicTrack.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: consoletrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 12/6/2003 by Timur.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "MusicTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMusicTrack::SerializeKey( IMusicKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *pStr;
|
||||
int nType;
|
||||
if (!keyNode->getAttr("type", nType))
|
||||
key.eType=eMusicKeyType_SetMood;
|
||||
else
|
||||
key.eType=(EMusicKeyType)nType;
|
||||
pStr=keyNode->getAttr("mood");
|
||||
if (pStr)
|
||||
{
|
||||
strncpy(key.szMood, pStr, sizeof(key.szMood));
|
||||
key.szMood[sizeof(key.szMood)-1]=0;
|
||||
}else
|
||||
{
|
||||
key.szMood[0]=0;
|
||||
}
|
||||
if (!keyNode->getAttr("volramp_time", key.fTime))
|
||||
key.fTime=0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyNode->setAttr("type", key.eType);
|
||||
if (strlen(key.szMood)>0)
|
||||
keyNode->setAttr("mood", key.szMood);
|
||||
keyNode->setAttr("volramp_time", key.fTime);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMusicTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = 0;
|
||||
switch (m_keys[key].eType)
|
||||
{
|
||||
case eMusicKeyType_SetMood:
|
||||
duration=0.0f;
|
||||
description=m_keys[key].szMood;
|
||||
break;
|
||||
case eMusicKeyType_VolumeRamp:
|
||||
duration=m_keys[key].fTime;
|
||||
description="RampDown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
39
CryMovie/MusicTrack.h
Normal file
39
CryMovie/MusicTrack.h
Normal file
@@ -0,0 +1,39 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2003.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: consoletrack.h
|
||||
// Version: v1.00
|
||||
// Created: 30/6/2003 by Lennert Schneider.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __musictrack_h__
|
||||
#define __musictrack_h__
|
||||
#pragma once
|
||||
|
||||
//forward declarations.
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
#include "AnimKey.h"
|
||||
|
||||
/** MusicTrack contains music keys, when time reach event key, it applies changes to the music-system...
|
||||
*/
|
||||
class CMusicTrack : public TAnimTrack<IMusicKey>
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides of IAnimTrack.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
EAnimTrackType GetType() { return ATRACK_MUSIC; };
|
||||
EAnimValue GetValueType() { return AVALUE_MUSIC; };
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( IMusicKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __musictrack_h__
|
||||
450
CryMovie/SceneNode.cpp
Normal file
450
CryMovie/SceneNode.cpp
Normal file
@@ -0,0 +1,450 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: scenenode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Lennert.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "SceneNode.h"
|
||||
#include "AnimTrack.h"
|
||||
#include "SelectTrack.h"
|
||||
#include "EventTrack.h"
|
||||
#include "ConsoleTrack.h"
|
||||
#include "MusicTrack.h"
|
||||
#include "isystem.h"
|
||||
#include "igame.h"
|
||||
#include "AnimCameraNode.h"
|
||||
#include "Movie.h"
|
||||
|
||||
#include <ISound.h>
|
||||
#include <IConsole.h>
|
||||
|
||||
namespace {
|
||||
bool s_nodeParamsInitialized = false;
|
||||
std::vector<IAnimNode::SParamInfo> s_nodeParams;
|
||||
|
||||
void AddSupportedParam( const char *sName,int paramId,EAnimValue valueType )
|
||||
{
|
||||
IAnimNode::SParamInfo param;
|
||||
param.name = sName;
|
||||
param.paramId = paramId;
|
||||
param.valueType = valueType;
|
||||
s_nodeParams.push_back( param );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimSceneNode::CAnimSceneNode( IMovieSystem *sys )
|
||||
: CAnimNode(sys)
|
||||
{
|
||||
m_dwSupportedTracks = PARAM_BIT(APARAM_CAMERA) | PARAM_BIT(APARAM_EVENT) |
|
||||
PARAM_BIT(APARAM_SOUND1)|PARAM_BIT(APARAM_SOUND2)|PARAM_BIT(APARAM_SOUND3) |
|
||||
PARAM_BIT(APARAM_SEQUENCE) | PARAM_BIT(APARAM_CONSOLE) | PARAM_BIT(APARAM_MUSIC);
|
||||
m_pMovie=sys;
|
||||
for (int i=0;i<SCENE_SOUNDTRACKS;i++)
|
||||
{
|
||||
m_SoundInfo[i].nLastKey=-1;
|
||||
m_SoundInfo[i].pSound=NULL;
|
||||
m_SoundInfo[i].sLastFilename="";
|
||||
}
|
||||
m_bMusicMoodSet=false;
|
||||
m_sequenceCameraId = -1;
|
||||
m_lastCameraKey = -1;
|
||||
m_lastEventKey = -1;
|
||||
m_lastConsoleKey = -1;
|
||||
m_lastMusicKey = -1;
|
||||
m_lastSequenceKey = -1;
|
||||
|
||||
if (!s_nodeParamsInitialized)
|
||||
{
|
||||
s_nodeParamsInitialized = true;
|
||||
AddSupportedParam( "Camera",APARAM_CAMERA,AVALUE_SELECT );
|
||||
AddSupportedParam( "Event",APARAM_EVENT,AVALUE_EVENT );
|
||||
AddSupportedParam( "Sound1",APARAM_SOUND1,AVALUE_SOUND );
|
||||
AddSupportedParam( "Sound2",APARAM_SOUND2,AVALUE_SOUND );
|
||||
AddSupportedParam( "Sound3",APARAM_SOUND3,AVALUE_SOUND );
|
||||
AddSupportedParam( "Sequence",APARAM_SEQUENCE,AVALUE_SELECT );
|
||||
AddSupportedParam( "Console",APARAM_CONSOLE,AVALUE_CONSOLE );
|
||||
AddSupportedParam( "Music",APARAM_MUSIC,AVALUE_MUSIC );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimSceneNode::~CAnimSceneNode()
|
||||
{
|
||||
ReleaseSounds();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::CreateDefaultTracks()
|
||||
{
|
||||
CreateTrack(APARAM_CAMERA);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimSceneNode::GetParamCount() const
|
||||
{
|
||||
return s_nodeParams.size();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimSceneNode::GetParamInfo( int nIndex, SParamInfo &info ) const
|
||||
{
|
||||
if (nIndex >= 0 && nIndex < s_nodeParams.size())
|
||||
{
|
||||
info = s_nodeParams[nIndex];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimSceneNode::GetParamInfoFromId( int paramId, SParamInfo &info ) const
|
||||
{
|
||||
for (int i = 0; i < s_nodeParams.size(); i++)
|
||||
{
|
||||
if (s_nodeParams[i].paramId == paramId)
|
||||
{
|
||||
info = s_nodeParams[i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IAnimBlock* CAnimSceneNode::CreateAnimBlock()
|
||||
{
|
||||
// Assign tracks to this anim node.
|
||||
IAnimBlock *block = new CAnimBlock;
|
||||
CreateTrack(block, APARAM_CAMERA);
|
||||
return block;
|
||||
};*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
CAnimBlock *anim = (CAnimBlock*)GetAnimBlock();
|
||||
if (!anim)
|
||||
return;
|
||||
|
||||
if (ec.bResetting)
|
||||
return;
|
||||
|
||||
CSelectTrack *cameraTrack = NULL;
|
||||
CEventTrack *pEventTrack = NULL;
|
||||
CSoundTrack *pSoundTrack[3] = { NULL,NULL,NULL };
|
||||
CSelectTrack *pSequenceTrack = NULL;
|
||||
CConsoleTrack *pConsoleTrack = NULL;
|
||||
CMusicTrack *pMusicTrack = NULL;
|
||||
/*
|
||||
bool bTimeJump = false;
|
||||
if (ec.time < m_time)
|
||||
bTimeJump = true;
|
||||
*/
|
||||
|
||||
int paramCount = anim->GetTrackCount();
|
||||
for (int paramIndex = 0; paramIndex < paramCount; paramIndex++)
|
||||
{
|
||||
int trackType;
|
||||
IAnimTrack *pTrack;
|
||||
if (!anim->GetTrackInfo( paramIndex,trackType,&pTrack ))
|
||||
continue;
|
||||
switch (trackType)
|
||||
{
|
||||
case APARAM_CAMERA: cameraTrack = (CSelectTrack*)pTrack; break;
|
||||
case APARAM_EVENT: pEventTrack = (CEventTrack*)pTrack; break;
|
||||
case APARAM_SOUND1: pSoundTrack[0] = (CSoundTrack*)pTrack; break;
|
||||
case APARAM_SOUND2: pSoundTrack[1] = (CSoundTrack*)pTrack; break;
|
||||
case APARAM_SOUND3: pSoundTrack[2] = (CSoundTrack*)pTrack; break;
|
||||
case APARAM_SEQUENCE: pSequenceTrack = (CSelectTrack*)pTrack; break;
|
||||
case APARAM_CONSOLE: pConsoleTrack = (CConsoleTrack*)pTrack; break;
|
||||
case APARAM_MUSIC: pMusicTrack = (CMusicTrack*)pTrack; break;
|
||||
}
|
||||
}
|
||||
|
||||
// Process entity track.
|
||||
if (cameraTrack)
|
||||
{
|
||||
ISelectKey key;
|
||||
int cameraKey = cameraTrack->GetActiveKey(ec.time,&key);
|
||||
if (cameraKey != m_lastCameraKey/* && cameraKey > m_lastCameraKey*/)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
ApplyCameraKey( key,ec );
|
||||
}
|
||||
m_lastCameraKey = cameraKey;
|
||||
}
|
||||
|
||||
if (pEventTrack)
|
||||
{
|
||||
IEventKey key;
|
||||
int nEventKey = pEventTrack->GetActiveKey(ec.time,&key);
|
||||
if (nEventKey != m_lastEventKey && nEventKey >= 0)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
ApplyEventKey(key, ec);
|
||||
}
|
||||
m_lastEventKey = nEventKey;
|
||||
}
|
||||
|
||||
if (pConsoleTrack)
|
||||
{
|
||||
IConsoleKey key;
|
||||
int nConsoleKey = pConsoleTrack->GetActiveKey(ec.time,&key);
|
||||
if (nConsoleKey != m_lastConsoleKey && nConsoleKey >= 0)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
ApplyConsoleKey(key, ec);
|
||||
}
|
||||
m_lastConsoleKey = nConsoleKey;
|
||||
}
|
||||
|
||||
if (pMusicTrack)
|
||||
{
|
||||
IMusicKey key;
|
||||
int nMusicKey = pMusicTrack->GetActiveKey(ec.time,&key);
|
||||
if (nMusicKey != m_lastMusicKey && nMusicKey >= 0)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
ApplyMusicKey(key, ec);
|
||||
}
|
||||
m_lastMusicKey = nMusicKey;
|
||||
}
|
||||
|
||||
for (int i=0;i<SCENE_SOUNDTRACKS;i++)
|
||||
{
|
||||
if (pSoundTrack[i])
|
||||
{
|
||||
ISoundKey key;
|
||||
int nSoundKey = pSoundTrack[i]->GetActiveKey(ec.time, &key);
|
||||
if (nSoundKey!=m_SoundInfo[i].nLastKey || key.time==ec.time || nSoundKey==-1)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
{
|
||||
m_SoundInfo[i].nLastKey=nSoundKey;
|
||||
ApplySoundKey( pSoundTrack[i],nSoundKey,i, key, ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pSequenceTrack)
|
||||
{
|
||||
ISelectKey key;
|
||||
int nSequenceKey = pSequenceTrack->GetActiveKey(ec.time,&key);
|
||||
if (nSequenceKey != m_lastSequenceKey && nSequenceKey >= 0)
|
||||
{
|
||||
if (!ec.bSingleFrame || key.time == ec.time) // If Single frame update key time must match current time.
|
||||
ApplySequenceKey(pSequenceTrack,nSequenceKey,key, ec);
|
||||
}
|
||||
m_lastSequenceKey = nSequenceKey;
|
||||
}
|
||||
|
||||
m_time = ec.time;
|
||||
if (m_callback)
|
||||
{
|
||||
m_callback->OnNodeAnimated();
|
||||
}else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimSceneNode::ReleaseSounds()
|
||||
{
|
||||
// stop all sounds
|
||||
for (int i=0;i<SCENE_SOUNDTRACKS;i++)
|
||||
{
|
||||
if (m_SoundInfo[i].pSound)
|
||||
m_SoundInfo[i].pSound->Stop();
|
||||
m_SoundInfo[i].nLastKey=-1;
|
||||
m_SoundInfo[i].sLastFilename="";
|
||||
m_SoundInfo[i].pSound=NULL;
|
||||
}
|
||||
// enable music-event processing
|
||||
if (m_bMusicMoodSet)
|
||||
{
|
||||
IMusicSystem *pMusicSystem=GetMovieSystem()->GetSystem()->GetIMusicSystem();
|
||||
if (pMusicSystem)
|
||||
pMusicSystem->EnableEventProcessing(true);
|
||||
m_bMusicMoodSet=false;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::Reset()
|
||||
{
|
||||
// If camera from this sequence still active, remove it.
|
||||
// reset camera
|
||||
SCameraParams CamParams = m_pMovie->GetCameraParams();
|
||||
if (CamParams.nCameraId != 0 && CamParams.nCameraId == m_sequenceCameraId)
|
||||
{
|
||||
CamParams.cameraNode = NULL;
|
||||
CamParams.nCameraId = 0;
|
||||
m_pMovie->SetCameraParams(CamParams);
|
||||
}
|
||||
|
||||
m_lastCameraKey = -1;
|
||||
m_lastEventKey = -1;
|
||||
m_lastConsoleKey = -1;
|
||||
m_lastMusicKey = -1;
|
||||
m_lastSequenceKey = -1;
|
||||
m_sequenceCameraId = -1;
|
||||
|
||||
ReleaseSounds();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::Pause()
|
||||
{
|
||||
ReleaseSounds();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplyCameraKey( ISelectKey &key,SAnimContext &ec )
|
||||
{
|
||||
IAnimNode *cameraNode = GetMovieSystem()->FindNode(key.szSelection);
|
||||
float fov=60.0f;
|
||||
SCameraParams CamParams;
|
||||
CamParams.cameraNode = cameraNode;
|
||||
CamParams.nCameraId=0;
|
||||
if (cameraNode)
|
||||
{
|
||||
cameraNode->GetParamValue( ec.time,APARAM_FOV,fov );
|
||||
IEntity *cameraEntity=cameraNode->GetEntity();
|
||||
if (cameraEntity)
|
||||
CamParams.nCameraId=cameraEntity->GetId();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen(key.szSelection) > 0)
|
||||
{
|
||||
m_pMovie->GetSystem()->Warning( VALIDATOR_MODULE_MOVIE,VALIDATOR_WARNING,0,0,
|
||||
"[CryMovie] Camera entity %s not found",(const char*)key.szSelection );
|
||||
}
|
||||
}
|
||||
CamParams.fFOV=DEG2RAD(fov);
|
||||
m_pMovie->SetCameraParams(CamParams);
|
||||
m_sequenceCameraId = CamParams.nCameraId;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplyEventKey(IEventKey &key, SAnimContext &ec)
|
||||
{
|
||||
char funcName[1024];
|
||||
strcpy(funcName, "Event_");
|
||||
strcat(funcName, key.event);
|
||||
m_pMovie->SendGlobalEvent(funcName);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplySoundKey( IAnimTrack *pTrack,int nCurrKey,int nLayer, ISoundKey &key, SAnimContext &ec)
|
||||
{
|
||||
if (m_SoundInfo[nLayer].nLastKey==-1)
|
||||
{
|
||||
if (m_SoundInfo[nLayer].pSound)
|
||||
m_SoundInfo[nLayer].pSound->Stop();
|
||||
m_SoundInfo[nLayer].pSound=NULL;
|
||||
return;
|
||||
}
|
||||
if (((strcmp(m_SoundInfo[nLayer].sLastFilename.c_str(), key.pszFilename)) || (!m_SoundInfo[nLayer].pSound)))
|
||||
{
|
||||
int flags = 0;
|
||||
//if (key.bStream)
|
||||
//flags |= FLAG_SOUND_STREAM;
|
||||
//else
|
||||
flags |= FLAG_SOUND_LOAD_SYNCHRONOUSLY; // Allways synchronously for now.
|
||||
if (key.bLoop)
|
||||
flags |= FLAG_SOUND_LOOP;
|
||||
//if (key.b3DSound)
|
||||
{
|
||||
// Always 2D sound.
|
||||
flags |= FLAG_SOUND_2D|FLAG_SOUND_STEREO|FLAG_SOUND_16BITS;
|
||||
}
|
||||
|
||||
// we have a different sound now
|
||||
if (m_SoundInfo[nLayer].pSound)
|
||||
m_SoundInfo[nLayer].pSound->Stop();
|
||||
m_SoundInfo[nLayer].pSound = m_pMovie->GetSystem()->GetISoundSystem()->LoadSound(key.pszFilename, flags|FLAG_SOUND_UNSCALABLE);
|
||||
m_SoundInfo[nLayer].sLastFilename=key.pszFilename;
|
||||
if (m_SoundInfo[nLayer].pSound)
|
||||
{
|
||||
m_SoundInfo[nLayer].nLength=m_SoundInfo[nLayer].pSound->GetLengthMs();
|
||||
key.fDuration = ((float)m_SoundInfo[nLayer].nLength) / 1000.0f;
|
||||
pTrack->SetKey( nCurrKey,&key ); // Update key duration.
|
||||
}
|
||||
}else
|
||||
{
|
||||
if (m_SoundInfo[nLayer].pSound)
|
||||
m_SoundInfo[nLayer].pSound->Stop();
|
||||
}
|
||||
if (!m_SoundInfo[nLayer].pSound)
|
||||
return;
|
||||
|
||||
m_SoundInfo[nLayer].pSound->SetSoundPriority( MOVIE_SOUND_PRIORITY );
|
||||
m_SoundInfo[nLayer].pSound->SetVolume(key.nVolume);
|
||||
m_SoundInfo[nLayer].pSound->SetPan(key.nPan);
|
||||
|
||||
int nOffset=(int)((ec.time-key.time)*1000.0f);
|
||||
if (nOffset < m_SoundInfo[nLayer].nLength)
|
||||
{
|
||||
//return;
|
||||
m_SoundInfo[nLayer].pSound->SetCurrentSamplePos(nOffset, true);
|
||||
}
|
||||
|
||||
((CMovieSystem*)m_pMovie)->OnPlaySound( m_SoundInfo[nLayer].pSound );
|
||||
if (!m_SoundInfo[nLayer].pSound->IsPlaying())
|
||||
m_SoundInfo[nLayer].pSound->Play();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplySequenceKey( IAnimTrack *pTrack,int nCurrKey,ISelectKey &key,SAnimContext &ec )
|
||||
{
|
||||
if (strlen(key.szSelection) > 0)
|
||||
{
|
||||
IAnimSequence *pSequence = GetMovieSystem()->FindSequence(key.szSelection);
|
||||
if (pSequence)
|
||||
{
|
||||
key.fDuration = pSequence->GetTimeRange().Length();
|
||||
pTrack->SetKey( nCurrKey,&key );
|
||||
}
|
||||
GetMovieSystem()->PlaySequence(key.szSelection,true);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplyConsoleKey(IConsoleKey &key, SAnimContext &ec)
|
||||
{
|
||||
if (strlen(key.command) > 0)
|
||||
{
|
||||
GetMovieSystem()->GetSystem()->GetIConsole()->ExecuteString( key.command,false );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimSceneNode::ApplyMusicKey(IMusicKey &key, SAnimContext &ec)
|
||||
{
|
||||
IMusicSystem *pMusicSystem=GetMovieSystem()->GetSystem()->GetIMusicSystem();
|
||||
if (!pMusicSystem)
|
||||
return;
|
||||
switch (key.eType)
|
||||
{
|
||||
case eMusicKeyType_SetMood:
|
||||
m_bMusicMoodSet=true;
|
||||
pMusicSystem->EnableEventProcessing(false);
|
||||
pMusicSystem->SetMood(key.szMood);
|
||||
break;
|
||||
case eMusicKeyType_VolumeRamp:
|
||||
break;
|
||||
}
|
||||
}
|
||||
82
CryMovie/SceneNode.h
Normal file
82
CryMovie/SceneNode.h
Normal file
@@ -0,0 +1,82 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: scenenode.h
|
||||
// Version: v1.00
|
||||
// Created: 23/4/2002 by Lennert.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __scenenode_h__
|
||||
#define __scenenode_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "AnimNode.h"
|
||||
#include "SoundTrack.h"
|
||||
|
||||
#define SCENE_SOUNDTRACKS 3
|
||||
|
||||
struct ISound;
|
||||
|
||||
class CAnimSceneNode : public CAnimNode
|
||||
{
|
||||
public:
|
||||
CAnimSceneNode(IMovieSystem *sys);
|
||||
~CAnimSceneNode();
|
||||
|
||||
virtual EAnimNodeType GetType() const { return ANODE_SCENE; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides from CAnimNode
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Animate( SAnimContext &ec );
|
||||
void CreateDefaultTracks();
|
||||
|
||||
// ovverided from IAnimNode
|
||||
// IAnimBlock* CreateAnimBlock();
|
||||
void Reset();
|
||||
void Pause();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetParamCount() const;
|
||||
virtual bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
virtual bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
private:
|
||||
void ReleaseSounds();
|
||||
void ApplyCameraKey( ISelectKey &key,SAnimContext &ec );
|
||||
void ApplyEventKey(IEventKey &key, SAnimContext &ec);
|
||||
void ApplyConsoleKey(IConsoleKey &key, SAnimContext &ec);
|
||||
void ApplySoundKey( IAnimTrack *pTrack,int nCurrKey,int nLayer, ISoundKey &key, SAnimContext &ec);
|
||||
void ApplySequenceKey( IAnimTrack *pTrack,int nCurrKey,ISelectKey &key,SAnimContext &ec );
|
||||
void ApplyMusicKey(IMusicKey &key, SAnimContext &ec);
|
||||
|
||||
// Cached parameters of node at givven time.
|
||||
float m_time;
|
||||
|
||||
IMovieSystem *m_pMovie;
|
||||
|
||||
bool m_bActive;
|
||||
|
||||
bool m_bMusicMoodSet;
|
||||
|
||||
//! Last animated key in track.
|
||||
int m_lastCameraKey;
|
||||
int m_lastEventKey;
|
||||
int m_lastConsoleKey;
|
||||
int m_lastMusicKey;
|
||||
int m_lastSequenceKey;
|
||||
int m_sequenceCameraId;
|
||||
SSoundInfo m_SoundInfo[SCENE_SOUNDTRACKS];
|
||||
};
|
||||
|
||||
#endif // __entitynode_h__
|
||||
120
CryMovie/ScriptVarNode.cpp
Normal file
120
CryMovie/ScriptVarNode.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: ScriptVarNode.cpp
|
||||
// Version: v1.00
|
||||
// Created: 11/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ScriptVarNode.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
#include <ISystem.h>
|
||||
#include <IScriptSystem.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CAnimScriptVarNode::CAnimScriptVarNode( IMovieSystem *sys )
|
||||
: CAnimNode(sys)
|
||||
{
|
||||
SetFlags( GetFlags()|ANODE_FLAG_CAN_CHANGE_NAME );
|
||||
m_dwSupportedTracks = PARAM_BIT(APARAM_FLOAT_1);
|
||||
m_value = -1e-20f;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimScriptVarNode::CreateDefaultTracks()
|
||||
{
|
||||
CreateTrack(APARAM_FLOAT_1);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CAnimScriptVarNode::GetParamCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimScriptVarNode::GetParamInfo( int nIndex, SParamInfo &info ) const
|
||||
{
|
||||
if (nIndex == 0)
|
||||
{
|
||||
info.flags = 0;
|
||||
info.name = "Value";
|
||||
info.paramId = APARAM_FLOAT_1;
|
||||
info.valueType = AVALUE_FLOAT;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CAnimScriptVarNode::GetParamInfoFromId( int paramId, SParamInfo &info ) const
|
||||
{
|
||||
if (paramId == APARAM_FLOAT_1)
|
||||
{
|
||||
GetParamInfo( 0,info );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimScriptVarNode::Animate( SAnimContext &ec )
|
||||
{
|
||||
IAnimBlock *anim = GetAnimBlock();
|
||||
if (!anim)
|
||||
return;
|
||||
|
||||
float value = m_value;
|
||||
|
||||
IAnimTrack *pValueTrack = anim->GetTrack(APARAM_FLOAT_1);
|
||||
if (pValueTrack)
|
||||
{
|
||||
pValueTrack->GetValue(ec.time, value);
|
||||
}
|
||||
|
||||
if (value != m_value)
|
||||
{
|
||||
m_value = value;
|
||||
// Change console var value.
|
||||
SetScriptValue();
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimScriptVarNode::SetScriptValue()
|
||||
{
|
||||
const char *sVarName = GetName();
|
||||
const char *sPnt = strchr(sVarName,'.');
|
||||
if (sPnt == 0)
|
||||
{
|
||||
// Global variable.
|
||||
IScriptSystem *pScriptSystem = m_pMovieSystem->GetSystem()->GetIScriptSystem();
|
||||
pScriptSystem->SetGlobalValue( sVarName,m_value );
|
||||
}
|
||||
else
|
||||
{
|
||||
char sTable[256];
|
||||
char sName[256];
|
||||
strcpy( sTable,sVarName );
|
||||
sTable[sPnt-sVarName] = 0;
|
||||
strcpy( sName,sPnt+1 );
|
||||
|
||||
// In Table value.
|
||||
IScriptSystem *pScriptSystem = m_pMovieSystem->GetSystem()->GetIScriptSystem();
|
||||
_SmartScriptObject pTable(pScriptSystem,true);
|
||||
if (pScriptSystem->GetGlobalValue( sTable,pTable ))
|
||||
{
|
||||
// Set float value inside table.
|
||||
pTable->SetValue( sName,m_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
45
CryMovie/ScriptVarNode.h
Normal file
45
CryMovie/ScriptVarNode.h
Normal file
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001-2004.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: ScriptVarNode.h
|
||||
// Version: v1.00
|
||||
// Created: 11/5/2004 by Timur.
|
||||
// Compilers: Visual Studio.NET 2003
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __ScriptVarNode_h__
|
||||
#define __ScriptVarNode_h__
|
||||
#pragma once
|
||||
|
||||
#include "AnimNode.h"
|
||||
|
||||
class CAnimScriptVarNode : public CAnimNode
|
||||
{
|
||||
public:
|
||||
CAnimScriptVarNode( IMovieSystem *sys );
|
||||
|
||||
virtual EAnimNodeType GetType() const { return ANODE_SCRIPTVAR; }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Overrides from CAnimNode
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Animate( SAnimContext &ec );
|
||||
void CreateDefaultTracks();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual int GetParamCount() const;
|
||||
virtual bool GetParamInfo( int nIndex, SParamInfo &info ) const;
|
||||
virtual bool GetParamInfoFromId( int paramId, SParamInfo &info ) const;
|
||||
|
||||
private:
|
||||
void SetScriptValue();
|
||||
float m_value;
|
||||
};
|
||||
|
||||
#endif // __ScriptVarNode_h__
|
||||
45
CryMovie/SelectTrack.cpp
Normal file
45
CryMovie/SelectTrack.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: selecttrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 23/7/2002 by Lennert Schneider.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "SelectTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSelectTrack::SerializeKey( ISelectKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *szSelection;
|
||||
szSelection= keyNode->getAttr( "node" );
|
||||
|
||||
strncpy( key.szSelection,szSelection,sizeof(key.szSelection) );
|
||||
key.szSelection[sizeof(key.szSelection)-1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyNode->setAttr( "node",key.szSelection);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSelectTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = m_keys[key].fDuration;
|
||||
if (strlen(m_keys[key].szSelection) > 0)
|
||||
description = m_keys[key].szSelection;
|
||||
}
|
||||
40
CryMovie/SelectTrack.h
Normal file
40
CryMovie/SelectTrack.h
Normal file
@@ -0,0 +1,40 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: selecttrack.h
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Lennert.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __selecttrack_h__
|
||||
#define __selecttrack_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** Boolean track, every key on this track negates boolean value.
|
||||
*/
|
||||
class CSelectTrack : public TAnimTrack<ISelectKey>
|
||||
{
|
||||
public:
|
||||
EAnimTrackType GetType() { return ATRACK_SELECT; };
|
||||
EAnimValue GetValueType() { return AVALUE_SELECT; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( ISelectKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
|
||||
#endif // __selecttrack_h__
|
||||
60
CryMovie/SequenceIt.cpp
Normal file
60
CryMovie/SequenceIt.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "stdafx.h"
|
||||
#include "sequenceit.h"
|
||||
|
||||
CSequenceIt::CSequenceIt()
|
||||
{
|
||||
m_count = 0;
|
||||
m_current = m_elements.end();
|
||||
}
|
||||
|
||||
CSequenceIt::~CSequenceIt()
|
||||
{
|
||||
}
|
||||
|
||||
void CSequenceIt::Release()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CSequenceIt::add( IAnimSequence* element )
|
||||
{
|
||||
m_elements.push_back( element );
|
||||
m_count++;
|
||||
m_current = m_elements.begin();
|
||||
}
|
||||
|
||||
void CSequenceIt::clear()
|
||||
{
|
||||
m_elements.clear();
|
||||
m_count = 0;
|
||||
m_current = m_elements.end();
|
||||
}
|
||||
|
||||
bool CSequenceIt::empty() const
|
||||
{
|
||||
return m_count == 0;
|
||||
};
|
||||
|
||||
int CSequenceIt::count() const
|
||||
{
|
||||
return m_count;
|
||||
};
|
||||
|
||||
IAnimSequence* CSequenceIt::first()
|
||||
{
|
||||
m_current = m_elements.begin();
|
||||
if (m_current != m_elements.end()) {
|
||||
return *m_current;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
IAnimSequence* CSequenceIt::next()
|
||||
{
|
||||
if (m_current != m_elements.end()) {
|
||||
if (++m_current != m_elements.end()) {
|
||||
return *m_current;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
29
CryMovie/SequenceIt.h
Normal file
29
CryMovie/SequenceIt.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <imoviesystem.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Iterator.
|
||||
// Iterator class allows iteration thru elements of container.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CSequenceIt : public ISequenceIt
|
||||
{
|
||||
public:
|
||||
CSequenceIt();
|
||||
virtual ~CSequenceIt();
|
||||
void Release();
|
||||
void add( IAnimSequence* element );
|
||||
void clear();
|
||||
bool empty() const;
|
||||
int count() const;
|
||||
IAnimSequence* first();
|
||||
IAnimSequence* next();
|
||||
private:
|
||||
typedef std::vector<IAnimSequence*> Elements;
|
||||
int m_count;
|
||||
Elements::iterator m_current;
|
||||
Elements m_elements;
|
||||
};
|
||||
66
CryMovie/SoundTrack.cpp
Normal file
66
CryMovie/SoundTrack.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2002.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: selecttrack.cpp
|
||||
// Version: v1.00
|
||||
// Created: 20/8/2002 by Lennert Schneider.
|
||||
// Compilers: Visual Studio.NET
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "SoundTrack.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSoundTrack::SerializeKey( ISoundKey &key,XmlNodeRef &keyNode,bool bLoading )
|
||||
{
|
||||
if (bLoading)
|
||||
{
|
||||
const char *desc;
|
||||
desc=keyNode->getAttr( "filename");
|
||||
strncpy(key.pszFilename,desc,sizeof(key.pszFilename));
|
||||
key.pszFilename[sizeof(key.pszFilename)-1] = 0;
|
||||
keyNode->getAttr( "volume",key.nVolume );
|
||||
keyNode->getAttr( "pan",key.nPan );
|
||||
keyNode->getAttr( "duration",key.fDuration );
|
||||
keyNode->getAttr( "InRadius",key.inRadius );
|
||||
keyNode->getAttr( "OutRadius",key.outRadius );
|
||||
keyNode->getAttr( "Stream",key.bStream );
|
||||
keyNode->getAttr( "Is3D",key.b3DSound );
|
||||
keyNode->getAttr( "Loop",key.bLoop );
|
||||
desc = keyNode->getAttr( "desc" );
|
||||
strncpy( key.description,desc,sizeof(key.description) );
|
||||
key.description[sizeof(key.description)-1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyNode->setAttr( "filename", key.pszFilename);
|
||||
keyNode->setAttr( "volume",key.nVolume );
|
||||
keyNode->setAttr( "pan",key.nPan );
|
||||
keyNode->setAttr( "duration",key.fDuration );
|
||||
keyNode->setAttr( "desc",key.description );
|
||||
keyNode->setAttr( "InRadius",key.inRadius );
|
||||
keyNode->setAttr( "OutRadius",key.outRadius );
|
||||
keyNode->setAttr( "Stream",key.bStream );
|
||||
keyNode->setAttr( "Is3D",key.b3DSound );
|
||||
keyNode->setAttr( "Loop",key.bLoop );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSoundTrack::GetKeyInfo( int key,const char* &description,float &duration )
|
||||
{
|
||||
assert( key >= 0 && key < (int)m_keys.size() );
|
||||
CheckValid();
|
||||
description = 0;
|
||||
duration = m_keys[key].fDuration;
|
||||
//if (strlen(m_keys[key].description) > 0)
|
||||
// description = m_keys[key].description;
|
||||
if (strlen(m_keys[key].pszFilename) > 0)
|
||||
description=m_keys[key].pszFilename;
|
||||
}
|
||||
22
CryMovie/SoundTrack.h
Normal file
22
CryMovie/SoundTrack.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "IMovieSystem.h"
|
||||
#include "AnimTrack.h"
|
||||
|
||||
struct SSoundInfo
|
||||
{
|
||||
int nLastKey;
|
||||
string sLastFilename;
|
||||
_smart_ptr<ISound> pSound;
|
||||
int nLength;
|
||||
};
|
||||
|
||||
class CSoundTrack : public TAnimTrack<ISoundKey>
|
||||
{
|
||||
public:
|
||||
EAnimTrackType GetType() { return ATRACK_SOUND; };
|
||||
EAnimValue GetValueType() { return AVALUE_SOUND; };
|
||||
|
||||
void GetKeyInfo( int key,const char* &description,float &duration );
|
||||
void SerializeKey( ISoundKey &key,XmlNodeRef &keyNode,bool bLoading );
|
||||
};
|
||||
650
CryMovie/Spline.h
Normal file
650
CryMovie/Spline.h
Normal file
@@ -0,0 +1,650 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: spline.h
|
||||
// Version: v1.00
|
||||
// Created: 22/4/2002 by Timur.
|
||||
// Compilers: Visual C++ 7.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __spline_h__
|
||||
#define __spline_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
template <int N>
|
||||
class BasisFunction {
|
||||
public:
|
||||
const float& operator[]( int i ) const { return m_f[i]; };
|
||||
// const float& operator[]( int i ) const { return m_f[i]; };
|
||||
protected:
|
||||
float m_f[N];
|
||||
};
|
||||
|
||||
// Special functions that makes parameter zero.
|
||||
template <class T>
|
||||
inline void Zero( T &val )
|
||||
{
|
||||
memset( &val,0,sizeof(val) );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HermitBasis.
|
||||
class HermitBasis : public BasisFunction<4>
|
||||
{
|
||||
public:
|
||||
HermitBasis( float t ) {
|
||||
float t2,t3,t2_3,t3_2,t3_t2;
|
||||
|
||||
t2 = t*t; // t2 = t^2;
|
||||
t3 = t2*t; // t3 = t^3;
|
||||
|
||||
t3_2 = t3 + t3;
|
||||
t2_3 = 3*t2;
|
||||
t3_t2 = t3 - t2;
|
||||
m_f[0] = t3_2 - t2_3 + 1;
|
||||
m_f[1] = -t3_2 + t2_3;
|
||||
m_f[2] = t3_t2 - t2 + t;
|
||||
m_f[3] = t3_t2;
|
||||
}
|
||||
};
|
||||
|
||||
inline float fast_fmod( float x,float y )
|
||||
{
|
||||
return cry_fmod( x,y );
|
||||
//int ival = ftoi(x/y);
|
||||
//return x - ival*y;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** Key classes **
|
||||
****************************************************************************/
|
||||
template <class T>
|
||||
struct SplineKey
|
||||
{
|
||||
typedef T value_type;
|
||||
|
||||
float time; //!< Key time.
|
||||
int flags; //!< Key flags.
|
||||
value_type value; //!< Key value.
|
||||
value_type ds; //!< Incoming tangent.
|
||||
value_type dd; //!< Outgoing tangent.
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool operator ==( const SplineKey<T> &k1,const SplineKey<T> &k2 ) { return k1.time == k2.time; };
|
||||
template <class T>
|
||||
bool operator !=( const SplineKey<T> &k1,const SplineKey<T> &k2 ) { return k1.time != k2.time; };
|
||||
template <class T>
|
||||
bool operator < ( const SplineKey<T> &k1,const SplineKey<T> &k2 ) { return k1.time < k2.time; };
|
||||
template <class T>
|
||||
bool operator > ( const SplineKey<T> &k1,const SplineKey<T> &k2 ) { return k1.time > k2.time; };
|
||||
|
||||
/****************************************************************************
|
||||
** TCBSplineKey classes **
|
||||
****************************************************************************/
|
||||
/*!
|
||||
TCB spline key.
|
||||
*/
|
||||
template <class T>
|
||||
struct TCBSplineKey : public SplineKey<T>
|
||||
{
|
||||
// Key controls.
|
||||
float tens; //!< Key tension value.
|
||||
float cont; //!< Key continuity value.
|
||||
float bias; //!< Key bias value.
|
||||
float easeto; //!< Key ease to value.
|
||||
float easefrom; //!< Key ease from value.
|
||||
|
||||
TCBSplineKey() { tens = 0, cont = 0, bias = 0, easeto = 0, easefrom = 0; };
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
** Spline class **
|
||||
****************************************************************************/
|
||||
template <class KeyType,class BasisType>
|
||||
class TSpline
|
||||
{
|
||||
public:
|
||||
typedef KeyType key_type;
|
||||
typedef typename KeyType::value_type value_type;
|
||||
typedef BasisType basis_type;
|
||||
|
||||
// Out of range types.
|
||||
enum {
|
||||
ORT_CONSTANT = 0x0001, // Constant track.
|
||||
ORT_CYCLE = 0x0002, // Cycle track
|
||||
ORT_LOOP = 0x0003, // Loop track.
|
||||
ORT_OSCILLATE = 0x0004, // Oscillate track.
|
||||
ORT_LINEAR = 0x0005, // Linear track.
|
||||
ORT_RELATIVE_REPEAT = 0x0007 // Realtive repeat track.
|
||||
};
|
||||
// Spline flags.
|
||||
enum {
|
||||
MODIFIED = 0x0001, // Track modified.
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Methods.
|
||||
TSpline();
|
||||
virtual ~TSpline() {};
|
||||
|
||||
void flag_set( int flag ) { m_flags |= flag; };
|
||||
void flag_clr( int flag ) { m_flags &= ~flag; };
|
||||
int flag( int flag ) { return m_flags&flag; };
|
||||
|
||||
void ORT( int ort ) { m_ORT = ort; };
|
||||
int ORT() const { return m_ORT; };
|
||||
int isORT( int o ) { return (m_ORT == o); };
|
||||
|
||||
void SetRange( float start,float end ) { m_rangeStart = start; m_rangeEnd = end; };
|
||||
float GetRangeStart() const { return m_rangeStart; };
|
||||
float GetRangeEnd() const { return m_rangeEnd; };
|
||||
|
||||
// Keys access methods.
|
||||
void reserve_keys( int num ) { m_keys.reserve(num); }; // Reserve memory for more keys.
|
||||
void resize( int num ) { m_keys.resize(num); }; // Set new key count.
|
||||
bool empty() const { return m_keys.empty(); }; // Check if curve empty (no keys).
|
||||
int num_keys() const { return m_keys.size(); }; // Return number of keys in curve.
|
||||
key_type& key( int n ) { return m_keys[n]; }; // Return n key.
|
||||
float time( int n ) const { return m_keys[n].time; }; // Shortcut to key n time.
|
||||
value_type& value( int n ) { return m_keys[n].value; }; // Shortcut to key n value.
|
||||
value_type& ds( int n ) { return m_keys[n].ds; }; // Shortcut to key n incoming tangent.
|
||||
value_type& dd( int n ) { return m_keys[n].dd; }; // Shortcut to key n outgoing tangent.
|
||||
|
||||
void erase( int key ) { m_keys.erase( m_keys.begin() + key ); m_flags |= MODIFIED; };
|
||||
bool closed() { return (ORT() == ORT_LOOP); } // return True if curve closed.
|
||||
|
||||
void sort_keys()
|
||||
{
|
||||
std::sort( m_keys.begin(),m_keys.end() );
|
||||
if (!m_keys.empty())
|
||||
{
|
||||
//@FIXME: check if this is correct?
|
||||
//m_rangeStart = time(0);
|
||||
//m_rangeEnd = time(num_keys()-1);
|
||||
}
|
||||
}
|
||||
|
||||
void push_back( const key_type &k )
|
||||
{
|
||||
m_keys.push_back( k ); m_flags |= MODIFIED;
|
||||
//if (k.time < m_rangeStart) m_rangeStart = k.time;
|
||||
//if (k.time > m_rangeEnd) m_rangeEnd = k.time;
|
||||
};
|
||||
|
||||
void interpolate( float time,value_type& val );
|
||||
|
||||
protected:
|
||||
// Must be ovveriden by curved classes.
|
||||
virtual void comp_deriv() = 0;
|
||||
virtual void interp_keys( int key1,int key2,float u,value_type& val ) = 0;
|
||||
int seek_key( float time ); // Return key before or equal to this time.
|
||||
|
||||
int m_flags;
|
||||
int m_ORT; // Out-Of-Range type.
|
||||
std::vector<key_type> m_keys; // List of keys.
|
||||
int m_curr; // Current key in track.
|
||||
|
||||
float m_rangeStart;
|
||||
float m_rangeEnd;
|
||||
};
|
||||
|
||||
template <class T,class Basis>
|
||||
inline TSpline<T,Basis>::TSpline() {
|
||||
m_flags = MODIFIED;
|
||||
m_ORT = 0;
|
||||
m_curr = 0;
|
||||
m_rangeStart = 0;
|
||||
m_rangeEnd = 0;
|
||||
}
|
||||
|
||||
template <class T,class Basis>
|
||||
inline int TSpline<T,Basis>::seek_key( float t ) {
|
||||
if ((m_curr == num_keys()) || (time(m_curr) > t)) {
|
||||
// Search from begining.
|
||||
m_curr = 0;
|
||||
}
|
||||
if (m_curr < num_keys()) {
|
||||
int last = num_keys() - 1;
|
||||
while ((m_curr != last)&&(time(m_curr+1) <= t)) ++m_curr;
|
||||
}
|
||||
return m_curr;
|
||||
}
|
||||
|
||||
template <class T,class Basis>
|
||||
inline void TSpline<T,Basis>::interpolate( float tm,value_type& val ) {
|
||||
if (empty()) return;
|
||||
|
||||
float t = tm;
|
||||
int last = num_keys() - 1;
|
||||
|
||||
if (m_flags&MODIFIED)
|
||||
sort_keys();
|
||||
|
||||
if (m_flags&MODIFIED) comp_deriv();
|
||||
|
||||
if (t < time(0)) { // Before first key.
|
||||
val = value(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isORT(ORT_CYCLE) || isORT(ORT_LOOP)) {
|
||||
// Warp time.
|
||||
float endtime = time(last);
|
||||
//t = t - floor(t/endtime)*endtime;
|
||||
t = fast_fmod( t,endtime );
|
||||
}
|
||||
int curr = seek_key( t );
|
||||
if (curr < last) {
|
||||
t = (t - time(curr))/(time(curr+1) - time(curr));
|
||||
if (t >= 0) {
|
||||
// Call actual interpolation function.
|
||||
interp_keys( curr,curr+1,t,val );
|
||||
}
|
||||
} else {
|
||||
val = value(last);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Save curve to archive.
|
||||
template <class T,class Basis>
|
||||
Archive& operator << ( Archive& ar,TSpline<T,Basis> &curve ) {
|
||||
TSpline<T,Basis>::value_type val;
|
||||
curve.interpolate( 0,val ); // Calc derivs if not calced yet. (for quat)
|
||||
ar << curve.flag( 0xFFFFFFFF );
|
||||
ar << curve.ORT(); // Save Out-Of-Range type.
|
||||
ar << curve.num_keys(); // Save num keys.
|
||||
for (int i = 0; i < curve.num_keys(); ++i) {
|
||||
ar << curve.key(i); // Save keys.
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
// Load curve from archive.
|
||||
template <class T,class Basis>
|
||||
Archive& operator >> ( Archive& ar,TSpline<T,Basis> &curve ) {
|
||||
int n = 0;
|
||||
ar >> n; // Load num keys.
|
||||
curve.flag_set( n );
|
||||
ar >> n; // Load Out-Of-Range type.
|
||||
curve.ORT( n );
|
||||
ar >> n; // Load num keys.
|
||||
while (n-- > 0) {
|
||||
TSpline<T,Basis>::key_type k;
|
||||
ar >> k; // Load key.
|
||||
curve.push_back( k );
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
** TCBSpline class implementation **
|
||||
****************************************************************************/
|
||||
template <class T>
|
||||
class TCBSpline : public TSpline< TCBSplineKey<T>,HermitBasis > {
|
||||
protected:
|
||||
virtual void interp_keys( int key1,int key2,float u,T& val );
|
||||
virtual void comp_deriv();
|
||||
|
||||
float calc_ease( float t,float a,float b );
|
||||
|
||||
static float Concatenate(float left, float right)
|
||||
{
|
||||
return left+right;
|
||||
}
|
||||
static Vec3 Concatenate(const Vec3& left, const Vec3& right)
|
||||
{
|
||||
return left + right;
|
||||
}
|
||||
static CryQuat Concatenate(const CryQuat& left, const CryQuat& right)
|
||||
{
|
||||
return left * right;
|
||||
}
|
||||
|
||||
static Vec3 Subtract (const Vec3& left, const Vec3& right)
|
||||
{
|
||||
return left - right;
|
||||
}
|
||||
|
||||
static CryQuat Subtract(const CryQuat& left, const CryQuat& right)
|
||||
{
|
||||
return left / right;
|
||||
}
|
||||
static float Subtract(float left, float right)
|
||||
{
|
||||
return left - right;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void compMiddleDeriv( int curr );
|
||||
virtual void compFirstDeriv();
|
||||
virtual void compLastDeriv();
|
||||
virtual void comp2KeyDeriv();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::compMiddleDeriv( int curr ) {
|
||||
float dsA,dsB,ddA,ddB;
|
||||
float A,B,cont1,cont2;
|
||||
int last = num_keys() - 1;
|
||||
|
||||
// dsAdjust,ddAdjust apply speed correction when continuity is 0.
|
||||
// Middle key.
|
||||
if (curr == 0) {
|
||||
// First key.
|
||||
float dts = (GetRangeEnd() - time(last)) + (time(0) - GetRangeStart());
|
||||
float dt = 2.0f / (dts + time(1) - time(0));
|
||||
dsA = dt * dts;
|
||||
ddA = dt * (time(1) - time(0));
|
||||
} else {
|
||||
if (curr == last) {
|
||||
// Last key.
|
||||
float dts = (GetRangeEnd() - time(last)) + (time(0) - GetRangeStart());
|
||||
float dt = 2.0f / (dts + time(last) - time(last-1));
|
||||
dsA = dt * dts;
|
||||
ddA = dt * (time(last) - time(last-1));
|
||||
} else {
|
||||
// Middle key.
|
||||
float dt = 2.0f/(time(curr+1) - time(curr-1));
|
||||
dsA = dt * (time(curr) - time(curr-1));
|
||||
ddA = dt * (time(curr+1) - time(curr));
|
||||
}
|
||||
}
|
||||
key_type &k = key(curr);
|
||||
|
||||
float c = (float)fabs(k.cont);
|
||||
float sa = dsA + c*(1.0f - dsA);
|
||||
float da = ddA + c*(1.0f - ddA);
|
||||
|
||||
A = 0.5f * (1.0f - k.tens) * (1.0f + k.bias);
|
||||
B = 0.5f * (1.0f - k.tens) * (1.0f - k.bias);
|
||||
cont1 = (1.0f - k.cont);
|
||||
cont2 = (1.0f + k.cont);
|
||||
//dsA = dsA * A * cont1;
|
||||
//dsB = dsA * B * cont2;
|
||||
//ddA = ddA * A * cont2;
|
||||
//ddB = ddA * B * cont1;
|
||||
dsA = sa * A * cont1;
|
||||
dsB = sa * B * cont2;
|
||||
ddA = da * A * cont2;
|
||||
ddB = da * B * cont1;
|
||||
|
||||
T qp,qn;
|
||||
if (curr > 0) qp = value(curr-1); else qp = value(last);
|
||||
if (curr < last) qn = value(curr+1); else qn = value(0);
|
||||
k.ds = dsA*(k.value - qp) + dsB*(qn - k.value);
|
||||
k.dd = ddA*(k.value - qp) + ddB*(qn - k.value);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::compFirstDeriv() {
|
||||
key_type &k = key(0);
|
||||
Zero(k.ds);
|
||||
k.dd = 0.5f*(1.0f - k.tens)*( 3.0f*(value(1) - k.value) - ds(1));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::compLastDeriv() {
|
||||
int last = num_keys() - 1;
|
||||
key_type &k = key(last);
|
||||
k.ds = -0.5f*(1.0f - k.tens)*( 3.0f*(value(last-1) - k.value) + dd(last-1) );
|
||||
Zero(k.dd);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::comp2KeyDeriv() {
|
||||
key_type &k1 = key(0);
|
||||
key_type &k2 = key(1);
|
||||
value_type val = value(1) - value(0);
|
||||
|
||||
Zero(k1.ds);
|
||||
k1.dd = (1.0f - k1.tens)*val;
|
||||
k2.ds = (1.0f - k2.tens)*val;
|
||||
Zero(k2.dd);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::comp_deriv() {
|
||||
if (num_keys() > 1) {
|
||||
if ((num_keys() == 2) && !closed()) {
|
||||
comp2KeyDeriv();
|
||||
return;
|
||||
}
|
||||
if (closed()) {
|
||||
for (int i = 0; i < num_keys(); ++i) {
|
||||
compMiddleDeriv( i );
|
||||
}
|
||||
} else {
|
||||
for (int i = 1; i < (num_keys()-1); ++i) {
|
||||
compMiddleDeriv( i );
|
||||
}
|
||||
compFirstDeriv();
|
||||
compLastDeriv();
|
||||
}
|
||||
}
|
||||
m_curr = 0;
|
||||
m_flags &= ~MODIFIED; // clear MODIFIED flag.
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline float TCBSpline<T>::calc_ease( float t,float a,float b ) {
|
||||
float k;
|
||||
float s = a+b;
|
||||
|
||||
if (t == 0.0f || t == 1.0f) return t;
|
||||
if (s == 0.0f) return t;
|
||||
if (s > 1.0f) {
|
||||
k = 1.0f/s;
|
||||
a *= k;
|
||||
b *= k;
|
||||
}
|
||||
k = 1.0f/(2.0f-a-b);
|
||||
if (t < a) {
|
||||
return ((k/a)*t*t);
|
||||
} else {
|
||||
if (t < 1.0f-b) {
|
||||
return (k*(2.0f*t - a));
|
||||
} else {
|
||||
t = 1.0f - t;
|
||||
return (1.0f - (k/b)*t*t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TCBSpline<T>::interp_keys( int from,int to,float u,T& val )
|
||||
{
|
||||
u = calc_ease( u,key(from).easefrom,key(to).easeto );
|
||||
basis_type basis( u );
|
||||
|
||||
// Changed by Sergiy&Ivo
|
||||
//val = (basis[0]*value(from)) + (basis[1]*value(to)) + (basis[2]*dd(from)) + (basis[3]*ds(to));
|
||||
val = Concatenate( Concatenate( Concatenate( (basis[0]*value(from)) , (basis[1]*value(to))) , (basis[2]*dd(from))) , (basis[3]*ds(to)));
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
** TCBQuatSpline class implementation **
|
||||
****************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Quaternion TCB slerp, specification.
|
||||
// Disable corresponding methods for quaternion.
|
||||
template<>
|
||||
inline void TCBSpline<Quat>::compMiddleDeriv( int curr ) {}
|
||||
|
||||
template<>
|
||||
inline void TCBSpline<Quat>::compFirstDeriv() {}
|
||||
|
||||
template<>
|
||||
inline void TCBSpline<Quat>::compLastDeriv() {}
|
||||
|
||||
template<>
|
||||
inline void TCBSpline<Quat>::comp2KeyDeriv() {}
|
||||
|
||||
class TCBQuatSpline : public TCBSpline<Quat> {
|
||||
public:
|
||||
void interpolate( float time,value_type& val );
|
||||
|
||||
protected:
|
||||
virtual void interp_keys( int key1,int key2,float u,value_type& val );
|
||||
virtual void comp_deriv();
|
||||
|
||||
private:
|
||||
virtual void compMiddleDeriv( int curr );
|
||||
virtual void compFirstDeriv() {};
|
||||
virtual void compLastDeriv() {};
|
||||
virtual void comp2KeyDeriv() {};
|
||||
|
||||
// Loacal function to add quaternions.
|
||||
Quat AddQuat( const Quat &q1,const Quat &q2 )
|
||||
{
|
||||
return Quat( q1.w+q2.w, q1.v.x+q2.v.x, q1.v.y+q2.v.y, q1.v.z+q2.v.z );
|
||||
}
|
||||
};
|
||||
|
||||
inline void TCBQuatSpline::interpolate( float tm,value_type& val )
|
||||
{
|
||||
if (empty()) return;
|
||||
|
||||
float t = tm;
|
||||
int last = num_keys() - 1;
|
||||
|
||||
if (m_flags&MODIFIED) comp_deriv();
|
||||
|
||||
if (t < time(0)) { // Before first key.
|
||||
val = value(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isORT(ORT_CYCLE) || isORT(ORT_LOOP)) {
|
||||
// Warp time.
|
||||
float endtime = time(last);
|
||||
//t = t - floor(t/endtime)*endtime;
|
||||
t = fast_fmod( t,endtime );
|
||||
}
|
||||
int curr = seek_key( t );
|
||||
if (curr < last) {
|
||||
t = (t - time(curr))/(time(curr+1) - time(curr));
|
||||
if (t >= 0) {
|
||||
// Call actual interpolation function.
|
||||
interp_keys( curr,curr+1,t,val );
|
||||
}
|
||||
} else {
|
||||
val = value(last);
|
||||
}
|
||||
}
|
||||
|
||||
inline void TCBQuatSpline::interp_keys( int from,int to,float u,value_type& val ) {
|
||||
u = calc_ease( u,key(from).easefrom,key(to).easeto );
|
||||
basis_type basis( u );
|
||||
//val = SquadRev( angle(to),axis(to), value(from), dd(from), ds(to), value(to), u );
|
||||
val = Squad( value(from), dd(from), ds(to), value(to), u );
|
||||
val = GetNormalized(val); // Normalize quaternion.
|
||||
}
|
||||
|
||||
inline void TCBQuatSpline::comp_deriv()
|
||||
{
|
||||
if (num_keys() > 1)
|
||||
{
|
||||
for (int i = 0; i < num_keys(); ++i) {
|
||||
compMiddleDeriv( i );
|
||||
}
|
||||
}
|
||||
m_curr = 0;
|
||||
m_flags &= ~MODIFIED; // clear MODIFIED flag.
|
||||
}
|
||||
|
||||
#define M_2PI (2.0f*3.14159f - 0.00001f)
|
||||
inline void TCBQuatSpline::compMiddleDeriv( int curr )
|
||||
{
|
||||
Quat qp,qm;
|
||||
float fp,fn;
|
||||
int last = num_keys() - 1;
|
||||
|
||||
if (curr > 0 || closed())
|
||||
{
|
||||
int prev = (curr != 0) ? curr - 1 : last;
|
||||
qm = value(prev);
|
||||
if ( (qm|value(curr)) < 0.0f) qm = -qm;
|
||||
qm = LnDif( qm,value(curr) );
|
||||
}
|
||||
|
||||
if (curr < last || closed())
|
||||
{
|
||||
int next = (curr != last) ? curr + 1 : 0;
|
||||
Quat qnext = value(next);
|
||||
if ((qnext|value(curr)) < 0.0f) qnext = -qnext;
|
||||
qp = value(curr);
|
||||
qp = LnDif( qp,qnext );
|
||||
}
|
||||
|
||||
if (curr == 0 && !closed()) qm = qp;
|
||||
if (curr == last && !closed()) qp = qm;
|
||||
|
||||
key_type &k = key(curr);
|
||||
float c = (float)fabs(k.cont);
|
||||
|
||||
fp = fn = 1.0f;
|
||||
if ((curr > 0 && curr < last) || closed())
|
||||
{
|
||||
if (curr == 0) {
|
||||
// First key.
|
||||
float dts = (GetRangeEnd() - time(last)) + (time(0) - GetRangeStart());
|
||||
float dt = 2.0f / (dts + time(1) - time(0));
|
||||
fp = dt * dts;
|
||||
fn = dt * (time(1) - time(0));
|
||||
} else {
|
||||
if (curr == last) {
|
||||
// Last key.
|
||||
float dts = (GetRangeEnd() - time(last)) + (time(0) - GetRangeStart());
|
||||
float dt = 2.0f / (dts + time(last) - time(last-1));
|
||||
fp = dt * dts;
|
||||
fn = dt * (time(last) - time(last-1));
|
||||
} else {
|
||||
// Middle key.
|
||||
float dt = 2.0f/(time(curr+1) - time(curr-1));
|
||||
fp = dt * (time(curr) - time(curr-1));
|
||||
fn = dt * (time(curr+1) - time(curr));
|
||||
}
|
||||
}
|
||||
fp += c - c*fp;
|
||||
fn += c - c*fn;
|
||||
}
|
||||
|
||||
float tm,cm,cp,bm,bp,tmcm,tmcp,ksm,ksp,kdm,kdp;
|
||||
|
||||
cm = 1.0f - k.cont;
|
||||
tm = 0.5f*(1.0f - k.tens);
|
||||
cp = 2.0f - cm;
|
||||
bm = 1.0f - k.bias;
|
||||
bp = 2.0f - bm;
|
||||
tmcm = tm * cm;
|
||||
tmcp = tm * cp;
|
||||
ksm = 1.0f - tmcm * bp * fp;
|
||||
ksp = -tmcp * bm * fp;
|
||||
kdm = tmcp * bp * fn;
|
||||
kdp = tmcm * bm * fn - 1.0f;
|
||||
|
||||
Quat qa = 0.5f * AddQuat(kdm*qm,kdp*qp);
|
||||
Quat qb = 0.5f * AddQuat(ksm*qm,ksp*qp);
|
||||
qa = exp(qa);
|
||||
qb = exp(qb);
|
||||
|
||||
// ds = qb, dd = qa.
|
||||
k.ds = value(curr) * qb;
|
||||
k.dd = value(curr) * qa;
|
||||
}
|
||||
|
||||
#endif // __spline_h__
|
||||
8
CryMovie/StdAfx.cpp
Normal file
8
CryMovie/StdAfx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// CryMovie.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
41
CryMovie/StdAfx.h
Normal file
41
CryMovie/StdAfx.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__0B7BFEE0_95B3_4DD3_956A_33AD2ADB212D__INCLUDED_)
|
||||
#define AFX_STDAFX_H__0B7BFEE0_95B3_4DD3_956A_33AD2ADB212D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// THIS MUST BE AT THE VERY BEGINING OF STDAFX.H FILE.
|
||||
// Disable STL threading support, (makes STL faster)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define _NOTHREADS
|
||||
#define _STLP_NO_THREADS
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#if !defined(LINUX)
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#include "Cry_Math.h"
|
||||
#include <IXml.h>
|
||||
#include <IEntitySystem.h>
|
||||
#include <IMovieSystem.h>
|
||||
#include "smartptr.h"
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__0B7BFEE0_95B3_4DD3_956A_33AD2ADB212D__INCLUDED_)
|
||||
115
CryMovie/smartptr.h
Normal file
115
CryMovie/smartptr.h
Normal file
@@ -0,0 +1,115 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: smartptr.h
|
||||
// Version: v1.00
|
||||
// Created: 27/11/2001 by Timur.
|
||||
// Compilers: Visual C++ 6.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __smartptr_h__
|
||||
#define __smartptr_h__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Class TSmartPtr<T>.
|
||||
// Smart pointer warper class that implements reference counting on IUnknown
|
||||
// interface compatable class.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <class _T>
|
||||
class TSmartPtr {
|
||||
_T* p;
|
||||
public:
|
||||
TSmartPtr() : p(NULL) {}
|
||||
TSmartPtr( _T* p_ ) : p(p_) { if (p) (p)->AddRef(); }
|
||||
TSmartPtr( const TSmartPtr<_T>& p_ ) : p(p_.p) { if (p) (p)->AddRef(); } // Copy constructor.
|
||||
TSmartPtr( int Null ) : p(NULL) {}
|
||||
~TSmartPtr() { if (p) (p)->Release(); }
|
||||
|
||||
operator _T*() const { return p; }
|
||||
operator const _T*() const { return p; }
|
||||
_T& operator*() const { return *p; }
|
||||
_T* operator->(void) const { return p; }
|
||||
|
||||
TSmartPtr& operator=( _T* newp ) {
|
||||
if (newp)
|
||||
(newp)->AddRef();
|
||||
if (p)
|
||||
(p)->Release();
|
||||
p = newp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TSmartPtr& operator=( const TSmartPtr<_T> &newp ) {
|
||||
if (newp.p)
|
||||
(newp.p)->AddRef();
|
||||
if (p)
|
||||
(p)->Release();
|
||||
p = newp.p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_T* ptr() const { return p; };
|
||||
|
||||
//operator bool() { return p != NULL; };
|
||||
operator bool() const { return p != NULL; };
|
||||
//bool operator !() { return p == NULL; };
|
||||
bool operator !() const { return p == NULL; };
|
||||
|
||||
// Misc compare functions.
|
||||
bool operator == ( const _T* p2 ) const { return p == p2; };
|
||||
bool operator == ( _T* p2 ) const { return p == p2; };
|
||||
bool operator != ( const _T* p2 ) const { return p != p2; };
|
||||
bool operator != ( _T* p2 ) const { return p != p2; };
|
||||
bool operator < ( const _T* p2 ) const { return p < p2; };
|
||||
bool operator > ( const _T* p2 ) const { return p > p2; };
|
||||
|
||||
bool operator == ( const TSmartPtr<_T> &p2 ) const { return p == p2.p; };
|
||||
bool operator != ( const TSmartPtr<_T> &p2 ) const { return p != p2.p; };
|
||||
bool operator < ( const TSmartPtr<_T> &p2 ) const { return p < p2.p; };
|
||||
bool operator > ( const TSmartPtr<_T> &p2 ) const { return p > p2.p; };
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline bool operator == ( const TSmartPtr<T> &p1,int null ) {
|
||||
return !(bool)p1;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool operator != ( const TSmartPtr<T> &p1,int null ) {
|
||||
return (bool)p1;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool operator == ( int null,const TSmartPtr<T> &p1 ) {
|
||||
return !(bool)p1;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool operator != ( int null,const TSmartPtr<T> &p1 ) {
|
||||
return (bool)p1;
|
||||
}
|
||||
|
||||
/** Use this to define smart pointers of classes.
|
||||
For example:
|
||||
class CNode : public CRefCountBase {};
|
||||
SMARTPTR_TYPEDEF( CNode );
|
||||
{
|
||||
CNodePtr node; // Smart pointer.
|
||||
}
|
||||
*/
|
||||
|
||||
#define SMARTPTR_TYPEDEF(Class) typedef TSmartPtr<Class> Class##Ptr
|
||||
|
||||
#endif // __smartptr_h__
|
||||
86
CryMovie/xml/Expat/ascii.h
Normal file
86
CryMovie/xml/Expat/ascii.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#define ASCII_A 0x41
|
||||
#define ASCII_B 0x42
|
||||
#define ASCII_C 0x43
|
||||
#define ASCII_D 0x44
|
||||
#define ASCII_E 0x45
|
||||
#define ASCII_F 0x46
|
||||
#define ASCII_G 0x47
|
||||
#define ASCII_H 0x48
|
||||
#define ASCII_I 0x49
|
||||
#define ASCII_J 0x4A
|
||||
#define ASCII_K 0x4B
|
||||
#define ASCII_L 0x4C
|
||||
#define ASCII_M 0x4D
|
||||
#define ASCII_N 0x4E
|
||||
#define ASCII_O 0x4F
|
||||
#define ASCII_P 0x50
|
||||
#define ASCII_Q 0x51
|
||||
#define ASCII_R 0x52
|
||||
#define ASCII_S 0x53
|
||||
#define ASCII_T 0x54
|
||||
#define ASCII_U 0x55
|
||||
#define ASCII_V 0x56
|
||||
#define ASCII_W 0x57
|
||||
#define ASCII_X 0x58
|
||||
#define ASCII_Y 0x59
|
||||
#define ASCII_Z 0x5A
|
||||
|
||||
#define ASCII_a 0x61
|
||||
#define ASCII_b 0x62
|
||||
#define ASCII_c 0x63
|
||||
#define ASCII_d 0x64
|
||||
#define ASCII_e 0x65
|
||||
#define ASCII_f 0x66
|
||||
#define ASCII_g 0x67
|
||||
#define ASCII_h 0x68
|
||||
#define ASCII_i 0x69
|
||||
#define ASCII_j 0x6A
|
||||
#define ASCII_k 0x6B
|
||||
#define ASCII_l 0x6C
|
||||
#define ASCII_m 0x6D
|
||||
#define ASCII_n 0x6E
|
||||
#define ASCII_o 0x6F
|
||||
#define ASCII_p 0x70
|
||||
#define ASCII_q 0x71
|
||||
#define ASCII_r 0x72
|
||||
#define ASCII_s 0x73
|
||||
#define ASCII_t 0x74
|
||||
#define ASCII_u 0x75
|
||||
#define ASCII_v 0x76
|
||||
#define ASCII_w 0x77
|
||||
#define ASCII_x 0x78
|
||||
#define ASCII_y 0x79
|
||||
#define ASCII_z 0x7A
|
||||
|
||||
#define ASCII_0 0x30
|
||||
#define ASCII_1 0x31
|
||||
#define ASCII_2 0x32
|
||||
#define ASCII_3 0x33
|
||||
#define ASCII_4 0x34
|
||||
#define ASCII_5 0x35
|
||||
#define ASCII_6 0x36
|
||||
#define ASCII_7 0x37
|
||||
#define ASCII_8 0x38
|
||||
#define ASCII_9 0x39
|
||||
|
||||
#define ASCII_TAB 0x09
|
||||
#define ASCII_SPACE 0x20
|
||||
#define ASCII_EXCL 0x21
|
||||
#define ASCII_QUOT 0x22
|
||||
#define ASCII_AMP 0x26
|
||||
#define ASCII_APOS 0x27
|
||||
#define ASCII_MINUS 0x2D
|
||||
#define ASCII_PERIOD 0x2E
|
||||
#define ASCII_COLON 0x3A
|
||||
#define ASCII_SEMI 0x3B
|
||||
#define ASCII_LT 0x3C
|
||||
#define ASCII_EQUALS 0x3D
|
||||
#define ASCII_GT 0x3E
|
||||
#define ASCII_LSQB 0x5B
|
||||
#define ASCII_RSQB 0x5D
|
||||
#define ASCII_UNDERSCORE 0x5F
|
||||
37
CryMovie/xml/Expat/asciitab.h
Normal file
37
CryMovie/xml/Expat/asciitab.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
||||
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
|
||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
55
CryMovie/xml/Expat/config.h
Normal file
55
CryMovie/xml/Expat/config.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*================================================================
|
||||
|
||||
** Copyright 2000, Clark Cooper
|
||||
|
||||
** All rights reserved.
|
||||
|
||||
**
|
||||
|
||||
** This is free software. You are permitted to copy, distribute, or modify
|
||||
|
||||
** it under the terms of the MIT/X license (contained in the COPYING file
|
||||
|
||||
** with this distribution.)
|
||||
|
||||
**
|
||||
|
||||
**
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef WINCONFIG_H
|
||||
|
||||
#define WINCONFIG_H
|
||||
|
||||
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#define XMLPARSEAPI(type) type
|
||||
#define VERSION "1.95.2"
|
||||
|
||||
#define XML_NS 1
|
||||
|
||||
//#define XML_DTD 1
|
||||
|
||||
#define XML_BYTE_ORDER 12
|
||||
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
|
||||
|
||||
|
||||
#endif /* ndef WINCONFIG_H */
|
||||
735
CryMovie/xml/Expat/expat.h
Normal file
735
CryMovie/xml/Expat/expat.h
Normal file
@@ -0,0 +1,735 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlParse_INCLUDED
|
||||
#define XmlParse_INCLUDED 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef XMLPARSEAPI
|
||||
# ifdef _MSC_EXTENSIONS
|
||||
# define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl
|
||||
# else
|
||||
# define XMLPARSEAPI(type) type
|
||||
# endif
|
||||
#endif /* not defined XMLPARSEAPI */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void *XML_Parser;
|
||||
|
||||
/* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
|
||||
enum XML_Content_Type {
|
||||
XML_CTYPE_EMPTY = 1,
|
||||
XML_CTYPE_ANY,
|
||||
XML_CTYPE_MIXED,
|
||||
XML_CTYPE_NAME,
|
||||
XML_CTYPE_CHOICE,
|
||||
XML_CTYPE_SEQ
|
||||
};
|
||||
|
||||
enum XML_Content_Quant {
|
||||
XML_CQUANT_NONE,
|
||||
XML_CQUANT_OPT,
|
||||
XML_CQUANT_REP,
|
||||
XML_CQUANT_PLUS
|
||||
};
|
||||
|
||||
/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
|
||||
XML_CQUANT_NONE, and the other fields will be zero or NULL.
|
||||
If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
|
||||
numchildren will contain number of elements that may be mixed in
|
||||
and children point to an array of XML_Content cells that will be
|
||||
all of XML_CTYPE_NAME type with no quantification.
|
||||
|
||||
If type == XML_CTYPE_NAME, then the name points to the name, and
|
||||
the numchildren field will be zero and children will be NULL. The
|
||||
quant fields indicates any quantifiers placed on the name.
|
||||
|
||||
CHOICE and SEQ will have name NULL, the number of children in
|
||||
numchildren and children will point, recursively, to an array
|
||||
of XML_Content cells.
|
||||
|
||||
The EMPTY, ANY, and MIXED types will only occur at top level.
|
||||
*/
|
||||
|
||||
typedef struct XML_cp XML_Content;
|
||||
|
||||
struct XML_cp {
|
||||
enum XML_Content_Type type;
|
||||
enum XML_Content_Quant quant;
|
||||
XML_Char * name;
|
||||
unsigned int numchildren;
|
||||
XML_Content * children;
|
||||
};
|
||||
|
||||
|
||||
/* This is called for an element declaration. See above for
|
||||
description of the model argument. It's the caller's responsibility
|
||||
to free model when finished with it.
|
||||
*/
|
||||
|
||||
typedef void (*XML_ElementDeclHandler) (void *userData,
|
||||
const XML_Char *name,
|
||||
XML_Content *model);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetElementDeclHandler(XML_Parser parser,
|
||||
XML_ElementDeclHandler eldecl);
|
||||
|
||||
/*
|
||||
The Attlist declaration handler is called for *each* attribute. So
|
||||
a single Attlist declaration with multiple attributes declared will
|
||||
generate multiple calls to this handler. The "default" parameter
|
||||
may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword.
|
||||
The "isrequired" parameter will be true and the default value will
|
||||
be NULL in the case of "#REQUIRED". If "isrequired" is true and
|
||||
default is non-NULL, then this is a "#FIXED" default.
|
||||
*/
|
||||
|
||||
typedef void (*XML_AttlistDeclHandler) (void *userData,
|
||||
const XML_Char *elname,
|
||||
const XML_Char *attname,
|
||||
const XML_Char *att_type,
|
||||
const XML_Char *dflt,
|
||||
int isrequired);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetAttlistDeclHandler(XML_Parser parser,
|
||||
XML_AttlistDeclHandler attdecl);
|
||||
|
||||
|
||||
/* The XML declaration handler is called for *both* XML declarations and
|
||||
text declarations. The way to distinguish is that the version parameter
|
||||
will be null for text declarations. The encoding parameter may be null
|
||||
for XML declarations. The standalone parameter will be -1, 0, or 1
|
||||
indicating respectively that there was no standalone parameter in
|
||||
the declaration, that it was given as no, or that it was given as yes.
|
||||
*/
|
||||
|
||||
typedef void (*XML_XmlDeclHandler) (void *userData,
|
||||
const XML_Char *version,
|
||||
const XML_Char *encoding,
|
||||
int standalone);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetXmlDeclHandler(XML_Parser parser,
|
||||
XML_XmlDeclHandler xmldecl);
|
||||
|
||||
|
||||
typedef struct {
|
||||
void *(*malloc_fcn)(size_t size);
|
||||
void *(*realloc_fcn)(void *ptr, size_t size);
|
||||
void (*free_fcn)(void *ptr);
|
||||
} XML_Memory_Handling_Suite;
|
||||
|
||||
/* Constructs a new parser; encoding is the encoding specified by the
|
||||
external protocol or null if there is none specified. */
|
||||
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreate(const XML_Char *encoding);
|
||||
|
||||
/* Constructs a new parser and namespace processor. Element type
|
||||
names and attribute names that belong to a namespace will be expanded;
|
||||
unprefixed attribute names are never expanded; unprefixed element type
|
||||
names are expanded only if there is a default namespace. The expanded
|
||||
name is the concatenation of the namespace URI, the namespace
|
||||
separator character, and the local part of the name. If the namespace
|
||||
separator is '\0' then the namespace URI and the local part will be
|
||||
concatenated without any separator. When a namespace is not declared,
|
||||
the name and prefix will be passed through without expansion. */
|
||||
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
|
||||
|
||||
|
||||
/* Constructs a new parser using the memory management suit referred to
|
||||
by memsuite. If memsuite is NULL, then use the standard library memory
|
||||
suite. If namespaceSeparator is non-NULL it creates a parser with
|
||||
namespace processing as described above. The character pointed at
|
||||
will serve as the namespace separator.
|
||||
|
||||
All further memory operations used for the created parser will come from
|
||||
the given suite.
|
||||
*/
|
||||
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ParserCreate_MM(const XML_Char *encoding,
|
||||
const XML_Memory_Handling_Suite *memsuite,
|
||||
const XML_Char *namespaceSeparator);
|
||||
|
||||
/* atts is array of name/value pairs, terminated by 0;
|
||||
names and values are 0 terminated. */
|
||||
|
||||
typedef void (*XML_StartElementHandler)(void *userData,
|
||||
const XML_Char *name,
|
||||
const XML_Char **atts);
|
||||
|
||||
typedef void (*XML_EndElementHandler)(void *userData,
|
||||
const XML_Char *name);
|
||||
|
||||
|
||||
/* s is not 0 terminated. */
|
||||
typedef void (*XML_CharacterDataHandler)(void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
|
||||
/* target and data are 0 terminated */
|
||||
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
|
||||
const XML_Char *target,
|
||||
const XML_Char *data);
|
||||
|
||||
/* data is 0 terminated */
|
||||
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
|
||||
|
||||
typedef void (*XML_StartCdataSectionHandler)(void *userData);
|
||||
typedef void (*XML_EndCdataSectionHandler)(void *userData);
|
||||
|
||||
/* This is called for any characters in the XML document for
|
||||
which there is no applicable handler. This includes both
|
||||
characters that are part of markup which is of a kind that is
|
||||
not reported (comments, markup declarations), or characters
|
||||
that are part of a construct which could be reported but
|
||||
for which no handler has been supplied. The characters are passed
|
||||
exactly as they were in the XML document except that
|
||||
they will be encoded in UTF-8. Line boundaries are not normalized.
|
||||
Note that a byte order mark character is not passed to the default handler.
|
||||
There are no guarantees about how characters are divided between calls
|
||||
to the default handler: for example, a comment might be split between
|
||||
multiple calls. */
|
||||
|
||||
typedef void (*XML_DefaultHandler)(void *userData,
|
||||
const XML_Char *s,
|
||||
int len);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration, before
|
||||
any DTD or internal subset is parsed. */
|
||||
|
||||
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
|
||||
const XML_Char *doctypeName,
|
||||
const XML_Char *sysid,
|
||||
const XML_Char *pubid,
|
||||
int has_internal_subset);
|
||||
|
||||
/* This is called for the start of the DOCTYPE declaration when the
|
||||
closing > is encountered, but after processing any external subset. */
|
||||
typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
|
||||
|
||||
/* This is called for entity declarations. The is_parameter_entity
|
||||
argument will be non-zero if the entity is a parameter entity, zero
|
||||
otherwise.
|
||||
|
||||
For internal entities (<!ENTITY foo "bar">), value will
|
||||
be non-null and systemId, publicID, and notationName will be null.
|
||||
The value string is NOT null terminated; the length is provided in
|
||||
the value_length argument. Since it is legal to have zero-length
|
||||
values, do not use this argument to test for internal entities.
|
||||
|
||||
For external entities, value will be null and systemId will be non-null.
|
||||
The publicId argument will be null unless a public identifier was
|
||||
provided. The notationName argument will have a non-null value only
|
||||
for unparsed entity declarations.
|
||||
*/
|
||||
|
||||
typedef void (*XML_EntityDeclHandler) (void *userData,
|
||||
const XML_Char *entityName,
|
||||
int is_parameter_entity,
|
||||
const XML_Char *value,
|
||||
int value_length,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEntityDeclHandler(XML_Parser parser,
|
||||
XML_EntityDeclHandler handler);
|
||||
|
||||
/* OBSOLETE -- OBSOLETE -- OBSOLETE
|
||||
This handler has been superceded by the EntityDeclHandler above.
|
||||
It is provided here for backward compatibility.
|
||||
This is called for a declaration of an unparsed (NDATA)
|
||||
entity. The base argument is whatever was set by XML_SetBase.
|
||||
The entityName, systemId and notationName arguments will never be null.
|
||||
The other arguments may be. */
|
||||
|
||||
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
|
||||
const XML_Char *entityName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
const XML_Char *notationName);
|
||||
|
||||
/* This is called for a declaration of notation.
|
||||
The base argument is whatever was set by XML_SetBase.
|
||||
The notationName will never be null. The other arguments can be. */
|
||||
|
||||
typedef void (*XML_NotationDeclHandler)(void *userData,
|
||||
const XML_Char *notationName,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
/* When namespace processing is enabled, these are called once for
|
||||
each namespace declaration. The call to the start and end element
|
||||
handlers occur between the calls to the start and end namespace
|
||||
declaration handlers. For an xmlns attribute, prefix will be null.
|
||||
For an xmlns="" attribute, uri will be null. */
|
||||
|
||||
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix,
|
||||
const XML_Char *uri);
|
||||
|
||||
typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
|
||||
const XML_Char *prefix);
|
||||
|
||||
/* This is called if the document is not standalone (it has an
|
||||
external subset or a reference to a parameter entity, but does not
|
||||
have standalone="yes"). If this handler returns 0, then processing
|
||||
will not continue, and the parser will return a
|
||||
XML_ERROR_NOT_STANDALONE error. */
|
||||
|
||||
typedef int (*XML_NotStandaloneHandler)(void *userData);
|
||||
|
||||
/* This is called for a reference to an external parsed general entity.
|
||||
The referenced entity is not automatically parsed.
|
||||
The application can parse it immediately or later using
|
||||
XML_ExternalEntityParserCreate.
|
||||
The parser argument is the parser parsing the entity containing the reference;
|
||||
it can be passed as the parser argument to XML_ExternalEntityParserCreate.
|
||||
The systemId argument is the system identifier as specified in the entity
|
||||
declaration; it will not be null.
|
||||
The base argument is the system identifier that should be used as the base for
|
||||
resolving systemId if systemId was relative; this is set by XML_SetBase;
|
||||
it may be null.
|
||||
The publicId argument is the public identifier as specified in the entity
|
||||
declaration, or null if none was specified; the whitespace in the public
|
||||
identifier will have been normalized as required by the XML spec.
|
||||
The context argument specifies the parsing context in the format
|
||||
expected by the context argument to
|
||||
XML_ExternalEntityParserCreate; context is valid only until the handler
|
||||
returns, so if the referenced entity is to be parsed later, it must be copied.
|
||||
The handler should return 0 if processing should not continue because of
|
||||
a fatal error in the handling of the external entity.
|
||||
In this case the calling parser will return an
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING error.
|
||||
Note that unlike other handlers the first argument is the parser, not
|
||||
userData. */
|
||||
|
||||
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *base,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId);
|
||||
|
||||
/* This structure is filled in by the XML_UnknownEncodingHandler
|
||||
to provide information to the parser about encodings that are unknown
|
||||
to the parser.
|
||||
The map[b] member gives information about byte sequences
|
||||
whose first byte is b.
|
||||
If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar
|
||||
value c.
|
||||
If map[b] is -1, then the byte sequence is malformed.
|
||||
If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
|
||||
sequence that encodes a single Unicode scalar value.
|
||||
The data member will be passed as the first argument to the convert function.
|
||||
The convert function is used to convert multibyte sequences;
|
||||
s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
|
||||
The convert function must return the Unicode scalar value
|
||||
represented by this byte sequence or -1 if the byte sequence is malformed.
|
||||
The convert function may be null if the encoding is a single-byte encoding,
|
||||
that is if map[b] >= -1 for all bytes b.
|
||||
When the parser is finished with the encoding, then if release is not null,
|
||||
it will call release passing it the data member;
|
||||
once release has been called, the convert function will not be called again.
|
||||
|
||||
Expat places certain restrictions on the encodings that are supported
|
||||
using this mechanism.
|
||||
|
||||
1. Every ASCII character that can appear in a well-formed XML document,
|
||||
other than the characters
|
||||
|
||||
$@\^`{}~
|
||||
|
||||
must be represented by a single byte, and that byte must be the
|
||||
same byte that represents that character in ASCII.
|
||||
|
||||
2. No character may require more than 4 bytes to encode.
|
||||
|
||||
3. All characters encoded must have Unicode scalar values <= 0xFFFF, (i.e.,
|
||||
characters that would be encoded by surrogates in UTF-16 are not
|
||||
allowed). Note that this restriction doesn't apply to the built-in
|
||||
support for UTF-8 and UTF-16.
|
||||
|
||||
4. No Unicode character may be encoded by more than one distinct sequence
|
||||
of bytes. */
|
||||
|
||||
typedef struct {
|
||||
int map[256];
|
||||
void *data;
|
||||
int (*convert)(void *data, const char *s);
|
||||
void (*release)(void *data);
|
||||
} XML_Encoding;
|
||||
|
||||
/* This is called for an encoding that is unknown to the parser.
|
||||
The encodingHandlerData argument is that which was passed as the
|
||||
second argument to XML_SetUnknownEncodingHandler.
|
||||
The name argument gives the name of the encoding as specified in
|
||||
the encoding declaration.
|
||||
If the callback can provide information about the encoding,
|
||||
it must fill in the XML_Encoding structure, and return 1.
|
||||
Otherwise it must return 0.
|
||||
If info does not describe a suitable encoding,
|
||||
then the parser will return an XML_UNKNOWN_ENCODING error. */
|
||||
|
||||
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
|
||||
const XML_Char *name,
|
||||
XML_Encoding *info);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetElementHandler(XML_Parser parser,
|
||||
XML_StartElementHandler start,
|
||||
XML_EndElementHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCharacterDataHandler(XML_Parser parser,
|
||||
XML_CharacterDataHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetProcessingInstructionHandler(XML_Parser parser,
|
||||
XML_ProcessingInstructionHandler handler);
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCommentHandler(XML_Parser parser,
|
||||
XML_CommentHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start,
|
||||
XML_EndCdataSectionHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartCdataSectionHandler(XML_Parser parser,
|
||||
XML_StartCdataSectionHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndCdataSectionHandler(XML_Parser parser,
|
||||
XML_EndCdataSectionHandler end);
|
||||
|
||||
/* This sets the default handler and also inhibits expansion of
|
||||
internal entities. The entity reference will be passed to the default
|
||||
handler. */
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDefaultHandler(XML_Parser parser,
|
||||
XML_DefaultHandler handler);
|
||||
|
||||
/* This sets the default handler but does not inhibit expansion of
|
||||
internal entities. The entity reference will not be passed to the
|
||||
default handler. */
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDefaultHandlerExpand(XML_Parser parser,
|
||||
XML_DefaultHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_StartDoctypeDeclHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndDoctypeDeclHandler(XML_Parser parser,
|
||||
XML_EndDoctypeDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
|
||||
XML_UnparsedEntityDeclHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNotationDeclHandler(XML_Parser parser,
|
||||
XML_NotationDeclHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetStartNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_StartNamespaceDeclHandler start);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetEndNamespaceDeclHandler(XML_Parser parser,
|
||||
XML_EndNamespaceDeclHandler end);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetNotStandaloneHandler(XML_Parser parser,
|
||||
XML_NotStandaloneHandler handler);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetExternalEntityRefHandler(XML_Parser parser,
|
||||
XML_ExternalEntityRefHandler handler);
|
||||
|
||||
/* If a non-null value for arg is specified here, then it will be passed
|
||||
as the first argument to the external entity ref handler instead
|
||||
of the parser object. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUnknownEncodingHandler(XML_Parser parser,
|
||||
XML_UnknownEncodingHandler handler,
|
||||
void *encodingHandlerData);
|
||||
|
||||
/* This can be called within a handler for a start element, end element,
|
||||
processing instruction or character data. It causes the corresponding
|
||||
markup to be passed to the default handler. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_DefaultCurrent(XML_Parser parser);
|
||||
|
||||
/* If do_nst is non-zero, and namespace processing is in effect, and
|
||||
a name has a prefix (i.e. an explicit namespace qualifier) then
|
||||
that name is returned as a triplet in a single
|
||||
string separated by the separator character specified when the parser
|
||||
was created: URI + sep + local_name + sep + prefix.
|
||||
|
||||
If do_nst is zero, then namespace information is returned in the
|
||||
default manner (URI + sep + local_name) whether or not the names
|
||||
has a prefix.
|
||||
*/
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
|
||||
|
||||
/* This value is passed as the userData argument to callbacks. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_SetUserData(XML_Parser parser, void *userData);
|
||||
|
||||
/* Returns the last value set by XML_SetUserData or null. */
|
||||
#define XML_GetUserData(parser) (*(void **)(parser))
|
||||
|
||||
/* This is equivalent to supplying an encoding argument
|
||||
to XML_ParserCreate. It must not be called after XML_Parse
|
||||
or XML_ParseBuffer. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
|
||||
|
||||
/* If this function is called, then the parser will be passed
|
||||
as the first argument to callbacks instead of userData.
|
||||
The userData will still be accessible using XML_GetUserData. */
|
||||
|
||||
XMLPARSEAPI(void)
|
||||
XML_UseParserAsHandlerArg(XML_Parser parser);
|
||||
|
||||
/* Sets the base to be used for resolving relative URIs in system
|
||||
identifiers in declarations. Resolving relative identifiers is left
|
||||
to the application: this value will be passed through as the base
|
||||
argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler
|
||||
and XML_UnparsedEntityDeclHandler. The base argument will be copied.
|
||||
Returns zero if out of memory, non-zero otherwise. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetBase(XML_Parser parser, const XML_Char *base);
|
||||
|
||||
XMLPARSEAPI(const XML_Char *)
|
||||
XML_GetBase(XML_Parser parser);
|
||||
|
||||
/* Returns the number of the attribute/value pairs passed in last call
|
||||
to the XML_StartElementHandler that were specified in the start-tag
|
||||
rather than defaulted. Each attribute/value pair counts as 2; thus
|
||||
this correspondds to an index into the atts array passed to the
|
||||
XML_StartElementHandler. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetSpecifiedAttributeCount(XML_Parser parser);
|
||||
|
||||
/* Returns the index of the ID attribute passed in the last call to
|
||||
XML_StartElementHandler, or -1 if there is no ID attribute. Each
|
||||
attribute/value pair counts as 2; thus this correspondds to an index
|
||||
into the atts array passed to the XML_StartElementHandler. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetIdAttributeIndex(XML_Parser parser);
|
||||
|
||||
/* Parses some input. Returns 0 if a fatal error is detected.
|
||||
The last call to XML_Parse must have isFinal true;
|
||||
len may be zero for this call (or any other). */
|
||||
XMLPARSEAPI(int)
|
||||
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
|
||||
|
||||
XMLPARSEAPI(void *)
|
||||
XML_GetBuffer(XML_Parser parser, int len);
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
|
||||
|
||||
/* Creates an XML_Parser object that can parse an external general
|
||||
entity; context is a '\0'-terminated string specifying the parse
|
||||
context; encoding is a '\0'-terminated string giving the name of the
|
||||
externally specified encoding, or null if there is no externally
|
||||
specified encoding. The context string consists of a sequence of
|
||||
tokens separated by formfeeds (\f); a token consisting of a name
|
||||
specifies that the general entity of the name is open; a token of the
|
||||
form prefix=uri specifies the namespace for a particular prefix; a
|
||||
token of the form =uri specifies the default namespace. This can be
|
||||
called at any point after the first call to an
|
||||
ExternalEntityRefHandler so longer as the parser has not yet been
|
||||
freed. The new parser is completely independent and may safely be
|
||||
used in a separate thread. The handlers and userData are initialized
|
||||
from the parser argument. Returns 0 if out of memory. Otherwise
|
||||
returns a new XML_Parser object. */
|
||||
XMLPARSEAPI(XML_Parser)
|
||||
XML_ExternalEntityParserCreate(XML_Parser parser,
|
||||
const XML_Char *context,
|
||||
const XML_Char *encoding);
|
||||
|
||||
enum XML_ParamEntityParsing {
|
||||
XML_PARAM_ENTITY_PARSING_NEVER,
|
||||
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS
|
||||
};
|
||||
|
||||
/* Controls parsing of parameter entities (including the external DTD
|
||||
subset). If parsing of parameter entities is enabled, then references
|
||||
to external parameter entities (including the external DTD subset)
|
||||
will be passed to the handler set with
|
||||
XML_SetExternalEntityRefHandler. The context passed will be 0.
|
||||
Unlike external general entities, external parameter entities can only
|
||||
be parsed synchronously. If the external parameter entity is to be
|
||||
parsed, it must be parsed during the call to the external entity ref
|
||||
handler: the complete sequence of XML_ExternalEntityParserCreate,
|
||||
XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
|
||||
this call. After XML_ExternalEntityParserCreate has been called to
|
||||
create the parser for the external parameter entity (context must be 0
|
||||
for this call), it is illegal to make any calls on the old parser
|
||||
until XML_ParserFree has been called on the newly created parser. If
|
||||
the library has been compiled without support for parameter entity
|
||||
parsing (ie without XML_DTD being defined), then
|
||||
XML_SetParamEntityParsing will return 0 if parsing of parameter
|
||||
entities is requested; otherwise it will return non-zero. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_SetParamEntityParsing(XML_Parser parser,
|
||||
enum XML_ParamEntityParsing parsing);
|
||||
|
||||
enum XML_Error {
|
||||
XML_ERROR_NONE,
|
||||
XML_ERROR_NO_MEMORY,
|
||||
XML_ERROR_SYNTAX,
|
||||
XML_ERROR_NO_ELEMENTS,
|
||||
XML_ERROR_INVALID_TOKEN,
|
||||
XML_ERROR_UNCLOSED_TOKEN,
|
||||
XML_ERROR_PARTIAL_CHAR,
|
||||
XML_ERROR_TAG_MISMATCH,
|
||||
XML_ERROR_DUPLICATE_ATTRIBUTE,
|
||||
XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
|
||||
XML_ERROR_PARAM_ENTITY_REF,
|
||||
XML_ERROR_UNDEFINED_ENTITY,
|
||||
XML_ERROR_RECURSIVE_ENTITY_REF,
|
||||
XML_ERROR_ASYNC_ENTITY,
|
||||
XML_ERROR_BAD_CHAR_REF,
|
||||
XML_ERROR_BINARY_ENTITY_REF,
|
||||
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
|
||||
XML_ERROR_MISPLACED_XML_PI,
|
||||
XML_ERROR_UNKNOWN_ENCODING,
|
||||
XML_ERROR_INCORRECT_ENCODING,
|
||||
XML_ERROR_UNCLOSED_CDATA_SECTION,
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING,
|
||||
XML_ERROR_NOT_STANDALONE,
|
||||
XML_ERROR_UNEXPECTED_STATE
|
||||
};
|
||||
|
||||
/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
|
||||
returns information about the error. */
|
||||
|
||||
XMLPARSEAPI(enum XML_Error)
|
||||
XML_GetErrorCode(XML_Parser parser);
|
||||
|
||||
/* These functions return information about the current parse location.
|
||||
They may be called when XML_Parse or XML_ParseBuffer return 0;
|
||||
in this case the location is the location of the character at which
|
||||
the error was detected.
|
||||
They may also be called from any other callback called to report
|
||||
some parse event; in this the location is the location of the first
|
||||
of the sequence of characters that generated the event. */
|
||||
|
||||
XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
|
||||
XMLPARSEAPI(int) XML_GetCurrentByteIndex(XML_Parser parser);
|
||||
|
||||
/* Return the number of bytes in the current event.
|
||||
Returns 0 if the event is in an internal entity. */
|
||||
|
||||
XMLPARSEAPI(int)
|
||||
XML_GetCurrentByteCount(XML_Parser parser);
|
||||
|
||||
/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
|
||||
the integer pointed to by offset to the offset within this buffer
|
||||
of the current parse position, and sets the integer pointed to by size
|
||||
to the size of this buffer (the number of input bytes). Otherwise
|
||||
returns a null pointer. Also returns a null pointer if a parse isn't
|
||||
active.
|
||||
|
||||
NOTE: The character pointer returned should not be used outside
|
||||
the handler that makes the call. */
|
||||
|
||||
XMLPARSEAPI(const char *)
|
||||
XML_GetInputContext(XML_Parser parser,
|
||||
int *offset,
|
||||
int *size);
|
||||
|
||||
/* For backwards compatibility with previous versions. */
|
||||
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
|
||||
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
|
||||
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
|
||||
|
||||
/* Frees memory used by the parser. */
|
||||
XMLPARSEAPI(void)
|
||||
XML_ParserFree(XML_Parser parser);
|
||||
|
||||
/* Returns a string describing the error. */
|
||||
XMLPARSEAPI(const XML_LChar *)
|
||||
XML_ErrorString(int code);
|
||||
|
||||
/* Return a string containing the version number of this expat */
|
||||
XMLPARSEAPI(const XML_LChar *)
|
||||
XML_ExpatVersion(void);
|
||||
|
||||
typedef struct {
|
||||
int major;
|
||||
int minor;
|
||||
int micro;
|
||||
} XML_Expat_Version;
|
||||
|
||||
/* Return an XML_Expat_Version structure containing numeric version
|
||||
number information for this version of expat */
|
||||
|
||||
XMLPARSEAPI(XML_Expat_Version)
|
||||
XML_ExpatVersionInfo(void);
|
||||
|
||||
#define XML_MAJOR_VERSION 1
|
||||
#define XML_MINOR_VERSION 95
|
||||
#define XML_MICRO_VERSION 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XmlParse_INCLUDED */
|
||||
38
CryMovie/xml/Expat/iasciitab.h
Normal file
38
CryMovie/xml/Expat/iasciitab.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
|
||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
||||
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
|
||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
37
CryMovie/xml/Expat/latin1tab.h
Normal file
37
CryMovie/xml/Expat/latin1tab.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
||||
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
|
||||
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
||||
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
||||
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
||||
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
||||
150
CryMovie/xml/Expat/nametab.h
Normal file
150
CryMovie/xml/Expat/nametab.h
Normal file
@@ -0,0 +1,150 @@
|
||||
static const unsigned namingBitmap[] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
|
||||
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
|
||||
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
|
||||
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
|
||||
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
|
||||
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
|
||||
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
|
||||
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
|
||||
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
|
||||
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
|
||||
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
|
||||
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
|
||||
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
|
||||
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
|
||||
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
|
||||
0x00000007, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
|
||||
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
|
||||
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
|
||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
|
||||
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
||||
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
||||
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
|
||||
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
|
||||
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
|
||||
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
|
||||
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
|
||||
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
|
||||
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
|
||||
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
|
||||
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
|
||||
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
|
||||
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
|
||||
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
|
||||
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
|
||||
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
|
||||
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
|
||||
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
|
||||
};
|
||||
static const unsigned char nmstrtPages[] = {
|
||||
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
|
||||
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
static const unsigned char namePages[] = {
|
||||
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
|
||||
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
||||
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
38
CryMovie/xml/Expat/utf8tab.h
Normal file
38
CryMovie/xml/Expat/utf8tab.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
|
||||
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
||||
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
||||
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
||||
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
|
||||
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
||||
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
|
||||
54
CryMovie/xml/Expat/winconfig.h
Normal file
54
CryMovie/xml/Expat/winconfig.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*================================================================
|
||||
|
||||
** Copyright 2000, Clark Cooper
|
||||
|
||||
** All rights reserved.
|
||||
|
||||
**
|
||||
|
||||
** This is free software. You are permitted to copy, distribute, or modify
|
||||
|
||||
** it under the terms of the MIT/X license (contained in the COPYING file
|
||||
|
||||
** with this distribution.)
|
||||
|
||||
**
|
||||
|
||||
**
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef WINCONFIG_H
|
||||
|
||||
#define WINCONFIG_H
|
||||
|
||||
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
#define XML_NS 1
|
||||
|
||||
#define XML_DTD 1
|
||||
|
||||
#define XML_BYTE_ORDER 12
|
||||
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
|
||||
|
||||
|
||||
#endif /* ndef WINCONFIG_H */
|
||||
|
||||
4635
CryMovie/xml/Expat/xmlparse.c
Normal file
4635
CryMovie/xml/Expat/xmlparse.c
Normal file
File diff suppressed because it is too large
Load Diff
1275
CryMovie/xml/Expat/xmlrole.c
Normal file
1275
CryMovie/xml/Expat/xmlrole.c
Normal file
File diff suppressed because it is too large
Load Diff
100
CryMovie/xml/Expat/xmlrole.h
Normal file
100
CryMovie/xml/Expat/xmlrole.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlRole_INCLUDED
|
||||
#define XmlRole_INCLUDED 1
|
||||
|
||||
#include "xmltok.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
XML_ROLE_ERROR = -1,
|
||||
XML_ROLE_NONE = 0,
|
||||
XML_ROLE_XML_DECL,
|
||||
XML_ROLE_INSTANCE_START,
|
||||
XML_ROLE_DOCTYPE_NAME,
|
||||
XML_ROLE_DOCTYPE_SYSTEM_ID,
|
||||
XML_ROLE_DOCTYPE_PUBLIC_ID,
|
||||
XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
|
||||
XML_ROLE_DOCTYPE_CLOSE,
|
||||
XML_ROLE_GENERAL_ENTITY_NAME,
|
||||
XML_ROLE_PARAM_ENTITY_NAME,
|
||||
XML_ROLE_ENTITY_VALUE,
|
||||
XML_ROLE_ENTITY_SYSTEM_ID,
|
||||
XML_ROLE_ENTITY_PUBLIC_ID,
|
||||
XML_ROLE_ENTITY_COMPLETE,
|
||||
XML_ROLE_ENTITY_NOTATION_NAME,
|
||||
XML_ROLE_NOTATION_NAME,
|
||||
XML_ROLE_NOTATION_SYSTEM_ID,
|
||||
XML_ROLE_NOTATION_NO_SYSTEM_ID,
|
||||
XML_ROLE_NOTATION_PUBLIC_ID,
|
||||
XML_ROLE_ATTRIBUTE_NAME,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_ID,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
|
||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
|
||||
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
|
||||
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
|
||||
XML_ROLE_ATTLIST_ELEMENT_NAME,
|
||||
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
|
||||
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
|
||||
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
|
||||
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
|
||||
XML_ROLE_ELEMENT_NAME,
|
||||
XML_ROLE_CONTENT_ANY,
|
||||
XML_ROLE_CONTENT_EMPTY,
|
||||
XML_ROLE_CONTENT_PCDATA,
|
||||
XML_ROLE_GROUP_OPEN,
|
||||
XML_ROLE_GROUP_CLOSE,
|
||||
XML_ROLE_GROUP_CLOSE_REP,
|
||||
XML_ROLE_GROUP_CLOSE_OPT,
|
||||
XML_ROLE_GROUP_CLOSE_PLUS,
|
||||
XML_ROLE_GROUP_CHOICE,
|
||||
XML_ROLE_GROUP_SEQUENCE,
|
||||
XML_ROLE_CONTENT_ELEMENT,
|
||||
XML_ROLE_CONTENT_ELEMENT_REP,
|
||||
XML_ROLE_CONTENT_ELEMENT_OPT,
|
||||
XML_ROLE_CONTENT_ELEMENT_PLUS,
|
||||
#ifdef XML_DTD
|
||||
XML_ROLE_TEXT_DECL,
|
||||
XML_ROLE_IGNORE_SECT,
|
||||
XML_ROLE_INNER_PARAM_ENTITY_REF,
|
||||
#endif /* XML_DTD */
|
||||
XML_ROLE_PARAM_ENTITY_REF
|
||||
};
|
||||
|
||||
typedef struct prolog_state {
|
||||
int (*handler)(struct prolog_state *state,
|
||||
int tok,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const ENCODING *enc);
|
||||
unsigned level;
|
||||
#ifdef XML_DTD
|
||||
unsigned includeLevel;
|
||||
int documentEntity;
|
||||
#endif /* XML_DTD */
|
||||
} PROLOG_STATE;
|
||||
|
||||
void XmlPrologStateInit(PROLOG_STATE *);
|
||||
#ifdef XML_DTD
|
||||
void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#define XmlTokenRole(state, tok, ptr, end, enc) \
|
||||
(((state)->handler)(state, tok, ptr, end, enc))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XmlRole_INCLUDED */
|
||||
1566
CryMovie/xml/Expat/xmltok.c
Normal file
1566
CryMovie/xml/Expat/xmltok.c
Normal file
File diff suppressed because it is too large
Load Diff
299
CryMovie/xml/Expat/xmltok.h
Normal file
299
CryMovie/xml/Expat/xmltok.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef XmlTok_INCLUDED
|
||||
#define XmlTok_INCLUDED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The following token may be returned by XmlContentTok */
|
||||
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
|
||||
illegal ]]> sequence */
|
||||
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
|
||||
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
|
||||
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
|
||||
might be part of CRLF sequence */
|
||||
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
|
||||
#define XML_TOK_PARTIAL -1 /* only part of a token */
|
||||
#define XML_TOK_INVALID 0
|
||||
|
||||
/* The following tokens are returned by XmlContentTok; some are also
|
||||
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
|
||||
|
||||
#define XML_TOK_START_TAG_WITH_ATTS 1
|
||||
#define XML_TOK_START_TAG_NO_ATTS 2
|
||||
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
|
||||
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
|
||||
#define XML_TOK_END_TAG 5
|
||||
#define XML_TOK_DATA_CHARS 6
|
||||
#define XML_TOK_DATA_NEWLINE 7
|
||||
#define XML_TOK_CDATA_SECT_OPEN 8
|
||||
#define XML_TOK_ENTITY_REF 9
|
||||
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
|
||||
|
||||
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
|
||||
#define XML_TOK_PI 11 /* processing instruction */
|
||||
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
|
||||
#define XML_TOK_COMMENT 13
|
||||
#define XML_TOK_BOM 14 /* Byte order mark */
|
||||
|
||||
/* The following tokens are returned only by XmlPrologTok */
|
||||
#define XML_TOK_PROLOG_S 15
|
||||
#define XML_TOK_DECL_OPEN 16 /* <!foo */
|
||||
#define XML_TOK_DECL_CLOSE 17 /* > */
|
||||
#define XML_TOK_NAME 18
|
||||
#define XML_TOK_NMTOKEN 19
|
||||
#define XML_TOK_POUND_NAME 20 /* #name */
|
||||
#define XML_TOK_OR 21 /* | */
|
||||
#define XML_TOK_PERCENT 22
|
||||
#define XML_TOK_OPEN_PAREN 23
|
||||
#define XML_TOK_CLOSE_PAREN 24
|
||||
#define XML_TOK_OPEN_BRACKET 25
|
||||
#define XML_TOK_CLOSE_BRACKET 26
|
||||
#define XML_TOK_LITERAL 27
|
||||
#define XML_TOK_PARAM_ENTITY_REF 28
|
||||
#define XML_TOK_INSTANCE_START 29
|
||||
|
||||
/* The following occur only in element type declarations */
|
||||
#define XML_TOK_NAME_QUESTION 30 /* name? */
|
||||
#define XML_TOK_NAME_ASTERISK 31 /* name* */
|
||||
#define XML_TOK_NAME_PLUS 32 /* name+ */
|
||||
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
|
||||
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
|
||||
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
|
||||
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
|
||||
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
|
||||
#define XML_TOK_COMMA 38
|
||||
|
||||
/* The following token is returned only by XmlAttributeValueTok */
|
||||
#define XML_TOK_ATTRIBUTE_VALUE_S 39
|
||||
|
||||
/* The following token is returned only by XmlCdataSectionTok */
|
||||
#define XML_TOK_CDATA_SECT_CLOSE 40
|
||||
|
||||
/* With namespace processing this is returned by XmlPrologTok
|
||||
for a name with a colon. */
|
||||
#define XML_TOK_PREFIXED_NAME 41
|
||||
|
||||
#ifdef XML_DTD
|
||||
#define XML_TOK_IGNORE_SECT 42
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#ifdef XML_DTD
|
||||
#define XML_N_STATES 4
|
||||
#else /* not XML_DTD */
|
||||
#define XML_N_STATES 3
|
||||
#endif /* not XML_DTD */
|
||||
|
||||
#define XML_PROLOG_STATE 0
|
||||
#define XML_CONTENT_STATE 1
|
||||
#define XML_CDATA_SECTION_STATE 2
|
||||
#ifdef XML_DTD
|
||||
#define XML_IGNORE_SECTION_STATE 3
|
||||
#endif /* XML_DTD */
|
||||
|
||||
#define XML_N_LITERAL_TYPES 2
|
||||
#define XML_ATTRIBUTE_VALUE_LITERAL 0
|
||||
#define XML_ENTITY_VALUE_LITERAL 1
|
||||
|
||||
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
|
||||
#define XML_UTF8_ENCODE_MAX 4
|
||||
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
|
||||
#define XML_UTF16_ENCODE_MAX 2
|
||||
|
||||
typedef struct position {
|
||||
/* first line and first column are 0 not 1 */
|
||||
unsigned int lineNumber;
|
||||
unsigned int columnNumber;
|
||||
} POSITION;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *valuePtr;
|
||||
const char *valueEnd;
|
||||
char normalized;
|
||||
} ATTRIBUTE;
|
||||
|
||||
struct encoding;
|
||||
typedef struct encoding ENCODING;
|
||||
|
||||
struct encoding {
|
||||
int (*scanners[XML_N_STATES])(const ENCODING *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char **);
|
||||
int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char **);
|
||||
int (*sameName)(const ENCODING *,
|
||||
const char *, const char *);
|
||||
int (*nameMatchesAscii)(const ENCODING *,
|
||||
const char *, const char *, const char *);
|
||||
int (*nameLength)(const ENCODING *, const char *);
|
||||
const char *(*skipS)(const ENCODING *, const char *);
|
||||
int (*getAtts)(const ENCODING *enc, const char *ptr,
|
||||
int attsMax, ATTRIBUTE *atts);
|
||||
int (*charRefNumber)(const ENCODING *enc, const char *ptr);
|
||||
int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
|
||||
void (*updatePosition)(const ENCODING *,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
POSITION *);
|
||||
int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **badPtr);
|
||||
void (*utf8Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
char **toP,
|
||||
const char *toLim);
|
||||
void (*utf16Convert)(const ENCODING *enc,
|
||||
const char **fromP,
|
||||
const char *fromLim,
|
||||
unsigned short **toP,
|
||||
const unsigned short *toLim);
|
||||
int minBytesPerChar;
|
||||
char isUtf8;
|
||||
char isUtf16;
|
||||
};
|
||||
|
||||
/*
|
||||
Scan the string starting at ptr until the end of the next complete token,
|
||||
but do not scan past eptr. Return an integer giving the type of token.
|
||||
|
||||
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
|
||||
|
||||
Return XML_TOK_PARTIAL when the string does not contain a complete token;
|
||||
nextTokPtr will not be set.
|
||||
|
||||
Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
|
||||
will be set to point to the character which made the token invalid.
|
||||
|
||||
Otherwise the string starts with a valid token; nextTokPtr will be set to point
|
||||
to the character following the end of that token.
|
||||
|
||||
Each data character counts as a single token, but adjacent data characters
|
||||
may be returned together. Similarly for characters in the prolog outside
|
||||
literals, comments and processing instructions.
|
||||
*/
|
||||
|
||||
|
||||
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
|
||||
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
|
||||
|
||||
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#ifdef XML_DTD
|
||||
|
||||
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
|
||||
|
||||
#endif /* XML_DTD */
|
||||
|
||||
/* This is used for performing a 2nd-level tokenization on
|
||||
the content of a literal that has already been returned by XmlTok. */
|
||||
|
||||
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
|
||||
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
|
||||
|
||||
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
|
||||
|
||||
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
|
||||
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
|
||||
|
||||
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
|
||||
|
||||
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
|
||||
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
|
||||
|
||||
#define XmlNameLength(enc, ptr) \
|
||||
(((enc)->nameLength)(enc, ptr))
|
||||
|
||||
#define XmlSkipS(enc, ptr) \
|
||||
(((enc)->skipS)(enc, ptr))
|
||||
|
||||
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
|
||||
(((enc)->getAtts)(enc, ptr, attsMax, atts))
|
||||
|
||||
#define XmlCharRefNumber(enc, ptr) \
|
||||
(((enc)->charRefNumber)(enc, ptr))
|
||||
|
||||
#define XmlPredefinedEntityName(enc, ptr, end) \
|
||||
(((enc)->predefinedEntityName)(enc, ptr, end))
|
||||
|
||||
#define XmlUpdatePosition(enc, ptr, end, pos) \
|
||||
(((enc)->updatePosition)(enc, ptr, end, pos))
|
||||
|
||||
#define XmlIsPublicId(enc, ptr, end, badPtr) \
|
||||
(((enc)->isPublicId)(enc, ptr, end, badPtr))
|
||||
|
||||
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
|
||||
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
|
||||
|
||||
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
|
||||
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
|
||||
|
||||
typedef struct {
|
||||
ENCODING initEnc;
|
||||
const ENCODING **encPtr;
|
||||
} INIT_ENCODING;
|
||||
|
||||
int XmlParseXmlDecl(int isGeneralTextEntity,
|
||||
const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const char **badPtr,
|
||||
const char **versionPtr,
|
||||
const char **versionEndPtr,
|
||||
const char **encodingNamePtr,
|
||||
const ENCODING **namedEncodingPtr,
|
||||
int *standalonePtr);
|
||||
|
||||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
||||
int XmlUtf8Encode(int charNumber, char *buf);
|
||||
int XmlUtf16Encode(int charNumber, unsigned short *buf);
|
||||
|
||||
int XmlSizeOfUnknownEncoding(void);
|
||||
ENCODING *
|
||||
XmlInitUnknownEncoding(void *mem,
|
||||
int *table,
|
||||
int (*conv)(void *userData, const char *p),
|
||||
void *userData);
|
||||
|
||||
int XmlParseXmlDeclNS(int isGeneralTextEntity,
|
||||
const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const char **badPtr,
|
||||
const char **versionPtr,
|
||||
const char **versionEndPtr,
|
||||
const char **encodingNamePtr,
|
||||
const ENCODING **namedEncodingPtr,
|
||||
int *standalonePtr);
|
||||
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
||||
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
||||
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
||||
ENCODING *
|
||||
XmlInitUnknownEncodingNS(void *mem,
|
||||
int *table,
|
||||
int (*conv)(void *userData, const char *p),
|
||||
void *userData);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not XmlTok_INCLUDED */
|
||||
1768
CryMovie/xml/Expat/xmltok_impl.c
Normal file
1768
CryMovie/xml/Expat/xmltok_impl.c
Normal file
File diff suppressed because it is too large
Load Diff
46
CryMovie/xml/Expat/xmltok_impl.h
Normal file
46
CryMovie/xml/Expat/xmltok_impl.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
enum {
|
||||
BT_NONXML,
|
||||
BT_MALFORM,
|
||||
BT_LT,
|
||||
BT_AMP,
|
||||
BT_RSQB,
|
||||
BT_LEAD2,
|
||||
BT_LEAD3,
|
||||
BT_LEAD4,
|
||||
BT_TRAIL,
|
||||
BT_CR,
|
||||
BT_LF,
|
||||
BT_GT,
|
||||
BT_QUOT,
|
||||
BT_APOS,
|
||||
BT_EQUALS,
|
||||
BT_QUEST,
|
||||
BT_EXCL,
|
||||
BT_SOL,
|
||||
BT_SEMI,
|
||||
BT_NUM,
|
||||
BT_LSQB,
|
||||
BT_S,
|
||||
BT_NMSTRT,
|
||||
BT_COLON,
|
||||
BT_HEX,
|
||||
BT_DIGIT,
|
||||
BT_NAME,
|
||||
BT_MINUS,
|
||||
BT_OTHER, /* known not to be a name or name start character */
|
||||
BT_NONASCII, /* might be a name or name start character */
|
||||
BT_PERCNT,
|
||||
BT_LPAR,
|
||||
BT_RPAR,
|
||||
BT_AST,
|
||||
BT_PLUS,
|
||||
BT_COMMA,
|
||||
BT_VERBAR
|
||||
};
|
||||
|
||||
#include <stddef.h>
|
||||
98
CryMovie/xml/Expat/xmltok_ns.c
Normal file
98
CryMovie/xml/Expat/xmltok_ns.c
Normal file
@@ -0,0 +1,98 @@
|
||||
const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
|
||||
{
|
||||
return &ns(internal_utf8_encoding).enc;
|
||||
}
|
||||
|
||||
const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
|
||||
{
|
||||
#if XML_BYTE_ORDER == 12
|
||||
return &ns(internal_little2_encoding).enc;
|
||||
#elif XML_BYTE_ORDER == 21
|
||||
return &ns(internal_big2_encoding).enc;
|
||||
#else
|
||||
const short n = 1;
|
||||
return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
const ENCODING *NS(encodings)[] = {
|
||||
&ns(latin1_encoding).enc,
|
||||
&ns(ascii_encoding).enc,
|
||||
&ns(utf8_encoding).enc,
|
||||
&ns(big2_encoding).enc,
|
||||
&ns(big2_encoding).enc,
|
||||
&ns(little2_encoding).enc,
|
||||
&ns(utf8_encoding).enc /* NO_ENC */
|
||||
};
|
||||
|
||||
static
|
||||
int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
|
||||
}
|
||||
|
||||
static
|
||||
int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
|
||||
const char **nextTokPtr)
|
||||
{
|
||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
|
||||
}
|
||||
|
||||
int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
|
||||
{
|
||||
int i = getEncodingIndex(name);
|
||||
if (i == UNKNOWN_ENC)
|
||||
return 0;
|
||||
SET_INIT_ENC_INDEX(p, i);
|
||||
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
|
||||
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
|
||||
p->initEnc.updatePosition = initUpdatePosition;
|
||||
p->encPtr = encPtr;
|
||||
*encPtr = &(p->initEnc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static
|
||||
const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
|
||||
{
|
||||
#define ENCODING_MAX 128
|
||||
char buf[ENCODING_MAX];
|
||||
char *p = buf;
|
||||
int i;
|
||||
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
|
||||
if (ptr != end)
|
||||
return 0;
|
||||
*p = 0;
|
||||
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
|
||||
return enc;
|
||||
i = getEncodingIndex(buf);
|
||||
if (i == UNKNOWN_ENC)
|
||||
return 0;
|
||||
return NS(encodings)[i];
|
||||
}
|
||||
|
||||
int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
|
||||
const ENCODING *enc,
|
||||
const char *ptr,
|
||||
const char *end,
|
||||
const char **badPtr,
|
||||
const char **versionPtr,
|
||||
const char **versionEndPtr,
|
||||
const char **encodingName,
|
||||
const ENCODING **encoding,
|
||||
int *standalone)
|
||||
{
|
||||
return doParseXmlDecl(NS(findEncoding),
|
||||
isGeneralTextEntity,
|
||||
enc,
|
||||
ptr,
|
||||
end,
|
||||
badPtr,
|
||||
versionPtr,
|
||||
versionEndPtr,
|
||||
encodingName,
|
||||
encoding,
|
||||
standalone);
|
||||
}
|
||||
526
CryMovie/xml/xml.cpp
Normal file
526
CryMovie/xml/xml.cpp
Normal file
@@ -0,0 +1,526 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define XMLPARSEAPI(type) type
|
||||
#include "expat\expat.h"
|
||||
#include "xml.h"
|
||||
#include <string>
|
||||
|
||||
// needed for crypak
|
||||
#include <ISystem.h>
|
||||
#include <ICryPak.h>
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* CXmlNode implementation.
|
||||
******************************************************************************
|
||||
*/
|
||||
XmlAttribute CXmlNode::tempAttr;
|
||||
|
||||
CXmlNode::~CXmlNode()
|
||||
{
|
||||
// Clear parent pointer from childs.
|
||||
for (XmlNodes::const_iterator it = m_childs.begin(); it != m_childs.end(); ++it)
|
||||
{
|
||||
IXmlNode *node = *it;
|
||||
((CXmlNode*)node)->m_parent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//! The only ctor and private, protect us from deriviation.
|
||||
CXmlNode::CXmlNode( const char *tag )
|
||||
{
|
||||
m_tag = tag;
|
||||
m_parent = 0;
|
||||
m_refCount = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef CXmlNode::createNode( const char *tag )
|
||||
{
|
||||
return XmlNodeRef( new CXmlNode(tag) );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CXmlNode::isTag( const char *tag ) const
|
||||
{
|
||||
#if defined(LINUX)
|
||||
return compareTextFileStrings(m_tag, tag) == 0;
|
||||
#else
|
||||
return stricmp( tag,m_tag ) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* CXmlNode::getAttr( const char *key ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
return it->value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool CXmlNode::haveAttr( const char *key ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find(tempAttr);
|
||||
if (it != m_attributes.end()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CXmlNode::delAttr( const char *key )
|
||||
{
|
||||
tempAttr.key = key;
|
||||
m_attributes.erase( tempAttr );
|
||||
}
|
||||
|
||||
void CXmlNode::removeAllAttributes()
|
||||
{
|
||||
m_attributes.clear();
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,const char *value )
|
||||
{
|
||||
tempAttr.key = key;
|
||||
tempAttr.value = value;
|
||||
std::pair<XmlAttributes::iterator,bool> res = m_attributes.insert( tempAttr );
|
||||
if (!res.second) {
|
||||
// If already exist, ovveride this member.
|
||||
m_attributes.erase(res.first);
|
||||
m_attributes.insert( tempAttr );
|
||||
}
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,int value )
|
||||
{
|
||||
char str[1024];
|
||||
itoa( value,str,10 );
|
||||
setAttr( key,str );
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,unsigned int value )
|
||||
{
|
||||
char str[1024];
|
||||
itoa( value,str,10 );
|
||||
setAttr( key,str );
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,float value )
|
||||
{
|
||||
char str[1024];
|
||||
sprintf( str,"%g",value );
|
||||
setAttr( key,str );
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,const Vec3 &value )
|
||||
{
|
||||
char str[1024];
|
||||
sprintf( str,"%g,%g,%g",value.x,value.y,value.z );
|
||||
setAttr( key,str );
|
||||
}
|
||||
|
||||
void CXmlNode::setAttr( const char *key,const Quat &value )
|
||||
{
|
||||
char str[1024];
|
||||
sprintf( str,"%g,%g,%g,%g",value.w,value.v.x,value.v.y,value.v.z );
|
||||
setAttr( key,str );
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,int &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
value = atoi(it->value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,unsigned int &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
value = atoi(it->value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,bool &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end())
|
||||
{
|
||||
value = atoi(it->value)!=0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,float &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
value = (float)atof(it->value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,Vec3 &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
float x,y,z;
|
||||
if (sscanf( it->value,"%f,%f,%f",&x,&y,&z ) == 3)
|
||||
{
|
||||
value(x,y,z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CXmlNode::getAttr( const char *key,Quat &value ) const
|
||||
{
|
||||
tempAttr.key = key;
|
||||
XmlAttributes::const_iterator it = m_attributes.find( tempAttr );
|
||||
if (it != m_attributes.end()) {
|
||||
float w,x,y,z;
|
||||
if (sscanf( it->value,"%f,%f,%f,%f",&w,&x,&y,&z ) == 4)
|
||||
{
|
||||
value = Quat(w,x,y,z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
XmlNodeRef CXmlNode::findChild( const char *tag ) const
|
||||
{
|
||||
for (XmlNodes::const_iterator it = m_childs.begin(); it != m_childs.end(); ++it) {
|
||||
if ((*it)->isTag(tag))
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Adds new child node.
|
||||
void CXmlNode::addChild( XmlNodeRef &node )
|
||||
{
|
||||
assert( node != 0 );
|
||||
m_childs.push_back(node);
|
||||
IXmlNode *n = node;
|
||||
((CXmlNode*)n)->m_parent = this;
|
||||
};
|
||||
|
||||
XmlNodeRef CXmlNode::newChild( const char *tagName )
|
||||
{
|
||||
XmlNodeRef node = createNode(tagName);
|
||||
addChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
void CXmlNode::removeChild( XmlNodeRef &node )
|
||||
{
|
||||
XmlNodes::iterator it = std::find(m_childs.begin(),m_childs.end(),(IXmlNode*)node );
|
||||
if (it != m_childs.end())
|
||||
{
|
||||
m_childs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void CXmlNode::removeAllChilds()
|
||||
{
|
||||
m_childs.clear();
|
||||
}
|
||||
|
||||
//! Get XML Node child nodes.
|
||||
XmlNodeRef CXmlNode::getChild( int i ) const
|
||||
{
|
||||
assert( i >= 0 && i < (int)m_childs.size() );
|
||||
return m_childs[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CXmlNode::copyAttributes( XmlNodeRef fromNode )
|
||||
{
|
||||
IXmlNode *n = fromNode;
|
||||
m_attributes = ((CXmlNode*)n)->m_attributes;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CXmlNode::getAttributeByIndex( int index,const char **key,const char **value )
|
||||
{
|
||||
XmlAttributes::iterator it = m_attributes.begin();
|
||||
if (it != m_attributes.end())
|
||||
{
|
||||
std::advance( it,index );
|
||||
if (it != m_attributes.end())
|
||||
{
|
||||
*key = it->key;
|
||||
*value = it->value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef CXmlNode::clone()
|
||||
{
|
||||
XmlNodeRef node = createNode(m_tag);
|
||||
// Clone attributes.
|
||||
IXmlNode *n = node;
|
||||
((CXmlNode*)n)->m_attributes = m_attributes;
|
||||
|
||||
// Clone sub nodes.
|
||||
for (XmlNodes::const_iterator it = m_childs.begin(); it != m_childs.end(); ++it) {
|
||||
XmlNodeRef child = (*it)->clone();
|
||||
node->addChild( child);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
XmlString CXmlNode::getXML( int level ) const
|
||||
{
|
||||
XmlString xml;
|
||||
int i;
|
||||
|
||||
// Add tabs.
|
||||
for (i = 0; i < level; i++)
|
||||
xml += " ";
|
||||
|
||||
// Begin Tag
|
||||
if (m_attributes.empty()) {
|
||||
xml += "<" + m_tag + ">";
|
||||
} else {
|
||||
xml += "<" + m_tag + " ";
|
||||
|
||||
// Put attributes.
|
||||
for (XmlAttributes::const_iterator it = m_attributes.begin(); it != m_attributes.end(); ++it)
|
||||
{
|
||||
xml += XmlString(it->key)+"=\""+it->value+"\" ";
|
||||
}
|
||||
if (m_content.empty() && m_childs.empty()) {
|
||||
// Compact tag form.
|
||||
xml += "/>\n";
|
||||
return xml;
|
||||
}
|
||||
xml += ">";
|
||||
}
|
||||
|
||||
// Put node content.
|
||||
xml += m_content;
|
||||
|
||||
if (!m_childs.empty()) {
|
||||
xml += "\n";
|
||||
}
|
||||
|
||||
// Put sub nodes.
|
||||
for (XmlNodes::const_iterator it = m_childs.begin(); it != m_childs.end(); ++it) {
|
||||
xml += (*it)->getXML( level+1 );
|
||||
}
|
||||
|
||||
// End tag.
|
||||
|
||||
// Add tabs.
|
||||
for (i = 0; i < level; i++)
|
||||
xml += " ";
|
||||
|
||||
xml += "</" + m_tag + ">\n";
|
||||
return xml;
|
||||
}
|
||||
|
||||
#include <ILog.h>
|
||||
|
||||
bool CXmlNode::saveToFile( const char *fileName )
|
||||
{
|
||||
XmlString xml = getXML();
|
||||
SetFileAttributes( fileName,FILE_ATTRIBUTE_NORMAL );
|
||||
FILE *file = fxopen( fileName,"wt" );
|
||||
if (file)
|
||||
{
|
||||
fwrite( (const char*)xml,xml.size(),1,file );
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* XmlParserImp class.
|
||||
******************************************************************************
|
||||
*/
|
||||
class XmlParserImp {
|
||||
public:
|
||||
XmlParserImp();
|
||||
XmlNodeRef parse( const char *buffer,size_t bufLen,XmlString &errorString );
|
||||
|
||||
protected:
|
||||
void onStartElement( const char *tagName,const char **atts );
|
||||
void onEndElement( const char *tagName );
|
||||
void onRawData( const char *data );
|
||||
|
||||
static void startElement(void *userData, const char *name, const char **atts) {
|
||||
((XmlParserImp*)userData)->onStartElement( name,atts );
|
||||
}
|
||||
static void endElement(void *userData, const char *name ) {
|
||||
((XmlParserImp*)userData)->onEndElement( name );
|
||||
}
|
||||
static void characterData( void *userData, const char *s, int len ) {
|
||||
char str[32768];
|
||||
assert( len < 32768 );
|
||||
strncpy( str,s,len );
|
||||
str[len] = 0;
|
||||
((XmlParserImp*)userData)->onRawData( str );
|
||||
}
|
||||
|
||||
// First node will become root node.
|
||||
std::vector<XmlNodeRef> nodeStack;
|
||||
XmlNodeRef m_root;
|
||||
|
||||
XML_Parser m_parser;
|
||||
};
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* XmlParserImp
|
||||
******************************************************************************
|
||||
*/
|
||||
XmlParserImp::XmlParserImp()
|
||||
{
|
||||
m_root = 0;
|
||||
}
|
||||
|
||||
void XmlParserImp::onStartElement( const char *tagName,const char **atts )
|
||||
{
|
||||
XmlNodeRef parent;
|
||||
XmlNodeRef node = new CXmlNode( tagName );
|
||||
|
||||
if (!nodeStack.empty()) {
|
||||
parent = nodeStack.back();
|
||||
} else {
|
||||
m_root = node;
|
||||
}
|
||||
nodeStack.push_back(node);
|
||||
|
||||
if (parent) {
|
||||
parent->addChild( node );
|
||||
}
|
||||
|
||||
node->setLine( XML_GetCurrentLineNumber( (XML_Parser)m_parser ) );
|
||||
|
||||
// Call start element callback.
|
||||
XmlString key,value;
|
||||
int i = 0;
|
||||
while (atts[i] != 0) {
|
||||
node->setAttr( atts[i],atts[i+1] );
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void XmlParserImp::onEndElement( const char *tagName )
|
||||
{
|
||||
assert( !nodeStack.empty() );
|
||||
if (!nodeStack.empty()) {
|
||||
nodeStack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
void XmlParserImp::onRawData( const char* data )
|
||||
{
|
||||
assert( !nodeStack.empty() );
|
||||
if (!nodeStack.empty())
|
||||
{
|
||||
IXmlNode *node = nodeStack.back();
|
||||
node->addContent( data );
|
||||
}
|
||||
}
|
||||
|
||||
XmlNodeRef XmlParserImp::parse( const char *buffer,size_t bufLen,XmlString &errorString )
|
||||
{
|
||||
XML_Memory_Handling_Suite memHandler;
|
||||
memHandler.malloc_fcn = CryModuleMalloc;
|
||||
memHandler.realloc_fcn = CryModuleRealloc;
|
||||
memHandler.free_fcn = CryModuleFree;
|
||||
m_parser = XML_ParserCreate_MM(NULL,&memHandler,NULL);
|
||||
|
||||
XML_SetUserData( m_parser, this );
|
||||
XML_SetElementHandler( m_parser, startElement,endElement );
|
||||
XML_SetCharacterDataHandler( m_parser,characterData );
|
||||
|
||||
XmlNodeRef root = 0;
|
||||
|
||||
/*
|
||||
int size = file->size();
|
||||
char *buf = (char*)memory::malloc( size );
|
||||
file->read( buf,size );
|
||||
if (!XML_Parse( parser,buf,size,1 ))
|
||||
{
|
||||
error( "XML Error (%s): %s at line %d\n",filename.c_str(),XML_ErrorString(XML_GetErrorCode(parser)),XML_GetCurrentLineNumber(parser) );
|
||||
return false;
|
||||
}
|
||||
memory::free( buf );
|
||||
|
||||
XMLParser::parse( fileName );
|
||||
*/
|
||||
if (XML_Parse( m_parser,buffer,(int)bufLen,1 ))
|
||||
{
|
||||
root = m_root;
|
||||
} else {
|
||||
char *str = new char [32768];
|
||||
sprintf( str,"XML Error: %s at line %d",XML_ErrorString(XML_GetErrorCode(m_parser)),XML_GetCurrentLineNumber(m_parser) );
|
||||
errorString = str;
|
||||
delete [] str;
|
||||
// CLogFile::FormatLine( "%s",str );
|
||||
}
|
||||
|
||||
XML_ParserFree( m_parser );
|
||||
|
||||
m_root = 0;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
//! Parse xml file.
|
||||
XmlNodeRef XmlParser::parse( const char *fileName )
|
||||
{
|
||||
m_errorString = "";
|
||||
XmlParserImp xml;
|
||||
std::vector<char> buf;
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
FILE *file = pPak->FOpen(fileName,"rb");
|
||||
if (file) {
|
||||
pPak->FSeek( file,0,SEEK_END );
|
||||
int fileSize = pPak->FTell(file);
|
||||
pPak->FSeek( file,0,SEEK_SET );
|
||||
buf.resize( fileSize );
|
||||
pPak->FRead( &(buf[0]),fileSize,1,file );
|
||||
pPak->FClose(file);
|
||||
return xml.parse( &buf[0],buf.size(),m_errorString );
|
||||
} else {
|
||||
return XmlNodeRef();
|
||||
}
|
||||
}
|
||||
|
||||
//! Parse xml from memory buffer.
|
||||
XmlNodeRef XmlParser::parseBuffer( const char *buffer )
|
||||
{
|
||||
m_errorString = "";
|
||||
XmlParserImp xml;
|
||||
return xml.parse( buffer,strlen(buffer),m_errorString );
|
||||
};
|
||||
225
CryMovie/xml/xml.h
Normal file
225
CryMovie/xml/xml.h
Normal file
@@ -0,0 +1,225 @@
|
||||
#ifndef __XML_HEADER__
|
||||
#define __XML_HEADER__
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "ixml.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* XmlParser class, Parse xml and return root xml node if success. */
|
||||
/************************************************************************/
|
||||
class XmlParser
|
||||
{
|
||||
public:
|
||||
//! Parse xml file.
|
||||
XmlNodeRef parse( const char *fileName );
|
||||
|
||||
//! Parse xml from memory buffer.
|
||||
XmlNodeRef parseBuffer( const char *buffer );
|
||||
|
||||
const char* getErrorString() const { return m_errorString; }
|
||||
private:
|
||||
XmlString m_errorString;
|
||||
};
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* XmlAttribute class
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class XmlAttribute {
|
||||
public:
|
||||
const char* key;
|
||||
const char* value;
|
||||
|
||||
XmlAttribute() { m_bOwnKey = false; m_bOwnValue = false; }
|
||||
//XmlAttribute( const char *k,const char *v ) : key(k),value(v) {}
|
||||
//explicit XmlAttribute( const char *k ) : key(k) {}
|
||||
XmlAttribute( const XmlAttribute &attr ) { m_bOwnKey = false; m_bOwnValue = false; *this = attr; }
|
||||
XmlAttribute& operator=( const XmlAttribute &attr )
|
||||
{
|
||||
if (m_bOwnKey) free( (void*)key );
|
||||
if (m_bOwnValue) free( (void*)value );
|
||||
|
||||
size_t keylen = strlen(attr.key);
|
||||
size_t valuelen = strlen(attr.value);
|
||||
if (keylen < sizeof(m_key))
|
||||
{
|
||||
m_bOwnKey = false;
|
||||
strcpy(m_key,attr.key);
|
||||
key = m_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bOwnKey = true;
|
||||
char *sKey = (char*)malloc(keylen+1);
|
||||
strcpy( sKey,attr.key );
|
||||
key = sKey;
|
||||
}
|
||||
if (valuelen < sizeof(m_value))
|
||||
{
|
||||
m_bOwnValue = false;
|
||||
strcpy(m_value,attr.value);
|
||||
value = m_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bOwnValue = true;
|
||||
char *sValue = (char*)malloc(valuelen+1);
|
||||
strcpy( sValue,attr.value );
|
||||
value = sValue;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
~XmlAttribute() {
|
||||
if (m_bOwnKey) free( (void*)key );
|
||||
if (m_bOwnValue) free( (void*)value );
|
||||
}
|
||||
bool operator<( const XmlAttribute &attr ) const { return stricmp( key,attr.key ) < 0; }
|
||||
bool operator>( const XmlAttribute &attr ) const { return stricmp( key,attr.key ) > 0; }
|
||||
bool operator==( const XmlAttribute &attr ) const { return stricmp( key,attr.key ) == 0; }
|
||||
bool operator!=( const XmlAttribute &attr ) const { return stricmp( key,attr.key ) != 0; }
|
||||
private:
|
||||
char m_key[16];
|
||||
char m_value[16];
|
||||
unsigned m_bOwnKey : 1;
|
||||
unsigned m_bOwnValue : 1;
|
||||
};
|
||||
|
||||
|
||||
//! Xml node attributes class.
|
||||
typedef std::set<XmlAttribute> XmlAttributes;
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* CXmlNode class
|
||||
* Never use CXmlNode directly instead use reference counted XmlNodeRef.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
class CXmlNode : public IXmlNode
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CXmlNode( const char *tag );
|
||||
//! Destructor.
|
||||
~CXmlNode();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Reference counting.
|
||||
void AddRef() { m_refCount++; };
|
||||
//! When ref count reach zero XML node dies.
|
||||
void Release() { if (--m_refCount <= 0) delete this; };
|
||||
|
||||
//! Create new XML node.
|
||||
XmlNodeRef createNode( const char *tag );
|
||||
|
||||
//! Get XML node tag.
|
||||
const char *getTag() const { return m_tag; };
|
||||
void setTag( const char *tag ) { m_tag = tag; }
|
||||
|
||||
//! Return true if givven tag equal to node tag.
|
||||
bool isTag( const char *tag ) const;
|
||||
|
||||
//! Get XML Node attributes.
|
||||
virtual int getNumAttributes() const { return (int)m_attributes.size(); };
|
||||
//! Return attribute key and value by attribute index.
|
||||
virtual bool getAttributeByIndex( int index,const char **key,const char **value );
|
||||
|
||||
virtual void copyAttributes( XmlNodeRef fromNode );
|
||||
|
||||
//! Get XML Node attribute for specified key.
|
||||
const char* getAttr( const char *key ) const;
|
||||
//! Check if attributes with specified key exist.
|
||||
bool haveAttr( const char *key ) const;
|
||||
|
||||
//! Adds new child node.
|
||||
void addChild( XmlNodeRef &node );
|
||||
|
||||
//! Creates new xml node and add it to childs list.
|
||||
XmlNodeRef newChild( const char *tagName );
|
||||
|
||||
//! Remove child node.
|
||||
void removeChild( XmlNodeRef &node );
|
||||
|
||||
//! Remove all child nodes.
|
||||
void removeAllChilds();
|
||||
|
||||
//! Get number of child XML nodes.
|
||||
int getChildCount() const { return (int)m_childs.size(); };
|
||||
|
||||
//! Get XML Node child nodes.
|
||||
XmlNodeRef getChild( int i ) const;
|
||||
|
||||
//! Find node with specified tag.
|
||||
XmlNodeRef findChild( const char *tag ) const;
|
||||
|
||||
//! Get parent XML node.
|
||||
XmlNodeRef getParent() const { return m_parent; }
|
||||
|
||||
//! Returns content of this node.
|
||||
const char* getContent() const { return m_content; };
|
||||
void setContent( const char *str ) { m_content = str; };
|
||||
void addContent( const char *str ) { m_content += str; };
|
||||
|
||||
XmlNodeRef clone();
|
||||
|
||||
//! Returns line number for XML tag.
|
||||
int getLine() const { return m_line; };
|
||||
//! Set line number in xml.
|
||||
void setLine( int line ) { m_line = line; };
|
||||
|
||||
//! Returns XML of this node and sub nodes.
|
||||
XmlString getXML( int level=0 ) const;
|
||||
bool saveToFile( const char *fileName );
|
||||
|
||||
//! Set new XML Node attribute (or override attribute with same key).
|
||||
void setAttr( const char* key,const char* value );
|
||||
void setAttr( const char* key,int value );
|
||||
void setAttr( const char* key,unsigned int value );
|
||||
void setAttr( const char* key,float value );
|
||||
void setAttr( const char* key,const Vec3 &value );
|
||||
void setAttr( const char* key,const Quat &value );
|
||||
|
||||
//! Delete attrbute.
|
||||
void delAttr( const char* key );
|
||||
//! Remove all node attributes.
|
||||
void removeAllAttributes();
|
||||
|
||||
//! Get attribute value of node.
|
||||
bool getAttr( const char *key,int &value ) const;
|
||||
bool getAttr( const char *key,unsigned int &value ) const;
|
||||
bool getAttr( const char *key,float &value ) const;
|
||||
bool getAttr( const char *key,Vec3 &value ) const;
|
||||
bool getAttr( const char *key,Quat &value ) const;
|
||||
bool getAttr( const char *key,bool &value ) const;
|
||||
bool getAttr( const char *key,XmlString &value ) const { XmlString v; if (v=getAttr(key)) { value = v; return true; } else return false; }
|
||||
// bool getAttr( const char *key,CString &value ) const { XmlString v; if (getAttr(key,v)) { value = (const char*)v; return true; } else return false; }
|
||||
|
||||
private:
|
||||
//! Ref count itself, its zeroed on node creation.
|
||||
int m_refCount;
|
||||
|
||||
//! Line in XML file where this node firstly appeared (usefull for debuggin).
|
||||
int m_line;
|
||||
//! Tag of XML node.
|
||||
XmlString m_tag;
|
||||
|
||||
//! Content of XML node.
|
||||
XmlString m_content;
|
||||
//! Parent XML node.
|
||||
CXmlNode *m_parent;
|
||||
//! Next XML node in same hierarchy level.
|
||||
|
||||
typedef std::vector<XmlNodeRef> XmlNodes;
|
||||
XmlNodes m_childs;
|
||||
//! Xml node attributes.
|
||||
XmlAttributes m_attributes;
|
||||
static XmlAttribute tempAttr;
|
||||
};
|
||||
|
||||
#endif // __XML_HEADER__
|
||||
Reference in New Issue
Block a user