Release __BS_EFFECT_LUA FIXXED

12/01/2011 20:12 Pixelfehler#1
So da es einige noch nicht geschafft haben die __BS_EFFECT_LUA zu Fixxen dachte ich mir das ich alle ben鰐igten Snippes einmal hier releasen tue :D

Wenn man alles genau so macht klappt es :D

Neuz-VersionCommon.h
Code:
 
#define	__BS_EFFECT_LUA
Sucht in der Mover.cpp nach
Code:
BOOL CMover::IsCommBank( void )
{
	return	( IsSMMode( SM_BANK15 ) || IsSMMode( SM_BANK30 ) || IsSMMode( SM_BANK001 ) );
}
und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
const char* CMover::GetNameO3D( )
{
	CObject3D* pObj = ((CModelObject*)m_pModel)->GetObject3D( );
	if( !pObj )
	{
		Error( "CMover::GetNameO3D, pObj == NULL" );
		return NULL;
	}

	return pObj->m_szFileName;
}

BOOL CMover::SetDataMTE( const char* alphaTex, const char* eff2ndTex )
{
	// 柳楼 结具且锭 龋免等促.
	// 捞锭 厚肺家 m_pMteData啊 且寸等促.

	CObject3D* pObj = ((CModelObject*)m_pModel)->GetObject3D( );
	if( !pObj )
	{
		Error( "CMover::GetNameO3D, pObj == NULL" );
		return FALSE;
	}

	if( NULL == pObj->m_pMteData )
		pObj->m_pMteData = new CObject3D::MTE_DATA;

	CObject3D::MTE_DATA* pData = pObj->m_pMteData;

	char	szAlphaTexture[MAX_PATH];
	GetFileTitle( alphaTex, szAlphaTexture );
	strcat( szAlphaTexture, "-ef01.tga" );
	
	pData->_pTex[ 0 ] = TexturePool::Get()->GetTexture( DIR_SFXTEX, std::string(szAlphaTexture) );
	pData->_pTex[ 1 ] = TexturePool::Get()->GetTexture( DIR_SFXTEX, std::string(eff2ndTex) );

	if( NULL == pData->_pTex[ 0 ] || NULL == pData->_pTex[ 1 ] )
	{
		Error( "Failed loading MTE texture %s or %s", szAlphaTexture, eff2ndTex );
		return FALSE;
	}
	
	//ok... now you can use this data
	return TRUE;
}

#endif //__BS_EFFECT_LUA
Sucht nach
Code:
#if __VER >= 15 // __PETVIS
	m_pSfxBuffPet = NULL;
#endif
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	CSfxModelMng::GetThis()->SubData( GetId() );
#endif //__BS_EFFECT_LUA
謋fnet die Datei StdAfx.h und sucht nach
Code:
#ifdef __BS_CONSOLE
#include "Console.h"
#endif
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
#include "BsCommon.h"
#endif
Geht zu der Datei Mover.h und sucht nach
Code:
#if __VER >= 14 // __WING_ITEM
	void			WingMotionSetting( const CModelObject* pModel );
	float			GetRideFrameSpeed( void );
#endif // __WING_ITEM
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	const char*		GetNameO3D( );
	BOOL			SetDataMTE( const char* fname1, const char* fname2 );
#endif
Geht zu der Datei sfxbase.cpp und sucht nach
Code:
CSfxMng::~CSfxMng()
{
	for(int i=0;i<m_apSfxBase.GetSize();i++)
		safe_delete( (CSfxBase*)m_apSfxBase.GetAt(i) );
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	close_lua_sfx( );
#endif	//__BS_EFFECT_LUA
Sucht nach
Code:
if( pMesh ) pMesh->DeleteDeviceObjects();
	}
	return S_OK;
}
Und genau darunter f黦t ihr das ein
Code:
#ifdef __BS_EFFECT_LUA

//gmpbigsun: 寇何(风酒)俊�* sfx甫 倒府扁 困窃 ( 20100201 )

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//SfxModelSet
SfxModelSet::SfxModelSet( const OBJID idMaster, const char* szSfxName, const char* szBoneName, BOOL bLoop, int nState )
{
	_idMaster = idMaster;

	_pModel = new CSfxModel;
	_pModel->SetSfx( szSfxName );

	// 弥措 橇饭烙阑 茫绰促 
	for(int i = 0; i < _pModel->m_pSfxBase->m_apParts.GetSize(); i++)
	{	
		for(int j = 0; j < _pModel->m_pSfxBase->Part( i )->m_apKeyFrames.GetSize(); j++)
		{
			// 阿 颇飘狼 橇饭烙 荐客 厚背秦�* 弥措 橇饭烙阑 茫澜
			if(_nMaxFrame < _pModel->m_pSfxBase->Part( i )->Key(j)->nFrame)
				_nMaxFrame = _pModel->m_pSfxBase->Part( i )->Key(j)->nFrame;
		}
		
	}

	strcpy( _szFileName, szSfxName );
	strcpy( _szBone, szBoneName );
	_bLoop = bLoop;

	_nState = nState;
}

SfxModelSet::~SfxModelSet( )
{
	SAFE_DELETE( _pModel );
}

