Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
372 lines
8.0 KiB
C++
372 lines
8.0 KiB
C++
// Z3DGeneralChrModel.h: interface for the CZ3DGeneralChrModel class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
#if !defined(AFX_Z3DGENERALCHRMODEL_H__B38196D0_93FD_49A6_85A7_6E726B0C53A1__INCLUDED_)
|
||
#define AFX_Z3DGENERALCHRMODEL_H__B38196D0_93FD_49A6_85A7_6E726B0C53A1__INCLUDED_
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif // _MSC_VER > 1000
|
||
|
||
#include "Z3DCharacterModel.h"
|
||
#include "Z3DGCMDS.h"
|
||
#include "Z3DMultipartSkin.h"
|
||
#include "Z3DSkeletonObject.h"
|
||
#include "Z3DChrEventGenerator.h"
|
||
#include "Z3DWeapon.h"
|
||
#include "Z3DAniMixer.h"
|
||
#include "map"
|
||
#include "vector"
|
||
|
||
|
||
struct Z3DTOK_OVERLAY_SLOT
|
||
{
|
||
long lCount;
|
||
Z3DTOK* pArray;
|
||
long lUsed;
|
||
|
||
void Alloc( long count )
|
||
{
|
||
pArray = new Z3DTOK[count];
|
||
for( int i = 0; i < count; ++i )
|
||
{
|
||
pArray[i] = NULL_TOK;
|
||
}
|
||
lCount = count;
|
||
lUsed = 0;
|
||
}
|
||
|
||
~Z3DTOK_OVERLAY_SLOT()
|
||
{
|
||
SAFE_DELETEA( pArray );
|
||
lCount = 0;
|
||
}
|
||
};
|
||
|
||
|
||
struct Z3D_BOUNDING_CYLINDER
|
||
{
|
||
vector3 vBottom, vTop;
|
||
float fBottomRadius, fTopRadius;
|
||
};
|
||
|
||
|
||
class CZ3DGeneralChrModel : public CZ3DCharacterModel
|
||
{
|
||
public:
|
||
CZ3DGeneralChrModel();
|
||
virtual ~CZ3DGeneralChrModel();
|
||
|
||
void ApplySTMode()
|
||
{
|
||
if( m_pSkin )
|
||
m_pSkin->ApplySTMode();
|
||
|
||
std::map<Z3DTOK, Z3D_TOK_N_ATTACHMENT>::iterator it;
|
||
for( it = m_mapAttachmentSlot.begin(); it != m_mapAttachmentSlot.end(); it++ )
|
||
{
|
||
if( it->second.pAttachment )
|
||
{
|
||
it->second.pAttachment->ApplySTMode();
|
||
}
|
||
}
|
||
}
|
||
|
||
const CZ3DGCMDS* GetGCMDSInterface() const
|
||
{
|
||
return m_rpGCMDS;
|
||
}
|
||
|
||
const char* GetGCMDSFileName() const
|
||
{
|
||
if( m_rpGCMDS )
|
||
{
|
||
return m_rpGCMDS->GetNameString();
|
||
}
|
||
|
||
return NULL;
|
||
}
|
||
|
||
float GetScale()
|
||
{
|
||
return m_fScaleFactor;
|
||
}
|
||
|
||
void SetScale( float f );
|
||
|
||
float GetEffectScale();
|
||
|
||
void SetLODLevel( long l )
|
||
{
|
||
if( m_pSkin )
|
||
{
|
||
m_pSkin->SetLODLevel( l );
|
||
}
|
||
}
|
||
|
||
void SetDisable( bool bDisabled );
|
||
|
||
void SetCull( bool bCulled );
|
||
bool IsCulled()
|
||
{
|
||
return m_pSkin->IsCulled();
|
||
}
|
||
|
||
void Pause( bool bPause )
|
||
{
|
||
m_bDisabled = bPause;
|
||
}
|
||
|
||
|
||
virtual bool Init( const char* szGCMDSname );
|
||
|
||
CZ3DObject* GetSkeletonPartObject( const char* szSkeletonPartName );
|
||
CZ3DObject* GetSkeletonPartObject( Z3DTOK tokSkeletonPartName );
|
||
|
||
CZ3DSkeletonObject* GetSkeletonSet( long* pN )
|
||
{
|
||
if( NULL == m_rpGCMDS )
|
||
{
|
||
if( pN )
|
||
{
|
||
*pN = 0;
|
||
}
|
||
return NULL;
|
||
}
|
||
|
||
if( pN )
|
||
{
|
||
*pN = m_rpGCMDS->GetSkeletonCount();
|
||
}
|
||
|
||
return m_pSkeletonObjects;
|
||
}
|
||
|
||
bool SetMotionSheet( const char* szSheetName );
|
||
bool SetMotionSheet( Z3DTOK tokSheetName );
|
||
|
||
const char* GetCurrentMotionSheetName();
|
||
|
||
void SetMotion( const char* szMotionName, unsigned long ulFlag = 0, bool bTransit = true, long lRandomIndex = -1 );
|
||
void SetMotion( Z3DTOK tokMotionName, unsigned long ulFlag = 0, bool bTransit = true , long lRandomIndex = -1 );
|
||
|
||
void AddMotion( const char* szMotionName, unsigned long ulFlag = 0, float fFactorPeak = 0.5f, bool bSustainLast = false );
|
||
void AddMotion( Z3DTOK tokMotionName, unsigned long ulFlag = 0, float fFactorPeak = 0.5f, bool bSustainLast = false );
|
||
|
||
float GetMotionCurrentFrame( int n )
|
||
{
|
||
if( n < m_rpGCMDS->GetAniHolderCount() )
|
||
{
|
||
return m_pAniHolder[n].GetCurrentFrame();
|
||
}
|
||
|
||
return 0.0f;
|
||
}
|
||
|
||
float GetAddonMotionCurrentFrame( int n )
|
||
{
|
||
if( n < m_rpGCMDS->GetAniHolderCount() )
|
||
{
|
||
return m_pAddonAniHolder[n].GetCurrentFrame();
|
||
}
|
||
|
||
return 0.0f;
|
||
}
|
||
|
||
void SetMotionCurrentFrame( int n, float fFrame )
|
||
{
|
||
if( n < m_rpGCMDS->GetAniHolderCount() )
|
||
{
|
||
m_pAniHolder[n].SetCurrentFrame( fFrame );
|
||
}
|
||
}
|
||
|
||
bool SetStaticSlot( const char* szSlotName, const char* szOutfitName );
|
||
void BeginOutfitSetting();
|
||
bool SetOutfitSlot( const char* szSlotName, const char* szOutfitName );
|
||
void EndOutfitSetting();
|
||
|
||
bool SetAttachmentSlot( const char* szSlotName, const char* szAttachmentName, bool bForced = false );
|
||
bool SetAttachmentSlot( Z3DTOK tokSlotName, Z3DTOK tokAttachmentName, bool bForced = false );
|
||
|
||
bool SetAttachmentHolder( const char* szSlotName, long lIndex );
|
||
bool SetAttachmentHolder( Z3DTOK tokSlotName, long lIndex );
|
||
|
||
long GetAttachmentHolder( const char* szSlotName );
|
||
long GetAttachmentHolder( Z3DTOK tokSlotName );
|
||
|
||
CZ3DWeapon* GetAttachmentObject( const char* szSlotName );
|
||
CZ3DWeapon* GetAttachmentObject( Z3DTOK tokSlotName );
|
||
|
||
|
||
bool IsActionFinished(int n)
|
||
{
|
||
//_ASSERT( n < m_rpGCMDS->GetAniHolderCount() );
|
||
if( !(n < m_rpGCMDS->GetAniHolderCount()) )
|
||
{
|
||
return true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
return m_pAniHolder[n].IsOverflow();
|
||
}
|
||
|
||
bool IsAddonActionFinished(int n)
|
||
{
|
||
//_ASSERT( n < m_rpGCMDS->GetAniHolderCount() );
|
||
if( !(n < m_rpGCMDS->GetAniHolderCount()) )
|
||
{
|
||
return true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
return m_pAddonAniHolder[n].IsOverflow();
|
||
}
|
||
|
||
|
||
void SetAlphaLevel( float f )
|
||
{
|
||
m_pSkin->SetTransparency( f );
|
||
}
|
||
|
||
bool SetAnimationSpeed( float f, long lIndex = -1 )
|
||
{
|
||
if( -1 == lIndex )
|
||
{
|
||
for( int i = 0; i < m_rpGCMDS->GetAniHolderCount(); i++ )
|
||
{
|
||
m_pAniHolder[i].SetSpeedFactor( f );
|
||
m_pAddonAniHolder[i].SetSpeedFactor( f );
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if( !(lIndex < m_rpGCMDS->GetAniHolderCount()) )
|
||
{
|
||
return false;
|
||
}
|
||
|
||
m_pAniHolder[lIndex].SetSpeedFactor( f );
|
||
m_pAddonAniHolder[lIndex].SetSpeedFactor( f );
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
bool CheckEvent( const char* szEventName, Z3DTOK* p_tokSecondaryEvent = NULL );
|
||
|
||
virtual void Act( Z3D_CHR_ACTION action, long lParam1 = 0, long lParam2 = 0 );
|
||
|
||
virtual void FrameMove();
|
||
|
||
void Render();
|
||
virtual void DrawShadow( DWORD vertexShader = 0xFFFFFFFF );
|
||
virtual void DrawSpecular( DWORD vertexShader = 0xFFFFFFFF );
|
||
|
||
void PreRender();
|
||
|
||
void GetAniDataDisplacement( vector3 &v_disp, int n );
|
||
long GetAniDataLength( int n );
|
||
|
||
void GetBoundingBox( vector3& r_vmin, vector3& r_vmax );
|
||
|
||
const CZ3DMultipartSkin* GetSkinInterface()
|
||
{
|
||
return m_pSkin;
|
||
}
|
||
|
||
long GetBoundingCylinderCount()
|
||
{
|
||
return m_rpGCMDS->GetBoundingCylinderVector()->size();
|
||
}
|
||
|
||
const Z3D_BOUNDING_CYLINDER* GetBoundingCylinderList();
|
||
|
||
|
||
bool IsShaderParameterAvailable( long lIdx );
|
||
const char* GetShaderParameterInfo( long lIdx );
|
||
|
||
long GetEffectInfoList( const char** &rpszEffectInfo );
|
||
|
||
float GetSizeFactor()
|
||
{
|
||
if( m_rpGCMDS )
|
||
{
|
||
return m_rpGCMDS->GetSizeFactor();
|
||
}
|
||
|
||
return 0.0f;
|
||
}
|
||
|
||
void SetAniTestMode( bool b )
|
||
{
|
||
m_bAniTestMode = b;
|
||
if( m_pSkin )
|
||
{
|
||
m_pSkin->SetTestMode( b );
|
||
}
|
||
}
|
||
|
||
|
||
static bool _BuildCMDSList( const char* szFileSpec = "*.GCMDS" );
|
||
static bool _ClearCMDSList();
|
||
static void _RetrieveCMDSNameList( std::vector<const char*>& r_vecList );
|
||
static CZ3DGCMDS* _GetGCMDSByName( const char* szFilename );
|
||
|
||
bool GetFixHeight() { return m_bFixHeight; }
|
||
void SetFixHeight(bool bFix) { m_bFixHeight = bFix; }
|
||
float m_fFixHeight;
|
||
|
||
protected:
|
||
bool m_bFixHeight;
|
||
|
||
bool m_bAniTestMode;
|
||
bool m_bInitialized;
|
||
CZ3DAniMixer m_AniMixer;
|
||
|
||
float m_fScaleFactor;
|
||
std::vector<Z3DTOK> m_vec_tokEventStorage;
|
||
std::vector<Z3DTOK> m_vec_tokSecondaryEventStorage;
|
||
|
||
CZ3DGCMDS* m_rpGCMDS;
|
||
const Z3DMOTIONSHEET* m_rpCurrentMotionSheet;
|
||
Z3DTOK m_tokCurrentMotionSheet;
|
||
|
||
CZ3DSkeletonObject* m_pSkeletonObjects;
|
||
CZ3DMultipartSkin* m_pSkin;
|
||
CZ3DPseudoCloth* m_pPseudoCloth;
|
||
|
||
H3DAniKeyPackTag* m_pTagAniKeyPack;
|
||
Z3DAniHolder* m_pAniHolder;
|
||
CZ3DChrEventGenerator* m_pEventGenerator;
|
||
|
||
H3DAniKeyPackTag* m_pTagAddonAniKeyPack;
|
||
Z3DAniHolder* m_pAddonAniHolder;
|
||
CZ3DChrEventGenerator* m_pAddonEventGenerator;
|
||
|
||
std::map<Z3DTOK, Z3DTOK> m_mapStaticSlot;
|
||
std::map<Z3DTOK, Z3DTOK_OVERLAY_SLOT*> m_mapOutfitSlot;
|
||
|
||
Z3D_BOUNDING_CYLINDER* m_pBoundingCylinder;
|
||
|
||
struct Z3D_TOK_N_ATTACHMENT
|
||
{
|
||
Z3DTOK tokAttachmentName;
|
||
CZ3DWeapon* pAttachment;
|
||
long lHolderIndex;
|
||
};
|
||
std::map<Z3DTOK, Z3D_TOK_N_ATTACHMENT> m_mapAttachmentSlot;
|
||
|
||
|
||
bool SetAniKeyPack( int n, Z3DTOK tokFileName, bool bTransit );
|
||
bool SetAddonAniKeyPack( int n, Z3DTOK tokFileName, float fFactorPeak );
|
||
|
||
void ApplyOutfit( Z3DTOK tokOutfitName );
|
||
|
||
Z3DTOKARRAY* GetTokArray( Z3DTOK tokMotionName, long lRandomIndex = -1 );
|
||
|
||
|
||
static std::map<Z3DTOK, CZ3DGCMDS*> ms_mapTok2GCMDS;
|
||
};
|
||
|
||
#endif // !defined(AFX_Z3DGENERALCHRMODEL_H__B38196D0_93FD_49A6_85A7_6E726B0C53A1__INCLUDED_)
|