/**==========================================================*\ @file : SGameWeatherAttr.h @brief : rappelz weather effect attributes @date : 2007.03.xx @author : sonador \*===========================================================*/ #pragma once //#include //#include #include "K3DTypes.h" namespace env_fx { struct SWeatherAttr { enum EResType { NONE, TEXTURE, NX3 }; template< typename T > struct TMinmax { T min; T max; TMinmax< T >& operator = ( const TMinmax< T >& rhs ) { if( this == &rhs ) return *this; min = rhs.min; max = rhs.max; return *this; } }; SWeatherAttr(); ~SWeatherAttr(); SWeatherAttr( const SWeatherAttr& rhs ); SWeatherAttr& operator = ( const SWeatherAttr& rhs ); void Reset(); void set(SWeatherAttr const& rhs); // load from lua ------------------------------------------------------------- unsigned int state_fade_duration ; ///< 페이딩 시간 //bool area_slope ; //! 기울이기 사용여부 //DWORD area_slope_duration ; //! 기울이기 딜레이 bool area_local ; bool area_swap ; ///< 스왑 사용 여부 float area_width ; ///< area 의 폭 float area_height ; ///< area 의 높이 int vert_density ; ///< v when density = v * h * h int hori_density ; ///< h when density = v * h * h TMinmax< K3DVector > particle_direction ; ///< direction min / max float particle_velocity ; ///< 속도 unsigned int particle_life ; ///< 생명력 float particle_width ; ///< 파티클의 폭 float particle_height ; ///< 파티클의 높이 K3DColor particle_color ; ///< particle color int sprite_count ; ///< 텍스쳐내 스프라이트 개수 int sprite_row ; ///< 텍스쳐내 행 개수 int sprite_col ; ///< 텍스쳐내 열 개수 float visibility_min ; ///< minimum of particle alpha float visibility_mid ; float visibility_max ; ///< maximum of particle alpha float visible_range_mid ; ///< visible range mid float visible_range_end ; ///< visible range end int collision_max ; ///< 최대 충돌 표현 개수 float collision_factor ; ///< 충돌될 확율( 0 ~ 1 ) float rotation_unit ; ///< 회전 성분 float rotation_speed ; ///< 회전 속도 unsigned int destroy_duration ; ///< 파괴 딜레이 EResType resource_type ; ///< 리소스 타입 std::string resource ; ///< 텍스쳐 파일명 -- resource SWeatherAttr* linked_attr ; ///< linked attribute // --------------------------------------------------------------------------- int capacity ; ///< capacity float emit_per_millisec ; ///< emitting count per one millisecond }; inline SWeatherAttr::SWeatherAttr() : linked_attr( 0 ) { this->Reset(); } inline SWeatherAttr::~SWeatherAttr() { } inline void SWeatherAttr::set(SWeatherAttr const& rhs) { state_fade_duration = rhs.state_fade_duration; area_local = rhs.area_local; area_swap = rhs.area_swap; area_width = rhs.area_width; area_height = rhs.area_height; vert_density = rhs.vert_density; hori_density = rhs.hori_density; particle_direction.min = rhs.particle_direction.min; particle_direction.max = rhs.particle_direction.max; particle_velocity = rhs.particle_velocity; particle_life = rhs.particle_life; particle_width = rhs.particle_width; particle_height = rhs.particle_height; sprite_count = rhs.sprite_count; sprite_row = rhs.sprite_row; sprite_col = rhs.sprite_col; visibility_min = rhs.visibility_min; visibility_mid = rhs.visibility_mid; visibility_max = rhs.visibility_max; visible_range_mid = rhs.visible_range_mid; visible_range_end = rhs.visible_range_end; collision_max = rhs.collision_max; collision_factor = rhs.collision_factor; rotation_unit = rhs.rotation_unit; rotation_speed = rhs.rotation_speed; destroy_duration = rhs.destroy_duration; resource_type = rhs.resource_type; resource = rhs.resource; /// linked_attr의 삭제는 SWeatherInfo에서 담당하기 때문에 포인터를 대입하는 것이 맞는 것 같다. linked_attr = rhs.linked_attr; capacity = rhs.capacity; emit_per_millisec = rhs.emit_per_millisec; } inline SWeatherAttr::SWeatherAttr( const SWeatherAttr& rhs ) { set(rhs); } inline SWeatherAttr& SWeatherAttr::operator = ( const SWeatherAttr& rhs ) { if( this == &rhs ) return *this; set(rhs); return *this; } inline void SWeatherAttr::Reset() { state_fade_duration = 0; area_local = false; area_swap = false; area_width = 0; area_height = 0; vert_density = 0; hori_density = 0; particle_direction.min = K3DVector( 0, 0, 0 ); particle_direction.max = K3DVector( 0, 0, 0 ); particle_velocity = 0; particle_life = 0; particle_width = 0; particle_height = 0; sprite_count = 0; sprite_row = 0; sprite_col = 0; visibility_min = 0; visibility_mid = 0; visibility_max = 0; visible_range_mid = 0; visible_range_end = 0; collision_max = 0; collision_factor = 0; rotation_unit = 0; rotation_speed = 0; destroy_duration = 0; resource_type = NONE; resource = ""; SAFE_DELETE( linked_attr ); capacity = 0; emit_per_millisec = 1.0f; } struct SWeatherInfo { SWeatherInfo() : m_nThemeID( 0 ), m_pWeatherAttr( 0 ), m_nSkyType( 0 ), m_bThunder( false ), m_bLightning( false ) { } ~SWeatherInfo() { if( m_pWeatherAttr ) { SWeatherAttr* pCurrAttr = m_pWeatherAttr; SWeatherAttr* pNextAttr = 0; do { pNextAttr = pCurrAttr->linked_attr; delete pCurrAttr; pCurrAttr = pNextAttr; } while( pCurrAttr ); } } int m_nThemeID; SWeatherAttr* m_pWeatherAttr; int m_nSkyType; bool m_bThunder; bool m_bLightning; std::string m_strSound; }; //========================================================================= /// thunder attribute //========================================================================= struct SThunderAttr { SThunderAttr() : fFactor ( 0 ) , fLightningFactor ( 0 ) , dwDuration ( 0 ) , nFlashCount ( 0 ) , fSpeedOfSound ( 0 ) { } float fFactor; float fLightningFactor; DWORD dwDuration; int nFlashCount; K3DColor sColor; std::string strSound; float fSpeedOfSound; }; //========================================================================= /// lightning attribute //========================================================================= struct SLightningAttr { typedef std::vector< std::string > textures_type; SLightningAttr() : fVisibleDistance ( 0 ) , dwLife_msec_ ( 0 ) , dwFadeOut_msec_ ( 0 ) , nTwinklingCount ( 0 ) , dwColor ( 0xffffffff ) , fHeight ( 0 ) , fWidth ( 0 ) { } SLightningAttr& operator = ( const SLightningAttr& rhs ) { if( this == &rhs ) return *this; fVisibleDistance = rhs.fVisibleDistance; dwLife_msec_ = rhs.dwLife_msec_; dwFadeOut_msec_ = rhs.dwFadeOut_msec_; nTwinklingCount = rhs.nTwinklingCount; dwColor = rhs.dwColor; fHeight = rhs.fHeight; fWidth = rhs.fWidth; strTextures = rhs.strTextures; return *this; } float fVisibleDistance; DWORD dwLife_msec_; DWORD dwFadeOut_msec_; int nTwinklingCount; KColor dwColor; float fHeight; float fWidth; textures_type strTextures; }; #ifdef DISTANCE_VIEW //========================================================================= /// SkyBox attribute //========================================================================= struct SLocalModelInfo { SLocalModelInfo() : local_id(0), model_name(""), cloud_type(0) {} int local_id; std::string model_name; int cloud_type; }; typedef vector< SLocalModelInfo* > VCLocalModel; struct SDistanceViewAttr { SDistanceViewAttr() {} ~SDistanceViewAttr() { clear(); } void clear() { int sz = vcLocalModel.size(); for(int x=0; xlocal_id == _id_local ) return p; } return NULL; } VCLocalModel vcLocalModel; }; struct SSkyBoxAttr { SSkyBoxAttr() : type_cloud ( 0 ) , appear_zone_width ( 2000 ) , appear_zone_height ( 2000 ) , count_cloud ( 0 ) , appear_layer ( 0 ) , size_cloud ( 0 ) , tickness_cloud ( 0 ) , dir_move_cloud ( 0 ) { } ~SSkyBoxAttr() { } SSkyBoxAttr& operator = ( SSkyBoxAttr& r ) { type_cloud = r.type_cloud; appear_zone_width = r.appear_zone_width; appear_zone_height = r.appear_zone_height; count_cloud = r.count_cloud; appear_layer = r.appear_layer; size_cloud = r.size_cloud; tickness_cloud = r.tickness_cloud; dir_move_cloud = r.dir_move_cloud; return *this; } int type_cloud; int appear_zone_width; int appear_zone_height; int count_cloud; int appear_layer; int size_cloud; int tickness_cloud; int dir_move_cloud; // int distance_view_wh; // std::string distance_view_nx3; }; #endif } // ns env_fx