BOOL SfxModelSet::Update( )
{
	CMover* pMaster = prj.GetMover( _idMaster );
	if( !pMaster )
		return FALSE;

	CModelObject* pMasterModel = (CModelObject*)pMaster->GetModel( );
	if( !pMasterModel )
		return FALSE;

	D3DXVECTOR3 kPos( 0.0f, 0.0f, 0.0f );

	BOOL bOK = pMasterModel->GetPosBone( &kPos, _szBone );
	if( !bOK )
		return FALSE;

	D3DXMATRIX* pMat = &pMaster->GetMatrixWorld( );
	D3DXVec3TransformCoord( &kPos, &kPos, pMat );
	_pModel->m_vPos = kPos;
	
	//looping
	if( _nMaxFrame < _pModel->m_nCurFrame )
	{
		if( _bLoop )
			_pModel->m_nCurFrame = 0;
		else 
			return FALSE;
	}

	_pModel->Process( );

	return TRUE;
}

BOOL SfxModelSet::Render( LPDIRECT3DDEVICE9 pd3dDevice )
{
	if( _pModel )
		_pModel->Render( pd3dDevice );

	return TRUE;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//CSfxModelMng

CSfxModelMng* CSfxModelMng::_pThis = NULL;

CSfxModelMng* CSfxModelMng::GetThis()
{
	if( !_pThis )
		_pThis = new CSfxModelMng;

	return _pThis;
}

void CSfxModelMng::Free()
{
	SAFE_DELETE( _pThis );
}

CSfxModelMng::CSfxModelMng( )
{
}

CSfxModelMng::~CSfxModelMng( )
{
	for( SfxModelSetIter iter = _cDatas.begin(); iter != _cDatas.end(); ++iter )
	{
		SMSVector& cSMS = iter->second;
		SeqDeleter< SMSVector >() ( cSMS );
	}

	_cDatas.clear();
}

BOOL CSfxModelMng::IsFull( OBJID objID, const char* szSfx, const char* szBone )
{
	// 菜 谩绰啊?
	static const int MAX_PLAY = 5;

	SfxModelSetIter iter = _cDatas.find( objID );
	if( iter != _cDatas.end() )
	{
		SMSVector& cSMS = iter->second;

		// 弥措 悼矫 啊瓷茄 捞棋飘 八荤
		if( cSMS.size() > MAX_PLAY )
			return TRUE;

		// 捞抚捞 鞍篮 sfx绰 老窜 吝汗 救达
		for( SMSVector::iterator iter2 = cSMS.begin(); iter2 != cSMS.end(); ++iter2 )
		{
			SfxModelSet* pData = *iter2;
			if( !pData->_bLoop )		//clamp 吝汗倾侩 
				continue;

			// looping牢单 bone 捞 鞍绊 , sfx 啊 鞍栏搁 捞扒 公矫且 单捞磐肺 魄窜.
			// 溜 鞍篮镑俊 鞍篮 捞棋飘甫 风俏矫虐磊绊 沁促搁 公矫茄促. ( 捞固 鞍篮 捞棋飘啊 免仿登绊 乐栏骨肺 )
			if( strcmp( pData->_szBone, szBone ) == 0 )
			{
				if( strcmp( pData->_szFileName, szSfx ) == 0 )
					return TRUE;
			}
		}
	}

	return FALSE;

}

BOOL CSfxModelMng::AddData( SfxModelSet* pData, BOOL bChecked )
{
	// IsFull肺 八荤茄快 AddData啊 阂妨具 窃, 弥家茄狼 救怜措氓 
	if( !bChecked )
		return FALSE;

	//! IsFull窃荐肺 捞固 八荤啊 登乐促绊 魄窜窍咯 犁 八荤绰 窍瘤 臼澜.

	SfxModelSetIter iter = _cDatas.find( pData->_idMaster );
	if( iter != _cDatas.end() )
	{
		//Bone name捞 鞍篮版快 looping 加己俊 措秦�* 扁粮 捞棋飘 昏力 饶 眠啊 
		SMSVector& rSMS = iter->second;

		for( SMSVector::iterator iter2 = rSMS.begin(); iter2 != rSMS.end();  )
		{
			SfxModelSet* pSet = *iter2;
			
			if( !pSet->_bLoop )		//clamp捞搁 吝汗倾侩 
			{
				++iter2;
				continue;
			}

			if( strcmp( pSet->_szBone, pData->_szBone ) == 0 )
			{
				//困摹啊 鞍促. 扁粮 sfx昏力 
				SAFE_DELETE( pSet );
				iter2 = rSMS.erase( iter2 );
			}
			else ++iter2;
		}

		rSMS.push_back( pData );

		return TRUE;
	}
	else
	{
		// new data
		SMSVector cSMS;
		cSMS.push_back( pData );

		pair< SfxModelSetIter, bool > rst =  _cDatas.insert( SfxModelSetContainer::value_type( pData->_idMaster, cSMS ) );

		assert( rst.second );
		return (BOOL)rst.second;
	}
	 
	 return TRUE;
}

BOOL CSfxModelMng::SubData( OBJID objID )
{
	SfxModelSetIter iter = _cDatas.find( objID );
	if( iter != _cDatas.end() )
	{
		SeqDeleter< SMSVector >() ( iter->second );

		_cDatas.erase( iter++ );
		return TRUE;
	}

	return FALSE;
}

BOOL CSfxModelMng::SubData( OBJID objID, const int nState )
{
	// 秦寸 惑怕俊 秦寸窍绰 葛电 sfx甫 昏力茄促.

	BOOL bOK = FALSE;
	SfxModelSetIter finder = _cDatas.find( objID );
	if( finder != _cDatas.end() )
	{
		SMSVector& kSubData = finder->second;

		for( SMSVector::iterator iter = kSubData.begin(); iter != kSubData.end(); /*none*/ )
		{
			SfxModelSet* pSfx = *iter;

			if( pSfx->_idMaster == objID )
			{
				if( nState == pSfx->_nState )
				{
					SAFE_DELETE( pSfx );
					iter = kSubData.erase( iter );

					bOK = TRUE;		//ok 茫酒�* 瘤奎澜.
				}
				else ++iter;
			}
		}
	}

	return bOK;

}


BOOL CSfxModelMng::SubData( OBJID objID, const char* szBone )
{
	//秦寸 夯俊 傅农登绢 乐绰 葛电 sfx甫 昏力茄促.
	BOOL bOK = FALSE;
	SfxModelSetIter finder = _cDatas.find( objID );
	if( finder != _cDatas.end() )
	{
		SMSVector& kSubData = finder->second;

		for( SMSVector::iterator iter = kSubData.begin(); iter != kSubData.end(); /*none*/ )
		{
			SfxModelSet* pSfx = *iter;

			if( pSfx->_idMaster == objID )
			{
				if( 0 == strcmp( pSfx->_szBone, szBone ) )
				{
					SAFE_DELETE( pSfx );
					iter = kSubData.erase( iter );

					bOK = TRUE;		//ok 茫酒�* 瘤奎澜.
				}
				else ++iter;
			}
		}
	}

	return bOK;
}

void CSfxModelMng::Update( )
{
	if( !_cWaitingObj.empty() )
	{
		for( map<DWORD,int>::iterator iter = _cWaitingObj.begin(); iter != _cWaitingObj.end(); ++iter )
		{
			CMover* pMover = prj.GetMover( iter->first );
			if( pMover )
			{
				int nState = iter->second;
				pMover->m_pActMover->RemoveStateFlag( nState );		//哗绊
				pMover->m_pActMover->AddStateFlag( nState );		//持栏搁 lua啊 惯悼
			}
		}

		_cWaitingObj.clear();
	}

	for( SfxModelSetIter iter = _cDatas.begin(); iter != _cDatas.end();  )
	{
		SMSVector& cSMS = iter->second;

		//sub loop
		for( SMSVector::iterator iter2 = cSMS.begin(); iter2 != cSMS.end();  )
		{
			SfxModelSet* pData = *iter2;
			if( !pData->Update() )
			{
				SAFE_DELETE( pData );
				iter2 = cSMS.erase( iter2 );
			}
			else 
				++iter2;
		}

		// main loop
		if( cSMS.empty() )
			_cDatas.erase( iter++ );
		else ++iter;
	}
}

void CSfxModelMng::Render( LPDIRECT3DDEVICE9 pd3dDevice )
{
	for( SfxModelSetIter iter = _cDatas.begin(); iter != _cDatas.end(); ++iter )
	{
		SMSVector& cSMS = iter->second;
	//	for_each( cSMS.begin(), cSMS.end(), bind2nd( mem_fun( &SfxModelSet::Render ), pd3dDevice ) );

		for( SMSVector::iterator iter2 = cSMS.begin(); iter2 != cSMS.end(); ++iter2 )
		{
			SfxModelSet* pData = *iter2;
			pData->Render( pd3dDevice );
		}
	}
}


///////////////////////////////////////////////////////////////////////////////////////////
// lua for sfx

lua_State* g_SfxLua = NULL;

int call_sfx( lua_State* L )
{
	// 风酒俊�* call ( lua glue )
	int n = lua_gettop( L ); 

	int who = lua_tointeger( L, 1 );				// master id
	int nKind = lua_tointeger( L, 2 );				// kind of the effect
	const char* szSfx = lua_tostring( L, 3 );		// sfx
	const char* szBone = lua_tostring( L, 4 );		// bone
	BOOL bLoop = lua_tointeger( L, 5 );				// is loop ?
	int nState = lua_tointeger( L, 6 );				// state ( create, battle ... )

	CMover* pMover = prj.GetMover( who );
	if( !pMover )
	{
		assert( 0 );
		return 0;
	}

	//! 积己窍扁 傈俊 鞘洒 八荤秦具窃.
	BOOL bFull = CSfxModelMng::GetThis()->IsFull( who, szSfx, szBone );
	if( bFull )
		return 0;

	SfxModelSet* pSfxSet = new SfxModelSet( who, szSfx, szBone, bLoop, nState );
	BOOL bOK = CSfxModelMng::GetThis()->AddData( pSfxSet, TRUE );

	if( !bOK )
		SAFE_DELETE( pSfxSet );

	return 0;
}

int call_mte( lua_State* L )
{
	// 风酒俊�* call ( lua glue )
	// multitexture effect
	int n = lua_gettop( L ); 

	int who = lua_tointeger( L, 1 );				// master id
	int nKind = lua_tointeger( L, 2 );				// kind of the effect
	const char* sz2ndDDS = lua_tostring( L, 3 );	// 2nd dds

	CMover* pMover = prj.GetMover( who );
	if( !pMover )
	{
		assert( 0 );
		return 0;
	}

	if( !pMover->IsNPC( ) )
		return 0;

	CModelObject* pModel = (CModelObject*)pMover->GetModel();
	if( !pModel )
		return 0;

	CObject3D* pObj = pModel->GetObject3D( );
	if( !pObj )
		return 0;

	pObj->m_dwEffect_EX |= XE_MTE;

	char szDDS[ 64 ];
	strcpy( szDDS, sz2ndDDS );
	strcat( szDDS, ".dds" );
	BOOL bOK = pMover->SetDataMTE( pMover->GetNameO3D(), szDDS );

	if( !bOK )
		Error( "please check the mte texture %s", pMover->GetNameO3D() );

	return 0;
}

int stop_sfx_bybone( lua_State* L )
{
	//2010_05_10 gmpbigsun : 老窜 父甸绢躇蝶.. 趣矫唱 绢恫惑怕啊 场唱搁 绢恫夯俊 傅农等 sfx父 瘤快绊酵阑锭甫 措厚秦�*..
	int n = lua_gettop( L );

	int who = lua_tointeger( L, 1 );
	const char* szBone = lua_tostring( L, 2 );

	CMover* pMover = prj.GetMover( who );
	if( !pMover )
	{
		assert( 0 );
		return 0;
	}

	BOOL bOK = CSfxModelMng::GetThis()->SubData( who, szBone );

	return bOK;
}

void open_lua_sfx()
{
	if( !g_SfxLua )
 	{
		g_SfxLua = lua_open();
//		luaL_openlibs(g_SfxLua);

		// push function
		lua_register( g_SfxLua, "call_sfx", call_sfx );
		lua_register( g_SfxLua, "call_mte", call_mte );
	}
}

void close_lua_sfx()
{
	if( g_SfxLua )
		lua_close( g_SfxLua );
}


void run_lua_sfx( int nState, OBJID caller, const char* szMoverName )
{
	static const CString strPATH( "SFX\\Scripts\\" );
	static const CString strFORMAT(".lua");

	// setup 
	if( !g_SfxLua )
		open_lua_sfx( );

	// caller绰 公滚父 瘤盔茄促. 泅犁 2010_0204
	CMover* pWho = prj.GetMover( caller );
	if( !pWho )
	{
		// 褥 积己捞 登绰档吝 阂副荐啊 乐促. 捞繁版快绰 prj俊�* 给谩阑帛捞骨肺 殿废惑怕肺 滴绊 促澜 橇饭烙俊 矫档茄促.
		CSfxModelMng::GetThis()->_cWaitingObj.insert( map< DWORD, int >::value_type( caller, nState ) );
		return;
	}

	char szFunc[ 64 ];
	GetFileTitle( szMoverName, szFunc );
	CString strFileName = CString( szFunc ) + strFORMAT;
	CString strFullPath = strPATH + strFileName;
	
	// res甫 秒鞭窍绰 抛挤 棺 沥挤篮 buffer甫 掘绢客�* 风酒甫 倒府磊 
#ifdef __BS_EFFECT_LUA
	if( 0 != luaL_dofile( g_SfxLua, strFullPath.GetBuffer(0) ) )
	{
	//	Error( "run_lua_sfx : %s", (char*)lua_tostring( g_SfxLua, -1 ) );
		return;
	}
#else
	// res肺 merge等 颇老篮 CResFile阑 捞侩秦 滚欺甫 掘绊 风酒甫 龋免 
	CResFile file;
	BOOL bRet = file.Open( strFullPath.GetBuffer(0), "rt" );
	if( bRet == FALSE )	
	{
		Error( "run_lua_sfx : %s 佬扁 角菩", strFullPath.GetBuffer(0) );
		return;
	}

	static char pBuff[ 2048 ];
	int nLength = file.GetLength();
	if( nLength > 2047 )
	{
		Error( "error!! overflowed size of lua file %s", strFullPath.GetBuffer(0) );
		return;
	}

	if( nLength < 2 )		// 粮犁捞蜡啊 绝绰 辨捞 捞促 .
		return;

	pBuff[ 0 ] = 0;
	file.Read( pBuff, nLength );
	pBuff[ nLength ] = 0;
	
	// TODO : buffer甫 掘绢客�* call lua
	int a = luaL_loadbuffer( g_SfxLua, pBuff, nLength, NULL );
	int b = lua_pcall(g_SfxLua, 0, LUA_MULTRET, 0);

	if( (a | b) != 0 )
	{
		Error( "error run_lua_sfx : %s", (char*)lua_tostring( g_SfxLua, -1 ) );
		return;
	}
#endif// __BS_EFFECT_LUA

	//父距 阁胶磐俊 措秦�* 老馆利牢 lua甫 利侩窍绊, 漂喊茄 版快父 阁胶磐俺俺牢俊 措秦�* lua甫 瘤沥茄促搁 
	// 快急鉴困绰 漂喊洒 瘤沥等版快促 ,

	if( OBJSTAF_COMBAT == nState )
		strcat( szFunc, "_battle" );
	else
	if( OBJSTA_NONE == nState ) 
	{
		//积己惑怕肺 埃林茄促.. 溜 积己登绊 酒公巴档 酒囱惑怕鄂 吧肺 秦籍窍扁 官恩.
		strcat( szFunc, "_create" );
	}
	else
	{
		Error( "SFXLUA is not supported the state : %d ", nState );
		return;
	}

	lua_getglobal( g_SfxLua, szFunc );
	lua_pushnumber( g_SfxLua, caller );

//	lua_call( g_SfxLua, 1, 0 ) ;

//_DEBUG
	if( lua_pcall( g_SfxLua, 1, 0, 0 ) != 0 ) 
	{
		char* szError = (char*)lua_tostring( g_SfxLua, -1 );
		Error( "run_lua_sfx : %s", szError );
	}
}

BOOL stop_sfx( OBJID caller )
{
	return CSfxModelMng::GetThis()->SubData( caller );
}

#endif //__BS_EFFECT_LUA
Geht zu der Datei sfxbase.h und sucht nach
Code:
HRESULT DeleteDeviceObjects();
};
Und f黦t genau darunter das ein
Code:
#ifdef __BS_EFFECT_LUA

