Debian Codegraph @

editor/AmbientSoundElement.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 // AmbientSoundElement.cpp : implementation file
20 //
21
22 #include "stdafx.h"
23 #include "editor.h"
24 #include "AmbientSoundElement.h"
25 #include "soundload.h"
26
27 #ifdef _DEBUG
28 #define new DEBUG_NEW
29 #undef THIS_FILE
30 static char THIS_FILE[] = __FILE__;
31 #endif
32
33 /////////////////////////////////////////////////////////////////////////////
34 // CAmbientSoundElement dialog
35
36 CAmbientSoundElement::CAmbientSoundElement(ase *ase, CWnd *pParent /*=NULL*/)
37 : CDialog(CAmbientSoundElement::IDD, pParent) {
38 //{{AFX_DATA_INIT(CAmbientSoundElement)
39 m_min_volume = 0.0f;
40 m_max_volume = 0.0f;
41 m_probability = 0;
42 //}}AFX_DATA_INIT
43
44 m_ase = ase;
45
46 m_min_volume = ase->min_volume;
47 m_max_volume = ase->max_volume;
48 m_probability = ase->probability;
49 m_handle = ase->handle;
50 }
51
52 void CAmbientSoundElement::DoDataExchange(CDataExchange *pDX) {
53 CDialog::DoDataExchange(pDX);
54 //{{AFX_DATA_MAP(CAmbientSoundElement)
55 DDX_Text(pDX, IDC_MIN_VOLUME, m_min_volume);
56 DDX_Text(pDX, IDC_ASE_MAX_VOLUME, m_max_volume);
57 DDX_Text(pDX, IDC_ASE_PROBABILITY, m_probability);
58 //}}AFX_DATA_MAP
59 }
60
61 BEGIN_MESSAGE_MAP(CAmbientSoundElement, CDialog)
62 //{{AFX_MSG_MAP(CAmbientSoundElement)
63 ON_CBN_SELENDOK(IDC_ASE_SOUND_LIST, OnSelendokASESoundList)
64 //}}AFX_MSG_MAP
65 END_MESSAGE_MAP()
66
67 /////////////////////////////////////////////////////////////////////////////
68 // CAmbientSoundElement message handlers
69
70 void CAmbientSoundElement::OnOK() {
71 CDialog::OnOK();
72
73 m_ase->min_volume = m_min_volume;
74 m_ase->max_volume = m_max_volume;
75 m_ase->probability = m_probability;
76 m_ase->handle = m_handle;
77 }
78
79 #include "pserror.h"
80
81 void CAmbientSoundElement::OnSelendokASESoundList() {
82 char name[200];
83 CComboBox *soundlist = (CComboBox *)GetDlgItem(IDC_ASE_SOUND_LIST);
84
85 soundlist->GetLBText(soundlist->GetCurSel(), name);
86 m_handle = FindSoundName(name);
87 }
88
89 BOOL CAmbientSoundElement::OnInitDialog() {
90 CDialog::OnInitDialog();
91
92 CComboBox *soundlist = (CComboBox *)GetDlgItem(IDC_ASE_SOUND_LIST);
93 soundlist->ResetContent();
94 for (int i = 0; i < MAX_SOUNDS; i++)
95 if (Sounds[i].used)
96 soundlist->AddString(Sounds[i].name);
97 soundlist->SelectString(-1, Sounds[m_handle].name);
98
99 return TRUE; // return TRUE unless you set the focus to a control
100 // EXCEPTION: OCX Property Pages should return FALSE
101 }