Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
secsome committed Nov 22, 2023
2 parents 869bf14 + ece147f commit f2ff96a
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 269 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# FINALALERT2 - SP CHANGELOG

## RELEASE 1.6.3 (2023-11-22)
- New ***ExtConfig*** : `ExtVariables` = **BOOLEAN**, defaults to false
- New ***ExtConfig*** : `FileWatcher` = **BOOLEAN**, defaults to true
- Add shortcuts to some online websites
- [FA2sp Github Page](https://github.com/secsome/FA2sp), translation key: `Menu.Online.FA2sp`
- [Phobos Github Page](https://github.com/Phobos-developers/Phobos), translation key: `Menu.Online.Phobos`
- [PPM Forum MainPage](https://www.ppmforums.com/), translation key: `Menu.Online.PPM`
- [ModEnc MainPage](https://modenc.renegadeprojects.com/Main_Page), translation key: `Menu.Online.ModEnc`
- You can also add your own shortcuts (3 at max) by editing `FAData.ini` section `[Online]`
- This feature might be vulnerable in some cases, so it is disabled by default, you can enable it by setting ***ExtConfig*** : `CustomOnlineWebsites` = **BOOLEAN**, defaults to false
```ini
; In `FAData.ini`
[OnlineWebsites]
Custom1=My Website Name 1,https://website1.com
Custom2=My Website Name 2,https://website2.com
Custom3=My Website Name 3,https://website3.com
```

## RELEASE 1.6.2 (2023-07-18)
- Renamed ***ExtConfig*** : `BrowserRedraw.GuessMode` to `ObjectBrowser.GuessMode`
- Renamed ***ExtConfig*** : `BrowserRedraw.CleanUp` to `ObjectBrowser.CleanUp`
Expand Down
20 changes: 16 additions & 4 deletions DOCUMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ Now this feature supports RaiseSingleTile/LowerSingleTile (though they are not "
- `EnableMultiSelection` = **BOOLEAN** ; Determines if FA2sp will enable expermental multi-selection features, defaults to **false**
- `ExtendedValidationNoError` = **BOOLEAN** ; If this value is true, then extended map validation won't be shown as error but warning, defaults to **false**
- `HideNoRubbleBuilding` = **BOOLEAN** ; If this value is true, then building whose HP = 0 with `LeaveRubble=no` won't be rendered, defaults to **false**
- **`[Sides]`** (**x** means this item is **essensial**, fa2sp need this section to work properly)
- `ExtVariables` = **BOOLEAN** ; Determines if FA2sp supports unlimited count of local variables, defaults to **false** (Phobos required)
- `FileWatcher` = **BOOLEAN** ; Determines if FA2sp will detect if map file is modified external, defaults to **true**
- `CustomOnlineWebsites` = **BOOLEAN** ; Determines if FA2sp will read custom online websites
- - **`[Sides]`** (**x** means this item is **essensial**, fa2sp need this section to work properly)
- Contains a list of sides registered in rules
```ini
[Sides]
Expand Down Expand Up @@ -371,6 +374,14 @@ Now this feature supports RaiseSingleTile/LowerSingleTile (though they are not "
Index = RegName
; Like 0=INORANLAMP, value must be a valid building regname
```

- `[OnlineWebsites]`
```ini
[OnlineWebsites]
Custom1=My Website Name 1,https://website1.com
Custom2=My Website Name 2,https://website2.com
Custom3=My Website Name 3,ahttps://website3.com
```
- `FALanguage.ini`
```ini
[CURRENTLANGUAGE-StringsRA2]
Expand Down Expand Up @@ -432,9 +443,10 @@ Now this feature supports RaiseSingleTile/LowerSingleTile (though they are not "
Menu.MapTools.NavigateCoordinate = TEXT
Menu.MapTools.ToolScripts = TEXT
Menu.Online = TEXT
Menu.Online.Westwood = TEXT
Menu.Online.FA2Fansite = TEXT
Menu.Online.FA2Forum = TEXT
Menu.Online.FA2sp = TEXT
Menu.Online.Phobos = TEXT
Menu.Online.PPM = TEXT
Menu.Online.ModEnc = TEXT
Menu.Options = TEXT
Menu.Options.Settings = TEXT
Menu.Options.ShowMinimap = TEXT
Expand Down
2 changes: 1 addition & 1 deletion FA2pp
Submodule FA2pp updated 1 files
+13 −0 CINI.h
2 changes: 2 additions & 0 deletions FA2sp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@
<ClCompile Include="FA2sp\Hooks.Debug.cpp" />
<ClCompile Include="FA2sp\MFCWindow\Hooks.cpp" />
<ClCompile Include="FA2sp\Miscs\FileWatcher.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.DialogStyle.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.DirectDraw.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.ExtLocalVariables.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.ShpLoad.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.Memory.cpp" />
<ClCompile Include="FA2sp\Miscs\PlaceHolder.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions FA2sp.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@
<ClCompile Include="FA2sp\Miscs\FileWatcher.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Miscs\Hooks.DialogStyle.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Miscs\Hooks.ExtLocalVariables.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="FA2sp\FA2sp.rc">
Expand Down
12 changes: 12 additions & 0 deletions FA2sp/Ext/CFinalSunApp/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@
#include "../../Miscs/FileWatcher.h"
#include "../../Miscs/SaveMap.h"

#include <thread>

#pragma warning(disable : 6262)

std::vector<std::string> CFinalSunAppExt::RecentFilesExt;
std::array<std::pair<std::string, std::string>, 7> CFinalSunAppExt::ExternalLinks
{
std::make_pair("https://github.com/secsome/FA2sp", ""),
std::make_pair("https://github.com/Phobos-developers/Phobos", ""),
std::make_pair("https://www.ppmforums.com/", ""),
std::make_pair("https://modenc.renegadeprojects.com/Main_Page", ""),
std::make_pair("", ""),
std::make_pair("", ""),
std::make_pair("", "")
};

CFinalSunAppExt* CFinalSunAppExt::GetInstance()
{
Expand Down
2 changes: 2 additions & 0 deletions FA2sp/Ext/CFinalSunApp/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <CFinalSunApp.h>

#include <array>
#include <vector>
#include <string>

Expand All @@ -15,4 +16,5 @@ class NOVTABLE CFinalSunAppExt : public CFinalSunApp
BOOL InitInstanceExt();

static std::vector<std::string> RecentFilesExt;
static std::array<std::pair<std::string, std::string>, 7> ExternalLinks;
};
19 changes: 19 additions & 0 deletions FA2sp/Ext/CFinalSunDlg/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ BOOL CFinalSunDlgExt::OnCommandExt(WPARAM wParam, LPARAM lParam)
}
break;
}
case 33000:
case 33001:
case 33002:
case 33003:
case 33004:
case 33005:
case 33006:
{
const auto& url = CFinalSunAppExt::ExternalLinks[wmID - 33000].first;
if (url.empty())
break;
if (!ShellExecute(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL))
{
std::string buffer = "Failed to open url, try manually: ";
buffer += url;
MessageBox(buffer.c_str());
}
break;
}
default:
break;
}
Expand Down
18 changes: 11 additions & 7 deletions FA2sp/Ext/CFinalSunDlg/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ DEFINE_HOOK(432380, CFinalSunDlg_Update_RecentFiles, A)
pMenu->GetSubMenu(0)->InsertMenu(10 + i, MF_BYPOSITION, 40140 + i, CFinalSunAppExt::RecentFilesExt[i].c_str());
}

for (size_t i = 4; i < 7; ++i)
{
if (!CFinalSunAppExt::ExternalLinks[i].first.empty())
pMenu->GetSubMenu(4)->InsertMenu(3 + i, MF_BYPOSITION, 33000 + i, CFinalSunAppExt::ExternalLinks[i].second.c_str());
}

R->EDI(::CheckMenuItem);

return 0x432442;
Expand Down Expand Up @@ -162,13 +168,11 @@ DEFINE_HOOK(43209D, CFinalSunDlg_Update_TranslateMenuItems, A)
translateMenuItem(40134, "Menu.MapTools.NavigateCoordinate");
translateMenuItem(40135, "Menu.MapTools.ToolScripts");

if (0)
{
translateSubMenu(i++, "Menu.Online");
translateMenuItem(40078, "Menu.Online.Westwood");
translateMenuItem(40081, "Menu.Online.FA2Fansite");
translateMenuItem(40119, "Menu.Online.FA2Forum");
}
translateSubMenu(i++, "Menu.Online");
translateMenuItem(33000, "Menu.Online.FA2sp");
translateMenuItem(33001, "Menu.Online.Phobos");
translateMenuItem(33002, "Menu.Online.PPM");
translateMenuItem(33003, "Menu.Online.ModEnc");

translateSubMenu(i++, "Menu.Options");
translateMenuItem(40004, "Menu.Options.Settings");
Expand Down
10 changes: 10 additions & 0 deletions FA2sp/Ext/CLoading/Body.LoadObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,16 @@ void CLoadingExt::SetValidBuffer(ImageDataClass* pData, int Width, int Height)

void CLoadingExt::GetFullPaletteName(ppmfc::CString& PaletteName)
{
const int len = PaletteName.GetLength();
if (len >= 4 &&
PaletteName[len - 4] == '.' &&
(PaletteName[len - 3] == 'p' || PaletteName[len - 3] == 'P') &&
(PaletteName[len - 2] == 'a' || PaletteName[len - 2] == 'A') &&
(PaletteName[len - 1] == 'l' || PaletteName[len - 1] == 'L'))
{
return;
}

switch (this->TheaterIdentifier)
{
case 'A':
Expand Down
12 changes: 10 additions & 2 deletions FA2sp/Ext/CMapValidator/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,21 @@ void CMapValidatorExt::ValidateStructureOverlapping(BOOL& result)
for (int dx = 0; dx < DataExt.Height; ++dx)
{
for (int dy = 0; dy < DataExt.Width; ++dy)
Occupied[CMapData::Instance->GetCoordIndex(X + dx, Y + dy)].emplace_back(splits[1].m_pchData);
{
MapCoord coord = { X + dx, Y + dy };
if (CMapData::Instance->IsCoordInMap(coord.X, coord.Y))
Occupied[CMapData::Instance->GetCoordIndex(coord.X, coord.Y)].emplace_back(splits[1].m_pchData);
}
}
}
else
{
for (const auto& block : *DataExt.Foundations)
Occupied[CMapData::Instance->GetCoordIndex(X + block.Y, Y + block.X)].emplace_back(splits[1].m_pchData);
{
MapCoord coord = { X + block.Y, Y + block.X };
if (CMapData::Instance->IsCoordInMap(coord.X, coord.Y))
Occupied[CMapData::Instance->GetCoordIndex(coord.X, coord.Y)].emplace_back(splits[1].m_pchData);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion FA2sp/Ext/CPropertyBuilding/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ DEFINE_HOOK(417F40, CPropertyBuilding_OnInitDialog, 7)
for (const auto& upgrade : upgrades)
{
const auto UIName = CMapData::Instance->GetUIName(upgrade.c_str());
const auto name = std::format("{} ({})", upgrade, UIName);
const auto name = std::format("{} ({})", upgrade, UIName.m_pchData);

for (int i = 0; i < nUpgrades; ++i)
pUpgrades[i]->AddString(name.c_str());
Expand Down
2 changes: 1 addition & 1 deletion FA2sp/FA2sp.Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define PRODUCT_MAJOR 1
#define PRODUCT_MINOR 6
#define PRODUCT_REVISION 2
#define PRODUCT_REVISION 3

#ifdef NDEBUG
#define PRODUCT_STR __str(PRODUCT_MAJOR) "." __str(PRODUCT_MINOR) "." __str(PRODUCT_REVISION)
Expand Down
42 changes: 42 additions & 0 deletions FA2sp/FA2sp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

#include "Helpers/MutexHelper.h"
#include "Helpers/InstructionSet.h"
#include "Helpers/STDHelpers.h"
#include "Miscs/Palettes.h"
#include "Miscs/VoxelDrawer.h"
#include "Miscs/Exception.h"

#include "Ext/CFinalSunApp/Body.h"

#include <CINI.h>

#include <clocale>
Expand Down Expand Up @@ -60,6 +63,9 @@ bool ExtConfigs::EnableMultiSelection;
bool ExtConfigs::ExtendedValidationNoError;
bool ExtConfigs::HideNoRubbleBuilding;
bool ExtConfigs::ModernObjectBrowser;
bool ExtConfigs::ExtVariables;
bool ExtConfigs::FileWatcher;
bool ExtConfigs::CustomOnlineWebsites;

MultimapHelper Variables::Rules = { &CINI::Rules(), &CINI::CurrentDocument() };
MultimapHelper Variables::FAData = { &CINI::FAData() };
Expand Down Expand Up @@ -150,6 +156,42 @@ void FA2sp::ExtConfigsInitialize()

ExtConfigs::ExtendedValidationNoError = CINI::FAData->GetBool("ExtConfigs", "ExtendedValidationNoError");
ExtConfigs::HideNoRubbleBuilding = CINI::FAData->GetBool("ExtConfigs", "HideNoRubbleBuilding");

ExtConfigs::ExtVariables = CINI::FAData->GetBool("ExtConfigs", "ExtVariables");

ExtConfigs::FileWatcher = CINI::FAData->GetBool("ExtConfigs", "FileWatcher", true);

ExtConfigs::CustomOnlineWebsites = CINI::FAData->GetBool("ExtConfigs", "CustomOnlineWebsites");
if (ExtConfigs::CustomOnlineWebsites)
{
if (auto pStr = CINI::FAData->TryGetString("OnlineWebsites", "Custom1"))
{
auto res = STDHelpers::SplitString(*pStr);
if (res.size() == 2)
{
CFinalSunAppExt::ExternalLinks[4].first = res[1];
CFinalSunAppExt::ExternalLinks[4].second = res[0];
}
}
if (auto pStr = CINI::FAData->TryGetString("OnlineWebsites", "Custom2"))
{
auto res = STDHelpers::SplitString(*pStr);
if (res.size() == 2)
{
CFinalSunAppExt::ExternalLinks[5].first = res[1];
CFinalSunAppExt::ExternalLinks[5].second = res[0];
}
}
if (auto pStr = CINI::FAData->TryGetString("OnlineWebsites", "Custom3"))
{
auto res = STDHelpers::SplitString(*pStr);
if (res.size() == 2)
{
CFinalSunAppExt::ExternalLinks[6].first = res[1];
CFinalSunAppExt::ExternalLinks[6].second = res[0];
}
}
}
}

// DllMain
Expand Down
3 changes: 3 additions & 0 deletions FA2sp/FA2sp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class ExtConfigs
static bool ExtendedValidationNoError;
static bool HideNoRubbleBuilding;
static bool ModernObjectBrowser;
static bool ExtVariables;
static bool FileWatcher;
static bool CustomOnlineWebsites;
};

class Variables
Expand Down

0 comments on commit f2ff96a

Please sign in to comment.