void open_lua_sfx();
void close_lua_sfx();

void run_lua_sfx( int nState, OBJID caller, const char* szMoverName );

//for lua glue
struct lua_State;
static int call_sfx( lua_State* L );
static BOOL stop_sfx( OBJID caller );

// 磊眉 update 
struct SfxModelSet
{
	SfxModelSet( ) : _idMaster(0), _pModel(NULL), _bLoop(FALSE), _nMaxFrame(0), _nState(0) { }
	SfxModelSet( const OBJID idMaster, const char* szSfxName, const char* szBoneName, BOOL bLoop, int _nState );
	
	~SfxModelSet( );

	BOOL Update( );
	BOOL Render( LPDIRECT3DDEVICE9 pd3dDevice );
	
	OBJID _idMaster;
	char _szBone[ 64 ];
	char _szFileName[ 64 ];
	int _nMaxFrame;
	BOOL _bLoop;
	CSfxModel* _pModel;

	int _nState;		//惑怕 : 绢恫惑怕老锭 惯悼登绰 瓤苞牢瘤

};

typedef vector< SfxModelSet* >					SMSVector;				//SMS : SfxModelSet
typedef map< OBJID, SMSVector >					SfxModelSetContainer;
typedef SfxModelSetContainer::iterator			SfxModelSetIter;

