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 Jun 18, 2022
2 parents 0b9d421 + 9bce098 commit 953a008
Show file tree
Hide file tree
Showing 27 changed files with 1,148 additions and 953 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
!/Release/vxl_drawing_lib.lib
/.vs/FA2sp/project-colors.json


.vs/
395 changes: 199 additions & 196 deletions CHANGELOG.md

Large diffs are not rendered by default.

1,241 changes: 626 additions & 615 deletions DOCUMENT.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion FA2pp
4 changes: 2 additions & 2 deletions FA2sp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NOMINMAX;SYR_VER=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>
Expand Down Expand Up @@ -242,7 +242,7 @@
<ClInclude Include="FA2sp\Helpers\MultimapHelper.h" />
<ClInclude Include="FA2sp\Helpers\Parser.h" />
<ClInclude Include="FA2sp\Helpers\STDHelpers.h" />
<ClInclude Include="FA2sp\Helpers\TheaterHelpers.h" />
<ClInclude Include="FA2sp\Helpers\TheaterHelpers.h" />
<ClInclude Include="FA2sp\Helpers\Templates.hpp" />
<ClInclude Include="FA2sp\Logger.h" />
<ClInclude Include="FA2sp\Miscs\DrawStuff.h" />
Expand Down
20 changes: 0 additions & 20 deletions FA2sp/Ext/CDialog289/Body.cpp

This file was deleted.

3 changes: 2 additions & 1 deletion FA2sp/Ext/CFinalSunApp/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ BOOL CFinalSunAppExt::InitInstanceExt()
exit(0);
}

std::string cmdline = this->m_lpCmdLine;
CFinalSunDlg::SE2KMODE = FALSE; // We don't need SE2K stuff
CFinalSunApp::MapPath[0] = '\0';
// Now let's parse the command line
// Nothing yet huh...

std::string path;
path = CFinalSunApp::ExePath + "\\FAData.ini";
Expand Down
24 changes: 16 additions & 8 deletions FA2sp/Ext/CFinalSunDlg/Body.ObjectBrowserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,19 @@ void CViewObjectsExt::Redraw_Initialize()

if (auto ignores = fadata.GetSection("IgnoreRA2"))
for (auto& item : ignores->GetEntities())
IgnoreSet.insert(item.second);
{
ppmfc::CString tmp = item.second;
tmp.Trim();
IgnoreSet.insert(tmp);
}

if (auto forcenames = fadata.GetSection("ForceName"))
for (auto& item : forcenames->GetEntities())
ForceName.insert(item.second);
{
ppmfc::CString tmp = item.second;
tmp.Trim();
ForceName.insert(tmp);
}

}

