code reformatted .

This commit is contained in:
Zero Fanker 2024-04-16 20:51:17 -04:00
parent 76d336504f
commit 1de6ad56c2
265 changed files with 18240 additions and 21591 deletions

View file

@ -1,21 +1,21 @@
/*
FinalSun/FinalAlert 2 Mission Editor
FinalSun/FinalAlert 2 Mission Editor
Copyright (C) 1999-2024 Electronic Arts, Inc.
Authored by Matthias Wagner
Copyright (C) 1999-2024 Electronic Arts, Inc.
Authored by Matthias Wagner
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*************************************
@ -41,7 +41,7 @@ CIniFile art;
CIniFile ai;
CIniFile sound;
CIniFile tutorial;
CIniFile eva;
CIniFile eva;
CIniFile theme;
CIniFile g_data; // FAData.ini
CIniFile language;
@ -51,7 +51,7 @@ CIniFile tiles_u; // urban.ini ...
CIniFile tiles_un; // new urbannmd.ini
CIniFile tiles_l; // lunarmd.ini
CIniFile tiles_d; // desertmd.ini
CIniFile* tiles=NULL; // this should be used by every class/function except CMapData::UpdateIniFile();
CIniFile* tiles = NULL; // this should be used by every class/function except CMapData::UpdateIniFile();
/*************/
/* the mapdata! */
@ -62,24 +62,24 @@ ACTIONDATA AD;
/* A map with all the pictures in the pics directory, and some special pics */
map<CString, PICDATA> pics;
TILEDATA* t_tiledata=NULL;
DWORD t_tiledata_count=0;
TILEDATA* s_tiledata=NULL;
DWORD s_tiledata_count=0;
TILEDATA* u_tiledata=NULL;
DWORD u_tiledata_count=0;
TILEDATA* t_tiledata = NULL;
DWORD t_tiledata_count = 0;
TILEDATA* s_tiledata = NULL;
DWORD s_tiledata_count = 0;
TILEDATA* u_tiledata = NULL;
DWORD u_tiledata_count = 0;
// MW new tilesets
TILEDATA* un_tiledata=NULL;
DWORD un_tiledata_count=0;
TILEDATA* l_tiledata=NULL;
DWORD l_tiledata_count=0;
TILEDATA* d_tiledata=NULL;
DWORD d_tiledata_count=0;
TILEDATA* un_tiledata = NULL;
DWORD un_tiledata_count = 0;
TILEDATA* l_tiledata = NULL;
DWORD l_tiledata_count = 0;
TILEDATA* d_tiledata = NULL;
DWORD d_tiledata_count = 0;
TILEDATA** tiledata=NULL;
TILEDATA** tiledata = NULL;
DWORD* tiledata_count=NULL;
DWORD* tiledata_count = NULL;
map<int, int> tilesets_start;
@ -110,58 +110,58 @@ vector<CString> rndterrainsrc;
/* Overlay tile data */
#ifndef RA2_MODE
int overlay_number[]={0x0,0x2, 0x1a, 0x7e, 0xa7, 0x27};
CString overlay_name[]={"Sandbags","GDI Wall", "Nod Wall", "Veins", "Veinhole monster", "Tracks"};
BOOL overlay_visible[]={TRUE,TRUE,TRUE,FALSE,FALSE, TRUE};
BOOL overlay_trail[]={TRUE,TRUE,TRUE,FALSE,FALSE, TRUE};
BOOL overlay_trdebug[]={FALSE,FALSE,FALSE,FALSE,FALSE, FALSE};
BOOL yr_only[]={FALSE, FALSE, FALSE, FALSE, FALSE, FALSE};
int overlay_count=6;
int overlay_number[] = { 0x0,0x2, 0x1a, 0x7e, 0xa7, 0x27 };
CString overlay_name[] = { "Sandbags","GDI Wall", "Nod Wall", "Veins", "Veinhole monster", "Tracks" };
BOOL overlay_visible[] = { TRUE,TRUE,TRUE,FALSE,FALSE, TRUE };
BOOL overlay_trail[] = { TRUE,TRUE,TRUE,FALSE,FALSE, TRUE };
BOOL overlay_trdebug[] = { FALSE,FALSE,FALSE,FALSE,FALSE, FALSE };
BOOL yr_only[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE };
int overlay_count = 6;
const std::string editor_name = "FinalSun";
#else
int overlay_number[]={0x0,0x2, 0x1a, 0xcb, 0xf1, 0xcc,0xf3,0xf0, 0x27};
BOOL overlay_trdebug[]={FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE};
CString overlay_name[]={"Sandbags","Allied Wall", "Soviet Wall", "Black fence", "Prison camp fence", "White fence", "Yuri Wall", "Kremlin Wall", "Tracks"};
BOOL overlay_visible[]={TRUE,TRUE,TRUE,TRUE,TRUE,TRUE, TRUE, TRUE, TRUE};
BOOL overlay_trail[]={TRUE,TRUE,TRUE,TRUE,TRUE,TRUE, TRUE, TRUE, TRUE};
BOOL yr_only[]={FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE};
int overlay_count=9;
int overlay_number[] = { 0x0,0x2, 0x1a, 0xcb, 0xf1, 0xcc,0xf3,0xf0, 0x27 };
BOOL overlay_trdebug[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE };
CString overlay_name[] = { "Sandbags","Allied Wall", "Soviet Wall", "Black fence", "Prison camp fence", "White fence", "Yuri Wall", "Kremlin Wall", "Tracks" };
BOOL overlay_visible[] = { TRUE,TRUE,TRUE,TRUE,TRUE,TRUE, TRUE, TRUE, TRUE };
BOOL overlay_trail[] = { TRUE,TRUE,TRUE,TRUE,TRUE,TRUE, TRUE, TRUE, TRUE };
BOOL yr_only[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE };
int overlay_count = 9;
const std::string editor_name = "FinalAlert 2";
#endif
static const std::string GetAppDataPath()
{
_setmbcp(CP_UTF8);
setlocale(LC_ALL, "C");
if (!setlocale(LC_CTYPE, ".65001"))
setlocale(LC_CTYPE, "");
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CComPtr<IKnownFolderManager> manager;
CComPtr<IKnownFolder> local_app_data;
CComHeapPtr<WCHAR> local_app_data_folder;
HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&manager));
if (SUCCEEDED(hr)) {
//std::shared_ptr<LPWSTR> x()
if (SUCCEEDED(manager->GetFolder(FOLDERID_LocalAppData, &local_app_data))) {
LPWSTR b;
local_app_data->GetPath(KF_FLAG_CREATE, &b);
local_app_data_folder.Attach(b);
int a = 0;
std::string AppFolder = utf16ToUtf8(std::wstring(local_app_data_folder));
//return CString(CW2A(CStringW(local_app_data_folder), CP_ACP)) + "\\" + editor_name + "\\";
return AppFolder + "\\" + editor_name + "\\";
}
}
_setmbcp(CP_UTF8);
setlocale(LC_ALL, "C");
if (!setlocale(LC_CTYPE, ".65001"))
setlocale(LC_CTYPE, "");
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CComPtr<IKnownFolderManager> manager;
CComPtr<IKnownFolder> local_app_data;
CComHeapPtr<WCHAR> local_app_data_folder;
HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&manager));
if (SUCCEEDED(hr)) {
//std::shared_ptr<LPWSTR> x()
// fallback: use app directory
wchar_t app_path[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, app_path, MAX_PATH);
std::wstring appPath = app_path;
std::size_t end = appPath.rfind(L'\\');
if (end != std::wstring::npos)
appPath.resize(end + 1);
return utf16ToUtf8(appPath);
if (SUCCEEDED(manager->GetFolder(FOLDERID_LocalAppData, &local_app_data))) {
LPWSTR b;
local_app_data->GetPath(KF_FLAG_CREATE, &b);
local_app_data_folder.Attach(b);
int a = 0;
std::string AppFolder = utf16ToUtf8(std::wstring(local_app_data_folder));
//return CString(CW2A(CStringW(local_app_data_folder), CP_ACP)) + "\\" + editor_name + "\\";
return AppFolder + "\\" + editor_name + "\\";
}
}
// fallback: use app directory
wchar_t app_path[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, app_path, MAX_PATH);
std::wstring appPath = app_path;
std::size_t end = appPath.rfind(L'\\');
if (end != std::wstring::npos)
appPath.resize(end + 1);
return utf16ToUtf8(appPath);
}
/* Application specific global variables */
@ -170,8 +170,8 @@ const std::string u8AppDataPath = GetAppDataPath();
const std::wstring u16AppDataPath = utf8ToUtf16(u8AppDataPath);
char TSPath[MAX_PATH + 1] = { 0 };
char currentMapFile[MAX_PATH + 1] = { 0 };
BOOL bOptionsStartup=FALSE;
bool bAllowAccessBehindCliffs=false;
BOOL bOptionsStartup = FALSE;
bool bAllowAccessBehindCliffs = false;
// infos for buildings and trees (should be extended to infantry, units, and aircraft)
@ -188,7 +188,7 @@ ofstream errstream;
/* the finalsun app object */
CFinalSunApp theApp;
CString currentOwner="Neutral";
CString currentOwner = "Neutral";
TranslationMap CCStrings;
TranslationMap AllStrings;
@ -215,16 +215,16 @@ int cliff2set_start;
int cliffwater2set;
// debug information
int last_succeeded_operation=0;
int last_succeeded_operation = 0;
#ifdef RA2_MODE
int editor_mode=1;
int editor_mode = 1;
#ifdef YR_MODE
int yuri_mode=1;
int yuri_mode = 1;
#else
int yuri_mode=0;
int yuri_mode = 0;
#endif
#else
int editor_mode=0;
int yuri_mode=0;
int editor_mode = 0;
int yuri_mode = 0;
#endif