//gmpbigsun(100128 ) : Lua俊�* 龋免茄 sfx( 葛电 加己捞 data肺 粮犁窍绰 ) 包府磊
// bone 俊 傅农登绢 loop登绰 捞棋父 瘤盔茄促. 
class CSfxModelMng 
{
public:
	CSfxModelMng( );
	~CSfxModelMng( );

	BOOL AddData( SfxModelSet* pData, BOOL bChecked );				
	BOOL SubData( OBJID objID );						//秦寸 坷宏璃飘狼 葛电 lua包访 sfx昏力 
	BOOL SubData( OBJID objID, const int nState );		//秦寸 坷宏璃飘狼 葛电 惑怕俊 秦寸窍绰 sfx昏力
	BOOL SubData( OBJID objID, const char* szBone );	//秦寸 坷宏璃飘狼 秦寸 夯俊 傅农等 葛电 sfx昏力
	
	void Update( );
	void Render( LPDIRECT3DDEVICE9 pd3dDevice );

	BOOL IsFull( OBJID objID, const char* szSfx, const char* szBone );	//optimized 

	static CSfxModelMng* GetThis();
	static void Free();

public:
	map< DWORD, int > _cWaitingObj;

private:
	static CSfxModelMng* _pThis;

	SfxModelSetContainer	_cDatas;
};


