]> icculus.org git repositories - taylor/freespace2.git/blob - include/eventeditor.h
proper padding of PXO stats struct for FS2 demo
[taylor/freespace2.git] / include / eventeditor.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Fred2/EventEditor.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Event editor dialog box class and event tree class (used for dialog)
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:12  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:12  root
22  * Initial import.
23  *
24  * 
25  * 5     8/26/99 8:52p Dave
26  * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
27  * 
28  * 4     5/04/99 5:21p Andsager
29  * 
30  * 3     2/17/99 2:11p Dave
31  * First full run of squad war. All freespace and tracker side stuff
32  * works.
33  * 
34  * 2     10/07/98 6:28p Dave
35  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
36  * Fred. Globalized mission and campaign file extensions. Removed Silent
37  * Threat specific code.
38  * 
39  * 1     10/07/98 3:01p Dave
40  * 
41  * 1     10/07/98 3:00p Dave
42  * 
43  * 27    5/15/98 5:51p Hoffoss
44  * Fixed escape key and cancel button bugs.
45  * 
46  * 26    4/22/98 9:56a Sandeep
47  * 
48  * 25    4/20/98 4:40p Hoffoss
49  * Added a button to 4 editors to play the chosen wave file.
50  * 
51  * 24    4/03/98 5:20p Hoffoss
52  * Changed code so that changing a message's wave file will update the
53  * persona as well, if the wave file has the proper prefix.
54  * 
55  * 23    2/16/98 6:25p Hoffoss
56  * Did major rework of the whole right_clicked() handler to simplify it
57  * all, break it down and make it more flexible.  Should be a lot easier
58  * to work with from now on.
59  * 
60  * 22    2/16/98 2:42p Hoffoss
61  * Added new code in preparation to simplify the sexp_tree monster.
62  * Checking in code now as a good foundation point that I can revert back
63  * to if needed.
64  * 
65  * 21    1/08/98 11:18a Hoffoss
66  * Fixed several bugs in new Event Editor.
67  * 
68  * 20    1/07/98 5:58p Hoffoss
69  * Combined message editor into event editor.
70  * 
71  * 19    1/06/98 8:25p Hoffoss
72  * Added insert event functionality to event editor.
73  * 
74  * 18    10/10/97 6:21p Hoffoss
75  * Put in Fred support for training object list editing.
76  * 
77  * 17    10/09/97 1:03p Hoffoss
78  * Renaming events or goals now updates sexp references as well.
79  * 
80  * 16    9/30/97 10:01a Hoffoss
81  * Added event chaining support to Fred and FreeSpace.
82  * 
83  * 15    8/12/97 3:33p Hoffoss
84  * Fixed the "press cancel to go to reference" code to work properly.
85  * 
86  * 14    7/30/97 5:23p Hoffoss
87  * Removed Sexp tree verification code, since it duplicates normal sexp
88  * verification, and is just another set of code to keep maintained.
89  * 
90  * 13    7/25/97 3:05p Allender
91  * added score field to goals and events editor
92  * 
93  * 12    7/24/97 12:45p Hoffoss
94  * Added sexp help system to sexp trees and some dialog boxes.
95  * 
96  * 11    7/17/97 4:10p Hoffoss
97  * Added drag and drop to sexp trees for reordering root items.
98  * 
99  * 10    7/15/97 10:30a Allender
100  * added repeat count and interval time to event editor.  For use in
101  * repeating events at regular intervals
102  * 
103  * 9     6/02/97 8:47p Hoffoss
104  * Fixed bug with inserting an operator at root position, but under a
105  * label.
106  * 
107  * 8     5/20/97 2:28p Hoffoss
108  * Added message box queries for close window operation on all modal
109  * dialog boxes.
110  * 
111  * 7     5/01/97 4:12p Hoffoss
112  * Added return handling to dialogs.
113  * 
114  * 6     4/17/97 2:01p Hoffoss
115  * All dialog box window states are saved between sessions now.
116  * 
117  * 5     4/11/97 10:10a Hoffoss
118  * Name fields supported by Fred for Events and Mission Goals.
119  * 
120  * 4     4/07/97 3:48p Hoffoss
121  * Event editor now supports a sporty new delete button!
122  * 
123  * 3     1/22/97 11:01a Hoffoss
124  * Many bug fixes (those pointed out by Mark during Fred testing trying to
125  * make mission 5).
126  * 
127  * 2     1/13/97 4:54p Hoffoss
128  * Added event editor.
129  *
130  * $NoKeywords: $
131  */
132
133 #ifndef _EVENTEDITOR_H
134 #define _EVENTEDITOR_H
135
136 #include "sexp_tree.h"
137 #include "missiongoals.h"
138 #include "missionmessage.h"
139
140 #define MAX_SEARCH_MESSAGE_DEPTH                5               // maximum search number of event nodes with message text
141
142 class sexp_event_tree : public sexp_tree
143 {
144 public:
145         int load_sub_tree(int index);
146         int get_new_node_position();
147 };
148
149 /////////////////////////////////////////////////////////////////////////////
150 // event_editor dialog
151
152 class event_editor : public CDialog
153 {
154 // Construction
155 public:
156         void update_persona();
157         void save();
158         char *current_message_name(int index);
159         char *get_message_list_item(int i);
160         int save_message(int num);
161         void update_cur_message();
162         HTREEITEM get_event_handle(int num);
163         void reset_event(int num, HTREEITEM after);
164         void save_event(int e);
165         void swap_handler(int node1, int node2);
166         void insert_handler(int old, int node);
167         int query_modified();
168         void OnOK();
169         void OnCancel();
170         int handler(int code, int node, char *str = NULL);
171         void create_tree();
172         void load_tree();
173         int modified;
174         int select_sexp_node;
175         event_editor(CWnd* pParent = NULL);   // standard constructor
176
177 // Dialog Data
178         //{{AFX_DATA(event_editor)
179         enum { IDD = IDD_EVENT_EDITOR };
180         sexp_event_tree m_event_tree;
181         UINT    m_repeat_count;
182         UINT    m_interval;
183         int             m_event_score;
184         int             m_chain_delay;
185         BOOL    m_chained;
186         CString m_obj_text;
187         CString m_obj_key_text;
188         CString m_avi_filename;
189         CString m_message_name;
190         CString m_message_text;
191         int             m_persona;
192         CString m_wave_filename;
193         int             m_cur_msg;
194         int             m_team;
195         int             m_message_team;
196         int             m_last_message_node;
197         //}}AFX_DATA
198
199         CBitmap m_play_bm;
200
201 // Overrides
202         // ClassWizard generated virtual function overrides
203         //{{AFX_VIRTUAL(event_editor)
204         public:
205         virtual BOOL DestroyWindow();
206         protected:
207         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
208         //}}AFX_VIRTUAL
209
210 // Implementation
211 protected:
212
213         // Generated message map functions
214         //{{AFX_MSG(event_editor)
215         virtual BOOL OnInitDialog();
216         afx_msg void OnRclickEventTree(NMHDR* pNMHDR, LRESULT* pResult);
217         afx_msg void OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
218         afx_msg void OnEndlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
219         afx_msg void OnButtonNewEvent();
220         afx_msg void OnDelete();
221         afx_msg void OnOk();
222         afx_msg void OnClose();
223         afx_msg void OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult);
224         afx_msg void OnUpdateRepeatCount();
225         afx_msg void OnChained();
226         afx_msg void OnInsert();
227         afx_msg void OnSelchangeMessageList();
228         afx_msg void OnNewMsg();
229         afx_msg void OnDeleteMsg();
230         afx_msg void OnBrowseAvi();
231         afx_msg void OnBrowseWave();
232         afx_msg void OnSelchangeWaveFilename();
233         afx_msg void OnPlay();
234         afx_msg void OnUpdate();
235         afx_msg void On_Cancel();
236         afx_msg void OnSelchangeTeam();
237         afx_msg void OnSelchangeMessageTeam();
238         afx_msg void OnDblclkMessageList();
239         //}}AFX_MSG
240         DECLARE_MESSAGE_MAP()
241
242 private:
243         int cur_event;
244         void update_cur_event();
245         int m_num_events;
246         int m_sig[MAX_MISSION_EVENTS];
247         mission_event m_events[MAX_MISSION_EVENTS];
248         int m_num_messages;
249         MMessage m_messages[MAX_MISSION_MESSAGES];
250         int m_msg_sig[MAX_MISSION_MESSAGES];
251 };
252
253 extern event_editor *Event_editor_dlg; // global reference needed by event tree class
254
255 #endif
256