Debian Codegraph @

editor/ScriptSelect.h

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
19 #if !defined(AFX_SCRIPTSELECT_H__84E5B8C1_29FC_11D1_86CC_004033312F7C__INCLUDED_)
20 #define AFX_SCRIPTSELECT_H__84E5B8C1_29FC_11D1_86CC_004033312F7C__INCLUDED_
21
22 #if _MSC_VER >= 1000
23 #pragma once
24 #endif // _MSC_VER >= 1000
25 // ScriptSelect.h : header file
26 //
27
28 #include "objscript.h"
29 #include "objcscript.h"
30 #include "d3x.h"
31
32 /////////////////////////////////////////////////////////////////////////////
33 // CScriptSelect dialog
34
35 #include "object.h"
36 #include "trigger.h"
37
38 class CScriptSelect : public CDialog {
39 // Construction
40 public:
41 CScriptSelect(uint16_t scr_type = 0xffff, int custom = CUSTOM_SCRIPT_MASK,
42 CWnd *pParent = NULL); // standard constructor
43
44 int m_CurScriptSel;
45
46 // arguments passed to script from object.
47 int m_NumParms;
48 tScriptParm m_Parm[MAX_SCRPARAMS];
49 int m_CustomType; // 0 = none, 1 = default, 2 = custom
50
51 // Dialog Data
52 //{{AFX_DATA(CScriptSelect)
53 enum { IDD = IDD_SCRIPTSELECT };
54 CString m_ScriptName;
55 //}}AFX_DATA
56
57 // Overrides
58 // ClassWizard generated virtual function overrides
59 //{{AFX_VIRTUAL(CScriptSelect)
60 protected:
61 virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
62 //}}AFX_VIRTUAL
63
64 // Implementation
65 protected:
66 // Generated message map functions
67 //{{AFX_MSG(CScriptSelect)
68 afx_msg void OnDblclkScriptselListbox();
69 virtual void OnOK();
70 virtual BOOL OnInitDialog();
71 afx_msg void OnDestroy();
72 afx_msg void OnParameters();
73 afx_msg void OnSelchangeScriptselListbox();
74 afx_msg void OnScriptselAdd();
75 afx_msg void OnEditScript();
76 afx_msg void OnScrtype();
77 //}}AFX_MSG
78 DECLARE_MESSAGE_MAP()
79
80 private:
81 void UpdateScriptListbox();
82 void EditScript(const char *filename, const char *scrname);
83
84 private:
85 tD3XProgram *m_ScriptCode;
86 uint16_t m_ScriptType;
87 };
88
89 inline void SETUP_SCRIPTSELECT_OBJECT(CScriptSelect &sel, object *obj) {
90 #if 0 // LGT: script undefined
91 sel.m_ScriptName = obj->script.name;
92 sel.m_NumParms = obj->script.num_parms;
93 obj->script.copy_parms(sel.m_Parm);
94 #endif
95 }
96
97 inline void RETURN_SCRIPTSELECT_OBJECT(object *obj, CScriptSelect &sel) {
98 #if 0 // LGT: script undefined
99 obj->script.set_parms(sel.m_NumParms, sel.m_Parm);
100 if (sel.m_ScriptName == "null")
101 obj->script.set_name(NULL);
102 else
103 obj->script.set_name(sel.m_ScriptName);
104 obj->script.is_custom = (sel.m_CustomType==CUSTOM_SCRIPT_MASK) ? 1 : 0;
105
106 mprintf((0, "Script [%s:custom=%d] assigned.\n", sel.m_ScriptName, obj->script.is_custom));
107 #endif
108 }
109
110 inline void SETUP_SCRIPTSELECT_TRIGGER(CScriptSelect &sel, trigger *trig) {
111 #if 0 // LGT: script undefined
112 sel.m_ScriptName = trig->script.name;
113 sel.m_NumParms = trig->script.num_parms;
114 trig->script.copy_parms(sel.m_Parm);
115 #endif
116 }
117
118 inline void RETURN_SCRIPTSELECT_TRIGGER(trigger *trig, CScriptSelect &sel) {
119 #if 0 // LGT: script undefined
120 trig->script.set_parms(sel.m_NumParms, sel.m_Parm);
121 if (sel.m_ScriptName == "null")
122 trig->script.set_name(NULL);
123 else
124 trig->script.set_name(sel.m_ScriptName);
125 trig->script.is_custom = (sel.m_CustomType==CUSTOM_SCRIPT_MASK) ? 1 : 0;
126
127 mprintf((0, "Script [%s:custom=%d] assigned.\n", sel.m_ScriptName, trig->script.is_custom));
128 #endif
129 }
130
131 //{{AFX_INSERT_LOCATION}}
132 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
133
134 #endif // !defined(AFX_SCRIPTSELECT_H__84E5B8C1_29FC_11D1_86CC_004033312F7C__INCLUDED_)