#endif //__BS_EFFECT_LUA
Geht zu der Datei ModelGlobal.h und sucht nach
Code:
#define XE_ITEM_GEN_AL		(0x00100000)		// Ultimate侩
#endif //__Y_ADV_ENCHANT_EFFECT
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
#define XE_MTE				(0x00200000)		// multi texturing effect
#endif //__BS_EFFECT_LUA
Geht zu der Datei ModelObject.cpp und sucht nach
Code:
D3DXVec3TransformCoord( &v1, &v1, &mWorld );
	*vOut = v1;
	
}
Und f黦t genau darunter
Code:
#ifdef __BS_EFFECT_LUA
BOOL CModelObject::GetPosBone( D3DXVECTOR3* pOut, const char* bonename )
{
	//gmpbigsun : 夯捞抚栏肺 夯谅钎 眠免 
	for( int i =0; i < m_pBone->m_nMaxBone; ++i )
	{
		BONE* pUnitBone = m_pBone->GetBone( i );
		if( !pUnitBone )
		{
			assert( 0 );
			continue;
		}

		if( strcmp( bonename, pUnitBone->m_szName ) == 0 )
		{
			D3DXMATRIX matTemp;
			if( pUnitBone->m_pParent )
				D3DXMatrixMultiply( &matTemp, &pUnitBone->m_mLocalTM, &m_mUpdateBone[ pUnitBone->m_nParentIdx ] );
			else 
				D3DXMatrixMultiply( &matTemp, &pUnitBone->m_mLocalTM, &m_mUpdateBone[ i ] );

			pOut->x = matTemp._41;
			pOut->y = matTemp._42;
			pOut->z = matTemp._43;

			return TRUE;
		}
	}

	return FALSE;
	
}

