1 |
cycrow |
1 |
#include "../StdAfx.h"
|
|
|
2 |
#include "CustomiseShip.h"
|
|
|
3 |
|
|
|
4 |
#include "Form1.h"
|
|
|
5 |
|
|
|
6 |
namespace Creator {
|
94 |
cycrow |
7 |
CustomiseShip::CustomiseShip(CXspFile *shipFile, Windows::Forms::Form ^mainForm, CPackages *p, ImageList ^imagesSmall, ImageList ^imagesLarge, CGameDirectories *gameDir)
|
1 |
cycrow |
8 |
{
|
94 |
cycrow |
9 |
InitializeComponent();
|
1 |
cycrow |
10 |
|
94 |
cycrow |
11 |
m_bUpdateing = false;
|
|
|
12 |
m_pPackages = p;
|
|
|
13 |
m_pMainForm = mainForm;
|
|
|
14 |
m_pShipFile = shipFile;
|
|
|
15 |
m_pShipData = new CShipData(m_pShipFile->GetShipData());
|
|
|
16 |
m_pWeapons = new CLinkList<SWeaponMasks>;
|
|
|
17 |
m_pModels = m_pShipFile->ReadSceneModels();
|
|
|
18 |
|
|
|
19 |
this->Text = "Customise Ship: " + SystemStringFromCyString(m_pShipData->sID);
|
|
|
20 |
|
|
|
21 |
m_pCustomiseInfo = gcnew CustomiseInfo(this, m_pShipData);
|
|
|
22 |
this->tabPage1->Controls->Add(m_pCustomiseInfo);
|
|
|
23 |
m_pCustomisePerformance = gcnew CustomisePerformance(m_pShipData);
|
|
|
24 |
this->tabPage2->Controls->Add(m_pCustomisePerformance);
|
|
|
25 |
m_pCustomiseWeapons1 = gcnew CustomiseWeapons1(this, m_pShipData);
|
|
|
26 |
this->tabPage3->Controls->Add(m_pCustomiseWeapons1);
|
|
|
27 |
m_pCustomiseModel = gcnew CustomiseModel(m_pShipData);
|
|
|
28 |
this->tabPage4->Controls->Add(m_pCustomiseModel);
|
|
|
29 |
m_pCustomiseWeapons = gcnew CustomiseWeapons(this, m_pWeapons, m_pShipData);
|
|
|
30 |
this->tabPage5->Controls->Add(m_pCustomiseWeapons);
|
|
|
31 |
m_pCustomiseGuns = gcnew CustomiseGuns(this, imagesSmall, imagesLarge, m_pShipData, m_pModels);
|
|
|
32 |
this->tabPage7->Controls->Add(m_pCustomiseGuns);
|
|
|
33 |
m_pCustomiseTurret = gcnew CustomiseTurret(this, imagesSmall, imagesLarge, m_pModels, m_pShipData, m_pShipFile);
|
|
|
34 |
this->tabPage6->Controls->Add(m_pCustomiseTurret);
|
|
|
35 |
|
|
|
36 |
_pGameDir = gameDir;
|
|
|
37 |
|
|
|
38 |
this->SetupControls();
|
1 |
cycrow |
39 |
}
|
|
|
40 |
|
94 |
cycrow |
41 |
void CustomiseShip::SetupControls()
|
1 |
cycrow |
42 |
{
|
94 |
cycrow |
43 |
this->ComboGame->Enabled = true;
|
|
|
44 |
this->ComboGame->Items->Clear();
|
1 |
cycrow |
45 |
|
94 |
cycrow |
46 |
int selectedGame = 0;
|
|
|
47 |
int highestGame = 0;
|
|
|
48 |
for ( Utils::String dir = _pGameDir->first(); !dir.empty(); dir = _pGameDir->next() ) {
|
|
|
49 |
if ( _pGameDir->currentGame() > highestGame ) {
|
|
|
50 |
selectedGame = this->ComboGame->Items->Count;
|
|
|
51 |
highestGame = _pGameDir->currentGame();
|
|
|
52 |
}
|
|
|
53 |
this->ComboGame->Items->Add(_US(_pGameDir->currentName() + " [" + dir + "]"));
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
((Form1 ^)m_pMainForm)->LoadText();
|
|
|
57 |
|
|
|
58 |
for ( int i = 1; i < m_pPackages->GetGameExe()->GetNumGames(); i++ )
|
|
|
59 |
{
|
|
|
60 |
SGameExe *gameExe = m_pPackages->GetGameExe()->GetGame(i);
|
|
|
61 |
if ( gameExe )
|
|
|
62 |
{
|
|
|
63 |
//this->ComboGame->Items->Add(SystemStringFromCyString(gameExe->sName));
|
|
|
64 |
m_pCustomiseTurret->AddGameEntry(SystemStringFromCyString(gameExe->sName));
|
|
|
65 |
m_pCustomiseWeapons->AddGameEntry(SystemStringFromCyString(gameExe->sName));
|
|
|
66 |
}
|
|
|
67 |
SWeaponMasks *m = m_pWeapons->push_back(new SWeaponMasks);
|
|
|
68 |
m->iGame = i;
|
|
|
69 |
m->iLaserMask = m_pShipFile->GetLaserMask(i, true);
|
|
|
70 |
m->iMissileMask = m_pShipFile->GetMissileMask(i, true);
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
// find heighest game we have added
|
|
|
74 |
if ( !this->ComboGame->Items->Count ) {
|
|
|
75 |
this->ComboGame->Items->Add(":: None Found ::");
|
|
|
76 |
this->ComboGame->Enabled = false;
|
|
|
77 |
}
|
|
|
78 |
this->ComboGame->SelectedIndex = selectedGame;
|
|
|
79 |
|
|
|
80 |
m_pCustomiseWeapons->SetupControlsEnd();
|
|
|
81 |
m_pCustomiseTurret->SetupControlsEnd();
|
1 |
cycrow |
82 |
}
|
|
|
83 |
|
|
|
84 |
|
94 |
cycrow |
85 |
|
|
|
86 |
CGameDirectories *CustomiseShip::gameDirectories()
|
1 |
cycrow |
87 |
{
|
94 |
cycrow |
88 |
return _pGameDir;
|
1 |
cycrow |
89 |
}
|
|
|
90 |
}
|