diff --git a/src/editors/xrECore/Props/GameType.cpp b/src/editors/xrECore/Props/GameType.cpp new file mode 100644 index 00000000000..57885795909 --- /dev/null +++ b/src/editors/xrECore/Props/GameType.cpp @@ -0,0 +1,36 @@ +#include "pch.hpp" +#include "GameType.h" +#include "xrServerEntities/gametype_chooser.h" + +namespace XRay +{ +namespace ECore +{ +namespace Props +{ +bool GameType::Run(pcstr title, GameTypeChooser* data) +{ + gameTypes = data; + + checkSingle->Checked = gameTypes->MatchType(eGameIDSingle); + checkDM->Checked = gameTypes->MatchType(eGameIDDeathmatch); + checkTDM->Checked = gameTypes->MatchType(eGameIDTeamDeathmatch); + checkAfHunt->Checked = gameTypes->MatchType(eGameIDArtefactHunt); + checkCTA->Checked = gameTypes->MatchType(eGameIDCaptureTheArtefact); + + return ShowDialog() == Windows::Forms::DialogResult::OK; +} + +System::Void GameType::buttonOk_Click(System::Object^ sender, System::EventArgs^ e) +{ + gameTypes->m_GameType.zero(); + gameTypes->m_GameType.set(eGameIDSingle, checkSingle->Checked); + gameTypes->m_GameType.set(eGameIDDeathmatch, checkDM->Checked); + gameTypes->m_GameType.set(eGameIDTeamDeathmatch, checkTDM->Checked); + gameTypes->m_GameType.set(eGameIDArtefactHunt, checkAfHunt->Checked); + gameTypes->m_GameType.set(eGameIDCaptureTheArtefact, checkCTA->Checked); +} + +} // namespace Props +} // namespace ECore +} // namespace XRay diff --git a/src/editors/xrECore/Props/GameType.h b/src/editors/xrECore/Props/GameType.h new file mode 100644 index 00000000000..04e37a6b3c0 --- /dev/null +++ b/src/editors/xrECore/Props/GameType.h @@ -0,0 +1,159 @@ +#pragma once + +namespace XRay +{ +namespace ECore +{ +namespace Props +{ +ref class GameType; +} +} +} + +struct GameTypeChooser; + +namespace XRay +{ +namespace ECore +{ +namespace Props +{ +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing; + +public ref class GameType : public System::Windows::Forms::Form +{ +public: + GameType(void) + { + InitializeComponent(); + } + +protected: + ~GameType() + { + if (components) + { + delete components; + } + } + +public: + bool Run(pcstr title, GameTypeChooser* data); + +private: + GameTypeChooser* gameTypes; + +private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e); + +private: System::Windows::Forms::CheckBox^ checkSingle; +private: System::Windows::Forms::CheckBox^ checkDM; +private: System::Windows::Forms::CheckBox^ checkTDM; +private: System::Windows::Forms::CheckBox^ checkAfHunt; +private: System::Windows::Forms::CheckBox^ checkCTA; + +private: System::Windows::Forms::Button^ buttonOk; +private: System::Windows::Forms::Button^ buttonCancel; + +private: System::Windows::Forms::Panel^ panel1; +private: + System::ComponentModel::Container^ components; + +#pragma region Windows Form Designer generated code + void InitializeComponent(void) + { + this->checkSingle = (gcnew System::Windows::Forms::CheckBox()); + this->checkDM = (gcnew System::Windows::Forms::CheckBox()); + this->checkTDM = (gcnew System::Windows::Forms::CheckBox()); + this->checkAfHunt = (gcnew System::Windows::Forms::CheckBox()); + this->checkCTA = (gcnew System::Windows::Forms::CheckBox()); + this->buttonOk = (gcnew System::Windows::Forms::Button()); + this->buttonCancel = (gcnew System::Windows::Forms::Button()); + this->panel1 = (gcnew System::Windows::Forms::Panel()); + this->panel1->SuspendLayout(); + this->SuspendLayout(); + this->checkSingle->AutoSize = true; + this->checkSingle->Location = System::Drawing::Point(3, 3); + this->checkSingle->Name = L"checkSingle"; + this->checkSingle->Size = System::Drawing::Size(55, 17); + this->checkSingle->TabIndex = 0; + this->checkSingle->Text = L"Single"; + this->checkSingle->UseVisualStyleBackColor = true; + this->checkDM->AutoSize = true; + this->checkDM->Location = System::Drawing::Point(3, 26); + this->checkDM->Name = L"checkDM"; + this->checkDM->Size = System::Drawing::Size(78, 17); + this->checkDM->TabIndex = 1; + this->checkDM->Text = L"Deathmatch"; + this->checkDM->UseVisualStyleBackColor = true; + this->checkTDM->AutoSize = true; + this->checkTDM->Location = System::Drawing::Point(3, 49); + this->checkTDM->Name = L"checkTDM"; + this->checkTDM->Size = System::Drawing::Size(108, 17); + this->checkTDM->TabIndex = 2; + this->checkTDM->Text = L"Team Deathmatch"; + this->checkTDM->UseVisualStyleBackColor = true; + this->checkAfHunt->AutoSize = true; + this->checkAfHunt->Location = System::Drawing::Point(3, 72); + this->checkAfHunt->Name = L"checkAfHunt"; + this->checkAfHunt->Size = System::Drawing::Size(89, 17); + this->checkAfHunt->TabIndex = 3; + this->checkAfHunt->Text = L"Artefact Hunt"; + this->checkAfHunt->UseVisualStyleBackColor = true; + this->checkCTA->AutoSize = true; + this->checkCTA->Location = System::Drawing::Point(3, 95); + this->checkCTA->Name = L"checkCTA"; + this->checkCTA->Size = System::Drawing::Size(121, 17); + this->checkCTA->TabIndex = 4; + this->checkCTA->Text = L"Capture the Artefact"; + this->checkCTA->UseVisualStyleBackColor = true; + this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK; + this->buttonOk->Location = System::Drawing::Point(0, 115); + this->buttonOk->Name = L"buttonOk"; + this->buttonOk->Size = System::Drawing::Size(64, 23); + this->buttonOk->TabIndex = 5; + this->buttonOk->Text = L"Ok"; + this->buttonOk->UseVisualStyleBackColor = true; + this->buttonOk->Click += gcnew System::EventHandler(this, &GameType::buttonOk_Click); + this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->buttonCancel->Location = System::Drawing::Point(63, 115); + this->buttonCancel->Name = L"buttonCancel"; + this->buttonCancel->Size = System::Drawing::Size(64, 23); + this->buttonCancel->TabIndex = 6; + this->buttonCancel->Text = L"Cancel"; + this->buttonCancel->UseVisualStyleBackColor = true; + this->panel1->Controls->Add(this->checkSingle); + this->panel1->Controls->Add(this->checkDM); + this->panel1->Controls->Add(this->checkTDM); + this->panel1->Controls->Add(this->checkCTA); + this->panel1->Controls->Add(this->checkAfHunt); + this->panel1->Location = System::Drawing::Point(0, 0); + this->panel1->Name = L"panel1"; + this->panel1->Size = System::Drawing::Size(127, 115); + this->panel1->TabIndex = 7; + this->AcceptButton = this->buttonOk; + this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->CancelButton = this->buttonCancel; + this->ClientSize = System::Drawing::Size(127, 138); + this->Controls->Add(this->panel1); + this->Controls->Add(this->buttonOk); + this->Controls->Add(this->buttonCancel); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow; + this->Name = L"GameType"; + this->Text = L"GameType"; + this->panel1->ResumeLayout(false); + this->panel1->PerformLayout(); + this->ResumeLayout(false); + + } +#pragma endregion +}; +} // namespace Props +} // namespace ECore +} // namespace XRay diff --git a/src/editors/xrECore/Props/GameType.resx b/src/editors/xrECore/Props/GameType.resx new file mode 100644 index 00000000000..d58980a38d7 --- /dev/null +++ b/src/editors/xrECore/Props/GameType.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/editors/xrECore/Props/NumericVector.cpp b/src/editors/xrECore/Props/NumericVector.cpp index 3f690e94573..04ce3c16b63 100644 --- a/src/editors/xrECore/Props/NumericVector.cpp +++ b/src/editors/xrECore/Props/NumericVector.cpp @@ -81,16 +81,9 @@ System::Void NumericVector::buttonApply_Click(System::Object^ sender, System::Ev Value->set((float)numX->Value, (float)numY->Value, (float)numZ->Value); } - System::Void NumericVector::buttonOk_Click(System::Object^ sender, System::EventArgs^ e) { buttonApply_Click(sender, e); - this->Close(); -} - -System::Void NumericVector::buttonCancel_Click(System::Object^ sender, System::EventArgs^ e) -{ - this->Close(); } System::Void NumericVector::buttonReset_Click(System::Object^ sender, System::EventArgs^ e) @@ -110,13 +103,13 @@ System::Void NumericVector::NumericVector_KeyPress(System::Object^ sender, Syste switch (e->KeyChar) { case (Char)Keys::Space: - buttonApply_Click(sender, e); + buttonApply->PerformClick(); break; case (Char)Keys::Enter: - buttonOk_Click(sender, e); + buttonOk->PerformClick(); break; case (Char)Keys::Escape: - buttonCancel_Click(sender, e); + buttonCancel->PerformClick(); break; } } diff --git a/src/editors/xrECore/Props/NumericVector.h b/src/editors/xrECore/Props/NumericVector.h index b7b8230e446..10317308a65 100644 --- a/src/editors/xrECore/Props/NumericVector.h +++ b/src/editors/xrECore/Props/NumericVector.h @@ -49,7 +49,6 @@ public ref class NumericVector : public System::Windows::Forms::Form private: System::Void buttonApply_Click(System::Object^ sender, System::EventArgs^ e); private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e); -private: System::Void buttonCancel_Click(System::Object^ sender, System::EventArgs^ e); private: System::Void buttonReset_Click(System::Object^ sender, System::EventArgs^ e); private: System::Void buttonImmediate_Click(System::Object^ sender, System::EventArgs^ e); private: System::Void NumericVector_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e); @@ -91,6 +90,7 @@ private: System::Windows::Forms::Label^ labelZ; this->buttonImmediate = (gcnew System::Windows::Forms::Button()); this->checkImmediate = (gcnew System::Windows::Forms::CheckBox()); this->SuspendLayout(); + this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK; this->buttonOk->Location = System::Drawing::Point(136, 21); this->buttonOk->Name = L"buttonOk"; this->buttonOk->Size = System::Drawing::Size(50, 22); @@ -98,13 +98,13 @@ private: System::Windows::Forms::Label^ labelZ; this->buttonOk->Text = L"Ok"; this->buttonOk->UseVisualStyleBackColor = true; this->buttonOk->Click += gcnew System::EventHandler(this, &NumericVector::buttonOk_Click); + this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel; this->buttonCancel->Location = System::Drawing::Point(136, 42); this->buttonCancel->Name = L"buttonCancel"; this->buttonCancel->Size = System::Drawing::Size(50, 22); this->buttonCancel->TabIndex = 1; this->buttonCancel->Text = L"Cancel"; this->buttonCancel->UseVisualStyleBackColor = true; - this->buttonCancel->Click += gcnew System::EventHandler(this, &NumericVector::buttonCancel_Click); this->buttonReset->Location = System::Drawing::Point(136, 63); this->buttonReset->Name = L"buttonReset"; this->buttonReset->Size = System::Drawing::Size(50, 22); @@ -184,8 +184,10 @@ private: System::Windows::Forms::Label^ labelZ; this->checkImmediate->Size = System::Drawing::Size(15, 14); this->checkImmediate->TabIndex = 11; this->checkImmediate->UseVisualStyleBackColor = true; + this->AcceptButton = this->buttonOk; this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->CancelButton = this->buttonCancel; this->ClientSize = System::Drawing::Size(186, 85); this->Controls->Add(this->checkImmediate); this->Controls->Add(this->buttonImmediate); diff --git a/src/editors/xrECore/Props/ShaderFunction.cpp b/src/editors/xrECore/Props/ShaderFunction.cpp index bf3668b50f8..a22a940dc02 100644 --- a/src/editors/xrECore/Props/ShaderFunction.cpp +++ b/src/editors/xrECore/Props/ShaderFunction.cpp @@ -56,6 +56,7 @@ XRay::Token^ ShaderFunction::GetTokenFromValue(int val) } NODEFAULT; + return nullptr; } System::Void ShaderFunction::ShaderFunction_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) @@ -71,7 +72,6 @@ System::Void ShaderFunction::ShaderFunction_KeyPress(System::Object^ sender, Sys System::Void ShaderFunction::buttonCancel_Click(System::Object^ sender, System::EventArgs^ e) { CopyMemory(currentFunc, saveFunc, sizeof(WaveForm)); - this->Close(); } System::Void ShaderFunction::numArgX_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) diff --git a/src/editors/xrECore/Props/ShaderFunction.h b/src/editors/xrECore/Props/ShaderFunction.h index 041f09fc44c..1906893aa39 100644 --- a/src/editors/xrECore/Props/ShaderFunction.h +++ b/src/editors/xrECore/Props/ShaderFunction.h @@ -296,6 +296,7 @@ private: System::Windows::Forms::Button^ buttonCancel; this->labelMax->TabIndex = 11; this->labelMax->Text = L"Max"; this->labelMax->TextAlign = System::Drawing::ContentAlignment::TopRight; + this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK; this->buttonOk->Location = System::Drawing::Point(0, 140); this->buttonOk->Name = L"buttonOk"; this->buttonOk->Size = System::Drawing::Size(89, 22); @@ -303,6 +304,7 @@ private: System::Windows::Forms::Button^ buttonCancel; this->buttonOk->Text = L"Ok"; this->buttonOk->UseVisualStyleBackColor = true; this->buttonOk->Click += gcnew System::EventHandler(this, &ShaderFunction::buttonOk_Click); + this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel; this->buttonCancel->Location = System::Drawing::Point(88, 140); this->buttonCancel->Name = L"buttonCancel"; this->buttonCancel->Size = System::Drawing::Size(116, 22); @@ -310,8 +312,10 @@ private: System::Windows::Forms::Button^ buttonCancel; this->buttonCancel->Text = L"Cancel"; this->buttonCancel->UseVisualStyleBackColor = true; this->buttonCancel->Click += gcnew System::EventHandler(this, &ShaderFunction::buttonCancel_Click); + this->AcceptButton = this->buttonOk; this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; + this->CancelButton = this->buttonCancel; this->ClientSize = System::Drawing::Size(441, 162); this->Controls->Add(this->buttonOk); this->Controls->Add(this->buttonCancel); diff --git a/src/editors/xrECore/xrECore.vcxproj b/src/editors/xrECore/xrECore.vcxproj index 471b8dfa27f..50f0715a81c 100644 --- a/src/editors/xrECore/xrECore.vcxproj +++ b/src/editors/xrECore/xrECore.vcxproj @@ -86,12 +86,16 @@ Create + + + CppForm + CppForm @@ -110,6 +114,9 @@ + + Props\GameType.h + Props\NumericVector.h diff --git a/src/editors/xrECore/xrECore.vcxproj.filters b/src/editors/xrECore/xrECore.vcxproj.filters index 08f19213e22..a5082a84572 100644 --- a/src/editors/xrECore/xrECore.vcxproj.filters +++ b/src/editors/xrECore/xrECore.vcxproj.filters @@ -13,6 +13,9 @@ {5ef41f0f-a8ef-4194-ae46-068b92e5bbd3} + + {6990b14a-937f-44c1-9ca3-1f83ab512b84} + @@ -25,6 +28,9 @@ Props\ShaderFunction + + Props\GameType + @@ -40,9 +46,19 @@ Core + + Props\GameType + - - + + Props\NumericVector + + + Props\ShaderFunction + + + Props\GameType + \ No newline at end of file diff --git a/src/editors/xrECore/xrEProps.cpp b/src/editors/xrECore/xrEProps.cpp index 6f861b58066..4a1c1406af3 100644 --- a/src/editors/xrECore/xrEProps.cpp +++ b/src/editors/xrECore/xrEProps.cpp @@ -2,6 +2,7 @@ #include "xrEProps.h" #include "Props/NumericVector.h" #include "Props/ShaderFunction.h" +#include "Props/GameType.h" #include "xrEngine/WaveForm.h" namespace XRay @@ -21,6 +22,12 @@ bool ShaderFunctionRun(WaveForm* func) auto form = gcnew ShaderFunction(); return form->Run(func); } + +bool GameTypeRun(pcstr title, GameTypeChooser* data) +{ + auto form = gcnew GameType(); + return form->Run(title, data); +} } // namespace Props } // namespace ECore } // namespace XRay diff --git a/src/editors/xrECore/xrEProps.h b/src/editors/xrECore/xrEProps.h index a293ca5754a..a8d2c7b7fd2 100644 --- a/src/editors/xrECore/xrEProps.h +++ b/src/editors/xrECore/xrEProps.h @@ -1,6 +1,7 @@ #pragma once struct WaveForm; +struct GameTypeChooser; namespace XRay { @@ -10,6 +11,7 @@ namespace Props { bool NumericVectorRun(pcstr title, Fvector* data, int decimal, Fvector* reset_value, Fvector* min, Fvector* max, int* X, int* Y); bool ShaderFunctionRun(WaveForm* func); +bool GameTypeRun(pcstr title, GameTypeChooser* data); } // namespace Props } // namespace ECore } // namespace XRay