mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-17 19:56:38 -04:00
code reformatted .
This commit is contained in:
parent
76d336504f
commit
1de6ad56c2
265 changed files with 18240 additions and 21591 deletions
|
@ -84,16 +84,14 @@ CFinalSunApp::CFinalSunApp()
|
|||
// Initialize AppData
|
||||
const std::wstring AppDataPathFolder = utf8ToUtf16(u8AppDataPath.substr(0, u8AppDataPath.size() - 1));
|
||||
auto create_dir_res = SHCreateDirectoryExW(NULL, AppDataPathFolder.c_str(), nullptr);
|
||||
if (ERROR_SUCCESS != create_dir_res && ERROR_ALREADY_EXISTS != create_dir_res)
|
||||
{
|
||||
if (ERROR_SUCCESS != create_dir_res && ERROR_ALREADY_EXISTS != create_dir_res) {
|
||||
wchar_t err_msg[1025] = { 0 };
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, create_dir_res, 0, err_msg, 1024, NULL);
|
||||
MessageBoxW(NULL, err_msg, (std::wstring(L"Failed to open ") + AppDataPathFolder).c_str(), 0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((GetFileAttributesW(AppDataPathFolder.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
if ((GetFileAttributesW(AppDataPathFolder.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
|
||||
MessageBoxW(NULL, (AppDataPathFolder + L" must be a directory, not a file").c_str(), (std::wstring(L"Failed to open ") + AppDataPathFolder).c_str(), 0);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -133,8 +131,7 @@ CFinalSunApp::CFinalSunApp()
|
|||
INITCOMMONCONTROLSEX ctr;
|
||||
ctr.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
ctr.dwICC = ICC_STANDARD_CLASSES;
|
||||
if (!InitCommonControlsEx(&ctr))
|
||||
{
|
||||
if (!InitCommonControlsEx(&ctr)) {
|
||||
errstream << "Error: Common controls could not be initialized" << std::endl;
|
||||
MessageBox(0, "Common controls could not be initialized.", "Error", 0);
|
||||
}
|
||||
|
@ -154,14 +151,12 @@ BOOL CFinalSunApp::InitInstance()
|
|||
m_hAccel = LoadAccelerators(this->m_hInstance, MAKEINTRESOURCE(IDR_MAIN));
|
||||
|
||||
#ifndef NOSURFACES
|
||||
if (GetDeviceCaps(GetDC(GetDesktopWindow()), BITSPIXEL) <= 8)
|
||||
{
|
||||
if (GetDeviceCaps(GetDC(GetDesktopWindow()), BITSPIXEL) <= 8) {
|
||||
MessageBox(0, "You currently only have 8 bit color mode enabled. This is not recommended. You can continue, but this will cause a significant slowdown while loading graphics, and result in poor graphics quality", "Error", 0);
|
||||
//exit(0);
|
||||
}
|
||||
#else
|
||||
if (GetDeviceCaps(GetDC(GetDesktopWindow()), BITSPIXEL) <= 8)
|
||||
{
|
||||
if (GetDeviceCaps(GetDC(GetDesktopWindow()), BITSPIXEL) <= 8) {
|
||||
MessageBox(0, "You currently only have 8 bit color mode enabled. FinalSun/FinalAlert 2 will not work in 8 bit color mode. See readme.txt for further information!", "Error", 0);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -207,8 +202,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
std::string templateIniFile = std::string(AppPath) + defaultIniName;
|
||||
|
||||
bool copiedDefaultFile = false;
|
||||
if (!DoesFileExist(iniFile.c_str()))
|
||||
{
|
||||
if (!DoesFileExist(iniFile.c_str())) {
|
||||
if (CopyFileW(utf8ToUtf16(templateIniFile).c_str(), utf8ToUtf16(iniFile).c_str(), TRUE))
|
||||
copiedDefaultFile = true;
|
||||
}
|
||||
|
@ -236,6 +230,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
auto getPathFromRegistry = false;
|
||||
auto getPathFromIni = true;
|
||||
|
||||
#if 0
|
||||
if (getPathFromRegistry) {
|
||||
do {
|
||||
int res;
|
||||
|
@ -260,10 +255,11 @@ BOOL CFinalSunApp::InitInstance()
|
|||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, res, 0, c, 1023, NULL);
|
||||
MessageBoxW(0, (s + c).c_str(), L"Error", 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
opts.TSExe = path;
|
||||
} while (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (getPathFromIni) {
|
||||
opts.TSExe = optini.GetString(game, "Exe");
|
||||
|
@ -273,7 +269,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
if (copiedDefaultFile ||
|
||||
optini.Size() == 0 ||
|
||||
opts.TSExe.IsEmpty() ||
|
||||
appSec.GetString( "Language").IsEmpty() ||
|
||||
appSec.GetString("Language").IsEmpty() ||
|
||||
!appSec.GetBool("FileSearchLikeGame") ||
|
||||
!appSec.GetBool("PreferLocalTheaterFiles")) {
|
||||
opts.bSearchLikeTS = TRUE;
|
||||
|
@ -286,8 +282,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
opts.LanguageName = appSec.GetString("Language");
|
||||
if (appSec.GetBool("FileSearchLikeGame")) {
|
||||
opts.bSearchLikeTS = TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
opts.bSearchLikeTS = FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +324,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
|
||||
// MW 07/20/01: Load file list
|
||||
int i;
|
||||
for (i = 0;i < 4;i++) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
opts.prev_maps[i] = optini.GetString("Files", c);
|
||||
|
@ -389,8 +384,7 @@ void CFinalSunApp::ParseCommandLine()
|
|||
char data[MAX_PATH + 30];
|
||||
|
||||
strcpy(data, theApp.m_lpCmdLine);
|
||||
if (strlen(data) == 0)
|
||||
{
|
||||
if (strlen(data) == 0) {
|
||||
strcpy(currentMapFile, "");
|
||||
return;
|
||||
}
|
||||
|
@ -423,8 +417,7 @@ int CFinalSunApp::Run()
|
|||
|
||||
BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
||||
{
|
||||
if (lpMsg->message == WM_KEYDOWN)
|
||||
{
|
||||
if (lpMsg->message == WM_KEYDOWN) {
|
||||
/*if(lpMsg->wParam==VK_F1)
|
||||
{
|
||||
if(ShellExecute(0, NULL, (CString)AppPath+"/help/index.htm", NULL, NULL, SW_NORMAL)==0)
|
||||
|
@ -436,19 +429,15 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
|
||||
// check AD mode
|
||||
|
||||
if (lpMsg->wParam == VK_PRIOR || lpMsg->wParam == VK_NEXT)
|
||||
{
|
||||
if (lpMsg->wParam == VK_PRIOR)
|
||||
{
|
||||
if (lpMsg->wParam == VK_PRIOR || lpMsg->wParam == VK_NEXT) {
|
||||
if (lpMsg->wParam == VK_PRIOR) {
|
||||
AD.z_data += 1;
|
||||
}
|
||||
if (lpMsg->wParam == VK_NEXT)
|
||||
{
|
||||
if (lpMsg->wParam == VK_NEXT) {
|
||||
AD.z_data -= 1;
|
||||
}
|
||||
|
||||
if (AD.mode == ACTIONMODE_SETTILE || AD.mode == ACTIONMODE_PASTE)
|
||||
{
|
||||
if (AD.mode == ACTIONMODE_SETTILE || AD.mode == ACTIONMODE_PASTE) {
|
||||
CIsoView* v = ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview;
|
||||
CTerrainDlg& tdlg = ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_browser->m_bar;
|
||||
WORD isox, isoy;
|
||||
|
@ -459,12 +448,9 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
isox = p.x - r.left;
|
||||
isoy = p.y - r.top;
|
||||
|
||||
if (isox > r.right - r.left || isoy > r.bottom - r.top)
|
||||
{
|
||||
if (isox > r.right - r.left || isoy > r.bottom - r.top) {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LPARAM lParam;
|
||||
memcpy(&lParam, &isox, 2);
|
||||
memcpy((BYTE*)&lParam + 2, &isoy, 2);
|
||||
|
@ -478,8 +464,7 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
|
||||
|
||||
|
||||
if (AD.mode == ACTIONMODE_SETTILE)
|
||||
{
|
||||
if (AD.mode == ACTIONMODE_SETTILE) {
|
||||
CIsoView* v = ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview;
|
||||
CTerrainDlg& tdlg = ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_browser->m_bar;
|
||||
WORD isox, isoy;
|
||||
|
@ -489,20 +474,16 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
GetCursorPos(&p);
|
||||
isox = p.x - r.left;
|
||||
isoy = p.y - r.top;
|
||||
if (isox > r.right - r.left || isoy > r.bottom - r.top)
|
||||
{
|
||||
if (isox > r.right - r.left || isoy > r.bottom - r.top) {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LPARAM lParam;
|
||||
memcpy(&lParam, &isox, 2);
|
||||
memcpy((BYTE*)&lParam + 2, &isoy, 2);
|
||||
|
||||
int searchedTileSet;
|
||||
int z;
|
||||
switch (lpMsg->wParam)
|
||||
{
|
||||
switch (lpMsg->wParam) {
|
||||
|
||||
case VK_LEFT:
|
||||
if (AD.type > 0 && (*tiledata)[AD.type].wTileSet == (*tiledata)[AD.type - 1].wTileSet) { AD.type -= 1; AD.z_data = 0; }
|
||||
|
@ -520,15 +501,13 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
if (lpMsg->wParam == VK_DOWN)
|
||||
searchedTileSet = (*tiledata)[AD.type].wTileSet + 1;
|
||||
|
||||
if (searchedTileSet >= 0 && searchedTileSet < tilesets_start.size())
|
||||
{
|
||||
if (searchedTileSet >= 0 && searchedTileSet < tilesets_start.size()) {
|
||||
int i;
|
||||
int s = 1;
|
||||
int start = 0;
|
||||
int count = tilesets_start.size() - searchedTileSet;
|
||||
|
||||
if (searchedTileSet < (*tiledata)[AD.type].wTileSet)
|
||||
{
|
||||
if (searchedTileSet < (*tiledata)[AD.type].wTileSet) {
|
||||
s = -1;
|
||||
start = 0;
|
||||
count = searchedTileSet + 1;
|
||||
|
@ -537,8 +516,7 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
|
||||
|
||||
|
||||
for (i = start;i < count;i += 1)
|
||||
{
|
||||
for (i = start; i < count; i += 1) {
|
||||
if (searchedTileSet + i * s < 0 || searchedTileSet + i * s >= tilesets_start.size()) continue;
|
||||
|
||||
int pos = tilesets_start[searchedTileSet + i * s];
|
||||
|
@ -549,18 +527,15 @@ BOOL CFinalSunApp::ProcessMessageFilter(int code, LPMSG lpMsg)
|
|||
int e;
|
||||
CComboBox* cb = ((CComboBox*)tdlg.GetDlgItem(IDC_TILESET));
|
||||
BOOL bFound = FALSE;
|
||||
for (e = 0;e < cb->GetCount();e++)
|
||||
{
|
||||
if (cb->GetItemData(e) == searchedTileSet + i * s)
|
||||
{
|
||||
for (e = 0; e < cb->GetCount(); e++) {
|
||||
if (cb->GetItemData(e) == searchedTileSet + i * s) {
|
||||
cb->SendMessage(CB_SETCURSEL, e, 0);
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFound)
|
||||
{
|
||||
if (bFound) {
|
||||
AD.type = tilesets_start[searchedTileSet + i * s];
|
||||
AD.data = 0;
|
||||
AD.data2 = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue