Subversion Repositories spk

Rev

Rev 1 | Rev 103 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 94
Line 27... Line 27...
27
	///          resources associated with this form.
27
	///          resources associated with this form.
28
	/// </summary>
28
	/// </summary>
29
	public ref class CustomiseShip : public System::Windows::Forms::Form
29
	public ref class CustomiseShip : public System::Windows::Forms::Form
30
	{
30
	{
31
	public:
31
	public:
32
		CustomiseShip(CXspFile *shipFile, Windows::Forms::Form ^mainForm, CPackages *p, ImageList ^imagesSmall, ImageList ^imagesLarge, int highestGame)
32
		CustomiseShip(CXspFile *shipFile, Windows::Forms::Form ^mainForm, CPackages *p, ImageList ^imagesSmall, ImageList ^imagesLarge, CGameDirectories *gameDir);
33
		{
-
 
34
			InitializeComponent();
-
 
35
 
-
 
36
			m_bUpdateing = false;
-
 
37
			m_pPackages = p;
-
 
38
			m_pMainForm = mainForm;
-
 
39
			m_pShipFile = shipFile;
-
 
40
			m_pShipData = new CShipData(m_pShipFile->GetShipData());
-
 
41
			m_pWeapons = new CLinkList<SWeaponMasks>;
-
 
42
			m_pModels = m_pShipFile->ReadSceneModels();
-
 
43
 
-
 
44
			this->Text = "Customise Ship: " + SystemStringFromCyString(m_pShipData->sID);
-
 
45
 
-
 
46
			m_pCustomiseInfo = gcnew CustomiseInfo(this, m_pShipData);
-
 
47
			this->tabPage1->Controls->Add(m_pCustomiseInfo);
-
 
48
			m_pCustomisePerformance = gcnew CustomisePerformance(m_pShipData);
-
 
49
			this->tabPage2->Controls->Add(m_pCustomisePerformance);
-
 
50
			m_pCustomiseWeapons1 = gcnew CustomiseWeapons1(this, m_pShipData);
-
 
51
			this->tabPage3->Controls->Add(m_pCustomiseWeapons1);
-
 
52
			m_pCustomiseModel = gcnew CustomiseModel(m_pShipData);
-
 
53
			this->tabPage4->Controls->Add(m_pCustomiseModel);
-
 
54
			m_pCustomiseWeapons = gcnew CustomiseWeapons(this, m_pWeapons, m_pShipData);
-
 
55
			this->tabPage5->Controls->Add(m_pCustomiseWeapons);
-
 
56
			m_pCustomiseGuns = gcnew CustomiseGuns(this, imagesSmall, imagesLarge, m_pShipData, m_pModels);
-
 
57
			this->tabPage7->Controls->Add(m_pCustomiseGuns);
-
 
58
			m_pCustomiseTurret = gcnew CustomiseTurret(this, imagesSmall, imagesLarge, m_pModels, m_pShipData, m_pShipFile);
-
 
59
			this->tabPage6->Controls->Add(m_pCustomiseTurret);
-
 
60
 
-
 
61
			m_iHighestGame = highestGame;
-
 
62
 
-
 
63
			this->SetupControls();
-
 
64
		}
-
 
65
 
33
 
66
		String ^FindText(int game, int page, int id);
-
 
67
		CyStringList *GetLasers(int game);
-
 
68
		CyStringList *GetShields();
-
 
69
		CyStringList *GetMissiles(int game);
-
 
70
		CyStringList *GetCockpits();
34
		CGameDirectories *gameDirectories();
71
 
35
 
72
		String ^GetPosition(int pos)
36
		String ^GetPosition(int pos)
73
		{
37
		{
74
			switch ( pos )
38
			switch ( pos )
75
			{
39
			{
76
				case 0:
40
				case 0:
77
					return "Cockpit";	
41
					return "Cockpit";	
78
				case 1: 
42
				case 1: 
Line 87... Line 51...
87
					return "Top";
51
					return "Top";
88
				case 6:
52
				case 6:
89
					return "Bottom";
53
					return "Bottom";
90
			}
54
			}
91
			return "";
55
			return "";
92
		}
56
		}
93
 
57
 
94
		void UpdateGunTurrets() { m_pCustomiseGuns->UpdateGunTurrets(); }
58
		void UpdateGunTurrets() { m_pCustomiseGuns->UpdateGunTurrets(); }
95
 
59
 
96
		void SetupControls()
60
		void SetupControls();
97
		{
-
 
98
			this->ComboGame->Items->Clear();
-
 
99
			for ( int i = 1; i < m_pPackages->GetGameExe()->GetNumGames(); i++ )
-
 
100
			{
-
 
101
				SGameExe *gameExe = m_pPackages->GetGameExe()->GetGame(i);
-
 
102
				if ( gameExe )
-
 
103
				{
-
 
104
					this->ComboGame->Items->Add(SystemStringFromCyString(gameExe->sName));
-
 
105
					m_pCustomiseTurret->AddGameEntry(SystemStringFromCyString(gameExe->sName));
-
 
106
					m_pCustomiseWeapons->AddGameEntry(SystemStringFromCyString(gameExe->sName));
-
 
107
				}
-
 
108
				SWeaponMasks *m = m_pWeapons->push_back(new SWeaponMasks);
-
 
109
				m->iGame = i;
-
 
110
				m->iLaserMask = m_pShipFile->GetLaserMask(i, true);
-
 
111
				m->iMissileMask = m_pShipFile->GetMissileMask(i, true);	
-
 
112
			}
-
 
113
 
-
 
114
			// find heighest game we have added
-
 
115
			if ( m_iHighestGame > 0 ) 
-
 
116
				this->ComboGame->SelectedIndex = m_iHighestGame - 1;
-
 
117
			else
-
 
118
				this->ComboGame->SelectedIndex = this->ComboGame->Items->Count - 1;
-
 
119
 
-
 
120
			m_pCustomiseWeapons->SetupControlsEnd();
-
 
121
			m_pCustomiseTurret->SetupControlsEnd();
-
 
122
		}
-
 
123
 
-
 
124
		String ^AddText(String ^text, String ^def)
-
 
125
		{
-
 
126
			if ( !text || !text->Length )
-
 
127
				return def;
-
 
128
			return text;
-
 
129
		}
-
 
130
 
-
 
131
 
61
 
132
		void SwitchGame()
62
		void SwitchGame()
133
		{
63
		{
134
			bool m_bUpdateding = true;
64
			bool m_bUpdateding = true;
-
 
65
 
-
 
66
			Utils::String dir = _S(this->ComboGame->Items[this->ComboGame->SelectedIndex]->ToString());
-
 
67
			dir = dir.token("[", -1).token("]", 1);
-
 
68
			
135
			int game = this->ComboGame->SelectedIndex + 1;
69
			_pGameDir->setSelectedDirectory(dir);
136
 
70
 
137
			// the ship info
71
			// the ship info
138
			m_pCustomiseInfo->UpdateInfo();
72
			m_pCustomiseInfo->UpdateInfo();
139
			// the shield entries
73
			// the shield entries
140
			m_pCustomiseWeapons1->UpdateShields();
74
			m_pCustomiseWeapons1->UpdateShields();
Line 183... Line 117...
183
		bool					 m_bUpdateing;
117
		bool					 m_bUpdateing;
184
		Windows::Forms::Form	^m_pMainForm;
118
		Windows::Forms::Form	^m_pMainForm;
185
		CXspFile				*m_pShipFile;
119
		CXspFile				*m_pShipFile;
186
		CShipData				*m_pShipData;
120
		CShipData				*m_pShipData;
187
		CyStringList			*m_pModels;
121
		CyStringList			*m_pModels;
188
		int						 m_iHighestGame;
122
		CGameDirectories		*_pGameDir;
189
 
123
 
190
		/// <summary>
124
		/// <summary>
191
		/// Clean up any resources being used.
125
		/// Clean up any resources being used.
192
		/// </summary>
126
		/// </summary>
193
		private: System::Windows::Forms::Panel^  panel1;
127
		private: System::Windows::Forms::Panel^  panel1;