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

Commit 2a323ae

Browse files
committed
Merge branch 'develop'
2 parents aacb80f + 4c3a9aa commit 2a323ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2537
-72
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# FINALALERT2 - SP CHANGELOG
22

3+
## RELEASE 1.5.0 (2023-01-03)
4+
- Implement Auto Property Brush
5+
- New ***ExtConfig*** : `DDrawInVideoMem` = **BOOLEAN**, defaults to true
6+
- New ***ExtConfig*** : `DDrawEmulation` = **BOOLEAN**, defaults to false
7+
- New ***ExtConfig*** : `NoHouseNameTranslation` = **BOOLEAN**, defaults to false
8+
39
## RELEASE 1.4.2 (2022-10-27)
410
- Split `CncVxlRenderText`
511
- New ***ExtConfig*** : `RandomTerrainObjects` = **BOOLEAN**, enable it so `random trees` will show all `TerrainTypes`.

DOCUMENT.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- What you need to know is that FA2sp requires Vanilla FinalAlert 2 1.02, any modified version may lead to unexpected errors!
66
- Before you launch it for the first time, write the ini files below properly, especially for essential ones (marked by **x**).
77
- If you still have any problem about it or something wrong occured while using it, please contact me directly or mail me at [email protected].
8-
- Now you can also join Discord server https://discord.gg/k4SVuMm, and found `map-editor-patches` under `DEDICATED PROJECTS`.
8+
- Now you can also join Discord server https://discord.gg/k4SVuMm, and found `map-editors` under `DEDICATED PROJECTS`.
99
- For now, I cannot ensure the stability of it, so save your maps frequently before heavy loss! XD
1010