#endif //__BS_EFFECT_LUA
Geht zu der Datei ModelObject.h und sucht nach
Code:
// virtual
	int LoadModel( LPCTSTR szFileName ) { return LoadElement( szFileName, 0 ); }
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	BOOL CModelObject::GetPosBone( D3DXVECTOR3* pOut, const char* bonename );
#endif
Geht zu der Datei Object3D.cpp und sucht nach
Code:
#ifdef __YENV
	m_pNormalDecl	= NULL;
#endif //__YENV
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	m_dwEffect_EX = 0;

	m_pMteData = NULL;
#endif;
Sucht nach
Code:
SAFE_DELETE_ARRAY( m_pBaseBone );
SAFE_DELETE( m_pMotion );
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	m_dwEffect_EX = 0;

	SAFE_DELETE( m_pMteData );
#endif;
Sucht nach
Code:
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR  );
		}
		
	}
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	if( nEffect & XE_MTE )
	{
		//animated texcoord ( alpha map - subtract )
   
		//check data
		if( !m_pMteData )
			return;

		m_pd3dDevice->SetSamplerState( 1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
        m_pd3dDevice->SetSamplerState( 1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
		
		//D3DRS_ALPHATESTENABLE波拎具 喉坊爹 瓤苞甫 扁措且荐乐促.
		m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
		m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	    
		m_pd3dDevice->SetTexture( 0, m_pMteData->_pTex[0] );

//		m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );
//		m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
//		m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR  );

		m_pd3dDevice->SetTexture( 1, m_pMteData->_pTex[1] );

		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_ADDSIGNED2X );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_SUBTRACT );

		// 20sec : 1.0f
		// 酒贰绰 tool俊�* 备泅等 巴苞 促弗单, 角力霸烙俊�*绰 矫埃栏肺 弊 荐摹甫 沥窍绊 乐扁 锭巩捞促. 
		// tool俊�*绰 咯矾 俺眉荐甫 剁匡鞘夸啊 绝扁俊 矫埃措脚 惑荐甫 荤侩窍看促.
		
		extern DWORD g_timeMTE;	// 20檬 盎脚侩 鸥捞赣
		float fUV = (float)(g_timeMTE * 0.00005f);
		m_pMteData->_kUV[0].x = fUV;
		m_pMteData->_kUV[0].y = fUV;

		if( m_pMteData->_kUV[0].x > 1.0f )
			m_pMteData->_kUV[0] = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
		m_pd3dDevice->SetVertexShaderConstantF( 91, (float*)&m_pMteData->_kUV[0], 1 );		//texture uv ( skinning2.vsh )


		if( g_timeMTE < 11000 ) // �*�*洒 灌酒瘤霸 窍磊
		{
			float v = (float)(g_timeMTE * 0.0001f);
			m_pMteData->_kUV[1] = D3DXVECTOR3( v, v, v );
		}
		else 
		{
			float v = (float)( ( 22000 - g_timeMTE ) * 0.0001f );
			m_pMteData->_kUV[1] = D3DXVECTOR3( v, v, v );
		}
	
		////light
		m_pd3dDevice->SetVertexShaderConstantF( 93, (float*)&m_pMteData->_kUV[1], 1 );
		m_pd3dDevice->SetVertexShaderConstantF( 94, (float*)&m_pMteData->_kUV[1], 1 );
	}
	else 
	
#endif //__BS_EFFECT_LUA
Sucht nach
Code:
if( (pBlock->m_dwEffect & XE_BUMP) || (nEffect & XE_BUMP) )
	{
		if( m_nNoEffect )	return;
		int a = 0;
	}
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	if( nEffect & XE_MTE )
	{
		if( m_nNoEffect ) 
			return;

		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1 );	
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
		m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
	}
#endif //__BS_EFFECT_LUA
Sucht nach
Code:
SetState( pBlock, nEffect, dwBlendFactor );
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
		if( XE_MTE != nEffect)
#endif //__BS_EFFECT_LUA
Sucht nach
Code:
if( pObj->m_Type == GMT_SKIN )
		{
			if( ppd3d_VB == NULL )
				Error( "CObject3D::Render : %s 胶挪坷宏璃飘牢单 ppd3d_VB啊 绝促.", m_szFileName );

			RenderSkin( pd3dDevice, ppd3d_VB[i], pObj, mWorld, nEffect, dwBlendFactor );
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
			if( m_dwEffect_EX & XE_MTE )
				RenderSkin( pd3dDevice, ppd3d_VB[i], pObj, mWorld, XE_MTE, dwBlendFactor );
#endif //__BS_EFFECT_LUA
Geht zu der Datei Object3D.h und sucht nach
Code:
int		m_nUseCnt;		// 割锅 傍蜡登绢 荤侩登菌绰啊.	

	FLOAT	m_fAmbient[3];
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	DWORD m_dwEffect_EX;	// Render effect 犬厘

	struct MTE_DATA	// Multi Texturing Effect
	{
		MTE_DATA() { _pTex[ 0 ] = NULL; _pTex[ 1 ] = NULL; _kUV[0] = D3DXVECTOR3( 0.f, 0.f, 0.f ); _kUV[1] = D3DXVECTOR3( 0.f, 0.f, 0.f ); }
		LPDIRECT3DTEXTURE9 _pTex[2];
		D3DXVECTOR3 _kUV[2];
	};
	MTE_DATA* m_pMteData;
#endif //__BS_EFFECT_LUA
Geht zu der Datei World.cpp und sucht nach
Code:
#if __VER >= 15 // __BS_CHANGING_ENVIR
	m_strCurContName = "";
#endif
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	CSfxModelMng::Free( );
#endif	//__BS_EFFECT_LUA
Sucht nach
Code:
if( ((CMover *)pObj)->GetId() == m_idObjFocusOld )
			{
				SetObjFocus( pObj );
			}
		}
	}
