Release __BS_EFFECT_LUA FIXXED

12/02/2011 12:58 .Crasy#31
Das ist nicht das, was ich meine. :>

Such das fopen darunter.
12/02/2011 13:40 Sekkusu[DW]#32
Quote:
Originally Posted by .Crasy View Post
Das ist nicht das, was ich meine. :>

Such das fopen darunter.
Ju, meinte deine Beschreibung wegen Path un so.

Bzw, ich würde gern mal wissen was bei manchen nicht geht o.O
12/02/2011 15:37 guardianangel#33
also nach

static const CString strPATH( "SFX\\Scripts\\" );
static const CString strFORMAT(".lua");
char szFunc[ 64 ];
GetFileTitle( szMoverName, szFunc );
CString strFileName = CString( szFunc ) + strFORMAT;
CString strFullPath = strPATH + strFileName;

suchen
und das Internal Server in Client ändern ?
Das klingt zu leicht aber mal schaun obs funzt xD



edit :

Tatsache ...
Echt Einfach ....
Vielen Dan Crasy
12/09/2011 14:38 Ultimate™#34
ich verstehs nicht mein pfad ist jetzt z.B SFX/Scripts so wie es im source steht bei mir und trotzdem gehts nicht :x
12/09/2011 15:43 guardianangel#35
schau dir doch bitte meinen Post an dann weisst du wie mans Fixxt ^^
Dieses Release hier ist eher ein Fail ...
Aber wie über deinem Post steht ...
Den Abschnitt musst du finden
ein kleines Stück darunter findest du eine Define ...
wo InternalServer steht ...
daraus machst du Client
weil der Server nix damit zu tun hat ^^
12/09/2011 19:03 greenmong#36
Hab nun InternalServer zu #ifdef __Client geändert aber nun kommt der error run_lua_sfx : attempt to call a nil value
12/09/2011 20:07 Achileus#37
schreib mal alles groß so CLIENT
12/09/2011 20:12 greenmong#38
ist es
Quote:
#ifdef __CLIENT
if( m_nTexFrame > 1 )
{ // ÅØ½ºÃÄ ¾Ö´Ï¸ÞÀ̼ÇÀÏ °æ¿ì
SfxKeyFrame* pFirstKey=GetNextKey(0);
if(nFrame<pFirstKey->nFrame) return;
int nTexFrame= (m_nTexFrame*(nFrame-pFirstKey->nFrame)/m_nTexLoop)%m_nTexFrame; // ÀÌ ÇÁ·¹ÀÓ¿¡¼* Ãâ·ÂÇÒ ÅØ½ºÃÄ ¹øÈ£
CSfxMng::m_pd3dDevice->SetTexture(0,g_SfxTex.Tex(GetTextureName(m_strTex ,nTexFrame)));
}
else
CSfxMng::m_pd3dDevice->SetTexture( 0, g_SfxTex.Tex( m_strTex ) );
SfxKeyFrame* pPrevKey = GetPrevKey( nFrame );
SfxKeyFrame* pNextKey = GetNextKey( nFrame );
if( pPrevKey == NULL || pNextKey == NULL ) return;
SfxKeyFrame Key;
int dFrame = pNextKey->nFrame-pPrevKey->nFrame;
Key = *(pPrevKey);
// ¾ÕµÚ keyframeÀ» »öÃâÇÏ¿© ÇöÀç ۰ªÀ» »êÃâÇØ ³½´Ù.
if( dFrame != 0 )
{
Key.vPos += (pNextKey->vPos - pPrevKey->vPos) * (FLOAT)( (nFrame - pPrevKey->nFrame) ) / (FLOAT)( dFrame );
Key.vPosRotate += (pNextKey->vPosRotate - pPrevKey->vPosRotate) * (FLOAT)( (nFrame - pPrevKey->nFrame) ) / (FLOAT)( dFrame );
Key.vRotate += (pNextKey->vRotate - pPrevKey->vRotate) * (FLOAT)( (nFrame - pPrevKey->nFrame) ) / (FLOAT)( dFrame );
Key.vScale += (pNextKey->vScale - pPrevKey->vScale) * (FLOAT)( (nFrame - pPrevKey->nFrame) ) / (FLOAT)( dFrame );
Key.nAlpha += (pNextKey->nAlpha - pPrevKey->nAlpha) * (nFrame - pPrevKey->nFrame)/dFrame;
}

