diff --git a/FA2pp b/FA2pp
index a48db6d..94568cb 160000
--- a/FA2pp
+++ b/FA2pp
@@ -1 +1 @@
-Subproject commit a48db6d4c24678aa490cfa0316564f958a00f43e
+Subproject commit 94568cbf175f54e019120ce370b867e03fee6c93
diff --git a/FA2sp.vcxproj b/FA2sp.vcxproj
index 0efc64b..bb49d49 100644
--- a/FA2sp.vcxproj
+++ b/FA2sp.vcxproj
@@ -123,6 +123,7 @@
+
@@ -149,6 +150,7 @@
+
@@ -176,6 +178,7 @@
+
@@ -213,6 +216,7 @@
+
diff --git a/FA2sp.vcxproj.filters b/FA2sp.vcxproj.filters
index 3232614..b993eb3 100644
--- a/FA2sp.vcxproj.filters
+++ b/FA2sp.vcxproj.filters
@@ -117,6 +117,9 @@
头文件
+
+ 头文件
+
@@ -275,6 +278,12 @@
源文件
+
+ 源文件
+
+
+ 源文件
+
@@ -328,5 +337,8 @@
资源文件
+
+ 资源文件
+
\ No newline at end of file
diff --git a/FA2sp/Ext/CAITriggerTypes/Body.cpp b/FA2sp/Ext/CAITriggerTypes/Body.cpp
index 1fe8c6c..7836370 100644
--- a/FA2sp/Ext/CAITriggerTypes/Body.cpp
+++ b/FA2sp/Ext/CAITriggerTypes/Body.cpp
@@ -1,18 +1,120 @@
#include "Body.h"
-CAITriggerTypes* CAITriggerTypesExt::Instance = nullptr;
+#include
+#include
+
+#include "../../Helpers/STDHelpers.h"
+#include "../../Helpers/Translations.h"
void CAITriggerTypesExt::ProgramStartupInit()
{
- RunTime::ResetMemoryContentAt(0x591B08, CAITriggerTypesExt::PreTranslateMessageExt);
+ RunTime::ResetMemoryContentAt(0x591B34, &CAITriggerTypesExt::OnInitDialogExt);
+ RunTime::ResetMemoryContentAt(0x591B08, &CAITriggerTypesExt::PreTranslateMessageExt);
}
-BOOL CAITriggerTypesExt::PreTranslateMessageExt(MSG* pMsg)
+BOOL CAITriggerTypesExt::OnInitDialogExt()
{
- switch (pMsg->message) {
+ BOOL ret = this->CAITriggerTypes::OnInitDialog();
+ if (!ret)
+ return FALSE;
+
+ Translations::TranslateItem(this, "AITriggerTitle");
+ Translations::TranslateItem(this, 50900, "AITriggerList");
+ Translations::TranslateItem(this, 50901, "AITriggerName");
+ Translations::TranslateItem(this, 50902, "AITriggerTeam1");
+ Translations::TranslateItem(this, 50903, "AITriggerHouse");
+ Translations::TranslateItem(this, 50904, "AITriggerTeam2");
+ Translations::TranslateItem(this, 50905, "AITriggerTechlevel");
+ Translations::TranslateItem(this, 50906, "AITriggerType");
+ Translations::TranslateItem(this, 50907, "AITriggerWeight");
+ Translations::TranslateItem(this, 50908, "AITriggerMinWeight");
+ Translations::TranslateItem(this, 50909, "AITriggerMaxWeight");
+ Translations::TranslateItem(this, 50910, "AITriggerMinDiff");
+ Translations::TranslateItem(this, 50911, "AITriggerSide");
+ Translations::TranslateItem(this, 50912, "AITriggerTechnoType");
+ Translations::TranslateItem(this, 50913, "AITriggerCondition");
+ Translations::TranslateItem(this, 50914, "AITriggerNumber");
+ Translations::TranslateItem(this, 50915, "AITriggerAdditionalDesc");
+ Translations::TranslateItem(this, 1210, "AITriggerData");
+
+ Translations::TranslateItem(this, 1218, "AITriggerEnabled");
+ Translations::TranslateItem(this, 1154, "AITriggerAdd");
+ Translations::TranslateItem(this, 1066, "AITriggerDel");
+ Translations::TranslateItem(this, 1919, "AITriggerClo");
+ Translations::TranslateItem(this, 1452, "AITriggerBaseDefense");
+ Translations::TranslateItem(this, 1453, "AITriggerSkirmish");
+ Translations::TranslateItem(this, 1424, "AITriggerEasy");
+ Translations::TranslateItem(this, 1425, "AITriggerMedium");
+ Translations::TranslateItem(this, 1426, "AITriggerHard");
- default:
- break;
+ HWND hSides;
+ GetDlgItem(1456, &hSides);
+ while (::SendMessage(hSides, CB_DELETESTRING, 0, NULL) != CB_ERR);
+
+ ::SendMessage(hSides, CB_ADDSTRING, NULL, (LPARAM)"0 - All");
+ int i = 1;
+ if (auto sides = GlobalVars::INIFiles::FAData->GetSection("Sides"))
+ {
+ for (auto& itr : sides->EntitiesDictionary)
+ {
+ ppmfc::CString buffer;
+ buffer.Format("%d - %s", i++, itr.second);
+ ::SendMessage(hSides, CB_ADDSTRING, NULL, (LPARAM)buffer.m_pchData);
+ }
}
+
+ return TRUE;
+}
+
+BOOL CAITriggerTypesExt::PreTranslateMessageExt(MSG* pMsg)
+{
+ switch (pMsg->message)
+ {
+ case WM_LBUTTONUP:
+ {
+ if (pMsg->hwnd == this->GetDlgItem(1919)->GetSafeHwnd())
+ this->OnBNCloneAITriggerClicked();
+ }
+ }
+
return this->FA2CDialog::PreTranslateMessage(pMsg);
-}
\ No newline at end of file
+}
+
+void CAITriggerTypesExt::OnBNCloneAITriggerClicked()
+{
+ if (this->CCBAITriggerList.GetCount() > 0 && this->CCBAITriggerList.GetCurSel() != CB_ERR)
+ {
+ ppmfc::CString currentID;
+ this->CCBAITriggerList.GetWindowText(currentID);
+ STDHelpers::TrimIndex(currentID);
+
+ ppmfc::CString key = INIClass::GetAvailableIndex();
+ ppmfc::CString value, name;
+
+ HWND hName;
+ GetDlgItem(1010, &hName);
+ auto nLen = ::GetWindowTextLength(hName);
+ auto pStr = new char[nLen + 1];
+ ::GetWindowText(hName, pStr, nLen + 1);
+ name.Format("%s Clone", pStr);
+ delete[] pStr;
+
+ value = name + ",";
+ auto& results = STDHelpers::SplitString(GlobalVars::INIFiles::CurrentDocument->GetString("AITriggerTypes", currentID));
+ for (int i = 1; i < results.size() - 1; ++i)
+ value += (results[i] + ",");
+ value += results.back();
+
+ GlobalVars::INIFiles::CurrentDocument->WriteString("AITriggerTypes", key, value);
+
+ GlobalVars::INIFiles::CurrentDocument->WriteString(
+ "AITriggerTypesEnable", key,
+ GlobalVars::INIFiles::CurrentDocument->GetString("AITriggerTypesEnable", currentID, "no")
+ );
+
+ int idx = this->CCBAITriggerList.AddString(key + " (" + name + ")");
+ this->CCBAITriggerList.SetCurSel(idx);
+
+ this->SetDlgItemText(1010, name); // update the name huh
+ }
+}
diff --git a/FA2sp/Ext/CAITriggerTypes/Body.h b/FA2sp/Ext/CAITriggerTypes/Body.h
index 4d8f4b3..cdfc175 100644
--- a/FA2sp/Ext/CAITriggerTypes/Body.h
+++ b/FA2sp/Ext/CAITriggerTypes/Body.h
@@ -6,18 +6,18 @@
class NOVTABLE CAITriggerTypesExt : public CAITriggerTypes
{
public:
- typedef BOOL(*FuncT_PTM)(MSG* pMsg);
-
- static CAITriggerTypes* Instance;
+ static void ProgramStartupInit();
- //hook function to replace in virtual function map
+ //
+ // Ext Functions
+ //
+ BOOL OnInitDialogExt();
BOOL PreTranslateMessageExt(MSG* pMsg);
- static void ProgramStartupInit();
-
CAITriggerTypesExt() {};
~CAITriggerTypesExt() {};
+ void OnBNCloneAITriggerClicked();
private:
};
\ No newline at end of file
diff --git a/FA2sp/Ext/FA2Expand.cpp b/FA2sp/Ext/FA2Expand.cpp
index 9bb6e9d..9f1f13a 100644
--- a/FA2sp/Ext/FA2Expand.cpp
+++ b/FA2sp/Ext/FA2Expand.cpp
@@ -52,6 +52,7 @@
void __stdcall FA2Expand::ExeRun()
{
+ CAITriggerTypesExt::ProgramStartupInit();
CFinalSunDlgExt::ProgramStartupInit();
CHousesExt::ProgramStartupInit();
// CIsoViewExt::ProgramStartupInit();
diff --git a/FA2sp/FA2sp.Constants.h b/FA2sp/FA2sp.Constants.h
index dd32087..df35fed 100644
--- a/FA2sp/FA2sp.Constants.h
+++ b/FA2sp/FA2sp.Constants.h
@@ -1,19 +1,14 @@
#pragma once
-#define wstr(x) wstr_(x)
-#define wstr_(x) L ## #x
-#define str(x) str_(x)
-#define str_(x) #x
-
constexpr int PRODUCT_MAJOR = 1;
constexpr int PRODUCT_MINOR = 0;
constexpr int PRODUCT_REVISION = 3;
-constexpr char* PRODUCT_STR = "1.0.3";
+constexpr char* PRODUCT_STR = "1.0.4";
constexpr char* DISPLAY_STR = PRODUCT_STR;
-constexpr char* VERSION_STRVER = "FA2sp 1.0.3";
+constexpr char* VERSION_STRVER = "FA2sp 1.0.4";
constexpr char* PRODUCT_NAME = "FA2sp";
-constexpr char* APPLY_INFO = "Found Final Alert 2 version 1.02. Applying FA2sp 1.0.3.";
+constexpr char* APPLY_INFO = "Found Final Alert 2 version 1.02. Applying FA2sp 1.0.4.";
// constexpr char* APPLY_INFO = "Found Final Alert 2 version 1.02. Applying FA2sp - " __DATE__ " - " __TIME__;
constexpr char* MUTEX_HASH_VAL = "b8097bca8590a4f46c975ebb43503aab2243ce7f1c87f12f7984dbe1";
diff --git a/FA2sp/FA2sp.cpp b/FA2sp/FA2sp.cpp
index 97ab221..44849b8 100644
--- a/FA2sp/FA2sp.cpp
+++ b/FA2sp/FA2sp.cpp
@@ -35,6 +35,10 @@ int ExtConfigs::Waypoint_Background_Color;
bool ExtConfigs::ExtWaypoints;
int ExtConfigs::UndoRedoLimit;
bool ExtConfigs::UseRGBHouseColor;
+bool ExtConfigs::SaveMap;
+bool ExtConfigs::SaveMap_AutoSave;
+int ExtConfigs::SaveMap_AutoSave_Interval;
+int ExtConfigs::SaveMap_AutoSave_MaxCount;
MultimapHelper Variables::Rules = { &GlobalVars::INIFiles::Rules(), &GlobalVars::INIFiles::CurrentDocument() };
@@ -81,6 +85,19 @@ void FA2sp::ExtConfigsInitialize()
ExtConfigs::UndoRedoLimit = fadata.GetInteger("ExtConfigs", "UndoRedoLimit", 16);
ExtConfigs::UseRGBHouseColor = fadata.GetBool("ExtConfigs", "UseRGBHouseColor");
+
+ if (ExtConfigs::SaveMap = fadata.GetBool("ExtConfigs", "SaveMap"))
+ {
+ if (ExtConfigs::SaveMap_AutoSave = fadata.GetBool("ExtConfigs", "SaveMap.AutoSave"))
+ {
+ ExtConfigs::SaveMap_AutoSave_Interval = fadata.GetInteger("ExtConfigs", "SaveMap.AutoSave.Interval", 300);
+ ExtConfigs::SaveMap_AutoSave_MaxCount = fadata.GetInteger("ExtConfigs", "SaveMap.AutoSave.MaxCount", 10);
+ }
+ else
+ {
+ ExtConfigs::SaveMap_AutoSave_Interval = -1;
+ }
+ }
}
// DllMain
diff --git a/FA2sp/FA2sp.h b/FA2sp/FA2sp.h
index 6410f86..d5468f9 100644
--- a/FA2sp/FA2sp.h
+++ b/FA2sp/FA2sp.h
@@ -45,6 +45,10 @@ class ExtConfigs
static bool ExtWaypoints;
static int UndoRedoLimit;
static bool UseRGBHouseColor;
+ static bool SaveMap;
+ static bool SaveMap_AutoSave;
+ static int SaveMap_AutoSave_Interval;
+ static int SaveMap_AutoSave_MaxCount;
};
class Variables
diff --git a/FA2sp/Miscs/Exception.cpp b/FA2sp/Miscs/Exception.cpp
index 4dfc0cf..c47dae7 100644
--- a/FA2sp/Miscs/Exception.cpp
+++ b/FA2sp/Miscs/Exception.cpp
@@ -194,10 +194,10 @@ std::wstring Exception::FullDump(
}
//ifdef DUMP_EXTENSIVE
-DEFINE_HOOK(434920, Exception_Handler, 7)
-{
- //GET(int, code, ECX);
- GET(LPEXCEPTION_POINTERS, pExs, EDX);
- Exception::ExceptionHandler(pExs);
-}
+//DEFINE_HOOK(434920, Exception_Handler, 7)
+//{
+// //GET(int, code, ECX);
+// GET(LPEXCEPTION_POINTERS, pExs, EDX);
+// Exception::ExceptionHandler(pExs);
+//}
//endif
diff --git a/FA2sp/Miscs/Hooks.SaveMap.cpp b/FA2sp/Miscs/Hooks.SaveMap.cpp
new file mode 100644
index 0000000..ce3fb4c
--- /dev/null
+++ b/FA2sp/Miscs/Hooks.SaveMap.cpp
@@ -0,0 +1,247 @@
+#include
+
+#include
+#include
+#include
+#include
+
+#include "../FA2sp.h"
+#include "../FA2sp.Constants.h"
+
+#include