MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnInitDialog

Method OnInitDialog

editor/LevelDialog.cpp:65–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63#define NULL_NAME "<none>"
64
65BOOL CLevelDialog::OnInitDialog() {
66 CDialog::OnInitDialog();
67
68 // set up reverb dropdown listbox
69 CComboBox *cbox = (CComboBox *)GetDlgItem(IDC_ENVAUD_LIST);
70 int i;
71
72 cbox->ResetContent();
73 for (i = 0; i < N_ENVAUDIO_PRESETS; i++) {
74 cbox->AddString(EnvAudio_PresetNames[i]);
75 }
76
77 cbox = (CComboBox *)GetDlgItem(IDC_AMBIENT_SOUND);
78 cbox->ResetContent();
79 cbox->AddString(NULL_NAME);
80 for (i = 0; i < Num_ambient_sound_patterns; i++) {
81 if (Ambient_sound_patterns[i].name[0]) {
82 cbox->AddString((LPCTSTR)AmbientSoundPatternName(i));
83 }
84 }
85
86 // select based off of selected rooms.
87 bool single_ambient_sel = true, single_env_sel = true;
88
89 if (N_selected_rooms) {
90 room *rp = &Rooms[Selected_rooms[0]];
91 int amb_sound = rp->ambient_sound;
92 uint8_t env_preset = rp->env_reverb;
93
94 for (i = 1; i < N_selected_rooms; i++) {
95 rp = &Rooms[Selected_rooms[i]];
96 if (rp->ambient_sound != amb_sound) {
97 single_ambient_sel = false;
98 }
99 if (rp->env_reverb != env_preset) {
100 single_env_sel = false;
101 }
102 }
103
104 rp = &Rooms[Selected_rooms[0]];
105
106 cbox = (CComboBox *)GetDlgItem(IDC_AMBIENT_SOUND);
107 if (single_ambient_sel) {
108 cbox->SelectString(-1, (rp->ambient_sound == -1) ? NULL_NAME : AmbientSoundPatternName(rp->ambient_sound));
109 } else {
110 cbox->SetCurSel(-1);
111 }
112
113 cbox = (CComboBox *)GetDlgItem(IDC_ENVAUD_LIST);
114 if (single_env_sel) {
115 cbox->SelectString(-1, EnvAudio_PresetNames[(rp->env_reverb < N_ENVAUDIO_PRESETS) ? rp->env_reverb : 0]);
116 } else {
117 cbox->SetCurSel(-1);
118 }
119 } else {
120 ((CComboBox *)GetDlgItem(IDC_AMBIENT_SOUND))
121 ->SelectString(-1,
122 (Curroomp->ambient_sound == -1) ? NULL_NAME : AmbientSoundPatternName(Curroomp->ambient_sound));

Callers

nothing calls this directly

Calls 2

AmbientSoundPatternNameFunction · 0.85
AddStringMethod · 0.80

Tested by

no test coverage detected