FS2_Open
Open source remastering of the Freespace 2 engine
voiceactingmanager.cpp
Go to the documentation of this file.
1 // VoiceActingManager.cpp : implementation file
2 //
3 
4 #include "stdafx.h"
5 #include <string.h>
6 #include "fred.h"
7 #include "fred2/freddoc.h"
8 #include "VoiceActingManager.h"
11 #include "mission/missionmessage.h"
12 #include "mission/missiongoals.h"
13 #include "hud/hudtarget.h"
14 #include "parse/sexp.h"
15 #include "iff_defs/iff_defs.h"
16 #include "mission/missiongoals.h"
17 #include <math.h>
18 
19 #ifdef _DEBUG
20 #undef THIS_FILE
21 static char THIS_FILE[] = __FILE__;
22 #endif
23 
24 #define INVALID_MESSAGE ((MMessage*)0xFFFFFFFF)
25 
26 // to keep track of data
37 
38 
40 // VoiceActingManager dialog
41 
42 
44  : CDialog(VoiceActingManager::IDD, pParent)
45 {
46  //{{AFX_DATA_INIT(VoiceActingManager)
47  m_abbrev_briefing = _T("");
48  m_abbrev_campaign = _T("");
50  m_abbrev_debriefing = _T("");
51  m_abbrev_message = _T("");
52  m_abbrev_mission = _T("");
54  m_example = _T("");
56  m_script_entry_format = _T("");
63  //}}AFX_DATA_INIT
64 }
65 
66 
67 void VoiceActingManager::DoDataExchange(CDataExchange* pDX)
68 {
69  CDialog::DoDataExchange(pDX);
70  //{{AFX_DATA_MAP(VoiceActingManager)
71  DDX_Text(pDX, IDC_ABBREV_BRIEFING, m_abbrev_briefing);
72  DDX_Text(pDX, IDC_ABBREV_CAMPAIGN, m_abbrev_campaign);
75  DDX_Text(pDX, IDC_ABBREV_MESSAGE, m_abbrev_message);
76  DDX_Text(pDX, IDC_ABBREV_MISSION, m_abbrev_mission);
77  DDX_Text(pDX, IDC_EXAMPLE, m_example);
78  DDX_Check(pDX, IDC_NO_REPLACE, m_no_replace);
85  DDX_Check(pDX, IDC_EXPORT_MESSAGES, m_export_messages);
86  DDX_Check(pDX, IDC_GROUP_MESSAGES, m_group_messages);
87  //}}AFX_DATA_MAP
88 }
89 
90 
91 BEGIN_MESSAGE_MAP(VoiceActingManager, CDialog)
92  //{{AFX_MSG_MAP(VoiceActingManager)
93  ON_WM_CLOSE()
94  ON_EN_SETFOCUS(IDC_ABBREV_BRIEFING, OnSetfocusAbbrevBriefing)
95  ON_EN_SETFOCUS(IDC_ABBREV_CAMPAIGN, OnSetfocusAbbrevCampaign)
96  ON_EN_SETFOCUS(IDC_ABBREV_COMMAND_BRIEFING, OnSetfocusAbbrevCommandBriefing)
97  ON_EN_SETFOCUS(IDC_ABBREV_DEBRIEFING, OnSetfocusAbbrevDebriefing)
98  ON_EN_SETFOCUS(IDC_ABBREV_MESSAGE, OnSetfocusAbbrevMessage)
99  ON_EN_SETFOCUS(IDC_ABBREV_MISSION, OnSetfocusAbbrevMission)
100  ON_CBN_SETFOCUS(IDC_SUFFIX, OnSetfocusSuffix)
101  ON_EN_CHANGE(IDC_ABBREV_BRIEFING, OnChangeAbbrevBriefing)
102  ON_EN_CHANGE(IDC_ABBREV_CAMPAIGN, OnChangeAbbrevCampaign)
103  ON_EN_CHANGE(IDC_ABBREV_COMMAND_BRIEFING, OnChangeAbbrevCommandBriefing)
104  ON_EN_CHANGE(IDC_ABBREV_DEBRIEFING, OnChangeAbbrevDebriefing)
105  ON_EN_CHANGE(IDC_ABBREV_MESSAGE, OnChangeAbbrevMessage)
106  ON_EN_CHANGE(IDC_ABBREV_MISSION, OnChangeAbbrevMission)
107  ON_CBN_SELCHANGE(IDC_SUFFIX, OnChangeOtherSuffix)
108  ON_BN_CLICKED(IDC_NO_REPLACE, OnChangeNoReplace)
109  ON_BN_CLICKED(IDC_GENERATE_FILE_NAMES, OnGenerateFileNames)
110  ON_BN_CLICKED(IDC_GENERATE_SCRIPT, OnGenerateScript)
111  ON_BN_CLICKED(IDC_EXPORT_EVERYTHING, OnExportEverything)
112  ON_BN_CLICKED(IDC_EXPORT_COMMAND_BRIEFINGS, OnExportCommandBriefings)
113  ON_BN_CLICKED(IDC_EXPORT_BRIEFINGS, OnExportBriefings)
114  ON_BN_CLICKED(IDC_EXPORT_DEBRIEFINGS, OnExportDebriefings)
115  ON_BN_CLICKED(IDC_EXPORT_MESSAGES, OnExportMessages)
116  ON_BN_CLICKED(IDC_INCLUDE_SENDER, OnBnClickedIncludeSender)
117  //}}AFX_MSG_MAP
118 END_MESSAGE_MAP()
119 
121 // VoiceActingManager message handlers
122 
123 BOOL VoiceActingManager::OnInitDialog()
124 {
125  CComboBox *box = ((CComboBox *) GetDlgItem(IDC_SUFFIX));
126  box->AddString(".WAV");
127  box->AddString(".OGG");
128  box->SetCurSel(0);
129 
130  // load saved data for file names
131  m_abbrev_briefing = _T(Voice_abbrev_briefing);
132  m_abbrev_campaign = _T(Voice_abbrev_campaign);
133  m_abbrev_command_briefing = _T(Voice_abbrev_command_briefing);
134  m_abbrev_debriefing = _T(Voice_abbrev_debriefing);
135  m_abbrev_message = _T(Voice_abbrev_message);
136  m_abbrev_mission = _T(Voice_abbrev_mission);
137  m_no_replace = Voice_no_replace_filenames;
138 
139  // load saved data for script
140  m_script_entry_format = _T(Voice_script_entry_format);
141  m_export_everything = m_export_command_briefings = m_export_briefings = m_export_debriefings = m_export_messages = FALSE;
142  if (Voice_export_selection == 1)
143  m_export_command_briefings = TRUE;
144  else if (Voice_export_selection == 2)
145  m_export_briefings = TRUE;
146  else if (Voice_export_selection == 3)
147  m_export_debriefings = TRUE;
148  else if (Voice_export_selection == 4)
149  m_export_messages = TRUE;
150  else
151  m_export_everything = TRUE;
152  m_group_messages = Voice_group_messages;
153 
154  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
155  button->EnableWindow(m_export_everything || m_export_messages);
156 
157  UpdateData(FALSE);
158 
159  return TRUE;
160 }
161 
163 {
164  UpdateData(TRUE);
165 
166  // save data for file names
173  Voice_no_replace_filenames = (m_no_replace == TRUE) ? true : false;
174 
175  // save data for script
179  else if (m_export_briefings)
181  else if (m_export_debriefings)
183  else if (m_export_messages)
185  else
187  Voice_group_messages = (m_group_messages == TRUE) ? true : false;
188 
189  CDialog::OnClose();
190 }
191 
193 {
194  // assign suffix
195  if (((CComboBox *) GetDlgItem(IDC_SUFFIX))->GetCurSel() == 1)
196  return ".ogg";
197  else
198  return ".wav";
199 }
200 
202 {
203  if (size >= 10000)
204  return 5;
205  else if (size >= 1000) // I hope we never hit this!
206  return 4;
207  else if (size >= 100)
208  return 3;
209  else
210  return 2;
211 }
212 
214 {
215  // pick a default
216 
217  if (m_abbrev_command_briefing != "")
219  else if (m_abbrev_briefing != "")
221  else if (m_abbrev_debriefing != "")
223  else if (m_abbrev_message != "")
225  else
226  build_example("");
227 }
228 
230 {
231  if (section == "")
232  {
233  m_example = "";
234  return;
235  }
236 
237  m_example = generate_filename(section, 1, 2, INVALID_MESSAGE);
238 }
239 
240 CString VoiceActingManager::generate_filename(CString section, int number, int digits, MMessage *message)
241 {
242  if (section == "")
243  return "none.wav";
244 
245  int i;
246  CString str = "";
247  CString num;
248 
249  // build prefix
250  if (m_abbrev_campaign != "")
251  str = str + m_abbrev_campaign;
252  if (m_abbrev_mission != "")
253  str = str + m_abbrev_mission;
254  str = str + section;
255 
256  // build number
257  num.Format("%d", number);;
258  digits -= num.GetLength();
259  for (i = 0; i < digits; i++)
260  {
261  num = "0" + num;
262  }
263  str = str + num;
264 
265 
266  const CString suffix = get_suffix();
267  // append sender name if supposed to and I have been passed a message
268  // to get the sender from
269  if ( message != NULL && m_use_sender_in_filename ) {
270  size_t allow_to_copy = NAME_LENGTH - suffix.GetLength() - str.GetLength();
271  char sender[NAME_LENGTH];
272  if ( message == INVALID_MESSAGE ) {
273  strcpy_s(sender, "Alpha 1");
274  } else {
275  get_valid_sender(sender, sizeof(sender), message);
276  }
277 
278  // truncate sender to that we don't overflow filename
279  sender[allow_to_copy] = '\0';
280  size_t j;
281  for( j = 0; sender[j] != '\0'; j++ ) {
282  // lower case letter
283  sender[j] = (char)tolower(sender[j]);
284 
285  // replace any non alpha numeric with a underscore
286  if ( !isalnum( sender[j] ) )
287  sender[j] = '_';
288  }
289 
290  // flatten muliple underscores
291  j = 1;
292  while( sender[j] != '\0' ) {
293  if ( sender[j-1] == '_' && sender[j] == '_' ) {
294  size_t k;
295  for (k = j + 1; sender[k] != '\0'; k++ )
296  sender[k - 1] = sender[k];
297  sender[k - 1] = '\0';
298  } else {
299  // only increment on rounds when I am not moving the string down
300  j++;
301  }
302  }
303  str = str + sender;
304  }
305 
306  // suffix
307  str = str + get_suffix();
308 
309  Assert( str.GetLength() < NAME_LENGTH );
310 
311  return str;
312 }
313 
315 {
316  int i;
317  int digits;
318  size_t modified_filenames = 0;
319 
320  // stuff data to variables
321  UpdateData(TRUE);
322 
323  // command briefings
324  digits = calc_digits(Cmd_briefs[0].num_stages);
325  for (i = 0; i < Cmd_briefs[0].num_stages; i++)
326  {
328 
329  // generate only if we're replacing or if it has a replaceable name
330  if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
331  {
332  strcpy(filename, LPCTSTR(generate_filename(m_abbrev_command_briefing, i + 1, digits)));
333  modified_filenames++;
334  }
335  }
336 
337  // briefings
338  digits = calc_digits(Briefings[0].num_stages);
339  for (i = 0; i < Briefings[0].num_stages; i++)
340  {
341  char *filename = Briefings[0].stages[i].voice;
342 
343  // generate only if we're replacing or if it has a replaceable name
344  if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
345  {
346  strcpy(filename, LPCTSTR(generate_filename(m_abbrev_briefing, i + 1, digits)));
347  modified_filenames++;
348  }
349  }
350 
351  // debriefings
352  digits = calc_digits(Debriefings[0].num_stages);
353  for (i = 0; i < Debriefings[0].num_stages; i++)
354  {
355  char *filename = Debriefings[0].stages[i].voice;
356 
357  // generate only if we're replacing or if it has a replaceable name
358  if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
359  {
360  strcpy(filename, LPCTSTR(generate_filename(m_abbrev_debriefing, i + 1, digits)));
361  modified_filenames++;
362  }
363  }
364 
365  // messages
367  for (i = 0; i < Num_messages - Num_builtin_messages; i++)
368  {
369  char *filename = Messages[i + Num_builtin_messages].wave_info.name;
371 
372  // generate only if we're replacing or if it has a replaceable name
373  if (!m_no_replace || !strlen(filename) || message_filename_is_generic(filename))
374  {
375  // free existing filename
376  if (filename != NULL)
377  free(filename);
378 
379  // allocate new filename
380  Messages[i + Num_builtin_messages].wave_info.name = strdup(LPCTSTR(generate_filename(m_abbrev_message, i + 1, digits, message)));
381  modified_filenames++;
382  }
383  }
384 
385  if ( modified_filenames > 0 ) {
386  // Tell FRED that we actually modified something
388  }
389 
390  // notify user that we are done and how many filenames were changed
391  char message[128] = { '\0' };
392  snprintf(message, sizeof(message)-1, "File name generation complete. Modified %u messages.", modified_filenames);
393  MessageBox(message, "Woohoo!");
394 }
395 
397 {
398  char pathname[256];
399 
400  // stuff data to variables
401  UpdateData(TRUE);
402 
403  // prompt to save script
404  CFileDialog dlg(FALSE, "txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text files (*.txt)|*.txt||");
405  if (dlg.DoModal() != IDOK)
406  return;
407 
408  CString dlgPathName = dlg.GetPathName( );
409  string_copy(pathname, dlgPathName, 256);
410  fp = cfopen(pathname, "wt", CFILE_NORMAL);
411  if (!fp)
412  {
413  MessageBox("Can't open file to save.", "Error!");
414  return;
415  }
416 
417  fout("%s\n", Mission_filename);
418  fout("%s\n\n", The_mission.name);
419 
421  {
422  fout("\n\nCommand Briefings\n-----------------\n\n");
423 
424  for (int i = 0; i < Cmd_briefs[0].num_stages; i++)
425  {
426  CString entry = m_script_entry_format;
427  entry.Replace("\r\n", "\n");
428 
429  cmd_brief_stage *stage = &Cmd_briefs[0].stage[i];
430  entry.Replace("$filename", stage->wave_filename);
431  entry.Replace("$message", stage->text.c_str());
432  entry.Replace("$persona", "<no persona specified>");
433  entry.Replace("$sender", "<no sender specified>");
434 
435  fout("%s\n\n\n", (char *) (LPCTSTR) entry);
436  }
437  }
438 
440  {
441  fout("\n\nBriefings\n---------\n\n");
442 
443  for (int i = 0; i < Briefings[0].num_stages; i++)
444  {
445  CString entry = m_script_entry_format;
446  entry.Replace("\r\n", "\n");
447 
448  brief_stage *stage = &Briefings[0].stages[i];
449  entry.Replace("$filename", stage->voice);
450  entry.Replace("$message", stage->text.c_str());
451  entry.Replace("$persona", "<no persona specified>");
452  entry.Replace("$sender", "<no sender specified>");
453 
454  fout("%s\n\n\n", (char *) (LPCTSTR) entry);
455  }
456  }
457 
459  {
460  fout("\n\nDebriefings\n-----------\n\n");
461 
462  for (int i = 0; i < Debriefings[0].num_stages; i++)
463  {
464  CString entry = m_script_entry_format;
465  entry.Replace("\r\n", "\n");
466 
467  debrief_stage *stage = &Debriefings[0].stages[i];
468  entry.Replace("$filename", stage->voice);
469  entry.Replace("$message", stage->text.c_str());
470  entry.Replace("$persona", "<no persona specified>");
471  entry.Replace("$sender", "<no sender specified>");
472 
473  fout("%s\n\n\n", (char *) (LPCTSTR) entry);
474  }
475  }
476 
478  {
479  fout("\n\nMessages\n--------\n\n");
480 
481  if (m_group_messages)
482  {
483  SCP_vector<int> message_indexes;
484  for (int i = 0; i < Num_messages - Num_builtin_messages; i++)
485  message_indexes.push_back(i + Num_builtin_messages);
486 
487  group_message_indexes(message_indexes);
488 
489  for (size_t index = 0; index < message_indexes.size(); index++)
490  {
491  MMessage *message = &Messages[message_indexes[index]];
492  export_one_message(message);
493  }
494  }
495  else
496  {
497  for (int i = 0; i < Num_messages - Num_builtin_messages; i++)
498  {
500  export_one_message(message);
501  }
502  }
503  }
504 
505  cfclose(fp);
506 
507  // notify
508  MessageBox("Script generation complete.", "Woohoo!");
509 }
510 
512 {
513  CString entry = m_script_entry_format;
514  entry.Replace("\r\n", "\n");
515 
516  // replace file name
517  entry.Replace("$filename", message->wave_info.name);
518 
519  // determine and replace persona
520  entry.Replace("$message", message->message);
521  if (message->persona_index >= 0)
522  entry.Replace("$persona", Personas[message->persona_index].name);
523  else
524  entry.Replace("$persona", "<none>");
525 
526  // determine sender
527  char sender[NAME_LENGTH+1];
528 
529  get_valid_sender(sender, sizeof(sender), message);
530 
531  // replace sender (but print #Command as Command)
532  if (*sender == '#')
533  entry.Replace("$sender", &sender[1]);
534  else
535  entry.Replace("$sender", sender);
536 
537  fout("%s\n\n\n", (char *) (LPCTSTR) entry);
538 }
539 
542 void VoiceActingManager::get_valid_sender(char *sender, size_t sender_size, MMessage *message) {
543  Assert( sender != NULL );
544  Assert( message != NULL );
545 
546  strncpy(sender, get_message_sender(message->name), sender_size);
547 
548  // strip hash if present
549  if ( sender[0] == '#' ) {
550  size_t i = 1;
551  for(; sender[i] != '\0'; i++ ) {
552  sender[i-1] = sender[i];
553  }
554  sender[i-1] = '\0';
555  }
556 
557  int shipnum = ship_name_lookup(sender, 1); // The player's ship is valid for this search.
558 
559  if (shipnum >= 0)
560  {
561  ship *shipp = &Ships[shipnum];
562 
563  // we may have to use the callsign
564  if (*Fred_callsigns[shipnum])
565  {
566  hud_stuff_ship_callsign(sender, shipp);
567  }
568  // account for hidden ship names
569  else if ( ((Iff_info[shipp->team].flags & IFFF_WING_NAME_HIDDEN) && (shipp->wingnum != -1)) || (shipp->flags2 & SF2_HIDE_SHIP_NAME) )
570  {
571  hud_stuff_ship_class(sender, shipp);
572  }
573  // use the regular sender text
574  else
575  {
577  }
578  }
579 }
580 
582 {
583  UpdateData(TRUE);
584 
586 
587  UpdateData(FALSE);
588 }
589 
591 {
592  UpdateData(TRUE);
593 
594  build_example();
595 
596  UpdateData(FALSE);
597 }
598 
600 {
601  UpdateData(TRUE);
602 
604 
605  UpdateData(FALSE);
606 }
607 
609 {
610  UpdateData(TRUE);
611 
613 
614  UpdateData(FALSE);
615 }
616 
618 {
619  UpdateData(TRUE);
620 
622 
623  UpdateData(FALSE);
624 }
625 
627 {
628  UpdateData(TRUE);
629 
630  build_example();
631 
632  UpdateData(FALSE);
633 }
634 
636 {
637  UpdateData(TRUE);
638 
639  build_example();
640 
641  UpdateData(FALSE);
642 }
643 
645 {
646  UpdateData(TRUE);
647 
649 
650  UpdateData(FALSE);
651 }
652 
654 {
655  UpdateData(TRUE);
656 
657  build_example();
658 
659  UpdateData(FALSE);
660 }
661 
663 {
664  UpdateData(TRUE);
665 
667 
668  UpdateData(FALSE);
669 }
670 
672 {
673  UpdateData(TRUE);
674 
676 
677  UpdateData(FALSE);
678 }
679 
681 {
682  UpdateData(TRUE);
683 
685 
686  UpdateData(FALSE);
687 }
688 
690 {
691  UpdateData(TRUE);
692 
693  build_example();
694 
695  UpdateData(FALSE);
696 }
697 
699 {
700  UpdateData(TRUE);
701 
702  build_example();
703 
704  UpdateData(FALSE);
705 }
706 
708 {
709  UpdateData(TRUE);
710 }
711 
713 {
714  SCP_string str;
715  va_list args;
716 
717  va_start(args, format);
718  vsprintf(str, format, args);
719  va_end(args);
720 
721  cfputs(str.c_str(), fp);
722  return 0;
723 }
724 
725 // Loops through all the sexps and finds the sender of the specified message. This assumes there is only one possible
726 // sender of the message, which is probably nearly always true (especially for voice-acted missions).
728 {
729  int i;
730 
731  for (i = 0; i < Num_sexp_nodes; i++)
732  {
733  if (Sexp_nodes[i].type == SEXP_NOT_USED)
734  continue;
735 
736  // stuff
737  int op = get_operator_const(Sexp_nodes[i].text);
738  int n = CDR(i);
739 
740  // find the message sexps
741  if (op == OP_SEND_MESSAGE)
742  {
743  // the first argument is the sender; the third is the message
744  if (!strcmp(message, Sexp_nodes[CDDR(n)].text))
745  return Sexp_nodes[n].text;
746  }
747  else if (op == OP_SEND_MESSAGE_LIST)
748  {
749  // check the argument list
750  while (n != -1)
751  {
752  // as before
753  if (!strcmp(message, Sexp_nodes[CDDR(n)].text))
754  return Sexp_nodes[n].text;
755 
756  // iterate along the list
757  n = CDDDDR(n);
758  }
759  }
760  else if (op == OP_SEND_RANDOM_MESSAGE)
761  {
762  // as before, sort of
763  char *sender = Sexp_nodes[n].text;
764 
765  // check the argument list
766  n = CDDR(n);
767  while (n != -1)
768  {
769  if (!strcmp(message, Sexp_nodes[n].text))
770  return sender;
771 
772  // iterate along the list
773  n = CDR(n);
774  }
775  }
776  else if (op == OP_TRAINING_MSG)
777  {
778  // just check the message
779  if (!strcmp(message, Sexp_nodes[n].text))
780  return "Training Message";
781  }
782  }
783 
784  return "<none>";
785 }
786 
788 {
789 #ifndef NDEBUG
790  size_t initial_size = message_indexes.size();
791 #endif
792 
793  SCP_vector<int> temp_message_indexes = message_indexes;
794  message_indexes.clear();
795 
796  // add all messages found in send-message-list or send-random-message node trees
797  for (int i = 0; i < Num_mission_events; i++)
798  {
799  mission_event *event = &Mission_events[i];
800  group_message_indexes_in_tree(event->formula, temp_message_indexes, message_indexes);
801  }
802 
803  // add remaining messages
804  for (size_t index = 0; index < temp_message_indexes.size(); index++)
805  message_indexes.push_back(temp_message_indexes[index]);
806 
807 #ifndef NDEBUG
808  if (initial_size > message_indexes.size())
809  {
810  Warning(LOCATION, "Initial size is greater than size after sorting!");
811  }
812  else if (initial_size < message_indexes.size())
813  {
814  Warning(LOCATION, "Initial size is less than size after sorting!");
815  }
816 #endif
817 }
818 
820 {
821  int op, n;
822 
823  if (node < 0)
824  return;
825  if (Sexp_nodes[node].type == SEXP_NOT_USED)
826  return;
827 
828  // stuff
829  op = get_operator_const(Sexp_nodes[node].text);
830  n = CDR(node);
831 
832  if (op == OP_SEND_MESSAGE_LIST)
833  {
834  // check the argument list
835  while (n != -1)
836  {
837  // the third argument is a message
838  char *message_name = Sexp_nodes[CDDR(n)].text;
839 
840  // check source messages
841  for (size_t i = 0; i < source_list.size(); i++)
842  {
843  if (!strcmp(message_name, Messages[source_list[i]].name))
844  {
845  // move it from source to destination
846  destination_list.push_back(source_list[i]);
847  source_list.erase(source_list.begin() + i);
848  break;
849  }
850  }
851 
852  // iterate along the list
853  n = CDDDDR(n);
854  }
855  }
856  else if (op == OP_SEND_RANDOM_MESSAGE)
857  {
858  // check the argument list
859  n = CDDR(n);
860  while (n != -1)
861  {
862  // each argument from this point on is a message
863  char *message_name = Sexp_nodes[n].text;
864 
865  // check source messages
866  for (size_t i = 0; i < source_list.size(); i++)
867  {
868  if (!strcmp(message_name, Messages[source_list[i]].name))
869  {
870  // move it from source to destination
871  destination_list.push_back(source_list[i]);
872  source_list.erase(source_list.begin() + i);
873  break;
874  }
875  }
876 
877  // iterate along the list
878  n = CDR(n);
879  }
880  }
881 
882  // iterate on first element
883  group_message_indexes_in_tree(CAR(node), source_list, destination_list);
884 
885  // iterate on rest of elements
886  group_message_indexes_in_tree(CDR(node), source_list, destination_list);
887 }
888 
890 {
891  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
892  button->EnableWindow(TRUE);
893 }
894 
896 {
897  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
898  button->EnableWindow(FALSE);
899 }
900 
902 {
903  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
904  button->EnableWindow(FALSE);
905 }
906 
908 {
909  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
910  button->EnableWindow(FALSE);
911 }
912 
914 {
915  CButton *button = ((CButton *) GetDlgItem(IDC_GROUP_MESSAGES));
916  button->EnableWindow(TRUE);
917 }
918 
919 
921 {
922  UpdateData(TRUE);
923 
924  build_example();
925 
926  UpdateData(FALSE);
927 }
GLenum GLsizei GLenum format
Definition: Gl.h:1509
int fout(char *format,...)
int flags
Definition: iff_defs.h:45
#define CFILE_NORMAL
Definition: cfile.h:89
int i
Definition: multi_pxo.cpp:466
afx_msg void OnChangeNoReplace()
int team
Definition: ship.h:606
int Num_mission_events
#define OP_TRAINING_MSG
Definition: sexp.h:793
afx_msg void OnGenerateScript()
char Voice_abbrev_briefing[NAME_LENGTH]
#define IDC_SUFFIX
Definition: resource.h:534
#define CAR(n)
Definition: sexp.h:820
char name[NAME_LENGTH]
Definition: missionparse.h:131
GLuint index
Definition: Glext.h:5608
CString generate_filename(CString section, int number, int digits, MMessage *message=NULL)
brief_stage stages[MAX_BRIEF_STAGES]
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Assert(pm!=NULL)
char Voice_script_entry_format[NOTES_LENGTH]
char message[MESSAGE_LENGTH]
afx_msg void OnSetfocusSuffix()
#define IDC_INCLUDE_SENDER
Definition: resource.h:1166
#define TRUE
Definition: pstypes.h:399
#define OP_SEND_MESSAGE
Definition: sexp.h:418
#define IDC_EXPORT_BRIEFINGS
Definition: resource.h:239
char name[NAME_LENGTH]
#define OP_SEND_RANDOM_MESSAGE
Definition: sexp.h:425
afx_msg void OnSetfocusAbbrevCampaign()
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: Glext.h:5156
#define IDC_ABBREV_COMMAND_BRIEFING
Definition: resource.h:803
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
cmd_brief Cmd_briefs[MAX_TVT_TEAMS]
void get_valid_sender(char *sender, size_t sender_size, MMessage *message)
GLsizeiptr size
Definition: Glext.h:5496
#define IDC_NO_REPLACE
Definition: resource.h:1131
afx_msg void OnChangeAbbrevBriefing()
#define IDC_EXPORT_MESSAGES
Definition: resource.h:253
briefing Briefings[MAX_TVT_TEAMS]
ship * shipp
Definition: lua.cpp:9162
#define IDC_EXPORT_DEBRIEFINGS
Definition: resource.h:245
afx_msg void OnSetfocusAbbrevBriefing()
VoiceActingManager(CWnd *pParent=NULL)
GLenum type
Definition: Gl.h:1492
iff_info Iff_info[MAX_IFFS]
Definition: iff_defs.cpp:20
afx_msg void OnSetfocusAbbrevCommandBriefing()
#define CDR(n)
Definition: sexp.h:821
SCP_vector< MMessage > Messages
afx_msg void OnExportEverything()
char * get_message_sender(char *message)
#define IDC_EXAMPLE
Definition: resource.h:820
char voice[MAX_FILENAME_LEN]
#define IDC_ABBREV_DEBRIEFING
Definition: resource.h:812
int Num_sexp_nodes
Definition: sexp.cpp:843
afx_msg void OnSetfocusAbbrevMission()
#define IDC_ABBREV_BRIEFING
Definition: resource.h:809
#define SEXP_NOT_USED
Definition: sexp.h:862
void vsprintf(SCP_string &dest, const char *format, va_list ap)
Definition: parselo.cpp:3800
#define cfopen(...)
Definition: cfile.h:134
#define IDC_ENTRY_FORMAT
Definition: resource.h:1130
char * filename
int wingnum
Definition: ship.h:623
mission_event Mission_events[MAX_MISSION_EVENTS]
Persona * Personas
#define SF2_HIDE_SHIP_NAME
Definition: ship.h:498
#define INVALID_MESSAGE
afx_msg void OnGenerateFileNames()
#define IDC_ABBREV_CAMPAIGN
Definition: resource.h:794
afx_msg void OnChangeAbbrevCommandBriefing()
#define CDDDDR(n)
Definition: sexp.h:829
Definition: ship.h:534
char Mission_filename[80]
#define IDC_GENERATE_FILE_NAMES
Definition: resource.h:340
cmd_brief_stage stage[CMD_BRIEF_STAGES_MAX]
sexp_node * Sexp_nodes
Definition: sexp.cpp:844
afx_msg void OnBnClickedIncludeSender()
char voice[MAX_FILENAME_LEN]
void group_message_indexes_in_tree(int node, SCP_vector< int > &source_list, SCP_vector< int > &destination_list)
#define IDC_ABBREV_MISSION
Definition: resource.h:817
GLclampd n
Definition: Glext.h:7286
void string_copy(char *dest, const CString &src, int max_len, int modify)
Definition: management.cpp:142
afx_msg void OnChangeOtherSuffix()
afx_msg void OnChangeAbbrevMission()
bool end_string_at_first_hash_symbol(char *src)
Definition: parselo.cpp:3833
char name[NAME_LENGTH]
char Voice_abbrev_command_briefing[NAME_LENGTH]
virtual void DoDataExchange(CDataExchange *pDX)
void set_modified(BOOL arg)
Definition: freddoc.cpp:676
GLuint const GLchar * name
Definition: Glext.h:5608
union MissionMessage::@255 wave_info
int Num_builtin_messages
afx_msg void OnExportBriefings()
afx_msg void OnExportDebriefings()
int BOOL
Definition: config.h:80
char Voice_abbrev_message[NAME_LENGTH]
#define CDDR(n)
Definition: sexp.h:827
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
debrief_stage stages[MAX_DEBRIEF_STAGES]
afx_msg void OnChangeAbbrevCampaign()
#define IDC_GROUP_MESSAGES
Definition: resource.h:1165
GLuint GLuint num
Definition: Glext.h:9089
#define OP_SEND_MESSAGE_LIST
Definition: sexp.h:467
afx_msg void OnSetfocusAbbrevMessage()
afx_msg void OnExportMessages()
int cfputs(const char *str, CFILE *cfile)
Definition: cfile.cpp:1504
bool Voice_group_messages
#define NAME_LENGTH
Definition: globals.h:15
afx_msg void OnExportCommandBriefings()
bool message_filename_is_generic(char *filename)
int Num_messages
char Voice_abbrev_mission[NAME_LENGTH]
struct _cl_event * event
Definition: Glext.h:7296
#define LOCATION
Definition: pstypes.h:245
int MessageBox(HWND h, const char *s1, const char *s2, int i)
int get_operator_const(const char *token)
Definition: sexp.cpp:1595
char wave_filename[MAX_FILENAME_LEN]
#define IDC_EXPORT_COMMAND_BRIEFINGS
Definition: resource.h:230
#define IDC_ABBREV_MESSAGE
Definition: resource.h:376
char Voice_abbrev_debriefing[NAME_LENGTH]
afx_msg void OnSetfocusAbbrevDebriefing()
void group_message_indexes(SCP_vector< int > &message_indexes)
debriefing Debriefings[MAX_TVT_TEAMS]
void hud_stuff_ship_class(char *ship_class_text, ship *shipp)
Definition: hudtarget.cpp:5325
void export_one_message(MMessage *message)
uint flags2
Definition: ship.h:645
#define IFFF_WING_NAME_HIDDEN
Definition: iff_defs.h:29
int ship_name_lookup(const char *name, int inc_players)
Definition: ship.cpp:12900
int Voice_export_selection
#define NOTES_LENGTH
Definition: globals.h:20
void hud_stuff_ship_callsign(char *ship_callsign_text, ship *shipp)
Definition: hudtarget.cpp:5290
mission The_mission
char Fred_callsigns[MAX_SHIPS][NAME_LENGTH+1]
Definition: management.cpp:94
int cfclose(CFILE *cfile)
Definition: cfile.cpp:895
#define FALSE
Definition: pstypes.h:400
bool Voice_no_replace_filenames
char text[TOKEN_LENGTH]
Definition: sexp.h:1027
#define IDC_EXPORT_EVERYTHING
Definition: resource.h:220
afx_msg void OnChangeAbbrevMessage()
#define IDC_GENERATE_SCRIPT
Definition: resource.h:344
char Voice_abbrev_campaign[NAME_LENGTH]
afx_msg void OnChangeAbbrevDebriefing()
#define strcpy_s(...)
Definition: safe_strings.h:67