Und f黦t genau darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	
	// 积己矫痢俊�* 积己包访 Effect 贸府( NPC only!! )
	if( OT_MOVER == pObj->GetType() )
	{
		CMover* pMover = static_cast< CMover* > ( pObj );
		
		if( pMover->IsNPC() )
			run_lua_sfx( OBJSTA_NONE, pMover->GetId(), pMover->GetNameO3D() );
	}

#endif //__BS_EFFECT_LUA
Sucht nach
Code:
#else //__WATER_EXT
	CLandscape::m_fWaterFrame += 0.15f;
	
	if( CLandscape::m_fWaterFrame >= 54.0f )
		CLandscape::m_fWaterFrame = 0.0f;	
#endif //__WATER_EXT
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	CSfxModelMng::GetThis()->Update();
#endif	//__BS_EFFECT_LUA
Geht zu der Datei World3D.cpp und sucht nach
Code:
RenderGrid();
		
		// 坷宏璃飘 罚歹傅 
		RenderObject( pFont );
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
		CSfxModelMng::GetThis()->Render( m_pd3dDevice );
#endif //__BS_EFFECT_LUA
Geht zu der Datei path.h und sucht nach
Code:
#define DIR_LOGO         _T( "Model\\Logo\\"   )
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
#define DIR_SFXLUA		 _T( "Sfx\\Scripts\\" )
#endif //__BS_EFFECT_LUA
Geht zu der Datei timer.cpp und sucht nach
Code:
///////////////////////////////////////////////
DWORD	m_lTime, m_dwOldTime;
Und f黦t darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
DWORD g_timeMTE = 0;
#endif;


static BOOL	s_bFrameSkip = TRUE;

void InitFST( void )
{
	m_lTime = 0;
	m_dwOldTime = timeGetTime();
	s_bFrameSkip = TRUE;
}

// 橇饭烙 胶虐俏阑 难绊/馋促
void	SetFrameSkip( BOOL bFlag )
{
	s_bFrameSkip = bFlag;
	if( bFlag == TRUE )		InitFST();
}

// 泅犁 敲贰弊 倒妨淋
BOOL	GetFrameSkip( void )
{
	return s_bFrameSkip;
}

