|
You last visited: Today at 12:51
Advertisement
Day & Night system.
Discussion on Day & Night system. within the Flyff Private Server forum part of the Flyff category.
03/04/2012, 16:16
|
#1
|
elite*gold: 0
Join Date: Jan 2012
Posts: 27
Received Thanks: 2
|
Day & Night system.
I added the code released by Jopsi332 but it only changes the sky. How can i make it like this?
|
|
|
03/04/2012, 17:46
|
#2
|
elite*gold: 4
Join Date: Mar 2010
Posts: 3,148
Received Thanks: 1,535
|
use the official system
|
|
|
03/04/2012, 17:57
|
#3
|
elite*gold: 0
Join Date: Jan 2012
Posts: 27
Received Thanks: 2
|
Where's the official? Can you link me?
|
|
|
03/04/2012, 18:08
|
#4
|
elite*gold: 0
Join Date: Feb 2010
Posts: 876
Received Thanks: 470
|
Go to the WorldEnvironment.cpp and search
static const LIGHTCOLOR gs_kLight[24] = and change your values to other..Sry for my bad english xD
|
|
|
03/04/2012, 18:10
|
#5
|
elite*gold: 0
Join Date: Jan 2012
Posts: 27
Received Thanks: 2
|
What do you mean by "change your values by others" ?
|
|
|
03/04/2012, 22:43
|
#6
|
ベトナム警察
elite*gold: 725
Join Date: Jan 2012
Posts: 16,377
Received Thanks: 3,429
|
He mean you should / can changes the Values in your Values. (Your Choice)
Sorry for my bad English too. ;D
|
|
|
03/05/2012, 00:00
|
#7
|
elite*gold: 320
Join Date: Jan 2012
Posts: 1,032
Received Thanks: 573
|
Quote:
Originally Posted by rizzy.maidenF
I added the code released by Jopsi332 but it only changes the sky. How can i make it like this?
|
You go into your WorldEnvironment.cpp and replace it with this:
// Implement of CWorld
// date : 2009_09_09
// author : gmpbigsun
#include "stdafx.h"
#ifdef __CLIENT
#if __VER >= 15 // __GUILD_HOUSE
#include "WndGuildHouse.h"
#include "ResData.h"
#endif
// ¿À·¡ÀüºÎÅÍ ½á¿À´ø °ÔÀÓ³» ½Ã°£´ÜÀ§ Light color values, ÀÌ ³à¼®À» default·Î ¾´´Ù.
static const LIGHTCOLOR gs_kLight[24] = // diffuse, ambient
{
#ifdef __DAY_NIGHT
0.03f, 0.03f, 0.05f, 0.03f, 0.03f, 0.1f, // 0 12
0.03f, 0.03f, 0.05f, 0.03f, 0.03f, 0.1f, // 1
0.03f, 0.03f, 0.05f, 0.03f, 0.03f, 0.1f, // 2
0.5f, 0.5f, 0.6f, 0.4f, 0.4f, 0.4f, // 3
0.5f, 0.5f, 0.6f, 0.4f, 0.4f, 0.4f, // 4
0.5f, 0.5f, 0.6f, 0.4f, 0.4f, 0.4f, // 5
0.5f, 0.5f, 0.6f, 0.4f, 0.4f, 0.4f, // 6
0.7f, 0.7f, 0.7f, 0.5f, 0.5f, 0.5f, // 7
0.8f, 0.8f, 0.8f, 0.5f, 0.5f, 0.5f, // 8
0.9f, 0.9f, 0.9f, 0.5f, 0.5f, 0.5f, // 9
1.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, // 10
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 11
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 12
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 13 1
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 14 2
1.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, // 15 3
0.8f, 0.6f, 0.7f, 0.4f, 0.4f, 0.4f, // 16 5
0.6f, 0.4f, 0.2f, 0.4f, 0.4f, 0.3f, // 17 6
0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.3f, // 18 7
0.1f, 0.1f, 0.2f, 0.3f, 0.3f, 0.3f, // 19 8
0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.3f, // 20 8
0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.3f, // 21 9
0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.3f, // 22 10
0.2f, 0.2f, 0.2f, 0.3f, 0.3f, 0.3f, // 23 11
#else
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 0 12
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 1
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 2
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 3
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 4
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f, // 5
0.5f, 0.5f, 0.6f, 0.4f, 0.4f, 0.4f, // 6
0.7f, 0.7f, 0.7f, 0.5f, 0.5f, 0.5f, // 7
0.8f, 0.8f, 0.8f, 0.5f, 0.5f, 0.5f, // 8
0.9f, 0.9f, 0.9f, 0.5f, 0.5f, 0.5f, // 9
1.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, // 10
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 11
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 12
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 13 1
1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f, // 14 2
1.0f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, // 15 3
0.9f, 0.9f, 0.9f, 0.5f, 0.5f, 0.5f, // 16 5
0.9f, 0.6f, 0.2f, 0.5f, 0.5f, 0.4f, // 17 6
0.6f, 0.6f, 0.4f, 0.4f, 0.4f, 0.4f, // 18 7
0.5f, 0.5f, 0.4f, 0.4f, 0.4f, 0.4f, // 19 8
0.45f, 0.45f, 0.4f, 0.35f, 0.35f, 0.35f, // 20 8
0.43f, 0.43f, 0.5f, 0.33f, 0.33f, 0.3f, // 21 9
0.41f, 0.41f, 0.5f, 0.31f, 0.31f, 0.3f, // 22 10
0.4f, 0.4f, 0.5f, 0.3f, 0.3f, 0.4f // 23 11
#endif
};
BOOL CWorld::InitWorldEnvir( )
{
memcpy( m_k24Light, gs_kLight, sizeof( LIGHTCOLOR ) * 24 );
return TRUE;
}
#if __VER >= 15 // __GUILD_HOUSE
void CWorld::InProcessing( )
{
//ÁøÀԽà Çѹø È£Ãâ
if( IsWorldGuildHouse() ) //±æµå ÇϿ콺 ÀÔÀåÀ̸é
{
//¸ÞÀθ޴ºÃ¢ ¶ç¿ì°í;;µîµî
if( !g_WndMng.m_pWndGHMain )
{
g_WndMng.m_pWndGHMain = new CWndGHMainMenu;
g_WndMng.m_pWndGHMain->Initialize( );
}
GuildHouse->ApplyEFTexture( );
}else
{
if( g_WndMng.m_pWndGHMain )
SAFE_DELETE( g_WndMng.m_pWndGHMain );
}
}
void CWorld::OutProcessing( )
{
//ÅðÀå½Ã Çѹø È£Ãâ
if( IsWorldGuildHouse() )
{
//¸ÞÀθ޴ºÃ¢ ´Ý±â µîµî
if( g_WndMng.m_pWndGHMain )
SAFE_DELETE( g_WndMng.m_pWndGHMain );
if( GuildDeploy()->IsReady( ) )
GuildDeploy()->EndDeploy( );
// GuildDeploy()->Init();
ForceTexture( NULL );
}
#if __VER >= 15 // __PETVIS
SAFE_DELETE( g_WndMng.m_pWndBuffPetStatus );
#endif // __PETVIS
//gmpbigsun(20100419): °³ÀÎÇÏ¿ì¡¿¡¼* ºüÁ®³ª¿À¸é ¹°°¡ ÅؽºÃÄ°¡ ÇÏ¿ì¡ ¹Ù´ÚÀÌ´Ù?
if( GetID() == WI_WORLD_MINIROOM )
ForceTexture( NULL );
}
#endif // __GUILD_HOUSE
#endif //__CLIENT
#if __VER >= 15 // __BS_CHANGING_ENVIR
#include "Continent.h"
enum ChangingTo
{
NO_CHANGING = 0,
CHANGING_TO_WORLD = 1,
CHANGING_TO_CONTINENT = 2,
};
BOOL LoadTextureSet( TextureSet* pSet )
{
assert( pSet );
if( string::npos != pSet->_strFileName.find( '.' ) ) //".xxx"
{
pSet->_pTexture = TexturePool::Get()->GetTexture( DIR_WEATHER, pSet->_strFileName );
if( !pSet->_pTexture )
{
CString tmp;
tmp.Format( "LoadTextureSet: pSet->_pTexture is NULL, filename : %s", pSet->_strFileName );
Error( tmp.GetBuffer(0) );
return FALSE;
}
}
return TRUE;
}
void CWorld::InitWorldEnvir( const char* filename )
{
// Initialize world sky
//todo:
TextureSet* pSet = NULL;
for( int i = 0; i < 3; ++i )
{
//sky
pSet = &m_kWorldEnvir._kSky[ i ];
if( pSet->_bUse )
LoadTextureSet( pSet );
//cloud
pSet = &m_kWorldEnvir._kCloud[ i ];
if( pSet->_bUse )
LoadTextureSet( pSet );
}
pSet = &m_kWorldEnvir._kSun;
if( pSet->_bUse )
LoadTextureSet( pSet );
//moon
pSet = &m_kWorldEnvir._kMoon;
if( pSet->_bUse )
LoadTextureSet( pSet );
//24 hours light
if( m_bUsing24Light )
{
//ok 24½Ã°£ LightÁ¤º¸¸¦ ¿ÜºÎ¿¡¼* °¡Á®¿À°Ú´Ù!, ¸¸¾à Àб⿡ ½ÇÆÐÇß´Ù¸é default°ªÀ» !
m_bUsing24Light = ReadFile24Light( filename );
assert( m_bUsing24Light );
}
if( !m_bUsing24Light )
{
//hm.. ¹Ì¸® Á¤ÀǵǾî ÀÖ´Â °ªÀ» ¾²ÀÚ!
memcpy( m_k24Light, gs_kLight, sizeof( LIGHTCOLOR ) * 24 );
}
#ifdef __BS_CHANGEABLE_WORLD_SEACLOUD
if( m_kSeaCloud._bUse )
LoadTextureSet( &m_kSeaCloud );
else m_kSeaCloud._pTexture = NULL;
#endif //__BS_CHANGEABLE_WORLD_SEACLOUD
}
BOOL CWorld::ReadFile24Light( const char* filename )
{
char fullname[ 256 ];
sprintf( fullname, "%s%s", filename, ".24l" );
CScript script;
if( script.Load( fullname ) == FALSE )
return FALSE;
for( int i = 0; i < 24; ++i )
{
m_k24Light[ i ].r1 = script.GetFloat( );
m_k24Light[ i ].g1 = script.GetFloat( );
m_k24Light[ i ].b1 = script.GetFloat( );
m_k24Light[ i ].r2 = script.GetFloat( );
m_k24Light[ i ].g2 = script.GetFloat( );
m_k24Light[ i ].b2 = script.GetFloat( );
}
return TRUE;
}
void CWorld::InitContinent( const char* filename )
{
// ¿ùµå »ý¼º½Ã ÃʱâÈ*
m_strCurContName = "";
m_cContinents.clear( );
ReadFileContinent( filename );
#ifdef _DEBUG
UpdateContinentLines( );
#endif
}
void CWorld::InitAfterCreatedPlayer( )
{
// g_pPlayer°¡ »ý¼ºµÈ Á÷ÈÄ µüÇѹø ÃʱâÈ*
// ÃÖÃÊ player°¡ ¼ÓÇÑ °÷¿¡ µû¶ó ÀûÀýÇÑ °ªÀ¸·Î ÃʱâÈ* µÈ´Ù.
DWORD dwAmbient = m_dwAmbient;
DWORD dwDiffuse = GetDiffuseColor( );
// player°¡ »ý¼ºµÇ¸é world À̰ųª continent Àε¥ continentÀΰæ¿ì´Â MoveInÀÌ È£ÃâµÈ´Ù ÀÌ°æ¿ì ¿ùµåÁ¤º¸¸¦ ¹Ì¸® ÀÔ·ÂÇسö¾ß¸¸ Á¦´ë·ÎµÈ º¯È*¸¦ º¼¼öÀÖ´Ù.
m_kCurContinent._fAmbient[ 0 ] = ( (dwAmbient>>16) & 0xff ) / 255.0f;
m_kCurContinent._fAmbient[ 1 ] = ( (dwAmbient>>8) & 0xff ) / 255.0f;
m_kCurContinent._fAmbient[ 2 ] = ( (dwAmbient) & 0xff ) / 255.0f;
m_kCurContinent._fDiffuse[ 0 ] = ( (dwDiffuse>>16) & 0xff ) / 255.0f;
m_kCurContinent._fDiffuse[ 1 ] = ( (dwDiffuse>>8) & 0xff ) / 255.0f;
m_kCurContinent._fDiffuse[ 2 ] = ( (dwDiffuse) & 0xff ) / 255.0f;
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos() );
if( !pInfo )
{
// óÀ½ ½ÃÀÛÁöÁ¡ÀÌ ¿ùµå
m_strCurContName = m_szFileName;
}else
{
// óÀ½ ½ÃÀÛÁöÁ¡ÀÌ ´ë·úÀÌ´Ù, ´ë·úÁ¤º¸·Î ȯ°æÀ» À籸¼ºÇØ¾ß Çϱ⶧¹®¿¡ MoveIn....ÇÔ¼ö¸¦ È£ÃâÇÑ´Ù.
MoveInContinent( *pInfo );
}
}
BOOL CWorld::CheckInOutContinent( )
{
//called every frame
if( m_strCurContName.empty() ) //óÀ½ ¿ùµå°¡ »ý¼ºµÇ°í g_pPlayer°¡ »ý¼ºµÈ ½Ã±â
InitAfterCreatedPlayer( ); // g_pPlayerÀ§Ä¡¸¦ ±âÁØÀ¸·Î ÃʱâÈ*
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos( ) );
if( !pInfo ) // ¿ùµå¿¡ ÀÖÀ½
{
if( string::npos == m_strCurContName.find( ".wld" ) )// ãÀ»¼ö ¾ø´Ù! ÀÌÀü¿¡ ´ë·ú
MoveOutContinent( m_szFileName ); // ´ë·ú Å»Ãâ!
return TRUE;
}
// ÀÌÈÄ´Â ´ë·ú¿¡ ÀÖÀ½ÀÌ º¸ÀåµÊ
if( pInfo->_strName != m_strCurContName ) // ÀÌÀü°ú Ʋ¸®´Ù¸é
{
// if( string::npos != m_strCurContName.find( ".wld" ) ) // ÀÌÀü¿¡ ¿ùµå¿´´Ù.
MoveInContinent( *pInfo ); // ´ë·ú ÀÔÀå!
}
return TRUE;
}
void CWorld::MoveInContinent( const ENVIR_INFO& kInfo )
{
// ¿ùµå -> ´ë·úÁøÀÔ
m_strCurContName = kInfo._strName;
//use
m_kCurContinent._bUseEnvir = kInfo._bUseEnvir;
//fog
m_fOldFogStart[0] = m_fFogStartValue;
m_fOldFogEnd[0] = m_fFogEndValue;
m_fOldFogStart[1] = kInfo._fFogStart;
m_fOldFogEnd[1] = kInfo._fFogEnd;
m_iOldWorldWeather = m_skyBox.GetWeather();
//weather
if( kInfo._iWeather != WEATHER_NONE )
{
#ifdef __BS_ADD_CONTINENT_WEATHER
if( 5 == kInfo._iWeather ) //±âº»³¯¾¾·Î!( ´ë·úÀ̱⶧¹®¿¡ ¹Ù²î´Â ³¯¾¾¿¡ ´ëÇؼ*µµ ¹«½ÃÇÑ´Ù. )
m_skyBox.SetWeather( 0, TRUE );
#else
m_skyBox.SetWeather( kInfo._iWeather, TRUE );
#endif
m_skyBox.m_bLockWeather = TRUE;
}
//skybox
TextureSet* pSet = const_cast< TextureSet*> ( &kInfo._kSky );
if( pSet->_bUse && !pSet->_pTexture )
LoadTextureSet( pSet );
//cloud
pSet = const_cast< TextureSet* > ( &kInfo._kCloud );
if( pSet->_bUse && !pSet->_pTexture )
LoadTextureSet( pSet );
m_bProcessingEnvir = CHANGING_TO_CONTINENT;
StartEV( m_kCurContinent );
}
void CWorld::MoveOutContinent( const string& worldname )
{
// ´ë·ú -> ¿ùµå
ENVIR_INFO* pOldContInfo = GetContinentInfo( m_strCurContName ); //¹Ì¸® ¹Þ¾Æ³õ°í.
if( !pOldContInfo )
{
assert( pOldContInfo );
return;
}
m_strCurContName = worldname;
// use
m_kCurContinent._bUseEnvir = pOldContInfo->_bUseEnvir;
// fog
m_fFogStartValue = m_fOldFogStart[ 0 ];
m_fFogEndValue = m_fOldFogEnd[ 0 ];
// ½ÃÀÛ°ú ³¡À» µÚÁý´Â´Ù.
m_fOldFogStart[ 0 ] = m_fOldFogStart[ 1 ];
m_fOldFogStart[ 1 ] = m_fFogStartValue;
m_fOldFogEnd[ 0 ] = m_fOldFogEnd[ 1 ];
m_fOldFogEnd[ 1 ] = m_fFogEndValue;
//skybox
//Weather
m_skyBox.m_bLockWeather = FALSE;
m_skyBox.SetWeather( m_iOldWorldWeather, TRUE );
// ´ë·ú skyÁ¤º¸ ³²±è ( skyº¯È*¿¡ ÀÌ¿ë )
m_kCurContinent._kCloud = pOldContInfo->_kCloud;
m_kCurContinent._kSky = pOldContInfo->_kSky;
m_bProcessingEnvir = CHANGING_TO_WORLD;
StartEV( m_kCurContinent );
}
inline float LerpValueToValue( const float oldVal_, const float newVal_, const float dt_ )
{
return oldVal_ - (oldVal_ - newVal_) * dt_; // oldVal * ( 1.0f - dt_ ) + newVal * dt_
}
const float fCON_DUR = 2.0f; //º¯È*ÇÒ ÃÑ ½Ã°£.
const float fINV_CON_DUR = 1.0f / fCON_DUR;
void CWorld::HookUpdateLight( CLight* pLight )
{
// time 0.0 ~ 1.0
// ambient
// diffuse
// fog light
if( !m_kCurContinent._bUseEnvir )
return;
if( !m_bProcessingEnvir )
return;
DWORD dwCurTime = timeGetTime( );
DWORD dwDeltaTime = dwCurTime - m_dwOldTime;
m_dwOldTime = dwCurTime;
m_dwAddedTime += dwDeltaTime;
if( m_dwAddedTime > ( 1000 * fCON_DUR ) )
m_dwAddedTime = (DWORD)( 1000 * fCON_DUR );
float fTime = m_dwAddedTime * 0.001f * ( fINV_CON_DUR );
// ¸ñÇ¥ °ªÀº ÇöÀç ¶óÀÌÆ®°ª!
//set light here!!
m_kCurContinent._fAmbient[ 0 ] = pLight->Ambient.r = LerpValueToValue( m_kOldContinent._fAmbient[ 0 ], pLight->Ambient.r, fTime );
m_kCurContinent._fAmbient[ 1 ] = pLight->Ambient.g = LerpValueToValue( m_kOldContinent._fAmbient[ 1 ], pLight->Ambient.g, fTime );
m_kCurContinent._fAmbient[ 2 ] = pLight->Ambient.b = LerpValueToValue( m_kOldContinent._fAmbient[ 2 ], pLight->Ambient.b, fTime );
m_kCurContinent._fDiffuse[ 0 ] = pLight->Diffuse.r = LerpValueToValue( m_kOldContinent._fDiffuse[ 0 ], pLight->Diffuse.r, fTime );
m_kCurContinent._fDiffuse[ 1 ] = pLight->Diffuse.g = LerpValueToValue( m_kOldContinent._fDiffuse[ 1 ], pLight->Diffuse.g, fTime );
m_kCurContinent._fDiffuse[ 2 ] = pLight->Diffuse.b = LerpValueToValue( m_kOldContinent._fDiffuse[ 2 ], pLight->Diffuse.b, fTime );
m_fFogStartValue = LerpValueToValue( m_fOldFogStart[ 0 ], m_fOldFogStart[ 1 ], fTime );
m_fFogEndValue = LerpValueToValue( m_fOldFogEnd[ 0 ], m_fOldFogEnd[ 1 ], fTime );
if( m_dwAddedTime >= 1000 * fCON_DUR )
{
//ok finished the working
m_bProcessingEnvir = FALSE;
m_dwAddedTime = 0;
m_dwOldTime = 0;
}
}
ENVIR_INFO* CWorld::GetInContinent( const D3DXVECTOR3& test_point )
{
int counter = 0;
int i;
double xinters;
D3DXVECTOR3 p1,p2;
for( ENVIR_INFO_Iter iter = m_cContinents.begin(); iter != m_cContinents.end(); ++iter )
{
ENVIR_INFO& kInfo = *iter;
Vec3D_Container& vecMap = kInfo._cVertices;
p1 = vecMap[0];
for (i=1;i<=(int)( vecMap.size() );i++) {
p2 = vecMap[i % vecMap.size()];
if (test_point.z > min_cont(p1.z,p2.z)) {
if (test_point.z <= max_cont(p1.z,p2.z)) {
if (test_point.x <= max_cont(p1.x,p2.x)) {
if (p1.z != p2.z) {
xinters = (test_point.z-p1.z)*(p2.x-p1.x)/(p2.z-p1.z)+p1.x;
if (p1.x == p2.x || test_point.x <= xinters)
counter++;
}
}
}
}
p1 = p2;
}
if (counter % 2 == 0)
continue;
else
return &kInfo;
}
return NULL;
}
BOOL CWorld::IsInContinent( )
{
if( !g_pPlayer )
return FALSE;
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos() );
return ( pInfo ? TRUE : FALSE );
}
void CWorld::StartEV( const ENVIR_INFO& pOrg )
{
m_kOldContinent = pOrg;
m_dwOldTime = timeGetTime( );
m_dwAddedTime = (DWORD)( 0.0f );
}
int CWorld::GetDiffuseAvg( )
{
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos() );
if( pInfo )
{
return ( (int)( ( pInfo->_fDiffuse[ 0 ] + pInfo->_fDiffuse[ 0 ] + pInfo->_fDiffuse[ 0 ]) * 255 / 3 ) );
}
return 0;
}
BOOL CWorld::HookRenderSky( CSkyBox::SKY_TYPE eType, int numRender, float& fAlpha )
{
//working: ´ë·ú in out°úÁ¤À̶ó¸é °úÁ¤À» ±×·ÁÁØ´Ù.
//working: °úÁ¤ÀÌ ³¡³ª°í inÀ̶ó¸é ´ë·ú ½ºÄ«ÀÌ·Î ±×·ÁÁØ´Ù.
if( !m_kCurContinent._bUseEnvir )
return FALSE;
ENVIR_INFO* pInfo = GetInContinent( g_pPlayer->GetPos( ) );
if( !m_bProcessingEnvir && !pInfo ) // º¯È* °úÁ¤µµ ¾Æ´Ï°í ´ë·ú¾Èµµ ¾Æ´Ï¸é ÇÒÀϾøÀ½.
return FALSE;
// ¿©±â¼*ºÎÅÏ ´ë·ú¾ÈÀ̰ųª º¯È*°úÁ¤ÁßÀÓ.
switch( eType )
{
case CSkyBox::SKY_SIDE : return HookRenderSky_Side( numRender, pInfo, fAlpha );
case CSkyBox::SKY_CLOUD : return HookRenderSky_Cloud( numRender, pInfo, fAlpha );
}
return TRUE; // ¹º°¡ hookingÇؼ* ó¸®Çß´Ù.
}
BOOL CWorld::HookRenderSky_Side( int numRender, ENVIR_INFO* pInfo, float& fAlpha )
{
if( m_bProcessingEnvir )
{
//º¯È* °úÁ¤Áß : lerp alpha org to target
float fTime = m_dwAddedTime * 0.001f * ( fINV_CON_DUR );
int grow = (int)( LerpValueToValue( 1, 255, fTime ) );
int degrow = 255 - grow;
if( CHANGING_TO_WORLD == m_bProcessingEnvir )
{
TextureSet* pSet = &m_kOldContinent._kSky;
if( pSet->_bUse && pSet->_pTexture )
{
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( degrow, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, numRender );
}
// ¿ùµå ½ºÄ«ÀÌ alpha°ªÀ» ³Ñ°ÜÁØ´Ù.
fAlpha = (float)grow / 255.0f; //Á¡Á¡ ³ªÅ¸³ª´Â
return FALSE;
}else
if( CHANGING_TO_CONTINENT == m_bProcessingEnvir )
{
fAlpha = (float)degrow / 255.0f; //Á¡Á¡ »ç¶óÁö´Â
TextureSet* pSet = &pInfo->_kSky;
if( pSet->_bUse && pSet->_pTexture )
{
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( grow, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, numRender );
}
return FALSE;
}
}
else //º¯È*°¡ ³¡³ª°í ´ë·ú¾È
{
TextureSet* pSet = &pInfo->_kSky;
if( !pSet->_bUse ) //»ç¿ëÇÏÁö ¾ÊÀ»°æ¿ì ¿ùµå·Î ³Ñ±è
return FALSE;
if( pSet->_bUse && !pSet->_pTexture ) //»ç¿ëÇÏ°Ú´Ù°í Çسõ°í ÅؽºÃÄ ¾øÀ»°æ¿ì ¾Æ¹«°Íµµ ±×¸®Áö ¾ÊÀ½.
return TRUE;
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, numRender );
}
return TRUE;
}
BOOL CWorld::HookRenderSky_Cloud( int numRender, ENVIR_INFO* pInfo, float& fAlpha )
{
if( m_bProcessingEnvir )
{
//º¯È* °úÁ¤Áß : lerp alpha org to target
float fTime = m_dwAddedTime * 0.001f * ( fINV_CON_DUR );
int grow = (int)( LerpValueToValue( 1, 255, fTime ) );
int degrow = 255 - grow;
if( CHANGING_TO_WORLD == m_bProcessingEnvir )
{
// ´ë·ú ½ºÄ«ÀÌ´Â Á¡Á¡ »ç¶óÁö°í
TextureSet* pSet = &m_kOldContinent._kCloud;
if( pSet->_bUse && pSet->_pTexture )
{
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( degrow, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, numRender );
}
// ¿ùµå ½ºÄ«ÀÌ´Â Á¡Á¡ ³ªÅ¸³ª°í
fAlpha = (float)grow / 255.0f;
return FALSE;
}else
if( CHANGING_TO_CONTINENT == m_bProcessingEnvir )
{
// ´ë·ú ½ºÄ«ÀÌ´Â Á¡Á¡ ³ªÅ¸³ª°í
TextureSet* pSet = &pInfo->_kCloud;
if( pSet->_bUse && pSet->_pTexture )
{
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( grow, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, numRender );
}
// ¿ùµå ½ºÄ«ÀÌ´Â Á¡Á¡ »ç¶óÁö°í
fAlpha = (float)degrow / 255.0f;
return FALSE;
}
}
else //º¯È*°¡ ³¡³ª°í ´ë·ú¾È
{
TextureSet* pSet = &pInfo->_kCloud;
if( !pSet->_bUse ) // »ç¿ëÇÏÁö ¾ÊÀ»°æ¿ì ±×³É ¿ùµå²¬ ±×·Á¶ó~
return FALSE;
if( pSet->_bUse && !pSet->_pTexture ) //»ç¿ëÇÏ°Ú´Ù°í Çسõ°í ÅؽºÃÄ ¾øÀ»°æ¿ì ¾Æ¹«°Íµµ ±×¸®Áö ¾ÊÀ½.
return TRUE;
m_pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( 255, 0, 0, 0 ) );
m_pd3dDevice->SetTexture( 0, pSet->_pTexture );
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, numRender );
}
return TRUE;
}
ENVIR_INFO* CWorld::GetContinentInfo( const string& name )
{
for( ENVIR_INFO_Iter iter = m_cContinents.begin(); iter != m_cContinents.end(); ++iter )
{
ENVIR_INFO* pInfo = &(*iter);
if( pInfo->_strName == name )
return pInfo;
}
return NULL;
}
void CWorld::ReadFileContinent( const char* filename )
{
char fullname[ 256 ];
sprintf( fullname, "%s%s", filename, ".cnt" );
CScript script;
if( script.Load( fullname ) == FALSE )
return;
ENVIR_INFO kInfo;
do{
script.GetToken();
if( script.Token == _T( "WORLD" ) )
{
script.GetToken( );
if( script.Token != _T( filename ) )
{
}
}
else
if( script.Token == _T( "Continent" ) )
{
script.GetToken();
if( script.Token == _T( "BEGIN" ) )
{
//ok
kInfo._cVertices.clear();
}
else if( script.Token == _T( "END" ) )
{
if( !kInfo._cVertices.empty() )
kInfo._cVertices.push_back( kInfo._cVertices[ 0 ] );
if( kInfo._bUseEnvir ) // ȯ°æÀ» ÀÌ¿ëÇÒ °æ¿ì¸¸ ÀúÀå
m_cContinents.push_back( kInfo );
}
}
else
if( script.Token == _T( "C_useEnvir" ) )
{
kInfo._bUseEnvir = script.GetNumber( );
}
else
if( script.Token == _T( "C_useRealData" ) )
{
kInfo._bUseRealData = script.GetNumber( );
}
else
if( script.Token == _T( "C_name" ) )
{
//´ë·ú À̸§
script.GetToken();
kInfo._strName = script.token;
}
else
if( script.Token == _T( "C_id" ) )
{
kInfo._id = script.GetNumber( );
}
else
if( script.Token == _T( "C_ambient" ) )
{
kInfo._fAmbient[ 0 ] = script.GetFloat();
kInfo._fAmbient[ 1 ] = script.GetFloat();
kInfo._fAmbient[ 2 ] = script.GetFloat();
}
else
if( script.Token == _T( "C_diffuse" ) )
{
kInfo._fDiffuse[ 0 ] = script.GetFloat( );
kInfo._fDiffuse[ 1 ] = script.GetFloat( );
kInfo._fDiffuse[ 2 ] = script.GetFloat( );
}
else
if( script.Token == _T( "C_fogstartend" ) )
{
kInfo._fFogStart = script.GetFloat( );
kInfo._fFogEnd = script.GetFloat( );
}
else
if( script.Token == _T( "C_weather" ) )
{
kInfo._iWeather = script.GetNumber( );
}
else
if( script.Token == _T( "C_sky" ) )
{
kInfo._kSky._bUse = script.GetNumber( );
script.GetToken( );
kInfo._kSky._strFileName = script.Token;
}
else
if( script.Token == _T( "C_cloud" ) )
{
kInfo._kCloud._bUse = script.GetNumber( );
script.GetToken( );
kInfo._kCloud._strFileName = script.Token;
}
else
if( script.Token == _T( "VERTEX" ) )
{
float x = script.GetFloat();
float y = script.GetFloat();
float z = script.GetFloat();
kInfo._cVertices.push_back( D3DXVECTOR3( x, y, z ) );
}
}while( script.tok != FINISHED );
}
#ifdef _DEBUG
struct ColorVertex
{
enum { FVF = ( D3DFVF_XYZ | D3DFVF_DIFFUSE ) };
ColorVertex( float x, float y, float z, D3DCOLOR color ) : _x( x ), _y( y ), _z( z ), _color( color ) { }
float _x, _y, _z;
D3DCOLOR _color;
};
void CWorld::UpdateContinentLines( )
{
for( ENVIR_INFO_Iter iter = m_cContinents.begin(); iter != m_cContinents.end(); ++iter )
{
ENVIR_INFO& kInfo = *iter;
size_t size = kInfo._cVertices.size();
if( size < 2 )
continue;
if( kInfo._VBforLine )
SAFE_RELEASE( kInfo._VBforLine );
m_pd3dDevice->CreateVertexBuffer( (size) * sizeof( ColorVertex ), D3DUSAGE_WRITEONLY, ColorVertex::FVF, D3DPOOL_MANAGED, &kInfo._VBforLine, 0 );
ColorVertex* pOtVertices = 0;
kInfo._VBforLine->Lock( 0, 0, (void**)&pOtVertices, 0 );
D3DXVECTOR3 kPos;
for( int idx = 0; idx < (int)( size ); ++idx )
{
kPos = kInfo._cVertices[ idx ];
pOtVertices[ idx ] = ColorVertex( kPos.x, kPos.y, kPos.z, D3DCOLOR_XRGB( 255, 0, 0 ) );
}
kInfo._VBforLine->Unlock( );
}
}
void CWorld::RenderContinentLines( )
{
for( ENVIR_INFO_Iter iter = m_cContinents.begin(); iter != m_cContinents.end(); ++iter )
{
ENVIR_INFO& kInfo = *iter;
size_t size = kInfo._cVertices.size();
m_pd3dDevice->SetStreamSource(0, kInfo._VBforLine, 0, sizeof(ColorVertex));
m_pd3dDevice->SetFVF(ColorVertex::FVF);
m_pd3dDevice->DrawPrimitive(D3DPT_LINESTRIP, 0, size-1 );
}
}
#endif
#endif //__BS_CHANGING_ENVIR
And then you add in your VersionCommon.h (from the Neuz):
#define __DAY_NIGHT
Have fun in the night
|
|
|
Similar Threads
|
[Source Release]Day & Night System
08/15/2014 - Flyff PServer Guides & Releases - 50 Replies
Hier release ich mal das day & night system.
Was ist das day & night system?
Seht es euch am besten an mit den screens.
Dämmerung : http://img809.imageshack.us/img809/553/flyff00000k r.jpg
Dunkler : http://img831.imageshack.us/img831/3141/flyff00001 p.jpg
Nochmal dunkler als voher :D : http://img210.imageshack.us/img210/6941/flyff00002 v.jpg
das wird nacher noch viel dunkler und später wieder hell.
|
[Source]Night System kleines Prob!
12/17/2011 - Flyff Private Server - 14 Replies
Hey E.pvp!
Ich habe dieses Problem:
Nach dem Ich den Night System , undzwar wollte ich ,dass die Dunkelheit näher am Spieler ist also grösser ist . Dafür habe ich mir diese Zeilen inder World3d.cpp angeguckt:
#ifdef __DAY_NIGHT
if( !m_bIsIndoor ){
m_fFogStartValue = 40.0F;
m_fFogEndValue = 170.0F + GetRealTime() * 140.0F;
|
All times are GMT +2. The time now is 12:51.
|
|