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 Oct 27, 2022
2 parents 953a008 + 738a1e3 commit aacb80f
Show file tree
Hide file tree
Showing 36 changed files with 476 additions and 249 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# FINALALERT2 - SP CHANGELOG

## RELEASE 1.4.2 (2022-10-27)
- Split `CncVxlRenderText`
- New ***ExtConfig*** : `RandomTerrainObjects` = **BOOLEAN**, enable it so `random trees` will show all `TerrainTypes`.
- Fixed a bug when saving `[PreviewPack]` and `[Preview]`

## RELEASE 1.4.1 (2022-06-18)
- *This is a **cumulative** update*
- Reimplemented CTeamTypes message handler
Expand Down
3 changes: 2 additions & 1 deletion DOCUMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~
- $1$ = Do no generate new preview
- $2$ = Always generate hidden preview
- defaults to $0$.
- `SaveMap.DefaultPreviewOptionSP` = **INTEGER** ; Same as the **MP** one but for **SP** maps, defaults to $1$.
- `SaveMap.DefaultPreviewOptionSP` = **INTEGER** ; Same as the **MP** one but for **SP** maps, defaults to $1$
- `VerticalLayout` = **BOOLEAN** ; Determines if FA2 will make the bottom view go to the right side
- `RecentFileLimit` = **INTEGER** ; How many recent files should I keep? ranges from $4$ to $9$
- `MultiSelectionColor` = **COLORREF** ; Determines the back color of selected tiles
- `RandomTerrainObjects` = **BOOLEAN** ; Determines if FA2 will display all terrain objects in random tree dialog, defaults to **false**
- **`[Sides]`** (**x** means this item is **essensial**, fa2sp need this section to work properly)
- Contains a list of sides registered in rules
```ini
Expand Down
Binary file added Debug/CncVxlRenderText.dll
Binary file not shown.
Binary file added Debug/CncVxlRenderText.lib
Binary file not shown.
Binary file removed Debug/vxl_drawing_lib.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion FA2pp
Submodule FA2pp updated 2 files
+1 −1 CMapData.h
+51 −0 CMapValidator.h
19 changes: 13 additions & 6 deletions FA2sp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalDependencies>DbgHelp.lib;legacy_stdio_definitions.lib;vxl_drawing_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>DbgHelp.lib;legacy_stdio_definitions.lib;CncVxlRenderText.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries>
Expand Down Expand Up @@ -118,7 +118,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<AdditionalDependencies>DbgHelp.lib;legacy_stdio_definitions.lib;vxl_drawing_lib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>DbgHelp.lib;legacy_stdio_definitions.lib;CncVxlRenderText.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries>
Expand All @@ -127,9 +127,11 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="FA2pp\FunctionInit.cpp" />
<ClCompile Include="FA2sp\Algorithms\base64.cpp" />
<ClCompile Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.cpp" />
<ClCompile Include="FA2sp\Ext\CAITriggerTypes\Body.cpp" />
<ClCompile Include="FA2sp\Ext\CChangeMapSize\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CCreateMap2\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CCreateMap3A\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CEasterEgg\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CFinalSunApp\Body.cpp" />
Expand Down Expand Up @@ -159,6 +161,8 @@
<ClCompile Include="FA2sp\Ext\CPropertyInfantry\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CPropertyUnit\Body.cpp" />
<ClCompile Include="FA2sp\Ext\CPropertyUnit\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CRandomTree\Body.cpp" />
<ClCompile Include="FA2sp\Ext\CRandomTree\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CScriptTypes\Body.CurrentScript.cpp" />
<ClCompile Include="FA2sp\Ext\CScriptTypes\Hooks.cpp" />
<ClCompile Include="FA2sp\Ext\CSingleplayerSettings\Body.cpp" />
Expand All @@ -178,7 +182,7 @@
<ClCompile Include="FA2sp\Helpers\MultimapHelper.cpp" />
<ClCompile Include="FA2sp\Hooks.Debug.cpp" />
<ClCompile Include="FA2sp\MFCWindow\Hooks.cpp" />
<ClCompile Include="FA2sp\Miscs\DrawStuff.cpp" />
<ClCompile Include="FA2sp\Miscs\VoxelDrawer.cpp" />
<ClCompile Include="FA2sp\Miscs\Exception.cpp" />
<ClCompile Include="FA2sp\Miscs\Hooks.PreviewFix.cpp" />
<ClCompile Include="FA2sp\Miscs\MultiSelection.cpp" />
Expand Down Expand Up @@ -210,6 +214,7 @@
<ClCompile Include="FA2sp\ExtraWindow\CTileManager\CTileManager.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="FA2sp\Algorithms\base64.h" />
<ClInclude Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.h" />
<ClInclude Include="FA2sp\Ext\CAITriggerTypes\Body.h" />
<ClInclude Include="FA2sp\Ext\CFinalSunApp\Body.h" />
Expand All @@ -223,6 +228,7 @@
<ClInclude Include="FA2sp\Ext\CPropertyBuilding\Body.h" />
<ClInclude Include="FA2sp\Ext\CPropertyInfantry\Body.h" />
<ClInclude Include="FA2sp\Ext\CPropertyUnit\Body.h" />
<ClInclude Include="FA2sp\Ext\CRandomTree\Body.h" />
<ClInclude Include="FA2sp\Ext\CScriptTypes\Functional.h" />
<ClInclude Include="FA2sp\Ext\CSingleplayerSettings\Body.h" />
<ClInclude Include="FA2sp\Ext\CTeamTypes\Body.h" />
Expand All @@ -245,7 +251,7 @@
<ClInclude Include="FA2sp\Helpers\TheaterHelpers.h" />
<ClInclude Include="FA2sp\Helpers\Templates.hpp" />
<ClInclude Include="FA2sp\Logger.h" />
<ClInclude Include="FA2sp\Miscs\DrawStuff.h" />
<ClInclude Include="FA2sp\Miscs\VoxelDrawer.h" />
<ClInclude Include="FA2sp\Miscs\Exception.h" />
<ClInclude Include="FA2sp\Miscs\MultiSelection.h" />
<ClInclude Include="FA2sp\Miscs\Palettes.h" />
Expand All @@ -257,12 +263,13 @@
<ClInclude Include="FA2sp\Helpers\Translations.h" />
<ClInclude Include="FA2sp\ExtraWindow\CTileManager\CTileManager.h" />
<ClInclude Include="FA2sp\Source\CIsoView.h" />
<ClInclude Include="FA2sp\vxl_drawing_lib.h" />
<ClInclude Include="FA2sp\CncVxlRenderText.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.rc" />
<ResourceCompile Include="FA2sp\UI\CAircraftDialog.rc" />
<ResourceCompile Include="FA2sp\UI\CAITriggerTypes.rc" />
<ResourceCompile Include="FA2sp\UI\CCreateMap2.rc" />
<ResourceCompile Include="FA2sp\UI\CInfantryDialog.rc" />
<ResourceCompile Include="FA2sp\UI\CLighting.rc" />
<ResourceCompile Include="FA2sp\UI\CLoading.rc" />
Expand All @@ -283,7 +290,7 @@
<ResourceCompile Include="FA2sp\UI\CUnitDialog.rc" />
</ItemGroup>
<ItemGroup>
<None Include="FA2sp\rt_manif.bin" />
<None Include="FA2sp\FA2sp.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
29 changes: 25 additions & 4 deletions FA2sp.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@
<ClInclude Include="FA2sp\Miscs\Palettes.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FA2sp\vxl_drawing_lib.h">
<ClInclude Include="FA2sp\CncVxlRenderText.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FA2sp\Miscs\DrawStuff.h">
<ClInclude Include="FA2sp\Miscs\VoxelDrawer.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.h">
Expand Down Expand Up @@ -159,6 +159,12 @@
<ClInclude Include="FA2sp\Source\CIsoView.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FA2sp\Ext\CRandomTree\Body.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FA2sp\Algorithms\base64.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="FA2sp\FA2sp.cpp">
Expand Down Expand Up @@ -293,7 +299,7 @@
<ClCompile Include="FA2sp\Ext\CTriggerAction\Hooks.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Miscs\DrawStuff.cpp">
<ClCompile Include="FA2sp\Miscs\VoxelDrawer.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Ext\CFinalSunDlg\Body.cpp">
Expand Down Expand Up @@ -407,6 +413,18 @@
<ClCompile Include="FA2sp\Source\CIsoView.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Ext\CCreateMap2\Hooks.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Ext\CRandomTree\Hooks.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Ext\CRandomTree\Body.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FA2sp\Algorithms\base64.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="FA2sp\FA2sp.rc">
Expand Down Expand Up @@ -472,9 +490,12 @@
<ResourceCompile Include="FA2sp\UI\CLoading.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
<ResourceCompile Include="FA2sp\UI\CCreateMap2.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="FA2sp\rt_manif.bin">
<None Include="FA2sp\FA2sp.manifest">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
Expand Down
60 changes: 60 additions & 0 deletions FA2sp/Algorithms/base64.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include "base64.h"

std::string base64::encode(std::string_view s)
{
std::string ret;
ret.reserve((s.length() + 2) / 3 * 4);

size_t pos = 0;
while (pos < s.length())
{
ret += encoder[(s[pos] & 0xFC) >> 2];
if (pos + 1 < s.length())
{
ret += encoder[((s[pos] & 0x03) << 4) + ((s[pos + 1] & 0xF0) >> 4)];
if (pos + 2 < s.length())
{
ret += encoder[((s[pos + 1] & 0x0F) << 2) + ((s[pos + 2] & 0xC0) >> 6)];
ret += encoder[s[pos + 2] & 0x3F];
}
else
{
ret += encoder[(s[pos + 1] & 0x0F) << 2];
ret += '=';
}
}
else
{
ret += encoder[(s[pos + 0] & 0x03) << 4];
ret += "==";
}
pos += 3;
}

ret.shrink_to_fit();
return ret;
}

std::string base64::decode(std::string_view s)
{
std::string ret;
ret.reserve(s.length() / 4 * 3);

size_t pos = 0;
while (pos < s.length())
{
auto p1 = decoder[s[pos + 1]];
ret += ((decoder[s[pos]]) << 2) + ((p1 & 0x30) >> 4);
if ((pos + 2 < s.length()) && s[pos + 2] != '=' && s[pos + 2] != '.')
{
auto p2 = decoder[s[pos + 2]];
ret += ((p1 & 0x0F) << 4) + ((p2 & 0x3C) >> 2);
if ((pos + 3 < s.length()) && s[pos + 3] != '=' && s[pos + 3] != '.')
ret += (((p2 & 0x03) << 6) + decoder[s[pos + 3]]);
}
pos += 4;
}

ret.shrink_to_fit();
return ret;
}
47 changes: 47 additions & 0 deletions FA2sp/Algorithms/base64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once

#include <string>

class base64
{
public:
static std::string encode(std::string_view s);
static std::string decode(std::string_view s);
private:
static constexpr char encoder[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static constexpr unsigned char const decoder[256] =
{
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0x3E, 0xFE, 0xFE, 0xFE, 0x3F,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0xFE, 0xFE, 0xFE, 0xFF, 0xFE, 0xFE,
0xFE, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x19, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
0x31, 0x32, 0x33, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
};
};
28 changes: 28 additions & 0 deletions FA2sp/CncVxlRenderText.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

extern "C"
{
__declspec(dllimport) void* __stdcall CncImgMalloc(unsigned int sz);
__declspec(dllimport) void __stdcall CncImgFree(void* ptr);

__declspec(dllimport) void __stdcall CncImgCreate();
__declspec(dllimport) void __stdcall CncImgRelease();

__declspec(dllimport) void __stdcall CncImgSetMaxFacing(unsigned int nFacingCount);
__declspec(dllimport) unsigned int __stdcall CncImgGetMaxFacing();

__declspec(dllimport) bool __stdcall CncImgLoadVPLFile(const unsigned char* pBuffer);
__declspec(dllimport) bool __stdcall CncImgLoadVXLFile(const unsigned char* pBuffer);
__declspec(dllimport) bool __stdcall CncImgLoadHVAFile(const unsigned char* pBuffer);

__declspec(dllimport) bool __stdcall CncImgPrepareVXLCache(unsigned int nFacing, int F, int L, int H);
__declspec(dllimport) int __stdcall CncImgGetImageWidth(unsigned int nFacing);
__declspec(dllimport) int __stdcall CncImgGetImageHeight(unsigned int nFacing);
__declspec(dllimport) void __stdcall CncImgGetImageFrame(unsigned int nFacing, int* width, int* height, int* x, int* y);
__declspec(dllimport) void __stdcall CncImgGetImageSize(unsigned int nFacing, int* width, int* height);
__declspec(dllimport) bool __stdcall CncImgGetImageData(unsigned int nFacing, unsigned char** ppBuffer);

__declspec(dllimport) void __stdcall CncImgClearCurrentVXL();
__declspec(dllimport) bool __stdcall CncImgIsVXLLoaded();
__declspec(dllimport) bool __stdcall CncImgIsVPLLoaded();
}
8 changes: 8 additions & 0 deletions FA2sp/Ext/CCreateMap2/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <Helpers/Macro.h>
#include <CCreateMap3A.h>

// Issue #22
DEFINE_HOOK(42DF67, CCreateMap2_SkipEnableAITriggers, 7)
{
return 0x42E0AA;
}
5 changes: 5 additions & 0 deletions FA2sp/Ext/CFinalSunDlg/Body.ObjectBrowserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,11 @@ void CViewObjectsExt::ApplyPropertyBrush_Vehicle(int nIndex)
::RedrawWindow(CFinalSunDlg::Instance->MyViewFrame.pIsoView->m_hWnd, 0, 0, RDW_UPDATENOW | RDW_INVALIDATE);
}

bool CViewObjectsExt::IsIgnored(const char* pItem)
{
return IgnoreSet.find(pItem) != IgnoreSet.end();
}

int CViewObjectsExt::GuessType(const char* pRegName)
{
if (ExtSets[Set_Building].find(pRegName) != ExtSets[Set_Building].end())
Expand Down
2 changes: 2 additions & 0 deletions FA2sp/Ext/CFinalSunDlg/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class CViewObjectsExt : public CViewObjects
static void ApplyPropertyBrush_Aircraft(int nIndex);
static void ApplyPropertyBrush_Vehicle(int nIndex);

static bool IsIgnored(const char* pItem);

ppmfc::CString QueryUIName(const char* pRegName, bool bOnlyOneLine = true);

public:
Expand Down
22 changes: 10 additions & 12 deletions FA2sp/Ext/CFinalSunDlg/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,20 @@ DEFINE_HOOK(436EE0, CFinalSunDlg_AddToRecentFile, 7)
if (itr == recentfiles.end()) // doesn't have this file
{
sortedrecentfiles.push_back(filepath);

// Remove useless files
for (auto& file : recentfiles)
{
if (file.length() > 0)
sortedrecentfiles.push_back(file);
{
auto it = std::find_if(sortedrecentfiles.begin(), sortedrecentfiles.end(),
[file](std::string& s) {return _strcmpi(s.c_str(), file.c_str()) == 0; }
);
if (it == sortedrecentfiles.end()) // no duplicate file
sortedrecentfiles.push_back(file);
}
}
std::unique(sortedrecentfiles.begin(), sortedrecentfiles.end(),
[](std::string& a, std::string b) {return _strcmpi(a.c_str(), b.c_str()) == 0; });
sortedrecentfiles.shrink_to_fit();

size_t sz = recentfiles.size();
size_t cnt = std::min(sz, sortedrecentfiles.size());
recentfiles.clear();
recentfiles.resize(sz);

for (size_t i = 0; i < cnt; ++i)
recentfiles[i] = sortedrecentfiles[i];
recentfiles = sortedrecentfiles;

CINI ini;
std::string path = CFinalSunApp::Instance->ExePath + "\\FinalAlert.ini";
Expand Down
Loading

0 comments on commit aacb80f

Please sign in to comment.