]> icculus.org git repositories - taylor/freespace2.git/blob - include/shipeditordlg.h
proper padding of PXO stats struct for FS2 demo
[taylor/freespace2.git] / include / shipeditordlg.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/ShipEditorDlg.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Single ship editing dialog
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:15  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  * 4     5/20/99 7:00p Dave
26  * Added alternate type names for ships. Changed swarm missile table
27  * entries.
28  * 
29  * 3     2/11/99 2:15p Andsager
30  * Add ship explosion modification to FRED
31  * 
32  * 2     10/07/98 6:28p Dave
33  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
34  * Fred. Globalized mission and campaign file extensions. Removed Silent
35  * Threat specific code.
36  * 
37  * 1     10/07/98 3:01p Dave
38  * 
39  * 1     10/07/98 3:00p Dave
40  * 
41  * 65    4/07/98 9:42a Allender
42  * put in persona combo box into ship editor.  Removed code to assign
43  * personas based on message
44  * 
45  * 64    3/27/98 12:02p Sandeep
46  * 
47  * 63    3/25/98 4:14p Hoffoss
48  * Split ship editor up into ship editor and a misc dialog, which tracks
49  * flags and such.
50  * 
51  * 62    3/16/98 8:27p Allender
52  * Fred support for two new AI flags -- kamikaze and no dynamic goals.
53  * 
54  * 61    3/09/98 4:30p Allender
55  * multiplayer secondary weapon changes.  red-alert and cargo-known-delay
56  * sexpressions.  Add time cargo revealed to ship structure
57  * 
58  * 60    2/17/98 11:42a Hoffoss
59  * Added support for hidden from sensors condition.
60  * 
61  * 59    2/06/98 2:54p Hoffoss
62  * Fixed some bugs in dialog init, and cleared up some of the confusion
63  * about how it works by renaming some variables and adding comments.
64  * 
65  * 58    1/29/98 5:14p Hoffoss
66  * Added support for a SF_INVULNERABLE ship flag in Fred.
67  * 
68  * 57    11/13/97 4:14p Allender
69  * automatic assignment of hotkeys for starting wings.  Appripriate
70  * warnings when they are incorrectly used.  hotkeys correctly assigned to
71  * ships/wing arriving after mission start
72  * 
73  * 56    11/10/97 10:13p Allender
74  * added departure anchor to Fred and Freespace in preparation for using
75  * docking bays.  Functional in Fred, not in FreeSpace.
76  * 
77  * 55    10/21/97 4:49p Allender
78  * added flags to Fred and FreeSpace to forgo warp effect (toggle in ship
79  * editor in Fred)
80  * 
81  * 54    10/14/97 5:33p Hoffoss
82  * Added Fred support (and fsm support) for the no_arrival_music flags in
83  * ships and wings.
84  * 
85  * 53    9/17/97 5:43p Hoffoss
86  * Added Fred support for new player start information.
87  * 
88  * 52    9/04/97 4:31p Hoffoss
89  * Fixed bug: Changed ship editor to not touch wing info (arrival or
90  * departure cues) to avoid conflicts with wing editor's changes.
91  * 
92  * 51    8/30/97 9:52p Hoffoss
93  * Implemented arrival location, distance, and anchor in Fred.
94  * 
95  * 50    8/25/97 5:56p Hoffoss
96  * Added multiple asteroid field support, loading and saving of asteroid
97  * fields, and ship score field to Fred.
98  * 
99  * 49    8/20/97 6:53p Hoffoss
100  * Implemented escort flag support in Fred.
101  * 
102  * 48    8/16/97 12:06p Hoffoss
103  * Fixed bug where a whole wing is deleted that is being referenced.
104  * 
105  * 47    8/12/97 7:17p Hoffoss
106  * Added previous button to ship and wing editors.
107  * 
108  * 46    8/12/97 6:32p Hoffoss
109  * Added code to allow hiding of arrival and departure cues in editors.
110  * 
111  * 45    8/08/97 1:31p Hoffoss
112  * Added syncronization protection to cur_object_index changes.
113  *
114  * $NoKeywords: $
115  */
116
117 #ifndef _SHIPEDITORDLG_H
118 #define _SHIPEDITORDLG_H
119
120 #include "sexp_tree.h"
121 #include "shipgoalsdlg.h"
122 #include "management.h"
123
124 /////////////////////////////////////////////////////////////////////////////
125 // CShipEditorDlg dialog
126
127 #define WM_GOODBYE      (WM_USER+5)
128 #define ID_ALWAYS_ON_TOP        0x0f00
129
130 class numeric_edit_control
131 {
132         int value;
133         int unique;
134         int control_id;
135         CWnd *dlg;
136
137 public:
138         void setup(int id, CWnd *wnd);
139         void blank() { unique = 0; }
140         void init(int n);
141         void set(int n);
142         void display();
143         void save(int *n);
144         void fix(int n);
145 };
146
147 class CShipEditorDlg : public CDialog
148 {
149 private:
150         int make_ship_list(int *arr);
151         int update_ship(int ship);
152         int initialized;
153         int multi_edit;
154         int always_on_top;
155         int cue_height;
156         int mission_type;  // indicates if single player(1) or multiplayer(0)
157         CView*  m_pSEView;
158         CCriticalSection CS_update;
159
160 // Construction
161 public:
162         int player_ship, single_ship;
163         int editing;
164         int modified;
165         int select_sexp_node;
166         int bypass_errors;
167         int bypass_all;
168
169         int enable;  // used to enable(1)/disable(0) controls based on if any ship selected
170         int p_enable;  // used to enable(1)/disable(0) controls based on if a player ship
171
172         int tristate_set(int val, int cur_state);
173         void show_hide_sexp_help();
174         void calc_cue_height();
175         int verify();
176         void OnInitMenu(CMenu *m);
177         void OnOK();
178         int update_data(int redraw = 1);
179         void initialize_data(int full);
180         CShipEditorDlg(CWnd* pParent = NULL);   // standard constructor
181         CShipEditorDlg(CView* pView);
182
183         // alternate ship name stuff
184         void ship_alt_name_init(int base_ship);
185         void ship_alt_name_close(int base_ship);
186
187         BOOL Create();
188
189 // Dialog Data
190         //{{AFX_DATA(CShipEditorDlg)
191         enum { IDD = IDD_SHIP_EDITOR };
192         CButton m_no_departure_warp;
193         CButton m_no_arrival_warp;
194         CButton m_player_ship;
195         CSpinButtonCtrl m_destroy_spin;
196         CSpinButtonCtrl m_departure_delay_spin;
197         CSpinButtonCtrl m_arrival_delay_spin;
198         sexp_tree       m_departure_tree;
199         sexp_tree       m_arrival_tree;
200         CString m_ship_name;
201         CString m_cargo1;
202         int             m_ship_class;
203         int             m_team;
204         int             m_arrival_location;
205         int             m_departure_location;
206         int             m_ai_class;
207         numeric_edit_control    m_arrival_delay;
208         numeric_edit_control    m_departure_delay;
209         int             m_hotkey;
210         BOOL    m_update_arrival;
211         BOOL    m_update_departure;
212         numeric_edit_control    m_destroy_value;
213         numeric_edit_control    m_score;
214         numeric_edit_control    m_arrival_dist;
215         numeric_edit_control m_kdamage;
216         int             m_arrival_target;
217         int             m_departure_target;
218         int             m_persona;      
219         //}}AFX_DATA
220
221 // Overrides
222         // ClassWizard generated virtual function overrides
223         //{{AFX_VIRTUAL(CShipEditorDlg)
224         public:
225         virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
226         protected:
227         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
228         virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
229         //}}AFX_VIRTUAL
230
231 // Implementation
232 protected:
233
234         // Generated message map functions
235         //{{AFX_MSG(CShipEditorDlg)
236         afx_msg void OnClose();
237         afx_msg void OnRclickArrivalTree(NMHDR* pNMHDR, LRESULT* pResult);
238         afx_msg void OnRclickDepartureTree(NMHDR* pNMHDR, LRESULT* pResult);
239         afx_msg void OnBeginlabeleditArrivalTree(NMHDR* pNMHDR, LRESULT* pResult);
240         afx_msg void OnBeginlabeleditDepartureTree(NMHDR* pNMHDR, LRESULT* pResult);
241         afx_msg void OnEndlabeleditArrivalTree(NMHDR* pNMHDR, LRESULT* pResult);
242         afx_msg void OnEndlabeleditDepartureTree(NMHDR* pNMHDR, LRESULT* pResult);
243         afx_msg void OnGoals();
244         afx_msg void OnSelchangeShipClass();
245         afx_msg void OnInitialStatus();
246         afx_msg void OnWeapons();
247         afx_msg void OnShipReset();
248         afx_msg void OnDeleteShip();
249         afx_msg void OnShipTbl();
250         afx_msg void OnNext();
251         afx_msg void OnSelchangedArrivalTree(NMHDR* pNMHDR, LRESULT* pResult);
252         afx_msg void OnSelchangedDepartureTree(NMHDR* pNMHDR, LRESULT* pResult);
253         afx_msg void OnHideCues();
254         afx_msg void OnPrev();
255         afx_msg void OnSelchangeArrivalLocation();
256         afx_msg void OnPlayerShip();
257         afx_msg void OnNoArrivalWarp();
258         afx_msg void OnNoDepartureWarp();
259         afx_msg void OnSelchangeDepartureLocation();
260         afx_msg void OnSelchangeHotkey();
261         afx_msg void OnFlags();
262         afx_msg void OnIgnoreOrders();
263         afx_msg void OnSpecialExp();
264         //}}AFX_MSG
265         DECLARE_MESSAGE_MAP()
266 };
267
268 #endif
269