Debian Codegraph @

editor/WorldSoundsDialog.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 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/editor/WorldSoundsDialog.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:57:40 $
23 * $Author: kevinb $
24 *
25 * Sound page dialog
26 *
27 * $Log: not supported by cvs2svn $
28 *
29 * 29 4/21/99 5:55p Jason
30 * added override button to sound page
31 *
32 * 28 2/23/99 11:26a Matt
33 * Cleaned up sounds dialog
34 *
35 * 27 11/06/98 12:34p Jason
36 * more speedups for manage system
37 *
38 * 26 10/22/98 8:31p Chris
39 * Sounds use GlobalAlloc and GlobalFree
40 *
41 * 25 10/19/98 1:21p Chris
42 * Improve the volume import scaling code
43 *
44 * 24 10/19/98 11:57a Chris
45 * Update the sound system to use the import volume
46 *
47 * 23 10/14/98 12:09p Jason
48 * fixed some long standing name problems
49 *
50 * 22 9/21/98 8:18p Chris
51 * Removed annoying mprints
52 *
53 * 21 6/29/98 10:35p Chris
54 * Added support for once per object
55 *
56 * 20 6/23/98 2:43p Matt
57 * Changed calls to OutrageMessageBox() & Debug_MessageBox() to deal with
58 * int return value (instead of bool).
59 *
60 * 19 6/19/98 3:03p Chris
61 * Made CheckAndForceSoundDataAlloc a SoundSystem function - useful for
62 * multiple mixers. Added IsSoundPlaying to the high level sound lib.
63 *
64 * 18 4/22/98 5:38p Chris
65 * Fixed problems with adding new sounds
66 *
67 * 17 2/15/98 7:43p Luke
68 *
69 * 16 2/12/98 6:07p Chris
70 * Fixed a problem with addsound
71 *
72 * 15 2/12/98 4:55p Chris
73 * More validation checks for sounds
74 *
75 * 14 2/12/98 4:44p Chris
76 * Fixed a bunch of bugs in the dialog
77 *
78 * 13 2/12/98 4:20p Chris
79 * Fixed problem with sound dialog and allowing users to enter invalid
80 * values
81 *
82 * 12 2/06/98 3:22a Chris
83 * Added a stop sounds button. Made delete sound first stop the currently
84 * playing sounds.
85 *
86 * 11 12/31/97 2:58a Chris
87 * Another major revision to the SoundLib. This cleaned up the code after
88 * removing the direct sound secondary buffers.
89 *
90 * 10 12/30/97 2:07p Chris
91 * Adding further support for software 3d stuff
92 *
93 * 9 12/29/97 4:50p Chris
94 * Added SPF_NO_UPDATE
95 *
96 * 8 12/22/97 6:19p Chris
97 * Moved weapon battery firing sound off the projectile (weapon) and into
98 * the weapon battery.
99 *
100 * 7 12/18/97 12:26p Chris
101 * Incremental new lib improvements
102 *
103 * 6 12/10/97 4:47p Chris
104 * Revision 1.0 of new sound library (no hardware -- uses primary buffer
105 * streaming)
106 *
107 * 5 12/02/97 5:31p Samir
108 * New file dialog interface implemented.
109 *
110 * 4 9/08/97 4:05p Samir
111 * Fixed some warnings and took out extranneous includes to windows.h in
112 * important headers.
113 *
114 * $NoKeywords: $
115 */
116
117 // WorldSoundsDialog.cpp : implementation file
118 //
119
120 #include <filesystem>
121
122 #include "stdafx.h"
123
124 #include "pserror.h"
125 #include "editor.h"
126 #include "WorldSoundsDialog.h"
127 #include "soundload.h"
128 #include "soundpage.h"
129 #include "manage.h"
130 #include "hlsoundlib.h"
131 #include "ddio.h"
132
133 #ifdef _DEBUG
134 #define new DEBUG_NEW
135 #undef THIS_FILE
136 static char THIS_FILE[] = __FILE__;
137 #endif
138
139 /////////////////////////////////////////////////////////////////////////////
140 // CWorldSoundsDialog dialog
141
142 CWorldSoundsDialog::CWorldSoundsDialog(CWnd *pParent /*=NULL*/) : CDialog(CWorldSoundsDialog::IDD, pParent) {
143 //{{AFX_DATA_INIT(CWorldSoundsDialog)
144 // NOTE: the ClassWizard will add member initialization here
145 //}}AFX_DATA_INIT
146 }
147
148 void CWorldSoundsDialog::DoDataExchange(CDataExchange *pDX) {
149 CDialog::DoDataExchange(pDX);
150 //{{AFX_DATA_MAP(CWorldSoundsDialog)
151 // NOTE: the ClassWizard will add DDX and DDV calls here
152 //}}AFX_DATA_MAP
153 }
154
155 BEGIN_MESSAGE_MAP(CWorldSoundsDialog, CDialog)
156 //{{AFX_MSG_MAP(CWorldSoundsDialog)
157 ON_BN_CLICKED(IDC_ADD_SOUND, OnAddSound)
158 ON_BN_CLICKED(IDC_CHECKIN_SOUND, OnCheckinSound)
159 ON_BN_CLICKED(IDC_DELETE_SOUND, OnDeleteSound)
160 ON_BN_CLICKED(IDC_LOCK_SOUND, OnLockSound)
161 ON_BN_CLICKED(IDC_LOAD_SOUND, OnLoadSound)
162 ON_BN_CLICKED(IDC_NEXT_SOUND, OnNextSound)
163 ON_BN_CLICKED(IDC_PREV_SOUND, OnPrevSound)
164 ON_EN_KILLFOCUS(IDC_SOUND_NAME_EDIT, OnKillfocusSoundNameEdit)
165 ON_CBN_SELENDOK(IDC_SOUND_PULLDOWN, OnSelendokSoundPulldown)
166 ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound)
167 ON_EN_KILLFOCUS(IDC_SOUNDINNERCONEANGLE_EDIT, OnKillfocusSoundinnerconeangleEdit)
168 ON_EN_KILLFOCUS(IDC_SOUNDLOOPEND_EDIT, OnKillfocusSoundloopendEdit)
169 ON_EN_KILLFOCUS(IDC_SOUNDLOOPSTART_EDIT, OnKillfocusSoundloopstartEdit)
170 ON_EN_KILLFOCUS(IDC_SOUNDMAXDIST_EDIT, OnKillfocusSoundmaxdistEdit)
171 ON_EN_KILLFOCUS(IDC_SOUNDMINDIST_EDIT, OnKillfocusSoundmindistEdit)
172 ON_EN_KILLFOCUS(IDC_SOUNDOUTERCONEANGLE_EDIT, OnKillfocusSoundouterconeangleEdit)
173 ON_EN_KILLFOCUS(IDC_SOUNDOUTERCONEVOL_EDIT, OnKillfocusSoundouterconevolEdit)
174 ON_BN_CLICKED(IDC_SOUNDHALLEFFECT_CHECK, OnSoundhalleffectCheck)
175 ON_BN_CLICKED(IDC_LOOPING_CHECK, OnLoopingCheck)
176 ON_BN_CLICKED(IDC_SOUNDBACKWARD_RADIO, OnSoundbackwardRadio)
177 ON_BN_CLICKED(IDC_SOUNDDOWNWARD_RADIO, OnSounddownwardRadio)
178 ON_BN_CLICKED(IDC_SOUNDEXCLUSIVE_CHECK, OnSoundexclusiveCheck)
179 ON_BN_CLICKED(IDC_SOUNDFOREVER_CHECK, OnSoundforeverCheck)
180 ON_BN_CLICKED(IDC_SOUNDFORWARD_RADIO, OnSoundforwardRadio)
181 ON_BN_CLICKED(IDC_SOUNDOBJATTACH_RADIO, OnSoundobjattachRadio)
182 ON_BN_CLICKED(IDC_SOUNDOBJECT_RADIO, OnSoundobjectRadio)
183 ON_BN_CLICKED(IDC_SOUNDONCE_CHECK, OnSoundonceCheck)
184 ON_BN_CLICKED(IDC_SOUNDPOSATTACH_RADIO, OnSoundposattachRadio)
185 ON_BN_CLICKED(IDC_SOUNDTURRET1_RADIO, OnSoundturret1Radio)
186 ON_BN_CLICKED(IDC_SOUNDTURRET2_RADIO, OnSoundturret2Radio)
187 ON_BN_CLICKED(IDC_SOUNDTURRET3_RADIO, OnSoundturret3Radio)
188 ON_BN_CLICKED(IDC_SOUNDUPWARD_RADIO, OnSoundupwardRadio)
189 ON_WM_HELPINFO()
190 ON_BN_CLICKED(IDC_SOUND_NO_UPDATE, OnSoundNoUpdate)
191 ON_BN_CLICKED(IDC_KILLSOUNDS, OnKillsounds)
192 ON_BN_CLICKED(IDC_SOUND_ONCE_PER_OBJ_CHECK, OnSoundOncePerObjCheck)
193 ON_EN_KILLFOCUS(IDC_SOUND_IMPORT_VOLUME_EDIT, OnKillfocusSoundImportVolumeEdit)
194 ON_BN_CLICKED(IDC_SOUND_CHANGE_NAME, OnSoundChangeName)
195 ON_BN_CLICKED(IDC_OVERRIDE, OnOverride)
196 //}}AFX_MSG_MAP
197 END_MESSAGE_MAP()
198
199 /////////////////////////////////////////////////////////////////////////////
200 // CWorldSoundsDialog message handlers
201
202 void CWorldSoundsDialog::OnAddSound() {
203 char filename[256], dir[256], fname[128], ext[32];
204 char cur_name[100];
205 int raw_handle;
206 int sound_handle;
207 int c = 1, finding_name = 1;
208
209 if (!Network_up) {
210 OutrageMessageBox("Sorry babe, the network is down. This action is a no-no.\n");
211 return;
212 }
213
214 // Get the filename of the representing image
215
216 CString filter = "Descent III files (*.wav)|*.wav||";
217
218 if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_sounds_dir, sizeof(Current_sounds_dir)))
219 return;
220
221 ddio_SplitPath(filename, dir, fname, ext);
222
223 // Okay, we selected a file. Lets do what needs to be done here.
224 raw_handle = LoadSoundFile(filename, 1.0f, true);
225
226 if (raw_handle < 0) {
227 OutrageMessageBox("Invalid sound file.");
228 return;
229 }
230
231 // Alloc a sound and give a name not already taken by some other sound
232
233 sound_handle = AllocSound();
234
235 while (finding_name) {
236 if (c == 1)
237 sprintf(cur_name, "%s", fname);
238 else
239 sprintf(cur_name, "%s%d", fname, c);
240 if (FindSoundName(cur_name) != -1)
241 c++;
242 else
243 finding_name = 0;
244 }
245
246 strcpy(Sounds[sound_handle].name, cur_name);
247
248 Sounds[sound_handle].sample_index = raw_handle;
249
250 // Finally, save a local copy of the .wav and alloc a tracklock
251 mprintf(0, "Making a copy of this sound locally...\n");
252
253 std::filesystem::path destname = LocalSoundsDir / SoundFiles[Sounds[sound_handle].sample_index].name;
254 cf_CopyFile(destname, filename);
255
256 mng_AllocTrackLock(cur_name, PAGETYPE_SOUND);
257
258 D3EditState.current_sound = sound_handle;
259
260 RemapSounds();
261
262 Sound_system.CheckAndForceSoundDataAlloc(D3EditState.current_sound);
263 Sounds[sound_handle].loop_end = SoundFiles[Sounds[sound_handle].sample_index].np_sample_length - 1;
264
265 UpdateDialog();
266 }
267
268 void CWorldSoundsDialog::OnCheckinSound() {
269 int n = D3EditState.current_sound;
270 mngs_Pagelock temp_pl;
271 int r;
272
273 if (Num_sounds < 1)
274 return;
275
276 if (!mng_MakeLocker())
277 return;
278
279 // Make sure we own this sound
280 strcpy(temp_pl.name, Sounds[n].name);
281 temp_pl.pagetype = PAGETYPE_SOUND;
282
283 r = mng_CheckIfPageOwned(&temp_pl, TableUser);
284 if (r < 0)
285 OutrageMessageBox(ErrorString);
286 else if (r == 0)
287 OutrageMessageBox(InfoString);
288 else {
289 // Change the pagelock state to UNLOCKED
290 strcpy(temp_pl.holder, "UNLOCKED");
291 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) {
292 MessageBox(ErrorString, "Error!");
293 mng_EraseLocker();
294 return;
295 } else {
296 // Now actually replace the copy on the net with our local one
297
298 if (!mng_ReplacePage(Sounds[n].name, Sounds[n].name, n, PAGETYPE_SOUND, 0))
299 OutrageMessageBox(ErrorString);
300 else {
301 // Save this sound raw to the network for all
302
303 std::filesystem::path srcname = LocalSoundsDir / SoundFiles[Sounds[n].sample_index].name;
304 std::filesystem::path destname = NetSoundsDir / SoundFiles[Sounds[n].sample_index].name;
305
306 cf_CopyFile(destname, srcname);
307
308 OutrageMessageBox("Sound checked in.");
309
310 // Delete it from local pagefile if its there
311 int dret = mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1);
312 ASSERT(dret == 1);
313 mng_EraseLocker();
314
315 // Free the tracklock
316 int p = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND);
317 ASSERT(p != -1);
318 mng_FreeTrackLock(p);
319 UpdateDialog();
320 }
321 }
322 }
323 }
324
325 void CWorldSoundsDialog::OnDeleteSound() {
326 int answer, tl;
327 mngs_Pagelock pl;
328 int n = D3EditState.current_sound;
329
330 if (Num_sounds < 1)
331 return;
332
333 Sound_system.BeginSoundFrame();
334 Sound_system.StopAllSounds();
335 Sound_system.EndSoundFrame();
336
337 // Check to see if we even have it locked
338 if ((tl = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND)) == -1) {
339 OutrageMessageBox("This sound is not yours to delete. Lock first.");
340 return;
341 }
342
343 // Make sure its to be deleted
344 answer = MessageBox("Are you sure you want to delete this sound?", Sounds[n].name, MB_YESNO);
345 if (answer == IDNO)
346 return;
347
348 if (!mng_MakeLocker())
349 return;
350
351 strcpy(pl.name, Sounds[n].name);
352 pl.pagetype = PAGETYPE_SOUND;
353
354 // Check to see if this is a local sound only. If so, only delete it locally
355 if (mng_CheckIfPageOwned(&pl, TableUser) != 1) {
356 mng_FreeTrackLock(tl);
357 if (!mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1)) {
358 mprintf(0, ErrorString);
359 Int3();
360 }
361 } else // if its network, delete it from both the net and local drives
362 {
363
364 mng_FreeTrackLock(tl);
365 mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1);
366 mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 0);
367
368 mng_DeletePagelock(Sounds[n].name, PAGETYPE_SOUND);
369 }
370
371 // Advance to the next sound
372 D3EditState.current_sound = GetNextSound(n);
373
374 FreeSound(n);
375 mng_EraseLocker();
376
377 OutrageMessageBox("Sound deleted.");
378
379 RemapSounds();
380
381 UpdateDialog();
382 }
383
384 void CWorldSoundsDialog::OnLockSound() {
385 int n = D3EditState.current_sound;
386 mngs_Pagelock temp_pl;
387 mngs_sound_page soundpage;
388 int r;
389
390 if (Num_sounds < 1)
391 return;
392
393 if (!mng_MakeLocker())
394 return;
395
396 // Make sure it can be locked
397 strcpy(temp_pl.name, Sounds[n].name);
398 temp_pl.pagetype = PAGETYPE_SOUND;
399
400 r = mng_CheckIfPageLocked(&temp_pl);
401 if (r == 2) {
402 int answer;
403 answer = OutrageMessageBox(MBOX_YESNO, "This page is not even in the table file, or the database maybe corrupt. "
404 "Override to 'Unlocked'? (Select NO if you don't know what you're doing)");
405 if (answer == IDYES) {
406 strcpy(temp_pl.holder, "UNLOCKED");
407 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl))
408 MessageBox(ErrorString, "Error!");
409 }
410
411 } else if (r < 0)
412 OutrageMessageBox(ErrorString);
413 else if (r == 1)
414 OutrageMessageBox(InfoString);
415 else {
416
417 // Everything is ok. Tell the network we're locking it and get a copy to
418 // our local drive
419
420 strcpy(temp_pl.holder, TableUser);
421 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) {
422 MessageBox(ErrorString, "Error!");
423 mng_EraseLocker();
424 return;
425 } else {
426 // Search thru the net pagefile and get a new copy in RAM in case anyone
427 // changed it since we started the editor
428 if (mng_FindSpecificSoundPage(temp_pl.name, &soundpage)) {
429 if (mng_AssignSoundPageToSound(&soundpage, n)) {
430 if (!mng_ReplacePage(Sounds[n].name, Sounds[n].name, n, PAGETYPE_SOUND, 1)) {
431 OutrageMessageBox("There was problem writing that page locally!");
432 mng_EraseLocker();
433 return;
434 }
435 OutrageMessageBox("Sound locked.");
436
437 } else
438 OutrageMessageBox(
439 "There was a problem loading this sound. You might encounter problems in dealing with it. Good luck!");
440
441 mng_AllocTrackLock(Sounds[n].name, PAGETYPE_SOUND);
442 UpdateDialog();
443 } else
444 OutrageMessageBox("Couldn't find that sound in the table file!");
445 }
446 }
447 mng_EraseLocker();
448 }
449
450 void CWorldSoundsDialog::OnLoadSound() {
451 char filename[255];
452 int raw_handle;
453 int sound_handle;
454 int c = 1, finding_name = 1;
455
456 // Get the filename of the representing image
457
458 CString filter = "Descent III files (*.wav)|*.wav||";
459
460 if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_sounds_dir, sizeof(Current_sounds_dir)))
461 return;
462
463 sound_handle = D3EditState.current_sound;
464
465 // Okay, we selected a file. Lets do what needs to be done here.
466 raw_handle = LoadSoundFile(filename, Sounds[sound_handle].import_volume, true);
467
468 if (raw_handle < 0) {
469 OutrageMessageBox("Invalid sound file.");
470 return;
471 }
472
473 Sounds[sound_handle].sample_index = raw_handle;
474
475 // Finally, save a local copy of the raw
476
477 std::filesystem::path curname = LocalSoundsDir / SoundFiles[Sounds[sound_handle].sample_index].name;
478 cf_CopyFile(curname, filename);
479
480 UpdateDialog();
481 }
482
483 void CWorldSoundsDialog::OnNextSound() {
484 D3EditState.current_sound = GetNextSound(D3EditState.current_sound);
485 UpdateDialog();
486 }
487
488 void CWorldSoundsDialog::OnPrevSound() {
489 D3EditState.current_sound = GetPrevSound(D3EditState.current_sound);
490 UpdateDialog();
491 }
492
493 void CWorldSoundsDialog::OnKillfocusSoundNameEdit() {
494 CEdit *ebox;
495 int n = D3EditState.current_sound;
496 char name[PAGENAME_LEN];
497 mngs_Pagelock pl;
498
499 // Make sure we have this sound locked, if not reset name and bail
500 int p = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND);
501 if (p == -1) {
502 OutrageMessageBox("You must lock this sound if you wish to change its name.");
503 CEdit *ebox = (CEdit *)GetDlgItem(IDC_SOUND_NAME_EDIT);
504 ebox->SetWindowText(Sounds[n].name);
505 return;
506 }
507
508 // Get the new name
509 ebox = (CEdit *)GetDlgItem(IDC_SOUND_NAME_EDIT);
510 ebox->GetWindowText(name, PAGENAME_LEN);
511
512 // Check to see if there is already a sound with this name. If so, reset and bail
513 if (FindSoundName(name) != -1) {
514 OutrageMessageBox("There already is a sound with that name...choose another name.");
515
516 CEdit *ebox = (CEdit *)GetDlgItem(IDC_SOUND_NAME_EDIT);
517 ebox->SetWindowText(Sounds[n].name);
518 return;
519 }
520
521 if (!mng_MakeLocker())
522 return;
523
524 // Check to see if this page exists on the network. If so, we have to
525 // rename it so we can prevent havoc
526 strcpy(pl.name, Sounds[n].name);
527 pl.pagetype = PAGETYPE_SOUND;
528
529 int ret = mng_CheckIfPageOwned(&pl, TableUser);
530 if (ret < 0)
531 OutrageMessageBox(ErrorString);
532 else if (ret == 1)
533 mng_RenamePage(Sounds[n].name, name, PAGETYPE_SOUND);
534 else if (ret == 2) {
535 // This page has never been checked in, replace only local copy
536
537 char oldname[PAGENAME_LEN];
538 strcpy(oldname, Sounds[n].name);
539 strcpy(Sounds[n].name, name);
540
541 mng_ReplacePage(oldname, Sounds[n].name, n, PAGETYPE_SOUND, 1);
542 } else if (ret == 0) {
543 OutrageMessageBox("You don't own this page. Get Jason now!");
544 mng_FreeTrackLock(p);
545 return;
546 }
547
548 // Finally, copy our new name to the appropriate arrays
549 strcpy(GlobalTrackLocks[p].name, name);
550 strcpy(Sounds[n].name, name);
551 mng_EraseLocker();
552
553 RemapSounds();
554 UpdateDialog();
555 }
556
557 void CWorldSoundsDialog::OnSelendokSoundPulldown() {
558 int i, cur;
559 char name[200];
560
561 cur = SendDlgItemMessage(IDC_SOUND_PULLDOWN, CB_GETCURSEL, 0, 0);
562 SendDlgItemMessage(IDC_SOUND_PULLDOWN, CB_GETLBTEXT, cur, (LPARAM)(LPCTSTR)name);
563
564 i = FindSoundName(name);
565
566 if (i == -1) {
567 mprintf(0, "Possible corrupted sound list, but probably nothing.");
568 UpdateDialog();
569 }
570
571 D3EditState.current_sound = i;
572 UpdateDialog();
573 }
574
575 void CWorldSoundsDialog::UpdateDialog() {
576 CEdit *ebox;
577 CStatic *sbox;
578 CButton *bbox;
579 int n = D3EditState.current_sound;
580 char str[50];
581 int radio_index[4];
582 int i;
583
584 int total_hardware_memory = 0;
585 int total_memory = 0;
586
587 Sound_system.CheckAndForceSoundDataAlloc(D3EditState.current_sound);
588
589 for (i = 0; i < MAX_SOUNDS; i++) {
590 if (Sounds[i].used)
591 total_memory += SoundFiles[Sounds[i].sample_index].sample_length * 2;
592 }
593
594 if (Num_sounds < 1) {
595 bbox = (CButton *)GetDlgItem(IDC_NEXT_SOUND);
596 bbox->EnableWindow(FALSE);
597 bbox = (CButton *)GetDlgItem(IDC_PREV_SOUND);
598 bbox->EnableWindow(FALSE);
599
600 return;
601 } else {
602 bbox = (CButton *)GetDlgItem(IDC_NEXT_SOUND);
603 bbox->EnableWindow(TRUE);
604 bbox = (CButton *)GetDlgItem(IDC_PREV_SOUND);
605 bbox->EnableWindow(TRUE);
606 }
607
608 if (!Sounds[n].used)
609 n = D3EditState.current_sound = GetNextSound(n);
610
611 ebox = (CEdit *)GetDlgItem(IDC_SOUNDMAXDIST_EDIT);
612 sprintf(str, "%f", Sounds[n].max_distance);
613 ebox->SetWindowText(str);
614
615 sbox = (CStatic *)GetDlgItem(IDC_SOUND_MEMORY_STATIC);
616 sprintf(str, "%d, %d H, %d Total", SoundFiles[Sounds[n].sample_index].sample_length / 512,
617 total_hardware_memory / 1024, total_memory / 1024);
618 sbox->SetWindowText(str);
619
620 ebox = (CEdit *)GetDlgItem(IDC_SOUNDMINDIST_EDIT);
621 sprintf(str, "%f", Sounds[n].min_distance);
622 ebox->SetWindowText(str);
623
624 ebox = (CEdit *)GetDlgItem(IDC_SOUNDINNERCONEANGLE_EDIT);
625 sprintf(str, "%d", Sounds[n].inner_cone_angle);
626 ebox->SetWindowText(str);
627
628 ebox = (CEdit *)GetDlgItem(IDC_SOUNDOUTERCONEANGLE_EDIT);
629 sprintf(str, "%d", Sounds[n].outer_cone_angle);
630 ebox->SetWindowText(str);
631
632 ebox = (CEdit *)GetDlgItem(IDC_SOUNDOUTERCONEVOL_EDIT);
633 sprintf(str, "%f", Sounds[n].outer_cone_volume * 100);
634 ebox->SetWindowText(str);
635
636 ebox = (CEdit *)GetDlgItem(IDC_SOUNDLOOPSTART_EDIT);
637 sprintf(str, "%d", Sounds[n].loop_start);
638 ebox->SetWindowText(str);
639
640 if (Sounds[n].loop_end >= SoundFiles[Sounds[n].sample_index].np_sample_length) {
641 Sounds[n].loop_end = SoundFiles[Sounds[n].sample_index].np_sample_length - 1;
642 }
643
644 if (Sounds[n].loop_start > Sounds[n].loop_end) {
645 Sounds[n].loop_start = 0;
646 }
647
648 ebox = (CEdit *)GetDlgItem(IDC_SOUNDLOOPEND_EDIT);
649 sprintf(str, "%d", Sounds[n].loop_end);
650 ebox->SetWindowText(str);
651
652 ebox = (CEdit *)GetDlgItem(IDC_SOUND_IMPORT_VOLUME_EDIT);
653 sprintf(str, "%f", Sounds[n].import_volume * 100.0f);
654 ebox->SetWindowText(str);
655
656 ebox = (CEdit *)GetDlgItem(IDC_RAW_NAME_EDIT);
657 ebox->SetWindowText(SoundFiles[Sounds[n].sample_index].name);
658
659 bbox = (CButton *)GetDlgItem(IDC_SOUNDHALLEFFECT_CHECK);
660 bbox->SetCheck(!(Sounds[n].flags & SPF_FIXED_FREQ));
661
662 bbox = (CButton *)GetDlgItem(IDC_SOUNDFOREVER_CHECK);
663 bbox->SetCheck(Sounds[n].flags & SPF_FOREVER);
664
665 bbox = (CButton *)GetDlgItem(IDC_SOUND_ONCE_PER_OBJ_CHECK);
666 bbox->SetCheck(Sounds[n].flags & SPF_ONCE_PER_OBJ);
667
668 bbox = (CButton *)GetDlgItem(IDC_SOUNDEXCLUSIVE_CHECK);
669 bbox->SetCheck(Sounds[n].flags & SPF_PLAYS_EXCLUSIVELY);
670
671 bbox = (CButton *)GetDlgItem(IDC_SOUND_NO_UPDATE);
672 bbox->SetCheck(Sounds[n].flags & SPF_LISTENER_UPDATE);
673
674 bbox = (CButton *)GetDlgItem(IDC_SOUNDONCE_CHECK);
675 bbox->SetCheck(Sounds[n].flags & SPF_PLAYS_ONCE);
676
677 bbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECK);
678 bbox->SetCheck(Sounds[n].flags & SPF_LOOPED);
679
680 if (Sounds[n].flags & SPF_OBJ_UPDATE) {
681 bbox = (CButton *)GetDlgItem(IDC_SOUNDOBJATTACH_RADIO);
682 bbox->SetCheck(1);
683 bbox = (CButton *)GetDlgItem(IDC_SOUNDPOSATTACH_RADIO);
684 bbox->SetCheck(0);
685 } else {
686 bbox = (CButton *)GetDlgItem(IDC_SOUNDPOSATTACH_RADIO);
687 bbox->SetCheck(1);
688 bbox = (CButton *)GetDlgItem(IDC_SOUNDOBJATTACH_RADIO);
689 bbox->SetCheck(0);
690 }
691
692 memset(radio_index, 0, 4 * sizeof(int));
693 switch (SPFT_CONE_LINK_MASK & Sounds[n].flags) {
694 case SPFT_CONE_LINK_OBJECT:
695 radio_index[0] = 1;
696 break;
697 case SPFT_CONE_LINK_TURRET1:
698 radio_index[1] = 1;
699 break;
700 case SPFT_CONE_LINK_TURRET2:
701 radio_index[2] = 1;
702 break;
703 case SPFT_CONE_LINK_TURRET3:
704 radio_index[3] = 1;
705 break;
706 }
707 bbox = (CButton *)GetDlgItem(IDC_SOUNDOBJECT_RADIO);
708 bbox->SetCheck(radio_index[0]);
709 bbox = (CButton *)GetDlgItem(IDC_SOUNDTURRET1_RADIO);
710 bbox->SetCheck(radio_index[1]);
711 bbox = (CButton *)GetDlgItem(IDC_SOUNDTURRET2_RADIO);
712 bbox->SetCheck(radio_index[2]);
713 bbox = (CButton *)GetDlgItem(IDC_SOUNDTURRET3_RADIO);
714 bbox->SetCheck(radio_index[3]);
715
716 memset(radio_index, 0, 4 * sizeof(int));
717 switch (SPFT_CONE_DIR_MASK & Sounds[n].flags) {
718 case SPFT_CONE_DIR_FORWARD:
719 radio_index[0] = 1;
720 break;
721 case SPFT_CONE_DIR_BACKWARD:
722 radio_index[1] = 1;
723 break;
724 case SPFT_CONE_DIR_UPWARD:
725 radio_index[2] = 1;
726 break;
727 case SPFT_CONE_DIR_DOWNWARD:
728 radio_index[3] = 1;
729 break;
730 }
731 bbox = (CButton *)GetDlgItem(IDC_SOUNDFORWARD_RADIO);
732 bbox->SetCheck(radio_index[0]);
733 bbox = (CButton *)GetDlgItem(IDC_SOUNDBACKWARD_RADIO);
734 bbox->SetCheck(radio_index[1]);
735 bbox = (CButton *)GetDlgItem(IDC_SOUNDUPWARD_RADIO);
736 bbox->SetCheck(radio_index[2]);
737 bbox = (CButton *)GetDlgItem(IDC_SOUNDDOWNWARD_RADIO);
738 bbox->SetCheck(radio_index[3]);
739
740 bbox = (CButton *)GetDlgItem(IDC_CHECKIN_SOUND);
741 if (mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND) == -1) {
742 bbox->EnableWindow(FALSE);
743 bbox = (CButton *)GetDlgItem(IDC_LOCK_SOUND);
744 bbox->EnableWindow(TRUE);
745 bbox = (CButton *)GetDlgItem(IDC_SOUND_CHANGE_NAME);
746 bbox->EnableWindow(FALSE);
747 } else {
748 bbox->EnableWindow(TRUE);
749 bbox = (CButton *)GetDlgItem(IDC_LOCK_SOUND);
750 bbox->EnableWindow(FALSE);
751 bbox = (CButton *)GetDlgItem(IDC_SOUND_CHANGE_NAME);
752 bbox->EnableWindow(TRUE);
753 }
754
755 SendDlgItemMessage(IDC_SOUND_PULLDOWN, CB_RESETCONTENT, 0, 0);
756
757 for (i = 0; i < MAX_SOUNDS; i++) {
758 if (Sounds[i].used)
759 SendDlgItemMessage(IDC_SOUND_PULLDOWN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)Sounds[i].name);
760 }
761 SendDlgItemMessage(IDC_SOUND_PULLDOWN, CB_SELECTSTRING, 0, (LPARAM)(LPCTSTR)Sounds[n].name);
762 }
763
764 void CWorldSoundsDialog::SaveSoundsOnClose() {
765 int i, t;
766
767 if (!Network_up)
768 return; // don't save a damn thing if the network is down
769
770 for (i = 0; i < MAX_TRACKLOCKS; i++) {
771 if (GlobalTrackLocks[i].used == 1 && GlobalTrackLocks[i].pagetype == PAGETYPE_SOUND) {
772 t = FindSoundName(GlobalTrackLocks[i].name);
773 ASSERT(t != -1);
774
775 mng_ReplacePage(Sounds[t].name, Sounds[t].name, t, PAGETYPE_SOUND, 1);
776 }
777 }
778 }
779
780 BOOL CWorldSoundsDialog::DestroyWindow() {
781 SaveSoundsOnClose();
782 return CDialog::DestroyWindow();
783 }
784
785 BOOL CWorldSoundsDialog::OnInitDialog() {
786 CDialog::OnInitDialog();
787
788 UpdateDialog();
789
790 return TRUE; // return TRUE unless you set the focus to a control
791 // EXCEPTION: OCX Property Pages should return FALSE
792 }
793
794 void CWorldSoundsDialog::OnPlaysound() {
795 int n = D3EditState.current_sound;
796
797 if (Num_sounds < 1)
798 return;
799
800 Sound_system.BeginSoundFrame();
801 Sound_system.Play2dSound(n);
802 Sound_system.EndSoundFrame();
803 }
804
805 void CWorldSoundsDialog::OnKillfocusSoundinnerconeangleEdit() {
806 CEdit *ebox;
807 char str[20];
808 int n = D3EditState.current_sound;
809
810 ebox = (CEdit *)GetDlgItem(IDC_SOUNDINNERCONEANGLE_EDIT);
811 ebox->GetWindowText(str, 20);
812
813 Sounds[n].inner_cone_angle = atoi(str);
814 }
815
816 void CWorldSoundsDialog::OnKillfocusSoundloopendEdit() {
817 CEdit *ebox;
818 char str[20];
819 int n = D3EditState.current_sound;
820
821 ebox = (CEdit *)GetDlgItem(IDC_SOUNDLOOPEND_EDIT);
822 ebox->GetWindowText(str, 20);
823
824 sscanf(str, "%d", &Sounds[n].loop_end);
825 if (Sounds[n].loop_end < Sounds[n].loop_start)
826 Sounds[n].loop_end = Sounds[n].loop_start;
827 if (Sounds[n].loop_end >= SoundFiles[Sounds[n].sample_index].np_sample_length)
828 Sounds[n].loop_end = SoundFiles[Sounds[n].sample_index].np_sample_length - 1;
829
830 if (Sounds[n].loop_end < 0)
831 Sounds[n].loop_end = 0;
832
833 UpdateDialog();
834 }
835
836 void CWorldSoundsDialog::OnKillfocusSoundloopstartEdit() {
837 CEdit *ebox;
838 char str[20];
839 int n = D3EditState.current_sound;
840
841 ebox = (CEdit *)GetDlgItem(IDC_SOUNDLOOPSTART_EDIT);
842 ebox->GetWindowText(str, 20);
843
844 sscanf(str, "%d", &Sounds[n].loop_start);
845 if (Sounds[n].loop_start > Sounds[n].loop_end)
846 Sounds[n].loop_start = Sounds[n].loop_end;
847 if (Sounds[n].loop_start >= SoundFiles[Sounds[n].sample_index].np_sample_length)
848 Sounds[n].loop_start = SoundFiles[Sounds[n].sample_index].np_sample_length - 1;
849
850 if (Sounds[n].loop_start < 0)
851 Sounds[n].loop_start = 0;
852
853 UpdateDialog();
854 }
855
856 void CWorldSoundsDialog::OnKillfocusSoundmaxdistEdit() {
857 CEdit *ebox;
858 char str[20];
859 int n = D3EditState.current_sound;
860
861 ebox = (CEdit *)GetDlgItem(IDC_SOUNDMAXDIST_EDIT);
862 ebox->GetWindowText(str, 20);
863
864 Sounds[n].max_distance = atof(str);
865 }
866
867 void CWorldSoundsDialog::OnKillfocusSoundmindistEdit() {
868 CEdit *ebox;
869 char str[20];
870 int n = D3EditState.current_sound;
871
872 ebox = (CEdit *)GetDlgItem(IDC_SOUNDMINDIST_EDIT);
873 ebox->GetWindowText(str, 20);
874
875 Sounds[n].min_distance = atof(str);
876 }
877
878 void CWorldSoundsDialog::OnKillfocusSoundouterconeangleEdit() {
879 CEdit *ebox;
880 char str[20];
881 int n = D3EditState.current_sound;
882
883 ebox = (CEdit *)GetDlgItem(IDC_SOUNDOUTERCONEANGLE_EDIT);
884 ebox->GetWindowText(str, 20);
885
886 Sounds[n].outer_cone_angle = atoi(str);
887 }
888
889 void CWorldSoundsDialog::OnKillfocusSoundouterconevolEdit() {
890 CEdit *ebox;
891 char str[20];
892 int n = D3EditState.current_sound;
893
894 ebox = (CEdit *)GetDlgItem(IDC_SOUNDOUTERCONEVOL_EDIT);
895 ebox->GetWindowText(str, 20);
896
897 Sounds[n].outer_cone_volume = atof(str) / 100.0;
898 }
899
900 void CWorldSoundsDialog::OnSoundhalleffectCheck() {
901 int n = D3EditState.current_sound;
902 CButton *btn;
903
904 btn = (CButton *)GetDlgItem(IDC_SOUNDHALLEFFECT_CHECK);
905
906 if (btn->GetCheck())
907 Sounds[n].flags &= ~SPF_FIXED_FREQ;
908 else
909 Sounds[n].flags |= SPF_FIXED_FREQ;
910 }
911
912 void CWorldSoundsDialog::OnLoopingCheck() {
913 int n = D3EditState.current_sound;
914 CButton *btn;
915
916 btn = (CButton *)GetDlgItem(IDC_LOOPING_CHECK);
917
918 if (btn->GetCheck())
919 Sounds[n].flags |= SPF_LOOPED;
920 else
921 Sounds[n].flags &= ~SPF_LOOPED;
922 }
923
924 void CWorldSoundsDialog::OnSoundbackwardRadio() {
925 int n = D3EditState.current_sound;
926
927 Sounds[n].flags &= ~SPFT_CONE_DIR_MASK;
928 Sounds[n].flags |= SPFT_CONE_DIR_BACKWARD;
929 }
930
931 void CWorldSoundsDialog::OnSounddownwardRadio() {
932 int n = D3EditState.current_sound;
933
934 Sounds[n].flags &= ~SPFT_CONE_DIR_MASK;
935 Sounds[n].flags |= SPFT_CONE_DIR_DOWNWARD;
936 }
937
938 void CWorldSoundsDialog::OnSoundexclusiveCheck() {
939 int n = D3EditState.current_sound;
940 CButton *btn;
941
942 btn = (CButton *)GetDlgItem(IDC_SOUNDEXCLUSIVE_CHECK);
943
944 if (btn->GetCheck())
945 Sounds[n].flags |= SPF_PLAYS_EXCLUSIVELY;
946 else
947 Sounds[n].flags &= ~SPF_PLAYS_EXCLUSIVELY;
948 }
949
950 void CWorldSoundsDialog::OnSoundforeverCheck() {
951 int n = D3EditState.current_sound;
952 CButton *btn;
953
954 btn = (CButton *)GetDlgItem(IDC_SOUNDFOREVER_CHECK);
955
956 if (btn->GetCheck())
957 Sounds[n].flags |= SPF_FOREVER;
958 else
959 Sounds[n].flags &= ~SPF_FOREVER;
960 }
961
962 void CWorldSoundsDialog::OnSoundforwardRadio() {
963 int n = D3EditState.current_sound;
964
965 Sounds[n].flags &= ~SPFT_CONE_DIR_MASK;
966 Sounds[n].flags |= SPFT_CONE_DIR_FORWARD;
967 }
968
969 void CWorldSoundsDialog::OnSoundobjattachRadio() {
970 int n = D3EditState.current_sound;
971 Sounds[n].flags |= SPF_OBJ_UPDATE;
972 }
973
974 void CWorldSoundsDialog::OnSoundobjectRadio() {
975 int n = D3EditState.current_sound;
976
977 Sounds[n].flags &= ~SPFT_CONE_LINK_MASK;
978 Sounds[n].flags |= SPFT_CONE_LINK_OBJECT;
979 }
980
981 void CWorldSoundsDialog::OnSoundonceCheck() {
982 int n = D3EditState.current_sound;
983 CButton *btn;
984
985 btn = (CButton *)GetDlgItem(IDC_SOUNDONCE_CHECK);
986
987 if (btn->GetCheck())
988 Sounds[n].flags |= SPF_PLAYS_ONCE;
989 else
990 Sounds[n].flags &= ~SPF_PLAYS_ONCE;
991 }
992
993 void CWorldSoundsDialog::OnSoundposattachRadio() {
994 int n = D3EditState.current_sound;
995 Sounds[n].flags &= ~SPF_OBJ_UPDATE;
996 }
997
998 void CWorldSoundsDialog::OnSoundturret1Radio() {
999 int n = D3EditState.current_sound;
1000
1001 Sounds[n].flags &= ~SPFT_CONE_LINK_MASK;
1002 Sounds[n].flags |= SPFT_CONE_LINK_TURRET1;
1003 }
1004
1005 void CWorldSoundsDialog::OnSoundturret2Radio() {
1006 int n = D3EditState.current_sound;
1007
1008 Sounds[n].flags &= ~SPFT_CONE_LINK_MASK;
1009 Sounds[n].flags |= SPFT_CONE_LINK_TURRET2;
1010 }
1011
1012 void CWorldSoundsDialog::OnSoundturret3Radio() {
1013 int n = D3EditState.current_sound;
1014
1015 Sounds[n].flags &= ~SPFT_CONE_LINK_MASK;
1016 Sounds[n].flags |= SPFT_CONE_LINK_TURRET3;
1017 }
1018
1019 void CWorldSoundsDialog::OnSoundupwardRadio() {
1020 int n = D3EditState.current_sound;
1021
1022 Sounds[n].flags &= ~SPFT_CONE_DIR_MASK;
1023 Sounds[n].flags |= SPFT_CONE_DIR_UPWARD;
1024 }
1025
1026 BOOL CWorldSoundsDialog::OnHelpInfo(HELPINFO *pHelpInfo) {
1027 WinHelp(HID_SOUNDSDLG, HELP_CONTEXT);
1028 return TRUE;
1029 // return CDialog::OnHelpInfo(pHelpInfo);
1030 }
1031
1032 void CWorldSoundsDialog::OnSoundNoUpdate() {
1033 int n = D3EditState.current_sound;
1034 CButton *btn;
1035
1036 btn = (CButton *)GetDlgItem(IDC_SOUND_NO_UPDATE);
1037
1038 if (btn->GetCheck())
1039 Sounds[n].flags |= SPF_LISTENER_UPDATE;
1040 else
1041 Sounds[n].flags &= ~SPF_LISTENER_UPDATE;
1042 }
1043
1044 void CWorldSoundsDialog::OnKillsounds() {
1045 Sound_system.BeginSoundFrame();
1046 Sound_system.StopAllSounds();
1047 Sound_system.EndSoundFrame();
1048 }
1049
1050 void CWorldSoundsDialog::OnSoundOncePerObjCheck() {
1051 int n = D3EditState.current_sound;
1052 CButton *btn;
1053
1054 btn = (CButton *)GetDlgItem(IDC_SOUND_ONCE_PER_OBJ_CHECK);
1055
1056 if (btn->GetCheck())
1057 Sounds[n].flags |= SPF_ONCE_PER_OBJ;
1058 else
1059 Sounds[n].flags &= ~SPF_ONCE_PER_OBJ;
1060 }
1061
1062 void CWorldSoundsDialog::OnKillfocusSoundImportVolumeEdit() {
1063 CEdit *ebox;
1064 char str[20];
1065 int n = D3EditState.current_sound;
1066
1067 ebox = (CEdit *)GetDlgItem(IDC_SOUND_IMPORT_VOLUME_EDIT);
1068 ebox->GetWindowText(str, 20);
1069
1070 sscanf(str, "%f", &Sounds[n].import_volume);
1071 Sounds[n].import_volume /= 100.0f;
1072
1073 if (Sounds[n].import_volume < 0.01f)
1074 Sounds[n].import_volume = 0.01f;
1075 if (Sounds[n].import_volume > 1.0f)
1076 Sounds[n].import_volume = 1.0f;
1077
1078 int j = Sounds[n].sample_index;
1079 if (j >= 0 && SoundFiles[j].used) {
1080 if (SoundFiles[j].sample_16bit) {
1081 GlobalFree(SoundFiles[j].sample_16bit);
1082 SoundFiles[j].sample_16bit = NULL;
1083 }
1084
1085 if (SoundFiles[j].sample_8bit) {
1086 GlobalFree(SoundFiles[j].sample_8bit);
1087 SoundFiles[j].sample_8bit = NULL;
1088 }
1089 }
1090
1091 UpdateDialog();
1092 }
1093
1094 #include "mem.h"
1095 #include "EditLineDialog.h"
1096
1097 // Gets a name from the user, making sure it's unique
1098 // Returns true if got new name, false if cancelled.
1099 // the data in buf not changed if cancel is pressed
1100 bool InputSoundName(char *buf, int len, char *title, char *prompt, CWnd *wnd) {
1101 if (len > (PAGENAME_LEN - 1))
1102 len = PAGENAME_LEN - 1;
1103
1104 char *tempbuf = (char *)mem_malloc(len);
1105
1106 strncpy(tempbuf, buf, len - 1);
1107 tempbuf[len - 1] = '\0';
1108
1109 try_again:
1110
1111 if (!InputString(tempbuf, len, title, prompt, wnd)) {
1112 mem_free(tempbuf);
1113 return 0;
1114 }
1115
1116 if (FindSoundName(tempbuf) != -1) {
1117 OutrageMessageBox("The name you specified is already in use. Enter another name.");
1118 goto try_again;
1119 }
1120
1121 strcpy(buf, tempbuf);
1122 mem_free(tempbuf);
1123
1124 return 1;
1125 }
1126
1127 void CWorldSoundsDialog::OnSoundChangeName() {
1128 int n = D3EditState.current_sound;
1129
1130 char name[PAGENAME_LEN];
1131 mngs_Pagelock pl;
1132
1133 // Make sure we have this ship locked, if not reset name and bail
1134 int p = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND);
1135 if (p == -1) {
1136 OutrageMessageBox("You must lock this sound if you wish to change its name.");
1137 return;
1138 }
1139
1140 if (!mng_MakeLocker())
1141 return;
1142
1143 // Get new name
1144 strcpy(name, Sounds[n].name);
1145 if (!InputSoundName(name, sizeof(name), "Sound name", "Enter a new name for this sound:", this))
1146 return;
1147
1148 // Check to see if this page exists on the network. If so, we have to
1149 // rename it so we can prevent havoc
1150 strcpy(pl.name, Sounds[n].name);
1151 pl.pagetype = PAGETYPE_SOUND;
1152
1153 int ret = mng_CheckIfPageOwned(&pl, TableUser);
1154 if (ret < 0)
1155 OutrageMessageBox(ErrorString);
1156 else if (ret == 1)
1157 mng_RenamePage(Sounds[n].name, name, PAGETYPE_SOUND);
1158 else if (ret == 2) {
1159 // This page has never been checked in, replace only local copy
1160
1161 char oldname[PAGENAME_LEN];
1162 strcpy(oldname, Sounds[n].name);
1163 strcpy(Sounds[n].name, name);
1164
1165 mng_ReplacePage(oldname, Sounds[n].name, n, PAGETYPE_SOUND, 1);
1166 } else if (ret == 0) {
1167 OutrageMessageBox("You don't own this page. Get Jason now!");
1168 mng_FreeTrackLock(p);
1169 return;
1170 }
1171
1172 // Finally, copy our new name to the appropriate arrays
1173 strcpy(GlobalTrackLocks[p].name, name);
1174 strcpy(Sounds[n].name, name);
1175 mng_EraseLocker();
1176
1177 UpdateDialog();
1178 }
1179
1180 void CWorldSoundsDialog::OnOverride() {
1181 int n = D3EditState.current_sound;
1182 mngs_Pagelock temp_pl;
1183
1184 strcpy(temp_pl.name, Sounds[n].name);
1185 temp_pl.pagetype = PAGETYPE_SOUND;
1186
1187 mng_OverrideToUnlocked(&temp_pl);
1188 }