1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "object_viewer.h"
19 #include "collision_zone_dlg.h"
20 #include "editable_range.h"
21 #include "particle_dlg.h"
22 #include "start_stop_particle_system.h"
24 /////////////////////////////////////////////////////////////////////////////
25 // CCollisionZoneDlg dialog
27 // standard constructor
28 CCollisionZoneDlg::CCollisionZoneDlg(CParticleWorkspace::CNode
*ownerNode
, NL3D::CPSZone
*zone
, CParticleDlg
*particleDlg
)
31 _ParticleDlg(particleDlg
)
33 nlassert(particleDlg
);
34 //{{AFX_DATA_INIT(CCollisionZoneDlg)
35 // NOTE: the ClassWizard will add member initialization here
40 void CCollisionZoneDlg::init(sint x
, sint y
, CWnd
*pParent
)
43 Create(IDD_ZONE
, pParent
);
45 r
.top
+= y
; r
.bottom
+= y
;
46 r
.right
+= x
; r
.left
+= x
;
49 _BounceFactorDlg
= new CEditableRangeFloat(std::string("BOUNCE_FACTOR"), _Node
, 0.f
, 1.f
);
50 pushWnd(_BounceFactorDlg
);
51 _BounceFactorWrapper
.Z
= _Zone
;
52 _BounceFactorDlg
->setWrapper(&_BounceFactorWrapper
);
53 _BounceFactorDlg
->init(60, 35, this);
55 m_CollisionBehaviour
.SetCurSel((uint
) _Zone
->getCollisionBehaviour() );
57 if (_Zone
->getCollisionBehaviour() != NL3D::CPSZone::bounce
)
59 _BounceFactorDlg
->EnableWindow(FALSE
);
68 void CCollisionZoneDlg::DoDataExchange(CDataExchange
* pDX
)
70 CDialog::DoDataExchange(pDX
);
71 //{{AFX_DATA_MAP(CCollisionZoneDlg)
72 DDX_Control(pDX
, IDC_COLLISION_BEHAVIOUR
, m_CollisionBehaviour
);
77 BEGIN_MESSAGE_MAP(CCollisionZoneDlg
, CDialog
)
78 //{{AFX_MSG_MAP(CCollisionZoneDlg)
79 ON_CBN_SELCHANGE(IDC_COLLISION_BEHAVIOUR
, OnSelchangeCollisionBehaviour
)
83 /////////////////////////////////////////////////////////////////////////////
84 // CCollisionZoneDlg message handlers
86 void CCollisionZoneDlg::OnSelchangeCollisionBehaviour()
89 _Zone
->setCollisionBehaviour( (NL3D::CPSZone::TCollisionBehaviour
) m_CollisionBehaviour
.GetCurSel());
90 _BounceFactorDlg
->EnableWindow(_Zone
->getCollisionBehaviour() == NL3D::CPSZone::bounce
? TRUE
: FALSE
);
91 _ParticleDlg
->StartStopDlg
->resetAutoCount(_Node
);