Expand Down Expand Up @@ -287,7 +295,7 @@ void CViewObjectsExt::Redraw_Infantry()
if (subNodes.find(side) == subNodes.end())
side = -1;
this->InsertString(
QueryUIName(inf.second) + "(" + inf.second + ")",
QueryUIName(inf.second) + " (" + inf.second + ")",
Const_Infantry + index,
subNodes[side]
);
Expand Down Expand Up @@ -336,7 +344,7 @@ void CViewObjectsExt::Redraw_Vehicle()
if (subNodes.find(side) == subNodes.end())
side = -1;
this->InsertString(
QueryUIName(veh.second) + "(" + veh.second + ")",
QueryUIName(veh.second) + " (" + veh.second + ")",
Const_Vehicle + index,
subNodes[side]
);
Expand Down Expand Up @@ -386,7 +394,7 @@ void CViewObjectsExt::Redraw_Aircraft()
if (subNodes.find(side) == subNodes.end())
side = -1;
this->InsertString(
QueryUIName(air.second) + "(" + air.second + ")",
QueryUIName(air.second) + " (" + air.second + ")",
Const_Aircraft + index,
subNodes[side]
);
Expand Down Expand Up @@ -436,7 +444,7 @@ void CViewObjectsExt::Redraw_Building()
if (subNodes.find(side) == subNodes.end())
side = -1;
this->InsertString(
QueryUIName(bud.second) + "(" + bud.second + ")",
QueryUIName(bud.second) + " (" + bud.second + ")",
Const_Building + index,
subNodes[side]
);
Expand Down Expand Up @@ -483,7 +491,7 @@ void CViewObjectsExt::Redraw_Terrain()
if (IgnoreSet.find(terrains[i]) == IgnoreSet.end())
{
FA2sp::Buffer = QueryUIName(terrains[i]);
FA2sp::Buffer += "(" + terrains[i] + ")";
FA2sp::Buffer += " (" + terrains[i] + ")";
bool bNotOther = false;
for (const auto& node : nodes)
{
Expand Down Expand Up @@ -590,7 +598,7 @@ void CViewObjectsExt::Redraw_Overlay()
{
CString buffer;
buffer = QueryUIName(overlays[i]);
buffer += "(" + overlays[i] + ")";
buffer += " (" + overlays[i] + ")";
if (rules.GetBool(overlays[i], "Wall"))
this->InsertString(
QueryUIName(overlays[i]),
Expand Down
2 changes: 1 addition & 1 deletion FA2sp/Ext/CIsoView/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void CIsoViewExt::ProgramStartupInit()

void CIsoViewExt::AddTube(int EnterX, int EnterY, int ExitX, int ExitY)
{
Logger::FormatLog("Generating tube from ({}, {}) to ({}, {})\n", EnterX, EnterY, ExitX, ExitY);
Logger::Raw("Generating tube from (%d, %d) to (%d, %d)\n", EnterX, EnterY, ExitX, ExitY);

TubeData tube;
memset(tube.Directions, 0xFF, sizeof(tube.Directions));
Expand Down
11 changes: 11 additions & 0 deletions FA2sp/Ext/CLoading/Hooks.LoadObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <Helpers/Macro.h>

#include <CMapData.h>
#include <CObjectDatas.h>
#include <CINI.h>
#include <Drawing.h>
Expand Down Expand Up @@ -77,6 +78,16 @@ DEFINE_HOOK(49D2C0, CMapData_LoadMap_ClearCLoadingExtData, 5)
return 0;
}

DEFINE_HOOK(49D5CC, CLoading_LoadMap_CallMissingRelease, 5)
{
GET(CLoading*, pThis, ESI);

pThis->Release();
pThis->InitializeDDraw();

return 0;
}

DEFINE_HOOK(491FD4, CLoading_Release_SetImageDataToNullptr, 5)
{
GET(char*, pNode, ESI); // Map node in fact
Expand Down
21 changes: 17 additions & 4 deletions FA2sp/Ext/CMapData/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,26 @@ DEFINE_HOOK(47AB50, CLoading_InitPics_InitOverlayTypeDatas, 7)

DEFINE_HOOK(49DFB4, CMapData_LoadMap_InvalidTheater, 6)
{
GET(char*, theaterName, EDI);
GET(const char*, lpTheaterName, EDI);

for (auto& str : TheaterHelpers::GetEnabledTheaterNames())
for (const auto& lpStr : TheaterHelpers::GetEnabledTheaterNames())
{
if (strcmp(str, theaterName) == 0)
if (_strcmpi(lpStr, lpTheaterName) == 0)
return 0;
}

return 0x49EDD9;
}
}

#define DEFINE_THEATER_NAME_FIX(addr, name, reg) \
DEFINE_HOOK(addr, CMapData_LoadMap_SupportLowerCaseTheaterName_##name, 5) \
{R->EAX(_strcmpi(R->reg<const char*>(), #name)); return (0x##addr + 0xE);}

DEFINE_THEATER_NAME_FIX(49DFB4, TEMPERATE, EDI);
DEFINE_THEATER_NAME_FIX(49E1D9, SNOW, EDI);
DEFINE_THEATER_NAME_FIX(49E3FF, URBAN, EDI);
DEFINE_THEATER_NAME_FIX(49E631, NEWURBAN, EDI);
DEFINE_THEATER_NAME_FIX(49E863, LUNAR, EDI);
DEFINE_THEATER_NAME_FIX(49EAA4, DESERT, ESI);

#undef DEFINE_THEATER_NAME_FIX
20 changes: 20 additions & 0 deletions FA2sp/Ext/CScriptsSelectionDialog/Body.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Body.h"

CScriptsSelectionDialog* CScriptsSelectionDialogExt::Instance = nullptr;

void CScriptsSelectionDialogExt::ProgramStartupInit()
{
RunTime::ResetMemoryContentAt(0x5926A8, &CScriptsSelectionDialogExt::PreTranslateMessageExt);
}

BOOL CScriptsSelectionDialogExt::PreTranslateMessageExt(MSG* pMsg)
{
switch (pMsg->message) {
case WM_CREATE:
Logger::Debug(__FUNCTION__"\n");
break;
default:
break;
}
return this->ppmfc::CDialog::PreTranslateMessage(pMsg);
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#pragma once

#include <CDialog289.h>
#include <CScriptsSelectionDialog.h>
#include "../FA2Expand.h"

class NOVTABLE CDialog289Ext : public CDialog289
class NOVTABLE CScriptsSelectionDialogExt : public CScriptsSelectionDialog
{
public:
typedef BOOL(*FuncT_PTM)(MSG* pMsg);

static CDialog289* Instance;
static CScriptsSelectionDialog* Instance;

//hook function to replace in virtual function map
BOOL PreTranslateMessageExt(MSG* pMsg);

static void ProgramStartupInit();

CDialog289Ext() {};
~CDialog289Ext() {};
CScriptsSelectionDialogExt() = delete;
~CScriptsSelectionDialogExt() {};

private:

Expand Down
81 changes: 81 additions & 0 deletions FA2sp/Ext/CTeamTypes/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,85 @@
#include "Body.h"

#include <Helpers/Macro.h>
#include <Miscs/Miscs.h>

#include <CMapData.h>
#include <CLoading.h>

#include "../../Helpers/STDHelpers.h"

#include "../../FA2sp.h"

DEFINE_HOOK(4E7900, CTeamTypes_OnCBCurrentTeamSelectChanged, 7)
{
GET(CTeamTypes*, pThis, ECX);
auto pINI = CMapData::Instance->UpdateCurrentDocument();

if (pThis->CCBTeamList.GetCurSel() >= 0)
{
ppmfc::CString ID = STDHelpers::GetComboBoxText(pThis->CCBTeamList);
STDHelpers::TrimIndex(ID);
if (pINI->SectionExists(ID))
{
pThis->BOOL_Aggressive = pINI->GetBool(ID, "Aggressive");
pThis->BOOL_Annoyance = pINI->GetBool(ID, "Annoyance");
pThis->BOOL_AreTeamMembersRecruitable = pINI->GetBool(ID, "AreTeamMembersRecruitable");
pThis->BOOL_Autocreate = pINI->GetBool(ID, "Autocreate");
pThis->BOOL_AvoidThreats = pINI->GetBool(ID, "AvoidThreats");
pThis->BOOL_CargoPlane = pINI->GetBool(ID, "CargoPlane");
pThis->BOOL_Full = pINI->GetBool(ID, "Full");
pThis->BOOL_GuardSlower = pINI->GetBool(ID, "GuardSlower");
pThis->BOOL_IonImmune = pINI->GetBool(ID, "IonImmune");
pThis->BOOL_IsBaseDefense = pINI->GetBool(ID, "IsBaseDefense");
pThis->BOOL_Loadable = pINI->GetBool(ID, "Loadable");
pThis->BOOL_LooseRecruit = pINI->GetBool(ID, "LooseRecruit");
pThis->BOOL_OnlyTargetHouseEnemy = pINI->GetBool(ID, "OnlyTargetHouseEnemy");
pThis->BOOL_OnTransOnly = pINI->GetBool(ID, "OnTransOnly");
pThis->BOOL_Prebuild = pINI->GetBool(ID, "Prebuild");
pThis->BOOL_Recruiter = pINI->GetBool(ID, "Recruiter");
pThis->BOOL_Reinforce = pINI->GetBool(ID, "Reinforce");
pThis->BOOL_Suicide = pINI->GetBool(ID, "Suicide");
pThis->BOOL_TransportsReturnOnUnload = pINI->GetBool(ID, "TransportsReturnOnUnload");
pThis->BOOL_Whiner = pINI->GetBool(ID, "Whiner");
pThis->CString_Group = pINI->GetString(ID, "Group");
pThis->CString_Max = pINI->GetString(ID, "Max");
pThis->CString_Name = pINI->GetString(ID, "Name");
pThis->CString_Priority = pINI->GetString(ID, "Priority");
pThis->CString_TechLevel = pINI->GetString(ID, "TechLevel");
Miscs::ParseHouseName(&pThis->CString_House, pINI->GetString(ID, "House"), true);

pThis->CString_VeteranLevel = pINI->GetString(ID, "VeteranLevel");
if (CLoading::HasMdFile)
pThis->CString_MindControlDecision = pINI->GetString(ID, "MindControlDecision");

pThis->CString_Waypoint.Format("%d", Waypoints::String_To_Waypoint(pINI->GetString(ID, "Waypoint")));
if (auto ppStr = pINI->TryGetString(ID, "TransportWaypoint"))
pThis->CString_TransportWaypoint.Format("%d", Waypoints::String_To_Waypoint(*ppStr));
else
pThis->CString_TransportWaypoint = "None";

auto GetNamedString = [&](ppmfc::CString& des, const char* KeyName, const char* SectionName)
{
des = pINI->GetString(ID, KeyName);
des += " (" + pINI->GetString(des, "Name") + ")";
};

GetNamedString(pThis->CString_Script, "Script", "ScriptTypes");
GetNamedString(pThis->CString_TaskForce, "TaskForce", "TaskForces");

if (auto ppStr = pINI->TryGetString(ID, "Tag"))
{
pThis->CString_Tag = *ppStr;
auto tagcontent = STDHelpers::SplitString(pINI->GetString("Tags", ID));
if (tagcontent.size() >= 2)
pThis->CString_Tag += " (" + tagcontent[1] + ")";
}
else
pThis->CString_Tag = "None";

pThis->UpdateData(FALSE);
}
}

return 0x4E9B11;
}
14 changes: 11 additions & 3 deletions FA2sp/Ext/CTileSetBrowserFrame/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DEFINE_HOOK(4F1A40, CTileSetBrowserFrame_CreateContent, 5)

RECT rect;
pThis->GetClientRect(&rect);
pThis->DialogBar.Create(pTab, MAKEINTRESOURCE(0xE3), 0x2800, 5);
pThis->DialogBar.Create(pTab, MAKEINTRESOURCE(ExtConfigs::VerticalLayout ? 0xE4 : 0xE3), 0x2800, 5);

Translations::TranslateItem(&pThis->DialogBar, 6102, "DialogBar.TileManager");
Translations::TranslateItem(&pThis->DialogBar, 1368, "DialogBar.TerrainOrGround");
Expand All @@ -44,8 +44,16 @@ DEFINE_HOOK(4F1B00, CTileSetBrowserFrame_RecalcLayout, 7)

::GetClientRect(CTileSetBrowserFrameExt::hTabCtrl, &tabRect);

pThis->DialogBar.MoveWindow(2, 29, tabRect.right - tabRect.left - 6, 110, FALSE);
pThis->View.MoveWindow(2, 139, tabRect.right - tabRect.left - 6, tabRect.bottom - 145, FALSE);
if (ExtConfigs::VerticalLayout)
{
pThis->DialogBar.MoveWindow(2, 29, tabRect.right - tabRect.left - 6, 110, FALSE);
pThis->View.MoveWindow(2, 139, tabRect.right - tabRect.left - 6, tabRect.bottom - 145, FALSE);
}
else
{
pThis->DialogBar.MoveWindow(2, 29, tabRect.right - tabRect.left - 6, 49, FALSE);
pThis->View.MoveWindow(2, 78, tabRect.right - tabRect.left - 6, tabRect.bottom - 54, FALSE);
}

SIZE sz{ tabRect.right,pThis->View.ScrollWidth };
pThis->View.SetScrollSizes(1, sz);
Expand Down
2 changes: 1 addition & 1 deletion FA2sp/Ext/FA2Expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "CCreateMap3B/Body.h"
#include "CCreateMap4/Body.h"
#include "CCredits/Body.h"
#include "CDialog289/Body.h"
#include "CScriptsSelectionDialog/Body.h"
#include "CEasterEgg/Body.h"
#include "CHouses/Body.h"
#include "CINIEditor/Body.h"
Expand Down
10 changes: 5 additions & 5 deletions FA2sp/FA2sp.Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#define PRODUCT_MAJOR 1
#define PRODUCT_MINOR 4
#define PRODUCT_REVISION 0
#define PRODUCT_HOTFIX 1
#define PRODUCT_REVISION 1
#define PRODUCT_HOTFIX 0

#define PRODUCT_STR __str(PRODUCT_MAJOR) "." __str(PRODUCT_MINOR) "." __str(PRODUCT_REVISION) "." __str(PRODUCT_HOTFIX)
#define DISPLAY_STR PRODUCT_STR
Expand All @@ -19,6 +19,6 @@

#define APPLY_INFO "Found Final Alert 2 version 1.02. Applying " VERSION_STRVER

constexpr char* MUTEX_HASH_VAL = "b8097bca8590a4f46c975ebb43503aab2243ce7f1c87f12f7984dbe1";
constexpr char* MUTEX_INIT_ERROR_MSG = "The program has already launched! Some function may work not correctly. Do you still want to launch it?";
constexpr char* MUTEX_INIT_ERROR_TIT = "FA2sp Init Checker";
#define MUTEX_HASH_VAL "b8097bca8590a4f46c975ebb43503aab2243ce7f1c87f12f7984dbe1"
#define MUTEX_INIT_ERROR_MSG "The program has already launched! Some function may work not correctly. Do you still want to launch it?"
#define MUTEX_INIT_ERROR_TIT "FA2sp Init Checker"
Loading

0 comments on commit 953a008

Please sign in to comment.