static void UpdateTime( void )
{
	DWORD	dwTime = timeGetTime();

	m_lTime += (dwTime - m_dwOldTime);	// 版苞等 矫埃阑 歹窃
	if( m_lTime > 1000 )	m_lTime = 1000;

#ifdef __BS_EFFECT_LUA
	g_timeMTE += ( dwTime - m_dwOldTime );
	if( g_timeMTE > 20000 )	//20檬付促 盎脚
		g_timeMTE = 0;
#endif //__BS_EFFECT_LUA
Geht zu der Datei Action.cpp und sucht nach
Code:
void	CAction::AddStateFlag( DWORD dwFlag ) 
{
Und f黦t genau darunter das ein
Code:
#ifdef __BS_EFFECT_LUA
	//惑怕啊 眠啊瞪 版快 弥檬牢版快俊 瓤苞甫 惯积矫挪促.
	if( dwFlag & OBJSTAF_COMBAT && !IsStateFlag( OBJSTAF_COMBAT ) )	
	{
		// 父距 傈捧惑怕肺 贸澜 倒涝窍绰芭扼搁 惑怕喊 瓤苞甫 龋免茄促. 老窜 npc幅父 
		if( m_pMover->IsNPC( ) )
			run_lua_sfx( OBJSTAF_COMBAT, m_pMover->GetId(), m_pMover->GetNameO3D() );
	}
#endif //__BS_EFFECT_LUA
Sucht nach
Code:
void	CAction::RemoveStateFlag( DWORD dwFlag )
{
Und f黦t genau das darunter
Code:
#ifdef __BS_EFFECT_LUA
	// 惑怕啊 秦力瞪版快 lua俊�* 龋免茄 葛电 惑怕瓤苞甫 秦力茄促.
	if( dwFlag & OBJSTAF_COMBAT )
	{
		//傈捧 惑怕瓤苞 秦力
		CSfxModelMng::GetThis()->SubData( m_pMover->GetId(), OBJSTAF_COMBAT );
	}
#endif //__BS_EFFECT_LUA
Die Lua磗 sind im Anhang.
Das ist mein erster release also seid nicht so streng zu mir :p
12/01/2011 20:14 Jopsi332#2
benutz mal spoiler ;D
12/01/2011 20:15 N8Schatten#3
Und was Fixxed man damit? (Denn Source is ja errorfrei soweit ich wei�)
12/01/2011 20:15 .Crasy#4
Was ist denn das f黵 ne Schei遝 rofl.

Ich musste nur eine Zeile 鋘dern und es Funktionierte auf einmal, wups, was denn da Falsch?
12/01/2011 20:19 Pixelfehler#5
Quote:
Originally Posted by .Crasy View Post
Was ist denn das f黵 ne Schei遝 rofl.
Ich musste nur eine Zeile 鋘dern und es Funktionierte auf einmal, wups, was denn da Falsch?
Dumm in Kopf?? Er fragte ob jemand seine fertigen Snippets gibt.
Hier nochmal f黵 blinde
Quote:
Originally Posted by guardianangel View Post
Kann wer seine Gefixxten Snippets Posten ?
W鋜 Echt Sexieh
:D
@Jopsi332 Werde ich nachher noch tuen ;)
12/01/2011 20:22 killerooo#6
am besten erw鋒nst du jetzt noch von wem du es hast, sieht stark nach dem aus was ich gemacht hatte.
12/01/2011 20:24 Pixelfehler#7
Quote:
Originally Posted by killerooo View Post
am besten erw鋒nst du jetzt noch von wem du es hast, sieht stark nach dem aus was ich gemacht hatte.
Ich glaube nicht das es von dir kommt :handsdown:
12/01/2011 20:30 .Crasy#8
Bei dem SFX Lua shit muss man nur EINE zeile 鋘dern, wenn du 0 Hirn hast lass es.

Ich verwett du verstehst nicht mal dne Halben code wo du oben gepostet hast weil du es von i wem C&P hast.
12/01/2011 20:35 .Tear#9
Right, das __INTERNALSERVER bei nem __BS_EFFECT_LUA ifdef oder?
12/01/2011 20:38 Pixelfehler#10
Quote:
Originally Posted by .Crasy View Post
Bei dem SFX Lua shit muss man nur EINE zeile 鋘dern, wenn du 0 Hirn hast lass es.

Ich verwett du verstehst nicht mal dne Halben code wo du oben gepostet hast weil du es von i wem C&P hast.
Ach Crasy ich muss mich bei dir nicht rechtfertigen was ich kann bzw versteh das las mal meine Sorge sein.Der Release soll ja auch nur f黵 die Leute sein die es 黚erhaupt nicht hinbekommen. Und C&P ?! Zeig mir ein Source der Releast wurden ist wo es zu 100% geht?
;)
12/01/2011 20:46 Clept0#11
Quote:
Originally Posted by Pixelfehler View Post
Ach Crasy ich muss mich bei dir nicht rechtfertigen was ich kann bzw versteh das las mal meine Sorge sein.Der Release soll ja auch nur f黵 die Leute sein die es 黚erhaupt nicht hinbekommen. Und C&P ?! Zeig mir ein Source der Releast wurden ist wo es zu 100% geht?
;)
Trozdem ist es 黚erm鋝sig sinnlos soviele snippets zuposten, wo es vollkommen ausreicht EINE zeile zu鋘dern. Ist lieb gemeint, aber einfach stroh dumm.
12/01/2011 21:20 killerooo#12
Stimmt du hast Recht es ist nicht meins es wird auch nicht funktionieren!
12/01/2011 21:21 guardianangel#13
Das Funzt aber nich

C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_AIInterface\Action.cpp(37): error C2039: 'GetNameO3D' : is not a member of 'CMover'
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_AIInterface\Action.cpp(37): error C3861: 'run_lua_sfx': identifier not found, even with argument-dependent lookup
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_AIInterface\Action.cpp(50): error C2653: 'CSfxModelMng' : is not a class or namespace name
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_AIInterface\Action.cpp(50): error C2227: left of '->SubData' must point to class/struct/union
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_AIInterface\Action.cpp(50): error C3861: 'GetThis': identifier not found, even with argument-dependent lookup
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11943): error C2039: 'GetNameO3D' : is not a member of 'CMover'
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11945): error C2065: 'm_pModel' : undeclared identifier
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11945): error C2227: left of '->GetObject3D' must point to class/struct/union
type is ''unknown-type''
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11955): error C2039: 'SetDataMTE' : is not a member of 'CMover'
..\_Common\Mover.h(464) : see declaration of 'CMover'
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11960): error C2227: left of '->GetObject3D' must point to class/struct/union
type is ''unknown-type''
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11960): error C3861: 'm_pModel': identifier not found, even with argument-dependent lookup
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11976): error C2653: 'TexturePool' : is not a class or namespace name
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11976): error C2227: left of '->GetTexture' must point to class/struct/union
type is ''unknown-type''
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11976): error C3861: 'Get': identifier not found, even with argument-dependent lookup
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11977): error C2653: 'TexturePool' : is not a class or namespace name
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11977): error C2227: left of '->GetTexture' must point to class/struct/union
type is ''unknown-type''
C:\Users\Administrator\Desktop\Flyff\BF Source\Source\_Common\Mover.cpp(11977): error C3861: 'Get': identifier not found, even with argument-dependent lookup
12/01/2011 21:42 clinkz96#14
can you post some screen shot sir? of ur release?
12/01/2011 21:45 Pixelfehler#15
[Only registered and activated users can see links. Click Here To Register...]