D3DXMATRIX matTemp,matTemp1,matTemp2;
D3DXMATRIX matTrans,matAngle,matScale,matInv;
D3DXVECTOR3 vTemp;
D3DXVECTOR3 vScaleTemp = vScale;
vScaleTemp.x *= Key.vScale.x;
vScaleTemp.y *= Key.vScale.y;
vScaleTemp.z *= Key.vScale.z;
// ÅØ½ºÃÄ Å¸ÀÔ¿¡ µû¶ó world ¸ÅÆ®¸¯½º¸¦ ¼³Á¤ÇÑ´Ù
switch(m_nBillType)
{
case SFXPARTBILLTYPE_BILL: // ºôº¸µåÀ̸é
{ // ¹«Á¶°Ç È*¸éÀ» Á¤¸éÀ¸·Î ¹Ù¶óº¸°Ô ÇÑ´Ù.
D3DXMatrixRotationZ( &matAngle, DEGREETORADIAN( Key.vRotate.z ) );
D3DXMatrixScaling( &matScale, vScaleTemp.x, vScaleTemp.y, vScaleTemp.z );
matTemp2=g_matView; matTemp2._41=matTemp2._42=matTemp2._43=.0f;
// D3DXMatrixInverse(&matInv,NULL,&matTemp2);
matTemp=matScale*matAngle*g_matInvView;
break;
}
case SFXPARTBILLTYPE_BOTTOM: // ¹Ù´Ú¿¡ ±ò¸®´Â ³ðÀ̸é
{ // xÃàÀ¸·Î 90µµ µ¹¸°´Ù.
D3DXMatrixRotationZ( &matAngle, DEGREETORADIAN( Key.vRotate.z - fAngle.z ) );
D3DXMatrixScaling( &matScale, vScaleTemp.x, vScaleTemp.y, vScaleTemp.z );
D3DXMatrixRotationX( &matTemp2,DEGREETORADIAN( 90 ) );
matTemp = matScale * matAngle * matTemp2;
break;
}
case SFXPARTBILLTYPE_POLE:
{ // ÀÌ°Ç ±âµÕÀε¥ ¾ÆÁ÷ ¾ÈÇß´Ù.
D3DXMatrixRotationZ( &matAngle, DEGREETORADIAN( Key.vRotate.z ) );
D3DXMatrixScaling( &matScale, vScaleTemp.x, vScaleTemp.y, vScaleTemp.z );
matTemp2 = g_matView; matTemp2._41 = matTemp2._42 = matTemp2._43 = .0f;
// D3DXMatrixInverse(&matInv,NULL,&matTemp2);
matTemp = matScale * matAngle * g_matInvView;
break;
}
case SFXPARTBILLTYPE_NORMAL: // º¸ÅëÀ̸é.
{ // ±×³É º¸Åë ¿ÀºêÁ§Æ®Ã³·³...
D3DXMATRIX mRot;
D3DXVECTOR3 vRot = DEGREETORADIAN(fAngle);
D3DXVECTOR3 vTemp2=DEGREETORADIAN( Key.vRotate );
D3DXMatrixRotationYawPitchRoll( &matAngle, vTemp2.y, vTemp2.x, vTemp2.z );
D3DXMatrixRotationYawPitchRoll(&mRot,vRot.y,vRot.x ,vRot.z);
D3DXMatrixScaling( &matScale, vScaleTemp.x, vScaleTemp.y, vScaleTemp.z );
matTemp = matScale * matAngle * mRot;
break;
}
}
D3DXMATRIX mRot;
D3DXVECTOR3 vRot = DEGREETORADIAN(fAngle);
D3DXVECTOR3 vTemp2=DEGREETORADIAN(Key.vPosRotate); // À§Ä¡È¸Àü°ª¿¡ ÀÇÇÑ »õ·Î¿î À§Ä¡µµ °è»êÇϰí
D3DXMatrixRotationYawPitchRoll(&matTemp2,vTemp2.y, vTemp2.x,vTemp2.z);
D3DXMatrixRotationYawPitchRoll(&mRot,vRot.y,vRot.x ,vRot.z);

