Subversion Repositories spk

Rev

Rev 1 | Rev 103 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
using namespace System;
4
using namespace System::ComponentModel;
5
using namespace System::Collections;
6
using namespace System::Windows::Forms;
7
using namespace System::Data;
8
using namespace System::Drawing;
9
 
10
#include "CustomiseTurret.h"
11
#include "CustomiseGuns.h"
12
#include "CustomiseWeapons.h"
13
#include "CustomiseWeapons1.h"
14
#include "CustomiseModel.h"
15
#include "CustomisePerformance.h"
16
#include "CustomiseInfo.h"
17
 
18
namespace Creator {
19
 
20
	/// <summary>
21
	/// Summary for CustomiseShip
22
	///
23
	/// WARNING: If you change the name of this class, you will need to change the
24
	///          'Resource File Name' property for the managed resource compiler tool
25
	///          associated with all .resx files this class depends on.  Otherwise
26
	///          the designers will not be able to interact properly with localized
27
	///          resources associated with this form.
28
	/// </summary>
29
	public ref class CustomiseShip : public System::Windows::Forms::Form
30
	{
31
	public:
94 cycrow 32
		CustomiseShip(CXspFile *shipFile, Windows::Forms::Form ^mainForm, CPackages *p, ImageList ^imagesSmall, ImageList ^imagesLarge, CGameDirectories *gameDir);
1 cycrow 33
 
94 cycrow 34
		CGameDirectories *gameDirectories();
1 cycrow 35
 
36
		String ^GetPosition(int pos)
37
		{
38
			switch ( pos )
39
			{
40
				case 0:
41
					return "Cockpit";	
42
				case 1: 
43
					return "Front";
44
				case 2:
45
					return "Rear";
46
				case 3:
47
					return "Left";
48
				case 4:
49
					return "Right";
50
				case 5:
51
					return "Top";
52
				case 6:
53
					return "Bottom";
54
			}
55
			return "";
56
		}
57
 
58
		void UpdateGunTurrets() { m_pCustomiseGuns->UpdateGunTurrets(); }
59
 
94 cycrow 60
		void SetupControls();
1 cycrow 61
 
62
		void SwitchGame()
63
		{
64
			bool m_bUpdateding = true;
65
 
94 cycrow 66
			Utils::String dir = _S(this->ComboGame->Items[this->ComboGame->SelectedIndex]->ToString());
67
			dir = dir.token("[", -1).token("]", 1);
68
 
69
			_pGameDir->setSelectedDirectory(dir);
70
 
1 cycrow 71
			// the ship info
72
			m_pCustomiseInfo->UpdateInfo();
73
			// the shield entries
74
			m_pCustomiseWeapons1->UpdateShields();
75
			// the cockpit entries
76
			m_pCustomiseTurret->UpdateCockpits();
77
 
78
			// notority preset
79
			this->UpdateDisplay();
80
 
81
			bool m_bUpdateing = false;
82
		}
83
 
84
		void UpdateDisplay()
85
		{
86
			m_pCustomiseInfo->UpdateDisplay();
87
			m_pCustomisePerformance->UpdateDisplay();
88
			m_pCustomiseWeapons1->UpdateDisplay();
89
			m_pCustomiseModel->UpdateDisplay();
90
			m_pCustomiseTurret->UpdateDisplay();
91
		}
92
 
93
	protected:
94
		~CustomiseShip()
95
		{
96
			if (components)
97
			{
98
				delete components;
99
			}
100
			delete m_pShipData;
101
			if ( m_pWeapons )
102
				m_pWeapons->MemoryClear();
103
			delete m_pWeapons;
104
			if ( m_pModels )
105
				delete m_pModels;
106
		}
107
 
108
		CustomiseInfo			^m_pCustomiseInfo;
109
		CustomisePerformance	^m_pCustomisePerformance;
110
		CustomiseWeapons1		^m_pCustomiseWeapons1;
111
		CustomiseModel			^m_pCustomiseModel;
112
		CustomiseWeapons		^m_pCustomiseWeapons;
113
		CustomiseGuns			^m_pCustomiseGuns;
114
		CustomiseTurret			^m_pCustomiseTurret;
115
		CLinkList<SWeaponMasks> *m_pWeapons;
116
		CPackages				*m_pPackages;
117
		bool					 m_bUpdateing;
118
		Windows::Forms::Form	^m_pMainForm;
119
		CXspFile				*m_pShipFile;
120
		CShipData				*m_pShipData;
121
		CyStringList			*m_pModels;
94 cycrow 122
		CGameDirectories		*_pGameDir;
1 cycrow 123
 
124
		/// <summary>
125
		/// Clean up any resources being used.
126
		/// </summary>
127
		private: System::Windows::Forms::Panel^  panel1;
128
		private: System::Windows::Forms::Label^  label1;
129
		private: System::Windows::Forms::ComboBox^  ComboGame;
130
		private: System::Windows::Forms::Panel^  panel2;
131
		private: System::Windows::Forms::Button^  button2;
132
		private: System::Windows::Forms::Button^  ButSave;
133
private: System::Windows::Forms::ListView^  listView2;
134
private: System::Windows::Forms::ListView^  listView1;
135
private: System::Windows::Forms::CheckBox^  CheckWeaponDefaultCockpit;
136
private: System::Windows::Forms::TabPage^  tabPage7;
137
private: System::Windows::Forms::TabPage^  tabPage6;
138
private: System::Windows::Forms::TabPage^  tabPage5;
139
private: System::Windows::Forms::TabPage^  tabPage4;
140
private: System::Windows::Forms::TabPage^  tabPage3;
141
private: System::Windows::Forms::TabPage^  tabPage2;
142
private: System::Windows::Forms::TabControl^  tabControl1;
143
 
144
private: System::Windows::Forms::TabPage^  tabPage1;
145
 
146
private: System::ComponentModel::IContainer^  components;
147
		 /// <summary>
148
		/// Required designer variable.
149
		/// </summary>
150
 
151
#pragma region Windows Form Designer generated code
152
		/// <summary>
153
		/// Required method for Designer support - do not modify
154
		/// the contents of this method with the code editor.
155
		/// </summary>
156
		void InitializeComponent(void)
157
		{
158
			this->panel1 = (gcnew System::Windows::Forms::Panel());
159
			this->ComboGame = (gcnew System::Windows::Forms::ComboBox());
160
			this->label1 = (gcnew System::Windows::Forms::Label());
161
			this->panel2 = (gcnew System::Windows::Forms::Panel());
162
			this->button2 = (gcnew System::Windows::Forms::Button());
163
			this->ButSave = (gcnew System::Windows::Forms::Button());
164
			this->tabPage7 = (gcnew System::Windows::Forms::TabPage());
165
			this->tabPage6 = (gcnew System::Windows::Forms::TabPage());
166
			this->tabPage5 = (gcnew System::Windows::Forms::TabPage());
167
			this->tabPage4 = (gcnew System::Windows::Forms::TabPage());
168
			this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
169
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
170
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
171
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
172
			this->panel1->SuspendLayout();
173
			this->panel2->SuspendLayout();
174
			this->tabControl1->SuspendLayout();
175
			this->SuspendLayout();
176
			// 
177
			// panel1
178
			// 
179
			this->panel1->Controls->Add(this->ComboGame);
180
			this->panel1->Controls->Add(this->label1);
181
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
182
			this->panel1->Location = System::Drawing::Point(10, 10);
183
			this->panel1->Name = L"panel1";
184
			this->panel1->Padding = System::Windows::Forms::Padding(5);
185
			this->panel1->Size = System::Drawing::Size(548, 32);
186
			this->panel1->TabIndex = 0;
187
			// 
188
			// ComboGame
189
			// 
190
			this->ComboGame->Dock = System::Windows::Forms::DockStyle::Fill;
191
			this->ComboGame->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
192
			this->ComboGame->FormattingEnabled = true;
193
			this->ComboGame->Location = System::Drawing::Point(155, 5);
194
			this->ComboGame->Name = L"ComboGame";
195
			this->ComboGame->Size = System::Drawing::Size(388, 21);
196
			this->ComboGame->TabIndex = 1;
197
			this->ComboGame->SelectedIndexChanged += gcnew System::EventHandler(this, &CustomiseShip::ComboGame_SelectedIndexChanged);
198
			// 
199
			// label1
200
			// 
201
			this->label1->Dock = System::Windows::Forms::DockStyle::Left;
202
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
203
				static_cast<System::Byte>(0)));
204
			this->label1->Location = System::Drawing::Point(5, 5);
205
			this->label1->Name = L"label1";
206
			this->label1->Size = System::Drawing::Size(150, 22);
207
			this->label1->TabIndex = 0;
208
			this->label1->Text = L"Primary Game";
209
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
210
			// 
211
			// panel2
212
			// 
213
			this->panel2->Controls->Add(this->button2);
214
			this->panel2->Controls->Add(this->ButSave);
215
			this->panel2->Dock = System::Windows::Forms::DockStyle::Bottom;
216
			this->panel2->Location = System::Drawing::Point(10, 553);
217
			this->panel2->Name = L"panel2";
218
			this->panel2->Padding = System::Windows::Forms::Padding(8);
219
			this->panel2->Size = System::Drawing::Size(548, 46);
220
			this->panel2->TabIndex = 1;
221
			// 
222
			// button2
223
			// 
224
			this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
225
			this->button2->Dock = System::Windows::Forms::DockStyle::Right;
226
			this->button2->Location = System::Drawing::Point(331, 8);
227
			this->button2->Name = L"button2";
228
			this->button2->Size = System::Drawing::Size(99, 30);
229
			this->button2->TabIndex = 1;
230
			this->button2->Text = L"Cancel";
231
			this->button2->UseVisualStyleBackColor = true;
232
			// 
233
			// ButSave
234
			// 
235
			this->ButSave->DialogResult = System::Windows::Forms::DialogResult::OK;
236
			this->ButSave->Dock = System::Windows::Forms::DockStyle::Right;
237
			this->ButSave->Location = System::Drawing::Point(430, 8);
238
			this->ButSave->Name = L"ButSave";
239
			this->ButSave->Size = System::Drawing::Size(110, 30);
240
			this->ButSave->TabIndex = 0;
241
			this->ButSave->Text = L"Save";
242
			this->ButSave->UseVisualStyleBackColor = true;
243
			this->ButSave->Click += gcnew System::EventHandler(this, &CustomiseShip::ButSave_Click);
244
			// 
245
			// tabPage7
246
			// 
247
			this->tabPage7->Location = System::Drawing::Point(4, 22);
248
			this->tabPage7->Name = L"tabPage7";
249
			this->tabPage7->Padding = System::Windows::Forms::Padding(10);
250
			this->tabPage7->Size = System::Drawing::Size(540, 485);
251
			this->tabPage7->TabIndex = 6;
252
			this->tabPage7->Text = L"Guns";
253
			this->tabPage7->UseVisualStyleBackColor = true;
254
			// 
255
			// tabPage6
256
			// 
257
			this->tabPage6->Location = System::Drawing::Point(4, 22);
258
			this->tabPage6->Margin = System::Windows::Forms::Padding(10);
259
			this->tabPage6->Name = L"tabPage6";
260
			this->tabPage6->Padding = System::Windows::Forms::Padding(3);
261
			this->tabPage6->Size = System::Drawing::Size(540, 485);
262
			this->tabPage6->TabIndex = 5;
263
			this->tabPage6->Text = L"Turrets";
264
			this->tabPage6->UseVisualStyleBackColor = true;
265
			// 
266
			// tabPage5
267
			// 
268
			this->tabPage5->Location = System::Drawing::Point(4, 22);
269
			this->tabPage5->Name = L"tabPage5";
270
			this->tabPage5->Padding = System::Windows::Forms::Padding(10);
271
			this->tabPage5->Size = System::Drawing::Size(540, 485);
272
			this->tabPage5->TabIndex = 4;
273
			this->tabPage5->Text = L"Lasers/Missiles";
274
			this->tabPage5->UseVisualStyleBackColor = true;
275
			// 
276
			// tabPage4
277
			// 
278
			this->tabPage4->Location = System::Drawing::Point(4, 22);
279
			this->tabPage4->Name = L"tabPage4";
280
			this->tabPage4->Padding = System::Windows::Forms::Padding(3);
281
			this->tabPage4->Size = System::Drawing::Size(540, 485);
282
			this->tabPage4->TabIndex = 3;
283
			this->tabPage4->Text = L"Model";
284
			this->tabPage4->UseVisualStyleBackColor = true;
285
			// 
286
			// tabPage3
287
			// 
288
			this->tabPage3->Location = System::Drawing::Point(4, 22);
289
			this->tabPage3->Name = L"tabPage3";
290
			this->tabPage3->Padding = System::Windows::Forms::Padding(3);
291
			this->tabPage3->Size = System::Drawing::Size(540, 485);
292
			this->tabPage3->TabIndex = 2;
293
			this->tabPage3->Text = L"Weapons";
294
			this->tabPage3->UseVisualStyleBackColor = true;
295
			// 
296
			// tabPage2
297
			// 
298
			this->tabPage2->Location = System::Drawing::Point(4, 22);
299
			this->tabPage2->Name = L"tabPage2";
300
			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
301
			this->tabPage2->Size = System::Drawing::Size(540, 485);
302
			this->tabPage2->TabIndex = 1;
303
			this->tabPage2->Text = L"Performance";
304
			this->tabPage2->UseVisualStyleBackColor = true;
305
			// 
306
			// tabControl1
307
			// 
308
			this->tabControl1->Controls->Add(this->tabPage1);
309
			this->tabControl1->Controls->Add(this->tabPage2);
310
			this->tabControl1->Controls->Add(this->tabPage3);
311
			this->tabControl1->Controls->Add(this->tabPage4);
312
			this->tabControl1->Controls->Add(this->tabPage5);
313
			this->tabControl1->Controls->Add(this->tabPage6);
314
			this->tabControl1->Controls->Add(this->tabPage7);
315
			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
316
			this->tabControl1->Location = System::Drawing::Point(10, 42);
317
			this->tabControl1->Name = L"tabControl1";
318
			this->tabControl1->SelectedIndex = 0;
319
			this->tabControl1->Size = System::Drawing::Size(548, 511);
320
			this->tabControl1->TabIndex = 2;
321
			// 
322
			// tabPage1
323
			// 
324
			this->tabPage1->Location = System::Drawing::Point(4, 22);
325
			this->tabPage1->Name = L"tabPage1";
326
			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
327
			this->tabPage1->Size = System::Drawing::Size(540, 485);
328
			this->tabPage1->TabIndex = 0;
329
			this->tabPage1->Text = L"Ship Info";
330
			this->tabPage1->UseVisualStyleBackColor = true;
331
			// 
332
			// CustomiseShip
333
			// 
334
			this->AcceptButton = this->ButSave;
335
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
336
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
337
			this->CancelButton = this->button2;
338
			this->ClientSize = System::Drawing::Size(568, 609);
339
			this->Controls->Add(this->tabControl1);
340
			this->Controls->Add(this->panel2);
341
			this->Controls->Add(this->panel1);
342
			this->Name = L"CustomiseShip";
343
			this->Padding = System::Windows::Forms::Padding(10);
344
			this->ShowInTaskbar = false;
345
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
346
			this->Text = L"Customise Ship";
347
			this->panel1->ResumeLayout(false);
348
			this->panel2->ResumeLayout(false);
349
			this->tabControl1->ResumeLayout(false);
350
			this->ResumeLayout(false);
351
 
352
		}
353
#pragma endregion
354
	private: System::Void ComboGame_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
355
				 this->SwitchGame();
356
			 }
357
private: System::Void ButSave_Click(System::Object^  sender, System::EventArgs^  e) {
358
			 m_pShipFile->SetCreatedShipData(m_pShipData);
359
			 for ( SWeaponMasks *m = m_pWeapons->First(); m; m = m_pWeapons->Next() )
360
			 {
361
				 if ( m->iLaserMask > -1 )
362
					 m_pShipFile->SetLaserMask(m->iGame, m->iLaserMask);
363
				 if ( m->iMissileMask > -1 )
364
					 m_pShipFile->SetMissileMask(m->iGame, m->iMissileMask);
365
			 }
366
		 }
367
};
368
}