1111
~~The multiple selection function is now available. Press Ctrl key to select tiles and press Ctrl+Shift key to deselect them. Ctrl+D can clear all selected tiles.
@@ -55,7 +55,7 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~
5555
- `SaveMap.AutoSave.Interval` = **INTEGER** ; Should be greater than or equal to $30$, defaults to $300$, determines how many seconds should we wait during the two auto saving
5656
- `SaveMap.AutoSave.MaxCount` = **INTEGER** ; How many saving should FA2 keep, set to $-1$ will disable the auto cleanning, defaults to $10$
5757
- `SaveMap.OnlySaveMAP` = **BOOLEAN** ; Determines if FA2 will only save map with *.map* file extension
58-
- `SaveMap.DefaultPreviewOptionMP` = **INTEGER** ; Default radio option button for preview generation when saving multiplayer maps.
58+
- `SaveMap.DefaultPreviewOptionMP` = **INTEGER** ; Default radio option button for preview generation when saving multiplayer maps
5959
- $0$ = Always generate new preview
6060
- $1$ = Do no generate new preview
6161
- $2$ = Always generate hidden preview
@@ -65,6 +65,9 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~
6565
- `RecentFileLimit` = **INTEGER** ; How many recent files should I keep? ranges from $4$ to $9$
6666
- `MultiSelectionColor` = **COLORREF** ; Determines the back color of selected tiles
6767
- `RandomTerrainObjects` = **BOOLEAN** ; Determines if FA2 will display all terrain objects in random tree dialog, defaults to **false**
68+
- `DDrawInVideoMem` = **BOOLEAN** ; Determines if FA2 will allocate DirectDraw surface in the video memory, defaults to true
69+
- `DDrawEmulation` = **BOOLEAN** ; Determines if FA2 will use emulation mode for DirectDrawCreate, defaults to false
70+
- `NoHouseNameTranslation` = **BOOLEAN** ; Determines if FA2 will translate house to their UIName, defaults to false
6871
- **`[Sides]`** (**x** means this item is **essensial**, fa2sp need this section to work properly)
6972
- Contains a list of sides registered in rules
7073
```ini
@@ -450,6 +453,11 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~
450453
Menu.Lighting.Normal = TEXT
451454
Menu.Lighting.Lightning = TEXT
452455
Menu.Lighting.Dominator = TEXT
456+
Menu.PropertyBrush = TEXT
457+
Menu.PropertyBrush.AutoAircraft = TEXT
458+
Menu.PropertyBrush.AutoBuilding = TEXT
459+
Menu.PropertyBrush.AutoInfantry = TEXT
460+
Menu.PropertyBrush.AutoVehicle = TEXT
453461
DialogBar.TileManager = TEXT
454462
DialogBar.TerrainOrGround = TEXT
455463
DialogBar.OverlayAndSpecial = TEXT

FA2sp.vcxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@
128128
<ItemGroup>
129129
<ClCompile Include="FA2pp\FunctionInit.cpp" />
130130
<ClCompile Include="FA2sp\Algorithms\base64.cpp" />
131+
<ClCompile Include="FA2sp\Algorithms\lcw.cpp" />
132+
<ClCompile Include="FA2sp\Algorithms\lcw_c.cpp" />
133+
<ClCompile Include="FA2sp\Algorithms\lcw_d.cpp" />
134+
<ClCompile Include="FA2sp\Algorithms\lzo.cpp" />
135+
<ClCompile Include="FA2sp\Algorithms\lzo1x_c.cpp" />
136+
<ClCompile Include="FA2sp\Algorithms\lzo1x_d.cpp" />
137+
<ClCompile Include="FA2sp\Algorithms\sha1.cpp" />
131138
<ClCompile Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.cpp" />
132139
<ClCompile Include="FA2sp\Ext\CAITriggerTypes\Body.cpp" />
133140
<ClCompile Include="FA2sp\Ext\CChangeMapSize\Hooks.cpp" />
@@ -150,7 +157,9 @@
150157
<ClCompile Include="FA2sp\Ext\CLoading\Hooks.InitPalettes.cpp" />
151158
<ClCompile Include="FA2sp\Ext\CLoading\Hooks.LoadObjects.cpp" />
152159
<ClCompile Include="FA2sp\Ext\CMapData\Body.cpp" />
160+
<ClCompile Include="FA2sp\Ext\CMapData\Hooks.AutoPropertyBrush.cpp" />
153161
<ClCompile Include="FA2sp\Ext\CMapData\Hooks.cpp" />
162+
<ClCompile Include="FA2sp\Ext\CMapData\Body.Pack.cpp" />
154163
<ClCompile Include="FA2sp\Ext\CMapD\Hooks.cpp" />
155164
<ClCompile Include="FA2sp\Ext\CMinimap\Hooks.cpp" />
156165
<ClCompile Include="FA2sp\Ext\CPropertyAircraft\Body.cpp" />
@@ -182,6 +191,7 @@
182191
<ClCompile Include="FA2sp\Helpers\MultimapHelper.cpp" />
183192
<ClCompile Include="FA2sp\Hooks.Debug.cpp" />
184193
<ClCompile Include="FA2sp\MFCWindow\Hooks.cpp" />
194+
<ClCompile Include="FA2sp\Miscs\Hooks.DirectDraw.cpp" />
185195
<ClCompile Include="FA2sp\Miscs\VoxelDrawer.cpp" />
186196
<ClCompile Include="FA2sp\Miscs\Exception.cpp" />
187197
<ClCompile Include="FA2sp\Miscs\Hooks.PreviewFix.cpp" />
@@ -215,6 +225,12 @@
215225
</ItemGroup>
216226
<ItemGroup>
217227
<ClInclude Include="FA2sp\Algorithms\base64.h" />
228+
<ClInclude Include="FA2sp\Algorithms\lcw.h" />
229+
<ClInclude Include="FA2sp\Algorithms\lzo.h" />
230+
<ClInclude Include="FA2sp\Algorithms\lzo1x.h" />
231+
<ClInclude Include="FA2sp\Algorithms\lzoconf.h" />
232+
<ClInclude Include="FA2sp\Algorithms\lzo_conf.h" />
233+
<ClInclude Include="FA2sp\Algorithms\sha1.h" />
218234
<ClInclude Include="FA2sp\ExtraWindow\CAllieEditor\CAllieEditor.h" />
219235
<ClInclude Include="FA2sp\Ext\CAITriggerTypes\Body.h" />
220236
<ClInclude Include="FA2sp\Ext\CFinalSunApp\Body.h" />

FA2sp.vcxproj.filters

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,24 @@
165165
<ClInclude Include="FA2sp\Algorithms\base64.h">
166166
<Filter>头文件</Filter>
167167
</ClInclude>
168+
<ClInclude Include="FA2sp\Algorithms\sha1.h">
169+
<Filter>头文件</Filter>
170+
</ClInclude>
171+
<ClInclude Include="FA2sp\Algorithms\lzo1x.h">
172+
<Filter>头文件</Filter>
173+
</ClInclude>
174+
<ClInclude Include="FA2sp\Algorithms\lzoconf.h">
175+
<Filter>头文件</Filter>
176+
</ClInclude>
177+
<ClInclude Include="FA2sp\Algorithms\lzo_conf.h">
178+
<Filter>头文件</Filter>
179+
</ClInclude>
180+
<ClInclude Include="FA2sp\Algorithms\lzo.h">
181+
<Filter>头文件</Filter>
182+
</ClInclude>
183+
<ClInclude Include="FA2sp\Algorithms\lcw.h">
184+
<Filter>头文件</Filter>
185+
</ClInclude>
168186
</ItemGroup>
169187
<ItemGroup>
170188
<ClCompile Include="FA2sp\FA2sp.cpp">
@@ -425,6 +443,36 @@
425443
<ClCompile Include="FA2sp\Algorithms\base64.cpp">
426444
<Filter>源文件</Filter>
427445
</ClCompile>
446+
<ClCompile Include="FA2sp\Ext\CMapData\Hooks.AutoPropertyBrush.cpp">
447+
<Filter>源文件</Filter>
448+
</ClCompile>
449+
<ClCompile Include="FA2sp\Miscs\Hooks.DirectDraw.cpp">
450+
<Filter>源文件</Filter>
451+
</ClCompile>
452+
<ClCompile Include="FA2sp\Algorithms\sha1.cpp">
453+
<Filter>源文件</Filter>
454+
</ClCompile>
455+
<ClCompile Include="FA2sp\Algorithms\lzo1x_c.cpp">
456+
<Filter>源文件</Filter>
457+
</ClCompile>
458+
<ClCompile Include="FA2sp\Algorithms\lzo1x_d.cpp">
459+
<Filter>源文件</Filter>
460+
</ClCompile>
461+
<ClCompile Include="FA2sp\Algorithms\lzo.cpp">
462+
<Filter>源文件</Filter>
463+
</ClCompile>
464+
<ClCompile Include="FA2sp\Ext\CMapData\Body.Pack.cpp">
465+
<Filter>源文件</Filter>
466+
</ClCompile>
467+
<ClCompile Include="FA2sp\Algorithms\lcw.cpp">
468+
<Filter>源文件</Filter>
469+
</ClCompile>
470+
<ClCompile Include="FA2sp\Algorithms\lcw_d.cpp">
471+
<Filter>源文件</Filter>
472+
</ClCompile>
473+
<ClCompile Include="FA2sp\Algorithms\lcw_c.cpp">
474+
<Filter>源文件</Filter>
475+
</ClCompile>
428476
</ItemGroup>
429477
<ItemGroup>
430478
<ResourceCompile Include="FA2sp\FA2sp.rc">

FA2sp/Algorithms/base64.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#include "base64.h"
22

3+
std::string base64::encode(const void* buffer, size_t length)
4+
{
5+
std::string s;
6+
s.resize(length);
7+
memcpy(s.data(), buffer, length);
8+
return encode(s);
9+
}
10+
311
std::string base64::encode(std::string_view s)
412
{
513
std::string ret;
@@ -35,6 +43,14 @@ std::string base64::encode(std::string_view s)
3543
return ret;
3644
}
3745

46+
std::string base64::decode(const void* buffer, size_t length)
47+
{
48+
std::string s;
49+
s.resize(length);
50+
memcpy(s.data(), buffer, length);
51+
return decode(s);
52+
}
53+
3854
std::string base64::decode(std::string_view s)
3955
{
4056
std::string ret;

FA2sp/Algorithms/base64.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
class base64
66
{
77
public:
8+
static std::string encode(const void* buffer, size_t length);
89
static std::string encode(std::string_view s);
10+
static std::string decode(const void* buffer, size_t length);
911
static std::string decode(std::string_view s);
1012
private:
1113
static constexpr char encoder[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

FA2sp/Algorithms/lcw.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include "lcw.h"
2+
3+
std::string lcw::compress(const void* src, int slen)
4+
{
5+
std::string ret;
6+
7+
unsigned char* ptr = (unsigned char*)src;
8+
char* buffer = new char[BufferSize];
9+
10+
while (slen > 0)
11+
{
12+
const int blocksize = std::min(slen, BlockSize);
13+
const int count = LCW_Compress(ptr, buffer + 4, blocksize);
14+
reinterpret_cast<unsigned short*>(buffer)[0] = count;
15+
reinterpret_cast<unsigned short*>(buffer)[1] = blocksize;
16+
ret.append(buffer, count + 4);
17+
ptr += blocksize;
18+
slen -= blocksize;
19+
}
20+
21+
delete[] buffer;
22+
23+
return ret;
24+
}
25+
26+
std::string lcw::decompress(const void* src, int slen)
27+
{
28+
std::string ret;
29+
30+
unsigned char* ptr = (unsigned char*)src;
31+
char* buffer = new char[BufferSize];
32+
33+
while (slen > 0)
34+
{
35+
auto blocksize = reinterpret_cast<unsigned short*>(ptr)[0];
36+
LCW_Uncompress(ptr + 4, buffer);
37+
ret.append(buffer, buffer);
38+
ptr += blocksize;
39+
slen -= blocksize;
40+
}
41+
42+
delete[] buffer;
43+
44+
return ret;
45+
}

FA2sp/Algorithms/lcw.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include <string>
4+
5+
class lcw
6+
{
7+
public:
8+
static std::string compress(const void* src, int slen);
9+
static std::string decompress(const void* src, int slen);
10+
11+
private:
12+
static constexpr int LCW_Worst_Case(int datasize)
13+
{
14+
return datasize + (datasize / 63) + 1;
15+
}
16+
17+
static constexpr int BlockSize = 1024 * 8;
18+
static constexpr int SafetyMargin = BlockSize / 128 + 1;
19+
static constexpr int BufferSize = BlockSize + SafetyMargin;
20+
21+
static unsigned int __cdecl LCW_Uncompress(void* source, void* dest, unsigned int length = 0);
22+
static int __cdecl LCW_Compress(void const* source, void* dest, unsigned int length);
23+
};

0 commit comments

Comments
 (0)