matTemp2 = mRot * matTemp2;

D3DXVec3TransformCoord(&vTemp,&Key.vPos,&matTemp2) ;
D3DXMatrixTranslation( &matTrans,
vPos.x + ( vTemp.x * vScale.x ),
vPos.y + ( vTemp.y * vScale.y ),
vPos.z + ( vTemp.z * vScale.z )
);
matTemp1=matTemp*matTrans;

switch(m_nAlphaType) { // ¾ËÆÄÀÇ ¿ëµµ¿¡ µû¶ó ·»´õ ½ºÅ×ÀÌÆ®¸¦ ¹Ù²ãÁØ´Ù
case SFXPARTALPHATYPE_BLEND: // ºí·»µåÀ̸é
{ // ¹ÝÅõ¸í ¼³Á¤À¸·Î...
CSfxMng::m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
break;
}
case SFXPARTALPHATYPE_GLOW: // ±Û·Î¿ì¸é
{ // ¹«Á¶°Ç ´õÇϴ°ɷÎ...
CSfxMng::m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
break;
}
}

// ´Ù¸¥ partµéµµ ±âº»ÀûÀ¸·Î ÀÌ¿Í ºñ½ÁÇÏ°Ô Ã³¸®ÇÑ´Ù.

// D3DXMATRIX matWorld;
// CSfxMng::m_pd3dDevice->GetTransform(D3DTS_WORLD,&matWorld);
CSfxMng::m_pd3dDevice->SetTransform(D3DTS_WORLD,&matTemp1);
CSfxMng::m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, Key.nAlpha<<24 | 0x404040 );

CSfxMng::m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, 2); // ÀÌÁ¦ ¼³Á¤ ´ÙÇßÀ¸´Ï ±×·Á¾ßÁö
// CSfxMng::m_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);
#endif //__CLIENT
12/10/2011 20:56 greenmong#39
Hallo ?
01/14/2012 08:03 greenmong#40
kann mir jemand seine sfxbase.cpp hochladen
01/14/2012 12:54 guardianangel#41
static const CString strPATH( "SFX\\Scripts\\" );
static const CString strFORMAT(".lua");
char szFunc[ 64 ];
GetFileTitle( szMoverName, szFunc );
CString strFileName = CString( szFunc ) + strFORMAT;
CString strFullPath = strPATH + strFileName;


NACH DIESEM ABSCHNITT !
Das Nächste InternalServer zu __CLIENT !!!
01/14/2012 13:32 greenmong#42
hab ich
Quote:
///////////////////////////////////////////////////////////////////////////////////////////
// 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 __CLIENT
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 //__CLIENT

//¸¸¾à ¸ó½ºÅÍ¿¡ ´ëÇØ¼* ÀϹÝÀûÀÎ 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
01/14/2012 21:07 guardianangel#43
hmmm dann nimm einfach mal nen Releasden Source &hol dir da die Datei raus und machs erneut
01/14/2012 23:43 greenmong#44
Hab schon mit dem RoC,b & clean probiert

hier emiene errors
Code:
2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value

2012/ 1/15   09:42:20   run_lua_sfx : attempt to call a nil value
01/18/2012 19:23 greenmong#45
PUSH THIS SHIT