diff --git a/3rdParty/xcc/Library/StdAfx.cpp b/3rdParty/xcc/Library/StdAfx.cpp index 799dfed..ac69bbf 100644 --- a/3rdParty/xcc/Library/StdAfx.cpp +++ b/3rdParty/xcc/Library/StdAfx.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" diff --git a/3rdParty/xcc/Library/StdAfx.h b/3rdParty/xcc/Library/StdAfx.h index 45cdcb9..27f43d5 100644 --- a/3rdParty/xcc/Library/StdAfx.h +++ b/3rdParty/xcc/Library/StdAfx.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/blowfish.cpp b/3rdParty/xcc/misc/blowfish.cpp index 37f75e5..e88e588 100644 --- a/3rdParty/xcc/misc/blowfish.cpp +++ b/3rdParty/xcc/misc/blowfish.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -21,7 +21,7 @@ #include -const Cblowfish::t_bf_p g_p = +const Cblowfish::t_bf_p g_p = { 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, @@ -30,7 +30,7 @@ const Cblowfish::t_bf_p g_p = 0x9216d5d9, 0x8979fb1b, }; -const Cblowfish::t_bf_s g_s = +const Cblowfish::t_bf_s g_s = { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, @@ -296,8 +296,7 @@ void Cblowfish::set_key(data_ref key) memcpy(m_s, g_s, sizeof(t_bf_s)); int j = 0; - for (int i = 0; i < 18; i++) - { + for (int i = 0; i < 18; i++) { int a = key[j++]; j %= key.size(); int b = key[j++]; j %= key.size(); int c = key[j++]; j %= key.size(); @@ -308,18 +307,15 @@ void Cblowfish::set_key(data_ref key) uint32_t datal = 0; uint32_t datar = 0; - for (int i = 0; i < 18; ) - { + for (int i = 0; i < 18; ) { encipher(datal, datar); m_p[i++] = datal; m_p[i++] = datar; } - for (int i = 0; i < 4; i++) - { - for (int j = 0; j < 256; ) - { + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 256; ) { encipher(datal, datar); m_s[i][j++] = datal; @@ -349,14 +345,14 @@ void Cblowfish::encipher(uint32_t& xl, uint32_t& xr) const uint32_t Xr = xr; Xl ^= m_p[0]; - ROUND (Xr, Xl, 1); ROUND (Xl, Xr, 2); - ROUND (Xr, Xl, 3); ROUND (Xl, Xr, 4); - ROUND (Xr, Xl, 5); ROUND (Xl, Xr, 6); - ROUND (Xr, Xl, 7); ROUND (Xl, Xr, 8); - ROUND (Xr, Xl, 9); ROUND (Xl, Xr, 10); - ROUND (Xr, Xl, 11); ROUND (Xl, Xr, 12); - ROUND (Xr, Xl, 13); ROUND (Xl, Xr, 14); - ROUND (Xr, Xl, 15); ROUND (Xl, Xr, 16); + ROUND(Xr, Xl, 1); ROUND(Xl, Xr, 2); + ROUND(Xr, Xl, 3); ROUND(Xl, Xr, 4); + ROUND(Xr, Xl, 5); ROUND(Xl, Xr, 6); + ROUND(Xr, Xl, 7); ROUND(Xl, Xr, 8); + ROUND(Xr, Xl, 9); ROUND(Xl, Xr, 10); + ROUND(Xr, Xl, 11); ROUND(Xl, Xr, 12); + ROUND(Xr, Xl, 13); ROUND(Xl, Xr, 14); + ROUND(Xr, Xl, 15); ROUND(Xl, Xr, 16); Xr ^= m_p[17]; xr = Xl; @@ -369,14 +365,14 @@ void Cblowfish::decipher(uint32_t& xl, uint32_t& xr) const uint32_t Xr = xr; Xl ^= m_p[17]; - ROUND (Xr, Xl, 16); ROUND (Xl, Xr, 15); - ROUND (Xr, Xl, 14); ROUND (Xl, Xr, 13); - ROUND (Xr, Xl, 12); ROUND (Xl, Xr, 11); - ROUND (Xr, Xl, 10); ROUND (Xl, Xr, 9); - ROUND (Xr, Xl, 8); ROUND (Xl, Xr, 7); - ROUND (Xr, Xl, 6); ROUND (Xl, Xr, 5); - ROUND (Xr, Xl, 4); ROUND (Xl, Xr, 3); - ROUND (Xr, Xl, 2); ROUND (Xl, Xr, 1); + ROUND(Xr, Xl, 16); ROUND(Xl, Xr, 15); + ROUND(Xr, Xl, 14); ROUND(Xl, Xr, 13); + ROUND(Xr, Xl, 12); ROUND(Xl, Xr, 11); + ROUND(Xr, Xl, 10); ROUND(Xl, Xr, 9); + ROUND(Xr, Xl, 8); ROUND(Xl, Xr, 7); + ROUND(Xr, Xl, 6); ROUND(Xl, Xr, 5); + ROUND(Xr, Xl, 4); ROUND(Xl, Xr, 3); + ROUND(Xr, Xl, 2); ROUND(Xl, Xr, 1); Xr ^= m_p[0]; xl = Xr; @@ -395,8 +391,7 @@ void Cblowfish::encipher(const void* s, void* d, int size) const const uint32_t* r = reinterpret_cast(s); uint32_t* w = reinterpret_cast(d); size >>= 3; - while (size--) - { + while (size--) { uint32_t a = reverse(*r++); uint32_t b = reverse(*r++); encipher(a, b); @@ -410,8 +405,7 @@ void Cblowfish::decipher(const void* s, void* d, int size) const const uint32_t* r = reinterpret_cast(s); uint32_t* w = reinterpret_cast(d); size >>= 3; - while (size--) - { + while (size--) { uint32_t a = reverse(*r++); uint32_t b = reverse(*r++); decipher(a, b); diff --git a/3rdParty/xcc/misc/blowfish.h b/3rdParty/xcc/misc/blowfish.h index 62aab66..137849c 100644 --- a/3rdParty/xcc/misc/blowfish.h +++ b/3rdParty/xcc/misc/blowfish.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/cc_file.cpp b/3rdParty/xcc/misc/cc_file.cpp index d9e9e11..cb20d31 100644 --- a/3rdParty/xcc/misc/cc_file.cpp +++ b/3rdParty/xcc/misc/cc_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -161,360 +161,347 @@ Ccc_file::Ccc_file(bool read_on_open) : #define test_fail(res) { int v = res; if (v) { close(); return v; }} #ifndef NO_MIX_SUPPORT - int Ccc_file::open(unsigned int id, Cmix_file& mix_f) - { - if (mix_f.get_index(id) == -1) - return -1; - m_f = mix_f.m_f; - m_offset = mix_f.m_offset + mix_f.get_offset(id); - m_size = mix_f.get_size(id); - m_p = 0; - m_is_open = true; - if (m_read_on_open || mix_f.data()) - m_data = mix_f.get_vdata(id); - test_fail(post_open()) - return 0; - } +int Ccc_file::open(unsigned int id, Cmix_file& mix_f) +{ + if (mix_f.get_index(id) == -1) + return -1; + m_f = mix_f.m_f; + m_offset = mix_f.m_offset + mix_f.get_offset(id); + m_size = mix_f.get_size(id); + m_p = 0; + m_is_open = true; + if (m_read_on_open || mix_f.data()) + m_data = mix_f.get_vdata(id); + test_fail(post_open()) + return 0; +} - int Ccc_file::open(const string& name, Cmix_file& mix_f) - { - return open(Cmix_file::get_id(mix_f.get_game(), name), mix_f); - } +int Ccc_file::open(const string& name, Cmix_file& mix_f) +{ + return open(Cmix_file::get_id(mix_f.get_game(), name), mix_f); +} #endif - int Ccc_file::open(const string& name) - { - close(); - assert(!is_open()); +int Ccc_file::open(const string& name) +{ + close(); + assert(!is_open()); #ifdef NO_MIX_SUPPORT - test_fail(m_f.open_read(name)); + test_fail(m_f.open_read(name)); #else - test_fail(m_f.open_read(xcc_dirs::find_file(name))); + test_fail(m_f.open_read(xcc_dirs::find_file(name))); #endif - m_offset = 0; - m_size = m_f.size(); - m_p = 0; - m_is_open = true; - m_data = m_f.get_mm(); - if (m_read_on_open) - m_f.close(); -#ifndef NO_FT_SUPPORT - Cfname fname = to_lower_copy(name); - if (fname.get_fext() == ".mmx") - { - fname.set_ext(".map"); - mix_database::add_name(game_ra2, fname.get_fname(), "-"); - fname.set_ext(".pkt"); - mix_database::add_name(game_ra2, fname.get_fname(), "-"); - } -#endif - test_fail(post_open()) - return 0; - } - - const Cwin_handle& Ccc_file::h() - { - assert(is_open()); - return m_f.h(); - } - - int Ccc_file::open(const Cwin_handle& h) - { - assert(!is_open()); - m_f.open(h); - m_offset = 0; - m_size = m_f.size(); - m_p = 0; - m_is_open = true; - m_data = m_f.get_mm(); - if (m_read_on_open) - m_f.close(); - test_fail(post_open()) - return 0; - } - - void Ccc_file::load(const Cvirtual_binary& d, int size) - { - m_data = d; - m_offset = 0; - m_is_open = true; - m_p = 0; - m_size = size == -1 ? d.size() : size; - post_open(); - } - - void Ccc_file::load(const Ccc_file& f) - { - load(f.vdata()); - } - - int Ccc_file::read() - { - seek(0); - Cvirtual_binary d; - if (int error = read(d.write_start(get_size()), get_size())) - return error; - m_data = d; - return 0; - } - - int Ccc_file::read(void* data, int size) - { - if (get_p() < 0 || get_p() + size > get_size()) - return 1; - if (get_data()) - { - memcpy(data, m_data.data() + m_p, size); - skip(size); - return 0; - } - assert(is_open()); - m_f.seek(m_offset + m_p); - int res = m_f.read(data, size); - if (!res) - skip(size); - return res; - } - - int Ccc_file::extract(const string& name) - { - assert(is_open()); - if (data()) - return vdata().save(name); - seek(0); - Cfile32 f; - if (int error = f.open_write(name)) - return error; - Cvirtual_binary data; - for (int size = get_size(); size; ) - { - int cb_write = min(size, 1 << 20); - if (int error = read(data.write_start(cb_write), cb_write)) - return error; - if (int error = f.write(data.data(), cb_write)) - return error; - size -= cb_write; - } - return 0; - } - - void Ccc_file::close() - { - m_data.clear(); + m_offset = 0; + m_size = m_f.size(); + m_p = 0; + m_is_open = true; + m_data = m_f.get_mm(); + if (m_read_on_open) m_f.close(); - m_is_open = false; +#ifndef NO_FT_SUPPORT + Cfname fname = to_lower_copy(name); + if (fname.get_fext() == ".mmx") { + fname.set_ext(".map"); + mix_database::add_name(game_ra2, fname.get_fname(), "-"); + fname.set_ext(".pkt"); + mix_database::add_name(game_ra2, fname.get_fname(), "-"); } +#endif + test_fail(post_open()) + return 0; +} + +const Cwin_handle& Ccc_file::h() +{ + assert(is_open()); + return m_f.h(); +} + +int Ccc_file::open(const Cwin_handle& h) +{ + assert(!is_open()); + m_f.open(h); + m_offset = 0; + m_size = m_f.size(); + m_p = 0; + m_is_open = true; + m_data = m_f.get_mm(); + if (m_read_on_open) + m_f.close(); + test_fail(post_open()) + return 0; +} + +void Ccc_file::load(const Cvirtual_binary& d, int size) +{ + m_data = d; + m_offset = 0; + m_is_open = true; + m_p = 0; + m_size = size == -1 ? d.size() : size; + post_open(); +} + +void Ccc_file::load(const Ccc_file& f) +{ + load(f.vdata()); +} + +int Ccc_file::read() +{ + seek(0); + Cvirtual_binary d; + if (int error = read(d.write_start(get_size()), get_size())) + return error; + m_data = d; + return 0; +} + +int Ccc_file::read(void* data, int size) +{ + if (get_p() < 0 || get_p() + size > get_size()) + return 1; + if (get_data()) { + memcpy(data, m_data.data() + m_p, size); + skip(size); + return 0; + } + assert(is_open()); + m_f.seek(m_offset + m_p); + int res = m_f.read(data, size); + if (!res) + skip(size); + return res; +} + +int Ccc_file::extract(const string& name) +{ + assert(is_open()); + if (data()) + return vdata().save(name); + seek(0); + Cfile32 f; + if (int error = f.open_write(name)) + return error; + Cvirtual_binary data; + for (int size = get_size(); size; ) { + int cb_write = min(size, 1 << 20); + if (int error = read(data.write_start(cb_write), cb_write)) + return error; + if (int error = f.write(data.data(), cb_write)) + return error; + size -= cb_write; + } + return 0; +} + +void Ccc_file::close() +{ + m_data.clear(); + m_f.close(); + m_is_open = false; +} #ifndef NO_MIX_SUPPORT #ifndef NO_FT_SUPPORT - t_file_type Ccc_file::get_file_type(bool fast) - { - Cvirtual_binary data; - int size; - if (m_data.data()) - { - data = m_data; - size = m_size; - } - else - { - size = min(m_size, 64 << 10); - seek(0); - if (read(data.write_start(size), size)) - return ft_unknown; - seek(0); - } - Caud_file aud_f; - Cbin_file bin_f; - Cbink_file bink_f; - Cbig_file big_f; - Cbmp_file bmp_f; - Ccsf_file csf_f; - Ccps_file cps_f; - Cdds_file dds_f; - Cfnt_file fnt_f; - Chva_file hva_f; - Cmix_file mix_f; - Cmix_rg_file mix_rg_f; - Cmp3_file mp3_f; - Cjpeg_file jpeg_f; - Cogg_file ogg_f; - Cpak_file pak_f; - Cpal_file pal_f; - Cpcx_file pcx_f; - Cpng_file png_f; - Criff_file riff_f; - Cshp_dune2_file shp_dune2_f; - Cshp_file shp_f; - Cshp_ts_file shp_ts_f; - Cst_file st_f; - Ctext_file text_f; - Ctga_file tga_f; - Ctmp_file tmp_f; - Ctmp_ra_file tmp_ra_f; - Ctmp_ts_file tmp_ts_f; - Cvoc_file voc_f; - Cvqa_file vqa_f; - Cvqp_file vqp_f; - Cvxl_file vxl_f; - Cw3d_file w3d_f; - Cwsa_dune2_file wsa_dune2_f; - Cwsa_file wsa_f; - Cxcc_file xcc_f; - Cxif_file xif_f; - if (aud_f.load(data, m_size), aud_f.is_valid()) - return ft_aud; - if (big_f.load(data, m_size), big_f.is_valid()) - return ft_big; - if (bin_f.load(data, m_size), bin_f.is_valid()) - return ft_bin; - if (bink_f.load(data, m_size), bink_f.is_valid()) - return ft_bink; - if (bmp_f.load(data, m_size), bmp_f.is_valid()) - return ft_bmp; - if (csf_f.load(data, m_size), csf_f.is_valid()) - return ft_csf; - if (cps_f.load(data, m_size), cps_f.is_valid()) - return ft_cps; - if (dds_f.load(data, m_size), dds_f.is_valid()) - return ft_dds; - if (fnt_f.load(data, m_size), fnt_f.is_valid()) - return ft_fnt; - if (hva_f.load(data, m_size), hva_f.is_valid()) - return ft_hva; - if (mp3_f.load(data, m_size), mp3_f.is_valid()) - return ft_mp3; - if (jpeg_f.load(data, m_size), jpeg_f.is_valid()) - return ft_jpeg; - if (ogg_f.load(data, m_size), ogg_f.is_valid()) - return ft_ogg; - if (pal_f.load(data, m_size), pal_f.is_valid()) - return ft_pal; - if (pcx_f.load(data, m_size), pcx_f.is_valid()) - return ft_pcx; - if (png_f.load(data, m_size), png_f.is_valid()) - return ft_png; - if (riff_f.load(data, m_size), riff_f.is_valid()) - { - Cavi_file avi_f; - Cwav_file wav_f; - avi_f.load(data, m_size); - wav_f.load(data, m_size); - if (avi_f.is_valid()) - return ft_avi; - if (wav_f.is_valid()) - return ft_wav; - return ft_riff; - } - if (shp_dune2_f.load(data, m_size), shp_dune2_f.is_valid()) - return ft_shp_dune2; - if (shp_f.load(data, m_size), shp_f.is_valid()) - return ft_shp; - if (shp_ts_f.load(data, m_size), shp_ts_f.is_valid()) - return ft_shp_ts; - if (st_f.load(data, m_size), st_f.is_valid()) - return ft_st; - if (tga_f.load(data, m_size), tga_f.is_valid()) - return ft_tga; - if (tmp_f.load(data, m_size), tmp_f.is_valid()) - return ft_tmp; - if (tmp_ra_f.load(data, m_size), tmp_ra_f.is_valid()) - return ft_tmp_ra; - if (tmp_ts_f.load(data, m_size), tmp_ts_f.is_valid()) - return ft_tmp_ts; - if (voc_f.load(data, m_size), voc_f.is_valid()) - return ft_voc; - if (vqa_f.load(data, m_size), vqa_f.is_valid()) - return ft_vqa; - if (vqp_f.load(data, m_size), vqp_f.is_valid()) - return ft_vqp; - if (vxl_f.load(data, m_size), vxl_f.is_valid()) - return ft_vxl; - if (wsa_dune2_f.load(data, m_size), wsa_dune2_f.is_valid()) - return ft_wsa_dune2; - if (wsa_f.load(data, m_size), wsa_f.is_valid()) - return ft_wsa; - if (xcc_f.load(data, m_size), xcc_f.is_valid()) - { - switch (xcc_f.get_ft()) - { - case xcc_ft_lmd: - return ft_xcc_lmd; - } - return ft_xcc_unknown; - } - if (xif_f.load(data, m_size), xif_f.is_valid()) - return ft_xif; - if (mix_f.load(data, m_size), mix_f.is_valid()) - return ft_mix; - if (mix_rg_f.load(data, m_size), mix_rg_f.is_valid()) - return ft_mix_rg; - if (pak_f.load(data, m_size), pak_f.is_valid()) - return ft_pak; - if (w3d_f.load(data, m_size), w3d_f.is_valid()) - return ft_w3d; - if (text_f.load(data, m_size), text_f.is_valid()) - { - if (fast) - return ft_text; - Cvirtual_tfile tf; - tf.load_data(data); - Cnull_ini_reader ir; - int error = 0; - while (!error && !tf.eof()) - { - error = ir.process_line(tf.read_line()); - if (tf.eof()) - error = 0; - } - if (!error && ir.is_valid()) - { - if (!m_read_on_open && m_size != size) - { - size = m_size; - if (read(data.write_start(size), size)) - return ft_unknown; - seek(0); - } - { - Cmap_td_ini_reader ir; - if (!ir.process(data) && ir.is_valid()) - return ft_map_td; - } - { - Cmap_ra_ini_reader ir; - if (!ir.process(data) && ir.is_valid()) - return ft_map_ra; - } - { - Cmap_ts_ini_reader ir; - ir.fast(true); - if (!ir.process(data) && ir.is_valid()) - return ft_map_ts; - } - { - Cpkt_ts_ini_reader ir; - ir.fast(true); - if (!ir.process(data) && ir.is_valid()) - return ft_pkt_ts; - } - { - Csound_ts_ini_reader ir; - ir.fast(true); - if (!ir.process(data) && ir.is_valid()) - return ft_sound_ini_ts; - } - { - Ctheme_ts_ini_reader ir; - if (!ir.process(data) && ir.is_valid()) - return ft_theme_ini_ts; - } - return ft_ini; - } - return ft_text; - } - return ft_unknown; +t_file_type Ccc_file::get_file_type(bool fast) +{ + Cvirtual_binary data; + int size; + if (m_data.data()) { + data = m_data; + size = m_size; + } else { + size = min(m_size, 64 << 10); + seek(0); + if (read(data.write_start(size), size)) + return ft_unknown; + seek(0); } + Caud_file aud_f; + Cbin_file bin_f; + Cbink_file bink_f; + Cbig_file big_f; + Cbmp_file bmp_f; + Ccsf_file csf_f; + Ccps_file cps_f; + Cdds_file dds_f; + Cfnt_file fnt_f; + Chva_file hva_f; + Cmix_file mix_f; + Cmix_rg_file mix_rg_f; + Cmp3_file mp3_f; + Cjpeg_file jpeg_f; + Cogg_file ogg_f; + Cpak_file pak_f; + Cpal_file pal_f; + Cpcx_file pcx_f; + Cpng_file png_f; + Criff_file riff_f; + Cshp_dune2_file shp_dune2_f; + Cshp_file shp_f; + Cshp_ts_file shp_ts_f; + Cst_file st_f; + Ctext_file text_f; + Ctga_file tga_f; + Ctmp_file tmp_f; + Ctmp_ra_file tmp_ra_f; + Ctmp_ts_file tmp_ts_f; + Cvoc_file voc_f; + Cvqa_file vqa_f; + Cvqp_file vqp_f; + Cvxl_file vxl_f; + Cw3d_file w3d_f; + Cwsa_dune2_file wsa_dune2_f; + Cwsa_file wsa_f; + Cxcc_file xcc_f; + Cxif_file xif_f; + if (aud_f.load(data, m_size), aud_f.is_valid()) + return ft_aud; + if (big_f.load(data, m_size), big_f.is_valid()) + return ft_big; + if (bin_f.load(data, m_size), bin_f.is_valid()) + return ft_bin; + if (bink_f.load(data, m_size), bink_f.is_valid()) + return ft_bink; + if (bmp_f.load(data, m_size), bmp_f.is_valid()) + return ft_bmp; + if (csf_f.load(data, m_size), csf_f.is_valid()) + return ft_csf; + if (cps_f.load(data, m_size), cps_f.is_valid()) + return ft_cps; + if (dds_f.load(data, m_size), dds_f.is_valid()) + return ft_dds; + if (fnt_f.load(data, m_size), fnt_f.is_valid()) + return ft_fnt; + if (hva_f.load(data, m_size), hva_f.is_valid()) + return ft_hva; + if (mp3_f.load(data, m_size), mp3_f.is_valid()) + return ft_mp3; + if (jpeg_f.load(data, m_size), jpeg_f.is_valid()) + return ft_jpeg; + if (ogg_f.load(data, m_size), ogg_f.is_valid()) + return ft_ogg; + if (pal_f.load(data, m_size), pal_f.is_valid()) + return ft_pal; + if (pcx_f.load(data, m_size), pcx_f.is_valid()) + return ft_pcx; + if (png_f.load(data, m_size), png_f.is_valid()) + return ft_png; + if (riff_f.load(data, m_size), riff_f.is_valid()) { + Cavi_file avi_f; + Cwav_file wav_f; + avi_f.load(data, m_size); + wav_f.load(data, m_size); + if (avi_f.is_valid()) + return ft_avi; + if (wav_f.is_valid()) + return ft_wav; + return ft_riff; + } + if (shp_dune2_f.load(data, m_size), shp_dune2_f.is_valid()) + return ft_shp_dune2; + if (shp_f.load(data, m_size), shp_f.is_valid()) + return ft_shp; + if (shp_ts_f.load(data, m_size), shp_ts_f.is_valid()) + return ft_shp_ts; + if (st_f.load(data, m_size), st_f.is_valid()) + return ft_st; + if (tga_f.load(data, m_size), tga_f.is_valid()) + return ft_tga; + if (tmp_f.load(data, m_size), tmp_f.is_valid()) + return ft_tmp; + if (tmp_ra_f.load(data, m_size), tmp_ra_f.is_valid()) + return ft_tmp_ra; + if (tmp_ts_f.load(data, m_size), tmp_ts_f.is_valid()) + return ft_tmp_ts; + if (voc_f.load(data, m_size), voc_f.is_valid()) + return ft_voc; + if (vqa_f.load(data, m_size), vqa_f.is_valid()) + return ft_vqa; + if (vqp_f.load(data, m_size), vqp_f.is_valid()) + return ft_vqp; + if (vxl_f.load(data, m_size), vxl_f.is_valid()) + return ft_vxl; + if (wsa_dune2_f.load(data, m_size), wsa_dune2_f.is_valid()) + return ft_wsa_dune2; + if (wsa_f.load(data, m_size), wsa_f.is_valid()) + return ft_wsa; + if (xcc_f.load(data, m_size), xcc_f.is_valid()) { + switch (xcc_f.get_ft()) { + case xcc_ft_lmd: + return ft_xcc_lmd; + } + return ft_xcc_unknown; + } + if (xif_f.load(data, m_size), xif_f.is_valid()) + return ft_xif; + if (mix_f.load(data, m_size), mix_f.is_valid()) + return ft_mix; + if (mix_rg_f.load(data, m_size), mix_rg_f.is_valid()) + return ft_mix_rg; + if (pak_f.load(data, m_size), pak_f.is_valid()) + return ft_pak; + if (w3d_f.load(data, m_size), w3d_f.is_valid()) + return ft_w3d; + if (text_f.load(data, m_size), text_f.is_valid()) { + if (fast) + return ft_text; + Cvirtual_tfile tf; + tf.load_data(data); + Cnull_ini_reader ir; + int error = 0; + while (!error && !tf.eof()) { + error = ir.process_line(tf.read_line()); + if (tf.eof()) + error = 0; + } + if (!error && ir.is_valid()) { + if (!m_read_on_open && m_size != size) { + size = m_size; + if (read(data.write_start(size), size)) + return ft_unknown; + seek(0); + } + { + Cmap_td_ini_reader ir; + if (!ir.process(data) && ir.is_valid()) + return ft_map_td; + } + { + Cmap_ra_ini_reader ir; + if (!ir.process(data) && ir.is_valid()) + return ft_map_ra; + } + { + Cmap_ts_ini_reader ir; + ir.fast(true); + if (!ir.process(data) && ir.is_valid()) + return ft_map_ts; + } + { + Cpkt_ts_ini_reader ir; + ir.fast(true); + if (!ir.process(data) && ir.is_valid()) + return ft_pkt_ts; + } + { + Csound_ts_ini_reader ir; + ir.fast(true); + if (!ir.process(data) && ir.is_valid()) + return ft_sound_ini_ts; + } + { + Ctheme_ts_ini_reader ir; + if (!ir.process(data) && ir.is_valid()) + return ft_theme_ini_ts; + } + return ft_ini; + } + return ft_text; + } + return ft_unknown; +} #endif #endif diff --git a/3rdParty/xcc/misc/cc_file.h b/3rdParty/xcc/misc/cc_file.h index 264e954..2b23fa8 100644 --- a/3rdParty/xcc/misc/cc_file.h +++ b/3rdParty/xcc/misc/cc_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -52,7 +52,7 @@ enum t_file_type ft_mix_rg, ft_mng, ft_mp3, - ft_mrf, + ft_mrf, ft_ogg, ft_pak, ft_pal, @@ -67,7 +67,7 @@ enum t_file_type ft_rules_ini_ra2, ft_shp_dune2, ft_shp, - ft_shp_ts, + ft_shp_ts, ft_sound_ini_ts, ft_sound_ini_ra2, ft_st, @@ -85,7 +85,7 @@ enum t_file_type ft_vqp, ft_vxl, ft_w3d, - ft_wav, + ft_wav, ft_wav_ima_adpcm, ft_wav_pcm, ft_wsa_dune2, @@ -102,7 +102,7 @@ const char* ft_name[]; class Cmix_file; -class Ccc_file +class Ccc_file { public: const Cwin_handle& h(); @@ -120,24 +120,24 @@ public: Ccc_file(bool read_on_open); const byte* begin() const - { - return m_data.begin(); - } + { + return m_data.begin(); + } const byte* end() const - { - return m_data.end(); - } + { + return m_data.end(); + } const byte* data() const - { - return m_data.data(); - } + { + return m_data.data(); + } - long long size() const - { - return m_size; - } + long long size() const + { + return m_size; + } const byte* get_data() const { diff --git a/3rdParty/xcc/misc/cc_file_sh.h b/3rdParty/xcc/misc/cc_file_sh.h index a304dcf..bd05709 100644 --- a/3rdParty/xcc/misc/cc_file_sh.h +++ b/3rdParty/xcc/misc/cc_file_sh.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -24,8 +24,8 @@ template class Ccc_file_sh : public Ccc_file_small { public: - const T& header() const - { - return *reinterpret_cast(data()); - } + const T& header() const + { + return *reinterpret_cast(data()); + } }; diff --git a/3rdParty/xcc/misc/cc_file_small.h b/3rdParty/xcc/misc/cc_file_small.h index 3428d7f..9fa31b9 100644 --- a/3rdParty/xcc/misc/cc_file_small.h +++ b/3rdParty/xcc/misc/cc_file_small.h @@ -1,26 +1,26 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once #include -class Ccc_file_small : public Ccc_file +class Ccc_file_small : public Ccc_file { public: Ccc_file_small() : Ccc_file(true) diff --git a/3rdParty/xcc/misc/cc_structures.cpp b/3rdParty/xcc/misc/cc_structures.cpp index 43fb582..9b1ba2b 100644 --- a/3rdParty/xcc/misc/cc_structures.cpp +++ b/3rdParty/xcc/misc/cc_structures.cpp @@ -1,40 +1,40 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" #include "cc_structures.h" -const char* game_name[] = +const char* game_name[] = { - "Tiberian Dawn", - "Red Alert", - "Tiberian Sun", - "Dune 2", - "Dune 2000", - "Red Alert 2", - "Red Alert 2 Yuri's Revenge", - "Renegade", - "Generals", + "Tiberian Dawn", + "Red Alert", + "Tiberian Sun", + "Dune 2", + "Dune 2000", + "Red Alert 2", + "Red Alert 2 Yuri's Revenge", + "Renegade", + "Generals", "Generals Zero Hour", "Emperor Battle for Dune", "Nox", "Battle for Middle Earth", "Battle for Middle Earth 2", "Tiberium Wars", - "Tiberian Sun Firestorm", + "Tiberian Sun Firestorm", }; diff --git a/3rdParty/xcc/misc/cc_structures.h b/3rdParty/xcc/misc/cc_structures.h index ff3ac5d..fba04e5 100644 --- a/3rdParty/xcc/misc/cc_structures.h +++ b/3rdParty/xcc/misc/cc_structures.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -201,9 +201,9 @@ struct t_mix_index_entry size = size_; } - unsigned __int32 id; - __int32 offset; - __int32 size; + unsigned __int32 id; + __int32 offset; + __int32 size; }; struct t_mix_rg_header @@ -276,14 +276,14 @@ const char png_id[] = "\x89PNG\r\n\x1A\n"; struct t_shp_dune2_header { - __int16 c_images; + __int16 c_images; }; struct t_shp_dune2_image_header { __int16 compression; - unsigned __int8 cy; - unsigned __int16 cx; + unsigned __int8 cy; + unsigned __int16 cx; unsigned __int8 cy2; unsigned __int16 size_in; unsigned __int16 size_out; @@ -291,29 +291,29 @@ struct t_shp_dune2_image_header struct t_shp_header { - __int16 c_images; - __int16 unknown1; - __int16 unknown2; - __int16 cx; - __int16 cy; - __int32 unknown3; + __int16 c_images; + __int16 unknown1; + __int16 unknown2; + __int16 cx; + __int16 cy; + __int32 unknown3; }; struct t_shp_ts_header { - __int16 zero; - __int16 cx; - __int16 cy; - __int16 c_images; + __int16 zero; + __int16 cx; + __int16 cy; + __int16 c_images; }; struct t_shp_ts_image_header { __int16 x; __int16 y; - __int16 cx; - __int16 cy; - __int32 compression; + __int16 cx; + __int16 cy; + __int32 compression; __int32 unknown; __int32 zero; __int32 offset; @@ -321,7 +321,7 @@ struct t_shp_ts_image_header struct t_tga_header { - byte id_size; + byte id_size; byte map_t; byte image_t; unsigned __int16 map_first; @@ -332,9 +332,9 @@ struct t_tga_header unsigned __int16 cx; unsigned __int16 cy; byte cb_pixel; - byte alpha:4; - byte horizontal:1; - byte vertical:1; + byte alpha : 4; + byte horizontal : 1; + byte vertical : 1; }; struct t_tmp_header @@ -387,9 +387,9 @@ struct t_tmp_image_header __int32 y_extra; __int32 cx_extra; __int32 cy_extra; - unsigned int has_extra_data: 1; - unsigned int has_z_data: 1; - unsigned int has_damaged_data: 1; + unsigned int has_extra_data : 1; + unsigned int has_z_data : 1; + unsigned int has_damaged_data : 1; __int8 height; __int8 terrain_type; __int8 ramp_type; @@ -451,7 +451,7 @@ struct t_vqa_header const __int32 vqa_c_mask = 0xff000000; const __int32 vqa_t_mask = 0x00ffffff; const __int32 vqa_file_id = *(__int32*)"FORM"; -const __int64 vqa_form_id = {*(__int64*)"WVQAVQHD"}; +const __int64 vqa_form_id = { *(__int64*)"WVQAVQHD" }; const __int32 vqa_cbf_id = *(__int32*)"CBF\0"; const __int32 vqa_cbp_id = *(__int32*)"CBP\0"; const __int32 vqa_cpl_id = *(__int32*)"CPL\0"; @@ -465,7 +465,7 @@ const __int32 vqa_vqfr_id = *(__int32*)"VQFR"; struct t_vqp_header { - unsigned __int32 c_tables; + unsigned __int32 c_tables; }; struct t_vxl_header @@ -489,9 +489,9 @@ struct t_vxl_section_header struct t_vxl_section_tailer { - __int32 span_start_ofs; - __int32 span_end_ofs; - __int32 span_data_ofs; + __int32 span_start_ofs; + __int32 span_end_ofs; + __int32 span_data_ofs; float scale; float transform[3][4]; float x_min_scale; @@ -526,20 +526,20 @@ struct t_w3d_header struct t_wsa_dune2_header { - __int16 c_frames; - __int16 cx; - __int16 cy; + __int16 c_frames; + __int16 cx; + __int16 cy; __int16 delta; }; struct t_wsa_header { - __int16 c_frames; - __int16 x; - __int16 y; - __int16 cx; - __int16 cy; - __int32 delta; + __int16 c_frames; + __int16 x; + __int16 y; + __int16 cx; + __int16 cy; + __int32 delta; }; struct t_xcc_header diff --git a/3rdParty/xcc/misc/crc.h b/3rdParty/xcc/misc/crc.h index 9a68d52..c203700 100644 --- a/3rdParty/xcc/misc/crc.h +++ b/3rdParty/xcc/misc/crc.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/ddpf_conversion.cpp b/3rdParty/xcc/misc/ddpf_conversion.cpp index 6581bdc..b8066bb 100644 --- a/3rdParty/xcc/misc/ddpf_conversion.cpp +++ b/3rdParty/xcc/misc/ddpf_conversion.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -24,8 +24,7 @@ static int get_shift(unsigned int v) if (!v) return 0; int r = 0; - while (~v & 1) - { + while (~v & 1) { r++; v >>= 1; } @@ -35,8 +34,7 @@ static int get_shift(unsigned int v) static int get_size(unsigned int v) { int r = 0; - while (v) - { + while (v) { if (v & 1) r++; v >>= 1; @@ -58,7 +56,7 @@ void Cddpf_conversion::set_pf(const DDPIXELFORMAT& pf) int Cddpf_conversion::get_color(int a, int r, int g, int b) { - return a >> (8 - a_size) << a_shift | r >> (8 - r_size) << r_shift | g >> (8 - g_size) << g_shift | b >> (8 - b_size) << b_shift; + return a >> (8 - a_size) << a_shift | r >> (8 - r_size) << r_shift | g >> (8 - g_size) << g_shift | b >> (8 - b_size) << b_shift; } int Cddpf_conversion::get_color(int r, int g, int b) diff --git a/3rdParty/xcc/misc/ddpf_conversion.h b/3rdParty/xcc/misc/ddpf_conversion.h index 3aab406..c773c39 100644 --- a/3rdParty/xcc/misc/ddpf_conversion.h +++ b/3rdParty/xcc/misc/ddpf_conversion.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/file32.cpp b/3rdParty/xcc/misc/file32.cpp index e895bfe..2a23adf 100644 --- a/3rdParty/xcc/misc/file32.cpp +++ b/3rdParty/xcc/misc/file32.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -133,9 +133,9 @@ Cvirtual_binary Cfile32::get_mm() { if (!size()) return Cvirtual_binary(); - Cwin_handle mh(CreateFileMapping(h(), NULL, PAGE_READONLY, 0, 0, NULL)); - void* d = mh ? MapViewOfFile(mh, FILE_MAP_READ, 0, 0, 0) : NULL; - return d ? Cvirtual_binary(d, size(), std::shared_ptr(d, UnmapViewOfFile)) : Cvirtual_binary(); + Cwin_handle mh(CreateFileMapping(h(), NULL, PAGE_READONLY, 0, 0, NULL)); + void* d = mh ? MapViewOfFile(mh, FILE_MAP_READ, 0, 0, 0) : NULL; + return d ? Cvirtual_binary(d, size(), std::shared_ptr(d, UnmapViewOfFile)) : Cvirtual_binary(); } Cvirtual_binary file32_read(const string& name) diff --git a/3rdParty/xcc/misc/file32.h b/3rdParty/xcc/misc/file32.h index 7e2cbfc..2c535d9 100644 --- a/3rdParty/xcc/misc/file32.h +++ b/3rdParty/xcc/misc/file32.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/fname.cpp b/3rdParty/xcc/misc/fname.cpp index 04654b5..893ca1e 100644 --- a/3rdParty/xcc/misc/fname.cpp +++ b/3rdParty/xcc/misc/fname.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -136,16 +136,14 @@ const Cfname& Cfname::operator=(string_view s) long p1 = s.rfind('\\'); long p2 = s.rfind('.'); char t[MAX_PATH]; - if (p1 != string::npos) - { + if (p1 != string::npos) { //copy last \ also t[s.copy(t, p1 + 1)] = 0; path = t; } t[s.copy(t, p2 - p1 - 1, p1 + 1)] = 0; title = t; - if (p2 != s.npos && p1 < p2) - { + if (p2 != s.npos && p1 < p2) { t[s.copy(t, s.npos, p2)] = 0; ext = t; } @@ -166,8 +164,7 @@ void create_deep_dir(string dir, const string& name) { int a = 0; int b; - while ((b = name.find_first_of("/\\", a)) != string::npos) - { + while ((b = name.find_first_of("/\\", a)) != string::npos) { dir += '/' + name.substr(a, b - a); create_dir(dir); a = b + 1; @@ -192,19 +189,15 @@ int move_file(string s, string d) bool fname_filter(const string& fname, const string& filter) { size_t i; - for (i = 0; i < filter.size(); i++) - { + for (i = 0; i < filter.size(); i++) { char c = filter[i]; - if (c == '*') - { - if (filter.find('*', i + 1) == string::npos) - { + if (c == '*') { + if (filter.find('*', i + 1) == string::npos) { int j = fname.length() - filter.length() + 1; return j < 0 ? false : fname_filter(fname.substr(i + j), filter.substr(i + 1)); } // for (int j = 0; j < min(fname.length(), filter.length()) - i; j++) - for (size_t j = 0; j < fname.size(); j++) - { + for (size_t j = 0; j < fname.size(); j++) { if (fname_filter(fname.substr(i + j), filter.substr(i + 1))) return true; } diff --git a/3rdParty/xcc/misc/fname.h b/3rdParty/xcc/misc/fname.h index ded5594..c89f70c 100644 --- a/3rdParty/xcc/misc/fname.h +++ b/3rdParty/xcc/misc/fname.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -55,7 +55,7 @@ public: Cfname GetModuleFileName(HMODULE hModule = 0); bool fname_filter(const string& fname, const string& filter); -int create_dir(const string& dir); +int create_dir(const string& dir); void create_deep_dir(string dir, const string& name); int delete_file(string fname); int copy_file(string s, string d); diff --git a/3rdParty/xcc/misc/hva_file.cpp b/3rdParty/xcc/misc/hva_file.cpp index fc3b675..9274c41 100644 --- a/3rdParty/xcc/misc/hva_file.cpp +++ b/3rdParty/xcc/misc/hva_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -28,7 +28,7 @@ bool Chva_file::is_valid() const const t_hva_header& h = header(); int size = get_size(); return !(sizeof(t_hva_header) > size - || !h.c_frames + || !h.c_frames || !h.c_sections || sizeof(t_hva_header) + (48 * h.c_frames + 16) * h.c_sections != size); } @@ -43,15 +43,11 @@ int Chva_file::extract_as_csv(const string& name) const << endl; for (int i = 0; i < c_sections; i++) f << get_section_id(i) << ";;;;;"; - for (int j = 0; j < c_frames; j++) - { + for (int j = 0; j < c_frames; j++) { f << endl; - for (int y = 0; y < 3; y++) - { - for (int i = 0; i < c_sections; i++) - { - for (int x = 0; x < 4; x++) - { + for (int y = 0; y < 3; y++) { + for (int i = 0; i < c_sections; i++) { + for (int x = 0; x < 4; x++) { f << get_transform_matrix(i, j)[x + 4 * y] << ';'; } f << ';'; @@ -83,25 +79,20 @@ Cvirtual_binary hva_file_write(const byte* s, int cb_s) header.c_sections = c_sections; w += sizeof(t_hva_header); l = f.read_line(); - for (int i = 0; i < c_sections; i++) - { + for (int i = 0; i < c_sections; i++) { strcpy(reinterpret_cast(w), l.get_next_line(sep).c_str()); w += 16; l.get_next_line(sep); - l.get_next_line(sep); - l.get_next_line(sep); - l.get_next_line(sep); + l.get_next_line(sep); + l.get_next_line(sep); + l.get_next_line(sep); } float* transform_matrix = reinterpret_cast(w); - for (int j = 0; j < c_frames; j++) - { - for (int y = 0; y < 3; y++) - { + for (int j = 0; j < c_frames; j++) { + for (int y = 0; y < 3; y++) { l = f.read_line(); - for (int i = 0; i < c_sections; i++) - { - for (int x = 0; x < 4; x++) - { + for (int i = 0; i < c_sections; i++) { + for (int x = 0; x < 4; x++) { transform_matrix[12 * (c_frames * i + j) + x + 4 * y] = atof(l.get_next_line(sep).c_str()); } l.get_next_line(sep); diff --git a/3rdParty/xcc/misc/hva_file.h b/3rdParty/xcc/misc/hva_file.h index 63b789d..ab5c214 100644 --- a/3rdParty/xcc/misc/hva_file.h +++ b/3rdParty/xcc/misc/hva_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/id_log.cpp b/3rdParty/xcc/misc/id_log.cpp index ff55fcd..bb15c47 100644 --- a/3rdParty/xcc/misc/id_log.cpp +++ b/3rdParty/xcc/misc/id_log.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -36,8 +36,7 @@ t_id_list td_list, ra_list, ts_list, dune2_list, ra2_list; static t_id_list& get_list(t_game game) { - switch (game) - { + switch (game) { case game_ra: return ra_list; case game_ts: @@ -56,8 +55,7 @@ static void read_list(t_game game, const char*& s) int count = *reinterpret_cast(s); s += 4; t_idinfo idinfo; - while (count--) - { + while (count--) { idinfo.name = s; s += idinfo.name.length() + 1; idinfo.description = s; @@ -78,8 +76,7 @@ int mix_database::load() read_list(game_ra, data); read_list(game_ts, data); read_list(game_ra2, data); - if (0) - { + if (0) { ofstream log_f("c:\\log.txt"); for (auto& i : ts_list) log_f << i.second.name << '\t' << i.second.description << endl; @@ -89,21 +86,16 @@ int mix_database::load() const char char1[] = "bgjm"; const char char2[] = "ew"; const char char3[] = "abc"; - for (int i = 0; i < 2; i++) - { + for (int i = 0; i < 2; i++) { if (i) strcpy(name + 8, "ini"); - for (int j = 0; j < 4; j++) - { + for (int j = 0; j < 4; j++) { name[2] = char1[j]; - for (int k = 0; k < 100; k++) - { + for (int k = 0; k < 100; k++) { memcpy(name + 3, nwzl(2, k).c_str(), 2); - for (int l = 0; l < 2; l++) - { + for (int l = 0; l < 2; l++) { name[5] = char2[l]; - for (int m = 0; m < 3; m++) - { + for (int m = 0; m < 3; m++) { name[6] = char3[m]; mix_database::add_name(game_td, name, ""); mix_database::add_name(game_ra, name, ""); diff --git a/3rdParty/xcc/misc/id_log.h b/3rdParty/xcc/misc/id_log.h index c866f86..8e278b6 100644 --- a/3rdParty/xcc/misc/id_log.h +++ b/3rdParty/xcc/misc/id_log.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/image_file.h b/3rdParty/xcc/misc/image_file.h index b9e9fb5..dd60a98 100644 --- a/3rdParty/xcc/misc/image_file.h +++ b/3rdParty/xcc/misc/image_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2001 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2001 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -29,7 +29,7 @@ class Cimage_file : public Cvideo_file { public: virtual void decode(void*) const = 0; - + #ifndef XCC_MINIMAL_BUILD virtual Cvirtual_image vimage() const { @@ -38,7 +38,7 @@ public: return Cvirtual_image(image, this->cx(), this->cy(), this->cb_pixel(), this->palet()); } #endif - + int cf() const override { return 1; diff --git a/3rdParty/xcc/misc/mix_decode.cpp b/3rdParty/xcc/misc/mix_decode.cpp index 5dbfc4e..403e811 100644 --- a/3rdParty/xcc/misc/mix_decode.cpp +++ b/3rdParty/xcc/misc/mix_decode.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -22,7 +22,7 @@ const static char* pubkey_str = "AihRvNoIbTn85FZRYNZRcT+i6KpU+maCsEqr3Q5q+LDB5tH7Tz2qQ38V"; -const static char char2num[] = +const static char char2num[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -45,7 +45,7 @@ const static char char2num[] = using word = unsigned short; using bignum = uint32_t[64]; -static struct +static struct { bignum key1; bignum key2; @@ -73,32 +73,29 @@ static void move_key_to_big(bignum n, const char* key, uint32_t klen, uint32_t b uint32_t sign = key[0] & 0x80 ? 0xff : 0; int i = blen * 4; for (; i > klen; i--) - ((char *)n)[i - 1] = sign; - for (; i > 0; i--) - ((char *)n)[i - 1] = key[klen - i]; + ((char*)n)[i - 1] = sign; + for (; i > 0; i--) + ((char*)n)[i - 1] = key[klen - i]; } -static void key_to_bignum(bignum n, char *key, uint32_t len) +static void key_to_bignum(bignum n, char* key, uint32_t len) { uint32_t keylen; int i; - - if (key[0] != 2) + + if (key[0] != 2) return; key++; - - if (key[0] & 0x80) - { + + if (key[0] & 0x80) { keylen = 0; - for (i = 0; i < (key[0] & 0x7f); i++) keylen = (keylen << 8) | key[i+1]; + for (i = 0; i < (key[0] & 0x7f); i++) keylen = (keylen << 8) | key[i + 1]; key += (key[0] & 0x7f) + 1; - } - else - { + } else { keylen = key[0]; key++; } - if (keylen <= len * 4) + if (keylen <= len * 4) move_key_to_big(n, key, keylen, len); } @@ -117,8 +114,7 @@ static uint32_t bitlen_bignum(bignum n, uint32_t len) return 0; uint32_t bitlen = ddlen * 32; uint32_t mask = 0x80000000; - while ((mask & n[ddlen - 1]) == 0) - { + while ((mask & n[ddlen - 1]) == 0) { mask >>= 1; bitlen--; } @@ -130,8 +126,7 @@ static void init_pubkey() init_bignum(pubkey.key2, 0x10001, 64); char keytmp[256]; uint32_t i2 = 0; - for (uint32_t i = 0; i < strlen(pubkey_str);) - { + for (uint32_t i = 0; i < strlen(pubkey_str);) { uint32_t tmp = char2num[pubkey_str[i++]]; tmp <<= 6; tmp |= char2num[pubkey_str[i++]]; tmp <<= 6; tmp |= char2num[pubkey_str[i++]]; @@ -154,8 +149,7 @@ static int cmp_bignum(bignum n1, bignum n2, uint32_t len) { n1 += len - 1; n2 += len - 1; - while (len > 0) - { + while (len > 0) { if (*n1 < *n2) return -1; if (*n1 > *n2) return 1; n1--; @@ -173,11 +167,10 @@ static void mov_bignum(bignum dest, bignum src, uint32_t len) static void shr_bignum(bignum n, uint32_t bits, long int len) { uint32_t i; - if (uint32_t i2 = bits / 32) - { - for (i = 0; i < len - i2; i++) + if (uint32_t i2 = bits / 32) { + for (i = 0; i < len - i2; i++) n[i] = n[i + i2]; - for (; i < len; i++) + for (; i < len; i++) n[i] = 0; bits %= 32; } @@ -191,11 +184,10 @@ static void shr_bignum(bignum n, uint32_t bits, long int len) static void shl_bignum(bignum n, uint32_t bits, uint32_t len) { uint32_t i; - if (uint32_t i2 = bits / 32) - { - for (i = len - 1; i > i2; i--) + if (uint32_t i2 = bits / 32) { + for (i = len - 1; i > i2; i--) n[i] = n[i - i2]; - for (; i > 0; i--) + for (; i > 0; i--) n[i] = 0; bits %= 32; } @@ -209,14 +201,13 @@ static void shl_bignum(bignum n, uint32_t bits, uint32_t len) static uint32_t sub_bignum(bignum dest, bignum src1, bignum src2, uint32_t carry, uint32_t len) { len *= 2; - while (--len != -1) - { - uint32_t i1 = *(word *)src1; - uint32_t i2 = *(word *)src2; - *(word *)dest = i1 - i2 - carry; - src1 = (uint32_t *)(((word *)src1) + 1); - src2 = (uint32_t *)(((word *)src2) + 1); - dest = (uint32_t *)(((word *)dest) + 1); + while (--len != -1) { + uint32_t i1 = *(word*)src1; + uint32_t i2 = *(word*)src2; + *(word*)dest = i1 - i2 - carry; + src1 = (uint32_t*)(((word*)src1) + 1); + src2 = (uint32_t*)(((word*)src2) + 1); + dest = (uint32_t*)(((word*)dest) + 1); carry = ((i1 - i2 - carry) & 0x10000) ? 1 : 0; } return carry; @@ -234,18 +225,15 @@ static void inv_bignum(bignum n1, bignum n2, uint32_t len) uint32_t n2_bytelen = ((n2_bitlen - 1) / 32) * 4; n_tmp[n2_bytelen / 4] |= ((uint32_t)1) << ((n2_bitlen - 1) & 0x1f); - while (n2_bitlen > 0) - { + while (n2_bitlen > 0) { n2_bitlen--; shl_bignum(n_tmp, 1, len); - if (cmp_bignum(n_tmp, n2, len) != -1) - { + if (cmp_bignum(n_tmp, n2, len) != -1) { sub_bignum(n_tmp, n_tmp, n2, 0, len); *n1 |= bit; } bit >>= 1; - if (bit == 0) - { + if (bit == 0) { n1--; bit = 0x80000000; } @@ -255,7 +243,7 @@ static void inv_bignum(bignum n1, bignum n2, uint32_t len) static void inc_bignum(bignum n, uint32_t len) { - while ((++*n == 0) && (--len > 0)) + while ((++ * n == 0) && (--len > 0)) n++; } @@ -271,37 +259,34 @@ static void init_two_dw(bignum n, uint32_t len) shr_bignum(glob1_hi_inv, 1, 2); glob1_hi_bitlen = (glob1_hi_bitlen + 15) % 16 + 1; inc_bignum(glob1_hi_inv, 2); - if (bitlen_bignum(glob1_hi_inv, 2) > 32) - { + if (bitlen_bignum(glob1_hi_inv, 2) > 32) { shr_bignum(glob1_hi_inv, 1, 2); glob1_hi_bitlen--; } - glob1_hi_inv_lo = *(word *)glob1_hi_inv; - glob1_hi_inv_hi = *(((word *)glob1_hi_inv) + 1); + glob1_hi_inv_lo = *(word*)glob1_hi_inv; + glob1_hi_inv_hi = *(((word*)glob1_hi_inv) + 1); } static void mul_bignum_word(bignum n1, bignum n2, uint32_t mul, uint32_t len) { uint32_t tmp = 0; - for (uint32_t i = 0; i < len; i++) - { - tmp = mul * (*(word *)n2) + *(word *)n1 + tmp; - *(word *)n1 = tmp; - n1 = (uint32_t *)(((word *)n1) + 1); - n2 = (uint32_t *)(((word *)n2) + 1); + for (uint32_t i = 0; i < len; i++) { + tmp = mul * (*(word*)n2) + *(word*)n1 + tmp; + *(word*)n1 = tmp; + n1 = (uint32_t*)(((word*)n1) + 1); + n2 = (uint32_t*)(((word*)n2) + 1); tmp >>= 16; } - *(word *)n1 += tmp; + *(word*)n1 += tmp; } static void mul_bignum(bignum dest, bignum src1, bignum src2, uint32_t len) { init_bignum(dest, 0, len * 2); - for (uint32_t i = 0; i < len * 2; i++) - { - mul_bignum_word(dest, src1, *(word *)src2, len * 2); - src2 = (uint32_t *)(((word *)src2) + 1); - dest = (uint32_t *)(((word *)dest) + 1); + for (uint32_t i = 0; i < len * 2; i++) { + mul_bignum_word(dest, src1, *(word*)src2, len * 2); + src2 = (uint32_t*)(((word*)src2) + 1); + dest = (uint32_t*)(((word*)dest) + 1); } } @@ -319,20 +304,20 @@ static void neg_bignum(bignum n, uint32_t len) static uint32_t get_mulword(bignum n) { - word* wn = (word *)n; + word* wn = (word*)n; uint32_t i = (((((((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_lo + 0x10000) >> 1) - + (((*(wn-2) ^ 0xffff) * glob1_hi_inv_hi + glob1_hi_inv_hi) >> 1) + 1) - >> 16) + ((((*(wn-1) ^ 0xffff) & 0xffff) * glob1_hi_inv_hi) >> 1) + - (((*wn ^ 0xffff) * glob1_hi_inv_lo) >> 1) + 1) >> 14) + glob1_hi_inv_hi - * (*wn ^ 0xffff) * 2) >> glob1_hi_bitlen; - if (i > 0xffff) + + (((*(wn - 2) ^ 0xffff) * glob1_hi_inv_hi + glob1_hi_inv_hi) >> 1) + 1) + >> 16) + ((((*(wn - 1) ^ 0xffff) & 0xffff) * glob1_hi_inv_hi) >> 1) + + (((*wn ^ 0xffff) * glob1_hi_inv_lo) >> 1) + 1) >> 14) + glob1_hi_inv_hi + * (*wn ^ 0xffff) * 2) >> glob1_hi_bitlen; + if (i > 0xffff) i = 0xffff; return i & 0xffff; } static void dec_bignum(bignum n, uint32_t len) { - while ((--*n == 0xffffffff) && (--len > 0)) + while ((-- * n == 0xffffffff) && (--len > 0)) n++; } @@ -341,24 +326,20 @@ static void calc_a_bignum(bignum n1, bignum n2, bignum n3, uint32_t len) mul_bignum(glob2, n2, n3, len); glob2[len * 2] = 0; uint32_t g2_len_x2 = len_bignum(glob2, len * 2 + 1) * 2; - if (g2_len_x2 >= glob1_len_x2) - { + if (g2_len_x2 >= glob1_len_x2) { inc_bignum(glob2, len * 2 + 1); neg_bignum(glob2, len * 2 + 1); uint32_t len_diff = g2_len_x2 + 1 - glob1_len_x2; - word* esi = ((word *)glob2) + (1 + g2_len_x2 - glob1_len_x2); - word* edi = ((word *)glob2) + (g2_len_x2 + 1); - for (; len_diff != 0; len_diff--) - { + word* esi = ((word*)glob2) + (1 + g2_len_x2 - glob1_len_x2); + word* edi = ((word*)glob2) + (g2_len_x2 + 1); + for (; len_diff != 0; len_diff--) { edi--; - word tmp = get_mulword((uint32_t *)edi); + word tmp = get_mulword((uint32_t*)edi); esi--; - if (tmp > 0) - { - mul_bignum_word((uint32_t *)esi, glob1, tmp, 2 * len); - if ((*edi & 0x8000) == 0) - { - if (sub_bignum((uint32_t *)esi, (uint32_t *)esi, glob1, 0, len)) + if (tmp > 0) { + mul_bignum_word((uint32_t*)esi, glob1, tmp, 2 * len); + if ((*edi & 0x8000) == 0) { + if (sub_bignum((uint32_t*)esi, (uint32_t*)esi, glob1, 0, len)) (*edi)--; } } @@ -381,17 +362,15 @@ static void calc_a_key(bignum n1, bignum n2, bignum n3, bignum n4, uint32_t len) n3 += n3_len - 1; n3_bitlen--; mov_bignum(n1, n2, n4_len); - while (--n3_bitlen != -1) - { - if (bit_mask == 0) - { + while (--n3_bitlen != -1) { + if (bit_mask == 0) { bit_mask = 0x80000000; n3--; } calc_a_bignum(n_tmp, n1, n1, n4_len); - if (*n3 & bit_mask) + if (*n3 & bit_mask) calc_a_bignum(n1, n_tmp, n2, n4_len); - else + else mov_bignum(n1, n_tmp, n4_len); bit_mask >>= 1; } @@ -407,18 +386,17 @@ static void calc_a_key(bignum n1, bignum n2, bignum n3, bignum n4, uint32_t len) glob1_hi_inv_hi = 0; } -static void process_predata(const byte* pre, uint32_t pre_len, byte *buf) +static void process_predata(const byte* pre, uint32_t pre_len, byte* buf) { bignum n2, n3; const uint32_t a = (pubkey.len - 1) / 8; - while (a + 1 <= pre_len) - { + while (a + 1 <= pre_len) { init_bignum(n2, 0, 64); memmove(n2, pre, a + 1); calc_a_key(n3, n2, pubkey.key2, pubkey.key1, 64); - + memmove(buf, n3, a); - + pre_len -= a + 1; pre += a + 1; buf += a; @@ -428,8 +406,7 @@ static void process_predata(const byte* pre, uint32_t pre_len, byte *buf) void get_blowfish_key(const byte* s, span d) { static bool public_key_initialized = false; - if (!public_key_initialized) - { + if (!public_key_initialized) { init_pubkey(); public_key_initialized = true; } diff --git a/3rdParty/xcc/misc/mix_decode.h b/3rdParty/xcc/misc/mix_decode.h index 388f8ed..bac8c5d 100644 --- a/3rdParty/xcc/misc/mix_decode.h +++ b/3rdParty/xcc/misc/mix_decode.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/mix_file.cpp b/3rdParty/xcc/misc/mix_file.cpp index 874ff31..19535a4 100644 --- a/3rdParty/xcc/misc/mix_file.cpp +++ b/3rdParty/xcc/misc/mix_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include @@ -58,8 +58,7 @@ bool Cmix_file::is_valid() return false; m_has_checksum = header.flags & mix_checksum; m_is_encrypted = header.flags & mix_encrypted; - if (m_is_encrypted) - { + if (m_is_encrypted) { Cblowfish bf; std::array key; get_blowfish_key(data + 4, key); @@ -69,9 +68,7 @@ bool Cmix_file::is_valid() t_mix_header* header = reinterpret_cast(e); if (!header->c_files || 84 + (sizeof(t_mix_header) + header->c_files * sizeof(t_mix_index_entry) + 7 & ~7) + header->size + (m_has_checksum ? 20 : 0) != size) return false; - } - else - { + } else { const t_mix_header* header = reinterpret_cast(data + 4); if (!header->c_files || 4 + sizeof(t_mix_header) + header->c_files * sizeof(t_mix_index_entry) + header->size + (m_has_checksum ? 20 : 0) != size) return false; @@ -85,42 +82,35 @@ int Cmix_file::post_open() { #ifndef NO_FT_SUPPORT bool index_read = false; - if (h()) - { + if (h()) { Cmix_rg_file f; if (get_data()) f.load(vdata()); else f.open(h()); - if (f.is_open() && f.is_valid()) - { + if (f.is_open() && f.is_valid()) { m_game = game_rg; m_is_encrypted = m_has_checksum = false; int c_files = f.get_c_files(); m_index.resize(c_files); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { string name = f.get_name(i); mix_database::add_name(m_game, name, "-"); m_index[i] = t_mix_index_entry(get_id(get_game(), name), f.get_offset(name), f.get_size(name)); } index_read = true; - } - else - { + } else { Cbig_file f; if (get_data()) f.load(vdata()); else f.open(h()); - if (f.is_open() && f.is_valid()) - { + if (f.is_open() && f.is_valid()) { m_game = game_gr; m_is_encrypted = m_has_checksum = false; int c_files = f.get_c_files(); m_index.resize(c_files); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { string name = f.get_name(i); mix_database::add_name(m_game, name, "-"); m_index[i] = t_mix_index_entry(get_id(get_game(), name), f.get_offset(name), f.get_size(name)); @@ -129,28 +119,24 @@ int Cmix_file::post_open() } } } - if (!index_read) - { + if (!index_read) { Cpak_file f; if (get_data()) f.load(vdata()); - else - { + else { int size = min(get_size(), 64 << 10); Cvirtual_binary data; test_fail(read(data.write_start(size), size)); f.load(data, get_size()); } - if (f.is_valid()) - { + if (f.is_valid()) { m_game = game_dune2; m_is_encrypted = m_has_checksum = false; int c_files = f.get_c_files(); if (c_files >> 12) test_fail(1); m_index.resize(c_files); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { string name = f.get_name(i); mix_database::add_name(m_game, name, "-"); m_index[i] = t_mix_index_entry(get_id(get_game(), name), f.get_offset(name), f.get_size(name)); @@ -164,8 +150,7 @@ int Cmix_file::post_open() t_mix_header header; seek(0); test_fail(read(&header, sizeof(t_mix_header))); - if (header.c_files) - { + if (header.c_files) { m_game = game_td; m_is_encrypted = m_has_checksum = false; int c_files = header.c_files; @@ -176,16 +161,13 @@ int Cmix_file::post_open() test_fail(read(&m_index[0], cb_index)); for (int i = 0; i < c_files; i++) m_index[i].offset += 6 + cb_index; - } - else - { + } else { m_has_checksum = header.flags & mix_checksum; m_is_encrypted = header.flags & mix_encrypted; bool aligned = true; Cblowfish bf; seek(4); - if (m_is_encrypted) - { + if (m_is_encrypted) { byte key_source[cb_mix_key_source]; read(key_source, cb_mix_key_source); std::array key; @@ -200,43 +182,36 @@ int Cmix_file::post_open() const int cb_f = cb_index + 5 & ~7; if (get_size() != 92 + cb_f + header.size + (m_has_checksum ? 20 : 0)) test_fail(1); - if (c_files) - { + if (c_files) { Cvirtual_binary f; read(f.write_start(cb_f), cb_f); bf.decipher(f.data_edit(), f.data_edit(), cb_f); m_index.resize(c_files); memcpy(&m_index[0], e + 6, 2); memcpy(reinterpret_cast(&m_index[0]) + 2, f.data(), cb_index - 2); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { if (m_index[i].offset & 0xf) aligned = false; m_index[i].offset += 92 + cb_f; } } - } - else - { + } else { read(&header, sizeof(header)); int c_files = header.c_files; const int cb_index = c_files * sizeof(t_mix_index_entry); if (get_size() != 4 + sizeof(t_mix_header) + cb_index + header.size + (m_has_checksum ? 20 : 0)) - test_fail(1); + test_fail(1); m_index.resize(c_files); read(&m_index[0], cb_index); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { if (m_index[i].offset & 0xf) aligned = false; m_index[i].offset += 4 + sizeof(t_mix_header) + cb_index; } } m_game = is_encrypted() ? game_ra : game_ts; - for (int i = 0; i < get_c_files(); i++) - { - if (get_id(i) == 0x763c81dd) - { + for (int i = 0; i < get_c_files(); i++) { + if (get_id(i) == 0x763c81dd) { m_game = game_ts; break; } @@ -248,55 +223,46 @@ int Cmix_file::post_open() for (int i = 0; i < get_c_files(); i++) m_id_index[get_id(i)] = i; #ifndef NO_FT_SUPPORT - if (m_ft_support) - { - switch (m_game) - { + if (m_ft_support) { + switch (m_game) { case game_dune2: case game_rg: break; default: - int count[game_unknown] = {0}; - for (int i = 0; i < get_c_files(); i++) - { + int count[game_unknown] = { 0 }; + for (int i = 0; i < get_c_files(); i++) { int id = get_id(i); for (int game = game_td; game < game_unknown; game++) count[game] += mix_database::get_name(static_cast(game), id).empty(); } int min = count[0]; - for (int game = 0; game < game_unknown; game++) - { - if (count[game] < min) - { + for (int game = 0; game < game_unknown; game++) { + if (count[game] < min) { m_game = static_cast(game); min = count[game]; } } } - if (vdata().size() == get_size()) - { + if (vdata().size() == get_size()) { int crc = compute_crc(&m_index[0], get_c_files() * sizeof(t_mix_index_entry)); Cvirtual_binary s = mix_cache::get_data(crc); m_index_ft.resize(get_c_files()); if (s.size() == get_c_files() * sizeof(t_file_type)) memcpy(&m_index_ft[0], s.data(), get_c_files() * sizeof(t_file_type)); - else - { + else { using t_block_map = multimap; t_block_map block_map; for (int i = 0; i < get_c_files(); i++) block_map.insert(t_block_map::value_type(get_offset(get_id(i)), i)); - for (auto& i : block_map) - { + for (auto& i : block_map) { Ccc_file f(false); f.open(get_id(i.second), *this); m_index_ft[i.second] = f.get_file_type(); } mix_cache::set_data(crc, Cvirtual_binary(&m_index_ft[0], get_c_files() * sizeof(t_file_type))); } - for (int i = 0; i < get_c_files(); i++) - { + for (int i = 0; i < get_c_files(); i++) { int id = get_id(i); Cxcc_lmd_file f; if (get_type(id) != ft_xcc_lmd || f.open(id, *this) || !f.is_valid()) @@ -304,8 +270,7 @@ int Cmix_file::post_open() m_game = f.get_game(); int count = f.get_c_fnames(); const char* r = f.get_fnames(); - while (count--) - { + while (count--) { string name = r; r += name.length() + 1; mix_database::add_name(m_game, name, "-"); @@ -314,20 +279,17 @@ int Cmix_file::post_open() } } #endif - if (m_mix_expansion) - { + if (m_mix_expansion) { int c_files = get_c_files(); - for (int i = 0; i < c_files; i++) - { + for (int i = 0; i < c_files; i++) { if (get_type(m_index[i].id) != ft_mix) continue; Cmix_file f; - f.open(m_index[i].id, *this); + f.open(m_index[i].id, *this); int c_files = get_c_files(); int new_c_files = f.get_c_files(); m_index.resize(c_files + new_c_files); - for (int j = 0; j < new_c_files; j++) - { + for (int j = 0; j < new_c_files; j++) { int id = f.get_id(j); m_index[c_files + j] = t_mix_index_entry(id, f.get_offset(id) + get_offset(m_index[i].id), f.get_size(id)); m_id_index[id] = c_files + j; @@ -336,14 +298,14 @@ int Cmix_file::post_open() memcpy(&m_index_ft[c_files], &f.m_index_ft[0], new_c_files * sizeof(t_file_type)); } } - return 0; + return 0; } void Cmix_file::close() { m_id_index.clear(); m_index_ft.clear(); - m_index.clear(); + m_index.clear(); Ccc_file::close(); } @@ -360,34 +322,30 @@ int Cmix_file::get_id(t_game game, string name) { boost::to_upper(name); std::replace(name.begin(), name.end(), '/', '\\'); - switch (game) - { + switch (game) { case game_ts: case game_ra2: case game_ra2_yr: - { - const int l = name.length(); - int a = l & ~3; - if (l & 3) - { - name += static_cast(l - a); - name.append(3 - (l & 3), name[a]); - } - return compute_crc(name.c_str(), name.length()); + { + const int l = name.length(); + int a = l & ~3; + if (l & 3) { + name += static_cast(l - a); + name.append(3 - (l & 3), name[a]); } + return compute_crc(name.c_str(), name.length()); + } case game_rg: case game_gr: case game_gr_zh: - return compute_crc(name.c_str(), name.length()); + return compute_crc(name.c_str(), name.length()); default: int i = 0; unsigned int id = 0; int l = name.length(); - while (i < l) - { + while (i < l) { unsigned int a = 0; - for (int j = 0; j < 4; j++) - { + for (int j = 0; j < 4; j++) { a >>= 8; if (i < l) a |= static_cast(name[i++]) << 24; diff --git a/3rdParty/xcc/misc/mix_file.h b/3rdParty/xcc/misc/mix_file.h index cb11e7b..ab37c00 100644 --- a/3rdParty/xcc/misc/mix_file.h +++ b/3rdParty/xcc/misc/mix_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -21,7 +21,7 @@ #include "cc_file.h" #include "cc_structures.h" -class Cmix_file : public Ccc_file +class Cmix_file : public Ccc_file { public: int post_open(); @@ -88,12 +88,12 @@ public: bool has_checksum() const { - return m_has_checksum; + return m_has_checksum; } bool is_encrypted() const { - return m_is_encrypted; + return m_is_encrypted; } const t_mix_index_entry* index() const diff --git a/3rdParty/xcc/misc/mix_file_write.cpp b/3rdParty/xcc/misc/mix_file_write.cpp index 85b750f..b5a0280 100644 --- a/3rdParty/xcc/misc/mix_file_write.cpp +++ b/3rdParty/xcc/misc/mix_file_write.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -63,8 +63,7 @@ int Cmix_file_write::write(byte* d) const t_mix_index_entry* index = reinterpret_cast(w); w += m_index.size() * sizeof(t_mix_index_entry); byte* body_start = w; - for (auto& i : m_index) - { + for (auto& i : m_index) { index->id = i.first; index->offset = w - body_start; index->size = i.second.size(); diff --git a/3rdParty/xcc/misc/mix_file_write.h b/3rdParty/xcc/misc/mix_file_write.h index c1b4fae..0ce141a 100644 --- a/3rdParty/xcc/misc/mix_file_write.h +++ b/3rdParty/xcc/misc/mix_file_write.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -22,7 +22,7 @@ #include #include "xcc_lmd_file_write.h" -class Cmix_file_write +class Cmix_file_write { public: void add_file(int id, const Cvirtual_binary d); diff --git a/3rdParty/xcc/misc/null_ini_reader.h b/3rdParty/xcc/misc/null_ini_reader.h index 846b270..f1a8794 100644 --- a/3rdParty/xcc/misc/null_ini_reader.h +++ b/3rdParty/xcc/misc/null_ini_reader.h @@ -1,26 +1,26 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once #include "ini_reader.h" -class Cnull_ini_reader : public Cini_reader +class Cnull_ini_reader : public Cini_reader { public: int process_section_start(string_view) override @@ -33,13 +33,13 @@ public: { return true; } - + int process_key(string_view, string_view) override { return 0; } - bool is_valid() const + bool is_valid() const { return mc_sections; } diff --git a/3rdParty/xcc/misc/pal_file.cpp b/3rdParty/xcc/misc/pal_file.cpp index 801f245..f24a480 100644 --- a/3rdParty/xcc/misc/pal_file.cpp +++ b/3rdParty/xcc/misc/pal_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -26,8 +26,7 @@ bool Cpal_file::is_valid() const if (get_size() != sizeof(t_palet)) return false; const t_palet_entry* p = get_palet(); - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { if ((p[i].r | p[i].g | p[i].b) & 0xc0) return false; } diff --git a/3rdParty/xcc/misc/pal_file.h b/3rdParty/xcc/misc/pal_file.h index 9d57687..8444de8 100644 --- a/3rdParty/xcc/misc/pal_file.h +++ b/3rdParty/xcc/misc/pal_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/palet.cpp b/3rdParty/xcc/misc/palet.cpp index e24071b..0db1d9e 100644 --- a/3rdParty/xcc/misc/palet.cpp +++ b/3rdParty/xcc/misc/palet.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -25,8 +25,7 @@ void convert_image_8_to_24(const byte* s, byte* d, int cx, int cy, const t_palet const byte* r = s; byte* w = d; int c = cx * cy; - while (c--) - { + while (c--) { const t_palet_entry* v = palet + *r++; *w++ = v->r; *w++ = v->g; @@ -37,10 +36,8 @@ void convert_image_8_to_24(const byte* s, byte* d, int cx, int cy, const t_palet void create_downsample_table(const t_palet palet, byte* rp) { byte* rp_w = rp; - for (int b = 0; b < 0x40; b++) - { - for (int g = 0; g < 0x40; g++) - { + for (int b = 0; b < 0x40; b++) { + for (int g = 0; g < 0x40; g++) { for (int r = 0; r < 0x40; r++) *rp_w++ = find_color(r * 255 / 63, g * 255 / 63, b * 255 / 63, palet); } @@ -52,8 +49,7 @@ void convert_image_24_to_8(const byte* s, byte* d, int cx, int cy, const byte* r const byte* r = s; byte* w = d; int c = cx * cy; - while (c--) - { + while (c--) { int red = *r++ >> 2 & 0x3f; int green = *r++ >> 2 & 0x3f; int blue = *r++ >> 2 & 0x3f; @@ -66,8 +62,7 @@ void convert_image_24_to_8(const byte* s, byte* d, int cx, int cy, const t_palet const byte* r = s; byte* w = d; int c = cx * cy; - while (c--) - { + while (c--) { int red = *r++; int green = *r++; int blue = *r++; @@ -80,8 +75,7 @@ void downsample_image(const t_palet32entry* s, byte* d, int cx, int cy, const by const t_palet32entry* r = s; byte* w = d; int c = cx * cy; - while (c--) - { + while (c--) { t_palet32entry e = *r++; *w++ = e.a < 0x80 ? 0 : rp[e.r >> 2 | (e.g & 0xfc) << 4 | (e.b & 0xfc) << 10]; } @@ -92,8 +86,7 @@ void downsample_image(const t_palet32entry* s, byte* d, int cx, int cy, const t_ const t_palet32entry* r = s; byte* w = d; int c = cx * cy; - while (c--) - { + while (c--) { t_palet32entry e = *r++; if (e.a < 0x80) *w++ = 0; @@ -107,20 +100,16 @@ void upsample_image(const byte* s, t_palet32entry* d, int cx, int cy, const t_pa const byte* r = s; t_palet32entry* w = d; int c = cx * cy; - while (c--) - { + while (c--) { t_palet32entry& e = *w++; int z = *r++; - if (z) - { + if (z) { const t_palet_entry* v = palet + z; e.r = v->r; e.g = v->g; e.b = v->b; e.a = 0xff; - } - else - { + } else { e.r = 0x80; e.g = 0x80; e.b = 0x80; @@ -131,8 +120,7 @@ void upsample_image(const byte* s, t_palet32entry* d, int cx, int cy, const t_pa void convert_palet_18_to_24(const t_palet s, t_palet d) { - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { d[i].r = (s[i].r & 63) * 255 / 63; d[i].g = (s[i].g & 63) * 255 / 63; d[i].b = (s[i].b & 63) * 255 / 63; @@ -141,8 +129,7 @@ void convert_palet_18_to_24(const t_palet s, t_palet d) void convert_palet_24_to_18(const t_palet s, t_palet d) { - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { d[i].r = s[i].r >> 2; d[i].g = s[i].g >> 2; d[i].b = s[i].b >> 2; @@ -163,14 +150,12 @@ int find_color(int r, int g, int b, const t_palet p) { int best_i; int min_d = INT_MAX; - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { int d_r = p[i].r - r; int d_g = p[i].g - g; int d_b = p[i].b - b; int d = d_r * d_r + d_g * d_g + d_b * d_b; - if (d < min_d) - { + if (d < min_d) { min_d = d; best_i = i; } @@ -182,14 +167,12 @@ int find_color_t(int r, int g, int b, const t_palet p) { int best_i; int min_d = INT_MAX; - for (int i = 1; i < 256; i++) - { + for (int i = 1; i < 256; i++) { int d_r = p[i].r - r; int d_g = p[i].g - g; int d_b = p[i].b - b; int d = d_r * d_r + d_g * d_g + d_b * d_b; - if (d < min_d) - { + if (d < min_d) { min_d = d; best_i = i; } @@ -206,8 +189,7 @@ void create_rp(const t_palet s1, const t_palet s2, byte* d) void apply_rp(byte* d, int cb_d, const byte* rp) { - while (cb_d--) - { + while (cb_d--) { *d = rp[*d]; d++; } diff --git a/3rdParty/xcc/misc/palet.h b/3rdParty/xcc/misc/palet.h index 539fbab..595f823 100644 --- a/3rdParty/xcc/misc/palet.h +++ b/3rdParty/xcc/misc/palet.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/reg_key.cpp b/3rdParty/xcc/misc/reg_key.cpp index 93401e9..c562705 100644 --- a/3rdParty/xcc/misc/reg_key.cpp +++ b/3rdParty/xcc/misc/reg_key.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2006 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2006 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -74,15 +74,13 @@ LONG Creg_key::query_value(const string& name, string& value) LONG result = RegQueryValueExA(m_h, name.c_str(), NULL, NULL, NULL, &cb_d); if (result != ERROR_SUCCESS) return result; - if (!cb_d) - { + if (!cb_d) { value.erase(); return result; } vector d(cb_d); result = RegQueryValueExA(m_h, name.c_str(), NULL, NULL, &d.front(), &cb_d); - if (result == ERROR_SUCCESS) - { + if (result == ERROR_SUCCESS) { if (cb_d) value.assign(reinterpret_cast(&d.front()), cb_d - 1); else diff --git a/3rdParty/xcc/misc/reg_key.h b/3rdParty/xcc/misc/reg_key.h index d087766..0d04af5 100644 --- a/3rdParty/xcc/misc/reg_key.h +++ b/3rdParty/xcc/misc/reg_key.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2006 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2006 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/shp_decode.cpp b/3rdParty/xcc/misc/shp_decode.cpp index fd1402d..5f7840a 100644 --- a/3rdParty/xcc/misc/shp_decode.cpp +++ b/3rdParty/xcc/misc/shp_decode.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -25,24 +25,24 @@ static const char* encode64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const int decode64_table[256] = +static const int decode64_table[256] = { - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1 + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, + 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, + -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, + -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1 }; static int read_w(const byte*& r) @@ -60,12 +60,9 @@ static void write_w(int v, byte*& w) static void write_v40(byte v, int count, byte*& d) { - while (count) - { - if (v) - { - if (count < 0x100) - { + while (count) { + if (v) { + if (count < 0x100) { *d++ = 0x00; *d++ = count; *d++ = v; @@ -76,19 +73,15 @@ static void write_v40(byte v, int count, byte*& d) write_w(0xc000 | c_write, d); count -= c_write; *d++ = v; - } - else if (count < 0x80) - { + } else if (count < 0x80) { *d++ = 0x80 | count; count = 0; - } - else - { - int c_write = count < 0x8000 ? count : 0x7fff; + } else { + int c_write = count < 0x8000 ? count : 0x7fff; *d++ = 0x80; write_w(c_write, d); count -= c_write; - } + } } } @@ -143,63 +136,50 @@ static void write40_c5(byte*& w, int count) static void write40_copy(byte*& w, int count, const byte* r) { - while (count) - { - if (count < 0x80) - { + while (count) { + if (count < 0x80) { write40_c1(w, count, r); count = 0; - } - else - { + } else { int c_write = count < 0x4000 ? count : 0x3fff; write40_c3(w, c_write, r); r += c_write; - count -= c_write; + count -= c_write; } } } static void write40_fill(byte*& w, int count, int v) { - while (count) - { - if (count < 0x100) - { + while (count) { + if (count < 0x100) { write40_c0(w, count, v); count = 0; - } - else - { + } else { int c_write = count < 0x4000 ? count : 0x3fff; write40_c4(w, c_write, v); - count -= c_write; + count -= c_write; } } } static void write40_skip(byte*& w, int count) { - while (count) - { - if (count < 0x80) - { + while (count) { + if (count < 0x80) { write40_c5(w, count); count = 0; - } - else - { + } else { int c_write = count < 0x8000 ? count : 0x7fff; write40_c2(w, c_write); - count -= c_write; + count -= c_write; } } } static void flush_copy(byte*& w, const byte* r, const byte*& copy_from) { - if (copy_from) - { + if (copy_from) { write40_copy(w, r - copy_from, copy_from); copy_from = NULL; } @@ -219,22 +199,16 @@ int encode40(const byte* last_s, const byte* x, byte* d, int cb_s) const byte* r = s; byte* w = d; const byte* copy_from = NULL; - while (r < s_end) - { + while (r < s_end) { int v = *r; int t = get_run_length(r, s_end); - if (!v) - { - flush_copy(w, r, copy_from); + if (!v) { + flush_copy(w, r, copy_from); write40_skip(w, t); - } - else if (t > 2) - { - flush_copy(w, r, copy_from); + } else if (t > 2) { + flush_copy(w, r, copy_from); write40_fill(w, t, v); - } - else - { + } else { if (!copy_from) copy_from = r; } @@ -253,13 +227,11 @@ int encode40_y(const byte* last_r, const byte* r, byte* d, int cb_s) int count = 0; byte last = ~(*last_r ^ *r); - while (cb_s--) - { + while (cb_s--) { byte v = *last_r++ ^ *r++; if (last == v) count++; - else - { + else { write_v40(last, count, w); count = 1; last = v; @@ -277,8 +249,7 @@ int encode40_z(const byte* last_s, const byte* s, byte* d, int cb_s) const byte* last_r = last_s; const byte* r = s; byte* w = d; - while (cb_s) - { + while (cb_s) { int c_write = cb_s > 0x3fff ? 0x3fff : cb_s; cb_s -= c_write; *w++ = 0x80; @@ -288,7 +259,7 @@ int encode40_z(const byte* last_s, const byte* s, byte* d, int cb_s) *w++ = *last_r++ ^ *r++; } *w++ = 0x80; - *w++ = 0x00; + *w++ = 0x00; *w++ = 0x00; return w - d; } @@ -301,57 +272,42 @@ int decode40(const byte* s, byte* d) 2 skip 10000000 c 0ccccccc 3 copy 10000000 c 10cccccc 4 fill 10000000 c 11cccccc v - 5 skip 1ccccccc + 5 skip 1ccccccc */ const byte* r = s; byte* w = d; int count; - while (1) - { + while (1) { int code = *r++; - if (code & 0x80) - { - if (count = code & 0x7f) - { + if (code & 0x80) { + if (count = code & 0x7f) { w += count; - } - else - { + } else { count = *(uint16_t*)r; r += 2; code = count >> 8; - if (code & 0x80) - { + if (code & 0x80) { count &= 0x3fff; - if (code & 0x40) - { + if (code & 0x40) { code = *r++; while (count--) *w++ ^= code; - } - else - { + } else { while (count--) *w++ ^= *r++; } - } - else - { + } else { if (!count) break; w += count; - } + } } - } - else if (code) - { + } else if (code) { count = code; while (count--) *w++ ^= *r++; - } - else - { + } else { count = *r++; code = *r++; while (count--) @@ -363,14 +319,11 @@ int decode40(const byte* s, byte* d) static void write_v80(byte v, int count, byte*& d) { - if (count > 3) - { + if (count > 3) { *d++ = 0xfe; write_w(count, d); *d++ = v; - } - else if (count) - { + } else if (count) { *d++ = 0x80 | count; while (count--) *d++ = v; @@ -415,7 +368,7 @@ end_line: goto next_s; end0: - edi_ptr = reinterpret_cast(& cb_p); + edi_ptr = reinterpret_cast(&cb_p); *edi_ptr = ecx_value; // Restore registers } @@ -428,16 +381,14 @@ static void write80_c0(byte*& w, int count, int p) static void write80_c1(byte*& w, int count, const byte* r) { - do - { + do { int c_write = count < 0x40 ? count : 0x3f; *w++ = 0x80 | c_write; memcpy(w, r, c_write); r += c_write; w += c_write; count -= c_write; - } - while (count); + } while (count); } static void write80_c2(byte*& w, int count, int p) @@ -462,8 +413,7 @@ static void write80_c4(byte*& w, int count, int p) static void flush_c1(byte*& w, const byte* r, const byte*& copy_from) { - if (copy_from) - { + if (copy_from) { write80_c1(w, r - copy_from, copy_from); copy_from = NULL; } @@ -476,32 +426,25 @@ int encode80(const byte* s, byte* d, int cb_s) const byte* r = s; byte* w = d; const byte* copy_from = NULL; - while (r < s_end) - { + while (r < s_end) { byte* p; int cb_p; int t = get_run_length(r, s_end); get_same(s, r, s_end, p, cb_p); - if (t < cb_p && cb_p > 2) - { + if (t < cb_p && cb_p > 2) { flush_c1(w, r, copy_from); if (cb_p - 3 < 8 && r - p < 0x1000) write80_c0(w, cb_p, r - p); else if (cb_p - 3 < 0x3e) write80_c2(w, cb_p, p - s); - else - write80_c4(w, cb_p, p - s); + else + write80_c4(w, cb_p, p - s); r += cb_p; - } - else - { - if (t < 3) - { + } else { + if (t < 3) { if (!copy_from) copy_from = r; - } - else - { + } else { flush_c1(w, r, copy_from); write80_c3(w, t, *r); } @@ -521,18 +464,16 @@ int encode80_y(const byte* s, byte* d, int cb_s) int count = 0; byte last = ~*r; - while (cb_s--) - { + while (cb_s--) { byte v = *r++; if (last == v) count++; - else - { + else { write_v80(last, count, w); count = 1; last = v; } - + } write_v80(last, count, w); *w++ = 0x80; @@ -548,30 +489,25 @@ int decode80c(const byte image_in[], byte image_out[], int cb_in) 3 fill 11111110 c c v 4 copy 11111111 c c p p */ - + const byte* copyp; const byte* r = image_in; byte* w = image_out; int code; int count; - while (1) - { + while (1) { code = *r++; - if (~code & 0x80) - { + if (~code & 0x80) { //bit 7 = 0 //command 0 (0cccpppp p): copy count = (code >> 4) + 3; copyp = w - (((code & 0xf) << 8) + *r++); while (count--) *w++ = *copyp++; - } - else - { + } else { //bit 7 = 1 count = code & 0x3f; - if (~code & 0x40) - { + if (~code & 0x40) { //bit 6 = 0 if (!count) //end of image @@ -579,31 +515,24 @@ int decode80c(const byte image_in[], byte image_out[], int cb_in) //command 1 (10cccccc): copy while (count--) *w++ = *r++; - } - else - { + } else { //bit 6 = 1 - if (count < 0x3e) - { + if (count < 0x3e) { //command 2 (11cccccc p p): copy count += 3; copyp = &image_out[*(unsigned __int16*)r]; r += 2; while (count--) *w++ = *copyp++; - } - else - if (count == 0x3e) - { + } else + if (count == 0x3e) { //command 3 (11111110 c c v): fill count = *(unsigned __int16*)r; r += 2; code = *r++; while (count--) *w++ = byte(code); - } - else - { + } else { //command 4 (copy 11111111 c c p p): copy count = *(unsigned __int16*)r; r += 2; @@ -634,14 +563,11 @@ int __fastcall decode80(const byte image_in[], byte image_out[]) unsigned int v13; // ecx char v14; // al - for (i = image_out; ; i += v10) - { - while (1) - { + for (i = image_out; ; i += v10) { + while (1) { v4 = (unsigned __int8)*image_in; v5 = image_in + 1; - if ((v4 & 0x80) == 0) - { + if ((v4 & 0x80) == 0) { v6 = (v4 >> 4) + 3; v7 = (v4 & 0xF) << 8; v7 |= static_cast(*v5); @@ -654,23 +580,19 @@ int __fastcall decode80(const byte image_in[], byte image_out[]) break; v11 = *(unsigned __int16*)v5; v12 = v5 + 2; - if (v10 == 62) - { + if (v10 == 62) { v13 = v11; v14 = *v12; image_in = v12 + 1; memset(i, v14, v13); i += v13; - } else - { - if (v10 > 0x3E) - { + } else { + if (v10 > 0x3E) { v6 = v11; v11 = *reinterpret_cast(v12); v8 = v12 + 2; v9 = &image_out[v11]; - } else - { + } else { v8 = v12; v9 = &image_out[v11]; v6 = v10 + 3; @@ -704,14 +626,11 @@ int __fastcall decode80r(const byte image_in[], byte image_out[]) unsigned int v13; // ecx char v14; // al - for (i = image_out; ; i += v10) - { - while (1) - { + for (i = image_out; ; i += v10) { + while (1) { v4 = (unsigned __int8)*image_in; v5 = image_in + 1; - if ((v4 & 0x80) == 0) - { + if ((v4 & 0x80) == 0) { v6 = (v4 >> 4) + 3; v7 = (v4 & 0xF) << 8; v7 |= static_cast(*v5); @@ -724,23 +643,19 @@ int __fastcall decode80r(const byte image_in[], byte image_out[]) break; v11 = *(unsigned __int16*)v5; v12 = v5 + 2; - if (v10 == 62) - { + if (v10 == 62) { v13 = v11; v14 = *v12; image_in = v12 + 1; memset(i, v14, v13); i += v13; - } else - { - if (v10 > 0x3E) - { + } else { + if (v10 > 0x3E) { v6 = v11; v11 = *reinterpret_cast(v12); v8 = v12 + 2; v9 = &i[-v11]; - } else - { + } else { v8 = v12; v9 = &i[-v11]; v6 = v10 + 3; @@ -764,13 +679,11 @@ int decode2(const byte* s, byte* d, int cb_s, const byte* reference_palet) const byte* r = s; const byte* r_end = s + cb_s; byte* w = d; - while (r < r_end) - { + while (r < r_end) { int v = *r++; if (v) *w++ = v; - else - { + else { v = *r++; memset(w, 0, v); w += v; @@ -785,21 +698,16 @@ int decode3(const byte* s, byte* d, int cx, int cy) { const byte* r = s; byte* w = d; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { int count = *reinterpret_cast(r) - 2; r += 2; int x = 0; - while (count--) - { + while (count--) { int v = *r++; - if (v) - { + if (v) { x++; *w++ = v; - } - else - { + } else { count--; v = *r++; if (x + v > cx) @@ -817,20 +725,17 @@ int encode3(const byte* s, byte* d, int cx, int cy) { const byte* r = s; byte* w = d; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { const byte* r_end = r + cx; byte* w_line = w; w += 2; - while (r < r_end) - { - + while (r < r_end) { + int v = *r; *w++ = v; if (v) r++; - else - { + else { int c = get_run_length(r, r_end); if (c > 0xff) c = 0xff; @@ -848,71 +753,66 @@ Cvirtual_binary encode64(data_ref s) Cvirtual_binary d; const byte* r = s.data(); int cb_s = s.size(); - byte* w = d.write_start(s.size() << 1); - while (cb_s) - { + byte* w = d.write_start(s.size() << 1); + while (cb_s) { int c1 = *r++; - *w++ = encode64_table[c1>>2]; - + *w++ = encode64_table[c1 >> 2]; + int c2 = --cb_s == 0 ? 0 : *r++; - *w++ = encode64_table[((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)]; - if (cb_s == 0) - { + *w++ = encode64_table[((c1 & 0x3) << 4) | ((c2 & 0xf0) >> 4)]; + if (cb_s == 0) { *w++ = '='; *w++ = '='; break; } - + int c3 = --cb_s == 0 ? 0 : *r++; - + *w++ = encode64_table[((c2 & 0xf) << 2) | ((c3 & 0xc0) >> 6)]; - if (cb_s == 0) - { + if (cb_s == 0) { *w++ = '='; break; - } + } --cb_s; *w++ = encode64_table[c3 & 0x3f]; - } + } d.set_size(w - d.data()); - return d; + return d; } Cvirtual_binary decode64(data_ref s) { Cvirtual_binary d; const byte* r = s.data(); - byte* w = d.write_start(s.size() << 1); - while (*r) - { + byte* w = d.write_start(s.size() << 1); + while (*r) { int c1 = *r++; - if (decode64_table[c1] == -1) + if (decode64_table[c1] == -1) return Cvirtual_binary(); int c2 = *r++; - if (decode64_table[c2] == -1) + if (decode64_table[c2] == -1) return Cvirtual_binary(); int c3 = *r++; - if (c3 != '=' && decode64_table[c3] == -1) + if (c3 != '=' && decode64_table[c3] == -1) return Cvirtual_binary(); int c4 = *r++; - if (c4 != '=' && decode64_table[c4] == -1) + if (c4 != '=' && decode64_table[c4] == -1) return Cvirtual_binary(); *w++ = (decode64_table[c1] << 2) | (decode64_table[c2] >> 4); - if (c3 == '=') + if (c3 == '=') break; *w++ = ((decode64_table[c2] << 4) & 0xf0) | (decode64_table[c3] >> 2); - if (c4 == '=') + if (c4 == '=') break; *w++ = ((decode64_table[c3] << 6) & 0xc0) | decode64_table[c4]; - } + } d.set_size(w - d.data()); return d; } static void write5_count(byte*& w, int count) { - while (count > 255) - { + while (count > 255) { *w++ = 0; count -= 255; } @@ -923,8 +823,7 @@ static void write5_c0(byte*& w, int count, const byte* r, byte* small_copy) { if (count < 4 && !small_copy) count = count; - if ((count < 4 || count > 7) && small_copy) - { + if ((count < 4 || count > 7) && small_copy) { int small_count = min(count, 3); *small_copy |= small_count; memcpy(w, r, small_count); @@ -932,15 +831,12 @@ static void write5_c0(byte*& w, int count, const byte* r, byte* small_copy) w += small_count; count -= small_count; } - if (count) - { + if (count) { assert(count > 3); - if (count > 18) - { + if (count > 18) { *w++ = 0; write5_count(w, count - 18); - } - else + } else *w++ = count - 3; memcpy(w, r, count); w += count; @@ -953,12 +849,10 @@ static void write5_c1(byte*& w, int count, int p) assert(p >= 0); assert(p < 32768); count -= 2; - if (count > 7) - { + if (count > 7) { *w++ = 0x10 | (p >> 11) & 8; write5_count(w, count - 7); - } - else + } else *w++ = 0x10 | (p >> 11) & 8 | count; write_w((p << 2) & 0xfffc, w); } @@ -970,12 +864,10 @@ static void write5_c2(byte*& w, int count, int p) assert(p <= 16384); count -= 2; p--; - if (count > 31) - { + if (count > 31) { *w++ = 0x20; write5_count(w, count - 31); - } - else + } else *w++ = 0x20 | count; write_w(p << 2, w); } @@ -996,19 +888,16 @@ int get_count(const byte*& r) { int count = -255; int v; - do - { + do { count += 255; v = *r++; - } - while (!v); + } while (!v); return count + v; } static void flush_c0(byte*& w, const byte* r, const byte*& copy_from, byte* small_copy, bool start) { - if (copy_from) - { + if (copy_from) { int count = r - copy_from; /* if (start) @@ -1067,42 +956,34 @@ int decode5s(const byte* s, byte* d, int cb_s) 2 copy 001ccccc ppppppzz p 3 copy cccpppzz p */ - + const byte* c; const byte* r = s; byte* w = d; int code; int count; code = *r; - if (code > 17) - { + if (code > 17) { r++; count = code - 17; while (count--) *w++ = *r++; } - while (1) - { + while (1) { code = *r++; - if (code & 0xf0) - { - if (code & 0xc0) - { + if (code & 0xf0) { + if (code & 0xc0) { count = (code >> 5) - 1; c = w - (code >> 2 & 7); c -= *r++ << 3; c--; - } - else if (code & 0x20) - { + } else if (code & 0x20) { count = code & 0x1f; if (!count) count = get_count(r) + 31; c = w - (read_w(r) >> 2); c--; - } - else - { + } else { c = w - ((code & 8) << 11); count = code & 7; if (!count) @@ -1112,27 +993,22 @@ int decode5s(const byte* s, byte* d, int cb_s) break; } count += 2; - while (count--) - { + while (count--) { if (*w != *c) *w = *c; w++; c++; } count = *(r - 2) & 3; - while (count--) - { + while (count--) { if (*w != *r) *w = *r; w++; r++; } - } - else - { - count = code ? code + 3: get_count(r) + 18; - while (count--) - { + } else { + count = code ? code + 3 : get_count(r) + 18; + while (count--) { if (*w != *r) *w = *r; w++; @@ -1149,8 +1025,7 @@ int encode5(const byte* s, byte* d, int cb_s, int format) const byte* r = s; const byte* r_end = s + cb_s; byte* w = d; - while (r < r_end) - { + while (r < r_end) { int cb_section = min(r_end - r, 8192); t_pack_section_header& header = *reinterpret_cast(w); w += sizeof(t_pack_section_header); @@ -1165,8 +1040,7 @@ int decode5(const byte* s, byte* d, int cb_s, int format) const byte* r = s; const byte* r_end = s + cb_s; byte* w = d; - while (r < r_end) - { + while (r < r_end) { const t_pack_section_header& header = *reinterpret_cast(r); r += sizeof(t_pack_section_header); if (format == 80) diff --git a/3rdParty/xcc/misc/shp_decode.h b/3rdParty/xcc/misc/shp_decode.h index df17b2e..fecab01 100644 --- a/3rdParty/xcc/misc/shp_decode.h +++ b/3rdParty/xcc/misc/shp_decode.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/shp_ts_file.cpp b/3rdParty/xcc/misc/shp_ts_file.cpp index db60a92..6f505e6 100644 --- a/3rdParty/xcc/misc/shp_ts_file.cpp +++ b/3rdParty/xcc/misc/shp_ts_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -58,17 +58,14 @@ public: const int cx = m_f.get_cx(m_frame_i); const int cy = m_f.get_cy(m_frame_i); const byte* r; - if (m_f.is_compressed(m_frame_i)) - { + if (m_f.is_compressed(m_frame_i)) { decode3(m_f.get_image(m_frame_i), s.write_start(cx * cy), cx, cy); r = s.data(); - } - else + } else r = m_f.get_image(m_frame_i); memset(d, 0, cb_image()); byte* w = d + m_f.get_x(m_frame_i) + Cshp_ts_decoder::cx() * m_f.get_y(m_frame_i); - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { memcpy(w, r, cx); r += cx; w += Cshp_ts_decoder::cx(); @@ -109,13 +106,12 @@ bool Cshp_ts_file::is_valid() const { const t_shp_ts_header& h = header(); int size = get_size(); - if (sizeof(t_shp_ts_header) > size || + if (sizeof(t_shp_ts_header) > size || h.zero || - h.c_images < 1 || h.c_images > 10000 || + h.c_images < 1 || h.c_images > 10000 || sizeof(t_shp_ts_header) + get_cb_index() > size) return false; - for (int i = 0; i < min(cf(), 1000); i++) - { + for (int i = 0; i < min(cf(), 1000); i++) { const t_shp_ts_image_header& image_header = *get_image_header(i); if (!image_header.cx && !image_header.cy && !image_header.offset) continue; @@ -124,13 +120,10 @@ bool Cshp_ts_file::is_valid() const image_header.zero || image_header.offset < sizeof(t_shp_ts_header) + get_cb_index()) return false; - if (is_compressed(i)) - { + if (is_compressed(i)) { if (image_header.offset > size) return false; - } - else - { + } else { if (image_header.offset + image_header.cx * image_header.cy > size) return false; } @@ -152,55 +145,42 @@ int Cshp_ts_file::extract_as_pcx(const Cfname& name, t_file_type ft, const t_pal const int global_cx = cx(); const int global_cy = cy(); const int c_images = cf(); - if (combine_shadows && ~c_images & 1) - { + if (combine_shadows && ~c_images & 1) { bool shadow = false; byte* image = new byte[global_cx * global_cy]; byte* d = new byte[global_cx * global_cy * c_images >> 1]; byte* w = d; - for (int i = 0; i < c_images; i++) - { + for (int i = 0; i < c_images; i++) { const int cx = get_cx(i); const int cy = get_cy(i); const byte* r; - if (is_compressed(i)) - { + if (is_compressed(i)) { decode3(get_image(i), image, cx, cy); r = image; - } - else + } else r = get_image(i); - if (!shadow) - { - if (i == c_images >> 1) - { + if (!shadow) { + if (i == c_images >> 1) { shadow = true; w = d; - } - else + } else memset(w, 0, global_cx * global_cy); } byte* w_start = w; w += get_x(i) + global_cx * get_y(i); - for (int y = 0; y < cy; y++) - { - if (shadow) - { - for (int x = 0; x < cx; x++) - { + for (int y = 0; y < cy; y++) { + if (shadow) { + for (int x = 0; x < cx; x++) { if (*r++) w[x] = 4; } - } - else - { + } else { memcpy(w, r, cx); r += cx; } w += global_cx; } - if (shadow) - { + if (shadow) { Cfname t = name; t.set_title(name.get_ftitle() + " " + nwzl(4, i - (c_images >> 1))); error = image_file_write(t, ft, w_start, palet, global_cx, global_cy); @@ -211,27 +191,21 @@ int Cshp_ts_file::extract_as_pcx(const Cfname& name, t_file_type ft, const t_pal } delete[] d; delete[] image; - } - else - { + } else { byte* image = new byte[global_cx * global_cy]; byte* s = new byte[global_cx * global_cy]; - for (int i = 0; i < c_images; i++) - { + for (int i = 0; i < c_images; i++) { const int cx = get_cx(i); const int cy = get_cy(i); const byte* r; - if (is_compressed(i)) - { + if (is_compressed(i)) { decode3(get_image(i), image, cx, cy); r = image; - } - else + } else r = get_image(i); memset(s, 0, global_cx * global_cy); byte* w = s + get_x(i) + global_cx * get_y(i); - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { memcpy(w, r, cx); r += cx; w += global_cx; @@ -266,62 +240,47 @@ Cvirtual_image Cshp_ts_file::extract_as_pcx_single(const t_palet _palet, bool co Cvirtual_binary image; Cvirtual_binary s; memset(s.write_start(cx_s * cy_s), 0, cx_s * cy_s); - if (combine_shadows) - { + if (combine_shadows) { c_images <<= 1; bool shadow = false; - for (int i = 0; i < c_images; i++) - { + for (int i = 0; i < c_images; i++) { const int cx = get_cx(i); const int cy = get_cy(i); const byte* r; - if (is_compressed(i)) - { + if (is_compressed(i)) { decode3(get_image(i), image.write_start(global_cx * global_cy), cx, cy); r = image.data(); - } - else + } else r = get_image(i); if (!shadow && i == c_images >> 1) shadow = true; int j = i % (c_images >> 1); byte* w = s.data_edit() + get_ofs(j % cblocks_x * global_cx + get_x(i), j / cblocks_x * global_cy + get_y(i), cx_s, cy_s); - for (int y = 0; y < cy; y++) - { - if (shadow) - { - for (int x = 0; x < cx; x++) - { + for (int y = 0; y < cy; y++) { + if (shadow) { + for (int x = 0; x < cx; x++) { if (*r++) w[x] = 4; } - } - else - { + } else { memcpy(w, r, cx); r += cx; } w += cx_s; } } - } - else - { - for (int i = 0; i < c_images; i++) - { + } else { + for (int i = 0; i < c_images; i++) { const int cx = get_cx(i); const int cy = get_cy(i); const byte* r; - if (is_compressed(i)) - { + if (is_compressed(i)) { decode3(get_image(i), image.write_start(global_cx * global_cy), cx, cy); r = image.data(); - } - else + } else r = get_image(i); byte* w = s.data_edit() + get_ofs(i % cblocks_x * global_cx + get_x(i), i / cblocks_x * global_cy + get_y(i), cx_s, cy_s); - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { memcpy(w, r, cx); r += cx; w += cx_s; @@ -340,13 +299,10 @@ void shp_split_frames(Cvirtual_image& image, int cblocks_x, int cblocks_y) byte* d = new byte[cx_d * cy_d]; byte* w = d; const byte* r_line = image.image(); - for (int yb = 0; yb < cblocks_y; yb++) - { - for (int xb = 0; xb < cblocks_x; xb++) - { + for (int yb = 0; yb < cblocks_y; yb++) { + for (int xb = 0; xb < cblocks_x; xb++) { const byte* r = r_line + cx * xb; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { memcpy(w, r, cx); r += image.cx(); w += cx_d; @@ -364,18 +320,15 @@ void shp_split_shadows(Cvirtual_image& image) int cy = image.cy(); int count = cx * cy; byte* d = new byte[count << 1]; - memcpy(d, image.image(), count); + memcpy(d, image.image(), count); byte* r = d; byte* w = d + count; - while (count--) - { + while (count--) { byte& v = *r++; - if (v == 4) - { + if (v == 4) { v = 0; *w++ = 1; - } - else + } else *w++ = 0; } image.load(d, cx, cy << 1, image.cb_pixel(), image.palet()); @@ -432,11 +385,9 @@ static int encode4_line(const byte* r, byte* d, int cx) { const byte* s_end = r + cx; byte* w = d; - while (r < s_end) - { + while (r < s_end) { int v = *w++ = *r++; - if (!v) - { + if (!v) { int c = min(get_run_length(r - 1, s_end), 0xff); r += c - 1; *w++ = c; @@ -448,11 +399,9 @@ static int encode4_line(const byte* r, byte* d, int cx) static int decode4_line_size(const byte*& r, int cx) { int w = 0; - while (cx--) - { + while (cx--) { w++; - if (!*r++) - { + if (!*r++) { cx -= *r++ - 1; w++; } @@ -463,8 +412,7 @@ static int decode4_line_size(const byte*& r, int cx) static int decode4_line(const byte* s, byte*& w, int cx) { const byte* r = s; - while (cx--) - { + while (cx--) { if (!(*w++ = *r++)) cx -= (*w++ = *r++) - 1; } @@ -476,8 +424,7 @@ static int encode4(const byte* s, byte* d, int cx, int cy) const byte* s_end = s + cx * cy; const byte* r = s; byte* w = d; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { int lm = min(get_left_margin(r, cx), 0xff); int rm = min(get_right_margin(r + cx, cx - lm), 0xff); *w++ = lm; @@ -491,8 +438,7 @@ static int encode4(const byte* s, byte* d, int cx, int cy) static int decode4_size(const byte*& r, int cx, int cy) { int w = 0; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { int lm = *r++; int rm = *r++; w += 2; @@ -508,20 +454,17 @@ static int decode4_size(const byte*& r, int cx, int cy) static int decode4(const byte* s, byte*& w, int cx, int cy) { const byte* r = s; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { int lm = *r++; int rm = *r++; byte* w_line = w; w += 2; - if (lm) - { + if (lm) { *w++ = 0; *w++ = lm; } r += decode4_line(r, w, cx - lm - rm); - if (rm) - { + if (rm) { *w++ = 0; *w++ = rm; } @@ -558,21 +501,17 @@ int shp_encode4(const Cshp_ts_file& f, byte* d) header.c_frames = c_frames; w += sizeof(t_shp4_header); - for (int i = 0; i < c_frames; i++) - { + for (int i = 0; i < c_frames; i++) { const t_shp_ts_image_header& image_header = *f.get_image_header(i); const int cx = image_header.cx; const int cy = image_header.cy; t_shp4_frame_header& frame_header = *reinterpret_cast(w); - if (image_header.cx && image_header.cy) - { + if (image_header.cx && image_header.cy) { frame_header.lm = image_header.x; frame_header.tm = image_header.y; - } - else - { + } else { frame_header.lm = min(global_cx, 0xff); frame_header.tm = min(global_cy, 0xff); } @@ -583,13 +522,11 @@ int shp_encode4(const Cshp_ts_file& f, byte* d) frame_header.bm = global_cy - frame_header.tm - cy; w += sizeof(t_shp4_frame_header); - if (f.is_compressed(i)) - { + if (f.is_compressed(i)) { Cvirtual_binary image; decode3(f.get_image(i), image.write_start(cx * cy), cx, cy); w += encode4(image.data(), w, cx, cy); - } - else + } else w += encode4(f.get_image(i), w, cx, cy); } return w - d; @@ -605,8 +542,7 @@ int shp_decode4_size(const byte* s) const int c_frames = s_header.c_frames; r += sizeof(t_shp4_header); int w = 0; - for (int i = 0; i < c_frames; i++) - { + for (int i = 0; i < c_frames; i++) { const t_shp4_frame_header& frame_header = *reinterpret_cast(r); int x = frame_header.lm; int y = frame_header.tm; @@ -639,8 +575,7 @@ Cvirtual_binary shp_decode4(const byte* s, int cb_d) header.c_images = c_frames; w += sizeof(t_shp_ts_header); byte* w1 = w + c_frames * sizeof(t_shp_ts_image_header); - for (int i = 0; i < c_frames; i++) - { + for (int i = 0; i < c_frames; i++) { const t_shp4_frame_header& frame_header = *reinterpret_cast(r); int x = frame_header.lm; int y = frame_header.tm; diff --git a/3rdParty/xcc/misc/shp_ts_file.h b/3rdParty/xcc/misc/shp_ts_file.h index 76261cd..8ad3e2d 100644 --- a/3rdParty/xcc/misc/shp_ts_file.h +++ b/3rdParty/xcc/misc/shp_ts_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -24,7 +24,7 @@ #include "video_file.h" #include "virtual_image.h" -class Cshp_ts_file : public Cvideo_file +class Cshp_ts_file : public Cvideo_file { public: Cvideo_decoder* decoder(const t_palet_entry*); @@ -74,10 +74,10 @@ public: return get_image_header(i)->cy; } - int get_cb_index() const - { - return sizeof(t_shp_ts_image_header) * cf(); - } + int get_cb_index() const + { + return sizeof(t_shp_ts_image_header) * cf(); + } bool is_compressed(int i) const { diff --git a/3rdParty/xcc/misc/string_conversion.cpp b/3rdParty/xcc/misc/string_conversion.cpp index e1c1eff..3f6003d 100644 --- a/3rdParty/xcc/misc/string_conversion.cpp +++ b/3rdParty/xcc/misc/string_conversion.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -27,8 +27,7 @@ int a2ip(const string& s) { int r = 0; int l = 0; - for (int i = 0; i < 3; i++) - { + for (int i = 0; i < 3; i++) { int c = s.find('.', l); r = r << 8 | atoi(s.substr(l, c - l).c_str()); l = c + 1; @@ -117,8 +116,7 @@ string nh(int l, __int64 v) { string s; int w; - while (l) - { + while (l) { w = v & 0xf; if (w > 9) w += 7; @@ -133,16 +131,12 @@ string nwp(int l, unsigned int v) { string r; string s = n(v); - while (1) - { + while (1) { int l = s.size(); - if (l > 3) - { + if (l > 3) { r = '.' + s.substr(l - 3, 3) + r; s.erase(l - 3, 3); - } - else - { + } else { r = s + r; break; } @@ -154,13 +148,10 @@ string nwp(int l, unsigned int v) void split_key(const string& key, string& name, string& value) { size_t i = key.find('='); - if (i == string::npos) - { + if (i == string::npos) { name = key; value.erase(); - } - else - { + } else { name = key.substr(0, i); value = key.substr(i + 1); } @@ -169,16 +160,13 @@ void split_key(const string& key, string& name, string& value) string tabs2spaces(const string& v) { string r; - for (size_t i = 0; i < v.size(); i++) - { + for (size_t i = 0; i < v.size(); i++) { char c = v[i]; - if (c == '\t') - { + if (c == '\t') { do r += ' '; while (r.size() & 3); - } - else + } else r += c; } return r; @@ -198,10 +186,8 @@ string time2a(time_t v) string js_encode(const string& v) { string r; - for (size_t i = 0; i < v.size(); i++) - { - switch (v[i]) - { + for (size_t i = 0; i < v.size(); i++) { + switch (v[i]) { case '<': r += "<"; break; @@ -220,16 +206,13 @@ string trim_field(const string& v) { string r; bool copy_white = false; - for (size_t i = 0; i < v.size(); i++) - { + for (size_t i = 0; i < v.size(); i++) { if (isspace(v[i])) copy_white = true; - else - { - if (copy_white) - { + else { + if (copy_white) { if (!r.empty()) - r += ' '; + r += ' '; copy_white = false; } r += v[i]; @@ -242,18 +225,15 @@ string trim_text(const string& v) { string r; bool copy_white = false; - for (size_t i = 0; i < v.size(); ) - { + for (size_t i = 0; i < v.size(); ) { int p = v.find('\n', i); if (p == string::npos) p = v.size(); string line = trim_field(v.substr(i, p - i)); if (line.empty()) copy_white = true; - else - { - if (copy_white) - { + else { + if (copy_white) { if (!r.empty()) r += '\n'; copy_white = false; diff --git a/3rdParty/xcc/misc/string_conversion.h b/3rdParty/xcc/misc/string_conversion.h index 8271255..e8936fb 100644 --- a/3rdParty/xcc/misc/string_conversion.h +++ b/3rdParty/xcc/misc/string_conversion.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/tmp_file.h b/3rdParty/xcc/misc/tmp_file.h index da7334e..53647e2 100644 --- a/3rdParty/xcc/misc/tmp_file.h +++ b/3rdParty/xcc/misc/tmp_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -21,16 +21,16 @@ #include #include -class Ctmp_file : public Ccc_file_sh +class Ctmp_file : public Ccc_file_sh { public: bool is_valid() const { const t_tmp_header& h = header(); int size = get_size(); - return !(sizeof(t_tmp_header) > size || - h.cx != 24 || - h.cy != 24 || + return !(sizeof(t_tmp_header) > size || + h.cx != 24 || + h.cy != 24 || h.c_tiles > 128 || h.zero1 || h.size != size || diff --git a/3rdParty/xcc/misc/tmp_ts_file.cpp b/3rdParty/xcc/misc/tmp_ts_file.cpp index 4347f86..7b18000 100644 --- a/3rdParty/xcc/misc/tmp_ts_file.cpp +++ b/3rdParty/xcc/misc/tmp_ts_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -26,20 +26,17 @@ void Ctmp_ts_file::get_rect(int& x, int& y, int& cx, int& cy) const x = INT_MAX; y = INT_MAX; cx = INT_MIN; - cy = INT_MIN; + cy = INT_MIN; int bigy = INT_MIN; int bigyval = 0; - for (int i = 0; i < get_c_tiles(); i++) - { - if (get_index()[i]) - { + for (int i = 0; i < get_c_tiles(); i++) { + if (get_index()[i]) { int height = get_height() - get_height(i); int x_t = get_x(i); int y_t = get_y(i) + (height * (get_cy() / 2)); int x2_t = x_t + get_cx(); int y2_t = y_t + get_cy(); - if (has_extra_graphics(i)) - { + if (has_extra_graphics(i)) { int y_t_extra = get_y_extra(i) + (height * (get_cy() / 2)); int y2_t_extra = y_t_extra + get_cy_extra(i); if (y_t_extra < y) @@ -55,8 +52,7 @@ void Ctmp_ts_file::get_rect(int& x, int& y, int& cx, int& cy) const y = y_t; if (y2_t > cy) cy = y2_t; - if (bigy < get_y(i)) - { + if (bigy < get_y(i)) { bigy = get_y(i); bigyval = get_y(i) + get_cy() + (get_height(i) * (get_cy() / 2)); if (has_extra_graphics(i)) @@ -75,43 +71,36 @@ void Ctmp_ts_file::draw(byte* d) const int global_x, global_y, global_cx, global_cy; get_rect(global_x, global_y, global_cx, global_cy); memset(d, 0, global_cx * global_cy); - for (int i = 0; i < get_c_tiles(); i++) - { - if (get_index()[i]) - { + for (int i = 0; i < get_c_tiles(); i++) { + if (get_index()[i]) { int height = get_height() - get_height(i); const byte* r = get_image(i); byte* w_line = d + get_x(i) - global_x + global_cx * (get_y(i) - global_y + (height * (get_cy() / 2))); int x = get_cx() / 2; int cx = 0; int y = 0; - for (; y < get_cy() / 2; y++) - { + for (; y < get_cy() / 2; y++) { cx += 4; x -= 2; memcpy(w_line + x, r, cx); r += cx; w_line += global_cx; } - for (; y < get_cy(); y++) - { + for (; y < get_cy(); y++) { cx -= 4; x += 2; memcpy(w_line + x, r, cx); r += cx; w_line += global_cx; } - if (has_extra_graphics(i)) - { + if (has_extra_graphics(i)) { r += get_cx() * get_cy() / 2; w_line = d + get_x_extra(i) - global_x + global_cx * (get_y_extra(i) - global_y + (height * (get_cy() / 2))); int cx = get_cx_extra(i); int cy = get_cy_extra(i); - for (y = 0; y < cy; y++) - { + for (y = 0; y < cy; y++) { byte* w = w_line; - for (int i = 0; i < cx; i++) - { + for (int i = 0; i < cx; i++) { int v = *r++; if (v) *w = v; @@ -133,16 +122,14 @@ int decode_tile(const byte* s, byte* d, int cx_d) int x = cx_d / 2; int cx = 0; int y = 0; - for (; y < cy / 2; y++) - { + for (; y < cy / 2; y++) { cx += 4; x -= 2; memcpy(w + x, r, cx); r += cx; w += cx_d; } - for (; y < cy; y++) - { + for (; y < cy; y++) { cx -= 4; x += 2; memcpy(w + x, r, cx); @@ -160,16 +147,14 @@ int encode_tile(const byte* s, byte* d, int cx_s) int x = cx_s / 2; int cx = 0; int y = 0; - for (; y < cy / 2; y++) - { + for (; y < cy / 2; y++) { cx += 4; x -= 2; memcpy(w, r + x, cx); r += cx_s; w += cx; } - for (; y < cy; y++) - { + for (; y < cy; y++) { cx -= 4; x += 2; memcpy(w, r + x, cx); diff --git a/3rdParty/xcc/misc/tmp_ts_file.h b/3rdParty/xcc/misc/tmp_ts_file.h index 8d6e702..c40bca6 100644 --- a/3rdParty/xcc/misc/tmp_ts_file.h +++ b/3rdParty/xcc/misc/tmp_ts_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -35,16 +35,14 @@ public: { const t_tmp_ts_header& h = header(); auto const size = get_size(); - if (sizeof(t_tmp_ts_header) > size || + if (sizeof(t_tmp_ts_header) > size || !h.cblocks_x || !h.cblocks_y || h.cx != 48 && h.cx != 60 || 2 * h.cy != h.cx || sizeof(t_tmp_ts_header) + 4 * get_c_tiles() > size) return false; - for (int i = 0; i < min(get_c_tiles(), 64); i++) - { - if (get_index()[i]) - { + for (int i = 0; i < min(get_c_tiles(), 64); i++) { + if (get_index()[i]) { const t_tmp_image_header& image_header = *get_image_header(i); } } @@ -114,14 +112,12 @@ public: { return get_image_header(i)->x_extra; } - + int get_height() const { int height = 0; - for (int i = 0; i < get_c_tiles(); i++) - { - if (get_index()[i]) - { + for (int i = 0; i < get_c_tiles(); i++) { + if (get_index()[i]) { if (get_height(i) > height) height = get_height(i); } @@ -188,7 +184,7 @@ public: assert(a == b); return data() + get_index()[i] + get_image_header(i)->z_ofs; } - + const byte* get_extra_data(int i) const { return data() + get_index()[i] + get_image_header(i)->extra_ofs; diff --git a/3rdParty/xcc/misc/vartypes.h b/3rdParty/xcc/misc/vartypes.h index 8f6482c..812533d 100644 --- a/3rdParty/xcc/misc/vartypes.h +++ b/3rdParty/xcc/misc/vartypes.h @@ -1,20 +1,20 @@ #pragma once /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include diff --git a/3rdParty/xcc/misc/video_decoder.cpp b/3rdParty/xcc/misc/video_decoder.cpp index 8366838..fc8c567 100644 --- a/3rdParty/xcc/misc/video_decoder.cpp +++ b/3rdParty/xcc/misc/video_decoder.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" diff --git a/3rdParty/xcc/misc/virtual_audio.cpp b/3rdParty/xcc/misc/virtual_audio.cpp index 410ae76..281f5fd 100644 --- a/3rdParty/xcc/misc/virtual_audio.cpp +++ b/3rdParty/xcc/misc/virtual_audio.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2001 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2001 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" diff --git a/3rdParty/xcc/misc/virtual_audio.h b/3rdParty/xcc/misc/virtual_audio.h index 6cc6de8..0af589c 100644 --- a/3rdParty/xcc/misc/virtual_audio.h +++ b/3rdParty/xcc/misc/virtual_audio.h @@ -1,26 +1,26 @@ /* - XCC Utilities and Library - Copyright (C) 2001 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2001 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once #include "virtual_file.h" -class Cvirtual_audio +class Cvirtual_audio { public: void load(Cvirtual_file f, int c_samples, int samplerate, int cb_sample, int c_channels); diff --git a/3rdParty/xcc/misc/virtual_binary.cpp b/3rdParty/xcc/misc/virtual_binary.cpp index 7d3ebcb..29e9847 100644 --- a/3rdParty/xcc/misc/virtual_binary.cpp +++ b/3rdParty/xcc/misc/virtual_binary.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2001 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2001 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -23,14 +23,11 @@ Cvirtual_binary_source::Cvirtual_binary_source(const void* d, size_t cb_d, const std::shared_ptr& source) { - if (source) - { + if (source) { m_data = const_cast(reinterpret_cast(d)); m_size = cb_d; m_source = source; - } - else - { + } else { m_data = new byte[cb_d]; m_size = cb_d; if (d) @@ -62,7 +59,7 @@ Cvirtual_binary_source* Cvirtual_binary_source::pre_edit() Cvirtual_binary_source* t = new Cvirtual_binary_source(m_data, m_size, NULL); detach(); return t; -} +} Cvirtual_binary::Cvirtual_binary() { @@ -102,8 +99,7 @@ Cvirtual_binary::~Cvirtual_binary() const Cvirtual_binary& Cvirtual_binary::operator=(const Cvirtual_binary& v) { - if (this != &v) - { + if (this != &v) { m_source->detach(); m_source = v.m_source->attach(); } @@ -119,11 +115,10 @@ int Cvirtual_binary::load(const string& fname, bool use_mm) { if (use_mm) *this = file32_read(fname); - else - { - Cvirtual_binary d = file32_read(fname); - *this = Cvirtual_binary(d.data(), d.size()); - } + else { + Cvirtual_binary d = file32_read(fname); + *this = Cvirtual_binary(d.data(), d.size()); + } return !data(); } diff --git a/3rdParty/xcc/misc/virtual_binary.h b/3rdParty/xcc/misc/virtual_binary.h index 9771175..07a3f52 100644 --- a/3rdParty/xcc/misc/virtual_binary.h +++ b/3rdParty/xcc/misc/virtual_binary.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2001 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2001 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -61,10 +61,10 @@ public: m_size = v; } - bool unique() const - { - return mc_references == 1; - } + bool unique() const + { + return mc_references == 1; + } private: byte* m_data; size_t m_size; @@ -102,15 +102,15 @@ public: return m_source ? m_source->data_end() : NULL; } - const byte* begin() const - { - return data(); - } + const byte* begin() const + { + return data(); + } - const byte* end() const - { - return data_end(); - } + const byte* end() const + { + return data_end(); + } byte* data_edit() { diff --git a/3rdParty/xcc/misc/virtual_file.cpp b/3rdParty/xcc/misc/virtual_file.cpp index ba70183..c7e8868 100644 --- a/3rdParty/xcc/misc/virtual_file.cpp +++ b/3rdParty/xcc/misc/virtual_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -55,7 +55,7 @@ int Cvirtual_file::size() const { int r = 0; for (auto& i : m_data) - r += i.size(); + r += i.size(); return r; } @@ -63,8 +63,7 @@ int Cvirtual_file::save(const string& fname) const { Cfile32 f; int error = f.open_write(fname); - if (!error) - { + if (!error) { for (auto& i : m_data) error = f.write(i); } diff --git a/3rdParty/xcc/misc/virtual_file.h b/3rdParty/xcc/misc/virtual_file.h index 2a4637e..5c5ef78 100644 --- a/3rdParty/xcc/misc/virtual_file.h +++ b/3rdParty/xcc/misc/virtual_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -23,7 +23,7 @@ using namespace std; -class Cvirtual_file +class Cvirtual_file { public: int save(const string& fname) const; diff --git a/3rdParty/xcc/misc/virtual_image.cpp b/3rdParty/xcc/misc/virtual_image.cpp index 456ea2d..c3dc02b 100644 --- a/3rdParty/xcc/misc/virtual_image.cpp +++ b/3rdParty/xcc/misc/virtual_image.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -47,13 +47,11 @@ Cvirtual_image::Cvirtual_image(const void* image, int cx, int cy, int cb_pixel, const Cvirtual_image& Cvirtual_image::palet(const t_palet_entry* palet, bool inflate) { - if (palet) - { + if (palet) { memcpy(m_palet.write_start(sizeof(t_palet)), palet, sizeof(t_palet)); if (inflate) convert_palet_18_to_24(reinterpret_cast(m_palet.data_edit())); - } - else + } else m_palet.clear(); return *this; } @@ -99,25 +97,21 @@ int Cvirtual_image::load(const Cvirtual_binary& s) return png_f.decode(*this); else if (tga_f.load(s), tga_f.is_valid()) return tga_f.decode(*this); - else - { + else { IStream* is = SHCreateMemStream(s.data(), s.size()); Gdiplus::Bitmap bmp(is); is->Release(); if (bmp.GetLastStatus() != Ok) return 1; PixelFormat pf = bmp.GetPixelFormat(); - if (bmp.GetPixelFormat() & PixelFormatIndexed) - { + if (bmp.GetPixelFormat() & PixelFormatIndexed) { load(NULL, bmp.GetWidth(), bmp.GetHeight(), 1, NULL); BitmapData d; d.Stride = bmp.GetWidth(); d.Scan0 = image_edit(); bmp.LockBits(NULL, ImageLockModeRead | ImageLockModeUserInputBuf, PixelFormat8bppIndexed, &d); bmp.UnlockBits(&d); - } - else - { + } else { load(NULL, bmp.GetWidth(), bmp.GetHeight(), 3, NULL); BitmapData d; d.Stride = bmp.GetWidth() * 3; @@ -163,8 +157,7 @@ void Cvirtual_image::swap_rb() { int count = m_cx * m_cy; t_palet_entry* r = reinterpret_cast(m_image.data_edit()); - while (count--) - { + while (count--) { swap(r->r, r->b); r++; } @@ -175,8 +168,7 @@ static void flip_frame(const byte* s, byte* d, int cx, int cy, int cb_pixel) int cb_line = cx * cb_pixel; const byte* r = s; byte* w = d + cb_line * cy; - while (cy--) - { + while (cy--) { w -= cb_line; memcpy(w, r, cb_line); r += cb_line; @@ -200,8 +192,7 @@ void Cvirtual_image::cb_pixel(int cb_pixel, const t_palet_entry* palet) void Cvirtual_image::decrease_color_depth(int new_cb_pixel, const t_palet_entry* palet) { - if (new_cb_pixel == 3) - { + if (new_cb_pixel == 3) { remove_alpha(); return; } @@ -211,21 +202,16 @@ void Cvirtual_image::decrease_color_depth(int new_cb_pixel, const t_palet_entry* load(NULL, cx(), cy(), new_cb_pixel, palet); byte* w = image_edit(); int count = m_cx * m_cy; - if (old_cb_pixel == 3) - { + if (old_cb_pixel == 3) { const t_palet_entry* r = reinterpret_cast(t.data()); - while (count--) - { + while (count--) { *w++ = find_color(r->r, r->g, r->b, palet); r++; } - } - else - { + } else { assert(old_cb_pixel == 4); const t_palet32entry* r = reinterpret_cast(t.data()); - while (count--) - { + while (count--) { *w++ = r->a < 0x80 ? find_color(r->r, r->g, r->b, palet) : 0; r++; } @@ -254,8 +240,7 @@ static t_palet32entry p32e(const t_palet palet, int i) void Cvirtual_image::increase_color_depth(int new_cb_pixel) { - if (cb_pixel() == 3) - { + if (cb_pixel() == 3) { if (new_cb_pixel == 4) add_alpha(); return; @@ -265,14 +250,11 @@ void Cvirtual_image::increase_color_depth(int new_cb_pixel) const byte* r = t.image(); load(NULL, cx(), cy(), new_cb_pixel, NULL); int count = m_cx * m_cy; - if (cb_pixel() == 3) - { + if (cb_pixel() == 3) { t_palet_entry* w = reinterpret_cast(image_edit()); while (count--) *w++ = t.palet()[*r++]; - } - else - { + } else { assert(cb_pixel() == 4); t_palet32entry* w = reinterpret_cast(image_edit()); while (count--) @@ -288,8 +270,7 @@ void Cvirtual_image::add_alpha() int count = m_cx * m_cy; const byte* r = t.data(); byte* w = image_edit(); - while (count--) - { + while (count--) { *w++ = *r++; *w++ = *r++; *w++ = *r++; @@ -306,8 +287,7 @@ void Cvirtual_image::remove_alpha() int count = m_cx * m_cy; const byte* r = t.data(); byte* w = image_edit(); - while (count--) - { + while (count--) { *w++ = *r++; *w++ = *r++; *w++ = *r++; @@ -321,8 +301,7 @@ void Cvirtual_image::increase_palet_depth() Cvirtual_binary t = m_palet; const t_palet_entry* s = reinterpret_cast(t.data()); t_palet_entry* d = reinterpret_cast(t.data_edit()); - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { d[i].r = (s[i].r & 63) * 255 / 63; d[i].g = (s[i].g & 63) * 255 / 63; d[i].b = (s[i].b & 63) * 255 / 63; diff --git a/3rdParty/xcc/misc/virtual_image.h b/3rdParty/xcc/misc/virtual_image.h index 0a2a2d6..61ce8e8 100644 --- a/3rdParty/xcc/misc/virtual_image.h +++ b/3rdParty/xcc/misc/virtual_image.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -109,7 +109,7 @@ public: { return reinterpret_cast(m_image.data())[ofs8(x, y)]; } - + void pixel24(int x, int y, t_palet_entry v) { reinterpret_cast(m_image.data_edit())[ofs8(x, y)] = v; diff --git a/3rdParty/xcc/misc/virtual_tfile.cpp b/3rdParty/xcc/misc/virtual_tfile.cpp index c1965f6..b92aa04 100644 --- a/3rdParty/xcc/misc/virtual_tfile.cpp +++ b/3rdParty/xcc/misc/virtual_tfile.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -30,10 +30,8 @@ string Cvirtual_tfile::read_line() assert(data()); const int first_non_ws = pos; int last_non_ws; - while (pos < size()) - { - switch (data()[pos++]) - { + while (pos < size()) { + switch (data()[pos++]) { case '\r': last_non_ws = pos - 2; if (pos < size() && data()[pos] == '\n') @@ -55,10 +53,8 @@ string Cvirtual_tfile::read_line(bool remove_ws) assert(data()); int first_non_ws; int last_non_ws; - while (pos < size()) - { - switch (data()[pos++]) - { + while (pos < size()) { + switch (data()[pos++]) { case '\r': if (pos < size() && data()[pos] == '\n') pos++; @@ -70,10 +66,8 @@ string Cvirtual_tfile::read_line(bool remove_ws) default: first_non_ws = pos - 1; last_non_ws = pos - 2; - while (pos < size()) - { - switch (data()[pos++]) - { + while (pos < size()) { + switch (data()[pos++]) { case '\r': if (pos < size() && data()[pos] == '\n') pos++; diff --git a/3rdParty/xcc/misc/virtual_tfile.h b/3rdParty/xcc/misc/virtual_tfile.h index 812b5aa..e958c5d 100644 --- a/3rdParty/xcc/misc/virtual_tfile.h +++ b/3rdParty/xcc/misc/virtual_tfile.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/vxl_file.cpp b/3rdParty/xcc/misc/vxl_file.cpp index a629aa1..df10138 100644 --- a/3rdParty/xcc/misc/vxl_file.cpp +++ b/3rdParty/xcc/misc/vxl_file.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -30,7 +30,7 @@ bool Cvxl_file::is_valid() const { - int size = get_size(); + int size = get_size(); const t_vxl_header& h = header(); if (sizeof(t_vxl_header) > size || strcmp(h.id, vxl_id) || @@ -47,7 +47,7 @@ bool Cvxl_file::is_valid() const if (section_header.one != 1 || section_header.zero || section_tailer.span_end_ofs - section_tailer.span_start_ofs != section_tailer.span_data_ofs - section_tailer.span_end_ofs) - return false; + return false; } */ return true; @@ -64,24 +64,18 @@ int Cvxl_file::extract_as_pcx(const Cfname& name, t_file_type ft, const t_palet const int cy = section_tailer.cy; const int cz = section_tailer.cz; Cvirtual_binary s; - for (int i = 0; i < cz; i++) - { + for (int i = 0; i < cz; i++) { memset(s.write_start(cx * cy), 0, cx * cy); int j = 0; - for (int y = 0; y < cy; y++) - { - for (int x = 0; x < cx; x++) - { + for (int y = 0; y < cy; y++) { + for (int x = 0; x < cx; x++) { const byte* r = get_span_data(0, j); - if (r) - { + if (r) { int z = 0; - while (z < cz) - { + while (z < cz) { z += *r++; int c = *r++; - while (c--) - { + while (c--) { if (i == z) s.data_edit()[x + cx * y] = *r; r += 2; @@ -105,27 +99,21 @@ int Cvxl_file::extract_as_pcx(const Cfname& name, t_file_type ft, const t_palet ostream& Cvxl_file::extract_as_text(ostream& os) const { - for (int i = 0; i < get_c_section_headers(); i++) - { + for (int i = 0; i < get_c_section_headers(); i++) { const t_vxl_section_tailer& section_tailer = *get_section_tailer(i); const int cx = section_tailer.cx; const int cy = section_tailer.cy; const int cz = section_tailer.cz; int j = 0; - for (int y = 0; y < cy; y++) - { - for (int x = 0; x < cx; x++) - { + for (int y = 0; y < cy; y++) { + for (int x = 0; x < cx; x++) { const byte* r = get_span_data(i, j); - if (r) - { + if (r) { int z = 0; - while (z < cz) - { + while (z < cz) { z += *r++; int c = *r++; - while (c--) - { + while (c--) { os << i << ',' << x << ',' << y << ',' << z << ',' << static_cast(*r++) << ',' << static_cast(*r++) << endl; z++; } @@ -173,16 +161,14 @@ int Cvxl_file::extract_as_xif(const string& name) const Cxif_key& header = k.open_key_write(vi_header); Cxif_key& palet = header.open_key_write(vi_palet); int i; - for (i = 0; i < 256; i++) - { + for (i = 0; i < 256; i++) { Cxif_key& palet_entry = palet.open_key_write(i); palet_entry.set_value_int(vi_red, get_palet()[i].r); palet_entry.set_value_int(vi_green, get_palet()[i].g); palet_entry.set_value_int(vi_blue, get_palet()[i].b); } Cxif_key& body = k.open_key_write(vi_body); - for (i = 0; i < get_c_section_headers(); i++) - { + for (i = 0; i < get_c_section_headers(); i++) { const t_vxl_section_header& section_header = *get_section_header(i); const t_vxl_section_tailer& section_tailer = *get_section_tailer(i); const int cx = section_tailer.cx; @@ -191,24 +177,19 @@ int Cvxl_file::extract_as_xif(const string& name) const Cxif_key& section = body.open_key_write(i); Cxif_key& header = section.open_key_write(vi_header); header.set_value_string(vi_id, section_header.id); - Cxif_key& body = section.open_key_write(vi_body); + Cxif_key& body = section.open_key_write(vi_body); int j = 0; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { Cxif_key& yi = body.open_key_write(y); - for (int x = 0; x < cx; x++) - { + for (int x = 0; x < cx; x++) { Cxif_key& xi = yi.open_key_write(x); const byte* r = get_span_data(i, j); - if (r) - { + if (r) { int z = 0; - while (z < cz) - { + while (z < cz) { z += *r++; int c = *r++; - while (c--) - { + while (c--) { Cxif_key& zi = xi.open_key_write(z); zi.set_value_int(vi_color, *r++); zi.set_value_int(vi_surface_normal, *r++); @@ -220,7 +201,7 @@ int Cvxl_file::extract_as_xif(const string& name) const j++; } } - Cxif_key& tailer = section.open_key_write(vi_tailer); + Cxif_key& tailer = section.open_key_write(vi_tailer); tailer.set_value_int(vi_x_min, section_tailer.x_min_scale * 1000000); tailer.set_value_int(vi_y_min, section_tailer.y_min_scale * 1000000); tailer.set_value_int(vi_z_min, section_tailer.z_min_scale * 1000000); @@ -252,16 +233,14 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) header.unknown = 0x1f10; const Cxif_key& palet_key = header_key.open_key_read(vi_palet); int i; - for (i = 0; i < 256; i++) - { + for (i = 0; i < 256; i++) { const Cxif_key& palet_entry_key = palet_key.open_key_read(i); header.palet[i].r = palet_entry_key.get_value_int(vi_red); header.palet[i].g = palet_entry_key.get_value_int(vi_green); header.palet[i].b = palet_entry_key.get_value_int(vi_blue); } w += sizeof(t_vxl_header); - for (i = 0; i < c_sections; i++) - { + for (i = 0; i < c_sections; i++) { const Cxif_key& section_key = body_key.open_key_read(i); const Cxif_key& section_header_key = section_key.open_key_read(vi_header); t_vxl_section_header& section_header = *reinterpret_cast(w); @@ -272,8 +251,7 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) w += sizeof(t_vxl_section_header); } byte* body_start = w; - for (i = 0; i < c_sections; i++) - { + for (i = 0; i < c_sections; i++) { const Cxif_key& section_key = body_key.open_key_read(i); const Cxif_key& section_body_key = section_key.open_key_read(vi_body); const Cxif_key& section_tailer_key = section_key.open_key_read(vi_tailer); @@ -289,16 +267,13 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) byte* span_data_start = w; span_data_ofs[i] = w - body_start; int span_i = 0; - for (int y = 0; y < cy; y++) - { + for (int y = 0; y < cy; y++) { const Cxif_key& yi = section_body_key.open_key_read(y); - for (int x = 0; x < cx; x++) - { + for (int x = 0; x < cx; x++) { byte* span_start = w; const Cxif_key& xi = yi.open_key_read(x); int z = 0; - for (auto& i : xi.m_keys) - { + for (auto& i : xi.m_keys) { int z_inc = i.first - z; z = i.first + 1; *w++ = z_inc; @@ -307,15 +282,11 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) *w++ = i.second.get_value_int(vi_surface_normal); *w++ = 1; } - if (span_start == w) - { + if (span_start == w) { span_start_list[span_i] = -1; span_end_list[span_i] = -1; - } - else - { - if (z != cz) - { + } else { + if (z != cz) { *w++ = cz - z; *w++ = 0; *w++ = 0; @@ -328,8 +299,7 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) } } header.size = w - body_start; - for (i = 0; i < c_sections; i++) - { + for (i = 0; i < c_sections; i++) { const Cxif_key& section_key = body_key.open_key_read(i); const Cxif_key& section_tailer_key = section_key.open_key_read(vi_tailer); t_vxl_section_tailer& section_tailer = *reinterpret_cast(w); @@ -338,8 +308,7 @@ Cvirtual_binary vxl_file_write(const Cxif_key& s) section_tailer.span_end_ofs = span_end_list_ofs[i]; section_tailer.span_data_ofs = span_data_ofs[i]; section_tailer.scale = 0; - for (int ty = 0; ty < 3; ty++) - { + for (int ty = 0; ty < 3; ty++) { for (int tx = 0; tx < 4; tx++) section_tailer.transform[ty][tx] = 0; } @@ -367,8 +336,7 @@ Cvirtual_binary vxl_file_write(const byte* s, const byte* s_normals, int cx, int Cxif_key k; Cxif_key& header = k.open_key_write(vi_header); Cxif_key& palet = header.open_key_write(vi_palet); - for (int i = 0; i < 256; i++) - { + for (int i = 0; i < 256; i++) { Cxif_key& palet_entry = palet.open_key_write(i); palet_entry.set_value_int(vi_red, i); palet_entry.set_value_int(vi_green, i); @@ -379,28 +347,24 @@ Cvirtual_binary vxl_file_write(const byte* s, const byte* s_normals, int cx, int Cxif_key& section = body.open_key_write(0); Cxif_key& header = section.open_key_write(vi_header); header.set_value_string(vi_id, "NONE"); - Cxif_key& body = section.open_key_write(vi_body); - for (int y = 0; y < cy; y++) - { + Cxif_key& body = section.open_key_write(vi_body); + for (int y = 0; y < cy; y++) { Cxif_key& yi = body.open_key_write(y); - for (int x = 0; x < cx; x++) - { + for (int x = 0; x < cx; x++) { Cxif_key& xi = yi.open_key_write(x); const byte* r = s + x + cx * y; - for (int z = 0; z < cz; z++) - { + for (int z = 0; z < cz; z++) { int v = *r; - if (v) - { + if (v) { Cxif_key& zi = xi.open_key_write(z); zi.set_value_int(vi_color, v); - zi.set_value_int(vi_surface_normal, s_normals ? s_normals[r - s]: -1); + zi.set_value_int(vi_surface_normal, s_normals ? s_normals[r - s] : -1); } r += cx * cy; } } } - Cxif_key& tailer = section.open_key_write(vi_tailer); + Cxif_key& tailer = section.open_key_write(vi_tailer); tailer.set_value_int(vi_x_min, cx * -1000000 / 2); tailer.set_value_int(vi_y_min, cy * -1000000 / 2); tailer.set_value_int(vi_z_min, cz * -1000000 / 2); @@ -433,8 +397,7 @@ Cvirtual_binary vxl_file_write(Cvirtual_tfile s) int cx = 0; int cy = 0; int cz = 0; - while (!s.eof()) - { + while (!s.eof()) { Cmulti_line l = s.read_line(); t_voxel e; int s = l.get_next_int(','); @@ -454,8 +417,7 @@ Cvirtual_binary vxl_file_write(Cvirtual_tfile s) Cvirtual_binary normals(NULL, cx * cy * cz); colors.memset(0); normals.memset(0); - for (auto& e : list) - { + for (auto& e : list) { int o = e.x + cx * (e.y + cy * e.z); colors.data_edit()[o] = e.color; normals.data_edit()[o] = e.normal; @@ -496,8 +458,7 @@ int vxl_encode4(const Cvxl_file& f, byte* d) header.c_sections = c_sections; w += sizeof(t_vxl4_header); - for (int i = 0; i < c_sections; i++) - { + for (int i = 0; i < c_sections; i++) { const t_vxl_section_header& s_section_header = *f.get_section_header(i); const t_vxl_section_tailer& section_tailer = *f.get_section_tailer(i); const int cx = section_tailer.cx; @@ -520,29 +481,24 @@ int vxl_encode4(const Cvxl_file& f, byte* d) section_header.cz = section_tailer.cz; section_header.unknown = section_tailer.unknown; w += sizeof(t_vxl4_section_header); - for (int j = 0; j < f.get_c_spans(i); j++) - { + for (int j = 0; j < f.get_c_spans(i); j++) { const byte* r = f.get_span_data(i, j); - if (r) - { + if (r) { int z = 0; - while (z < cz) - { + while (z < cz) { int z_inc = *w++ = *r++; if (z_inc == cz) break; z += z_inc; int c = *w++ = *r++; - while (c--) - { + while (c--) { *w++ = *r++; *w++ = *r++; z++; } r++; } - } - else + } else *w++ = cz; } } @@ -556,19 +512,16 @@ int vxl_decode4_size(const byte* s) const int c_sections = s_header.c_sections; r += sizeof(t_vxl4_header); int w = 0; - for (int i = 0; i < c_sections; i++) - { + for (int i = 0; i < c_sections; i++) { const t_vxl4_section_header& section_header = *reinterpret_cast(r); const int cx = section_header.cx; const int cy = section_header.cy; const int cz = section_header.cz; w += 8 * cx * cy; r += sizeof(t_vxl4_section_header); - for (int j = 0; j < cx * cy; j++) - { + for (int j = 0; j < cx * cy; j++) { int z = 0; - while (z < cz) - { + while (z < cz) { int z_inc = *r++; if (z_inc == cz) break; @@ -604,8 +557,7 @@ Cvirtual_binary vxl_decode4(const byte* s, int cb_d) t_vxl_section_tailer* section_tailer = new t_vxl_section_tailer[c_sections]; w += sizeof(t_vxl_section_header) * c_sections; byte* body_start = w; - for (int i = 0; i < c_sections; i++) - { + for (int i = 0; i < c_sections; i++) { const t_vxl4_section_header& section_header = *reinterpret_cast(r); const int cx = section_header.cx; const int cy = section_header.cy; @@ -635,33 +587,27 @@ Cvirtual_binary vxl_decode4(const byte* s, int cb_d) section_tailer[i].unknown = section_header.unknown; r += sizeof(t_vxl4_section_header); byte* span_data_start = w; - for (int j = 0; j < cx * cy; j++) - { + for (int j = 0; j < cx * cy; j++) { byte* span_start = w; int z = 0; - while (z < cz) - { + while (z < cz) { int z_inc = *r++; if (z_inc == cz) break; z += *w++ = z_inc; int count = *w++ = *r++; int c = count; - while (c--) - { + while (c--) { *w++ = *r++; *w++ = *r++; z++; } *w++ = count; } - if (span_start == w) - { + if (span_start == w) { span_start_list[j] = -1; span_end_list[j] = -1; - } - else - { + } else { span_start_list[j] = span_start - span_data_start; span_end_list[j] = w - span_data_start - 1; } diff --git a/3rdParty/xcc/misc/vxl_file.h b/3rdParty/xcc/misc/vxl_file.h index 576bcd3..e4d1f76 100644 --- a/3rdParty/xcc/misc/vxl_file.h +++ b/3rdParty/xcc/misc/vxl_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -37,7 +37,7 @@ public: int extract_as_xif(const string& name) const; #endif bool is_valid() const; - + int get_c_section_headers() const { return header().c_section_headers; diff --git a/3rdParty/xcc/misc/win_handle.cpp b/3rdParty/xcc/misc/win_handle.cpp index ce6f97d..984df4f 100644 --- a/3rdParty/xcc/misc/win_handle.cpp +++ b/3rdParty/xcc/misc/win_handle.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2002 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2002 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" diff --git a/3rdParty/xcc/misc/win_handle.h b/3rdParty/xcc/misc/win_handle.h index 9d49d92..0ab510f 100644 --- a/3rdParty/xcc/misc/win_handle.h +++ b/3rdParty/xcc/misc/win_handle.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2002 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2002 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/xcc_dirs.cpp b/3rdParty/xcc/misc/xcc_dirs.cpp index a8cb29a..afd58b7 100644 --- a/3rdParty/xcc/misc/xcc_dirs.cpp +++ b/3rdParty/xcc/misc/xcc_dirs.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "xcc_dirs.h" @@ -50,8 +50,7 @@ bool xcc_dirs::enable_log() string xcc_dirs::get_dir(t_game game) { - switch (game) - { + switch (game) { case game_td: return td_primary_dir; case game_ra: @@ -87,8 +86,7 @@ string xcc_dirs::get_dir(t_game game) string xcc_dirs::get_exe(t_game game) { - switch (game) - { + switch (game) { case game_td: return td_primary_dir + "c&c95.exe"; case game_ra: @@ -116,8 +114,7 @@ string xcc_dirs::get_exe(t_game game) string xcc_dirs::get_audio_mix(t_game game) { - switch (game) - { + switch (game) { case game_ra2: return "audio.mix"; case game_ra2_yr: @@ -129,8 +126,7 @@ string xcc_dirs::get_audio_mix(t_game game) string xcc_dirs::get_csf_fname(t_game game) { - switch (game) - { + switch (game) { case game_ra2: return "ra2.csf"; case game_ra2_yr: @@ -173,8 +169,7 @@ string xcc_dirs::get_expand_mix(t_game game, const string& s) string xcc_dirs::get_language_mix(t_game game) { - switch (game) - { + switch (game) { case game_ra2: return ra2_dir + "language.mix"; case game_ra2_yr: @@ -190,8 +185,7 @@ string xcc_dirs::get_language_mix(t_game game) string xcc_dirs::get_local_mix(t_game game) { - switch (game) - { + switch (game) { case game_ts: case game_ra2: return "local.mix"; @@ -204,8 +198,7 @@ string xcc_dirs::get_local_mix(t_game game) string xcc_dirs::get_main_mix(t_game game) { - switch (game) - { + switch (game) { case game_ra: return ra_dir + "redalert.mix"; case game_ts: @@ -223,14 +216,13 @@ static void set_path(string s, string& path) { boost::to_lower(s); if (!s.empty() && s.back() != '\\') - s += '\\'; + s += '\\'; path = s; } -void xcc_dirs::set_dir(t_game game, const string &s) +void xcc_dirs::set_dir(t_game game, const string& s) { - switch (game) - { + switch (game) { case game_td: set_path(s, td_primary_dir); break; @@ -294,10 +286,8 @@ void xcc_dirs::reset_cd_dir() { int drive_map = GetLogicalDrives(); char drive_root[] = "a:\\"; - for (int i = 0; i < 26; i++) - { - if (drive_map >> i & 1 && GetDriveTypeA(drive_root) == DRIVE_CDROM) - { + for (int i = 0; i < 26; i++) { + if (drive_map >> i & 1 && GetDriveTypeA(drive_root) == DRIVE_CDROM) { set_cd_dir(drive_root); break; } @@ -314,8 +304,8 @@ static void read_dir(const string& key, const string& value, t_game game) { Creg_key h; string s; - if (xcc_dirs::get_dir(game).empty() - && ERROR_SUCCESS == h.open(HKEY_LOCAL_MACHINE, key, KEY_QUERY_VALUE) + if (xcc_dirs::get_dir(game).empty() + && ERROR_SUCCESS == h.open(HKEY_LOCAL_MACHINE, key, KEY_QUERY_VALUE) && ERROR_SUCCESS == h.query_value(value, s)) xcc_dirs::set_dir(game, Cfname(s).get_path()); } @@ -323,8 +313,7 @@ static void read_dir(const string& key, const string& value, t_game game) void xcc_dirs::load_from_registry() { Creg_key kh_base; - if (!Cxcc_registry::get_base_key(kh_base)) - { + if (!Cxcc_registry::get_base_key(kh_base)) { string s; if (ERROR_SUCCESS == kh_base.query_value("dune2_dir", s)) set_dir(game_dune2, s); diff --git a/3rdParty/xcc/misc/xcc_dirs.h b/3rdParty/xcc/misc/xcc_dirs.h index 8f374d1..a7fa1af 100644 --- a/3rdParty/xcc/misc/xcc_dirs.h +++ b/3rdParty/xcc/misc/xcc_dirs.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -21,7 +21,7 @@ #include "cc_structures.h" #include "fname.h" -class xcc_dirs +class xcc_dirs { public: static bool enable_log(); @@ -41,8 +41,8 @@ public: static string get_local_mix(t_game game); static string get_main_mix(t_game game); static void set_td_secondary_dir(const string& s); - static void set_cd_dir(const string &s); - static void set_data_dir(const string &s); + static void set_cd_dir(const string& s); + static void set_data_dir(const string& s); static void set_dir(t_game game, const string& s); static void reset_cd_dir(); static void reset_data_dir(); diff --git a/3rdParty/xcc/misc/xcc_file.h b/3rdParty/xcc/misc/xcc_file.h index d063e38..992fc7d 100644 --- a/3rdParty/xcc/misc/xcc_file.h +++ b/3rdParty/xcc/misc/xcc_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -35,7 +35,7 @@ public: { const t_xcc_header& h = header(); int size = get_size(); - return !(sizeof(t_xcc_header) > size || + return !(sizeof(t_xcc_header) > size || strcmp(h.id, xcc_id) || h.size != size || h.version); diff --git a/3rdParty/xcc/misc/xcc_file_sh.h b/3rdParty/xcc/misc/xcc_file_sh.h index f2fbf69..dd05eda 100644 --- a/3rdParty/xcc/misc/xcc_file_sh.h +++ b/3rdParty/xcc/misc/xcc_file_sh.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/xcc_lmd_file.h b/3rdParty/xcc/misc/xcc_lmd_file.h index b5bde8f..ca9f647 100644 --- a/3rdParty/xcc/misc/xcc_lmd_file.h +++ b/3rdParty/xcc/misc/xcc_lmd_file.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/3rdParty/xcc/misc/xcc_lmd_file_write.cpp b/3rdParty/xcc/misc/xcc_lmd_file_write.cpp index 23fda02..2966579 100644 --- a/3rdParty/xcc/misc/xcc_lmd_file_write.cpp +++ b/3rdParty/xcc/misc/xcc_lmd_file_write.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -44,8 +44,7 @@ Cvirtual_binary Cxcc_lmd_file_write::write(t_game game) const lmd_header.c_fnames = m_index.size(); lmd_header.game = game; w += sizeof(t_xcc_lmd_header); - for (auto& i : m_index) - { + for (auto& i : m_index) { strcpy(reinterpret_cast(w), i.c_str()); w += i.length() + 1; } diff --git a/3rdParty/xcc/misc/xcc_lmd_file_write.h b/3rdParty/xcc/misc/xcc_lmd_file_write.h index 4e02a8e..30e2849 100644 --- a/3rdParty/xcc/misc/xcc_lmd_file_write.h +++ b/3rdParty/xcc/misc/xcc_lmd_file_write.h @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -24,7 +24,7 @@ using namespace std; -class Cxcc_lmd_file_write +class Cxcc_lmd_file_write { public: void add_fname(const string& fname); diff --git a/3rdParty/xcc/misc/xcc_registry.cpp b/3rdParty/xcc/misc/xcc_registry.cpp index e14c965..21bec3a 100644 --- a/3rdParty/xcc/misc/xcc_registry.cpp +++ b/3rdParty/xcc/misc/xcc_registry.cpp @@ -1,19 +1,19 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" diff --git a/3rdParty/xcc/misc/xcc_registry.h b/3rdParty/xcc/misc/xcc_registry.h index 48890e6..a9b4ec0 100644 --- a/3rdParty/xcc/misc/xcc_registry.h +++ b/3rdParty/xcc/misc/xcc_registry.h @@ -1,26 +1,26 @@ /* - XCC Utilities and Library - Copyright (C) 2000 Olaf van der Spek + XCC Utilities and Library + Copyright (C) 2000 Olaf van der Spek - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once #include "reg_key.h" -class Cxcc_registry +class Cxcc_registry { public: static int get_base_key(Creg_key&); diff --git a/MissionEditor/AITriggerAddDlg.cpp b/MissionEditor/AITriggerAddDlg.cpp index 4535c0e..d03d901 100644 --- a/MissionEditor/AITriggerAddDlg.cpp +++ b/MissionEditor/AITriggerAddDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // AITriggerAddDlg.cpp: Implementierungsdatei @@ -64,11 +64,11 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CAITriggerAddDlg -BOOL CAITriggerAddDlg::OnInitDialog() +BOOL CAITriggerAddDlg::OnInitDialog() { CDialog::OnInitDialog(); - CListBox* lb=(CListBox*)GetDlgItem(IDC_AITRIGGERS); + CListBox* lb = (CListBox*)GetDlgItem(IDC_AITRIGGERS); int i; for (i = 0; i < ai["AITriggerTypes"].Size(); i++) { @@ -76,7 +76,7 @@ BOOL CAITriggerAddDlg::OnInitDialog() auto const& valuePair = section.Nth(i); lb->AddString(valuePair.first + (CString)" " + GetParam(valuePair.second, 0)); } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/AITriggerAddDlg.h b/MissionEditor/AITriggerAddDlg.h index 110e65f..e4f0deb 100644 --- a/MissionEditor/AITriggerAddDlg.h +++ b/MissionEditor/AITriggerAddDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_AITRIGGERADDDLG_H__19C60CA1_25D1_11D5_89B2_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CAITriggerAddDlg : public CDialog { -// Konstruktion + // Konstruktion public: CAITriggerAddDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CAITriggerAddDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/AITriggerTypes.cpp b/MissionEditor/AITriggerTypes.cpp index a5ebe09..81555d3 100644 --- a/MissionEditor/AITriggerTypes.cpp +++ b/MissionEditor/AITriggerTypes.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // AITriggerTypes.cpp: implementation file @@ -175,30 +175,29 @@ void ListObjects(CComboBox& cb) void CAITriggerTypes::UpdateDialog() { - int sel=m_AITriggerType.GetCurSel(); + int sel = m_AITriggerType.GetCurSel(); m_AITriggerType.SetRedraw(FALSE); - while(m_AITriggerType.DeleteString(0)!=CB_ERR); + while (m_AITriggerType.DeleteString(0) != CB_ERR); - ListHouses(m_Owner,FALSE,TRUE); + ListHouses(m_Owner, FALSE, TRUE); m_Owner.AddString(""); ListTeamTypes(m_TeamType1, TRUE); ListTeamTypes(m_TeamType2, TRUE); int i; - for(i=0;iGetAITriggerTypeCount();i++) - { + for (i = 0; i < Map->GetAITriggerTypeCount(); i++) { AITRIGGERTYPE aitt; Map->GetAITriggerType(i, &aitt); - CString s=aitt.ID; - s+=" ("; - s+=aitt.name; - s+=")"; + CString s = aitt.ID; + s += " ("; + s += aitt.name; + s += ")"; m_AITriggerType.AddString(s); } m_AITriggerType.SetCurSel(0); - if(sel!=-1) + if (sel != -1) m_AITriggerType.SetCurSel(sel); @@ -213,25 +212,25 @@ void CAITriggerTypes::UpdateDialog() } -void CAITriggerTypes::OnSelchangeAitriggertype() +void CAITriggerTypes::OnSelchangeAitriggertype() { - int sel=m_AITriggerType.GetCurSel(); - if(sel<0) return; + int sel = m_AITriggerType.GetCurSel(); + if (sel < 0) return; CString aitrigger; - m_AITriggerType.GetLBText(sel,aitrigger); + m_AITriggerType.GetLBText(sel, aitrigger); TruncSpace(aitrigger); - + AITRIGGERTYPE aitt; Map->GetAITriggerType(Map->GetAITriggerTypeIndex(aitrigger), &aitt); - m_Name=aitt.name; + m_Name = aitt.name; m_TeamType1.SetWindowText(aitt.teamtype1); m_Owner.SetWindowText(TranslateHouse(aitt.owner, TRUE)); m_Flag1.SetWindowText(aitt.techlevel); //m_Flag2.SetWindowText(aitt.type); - int type=atoi(aitt.type)+1; + int type = atoi(aitt.type) + 1; m_Flag2.SetCurSel(type); m_UnitType.SetWindowText(aitt.unittype); m_Data.SetWindowText(aitt.data); @@ -239,75 +238,75 @@ void CAITriggerTypes::OnSelchangeAitriggertype() m_Float2.SetWindowText(aitt.float2); m_Float3.SetWindowText(aitt.float3); //m_Flag3=aitt.skirmish; - m_Skirmish=isTrue(aitt.skirmish); - m_Flag4=aitt.flag4; + m_Skirmish = isTrue(aitt.skirmish); + m_Flag4 = aitt.flag4; //m_Flag5=aitt.multihouse; - m_MultiSide=aitt.multihouse; - m_BaseDefense=isTrue(aitt.basedefense); + m_MultiSide = aitt.multihouse; + m_BaseDefense = isTrue(aitt.basedefense); m_TeamType2.SetWindowText(aitt.teamtype2); - m_Easy=isTrue(aitt.easy); - m_Medium=isTrue(aitt.medium); - m_Hard=isTrue(aitt.hard); - - m_Enabled=FALSE; - CIniFile& ini=Map->GetIniFile(); + m_Easy = isTrue(aitt.easy); + m_Medium = isTrue(aitt.medium); + m_Hard = isTrue(aitt.hard); + + m_Enabled = FALSE; + CIniFile& ini = Map->GetIniFile(); if (ini.GetBool("AITriggerTypesEnable", aitrigger)) { m_Enabled = TRUE; } AITrigInfo info; - info=ConvertToAITrigInfoFromHex((char*)(LPCSTR)aitt.data); - m_Condition=info.Condition; - m_Number=info.Number; + info = ConvertToAITrigInfoFromHex((char*)(LPCSTR)aitt.data); + m_Condition = info.Condition; + m_Number = info.Number; ListObjects(m_UnitType); - + UpdateData(FALSE); } -void CAITriggerTypes::OnChangeName() +void CAITriggerTypes::OnChangeName() { UpdateData(); CString value; - value=m_Name; + value = m_Name; - if(value.GetLength()==0) value=" "; + if (value.GetLength() == 0) value = " "; SetAITriggerParam(value, 0); UpdateDialog(); } -void CAITriggerTypes::OnEditchangeOwner() +void CAITriggerTypes::OnEditchangeOwner() { CString value; m_Owner.GetWindowText(value); - value=TranslateHouse(value); + value = TranslateHouse(value); SetAITriggerParam(value, 2); } -void CAITriggerTypes::OnEditchangeTeamtype1() +void CAITriggerTypes::OnEditchangeTeamtype1() { CString value; m_TeamType1.GetWindowText(value); TruncSpace(value); - + SetAITriggerParam(value, 1); } -void CAITriggerTypes::OnEditchangeTeamtype2() +void CAITriggerTypes::OnEditchangeTeamtype2() { CString value; m_TeamType2.GetWindowText(value); TruncSpace(value); - + SetAITriggerParam(value, 14); } -void CAITriggerTypes::OnEditchangeFlag1() +void CAITriggerTypes::OnEditchangeFlag1() { CString value; m_Flag1.GetWindowText(value); @@ -315,7 +314,7 @@ void CAITriggerTypes::OnEditchangeFlag1() SetAITriggerParam(value, 3); } -void CAITriggerTypes::OnEditchangeFlag2() +void CAITriggerTypes::OnEditchangeFlag2() { CString value; m_Flag2.GetWindowText(value); @@ -325,7 +324,7 @@ void CAITriggerTypes::OnEditchangeFlag2() SetAITriggerParam(value, 4); } -void CAITriggerTypes::OnEditchangeUnittype() +void CAITriggerTypes::OnEditchangeUnittype() { CString value; m_UnitType.GetWindowText(value); @@ -334,7 +333,7 @@ void CAITriggerTypes::OnEditchangeUnittype() SetAITriggerParam(value, 5); } -void CAITriggerTypes::OnEditchangeData() +void CAITriggerTypes::OnEditchangeData() { /* This function should also valid the data! @@ -345,23 +344,23 @@ void CAITriggerTypes::OnEditchangeData() TruncSpace(value); // max 64 chars... min 64 chars too... - ((char*)(LPCTSTR)value)[64]=0; - - int ToInsert=64-value.GetLength(); - CString nulls('0',ToInsert); + ((char*)(LPCTSTR)value)[64] = 0; + + int ToInsert = 64 - value.GetLength(); + CString nulls('0', ToInsert); + + value.Insert(value.GetLength() - ToInsert, nulls); - value.Insert(value.GetLength()-ToInsert, nulls); - SetAITriggerParam(value, 6); - int editsel=m_Data.GetEditSel(); - UpdateDialog(); - m_Data.SetEditSel(editsel,editsel+1); + int editsel = m_Data.GetEditSel(); + UpdateDialog(); + m_Data.SetEditSel(editsel, editsel + 1); } -void CAITriggerTypes::OnChangeFloat1() +void CAITriggerTypes::OnChangeFloat1() { CString value; m_Float1.GetWindowText(value); @@ -369,7 +368,7 @@ void CAITriggerTypes::OnChangeFloat1() SetAITriggerParam(value, 7); } -void CAITriggerTypes::OnChangeFloat2() +void CAITriggerTypes::OnChangeFloat2() { CString value; m_Float2.GetWindowText(value); @@ -377,7 +376,7 @@ void CAITriggerTypes::OnChangeFloat2() SetAITriggerParam(value, 8); } -void CAITriggerTypes::OnChangeFloat3() +void CAITriggerTypes::OnChangeFloat3() { CString value; m_Float3.GetWindowText(value); @@ -385,76 +384,76 @@ void CAITriggerTypes::OnChangeFloat3() SetAITriggerParam(value, 9); } -void CAITriggerTypes::OnChangeFlag3() +void CAITriggerTypes::OnChangeFlag3() { - + } -void CAITriggerTypes::OnChangeFlag4() +void CAITriggerTypes::OnChangeFlag4() { UpdateData(); CString value; - value=m_Flag4; + value = m_Flag4; SetAITriggerParam(value, 11); } -void CAITriggerTypes::OnChangeFlag5() +void CAITriggerTypes::OnChangeFlag5() { - + } -void CAITriggerTypes::OnChangeFlag6() +void CAITriggerTypes::OnChangeFlag6() { - + } -void CAITriggerTypes::OnChangeFlag7() +void CAITriggerTypes::OnChangeFlag7() { - + } -void CAITriggerTypes::OnChangeFlag8() +void CAITriggerTypes::OnChangeFlag8() { UpdateData(); CString value; - value=m_Flag8; + value = m_Flag8; SetAITriggerParam(value, 16); } -void CAITriggerTypes::OnChangeFlag9() +void CAITriggerTypes::OnChangeFlag9() { UpdateData(); CString value; - value=m_Flag9; + value = m_Flag9; SetAITriggerParam(value, 17); } -void CAITriggerTypes::OnEnabled() +void CAITriggerTypes::OnEnabled() { // enable or disable trigger UpdateData(); - int sel=m_AITriggerType.GetCurSel(); + int sel = m_AITriggerType.GetCurSel(); if (sel < 0) { return; } CString aitrigger; - m_AITriggerType.GetLBText(sel,aitrigger); + m_AITriggerType.GetLBText(sel, aitrigger); TruncSpace(aitrigger); - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(m_Enabled) { + if (m_Enabled) { // enable it ini.SetBool("AITriggerTypesEnable", aitrigger, true); } else { @@ -464,48 +463,48 @@ void CAITriggerTypes::OnEnabled() } } -void CAITriggerTypes::SetAITriggerParam(const char *value, int param) +void CAITriggerTypes::SetAITriggerParam(const char* value, int param) { - int sel=m_AITriggerType.GetCurSel(); + int sel = m_AITriggerType.GetCurSel(); if (sel < 0) { return; } CString aitrigger; - m_AITriggerType.GetLBText(sel,aitrigger); + m_AITriggerType.GetLBText(sel, aitrigger); TruncSpace(aitrigger); - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (auto const pSec = ini.TryGetSection("AITriggerTypes")) { pSec->SetString(aitrigger, SetParam(pSec->GetString(aitrigger), param, value)); } } -void CAITriggerTypes::OnAdd() +void CAITriggerTypes::OnAdd() { - CString ID=GetFreeID(); - CIniFile& ini=Map->GetIniFile(); - CString data="New AI Trigger,"; - + CString ID = GetFreeID(); + CIniFile& ini = Map->GetIniFile(); + CString data = "New AI Trigger,"; + // now try to set a teamtype - if (ini["TeamTypes"].Size()>0) { - data+=*ini["TeamTypes"].Nth(0).second; + if (ini["TeamTypes"].Size() > 0) { + data += *ini["TeamTypes"].Nth(0).second; } else { - data+=""; + data += ""; } - - data+=",,"; - + + data += ",,"; + // the flag here... i first thought it´s an ID, but it more seems to be an value specifying the importance of the trigger - data+="1,"; + data += "1,"; // the flag 2 seems to be the type of the trigger. -1 seems to be pool - data+="0,"; + data += "0,"; // now stuff - data+=",0000000000000000000000000000000000000000000000000000000000000000,50.000000,30.000000,50.000000,1,0,1,1,"; - + data += ",0000000000000000000000000000000000000000000000000000000000000000,50.000000,30.000000,50.000000,1,0,1,1,"; + // a pool seems to need both teamtypes the same //if(ini.sections["TeamTypes"].values.size()>0) //{ @@ -513,77 +512,74 @@ void CAITriggerTypes::OnAdd() //} //else { - data+=""; + data += ""; } - data+=",1,1,1"; - + data += ",1,1,1"; + ini.SetString("AITriggerTypes", ID, data); UpdateDialog(); - + // now make current id visible int i; - for(i=0;iGetIniFile(); - + ini.RemoveValueByKey("AITriggerTypes", aitrigger); ini.RemoveValueByKey("AITriggerTypesEnable", aitrigger); UpdateDialog(); } -void CAITriggerTypes::OnEditchangeAitriggertype() +void CAITriggerTypes::OnEditchangeAitriggertype() { - OnSelchangeAitriggertype(); + OnSelchangeAitriggertype(); } -AITrigInfo CAITriggerTypes::ConvertToAITrigInfoFromHex(char *aitinfo) +AITrigInfo CAITriggerTypes::ConvertToAITrigInfoFromHex(char* aitinfo) { - int index=0; + int index = 0; AITrigInfo info; - char* rawdata=(char*)&info; - char hexbuff[3]="00"; - char* dummy=NULL; + char* rawdata = (char*)&info; + char hexbuff[3] = "00"; + char* dummy = NULL; - while(*aitinfo!='\0') - { - while(isspace((int)*aitinfo)) aitinfo++; + while (*aitinfo != '\0') { + while (isspace((int)*aitinfo)) aitinfo++; - hexbuff[0]=*aitinfo++; - ASSERT(*aitinfo!='\0'); - if(*aitinfo!='\0'){ - hexbuff[1]=*aitinfo++; + hexbuff[0] = *aitinfo++; + ASSERT(*aitinfo != '\0'); + if (*aitinfo != '\0') { + hexbuff[1] = *aitinfo++; } else { - hexbuff[1]='\0'; + hexbuff[1] = '\0'; } - ASSERT(index=sizeof(AITrigInfo)) break; + ASSERT(index < sizeof(AITrigInfo)); + if (index >= sizeof(AITrigInfo)) break; - *rawdata++=strtol(hexbuff, &dummy, 16); + *rawdata++ = strtol(hexbuff, &dummy, 16); index++; } @@ -592,57 +588,57 @@ AITrigInfo CAITriggerTypes::ConvertToAITrigInfoFromHex(char *aitinfo) char* CAITriggerTypes::ConvertToHexFromAITrigInfo(AITrigInfo info, char* buffer) { - unsigned char* aitinfobuffer=(unsigned char*)buffer; + unsigned char* aitinfobuffer = (unsigned char*)buffer; /* ** Convert the AITrigInfo union data structure to ASCII format string */ { - + int index = 0; - unsigned char *rawdata = (unsigned char *)&info; - unsigned char *aitinfobuffptr = &aitinfobuffer[0]; + unsigned char* rawdata = (unsigned char*)&info; + unsigned char* aitinfobuffptr = &aitinfobuffer[0]; for (; index < sizeof(AITrigInfo); index++, rawdata++, aitinfobuffptr += 2) { - sprintf((char *)aitinfobuffptr, "%02x", *rawdata); + sprintf((char*)aitinfobuffptr, "%02x", *rawdata); } *aitinfobuffptr = '\0'; } - + return (char*)aitinfobuffer; } -void CAITriggerTypes::OnSelchangeCondition() +void CAITriggerTypes::OnSelchangeCondition() { - int sel=m_AITriggerType.GetCurSel(); - if(sel<0) return; + int sel = m_AITriggerType.GetCurSel(); + if (sel < 0) return; UpdateData(TRUE); AITrigInfo info; - info.Condition=(ConditionEnum)m_Condition; - info.Number=m_Number; + info.Condition = (ConditionEnum)m_Condition; + info.Number = m_Number; char buffer[65]; ConvertToHexFromAITrigInfo(info, buffer); - - + + SetAITriggerParam(buffer, 6); - UpdateDialog(); + UpdateDialog(); } -void CAITriggerTypes::OnChangeNumber() +void CAITriggerTypes::OnChangeNumber() { - int sel=m_AITriggerType.GetCurSel(); - if(sel<0) return; + int sel = m_AITriggerType.GetCurSel(); + if (sel < 0) return; UpdateData(TRUE); AITrigInfo info; memset(&info, 0, sizeof(AITrigInfo)); - info.Condition=(ConditionEnum)m_Condition; - info.Number=m_Number; + info.Condition = (ConditionEnum)m_Condition; + info.Number = m_Number; char buffer[65]; ConvertToHexFromAITrigInfo(info, buffer); @@ -653,81 +649,81 @@ void CAITriggerTypes::OnChangeNumber() SetAITriggerParam(buffer, 6); - UpdateDialog(); + UpdateDialog(); } -void CAITriggerTypes::OnEasy() +void CAITriggerTypes::OnEasy() { UpdateData(); CString value; - value="1"; - if(!m_Easy) value="0"; + value = "1"; + if (!m_Easy) value = "0"; SetAITriggerParam(value, 15); } -void CAITriggerTypes::OnMedium() +void CAITriggerTypes::OnMedium() { UpdateData(); CString value; - value="1"; - if(!m_Medium) value="0"; + value = "1"; + if (!m_Medium) value = "0"; SetAITriggerParam(value, 16); } -void CAITriggerTypes::OnHard() +void CAITriggerTypes::OnHard() { UpdateData(); CString value; - value="1"; - if(!m_Hard) value="0"; + value = "1"; + if (!m_Hard) value = "0"; SetAITriggerParam(value, 17); } -void CAITriggerTypes::OnBasedefense() +void CAITriggerTypes::OnBasedefense() { UpdateData(); CString value; - value="1"; - if(!m_BaseDefense) value="0"; + value = "1"; + if (!m_BaseDefense) value = "0"; SetAITriggerParam(value, 13); } -void CAITriggerTypes::OnSkirmish() +void CAITriggerTypes::OnSkirmish() { UpdateData(); CString value; - value="1"; - if(!m_Skirmish) value="0"; + value = "1"; + if (!m_Skirmish) value = "0"; SetAITriggerParam(value, 10); } -void CAITriggerTypes::OnEditchangeMultiside() +void CAITriggerTypes::OnEditchangeMultiside() { UpdateData(); CString value; - value=m_MultiSide; + value = m_MultiSide; TruncSpace(value); SetAITriggerParam(value, 12); } -void CAITriggerTypes::OnSelchangeMultiside() +void CAITriggerTypes::OnSelchangeMultiside() { CString s; - CComboBox& box=*(CComboBox*)GetDlgItem(IDC_MULTISIDE); + CComboBox& box = *(CComboBox*)GetDlgItem(IDC_MULTISIDE); box.GetLBText(box.GetCurSel(), s); box.SetWindowText(s); diff --git a/MissionEditor/AITriggerTypes.h b/MissionEditor/AITriggerTypes.h index 027a4ef..976cf0a 100644 --- a/MissionEditor/AITriggerTypes.h +++ b/MissionEditor/AITriggerTypes.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_AITRIGGERTYPES_H__47F0A0E0_A8DC_11D3_B63B_B4F5BEE55940__INCLUDED_) @@ -36,7 +36,7 @@ class CAITriggerTypes : public CDialog { DECLARE_DYNCREATE(CAITriggerTypes) -// construction + // construction public: char* ConvertToHexFromAITrigInfo(AITrigInfo info, char* buffer); void SetAITriggerParam(const char* value, int param); @@ -44,8 +44,8 @@ public: CAITriggerTypes(); ~CAITriggerTypes(); -// dialog field data - //{{AFX_DATA(CAITriggerTypes) + // dialog field data + //{{AFX_DATA(CAITriggerTypes) enum { IDD = IDD_AITRIGGERTYPES }; CMyComboBox m_TeamType1; CMyComboBox m_UnitType; @@ -81,7 +81,7 @@ public: // overwriteables // generated virtual overwriteables //{{AFX_VIRTUAL(CAITriggerTypes) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL diff --git a/MissionEditor/AiTriggerTypesEnable.cpp b/MissionEditor/AiTriggerTypesEnable.cpp index de9b03e..c2353c0 100644 --- a/MissionEditor/AiTriggerTypesEnable.cpp +++ b/MissionEditor/AiTriggerTypesEnable.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // AiTriggerTypesEnable.cpp: Implementierungsdatei @@ -75,17 +75,17 @@ END_MESSAGE_MAP() void CAiTriggerTypesEnable::UpdateDialog() { - int sel=m_AITriggerType.GetCurSel(); - if(sel<0) sel=0; + int sel = m_AITriggerType.GetCurSel(); + if (sel < 0) sel = 0; - while(m_AITriggerType.DeleteString(0)!=CB_ERR); + while (m_AITriggerType.DeleteString(0) != CB_ERR); CIniFile& ini = Map->GetIniFile(); int i; - for(auto const[aitrigger, val] : ini["AITriggerTypesEnable"]) { + for (auto const [aitrigger, val] : ini["AITriggerTypesEnable"]) { CString str = aitrigger; - str+=" ("; + str += " ("; // parse from map definition first auto const& aiDef = ini.GetString("AITriggerTypes", aitrigger); if (!aiDef.IsEmpty()) { @@ -103,22 +103,22 @@ void CAiTriggerTypesEnable::UpdateDialog() } } - str+=")"; + str += ")"; m_AITriggerType.AddString(str); } - if(m_AITriggerType.SetCurSel(sel)==CB_ERR) + if (m_AITriggerType.SetCurSel(sel) == CB_ERR) m_AITriggerType.SetCurSel(0); OnSelchangeAitriggertype(); - + } -void CAiTriggerTypesEnable::OnEnableall() +void CAiTriggerTypesEnable::OnEnableall() { // enable all standard ai triggers - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int i; for (auto const& [id, def] : ai["AITriggerTypes"]) { ini.SetBool("AITriggerTypesEnable", id, true); @@ -127,36 +127,36 @@ void CAiTriggerTypesEnable::OnEnableall() UpdateDialog(); } -void CAiTriggerTypesEnable::OnSelchangeAitriggertype() +void CAiTriggerTypesEnable::OnSelchangeAitriggertype() { - int sel=m_AITriggerType.GetCurSel(); - if(sel<0) return; - + int sel = m_AITriggerType.GetCurSel(); + if (sel < 0) return; + } -void CAiTriggerTypesEnable::OnDelete() +void CAiTriggerTypesEnable::OnDelete() { - int sel=m_AITriggerType.GetCurSel(); + int sel = m_AITriggerType.GetCurSel(); if (sel < 0) { return; } CString aitrigger; - m_AITriggerType.GetLBText(sel,aitrigger); + m_AITriggerType.GetLBText(sel, aitrigger); if (aitrigger.Find(" ") >= 0) { aitrigger.SetAt(aitrigger.Find(" "), 0); } - - CIniFile& ini=Map->GetIniFile(); + + CIniFile& ini = Map->GetIniFile(); ini.RemoveValueByKey("AITriggerTypesEnable", aitrigger); UpdateDialog(); } -void CAiTriggerTypesEnable::OnAdd() +void CAiTriggerTypesEnable::OnAdd() { //CString newTriggerId=InputBox("Please enter the ID of the AITriggerType (for a list of all AITriggerType-IDs use the All-Section)","Enable AITriggerType"); CAITriggerAddDlg dlg; - if(dlg.DoModal()==IDCANCEL) return; + if (dlg.DoModal() == IDCANCEL) return; CString newTriggerId = dlg.m_AITrigger; TruncSpace(newTriggerId); @@ -164,7 +164,7 @@ void CAiTriggerTypesEnable::OnAdd() return; } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetBool("AITriggerTypesEnable", newTriggerId, true); UpdateDialog(); diff --git a/MissionEditor/AiTriggerTypesEnable.h b/MissionEditor/AiTriggerTypesEnable.h index 0cfcfb7..dfd9f11 100644 --- a/MissionEditor/AiTriggerTypesEnable.h +++ b/MissionEditor/AiTriggerTypesEnable.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_AITRIGGERTYPESENABLE_H__5CA6D080_A4D2_11D3_B63B_808EC7AC6440__INCLUDED_) @@ -34,14 +34,14 @@ class CAiTriggerTypesEnable : public CDialog { DECLARE_DYNCREATE(CAiTriggerTypesEnable) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CAiTriggerTypesEnable(); ~CAiTriggerTypesEnable(); -// Dialogfelddaten - //{{AFX_DATA(CAiTriggerTypesEnable) + // Dialogfelddaten + //{{AFX_DATA(CAiTriggerTypesEnable) enum { IDD = IDD_AITRIGGERTYPESENABLE }; CComboBox m_AITriggerType; //}}AFX_DATA @@ -50,7 +50,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CAiTriggerTypesEnable) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Aircraft.cpp b/MissionEditor/Aircraft.cpp index 7da02a8..271f02c 100644 --- a/MissionEditor/Aircraft.cpp +++ b/MissionEditor/Aircraft.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Aircraft.cpp: implementation file @@ -82,63 +82,61 @@ END_MESSAGE_MAP() void CAircraft::Init(CString house, CString strength, CString direction, CString action, CString tag, CString flag1, CString flag2, CString flag3, CString flag4) { - if(house.GetLength()==0) - { - m_house=TranslateHouse(Map->GetHouseID(0), TRUE); - } - else - m_house=TranslateHouse(house, TRUE); + if (house.GetLength() == 0) { + m_house = TranslateHouse(Map->GetHouseID(0), TRUE); + } else + m_house = TranslateHouse(house, TRUE); - - m_flag1=flag1; - m_flag2=flag2; - m_flag3=flag3; - m_flag4=flag4; - m_action=action; - m_strength=strength; - - m_tag=tag; - m_direction=direction; - + m_flag1 = flag1; + m_flag2 = flag2; + m_flag3 = flag3; + m_flag4 = flag4; + + m_action = action; + m_strength = strength; + + m_tag = tag; + m_direction = direction; + } -BOOL CAircraft::OnInitDialog() +BOOL CAircraft::OnInitDialog() { CDialog::OnInitDialog(); - + // init the common (!) dialog things int i; - CComboBox* house, *tag; - - house=(CComboBox*)GetDlgItem(IDC_HOUSE); - - tag=(CComboBox*)GetDlgItem(IDC_TAG); - + CComboBox* house, * tag; + + house = (CComboBox*)GetDlgItem(IDC_HOUSE); + + tag = (CComboBox*)GetDlgItem(IDC_TAG); + ListHouses(*house, FALSE); ListTags(*tag, TRUE); ListYesNo(*(CComboBox*)GetDlgItem(IDC_P3)); - + UpdateData(FALSE); - m_strength_ctrl.SetRange(0,256); + m_strength_ctrl.SetRange(0, 256); m_strength_ctrl.SetPos(atoi(m_strength)); - + UpdateStrings(); - return TRUE; + return TRUE; } -void CAircraft::OnOK() +void CAircraft::OnOK() { CDialog::OnOK(); - m_strength=GetText(&m_strength_ctrl); + m_strength = GetText(&m_strength_ctrl); + - UpdateData(); - m_house=TranslateHouse(m_house, FALSE); + m_house = TranslateHouse(m_house, FALSE); TruncSpace(m_tag); TruncSpace(m_flag1); TruncSpace(m_flag2); diff --git a/MissionEditor/Aircraft.h b/MissionEditor/Aircraft.h index 48a9160..55ba96b 100644 --- a/MissionEditor/Aircraft.h +++ b/MissionEditor/Aircraft.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_AIRCRAFT_H__15BD6160_8953_11D3_B63B_A583BFBD8C41__INCLUDED_) @@ -30,11 +30,11 @@ class CAircraft : public CDialog { -// construction + // construction public: void UpdateStrings(); CString m_strength; - void Init(CString house="", CString strength="256", CString direction="64", CString action="Guard", CString tag="None", CString flag1="0", CString flag2="0", CString flag3="0", CString flag4="0"); + void Init(CString house = "", CString strength = "256", CString direction = "64", CString action = "Guard", CString tag = "None", CString flag1 = "0", CString flag2 = "0", CString flag3 = "0", CString flag4 = "0"); CAircraft(CWnd* pParent = NULL); // standard constructor // dialog field data @@ -55,7 +55,7 @@ public: // overwriteables // generated from class assistant //{{AFX_VIRTUAL(CAircraft) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL diff --git a/MissionEditor/All.cpp b/MissionEditor/All.cpp index 9a2f9c2..8797e03 100644 --- a/MissionEditor/All.cpp +++ b/MissionEditor/All.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // All1.cpp: Implementierungsdatei @@ -87,10 +87,10 @@ void CAll::UpdateDialog() { //m_Sections.Clear(); - while(m_Sections.DeleteString(0)!=-1); - while(m_Keys.DeleteString(0)!=-1); - CIniFile& ini=Map->GetIniFile(); - + while (m_Sections.DeleteString(0) != -1); + while (m_Keys.DeleteString(0) != -1); + CIniFile& ini = Map->GetIniFile(); + m_Value.SetWindowText(""); @@ -105,22 +105,21 @@ void CAll::UpdateDialog() OnSelchangeSections(); } -void CAll::OnSelchangeSections() +void CAll::OnSelchangeSections() { - while(m_Keys.DeleteString(0)!=CB_ERR); - CIniFile& ini=Map->GetIniFile(); + while (m_Keys.DeleteString(0) != CB_ERR); + CIniFile& ini = Map->GetIniFile(); CString cuSection; m_Sections.GetWindowText(cuSection); - if(cuSection.GetLength()) - { + if (cuSection.GetLength()) { int i; m_Keys.SetRedraw(FALSE); - SetCursor(LoadCursor(0,IDC_WAIT)); - for(auto const&[key, val] : ini[cuSection]) { + SetCursor(LoadCursor(0, IDC_WAIT)); + for (auto const& [key, val] : ini[cuSection]) { m_Keys.InsertString(-1, key); - + } SetCursor(m_hArrowCursor); m_Keys.SetRedraw(TRUE); @@ -129,62 +128,62 @@ void CAll::OnSelchangeSections() } -void CAll::OnChangeValue() +void CAll::OnChangeValue() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + CString t; m_Value.GetWindowText(t); CString cuSection; m_Sections.GetWindowText(cuSection); - + CString cuKey; if (m_Keys.GetCurSel() >= 0) { m_Keys.GetText(m_Keys.GetCurSel(), cuKey); } ini.SetString(cuSection, cuKey, t); - + } -void CAll::OnSelchangeKeys() +void CAll::OnSelchangeKeys() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString cuSection; m_Sections.GetWindowText(cuSection); CString cuKey; - m_Keys.GetText(m_Keys.GetCurSel(), cuKey) ; - + m_Keys.GetText(m_Keys.GetCurSel(), cuKey); + m_Value.SetWindowText(ini.GetString(cuSection, cuKey)); } -void CAll::OnUpdateValue() +void CAll::OnUpdateValue() { - + } -void CAll::OnAddsection() +void CAll::OnAddsection() { CString name = InputBox("Please set the name of the new section (the section may already exist)", "Insert Section"); - + CIniFile& ini = Map->GetIniFile(); ini.AddSection(name); - + UpdateDialog(); } -void CAll::OnDeletesection() +void CAll::OnDeletesection() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int cusection; - cusection=m_Sections.GetCurSel(); - if (cusection==-1) { + cusection = m_Sections.GetCurSel(); + if (cusection == -1) { MessageBox("You cannot delete a section without choosing one."); return; } @@ -195,65 +194,65 @@ void CAll::OnDeletesection() if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete section", MB_YESNO) == IDNO) { return; } - + ini.DeleteSection(str); UpdateDialog(); } -void CAll::OnDeletekey() +void CAll::OnDeletekey() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int cukey; - if(m_Sections.GetCurSel()<0) return; - cukey=m_Keys.GetCurSel(); - if(cukey==-1) { + if (m_Sections.GetCurSel() < 0) return; + cukey = m_Keys.GetCurSel(); + if (cukey == -1) { MessageBox("You cannot delete a key without choosing one."); return; } CString str; CString sec; - int cuSection=m_Sections.GetCurSel(); + int cuSection = m_Sections.GetCurSel(); m_Sections.GetLBText(cuSection, sec); m_Keys.GetText(cukey, str); if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete key", MB_YESNO) == IDNO) { return; } - + ini.RemoveValueByKey(sec, str); - UpdateDialog(); + UpdateDialog(); m_Sections.SetCurSel(cuSection); OnSelchangeSections(); } -void CAll::OnAddkey() +void CAll::OnAddkey() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int cusection; - cusection=m_Sections.GetCurSel(); - if(cusection==-1) { + cusection = m_Sections.GetCurSel(); + if (cusection == -1) { MessageBox("You need to specify a section first."); return; } - + CString sec; m_Sections.GetLBText(cusection, sec); CString key, value; - key=InputBox("Please set the name and value for the current key here: (for example, setting a new key ""Strength"" with the value 200 can be written as ""Strength=200"". You don´t need to specify a value.)", "Create key"); + key = InputBox("Please set the name and value for the current key here: (for example, setting a new key ""Strength"" with the value 200 can be written as ""Strength=200"". You don´t need to specify a value.)", "Create key"); if (key.Find("=") != -1) { // value specified // MW BUGFIX - value=key.Right(key.GetLength()-key.Find("=")-1); - key=key.Left(key.Find("=")); + value = key.Right(key.GetLength() - key.Find("=") - 1); + key = key.Left(key.Find("=")); } - + ini.SetString(sec, key, value); UpdateDialog(); @@ -261,25 +260,23 @@ void CAll::OnAddkey() OnSelchangeSections(); } -void CAll::OnInisection() +void CAll::OnInisection() { CFileDialog dlg(FALSE, ".ini", "*.ini", OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, "INI files|*.ini|"); char cuPath[MAX_PATH]; - BOOL hidePreview=FALSE; - BOOL previewPrinted=FALSE; + BOOL hidePreview = FALSE; + BOOL previewPrinted = FALSE; GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; - if(dlg.DoModal()!=IDCANCEL) - { + if (dlg.DoModal() != IDCANCEL) { CImportINI impini; - impini.m_FileName=dlg.GetPathName(); - if(impini.DoModal()!=IDCANCEL) - { - UpdateDialog(); + impini.m_FileName = dlg.GetPathName(); + if (impini.DoModal() != IDCANCEL) { + UpdateDialog(); } } } diff --git a/MissionEditor/All.h b/MissionEditor/All.h index e5b43e9..9456a5e 100644 --- a/MissionEditor/All.h +++ b/MissionEditor/All.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_ALL1_H__B5D522E4_69CE_11D3_99E1_C138647F2A00__INCLUDED_) @@ -32,7 +32,7 @@ class CAll : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateDialog(); CAll(CWnd* pParent = NULL); // Standardkonstruktor @@ -54,7 +54,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CAll) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/BackCliffModifier.cpp b/MissionEditor/BackCliffModifier.cpp index f9a1499..b4d24a3 100644 --- a/MissionEditor/BackCliffModifier.cpp +++ b/MissionEditor/BackCliffModifier.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // BackCliffModifier.cpp: Implementierung der Klasse CBackCliffModifier. @@ -30,7 +30,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif @@ -45,48 +45,43 @@ CBackCliffModifier::CBackCliffModifier() CBackCliffModifier::~CBackCliffModifier() { - + } -void CBackCliffModifier::ModifyCurrentPos(DWORD *dwPos, BOOL bBeforePlacing, BOOL bSmall) +void CBackCliffModifier::ModifyCurrentPos(DWORD* dwPos, BOOL bBeforePlacing, BOOL bSmall) { - if(!bBeforePlacing) - { - if(m_direction==cd_verticdiag_top) (*dwPos)+=2+0*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwPos)+=-2+0*Map->GetIsoSize(); + if (!bBeforePlacing) { + if (m_direction == cd_verticdiag_top) (*dwPos) += 2 + 0 * Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwPos) += -2 + 0 * Map->GetIsoSize(); } } -void CBackCliffModifier::ModifyStartPos(DWORD *dwPos, BOOL bSmall) +void CBackCliffModifier::ModifyStartPos(DWORD* dwPos, BOOL bSmall) { - if(m_direction==cd_verticdiag_top) (*dwPos)+=1+1*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwPos)+=-1+0*Map->GetIsoSize(); + if (m_direction == cd_verticdiag_top) (*dwPos) += 1 + 1 * Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwPos) += -1 + 0 * Map->GetIsoSize(); - if(m_direction==cd_horiz_right) (*dwPos)+=0+0*Map->GetIsoSize(); - if(m_direction==cd_horiz_left) - { - - int ground=Map->GetFielddataAt(*dwPos)->wGround; - (*dwPos)+=0+Map->GetIsoSize(); - if(ground==0xFFFF) ground=0; - if((*tiledata)[ground].wTileSet==cliffset) - { - (*dwPos)-=Map->GetIsoSize(); + if (m_direction == cd_horiz_right) (*dwPos) += 0 + 0 * Map->GetIsoSize(); + if (m_direction == cd_horiz_left) { + + int ground = Map->GetFielddataAt(*dwPos)->wGround; + (*dwPos) += 0 + Map->GetIsoSize(); + if (ground == 0xFFFF) ground = 0; + if ((*tiledata)[ground].wTileSet == cliffset) { + (*dwPos) -= Map->GetIsoSize(); //ModifyStartPos(dwPos, bSmall); } } - if(m_direction==cd_vertic_top) - { - int ground=Map->GetFielddataAt(*dwPos)->wGround; - - (*dwPos)+=1; - if(ground==0xFFFF) ground=0; - if((*tiledata)[ground].wTileSet==cliffset) - { - (*dwPos)-=1; + if (m_direction == cd_vertic_top) { + int ground = Map->GetFielddataAt(*dwPos)->wGround; + + (*dwPos) += 1; + if (ground == 0xFFFF) ground = 0; + if ((*tiledata)[ground].wTileSet == cliffset) { + (*dwPos) -= 1; //ModifyStartPos(dwPos, bSmall); } } @@ -95,6 +90,6 @@ void CBackCliffModifier::ModifyStartPos(DWORD *dwPos, BOOL bSmall) CString CBackCliffModifier::GetDataSection() { - if(m_bAlternative) return ("CliffBackDataAlt"); + if (m_bAlternative) return ("CliffBackDataAlt"); return("CliffBackData"); } diff --git a/MissionEditor/BackCliffModifier.h b/MissionEditor/BackCliffModifier.h index 114c95b..1091b39 100644 --- a/MissionEditor/BackCliffModifier.h +++ b/MissionEditor/BackCliffModifier.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // BackCliffModifier.h: Schnittstelle für die Klasse CBackCliffModifier. @@ -31,7 +31,7 @@ #include "CliffModifier.h" -class CBackCliffModifier : public CCliffModifier +class CBackCliffModifier : public CCliffModifier { public: CBackCliffModifier(); diff --git a/MissionEditor/Basic.cpp b/MissionEditor/Basic.cpp index f2f086c..ceac04e 100644 --- a/MissionEditor/Basic.cpp +++ b/MissionEditor/Basic.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Basic.cpp: Implementierungsdatei @@ -120,7 +120,7 @@ END_MESSAGE_MAP() void CBasic::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); auto const& basicSec = ini["Basic"]; m_AltNextScenario.SetWindowText(basicSec["AltNextScenario"]); @@ -154,9 +154,9 @@ void CBasic::UpdateDialog() } -void CBasic::OnChangeName() +void CBasic::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Name", GetText(&m_Name)); } @@ -168,123 +168,123 @@ void CBasic::UpdateData() } -void CBasic::OnEditchangeNextscenario() +void CBasic::OnEditchangeNextscenario() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "NextScenario", GetText(&m_NextScenario)); } -void CBasic::OnEditchangeAltnextscenario() +void CBasic::OnEditchangeAltnextscenario() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "AltNextScenario", GetText(&m_AltNextScenario)); } -void CBasic::OnChangeNewiniformat() +void CBasic::OnChangeNewiniformat() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "NewINIFormat", GetText(&m_NewINIFormat)); } -void CBasic::OnChangeCarryovercap() +void CBasic::OnChangeCarryovercap() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "CarryOverCap", GetText(&m_CarryOverCap)); } -void CBasic::OnEditchangeEndofgame() +void CBasic::OnEditchangeEndofgame() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "EndOfGame", GetText(&m_EndOfGame)); } -void CBasic::OnEditchangeSkipscore() +void CBasic::OnEditchangeSkipscore() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "SkipScore", GetText(&m_SkipScore)); } -void CBasic::OnEditchangeOnetimeonly() +void CBasic::OnEditchangeOnetimeonly() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "OneTimeOnly", GetText(&m_OneTimeOnly)); } -void CBasic::OnEditchangeSkipmapselect() +void CBasic::OnEditchangeSkipmapselect() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "SkipMapSelect", GetText(&m_SkipMapSelect)); } -void CBasic::OnEditchangeOfficial() +void CBasic::OnEditchangeOfficial() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Official", GetText(&m_Official)); } -void CBasic::OnEditchangeIgnoreglobalaitriggers() +void CBasic::OnEditchangeIgnoreglobalaitriggers() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "IgnoreGlobalAITriggers", GetText(&m_IgnoreGlobalAITriggers)); } -void CBasic::OnEditchangeTruckcrate() +void CBasic::OnEditchangeTruckcrate() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "TruckCrate", GetText(&m_TruckCrate)); } -void CBasic::OnEditchangeTraincrate() +void CBasic::OnEditchangeTraincrate() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "TrainCrate", GetText(&m_TrainCrate)); } -void CBasic::OnChangePercent() +void CBasic::OnChangePercent() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Percent", GetText(&m_Percent)); } -void CBasic::OnChangeMultiplayeronly() +void CBasic::OnChangeMultiplayeronly() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "MultiplayerOnly", GetText(&m_MultiplayerOnly)); } -void CBasic::OnEditchangeTiberiumgrowthenabled() +void CBasic::OnEditchangeTiberiumgrowthenabled() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "TiberiumGrowthEnabled", GetText(&m_TiberiumGrowthEnabled)); } -void CBasic::OnEditchangeVeingrowthenabled() +void CBasic::OnEditchangeVeingrowthenabled() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "VeinGrowthEnabled", GetText(&m_VeinGrowthEnabled)); } -void CBasic::OnEditchangeIcegrowthenabled() +void CBasic::OnEditchangeIcegrowthenabled() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "IceGrowthEnabled", GetText(&m_IceGrowthEnabled)); } -void CBasic::OnEditchangeTiberiumdeathtovisceroid() +void CBasic::OnEditchangeTiberiumdeathtovisceroid() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "TiberiumDeathToVisceroid", GetText(&m_TiberiumDeathToVisceroid)); } -void CBasic::OnEditchangeFreeradar() +void CBasic::OnEditchangeFreeradar() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "FreeRadar", GetText(&m_FreeRadar)); } -void CBasic::OnChangeInittime() +void CBasic::OnChangeInittime() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "InitTime", GetText(&m_InitTime)); } @@ -332,7 +332,7 @@ void CBasic::UpdateStrings() SetWindowText(TranslateStringACP("Basic")); } -void CBasic::OnEditchangeRequiredaddon() +void CBasic::OnEditchangeRequiredaddon() { CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "RequiredAddOn", GetText(&m_RequiredAddOn)); @@ -342,7 +342,7 @@ void CBasic::OnEditchangeRequiredaddon() } -void CBasic::PostNcDestroy() +void CBasic::PostNcDestroy() { // do not call PostNcDestroy as this is a member of FinalSunDlg //CPropertyPage::PostNcDestroy(); diff --git a/MissionEditor/Basic.h b/MissionEditor/Basic.h index 7687b58..216d0c2 100644 --- a/MissionEditor/Basic.h +++ b/MissionEditor/Basic.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_BASIC_H__C350C7AC_63C3_11D3_99E0_C30F10710B17__INCLUDED_) @@ -34,7 +34,7 @@ class CBasic : public CDialog { DECLARE_DYNCREATE(CBasic) -// Konstruktion + // Konstruktion public: void UpdateStrings(); void UpdateData(); @@ -42,8 +42,8 @@ public: CBasic(); ~CBasic(); -// Dialogfelddaten - //{{AFX_DATA(CBasic) + // Dialogfelddaten + //{{AFX_DATA(CBasic) enum { IDD = IDD_BASIC }; CMyComboBox m_RequiredAddOn; CMyComboBox m_VeinGrowthEnabled; @@ -73,7 +73,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CBasic) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/Bitmap2MapConverter.cpp b/MissionEditor/Bitmap2MapConverter.cpp index 009f039..2e0cd9d 100644 --- a/MissionEditor/Bitmap2MapConverter.cpp +++ b/MissionEditor/Bitmap2MapConverter.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Bitmap2MapConverter.cpp: Implementierung der Klasse CBitmap2MapConverter. @@ -28,7 +28,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif @@ -51,139 +51,128 @@ I originally intended this tool to support different theaters, but currently it does only support temperate. People can use copy/paste to convert those maps though! */ -BOOL CBitmap2MapConverter::Convert(HBITMAP hBitmap, CMapData & mapdata) +BOOL CBitmap2MapConverter::Convert(HBITMAP hBitmap, CMapData& mapdata) { BITMAP bm; - - GetObject(hBitmap, sizeof(BITMAP), &bm); - - HBITMAP hUsed=hBitmap; - - - if(bm.bmWidth+bm.bmHeight>255) - { - float scalex=(float)bm.bmWidth/(float)bm.bmHeight; - int neededheight, neededwidth; - neededheight=255.0f/(scalex+1.0f); - neededwidth=255-neededheight; - hUsed=CreateCompatibleBitmap(GetDC(NULL), neededwidth, neededheight); - HDC hDC=CreateCompatibleDC(GetDC(NULL)); + GetObject(hBitmap, sizeof(BITMAP), &bm); + + HBITMAP hUsed = hBitmap; + + + if (bm.bmWidth + bm.bmHeight > 255) { + float scalex = (float)bm.bmWidth / (float)bm.bmHeight; + int neededheight, neededwidth; + neededheight = 255.0f / (scalex + 1.0f); + neededwidth = 255 - neededheight; + + hUsed = CreateCompatibleBitmap(GetDC(NULL), neededwidth, neededheight); + HDC hDC = CreateCompatibleDC(GetDC(NULL)); SelectObject(hDC, hUsed); - HDC hSrcDC=CreateCompatibleDC(GetDC(NULL)); + HDC hSrcDC = CreateCompatibleDC(GetDC(NULL)); SelectObject(hSrcDC, hBitmap); - StretchBlt(hDC, 0,0,neededwidth,neededheight, hSrcDC, 0,0,bm.bmWidth, bm.bmHeight, SRCCOPY); + StretchBlt(hDC, 0, 0, neededwidth, neededheight, hSrcDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); DeleteDC(hDC); DeleteDC(hSrcDC); - + GetObject(hUsed, sizeof(BITMAP), &bm); } HDC hDC; - hDC=CreateCompatibleDC(GetDC(NULL)); + hDC = CreateCompatibleDC(GetDC(NULL)); SelectObject(hDC, hUsed); - + srand(GetTickCount()); int i; int e; - int theater=0; + int theater = 0; mapdata.CreateMap(bm.bmWidth, bm.bmHeight, "TEMPERATE", 0); - int isosize=mapdata.GetIsoSize(); + int isosize = mapdata.GetIsoSize(); - for(i=0;i<(*tiledata_count);i++) - if((*tiledata)[i].wTileSet==waterset) break; + for (i = 0; i < (*tiledata_count); i++) + if ((*tiledata)[i].wTileSet == waterset) break; - int water_start=i+8; // to 12 + int water_start = i + 8; // to 12 int sandset = tiles->GetInteger("General", "SandTile"); - int greenset= tiles->GetInteger("General", "GreenTile"); + int greenset = tiles->GetInteger("General", "GreenTile"); #ifdef RA2_MODE sandset = tiles->GetInteger("General", "GreenTile"); greenset = tiles->GetInteger("General", "RoughTile"); #endif - for(i=0;i<(*tiledata_count);i++) - if((*tiledata)[i].wTileSet==sandset) break; + for (i = 0; i < (*tiledata_count); i++) + if ((*tiledata)[i].wTileSet == sandset) break; - int sand_start=i; + int sand_start = i; - for(i=0;i<(*tiledata_count);i++) - if((*tiledata)[i].wTileSet==greenset) break; + for (i = 0; i < (*tiledata_count); i++) + if ((*tiledata)[i].wTileSet == greenset) break; - int green_start=i; + int green_start = i; - for(i=0;iisosize*isosize) continue; - - FIELDDATA* fd=mapdata.GetFielddataAt(dwPos); - - int r=GetRValue(col); - int g=GetGValue(col); - int b=GetBValue(col); - if(g>r && g>b) - { - if(theater!=1) - { - fd->wGround=0; - fd->bSubTile=0; + for (x = -1; x < 2; x++) { + for (y = -1; y < 2; y++) { + DWORD dwPos = xiso + x + (yiso + y) * isosize; + + if (dwPos > isosize * isosize) continue; + + FIELDDATA* fd = mapdata.GetFielddataAt(dwPos); + + int r = GetRValue(col); + int g = GetGValue(col); + int b = GetBValue(col); + + if (g > r && g > b) { + if (theater != 1) { + fd->wGround = 0; + fd->bSubTile = 0; } } - if(b>g && b>r) - { - int p=rand()*4/RAND_MAX; - fd->wGround=water_start+p; - fd->bSubTile=0; + if (b > g && b > r) { + int p = rand() * 4 / RAND_MAX; + fd->wGround = water_start + p; + fd->bSubTile = 0; } - if(g>b+25 && r>b+25 && g>120 && r>120) - { - if(theater!=1) - { - fd->wGround=sand_start; - fd->bSubTile=0; + if (g > b + 25 && r > b + 25 && g > 120 && r > 120) { + if (theater != 1) { + fd->wGround = sand_start; + fd->bSubTile = 0; } } - if(b<20 && r<20 && g>20) - { + if (b < 20 && r < 20 && g>20) { #ifdef RA2_MODE - if(g<140) // dark only + if (g < 140) // dark only #endif { - fd->wGround=green_start; - fd->bSubTile=0; + fd->wGround = green_start; + fd->bSubTile = 0; } - + } } @@ -191,16 +180,15 @@ BOOL CBitmap2MapConverter::Convert(HBITMAP hBitmap, CMapData & mapdata) } } - mapdata.CreateShore(0,0,isosize, isosize); + mapdata.CreateShore(0, 0, isosize, isosize); - for(i=0;i. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Bitmap2MapConverter.h: Schnittstelle für die Klasse CBitmap2MapConverter. @@ -31,7 +31,7 @@ #pragma once #endif // _MSC_VER > 1000 -class CBitmap2MapConverter +class CBitmap2MapConverter { public: BOOL Convert(HBITMAP hBitmap, CMapData& mapdata); diff --git a/MissionEditor/Building.cpp b/MissionEditor/Building.cpp index 1a55d95..a601b09 100644 --- a/MissionEditor/Building.cpp +++ b/MissionEditor/Building.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Building.cpp: Implementierungsdatei @@ -81,7 +81,7 @@ void CBuilding::DoDataExchange(CDataExchange* pDX) DDX_CBString(pDX, IDC_TAG, m_tag); //}}AFX_DATA_MAP - + } @@ -98,19 +98,19 @@ CString GetName(CString id) return rules.GetString(id, "Name"); } -void CBuilding::OnOK() +void CBuilding::OnOK() { CDialog::OnOK(); - m_strength=GetText(&m_strength_ctrl); + m_strength = GetText(&m_strength_ctrl); UpdateData(); char d[50]; TruncSpace(m_spotlight); itoa(atoi(m_spotlight), d, 10); - m_spotlight=d; - - m_house=TranslateHouse(m_house); + m_spotlight = d; + + m_house = TranslateHouse(m_house); TruncSpace(m_upgrade1); TruncSpace(m_upgrade2); TruncSpace(m_upgrade3); @@ -119,38 +119,38 @@ void CBuilding::OnOK() TruncSpace(m_flag2); TruncSpace(m_flag3); TruncSpace(m_flag4); - + // } -BOOL CBuilding::OnInitDialog() +BOOL CBuilding::OnInitDialog() { CDialog::OnInitDialog(); - - CIniFile& ini=Map->GetIniFile(); + + CIniFile& ini = Map->GetIniFile(); int i; - CComboBox* chouse, *ctag; - chouse=(CComboBox*)GetDlgItem(IDC_HOUSE); - ctag=(CComboBox*)GetDlgItem(IDC_TAG); - + CComboBox* chouse, * ctag; + chouse = (CComboBox*)GetDlgItem(IDC_HOUSE); + ctag = (CComboBox*)GetDlgItem(IDC_TAG); + ListHouses(*chouse, FALSE); ListTags(*ctag, TRUE); - - - - m_strength_ctrl.SetRange(0,256); + + + + m_strength_ctrl.SetRange(0, 256); m_strength_ctrl.SetPos(atoi(m_strength)); UpdateData(FALSE); - int upgradecount=0; + int upgradecount = 0; if (strcmp(m_type, "GACTWR") == NULL) { upgradecount = 1; } upgradecount = ini.GetInteger(m_type, "Upgrades"); - + GetDlgItem(IDC_P5)->SendMessage(CB_SETCURSEL, atoi(m_spotlight), 0); if (upgradecount > 0) { @@ -174,50 +174,47 @@ BOOL CBuilding::OnInitDialog() GetDlgItem(IDC_P6)->EnableWindow(TRUE); GetDlgItem(IDC_P4)->EnableWindow(TRUE); - if(upgradecount<3) + if (upgradecount < 3) GetDlgItem(IDC_P8)->EnableWindow(FALSE); - if(upgradecount<2) + if (upgradecount < 2) GetDlgItem(IDC_P7)->EnableWindow(FALSE); - if(upgradecount<1) - { + if (upgradecount < 1) { GetDlgItem(IDC_P6)->EnableWindow(FALSE); GetDlgItem(IDC_P4)->EnableWindow(FALSE); } - + UpdateStrings(); - - return TRUE; + + return TRUE; } void CBuilding::Init(CString house, CString strength, CString direction, CString tag, CString flag1, CString flag2, CString energy, CString upgradecount, CString spotlight, CString upgrade1, CString upgrade2, CString upgrade3, CString flag3, CString flag4) { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(house=="") - { - house=TranslateHouse(Map->GetHouseID(0), TRUE); - } - else - m_house=TranslateHouse(house, TRUE); - + if (house == "") { + house = TranslateHouse(Map->GetHouseID(0), TRUE); + } else + m_house = TranslateHouse(house, TRUE); - - m_house=TranslateHouse(house, TRUE); - m_flag1=flag1; - m_flag2=flag2; - m_flag3=flag3; - m_flag4=flag4; - m_spotlight=spotlight; - m_energy=energy; - m_upgrade1=upgrade1; - m_upgrade2=upgrade2; - m_upgrade3=upgrade3; - m_upgradecount=upgradecount; - m_strength=strength; - m_tag=tag; - m_direction=direction; + + + m_house = TranslateHouse(house, TRUE); + m_flag1 = flag1; + m_flag2 = flag2; + m_flag3 = flag3; + m_flag4 = flag4; + m_spotlight = spotlight; + m_energy = energy; + m_upgrade1 = upgrade1; + m_upgrade2 = upgrade2; + m_upgrade3 = upgrade3; + m_upgradecount = upgradecount; + m_strength = strength; + m_tag = tag; + m_direction = direction; } diff --git a/MissionEditor/Building.h b/MissionEditor/Building.h index 739450d..6969e75 100644 --- a/MissionEditor/Building.h +++ b/MissionEditor/Building.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_BUILDING_H__44A11CC0_84B6_11D3_B63B_F881F458F743__INCLUDED_) @@ -32,12 +32,12 @@ class CBuilding : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateStrings(); CString m_type; CString m_strength; - void Init(CString house="", CString strength="256", CString direction="0", CString tag="None", CString flag1="0", CString flag2="0", CString energy="1", CString upgradecount="0", CString spotlight="0", CString upgrade1="None", CString upgrade2="None", CString upgrade3="None", CString flag3="0", CString flag4="0"); + void Init(CString house = "", CString strength = "256", CString direction = "0", CString tag = "None", CString flag1 = "0", CString flag2 = "0", CString energy = "1", CString upgradecount = "0", CString spotlight = "0", CString upgrade1 = "None", CString upgrade2 = "None", CString upgrade3 = "None", CString flag3 = "0", CString flag4 = "0"); CBuilding(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten @@ -63,7 +63,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CBuilding) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/CellTag.cpp b/MissionEditor/CellTag.cpp index ba036cc..ce40fb3 100644 --- a/MissionEditor/CellTag.cpp +++ b/MissionEditor/CellTag.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // CellTag.cpp: Implementierungsdatei @@ -66,38 +66,35 @@ END_MESSAGE_MAP() string GetParam(string data, int pos); -BOOL CCellTag::OnInitDialog() +BOOL CCellTag::OnInitDialog() { CDialog::OnInitDialog(); - CIniFile& ini=Map->GetIniFile(); - - CComboBox& m_Tag=*((CComboBox*)GetDlgItem(IDC_TAG)); + CIniFile& ini = Map->GetIniFile(); - if(!ini.TryGetSection("Tags")) - { + CComboBox& m_Tag = *((CComboBox*)GetDlgItem(IDC_TAG)); + + if (!ini.TryGetSection("Tags")) { MessageBox("No tags are specified."); OnCancel(); - } - else - { + } else { ListTags(m_Tag, FALSE); if (m_tag == "") { m_Tag.SetCurSel(0); } } - + UpdateStrings(); - return TRUE; + return TRUE; } -void CCellTag::OnOK() +void CCellTag::OnOK() { UpdateData(); - + CDialog::OnOK(); - + TruncSpace(m_tag); } @@ -106,5 +103,5 @@ void CCellTag::UpdateStrings() SetWindowText(GetLanguageStringACP("CellTagCap")); GetDlgItem(IDC_LTAG)->SetWindowText(GetLanguageStringACP("CellTagTag")); GetDlgItem(IDC_LDESC)->SetWindowText(GetLanguageStringACP("CellTagDesc")); - + } diff --git a/MissionEditor/CellTag.h b/MissionEditor/CellTag.h index 7b54107..3707c98 100644 --- a/MissionEditor/CellTag.h +++ b/MissionEditor/CellTag.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_CELLTAG_H__F41D5900_9133_11D3_B63B_D010F279DC93__INCLUDED_) @@ -32,7 +32,7 @@ class CCellTag : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateStrings(); CCellTag(CWnd* pParent = NULL); // Standardkonstruktor @@ -47,7 +47,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CCellTag) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/ChangeSizeDlg.cpp b/MissionEditor/ChangeSizeDlg.cpp index bbcd9da..ae2fb27 100644 --- a/MissionEditor/ChangeSizeDlg.cpp +++ b/MissionEditor/ChangeSizeDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ChangeSizeDlg.cpp: Implementierungsdatei @@ -45,8 +45,8 @@ CChangeSizeDlg::CChangeSizeDlg(CWnd* pParent /*=NULL*/) m_Top = 0; m_Width = 0; //}}AFX_DATA_INIT - m_Width=Map->GetWidth(); - m_Height=Map->GetHeight(); + m_Width = Map->GetWidth(); + m_Height = Map->GetHeight(); } @@ -74,20 +74,18 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CChangeSizeDlg -void CChangeSizeDlg::OnChangeWidth() -{ - if(UpdateData(TRUE)) - { - m_Left=(m_Width-Map->GetWidth())/2; +void CChangeSizeDlg::OnChangeWidth() +{ + if (UpdateData(TRUE)) { + m_Left = (m_Width - Map->GetWidth()) / 2; UpdateData(FALSE); } } -void CChangeSizeDlg::OnChangeHeight() +void CChangeSizeDlg::OnChangeHeight() { - if(UpdateData(TRUE)) - { - m_Top=(m_Height-Map->GetHeight())/2; + if (UpdateData(TRUE)) { + m_Top = (m_Height - Map->GetHeight()) / 2; UpdateData(FALSE); - } + } } diff --git a/MissionEditor/ChangeSizeDlg.h b/MissionEditor/ChangeSizeDlg.h index 51f254d..e075058 100644 --- a/MissionEditor/ChangeSizeDlg.h +++ b/MissionEditor/ChangeSizeDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_CHANGESIZEDLG_H__60391D80_1E15_11D5_89B2_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CChangeSizeDlg : public CDialog { -// Konstruktion + // Konstruktion public: CChangeSizeDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -49,7 +49,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CChangeSizeDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/CliffModifier.cpp b/MissionEditor/CliffModifier.cpp index 5480bbf..6dd4184 100644 --- a/MissionEditor/CliffModifier.cpp +++ b/MissionEditor/CliffModifier.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // CliffModifier.cpp: Implementierung der Klasse CCliffModifier. @@ -29,7 +29,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif @@ -49,234 +49,202 @@ CCliffModifier::~CCliffModifier() BOOL CCliffModifier::PlaceCliff(DWORD dwXFrom, DWORD dwYFrom, DWORD dwXDest, DWORD dwYDest, BOOL bAlternative) { - m_bAlternative=bAlternative; + m_bAlternative = bAlternative; int x_diff, y_diff; - x_diff=dwXDest-dwXFrom; - y_diff=dwYDest-dwYFrom; + x_diff = dwXDest - dwXFrom; + y_diff = dwYDest - dwYFrom; - if(x_diff>0 && y_diff>0 && ((float)y_diff)/((float)x_diff) > 1.33f) - { - x_diff=0; - dwXDest=dwXFrom; + if (x_diff > 0 && y_diff > 0 && ((float)y_diff) / ((float)x_diff) > 1.33f) { + x_diff = 0; + dwXDest = dwXFrom; } - if(x_diff<0 && y_diff>0 && ((float)y_diff)/(-(float)x_diff) > 1.33f) - { - x_diff=0; - dwXDest=dwXFrom; + if (x_diff < 0 && y_diff>0 && ((float)y_diff) / (-(float)x_diff) > 1.33f) { + x_diff = 0; + dwXDest = dwXFrom; } - if(x_diff>0 && y_diff<0 && ((float)-y_diff)/((float)x_diff) > 1.33f) - { - x_diff=0; - dwXDest=dwXFrom; + if (x_diff > 0 && y_diff < 0 && ((float)-y_diff) / ((float)x_diff) > 1.33f) { + x_diff = 0; + dwXDest = dwXFrom; } - if(x_diff<0 && y_diff<0 && (-(float)y_diff)/(-(float)x_diff) > 1.33f) - { - x_diff=0; - dwXDest=dwXFrom; + if (x_diff < 0 && y_diff < 0 && (-(float)y_diff) / (-(float)x_diff) > 1.33f) { + x_diff = 0; + dwXDest = dwXFrom; } - if(y_diff>0 && x_diff>0 && ((float)x_diff)/((float)y_diff) > 2) - { - y_diff=0; - dwYDest=dwYFrom; + if (y_diff > 0 && x_diff > 0 && ((float)x_diff) / ((float)y_diff) > 2) { + y_diff = 0; + dwYDest = dwYFrom; } - if(y_diff<0 && x_diff>0 && ((float)x_diff)/(-(float)y_diff) > 2) - { - y_diff=0; - dwYDest=dwYFrom; + if (y_diff < 0 && x_diff>0 && ((float)x_diff) / (-(float)y_diff) > 2) { + y_diff = 0; + dwYDest = dwYFrom; } - if(y_diff>0 && x_diff<0 && ((float)-x_diff)/((float)y_diff) > 2) - { - y_diff=0; - dwYDest=dwYFrom; + if (y_diff > 0 && x_diff < 0 && ((float)-x_diff) / ((float)y_diff) > 2) { + y_diff = 0; + dwYDest = dwYFrom; } - if(y_diff<0 && x_diff<0 && (-(float)x_diff)/(-(float)y_diff) > 2) - { - y_diff=0; - dwYDest=dwYFrom; + if (y_diff < 0 && x_diff < 0 && (-(float)x_diff) / (-(float)y_diff) > 2) { + y_diff = 0; + dwYDest = dwYFrom; } - m_dwFrom=dwXFrom + dwYFrom*Map->GetIsoSize(); - m_dwTo=dwXDest + dwYDest*Map->GetIsoSize(); - - if(!x_diff && !y_diff) return FALSE; - - if(x_diff && y_diff) - { - if((x_diff>0 && y_diff>0)) - { - m_direction=cd_verticdiag_bottom; - } - else if((x_diff<0 && y_diff<0)) - { - m_direction=cd_verticdiag_top; - } - else if((x_diff<0 && y_diff>0) ) - { - m_direction=cd_horizdiag_right; - } - else if(x_diff>0 && y_diff<0) - { - m_direction=cd_horizdiag_left; + m_dwFrom = dwXFrom + dwYFrom * Map->GetIsoSize(); + m_dwTo = dwXDest + dwYDest * Map->GetIsoSize(); + + if (!x_diff && !y_diff) return FALSE; + + if (x_diff && y_diff) { + if ((x_diff > 0 && y_diff > 0)) { + m_direction = cd_verticdiag_bottom; + } else if ((x_diff < 0 && y_diff < 0)) { + m_direction = cd_verticdiag_top; + } else if ((x_diff < 0 && y_diff>0)) { + m_direction = cd_horizdiag_right; + } else if (x_diff > 0 && y_diff < 0) { + m_direction = cd_horizdiag_left; } - } - else if(y_diff<0) - { - m_direction=cd_horiz_left; - } - else if(y_diff>0) - { - m_direction=cd_horiz_right; - } - else if(x_diff<0) - { - m_direction=cd_vertic_top; - } - else if(x_diff>0) - { - m_direction=cd_vertic_bottom; + } else if (y_diff < 0) { + m_direction = cd_horiz_left; + } else if (y_diff > 0) { + m_direction = cd_horiz_right; + } else if (x_diff < 0) { + m_direction = cd_vertic_top; + } else if (x_diff > 0) { + m_direction = cd_vertic_bottom; } - switch(m_direction) - { + switch (m_direction) { case cd_horiz_left: - m_addx=0; - m_addy=-1; + m_addx = 0; + m_addy = -1; break; case cd_horiz_right: - m_addx=0; - m_addy=1; + m_addx = 0; + m_addy = 1; break; case cd_horizdiag_left: - m_addx=1; - m_addy=-1; + m_addx = 1; + m_addy = -1; break; case cd_horizdiag_right: - m_addx=-1; - m_addy=1; + m_addx = -1; + m_addy = 1; break; case cd_vertic_top: - m_addx=-1; - m_addy=0; + m_addx = -1; + m_addy = 0; break; case cd_vertic_bottom: - m_addx=1; - m_addy=0; + m_addx = 1; + m_addy = 0; break; case cd_verticdiag_top: - m_addx=-1; - m_addy=-1; + m_addx = -1; + m_addy = -1; break; case cd_verticdiag_bottom: - m_addx=1; - m_addy=1; + m_addx = 1; + m_addy = 1; break; } - int i,e; - DWORD dwCurPos=m_dwFrom; - int startheight=Map->GetHeightAt(dwCurPos); + int i, e; + DWORD dwCurPos = m_dwFrom; + int startheight = Map->GetHeightAt(dwCurPos); - - DWORD dwLastTile=-1; - FIELDDATA* fd=Map->GetFielddataAt(dwCurPos); - int ground=fd->wGround; - int subtile=fd->bSubTile; - if(ground==0xFFFF) ground=0; - startheight-=(*tiledata)[ground].tiles[subtile].bZHeight; - + DWORD dwLastTile = -1; + + FIELDDATA* fd = Map->GetFielddataAt(dwCurPos); + int ground = fd->wGround; + int subtile = fd->bSubTile; + if (ground == 0xFFFF) ground = 0; + startheight -= (*tiledata)[ground].tiles[subtile].bZHeight; + ModifyStartPos(&dwCurPos, FALSE); - BOOL bSmall=FALSE; - DWORD dwFirstStartPos=dwCurPos; - DWORD dwTile=GetTileToPlace(dwCurPos, &bSmall); + BOOL bSmall = FALSE; + DWORD dwFirstStartPos = dwCurPos; + DWORD dwTile = GetTileToPlace(dwCurPos, &bSmall); - - - BOOL bFirstPos=TRUE; - while(dwCurPos!=m_dwTo) - { + + BOOL bFirstPos = TRUE; + + while (dwCurPos != m_dwTo) { ModifyCurrentPos(&dwCurPos, TRUE, bSmall); - if(!bFirstPos) - { - dwTile=GetTileToPlace(dwCurPos, &bSmall); - dwLastTile=dwTile; - } - else - bFirstPos=FALSE; - if(dwTile==-1) break; - - TILEDATA* t=&(*tiledata)[dwTile]; - - if(m_addx<0) dwCurPos+=t->cx*m_addx; - if(m_addy<0) dwCurPos+=t->cy*m_addy*Map->GetIsoSize(); - + if (!bFirstPos) { + dwTile = GetTileToPlace(dwCurPos, &bSmall); + dwLastTile = dwTile; + } else + bFirstPos = FALSE; + if (dwTile == -1) break; - int o=0; - DWORD dwTmpTile=dwTile; - while(dwFirstStartPos!=dwCurPos && dwTile==dwLastTile) - { + TILEDATA* t = &(*tiledata)[dwTile]; + + if (m_addx < 0) dwCurPos += t->cx * m_addx; + if (m_addy < 0) dwCurPos += t->cy * m_addy * Map->GetIsoSize(); + + + int o = 0; + DWORD dwTmpTile = dwTile; + while (dwFirstStartPos != dwCurPos && dwTile == dwLastTile) { o++; - if(o==10) break; - dwTmpTile=GetTileToPlace(dwCurPos, &bSmall); + if (o == 10) break; + dwTmpTile = GetTileToPlace(dwCurPos, &bSmall); - if((*tiledata)[dwTmpTile].cx==(*tiledata)[dwTile].cx && (*tiledata)[dwTile].cy==(*tiledata)[dwTmpTile].cy) - dwTile=dwTmpTile; + if ((*tiledata)[dwTmpTile].cx == (*tiledata)[dwTile].cx && (*tiledata)[dwTile].cy == (*tiledata)[dwTmpTile].cy) + dwTile = dwTmpTile; } - - - t=&(*tiledata)[dwTile]; - - - - - - - int p=0; - for(i=0;icx;i++) - { - for(e=0;ecy;e++) - { - - if(t->tiles[p].pic!=NULL) - { - - - Map->SetHeightAt(dwCurPos+i+e*Map->GetIsoSize(), startheight+t->tiles[p].bZHeight); - Map->SetTileAt(dwCurPos+i+e*Map->GetIsoSize(), dwTile, p); - + + t = &(*tiledata)[dwTile]; + + + + + + + + int p = 0; + for (i = 0; i < t->cx; i++) { + for (e = 0; e < t->cy; e++) { + + if (t->tiles[p].pic != NULL) { + + + Map->SetHeightAt(dwCurPos + i + e * Map->GetIsoSize(), startheight + t->tiles[p].bZHeight); + Map->SetTileAt(dwCurPos + i + e * Map->GetIsoSize(), dwTile, p); + } p++; } - } + } + + if (m_addx > 0) dwCurPos += t->cx * m_addx; + if (m_addy > 0) dwCurPos += t->cy * m_addy * Map->GetIsoSize(); - if(m_addx>0) dwCurPos+=t->cx*m_addx; - if(m_addy>0) dwCurPos+=t->cy*m_addy*Map->GetIsoSize(); - ModifyCurrentPos(&dwCurPos, FALSE, bSmall); - dwLastTile=dwTile; + dwLastTile = dwTile; } - return TRUE; + return TRUE; } -void CCliffModifier::ModifyStartPos(DWORD *dwStartPos, BOOL bSmall) +void CCliffModifier::ModifyStartPos(DWORD* dwStartPos, BOOL bSmall) { } -void CCliffModifier::ModifyCurrentPos(DWORD *dwPos, BOOL bBeforePlacing, BOOL bSmall) +void CCliffModifier::ModifyCurrentPos(DWORD* dwPos, BOOL bBeforePlacing, BOOL bSmall) { - + } DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) @@ -286,30 +254,29 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) map notusedascliff; CString type; - int count=0; + int count = 0; - - switch(m_direction) - { + + switch (m_direction) { case cd_horiz_left: case cd_horiz_right: - type="horiz_"; + type = "horiz_"; break; case cd_horizdiag_left: case cd_horizdiag_right: - type="horiz_diag_"; + type = "horiz_diag_"; break; case cd_vertic_top: case cd_vertic_bottom: - type="vertic_"; + type = "vertic_"; break; case cd_verticdiag_top: case cd_verticdiag_bottom: - type="vertic_diag_"; + type = "vertic_diag_"; break; } - + CString sec = GetDataSection(); CIniFile& ini = Map->GetIniFile(); auto const& theaterID = g_data.GetString("Map", "Theater"); @@ -319,10 +286,10 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) count = g_data.GetInteger(sec, type + "c"); - - + + int i; - DWORD dwStartSet=0; + DWORD dwStartSet = 0; /*for(i=0;i<(*tiledata_count);i++) { if( (!m_bAlternative && (*tiledata)[i].wTileSet==cliffset) || (m_bAlternative && (*tiledata)[i].wTileSet==cliff2set)) @@ -332,47 +299,43 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) } }*/ // a bit faster: - if(m_bAlternative) dwStartSet=cliff2set_start; - else dwStartSet=cliffset_start; - - for(i=0;iGetIsoSize(); + CString corner_searched = ""; + DWORD dwCurPos = dwPos; + int isosize = Map->GetIsoSize(); ModifyStartPos(&dwCurPos, FALSE); int e; - for(i=-1;i<2;i++) - { - for(e=-1;e<2;e++) - { - FIELDDATA* fd=Map->GetFielddataAt(dwCurPos+i+e*isosize); - int ground=fd->wGround; - if(ground==0xFFFF) ground=0; + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { + FIELDDATA* fd = Map->GetFielddataAt(dwCurPos + i + e * isosize); + int ground = fd->wGround; + if (ground == 0xFFFF) ground = 0; - if( (*tiledata)[ground].wTileSet==cliffset && notusedascliff.find(ground)==notusedascliff.end()) - { - - - if(i==0 && e==-1) {corner_searched="cornerleft_";break;} - if(i==0 && e==1) {corner_searched="cornerright_";break;} - if(i==-1 && e==0) {corner_searched="cornertop_";break;} - if(i==1 && e==0) {corner_searched="cornerbottom_";break;} + if ((*tiledata)[ground].wTileSet == cliffset && notusedascliff.find(ground) == notusedascliff.end()) { + + + if (i == 0 && e == -1) { corner_searched = "cornerleft_"; break; } + if (i == 0 && e == 1) { corner_searched = "cornerright_"; break; } + if (i == -1 && e == 0) { corner_searched = "cornertop_"; break; } + if (i == 1 && e == 0) { corner_searched = "cornerbottom_"; break; } /*if(e==-1) {corner_searched="cornerleft_";break;} if(e==1) {corner_searched="cornerright_";break;} if(i==-1) {corner_searched="cornertop_";break;} if(i==1) {corner_searched="cornerbottom_";break;}*/ } - + } - if(corner_searched.GetLength()>0) break; + if (corner_searched.GetLength() > 0) break; } BOOL bCornerFound = FALSE;; @@ -380,74 +343,68 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) bCornerFound = TRUE; count = icount; } - - - if(!bCornerFound) corner_searched=""; - - if(count==0) return -1; - DWORD dwX=dwPos%Map->GetIsoSize(); - DWORD dwY=dwPos/Map->GetIsoSize(); - DWORD dwDX=m_dwTo%Map->GetIsoSize(); - DWORD dwDY=m_dwTo/Map->GetIsoSize(); + if (!bCornerFound) corner_searched = ""; + + if (count == 0) return -1; + + + DWORD dwX = dwPos % Map->GetIsoSize(); + DWORD dwY = dwPos / Map->GetIsoSize(); + DWORD dwDX = m_dwTo % Map->GetIsoSize(); + DWORD dwDY = m_dwTo / Map->GetIsoSize(); + - for (i = 0; i < count; i++) { char c[50]; - itoa(i,c,10); + itoa(i, c, 10); careables.push_back(dwStartSet + g_data.GetInteger(sec, type + corner_searched + c)); } - for(i=0;i0 && dwX+m_addx*t.cx>dwDX) continue; - if(m_addy>0 && dwY+m_addy*t.cy>dwDY) continue; - if(m_addx<0 && dwX+m_addx*t.cx 0 && dwX + m_addx * t.cx > dwDX) continue; + if (m_addy > 0 && dwY + m_addy * t.cy > dwDY) continue; + if (m_addx < 0 && dwX + m_addx * t.cx < dwDX) continue; + if (m_addy < 0 && dwY + m_addy * t.cy < dwDY) continue; useables.push_back(careables[i]); } - if(useables.size()<1) return -1; + if (useables.size() < 1) return -1; - - *bSmall=FALSE; + + *bSmall = FALSE; int k; - k=rand()%(useables.size()); + k = rand() % (useables.size()); - TILEDATA& t1=(*tiledata)[useables[k]]; - for(i=0;it1.cx || t.cy>t1.cy) {*bSmall=TRUE; break;} + TILEDATA& t1 = (*tiledata)[useables[k]]; + for (i = 0; i < careables.size(); i++) { + TILEDATA& t = (*tiledata)[careables[i]]; + if (t.cx > t1.cx || t.cy > t1.cy) { *bSmall = TRUE; break; } } - - // check for water - BOOL bWater=FALSE; - for(i=0;iGetFielddataAt(dwPos+i+e*Map->GetIsoSize()); - int ground=fd->wGround; - if(ground==0xFFFF) ground=0; - if((i==t1.cx-1 || e==t1.cy-1) && (*tiledata)[ground].tiles[fd->bSubTile].bHackedTerrainType==TERRAINTYPE_WATER) - { - bWater=TRUE; + // check for water + BOOL bWater = FALSE; + for (i = 0; i < t1.cx; i++) { + for (e = 0; e < t1.cy; e++) { + + FIELDDATA* fd = Map->GetFielddataAt(dwPos + i + e * Map->GetIsoSize()); + int ground = fd->wGround; + if (ground == 0xFFFF) ground = 0; + if ((i == t1.cx - 1 || e == t1.cy - 1) && (*tiledata)[ground].tiles[fd->bSubTile].bHackedTerrainType == TERRAINTYPE_WATER) { + bWater = TRUE; break; } } - if(bWater) break; + if (bWater) break; } - - if(bWater && useables[k]-dwStartSet<22) - { + + if (bWater && useables[k] - dwStartSet < 22) { CString tset; char c[50]; int watercliffs = tiles->GetInteger("General", "WaterCliffs"); @@ -459,9 +416,9 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) for (e = 0; e < 4 - strlen(c); e++) { tset += "0"; } - tset+=c; - CString sec="TileSet"; - sec+=tset; + tset += c; + CString sec = "TileSet"; + sec += tset; auto const pSec = tiles->TryGetSection(sec); if (!pSec) { @@ -470,17 +427,15 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall) if (pSec->GetInteger("TilesInSet") > useables[k] - dwStartSet) { - DWORD dwStartWaterSet=0; - for(i=0;i<(*tiledata_count);i++) - { - if((*tiledata)[i].wTileSet==watercliffs) - { - dwStartWaterSet=i; - return dwStartWaterSet+(useables[k]-dwStartSet); + DWORD dwStartWaterSet = 0; + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == watercliffs) { + dwStartWaterSet = i; + return dwStartWaterSet + (useables[k] - dwStartSet); } } - - + + } } diff --git a/MissionEditor/CliffModifier.h b/MissionEditor/CliffModifier.h index 0f12e03..54a785c 100644 --- a/MissionEditor/CliffModifier.h +++ b/MissionEditor/CliffModifier.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // CliffModifier.h: Schnittstelle für die Klasse CCliffModifier. @@ -33,21 +33,23 @@ -class CCliffModifier : public CTerrainModifier +class CCliffModifier : public CTerrainModifier { - + public: - virtual BOOL PlaceCliff(DWORD dwXFrom, DWORD dwYFrom, DWORD dwXDest, DWORD dwYDest, BOOL bAlternative=FALSE); + virtual BOOL PlaceCliff(DWORD dwXFrom, DWORD dwYFrom, DWORD dwXDest, DWORD dwYDest, BOOL bAlternative = FALSE); CCliffModifier(); virtual ~CCliffModifier(); protected: - virtual CString GetDataSection()=0; + virtual CString GetDataSection() = 0; virtual void ModifyCurrentPos(DWORD* dwPos, BOOL bBeforePlacing, BOOL bSmall); virtual void ModifyStartPos(DWORD* dwStartPos, BOOL bSmall); - - enum e_cliffdirections {cd_horiz_left, cd_horiz_right, cd_horizdiag_left, - cd_horizdiag_right, cd_vertic_top, cd_vertic_bottom, cd_verticdiag_top, cd_verticdiag_bottom }; + + enum e_cliffdirections { + cd_horiz_left, cd_horiz_right, cd_horizdiag_left, + cd_horizdiag_right, cd_vertic_top, cd_vertic_bottom, cd_verticdiag_top, cd_verticdiag_bottom + }; DWORD m_dwTo; DWORD m_dwFrom; @@ -56,7 +58,7 @@ protected: int m_addx; int m_addy; BOOL m_bAlternative; - virtual DWORD GetTileToPlace(DWORD dwPos, BOOL* bSmall) ; + virtual DWORD GetTileToPlace(DWORD dwPos, BOOL* bSmall); }; #endif // !defined(AFX_CLIFFMODIFIER_H__3853D323_CD37_11D4_9C87_F2DC6A2E6849__INCLUDED_) diff --git a/MissionEditor/ComboUInputDlg.cpp b/MissionEditor/ComboUInputDlg.cpp index d0bfff4..2fe8eac 100644 --- a/MissionEditor/ComboUInputDlg.cpp +++ b/MissionEditor/ComboUInputDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -42,8 +42,8 @@ CComboUInputDlg::CComboUInputDlg(CWnd* pParent /*=NULL*/) m_Combo = _T(""); //}}AFX_DATA_INIT - m_type=0; - bTruncateStrings=FALSE; + m_type = 0; + bTruncateStrings = FALSE; } @@ -65,71 +65,67 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CComboUInputDlg -BOOL CComboUInputDlg::OnInitDialog() +BOOL CComboUInputDlg::OnInitDialog() { CDialog::OnInitDialog(); - - CComboBox* box=(CComboBox*)GetDlgItem(IDC_COMBO1); - switch(m_type) + CComboBox* box = (CComboBox*)GetDlgItem(IDC_COMBO1); + + switch (m_type) { + case COMBOUINPUT_HOUSES: { - case COMBOUINPUT_HOUSES: - { - ListHouses(*box, FALSE, FALSE); - break; - } - case COMBOUINPUT_COUNTRIES: - ListHouses(*box, FALSE, TRUE); - break; - case COMBOUINPUT_TRIGGERS: - ListTriggers(*box); - break; - case COMBOUINPUT_TAGS: - ListTags(*box, FALSE); - break; - case COMBOUINPUT_HOUSES_N: - { - ListHouses(*box, TRUE, FALSE); - break; - } - case COMBOUINPUT_COUNTRIES_N: - ListHouses(*box, TRUE, TRUE); - break; - case COMBOUINPUT_MANUAL: - int i; - for(i=0;iAddString(m_ManualStrings[i]); + ListHouses(*box, FALSE, FALSE); + break; + } + case COMBOUINPUT_COUNTRIES: + ListHouses(*box, FALSE, TRUE); + break; + case COMBOUINPUT_TRIGGERS: + ListTriggers(*box); + break; + case COMBOUINPUT_TAGS: + ListTags(*box, FALSE); + break; + case COMBOUINPUT_HOUSES_N: + { + ListHouses(*box, TRUE, FALSE); + break; + } + case COMBOUINPUT_COUNTRIES_N: + ListHouses(*box, TRUE, TRUE); + break; + case COMBOUINPUT_MANUAL: + int i; + for (i = 0; i < m_ManualStrings.size(); i++) + box->AddString(m_ManualStrings[i]); } box->SetCurSel(0); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CComboUInputDlg::OnOK() +void CComboUInputDlg::OnOK() { UpdateData(TRUE); - - if(m_type==COMBOUINPUT_TRIGGERS || m_type==COMBOUINPUT_TAGS || m_type==COMBOUINPUT_HOUSES_N || m_type==COMBOUINPUT_COUNTRIES_N) TruncSpace(m_Combo); - else if(m_type==COMBOUINPUT_MANUAL) - { - if(bTruncateStrings) TruncSpace(m_Combo); - } - else - { - m_Combo=TranslateHouse(m_Combo, FALSE); + + if (m_type == COMBOUINPUT_TRIGGERS || m_type == COMBOUINPUT_TAGS || m_type == COMBOUINPUT_HOUSES_N || m_type == COMBOUINPUT_COUNTRIES_N) TruncSpace(m_Combo); + else if (m_type == COMBOUINPUT_MANUAL) { + if (bTruncateStrings) TruncSpace(m_Combo); + } else { + m_Combo = TranslateHouse(m_Combo, FALSE); } - EndDialog(0); + EndDialog(0); //CDialog::OnOK(); } -void CComboUInputDlg::OnCancel() +void CComboUInputDlg::OnCancel() { // TODO: Zusätzlichen Bereinigungscode hier einfügen - + //CDialog::OnCancel(); } diff --git a/MissionEditor/ComboUInputDlg.h b/MissionEditor/ComboUInputDlg.h index f6e472e..be00df2 100644 --- a/MissionEditor/ComboUInputDlg.h +++ b/MissionEditor/ComboUInputDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_COMBOUINPUTDLG_H__2EEED280_9A8C_11D5_89B3_00E07D97C331__INCLUDED_) @@ -44,7 +44,7 @@ using namespace std; class CComboUInputDlg : public CDialog { -// Konstruktion + // Konstruktion public: int m_type; vector m_ManualStrings; @@ -62,7 +62,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CComboUInputDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Defines.h b/MissionEditor/Defines.h index 52c6937..6fcf536 100644 --- a/MissionEditor/Defines.h +++ b/MissionEditor/Defines.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /************************** diff --git a/MissionEditor/DownloadSession.cpp b/MissionEditor/DownloadSession.cpp index a487644..b8e28bb 100644 --- a/MissionEditor/DownloadSession.cpp +++ b/MissionEditor/DownloadSession.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -24,7 +24,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif @@ -32,7 +32,7 @@ static char THIS_FILE[]=__FILE__; // Konstruktion/Destruktion ////////////////////////////////////////////////////////////////////// -CDownloadSession::CDownloadSession():CInternetSession("FinalAlert Download", 1, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC | INTERNET_FLAG_DONT_CACHE) +CDownloadSession::CDownloadSession() :CInternetSession("FinalAlert Download", 1, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC | INTERNET_FLAG_DONT_CACHE) { } @@ -43,7 +43,7 @@ CDownloadSession::~CDownloadSession() } -void CDownloadSession::OnStatusCallback(DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength ) +void CDownloadSession::OnStatusCallback(DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength) { } \ No newline at end of file diff --git a/MissionEditor/DownloadSession.h b/MissionEditor/DownloadSession.h index 3f6ed90..6430c8e 100644 --- a/MissionEditor/DownloadSession.h +++ b/MissionEditor/DownloadSession.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include @@ -27,13 +27,13 @@ #pragma once #endif // _MSC_VER > 1000 -class CDownloadSession : public CInternetSession +class CDownloadSession : public CInternetSession { public: CDownloadSession(); virtual ~CDownloadSession(); protected: - virtual void OnStatusCallback( DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength ); + virtual void OnStatusCallback(DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength); }; diff --git a/MissionEditor/DynamicGraphDlg.cpp b/MissionEditor/DynamicGraphDlg.cpp index 6cad11d..530fd6c 100644 --- a/MissionEditor/DynamicGraphDlg.cpp +++ b/MissionEditor/DynamicGraphDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -61,7 +61,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CDynamicGraphDlg -void CDynamicGraphDlg::PostNcDestroy() +void CDynamicGraphDlg::PostNcDestroy() { // delete this; } diff --git a/MissionEditor/DynamicGraphDlg.h b/MissionEditor/DynamicGraphDlg.h index 8cf4286..516d39a 100644 --- a/MissionEditor/DynamicGraphDlg.h +++ b/MissionEditor/DynamicGraphDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_DYNAMICGRAPHDLG_H__ED5FED21_83F5_11D4_9C87_86ADAD0FBC4A__INCLUDED_) @@ -34,7 +34,7 @@ class CDynamicGraphDlg : public CDialog { -// Konstruktion + // Konstruktion public: CDynamicGraphDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -48,7 +48,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CDynamicGraphDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/FinalSun.cpp b/MissionEditor/FinalSun.cpp index 3b2dbe6..48520c5 100644 --- a/MissionEditor/FinalSun.cpp +++ b/MissionEditor/FinalSun.cpp @@ -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; diff --git a/MissionEditor/FinalSun.h b/MissionEditor/FinalSun.h index e3dc5c4..7155241 100644 --- a/MissionEditor/FinalSun.h +++ b/MissionEditor/FinalSun.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // @@ -30,14 +30,14 @@ #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH +#error include 'stdafx.h' before including this file for PCH #endif #include "resource.h" // main symbols #include "ddeml.h" #include "loading.h" -struct OPTIONS{ +struct OPTIONS { CString TSExe; CString LanguageName; CString prev_maps[4]; @@ -93,11 +93,11 @@ public: return m_u8LogFileName; } - -// Überladungen - // Vom Klassenassistenten generierte Überladungen virtueller Funktionen - //{{AFX_VIRTUAL(CFinalSunApp) - public: + + // Überladungen + // Vom Klassenassistenten generierte Überladungen virtueller Funktionen + //{{AFX_VIRTUAL(CFinalSunApp) +public: virtual BOOL InitInstance(); virtual int Run(); virtual BOOL ProcessMessageFilter(int code, LPMSG lpMsg); @@ -112,7 +112,7 @@ public: //{{AFX_MSG(CFinalSunApp) //}}AFX_MSG DECLARE_MESSAGE_MAP() - public: +public: UINT m_cf; HACCEL m_hAccel; void ParseCommandLine(); diff --git a/MissionEditor/FinalSunDlg.cpp b/MissionEditor/FinalSunDlg.cpp index 076c2ca..4952b47 100644 --- a/MissionEditor/FinalSunDlg.cpp +++ b/MissionEditor/FinalSunDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // @@ -225,10 +225,10 @@ BEGIN_MESSAGE_MAP(CFinalSunDlg, CDialog) ON_COMMAND(ID_MAPTOOLS_SEARCHWAYPOINT, OnMaptoolsSearchwaypoint) ON_COMMAND(ID_MAPTOOLS_TOOLSCRIPTS, OnMaptoolsToolscripts) //}}AFX_MSG_MAP - ON_COMMAND(ID_OPTIONS_SMOOTHZOOM, &CFinalSunDlg::OnOptionsSmoothzoom) - ON_WM_SETCURSOR() - ON_COMMAND(ID_OPTIONS_USEDEFAULTMOUSECURSOR, &CFinalSunDlg::OnOptionsUsedefaultmousecursor) - END_MESSAGE_MAP() + ON_COMMAND(ID_OPTIONS_SMOOTHZOOM, &CFinalSunDlg::OnOptionsSmoothzoom) + ON_WM_SETCURSOR() + ON_COMMAND(ID_OPTIONS_USEDEFAULTMOUSECURSOR, &CFinalSunDlg::OnOptionsUsedefaultmousecursor) +END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFinalSunDlg message handler @@ -242,40 +242,40 @@ BOOL CFinalSunDlg::OnInitDialog() errstream << "CFinalSunDlg::OnInitDialog() called" << endl; errstream.flush(); - + ShowWindow(SW_HIDE); SetWindowPos(NULL, 0, 0, GetSystemMetrics(SM_CXFULLSCREEN), GetSystemMetrics(SM_CYFULLSCREEN), 0); SetIcon(m_hIcon, TRUE); // use big symbol SetIcon(m_hIcon, FALSE); // use small symbol - + CString cap; #ifndef RA2_MODE - cap= GetLanguageStringACP("MainDialogCaption"); + cap = GetLanguageStringACP("MainDialogCaption"); #else - cap=GetLanguageStringACP("MainDialogCaptionRA2"); + cap = GetLanguageStringACP("MainDialogCaptionRA2"); #endif - cap+=" ("; - cap+=GetLanguageStringACP("NoMapLoaded"); - cap+=")"; + cap += " ("; + cap += GetLanguageStringACP("NoMapLoaded"); + cap += ")"; SetWindowText(cap); // Matze: // July 9th: // Added toolbars - - BOOL success=true; + + auto success = true; RECT r; SIZE size_mainbar; SIZE size_terrainbar; GetClientRect(&r); - r.top+=32; + r.top += 32; success = success && m_view.Create(NULL, GetLanguageStringACP("IsoCaption"), WS_CHILD, r, this); - r.top=0; - r.bottom=32; + r.top = 0; + r.bottom = 32; success = success && m_bar.Create(RBS_AUTOSIZE, r, this, 5000); success = success && m_maintoolbar.Create(this); success = success && m_maintoolbar.LoadToolBar(IDR_MAINFRAME); @@ -283,44 +283,44 @@ BOOL CFinalSunDlg::OnInitDialog() success = success && m_maintoolbar.GetToolBarCtrl().GetMaxSize(&size_mainbar); success = success && m_terraintoolbar.Create(this); success = success && m_terraintoolbar.LoadToolBar(IDR_TERRAINBAR); - m_terraintoolbar.GetToolBarCtrl().SetStyle(m_terraintoolbar.GetToolBarCtrl().GetStyle() | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS ); + m_terraintoolbar.GetToolBarCtrl().SetStyle(m_terraintoolbar.GetToolBarCtrl().GetStyle() | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS); success = success && m_terraintoolbar.GetToolBarCtrl().GetMaxSize(&size_terrainbar); m_terraintoolbar.SetBarStyle(m_terraintoolbar.GetBarStyle()); success = success && m_clifftoolbar.Create(this); success = success && m_clifftoolbar.LoadToolBar(IDR_CLIFFBAR); - m_clifftoolbar.GetToolBarCtrl().SetStyle(m_clifftoolbar.GetToolBarCtrl().GetStyle() | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS ); + m_clifftoolbar.GetToolBarCtrl().SetStyle(m_clifftoolbar.GetToolBarCtrl().GetStyle() | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS); m_clifftoolbar.SetBarStyle(m_terraintoolbar.GetBarStyle()); success = success && m_settingsbar.Create(this, IDD_TOOLSETTINGS, CBRS_TOP, 6000); - + REBARBANDINFO rbi = { 0 }; - rbi.cbSize= sizeof(REBARBANDINFO); - rbi.fMask= RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_TEXT /*| RBBIM_SIZE*/ | RBBIM_IDEALSIZE; - rbi.fStyle= RBBS_GRIPPERALWAYS; - rbi.cxMinChild= size_mainbar.cx+30; - rbi.cyMinChild= 30; - rbi.cch= 0; - rbi.cx= size_mainbar.cx+30; - rbi.cxIdeal=size_mainbar.cx+30; - rbi.hbmBack= NULL; - rbi.hwndChild= (HWND)m_maintoolbar; + rbi.cbSize = sizeof(REBARBANDINFO); + rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_TEXT /*| RBBIM_SIZE*/ | RBBIM_IDEALSIZE; + rbi.fStyle = RBBS_GRIPPERALWAYS; + rbi.cxMinChild = size_mainbar.cx + 30; + rbi.cyMinChild = 30; + rbi.cch = 0; + rbi.cx = size_mainbar.cx + 30; + rbi.cxIdeal = size_mainbar.cx + 30; + rbi.hbmBack = NULL; + rbi.hwndChild = (HWND)m_maintoolbar; success = success && m_bar.InsertBand(0, &rbi); - rbi.hwndChild= (HWND)m_terraintoolbar; - rbi.cx=size_terrainbar.cx+30; - rbi.cxIdeal=size_terrainbar.cx+30; - rbi.cxMinChild= size_terrainbar.cx+30; + rbi.hwndChild = (HWND)m_terraintoolbar; + rbi.cx = size_terrainbar.cx + 30; + rbi.cxIdeal = size_terrainbar.cx + 30; + rbi.cxMinChild = size_terrainbar.cx + 30; success = success && m_bar.InsertBand(1, &rbi); rbi.hwndChild = (HWND)m_clifftoolbar; rbi.cx = 560; rbi.cxMinChild = 170; rbi.cxIdeal = 560; success = success && m_bar.InsertBand(2, &rbi); - rbi.hwndChild= (HWND)m_settingsbar; - rbi.cxMinChild= 170; - rbi.cx=170; - rbi.cxIdeal=170; + rbi.hwndChild = (HWND)m_settingsbar; + rbi.cxMinChild = 170; + rbi.cx = 170; + rbi.cxIdeal = 170; success = success && m_bar.InsertBand(3, &rbi); - + m_bar.ShowWindow(SW_SHOW); m_maintoolbar.ShowWindow(SW_SHOW); @@ -332,8 +332,7 @@ BOOL CFinalSunDlg::OnInitDialog() - if(!success) - { + if (!success) { // sometimes, insufficient resources are available. // this is a very rare case - but it happened on Win9x // especially when running the developer studio and IE5, this happens often @@ -342,12 +341,12 @@ BOOL CFinalSunDlg::OnInitDialog() exit(-5); } - + errstream << "Updating menu" << endl; errstream.flush(); - - if(theApp.m_Options.bEasy && GetMenu()) GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); - + + if (theApp.m_Options.bEasy && GetMenu()) GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); + UpdateStrings(); @@ -357,8 +356,7 @@ BOOL CFinalSunDlg::OnInitDialog() // June 21, CLoading now non-modal. // CLoading will free itself // September 6th, CLoading will not free itself as it is a member of CFinalSunApp - if(theApp.m_loading->m_hWnd ==NULL) - { + if (theApp.m_loading->m_hWnd == NULL) { MessageBox("Loading dialog could not be created. Please close any programs and start again."); exit(-99); } @@ -366,38 +364,36 @@ BOOL CFinalSunDlg::OnInitDialog() theApp.m_loading->UpdateWindow(); theApp.m_loading->Load(); - if(!theApp.m_Options.bSupportMarbleMadness) - { + if (!theApp.m_Options.bSupportMarbleMadness) { TBBUTTON b; m_terraintoolbar.GetToolBarCtrl().GetButton(9, &b); - + m_terraintoolbar.GetToolBarCtrl().HideButton(b.idCommand); m_terraintoolbar.GetToolBarCtrl().HideButton(ID_MARBLEMADNESS); } - + ShowWindow(SW_SHOWMAXIMIZED); CDialog::BringWindowToTop(); - - if(strlen(currentMapFile)==0) // no map file specified + + if (strlen(currentMapFile) == 0) // no map file specified { // ok, let the user choose a map! // hmm... no, don´t let him. we already have our tips dialog. // OnFileOpenmap(); theApp.ShowTipAtStartup(); - } - else // yah, map file specified + } else // yah, map file specified { CString str = GetLanguageStringACP("MainDialogCaption"); - str+=" ("; - str+=currentMapFile; - str+=")"; - + str += " ("; + str += currentMapFile; + str += ")"; + this->SetWindowText(str); SetCursor(LoadCursor(NULL, IDC_WAIT)); - + Map->LoadMap(currentMapFile); - + SetCursor(m_hArrowCursor); } @@ -405,30 +401,28 @@ BOOL CFinalSunDlg::OnInitDialog() UpdateDialogs(); #ifndef RA2_MODE - CTime t=t.GetCurrentTime(); - - if(t.GetDay()>=24 && t.GetDay()<=26 && t.GetMonth()==12) - { + CTime t = t.GetCurrentTime(); + + if (t.GetDay() >= 24 && t.GetDay() <= 26 && t.GetMonth() == 12) { CString str; GetWindowText(str); - SetWindowText(str+" Merry Christmas! Fröhliche Weihnachten!"); + SetWindowText(str + " Merry Christmas! Fröhliche Weihnachten!"); } #endif - - return TRUE; + + return TRUE; } -void CFinalSunDlg::OnPaint() +void CFinalSunDlg::OnPaint() { - - if (IsIconic()) - { + + if (IsIconic()) { CPaintDC dc(this); // DC for painting - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0); // center symbol int cxIcon = GetSystemMetrics(SM_CXICON); @@ -440,30 +434,27 @@ void CFinalSunDlg::OnPaint() // draw symbol dc.DrawIcon(x, y, m_hIcon); - } - else - { + } else { CDialog::OnPaint(); } - + } HCURSOR CFinalSunDlg::OnQueryDragIcon() { - return (HCURSOR) m_hIcon; + return (HCURSOR)m_hIcon; } -void CFinalSunDlg::OnFileQuit() +void CFinalSunDlg::OnFileQuit() { UnloadAll(); } -void CFinalSunDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if(nID==SC_CLOSE) - { +void CFinalSunDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if (nID == SC_CLOSE) { UnloadAll(); return; } @@ -472,83 +463,81 @@ void CFinalSunDlg::OnSysCommand(UINT nID, LPARAM lParam) -void CFinalSunDlg::OnOK() +void CFinalSunDlg::OnOK() { //just do nothing... // this is a stub } -void CFinalSunDlg::OnCancel() +void CFinalSunDlg::OnCancel() { //do nothing... // stub } -void CFinalSunDlg::OnOptionsTiberiansunoptions() +void CFinalSunDlg::OnOptionsTiberiansunoptions() { - + ShowOptionsDialog(); - + } -void CFinalSunDlg::OnFileOpenmap() +void CFinalSunDlg::OnFileOpenmap() { - + //CMapOpenDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "TS maps|*.mpr;*.map|TS multi maps|*.mpr|TS single maps|*.map|"); - CString r=GetLanguageStringACP("SAVEDLG_FILETYPES"); - if(yuri_mode) - { - r=GetLanguageStringACP("SAVEDLG_FILETYPES_YR"); + CString r = GetLanguageStringACP("SAVEDLG_FILETYPES"); + if (yuri_mode) { + r = GetLanguageStringACP("SAVEDLG_FILETYPES_YR"); } - r=TranslateStringVariables(8, r, ";"); + r = TranslateStringVariables(8, r, ";"); - if(!yuri_mode) r.Replace(".yrm",".mpr"); + if (!yuri_mode) r.Replace(".yrm", ".mpr"); - CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, r); + CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, r); char cuPath[MAX_PATH]; GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; - if(dlg.DoModal()==IDCANCEL) return; + if (dlg.DoModal() == IDCANCEL) return; m_PKTHeader.Clear(); - CString fileToOpen=dlg.GetPathName(); - fileToOpen.MakeLower(); - CString ext=dlg.GetFileExt(); + CString fileToOpen = dlg.GetPathName(); + fileToOpen.MakeLower(); + CString ext = dlg.GetFileExt(); ext.MakeLower(); - BOOL bLoadedFromMMX=FALSE; - if(ext=="mmx") - { - HMIXFILE hMix=FSunPackLib::XCC_OpenMix(fileToOpen, NULL); + BOOL bLoadedFromMMX = FALSE; + if (ext == "mmx") { + HMIXFILE hMix = FSunPackLib::XCC_OpenMix(fileToOpen, NULL); fileToOpen.Replace(".mmx", ".map"); - if(fileToOpen.ReverseFind('\\')>=0) fileToOpen=fileToOpen.Right(fileToOpen.GetLength()-fileToOpen.ReverseFind('\\')-1); + if (fileToOpen.ReverseFind('\\') >= 0) fileToOpen = fileToOpen.Right(fileToOpen.GetLength() - fileToOpen.ReverseFind('\\') - 1); - CString extractFile=u8AppDataPath.c_str(); - CString pktFile=fileToOpen; + CString extractFile = u8AppDataPath.c_str(); + CString pktFile = fileToOpen; pktFile.Replace(".map", ".pkt"); - extractFile+="\\mmx_tmp.pkt"; - + extractFile += "\\mmx_tmp.pkt"; + FSunPackLib::XCC_ExtractFile(pktFile, extractFile, hMix); m_PKTHeader.LoadFile(extractFile, TRUE); fileToOpen = m_PKTHeader.GetString("MultiMaps", "1") + ".map"; - - extractFile=u8AppDataPath.c_str(); - extractFile+="\\mmx_tmp.map"; + + extractFile = u8AppDataPath.c_str(); + extractFile += "\\mmx_tmp.map"; FSunPackLib::XCC_ExtractFile(fileToOpen, extractFile, hMix); - fileToOpen=extractFile; - - - + fileToOpen = extractFile; + + + FSunPackLib::XCC_CloseMix(hMix); - bLoadedFromMMX=TRUE; + bLoadedFromMMX = TRUE; } CIniFile f; @@ -559,13 +548,13 @@ void CFinalSunDlg::OnFileOpenmap() return; } - bNoDraw=TRUE; + bNoDraw = TRUE; CString str; str = GetLanguageStringACP("MainDialogCaption"); - str+=" ("; - str+=(char*)(LPCTSTR)dlg.GetPathName(); - str+=")"; + str += " ("; + str += (char*)(LPCTSTR)dlg.GetPathName(); + str += ")"; // MW 07/20/01: Update prev. files InsertPrevFile(dlg.GetPathName()); @@ -577,40 +566,31 @@ void CFinalSunDlg::OnFileOpenmap() errstream << "Map->LoadMap() will be called" << endl; errstream.flush(); - + Map->LoadMap((char*)(LPCTSTR)fileToOpen); - - BOOL bNoMapFile=FALSE; - if(!Map->CheckMapPackData()) - { - int res=MessageBox("This map seems to be corrupt. Do you want to try repairing it? If you click cancel, a empty map will be created, if you click no, it will load the map as it is","Corrupt", MB_YESNOCANCEL); - if(res==IDCANCEL) - { - Map->CreateMap(32,32,THEATER0,0); - bNoMapFile=TRUE; - } - else - { - if(res==IDYES) // try repair + + BOOL bNoMapFile = FALSE; + if (!Map->CheckMapPackData()) { + int res = MessageBox("This map seems to be corrupt. Do you want to try repairing it? If you click cancel, a empty map will be created, if you click no, it will load the map as it is", "Corrupt", MB_YESNOCANCEL); + if (res == IDCANCEL) { + Map->CreateMap(32, 32, THEATER0, 0); + bNoMapFile = TRUE; + } else { + if (res == IDYES) // try repair { - int fielddata_size=Map->GetIsoSize()*Map->GetIsoSize(); + int fielddata_size = Map->GetIsoSize() * Map->GetIsoSize(); int i; - for(i=0;iGetFielddataAt(i)->wGround; - if(gr==0xFFFF) gr=0; - - if(gr>=(*tiledata_count)) - { - Map->SetTileAt(i, 0, 0); - } - else - { - if((*tiledata)[gr].wTileCount<=Map->GetFielddataAt(i)->bSubTile) - { + for (i = 0; i < fielddata_size; i++) { + int gr = Map->GetFielddataAt(i)->wGround; + if (gr == 0xFFFF) gr = 0; + + if (gr >= (*tiledata_count)) { + Map->SetTileAt(i, 0, 0); + } else { + if ((*tiledata)[gr].wTileCount <= Map->GetFielddataAt(i)->bSubTile) { Map->SetTileAt(i, 0, 0); } } @@ -619,16 +599,13 @@ void CFinalSunDlg::OnFileOpenmap() } } } - - if(!bNoMapFile) - { - if(bLoadedFromMMX) - { + + if (!bNoMapFile) { + if (bLoadedFromMMX) { //currentMapFile[0]=0; strcpy(currentMapFile, dlg.GetPathName()); - } - else - strcpy(currentMapFile, fileToOpen); + } else + strcpy(currentMapFile, fileToOpen); } Sleep(200); @@ -636,7 +613,7 @@ void CFinalSunDlg::OnFileOpenmap() SetCursor(m_hArrowCursor); - bNoDraw=FALSE; + bNoDraw = FALSE; m_view.m_isoview->UpdateDialog(TRUE); UpdateDialogs(); @@ -694,7 +671,7 @@ void CFinalSunDlg::UpdateDialogs(BOOL bOnlyMissionControl, BOOL bNoRepos) m_singleplayersettings.UpdateDialog(); } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); currentOwner = "Neutral"; auto const& houseSec = ini[MAPHOUSES]; @@ -704,8 +681,7 @@ void CFinalSunDlg::UpdateDialogs(BOOL bOnlyMissionControl, BOOL bNoRepos) } } - if(!bOnlyMissionControl) - { + if (!bOnlyMissionControl) { UpdateWindow(); UpdateStrings(); @@ -723,91 +699,87 @@ void CFinalSunDlg::UpdateDialogs(BOOL bOnlyMissionControl, BOOL bNoRepos) AD.reset(); } -void CFinalSunDlg::OnFileSaveas() +void CFinalSunDlg::OnFileSaveas() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } CMapValidator validator; - int iCancel=validator.DoModal(); - if(iCancel==IDCANCEL) return; - CString r=GetLanguageStringACP("SAVEDLG_FILETYPES"); - if(yuri_mode) - { - r=GetLanguageStringACP("SAVEDLG_FILETYPES_YR"); + int iCancel = validator.DoModal(); + if (iCancel == IDCANCEL) return; + CString r = GetLanguageStringACP("SAVEDLG_FILETYPES"); + if (yuri_mode) { + r = GetLanguageStringACP("SAVEDLG_FILETYPES_YR"); } - r=TranslateStringVariables(8, r, ";"); + r = TranslateStringVariables(8, r, ";"); auto const ext = ".map"; auto const fname = "noname.map"; CFileDialog dlg(FALSE, ext, /*fname*/ NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, r); char cuPath[MAX_PATH]; - + GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; - - if(dlg.DoModal()!=IDCANCEL) - { + + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; + + if (dlg.DoModal() != IDCANCEL) { strcpy(currentMapFile, dlg.GetPathName()); - CString str=GetLanguageStringACP("MainDialogCaption"); - str+=" ("; - str+=(char*)(LPCTSTR)dlg.GetPathName(); - str+=")"; + CString str = GetLanguageStringACP("MainDialogCaption"); + str += " ("; + str += (char*)(LPCTSTR)dlg.GetPathName(); + str += ")"; this->SetWindowText(str); - + SaveMap(dlg.GetPathName()); } - + SetCursor(m_hArrowCursor); } -void CFinalSunDlg::OnOptionsExportrulesini() +void CFinalSunDlg::OnOptionsExportrulesini() { - int res=MessageBox("This will export the Rules.Ini of Tiberian Sun V1.13 MMX. ou should not modify this rules.ini because you won´t be able to play online then and ecause this could cause compatibility problems.\nIf you want to modify the rules.ini, you need to rename it before you play online.", "Export Rules.INI", MB_OK); + int res = MessageBox("This will export the Rules.Ini of Tiberian Sun V1.13 MMX. ou should not modify this rules.ini because you won´t be able to play online then and ecause this could cause compatibility problems.\nIf you want to modify the rules.ini, you need to rename it before you play online.", "Export Rules.INI", MB_OK); CFileDialog dlg(FALSE, ".ini", "rules.ini", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Rules.INI|rules.ini|"); char cuPath[MAX_PATH]; - BOOL hidePreview=FALSE; - BOOL previewPrinted=FALSE; + BOOL hidePreview = FALSE; + BOOL previewPrinted = FALSE; GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; - if(dlg.DoModal()!=IDCANCEL) - { + if (dlg.DoModal() != IDCANCEL) { SetCursor(LoadCursor(NULL, IDC_WAIT)); HRSRC r; - r=FindResource(NULL, MAKEINTRESOURCE(IDR_RULES) ,"TEXTFILE"); + r = FindResource(NULL, MAKEINTRESOURCE(IDR_RULES), "TEXTFILE"); - if(r==0) {MessageBox("FindResource() failed to find IDR_RULES", "DEBUG");return;} + if (r == 0) { MessageBox("FindResource() failed to find IDR_RULES", "DEBUG"); return; } - HGLOBAL hres=LoadResource(NULL, r); - - if(hres==0) {MessageBox("LoadResource() failed to load IDR_RULES", "DEBUG");return;} + HGLOBAL hres = LoadResource(NULL, r); - char* data=(char*)LockResource(hres); + if (hres == 0) { MessageBox("LoadResource() failed to load IDR_RULES", "DEBUG"); return; } - int hfile=_open((char*)(LPCTSTR)dlg.GetPathName(),_O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE); - - if(hfile==-1) { MessageBox("File could not be opened","DEBUG"); return; } - - _write(hfile, (void*) data, strlen(data)); + char* data = (char*)LockResource(hres); + + int hfile = _open((char*)(LPCTSTR)dlg.GetPathName(), _O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE); + + if (hfile == -1) { MessageBox("File could not be opened", "DEBUG"); return; } + + _write(hfile, (void*)data, strlen(data)); _close(hfile); @@ -816,7 +788,7 @@ void CFinalSunDlg::OnOptionsExportrulesini() } } -void CFinalSunDlg::OnHelpInfo() +void CFinalSunDlg::OnHelpInfo() { // handle the help dialog CInfo info; @@ -824,36 +796,35 @@ void CFinalSunDlg::OnHelpInfo() } -void CFinalSunDlg::OnShowWindow(BOOL bShow, UINT nStatus) +void CFinalSunDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); m_view.ShowWindow(SW_SHOW); - if(!bShow) return; - - - + if (!bShow) return; + + + } -void CFinalSunDlg::OnFileSave() +void CFinalSunDlg::OnFileSave() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(strlen(currentMapFile)==0) { OnFileSaveas(); return; } - - CMapValidator validator; - int iCancel=validator.DoModal(); - if(iCancel==IDCANCEL) return; + if (strlen(currentMapFile) == 0) { OnFileSaveas(); return; } - SaveMap(currentMapFile); + CMapValidator validator; + int iCancel = validator.DoModal(); + if (iCancel == IDCANCEL) return; + + SaveMap(currentMapFile); } @@ -866,17 +837,17 @@ void CFinalSunDlg::SaveMap(CString FileName_) errstream << "SaveMap() called" << endl; errstream.flush(); - BOOL bSaveAsMMX=FALSE; - BOOL hidePreview=FALSE; - BOOL previewPrinted=FALSE; + BOOL bSaveAsMMX = FALSE; + BOOL hidePreview = FALSE; + BOOL previewPrinted = FALSE; + - FileName_.MakeLower(); - FileName_=(LPCSTR)FileName_; // GetLength() needs to return proper size + FileName_ = (LPCSTR)FileName_; // GetLength() needs to return proper size - CString CoreName=FileName_; + CString CoreName = FileName_; CString Description; int minplayers; int maxplayers; @@ -891,49 +862,46 @@ void CFinalSunDlg::SaveMap(CString FileName_) // MW Apr 17th, 2002: Added Teamgame! BOOL teamgame; - if(CoreName.ReverseFind('\\')>=0) CoreName=CoreName.Right(CoreName.GetLength()-CoreName.ReverseFind('\\')-1); - if(CoreName.Find(".")>=0) CoreName=CoreName.Left(CoreName.Find(".")); + if (CoreName.ReverseFind('\\') >= 0) CoreName = CoreName.Right(CoreName.GetLength() - CoreName.ReverseFind('\\') - 1); + if (CoreName.Find(".") >= 0) CoreName = CoreName.Left(CoreName.Find(".")); + + - - #ifdef RA2_MODE - if(Map->IsMultiplayer()) - { - if(FileName_.Find(".mmx")>=0) bSaveAsMMX=TRUE; else bSaveAsMMX=FALSE; - if(FileName_.Find(".map")>=0) FileName_.Replace(".map",".mpr"); - - // MW 07/27/01: Check for YRM - if(FileName_.Find(".mpr")>=0 && Map->IsYRMap()) FileName_.Replace(".mpr",".yrm"); + if (Map->IsMultiplayer()) { + if (FileName_.Find(".mmx") >= 0) bSaveAsMMX = TRUE; else bSaveAsMMX = FALSE; + if (FileName_.Find(".map") >= 0) FileName_.Replace(".map", ".mpr"); + + // MW 07/27/01: Check for YRM + if (FileName_.Find(".mpr") >= 0 && Map->IsYRMap()) FileName_.Replace(".mpr", ".yrm"); + - // MW 07/28/01: Create [Header] int i; - int wp_count=0; - int xw[8]={0,0,0,0,0,0,0,0}; - int yw[8]={0,0,0,0,0,0,0,0}; - for(i=0;iGetWaypointCount();i++) - { + int wp_count = 0; + int xw[8] = { 0,0,0,0,0,0,0,0 }; + int yw[8] = { 0,0,0,0,0,0,0,0 }; + for (i = 0; i < Map->GetWaypointCount(); i++) { CString id; DWORD pos; Map->GetWaypointData(i, &id, &pos); int idi; - idi=atoi(id); - if(idi!=i) break; - if(idi>=0 && idi<8) - { - int x,y; - x=pos/Map->GetIsoSize(); - y=pos%Map->GetIsoSize(); + idi = atoi(id); + if (idi != i) break; + if (idi >= 0 && idi < 8) { + int x, y; + x = pos / Map->GetIsoSize(); + y = pos % Map->GetIsoSize(); //PosToXY(pos, x,y); - xw[wp_count]=calcXPos(x,y); - yw[wp_count]=calcYPos(x,y); - wp_count++; + xw[wp_count] = calcXPos(x, y); + yw[wp_count] = calcYPos(x, y); + wp_count++; } - + } char c[50]; - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); auto const sec = ini.TryGetSection("Header"); sec->SetInteger("NumberStartingPoints", wp_count); for (i = 0; i < 8; i++) { @@ -958,28 +926,28 @@ void CFinalSunDlg::SaveMap(CString FileName_) auto const& localSizeStr = ini.GetString("Map", "LocalSize"); CString left = GetParam(localSizeStr, 0); CString top = GetParam(localSizeStr, 1); - + //startx=1;//Map->GetHeight()/2;//atoi(left);//Map->GetIsoSize()/2-Map->GetWidth()/2;//198/2-50;//Map->GetIsoSize()/2-Map->GetHeight()/2;//Map->GetWidth()/2-50; //starty=Map->GetWidth();//Map->GetIsoSize()/2-Map->GetWidth()/2;//198/2-50;//Map->GetIsoSize()/2-Map->GetWidth()/2;//Map->GetHeight()/2-50; itoa(startx, c, 10); sec->SetInteger("StartX", startx); sec->SetInteger("StartY", starty); - + /*CMultiSaveOptionsDlg mso; - + if(FileName.Find(".mmx")>=0) mso.m_mmx=0; else mso.m_mmx=1; if(mso.DoModal()==IDCANCEL) return; - + if(mso.m_mmx==0) { FileName.Replace(".mpr", ".map"); //FileName.Replace(" ", ""); - if(CoreName.GetLength()>8) + if(CoreName.GetLength()>8) { CoreName=CoreName.Left(8); FileName=CoreName+".map"; - + CString s="The maximum filename length for MMX files is 8 chars, do you want to save the map as "; s+=CoreName; s+=".mmx?"; @@ -988,7 +956,7 @@ void CFinalSunDlg::SaveMap(CString FileName_) } bSaveAsMMX=TRUE; - + } else { @@ -998,14 +966,14 @@ void CFinalSunDlg::SaveMap(CString FileName_) } #endif - CString MMXFileName=CoreName; - MMXFileName+=".mmx"; + CString MMXFileName = CoreName; + MMXFileName += ".mmx"; - CString PKTFileName=CoreName; - PKTFileName+=".pkt"; + CString PKTFileName = CoreName; + PKTFileName += ".pkt"; - CString MAPFileName=CoreName; - MAPFileName+=".map"; + CString MAPFileName = CoreName; + MAPFileName += ".map"; DWORD dwFlags = MAPDATA_UPDATE_TO_INI_ALL; @@ -1028,7 +996,7 @@ void CFinalSunDlg::SaveMap(CString FileName_) } else { opt.m_Standard = TRUE; } - + if (opt.DoModal() == IDCANCEL) { return; } @@ -1069,20 +1037,19 @@ void CFinalSunDlg::SaveMap(CString FileName_) if (gm.GetLength() == 0) { gm = "standard"; } - + Map->GetIniFile().SetString("Basic", "Name", opt.m_MapName); Map->GetIniFile().SetString("Basic", "GameMode", gm); int i; - int count=0; - for(i=0;iGetWaypointCount();i++) - { + int count = 0; + for (i = 0; i < Map->GetWaypointCount(); i++) { CString id; DWORD pos; Map->GetWaypointData(i, &id, &pos); int idi; - idi=atoi(id); + idi = atoi(id); if (idi != i) { break; } @@ -1097,7 +1064,7 @@ void CFinalSunDlg::SaveMap(CString FileName_) // TODO: control from dialog Map->GetIniFile().SetInteger("Basic", "MinPlayer", 2); Map->GetIniFile().SetInteger("Basic", "MaxPlayer", count); - + if (opt.m_Compress == 0) { dwFlags |= MAPDATA_UPDATE_TO_INI_ALL_COMPRESSED; } @@ -1134,41 +1101,41 @@ void CFinalSunDlg::SaveMap(CString FileName_) return; } - Description=opt.m_Description; - standard=opt.m_Standard; - airwar=opt.m_AirWar; - cooperative=opt.m_Cooperative; - duel=opt.m_Duel; - navalwar=opt.m_NavalWar; - nukewar=opt.m_NukeWar; - meatgrind=opt.m_Meatgrind; - megawealth=opt.m_MegaWealth; + Description = opt.m_Description; + standard = opt.m_Standard; + airwar = opt.m_AirWar; + cooperative = opt.m_Cooperative; + duel = opt.m_Duel; + navalwar = opt.m_NavalWar; + nukewar = opt.m_NukeWar; + meatgrind = opt.m_Meatgrind; + megawealth = opt.m_MegaWealth; - maxplayers=opt.m_Maxplayers+2; - minplayers=opt.m_MinPlayers+2; + maxplayers = opt.m_Maxplayers + 2; + minplayers = opt.m_MinPlayers + 2; - dwFlags|=MAPDATA_UPDATE_TO_INI_ALL_PREVIEW; + dwFlags |= MAPDATA_UPDATE_TO_INI_ALL_PREVIEW; Map->GetIniFile().SetBool("Basic", "Official", "Yes"); // Map->GetIniFile().sections["Basic"].values["Name"]=opt.m_Description; - } - + } + SetText("Packing data..."); - UpdateWindow(); - errstream << "Calling UpdateIniFile()"<UpdateIniFile(dwFlags); - - CIniFile& ini=Map->GetIniFile(); + + CIniFile& ini = Map->GetIniFile(); // delete invalid ini sections for (auto it = ini.begin(); it != ini.end();) { @@ -1180,130 +1147,224 @@ void CFinalSunDlg::SaveMap(CString FileName_) // why need this trim? we should handle it in the first place #if 0 - for(auto & sec : ini) { + for (auto& sec : ini) { int e; if (sec.first == "IsoMapPack5") { continue; } - for(e=0;eTrimLeft(); { - CString value=*sec.GetValue(e); - CString name=*sec.GetValueName(e); + CString value = *sec.GetValue(e); + CString name = *sec.GetValueName(e); sec.values.erase(name); name.TrimLeft(); - sec.values[name]=value; + sec.values[name] = value; } } } - for(i=0;iTrimRight(); - { - CString value=*sec.GetValue(e); - CString name=*sec.GetValueName(e); + if (*ini.GetSectionName(i) != "IsoMapPack5") + for (e = 0; e < sec.values.size(); e++) { + sec.GetValue(e)->TrimRight(); + { + CString value = *sec.GetValue(e); + CString name = *sec.GetValueName(e); - sec.values.erase(name); - name.TrimRight(); - sec.values[name]=value; + sec.values.erase(name); + name.TrimRight(); + sec.values[name] = value; + } } - } } #endif - - + + SetText("Saving..."); UpdateWindow(); - - + + std::wstring FileName = utf8ToUtf16(FileName_.GetString()); map rulessections; - - std::string tempfile=u8AppDataPath; - tempfile+="\\TmpMap.map"; + + std::string tempfile = u8AppDataPath; + tempfile += "\\TmpMap.map"; std::wstring u16tempfile = utf8ToUtf16(tempfile); - CString fi; - - deleteFile(tempfile); - HANDLE hFile=CreateFileW(u16tempfile.c_str(), GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); - CloseHandle(hFile); - hFile=CreateFileW(u16tempfile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); - + CString fi; + + deleteFile(tempfile); + HANDLE hFile = CreateFileW(u16tempfile.c_str(), GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + CloseHandle(hFile); + hFile = CreateFileW(u16tempfile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + + + DWORD bwr; - DWORD bwr; - #ifdef TS_MODE - fi= "; Map created with FinalSun Mission Editor"; - fi+="\n"; - fi+= "; note that all comments were truncated" ; - fi+= "\n"; - fi+="\n"; + fi = "; Map created with FinalSun Mission Editor"; + fi += "\n"; + fi += "; note that all comments were truncated"; + fi += "\n"; + fi += "\n"; #else - fi= "; Map created with FinalAlert 2 Mission Editor"; - fi+="\n"; - fi+= "; note that all comments were truncated" ; - fi+= "\n"; - fi+="\n"; + fi = "; Map created with FinalAlert 2 Mission Editor"; + fi += "\n"; + fi += "; note that all comments were truncated"; + fi += "\n"; + fi += "\n"; #endif + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + + fi = ""; + + // MW 07/28/01: Header saving at top + { + auto const headerSecName = "Header"; + auto const& headerSec = ini[headerSecName]; + rulessections[headerSecName] = TRUE; + + fi = "["; + fi += headerSecName; + fi += "]"; + fi += "\n"; + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - fi=""; - - // MW 07/28/01: Header saving at top - { - auto const headerSecName = "Header"; - auto const& headerSec = ini[headerSecName]; - rulessections[headerSecName] = TRUE; - - fi = "["; - fi += headerSecName; - fi += "]"; + char c[50]; + for (auto e = 0; e < headerSec.Size(); e++) { + auto const& [key, value] = headerSec.Nth(e); + fi = key; + fi += "="; + fi += value; fi += "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - char c[50]; - for (auto e = 0; e < headerSec.Size(); e++) { - auto const& [key, value] = headerSec.Nth(e); - fi = key; - fi += "="; - fi += value; - fi += "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - - - if (e % 500 == 0) { - int percent = e * 100 / headerSec.Size(); - itoa(percent, c, 10); - SetText((CString)"Saving... " + headerSecName + "( " + c + "% )"); - UpdateWindow(); - } + if (e % 500 == 0) { + int percent = e * 100 / headerSec.Size(); + itoa(percent, c, 10); + SetText((CString)"Saving... " + headerSecName + "( " + c + "% )"); + UpdateWindow(); } - fi = "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); } - for (auto const& [secName, sec] : ini) { - if (!Map->IsRulesSection(secName)) { - continue; - } - rulessections[secName] = TRUE; + fi = "\n"; + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + } + for (auto const& [secName, sec] : ini) { + if (!Map->IsRulesSection(secName)) { + continue; + } + rulessections[secName] = TRUE; + + fi = "["; + fi += secName; + fi += "]"; + fi += "\n"; + + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + + char c[50]; + for (auto e = 0; e < sec.Size(); e++) { + auto const& [key, value] = sec.Nth(e); + fi = key; + fi += "="; + fi += value; + fi += "\n"; + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + + if (e % 500 == 0) { + int percent = e * 100 / sec.Size(); + itoa(percent, c, 10); + SetText((CString)"Saving... " + secName + "( " + c + "% )"); + UpdateWindow(); + } + + } + + fi = "\n"; + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + } + + // the preview must be before map data... + if (hidePreview) { + fi += "; this is a hidden preview"; + fi += "\n"; + fi += "[Preview]"; + fi += "\n"; + fi += "Size=0,0,106,61"; + fi += "\n"; + fi += "\n"; + fi += "[PreviewPack]"; + fi += "\n"; + fi += "2=BIACcgAEwBtAMnRABAAaQCSANMAVQASAAnIABMAbQDJ0QAQAGkAkgDTAFUAEgAJyAATAG0"; + fi += "\n"; + fi += "1=yAsAIAXQ5PDQ5PDQ6JQATAEE6PDQ4PDI4JgBTAFEAkgAJyAATAG0AydEAEABpAJIA0wBVA"; + fi += "\n"; + fi += "\n"; + } else { + fi += "[Preview]"; + fi += "\n"; + for (auto const& [key, value] : ini["Preview"]) { + fi += key; + fi += "="; + fi += value; + fi += "\n"; + } + fi += "\n"; + fi += "[PreviewPack]"; + fi += "\n"; + for (auto const& [key, value] : ini["PreviewPack"]) { + fi += key; + fi += "="; + fi += value; + fi += "\n"; + } + fi += "\n"; + } + + + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + + auto alreadyHandledSections = [&rulessections](const CString& secName) { + const char* handledSections[] = { + "Digest", + "PreviewPack", + "Preview", + "Header" + }; + + if (rulessections.find(secName) != rulessections.end()) { + return true; + } + + for (auto const pSec : handledSections) { + if (pSec == secName) { + return true; + } + } + + return false; + }; + + for (auto const& [secName, sec] : ini) { + if (alreadyHandledSections(secName)) { + continue; + } + if (!secName.IsEmpty()) { + //MessageBox(secName); + //its a standard section: fi = "["; fi += secName; fi += "]"; @@ -1332,241 +1393,136 @@ void CFinalSunDlg::SaveMap(CString FileName_) fi = "\n"; WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); } + } - // the preview must be before map data... - if (hidePreview) { - fi += "; this is a hidden preview"; - fi += "\n"; - fi += "[Preview]"; - fi += "\n"; - fi += "Size=0,0,106,61"; - fi += "\n"; - fi += "\n"; - fi += "[PreviewPack]"; - fi += "\n"; - fi += "2=BIACcgAEwBtAMnRABAAaQCSANMAVQASAAnIABMAbQDJ0QAQAGkAkgDTAFUAEgAJyAATAG0"; - fi += "\n"; - fi += "1=yAsAIAXQ5PDQ5PDQ6JQATAEE6PDQ4PDI4JgBTAFEAkgAJyAATAG0AydEAEABpAJIA0wBVA"; - fi += "\n"; - fi += "\n"; - } else { - fi += "[Preview]"; - fi += "\n"; - for (auto const& [key, value] : ini["Preview"]) { - fi += key; - fi += "="; - fi += value; - fi += "\n"; - } - fi += "\n"; - fi += "[PreviewPack]"; - fi += "\n"; - for (auto const& [key, value] : ini["PreviewPack"]) { - fi += key; - fi += "="; - fi += value; - fi += "\n"; - } - fi += "\n"; - } - - - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - - auto alreadyHandledSections = [&rulessections](const CString& secName) { - const char* handledSections[] = { - "Digest", - "PreviewPack", - "Preview", - "Header" - }; - - if (rulessections.find(secName) != rulessections.end()) { - return true; - } - - for (auto const pSec : handledSections) { - if (pSec == secName) { - return true; - } - } - - return false; - }; - - for (auto const& [secName, sec] : ini) { - if (alreadyHandledSections(secName)) { - continue; - } - if (!secName.IsEmpty()) { - //MessageBox(secName); - //its a standard section: - fi = "["; - fi += secName; - fi += "]"; - fi += "\n"; - - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - - char c[50]; - for (auto e = 0; e < sec.Size(); e++) { - auto const& [key, value] = sec.Nth(e); - fi = key; - fi += "="; - fi += value; - fi += "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - - if (e % 500 == 0) { - int percent = e * 100 / sec.Size(); - itoa(percent, c, 10); - SetText((CString)"Saving... " + secName + "( " + c + "% )"); - UpdateWindow(); - } - - } - - fi = "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - } - } - + fi += "\n"; + fi += "[Digest]"; + fi += "\n"; + for (auto const& [key, value] : ini["Digest"]) { + fi += key; fi += "="; + fi += value; fi += "\n"; - fi += "[Digest]"; - fi += "\n"; - for (auto const& [key, value] : ini["Digest"]) { - fi += key; fi += "="; - fi += value; - fi += "\n"; - } - fi += "\n"; - WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); + } + fi += "\n"; + WriteFile(hFile, fi, fi.GetLength(), &bwr, NULL); - - CloseHandle(hFile); - dlg.DestroyWindow(); + CloseHandle(hFile); - auto DestName=FileName; - if(bSaveAsMMX) - { - MAPFileName.Replace(" ", ""); - MMXFileName.Replace(" ", ""); - PKTFileName.Replace(" ", ""); - CoreName.Replace(" ", ""); - } - if (bSaveAsMMX) - FileName = utf8ToUtf16(MAPFileName.GetString()); - - const auto u8FileName = utf16ToUtf8(FileName); + dlg.DestroyWindow(); - if(!CopyFileW(u16tempfile.c_str(), FileName.c_str(), FALSE)) - { - MessageBox("Error: file cannot be saved. Make sure the file is not read only","Error",MB_OK); - } - else - { - SetText(TranslateStringVariables(1,GetLanguageStringACP("FileSaved"), u8FileName.c_str())); - if(bSaveAsMMX) - { - SetText(TranslateStringVariables(1,GetLanguageStringACP("FileSaved"), MMXFileName)); - - // MW 07/20/01: - InsertPrevFile(MMXFileName); + auto DestName = FileName; + if (bSaveAsMMX) { + MAPFileName.Replace(" ", ""); + MMXFileName.Replace(" ", ""); + PKTFileName.Replace(" ", ""); + CoreName.Replace(" ", ""); + } + if (bSaveAsMMX) + FileName = utf8ToUtf16(MAPFileName.GetString()); - CIniFile f; - //CoreName.Replace(" ", ""); - //Description.Replace(" ",""); - - f.SetString("MultiMaps", "1", CoreName); - f.SetString(CoreName, "Description", Description); - CString gm; - if (standard) { - gm += "standard, "; - } - if (meatgrind) { - gm += "meatgrind, "; - } - if (navalwar) { - gm += "navalwar, "; - } - if (nukewar) { - gm += "nukewar, "; - } - if (airwar) { - gm += "airwar, "; - } - if (megawealth) { - gm += "megawealth, "; - } - if (duel) { - gm += "duel, "; - } - if (cooperative) { - gm += "cooperative, "; - } + const auto u8FileName = utf16ToUtf8(FileName); - if (gm.ReverseFind(',') >= 0) { - gm = gm.Left(gm.ReverseFind(',')); - } + if (!CopyFileW(u16tempfile.c_str(), FileName.c_str(), FALSE)) { + MessageBox("Error: file cannot be saved. Make sure the file is not read only", "Error", MB_OK); + } else { + SetText(TranslateStringVariables(1, GetLanguageStringACP("FileSaved"), u8FileName.c_str())); + if (bSaveAsMMX) { + SetText(TranslateStringVariables(1, GetLanguageStringACP("FileSaved"), MMXFileName)); - f.SetString(CoreName, "GameMode", gm); + // MW 07/20/01: + InsertPrevFile(MMXFileName); - char c[50]; - f.SetInteger( CoreName,"MaxPlayers", maxplayers); - f.SetInteger(CoreName, "MinPlayers", minplayers); + CIniFile f; + //CoreName.Replace(" ", ""); + //Description.Replace(" ",""); - f.SetString(CoreName, "CD", "0,1"); - + f.SetString("MultiMaps", "1", CoreName); + f.SetString(CoreName, "Description", Description); + CString gm; + if (standard) { + gm += "standard, "; + } + if (meatgrind) { + gm += "meatgrind, "; + } + if (navalwar) { + gm += "navalwar, "; + } + if (nukewar) { + gm += "nukewar, "; + } + if (airwar) { + gm += "airwar, "; + } + if (megawealth) { + gm += "megawealth, "; + } + if (duel) { + gm += "duel, "; + } + if (cooperative) { + gm += "cooperative, "; + } - f.SaveFile(PKTFileName); + if (gm.ReverseFind(',') >= 0) { + gm = gm.Left(gm.ReverseFind(',')); + } - LPCSTR files[2]; - files[0] = (LPCSTR)PKTFileName; - files[1] = (LPCSTR)MAPFileName; + f.SetString(CoreName, "GameMode", gm); + + char c[50]; + f.SetInteger(CoreName, "MaxPlayers", maxplayers); + f.SetInteger(CoreName, "MinPlayers", minplayers); + + f.SetString(CoreName, "CD", "0,1"); + + + f.SaveFile(PKTFileName); + + LPCSTR files[2]; + files[0] = (LPCSTR)PKTFileName; + files[1] = (LPCSTR)MAPFileName; #ifdef RA2_MODE - auto game = yuri_mode ? FSunPackLib::Game::RA2_YR : FSunPackLib::Game::RA2; + auto game = yuri_mode ? FSunPackLib::Game::RA2_YR : FSunPackLib::Game::RA2; #else - auto game = FSunPackLib::Game::TS; + auto game = FSunPackLib::Game::TS; #endif - FSunPackLib::WriteMixFile(MMXFileName, files, 2, game); + FSunPackLib::WriteMixFile(MMXFileName, files, 2, game); - DeleteFile(PKTFileName); - DeleteFile(MAPFileName); - } - else - { - // MW 07/20/01: - InsertPrevFile(u8FileName.c_str()); - } + DeleteFile(PKTFileName); + DeleteFile(MAPFileName); + } else { + // MW 07/20/01: + InsertPrevFile(u8FileName.c_str()); } + } - deleteFile(tempfile); + deleteFile(tempfile); SetCursor(m_hArrowCursor); //SetReady(); - } +} void CFinalSunDlg::SetReady() { - m_view.m_statbar.GetStatusBarCtrl().SetText(TranslateStringACP("Ready"), 0,0); + m_view.m_statbar.GetStatusBarCtrl().SetText(TranslateStringACP("Ready"), 0, 0); } -void CFinalSunDlg::SetText(const char *text) +void CFinalSunDlg::SetText(const char* text) { - m_view.m_statbar.GetStatusBarCtrl().SetText(text,0,0); + m_view.m_statbar.GetStatusBarCtrl().SetText(text, 0, 0); } -void CFinalSunDlg::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) +void CFinalSunDlg::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu) { - + CDialog::OnMenuSelect(nItemID, nFlags, hSysMenu); - - switch(nItemID) - { + + switch (nItemID) { case ID_FILE_OPENMAP: SetText(GetLanguageStringACP("FileOpenHelp")); break; @@ -1622,17 +1578,16 @@ void CFinalSunDlg::OnFileRuntiberiansun() // or RA2 PROCESS_INFORMATION pi; STARTUPINFO si; memset(&si, 0, sizeof(STARTUPINFO)); - si.cb=sizeof(STARTUPINFO); + si.cb = sizeof(STARTUPINFO); - CString exe=theApp.m_Options.TSExe; + CString exe = theApp.m_Options.TSExe; exe.MakeLower(); - if(yuri_mode) - { - exe.Replace("ra2.exe","ra2md.exe"); + if (yuri_mode) { + exe.Replace("ra2.exe", "ra2md.exe"); } - BOOL success=CreateProcess(exe, + BOOL success = CreateProcess(exe, NULL, NULL, NULL, @@ -1642,13 +1597,13 @@ void CFinalSunDlg::OnFileRuntiberiansun() // or RA2 NULL, &si, &pi); - + } -void CFinalSunDlg::OnFileImportmod() +void CFinalSunDlg::OnFileImportmod() { /*CImportModDlg dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "TS maps|*.mpr;*.map|TS multi maps|*.mpr|TS single maps|*.map|"); @@ -1662,12 +1617,12 @@ void CFinalSunDlg::OnFileImportmod() if(dlg.DoModal()==IDCANCEL) return; */ - + } -void CFinalSunDlg::OnDebugExportmappacknosections() +void CFinalSunDlg::OnDebugExportmappacknosections() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ovrl; int i; @@ -1685,25 +1640,25 @@ void CFinalSunDlg::OnDebugExportmappacknosections() //int hexlen=ConvertToHex((BYTE*)(LPCTSTR)ovrl, hex); - - + + //ExtractIsoMapPack5(hex,hexlen, values); - HANDLE hFile=CreateFile("c:\\MAPPACKNOSECTIONS.BIN", GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); - CloseHandle(hFile); - hFile=CreateFile("c:\\MAPPACKNOSECTIONS.BIN", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + HANDLE hFile = CreateFile("c:\\MAPPACKNOSECTIONS.BIN", GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); + CloseHandle(hFile); + hFile = CreateFile("c:\\MAPPACKNOSECTIONS.BIN", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); DWORD dw; WriteFile(hFile, values, 400000, &dw, NULL); CloseHandle(hFile); - + } -void CFinalSunDlg::OnDebugExportmappack() +void CFinalSunDlg::OnDebugExportmappack() { - + } void deleteTypeListFromIni(CIniFile& ini, const CString& SectionType) @@ -1719,121 +1674,111 @@ void DeleteTypeList(const CString& SectionType) deleteTypeListFromIni(Map->GetIniFile(), SectionType); } -void CFinalSunDlg::OnFileNew() +void CFinalSunDlg::OnFileNew() { - - CNewMapTypeDlg typedlg; - if(typedlg.DoModal()==IDCANCEL) return; - BOOL bSingleplayer=!typedlg.m_Singleplayer; + CNewMapTypeDlg typedlg; + if (typedlg.DoModal() == IDCANCEL) return; + + BOOL bSingleplayer = !typedlg.m_Singleplayer; CNewMapCreateDlg createdlg; - if(createdlg.DoModal()==IDCANCEL) return; + if (createdlg.DoModal() == IDCANCEL) return; + + BOOL bCreateNew = !createdlg.m_CreateType; - BOOL bCreateNew=!createdlg.m_CreateType; - int width, height, theater, stdheight; CString importmap; BOOL bImportTrees, bImportUnits, bImportOverlay; - if(bCreateNew) - { + if (bCreateNew) { CNewMapCreateNewDlg createnewdlg; - if(createnewdlg.DoModal()==IDCANCEL) return; - width=createnewdlg.m_Width; - height=createnewdlg.m_Height; - stdheight=createnewdlg.m_StartingHeight; - theater=createnewdlg.m_Theater; - } - else - { - while(!DoesFileExist(importmap)) - { + if (createnewdlg.DoModal() == IDCANCEL) return; + width = createnewdlg.m_Width; + height = createnewdlg.m_Height; + stdheight = createnewdlg.m_StartingHeight; + theater = createnewdlg.m_Theater; + } else { + while (!DoesFileExist(importmap)) { CNewMapImportDlg impdlg; - if(impdlg.DoModal()==IDCANCEL) return; - importmap=impdlg.m_ImportFile; - bImportTrees=impdlg.m_ImportTrees; - bImportUnits=impdlg.m_ImportUnits; - bImportOverlay=impdlg.m_ImportOverlay; + if (impdlg.DoModal() == IDCANCEL) return; + importmap = impdlg.m_ImportFile; + bImportTrees = impdlg.m_ImportTrees; + bImportUnits = impdlg.m_ImportUnits; + bImportOverlay = impdlg.m_ImportOverlay; } } CString plhouse; - BOOL bPrepareHouses=FALSE; - BOOL bAutoProd=FALSE; + BOOL bPrepareHouses = FALSE; + BOOL bAutoProd = FALSE; if (bSingleplayer) { CNewMapSpDlg spdlg; if (spdlg.DoModal() == IDCANCEL) { return; } - bPrepareHouses=spdlg.m_PrepareHouses; - bAutoProd=spdlg.m_AutoProd; + bPrepareHouses = spdlg.m_PrepareHouses; + bAutoProd = spdlg.m_AutoProd; plhouse = rules[HOUSES].Nth(spdlg.m_House).second; } - bNoDraw=TRUE; + bNoDraw = TRUE; m_PKTHeader.Clear(); - + // first hide the terrain browser window m_TerrainDlg.DestroyWindow(); // set currentMapFile to nothing and update window caption - strcpy(currentMapFile,""); + strcpy(currentMapFile, ""); CString cap; - cap=GetLanguageStringACP("MainDialogCaption"); - cap+=" ("; - cap+=GetLanguageStringACP("NewMap"); - cap+=")"; + cap = GetLanguageStringACP("MainDialogCaption"); + cap += " ("; + cap += GetLanguageStringACP("NewMap"); + cap += ")"; SetWindowText(cap); // set cursor to wait - SetCursor(LoadCursor(NULL,IDC_WAIT)); + SetCursor(LoadCursor(NULL, IDC_WAIT)); - if(!bCreateNew) - { - CString file=importmap; + if (!bCreateNew) { + CString file = importmap; file.MakeLower(); - if(file.Find(".bmp")>=0) - { + if (file.Find(".bmp") >= 0) { CBitmap2MapConverter conv; - HBITMAP hBitmap=(HBITMAP)LoadImageW(NULL, utf8ToUtf16(file.GetString()).c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); - + HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, utf8ToUtf16(file.GetString()).c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + conv.Convert(hBitmap, *Map); - + DeleteObject(hBitmap); - } - else - { + } else { Map->LoadMap(file.GetString()); - - if(!bImportOverlay) { + + if (!bImportOverlay) { Map->ClearOverlay(); Map->ClearOverlayData(); } - + CIniFile& ini = Map->GetIniFile(); int i; - int count=Map->GetTerrainCount(); - if(!bImportTrees) - { - for(i=0;iDeleteTerrain(0); + int count = Map->GetTerrainCount(); + if (!bImportTrees) { + for (i = 0; i < count; i++) + Map->DeleteTerrain(0); } - if(!bImportUnits) - { - count=Map->GetInfantryCount(); - for(i=0;iGetInfantryCount(); + for (i = 0; i < count; i++) Map->DeleteInfantry(0); - count=Map->GetUnitCount(); - for(i=0;iGetUnitCount(); + for (i = 0; i < count; i++) Map->DeleteUnit(0); - count=Map->GetStructureCount(); - for(i=0;iGetStructureCount(); + for (i = 0; i < count; i++) Map->DeleteStructure(0); - count=Map->GetAircraftCount(); - for(i=0;iGetAircraftCount(); + for (i = 0; i < count; i++) Map->DeleteAircraft(0); } @@ -1855,45 +1800,42 @@ void CFinalSunDlg::OnFileNew() // ini.sections.erase("AITriggerTypes"); } } - - } - else - { + + } else { // ok, create a new map CString theater_s; - if(theater==0) theater_s=THEATER0; else if(theater==1) theater_s=THEATER1; - else if(theater==2) theater_s=THEATER2; else if(theater==3) theater_s=THEATER3; - else if(theater==4) theater_s=THEATER4; else if(theater==5) theater_s=THEATER5; - - Map->CreateMap(width, height, theater_s, stdheight); - - if(!bSingleplayer) - { - last_succeeded_operation=11003; + if (theater == 0) theater_s = THEATER0; else if (theater == 1) theater_s = THEATER1; + else if (theater == 2) theater_s = THEATER2; else if (theater == 3) theater_s = THEATER3; + else if (theater == 4) theater_s = THEATER4; else if (theater == 5) theater_s = THEATER5; + + Map->CreateMap(width, height, theater_s, stdheight); + + if (!bSingleplayer) { + last_succeeded_operation = 11003; // create map function was created for SP. Fix it here; Map->DeleteWaypoint(0); Map->DeleteWaypoint(0); - int midx=Map->GetIsoSize()/2; - int midy=Map->GetIsoSize()/2; - Map->AddWaypoint("0", midx+midy*Map->GetIsoSize()); - Map->AddWaypoint("1", midx+1+midy*Map->GetIsoSize()); - Map->AddWaypoint("2", midx+2+midy*Map->GetIsoSize()); - Map->AddWaypoint("3", midx+3+midy*Map->GetIsoSize()); - Map->AddWaypoint("4", midx+(midy+1)*Map->GetIsoSize()); - Map->AddWaypoint("5", midx+1+(midy+1)*Map->GetIsoSize()); - Map->AddWaypoint("6", midx+2+(midy+1)*Map->GetIsoSize()); - Map->AddWaypoint("7", midx+3+(midy+1)*Map->GetIsoSize()); - + int midx = Map->GetIsoSize() / 2; + int midy = Map->GetIsoSize() / 2; + Map->AddWaypoint("0", midx + midy * Map->GetIsoSize()); + Map->AddWaypoint("1", midx + 1 + midy * Map->GetIsoSize()); + Map->AddWaypoint("2", midx + 2 + midy * Map->GetIsoSize()); + Map->AddWaypoint("3", midx + 3 + midy * Map->GetIsoSize()); + Map->AddWaypoint("4", midx + (midy + 1) * Map->GetIsoSize()); + Map->AddWaypoint("5", midx + 1 + (midy + 1) * Map->GetIsoSize()); + Map->AddWaypoint("6", midx + 2 + (midy + 1) * Map->GetIsoSize()); + Map->AddWaypoint("7", midx + 3 + (midy + 1) * Map->GetIsoSize()); + } } - - last_succeeded_operation=11004; + + last_succeeded_operation = 11004; - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (!bSingleplayer) { ini.SetString("Basic", "MultiplayerOnly", "1"); @@ -1930,7 +1872,7 @@ void CFinalSunDlg::OnFileNew() // is it a player house or a ai house? if (house != (LPCTSTR)plhouse) { ini.SetInteger(house, "IQ", 5); - + ini.SetBool(house, "PlayerControl", false); // now, if the user wants to, check if this house is a passive or active house @@ -1958,26 +1900,26 @@ void CFinalSunDlg::OnFileNew() actionContent += idxStr; actionContent += ",0,0,0,0,A"; - ini.SetString("Actions",id, actionContent); + ini.SetString("Actions", id, actionContent); CString ID_TAG = GetFreeID(); - CString tagContent ="0,AI Auto Production "; + CString tagContent = "0,AI Auto Production "; tagContent += TranslateHouse(house, TRUE); tagContent += ","; tagContent += id; ini.SetString("Tags", ID_TAG, tagContent); } - + } else { ini.SetInteger(house, "IQ", 0); ini.SetBool(house, "PlayerControl", true); } #ifndef RA2_MODE - ini.sections[house].values["ActsLike"]=c; - ini.sections[house].values["Side"]=house; + ini.sections[house].values["ActsLike"] = c; + ini.sections[house].values["Side"] = house; #else ini.SetString(house, "Country", country); #endif @@ -2006,16 +1948,14 @@ void CFinalSunDlg::OnFileNew() } } - } - else - { + } else { // for RA2, we create standard houses #ifdef RA2_MODE auto const& rulesHouseSec = rules[HOUSES]; for (auto idx = 0; idx < rulesHouseSec.Size(); idx++) { char c[50]; - int k=idx; - itoa(k,c,10); + int k = idx; + itoa(k, c, 10); auto const& country = rulesHouseSec.Nth(idx).second; if (country.IsEmpty()) { @@ -2024,7 +1964,7 @@ void CFinalSunDlg::OnFileNew() // we now create a HOUSE with the same name as the current rules house ini.SetString(MAPHOUSES, c, country); - + ini.SetInteger(country, "IQ", 0); ini.SetString(country, "Edge", "North"); ini.SetString(country, "Color", rules.GetString(country, "Color")); @@ -2048,17 +1988,17 @@ void CFinalSunDlg::OnFileNew() } } - last_succeeded_operation=11000; + last_succeeded_operation = 11000; - Map->UpdateIniFile(MAPDATA_UPDATE_FROM_INI); + Map->UpdateIniFile(MAPDATA_UPDATE_FROM_INI); + + last_succeeded_operation = 11001; - last_succeeded_operation=11001; - Sleep(200); - + SetCursor(m_hArrowCursor); - bNoDraw=FALSE; + bNoDraw = FALSE; //if(RepairRulesHouses()) // MessageBox("Repaired houses"); @@ -2067,7 +2007,7 @@ void CFinalSunDlg::OnFileNew() m_view.m_minimap.RedrawWindow(); UpdateDialogs(); - last_succeeded_operation=11002; + last_succeeded_operation = 11002; } @@ -2077,75 +2017,71 @@ void CFinalSunDlg::OnFileNew() */ void CFinalSunDlg::UpdateStrings() { - last_succeeded_operation=20; + last_succeeded_operation = 20; CString str; - - // update the menu - CMenu* menu=GetMenu(); - + // update the menu + CMenu* menu = GetMenu(); + + // destroy the old menu - if(menu) menu->DestroyMenu(); + if (menu) menu->DestroyMenu(); // if(menu) delete menu; - CMenu* my_menu=new(CMenu); + CMenu* my_menu = new(CMenu); // first, we load the original menu (we can´t translate from for example german!) my_menu->LoadMenu(IDR_MAIN); - int idx,e; - for(idx=0;idxGetMenuItemCount();idx++) - { + int idx, e; + for (idx = 0; idx < my_menu->GetMenuItemCount(); idx++) { MENUITEMINFO mii; ZeroMemory(&mii, sizeof(MENUITEMINFO)); - mii.cbSize=sizeof(MENUITEMINFO); - mii.fMask=MIIM_ID | MIIM_STATE | MIIM_TYPE; + mii.cbSize = sizeof(MENUITEMINFO); + mii.fMask = MIIM_ID | MIIM_STATE | MIIM_TYPE; my_menu->GetMenuItemInfo(idx, &mii, TRUE); my_menu->GetMenuString(idx, str, MF_BYPOSITION); - my_menu->ModifyMenu(idx,mii.fState | mii.fType | MF_BYPOSITION | MF_STRING, mii.wID, TranslateStringACP((LPCTSTR)str)); - for(e=0;eGetSubMenu(idx)->GetMenuItemCount();e++) - { - int id=my_menu->GetSubMenu(idx)->GetMenuItemID(e); - + my_menu->ModifyMenu(idx, mii.fState | mii.fType | MF_BYPOSITION | MF_STRING, mii.wID, TranslateStringACP((LPCTSTR)str)); + for (e = 0; e < my_menu->GetSubMenu(idx)->GetMenuItemCount(); e++) { + int id = my_menu->GetSubMenu(idx)->GetMenuItemID(e); + ZeroMemory(&mii, sizeof(MENUITEMINFO)); - mii.cbSize=sizeof(MENUITEMINFO); - mii.fMask=MIIM_ID | MIIM_STATE | MIIM_TYPE; + mii.cbSize = sizeof(MENUITEMINFO); + mii.fMask = MIIM_ID | MIIM_STATE | MIIM_TYPE; my_menu->GetSubMenu(idx)->GetMenuItemInfo(e, &mii, TRUE); my_menu->GetSubMenu(idx)->GetMenuString(e, str, MF_BYPOSITION); - my_menu->GetSubMenu(idx)->ModifyMenu(e,mii.fState | mii.fType | MF_BYPOSITION | MF_STRING, mii.wID, TranslateStringACP((LPCTSTR)str)); - + my_menu->GetSubMenu(idx)->ModifyMenu(e, mii.fState | mii.fType | MF_BYPOSITION | MF_STRING, mii.wID, TranslateStringACP((LPCTSTR)str)); + } } - - if(theApp.m_Options.bEasy) my_menu->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); - if(theApp.m_Options.bDisableAutoShore) my_menu->CheckMenuItem(ID_OPTIONS_DISABLEAUTOSHORE, MF_BYCOMMAND | MF_CHECKED); - if(theApp.m_Options.bDisableAutoLat) my_menu->CheckMenuItem(ID_OPTIONS_DISABLEAUTOLAT, MF_BYCOMMAND | MF_CHECKED); - if(theApp.m_Options.bDisableSlopeCorrection) my_menu->CheckMenuItem(ID_OPTIONS_DISABLESLOPECORRECTION, MF_BYCOMMAND | MF_CHECKED); - if(theApp.m_Options.bShowCells) my_menu->CheckMenuItem(ID_OPTIONS_SHOWBUILDINGOUTLINE, MF_BYCOMMAND | MF_CHECKED); - if(theApp.m_Options.useDefaultMouseCursor) my_menu->CheckMenuItem(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND | MF_CHECKED); - if(!theApp.m_Options.viewScaleUseSteps) my_menu->CheckMenuItem(ID_OPTIONS_SMOOTHZOOM, MF_BYCOMMAND | MF_CHECKED); - + if (theApp.m_Options.bEasy) my_menu->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.bDisableAutoShore) my_menu->CheckMenuItem(ID_OPTIONS_DISABLEAUTOSHORE, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.bDisableAutoLat) my_menu->CheckMenuItem(ID_OPTIONS_DISABLEAUTOLAT, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.bDisableSlopeCorrection) my_menu->CheckMenuItem(ID_OPTIONS_DISABLESLOPECORRECTION, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.bShowCells) my_menu->CheckMenuItem(ID_OPTIONS_SHOWBUILDINGOUTLINE, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.useDefaultMouseCursor) my_menu->CheckMenuItem(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND | MF_CHECKED); + if (!theApp.m_Options.viewScaleUseSteps) my_menu->CheckMenuItem(ID_OPTIONS_SMOOTHZOOM, MF_BYCOMMAND | MF_CHECKED); + + // MW 07/20/01: Show prev. opened files - int prev_maps_count=0; - for(idx=0;idx<4;idx++) - { - if(theApp.m_Options.prev_maps[idx].GetLength()>0) - { + int prev_maps_count = 0; + for (idx = 0; idx < 4; idx++) { + if (theApp.m_Options.prev_maps[idx].GetLength() > 0) { prev_maps_count++; - int id=0; - CString str="bla"; - str=theApp.m_Options.prev_maps[idx]; - - if(idx==0) id=ID_FILE_FILE1; - else if(idx==1) id=ID_FILE_FILE2; - else if(idx==2) id=ID_FILE_FILE3; - else if(idx==3) id=ID_FILE_FILE4; - - my_menu->GetSubMenu(0)->InsertMenu(10+prev_maps_count, MF_BYPOSITION | MF_STRING, id, str); + int id = 0; + CString str = "bla"; + str = theApp.m_Options.prev_maps[idx]; + + if (idx == 0) id = ID_FILE_FILE1; + else if (idx == 1) id = ID_FILE_FILE2; + else if (idx == 2) id = ID_FILE_FILE3; + else if (idx == 3) id = ID_FILE_FILE4; + + my_menu->GetSubMenu(0)->InsertMenu(10 + prev_maps_count, MF_BYPOSITION | MF_STRING, id, str); } } @@ -2154,18 +2090,16 @@ void CFinalSunDlg::UpdateStrings() // my_menu->DeleteMenu(4, MF_BYPOSITION); #endif - if(theApp.m_Options.bEasy) my_menu->GetSubMenu(3)->DeleteMenu(0, MF_BYPOSITION); + if (theApp.m_Options.bEasy) my_menu->GetSubMenu(3)->DeleteMenu(0, MF_BYPOSITION); - if(theApp.m_Options.bEasy) - { - CMenu* edit_my_menu=my_menu->GetSubMenu(1); - for(idx=edit_my_menu->GetMenuItemCount()-1;idx>=11;idx--) // MW 07/17/2001: i>=9 changed to i>=10 so Basic dialog is always available + if (theApp.m_Options.bEasy) { + CMenu* edit_my_menu = my_menu->GetSubMenu(1); + for (idx = edit_my_menu->GetMenuItemCount() - 1; idx >= 11; idx--) // MW 07/17/2001: i>=9 changed to i>=10 so Basic dialog is always available { edit_my_menu->DeleteMenu(idx, MF_BYPOSITION); } - CMenu* terrain_my_menu=my_menu->GetSubMenu(2); - for(idx=terrain_my_menu->GetMenuItemCount()-1;idx>=8;idx--) - { + CMenu* terrain_my_menu = my_menu->GetSubMenu(2); + for (idx = terrain_my_menu->GetMenuItemCount() - 1; idx >= 8; idx--) { terrain_my_menu->DeleteMenu(idx, MF_BYPOSITION); } } @@ -2177,7 +2111,7 @@ void CFinalSunDlg::UpdateStrings() // now attach this my_menu to the window SetMenu(my_menu); - + // update the tabs /*TCITEM tci; memset(&tci, 0, sizeof(TCITEM)); @@ -2215,104 +2149,101 @@ void CFinalSunDlg::UpdateStrings() // now the child windows and the iso view m_view.m_objectview->UpdateDialog(); m_view.m_browser->m_bar.Update(); - if(m_basic.m_hWnd) m_basic.UpdateStrings(); - if(m_houses.m_hWnd) m_houses.UpdateStrings(); - if(m_map.m_hWnd) m_map.UpdateStrings(); - if(m_singleplayersettings.m_hWnd) m_singleplayersettings.UpdateStrings(); + if (m_basic.m_hWnd) m_basic.UpdateStrings(); + if (m_houses.m_hWnd) m_houses.UpdateStrings(); + if (m_map.m_hWnd) m_map.UpdateStrings(); + if (m_singleplayersettings.m_hWnd) m_singleplayersettings.UpdateStrings(); // we need to check SimpleView if using easy view - if(theApp.m_Options.bEasy) GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); - if(!theApp.m_Options.bNoSounds) GetMenu()->CheckMenuItem(ID_OPTIONS_SOUNDS, MF_BYCOMMAND | MF_CHECKED); + if (theApp.m_Options.bEasy) GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); + if (!theApp.m_Options.bNoSounds) GetMenu()->CheckMenuItem(ID_OPTIONS_SOUNDS, MF_BYCOMMAND | MF_CHECKED); - - - RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + + + RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); } -void CFinalSunDlg::OnHelpTipoftheday() +void CFinalSunDlg::OnHelpTipoftheday() { CTipDlg tip; tip.DoModal(); - + } void CFinalSunDlg::UnloadAll() { - int iQuit=MessageBox(GetLanguageStringACP("MainDialogExitQuestion"), GetLanguageStringACP("MainDialogExitQuestionCap"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2); - if(iQuit==IDNO) return; - else{ - try - { - - CShutDownDlg dlg(this); - dlg.ShowWindow(SW_SHOW); - dlg.UpdateWindow(); + int iQuit = MessageBox(GetLanguageStringACP("MainDialogExitQuestion"), GetLanguageStringACP("MainDialogExitQuestionCap"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2); + if (iQuit == IDNO) return; + else { + try { - tiledata=0; + CShutDownDlg dlg(this); + dlg.ShowWindow(SW_SHOW); + dlg.UpdateWindow(); - theApp.m_loading->FreeAll(); - - rules.Clear(); - ai.Clear(); - art.Clear(); - tiles_t.Clear(); - tiles_s.Clear(); - tiles_u.Clear(); - Map->GetIniFile().Clear(); - sound.Clear(); - tutorial.Clear(); - g_data.Clear(); - language.Clear(); - - - - DestroyWindow(); - } - catch(...) - { + tiledata = 0; + + theApp.m_loading->FreeAll(); + + rules.Clear(); + ai.Clear(); + art.Clear(); + tiles_t.Clear(); + tiles_s.Clear(); + tiles_u.Clear(); + Map->GetIniFile().Clear(); + sound.Clear(); + tutorial.Clear(); + g_data.Clear(); + language.Clear(); + + + + DestroyWindow(); + } catch (...) { DestroyWindow(); } } - + } -void CFinalSunDlg::OnOptionsSimpleview() +void CFinalSunDlg::OnOptionsSimpleview() { CIniFile Options; - Options.LoadFile(u8AppDataPath+"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bEasy=FALSE; + theApp.m_Options.bEasy = FALSE; Options.SetInteger("UserInterface", "EasyView", 0); // hide all dialogs: - HideAllDialogs(); + HideAllDialogs(); } else { GetMenu()->CheckMenuItem(ID_OPTIONS_SIMPLEVIEW, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bEasy=TRUE; + theApp.m_Options.bEasy = TRUE; Options.SetInteger("UserInterface", "EasyView", 1); } UpdateStrings(); #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath+"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif UpdateDialogs(); } -void CFinalSunDlg::OnOptionsShowminimap() +void CFinalSunDlg::OnOptionsShowminimap() { - bMiniMapClosedByUser=FALSE; + bMiniMapClosedByUser = FALSE; this->m_view.m_minimap.UpdateView(); } @@ -2348,38 +2279,35 @@ void CFinalSunDlg::HideAllDialogs() m_triggers.ShowWindow(SW_HIDE); } -void CFinalSunDlg::OnFileValidatemap() +void CFinalSunDlg::OnFileValidatemap() { CMapValidator validator; - int iCancel=validator.DoModal(); - if(iCancel==IDCANCEL) return; + int iCancel = validator.DoModal(); + if (iCancel == IDCANCEL) return; } -void CFinalSunDlg::OnEnterIdle(UINT nWhy, CWnd* pWho) +void CFinalSunDlg::OnEnterIdle(UINT nWhy, CWnd* pWho) { CDialog::OnEnterIdle(nWhy, pWho); - - + + } -void CFinalSunDlg::OnEditBasicsettings() +void CFinalSunDlg::OnEditBasicsettings() { - if(m_basic.m_hWnd==NULL) - { - if(!m_basic.Create(CBasic::IDD, NULL)) - { + if (m_basic.m_hWnd == NULL) { + if (!m_basic.Create(CBasic::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } - + } - if(m_basic.m_hWnd!=NULL) - { + if (m_basic.m_hWnd != NULL) { m_basic.UpdateStrings(); m_basic.UpdateDialog(); m_basic.ShowWindow(SW_SHOW); @@ -2387,159 +2315,135 @@ void CFinalSunDlg::OnEditBasicsettings() } } -void CFinalSunDlg::OnEditSingleplayersettings() +void CFinalSunDlg::OnEditSingleplayersettings() { - if(m_singleplayersettings.m_hWnd==NULL) - { - if(!m_singleplayersettings.Create(CSingleplayerSettings::IDD, NULL)) - { + if (m_singleplayersettings.m_hWnd == NULL) { + if (!m_singleplayersettings.Create(CSingleplayerSettings::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_singleplayersettings.m_hWnd!=NULL) - { + if (m_singleplayersettings.m_hWnd != NULL) { m_singleplayersettings.UpdateStrings(); m_singleplayersettings.UpdateDialog(); m_singleplayersettings.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - } + } } -void CFinalSunDlg::OnSizing(UINT fwSide, LPRECT pRect) +void CFinalSunDlg::OnSizing(UINT fwSide, LPRECT pRect) { CDialog::OnSizing(fwSide, pRect); - + } -void CFinalSunDlg::OnSize(UINT nType, int cx, int cy) +void CFinalSunDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); - if(nType==SIZE_MINIMIZED) - { - if(!bMiniMapClosedByUser) m_view.m_minimap.ShowWindow(SW_MINIMIZE); - } - else if(nType==SIZE_MAXIMIZED) - { - if(!bMiniMapClosedByUser) m_view.m_minimap.ShowWindow(SW_RESTORE); + if (nType == SIZE_MINIMIZED) { + if (!bMiniMapClosedByUser) m_view.m_minimap.ShowWindow(SW_MINIMIZE); + } else if (nType == SIZE_MAXIMIZED) { + if (!bMiniMapClosedByUser) m_view.m_minimap.ShowWindow(SW_RESTORE); } - RecalcLayout(); + RecalcLayout(); } -void CFinalSunDlg::OnEditHouses() +void CFinalSunDlg::OnEditHouses() { - if(m_houses.m_hWnd==NULL) - { - if(!m_houses.Create(CHouses::IDD, NULL)) - { + if (m_houses.m_hWnd == NULL) { + if (!m_houses.Create(CHouses::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_houses.m_hWnd!=NULL) - { + if (m_houses.m_hWnd != NULL) { m_houses.UpdateStrings(); m_houses.UpdateDialog(); m_houses.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - } + } } -void CFinalSunDlg::OnEditAitriggers() +void CFinalSunDlg::OnEditAitriggers() { - if(m_aitriggertypes.m_hWnd==NULL) - { - if(!m_aitriggertypes.Create(CAITriggerTypes::IDD, NULL)) - { + if (m_aitriggertypes.m_hWnd == NULL) { + if (!m_aitriggertypes.Create(CAITriggerTypes::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_aitriggertypes.m_hWnd!=NULL) - { + if (m_aitriggertypes.m_hWnd != NULL) { //m_aitriggertypes.UpdateStrings(); m_aitriggertypes.UpdateDialog(); m_aitriggertypes.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - + } - + } -void CFinalSunDlg::OnEditAitriggerenabling() +void CFinalSunDlg::OnEditAitriggerenabling() { - if(m_aitriggertypesenable.m_hWnd==NULL) - { - if(!m_aitriggertypesenable.Create(CAiTriggerTypesEnable::IDD, NULL)) - { + if (m_aitriggertypesenable.m_hWnd == NULL) { + if (!m_aitriggertypesenable.Create(CAiTriggerTypesEnable::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_aitriggertypesenable.m_hWnd!=NULL) - { + if (m_aitriggertypesenable.m_hWnd != NULL) { //m_aitriggertypesenable.UpdateStrings(); m_aitriggertypesenable.UpdateDialog(); m_aitriggertypesenable.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - + } } -void CFinalSunDlg::OnEditIniediting() +void CFinalSunDlg::OnEditIniediting() { - if(m_all.m_hWnd==NULL) - { - if(!m_all.Create(CAll::IDD, NULL)) - { + if (m_all.m_hWnd == NULL) { + if (!m_all.Create(CAll::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_all.m_hWnd!=NULL) - { + if (m_all.m_hWnd != NULL) { //m_all.UpdateStrings(); m_all.UpdateDialog(); m_all.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - } + } } -void CFinalSunDlg::OnEditLighting() +void CFinalSunDlg::OnEditLighting() { - if(m_lighting.m_hWnd==NULL) - { - if(!m_lighting.Create(CLighting::IDD, NULL)) - { + if (m_lighting.m_hWnd == NULL) { + if (!m_lighting.Create(CLighting::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_lighting.m_hWnd!=NULL) - { + if (m_lighting.m_hWnd != NULL) { //m_lighting.UpdateStrings(); m_lighting.UpdateDialog(); m_lighting.ShowWindow(SW_SHOW); Sound(SOUND_POSITIVE); - } - + } + } -void CFinalSunDlg::OnEditMap() +void CFinalSunDlg::OnEditMap() { - if(m_map.m_hWnd==NULL) - { - if(!m_map.Create(CMapD::IDD, NULL)) - { + if (m_map.m_hWnd == NULL) { + if (!m_map.Create(CMapD::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_map.m_hWnd!=NULL) - { + if (m_map.m_hWnd != NULL) { m_map.UpdateStrings(); m_map.UpdateDialog(); m_map.ShowWindow(SW_SHOW); @@ -2547,18 +2451,15 @@ void CFinalSunDlg::OnEditMap() } } -void CFinalSunDlg::OnEditScripts() +void CFinalSunDlg::OnEditScripts() { - if(m_Scripttypes.m_hWnd==NULL) - { - if(!m_Scripttypes.Create(CScriptTypes::IDD, NULL)) - { + if (m_Scripttypes.m_hWnd == NULL) { + if (!m_Scripttypes.Create(CScriptTypes::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_Scripttypes.m_hWnd!=NULL) - { + if (m_Scripttypes.m_hWnd != NULL) { //m_Scripttypes.UpdateStrings(); m_Scripttypes.UpdateDialog(); m_Scripttypes.ShowWindow(SW_SHOW); @@ -2566,18 +2467,15 @@ void CFinalSunDlg::OnEditScripts() } } -void CFinalSunDlg::OnEditSpecialflags() +void CFinalSunDlg::OnEditSpecialflags() { - if(m_specialflags.m_hWnd==NULL) - { - if(!m_specialflags.Create(CSpecialFlags::IDD, NULL)) - { + if (m_specialflags.m_hWnd == NULL) { + if (!m_specialflags.Create(CSpecialFlags::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_specialflags.m_hWnd!=NULL) - { + if (m_specialflags.m_hWnd != NULL) { //m_specialflags.UpdateStrings(); m_specialflags.UpdateDialog(); m_specialflags.ShowWindow(SW_SHOW); @@ -2585,18 +2483,15 @@ void CFinalSunDlg::OnEditSpecialflags() } } -void CFinalSunDlg::OnEditTags() +void CFinalSunDlg::OnEditTags() { - if(m_tags.m_hWnd==NULL) - { - if(!m_tags.Create(CTags::IDD, NULL)) - { + if (m_tags.m_hWnd == NULL) { + if (!m_tags.Create(CTags::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_tags.m_hWnd!=NULL) - { + if (m_tags.m_hWnd != NULL) { //m_tags.UpdateStrings(); m_tags.UpdateDialog(); m_tags.ShowWindow(SW_SHOW); @@ -2604,18 +2499,15 @@ void CFinalSunDlg::OnEditTags() } } -void CFinalSunDlg::OnEditTaskforces() +void CFinalSunDlg::OnEditTaskforces() { - if(m_taskforces.m_hWnd==NULL) - { - if(!m_taskforces.Create(CTaskForce::IDD, NULL)) - { + if (m_taskforces.m_hWnd == NULL) { + if (!m_taskforces.Create(CTaskForce::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_taskforces.m_hWnd!=NULL) - { + if (m_taskforces.m_hWnd != NULL) { //m_taskforces.UpdateStrings(); m_taskforces.UpdateDialog(); m_taskforces.ShowWindow(SW_SHOW); @@ -2623,18 +2515,15 @@ void CFinalSunDlg::OnEditTaskforces() } } -void CFinalSunDlg::OnEditTeams() +void CFinalSunDlg::OnEditTeams() { - if(m_teamtypes.m_hWnd==NULL) - { - if(!m_teamtypes.Create(CTeamTypes::IDD, NULL)) - { + if (m_teamtypes.m_hWnd == NULL) { + if (!m_teamtypes.Create(CTeamTypes::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_teamtypes.m_hWnd!=NULL) - { + if (m_teamtypes.m_hWnd != NULL) { //m_teamtypes.UpdateStrings(); m_teamtypes.UpdateDialog(); m_teamtypes.ShowWindow(SW_SHOW); @@ -2642,18 +2531,15 @@ void CFinalSunDlg::OnEditTeams() } } -void CFinalSunDlg::OnEditTriggers() +void CFinalSunDlg::OnEditTriggers() { - if(m_triggers.m_hWnd==NULL) - { - if(!m_triggers.Create(CTriggers::IDD, NULL)) - { + if (m_triggers.m_hWnd == NULL) { + if (!m_triggers.Create(CTriggers::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_triggers.m_hWnd!=NULL) - { + if (m_triggers.m_hWnd != NULL) { //m_triggers.UpdateStrings(); m_triggers.UpdateDialog(); m_triggers.ShowWindow(SW_SHOW); @@ -2661,118 +2547,110 @@ void CFinalSunDlg::OnEditTriggers() } } -void CFinalSunDlg::OnSetFocus(CWnd* pOldWnd) +void CFinalSunDlg::OnSetFocus(CWnd* pOldWnd) { CDialog::OnSetFocus(pOldWnd); SetForegroundWindow(); } -BOOL CFinalSunDlg::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) +BOOL CFinalSunDlg::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) { // - - + + return CDialog::OnChildNotify(message, wParam, lParam, pLResult); } void CFinalSunDlg::RecalcLayout() { - if(m_bar.m_hWnd==NULL) return; + if (m_bar.m_hWnd == NULL) return; - RECT r,rr; + RECT r, rr; GetClientRect(&r); m_bar.GetWindowRect(&rr); - int h=rr.bottom-rr.top+2; + int h = rr.bottom - rr.top + 2; m_bar.GetClientRect(&rr); - rr.right=r.right; - m_view.SetWindowPos(NULL, 0, h, r.right, r.bottom-h, SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_DRAWFRAME); - m_bar.SetWindowPos(NULL, 0,0, rr.right, rr.bottom, SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_DRAWFRAME); + rr.right = r.right; + m_view.SetWindowPos(NULL, 0, h, r.right, r.bottom - h, SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_DRAWFRAME); + m_bar.SetWindowPos(NULL, 0, 0, rr.right, rr.bottom, SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_DRAWFRAME); m_bar.ShowBand(0, TRUE); m_bar.ShowBand(1, TRUE); } -BOOL CFinalSunDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) +BOOL CFinalSunDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { - NMHDR* pHead=(NMHDR*)lParam; + NMHDR* pHead = (NMHDR*)lParam; - if(pHead->hwndFrom==m_bar.m_hWnd && pHead->code==RBN_HEIGHTCHANGE) - { + if (pHead->hwndFrom == m_bar.m_hWnd && pHead->code == RBN_HEIGHTCHANGE) { RecalcLayout(); } - if(pHead->code==TTN_NEEDTEXT) - { - TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pHead; - auto nID =pHead->idFrom; - if (pTTT->uFlags & TTF_IDISHWND) - { + if (pHead->code == TTN_NEEDTEXT) { + TOOLTIPTEXT* pTTT = (TOOLTIPTEXT*)pHead; + auto nID = pHead->idFrom; + if (pTTT->uFlags & TTF_IDISHWND) { // idFrom ist der HWND des Tools nID = ::GetDlgCtrlID((HWND)nID); } - - if(nID) - { + + if (nID) { CString s; char c[50]; - itoa(nID, c, 10); - + itoa(nID, c, 10); + s.LoadString(nID); - s=TranslateStringACP(s); + s = TranslateStringACP(s); //pTTT->lpszText = s; - if(s.GetLength()>80) s.SetAt(80, 0); + if (s.GetLength() > 80) s.SetAt(80, 0); strcpy(pTTT->szText, s); pTTT->hinst = NULL; return(TRUE); } - + } return CDialog::OnNotify(wParam, lParam, pResult); } -void CFinalSunDlg::OnTerrainHeightenground() +void CFinalSunDlg::OnTerrainHeightenground() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(AD.mode!=ACTIONMODE_HEIGHTEN) - { - m_settingsbar.m_BrushSize=1; + if (AD.mode != ACTIONMODE_HEIGHTEN) { + m_settingsbar.m_BrushSize = 1; m_settingsbar.UpdateData(FALSE); - m_view.m_isoview->m_BrushSize_x=2; - m_view.m_isoview->m_BrushSize_y=2; + m_view.m_isoview->m_BrushSize_x = 2; + m_view.m_isoview->m_BrushSize_y = 2; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_HEIGHTEN; - + AD.mode = ACTIONMODE_HEIGHTEN; + } -void CFinalSunDlg::OnTerrainLowerground() +void CFinalSunDlg::OnTerrainLowerground() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(AD.mode!=ACTIONMODE_LOWER) - { - m_settingsbar.m_BrushSize=1; + if (AD.mode != ACTIONMODE_LOWER) { + m_settingsbar.m_BrushSize = 1; m_settingsbar.UpdateData(FALSE); - m_view.m_isoview->m_BrushSize_x=2; - m_view.m_isoview->m_BrushSize_y=2; + m_view.m_isoview->m_BrushSize_x = 2; + m_view.m_isoview->m_BrushSize_y = 2; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_LOWER; + AD.mode = ACTIONMODE_LOWER; } //DEL void CFinalSunDlg::OnTerrainPaint() @@ -2793,83 +2671,76 @@ void CFinalSunDlg::OnTerrainLowerground() //DEL } //DEL } -void CFinalSunDlg::OnTerrainLowertile() +void CFinalSunDlg::OnTerrainLowertile() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(AD.mode!=ACTIONMODE_LOWERTILE) - { - m_settingsbar.m_BrushSize=0; + if (AD.mode != ACTIONMODE_LOWERTILE) { + m_settingsbar.m_BrushSize = 0; m_settingsbar.UpdateData(FALSE); - m_view.m_isoview->m_BrushSize_x=1; - m_view.m_isoview->m_BrushSize_y=1; - + m_view.m_isoview->m_BrushSize_x = 1; + m_view.m_isoview->m_BrushSize_y = 1; + } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_LOWERTILE; - + AD.mode = ACTIONMODE_LOWERTILE; + } -void CFinalSunDlg::OnTerrainRaisetile() +void CFinalSunDlg::OnTerrainRaisetile() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(AD.mode!=ACTIONMODE_HEIGHTENTILE) - { - m_settingsbar.m_BrushSize=0; + if (AD.mode != ACTIONMODE_HEIGHTENTILE) { + m_settingsbar.m_BrushSize = 0; m_settingsbar.UpdateData(FALSE); - m_view.m_isoview->m_BrushSize_x=1; - m_view.m_isoview->m_BrushSize_y=1; + m_view.m_isoview->m_BrushSize_x = 1; + m_view.m_isoview->m_BrushSize_y = 1; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_HEIGHTENTILE; - + AD.mode = ACTIONMODE_HEIGHTENTILE; + } -void CFinalSunDlg::OnTerrainFlatten() +void CFinalSunDlg::OnTerrainFlatten() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(AD.mode!=ACTIONMODE_FLATTENGROUND) - { - m_settingsbar.m_BrushSize=1; + if (AD.mode != ACTIONMODE_FLATTENGROUND) { + m_settingsbar.m_BrushSize = 1; m_settingsbar.UpdateData(FALSE); - m_view.m_isoview->m_BrushSize_x=2; - m_view.m_isoview->m_BrushSize_y=2; + m_view.m_isoview->m_BrushSize_x = 2; + m_view.m_isoview->m_BrushSize_y = 2; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_FLATTENGROUND; + AD.mode = ACTIONMODE_FLATTENGROUND; } -void CFinalSunDlg::OnTerrainCloak() +void CFinalSunDlg::OnTerrainCloak() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - AD.mode=ACTIONMODE_HIDETILESET; + AD.mode = ACTIONMODE_HIDETILESET; Sound(SOUND_POSITIVE); } -void CFinalSunDlg::OnTerrainShoweverytile() +void CFinalSunDlg::OnTerrainShoweverytile() { - if(!Map->GetIsoSize()) { + if (!Map->GetIsoSize()) { Sound(SOUND_NEGATIVE); return; } @@ -2879,16 +2750,15 @@ void CFinalSunDlg::OnTerrainShoweverytile() Sound(SOUND_POSITIVE); } -void CFinalSunDlg::OnTerrainShowallfields() +void CFinalSunDlg::OnTerrainShowallfields() { - if(!Map->GetIsoSize()) { + if (!Map->GetIsoSize()) { Sound(SOUND_NEGATIVE); return; } int idx; - for(idx=0;idxGetIsoSize()*Map->GetIsoSize();idx++) - { + for (idx = 0; idx < Map->GetIsoSize() * Map->GetIsoSize(); idx++) { Map->HideField(idx, FALSE); } @@ -2896,31 +2766,28 @@ void CFinalSunDlg::OnTerrainShowallfields() Sound(SOUND_POSITIVE); } -void CFinalSunDlg::OnTerrainHidefield() +void CFinalSunDlg::OnTerrainHidefield() { - if(!Map->GetIsoSize()) { + if (!Map->GetIsoSize()) { Sound(SOUND_NEGATIVE); return; } - AD.mode=ACTIONMODE_HIDEFIELD; + AD.mode = ACTIONMODE_HIDEFIELD; Sound(SOUND_POSITIVE); } -void CFinalSunDlg::OnEditTriggereditor() +void CFinalSunDlg::OnEditTriggereditor() { - if(m_triggereditor.m_hWnd==NULL) - { - if(!m_triggereditor.Create(CTriggerEditorDlg::IDD, NULL)) - { + if (m_triggereditor.m_hWnd == NULL) { + if (!m_triggereditor.Create(CTriggerEditorDlg::IDD, NULL)) { MessageBox(GetLanguageStringACP("Err_CreateErr"), "Error"); } } - if(m_triggereditor.m_hWnd!=NULL) - { + if (m_triggereditor.m_hWnd != NULL) { //m_all.UpdateStrings(); m_triggereditor.UpdateDialog(); m_triggereditor.ShowWindow(SW_SHOW); @@ -2928,110 +2795,96 @@ void CFinalSunDlg::OnEditTriggereditor() } } -void CFinalSunDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CFinalSunDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { - + CDialog::OnKeyDown(nChar, nRepCnt, nFlags); } -void CFinalSunDlg::OnMaptoolsChangemapheight() +void CFinalSunDlg::OnMaptoolsChangemapheight() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } Sound(SOUND_POSITIVE); - int vmin=-MAXHEIGHT; - int vmax=MAXHEIGHT; + int vmin = -MAXHEIGHT; + int vmax = MAXHEIGHT; - int isosize=Map->GetIsoSize(); - int mapsize=isosize*isosize; - int mapwidth=Map->GetWidth(); - int mapheight=Map->GetHeight(); - int max=Map->GetIsoSize()*Map->GetIsoSize(); + int isosize = Map->GetIsoSize(); + int mapsize = isosize * isosize; + int mapwidth = Map->GetWidth(); + int mapheight = Map->GetHeight(); + int max = Map->GetIsoSize() * Map->GetIsoSize(); int idx; - for(idx=0;idxmapwidth+mapheight*2 || (dwY+1>mapwidth && dwXmapwidth && dwY+mapwidthmapwidth+mapheight*2 || (dwY+2>mapwidth && dwX-2mapwidth && dwY+mapwidth-2mapwidth+mapheight*2 || (dwY+1>mapwidth && dwX-1mapwidth && dwY+mapwidth-1mapwidth + mapheight * 2 || (dwY + 1 > mapwidth && dwX - 1 < dwY - mapwidth) || (dwX + 1 > mapwidth && dwY + mapwidth - 1 < dwX)) { - } - else - { - int v=Map->GetHeightAt(idx); - if(v+vmin <0) - { - vmin=-v; + } else { + int v = Map->GetHeightAt(idx); + if (v + vmin < 0) { + vmin = -v; } - if(v+vmax>MAXHEIGHT) - { - vmax=MAXHEIGHT-v; + if (v + vmax > MAXHEIGHT) { + vmax = MAXHEIGHT - v; } } } - CString p=GetLanguageStringACP("StrChangeHeight"); + CString p = GetLanguageStringACP("StrChangeHeight"); char c[50]; itoa(vmin, c, 10); - p=TranslateStringVariables(1, p, c); + p = TranslateStringVariables(1, p, c); itoa(vmax, c, 10); - p=TranslateStringVariables(2, p, c); + p = TranslateStringVariables(2, p, c); - CString res=InputBox(p, + CString res = InputBox(p, GetLanguageStringACP("StrChangeHeightCap")); - - if(res.GetLength()<0) return; - int a=atoi(res); - if(a==0) return; - + if (res.GetLength() < 0) return; - - + int a = atoi(res); + if (a == 0) return; - for(idx=0;idxmapwidth+mapheight*2 || (dwY+1>mapwidth && dwXmapwidth && dwY+mapwidthmapwidth+mapheight*2 || (dwY+2>mapwidth && dwX-2mapwidth && dwY+mapwidth-2mapwidth+mapheight*2 || (dwY+1>mapwidth && dwX-1mapwidth && dwY+mapwidth-1mapwidth + mapheight * 2 || (dwY + 1 > mapwidth && dwX - 1 < dwY - mapwidth) || (dwX + 1 > mapwidth && dwY + mapwidth - 1 < dwX)) { - } - else - { - int v=Map->GetHeightAt(idx); - if(v+a <0 || v+a>MAXHEIGHT) - { + } else { + int v = Map->GetHeightAt(idx); + if (v + a <0 || v + a>MAXHEIGHT) { MessageBox(GetLanguageStringACP("StrChangeHeightErr"), GetLanguageStringACP("StrChangeHeightErrCap"), MB_ICONSTOP); return; } } } - for(idx=0;idxGetHeightAt(idx); - Map->SetHeightAt(idx, v+a); + for (idx = 0; idx < max; idx++) { + int v = Map->GetHeightAt(idx); + Map->SetHeightAt(idx, v + a); } this->m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } -void CFinalSunDlg::OnEditGlobalvariables() +void CFinalSunDlg::OnEditGlobalvariables() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } @@ -3052,10 +2905,9 @@ BOOL CFinalSunDlg::PreTranslateMessage(MSG* pMsg) return CDialog::PreTranslateMessage(pMsg); // CG: Dies wurde von der Komponente "QuickInfo" hinzugefügt. } -void CFinalSunDlg::OnEditUndo() +void CFinalSunDlg::OnEditUndo() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } @@ -3070,148 +2922,144 @@ void CFinalSunDlg::OnEditUndo() m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } -void CFinalSunDlg::OnHelpManual() +void CFinalSunDlg::OnHelpManual() { Sound(SOUND_POSITIVE); - if(ShellExecuteW(0, NULL, (utf8ToUtf16(AppPath)+L"\\HelpManual.pdf").c_str(), NULL, NULL, SW_NORMAL) == 0) - { - MessageBox((CString)"Could not open HelpManual.pdf! Try opening "+(CString)AppPath+(CString)"\\HelpManual manually."); + if (ShellExecuteW(0, NULL, (utf8ToUtf16(AppPath) + L"\\HelpManual.pdf").c_str(), NULL, NULL, SW_NORMAL) == 0) { + MessageBox((CString)"Could not open HelpManual.pdf! Try opening " + (CString)AppPath + (CString)"\\HelpManual manually."); } } LONG __stdcall ExceptionHandler( - _EXCEPTION_POINTERS *ExceptionInfo // address of - // exception info + _EXCEPTION_POINTERS* ExceptionInfo // address of + // exception info ) { CString s; CString s2; - CString s_add; + CString s_add; char adress[50]; char c[50]; itoa((std::ptrdiff_t)ExceptionInfo->ExceptionRecord->ExceptionAddress, adress, 16); - s="Unknown exception"; - switch(ExceptionInfo->ExceptionRecord->ExceptionCode) - { + s = "Unknown exception"; + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: - s="EXCEPTION_ACCESS_VIOLATION"; - s2="Thread did not have read or write access to the virtual address."; - if(ExceptionInfo->ExceptionRecord->ExceptionInformation[0]) - { - s_add="\nAdditional information: Write access to 0x"; - } - else - s_add="\nAdditional information: Read access from 0x"; - + s = "EXCEPTION_ACCESS_VIOLATION"; + s2 = "Thread did not have read or write access to the virtual address."; + if (ExceptionInfo->ExceptionRecord->ExceptionInformation[0]) { + s_add = "\nAdditional information: Write access to 0x"; + } else + s_add = "\nAdditional information: Read access from 0x"; + itoa(ExceptionInfo->ExceptionRecord->ExceptionInformation[1], c, 16); - s_add+=c; + s_add += c; break; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - s="EXCEPTION_ARRAY_BOUNDS_EXCEEDED"; - s2="Thread tried to access an array out of bounds."; + s = "EXCEPTION_ARRAY_BOUNDS_EXCEEDED"; + s2 = "Thread tried to access an array out of bounds."; break; - case EXCEPTION_BREAKPOINT : - s="EXCEPTION_BREAKPOINT"; - s2="Encountered breakpoint."; + case EXCEPTION_BREAKPOINT: + s = "EXCEPTION_BREAKPOINT"; + s2 = "Encountered breakpoint."; break; case EXCEPTION_DATATYPE_MISALIGNMENT: - s="EXCEPTION_DATATYPE_MISALIGNMENT"; - s2="Access to memory was misaligned for the given datatype."; + s = "EXCEPTION_DATATYPE_MISALIGNMENT"; + s2 = "Access to memory was misaligned for the given datatype."; break; case EXCEPTION_FLT_DENORMAL_OPERAND: - s="EXCEPTION_FLT_DENORMAL_OPERAND"; - s2="Denormal operand in floating point operation."; + s = "EXCEPTION_FLT_DENORMAL_OPERAND"; + s2 = "Denormal operand in floating point operation."; break; case EXCEPTION_FLT_DIVIDE_BY_ZERO: - s="EXCEPTION_FLT_DIVIDE_BY_ZERO"; - s2="Thread divided by zero in a floating point operation."; + s = "EXCEPTION_FLT_DIVIDE_BY_ZERO"; + s2 = "Thread divided by zero in a floating point operation."; break; - case EXCEPTION_FLT_INEXACT_RESULT : - s="EXCEPTION_FLT_INEXACT_RESULT"; - s2="Floating point operation result not representable with exact decimal fraction."; + case EXCEPTION_FLT_INEXACT_RESULT: + s = "EXCEPTION_FLT_INEXACT_RESULT"; + s2 = "Floating point operation result not representable with exact decimal fraction."; break; case EXCEPTION_FLT_INVALID_OPERATION: - s="EXCEPTION_FLT_INVALID_OPERATION"; - s2="Invalid floating point operation."; + s = "EXCEPTION_FLT_INVALID_OPERATION"; + s2 = "Invalid floating point operation."; break; - case EXCEPTION_FLT_OVERFLOW : - s="EXCEPTION_FLT_OVERFLOW"; - s2="Floating point overflow error."; + case EXCEPTION_FLT_OVERFLOW: + s = "EXCEPTION_FLT_OVERFLOW"; + s2 = "Floating point overflow error."; break; - case EXCEPTION_FLT_STACK_CHECK : - s="EXCEPTION_FLT_STACK_CHECK"; - s2="Floating point operation caused stack overflow or underflow."; + case EXCEPTION_FLT_STACK_CHECK: + s = "EXCEPTION_FLT_STACK_CHECK"; + s2 = "Floating point operation caused stack overflow or underflow."; break; case EXCEPTION_FLT_UNDERFLOW: - s="EXCEPTION_FLT_UNDERFLOW"; - s2="Floating point underflow error."; + s = "EXCEPTION_FLT_UNDERFLOW"; + s2 = "Floating point underflow error."; break; case EXCEPTION_ILLEGAL_INSTRUCTION: - s="EXCEPTION_ILLEGAL_INSTRUCTION"; - s2="Thread executed illegal instruction."; + s = "EXCEPTION_ILLEGAL_INSTRUCTION"; + s2 = "Thread executed illegal instruction."; break; case EXCEPTION_IN_PAGE_ERROR: - s="EXCEPTION_IN_PAGE_ERROR"; - s2="Thread tried to access a page that could not be retrieved by the system."; + s = "EXCEPTION_IN_PAGE_ERROR"; + s2 = "Thread tried to access a page that could not be retrieved by the system."; break; case EXCEPTION_INT_DIVIDE_BY_ZERO: - s="EXCEPTION_INT_DIVIDE_BY_ZERO"; - s2="Thread divided by zero in an integer operation."; + s = "EXCEPTION_INT_DIVIDE_BY_ZERO"; + s2 = "Thread divided by zero in an integer operation."; break; case EXCEPTION_INT_OVERFLOW: - s="EXCEPTION_INT_OVERFLOW"; - s2="Integer operation caused overflow."; + s = "EXCEPTION_INT_OVERFLOW"; + s2 = "Integer operation caused overflow."; break; case EXCEPTION_INVALID_DISPOSITION: - s="EXCEPTION_INVALID_DISPOSITION"; - s2="Exception handler returned invalid disposition."; + s = "EXCEPTION_INVALID_DISPOSITION"; + s2 = "Exception handler returned invalid disposition."; break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: - s="EXCEPTION_NONCONTINUABLE_EXCEPTION"; - s2="Cannot continue execution after a noncontinuable exception."; + s = "EXCEPTION_NONCONTINUABLE_EXCEPTION"; + s2 = "Cannot continue execution after a noncontinuable exception."; break; - case EXCEPTION_PRIV_INSTRUCTION : - s="EXCEPTION_PRIV_INSTRUCTION"; - s2="Instruction not valid in the current machine mode."; + case EXCEPTION_PRIV_INSTRUCTION: + s = "EXCEPTION_PRIV_INSTRUCTION"; + s2 = "Instruction not valid in the current machine mode."; break; case EXCEPTION_SINGLE_STEP: - s="EXCEPTION_SINGLE_STEP"; - s2="Instruction step has been executed."; + s = "EXCEPTION_SINGLE_STEP"; + s2 = "Instruction step has been executed."; break; case EXCEPTION_STACK_OVERFLOW: - s="EXCEPTION_STACK_OVERFLOW"; - s2="Stack overflow."; + s = "EXCEPTION_STACK_OVERFLOW"; + s2 = "Stack overflow."; } CString s3; #ifdef TS_MODE - s3="INTERNAL APPLICATION ERROR\n\nApplication will now try to free memory, save the current map as \"fcrash_backup.map\" in the FinalSun directory and quit.\n\n\n"; + s3 = "INTERNAL APPLICATION ERROR\n\nApplication will now try to free memory, save the current map as \"fcrash_backup.map\" in the FinalSun directory and quit.\n\n\n"; #else // RA2_MODE - s3="INTERNAL APPLICATION ERROR\n\nApplication will now try to free memory, save the current map as \"fcrash_backup.map\" in the FinalAlert 2 directory and quit.\n\n\n"; + s3 = "INTERNAL APPLICATION ERROR\n\nApplication will now try to free memory, save the current map as \"fcrash_backup.map\" in the FinalAlert 2 directory and quit.\n\n\n"; #endif - s3+="Important: If this error has occured while loading graphics, it can very often be fixed by using another system color resolution (16, 24 or 32 bit)."; + s3 += "Important: If this error has occured while loading graphics, it can very often be fixed by using another system color resolution (16, 24 or 32 bit)."; - s3+="\n\nThe following information is available, please note every line below:\n\n"; - s3+="Last succeeded operation: "; - itoa(last_succeeded_operation,c,10); - s3+=c; - s3+=""; - s3+="\nLast library operation: "; - itoa(FSunPackLib::last_succeeded_operation,c,10); - s3+=c; - s3+="\n"; - s3+="\nException data:\n"; - s3+=s; - s3+="\n"; - s3+=s2; - s3+="\nAt address: "; - s3+=adress; - s3+=s_add; + s3 += "\n\nThe following information is available, please note every line below:\n\n"; + s3 += "Last succeeded operation: "; + itoa(last_succeeded_operation, c, 10); + s3 += c; + s3 += ""; + s3 += "\nLast library operation: "; + itoa(FSunPackLib::last_succeeded_operation, c, 10); + s3 += c; + s3 += "\n"; + s3 += "\nException data:\n"; + s3 += s; + s3 += "\n"; + s3 += s2; + s3 += "\nAt address: "; + s3 += adress; + s3 += s_add; errstream << "Exception occured. Current data:" << endl; @@ -3220,17 +3068,16 @@ LONG __stdcall ExceptionHandler( errstream << "Trying to save current map" << endl; errstream.flush(); - - if(MessageBox(0,s3,"Fatal error",MB_OKCANCEL)==IDOK) - { + + if (MessageBox(0, s3, "Fatal error", MB_OKCANCEL) == IDOK) { return EXCEPTION_CONTINUE_EXECUTION; } - std::string file=u8AppDataPath; - file+="\\fcrash_backup.map"; + std::string file = u8AppDataPath; + file += "\\fcrash_backup.map"; ((CFinalSunDlg*)theApp.m_pMainWnd)->SaveMap(file.c_str()); - + theApp.m_loading->FreeAll(); rules.Clear(); @@ -3254,18 +3101,17 @@ LONG __stdcall ExceptionHandler( INT_PTR CFinalSunDlg::DoModal() { - int res=0; + int res = 0; SetUnhandledExceptionFilter(ExceptionHandler); - res=CDialog::DoModal(); + res = CDialog::DoModal(); return res; } -void CFinalSunDlg::OnMaptoolsAutolevel() +void CFinalSunDlg::OnMaptoolsAutolevel() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } @@ -3273,256 +3119,250 @@ void CFinalSunDlg::OnMaptoolsAutolevel() Sound(SOUND_POSITIVE); MessageBox("This tool will try to automatically raise the terrain using the cliffs.\nIt may take some seconds to execute, as there are masses of data to handle.\nAfter this, you should check your map if everything looks fine. If not, you should use the different height tools, especially flatten ground, to fix any errors. You can use Edit->Undo to undo anything that has been done by using this function.", "Auto Leveler"); - m_view.m_isoview->AutoLevel(); + m_view.m_isoview->AutoLevel(); } -void CFinalSunDlg::OnUpdateEditAitriggerenabling(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditAitriggerenabling(CCmdUI* pCmdUI) { - - /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); + + /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE);*/ } -void CFinalSunDlg::OnUpdateEditAitriggers(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditAitriggers(CCmdUI* pCmdUI) { - /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); + /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE);*/ } -void CFinalSunDlg::OnUpdateEditBasicsettings(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditBasicsettings(CCmdUI* pCmdUI) { - /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); + /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE);*/ } -void CFinalSunDlg::OnUpdateEditGlobalvariables(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditGlobalvariables(CCmdUI* pCmdUI) { - /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); + /*if(Map->GetIsoSize()==0) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE);*/ } -void CFinalSunDlg::OnUpdateEditHouses(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditHouses(CCmdUI* pCmdUI) { CheckAvail(pCmdUI); } -void CFinalSunDlg::OnUpdateEditIniediting(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditIniediting(CCmdUI* pCmdUI) { - + CheckAvail(pCmdUI); - + } -void CFinalSunDlg::OnUpdateEditLighting(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditLighting(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditMap(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditMap(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditScripts(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditScripts(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditSingleplayersettings(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditSingleplayersettings(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditSpecialflags(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditSpecialflags(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditTags(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditTags(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditTaskforces(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditTaskforces(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditTeams(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditTeams(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditTriggereditor(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditTriggereditor(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditTriggers(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditTriggers(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateEditUndo(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateEditUndo(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateFileSave(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateFileSave(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateFileSaveas(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateFileSaveas(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateFileValidatemap(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateFileValidatemap(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateMaptoolsAutolevel(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateMaptoolsAutolevel(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateMaptoolsChangemapheight(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateMaptoolsChangemapheight(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateOptionsShowminimap(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateOptionsShowminimap(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainCloak(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainCloak(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainFlatten(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainFlatten(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainHeightenground(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainHeightenground(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainHidefield(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainHidefield(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainLowerground(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainLowerground(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainLowertile(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainLowertile(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainRaisetile(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainRaisetile(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainShowallfields(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainShowallfields(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnUpdateTerrainShoweverytile(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateTerrainShoweverytile(CCmdUI* pCmdUI) { // TODO: Code für die Befehlsbehandlungsroutine zum Aktualisieren der Benutzeroberfläche hier einfügen - + } -void CFinalSunDlg::OnMaptoolsFrontcliff() +void CFinalSunDlg::OnMaptoolsFrontcliff() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(Map->GetTheater()==THEATER4) - { + if (Map->GetTheater() == THEATER4) { MessageBox("There are no cliffs in the Lunar theater"); return; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_CLIFFFRONT; + AD.mode = ACTIONMODE_CLIFFFRONT; } -void CFinalSunDlg::OnMaptoolsBackcliff() +void CFinalSunDlg::OnMaptoolsBackcliff() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } - if(Map->GetTheater()==THEATER4) - { + if (Map->GetTheater() == THEATER4) { MessageBox("There are no cliffs in the Lunar theater"); return; } Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_CLIFFBACK; + AD.mode = ACTIONMODE_CLIFFBACK; } -void CFinalSunDlg::OnEditRedo() +void CFinalSunDlg::OnEditRedo() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } Sound(SOUND_POSITIVE); - Map->Redo(); - + Map->Redo(); + m_view.m_isoview->SendMessage(WM_RBUTTONUP); m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } -void CFinalSunDlg::OnMaptoolsAutocreateshores() +void CFinalSunDlg::OnMaptoolsAutocreateshores() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } @@ -3531,38 +3371,38 @@ void CFinalSunDlg::OnMaptoolsAutocreateshores() Map->TakeSnapshot(); - Map->CreateShore(0,0,Map->GetIsoSize(), Map->GetIsoSize()); + Map->CreateShore(0, 0, Map->GetIsoSize(), Map->GetIsoSize()); m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); Map->TakeSnapshot(); Map->Undo(); - + } -void CFinalSunDlg::OnOptionsDisableautoshore() +void CFinalSunDlg::OnOptionsDisableautoshore() { CIniFile Options; - Options.LoadFile(u8AppDataPath+"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_DISABLEAUTOSHORE, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLEAUTOSHORE, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bDisableAutoShore=FALSE; + theApp.m_Options.bDisableAutoShore = FALSE; Options.SetBool("UserInterface", "DisableAutoShore", false); } else { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLEAUTOSHORE, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bDisableAutoShore=TRUE; + theApp.m_Options.bDisableAutoShore = TRUE; Options.SetBool("UserInterface", "DisableAutoShore", true); } - + #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath+"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif } @@ -3626,90 +3466,89 @@ void CFinalSunDlg::OnOptionsDisableautoshore() //DEL // Kein Aufruf von CDialog::OnNcPaint() für Zeichnungsnachrichten //DEL } -void CFinalSunDlg::OnOptionsDisableautolat() +void CFinalSunDlg::OnOptionsDisableautolat() { CIniFile Options; - Options.LoadFile(u8AppDataPath+"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_DISABLEAUTOLAT, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLEAUTOLAT, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bDisableAutoLat=FALSE; + theApp.m_Options.bDisableAutoLat = FALSE; Options.SetBool("UserInterface", "DisableAutoLat", false); } else { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLEAUTOLAT, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bDisableAutoLat=TRUE; + theApp.m_Options.bDisableAutoLat = TRUE; Options.SetBool("UserInterface", "DisableAutoLat", true); } - + #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath+"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif } -void CFinalSunDlg::OnEditPaste() +void CFinalSunDlg::OnEditPaste() { Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_PASTE; - AD.z_data=0; + AD.mode = ACTIONMODE_PASTE; + AD.z_data = 0; } -void CFinalSunDlg::OnEditCopy() +void CFinalSunDlg::OnEditCopy() { Sound(SOUND_POSITIVE); - AD.mode=ACTIONMODE_COPY; + AD.mode = ACTIONMODE_COPY; } -void CFinalSunDlg::OnEditCopywholemap() +void CFinalSunDlg::OnEditCopywholemap() { Sound(SOUND_POSITIVE); - Map->Copy(); + Map->Copy(); } -void CFinalSunDlg::OnEditPastewholemap() +void CFinalSunDlg::OnEditPastewholemap() { Sound(SOUND_POSITIVE); - Map->Paste(Map->GetIsoSize()/2,Map->GetIsoSize()/2,0); + Map->Paste(Map->GetIsoSize() / 2, Map->GetIsoSize() / 2, 0); m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } -void CFinalSunDlg::OnMarblemadness() +void CFinalSunDlg::OnMarblemadness() { - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { Sound(SOUND_NEGATIVE); return; } Sound(SOUND_POSITIVE); - theApp.m_Options.bMarbleMadness=! theApp.m_Options.bMarbleMadness; + theApp.m_Options.bMarbleMadness = !theApp.m_Options.bMarbleMadness; m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); m_view.m_browser->m_view.SetTileSet(m_view.m_browser->m_view.m_currentTileSet, TRUE); } -void CFinalSunDlg::CheckAvail(CCmdUI *pCmdUI) +void CFinalSunDlg::CheckAvail(CCmdUI* pCmdUI) { - /*if(Map->GetIsoSize()==0) + /*if(Map->GetIsoSize()==0) { - pCmdUI->Enable(FALSE); + pCmdUI->Enable(FALSE); if(pCmdUI->m_pMenu) { pCmdUI->m_pMenu->DeleteMenu(pCmdUI->m_nIndex, MF_BYPOSITION); } } - else + else { pCmdUI->Enable(TRUE); - + if(pCmdUI->m_pMenu) { pCmdUI->m_pMenu->ModifyMenu(pCmdUI->m_nID, MF_BYCOMMAND | MF_ENABLED); @@ -3717,132 +3556,129 @@ void CFinalSunDlg::CheckAvail(CCmdUI *pCmdUI) }*/ } -void CFinalSunDlg::OnOptionsSounds() +void CFinalSunDlg::OnOptionsSounds() { CIniFile Options; - Options.LoadFile(u8AppDataPath+"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_SOUNDS, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_SOUNDS, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bNoSounds=TRUE; + theApp.m_Options.bNoSounds = TRUE; Options.SetBool("UserInterface", "Sounds", false); - } - else { + } else { GetMenu()->CheckMenuItem(ID_OPTIONS_SOUNDS, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bNoSounds=FALSE; + theApp.m_Options.bNoSounds = FALSE; Options.SetBool("UserInterface", "Sounds", true); } - + #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath+"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif } -void CFinalSunDlg::OnUpdateOptionsSounds(CCmdUI* pCmdUI) +void CFinalSunDlg::OnUpdateOptionsSounds(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.m_Options.bNoSounds ? 0 : 1); + pCmdUI->SetCheck(theApp.m_Options.bNoSounds ? 0 : 1); } -void CFinalSunDlg::OnOptionsDisableslopecorrection() +void CFinalSunDlg::OnOptionsDisableslopecorrection() { CIniFile Options; - Options.LoadFile(u8AppDataPath +"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath +"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_DISABLESLOPECORRECTION, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLESLOPECORRECTION, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bDisableSlopeCorrection=FALSE; + theApp.m_Options.bDisableSlopeCorrection = FALSE; Options.SetBool("UserInterface", "DisableSlopeCorrection", false); } else { GetMenu()->CheckMenuItem(ID_OPTIONS_DISABLESLOPECORRECTION, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bDisableSlopeCorrection=TRUE; + theApp.m_Options.bDisableSlopeCorrection = TRUE; Options.SetBool("UserInterface", "DisableSlopeCorrection", true); } #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath+"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif } -void CFinalSunDlg::OnOptionsShowbuildingoutline() +void CFinalSunDlg::OnOptionsShowbuildingoutline() { - + CIniFile Options; - Options.LoadFile(u8AppDataPath+"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath+"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif if (GetMenu()->GetMenuState(ID_OPTIONS_SHOWBUILDINGOUTLINE, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_SHOWBUILDINGOUTLINE, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.bShowCells=FALSE; + theApp.m_Options.bShowCells = FALSE; Options.SetBool("UserInterface", "ShowBuildingCells", false); } else { GetMenu()->CheckMenuItem(ID_OPTIONS_SHOWBUILDINGOUTLINE, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.bShowCells=TRUE; + theApp.m_Options.bShowCells = TRUE; Options.SetBool("UserInterface", "ShowBuildingCells", true); } m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath +"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath +"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif } -void CFinalSunDlg::OnFileFile1() +void CFinalSunDlg::OnFileFile1() { - if(DoesFileExist(theApp.m_Options.prev_maps[0])) OpenMap(theApp.m_Options.prev_maps[0]); - + if (DoesFileExist(theApp.m_Options.prev_maps[0])) OpenMap(theApp.m_Options.prev_maps[0]); + } -void CFinalSunDlg::OnFileFile2() +void CFinalSunDlg::OnFileFile2() { - if(DoesFileExist(theApp.m_Options.prev_maps[1])) OpenMap(theApp.m_Options.prev_maps[1]); - + if (DoesFileExist(theApp.m_Options.prev_maps[1])) OpenMap(theApp.m_Options.prev_maps[1]); + } -void CFinalSunDlg::OnFileFile3() +void CFinalSunDlg::OnFileFile3() { - if(DoesFileExist(theApp.m_Options.prev_maps[2])) OpenMap(theApp.m_Options.prev_maps[2]); - + if (DoesFileExist(theApp.m_Options.prev_maps[2])) OpenMap(theApp.m_Options.prev_maps[2]); + } -void CFinalSunDlg::OnFileFile4() +void CFinalSunDlg::OnFileFile4() { - if(DoesFileExist(theApp.m_Options.prev_maps[3])) OpenMap(theApp.m_Options.prev_maps[3]); - + if (DoesFileExist(theApp.m_Options.prev_maps[3])) OpenMap(theApp.m_Options.prev_maps[3]); + } // MW 07/20/01: Checks if file already exists in prev. files list. If not, adds it (may delete old ones) void CFinalSunDlg::InsertPrevFile(CString lpFilename) { int idx; - + //int free_at=-1; - for(idx=0;idx<4;idx++) - { - CString f=theApp.m_Options.prev_maps[idx]; - CString f2=lpFilename; + for (idx = 0; idx < 4; idx++) { + CString f = theApp.m_Options.prev_maps[idx]; + CString f2 = lpFilename; f2.MakeLower(); f.MakeLower(); - if(f==f2) - { + if (f == f2) { return; } @@ -3856,43 +3692,43 @@ void CFinalSunDlg::InsertPrevFile(CString lpFilename) } CIniFile Options; - Options.LoadFile(u8AppDataPath +"\\FinalSun.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalSun.ini"); #ifdef RA2_MODE - Options.LoadFile(u8AppDataPath +"\\FinalAlert.ini"); + Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif - + for (idx = 3; idx > 0; idx--) { - theApp.m_Options.prev_maps[idx]=theApp.m_Options.prev_maps[idx-1]; + theApp.m_Options.prev_maps[idx] = theApp.m_Options.prev_maps[idx - 1]; char e[10]; itoa(idx, e, 10); Options.SetString("Files", e, theApp.m_Options.prev_maps[idx]); } - theApp.m_Options.prev_maps[0]=lpFilename; + theApp.m_Options.prev_maps[0] = lpFilename; Options.SetString("Files", "0", theApp.m_Options.prev_maps[0]); #ifndef RA2_MODE - Options.SaveFile(u8AppDataPath +"\\FinalSun.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalSun.ini"); #else - Options.SaveFile(u8AppDataPath +"\\FinalAlert.ini"); + Options.SaveFile(u8AppDataPath + "\\FinalAlert.ini"); #endif - UpdateStrings(); + UpdateStrings(); } // MW 07/20/01: New: for files clicked in the file list... copied from OnFileOpenmap(); void CFinalSunDlg::OpenMap(LPCSTR lpFilename) { - CString r=GetLanguageStringACP("SAVEDLG_FILETYPES"); - r=TranslateStringVariables(8, r, ";"); + CString r = GetLanguageStringACP("SAVEDLG_FILETYPES"); + r = TranslateStringVariables(8, r, ";"); //CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, r); char cuPath[MAX_PATH]; @@ -3907,56 +3743,54 @@ void CFinalSunDlg::OpenMap(LPCSTR lpFilename) m_PKTHeader.Clear(); - CString fileToOpen=lpFilename;//dlg.GetPathName(); - fileToOpen.MakeLower(); - CString ext=fileToOpen.Right(fileToOpen.GetLength()-fileToOpen.ReverseFind('.')-1); //dlg.GetFileExt(); - + CString fileToOpen = lpFilename;//dlg.GetPathName(); + fileToOpen.MakeLower(); + CString ext = fileToOpen.Right(fileToOpen.GetLength() - fileToOpen.ReverseFind('.') - 1); //dlg.GetFileExt(); + ext.MakeLower(); - BOOL bLoadedFromMMX=FALSE; - if(ext=="mmx") - { - HMIXFILE hMix=FSunPackLib::XCC_OpenMix(fileToOpen, NULL); + BOOL bLoadedFromMMX = FALSE; + if (ext == "mmx") { + HMIXFILE hMix = FSunPackLib::XCC_OpenMix(fileToOpen, NULL); fileToOpen.Replace(".mmx", ".map"); - if(fileToOpen.ReverseFind('\\')>=0) fileToOpen=fileToOpen.Right(fileToOpen.GetLength()-fileToOpen.ReverseFind('\\')-1); + if (fileToOpen.ReverseFind('\\') >= 0) fileToOpen = fileToOpen.Right(fileToOpen.GetLength() - fileToOpen.ReverseFind('\\') - 1); - CString extractFile=u8AppDataPath.c_str(); - CString pktFile=fileToOpen; + CString extractFile = u8AppDataPath.c_str(); + CString pktFile = fileToOpen; pktFile.Replace(".map", ".pkt"); - extractFile+="\\mmx_tmp.pkt"; - + extractFile += "\\mmx_tmp.pkt"; + FSunPackLib::XCC_ExtractFile(pktFile, extractFile, hMix); m_PKTHeader.LoadFile(extractFile, TRUE); fileToOpen = m_PKTHeader.GetString("MultiMaps", "1") + ".map"; - - extractFile=u8AppDataPath.c_str(); - extractFile+="\\mmx_tmp.map"; + + extractFile = u8AppDataPath.c_str(); + extractFile += "\\mmx_tmp.map"; FSunPackLib::XCC_ExtractFile(fileToOpen, extractFile, hMix); - fileToOpen=extractFile; - - - + fileToOpen = extractFile; + + + FSunPackLib::XCC_CloseMix(hMix); - bLoadedFromMMX=TRUE; + bLoadedFromMMX = TRUE; } CIniFile f; f.InsertFile(fileToOpen, "Map"); auto const& theaterType = f.GetString("Map", "Theater"); - if((theaterType ==THEATER0 && theApp.m_Options.bDoNotLoadTemperateGraphics) || (theaterType ==THEATER1 && theApp.m_Options.bDoNotLoadSnowGraphics)) - { + if ((theaterType == THEATER0 && theApp.m_Options.bDoNotLoadTemperateGraphics) || (theaterType == THEATER1 && theApp.m_Options.bDoNotLoadSnowGraphics)) { MessageBox("You have selected to don´t show temperate or snow theater, but this map uses this theater. You cannot load it without restarting FinalSun/FinalAlert 2 with this theater enabled.", "Error"); return; } - bNoDraw=TRUE; + bNoDraw = TRUE; CString str = GetLanguageStringACP("MainDialogCaption"); - str+=" ("; - str+=(char*)(LPCTSTR)lpFilename; - str+=")"; + str += " ("; + str += (char*)(LPCTSTR)lpFilename; + str += ")"; // MW 07/20/01: Update prev. files InsertPrevFile(lpFilename); @@ -3968,40 +3802,31 @@ void CFinalSunDlg::OpenMap(LPCSTR lpFilename) errstream << "Map->LoadMap() will be called" << endl; errstream.flush(); - + Map->LoadMap((char*)(LPCTSTR)fileToOpen); - - BOOL bNoMapFile=FALSE; - if(!Map->CheckMapPackData()) - { - int res=MessageBox("This map seems to be corrupt. Do you want to try repairing it? If you click cancel, a empty map will be created, if you click no, it will load the map as it is","Corrupt", MB_YESNOCANCEL); - if(res==IDCANCEL) - { - Map->CreateMap(32,32,THEATER0,0); - bNoMapFile=TRUE; - } - else - { - if(res==IDYES) // try repair + + BOOL bNoMapFile = FALSE; + if (!Map->CheckMapPackData()) { + int res = MessageBox("This map seems to be corrupt. Do you want to try repairing it? If you click cancel, a empty map will be created, if you click no, it will load the map as it is", "Corrupt", MB_YESNOCANCEL); + if (res == IDCANCEL) { + Map->CreateMap(32, 32, THEATER0, 0); + bNoMapFile = TRUE; + } else { + if (res == IDYES) // try repair { - int fielddata_size=Map->GetIsoSize()*Map->GetIsoSize(); + int fielddata_size = Map->GetIsoSize() * Map->GetIsoSize(); int idx; - for(idx=0;idxGetFielddataAt(idx)->wGround; - if(gr==0xFFFF) gr=0; - - if(gr>=(*tiledata_count)) - { - Map->SetTileAt(idx, 0, 0); - } - else - { - if((*tiledata)[gr].wTileCount<=Map->GetFielddataAt(idx)->bSubTile) - { + for (idx = 0; idx < fielddata_size; idx++) { + int gr = Map->GetFielddataAt(idx)->wGround; + if (gr == 0xFFFF) gr = 0; + + if (gr >= (*tiledata_count)) { + Map->SetTileAt(idx, 0, 0); + } else { + if ((*tiledata)[gr].wTileCount <= Map->GetFielddataAt(idx)->bSubTile) { Map->SetTileAt(idx, 0, 0); } } @@ -4010,16 +3835,13 @@ void CFinalSunDlg::OpenMap(LPCSTR lpFilename) } } } - - if(!bNoMapFile) - { - if(bLoadedFromMMX) - { + + if (!bNoMapFile) { + if (bLoadedFromMMX) { //currentMapFile[0]=0; strcpy(currentMapFile, lpFilename); - } - else - strcpy(currentMapFile, fileToOpen); + } else + strcpy(currentMapFile, fileToOpen); } Sleep(200); @@ -4027,43 +3849,42 @@ void CFinalSunDlg::OpenMap(LPCSTR lpFilename) SetCursor(m_hArrowCursor); - bNoDraw=FALSE; + bNoDraw = FALSE; m_view.m_isoview->UpdateDialog(TRUE); UpdateDialogs(); } -void CFinalSunDlg::OnMaptoolsSearchwaypoint() +void CFinalSunDlg::OnMaptoolsSearchwaypoint() { - if(Map->GetIsoSize()==0) return; + if (Map->GetIsoSize() == 0) return; CSearchWaypointDlg dlg; - if(dlg.DoModal()==IDCANCEL) return; - if(dlg.m_WaypointIndex<0) return; + if (dlg.DoModal() == IDCANCEL) return; + if (dlg.m_WaypointIndex < 0) return; m_view.m_isoview->FocusWaypoint(dlg.m_WaypointIndex); } -void CFinalSunDlg::OnMaptoolsToolscripts() +void CFinalSunDlg::OnMaptoolsToolscripts() { - if(Map->GetIsoSize()==0) return; + if (Map->GetIsoSize() == 0) return; CUserScriptsDlg dlg; dlg.DoModal(); - + } void CFinalSunDlg::OnHelpShowlogs() { // TODO: Fügen Sie hier Ihren Befehlshandlercode ein. - + Sound(SOUND_POSITIVE); errstream.flush(); auto f = utf8ToUtf16(theApp.getLogFileName()); - if (ShellExecuteW(0, NULL, f.c_str(), NULL, NULL, SW_NORMAL) == 0) - { + if (ShellExecuteW(0, NULL, f.c_str(), NULL, NULL, SW_NORMAL) == 0) { MessageBoxW(nullptr, (std::wstring(L"Could not open log! Try opening ") + f + L" manually").c_str(), L"Cannot open log", MB_ICONEXCLAMATION); } } @@ -4079,11 +3900,11 @@ void CFinalSunDlg::OnOptionsSmoothzoom() if (GetMenu()->GetMenuState(ID_OPTIONS_SMOOTHZOOM, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_SMOOTHZOOM, MF_BYCOMMAND | MF_UNCHECKED); - theApp.m_Options.viewScaleUseSteps = true; + theApp.m_Options.viewScaleUseSteps = true; } else { GetMenu()->CheckMenuItem(ID_OPTIONS_SMOOTHZOOM, MF_BYCOMMAND | MF_CHECKED); - theApp.m_Options.viewScaleUseSteps = false; - } + theApp.m_Options.viewScaleUseSteps = false; + } Options.SetBool("UserInterface", "ViewScaleUseSteps", theApp.m_Options.viewScaleUseSteps); @@ -4112,14 +3933,11 @@ void CFinalSunDlg::OnOptionsUsedefaultmousecursor() Options.LoadFile(u8AppDataPath + "\\FinalAlert.ini"); #endif - if (GetMenu()->GetMenuState(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND) & MF_CHECKED) - { + if (GetMenu()->GetMenuState(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND) & MF_CHECKED) { GetMenu()->CheckMenuItem(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND | MF_UNCHECKED); theApp.m_Options.useDefaultMouseCursor = false; m_hArrowCursor = m_hGameCursor; - } - else - { + } else { GetMenu()->CheckMenuItem(ID_OPTIONS_USEDEFAULTMOUSECURSOR, MF_BYCOMMAND | MF_CHECKED); theApp.m_Options.useDefaultMouseCursor = true; m_hArrowCursor = LoadCursor(NULL, IDC_ARROW); diff --git a/MissionEditor/FinalSunDlg.h b/MissionEditor/FinalSunDlg.h index 54bbb4c..27aa1e1 100644 --- a/MissionEditor/FinalSunDlg.h +++ b/MissionEditor/FinalSunDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // @@ -58,7 +58,7 @@ class CLoading; class CFinalSunDlg : public CDialog { -// Konstruktion + // Konstruktion public: void OpenMap(LPCSTR lpFilename); void InsertPrevFile(CString lpFilename); @@ -69,7 +69,7 @@ public: CToolBar m_clifftoolbar; CToolBar m_terraintoolbar; CToolBar m_maintoolbar; - CToolSettingsBar m_settingsbar; + CToolSettingsBar m_settingsbar; CReBarCtrl m_bar; void HideAllDialogs(); CSingleplayerSettings m_singleplayersettings; @@ -92,10 +92,10 @@ public: CMyViewFrame m_view; CSpecialFlags m_specialflags; CLighting m_lighting; - void UpdateDialogs(BOOL bOnlyMissionControl=FALSE, BOOL bNoRepos=FALSE); + void UpdateDialogs(BOOL bOnlyMissionControl = FALSE, BOOL bNoRepos = FALSE); CAll m_all; CBasic m_basic; - CMapD m_map; + CMapD m_map; CIniFile m_PKTHeader; CFinalSunDlg(CWnd* pParent = NULL); // Standard-Konstruktor @@ -107,10 +107,10 @@ public: // Vom Klassenassistenten generierte Überladungen virtueller Funktionen //{{AFX_VIRTUAL(CFinalSunDlg) - public: +public: virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult); virtual INT_PTR DoModal(); - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); //}}AFX_VIRTUAL @@ -236,9 +236,9 @@ protected: DECLARE_MESSAGE_MAP() private: void UnloadAll(); - + HCURSOR m_hGameCursor; - + public: afx_msg void OnHelpShowlogs(); afx_msg void OnOptionsSmoothzoom(); diff --git a/MissionEditor/FloatEdit.cpp b/MissionEditor/FloatEdit.cpp index e722aaf..34b1568 100644 --- a/MissionEditor/FloatEdit.cpp +++ b/MissionEditor/FloatEdit.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // @@ -59,44 +59,42 @@ END_MESSAGE_MAP() -void CFloatEdit::OnKillfocus() +void CFloatEdit::OnKillfocus() { // okay, we need to convert it to a float CString text, originaltext; GetWindowText(text); - originaltext=text; + originaltext = text; - if(strlen(text)<1) - { + if (strlen(text) < 1) { //SetWindowText("0.000000"); return; } - - double res=atof(text); - int c,d; - char* j=_fcvt(res, 6, &c, &d); - - int i, slen=strlen(j); + + double res = atof(text); + int c, d; + char* j = _fcvt(res, 6, &c, &d); + + int i, slen = strlen(j); char j2[50]; - for(i=0;i<6-slen;i++) - { - strcpy(j2, j+i); - j[i]=0; + for (i = 0; i < 6 - slen; i++) { + strcpy(j2, j + i); + j[i] = 0; strcat(j, "0"); - strcat(j,j2); + strcat(j, j2); } - if(j==NULL) return; + if (j == NULL) return; //MessageBox(j,text); - text=j; + text = j; text.Insert(c, "."); - + //MessageBox(text); - if(strchr(text, '.')==text) text.Insert(0, "0"); + if (strchr(text, '.') == text) text.Insert(0, "0"); //delete[](j); - if(originaltext==text) return; + if (originaltext == text) return; SetWindowText(text); } diff --git a/MissionEditor/FloatEdit.h b/MissionEditor/FloatEdit.h index ef315bf..5000fd6 100644 --- a/MissionEditor/FloatEdit.h +++ b/MissionEditor/FloatEdit.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_FLOATEDIT_H__D0F98066_6E8E_11D3_99E1_D18E6230AA05__INCLUDED_) @@ -32,22 +32,22 @@ class CFloatEdit : public CEdit { -// Konstruktion + // Konstruktion public: CFloatEdit(); -// Attribute + // Attribute public: -// Operationen + // Operationen public: -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CFloatEdit) - //}}AFX_VIRTUAL + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CFloatEdit) + //}}AFX_VIRTUAL -// Implementierung + // Implementierung public: virtual ~CFloatEdit(); diff --git a/MissionEditor/FrontCliffModifier.cpp b/MissionEditor/FrontCliffModifier.cpp index b195d88..b1d9c2a 100644 --- a/MissionEditor/FrontCliffModifier.cpp +++ b/MissionEditor/FrontCliffModifier.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // FrontCliffModifier.cpp: Implementierung der Klasse CFrontCliffModifier. @@ -30,7 +30,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif @@ -52,43 +52,36 @@ CFrontCliffModifier::~CFrontCliffModifier() -void CFrontCliffModifier::ModifyStartPos(DWORD *dwStartPos, BOOL bSmall) +void CFrontCliffModifier::ModifyStartPos(DWORD* dwStartPos, BOOL bSmall) { - - if(m_direction==cd_horiz_right) (*dwStartPos)-=1+0*Map->GetIsoSize(); - if(m_direction==cd_horiz_left) (*dwStartPos)+=-(1)+Map->GetIsoSize(); - if(m_direction==cd_vertic_top) (*dwStartPos)-=-1+0*Map->GetIsoSize(); - if(m_direction==cd_vertic_bottom) (*dwStartPos)-=0*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_top) (*dwStartPos)+=1+Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwStartPos)+=0-Map->GetIsoSize(); - - - if(m_direction==cd_horizdiag_right) (*dwStartPos)+=1+0*Map->GetIsoSize(); - if(m_direction==cd_horizdiag_left) (*dwStartPos)+=0+1*Map->GetIsoSize(); + if (m_direction == cd_horiz_right) (*dwStartPos) -= 1 + 0 * Map->GetIsoSize(); + if (m_direction == cd_horiz_left) (*dwStartPos) += -(1) + Map->GetIsoSize(); + if (m_direction == cd_vertic_top) (*dwStartPos) -= -1 + 0 * Map->GetIsoSize(); + if (m_direction == cd_vertic_bottom) (*dwStartPos) -= 0 * Map->GetIsoSize(); + + if (m_direction == cd_verticdiag_top) (*dwStartPos) += 1 + Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwStartPos) += 0 - Map->GetIsoSize(); + + + if (m_direction == cd_horizdiag_right) (*dwStartPos) += 1 + 0 * Map->GetIsoSize(); + if (m_direction == cd_horizdiag_left) (*dwStartPos) += 0 + 1 * Map->GetIsoSize(); } -void CFrontCliffModifier::ModifyCurrentPos(DWORD *dwPos, BOOL bBeforePlacing, BOOL bSmall) +void CFrontCliffModifier::ModifyCurrentPos(DWORD* dwPos, BOOL bBeforePlacing, BOOL bSmall) { - if(!bBeforePlacing) - { - if(!bSmall) - { - if(m_direction==cd_verticdiag_top) (*dwPos)+=0+2*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwPos)+=0-2*Map->GetIsoSize(); + if (!bBeforePlacing) { + if (!bSmall) { + if (m_direction == cd_verticdiag_top) (*dwPos) += 0 + 2 * Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwPos) += 0 - 2 * Map->GetIsoSize(); + } else { + if (m_direction == cd_verticdiag_top) (*dwPos) += 0 + 2 * Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwPos) += 0 - 2 * Map->GetIsoSize(); } - else - { - if(m_direction==cd_verticdiag_top) (*dwPos)+=0+2*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwPos)+=0-2*Map->GetIsoSize(); - } - } - else - { - if(bSmall) - { - if(m_direction==cd_verticdiag_top) (*dwPos)+=0-1*Map->GetIsoSize(); - if(m_direction==cd_verticdiag_bottom) (*dwPos)+=0+1*Map->GetIsoSize(); + } else { + if (bSmall) { + if (m_direction == cd_verticdiag_top) (*dwPos) += 0 - 1 * Map->GetIsoSize(); + if (m_direction == cd_verticdiag_bottom) (*dwPos) += 0 + 1 * Map->GetIsoSize(); } @@ -98,6 +91,6 @@ void CFrontCliffModifier::ModifyCurrentPos(DWORD *dwPos, BOOL bBeforePlacing, BO CString CFrontCliffModifier::GetDataSection() { - if(m_bAlternative) return ("CliffFrontDataAlt"); + if (m_bAlternative) return ("CliffFrontDataAlt"); return("CliffFrontData"); } diff --git a/MissionEditor/FrontCliffModifier.h b/MissionEditor/FrontCliffModifier.h index 7bf45dc..398d820 100644 --- a/MissionEditor/FrontCliffModifier.h +++ b/MissionEditor/FrontCliffModifier.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // FrontCliffModifier.h: Schnittstelle für die Klasse CFrontCliffModifier. @@ -31,7 +31,7 @@ #include "CliffModifier.h" -class CFrontCliffModifier : public CCliffModifier +class CFrontCliffModifier : public CCliffModifier { public: CFrontCliffModifier(); diff --git a/MissionEditor/GlobalsDlg.cpp b/MissionEditor/GlobalsDlg.cpp index 61f32aa..10b8c02 100644 --- a/MissionEditor/GlobalsDlg.cpp +++ b/MissionEditor/GlobalsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // GlobalsDlg.cpp: Implementierungsdatei @@ -70,35 +70,34 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CGlobalsDlg -void CGlobalsDlg::OnOK() +void CGlobalsDlg::OnOK() { - + // CDialog::OnOK(); } -void CGlobalsDlg::OnCancel() +void CGlobalsDlg::OnCancel() { // TODO: Zusätzlichen Bereinigungscode hier einfügen - + CDialog::OnCancel(); } void CGlobalsDlg::UpdateDialog() { - int oldsel=m_Global.GetCurSel(); - if(oldsel<0) oldsel=0; + int oldsel = m_Global.GetCurSel(); + if (oldsel < 0) oldsel = 0; - while(m_Global.DeleteString(0)!=CB_ERR); + while (m_Global.DeleteString(0) != CB_ERR); int i; - BOOL bFailFind=FALSE; - CIniFile& ini=Map->GetIniFile(); - for(i=0;i<100;i++) - { + BOOL bFailFind = FALSE; + CIniFile& ini = Map->GetIniFile(); + for (i = 0; i < 100; i++) { char c[50]; - itoa(i,c,10); - CString added=c; - added+=" "; + itoa(i, c, 10); + CString added = c; + added += " "; auto const& variableStr = ini.GetString("VariableNames", c); if (!variableStr.IsEmpty()) { @@ -108,7 +107,7 @@ void CGlobalsDlg::UpdateDialog() added += " No name"; } - m_Global.SetItemData(m_Global.AddString(added),i); + m_Global.SetItemData(m_Global.AddString(added), i); if (bFailFind) { break; @@ -119,24 +118,24 @@ void CGlobalsDlg::UpdateDialog() OnSelchangeGlobal(); } -void CGlobalsDlg::OnChangeDescription() +void CGlobalsDlg::OnChangeDescription() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int cursel = m_Global.GetCurSel(); + if (cursel < 0) return; + int curglob = m_Global.GetItemData(cursel); - int cursel=m_Global.GetCurSel(); - if(cursel<0) return; - int curglob=m_Global.GetItemData(cursel); - char c[50]; itoa(curglob, c, 10); UpdateData(TRUE); - if(m_Description.Find(",")>=0) m_Description.SetAt(m_Description.Find(","), 0); + if (m_Description.Find(",") >= 0) m_Description.SetAt(m_Description.Find(","), 0); - if (ini.GetString( "VariableNames",c).IsEmpty()) { + if (ini.GetString("VariableNames", c).IsEmpty()) { ini.SetString("VariableNames", c, "text,0"); } ini.SetString("VariableNames", c, SetParam(ini.GetString("VariableNames", c), 0, m_Description)); @@ -149,13 +148,13 @@ void CGlobalsDlg::OnChangeDescription() } -void CGlobalsDlg::OnSelchangeGlobal() +void CGlobalsDlg::OnSelchangeGlobal() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int cursel=m_Global.GetCurSel(); - if(cursel<0) return; - int curglob=m_Global.GetItemData(cursel); + int cursel = m_Global.GetCurSel(); + if (cursel < 0) return; + int curglob = m_Global.GetItemData(cursel); char c[50]; itoa(curglob, c, 10); @@ -168,34 +167,34 @@ void CGlobalsDlg::OnSelchangeGlobal() m_Description = ""; } - UpdateData(FALSE); + UpdateData(FALSE); } -BOOL CGlobalsDlg::OnInitDialog() +BOOL CGlobalsDlg::OnInitDialog() { CDialog::OnInitDialog(); UpdateDialog(); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CGlobalsDlg::OnSelchangeValue() +void CGlobalsDlg::OnSelchangeValue() { - + } -void CGlobalsDlg::OnEditchangeValue() +void CGlobalsDlg::OnEditchangeValue() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; m_Value.GetWindowText(str); - if(str.GetLength()==0) return; - int cursel=m_Global.GetCurSel(); - if(cursel<0) return; - int curglob=m_Global.GetItemData(cursel); - + if (str.GetLength() == 0) return; + int cursel = m_Global.GetCurSel(); + if (cursel < 0) return; + int curglob = m_Global.GetItemData(cursel); + char c[50]; itoa(curglob, c, 10); @@ -203,12 +202,12 @@ void CGlobalsDlg::OnEditchangeValue() if (variable.IsEmpty()) { return; } - + UpdateData(TRUE); - - str=GetParam(str, 0); + + str = GetParam(str, 0); TruncSpace(str); ini.SetString("VariableNames", c, SetParam(variable, 1, str)); - UpdateDialog(); + UpdateDialog(); } diff --git a/MissionEditor/GlobalsDlg.h b/MissionEditor/GlobalsDlg.h index 0aaff16..72519f8 100644 --- a/MissionEditor/GlobalsDlg.h +++ b/MissionEditor/GlobalsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_GLOBALSDLG_H__A8AAF461_9DE3_11D4_9C87_A7C4798A5242__INCLUDED_) @@ -32,7 +32,7 @@ class CGlobalsDlg : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateDialog(); CGlobalsDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -49,7 +49,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CGlobalsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Houses.cpp b/MissionEditor/Houses.cpp index 8fef663..c513e58 100644 --- a/MissionEditor/Houses.cpp +++ b/MissionEditor/Houses.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Houses.cpp: Implementierungsdatei @@ -103,10 +103,10 @@ END_MESSAGE_MAP() void CHouses::UpdateDialog() { - while(this->m_houses.DeleteString(0)!=CB_ERR); - while(this->m_HumanPlayer.DeleteString(0)!=CB_ERR); - while(this->m_Color.DeleteString(0)!=CB_ERR); - while(this->m_ActsLike.DeleteString(0)!=CB_ERR); + while (this->m_houses.DeleteString(0) != CB_ERR); + while (this->m_HumanPlayer.DeleteString(0) != CB_ERR); + while (this->m_Color.DeleteString(0) != CB_ERR); + while (this->m_ActsLike.DeleteString(0) != CB_ERR); ListHouses(m_Side, FALSE, TRUE); @@ -127,16 +127,14 @@ void CHouses::UpdateDialog() m_ActsLike.AddString(houseCString); } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(!ini.TryGetSection(MAPHOUSES) && ini.Size()>0) { + if (!ini.TryGetSection(MAPHOUSES) && ini.Size() > 0) { // MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else."); - } - else { + } else { m_HumanPlayer.AddString("None"); m_HumanPlayer.SetCurSel(0); - for(auto const& [seq, id]: ini[MAPHOUSES]) - { + for (auto const& [seq, id] : ini[MAPHOUSES]) { #ifdef RA2_MODE if (!id.CompareNoCase("nod") || !id.CompareNoCase("gdi")) { continue; @@ -145,14 +143,14 @@ void CHouses::UpdateDialog() m_houses.AddString(TranslateHouse(id, TRUE)); m_HumanPlayer.AddString(TranslateHouse(id, TRUE)); } - + auto const& playerHouseStr = ini.GetString("Basic", "Player"); - if(!playerHouseStr.IsEmpty()) { + if (!playerHouseStr.IsEmpty()) { m_HumanPlayer.SetCurSel(m_HumanPlayer.FindStringExact(0, TranslateHouse(playerHouseStr, TRUE))); } m_houses.SetCurSel(0); - + m_ActsLike.SetWindowText(""); m_Allies.SetWindowText(""); m_Color.SetWindowText(""); @@ -165,14 +163,14 @@ void CHouses::UpdateDialog() m_Side.SetWindowText(""); m_TechLevel.SetWindowText(""); - + OnSelchangeHouses(); } // houses list done - + // ok now color list const auto& rulesColors = rules["Colors"]; for (auto const& [id, def] : rulesColors) { @@ -185,10 +183,10 @@ void CHouses::UpdateDialog() } } -BOOL CHouses::OnInitDialog() +BOOL CHouses::OnInitDialog() { CDialog::OnInitDialog(); - + UpdateStrings(); UpdateDialog(); @@ -196,23 +194,23 @@ BOOL CHouses::OnInitDialog() m_ActsLike.ShowWindow(SW_HIDE); //m_Edge.ShowWindow(SW_HIDE); #endif - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CHouses::OnSelchangeHouses() +void CHouses::OnSelchangeHouses() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); auto const& s = ini[name]; @@ -238,20 +236,19 @@ void CHouses::OnSelchangeHouses() } -void CHouses::OnPreparehouses() +void CHouses::OnPreparehouses() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); #ifdef RA2_MODE - if(Map->IsMultiplayer()) - { + if (Map->IsMultiplayer()) { ini.SetInteger("Basic", "MultiplayerOnly", 1); auto const rulesHouseSec = rules[HOUSES]; - for (auto i = 0;i < rulesHouseSec.Size();++i) { + for (auto i = 0; i < rulesHouseSec.Size(); ++i) { char c[50]; - int k=i; - itoa(k,c,10); + int k = i; + itoa(k, c, 10); auto const& country = rulesHouseSec.Nth(i).second; // we now create a MAPHOUSE with the same name as the current rules house ini.SetString(MAPHOUSES, c, country); @@ -268,7 +265,7 @@ void CHouses::OnPreparehouses() ini.SetString(country, "PlayerControl", "no"); } - + UpdateDialog(); return; } @@ -287,7 +284,7 @@ void CHouses::OnPreparehouses() void CHouses::AddHouse(const CString& name) { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (ini.TryGetSection(name)) { MessageBox("Sorry this name is not available. " + name + " is already used in the map file. You need to use another name."); @@ -305,16 +302,15 @@ void CHouses::AddHouse(const CString& name) #endif int c; - + //okay, get a free slot - int pos=-1; + int pos = -1; #ifdef RA2_MODE - int pos2=-1; + int pos2 = -1; #endif - for(c=0;c>-1;c++) - { + for (c = 0; c > -1; c++) { char k[50]; - itoa(c,k,10); + itoa(c, k, 10); if (!ini[MAPHOUSES].Exists(k)) { pos = c; } @@ -323,27 +319,26 @@ void CHouses::AddHouse(const CString& name) } } #ifdef RA2_MODE - for(c=0;c>-1;c++) - { + for (c = 0; c > -1; c++) { char k[50]; - itoa(c,k,10); + itoa(c, k, 10); if (!ini[HOUSES].Exists(k)) { - pos2=c; + pos2 = c; } - if(pos2!=-1) break; + if (pos2 != -1) break; } #endif - + char k[50]; - itoa(pos,k,10); - + itoa(pos, k, 10); + auto const translatedHouseName = TranslateHouse(name); ini.SetString(MAPHOUSES, k, translatedHouseName); CString country; country = name; country.Replace(" House", ""); - country.Replace("House",""); + country.Replace("House", ""); if (country.Find(" ") >= 0) { country.Replace(" ", "_"); //=country.Left(country.Find(" ")); } @@ -363,7 +358,7 @@ void CHouses::AddHouse(const CString& name) if (strstr(name, "Nod") != NULL) { #ifndef RA2_MODE - ini.sections[translatedHouseName].values["Side"]="Nod"; + ini.sections[translatedHouseName].values["Side"] = "Nod"; #endif ini.SetString(translatedHouseName, "Color", "DarkRed"); if (name != "Nod") { @@ -371,7 +366,7 @@ void CHouses::AddHouse(const CString& name) } } else { #ifndef RA2_MODE - ini.sections[translatedHouseName].values["Side"]="GDI"; + ini.sections[translatedHouseName].values["Side"] = "GDI"; #endif ini.SetString(translatedHouseName, "Color", "Gold"); if (name != "GDI") { @@ -402,7 +397,7 @@ void CHouses::AddHouse(const CString& name) ini.SetInteger(country, "CostUnitsMult", 1); #endif - int cusel=m_houses.GetCurSel(); + int cusel = m_houses.GetCurSel(); UpdateDialog(); ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(); if (cusel != -1) { @@ -410,18 +405,18 @@ void CHouses::AddHouse(const CString& name) } } -void CHouses::OnShowWindow(BOOL bShow, UINT nStatus) +void CHouses::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (bShow) { if (!ini.TryGetSection(MAPHOUSES) && ini.Size() > 0) { #ifndef RA2_MODE - MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else. Note that in a multiplayer map independent computer players cannot be created by using the names GDI and Nod for the house. Just use something like GDI_AI."); + MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else. Note that in a multiplayer map independent computer players cannot be created by using the names GDI and Nod for the house. Just use something like GDI_AI."); #else - MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else."); + MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else."); #endif } @@ -441,19 +436,19 @@ void CHouses::OnShowWindow(BOOL bShow, UINT nStatus) } } -void CHouses::OnAddhouse() +void CHouses::OnAddhouse() { - CString name=InputBox(GetLanguageStringACP("AddHouse"),GetLanguageStringACP("AddHouseCap")); - if(name.GetLength()==0) return; - - name=GetHouseSectionName(name); + CString name = InputBox(GetLanguageStringACP("AddHouse"), GetLanguageStringACP("AddHouseCap")); + if (name.GetLength() == 0) return; + + name = GetHouseSectionName(name); //name=TranslateHouse(name); AddHouse(name); } -void CHouses::OnDeletehouse() +void CHouses::OnDeletehouse() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int cusel; cusel = m_houses.GetCurSel(); @@ -465,10 +460,10 @@ void CHouses::OnDeletehouse() CString uiname; m_houses.GetLBText(cusel, name); - uiname=name; + uiname = name; name = TranslateHouse(name); - CString str=GetLanguageStringACP("DeleteHouse"); + CString str = GetLanguageStringACP("DeleteHouse"); str = TranslateStringVariables(1, str, uiname); if (MessageBox(str, GetLanguageStringACP("DeleteHouseCap"), MB_YESNO) == IDNO) { return; @@ -486,61 +481,61 @@ void CHouses::OnDeletehouse() UpdateDialog(); } -void CHouses::OnKillfocusIq() +void CHouses::OnKillfocusIq() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_IQ.GetWindowText(t); ini.SetString(name, "IQ", t); } -void CHouses::OnKillfocusEdge() +void CHouses::OnKillfocusEdge() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Edge.GetWindowText(t); ini.SetString(name, "Edge", t); } -void CHouses::OnKillfocusSide() +void CHouses::OnKillfocusSide() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Side.GetWindowText(t); - t=TranslateHouse(t); + t = TranslateHouse(t); #ifndef RA2_MODE ini.SetString(name, "Side", t); #else @@ -548,24 +543,24 @@ void CHouses::OnKillfocusSide() #endif } -void CHouses::OnKillfocusColor() +void CHouses::OnKillfocusColor() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Color.GetWindowText(t); ini.SetString(name, "Color", t); - + //Map->UpdateIniFile(MAPDATA_UPDATE_FROM_INI); // MW fix: Only update structures // this recalculates the colors @@ -576,151 +571,151 @@ void CHouses::OnKillfocusColor() ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_minimap.RedrawWindow(); } -void CHouses::OnKillfocusAllies() +void CHouses::OnKillfocusAllies() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Allies.GetWindowText(t); - t=TranslateHouse(t); + t = TranslateHouse(t); ini.SetString(name, "Allies", t); } -void CHouses::OnKillfocusCredits() +void CHouses::OnKillfocusCredits() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Credits.GetWindowText(t); ini.SetString(name, "Credits", t); } -void CHouses::OnEditchangeActslike() +void CHouses::OnEditchangeActslike() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_ActsLike.GetWindowText(t); TruncSpace(t); - t=TranslateHouse(t); + t = TranslateHouse(t); ini.SetString(name, "ActsLike", t); } -void CHouses::OnKillfocusNodecount() +void CHouses::OnKillfocusNodecount() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_Nodecount.GetWindowText(t); ini.SetString(name, "NodeCount", t); } -void CHouses::OnKillfocusTechlevel() +void CHouses::OnKillfocusTechlevel() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_TechLevel.GetWindowText(t); ini.SetString(name, "TechLevel", t); } -void CHouses::OnKillfocusPercentbuilt() +void CHouses::OnKillfocusPercentbuilt() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_PercentBuilt.GetWindowText(t); ini.SetString(name, "PercentBuilt", t); } -void CHouses::OnKillfocusPlayercontrol() +void CHouses::OnKillfocusPlayercontrol() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); SetMainStatusBarReady(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; m_PlayerControl.GetWindowText(t); ini.SetString(name, "PlayerControl", t); } -void CHouses::OnSelchangeHumanplayer() +void CHouses::OnSelchangeHumanplayer() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString pl; - m_HumanPlayer.GetLBText(m_HumanPlayer.GetCurSel(),pl); - pl=TranslateHouse(pl); + m_HumanPlayer.GetLBText(m_HumanPlayer.GetCurSel(), pl); + pl = TranslateHouse(pl); - if(pl.GetLength()==0 || pl=="None") { + if (pl.GetLength() == 0 || pl == "None") { ini.RemoveValueByKey("Basic", "Player"); return; } @@ -728,22 +723,22 @@ void CHouses::OnSelchangeHumanplayer() ini.SetString("Basic", "Player", pl); } -void CHouses::OnSelchangeActslike() +void CHouses::OnSelchangeActslike() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int cusel; - cusel=m_houses.GetCurSel(); - if(cusel==-1) return; + cusel = m_houses.GetCurSel(); + if (cusel == -1) return; CString name; m_houses.GetLBText(cusel, name); - name=TranslateHouse(name); + name = TranslateHouse(name); CString t; - m_ActsLike.GetLBText(m_ActsLike.GetCurSel(),t); + m_ActsLike.GetLBText(m_ActsLike.GetCurSel(), t); TruncSpace(t); - t=TranslateHouse(t); + t = TranslateHouse(t); ini.SetString(name, "ActsLike", t); } @@ -771,12 +766,12 @@ void CHouses::UpdateStrings() SetWindowText(TranslateStringACP(HOUSES)); } -void CHouses::OnSetfocusAllies() +void CHouses::OnSetfocusAllies() { - SetMainStatusBar(GetLanguageStringACP("HousesAlliesHelp")); + SetMainStatusBar(GetLanguageStringACP("HousesAlliesHelp")); } -void CHouses::PostNcDestroy() +void CHouses::PostNcDestroy() { CDialog::PostNcDestroy(); } diff --git a/MissionEditor/Houses.h b/MissionEditor/Houses.h index 5e92a26..d360b27 100644 --- a/MissionEditor/Houses.h +++ b/MissionEditor/Houses.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_HOUSES_H__80D09600_8932_11D3_B63B_A583BFBD8C41__INCLUDED_) @@ -34,7 +34,7 @@ class CHouses : public CDialog { DECLARE_DYNCREATE(CHouses) -// Konstruktion + // Konstruktion public: void UpdateStrings(); void AddHouse(const CString& name); @@ -42,8 +42,8 @@ public: CHouses(); ~CHouses(); -// Dialogfelddaten - //{{AFX_DATA(CHouses) + // Dialogfelddaten + //{{AFX_DATA(CHouses) enum { IDD = IDD_HOUSES }; CComboBox m_HumanPlayer; CComboBox m_TechLevel; @@ -64,7 +64,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CHouses) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/ImportINI.cpp b/MissionEditor/ImportINI.cpp index 82025ab..c9e8b33 100644 --- a/MissionEditor/ImportINI.cpp +++ b/MissionEditor/ImportINI.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ImportINI.cpp: Implementierungsdatei @@ -42,7 +42,7 @@ CImportINI::CImportINI(CWnd* pParent /*=NULL*/) { //{{AFX_DATA_INIT(CImportINI) //}}AFX_DATA_INIT - m_inicount=0; + m_inicount = 0; } @@ -65,37 +65,37 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CImportINI -void CImportINI::OnAllsections() +void CImportINI::OnAllsections() { this->m_Available.EnableWindow(FALSE); //this->m_Sections.EnableWindow(FALSE); } -void CImportINI::OnSpecifysections() +void CImportINI::OnSpecifysections() { this->m_Available.EnableWindow(); //this->m_Sections.EnableWindow(); } -BOOL CImportINI::OnInitDialog() +BOOL CImportINI::OnInitDialog() { CDialog::OnInitDialog(); - + CButton* all; - all=(CButton*)GetDlgItem(IDC_ALLSECTIONS); + all = (CButton*)GetDlgItem(IDC_ALLSECTIONS); all->SetCheck(1); this->OnAllsections(); CIniFile inifile; inifile.LoadFile(this->m_FileName); - + if (inifile.Size() < 1) { - MessageBox("File does not have any ini content, abort.", "Error"); - EndDialog(IDCANCEL); + MessageBox("File does not have any ini content, abort.", "Error"); + EndDialog(IDCANCEL); return TRUE; } - + m_inicount = inifile.Size(); for (auto const& [secName, _] : inifile) { @@ -105,30 +105,25 @@ BOOL CImportINI::OnInitDialog() } return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CImportINI::OnOK() +void CImportINI::OnOK() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CButton* all; - all=(CButton*)GetDlgItem(IDC_ALLSECTIONS); - - if(all->GetCheck()) - { + all = (CButton*)GetDlgItem(IDC_ALLSECTIONS); + + if (all->GetCheck()) { // all... ini.InsertFile(m_FileName, NULL); - } - else - { + } else { // only the chosen sections int i; - for(i=0;i0) - { + for (i = 0; i < m_Available.GetCount(); i++) { + if (m_Available.GetSel(i) > 0) { // ok the user wants to add that section! CString name; m_Available.GetText(i, name); @@ -137,6 +132,6 @@ void CImportINI::OnOK() } } } - + CDialog::OnOK(); } diff --git a/MissionEditor/ImportINI.h b/MissionEditor/ImportINI.h index 1987406..8977edb 100644 --- a/MissionEditor/ImportINI.h +++ b/MissionEditor/ImportINI.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_IMPORTINI_H__9DC7B324_6DF2_11D3_99E1_D14A1D4DCF07__INCLUDED_) @@ -32,7 +32,7 @@ class CImportINI : public CDialog { -// Konstruktion + // Konstruktion public: CString m_FileName; CImportINI(CWnd* pParent = NULL); // Standardkonstruktor @@ -47,7 +47,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CImportINI) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Infantry.cpp b/MissionEditor/Infantry.cpp index 7b6f971..f0196da 100644 --- a/MissionEditor/Infantry.cpp +++ b/MissionEditor/Infantry.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Infantrie.cpp: Implementierungsdatei @@ -84,72 +84,70 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CInfantrie -BOOL CInfantrie::OnInitDialog() +BOOL CInfantrie::OnInitDialog() { CDialog::OnInitDialog(); - + // init the common (!) dialog things int i; - CComboBox* house, *tag; - house=(CComboBox*)GetDlgItem(IDC_HOUSE); - tag=(CComboBox*)GetDlgItem(IDC_TAG); - + CComboBox* house, * tag; + house = (CComboBox*)GetDlgItem(IDC_HOUSE); + tag = (CComboBox*)GetDlgItem(IDC_TAG); + ListHouses(*house, FALSE); ListTags(*tag, TRUE); - - + + UpdateData(FALSE); - m_strength_ctrl.SetRange(0,256); + m_strength_ctrl.SetRange(0, 256); m_strength_ctrl.SetPos(atoi(m_strength)); - + UpdateStrings(); - return TRUE; + return TRUE; } -void CInfantrie::OnOK() +void CInfantrie::OnOK() { CDialog::OnOK(); - m_strength=GetText(&m_strength_ctrl); + m_strength = GetText(&m_strength_ctrl); - UpdateData(); + UpdateData(); TruncSpace(m_tag); - m_house=TranslateHouse(m_house); - + m_house = TranslateHouse(m_house); + + - } void CInfantrie::Init(CString house, CString strength, CString action, CString direction, CString tag, CString flag1, CString flag2, CString flag3, CString flag4, CString flag5) { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(house=="") - { + if (house == "") { /*m_house=*rules.sections[HOUSES].GetValue(0); if(ini.sections.find(HOUSES)!=ini.sections.end()) if(ini.sections[HOUSES].values.size()>0) m_house=*ini.sections[HOUSES].GetValue(0);*/ - m_house=TranslateHouse(Map->GetHouseID(0), TRUE); - } - else - m_house=TranslateHouse(house, TRUE); + m_house = TranslateHouse(Map->GetHouseID(0), TRUE); + } else + m_house = TranslateHouse(house, TRUE); - - m_flag1=flag1; - m_flag2=flag2; - m_flag3=flag3; - m_flag4=flag4; - m_flag5=flag5; + + m_flag1 = flag1; + m_flag2 = flag2; + m_flag3 = flag3; + m_flag4 = flag4; + m_flag5 = flag5; // m_pos=pos; - m_action=action; - m_strength=strength; - - m_tag=tag; - m_direction=direction; - + m_action = action; + m_strength = strength; + + m_tag = tag; + m_direction = direction; + } void CInfantrie::UpdateStrings() diff --git a/MissionEditor/Infantry.h b/MissionEditor/Infantry.h index 14ae9a8..c955ae9 100644 --- a/MissionEditor/Infantry.h +++ b/MissionEditor/Infantry.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_INFANTRIE_H__F5A248C4_84A5_11D3_B63B_F881F458F743__INCLUDED_) @@ -32,11 +32,11 @@ class CInfantrie : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateStrings(); CString m_strength; - void Init(CString house="", CString strength="256", CString action="Guard", CString direction="64", CString tag="None", CString p1="0", CString p2="-1", CString p3="0", CString p4="0", CString p5="0"); + void Init(CString house = "", CString strength = "256", CString action = "Guard", CString direction = "64", CString tag = "None", CString p1 = "0", CString p2 = "-1", CString p3 = "0", CString p4 = "0", CString p5 = "0"); CInfantrie(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten @@ -58,7 +58,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CInfantrie) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Info.cpp b/MissionEditor/Info.cpp index c8e19e1..1d58f0a 100644 --- a/MissionEditor/Info.cpp +++ b/MissionEditor/Info.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Info.cpp: Implementierungsdatei diff --git a/MissionEditor/Info.h b/MissionEditor/Info.h index 5d057ce..a93dec2 100644 --- a/MissionEditor/Info.h +++ b/MissionEditor/Info.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_INFO_H__3F820D60_6EB5_11D3_99E1_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CInfo : public CDialog { -// Konstruktion + // Konstruktion public: CInfo(CWnd* pParent = NULL); // Standardkonstruktor @@ -45,7 +45,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CInfo) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL @@ -58,7 +58,7 @@ protected: //}}AFX_MSG DECLARE_MESSAGE_MAP() public: -// afx_msg void OnEnChangeEdit1(); + // afx_msg void OnEnChangeEdit1(); virtual BOOL OnInitDialog(); }; diff --git a/MissionEditor/IniFile.cpp b/MissionEditor/IniFile.cpp index b803447..02465e2 100644 --- a/MissionEditor/IniFile.cpp +++ b/MissionEditor/IniFile.cpp @@ -60,7 +60,7 @@ CIniFile::~CIniFile() sections.clear(); } -WORD CIniFile::LoadFile(const CString& filename, BOOL bNoSpaces) +WORD CIniFile::LoadFile(const CString& filename, BOOL bNoSpaces) { return LoadFile(std::string(filename.GetString()), bNoSpaces); } @@ -120,8 +120,7 @@ WORD CIniFile::InsertFile(const std::string& filename, const char* Section, BOOL const auto npos = std::string::npos; - while (!file.eof()) - { + while (!file.eof()) { std::getline(file, cLine); // strip to left side of newline or comment @@ -131,23 +130,18 @@ WORD CIniFile::InsertFile(const std::string& filename, const char* Section, BOOL const auto closeBracket = cLine.find(']'); const auto equals = cLine.find('='); - if (openBracket != npos && closeBracket != npos && openBracket < closeBracket && (equals == npos || equals > openBracket)) - { + if (openBracket != npos && closeBracket != npos && openBracket < closeBracket && (equals == npos || equals > openBracket)) { if ((Section != nullptr) && cSec == Section) return 0; // the section we want to insert is finished cSec = cLine.substr(openBracket + 1, closeBracket - openBracket - 1).c_str(); - } - else if (equals != npos && !cSec.IsEmpty()) - { - if (Section == NULL || cSec == Section) - { + } else if (equals != npos && !cSec.IsEmpty()) { + if (Section == NULL || cSec == Section) { // a value is set and we have a valid current section! CString name = cLine.substr(0, equals).c_str(); CString value = cLine.substr(equals + 1, cLine.size() - equals - 1).c_str(); - if (bNoSpaces) - { + if (bNoSpaces) { name.Trim(); value.Trim(); } @@ -187,7 +181,7 @@ BOOL CIniFile::SaveFile(const std::string& Filename) const file.open(Filename, ios::out | ios::trunc); - for (auto const& sec : sections) { + for (auto const& sec : sections) { file << "[" << sec.first << "]" << endl; for (auto const& pair : sec.second) { file << pair.first << "=" << pair.second << endl; diff --git a/MissionEditor/IniFile.h b/MissionEditor/IniFile.h index 4e552ee..259b001 100644 --- a/MissionEditor/IniFile.h +++ b/MissionEditor/IniFile.h @@ -164,8 +164,8 @@ public: } void Insert(const CString& key, CString&& value) { - value_pairs.push_back({ key, value }); - value_pos.insert_or_assign(key, value_pairs.size() - 1); + value_pairs.push_back({ key, value }); + value_pos.insert_or_assign(key, value_pairs.size() - 1); } // ==================== Delete @@ -218,7 +218,7 @@ public: private: map value_pos{}; vector> value_pairs{};// sequenced - mutable bool isRegistry{false}; + mutable bool isRegistry{ false }; }; class CIniFile @@ -310,7 +310,7 @@ public: // ============== Writer and Helper converter ============================ CIniFileSection& AddSection(CString&& sectionName) { - auto const ret = this->sections.insert({ std::move(sectionName), {}}); + auto const ret = this->sections.insert({ std::move(sectionName), {} }); return ret.first->second; } CIniFileSection& AddSection(const CString& sectionName) { @@ -337,7 +337,7 @@ public: } void SetBool(const CString& section, const CString& key, const bool value) { - this->SetString(section, key, INIHelper::ToString(value)); + this->SetString(section, key, INIHelper::ToString(value)); } void SetInteger(const CString& section, const CString& key, const int value) { this->SetString(section, key, INIHelper::ToString(value)); diff --git a/MissionEditor/IniHelper.h b/MissionEditor/IniHelper.h index 868e6c4..eb0c571 100644 --- a/MissionEditor/IniHelper.h +++ b/MissionEditor/IniHelper.h @@ -48,9 +48,9 @@ public: static CString ToString(const T& origin);// { static_assert(false, "T must have specialized implementations!"); } template<> - static CString ToString(const bool& origin) + static CString ToString(const bool& origin) { - static CString result[] = { "no", "yes" }; + static CString result[] = { "no", "yes" }; return result[origin]; } diff --git a/MissionEditor/InputBox.cpp b/MissionEditor/InputBox.cpp index 44cd9ce..c9c0fa8 100644 --- a/MissionEditor/InputBox.cpp +++ b/MissionEditor/InputBox.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // InputBox.cpp: Implementierungsdatei @@ -55,7 +55,7 @@ CInputBox::CInputBox(CWnd* pParent /*=NULL*/) : CDialog(CInputBox::IDD, pParent) { //{{AFX_DATA_INIT(CInputBox) - + //}}AFX_DATA_INIT } @@ -64,7 +64,7 @@ void CInputBox::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CInputBox) - + //}}AFX_DATA_MAP } @@ -89,25 +89,25 @@ void CInputBox::OnOK() EndDialog(true); } -void CInputBox::OnCancel() +void CInputBox::OnCancel() { EndDialog(false); } void CInputBox::SetCaption(CString Caption) { - m_Caption=Caption; + m_Caption = Caption; } void CInputBox::SetSentence(CString Sentence) { - m_Text=Sentence; + m_Text = Sentence; } -BOOL CInputBox::OnInitDialog() +BOOL CInputBox::OnInitDialog() { CDialog::OnInitDialog(); - + SetWindowText(m_Caption); SetDlgItemText(IDC_SENTENCE, m_Text); @@ -115,6 +115,6 @@ BOOL CInputBox::OnInitDialog() SetDlgItemText(IDCANCEL, GetLanguageStringACP("Cancel")); GetDlgItem(IDC_VAL)->SetFocus(); - - return FALSE; + + return FALSE; } diff --git a/MissionEditor/InputBox.h b/MissionEditor/InputBox.h index 4612833..e594aa7 100644 --- a/MissionEditor/InputBox.h +++ b/MissionEditor/InputBox.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_INPUTBOX_H__90BA0F00_6AD4_11D3_99E1_FA6209BA1804__INCLUDED_) @@ -36,7 +36,7 @@ CString InputBox(const char* Sentence, const char* Caption); class CInputBox : public CDialog { -// Konstruktion + // Konstruktion public: void SetSentence(CString Sentence); void SetCaption(CString Caption); @@ -48,10 +48,10 @@ public: //}}AFX_DATA const CString& GetResult() const { return m_Result; } -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CInputBox) - protected: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CInputBox) +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/IsoPaintThread.cpp b/MissionEditor/IsoPaintThread.cpp index 3527a21..521cc53 100644 --- a/MissionEditor/IsoPaintThread.cpp +++ b/MissionEditor/IsoPaintThread.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // IsoPaintThread.cpp: Implementierungsdatei @@ -49,8 +49,7 @@ BOOL CIsoPaintThread::InitInstance() { // ZU ERLEDIGEN: Initialisierungen für jeden Thread hier durchführen - while(TRUE) - { + while (TRUE) { // this worker thread just updates the main window ((CFinalSunDlg*)theApp.GetMainWnd())->m_view.m_isoview->UpdateWindow(); } diff --git a/MissionEditor/IsoPaintThread.h b/MissionEditor/IsoPaintThread.h index 69abef7..3e8cf53 100644 --- a/MissionEditor/IsoPaintThread.h +++ b/MissionEditor/IsoPaintThread.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_ISOPAINTTHREAD_H__13F04541_01CB_11D5_9C88_FB4495B57649__INCLUDED_) @@ -41,13 +41,13 @@ protected: // Attribute public: -// Operationen + // Operationen public: -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CIsoPaintThread) - public: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CIsoPaintThread) +public: virtual BOOL InitInstance(); virtual int ExitInstance(); //}}AFX_VIRTUAL diff --git a/MissionEditor/IsoView.cpp b/MissionEditor/IsoView.cpp index e838fde..a8cdb37 100644 --- a/MissionEditor/IsoView.cpp +++ b/MissionEditor/IsoView.cpp @@ -132,8 +132,7 @@ public: void ensure_unlocked() { - if (m_locked) - { + if (m_locked) { m_pDDS->Unlock(m_hasRect ? &m_rect : nullptr); } m_locked = false; @@ -295,26 +294,22 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int blrect.left = x; - if (blrect.left < 0) - { + if (blrect.left < 0) { srcRect.left = 1 - blrect.left; blrect.left = 1; } blrect.top = y; - if (blrect.top < 0) - { + if (blrect.top < 0) { srcRect.top = 1 - blrect.top; blrect.top = 1; } blrect.right = (x + swidth); - if (x + swidth > dright) - { + if (x + swidth > dright) { srcRect.right = dright - x;//swidth-((x+swidth)-dright); blrect.right = dright; } blrect.bottom = (y + sheight); - if (y + sheight > dbottom) - { + if (y + sheight > dbottom) { srcRect.bottom = dbottom - y;//sheight-((y+sheight)-dbottom); blrect.bottom = dbottom; } @@ -325,10 +320,8 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int #ifdef NOSURFACES_EXTRACT int pos = 0; - if (!st.bNotExtracted) - { - for (e = srcRect.top;e < srcRect.bottom;e++) - { + if (!st.bNotExtracted) { + for (e = srcRect.top; e < srcRect.bottom; e++) { short left = st.vborder[e].left; short right = st.vborder[e].right; @@ -337,8 +330,7 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int //short addx_s=0; if (right >= srcRect.right) right = srcRect.right - 1; - if (srcRect.left > 0) - { + if (srcRect.left > 0) { pos += (realright - left + 1) * bpp; continue; // just cancel. this area is used by object browser. saves some performance //addx_s=srcRect.left; @@ -346,10 +338,8 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int //left=//addx=left-srcRect.left; } - if (realright >= left) - { - if (/*left= srcRect.right) - { + if (realright >= left) { + if (/*left= srcRect.right) { pos += (realright - left + 1) * bpp; continue; } @@ -361,19 +351,16 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int pos += (realright - left + 1) * bpp; } } - } - else + } else #endif - for (e = srcRect.top;e < srcRect.bottom;e++) - { + for (e = srcRect.top; e < srcRect.bottom; e++) { short& left = st.vborder[e].left; short& right = st.vborder[e].right; auto l = max(left, srcRect.left); auto r = min(right, static_cast(srcRect.right - 1)); - for (i = l;i <= r;i++) - { + for (i = l; i <= r; i++) { //if (i < srcRect.left || i >= srcRect.right) { //dest+=bpp; @@ -382,8 +369,7 @@ __forceinline void BlitTerrain(void* dst, int x, int y, int dleft, int dtop, int { BYTE& val = src[i + e * swidth]; - if (val) - { + if (val) { void* dest = ((BYTE*)dst + (blrect.left + i) * bpp + (blrect.top + e) * dpitch); memcpy(dest, &iPalIso[val], bpp); @@ -422,26 +408,22 @@ __forceinline void BlitTerrainHalfTransp(void* dst, int x, int y, int dleft, int blrect.left = x; - if (blrect.left < 0) - { + if (blrect.left < 0) { srcRect.left = 1 - blrect.left; blrect.left = 1; } blrect.top = y; - if (blrect.top < 0) - { + if (blrect.top < 0) { srcRect.top = 1 - blrect.top; blrect.top = 1; } blrect.right = (x + swidth); - if (x + swidth > dright) - { + if (x + swidth > dright) { srcRect.right = dright - x;//swidth-((x+swidth)-dright); blrect.right = dright; } blrect.bottom = (y + sheight); - if (y + sheight > dbottom) - { + if (y + sheight > dbottom) { srcRect.bottom = dbottom - y;//sheight-((y+sheight)-dbottom); blrect.bottom = dbottom; } @@ -452,29 +434,24 @@ __forceinline void BlitTerrainHalfTransp(void* dst, int x, int y, int dleft, int #ifdef NOSURFACES_EXTRACT int pos = 0; - if (!st.bNotExtracted) - { + if (!st.bNotExtracted) { int a = 0; - for (e = srcRect.top;e < srcRect.bottom;e += 1) - { + for (e = srcRect.top; e < srcRect.bottom; e += 1) { short left = st.vborder[e].left; short right = st.vborder[e].right; short realright = right; if (right >= srcRect.right) right = srcRect.right - 1; - if (srcRect.left > 0) - { + if (srcRect.left > 0) { pos += (realright - left + 1) * bpp; continue; // just cancel. this area is used by object browser. saves some performance } a++; - if (realright >= left) - { - if (/*left= srcRect.right) - { + if (realright >= left) { + if (/*left= srcRect.right) { pos += (realright - left + 1) * bpp; continue; } @@ -485,14 +462,10 @@ __forceinline void BlitTerrainHalfTransp(void* dst, int x, int y, int dleft, int //memcpy(dest, &st.pic[pos], bpp*(right-left+1)); //pos+=(right-left+1)*bpp; - for (i = left + a % 2;i <= right;i += 2) - { - if (i < srcRect.left || i >= srcRect.right) - { + for (i = left + a % 2; i <= right; i += 2) { + if (i < srcRect.left || i >= srcRect.right) { //dest+=bpp; - } - else - { + } else { //BYTE& val=st.pic[pos+i*bpp]; //if(val) @@ -507,32 +480,25 @@ __forceinline void BlitTerrainHalfTransp(void* dst, int x, int y, int dleft, int pos += (realright - left + 1) * bpp; } } - } - else + } else #endif { int a = 0; - for (e = srcRect.top;e < srcRect.bottom;e++) - { + for (e = srcRect.top; e < srcRect.bottom; e++) { short& left = st.vborder[e].left; short& right = st.vborder[e].right; a++; - for (i = left + a % 2;i <= right;i += 2) - { - if (i < srcRect.left || i >= srcRect.right) - { + for (i = left + a % 2; i <= right; i += 2) { + if (i < srcRect.left || i >= srcRect.right) { //dest+=bpp; - } - else - { + } else { BYTE& val = src[i + e * swidth]; - if (val) - { + if (val) { void* dest = ((BYTE*)dst + (blrect.left + i) * bpp + (blrect.top + e) * dpitch); memcpy(dest, &iPalIso[val], bpp); @@ -553,12 +519,9 @@ const int houseColorRelMax = houseColorMax - houseColorMin; inline void CalculateHouseColorPalette(int house_pal[houseColorRelMax + 1], const int* default_pal, const int* color = NULL) { - if (color) - { - if (bpp == 4) - { - for (int n = 0; n <= houseColorRelMax; ++n) - { + if (color) { + if (bpp == 4) { + for (int n = 0; n <= houseColorRelMax; ++n) { const int v = (houseColorRelMax - n); auto src = reinterpret_cast(color); auto bdest = reinterpret_cast(&house_pal[n]); @@ -567,20 +530,14 @@ inline void CalculateHouseColorPalette(int house_pal[houseColorRelMax + 1], cons bdest[2] = src[2] * v / houseColorRelMax; bdest[3] = src[3]; } - } - else - { + } else { // nowadays only 32 bit rendering should be used, so we take a shortcut here - for (int n = 0; n <= houseColorRelMax; ++n) - { + for (int n = 0; n <= houseColorRelMax; ++n) { house_pal[n] = *color; } } - } - else - { - for (int n = 0; n <= houseColorRelMax; ++n) - { + } else { + for (int n = 0; n <= houseColorRelMax; ++n) { house_pal[n] = default_pal[n + houseColorMin]; } } @@ -617,26 +574,22 @@ __forceinline void BlitPic(void* dst, int x, int y, int dleft, int dtop, int dpi srcRect.right = swidth; srcRect.bottom = sheight; blrect.left = x; - if (blrect.left < 0) - { + if (blrect.left < 0) { srcRect.left = 1 - blrect.left; //blrect.left=1; } blrect.top = y; - if (blrect.top < 0) - { + if (blrect.top < 0) { srcRect.top = 1 - blrect.top; //blrect.top=1; } blrect.right = (x + swidth); - if (x + swidth > dright) - { + if (x + swidth > dright) { srcRect.right = swidth - ((x + swidth) - dright); blrect.right = dright; } blrect.bottom = (y + sheight); - if (y + sheight > dbottom) - { + if (y + sheight > dbottom) { srcRect.bottom = sheight - ((y + sheight) - dbottom); blrect.bottom = dbottom; } @@ -652,8 +605,7 @@ __forceinline void BlitPic(void* dst, int x, int y, int dleft, int dtop, int dpi CalculateHouseColorPalette(houseColors, newPal, color); const BYTE* const pLighting = (bpp == 4 && pd.lighting && !pd.lighting->empty()) ? pd.lighting->data() : nullptr; - for (e = srcRect.top;e < srcRect.bottom;e++) - { + for (e = srcRect.top; e < srcRect.bottom; e++) { int left = pd.vborder[e].left; int right = pd.vborder[e].right; @@ -662,34 +614,27 @@ __forceinline void BlitPic(void* dst, int x, int y, int dleft, int dtop, int dpi if (right >= srcRect.right) right = srcRect.right - 1; - for (i = left;i <= right;i++) - { + for (i = left; i <= right; i++) { if (blrect.left + i < 0) continue; const int spos = i + e * swidth; BYTE val = src[spos]; - if (val) - { + if (val) { void* dest = ((BYTE*)dst + (blrect.left + i) * bpp + (blrect.top + e) * dpitch); - if (dest >= dst) - { + if (dest >= dst) { int c; - if (!color || newPal != iPalUnit || val < houseColorMin || val > houseColorMax) - { + if (!color || newPal != iPalUnit || val < houseColorMin || val > houseColorMax) { c = newPal[val]; - } - else - { + } else { // Replace the original palette color with the house color ASSERT(val >= houseColorMin && val <= houseColorMax); const int v = (val - houseColorMin); c = houseColors[v]; } - if (pLighting) - { + if (pLighting) { // bpp == 4 ASSERT(bpp == 4); int l = pLighting[spos]; @@ -732,26 +677,22 @@ __forceinline void BlitPicHalfTransp(void* dst, int x, int y, int dleft, int dto srcRect.right = swidth; srcRect.bottom = sheight; blrect.left = x; - if (blrect.left < 0) - { + if (blrect.left < 0) { srcRect.left = 1 - blrect.left; //blrect.left=1; } blrect.top = y; - if (blrect.top < 0) - { + if (blrect.top < 0) { srcRect.top = 1 - blrect.top; //blrect.top=1; } blrect.right = (x + swidth); - if (x + swidth > dright) - { + if (x + swidth > dright) { srcRect.right = swidth - ((x + swidth) - dright); blrect.right = dright; } blrect.bottom = (y + sheight); - if (y + sheight > dbottom) - { + if (y + sheight > dbottom) { srcRect.bottom = sheight - ((y + sheight) - dbottom); blrect.bottom = dbottom; } @@ -762,8 +703,7 @@ __forceinline void BlitPicHalfTransp(void* dst, int x, int y, int dleft, int dto - for (e = srcRect.top;e < srcRect.bottom;e++) - { + for (e = srcRect.top; e < srcRect.bottom; e++) { int left = pd.vborder[e].left; @@ -773,8 +713,7 @@ __forceinline void BlitPicHalfTransp(void* dst, int x, int y, int dleft, int dto int a = e % 2 + left % 2; - for (i = left + a;i <= right;i += 2) - { + for (i = left + a; i <= right; i += 2) { //a++; if (blrect.left + i < 0) continue; @@ -782,18 +721,13 @@ __forceinline void BlitPicHalfTransp(void* dst, int x, int y, int dleft, int dto BYTE& val = src[i + e * swidth]; //0x10-0x1f, - if (val) - { + if (val) { void* dest = ((BYTE*)dst + (blrect.left + i) * bpp + (blrect.top + e) * dpitch); //*dest=newPal[val]; - if (dest >= dst) - { - if (!color || newPal != iPalUnit || val < 0x10 || val>0x1f) - { + if (dest >= dst) { + if (!color || newPal != iPalUnit || val < 0x10 || val>0x1f) { memcpy(dest, &newPal[val], bpp); - } - else - { + } else { //int col=0; memcpy(dest, color, bpp); } @@ -831,9 +765,8 @@ void CIsoView::updateFontScaled() m_fontDefaultHeight = -MulDiv(12, dc->GetDeviceCaps(LOGPIXELSY), 72); m_Font9Height = -MulDiv(9, dc->GetDeviceCaps(LOGPIXELSY), 72); - if (dd) - { - m_textDefault.reset(new TextDrawer(dd, m_fontDefaultHeight, RGB(0,0,0), RGB(255, 255, 255))); + if (dd) { + m_textDefault.reset(new TextDrawer(dd, m_fontDefaultHeight, RGB(0, 0, 0), RGB(255, 255, 255))); m_text9.reset(new TextDrawer(dd, m_Font9Height, RGB(0, 0, 0), RGB(255, 255, 255))); m_textScaled.reset(new TextDrawer(dd, m_fontDefaultHeight / m_viewScale.y, RGB(0, 0, 0), RGB(255, 255, 255))); m_text9Scaled.reset(new TextDrawer(dd, m_Font9Height / m_viewScale.y, RGB(0, 0, 0), RGB(255, 255, 255))); @@ -860,8 +793,7 @@ BOOL CIsoView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwSty void CIsoView::OnSysCommand(UINT nID, LPARAM lParam) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen - if (nID == SC_CLOSE) - { + if (nID == SC_CLOSE) { // ok now just hide the window ShowWindow(SW_HIDE); return; @@ -878,8 +810,7 @@ inline int GetScrPos(CWnd* pOwner, UINT nSB, UINT nSBCode, UINT& nPos) pOwner->GetScrollInfo(nSB, &scr); - switch (nSBCode) - { + switch (nSBCode) { case SB_LEFT: { nPos = scr.nMin; @@ -969,13 +900,12 @@ void CIsoView::UpdateDialog(BOOL bRepos) UpdateOverlayPictures(); - if (bRepos && Map->GetIsoSize() != 0) - { + if (bRepos && Map->GetIsoSize() != 0) { m_viewScale = Vec2(1.0f, 1.0f); m_viewScaleControl = 1.0f; auto r = GetScaledDisplayRect(); UpdateScrollRanges(); - SetScroll((Map->GetIsoSize() / 2 - r.right / f_x / 2) * f_x, (Map->GetIsoSize() / 2 - r.bottom / f_y / 2) * f_y); + SetScroll((Map->GetIsoSize() / 2 - r.right / f_x / 2) * f_x, (Map->GetIsoSize() / 2 - r.bottom / f_y / 2) * f_y); } RedrawWindow(NULL, NULL, RDW_INVALIDATE); @@ -1018,10 +948,8 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) if (!(nFlags & MK_RBUTTON)) bDoNotAllowScroll = FALSE; - if (rscroll) - { - if (!(nFlags & MK_RBUTTON)) - { + if (rscroll) { + if (!(nFlags & MK_RBUTTON)) { ReleaseCapture(); KillTimer(11); rscroll = FALSE; @@ -1030,9 +958,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) CMyViewFrame& dlg = *(CMyViewFrame*)owner; dlg.m_minimap.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else - { + } else { isMoving = FALSE; return; @@ -1041,8 +967,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) if (!bDoNotAllowScroll && (nFlags & MK_RBUTTON) && !rscroll) // check if scroll should start { - if (abs(point.x - rclick_x) > 2 || abs(point.y - rclick_y) > 2) - { + if (abs(point.x - rclick_x) > 2 || abs(point.y - rclick_y) > 2) { // yes, begin scrolling! rscroll = TRUE; @@ -1057,10 +982,8 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) if ((nFlags & MK_MBUTTON) == 0) m_zooming = false; - if (!bDoNotAllowScroll && m_zooming) - { - if ((nFlags & MK_MBUTTON) == MK_MBUTTON) - { + if (!bDoNotAllowScroll && m_zooming) { + if ((nFlags & MK_MBUTTON) == MK_MBUTTON) { auto diff = point - m_MButtonMoveZooming; m_MButtonMoveZooming = point; Zoom(m_MButtonDown, -diff.cy / 1000.0f); @@ -1095,21 +1018,15 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) BOOL bOutside = FALSE; - if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE) - { - if (x < 1 || y < 1 || x + ymapwidth + mapheight * 2 || (y + 1 > mapwidth && x - 1 < y - mapwidth) || (x + 1 > mapwidth && y + mapwidth - 1 < x)) - { + if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE) { + if (x < 1 || y < 1 || x + ymapwidth + mapheight * 2 || (y + 1 > mapwidth && x - 1 < y - mapwidth) || (x + 1 > mapwidth && y + mapwidth - 1 < x)) { isMoving = FALSE; return; } - } - else - { - if (x < 1 || y < 1 || x >= mapwidth + mapheight - 1 || y >= mapwidth + mapheight - 1) - { + } else { + if (x < 1 || y < 1 || x >= mapwidth + mapheight - 1 || y >= mapwidth + mapheight - 1) { bOutside = TRUE; - if (AD.mode == ACTIONMODE_COPY || AD.mode == ACTIONMODE_PASTE) - { + if (AD.mode == ACTIONMODE_COPY || AD.mode == ACTIONMODE_PASTE) { isMoving = FALSE; return; } @@ -1121,15 +1038,14 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) if (lpdsBack) // reset back buffer to last DrawMap() lpdsBack->BltFast(0, 0, lpdsTemp, NULL, DDBLTFAST_WAIT); - //lpdsBack->Blt(NULL, lpdsTemp, NULL, 0, 0); + //lpdsBack->Blt(NULL, lpdsTemp, NULL, 0, 0); - //int cell_x = x; - //int cell_y = y; +//int cell_x = x; +//int cell_y = y; { // Preview rendering - if (AD.mode == ACTIONMODE_SETTILE && !((nFlags & MK_LBUTTON) && !(nFlags & MK_CONTROL) && (nFlags & MK_SHIFT))) - { + if (AD.mode == ACTIONMODE_SETTILE && !((nFlags & MK_LBUTTON) && !(nFlags & MK_CONTROL) && (nFlags & MK_SHIFT))) { // No placement, just preview bCancelDraw = TRUE; @@ -1152,15 +1068,12 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) int height_add = height * isosize; char c[50]; itoa(AD.data, c, 10); - for (f = 0;f < m_BrushSize_x;f++) - { - for (n = 0;n < m_BrushSize_y;n++) - { + for (f = 0; f < m_BrushSize_x; f++) { + for (n = 0; n < m_BrushSize_y; n++) { int tile = AD.type; - if (AD.data == 1) - { + if (AD.data == 1) { int n = rand() * 5 / RAND_MAX; tile += n; } @@ -1169,17 +1082,12 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) cur_pos = pos + f * width + n * height_add; p = 0; - for (i = 0;i < td.cx;i++) - { - for (e = 0;e < td.cy;e++) - { + for (i = 0; i < td.cx; i++) { + for (e = 0; e < td.cy; e++) { if (x - width + 1 + f * width + i >= Map->GetIsoSize() || - y - height + 1 + n * height + e >= Map->GetIsoSize()) - { - } - else - if (td.tiles[p].pic != NULL) - { + y - height + 1 + n * height + e >= Map->GetIsoSize()) { + } else + if (td.tiles[p].pic != NULL) { int mypos = cur_pos + i + e * isosize; Map->SetHeightAt(mypos, startheight + td.tiles[p].bZHeight); @@ -1197,20 +1105,15 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) } } - if (!((nFlags & MK_CONTROL) && (nFlags & MK_SHIFT))) - { + if (!((nFlags & MK_CONTROL) && (nFlags & MK_SHIFT))) { if (!theApp.m_Options.bDisableAutoShore) Map->CreateShore(x - width - 2, y - height - 2, x - width + td.cx * m_BrushSize_x + 5, y - height + td.cy * m_BrushSize_y + 5, FALSE); - for (f = 0;f < m_BrushSize_x;f++) - { - for (n = 0;n < m_BrushSize_y;n++) - { + for (f = 0; f < m_BrushSize_x; f++) { + for (n = 0; n < m_BrushSize_y; n++) { cur_pos = pos + f * width + n * height_add; p = 0; - for (i = -1;i < td.cx + 1;i++) - { - for (e = -1;e < td.cy + 1;e++) - { + for (i = -1; i < td.cx + 1; i++) { + for (e = -1; e < td.cy + 1; e++) { Map->SmoothAllAt(cur_pos + i + (e)*isosize); } } @@ -1230,9 +1133,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) m_drag = FALSE; - } - else if (m_drag && AD.mode == ACTIONMODE_CLIFFFRONT) - { + } else if (m_drag && AD.mode == ACTIONMODE_CLIFFFRONT) { RECT affect; if (m_mapx < x) affect.left = m_mapx - 2; else affect.left = x - 2; if (m_mapx < x) affect.right = x + 2; else affect.right = m_mapx + 2; @@ -1251,9 +1152,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->TakeSnapshot(TRUE, affect.left, affect.top, affect.right, affect.bottom); Map->Undo(); Map->Undo(); - } - else if (m_drag && AD.mode == ACTIONMODE_CLIFFBACK) - { + } else if (m_drag && AD.mode == ACTIONMODE_CLIFFBACK) { RECT affect; if (m_mapx < x) affect.left = m_mapx - 2; else affect.left = x - 2; if (m_mapx < x) affect.right = x + 2; else affect.right = m_mapx + 2; @@ -1272,29 +1171,21 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->TakeSnapshot(TRUE, affect.left, affect.top, affect.right, affect.bottom); Map->Undo(); Map->Undo(); - } - else if (AD.mode == ACTIONMODE_COPY && m_drag) - { + } else if (AD.mode == ACTIONMODE_COPY && m_drag) { last_succeeded_operation = 80301; //bugtracing once more int x1, x2, y1, y2; - if (m_mapx < x) - { + if (m_mapx < x) { x1 = m_mapx; x2 = x; - } - else - { + } else { x1 = x; x2 = m_mapx; } - if (m_mapy < y) - { + if (m_mapy < y) { y1 = m_mapy; y2 = y; - } - else - { + } else { y1 = y; y2 = m_mapy; } @@ -1311,10 +1202,8 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) int i, e; int isosize = Map->GetIsoSize(); - for (i = 0;i < x2 - x1 + 1;i++) - { - for (e = 0;e < y2 - y1 + 1;e++) - { + for (i = 0; i < x2 - x1 + 1; i++) { + for (e = 0; e < y2 - y1 + 1; e++) { last_succeeded_operation = 80302; int x_s = x1 + i; int y_s = y1 + e; @@ -1337,15 +1226,12 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) RenderUIOverlay(); FlipHighResBuffer(); last_succeeded_operation = 80304; - } - else if (AD.mode == ACTIONMODE_PASTE) - { + } else if (AD.mode == ACTIONMODE_PASTE) { Map->TakeSnapshot(); Map->Paste(x, y, AD.z_data); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); Map->Undo(); - } - else if ((AD.mode == ACTIONMODE_PLACE || AD.mode == ACTIONMODE_RANDOMTERRAIN) && (nFlags & ~MK_CONTROL) == 0 && AD.type != 7 && (AD.type != 6 || (AD.type == 6 && ((AD.data >= 30 && AD.data <= 33) || AD.data == 2 || AD.data == 3)))) // everything placing but not overlay! + } else if ((AD.mode == ACTIONMODE_PLACE || AD.mode == ACTIONMODE_RANDOMTERRAIN) && (nFlags & ~MK_CONTROL) == 0 && AD.type != 7 && (AD.type != 6 || (AD.type == 6 && ((AD.data >= 30 && AD.data <= 33) || AD.data == 2 || AD.data == 3)))) // everything placing but not overlay! { FIELDDATA oldData[32][32]; INFANTRY infData[SUBPOS_COUNT][32][32]; @@ -1353,13 +1239,11 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) //if(AD.type!=1 || Map->GetInfantryCountAt(x+y*Map->GetIsoSize())==0) { - for (i = 0;i < 32;i++) - { - for (e = 0;e < 32;e++) - { + for (i = 0; i < 32; i++) { + for (e = 0; e < 32; e++) { oldData[i][e] = *Map->GetFielddataAt(i + x + (e + y) * Map->GetIsoSize()); int z; - for (z = 0;z < SUBPOS_COUNT;z++) + for (z = 0; z < SUBPOS_COUNT; z++) if (oldData[i][e].infantry[z] > -1) Map->GetInfantryData(oldData[i][e].infantry[z], &infData[z][i][e]); } @@ -1368,10 +1252,8 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) PlaceCurrentObjectAt(x, y); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - for (i = 0;i < 32;i++) - { - for (e = 0;e < 32;e++) - { + for (i = 0; i < 32; i++) { + for (e = 0; e < 32; e++) { DWORD dwPos = i + x + (e + y) * Map->GetIsoSize(); FIELDDATA cur_field; cur_field = *Map->GetFielddataAt(dwPos); @@ -1379,14 +1261,12 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) if (cur_field.aircraft != oldData[i][e].aircraft) Map->DeleteAircraft(cur_field.aircraft); int z; - for (z = 0;z < SUBPOS_COUNT;z++) - if (cur_field.infantry[z] != oldData[i][e].infantry[z]) - { + for (z = 0; z < SUBPOS_COUNT; z++) + if (cur_field.infantry[z] != oldData[i][e].infantry[z]) { Map->DeleteInfantry(cur_field.infantry[z]); } - if (cur_field.node.index != oldData[i][e].node.index) - { + if (cur_field.node.index != oldData[i][e].node.index) { CString house; int id = Map->GetNodeAt(dwPos, house); Map->DeleteNode(house, id); @@ -1414,9 +1294,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) //else // RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else - { + } else { SurfaceLocker locker(lpdsBack); auto desc = locker.ensure_locked(); @@ -1431,7 +1309,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) FlipHighResBuffer(); } } - + @@ -1454,8 +1332,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) // drag - if (m_drag && AD.mode == 0) - { + if (m_drag && AD.mode == 0) { RedrawWindow(NULL, NULL, RDW_INVALIDATE); CPaintDC dc(this); @@ -1467,31 +1344,24 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) dc.MoveTo(from.x, from.y); dc.LineTo(to.x, to.y); - } - else if (AD.mode == ACTIONMODE_SETTILE && (nFlags & MK_LBUTTON) && ((nFlags & MK_SHIFT) || Map->hasLat(AD.type)) && !(nFlags & MK_CONTROL)) - { + } else if (AD.mode == ACTIONMODE_SETTILE && (nFlags & MK_LBUTTON) && ((nFlags & MK_SHIFT) || Map->hasLat(AD.type)) && !(nFlags & MK_CONTROL)) { // Sound(SOUND_LAYDOWNTILE); // too many sounds PlaceTile(x, y, nFlags); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); isMoving = FALSE; return; - } - else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_HEIGHTEN) - { + } else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_HEIGHTEN) { OnLButtonDown(nFlags, point); isMoving = FALSE; return; - } - else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_LOWER) - { + } else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_LOWER) { OnLButtonDown(nFlags, point); isMoving = FALSE; return; } - else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_FLATTENGROUND) - { + else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_FLATTENGROUND) { m_TileChangeCount = 0; // if(abs(m_FlattenLastX-x)<2 && abs(m_FlattenLastY-y)<2) //ReachableFrom(x+y*Map->GetIsoSize(), m_mapx+m_mapy*Map->GetIsoSize())) @@ -1510,10 +1380,8 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) int n, m; int isosize = Map->GetIsoSize(); - for (m = left;m < right;m++) - { - for (n = top;n < bottom;n++) - { + for (m = left; m < right; m++) { + for (n = top; n < bottom; n++) { int pos = x + m + (y + n) * isosize; int ground = Map->GetFielddataAt(pos)->wGround; @@ -1525,8 +1393,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) - if (!(*tiledata)[ground].bMorphable) - { + if (!(*tiledata)[ground].bMorphable) { { if (n <= 0 /*&& !(*tiledata)[ground1].bMorphable*/) top = n + 1; @@ -1537,13 +1404,11 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) } - if (n < top) - { + if (n < top) { m = left; n = top; } - if (m < left) - { + if (m < left) { n = top; m = left; } @@ -1555,20 +1420,17 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) m_funcRect.bottom = y; m_funcRect.right = x; - for (m = left;m < right;m++) - { - for (n = top;n < bottom;n++) - { + for (m = left; m < right; m++) { + for (n = top; n < bottom; n++) { int ground = Map->GetFielddataAt(x + m + (y + n) * Map->GetIsoSize())->wGround; if (ground == 0xFFFF) ground = 0; - if ((*tiledata)[ground].bMorphable) - { + if ((*tiledata)[ground].bMorphable) { int i; int max = isosize * isosize; - for (i = 0;i < max;i++) + for (i = 0; i < max; i++) Map->SetReserved(i, 0); @@ -1578,9 +1440,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) - } - else - { + } else { if (n == 0 && m == 0) doNotSave = TRUE; @@ -1597,46 +1457,35 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) */ ASSERT(m_funcRect.left <= m_funcRect.right); ASSERT(m_funcRect.top <= m_funcRect.bottom); - for (m = m_funcRect.left - 1;m <= m_funcRect.right + 1;m++) - for (n = m_funcRect.top - 1;n <= m_funcRect.bottom + 1;n++) + for (m = m_funcRect.left - 1; m <= m_funcRect.right + 1; m++) + for (n = m_funcRect.top - 1; n <= m_funcRect.bottom + 1; n++) Map->CreateSlopesAt(m + n * isosize); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - if (!doNotSave) - { + if (!doNotSave) { m_FlattenLastX = x; m_FlattenLastY = y; } } - } - else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_HEIGHTENTILE) - { + } else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_HEIGHTENTILE) { OnLButtonDown(nFlags, point); - } - else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_LOWERTILE) - { + } else if ((nFlags & MK_LBUTTON) && (nFlags & MK_SHIFT) && AD.mode == ACTIONMODE_LOWERTILE) { OnLButtonDown(nFlags, point); - } - else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_WAYPOINT) // waypoints + } else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_WAYPOINT) // waypoints { - if (AD.type == 1) - { + if (AD.type == 1) { //delete waypoint int w = Map->GetWaypointAt(x + y * Map->GetIsoSize()); - if (w < 0) - { + if (w < 0) { isMoving = FALSE; return; } Map->DeleteWaypoint(w); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 0) - { + } else if (AD.type == 0) { int n = Map->GetWaypointAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { isMoving = FALSE; return; } @@ -1644,12 +1493,9 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->AddWaypoint("", x + y * Map->GetIsoSize()); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type >= 3) - { + } else if (AD.type >= 3) { int n = Map->GetWaypointAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { isMoving = FALSE; return; } @@ -1666,20 +1512,17 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) int i; int e; int notfound = -1; - for (e = 0;e < max;e++) - { + for (e = 0; e < max; e++) { BOOL bFound = FALSE; - for (i = 0;i < Map->GetWaypointCount();i++) - { + for (i = 0; i < Map->GetWaypointCount(); i++) { CString id; DWORD pos; Map->GetWaypointData(i, &id, &pos); if (atoi(id) == e) bFound = TRUE; if (bFound) break; } - if (!bFound) - { + if (!bFound) { notfound = e; break; } @@ -1691,47 +1534,37 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) itoa(max, c, 10); - if (!Map->IsMultiplayer()) - { + if (!Map->IsMultiplayer()) { Map->AddWaypoint("99", x + (y + 1) * Map->GetIsoSize()); Map->AddWaypoint("98", x + (y)*Map->GetIsoSize()); - } - else - { + } else { Map->AddWaypoint(c, x + y * Map->GetIsoSize()); } RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - } - else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_CELLTAG) // celltags + } else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_CELLTAG) // celltags { - if (AD.type == 1) - { + if (AD.type == 1) { int n = Map->GetCelltagAt(x + y * Map->GetIsoSize()); - if (n < 0) - { + if (n < 0) { isMoving = FALSE; return; } Map->DeleteCelltag(n); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 4) - { + } else if (AD.type == 4) { Map->AddCelltag(AD.data_s, x + y * Map->GetIsoSize()); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - } - else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_NODE) // nodes + } else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_NODE) // nodes { if (AD.type == 1) // create node, delete building { int n = Map->GetStructureAt(x + y * Map->GetIsoSize()); - if (n < 0) - { + if (n < 0) { isMoving = FALSE; return; } @@ -1740,8 +1573,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->GetStdStructureData(n, &sod); CString tmp; - if (Map->GetNodeAt(atoi(sod.x) + atoi(sod.y) * Map->GetIsoSize(), tmp) >= 0) - { + if (Map->GetNodeAt(atoi(sod.x) + atoi(sod.y) * Map->GetIsoSize(), tmp) >= 0) { SetError("You cannot place a node on another node"); { isMoving = FALSE; @@ -1760,12 +1592,10 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->AddNode(&node, 0); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 0) // create node, don´t delete building + } else if (AD.type == 0) // create node, don´t delete building { int n = Map->GetStructureAt(x + y * Map->GetIsoSize()); - if (n < 0) - { + if (n < 0) { isMoving = FALSE; return; } @@ -1774,8 +1604,7 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->GetStdStructureData(n, &sod); CString tmp; - if (Map->GetNodeAt(atoi(sod.x) + atoi(sod.y) * Map->GetIsoSize(), tmp) >= 0) - { + if (Map->GetNodeAt(atoi(sod.x) + atoi(sod.y) * Map->GetIsoSize(), tmp) >= 0) { SetError("You cannot place a node on another node"); { isMoving = FALSE; @@ -1792,13 +1621,11 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) Map->AddNode(&node, 0); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 2) // delete node + } else if (AD.type == 2) // delete node { CString owner; int n = Map->GetNodeAt(x + y * Map->GetIsoSize(), owner); - if (n < 0) - { + if (n < 0) { isMoving = FALSE; return; } @@ -1807,60 +1634,48 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - } - else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_ERASEFIELD) - { + } else if ((nFlags == MK_LBUTTON) && AD.mode == ACTIONMODE_ERASEFIELD) { int h; DWORD dwPos = x + y * Map->GetIsoSize(); h = Map->GetInfantryAt(dwPos); - if (h > -1) - { + if (h > -1) { Map->DeleteInfantry(h); } h = Map->GetUnitAt(dwPos); - if (h > -1) - { + if (h > -1) { Map->DeleteUnit(h); } h = Map->GetStructureAt(dwPos); - if (h > -1) - { + if (h > -1) { Map->DeleteStructure(h); } h = Map->GetAirAt(dwPos); - if (h > -1) - { + if (h > -1) { Map->DeleteAircraft(h); } h = Map->GetTerrainAt(dwPos); - if (h > -1) - { + if (h > -1) { Map->DeleteTerrain(h); } #ifdef SMUDGE_SUPP const FIELDDATA& fd = *Map->GetFielddataAt(dwPos); h = fd.smudge; - if (h > -1) - { + if (h > -1) { Map->DeleteSmudge(h); } #endif RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_MAPTOOL) - { + } else if (AD.mode == ACTIONMODE_MAPTOOL) { if (AD.tool) AD.tool->onMouseMove(projCoords, mapCoords, MapToolMouseFlagsFromWin32(nFlags)); - } - else if ((nFlags & MK_LBUTTON) == MK_LBUTTON && (AD.mode == ACTIONMODE_PLACE || AD.mode == ACTIONMODE_RANDOMTERRAIN)) - { + } else if ((nFlags & MK_LBUTTON) == MK_LBUTTON && (AD.mode == ACTIONMODE_PLACE || AD.mode == ACTIONMODE_RANDOMTERRAIN)) { // ADD OBJECTS if (AD.mode == ACTIONMODE_PLACE && AD.type == 6) Map->TakeSnapshot(); @@ -1873,13 +1688,10 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) int x = mapCoords.x; int y = mapCoords.y; - if (abs(x - m_mapx) >= abs(y - m_mapy)) - { + if (abs(x - m_mapx) >= abs(y - m_mapy)) { // it´s from bottom left to top right y = m_mapy; - } - else - { + } else { // from bottom right to top left x = m_mapx; } @@ -1926,16 +1738,13 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) FlipHighResBuffer(); //lpds->Blt(NULL, lpdsBack, NULL, 0, 0); - } - else - { + } else { PlaceCurrentObjectAt(x, y); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - if (AD.mode == ACTIONMODE_PLACE && AD.type == 6) - { + if (AD.mode == ACTIONMODE_PLACE && AD.type == 6) { Map->TakeSnapshot(); Map->Undo(); } @@ -1957,13 +1766,13 @@ void CIsoView::OnMouseMove(UINT nFlags, CPoint point) void CIsoView::DrawCellCursor(const MapCoords& mapCoords, const DDSURFACEDESC2& desc) { - ProjectedVec drawOffset(0*4, 0*3); + ProjectedVec drawOffset(0 * 4, 0 * 3); ProjectedCoords drawCoords2d = GetRenderTargetCoordinates(mapCoords, 0) + drawOffset; ProjectedCoords drawCoords = GetRenderTargetCoordinates(mapCoords) + drawOffset; - static const COLORREF _cell_hilight_colors[16] = { + static const COLORREF _cell_hilight_colors[16] = { RGB(255, 255, 255), // level 0 - RGB( 170, 0, 170), // level 1 + RGB(170, 0, 170), // level 1 RGB(0, 170, 170), // level 2 RGB(0, 170, 0), // level 3 RGB(90, 255, 90), // level 4 @@ -1985,7 +1794,7 @@ void CIsoView::DrawCellCursor(const MapCoords& mapCoords, const DDSURFACEDESC2& int new_tileheight = std::clamp(tileheight, 0, 16); DrawCell(desc.lpSurface, desc.dwWidth, desc.dwHeight, desc.lPitch, drawCoords.x, drawCoords.y, 1, 1, m_color_converter->GetColor(_cell_hilight_colors[new_tileheight]), false, true, m_color_converter->GetColor(60, 60, 255)); - + LineDrawer l(desc.lpSurface, bpp, desc.dwWidth, desc.dwHeight, desc.lPitch); POINT p1, p2, p3, p4; @@ -2005,10 +1814,8 @@ void CIsoView::DrawCellCursor(const MapCoords& mapCoords, const DDSURFACEDESC2& p8.y = drawCoords.y + 1 * f_y / 2 - 1; auto col = m_color_converter->GetColor(60, 60, 60); - if (drawCoords2d != drawCoords) - { - for (int y = 0; y < 2; ++y) - { + if (drawCoords2d != drawCoords) { + for (int y = 0; y < 2; ++y) { l.MoveTo(p2.x + 1, p2.y + y); l.LineTo(p6.x + 1, p6.y + y, col, LineStyle::Dotted_4); l.MoveTo(p3.x, p3.y + 1 + y); @@ -2031,8 +1838,7 @@ const int valadded = 10000; void CIsoView::OnRButtonUp(UINT nFlags, CPoint point) { - if (rscroll) - { + if (rscroll) { if (b_IsLoading) return; ReleaseCapture(); @@ -2044,8 +1850,7 @@ void CIsoView::OnRButtonUp(UINT nFlags, CPoint point) } - if (nFlags == 0 && point.x == 0 && point.y == 0) - { + if (nFlags == 0 && point.x == 0 && point.y == 0) { m_drag = FALSE; return; } @@ -2062,17 +1867,14 @@ void CIsoView::OnRButtonUp(UINT nFlags, CPoint point) const int y = mapCoords.y; // context menu - if (AD.mode != 0 && !rscroll) - { + if (AD.mode != 0 && !rscroll) { bool ignoreClick = false; - if (AD.mode == ACTIONMODE_MAPTOOL) - { + if (AD.mode == ACTIONMODE_MAPTOOL) { if (AD.tool) ignoreClick = AD.tool->onRButtonUp(projCoords, mapCoords, MapToolMouseFlagsFromWin32(nFlags)); } - if (!ignoreClick) - { + if (!ignoreClick) { AD.reset(); CMyViewFrame& frame = *((CMyViewFrame*)owner); @@ -2101,33 +1903,24 @@ BOOL CIsoView::OnCommand(WPARAM wParam, LPARAM lParam) CIniFile& ini = Map->GetIniFile(); - if (wID < valadded) - { + if (wID < valadded) { // a standard menu, no popup! - switch (wID) - { + switch (wID) { case 4: { last_succeeded_operation = 54310; //get the number - if (Map->GetAirAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) - { + if (Map->GetAirAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) { HandleProperties(Map->GetAirAt(m_mapx + m_mapy * Map->GetIsoSize()), 2); - } - else if (Map->GetInfantryAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) - { + } else if (Map->GetInfantryAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) { last_succeeded_operation = 54311; int z; - for (z = 0;z < SUBPOS_COUNT;z++) + for (z = 0; z < SUBPOS_COUNT; z++) if (Map->GetInfantryAt(m_mapx + m_mapy * Map->GetIsoSize(), z) != -1) HandleProperties(Map->GetInfantryAt(m_mapx + m_mapy * Map->GetIsoSize(), z), 0); - } - else if (Map->GetUnitAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) - { + } else if (Map->GetUnitAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) { HandleProperties(Map->GetUnitAt(m_mapx + m_mapy * Map->GetIsoSize()), 3); - } - else if (Map->GetStructureAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) - { + } else if (Map->GetStructureAt(m_mapx + m_mapy * Map->GetIsoSize()) != -1) { HandleProperties(Map->GetStructureAt(m_mapx + m_mapy * Map->GetIsoSize()), 1); } @@ -2152,8 +1945,7 @@ void CIsoView::HandleProperties(int n, int type) CIniFile& ini = Map->GetIniFile(); if (n < 0) return; - switch (type) - { + switch (type) { case 0: { last_succeeded_operation = 54312; @@ -2321,13 +2113,10 @@ void CIsoView::OnLButtonDblClk(UINT nFlags, CPoint point) const auto projCoords = GetProjectedCoordinatesFromClientCoordinates(point); const MapCoords mapCoords = GetMapCoordinatesFromClientCoordinates(point, (nFlags & MK_CONTROL) == MK_CONTROL); - if (AD.mode == ACTIONMODE_MAPTOOL) - { + if (AD.mode == ACTIONMODE_MAPTOOL) { if (AD.tool) AD.tool->onLButtonDblClick(projCoords, mapCoords, MapToolMouseFlagsFromWin32(nFlags)); - } - else - { + } else { if (!Map->isInside(mapCoords)) return; @@ -2335,11 +2124,9 @@ void CIsoView::OnLButtonDblClk(UINT nFlags, CPoint point) m_mapy = mapCoords.y; int pos = m_mapx + m_mapy * Map->GetIsoSize(); - if (Map->GetCelltagAt(pos) < 0) - { + if (Map->GetCelltagAt(pos) < 0) { OnCommand(4, 0); - } - else + } else OnCommand(9, 0); } @@ -2359,7 +2146,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) const auto projCoords = GetProjectedCoordinatesFromClientCoordinates(point); const MapCoords mapCoords = GetMapCoordinatesFromClientCoordinates(point, (nFlags & MK_CONTROL) == MK_CONTROL); - + const int x = mapCoords.x; // compat const int y = mapCoords.y; @@ -2368,8 +2155,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) int mapwidth = Map->GetWidth(); int mapheight = Map->GetHeight(); //if(x>=Map->GetIsoSize() || y>=Map->GetIsoSize() || x<0 || y<0) return; - if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE && AD.mode != ACTIONMODE_MAPTOOL) - { + if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE && AD.mode != ACTIONMODE_MAPTOOL) { if (!Map->isInside(mapCoords)) return; if (x < 1 || y < 1 || x + ymapwidth + mapheight * 2 || (y + 1 > mapwidth && x - 1 < y - mapwidth) || (x + 1 > mapwidth && y + mapwidth - 1 < x)) @@ -2384,44 +2170,31 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) CStatusBarCtrl& stat = ((CMyViewFrame*)owner)->m_statbar.GetStatusBarCtrl(); - if (AD.mode == ACTIONMODE_CLIFFFRONT || AD.mode == ACTIONMODE_CLIFFBACK) - { + if (AD.mode == ACTIONMODE_CLIFFFRONT || AD.mode == ACTIONMODE_CLIFFBACK) { m_drag = TRUE; - } - else if (AD.mode == ACTIONMODE_PASTE) - { + } else if (AD.mode == ACTIONMODE_PASTE) { Map->TakeSnapshot(); Map->Paste(m_mapx, m_mapy, AD.z_data); Map->TakeSnapshot(); Map->Undo(); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_COPY) - { - if (!m_drag) - { + } else if (AD.mode == ACTIONMODE_COPY) { + if (!m_drag) { m_drag = TRUE; - } - else // 2nd click + } else // 2nd click { int x1, x2, y1, y2; - if (px < x) - { + if (px < x) { x1 = px; x2 = x; - } - else - { + } else { x1 = x; x2 = px; } - if (py < y) - { + if (py < y) { y1 = py; y2 = y; - } - else - { + } else { y1 = y; y2 = py; } @@ -2431,30 +2204,24 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) m_drag = FALSE; } - } - else if (Map->IsGroundObjectAt(m_mapx + m_mapy * Map->GetIsoSize()) && AD.mode == 0 && m_NoMove == FALSE) - { + } else if (Map->IsGroundObjectAt(m_mapx + m_mapy * Map->GetIsoSize()) && AD.mode == 0 && m_NoMove == FALSE) { m_drag = TRUE; m_moved = FALSE; m_id = Map->GetInfantryAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 0; - if (m_id < 0) - { + if (m_id < 0) { m_id = Map->GetUnitAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 3; } - if (m_id < 0) - { + if (m_id < 0) { m_id = Map->GetAirAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 2; } - if (m_id < 0) - { + if (m_id < 0) { m_id = Map->GetTerrainAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 4; } - if (m_id < 0) - { + if (m_id < 0) { m_id = Map->GetStructureAt(m_mapx + m_mapy * Map->GetIsoSize()); STDOBJECTDATA sod; @@ -2465,31 +2232,25 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) m_type = 1; } - } - else if (AD.mode == ACTIONMODE_SETTILE) - { + } else if (AD.mode == ACTIONMODE_SETTILE) { - if ((nFlags & MK_CONTROL) && !(nFlags & MK_SHIFT)) - { + if ((nFlags & MK_CONTROL) && !(nFlags & MK_SHIFT)) { // Fill the whole area Sound(SOUND_LAYDOWNTILE); Map->TakeSnapshot(); int i; - for (i = 0;i < Map->GetIsoSize() * Map->GetIsoSize();i++) + for (i = 0; i < Map->GetIsoSize() * Map->GetIsoSize(); i++) Map->SetReserved(i, 0); FillArea(x, y, AD.type, 0); Map->TakeSnapshot(); Map->Undo(); - } - else - { + } else { // just place a single tile - if (!(nFlags & MK_SHIFT)) - { + if (!(nFlags & MK_SHIFT)) { Sound(SOUND_LAYDOWNTILE); } @@ -2500,23 +2261,17 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_HIDETILESET) - { + } else if (AD.mode == ACTIONMODE_HIDETILESET) { int ground = Map->GetFielddataAt(x + (y)*Map->GetIsoSize())->wGround; if (ground == 0xFFFF) ground = 0; //if(ground!=0) HideTileSet((*tiledata)[ground].wTileSet); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_HIDEFIELD) - { + } else if (AD.mode == ACTIONMODE_HIDEFIELD) { Map->HideField(x + y * Map->GetIsoSize(), TRUE); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_HEIGHTEN) - { + } else if (AD.mode == ACTIONMODE_HEIGHTEN) { Map->TakeSnapshot(); m_TileChangeCount = 0; @@ -2526,8 +2281,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) int ground = Map->GetFielddataAt(x + (y)*Map->GetIsoSize())->wGround; if (ground == 0xFFFF) ground = 0; - if ((nFlags & MK_CONTROL) && !(*tiledata)[ground].bMorphable) - { + if ((nFlags & MK_CONTROL) && !(*tiledata)[ground].bMorphable) { SetError("Applying non-morphable terrain height change, please wait..."); stat.RedrawWindow(); stat.UpdateWindow(); @@ -2538,65 +2292,51 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) m_funcRect.bottom = y; m_funcRect.right = x; - if ((*tiledata)[ground].bMorphable) - { + if ((*tiledata)[ground].bMorphable) { int f, n; int oheight = Map->GetHeightAt(x + y * Map->GetIsoSize()); - for (f = -m_BrushSize_x / 2;f < m_BrushSize_x / 2 + 1;f++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (f = -m_BrushSize_x / 2; f < m_BrushSize_x / 2 + 1; f++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { int pos = x + f + (y + n) * Map->GetIsoSize(); int ground = Map->GetFielddataAt(pos)->wGround; if (ground == 0xFFFF) ground = 0; - if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(pos) == oheight) - { + if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(pos) == oheight) { Map->SetHeightAt(pos, oheight + 1); } } } - for (f = -m_BrushSize_x / 2;f < m_BrushSize_x / 2 + 1;f++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (f = -m_BrushSize_x / 2; f < m_BrushSize_x / 2 + 1; f++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { int pos = x + f + (y + n) * Map->GetIsoSize(); int ground = Map->GetFielddataAt(pos)->wGround; if (ground == 0xFFFF) ground = 0; - if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(x + f + (y + n) * Map->GetIsoSize()) == oheight + 1) - { + if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(x + f + (y + n) * Map->GetIsoSize()) == oheight + 1) { int i; - for (i = 0;i < Map->GetIsoSize() * Map->GetIsoSize();i++) + for (i = 0; i < Map->GetIsoSize() * Map->GetIsoSize(); i++) Map->SetReserved(i, 0); ChangeTileHeight(x + f + (y + n) * Map->GetIsoSize(), oheight + 1, FALSE, (nFlags & MK_CONTROL), TRUE); } } } - } - else - { + } else { int i; - for (i = 0;i < Map->GetIsoSize() * Map->GetIsoSize();i++) + for (i = 0; i < Map->GetIsoSize() * Map->GetIsoSize(); i++) Map->SetReserved(i, 0); // TODO: replace recursion, otherwise be aware of stack issues! - try - { + try { ChangeTileHeight(x + (y)*Map->GetIsoSize(), Map->GetHeightAt(x + y * Map->GetIsoSize()) + 1, FALSE, !(nFlags & MK_CONTROL)); - } - catch (...) - { + } catch (...) { MessageBox("Stack is too small to complete operation!", "Error"); } } int f, n; - for (f = m_funcRect.left - 1;f <= m_funcRect.right + 1;f++) - { - for (n = m_funcRect.top - 1;n <= m_funcRect.bottom + 1;n++) - { + for (f = m_funcRect.left - 1; f <= m_funcRect.right + 1; f++) { + for (n = m_funcRect.top - 1; n <= m_funcRect.bottom + 1; n++) { int pos = f + (n)*Map->GetIsoSize(); Map->CreateSlopesAt(pos); } @@ -2622,9 +2362,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) { // MessageBox("Error occured","Error"); } - } - else if (AD.mode == ACTIONMODE_LOWER) - { + } else if (AD.mode == ACTIONMODE_LOWER) { Map->TakeSnapshot(); m_TileChangeCount = 0; @@ -2634,8 +2372,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) int ground = Map->GetFielddataAt(x + (y)*Map->GetIsoSize())->wGround; if (ground == 0xFFFF) ground = 0; - if ((nFlags & MK_CONTROL) && !(*tiledata)[ground].bMorphable) - { + if ((nFlags & MK_CONTROL) && !(*tiledata)[ground].bMorphable) { SetError("Applying non-morphable terrain height change, please wait..."); stat.RedrawWindow(); stat.UpdateWindow(); @@ -2648,62 +2385,48 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) m_funcRect.bottom = y; m_funcRect.right = x; - if ((*tiledata)[ground].bMorphable) - { + if ((*tiledata)[ground].bMorphable) { int f, n; int oheight = Map->GetHeightAt(x + y * Map->GetIsoSize()); - for (f = -m_BrushSize_x / 2;f < m_BrushSize_x / 2 + 1;f++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (f = -m_BrushSize_x / 2; f < m_BrushSize_x / 2 + 1; f++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { int pos = x + f + (y + n) * Map->GetIsoSize(); int ground = Map->GetFielddataAt(pos)->wGround; if (ground == 0xFFFF) ground = 0; - if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(pos) == oheight) - { + if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(pos) == oheight) { Map->SetHeightAt(pos, oheight - 1); } } } - for (f = -m_BrushSize_x / 2;f < m_BrushSize_x / 2 + 1;f++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (f = -m_BrushSize_x / 2; f < m_BrushSize_x / 2 + 1; f++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { int pos = x + f + (y + n) * Map->GetIsoSize(); int ground = Map->GetFielddataAt(pos)->wGround; if (ground == 0xFFFF) ground = 0; - if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(x + f + (y + n) * Map->GetIsoSize()) == oheight - 1) - { - for (i = 0;i < Map->GetIsoSize() * Map->GetIsoSize();i++) + if ((*tiledata)[ground].bMorphable && Map->GetHeightAt(x + f + (y + n) * Map->GetIsoSize()) == oheight - 1) { + for (i = 0; i < Map->GetIsoSize() * Map->GetIsoSize(); i++) Map->SetReserved(i, 0); ChangeTileHeight(x + f + (y + n) * Map->GetIsoSize(), oheight - 1, FALSE, (nFlags & MK_CONTROL), TRUE); } } } - } - else - { - for (i = 0;i < Map->GetIsoSize() * Map->GetIsoSize();i++) + } else { + for (i = 0; i < Map->GetIsoSize() * Map->GetIsoSize(); i++) Map->SetReserved(i, 0); - try - { + try { ChangeTileHeight(x + (y)*Map->GetIsoSize(), Map->GetHeightAt(x + y * Map->GetIsoSize()) - 1, FALSE, !(nFlags & MK_CONTROL)); - } - catch (...) - { + } catch (...) { MessageBox("Stack is too small to complete operation!", "Error"); } } int f, n; - for (f = m_funcRect.left - 1;f <= m_funcRect.right + 1;f++) - { - for (n = m_funcRect.top - 1;n <= m_funcRect.bottom + 1;n++) - { + for (f = m_funcRect.left - 1; f <= m_funcRect.right + 1; f++) { + for (n = m_funcRect.top - 1; n <= m_funcRect.bottom + 1; n++) { int pos = f + (n)*Map->GetIsoSize(); Map->CreateSlopesAt(pos); } @@ -2727,25 +2450,19 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) Map->TakeSnapshot(); Map->Undo(); - } - else if (AD.mode == ACTIONMODE_HEIGHTENTILE) - { + } else if (AD.mode == ACTIONMODE_HEIGHTENTILE) { Map->TakeSnapshot(); int n, m; - for (m = -m_BrushSize_x / 2;m < m_BrushSize_x / 2 + 1;m++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (m = -m_BrushSize_x / 2; m < m_BrushSize_x / 2 + 1; m++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { Map->SetHeightAt(x + m + (y + n) * Map->GetIsoSize(), Map->GetHeightAt(x + m + (y + n) * Map->GetIsoSize()) + 1); } } if (nFlags & MK_CONTROL) - for (m = -m_BrushSize_x / 2 - 1;m < m_BrushSize_x / 2 + 2;m++) - { - for (n = -m_BrushSize_y / 2 - 1;n < m_BrushSize_y / 2 + 2;n++) - { + for (m = -m_BrushSize_x / 2 - 1; m < m_BrushSize_x / 2 + 2; m++) { + for (n = -m_BrushSize_y / 2 - 1; n < m_BrushSize_y / 2 + 2; n++) { Map->CreateSlopesAt(x + m + (y + n) * Map->GetIsoSize()); } } @@ -2754,25 +2471,19 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) Map->Undo(); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_LOWERTILE) - { + } else if (AD.mode == ACTIONMODE_LOWERTILE) { Map->TakeSnapshot(); int n, m; - for (m = -m_BrushSize_x / 2;m < m_BrushSize_x / 2 + 1;m++) - { - for (n = -m_BrushSize_y / 2;n < m_BrushSize_y / 2 + 1;n++) - { + for (m = -m_BrushSize_x / 2; m < m_BrushSize_x / 2 + 1; m++) { + for (n = -m_BrushSize_y / 2; n < m_BrushSize_y / 2 + 1; n++) { Map->SetHeightAt(x + m + (y + n) * Map->GetIsoSize(), Map->GetHeightAt(x + m + (y + n) * Map->GetIsoSize()) - 1); } } if (nFlags & MK_CONTROL) - for (m = -m_BrushSize_x / 2 - 1;m < m_BrushSize_x / 2 + 2;m++) - { - for (n = -m_BrushSize_y / 2 - 1;n < m_BrushSize_y / 2 + 2;n++) - { + for (m = -m_BrushSize_x / 2 - 1; m < m_BrushSize_x / 2 + 2; m++) { + for (n = -m_BrushSize_y / 2 - 1; n < m_BrushSize_y / 2 + 2; n++) { Map->CreateSlopesAt(x + m + (y + n) * Map->GetIsoSize()); } } @@ -2781,9 +2492,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) Map->Undo(); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_FLATTENGROUND) - { + } else if (AD.mode == ACTIONMODE_FLATTENGROUND) { Map->TakeSnapshot(); m_FlattenHeight = Map->GetHeightAt(x + y * Map->GetIsoSize()); @@ -2792,31 +2501,21 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) Map->TakeSnapshot(); Map->Undo(); - } - else if (Map->GetWaypointAt(m_mapx + m_mapy * Map->GetIsoSize()) >= 0 && AD.mode == 0) - { + } else if (Map->GetWaypointAt(m_mapx + m_mapy * Map->GetIsoSize()) >= 0 && AD.mode == 0) { m_drag = TRUE; m_id = Map->GetWaypointAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 6; - } - else if (Map->GetCelltagAt(m_mapx + m_mapy * Map->GetIsoSize()) >= 0 && AD.mode == 0) - { + } else if (Map->GetCelltagAt(m_mapx + m_mapy * Map->GetIsoSize()) >= 0 && AD.mode == 0) { m_drag = TRUE; m_id = Map->GetCelltagAt(m_mapx + m_mapy * Map->GetIsoSize()); m_type = 5; - } - else if ((AD.mode < 3 || AD.mode>4) || (AD.mode == 3 && AD.type == 0) || (AD.mode >= 3 && AD.mode <= 4 && AD.type == 1)) - { + } else if ((AD.mode < 3 || AD.mode>4) || (AD.mode == 3 && AD.type == 0) || (AD.mode >= 3 && AD.mode <= 4 && AD.type == 1)) { OnMouseMove(nFlags, point); - } - else if (AD.mode == 3) - { - if (AD.type == 2) - { + } else if (AD.mode == 3) { + if (AD.type == 2) { // create waypoint CWaypointID w(this); - if (w.DoModal() != IDCANCEL) - { + if (w.DoModal() != IDCANCEL) { int n = w.m_value; char id[50]; @@ -2829,21 +2528,17 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point) } - else if (AD.mode == 4) - { - if (AD.type == 0) - { + else if (AD.mode == 4) { + if (AD.type == 0) { // create celltag CCellTag w(this); - if (w.DoModal() != IDCANCEL) - { + if (w.DoModal() != IDCANCEL) { Map->AddCelltag(w.m_tag, x + y * Map->GetIsoSize()); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } } - if (AD.type == 2) - { + if (AD.type == 2) { // change celltag properties int n = Map->GetCelltagAt(x + y * Map->GetIsoSize()); if (n < 0) return; @@ -2890,31 +2585,23 @@ void CIsoView::PlaceTile(const int x, const int y, const UINT nMouseFlags) int ground = Map->GetFielddataAt(x + y * Map->GetIsoSize())->wGround; if (ground == 0xFFFF) ground = 0; startheight -= (*tiledata)[ground].tiles[Map->GetFielddataAt(x + y * Map->GetIsoSize())->bSubTile].bZHeight; - for (f = 0;f < m_BrushSize_x;f++) - { - for (n = 0;n < m_BrushSize_y;n++) - { + for (f = 0; f < m_BrushSize_x; f++) { + for (n = 0; n < m_BrushSize_y; n++) { int tile = AD.type; - if (AD.data == 1) - { + if (AD.data == 1) { int n = rand() * 5 / RAND_MAX; tile += n; } p = 0; - for (i = 0;i < (*tiledata)[AD.type].cx;i++) - { - for (e = 0;e < (*tiledata)[AD.type].cy;e++) - { + for (i = 0; i < (*tiledata)[AD.type].cx; i++) { + for (e = 0; e < (*tiledata)[AD.type].cy; e++) { if (x - width + 1 + f * width + i >= Map->GetIsoSize() || - y - height + 1 + n * height + e >= Map->GetIsoSize()) - { + y - height + 1 + n * height + e >= Map->GetIsoSize()) { - } - else - if ((*tiledata)[AD.type].tiles[p].pic != NULL) - { + } else + if ((*tiledata)[AD.type].tiles[p].pic != NULL) { Map->SetHeightAt(pos + i + f * width + (e + n * height) * Map->GetIsoSize(), startheight + (*tiledata)[AD.type].tiles[p].bZHeight); Map->SetTileAt(pos + i + f * width + (e + n * height) * Map->GetIsoSize(), tile, p); @@ -2926,20 +2613,15 @@ void CIsoView::PlaceTile(const int x, const int y, const UINT nMouseFlags) } } - if (!((nMouseFlags & MK_CONTROL) && (nMouseFlags & MK_SHIFT))) - { + if (!((nMouseFlags & MK_CONTROL) && (nMouseFlags & MK_SHIFT))) { if (!theApp.m_Options.bDisableAutoShore) Map->CreateShore(x - 5, y - 5, x + (*tiledata)[AD.type].cx * m_BrushSize_x + 5, y + (*tiledata)[AD.type].cy * m_BrushSize_y + 5, FALSE); //Map->CreateShore(0,0,Map->GetIsoSize(), Map->GetIsoSize()); - for (f = 0;f < m_BrushSize_x;f++) - { - for (n = 0;n < m_BrushSize_y;n++) - { + for (f = 0; f < m_BrushSize_x; f++) { + for (n = 0; n < m_BrushSize_y; n++) { p = 0; - for (i = -1;i < (*tiledata)[AD.type].cx + 1;i++) - { - for (e = -1;e < (*tiledata)[AD.type].cy + 1;e++) - { + for (i = -1; i < (*tiledata)[AD.type].cx + 1; i++) { + for (e = -1; e < (*tiledata)[AD.type].cy + 1; e++) { Map->SmoothAllAt(pos + i + f * width + (e + n * height) * Map->GetIsoSize()); @@ -2969,15 +2651,14 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) const auto projCoords = GetProjectedCoordinatesFromClientCoordinates(point); const MapCoords mapCoords = GetMapCoordinatesFromClientCoordinates(point, (nFlags & MK_CONTROL) == MK_CONTROL); - const int dx = mapCoords.x; // compat + const int dx = mapCoords.x; // compat const int dy = mapCoords.y; //if(dx>=Map->GetIsoSize() || dy>=Map->GetIsoSize() || dx<0 || dy<0) return; int mapwidth = Map->GetWidth(); int mapheight = Map->GetHeight(); - if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE && AD.mode != ACTIONMODE_MAPTOOL) - { + if (AD.mode != ACTIONMODE_COPY && AD.mode != ACTIONMODE_PASTE && AD.mode != ACTIONMODE_MAPTOOL) { if (!Map->isInside(mapCoords)) return; if (dx < 1 || dy < 1 || dx + dymapwidth + mapheight * 2 || (dy + 1 > mapwidth && dx - 1 < dy - mapwidth) || (dx + 1 > mapwidth && dy + mapwidth - 1 < dx)) @@ -2994,20 +2675,17 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) y = dy; // check if user did select something else than 0 in object browser - if (AD.mode != 0 && AD.mode != ACTIONMODE_COPY) - { + if (AD.mode != 0 && AD.mode != ACTIONMODE_COPY) { if (m_moved) m_drag = FALSE; m_moved = FALSE; } - if (AD.mode == ACTIONMODE_FLATTENGROUND) - { + if (AD.mode == ACTIONMODE_FLATTENGROUND) { Map->TakeSnapshot(); Map->Undo(); } - if (AD.mode == ACTIONMODE_CLIFFFRONT || AD.mode == ACTIONMODE_CLIFFBACK) - { + if (AD.mode == ACTIONMODE_CLIFFFRONT || AD.mode == ACTIONMODE_CLIFFBACK) { m_drag = FALSE; Map->Redo(); /*Map->TakeSnapshot(); @@ -3026,8 +2704,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - if (AD.mode == ACTIONMODE_COPY && m_drag) - { + if (AD.mode == ACTIONMODE_COPY && m_drag) { /*m_drag=FALSE; int x1, x2, y1, y2; @@ -3039,8 +2716,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) m_moved = FALSE; } - if (m_drag && m_moved) - { + if (m_drag && m_moved) { m_moved = FALSE; // ok, drag the object at m_mapx/m_mapy to x/y @@ -3048,8 +2724,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) char strX[15], strY[15]; itoa(x, strX, 10); itoa(y, strY, 10); - switch (m_type) - { + switch (m_type) { case 0: // drag infantry { INFANTRY infantry; @@ -3058,8 +2733,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) infantry.y = strY; infantry.pos = "-1"; - if ((nFlags != MK_SHIFT)) - { + if ((nFlags != MK_SHIFT)) { Map->DeleteInfantry(m_id); } @@ -3074,8 +2748,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) structure.x = strX; structure.y = strY; - if ((nFlags != MK_SHIFT)) - { + if ((nFlags != MK_SHIFT)) { Map->DeleteStructure(m_id); } @@ -3091,8 +2764,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) aircraft.y = strY; - if ((nFlags != MK_SHIFT)) - { + if ((nFlags != MK_SHIFT)) { Map->DeleteAircraft(m_id); } @@ -3107,8 +2779,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) unit.x = strX; unit.y = strY; - if (!(nFlags == MK_SHIFT)) - { + if (!(nFlags == MK_SHIFT)) { Map->DeleteUnit(m_id); } @@ -3122,8 +2793,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) Map->GetTerrainData(m_id, &type); - if ((nFlags != MK_SHIFT)) - { + if ((nFlags != MK_SHIFT)) { Map->DeleteTerrain(m_id); } @@ -3137,8 +2807,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) DWORD dwPos; Map->GetCelltagData(m_id, &tag, &dwPos); - if ((nFlags != MK_SHIFT)) - { + if ((nFlags != MK_SHIFT)) { Map->DeleteCelltag(m_id); } @@ -3152,8 +2821,7 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) Map->GetWaypointData(m_id, &ID, &dwPos); - if (!(nFlags == MK_SHIFT)) - { + if (!(nFlags == MK_SHIFT)) { Map->DeleteWaypoint(m_id); } @@ -3172,13 +2840,10 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) line.bottom = 0; RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.mode == ACTIONMODE_MAPTOOL) - { + } else if (AD.mode == ACTIONMODE_MAPTOOL) { if (AD.tool) AD.tool->onLButtonUp(projCoords, mapCoords, MapToolMouseFlagsFromWin32(nFlags)); - } - else if (AD.mode == ACTIONMODE_PLACE) // painting stuff + } else if (AD.mode == ACTIONMODE_PLACE) // painting stuff { m_moved = FALSE; if (AD.type == 6) // Overlay @@ -3188,14 +2853,11 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) if (x == m_mapx && y == m_mapy) return; int ovrltype = 0x18; - if (abs(x - m_mapx) >= abs(y - m_mapy)) - { + if (abs(x - m_mapx) >= abs(y - m_mapy)) { // it´s from bottom left to top right y = m_mapy; ovrltype = 0x19; - } - else - { + } else { // from bottom right to top left x = m_mapx; ovrltype = 0x18; @@ -3203,14 +2865,12 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) int tmp; - if (x < m_mapx) - { + if (x < m_mapx) { tmp = m_mapx; m_mapx = x; x = tmp; } - if (y < m_mapy) - { + if (y < m_mapy) { tmp = m_mapy; m_mapy = y; y = tmp; @@ -3222,46 +2882,32 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) { int startheight = Map->GetFielddataAt(m_mapx + m_mapy * Map->GetIsoSize())->bHeight; - if (y == m_mapy) - { - for (i = m_mapx;i <= x;i++) - { - if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight - 4) - { + if (y == m_mapy) { + for (i = m_mapx; i <= x; i++) { + if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight - 4) { startheight = Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight; break; } } - } - else - { - for (i = m_mapy;i <= y;i++) - { - if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight - 4) - { + } else { + for (i = m_mapy; i <= y; i++) { + if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight - 4) { startheight = Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight; break; } } } - if (y == m_mapy) - { - for (i = m_mapx;i <= x;i++) - { - if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight) - { + if (y == m_mapy) { + for (i = m_mapx; i <= x; i++) { + if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight) { Map->SetOverlayAt(i + m_mapy * Map->GetIsoSize(), ovrltype); Map->SetOverlayDataAt(i + m_mapy * Map->GetIsoSize(), 0x9); } } - } - else - { - for (i = m_mapy;i <= y;i++) - { - if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight) - { + } else { + for (i = m_mapy; i <= y; i++) { + if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight) { Map->SetOverlayAt(m_mapx + i * Map->GetIsoSize(), ovrltype); Map->SetOverlayDataAt(m_mapx + i * Map->GetIsoSize(), 0x0); } @@ -3272,35 +2918,25 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) { int startheight = Map->GetFielddataAt(m_mapx + m_mapy * Map->GetIsoSize())->bHeight; - if (y == m_mapy) - { - for (i = m_mapx;i <= x;i++) - { - if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight - 4) - { + if (y == m_mapy) { + for (i = m_mapx; i <= x; i++) { + if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight - 4) { startheight = Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight; break; } } - } - else - { - for (i = m_mapy;i <= y;i++) - { - if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight - 4) - { + } else { + for (i = m_mapy; i <= y; i++) { + if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight - 4) { startheight = Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight; break; } } } - if (y == m_mapy) - { - for (i = m_mapx;i <= x;i++) - { - if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight) - { + if (y == m_mapy) { + for (i = m_mapx; i <= x; i++) { + if (Map->GetFielddataAt(i + m_mapy * Map->GetIsoSize())->bHeight == startheight) { Map->SetOverlayAt(i + m_mapy * Map->GetIsoSize(), 0x3c); #ifdef RA2_MODE @@ -3309,13 +2945,9 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) Map->SetOverlayDataAt(i + m_mapy * Map->GetIsoSize(), 0x9); } } - } - else - { - for (i = m_mapy;i <= y;i++) - { - if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight) - { + } else { + for (i = m_mapy; i <= y; i++) { + if (Map->GetFielddataAt(m_mapx + i * Map->GetIsoSize())->bHeight == startheight) { Map->SetOverlayAt(m_mapx + i * Map->GetIsoSize(), 0x3b); #ifdef RA2_MODE Map->SetOverlayAt(m_mapx + i * Map->GetIsoSize(), 0xed); @@ -3341,17 +2973,14 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) Map->SetOverlayDataAt(m_mapx+i*Map->GetIsoSize(), 0x0); } }*/ - } - else if (AD.data2 == 1 || AD.data2 == 3) // small bridge + } else if (AD.data2 == 1 || AD.data2 == 3) // small bridge { int start = 0x4a; if (AD.data2 == 3) start = 0xcd; - if (y == m_mapy) - { + if (y == m_mapy) { srand((unsigned)time(NULL)); - for (i = m_mapx + 1;i <= x - 1;i++) - { + for (i = m_mapx + 1; i <= x - 1; i++) { int v2 = ((float)rand() / (float)RAND_MAX) * 4; @@ -3377,13 +3006,10 @@ void CIsoView::OnLButtonUp(UINT nFlags, CPoint point) Map->SetOverlayDataAt(x + (m_mapy + 1) * Map->GetIsoSize(), 0x2); - } - else - { + } else { srand((unsigned)time(NULL)); - for (i = m_mapy + 1;i <= y - 1;i++) - { + for (i = m_mapy + 1; i <= y - 1; i++) { int v2 = ((float)rand() / (float)RAND_MAX) * 4; @@ -3465,7 +3091,7 @@ void CIsoView::OnMove(int x, int y) ddc->SetHWnd(0, m_hWnd); updateFontScaled(); - RedrawWindow(); + RedrawWindow(); } void CIsoView::OnSize(UINT nType, int cx, int cy) @@ -3497,8 +3123,7 @@ COLORREF CIsoView::GetColor(const char* house, const char* vcolor) CString color; CIniFile& ini = Map->GetIniFile(); - if (house && strlen(house)) - { + if (house && strlen(house)) { auto const& localColorDef = ini.GetString(house, "Color"); if (!localColorDef.IsEmpty()) { color = localColorDef; @@ -3514,8 +3139,7 @@ COLORREF CIsoView::GetColor(const char* house, const char* vcolor) CString colorValues; colorValues = ini.GetStringOr("Colors", color, rules.GetString("Colors", color)); auto colorArray = SplitParams(colorValues); - if (colorArray.size() == 3) - { + if (colorArray.size() == 3) { unsigned char hsv[3] = { static_cast(std::atoi(colorArray[0])), static_cast(std::atoi(colorArray[1])), static_cast(std::atoi(colorArray[2])) }; unsigned char rgb[3]; HSVToRGB(hsv, rgb); @@ -3524,30 +3148,20 @@ COLORREF CIsoView::GetColor(const char* house, const char* vcolor) } #ifndef RA2_MODE - if (strstr(house, houses[0].name) != NULL) - { + if (strstr(house, houses[0].name) != NULL) { return GDI; - } - else if (strstr(house, houses[1].name) != NULL) - { + } else if (strstr(house, houses[1].name) != NULL) { return Nod; - } - else if (strstr(house, houses[2].name) != NULL) - { + } else if (strstr(house, houses[2].name) != NULL) { return neutral; - } - else - { - if (isIncluded(color, "darkred") != NULL) - { + } else { + if (isIncluded(color, "darkred") != NULL) { return Nod; } - if (isIncluded(color, "grey") != NULL) - { + if (isIncluded(color, "grey") != NULL) { return RGB(120, 120, 120); } - if (isIncluded(color, "gold") != NULL) - { + if (isIncluded(color, "gold") != NULL) { return GDI; } @@ -3555,52 +3169,40 @@ COLORREF CIsoView::GetColor(const char* house, const char* vcolor) return other; } #else - if (isIncluded(color, "darkred") != NULL) - { + if (isIncluded(color, "darkred") != NULL) { return RGB(130, 20, 20); } - if (isIncluded(color, "grey") != NULL) - { + if (isIncluded(color, "grey") != NULL) { return RGB(120, 120, 120); } - if (isIncluded(color, "red") != NULL) - { + if (isIncluded(color, "red") != NULL) { return RGB(240, 20, 20); } - if (isIncluded(color, "lightgold") != NULL) - { + if (isIncluded(color, "lightgold") != NULL) { return RGB(220, 220, 150); } - if (isIncluded(color, "yellow") != NULL) - { + if (isIncluded(color, "yellow") != NULL) { return RGB(240, 240, 0); } - if (isIncluded(color, "gold") != NULL) - { + if (isIncluded(color, "gold") != NULL) { return RGB(230, 200, 0); } - if (isIncluded(color, "darkgreen") != NULL) - { + if (isIncluded(color, "darkgreen") != NULL) { return RGB(50, 160, 70); } - if (isIncluded(color, "neongreen") != NULL) - { + if (isIncluded(color, "neongreen") != NULL) { return RGB(10, 255, 10); } - if (isIncluded(color, "green") != NULL) - { + if (isIncluded(color, "green") != NULL) { return RGB(50, 200, 70); } - if (isIncluded(color, "darkblue") != NULL) - { + if (isIncluded(color, "darkblue") != NULL) { return RGB(30, 30, 150); } - if (isIncluded(color, "lightblue") != NULL) - { + if (isIncluded(color, "lightblue") != NULL) { return RGB(100, 100, 200); } - if (isIncluded(color, "neonblue") != NULL) - { + if (isIncluded(color, "neonblue") != NULL) { return RGB(35, 205, 255); } @@ -3663,10 +3265,8 @@ void CIsoView::ReInitializeDDraw() #ifdef NOSURFACES - while ((GetDeviceCaps(::GetDC(::GetDesktopWindow()), BITSPIXEL) <= 8)) - { - if (MessageBox("You currently only have 8 bit color mode enabled. FinalAlert 2 does not work in 8 bit color mode. Please change the color mode and then click on OK. Click Cancel to quit (and save the map as backup.map).", "Error", MB_OKCANCEL) == IDCANCEL) - { + while ((GetDeviceCaps(::GetDC(::GetDesktopWindow()), BITSPIXEL) <= 8)) { + if (MessageBox("You currently only have 8 bit color mode enabled. FinalAlert 2 does not work in 8 bit color mode. Please change the color mode and then click on OK. Click Cancel to quit (and save the map as backup.map).", "Error", MB_OKCANCEL) == IDCANCEL) { ((CFinalSunDlg*)theApp.m_pMainWnd)->SaveMap((u8AppDataPath + "\\backup.map").c_str()); PostQuitMessage(0); return; @@ -3833,7 +3433,7 @@ int CIsoView::GetOverlayDirection(int x, int y) BOOL isTrail = FALSE; int i; - for (i = 0;i < overlay_count;i++) + for (i = 0; i < overlay_count; i++) if (overlay_number[i] == type) if (overlay_trail[i]) isTrail = TRUE; @@ -3883,8 +3483,7 @@ int CIsoView::GetOverlayDirection(int x, int y) return 3; return 0; - } - else if (isTrail) // handling something like a sandbag + } else if (isTrail) // handling something like a sandbag { p = 0; if (Map->GetOverlayAt(x - 1 + (y - 0) * dwIsoSize) == type) p |= 0x1; @@ -3905,24 +3504,18 @@ void CIsoView::HandleTrail(int x, int y) if (isTrack(type)) // is a track (overlay must be changed) { - for (i = x - 2;i <= x + 2;i++) - { - for (e = y - 1;e <= y + 1;e++) - { + for (i = x - 2; i <= x + 2; i++) { + for (e = y - 1; e <= y + 1; e++) { if (isTrack(Map->GetOverlayAt(i + e * Map->GetIsoSize()))) Map->SetOverlayAt(i + e * Map->GetIsoSize(), 0x27 + GetOverlayDirection(i, e)); } } - } - else // something like a sandbag (overlaydata must be changed) + } else // something like a sandbag (overlaydata must be changed) { - for (i = x - 2;i <= x + 2;i++) - { - for (e = y - 1;e <= y + 1;e++) - { - if (Map->GetOverlayAt(i + e * Map->GetIsoSize()) == type) - { + for (i = x - 2; i <= x + 2; i++) { + for (e = y - 1; e <= y + 1; e++) { + if (Map->GetOverlayAt(i + e * Map->GetIsoSize()) == type) { int dir = GetOverlayDirection(i, e); if (dir >= 0) Map->SetOverlayDataAt(i + e * Map->GetIsoSize(), dir); } @@ -3972,8 +3565,7 @@ void CIsoView::DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted, H SelectObject(hDC, p); - if (dotted) - { + if (dotted) { SetBkMode(hDC, TRANSPARENT); MoveToEx(hDC, p1.x, p1.y - 1, NULL); LineTo(hDC, p2.x + 1, p2.y); @@ -3982,8 +3574,7 @@ void CIsoView::DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted, H LineTo(hDC, p1.x, p1.y - 1); } - if (!dotted) - { + if (!dotted) { MoveToEx(hDC, p1.x, p1.y, NULL); LineTo(hDC, p2.x, p2.y); LineTo(hDC, p3.x, p3.y); @@ -4025,8 +3616,7 @@ void CIsoView::DrawCell(void* dest, int dest_width, int dest_height, int dest_pi for (int x = 0; x < 1; ++x) // you could use this loop for more thickness { - for (int y = 0; y < 1; ++y) - { + for (int y = 0; y < 1; ++y) { // inside the MM tile drawer.MoveTo(p1.x + x + 1, p1.y + y + 1); drawer.LineTo(p2.x + x - 2, p2.y + y - 1, col, style); @@ -4050,12 +3640,10 @@ void CIsoView::DrawCell(void* dest, int dest_width, int dest_height, int dest_pi } // pixels of neighboured MM tiles boundary - if (touchNeighbours) - { + if (touchNeighbours) { for (int x = 0; x < 1; ++x) // you could use this loop for more thickness { - for (int y = 0; y < 1; ++y) - { + for (int y = 0; y < 1; ++y) { drawer.MoveTo(p1.x + x + 1, p1.y + y - 1); drawer.LineTo(p2.x + x - 2, p2.y + y - 3, colNeighbour, style); drawer.MoveTo(p2.x + x - 2, p2.y + y - 2); @@ -4076,8 +3664,7 @@ void CIsoView::DrawTube(const CTube& tube, const DDSURFACEDESC2* lockedDDSD, con { SurfaceLocker locker(lpdsBack); - if (!lockedDDSD || !lockedDDSD->lpSurface) - { + if (!lockedDDSD || !lockedDDSD->lpSurface) { lockedDDSD = locker.ensure_locked(); } if (!lockedDDSD) @@ -4094,26 +3681,24 @@ void CIsoView::DrawTube(const CTube& tube, const DDSURFACEDESC2* lockedDDSD, con LineDrawer ld(lockedDDSD->lpSurface, bpp, lockedDDSD->dwWidth, lockedDDSD->dwHeight, lockedDDSD->lPitch); auto startDraw = GetRenderTargetCoordinates(tube.getStartCoords(), lowestHeight); ld.MoveTo(startDraw.x + f_x / 2 + lineOffset.x, startDraw.y + f_y / 2 + lineOffset.y); - + tube.walk([this, &tube, lockedDDSD, &ld, lowestHeight, col, lineOffset](const auto& wi) { auto draw = GetRenderTargetCoordinates(wi.pos, lowestHeight); - if (wi.pos == tube.getEndCoords()) - { + if (wi.pos == tube.getEndCoords()) { // end coordinates are drawn as cross LineDrawer startLD(lockedDDSD->lpSurface, bpp, lockedDDSD->dwWidth, lockedDDSD->dwHeight, lockedDDSD->lPitch); ProjectedVec off(7, 4); startLD.DrawLine(draw.x + off.x, draw.y + f_y / 2, draw.x + f_x - off.x, draw.y + f_y / 2, col); startLD.DrawLine(draw.x + f_x / 2 - 1, draw.y + off.y, draw.x + f_x / 2 - 1, draw.y + f_y - off.y, col); } - if (wi.pos == tube.getStartCoords()) - { + if (wi.pos == tube.getStartCoords()) { // Start coordinates are drawn as cell DrawCell(lockedDDSD->lpSurface, lockedDDSD->dwWidth, lockedDDSD->dwHeight, lockedDDSD->lPitch, draw.x, draw.y, 1, 1, col, true); } ld.LineTo(draw.x + f_x / 2 + lineOffset.x, draw.y + f_y / 2 + lineOffset.y, col); return true; - }); + }); } MapCoords CIsoView::GetMapCoordinates(const ProjectedCoords& projCoords, bool bAllowAccessBehindCliffs, bool ignoreHideFlagsAndOutside) const @@ -4199,8 +3784,7 @@ void CIsoView::UpdateStatusBar(int x, int y) FIELDDATA m = *Map->GetFielddataAt(x + y * Map->GetIsoSize()); if (m.wGround == 0xFFFF) m.wGround = 0; - if (m.wGround < (*tiledata_count) && m.bSubTile < (*tiledata)[m.wGround].wTileCount) - { + if (m.wGround < (*tiledata_count) && m.bSubTile < (*tiledata)[m.wGround].wTileCount) { statusbar = "Terrain type: 0x"; char c[50]; itoa((*tiledata)[m.wGround].tiles[m.bSubTile].bTerrainType, c, 16); @@ -4212,8 +3796,7 @@ void CIsoView::UpdateStatusBar(int x, int y) } - if (Map->GetOverlayAt(x + y * Map->GetIsoSize()) != 0xFF) - { + if (Map->GetOverlayAt(x + y * Map->GetIsoSize()) != 0xFF) { char ov[50]; itoa(Map->GetOverlayAt(x + y * Map->GetIsoSize()), ov, 16); @@ -4221,8 +3804,7 @@ void CIsoView::UpdateStatusBar(int x, int y) CString name; name = "0x"; name += ov; - for (i = 0;i < overlay_count;i++) - { + for (i = 0; i < overlay_count; i++) { if (overlay_number[i] == Map->GetOverlayAt(x + y * Map->GetIsoSize())) name = overlay_name[i]; } @@ -4241,8 +3823,7 @@ void CIsoView::UpdateStatusBar(int x, int y) int n = Map->GetStructureAt(x + y * Map->GetIsoSize()); int on = -1; - if (n >= 0) - { + if (n >= 0) { Map->GetStdStructureData(n, &sod); statusbar = GetLanguageStringACP("StructStatus"); @@ -4250,8 +3831,7 @@ void CIsoView::UpdateStatusBar(int x, int y) } n = Map->GetUnitAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { Map->GetStdUnitData(n, &sod); statusbar = GetLanguageStringACP("UnitStatus"); @@ -4260,8 +3840,7 @@ void CIsoView::UpdateStatusBar(int x, int y) } n = Map->GetAirAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { Map->GetStdAircraftData(n, &sod); statusbar = GetLanguageStringACP("AirStatus"); @@ -4269,15 +3848,13 @@ void CIsoView::UpdateStatusBar(int x, int y) } n = Map->GetInfantryAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { Map->GetStdInfantryData(n, &sod); statusbar = GetLanguageStringACP("InfStatus"); on = n; } - if (sod.type.GetLength() > 0) - { + if (sod.type.GetLength() > 0) { char c[50]; itoa(on, c, 10); statusbar += "ID "; @@ -4320,8 +3897,7 @@ void CIsoView::UpdateStatusBar(int x, int y) n = Map->GetCelltagAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { CString type; CString name; DWORD pos; @@ -4339,8 +3915,7 @@ void CIsoView::UpdateStatusBar(int x, int y) statusbar += ")"; } - if (AD.mode == ACTIONMODE_SETTILE) - { + if (AD.mode == ACTIONMODE_SETTILE) { statusbar = GetLanguageStringACP("TilePlaceStatus"); } @@ -4354,15 +3929,12 @@ void CIsoView::UpdateStatusBar(int x, int y) void CIsoView::UpdateOverlayPictures(int id) { - if (id < 0) - { + if (id < 0) { memset(ovrlpics, 0, max_ovrl_img * 0xFF * sizeof(LPDIRECTDRAWSURFACE4)); int i, e; - for (i = 0;i < 0xFF;i++) - { - for (e = 0;e < max_ovrl_img;e++) - { + for (i = 0; i < 0xFF; i++) { + for (e = 0; e < max_ovrl_img; e++) { /*PICDATA& p=GetOverlayPic(i, e); if(p.pic!=NULL) ovrlpics[i][e]=&p; else @@ -4370,12 +3942,9 @@ void CIsoView::UpdateOverlayPictures(int id) ovrlpics[i][e] = GetOverlayPic(i, e); } } - } - else - { + } else { int e; - for (e = 0;e < max_ovrl_img;e++) - { + for (e = 0; e < max_ovrl_img; e++) { ovrlpics[id][e] = GetOverlayPic(id, e); } } @@ -4392,23 +3961,19 @@ __forceinline void FixTileHeight(DWORD dwPos, int x, int y) char bHeightDiff[9]; int i, e; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { if (x + i < 0 || y + e < 0 || x + i >= isosize || y + e >= isosize) bHeightDiff[i + 1 + (e + 1) * 3] = 0; else bHeightDiff[i + 1 + (e + 1) * 3] = oheight - Map->GetHeightAt(dwPos + i + e * isosize); } } - if (bHeightDiff[1] < 0 && bHeightDiff[7] < 0) - { + if (bHeightDiff[1] < 0 && bHeightDiff[7] < 0) { Map->SetHeightAt(dwPos, oheight + 1); return; } - if (bHeightDiff[3] < 0 && bHeightDiff[5] < 0) - { + if (bHeightDiff[3] < 0 && bHeightDiff[5] < 0) { Map->SetHeightAt(dwPos, oheight + 1); return; } @@ -4422,8 +3987,7 @@ __forceinline void FixTileHeight(DWORD dwPos, int x, int y) (bHeightDiff[5]<0 && bHeightDiff[6]<0) || (bHeightDiff[7]<0 && bHeightDiff[0]<0) || (bHeightDiff[7]<0 && bHeightDiff[2]<0) */ - ) - { + ) { Map->SetHeightAt(dwPos, oheight + 1); return; } @@ -4501,10 +4065,8 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL int i, e; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { int pos = dwPos + i + (e)*isosize; @@ -4519,12 +4081,10 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL else if (dwY == isosize - 1 && e == 1) bAllowed = FALSE; - if (bOnlyThisTile) - { + if (bOnlyThisTile) { if (fd.wGround != orig_fd.wGround) bAllowed = FALSE; // was another tile - else - { + else { // we now need to check if it is really the same tile or just the same tile type (!) int of = orig_fd.bSubTile; int f = fd.bSubTile; @@ -4543,8 +4103,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL int ground = fd.wGround; - if (bAllowed && !fd.bReserved && pos > 0 && pos < mapsize) - { + if (bAllowed && !fd.bReserved && pos > 0 && pos < mapsize) { @@ -4553,10 +4112,8 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL TILEDATA destTile = (*tiledata)[fd.wGround]; TILEDATA sourceTile = (*tiledata)[orig_fd.wGround]; - if (bAllowed && (!bNonMorpheableMove || bDestMorphable)) - { - if (e == 1 && i == 1) - { + if (bAllowed && (!bNonMorpheableMove || bDestMorphable)) { + if (e == 1 && i == 1) { int leftGround = Map->GetFielddataAt(dwPos + 1)->wGround; int rightGround = Map->GetFielddataAt(dwPos + isosize)->wGround; if (leftGround == 0xFFFF) leftGround = 0; @@ -4564,8 +4121,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL if (!(*tiledata)[leftGround].bMorphable && !(*tiledata)[rightGround].bMorphable) bAllowed = FALSE; } - if (e == -1 && i == -1) - { + if (e == -1 && i == -1) { int leftGround = Map->GetFielddataAt(dwPos - 1)->wGround; int rightGround = Map->GetFielddataAt(dwPos - isosize)->wGround; if (leftGround == 0xFFFF) leftGround = 0; @@ -4573,8 +4129,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL if (!(*tiledata)[leftGround].bMorphable && !(*tiledata)[rightGround].bMorphable) bAllowed = FALSE; } - if (e == -1 && i == 1) - { + if (e == -1 && i == 1) { int leftGround = Map->GetFielddataAt(dwPos - 1)->wGround; int rightGround = Map->GetFielddataAt(dwPos + isosize)->wGround; if (leftGround == 0xFFFF) leftGround = 0; @@ -4582,8 +4137,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL if (!(*tiledata)[leftGround].bMorphable && !(*tiledata)[rightGround].bMorphable) bAllowed = FALSE; } - if (e == 1 && i == -1) - { + if (e == 1 && i == -1) { int leftGround = Map->GetFielddataAt(dwPos + 1)->wGround; int rightGround = Map->GetFielddataAt(dwPos - isosize)->wGround; if (leftGround == 0xFFFF) leftGround = 0; @@ -4598,8 +4152,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL - if (/*(*tiledata)[ground].bMorphable &&*/ bAllowed) - { + if (/*(*tiledata)[ground].bMorphable &&*/ bAllowed) { int need_diff = (*tiledata)[ground].tiles[fd.bSubTile].bZHeight - (*tiledata)[orig_ground].tiles[orig_fd.bSubTile].bZHeight; @@ -4619,8 +4172,7 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL }*/ - if (!bNonMorpheableMove && bDestMorphable) - { + if (!bNonMorpheableMove && bDestMorphable) { //if(!bOnlyHeighten)//!bCliffNext) { if (diff < -1) @@ -4632,26 +4184,17 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL { ChangeTileHeight(pos, dwNewHeight, bNonMorpheableMove, bOnlyThisTile, bOnlyHeighten); }*/ - } - else if (bNonMorpheableMove) - { - if (!bDestMorphable /*&& (*tiledata)[fd.wGround].wTileSet==(*tiledata)[orig_fd.wGround].wTileSet*/ /*&& need_diff!=fd.bHeight-orig_fd.bHeight*/) - { - if (destTile.tiles[fd.bSubTile].bTerrainType == sourceTile.tiles[orig_fd.bSubTile].bTerrainType || destTile.wTileSet == sourceTile.wTileSet) - { + } else if (bNonMorpheableMove) { + if (!bDestMorphable /*&& (*tiledata)[fd.wGround].wTileSet==(*tiledata)[orig_fd.wGround].wTileSet*/ /*&& need_diff!=fd.bHeight-orig_fd.bHeight*/) { + if (destTile.tiles[fd.bSubTile].bTerrainType == sourceTile.tiles[orig_fd.bSubTile].bTerrainType || destTile.wTileSet == sourceTile.wTileSet) { ChangeTileHeight(pos, dwNewHeight + need_diff, TRUE, bOnlyThisTile, bNoSlopes); } - } - else if (bDestMorphable /*&& need_diff!=fd.bHeight-orig_fd.bHeight*/) - { + } else if (bDestMorphable /*&& need_diff!=fd.bHeight-orig_fd.bHeight*/) { //diff-=need_diff; - if ((sourceTile.cx > 1 && sourceTile.cy > 1 && (e < 0 && i < 0)) || ((sourceTile.cx < 2 || sourceTile.cy < 2) && (e > 0 && i > 0))) - { + if ((sourceTile.cx > 1 && sourceTile.cy > 1 && (e < 0 && i < 0)) || ((sourceTile.cx < 2 || sourceTile.cy < 2) && (e > 0 && i > 0))) { ChangeTileHeight(pos, dwNewHeight, FALSE, bOnlyThisTile, bNoSlopes); - } - else - { + } else { if (diff - need_diff > 0) ChangeTileHeight(pos, dwNewHeight + need_diff, FALSE, bOnlyThisTile, bNoSlopes); else if (diff - need_diff < 0) @@ -4675,12 +4218,9 @@ void __fastcall CIsoView::ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL } }*/ - if (!bNoSlopes) - { - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + if (!bNoSlopes) { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { int pos = dwPos + i + (e)*isosize; if (pos > 0 && pos < mapsize) Map->CreateSlopesAt(pos); @@ -4703,10 +4243,8 @@ BOOL CIsoView::ReachableFrom(DWORD dwStart, DWORD dwEnd) int i, e; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { int new_ground = orig_fd.wGround; if (new_ground == 0xFFFF) new_ground = 0; @@ -4726,8 +4264,7 @@ void CIsoView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) void CIsoView::HideTileSet(DWORD dwTileSet) { int i; - for (i = 0;i < *tiledata_count;i++) - { + for (i = 0; i < *tiledata_count; i++) { if ((*tiledata)[i].wTileSet == dwTileSet) (*tiledata)[i].bHide = TRUE; } } @@ -4745,32 +4282,26 @@ void CIsoView::BlitBackbufferToHighRes() // This is a simple scaling and also scales any text that has already been rendered to the backbuffer (which is why we're usually rendering text afterwards to the HighRes backbuffer). // Altogether it'd probably be best to move from DirectDraw to Direct3D, support high DPI awareness and do the scaling right when initially drawing the map. - - if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) - { + + if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) { // copy scene backbuffer to the high-res buffer that will receive text rendering RECT dr; GetWindowRect(&dr); auto cr = GetScaledDisplayRect(); lpdsBackHighRes->Blt(&dr, lpdsBack, &cr, DDBLT_WAIT, 0); - } - else - { + } else { // do nothing, backbuffer will receive additional text rendering as text doesn't have to be scaled } } void CIsoView::FlipHighResBuffer() { - if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) - { + if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) { // This flip copies the high-res backbuffer to the front buffer RECT dr; GetWindowRect(&dr); lpds->Blt(&dr, lpdsBackHighRes, &dr, DDBLT_WAIT, 0); - } - else - { + } else { // copy scene backbuffer to the front buffer that will receive text/gdi rendering RECT dr; GetWindowRect(&dr); @@ -4782,8 +4313,7 @@ void CIsoView::FlipHighResBuffer() void CIsoView::ShowAllTileSets() { int i; - for (i = 0;i < *tiledata_count;i++) - { + for (i = 0; i < *tiledata_count; i++) { (*tiledata)[i].bHide = FALSE; } } @@ -4792,10 +4322,8 @@ void CIsoView::ShowAllTileSets() void CIsoView::PlaceCurrentObjectAt(int x, int y) { - if (AD.mode == ACTIONMODE_RANDOMTERRAIN) - { - if (Map->GetTerrainAt(x + y * Map->GetIsoSize()) >= 0) - { + if (AD.mode == ACTIONMODE_RANDOMTERRAIN) { + if (Map->GetTerrainAt(x + y * Map->GetIsoSize()) >= 0) { return; } @@ -4816,23 +4344,19 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) if (AD.type == 1) // ADD INFANTRY { - if (Map->GetInfantryCountAt(x + y * Map->GetIsoSize()) >= SUBPOS_COUNT) - { + if (Map->GetInfantryCountAt(x + y * Map->GetIsoSize()) >= SUBPOS_COUNT) { return; } Map->AddInfantry(NULL, AD.data_s, currentOwner, x + y * Map->GetIsoSize()); //RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 2) // add structure + } else if (AD.type == 2) // add structure { int n = Map->GetStructureAt(x + y * Map->GetIsoSize()); - if (n >= 0) - { + if (n >= 0) { STDOBJECTDATA sod; Map->GetStdStructureData(n, &sod); - if (strcmp(sod.type, "GAPAVE") != NULL) - { + if (strcmp(sod.type, "GAPAVE") != NULL) { //isMoving=FALSE; return; } @@ -4841,43 +4365,35 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) Map->AddStructure(NULL, AD.data_s, currentOwner, x + y * Map->GetIsoSize()); //RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 3) // add aircraft + } else if (AD.type == 3) // add aircraft { - if (Map->GetAirAt(x + y * Map->GetIsoSize()) >= 0) - { + if (Map->GetAirAt(x + y * Map->GetIsoSize()) >= 0) { return; } Map->AddAircraft(NULL, AD.data_s, currentOwner, x + y * Map->GetIsoSize()); //RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 4) // add vehicle + } else if (AD.type == 4) // add vehicle { - if (Map->GetUnitAt(x + y * Map->GetIsoSize()) >= 0) - { + if (Map->GetUnitAt(x + y * Map->GetIsoSize()) >= 0) { return; } Map->AddUnit(NULL, AD.data_s, currentOwner, x + y * Map->GetIsoSize()); //RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 5) // add terrain + } else if (AD.type == 5) // add terrain { - if (Map->GetTerrainAt(x + y * Map->GetIsoSize()) >= 0) - { + if (Map->GetTerrainAt(x + y * Map->GetIsoSize()) >= 0) { return; } Map->AddTerrain(AD.data_s, x + y * Map->GetIsoSize()); //RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 6) - { + } else if (AD.type == 6) { // Overlay @@ -4893,10 +4409,8 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) if (AD.data == 1) // delete overlay { int gx, gy; - for (gx = x - AD.data2;gx <= x + AD.data2;gx++) - { - for (gy = y - AD.data2;gy <= y + AD.data2;gy++) - { + for (gx = x - AD.data2; gx <= x + AD.data2; gx++) { + for (gy = y - AD.data2; gy <= y + AD.data2; gy++) { Map->SetOverlayDataAt(gx + gy * Map->GetIsoSize(), 0xFF); Map->SetOverlayAt(gx + gy * Map->GetIsoSize(), 0xFF); @@ -4913,23 +4427,18 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } - } - else if (AD.data == 2) // green tiberium mode + } else if (AD.data == 2) // green tiberium mode { { - if (AD.data2 == 0) - { + if (AD.data2 == 0) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int curground = Map->GetFielddataAt(dwPos + i + e * Map->GetIsoSize())->wGround; if (curground == 0xFFFF) curground = 0; - if ((*tiledata)[curground].bAllowTiberium) - { + if ((*tiledata)[curground].bAllowTiberium) { //srand( GetTickCount()+i+e*5 ); int v1 = ((float)rand() / (float)RAND_MAX) * 8.0f + 0x68; int v2 = ((float)rand() / (float)RAND_MAX) * 8.0f + 1; @@ -4938,51 +4447,36 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } } } - } - else if (AD.data2 == 10) - { + } else if (AD.data2 == 10) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int curground = Map->GetFielddataAt(dwPos + i + e * Map->GetIsoSize())->wGround; if (curground == 0xFFFF) curground = 0; - if ((*tiledata)[curground].bAllowTiberium) - { + if ((*tiledata)[curground].bAllowTiberium) { Map->SetOverlayAt(dwPos + i + e * Map->GetIsoSize(), 0x70); Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), 0x5); } } } - } - else if (AD.data2 == 20) - { + } else if (AD.data2 == 20) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int ovrl = Map->GetOverlayAt(dwPos + i + e * Map->GetIsoSize()); - if (ovrl > 0x65 && ovrl < 0x72) - { + if (ovrl > 0x65 && ovrl < 0x72) { if (Map->GetOverlayDataAt(i + e * Map->GetIsoSize() + dwPos) < 9) Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) + 1); } } } - } - else if (AD.data2 == 21) - { + } else if (AD.data2 == 21) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int ovrl = Map->GetOverlayAt(dwPos + i + e * Map->GetIsoSize()); - if (ovrl > 0x65 && ovrl < 0x72) - { + if (ovrl > 0x65 && ovrl < 0x72) { if (Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) > 0) Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) - 1); } } @@ -4990,8 +4484,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } } - } - else if (AD.data == 3) // blue tiberium mode + } else if (AD.data == 3) // blue tiberium mode { int o = 0x7f; #ifdef RA2_MODE @@ -4999,19 +4492,15 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) #endif //if((*tiledata)[m.wGround].bAllowTiberium) { - if (AD.data2 == 0) - { + if (AD.data2 == 0) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int curground = Map->GetFielddataAt(dwPos + i + e * Map->GetIsoSize())->wGround; if (curground == 0xFFFF) curground = 0; - if ((*tiledata)[curground].bAllowTiberium) - { + if ((*tiledata)[curground].bAllowTiberium) { int v2 = ((float)rand() / (float)RAND_MAX) * 8 + 1; Map->SetOverlayAt(dwPos + i + e * Map->GetIsoSize(), o); @@ -5020,50 +4509,35 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } } - } - else if (AD.data2 == 10) - { + } else if (AD.data2 == 10) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int curground = Map->GetFielddataAt(dwPos + i + e * Map->GetIsoSize())->wGround; if (curground == 0xFFFF) curground = 0; - if ((*tiledata)[curground].bAllowTiberium) - { + if ((*tiledata)[curground].bAllowTiberium) { Map->SetOverlayAt(dwPos + i + e * Map->GetIsoSize(), o); Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), 0x5); } } } - } - else if (AD.data2 == 20) - { + } else if (AD.data2 == 20) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int ovrl = Map->GetOverlayAt(dwPos + i + e * Map->GetIsoSize()); - if (ovrl == o) - { + if (ovrl == o) { if (Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) < 9) Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) + 1); } } } - } - else if (AD.data2 == 21) - { + } else if (AD.data2 == 21) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { int ovrl = Map->GetOverlayAt(dwPos + i + e * Map->GetIsoSize()); - if (ovrl == o) - { + if (ovrl == o) { if (Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) > 0) Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), Map->GetOverlayDataAt(dwPos + i + e * Map->GetIsoSize()) - 1); } } @@ -5071,16 +4545,13 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } } - } - else if (AD.data == 4) // veinhole stuff mode + } else if (AD.data == 4) // veinhole stuff mode { if (AD.data2 == 0) // Set veinhole! { int gx, gy; - for (gx = x - 1;gx <= x + 1;gx++) - { - for (gy = y - 1;gy <= y + 1;gy++) - { + for (gx = x - 1; gx <= x + 1; gx++) { + for (gy = y - 1; gy <= y + 1; gy++) { Map->SetOverlayAt(gx + gy * Map->GetIsoSize(), OVRL_VEINHOLEBORDER); Map->SetOverlayDataAt(gx + gy * Map->GetIsoSize(), 0x0); } @@ -5088,63 +4559,48 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) Map->SetOverlayAt(dwPos, OVRL_VEINHOLE); Map->SetOverlayDataAt(dwPos, 0x0); Map->SetHeightAt(dwPos, Map->GetHeightAt(dwPos) - 1); - } - else if (AD.data2 == 1) // set veins + } else if (AD.data2 == 1) // set veins { Map->SetOverlayAt(dwPos, OVRL_VEINS); Map->SetOverlayDataAt(dwPos, 0x30); } - } - else if (AD.data == 30) // any overlay + } else if (AD.data == 30) // any overlay { Map->SetOverlayAt(dwPos, AD.data2); Map->SetOverlayDataAt(dwPos, 0); int i; - for (i = 0;i < overlay_count;i++) - { - if (overlay_number[i] == AD.data2) - { - if (overlay_trail[i]) - { + for (i = 0; i < overlay_count; i++) { + if (overlay_number[i] == AD.data2) { + if (overlay_trail[i]) { // handle trail stuff! HandleTrail(x, y); } } } - } - else if (AD.data == 33) - { + } else if (AD.data == 33) { int i, e; - for (i = 0;i < m_BrushSize_x;i++) - { - for (e = 0;e < m_BrushSize_y;e++) - { + for (i = 0; i < m_BrushSize_x; i++) { + for (e = 0; e < m_BrushSize_y; e++) { Map->SetOverlayAt(dwPos + i + e * Map->GetIsoSize(), AD.data2); Map->SetOverlayDataAt(dwPos + i + e * Map->GetIsoSize(), AD.data3); } } } - else if (AD.data == 31) - { + else if (AD.data == 31) { Map->SetOverlayAt(dwPos, AD.data2); - } - else if (AD.data == 32) - { + } else if (AD.data == 32) { Map->SetOverlayDataAt(dwPos, AD.data2); } // RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (AD.type == 7) - { + } else if (AD.type == 7) { // set owner! BOOL bchanged = FALSE; int t = Map->GetStructureAt(x + y * Map->GetIsoSize()); - if (t >= 0) - { + if (t >= 0) { STRUCTURE structure; Map->GetStructureData(t, &structure); Map->DeleteStructure(t); @@ -5153,8 +4609,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) bchanged = TRUE; } t = Map->GetUnitAt(x + y * Map->GetIsoSize()); - if (t >= 0) - { + if (t >= 0) { UNIT unit; Map->GetUnitData(t, &unit); Map->DeleteUnit(t); @@ -5163,8 +4618,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) bchanged = TRUE; } t = Map->GetAirAt(x + y * Map->GetIsoSize()); - if (t >= 0) - { + if (t >= 0) { AIRCRAFT aircraft; Map->GetAircraftData(t, &aircraft); Map->DeleteAircraft(t); @@ -5173,11 +4627,9 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) bchanged = TRUE; } int z; - for (z = 0;z < SUBPOS_COUNT;z++) - { + for (z = 0; z < SUBPOS_COUNT; z++) { t = Map->GetInfantryAt(x + y * Map->GetIsoSize(), z); - if (t >= 0) - { + if (t >= 0) { INFANTRY infantry; Map->GetInfantryData(t, &infantry); Map->DeleteInfantry(t); @@ -5187,8 +4639,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) } } - if (bchanged) - { + if (bchanged) { //RedrawWindow(NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW); } @@ -5198,8 +4649,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y) else if (AD.type == 8) // add smudge { - if (Map->GetFielddataAt(x + y * Map->GetIsoSize())->smudge >= 0) - { + if (Map->GetFielddataAt(x + y * Map->GetIsoSize())->smudge >= 0) { return; } @@ -5224,8 +4674,7 @@ void CIsoView::OnTimer(UINT_PTR nIDEvent) last_succeeded_operation = 1000000; - if (nIDEvent == 11) - { + if (nIDEvent == 11) { // BUGSEARCH //if(b_IsLoading) return; // @@ -5234,9 +4683,7 @@ void CIsoView::OnTimer(UINT_PTR nIDEvent) SetScroll(m_viewOffset.x, m_viewOffset.y); InvalidateRect(NULL, FALSE); - } - else - { + } else { errstream << "Timer calls InitTMPs()" << endl; errstream.flush(); @@ -5253,8 +4700,7 @@ void CIsoView::OnTimer(UINT_PTR nIDEvent) void CIsoView::FillArea(DWORD dwX, DWORD dwY, DWORD dwID, BYTE bSubTile) { - if ((*tiledata)[dwID].cx != 1 || (*tiledata)[dwID].cy != 1) - { + if ((*tiledata)[dwID].cx != 1 || (*tiledata)[dwID].cy != 1) { MessageBox("You can only use 1x1 tiles to fill areas."); return; } @@ -5267,10 +4713,8 @@ void CIsoView::FillArea(DWORD dwX, DWORD dwY, DWORD dwID, BYTE bSubTile) mapheight = Map->GetHeight(); int i, e; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { if (abs(i) == abs(e)) continue; int cur_x, cur_y; cur_x = dwX + i; @@ -5283,8 +4727,7 @@ void CIsoView::FillArea(DWORD dwX, DWORD dwY, DWORD dwID, BYTE bSubTile) - if (f2->wGround != dwID && f2->wGround == f->wGround && f2->bSubTile == f->bSubTile) - { + if (f2->wGround != dwID && f2->wGround == f->wGround && f2->bSubTile == f->bSubTile) { FillArea(cur_x, cur_y, dwID, bSubTile); } @@ -5313,10 +4756,8 @@ void CIsoView::AutoLevel() int i; - for (i = 0;i < *tiledata_count;i++) - { - if ((*tiledata)[i].wTileSet == cliffset) - { + for (i = 0; i < *tiledata_count; i++) { + if ((*tiledata)[i].wTileSet == cliffset) { iCliffStart = i; break; @@ -5356,8 +4797,7 @@ void CIsoView::AutoLevel() else if(s=="Top_2") bDirections[i]=7; }*/ - for (i = 0;i < mapsize;i++) - { + for (i = 0; i < mapsize; i++) { FIELDDATA* f1 = Map->GetFielddataAt(i); int o_ground = f1->wGround; if (o_ground == 0xFFFF) o_ground = 0; @@ -5370,10 +4810,8 @@ void CIsoView::AutoLevel() int x, y; - for (x = -1;x < 2;x++) - { - for (y = -1;y < 2;y++) - { + for (x = -1; x < 2; x++) { + for (y = -1; y < 2; y++) { if (x == -1 && y == -1) continue; if (x == 1 && y == 1) continue; if (x == 1 && y == -1) continue; @@ -5384,10 +4822,8 @@ void CIsoView::AutoLevel() int heights[32][32]; memset(heights, 0, 32 * 32 * sizeof(int)); - for (p = 0;p < o_width;p++) - { - for (k = 0;k < o_height;k++) - { + for (p = 0; p < o_width; p++) { + for (k = 0; k < o_height; k++) { count++; heights[p][k] = (*tiledata)[o_ground].tiles[p + k * o_width].bZHeight; } @@ -5395,38 +4831,30 @@ void CIsoView::AutoLevel() - if (o_ground < 8 + iCliffStart || o_ground>13 + iCliffStart) - { - if (count < 4 || count>4) - { + if (o_ground < 8 + iCliffStart || o_ground>13 + iCliffStart) { + if (count < 4 || count>4) { if (x < 0 || y < 0) continue; } - if (heights[0][0] && !heights[1][1]) - { - if (heights[1][0] && heights[0][1]) - { + if (heights[0][0] && !heights[1][1]) { + if (heights[1][0] && heights[0][1]) { if (x < 0 || y < 0) continue; } } - if (heights[0][0] && heights[1][1]) - { + if (heights[0][0] && heights[1][1]) { if (x < 0 || y>0) continue; } - if (!heights[0][0] && heights[1][0] && heights[0][1] && heights[1][1]) - { + if (!heights[0][0] && heights[1][0] && heights[0][1] && heights[1][1]) { if (x < 0 || y < 0) continue; } - } - else - { + } else { if (x > 0 || y > 0) continue; } @@ -5438,24 +4866,20 @@ void CIsoView::AutoLevel() int cur_ground = cur_f->wGround; if (cur_ground == 0xFFFF) cur_ground = 0; int cur_set; - if ((*tiledata)[cur_ground].wTileSet != (*tiledata)[o_ground].wTileSet) - { + if ((*tiledata)[cur_ground].wTileSet != (*tiledata)[o_ground].wTileSet) { - if (((*tiledata)[o_ground].wTileSet == cliffset || (*tiledata)[o_ground].wTileSet == slopesetpiecesset) && (*tiledata)[cur_ground].bMorphable) - { + if (((*tiledata)[o_ground].wTileSet == cliffset || (*tiledata)[o_ground].wTileSet == slopesetpiecesset) && (*tiledata)[cur_ground].bMorphable) { int height_diff = f1->bHeight - cur_f->bHeight; if (o_ground >= 8 + iCliffStart && o_ground <= 13 + iCliffStart && (*tiledata)[o_ground].tiles[cur_f->bSubTile].bZHeight == 0) height_diff += 4; int need_diff = height_diff;//(*tiledata)[o_ground].tiles[f1->bSubTile].bZHeight-(*tiledata)[cur_ground].tiles[cur_f->bSubTile].bZHeight; //if((*tiledata)[o_ground].tiles[f1->bSubTile].bZ - if (abs(height_diff) > 1) - { + if (abs(height_diff) > 1) { //ChangeTileHeight(i+x+y*mapedge,f1->bHeight,FALSE, FALSE); int height = f1->bHeight; if (o_ground >= 8 + iCliffStart && o_ground <= 13 + iCliffStart && (*tiledata)[o_ground].tiles[cur_f->bSubTile].bZHeight == 0) height = f1->bHeight + 4; Map->SetHeightAt(i + x + y * mapedge, height); bChanged[i + x + y * mapedge] = TRUE; - } - else if (height_diff) + } else if (height_diff) Map->CreateSlopesAt(i + x + y * mapedge); //bChanged[i+x+y*mapedge]=TRUE; } @@ -5464,13 +4888,11 @@ void CIsoView::AutoLevel() } } - for (i = 0;i < mapsize;i++) - { + for (i = 0; i < mapsize; i++) { - if (bChanged[i]) - { + if (bChanged[i]) { int e; - for (e = 0;e < Map->GetIsoSize() * Map->GetIsoSize();e++) + for (e = 0; e < Map->GetIsoSize() * Map->GetIsoSize(); e++) Map->SetReserved(e, 0); ChangeTileHeight(i, Map->GetHeightAt(i), FALSE, FALSE); } @@ -5497,10 +4919,8 @@ inline void ToIso3d_NoAccessCheck(int* x, int* y) int i, e = 0; - for (i = 15;i >= 0;i--) - { - for (e = 0;e < 3;e++) - { + for (i = 15; i >= 0; i--) { + for (e = 0; e < 3; e++) { int a; @@ -5515,8 +4935,7 @@ inline void ToIso3d_NoAccessCheck(int* x, int* y) px = m; py = n; - if (m >= 0 && n >= 0 && m < Map->GetIsoSize() && n < Map->GetIsoSize()) - { + if (m >= 0 && n >= 0 && m < Map->GetIsoSize() && n < Map->GetIsoSize()) { FIELDDATA mfd = *Map->GetFielddataAt(px + py * Map->GetIsoSize()); int ground = mfd.wGround; if (ground == 0xFFFF) ground = 0; @@ -5537,8 +4956,7 @@ inline void ToIso3d_NoAccessCheck(int* x, int* y) dx = ((float)dy1) / ((float)f_y) - ((float)dx1) / ((float)f_x) + 1.0f;//+ 1 + (float)0.5 +1; dy = ((float)dx1) / ((float)f_x) + ((float)dy1) / ((float)f_y) + 0.0f;//- 1-(float)0.5 +1; - if (((dx == 0 && dy == 0) || (!bAllowAccessBehindCliffs && *y - n > f_y))) - { + if (((dx == 0 && dy == 0) || (!bAllowAccessBehindCliffs && *y - n > f_y))) { *x = px - 0; *y = py + 0; return; @@ -5586,7 +5004,7 @@ for(i=15;i>=0;i--) }*/ - *x = cx;//-1; + * x = cx;//-1; *y = cy;//-1; } @@ -5598,8 +5016,7 @@ void CIsoView::DrawMap() if (bNoDraw) return; - if (bCancelDraw) - { + if (bCancelDraw) { bCancelDraw = FALSE; return; } @@ -5608,8 +5025,7 @@ void CIsoView::DrawMap() if (lpds == NULL || b_IsLoading || tiledata == NULL || (*tiledata) == NULL || (*tiledata_count == 0)) return; // just to make sure... - if (lpds->IsLost() != DD_OK) - { + if (lpds->IsLost() != DD_OK) { // we lost our surfaces, we need to reinitialize directdraw and all associated objects ReInitializeDDraw(); return; @@ -5630,15 +5046,15 @@ void CIsoView::DrawMap() // get the window rect - + RECT r = GetScaledDisplayRect(); // the code here draws the coordinate system int i; - + // now, we draw all the objects - + int left, right, top, bottom; @@ -5699,16 +5115,13 @@ void CIsoView::DrawMap() m_texts_to_render.clear(); m_waypoints_to_render.clear(); - for (u = left;u < right;u++) - { - for (v = top;v < bottom;v++) - { + for (u = left; u < right; u++) { + for (v = top; v < bottom; v++) { const MapCoords mapCoords(u, v); - if (bCancelDraw) - { + if (bCancelDraw) { bCancelDraw = FALSE; } - + if (u < 1 || v < 1 || u + vmapwidth + mapheight * 2 || (v + 1 > mapwidth && u - 1 < v - mapwidth) || (u + 1 > mapwidth && v + mapwidth - 1 < u)) continue; @@ -5722,15 +5135,11 @@ void CIsoView::DrawMap() DWORD dwOrigGround = m.wGround; - if (theApp.m_Options.bMarbleMadness) - { - if ((*tiledata)[m.wGround].wMarbleGround != 0xFFFF) - { + if (theApp.m_Options.bMarbleMadness) { + if ((*tiledata)[m.wGround].wMarbleGround != 0xFFFF) { m.wGround = (*tiledata)[m.wGround].wMarbleGround; - } - else if (bMarbleHeight) - { + } else if (bMarbleHeight) { //drawy+=f_y*m.bHeight; m.wGround = MM_heightstart + m.bHeight; @@ -5738,33 +5147,27 @@ void CIsoView::DrawMap() } } - if (!m.bRedrawTerrain) - { + if (!m.bRedrawTerrain) { TILEDATA* td = &(*tiledata)[m.wGround]; - if (td->bReplacementCount) - { - if (m.bRNDImage > 0) - { + if (td->bReplacementCount) { + if (m.bRNDImage > 0) { m.bRNDImage <= td->bReplacementCount ? td = &td->lpReplacements[m.bRNDImage - 1] : td = &td->lpReplacements[td->bReplacementCount - 1]; } } - if (m.bSubTile < td->wTileCount && td->tiles[m.bSubTile].pic != NULL) - { + if (m.bSubTile < td->wTileCount && td->tiles[m.bSubTile].pic != NULL) { const SUBTILE& st = td->tiles[m.bSubTile]; const auto stDrawCoords = drawCoords + st.drawOffset(); - if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE) - { + if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE) { #ifndef NOSURFACES Blit(st.pic, stDrawCoords.x, stDrawCoords.y, st.wWidth, st.wHeight); #else BlitTerrain(ddsd.lpSurface, stDrawCoords.x, stDrawCoords.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, st); #endif - } - else // draw soemthing representing the tile + } else // draw soemthing representing the tile { #ifndef NOSURFACES DrawCell(stDrawCoords.x, stDrawCoords.y, 1, 1, RGB(0, 140, 0), FALSE, FALSE); @@ -5781,13 +5184,10 @@ void CIsoView::DrawMap() } - for (u = left;u < right;u++) - { - for (v = top;v < bottom;v++) - { + for (u = left; u < right; u++) { + for (v = top; v < bottom; v++) { const MapCoords mapCoords(u, v); - if (bCancelDraw) - { + if (bCancelDraw) { bCancelDraw = FALSE; } @@ -5802,56 +5202,44 @@ void CIsoView::DrawMap() DWORD dwOrigGround = m.wGround; - if (theApp.m_Options.bMarbleMadness) - { - if ((*tiledata)[m.wGround].wMarbleGround != 0xFFFF) - { + if (theApp.m_Options.bMarbleMadness) { + if ((*tiledata)[m.wGround].wMarbleGround != 0xFFFF) { m.wGround = (*tiledata)[m.wGround].wMarbleGround; - } - else if (bMarbleHeight) - { + } else if (bMarbleHeight) { //y+=f_y*m.bHeight; m.wGround = MM_heightstart + m.bHeight; m.bSubTile = 0; } } - if (m.bRedrawTerrain) - { + if (m.bRedrawTerrain) { // draw cliff again to hide buildings behind - if (m.wGround < *tiledata_count) - { + if (m.wGround < *tiledata_count) { TILEDATA* td = &(*tiledata)[m.wGround]; - if (td->bReplacementCount) - { - if (m.bRNDImage > 0) - { + if (td->bReplacementCount) { + if (m.bRNDImage > 0) { m.bRNDImage <= td->bReplacementCount ? td = &td->lpReplacements[m.bRNDImage - 1] : td = &td->lpReplacements[td->bReplacementCount - 1]; } } - if (m.bSubTile < td->wTileCount && td->tiles[m.bSubTile].pic != NULL) - { + if (m.bSubTile < td->wTileCount && td->tiles[m.bSubTile].pic != NULL) { const SUBTILE& st = td->tiles[m.bSubTile]; const auto stDrawCoords = drawCoords + st.drawOffset(); - if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE) - { + if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE) { #ifndef NOSURFACES Blit(st.pic, stDrawCoords.x, stDrawCoords.y, st.wWidth, st.wHeight); #else BlitTerrain(ddsd.lpSurface, stDrawCoords.x, stDrawCoords.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, st); - if (st.anim) - { + if (st.anim) { const auto animDrawCoords = drawCoords + ProjectedVec(f_x / 2 - st.anim->wMaxWidth / 2, f_y / 2 - st.anim->wMaxHeight / 2) + st.anim->drawOffset(); BlitPic(ddsd.lpSurface, animDrawCoords.x, animDrawCoords.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, *st.anim); } #endif - } - else // draw soemthing representing the tile + } else // draw soemthing representing the tile { #ifndef NOSURFACES DrawCell(stDrawCoords.x, stDrawCoords.y, 1, 1, RGB(0, 140, 0), FALSE, FALSE); @@ -5868,16 +5256,13 @@ void CIsoView::DrawMap() // draw terrain animation (tunnel tops, waterfalls) // tunnel tops might be repainted later so that units do not appear on top - this probably could be done in CLoading so that instead of a back tile a front tile is responsible for drawing the animation { - if (m.wGround < *tiledata_count) - { + if (m.wGround < *tiledata_count) { TILEDATA* td = &(*tiledata)[m.wGround]; - if (m.bSubTile < td->wTileCount) - { + if (m.bSubTile < td->wTileCount) { const SUBTILE& st = td->tiles[m.bSubTile]; - if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE && st.anim) - { + if (!m.bHide && (*tiledata)[dwOrigGround].bHide == FALSE && st.anim) { #ifndef NOSURFACES #else const auto animDrawCoords = drawCoords + ProjectedVec(f_x / 2 - st.anim->wMaxWidth / 2, f_y / 2 - st.anim->wMaxHeight / 2) + st.anim->drawOffset(); @@ -5890,21 +5275,17 @@ void CIsoView::DrawMap() } // draw overlay - if (m.overlay != 0xFF) - { + if (m.overlay != 0xFF) { PICDATA pic; pic.pic = NULL; - if (ovrlpics[m.overlay][m.overlaydata] != NULL) - { + if (ovrlpics[m.overlay][m.overlaydata] != NULL) { pic = *ovrlpics[m.overlay][m.overlaydata]; } - if (pic.pic == NULL) - { - if (!pic.bTried) - { + if (pic.pic == NULL) { + if (!pic.bTried) { auto const& overlayId = rules.GetSection("OverlayTypes").Nth(m.overlay).second; if (!overlayId.IsEmpty()) { SetError("Loading graphics"); @@ -5916,41 +5297,35 @@ void CIsoView::DrawMap() } } - if (pic.pic == NULL) - { - if (!(m.overlay >= 0x4a && m.overlay <= 0x65) && !(m.overlay >= 0xcd && m.overlay <= 0xec)) - { + if (pic.pic == NULL) { + if (!(m.overlay >= 0x4a && m.overlay <= 0x65) && !(m.overlay >= 0xcd && m.overlay <= 0xec)) { char cd[50]; cd[0] = '0'; cd[1] = 'x'; itoa(m.overlay, cd + 2, 16); - m_texts_to_render.push_back({ cd, drawCoords.x + f_x / 2, drawCoords.y + f_y / 2, RGB(0,0,0), false, true, true}); + m_texts_to_render.push_back({ cd, drawCoords.x + f_x / 2, drawCoords.y + f_y / 2, RGB(0,0,0), false, true, true }); // TextOut(drawx,drawy, cd, RGB(0,0,0)); } } } - if (pic.pic != NULL) - { + if (pic.pic != NULL) { ProjectedVec offset(f_x / 2 - pic.wMaxWidth / 2, -pic.wMaxHeight / 2); if (m.overlay == OVRL_VEINHOLE) // veinhole, big, special case { offset.y -= f_y * 3 / 2; - } - else if (isBigBridge(m.overlay)) // bridge special case + } else if (isBigBridge(m.overlay)) // bridge special case { // drawy-=f_y; - if (m.overlaydata >= 0x09 && m.overlaydata <= 0x11) - { + if (m.overlaydata >= 0x09 && m.overlaydata <= 0x11) { offset.y -= f_y / 2; } offset.x -= 1; // hmm... strange, but this is needed - } - else if (isTrack(m.overlay)) + } else if (isTrack(m.overlay)) offset.y += f_y / 2; if (m.overlay >= 0x4a && m.overlay <= 0x65) offset.y += f_y / 2; @@ -5973,9 +5348,7 @@ void CIsoView::DrawMap() { int n = RGB(200, 0, 0); BlitPic(ddsd.lpSurface, drawCoordsOvrl.x, drawCoordsOvrl.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, pic, &n); - } - else - { + } else { int n = RGB(0, 200, 0); BlitPic(ddsd.lpSurface, drawCoordsOvrl.x, drawCoordsOvrl.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, pic, &n); } @@ -5986,14 +5359,12 @@ void CIsoView::DrawMap() } } - if (m.structure != -1) - { + if (m.structure != -1) { last_succeeded_operation = 10101; // for structures we need to check if they weren´t drawn earlier // (every field that this building achieves has this building as .structure) - if (Map->GetStructureAt(mapCoords - MapVec(-1, 0)) != m.structure && Map->GetStructureAt(mapCoords - MapVec(0, -1)) != m.structure) - { + if (Map->GetStructureAt(mapCoords - MapVec(-1, 0)) != m.structure && Map->GetStructureAt(mapCoords - MapVec(0, -1)) != m.structure) { STRUCTUREPAINT objp; Map->GetStructurePaint(m.structure, &objp); @@ -6004,8 +5375,7 @@ void CIsoView::DrawMap() int w = 1, h = 1; PICDATA pic; - if (id > -1 && id < 0x0F00) - { + if (id > -1 && id < 0x0F00) { w = buildinginfo[id].w; h = buildinginfo[id].h; int dir = objp.direction / 32; @@ -6022,17 +5392,14 @@ void CIsoView::DrawMap() DrawCell(drawCoordsBld.x, drawCoordsBld.y, w, h, colorref_conv[objp.col]); #else // MW 07/19/01: Paint cell if user chose so... - if (theApp.m_Options.bShowCells) - { + if (theApp.m_Options.bShowCells) { DrawCell(ddsd.lpSurface, ddsd.dwWidth, ddsd.dwHeight, ddsd.lPitch, drawCoordsBld.x, drawCoordsBld.y, w, h, colorref_conv[objp.col]); } #endif - if (pic.pic == NULL) - { - if (!missingimages[objp.type]) - { + if (pic.pic == NULL) { + if (!missingimages[objp.type]) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(objp.type); ::Map->UpdateBuildingInfo(&objp.type); @@ -6040,8 +5407,7 @@ void CIsoView::DrawMap() pic = buildinginfo[id].pic[dir]; if (pic.pic == NULL) pic = buildinginfo[id].pic[0]; } - if (pic.pic == NULL) - { + if (pic.pic == NULL) { #ifndef NOSURFACES Blit(pics["HOUSE"].pic, drawCoordsBld.x, drawCoordsBld.y - 19); // draw a ugly house #endif @@ -6062,8 +5428,7 @@ void CIsoView::DrawMap() BlitPic(ddsd.lpSurface, drawCoordsBldShp.x, drawCoordsBldShp.y, r.left, r.top, ddsd.lPitch, r.right, r.bottom, pic, &colorref_conv[objp.col]); #endif - for (int upgrade = 0; upgrade < objp.upradecount; ++upgrade) - { + for (int upgrade = 0; upgrade < objp.upradecount; ++upgrade) { const auto& upg = upgrade == 0 ? objp.upgrade1 : (upgrade == 1 ? objp.upgrade2 : objp.upgrade3); if (upg.GetLength() == 0) continue; @@ -6071,8 +5436,7 @@ void CIsoView::DrawMap() PICDATA pic; int dir = (7 - objp.direction / 32) % 8; pic = pics[GetUnitPictureFilename(upg, dir)]; - if (!missingimages[upg] && pic.pic == NULL) - { + if (!missingimages[upg] && pic.pic == NULL) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(upg); ::Map->UpdateBuildingInfo(&upg); @@ -6080,8 +5444,7 @@ void CIsoView::DrawMap() if (pic.pic == NULL) missingimages[upg] = TRUE; } - if (pic.pic != NULL) - { + if (pic.pic != NULL) { static const CString LocLookup[3][2] = { {"PowerUp1LocXX", "PowerUp1LocYY"}, {"PowerUp2LocXX", "PowerUp2LocYY"}, {"PowerUp3LocXX", "PowerUp3LocYY"} }; const auto drawCoordsPowerUp = drawCoordsBldShp + ProjectedVec( atoi(art.GetString(objp.type, LocLookup[upgrade][0])), @@ -6104,15 +5467,13 @@ void CIsoView::DrawMap() } - if (m.node.type > -1) - { + if (m.node.type > -1) { last_succeeded_operation = 10102; CString house = m.node.house; CString tmp; - - if (Map->GetNodeAt(mapCoords + MapVec(1, 0), tmp) != m.node.index && Map->GetNodeAt(mapCoords + MapVec(0, 1), tmp) != m.node.index) - { + + if (Map->GetNodeAt(mapCoords + MapVec(1, 0), tmp) != m.node.index && Map->GetNodeAt(mapCoords + MapVec(0, 1), tmp) != m.node.index) { const auto drawCoordsBld = GetRenderTargetCoordinates(mapCoords - MapVec(buildinginfo[m.node.type].h - 1, buildinginfo[m.node.type].w - 1)); COLORREF c; @@ -6122,8 +5483,7 @@ void CIsoView::DrawMap() int id = m.node.type; int w = 1, h = 1; PICDATA pic; - if (id > -1 && id < 0x0F00) - { + if (id > -1 && id < 0x0F00) { w = buildinginfo[id].w; h = buildinginfo[id].h; pic = buildinginfo[id].pic[0]; @@ -6143,8 +5503,7 @@ void CIsoView::DrawMap() #endif //#endif - if (pic.pic == NULL) - { + if (pic.pic == NULL) { auto const& buildingId = rules.GetSection("BuildingTypes").Nth(m.node.type).second; if (!buildingId.IsEmpty() && !missingimages[buildingId]) { SetError("Loading graphics"); @@ -6174,8 +5533,7 @@ void CIsoView::DrawMap() } } - if (m.unit != -1) - { + if (m.unit != -1) { UNIT obj; Map->GetUnitData(m.unit, &obj); @@ -6191,22 +5549,19 @@ void CIsoView::DrawMap() PICDATA p = pics[lpPicFile]; - if (p.pic == NULL || lpPicFile.GetLength() == 0) - { - if (!missingimages[obj.type]) - { + if (p.pic == NULL || lpPicFile.GetLength() == 0) { + if (!missingimages[obj.type]) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(obj.type); lpPicFile = GetUnitPictureFilename(obj.type, atoi(obj.direction) / 32); p = pics[lpPicFile]; } - if (p.pic == NULL) - { + if (p.pic == NULL) { #ifndef NOSURFACES Blit(pics["TANK"].pic, drawCoords.x, drawCoords.y); // TextOut(drawx+f_x/4,drawy+f_y/4, obj.type,c); - m_texts_to_render.push_back({ obj.type, drawCoords.x + f_x / 4, drawCoords.y + f_y / 4, m_color_converter->GetColor(c)}); + m_texts_to_render.push_back({ obj.type, drawCoords.x + f_x / 4, drawCoords.y + f_y / 4, m_color_converter->GetColor(c) }); #endif missingimages[obj.type] = TRUE; } @@ -6225,8 +5580,7 @@ void CIsoView::DrawMap() #endif } } - if (m.aircraft != -1) - { + if (m.aircraft != -1) { last_succeeded_operation = 10102; AIRCRAFT obj; @@ -6243,17 +5597,14 @@ void CIsoView::DrawMap() PICDATA p = pics[lpPicFile]; - if (p.pic == NULL) - { - if (!missingimages[obj.type]) - { + if (p.pic == NULL) { + if (!missingimages[obj.type]) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(obj.type); p = pics[lpPicFile]; } - if (p.pic == NULL) - { + if (p.pic == NULL) { #ifndef NOSURFACES Blit(pics["TANK"].pic, drawCoords.x, drawCoords.y); //TextOut(drawx+f_x/4,drawy+f_y/4, obj.type,c); @@ -6277,9 +5628,8 @@ void CIsoView::DrawMap() } } int ic; - for (ic = 0;ic < SUBPOS_COUNT;ic++) - if (m.infantry[ic] != -1) - { + for (ic = 0; ic < SUBPOS_COUNT; ic++) + if (m.infantry[ic] != -1) { last_succeeded_operation = 10103; //errstream << "GetInfantryData()" << endl; @@ -6294,7 +5644,7 @@ void CIsoView::DrawMap() COLORREF c = GetColor(obj.house); - + int dir = (7 - atoi(obj.direction) / 32) % 8; CString lpPicFile = GetUnitPictureFilename(obj.type, dir); @@ -6302,22 +5652,19 @@ void CIsoView::DrawMap() DrawCell(drawCoords.x, drawCoords.y, 1, 1, c); #endif - static const ProjectedVec subPosLookup[5] = { ProjectedVec(0, -f_y / 4), ProjectedVec(f_x / 4 , 0), ProjectedVec(-f_x / 4, 0), ProjectedVec(0, f_y / 4), ProjectedVec()}; + static const ProjectedVec subPosLookup[5] = { ProjectedVec(0, -f_y / 4), ProjectedVec(f_x / 4 , 0), ProjectedVec(-f_x / 4, 0), ProjectedVec(0, f_y / 4), ProjectedVec() }; auto drawCoordsInf = drawCoords + subPosLookup[ic > 4 ? 4 : ic]; PICDATA p = pics[lpPicFile]; - if (p.pic == NULL) - { - if (!missingimages[obj.type]) - { + if (p.pic == NULL) { + if (!missingimages[obj.type]) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(obj.type); p = pics[lpPicFile]; } - if (p.pic == NULL) - { + if (p.pic == NULL) { #ifndef NOSURFACES Blit(pics["MAN"].pic, drawCoordsInf.x, drawCoordsInf.y); // TextOut(drawx+f_x/4,drawy+f_y/4, obj.type,c); @@ -6342,16 +5689,14 @@ void CIsoView::DrawMap() } } - if (m.terrain != -1) - { + if (m.terrain != -1) { last_succeeded_operation = 10104; int id = m.terraintype; int w = 1, h = 1; PICDATA pic; - if (id > -1 && id < 0x0F00) - { + if (id > -1 && id < 0x0F00) { w = treeinfo[id].w; h = treeinfo[id].h; pic = treeinfo[id].pic; @@ -6359,20 +5704,17 @@ void CIsoView::DrawMap() //CString lpPicFile=GetUnitPictureFilename(type, 0); - if (pic.pic == NULL) - { + if (pic.pic == NULL) { CString type; Map->GetTerrainData(m.terrain, &type); - if (missingimages.find(type) == missingimages.end()) - { + if (missingimages.find(type) == missingimages.end()) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(type); ::Map->UpdateTreeInfo(&type); pic = treeinfo[id].pic; } - if (pic.pic == NULL) - { + if (pic.pic == NULL) { #ifndef NOSURFACES Blit(pics["TREE"].pic, drawCoords.x, drawCoords.y - 19); #endif @@ -6380,8 +5722,7 @@ void CIsoView::DrawMap() } } - if (pic.pic) - { + if (pic.pic) { auto drawCoordsTerrain = drawCoords + ProjectedVec(f_x / 2 - (pic.wMaxWidth / 2), f_y / 2 - 3 - (pic.wMaxHeight / 2)); @@ -6399,34 +5740,29 @@ void CIsoView::DrawMap() #ifdef SMUDGE_SUPP - if (m.smudge != -1) - { + if (m.smudge != -1) { last_succeeded_operation = 10104; int id = m.smudgetype; PICDATA pic; - if (id > -1 && id < 0x0F00) - { + if (id > -1 && id < 0x0F00) { pic = smudgeinfo[id].pic; } - if (pic.pic == NULL) - { + if (pic.pic == NULL) { SMUDGE data; CString& type = data.type; Map->GetSmudgeData(m.smudge, &data); - if (missingimages.find(type) == missingimages.end()) - { + if (missingimages.find(type) == missingimages.end()) { SetError("Loading graphics"); theApp.m_loading->LoadUnitGraphic(type); ::Map->UpdateSmudgeInfo(type); pic = smudgeinfo[id].pic; } - if (pic.pic == NULL) - { + if (pic.pic == NULL) { #ifndef NOSURFACES // Blit(pics["TREE"].pic,drawCoords.x,drawCoords.y-19); #endif @@ -6434,9 +5770,8 @@ void CIsoView::DrawMap() } } - if (pic.pic) - { - auto drawCoordsSmudge = drawCoords + ProjectedVec(f_x / 2 - (pic.wMaxWidth / 2), /*f_y / 2 - 3*/ - (pic.wMaxHeight / 2)); + if (pic.pic) { + auto drawCoordsSmudge = drawCoords + ProjectedVec(f_x / 2 - (pic.wMaxWidth / 2), /*f_y / 2 - 3*/ -(pic.wMaxHeight / 2)); #ifndef NOSURFACES Blit(pic.pic, drawCoordsSmudge.x, drawCoordsSmudge.y); @@ -6452,8 +5787,7 @@ void CIsoView::DrawMap() #endif - if (m.celltag != -1) - { + if (m.celltag != -1) { #ifdef NOSURFACES lpdsBack->Unlock(NULL); @@ -6465,8 +5799,7 @@ void CIsoView::DrawMap() #endif } - if (m.waypoint != -1) - { + if (m.waypoint != -1) { DWORD dwPos; CString ID; @@ -6500,7 +5833,7 @@ void CIsoView::DrawMap() const auto waypointImageCoords = ProjectedCoords({ drawCoords.x, drawCoords.y }) + waypointImageOffset; const auto waypointTextCoords = ProjectedCoords({ drawCoords.x, drawCoords.y }) + waypointTextOffset; m_waypoints_to_render.push_back({ waypointImageCoords.x, waypointImageCoords.y }); - m_texts_to_render.push_back({ ID.GetString(), waypointTextCoords.x, waypointTextCoords.y, RGB(0,0,255), false, useFont9, true}); + m_texts_to_render.push_back({ ID.GetString(), waypointTextCoords.x, waypointTextCoords.y, RGB(0,0,255), false, useFont9, true }); #ifdef NOSURFACES lpdsBack->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL); #endif @@ -6510,8 +5843,7 @@ void CIsoView::DrawMap() } - for (const auto& tube : Map->GetTubes()) - { + for (const auto& tube : Map->GetTubes()) { DrawTube(*tube, &ddsd); } @@ -6520,22 +5852,19 @@ void CIsoView::DrawMap() #endif // delayed waypoint rendering - for (const auto& wp : m_waypoints_to_render) - { + for (const auto& wp : m_waypoints_to_render) { Blit((LPDIRECTDRAWSURFACE4)pics["FLAG"].pic, wp.drawx, wp.drawy); } // map tool rendering - if (AD.mode == ACTIONMODE_MAPTOOL) - { + if (AD.mode == ACTIONMODE_MAPTOOL) { if (AD.tool) AD.tool->render(); } lpdsTemp->Blt(NULL, lpdsBack, NULL, 0, 0); // lpdsTemp always holds the scene drawn above, unscaled to the window - if (m_cellCursor != MapCoords(-1, -1)) - { + if (m_cellCursor != MapCoords(-1, -1)) { SurfaceLocker locker(lpdsBack); auto desc = locker.ensure_locked(); if (desc) @@ -6544,10 +5873,8 @@ void CIsoView::DrawMap() auto renderDuration = std::chrono::duration_cast>(std::chrono::steady_clock::now() - startTime); // not including text output, ReleaseDC, waitForVerticalBlank etc below - if (bDrawStats) - { - if (theApp.m_Options.bShowStats) - { + if (bDrawStats) { + if (theApp.m_Options.bShowStats) { auto systemStats = std::format("ms: {0} Left: {1} Top: {2} Right: {3} Bottom: {4}", renderDuration.count(), left, top, right, bottom); m_texts_to_render.push_back({ systemStats.c_str(), r.left + 10, r.top + 10 + (-m_fontDefaultHeight) * 3 / 2, RGB(0,0,0), true }); } @@ -6556,14 +5883,13 @@ void CIsoView::DrawMap() m_texts_to_render.push_back({ moneyStr.c_str(), r.left + 10, r.top + 10, RGB(0,0,0), true }); } - if (rscroll) - { + if (rscroll) { const auto& sc = pics["SCROLLCURSOR"]; Blit((LPDIRECTDRAWSURFACE4)sc.pic, rclick_x * m_viewScale.x + r.left - sc.wWidth / 2, rclick_y * m_viewScale.y + r.top - sc.wHeight / 2); } BlitBackbufferToHighRes(); // lpdsBackHighRes contains the same graphic, but scaled to the whole window - + RenderUIOverlay(); if (theApp.m_Options.bVSync) dd->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL); @@ -6579,8 +5905,7 @@ void CIsoView::RenderUIOverlay() LPDIRECTDRAWSURFACE4 dds = lpdsBack; bool useHighRes = false; - if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) - { + if (m_viewScale != Vec2(1.0f, 1.0f) && lpdsBackHighRes) { dds = lpdsBackHighRes; useHighRes = true; } @@ -6634,25 +5959,21 @@ void CIsoView::RenderUIOverlay() auto red = m_color_converter->GetColor(255, 0, 0); auto blue = m_color_converter->GetColor(0, 0, 255); d.Rectangle(sllt.x, sllt.y, slbr.x, slbr.y, red); - d.Rectangle(sllt.x-1, sllt.y-1, slbr.x+1, slbr.y+1, red); + d.Rectangle(sllt.x - 1, sllt.y - 1, slbr.x + 1, slbr.y + 1, red); d.Rectangle(ls_lt.x, ls_lt.y, ls_br.x, ls_br.y, blue); - d.Rectangle(ls_lt.x+1, ls_lt.y+1, ls_br.x-1, ls_br.y-1, blue); + d.Rectangle(ls_lt.x + 1, ls_lt.y + 1, ls_br.x - 1, ls_br.y - 1, blue); dds->Unlock(NULL); - + RECT r; GetWindowRect(&r); - for (const auto& s : m_texts_to_render) - { + for (const auto& s : m_texts_to_render) { const bool blue = s.color == RGB(0, 0, 255); // TODO: TextRenderer should support setting the color at render time - if (s.fixedScreenPos || !useHighRes) - { + if (s.fixedScreenPos || !useHighRes) { auto textRenderer = s.useFont9 ? (blue ? *m_textBlue9 : *m_text9) : (blue ? *m_textBlue : *m_textDefault); textRenderer.RenderText(dds, s.drawx, s.drawy, s.text, s.centered); - } - else - { + } else { auto textRenderer = s.useFont9 ? (blue ? *m_textBlue9Scaled : *m_text9Scaled) : (blue ? *m_textBlueScaled : *m_textScaled); textRenderer.RenderText(dds, r.left + (s.drawx - r.left) / m_viewScale.x, r.top + (s.drawy - r.top) / m_viewScale.y, s.text, s.centered); } @@ -6676,7 +5997,7 @@ void CIsoView::SetScroll(int xscroll, int yscroll) m_viewOffset = ProjectedVec(xscroll, yscroll); - + if (m_viewOffset.x < (Map->GetHeight() / 2 - 14 - r.left / f_x) * f_x) m_viewOffset.x = (Map->GetHeight() / 2 - 14 - r.left / f_x) * f_x; if (m_viewOffset.x + r.right * m_viewScale.x > (Map->GetHeight() / 2 + Map->GetWidth() + 14) * f_x) @@ -6710,8 +6031,7 @@ void CIsoView::OnKillFocus(CWnd* pNewWnd) { CView::OnKillFocus(pNewWnd); - if (rscroll) - { + if (rscroll) { errstream << "Killing scroll" << endl; errstream.flush(); @@ -6741,7 +6061,7 @@ void CIsoView::FocusWaypoint(int index) RECT r; GetWindowRect(&r); - auto pos = ProjectedVec((x - (r.right - r.left) / 2 * m_viewScale.x) - r.left, (y - (r.bottom - r.top) / 2 * m_viewScale.y) - r.top); + auto pos = ProjectedVec((x - (r.right - r.left) / 2 * m_viewScale.x) - r.left, (y - (r.bottom - r.top) / 2 * m_viewScale.y) - r.top); SetScroll(pos.x, pos.y); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); @@ -6761,7 +6081,7 @@ BOOL CIsoView::OnMouseWheel(UINT nFlags, short zDelta, CPoint ptScreen) RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); CMyViewFrame& dlg = *(CMyViewFrame*)owner; dlg.m_minimap.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - + return CView::OnMouseWheel(nFlags, zDelta, pt); } @@ -6777,14 +6097,13 @@ void CIsoView::Zoom(CPoint& pt, float f) m_viewScaleControl = 1.0f; if (m_viewScaleControl < 0.1f) m_viewScaleControl = 0.1f; - + if (!theApp.m_Options.viewScaleUseSteps) m_viewScale.set(m_viewScaleControl, m_viewScaleControl); - else - { + else { // find previous step - auto prevStepIt = std::find_if(theApp.m_Options.viewScaleSteps.rbegin(), theApp.m_Options.viewScaleSteps.rend(), [oldScale](auto f) {return f >= oldScale.x;}); - auto stepIt = std::find_if(theApp.m_Options.viewScaleSteps.rbegin(), theApp.m_Options.viewScaleSteps.rend(), [this](auto f) {return f >= m_viewScaleControl;}); + auto prevStepIt = std::find_if(theApp.m_Options.viewScaleSteps.rbegin(), theApp.m_Options.viewScaleSteps.rend(), [oldScale](auto f) {return f >= oldScale.x; }); + auto stepIt = std::find_if(theApp.m_Options.viewScaleSteps.rbegin(), theApp.m_Options.viewScaleSteps.rend(), [this](auto f) {return f >= m_viewScaleControl; }); if (stepIt > prevStepIt) stepIt = prevStepIt + 1; if (stepIt < prevStepIt) @@ -6792,7 +6111,7 @@ void CIsoView::Zoom(CPoint& pt, float f) auto nextScale = stepIt == theApp.m_Options.viewScaleSteps.rend() ? 1.0f : *stepIt; m_viewScale.set(nextScale, nextScale); } - + auto newScaledMPos = GetProjectedCoordinatesFromClientCoordinates(pt); m_viewOffset = m_viewOffset + ((oldScaledMPos - newScaledMPos)).convertT(); // this lets the mouse cursor pixel stay constant diff --git a/MissionEditor/IsoView.h b/MissionEditor/IsoView.h index 0a56abb..b250cf0 100644 --- a/MissionEditor/IsoView.h +++ b/MissionEditor/IsoView.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_ISOVIEW_H__7FB6D6A0_7B52_11D3_99E1_DA6DFD21E706__INCLUDED_) @@ -46,7 +46,7 @@ struct TextToRender int drawx; int drawy; int color; - bool fixedScreenPos = false; + bool fixedScreenPos = false; bool useFont9 = false; bool centered = false; }; @@ -66,7 +66,7 @@ class CIsoView : public CView protected: DECLARE_DYNCREATE(CIsoView) -// attributes + // attributes public: INT m_mapx; INT m_mapy; @@ -94,18 +94,18 @@ private: std::vector m_texts_to_render; std::vector m_waypoints_to_render; - -// operations + + // operations public: - CIsoView(); + CIsoView(); virtual ~CIsoView(); -// overwriteables - //{{AFX_VIRTUAL(CIsoView) - public: + // overwriteables + //{{AFX_VIRTUAL(CIsoView) +public: virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); - protected: +protected: virtual void OnDraw(CDC* pDC); // Überschrieben zum Zeichnen dieser Ansicht virtual void OnInitialUpdate(); // Zum ersten Mal nach der Konstruktion virtual BOOL PreCreateWindow(CREATESTRUCT& cs); @@ -114,7 +114,7 @@ public: // implementation protected: - + #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; @@ -129,7 +129,7 @@ protected: afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMove(int x, int y); afx_msg void OnSize(UINT nType, int cx, int cy); @@ -170,21 +170,21 @@ public: int m_BrushSize_x; int m_BrushSize_y; BOOL ReachableFrom(DWORD dwStart, DWORD dwEnd); - void __fastcall ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL bNonMorphableMove, BOOL bOnlyThisTile=FALSE, BOOL bNoSlopes=FALSE); - void UpdateOverlayPictures(int id=-1); + void __fastcall ChangeTileHeight(DWORD dwPos, DWORD dwNewHeight, BOOL bNonMorphableMove, BOOL bOnlyThisTile = FALSE, BOOL bNoSlopes = FALSE); + void UpdateOverlayPictures(int id = -1); void UpdateStatusBar(int x, int y); - void DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted=FALSE, HDC hDC=nullptr); - void DrawCell(void* dest, int dest_width, int dest_height, int dest_pitch, int x, int y, int w, int h, int col, bool dotted=false, bool touchNeighbours=false, int colNeighbour=CLR_INVALID) const; + void DrawCell(int x, int y, int w, int h, COLORREF col, BOOL dotted = FALSE, HDC hDC = nullptr); + void DrawCell(void* dest, int dest_width, int dest_height, int dest_pitch, int x, int y, int w, int h, int col, bool dotted = false, bool touchNeighbours = false, int colNeighbour = CLR_INVALID) const; void DrawCellCursor(const MapCoords& mapCoords, const DDSURFACEDESC2& desc); - void DrawTube(const CTube& tube, const DDSURFACEDESC2* ddsd=nullptr, const COLORREF* color=nullptr) const; + void DrawTube(const CTube& tube, const DDSURFACEDESC2* ddsd = nullptr, const COLORREF* color = nullptr) const; /// /// Converts from (world) pixel coordinates to logical map coordinates /// /// World pixel coordinates /// Logical map coordinates - MapCoords GetMapCoordinates(const ProjectedCoords& projCoords, bool bAllowAccessBehindCliffs=false, bool ignoreHideFlags = false) const; - + MapCoords GetMapCoordinates(const ProjectedCoords& projCoords, bool bAllowAccessBehindCliffs = false, bool ignoreHideFlags = false) const; + /// /// Converts from view / render target pixel coordinates (0/0 is top left corner of screen) to logical map coordinates /// If you use mouse-move coordinates you need to @@ -264,77 +264,70 @@ public: void SetError(const char* text); CWnd* owner; void ReInitializeDDraw(); - COLORREF GetColor(const char* house, const char* color=NULL); - void Blit(LPDIRECTDRAWSURFACE4 pic, int x, int y, int width=-1, int height=-1) + COLORREF GetColor(const char* house, const char* color = NULL); + void Blit(LPDIRECTDRAWSURFACE4 pic, int x, int y, int width = -1, int height = -1) { - if(pic==NULL) return; + if (pic == NULL) return; - x+=1; - y+=1; + x += 1; + y += 1; //y-=f_y; RECT r; GetDesktopWindow()->GetWindowRect(&r); //GetWindowRect(&r); - if(width==-1 || height==-1) - { + if (width == -1 || height == -1) { DDSURFACEDESC2 ddsd; memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; pic->GetSurfaceDesc(&ddsd); - width=ddsd.dwWidth; - height=ddsd.dwHeight; + width = ddsd.dwWidth; + height = ddsd.dwHeight; } - if(x+width<0 || y+height<0) return; - if(x>r.right || y>r.bottom) return; + if (x + width < 0 || y + height < 0) return; + if (x > r.right || y > r.bottom) return; + + if (x < 0 || y < 0 || x + width >= r.right || y + height >= r.bottom) { - if(x<0 || y<0 || x+width>=r.right || y+height>=r.bottom) - { - RECT blrect; RECT srcRect; - srcRect.left=0; - srcRect.top=0; - srcRect.right=width; - srcRect.bottom=height; - blrect.left=x; - if(blrect.left<0) - { - srcRect.left=r.left+1-blrect.left; - blrect.left=r.left+1; + srcRect.left = 0; + srcRect.top = 0; + srcRect.right = width; + srcRect.bottom = height; + blrect.left = x; + if (blrect.left < 0) { + srcRect.left = r.left + 1 - blrect.left; + blrect.left = r.left + 1; } - blrect.top=y; - if(blrect.top<0) - { - + blrect.top = y; + if (blrect.top < 0) { + //errstream << "BlRect.top=" << blrect.top << endl; - srcRect.top=(r.top+1)-blrect.top; //(r.top-blrect.top); - blrect.top=r.top+1;//r.top; + srcRect.top = (r.top + 1) - blrect.top; //(r.top-blrect.top); + blrect.top = r.top + 1;//r.top; // errstream << blrect.top << " " << srcRect.top << endl; } - blrect.right=(x+width); - if(x+width>r.right) - { - srcRect.right=width-((x+width)-r.right);// -(-blrect.right+r.right); - blrect.right=r.right; + blrect.right = (x + width); + if (x + width > r.right) { + srcRect.right = width - ((x + width) - r.right);// -(-blrect.right+r.right); + blrect.right = r.right; } - blrect.bottom=(y+height); - if(y+height>r.bottom) - { - srcRect.bottom=height-((y+height)-r.bottom); // -(-blrect.bottom+r.bottom); - blrect.bottom=r.bottom; + blrect.bottom = (y + height); + if (y + height > r.bottom) { + srcRect.bottom = height - ((y + height) - r.bottom); // -(-blrect.bottom+r.bottom); + blrect.bottom = r.bottom; } DDBLTFX fx; memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); + fx.dwSize = sizeof(DDBLTFX); lpdsBack->Blt(&blrect, pic, &srcRect, DDBLT_KEYSRC, &fx); - } - else - lpdsBack->BltFast(x,y, pic, NULL, DDBLTFAST_SRCCOLORKEY); + } else + lpdsBack->BltFast(x, y, pic, NULL, DDBLTFAST_SRCCOLORKEY); } void updateFontScaled(); void TextOut(int x, int y, const char* text, COLORREF col); @@ -343,18 +336,18 @@ public: LPDIRECTDRAWSURFACE4 lpdsTemp; // used for saving the isoview when drawing current tile LPDIRECTDRAWSURFACE4 lpdsBackHighRes; // used for rendering text and some lines in high-res LPDIRECTDRAWSURFACE4 lpds; - DDPIXELFORMAT pf; + DDPIXELFORMAT pf; std::unique_ptr m_color_converter; LPDIRECTDRAW4 dd; LPDIRECTDRAW dd_1; HGLRC m_hglrc; void HandleProperties(int n, int type); - void UpdateDialog(BOOL bRepos=TRUE); + void UpdateDialog(BOOL bRepos = TRUE); CMenu m_menu; BOOL b_IsLoading; int m_fontDefaultHeight; int m_Font9Height; - std::unique_ptr m_textDefault; + std::unique_ptr m_textDefault; std::unique_ptr m_textScaled; std::unique_ptr m_text9; std::unique_ptr m_text9Scaled; @@ -368,8 +361,8 @@ private: private: RECT m_myRect; - - + + // mapdata* _map; COLORREF m_linecolor; RECT line; diff --git a/MissionEditor/Lighting.cpp b/MissionEditor/Lighting.cpp index 8d7f7e5..92c81e9 100644 --- a/MissionEditor/Lighting.cpp +++ b/MissionEditor/Lighting.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Lighting.cpp: Implementierungsdatei @@ -87,7 +87,7 @@ END_MESSAGE_MAP() void CLighting::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); m_Ambient.SetWindowText(ini.GetString("Lighting", "Ambient")); m_Ambient2.SetWindowText(ini.GetString("Lighting", "IonAmbient")); @@ -102,123 +102,123 @@ void CLighting::UpdateDialog() //MessageBox(ini.GetString("Lightning", "Ambient")); } -BOOL CLighting::OnInitDialog() +BOOL CLighting::OnInitDialog() { CDialog::OnInitDialog(); - + #ifdef RA2_MODE SetDlgItemText(IDC_LIONSTORM, "Weather Storm Settings"); #endif - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CLighting::OnChangeAmbient() +void CLighting::OnChangeAmbient() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Ambient.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "Ambient", text); } -void CLighting::OnChangeLevel() +void CLighting::OnChangeLevel() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Level.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "Level", text); } -void CLighting::OnKillfocusAmbient() +void CLighting::OnKillfocusAmbient() { - + } -void CLighting::OnChangeRed() +void CLighting::OnChangeRed() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Red.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "Red", text); } -void CLighting::OnChangeGreen() +void CLighting::OnChangeGreen() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Green.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "Green", text); } -void CLighting::OnChangeBlue() +void CLighting::OnChangeBlue() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Blue.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "Blue", text); } -void CLighting::OnChangeAmbient2() +void CLighting::OnChangeAmbient2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Ambient2.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "IonAmbient", text); } -void CLighting::OnChangeLevel2() +void CLighting::OnChangeLevel2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Level2.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "IonLevel", text); } -void CLighting::OnChangeRed2() +void CLighting::OnChangeRed2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Red2.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "IonRed", text); } -void CLighting::OnChangeGreen2() +void CLighting::OnChangeGreen2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Green2.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "IonGreen", text); } -void CLighting::OnChangeBlue2() +void CLighting::OnChangeBlue2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString ctext; m_Blue2.GetWindowText(ctext); - CString text=(char*)(LPCTSTR)ctext; + CString text = (char*)(LPCTSTR)ctext; ini.SetString("Lighting", "IonBlue", text); } diff --git a/MissionEditor/Lighting.h b/MissionEditor/Lighting.h index a371a1d..b17cde7 100644 --- a/MissionEditor/Lighting.h +++ b/MissionEditor/Lighting.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_LIGHTNING_H__9DC7B326_6DF2_11D3_99E1_D14A1D4DCF07__INCLUDED_) @@ -36,14 +36,14 @@ class CLighting : public CDialog { DECLARE_DYNCREATE(CLighting) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CLighting(); ~CLighting(); -// Dialogfelddaten - //{{AFX_DATA(CLighting) + // Dialogfelddaten + //{{AFX_DATA(CLighting) enum { IDD = IDD_LIGHTING }; CFloatEdit m_Red2; CFloatEdit m_Red; @@ -61,7 +61,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CLighting) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/LineDrawer.cpp b/MissionEditor/LineDrawer.cpp index a7d9ce5..32e0afa 100644 --- a/MissionEditor/LineDrawer.cpp +++ b/MissionEditor/LineDrawer.cpp @@ -30,7 +30,7 @@ static int ModLookup[] = { 4 }; -LineDrawer::LineDrawer(void* dest, int bytes_per_pixel, int width, int height, int pitch): +LineDrawer::LineDrawer(void* dest, int bytes_per_pixel, int width, int height, int pitch) : m_dest(dest), m_bytes_per_pixel(bytes_per_pixel), m_width(width), @@ -60,8 +60,7 @@ void LineDrawer::DrawLine(int from_x, int from_y, int to_x, int to_y, int color, m_last_y = to_y; if (abs(w) >= abs(h)) { return w >= 0 ? DrawLineImplX(from_x, from_y, to_x, to_y, color, style) : DrawLineImplX(to_x, to_y, from_x, from_y, color, style); - } - else { + } else { return h >= 0 ? DrawLineImplY(from_x, from_y, to_x, to_y, color, style) : DrawLineImplY(to_x, to_y, from_x, from_y, color, style); } } @@ -83,12 +82,12 @@ void LineDrawer::SetPixel(char* const dest, const int cur_x, const int cur_y, co void LineDrawer::DrawLineImplX(const int from_x, const int from_y, const int to_x, const int to_y, const int color, const LineStyle style) { - // X major line drawing + // X major line drawing - assert (from_x <= to_x); + assert(from_x <= to_x); const int w = to_x - from_x; const int h = abs(to_y - from_y); - assert (w >= h); + assert(w >= h); const int increment_e = 2 * h; const int increment_ne = 2 * (h - w); const int y_inc = (to_y - from_y) < 0 ? -1 : 1; @@ -100,12 +99,10 @@ void LineDrawer::DrawLineImplX(const int from_x, const int from_y, const int to_ char* dest = reinterpret_cast(m_dest); SetPixel(dest, cur_x, cur_y, color); - for(; cur_x < to_x; ++cur_x) - { + for (; cur_x < to_x; ++cur_x) { if (d < 0) { d += increment_e; - } - else { + } else { d += increment_ne; cur_y += y_inc; } @@ -133,12 +130,10 @@ void LineDrawer::DrawLineImplY(const int from_x, const int from_y, const int to_ char* dest = reinterpret_cast(m_dest); SetPixel(dest, cur_x, cur_y, color); - for (; cur_y < to_y; ++cur_y) - { + for (; cur_y < to_y; ++cur_y) { if (d < 0) { d += increment_e; - } - else { + } else { d += increment_ne; cur_x += x_inc; } diff --git a/MissionEditor/LineDrawer.h b/MissionEditor/LineDrawer.h index 550b24c..48043cc 100644 --- a/MissionEditor/LineDrawer.h +++ b/MissionEditor/LineDrawer.h @@ -22,7 +22,7 @@ #include -enum class LineStyle: int +enum class LineStyle : int { Standard, Dotted_2, diff --git a/MissionEditor/Loading.cpp b/MissionEditor/Loading.cpp index 02e8a7d..831e525 100644 --- a/MissionEditor/Loading.cpp +++ b/MissionEditor/Loading.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Loading.cpp: Implementierungsdatei @@ -58,40 +58,38 @@ CLoading::CLoading(CWnd* pParent /*=NULL*/) Create(CLoading::IDD, pParent); - loaded=FALSE; - cur_theat='T'; + loaded = FALSE; + cur_theat = 'T'; - - m_hCache=NULL; - m_hConquer=NULL; - m_hIsoSnow=NULL; - m_hIsoTemp=NULL; - m_hLocal=NULL; - m_hTemperat=NULL; - m_hTibSun=NULL; - m_hLangMD=NULL; - m_pic_count=0; - s_tiledata=NULL; - t_tiledata=NULL; - u_tiledata=NULL; - s_tiledata_count=0; - t_tiledata_count=0; - u_tiledata_count=0; - tiledata=NULL; - tiledata_count=0; + m_hCache = NULL; + m_hConquer = NULL; + m_hIsoSnow = NULL; + m_hIsoTemp = NULL; + m_hLocal = NULL; + m_hTemperat = NULL; + m_hTibSun = NULL; + m_hLangMD = NULL; + m_pic_count = 0; - int i=0; - for(i=0;i<101; i++) - { - - m_hExpand[i].hExpand=NULL; + s_tiledata = NULL; + t_tiledata = NULL; + u_tiledata = NULL; + s_tiledata_count = 0; + t_tiledata_count = 0; + u_tiledata_count = 0; + tiledata = NULL; + tiledata_count = 0; + + int i = 0; + for (i = 0; i < 101; i++) { + + m_hExpand[i].hExpand = NULL; } - for(i=0;i<100; i++) - { - - m_hECache[i]=NULL; + for (i = 0; i < 100; i++) { + + m_hECache[i] = NULL; } errstream << "CLoading::CLoading() called" << endl; @@ -121,17 +119,17 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // message handlers CLoading -BOOL bUseFirestorm=TRUE; +BOOL bUseFirestorm = TRUE; void CLoading::Load() { auto startTime = std::chrono::steady_clock::now(); - + CString artFile; - - + + // show a wait cursor SetCursor(LoadCursor(NULL, IDC_WAIT)); @@ -150,9 +148,9 @@ void CLoading::Load() errstream << "Initializing mix files" << std::endl; errstream.flush(); MEMORYSTATUS ms; - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - int cs=ms.dwAvailPhys+ms.dwAvailPageFile; + int cs = ms.dwAvailPhys + ms.dwAvailPageFile; InitMixFiles(); errstream << "Loading palettes" << std::endl << std::endl; errstream.flush(); @@ -161,13 +159,13 @@ void CLoading::Load() // Load voxel normal tables InitVoxelNormalTables(); - + // create a ini file containing some info XCC Mixer needs CreateINI(); // set progress bar range to 0-2 - m_progress.SetRange(0,2); - + m_progress.SetRange(0, 2); + // rules.ini m_cap.SetWindowText(GetLanguageStringACP("LoadLoadRules")); m_progress.SetPos(1); @@ -175,75 +173,66 @@ void CLoading::Load() LoadTSIni("Rules.ini", &rules, FALSE); #ifdef TS_MODE - if(bUseFirestorm) - { + if (bUseFirestorm) { // very special case, the types list don´t have any order according to the original rules! CIniFile fstorm; LoadTSIni("firestrm.ini", &fstorm, TRUE); int i; CString cuSection; - cuSection="InfantryTypes"; - for(i=0;i0) { + if (artmd.Size() > 0) { art = std::move(artmd); } } #endif - + m_progress.SetPos(2); //art.DeleteLeadingSpaces(TRUE, TRUE); @@ -342,19 +328,18 @@ void CLoading::Load() // sound.ini m_cap.SetWindowText(GetLanguageStringACP("LoadLoadSound")); m_progress.SetPos(1); - UpdateWindow(); - - - if(bUseFirestorm) { + UpdateWindow(); + + + if (bUseFirestorm) { int b; - for(b=99;b>0;b--) - { + for (b = 99; b > 0; b--) { char p[50]; itoa(b, p, 10); - CString name="Sound"; - if(strlen(p)<2) name+="0"; - name+=p; - name+=".ini"; + CString name = "Sound"; + if (strlen(p) < 2) name += "0"; + name += p; + name += ".ini"; LoadTSIni(name, &sound, FALSE); if (sound.Size() > 0) { @@ -395,9 +380,9 @@ void CLoading::Load() UpdateWindow(); LoadTSIni("Ai.ini", &ai, FALSE); #ifdef TS_MODE - if(bUseFirestorm) LoadTSIni("aifs.ini", &ai, TRUE);; + if (bUseFirestorm) LoadTSIni("aifs.ini", &ai, TRUE);; #else - if(bUseFirestorm && yuri_mode) LoadTSIni("aimd.ini", &ai, TRUE); // YR + if (bUseFirestorm && yuri_mode) LoadTSIni("aimd.ini", &ai, TRUE); // YR #endif m_progress.SetPos(2); UpdateWindow(); @@ -410,7 +395,7 @@ void CLoading::Load() m_progress.SetPos(1); UpdateWindow(); LoadTSIni("Temperat.ini", &tiles_t, FALSE, preferLocalTheater); - if(yuri_mode) LoadTSIni("TemperatMD.ini", &tiles_t, TRUE, preferLocalTheater); + if (yuri_mode) LoadTSIni("TemperatMD.ini", &tiles_t, TRUE, preferLocalTheater); m_progress.SetPos(2); UpdateWindow(); @@ -419,7 +404,7 @@ void CLoading::Load() m_progress.SetPos(1); UpdateWindow(); LoadTSIni("Snow.ini", &tiles_s, FALSE, preferLocalTheater); - if(yuri_mode) LoadTSIni("SnowMD.ini", &tiles_s, TRUE, preferLocalTheater); + if (yuri_mode) LoadTSIni("SnowMD.ini", &tiles_s, TRUE, preferLocalTheater); m_progress.SetPos(2); UpdateWindow(); @@ -428,12 +413,11 @@ void CLoading::Load() m_progress.SetPos(1); UpdateWindow(); LoadTSIni("Urban.ini", &tiles_u, FALSE, preferLocalTheater); - if(yuri_mode) LoadTSIni("UrbanMD.ini", &tiles_u, TRUE, preferLocalTheater); + if (yuri_mode) LoadTSIni("UrbanMD.ini", &tiles_u, TRUE, preferLocalTheater); m_progress.SetPos(2); UpdateWindow(); - if(yuri_mode) - { + if (yuri_mode) { m_cap.SetWindowText(GetLanguageStringACP("LoadLoadUrbanN")); m_progress.SetPos(1); UpdateWindow(); @@ -461,21 +445,21 @@ void CLoading::Load() UpdateWindow(); } - - + + // load Command & Conquer Rules.ini section names LoadStrings(); // ok now directdraw m_cap.SetWindowText(GetLanguageStringACP("LoadInitDDraw")); - m_progress.SetRange(0,4); - + m_progress.SetRange(0, 4); + InitDirectDraw(); m_progress.SetPos(3); UpdateWindow(); - + /*errstream << "Now calling InitPics()\n"; errstream.flush(); m_cap.SetWindowText(GetLanguageStringACP("LoadInitPics")); @@ -484,8 +468,7 @@ void CLoading::Load() errstream.flush();*/ auto delay = std::chrono::duration(theApp.m_Options.fLoadScreenDelayInSeconds); - if ((std::chrono::steady_clock::now() - startTime) < delay) - { + if ((std::chrono::steady_clock::now() - startTime) < delay) { std::this_thread::sleep_until(startTime + delay); } @@ -500,42 +483,37 @@ void CLoading::Load() void CLoading::InitPics(CProgressCtrl* prog) { MEMORYSTATUS ms; - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - int cs=ms.dwAvailPhys+ms.dwAvailPageFile; + int cs = ms.dwAvailPhys + ms.dwAvailPageFile; errstream << "InitPics() called. Available memory: " << cs << endl; errstream.flush(); - - - + + + CalcPicCount(); - if(m_progress.m_hWnd!=NULL) m_progress.SetRange(0,m_pic_count/15+1); + if (m_progress.m_hWnd != NULL) m_progress.SetRange(0, m_pic_count / 15 + 1); - if(!theApp.m_Options.bDoNotLoadBMPs) - { + if (!theApp.m_Options.bDoNotLoadBMPs) { int k; CFileFind ff; - CString bmps=(CString)AppPath+"\\pics2\\*.bmp"; - if(ff.FindFile(bmps)) - { + CString bmps = (CString)AppPath + "\\pics2\\*.bmp"; + if (ff.FindFile(bmps)) { - BOOL lastFile=FALSE; - - for(k=0;km_view.m_isoview->dd, *BitmapFromFile(ff.GetFilePath())).Detach(); DDSURFACEDESC2 desc; @@ -550,14 +528,11 @@ void CLoading::InitPics(CProgressCtrl* prog) pics[(LPCTSTR)ff.GetFileName()].bType = PICDATA_TYPE_BMP; FSunPackLib::SetColorKey(((LPDIRECTDRAWSURFACE4)(pics[(LPCTSTR)ff.GetFileName()].pic)), -1); - } - catch (const BitmapNotFound&) - { + } catch (const BitmapNotFound&) { } - if(m_progress.m_hWnd!=NULL && k%15==0) - { - m_progress.SetPos(m_progress.GetPos()+1); + if (m_progress.m_hWnd != NULL && k % 15 == 0) { + m_progress.SetPos(m_progress.GetPos() + 1); UpdateWindow(); } } @@ -576,9 +551,7 @@ void CLoading::InitPics(CProgressCtrl* prog) pics["SCROLLCURSOR"].wHeight = desc.dwHeight; pics["SCROLLCURSOR"].wWidth = desc.dwWidth; pics["SCROLLCURSOR"].bType = PICDATA_TYPE_BMP; - } - catch (const BitmapNotFound&) - { + } catch (const BitmapNotFound&) { } try { @@ -598,13 +571,10 @@ void CLoading::InitPics(CProgressCtrl* prog) pics["CELLTAG"].y = -1; #endif pics["CELLTAG"].bType = PICDATA_TYPE_BMP; - } - catch (const BitmapNotFound&) - { + } catch (const BitmapNotFound&) { } - try - { + try { pics["FLAG"].pic = BitmapToSurface(((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->dd, *BitmapFromResource(IDB_FLAG)).Detach(); FSunPackLib::SetColorKey((LPDIRECTDRAWSURFACE4)pics["FLAG"].pic, -1); ::memset(&desc, 0, sizeof(DDSURFACEDESC2)); @@ -614,9 +584,7 @@ void CLoading::InitPics(CProgressCtrl* prog) pics["FLAG"].wHeight = desc.dwHeight; pics["FLAG"].wWidth = desc.dwWidth; pics["FLAG"].bType = PICDATA_TYPE_BMP; - } - catch (const BitmapNotFound&) - { + } catch (const BitmapNotFound&) { } @@ -625,46 +593,46 @@ void CLoading::InitPics(CProgressCtrl* prog) // prepare 1x1 hidden tile replacement DDSURFACEDESC2 ddsd; ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN; - ddsd.dwFlags=DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.dwWidth=f_x; - ddsd.dwHeight=f_y; + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.dwWidth = f_x; + ddsd.dwHeight = f_y; - LPDIRECTDRAWSURFACE4 srf=NULL; + LPDIRECTDRAWSURFACE4 srf = NULL; ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->dd->CreateSurface(&ddsd, &srf, 0); - pics["HTILE"].pic=srf; - pics["HTILE"].wHeight=ddsd.dwHeight; - pics["HTILE"].wWidth=ddsd.dwWidth; - pics["HTILE"].bType=PICDATA_TYPE_BMP; - + pics["HTILE"].pic = srf; + pics["HTILE"].wHeight = ddsd.dwHeight; + pics["HTILE"].wWidth = ddsd.dwWidth; + pics["HTILE"].bType = PICDATA_TYPE_BMP; + HDC hDC; srf->GetDC(&hDC); HPEN p; - int width=1; - p=CreatePen(PS_DOT, 0, RGB(0,120,0)); + int width = 1; + p = CreatePen(PS_DOT, 0, RGB(0, 120, 0)); - SelectObject(hDC,p); + SelectObject(hDC, p); POINT p1, p2, p3, p4; - p1.x=f_x/2; - p1.y=0; - p2.x=f_x/2+f_x/2; - p2.y=f_y/2; - p3.x=f_x/2-f_x/2+f_x/2-1; - p3.y=f_y/2+f_y/2-1; - p4.x=f_x/2+f_x/2-1; - p4.y=f_y/2-1; + p1.x = f_x / 2; + p1.y = 0; + p2.x = f_x / 2 + f_x / 2; + p2.y = f_y / 2; + p3.x = f_x / 2 - f_x / 2 + f_x / 2 - 1; + p3.y = f_y / 2 + f_y / 2 - 1; + p4.x = f_x / 2 + f_x / 2 - 1; + p4.y = f_y / 2 - 1; SetBkMode(hDC, TRANSPARENT); - MoveToEx(hDC, p1.x,p1.y-1,NULL); - LineTo(hDC, p2.x+1,p2.y); - LineTo(hDC, p3.x,p3.y+1); - LineTo(hDC, p4.x-1, p4.y); - LineTo(hDC, p1.x, p1.y-1); + MoveToEx(hDC, p1.x, p1.y - 1, NULL); + LineTo(hDC, p2.x + 1, p2.y); + LineTo(hDC, p3.x, p3.y + 1); + LineTo(hDC, p4.x - 1, p4.y); + LineTo(hDC, p1.x, p1.y - 1); srf->ReleaseDC(hDC); @@ -672,15 +640,15 @@ void CLoading::InitPics(CProgressCtrl* prog) // new: Prepare building terrain information: - for(auto const& [seq, id] : rules.GetSection("BuildingTypes")) { + for (auto const& [seq, id] : rules.GetSection("BuildingTypes")) { PrepareUnitGraphic(id); - - } - ms.dwLength=sizeof(MEMORYSTATUS); - GlobalMemoryStatus(&ms); - cs=ms.dwAvailPhys+ms.dwAvailPageFile; - int piccount=pics.size(); + } + ms.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&ms); + cs = ms.dwAvailPhys + ms.dwAvailPageFile; + + int piccount = pics.size(); errstream << "InitPics() finished and loaded " << piccount << " pictures. Available memory: " << cs << endl; errstream.flush(); @@ -688,7 +656,7 @@ void CLoading::InitPics(CProgressCtrl* prog) return; } -BOOL CLoading::OnInitDialog() +BOOL CLoading::OnInitDialog() { CDialog::OnInitDialog(); @@ -699,7 +667,7 @@ BOOL CLoading::OnInitDialog() #endif m_Version.SetWindowText(version); - + CString builder; builder.LoadString(IDS_BUILTBY); m_BuiltBy.SetWindowText(builder); @@ -707,9 +675,9 @@ BOOL CLoading::OnInitDialog() SetDlgItemText(IDC_LBUILTBY, GetLanguageStringACP("LoadBuiltBy")); SetDlgItemText(IDC_LVERSION, GetLanguageStringACP("LoadVersion")); SetDlgItemText(IDC_CAP, GetLanguageStringACP("LoadLoading")); - - + + UpdateWindow(); return TRUE; @@ -719,12 +687,12 @@ BOOL CLoading::OnInitDialog() // TODO: this was made for Win9x. It does not work anymore on modern operating systems if you don't run the editor as administrator (which you should not do) void CLoading::CreateINI() { - + wchar_t iniFile_[MAX_PATH]; CIniFile path; CString version; - + GetWindowsDirectoryW(iniFile_, MAX_PATH); std::string iniFile = utf16ToUtf8(iniFile_); #ifdef RA2_MODE @@ -755,15 +723,14 @@ void CLoading::CreateINI() -void CLoading::LoadTSIni(LPCTSTR lpFilename, CIniFile *lpIniFile, BOOL bIsExpansion, BOOL bCheckEditorDir) +void CLoading::LoadTSIni(LPCTSTR lpFilename, CIniFile* lpIniFile, BOOL bIsExpansion, BOOL bCheckEditorDir) { errstream << "LoadTSIni(" << lpFilename << "," << lpIniFile << "," << bIsExpansion << ") called" << endl; errstream.flush(); if (bCheckEditorDir) { // check if file is available in the editors application data folder - if (DoesFileExist((u8AppDataPath + lpFilename).c_str())) - { + if (DoesFileExist((u8AppDataPath + lpFilename).c_str())) { errstream << "File found in mission editor AppData directory (" << u8AppDataPath << ")" << endl; errstream.flush(); if (!bIsExpansion) @@ -774,38 +741,35 @@ void CLoading::LoadTSIni(LPCTSTR lpFilename, CIniFile *lpIniFile, BOOL bIsExpans } // check if file is available in the editors root folder - if(DoesFileExist(CString(AppPath) + lpFilename)) - { + if (DoesFileExist(CString(AppPath) + lpFilename)) { errstream << "File found in Mission Editor directory (" << AppPath << ")" << endl; errstream.flush(); - if(!bIsExpansion) - lpIniFile->LoadFile((CString)AppPath+lpFilename, TRUE); + if (!bIsExpansion) + lpIniFile->LoadFile((CString)AppPath + lpFilename, TRUE); else - lpIniFile->InsertFile((CString)AppPath+lpFilename, NULL, TRUE); + lpIniFile->InsertFile((CString)AppPath + lpFilename, NULL, TRUE); return; } } - if(theApp.m_Options.bSearchLikeTS) - { - - + if (theApp.m_Options.bSearchLikeTS) { + + // check if Rules.ini is available - if(DoesFileExist((CString)TSPath+lpFilename)) - { + if (DoesFileExist((CString)TSPath + lpFilename)) { errstream << "File found in TS directory (" << TSPath << ")" << endl; errstream.flush(); - if(!bIsExpansion) - lpIniFile->LoadFile((CString)TSPath+lpFilename, TRUE); + if (!bIsExpansion) + lpIniFile->LoadFile((CString)TSPath + lpFilename, TRUE); else - lpIniFile->InsertFile((CString)TSPath+lpFilename, NULL, TRUE); + lpIniFile->InsertFile((CString)TSPath + lpFilename, NULL, TRUE); return; } - - BOOL bExpandFound=FALSE; - + BOOL bExpandFound = FALSE; + + /*int i; for(i=1;i<101;i++) @@ -817,58 +781,53 @@ void CLoading::LoadTSIni(LPCTSTR lpFilename, CIniFile *lpIniFile, BOOL bIsExpans errstream << lpFilename << " found in expansion #" << i << endl; errstream.flush(); - + //if(!bIsExpansion) // lpIniFile->InsertFile((CString)TSPath+(CString)"FinalSun"+lpFilename, NULL); //else lpIniFile->InsertFile((CString)TSPath+(CString)"FinalSun"+lpFilename, NULL, TRUE); DeleteFile((CString)TSPath+(CString)"FinalSun"+lpFilename); - + bExpandFound=TRUE; } - + } }*/ - HMIXFILE hMix=FindFileInMix(lpFilename); - if(hMix) - { - if(FSunPackLib::XCC_ExtractFile(lpFilename, (CString)TSPath+(CString)"FinalSun"+lpFilename, hMix)) - { + HMIXFILE hMix = FindFileInMix(lpFilename); + if (hMix) { + if (FSunPackLib::XCC_ExtractFile(lpFilename, (CString)TSPath + (CString)"FinalSun" + lpFilename, hMix)) { - errstream << lpFilename << " found " << endl; - errstream.flush(); - - //if(!bIsExpansion) - // lpIniFile->InsertFile((CString)TSPath+(CString)"FinalSun"+lpFilename, NULL); - //else - lpIniFile->InsertFile((CString)TSPath+(CString)"FinalSun"+lpFilename, NULL, TRUE); + errstream << lpFilename << " found " << endl; + errstream.flush(); - DeleteFile((CString)TSPath+(CString)"FinalSun"+lpFilename); - - bExpandFound=TRUE; - } + //if(!bIsExpansion) + // lpIniFile->InsertFile((CString)TSPath+(CString)"FinalSun"+lpFilename, NULL); + //else + lpIniFile->InsertFile((CString)TSPath + (CString)"FinalSun" + lpFilename, NULL, TRUE); + + DeleteFile((CString)TSPath + (CString)"FinalSun" + lpFilename); + + bExpandFound = TRUE; + } } - if(!bIsExpansion && !bExpandFound) - { + if (!bIsExpansion && !bExpandFound) { // not found, go ahead if this is not a expansion only file... - FSunPackLib::XCC_ExtractFile(lpFilename,(CString)TSPath+(CString)"FinalSun"+lpFilename, m_hLocal); - - lpIniFile->LoadFile((CString)TSPath+(CString)"FinalSun"+lpFilename, TRUE); - - DeleteFile((CString)TSPath+(CString)"FinalSun"+lpFilename); + FSunPackLib::XCC_ExtractFile(lpFilename, (CString)TSPath + (CString)"FinalSun" + lpFilename, m_hLocal); + + lpIniFile->LoadFile((CString)TSPath + (CString)"FinalSun" + lpFilename, TRUE); + + DeleteFile((CString)TSPath + (CString)"FinalSun" + lpFilename); } - - - } - else if(bIsExpansion==FALSE) - { - FSunPackLib::XCC_ExtractFile(lpFilename,(CString)TSPath+(CString)"FinalSun"+lpFilename, m_hLocal); - - lpIniFile->LoadFile((CString)TSPath+(CString)"FinalSun"+lpFilename, TRUE); - DeleteFile((CString)TSPath+(CString)"FinalSun"+lpFilename); + + + } else if (bIsExpansion == FALSE) { + FSunPackLib::XCC_ExtractFile(lpFilename, (CString)TSPath + (CString)"FinalSun" + lpFilename, m_hLocal); + + lpIniFile->LoadFile((CString)TSPath + (CString)"FinalSun" + lpFilename, TRUE); + DeleteFile((CString)TSPath + (CString)"FinalSun" + lpFilename); return; } } @@ -877,9 +836,9 @@ void CLoading::LoadTSIni(LPCTSTR lpFilename, CIniFile *lpIniFile, BOOL bIsExpans void CLoading::InitSHPs(CProgressCtrl* prog) { MEMORYSTATUS ms; - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - int cs=ms.dwAvailPhys+ms.dwAvailPageFile; + int cs = ms.dwAvailPhys + ms.dwAvailPageFile; errstream << "InitSHPs() called. Available memory: " << cs << endl; errstream.flush(); @@ -932,7 +891,7 @@ void CLoading::InitSHPs(CProgressCtrl* prog) } } - if(!theApp.m_Options.bDoNotLoadAircraftGraphics) { + if (!theApp.m_Options.bDoNotLoadAircraftGraphics) { auto const& sec = rules.GetSection("AircraftTypes"); for (i = 0; i < sec.Size(); i++) { LoadUnitGraphic(sec.Nth(i).second); @@ -955,7 +914,7 @@ void CLoading::InitSHPs(CProgressCtrl* prog) } #ifdef SMUDGE_SUPP - for(auto const& [seq, id] : rules.GetSection("SmudgeTypes")) { + for (auto const& [seq, id] : rules.GetSection("SmudgeTypes")) { LoadUnitGraphic(id); /*if(m_progress.m_hWnd!=NULL && i%15==0) { @@ -964,7 +923,7 @@ void CLoading::InitSHPs(CProgressCtrl* prog) }*/ } #endif - + } /* @@ -980,100 +939,87 @@ June 15th: // blit util __forceinline void Blit_Pal(BYTE* dst, int x, int y, int dwidth, int dheight, BYTE* src, int swidth, int sheight) { - - if(src==NULL || dst==NULL) return; + + if (src == NULL || dst == NULL) return; - if(x+swidth<0 || y+sheight<0) return; - if(x>=dwidth || y>=dheight) return; + if (x + swidth < 0 || y + sheight < 0) return; + if (x >= dwidth || y >= dheight) return; RECT blrect; RECT srcRect; - srcRect.left=0; - srcRect.top=0; - srcRect.right=swidth; - srcRect.bottom=sheight; - blrect.left=x; - if(blrect.left<0) - { - srcRect.left=1-blrect.left; - blrect.left=1; + srcRect.left = 0; + srcRect.top = 0; + srcRect.right = swidth; + srcRect.bottom = sheight; + blrect.left = x; + if (blrect.left < 0) { + srcRect.left = 1 - blrect.left; + blrect.left = 1; } - blrect.top=y; - if(blrect.top<0) - { - srcRect.top=1-blrect.top; - blrect.top=1; + blrect.top = y; + if (blrect.top < 0) { + srcRect.top = 1 - blrect.top; + blrect.top = 1; } - blrect.right=(x+swidth); - if(x+swidth>dwidth) - { - srcRect.right=swidth-((x+swidth)-dwidth); - blrect.right=dwidth; + blrect.right = (x + swidth); + if (x + swidth > dwidth) { + srcRect.right = swidth - ((x + swidth) - dwidth); + blrect.right = dwidth; } - blrect.bottom=(y+sheight); - if(y+sheight>dheight) - { - srcRect.bottom=sheight-((y+sheight)-dheight); - blrect.bottom=dheight; + blrect.bottom = (y + sheight); + if (y + sheight > dheight) { + srcRect.bottom = sheight - ((y + sheight) - dheight); + blrect.bottom = dheight; } - int i,e; - for(i=srcRect.left;i=dwidth || blrect.top>=dheight) return; - - int x=blrect.left; - int y=blrect.top; + if (src == NULL || dst == NULL) return; - int i,e; - for(i=srcRect.left;i= dwidth || blrect.top >= dheight) return; + + int x = blrect.left; + int y = blrect.top; + + int i, e; + for (i = srcRect.left; i < srcRect.right; i++) { + for (e = srcRect.top; e < srcRect.bottom; e++) { auto pos = i + e * swidth; - const BYTE& val=src[pos]; - if(blrect.left+i>0 && blrect.top+e>0 && blrect.left+i 0 && blrect.top + e > 0 && blrect.left + i < dwidth && blrect.top + e < dheight) { + if (srcMask) { if (srcMask[pos] == 0) continue; - } - else - { + } else { if (val == 0) continue; } - BYTE* dest=dst+(blrect.left+i)+(blrect.top+e)*dwidth; - *dest=val; + BYTE* dest = dst + (blrect.left + i) + (blrect.top + e) * dwidth; + *dest = val; } } } - + } #ifdef TS_MODE @@ -1086,8 +1032,7 @@ const Vec3f lightDirection = Vec3f(1.0f, 0.0f, -1.0f).normalize(); HTSPALETTE CLoading::GetIsoPalette(char theat) { HTSPALETTE isoPalette = m_hPalIsoTemp; - switch (theat) - { + switch (theat) { case 'T': case 'G': isoPalette = m_hPalIsoTemp; @@ -1114,8 +1059,7 @@ HTSPALETTE CLoading::GetIsoPalette(char theat) HTSPALETTE CLoading::GetUnitPalette(char theat) { HTSPALETTE isoPalette = m_hPalUnitTemp; - switch (theat) - { + switch (theat) { case 'T': case 'G': isoPalette = m_hPalUnitTemp; @@ -1172,9 +1116,9 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr if (image.IsEmpty()) return std::nullopt; - const char kTheatersToTry[] = { preferred_theat, 'G', 'T', 'A', 'U', 'N', 'D', 'L', 0}; - const CString kSuffixesToTry[] = { theatToSuffix(preferred_theat), ".tem", ".sno", ".urb", ".lun", ".des", ".ubn", ""}; - + const char kTheatersToTry[] = { preferred_theat, 'G', 'T', 'A', 'U', 'N', 'D', 'L', 0 }; + const CString kSuffixesToTry[] = { theatToSuffix(preferred_theat), ".tem", ".sno", ".urb", ".lun", ".des", ".ubn", "" }; + const char first = image.GetAt(0); const bool firstCharSupportsTheater = first == 'G' || first == 'N' || first == 'C' || first == 'Y'; @@ -1186,8 +1130,8 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr } const auto& isoPalettePrefixes = g_data["ForceIsoPalettePrefix"]; - if (isoPalettePrefixes.end() != std::find_if(isoPalettePrefixes.begin(), isoPalettePrefixes.end(), - [&image](const auto& pair) {return image.Find(pair.second) == 0;})) { + if (isoPalettePrefixes.end() != std::find_if(isoPalettePrefixes.begin(), isoPalettePrefixes.end(), + [&image](const auto& pair) {return image.Find(pair.second) == 0; })) { forcedPalette = GetIsoPalette(preferred_theat); } @@ -1204,10 +1148,8 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr CString curSuffix; // Phase 0: theater with .tem, .sno etc - if (isTheater) - { - for (int t = 0; !(curSuffix = kSuffixesToTry[t]).IsEmpty(); ++t) - { + if (isTheater) { + for (int t = 0; !(curSuffix = kSuffixesToTry[t]).IsEmpty(); ++t) { curFilename = image + curSuffix; curFilename.MakeLower(); curMixFile = FindFileInMix(curFilename, &curMixTheater); @@ -1217,16 +1159,13 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr } // Phase 1: if NewTheater is enabled and first character indicates support, try with real theater, then in order of kTheatersToTry // Otherwise, - if (isNewTheater) - { - if (firstCharSupportsTheater) - { + if (isNewTheater) { + if (firstCharSupportsTheater) { /*curFilename.SetAt(1, preferred_theat); curMixFile = FindFileInMix(curFilename, &curMixTheater); if (curMixFile) return FindShpResult(curMixFile, curMixTheater, curFilename, toTheaterChar(preferred_theat), GetUnitPalette(preferred_theat));*/ - for (int t = 0; curTheater=kTheatersToTry[t]; ++t) - { + for (int t = 0; curTheater = kTheatersToTry[t]; ++t) { curFilename.SetAt(1, curTheater); curMixFile = FindFileInMix(curFilename, &curMixTheater); if (curMixFile) @@ -1235,14 +1174,12 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr } } // Phase 2: try again even if isNewTheater is not true but the first char signals it should support theaters - if (firstCharSupportsTheater) - { + if (firstCharSupportsTheater) { /*curFilename.SetAt(1, preferred_theat); curMixFile = FindFileInMix(curFilename, &curMixTheater); if (curMixFile) return FindShpResult(curMixFile, curMixTheater, curFilename, toTheaterChar(preferred_theat), GetUnitPalette(preferred_theat));*/ - for (int t = 0; curTheater = kTheatersToTry[t]; ++t) - { + for (int t = 0; curTheater = kTheatersToTry[t]; ++t) { curFilename.SetAt(1, curTheater); curMixFile = FindFileInMix(curFilename, &curMixTheater); if (curMixFile) @@ -1261,8 +1198,7 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr if (curMixFile) return FindShpResult(curMixFile, curMixTheater, curFilename, toTheaterChar(preferred_theat), forcedPalette ? forcedPalette : unitOrIsoPalette); // Phase 5: try with .tem, .sno etc endings with preferred theater - for (int t = 0; !(curSuffix = kSuffixesToTry[t]).IsEmpty(); ++t) - { + for (int t = 0; !(curSuffix = kSuffixesToTry[t]).IsEmpty(); ++t) { curFilename = image + curSuffix; curFilename.MakeLower(); curMixFile = FindFileInMix(curFilename, &curMixTheater); @@ -1271,8 +1207,7 @@ std::optional CLoading::FindUnitShp(const CString& image, char pr } // Phase 6: try with theater in 2nd char even if first char does not indicate support curFilename = image + ".shp"; - for (int t = 0; curTheater = kTheatersToTry[t]; ++t) - { + for (int t = 0; curTheater = kTheatersToTry[t]; ++t) { curFilename.SetAt(1, curTheater); curMixFile = FindFileInMix(curFilename, &curMixTheater); if (curMixFile) @@ -1292,23 +1227,23 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) errstream << "Loading: " << lpUnittype << endl; errstream.flush(); - last_succeeded_operation=10; + last_succeeded_operation = 10; CString _rules_image; // the image used CString filename; // filename of the image - char theat=cur_theat; // standard theater char is t (Temperat). a is snow. + char theat = cur_theat; // standard theater char is t (Temperat). a is snow. - BOOL bAlwaysSetChar=FALSE; // second char is always theater, even if NewTheater not specified! - WORD wStep=1; // step is 1 for infantry, buildings, etc, and for shp vehicles it specifies the step rate between every direction - WORD wStartWalkFrame=0; // for examply cyborg reaper has another walk starting frame - int iTurretOffset=0; // used for centering y pos of turret (if existing) (for vehicles) + BOOL bAlwaysSetChar = FALSE; // second char is always theater, even if NewTheater not specified! + WORD wStep = 1; // step is 1 for infantry, buildings, etc, and for shp vehicles it specifies the step rate between every direction + WORD wStartWalkFrame = 0; // for examply cyborg reaper has another walk starting frame + int iTurretOffset = 0; // used for centering y pos of turret (if existing) (for vehicles) const BOOL bStructure = rules["BuildingTypes"].HasValue(lpUnittype); // is this a structure? const BOOL bVehicle = rules["VehicleTypes"].HasValue(lpUnittype); // is this a structure? auto const bPowerUp = !rules.GetString(lpUnittype, "PowersUpBuilding").IsEmpty(); - - CIsoView& v=*((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; + + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; _rules_image = lpUnittype; _rules_image = rules.GetStringOr(lpUnittype, "Image", _rules_image); @@ -1327,835 +1262,782 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) // is it a shp graphic? if (!artSection.GetBool(image, "Voxel")) { - try - { + try { - auto shp = FindUnitShp(image, cur_theat, artSection); - if (!shp) - { - errstream << "Building SHP in theater " << cur_theat << " not found: " << image << endl; - errstream.flush(); - missingimages[lpUnittype] = TRUE; - return FALSE; - } - - filename = shp->filename; - HTSPALETTE hPalette = shp->palette; - const auto hShpMix = shp->mixfile; - theat = static_cast(shp->theat); - auto limited_to_theater = artSection.GetBool("TerrainPalette") ? shp->mixfile_theater : TheaterChar::None; - - - SHPHEADER head; - int superanim_1_zadjust=0; - int superanim_2_zadjust=0; - int superanim_3_zadjust=0; - int superanim_4_zadjust=0; - - CString turretanim_name; - CString turretanim_filename; - CString barrelanim_filename; - BYTE* bib=NULL; - SHPHEADER bib_h; - BYTE* activeanim=NULL; - SHPHEADER activeanim_h; - BYTE* idleanim=NULL; - SHPHEADER idleanim_h; - BYTE* activeanim2=NULL; - SHPHEADER activeanim2_h; - BYTE* activeanim3=NULL; - SHPHEADER activeanim3_h; - BYTE* superanim1=NULL; - SHPHEADER superanim1_h; - BYTE* superanim2=NULL; - SHPHEADER superanim2_h; - BYTE* superanim3=NULL; - SHPHEADER superanim3_h; - BYTE* superanim4=NULL; - SHPHEADER superanim4_h; - BYTE* specialanim1=NULL; - SHPHEADER specialanim1_h; - BYTE* specialanim2=NULL; - SHPHEADER specialanim2_h; - BYTE* specialanim3=NULL; - SHPHEADER specialanim3_h; - BYTE* specialanim4=NULL; - SHPHEADER specialanim4_h; - BYTE** lpT=NULL; - SHPHEADER* lpT_h=NULL; - std::vector turretColors[8]; - std::vector turretLighting[8]; - std::vector vxlBarrelColors[8]; - std::vector vxlBarrelLighting[8]; - SHPHEADER turrets_h[8]; - SHPIMAGEHEADER turretinfo[8]; - SHPHEADER barrels_h[8]; - SHPIMAGEHEADER barrelinfo[8]; - - - if(hShpMix>0) - { - - std::string shp_mixfile; - if (FSunPackLib::XCC_GetMixName(hShpMix, shp_mixfile)) - { - errstream << (LPCTSTR)filename << " found "; - errstream << " in " << shp_mixfile << endl; + auto shp = FindUnitShp(image, cur_theat, artSection); + if (!shp) { + errstream << "Building SHP in theater " << cur_theat << " not found: " << image << endl; errstream.flush(); - } - //hShpMix=20; - - // seems to be ignored by TS, art.ini overwrites??? - if(rules.GetBool( lpUnittype, "Bib")) { - LoadBuildingSubGraphic("BibShape", artSection, bAlwaysSetChar, theat, hShpMix, bib_h, bib); + missingimages[lpUnittype] = TRUE; + return FALSE; } - LoadBuildingSubGraphic("ActiveAnim", artSection, bAlwaysSetChar, theat, hShpMix, activeanim_h, activeanim); - LoadBuildingSubGraphic("IdleAnim", artSection, bAlwaysSetChar, theat, hShpMix, idleanim_h, idleanim); - LoadBuildingSubGraphic("ActiveAnim2", artSection, bAlwaysSetChar, theat, hShpMix, activeanim2_h, activeanim2); - LoadBuildingSubGraphic("ActiveAnim3", artSection, bAlwaysSetChar, theat, hShpMix, activeanim3_h, activeanim3); - if (!g_data.GetBool("IgnoreSuperAnim1", image)) - LoadBuildingSubGraphic("SuperAnim", artSection, bAlwaysSetChar, theat, hShpMix, superanim1_h, superanim1); - if (!g_data.GetBool("IgnoreSuperAnim2", image)) - LoadBuildingSubGraphic("SuperAnimTwo", artSection, bAlwaysSetChar, theat, hShpMix, superanim2_h, superanim2); - if (!g_data.GetBool("IgnoreSuperAnim3", image)) - LoadBuildingSubGraphic("SuperAnimThree", artSection, bAlwaysSetChar, theat, hShpMix, superanim3_h, superanim3); - if (!g_data.GetBool("IgnoreSuperAnim4", image)) - LoadBuildingSubGraphic("SuperAnimFour", artSection, bAlwaysSetChar, theat, hShpMix, superanim4_h, superanim4); - LoadBuildingSubGraphic("SpecialAnim", artSection, bAlwaysSetChar, theat, hShpMix, specialanim1_h, specialanim1); - LoadBuildingSubGraphic("SpecialAnimTwo", artSection, bAlwaysSetChar, theat, hShpMix, specialanim2_h, specialanim2); - LoadBuildingSubGraphic("SpecialAnimThree", artSection, bAlwaysSetChar, theat, hShpMix, specialanim3_h, specialanim3); - LoadBuildingSubGraphic("SpecialAnimFour", artSection, bAlwaysSetChar, theat, hShpMix, specialanim4_h, specialanim4); + filename = shp->filename; + HTSPALETTE hPalette = shp->palette; + const auto hShpMix = shp->mixfile; + theat = static_cast(shp->theat); + auto limited_to_theater = artSection.GetBool("TerrainPalette") ? shp->mixfile_theater : TheaterChar::None; - BOOL bVoxelTurret = FALSE; - BOOL bVoxelBarrel = FALSE; - FSunPackLib::VoxelNormalClass vnc = FSunPackLib::VoxelNormalClass::Unknown; + SHPHEADER head; + int superanim_1_zadjust = 0; + int superanim_2_zadjust = 0; + int superanim_3_zadjust = 0; + int superanim_4_zadjust = 0; - if (rules.GetBool(image, "Turret")) { - turretanim_name = rules.GetString(image, "TurretAnim"); - auto vxl_turretanim_filename = turretanim_name.IsEmpty() ? image + "tur.vxl" : turretanim_name + ".vxl"; - auto vxl_barrelanim_filename = image + "barl.vxl"; - auto const& imageID = art.GetString(turretanim_name, "Image"); - if (!imageID.IsEmpty()) { - vxl_turretanim_filename = imageID + ".vxl"; + CString turretanim_name; + CString turretanim_filename; + CString barrelanim_filename; + BYTE* bib = NULL; + SHPHEADER bib_h; + BYTE* activeanim = NULL; + SHPHEADER activeanim_h; + BYTE* idleanim = NULL; + SHPHEADER idleanim_h; + BYTE* activeanim2 = NULL; + SHPHEADER activeanim2_h; + BYTE* activeanim3 = NULL; + SHPHEADER activeanim3_h; + BYTE* superanim1 = NULL; + SHPHEADER superanim1_h; + BYTE* superanim2 = NULL; + SHPHEADER superanim2_h; + BYTE* superanim3 = NULL; + SHPHEADER superanim3_h; + BYTE* superanim4 = NULL; + SHPHEADER superanim4_h; + BYTE* specialanim1 = NULL; + SHPHEADER specialanim1_h; + BYTE* specialanim2 = NULL; + SHPHEADER specialanim2_h; + BYTE* specialanim3 = NULL; + SHPHEADER specialanim3_h; + BYTE* specialanim4 = NULL; + SHPHEADER specialanim4_h; + BYTE** lpT = NULL; + SHPHEADER* lpT_h = NULL; + std::vector turretColors[8]; + std::vector turretLighting[8]; + std::vector vxlBarrelColors[8]; + std::vector vxlBarrelLighting[8]; + SHPHEADER turrets_h[8]; + SHPIMAGEHEADER turretinfo[8]; + SHPHEADER barrels_h[8]; + SHPIMAGEHEADER barrelinfo[8]; + + + if (hShpMix > 0) { + + std::string shp_mixfile; + if (FSunPackLib::XCC_GetMixName(hShpMix, shp_mixfile)) { + errstream << (LPCTSTR)filename << " found "; + errstream << " in " << shp_mixfile << endl; + errstream.flush(); + } + //hShpMix=20; + + // seems to be ignored by TS, art.ini overwrites??? + if (rules.GetBool(lpUnittype, "Bib")) { + LoadBuildingSubGraphic("BibShape", artSection, bAlwaysSetChar, theat, hShpMix, bib_h, bib); } - if (bStructure && turretanim_name.GetLength() > 0 && !rules.GetBool(image, "TurretAnimIsVoxel")) { - turretanim_filename = turretanim_name + ".shp"; + LoadBuildingSubGraphic("ActiveAnim", artSection, bAlwaysSetChar, theat, hShpMix, activeanim_h, activeanim); + LoadBuildingSubGraphic("IdleAnim", artSection, bAlwaysSetChar, theat, hShpMix, idleanim_h, idleanim); + LoadBuildingSubGraphic("ActiveAnim2", artSection, bAlwaysSetChar, theat, hShpMix, activeanim2_h, activeanim2); + LoadBuildingSubGraphic("ActiveAnim3", artSection, bAlwaysSetChar, theat, hShpMix, activeanim3_h, activeanim3); + if (!g_data.GetBool("IgnoreSuperAnim1", image)) + LoadBuildingSubGraphic("SuperAnim", artSection, bAlwaysSetChar, theat, hShpMix, superanim1_h, superanim1); + if (!g_data.GetBool("IgnoreSuperAnim2", image)) + LoadBuildingSubGraphic("SuperAnimTwo", artSection, bAlwaysSetChar, theat, hShpMix, superanim2_h, superanim2); + if (!g_data.GetBool("IgnoreSuperAnim3", image)) + LoadBuildingSubGraphic("SuperAnimThree", artSection, bAlwaysSetChar, theat, hShpMix, superanim3_h, superanim3); + if (!g_data.GetBool("IgnoreSuperAnim4", image)) + LoadBuildingSubGraphic("SuperAnimFour", artSection, bAlwaysSetChar, theat, hShpMix, superanim4_h, superanim4); + LoadBuildingSubGraphic("SpecialAnim", artSection, bAlwaysSetChar, theat, hShpMix, specialanim1_h, specialanim1); + LoadBuildingSubGraphic("SpecialAnimTwo", artSection, bAlwaysSetChar, theat, hShpMix, specialanim2_h, specialanim2); + LoadBuildingSubGraphic("SpecialAnimThree", artSection, bAlwaysSetChar, theat, hShpMix, specialanim3_h, specialanim3); + LoadBuildingSubGraphic("SpecialAnimFour", artSection, bAlwaysSetChar, theat, hShpMix, specialanim4_h, specialanim4); + + BOOL bVoxelTurret = FALSE; + BOOL bVoxelBarrel = FALSE; + + FSunPackLib::VoxelNormalClass vnc = FSunPackLib::VoxelNormalClass::Unknown; + + if (rules.GetBool(image, "Turret")) { + turretanim_name = rules.GetString(image, "TurretAnim"); + auto vxl_turretanim_filename = turretanim_name.IsEmpty() ? image + "tur.vxl" : turretanim_name + ".vxl"; + auto vxl_barrelanim_filename = image + "barl.vxl"; auto const& imageID = art.GetString(turretanim_name, "Image"); - if (imageID.IsEmpty()) { - turretanim_filename = imageID + ".shp"; + if (!imageID.IsEmpty()) { + vxl_turretanim_filename = imageID + ".vxl"; } - if (artSection.GetBool("NewTheater")) { - auto tmp = turretanim_filename; - tmp.SetAt(1, theat); - if (FSunPackLib::XCC_DoesFileExist(tmp, hShpMix)) - turretanim_filename = tmp; + if (bStructure && turretanim_name.GetLength() > 0 && !rules.GetBool(image, "TurretAnimIsVoxel")) { + turretanim_filename = turretanim_name + ".shp"; + auto const& imageID = art.GetString(turretanim_name, "Image"); + if (imageID.IsEmpty()) { + turretanim_filename = imageID + ".shp"; + } + + if (artSection.GetBool("NewTheater")) { + auto tmp = turretanim_filename; + tmp.SetAt(1, theat); + if (FSunPackLib::XCC_DoesFileExist(tmp, hShpMix)) + turretanim_filename = tmp; + } + + + FSunPackLib::SetCurrentSHP(turretanim_filename, hShpMix); + FSunPackLib::XCC_GetSHPHeader(&head); + + int iStartTurret = 0; + const WORD wAnimCount = 4; // anims between each "normal" direction, seems to be hardcoded + + int i; + + for (i = 0; i < 8; i++) { + if (iStartTurret + i * wAnimCount < head.c_images) { + FSunPackLib::XCC_GetSHPImageHeader(iStartTurret + i * wAnimCount, &turretinfo[i]); + FSunPackLib::XCC_GetSHPHeader(&turrets_h[i]); + FSunPackLib::LoadSHPImage(iStartTurret + i * wAnimCount, turretColors[i]); + turretLighting[i].clear(); + } + + } + } else if ( + (bStructure && turretanim_name.GetLength() > 0 && rules.GetBool(image, "TurretAnimIsVoxel")) + || (!bStructure && (FindFileInMix(vxl_turretanim_filename) || FindFileInMix(vxl_barrelanim_filename))) + ) { + turretanim_filename = vxl_turretanim_filename; + barrelanim_filename = vxl_barrelanim_filename; + + HMIXFILE hVXL = FindFileInMix(vxl_turretanim_filename); + HMIXFILE hBarl = FindFileInMix(vxl_barrelanim_filename); + + iTurretOffset = artSection.GetInteger("TurretOffset", iTurretOffset); + Vec3f turretModelOffset(iTurretOffset / 6.0f, 0.0f, 0.0f); + + + if (hVXL) { + bVoxelTurret = TRUE; + + if ( + FSunPackLib::SetCurrentVXL(turretanim_filename, hVXL) + ) { + // we assume the voxel normal class is always the same for the combined voxels + FSunPackLib::GetVXLSectionInfo(0, vnc); + + int i; + + for (i = 0; i < 8; i++) { + float r_x, r_y, r_z; + + + const int dir = bVehicle ? ((i + 1) % 8) : i; + r_x = 300; + r_y = 0; + r_z = 45 * dir + 90; + + // convert + const double pi = 3.141592654; + const Vec3f rotation(r_x / 180.0f * pi, r_y / 180.0f * pi, r_z / 180.0f * pi); + + + RECT r; + int center_x, center_y; + if (! + FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, turretColors[i], turretLighting[i], ¢er_x, ¢er_y, 0, 0, 0, 0, 0, &r) + ) { + + } else { + turrets_h[i].cx = r.right - r.left; + turrets_h[i].cy = r.bottom - r.top; + + turretinfo[i].x = center_x; + turretinfo[i].y = center_y; + turretinfo[i].cx = r.right - r.left; + turretinfo[i].cy = r.bottom - r.top; + + } + + } + } + } + if (hBarl) { + bVoxelBarrel = TRUE; + + if ( + FSunPackLib::SetCurrentVXL(barrelanim_filename, hBarl) + ) { + // we assume the voxel normal class is always the same for the combined voxels + FSunPackLib::GetVXLSectionInfo(0, vnc); + + int i; + + for (i = 0; i < 8; i++) { + float r_x, r_y, r_z; + + + const int dir = bVehicle ? ((i + 1) % 8) : i; + r_x = 300; + r_y = 0; + r_z = 45 * dir + 90; + + // convert + const double pi = 3.141592654; + const Vec3f rotation(r_x / 180.0f * pi, r_y / 180.0f * pi, r_z / 180.0f * pi); + + + RECT r; + int center_x, center_y; + if (! + FSunPackLib::LoadVXLImage( + *m_voxelNormalTables, + lightDirection, + rotation, + turretModelOffset, + vxlBarrelColors[i], + vxlBarrelLighting[i], + ¢er_x, + ¢er_y, + rules.GetInteger(image, "TurretAnimZAdjust"), + 0, 0, 0, 0, &r) + ) { + + } else { + barrels_h[i].cx = r.right - r.left; + barrels_h[i].cy = r.bottom - r.top; + + barrelinfo[i].x = center_x; + barrelinfo[i].y = center_y; + barrelinfo[i].cx = r.right - r.left; + barrelinfo[i].cy = r.bottom - r.top; + + } + + } + } + } } + } - FSunPackLib::SetCurrentSHP(turretanim_filename, hShpMix); + wStep = art.GetInteger(image, "WalkFrames", wStep); + wStartWalkFrame = art.GetInteger(image, "StartWalkFrame", wStartWalkFrame); + + if (art.GetString(image, "Palette") == "lib") { + hPalette = m_hPalLib; + } + + BOOL bSuccess = FSunPackLib::SetCurrentSHP(filename, hShpMix); + if ( + !bSuccess + ) { + filename = image + ".sno"; + if (cur_theat == 'T' || cur_theat == 'U' /* || cur_theat=='N' ? */) { + hPalette = m_hPalIsoTemp; + } + HMIXFILE hShpMix = FindFileInMix(filename); + bSuccess = FSunPackLib::SetCurrentSHP(filename, hShpMix); + + if (!bSuccess) { + missingimages[lpUnittype] = TRUE; + } + } + + if (bSuccess) { + FSunPackLib::XCC_GetSHPHeader(&head); - - int iStartTurret = 0; - const WORD wAnimCount = 4; // anims between each "normal" direction, seems to be hardcoded - int i; - - for (i = 0;i < 8;i++) - { - if (iStartTurret + i * wAnimCount < head.c_images) - { - FSunPackLib::XCC_GetSHPImageHeader(iStartTurret + i * wAnimCount, &turretinfo[i]); - FSunPackLib::XCC_GetSHPHeader(&turrets_h[i]); - FSunPackLib::LoadSHPImage(iStartTurret + i * wAnimCount, turretColors[i]); - turretLighting[i].clear(); - } - + int maxPics = head.c_images; + if (maxPics > 8) { + maxPics = 8; // we only need 8 pictures for every direction! + } + if (bStructure && !bPowerUp && !rules.GetBool(image, "Turret")) { + maxPics = 1; + } + if (bVoxelTurret) { + maxPics = 8; } - } else if ( - (bStructure && turretanim_name.GetLength() > 0 && rules.GetBool(image, "TurretAnimIsVoxel")) - || (!bStructure && (FindFileInMix(vxl_turretanim_filename) || FindFileInMix(vxl_barrelanim_filename))) - ) { - turretanim_filename = vxl_turretanim_filename; - barrelanim_filename = vxl_barrelanim_filename; - - HMIXFILE hVXL = FindFileInMix(vxl_turretanim_filename); - HMIXFILE hBarl = FindFileInMix(vxl_barrelanim_filename); - - iTurretOffset = artSection.GetInteger("TurretOffset", iTurretOffset); - Vec3f turretModelOffset(iTurretOffset / 6.0f, 0.0f, 0.0f); - - - if (hVXL) - { - bVoxelTurret = TRUE; - - if ( - FSunPackLib::SetCurrentVXL(turretanim_filename, hVXL) - ) - { - // we assume the voxel normal class is always the same for the combined voxels - FSunPackLib::GetVXLSectionInfo(0, vnc); - - int i; - - for (i = 0;i < 8;i++) - { - float r_x, r_y, r_z; - - - const int dir = bVehicle ? ((i + 1) % 8) : i; - r_x = 300; - r_y = 0; - r_z = 45 * dir + 90; - - // convert - const double pi = 3.141592654; - const Vec3f rotation(r_x / 180.0f * pi, r_y / 180.0f * pi, r_z / 180.0f * pi); - - - RECT r; - int center_x, center_y; - if (! - FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, turretColors[i], turretLighting[i], ¢er_x, ¢er_y, 0, 0, 0, 0, 0, &r) - ) - { - - } - else - { - turrets_h[i].cx = r.right - r.left; - turrets_h[i].cy = r.bottom - r.top; - - turretinfo[i].x = center_x; - turretinfo[i].y = center_y; - turretinfo[i].cx = r.right - r.left; - turretinfo[i].cy = r.bottom - r.top; - - } + if (!bStructure && rules.GetBool(image, "Turret")) { + int iStartTurret = wStartWalkFrame + 8 * wStep; + const WORD wAnimCount = 4; // anims between each "normal" direction, seems to be hardcoded + for (auto i = 0; i < 8; i++) { + if (iStartTurret + i * wAnimCount < head.c_images) { + FSunPackLib::XCC_GetSHPImageHeader(iStartTurret + i * wAnimCount, &turretinfo[i]); + FSunPackLib::XCC_GetSHPHeader(&turrets_h[i]); + FSunPackLib::LoadSHPImage(iStartTurret + i * wAnimCount, turretColors[i]); } } } - if (hBarl) - { - bVoxelBarrel = TRUE; - if ( - FSunPackLib::SetCurrentVXL(barrelanim_filename, hBarl) - ) - { - // we assume the voxel normal class is always the same for the combined voxels - FSunPackLib::GetVXLSectionInfo(0, vnc); - int i; - for (i = 0;i < 8;i++) + // create an array of pointers to directdraw surfaces + lpT = new(BYTE * [maxPics]); + ::memset(lpT, 0, sizeof(BYTE) * maxPics); + std::vector> lighting(maxPics); + std::vector shp_image_headers(maxPics); + + if (bVoxelTurret && bStructure) { + for (i = 0; i < maxPics; i++) { + FSunPackLib::LoadSHPImage(0, 1, &lpT[i]); + FSunPackLib::XCC_GetSHPImageHeader(0, &shp_image_headers[i]); + } + } else if (wStep == 1 && (rules.GetString(lpUnittype, "PowersUpBuilding").IsEmpty() || !rules.GetBool(lpUnittype, "Turret"))) { + // standard case... + FSunPackLib::LoadSHPImage(wStartWalkFrame, maxPics, lpT); + for (int i = 0; i < maxPics; ++i) { + FSunPackLib::XCC_GetSHPImageHeader(wStartWalkFrame + i, &shp_image_headers[i]); + } + + } else if (!rules.GetString(lpUnittype, "PowersUpBuilding").IsEmpty() && rules.GetBool(lpUnittype, "Turret")) { + // a "real" turret (vulcan cannon, etc...) + for (i = 0; i < maxPics; i++) { + FSunPackLib::LoadSHPImage(i * 4, 1, &lpT[i]); + FSunPackLib::XCC_GetSHPImageHeader(i * 4, &shp_image_headers[i]); + } + } else { + // walk frames used + for (i = 0; i < maxPics; i++) { + const int dir = bVehicle ? ((i + 1) % 8) : i; + const int pic_in_file = dir * wStep + wStartWalkFrame; + FSunPackLib::LoadSHPImage(pic_in_file, 1, &lpT[i]); + FSunPackLib::XCC_GetSHPImageHeader(pic_in_file, &shp_image_headers[i]); + } + } + + for (i = 0; i < maxPics; i++) { + int pic_in_file = i; + if (bStructure && bVoxelTurret) pic_in_file = 0; + SHPIMAGEHEADER imghead = shp_image_headers[i]; + //FSunPackLib::XCC_GetSHPImageHeader(pic_in_file, &imghead); + + if (bib != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, bib, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, bib, bib_h.cx, bib_h.cy); + + imghead.cx = head.cx - imghead.x; // update size of main graphic + imghead.cy = head.cy - imghead.y; + + } + + if (activeanim != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, activeanim, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim, activeanim_h.cx, activeanim_h.cy); + + + } + + if (idleanim != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, idleanim, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, idleanim, idleanim_h.cx, idleanim_h.cy); + + + } + + if (activeanim2 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, activeanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim2, activeanim2_h.cx, activeanim2_h.cy); + + } + + if (activeanim3 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, activeanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim3, activeanim3_h.cx, activeanim3_h.cy); + + } + + if (superanim1 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, superanim1, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, superanim_1_zadjust, head.cx, head.cy, superanim1, superanim1_h.cx, superanim1_h.cy); + + + } + + if (superanim2 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, superanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, superanim_2_zadjust, head.cx, head.cy, superanim2, superanim2_h.cx, superanim2_h.cy); + + + } + + if (superanim3 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, superanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, superanim_3_zadjust, head.cx, head.cy, superanim3, superanim3_h.cx, superanim3_h.cy); + + + } + + if (superanim4 != NULL && strcmp(lpUnittype, "YAGNTC") != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, superanim4, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, superanim_4_zadjust, head.cx, head.cy, superanim4, superanim4_h.cx, superanim4_h.cy); + + + } + + if (specialanim1 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, specialanim1, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim1, specialanim1_h.cx, specialanim1_h.cy); + + + } + + if (specialanim2 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, specialanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim2, specialanim2_h.cx, specialanim2_h.cy); + + } + + if (specialanim3 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, specialanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim3, specialanim3_h.cx, specialanim3_h.cy); + + + } + + if (specialanim4 != NULL) { + DDBLTFX fx; + + ::memset(&fx, 0, sizeof(DDBLTFX)); + fx.dwSize = sizeof(DDBLTFX); + + //lpT[i]->Blt(NULL, specialanim4, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); + Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim4, specialanim4_h.cx, specialanim4_h.cy); + + } + + if (!vxlBarrelLighting[i].empty() || !turretLighting[i].empty()) + lighting[i].resize(head.cx * head.cy, 46); // value needs to lead to 1.0 lighting + + // barrels hidden behind turret: + if (!vxlBarrelColors[i].empty() && (i == 1 || i == 0 || i == 7)) { + DDSURFACEDESC2 ddsd; + ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwWidth = barrels_h[i].cx; + ddsd.dwHeight = barrels_h[i].cy; + + int XMover, YMover; + char c[50]; + itoa(i, c, 10); +#ifdef RA2_MODE + XMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X"); + YMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y"); + XMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X" + c); + YMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y" + c); +#else + XMover = atoi(g_data.GetInteger("BuildingVoxelBarrels"].lpUnittype + "X"); + YMover = atoi(g_data.GetInteger("BuildingVoxelBarrels"].lpUnittype + "Y"); +#endif + + RECT srcRect, destRect; + + int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - barrelinfo[i].x; + int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - barrelinfo[i].y; + + srcRect.top = 0; + srcRect.left = 0; + srcRect.right = ddsd.dwWidth; + srcRect.bottom = ddsd.dwHeight; + destRect.top = YMover + my; + destRect.left = XMover + mx; + destRect.right = destRect.left + ddsd.dwWidth; + destRect.bottom = destRect.top + ddsd.dwHeight; + + + errstream << "vxl barrel: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; + errstream.flush(); + Blit_PalD(lpT[i], destRect, vxlBarrelColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); + Blit_PalD(lighting[i].data(), destRect, vxlBarrelLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, vxlBarrelColors[i].data()); + + } + + + if (!turretColors[i].empty()) { + DDSURFACEDESC2 ddsd; + ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + //turrets[i]->GetSurfaceDesc(&ddsd); + // replace DX code: + ddsd.dwWidth = turrets_h[i].cx; + ddsd.dwHeight = turrets_h[i].cy; + + int XMover, YMover; + char c[50]; + itoa(i, c, 10); +#ifdef RA2_MODE + XMover = g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "X"); + YMover = g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "Y"); + XMover += g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "X" + c); + YMover += g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "Y" + c); +#else + XMover = g_data.GetInteger("BuildingVoxelTurrets", lpUnittype + "X"); + YMover = g_data.GetInteger("BuildingVoxelTurrets", lpUnittype + "Y"); +#endif + + RECT srcRect, destRect; + + if (bVoxelTurret) { + int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - turretinfo[i].x; + int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - turretinfo[i].y; + + srcRect.top = 0; + srcRect.left = 0; + srcRect.right = ddsd.dwWidth; + srcRect.bottom = ddsd.dwHeight; + destRect.top = YMover + my; + destRect.left = XMover + mx; + destRect.right = destRect.left + ddsd.dwWidth;; + destRect.bottom = destRect.top + ddsd.dwHeight; + + } else // !bVoxelTurret { - float r_x, r_y, r_z; + + int mx = rules.GetInteger(image, "TurretAnimX"); + int my = rules.GetInteger(image, "TurretAnimY");//+rules.GetInteger(image, "barrelAnimZAdjust"); - const int dir = bVehicle ? ((i + 1) % 8) : i; - r_x = 300; - r_y = 0; - r_z = 45 * dir + 90; - - // convert - const double pi = 3.141592654; - const Vec3f rotation(r_x / 180.0f * pi, r_y / 180.0f * pi, r_z / 180.0f * pi); - - - RECT r; - int center_x, center_y; - if (! - FSunPackLib::LoadVXLImage( - *m_voxelNormalTables, - lightDirection, - rotation, - turretModelOffset, - vxlBarrelColors[i], - vxlBarrelLighting[i], - ¢er_x, - ¢er_y, - rules.GetInteger(image, "TurretAnimZAdjust"), - 0, 0, 0, 0, &r) - ) - { - - } - else - { - barrels_h[i].cx = r.right - r.left; - barrels_h[i].cy = r.bottom - r.top; - - barrelinfo[i].x = center_x; - barrelinfo[i].y = center_y; - barrelinfo[i].cx = r.right - r.left; - barrelinfo[i].cy = r.bottom - r.top; - - } + srcRect.top = 0; + srcRect.left = 0; + srcRect.right = turrets_h[i].cx; + srcRect.bottom = turrets_h[i].cy; + destRect.top = YMover + my; + destRect.left = XMover + mx; + destRect.right = destRect.left + srcRect.right; + destRect.bottom = destRect.top + srcRect.bottom; } + + errstream << "vxl turret: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; + errstream.flush(); + Blit_PalD(lpT[i], destRect, turretColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); + Blit_PalD(lighting[i].data(), destRect, turretLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, turretColors[i].data()); + } - } - } - } + + // barrels in front of turret + if (!vxlBarrelColors[i].empty() && i != 1 && i != 0 && i != 7) { + DDSURFACEDESC2 ddsd; + ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwWidth = barrels_h[i].cx; + ddsd.dwHeight = barrels_h[i].cy; + + int XMover, YMover; + char c[50]; + itoa(i, c, 10); +#ifdef RA2_MODE + XMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X"); + YMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y"); + XMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + (CString)"X" + c); + YMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + (CString)"Y" + c); +#else + XMover = g_data.GetInteger("BuildingVoxelBarrels", lpUnittype + "X"); + YMover = g_data.GetInteger("BuildingVoxelBarrels", lpUnittype + "Y"); +#endif + + RECT srcRect, destRect; + + int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - barrelinfo[i].x; + int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - barrelinfo[i].y; + + srcRect.top = 0; + srcRect.left = 0; + srcRect.right = ddsd.dwWidth; + srcRect.bottom = ddsd.dwHeight; + destRect.top = YMover + my; + destRect.left = XMover + mx; + destRect.right = destRect.left + ddsd.dwWidth; + destRect.bottom = destRect.top + ddsd.dwHeight; - wStep = art.GetInteger(image, "WalkFrames", wStep); - wStartWalkFrame = art.GetInteger(image, "StartWalkFrame", wStartWalkFrame); - - if (art.GetString(image, "Palette") == "lib") { - hPalette = m_hPalLib; - } + errstream << "vxl barrel: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; + errstream.flush(); + Blit_PalD(lpT[i], destRect, vxlBarrelColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); + Blit_PalD(lighting[i].data(), destRect, vxlBarrelLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, vxlBarrelColors[i].data()); - BOOL bSuccess=FSunPackLib::SetCurrentSHP(filename, hShpMix); - if( - !bSuccess - ) { - filename=image+".sno"; - if (cur_theat == 'T' || cur_theat == 'U' /* || cur_theat=='N' ? */) { - hPalette = m_hPalIsoTemp; - } - HMIXFILE hShpMix=FindFileInMix(filename); - bSuccess=FSunPackLib::SetCurrentSHP(filename, hShpMix); - - if(!bSuccess) - { - missingimages[lpUnittype]=TRUE; - } - } - - if (bSuccess) { - FSunPackLib::XCC_GetSHPHeader(&head); - int i; - int maxPics = head.c_images; - if (maxPics > 8) { - maxPics = 8; // we only need 8 pictures for every direction! - } - if (bStructure && !bPowerUp && !rules.GetBool(image, "Turret")) { - maxPics = 1; - } - if (bVoxelTurret) { - maxPics = 8; - } - - if (!bStructure && rules.GetBool(image, "Turret")) { - int iStartTurret = wStartWalkFrame + 8 * wStep; - const WORD wAnimCount = 4; // anims between each "normal" direction, seems to be hardcoded - for (auto i = 0; i < 8; i++) { - if (iStartTurret + i * wAnimCount < head.c_images) { - FSunPackLib::XCC_GetSHPImageHeader(iStartTurret + i * wAnimCount, &turretinfo[i]); - FSunPackLib::XCC_GetSHPHeader(&turrets_h[i]); - FSunPackLib::LoadSHPImage(iStartTurret + i * wAnimCount, turretColors[i]); } - } - } - - - // create an array of pointers to directdraw surfaces - lpT=new(BYTE*[maxPics]); - ::memset(lpT, 0, sizeof(BYTE)*maxPics); - std::vector> lighting(maxPics); - std::vector shp_image_headers(maxPics); - - if(bVoxelTurret && bStructure) - { - for(i=0;i>(new std::vector(std::move(lighting[i]))); + else + lighting[i].clear(); + p.vborder = new(VBORDER[head.cy]); + int k; + for (k = 0; k < head.cy; k++) { + int l, r; + GetDrawBorder(lpT[i], head.cx, k, l, r, 0); + p.vborder[k].left = l; + p.vborder[k].right = r; + } - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); + if (hPalette == m_hPalIsoTemp || hPalette == m_hPalIsoUrb || hPalette == m_hPalIsoSnow || hPalette == m_hPalIsoUbn || hPalette == m_hPalIsoDes || hPalette == m_hPalIsoLun) p.pal = iPalIso; + if (hPalette == m_hPalTemp || hPalette == m_hPalUrb || hPalette == m_hPalSnow || hPalette == m_hPalUbn || hPalette == m_hPalLun || hPalette == m_hPalDes) p.pal = iPalTheater; + if (hPalette == m_hPalUnitTemp || hPalette == m_hPalUnitUrb || hPalette == m_hPalUnitSnow || hPalette == m_hPalUnitDes || hPalette == m_hPalUnitLun || hPalette == m_hPalUnitUbn) p.pal = iPalUnit; + if (hPalette == m_hPalLib) p.pal = iPalLib; - //lpT[i]->Blt(NULL, bib, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, bib, bib_h.cx, bib_h.cy); + p.x = imghead.x; + p.y = imghead.y; + p.wHeight = imghead.cy; + p.wWidth = imghead.cx; + p.wMaxWidth = head.cx; + p.wMaxHeight = head.cy; + p.bType = PICDATA_TYPE_SHP; + p.bTerrain = limited_to_theater; - imghead.cx=head.cx-imghead.x; // update size of main graphic - imghead.cy=head.cy-imghead.y; + pics[image + ic] = p; - } - - if(activeanim!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, activeanim, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim, activeanim_h.cx, activeanim_h.cy); - - - } - - if(idleanim!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, idleanim, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, idleanim, idleanim_h.cx, idleanim_h.cy); - - - } - - if(activeanim2!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, activeanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim2, activeanim2_h.cx, activeanim2_h.cy); - - } - - if(activeanim3!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, activeanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, activeanim3, activeanim3_h.cx, activeanim3_h.cy); - - } - - if(superanim1!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, superanim1, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, superanim_1_zadjust, head.cx, head.cy, superanim1, superanim1_h.cx, superanim1_h.cy); - - - } - - if(superanim2!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, superanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, superanim_2_zadjust, head.cx, head.cy, superanim2, superanim2_h.cx, superanim2_h.cy); - - - } - - if(superanim3!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, superanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, superanim_3_zadjust, head.cx, head.cy, superanim3, superanim3_h.cx, superanim3_h.cy); - - - } - - if(superanim4!=NULL && strcmp(lpUnittype, "YAGNTC")!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, superanim4, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, superanim_4_zadjust, head.cx, head.cy, superanim4, superanim4_h.cx, superanim4_h.cy); - - - } - - if(specialanim1!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, specialanim1, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim1, specialanim1_h.cx, specialanim1_h.cy); - - - } - - if(specialanim2!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, specialanim2, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim2, specialanim2_h.cx, specialanim2_h.cy); - - } - - if(specialanim3!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, specialanim3, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim3, specialanim3_h.cx, specialanim3_h.cy); - - - } - - if(specialanim4!=NULL) - { - DDBLTFX fx; - - ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); - - //lpT[i]->Blt(NULL, specialanim4, NULL, DDBLT_KEYSRC | DDBLT_WAIT , &fx); - Blit_Pal(lpT[i], 0, 0, head.cx, head.cy, specialanim4, specialanim4_h.cx, specialanim4_h.cy); - - } - - if (!vxlBarrelLighting[i].empty() || !turretLighting[i].empty()) - lighting[i].resize(head.cx * head.cy, 46); // value needs to lead to 1.0 lighting - - // barrels hidden behind turret: - if(!vxlBarrelColors[i].empty() && (i == 1 || i == 0 || i == 7)) - { - DDSURFACEDESC2 ddsd; - ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize = sizeof(DDSURFACEDESC2); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; - ddsd.dwWidth = barrels_h[i].cx; - ddsd.dwHeight = barrels_h[i].cy; - - int XMover, YMover; - char c[50]; - itoa(i, c, 10); -#ifdef RA2_MODE - XMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X"); - YMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y"); - XMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X" + c); - YMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y" + c); -#else - XMover = atoi(g_data.GetInteger("BuildingVoxelBarrels"].lpUnittype + "X"); - YMover = atoi(g_data.GetInteger("BuildingVoxelBarrels"].lpUnittype + "Y"); -#endif - - RECT srcRect, destRect; - - int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - barrelinfo[i].x; - int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - barrelinfo[i].y; - - srcRect.top = 0; - srcRect.left = 0; - srcRect.right = ddsd.dwWidth; - srcRect.bottom = ddsd.dwHeight; - destRect.top = YMover + my; - destRect.left = XMover + mx; - destRect.right = destRect.left + ddsd.dwWidth; - destRect.bottom = destRect.top + ddsd.dwHeight; + //errstream << " --> finished as " << (LPCSTR)(image+ic) << endl; + //errstream.flush(); + } - errstream << "vxl barrel: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; - errstream.flush(); - Blit_PalD(lpT[i], destRect, vxlBarrelColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); - Blit_PalD(lighting[i].data(), destRect, vxlBarrelLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, vxlBarrelColors[i].data()); - - } - - - if(!turretColors[i].empty()) - { - DDSURFACEDESC2 ddsd; - ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; - //turrets[i]->GetSurfaceDesc(&ddsd); - // replace DX code: - ddsd.dwWidth=turrets_h[i].cx; - ddsd.dwHeight=turrets_h[i].cy; - - int XMover, YMover; - char c[50]; - itoa(i, c, 10); -#ifdef RA2_MODE - XMover = g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "X"); - YMover = g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "Y"); - XMover += g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "X" + c); - YMover += g_data.GetInteger("BuildingVoxelTurretsRA2", lpUnittype + "Y" + c); -#else - XMover = g_data.GetInteger("BuildingVoxelTurrets", lpUnittype + "X"); - YMover = g_data.GetInteger("BuildingVoxelTurrets", lpUnittype + "Y"); -#endif - - RECT srcRect, destRect; - - if (bVoxelTurret) - { - int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - turretinfo[i].x; - int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - turretinfo[i].y; - - srcRect.top=0; - srcRect.left=0; - srcRect.right=ddsd.dwWidth; - srcRect.bottom=ddsd.dwHeight; - destRect.top=YMover+my; - destRect.left=XMover+mx; - destRect.right=destRect.left+ddsd.dwWidth;; - destRect.bottom=destRect.top+ddsd.dwHeight; - - } - else // !bVoxelTurret - { - - int mx = rules.GetInteger(image, "TurretAnimX"); - int my = rules.GetInteger(image, "TurretAnimY");//+rules.GetInteger(image, "barrelAnimZAdjust"); - - - - srcRect.top = 0; - srcRect.left = 0; - srcRect.right = turrets_h[i].cx; - srcRect.bottom = turrets_h[i].cy; - destRect.top = YMover + my; - destRect.left = XMover + mx; - destRect.right = destRect.left + srcRect.right; - destRect.bottom = destRect.top + srcRect.bottom; } - errstream << "vxl turret: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; - errstream.flush(); - Blit_PalD(lpT[i], destRect, turretColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); - Blit_PalD(lighting[i].data(), destRect, turretLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, turretColors[i].data()); - + delete[] lpT; + + + if (bib) delete[] bib; + if (activeanim) delete[] activeanim; + if (idleanim) delete[] idleanim; + if (activeanim2) delete[] activeanim2; + if (activeanim3) delete[] activeanim3; + if (superanim1) delete[] superanim1; + if (superanim2) delete[] superanim2; + if (superanim3) delete[] superanim3; + if (superanim4) delete[] superanim4; + if (specialanim1) delete[] specialanim1; + if (specialanim2) delete[] specialanim2; + if (specialanim3) delete[] specialanim3; + if (specialanim4) delete[] specialanim4; + + //for(i=0;i<8;i++) + // if(turrets[i]) delete[] turrets[i]; + } - // barrels in front of turret - if(!vxlBarrelColors[i].empty() && i!=1 && i!=0 && i!=7) - { - DDSURFACEDESC2 ddsd; - ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize = sizeof(DDSURFACEDESC2); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; - ddsd.dwWidth = barrels_h[i].cx; - ddsd.dwHeight = barrels_h[i].cy; - - int XMover, YMover; - char c[50]; - itoa(i, c, 10); -#ifdef RA2_MODE - XMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "X"); - YMover = g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + "Y"); - XMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + (CString)"X" + c); - YMover += g_data.GetInteger("BuildingVoxelBarrelsRA2", lpUnittype + (CString)"Y" + c); -#else - XMover = g_data.GetInteger("BuildingVoxelBarrels", lpUnittype + "X"); - YMover = g_data.GetInteger("BuildingVoxelBarrels", lpUnittype + "Y"); -#endif - - RECT srcRect, destRect; - - int mx = head.cx / 2 + rules.GetInteger(image, "TurretAnimX") - barrelinfo[i].x; - int my = head.cy / 2 + rules.GetInteger(image, "TurretAnimY") - barrelinfo[i].y; - - srcRect.top = 0; - srcRect.left = 0; - srcRect.right = ddsd.dwWidth; - srcRect.bottom = ddsd.dwHeight; - destRect.top = YMover + my; - destRect.left = XMover + mx; - destRect.right = destRect.left + ddsd.dwWidth; - destRect.bottom = destRect.top + ddsd.dwHeight; - - - errstream << "vxl barrel: " << i << " size: " << ddsd.dwWidth << " " << ddsd.dwHeight << " at " << destRect.left << " " << destRect.top << endl; - errstream.flush(); - Blit_PalD(lpT[i], destRect, vxlBarrelColors[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy); - Blit_PalD(lighting[i].data(), destRect, vxlBarrelLighting[i].data(), srcRect, ddsd.dwWidth, head.cx, ddsd.dwHeight, head.cy, vxlBarrelColors[i].data()); - - - } - - if(!bPowerUp && i!=0 && (imghead.unknown==0 && !g_data.GetBool("Debug", "IgnoreSHPImageHeadUnused")) && bStructure) { - if(lpT[i]) delete[] lpT[i]; - lpT[i]=NULL; - } - else - { - char ic[50]; - itoa(i, ic, 10); - - PICDATA p; - p.pic=lpT[i]; - if (std::find_if(lighting[i].begin(), lighting[i].end(), [](const BYTE b) { return b != 255; }) != lighting[i].end()) - p.lighting = std::shared_ptr>(new std::vector(std::move(lighting[i]))); - else - lighting[i].clear(); - p.vborder=new(VBORDER[head.cy]); - int k; - for(k=0;k finished as " << (LPCSTR)(image+ic) << endl; - //errstream.flush(); - } - - - } - - delete[] lpT; - - - if(bib) delete[] bib; - if(activeanim) delete[] activeanim; - if(idleanim) delete[] idleanim; - if(activeanim2) delete[] activeanim2; - if(activeanim3) delete[] activeanim3; - if(superanim1) delete[] superanim1; - if(superanim2) delete[] superanim2; - if(superanim3) delete[] superanim3; - if(superanim4) delete[] superanim4; - if(specialanim1) delete[] specialanim1; - if(specialanim2) delete[] specialanim2; - if(specialanim3) delete[] specialanim3; - if(specialanim4) delete[] specialanim4; - - //for(i=0;i<8;i++) - // if(turrets[i]) delete[] turrets[i]; - + //errstream << " --> Finished" << endl; + //errstream.flush(); } - //errstream << " --> Finished" << endl; - //errstream.flush(); - } - - else - { - errstream << "File in theater " << cur_theat << " not found: " << (LPCTSTR)filename << endl; - errstream.flush(); + else { + errstream << "File in theater " << cur_theat << " not found: " << (LPCTSTR)filename << endl; + errstream.flush(); - missingimages[lpUnittype]=TRUE; - } + missingimages[lpUnittype] = TRUE; + } - } - catch(...) - { + } catch (...) { errstream << " exception " << endl; errstream.flush(); } - - - } - else - { - filename=image+".vxl"; - HMIXFILE hMix=FindFileInMix(filename); - if(hMix==FALSE) - { - missingimages[lpUnittype]=TRUE; + + } else { + filename = image + ".vxl"; + + HMIXFILE hMix = FindFileInMix(filename); + if (hMix == FALSE) { + missingimages[lpUnittype] = TRUE; return FALSE; } int XMover, YMover; #ifdef RA2_MODE - XMover=g_data.GetInteger("VehicleVoxelTurretsRA2", lpUnittype+"X"); - YMover=g_data.GetInteger("VehicleVoxelTurretsRA2", lpUnittype+"Y"); + XMover = g_data.GetInteger("VehicleVoxelTurretsRA2", lpUnittype + "X"); + YMover = g_data.GetInteger("VehicleVoxelTurretsRA2", lpUnittype + "Y"); #else - XMover=g_data.GetInteger("VehicleVoxelTurrets", lpUnittype+"X"); - YMover=g_data.GetInteger("VehicleVoxelTurrets", lpUnittype+"Y"); + XMover = g_data.GetInteger("VehicleVoxelTurrets", lpUnittype + "X"); + YMover = g_data.GetInteger("VehicleVoxelTurrets", lpUnittype + "Y"); #endif iTurretOffset = art.GetInteger(image, "TurretOffset", iTurretOffset); - + int i; - for(i=0;i<8;i++) - { - float r_x,r_y,r_z; - + for (i = 0; i < 8; i++) { + float r_x, r_y, r_z; + r_x = 300; - r_y=0; - r_z=45*i+90; - + r_y = 0; + r_z = 45 * i + 90; + //r_x = 0; //r_y = 0; //r_z = 0; @@ -2164,7 +2046,7 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) const double pi = 3.141592654; Vec3f rotation(r_x / 180.0f * pi, r_y / 180.0f * pi, r_z / 180.0f * pi); Vec3f turretModelOffset(iTurretOffset / 6.0f, 0.0f, 0.0f); - + std::vector colors; std::shared_ptr> pLighting(new std::vector); @@ -2175,35 +2057,31 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) std::vector barrelNormals; RECT lprT; RECT lprB; - int turret_x,turret_y,turret_x_zmax,turret_y_zmax,barrel_x,barrel_y; + int turret_x, turret_y, turret_x_zmax, turret_y_zmax, barrel_x, barrel_y; - if(rules.GetBool( lpUnittype, "Turret")) { - if(FSunPackLib::SetCurrentVXL(image+"tur.vxl", hMix)) - { - FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, turretColors, turretNormals, &turret_x,&turret_y, 0, &turret_x_zmax, &turret_y_zmax,-1,-1,&lprT); + if (rules.GetBool(lpUnittype, "Turret")) { + if (FSunPackLib::SetCurrentVXL(image + "tur.vxl", hMix)) { + FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, turretColors, turretNormals, &turret_x, &turret_y, 0, &turret_x_zmax, &turret_y_zmax, -1, -1, &lprT); + } + if (FSunPackLib::SetCurrentVXL(image + "barl.vxl", hMix)) { + FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, barrelColors, barrelNormals, &barrel_x, &barrel_y, 0, NULL, NULL, 0, 0, &lprB); } - if(FSunPackLib::SetCurrentVXL(image+"barl.vxl", hMix)) - { - FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, turretModelOffset, barrelColors, barrelNormals, &barrel_x,&barrel_y, 0, NULL, NULL, 0, 0, &lprB); - } } - if(!FSunPackLib::SetCurrentVXL(filename, hMix)) - { + if (!FSunPackLib::SetCurrentVXL(filename, hMix)) { return FALSE; } - - int xcenter,ycenter,xcenter_zmax,ycenter_zmax; + + int xcenter, ycenter, xcenter_zmax, ycenter_zmax; RECT r; - if(! - FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, Vec3f(), colors, lighting, &xcenter, &ycenter,0, &xcenter_zmax, &ycenter_zmax,-1,-1,&r) - ) - { + if (! + FSunPackLib::LoadVXLImage(*m_voxelNormalTables, lightDirection, rotation, Vec3f(), colors, lighting, &xcenter, &ycenter, 0, &xcenter_zmax, &ycenter_zmax, -1, -1, &r) + ) { return FALSE; } @@ -2212,38 +2090,37 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) DDSURFACEDESC2 ddsd; ::memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; - ddsd.dwWidth=r.right-r.left; - ddsd.dwHeight=r.bottom-r.top; + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwWidth = r.right - r.left; + ddsd.dwHeight = r.bottom - r.top; //lpT->GetSurfaceDesc(&ddsd); // turret - if(turretColors.size()) - { + if (turretColors.size()) { DDSURFACEDESC2 ddsdT; ::memset(&ddsdT, 0, sizeof(DDSURFACEDESC2)); - ddsdT.dwSize=sizeof(DDSURFACEDESC2); - ddsdT.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; - ddsdT.dwWidth=lprT.right-lprT.left; - ddsdT.dwHeight=lprT.bottom-lprT.top; + ddsdT.dwSize = sizeof(DDSURFACEDESC2); + ddsdT.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ddsdT.dwWidth = lprT.right - lprT.left; + ddsdT.dwHeight = lprT.bottom - lprT.top; //lpTurret->GetSurfaceDesc(&ddsdT); DDBLTFX fx; ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); + fx.dwSize = sizeof(DDBLTFX); + - RECT srcRect, destRect; - srcRect.left=0; - srcRect.right=ddsdT.dwWidth; - destRect.left=xcenter - turret_x + XMover; - destRect.right=destRect.left+ddsdT.dwWidth; - srcRect.top=0; - srcRect.bottom=ddsdT.dwHeight; - destRect.top=ycenter - turret_y + YMover; - destRect.bottom=destRect.top+ddsdT.dwHeight; + srcRect.left = 0; + srcRect.right = ddsdT.dwWidth; + destRect.left = xcenter - turret_x + XMover; + destRect.right = destRect.left + ddsdT.dwWidth; + srcRect.top = 0; + srcRect.bottom = ddsdT.dwHeight; + destRect.top = ycenter - turret_y + YMover; + destRect.bottom = destRect.top + ddsdT.dwHeight; errstream << destRect.left << " " << destRect.top << endl; errstream.flush(); @@ -2251,58 +2128,56 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) Blit_PalD(colors.data(), destRect, turretColors.data(), srcRect, ddsdT.dwWidth, ddsd.dwWidth, ddsdT.dwHeight, ddsd.dwHeight); Blit_PalD(lighting.data(), destRect, turretNormals.data(), srcRect, ddsdT.dwWidth, ddsd.dwWidth, ddsdT.dwHeight, ddsd.dwHeight, turretColors.data()); //AssertNormals(turretColors, turretNormals); - + } // barrel - if(barrelColors.size()) - { + if (barrelColors.size()) { DDSURFACEDESC2 ddsdB; ::memset(&ddsdB, 0, sizeof(DDSURFACEDESC2)); - ddsdB.dwSize=sizeof(DDSURFACEDESC2); - ddsdB.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; - ddsdB.dwWidth=lprB.right-lprB.left; - ddsdB.dwHeight=lprB.bottom-lprB.top; + ddsdB.dwSize = sizeof(DDSURFACEDESC2); + ddsdB.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + ddsdB.dwWidth = lprB.right - lprB.left; + ddsdB.dwHeight = lprB.bottom - lprB.top; //lpBarrel->GetSurfaceDesc(&ddsdB); - + DDSURFACEDESC2 ddsdT; ::memset(&ddsdT, 0, sizeof(DDSURFACEDESC2)); - ddsdT.dwSize=sizeof(DDSURFACEDESC2); - ddsdT.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; - - if(turretColors.size()) - { - ddsdT.dwWidth=lprT.right-lprT.left; - ddsdT.dwHeight=lprT.bottom-lprT.top; + ddsdT.dwSize = sizeof(DDSURFACEDESC2); + ddsdT.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; + + if (turretColors.size()) { + ddsdT.dwWidth = lprT.right - lprT.left; + ddsdT.dwHeight = lprT.bottom - lprT.top; //lpTurret->GetSurfaceDesc(&ddsdT); } DDBLTFX fx; ::memset(&fx, 0, sizeof(DDBLTFX)); - fx.dwSize=sizeof(DDBLTFX); + fx.dwSize = sizeof(DDBLTFX); RECT srcRect, destRect; - srcRect.left=0; - srcRect.right=ddsdB.dwWidth; - destRect.left=xcenter-barrel_x+XMover; - destRect.right=destRect.left+ddsdB.dwWidth; - srcRect.top=0; - srcRect.bottom=ddsdB.dwHeight; - destRect.top=ycenter-barrel_y+YMover; - destRect.bottom=destRect.top+ddsdB.dwHeight; + srcRect.left = 0; + srcRect.right = ddsdB.dwWidth; + destRect.left = xcenter - barrel_x + XMover; + destRect.right = destRect.left + ddsdB.dwWidth; + srcRect.top = 0; + srcRect.bottom = ddsdB.dwHeight; + destRect.top = ycenter - barrel_y + YMover; + destRect.bottom = destRect.top + ddsdB.dwHeight; Blit_PalD(colors.data(), destRect, barrelColors.data(), srcRect, ddsdB.dwWidth, ddsd.dwWidth, ddsdB.dwHeight, ddsd.dwHeight); Blit_PalD(lighting.data(), destRect, barrelNormals.data(), srcRect, ddsdB.dwWidth, ddsd.dwWidth, ddsdB.dwHeight, ddsd.dwHeight, barrelColors.data()); //AssertNormals(vxlBarrelColors, barrelNormals); - + } // all VXL, so every non-transparent area should have a normal //AssertNormals(colors, lighting); char ic[50]; - itoa(7-i, ic, 10); + itoa(7 - i, ic, 10); errstream << ddsd.dwWidth << " " << ddsd.dwHeight << "\n"; PICDATA p; @@ -2310,54 +2185,52 @@ BOOL CLoading::LoadUnitGraphic(const CString& lpUnittype) ::memcpy(p.pic, colors.data(), colors.size()); p.lighting = pLighting; p.normalClass = vnc; - - p.vborder=new(VBORDER[ddsd.dwHeight]); + + p.vborder = new(VBORDER[ddsd.dwHeight]); int k; - for(k=0;k 0) - { + if (subname.GetLength() > 0) { auto res = FindUnitShp(subname, theat, artSection); /*CString subfilename = subname + ".shp"; @@ -2369,8 +2242,7 @@ void CLoading::LoadBuildingSubGraphic(const CString& subkey, const CIniFileSecti subfilename = subfilename_theat; }*/ - if (res && FSunPackLib::XCC_DoesFileExist(res->filename, res->mixfile)) - { + if (res && FSunPackLib::XCC_DoesFileExist(res->filename, res->mixfile)) { FSunPackLib::SetCurrentSHP(res->filename, res->mixfile); FSunPackLib::XCC_GetSHPHeader(&shp_h); FSunPackLib::LoadSHPImage(0, 1, &shp); @@ -2383,48 +2255,41 @@ void CLoading::LoadBuildingSubGraphic(const CString& subkey, const CIniFileSecti BOOL CLoading::InitMixFiles() { - last_succeeded_operation=8; + last_succeeded_operation = 8; MEMORYSTATUS ms; - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - int cs=ms.dwAvailPhys+ms.dwAvailPageFile; + int cs = ms.dwAvailPhys + ms.dwAvailPageFile; errstream << "InitMixFiles() called. Available memory: " << cs << endl; errstream.flush(); // load tibsun.mix and local.mix - if(DoesFileExist((CString)TSPath+(CString)"\\"+MAINMIX)) - { - errstream << "Loading " MAINMIX ".mix" ; + if (DoesFileExist((CString)TSPath + (CString)"\\" + MAINMIX)) { + errstream << "Loading " MAINMIX ".mix"; errstream.flush(); - m_hTibSun=FSunPackLib::XCC_OpenMix((CString)TSPath+(CString)"\\"+MAINMIX, NULL); - if(m_hTibSun!=NULL) - { + m_hTibSun = FSunPackLib::XCC_OpenMix((CString)TSPath + (CString)"\\" + MAINMIX, NULL); + if (m_hTibSun != NULL) { errstream << " success" << endl; errstream.flush(); - } - else - { + } else { ShowWindow(SW_HIDE); MessageBox(GetLanguageStringACP("Err_TSNotInstalled")); exit(200); } - m_hLanguage=FSunPackLib::XCC_OpenMix((CString)TSPath+(CString)"\\Language.mix", NULL); - m_hLangMD=FSunPackLib::XCC_OpenMix((CString)TSPath+(CString)"\\Langmd.mix", NULL); - m_hMarble=FSunPackLib::XCC_OpenMix((CString)TSPath+(CString)"\\marble.mix", NULL); + m_hLanguage = FSunPackLib::XCC_OpenMix((CString)TSPath + (CString)"\\Language.mix", NULL); + m_hLangMD = FSunPackLib::XCC_OpenMix((CString)TSPath + (CString)"\\Langmd.mix", NULL); + m_hMarble = FSunPackLib::XCC_OpenMix((CString)TSPath + (CString)"\\marble.mix", NULL); //if(!m_hLanguage) MessageBox("No language file found"); - if(!m_hMarble) - { - m_hMarble=FSunPackLib::XCC_OpenMix((CString)AppPath+(CString)"\\marble.mix", NULL); + if (!m_hMarble) { + m_hMarble = FSunPackLib::XCC_OpenMix((CString)AppPath + (CString)"\\marble.mix", NULL); } - } - else - { + } else { ShowWindow(SW_HIDE); MessageBox(GetLanguageStringACP("Err_TSNotInstalled")); exit(199); @@ -2432,120 +2297,114 @@ BOOL CLoading::InitMixFiles() errstream << "Loading local.mix"; errstream.flush(); - if(DoesFileExist((CString)TSPath+"\\Local.mix")==FALSE || theApp.m_Options.bSearchLikeTS==FALSE) - { - m_hLocal=FSunPackLib::XCC_OpenMix("Local.mix", m_hTibSun); - } - else - m_hLocal=FSunPackLib::XCC_OpenMix((CString)TSPath+"\\Local.mix", NULL); + if (DoesFileExist((CString)TSPath + "\\Local.mix") == FALSE || theApp.m_Options.bSearchLikeTS == FALSE) { + m_hLocal = FSunPackLib::XCC_OpenMix("Local.mix", m_hTibSun); + } else + m_hLocal = FSunPackLib::XCC_OpenMix((CString)TSPath + "\\Local.mix", NULL); errstream << " successful" << endl; errstream.flush(); - + errstream << "Loading conquer.mix, temperat.mix, isotemp.mix, isosnow.mix, isourb.mix and cache.mix"; errstream.flush(); - m_hConquer=FSunPackLib::XCC_OpenMix("conquer.mix", m_hTibSun); - m_hTemperat=FSunPackLib::XCC_OpenMix("temperat.mix", m_hTibSun); - m_hUrban=FSunPackLib::XCC_OpenMix("urban.mix", m_hTibSun); - m_hSnow=FSunPackLib::XCC_OpenMix("snow.mix", m_hTibSun); - m_hUrbanN=FSunPackLib::XCC_OpenMix("urbann.mix", m_hTibSun); - m_hLunar=FSunPackLib::XCC_OpenMix("lunar.mix", m_hTibSun); - m_hDesert=FSunPackLib::XCC_OpenMix("desert.mix", m_hTibSun); - m_hIsoTemp=FSunPackLib::XCC_OpenMix("isotemp.mix", m_hTibSun); - m_hIsoSnow=FSunPackLib::XCC_OpenMix("isosnow.mix", m_hTibSun); - m_hIsoUrb=FSunPackLib::XCC_OpenMix("isourb.mix", m_hTibSun); - m_hIsoUbn=FSunPackLib::XCC_OpenMix("isoubn.mix", m_hTibSun); - m_hIsoLun=FSunPackLib::XCC_OpenMix("isolun.mix", m_hTibSun); - m_hIsoDes=FSunPackLib::XCC_OpenMix("isodes.mix", m_hTibSun); - m_hIsoGen=FSunPackLib::XCC_OpenMix("isogen.mix", m_hTibSun); + m_hConquer = FSunPackLib::XCC_OpenMix("conquer.mix", m_hTibSun); + m_hTemperat = FSunPackLib::XCC_OpenMix("temperat.mix", m_hTibSun); + m_hUrban = FSunPackLib::XCC_OpenMix("urban.mix", m_hTibSun); + m_hSnow = FSunPackLib::XCC_OpenMix("snow.mix", m_hTibSun); + m_hUrbanN = FSunPackLib::XCC_OpenMix("urbann.mix", m_hTibSun); + m_hLunar = FSunPackLib::XCC_OpenMix("lunar.mix", m_hTibSun); + m_hDesert = FSunPackLib::XCC_OpenMix("desert.mix", m_hTibSun); + m_hIsoTemp = FSunPackLib::XCC_OpenMix("isotemp.mix", m_hTibSun); + m_hIsoSnow = FSunPackLib::XCC_OpenMix("isosnow.mix", m_hTibSun); + m_hIsoUrb = FSunPackLib::XCC_OpenMix("isourb.mix", m_hTibSun); + m_hIsoUbn = FSunPackLib::XCC_OpenMix("isoubn.mix", m_hTibSun); + m_hIsoLun = FSunPackLib::XCC_OpenMix("isolun.mix", m_hTibSun); + m_hIsoDes = FSunPackLib::XCC_OpenMix("isodes.mix", m_hTibSun); + m_hIsoGen = FSunPackLib::XCC_OpenMix("isogen.mix", m_hTibSun); //m_hBuildings=FSunPackLib::XCC_OpenMix("_ID1085587737", m_hTibSun); - m_hBuildings=FSunPackLib::XCC_OpenMix("Generic.mix", m_hTibSun); - m_hCache=FSunPackLib::XCC_OpenMix("cache.mix", m_hTibSun); - m_hTem=FSunPackLib::XCC_OpenMix("tem.mix", m_hTibSun); - m_hSno=FSunPackLib::XCC_OpenMix("sno.mix", m_hTibSun); - m_hUrb=FSunPackLib::XCC_OpenMix("urb.mix", m_hTibSun); - m_hUbn=FSunPackLib::XCC_OpenMix("ubn.mix", m_hTibSun); - m_hLun=FSunPackLib::XCC_OpenMix("lun.mix", m_hTibSun); - m_hDes=FSunPackLib::XCC_OpenMix("des.mix", m_hTibSun); - if(!m_hMarble) FSunPackLib::XCC_OpenMix("marble.mix", m_hTibSun); + m_hBuildings = FSunPackLib::XCC_OpenMix("Generic.mix", m_hTibSun); + m_hCache = FSunPackLib::XCC_OpenMix("cache.mix", m_hTibSun); + m_hTem = FSunPackLib::XCC_OpenMix("tem.mix", m_hTibSun); + m_hSno = FSunPackLib::XCC_OpenMix("sno.mix", m_hTibSun); + m_hUrb = FSunPackLib::XCC_OpenMix("urb.mix", m_hTibSun); + m_hUbn = FSunPackLib::XCC_OpenMix("ubn.mix", m_hTibSun); + m_hLun = FSunPackLib::XCC_OpenMix("lun.mix", m_hTibSun); + m_hDes = FSunPackLib::XCC_OpenMix("des.mix", m_hTibSun); + if (!m_hMarble) FSunPackLib::XCC_OpenMix("marble.mix", m_hTibSun); - if(m_hMarble) theApp.m_Options.bSupportMarbleMadness=TRUE; + if (m_hMarble) theApp.m_Options.bSupportMarbleMadness = TRUE; errstream << " successful" << endl; errstream.flush(); int i; - yuri_mode=FALSE; + yuri_mode = FALSE; - if(!theApp.m_Options.bSearchLikeTS) return TRUE; - - if(DoesFileExist((CString)TSPath+"\\ra2md.mix")) - yuri_mode=TRUE; // MW Apr 17th, make it available right here! + if (!theApp.m_Options.bSearchLikeTS) return TRUE; + + if (DoesFileExist((CString)TSPath + "\\ra2md.mix")) + yuri_mode = TRUE; // MW Apr 17th, make it available right here! // load expansion mix files - for(i=0;i<101;i++) - { - CString expand; - char n[50]; - + for (i = 0; i < 101; i++) { + CString expand; + char n[50]; + // MW April 17th, 2002: // read expandxxmd.mix files in yurimode - + itoa(i, n, 10); - expand=TSPath; - expand+="\\Expand"; - if(yuri_mode) expand+="md"; - if(i<10) expand+="0"; - expand+=n; - expand+=".mix"; + expand = TSPath; + expand += "\\Expand"; + if (yuri_mode) expand += "md"; + if (i < 10) expand += "0"; + expand += n; + expand += ".mix"; - CString nappend=".mix"; + CString nappend = ".mix"; - CString append=".mix"; - if(i==100) append="md.mix"; - - - if(yuri_mode) append="md.mix"; + CString append = ".mix"; + if (i == 100) append = "md.mix"; - if(i==100) expand=(CString)TSPath+"\\ra2md.mix"; // support the mission disk!!! + if (yuri_mode) append = "md.mix"; + + + if (i == 100) expand = (CString)TSPath + "\\ra2md.mix"; // support the mission disk!!! errstream << "Searching " << (LPCTSTR)expand << endl; errstream.flush(); - if(DoesFileExist(expand)) - { + if (DoesFileExist(expand)) { OutputDebugString(expand); OutputDebugString(": "); - - m_hExpand[i].hExpand=FSunPackLib::XCC_OpenMix(expand, NULL); + + m_hExpand[i].hExpand = FSunPackLib::XCC_OpenMix(expand, NULL); #ifdef YR_MODE - if(i==100 && m_hExpand[i].hExpand) yuri_mode=TRUE; + if (i == 100 && m_hExpand[i].hExpand) yuri_mode = TRUE; #endif errstream << (LPCTSTR)expand << " found: loading "; errstream.flush(); - CString conquer="conquer"; - if(i==100) conquer="conq"; - if(FSunPackLib::XCC_DoesFileExist(conquer+append, m_hExpand[i].hExpand)) - { - OutputDebugString(conquer+append); + CString conquer = "conquer"; + if (i == 100) conquer = "conq"; + if (FSunPackLib::XCC_DoesFileExist(conquer + append, m_hExpand[i].hExpand)) { + OutputDebugString(conquer + append); OutputDebugString(": "); - m_hExpand[i].hConquer=FSunPackLib::XCC_OpenMix((CString)conquer+append, m_hExpand[i].hExpand); + m_hExpand[i].hConquer = FSunPackLib::XCC_OpenMix((CString)conquer + append, m_hExpand[i].hExpand); errstream << "conquer.mix, "; } - if(FSunPackLib::XCC_DoesFileExist((CString)"local"+append, m_hExpand[i].hExpand)) - { - OutputDebugString((CString)"local"+append); + if (FSunPackLib::XCC_DoesFileExist((CString)"local" + append, m_hExpand[i].hExpand)) { + OutputDebugString((CString)"local" + append); OutputDebugString(": "); - m_hExpand[i].hLocal=FSunPackLib::XCC_OpenMix((CString)"local"+append, m_hExpand[i].hExpand); + m_hExpand[i].hLocal = FSunPackLib::XCC_OpenMix((CString)"local" + append, m_hExpand[i].hExpand); errstream << "local.mix, "; } //if(FSunPackLib::XCC_DoesFileExist("_ID1085587737", m_hExpand[i].hExpand)) @@ -2553,230 +2412,198 @@ BOOL CLoading::InitMixFiles() //m_hExpand[i].hConquer=FSunPackLib::XCC_OpenMix("_ID1085587737", m_hExpand[i].hExpand); //errstream << "1085587737, "; } - if(FSunPackLib::XCC_DoesFileExist((CString)"temperat"+append, m_hExpand[i].hExpand)) - { - OutputDebugString((CString)"temperat"+append); + if (FSunPackLib::XCC_DoesFileExist((CString)"temperat" + append, m_hExpand[i].hExpand)) { + OutputDebugString((CString)"temperat" + append); OutputDebugString(": "); - m_hExpand[i].hTemperat=FSunPackLib::XCC_OpenMix((CString)"temperat"+append, m_hExpand[i].hExpand); + m_hExpand[i].hTemperat = FSunPackLib::XCC_OpenMix((CString)"temperat" + append, m_hExpand[i].hExpand); errstream << "temperat.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"urban"+append, m_hExpand[i].hExpand)) - { - OutputDebugString((CString)"urban"+append); + if (FSunPackLib::XCC_DoesFileExist((CString)"urban" + append, m_hExpand[i].hExpand)) { + OutputDebugString((CString)"urban" + append); OutputDebugString(": "); - m_hExpand[i].hUrban=FSunPackLib::XCC_OpenMix((CString)"urban"+append, m_hExpand[i].hExpand); + m_hExpand[i].hUrban = FSunPackLib::XCC_OpenMix((CString)"urban" + append, m_hExpand[i].hExpand); errstream << "urban.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"snow"+append, m_hExpand[i].hExpand)) - { - OutputDebugString((CString)"snow"+append); + if (FSunPackLib::XCC_DoesFileExist((CString)"snow" + append, m_hExpand[i].hExpand)) { + OutputDebugString((CString)"snow" + append); OutputDebugString(": "); - - FSunPackLib::_DEBUG_EnableLogs=true; - HMIXFILE hM=FSunPackLib::XCC_OpenMix((CString)"snow"+append, m_hExpand[i].hExpand); - m_hExpand[i].hSnow=hM; + FSunPackLib::_DEBUG_EnableLogs = true; + + HMIXFILE hM = FSunPackLib::XCC_OpenMix((CString)"snow" + append, m_hExpand[i].hExpand); + m_hExpand[i].hSnow = hM; errstream << "snow.mix, "; errstream.flush(); - FSunPackLib::_DEBUG_EnableLogs=false; + FSunPackLib::_DEBUG_EnableLogs = false; } - CString generic="generic"; - if(i==100) generic="gener"; - if(FSunPackLib::XCC_DoesFileExist((CString)generic+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hGeneric=FSunPackLib::XCC_OpenMix((CString)generic+append, m_hExpand[i].hExpand); + CString generic = "generic"; + if (i == 100) generic = "gener"; + if (FSunPackLib::XCC_DoesFileExist((CString)generic + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hGeneric = FSunPackLib::XCC_OpenMix((CString)generic + append, m_hExpand[i].hExpand); errstream << "generic.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"urbann"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hUrbanN=FSunPackLib::XCC_OpenMix((CString)"urbann"+nappend, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"urbann" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hUrbanN = FSunPackLib::XCC_OpenMix((CString)"urbann" + nappend, m_hExpand[i].hExpand); errstream << "urbann.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"lunar"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hLunar=FSunPackLib::XCC_OpenMix((CString)"lunar"+nappend, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"lunar" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hLunar = FSunPackLib::XCC_OpenMix((CString)"lunar" + nappend, m_hExpand[i].hExpand); errstream << "lunar.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"desert"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hDesert=FSunPackLib::XCC_OpenMix((CString)"desert"+nappend, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"desert" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hDesert = FSunPackLib::XCC_OpenMix((CString)"desert" + nappend, m_hExpand[i].hExpand); errstream << "desert.mix, "; errstream.flush(); } - CString isotemp="isotemp"; - if(i==100) isotemp="isotem"; - if(FSunPackLib::XCC_DoesFileExist(isotemp+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoTemp=FSunPackLib::XCC_OpenMix((CString)isotemp+append, m_hExpand[i].hExpand); + CString isotemp = "isotemp"; + if (i == 100) isotemp = "isotem"; + if (FSunPackLib::XCC_DoesFileExist(isotemp + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoTemp = FSunPackLib::XCC_OpenMix((CString)isotemp + append, m_hExpand[i].hExpand); errstream << "isotemp.mix, "; errstream.flush(); } - CString isosnow="isosnow"; - if(i==100) isosnow="isosno"; - if(FSunPackLib::XCC_DoesFileExist((CString)isosnow+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoSnow=FSunPackLib::XCC_OpenMix((CString)isosnow+append, m_hExpand[i].hExpand); + CString isosnow = "isosnow"; + if (i == 100) isosnow = "isosno"; + if (FSunPackLib::XCC_DoesFileExist((CString)isosnow + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoSnow = FSunPackLib::XCC_OpenMix((CString)isosnow + append, m_hExpand[i].hExpand); errstream << "isosnow.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isourb"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoUrb=FSunPackLib::XCC_OpenMix((CString)"isourb"+append, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isourb" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoUrb = FSunPackLib::XCC_OpenMix((CString)"isourb" + append, m_hExpand[i].hExpand); errstream << "isourb.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isoubn"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoUbnMd=FSunPackLib::XCC_OpenMix((CString)"isoubn"+append, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isoubn" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoUbnMd = FSunPackLib::XCC_OpenMix((CString)"isoubn" + append, m_hExpand[i].hExpand); errstream << "isoubn.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isolun"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoLunMd=FSunPackLib::XCC_OpenMix((CString)"isolun"+append, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isolun" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoLunMd = FSunPackLib::XCC_OpenMix((CString)"isolun" + append, m_hExpand[i].hExpand); errstream << "isolun.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isodes"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoDesMd=FSunPackLib::XCC_OpenMix((CString)"isodes"+append, m_hExpand[i].hExpand); - errstream << "isodes.mix, "; - errstream.flush(); - } - - if(FSunPackLib::XCC_DoesFileExist((CString)"isoubn"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoUbn=FSunPackLib::XCC_OpenMix((CString)"isoubn"+nappend, m_hExpand[i].hExpand); - errstream << "isoubn.mix, "; - errstream.flush(); - } - if(FSunPackLib::XCC_DoesFileExist((CString)"isolun"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoLun=FSunPackLib::XCC_OpenMix((CString)"isolun"+nappend, m_hExpand[i].hExpand); - errstream << "isolun.mix, "; - errstream.flush(); - } - if(FSunPackLib::XCC_DoesFileExist((CString)"isodes"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoDes=FSunPackLib::XCC_OpenMix((CString)"isodes"+nappend, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isodes" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoDesMd = FSunPackLib::XCC_OpenMix((CString)"isodes" + append, m_hExpand[i].hExpand); errstream << "isodes.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isogen"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoGenMd=FSunPackLib::XCC_OpenMix((CString)"isogen"+append, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isoubn" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoUbn = FSunPackLib::XCC_OpenMix((CString)"isoubn" + nappend, m_hExpand[i].hExpand); + errstream << "isoubn.mix, "; + errstream.flush(); + } + if (FSunPackLib::XCC_DoesFileExist((CString)"isolun" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoLun = FSunPackLib::XCC_OpenMix((CString)"isolun" + nappend, m_hExpand[i].hExpand); + errstream << "isolun.mix, "; + errstream.flush(); + } + if (FSunPackLib::XCC_DoesFileExist((CString)"isodes" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoDes = FSunPackLib::XCC_OpenMix((CString)"isodes" + nappend, m_hExpand[i].hExpand); + errstream << "isodes.mix, "; + errstream.flush(); + } + + if (FSunPackLib::XCC_DoesFileExist((CString)"isogen" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoGenMd = FSunPackLib::XCC_OpenMix((CString)"isogen" + append, m_hExpand[i].hExpand); errstream << "isogen.mix, "; errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"isogen"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hIsoGen=FSunPackLib::XCC_OpenMix((CString)"isogen"+nappend, m_hExpand[i].hExpand); + if (FSunPackLib::XCC_DoesFileExist((CString)"isogen" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hIsoGen = FSunPackLib::XCC_OpenMix((CString)"isogen" + nappend, m_hExpand[i].hExpand); errstream << "isogen.mix, "; errstream.flush(); } - CString cache="ecache01"; - if(i==100) cache="cache"; - if(FSunPackLib::XCC_DoesFileExist((CString)cache+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hECache=FSunPackLib::XCC_OpenMix((CString)cache+append, m_hExpand[i].hExpand); - errstream << LPCSTR("ecache01"+append+", "); + CString cache = "ecache01"; + if (i == 100) cache = "cache"; + if (FSunPackLib::XCC_DoesFileExist((CString)cache + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hECache = FSunPackLib::XCC_OpenMix((CString)cache + append, m_hExpand[i].hExpand); + errstream << LPCSTR("ecache01" + append + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"tem"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hTem=FSunPackLib::XCC_OpenMix((CString)"tem"+append, m_hExpand[i].hExpand); - errstream << LPCSTR("tem"+append+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"tem" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hTem = FSunPackLib::XCC_OpenMix((CString)"tem" + append, m_hExpand[i].hExpand); + errstream << LPCSTR("tem" + append + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"sno"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hSno=FSunPackLib::XCC_OpenMix((CString)"sno"+append, m_hExpand[i].hExpand); - errstream << LPCSTR("sno"+append+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"sno" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hSno = FSunPackLib::XCC_OpenMix((CString)"sno" + append, m_hExpand[i].hExpand); + errstream << LPCSTR("sno" + append + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"urb"+append, m_hExpand[i].hExpand)) - { - m_hExpand[i].hUrb=FSunPackLib::XCC_OpenMix((CString)"urb"+append, m_hExpand[i].hExpand); - errstream << LPCSTR("urb"+append+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"urb" + append, m_hExpand[i].hExpand)) { + m_hExpand[i].hUrb = FSunPackLib::XCC_OpenMix((CString)"urb" + append, m_hExpand[i].hExpand); + errstream << LPCSTR("urb" + append + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"ubn"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hUbn=FSunPackLib::XCC_OpenMix((CString)"ubn"+nappend, m_hExpand[i].hExpand); - errstream << LPCSTR("ubn"+nappend+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"ubn" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hUbn = FSunPackLib::XCC_OpenMix((CString)"ubn" + nappend, m_hExpand[i].hExpand); + errstream << LPCSTR("ubn" + nappend + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"lun"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hLun=FSunPackLib::XCC_OpenMix((CString)"lun"+nappend, m_hExpand[i].hExpand); - errstream << LPCSTR("lun"+nappend+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"lun" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hLun = FSunPackLib::XCC_OpenMix((CString)"lun" + nappend, m_hExpand[i].hExpand); + errstream << LPCSTR("lun" + nappend + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"des"+nappend, m_hExpand[i].hExpand)) - { - m_hExpand[i].hDes=FSunPackLib::XCC_OpenMix((CString)"des"+nappend, m_hExpand[i].hExpand); - errstream << LPCSTR("des"+nappend+", "); + if (FSunPackLib::XCC_DoesFileExist((CString)"des" + nappend, m_hExpand[i].hExpand)) { + m_hExpand[i].hDes = FSunPackLib::XCC_OpenMix((CString)"des" + nappend, m_hExpand[i].hExpand); + errstream << LPCSTR("des" + nappend + ", "); errstream.flush(); } - if(FSunPackLib::XCC_DoesFileExist((CString)"marble"+append, m_hExpand[i].hExpand)) - { - theApp.m_Options.bSupportMarbleMadness=TRUE; + if (FSunPackLib::XCC_DoesFileExist((CString)"marble" + append, m_hExpand[i].hExpand)) { + theApp.m_Options.bSupportMarbleMadness = TRUE; - m_hExpand[i].hMarble=FSunPackLib::XCC_OpenMix((CString)"marble"+append, m_hExpand[i].hExpand); - errstream << LPCSTR("marble"+append+", "); + m_hExpand[i].hMarble = FSunPackLib::XCC_OpenMix((CString)"marble" + append, m_hExpand[i].hExpand); + errstream << LPCSTR("marble" + append + ", "); errstream.flush(); } - + errstream << endl; errstream.flush(); - } - else - { - m_hExpand[i].hExpand=NULL; + } else { + m_hExpand[i].hExpand = NULL; } } // load expansion ecache mix files - for(i=0;i<100;i++) - { - CString expand; - char n[50]; - + for (i = 0; i < 100; i++) { + CString expand; + char n[50]; + itoa(i, n, 10); - expand=TSPath; - if(!yuri_mode) expand+="\\ECache"; - else expand+="\\ecachemd"; + expand = TSPath; + if (!yuri_mode) expand += "\\ECache"; + else expand += "\\ecachemd"; - if(i<10) expand+="0"; - expand+=n; - expand+=".mix"; + if (i < 10) expand += "0"; + expand += n; + expand += ".mix"; - - if(DoesFileExist(expand)) - { - m_hECache[i]=FSunPackLib::XCC_OpenMix(expand, NULL); + + if (DoesFileExist(expand)) { + m_hECache[i] = FSunPackLib::XCC_OpenMix(expand, NULL); errstream << (LPCTSTR)expand << " found and loaded" << endl; errstream.flush(); - } - else - { - m_hECache[i]=NULL; + } else { + m_hECache[i] = NULL; } } - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - cs=ms.dwAvailPhys+ms.dwAvailPageFile; + cs = ms.dwAvailPhys + ms.dwAvailPageFile; errstream << "InitMixFiles() finished. Available memory: " << cs << endl; errstream.flush(); @@ -2823,8 +2650,7 @@ void CLoading::Unload() int i = 0; - for (i = 0;i < 100; i++) - { + for (i = 0; i < 100; i++) { FSunPackLib::XCC_CloseMix(m_hExpand[i].hExpand); FSunPackLib::XCC_CloseMix(m_hExpand[i].hConquer); FSunPackLib::XCC_CloseMix(m_hExpand[i].hECache); @@ -2842,8 +2668,7 @@ void CLoading::Unload() m_hExpand[i].hExpand = NULL; } - for (i = 0;i < 100; i++) - { + for (i = 0; i < 100; i++) { FSunPackLib::XCC_CloseMix(m_hECache[i]); } @@ -2859,198 +2684,178 @@ void CLoading::Unload() HMIXFILE CLoading::FindFileInMix(LPCTSTR lpFilename, TheaterChar* pTheaterChar) { - if(pTheaterChar) + if (pTheaterChar) *pTheaterChar = TheaterChar::None; int i; // MW: added ecache support - for(i=100;i>=0; i--) - { - HMIXFILE cuExp=m_hECache[i]; + for (i = 100; i >= 0; i--) { + HMIXFILE cuExp = m_hECache[i]; - if(cuExp!=NULL) - { - if(FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp)) + if (cuExp != NULL) { + if (FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp)) return cuExp; } } - for(i=100;i>=0; i--) - { - EXPANDMIX cuExp=m_hExpand[i]; + for (i = 100; i >= 0; i--) { + EXPANDMIX cuExp = m_hExpand[i]; - if(cuExp.hExpand!=NULL) - { - if(FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hExpand)) + if (cuExp.hExpand != NULL) { + if (FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hExpand)) return cuExp.hExpand; - if(cuExp.hECache!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hECache)) + if (cuExp.hECache != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hECache)) return cuExp.hECache; - if(cuExp.hConquer!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hConquer)) + if (cuExp.hConquer != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hConquer)) return cuExp.hConquer; - if(cuExp.hLocal!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLocal)) + if (cuExp.hLocal != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLocal)) return cuExp.hLocal; - if(cuExp.hTemperat!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hTemperat)) + if (cuExp.hTemperat != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hTemperat)) return cuExp.hTemperat; - if(strcmp(lpFilename,"yayard.shp")==NULL) - FSunPackLib::_DEBUG_EnableLogs=true; - if(cuExp.hSnow!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hSnow)) - return cuExp.hSnow; - FSunPackLib::_DEBUG_EnableLogs=false; - if(cuExp.hGeneric!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hGeneric)) + if (strcmp(lpFilename, "yayard.shp") == NULL) + FSunPackLib::_DEBUG_EnableLogs = true; + if (cuExp.hSnow != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hSnow)) + return cuExp.hSnow; + FSunPackLib::_DEBUG_EnableLogs = false; + if (cuExp.hGeneric != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hGeneric)) return cuExp.hGeneric; - if(cuExp.hUrban!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrban)) + if (cuExp.hUrban != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrban)) return cuExp.hUrban; - if(cuExp.hUrbanN!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrbanN)) + if (cuExp.hUrbanN != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrbanN)) return cuExp.hUrbanN; - if(cuExp.hLunar!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLunar)) + if (cuExp.hLunar != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLunar)) return cuExp.hLunar; - if(cuExp.hDesert!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hDesert)) + if (cuExp.hDesert != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hDesert)) return cuExp.hDesert; - if(cuExp.hBuildings!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hBuildings)) + if (cuExp.hBuildings != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hBuildings)) return cuExp.hBuildings; - if(cuExp.hIsoGen!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoGen)) + if (cuExp.hIsoGen != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoGen)) return cuExp.hIsoGen; - if(cuExp.hIsoGenMd!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoGenMd)) + if (cuExp.hIsoGenMd != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoGenMd)) return cuExp.hIsoGenMd; - if(cuExp.hIsoTemp!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoTemp)) - { - if(pTheaterChar) *pTheaterChar=TheaterChar::T; + if (cuExp.hIsoTemp != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoTemp)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::T; return cuExp.hIsoTemp; } - if(cuExp.hIsoSnow!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoSnow)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::A; - return cuExp.hIsoSnow; + if (cuExp.hIsoSnow != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoSnow)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::A; + return cuExp.hIsoSnow; } - if(cuExp.hIsoUrb!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUrb)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::U; - return cuExp.hIsoUrb; + if (cuExp.hIsoUrb != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUrb)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::U; + return cuExp.hIsoUrb; } - if(cuExp.hIsoUbn!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUbn)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::N; + if (cuExp.hIsoUbn != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUbn)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::N; return cuExp.hIsoUbn; } - if(cuExp.hIsoDes!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoDes)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::D; - return cuExp.hIsoDes; + if (cuExp.hIsoDes != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoDes)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::D; + return cuExp.hIsoDes; } - if(cuExp.hIsoLun!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoLun)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::L; - return cuExp.hIsoLun; + if (cuExp.hIsoLun != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoLun)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::L; + return cuExp.hIsoLun; } - if(cuExp.hIsoUbnMd!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUbnMd)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::N; + if (cuExp.hIsoUbnMd != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoUbnMd)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::N; return cuExp.hIsoUbnMd; } - if(cuExp.hIsoDesMd!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoDesMd)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::D; - return cuExp.hIsoDesMd; + if (cuExp.hIsoDesMd != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoDesMd)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::D; + return cuExp.hIsoDesMd; } - if(cuExp.hIsoLunMd!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoLunMd)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::L; - return cuExp.hIsoLunMd; + if (cuExp.hIsoLunMd != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hIsoLunMd)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::L; + return cuExp.hIsoLunMd; } - if(cuExp.hSno!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hSno)) - return cuExp.hSno; - if(cuExp.hTem!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hTem)) - return cuExp.hTem; - if(cuExp.hUrb!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrb)) + if (cuExp.hSno != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hSno)) + return cuExp.hSno; + if (cuExp.hTem != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hTem)) + return cuExp.hTem; + if (cuExp.hUrb != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUrb)) return cuExp.hUrb; - if(cuExp.hUbn!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUbn)) - return cuExp.hUbn; - if(cuExp.hLun!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLun)) - return cuExp.hLun; - if(cuExp.hDes!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hDes)) + if (cuExp.hUbn != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hUbn)) + return cuExp.hUbn; + if (cuExp.hLun != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hLun)) + return cuExp.hLun; + if (cuExp.hDes != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hDes)) return cuExp.hDes; - if(cuExp.hMarble!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hMarble)) - return cuExp.hMarble; + if (cuExp.hMarble != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, cuExp.hMarble)) + return cuExp.hMarble; } } - if(m_hTibSun!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTibSun)) + if (m_hTibSun != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTibSun)) return m_hTibSun; - if(m_hLanguage!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLanguage)) - return m_hLanguage; - if(m_hLangMD!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLangMD)) - return m_hLangMD; - if(m_hLocal!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLocal)) + if (m_hLanguage != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLanguage)) + return m_hLanguage; + if (m_hLangMD != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLangMD)) + return m_hLangMD; + if (m_hLocal != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLocal)) return m_hLocal; - if(m_hBuildings!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hBuildings)) + if (m_hBuildings != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hBuildings)) return m_hBuildings; - if(m_hCache!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hCache)) + if (m_hCache != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hCache)) return m_hCache; - if(m_hConquer!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hConquer)) + if (m_hConquer != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hConquer)) return m_hConquer; - if(m_hTemperat!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTemperat)) + if (m_hTemperat != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTemperat)) return m_hTemperat; - if(m_hSnow!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hSnow)) + if (m_hSnow != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hSnow)) return m_hSnow; - if(m_hUrban!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrban)) + if (m_hUrban != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrban)) return m_hUrban; - if(m_hUrbanN!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrbanN)) + if (m_hUrbanN != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrbanN)) return m_hUrbanN; - if(m_hLunar!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLunar)) + if (m_hLunar != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLunar)) return m_hLunar; - if(m_hDesert!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hDesert)) + if (m_hDesert != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hDesert)) return m_hDesert; - if(m_hIsoGen!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoGen)) - { + if (m_hIsoGen != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoGen)) { return m_hIsoGen; } - if(m_hIsoTemp!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoTemp)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::T; + if (m_hIsoTemp != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoTemp)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::T; return m_hIsoTemp; } - if(m_hIsoSnow!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoSnow)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::A; - return m_hIsoSnow; + if (m_hIsoSnow != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoSnow)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::A; + return m_hIsoSnow; } - if(m_hIsoUrb!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoUrb)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::U; - return m_hIsoUrb; + if (m_hIsoUrb != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoUrb)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::U; + return m_hIsoUrb; } - if(m_hIsoUbn!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoUbn)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::N; + if (m_hIsoUbn != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoUbn)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::N; return m_hIsoUbn; } - if(m_hIsoLun!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoLun)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::L; - return m_hIsoLun; + if (m_hIsoLun != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoLun)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::L; + return m_hIsoLun; } - if(m_hIsoDes!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoDes)) - { - if(pTheaterChar) *pTheaterChar = TheaterChar::D; - return m_hIsoDes; + if (m_hIsoDes != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hIsoDes)) { + if (pTheaterChar) *pTheaterChar = TheaterChar::D; + return m_hIsoDes; } - if(m_hTem!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTem)) + if (m_hTem != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hTem)) return m_hTem; - if(m_hSno!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hSno)) - return m_hSno; - if(m_hUrb!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrb)) - return m_hUrb; - if(m_hUbn!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUbn)) + if (m_hSno != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hSno)) + return m_hSno; + if (m_hUrb != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUrb)) + return m_hUrb; + if (m_hUbn != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hUbn)) return m_hUbn; - if(m_hLun!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLun)) - return m_hLun; - if(m_hDes!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hDes)) - return m_hDes; + if (m_hLun != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hLun)) + return m_hLun; + if (m_hDes != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hDes)) + return m_hDes; + + if (m_hMarble != NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hMarble)) + return m_hMarble; - if(m_hMarble!=NULL && FSunPackLib::XCC_DoesFileExist(lpFilename, m_hMarble)) - return m_hMarble; - return NULL; } @@ -3060,106 +2865,106 @@ HMIXFILE CLoading::FindFileInMix(LPCTSTR lpFilename, TheaterChar* pTheaterChar) void CLoading::InitPalettes() { errstream << "InitPalettes() called\n"; - if(!FSunPackLib::XCC_ExtractFile("isotem.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("isotem.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "IsoTem.pal failed\n"; - m_hPalIsoTemp=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalIsoTemp = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("isosno.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("isosno.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "IsoSno.pal failed\n"; - m_hPalIsoSnow=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalIsoSnow = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("isourb.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("isourb.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "IsoUrb.pal failed\n"; - m_hPalIsoUrb=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalIsoUrb = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - HMIXFILE m_hCache2=m_hExpand[100].hECache; - if(!FSunPackLib::XCC_ExtractFile("isolun.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + HMIXFILE m_hCache2 = m_hExpand[100].hECache; + if (!FSunPackLib::XCC_ExtractFile("isolun.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "IsoLun.pal failed\n"; - m_hPalIsoLun=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); - - if(!FSunPackLib::XCC_ExtractFile("isodes.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + m_hPalIsoLun = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); + + if (!FSunPackLib::XCC_ExtractFile("isodes.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "IsoDes.pal failed\n"; - m_hPalIsoDes=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalIsoDes = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("isoubn.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("isoubn.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "IsoUbn.pal failed\n"; - m_hPalIsoUbn=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalIsoUbn = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("unittem.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("unittem.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "UnitTem.pal failed"; - m_hPalUnitTemp=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitTemp = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("unitsno.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("unitsno.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "UnitSno.pal failed\n"; - m_hPalUnitSnow=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitSnow = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("uniturb.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("uniturb.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "UnitUrb.pal failed\n"; - m_hPalUnitUrb=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitUrb = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("unitlun.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("unitlun.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "UnitLun.pal failed\n"; - m_hPalUnitLun=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitLun = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("unitdes.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("unitdes.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "UnitDes.pal failed\n"; - m_hPalUnitDes=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitDes = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("unitubn.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("unitubn.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "UnitUbn.pal failed\n"; - m_hPalUnitUbn=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUnitUbn = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("snow.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("snow.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "Snow.pal failed\n"; - m_hPalSnow=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalSnow = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("temperat.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("temperat.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "Temperat.pal failed\n"; - m_hPalTemp=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalTemp = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("urban.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("urban.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "Urban.pal failed\n"; - m_hPalUrb=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUrb = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("lunar.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("lunar.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "lunar.pal failed\n"; - m_hPalLun=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalLun = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("desert.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("desert.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "desert.pal failed\n"; - m_hPalDes=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalDes = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("urbann.pal", u8AppDataPath+"\\TmpPalette.pal", m_hCache2)) + if (!FSunPackLib::XCC_ExtractFile("urbann.pal", u8AppDataPath + "\\TmpPalette.pal", m_hCache2)) errstream << "urbann.pal failed\n"; - m_hPalUbn=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalUbn = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); - if(!FSunPackLib::XCC_ExtractFile("_ID2124019542", u8AppDataPath+"\\TmpPalette.pal", m_hCache)) + if (!FSunPackLib::XCC_ExtractFile("_ID2124019542", u8AppDataPath + "\\TmpPalette.pal", m_hCache)) errstream << "lib.pal failed\n"; - m_hPalLib=FSunPackLib::LoadTSPalette(u8AppDataPath+"\\TmpPalette.pal", NULL); - deleteFile(u8AppDataPath +"\\TmpPalette.pal"); + m_hPalLib = FSunPackLib::LoadTSPalette(u8AppDataPath + "\\TmpPalette.pal", NULL); + deleteFile(u8AppDataPath + "\\TmpPalette.pal"); errstream << "\n"; @@ -3171,12 +2976,12 @@ void CLoading::InitPalettes() void CLoading::InitTMPs(CProgressCtrl* prog) { FetchPalettes(); - + MEMORYSTATUS ms; - ms.dwLength=sizeof(MEMORYSTATUS); + ms.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&ms); - int cs=ms.dwAvailPhys+ms.dwAvailPageFile; + int cs = ms.dwAvailPhys + ms.dwAvailPageFile; errstream << "InitTMPs() called. Available memory: " << cs << endl; errstream.flush(); @@ -3187,7 +2992,7 @@ void CLoading::InitTMPs(CProgressCtrl* prog) - + int i, tcount = 0; @@ -3200,39 +3005,38 @@ void CLoading::InitTMPs(CProgressCtrl* prog) for (e = 0; e < 4 - strlen(c); e++) { tset += "0"; } - tset+=c; - CString sec="TileSet"; - sec+=tset; + tset += c; + CString sec = "TileSet"; + sec += tset; auto const pSec = tiles->TryGetSection(sec); if (!pSec) { break; } - + for (e = 0; e < pSec->GetInteger("TilesInSet"); e++) { tcount++; } } - if(prog) prog->SetRange(0, tcount); - if(prog) prog->SetPos(0); + if (prog) prog->SetRange(0, tcount); + if (prog) prog->SetPos(0); - if(*tiledata!=NULL) delete[] *tiledata; - *tiledata=new(TILEDATA[tcount]); - *tiledata_count=tcount; + if (*tiledata != NULL) delete[] * tiledata; + *tiledata = new(TILEDATA[tcount]); + *tiledata_count = tcount; - DWORD tilecount=0; - for(i=0;i<10000;i++) - { + DWORD tilecount = 0; + for (i = 0; i < 10000; i++) { CString tset; char c[50]; itoa(i, c, 10); int e; - for(e=0;e<4-strlen(c);e++) - tset+="0"; - tset+=c; - CString sec="TileSet"; - sec+=tset; + for (e = 0; e < 4 - strlen(c); e++) + tset += "0"; + tset += c; + CString sec = "TileSet"; + sec += tset; auto const pSec = tiles->TryGetSection(sec); if (!pSec) { @@ -3240,10 +3044,10 @@ void CLoading::InitTMPs(CProgressCtrl* prog) } BOOL bTib, bMorph, bPlace, bMadness; - bPlace=TRUE; - bTib=FALSE; - bMorph=FALSE; - bMadness=FALSE; + bPlace = TRUE; + bTib = FALSE; + bMorph = FALSE; + bMadness = FALSE; if (pSec->GetBool("AllowTiberium")) { bTib = TRUE; @@ -3262,84 +3066,75 @@ void CLoading::InitTMPs(CProgressCtrl* prog) } auto const tilesetAnimSection = tiles->TryGetSection(tiles->GetString(sec, "SetName")); - tilesets_start[i]=tilecount; + tilesets_start[i] = tilecount; for (e = 0; e < tiles->GetInteger(sec, "TilesInSet"); e++) { std::string sId = std::format("{:02}", e + 1); CString filename = tiles->GetString(sec, "FileName"); - filename+=sId.c_str(); + filename += sId.c_str(); + + CString bas_f = filename; - CString bas_f=filename; - CString suffix; - if(tiles==&tiles_t) suffix =".tem"; - if(tiles==&tiles_s) suffix =".sno"; - if(tiles==&tiles_u) suffix =".urb"; - if(tiles==&tiles_un) suffix =".ubn"; - if(tiles==&tiles_l) suffix =".lun"; - if(tiles==&tiles_d) suffix =".des"; + if (tiles == &tiles_t) suffix = ".tem"; + if (tiles == &tiles_s) suffix = ".sno"; + if (tiles == &tiles_u) suffix = ".urb"; + if (tiles == &tiles_un) suffix = ".ubn"; + if (tiles == &tiles_l) suffix = ".lun"; + if (tiles == &tiles_d) suffix = ".des"; filename += suffix; - HTSPALETTE hPalette=m_hPalIsoTemp; - if(tiles==&tiles_s) hPalette=m_hPalIsoSnow; - if(tiles==&tiles_u) hPalette=m_hPalIsoUrb; - if(tiles==&tiles_t) hPalette=m_hPalIsoTemp; - if(tiles==&tiles_un) hPalette=m_hPalIsoUbn; - if(tiles==&tiles_d) hPalette=m_hPalIsoDes; - if(tiles==&tiles_l) hPalette=m_hPalIsoLun; + HTSPALETTE hPalette = m_hPalIsoTemp; + if (tiles == &tiles_s) hPalette = m_hPalIsoSnow; + if (tiles == &tiles_u) hPalette = m_hPalIsoUrb; + if (tiles == &tiles_t) hPalette = m_hPalIsoTemp; + if (tiles == &tiles_un) hPalette = m_hPalIsoUbn; + if (tiles == &tiles_d) hPalette = m_hPalIsoDes; + if (tiles == &tiles_l) hPalette = m_hPalIsoLun; // MW add: use other... - if(FindFileInMix(filename)==NULL && tiles==&tiles_un) { filename=bas_f+".urb"; hPalette=m_hPalIsoUrb; } - if(FindFileInMix(filename)==NULL) { filename=bas_f+".tem"; hPalette=m_hPalIsoTemp; } + if (FindFileInMix(filename) == NULL && tiles == &tiles_un) { filename = bas_f + ".urb"; hPalette = m_hPalIsoUrb; } + if (FindFileInMix(filename) == NULL) { filename = bas_f + ".tem"; hPalette = m_hPalIsoTemp; } - (*tiledata)[tilecount].bAllowTiberium=bTib; - (*tiledata)[tilecount].bAllowToPlace=bPlace; - (*tiledata)[tilecount].bMorphable=bMorph; - (*tiledata)[tilecount].bMarbleMadness=bMadness; - (*tiledata)[tilecount].wTileSet=i; + (*tiledata)[tilecount].bAllowTiberium = bTib; + (*tiledata)[tilecount].bAllowToPlace = bPlace; + (*tiledata)[tilecount].bMorphable = bMorph; + (*tiledata)[tilecount].bMarbleMadness = bMadness; + (*tiledata)[tilecount].wTileSet = i; int reps; - for(reps=0;reps<5;reps++) - { - CString r_filename=filename; - - if(reps>0) - { + for (reps = 0; reps < 5; reps++) { + CString r_filename = filename; + + if (reps > 0) { char c[3]; - c[0]='a'+reps-1; - c[1]='.'; - c[2]=0; - + c[0] = 'a' + reps - 1; + c[1] = '.'; + c[2] = 0; + r_filename.Replace(".", c); - if(!LoadTile(r_filename, FindFileInMix(filename), hPalette, tilecount, TRUE)) + if (!LoadTile(r_filename, FindFileInMix(filename), hPalette, tilecount, TRUE)) break; - } - else - { + } else { LoadTile(filename, FindFileInMix(filename), hPalette, tilecount, FALSE); } } - if (tilesetAnimSection) - { + if (tilesetAnimSection) { auto anim = tilesetAnimSection->GetString(std::format("Tile{}Anim", sId).c_str()); auto offsetX = tilesetAnimSection->GetInteger(std::format("Tile{}XOffset", sId).c_str()); auto offsetY = tilesetAnimSection->GetInteger(std::format("Tile{}YOffset", sId).c_str()); auto attachesTo = tilesetAnimSection->GetInteger(std::format("Tile{}AttachesTo", sId).c_str()); auto animFileName = anim + suffix; HMIXFILE hAnimMix = FindFileInMix(animFileName); - if (hAnimMix) - { + if (hAnimMix) { auto& tile = (*tiledata)[tilecount]; - if (tile.wTileCount <= attachesTo) - { + if (tile.wTileCount <= attachesTo) { ASSERT(tile.wTileCount > attachesTo); - } - else - { + } else { auto& subtile = tile.tiles[attachesTo]; SHPHEADER shp_h; SHPIMAGEHEADER shpi_h; @@ -3350,14 +3145,12 @@ void CLoading::InitTMPs(CProgressCtrl* prog) FSunPackLib::XCC_GetSHPHeader(&shp_h); int imageNum = 1; FSunPackLib::XCC_GetSHPImageHeader(1, &shpi_h); - if (shpi_h.unknown == 0) - { + if (shpi_h.unknown == 0) { // shadow imageNum = 0; } FSunPackLib::XCC_GetSHPImageHeader(imageNum, &shpi_h); - if (FSunPackLib::LoadSHPImage(imageNum, *rawPic)) - { + if (FSunPackLib::LoadSHPImage(imageNum, *rawPic)) { subtile.anim = animPic; animPic->pic = animPic->rawPic->data(); animPic->bType = PICDATA_TYPE_SHP; @@ -3371,60 +3164,57 @@ void CLoading::InitTMPs(CProgressCtrl* prog) } } } - + tilecount++; - if(prog!=NULL /*&& tilecount%15==0*/) - { + if (prog != NULL /*&& tilecount%15==0*/) { prog->SetPos(tilecount); prog->UpdateWindow(); } } - + } - tilecount=0; + tilecount = 0; for (i = 0; i < 10000; i++) { CString tset; char c[50]; itoa(i, c, 10); int e; - for(e=0;e<4-strlen(c);e++) - tset+="0"; - tset+=c; - CString sec="TileSet"; - sec+=tset; + for (e = 0; e < 4 - strlen(c); e++) + tset += "0"; + tset += c; + CString sec = "TileSet"; + sec += tset; auto const pSec = tiles->TryGetSection(sec); if (!pSec) { break; } - int madnessid= pSec->GetInteger("MarbleMadness"); - + int madnessid = pSec->GetInteger("MarbleMadness"); + for (e = 0; e < pSec->GetInteger("TilesInSet"); e++) { - if(madnessid) { - (*tiledata)[tilecount].wMarbleGround=tilesets_start[madnessid]+(tilecount-tilesets_start[i]); - } - else { + if (madnessid) { + (*tiledata)[tilecount].wMarbleGround = tilesets_start[madnessid] + (tilecount - tilesets_start[i]); + } else { (*tiledata)[tilecount].wMarbleGround = 0xFFFF; } tilecount++; } } - + } #ifdef NOSURFACES // first version, using palettized (or extracted) data BOOL CLoading::LoadTile(LPCSTR lpFilename, HMIXFILE hOwner, HTSPALETTE hPalette, DWORD dwID, BOOL bReplacement) { - last_succeeded_operation=12; + last_succeeded_operation = 12; + - int tileCount; - - if(FSunPackLib::XCC_DoesFileExist(lpFilename, hOwner)) - { + + if (FSunPackLib::XCC_DoesFileExist(lpFilename, hOwner)) { FSunPackLib::SetCurrentTMP(lpFilename, hOwner); { @@ -3433,144 +3223,131 @@ BOOL CLoading::LoadTile(LPCSTR lpFilename, HMIXFILE hOwner, HTSPALETTE hPalette, RECT rect; FSunPackLib::XCC_GetTMPInfo(&rect, &tileCount, &tileWidth, &tileHeight); - - BYTE** pics=new(BYTE*[tileCount]); - if(FSunPackLib::LoadTMPImage(0, tileCount, pics)) // be aware this allocates memory! + BYTE** pics = new(BYTE * [tileCount]); + + if (FSunPackLib::LoadTMPImage(0, tileCount, pics)) // be aware this allocates memory! //if(FSunPackLib::LoadTMPImageInSurface(v.dd,lpFilename, 0, tileCount, pics, hPalette, hOwner)) { TILEDATA* td; - if(!bReplacement) td=&(*tiledata)[dwID]; - else - { + if (!bReplacement) td = &(*tiledata)[dwID]; + else { - TILEDATA* lpTmp=NULL; - if((*tiledata)[dwID].bReplacementCount) - { - lpTmp=new(TILEDATA[(*tiledata)[dwID].bReplacementCount]); - memcpy(lpTmp, (*tiledata)[dwID].lpReplacements, sizeof(TILEDATA)* (*tiledata)[dwID].bReplacementCount); + TILEDATA* lpTmp = NULL; + if ((*tiledata)[dwID].bReplacementCount) { + lpTmp = new(TILEDATA[(*tiledata)[dwID].bReplacementCount]); + memcpy(lpTmp, (*tiledata)[dwID].lpReplacements, sizeof(TILEDATA) * (*tiledata)[dwID].bReplacementCount); } - - (*tiledata)[dwID].lpReplacements=new(TILEDATA[(*tiledata)[dwID].bReplacementCount+1]); - if((*tiledata)[dwID].bReplacementCount) - { - memcpy((*tiledata)[dwID].lpReplacements, lpTmp, sizeof(TILEDATA)*(*tiledata)[dwID].bReplacementCount); + (*tiledata)[dwID].lpReplacements = new(TILEDATA[(*tiledata)[dwID].bReplacementCount + 1]); + + if ((*tiledata)[dwID].bReplacementCount) { + memcpy((*tiledata)[dwID].lpReplacements, lpTmp, sizeof(TILEDATA) * (*tiledata)[dwID].bReplacementCount); delete[] lpTmp; } - td=&(*tiledata)[dwID].lpReplacements[(*tiledata)[dwID].bReplacementCount]; + td = &(*tiledata)[dwID].lpReplacements[(*tiledata)[dwID].bReplacementCount]; (*tiledata)[dwID].bReplacementCount++; } - - td->tiles=new(SUBTILE[tileCount]); - td->wTileCount=tileCount; - td->cx=tileWidth; - td->cy=tileHeight; - td->rect=rect; - - int i; - for(i=0;itiles = new(SUBTILE[tileCount]); + td->wTileCount = tileCount; + td->cx = tileWidth; + td->cy = tileHeight; + td->rect = rect; + + int i; + for (i = 0; i < tileCount; i++) { + if (pics[i] != NULL) { + + int cx, cy; + BYTE height, terraintype, direction; POINT p; FSunPackLib::XCC_GetTMPTileInfo(i, &p, &cx, &cy, &direction, &height, &terraintype, &td->tiles[i].rgbLeft, &td->tiles[i].rgbRight); - - td->tiles[i].pic=pics[i]; - td->tiles[i].sX=p.x; - td->tiles[i].sY=p.y; - td->tiles[i].wWidth=cx; - td->tiles[i].wHeight=cy; - td->tiles[i].bZHeight=height; - td->tiles[i].bTerrainType=terraintype; - td->tiles[i].bHackedTerrainType=terraintype; - td->tiles[i].bDirection=direction; - td->tiles[i].vborder=new(VBORDER[cy]); + td->tiles[i].pic = pics[i]; + td->tiles[i].sX = p.x; + td->tiles[i].sY = p.y; + td->tiles[i].wWidth = cx; + td->tiles[i].wHeight = cy; + td->tiles[i].bZHeight = height; + td->tiles[i].bTerrainType = terraintype; + td->tiles[i].bHackedTerrainType = terraintype; + td->tiles[i].bDirection = direction; + + td->tiles[i].vborder = new(VBORDER[cy]); int k; - int size=0; - BOOL TranspInside=FALSE; - for(k=0;ktiles[i].vborder[k].left=l; - td->tiles[i].vborder[k].right=r; + int size = 0; + BOOL TranspInside = FALSE; + for (k = 0; k < cy; k++) { + int l, r; + BOOL* ti = NULL; + if (!TranspInside) ti = &TranspInside; + GetDrawBorder(pics[i], cx, k, l, r, 0, ti); + td->tiles[i].vborder[k].left = l; + td->tiles[i].vborder[k].right = r; - if(r>=l) - size+=r-l+1; + if (r >= l) + size += r - l + 1; } #ifdef NOSURFACES_EXTRACT - if(!TranspInside) - { + if (!TranspInside) { // extract the palette data! - td->tiles[i].bNotExtracted=FALSE; - td->tiles[i].pic=new(BYTE[size*bpp]); + td->tiles[i].bNotExtracted = FALSE; + td->tiles[i].pic = new(BYTE[size * bpp]); int l; - int pos=0; - for(k=0;ktiles[i].vborder[k].left; - right=td->tiles[i].vborder[k].right; - for(l=left;l<=right;l++) - { - memcpy(&td->tiles[i].pic[pos], &iPalIso[pics[i][l+k*cx]], bpp); - pos+=bpp; + left = td->tiles[i].vborder[k].left; + right = td->tiles[i].vborder[k].right; + for (l = left; l <= right; l++) { + memcpy(&td->tiles[i].pic[pos], &iPalIso[pics[i][l + k * cx]], bpp); + pos += bpp; } } delete[] pics[i]; - } - else - td->tiles[i].bNotExtracted=TRUE; + } else + td->tiles[i].bNotExtracted = TRUE; #endif - if(terraintype==0xa) - { + if (terraintype == 0xa) { #ifdef RA2_MODE - td->tiles[i].bHackedTerrainType=TERRAINTYPE_WATER; + td->tiles[i].bHackedTerrainType = TERRAINTYPE_WATER; #else - td->tiles[i].bHackedTerrainType=TERRAINTYPE_WATER; + td->tiles[i].bHackedTerrainType = TERRAINTYPE_WATER; #endif } - if(terraintype==TERRAINTYPE_ROUGH) td->tiles[i].bHackedTerrainType=TERRAINTYPE_GROUND; + if (terraintype == TERRAINTYPE_ROUGH) td->tiles[i].bHackedTerrainType = TERRAINTYPE_GROUND; //if((*tiledata)[dwID].wTileSet==waterset) (*tiledata)[dwID].tiles[i].bHackedTerrainType=TERRAINTYPE_WATER; // shore hack: check fsdata.ini for new shore terrain - if(td->wTileSet==shoreset) - { + if (td->wTileSet == shoreset) { int h; - for(h=0;h<(*tiledata_count);h++) - { - if((*tiledata)[h].wTileSet==shoreset) break; + for (h = 0; h < (*tiledata_count); h++) { + if ((*tiledata)[h].wTileSet == shoreset) break; } - int pos=dwID-h; + int pos = dwID - h; char c[50]; - itoa(pos,c,10); - CString hack=c; - hack+="_"; + itoa(pos, c, 10); + CString hack = c; + hack += "_"; itoa(i, c, 10); - hack+=c;/* + hack += c;/* hack+="_"; itoa(i/tileWidth, c, 10); hack+=c;*/ - CString section="ShoreTerrainTS"; + CString section = "ShoreTerrainTS"; #ifdef RA2_MODE - section="ShoreTerrainRA2"; + section = "ShoreTerrainRA2"; #endif auto const& sec = g_data.GetSection(section); auto const hackValIdx = sec.FindIndex(hack); @@ -3578,45 +3355,40 @@ BOOL CLoading::LoadTile(LPCSTR lpFilename, HMIXFILE hOwner, HTSPALETTE hPalette, int t = atoi(sec.Nth(hackValIdx).second); if (t) { td->tiles[i].bHackedTerrainType = TERRAINTYPE_WATER; - } - else { + } else { td->tiles[i].bHackedTerrainType = 0xe; } } } - if((*tiledata)[dwID].wTileSet==waterset) (*tiledata)[dwID].tiles[i].bHackedTerrainType=TERRAINTYPE_WATER; - } - else - { - td->tiles[i].pic=NULL; - td->tiles[i].sX=0; - td->tiles[i].sY=0; - td->tiles[i].wWidth=0; - td->tiles[i].wHeight=0; - td->tiles[i].bZHeight=0; - td->tiles[i].bTerrainType=0; - td->tiles[i].bDirection=0; - td->tiles[i].vborder=NULL; - + if ((*tiledata)[dwID].wTileSet == waterset) (*tiledata)[dwID].tiles[i].bHackedTerrainType = TERRAINTYPE_WATER; + } else { + td->tiles[i].pic = NULL; + td->tiles[i].sX = 0; + td->tiles[i].sY = 0; + td->tiles[i].wWidth = 0; + td->tiles[i].wHeight = 0; + td->tiles[i].bZHeight = 0; + td->tiles[i].bTerrainType = 0; + td->tiles[i].bDirection = 0; + td->tiles[i].vborder = NULL; + } } } - - if(tileCount>0) delete[] pics; + + if (tileCount > 0) delete[] pics; } - } - else - { + } else { errstream << lpFilename << " not found" << endl; return FALSE; } - - - - + + + + return TRUE; - + } #endif @@ -3624,74 +3396,66 @@ BOOL CLoading::LoadTile(LPCSTR lpFilename, HMIXFILE hOwner, HTSPALETTE hPalette, #ifdef NOSURFACES_OBJECTS // palettized void CLoading::LoadOverlayGraphic(const CString& lpOvrlName_, int iOvrlNum) { - last_succeeded_operation=11; + last_succeeded_operation = 11; CString image; // the image used CString filename; // filename of the image SHPHEADER head; - char theat=cur_theat; - BYTE** lpT=NULL; + char theat = cur_theat; + BYTE** lpT = NULL; char OvrlID[50]; itoa(iOvrlNum, OvrlID, 10); HTSPALETTE hPalette = m_hPalIsoTemp; - if(cur_theat=='T') - { - hPalette=m_hPalIsoTemp; - #ifdef RA2_MODE - hPalette=m_hPalIsoTemp; - #endif + if (cur_theat == 'T') { + hPalette = m_hPalIsoTemp; +#ifdef RA2_MODE + hPalette = m_hPalIsoTemp; +#endif } - if(cur_theat=='A') - { - hPalette=m_hPalIsoSnow; - #ifdef RA2_MODE - hPalette=m_hPalIsoSnow; - #endif + if (cur_theat == 'A') { + hPalette = m_hPalIsoSnow; +#ifdef RA2_MODE + hPalette = m_hPalIsoSnow; +#endif } - if(cur_theat=='U' && m_hPalIsoUrb) - { - hPalette=m_hPalIsoUrb; - #ifdef RA2_MODE - hPalette=m_hPalIsoUrb; - #endif + if (cur_theat == 'U' && m_hPalIsoUrb) { + hPalette = m_hPalIsoUrb; +#ifdef RA2_MODE + hPalette = m_hPalIsoUrb; +#endif } - if(cur_theat=='N' && m_hPalIsoUbn) - { - hPalette=m_hPalIsoUbn; - #ifdef RA2_MODE - hPalette=m_hPalIsoUbn; - #endif + if (cur_theat == 'N' && m_hPalIsoUbn) { + hPalette = m_hPalIsoUbn; +#ifdef RA2_MODE + hPalette = m_hPalIsoUbn; +#endif } - if(cur_theat=='L' && m_hPalIsoLun) - { - hPalette=m_hPalIsoLun; - #ifdef RA2_MODE - hPalette=m_hPalIsoLun; - #endif + if (cur_theat == 'L' && m_hPalIsoLun) { + hPalette = m_hPalIsoLun; +#ifdef RA2_MODE + hPalette = m_hPalIsoLun; +#endif } - if(cur_theat=='D' && m_hPalIsoDes) - { - hPalette=m_hPalIsoDes; - #ifdef RA2_MODE - hPalette=m_hPalIsoDes; - #endif + if (cur_theat == 'D' && m_hPalIsoDes) { + hPalette = m_hPalIsoDes; +#ifdef RA2_MODE + hPalette = m_hPalIsoDes; +#endif } HTSPALETTE forcedPalette = 0; const auto& isoPalettePrefixes = g_data["ForceOvrlIsoPalettePrefix"]; const auto& unitPalettePrefixes = g_data["ForceOvrlUnitPalettePrefix"]; const CString sOvrlName(lpOvrlName_); - if (unitPalettePrefixes.end() != std::find_if(unitPalettePrefixes.begin(), unitPalettePrefixes.end(), [&sOvrlName](const auto& pair) {return sOvrlName.Find(pair.second) == 0;})) - { + if (unitPalettePrefixes.end() != std::find_if(unitPalettePrefixes.begin(), unitPalettePrefixes.end(), [&sOvrlName](const auto& pair) {return sOvrlName.Find(pair.second) == 0; })) { forcedPalette = GetUnitPalette(cur_theat); - } - if (isoPalettePrefixes.end() != std::find_if(isoPalettePrefixes.begin(), isoPalettePrefixes.end(), [&sOvrlName](const auto& pair) {return sOvrlName.Find(pair.second) == 0;})) - { + } + if (isoPalettePrefixes.end() != std::find_if(isoPalettePrefixes.begin(), isoPalettePrefixes.end(), [&sOvrlName](const auto& pair) {return sOvrlName.Find(pair.second) == 0; })) { forcedPalette = GetIsoPalette(cur_theat); } - + HMIXFILE hMix; CString lpOvrlName = lpOvrlName_; @@ -3704,12 +3468,12 @@ void CLoading::LoadOverlayGraphic(const CString& lpOvrlName_, int iOvrlNum) auto const isveinhole = rules.GetBool(lpOvrlName, "IsVeinholeMonster"); auto const istiberium = rules.GetBool(lpOvrlName, "Tiberium"); auto const isveins = rules.GetBool(lpOvrlName, "IsVeins"); - + image = rules.GetStringOr(lpOvrlName, "Image", lpOvrlName); TruncSpace(image); - CString imagerules=image; + CString imagerules = image; auto const& imageID = art.GetString(image, "Image"); if (!imageID.IsEmpty()) { image = imageID; @@ -3732,193 +3496,171 @@ void CLoading::LoadOverlayGraphic(const CString& lpOvrlName_, int iOvrlNum) } - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); const auto& artSection = art[image]; - + if (hMix == NULL) { - filename=image+".shp"; + filename = image + ".shp"; if (artSection.GetBool("NewTheater")) { filename.SetAt(1, theat); } - if(cur_theat=='U' && m_hPalUnitUrb) hPalette=m_hPalUnitUrb; - if(cur_theat=='T') hPalette=m_hPalUnitTemp; - if(cur_theat=='A') hPalette=m_hPalUnitSnow; - if(cur_theat=='N') hPalette=m_hPalUnitUbn; - if(cur_theat=='L') hPalette=m_hPalUnitLun; - if(cur_theat=='D') hPalette=m_hPalUnitDes; + if (cur_theat == 'U' && m_hPalUnitUrb) hPalette = m_hPalUnitUrb; + if (cur_theat == 'T') hPalette = m_hPalUnitTemp; + if (cur_theat == 'A') hPalette = m_hPalUnitSnow; + if (cur_theat == 'N') hPalette = m_hPalUnitUbn; + if (cur_theat == 'L') hPalette = m_hPalUnitLun; + if (cur_theat == 'D') hPalette = m_hPalUnitDes; - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); //errstream << (LPCSTR)filename << " " << endl; //errstream.flush(); - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'T'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'A'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'U'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'N'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'L'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'D'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(cur_theat=='T' || cur_theat=='U') - { - hPalette=m_hPalUnitTemp; - } - else - hPalette=m_hPalUnitSnow; + if (cur_theat == 'T' || cur_theat == 'U') { + hPalette = m_hPalUnitTemp; + } else + hPalette = m_hPalUnitSnow; } - - if(hMix==NULL) - { - filename=image+".tem"; - hMix=FindFileInMix(filename); - if(hMix) hPalette=m_hPalIsoTemp; + + if (hMix == NULL) { + filename = image + ".tem"; + hMix = FindFileInMix(filename); + if (hMix) hPalette = m_hPalIsoTemp; } - if(hMix==NULL) - { - filename=image+".sno"; - hMix=FindFileInMix(filename); - if(hMix) hPalette=m_hPalIsoSnow; + if (hMix == NULL) { + filename = image + ".sno"; + hMix = FindFileInMix(filename); + if (hMix) hPalette = m_hPalIsoSnow; } - if(hMix==NULL) - { - filename=image+".urb"; - hMix=FindFileInMix(filename); - if(hMix && m_hPalIsoUrb) hPalette=m_hPalIsoUrb; + if (hMix == NULL) { + filename = image + ".urb"; + hMix = FindFileInMix(filename); + if (hMix && m_hPalIsoUrb) hPalette = m_hPalIsoUrb; } - if(hMix==NULL) - { - filename=image+".ubn"; - hMix=FindFileInMix(filename); - if(hMix && m_hPalIsoUbn) hPalette=m_hPalIsoUbn; + if (hMix == NULL) { + filename = image + ".ubn"; + hMix = FindFileInMix(filename); + if (hMix && m_hPalIsoUbn) hPalette = m_hPalIsoUbn; } - if(hMix==NULL) - { - filename=image+".lun"; - hMix=FindFileInMix(filename); - if(hMix && m_hPalIsoLun) hPalette=m_hPalIsoLun; + if (hMix == NULL) { + filename = image + ".lun"; + hMix = FindFileInMix(filename); + if (hMix && m_hPalIsoLun) hPalette = m_hPalIsoLun; } - if(hMix==NULL) - { - filename=image+".des"; - hMix=FindFileInMix(filename); - if(hMix && m_hPalIsoDes) hPalette=m_hPalIsoDes; + if (hMix == NULL) { + filename = image + ".des"; + hMix = FindFileInMix(filename); + if (hMix && m_hPalIsoDes) hPalette = m_hPalIsoDes; } - if(isveinhole==TRUE || isveins==TRUE || istiberium==TRUE) - { - hPalette=m_hPalTemp; + if (isveinhole == TRUE || isveins == TRUE || istiberium == TRUE) { + hPalette = m_hPalTemp; #ifndef RA2_MODE - hPalette=m_hPalUnitTemp; + hPalette = m_hPalUnitTemp; #endif } hPalette = forcedPalette ? forcedPalette : hPalette; - if(hMix!=NULL) - { + if (hMix != NULL) { - errstream << "Overlay: " << (LPCSTR) filename << endl; + errstream << "Overlay: " << (LPCSTR)filename << endl; errstream.flush(); - + FSunPackLib::SetCurrentSHP(filename, hMix); { - + FSunPackLib::XCC_GetSHPHeader(&head); int i; - int maxPics=head.c_images; - if(maxPics>max_ovrl_img) maxPics=max_ovrl_img; + int maxPics = head.c_images; + if (maxPics > max_ovrl_img) maxPics = max_ovrl_img; + - // create an array of pointers to directdraw surfaces - lpT=new(BYTE*[maxPics]); - memset(lpT, 0, sizeof(BYTE)*maxPics); + lpT = new(BYTE * [maxPics]); + memset(lpT, 0, sizeof(BYTE) * maxPics); // if tiberium, change color - BOOL bIsBlueTib=FALSE; - BOOL bIsGreenTib=FALSE; + BOOL bIsBlueTib = FALSE; + BOOL bIsGreenTib = FALSE; RGBTRIPLE rgbOld[16], rgbNew; - #ifndef RA2_MODE - if(istiberium) - { - if(lpOvrlName[4]=='_') // other than green! - bIsBlueTib=TRUE; +#ifndef RA2_MODE + if (istiberium) { + if (lpOvrlName[4] == '_') // other than green! + bIsBlueTib = TRUE; else - bIsGreenTib=TRUE; + bIsGreenTib = TRUE; + - int i; - for(i=0;i<16;i++) - { - if(bIsGreenTib) - { - rgbNew.rgbtBlue=0; - if(i!=0) - rgbNew.rgbtGreen=255-i*16+1; + for (i = 0; i < 16; i++) { + if (bIsGreenTib) { + rgbNew.rgbtBlue = 0; + if (i != 0) + rgbNew.rgbtGreen = 255 - i * 16 + 1; else - rgbNew.rgbtGreen=255; - rgbNew.rgbtRed=0; - } - else if(bIsBlueTib) - { - if(i!=0) - rgbNew.rgbtBlue=255-i*16+1; + rgbNew.rgbtGreen = 255; + rgbNew.rgbtRed = 0; + } else if (bIsBlueTib) { + if (i != 0) + rgbNew.rgbtBlue = 255 - i * 16 + 1; else - rgbNew.rgbtBlue=255; - rgbNew.rgbtGreen=0; - rgbNew.rgbtRed=0; // change green/blue (not RGB but BGR) + rgbNew.rgbtBlue = 255; + rgbNew.rgbtGreen = 0; + rgbNew.rgbtRed = 0; // change green/blue (not RGB but BGR) } - int rb=rgbNew.rgbtBlue; - int rr=rgbNew.rgbtRed; + int rb = rgbNew.rgbtBlue; + int rr = rgbNew.rgbtRed; - FSunPackLib::SetTSPaletteEntry(hPalette, 0x10+i, &rgbNew, &rgbOld[i]); + FSunPackLib::SetTSPaletteEntry(hPalette, 0x10 + i, &rgbNew, &rgbOld[i]); } } - #endif +#endif FSunPackLib::LoadSHPImage(0, maxPics, lpT); - #ifndef RA2_MODE - if(istiberium) - for(i=0;i<16;i++) - FSunPackLib::SetTSPaletteEntry(hPalette, 0x10+i, &rgbOld[i], NULL); - #endif +#ifndef RA2_MODE + if (istiberium) + for (i = 0; i < 16; i++) + FSunPackLib::SetTSPaletteEntry(hPalette, 0x10 + i, &rgbOld[i], NULL); +#endif - for(i=0; im_view.m_isoview; + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; CString lpOvrlName = lpOvrlName_; if (lpOvrlName.Find(' ') >= 0) lpOvrlName = lpOvrlName.Left(lpOvrlName.Find(' ')); - CString isveinhole_t=rules.sections[lpOvrlName].values["IsVeinholeMonster"]; - CString istiberium_t=rules.sections[lpOvrlName].values["Tiberium"]; - CString isveins_t=rules.sections[lpOvrlName].values["IsVeins"]; + CString isveinhole_t = rules.sections[lpOvrlName].values["IsVeinholeMonster"]; + CString istiberium_t = rules.sections[lpOvrlName].values["Tiberium"]; + CString isveins_t = rules.sections[lpOvrlName].values["IsVeins"]; isveinhole_t.MakeLower(); istiberium_t.MakeLower(); isveins_t.MakeLower(); - BOOL isveinhole=FALSE, istiberium=FALSE, isveins=FALSE; - if(isTrue(isveinhole_t)) isveinhole=TRUE; - if(isTrue(istiberium_t)) istiberium=TRUE; - if(isTrue(isveins_t)) isveins=TRUE; + BOOL isveinhole = FALSE, istiberium = FALSE, isveins = FALSE; + if (isTrue(isveinhole_t)) isveinhole = TRUE; + if (isTrue(istiberium_t)) istiberium = TRUE; + if (isTrue(isveins_t)) isveins = TRUE; - - image=lpOvrlName; - if(rules.sections[lpOvrlName].values.find("Image")!=rules.sections[lpOvrlName].values.end()) - image=rules.sections[lpOvrlName].values["Image"]; + + image = lpOvrlName; + if (rules.sections[lpOvrlName].values.find("Image") != rules.sections[lpOvrlName].values.end()) + image = rules.sections[lpOvrlName].values["Image"]; TruncSpace(image); - CString imagerules=image; - if(art.sections[image].values.find("Image")!=art.sections[image].values.end()) - image=art.sections[image].values["Image"]; + CString imagerules = image; + if (art.sections[image].values.find("Image") != art.sections[image].values.end()) + image = art.sections[image].values["Image"]; TruncSpace(image); - if(cur_theat=='T') filename=image+".tem"; - if(cur_theat=='A') filename=image+".sno"; - if(cur_theat=='U') filename=image+".urb"; + if (cur_theat == 'T') filename = image + ".tem"; + if (cur_theat == 'A') filename = image + ".sno"; + if (cur_theat == 'U') filename = image + ".urb"; - hMix=FindFileInMix(filename); - - - if(hMix==NULL) - { - filename=image+".shp"; - if(isTrue(art.sections[image].values["NewTheater"])) + hMix = FindFileInMix(filename); + + + if (hMix == NULL) { + filename = image + ".shp"; + if (isTrue(art.sections[image].values["NewTheater"])) filename.SetAt(1, theat); - if(cur_theat=='U' && m_hPalUnitUrb) hPalette=m_hPalUnitUrb; - if(cur_theat=='T') hPalette=m_hPalUnitTemp; - if(cur_theat=='A') hPalette=m_hPalUnitSnow; + if (cur_theat == 'U' && m_hPalUnitUrb) hPalette = m_hPalUnitUrb; + if (cur_theat == 'T') hPalette = m_hPalUnitTemp; + if (cur_theat == 'A') hPalette = m_hPalUnitSnow; - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); // errstream << (LPCSTR)filename << " " << hMix; - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'T'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'A'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(hMix==NULL) - { + if (hMix == NULL) { filename.SetAt(1, 'U'); - hMix=FindFileInMix(filename); + hMix = FindFileInMix(filename); } - if(cur_theat=='T' || cur_theat=='U') - { - hPalette=m_hPalUnitTemp; - } - else - hPalette=m_hPalUnitSnow; + if (cur_theat == 'T' || cur_theat == 'U') { + hPalette = m_hPalUnitTemp; + } else + hPalette = m_hPalUnitSnow; } - - if(hMix==NULL) - { - filename=image+".tem"; - hMix=FindFileInMix(filename); - if(hMix) hPalette=m_hPalIsoTemp; + + if (hMix == NULL) { + filename = image + ".tem"; + hMix = FindFileInMix(filename); + if (hMix) hPalette = m_hPalIsoTemp; } - if(hMix==NULL) - { - filename=image+".sno"; - hMix=FindFileInMix(filename); - if(hMix) hPalette=m_hPalIsoSnow; + if (hMix == NULL) { + filename = image + ".sno"; + hMix = FindFileInMix(filename); + if (hMix) hPalette = m_hPalIsoSnow; } - if(hMix==NULL) - { - filename=image+".urb"; - hMix=FindFileInMix(filename); - if(hMix && m_hPalIsoUrb) hPalette=m_hPalIsoUrb; + if (hMix == NULL) { + filename = image + ".urb"; + hMix = FindFileInMix(filename); + if (hMix && m_hPalIsoUrb) hPalette = m_hPalIsoUrb; } - if(isveinhole==TRUE || isveins==TRUE || istiberium==TRUE) - { - hPalette=m_hPalTemp; + if (isveinhole == TRUE || isveins == TRUE || istiberium == TRUE) { + hPalette = m_hPalTemp; #ifndef RA2_MODE - hPalette=m_hPalUnitTemp; + hPalette = m_hPalUnitTemp; #endif } - if(hMix!=NULL) - { - + if (hMix != NULL) { + FSunPackLib::SetCurrentSHP(filename, hMix); { - + FSunPackLib::XCC_GetSHPHeader(&head); int i; - int maxPics=head.c_images; - if(maxPics>max_ovrl_img) maxPics=max_ovrl_img; // max may_ovrl_img pictures (memory usage!) + int maxPics = head.c_images; + if (maxPics > max_ovrl_img) maxPics = max_ovrl_img; // max may_ovrl_img pictures (memory usage!) //errstream << ", loading " << maxPics << " of " << head.c_images << " pictures. "; //errstream.flush(); - + // create an array of pointers to directdraw surfaces - lpT=new(LPDIRECTDRAWSURFACE4[maxPics]); - memset(lpT, 0, sizeof(LPDIRECTDRAWSURFACE4)*maxPics); + lpT = new(LPDIRECTDRAWSURFACE4[maxPics]); + memset(lpT, 0, sizeof(LPDIRECTDRAWSURFACE4) * maxPics); // if tiberium, change color - BOOL bIsBlueTib=FALSE; - BOOL bIsGreenTib=FALSE; + BOOL bIsBlueTib = FALSE; + BOOL bIsGreenTib = FALSE; RGBTRIPLE rgbOld[16], rgbNew; - #ifndef RA2_MODE - if(istiberium) - { - if(lpOvrlName[4]=='_') // other than green! - bIsBlueTib=TRUE; +#ifndef RA2_MODE + if (istiberium) { + if (lpOvrlName[4] == '_') // other than green! + bIsBlueTib = TRUE; else - bIsGreenTib=TRUE; + bIsGreenTib = TRUE; + - int i; - for(i=0;i<16;i++) - { - if(bIsGreenTib) - { - rgbNew.rgbtBlue=0; - if(i!=0) - rgbNew.rgbtGreen=255-i*16+1; + for (i = 0; i < 16; i++) { + if (bIsGreenTib) { + rgbNew.rgbtBlue = 0; + if (i != 0) + rgbNew.rgbtGreen = 255 - i * 16 + 1; else - rgbNew.rgbtGreen=255; - rgbNew.rgbtRed=0; - } - else if(bIsBlueTib) - { - if(i!=0) - rgbNew.rgbtBlue=255-i*16+1; + rgbNew.rgbtGreen = 255; + rgbNew.rgbtRed = 0; + } else if (bIsBlueTib) { + if (i != 0) + rgbNew.rgbtBlue = 255 - i * 16 + 1; else - rgbNew.rgbtBlue=255; - rgbNew.rgbtGreen=0; - rgbNew.rgbtRed=0; + rgbNew.rgbtBlue = 255; + rgbNew.rgbtGreen = 0; + rgbNew.rgbtRed = 0; } - FSunPackLib::SetTSPaletteEntry(hPalette, 0x10+i, &rgbNew, &rgbOld[i]); + FSunPackLib::SetTSPaletteEntry(hPalette, 0x10 + i, &rgbNew, &rgbOld[i]); } } - #endif +#endif FSunPackLib::LoadSHPImageInSurface(v.dd, hPalette, 0, maxPics, lpT); - #ifndef RA2_MODE - if(istiberium) - for(i=0;i<16;i++) - FSunPackLib::SetTSPaletteEntry(hPalette, 0x10+i, &rgbOld[i], NULL); - #endif +#ifndef RA2_MODE + if (istiberium) + for (i = 0; i < 16; i++) + FSunPackLib::SetTSPaletteEntry(hPalette, 0x10 + i, &rgbOld[i], NULL); +#endif - for(i=0; iRelease(); - - if(imghead.unknown && lpT[i]) - { + + if (imghead.unknown == 0) // is it a shadow or not used image? + if (lpT[i]) lpT[i]->Release(); + + if (imghead.unknown && lpT[i]) { char ic[50]; itoa(i, ic, 10); PICDATA p; - p.pic=lpT[i]; - p.x=imghead.x; - p.y=imghead.y; + p.pic = lpT[i]; + p.x = imghead.x; + p.y = imghead.y; - p.wHeight=imghead.cy; - p.wWidth=imghead.cx; - p.wMaxWidth=head.cx; - p.wMaxHeight=head.cy; - p.bType=PICDATA_TYPE_SHP; - + p.wHeight = imghead.cy; + p.wWidth = imghead.cx; + p.wMaxWidth = head.cx; + p.wMaxHeight = head.cy; + p.bType = PICDATA_TYPE_SHP; - pics[(CString)"OVRL"+ OvrlID + "_" + ic]=p; + + pics[(CString)"OVRL" + OvrlID + "_" + ic] = p; } } - + delete[] lpT; //errstream << " --> Finished" << endl; //errstream.flush(); - } + } /*else { errstream << " failed"; @@ -4237,39 +3956,34 @@ void CLoading::LoadOverlayGraphic(LPCTSTR lpOvrlName_, int iOvrlNum) }*/ } - else - { + else { //errstream << "File not found: " << (LPCTSTR)filename << endl; //errstream.flush(); - } + } int i; - for(i=0; i<0xFF; i++) - { + for (i = 0; i < 0xFF; i++) { char ic[50]; itoa(i, ic, 10); - pics[(CString)"OVRL"+ OvrlID + "_" + ic].bTried=TRUE; + pics[(CString)"OVRL" + OvrlID + "_" + ic].bTried = TRUE; } - + } #endif -void CLoading::OnDestroy() +void CLoading::OnDestroy() { CDialog::OnDestroy(); } void CLoading::InitVoxelNormalTables() { - try - { + try { std::ifstream f(std::string(AppPath) + "\\voxel_normal_tables.bin", std::ios::binary); m_voxelNormalTables.reset(new VoxelNormalTables(f)); - } - catch (const std::runtime_error& e) - { + } catch (const std::runtime_error& e) { errstream << e.what() << std::endl; m_voxelNormalTables.reset(new VoxelNormalTables()); } @@ -4277,97 +3991,94 @@ void CLoading::InitVoxelNormalTables() void CLoading::CalcPicCount() { - m_pic_count=0; + m_pic_count = 0; - CString bmps=(CString)AppPath+"\\pics\\*.bmp"; - if(!theApp.m_Options.bDoNotLoadBMPs) - { + CString bmps = (CString)AppPath + "\\pics\\*.bmp"; + if (!theApp.m_Options.bDoNotLoadBMPs) { CFileFind ff; - if(ff.FindFile(bmps)) - { + if (ff.FindFile(bmps)) { // found bmp m_pic_count++; - while(ff.FindNextFile()) m_pic_count++; + while (ff.FindNextFile()) m_pic_count++; } } - m_bmp_count=m_pic_count; + m_bmp_count = m_pic_count; - if(!theApp.m_Options.bDoNotLoadVehicleGraphics) m_pic_count+=rules["VehicleTypes"].Size(); - if(!theApp.m_Options.bDoNotLoadOverlayGraphics) m_pic_count+=rules["OverlayTypes"].Size(); - if(!theApp.m_Options.bDoNotLoadInfantryGraphics) m_pic_count+=rules["InfantryTypes"].Size(); - if(!theApp.m_Options.bDoNotLoadBuildingGraphics) m_pic_count+=rules["BuildingTypes"].Size(); - if(!theApp.m_Options.bDoNotLoadAircraftGraphics) m_pic_count+=rules["AircraftTypes"].Size(); - if(!theApp.m_Options.bDoNotLoadTreeGraphics) m_pic_count+=rules["TerrainTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadVehicleGraphics) m_pic_count += rules["VehicleTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadOverlayGraphics) m_pic_count += rules["OverlayTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadInfantryGraphics) m_pic_count += rules["InfantryTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadBuildingGraphics) m_pic_count += rules["BuildingTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadAircraftGraphics) m_pic_count += rules["AircraftTypes"].Size(); + if (!theApp.m_Options.bDoNotLoadTreeGraphics) m_pic_count += rules["TerrainTypes"].Size(); int i; -/* - if(!theApp.m_Options.bDoNotLoadSnowGraphics) - { - tiledata=&s_tiledata; - tiles=&tiles_s; - tiledata_count=&s_tiledata_count; - for(i=0;i<10000;i++) + /* + if(!theApp.m_Options.bDoNotLoadSnowGraphics) { - CString tset; - char c[50]; - itoa(i, c, 10); - int e; - for(e=0;e<4-strlen(c);e++) - tset+="0"; - tset+=c; - CString sec="TileSet"; - sec+=tset; - - if(tiles->sections.find(sec)==tiles->sections.end()) break; - - for(e=0;esections[sec].values["TilesInSet"]);e++) + tiledata=&s_tiledata; + tiles=&tiles_s; + tiledata_count=&s_tiledata_count; + for(i=0;i<10000;i++) { - m_pic_count++; - } - - } - } + CString tset; + char c[50]; + itoa(i, c, 10); + int e; + for(e=0;e<4-strlen(c);e++) + tset+="0"; + tset+=c; + CString sec="TileSet"; + sec+=tset; - if(!theApp.m_Options.bDoNotLoadTemperateGraphics) - { - tiledata=&t_tiledata; - tiles=&tiles_t; - tiledata_count=&t_tiledata_count; - for(i=0;i<10000;i++) + if(tiles->sections.find(sec)==tiles->sections.end()) break; + + for(e=0;esections[sec].values["TilesInSet"]);e++) + { + m_pic_count++; + } + + } + } + + if(!theApp.m_Options.bDoNotLoadTemperateGraphics) { - CString tset; - char c[50]; - itoa(i, c, 10); - int e; - for(e=0;e<4-strlen(c);e++) - tset+="0"; - tset+=c; - CString sec="TileSet"; - sec+=tset; - - if(tiles->sections.find(sec)==tiles->sections.end()) break; - - for(e=0;esections[sec].values["TilesInSet"]);e++) + tiledata=&t_tiledata; + tiles=&tiles_t; + tiledata_count=&t_tiledata_count; + for(i=0;i<10000;i++) { - m_pic_count++; + CString tset; + char c[50]; + itoa(i, c, 10); + int e; + for(e=0;e<4-strlen(c);e++) + tset+="0"; + tset+=c; + CString sec="TileSet"; + sec+=tset; + + if(tiles->sections.find(sec)==tiles->sections.end()) break; + + for(e=0;esections[sec].values["TilesInSet"]);e++) + { + m_pic_count++; + } + } - - } - }*/ + }*/ } BOOL CLoading::InitDirectDraw() { - last_succeeded_operation=7; + last_succeeded_operation = 7; errstream << "\n\nDirectDrawCreate() will be called now\n"; errstream.flush(); - - CIsoView& v=*((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; - if(DirectDrawCreate(NULL, &v.dd_1, NULL)!=DD_OK) - { + + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; + if (DirectDrawCreate(NULL, &v.dd_1, NULL) != DD_OK) { errstream << "DirectDrawCreate() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); @@ -4375,19 +4086,18 @@ BOOL CLoading::InitDirectDraw() exit(-1); return FALSE; - } + } errstream << "DirectDrawCreate() successful\n\n"; errstream.flush(); - if(m_progress.m_hWnd) m_progress.SetPos(1); - if(m_hWnd) UpdateWindow(); + if (m_progress.m_hWnd) m_progress.SetPos(1); + if (m_hWnd) UpdateWindow(); errstream << "Now querying the DirectX 7 or 6 interface\n"; errstream.flush(); - if(v.dd_1->QueryInterface(IID_IDirectDraw7, (void**)&v.dd)!=DD_OK) - { + if (v.dd_1->QueryInterface(IID_IDirectDraw7, (void**)&v.dd) != DD_OK) { errstream << "QueryInterface() failed -> Using DirectX 6.0\n"; errstream.flush(); //ShowWindow(SW_HIDE); @@ -4396,8 +4106,7 @@ BOOL CLoading::InitDirectDraw() //return FALSE; - if(v.dd_1->QueryInterface(IID_IDirectDraw4, (void**)&v.dd)!=DD_OK) - { + if (v.dd_1->QueryInterface(IID_IDirectDraw4, (void**)&v.dd) != DD_OK) { MessageBox("You need at least DirectX 6.0 to run this program", "Error"); exit(-1); return FALSE; @@ -4406,15 +4115,14 @@ BOOL CLoading::InitDirectDraw() errstream << "QueryInterface() successful\n\nNow setting cooperative level\n"; errstream.flush(); - - if(v.dd->SetCooperativeLevel(v.m_hWnd, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES )!=DD_OK) - { + + if (v.dd->SetCooperativeLevel(v.m_hWnd, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES) != DD_OK) { errstream << "SetCooperativeLevel() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); MessageBox("Cooperative Level could not be set! Quitting..."); v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-2); return FALSE; @@ -4424,71 +4132,67 @@ BOOL CLoading::InitDirectDraw() errstream.flush(); - if(m_progress.m_hWnd) m_progress.SetPos(2); - if(m_hWnd) UpdateWindow(); - + if (m_progress.m_hWnd) m_progress.SetPos(2); + if (m_hWnd) UpdateWindow(); + DDSURFACEDESC2 ddsd; memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE ; - ddsd.dwFlags=DDSD_CAPS ; + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + ddsd.dwFlags = DDSD_CAPS; - - int res=0; - int trycount=0; - do - { - res=v.dd->CreateSurface(&ddsd, &v.lpds, NULL); + + int res = 0; + int trycount = 0; + do { + res = v.dd->CreateSurface(&ddsd, &v.lpds, NULL); errstream << "Return code: " << res << endl; errstream.flush(); //if(res!=DD_OK && (res!=DDERR_PRIMARYSURFACEALREADYEXISTS || trycount>100)) - if(res!=DD_OK && trycount>=300) - { - + if (res != DD_OK && trycount >= 300) { + errstream << "CreateSurface() failed\n"; - + errstream.flush(); ShowWindow(SW_HIDE); MessageBox("Primary surface could not be initialized! Quitting..."); v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-3); return FALSE; } trycount++; - if(res!=DD_OK) - { + if (res != DD_OK) { Sleep(50); } - - }while(res!=DD_OK); + + } while (res != DD_OK); #ifdef NOSURFACES DDPIXELFORMAT pf; memset(&pf, 0, sizeof(DDPIXELFORMAT)); - pf.dwSize=sizeof(DDPIXELFORMAT); + pf.dwSize = sizeof(DDPIXELFORMAT); v.lpds->GetPixelFormat(&pf); - if(!pf.dwBBitMask || !pf.dwRBitMask || !pf.dwGBitMask) - { + if (!pf.dwBBitMask || !pf.dwRBitMask || !pf.dwGBitMask) { ShowWindow(SW_HIDE); - MessageBox("You must not use a palette color mode like 8 bit in order to run FinalSun/FinalAlert 2. Please check readme.txt","Error",MB_OK); + MessageBox("You must not use a palette color mode like 8 bit in order to run FinalSun/FinalAlert 2. Please check readme.txt", "Error", MB_OK); v.lpds->Release(); - v.lpds=NULL; + v.lpds = NULL; v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-3); return FALSE; } - bpp=(pf.dwRGBBitCount+7)/8; + bpp = (pf.dwRGBBitCount + 7) / 8; #endif @@ -4496,31 +4200,29 @@ BOOL CLoading::InitDirectDraw() errstream.flush(); memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); - ddsd.dwSize=sizeof(DDSURFACEDESC2); - ddsd.dwFlags=DDSD_WIDTH | DDSD_HEIGHT; + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT; v.lpds->GetSurfaceDesc(&ddsd); - ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwFlags=DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - - if(v.dd->CreateSurface(&ddsd, &v.lpdsBack, NULL)!=DD_OK) - { + + if (v.dd->CreateSurface(&ddsd, &v.lpdsBack, NULL) != DD_OK) { errstream << "CreateSurface() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); MessageBox("Backbuffer surface could not be initialized! Quitting..."); v.lpds->Release(); - v.lpds=NULL; + v.lpds = NULL; v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-4); return FALSE; } - if (theApp.m_Options.bHighResUI && v.dd->CreateSurface(&ddsd, &v.lpdsBackHighRes, NULL) != DD_OK) - { + if (theApp.m_Options.bHighResUI && v.dd->CreateSurface(&ddsd, &v.lpdsBackHighRes, NULL) != DD_OK) { errstream << "CreateSurface() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); @@ -4535,21 +4237,20 @@ BOOL CLoading::InitDirectDraw() return FALSE; } - if(v.dd->CreateSurface(&ddsd, &v.lpdsTemp, NULL)!=DD_OK) - { + if (v.dd->CreateSurface(&ddsd, &v.lpdsTemp, NULL) != DD_OK) { errstream << "CreateSurface() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); MessageBox("Tempbuffer surface could not be initialized! Quitting..."); v.lpdsBack->Release(); - v.lpdsBack=NULL; + v.lpdsBack = NULL; if (v.lpdsBackHighRes) v.lpdsBackHighRes->Release(); v.lpdsBackHighRes = nullptr; v.lpds->Release(); - v.lpds=NULL; + v.lpds = NULL; v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-4); return FALSE; @@ -4559,23 +4260,22 @@ BOOL CLoading::InitDirectDraw() errstream.flush(); LPDIRECTDRAWCLIPPER ddc; - if(v.dd->CreateClipper(0, &ddc, NULL)!=DD_OK) - { + if (v.dd->CreateClipper(0, &ddc, NULL) != DD_OK) { errstream << "CreateClipper() failed\n"; errstream.flush(); ShowWindow(SW_HIDE); MessageBox("Clipper could not be created! Quitting..."); v.lpdsTemp->Release(); - v.lpdsTemp=NULL; + v.lpdsTemp = NULL; v.lpdsBack->Release(); - v.lpdsBack=NULL; + v.lpdsBack = NULL; if (v.lpdsBackHighRes) v.lpdsBackHighRes->Release(); v.lpdsBackHighRes = nullptr; v.lpds->Release(); - v.lpds=NULL; + v.lpds = NULL; v.dd->Release(); - v.dd=NULL; + v.dd = NULL; exit(-6); } @@ -4583,21 +4283,21 @@ BOOL CLoading::InitDirectDraw() errstream.flush(); v.lpds->SetClipper(ddc); - + ddc->SetHWnd(0, v.m_hWnd); return TRUE; } -void CLoading::OnPaint() +void CLoading::OnPaint() { CPaintDC dc(this); // device context for painting - CWnd* poswindow=GetDlgItem(IDC_SAVEOFTEN); + CWnd* poswindow = GetDlgItem(IDC_SAVEOFTEN); - if(!poswindow) return; + if (!poswindow) return; - RECT r1,r2; + RECT r1, r2; poswindow->GetWindowRect(&r1); GetWindowRect(&r2); @@ -4605,10 +4305,10 @@ void CLoading::OnPaint() dc.SetBkMode(TRANSPARENT); RECT dest; - dest.top=r1.bottom-r2.top-45; - dest.bottom=r1.bottom-r2.top+10; - dest.left=10; - dest.right=r1.right-r1.left+10; + dest.top = r1.bottom - r2.top - 45; + dest.bottom = r1.bottom - r2.top + 10; + dest.left = 10; + dest.right = r1.right - r1.left + 10; CFont f; f.CreatePointFont(90, "Tahoma"); @@ -4621,93 +4321,89 @@ void CLoading::FreeTileSet() // free the current tileset int i; - for(i=0;i<(*tiledata_count);i++) - { + for (i = 0; i < (*tiledata_count); i++) { int e; int z; - + // delete replacements. Replacements themself MUST NOT have replacements - for(z=0;z<(*tiledata)[i].bReplacementCount;z++) - { - TILEDATA& rept=(*tiledata)[i].lpReplacements[z]; - - for(e=0;eRelease(); + LPDIRECTDRAWSURFACE4 curSur = rept.tiles[e].pic; + if (curSur) curSur->Release(); #endif } - + delete[] rept.tiles; - rept.tiles=NULL; - rept.wTileCount=0; - rept.bReplacementCount=0; + rept.tiles = NULL; + rept.wTileCount = 0; + rept.bReplacementCount = 0; ASSERT(!rept.lpReplacements); // make sure we don´t have replacements for this replacement } - for(e=0;e<(*tiledata)[i].wTileCount;e++) - { + for (e = 0; e < (*tiledata)[i].wTileCount; e++) { #ifdef NOSURFACES - BYTE* curSur=(*tiledata)[i].tiles[e].pic; - if(curSur) delete[] curSur; - if((*tiledata)[i].tiles[e].vborder) delete[] (*tiledata)[i].tiles[e].vborder; + BYTE* curSur = (*tiledata)[i].tiles[e].pic; + if (curSur) delete[] curSur; + if ((*tiledata)[i].tiles[e].vborder) delete[](*tiledata)[i].tiles[e].vborder; #else - LPDIRECTDRAWSURFACE4 curSur=(*tiledata)[i].tiles[e].pic; - if(curSur) curSur->Release(); + LPDIRECTDRAWSURFACE4 curSur = (*tiledata)[i].tiles[e].pic; + if (curSur) curSur->Release(); #endif } - delete[] ((*tiledata)[i].tiles); - (*tiledata)[i].tiles=NULL; - (*tiledata)[i].wTileCount=0; - (*tiledata)[i].bReplacementCount=0; - if((*tiledata)[i].lpReplacements) delete[] (*tiledata)[i].lpReplacements; - (*tiledata)[i].lpReplacements=NULL; + delete[]((*tiledata)[i].tiles); + (*tiledata)[i].tiles = NULL; + (*tiledata)[i].wTileCount = 0; + (*tiledata)[i].bReplacementCount = 0; + if ((*tiledata)[i].lpReplacements) delete[](*tiledata)[i].lpReplacements; + (*tiledata)[i].lpReplacements = NULL; } - if(*tiledata) delete[] (*tiledata); - (*tiledata)=NULL; - (*tiledata_count)=0; + if (*tiledata) delete[](*tiledata); + (*tiledata) = NULL; + (*tiledata_count) = 0; } void CLoading::FreeAll() { - last_succeeded_operation=14; + last_succeeded_operation = 14; // MW fix: We need to set tiledata and tiledata_count to the old pointers again - int t=0; - if(tiledata==&t_tiledata) t=0; - if(tiledata==&s_tiledata) t=1; - if(tiledata==&u_tiledata) t=2; - if(tiledata==&un_tiledata) t=3; - if(tiledata==&l_tiledata) t=4; - if(tiledata==&d_tiledata) t=4; + int t = 0; + if (tiledata == &t_tiledata) t = 0; + if (tiledata == &s_tiledata) t = 1; + if (tiledata == &u_tiledata) t = 2; + if (tiledata == &un_tiledata) t = 3; + if (tiledata == &l_tiledata) t = 4; + if (tiledata == &d_tiledata) t = 4; //try{ - tiledata=&t_tiledata; - tiledata_count=&t_tiledata_count; + tiledata = &t_tiledata; + tiledata_count = &t_tiledata_count; FreeTileSet(); - tiledata=&s_tiledata; - tiledata_count=&s_tiledata_count; + tiledata = &s_tiledata; + tiledata_count = &s_tiledata_count; FreeTileSet(); - tiledata=&u_tiledata; - tiledata_count=&u_tiledata_count; + tiledata = &u_tiledata; + tiledata_count = &u_tiledata_count; FreeTileSet(); // MW New tilesets: - tiledata=&un_tiledata; - tiledata_count=&un_tiledata_count; + tiledata = &un_tiledata; + tiledata_count = &un_tiledata_count; FreeTileSet(); - tiledata=&l_tiledata; - tiledata_count=&l_tiledata_count; + tiledata = &l_tiledata; + tiledata_count = &l_tiledata_count; FreeTileSet(); - tiledata=&d_tiledata; - tiledata_count=&d_tiledata_count; + tiledata = &d_tiledata; + tiledata_count = &d_tiledata_count; FreeTileSet(); /* } catch(...) @@ -4716,83 +4412,73 @@ void CLoading::FreeAll() }*/ // MW Reset tiledata & tiledata_count - if(t==0) { tiledata=&t_tiledata; tiledata_count=&t_tiledata_count; } - if(t==1) { tiledata=&s_tiledata; tiledata_count=&s_tiledata_count; } - if(t==2) { tiledata=&u_tiledata; tiledata_count=&u_tiledata_count; } - if(t==3) { tiledata=&un_tiledata; tiledata_count=&un_tiledata_count; } - if(t==4) { tiledata=&l_tiledata; tiledata_count=&l_tiledata_count; } - if(t==5) { tiledata=&d_tiledata; tiledata_count=&d_tiledata_count; } + if (t == 0) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; } + if (t == 1) { tiledata = &s_tiledata; tiledata_count = &s_tiledata_count; } + if (t == 2) { tiledata = &u_tiledata; tiledata_count = &u_tiledata_count; } + if (t == 3) { tiledata = &un_tiledata; tiledata_count = &un_tiledata_count; } + if (t == 4) { tiledata = &l_tiledata; tiledata_count = &l_tiledata_count; } + if (t == 5) { tiledata = &d_tiledata; tiledata_count = &d_tiledata_count; } - map::iterator i=pics.begin(); - for (int e=0;e::iterator i = pics.begin(); + for (int e = 0; e < pics.size(); e++) { + try { #ifdef NOSURFACES_OBJECTS - if(i->second.bType==PICDATA_TYPE_BMP) - { - if(i->second.pic!=NULL) - { + if (i->second.bType == PICDATA_TYPE_BMP) { + if (i->second.pic != NULL) { ((LPDIRECTDRAWSURFACE4)i->second.pic)->Release(); } - } - else - { - if(i->second.pic!=NULL) - { + } else { + if (i->second.pic != NULL) { delete[] i->second.pic; } - if(i->second.vborder) delete[] i->second.vborder; + if (i->second.vborder) delete[] i->second.vborder; } #else - if(i->second.pic!=NULL) i->second.pic->Release(); + if (i->second.pic != NULL) i->second.pic->Release(); #endif - i->second.pic=NULL; - } - catch(...) - { + i->second.pic = NULL; + } catch (...) { CString err; - err="Access violation while trying to release surface "; + err = "Access violation while trying to release surface "; char c[6]; - itoa(e,c,10); - err+=c; - - err+="\n"; - OutputDebugString(err); + itoa(e, c, 10); + err += c; + + err += "\n"; + OutputDebugString(err); continue; } - + i++; } - try{ - CFinalSunDlg* dlg=((CFinalSunDlg*)theApp.m_pMainWnd); - if(dlg->m_view.m_isoview->lpds!=NULL) dlg->m_view.m_isoview->lpds->Release(); - dlg->m_view.m_isoview->lpds=NULL; - if(dlg->m_view.m_isoview->lpdsBack!=NULL) dlg->m_view.m_isoview->lpdsBack->Release(); - dlg->m_view.m_isoview->lpdsBack=NULL; - if (dlg->m_view.m_isoview->lpdsBackHighRes != NULL) dlg->m_view.m_isoview->lpdsBackHighRes->Release(); - dlg->m_view.m_isoview->lpdsBackHighRes = NULL; - if(dlg->m_view.m_isoview->lpdsTemp!=NULL) dlg->m_view.m_isoview->lpdsTemp->Release(); - dlg->m_view.m_isoview->lpdsTemp=NULL; - if(dlg->m_view.m_isoview->dd!=NULL) dlg->m_view.m_isoview->dd->Release(); - dlg->m_view.m_isoview->dd=NULL; - if(dlg->m_view.m_isoview->dd_1!=NULL) dlg->m_view.m_isoview->dd_1->Release(); - dlg->m_view.m_isoview->dd_1=NULL; + try { + CFinalSunDlg* dlg = ((CFinalSunDlg*)theApp.m_pMainWnd); + if (dlg->m_view.m_isoview->lpds != NULL) dlg->m_view.m_isoview->lpds->Release(); + dlg->m_view.m_isoview->lpds = NULL; + if (dlg->m_view.m_isoview->lpdsBack != NULL) dlg->m_view.m_isoview->lpdsBack->Release(); + dlg->m_view.m_isoview->lpdsBack = NULL; + if (dlg->m_view.m_isoview->lpdsBackHighRes != NULL) dlg->m_view.m_isoview->lpdsBackHighRes->Release(); + dlg->m_view.m_isoview->lpdsBackHighRes = NULL; + if (dlg->m_view.m_isoview->lpdsTemp != NULL) dlg->m_view.m_isoview->lpdsTemp->Release(); + dlg->m_view.m_isoview->lpdsTemp = NULL; + if (dlg->m_view.m_isoview->dd != NULL) dlg->m_view.m_isoview->dd->Release(); + dlg->m_view.m_isoview->dd = NULL; + if (dlg->m_view.m_isoview->dd_1 != NULL) dlg->m_view.m_isoview->dd_1->Release(); + dlg->m_view.m_isoview->dd_1 = NULL; + } catch (...) { + errstream << "Exception while freeing DirectDraw" << endl; } - catch(...) - { - errstream << "Exception while freeing DirectDraw" << endl; - } -} +} -void CLoading::PostNcDestroy() +void CLoading::PostNcDestroy() { -// delete this; // on stack! -// CDialog::PostNcDestroy(); + // delete this; // on stack! + // CDialog::PostNcDestroy(); } void CLoading::PrepareHouses() @@ -4834,60 +4520,56 @@ void CLoading::PrepareHouses() BYTE* Search(BYTE** lpData, BYTE* lpSearched) { - BYTE* lpDat=*lpData; - - lpDat=(BYTE*)strstr((LPCSTR)lpDat, (LPCSTR)lpSearched)+strlen((LPCSTR)lpSearched); + BYTE* lpDat = *lpData; + + lpDat = (BYTE*)strstr((LPCSTR)lpDat, (LPCSTR)lpSearched) + strlen((LPCSTR)lpSearched); return lpDat; } -class SortDummy2{ +class SortDummy2 { public: bool operator() (const CString& x, const CString& y) const { // the length is more important than spelling (numbers!!!)... - if(x.GetLength() 0) - { + if (size > 0) { lpData = new(BYTE[size]); dwSize = size; f.seekg(0, std::ios::beg); @@ -4898,21 +4580,16 @@ void CLoading::LoadStrings() errstream << "LoadStrings() loading from mix" << endl; errstream.flush(); - if(!lpData) - { - HMIXFILE hMix=FindFileInMix(file.c_str()); + if (!lpData) { + HMIXFILE hMix = FindFileInMix(file.c_str()); //HMIXFILE hMix=m_hLanguage; - if(hMix) - { - if (FSunPackLib::XCC_ExtractFile(file, u8AppDataPath + "\\RA2Tmp.csf", hMix)) - { + if (hMix) { + if (FSunPackLib::XCC_ExtractFile(file, u8AppDataPath + "\\RA2Tmp.csf", hMix)) { std::ifstream f(u8AppDataPath + "\\RA2Tmp.csf", ios::binary); - if (f.good()) - { + if (f.good()) { f.seekg(0, std::ios::end); auto size = f.tellg(); - if (size > 0) - { + if (size > 0) { lpData = new(BYTE[size]); dwSize = size; f.seekg(0, std::ios::beg); @@ -4920,111 +4597,104 @@ void CLoading::LoadStrings() } } } - - if (!lpData) - { - MessageBox("String file not found, using rules.ini names","Error"); + + if (!lpData) { + MessageBox("String file not found, using rules.ini names", "Error"); return; } - } - else - { - MessageBox("String file not found, using rules.ini names","Error"); + } else { + MessageBox("String file not found, using rules.ini names", "Error"); return; } - + } - BYTE* orig=static_cast(lpData); + BYTE* orig = static_cast(lpData); - if(!(lpData=Search(&lpData, (BYTE*)" FSC"))) return; + if (!(lpData = Search(&lpData, (BYTE*)" FSC"))) return; RA2STRFILEHEAD head; memcpy(&head, lpData, RA2STRFILEHEADSIZE); - - lpData+=RA2STRFILEHEADSIZE; - + + lpData += RA2STRFILEHEADSIZE; + map strings; int i; //try{ - for(i=0;ilpData); + for (i = 0; i < head.dwCount1; i++) { + ASSERT(orig + dwSize > lpData); - if(!(lpData=lpData+4))//Search(&lpData, (BYTE*)" LBL"))) + if (!(lpData = lpData + 4))//Search(&lpData, (BYTE*)" LBL"))) { - + return; } - RA2STRINGENTRY entry; + RA2STRINGENTRY entry; memcpy(&entry.dwFlag, lpData, 4); - lpData+=4; - + lpData += 4; + DWORD dwCharCount; memcpy(&dwCharCount, lpData, 4); - lpData+=4; + lpData += 4; - BYTE* lpID=new(BYTE[dwCharCount+1]); + BYTE* lpID = new(BYTE[dwCharCount + 1]); memcpy(lpID, lpData, dwCharCount); - lpData+=dwCharCount; - lpID[dwCharCount]=0; - entry.id=(CHAR*)new(BYTE[dwCharCount+1]); + lpData += dwCharCount; + lpID[dwCharCount] = 0; + entry.id = (CHAR*)new(BYTE[dwCharCount + 1]); strcpy(entry.id, (LPCSTR)lpID); - entry.id[dwCharCount]=0; - entry.id_size=dwCharCount; + entry.id[dwCharCount] = 0; + entry.id_size = dwCharCount; // enable this to show the string ID delete[](lpID); - - BOOL b2Strings=FALSE; - if(lpData[0]=='W') - b2Strings=TRUE; - - if(!(lpData=lpData+4))//Search(&lpData, (BYTE*)" RTS"))) - { + BOOL b2Strings = FALSE; + + if (lpData[0] == 'W') + b2Strings = TRUE; + + if (!(lpData = lpData + 4))//Search(&lpData, (BYTE*)" RTS"))) + { return; } memcpy(&dwCharCount, lpData, 4); - lpData+=4; + lpData += 4; - WCHAR* lpwID=new(WCHAR[dwCharCount+1]); + WCHAR* lpwID = new(WCHAR[dwCharCount + 1]); int e; - for(e=0;eFindIndex("Name")>=0) - { + for (i = 0; i < rules.sections.size(); i++) { + if (rules.GetSection(i)->FindIndex("Name") >= 0) { //CCStrings[*rules.GetSectionName(i)].cString=rules.GetSection(i)->values["Name"]; //CCStrings[*rules.GetSectionName(i)].SetString=rul CCStrings[*rules.GetSectionName(i)].SetString((LPSTR)(LPCSTR)rules.GetSection(i)->values["Name"]); @@ -5119,7 +4787,7 @@ void CLoading::HackRules() #endif } - + } void CLoading::PrepareBuildingTheaters() @@ -5139,12 +4807,12 @@ void CLoading::PrepareUnitGraphic(LPCSTR lpUnittype) { CString _rules_image; // the image used CString filename; // filename of the image - char theat=cur_theat; // standard theater char is t (Temperat). a is snow. + char theat = cur_theat; // standard theater char is t (Temperat). a is snow. BOOL bAlwaysSetChar; // second char is always theater, even if NewTheater not specified! - WORD wStep=1; // step is 1 for infantry, buildings, etc, and for shp vehicles it specifies the step rate between every direction - WORD wStartWalkFrame=0; // for examply cyborg reaper has another walk starting frame - int iTurretOffset=0; // used for centering y pos of turret (if existing) + WORD wStep = 1; // step is 1 for infantry, buildings, etc, and for shp vehicles it specifies the step rate between every direction + WORD wStartWalkFrame = 0; // for examply cyborg reaper has another walk starting frame + int iTurretOffset = 0; // used for centering y pos of turret (if existing) BOOL bStructure = rules["BuildingTypes"].HasValue(lpUnittype); // is this a structure? // make sure we only use it for buildings now @@ -5154,14 +4822,14 @@ void CLoading::PrepareUnitGraphic(LPCSTR lpUnittype) auto const bPowerUp = !rules.GetString(lpUnittype, "PowersUpBuilding").IsEmpty(); HTSPALETTE hPalette; - if(theat=='T') hPalette=m_hPalIsoTemp; - if(theat=='A') hPalette=m_hPalIsoSnow; - if(theat=='U') hPalette=m_hPalIsoUrb; - if(theat=='L') hPalette=m_hPalIsoLun; - if(theat=='D') hPalette=m_hPalIsoDes; - if(theat=='N') hPalette=m_hPalIsoUbn; - - CIsoView& v=*((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; + if (theat == 'T') hPalette = m_hPalIsoTemp; + if (theat == 'A') hPalette = m_hPalIsoSnow; + if (theat == 'U') hPalette = m_hPalIsoUrb; + if (theat == 'L') hPalette = m_hPalIsoLun; + if (theat == 'D') hPalette = m_hPalIsoDes; + if (theat == 'N') hPalette = m_hPalIsoUbn; + + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; _rules_image = rules.GetStringOr(lpUnittype, "Image", lpUnittype); @@ -5176,190 +4844,190 @@ void CLoading::PrepareUnitGraphic(LPCSTR lpUnittype) const auto& artSection = art[image]; // is it a shp graphic? - if(!artSection.GetBool("Voxel")) { - try - { + if (!artSection.GetBool("Voxel")) { + try { - /*filename = image + ".shp"; - - - BYTE bTerrain=0; - - - - BOOL isNewTerrain=FALSE; - if(isTrue(artSection.GetValueByName("NewTheater")))//&& isTrue(artSection.GetValueByName("TerrainPalette")))//(filename.GetAt(0)=='G' || filename.GetAt(0)=='N' || filename.GetAt(0)=='C') && filename.GetAt(1)=='A') - { - hPalette=m_hPalUnitTemp; - if(theat=='A') hPalette=m_hPalUnitSnow; - if(theat=='U') hPalette=m_hPalUnitUrb; - if(theat=='L') hPalette=m_hPalUnitLun; - if(theat=='D') hPalette=m_hPalUnitDes; - if(theat=='N') hPalette=m_hPalUnitUbn; - filename.SetAt(1, theat); - isNewTerrain=TRUE; - } - - - HMIXFILE hShpMix=FindFileInMix(filename, &bTerrain); - - BYTE bIgnoreTerrain=TRUE; - - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'G'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) theat='G'; - - } + /*filename = image + ".shp"; - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'N'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) theat='N'; - } - - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'D'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) theat='D'; - } + BYTE bTerrain=0; - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'L'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) theat='L'; - } - - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'A'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) theat='A'; - } - - if(hShpMix==NULL && isNewTerrain) - { - filename.SetAt(1, 'T'); - hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix){ - theat='T'; - hPalette=m_hIsoTemp; + + + BOOL isNewTerrain=FALSE; + if(isTrue(artSection.GetValueByName("NewTheater")))//&& isTrue(artSection.GetValueByName("TerrainPalette")))//(filename.GetAt(0)=='G' || filename.GetAt(0)=='N' || filename.GetAt(0)=='C') && filename.GetAt(1)=='A') + { + hPalette=m_hPalUnitTemp; + if(theat=='A') hPalette=m_hPalUnitSnow; + if(theat=='U') hPalette=m_hPalUnitUrb; + if(theat=='L') hPalette=m_hPalUnitLun; + if(theat=='D') hPalette=m_hPalUnitDes; + if(theat=='N') hPalette=m_hPalUnitUbn; + filename.SetAt(1, theat); + isNewTerrain=TRUE; } - } - - - if(isTrue(artSection.GetValueByName("TerrainPalette"))) - { - bIgnoreTerrain=FALSE; - - if(cur_theat=='T') - hPalette=m_hPalIsoTemp; - else if(cur_theat=='A') - hPalette=m_hPalIsoSnow; - else if (cur_theat=='U') - hPalette=m_hPalIsoUrb; - else if(cur_theat=='L') - hPalette=m_hPalIsoLun; - else if(cur_theat=='D') - hPalette=m_hPalIsoDes; - else if(cur_theat=='N') - hPalette=m_hPalIsoUbn; - - - - } - - if(hShpMix==0) - { - filename=image; - filename+=".shp"; - hShpMix=FindFileInMix(filename, &bTerrain); + HMIXFILE hShpMix=FindFileInMix(filename, &bTerrain); - - - if(hShpMix==NULL) + BYTE bIgnoreTerrain=TRUE; + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'G'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) theat='G'; + + } + + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'N'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) theat='N'; + } + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'D'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) theat='D'; + } + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'L'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) theat='L'; + } + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'A'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) theat='A'; + } + + if(hShpMix==NULL && isNewTerrain) + { + filename.SetAt(1, 'T'); + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix){ + theat='T'; + hPalette=m_hIsoTemp; + } + } + + + if(isTrue(artSection.GetValueByName("TerrainPalette"))) + { + bIgnoreTerrain=FALSE; + + if(cur_theat=='T') + hPalette=m_hPalIsoTemp; + else if(cur_theat=='A') + hPalette=m_hPalIsoSnow; + else if (cur_theat=='U') + hPalette=m_hPalIsoUrb; + else if(cur_theat=='L') + hPalette=m_hPalIsoLun; + else if(cur_theat=='D') + hPalette=m_hPalIsoDes; + else if(cur_theat=='N') + hPalette=m_hPalIsoUbn; + + + + } + + + + if(hShpMix==0) { filename=image; - if(theat=='T') filename+=".tem"; - if(theat=='A') filename+=".sno"; - if(theat=='U') filename+=".urb"; - if(theat=='L') filename+=".lun"; - if(theat=='D') filename+=".des"; - if(theat=='N') filename+=".ubn"; - filename.MakeLower(); + filename+=".shp"; hShpMix=FindFileInMix(filename, &bTerrain); - + + + if(hShpMix==NULL) { filename=image; - filename+=".tem"; + if(theat=='T') filename+=".tem"; + if(theat=='A') filename+=".sno"; + if(theat=='U') filename+=".urb"; + if(theat=='L') filename+=".lun"; + if(theat=='D') filename+=".des"; + if(theat=='N') filename+=".ubn"; + filename.MakeLower(); hShpMix=FindFileInMix(filename, &bTerrain); - if(hShpMix) + + if(hShpMix==NULL) { - hPalette=m_hPalIsoTemp; + filename=image; + filename+=".tem"; + hShpMix=FindFileInMix(filename, &bTerrain); + if(hShpMix) + { + hPalette=m_hPalIsoTemp; + } } - } - - if(hShpMix!=NULL) - { - - - - } - else - { - filename=image+".shp"; - - filename.SetAt(1, 'A'); - - hShpMix=FindFileInMix(filename); if(hShpMix!=NULL) { - bAlwaysSetChar=TRUE; + + + } else { + filename=image+".shp"; + filename.SetAt(1, 'A'); + hShpMix=FindFileInMix(filename); if(hShpMix!=NULL) { - theat='A'; bAlwaysSetChar=TRUE; } else { - filename.SetAt(1, 'U'); + filename.SetAt(1, 'A'); hShpMix=FindFileInMix(filename); - if(hShpMix) theat='U'; + + if(hShpMix!=NULL) + { + theat='A'; + bAlwaysSetChar=TRUE; + } else { - filename.SetAt(1, 'L'); + filename.SetAt(1, 'U'); hShpMix=FindFileInMix(filename); - if(hShpMix) theat='L'; + if(hShpMix) theat='U'; else { - filename.SetAt(1, 'D'); + filename.SetAt(1, 'L'); hShpMix=FindFileInMix(filename); - if(hShpMix) theat='D'; + if(hShpMix) theat='L'; else { - filename.SetAt(1, 'N'); + filename.SetAt(1, 'D'); hShpMix=FindFileInMix(filename); - if(hShpMix) theat='N'; + if(hShpMix) theat='D'; else { - filename.SetAt(1, 'T'); + filename.SetAt(1, 'N'); hShpMix=FindFileInMix(filename); - if(hShpMix) theat='T'; + if(hShpMix) theat='N'; + else + { + filename.SetAt(1, 'T'); + hShpMix=FindFileInMix(filename); + if(hShpMix) theat='T'; + } } } } @@ -5367,99 +5035,94 @@ void CLoading::PrepareUnitGraphic(LPCSTR lpUnittype) } } } + else + { + theat='T'; + } + } else { - theat='T'; + + // now we need to find out the palette + + if(isTrue(artSection.GetValueByName("TerrainPalette"))) // it´s a file in isotemp.mix/isosno.mix + { + + } + else // it´s a file in temperat.mix/snow.mix + { + if(cur_theat=='T') hPalette=m_hPalUnitTemp; + if(cur_theat=='A') hPalette=m_hPalUnitSnow; + if(cur_theat=='U') hPalette=m_hPalUnitUrb; + if(cur_theat=='L') hPalette=m_hPalUnitLun; + if(cur_theat=='D') hPalette=m_hPalUnitDes; + if(cur_theat=='N') hPalette=m_hPalUnitUbn; + } + + }*/ + + auto shp = FindUnitShp(image, cur_theat, artSection); + if (!shp) { + return; } - } - else - { + filename = shp->filename; + hPalette = shp->palette; - // now we need to find out the palette - - if(isTrue(artSection.GetValueByName("TerrainPalette"))) // it´s a file in isotemp.mix/isosno.mix - { - - } - else // it´s a file in temperat.mix/snow.mix - { - if(cur_theat=='T') hPalette=m_hPalUnitTemp; - if(cur_theat=='A') hPalette=m_hPalUnitSnow; - if(cur_theat=='U') hPalette=m_hPalUnitUrb; - if(cur_theat=='L') hPalette=m_hPalUnitLun; - if(cur_theat=='D') hPalette=m_hPalUnitDes; - if(cur_theat=='N') hPalette=m_hPalUnitUbn; - } - - }*/ + auto limited_to_theater = artSection.GetBool("TerrainPalette") ? shp->mixfile_theater : TheaterChar::None; - auto shp = FindUnitShp(image, cur_theat, artSection); - if (!shp) { - return; - } - - filename = shp->filename; - hPalette = shp->palette; - - auto limited_to_theater = artSection.GetBool("TerrainPalette") ? shp->mixfile_theater : TheaterChar::None; - - if(filename=="tibtre01.tem" || filename=="tibtre02.tem" || filename=="tibtre03.tem" || filename=="veinhole.tem") { - hPalette=m_hPalUnitTemp; - } - - if (shp->mixfile > 0) { - - BOOL bSuccess = FSunPackLib::SetCurrentSHP(filename, shp->mixfile); - if (!bSuccess) { - filename=image+".sno"; - if(cur_theat=='T' || cur_theat=='U') hPalette=m_hPalIsoTemp; - HMIXFILE hShpMix=FindFileInMix(filename); - bSuccess=FSunPackLib::SetCurrentSHP(filename, hShpMix); - - if(!bSuccess) - { - return; - } + if (filename == "tibtre01.tem" || filename == "tibtre02.tem" || filename == "tibtre03.tem" || filename == "veinhole.tem") { + hPalette = m_hPalUnitTemp; } - - if(bSuccess) - { - - char ic[50]; - int i=0; - itoa(i, ic, 10); + if (shp->mixfile > 0) { - // just fill in a stub entry - Final* will automatically retry loading once the graphic really must be loaded - PICDATA p; - p.pic=NULL; - p.x=0; - p.y=0; - p.wHeight=0; - p.wWidth=0; - p.wMaxWidth=0; - p.wMaxHeight=0; - p.bType=PICDATA_TYPE_SHP; - p.bTerrain=limited_to_theater; + BOOL bSuccess = FSunPackLib::SetCurrentSHP(filename, shp->mixfile); + if (!bSuccess) { + filename = image + ".sno"; + if (cur_theat == 'T' || cur_theat == 'U') hPalette = m_hPalIsoTemp; + HMIXFILE hShpMix = FindFileInMix(filename); + bSuccess = FSunPackLib::SetCurrentSHP(filename, hShpMix); + + if (!bSuccess) { + return; + } + } + + if (bSuccess) { + + + char ic[50]; + int i = 0; + itoa(i, ic, 10); + + // just fill in a stub entry - Final* will automatically retry loading once the graphic really must be loaded + PICDATA p; + p.pic = NULL; + p.x = 0; + p.y = 0; + p.wHeight = 0; + p.wWidth = 0; + p.wMaxWidth = 0; + p.wMaxHeight = 0; + p.bType = PICDATA_TYPE_SHP; + p.bTerrain = limited_to_theater; + + + pics[image + ic] = p; + + + } - - pics[image+ic]=p; - - } - - } - - } - catch(...) - { + + } catch (...) { errstream << " exception " << endl; errstream.flush(); } - - + + } } @@ -5477,59 +5140,55 @@ void CLoading::FetchPalettes() // iso palette - HTSPALETTE hCur=0; - if(Map->GetTheater()==THEATER0) hCur=m_hPalIsoTemp; - if(Map->GetTheater()==THEATER1) hCur=m_hPalIsoSnow; - if(Map->GetTheater()==THEATER2) hCur=m_hPalIsoUrb; - if(Map->GetTheater()==THEATER3) hCur=m_hPalIsoUbn; - if(Map->GetTheater()==THEATER4) hCur=m_hPalIsoLun; - if(Map->GetTheater()==THEATER5) hCur=m_hPalIsoDes; + HTSPALETTE hCur = 0; + if (Map->GetTheater() == THEATER0) hCur = m_hPalIsoTemp; + if (Map->GetTheater() == THEATER1) hCur = m_hPalIsoSnow; + if (Map->GetTheater() == THEATER2) hCur = m_hPalIsoUrb; + if (Map->GetTheater() == THEATER3) hCur = m_hPalIsoUbn; + if (Map->GetTheater() == THEATER4) hCur = m_hPalIsoLun; + if (Map->GetTheater() == THEATER5) hCur = m_hPalIsoDes; int i; - for(i=0;i<256;i++) - { + for (i = 0; i < 256; i++) { FSunPackLib::SetTSPaletteEntry(hCur, i, NULL /* don´t modify it!*/, &palIso[i] /*but retrieve it!*/); } // unit palette - if(Map->GetTheater()==THEATER0) hCur=m_hPalUnitTemp; - if(Map->GetTheater()==THEATER1) hCur=m_hPalUnitSnow; - if(Map->GetTheater()==THEATER2) hCur=m_hPalUnitUrb; - if(Map->GetTheater()==THEATER3) hCur=m_hPalUnitUbn; - if(Map->GetTheater()==THEATER4) hCur=m_hPalUnitLun; - if(Map->GetTheater()==THEATER5) hCur=m_hPalUnitDes; + if (Map->GetTheater() == THEATER0) hCur = m_hPalUnitTemp; + if (Map->GetTheater() == THEATER1) hCur = m_hPalUnitSnow; + if (Map->GetTheater() == THEATER2) hCur = m_hPalUnitUrb; + if (Map->GetTheater() == THEATER3) hCur = m_hPalUnitUbn; + if (Map->GetTheater() == THEATER4) hCur = m_hPalUnitLun; + if (Map->GetTheater() == THEATER5) hCur = m_hPalUnitDes; - for(i=0;i<256;i++) - { + for (i = 0; i < 256; i++) { FSunPackLib::SetTSPaletteEntry(hCur, i, NULL /* don´t modify it!*/, &palUnit[i] /*but retrieve it!*/); } // theater palette - if(Map->GetTheater()==THEATER0) hCur=m_hPalTemp; - if(Map->GetTheater()==THEATER1) hCur=m_hPalSnow; - if(Map->GetTheater()==THEATER2) hCur=m_hPalUrb; - if(Map->GetTheater()==THEATER3) hCur=m_hPalUbn; - if(Map->GetTheater()==THEATER4) hCur=m_hPalLun; - if(Map->GetTheater()==THEATER5) hCur=m_hPalDes; + if (Map->GetTheater() == THEATER0) hCur = m_hPalTemp; + if (Map->GetTheater() == THEATER1) hCur = m_hPalSnow; + if (Map->GetTheater() == THEATER2) hCur = m_hPalUrb; + if (Map->GetTheater() == THEATER3) hCur = m_hPalUbn; + if (Map->GetTheater() == THEATER4) hCur = m_hPalLun; + if (Map->GetTheater() == THEATER5) hCur = m_hPalDes; - for(i=0;i<256;i++) - { + for (i = 0; i < 256; i++) { FSunPackLib::SetTSPaletteEntry(hCur, i, NULL /* don´t modify it!*/, &palTheater[i] /*but retrieve it!*/); } // lib palette - hCur=m_hPalLib; + hCur = m_hPalLib; - for(i=0;i<256;i++) - { + for (i = 0; i < 256; i++) { FSunPackLib::SetTSPaletteEntry(hCur, i, NULL /* don´t modify it!*/, &palLib[i] /*but retrieve it!*/); } @@ -5538,11 +5197,11 @@ void CLoading::FetchPalettes() CreateConvTable(palUnit, iPalUnit); CreateConvTable(palTheater, iPalTheater); - CIsoView& v=*((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; DDPIXELFORMAT pf; memset(&pf, 0, sizeof(DDPIXELFORMAT)); - pf.dwSize=sizeof(DDPIXELFORMAT); + pf.dwSize = sizeof(DDPIXELFORMAT); v.lpds->GetPixelFormat(&pf); v.pf = pf; @@ -5552,27 +5211,26 @@ void CLoading::FetchPalettes() for (auto const& [name, col] : rules["Colors"]) { COLORREF cref = v.GetColor("", col); - + color_conv[col] = conf.GetColor(GetRValue(cref), GetGValue(cref), GetBValue(cref)); colorref_conv[cref] = color_conv[col]; } } -void CLoading::CreateConvTable(RGBTRIPLE *pal, int *iPal) +void CLoading::CreateConvTable(RGBTRIPLE* pal, int* iPal) { - CIsoView& v=*((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; + CIsoView& v = *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview; DDPIXELFORMAT pf; memset(&pf, 0, sizeof(DDPIXELFORMAT)); - pf.dwSize=sizeof(DDPIXELFORMAT); + pf.dwSize = sizeof(DDPIXELFORMAT); v.lpds->GetPixelFormat(&pf); FSunPackLib::ColorConverter conf(pf); int i; - for(i=0;i<256;i++) - { - iPal[i]=conf.GetColor(pal[i].rgbtRed, pal[i].rgbtGreen, pal[i].rgbtBlue); + for (i = 0; i < 256; i++) { + iPal[i] = conf.GetColor(pal[i].rgbtRed, pal[i].rgbtGreen, pal[i].rgbtBlue); } } diff --git a/MissionEditor/Loading.h b/MissionEditor/Loading.h index 70eb665..62b861b 100644 --- a/MissionEditor/Loading.h +++ b/MissionEditor/Loading.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_LOADING_H__5D5C3284_8962_11D3_B63B_AAA51FD322E3__INCLUDED_) @@ -66,7 +66,7 @@ struct EXPANDMIX HMIXFILE hUbn; HMIXFILE hBuildings; HMIXFILE hMarble; - EXPANDMIX() {memset(this, 0, sizeof(EXPANDMIX));}; + EXPANDMIX() { memset(this, 0, sizeof(EXPANDMIX)); }; }; class CFinalSunDlg; @@ -78,7 +78,7 @@ class CFinalSunDlg; struct FindShpResult { - FindShpResult(HMIXFILE mixfile_, TheaterChar mixfile_theater_, CString filename_, TheaterChar theat_, HTSPALETTE palette_): mixfile(mixfile_), mixfile_theater(mixfile_theater_), filename(filename_), theat(theat_), palette(palette_) { } + FindShpResult(HMIXFILE mixfile_, TheaterChar mixfile_theater_, CString filename_, TheaterChar theat_, HTSPALETTE palette_) : mixfile(mixfile_), mixfile_theater(mixfile_theater_), filename(filename_), theat(theat_), palette(palette_) { } HMIXFILE mixfile; TheaterChar mixfile_theater; CString filename; @@ -88,7 +88,7 @@ struct FindShpResult class CLoading : public CDialog { -// Construction + // Construction public: void CreateConvTable(RGBTRIPLE* pal, int* iPal); void FetchPalettes(); @@ -97,18 +97,18 @@ public: void FreeAll(); void FreeTileSet(); BOOL InitDirectDraw(); - - void InitTMPs(CProgressCtrl* prog=NULL); + + void InitTMPs(CProgressCtrl* prog = NULL); void InitPalettes(); - + ~CLoading(); void Unload(); BOOL InitMixFiles(); - void InitSHPs(CProgressCtrl* prog=NULL); + void InitSHPs(CProgressCtrl* prog = NULL); void LoadTSIni(LPCTSTR lpFilename, CIniFile* lpIniFile, BOOL bIsExpansion, BOOL bCheckEditorDir = FALSE); void CreateINI(); CLoading(CWnd* pParent = NULL); // Standardconstructor - void InitPics(CProgressCtrl* prog=NULL); + void InitPics(CProgressCtrl* prog = NULL); void Load(); BOOL LoadUnitGraphic(const CString& lpUnittype); void LoadBuildingSubGraphic(const CString& subkey, const CIniFileSection& artSection, BOOL bAlwaysSetChar, char theat, HMIXFILE hShpMix, SHPHEADER& shp_h, BYTE*& shp); @@ -118,10 +118,10 @@ public: HTSPALETTE GetUnitPalette(char theat); std::optional FindUnitShp(const CString& image, char preferred_theat, const CIniFileSection& artSection); char cur_theat; - -// Dialog data - //{{AFX_DATA(CLoading) + + // Dialog data + //{{AFX_DATA(CLoading) enum { IDD = IDD_LOADING }; CStatic m_Version; CStatic m_BuiltBy; @@ -133,7 +133,7 @@ public: // Overwriteables // class wizard generated overwriteables //{{AFX_VIRTUAL(CLoading) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-support virtual void PostNcDestroy(); //}}AFX_VIRTUAL @@ -159,7 +159,7 @@ private: HTSPALETTE m_hPalIsoTemp; HTSPALETTE m_hPalIsoSnow; HTSPALETTE m_hPalIsoUrb; - + HTSPALETTE m_hPalUnitTemp; HTSPALETTE m_hPalUnitSnow; HTSPALETTE m_hPalUnitUrb; @@ -178,7 +178,7 @@ private: HTSPALETTE m_hPalUnitDes; HTSPALETTE m_hPalUnitUbn; - HMIXFILE FindFileInMix(LPCTSTR lpFilename, TheaterChar* pTheaterChar=NULL); + HMIXFILE FindFileInMix(LPCTSTR lpFilename, TheaterChar* pTheaterChar = NULL); HMIXFILE m_hLocal; HMIXFILE m_hSno; HMIXFILE m_hTem; @@ -211,8 +211,8 @@ private: BOOL loaded; std::unique_ptr m_voxelNormalTables; - - + + }; //{{AFX_INSERT_LOCATION}} diff --git a/MissionEditor/MMXSavingOptionsDlg.cpp b/MissionEditor/MMXSavingOptionsDlg.cpp index c81cf39..364c013 100644 --- a/MissionEditor/MMXSavingOptionsDlg.cpp +++ b/MissionEditor/MMXSavingOptionsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MMXSavingOptionsDlg.cpp: Implementierungsdatei diff --git a/MissionEditor/MMXSavingOptionsDlg.h b/MissionEditor/MMXSavingOptionsDlg.h index 783b5a2..c403b62 100644 --- a/MissionEditor/MMXSavingOptionsDlg.h +++ b/MissionEditor/MMXSavingOptionsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MMXSAVINGOPTIONSDLG_H__1A62AFE1_E8CA_11D4_9C88_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CMMXSavingOptionsDlg : public CDialog { -// Konstruktion + // Konstruktion public: CMMXSavingOptionsDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -56,7 +56,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CMMXSavingOptionsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Macros.h b/MissionEditor/Macros.h index e1215e9..d2895f2 100644 --- a/MissionEditor/Macros.h +++ b/MissionEditor/Macros.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /* diff --git a/MissionEditor/MapCode.cpp b/MissionEditor/MapCode.cpp index aad82c0..c0b0052 100644 --- a/MissionEditor/MapCode.cpp +++ b/MissionEditor/MapCode.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // This code determines the cell values for @@ -31,34 +31,34 @@ int calcXPos(int x, int y) { - int x1=x*256+128; - - int y1 = y*256 + 128; + int x1 = x * 256 + 128; + + int y1 = y * 256 + 128; int x2 = (x1 - y1) * 30; int y2 = (x1 + y1) * 15; - int x3 = (x2/256 + 512*30) / 60; + int x3 = (x2 / 256 + 512 * 30) / 60; - int y3 = (y2/256) / 30; + int y3 = (y2 / 256) / 30; return x3; } int calcYPos(int x, int y) { - int x1=x*256+128; - - int y1 = y*256 + 128; + int x1 = x * 256 + 128; + + int y1 = y * 256 + 128; int x2 = (x1 - y1) * 30; int y2 = (x1 + y1) * 15; - int x3 = (x2/256 + 512*30) / 60; + int x3 = (x2 / 256 + 512 * 30) / 60; - int y3 = (y2/256) / 30; + int y3 = (y2 / 256) / 30; return y3; } @@ -69,84 +69,81 @@ struct MRECT int Y; int Width; int Height; -}; - +}; + void MC_GetHeaderRect(int& startx, int& starty, int& width, int& height) { - int leastx=10000; - int leasty=10000; - int mostx=0; - int mosty=0; + int leastx = 10000; + int leasty = 10000; + int mostx = 0; + int mosty = 0; MRECT LocalRect, PlayRect; RECT r; Map->GetLocalSize(&r); - LocalRect.X=r.left; - LocalRect.Y=r.top; - LocalRect.Width=r.right; - LocalRect.Height=r.bottom; + LocalRect.X = r.left; + LocalRect.Y = r.top; + LocalRect.Width = r.right; + LocalRect.Height = r.bottom; - CIniFile& ini=Map->GetIniFile(); - PlayRect.X=0; - PlayRect.Y=0; - PlayRect.Width=Map->GetWidth(); - PlayRect.Height=Map->GetHeight(); + CIniFile& ini = Map->GetIniFile(); + PlayRect.X = 0; + PlayRect.Y = 0; + PlayRect.Width = Map->GetWidth(); + PlayRect.Height = Map->GetHeight(); char c[50]; char d[50]; itoa(LocalRect.Width, c, 10); - - int x,y; - int max=Map->GetIsoSize(); - for(x=0;xGetIsoSize(); + for (x = 0; x < max; x++) { + for (y = 0; y < max; y++) { + int height = 0; - height = Map->GetHeightAt(y+x*max); // remember: x/y switched here, WS coordinate system - - // fudge ramps at the top of the map so that they end up considered not in the local rect - //if (cell->ramp && x + y < PlayRect.Width + 2*LocalRect.Y + 4 + height) { - //height++; - //} - } + if (TRUE) { + + height = Map->GetHeightAt(y + x * max); // remember: x/y switched here, WS coordinate system + + // fudge ramps at the top of the map so that they end up considered not in the local rect + //if (cell->ramp && x + y < PlayRect.Width + 2*LocalRect.Y + 4 + height) { + //height++; + //} + } - if ((x + y > PlayRect.Width + 2*LocalRect.Y + height) && - (x + y <= PlayRect.Width + 2*(LocalRect.Y + LocalRect.Height + 1) + height) && - (x - y < 2*(LocalRect.X + LocalRect.Width) - PlayRect.Width) && - (y - x < PlayRect.Width - 2*LocalRect.X)) - //if ((x + y > PlayRect.Width) && (x - y < PlayRect.Width) && (y - x < PlayRect.Width) && (x + y <= PlayRect.Width + 2 * PlayRect.Height)) - { - int rx=calcXPos(x,y); - int ry=calcYPos(x,y); + if ((x + y > PlayRect.Width + 2 * LocalRect.Y + height) && + (x + y <= PlayRect.Width + 2 * (LocalRect.Y + LocalRect.Height + 1) + height) && + (x - y < 2 * (LocalRect.X + LocalRect.Width) - PlayRect.Width) && + (y - x < PlayRect.Width - 2 * LocalRect.X)) + //if ((x + y > PlayRect.Width) && (x - y < PlayRect.Width) && (y - x < PlayRect.Width) && (x + y <= PlayRect.Width + 2 * PlayRect.Height)) + { + int rx = calcXPos(x, y); + int ry = calcYPos(x, y); if (rx < leastx) leastx = rx; - - if (rx > mostx) + + if (rx > mostx) mostx = rx; - - if (ry < leasty) + + if (ry < leasty) leasty = ry; - - if (ry > mosty) + + if (ry > mosty) mosty = ry; } } } - startx=leastx; - starty=leasty; - width=mostx-leastx; - height=mosty-leasty; + startx = leastx; + starty = leasty; + width = mostx - leastx; + height = mosty - leasty; } - \ No newline at end of file diff --git a/MissionEditor/MapCode.h b/MissionEditor/MapCode.h index ab017d4..78722b7 100644 --- a/MissionEditor/MapCode.h +++ b/MissionEditor/MapCode.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef MAPCODE_INCLUDED diff --git a/MissionEditor/MapD.cpp b/MissionEditor/MapD.cpp index daa575d..9c427af 100644 --- a/MissionEditor/MapD.cpp +++ b/MissionEditor/MapD.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapD.cpp: Implementierungsdatei @@ -80,7 +80,7 @@ END_MESSAGE_MAP() void CMapD::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); m_LocalSize.SetWindowText(ini.GetString("Map", "LocalSize")); //m_Size.SetWindowText( ini.sections["Map"].values["Size"] ); @@ -88,9 +88,9 @@ void CMapD::UpdateDialog() char c[50]; itoa(Map->GetWidth(), c, 10); - m_Width=c; + m_Width = c; itoa(Map->GetHeight(), c, 10); - m_Height=c; + m_Height = c; CDialog::UpdateData(FALSE); } @@ -100,14 +100,14 @@ void CMapD::UpdateData() //MessageBox("This function ( UpdateData() ) should not be called, please contact the author."); } -void CMapD::OnChangeUsesize() +void CMapD::OnChangeUsesize() { - + } -void CMapD::OnEditchangeTheater() +void CMapD::OnEditchangeTheater() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Map", "Theater", GetText(&m_Theater)); } @@ -122,16 +122,16 @@ void CMapD::UpdateStrings() GetDlgItem(IDC_LTHEATER)->SetWindowText(GetLanguageStringACP("MapTheater")); } -void CMapD::OnChangelocal() +void CMapD::OnChangelocal() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Map", "LocalSize", GetText(&m_LocalSize)); - + Map->CalcMapRect(); ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } -void CMapD::OnChange() +void CMapD::OnChange() { /* CDialog::UpdateData(TRUE); @@ -145,10 +145,9 @@ void CMapD::OnChange() */ CChangeSizeDlg dlg; - if(dlg.DoModal()==IDCANCEL) return; + if (dlg.DoModal() == IDCANCEL) return; - if(dlg.m_Width<16 || dlg.m_Width>400 || dlg.m_Height<16 || dlg.m_Height>400 || (dlg.m_Width + dlg.m_Height) > 512) - { + if (dlg.m_Width < 16 || dlg.m_Width>400 || dlg.m_Height < 16 || dlg.m_Height>400 || (dlg.m_Width + dlg.m_Height) > 512) { MessageBox("Width and Height must both be between 16 and 400 and both added must be less than 512.", "Error"); return; } @@ -161,9 +160,9 @@ void CMapD::OnChange() char c[50]; itoa(dlg.m_Width, c, 10); - - m_Width=c; + + m_Width = c; itoa(dlg.m_Height, c, 10); - m_Height=c; + m_Height = c; CDialog::UpdateData(FALSE); } diff --git a/MissionEditor/MapD.h b/MissionEditor/MapD.h index 334cb3d..f4f255f 100644 --- a/MissionEditor/MapD.h +++ b/MissionEditor/MapD.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MAPD_H__B5D522E9_69CE_11D3_99E1_C138647F2A00__INCLUDED_) @@ -34,7 +34,7 @@ class CMapD : public CDialog { DECLARE_DYNCREATE(CMapD) -// Konstruktion + // Konstruktion public: void UpdateStrings(); void UpdateData(); @@ -42,8 +42,8 @@ public: CMapD(); ~CMapD(); -// Dialogfelddaten - //{{AFX_DATA(CMapD) + // Dialogfelddaten + //{{AFX_DATA(CMapD) enum { IDD = IDD_MAP }; CEdit m_LocalSize; CComboBox m_Theater; @@ -55,7 +55,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CMapD) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/MapData.cpp b/MissionEditor/MapData.cpp index 80a17a3..48aa1ea 100644 --- a/MissionEditor/MapData.cpp +++ b/MissionEditor/MapData.cpp @@ -138,7 +138,7 @@ FIELDDATA::FIELDDATA() #endif unit = -1; int i; - for (i = 0;i < SUBPOS_COUNT;i++) + for (i = 0; i < SUBPOS_COUNT; i++) infantry[i] = -1; aircraft = -1; structure = -1; @@ -222,8 +222,7 @@ CMapData::~CMapData() int i; - for (i = 0;i < dwSnapShotCount;i++) - { + for (i = 0; i < dwSnapShotCount; i++) { delete[] m_snapshots[i].bHeight; delete[] m_snapshots[i].bMapData; delete[] m_snapshots[i].bSubTile; @@ -458,8 +457,7 @@ void CMapData::UpdateIniFile(DWORD dwFlags) if (dwFlags == MAPDATA_UPDATE_FROM_INI) bSave = FALSE; - if (dwFlags == MAPDATA_UPDATE_FROM_INI) - { + if (dwFlags == MAPDATA_UPDATE_FROM_INI) { CalcMapRect(); InitMinimap(); @@ -487,9 +485,7 @@ void CMapData::UpdateIniFile(DWORD dwFlags) UpdateMapFieldData(bSave); - } - else if (dwFlags & MAPDATA_UPDATE_TO_INI_ALL) - { + } else if (dwFlags & MAPDATA_UPDATE_TO_INI_ALL) { UpdateAircraft(bSave); UpdateCelltags(bSave); UpdateInfantry(bSave); @@ -535,8 +531,7 @@ void CMapData::LoadMap(const std::string& file) if (fielddata != NULL) delete[] fielddata; int i; - for (i = 0;i < dwSnapShotCount;i++) - { + for (i = 0; i < dwSnapShotCount; i++) { delete[] m_snapshots[i].bHeight; delete[] m_snapshots[i].bMapData; delete[] m_snapshots[i].bSubTile; @@ -618,22 +613,15 @@ void CMapData::LoadMap(const std::string& file) theApp.m_loading->InitMixFiles(); map::iterator it = pics.begin(); - for (int e = 0;e < pics.size();e++) - { - try - { + for (int e = 0; e < pics.size(); e++) { + try { #ifdef NOSURFACES_OBJECTS - if (it->second.bType == PICDATA_TYPE_BMP) - { - if (it->second.pic != NULL) - { + if (it->second.bType == PICDATA_TYPE_BMP) { + if (it->second.pic != NULL) { ((LPDIRECTDRAWSURFACE4)it->second.pic)->Release(); } - } - else - { - if (it->second.pic != NULL) - { + } else { + if (it->second.pic != NULL) { delete[] it->second.pic; } if (it->second.vborder) delete[] it->second.vborder; @@ -643,9 +631,7 @@ void CMapData::LoadMap(const std::string& file) #endif it->second.pic = NULL; - } - catch (...) - { + } catch (...) { CString err; err = "Access violation while trying to release surface "; char c[6]; @@ -701,8 +687,7 @@ void CMapData::LoadMap(const std::string& file) theApp.m_loading->InitTMPs(&dlg.m_Progress); theApp.m_loading->cur_theat = 'T'; - } - else if (theaterType == THEATER1) { + } else if (theaterType == THEATER1) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -922,8 +907,7 @@ void CMapData::Unpack() int hexlen; - if (ovrl.GetLength() > 0) - { + if (ovrl.GetLength() > 0) { std::vector hex; hexlen = FSunPackLib::DecodeBase64(ovrl, hex); FSunPackLib::DecodeF80(hex.data(), hexlen, values, VALUESIZE); @@ -933,14 +917,13 @@ void CMapData::Unpack() memcpy(m_Overlay, values.data(), std::min(VALUESIZE, values.size())); ovrl = ""; - + for (auto const& [idx, val] : m_mapfile.GetSection("OverlayDataPack")) { ovrl += val; } values.assign(VALUESIZE, 0); - if (ovrl.GetLength() > 0) - { + if (ovrl.GetLength() > 0) { std::vector hex; hexlen = FSunPackLib::DecodeBase64(ovrl, hex); @@ -967,8 +950,7 @@ void CMapData::Unpack() memset(lpMapPack, 0, len_needed + 1); int cur_pos = 0; - for (auto const& [key, val] : sec) - { + for (auto const& [key, val] : sec) { memcpy(lpMapPack + cur_pos, val, val.GetLength()); cur_pos += val.GetLength(); DoEvents(); @@ -985,8 +967,7 @@ void CMapData::Unpack() m_mfd = NULL; dwIsoMapSize = 0; - if (IsoMapPck.GetLength() > 0) - { + if (IsoMapPck.GetLength() > 0) { std::vector hexC; //DoEvents(); @@ -998,8 +979,7 @@ void CMapData::Unpack() int SP = 0; int MapSizeBytes = 0; int sec = 0; - while (SP < hexlen) - { + while (SP < hexlen) { WORD wSrcSize; WORD wDestSize; memcpy(&wSrcSize, hex + SP, 2); @@ -1059,15 +1039,14 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) if (m_mapfile["Digest"].Size() == 0) { srand(GetTickCount()); unsigned short vals[10]; - for (i = 0;i < 10;i++) + for (i = 0; i < 10; i++) vals[i] = rand() * 65536 / RAND_MAX; base64 = FSunPackLib::EncodeBase64((BYTE*)vals, 20); i = 0; pos = 0; - while (TRUE) - { + while (TRUE) { i++; char cLine[50]; itoa(i, cLine, 10); @@ -1081,8 +1060,8 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) if (strlen(str) > 0) { m_mapfile.SetString("Digest", cLine, str); } - if (cpysize < 70) { - break; + if (cpysize < 70) { + break; } pos += 70; } @@ -1103,8 +1082,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) errstream << "Packing overlay" << endl; errstream.flush(); - for (i = 0;i < 262144;i++) - { + for (i = 0; i < 262144; i++) { values[i] = m_Overlay[i]; } @@ -1116,8 +1094,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) i = 0; pos = 0; - while (TRUE) - { + while (TRUE) { i++; char cLine[50]; itoa(i, cLine, 10); @@ -1147,8 +1124,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) errstream << "Pack overlaydata" << endl; errstream.flush(); - for (i = 0;i < 262144;i++) - { + for (i = 0; i < 262144; i++) { values[i] = m_OverlayData[i]; } @@ -1171,8 +1147,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) i = 0; pos = 0; - while (TRUE) - { + while (TRUE) { i++; char cLine[50]; itoa(i, cLine, 10); @@ -1220,8 +1195,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) i = 0; pos = 0; int base64len = strlen((char*)base64); - while (TRUE) - { + while (TRUE) { i++; char cLine[50]; itoa(i, cLine, 10); @@ -1251,15 +1225,14 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) // create minimap - if (bCreatePreview) - { + if (bCreatePreview) { BITMAPINFO biinfo; BYTE* lpDibData; int pitch; ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_minimap.DrawMinimap(&lpDibData, biinfo, pitch); m_mapfile.DeleteSection("PreviewPack"); - m_mapfile.SetString("Preview", "Size", m_mapfile.GetString("Map","Size")); + m_mapfile.SetString("Preview", "Size", m_mapfile.GetString("Map", "Size")); char c[50]; itoa(biinfo.bmiHeader.biWidth, c, 10); m_mapfile.SetString("Preview", "Size", SetParam(m_mapfile.GetString("Preview", "Size"), 2, c)); @@ -1271,10 +1244,8 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) int mapwidth = GetWidth(); int mapheight = GetHeight(); int e; - for (i = 0;i < biinfo.bmiHeader.biWidth;i++) - { - for (e = 0;e < biinfo.bmiHeader.biHeight;e++) - { + for (i = 0; i < biinfo.bmiHeader.biWidth; i++) { + for (e = 0; e < biinfo.bmiHeader.biHeight; e++) { int dest = i * 3 + e * biinfo.bmiHeader.biWidth * 3; int src = i * 3 + (biinfo.bmiHeader.biHeight - e - 1) * pitch; memcpy(&lpRAW[dest + 2], &lpDibData[src + 0], 1); @@ -1296,8 +1267,7 @@ void CMapData::Pack(BOOL bCreatePreview, BOOL bCompression) i = 0; pos = 0; - while (TRUE) - { + while (TRUE) { i++; char cLine[50]; itoa(i, cLine, 10); @@ -1366,8 +1336,8 @@ void CMapData::SetOverlayAt(DWORD dwPos, BYTE bValue) AddOvrlMoney(ovrl2, ovrld2); int i, e; - for (i = -1;i < 2;i++) - for (e = -1;e < 2;e++) + for (i = -1; i < 2; i++) + for (e = -1; e < 2; e++) if (i + x > 0 && i + x < m_IsoSize && y + e >= 0 && y + e < m_IsoSize) SmoothTiberium(dwPos + i + e * m_IsoSize); @@ -1398,26 +1368,22 @@ void CMapData::SetOverlayDataAt(DWORD dwPos, BYTE bValue) BYTE& ovrl = m_Overlay[y + x * 512]; BYTE& ovrld = m_OverlayData[y + x * 512]; - if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) - { + if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) { //m_money-=(ovrld+1)*(atoi(rules.sections["Riparius"].values["Value"])); return; } - if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) - { + if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) { //m_money-=(ovrld+1)*(atoi(rules.sections["Cruentus"].values["Value"])); return; } - if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) - { + if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) { //m_money-=(ovrld+1)*(atoi(rules.sections["Vinifera"].values["Value"])); return; } - if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) - { + if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) { //m_money-=(ovrld+1)*(atoi(rules.sections["Aboreus"].values["Value"])); return; } @@ -1473,10 +1439,9 @@ void CMapData::UpdateInfantry(BOOL bSave) iv.reserve(100); int i; - for (i = 0;i < GetIsoSize() * GetIsoSize();i++) - { + for (i = 0; i < GetIsoSize() * GetIsoSize(); i++) { int e; - for (e = 0;e < SUBPOS_COUNT;e++) + for (e = 0; e < SUBPOS_COUNT; e++) fielddata[i].infantry[e] = -1; } @@ -1531,9 +1496,9 @@ void CMapData::UpdateInfantry(BOOL bSave) } return; } - + // do save - + m_mapfile.DeleteSection("Infantry"); int i; @@ -1619,11 +1584,9 @@ void CMapData::UpdateStructures(BOOL bSave) int d, e; int bid = buildingid[GetParam(val, 1)]; for (d = 0; d < buildinginfo[bid].h; d++) { - for (e = 0; e < buildinginfo[bid].w; e++) - { + for (e = 0; e < buildinginfo[bid].w; e++) { int pos = (x + d) + (y + e) * GetIsoSize(); - if (pos < fielddata_size) - { + if (pos < fielddata_size) { fielddata[pos].structure = i; fielddata[pos].structuretype = bid; } @@ -1698,13 +1661,11 @@ void CMapData::UpdateTerrain(BOOL bSave, int num) y = td.y; itoa(y, j1, 10); - if (strlen(j1) < 3) - { + if (strlen(j1) < 3) { strcpy_safe(j1 + 1, j1); j1[0] = '0'; } - if (strlen(j1) < 3) - { + if (strlen(j1) < 3) { strcpy_safe(j1 + 1, j1); j1[0] = '0'; } @@ -1722,7 +1683,7 @@ void CMapData::UpdateUnits(BOOL bSave) { if (bSave == FALSE) { int i; - for (i = 0;i < GetIsoSize() * GetIsoSize();i++) { + for (i = 0; i < GetIsoSize() * GetIsoSize(); i++) { fielddata[i].unit = -1; } @@ -1810,14 +1771,11 @@ void CMapData::UpdateNodes(BOOL bSave) void CMapData::UpdateOverlay(BOOL bSave) { - if (bSave == FALSE) - { + if (bSave == FALSE) { int u, v; const bool mp = IsMultiplayer(); - for (u = 0;u < GetIsoSize();u++) - { - for (v = 0;v < GetIsoSize();v++) - { + for (u = 0; u < GetIsoSize(); u++) { + for (v = 0; v < GetIsoSize(); v++) { fielddata[u + v * GetIsoSize()].overlay = m_Overlay[v + u * 512]; fielddata[u + v * GetIsoSize()].overlaydata = m_OverlayData[v + u * 512]; @@ -1825,14 +1783,10 @@ void CMapData::UpdateOverlay(BOOL bSave) } } - } - else - { + } else { int u, v; - for (u = 0;u < GetIsoSize();u++) - { - for (v = 0;v < GetIsoSize();v++) - { + for (u = 0; u < GetIsoSize(); u++) { + for (v = 0; v < GetIsoSize(); v++) { m_Overlay[v + u * 512] = fielddata[u + v * GetIsoSize()].overlay; m_OverlayData[v + u * 512] = fielddata[u + v * GetIsoSize()].overlaydata; } @@ -1884,8 +1838,7 @@ void CMapData::DeleteInfantry(DWORD dwIndex) // BUG TRACING HERE, FOR THE COPY INSTEAD MOVE INFANTRY BUG! // SOLUTION WAS IN ADDINFANTRY(); - if (m_infantry[dwIndex].deleted) - { + if (m_infantry[dwIndex].deleted) { //MessageBox(0,"CMapData::DeleteInfantry() called for infantry that already got deleted!", "Error",0); errstream << "CMapData::DeleteInfantry() called for infantry that already got deleted! Index: " << dwIndex << endl; errstream.flush(); @@ -1935,14 +1888,14 @@ void CMapData::DeleteWaypoint(DWORD dwIndex) ASSERT(pSec != nullptr); pSec->RemoveAt(dwIndex); - + if (!m_noAutoObjectUpdate) { UpdateWaypoints(FALSE); } int k, l; - for (k = -1;k < 2;k++) - for (l = -1;l < 2;l++) + for (k = -1; k < 2; k++) + for (l = -1; l < 2; l++) Mini_UpdatePos(x + k, y + l, IsMultiplayer()); } @@ -2000,8 +1953,8 @@ void CMapData::DeleteStructure(DWORD dwIndex) int d, e; int bid = buildingid[type]; - for (d = 0;d < buildinginfo[bid].h;d++) { - for (e = 0;e < buildinginfo[bid].w;e++) { + for (d = 0; d < buildinginfo[bid].h; d++) { + for (e = 0; e < buildinginfo[bid].w; e++) { int pos = (x + d) + (y + e) * GetIsoSize(); Mini_UpdatePos(x + d, y + e, IsMultiplayer()); @@ -2047,8 +2000,7 @@ void CMapData::DeleteTerrain(DWORD dwIndex) m_terrain[dwIndex].deleted = 1; int pos = x + y * GetIsoSize(); - if (x + y * m_IsoSize < fielddata_size) - { + if (x + y * m_IsoSize < fielddata_size) { fielddata[pos].terrain = -1; fielddata[pos].terraintype = -1; } @@ -2092,13 +2044,11 @@ BOOL CMapData::AddWaypoint(CString lpID, DWORD dwPos) memset(j, 0, 15); memset(k, 0, 15); itoa(dwPos / GetIsoSize(), j, 10); - if (strlen(j) < 3) - { + if (strlen(j) < 3) { strcpy_safe(j + 1, j); j[0] = '0'; } - if (strlen(j) < 3) - { + if (strlen(j) < 3) { strcpy_safe(j + 1, j); j[0] = '0'; } @@ -2119,7 +2069,7 @@ BOOL CMapData::AddWaypoint(CString lpID, DWORD dwPos) void CMapData::GetStructureData(DWORD dwIndex, STRUCTURE* lpStructure) const -{ +{ auto const& section = m_mapfile.GetSection("Structures"); if (dwIndex >= section.Size()) { return; @@ -2165,12 +2115,9 @@ void CMapData::GetStdStructureData(DWORD dwIndex, STDOBJECTDATA* lpStdStructure) BOOL CMapData::AddNode(NODE* lpNode, WORD dwPos) { NODE node; - if (lpNode != NULL) - { + if (lpNode != NULL) { node = *lpNode; - } - else - { + } else { node.x.Format("%d", dwPos % Map->GetIsoSize()); node.y.Format("%d", dwPos / Map->GetIsoSize()); node.house = GetHouseID(0); @@ -2206,17 +2153,14 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse { INFANTRY infantry; - if (lpInfantry != NULL) - { + if (lpInfantry != NULL) { infantry = *lpInfantry; dwPos = atoi(infantry.x) + atoi(infantry.y) * Map->GetIsoSize(); // MW Bugfix: not checking if infantry.pos does already exist caused crashes with user scripts! if (GetInfantryAt(dwPos, atoi(infantry.pos)) >= 0) infantry.pos = "-1"; - } - else - { + } else { char cx[10], cy[10]; itoa(dwPos % Map->GetIsoSize(), cx, 10); itoa(dwPos / Map->GetIsoSize(), cy, 10); @@ -2241,26 +2185,21 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse } - if (infantry.pos == "-1") - { + if (infantry.pos == "-1") { int subpos = -1; int i; if (GetInfantryCountAt(dwPos) == 0) subpos = 0; - else - { + else { int oldInf = GetInfantryAt(dwPos, 0); - if (oldInf > -1) - { + if (oldInf > -1) { INFANTRY inf; GetInfantryData(oldInf, &inf); if (inf.pos == "0") - for (i = 1;i < SUBPOS_COUNT;i++) - { - if (GetInfantryAt(dwPos, i) == -1) - { + for (i = 1; i < SUBPOS_COUNT; i++) { + if (GetInfantryAt(dwPos, i) == -1) { //subpos=i+1; char c[50]; @@ -2276,10 +2215,8 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse // if(GetInfantryAt(dwPos, 0)==oldInf) return FALSE; - for (i = 0;i < SUBPOS_COUNT;i++) - { - if (GetInfantryAt(dwPos, i) == -1) - { + for (i = 0; i < SUBPOS_COUNT; i++) { + if (GetInfantryAt(dwPos, i) == -1) { subpos = i + 1; break; } @@ -2328,10 +2265,8 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse int i; BOOL bFound = FALSE; - if (suggestedIndex >= 0 && suggestedIndex < m_infantry.size()) - { - if (m_infantry[suggestedIndex].deleted) - { + if (suggestedIndex >= 0 && suggestedIndex < m_infantry.size()) { + if (m_infantry[suggestedIndex].deleted) { m_infantry[suggestedIndex] = infantry; if (dwPos < fielddata_size) fielddata[dwPos].infantry[sp] = suggestedIndex; bFound = TRUE; @@ -2340,8 +2275,7 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse } if (!bFound) - for (i = 0;i < m_infantry.size();i++) - { + for (i = 0; i < m_infantry.size(); i++) { if (m_infantry[i].deleted) // yep, found one, replace it { m_infantry[i] = infantry; @@ -2351,8 +2285,7 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse } } - if (!bFound) - { + if (!bFound) { m_infantry.push_back(infantry); if (dwPos < fielddata_size) fielddata[dwPos].infantry[sp] = m_infantry.size() - 1; } @@ -2364,12 +2297,9 @@ BOOL CMapData::AddInfantry(INFANTRY* lpInfantry, LPCTSTR lpType, LPCTSTR lpHouse BOOL CMapData::AddStructure(STRUCTURE* lpStructure, LPCTSTR lpType, LPCTSTR lpHouse, DWORD dwPos, CString suggestedID) { STRUCTURE structure; - if (lpStructure != NULL) - { + if (lpStructure != NULL) { structure = *lpStructure; - } - else - { + } else { char cx[10], cy[10]; itoa(dwPos % Map->GetIsoSize(), cx, 10); itoa(dwPos / Map->GetIsoSize(), cy, 10); @@ -2505,7 +2435,7 @@ void CMapData::GetInfantryData(DWORD dwIndex, INFANTRY* lpInfantry) const lpInfantry->flag3=m_infantry.; lpInfantry->flag4=m_infantry.; lpInfantry->flag5=m_infantry.;*/ - *lpInfantry = m_infantry[dwIndex]; + * lpInfantry = m_infantry[dwIndex]; //memcpy(lpInfantry, &m_infantry[dwIndex], sizeof(INFANTRY)); @@ -2589,13 +2519,11 @@ BOOL CMapData::AddCelltag(LPCTSTR lpTag, DWORD dwPos) memset(j, 0, 15); memset(k, 0, 15); itoa(dwPos / GetIsoSize(), j, 10); - if (strlen(j) < 3) - { + if (strlen(j) < 3) { strcpy_safe(j + 1, j); j[0] = '0'; } - if (strlen(j) < 3) - { + if (strlen(j) < 3) { strcpy_safe(j + 1, j); j[0] = '0'; } @@ -2628,12 +2556,9 @@ BOOL CMapData::AddAircraft(AIRCRAFT* lpAircraft, LPCTSTR lpType, LPCTSTR lpHouse { AIRCRAFT aircraft; - if (lpAircraft != NULL) - { + if (lpAircraft != NULL) { aircraft = *lpAircraft; - } - else - { + } else { char sx[15], sy[15]; itoa(dwPos % GetIsoSize(), sx, 10); itoa(dwPos / GetIsoSize(), sy, 10); @@ -2676,12 +2601,9 @@ BOOL CMapData::AddUnit(UNIT* lpUnit, LPCTSTR lpType, LPCTSTR lpHouse, DWORD dwPo { UNIT unit; - if (lpUnit != NULL) - { + if (lpUnit != NULL) { unit = *lpUnit; - } - else - { + } else { char sx[15], sy[15]; itoa(dwPos % GetIsoSize(), sx, 10); itoa(dwPos / GetIsoSize(), sy, 10); @@ -2783,13 +2705,10 @@ BOOL CMapData::AddTerrain(LPCTSTR lpType, DWORD dwPos, int suggestedIndex) BOOL bFound = FALSE; - if (suggestedIndex >= 0 && suggestedIndex < m_terrain.size()) - { - if (m_terrain[suggestedIndex].deleted) - { + if (suggestedIndex >= 0 && suggestedIndex < m_terrain.size()) { + if (m_terrain[suggestedIndex].deleted) { m_terrain[suggestedIndex] = td; - if (dwPos < fielddata_size) - { + if (dwPos < fielddata_size) { fielddata[dwPos].terrain = suggestedIndex; fielddata[dwPos].terraintype = terrainid[lpType]; } @@ -2800,13 +2719,11 @@ BOOL CMapData::AddTerrain(LPCTSTR lpType, DWORD dwPos, int suggestedIndex) int i; if (!bFound) - for (i = 0;i < m_terrain.size();i++) - { + for (i = 0; i < m_terrain.size(); i++) { if (m_terrain[i].deleted) // yep, found one, replace it { m_terrain[i] = td; - if (dwPos < fielddata_size) - { + if (dwPos < fielddata_size) { fielddata[dwPos].terrain = i; fielddata[dwPos].terraintype = terrainid[lpType]; } @@ -2815,12 +2732,10 @@ BOOL CMapData::AddTerrain(LPCTSTR lpType, DWORD dwPos, int suggestedIndex) } } - if (!bFound) - { + if (!bFound) { m_terrain.push_back(td); int pos = x + y * GetIsoSize(); - if (pos < fielddata_size) - { + if (pos < fielddata_size) { fielddata[pos].terrain = m_terrain.size() - 1; fielddata[pos].terraintype = terrainid[lpType]; } @@ -2955,8 +2870,8 @@ WCHAR* CMapData::GetUnitName(LPCTSTR lpID) const return res; } - if (CCStrings.find(lpID) != CCStrings.end() && CCStrings[lpID].len > 0) { - res = CCStrings[lpID].wString; + if (CCStrings.find(lpID) != CCStrings.end() && CCStrings[lpID].len > 0) { + res = CCStrings[lpID].wString; } if (!res) { @@ -3010,7 +2925,7 @@ void CMapData::DeleteRulesSections() } // now delete these types lists... - for (auto it = m_mapfile.begin(); it != m_mapfile.end();) { + for (auto it = m_mapfile.begin(); it != m_mapfile.end();) { auto const& name = it->first; if (IsRulesSection(name)) { // special care for deletion, this is a deletion in a loop @@ -3112,8 +3027,7 @@ void CMapData::ImportRUL(LPCTSTR lpFilename) void CMapData::UpdateMapFieldData(BOOL bSave) { - if (bSave == FALSE) - { + if (bSave == FALSE) { int i; int e; /*for(i=0;iwY + mfd->wX * GetIsoSize(); if (dwIsoMapSize - i < 50) errstream << mfd->wY << " " << mfd->wX << endl; - if (pos < (GetIsoSize() + 1) * (GetIsoSize() + 1)) - { + if (pos < (GetIsoSize() + 1) * (GetIsoSize() + 1)) { fielddata[pos].wGround = mfd->wGround; fielddata[pos].bHeight = mfd->bHeight; memcpy(&fielddata[pos].bMapData, mfd->bData, 3); @@ -3204,8 +3116,7 @@ void CMapData::UpdateMapFieldData(BOOL bSave) errstream.flush(); }*/ - } - else // if(mfd->wY==0xFFFE && mfd->wX==0xFFFE) + } else // if(mfd->wY==0xFFFE && mfd->wX==0xFFFE) { char c[2]; c[0] = mfd->bHeight; @@ -3239,20 +3150,15 @@ void CMapData::UpdateMapFieldData(BOOL bSave) } - for (i = 0;i < m_IsoSize;i++) - { - for (e = 0;e < m_IsoSize;e++) - { + for (i = 0; i < m_IsoSize; i++) { + for (e = 0; e < m_IsoSize; e++) { int pos = i + e * m_IsoSize; int xx, yy; fielddata[pos].bRedrawTerrain = FALSE; - for (xx = -2;xx < 0;xx++) - { - for (yy = -2;yy < 0;yy++) - { + for (xx = -2; xx < 0; xx++) { + for (yy = -2; yy < 0; yy++) { int npos = pos + xx + yy * m_IsoSize; - if (npos > 0 && fielddata[pos].bHeight - fielddata[npos].bHeight >= 4) - { + if (npos > 0 && fielddata[pos].bHeight - fielddata[npos].bHeight >= 4) { fielddata[pos].bRedrawTerrain = TRUE; break; } @@ -3261,9 +3167,7 @@ void CMapData::UpdateMapFieldData(BOOL bSave) } } } - } - else - { + } else { int x, y, n = 0; // this code here must be improved to produce smaller maps. Just ignore the data outside the visible rect! @@ -3288,10 +3192,8 @@ void CMapData::UpdateMapFieldData(BOOL bSave) //#ifdef UNUSED int dwX, dwY; - for (dwX = 0;dwX <= m_IsoSize;dwX++) - { - for (dwY = 0;dwY <= m_IsoSize;dwY++) - { + for (dwX = 0; dwX <= m_IsoSize; dwX++) { + for (dwY = 0; dwY <= m_IsoSize; dwY++) { /*for(i=0;i= 0 && n < 0x0F00) - { + if (n >= 0 && n < 0x0F00) { treeinfo[n].w = foundation.Width; treeinfo[n].h = foundation.Height; CString lpPicFile = GetUnitPictureFilename(type, 0); - if (pics.find(lpPicFile) != pics.end()) - { + if (pics.find(lpPicFile) != pics.end()) { treeinfo[n].pic = pics[lpPicFile]; - } - else + } else treeinfo[n].pic.pic = NULL; } @@ -3726,18 +3619,15 @@ void CMapData::UpdateTreeInfo(const CString* lpTreeType) int n = Map->GetUnitTypeID(type); - if (n >= 0 && n < 0x0F00) - { + if (n >= 0 && n < 0x0F00) { treeinfo[n].w = foundation.Width; treeinfo[n].h = foundation.Height; CString lpPicFile = GetUnitPictureFilename(type, 0); - if (pics.find(lpPicFile) != pics.end()) - { + if (pics.find(lpPicFile) != pics.end()) { treeinfo[n].pic = pics[lpPicFile]; - } - else + } else treeinfo[n].pic.pic = NULL; } @@ -3783,8 +3673,7 @@ MAPFIELDDATA* CMapData::GetMappackPointer(DWORD dwPos) int y = dwPos / GetIsoSize(); int i = 0; - for (i = 0;i < dwIsoMapSize;i++) - { + for (i = 0; i < dwIsoMapSize; i++) { MAPFIELDDATA* cur = (MAPFIELDDATA*)&m_mfd[i * MAPFIELDDATA_SIZE]; if (cur->wX == y && cur->wY == x) return cur; @@ -3800,8 +3689,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D delete[] fielddata; } int i; - for (i = 0;i < dwSnapShotCount;i++) - { + for (i = 0; i < dwSnapShotCount; i++) { delete[] m_snapshots[i].bHeight; delete[] m_snapshots[i].bMapData; delete[] m_snapshots[i].bSubTile; @@ -3873,22 +3761,15 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D m_mapfile.SetString("Map", "LocalSize", mapsize); map::iterator it = pics.begin(); - for (int e = 0;e < pics.size();e++) - { - try - { + for (int e = 0; e < pics.size(); e++) { + try { #ifdef NOSURFACES_OBJECTS - if (it->second.bType == PICDATA_TYPE_BMP) - { - if (it->second.pic != NULL) - { + if (it->second.bType == PICDATA_TYPE_BMP) { + if (it->second.pic != NULL) { ((LPDIRECTDRAWSURFACE4)it->second.pic)->Release(); } - } - else - { - if (it->second.pic != NULL) - { + } else { + if (it->second.pic != NULL) { delete[] it->second.pic; } if (it->second.vborder) delete[] it->second.vborder; @@ -3898,9 +3779,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D #endif it->second.pic = NULL; - } - catch (...) - { + } catch (...) { CString err; err = "Access violation while trying to release surface "; char c[6]; @@ -3916,8 +3795,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D } std::unique_ptr dlg; - if (theApp.m_pMainWnd) - { + if (theApp.m_pMainWnd) { dlg.reset(new CDynamicGraphDlg(theApp.m_pMainWnd)); dlg->ShowWindow(SW_SHOW); dlg->UpdateWindow(); @@ -3929,8 +3807,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D UpdateBuildingInfo(); UpdateTreeInfo(); - if (theApp.m_loading) - { + if (theApp.m_loading) { theApp.m_loading->Unload(); theApp.m_loading->InitMixFiles(); @@ -3971,8 +3848,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D theApp.m_loading->InitTMPs(&dlg->m_Progress); theApp.m_loading->cur_theat = 'T'; - } - else if (theaterType == THEATER1) { + } else if (theaterType == THEATER1) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -4003,8 +3879,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D if (dlg) theApp.m_loading->InitTMPs(&dlg->m_Progress); theApp.m_loading->cur_theat = 'A'; - } - else if (theaterType == THEATER2) { + } else if (theaterType == THEATER2) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -4035,8 +3910,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D if (dlg) theApp.m_loading->InitTMPs(&dlg->m_Progress); theApp.m_loading->cur_theat = 'U'; - } - else if (yuri_mode && theaterType == THEATER3) { + } else if (yuri_mode && theaterType == THEATER3) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -4070,8 +3944,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D if (dlg) theApp.m_loading->InitTMPs(&dlg->m_Progress); theApp.m_loading->cur_theat = 'N'; - } - else if (yuri_mode && theaterType == THEATER4) { + } else if (yuri_mode && theaterType == THEATER4) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -4102,13 +3975,11 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D tiles = &tiles_l; theApp.m_loading->FreeTileSet(); - if (dlg) - { + if (dlg) { theApp.m_loading->InitTMPs(&dlg->m_Progress); } theApp.m_loading->cur_theat = 'L'; - } - else if (theaterType == THEATER5) { + } else if (theaterType == THEATER5) { tiledata = &t_tiledata; tiledata_count = &t_tiledata_count; tiles = &tiles_t; @@ -4143,16 +4014,14 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D if (dlg) theApp.m_loading->InitTMPs(&dlg->m_Progress); theApp.m_loading->cur_theat = 'D'; - } - else { + } else { theApp.m_loading->FreeAll(); CString s = "Fatal error! %9 doesn´t support the theater of this map!"; s = TranslateStringACP(s); MessageBox(0, s, "Error", 0); exit(0); } - } - else { + } else { // e.g. unittests tiles = &tiles_t; } @@ -4190,8 +4059,7 @@ void CMapData::CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, D errstream.flush(); - for (i = 0;i < fielddata_size;i++) - { + for (i = 0; i < fielddata_size; i++) { fielddata[i].bHeight = dwGroundHeight; } @@ -4463,9 +4331,8 @@ void CMapData::SetTube(CTube* lpTI) CString sTubeId; if (lpTI->hasId()) { sTubeId = std::to_string(lpTI->getId()).c_str(); - } - else { - for (std::uint16_t i = 0;i < 10000;i++) { + } else { + for (std::uint16_t i = 0; i < 10000; i++) { sTubeId = std::to_string(i).c_str(); if (!m_mapfile["Tubes"].Exists(sTubeId)) { lpTI->setId(i); @@ -4484,7 +4351,7 @@ void CMapData::SetTube(CTube* lpTI) CTube* CMapData::GetTube(std::uint16_t wID) { - auto it = std::find_if(m_tubes.begin(), m_tubes.end(), [wID](const auto& el) {return el->getId() == wID;}); + auto it = std::find_if(m_tubes.begin(), m_tubes.end(), [wID](const auto& el) {return el->getId() == wID; }); if (it == m_tubes.end()) { return nullptr; } @@ -4532,8 +4399,7 @@ int CMapData::GetInfantryCountAt(DWORD dwPos) { int i; int sc = 0; - for (i = 0;i < SUBPOS_COUNT;i++) - { + for (i = 0; i < SUBPOS_COUNT; i++) { if (fielddata[dwPos].infantry[i] > -1) sc++; } @@ -4548,8 +4414,7 @@ or if loading maps made with modified tilesets BOOL CMapData::CheckMapPackData() { int i; - for (i = 0;i < fielddata_size;i++) - { + for (i = 0; i < fielddata_size; i++) { int gr = fielddata[i].wGround; if (gr != 0xFFFF && gr >= (*tiledata_count)) return FALSE; @@ -4581,10 +4446,8 @@ void CMapData::TakeSnapshot(BOOL bEraseFollowing, int left, int top, int right, if (bottom == 0) bottom = m_IsoSize; int e; - if (bEraseFollowing) - { - for (e = dwSnapShotCount - 1;e > m_cursnapshot;e--) - { + if (bEraseFollowing) { + for (e = dwSnapShotCount - 1; e > m_cursnapshot; e--) { delete[] m_snapshots[e].bHeight; delete[] m_snapshots[e].bMapData; delete[] m_snapshots[e].bSubTile; @@ -4603,8 +4466,7 @@ void CMapData::TakeSnapshot(BOOL bEraseFollowing, int left, int top, int right, dwSnapShotCount += 1; m_cursnapshot++; - if (dwSnapShotCount > 64) - { + if (dwSnapShotCount > 64) { dwSnapShotCount = 64; m_cursnapshot = 63; int i; @@ -4618,18 +4480,14 @@ void CMapData::TakeSnapshot(BOOL bEraseFollowing, int left, int top, int right, delete[] m_snapshots[0].bRedrawTerrain; delete[] m_snapshots[0].bRNDData; // m_snapshots[0].mapfile.Clear(); - for (i = 1;i < dwSnapShotCount;i++) - { + for (i = 1; i < dwSnapShotCount; i++) { m_snapshots[i - 1] = m_snapshots[i]; } - } - else - { + } else { SNAPSHOTDATA* b = new(SNAPSHOTDATA[dwSnapShotCount]); - if (m_snapshots) - { + if (m_snapshots) { memcpy(b, m_snapshots, sizeof(SNAPSHOTDATA) * (dwSnapShotCount - 1)); delete[] m_snapshots; } @@ -4662,10 +4520,8 @@ void CMapData::TakeSnapshot(BOOL bEraseFollowing, int left, int top, int right, ss.bRedrawTerrain = new(BOOL[size]); ss.bRNDData = new(BYTE[size]); int i; - for (i = 0;i < width;i++) - { - for (e = 0;e < height;e++) - { + for (i = 0; i < width; i++) { + for (e = 0; e < height; e++) { int pos_w, pos_r; pos_w = i + e * width; pos_r = left + i + (top + e) * m_IsoSize; @@ -4706,10 +4562,8 @@ void CMapData::Undo() const bool mp = IsMultiplayer(); int i, e; - for (i = 0;i < width;i++) - { - for (e = 0;e < height;e++) - { + for (i = 0; i < width; i++) { + for (e = 0; e < height; e++) { int pos_w, pos_r; pos_r = i + e * width; pos_w = left + i + (top + e) * m_IsoSize; @@ -4772,10 +4626,8 @@ void CMapData::Redo() int i, e; const bool mp = IsMultiplayer(); - for (i = 0;i < width;i++) - { - for (e = 0;e < height;e++) - { + for (i = 0; i < width; i++) { + for (e = 0; e < height; e++) { int pos_w, pos_r; pos_r = i + e * width; pos_w = left + i + (top + e) * m_IsoSize; @@ -4941,10 +4793,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7001; // remove partial shore pieces (wrong ones) - for (xx = left - 2;xx < right + 2;xx++) - { - for (yy = top - 2;yy < bottom + 2;yy++) - { + for (xx = left - 2; xx < right + 2; xx++) { + for (yy = top - 2; yy < bottom + 2; yy++) { if (xx < 1 || yy < 1 || xx + yymapwidth + mapheight * 2 || (yy + 1 > mapwidth && xx - 1 < yy - mapwidth) || (xx + 1 > mapwidth && yy + mapwidth - 1 < xx)) continue; @@ -4968,19 +4818,15 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int xxx, yyy; int p = 0; - for (xxx = xx - ox;xxx < xx + td.cx - ox;xxx++) - { - for (yyy = yy - oy;yyy < yy + td.cy - oy;yyy++) - { + for (xxx = xx - ox; xxx < xx + td.cx - ox; xxx++) { + for (yyy = yy - oy; yyy < yy + td.cy - oy; yyy++) { int pos = xxx + yyy * isosize; - if (td.tiles[p].pic != NULL) - { + if (td.tiles[p].pic != NULL) { FIELDDATA* curf = Map->GetFielddataAt(pos); int curg = curf->wGround; if (curg == 0xFFFF) curg = 0; - if (curg != ground || curf->bSubTile != p) - { + if (curg != ground || curf->bSubTile != p) { bCorrect = FALSE; break; } @@ -4990,8 +4836,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (!bCorrect) break; } - if (!bCorrect) - { + if (!bCorrect) { int iWaterFound = 0; /*for(xxx=xx-1;xxx<=xx+1;xxx++) { @@ -5017,18 +4862,14 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if ((*tiledata)[curg].tiles[curf->bSubTile].bHackedTerrainType == TERRAINTYPE_WATER) iWaterFound = 8; - if (iWaterFound > 7) - { - for (i = 0;i < *tiledata_count;i++) - { + if (iWaterFound > 7) { + for (i = 0; i < *tiledata_count; i++) { if ((*tiledata)[i].wTileSet == waterset && (*tiledata)[i].cx == 1 && (*tiledata)[i].cy == 1) break; } SetTileAt(xx + yy * isosize, i, 0); noChange[xx + yy * isosize] = FALSE; //replaced[xx+yy*isosize]=TRUE; - } - else - { + } else { SetTileAt(xx + yy * isosize, 0, 0); noChange[xx + yy * isosize] = FALSE; //replaced[xx+yy*isosize]=TRUE; @@ -5041,12 +4882,9 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov // remove too small water and ground pieces (NEW) - if (bRemoveUseless) - { - for (xx = left;xx < right;xx++) - { - for (yy = top;yy < bottom;yy++) - { + if (bRemoveUseless) { + for (xx = left; xx < right; xx++) { + for (yy = top; yy < bottom; yy++) { if (xx < 1 || yy < 1 || xx + yymapwidth + mapheight * 2 || (yy + 1 > mapwidth && xx - 1 < yy - mapwidth) || (xx + 1 > mapwidth && yy + mapwidth - 1 < xx)) continue; @@ -5065,17 +4903,12 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int ts[3][3]; // terrain info int i, e; - for (i = 0;i < 3; i++) - { - for (e = 0;e < 3;e++) - { + for (i = 0; i < 3; i++) { + for (e = 0; e < 3; e++) { int pos = dwPos + (i - 1) + (e - 1) * m_IsoSize; - if (pos < 0 || pos >= fielddata_size) - { + if (pos < 0 || pos >= fielddata_size) { ts[i][e] = 0; - } - else - { + } else { FIELDDATA m2 = *GetFielddataAt(pos); if (m2.wGround == 0xFFFF) m2.wGround = 0; @@ -5086,17 +4919,12 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if ((ts[1][0] != ts[1][1] && ts[1][2] != ts[1][1]) || - (ts[0][1] != ts[1][1] && ts[2][1] != ts[1][1])) - { - if (ts[1][1] == TERRAINTYPE_WATER) - { + (ts[0][1] != ts[1][1] && ts[2][1] != ts[1][1])) { + if (ts[1][1] == TERRAINTYPE_WATER) { SetTileAt(dwPos, 0, 0); //replaced[dwPos]=TRUE; - } - else if (ts[1][1] == TERRAINTYPE_GROUND) - { - if ((ts[1][0] == TERRAINTYPE_WATER && ts[1][2] == TERRAINTYPE_WATER) || (ts[0][1] == TERRAINTYPE_WATER && ts[2][1] == TERRAINTYPE_WATER)) - { + } else if (ts[1][1] == TERRAINTYPE_GROUND) { + if ((ts[1][0] == TERRAINTYPE_WATER && ts[1][2] == TERRAINTYPE_WATER) || (ts[0][1] == TERRAINTYPE_WATER && ts[2][1] == TERRAINTYPE_WATER)) { SetTileAt(dwPos, smallwater, 0); //replaced[dwPos]=TRUE; } @@ -5111,10 +4939,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7003; // retrieve non-changeable fields - for (xx = left;xx < right;xx++) - { - for (yy = top;yy < bottom;yy++) - { + for (xx = left; xx < right; xx++) { + for (yy = top; yy < bottom; yy++) { if (xx < 1 || yy < 1 || xx + yymapwidth + mapheight * 2 || (yy + 1 > mapwidth && xx - 1 < yy - mapwidth) || (xx + 1 > mapwidth && yy + mapwidth - 1 < xx)) continue; int pos = xx + yy * isosize; @@ -5126,11 +4952,9 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov terrain[pos] = (*tiledata)[ground].tiles[fd->bSubTile].bHackedTerrainType; tile[pos] = ground; - if (xx >= left && xx < right && yy >= top && yy < bottom) - { + if (xx >= left && xx < right && yy >= top && yy < bottom) { - if (softsets.find((*tiledata)[ground].wTileSet) == softsets.end()/*(*tiledata)[ground].wTileSet==cliffset || (*tiledata)[ground].wTileSet==watercliffset*/) - { + if (softsets.find((*tiledata)[ground].wTileSet) == softsets.end()/*(*tiledata)[ground].wTileSet==cliffset || (*tiledata)[ground].wTileSet==watercliffset*/) { noChange[pos] = TRUE; continue; } @@ -5138,15 +4962,13 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov TILEDATA& td = (*tiledata)[ground]; - if (td.wTileSet == shoreset) - { + if (td.wTileSet == shoreset) { int of = fd->bSubTile; int ox = of / td.cy; int oy = of % td.cy; - if (xx - ox < left || yy - oy < top || xx - ox + td.cx >= right || yy - oy + td.cy >= bottom) - { + if (xx - ox < left || yy - oy < top || xx - ox + td.cx >= right || yy - oy + td.cy >= bottom) { /*if(!replaced[pos])*/ noChange[pos] = TRUE; } } @@ -5169,10 +4991,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int tStart, tEnd; tStart = -1; tEnd = 0; - for (i = 0;i < *tiledata_count;i++) - { - if ((*tiledata)[i].wTileSet == shoreset) - { + for (i = 0; i < *tiledata_count; i++) { + if ((*tiledata)[i].wTileSet == shoreset) { if (tStart < 0) tStart = i; if (i > tEnd) tEnd = i; } @@ -5185,14 +5005,12 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7004; - for (i = tStart;i <= tEnd;i++) - { + for (i = tStart; i <= tEnd; i++) { /*pc.SetPos(i-tStart); pc.UpdateWindow();*/ TILEDATA& td = (*tiledata)[i]; - if (td.wTileSet == shoreset) - { + if (td.wTileSet == shoreset) { int pos = i - tStart; if (pos != 4 && pos != 5 && pos != 12 && pos != 13 && pos != 20 && pos != 21 && pos != 28 && pos != 29 && pos != 6 && pos != 7 && pos != 14 && pos != 15 && pos != 22 && pos != 23 && pos != 30 && pos != 31 && (pos < 32 || pos>39)) @@ -5201,10 +5019,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int x, y; int water_count = 0; int p = 0; - for (x = 0;x < td.cx;x++) - { - for (y = 0;y < td.cy;y++) - { + for (x = 0; x < td.cx; x++) { + for (y = 0; y < td.cy; y++) { if (td.tiles[p].bHackedTerrainType == TERRAINTYPE_WATER) water_count++; p++; @@ -5216,10 +5032,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int max_x = td.cx < 16 ? td.cx : 16; int max_y = td.cy < 16 ? td.cy : 16; - for (x = left;x < right;x++) - { - for (y = top;y < bottom;y++) - { + for (x = left; x < right; x++) { + for (y = top; y < bottom; y++) { last_succeeded_operation = 7010; int xx, yy; @@ -5247,10 +5061,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov BOOL bFits = TRUE; int p = 0; - for (xx = x;xx < x + max_x;xx++) - { - for (yy = y;yy < y + max_y;yy++) - { + for (xx = x; xx < x + max_x; xx++) { + for (yy = y; yy < y + max_y; yy++) { if (xx >= isosize || yy >= isosize) continue; @@ -5326,10 +5138,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7011; - if (xadd && yadd) - { - if (tsets[xx + xadd + yy * isosize] == waterset || tsets[xx + (yy + yadd) * isosize] == waterset) - { + if (xadd && yadd) { + if (tsets[xx + xadd + yy * isosize] == waterset || tsets[xx + (yy + yadd) * isosize] == waterset) { bFits = FALSE; break; } @@ -5343,15 +5153,12 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov BYTE& tile_t = td.tiles[p].bHackedTerrainType; - if (tsets[pos_data] == shoreset) - { + if (tsets[pos_data] == shoreset) { if (hasChanged[pos_data]) // only cancel if this routine set the shore { // curves are preferred - if ((max_x != 2 || max_y != 2 || water_count != 3)) - { - if (!((max_x == 3 && max_y == 2) || (max_x == 2 && max_y == 3))) - { + if ((max_x != 2 || max_y != 2 || water_count != 3)) { + if (!((max_x == 3 && max_y == 2) || (max_x == 2 && max_y == 3))) { bFits = FALSE; break; } @@ -5364,8 +5171,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7012; // one step curves - if (noChange[pos_data]) - { + if (noChange[pos_data]) { bFits = FALSE; break; } @@ -5375,15 +5181,11 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (tile[pos_data] <= tEnd && tile[pos_data] >= tEnd - 2) bFits = FALSE; - if (tile_t == TERRAINTYPE_WATER) - { - if (terrain[pos_water] != TERRAINTYPE_WATER) - { + if (tile_t == TERRAINTYPE_WATER) { + if (terrain[pos_water] != TERRAINTYPE_WATER) { bFits = FALSE; } - } - else - { + } else { if (terrain[pos_water] != TERRAINTYPE_GROUND) //if(tsets[pos_water]==waterset) { @@ -5407,8 +5209,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int pieces[16]; int k; TILEDATA& t_orig = (*tiledata)[i]; - for (k = 0;k < *tiledata_count;k++) - { + for (k = 0; k < *tiledata_count; k++) { TILEDATA& t = (*tiledata)[k]; if (t.bMarbleMadness) continue; @@ -5416,18 +5217,14 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (t.cx != t_orig.cx || t.cy != t_orig.cy) continue; if (k != 4 && k != 5 && k != 12 && k != 13 && k != 20 && k != 21 && k != 28 && k != 29 - && (k < 32 || k>39)) - { - } - else continue; + && (k < 32 || k>39)) { + } else continue; int xx, yy; BOOL bSame = TRUE; int p = 0; - for (xx = 0;xx < t.cx;xx++) - { - for (yy = 0;yy < t.cy;yy++) - { + for (xx = 0; xx < t.cx; xx++) { + for (yy = 0; yy < t.cy; yy++) { if (t.tiles[p].bHackedTerrainType != t_orig.tiles[p].bHackedTerrainType) bSame = FALSE; p++; @@ -5436,8 +5233,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (!bSame) break; } - if (bSame && count < 16) - { + if (bSame && count < 16) { pieces[count] = k; count++; } @@ -5453,17 +5249,14 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int p = 0; int xx, yy; int startheight = GetHeightAt(x + y * isosize); - for (xx = 0;xx < t.cx;xx++) - { - for (yy = 0;yy < t.cy;yy++) - { + for (xx = 0; xx < t.cx; xx++) { + for (yy = 0; yy < t.cy; yy++) { if (x + xx >= isosize || y + yy >= isosize) continue; int pos = x + xx + (y + yy) * isosize; last_succeeded_operation = 7014; - if (t.tiles[p].pic != NULL) - { + if (t.tiles[p].pic != NULL) { SetHeightAt(pos, startheight + t.tiles[p].bZHeight); SetTileAt(pos, k, p); last_succeeded_operation = 7015; @@ -5488,29 +5281,24 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov last_succeeded_operation = 7005; - for (i = tStart;i <= tEnd;i++) - { + for (i = tStart; i <= tEnd; i++) { /*pc.SetPos(i-tStart+(tEnd-tStart)); pc.UpdateWindow();*/ TILEDATA& td = (*tiledata)[i]; - if ((*tiledata)[i].wTileSet == shoreset) - { + if ((*tiledata)[i].wTileSet == shoreset) { int pos = i - tStart; if (pos != 4 && pos != 5 && pos != 12 && pos != 13 && pos != 20 && pos != 21 && pos != 28 && pos != 29 && pos != 6 && pos != 7 && pos != 14 && pos != 15 && pos != 22 && pos != 23 && pos != 30 && pos != 31 && (pos < 32 || pos>39)) { - } - else continue; + } else continue; int x, y; int water_count = 0; int p = 0; - for (x = 0;x < td.cx;x++) - { - for (y = 0;y < td.cy;y++) - { + for (x = 0; x < td.cx; x++) { + for (y = 0; y < td.cy; y++) { if (td.tiles[p].bHackedTerrainType == TERRAINTYPE_WATER) water_count++; p++; @@ -5523,10 +5311,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int max_x = td.cx < 16 ? td.cx : 16; int max_y = td.cy < 16 ? td.cy : 16; - for (x = left;x < right;x++) - { - for (y = top;y < bottom;y++) - { + for (x = left; x < right; x++) { + for (y = top; y < bottom; y++) { int xx, yy; //if(!replaced[x+y*isosize] && (x=right || y>=bottom)) continue; @@ -5556,10 +5342,8 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov BOOL bFits = TRUE; int p = 0; - for (xx = x;xx < x + max_x;xx++) - { - for (yy = y;yy < y + max_y;yy++) - { + for (xx = x; xx < x + max_x; xx++) { + for (yy = y; yy < y + max_y; yy++) { if (xx >= isosize || yy >= isosize) continue; int tpos = i - tStart; @@ -5613,15 +5397,12 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov BYTE& tile_t = td.tiles[p].bHackedTerrainType; - if (tsets[pos_data] == shoreset) - { + if (tsets[pos_data] == shoreset) { if (hasChanged[pos_data]) // only cancel if this routine set the shore { // curves are preferred - if ((max_x != 2 || max_y != 2 || water_count != 3)) - { - if (!((max_x == 3 && max_y == 2) || (max_x == 2 && max_y == 3))) - { + if ((max_x != 2 || max_y != 2 || water_count != 3)) { + if (!((max_x == 3 && max_y == 2) || (max_x == 2 && max_y == 3))) { bFits = FALSE; break; } @@ -5631,8 +5412,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov } // one step curves - if (noChange[pos_data]) - { + if (noChange[pos_data]) { bFits = FALSE; break; } @@ -5641,15 +5421,11 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (tile[pos_data] <= tEnd && tile[pos_data] >= tEnd - 2) bFits = FALSE; - if (tile_t == TERRAINTYPE_WATER) - { - if (terrain[pos_water] != TERRAINTYPE_WATER) - { + if (tile_t == TERRAINTYPE_WATER) { + if (terrain[pos_water] != TERRAINTYPE_WATER) { bFits = FALSE; } - } - else - { + } else { if (terrain[pos_water] != TERRAINTYPE_GROUND) //if(tsets[pos_water]==waterset) { @@ -5672,26 +5448,21 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int pieces[16]; int k; TILEDATA& t_orig = (*tiledata)[i]; - for (k = 0;k < *tiledata_count;k++) - { + for (k = 0; k < *tiledata_count; k++) { TILEDATA& t = (*tiledata)[k]; if (t.cx != t_orig.cx || t.cy != t_orig.cy) continue; if (t.bMarbleMadness) continue; if (k != 4 && k != 5 && k != 12 && k != 13 && k != 20 && k != 21 && k != 28 && k != 29 - && (k < 32 || k>39)) - { - } - else continue; + && (k < 32 || k>39)) { + } else continue; int xx, yy; BOOL bSame = TRUE; int p = 0; - for (xx = 0;xx < t.cx;xx++) - { - for (yy = 0;yy < t.cy;yy++) - { + for (xx = 0; xx < t.cx; xx++) { + for (yy = 0; yy < t.cy; yy++) { if (t.tiles[p].bHackedTerrainType != t_orig.tiles[p].bHackedTerrainType) bSame = FALSE; p++; @@ -5700,8 +5471,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov if (!bSame) break; } - if (bSame && count < 16) - { + if (bSame && count < 16) { pieces[count] = k; count++; } @@ -5717,16 +5487,13 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov int p = 0; int xx, yy; int startheight = GetHeightAt(x + y * isosize); - for (xx = 0;xx < t.cx;xx++) - { - for (yy = 0;yy < t.cy;yy++) - { + for (xx = 0; xx < t.cx; xx++) { + for (yy = 0; yy < t.cy; yy++) { if (x + xx >= isosize || y + yy >= isosize) continue; int pos = x + xx + (y + yy) * isosize; - if (t.tiles[p].pic != NULL) - { + if (t.tiles[p].pic != NULL) { SetHeightAt(pos, startheight + t.tiles[p].bZHeight); SetTileAt(pos, k, p); tile[pos] = i; @@ -5753,37 +5520,31 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov #ifdef RA2_MODE int x, y; - for (x = left;x < right;x++) - { - for (y = top;y < bottom;y++) - { + for (x = left; x < right; x++) { + for (y = top; y < bottom; y++) { int xx, yy; if (x < 1 || y < 1 || x + ymapwidth + mapheight * 2 || (y + 1 > mapwidth && x - 1 < y - mapwidth) || (x + 1 > mapwidth && y + mapwidth - 1 < x)) continue; int pos = x + y * isosize; if (noChange[pos]) continue; - if (terrain[pos] == TERRAINTYPE_GROUND && tsets[pos] != shoreset && tsets[pos] != cliffset && tsets[pos] != watercliffset) - { + if (terrain[pos] == TERRAINTYPE_GROUND && tsets[pos] != shoreset && tsets[pos] != cliffset && tsets[pos] != watercliffset) { int i, e; BOOL bShoreFound = FALSE; - for (i = x - 1;i <= x + 1;i++) - { - for (e = y - 1;e <= y + 1;e++) - { + for (i = x - 1; i <= x + 1; i++) { + for (e = y - 1; e <= y + 1; e++) { if (tsets[i + e * isosize] == shoreset) bShoreFound = TRUE; if (bShoreFound) break; } if (bShoreFound) break; } - if (bShoreFound) - { + if (bShoreFound) { int sandtile = tiles->GetInteger("General", "GreenTile"); int sandlat = tiles->GetInteger("General", "ClearToGreenLat"); int i; - for (i = 0;i < *tiledata_count;i++) + for (i = 0; i < *tiledata_count; i++) if ((*tiledata)[i].wTileSet == sandtile) break; Map->SetTileAt(pos, i, 0); hasChanged[pos] = TRUE; @@ -5794,25 +5555,20 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov } } - for (x = left - 1;x < right + 1;x++) - { - for (y = top - 1;y < bottom + 1;y++) - { + for (x = left - 1; x < right + 1; x++) { + for (y = top - 1; y < bottom + 1; y++) { int xx, yy; if (x < 1 || y < 1 || x + ymapwidth + mapheight * 2 || (y + 1 > mapwidth && x - 1 < y - mapwidth) || (x + 1 > mapwidth && y + mapwidth - 1 < x)) continue; int pos = x + y * isosize; if (noChange[pos]) continue; - if (terrain[pos] == TERRAINTYPE_GROUND && tsets[pos] != shoreset && tsets[pos] != cliffset && tsets[pos] != watercliffset) - { + if (terrain[pos] == TERRAINTYPE_GROUND && tsets[pos] != shoreset && tsets[pos] != cliffset && tsets[pos] != watercliffset) { int i, e; BOOL bShoreFound = FALSE; BOOL bSomethingChanged = FALSE; - for (i = x - 1;i <= x + 1;i++) - { - for (e = y - 1;e <= y + 1;e++) - { + for (i = x - 1; i <= x + 1; i++) { + for (e = y - 1; e <= y + 1; e++) { if (tsets[i + e * isosize] == shoreset) bShoreFound = TRUE; if (hasChanged[i + e * isosize]) bSomethingChanged = TRUE; if (bShoreFound && hasChanged[i + e * isosize]) break; @@ -5822,8 +5578,7 @@ void CMapData::CreateShore(int left, int top, int right, int bottom, BOOL bRemov - if (bShoreFound && hasChanged) - { + if (bShoreFound && hasChanged) { int sandtile = tiles->GetInteger("General", "GreenTile"); int sandlat = tiles->GetInteger("General", "ClearToGreenLat"); @@ -5899,8 +5654,7 @@ void CMapData::Copy(int left, int top, int right, int bottom) void* lpVoid = GlobalLock(hGlob); - if (!lpVoid) - { + if (!lpVoid) { MessageBox(0, "Failed to lock memory", "Error", 0); return; } @@ -5913,10 +5667,8 @@ void CMapData::Copy(int left, int top, int right, int bottom) int e; int lowestheight = 255; - for (i = 0;i < cd.iWidth;i++) - { - for (e = 0;e < cd.iHeight;e++) - { + for (i = 0; i < cd.iWidth; i++) { + for (e = 0; e < cd.iHeight; e++) { if (i + left < 0 || e + top < 0 || i + left >= m_IsoSize || e + top >= m_IsoSize) continue; int pos_r; @@ -5931,10 +5683,8 @@ void CMapData::Copy(int left, int top, int right, int bottom) last_succeeded_operation = 80201; - for (i = 0;i < cd.iWidth;i++) - { - for (e = 0;e < cd.iHeight;e++) - { + for (i = 0; i < cd.iWidth; i++) { + for (e = 0; e < cd.iHeight; e++) { if (i + left < 0 || e + top < 0 || i + left >= m_IsoSize || e + top >= m_IsoSize) continue; int pos_w, pos_r; @@ -5955,8 +5705,7 @@ void CMapData::Copy(int left, int top, int right, int bottom) int tset = (*tiledata)[ground].wTileSet; int k; - for (k = 0;k < *tiledata_count;k++) - { + for (k = 0; k < *tiledata_count; k++) { if ((*tiledata)[k].wTileSet == tset) break; } @@ -5972,8 +5721,7 @@ void CMapData::Copy(int left, int top, int right, int bottom) OpenClipboard(theApp.m_pMainWnd->m_hWnd); EmptyClipboard(); - if (!SetClipboardData(theApp.m_cf, hGlob)) - { + if (!SetClipboardData(theApp.m_cf, hGlob)) { MessageBox(0, "Failed to set clipboard data", "Error", 0); } @@ -5989,8 +5737,7 @@ void CMapData::Paste(int x, int y, int z_mod) void* lpVoid = GlobalLock(handle); - if (!lpVoid) - { + if (!lpVoid) { CloseClipboard(); return; } @@ -6015,10 +5762,8 @@ void CMapData::Paste(int x, int y, int z_mod) int i; int e; - for (i = 0;i < cd.iWidth;i++) - { - for (e = 0;e < cd.iHeight;e++) - { + for (i = 0; i < cd.iWidth; i++) { + for (e = 0; e < cd.iHeight; e++) { if (x + i < 0 || y + e < 0 || x + i >= m_IsoSize || y + e >= m_IsoSize) continue; FIELDDATA* fd = Map->GetFielddataAt(i + x + (y + e) * m_IsoSize); @@ -6049,10 +5794,8 @@ void CMapData::Paste(int x, int y, int z_mod) last_succeeded_operation = 3003; const bool mp = IsMultiplayer(); - for (i = 0;i < cd.iWidth;i++) - { - for (e = 0;e < cd.iHeight;e++) - { + for (i = 0; i < cd.iWidth; i++) { + for (e = 0; e < cd.iHeight; e++) { int pos_w, pos_r; pos_r = i + e * cd.iWidth; pos_w = x + i + (y + e) * m_IsoSize; @@ -6072,18 +5815,15 @@ void CMapData::Paste(int x, int y, int z_mod) int tile = data[pos_r].bTile; int k; int found = -1; - for (k = 0;k < *tiledata_count;k++) - { - if ((*tiledata)[k].wTileSet == tset) - { + for (k = 0; k < *tiledata_count; k++) { + if ((*tiledata)[k].wTileSet == tset) { found = k; break; } } if (found < 0) continue; - if ((*tiledata)[found + tile].wTileSet != tset) - { + if ((*tiledata)[found + tile].wTileSet != tset) { continue; } if ((*tiledata)[found + tile].wTileCount <= data[pos_r].bSubTile) continue; @@ -6134,8 +5874,7 @@ void CMapData::InitMinimap() int pitch = pwidth * 3; if (pitch == 0) return; - if (pitch % sizeof(DWORD)) - { + if (pitch % sizeof(DWORD)) { pitch += sizeof(DWORD) - (pwidth * 3) % sizeof(DWORD); } @@ -6177,31 +5916,26 @@ int CMapData::CalcMoneyOnMap() { int i; int money = 0; - for (i = 0;i < fielddata_size;i++) - { + for (i = 0; i < fielddata_size; i++) { FIELDDATA& fd = fielddata[i]; BYTE& ovrl = fd.overlay; BYTE& ovrld = fd.overlaydata; - if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) - { + if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) { money += (ovrld + 1) * rules.GetInteger("Riparius", "Value"); } - if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) - { + if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) { money += (ovrld + 1) * rules.GetInteger("Cruentus", "Value"); } - if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) - { + if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) { money += (ovrld + 1) * rules.GetInteger("Vinifera", "Value"); } - if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) - { + if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) { money += (ovrld + 1) * rules.GetInteger("Aboreus", "Value"); } } @@ -6240,10 +5974,8 @@ void CMapData::SmoothTiberium(DWORD dwPos) y = dwPos / m_IsoSize; int count = 0; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { int xx = x + i; int yy = y + e; @@ -6255,23 +5987,19 @@ void CMapData::SmoothTiberium(DWORD dwPos) BYTE& ovrld = fd.overlaydata; - if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) - { + if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) { count++; } - if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) - { + if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) { count++; } - if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) - { + if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) { count++; } - if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) - { + if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) { count++; } @@ -6314,55 +6042,49 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh int i; // Now copy the objects into above arrays and delete them from map - for (i = 0;i < inf_count;i++) - { + for (i = 0; i < inf_count; i++) { INFANTRY obj; GetInfantryData(i, &obj); inf[i] = obj; } - for (i = inf_count - 1;i >= 0;i--) + for (i = inf_count - 1; i >= 0; i--) DeleteInfantry(i); - for (i = 0;i < air_count;i++) - { + for (i = 0; i < air_count; i++) { AIRCRAFT obj; GetAircraftData(i, &obj); air[i] = obj; } - for (i = air_count - 1;i >= 0;i--) + for (i = air_count - 1; i >= 0; i--) DeleteAircraft(i); - for (i = 0;i < str_count;i++) - { + for (i = 0; i < str_count; i++) { STRUCTURE obj; GetStructureData(i, &obj); str[i] = obj; } - for (i = str_count - 1;i >= 0;i--) + for (i = str_count - 1; i >= 0; i--) DeleteStructure(i); - for (i = 0;i < unit_count;i++) - { + for (i = 0; i < unit_count; i++) { UNIT obj; GetUnitData(i, &obj); unit[i] = obj; } - for (i = unit_count - 1;i >= 0;i--) + for (i = unit_count - 1; i >= 0; i--) DeleteUnit(i); - for (i = 0;i < terrain_count;i++) - { + for (i = 0; i < terrain_count; i++) { terrain[i] = m_terrain[i]; } - for (i = 0;i < terrain_count;i++) + for (i = 0; i < terrain_count; i++) DeleteTerrain(i); - for (i = 0;i < wp_count;i++) - { + for (i = 0; i < wp_count; i++) { DWORD pos; CString id; @@ -6375,8 +6097,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh // for(i=0;iSetPosition(i + curcount); dlg->UpdateWindow(); @@ -6559,8 +6275,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; count = air_count; - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { // if(air[i].deleted) continue; AIRCRAFT obj; @@ -6587,8 +6302,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; count = str_count; - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { // if(str[i].deleted) continue; STRUCTURE obj; @@ -6615,8 +6329,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; count = unit_count; - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { // if(units[i].deleted) continue; UNIT obj; @@ -6643,10 +6356,8 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; count = terrain_count; - for (i = 0;i < count;i++) - { - if (terrain[i].deleted) - { + for (i = 0; i < count; i++) { + if (terrain[i].deleted) { dlg->SetPosition(i + curcount); dlg->UpdateWindow(); continue; // MW June 12 01 @@ -6677,8 +6388,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; count = wp_count; - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { DWORD pos; CString id; @@ -6701,8 +6411,7 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh curcount += count; - for (i = 0;i < ct_count;i++) - { + for (i = 0; i < ct_count; i++) { DWORD pos = ct_pos[i]; CString tag = ct_tag[i]; @@ -6741,10 +6450,8 @@ void CMapData::ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeigh errstream.flush(); const bool mp = IsMultiplayer(); - for (i = 0;i < m_IsoSize;i++) - { - for (e = 0;e < m_IsoSize;e++) - { + for (i = 0; i < m_IsoSize; i++) { + for (e = 0; e < m_IsoSize; e++) { Mini_UpdatePos(i, e, mp); count++; @@ -6805,20 +6512,16 @@ BOOL CMapData::IsYRMap() int max = 0; if (tiledata == &u_tiledata) { max = g_data.GetInteger("RA2TileMax", "Urban"); - } - else if (tiledata == &s_tiledata) { + } else if (tiledata == &s_tiledata) { max = g_data.GetInteger("RA2TileMax", "Snow"); - } - else if (tiledata == &t_tiledata) { + } else if (tiledata == &t_tiledata) { max = g_data.GetInteger("RA2TileMax", "Temperat"); } int yroverlay = g_data.GetInteger("YROverlay", "Begin"); - for (i = 0;i < fielddata_size;i++) - { - if (fielddata[i].wGround != 0xFFFF && fielddata[i].wGround >= max) - { + for (i = 0; i < fielddata_size; i++) { + if (fielddata[i].wGround != 0xFFFF && fielddata[i].wGround >= max) { return TRUE; } if (fielddata[i].overlay >= yroverlay && fielddata[i].overlay != 0xFF) @@ -6828,8 +6531,7 @@ BOOL CMapData::IsYRMap() int count; count = GetInfantryCount(); - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { INFANTRY inf; GetInfantryData(i, &inf); @@ -6843,8 +6545,7 @@ BOOL CMapData::IsYRMap() } count = GetStructureCount(); - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { STRUCTURE str; GetStructureData(i, &str); @@ -6858,8 +6559,7 @@ BOOL CMapData::IsYRMap() } count = GetUnitCount(); - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { UNIT unit; GetUnitData(i, &unit); @@ -6873,8 +6573,7 @@ BOOL CMapData::IsYRMap() } count = GetAircraftCount(); - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { AIRCRAFT air; GetAircraftData(i, &air); @@ -6888,8 +6587,7 @@ BOOL CMapData::IsYRMap() } count = GetTerrainCount(); - for (i = 0;i < count;i++) - { + for (i = 0; i < count; i++) { TERRAIN& tr = m_terrain[i]; @@ -6950,13 +6648,11 @@ BOOL CMapData::AddSmudge(SMUDGE* lpSmudge) BOOL bFound = FALSE; int i; - for (i = 0;i < m_smudges.size();i++) - { + for (i = 0; i < m_smudges.size(); i++) { if (m_smudges[i].deleted) // yep, found one, replace it { m_smudges[i] = td; - if (pos < fielddata_size) - { + if (pos < fielddata_size) { fielddata[pos].smudge = i; fielddata[pos].smudgetype = smudgeid[td.type]; } @@ -6966,12 +6662,10 @@ BOOL CMapData::AddSmudge(SMUDGE* lpSmudge) } } - if (!bFound) - { + if (!bFound) { m_smudges.push_back(td); - if (pos < fielddata_size) - { + if (pos < fielddata_size) { fielddata[pos].smudge = m_smudges.size() - 1; fielddata[pos].smudgetype = smudgeid[td.type]; } @@ -6992,8 +6686,7 @@ void CMapData::DeleteSmudge(DWORD dwIndex) m_smudges[dwIndex].deleted = 1; int pos = x + y * GetIsoSize(); - if (x + y * m_IsoSize < fielddata_size) - { + if (x + y * m_IsoSize < fielddata_size) { fielddata[pos].smudge = -1; fielddata[pos].smudgetype = -1; } @@ -7049,8 +6742,8 @@ void CMapData::UpdateSmudges(BOOL bSave, int num) } return; } - - + + //if(num<0) { @@ -7095,15 +6788,14 @@ void CMapData::UpdateSmudgeInfo(LPCSTR lpSmudgeType) if (pics.find(lpPicFile) != pics.end()) { smudgeinfo[n].pic = pics[lpPicFile]; - } - else { + } else { smudgeinfo[n].pic.pic = NULL; } } } - for (auto const&[seq, type]: ini.GetSection("SmudgeTypes")) { + for (auto const& [seq, type] : ini.GetSection("SmudgeTypes")) { int n = Map->GetUnitTypeID(type); if (n >= 0 && n < 0x0F00) { @@ -7114,8 +6806,7 @@ void CMapData::UpdateSmudgeInfo(LPCSTR lpSmudgeType) if (pics.find(lpPicFile) != pics.end()) { smudgeinfo[n].pic = pics[lpPicFile]; - } - else { + } else { smudgeinfo[n].pic.pic = NULL; } } diff --git a/MissionEditor/MapData.h b/MissionEditor/MapData.h index 63f06ba..31aa735 100644 --- a/MissionEditor/MapData.h +++ b/MissionEditor/MapData.h @@ -193,17 +193,12 @@ public: int ns = -1; int i, e, p = 0; int h[3][3]; - for (i = 0;i < 3; i++) - { - for (e = 0;e < 3;e++) - { + for (i = 0; i < 3; i++) { + for (e = 0; e < 3; e++) { int pos = dwPos + (i - 1) + (e - 1) * m_IsoSize; - if (pos < 0 || pos >= m_IsoSize * m_IsoSize) - { + if (pos < 0 || pos >= m_IsoSize * m_IsoSize) { h[i][e] = 0; - } - else - { + } else { FIELDDATA m2 = *GetFielddataAt(pos); h[i][e] = m.bHeight - m2.bHeight; @@ -214,8 +209,7 @@ public: } // check if the current tile must be heightened anyway - if (!theApp.m_Options.bDisableSlopeCorrection && d.bMorphable) - { + if (!theApp.m_Options.bDisableSlopeCorrection && d.bMorphable) { if ((h[0][1] < 0 && h[2][1] < 0) || (h[1][0] < 0 && h[1][2] < 0) || (h[1][0] < 0 && h[0][2] < 0 && h[0][1] >= 0) @@ -235,11 +229,10 @@ public: || (h[1][2] < 0 && h[2][1] < 0 && h[2][2] >= 0) || (h[2][1] < 0 && h[1][0] < 0 && h[2][0] >= 0) - ) - { + ) { SetHeightAt(dwPos, m.bHeight + 1); - for (i = -1;i < 2;i++) - for (e = -1;e < 2;e++) + for (i = -1; i < 2; i++) + for (e = -1; e < 2; e++) CreateSlopesAt(dwPos + i + e * m_IsoSize); return; @@ -258,100 +251,84 @@ public: if (ns == -1) - if (h[1][0] == -1 && h[0][1] != -1 && h[1][2] != -1 && h[2][1] != -1) - { + if (h[1][0] == -1 && h[0][1] != -1 && h[1][2] != -1 && h[2][1] != -1) { ns = SLOPE_UP_LEFT; - } - else if (h[0][1] == -1 && h[1][0] != -1 && h[2][1] != -1 && h[1][2] != -1) - { + } else if (h[0][1] == -1 && h[1][0] != -1 && h[2][1] != -1 && h[1][2] != -1) { ns = SLOPE_UP_TOP; - } - else if (h[1][2] == -1 && h[0][1] != -1 && h[1][0] != -1 && h[2][1] != -1) - { + } else if (h[1][2] == -1 && h[0][1] != -1 && h[1][0] != -1 && h[2][1] != -1) { ns = SLOPE_UP_RIGHT; - } - else if (h[2][1] == -1 && h[0][1] != -1 && h[1][0] != -1 && h[1][2] != -1) - { + } else if (h[2][1] == -1 && h[0][1] != -1 && h[1][0] != -1 && h[1][2] != -1) { ns = SLOPE_UP_BOTTOM; } - if (ns == -1) - { - if (h[0][0] == -2) ns = SLOPE_DOWN_BOTTOM; - if (h[2][0] == -2) ns = SLOPE_DOWN_RIGHT; - if (h[0][2] == -2) ns = SLOPE_DOWN_LEFT; - if (h[2][2] == -2) ns = SLOPE_DOWN_TOP; - } - - if (ns == -1 && h[0][0] == -1) - { - if (h[1][0] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_RIGHTBOTTOM; - else if (h[1][0] == 0 && h[0][1] == 0) ns = SLOPE_UP_LEFTTOP; - //else if(h[2][2]==1) ns=SLOPE_DOWN_BOTTOM; - } - - if (ns == -1 && h[2][0] == -1) - { - if (h[1][0] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_RIGHTTOP; - else if (h[1][0] == 0 && h[2][1] == 0) ns = SLOPE_UP_LEFTBOTTOM; - //else if(h[0][2]==1) ns=SLOPE_DOWN_RIGHT; - } - if (ns == -1 && h[0][2] == -1) - { - if (h[1][2] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_LEFTBOTTOM; - else if (h[1][2] == 0 && h[0][1] == 0) ns = SLOPE_UP_RIGHTTOP; - //else if(h[2][0]==1) ns=SLOPE_DOWN_LEFT; - } - if (ns == -1 && h[2][2] == -1) - { - if (h[1][2] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_LEFTTOP; - else if (h[1][2] == 0 && h[2][1] == 0) ns = SLOPE_UP_RIGHTBOTTOM; - //else if(h[0][0]==1) ns=SLOPE_DOWN_TOP; - } - - if (ns == -1 && h[1][0] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_RIGHTTOP; - if (ns == -1 && h[1][2] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_LEFTTOP; - if (ns == -1 && h[1][0] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_RIGHTBOTTOM; - if (ns == -1 && h[1][2] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_LEFTBOTTOM; - - - int rampbase = rampset_start;//atoi((*tiles).sections["General"].values["RampBase"]); - int rampsmooth = tiles->GetInteger("General", "RampSmooth"); - - if (ns == -1 && (d.wTileSet == rampset || d.wTileSet == rampsmooth) && d.bMorphable) - { - SetTileAt(dwPos, 0, 0); - } - if (tiledata == &un_tiledata) - { - int r = ramp2set; - int m = pave2set; - - if (ns == -1 && (d.wTileSet == r || d.wTileSet == m) && d.bMorphable) - { - SetTileAt(dwPos, pave2set_start/*GetTileID(m,0)*/, 0); + if (ns == -1) { + if (h[0][0] == -2) ns = SLOPE_DOWN_BOTTOM; + if (h[2][0] == -2) ns = SLOPE_DOWN_RIGHT; + if (h[0][2] == -2) ns = SLOPE_DOWN_LEFT; + if (h[2][2] == -2) ns = SLOPE_DOWN_TOP; } - } - if (d.bMorphable && ns != -1) - { - if (tiledata == &un_tiledata) // NEW URBAN FIX FOR URBAN PAVEMENT - { - //[NewUrbanInfo] - //Morphable2=114 - //Ramps2=117 + if (ns == -1 && h[0][0] == -1) { + if (h[1][0] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_RIGHTBOTTOM; + else if (h[1][0] == 0 && h[0][1] == 0) ns = SLOPE_UP_LEFTTOP; + //else if(h[2][2]==1) ns=SLOPE_DOWN_BOTTOM; + } + + if (ns == -1 && h[2][0] == -1) { + if (h[1][0] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_RIGHTTOP; + else if (h[1][0] == 0 && h[2][1] == 0) ns = SLOPE_UP_LEFTBOTTOM; + //else if(h[0][2]==1) ns=SLOPE_DOWN_RIGHT; + } + if (ns == -1 && h[0][2] == -1) { + if (h[1][2] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_LEFTBOTTOM; + else if (h[1][2] == 0 && h[0][1] == 0) ns = SLOPE_UP_RIGHTTOP; + //else if(h[2][0]==1) ns=SLOPE_DOWN_LEFT; + } + if (ns == -1 && h[2][2] == -1) { + if (h[1][2] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_LEFTTOP; + else if (h[1][2] == 0 && h[2][1] == 0) ns = SLOPE_UP_RIGHTBOTTOM; + //else if(h[0][0]==1) ns=SLOPE_DOWN_TOP; + } + + if (ns == -1 && h[1][0] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_RIGHTTOP; + if (ns == -1 && h[1][2] == -1 && h[2][1] == -1) ns = SLOPE_DOWN_LEFTTOP; + if (ns == -1 && h[1][0] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_RIGHTBOTTOM; + if (ns == -1 && h[1][2] == -1 && h[0][1] == -1) ns = SLOPE_DOWN_LEFTBOTTOM; + + + int rampbase = rampset_start;//atoi((*tiles).sections["General"].values["RampBase"]); + int rampsmooth = tiles->GetInteger("General", "RampSmooth"); + + if (ns == -1 && (d.wTileSet == rampset || d.wTileSet == rampsmooth) && d.bMorphable) { + SetTileAt(dwPos, 0, 0); + } + if (tiledata == &un_tiledata) { int r = ramp2set; int m = pave2set; - if (d.wTileSet == r || d.wTileSet == m) - rampbase = ramp2set_start; + if (ns == -1 && (d.wTileSet == r || d.wTileSet == m) && d.bMorphable) { + SetTileAt(dwPos, pave2set_start/*GetTileID(m,0)*/, 0); + } + } + if (d.bMorphable && ns != -1) { + if (tiledata == &un_tiledata) // NEW URBAN FIX FOR URBAN PAVEMENT + { + + //[NewUrbanInfo] + //Morphable2=114 + //Ramps2=117 + int r = ramp2set; + int m = pave2set; + if (d.wTileSet == r || d.wTileSet == m) + rampbase = ramp2set_start; + + + } + + SetTileAt(dwPos, rampbase + ns - 1, 0); } - SetTileAt(dwPos, rampbase + ns - 1, 0); - - } - } void CreateMap(DWORD dwWidth, DWORD dwHeight, LPCTSTR lpTerrainType, DWORD dwGroundHeight); @@ -371,13 +348,10 @@ public: int e; fielddata[dwPos].bRedrawTerrain = FALSE; int xx, yy; - for (xx = -2;xx < 0;xx++) - { - for (yy = -2;yy < 0;yy++) - { + for (xx = -2; xx < 0; xx++) { + for (yy = -2; yy < 0; yy++) { int npos = dwPos + xx + yy * m_IsoSize; - if (npos > 0 && fielddata[dwPos].bHeight - fielddata[npos].bHeight >= 4) - { + if (npos > 0 && fielddata[dwPos].bHeight - fielddata[npos].bHeight >= 4) { fielddata[dwPos].bRedrawTerrain = TRUE; break; } @@ -494,10 +468,9 @@ public: } INT GetInfantryAt(DWORD dwPos, DWORD dwSubPos = 0xFFFFFFFF) const { - if (dwSubPos == 0xFFFFFFFF) - { + if (dwSubPos == 0xFFFFFFFF) { int i; - for (i = 0;i < SUBPOS_COUNT;i++) + for (i = 0; i < SUBPOS_COUNT; i++) if (fielddata[dwPos].infantry[i] != -1) return fielddata[dwPos].infantry[i]; return -1; @@ -524,8 +497,7 @@ public: const FIELDDATA* GetFielddataAt(DWORD dwPos) const { - if (dwPos >= fielddata_size) - { + if (dwPos >= fielddata_size) { outside_f.bReserved = 1; return &outside_f; } @@ -535,8 +507,7 @@ public: FIELDDATA* GetFielddataAt(DWORD dwPos) { - if (dwPos >= fielddata_size) - { + if (dwPos >= fielddata_size) { outside_f.bReserved = 1; return &outside_f; } @@ -547,8 +518,7 @@ public: const FIELDDATA* GetFielddataAt(const MapCoords& pos) const { auto dwPos = GetMapPos(pos); - if (dwPos >= fielddata_size) - { + if (dwPos >= fielddata_size) { outside_f.bReserved = 1; return &outside_f; } @@ -559,8 +529,7 @@ public: FIELDDATA* GetFielddataAt(const MapCoords& pos) { auto dwPos = GetMapPos(pos); - if (dwPos >= fielddata_size) - { + if (dwPos >= fielddata_size) { outside_f.bReserved = 1; return &outside_f; } @@ -617,7 +586,7 @@ public: MapCoords ToMapCoords(ProjectedCoords xy) const; MapCoords ToMapCoords3d(ProjectedCoords xy, int mapZ) const; - MapCoords ToMapCoords3d(ProjectedCoords xy, bool bAllowAccessBehindCliffs=false, bool ignoreHideFlagsAndOutside=false) const; + MapCoords ToMapCoords3d(ProjectedCoords xy, bool bAllowAccessBehindCliffs = false, bool ignoreHideFlagsAndOutside = false) const; ProjectedCoords ProjectCoords(MapCoords xy) const; ProjectedCoords ProjectCoords3d(MapCoords xy) const; ProjectedCoords ProjectCoords3d(MapCoords xy, int z) const; @@ -708,46 +677,38 @@ protected: __forceinline void RemoveOvrlMoney(unsigned char ovrl, unsigned char ovrld) { - if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) - { + if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) { m_money -= (ovrld + 1) * m_overlayCredits[OverlayCredits_Riparius]; } - if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) - { + if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) { m_money -= (ovrld + 1) * m_overlayCredits[OverlayCredits_Cruentus]; } - if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) - { + if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) { m_money -= (ovrld + 1) * m_overlayCredits[OverlayCredits_Vinifera]; } - if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) - { + if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) { m_money -= (ovrld + 1) * m_overlayCredits[OverlayCredits_Aboreus]; } } __forceinline void AddOvrlMoney(unsigned char ovrl, unsigned char ovrld) { - if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) - { + if (ovrl >= RIPARIUS_BEGIN && ovrl <= RIPARIUS_END) { m_money += (ovrld + 1) * m_overlayCredits[OverlayCredits_Riparius]; } - if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) - { + if (ovrl >= CRUENTUS_BEGIN && ovrl <= CRUENTUS_END) { m_money += (ovrld + 1) * m_overlayCredits[OverlayCredits_Cruentus]; } - if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) - { + if (ovrl >= VINIFERA_BEGIN && ovrl <= VINIFERA_END) { m_money += (ovrld + 1) * m_overlayCredits[OverlayCredits_Vinifera]; } - if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) - { + if (ovrl >= ABOREUS_BEGIN && ovrl <= ABOREUS_END) { m_money += (ovrld + 1) * m_overlayCredits[OverlayCredits_Aboreus]; } } @@ -774,7 +735,7 @@ protected: y += pheight / 2; } - + __forceinline void Mini_UpdatePos(const int i, const int e, bool isMultiplayer) { const int pwidth = m_mini_biinfo.bmiHeader.biWidth; @@ -783,7 +744,7 @@ protected: if (m_mini_colors.empty() || !tiledata) return; - + const DWORD dwIsoSize = m_IsoSize; const int pitch = m_mini_pitch; @@ -826,23 +787,18 @@ protected: STDOBJECTDATA sod; sod.house = ""; int ic; - for (ic = 0;ic < SUBPOS_COUNT;ic++) - { - if (td.infantry[ic] >= 0) - { + for (ic = 0; ic < SUBPOS_COUNT; ic++) { + if (td.infantry[ic] >= 0) { GetStdInfantryData(td.infantry[ic], &sod); } } - if (td.structure >= 0) - { + if (td.structure >= 0) { GetStdStructureData(td.structure, &sod); } - if (td.aircraft >= 0) - { + if (td.aircraft >= 0) { GetStdAircraftData(td.aircraft, &sod); } - if (td.unit >= 0) - { + if (td.unit >= 0) { GetStdUnitData(td.unit, &sod); } @@ -868,8 +824,7 @@ protected: col_r.rgbtGreen = r.rgbtGreen; col_r.rgbtRed = r.rgbtRed; - if (isGreenTiberium(td.overlay)) - { + if (isGreenTiberium(td.overlay)) { #ifndef RA2_MODE col.rgbtBlue = 0; col.rgbtGreen = 200; @@ -881,23 +836,17 @@ protected: col.rgbtRed = 250; col_r = col; #endif - } - else if (td.overlay == OVRL_VEINS) - { + } else if (td.overlay == OVRL_VEINS) { col.rgbtBlue = 120; col.rgbtGreen = 180; col.rgbtRed = 190; col_r = col; - } - else if (td.overlay == OVRL_VEINHOLE || td.overlay == OVRL_VEINHOLEBORDER) - { + } else if (td.overlay == OVRL_VEINHOLE || td.overlay == OVRL_VEINHOLEBORDER) { col.rgbtBlue = 120; col.rgbtGreen = 160; col.rgbtRed = 165; col_r = col; - } - else if (td.overlay != 0xFF) - { + } else if (td.overlay != 0xFF) { col.rgbtBlue = 20; col.rgbtGreen = 20; col.rgbtRed = 20; @@ -905,8 +854,7 @@ protected: } - if (sod.house.GetLength() > 0) - { + if (sod.house.GetLength() > 0) { /* if(strstr(sod.house, houses[1].name)) { @@ -935,25 +883,19 @@ protected: } // MW: ADD: make red start pos dots - if (isMultiplayer) - { + if (isMultiplayer) { CString id; DWORD p; int wp = td.waypoint; BOOL startpos = FALSE; int i, e; - for (i = -1;i < 2;i++) - { - for (e = -1;e < 2;e++) - { - if (dwPos + i + e * m_IsoSize < fielddata_size) - { + for (i = -1; i < 2; i++) { + for (e = -1; e < 2; e++) { + if (dwPos + i + e * m_IsoSize < fielddata_size) { int w = GetWaypointAt(dwPos + i + e * m_IsoSize); - if (w >= 0) - { + if (w >= 0) { GetWaypointData(w, &id, &p); - if (atoi(id) < 8) - { + if (atoi(id) < 8) { startpos = TRUE; break; } @@ -964,8 +906,7 @@ protected: } if (startpos) break; } - if (startpos) - { + if (startpos) { col.rgbtBlue = 0; col.rgbtGreen = 0; col.rgbtRed = 255; @@ -1047,17 +988,12 @@ public: int set = (*tiledata)[m.wGround].wTileSet; - for (i = 0;i < 3; i++) - { - for (e = 0;e < 3;e++) - { + for (i = 0; i < 3; i++) { + for (e = 0; e < 3; e++) { int pos = dwPos + (i - 1) + (e - 1) * m_IsoSize; - if (pos < 0 || pos >= fielddata_size) - { + if (pos < 0 || pos >= fielddata_size) { ts[i][e] = 0; - } - else - { + } else { FIELDDATA m2 = *GetFielddataAt(pos); if (m2.wGround == 0xFFFF) m2.wGround = 0; @@ -1066,8 +1002,7 @@ public: //if(cur_set==iSmoothSet) bNoLat=FALSE; // - if (its == iss && cur_set == iSmoothSet) - { + if (its == iss && cur_set == iSmoothSet) { m2.wGround = iLatGround; cur_set = iLatSet; } @@ -1083,23 +1018,19 @@ public: //if(bIgnoreShore && (*tiledata)[m2.wGround].wTileSet==shoreset) // ts[i][e]=0;//ts[i][e]+1; } - else*/ if (its == iss && cur_set != set) - { + else*/ if (its == iss && cur_set != set) { if (cur_set == shoreset && !bIgnoreShore) ts[i][e] = its; else if (cur_set != iSmoothSet && cur_set != iTargetSet && cur_set != iLatSet) ts[i][e] = 0; else ts[i][e] = its; - } - else if (its == iss && cur_set == set) - ts[i][e] = ils; - else - { + } else if (its == iss && cur_set == set) + ts[i][e] = ils; + else { ts[i][e] = (*tiledata)[m2.wGround].tiles[m2.bSubTile].bTerrainType; - if (cur_set != shoreset && cur_set != iLatSet && cur_set != iSmoothSet) - { + if (cur_set != shoreset && cur_set != iLatSet && cur_set != iSmoothSet) { ts[i][e] = 0;//ts[i][e]+1; // make sure you don´t smooth at it except it´s shore } @@ -1115,8 +1046,7 @@ public: // 1/1 is smoothed tile - if (ts[1][1] == ils) - { + if (ts[1][1] == ils) { // single lat if (ts[0][1] != ils && ts[1][0] != ils && ts[1][2] != ils && ts[2][1] != ils) @@ -1164,17 +1094,14 @@ public: needed = 4; - } - else if (ts[1][1] == its) - { + } else if (ts[1][1] == its) { // replace target set instead of smooth set //if(st(ts[0][0], && ts[0][1] } needed -= 1; - if (needed >= 0) - { + if (needed >= 0) { /*for(i=0;i<*tiledata_count;i++) { if((*tiledata)[i].wTileSet==iLatSet) @@ -1186,15 +1113,12 @@ public: // i is first lat tile int e; - for (e = 0;e < needed;e++) - { + for (e = 0; e < needed; e++) { i += (*tiledata)[i].wTileCount; } SetTileAt(dwPos, i, 0); - } - else if (needed == -1) - { + } else if (needed == -1) { /*for(i=0;i<*tiledata_count;i++) { if((*tiledata)[i].wTileSet==iSmoothSet) @@ -1222,7 +1146,7 @@ public: inline bool CMapData::isInside(MapCoords xy) const { - return xy.x >= 0 && xy.y >= 0 && xy.x < m_IsoSize && xy.y < m_IsoSize; + return xy.x >= 0 && xy.y >= 0 && xy.x < m_IsoSize&& xy.y < m_IsoSize; } inline MapCoords CMapData::ToMapCoords(ProjectedCoords xy) const @@ -1245,20 +1169,16 @@ inline MapCoords CMapData::ToMapCoords3d(const ProjectedCoords xy, bool bAllowAc static const auto fxy = ProjectedVec(f_x, f_y).convertT(); auto ret = ignoreHideFlagsAndOutside ? xy2d : MapCoords(-1, -1); - for (int i = 15; i >= 0; i--) - { - for (int e = 0; e < 3; e++) - { + for (int i = 15; i >= 0; i--) { + for (int e = 0; e < 3; e++) { const MapVec off(i, i); // this is a vertical line starting from the bottom const MapVec off2(e == 1 ? -1 : 0, e == 2 ? -1 : 0); // increase x or y or neither in map coordinates by one so that we have a broader area to check const MapCoords cur = xy2d + off + off2; - if (isInside(cur)) - { + if (isInside(cur)) { const auto& mfd = *GetFielddataAt(GetMapPos(cur)); const int ground = mfd.wGround == 0xFFFF ? 0 : mfd.wGround; - if (ignoreHideFlagsAndOutside || (!mfd.bHide && !(tiledata && (*tiledata)[ground].bHide))) - { + if (ignoreHideFlagsAndOutside || (!mfd.bHide && !(tiledata && (*tiledata)[ground].bHide))) { const auto curProj = ProjectCoords3d(cur); // now projCoords hold the logical pixel coordinates for the current field... diff --git a/MissionEditor/MapLoadingDlg.cpp b/MissionEditor/MapLoadingDlg.cpp index dad0c42..72a7d94 100644 --- a/MissionEditor/MapLoadingDlg.cpp +++ b/MissionEditor/MapLoadingDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapLoadingDlg.cpp: Implementierungsdatei diff --git a/MissionEditor/MapLoadingDlg.h b/MissionEditor/MapLoadingDlg.h index ff99f14..ad2e764 100644 --- a/MissionEditor/MapLoadingDlg.h +++ b/MissionEditor/MapLoadingDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MAPLOADINGDLG_H__19690341_CE13_11D4_9C87_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CMapLoadingDlg : public CDialog { -// Konstruktion + // Konstruktion public: CMapLoadingDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CMapLoadingDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/MapModifier.cpp b/MissionEditor/MapModifier.cpp index 57fe456..c8a6bde 100644 --- a/MissionEditor/MapModifier.cpp +++ b/MissionEditor/MapModifier.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapModifier.cpp: Implementierung der Klasse CMapModifier. @@ -28,7 +28,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif diff --git a/MissionEditor/MapModifier.h b/MissionEditor/MapModifier.h index 06cb7b4..f6c2331 100644 --- a/MissionEditor/MapModifier.h +++ b/MissionEditor/MapModifier.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapModifier.h: Schnittstelle für die Klasse CMapModifier. @@ -29,7 +29,7 @@ #pragma once #endif // _MSC_VER > 1000 -class CMapModifier +class CMapModifier { public: CMapModifier(); diff --git a/MissionEditor/MapOpenDialog.cpp b/MissionEditor/MapOpenDialog.cpp index a2aa0f1..6d4bc64 100644 --- a/MissionEditor/MapOpenDialog.cpp +++ b/MissionEditor/MapOpenDialog.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapOpenDialog.cpp: Implementierungsdatei @@ -36,32 +36,29 @@ static char THIS_FILE[] = __FILE__; // CMapOpenDialog UINT_PTR CALLBACK OFNHookProc( - HWND hdlg, // handle to child dialog window - UINT uiMsg, // message identifier - WPARAM wParam, // message parameter - LPARAM lParam // message parameter + HWND hdlg, // handle to child dialog window + UINT uiMsg, // message identifier + WPARAM wParam, // message parameter + LPARAM lParam // message parameter ) { - if(uiMsg==WM_NOTIFY) - { + if (uiMsg == WM_NOTIFY) { OFNOTIFY ofn; - ofn=*((OFNOTIFY*)lParam); - if(ofn.hdr.code==CDN_SELCHANGE) - { + ofn = *((OFNOTIFY*)lParam); + if (ofn.hdr.code == CDN_SELCHANGE) { // user selected another file wchar_t psz[MAX_PATH] = { 0 }; // filename CommDlg_OpenSave_GetFilePathW(GetParent(hdlg), psz, MAX_PATH); - + // lets parse the file. Only load Basic section CIniFile CurMap; - CurMap.InsertFile(utf16ToUtf8(psz),"Basic"); + CurMap.InsertFile(utf16ToUtf8(psz), "Basic"); SetDlgItemText(hdlg, IDC_MAPNAME, CurMap.GetString("Basic", "Name")); - - - } - else if (ofn.hdr.code==CDN_FOLDERCHANGE) - RedrawWindow(GetParent(hdlg),NULL,NULL,RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE ); + + + } else if (ofn.hdr.code == CDN_FOLDERCHANGE) + RedrawWindow(GetParent(hdlg), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); } return 0; @@ -71,12 +68,12 @@ UINT_PTR CALLBACK OFNHookProc( IMPLEMENT_DYNAMIC(CMapOpenDialog, CFileDialog) CMapOpenDialog::CMapOpenDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName, - DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : - CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd) + DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : + CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd) { - m_ofn.Flags|=OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK; - m_ofn.lpTemplateName=MAKEINTRESOURCE(IDD_MYOPENDIALOG); - m_ofn.lpfnHook=OFNHookProc; + m_ofn.Flags |= OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK; + m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_MYOPENDIALOG); + m_ofn.lpfnHook = OFNHookProc; } diff --git a/MissionEditor/MapOpenDialog.h b/MissionEditor/MapOpenDialog.h index f478162..4aa823b 100644 --- a/MissionEditor/MapOpenDialog.h +++ b/MissionEditor/MapOpenDialog.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MAPOPENDIALOG_H__BA196F80_ACBA_11D3_B63B_8A39ED4C0940__INCLUDED_) diff --git a/MissionEditor/MapTool.h b/MissionEditor/MapTool.h index 60bab55..3fa1ad0 100644 --- a/MissionEditor/MapTool.h +++ b/MissionEditor/MapTool.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -29,59 +29,59 @@ class CIsoView; enum class MapToolMouseFlags { - DEFAULT = 0, - LBUTTON = 1, - MBUTTON = 2, - RBUTTON = 4, - SHIFT = 8 + DEFAULT = 0, + LBUTTON = 1, + MBUTTON = 2, + RBUTTON = 4, + SHIFT = 8 }; DEFINE_ENUM_FLAG_OPERATORS(MapToolMouseFlags); inline MapToolMouseFlags MapToolMouseFlagsFromWin32(UINT nFlags) { - MapToolMouseFlags flags = MapToolMouseFlags::DEFAULT; + MapToolMouseFlags flags = MapToolMouseFlags::DEFAULT; - if ((nFlags & MK_LBUTTON) == MK_LBUTTON) - flags |= MapToolMouseFlags::LBUTTON; + if ((nFlags & MK_LBUTTON) == MK_LBUTTON) + flags |= MapToolMouseFlags::LBUTTON; - if ((nFlags & MK_MBUTTON) == MK_MBUTTON) - flags |= MapToolMouseFlags::MBUTTON; + if ((nFlags & MK_MBUTTON) == MK_MBUTTON) + flags |= MapToolMouseFlags::MBUTTON; - if ((nFlags & MK_RBUTTON) == MK_RBUTTON) - flags |= MapToolMouseFlags::RBUTTON; + if ((nFlags & MK_RBUTTON) == MK_RBUTTON) + flags |= MapToolMouseFlags::RBUTTON; - if ((nFlags & MK_SHIFT) == MK_SHIFT) - flags |= MapToolMouseFlags::SHIFT; - - return flags; + if ((nFlags & MK_SHIFT) == MK_SHIFT) + flags |= MapToolMouseFlags::SHIFT; + + return flags; } class MapTool { public: - virtual ~MapTool() = default; + virtual ~MapTool() = default; - // return false if tool has not handled this call (or doesn't want to override any caller behavior) - virtual bool onRButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) - { - return false; - }; + // return false if tool has not handled this call (or doesn't want to override any caller behavior) + virtual bool onRButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) + { + return false; + }; - virtual void onLButtonDblClick(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; - virtual void onLButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; - virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; - virtual void render() {}; + virtual void onLButtonDblClick(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; + virtual void onLButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; + virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) {}; + virtual void render() {}; protected: - MapTool(CMapData& map, CIsoView& view) : m_map(map), m_view(view) {}; - MapTool& operator=(const MapTool& other) = delete; + MapTool(CMapData& map, CIsoView& view) : m_map(map), m_view(view) {}; + MapTool& operator=(const MapTool& other) = delete; - CMapData& getMap() { return m_map; } - const CMapData& getMap() const { return m_map; } - CIsoView& getView() { return m_view; } - const CIsoView& getView() const { return m_view; } + CMapData& getMap() { return m_map; } + const CMapData& getMap() const { return m_map; } + CIsoView& getView() { return m_view; } + const CIsoView& getView() const { return m_view; } private: - CMapData& m_map; - CIsoView& m_view; + CMapData& m_map; + CIsoView& m_view; }; \ No newline at end of file diff --git a/MissionEditor/MapValidator.cpp b/MissionEditor/MapValidator.cpp index 47ec824..6919005 100644 --- a/MissionEditor/MapValidator.cpp +++ b/MissionEditor/MapValidator.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MapValidator.cpp: implementation file @@ -45,7 +45,7 @@ CMapValidator::CMapValidator(CWnd* pParent /*=NULL*/) : CDialog(CMapValidator::IDD, pParent) { //{{AFX_DATA_INIT(CMapValidator) - + //}}AFX_DATA_INIT } @@ -75,43 +75,42 @@ void CMapValidator::UpdateStrings() SetDlgItemText(IDCANCEL, GetLanguageStringACP("Cancel")); } -BOOL CMapValidator::OnInitDialog() +BOOL CMapValidator::OnInitDialog() { CDialog::OnInitDialog(); - + UpdateStrings(); - m_ProblemImages.Create(16,16,ILC_COLOR8 | ILC_MASK,0, 50 ); - + m_ProblemImages.Create(16, 16, ILC_COLOR8 | ILC_MASK, 0, 50); + CBitmap bmpIcons; bmpIcons.LoadBitmap(IDB_MV_ICONS); - m_ProblemImages.Add(&bmpIcons, RGB(255,255,255)); - m_MapProblemList.SetImageList(&m_ProblemImages,LVSIL_SMALL); - m_MapProblemList.SetImageList(&m_ProblemImages,LVSIL_NORMAL); + m_ProblemImages.Add(&bmpIcons, RGB(255, 255, 255)); + m_MapProblemList.SetImageList(&m_ProblemImages, LVSIL_SMALL); + m_MapProblemList.SetImageList(&m_ProblemImages, LVSIL_NORMAL); auto col = m_MapProblemList.InsertColumn(0, ""); //RECT r; //m_MapProblemList.GetClientRect(&r); - - BOOL bSaveAble=CheckMap(); + + BOOL bSaveAble = CheckMap(); m_MapProblemList.SetColumnWidth(col, LVSCW_AUTOSIZE); - if(bSaveAble==FALSE) GetDlgItem(IDOK)->EnableWindow(FALSE); - - return TRUE; + if (bSaveAble == FALSE) GetDlgItem(IDOK)->EnableWindow(FALSE); + + return TRUE; } void AddItemWithNewLine(CListCtrl& ctrl, CString s, int image) { s.Replace("\\n", "\n"); int n = ctrl.GetItemCount(); - for (const auto& line : Split(s, '\n')) - { + for (const auto& line : Split(s, '\n')) { ctrl.InsertItem(n++, line, image); image = 2; } @@ -125,12 +124,12 @@ If FALSE is returned, you should not anymore allow to save the map. */ BOOL CMapValidator::CheckMap() { - BOOL bAllow=TRUE; + BOOL bAllow = TRUE; // now check the map Map->UpdateIniFile(MAPDATA_UPDATE_TO_INI); - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (!ini.TryGetSection("Map")) { bAllow = FALSE; @@ -140,14 +139,13 @@ BOOL CMapValidator::CheckMap() bAllow = FALSE; AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_NoBasic"), 0); } else { - if (ini.GetString("Basic","Name").IsEmpty()) { + if (ini.GetString("Basic", "Name").IsEmpty()) { AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_NoName"), 1); } #ifdef TS_MODE if (ini.GetString("Basic", "Player").IsEmpty()) { - if(ini.sections.find(MAPHOUSES)!=ini.sections.end() && ini.sections["Houses"].values.size()>0) - { + if (ini.sections.find(MAPHOUSES) != ini.sections.end() && ini.sections["Houses"].values.size() > 0) { AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesButNoPlayer"), 1); AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesInMultiplayer"), 1); } @@ -156,21 +154,19 @@ BOOL CMapValidator::CheckMap() if (!ini.TryGetSection(MAPHOUSES)) { int d = Map->GetWaypointCount(); - int below8found=0; + int below8found = 0; int i; - for(i=0;iGetWaypointData(i, &id, &pos); - if(atoi(id)<8) - { + if (atoi(id) < 8) { below8found++; } } if (below8found < 8) { - if(!ini.GetBool("Basic", "Official")) { + if (!ini.GetBool("Basic", "Official")) { AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_Not8Waypoints"), 1); } @@ -178,7 +174,7 @@ BOOL CMapValidator::CheckMap() AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesNoWaypoints"), 1); } } - + #ifdef RA2_MODE if (ini.GetBool("Basic", "Official")) { AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_OfficialYes"), 1); @@ -252,25 +248,25 @@ BOOL CMapValidator::CheckMap() } } - for (auto i = 0; i < Map->GetCelltagCount(); i++) { + for (auto i = 0; i < Map->GetCelltagCount(); i++) { CString tag; DWORD pos; Map->GetCelltagData(i, &tag, &pos); - int x=pos%Map->GetIsoSize(); - int y=pos/Map->GetIsoSize(); + int x = pos % Map->GetIsoSize(); + int y = pos / Map->GetIsoSize(); char cx[50]; char cy[50]; itoa(x, cx, 10); itoa(y, cy, 10); - CString p=cx; - p+="/"; - p+=cy; + CString p = cx; + p += "/"; + p += cy; if (!ini["Tags"].Exists(tag)) { CString error; - error=GetLanguageStringACP("MV_TagMissing"); - error=TranslateStringVariables(1, error, tag); - error=TranslateStringVariables(2, error, "Celltag"); - error=TranslateStringVariables(3, error, p); + error = GetLanguageStringACP("MV_TagMissing"); + error = TranslateStringVariables(1, error, tag); + error = TranslateStringVariables(2, error, "Celltag"); + error = TranslateStringVariables(3, error, p); AddItemWithNewLine(m_MapProblemList, error, 1); } } @@ -278,11 +274,9 @@ BOOL CMapValidator::CheckMap() } const auto& tubes = Map->GetTubes(); - for (auto& tube : tubes) - { + for (auto& tube : tubes) { auto n_reverse = std::count_if(tubes.begin(), tubes.end(), [&tube](const auto& other) { return tube->isCounterpart(*other); }); - if (n_reverse == 0) - { + if (n_reverse == 0) { CString error = TranslateTubeString( GetLanguageStringACP("MV_TubeCounterpartMissing"), *tube, @@ -291,8 +285,7 @@ BOOL CMapValidator::CheckMap() AddItemWithNewLine(m_MapProblemList, error, 0); } auto n_same_start = std::count_if(tubes.begin(), tubes.end(), [&tube](const auto& other) { return tube->getStartCoords() == other->getStartCoords() && *tube != *other; }); - if (n_same_start) - { + if (n_same_start) { CString error = TranslateTubeString( GetLanguageStringACP("MV_TubeStartNotUnique"), *tube, @@ -301,8 +294,7 @@ BOOL CMapValidator::CheckMap() AddItemWithNewLine(m_MapProblemList, error, 0); } auto n_same_end = std::count_if(tubes.begin(), tubes.end(), [&tube](const auto& other) { return tube->getEndCoords() == other->getEndCoords() && *tube != *other; }); - if (n_same_end) - { + if (n_same_end) { CString error = TranslateTubeString( GetLanguageStringACP("MV_TubeEndNotUnique"), *tube, @@ -311,8 +303,7 @@ BOOL CMapValidator::CheckMap() AddItemWithNewLine(m_MapProblemList, error, 0); } auto n_invalid_counterpart_end = std::count_if(tubes.begin(), tubes.end(), [&tube](const auto& other) { return tube->getEndCoords() == other->getStartCoords() && tube->getStartCoords() != other->getEndCoords(); }); - if (n_invalid_counterpart_end) - { + if (n_invalid_counterpart_end) { CString error = TranslateTubeString( GetLanguageStringACP("MV_TubeInvalidCounterpartEnd"), *tube, @@ -321,8 +312,7 @@ BOOL CMapValidator::CheckMap() AddItemWithNewLine(m_MapProblemList, error, 0); } auto n_invalid_counterpart_start = std::count_if(tubes.begin(), tubes.end(), [&tube](const auto& other) { return tube->getStartCoords() == other->getEndCoords() && tube->getEndCoords() != other->getStartCoords(); }); - if (n_invalid_counterpart_start) - { + if (n_invalid_counterpart_start) { CString error = TranslateTubeString( GetLanguageStringACP("MV_TubeInvalidCounterpartStart"), *tube, @@ -333,26 +323,24 @@ BOOL CMapValidator::CheckMap() } int i; - BOOL bWaypBig=FALSE; - for(i=0;iGetWaypointCount();i++) - { + BOOL bWaypBig = FALSE; + for (i = 0; i < Map->GetWaypointCount(); i++) { DWORD pos; CString id; Map->GetWaypointData(i, &id, &pos); - if(atoi(id)>99) bWaypBig=TRUE; + if (atoi(id) > 99) bWaypBig = TRUE; } - if(bWaypBig) + if (bWaypBig) AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_>100Waypoint"), 1); - - if(Map->IsYRMap()) - { + + if (Map->IsYRMap()) { AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("NeedsYR"), 1); } - return bAllow; + return bAllow; } CString TranslateTubeString(const char* error_, const CTube& tube, int count) diff --git a/MissionEditor/MapValidator.h b/MissionEditor/MapValidator.h index 7097b27..acb99be 100644 --- a/MissionEditor/MapValidator.h +++ b/MissionEditor/MapValidator.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MAPVALIDATOR_H__B290D180_F761_11D3_B63B_00485453E8BA__INCLUDED_) @@ -34,20 +34,20 @@ class CMapValidator : public CDialog { -// construction + // construction public: CMapValidator(CWnd* pParent = NULL); // standard constructor // dialog field data //{{AFX_DATA(CMapValidator) enum { IDD = IDD_MAPVALIDATOR }; - + //}}AFX_DATA // overwriteables //{{AFX_VIRTUAL(CMapValidator) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL diff --git a/MissionEditor/MiniMap.cpp b/MissionEditor/MiniMap.cpp index 69f5b01..2825009 100644 --- a/MissionEditor/MiniMap.cpp +++ b/MissionEditor/MiniMap.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MiniMap.cpp: implementaion file @@ -41,7 +41,7 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(CMiniMap, CView) -CMiniMap::CMiniMap(): m_scale(theApp.m_Options.fMiniMapScale) +CMiniMap::CMiniMap() : m_scale(theApp.m_Options.fMiniMapScale) { } @@ -65,14 +65,14 @@ END_MESSAGE_MAP() void CMiniMap::OnDraw(CDC* pDC) { - + BYTE* colors; BITMAPINFO biinfo; int pitch; DrawMinimap(&colors, biinfo, pitch); - if(!colors) return; - + if (!colors) return; + // set the bits //SetDIBitsToDevice(pDC->m_hDC, 0, 0, Map->GetWidth()*2, Map->GetHeight(),0,0,0, Map->GetHeight(), colors, &biinfo, DIB_RGB_COLORS); RECT r; @@ -81,15 +81,15 @@ void CMiniMap::OnDraw(CDC* pDC) // now draw the current position - CFinalSunDlg& dlg=*(CFinalSunDlg*)theApp.GetMainWnd(); - CIsoView& isoview=*dlg.m_view.m_isoview; + CFinalSunDlg& dlg = *(CFinalSunDlg*)theApp.GetMainWnd(); + CIsoView& isoview = *dlg.m_view.m_isoview; RECT selRect; auto isoRect = isoview.GetScaledDisplayRect(); - - int mapwidth=Map->GetWidth(); - int mapheight=Map->GetHeight(); - + int mapwidth = Map->GetWidth(); + int mapheight = Map->GetHeight(); + + // Get iso view display rectangle RECT cr; isoview.GetClientRect(&cr); @@ -109,8 +109,8 @@ void CMiniMap::OnDraw(CDC* pDC) selRect.bottom = bottom * m_scale; - pDC->Draw3dRect(&selRect, RGB(200,0,0), RGB(120,0,0)); - + pDC->Draw3dRect(&selRect, RGB(200, 0, 0), RGB(120, 0, 0)); + } ///////////////////////////////////////////////////////////////////////////// @@ -131,32 +131,32 @@ void CMiniMap::Dump(CDumpContext& dc) const ///////////////////////////////////////////////////////////////////////////// // handlers -BOOL CMiniMap::PreCreateWindow(CREATESTRUCT& cs) +BOOL CMiniMap::PreCreateWindow(CREATESTRUCT& cs) { // MW 07/17/2001: Style changed cs.style = WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU;// | WS_CHILD; - cs.cx=0; - cs.cy=0; - - CFinalSunDlg& dlg=*(CFinalSunDlg*)theApp.GetMainWnd(); + cs.cx = 0; + cs.cy = 0; + + CFinalSunDlg& dlg = *(CFinalSunDlg*)theApp.GetMainWnd(); //CIsoView& isoview=*dlg.m_view.m_isoview; RECT r; dlg.GetWindowRect(&r); - - cs.x=0;//r.right-250 ; - cs.y=r.bottom-250; - if(cs.y<0) cs.y=0; + + cs.x = 0;//r.right-250 ; + cs.y = r.bottom - 250; + if (cs.y < 0) cs.y = 0; //cs.dwExStyle=WS_EX_TOOLWINDOW; //cs.dwExStyle=WS_EX_PALETTEWINDOW; - - // this here will cause an assert in debug mode, ignore it (window must be a child window) - int res=CWnd::PreCreateWindow(cs); - cs.style=WS_POPUPWINDOW | WS_CAPTION /*| WS_DLGFRAME */ | WS_THICKFRAME | WS_OVERLAPPED | DS_3DLOOK | WS_MINIMIZEBOX; //WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; + // this here will cause an assert in debug mode, ignore it (window must be a child window) + int res = CWnd::PreCreateWindow(cs); + + cs.style = WS_POPUPWINDOW | WS_CAPTION /*| WS_DLGFRAME */ | WS_THICKFRAME | WS_OVERLAPPED | DS_3DLOOK | WS_MINIMIZEBOX; //WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX; return res; - + } void CMiniMap::UpdateView() @@ -164,15 +164,12 @@ void CMiniMap::UpdateView() CRect r; GetWindowRect(r); - if(Map->GetIsoSize()==0) - { + if (Map->GetIsoSize() == 0) { ShowWindow(SW_HIDE); - } - else - { + } else { // calculate the needed width=height - int axissizex=Map->GetWidth()*2; - int axissizey=Map->GetHeight(); + int axissizex = Map->GetWidth() * 2; + int axissizey = Map->GetHeight(); SetIcon(theApp.m_pMainWnd->GetIcon(FALSE), FALSE); SetIcon(theApp.m_pMainWnd->GetIcon(TRUE), TRUE); @@ -180,31 +177,29 @@ void CMiniMap::UpdateView() RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } - + } -BOOL bMiniMapClosedByUser=FALSE; +BOOL bMiniMapClosedByUser = FALSE; -void CMiniMap::OnSysCommand(UINT nID, LPARAM lParam) +void CMiniMap::OnSysCommand(UINT nID, LPARAM lParam) { - if(nID==SC_CLOSE) - { - bMiniMapClosedByUser=TRUE; + if (nID == SC_CLOSE) { + bMiniMapClosedByUser = TRUE; ShowWindow(SW_HIDE); return; } - + CWnd::OnSysCommand(nID, lParam); } -void CMiniMap::OnMouseMove(UINT nFlags, CPoint point) +void CMiniMap::OnMouseMove(UINT nFlags, CPoint point) { - if(nFlags==MK_LBUTTON) - { - int x,y; + if (nFlags == MK_LBUTTON) { + int x, y; int xiso; int yiso; @@ -225,35 +220,34 @@ void CMiniMap::OnMouseMove(UINT nFlags, CPoint point) auto viewScale = isoview.GetViewScale(); auto viewOffset = isoview.GetViewOffset(); - x = (point.x / m_scale / resizedXScale) / 2 +Map->GetHeight() / 2; + x = (point.x / m_scale / resizedXScale) / 2 + Map->GetHeight() / 2; y = (point.y / m_scale / resizedYScale) + Map->GetWidth() / 2; - + RECT r = isoview.GetScaledDisplayRect(); - - isoview.SetScroll((x-r.right/f_x/2)*f_x, (y-r.bottom/f_y/2)*f_y); - + isoview.SetScroll((x - r.right / f_x / 2) * f_x, (y - r.bottom / f_y / 2) * f_y); + + isoview.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } } -void CMiniMap::OnLButtonDown(UINT nFlags, CPoint point) +void CMiniMap::OnLButtonDown(UINT nFlags, CPoint point) { - + OnMouseMove(nFlags, point); } -void CMiniMap::DrawMinimap(BYTE **lpData, BITMAPINFO &biinfo, int& Pitch) +void CMiniMap::DrawMinimap(BYTE** lpData, BITMAPINFO& biinfo, int& Pitch) { - Map->GetMinimap(lpData, &biinfo, &Pitch); + Map->GetMinimap(lpData, &biinfo, &Pitch); // fix straw pixels auto* data = *lpData; - if (data) - { + if (data) { // fix bottom left and right top pixels in the bottom-up bitmap memcpy(&data[0], &data[sizeof(RGBTRIPLE)], sizeof(RGBTRIPLE)); auto firstLine = (biinfo.bmiHeader.biHeight - 1) * Pitch; @@ -271,17 +265,13 @@ void CMiniMap::OnSizing(UINT fwSide, LPRECT pRect) int axissizey = Map->GetHeight(); float ratio = float(axissizex) / float(axissizey); - if (pRect) - { + if (pRect) { int heightAdd = 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION); int widthAdd = 2 * GetSystemMetrics(SM_CXFIXEDFRAME); if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT || - fwSide == WMSZ_RIGHT || fwSide == WMSZ_BOTTOMRIGHT) - { + fwSide == WMSZ_RIGHT || fwSide == WMSZ_BOTTOMRIGHT) { pRect->bottom = pRect->top + (pRect->right - pRect->left - widthAdd) / ratio + heightAdd; - } - else - { + } else { pRect->right = pRect->left + (pRect->bottom - pRect->top - heightAdd) * ratio + widthAdd; } } @@ -289,7 +279,7 @@ void CMiniMap::OnSizing(UINT fwSide, LPRECT pRect) //width = axissizex* m_scale + 2 * (GetSystemMetrics(SM_CXFIXEDFRAME)) m_scale = ((pRect->right - pRect->left) - 2 * GetSystemMetrics(SM_CXFIXEDFRAME)) / (float)axissizex; - + RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } diff --git a/MissionEditor/MiniMap.h b/MissionEditor/MiniMap.h index 5893261..8c47a7e 100644 --- a/MissionEditor/MiniMap.h +++ b/MissionEditor/MiniMap.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MINIMAP_H__43F7CCE0_CC11_11D3_B63B_00485453E8BA__INCLUDED_) @@ -33,23 +33,23 @@ class CMiniMap : public CView { public: - CMiniMap(); + CMiniMap(); virtual ~CMiniMap(); DECLARE_DYNCREATE(CMiniMap) -// attributes + // attributes public: -// operations + // operations public: void DrawMinimap(BYTE** lpData, BITMAPINFO& biinfo, int& Pitch); - + void UpdateView(); -// overwriteables - //{{AFX_VIRTUAL(CMiniMap) - protected: - virtual void OnDraw(CDC* pDC); + // overwriteables + //{{AFX_VIRTUAL(CMiniMap) +protected: + virtual void OnDraw(CDC* pDC); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL @@ -59,8 +59,8 @@ protected: virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif - - + + // generated message maps protected: //{{AFX_MSG(CMiniMap) diff --git a/MissionEditor/MissionEditor.rc b/MissionEditor/MissionEditor.rc index a1ae57c..8e016cf 100644 --- a/MissionEditor/MissionEditor.rc +++ b/MissionEditor/MissionEditor.rc @@ -26,33 +26,33 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN - "resource.h\0" +"resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN - "#include ""afxres.h""\r\n" - "\0" +"#include ""afxres.h""\r\n" +"\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(65001)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\FinalSun.rc2"" // Nicht mit Microsoft Visual C++ bearbeitete Ressourcen\r\n" - "#include ""afxres.rc"" // Standardkomponenten\r\n" - "#endif\r\n" - "\0" +"#define _AFX_NO_SPLITTER_RESOURCES\r\n" +"#define _AFX_NO_OLE_RESOURCES\r\n" +"#define _AFX_NO_TRACKER_RESOURCES\r\n" +"#define _AFX_NO_PROPERTY_RESOURCES\r\n" +"\r\n" +"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" +"#ifdef _WIN32\r\n" +"LANGUAGE 9, 1\r\n" +"#pragma code_page(65001)\r\n" +"#endif //_WIN32\r\n" +"#include ""res\\FinalSun.rc2"" // Nicht mit Microsoft Visual C++ bearbeitete Ressourcen\r\n" +"#include ""afxres.rc"" // Standardkomponenten\r\n" +"#endif\r\n" +"\0" END #endif // APSTUDIO_INVOKED @@ -171,10 +171,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Create new house" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 - LTEXT "Choose parent country:",IDC_STATIC,7,7,98,12 - COMBOBOX IDC_COUNTRY,7,20,112,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 129, 7, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 129, 24, 50, 14 +LTEXT "Choose parent country:", IDC_STATIC, 7, 7, 98, 12 +COMBOBOX IDC_COUNTRY, 7, 20, 112, 118, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -187,21 +187,21 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Save options" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,176,104,50,14 - PUSHBUTTON "Cancel",IDCANCEL,117,104,50,14 - CONTROL "Compress map",IDC_COMPRESS,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP,19,42,118,12 - CONTROL "Don't compress map (use this if any problems with the map occur in RA2/TS)",IDC_NOCOMPRESSION, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | NOT WS_VISIBLE,19,52,192,21 - CONTROL "Create new preview using minimap",IDC_PREVIEWMODE, - "Button",BS_AUTORADIOBUTTON | WS_GROUP,19,40,150,13 - CONTROL "Use existing preview (if possible)",IDC_EXISTINGPREVIEW, - "Button",BS_AUTORADIOBUTTON,19,53,141,12 - CONTROL "Don't save any preview",IDC_NOPREVIEW,"Button",BS_AUTORADIOBUTTON,19,66,141,12 - GROUPBOX "Compression",IDC_STATIC,7,28,219,52,NOT WS_VISIBLE - GROUPBOX "Preview",IDC_STATIC,7,29,219,56 - LTEXT "If you want to play the map online, you should try to make the file size as low as possible. This includes turning off the preview. You should also try using compression.",IDC_STATIC,7,90,219,27,NOT WS_VISIBLE - LTEXT "Map name:",IDC_STATIC,7,7,63,13 - EDITTEXT IDC_MAPNAME,73,7,153,12,ES_AUTOHSCROLL +DEFPUSHBUTTON "OK", IDOK, 176, 104, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 117, 104, 50, 14 +CONTROL "Compress map", IDC_COMPRESS, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP, 19, 42, 118, 12 +CONTROL "Don't compress map (use this if any problems with the map occur in RA2/TS)", IDC_NOCOMPRESSION, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE | NOT WS_VISIBLE, 19, 52, 192, 21 +CONTROL "Create new preview using minimap", IDC_PREVIEWMODE, +"Button", BS_AUTORADIOBUTTON | WS_GROUP, 19, 40, 150, 13 +CONTROL "Use existing preview (if possible)", IDC_EXISTINGPREVIEW, +"Button", BS_AUTORADIOBUTTON, 19, 53, 141, 12 +CONTROL "Don't save any preview", IDC_NOPREVIEW, "Button", BS_AUTORADIOBUTTON, 19, 66, 141, 12 +GROUPBOX "Compression", IDC_STATIC, 7, 28, 219, 52, NOT WS_VISIBLE +GROUPBOX "Preview", IDC_STATIC, 7, 29, 219, 56 +LTEXT "If you want to play the map online, you should try to make the file size as low as possible. This includes turning off the preview. You should also try using compression.", IDC_STATIC, 7, 90, 219, 27, NOT WS_VISIBLE +LTEXT "Map name:", IDC_STATIC, 7, 7, 63, 13 +EDITTEXT IDC_MAPNAME, 73, 7, 153, 12, ES_AUTOHSCROLL END #endif @@ -210,13 +210,13 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Specify file type" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,224,84,50,14 - PUSHBUTTON "Cancel",IDCANCEL,161,84,50,14 - LTEXT "Please specify if you want to save your multiplayer map as *.mmx map or as *.mpr map. While *.mmx maps are the recommended method, as they are fully supported and do not slow down RA2 when loading, they are never transferred automatically to other players!",IDC_STATIC,7,7,267,38 - CONTROL "Save as *.mmx (no automatic map transfer)",IDC_MMX, - "Button",BS_AUTORADIOBUTTON | WS_GROUP,7,47,267,15 - CONTROL "Save as *.mpr (many mprs slow down RA2 while loading)",IDC_MMX2, - "Button",BS_AUTORADIOBUTTON,7,59,267,15 +DEFPUSHBUTTON "OK", IDOK, 224, 84, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 161, 84, 50, 14 +LTEXT "Please specify if you want to save your multiplayer map as *.mmx map or as *.mpr map. While *.mmx maps are the recommended method, as they are fully supported and do not slow down RA2 when loading, they are never transferred automatically to other players!", IDC_STATIC, 7, 7, 267, 38 +CONTROL "Save as *.mmx (no automatic map transfer)", IDC_MMX, +"Button", BS_AUTORADIOBUTTON | WS_GROUP, 7, 47, 267, 15 +CONTROL "Save as *.mpr (many mprs slow down RA2 while loading)", IDC_MMX2, +"Button", BS_AUTORADIOBUTTON, 7, 59, 267, 15 END IDD_MMXOPTIONS DIALOG 0, 0, 268, 172 @@ -224,23 +224,23 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "MMX options" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,211,151,50,14 - PUSHBUTTON "Cancel",IDCANCEL,141,151,50,14 - LTEXT "If description tag does not exist, RA2 will place MISSING: in front of the map name, this does not affect the game!",IDC_STATIC,7,7,254,21 - LTEXT "Description tag:",IDC_STATIC,7,37,80,12 - EDITTEXT IDC_DESCRIPTION,90,37,171,15,ES_AUTOHSCROLL - CONTROL "Standard",IDC_STANDARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,89,80,14 - CONTROL "Meatgrind",IDC_MEATGRIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,90,80,14 - CONTROL "Naval War",IDC_NAVALWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,90,80,14 - CONTROL "Nuke War",IDC_NUKEWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,105,80,14 - CONTROL "Air War",IDC_AIRWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,105,80,14 - CONTROL "Mega Wealth",IDC_MEGAWEALTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,105,80,14 - CONTROL "Duel",IDC_DUEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,121,80,14 - CONTROL "Cooperative",IDC_COOPERATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,121,80,14 - LTEXT "Min players:",IDC_STATIC,7,63,54,12 - COMBOBOX IDC_MINPLAYERS,89,62,40,103,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Max players:",IDC_STATIC,148,63,54,12 - COMBOBOX IDC_MAXPLAYERS,221,61,40,104,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 211, 151, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 141, 151, 50, 14 +LTEXT "If description tag does not exist, RA2 will place MISSING: in front of the map name, this does not affect the game!", IDC_STATIC, 7, 7, 254, 21 +LTEXT "Description tag:", IDC_STATIC, 7, 37, 80, 12 +EDITTEXT IDC_DESCRIPTION, 90, 37, 171, 15, ES_AUTOHSCROLL +CONTROL "Standard", IDC_STANDARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 89, 80, 14 +CONTROL "Meatgrind", IDC_MEATGRIND, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 92, 90, 80, 14 +CONTROL "Naval War", IDC_NAVALWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 174, 90, 80, 14 +CONTROL "Nuke War", IDC_NUKEWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 105, 80, 14 +CONTROL "Air War", IDC_AIRWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 92, 105, 80, 14 +CONTROL "Mega Wealth", IDC_MEGAWEALTH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 174, 105, 80, 14 +CONTROL "Duel", IDC_DUEL, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 121, 80, 14 +CONTROL "Cooperative", IDC_COOPERATIVE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 92, 121, 80, 14 +LTEXT "Min players:", IDC_STATIC, 7, 63, 54, 12 +COMBOBOX IDC_MINPLAYERS, 89, 62, 40, 103, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Max players:", IDC_STATIC, 148, 63, 54, 12 +COMBOBOX IDC_MAXPLAYERS, 221, 61, 40, 104, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -253,30 +253,30 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Save options" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,176,165,50,14 - PUSHBUTTON "Cancel",IDCANCEL,117,165,50,14 - CONTROL "Compress map",IDC_COMPRESS,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP,201,46,25,8 - CONTROL "Don't compress map (use this if any problems with the map occur in RA2/TS)",IDC_NOCOMPRESSION, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | NOT WS_VISIBLE,184,62,42,13 - CONTROL "Create new preview using minimap",IDC_PREVIEWMODE, - "Button",BS_AUTORADIOBUTTON | WS_GROUP,19,40,150,13 - CONTROL "Use existing preview (if possible)",IDC_EXISTINGPREVIEW, - "Button",BS_AUTORADIOBUTTON,19,53,141,12 - CONTROL "Don't save any preview",IDC_NOPREVIEW,"Button",BS_AUTORADIOBUTTON,19,66,141,12 - GROUPBOX "Compression",IDC_STATIC,119,52,107,15,NOT WS_VISIBLE - GROUPBOX "Preview",IDC_STATIC,7,29,219,56 - LTEXT "If you want to play the map online, you should try to make the file size as low as possible. This includes turning off the preview.",IDC_STATIC,7,143,219,21 - LTEXT "Map name:",IDC_STATIC,7,7,63,13 - EDITTEXT IDC_MAPNAME,73,7,153,12,ES_AUTOHSCROLL - CONTROL "Standard",IDC_STANDARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,89,67,14 - CONTROL "Meatgrind",IDC_MEATGRIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,90,65,14 - CONTROL "Naval War",IDC_NAVALWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,90,65,14 - CONTROL "Nuke War",IDC_NUKEWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,105,66,14 - CONTROL "Air War",IDC_AIRWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,105,65,14 - CONTROL "Mega Wealth",IDC_MEGAWEALTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,105,80,14 - CONTROL "Land Rush",IDC_DUEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,121,59,14 - CONTROL "Cooperative",IDC_COOPERATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,121,70,14 - CONTROL "Team Alliance",IDC_TEAMGAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,121,65,14 +DEFPUSHBUTTON "OK", IDOK, 176, 165, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 117, 165, 50, 14 +CONTROL "Compress map", IDC_COMPRESS, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP, 201, 46, 25, 8 +CONTROL "Don't compress map (use this if any problems with the map occur in RA2/TS)", IDC_NOCOMPRESSION, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE | NOT WS_VISIBLE, 184, 62, 42, 13 +CONTROL "Create new preview using minimap", IDC_PREVIEWMODE, +"Button", BS_AUTORADIOBUTTON | WS_GROUP, 19, 40, 150, 13 +CONTROL "Use existing preview (if possible)", IDC_EXISTINGPREVIEW, +"Button", BS_AUTORADIOBUTTON, 19, 53, 141, 12 +CONTROL "Don't save any preview", IDC_NOPREVIEW, "Button", BS_AUTORADIOBUTTON, 19, 66, 141, 12 +GROUPBOX "Compression", IDC_STATIC, 119, 52, 107, 15, NOT WS_VISIBLE +GROUPBOX "Preview", IDC_STATIC, 7, 29, 219, 56 +LTEXT "If you want to play the map online, you should try to make the file size as low as possible. This includes turning off the preview.", IDC_STATIC, 7, 143, 219, 21 +LTEXT "Map name:", IDC_STATIC, 7, 7, 63, 13 +EDITTEXT IDC_MAPNAME, 73, 7, 153, 12, ES_AUTOHSCROLL +CONTROL "Standard", IDC_STANDARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 89, 67, 14 +CONTROL "Meatgrind", IDC_MEATGRIND, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 83, 90, 65, 14 +CONTROL "Naval War", IDC_NAVALWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 161, 90, 65, 14 +CONTROL "Nuke War", IDC_NUKEWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 105, 66, 14 +CONTROL "Air War", IDC_AIRWAR, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 83, 105, 65, 14 +CONTROL "Mega Wealth", IDC_MEGAWEALTH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 161, 105, 80, 14 +CONTROL "Land Rush", IDC_DUEL, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 121, 59, 14 +CONTROL "Cooperative", IDC_COOPERATIVE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 83, 121, 70, 14 +CONTROL "Team Alliance", IDC_TEAMGAME, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 161, 121, 65, 14 END #endif @@ -285,19 +285,19 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Change Map Size" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,155,173,50,14 - PUSHBUTTON "Cancel",IDCANCEL,97,173,50,14 - LTEXT "Please specify the new width and height of the map. Left and top will automatically be set so that the old area of the map is centered. You can change left and top to modify the left-top position (you may use negative numbers for left/top).",IDC_STATIC,7,7,198,36 - LTEXT "Width:",IDC_STATIC,7,54,71,13 - EDITTEXT IDC_WIDTH,86,52,62,15,ES_AUTOHSCROLL - LTEXT "Note: If there are any units, buildings, waypoints etc. outside of the new map area, they will be deleted.",IDC_STATIC,7,132,198,19 - LTEXT "Height:",IDC_STATIC,7,72,71,13 - EDITTEXT IDC_HEIGHT,86,70,62,15,ES_AUTOHSCROLL - LTEXT "Left:",IDC_STATIC,7,90,71,13 - EDITTEXT IDC_LEFT,86,88,62,15,ES_AUTOHSCROLL - LTEXT "Top:",IDC_STATIC,7,108,71,13 - EDITTEXT IDC_TOP,86,106,62,15,ES_AUTOHSCROLL - LTEXT "UNDO IS NOT AVAILABLE!",IDC_STATIC,7,152,198,16 +DEFPUSHBUTTON "OK", IDOK, 155, 173, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 97, 173, 50, 14 +LTEXT "Please specify the new width and height of the map. Left and top will automatically be set so that the old area of the map is centered. You can change left and top to modify the left-top position (you may use negative numbers for left/top).", IDC_STATIC, 7, 7, 198, 36 +LTEXT "Width:", IDC_STATIC, 7, 54, 71, 13 +EDITTEXT IDC_WIDTH, 86, 52, 62, 15, ES_AUTOHSCROLL +LTEXT "Note: If there are any units, buildings, waypoints etc. outside of the new map area, they will be deleted.", IDC_STATIC, 7, 132, 198, 19 +LTEXT "Height:", IDC_STATIC, 7, 72, 71, 13 +EDITTEXT IDC_HEIGHT, 86, 70, 62, 15, ES_AUTOHSCROLL +LTEXT "Left:", IDC_STATIC, 7, 90, 71, 13 +EDITTEXT IDC_LEFT, 86, 88, 62, 15, ES_AUTOHSCROLL +LTEXT "Top:", IDC_STATIC, 7, 108, 71, 13 +EDITTEXT IDC_TOP, 86, 106, 62, 15, ES_AUTOHSCROLL +LTEXT "UNDO IS NOT AVAILABLE!", IDC_STATIC, 7, 152, 198, 16 END IDD_AITRIGGERADD DIALOG 0, 0, 222, 97 @@ -305,10 +305,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enable AI Trigger" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,165,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,165,24,50,14 - LTEXT "Select AI Trigger that should be enabled:",IDC_STATIC,7,7,136,21 - LISTBOX IDC_AITRIGGERS,7,48,208,42,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 165, 7, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 165, 24, 50, 14 +LTEXT "Select AI Trigger that should be enabled:", IDC_STATIC, 7, 7, 136, 21 +LISTBOX IDC_AITRIGGERS, 7, 48, 208, 42, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END IDD_MYOPENDIALOG DIALOGEX 0, 0, 222, 30 @@ -316,8 +316,8 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_TRANSPARENT FONT 8, "Tahoma", 0, 0, 0x1 BEGIN - LTEXT "Map name:",IDC_STATIC,5,4,41,14 - EDITTEXT IDC_MAPNAME,54,4,155,14,ES_AUTOHSCROLL +LTEXT "Map name:", IDC_STATIC, 5, 4, 41, 14 +EDITTEXT IDC_MAPNAME, 54, 4, 155, 14, ES_AUTOHSCROLL END IDD_TIP DIALOGEX 0, 0, 275, 174 @@ -325,11 +325,11 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Tip of the day" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - LTEXT "TIP",IDC_TIPSTRING,28,63,177,60 - CONTROL "&Show tips at program start",IDC_STARTUP,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,152,134,10 - PUSHBUTTON "&Next tip",IDC_NEXTTIP,157,152,52,14,WS_GROUP - DEFPUSHBUTTON "&Close",IDOK,216,152,50,14,WS_GROUP - CONTROL "",IDC_TOOLTIPCENTER,"Static",SS_BLACKFRAME,12,11,251,134 +LTEXT "TIP", IDC_TIPSTRING, 28, 63, 177, 60 +CONTROL "&Show tips at program start", IDC_STARTUP, "Button", BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP, 13, 152, 134, 10 +PUSHBUTTON "&Next tip", IDC_NEXTTIP, 157, 152, 52, 14, WS_GROUP +DEFPUSHBUTTON "&Close", IDOK, 216, 152, 50, 14, WS_GROUP +CONTROL "", IDC_TOOLTIPCENTER, "Static", SS_BLACKFRAME, 12, 11, 251, 134 END IDD_FINALSUN_DIALOG DIALOGEX 0, 0, 414, 287 @@ -339,9 +339,9 @@ CAPTION "FinalAlert 2" MENU IDR_MAIN FONT 8, "Tahoma", 0, 0, 0x1 BEGIN - DEFPUSHBUTTON "just to prohibite enter to quit.",IDOK,0,124,21,12,NOT WS_VISIBLE - PUSHBUTTON "and that one to prevent cancelling",IDCANCEL,5,191,18,8,NOT WS_VISIBLE - LTEXT "As FinalAlert was dialog based in earlier versions, we need to have this.",IDC_STATIC,7,156,26,26 +DEFPUSHBUTTON "just to prohibite enter to quit.", IDOK, 0, 124, 21, 12, NOT WS_VISIBLE +PUSHBUTTON "and that one to prevent cancelling", IDCANCEL, 5, 191, 18, 8, NOT WS_VISIBLE +LTEXT "As FinalAlert was dialog based in earlier versions, we need to have this.", IDC_STATIC, 7, 156, 26, 26 END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -354,20 +354,20 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_NOFAILCREATE | WS_POPUP | WS_VISIBLE | WS_ CAPTION "Options" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,140,159,50,14 - PUSHBUTTON "Cancel",IDCANCEL,85,159,50,14 - LTEXT "Red Alert 2 EXE (make sure its in the correct path)",IDC_STATIC,5,5,130,20 - EDITTEXT IDC_EDIT1,5,25,130,15,ES_AUTOHSCROLL - PUSHBUTTON "Browse",IDC_CHOOSE,140,25,50,15 - LTEXT "Language / Sprache:",IDC_STATIC,7,51,128,11 - COMBOBOX IDC_LANGUAGE,7,63,183,94,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Support settings",IDC_STATIC,7,81,183,71 - CONTROL "Support mission disks and mods (recommended)",IDC_RULESLIKETS, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP,14,92,170,16 - CONTROL "Only support original Red Alert 2",IDC_ONLYORIGINAL, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE,14,108,168,16 - CONTROL "Prefer FinalAlert 2 theater INI files",IDC_PREFER_LOCAL_THEATER_FILES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,131,164,12 +DEFPUSHBUTTON "OK", IDOK, 140, 159, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 85, 159, 50, 14 +LTEXT "Red Alert 2 EXE (make sure its in the correct path)", IDC_STATIC, 5, 5, 130, 20 +EDITTEXT IDC_EDIT1, 5, 25, 130, 15, ES_AUTOHSCROLL +PUSHBUTTON "Browse", IDC_CHOOSE, 140, 25, 50, 15 +LTEXT "Language / Sprache:", IDC_STATIC, 7, 51, 128, 11 +COMBOBOX IDC_LANGUAGE, 7, 63, 183, 94, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +GROUPBOX "Support settings", IDC_STATIC, 7, 81, 183, 71 +CONTROL "Support mission disks and mods (recommended)", IDC_RULESLIKETS, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP, 14, 92, 170, 16 +CONTROL "Only support original Red Alert 2", IDC_ONLYORIGINAL, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE, 14, 108, 168, 16 +CONTROL "Prefer FinalAlert 2 theater INI files", IDC_PREFER_LOCAL_THEATER_FILES, +"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 131, 164, 12 END #endif @@ -376,19 +376,19 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "INI Editor" FONT 8, "Tahoma" BEGIN - LTEXT "We highly recommend not to use this editor except you really know what you are doing.",IDC_STATIC,6,5,290,15 - LTEXT "Sections:",IDC_STATIC,5,25,55,10 - COMBOBOX IDC_SECTIONS,61,25,235,85,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Keys:",IDC_STATIC,15,80,40,10 - PUSHBUTTON "Add",IDC_ADDSECTION,60,40,55,15 - PUSHBUTTON "Delete",IDC_DELETESECTION,120,40,55,15 - GROUPBOX "Section content",IDC_STATIC,6,67,290,130 - LISTBOX IDC_KEYS,60,80,225,90,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Value:",IDC_STATIC,15,175,40,15 - EDITTEXT IDC_VALUE,60,175,225,12,ES_AUTOHSCROLL - PUSHBUTTON "Add",IDC_ADDKEY,15,95,40,15 - PUSHBUTTON "Delete",IDC_DELETEKEY,15,115,40,15 - PUSHBUTTON "Insert another INI file content",IDC_INISECTION,181,40,115,15 +LTEXT "We highly recommend not to use this editor except you really know what you are doing.", IDC_STATIC, 6, 5, 290, 15 +LTEXT "Sections:", IDC_STATIC, 5, 25, 55, 10 +COMBOBOX IDC_SECTIONS, 61, 25, 235, 85, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Keys:", IDC_STATIC, 15, 80, 40, 10 +PUSHBUTTON "Add", IDC_ADDSECTION, 60, 40, 55, 15 +PUSHBUTTON "Delete", IDC_DELETESECTION, 120, 40, 55, 15 +GROUPBOX "Section content", IDC_STATIC, 6, 67, 290, 130 +LISTBOX IDC_KEYS, 60, 80, 225, 90, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Value:", IDC_STATIC, 15, 175, 40, 15 +EDITTEXT IDC_VALUE, 60, 175, 225, 12, ES_AUTOHSCROLL +PUSHBUTTON "Add", IDC_ADDKEY, 15, 95, 40, 15 +PUSHBUTTON "Delete", IDC_DELETEKEY, 15, 115, 40, 15 +PUSHBUTTON "Insert another INI file content", IDC_INISECTION, 181, 40, 115, 15 END IDD_MAP DIALOG 0, 0, 303, 204 @@ -396,20 +396,20 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Map Properties" FONT 8, "Tahoma" BEGIN - LTEXT "Except useable size just for information.",IDC_DESC,7,7,289,18 - GROUPBOX "Size of map data",IDC_SIZEFRAME,6,28,290,62 - GROUPBOX """Useable"" size",IDC_USEABLEFRAME,6,95,290,55 - LTEXT "The ""physical"" size of the map. Format: 0,0,Width,Height.",IDC_LSIZE,10,39,275,13 - EDITTEXT IDC__SIZEX,11,67,90,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "The ""useable"" size of the map. This specifies where you can place buildings etc. Has the following format: Left,Top,Right,Bottom",IDC_LUSEABLE,10,110,275,20 - EDITTEXT IDC_USESIZE,10,131,90,12,ES_AUTOHSCROLL - LTEXT "Theater:",IDC_LTHEATER,12,159,284,11 - COMBOBOX IDC_THEATER,10,170,90,45,CBS_DROPDOWN | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Change",IDC_CHANGELOCAL,111,131,70,13 - PUSHBUTTON "Change",IDC_CHANGE,212,67,70,13 - LTEXT "Width:",IDC_STATIC,12,56,93,9 - EDITTEXT IDC__SIZEY,106,67,90,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Height:",IDC_STATIC,107,56,93,9 +LTEXT "Except useable size just for information.", IDC_DESC, 7, 7, 289, 18 +GROUPBOX "Size of map data", IDC_SIZEFRAME, 6, 28, 290, 62 +GROUPBOX """Useable"" size", IDC_USEABLEFRAME, 6, 95, 290, 55 +LTEXT "The ""physical"" size of the map. Format: 0,0,Width,Height.", IDC_LSIZE, 10, 39, 275, 13 +EDITTEXT IDC__SIZEX, 11, 67, 90, 12, ES_AUTOHSCROLL | ES_READONLY +LTEXT "The ""useable"" size of the map. This specifies where you can place buildings etc. Has the following format: Left,Top,Right,Bottom", IDC_LUSEABLE, 10, 110, 275, 20 +EDITTEXT IDC_USESIZE, 10, 131, 90, 12, ES_AUTOHSCROLL +LTEXT "Theater:", IDC_LTHEATER, 12, 159, 284, 11 +COMBOBOX IDC_THEATER, 10, 170, 90, 45, CBS_DROPDOWN | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Change", IDC_CHANGELOCAL, 111, 131, 70, 13 +PUSHBUTTON "Change", IDC_CHANGE, 212, 67, 70, 13 +LTEXT "Width:", IDC_STATIC, 12, 56, 93, 9 +EDITTEXT IDC__SIZEY, 106, 67, 90, 12, ES_AUTOHSCROLL | ES_READONLY +LTEXT "Height:", IDC_STATIC, 107, 56, 93, 9 END IDD_INPUTBOX DIALOG 0, 0, 214, 70 @@ -417,10 +417,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,160,5,50,14 - PUSHBUTTON "Cancel",IDCANCEL,160,25,50,14 - LTEXT "Static",IDC_SENTENCE,5,5,150,35 - EDITTEXT IDC_VAL,5,50,205,12,ES_AUTOHSCROLL +DEFPUSHBUTTON "OK", IDOK, 160, 5, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 160, 25, 50, 14 +LTEXT "Static", IDC_SENTENCE, 5, 5, 150, 35 +EDITTEXT IDC_VAL, 5, 50, 205, 12, ES_AUTOHSCROLL END IDD_IMPORTINI DIALOG 0, 0, 229, 150 @@ -428,15 +428,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Insert INI file section" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,170,5,50,14 - PUSHBUTTON "Cancel",IDCANCEL,170,25,50,14 - LTEXT "Choose the sections you want to import in the map. Be careful! If you import a section that already exists, keys of the already existing section may be overwritten!",IDC_STATIC,5,5,155,35 - LISTBOX IDC_AVAILABLE,5,75,215,55,LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP - LTEXT "Available sections:",IDC_STATIC,5,65,100,10 - CONTROL "Import all sections",IDC_ALLSECTIONS,"Button",BS_AUTORADIOBUTTON,5,40,155,10 - CONTROL "Specify sections to be imported",IDC_SPECIFYSECTIONS, - "Button",BS_AUTORADIOBUTTON,5,50,150,10 - LTEXT "Select the sections you wish to import.",IDC_STATIC,5,135,215,10 +DEFPUSHBUTTON "OK", IDOK, 170, 5, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 170, 25, 50, 14 +LTEXT "Choose the sections you want to import in the map. Be careful! If you import a section that already exists, keys of the already existing section may be overwritten!", IDC_STATIC, 5, 5, 155, 35 +LISTBOX IDC_AVAILABLE, 5, 75, 215, 55, LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP +LTEXT "Available sections:", IDC_STATIC, 5, 65, 100, 10 +CONTROL "Import all sections", IDC_ALLSECTIONS, "Button", BS_AUTORADIOBUTTON, 5, 40, 155, 10 +CONTROL "Specify sections to be imported", IDC_SPECIFYSECTIONS, +"Button", BS_AUTORADIOBUTTON, 5, 50, 150, 10 +LTEXT "Select the sections you wish to import.", IDC_STATIC, 5, 135, 215, 10 END IDD_LIGHTING DIALOG 0, 0, 303, 204 @@ -444,29 +444,29 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Lighting Settings" FONT 8, "Tahoma" BEGIN - LTEXT "Lighting settings define the color of the terrain in the game, and you can specify a very dark or very bright map. Be careful, using wrong settings may cause the player to be unable to see his units.",IDC_DESC,6,5,290,25 - GROUPBOX "Normal",IDC_LNORMAL,6,35,290,65 - GROUPBOX "Ion storm settings",IDC_LIONSTORM,6,110,290,65 - LTEXT "Ambient:",IDC_LAMBIENT1,15,50,50,10 - EDITTEXT IDC_AMBIENT,65,50,75,12,ES_AUTOHSCROLL - LTEXT "Green:",IDC_LGREEN1,160,65,50,10 - EDITTEXT IDC_GREEN,210,65,75,12,ES_AUTOHSCROLL - LTEXT "Red:",IDC_LRED1,160,50,50,10 - EDITTEXT IDC_RED,210,50,75,12,ES_AUTOHSCROLL - LTEXT "Blue:",IDC_LBLUE1,160,80,50,10 - EDITTEXT IDC_BLUE,210,80,75,12,ES_AUTOHSCROLL - LTEXT "Level:",IDC_LLEVEL1,15,65,50,10 - EDITTEXT IDC_LEVEL,65,65,75,12,ES_AUTOHSCROLL - LTEXT "Ambient:",IDC_LAMBIENT2,15,125,50,10 - EDITTEXT IDC_AMBIENT2,65,125,75,12,ES_AUTOHSCROLL - LTEXT "Green:",IDC_LGREEN2,160,140,50,10 - EDITTEXT IDC_GREEN2,210,140,75,12,ES_AUTOHSCROLL - LTEXT "Red:",IDC_LRED2,160,125,50,10 - EDITTEXT IDC_RED2,210,125,75,12,ES_AUTOHSCROLL - LTEXT "Blue:",IDC_LBLUE2,160,155,50,10 - EDITTEXT IDC_BLUE2,210,155,75,12,ES_AUTOHSCROLL - LTEXT "Level:",IDC_LLEVEL2,15,140,50,10 - EDITTEXT IDC_LEVEL2,65,140,75,12,ES_AUTOHSCROLL +LTEXT "Lighting settings define the color of the terrain in the game, and you can specify a very dark or very bright map. Be careful, using wrong settings may cause the player to be unable to see his units.", IDC_DESC, 6, 5, 290, 25 +GROUPBOX "Normal", IDC_LNORMAL, 6, 35, 290, 65 +GROUPBOX "Ion storm settings", IDC_LIONSTORM, 6, 110, 290, 65 +LTEXT "Ambient:", IDC_LAMBIENT1, 15, 50, 50, 10 +EDITTEXT IDC_AMBIENT, 65, 50, 75, 12, ES_AUTOHSCROLL +LTEXT "Green:", IDC_LGREEN1, 160, 65, 50, 10 +EDITTEXT IDC_GREEN, 210, 65, 75, 12, ES_AUTOHSCROLL +LTEXT "Red:", IDC_LRED1, 160, 50, 50, 10 +EDITTEXT IDC_RED, 210, 50, 75, 12, ES_AUTOHSCROLL +LTEXT "Blue:", IDC_LBLUE1, 160, 80, 50, 10 +EDITTEXT IDC_BLUE, 210, 80, 75, 12, ES_AUTOHSCROLL +LTEXT "Level:", IDC_LLEVEL1, 15, 65, 50, 10 +EDITTEXT IDC_LEVEL, 65, 65, 75, 12, ES_AUTOHSCROLL +LTEXT "Ambient:", IDC_LAMBIENT2, 15, 125, 50, 10 +EDITTEXT IDC_AMBIENT2, 65, 125, 75, 12, ES_AUTOHSCROLL +LTEXT "Green:", IDC_LGREEN2, 160, 140, 50, 10 +EDITTEXT IDC_GREEN2, 210, 140, 75, 12, ES_AUTOHSCROLL +LTEXT "Red:", IDC_LRED2, 160, 125, 50, 10 +EDITTEXT IDC_RED2, 210, 125, 75, 12, ES_AUTOHSCROLL +LTEXT "Blue:", IDC_LBLUE2, 160, 155, 50, 10 +EDITTEXT IDC_BLUE2, 210, 155, 75, 12, ES_AUTOHSCROLL +LTEXT "Level:", IDC_LLEVEL2, 15, 140, 50, 10 +EDITTEXT IDC_LEVEL2, 65, 140, 75, 12, ES_AUTOHSCROLL END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -479,10 +479,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Info" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,292,8,50,14 - LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nWestwood Studios(tm) is an Electronic Arts(tm) brand.",IDC_STATIC,7,189,334,18 - LTEXT "© 1999-2024 Electronic Arts Inc. Westwood Studios and Electronic Arts are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.",IDC_STATIC,7,214,335,28 - EDITTEXT IDC_LICENSE_AND_COPYRIGHT,6,29,336,148,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL +DEFPUSHBUTTON "OK", IDOK, 292, 8, 50, 14 +LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nWestwood Studios(tm) is an Electronic Arts(tm) brand.", IDC_STATIC, 7, 189, 334, 18 +LTEXT "© 1999-2024 Electronic Arts Inc. Westwood Studios and Electronic Arts are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.", IDC_STATIC, 7, 214, 335, 28 +EDITTEXT IDC_LICENSE_AND_COPYRIGHT, 6, 29, 336, 148, ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL END #endif @@ -491,33 +491,33 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Special Flags" FONT 8, "Tahoma" BEGIN - LTEXT "Tiberium grows:",IDC_LTIBERIUMGROWS,5,22,75,10 - COMBOBOX IDC_TIBERIUMGROWS,85,22,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tiberium spreads:",IDC_LTIBERIUMSPREADS,5,37,75,10 - COMBOBOX IDC_TIBERIUMSPREADS,85,37,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tiberium explosive:",IDC_LTIBERIUMEXPLOSIVE,5,52,75,10 - COMBOBOX IDC_TIBERIUMEXPLOSIVE,85,52,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Destroyable bridges:",IDC_LDESTROYABLEBRIDGES,5,67,75,10 - COMBOBOX IDC_DESTROYABLEBRIDGES,85,67,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "MCV deploy:",IDC_LMCVDEPLOY,5,82,75,10 - COMBOBOX IDC_MCVDEPLOY,85,82,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Initial veteran: (initial troops have veteran status)",IDC_LINITIALVETERAN,5,97,75,25 - COMBOBOX IDC_INITIALVETERAN,85,97,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Fixed alliance:",IDC_LFIXEDALLIANCE,165,22,75,10 - COMBOBOX IDC_FIXEDALLIANCE,245,22,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Harvester immune:",IDC_LHARVESTERIMMUNE,165,37,75,10 - COMBOBOX IDC_HARVESTERIMMUNE,245,37,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Fog of war:",IDC_LFOGOFWAR,165,52,75,10 - COMBOBOX IDC_FOGOFWAR,245,52,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Inert:",IDC_LINERT,165,67,75,10 - COMBOBOX IDC_INERT,245,67,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Ion storms:",IDC_LIONSTORMS,165,82,75,10 - COMBOBOX IDC_IONSTORMS,245,82,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Meteorites:",IDC_LMETEORITES,165,97,75,10 - COMBOBOX IDC_METEORITES,245,97,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Visceroids:",IDC_LVISCEROIDS,165,112,75,10 - COMBOBOX IDC_VISCEROIDS,245,112,45,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Some settings only work under certain circumstances.",IDC_DESC,5,5,285,16 +LTEXT "Tiberium grows:", IDC_LTIBERIUMGROWS, 5, 22, 75, 10 +COMBOBOX IDC_TIBERIUMGROWS, 85, 22, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tiberium spreads:", IDC_LTIBERIUMSPREADS, 5, 37, 75, 10 +COMBOBOX IDC_TIBERIUMSPREADS, 85, 37, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tiberium explosive:", IDC_LTIBERIUMEXPLOSIVE, 5, 52, 75, 10 +COMBOBOX IDC_TIBERIUMEXPLOSIVE, 85, 52, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Destroyable bridges:", IDC_LDESTROYABLEBRIDGES, 5, 67, 75, 10 +COMBOBOX IDC_DESTROYABLEBRIDGES, 85, 67, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "MCV deploy:", IDC_LMCVDEPLOY, 5, 82, 75, 10 +COMBOBOX IDC_MCVDEPLOY, 85, 82, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Initial veteran: (initial troops have veteran status)", IDC_LINITIALVETERAN, 5, 97, 75, 25 +COMBOBOX IDC_INITIALVETERAN, 85, 97, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Fixed alliance:", IDC_LFIXEDALLIANCE, 165, 22, 75, 10 +COMBOBOX IDC_FIXEDALLIANCE, 245, 22, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Harvester immune:", IDC_LHARVESTERIMMUNE, 165, 37, 75, 10 +COMBOBOX IDC_HARVESTERIMMUNE, 245, 37, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Fog of war:", IDC_LFOGOFWAR, 165, 52, 75, 10 +COMBOBOX IDC_FOGOFWAR, 245, 52, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Inert:", IDC_LINERT, 165, 67, 75, 10 +COMBOBOX IDC_INERT, 245, 67, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Ion storms:", IDC_LIONSTORMS, 165, 82, 75, 10 +COMBOBOX IDC_IONSTORMS, 245, 82, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Meteorites:", IDC_LMETEORITES, 165, 97, 75, 10 +COMBOBOX IDC_METEORITES, 245, 97, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Visceroids:", IDC_LVISCEROIDS, 165, 112, 75, 10 +COMBOBOX IDC_VISCEROIDS, 245, 112, 45, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Some settings only work under certain circumstances.", IDC_DESC, 5, 5, 285, 16 END IDD_INFANTRY DIALOG 0, 0, 232, 142 @@ -525,29 +525,29 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Infantry options" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,175,121,50,14 - PUSHBUTTON "Cancel",IDCANCEL,117,121,50,14 - LTEXT "House:",IDC_LHOUSE,7,6,33,11 - COMBOBOX IDC_HOUSE,47,6,65,45,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Strength:",IDC_LSTRENGTH,7,24,29,10 - CONTROL "Slider1",IDC_STRENGTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,47,24,70,11 - LTEXT "State:",IDC_LSTATE,7,42,40,13 - COMBOBOX IDC_STATE,47,42,65,90,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tag:",IDC_LTAG,7,100,68,19 - COMBOBOX IDC_TAG,79,102,142,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Param1:",IDC_LP1,120,6,35,15 - EDITTEXT IDC_P1,155,6,65,12,ES_AUTOHSCROLL - LTEXT "Param2:",IDC_LP2,120,24,32,16 - LTEXT "Param3:",IDC_LP3,120,42,32,16 - LTEXT "Param4:",IDC_LP4,120,60,36,17 - EDITTEXT IDC_P2,155,24,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_P3,155,42,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_P4,155,60,65,12,ES_AUTOHSCROLL - LTEXT "",IDC_LDESC,0,133,38,8 - LTEXT "Direction:",IDC_LDIRECTION,7,60,40,10 - COMBOBOX IDC_DIRECTION,47,60,65,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param5:",IDC_LP5,120,78,34,19 - EDITTEXT IDC_P5,155,78,65,12,ES_AUTOHSCROLL +DEFPUSHBUTTON "OK", IDOK, 175, 121, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 117, 121, 50, 14 +LTEXT "House:", IDC_LHOUSE, 7, 6, 33, 11 +COMBOBOX IDC_HOUSE, 47, 6, 65, 45, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Strength:", IDC_LSTRENGTH, 7, 24, 29, 10 +CONTROL "Slider1", IDC_STRENGTH, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 47, 24, 70, 11 +LTEXT "State:", IDC_LSTATE, 7, 42, 40, 13 +COMBOBOX IDC_STATE, 47, 42, 65, 90, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tag:", IDC_LTAG, 7, 100, 68, 19 +COMBOBOX IDC_TAG, 79, 102, 142, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Param1:", IDC_LP1, 120, 6, 35, 15 +EDITTEXT IDC_P1, 155, 6, 65, 12, ES_AUTOHSCROLL +LTEXT "Param2:", IDC_LP2, 120, 24, 32, 16 +LTEXT "Param3:", IDC_LP3, 120, 42, 32, 16 +LTEXT "Param4:", IDC_LP4, 120, 60, 36, 17 +EDITTEXT IDC_P2, 155, 24, 65, 12, ES_AUTOHSCROLL +EDITTEXT IDC_P3, 155, 42, 65, 12, ES_AUTOHSCROLL +EDITTEXT IDC_P4, 155, 60, 65, 12, ES_AUTOHSCROLL +LTEXT "", IDC_LDESC, 0, 133, 38, 8 +LTEXT "Direction:", IDC_LDIRECTION, 7, 60, 40, 10 +COMBOBOX IDC_DIRECTION, 47, 60, 65, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param5:", IDC_LP5, 120, 78, 34, 19 +EDITTEXT IDC_P5, 155, 78, 65, 12, ES_AUTOHSCROLL END IDD_HOUSES DIALOG 0, 0, 303, 207 @@ -555,37 +555,37 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Houses" FONT 8, "Tahoma" BEGIN - LTEXT "DESC [quite long]",IDC_DESC,7,5,290,43 - COMBOBOX IDC_HOUSES,77,65,220,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "House:",IDC_LHOUSE,7,65,64,22 - PUSHBUTTON "Add house",IDC_ADDHOUSE,227,82,70,15 - PUSHBUTTON "Standard houses",IDC_PREPAREHOUSES,75,82,70,15 - PUSHBUTTON "Delete house",IDC_DELETEHOUSE,150,82,70,15 - LTEXT "IQ:",IDC_LIQ,10,105,40,10 - COMBOBOX IDC_IQ,55,105,70,70,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Edge:",IDC_LEDGE,10,120,40,10 - COMBOBOX IDC_EDGE,55,120,70,65,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Side",IDC_LSIDE,10,135,40,10 - COMBOBOX IDC_SIDE,55,135,70,65,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Color",IDC_LCOLOR,10,150,40,10 - COMBOBOX IDC_COLOR,55,150,70,150,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Allies:",IDC_LALLIES,10,165,40,10 - EDITTEXT IDC_ALLIES,55,165,70,12,ES_AUTOHSCROLL - LTEXT "Credits (x100):",IDC_LCREDITS,10,181,40,17 - EDITTEXT IDC_CREDITS,55,179,70,12,ES_AUTOHSCROLL - LTEXT "Acts like:",IDC_LACTSLIKE,150,105,69,14 - COMBOBOX IDC_ACTSLIKE,227,105,70,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Nodecount:",IDC_LNODECOUNT,150,119,68,15 - COMBOBOX IDC_NODECOUNT,227,120,70,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Techlevel:",IDC_LTECHLEVEL,150,134,63,10 - COMBOBOX IDC_TECHLEVEL,227,135,70,135,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Build activity (%):",IDC_LBUILDACTIVITY,150,150,66,17 - COMBOBOX IDC_PERCENTBUILT,227,150,70,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Player control:",IDC_LPLAYERCONTROL,150,166,70,20 - COMBOBOX IDC_PLAYERCONTROL,227,166,70,50,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Human Player:",IDC_LPLAYER,7,48,65,16 - COMBOBOX IDC_HUMANPLAYER,77,49,220,70,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_STATIC,6,98,293,102 +LTEXT "DESC [quite long]", IDC_DESC, 7, 5, 290, 43 +COMBOBOX IDC_HOUSES, 77, 65, 220, 125, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "House:", IDC_LHOUSE, 7, 65, 64, 22 +PUSHBUTTON "Add house", IDC_ADDHOUSE, 227, 82, 70, 15 +PUSHBUTTON "Standard houses", IDC_PREPAREHOUSES, 75, 82, 70, 15 +PUSHBUTTON "Delete house", IDC_DELETEHOUSE, 150, 82, 70, 15 +LTEXT "IQ:", IDC_LIQ, 10, 105, 40, 10 +COMBOBOX IDC_IQ, 55, 105, 70, 70, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Edge:", IDC_LEDGE, 10, 120, 40, 10 +COMBOBOX IDC_EDGE, 55, 120, 70, 65, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Side", IDC_LSIDE, 10, 135, 40, 10 +COMBOBOX IDC_SIDE, 55, 135, 70, 65, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Color", IDC_LCOLOR, 10, 150, 40, 10 +COMBOBOX IDC_COLOR, 55, 150, 70, 150, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Allies:", IDC_LALLIES, 10, 165, 40, 10 +EDITTEXT IDC_ALLIES, 55, 165, 70, 12, ES_AUTOHSCROLL +LTEXT "Credits (x100):", IDC_LCREDITS, 10, 181, 40, 17 +EDITTEXT IDC_CREDITS, 55, 179, 70, 12, ES_AUTOHSCROLL +LTEXT "Acts like:", IDC_LACTSLIKE, 150, 105, 69, 14 +COMBOBOX IDC_ACTSLIKE, 227, 105, 70, 50, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Nodecount:", IDC_LNODECOUNT, 150, 119, 68, 15 +COMBOBOX IDC_NODECOUNT, 227, 120, 70, 50, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Techlevel:", IDC_LTECHLEVEL, 150, 134, 63, 10 +COMBOBOX IDC_TECHLEVEL, 227, 135, 70, 135, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Build activity (%):", IDC_LBUILDACTIVITY, 150, 150, 66, 17 +COMBOBOX IDC_PERCENTBUILT, 227, 150, 70, 50, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Player control:", IDC_LPLAYERCONTROL, 150, 166, 70, 20 +COMBOBOX IDC_PLAYERCONTROL, 227, 166, 70, 50, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Human Player:", IDC_LPLAYER, 7, 48, 65, 16 +COMBOBOX IDC_HUMANPLAYER, 77, 49, 220, 70, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +GROUPBOX "", IDC_STATIC, 6, 98, 293, 102 END IDD_AIRCRAFT DIALOG 0, 0, 232, 130 @@ -593,27 +593,27 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Aircraft Options" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,170,110,50,14 - PUSHBUTTON "Cancel",IDCANCEL,110,110,50,14 - CONTROL "House:",IDC_LHOUSE,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,5,7,33,11 - COMBOBOX IDC_HOUSE,45,7,65,45,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Strength:",IDC_LSTRENGTH,5,25,29,10 - CONTROL "Slider1",IDC_STRENGTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,45,25,70,11 - LTEXT "State:",IDC_LSTATE,5,62,40,10 - COMBOBOX IDC_STATE,45,62,65,90,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tag:",IDC_LTAG,5,90,66,14 - COMBOBOX IDC_TAG,77,90,144,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Param1:",IDC_LP1,116,7,40,17 - EDITTEXT IDC_P1,155,7,65,12,ES_AUTOHSCROLL - LTEXT "Param2:",IDC_LP2,116,25,37,12 - LTEXT "Recruitable:",IDC_LP3,116,43,39,15 - LTEXT "Param4:",IDC_LP4,116,62,39,18 - EDITTEXT IDC_P2,155,25,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_P4,155,62,65,12,ES_AUTOHSCROLL - LTEXT "Params are unknown (integers?).",IDC_LDESC,5,120,19,10 - LTEXT "Direction:",IDC_LDIRECTION,5,43,40,10 - COMBOBOX IDC_DIRECTION,45,43,65,63,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P3,155,43,66,62,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 170, 110, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 110, 110, 50, 14 +CONTROL "House:", IDC_LHOUSE, "Static", SS_LEFTNOWORDWRAP | WS_GROUP, 5, 7, 33, 11 +COMBOBOX IDC_HOUSE, 45, 7, 65, 45, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Strength:", IDC_LSTRENGTH, 5, 25, 29, 10 +CONTROL "Slider1", IDC_STRENGTH, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 45, 25, 70, 11 +LTEXT "State:", IDC_LSTATE, 5, 62, 40, 10 +COMBOBOX IDC_STATE, 45, 62, 65, 90, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tag:", IDC_LTAG, 5, 90, 66, 14 +COMBOBOX IDC_TAG, 77, 90, 144, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Param1:", IDC_LP1, 116, 7, 40, 17 +EDITTEXT IDC_P1, 155, 7, 65, 12, ES_AUTOHSCROLL +LTEXT "Param2:", IDC_LP2, 116, 25, 37, 12 +LTEXT "Recruitable:", IDC_LP3, 116, 43, 39, 15 +LTEXT "Param4:", IDC_LP4, 116, 62, 39, 18 +EDITTEXT IDC_P2, 155, 25, 65, 12, ES_AUTOHSCROLL +EDITTEXT IDC_P4, 155, 62, 65, 12, ES_AUTOHSCROLL +LTEXT "Params are unknown (integers?).", IDC_LDESC, 5, 120, 19, 10 +LTEXT "Direction:", IDC_LDIRECTION, 5, 43, 40, 10 +COMBOBOX IDC_DIRECTION, 45, 43, 65, 63, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P3, 155, 43, 66, 62, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_BUILDING DIALOG 0, 0, 247, 190 @@ -621,37 +621,37 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU CAPTION "Building options" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,190,170,50,14 - PUSHBUTTON "Cancel",IDCANCEL,131,170,50,14 - LTEXT "House:",IDC_LHOUSE,7,41,33,11 - COMBOBOX IDC_HOUSE,47,41,65,45,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Strength:",IDC_LSTRENGTH,7,57,29,10 - CONTROL "Slider1",IDC_STRENGTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,47,56,69,11 - LTEXT "Tag:",IDC_LTAG,7,149,39,15 - COMBOBOX IDC_TAG,47,149,193,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Param1:",IDC_LP1,7,87,35,13 - EDITTEXT IDC_P1,47,87,65,12,ES_AUTOHSCROLL - LTEXT "AI repairs:",IDC_LAIREPAIRS,7,102,40,14 - LTEXT "Energy:",IDC_LENERGY,7,117,38,18 - LTEXT "Upgrade count:",IDC_LUPGRADECOUNT,119,40,30,17 - LTEXT "Params are unknown (some integers, some strings?). Note: 0 means no, 1 means yes",IDC_LDESC,5,5,235,36 - LTEXT "Direction:",IDC_LDIRECTION,7,71,40,14 - COMBOBOX IDC_DIRECTION,47,71,65,58,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Spotlight:",IDC_LSPOTLIGHT,119,57,39,15 - LTEXT "Upgrade 1:",IDC_LUPGRADE1,119,72,40,14 - COMBOBOX IDC_P6,164,71,77,71,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Upgrade 2:",IDC_LUPGRADE2,119,87,40,16 - COMBOBOX IDC_P7,164,86,77,84,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Upgrade 3:",IDC_LUPGRADE3,119,102,38,15 - COMBOBOX IDC_P8,164,101,77,89,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Param 2:",IDC_LP2,120,117,35,10 - LTEXT "Show name:",IDC_LP3,120,132,40,10 - COMBOBOX IDC_P3,47,118,65,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P2,47,102,65,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P4,164,41,77,53,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P5,164,56,77,79,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P9,164,116,77,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_P10,164,132,77,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 190, 170, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 131, 170, 50, 14 +LTEXT "House:", IDC_LHOUSE, 7, 41, 33, 11 +COMBOBOX IDC_HOUSE, 47, 41, 65, 45, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Strength:", IDC_LSTRENGTH, 7, 57, 29, 10 +CONTROL "Slider1", IDC_STRENGTH, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 47, 56, 69, 11 +LTEXT "Tag:", IDC_LTAG, 7, 149, 39, 15 +COMBOBOX IDC_TAG, 47, 149, 193, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Param1:", IDC_LP1, 7, 87, 35, 13 +EDITTEXT IDC_P1, 47, 87, 65, 12, ES_AUTOHSCROLL +LTEXT "AI repairs:", IDC_LAIREPAIRS, 7, 102, 40, 14 +LTEXT "Energy:", IDC_LENERGY, 7, 117, 38, 18 +LTEXT "Upgrade count:", IDC_LUPGRADECOUNT, 119, 40, 30, 17 +LTEXT "Params are unknown (some integers, some strings?). Note: 0 means no, 1 means yes", IDC_LDESC, 5, 5, 235, 36 +LTEXT "Direction:", IDC_LDIRECTION, 7, 71, 40, 14 +COMBOBOX IDC_DIRECTION, 47, 71, 65, 58, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Spotlight:", IDC_LSPOTLIGHT, 119, 57, 39, 15 +LTEXT "Upgrade 1:", IDC_LUPGRADE1, 119, 72, 40, 14 +COMBOBOX IDC_P6, 164, 71, 77, 71, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Upgrade 2:", IDC_LUPGRADE2, 119, 87, 40, 16 +COMBOBOX IDC_P7, 164, 86, 77, 84, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Upgrade 3:", IDC_LUPGRADE3, 119, 102, 38, 15 +COMBOBOX IDC_P8, 164, 101, 77, 89, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Param 2:", IDC_LP2, 120, 117, 35, 10 +LTEXT "Show name:", IDC_LP3, 120, 132, 40, 10 +COMBOBOX IDC_P3, 47, 118, 65, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P2, 47, 102, 65, 41, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P4, 164, 41, 77, 53, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P5, 164, 56, 77, 79, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P9, 164, 116, 77, 41, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_P10, 164, 132, 77, 41, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -663,15 +663,15 @@ IDD_LOADING DIALOGEX 0, 0, 235, 165 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP FONT 8, "Tahoma", 0, 0, 0x1 BEGIN - LTEXT "Loading...",IDC_CAP,7,7,221,9 - CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH,7,18,221,13,WS_EX_DLGMODALFRAME - LTEXT "Homepage: http://www.ea.com",IDC_STATIC,7,78,221,11,WS_BORDER - CTEXT "",IDC_VERSION,74,37,154,13,SS_CENTERIMAGE | SS_SUNKEN - LTEXT "Version:",IDC_LVERSION,7,37,61,9 - CTEXT "",IDC_BUILTBY,74,52,154,13,SS_CENTERIMAGE | SS_SUNKEN - LTEXT "Built by:",IDC_LBUILTBY,7,52,61,9 - LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nAuthored by Matthias Wagner\nWestwood Studios(tm) is an Electronic Arts(tm) brand.",IDC_STATIC,7,97,221,33 - LTEXT "This software comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it.\nFor details open Help->Info",IDC_STATIC,6,129,221,26 +LTEXT "Loading...", IDC_CAP, 7, 7, 221, 9 +CONTROL "", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH, 7, 18, 221, 13, WS_EX_DLGMODALFRAME +LTEXT "Homepage: http://www.ea.com", IDC_STATIC, 7, 78, 221, 11, WS_BORDER +CTEXT "", IDC_VERSION, 74, 37, 154, 13, SS_CENTERIMAGE | SS_SUNKEN +LTEXT "Version:", IDC_LVERSION, 7, 37, 61, 9 +CTEXT "", IDC_BUILTBY, 74, 52, 154, 13, SS_CENTERIMAGE | SS_SUNKEN +LTEXT "Built by:", IDC_LBUILTBY, 7, 52, 61, 9 +LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nAuthored by Matthias Wagner\nWestwood Studios(tm) is an Electronic Arts(tm) brand.", IDC_STATIC, 7, 97, 221, 33 +LTEXT "This software comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it.\nFor details open Help->Info", IDC_STATIC, 6, 129, 221, 26 END #endif @@ -680,12 +680,12 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Create waypoint" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,129,72,50,14 - PUSHBUTTON "Cancel",IDCANCEL,70,72,50,14 - LTEXT "Enter the waypoint number (note that it may already exist and be overwritten!). Or use ""Get free number"".",IDC_DESC,7,7,172,27 - EDITTEXT IDC_ID,7,45,67,16,ES_AUTOHSCROLL - LTEXT "ID:",IDC_LID,7,34,78,10 - PUSHBUTTON "Get first free number",IDC_FREE,86,45,93,16 +DEFPUSHBUTTON "OK", IDOK, 129, 72, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 70, 72, 50, 14 +LTEXT "Enter the waypoint number (note that it may already exist and be overwritten!). Or use ""Get free number"".", IDC_DESC, 7, 7, 172, 27 +EDITTEXT IDC_ID, 7, 45, 67, 16, ES_AUTOHSCROLL +LTEXT "ID:", IDC_LID, 7, 34, 78, 10 +PUSHBUTTON "Get first free number", IDC_FREE, 86, 45, 93, 16 END IDD_CELLTAG DIALOG 0, 0, 212, 77 @@ -693,11 +693,11 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Cell-Tag" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,155,56,50,14 - PUSHBUTTON "Cancel",IDCANCEL,95,56,50,14 - LTEXT "Tag:",IDC_LTAG,7,29,82,8 - COMBOBOX IDC_TAG,7,37,198,114,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Associate a tag with a specific cell.",IDC_LDESC,7,7,198,19 +DEFPUSHBUTTON "OK", IDOK, 155, 56, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 95, 56, 50, 14 +LTEXT "Tag:", IDC_LTAG, 7, 29, 82, 8 +COMBOBOX IDC_TAG, 7, 37, 198, 114, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Associate a tag with a specific cell.", IDC_LDESC, 7, 7, 198, 19 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -710,61 +710,61 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Teamtypes" FONT 8, "Tahoma" BEGIN - LTEXT "Team types connect a trigger with task forces",IDC_STATIC,6,5,290,10 - LTEXT "Team types:",IDC_STATIC,5,20,50,10 - COMBOBOX IDC_TEAMTYPES,55,20,155,174,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "New",IDC_NEWTEAMTYPE,261,20,35,15 - PUSHBUTTON "Delete",IDC_DELETETEAMTYPE,220,20,35,15 - LTEXT "Name:",IDC_STATIC,10,51,30,10 - EDITTEXT IDC_NAME,56,51,90,12,ES_AUTOHSCROLL - LTEXT "Veteran level:",IDC_STATIC,10,66,45,15 - CONTROL "Loadable",IDC_LOADABLE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,145,55,8 - CONTROL "Full",IDC_FULL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,155,55,8 - CONTROL "Annoyance",IDC_ANNOYANCE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,164,55,10 - CONTROL "Guard slower",IDC_GUARDSLOWER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,175,55,8 - CONTROL "Recruiter",IDC_RECRUITER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,185,55,8 - LTEXT "House:",IDC_STATIC,10,81,35,10 - COMBOBOX IDC_HOUSE,56,81,90,62,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Autocreate",IDC_AUTOCREATE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,145,55,8 - CONTROL "Prebuild",IDC_PREBUILD,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,155,55,8 - CONTROL "Reinforce",IDC_REINFORCE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,165,55,8 - CONTROL "Droppod",IDC_DROPPOD,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,145,55,8 - CONTROL "Whiner",IDC_WHINER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,155,55,8 - CONTROL "Loose recruit",IDC_LOOSERECRUIT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,165,55,8 - CONTROL "Aggressive",IDC_AGGRESSIVE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,175,55,8 - CONTROL "Suicide",IDC_SUICIDE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,185,55,8 - CONTROL "OnTransOnly",IDC_ONTRANSONLY,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,175,55,8 - CONTROL "AvoidThreats",IDC_AVOIDTHREATS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,185,55,8 - CONTROL "Ion immune",IDC_IONIMMUNE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,145,60,8 - CONTROL "TransportsReturnOnUnload",IDC_TRANSPORTRETURNSONUNLOAD, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,155,100,8 - CONTROL "AreTeamMembersRecruitable",IDC_ARETEAMMEMBERSRECRUITABLE, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,165,105,8 - CONTROL "IsBaseDefense",IDC_ISBASEDEFENSE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,175,80,8 - CONTROL "OnlyTargetHouseEnemy",IDC_ONLYTARGETHOUSEENEMY,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,185,100,8 - LTEXT "Priority:",IDC_STATIC,10,96,40,10 - EDITTEXT IDC_PRIORITY,56,96,90,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Max:",IDC_STATIC,10,111,30,10 - EDITTEXT IDC_MAX,56,111,90,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Techlevel:",IDC_STATIC,10,125,40,10 - COMBOBOX IDC_TECHLEVEL,56,125,91,72,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Group:",IDC_STATIC,156,51,30,10 - GROUPBOX "Selected team type",IDC_STATIC,6,37,290,161 - COMBOBOX IDC_GROUP,200,51,90,78,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Waypoint:",IDC_STATIC,156,66,40,10 - COMBOBOX IDC_WAYPOINT,200,66,90,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Script:",IDC_STATIC,156,81,40,10 - COMBOBOX IDC_SCRIPT,200,81,90,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Task force:",IDC_STATIC,156,96,40,10 - COMBOBOX IDC_TASKFORCE,200,96,90,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_VETERANLEVEL,56,66,90,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tag:",IDC_STATIC,156,111,40,13 - COMBOBOX IDC_TAG,200,111,90,186,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "",IDC_LTRANSPORTWAYPOINT,156,126,40,17 - COMBOBOX IDC_TRANSPORTWAYPOINT,200,126,90,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Mind Control Decision:",IDC_STATIC,164,4,43,16,NOT WS_VISIBLE - COMBOBOX IDC_MINDCONTROLDECISION,209,6,92,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Mind Control Decision:",IDC_MCD_L,10,139,43,16,NOT WS_VISIBLE +LTEXT "Team types connect a trigger with task forces", IDC_STATIC, 6, 5, 290, 10 +LTEXT "Team types:", IDC_STATIC, 5, 20, 50, 10 +COMBOBOX IDC_TEAMTYPES, 55, 20, 155, 174, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "New", IDC_NEWTEAMTYPE, 261, 20, 35, 15 +PUSHBUTTON "Delete", IDC_DELETETEAMTYPE, 220, 20, 35, 15 +LTEXT "Name:", IDC_STATIC, 10, 51, 30, 10 +EDITTEXT IDC_NAME, 56, 51, 90, 12, ES_AUTOHSCROLL +LTEXT "Veteran level:", IDC_STATIC, 10, 66, 45, 15 +CONTROL "Loadable", IDC_LOADABLE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 145, 55, 8 +CONTROL "Full", IDC_FULL, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 155, 55, 8 +CONTROL "Annoyance", IDC_ANNOYANCE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 164, 55, 10 +CONTROL "Guard slower", IDC_GUARDSLOWER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 175, 55, 8 +CONTROL "Recruiter", IDC_RECRUITER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 185, 55, 8 +LTEXT "House:", IDC_STATIC, 10, 81, 35, 10 +COMBOBOX IDC_HOUSE, 56, 81, 90, 62, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +CONTROL "Autocreate", IDC_AUTOCREATE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 145, 55, 8 +CONTROL "Prebuild", IDC_PREBUILD, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 155, 55, 8 +CONTROL "Reinforce", IDC_REINFORCE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 165, 55, 8 +CONTROL "Droppod", IDC_DROPPOD, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 145, 55, 8 +CONTROL "Whiner", IDC_WHINER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 155, 55, 8 +CONTROL "Loose recruit", IDC_LOOSERECRUIT, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 165, 55, 8 +CONTROL "Aggressive", IDC_AGGRESSIVE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 175, 55, 8 +CONTROL "Suicide", IDC_SUICIDE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 185, 55, 8 +CONTROL "OnTransOnly", IDC_ONTRANSONLY, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 175, 55, 8 +CONTROL "AvoidThreats", IDC_AVOIDTHREATS, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 185, 55, 8 +CONTROL "Ion immune", IDC_IONIMMUNE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 145, 60, 8 +CONTROL "TransportsReturnOnUnload", IDC_TRANSPORTRETURNSONUNLOAD, +"Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 155, 100, 8 +CONTROL "AreTeamMembersRecruitable", IDC_ARETEAMMEMBERSRECRUITABLE, +"Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 165, 105, 8 +CONTROL "IsBaseDefense", IDC_ISBASEDEFENSE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 175, 80, 8 +CONTROL "OnlyTargetHouseEnemy", IDC_ONLYTARGETHOUSEENEMY, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 185, 100, 8 +LTEXT "Priority:", IDC_STATIC, 10, 96, 40, 10 +EDITTEXT IDC_PRIORITY, 56, 96, 90, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Max:", IDC_STATIC, 10, 111, 30, 10 +EDITTEXT IDC_MAX, 56, 111, 90, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Techlevel:", IDC_STATIC, 10, 125, 40, 10 +COMBOBOX IDC_TECHLEVEL, 56, 125, 91, 72, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Group:", IDC_STATIC, 156, 51, 30, 10 +GROUPBOX "Selected team type", IDC_STATIC, 6, 37, 290, 161 +COMBOBOX IDC_GROUP, 200, 51, 90, 78, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Waypoint:", IDC_STATIC, 156, 66, 40, 10 +COMBOBOX IDC_WAYPOINT, 200, 66, 90, 80, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Script:", IDC_STATIC, 156, 81, 40, 10 +COMBOBOX IDC_SCRIPT, 200, 81, 90, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Task force:", IDC_STATIC, 156, 96, 40, 10 +COMBOBOX IDC_TASKFORCE, 200, 96, 90, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_VETERANLEVEL, 56, 66, 90, 60, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tag:", IDC_STATIC, 156, 111, 40, 13 +COMBOBOX IDC_TAG, 200, 111, 90, 186, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "", IDC_LTRANSPORTWAYPOINT, 156, 126, 40, 17 +COMBOBOX IDC_TRANSPORTWAYPOINT, 200, 126, 90, 80, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Mind Control Decision:", IDC_STATIC, 164, 4, 43, 16, NOT WS_VISIBLE +COMBOBOX IDC_MINDCONTROLDECISION, 209, 6, 92, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +LTEXT "Mind Control Decision:", IDC_MCD_L, 10, 139, 43, 16, NOT WS_VISIBLE END #endif @@ -773,23 +773,23 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Taskforces" FONT 8, "Tahoma" BEGIN - LTEXT "Task forces:",IDC_STATIC,7,7,71,10 - COMBOBOX IDC_TASKFORCES,87,7,199,130,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Units in task force:",IDC_STATIC,17,88,61,13 - LISTBOX IDC_UNITS,87,88,199,68,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_ADDUNIT,17,102,61,14 - PUSHBUTTON "Delete",IDC_DELETEUNIT,17,121,61,15 - LTEXT "Group:",IDC_STATIC,17,69,61,13 - EDITTEXT IDC_GROUP,87,69,199,13,ES_AUTOHSCROLL - LTEXT "Number of units:",IDC_STATIC,16,160,62,12 - EDITTEXT IDC_NUMBERUNITS,87,160,199,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Unit type:",IDC_STATIC,17,179,62,12 - COMBOBOX IDC_UNITTYPE,87,179,199,183,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Selected task force",IDC_STATIC,7,45,290,153 - PUSHBUTTON "Delete",IDC_DELETETASKFORCE,222,23,64,15 - PUSHBUTTON "Add",IDC_ADDTASKFORCE,153,23,64,15 - LTEXT "Name:",IDC_STATIC,17,56,61,12 - EDITTEXT IDC_NAME,87,54,199,13,ES_AUTOHSCROLL +LTEXT "Task forces:", IDC_STATIC, 7, 7, 71, 10 +COMBOBOX IDC_TASKFORCES, 87, 7, 199, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Units in task force:", IDC_STATIC, 17, 88, 61, 13 +LISTBOX IDC_UNITS, 87, 88, 199, 68, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Add", IDC_ADDUNIT, 17, 102, 61, 14 +PUSHBUTTON "Delete", IDC_DELETEUNIT, 17, 121, 61, 15 +LTEXT "Group:", IDC_STATIC, 17, 69, 61, 13 +EDITTEXT IDC_GROUP, 87, 69, 199, 13, ES_AUTOHSCROLL +LTEXT "Number of units:", IDC_STATIC, 16, 160, 62, 12 +EDITTEXT IDC_NUMBERUNITS, 87, 160, 199, 14, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Unit type:", IDC_STATIC, 17, 179, 62, 12 +COMBOBOX IDC_UNITTYPE, 87, 179, 199, 183, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +GROUPBOX "Selected task force", IDC_STATIC, 7, 45, 290, 153 +PUSHBUTTON "Delete", IDC_DELETETASKFORCE, 222, 23, 64, 15 +PUSHBUTTON "Add", IDC_ADDTASKFORCE, 153, 23, 64, 15 +LTEXT "Name:", IDC_STATIC, 17, 56, 61, 12 +EDITTEXT IDC_NAME, 87, 54, 199, 13, ES_AUTOHSCROLL END IDD_TAGS DIALOG 0, 0, 303, 204 @@ -797,18 +797,18 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Tags" FONT 8, "Tahoma" BEGIN - LTEXT "Tags make Triggers work. Without a tag, a trigger is usually useless, because it won't be executed (except if another triggers fires it directly).",IDC_STATIC,7,7,290,20 - LTEXT "Tag:",IDC_STATIC,7,36,54,12 - COMBOBOX IDC_TAG,61,37,236,196,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_ADD,169,53,59,14 - PUSHBUTTON "Delete",IDC_DELETE,238,53,59,14 - LTEXT "Name:",IDC_STATIC,7,90,54,12 - EDITTEXT IDC_NAME,61,89,236,13,ES_AUTOHSCROLL - LTEXT "Repeat:",IDC_STATIC,7,110,54,13 - COMBOBOX IDC_REPEAT,61,110,236,59,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Trigger:",IDC_STATIC,7,131,54,13 - COMBOBOX IDC_TRIGGER,61,131,236,135,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "For every trigger you create, you should create a tag to make the trigger work. A trigger consists of some general properties, an event and an action, which can all be defined in the ""trigger"" section.",IDC_STATIC,7,167,290,30 +LTEXT "Tags make Triggers work. Without a tag, a trigger is usually useless, because it won't be executed (except if another triggers fires it directly).", IDC_STATIC, 7, 7, 290, 20 +LTEXT "Tag:", IDC_STATIC, 7, 36, 54, 12 +COMBOBOX IDC_TAG, 61, 37, 236, 196, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Add", IDC_ADD, 169, 53, 59, 14 +PUSHBUTTON "Delete", IDC_DELETE, 238, 53, 59, 14 +LTEXT "Name:", IDC_STATIC, 7, 90, 54, 12 +EDITTEXT IDC_NAME, 61, 89, 236, 13, ES_AUTOHSCROLL +LTEXT "Repeat:", IDC_STATIC, 7, 110, 54, 13 +COMBOBOX IDC_REPEAT, 61, 110, 236, 59, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Trigger:", IDC_STATIC, 7, 131, 54, 13 +COMBOBOX IDC_TRIGGER, 61, 131, 236, 135, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "For every trigger you create, you should create a tag to make the trigger work. A trigger consists of some general properties, an event and an action, which can all be defined in the ""trigger"" section.", IDC_STATIC, 7, 167, 290, 30 END IDD_TRIGGERS DIALOG 0, 0, 303, 204 @@ -816,54 +816,54 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Old Trigger Editor - UNUSED" FONT 8, "Tahoma" BEGIN - LTEXT "Trigger:",IDC_STATIC,7,7,26,11 - COMBOBOX IDC_TRIGGER,37,7,120,122,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "House:",IDC_STATIC,7,25,28,12 - COMBOBOX IDC_HOUSE,38,25,60,100,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "New trigger",IDC_ADDTRIGGER,165,7,61,14 - PUSHBUTTON "Delete trigger",IDC_DELETETRIGGER,234,7,63,14 - LTEXT "Name:",IDC_STATIC,109,26,24,12 - EDITTEXT IDC_NAME,135,25,162,13,ES_AUTOHSCROLL - LTEXT "Flags:",IDC_STATIC,7,41,19,13 - EDITTEXT IDC_FLAG1,37,41,24,13,ES_AUTOHSCROLL - EDITTEXT IDC_FLAG2,65,41,23,13,ES_AUTOHSCROLL - EDITTEXT IDC_FLAG3,92,41,23,13,ES_AUTOHSCROLL - EDITTEXT IDC_FLAG4,119,41,23,13,ES_AUTOHSCROLL - EDITTEXT IDC_FLAG5,146,41,23,13,ES_AUTOHSCROLL - GROUPBOX "Events which let the trigger start",IDC_STATIC,7,56,290,59 - GROUPBOX "Actions - What the trigger will do",IDC_STATIC,7,120,290,77 - LTEXT "Event:",IDC_STATIC,13,65,29,11 - COMBOBOX IDC_EVENT,57,66,123,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_ADDEVENT,185,65,49,15 - PUSHBUTTON "Delete",IDC_DELETEEVENT,239,65,49,15 - LTEXT "Parameter 1:",IDC_LABEL_E1,13,97,44,16 - COMBOBOX IDC_EVENTPARAM1,57,97,86,160,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Parameter 2:",IDC_LABEL_E2,149,97,44,16 - COMBOBOX IDC_EVENTPARAM2,198,98,90,172,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_ACTION,45,131,134,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_ADDACTION,185,130,49,15 - PUSHBUTTON "Delete",IDC_DELETEACTION,239,130,49,15 - LTEXT "Action:",IDC_STATIC,14,131,24,13 - LTEXT "Type:",IDC_STATIC,13,82,44,12 - COMBOBOX IDC_EVENTTYPE,57,82,230,98,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param1:",IDC_LABEL_A1,13,163,30,14 - COMBOBOX IDC_ACTIONPARAM1,45,163,48,219,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Type:",IDC_STATIC,13,148,23,12 - COMBOBOX IDC_ACTIONTYPE,45,148,172,133,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param2:",IDC_LABEL_A2,96,163,30,15 - COMBOBOX IDC_ACTIONPARAM2,127,163,74,289,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param3:",IDC_LABEL_A3,203,162,30,14 - COMBOBOX IDC_ACTIONPARAM3,234,163,56,243,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param4:",IDC_LABEL_A4,13,177,30,15 - COMBOBOX IDC_ACTIONPARAM4,45,176,48,204,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param5:",IDC_LABEL_A5,96,178,30,14 - COMBOBOX IDC_ACTIONPARAM5,127,176,74,221,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param6:",IDC_LABEL_A6,203,176,30,16 - COMBOBOX IDC_ACTIONPARAM6,234,176,56,239,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Waypoint:",IDC_WAYPOINT,221,148,33,11 - COMBOBOX IDC_ACTIONWAYPOINT,257,148,32,133,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Trigger??? :",IDC_STATIC,177,42,37,12 - COMBOBOX IDC_TRIGGER2,221,42,76,152,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Trigger:", IDC_STATIC, 7, 7, 26, 11 +COMBOBOX IDC_TRIGGER, 37, 7, 120, 122, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "House:", IDC_STATIC, 7, 25, 28, 12 +COMBOBOX IDC_HOUSE, 38, 25, 60, 100, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "New trigger", IDC_ADDTRIGGER, 165, 7, 61, 14 +PUSHBUTTON "Delete trigger", IDC_DELETETRIGGER, 234, 7, 63, 14 +LTEXT "Name:", IDC_STATIC, 109, 26, 24, 12 +EDITTEXT IDC_NAME, 135, 25, 162, 13, ES_AUTOHSCROLL +LTEXT "Flags:", IDC_STATIC, 7, 41, 19, 13 +EDITTEXT IDC_FLAG1, 37, 41, 24, 13, ES_AUTOHSCROLL +EDITTEXT IDC_FLAG2, 65, 41, 23, 13, ES_AUTOHSCROLL +EDITTEXT IDC_FLAG3, 92, 41, 23, 13, ES_AUTOHSCROLL +EDITTEXT IDC_FLAG4, 119, 41, 23, 13, ES_AUTOHSCROLL +EDITTEXT IDC_FLAG5, 146, 41, 23, 13, ES_AUTOHSCROLL +GROUPBOX "Events which let the trigger start", IDC_STATIC, 7, 56, 290, 59 +GROUPBOX "Actions - What the trigger will do", IDC_STATIC, 7, 120, 290, 77 +LTEXT "Event:", IDC_STATIC, 13, 65, 29, 11 +COMBOBOX IDC_EVENT, 57, 66, 123, 68, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Add", IDC_ADDEVENT, 185, 65, 49, 15 +PUSHBUTTON "Delete", IDC_DELETEEVENT, 239, 65, 49, 15 +LTEXT "Parameter 1:", IDC_LABEL_E1, 13, 97, 44, 16 +COMBOBOX IDC_EVENTPARAM1, 57, 97, 86, 160, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Parameter 2:", IDC_LABEL_E2, 149, 97, 44, 16 +COMBOBOX IDC_EVENTPARAM2, 198, 98, 90, 172, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_ACTION, 45, 131, 134, 68, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Add", IDC_ADDACTION, 185, 130, 49, 15 +PUSHBUTTON "Delete", IDC_DELETEACTION, 239, 130, 49, 15 +LTEXT "Action:", IDC_STATIC, 14, 131, 24, 13 +LTEXT "Type:", IDC_STATIC, 13, 82, 44, 12 +COMBOBOX IDC_EVENTTYPE, 57, 82, 230, 98, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param1:", IDC_LABEL_A1, 13, 163, 30, 14 +COMBOBOX IDC_ACTIONPARAM1, 45, 163, 48, 219, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Type:", IDC_STATIC, 13, 148, 23, 12 +COMBOBOX IDC_ACTIONTYPE, 45, 148, 172, 133, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param2:", IDC_LABEL_A2, 96, 163, 30, 15 +COMBOBOX IDC_ACTIONPARAM2, 127, 163, 74, 289, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param3:", IDC_LABEL_A3, 203, 162, 30, 14 +COMBOBOX IDC_ACTIONPARAM3, 234, 163, 56, 243, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param4:", IDC_LABEL_A4, 13, 177, 30, 15 +COMBOBOX IDC_ACTIONPARAM4, 45, 176, 48, 204, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param5:", IDC_LABEL_A5, 96, 178, 30, 14 +COMBOBOX IDC_ACTIONPARAM5, 127, 176, 74, 221, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param6:", IDC_LABEL_A6, 203, 176, 30, 16 +COMBOBOX IDC_ACTIONPARAM6, 234, 176, 56, 239, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Waypoint:", IDC_WAYPOINT, 221, 148, 33, 11 +COMBOBOX IDC_ACTIONWAYPOINT, 257, 148, 32, 133, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Trigger??? :", IDC_STATIC, 177, 42, 37, 12 +COMBOBOX IDC_TRIGGER2, 221, 42, 76, 152, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -876,47 +876,47 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "AI Trigger Types" FONT 8, "Tahoma" BEGIN - LTEXT "AI Trigger:",IDC_STATIC,7,7,43,11 - COMBOBOX IDC_AITRIGGERTYPE,60,7,236,307,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Name:",IDC_STATIC,7,63,43,11 - EDITTEXT IDC_NAME,60,64,94,13,ES_AUTOHSCROLL - LTEXT "Teamtype #1:",IDC_STATIC,7,80,43,17 - COMBOBOX IDC_TEAMTYPE1,60,81,236,81,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "House:",IDC_STATIC,165,64,50,16 - COMBOBOX IDC_OWNER,220,64,76,207,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Teamtype #2:",IDC_STATIC,7,98,43,17 - COMBOBOX IDC_TEAMTYPE2,60,98,235,81,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Techlevel:",IDC_STATIC,280,206,8,11,NOT WS_VISIBLE - COMBOBOX IDC_FLAG1,288,222,16,56,CBS_DROPDOWN | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Type:",IDC_STATIC,6,44,53,17 - COMBOBOX IDC_FLAG2,60,45,235,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Data:",IDC_DATALABEL,265,204,8,13,NOT WS_VISIBLE - COMBOBOX IDC_DATA,287,222,16,128,CBS_DROPDOWN | CBS_AUTOHSCROLL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Weight:",IDC_STATIC,6,150,33,11 - EDITTEXT IDC_FLOAT1,59,148,56,13,ES_AUTOHSCROLL - LTEXT "MinWeight:",IDC_STATIC,6,165,38,11 - EDITTEXT IDC_FLOAT2,59,164,56,13,ES_AUTOHSCROLL - LTEXT "MaxWeight:",IDC_STATIC,125,165,40,11 - EDITTEXT IDC_FLOAT3,180,164,54,13,ES_AUTOHSCROLL - LTEXT "MinDiff:",IDC_STATIC,279,222,8,12,NOT WS_VISIBLE - EDITTEXT IDC_FLAG4,291,222,8,12,ES_AUTOHSCROLL | NOT WS_VISIBLE - LTEXT "Multi-Side:",IDC_STATIC,7,115,33,12 - PUSHBUTTON "Delete",IDC_DELETE,220,23,76,13 - PUSHBUTTON "Add",IDC_ADD,140,23,74,13 - CONTROL "Enabled",IDC_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,23,76,11 - CONTROL "Easy",IDC_EASY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,59,133,42,13 - CONTROL "Medium",IDC_MEDIUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,124,132,42,13 - CONTROL "Hard",IDC_HARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,132,42,13 - CONTROL "Base defense",IDC_BASEDEFENSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,124,116,67,13 - CONTROL "Available in Skirmish",IDC_SKIRMISH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,116,85,14 - COMBOBOX IDC_MULTISIDE,60,116,56,63,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Unittype (X):",IDC_STATIC,171,200,51,10 - COMBOBOX IDC_UNITTYPE,171,212,125,255,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Condition:",IDC_STATIC,8,200,50,11 - COMBOBOX IDC_CONDITION,8,212,95,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_NUMBER,109,212,54,13,ES_AUTOHSCROLL - LTEXT "Number (N):",IDC_STATIC,110,200,56,11 - LTEXT "Additional parameters for the appropiate AI Trigger Types:",IDC_STATIC,6,188,295,12 +LTEXT "AI Trigger:", IDC_STATIC, 7, 7, 43, 11 +COMBOBOX IDC_AITRIGGERTYPE, 60, 7, 236, 307, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Name:", IDC_STATIC, 7, 63, 43, 11 +EDITTEXT IDC_NAME, 60, 64, 94, 13, ES_AUTOHSCROLL +LTEXT "Teamtype #1:", IDC_STATIC, 7, 80, 43, 17 +COMBOBOX IDC_TEAMTYPE1, 60, 81, 236, 81, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "House:", IDC_STATIC, 165, 64, 50, 16 +COMBOBOX IDC_OWNER, 220, 64, 76, 207, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Teamtype #2:", IDC_STATIC, 7, 98, 43, 17 +COMBOBOX IDC_TEAMTYPE2, 60, 98, 235, 81, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Techlevel:", IDC_STATIC, 280, 206, 8, 11, NOT WS_VISIBLE +COMBOBOX IDC_FLAG1, 288, 222, 16, 56, CBS_DROPDOWN | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +LTEXT "Type:", IDC_STATIC, 6, 44, 53, 17 +COMBOBOX IDC_FLAG2, 60, 45, 235, 71, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Data:", IDC_DATALABEL, 265, 204, 8, 13, NOT WS_VISIBLE +COMBOBOX IDC_DATA, 287, 222, 16, 128, CBS_DROPDOWN | CBS_AUTOHSCROLL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +LTEXT "Weight:", IDC_STATIC, 6, 150, 33, 11 +EDITTEXT IDC_FLOAT1, 59, 148, 56, 13, ES_AUTOHSCROLL +LTEXT "MinWeight:", IDC_STATIC, 6, 165, 38, 11 +EDITTEXT IDC_FLOAT2, 59, 164, 56, 13, ES_AUTOHSCROLL +LTEXT "MaxWeight:", IDC_STATIC, 125, 165, 40, 11 +EDITTEXT IDC_FLOAT3, 180, 164, 54, 13, ES_AUTOHSCROLL +LTEXT "MinDiff:", IDC_STATIC, 279, 222, 8, 12, NOT WS_VISIBLE +EDITTEXT IDC_FLAG4, 291, 222, 8, 12, ES_AUTOHSCROLL | NOT WS_VISIBLE +LTEXT "Multi-Side:", IDC_STATIC, 7, 115, 33, 12 +PUSHBUTTON "Delete", IDC_DELETE, 220, 23, 76, 13 +PUSHBUTTON "Add", IDC_ADD, 140, 23, 74, 13 +CONTROL "Enabled", IDC_ENABLED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 60, 23, 76, 11 +CONTROL "Easy", IDC_EASY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 59, 133, 42, 13 +CONTROL "Medium", IDC_MEDIUM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 124, 132, 42, 13 +CONTROL "Hard", IDC_HARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 199, 132, 42, 13 +CONTROL "Base defense", IDC_BASEDEFENSE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 124, 116, 67, 13 +CONTROL "Available in Skirmish", IDC_SKIRMISH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 199, 116, 85, 14 +COMBOBOX IDC_MULTISIDE, 60, 116, 56, 63, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Unittype (X):", IDC_STATIC, 171, 200, 51, 10 +COMBOBOX IDC_UNITTYPE, 171, 212, 125, 255, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Condition:", IDC_STATIC, 8, 200, 50, 11 +COMBOBOX IDC_CONDITION, 8, 212, 95, 82, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +EDITTEXT IDC_NUMBER, 109, 212, 54, 13, ES_AUTOHSCROLL +LTEXT "Number (N):", IDC_STATIC, 110, 200, 56, 11 +LTEXT "Additional parameters for the appropiate AI Trigger Types:", IDC_STATIC, 6, 188, 295, 12 END #endif @@ -925,30 +925,30 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "New map assistant" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,191,205,50,14 - PUSHBUTTON "Cancel",IDCANCEL,134,205,50,14 - PUSHBUTTON "Browse",IDC_BROWSE,189,106,44,12 - GROUPBOX "Import options",IDC_LIMPORTOPTIONS,7,93,234,64 - CONTROL "Import Trees",IDC_IMPORTTREES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,91,12 - CONTROL "Import Overlay",IDC_IMPORTOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,138,103,13 - CONTROL "Import Units/Buildings",IDC_IMPORTUNITS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,128,122,94,19 - CONTROL "Multiplayer",IDC_MULTIPLAYER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,167,85,12 - COMBOBOX IDC_IMPORTFILE,15,106,161,206,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Prepare standard houses",IDC_PREPAREHOUSES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,167,113,13 - COMBOBOX IDC_HOUSE,177,183,56,99,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Player house:",IDC_LPLAYERHOUSE,119,183,52,15 - CONTROL "Set Auto-Production triggers",IDC_AUTOPROD,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,178,102,19 - CONTROL "Import existing map",IDC_IMPORT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,7,81,234,11 - CONTROL "Create new map",IDC_NEW,"Button",BS_AUTORADIOBUTTON,7,8,234,15 - GROUPBOX "New map options",IDC_STATIC,7,21,234,51 - EDITTEXT IDC_WIDTH,51,31,51,14,ES_AUTOHSCROLL - LTEXT "Width:",IDC_STATIC,13,31,33,14 - EDITTEXT IDC_HEIGHT,178,31,51,14,ES_AUTOHSCROLL - LTEXT "Height:",IDC_STATIC,130,31,41,14 - LTEXT "Theater:",IDC_STATIC,13,49,38,12 - COMBOBOX IDC_THEATER,51,49,68,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Ground height:",IDC_STATIC,130,50,47,16 - COMBOBOX IDC_GROUNDHEIGHT,178,50,52,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 191, 205, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 134, 205, 50, 14 +PUSHBUTTON "Browse", IDC_BROWSE, 189, 106, 44, 12 +GROUPBOX "Import options", IDC_LIMPORTOPTIONS, 7, 93, 234, 64 +CONTROL "Import Trees", IDC_IMPORTTREES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 15, 125, 91, 12 +CONTROL "Import Overlay", IDC_IMPORTOVERLAY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 15, 138, 103, 13 +CONTROL "Import Units/Buildings", IDC_IMPORTUNITS, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 128, 122, 94, 19 +CONTROL "Multiplayer", IDC_MULTIPLAYER, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 167, 85, 12 +COMBOBOX IDC_IMPORTFILE, 15, 106, 161, 206, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +CONTROL "Prepare standard houses", IDC_PREPAREHOUSES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 120, 167, 113, 13 +COMBOBOX IDC_HOUSE, 177, 183, 56, 99, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Player house:", IDC_LPLAYERHOUSE, 119, 183, 52, 15 +CONTROL "Set Auto-Production triggers", IDC_AUTOPROD, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 7, 178, 102, 19 +CONTROL "Import existing map", IDC_IMPORT, "Button", BS_AUTORADIOBUTTON | WS_GROUP, 7, 81, 234, 11 +CONTROL "Create new map", IDC_NEW, "Button", BS_AUTORADIOBUTTON, 7, 8, 234, 15 +GROUPBOX "New map options", IDC_STATIC, 7, 21, 234, 51 +EDITTEXT IDC_WIDTH, 51, 31, 51, 14, ES_AUTOHSCROLL +LTEXT "Width:", IDC_STATIC, 13, 31, 33, 14 +EDITTEXT IDC_HEIGHT, 178, 31, 51, 14, ES_AUTOHSCROLL +LTEXT "Height:", IDC_STATIC, 130, 31, 41, 14 +LTEXT "Theater:", IDC_STATIC, 13, 49, 38, 12 +COMBOBOX IDC_THEATER, 51, 49, 68, 71, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Ground height:", IDC_STATIC, 130, 50, 47, 16 +COMBOBOX IDC_GROUNDHEIGHT, 178, 50, 52, 71, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_BASIC DIALOG 0, 0, 303, 208 @@ -956,51 +956,51 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Basic Settings" FONT 8, "Tahoma" BEGIN - LTEXT "Note: some of the settings are probably just ignored",IDC_LDESC,5,7,290,10 - LTEXT "Next scenario:",IDC_LNEXTSCENARIO,5,35,60,15 - LTEXT "Alt. next scenario:",IDC_LALTNEXTSCENARIO,5,51,60,15 - LTEXT "Name:",IDC_LNAME,5,20,60,15 - EDITTEXT IDC_NAME,70,20,70,12,ES_AUTOHSCROLL - LTEXT "New INI format:",IDC_LNEWINIFORMAT,5,67,60,15 - EDITTEXT IDC_NEWINIFORMAT,70,67,70,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "CarryOverCap:",IDC_LCARRYOVERCAP,5,83,60,15 - EDITTEXT IDC_CARRYOVERCAP,70,83,70,12,ES_AUTOHSCROLL - LTEXT "EndOfGame",IDC_LENDOFGAME,5,100,60,15 - COMBOBOX IDC_ENDOFGAME,70,99,70,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_NEXTSCENARIO,70,35,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_ALTNEXTSCENARIO,70,51,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Skip Score:",IDC_LSKIPSCORE,5,115,60,15 - COMBOBOX IDC_SKIPSCORE,70,115,70,45,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "One Time Only:",IDC_LONETIMEONLY,5,130,60,15 - COMBOBOX IDC_ONETIMEONLY,70,131,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Skip map select:",IDC_LSKIPMAPSELECT,5,146,60,15 - COMBOBOX IDC_SKIPMAPSELECT,70,147,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Official",IDC_LOFFICIAL,5,163,60,15 - COMBOBOX IDC_OFFICIAL,70,163,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Ignore global AI triggers",IDC_LIGNOREGLOBALAITRIGGERS,6,178,60,19 - COMBOBOX IDC_IGNOREGLOBALAITRIGGERS,70,179,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Truck crate:",IDC_LTRUCKCRATE,150,20,70,17 - COMBOBOX IDC_TRUCKCRATE,226,20,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Train crate:",IDC_LTRAINCRATE,150,35,70,16 - COMBOBOX IDC_TRAINCRATE,226,36,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Percent: (?)",IDC_LPERCENT,150,52,70,16 - EDITTEXT IDC_PERCENT,226,52,70,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Multiplayer Only:",IDC_LMULTIPLAYERONLY,150,67,70,16 - EDITTEXT IDC_MULTIPLAYERONLY,226,68,70,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Tiberium growth enabled:",IDC_LTIBERIUMGROWTHENABLED,150,83,70,15 - COMBOBOX IDC_TIBERIUMGROWTHENABLED,226,84,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Vein growth enabled:",IDC_LVEINGROWTHENABLED,150,99,70,15 - COMBOBOX IDC_VEINGROWTHENABLED,226,100,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Ice growth enabled:",IDC_LICEGROWTHENABLED,150,115,70,15 - COMBOBOX IDC_ICEGROWTHENABLED,226,116,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tiberium death to visceroid:",IDC_LTIBERIUMDEATHTOVISCEROID,150,131,70,15 - COMBOBOX IDC_TIBERIUMDEATHTOVISCEROID,226,132,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Free radar:",IDC_LFREERADAR,150,147,70,10 - COMBOBOX IDC_FREERADAR,226,148,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Init time:",IDC_LINITIME,150,164,70,10 - EDITTEXT IDC_INITTIME,226,164,70,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Required add on:",IDC_LADDONNEEDED,150,179,68,20 - COMBOBOX IDC_REQUIREDADDON,226,179,70,40,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Note: some of the settings are probably just ignored", IDC_LDESC, 5, 7, 290, 10 +LTEXT "Next scenario:", IDC_LNEXTSCENARIO, 5, 35, 60, 15 +LTEXT "Alt. next scenario:", IDC_LALTNEXTSCENARIO, 5, 51, 60, 15 +LTEXT "Name:", IDC_LNAME, 5, 20, 60, 15 +EDITTEXT IDC_NAME, 70, 20, 70, 12, ES_AUTOHSCROLL +LTEXT "New INI format:", IDC_LNEWINIFORMAT, 5, 67, 60, 15 +EDITTEXT IDC_NEWINIFORMAT, 70, 67, 70, 12, ES_AUTOHSCROLL | ES_READONLY +LTEXT "CarryOverCap:", IDC_LCARRYOVERCAP, 5, 83, 60, 15 +EDITTEXT IDC_CARRYOVERCAP, 70, 83, 70, 12, ES_AUTOHSCROLL +LTEXT "EndOfGame", IDC_LENDOFGAME, 5, 100, 60, 15 +COMBOBOX IDC_ENDOFGAME, 70, 99, 70, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_NEXTSCENARIO, 70, 35, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_ALTNEXTSCENARIO, 70, 51, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Skip Score:", IDC_LSKIPSCORE, 5, 115, 60, 15 +COMBOBOX IDC_SKIPSCORE, 70, 115, 70, 45, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "One Time Only:", IDC_LONETIMEONLY, 5, 130, 60, 15 +COMBOBOX IDC_ONETIMEONLY, 70, 131, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Skip map select:", IDC_LSKIPMAPSELECT, 5, 146, 60, 15 +COMBOBOX IDC_SKIPMAPSELECT, 70, 147, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Official", IDC_LOFFICIAL, 5, 163, 60, 15 +COMBOBOX IDC_OFFICIAL, 70, 163, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Ignore global AI triggers", IDC_LIGNOREGLOBALAITRIGGERS, 6, 178, 60, 19 +COMBOBOX IDC_IGNOREGLOBALAITRIGGERS, 70, 179, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Truck crate:", IDC_LTRUCKCRATE, 150, 20, 70, 17 +COMBOBOX IDC_TRUCKCRATE, 226, 20, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Train crate:", IDC_LTRAINCRATE, 150, 35, 70, 16 +COMBOBOX IDC_TRAINCRATE, 226, 36, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Percent: (?)", IDC_LPERCENT, 150, 52, 70, 16 +EDITTEXT IDC_PERCENT, 226, 52, 70, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Multiplayer Only:", IDC_LMULTIPLAYERONLY, 150, 67, 70, 16 +EDITTEXT IDC_MULTIPLAYERONLY, 226, 68, 70, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Tiberium growth enabled:", IDC_LTIBERIUMGROWTHENABLED, 150, 83, 70, 15 +COMBOBOX IDC_TIBERIUMGROWTHENABLED, 226, 84, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Vein growth enabled:", IDC_LVEINGROWTHENABLED, 150, 99, 70, 15 +COMBOBOX IDC_VEINGROWTHENABLED, 226, 100, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Ice growth enabled:", IDC_LICEGROWTHENABLED, 150, 115, 70, 15 +COMBOBOX IDC_ICEGROWTHENABLED, 226, 116, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tiberium death to visceroid:", IDC_LTIBERIUMDEATHTOVISCEROID, 150, 131, 70, 15 +COMBOBOX IDC_TIBERIUMDEATHTOVISCEROID, 226, 132, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Free radar:", IDC_LFREERADAR, 150, 147, 70, 10 +COMBOBOX IDC_FREERADAR, 226, 148, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Init time:", IDC_LINITIME, 150, 164, 70, 10 +EDITTEXT IDC_INITTIME, 226, 164, 70, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Required add on:", IDC_LADDONNEEDED, 150, 179, 68, 20 +COMBOBOX IDC_REQUIREDADDON, 226, 179, 70, 40, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_SINGLEPLAYER DIALOG 0, 0, 303, 207 @@ -1008,30 +1008,30 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Singleplayer Map Settings" FONT 8, "Tahoma" BEGIN - LTEXT "Movies && other singleplayer stuff.",IDC_DESC,7,7,289,16 - GROUPBOX "Movies",IDC_LMOVIES,7,117,289,81 - LTEXT "Intro:",IDC_LINTRO,15,128,59,18 - COMBOBOX IDC_INTRO,75,128,68,161,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Brief:",IDC_LBRIEF,15,144,59,18 - COMBOBOX IDC_BRIEF,75,144,68,202,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Win:",IDC_LWIN,15,160,59,18 - COMBOBOX IDC_WIN,75,160,68,185,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Lose:",IDC_LLOSE,14,177,59,15 - COMBOBOX IDC_LOSE,75,176,68,203,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Action:",IDC_LACTION,154,128,59,18 - COMBOBOX IDC_ACTION,216,128,68,160,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "PostScore:",IDC_LPOSTSCORE,153,144,59,18 - COMBOBOX IDC_POSTSCORE,216,144,68,196,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "PreMapSelect:",IDC_LPREMAPSELECT,153,160,59,18 - COMBOBOX IDC_PREMAPSELECT,216,160,68,225,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Starting dropships:",IDC_LSTARTINGDROPSHIPS,7,23,67,16 - COMBOBOX IDC_STARTINGDROPSHIPS,75,23,68,161,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Carry over money (percent):",IDC_LCARRYOVERMONEY,7,40,67,16 - EDITTEXT IDC_CARRYOVERMONEY,75,41,67,14,ES_AUTOHSCROLL - LTEXT "Inherit timer:",IDC_LINHERITTIMER,7,61,67,16 - COMBOBOX IDC_TIMERINHERIT,75,61,68,161,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Fill silos:",IDC_LFILLSILOS,7,79,67,16 - COMBOBOX IDC_FILLSILOS,75,79,68,161,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Movies && other singleplayer stuff.", IDC_DESC, 7, 7, 289, 16 +GROUPBOX "Movies", IDC_LMOVIES, 7, 117, 289, 81 +LTEXT "Intro:", IDC_LINTRO, 15, 128, 59, 18 +COMBOBOX IDC_INTRO, 75, 128, 68, 161, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Brief:", IDC_LBRIEF, 15, 144, 59, 18 +COMBOBOX IDC_BRIEF, 75, 144, 68, 202, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Win:", IDC_LWIN, 15, 160, 59, 18 +COMBOBOX IDC_WIN, 75, 160, 68, 185, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Lose:", IDC_LLOSE, 14, 177, 59, 15 +COMBOBOX IDC_LOSE, 75, 176, 68, 203, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Action:", IDC_LACTION, 154, 128, 59, 18 +COMBOBOX IDC_ACTION, 216, 128, 68, 160, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "PostScore:", IDC_LPOSTSCORE, 153, 144, 59, 18 +COMBOBOX IDC_POSTSCORE, 216, 144, 68, 196, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "PreMapSelect:", IDC_LPREMAPSELECT, 153, 160, 59, 18 +COMBOBOX IDC_PREMAPSELECT, 216, 160, 68, 225, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Starting dropships:", IDC_LSTARTINGDROPSHIPS, 7, 23, 67, 16 +COMBOBOX IDC_STARTINGDROPSHIPS, 75, 23, 68, 161, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Carry over money (percent):", IDC_LCARRYOVERMONEY, 7, 40, 67, 16 +EDITTEXT IDC_CARRYOVERMONEY, 75, 41, 67, 14, ES_AUTOHSCROLL +LTEXT "Inherit timer:", IDC_LINHERITTIMER, 7, 61, 67, 16 +COMBOBOX IDC_TIMERINHERIT, 75, 61, 68, 161, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Fill silos:", IDC_LFILLSILOS, 7, 79, 67, 16 +COMBOBOX IDC_FILLSILOS, 75, 79, 68, 161, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_MAPVALIDATOR DIALOGEX 0, 0, 440, 225 @@ -1039,10 +1039,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "Map-Validator" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,383,205,50,14 - PUSHBUTTON "Cancel",IDCANCEL,322,205,50,14 - LTEXT "These possible problems were found:",IDC_LPROBLEMSFOUND,7,7,225,14 - CONTROL "List1",IDC_MAPPROBLEMS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,6,21,427,144 +DEFPUSHBUTTON "OK", IDOK, 383, 205, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 322, 205, 50, 14 +LTEXT "These possible problems were found:", IDC_LPROBLEMSFOUND, 7, 7, 225, 14 +CONTROL "List1", IDC_MAPPROBLEMS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 6, 21, 427, 144 END IDD_SCRIPTTYPES DIALOG 0, 0, 302, 230 @@ -1050,23 +1050,23 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Scripts" FONT 8, "Tahoma" BEGIN - LTEXT "Scripttypes let you, for example, define that a team moves from one point to another. A scripttype is attached to a TeamType (not a TaskForce!)",IDC_STATIC,7,7,288,20 - LTEXT "Scripttype",IDC_STATIC,7,31,65,12 - COMBOBOX IDC_SCRIPTTYPE,72,32,223,196,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Add",IDC_ADD,169,49,59,14 - PUSHBUTTON "Delete",IDC_DELETE,236,49,59,14 - LTEXT "Name:",IDC_STATIC,7,74,65,12 - EDITTEXT IDC_NAME,72,74,223,13,ES_AUTOHSCROLL - LTEXT "Actions:",IDC_STATIC,7,92,65,11 - LISTBOX IDC_ACTION,72,92,223,45,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Type of action:",IDC_STATIC,7,160,65,12 - LTEXT "Parameter of action:",IDC_PDESC,7,180,65,17 - COMBOBOX IDC_TYPE,72,161,223,192,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PARAM,72,180,223,111,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Delete",IDC_DELETEACTION,235,140,60,14 - PUSHBUTTON "Add",IDC_ADDACTION,168,140,60,14 - LTEXT "Description:",IDC_STATIC,7,201,62,13 - EDITTEXT IDC_DESCRIPTION,72,201,221,24,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL +LTEXT "Scripttypes let you, for example, define that a team moves from one point to another. A scripttype is attached to a TeamType (not a TaskForce!)", IDC_STATIC, 7, 7, 288, 20 +LTEXT "Scripttype", IDC_STATIC, 7, 31, 65, 12 +COMBOBOX IDC_SCRIPTTYPE, 72, 32, 223, 196, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Add", IDC_ADD, 169, 49, 59, 14 +PUSHBUTTON "Delete", IDC_DELETE, 236, 49, 59, 14 +LTEXT "Name:", IDC_STATIC, 7, 74, 65, 12 +EDITTEXT IDC_NAME, 72, 74, 223, 13, ES_AUTOHSCROLL +LTEXT "Actions:", IDC_STATIC, 7, 92, 65, 11 +LISTBOX IDC_ACTION, 72, 92, 223, 45, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Type of action:", IDC_STATIC, 7, 160, 65, 12 +LTEXT "Parameter of action:", IDC_PDESC, 7, 180, 65, 17 +COMBOBOX IDC_TYPE, 72, 161, 223, 192, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_PARAM, 72, 180, 223, 111, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Delete", IDC_DELETEACTION, 235, 140, 60, 14 +PUSHBUTTON "Add", IDC_ADDACTION, 168, 140, 60, 14 +LTEXT "Description:", IDC_STATIC, 7, 201, 62, 13 +EDITTEXT IDC_DESCRIPTION, 72, 201, 221, 24, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL END IDD_AITRIGGERTYPESENABLE DIALOG 0, 0, 303, 204 @@ -1074,22 +1074,22 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "AI Trigger Types Enable" FONT 8, "Tahoma" BEGIN - LTEXT "This allows the AI for example to create teams automatically. You simply specify which AITriggerTypes are enabled.",IDC_STATIC,7,7,287,23 - LTEXT "AITriggerType:",IDC_STATIC,7,62,60,13 - COMBOBOX IDC_AITRIGGERTYPE,71,62,223,281,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Enable all standard AI triggers (recommended)",IDC_ENABLEALL,7,30,160,14 - PUSHBUTTON "Delete = Disable AITrigger",IDC_DELETE,192,81,102,15 - PUSHBUTTON "Add = Enable AITrigger",IDC_ADD,85,81,102,15 +LTEXT "This allows the AI for example to create teams automatically. You simply specify which AITriggerTypes are enabled.", IDC_STATIC, 7, 7, 287, 23 +LTEXT "AITriggerType:", IDC_STATIC, 7, 62, 60, 13 +COMBOBOX IDC_AITRIGGERTYPE, 71, 62, 223, 281, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "Enable all standard AI triggers (recommended)", IDC_ENABLEALL, 7, 30, 160, 14 +PUSHBUTTON "Delete = Disable AITrigger", IDC_DELETE, 192, 81, 102, 15 +PUSHBUTTON "Add = Enable AITrigger", IDC_ADD, 85, 81, 102, 15 END IDD_TERRAINBAR DIALOG 0, 0, 387, 29 STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif" BEGIN - LTEXT "Terrain / Ground:",IDC_STATIC,7,7,32,20 - COMBOBOX IDC_TILESET,42,7,141,169,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Overlay && Special:",IDC_STATIC,204,7,32,20 - COMBOBOX IDC_OVERLAY,239,7,141,169,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Terrain / Ground:", IDC_STATIC, 7, 7, 32, 20 +COMBOBOX IDC_TILESET, 42, 7, 141, 169, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Overlay && Special:", IDC_STATIC, 204, 7, 32, 20 +COMBOBOX IDC_OVERLAY, 239, 7, 141, 169, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_TOOLSETTINGS DIALOGEX 0, 0, 116, 17 @@ -1097,8 +1097,8 @@ STYLE DS_SETFONT | WS_CHILD EXSTYLE WS_EX_TRANSPARENT FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - LTEXT "Brush size:",IDC_STATIC,7,3,46,11,SS_CENTERIMAGE,WS_EX_TRANSPARENT - COMBOBOX IDC_BRUSHSIZE,58,1,51,79,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Brush size:", IDC_STATIC, 7, 3, 46, 11, SS_CENTERIMAGE, WS_EX_TRANSPARENT +COMBOBOX IDC_BRUSHSIZE, 58, 1, 51, 79, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_SHUTDOWN DIALOG 0, 0, 186, 35 @@ -1106,7 +1106,7 @@ STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "Shutdown" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Shutting down, please wait a few seconds",IDC_STATIC,7,14,172,13 +LTEXT "Shutting down, please wait a few seconds", IDC_STATIC, 7, 14, 172, 13 END IDD_DYNAMICLOAD DIALOG 0, 0, 220, 44 @@ -1114,8 +1114,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_ CAPTION "Loading" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Loading graphics, please wait a few seconds.",IDC_STATIC,7,7,206,15 - CONTROL "Progress4",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,22,206,15 +LTEXT "Loading graphics, please wait a few seconds.", IDC_STATIC, 7, 7, 206, 15 +CONTROL "Progress4", IDC_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_BORDER, 7, 22, 206, 15 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -1128,7 +1128,7 @@ STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "Saving" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Please wait a few seconds while FinalSun is saving. On very large maps this may even take some minutes, please do not cancel! More information is available in the status bar, most time will be needed for packing.",IDC_STATIC,7,7,249,32 +LTEXT "Please wait a few seconds while FinalSun is saving. On very large maps this may even take some minutes, please do not cancel! More information is available in the status bar, most time will be needed for packing.", IDC_STATIC, 7, 7, 249, 32 END #endif @@ -1138,70 +1138,70 @@ EXSTYLE WS_EX_TOOLWINDOW CAPTION "Trigger editor" FONT 8, "Tahoma", 0, 0, 0x1 BEGIN - LTEXT "Select current trigger:",IDC_STATIC,7,7,80,10 - PUSHBUTTON "New trigger",IDC_NEWTRIGGER,180,7,60,14 - PUSHBUTTON "Delete trigger",IDC_DELETETRIGGER,254,7,60,14 - COMBOBOX IDC_TRIGGER,7,26,307,165,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Tab3",IDC_TRIGGERTAB,"SysTabControl32",TCS_HOTTRACK | TCS_TOOLTIPS,7,44,377,214,WS_EX_TRANSPARENT - PUSHBUTTON "Place on map",IDC_PLACEONMAP,324,7,60,14 - PUSHBUTTON "Clone trigger",IDC_CLONE,324,24,60,14 +LTEXT "Select current trigger:", IDC_STATIC, 7, 7, 80, 10 +PUSHBUTTON "New trigger", IDC_NEWTRIGGER, 180, 7, 60, 14 +PUSHBUTTON "Delete trigger", IDC_DELETETRIGGER, 254, 7, 60, 14 +COMBOBOX IDC_TRIGGER, 7, 26, 307, 165, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +CONTROL "Tab3", IDC_TRIGGERTAB, "SysTabControl32", TCS_HOTTRACK | TCS_TOOLTIPS, 7, 44, 377, 214, WS_EX_TRANSPARENT +PUSHBUTTON "Place on map", IDC_PLACEONMAP, 324, 7, 60, 14 +PUSHBUTTON "Clone trigger", IDC_CLONE, 324, 24, 60, 14 END IDD_TRIGGEROPTIONS DIALOGEX 0, 0, 365, 204 STYLE DS_SETFONT | WS_CHILD FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - LTEXT "Type (modifies all attached Tags!):",IDC_STATIC,231,30,125,9 - COMBOBOX IDC_TRIGGERTYPE,231,41,125,71,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Name",IDC_STATIC,7,2,264,10 - EDITTEXT IDC_NAME,6,12,350,13,ES_AUTOHSCROLL - LTEXT "House:",IDC_STATIC,4,31,125,9 - COMBOBOX IDC_HOUSE,4,41,186,78,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Attached trigger:",IDC_STATIC,4,59,125,8 - COMBOBOX IDC_ATTACHEDTRIGGER,4,68,352,133,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Disabled",IDC_DISABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,90,124,9 - LTEXT "Disabled triggers must be enabled using other triggers before they fire.",IDC_STATIC,4,102,260,9 - CONTROL "Easy",IDC_EASY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,115,58,13 - CONTROL "Medium",IDC_MEDIUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,115,58,13 - CONTROL "Hard",IDC_HARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,115,58,13 +LTEXT "Type (modifies all attached Tags!):", IDC_STATIC, 231, 30, 125, 9 +COMBOBOX IDC_TRIGGERTYPE, 231, 41, 125, 71, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Name", IDC_STATIC, 7, 2, 264, 10 +EDITTEXT IDC_NAME, 6, 12, 350, 13, ES_AUTOHSCROLL +LTEXT "House:", IDC_STATIC, 4, 31, 125, 9 +COMBOBOX IDC_HOUSE, 4, 41, 186, 78, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Attached trigger:", IDC_STATIC, 4, 59, 125, 8 +COMBOBOX IDC_ATTACHEDTRIGGER, 4, 68, 352, 133, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +CONTROL "Disabled", IDC_DISABLED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 4, 90, 124, 9 +LTEXT "Disabled triggers must be enabled using other triggers before they fire.", IDC_STATIC, 4, 102, 260, 9 +CONTROL "Easy", IDC_EASY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 4, 115, 58, 13 +CONTROL "Medium", IDC_MEDIUM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 68, 115, 58, 13 +CONTROL "Hard", IDC_HARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 140, 115, 58, 13 END IDD_TRIGGEREVENTS DIALOGEX 0, 0, 365, 204 STYLE DS_SETFONT | WS_CHILD FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - LTEXT "Current event:",IDC_STATIC,6,6,64,11 - COMBOBOX IDC_EVENT,72,6,150,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "New event",IDC_NEWEVENT,233,6,61,14 - PUSHBUTTON "Delete event",IDC_DELETEEVENT,300,6,61,14 - GROUPBOX "Event options",IDC_STATIC,6,19,355,178 - LTEXT "Event type:",IDC_STATIC,14,32,57,12 - COMBOBOX IDC_EVENTTYPE,72,30,282,184,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EVENTDESCRIPTION,14,48,340,26,ES_MULTILINE | ES_READONLY | WS_VSCROLL - LTEXT "Event parameters:",IDC_STATIC,14,79,74,10 - LISTBOX IDC_PARAMETER,14,93,159,96,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - LTEXT "Parameter value:",IDC_STATIC,185,79,118,10 - COMBOBOX IDC_PARAMVALUE,185,93,169,125,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Select the event type first, then set all parameters.",IDC_STATIC,185,110,169,25 +LTEXT "Current event:", IDC_STATIC, 6, 6, 64, 11 +COMBOBOX IDC_EVENT, 72, 6, 150, 79, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "New event", IDC_NEWEVENT, 233, 6, 61, 14 +PUSHBUTTON "Delete event", IDC_DELETEEVENT, 300, 6, 61, 14 +GROUPBOX "Event options", IDC_STATIC, 6, 19, 355, 178 +LTEXT "Event type:", IDC_STATIC, 14, 32, 57, 12 +COMBOBOX IDC_EVENTTYPE, 72, 30, 282, 184, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +EDITTEXT IDC_EVENTDESCRIPTION, 14, 48, 340, 26, ES_MULTILINE | ES_READONLY | WS_VSCROLL +LTEXT "Event parameters:", IDC_STATIC, 14, 79, 74, 10 +LISTBOX IDC_PARAMETER, 14, 93, 159, 96, LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +LTEXT "Parameter value:", IDC_STATIC, 185, 79, 118, 10 +COMBOBOX IDC_PARAMVALUE, 185, 93, 169, 125, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Select the event type first, then set all parameters.", IDC_STATIC, 185, 110, 169, 25 END IDD_TRIGGERACTIONS DIALOGEX 0, 0, 365, 202 STYLE DS_SETFONT | WS_CHILD FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - LTEXT "Current action:",IDC_STATIC,6,6,58,11 - COMBOBOX IDC_ACTION,72,6,149,79,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "New action",IDC_NEWACTION,233,6,60,14 - PUSHBUTTON "Delete action",IDC_DELETEACTION,301,6,59,14 - GROUPBOX "Action options",IDC_STATIC,6,20,354,174 - LTEXT "Action type:",IDC_STATIC,14,32,57,12 - COMBOBOX IDC_ACTIONTYPE,72,30,282,184,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_ACTIONDESCRIPTION,14,48,340,26,ES_MULTILINE | ES_READONLY | WS_VSCROLL - LTEXT "Action parameters:",IDC_STATIC,14,79,74,10 - LISTBOX IDC_PARAMETER,14,93,160,94,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - LTEXT "Parameter value:",IDC_STATIC,186,79,118,10 - COMBOBOX IDC_PARAMVALUE,186,92,168,125,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Select the event type first, then set all parameters.",IDC_STATIC,186,110,168,25 +LTEXT "Current action:", IDC_STATIC, 6, 6, 58, 11 +COMBOBOX IDC_ACTION, 72, 6, 149, 79, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "New action", IDC_NEWACTION, 233, 6, 60, 14 +PUSHBUTTON "Delete action", IDC_DELETEACTION, 301, 6, 59, 14 +GROUPBOX "Action options", IDC_STATIC, 6, 20, 354, 174 +LTEXT "Action type:", IDC_STATIC, 14, 32, 57, 12 +COMBOBOX IDC_ACTIONTYPE, 72, 30, 282, 184, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +EDITTEXT IDC_ACTIONDESCRIPTION, 14, 48, 340, 26, ES_MULTILINE | ES_READONLY | WS_VSCROLL +LTEXT "Action parameters:", IDC_STATIC, 14, 79, 74, 10 +LISTBOX IDC_PARAMETER, 14, 93, 160, 94, LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +LTEXT "Parameter value:", IDC_STATIC, 186, 79, 118, 10 +COMBOBOX IDC_PARAMVALUE, 186, 92, 168, 125, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_NOINTEGRALHEIGHT | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Select the event type first, then set all parameters.", IDC_STATIC, 186, 110, 168, 25 END IDD_GLOBALS DIALOG 0, 0, 186, 79 @@ -1209,12 +1209,12 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Local Variables" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Select variable:",IDC_STATIC,7,7,60,12 - COMBOBOX IDC_GLOBAL,7,19,172,92,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,7,41,44,12 - EDITTEXT IDC_DESCRIPTION,56,41,123,13,ES_AUTOHSCROLL - LTEXT "Preset value:",IDC_STATIC,7,60,45,11 - COMBOBOX IDC_VALUE,57,59,122,55,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Select variable:", IDC_STATIC, 7, 7, 60, 12 +COMBOBOX IDC_GLOBAL, 7, 19, 172, 92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Description:", IDC_STATIC, 7, 41, 44, 12 +EDITTEXT IDC_DESCRIPTION, 56, 41, 123, 13, ES_AUTOHSCROLL +LTEXT "Preset value:", IDC_STATIC, 7, 60, 45, 11 +COMBOBOX IDC_VALUE, 57, 59, 122, 55, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -1227,20 +1227,20 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_NOFAILCREATE | WS_POPUP | WS_VISIBLE | WS_ CAPTION "Options" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,140,160,50,14 - PUSHBUTTON "Cancel",IDCANCEL,85,160,50,14 - LTEXT "Tiberian Sun EXE (make sure its in the correct path)",IDC_STATIC,5,5,130,20 - EDITTEXT IDC_EDIT1,5,25,130,15,ES_AUTOHSCROLL - PUSHBUTTON "Browse",IDC_CHOOSE,140,25,50,15 - LTEXT "Language / Sprache:",IDC_STATIC,7,51,128,11 - COMBOBOX IDC_LANGUAGE,7,63,183,94,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Rules, Art && AI ini files",IDC_STATIC,7,81,183,71 - CONTROL "Act like Tiberian Sun when searching for files (recommended)",IDC_RULESLIKETS, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP,14,92,170,16 - CONTROL "Only use the files inside tibsun.mix (do not use Firestorm or any mods)",IDC_ONLYORIGINAL, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE,14,110,168,16 - CONTROL "Prefer FinalSun theater INI files",IDC_PREFER_LOCAL_THEATER_FILES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,131,164,12 +DEFPUSHBUTTON "OK", IDOK, 140, 160, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 85, 160, 50, 14 +LTEXT "Tiberian Sun EXE (make sure its in the correct path)", IDC_STATIC, 5, 5, 130, 20 +EDITTEXT IDC_EDIT1, 5, 25, 130, 15, ES_AUTOHSCROLL +PUSHBUTTON "Browse", IDC_CHOOSE, 140, 25, 50, 15 +LTEXT "Language / Sprache:", IDC_STATIC, 7, 51, 128, 11 +COMBOBOX IDC_LANGUAGE, 7, 63, 183, 94, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +GROUPBOX "Rules, Art && AI ini files", IDC_STATIC, 7, 81, 183, 71 +CONTROL "Act like Tiberian Sun when searching for files (recommended)", IDC_RULESLIKETS, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP, 14, 92, 170, 16 +CONTROL "Only use the files inside tibsun.mix (do not use Firestorm or any mods)", IDC_ONLYORIGINAL, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE, 14, 110, 168, 16 +CONTROL "Prefer FinalSun theater INI files", IDC_PREFER_LOCAL_THEATER_FILES, +"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 131, 164, 12 END #endif @@ -1254,10 +1254,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Info" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,292,8,50,14 - LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nWestwood Studios(tm) is an Electronic Arts(tm) brand.",IDC_STATIC,7,189,334,18 - LTEXT "© 1999-2024 Electronic Arts Inc. Westwood Studios and Electronic Arts are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.",IDC_STATIC,7,214,335,28 - EDITTEXT IDC_LICENSE_AND_COPYRIGHT,6,29,336,148,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL +DEFPUSHBUTTON "OK", IDOK, 292, 8, 50, 14 +LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nWestwood Studios(tm) is an Electronic Arts(tm) brand.", IDC_STATIC, 7, 189, 334, 18 +LTEXT "© 1999-2024 Electronic Arts Inc. Westwood Studios and Electronic Arts are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.", IDC_STATIC, 7, 214, 335, 28 +EDITTEXT IDC_LICENSE_AND_COPYRIGHT, 6, 29, 336, 148, ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL END #endif @@ -1270,15 +1270,15 @@ IDD_LOADING DIALOGEX 0, 0, 235, 165 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP FONT 8, "Tahoma", 0, 0, 0x1 BEGIN - LTEXT "Loading...",IDC_CAP,7,7,221,9 - CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH,7,18,221,13,WS_EX_DLGMODALFRAME - LTEXT "Homepage: http://www.ea.com",IDC_STATIC,7,78,221,11,WS_BORDER - CTEXT "",IDC_VERSION,74,37,154,13,SS_CENTERIMAGE | SS_SUNKEN - LTEXT "Version:",IDC_LVERSION,7,37,61,9 - CTEXT "",IDC_BUILTBY,74,52,154,13,SS_CENTERIMAGE | SS_SUNKEN - LTEXT "Built by:",IDC_LBUILTBY,7,52,61,9 - LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nAuthored by Matthias Wagner\nWestwood Studios(tm) is an Electronic Arts(tm) brand.",IDC_STATIC,7,97,221,33 - LTEXT "This software comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it.\nFor details open Help->Info",IDC_STATIC,6,129,221,26 +LTEXT "Loading...", IDC_CAP, 7, 7, 221, 9 +CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH, 7, 18, 221, 13, WS_EX_DLGMODALFRAME +LTEXT "Homepage: http://www.ea.com", IDC_STATIC, 7, 78, 221, 11, WS_BORDER +CTEXT "", IDC_VERSION, 74, 37, 154, 13, SS_CENTERIMAGE | SS_SUNKEN +LTEXT "Version:", IDC_LVERSION, 7, 37, 61, 9 +CTEXT "", IDC_BUILTBY, 74, 52, 154, 13, SS_CENTERIMAGE | SS_SUNKEN +LTEXT "Built by:", IDC_LBUILTBY, 7, 52, 61, 9 +LTEXT "© 1999-2024 ELECTRONIC ARTS INC. ALL RIGHTS RESERVED\nAuthored by Matthias Wagner\nWestwood Studios(tm) is an Electronic Arts(tm) brand.", IDC_STATIC, 7, 97, 221, 33 +LTEXT "This software comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it.\nFor details open Help->Info", IDC_STATIC, 6, 129, 221, 26 END #endif @@ -1292,60 +1292,60 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Teams" FONT 8, "Tahoma" BEGIN - LTEXT "Team types connect a trigger with task forces",IDC_STATIC,6,5,290,10 - LTEXT "Team types:",IDC_STATIC,5,20,50,10 - COMBOBOX IDC_TEAMTYPES,55,20,155,174,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "New",IDC_NEWTEAMTYPE,261,20,35,15 - PUSHBUTTON "Delete",IDC_DELETETEAMTYPE,220,20,35,15 - LTEXT "Name:",IDC_STATIC,10,51,30,10 - EDITTEXT IDC_NAME,56,51,90,12,ES_AUTOHSCROLL - LTEXT "Veteran level:",IDC_STATIC,10,66,45,15 - CONTROL "Loadable",IDC_LOADABLE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,157,55,8 - CONTROL "Full",IDC_FULL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,167,55,8 - CONTROL "Annoyance",IDC_ANNOYANCE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,176,55,10 - CONTROL "Guard slower",IDC_GUARDSLOWER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,187,55,8 - CONTROL "Recruiter",IDC_RECRUITER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,10,197,55,8 - LTEXT "House:",IDC_STATIC,10,81,35,10 - COMBOBOX IDC_HOUSE,56,81,90,62,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "Autocreate",IDC_AUTOCREATE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,157,55,8 - CONTROL "Prebuild",IDC_PREBUILD,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,167,55,8 - CONTROL "Reinforce",IDC_REINFORCE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,177,55,8 - CONTROL "Cargo plane",IDC_DROPPOD,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,157,55,8 - CONTROL "Whiner",IDC_WHINER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,167,55,8 - CONTROL "Loose recruit",IDC_LOOSERECRUIT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,177,55,8 - CONTROL "Aggressive",IDC_AGGRESSIVE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,187,55,8 - CONTROL "Suicide",IDC_SUICIDE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,65,197,55,8 - CONTROL "OnTransOnly",IDC_ONTRANSONLY,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,187,55,8 - CONTROL "AvoidThreats",IDC_AVOIDTHREATS,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,125,197,55,8 - CONTROL "Ion immune",IDC_IONIMMUNE,"Button",BS_AUTOCHECKBOX | BS_LEFT | NOT WS_VISIBLE | WS_TABSTOP,185,157,60,8 - CONTROL "TransportsReturnOnUnload",IDC_TRANSPORTRETURNSONUNLOAD, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,177,100,8 - CONTROL "AreTeamMembersRecruitable",IDC_ARETEAMMEMBERSRECRUITABLE, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,167,105,8 - CONTROL "IsBaseDefense",IDC_ISBASEDEFENSE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,187,80,8 - CONTROL "OnlyTargetHouseEnemy",IDC_ONLYTARGETHOUSEENEMY,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,185,197,100,8 - LTEXT "Priority:",IDC_STATIC,10,96,40,10 - EDITTEXT IDC_PRIORITY,56,96,90,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Max:",IDC_STATIC,10,111,30,10 - EDITTEXT IDC_MAX,56,111,90,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Techlevel:",IDC_STATIC,10,125,40,10 - COMBOBOX IDC_TECHLEVEL,56,125,91,72,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Group:",IDC_STATIC,156,51,30,10 - GROUPBOX "Selected team type",IDC_STATIC,6,37,290,173 - COMBOBOX IDC_GROUP,200,51,90,78,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Waypoint:",IDC_STATIC,156,66,40,10 - COMBOBOX IDC_WAYPOINT,200,66,90,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Script:",IDC_STATIC,156,81,40,10 - COMBOBOX IDC_SCRIPT,200,81,90,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Task force:",IDC_STATIC,156,96,40,10 - COMBOBOX IDC_TASKFORCE,200,96,90,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_VETERANLEVEL,56,66,90,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tag:",IDC_STATIC,156,111,40,13 - COMBOBOX IDC_TAG,200,111,90,186,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Transport waypoint:",IDC_LTRANSPORTWAYPOINT,156,126,40,17 - COMBOBOX IDC_TRANSPORTWAYPOINT,200,126,90,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Mind Control Decision:",IDC_MCD_L,10,139,43,16 - COMBOBOX IDC_MINDCONTROLDECISION,55,140,92,205,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Team types connect a trigger with task forces", IDC_STATIC, 6, 5, 290, 10 +LTEXT "Team types:", IDC_STATIC, 5, 20, 50, 10 +COMBOBOX IDC_TEAMTYPES, 55, 20, 155, 174, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP +PUSHBUTTON "New", IDC_NEWTEAMTYPE, 261, 20, 35, 15 +PUSHBUTTON "Delete", IDC_DELETETEAMTYPE, 220, 20, 35, 15 +LTEXT "Name:", IDC_STATIC, 10, 51, 30, 10 +EDITTEXT IDC_NAME, 56, 51, 90, 12, ES_AUTOHSCROLL +LTEXT "Veteran level:", IDC_STATIC, 10, 66, 45, 15 +CONTROL "Loadable", IDC_LOADABLE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 157, 55, 8 +CONTROL "Full", IDC_FULL, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 167, 55, 8 +CONTROL "Annoyance", IDC_ANNOYANCE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 176, 55, 10 +CONTROL "Guard slower", IDC_GUARDSLOWER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 187, 55, 8 +CONTROL "Recruiter", IDC_RECRUITER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 10, 197, 55, 8 +LTEXT "House:", IDC_STATIC, 10, 81, 35, 10 +COMBOBOX IDC_HOUSE, 56, 81, 90, 62, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +CONTROL "Autocreate", IDC_AUTOCREATE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 157, 55, 8 +CONTROL "Prebuild", IDC_PREBUILD, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 167, 55, 8 +CONTROL "Reinforce", IDC_REINFORCE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 177, 55, 8 +CONTROL "Cargo plane", IDC_DROPPOD, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 157, 55, 8 +CONTROL "Whiner", IDC_WHINER, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 167, 55, 8 +CONTROL "Loose recruit", IDC_LOOSERECRUIT, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 177, 55, 8 +CONTROL "Aggressive", IDC_AGGRESSIVE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 187, 55, 8 +CONTROL "Suicide", IDC_SUICIDE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 65, 197, 55, 8 +CONTROL "OnTransOnly", IDC_ONTRANSONLY, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 187, 55, 8 +CONTROL "AvoidThreats", IDC_AVOIDTHREATS, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 125, 197, 55, 8 +CONTROL "Ion immune", IDC_IONIMMUNE, "Button", BS_AUTOCHECKBOX | BS_LEFT | NOT WS_VISIBLE | WS_TABSTOP, 185, 157, 60, 8 +CONTROL "TransportsReturnOnUnload", IDC_TRANSPORTRETURNSONUNLOAD, +"Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 177, 100, 8 +CONTROL "AreTeamMembersRecruitable", IDC_ARETEAMMEMBERSRECRUITABLE, +"Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 167, 105, 8 +CONTROL "IsBaseDefense", IDC_ISBASEDEFENSE, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 187, 80, 8 +CONTROL "OnlyTargetHouseEnemy", IDC_ONLYTARGETHOUSEENEMY, "Button", BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP, 185, 197, 100, 8 +LTEXT "Priority:", IDC_STATIC, 10, 96, 40, 10 +EDITTEXT IDC_PRIORITY, 56, 96, 90, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Max:", IDC_STATIC, 10, 111, 30, 10 +EDITTEXT IDC_MAX, 56, 111, 90, 12, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Techlevel:", IDC_STATIC, 10, 125, 40, 10 +COMBOBOX IDC_TECHLEVEL, 56, 125, 91, 72, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Group:", IDC_STATIC, 156, 51, 30, 10 +GROUPBOX "Selected team type", IDC_STATIC, 6, 37, 290, 173 +COMBOBOX IDC_GROUP, 200, 51, 90, 78, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Waypoint:", IDC_STATIC, 156, 66, 40, 10 +COMBOBOX IDC_WAYPOINT, 200, 66, 90, 80, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Script:", IDC_STATIC, 156, 81, 40, 10 +COMBOBOX IDC_SCRIPT, 200, 81, 90, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Task force:", IDC_STATIC, 156, 96, 40, 10 +COMBOBOX IDC_TASKFORCE, 200, 96, 90, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +COMBOBOX IDC_VETERANLEVEL, 56, 66, 90, 60, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tag:", IDC_STATIC, 156, 111, 40, 13 +COMBOBOX IDC_TAG, 200, 111, 90, 186, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Transport waypoint:", IDC_LTRANSPORTWAYPOINT, 156, 126, 40, 17 +COMBOBOX IDC_TRANSPORTWAYPOINT, 200, 126, 90, 80, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Mind Control Decision:", IDC_MCD_L, 10, 139, 43, 16 +COMBOBOX IDC_MINDCONTROLDECISION, 55, 140, 92, 205, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP END #endif @@ -1354,12 +1354,12 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 1" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - LTEXT "Please select if you want to create a new singleplayer map or multiplayer map. Multiplayer maps are maps used in both skirmish and multiplayer games.",IDC_STATIC,7,7,208,33 - CONTROL "Singleplayer map (only for experienced users that can handle advanced mode)",IDC_SINGLE, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP,7,55,208,20 - CONTROL "Multiplayer map",IDC_MULTI,"Button",BS_AUTORADIOBUTTON,7,76,208,11 +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +LTEXT "Please select if you want to create a new singleplayer map or multiplayer map. Multiplayer maps are maps used in both skirmish and multiplayer games.", IDC_STATIC, 7, 7, 208, 33 +CONTROL "Singleplayer map (only for experienced users that can handle advanced mode)", IDC_SINGLE, +"Button", BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP, 7, 55, 208, 20 +CONTROL "Multiplayer map", IDC_MULTI, "Button", BS_AUTORADIOBUTTON, 7, 76, 208, 11 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -1372,14 +1372,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 2" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - LTEXT "Please select here if you want to create a completely new map from scratch or if you want to import an already existing map (Note: You cannot import maps created by the random map generator of RA2 or of TS version 1.15 or higher)",IDC_STATIC,7,7,208,37 - CONTROL "Create a completely new map",IDC_CREATE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,7,55,208,11 - CONTROL "Import an existing map or bitmap (BMP)",IDC_IMPORT, - "Button",BS_AUTORADIOBUTTON,7,67,208,11 - CONTROL "Activate AI Triggers (results in better AI)",IDC_AITRIGGERS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,83,208,14 +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +LTEXT "Please select here if you want to create a completely new map from scratch or if you want to import an already existing map (Note: You cannot import maps created by the random map generator of RA2 or of TS version 1.15 or higher)", IDC_STATIC, 7, 7, 208, 37 +CONTROL "Create a completely new map", IDC_CREATE, "Button", BS_AUTORADIOBUTTON | WS_GROUP, 7, 55, 208, 11 +CONTROL "Import an existing map or bitmap (BMP)", IDC_IMPORT, +"Button", BS_AUTORADIOBUTTON, 7, 67, 208, 11 +CONTROL "Activate AI Triggers (results in better AI)", IDC_AITRIGGERS, +"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 83, 208, 14 END #endif @@ -1388,15 +1388,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 4" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - CONTROL "Prepare standard houses (recommended)",IDC_PREPAREHOUSES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,39,159,13 - COMBOBOX IDC_HOUSE,87,63,115,99,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Player house:",IDC_LPLAYERHOUSE,15,63,52,15 - CONTROL "Set Auto-Production triggers",IDC_AUTOPROD,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,78,192,14 - LTEXT "Please select the human player. It is recommended to leave the other options as they are.",IDC_STATIC,7,7,208,26 - GROUPBOX "",IDC_STATIC,7,52,208,46 +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +CONTROL "Prepare standard houses (recommended)", IDC_PREPAREHOUSES, +"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 39, 159, 13 +COMBOBOX IDC_HOUSE, 87, 63, 115, 99, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Player house:", IDC_LPLAYERHOUSE, 15, 63, 52, 15 +CONTROL "Set Auto-Production triggers", IDC_AUTOPROD, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 14, 78, 192, 14 +LTEXT "Please select the human player. It is recommended to leave the other options as they are.", IDC_STATIC, 7, 7, 208, 26 +GROUPBOX "", IDC_STATIC, 7, 52, 208, 46 END IDD_NEWMAPCREATENEW DIALOG 0, 0, 222, 129 @@ -1404,17 +1404,17 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 3" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - LTEXT "Please select size, theater and starting height here. The size should be below 100x100 for best results.",IDC_STATIC,7,7,208,32 - LTEXT "Width:",IDC_STATIC,7,39,35,11 - EDITTEXT IDC_WIDTH,130,39,85,13,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Height:",IDC_STATIC,7,55,35,11 - EDITTEXT IDC_HEIGHT,130,55,85,13,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Theater:",IDC_STATIC,7,71,53,12 - COMBOBOX IDC_THEATER,130,71,85,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Starting height:",IDC_STATIC,7,87,64,12 - COMBOBOX IDC_STARTINGHEIGHT,130,87,85,93,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +LTEXT "Please select size, theater and starting height here. The size should be below 100x100 for best results.", IDC_STATIC, 7, 7, 208, 32 +LTEXT "Width:", IDC_STATIC, 7, 39, 35, 11 +EDITTEXT IDC_WIDTH, 130, 39, 85, 13, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Height:", IDC_STATIC, 7, 55, 35, 11 +EDITTEXT IDC_HEIGHT, 130, 55, 85, 13, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Theater:", IDC_STATIC, 7, 71, 53, 12 +COMBOBOX IDC_THEATER, 130, 71, 85, 58, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Starting height:", IDC_STATIC, 7, 87, 64, 12 +COMBOBOX IDC_STARTINGHEIGHT, 130, 87, 85, 93, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_NEWMAPIMPORT DIALOG 0, 0, 222, 129 @@ -1422,14 +1422,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 3" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - PUSHBUTTON "Browse",IDC_BROWSE,155,51,60,12 - CONTROL "Import Trees",IDC_IMPORTTREES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,69,91,12 - CONTROL "Import Overlay",IDC_IMPORTOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,82,103,13 - CONTROL "Import Units/Buildings",IDC_IMPORTUNITS,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,120,66,94,19 - COMBOBOX IDC_IMPORTFILE,7,51,131,206,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Please select the map you want to import. No triggers or houses will be imported. Bitmaps will be scaled down to appropiate size. Currently bitmaps will always be converted to temperate theater maps.",IDC_STATIC,7,7,208,43 +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +PUSHBUTTON "Browse", IDC_BROWSE, 155, 51, 60, 12 +CONTROL "Import Trees", IDC_IMPORTTREES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 69, 91, 12 +CONTROL "Import Overlay", IDC_IMPORTOVERLAY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 82, 103, 13 +CONTROL "Import Units/Buildings", IDC_IMPORTUNITS, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 120, 66, 94, 19 +COMBOBOX IDC_IMPORTFILE, 7, 51, 131, 206, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Please select the map you want to import. No triggers or houses will be imported. Bitmaps will be scaled down to appropiate size. Currently bitmaps will always be converted to temperate theater maps.", IDC_STATIC, 7, 7, 208, 43 END IDD_MAPLOAD DIALOG 0, 0, 220, 50 @@ -1437,8 +1437,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_ CAPTION "Loading" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Loading map, please wait. This may take several minutes on big maps.",IDC_STATIC,7,7,206,18 - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,29,206,14 +LTEXT "Loading map, please wait. This may take several minutes on big maps.", IDC_STATIC, 7, 7, 206, 18 +CONTROL "Progress1", IDC_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_BORDER, 7, 29, 206, 14 END IDD_NEWMAPBITMAP DIALOG 0, 0, 222, 129 @@ -1446,17 +1446,17 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 3" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - LTEXT "Please select size, theater and starting height here. The size should be below 150x150.",IDC_STATIC,7,7,208,32 - LTEXT "Width:",IDC_STATIC,7,39,35,11 - EDITTEXT IDC_WIDTH,130,39,85,13,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Height:",IDC_STATIC,7,55,35,11 - EDITTEXT IDC_HEIGHT,130,55,85,13,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Theater:",IDC_STATIC,7,71,53,12 - COMBOBOX IDC_THEATER,130,71,85,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Starting height:",IDC_STATIC,7,87,64,12 - COMBOBOX IDC_STARTINGHEIGHT,130,87,85,93,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +LTEXT "Please select size, theater and starting height here. The size should be below 150x150.", IDC_STATIC, 7, 7, 208, 32 +LTEXT "Width:", IDC_STATIC, 7, 39, 35, 11 +EDITTEXT IDC_WIDTH, 130, 39, 85, 13, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Height:", IDC_STATIC, 7, 55, 35, 11 +EDITTEXT IDC_HEIGHT, 130, 55, 85, 13, ES_AUTOHSCROLL | ES_NUMBER +LTEXT "Theater:", IDC_STATIC, 7, 71, 53, 12 +COMBOBOX IDC_THEATER, 130, 71, 85, 58, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Starting height:", IDC_STATIC, 7, 87, 64, 12 +COMBOBOX IDC_STARTINGHEIGHT, 130, 87, 85, 93, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_PROGRESS DIALOG 0, 0, 208, 89 @@ -1464,10 +1464,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Progress" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "Cancel",IDCANCEL,67,68,50,14 - LTEXT "Progress:",IDC_LABEL,7,7,194,22 - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,47,194,13 - LTEXT "Progress: ",IDC_PROGLABEL,7,31,194,13 +PUSHBUTTON "Cancel", IDCANCEL, 67, 68, 50, 14 +LTEXT "Progress:", IDC_LABEL, 7, 7, 194, 22 +CONTROL "Progress1", IDC_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_BORDER, 7, 47, 194, 13 +LTEXT "Progress: ", IDC_PROGLABEL, 7, 31, 194, 13 END IDD_AUTOUPDATE DIALOG 0, 0, 290, 177 @@ -1475,14 +1475,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Auto Update" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "Download",IDOK,223,156,60,14 - PUSHBUTTON "Cancel",IDCANCEL,152,156,60,14 - LTEXT "Updates available:",IDC_STATIC,7,7,184,16 - LISTBOX IDC_UPDATELIST,7,23,276,36,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Description:",IDC_STATIC,7,66,80,14 - EDITTEXT IDC_DESCRIPTION,92,66,191,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL - LTEXT "Download locations:",IDC_STATIC,7,118,69,14 - LISTBOX IDC_DOWNLOADLIST,91,117,192,29,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "Download", IDOK, 223, 156, 60, 14 +PUSHBUTTON "Cancel", IDCANCEL, 152, 156, 60, 14 +LTEXT "Updates available:", IDC_STATIC, 7, 7, 184, 16 +LISTBOX IDC_UPDATELIST, 7, 23, 276, 36, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Description:", IDC_STATIC, 7, 66, 80, 14 +EDITTEXT IDC_DESCRIPTION, 92, 66, 191, 42, ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL +LTEXT "Download locations:", IDC_STATIC, 7, 118, 69, 14 +LISTBOX IDC_DOWNLOADLIST, 91, 117, 192, 29, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -1495,14 +1495,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMEN CAPTION "Create new map - Step 2" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "Next",IDOK,165,108,50,14 - PUSHBUTTON "Cancel",IDCANCEL,7,108,50,14 - LTEXT "Please select here if you want to create a completely new map from scratch or if you want to import an already existing map (Note: You cannot import maps created by the random map generator of RA2)",IDC_STATIC,7,7,208,37 - CONTROL "Create a completely new map",IDC_CREATE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,7,55,208,11 - CONTROL "Import an existing map or bitmap (BMP)",IDC_IMPORT, - "Button",BS_AUTORADIOBUTTON,7,67,208,11 - CONTROL "Activate AI Triggers (results in better AI)",IDC_AITRIGGERS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,83,208,14 +DEFPUSHBUTTON "Next", IDOK, 165, 108, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 7, 108, 50, 14 +LTEXT "Please select here if you want to create a completely new map from scratch or if you want to import an already existing map (Note: You cannot import maps created by the random map generator of RA2)", IDC_STATIC, 7, 7, 208, 37 +CONTROL "Create a completely new map", IDC_CREATE, "Button", BS_AUTORADIOBUTTON | WS_GROUP, 7, 55, 208, 11 +CONTROL "Import an existing map or bitmap (BMP)", IDC_IMPORT, +"Button", BS_AUTORADIOBUTTON, 7, 67, 208, 11 +CONTROL "Activate AI Triggers (results in better AI)", IDC_AITRIGGERS, +"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 7, 83, 208, 14 END #endif @@ -1516,7 +1516,7 @@ STYLE DS_SETFONT | DS_CENTER | WS_POPUP | WS_CAPTION CAPTION "Saving" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Please wait a few seconds while FinalAlert 2 is saving. On very large maps this may even take some minutes, please do not cancel! More information is available in the status bar, most time will be needed for packing.",IDC_STATIC,7,7,249,32 +LTEXT "Please wait a few seconds while FinalAlert 2 is saving. On very large maps this may even take some minutes, please do not cancel! More information is available in the status bar, most time will be needed for packing.", IDC_STATIC, 7, 7, 249, 32 END #endif @@ -1525,31 +1525,31 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "Unit Options" FONT 8, "Tahoma" BEGIN - DEFPUSHBUTTON "OK",IDOK,170,124,50,14 - PUSHBUTTON "Cancel",IDCANCEL,110,124,50,14 - LTEXT "House:",IDC_LHOUSE,5,8,33,11 - COMBOBOX IDC_HOUSE,45,8,65,45,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Strength:",IDC_LSTRENGTH,5,26,29,10 - CONTROL "Slider1",IDC_STRENGTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,45,26,70,11 - LTEXT "State:",IDC_LSTATE,5,43,40,10 - COMBOBOX IDC_STATE,45,43,65,90,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Tag:",IDC_LTAG,6,105,63,14 - COMBOBOX IDC_TAG,74,106,153,69,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Param1:",IDC_LP1,5,80,37,17 - EDITTEXT IDC_P1,45,80,65,12,ES_AUTOHSCROLL - LTEXT "Param2:",IDC_LP2,125,8,30,16 - LTEXT "Param3:",IDC_LP3,125,25,30,16 - LTEXT "Param4:",IDC_LP4,125,43,30,16 - EDITTEXT IDC_P2,161,8,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_P3,161,25,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_P4,161,43,65,12,ES_AUTOHSCROLL - LTEXT "Params are unknown (integers?).",IDC_DESC,4,137,53,8 - LTEXT "Direction:",IDC_LDIRECTION,5,61,40,10 - COMBOBOX IDC_DIRECTION,45,61,65,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - LTEXT "Param5:",IDC_LP5,125,61,34,17 - EDITTEXT IDC_P6,161,79,65,12,ES_AUTOHSCROLL - LTEXT "Param6:",IDC_LP6,125,79,35,16 - EDITTEXT IDC_P5,161,61,65,12,ES_AUTOHSCROLL +DEFPUSHBUTTON "OK", IDOK, 170, 124, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 110, 124, 50, 14 +LTEXT "House:", IDC_LHOUSE, 5, 8, 33, 11 +COMBOBOX IDC_HOUSE, 45, 8, 65, 45, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Strength:", IDC_LSTRENGTH, 5, 26, 29, 10 +CONTROL "Slider1", IDC_STRENGTH, "msctls_trackbar32", TBS_BOTH | TBS_NOTICKS | WS_TABSTOP, 45, 26, 70, 11 +LTEXT "State:", IDC_LSTATE, 5, 43, 40, 10 +COMBOBOX IDC_STATE, 45, 43, 65, 90, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Tag:", IDC_LTAG, 6, 105, 63, 14 +COMBOBOX IDC_TAG, 74, 106, 153, 69, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Param1:", IDC_LP1, 5, 80, 37, 17 +EDITTEXT IDC_P1, 45, 80, 65, 12, ES_AUTOHSCROLL +LTEXT "Param2:", IDC_LP2, 125, 8, 30, 16 +LTEXT "Param3:", IDC_LP3, 125, 25, 30, 16 +LTEXT "Param4:", IDC_LP4, 125, 43, 30, 16 +EDITTEXT IDC_P2, 161, 8, 65, 12, ES_AUTOHSCROLL +EDITTEXT IDC_P3, 161, 25, 65, 12, ES_AUTOHSCROLL +EDITTEXT IDC_P4, 161, 43, 65, 12, ES_AUTOHSCROLL +LTEXT "Params are unknown (integers?).", IDC_DESC, 4, 137, 53, 8 +LTEXT "Direction:", IDC_LDIRECTION, 5, 61, 40, 10 +COMBOBOX IDC_DIRECTION, 45, 61, 65, 75, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP +LTEXT "Param5:", IDC_LP5, 125, 61, 34, 17 +EDITTEXT IDC_P6, 161, 79, 65, 12, ES_AUTOHSCROLL +LTEXT "Param6:", IDC_LP6, 125, 79, 35, 16 +EDITTEXT IDC_P5, 161, 61, 65, 12, ES_AUTOHSCROLL END IDD_TERRAINPLACING DIALOG 0, 0, 193, 234 @@ -1557,16 +1557,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Random Tree Placing" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,136,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,136,24,50,14 - LTEXT "Please select the trees that shall be placed",IDC_STATIC,7,7,104,22 - LISTBOX IDC_AVAIL,7,58,73,77,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Available:",IDC_STATIC,7,45,86,11 - LISTBOX IDC_USED,113,58,73,77,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Used:",IDC_STATIC,114,45,74,11 - PUSHBUTTON "<-",IDC_REMOVE,87,75,20,11 - PUSHBUTTON "->",IDC_ADD,87,58,20,11 - GROUPBOX "Preview",IDC_PREVIEW,7,140,179,86 +DEFPUSHBUTTON "OK", IDOK, 136, 7, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 136, 24, 50, 14 +LTEXT "Please select the trees that shall be placed", IDC_STATIC, 7, 7, 104, 22 +LISTBOX IDC_AVAIL, 7, 58, 73, 77, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Available:", IDC_STATIC, 7, 45, 86, 11 +LISTBOX IDC_USED, 113, 58, 73, 77, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Used:", IDC_STATIC, 114, 45, 74, 11 +PUSHBUTTON "<-", IDC_REMOVE, 87, 75, 20, 11 +PUSHBUTTON "->", IDC_ADD, 87, 58, 20, 11 +GROUPBOX "Preview", IDC_PREVIEW, 7, 140, 179, 86 END IDD_SEARCHWAYPOINT DIALOG 0, 0, 186, 95 @@ -1574,10 +1574,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Search Waypoint" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "Search",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 - LTEXT "Waypoints:",IDC_STATIC,7,7,96,12 - LISTBOX IDC_WAYPOINTS,7,21,97,67,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "Search", IDOK, 129, 7, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 129, 24, 50, 14 +LTEXT "Waypoints:", IDC_STATIC, 7, 7, 96, 12 +LISTBOX IDC_WAYPOINTS, 7, 21, 97, 67, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -1590,47 +1590,47 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "AI Trigger Types" FONT 8, "Tahoma" BEGIN - LTEXT "AI Trigger:",IDC_STATIC,7,7,43,11 - COMBOBOX IDC_AITRIGGERTYPE,60,7,236,307,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Name:",IDC_STATIC,7,63,43,11 - EDITTEXT IDC_NAME,60,64,94,13,ES_AUTOHSCROLL - LTEXT "Teamtype #1:",IDC_STATIC,7,80,43,17 - COMBOBOX IDC_TEAMTYPE1,60,81,236,81,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "House:",IDC_STATIC,165,64,50,16 - COMBOBOX IDC_OWNER,220,64,76,207,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Teamtype #2:",IDC_STATIC,7,98,43,17 - COMBOBOX IDC_TEAMTYPE2,60,98,235,81,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Techlevel:",IDC_STATIC,280,206,8,11,NOT WS_VISIBLE - COMBOBOX IDC_FLAG1,288,222,16,56,CBS_DROPDOWN | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Type:",IDC_STATIC,6,44,53,17 - COMBOBOX IDC_FLAG2,60,45,235,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Data:",IDC_DATALABEL,265,204,8,13,NOT WS_VISIBLE - COMBOBOX IDC_DATA,287,222,16,128,CBS_DROPDOWN | CBS_AUTOHSCROLL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP - LTEXT "Weight:",IDC_STATIC,6,150,33,11 - EDITTEXT IDC_FLOAT1,59,148,56,13,ES_AUTOHSCROLL - LTEXT "MinWeight:",IDC_STATIC,6,165,38,11 - EDITTEXT IDC_FLOAT2,59,164,56,13,ES_AUTOHSCROLL - LTEXT "MaxWeight:",IDC_STATIC,125,165,40,11 - EDITTEXT IDC_FLOAT3,180,164,54,13,ES_AUTOHSCROLL - LTEXT "MinDiff:",IDC_STATIC,279,222,8,12,NOT WS_VISIBLE - EDITTEXT IDC_FLAG4,291,222,8,12,ES_AUTOHSCROLL | NOT WS_VISIBLE - LTEXT "Multi-Side:",IDC_STATIC,7,115,33,12 - PUSHBUTTON "Delete",IDC_DELETE,220,23,76,13 - PUSHBUTTON "Add",IDC_ADD,140,23,74,13 - CONTROL "Enabled",IDC_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,23,76,11 - CONTROL "Easy",IDC_EASY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,59,133,42,13 - CONTROL "Medium",IDC_MEDIUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,124,132,42,13 - CONTROL "Hard",IDC_HARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,132,42,13 - CONTROL "Base defense",IDC_BASEDEFENSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,124,116,67,13 - CONTROL "Available in Skirmish",IDC_SKIRMISH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,116,85,14 - COMBOBOX IDC_MULTISIDE,60,116,56,63,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Unittype (X):",IDC_STATIC,171,200,51,10 - COMBOBOX IDC_UNITTYPE,171,212,125,255,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Condition:",IDC_STATIC,8,200,50,11 - COMBOBOX IDC_CONDITION,8,212,95,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_NUMBER,109,212,54,13,ES_AUTOHSCROLL - LTEXT "Number (N):",IDC_STATIC,110,200,56,11 - LTEXT "Additional parameters for the appropiate AI Trigger Types:",IDC_STATIC,6,188,295,12 +LTEXT "AI Trigger:", IDC_STATIC, 7, 7, 43, 11 +COMBOBOX IDC_AITRIGGERTYPE, 60, 7, 236, 307, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Name:", IDC_STATIC, 7, 63, 43, 11 +EDITTEXT IDC_NAME, 60, 64, 94, 13, ES_AUTOHSCROLL +LTEXT "Teamtype #1:", IDC_STATIC, 7, 80, 43, 17 +COMBOBOX IDC_TEAMTYPE1, 60, 81, 236, 81, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "House:", IDC_STATIC, 165, 64, 50, 16 +COMBOBOX IDC_OWNER, 220, 64, 76, 207, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Teamtype #2:", IDC_STATIC, 7, 98, 43, 17 +COMBOBOX IDC_TEAMTYPE2, 60, 98, 235, 81, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +LTEXT "Techlevel:", IDC_STATIC, 280, 206, 8, 11, NOT WS_VISIBLE +COMBOBOX IDC_FLAG1, 288, 222, 16, 56, CBS_DROPDOWN | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +LTEXT "Type:", IDC_STATIC, 6, 44, 53, 17 +COMBOBOX IDC_FLAG2, 60, 45, 235, 71, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +LTEXT "Data:", IDC_DATALABEL, 265, 204, 8, 13, NOT WS_VISIBLE +COMBOBOX IDC_DATA, 287, 222, 16, 128, CBS_DROPDOWN | CBS_AUTOHSCROLL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP +LTEXT "Weight:", IDC_STATIC, 6, 150, 33, 11 +EDITTEXT IDC_FLOAT1, 59, 148, 56, 13, ES_AUTOHSCROLL +LTEXT "MinWeight:", IDC_STATIC, 6, 165, 38, 11 +EDITTEXT IDC_FLOAT2, 59, 164, 56, 13, ES_AUTOHSCROLL +LTEXT "MaxWeight:", IDC_STATIC, 125, 165, 40, 11 +EDITTEXT IDC_FLOAT3, 180, 164, 54, 13, ES_AUTOHSCROLL +LTEXT "MinDiff:", IDC_STATIC, 279, 222, 8, 12, NOT WS_VISIBLE +EDITTEXT IDC_FLAG4, 291, 222, 8, 12, ES_AUTOHSCROLL | NOT WS_VISIBLE +LTEXT "Multi-Side:", IDC_STATIC, 7, 115, 33, 12 +PUSHBUTTON "Delete", IDC_DELETE, 220, 23, 76, 13 +PUSHBUTTON "Add", IDC_ADD, 140, 23, 74, 13 +CONTROL "Enabled", IDC_ENABLED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 60, 23, 76, 11 +CONTROL "Easy", IDC_EASY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 59, 133, 42, 13 +CONTROL "Medium", IDC_MEDIUM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 124, 132, 42, 13 +CONTROL "Hard", IDC_HARD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 199, 132, 42, 13 +CONTROL "Base defense", IDC_BASEDEFENSE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 124, 116, 67, 13 +CONTROL "Available in Skirmish", IDC_SKIRMISH, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 199, 116, 85, 14 +COMBOBOX IDC_MULTISIDE, 60, 116, 56, 63, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Unittype (X):", IDC_STATIC, 171, 200, 51, 10 +COMBOBOX IDC_UNITTYPE, 171, 212, 125, 255, CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +LTEXT "Condition:", IDC_STATIC, 8, 200, 50, 11 +COMBOBOX IDC_CONDITION, 8, 212, 95, 82, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +EDITTEXT IDC_NUMBER, 109, 212, 54, 13, ES_AUTOHSCROLL +LTEXT "Number (N):", IDC_STATIC, 110, 200, 56, 11 +LTEXT "Additional parameters for the appropiate AI Trigger Types:", IDC_STATIC, 6, 188, 295, 12 END #endif @@ -1639,13 +1639,13 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Map Scripts" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "Run",IDOK,244,40,50,14 - PUSHBUTTON "Quit",IDCANCEL,244,57,50,14 - LTEXT "Scripts available:",IDC_STATIC,7,24,109,12 - LISTBOX IDC_SCRIPTS,7,39,230,74,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LTEXT "Report:",IDC_STATIC,7,124,117,15 - EDITTEXT IDC_REPORT,7,145,287,41,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL - LTEXT "For safety reasons, you should save your map before running scripts. Undo is not available.",IDC_STATIC,7,7,287,17 +DEFPUSHBUTTON "Run", IDOK, 244, 40, 50, 14 +PUSHBUTTON "Quit", IDCANCEL, 244, 57, 50, 14 +LTEXT "Scripts available:", IDC_STATIC, 7, 24, 109, 12 +LISTBOX IDC_SCRIPTS, 7, 39, 230, 74, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +LTEXT "Report:", IDC_STATIC, 7, 124, 117, 15 +EDITTEXT IDC_REPORT, 7, 145, 287, 41, ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL +LTEXT "For safety reasons, you should save your map before running scripts. Undo is not available.", IDC_STATIC, 7, 7, 287, 17 END IDD_COMBO_UINPUT DIALOG 0, 0, 238, 63 @@ -1653,10 +1653,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Please select" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,181,42,50,14 - PUSHBUTTON "Cancel",IDCANCEL,124,42,50,14,NOT WS_VISIBLE - LTEXT "CAPTION",IDC_CAPTION,7,7,224,12 - COMBOBOX IDC_COMBO1,7,23,224,160,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +DEFPUSHBUTTON "OK", IDOK, 181, 42, 50, 14 +PUSHBUTTON "Cancel", IDCANCEL, 124, 42, 50, 14, NOT WS_VISIBLE +LTEXT "CAPTION", IDC_CAPTION, 7, 7, 224, 12 +COMBOBOX IDC_COMBO1, 7, 23, 224, 160, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END @@ -1668,357 +1668,357 @@ END #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN - IDD_NEWRA2HOUSE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 45 - END +IDD_NEWRA2HOUSE, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 179 +TOPMARGIN, 7 +BOTTOMMARGIN, 45 +END - "IDD_SAVEOPTIONS$(TS_MODE)", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 226 - TOPMARGIN, 7 - BOTTOMMARGIN, 118 - END +"IDD_SAVEOPTIONS$(TS_MODE)", DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 226 +TOPMARGIN, 7 +BOTTOMMARGIN, 118 +END - IDD_MULTISAVEOPT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 274 - TOPMARGIN, 7 - BOTTOMMARGIN, 98 - END +IDD_MULTISAVEOPT, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 274 +TOPMARGIN, 7 +BOTTOMMARGIN, 98 +END - IDD_MMXOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 261 - TOPMARGIN, 7 - BOTTOMMARGIN, 165 - END +IDD_MMXOPTIONS, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 261 +TOPMARGIN, 7 +BOTTOMMARGIN, 165 +END - "IDD_SAVEOPTIONS$(RA2_MODE)", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 226 - TOPMARGIN, 7 - BOTTOMMARGIN, 179 - END +"IDD_SAVEOPTIONS$(RA2_MODE)", DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 226 +TOPMARGIN, 7 +BOTTOMMARGIN, 179 +END - IDD_CHANGESIZE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 205 - TOPMARGIN, 7 - BOTTOMMARGIN, 187 - END +IDD_CHANGESIZE, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 205 +TOPMARGIN, 7 +BOTTOMMARGIN, 187 +END - IDD_AITRIGGERADD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 215 - TOPMARGIN, 7 - BOTTOMMARGIN, 90 - END +IDD_AITRIGGERADD, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 215 +TOPMARGIN, 7 +BOTTOMMARGIN, 90 +END - IDD_MYOPENDIALOG, DIALOG - BEGIN - END +IDD_MYOPENDIALOG, DIALOG +BEGIN +END - IDD_TIP, DIALOG - BEGIN - RIGHTMARGIN, 274 - END +IDD_TIP, DIALOG +BEGIN +RIGHTMARGIN, 274 +END - IDD_FINALSUN_DIALOG, DIALOG - BEGIN - END +IDD_FINALSUN_DIALOG, DIALOG +BEGIN +END - "IDD_TSOPTIONS$(RA2_MODE)", DIALOG - BEGIN - BOTTOMMARGIN, 165 - END +"IDD_TSOPTIONS$(RA2_MODE)", DIALOG +BEGIN +BOTTOMMARGIN, 165 +END - IDD_ALL, DIALOG - BEGIN - END +IDD_ALL, DIALOG +BEGIN +END - IDD_MAP, DIALOG - BEGIN - END +IDD_MAP, DIALOG +BEGIN +END - IDD_INPUTBOX, DIALOG - BEGIN - END +IDD_INPUTBOX, DIALOG +BEGIN +END - IDD_IMPORTINI, DIALOG - BEGIN - END +IDD_IMPORTINI, DIALOG +BEGIN +END - IDD_LIGHTING, DIALOG - BEGIN - END +IDD_LIGHTING, DIALOG +BEGIN +END - "IDD_INFO$(TS_MODE)", DIALOG - BEGIN - RIGHTMARGIN, 343 - BOTTOMMARGIN, 243 - END +"IDD_INFO$(TS_MODE)", DIALOG +BEGIN +RIGHTMARGIN, 343 +BOTTOMMARGIN, 243 +END - IDD_SPECIALFLAGS, DIALOG - BEGIN - END +IDD_SPECIALFLAGS, DIALOG +BEGIN +END - IDD_INFANTRY, DIALOG - BEGIN - END +IDD_INFANTRY, DIALOG +BEGIN +END - IDD_HOUSES, DIALOG - BEGIN - END +IDD_HOUSES, DIALOG +BEGIN +END - IDD_AIRCRAFT, DIALOG - BEGIN - END +IDD_AIRCRAFT, DIALOG +BEGIN +END - IDD_BUILDING, DIALOG - BEGIN - END +IDD_BUILDING, DIALOG +BEGIN +END - "IDD_LOADING$(TS_MODE)", DIALOG - BEGIN - BOTTOMMARGIN, 159 - END +"IDD_LOADING$(TS_MODE)", DIALOG +BEGIN +BOTTOMMARGIN, 159 +END - IDD_WAYPOINT, DIALOG - BEGIN - END +IDD_WAYPOINT, DIALOG +BEGIN +END - IDD_CELLTAG, DIALOG - BEGIN - END +IDD_CELLTAG, DIALOG +BEGIN +END - "IDD_TEAMTYPES$(TS_MODE)", DIALOG - BEGIN - END +"IDD_TEAMTYPES$(TS_MODE)", DIALOG +BEGIN +END - IDD_TASKFORCES, DIALOG - BEGIN - END +IDD_TASKFORCES, DIALOG +BEGIN +END - IDD_TAGS, DIALOG - BEGIN - END +IDD_TAGS, DIALOG +BEGIN +END - IDD_TRIGGERS, DIALOG - BEGIN - END +IDD_TRIGGERS, DIALOG +BEGIN +END - "IDD_AITRIGGERTYPES$(RA2_MODE)", DIALOG - BEGIN - END +"IDD_AITRIGGERTYPES$(RA2_MODE)", DIALOG +BEGIN +END - IDD_NEWMAP, DIALOG - BEGIN - END +IDD_NEWMAP, DIALOG +BEGIN +END - IDD_BASIC, DIALOG - BEGIN - END +IDD_BASIC, DIALOG +BEGIN +END - IDD_SINGLEPLAYER, DIALOG - BEGIN - END +IDD_SINGLEPLAYER, DIALOG +BEGIN +END - IDD_MAPVALIDATOR, DIALOG - BEGIN - RIGHTMARGIN, 433 - VERTGUIDE, 6 - VERTGUIDE, 372 - BOTTOMMARGIN, 219 - HORZGUIDE, 165 - END +IDD_MAPVALIDATOR, DIALOG +BEGIN +RIGHTMARGIN, 433 +VERTGUIDE, 6 +VERTGUIDE, 372 +BOTTOMMARGIN, 219 +HORZGUIDE, 165 +END - IDD_SCRIPTTYPES, DIALOG - BEGIN - END +IDD_SCRIPTTYPES, DIALOG +BEGIN +END - IDD_TERRAINBAR, DIALOG - BEGIN - END +IDD_TERRAINBAR, DIALOG +BEGIN +END - IDD_TOOLSETTINGS, DIALOG - BEGIN - END +IDD_TOOLSETTINGS, DIALOG +BEGIN +END - IDD_SHUTDOWN, DIALOG - BEGIN - END +IDD_SHUTDOWN, DIALOG +BEGIN +END - IDD_DYNAMICLOAD, DIALOG - BEGIN - END +IDD_DYNAMICLOAD, DIALOG +BEGIN +END - "IDD_SAVING$(TS_MODE)", DIALOG - BEGIN - END +"IDD_SAVING$(TS_MODE)", DIALOG +BEGIN +END - IDD_TRIGGEREDITOR, DIALOG - BEGIN - RIGHTMARGIN, 384 - VERTGUIDE, 228 - BOTTOMMARGIN, 258 - END +IDD_TRIGGEREDITOR, DIALOG +BEGIN +RIGHTMARGIN, 384 +VERTGUIDE, 228 +BOTTOMMARGIN, 258 +END - IDD_TRIGGEROPTIONS, DIALOG - BEGIN - VERTGUIDE, 4 - VERTGUIDE, 356 - END +IDD_TRIGGEROPTIONS, DIALOG +BEGIN +VERTGUIDE, 4 +VERTGUIDE, 356 +END - IDD_TRIGGEREVENTS, DIALOG - BEGIN - RIGHTMARGIN, 361 - VERTGUIDE, 6 - VERTGUIDE, 14 - VERTGUIDE, 72 - VERTGUIDE, 173 - VERTGUIDE, 185 - VERTGUIDE, 222 - VERTGUIDE, 233 - VERTGUIDE, 294 - VERTGUIDE, 300 - VERTGUIDE, 354 - HORZGUIDE, 6 - HORZGUIDE, 79 - END +IDD_TRIGGEREVENTS, DIALOG +BEGIN +RIGHTMARGIN, 361 +VERTGUIDE, 6 +VERTGUIDE, 14 +VERTGUIDE, 72 +VERTGUIDE, 173 +VERTGUIDE, 185 +VERTGUIDE, 222 +VERTGUIDE, 233 +VERTGUIDE, 294 +VERTGUIDE, 300 +VERTGUIDE, 354 +HORZGUIDE, 6 +HORZGUIDE, 79 +END - IDD_TRIGGERACTIONS, DIALOG - BEGIN - RIGHTMARGIN, 360 - VERTGUIDE, 6 - VERTGUIDE, 14 - VERTGUIDE, 72 - VERTGUIDE, 174 - VERTGUIDE, 186 - VERTGUIDE, 221 - VERTGUIDE, 233 - VERTGUIDE, 293 - VERTGUIDE, 301 - VERTGUIDE, 354 - BOTTOMMARGIN, 194 - HORZGUIDE, 6 - HORZGUIDE, 74 - HORZGUIDE, 79 - END +IDD_TRIGGERACTIONS, DIALOG +BEGIN +RIGHTMARGIN, 360 +VERTGUIDE, 6 +VERTGUIDE, 14 +VERTGUIDE, 72 +VERTGUIDE, 174 +VERTGUIDE, 186 +VERTGUIDE, 221 +VERTGUIDE, 233 +VERTGUIDE, 293 +VERTGUIDE, 301 +VERTGUIDE, 354 +BOTTOMMARGIN, 194 +HORZGUIDE, 6 +HORZGUIDE, 74 +HORZGUIDE, 79 +END - "IDD_TSOPTIONS$(TS_MODE)", DIALOG - BEGIN - BOTTOMMARGIN, 165 - END +"IDD_TSOPTIONS$(TS_MODE)", DIALOG +BEGIN +BOTTOMMARGIN, 165 +END - "IDD_INFO$(RA2_MODE)", DIALOG - BEGIN - RIGHTMARGIN, 342 - TOPMARGIN, 8 - BOTTOMMARGIN, 242 - END +"IDD_INFO$(RA2_MODE)", DIALOG +BEGIN +RIGHTMARGIN, 342 +TOPMARGIN, 8 +BOTTOMMARGIN, 242 +END - "IDD_LOADING$(RA2_MODE)", DIALOG - BEGIN - BOTTOMMARGIN, 159 - END +"IDD_LOADING$(RA2_MODE)", DIALOG +BEGIN +BOTTOMMARGIN, 159 +END - "IDD_TEAMTYPES$(RA2_MODE)", DIALOG - BEGIN - END +"IDD_TEAMTYPES$(RA2_MODE)", DIALOG +BEGIN +END - IDD_NEWMAPTYPE, DIALOG - BEGIN - END +IDD_NEWMAPTYPE, DIALOG +BEGIN +END - "IDD_NEWMAPCREATE$(TS_MODE)", DIALOG - BEGIN - END +"IDD_NEWMAPCREATE$(TS_MODE)", DIALOG +BEGIN +END - IDD_NEWMAPSPOPTIONS, DIALOG - BEGIN - END +IDD_NEWMAPSPOPTIONS, DIALOG +BEGIN +END - IDD_NEWMAPCREATENEW, DIALOG - BEGIN - END +IDD_NEWMAPCREATENEW, DIALOG +BEGIN +END - IDD_NEWMAPIMPORT, DIALOG - BEGIN - END +IDD_NEWMAPIMPORT, DIALOG +BEGIN +END - IDD_MAPLOAD, DIALOG - BEGIN - END +IDD_MAPLOAD, DIALOG +BEGIN +END - IDD_NEWMAPBITMAP, DIALOG - BEGIN - END +IDD_NEWMAPBITMAP, DIALOG +BEGIN +END - IDD_PROGRESS, DIALOG - BEGIN - END +IDD_PROGRESS, DIALOG +BEGIN +END - IDD_AUTOUPDATE, DIALOG - BEGIN - END +IDD_AUTOUPDATE, DIALOG +BEGIN +END - "IDD_NEWMAPCREATE$(RA2_MODE)", DIALOG - BEGIN - END +"IDD_NEWMAPCREATE$(RA2_MODE)", DIALOG +BEGIN +END - "IDD_SAVING$(RA2_MODE)", DIALOG - BEGIN - END +"IDD_SAVING$(RA2_MODE)", DIALOG +BEGIN +END - IDD_UNIT, DIALOG - BEGIN - END +IDD_UNIT, DIALOG +BEGIN +END - IDD_TERRAINPLACING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 186 - TOPMARGIN, 7 - BOTTOMMARGIN, 226 - END +IDD_TERRAINPLACING, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 186 +TOPMARGIN, 7 +BOTTOMMARGIN, 226 +END - IDD_SEARCHWAYPOINT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END +IDD_SEARCHWAYPOINT, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 179 +TOPMARGIN, 7 +BOTTOMMARGIN, 88 +END - "IDD_AITRIGGERTYPES$(TS_MODE)", DIALOG - BEGIN - END +"IDD_AITRIGGERTYPES$(TS_MODE)", DIALOG +BEGIN +END - IDD_USERSCRIPTS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 294 - TOPMARGIN, 7 - BOTTOMMARGIN, 186 - END +IDD_USERSCRIPTS, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 294 +TOPMARGIN, 7 +BOTTOMMARGIN, 186 +END - IDD_COMBO_UINPUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 231 - TOPMARGIN, 7 - BOTTOMMARGIN, 56 - END +IDD_COMBO_UINPUT, DIALOG +BEGIN +LEFTMARGIN, 7 +RIGHTMARGIN, 231 +TOPMARGIN, 7 +BOTTOMMARGIN, 56 +END END #endif // APSTUDIO_INVOKED @@ -2030,379 +2030,379 @@ END IDD_MMXOPTIONS DLGINIT BEGIN - IDC_MINPLAYERS, 0x403, 2, 0 -0x0032, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0033, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0034, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0035, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0036, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0037, - IDC_MINPLAYERS, 0x403, 2, 0 -0x0038, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0032, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0033, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0034, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0035, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0036, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0037, - IDC_MAXPLAYERS, 0x403, 2, 0 -0x0038, - 0 +IDC_MINPLAYERS, 0x403, 2, 0 +0x0032, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0033, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0034, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0035, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0036, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0037, +IDC_MINPLAYERS, 0x403, 2, 0 +0x0038, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0032, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0033, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0034, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0035, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0036, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0037, +IDC_MAXPLAYERS, 0x403, 2, 0 +0x0038, +0 END IDD_MAP DLGINIT BEGIN - IDC_THEATER, 0x403, 5, 0 -0x4e53, 0x574f, "\000" - IDC_THEATER, 0x403, 10, 0 -0x4554, 0x504d, 0x5245, 0x5441, 0x0045, - 0 +IDC_THEATER, 0x403, 5, 0 +0x4e53, 0x574f, "\000" +IDC_THEATER, 0x403, 10, 0 +0x4554, 0x504d, 0x5245, 0x5441, 0x0045, +0 END IDD_SPECIALFLAGS DLGINIT BEGIN - IDC_TIBERIUMGROWS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIBERIUMGROWS, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TIBERIUMSPREADS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIBERIUMSPREADS, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TIBERIUMEXPLOSIVE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIBERIUMEXPLOSIVE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_DESTROYABLEBRIDGES, 0x403, 4, 0 -0x6579, 0x0073, - IDC_DESTROYABLEBRIDGES, 0x403, 3, 0 -0x6f6e, "\000" - IDC_MCVDEPLOY, 0x403, 4, 0 -0x6579, 0x0073, - IDC_MCVDEPLOY, 0x403, 3, 0 -0x6f6e, "\000" - IDC_INITIALVETERAN, 0x403, 4, 0 -0x6579, 0x0073, - IDC_INITIALVETERAN, 0x403, 3, 0 -0x6f6e, "\000" - IDC_FIXEDALLIANCE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_FIXEDALLIANCE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_HARVESTERIMMUNE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_HARVESTERIMMUNE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_FOGOFWAR, 0x403, 4, 0 -0x6579, 0x0073, - IDC_FOGOFWAR, 0x403, 3, 0 -0x6f6e, "\000" - IDC_INERT, 0x403, 4, 0 -0x6579, 0x0073, - IDC_INERT, 0x403, 3, 0 -0x6f6e, "\000" - IDC_IONSTORMS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_IONSTORMS, 0x403, 3, 0 -0x6f6e, "\000" - IDC_METEORITES, 0x403, 4, 0 -0x6579, 0x0073, - IDC_METEORITES, 0x403, 3, 0 -0x6f6e, "\000" - IDC_VISCEROIDS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_VISCEROIDS, 0x403, 3, 0 -0x6f6e, "\000" - 0 +IDC_TIBERIUMGROWS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIBERIUMGROWS, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TIBERIUMSPREADS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIBERIUMSPREADS, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TIBERIUMEXPLOSIVE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIBERIUMEXPLOSIVE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_DESTROYABLEBRIDGES, 0x403, 4, 0 +0x6579, 0x0073, +IDC_DESTROYABLEBRIDGES, 0x403, 3, 0 +0x6f6e, "\000" +IDC_MCVDEPLOY, 0x403, 4, 0 +0x6579, 0x0073, +IDC_MCVDEPLOY, 0x403, 3, 0 +0x6f6e, "\000" +IDC_INITIALVETERAN, 0x403, 4, 0 +0x6579, 0x0073, +IDC_INITIALVETERAN, 0x403, 3, 0 +0x6f6e, "\000" +IDC_FIXEDALLIANCE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_FIXEDALLIANCE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_HARVESTERIMMUNE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_HARVESTERIMMUNE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_FOGOFWAR, 0x403, 4, 0 +0x6579, 0x0073, +IDC_FOGOFWAR, 0x403, 3, 0 +0x6f6e, "\000" +IDC_INERT, 0x403, 4, 0 +0x6579, 0x0073, +IDC_INERT, 0x403, 3, 0 +0x6f6e, "\000" +IDC_IONSTORMS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_IONSTORMS, 0x403, 3, 0 +0x6f6e, "\000" +IDC_METEORITES, 0x403, 4, 0 +0x6579, 0x0073, +IDC_METEORITES, 0x403, 3, 0 +0x6f6e, "\000" +IDC_VISCEROIDS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_VISCEROIDS, 0x403, 3, 0 +0x6f6e, "\000" +0 END IDD_INFANTRY DLGINIT BEGIN - IDC_STATE, 0x403, 6, 0 -0x6c53, 0x6565, 0x0070, - IDC_STATE, 0x403, 9, 0 -0x6148, 0x6d72, 0x656c, 0x7373, "\000" - IDC_STATE, 0x403, 7, 0 -0x7453, 0x6369, 0x796b, "\000" - IDC_STATE, 0x403, 7, 0 -0x7441, 0x6174, 0x6b63, "\000" - IDC_STATE, 0x403, 5, 0 -0x6f4d, 0x6576, "\000" - IDC_STATE, 0x403, 7, 0 -0x6150, 0x7274, 0x6c6f, "\000" - IDC_STATE, 0x403, 6, 0 -0x4d51, 0x766f, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6552, 0x7274, 0x6165, 0x0074, - IDC_STATE, 0x403, 6, 0 -0x7547, 0x7261, 0x0064, - IDC_STATE, 0x403, 6, 0 -0x6e45, 0x6574, 0x0072, - IDC_STATE, 0x403, 8, 0 -0x6143, 0x7470, 0x7275, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6148, 0x7672, 0x7365, 0x0074, - IDC_STATE, 0x403, 11, 0 -0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" - IDC_STATE, 0x403, 17, 0 -0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7453, 0x706f, "\000" - IDC_STATE, 0x403, 17, 0 -0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7548, 0x746e, "\000" - IDC_STATE, 0x403, 7, 0 -0x6e55, 0x6f6c, 0x6461, "\000" - IDC_STATE, 0x403, 9, 0 -0x6153, 0x6f62, 0x6174, 0x6567, "\000" - IDC_STATE, 0x403, 13, 0 -0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" - IDC_STATE, 0x403, 8, 0 -0x6553, 0x6c6c, 0x6e69, 0x0067, - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6170, 0x7269, "\000" - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6373, 0x6575, "\000" - IDC_STATE, 0x403, 8, 0 -0x694d, 0x7373, 0x6c69, 0x0065, - IDC_STATE, 0x403, 5, 0 -0x704f, 0x6e65, "\000" - IDC_TAG, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_DIRECTION, 0x403, 2, 0 -0x0030, - IDC_DIRECTION, 0x403, 3, 0 -0x3233, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3436, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3639, "\000" - IDC_DIRECTION, 0x403, 4, 0 -0x3231, 0x0038, - IDC_DIRECTION, 0x403, 4, 0 -0x3631, 0x0030, - IDC_DIRECTION, 0x403, 4, 0 -0x3931, 0x0032, - IDC_DIRECTION, 0x403, 4, 0 -0x3232, 0x0034, - 0 +IDC_STATE, 0x403, 6, 0 +0x6c53, 0x6565, 0x0070, +IDC_STATE, 0x403, 9, 0 +0x6148, 0x6d72, 0x656c, 0x7373, "\000" +IDC_STATE, 0x403, 7, 0 +0x7453, 0x6369, 0x796b, "\000" +IDC_STATE, 0x403, 7, 0 +0x7441, 0x6174, 0x6b63, "\000" +IDC_STATE, 0x403, 5, 0 +0x6f4d, 0x6576, "\000" +IDC_STATE, 0x403, 7, 0 +0x6150, 0x7274, 0x6c6f, "\000" +IDC_STATE, 0x403, 6, 0 +0x4d51, 0x766f, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6552, 0x7274, 0x6165, 0x0074, +IDC_STATE, 0x403, 6, 0 +0x7547, 0x7261, 0x0064, +IDC_STATE, 0x403, 6, 0 +0x6e45, 0x6574, 0x0072, +IDC_STATE, 0x403, 8, 0 +0x6143, 0x7470, 0x7275, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6148, 0x7672, 0x7365, 0x0074, +IDC_STATE, 0x403, 11, 0 +0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" +IDC_STATE, 0x403, 17, 0 +0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7453, 0x706f, "\000" +IDC_STATE, 0x403, 17, 0 +0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7548, 0x746e, "\000" +IDC_STATE, 0x403, 7, 0 +0x6e55, 0x6f6c, 0x6461, "\000" +IDC_STATE, 0x403, 9, 0 +0x6153, 0x6f62, 0x6174, 0x6567, "\000" +IDC_STATE, 0x403, 13, 0 +0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" +IDC_STATE, 0x403, 8, 0 +0x6553, 0x6c6c, 0x6e69, 0x0067, +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6170, 0x7269, "\000" +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6373, 0x6575, "\000" +IDC_STATE, 0x403, 8, 0 +0x694d, 0x7373, 0x6c69, 0x0065, +IDC_STATE, 0x403, 5, 0 +0x704f, 0x6e65, "\000" +IDC_TAG, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_DIRECTION, 0x403, 2, 0 +0x0030, +IDC_DIRECTION, 0x403, 3, 0 +0x3233, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3436, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3639, "\000" +IDC_DIRECTION, 0x403, 4, 0 +0x3231, 0x0038, +IDC_DIRECTION, 0x403, 4, 0 +0x3631, 0x0030, +IDC_DIRECTION, 0x403, 4, 0 +0x3931, 0x0032, +IDC_DIRECTION, 0x403, 4, 0 +0x3232, 0x0034, +0 END IDD_HOUSES DLGINIT BEGIN - IDC_IQ, 0x403, 2, 0 -0x0030, - IDC_IQ, 0x403, 2, 0 -0x0031, - IDC_IQ, 0x403, 2, 0 -0x0032, - IDC_IQ, 0x403, 2, 0 -0x0033, - IDC_IQ, 0x403, 2, 0 -0x0034, - IDC_IQ, 0x403, 2, 0 -0x0035, - IDC_EDGE, 0x403, 5, 0 -0x6557, 0x7473, "\000" - IDC_EDGE, 0x403, 5, 0 -0x6145, 0x7473, "\000" - IDC_EDGE, 0x403, 6, 0 -0x6f4e, 0x7472, 0x0068, - IDC_EDGE, 0x403, 6, 0 -0x6f53, 0x7475, 0x0068, - IDC_SIDE, 0x403, 4, 0 -0x4447, 0x0049, - IDC_SIDE, 0x403, 4, 0 -0x6f4e, 0x0064, - IDC_SIDE, 0x403, 9, 0 -0x6943, 0x6976, 0x696c, 0x6e61, "\000" - IDC_SIDE, 0x403, 7, 0 -0x754d, 0x6174, 0x746e, "\000" - IDC_ACTSLIKE, 0x403, 6, 0 -0x2030, 0x4447, 0x0049, - IDC_ACTSLIKE, 0x403, 6, 0 -0x2031, 0x6f4e, 0x0064, - IDC_NODECOUNT, 0x403, 2, 0 -0x0030, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0030, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0031, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0032, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0033, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0034, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0035, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0036, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0037, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0038, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0039, - IDC_TECHLEVEL, 0x403, 3, 0 -0x3031, "\000" - IDC_PERCENTBUILT, 0x403, 2, 0 -0x0030, - IDC_PERCENTBUILT, 0x403, 3, 0 -0x3035, "\000" - IDC_PERCENTBUILT, 0x403, 4, 0 -0x3031, 0x0030, - IDC_PLAYERCONTROL, 0x403, 3, 0 -0x6f6e, "\000" - IDC_PLAYERCONTROL, 0x403, 4, 0 -0x6579, 0x0073, - 0 +IDC_IQ, 0x403, 2, 0 +0x0030, +IDC_IQ, 0x403, 2, 0 +0x0031, +IDC_IQ, 0x403, 2, 0 +0x0032, +IDC_IQ, 0x403, 2, 0 +0x0033, +IDC_IQ, 0x403, 2, 0 +0x0034, +IDC_IQ, 0x403, 2, 0 +0x0035, +IDC_EDGE, 0x403, 5, 0 +0x6557, 0x7473, "\000" +IDC_EDGE, 0x403, 5, 0 +0x6145, 0x7473, "\000" +IDC_EDGE, 0x403, 6, 0 +0x6f4e, 0x7472, 0x0068, +IDC_EDGE, 0x403, 6, 0 +0x6f53, 0x7475, 0x0068, +IDC_SIDE, 0x403, 4, 0 +0x4447, 0x0049, +IDC_SIDE, 0x403, 4, 0 +0x6f4e, 0x0064, +IDC_SIDE, 0x403, 9, 0 +0x6943, 0x6976, 0x696c, 0x6e61, "\000" +IDC_SIDE, 0x403, 7, 0 +0x754d, 0x6174, 0x746e, "\000" +IDC_ACTSLIKE, 0x403, 6, 0 +0x2030, 0x4447, 0x0049, +IDC_ACTSLIKE, 0x403, 6, 0 +0x2031, 0x6f4e, 0x0064, +IDC_NODECOUNT, 0x403, 2, 0 +0x0030, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0030, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0031, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0032, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0033, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0034, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0035, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0036, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0037, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0038, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0039, +IDC_TECHLEVEL, 0x403, 3, 0 +0x3031, "\000" +IDC_PERCENTBUILT, 0x403, 2, 0 +0x0030, +IDC_PERCENTBUILT, 0x403, 3, 0 +0x3035, "\000" +IDC_PERCENTBUILT, 0x403, 4, 0 +0x3031, 0x0030, +IDC_PLAYERCONTROL, 0x403, 3, 0 +0x6f6e, "\000" +IDC_PLAYERCONTROL, 0x403, 4, 0 +0x6579, 0x0073, +0 END IDD_AIRCRAFT DLGINIT BEGIN - IDC_STATE, 0x403, 6, 0 -0x6c53, 0x6565, 0x0070, - IDC_STATE, 0x403, 9, 0 -0x6148, 0x6d72, 0x656c, 0x7373, "\000" - IDC_STATE, 0x403, 7, 0 -0x7453, 0x6369, 0x796b, "\000" - IDC_STATE, 0x403, 7, 0 -0x7441, 0x6174, 0x6b63, "\000" - IDC_STATE, 0x403, 5, 0 -0x6f4d, 0x6576, "\000" - IDC_STATE, 0x403, 7, 0 -0x6150, 0x7274, 0x6c6f, "\000" - IDC_STATE, 0x403, 6, 0 -0x4d51, 0x766f, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6552, 0x7274, 0x6165, 0x0074, - IDC_STATE, 0x403, 6, 0 -0x7547, 0x7261, 0x0064, - IDC_STATE, 0x403, 6, 0 -0x6e45, 0x6574, 0x0072, - IDC_STATE, 0x403, 8, 0 -0x6143, 0x7470, 0x7275, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6148, 0x7672, 0x7365, 0x0074, - IDC_STATE, 0x403, 11, 0 -0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" - IDC_STATE, 0x403, 17, 0 -0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7453, 0x706f, "\000" - IDC_STATE, 0x403, 17, 0 -0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7548, 0x746e, "\000" - IDC_STATE, 0x403, 7, 0 -0x6e55, 0x6f6c, 0x6461, "\000" - IDC_STATE, 0x403, 9, 0 -0x6153, 0x6f62, 0x6174, 0x6567, "\000" - IDC_STATE, 0x403, 13, 0 -0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" - IDC_STATE, 0x403, 8, 0 -0x6553, 0x6c6c, 0x6e69, 0x0067, - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6170, 0x7269, "\000" - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6373, 0x6575, "\000" - IDC_STATE, 0x403, 8, 0 -0x694d, 0x7373, 0x6c69, 0x0065, - IDC_STATE, 0x403, 5, 0 -0x704f, 0x6e65, "\000" - IDC_TAG, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_DIRECTION, 0x403, 2, 0 -0x0030, - IDC_DIRECTION, 0x403, 3, 0 -0x3233, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3436, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3639, "\000" - IDC_DIRECTION, 0x403, 4, 0 -0x3231, 0x0038, - IDC_DIRECTION, 0x403, 4, 0 -0x3631, 0x0030, - IDC_DIRECTION, 0x403, 4, 0 -0x3931, 0x0032, - IDC_DIRECTION, 0x403, 4, 0 -0x3232, 0x0034, - 0 +IDC_STATE, 0x403, 6, 0 +0x6c53, 0x6565, 0x0070, +IDC_STATE, 0x403, 9, 0 +0x6148, 0x6d72, 0x656c, 0x7373, "\000" +IDC_STATE, 0x403, 7, 0 +0x7453, 0x6369, 0x796b, "\000" +IDC_STATE, 0x403, 7, 0 +0x7441, 0x6174, 0x6b63, "\000" +IDC_STATE, 0x403, 5, 0 +0x6f4d, 0x6576, "\000" +IDC_STATE, 0x403, 7, 0 +0x6150, 0x7274, 0x6c6f, "\000" +IDC_STATE, 0x403, 6, 0 +0x4d51, 0x766f, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6552, 0x7274, 0x6165, 0x0074, +IDC_STATE, 0x403, 6, 0 +0x7547, 0x7261, 0x0064, +IDC_STATE, 0x403, 6, 0 +0x6e45, 0x6574, 0x0072, +IDC_STATE, 0x403, 8, 0 +0x6143, 0x7470, 0x7275, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6148, 0x7672, 0x7365, 0x0074, +IDC_STATE, 0x403, 11, 0 +0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" +IDC_STATE, 0x403, 17, 0 +0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7453, 0x706f, "\000" +IDC_STATE, 0x403, 17, 0 +0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7548, 0x746e, "\000" +IDC_STATE, 0x403, 7, 0 +0x6e55, 0x6f6c, 0x6461, "\000" +IDC_STATE, 0x403, 9, 0 +0x6153, 0x6f62, 0x6174, 0x6567, "\000" +IDC_STATE, 0x403, 13, 0 +0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" +IDC_STATE, 0x403, 8, 0 +0x6553, 0x6c6c, 0x6e69, 0x0067, +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6170, 0x7269, "\000" +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6373, 0x6575, "\000" +IDC_STATE, 0x403, 8, 0 +0x694d, 0x7373, 0x6c69, 0x0065, +IDC_STATE, 0x403, 5, 0 +0x704f, 0x6e65, "\000" +IDC_TAG, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_DIRECTION, 0x403, 2, 0 +0x0030, +IDC_DIRECTION, 0x403, 3, 0 +0x3233, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3436, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3639, "\000" +IDC_DIRECTION, 0x403, 4, 0 +0x3231, 0x0038, +IDC_DIRECTION, 0x403, 4, 0 +0x3631, 0x0030, +IDC_DIRECTION, 0x403, 4, 0 +0x3931, 0x0032, +IDC_DIRECTION, 0x403, 4, 0 +0x3232, 0x0034, +0 END IDD_BUILDING DLGINIT BEGIN - IDC_TAG, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_DIRECTION, 0x403, 2, 0 -0x0030, - IDC_DIRECTION, 0x403, 3, 0 -0x3233, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3436, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3639, "\000" - IDC_DIRECTION, 0x403, 4, 0 -0x3231, 0x0038, - IDC_DIRECTION, 0x403, 4, 0 -0x3631, 0x0030, - IDC_DIRECTION, 0x403, 4, 0 -0x3931, 0x0032, - IDC_DIRECTION, 0x403, 4, 0 -0x3232, 0x0034, - IDC_P6, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_P7, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_P8, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_P3, 0x403, 2, 0 -0x0030, - IDC_P3, 0x403, 2, 0 -0x0031, - IDC_P2, 0x403, 2, 0 -0x0030, - IDC_P2, 0x403, 2, 0 -0x0031, - IDC_P4, 0x403, 2, 0 -0x0030, - IDC_P4, 0x403, 2, 0 -0x0031, - IDC_P4, 0x403, 2, 0 -0x0032, - IDC_P4, 0x403, 2, 0 -0x0033, - IDC_P5, 0x403, 17, 0 -0x2030, 0x202d, 0x6f4e, 0x7320, 0x6f70, 0x6c74, 0x6769, 0x7468, "\000" - IDC_P5, 0x403, 22, 0 -0x2031, 0x202d, 0x7552, 0x656c, 0x2e73, 0x6e49, 0x2069, 0x6573, 0x7474, -0x6e69, 0x0067, - IDC_P5, 0x403, 23, 0 -0x2032, 0x202d, 0x6943, 0x6372, 0x656c, 0x2f20, 0x4420, 0x7269, 0x6365, -0x6974, 0x6e6f, "\000" - IDC_P9, 0x403, 2, 0 -0x0030, - IDC_P9, 0x403, 2, 0 -0x0031, - IDC_P10, 0x403, 2, 0 -0x0030, - IDC_P10, 0x403, 2, 0 -0x0031, - 0 +IDC_TAG, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_DIRECTION, 0x403, 2, 0 +0x0030, +IDC_DIRECTION, 0x403, 3, 0 +0x3233, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3436, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3639, "\000" +IDC_DIRECTION, 0x403, 4, 0 +0x3231, 0x0038, +IDC_DIRECTION, 0x403, 4, 0 +0x3631, 0x0030, +IDC_DIRECTION, 0x403, 4, 0 +0x3931, 0x0032, +IDC_DIRECTION, 0x403, 4, 0 +0x3232, 0x0034, +IDC_P6, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_P7, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_P8, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_P3, 0x403, 2, 0 +0x0030, +IDC_P3, 0x403, 2, 0 +0x0031, +IDC_P2, 0x403, 2, 0 +0x0030, +IDC_P2, 0x403, 2, 0 +0x0031, +IDC_P4, 0x403, 2, 0 +0x0030, +IDC_P4, 0x403, 2, 0 +0x0031, +IDC_P4, 0x403, 2, 0 +0x0032, +IDC_P4, 0x403, 2, 0 +0x0033, +IDC_P5, 0x403, 17, 0 +0x2030, 0x202d, 0x6f4e, 0x7320, 0x6f70, 0x6c74, 0x6769, 0x7468, "\000" +IDC_P5, 0x403, 22, 0 +0x2031, 0x202d, 0x7552, 0x656c, 0x2e73, 0x6e49, 0x2069, 0x6573, 0x7474, +0x6e69, 0x0067, +IDC_P5, 0x403, 23, 0 +0x2032, 0x202d, 0x6943, 0x6372, 0x656c, 0x2f20, 0x4420, 0x7269, 0x6365, +0x6974, 0x6e6f, "\000" +IDC_P9, 0x403, 2, 0 +0x0030, +IDC_P9, 0x403, 2, 0 +0x0031, +IDC_P10, 0x403, 2, 0 +0x0030, +IDC_P10, 0x403, 2, 0 +0x0031, +0 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -2412,73 +2412,73 @@ IDD_TEAMTYPES$(TS_MODE) DLGINIT IDD_TEAMTYPES DLGINIT #endif BEGIN - IDC_TECHLEVEL, 0x403, 2, 0 -0x0030, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0031, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0032, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0033, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0034, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0035, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0036, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0037, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0038, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0039, - IDC_TECHLEVEL, 0x403, 3, 0 -0x3031, "\000" - IDC_GROUP, 0x403, 3, 0 -0x312d, "\000" - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0031, - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0032, - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0033, - IDC_MINDCONTROLDECISION, 0x403, 17, 0 -0x2030, 0x202d, 0x443c, 0x6e6f, 0x7427, 0x6320, 0x7261, 0x3e65, "\000" - IDC_MINDCONTROLDECISION, 0x403, 16, 0 -0x2031, 0x202d, 0x6441, 0x2064, 0x6f54, 0x5420, 0x6165, 0x006d, - IDC_MINDCONTROLDECISION, 0x403, 19, 0 -0x2032, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4720, 0x6972, 0x646e, 0x7265, -"\000" - IDC_MINDCONTROLDECISION, 0x403, 23, 0 -0x2033, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4220, 0x6f69, 0x5220, 0x6165, -0x7463, 0x726f, "\000" - IDC_MINDCONTROLDECISION, 0x403, 15, 0 -0x2034, 0x202d, 0x6f47, 0x7420, 0x206f, 0x7548, 0x746e, "\000" - IDC_MINDCONTROLDECISION, 0x403, 15, 0 -0x2035, 0x202d, 0x6f44, 0x4e20, 0x746f, 0x6968, 0x676e, "\000" - 0 +IDC_TECHLEVEL, 0x403, 2, 0 +0x0030, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0031, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0032, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0033, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0034, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0035, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0036, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0037, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0038, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0039, +IDC_TECHLEVEL, 0x403, 3, 0 +0x3031, "\000" +IDC_GROUP, 0x403, 3, 0 +0x312d, "\000" +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0031, +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0032, +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0033, +IDC_MINDCONTROLDECISION, 0x403, 17, 0 +0x2030, 0x202d, 0x443c, 0x6e6f, 0x7427, 0x6320, 0x7261, 0x3e65, "\000" +IDC_MINDCONTROLDECISION, 0x403, 16, 0 +0x2031, 0x202d, 0x6441, 0x2064, 0x6f54, 0x5420, 0x6165, 0x006d, +IDC_MINDCONTROLDECISION, 0x403, 19, 0 +0x2032, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4720, 0x6972, 0x646e, 0x7265, +"\000" +IDC_MINDCONTROLDECISION, 0x403, 23, 0 +0x2033, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4220, 0x6f69, 0x5220, 0x6165, +0x7463, 0x726f, "\000" +IDC_MINDCONTROLDECISION, 0x403, 15, 0 +0x2034, 0x202d, 0x6f47, 0x7420, 0x206f, 0x7548, 0x746e, "\000" +IDC_MINDCONTROLDECISION, 0x403, 15, 0 +0x2035, 0x202d, 0x6f44, 0x4e20, 0x746f, 0x6968, 0x676e, "\000" +0 END #endif IDD_TAGS DLGINIT BEGIN - IDC_REPEAT, 0x403, 36, 0 -0x2030, 0x202d, 0x614d, 0x656b, 0x7420, 0x6568, 0x7420, 0x6972, 0x6767, -0x7265, 0x7720, 0x726f, 0x206b, 0x6e6f, 0x796c, 0x6f20, 0x636e, 0x0065, +IDC_REPEAT, 0x403, 36, 0 +0x2030, 0x202d, 0x614d, 0x656b, 0x7420, 0x6568, 0x7420, 0x6972, 0x6767, +0x7265, 0x7720, 0x726f, 0x206b, 0x6e6f, 0x796c, 0x6f20, 0x636e, 0x0065, - IDC_REPEAT, 0x403, 12, 0 -0x2031, 0x202d, 0x6e55, 0x6e6b, 0x776f, 0x006e, - IDC_REPEAT, 0x403, 32, 0 -0x2032, 0x202d, 0x614d, 0x656b, 0x7420, 0x6568, 0x7420, 0x6972, 0x6767, -0x7265, 0x7220, 0x7065, 0x6165, 0x6974, 0x676e, 0x0020, - 0 +IDC_REPEAT, 0x403, 12, 0 +0x2031, 0x202d, 0x6e55, 0x6e6b, 0x776f, 0x006e, +IDC_REPEAT, 0x403, 32, 0 +0x2032, 0x202d, 0x614d, 0x656b, 0x7420, 0x6568, 0x7420, 0x6972, 0x6767, +0x7265, 0x7220, 0x7065, 0x6165, 0x6974, 0x676e, 0x0020, +0 END IDD_TRIGGERS DLGINIT BEGIN - IDC_TRIGGER2, 0x403, 7, 0 -0x6e3c, 0x6e6f, 0x3e65, "\000" - 0 +IDC_TRIGGER2, 0x403, 7, 0 +0x6e3c, 0x6e6f, 0x3e65, "\000" +0 END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -2488,292 +2488,292 @@ IDD_AITRIGGERTYPES$(RA2_MODE) DLGINIT IDD_AITRIGGERTYPES DLGINIT #endif BEGIN - IDC_FLAG2, 0x403, 8, 0 -0x312d, 0x4e20, 0x6e6f, 0x0065, - IDC_FLAG2, 0x403, 37, 0 -0x2030, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, -"\000" - IDC_FLAG2, 0x403, 37, 0 -0x2031, 0x6f48, 0x7375, 0x2065, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, -"\000" - IDC_FLAG2, 0x403, 22, 0 -0x2032, 0x6e45, 0x6d65, 0x3a79, 0x5920, 0x6c65, 0x6f6c, 0x2077, 0x6f70, -0x6577, 0x0072, - IDC_FLAG2, 0x403, 19, 0 -0x2033, 0x6e45, 0x6d65, 0x3a79, 0x5220, 0x6465, 0x7020, 0x776f, 0x7265, -"\000" - IDC_FLAG2, 0x403, 33, 0 -0x2034, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6d20, 0x6e6f, 0x7965, "\000" - IDC_FLAG2, 0x403, 26, 0 -0x2035, 0x7249, 0x6e6f, 0x6320, 0x7275, 0x6174, 0x6e69, 0x6e20, 0x6165, -0x2072, 0x6572, 0x6461, 0x0079, - IDC_FLAG2, 0x403, 26, 0 -0x2036, 0x6843, 0x6f72, 0x6f6e, 0x7073, 0x6568, 0x6572, 0x6e20, 0x6165, -0x2072, 0x6572, 0x6461, 0x0079, - IDC_FLAG2, 0x403, 39, 0 -0x2037, 0x654e, 0x7475, 0x6172, 0x206c, 0x776f, 0x736e, 0x2820, 0x4f43, -0x444e, 0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, -0x5820, "\000" - IDC_DATA, 0x403, 65, 0 -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, "\000" - IDC_MULTISIDE, 0x403, 7, 0 -0x2030, 0x6f4e, 0x656e, "\000" - IDC_MULTISIDE, 0x403, 9, 0 -0x2031, 0x6c41, 0x696c, 0x6465, "\000" - IDC_MULTISIDE, 0x403, 9, 0 -0x2032, 0x6f53, 0x6976, 0x7465, "\000" - IDC_MULTISIDE, 0x403, 8, 0 -0x2033, 0x6854, 0x7269, 0x0064, - IDC_CONDITION, 0x403, 10, 0 -0x656c, 0x7373, 0x7420, 0x6168, 0x006e, - IDC_CONDITION, 0x403, 22, 0 -0x656c, 0x7373, 0x7420, 0x6168, 0x206e, 0x726f, 0x6520, 0x7571, 0x6c61, -0x7420, 0x006f, - IDC_CONDITION, 0x403, 9, 0 -0x7165, 0x6175, 0x206c, 0x6f74, "\000" - IDC_CONDITION, 0x403, 25, 0 -0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, 0x6f20, 0x2072, 0x7165, -0x6175, 0x206c, 0x6f74, "\000" - IDC_CONDITION, 0x403, 13, 0 -0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, "\000" - IDC_CONDITION, 0x403, 13, 0 -0x6f6e, 0x2074, 0x7165, 0x6175, 0x206c, 0x6f74, "\000" - 0 +IDC_FLAG2, 0x403, 8, 0 +0x312d, 0x4e20, 0x6e6f, 0x0065, +IDC_FLAG2, 0x403, 37, 0 +0x2030, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, +"\000" +IDC_FLAG2, 0x403, 37, 0 +0x2031, 0x6f48, 0x7375, 0x2065, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, +"\000" +IDC_FLAG2, 0x403, 22, 0 +0x2032, 0x6e45, 0x6d65, 0x3a79, 0x5920, 0x6c65, 0x6f6c, 0x2077, 0x6f70, +0x6577, 0x0072, +IDC_FLAG2, 0x403, 19, 0 +0x2033, 0x6e45, 0x6d65, 0x3a79, 0x5220, 0x6465, 0x7020, 0x776f, 0x7265, +"\000" +IDC_FLAG2, 0x403, 33, 0 +0x2034, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6d20, 0x6e6f, 0x7965, "\000" +IDC_FLAG2, 0x403, 26, 0 +0x2035, 0x7249, 0x6e6f, 0x6320, 0x7275, 0x6174, 0x6e69, 0x6e20, 0x6165, +0x2072, 0x6572, 0x6461, 0x0079, +IDC_FLAG2, 0x403, 26, 0 +0x2036, 0x6843, 0x6f72, 0x6f6e, 0x7073, 0x6568, 0x6572, 0x6e20, 0x6165, +0x2072, 0x6572, 0x6461, 0x0079, +IDC_FLAG2, 0x403, 39, 0 +0x2037, 0x654e, 0x7475, 0x6172, 0x206c, 0x776f, 0x736e, 0x2820, 0x4f43, +0x444e, 0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, +0x5820, "\000" +IDC_DATA, 0x403, 65, 0 +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, "\000" +IDC_MULTISIDE, 0x403, 7, 0 +0x2030, 0x6f4e, 0x656e, "\000" +IDC_MULTISIDE, 0x403, 9, 0 +0x2031, 0x6c41, 0x696c, 0x6465, "\000" +IDC_MULTISIDE, 0x403, 9, 0 +0x2032, 0x6f53, 0x6976, 0x7465, "\000" +IDC_MULTISIDE, 0x403, 8, 0 +0x2033, 0x6854, 0x7269, 0x0064, +IDC_CONDITION, 0x403, 10, 0 +0x656c, 0x7373, 0x7420, 0x6168, 0x006e, +IDC_CONDITION, 0x403, 22, 0 +0x656c, 0x7373, 0x7420, 0x6168, 0x206e, 0x726f, 0x6520, 0x7571, 0x6c61, +0x7420, 0x006f, +IDC_CONDITION, 0x403, 9, 0 +0x7165, 0x6175, 0x206c, 0x6f74, "\000" +IDC_CONDITION, 0x403, 25, 0 +0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, 0x6f20, 0x2072, 0x7165, +0x6175, 0x206c, 0x6f74, "\000" +IDC_CONDITION, 0x403, 13, 0 +0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, "\000" +IDC_CONDITION, 0x403, 13, 0 +0x6f6e, 0x2074, 0x7165, 0x6175, 0x206c, 0x6f74, "\000" +0 END #endif IDD_BASIC DLGINIT BEGIN - IDC_ENDOFGAME, 0x403, 3, 0 -0x6f6e, "\000" - IDC_ENDOFGAME, 0x403, 4, 0 -0x6579, 0x0073, - IDC_SKIPSCORE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_SKIPSCORE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_ONETIMEONLY, 0x403, 3, 0 -0x6f6e, "\000" - IDC_ONETIMEONLY, 0x403, 4, 0 -0x6579, 0x0073, - IDC_SKIPMAPSELECT, 0x403, 3, 0 -0x6f6e, "\000" - IDC_SKIPMAPSELECT, 0x403, 4, 0 -0x6579, 0x0073, - IDC_OFFICIAL, 0x403, 3, 0 -0x6f6e, "\000" - IDC_OFFICIAL, 0x403, 4, 0 -0x6579, 0x0073, - IDC_IGNOREGLOBALAITRIGGERS, 0x403, 3, 0 -0x6f6e, "\000" - IDC_IGNOREGLOBALAITRIGGERS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TRUCKCRATE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TRUCKCRATE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TRAINCRATE, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TRAINCRATE, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIBERIUMGROWTHENABLED, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TIBERIUMGROWTHENABLED, 0x403, 4, 0 -0x6579, 0x0073, - IDC_VEINGROWTHENABLED, 0x403, 3, 0 -0x6f6e, "\000" - IDC_VEINGROWTHENABLED, 0x403, 4, 0 -0x6579, 0x0073, - IDC_ICEGROWTHENABLED, 0x403, 3, 0 -0x6f6e, "\000" - IDC_ICEGROWTHENABLED, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIBERIUMDEATHTOVISCEROID, 0x403, 3, 0 -0x6f6e, "\000" - IDC_TIBERIUMDEATHTOVISCEROID, 0x403, 4, 0 -0x6579, 0x0073, - IDC_FREERADAR, 0x403, 3, 0 -0x6f6e, "\000" - IDC_FREERADAR, 0x403, 4, 0 -0x6579, 0x0073, - IDC_REQUIREDADDON, 0x403, 2, 0 -0x0030, - IDC_REQUIREDADDON, 0x403, 2, 0 -0x0031, - 0 +IDC_ENDOFGAME, 0x403, 3, 0 +0x6f6e, "\000" +IDC_ENDOFGAME, 0x403, 4, 0 +0x6579, 0x0073, +IDC_SKIPSCORE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_SKIPSCORE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_ONETIMEONLY, 0x403, 3, 0 +0x6f6e, "\000" +IDC_ONETIMEONLY, 0x403, 4, 0 +0x6579, 0x0073, +IDC_SKIPMAPSELECT, 0x403, 3, 0 +0x6f6e, "\000" +IDC_SKIPMAPSELECT, 0x403, 4, 0 +0x6579, 0x0073, +IDC_OFFICIAL, 0x403, 3, 0 +0x6f6e, "\000" +IDC_OFFICIAL, 0x403, 4, 0 +0x6579, 0x0073, +IDC_IGNOREGLOBALAITRIGGERS, 0x403, 3, 0 +0x6f6e, "\000" +IDC_IGNOREGLOBALAITRIGGERS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TRUCKCRATE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TRUCKCRATE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TRAINCRATE, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TRAINCRATE, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIBERIUMGROWTHENABLED, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TIBERIUMGROWTHENABLED, 0x403, 4, 0 +0x6579, 0x0073, +IDC_VEINGROWTHENABLED, 0x403, 3, 0 +0x6f6e, "\000" +IDC_VEINGROWTHENABLED, 0x403, 4, 0 +0x6579, 0x0073, +IDC_ICEGROWTHENABLED, 0x403, 3, 0 +0x6f6e, "\000" +IDC_ICEGROWTHENABLED, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIBERIUMDEATHTOVISCEROID, 0x403, 3, 0 +0x6f6e, "\000" +IDC_TIBERIUMDEATHTOVISCEROID, 0x403, 4, 0 +0x6579, 0x0073, +IDC_FREERADAR, 0x403, 3, 0 +0x6f6e, "\000" +IDC_FREERADAR, 0x403, 4, 0 +0x6579, 0x0073, +IDC_REQUIREDADDON, 0x403, 2, 0 +0x0030, +IDC_REQUIREDADDON, 0x403, 2, 0 +0x0031, +0 END IDD_SINGLEPLAYER DLGINIT BEGIN - IDC_STARTINGDROPSHIPS, 0x403, 2, 0 -0x0030, - IDC_STARTINGDROPSHIPS, 0x403, 2, 0 -0x0031, - IDC_TIMERINHERIT, 0x403, 4, 0 -0x6579, 0x0073, - IDC_TIMERINHERIT, 0x403, 3, 0 -0x6f6e, "\000" - IDC_FILLSILOS, 0x403, 4, 0 -0x6579, 0x0073, - IDC_FILLSILOS, 0x403, 3, 0 -0x6f6e, "\000" - 0 +IDC_STARTINGDROPSHIPS, 0x403, 2, 0 +0x0030, +IDC_STARTINGDROPSHIPS, 0x403, 2, 0 +0x0031, +IDC_TIMERINHERIT, 0x403, 4, 0 +0x6579, 0x0073, +IDC_TIMERINHERIT, 0x403, 3, 0 +0x6f6e, "\000" +IDC_FILLSILOS, 0x403, 4, 0 +0x6579, 0x0073, +IDC_FILLSILOS, 0x403, 3, 0 +0x6f6e, "\000" +0 END IDD_SCRIPTTYPES DLGINIT BEGIN - IDC_TYPE, 0x403, 32, 0 -0x2030, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7420, 0x7261, 0x6567, 0x2074, -0x7428, 0x7261, 0x6567, 0x2074, 0x7974, 0x6570, 0x0029, - IDC_TYPE, 0x403, 38, 0 -0x2031, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7720, 0x7961, 0x6f70, 0x6e69, -0x2074, 0x7728, 0x7961, 0x6f70, 0x6e69, 0x2074, 0x756e, 0x626d, 0x7265, -0x0029, - IDC_TYPE, 0x403, 39, 0 -0x2033, 0x202d, 0x6f4d, 0x6576, 0x7420, 0x206f, 0x6177, 0x7079, 0x696f, -0x746e, 0x2820, 0x6177, 0x7079, 0x696f, 0x746e, 0x6e20, 0x6d75, 0x6562, -0x2972, "\000" - IDC_TYPE, 0x403, 58, 0 -0x2034, 0x202d, 0x6f4d, 0x6576, 0x7420, 0x206f, 0x6563, 0x6c6c, 0x2820, -0x6177, 0x7079, 0x696f, 0x746e, 0x7620, 0x6c61, 0x6575, 0x2820, 0x5820, -0x5858, 0x5959, 0x2c59, 0x6120, 0x2074, 0x656c, 0x7361, 0x2074, 0x5958, -0x5959, 0x0029, - IDC_TYPE, 0x403, 37, 0 -0x2035, 0x202d, 0x7547, 0x7261, 0x2064, 0x7261, 0x6165, 0x2820, 0x6974, -0x656d, 0x7520, 0x696e, 0x7374, 0x7420, 0x206f, 0x7567, 0x7261, 0x2964, -"\000" - IDC_TYPE, 0x403, 36, 0 -0x2036, 0x202d, 0x754a, 0x706d, 0x7420, 0x206f, 0x6361, 0x6974, 0x6e6f, -0x2320, 0x2820, 0x6361, 0x6974, 0x6e6f, 0x7420, 0x206f, 0x6f67, 0x0029, +IDC_TYPE, 0x403, 32, 0 +0x2030, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7420, 0x7261, 0x6567, 0x2074, +0x7428, 0x7261, 0x6567, 0x2074, 0x7974, 0x6570, 0x0029, +IDC_TYPE, 0x403, 38, 0 +0x2031, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7720, 0x7961, 0x6f70, 0x6e69, +0x2074, 0x7728, 0x7961, 0x6f70, 0x6e69, 0x2074, 0x756e, 0x626d, 0x7265, +0x0029, +IDC_TYPE, 0x403, 39, 0 +0x2033, 0x202d, 0x6f4d, 0x6576, 0x7420, 0x206f, 0x6177, 0x7079, 0x696f, +0x746e, 0x2820, 0x6177, 0x7079, 0x696f, 0x746e, 0x6e20, 0x6d75, 0x6562, +0x2972, "\000" +IDC_TYPE, 0x403, 58, 0 +0x2034, 0x202d, 0x6f4d, 0x6576, 0x7420, 0x206f, 0x6563, 0x6c6c, 0x2820, +0x6177, 0x7079, 0x696f, 0x746e, 0x7620, 0x6c61, 0x6575, 0x2820, 0x5820, +0x5858, 0x5959, 0x2c59, 0x6120, 0x2074, 0x656c, 0x7361, 0x2074, 0x5958, +0x5959, 0x0029, +IDC_TYPE, 0x403, 37, 0 +0x2035, 0x202d, 0x7547, 0x7261, 0x2064, 0x7261, 0x6165, 0x2820, 0x6974, +0x656d, 0x7520, 0x696e, 0x7374, 0x7420, 0x206f, 0x7567, 0x7261, 0x2964, +"\000" +IDC_TYPE, 0x403, 36, 0 +0x2036, 0x202d, 0x754a, 0x706d, 0x7420, 0x206f, 0x6361, 0x6974, 0x6e6f, +0x2320, 0x2820, 0x6361, 0x6974, 0x6e6f, 0x7420, 0x206f, 0x6f67, 0x0029, - IDC_TYPE, 0x403, 18, 0 -0x2037, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7420, 0x7261, 0x6f63, 0x006d, +IDC_TYPE, 0x403, 18, 0 +0x2037, 0x202d, 0x7441, 0x6174, 0x6b63, 0x7420, 0x7261, 0x6f63, 0x006d, - IDC_TYPE, 0x403, 46, 0 -0x2038, 0x202d, 0x6e55, 0x6f6c, 0x6461, 0x6320, 0x7261, 0x6f67, 0x2820, -0x7073, 0x696c, 0x2074, 0x7274, 0x6e61, 0x7073, 0x726f, 0x2074, 0x6e61, -0x2064, 0x7274, 0x6f6f, 0x7370, 0x0029, - IDC_TYPE, 0x403, 24, 0 -0x2039, 0x202d, 0x6544, 0x6c70, 0x796f, 0x2820, 0x6170, 0x6172, 0x206d, -0x7369, 0x3020, 0x0029, - IDC_TYPE, 0x403, 30, 0 -0x3131, 0x2d20, 0x4420, 0x206f, 0x6562, 0x6168, 0x6976, 0x756f, 0x2072, -0x6228, 0x6865, 0x7661, 0x6f69, 0x7275, 0x0029, - IDC_TYPE, 0x403, 32, 0 -0x3431, 0x2d20, 0x4c20, 0x616f, 0x2064, 0x6e6f, 0x7420, 0x6172, 0x736e, -0x6f70, 0x7472, 0x2073, 0x7528, 0x6573, 0x3020, 0x0029, - IDC_TYPE, 0x403, 42, 0 -0x3631, 0x2d20, 0x5020, 0x7461, 0x6f72, 0x206c, 0x6f74, 0x7720, 0x7961, -0x6f70, 0x6e69, 0x2074, 0x7728, 0x7961, 0x6f70, 0x6e69, 0x2074, 0x756e, -0x626d, 0x7265, 0x0029, - IDC_TYPE, 0x403, 46, 0 -0x3032, 0x2d20, 0x4320, 0x6168, 0x676e, 0x2065, 0x6f68, 0x7375, 0x2065, -0x6e28, 0x6d75, 0x6562, 0x2072, 0x666f, 0x6e20, 0x7765, 0x6f20, 0x6e77, -0x7265, 0x6820, 0x756f, 0x6573, 0x0029, - IDC_TYPE, 0x403, 23, 0 -0x3733, 0x2d20, 0x4c20, 0x6165, 0x6576, 0x6d20, 0x7061, 0x2820, 0x7375, -0x2065, 0x2930, "\000" - IDC_TYPE, 0x403, 25, 0 -0x3933, 0x2d20, 0x5320, 0x7465, 0x6720, 0x6f6c, 0x6162, 0x206c, 0x6728, -0x6f6c, 0x6162, 0x296c, "\000" - IDC_TYPE, 0x403, 19, 0 -0x3034, 0x2d20, 0x4320, 0x656c, 0x7261, 0x6720, 0x6f6c, 0x6162, 0x3f6c, -"\000" - IDC_TYPE, 0x403, 25, 0 -0x3234, 0x2d20, 0x5420, 0x7275, 0x206e, 0x6e69, 0x6f74, 0x6420, 0x7269, -0x6365, 0x6974, 0x6e6f, "\000" - IDC_TYPE, 0x403, 16, 0 -0x3434, 0x2d20, 0x4c20, 0x616f, 0x2064, 0x6163, 0x6772, 0x006f, - IDC_TYPE, 0x403, 18, 0 -0x3534, 0x2d20, 0x5520, 0x6c6e, 0x616f, 0x2064, 0x6163, 0x6772, 0x006f, +IDC_TYPE, 0x403, 46, 0 +0x2038, 0x202d, 0x6e55, 0x6f6c, 0x6461, 0x6320, 0x7261, 0x6f67, 0x2820, +0x7073, 0x696c, 0x2074, 0x7274, 0x6e61, 0x7073, 0x726f, 0x2074, 0x6e61, +0x2064, 0x7274, 0x6f6f, 0x7370, 0x0029, +IDC_TYPE, 0x403, 24, 0 +0x2039, 0x202d, 0x6544, 0x6c70, 0x796f, 0x2820, 0x6170, 0x6172, 0x206d, +0x7369, 0x3020, 0x0029, +IDC_TYPE, 0x403, 30, 0 +0x3131, 0x2d20, 0x4420, 0x206f, 0x6562, 0x6168, 0x6976, 0x756f, 0x2072, +0x6228, 0x6865, 0x7661, 0x6f69, 0x7275, 0x0029, +IDC_TYPE, 0x403, 32, 0 +0x3431, 0x2d20, 0x4c20, 0x616f, 0x2064, 0x6e6f, 0x7420, 0x6172, 0x736e, +0x6f70, 0x7472, 0x2073, 0x7528, 0x6573, 0x3020, 0x0029, +IDC_TYPE, 0x403, 42, 0 +0x3631, 0x2d20, 0x5020, 0x7461, 0x6f72, 0x206c, 0x6f74, 0x7720, 0x7961, +0x6f70, 0x6e69, 0x2074, 0x7728, 0x7961, 0x6f70, 0x6e69, 0x2074, 0x756e, +0x626d, 0x7265, 0x0029, +IDC_TYPE, 0x403, 46, 0 +0x3032, 0x2d20, 0x4320, 0x6168, 0x676e, 0x2065, 0x6f68, 0x7375, 0x2065, +0x6e28, 0x6d75, 0x6562, 0x2072, 0x666f, 0x6e20, 0x7765, 0x6f20, 0x6e77, +0x7265, 0x6820, 0x756f, 0x6573, 0x0029, +IDC_TYPE, 0x403, 23, 0 +0x3733, 0x2d20, 0x4c20, 0x6165, 0x6576, 0x6d20, 0x7061, 0x2820, 0x7375, +0x2065, 0x2930, "\000" +IDC_TYPE, 0x403, 25, 0 +0x3933, 0x2d20, 0x5320, 0x7465, 0x6720, 0x6f6c, 0x6162, 0x206c, 0x6728, +0x6f6c, 0x6162, 0x296c, "\000" +IDC_TYPE, 0x403, 19, 0 +0x3034, 0x2d20, 0x4320, 0x656c, 0x7261, 0x6720, 0x6f6c, 0x6162, 0x3f6c, +"\000" +IDC_TYPE, 0x403, 25, 0 +0x3234, 0x2d20, 0x5420, 0x7275, 0x206e, 0x6e69, 0x6f74, 0x6420, 0x7269, +0x6365, 0x6974, 0x6e6f, "\000" +IDC_TYPE, 0x403, 16, 0 +0x3434, 0x2d20, 0x4c20, 0x616f, 0x2064, 0x6163, 0x6772, 0x006f, +IDC_TYPE, 0x403, 18, 0 +0x3534, 0x2d20, 0x5520, 0x6c6e, 0x616f, 0x2064, 0x6163, 0x6772, 0x006f, - IDC_TYPE, 0x403, 29, 0 -0x3634, 0x2d20, 0x4120, 0x7474, 0x6361, 0x206b, 0x6174, 0x6772, 0x7465, -0x7320, 0x7274, 0x6375, 0x7574, 0x6572, "\000" - IDC_TYPE, 0x403, 30, 0 -0x3734, 0x2d20, 0x4d20, 0x766f, 0x2065, 0x6f74, 0x7420, 0x7261, 0x6567, -0x2074, 0x7473, 0x7572, 0x7463, 0x7275, 0x0065, - 0 +IDC_TYPE, 0x403, 29, 0 +0x3634, 0x2d20, 0x4120, 0x7474, 0x6361, 0x206b, 0x6174, 0x6772, 0x7465, +0x7320, 0x7274, 0x6375, 0x7574, 0x6572, "\000" +IDC_TYPE, 0x403, 30, 0 +0x3734, 0x2d20, 0x4d20, 0x766f, 0x2065, 0x6f74, 0x7420, 0x7261, 0x6567, +0x2074, 0x7473, 0x7572, 0x7463, 0x7275, 0x0065, +0 END IDD_NEWMAP DLGINIT BEGIN - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0030, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0031, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0032, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0033, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0034, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0035, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0036, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0037, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0038, - IDC_GROUNDHEIGHT, 0x403, 2, 0 -0x0039, - IDC_GROUNDHEIGHT, 0x403, 3, 0 -0x3031, "\000" - 0 +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0030, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0031, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0032, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0033, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0034, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0035, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0036, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0037, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0038, +IDC_GROUNDHEIGHT, 0x403, 2, 0 +0x0039, +IDC_GROUNDHEIGHT, 0x403, 3, 0 +0x3031, "\000" +0 END IDD_TOOLSETTINGS DLGINIT BEGIN - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7831, 0x0031, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7832, 0x0032, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7833, 0x0033, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7834, 0x0034, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7835, 0x0035, - IDC_BRUSHSIZE, 0x403, 6, 0 -0x3031, 0x3178, 0x0030, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7831, 0x0032, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7832, 0x0031, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7831, 0x0033, - IDC_BRUSHSIZE, 0x403, 4, 0 -0x7833, 0x0031, - 0 +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7831, 0x0031, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7832, 0x0032, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7833, 0x0033, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7834, 0x0034, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7835, 0x0035, +IDC_BRUSHSIZE, 0x403, 6, 0 +0x3031, 0x3178, 0x0030, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7831, 0x0032, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7832, 0x0031, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7831, 0x0033, +IDC_BRUSHSIZE, 0x403, 4, 0 +0x7833, 0x0031, +0 END IDD_TRIGGEROPTIONS DLGINIT BEGIN - IDC_TRIGGERTYPE, 0x403, 13, 0 -0x2030, 0x202d, 0x7453, 0x6e61, 0x6164, 0x6472, "\000" - IDC_TRIGGERTYPE, 0x403, 14, 0 -0x2032, 0x202d, 0x6552, 0x6570, 0x7461, 0x6e69, 0x0067, - IDC_HOUSE, 0x403, 13, 0 -0x2030, 0x202d, 0x7453, 0x6e61, 0x6164, 0x6472, "\000" - IDC_HOUSE, 0x403, 14, 0 -0x2032, 0x202d, 0x6552, 0x6570, 0x7461, 0x6e69, 0x0067, - 0 +IDC_TRIGGERTYPE, 0x403, 13, 0 +0x2030, 0x202d, 0x7453, 0x6e61, 0x6164, 0x6472, "\000" +IDC_TRIGGERTYPE, 0x403, 14, 0 +0x2032, 0x202d, 0x6552, 0x6570, 0x7461, 0x6e69, 0x0067, +IDC_HOUSE, 0x403, 13, 0 +0x2030, 0x202d, 0x7453, 0x6e61, 0x6164, 0x6472, "\000" +IDC_HOUSE, 0x403, 14, 0 +0x2032, 0x202d, 0x6552, 0x6570, 0x7461, 0x6e69, 0x0067, +0 END IDD_GLOBALS DLGINIT BEGIN - IDC_VALUE, 0x403, 10, 0 -0x2030, 0x202d, 0x6c43, 0x6165, 0x0072, - IDC_VALUE, 0x403, 8, 0 -0x2031, 0x202d, 0x6553, 0x0074, - 0 +IDC_VALUE, 0x403, 10, 0 +0x2030, 0x202d, 0x6c43, 0x6165, 0x0072, +IDC_VALUE, 0x403, 8, 0 +0x2031, 0x202d, 0x6553, 0x0074, +0 END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) @@ -2783,171 +2783,171 @@ IDD_TEAMTYPES$(RA2_MODE) DLGINIT IDD_TEAMTYPES DLGINIT #endif BEGIN - IDC_TECHLEVEL, 0x403, 2, 0 -0x0030, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0031, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0032, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0033, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0034, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0035, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0036, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0037, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0038, - IDC_TECHLEVEL, 0x403, 2, 0 -0x0039, - IDC_TECHLEVEL, 0x403, 3, 0 -0x3031, "\000" - IDC_GROUP, 0x403, 3, 0 -0x312d, "\000" - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0031, - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0032, - IDC_VETERANLEVEL, 0x403, 2, 0 -0x0033, - IDC_MINDCONTROLDECISION, 0x403, 17, 0 -0x2030, 0x202d, 0x443c, 0x6e6f, 0x7427, 0x6320, 0x7261, 0x3e65, "\000" - IDC_MINDCONTROLDECISION, 0x403, 16, 0 -0x2031, 0x202d, 0x6441, 0x2064, 0x6f54, 0x5420, 0x6165, 0x006d, - IDC_MINDCONTROLDECISION, 0x403, 19, 0 -0x2032, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4720, 0x6972, 0x646e, 0x7265, -"\000" - IDC_MINDCONTROLDECISION, 0x403, 23, 0 -0x2033, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4220, 0x6f69, 0x5220, 0x6165, -0x7463, 0x726f, "\000" - IDC_MINDCONTROLDECISION, 0x403, 15, 0 -0x2034, 0x202d, 0x6f47, 0x7420, 0x206f, 0x7548, 0x746e, "\000" - IDC_MINDCONTROLDECISION, 0x403, 15, 0 -0x2035, 0x202d, 0x6f44, 0x4e20, 0x746f, 0x6968, 0x676e, "\000" - 0 +IDC_TECHLEVEL, 0x403, 2, 0 +0x0030, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0031, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0032, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0033, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0034, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0035, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0036, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0037, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0038, +IDC_TECHLEVEL, 0x403, 2, 0 +0x0039, +IDC_TECHLEVEL, 0x403, 3, 0 +0x3031, "\000" +IDC_GROUP, 0x403, 3, 0 +0x312d, "\000" +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0031, +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0032, +IDC_VETERANLEVEL, 0x403, 2, 0 +0x0033, +IDC_MINDCONTROLDECISION, 0x403, 17, 0 +0x2030, 0x202d, 0x443c, 0x6e6f, 0x7427, 0x6320, 0x7261, 0x3e65, "\000" +IDC_MINDCONTROLDECISION, 0x403, 16, 0 +0x2031, 0x202d, 0x6441, 0x2064, 0x6f54, 0x5420, 0x6165, 0x006d, +IDC_MINDCONTROLDECISION, 0x403, 19, 0 +0x2032, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4720, 0x6972, 0x646e, 0x7265, +"\000" +IDC_MINDCONTROLDECISION, 0x403, 23, 0 +0x2033, 0x202d, 0x7550, 0x2074, 0x6e69, 0x4220, 0x6f69, 0x5220, 0x6165, +0x7463, 0x726f, "\000" +IDC_MINDCONTROLDECISION, 0x403, 15, 0 +0x2034, 0x202d, 0x6f47, 0x7420, 0x206f, 0x7548, 0x746e, "\000" +IDC_MINDCONTROLDECISION, 0x403, 15, 0 +0x2035, 0x202d, 0x6f44, 0x4e20, 0x746f, 0x6968, 0x676e, "\000" +0 END #endif IDD_NEWMAPCREATENEW DLGINIT BEGIN - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0030, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0031, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0032, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0033, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0034, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0035, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0036, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0037, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0038, - 0 +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0030, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0031, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0032, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0033, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0034, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0035, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0036, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0037, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0038, +0 END IDD_NEWMAPBITMAP DLGINIT BEGIN - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0030, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0031, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0032, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0033, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0034, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0035, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0036, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0037, - IDC_STARTINGHEIGHT, 0x403, 2, 0 -0x0038, - 0 +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0030, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0031, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0032, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0033, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0034, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0035, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0036, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0037, +IDC_STARTINGHEIGHT, 0x403, 2, 0 +0x0038, +0 END IDD_UNIT DLGINIT BEGIN - IDC_STATE, 0x403, 6, 0 -0x6c53, 0x6565, 0x0070, - IDC_STATE, 0x403, 9, 0 -0x6148, 0x6d72, 0x656c, 0x7373, "\000" - IDC_STATE, 0x403, 7, 0 -0x7453, 0x6369, 0x796b, "\000" - IDC_STATE, 0x403, 7, 0 -0x7441, 0x6174, 0x6b63, "\000" - IDC_STATE, 0x403, 5, 0 -0x6f4d, 0x6576, "\000" - IDC_STATE, 0x403, 7, 0 -0x6150, 0x7274, 0x6c6f, "\000" - IDC_STATE, 0x403, 6, 0 -0x4d51, 0x766f, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6552, 0x7274, 0x6165, 0x0074, - IDC_STATE, 0x403, 6, 0 -0x7547, 0x7261, 0x0064, - IDC_STATE, 0x403, 6, 0 -0x6e45, 0x6574, 0x0072, - IDC_STATE, 0x403, 8, 0 -0x6143, 0x7470, 0x7275, 0x0065, - IDC_STATE, 0x403, 8, 0 -0x6148, 0x7672, 0x7365, 0x0074, - IDC_STATE, 0x403, 11, 0 -0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" - IDC_STATE, 0x403, 17, 0 -0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7453, 0x706f, "\000" - IDC_STATE, 0x403, 17, 0 -0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" - IDC_STATE, 0x403, 5, 0 -0x7548, 0x746e, "\000" - IDC_STATE, 0x403, 7, 0 -0x6e55, 0x6f6c, 0x6461, "\000" - IDC_STATE, 0x403, 9, 0 -0x6153, 0x6f62, 0x6174, 0x6567, "\000" - IDC_STATE, 0x403, 13, 0 -0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" - IDC_STATE, 0x403, 8, 0 -0x6553, 0x6c6c, 0x6e69, 0x0067, - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6170, 0x7269, "\000" - IDC_STATE, 0x403, 7, 0 -0x6552, 0x6373, 0x6575, "\000" - IDC_STATE, 0x403, 8, 0 -0x694d, 0x7373, 0x6c69, 0x0065, - IDC_STATE, 0x403, 5, 0 -0x704f, 0x6e65, "\000" - IDC_TAG, 0x403, 5, 0 -0x6f4e, 0x656e, "\000" - IDC_DIRECTION, 0x403, 2, 0 -0x0030, - IDC_DIRECTION, 0x403, 3, 0 -0x3233, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3436, "\000" - IDC_DIRECTION, 0x403, 3, 0 -0x3639, "\000" - IDC_DIRECTION, 0x403, 4, 0 -0x3231, 0x0038, - IDC_DIRECTION, 0x403, 4, 0 -0x3631, 0x0030, - IDC_DIRECTION, 0x403, 4, 0 -0x3931, 0x0032, - IDC_DIRECTION, 0x403, 4, 0 -0x3232, 0x0034, - 0 +IDC_STATE, 0x403, 6, 0 +0x6c53, 0x6565, 0x0070, +IDC_STATE, 0x403, 9, 0 +0x6148, 0x6d72, 0x656c, 0x7373, "\000" +IDC_STATE, 0x403, 7, 0 +0x7453, 0x6369, 0x796b, "\000" +IDC_STATE, 0x403, 7, 0 +0x7441, 0x6174, 0x6b63, "\000" +IDC_STATE, 0x403, 5, 0 +0x6f4d, 0x6576, "\000" +IDC_STATE, 0x403, 7, 0 +0x6150, 0x7274, 0x6c6f, "\000" +IDC_STATE, 0x403, 6, 0 +0x4d51, 0x766f, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6552, 0x7274, 0x6165, 0x0074, +IDC_STATE, 0x403, 6, 0 +0x7547, 0x7261, 0x0064, +IDC_STATE, 0x403, 6, 0 +0x6e45, 0x6574, 0x0072, +IDC_STATE, 0x403, 8, 0 +0x6143, 0x7470, 0x7275, 0x0065, +IDC_STATE, 0x403, 8, 0 +0x6148, 0x7672, 0x7365, 0x0074, +IDC_STATE, 0x403, 11, 0 +0x7241, 0x6165, 0x4720, 0x6175, 0x6472, "\000" +IDC_STATE, 0x403, 17, 0 +0x6552, 0x7574, 0x6e72, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7453, 0x706f, "\000" +IDC_STATE, 0x403, 17, 0 +0x6d41, 0x7562, 0x6873, 0x3c20, 0x6e75, 0x7375, 0x6465, 0x3e21, "\000" +IDC_STATE, 0x403, 5, 0 +0x7548, 0x746e, "\000" +IDC_STATE, 0x403, 7, 0 +0x6e55, 0x6f6c, 0x6461, "\000" +IDC_STATE, 0x403, 9, 0 +0x6153, 0x6f62, 0x6174, 0x6567, "\000" +IDC_STATE, 0x403, 13, 0 +0x6f43, 0x736e, 0x7274, 0x6375, 0x6974, 0x6e6f, "\000" +IDC_STATE, 0x403, 8, 0 +0x6553, 0x6c6c, 0x6e69, 0x0067, +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6170, 0x7269, "\000" +IDC_STATE, 0x403, 7, 0 +0x6552, 0x6373, 0x6575, "\000" +IDC_STATE, 0x403, 8, 0 +0x694d, 0x7373, 0x6c69, 0x0065, +IDC_STATE, 0x403, 5, 0 +0x704f, 0x6e65, "\000" +IDC_TAG, 0x403, 5, 0 +0x6f4e, 0x656e, "\000" +IDC_DIRECTION, 0x403, 2, 0 +0x0030, +IDC_DIRECTION, 0x403, 3, 0 +0x3233, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3436, "\000" +IDC_DIRECTION, 0x403, 3, 0 +0x3639, "\000" +IDC_DIRECTION, 0x403, 4, 0 +0x3231, 0x0038, +IDC_DIRECTION, 0x403, 4, 0 +0x3631, 0x0030, +IDC_DIRECTION, 0x403, 4, 0 +0x3931, 0x0032, +IDC_DIRECTION, 0x403, 4, 0 +0x3232, 0x0034, +0 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -2957,51 +2957,51 @@ IDD_AITRIGGERTYPES$(TS_MODE) DLGINIT IDD_AITRIGGERTYPES DLGINIT #endif BEGIN - IDC_FLAG2, 0x403, 8, 0 -0x312d, 0x4e20, 0x6e6f, 0x0065, - IDC_FLAG2, 0x403, 37, 0 -0x2030, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, -"\000" - IDC_FLAG2, 0x403, 37, 0 -0x2031, 0x6f48, 0x7375, 0x2065, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, -"\000" - IDC_FLAG2, 0x403, 22, 0 -0x2032, 0x6e45, 0x6d65, 0x3a79, 0x5920, 0x6c65, 0x6f6c, 0x2077, 0x6f70, -0x6577, 0x0072, - IDC_FLAG2, 0x403, 19, 0 -0x2033, 0x6e45, 0x6d65, 0x3a79, 0x5220, 0x6465, 0x7020, 0x776f, 0x7265, -"\000" - IDC_FLAG2, 0x403, 33, 0 -0x2034, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, -0x5449, 0x4f49, 0x294e, 0x4e20, 0x6d20, 0x6e6f, 0x7965, "\000" - IDC_DATA, 0x403, 65, 0 -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, -0x3030, 0x3030, 0x3030, 0x3030, 0x3030, "\000" - IDC_MULTISIDE, 0x403, 7, 0 -0x2030, 0x6f4e, 0x656e, "\000" - IDC_MULTISIDE, 0x403, 6, 0 -0x2031, 0x4447, 0x0049, - IDC_MULTISIDE, 0x403, 6, 0 -0x2032, 0x6f4e, 0x0064, - IDC_CONDITION, 0x403, 10, 0 -0x656c, 0x7373, 0x7420, 0x6168, 0x006e, - IDC_CONDITION, 0x403, 22, 0 -0x656c, 0x7373, 0x7420, 0x6168, 0x206e, 0x726f, 0x6520, 0x7571, 0x6c61, -0x7420, 0x006f, - IDC_CONDITION, 0x403, 9, 0 -0x7165, 0x6175, 0x206c, 0x6f74, "\000" - IDC_CONDITION, 0x403, 25, 0 -0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, 0x6f20, 0x2072, 0x7165, -0x6175, 0x206c, 0x6f74, "\000" - IDC_CONDITION, 0x403, 13, 0 -0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, "\000" - IDC_CONDITION, 0x403, 13, 0 -0x6f6e, 0x2074, 0x7165, 0x6175, 0x206c, 0x6f74, "\000" - 0 +IDC_FLAG2, 0x403, 8, 0 +0x312d, 0x4e20, 0x6e6f, 0x0065, +IDC_FLAG2, 0x403, 37, 0 +0x2030, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, +"\000" +IDC_FLAG2, 0x403, 37, 0 +0x2031, 0x6f48, 0x7375, 0x2065, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6f20, 0x2066, 0x7974, 0x6570, 0x5820, +"\000" +IDC_FLAG2, 0x403, 22, 0 +0x2032, 0x6e45, 0x6d65, 0x3a79, 0x5920, 0x6c65, 0x6f6c, 0x2077, 0x6f70, +0x6577, 0x0072, +IDC_FLAG2, 0x403, 19, 0 +0x2033, 0x6e45, 0x6d65, 0x3a79, 0x5220, 0x6465, 0x7020, 0x776f, 0x7265, +"\000" +IDC_FLAG2, 0x403, 33, 0 +0x2034, 0x6e45, 0x6d65, 0x2079, 0x776f, 0x736e, 0x2820, 0x4f43, 0x444e, +0x5449, 0x4f49, 0x294e, 0x4e20, 0x6d20, 0x6e6f, 0x7965, "\000" +IDC_DATA, 0x403, 65, 0 +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, +0x3030, 0x3030, 0x3030, 0x3030, 0x3030, "\000" +IDC_MULTISIDE, 0x403, 7, 0 +0x2030, 0x6f4e, 0x656e, "\000" +IDC_MULTISIDE, 0x403, 6, 0 +0x2031, 0x4447, 0x0049, +IDC_MULTISIDE, 0x403, 6, 0 +0x2032, 0x6f4e, 0x0064, +IDC_CONDITION, 0x403, 10, 0 +0x656c, 0x7373, 0x7420, 0x6168, 0x006e, +IDC_CONDITION, 0x403, 22, 0 +0x656c, 0x7373, 0x7420, 0x6168, 0x206e, 0x726f, 0x6520, 0x7571, 0x6c61, +0x7420, 0x006f, +IDC_CONDITION, 0x403, 9, 0 +0x7165, 0x6175, 0x206c, 0x6f74, "\000" +IDC_CONDITION, 0x403, 25, 0 +0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, 0x6f20, 0x2072, 0x7165, +0x6175, 0x206c, 0x6f74, "\000" +IDC_CONDITION, 0x403, 13, 0 +0x7267, 0x6165, 0x6574, 0x2072, 0x6874, 0x6e61, "\000" +IDC_CONDITION, 0x403, 13, 0 +0x6f6e, 0x2074, 0x7165, 0x6175, 0x206c, 0x6f74, "\000" +0 END #endif @@ -3066,38 +3066,38 @@ VS_VERSION_INFO$(RA2_MODE) VERSIONINFO #else VS_VERSION_INFO VERSIONINFO #endif - FILEVERSION 1,0,0,2 - PRODUCTVERSION 1,0,0,2 - FILEFLAGSMASK 0x3fL +FILEVERSION 1, 0, 0, 2 +PRODUCTVERSION 1, 0, 0, 2 +FILEFLAGSMASK 0x3fL #ifdef _DEBUG - FILEFLAGS 0x2bL +FILEFLAGS 0x2bL #else - FILEFLAGS 0x2aL +FILEFLAGS 0x2aL #endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L +FILEOS 0x4L +FILETYPE 0x1L +FILESUBTYPE 0x0L BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "FinalAlert 2: Yuri's Revenge Mission Editor" - VALUE "CompanyName", "Electronic Arts, Inc." - VALUE "FileDescription", "FinalAlert 2: Yuri's Revenge" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "FinalAlert 2: Yuri's Revenge Mission Editor" - VALUE "LegalCopyright", "Copyright (C) 1999-2024 Electronic Arts, Inc." - VALUE "LegalTrademarks", "FinalAlert 2: Yuri's Revenge" - VALUE "OriginalFilename", "FinalAlert2YR.EXE" - VALUE "ProductName", "FinalAlert 2: Yuri's Revenge" - VALUE "ProductVersion", "2.00" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END +BLOCK "StringFileInfo" +BEGIN +BLOCK "040904b0" +BEGIN +VALUE "Comments", "FinalAlert 2: Yuri's Revenge Mission Editor" +VALUE "CompanyName", "Electronic Arts, Inc." +VALUE "FileDescription", "FinalAlert 2: Yuri's Revenge" +VALUE "FileVersion", "2.00" +VALUE "InternalName", "FinalAlert 2: Yuri's Revenge Mission Editor" +VALUE "LegalCopyright", "Copyright (C) 1999-2024 Electronic Arts, Inc." +VALUE "LegalTrademarks", "FinalAlert 2: Yuri's Revenge" +VALUE "OriginalFilename", "FinalAlert2YR.EXE" +VALUE "ProductName", "FinalAlert 2: Yuri's Revenge" +VALUE "ProductVersion", "2.00" +END +END +BLOCK "VarFileInfo" +BEGIN +VALUE "Translation", 0x409, 1200 +END END #endif @@ -3107,38 +3107,38 @@ VS_VERSION_INFO$(TS_MODE) VERSIONINFO #else VS_VERSION_INFO VERSIONINFO #endif - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL +FILEVERSION 1, 0, 0, 1 +PRODUCTVERSION 1, 0, 0, 1 +FILEFLAGSMASK 0x3fL #ifdef _DEBUG - FILEFLAGS 0x23L +FILEFLAGS 0x23L #else - FILEFLAGS 0x22L +FILEFLAGS 0x22L #endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L +FILEOS 0x4L +FILETYPE 0x1L +FILESUBTYPE 0x0L BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "FinalSun Mission Editor" - VALUE "CompanyName", "Electronic Arts, Inc." - VALUE "FileDescription", "FinalSun" - VALUE "FileVersion", "2.00" - VALUE "InternalName", "FinalSun Mission Editor" - VALUE "LegalCopyright", "Copyright (C) 1999-2024 Electronic Arts, Inc." - VALUE "LegalTrademarks", "FinalSun" - VALUE "OriginalFilename", "FinalSun.EXE" - VALUE "ProductName", "FinalSun" - VALUE "ProductVersion", "2.00" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END +BLOCK "StringFileInfo" +BEGIN +BLOCK "040904b0" +BEGIN +VALUE "Comments", "FinalSun Mission Editor" +VALUE "CompanyName", "Electronic Arts, Inc." +VALUE "FileDescription", "FinalSun" +VALUE "FileVersion", "2.00" +VALUE "InternalName", "FinalSun Mission Editor" +VALUE "LegalCopyright", "Copyright (C) 1999-2024 Electronic Arts, Inc." +VALUE "LegalTrademarks", "FinalSun" +VALUE "OriginalFilename", "FinalSun.EXE" +VALUE "ProductName", "FinalSun" +VALUE "ProductVersion", "2.00" +END +END +BLOCK "VarFileInfo" +BEGIN +VALUE "Translation", 0x409, 1200 +END END #endif @@ -3155,103 +3155,103 @@ IDR_MAIN$(TS_MODE) MENU IDR_MAIN MENU #endif BEGIN - POPUP "File" - BEGIN - MENUITEM "New", ID_FILE_NEW - MENUITEM SEPARATOR - MENUITEM "Open", ID_FILE_OPENMAP - MENUITEM SEPARATOR - MENUITEM "Save", ID_FILE_SAVE - MENUITEM "Save as", ID_FILE_SAVEAS - MENUITEM SEPARATOR - MENUITEM "Check map", ID_FILE_VALIDATEMAP - MENUITEM SEPARATOR - MENUITEM "Quit", ID_FILE_QUIT - END - POPUP "Edit" - BEGIN - MENUITEM "Undo\tCtrl+Z", ID_EDIT_UNDO - MENUITEM "Redo\tCtrl+Y", ID_EDIT_REDO - MENUITEM SEPARATOR - MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "Copy whole map", ID_EDIT_COPYWHOLEMAP - MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE - MENUITEM "Paste centered", ID_EDIT_PASTEWHOLEMAP - MENUITEM SEPARATOR - MENUITEM "Map", ID_EDIT_MAP - MENUITEM "Basic", ID_EDIT_BASICSETTINGS - MENUITEM "Special flags", ID_EDIT_SPECIALFLAGS - MENUITEM "Lighting", ID_EDIT_LIGHTING - MENUITEM SEPARATOR - MENUITEM "Singleplayer settings", ID_EDIT_SINGLEPLAYERSETTINGS - MENUITEM SEPARATOR - MENUITEM "Houses", ID_EDIT_HOUSES - MENUITEM SEPARATOR - MENUITEM "Local variables (Locals)", ID_EDIT_GLOBALVARIABLES - MENUITEM SEPARATOR - MENUITEM "Trigger editor", ID_EDIT_TRIGGEREDITOR - MENUITEM "Tag editor", ID_EDIT_TAGS - MENUITEM SEPARATOR - MENUITEM "Scripts", ID_EDIT_SCRIPTS - MENUITEM SEPARATOR - MENUITEM "Taskforces", ID_EDIT_TASKFORCES - MENUITEM "Teams", ID_EDIT_TEAMS - MENUITEM SEPARATOR - MENUITEM "AI Triggers", ID_EDIT_AITRIGGERS - MENUITEM "AI Trigger enabling", ID_EDIT_AITRIGGERENABLING - MENUITEM SEPARATOR - MENUITEM "INI editing", ID_EDIT_INIEDITING - END - POPUP "Terrain" - BEGIN - MENUITEM "Raise ground", ID_TERRAIN_HEIGHTENGROUND - MENUITEM "Lower ground", ID_TERRAIN_LOWERGROUND - MENUITEM "Flatten ground", ID_TERRAIN_FLATTEN - MENUITEM SEPARATOR - MENUITEM "Hide tileset", ID_TERRAIN_CLOAK - MENUITEM "Show every tileset", ID_TERRAIN_SHOWEVERYTILE - MENUITEM "Hide single field", ID_TERRAIN_HIDEFIELD - MENUITEM "Show all fields", ID_TERRAIN_SHOWALLFIELDS - MENUITEM SEPARATOR - MENUITEM "Raise single tile (Be careful!)", ID_TERRAIN_RAISETILE - MENUITEM "Lower single tile (Be careful!)", ID_TERRAIN_LOWERTILE - END - POPUP "Map tools" - BEGIN - MENUITEM "Change map height", ID_MAPTOOLS_CHANGEMAPHEIGHT - MENUITEM SEPARATOR - MENUITEM "Autocreate shores", ID_MAPTOOLS_AUTOCREATESHORES - MENUITEM "Auto level using cliffs", ID_MAPTOOLS_AUTOLEVEL - MENUITEM SEPARATOR - MENUITEM "Paint cliff front", ID_MAPTOOLS_FRONTCLIFF - MENUITEM "Paint cliff back", ID_MAPTOOLS_BACKCLIFF - MENUITEM SEPARATOR - MENUITEM "Search Waypoint", ID_MAPTOOLS_SEARCHWAYPOINT - MENUITEM SEPARATOR - MENUITEM "Tool Scripts", ID_MAPTOOLS_TOOLSCRIPTS - END - POPUP "Options" - BEGIN - MENUITEM "Settings", ID_OPTIONS_TIBERIANSUNOPTIONS - MENUITEM "Show minimap", ID_OPTIONS_SHOWMINIMAP - MENUITEM "Easy mode", ID_OPTIONS_SIMPLEVIEW - MENUITEM "Sounds", ID_OPTIONS_SOUNDS - MENUITEM "Show Building Outline", ID_OPTIONS_SHOWBUILDINGOUTLINE - MENUITEM "Disable AutoShore\tCTRL-A", ID_OPTIONS_DISABLEAUTOSHORE - MENUITEM "Disable AutoLat\tCTRL-L", ID_OPTIONS_DISABLEAUTOLAT - MENUITEM "Disable Slope Correction", ID_OPTIONS_DISABLESLOPECORRECTION - MENUITEM "Smooth zoom", ID_OPTIONS_SMOOTHZOOM - MENUITEM "Use default mouse cursor", ID_OPTIONS_USEDEFAULTMOUSECURSOR - END - POPUP "Help" - BEGIN - MENUITEM "Manual\tF1", ID_HELP - MENUITEM SEPARATOR - MENUITEM "Info", ID_HELP_INFO - MENUITEM "Tip of the day", ID_HELP_TIPOFTHEDAY - MENUITEM SEPARATOR - MENUITEM "Show logs", ID_HELP_SHOWLOGS - END +POPUP "File" +BEGIN +MENUITEM "New", ID_FILE_NEW +MENUITEM SEPARATOR +MENUITEM "Open", ID_FILE_OPENMAP +MENUITEM SEPARATOR +MENUITEM "Save", ID_FILE_SAVE +MENUITEM "Save as", ID_FILE_SAVEAS +MENUITEM SEPARATOR +MENUITEM "Check map", ID_FILE_VALIDATEMAP +MENUITEM SEPARATOR +MENUITEM "Quit", ID_FILE_QUIT +END +POPUP "Edit" +BEGIN +MENUITEM "Undo\tCtrl+Z", ID_EDIT_UNDO +MENUITEM "Redo\tCtrl+Y", ID_EDIT_REDO +MENUITEM SEPARATOR +MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY +MENUITEM "Copy whole map", ID_EDIT_COPYWHOLEMAP +MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE +MENUITEM "Paste centered", ID_EDIT_PASTEWHOLEMAP +MENUITEM SEPARATOR +MENUITEM "Map", ID_EDIT_MAP +MENUITEM "Basic", ID_EDIT_BASICSETTINGS +MENUITEM "Special flags", ID_EDIT_SPECIALFLAGS +MENUITEM "Lighting", ID_EDIT_LIGHTING +MENUITEM SEPARATOR +MENUITEM "Singleplayer settings", ID_EDIT_SINGLEPLAYERSETTINGS +MENUITEM SEPARATOR +MENUITEM "Houses", ID_EDIT_HOUSES +MENUITEM SEPARATOR +MENUITEM "Local variables (Locals)", ID_EDIT_GLOBALVARIABLES +MENUITEM SEPARATOR +MENUITEM "Trigger editor", ID_EDIT_TRIGGEREDITOR +MENUITEM "Tag editor", ID_EDIT_TAGS +MENUITEM SEPARATOR +MENUITEM "Scripts", ID_EDIT_SCRIPTS +MENUITEM SEPARATOR +MENUITEM "Taskforces", ID_EDIT_TASKFORCES +MENUITEM "Teams", ID_EDIT_TEAMS +MENUITEM SEPARATOR +MENUITEM "AI Triggers", ID_EDIT_AITRIGGERS +MENUITEM "AI Trigger enabling", ID_EDIT_AITRIGGERENABLING +MENUITEM SEPARATOR +MENUITEM "INI editing", ID_EDIT_INIEDITING +END +POPUP "Terrain" +BEGIN +MENUITEM "Raise ground", ID_TERRAIN_HEIGHTENGROUND +MENUITEM "Lower ground", ID_TERRAIN_LOWERGROUND +MENUITEM "Flatten ground", ID_TERRAIN_FLATTEN +MENUITEM SEPARATOR +MENUITEM "Hide tileset", ID_TERRAIN_CLOAK +MENUITEM "Show every tileset", ID_TERRAIN_SHOWEVERYTILE +MENUITEM "Hide single field", ID_TERRAIN_HIDEFIELD +MENUITEM "Show all fields", ID_TERRAIN_SHOWALLFIELDS +MENUITEM SEPARATOR +MENUITEM "Raise single tile (Be careful!)", ID_TERRAIN_RAISETILE +MENUITEM "Lower single tile (Be careful!)", ID_TERRAIN_LOWERTILE +END +POPUP "Map tools" +BEGIN +MENUITEM "Change map height", ID_MAPTOOLS_CHANGEMAPHEIGHT +MENUITEM SEPARATOR +MENUITEM "Autocreate shores", ID_MAPTOOLS_AUTOCREATESHORES +MENUITEM "Auto level using cliffs", ID_MAPTOOLS_AUTOLEVEL +MENUITEM SEPARATOR +MENUITEM "Paint cliff front", ID_MAPTOOLS_FRONTCLIFF +MENUITEM "Paint cliff back", ID_MAPTOOLS_BACKCLIFF +MENUITEM SEPARATOR +MENUITEM "Search Waypoint", ID_MAPTOOLS_SEARCHWAYPOINT +MENUITEM SEPARATOR +MENUITEM "Tool Scripts", ID_MAPTOOLS_TOOLSCRIPTS +END +POPUP "Options" +BEGIN +MENUITEM "Settings", ID_OPTIONS_TIBERIANSUNOPTIONS +MENUITEM "Show minimap", ID_OPTIONS_SHOWMINIMAP +MENUITEM "Easy mode", ID_OPTIONS_SIMPLEVIEW +MENUITEM "Sounds", ID_OPTIONS_SOUNDS +MENUITEM "Show Building Outline", ID_OPTIONS_SHOWBUILDINGOUTLINE +MENUITEM "Disable AutoShore\tCTRL-A", ID_OPTIONS_DISABLEAUTOSHORE +MENUITEM "Disable AutoLat\tCTRL-L", ID_OPTIONS_DISABLEAUTOLAT +MENUITEM "Disable Slope Correction", ID_OPTIONS_DISABLESLOPECORRECTION +MENUITEM "Smooth zoom", ID_OPTIONS_SMOOTHZOOM +MENUITEM "Use default mouse cursor", ID_OPTIONS_USEDEFAULTMOUSECURSOR +END +POPUP "Help" +BEGIN +MENUITEM "Manual\tF1", ID_HELP +MENUITEM SEPARATOR +MENUITEM "Info", ID_HELP_INFO +MENUITEM "Tip of the day", ID_HELP_TIPOFTHEDAY +MENUITEM SEPARATOR +MENUITEM "Show logs", ID_HELP_SHOWLOGS +END END #endif @@ -3262,103 +3262,103 @@ IDR_MAIN$(RA2_MODE) MENU IDR_MAIN MENU #endif BEGIN - POPUP "File" - BEGIN - MENUITEM "New", ID_FILE_NEW - MENUITEM SEPARATOR - MENUITEM "Open", ID_FILE_OPENMAP - MENUITEM SEPARATOR - MENUITEM "Save", ID_FILE_SAVE - MENUITEM "Save as", ID_FILE_SAVEAS - MENUITEM SEPARATOR - MENUITEM "Check map", ID_FILE_VALIDATEMAP - MENUITEM SEPARATOR - MENUITEM "Quit", ID_FILE_QUIT - END - POPUP "Edit" - BEGIN - MENUITEM "Undo\tCtrl+Z", ID_EDIT_UNDO - MENUITEM "Redo\tCtrl+Y", ID_EDIT_REDO - MENUITEM SEPARATOR - MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY - MENUITEM "Copy whole map", ID_EDIT_COPYWHOLEMAP - MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE - MENUITEM "Paste centered", ID_EDIT_PASTEWHOLEMAP - MENUITEM SEPARATOR - MENUITEM "Map", ID_EDIT_MAP - MENUITEM "Basic", ID_EDIT_BASICSETTINGS - MENUITEM "Special flags", ID_EDIT_SPECIALFLAGS - MENUITEM "Lighting", ID_EDIT_LIGHTING - MENUITEM SEPARATOR - MENUITEM "Singleplayer settings", ID_EDIT_SINGLEPLAYERSETTINGS - MENUITEM SEPARATOR - MENUITEM "Houses", ID_EDIT_HOUSES - MENUITEM SEPARATOR - MENUITEM "Local variables (Locals)", ID_EDIT_GLOBALVARIABLES - MENUITEM SEPARATOR - MENUITEM "Trigger editor", ID_EDIT_TRIGGEREDITOR - MENUITEM "Tag editor", ID_EDIT_TAGS - MENUITEM SEPARATOR - MENUITEM "Scripts", ID_EDIT_SCRIPTS - MENUITEM SEPARATOR - MENUITEM "Taskforces", ID_EDIT_TASKFORCES - MENUITEM "Teams", ID_EDIT_TEAMS - MENUITEM SEPARATOR - MENUITEM "AI Triggers", ID_EDIT_AITRIGGERS - MENUITEM "AI Trigger enabling", ID_EDIT_AITRIGGERENABLING - MENUITEM SEPARATOR - MENUITEM "INI editing", ID_EDIT_INIEDITING - END - POPUP "Terrain" - BEGIN - MENUITEM "Raise ground", ID_TERRAIN_HEIGHTENGROUND - MENUITEM "Lower ground", ID_TERRAIN_LOWERGROUND - MENUITEM "Flatten ground", ID_TERRAIN_FLATTEN - MENUITEM SEPARATOR - MENUITEM "Hide tileset", ID_TERRAIN_CLOAK - MENUITEM "Show every tileset", ID_TERRAIN_SHOWEVERYTILE - MENUITEM "Hide single field", ID_TERRAIN_HIDEFIELD - MENUITEM "Show all fields", ID_TERRAIN_SHOWALLFIELDS - MENUITEM SEPARATOR - MENUITEM "Raise single tile (Be careful!)", ID_TERRAIN_RAISETILE - MENUITEM "Lower single tile (Be careful!)", ID_TERRAIN_LOWERTILE - END - POPUP "Map tools" - BEGIN - MENUITEM "Change map height", ID_MAPTOOLS_CHANGEMAPHEIGHT - MENUITEM SEPARATOR - MENUITEM "Autocreate shores", ID_MAPTOOLS_AUTOCREATESHORES - MENUITEM "Auto level using cliffs", ID_MAPTOOLS_AUTOLEVEL - MENUITEM SEPARATOR - MENUITEM "Paint cliff front", ID_MAPTOOLS_FRONTCLIFF - MENUITEM "Paint cliff back", ID_MAPTOOLS_BACKCLIFF - MENUITEM SEPARATOR - MENUITEM "Search Waypoint", ID_MAPTOOLS_SEARCHWAYPOINT - MENUITEM SEPARATOR - MENUITEM "Tool Scripts", ID_MAPTOOLS_TOOLSCRIPTS - END - POPUP "Options" - BEGIN - MENUITEM "Settings", ID_OPTIONS_TIBERIANSUNOPTIONS - MENUITEM "Show minimap", ID_OPTIONS_SHOWMINIMAP - MENUITEM "Easy mode", ID_OPTIONS_SIMPLEVIEW - MENUITEM "Sounds", ID_OPTIONS_SOUNDS - MENUITEM "Show Building Outline", ID_OPTIONS_SHOWBUILDINGOUTLINE - MENUITEM "Disable AutoShore\tCTRL-A", ID_OPTIONS_DISABLEAUTOSHORE - MENUITEM "Disable AutoLat\tCTRL-L", ID_OPTIONS_DISABLEAUTOLAT - MENUITEM "Disable Slope Correction", ID_OPTIONS_DISABLESLOPECORRECTION - MENUITEM "Smooth zoom", ID_OPTIONS_SMOOTHZOOM - MENUITEM "Use default mouse cursor", ID_OPTIONS_USEDEFAULTMOUSECURSOR - END - POPUP "Help" - BEGIN - MENUITEM "Manual\tF1", ID_HELP - MENUITEM SEPARATOR - MENUITEM "Info", ID_HELP_INFO - MENUITEM "Tip of the day", ID_HELP_TIPOFTHEDAY - MENUITEM SEPARATOR - MENUITEM "Show logs", ID_HELP_SHOWLOGS - END +POPUP "File" +BEGIN +MENUITEM "New", ID_FILE_NEW +MENUITEM SEPARATOR +MENUITEM "Open", ID_FILE_OPENMAP +MENUITEM SEPARATOR +MENUITEM "Save", ID_FILE_SAVE +MENUITEM "Save as", ID_FILE_SAVEAS +MENUITEM SEPARATOR +MENUITEM "Check map", ID_FILE_VALIDATEMAP +MENUITEM SEPARATOR +MENUITEM "Quit", ID_FILE_QUIT +END +POPUP "Edit" +BEGIN +MENUITEM "Undo\tCtrl+Z", ID_EDIT_UNDO +MENUITEM "Redo\tCtrl+Y", ID_EDIT_REDO +MENUITEM SEPARATOR +MENUITEM "Copy\tCtrl+C", ID_EDIT_COPY +MENUITEM "Copy whole map", ID_EDIT_COPYWHOLEMAP +MENUITEM "Paste\tCtrl+V", ID_EDIT_PASTE +MENUITEM "Paste centered", ID_EDIT_PASTEWHOLEMAP +MENUITEM SEPARATOR +MENUITEM "Map", ID_EDIT_MAP +MENUITEM "Basic", ID_EDIT_BASICSETTINGS +MENUITEM "Special flags", ID_EDIT_SPECIALFLAGS +MENUITEM "Lighting", ID_EDIT_LIGHTING +MENUITEM SEPARATOR +MENUITEM "Singleplayer settings", ID_EDIT_SINGLEPLAYERSETTINGS +MENUITEM SEPARATOR +MENUITEM "Houses", ID_EDIT_HOUSES +MENUITEM SEPARATOR +MENUITEM "Local variables (Locals)", ID_EDIT_GLOBALVARIABLES +MENUITEM SEPARATOR +MENUITEM "Trigger editor", ID_EDIT_TRIGGEREDITOR +MENUITEM "Tag editor", ID_EDIT_TAGS +MENUITEM SEPARATOR +MENUITEM "Scripts", ID_EDIT_SCRIPTS +MENUITEM SEPARATOR +MENUITEM "Taskforces", ID_EDIT_TASKFORCES +MENUITEM "Teams", ID_EDIT_TEAMS +MENUITEM SEPARATOR +MENUITEM "AI Triggers", ID_EDIT_AITRIGGERS +MENUITEM "AI Trigger enabling", ID_EDIT_AITRIGGERENABLING +MENUITEM SEPARATOR +MENUITEM "INI editing", ID_EDIT_INIEDITING +END +POPUP "Terrain" +BEGIN +MENUITEM "Raise ground", ID_TERRAIN_HEIGHTENGROUND +MENUITEM "Lower ground", ID_TERRAIN_LOWERGROUND +MENUITEM "Flatten ground", ID_TERRAIN_FLATTEN +MENUITEM SEPARATOR +MENUITEM "Hide tileset", ID_TERRAIN_CLOAK +MENUITEM "Show every tileset", ID_TERRAIN_SHOWEVERYTILE +MENUITEM "Hide single field", ID_TERRAIN_HIDEFIELD +MENUITEM "Show all fields", ID_TERRAIN_SHOWALLFIELDS +MENUITEM SEPARATOR +MENUITEM "Raise single tile (Be careful!)", ID_TERRAIN_RAISETILE +MENUITEM "Lower single tile (Be careful!)", ID_TERRAIN_LOWERTILE +END +POPUP "Map tools" +BEGIN +MENUITEM "Change map height", ID_MAPTOOLS_CHANGEMAPHEIGHT +MENUITEM SEPARATOR +MENUITEM "Autocreate shores", ID_MAPTOOLS_AUTOCREATESHORES +MENUITEM "Auto level using cliffs", ID_MAPTOOLS_AUTOLEVEL +MENUITEM SEPARATOR +MENUITEM "Paint cliff front", ID_MAPTOOLS_FRONTCLIFF +MENUITEM "Paint cliff back", ID_MAPTOOLS_BACKCLIFF +MENUITEM SEPARATOR +MENUITEM "Search Waypoint", ID_MAPTOOLS_SEARCHWAYPOINT +MENUITEM SEPARATOR +MENUITEM "Tool Scripts", ID_MAPTOOLS_TOOLSCRIPTS +END +POPUP "Options" +BEGIN +MENUITEM "Settings", ID_OPTIONS_TIBERIANSUNOPTIONS +MENUITEM "Show minimap", ID_OPTIONS_SHOWMINIMAP +MENUITEM "Easy mode", ID_OPTIONS_SIMPLEVIEW +MENUITEM "Sounds", ID_OPTIONS_SOUNDS +MENUITEM "Show Building Outline", ID_OPTIONS_SHOWBUILDINGOUTLINE +MENUITEM "Disable AutoShore\tCTRL-A", ID_OPTIONS_DISABLEAUTOSHORE +MENUITEM "Disable AutoLat\tCTRL-L", ID_OPTIONS_DISABLEAUTOLAT +MENUITEM "Disable Slope Correction", ID_OPTIONS_DISABLESLOPECORRECTION +MENUITEM "Smooth zoom", ID_OPTIONS_SMOOTHZOOM +MENUITEM "Use default mouse cursor", ID_OPTIONS_USEDEFAULTMOUSECURSOR +END +POPUP "Help" +BEGIN +MENUITEM "Manual\tF1", ID_HELP +MENUITEM SEPARATOR +MENUITEM "Info", ID_HELP_INFO +MENUITEM "Tip of the day", ID_HELP_TIPOFTHEDAY +MENUITEM SEPARATOR +MENUITEM "Show logs", ID_HELP_SHOWLOGS +END END #endif @@ -3370,33 +3370,33 @@ END IDR_MAINFRAME TOOLBAR 16, 15 BEGIN - BUTTON ID_FILE_NEW - BUTTON ID_FILE_OPENMAP - BUTTON ID_FILE_SAVE +BUTTON ID_FILE_NEW +BUTTON ID_FILE_OPENMAP +BUTTON ID_FILE_SAVE END IDR_TERRAINBAR TOOLBAR 16, 15 BEGIN - BUTTON ID_TERRAIN_HEIGHTENGROUND - BUTTON ID_TERRAIN_LOWERGROUND - BUTTON ID_TERRAIN_FLATTEN - BUTTON ID_TERRAIN_CLOAK - BUTTON ID_TERRAIN_SHOWEVERYTILE - BUTTON ID_TERRAIN_HIDEFIELD - BUTTON ID_TERRAIN_SHOWALLFIELDS - BUTTON ID_TERRAIN_RAISETILE - BUTTON ID_TERRAIN_LOWERTILE - SEPARATOR - BUTTON ID_MARBLEMADNESS +BUTTON ID_TERRAIN_HEIGHTENGROUND +BUTTON ID_TERRAIN_LOWERGROUND +BUTTON ID_TERRAIN_FLATTEN +BUTTON ID_TERRAIN_CLOAK +BUTTON ID_TERRAIN_SHOWEVERYTILE +BUTTON ID_TERRAIN_HIDEFIELD +BUTTON ID_TERRAIN_SHOWALLFIELDS +BUTTON ID_TERRAIN_RAISETILE +BUTTON ID_TERRAIN_LOWERTILE +SEPARATOR +BUTTON ID_MARBLEMADNESS END IDR_CLIFFBAR TOOLBAR 16, 15 BEGIN - BUTTON ID_MAPTOOLS_FRONTCLIFF - BUTTON ID_MAPTOOLS_BACKCLIFF - SEPARATOR - BUTTON ID_MAPTOOLS_AUTOLEVEL - BUTTON ID_MAPTOOLS_AUTOCREATESHORES +BUTTON ID_MAPTOOLS_FRONTCLIFF +BUTTON ID_MAPTOOLS_BACKCLIFF +SEPARATOR +BUTTON ID_MAPTOOLS_AUTOLEVEL +BUTTON ID_MAPTOOLS_AUTOCREATESHORES END @@ -3407,16 +3407,16 @@ END IDR_MAIN ACCELERATORS BEGIN - "A", ID_OPTIONS_DISABLEAUTOSHORE, VIRTKEY, CONTROL, NOINVERT - "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT - "F", ID_MARBLEMADNESS, VIRTKEY, CONTROL, NOINVERT - "L", ID_OPTIONS_DISABLEAUTOLAT, VIRTKEY, CONTROL, NOINVERT - "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT - "Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT - "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT - "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT - "O", ID_FILE_OPENMAP, VIRTKEY, CONTROL, NOINVERT - "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT +"A", ID_OPTIONS_DISABLEAUTOSHORE, VIRTKEY, CONTROL, NOINVERT +"C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT +"F", ID_MARBLEMADNESS, VIRTKEY, CONTROL, NOINVERT +"L", ID_OPTIONS_DISABLEAUTOLAT, VIRTKEY, CONTROL, NOINVERT +"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT +"Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT +"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT +"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT +"O", ID_FILE_OPENMAP, VIRTKEY, CONTROL, NOINVERT +"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT END @@ -3432,7 +3432,7 @@ IDD_INFO$(RA2_MODE) AFX_DIALOG_LAYOUT IDD_INFO AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif @@ -3443,7 +3443,7 @@ IDD_INFO$(TS_MODE) AFX_DIALOG_LAYOUT IDD_INFO AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif @@ -3454,7 +3454,7 @@ IDD_LOADING$(RA2_MODE) AFX_DIALOG_LAYOUT IDD_LOADING AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif @@ -3465,18 +3465,18 @@ IDD_LOADING$(TS_MODE) AFX_DIALOG_LAYOUT IDD_LOADING AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif IDD_FINALSUN_DIALOG AFX_DIALOG_LAYOUT BEGIN - 0 +0 END IDD_TIP AFX_DIALOG_LAYOUT BEGIN - 0 +0 END #if defined(APSTUDIO_INVOKED) || defined(TS_MODE) @@ -3486,7 +3486,7 @@ IDD_TSOPTIONS$(TS_MODE) AFX_DIALOG_LAYOUT IDD_TSOPTIONS AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif @@ -3497,33 +3497,33 @@ IDD_TSOPTIONS$(RA2_MODE) AFX_DIALOG_LAYOUT IDD_TSOPTIONS AFX_DIALOG_LAYOUT #endif BEGIN - 0 +0 END #endif IDD_TRIGGEREDITOR AFX_DIALOG_LAYOUT BEGIN - 0 +0 END IDD_TRIGGERACTIONS AFX_DIALOG_LAYOUT BEGIN - 0 +0 END IDD_TRIGGEREVENTS AFX_DIALOG_LAYOUT BEGIN - 0 +0 END IDD_TRIGGEROPTIONS AFX_DIALOG_LAYOUT BEGIN - 0 +0 END IDD_MAPVALIDATOR AFX_DIALOG_LAYOUT BEGIN - 0 +0 END @@ -3534,58 +3534,58 @@ END STRINGTABLE BEGIN - IDS_BUILTBY "Matthias Wagner" - IDS_VERSIONTEXT "Version 2.00" - IDS_VERSION "2.00" - IDS_VERSIONTEXTTS "Version 2.00" +IDS_BUILTBY "Matthias Wagner" +IDS_VERSIONTEXT "Version 2.00" +IDS_VERSION "2.00" +IDS_VERSIONTEXTTS "Version 2.00" END STRINGTABLE BEGIN - ID_TERRAIN_HEIGHTENGROUND "Heighten ground (slope logic)" - ID_TERRAIN_LOWERGROUND "Lower ground (slope logic)" - ID_TERRAIN_PAINT "Paint terrain types" - ID_TERRAIN_RISETILE "Raise a single tile" - ID_TERRAIN_RAISETILE "Raise a single tile" - ID_TERRAIN_LOWERTILE "Lower a single tile" +ID_TERRAIN_HEIGHTENGROUND "Heighten ground (slope logic)" +ID_TERRAIN_LOWERGROUND "Lower ground (slope logic)" +ID_TERRAIN_PAINT "Paint terrain types" +ID_TERRAIN_RISETILE "Raise a single tile" +ID_TERRAIN_RAISETILE "Raise a single tile" +ID_TERRAIN_LOWERTILE "Lower a single tile" END STRINGTABLE BEGIN - ID_TERRAIN_FLATTEN "Make terrain flat" - ID_TERRAIN_CLOAK "Hide tileset" - ID_TERRAIN_SHOWEVERYTILE "Show all tilesets" - ID_TERRAIN_SHOWALLFIELDS "Show all fields" - ID_TERRAIN_HIDEFIELD "Hide single field" +ID_TERRAIN_FLATTEN "Make terrain flat" +ID_TERRAIN_CLOAK "Hide tileset" +ID_TERRAIN_SHOWEVERYTILE "Show all tilesets" +ID_TERRAIN_SHOWALLFIELDS "Show all fields" +ID_TERRAIN_HIDEFIELD "Hide single field" END STRINGTABLE BEGIN - ID_FILE_NEW "New map" - ID_FILE_SAVE "Save map" - IDS_LINEARVERSION "3" +ID_FILE_NEW "New map" +ID_FILE_SAVE "Save map" +IDS_LINEARVERSION "3" END STRINGTABLE BEGIN - ID_FILE_OPENMAP "Open map" +ID_FILE_OPENMAP "Open map" END STRINGTABLE BEGIN - ID_MAPTOOLS_AUTOLEVEL "AutoLevel terrain height using cliffs" - ID_MAPTOOLS_FRONTCLIFF "Paint cliff front" - ID_MAPTOOLS_BACKCLIFF "Paint cliff back" +ID_MAPTOOLS_AUTOLEVEL "AutoLevel terrain height using cliffs" +ID_MAPTOOLS_FRONTCLIFF "Paint cliff front" +ID_MAPTOOLS_BACKCLIFF "Paint cliff back" END STRINGTABLE BEGIN - ID_MAPTOOLS_AUTOCREATESHORES "AutoCreate shores" +ID_MAPTOOLS_AUTOCREATESHORES "AutoCreate shores" END STRINGTABLE BEGIN - ID_MARBLEMADNESS "Switch Framework Mode" +ID_MARBLEMADNESS "Switch Framework Mode" END #endif // Englisch (USA) resources diff --git a/MissionEditor/MultiSaveOptionsDlg.cpp b/MissionEditor/MultiSaveOptionsDlg.cpp index dc9d3bb..4140e5e 100644 --- a/MissionEditor/MultiSaveOptionsDlg.cpp +++ b/MissionEditor/MultiSaveOptionsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MultiSaveOptionsDlg.cpp: Implementierungsdatei diff --git a/MissionEditor/MultiSaveOptionsDlg.h b/MissionEditor/MultiSaveOptionsDlg.h index 0e0bcd4..a2ecb9e 100644 --- a/MissionEditor/MultiSaveOptionsDlg.h +++ b/MissionEditor/MultiSaveOptionsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MULTISAVEOPTIONSDLG_H__72E7BEC1_E8B2_11D4_9C88_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CMultiSaveOptionsDlg : public CDialog { -// Konstruktion + // Konstruktion public: CMultiSaveOptionsDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CMultiSaveOptionsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/MyComboBox.cpp b/MissionEditor/MyComboBox.cpp index a3efe6e..474c9aa 100644 --- a/MissionEditor/MyComboBox.cpp +++ b/MissionEditor/MyComboBox.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MyComboBox.cpp: Implementierungsdatei @@ -57,19 +57,19 @@ END_MESSAGE_MAP() This will automatically send a CBN_EDITCHANGE command. Also it will set the window text to the selected item */ -void CMyComboBox::OnSelchange() +void CMyComboBox::OnSelchange() { CString SelectedItem; - GetLBText(GetCurSel(),SelectedItem); + GetLBText(GetCurSel(), SelectedItem); + - SetWindowText(SelectedItem); - + WPARAM wparam; - int ctrlid=GetDlgCtrlID(); - WORD command=CBN_EDITCHANGE; - memcpy((BYTE*)&wparam+2, &command, 2); + int ctrlid = GetDlgCtrlID(); + WORD command = CBN_EDITCHANGE; + memcpy((BYTE*)&wparam + 2, &command, 2); memcpy((BYTE*)&wparam, &ctrlid, 2); - GetOwner()->SendMessage(WM_COMMAND,wparam,(LPARAM)m_hWnd); - + GetOwner()->SendMessage(WM_COMMAND, wparam, (LPARAM)m_hWnd); + } diff --git a/MissionEditor/MyComboBox.h b/MissionEditor/MyComboBox.h index 500e3db..71fb87c 100644 --- a/MissionEditor/MyComboBox.h +++ b/MissionEditor/MyComboBox.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MYCOMBOBOX_H__6B1D6F02_A9A7_11D3_B63B_B4DF98412640__INCLUDED_) @@ -32,22 +32,22 @@ class CMyComboBox : public CComboBox { -// Konstruktion + // Konstruktion public: CMyComboBox(); -// Attribute + // Attribute public: -// Operationen + // Operationen public: -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CMyComboBox) - //}}AFX_VIRTUAL + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CMyComboBox) + //}}AFX_VIRTUAL -// Implementierung + // Implementierung public: virtual ~CMyComboBox(); diff --git a/MissionEditor/MyViewFrame.cpp b/MissionEditor/MyViewFrame.cpp index 7f7cbbd..91c132f 100644 --- a/MissionEditor/MyViewFrame.cpp +++ b/MissionEditor/MyViewFrame.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // MyViewFrame.cpp: Implementierungsdatei @@ -38,7 +38,7 @@ IMPLEMENT_DYNCREATE(CMyViewFrame, CFrameWnd) CMyViewFrame::CMyViewFrame() { - m_isoview=0; + m_isoview = 0; } CMyViewFrame::~CMyViewFrame() @@ -60,95 +60,93 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CMyViewFrame -BOOL CMyViewFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) +BOOL CMyViewFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { SIZE z; - z.cx=200; - z.cy=200; + z.cx = 200; + z.cy = 200; CRect r; - r.right=200; - r.bottom=200; - + r.right = 200; + r.bottom = 200; - if(!m_Splitter.CreateStatic(this,1,2)) return FALSE; - - if(!m_Splitter.CreateView(0,0, + if (!m_Splitter.CreateStatic(this, 1, 2)) return FALSE; + + + if (!m_Splitter.CreateView(0, 0, RUNTIME_CLASS(CViewObjects), z, pContext)) return FALSE; - if(!m_Splitter.CreateView(0,1, + if (!m_Splitter.CreateView(0, 1, RUNTIME_CLASS(CRightFrame), z, pContext)) return FALSE; OutputDebugString("CMyViewFrame::OnCreateClient(): windows created\n"); - m_rightFrame=(CRightFrame*)m_Splitter.GetPane(0,1); - - m_isoview=(CIsoView*)m_rightFrame->m_Splitter.GetPane(0,0); - m_isoview->owner=this; - m_browser=(CTileSetBrowserFrame*)m_rightFrame->m_Splitter.GetPane(1,0); - m_objectview=(CViewObjects*)m_Splitter.GetPane(0,0); + m_rightFrame = (CRightFrame*)m_Splitter.GetPane(0, 1); + + m_isoview = (CIsoView*)m_rightFrame->m_Splitter.GetPane(0, 0); + m_isoview->owner = this; + m_browser = (CTileSetBrowserFrame*)m_rightFrame->m_Splitter.GetPane(1, 0); + m_objectview = (CViewObjects*)m_Splitter.GetPane(0, 0); // the minimap is not a child window right now, but it is created here though auto miniMapClass = AfxRegisterWndClass(0, m_hArrowCursor, static_cast(::GetStockObject(GRAY_BRUSH))); - m_minimap.CreateEx(0, miniMapClass, "Minimap", WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE, r, NULL, 0); - //m_minimap.Create(NULL, "Minimap", WS_OVERLAPPED) + m_minimap.CreateEx(0, miniMapClass, "Minimap", WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE, r, NULL, 0); + //m_minimap.Create(NULL, "Minimap", WS_OVERLAPPED) m_minimap.UpdateView(); - - if(!m_statbar.CreateEx(this,SBARS_SIZEGRIP | SBT_TOOLTIPS)) return FALSE; - + + if (!m_statbar.CreateEx(this, SBARS_SIZEGRIP | SBT_TOOLTIPS)) return FALSE; + return CFrameWnd::OnCreateClient(lpcs, pContext); } -void CMyViewFrame::OnSysCommand(UINT nID, LPARAM lParam) +void CMyViewFrame::OnSysCommand(UINT nID, LPARAM lParam) { -if(nID==SC_CLOSE) - { + if (nID == SC_CLOSE) { // ok now just hide the window ShowWindow(SW_HIDE); return; - } + } CFrameWnd::OnSysCommand(nID, lParam); } -void CMyViewFrame::OnSize(UINT nType, int cx, int cy) +void CMyViewFrame::OnSize(UINT nType, int cx, int cy) { // we now check if our frame window has already created its child windows // this is true at the second OnSize // TODO: replace static - static BOOL wasHere=FALSE; - if(wasHere==FALSE) - { - wasHere=TRUE; + static BOOL wasHere = FALSE; + if (wasHere == FALSE) { + wasHere = TRUE; return; } CFrameWnd::OnSize(nType, cx, cy); - CStatusBarCtrl& stat=m_statbar.GetStatusBarCtrl(); - + CStatusBarCtrl& stat = m_statbar.GetStatusBarCtrl(); + m_statbar.ShowWindow(SW_SHOW); CRect sr; GetWindowRect(sr); //int Widths[]={sr.right-80,80,-1}; - int Widths[]={sr.right-sr.left-130,-1}; + int Widths[] = { sr.right - sr.left - 130,-1 }; stat.SetParts(2, Widths); stat.SetSimple(FALSE); - m_statbar.ShowWindow(SW_SHOW); + m_statbar.ShowWindow(SW_SHOW); } -void CMyViewFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) +void CMyViewFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { - lpMMI->ptMinTrackSize.x=260; - lpMMI->ptMinTrackSize.y=150; + lpMMI->ptMinTrackSize.x = 260; + lpMMI->ptMinTrackSize.y = 150; CFrameWnd::OnGetMinMaxInfo(lpMMI); } -void CMyViewFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CMyViewFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { m_isoview->SendMessage(WM_KEYDOWN, nChar, nFlags); // CFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags); @@ -156,22 +154,22 @@ void CMyViewFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) -void CMyViewFrame::PostNcDestroy() +void CMyViewFrame::PostNcDestroy() { // do not call CFrameWnd::PostNcDestroy(), as long as MyViewFrame is not on the heap! // CFrameWnd::PostNcDestroy(); } -void CMyViewFrame::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) +void CMyViewFrame::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen - + // CFrameWnd::OnKeyUp(nChar, nRepCnt, nFlags); } -void CMyViewFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void CMyViewFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen - + // CFrameWnd::OnChar(nChar, nRepCnt, nFlags); } diff --git a/MissionEditor/MyViewFrame.h b/MissionEditor/MyViewFrame.h index 462a194..dce1a78 100644 --- a/MissionEditor/MyViewFrame.h +++ b/MissionEditor/MyViewFrame.h @@ -1,28 +1,28 @@ /* - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_MYVIEWFRAME_H__98929AE1_9B75_11D3_B63B_D046A7216340__INCLUDED_) #define AFX_MYVIEWFRAME_H__98929AE1_9B75_11D3_B63B_D046A7216340__INCLUDED_ #include "IsoView.h" - + #if _MSC_VER > 1000 #pragma once #endif @@ -43,9 +43,9 @@ class CMyViewFrame : public CFrameWnd { DECLARE_DYNCREATE(CMyViewFrame) protected: - -// attributes + + // attributes public: CMiniMap m_minimap; CStatusBar m_statbar; @@ -53,24 +53,24 @@ public: CIsoView* m_isoview; CSplitterWnd m_Splitter; -// operations + // operations public: CTileSetBrowserFrame* m_browser; CRightFrame* m_rightFrame; - CMyViewFrame(); + CMyViewFrame(); ~CMyViewFrame(); -// overwriteables - - //{{AFX_VIRTUAL(CMyViewFrame) - protected: + // overwriteables + + //{{AFX_VIRTUAL(CMyViewFrame) +protected: virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); virtual void PostNcDestroy(); //}}AFX_VIRTUAL // implementation protected: - + // generated message maps //{{AFX_MSG(CMyViewFrame) afx_msg void OnSysCommand(UINT nID, LPARAM lParam); diff --git a/MissionEditor/NewMap.cpp b/MissionEditor/NewMap.cpp index 7ba9409..24178e6 100644 --- a/MissionEditor/NewMap.cpp +++ b/MissionEditor/NewMap.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMap.cpp: Implementierungsdatei @@ -99,24 +99,24 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMap -BOOL CNewMap::OnInitDialog() +BOOL CNewMap::OnInitDialog() { CDialog::OnInitDialog(); // preset some stuff - m_ImportOverlay=TRUE; - m_ImportUnits=TRUE; + m_ImportOverlay = TRUE; + m_ImportUnits = TRUE; m_OK.EnableWindow(FALSE); - m_ImportTrees=TRUE; - m_PrepareHouses=TRUE; - m_AutoProduction=TRUE; - m_Theater=0; - m_Import=1; - m_Width=64; - m_Height=64; - + m_ImportTrees = TRUE; + m_PrepareHouses = TRUE; + m_AutoProduction = TRUE; + m_Theater = 0; + m_Import = 1; + m_Width = 64; + m_Height = 64; - CComboBox& house=*((CComboBox*)(GetDlgItem(IDC_HOUSE))); + + CComboBox& house = *((CComboBox*)(GetDlgItem(IDC_HOUSE))); int i; for (auto const& [seq, id] : rules[HOUSES]) { house.AddString(id); @@ -131,30 +131,29 @@ BOOL CNewMap::OnInitDialog() theater.AddString(THEATER2); #endif - m_Theater=0; + m_Theater = 0; UpdateData(FALSE); - + UpdateStrings(); - + // set cursor to wait - SetCursor(LoadCursor(NULL,IDC_WAIT)); + SetCursor(LoadCursor(NULL, IDC_WAIT)); - CString maps=CString(u8AppDataPath.c_str())+"\\stdmaps\\*.mpr"; + CString maps = CString(u8AppDataPath.c_str()) + "\\stdmaps\\*.mpr"; CFileFind ff; - - if(ff.FindFile(maps)) - { - BOOL bFileAvailable=TRUE; - while(bFileAvailable) { - bFileAvailable=ff.FindNextFile(); - CString file=ff.GetFileName(); + if (ff.FindFile(maps)) { + BOOL bFileAvailable = TRUE; + while (bFileAvailable) { + bFileAvailable = ff.FindNextFile(); + + CString file = ff.GetFileName(); m_ImportFile.AddString(file); } @@ -166,25 +165,25 @@ BOOL CNewMap::OnInitDialog() // set cursor to ready SetCursor(m_hArrowCursor); - - return TRUE; + + return TRUE; } -void CNewMap::OnBrowse() +void CNewMap::OnBrowse() { UpdateData(); - CMapOpenDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "TS maps|*.mpr;*.map|TS multi maps|*.mpr|TS single maps|*.map|"); + CMapOpenDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "TS maps|*.mpr;*.map|TS multi maps|*.mpr|TS single maps|*.map|"); char cuPath[MAX_PATH]; GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; - if(dlg.DoModal()==IDCANCEL) return; - + if (dlg.DoModal() == IDCANCEL) return; + m_ImportFile.SetWindowText(dlg.GetPathName()); UpdateData(FALSE); @@ -193,36 +192,33 @@ void CNewMap::OnBrowse() -void CNewMap::OnOK() +void CNewMap::OnOK() { - UpdateData(); + UpdateData(); CDialog::OnOK(); } -void CNewMap::OnMultiplayer() +void CNewMap::OnMultiplayer() { UpdateData(); - CButton& ph=*((CButton*)(GetDlgItem(IDC_PREPAREHOUSES))); - CButton& autoprod=*((CButton*)(GetDlgItem(IDC_AUTOPROD))); - CComboBox& house=*((CComboBox*)(GetDlgItem(IDC_HOUSE))); - - if(m_Multiplayer) - { + CButton& ph = *((CButton*)(GetDlgItem(IDC_PREPAREHOUSES))); + CButton& autoprod = *((CButton*)(GetDlgItem(IDC_AUTOPROD))); + CComboBox& house = *((CComboBox*)(GetDlgItem(IDC_HOUSE))); + + if (m_Multiplayer) { ph.EnableWindow(FALSE); autoprod.EnableWindow(FALSE); - m_AutoProduction=FALSE; + m_AutoProduction = FALSE; house.EnableWindow(FALSE); - m_PrepareHouses=FALSE; - } - else - { + m_PrepareHouses = FALSE; + } else { autoprod.EnableWindow(TRUE); - m_AutoProduction=TRUE; + m_AutoProduction = TRUE; ph.EnableWindow(TRUE); house.EnableWindow(TRUE); - m_PrepareHouses=TRUE; + m_PrepareHouses = TRUE; } UpdateData(FALSE); @@ -246,7 +242,7 @@ void CNewMap::UpdateStrings() SetWindowText(GetLanguageStringACP("NewMapCap")); } -void CNewMap::OnEditchangeImportfile() +void CNewMap::OnEditchangeImportfile() { UpdateData(); @@ -254,32 +250,31 @@ void CNewMap::OnEditchangeImportfile() CString file; m_ImportFile.GetWindowText(file); - m_MapToImport=file; + m_MapToImport = file; - if(file.Find(":")<0) - { - m_MapToImport=CString(u8AppDataPath.c_str())+"\\stdmaps\\"; - m_MapToImport+=file; - } + if (file.Find(":") < 0) { + m_MapToImport = CString(u8AppDataPath.c_str()) + "\\stdmaps\\"; + m_MapToImport += file; + } + + cmap.InsertFile(m_MapToImport, "Map"); - cmap.InsertFile(m_MapToImport,"Map"); - if (!cmap.TryGetSection("Map")) { m_OK.EnableWindow(FALSE); return; } - m_OK.EnableWindow(TRUE); + m_OK.EnableWindow(TRUE); } -void CNewMap::OnImport() +void CNewMap::OnImport() { m_OK.EnableWindow(FALSE); - OnEditchangeImportfile(); + OnEditchangeImportfile(); } -void CNewMap::OnNew() +void CNewMap::OnNew() { - m_OK.EnableWindow(TRUE); + m_OK.EnableWindow(TRUE); } diff --git a/MissionEditor/NewMap.h b/MissionEditor/NewMap.h index a65147e..fa3ef89 100644 --- a/MissionEditor/NewMap.h +++ b/MissionEditor/NewMap.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAP_H__868C3FC0_AF27_11D3_B63B_BE68077E9F41__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMap : public CDialog { -// Konstruktion + // Konstruktion public: CString m_MapToImport; void UpdateStrings(); @@ -60,7 +60,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMap) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewMapCreateDlg.cpp b/MissionEditor/NewMapCreateDlg.cpp index 2da20b7..0b9232d 100644 --- a/MissionEditor/NewMapCreateDlg.cpp +++ b/MissionEditor/NewMapCreateDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMapCreateDlg.cpp: Implementierungsdatei @@ -63,13 +63,13 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMapCreateDlg -BOOL CNewMapCreateDlg::OnInitDialog() +BOOL CNewMapCreateDlg::OnInitDialog() { CDialog::OnInitDialog(); - m_CreateType=0; + m_CreateType = 0; UpdateData(FALSE); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/NewMapCreateDlg.h b/MissionEditor/NewMapCreateDlg.h index 6c42f3e..e9fa8f3 100644 --- a/MissionEditor/NewMapCreateDlg.h +++ b/MissionEditor/NewMapCreateDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAPCREATEDLG_H__F7D62442_C6DF_11D4_9C87_E63AC3E34349__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMapCreateDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewMapCreateDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -47,7 +47,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMapCreateDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewMapCreateNewDlg.cpp b/MissionEditor/NewMapCreateNewDlg.cpp index c78eec8..710fd9b 100644 --- a/MissionEditor/NewMapCreateNewDlg.cpp +++ b/MissionEditor/NewMapCreateNewDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMapCreateNewDlg.cpp: Implementierungsdatei @@ -68,16 +68,16 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMapCreateNewDlg -BOOL CNewMapCreateNewDlg::OnInitDialog() +BOOL CNewMapCreateNewDlg::OnInitDialog() { CDialog::OnInitDialog(); - CComboBox& theater=*((CComboBox*)GetDlgItem(IDC_THEATER)); + CComboBox& theater = *((CComboBox*)GetDlgItem(IDC_THEATER)); theater.AddString(THEATER0); theater.AddString(THEATER1); #ifdef RA2_MODE theater.AddString(THEATER2); - if(yuri_mode) // MW YR support + if (yuri_mode) // MW YR support { theater.AddString(THEATER3); theater.AddString(THEATER4); @@ -86,36 +86,34 @@ BOOL CNewMapCreateNewDlg::OnInitDialog() #endif - m_Theater=0; - m_Width=50; - m_Height=50; - m_StartingHeight=0; + m_Theater = 0; + m_Width = 50; + m_Height = 50; + m_StartingHeight = 0; UpdateData(FALSE); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CNewMapCreateNewDlg::OnOK() +void CNewMapCreateNewDlg::OnOK() { - + UpdateData(TRUE); - if(m_Width>400 || m_Height>400 || m_Width<16 || m_Height<16 || (m_Width + m_Height) > 512) - { - MessageBox("Width and Height must both be between 16 and 400 and both added must be less than 512.","Error"); + if (m_Width > 400 || m_Height > 400 || m_Width < 16 || m_Height < 16 || (m_Width + m_Height) > 512) { + MessageBox("Width and Height must both be between 16 and 400 and both added must be less than 512.", "Error"); return; } - if(m_Width+m_Height>256) - { + if (m_Width + m_Height > 256) { #ifdef RA2_MODE - int res=MessageBox("Width + height is bigger than 256, this may cause problems in RA2. Continue?","Warning",MB_YESNO); + int res = MessageBox("Width + height is bigger than 256, this may cause problems in RA2. Continue?", "Warning", MB_YESNO); #else - int res=MessageBox("Width + height is bigger than 256, this may cause problems in TS. Continue?","Warning",MB_YESNO); + int res = MessageBox("Width + height is bigger than 256, this may cause problems in TS. Continue?", "Warning", MB_YESNO); #endif - if(res==IDNO) return; + if (res == IDNO) return; } CDialog::OnOK(); diff --git a/MissionEditor/NewMapCreateNewDlg.h b/MissionEditor/NewMapCreateNewDlg.h index 0951e0c..866321d 100644 --- a/MissionEditor/NewMapCreateNewDlg.h +++ b/MissionEditor/NewMapCreateNewDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAPCREATENEWDLG_H__F7D62443_C6DF_11D4_9C87_E63AC3E34349__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMapCreateNewDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewMapCreateNewDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -49,7 +49,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMapCreateNewDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewMapImportDlg.cpp b/MissionEditor/NewMapImportDlg.cpp index de615a9..350ff3d 100644 --- a/MissionEditor/NewMapImportDlg.cpp +++ b/MissionEditor/NewMapImportDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMapImportDlg.cpp: Implementierungsdatei @@ -69,50 +69,49 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMapImportDlg -void CNewMapImportDlg::OnBrowse() +void CNewMapImportDlg::OnBrowse() { UpdateData(); //CComboBox* m_ImportFile=(CComboBox*)GetDlgItem(IDC_IMPORTFILE); - CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "All files|*.mpr;*.map;*.bmp|TS/RA2 multi maps|*.mpr|TS/RA2 single maps|*.map|Windows bitmaps|*.bmp|"); + CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST, "All files|*.mpr;*.map;*.bmp|TS/RA2 multi maps|*.mpr|TS/RA2 single maps|*.map|Windows bitmaps|*.bmp|"); char cuPath[MAX_PATH]; GetCurrentDirectory(MAX_PATH, cuPath); - dlg.m_ofn.lpstrInitialDir=cuPath; + dlg.m_ofn.lpstrInitialDir = cuPath; - if(theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir=(char*)(LPCTSTR)theApp.m_Options.TSExe; + if (theApp.m_Options.TSExe.GetLength()) dlg.m_ofn.lpstrInitialDir = (char*)(LPCTSTR)theApp.m_Options.TSExe; - if(dlg.DoModal()==IDCANCEL) return; - - m_ImportFile=dlg.GetPathName(); + if (dlg.DoModal() == IDCANCEL) return; + + m_ImportFile = dlg.GetPathName(); UpdateData(FALSE); } -BOOL CNewMapImportDlg::OnInitDialog() +BOOL CNewMapImportDlg::OnInitDialog() { CDialog::OnInitDialog(); - - CComboBox* m_ImportFile=(CComboBox*)GetDlgItem(IDC_IMPORTFILE); + + CComboBox* m_ImportFile = (CComboBox*)GetDlgItem(IDC_IMPORTFILE); CString maps = CString(u8AppDataPath.c_str()) + "\\stdmaps\\*.mpr"; CFileFind ff; - - if(ff.FindFile(maps)) - { - BOOL bFileAvailable=TRUE; - while(bFileAvailable) { - bFileAvailable=ff.FindNextFile(); - CString file=ff.GetFileName(); + if (ff.FindFile(maps)) { + BOOL bFileAvailable = TRUE; + while (bFileAvailable) { + bFileAvailable = ff.FindNextFile(); + + CString file = ff.GetFileName(); m_ImportFile->AddString(file); } m_ImportFile->SetCurSel(0); } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/NewMapImportDlg.h b/MissionEditor/NewMapImportDlg.h index 2d0228c..2fa7248 100644 --- a/MissionEditor/NewMapImportDlg.h +++ b/MissionEditor/NewMapImportDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAPIMPORTDLG_H__F7D62444_C6DF_11D4_9C87_E63AC3E34349__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMapImportDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewMapImportDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -49,7 +49,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMapImportDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewMapSpDlg.cpp b/MissionEditor/NewMapSpDlg.cpp index 23a2b1e..e48f159 100644 --- a/MissionEditor/NewMapSpDlg.cpp +++ b/MissionEditor/NewMapSpDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMapSpDlg.cpp: Implementierungsdatei @@ -68,37 +68,37 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMapSpDlg -void CNewMapSpDlg::OnPreparehouses() +void CNewMapSpDlg::OnPreparehouses() { UpdateData(TRUE); - BOOL bEnable=m_PrepareHouses; + BOOL bEnable = m_PrepareHouses; GetDlgItem(IDC_AUTOPROD)->EnableWindow(bEnable); GetDlgItem(IDC_HOUSE)->EnableWindow(bEnable); - + } -BOOL CNewMapSpDlg::OnInitDialog() +BOOL CNewMapSpDlg::OnInitDialog() { CDialog::OnInitDialog(); - - CComboBox& house=*((CComboBox*)(GetDlgItem(IDC_HOUSE))); + + CComboBox& house = *((CComboBox*)(GetDlgItem(IDC_HOUSE))); int i; for (auto const& [seq, id] : rules[HOUSES]) { house.AddString(TranslateHouse(id, TRUE)); } - m_PrepareHouses=TRUE; - m_AutoProd=TRUE; - m_House=0; + m_PrepareHouses = TRUE; + m_AutoProd = TRUE; + m_House = 0; UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CNewMapSpDlg::OnOK() -{ +void CNewMapSpDlg::OnOK() +{ CDialog::OnOK(); //m_House=TranslateHouse(m_House); } diff --git a/MissionEditor/NewMapSpDlg.h b/MissionEditor/NewMapSpDlg.h index 90c4206..541e3ba 100644 --- a/MissionEditor/NewMapSpDlg.h +++ b/MissionEditor/NewMapSpDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAPSPDLG_H__F7D62445_C6DF_11D4_9C87_E63AC3E34349__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMapSpDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewMapSpDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -48,7 +48,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMapSpDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewMapTypeDlg.cpp b/MissionEditor/NewMapTypeDlg.cpp index 5e27156..d8ed7b5 100644 --- a/MissionEditor/NewMapTypeDlg.cpp +++ b/MissionEditor/NewMapTypeDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewMapTypeDlg.cpp: Implementierungsdatei @@ -61,13 +61,13 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CNewMapTypeDlg -BOOL CNewMapTypeDlg::OnInitDialog() +BOOL CNewMapTypeDlg::OnInitDialog() { CDialog::OnInitDialog(); - m_Singleplayer=1; + m_Singleplayer = 1; UpdateData(FALSE); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/NewMapTypeDlg.h b/MissionEditor/NewMapTypeDlg.h index 7467169..de856de 100644 --- a/MissionEditor/NewMapTypeDlg.h +++ b/MissionEditor/NewMapTypeDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWMAPTYPEDLG_H__F7D62441_C6DF_11D4_9C87_E63AC3E34349__INCLUDED_) @@ -32,7 +32,7 @@ class CNewMapTypeDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewMapTypeDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewMapTypeDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/NewRA2HouseDlg.cpp b/MissionEditor/NewRA2HouseDlg.cpp index e2dc2ed..8c3c6c9 100644 --- a/MissionEditor/NewRA2HouseDlg.cpp +++ b/MissionEditor/NewRA2HouseDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // NewRA2HouseDlg.cpp: Implementierungsdatei @@ -64,18 +64,18 @@ END_MESSAGE_MAP() #include "functions.h" -BOOL CNewRA2HouseDlg::OnInitDialog() +BOOL CNewRA2HouseDlg::OnInitDialog() { CDialog::OnInitDialog(); - CComboBox* country=(CComboBox*)GetDlgItem(IDC_COUNTRY); - + CComboBox* country = (CComboBox*)GetDlgItem(IDC_COUNTRY); + for (auto const& [seq, id] : rules[HOUSES]) { country->AddString(TranslateHouse(id, TRUE)); } country->SetCurSel(0); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/NewRA2HouseDlg.h b/MissionEditor/NewRA2HouseDlg.h index 0673a1b..2645af6 100644 --- a/MissionEditor/NewRA2HouseDlg.h +++ b/MissionEditor/NewRA2HouseDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_NEWRA2HOUSEDLG_H__142D23E1_ADDC_11D4_9C87_A435A7B6044F__INCLUDED_) @@ -32,7 +32,7 @@ class CNewRA2HouseDlg : public CDialog { -// Konstruktion + // Konstruktion public: CNewRA2HouseDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CNewRA2HouseDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/OpenMapDialog.cpp b/MissionEditor/OpenMapDialog.cpp index 83787ba..97ebfa9 100644 --- a/MissionEditor/OpenMapDialog.cpp +++ b/MissionEditor/OpenMapDialog.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // OpenMapDialog.cpp: Implementierungsdatei @@ -37,8 +37,8 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNAMIC(COpenMapDialog, CFileDialog) COpenMapDialog::COpenMapDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName, - DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : - CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd) + DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) : + CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd) { } diff --git a/MissionEditor/OpenMapDialog.h b/MissionEditor/OpenMapDialog.h index 1ad98aa..9b1db1c 100644 --- a/MissionEditor/OpenMapDialog.h +++ b/MissionEditor/OpenMapDialog.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_OPENMAPDIALOG_H__914D68A0_ACAF_11D3_B63B_F360681B1940__INCLUDED_) diff --git a/MissionEditor/ProgressDlg.cpp b/MissionEditor/ProgressDlg.cpp index 0b83171..5565536 100644 --- a/MissionEditor/ProgressDlg.cpp +++ b/MissionEditor/ProgressDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ProgressDlg.cpp: Implementierungsdatei @@ -43,7 +43,7 @@ CProgressDlg::CProgressDlg(CString lpDescription, CWnd* pParent /*=NULL*/) m_ProgLabel = _T(""); //}}AFX_DATA_INIT - m_bCancel=FALSE; + m_bCancel = FALSE; Create(CProgressDlg::IDD, pParent); } @@ -77,35 +77,35 @@ void CProgressDlg::SetPosition(int nPos) { m_Progress.SetPos(nPos); m_Progress.UpdateWindow(); - m_ProgLabel="Progress: "; - - + m_ProgLabel = "Progress: "; - float p=m_Progress.GetPos(); - int min,max; - m_Progress.GetRange(min,max); - - if(max-min==0) return; - float f=p/((float)(max-min)); + + float p = m_Progress.GetPos(); + int min, max; + m_Progress.GetRange(min, max); + + if (max - min == 0) return; + + float f = p / ((float)(max - min)); char c[50]; - itoa(f*100, c, 10); - m_ProgLabel+=c; - m_ProgLabel+=" %"; + itoa(f * 100, c, 10); + m_ProgLabel += c; + m_ProgLabel += " %"; UpdateData(FALSE); } -void CProgressDlg::PostNcDestroy() +void CProgressDlg::PostNcDestroy() { delete this; - + //CDialog::PostNcDestroy(); } -void CProgressDlg::OnCancel() +void CProgressDlg::OnCancel() { - m_bCancel=TRUE; - + m_bCancel = TRUE; + CDialog::OnCancel(); } diff --git a/MissionEditor/ProgressDlg.h b/MissionEditor/ProgressDlg.h index 1456db5..4a0efc6 100644 --- a/MissionEditor/ProgressDlg.h +++ b/MissionEditor/ProgressDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_PROGRESSDLG_H__6FA29A01_EA1F_11D4_9C88_F09F67B34649__INCLUDED_) @@ -32,7 +32,7 @@ class CProgressDlg : public CDialog { -// Konstruktion + // Konstruktion public: BOOL m_bCancel; void SetPosition(int nPos); @@ -51,7 +51,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CProgressDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/RTPDlg.cpp b/MissionEditor/RTPDlg.cpp index 71e24ed..4464201 100644 --- a/MissionEditor/RTPDlg.cpp +++ b/MissionEditor/RTPDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // RTPDlg.cpp: Implementierungsdatei @@ -72,47 +72,47 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CRTPDlg -BOOL CRTPDlg::OnInitDialog() +BOOL CRTPDlg::OnInitDialog() { CDialog::OnInitDialog(); for (auto const& [seq, unitname] : rules["TerrainTypes"]) { - CString addedString=unitname; + CString addedString = unitname; if (g_data["IgnoreRA2"].HasValue(unitname)) { continue; } - addedString=TranslateStringACP(addedString); - + addedString = TranslateStringACP(addedString); + if (unitname.Find("TREE") >= 0) { - if(unitname.GetLength()>0 && unitname!="VEINTREE") // out with it :-) + if (unitname.GetLength() > 0 && unitname != "VEINTREE") // out with it :-) { auto const& theaterType = Map->GetTheater(); int TreeMin = g_data.GetInteger(theaterType + "Limits", "TreeMin"); int TreeMax = g_data.GetInteger(theaterType + "Limits", "TreeMax"); - - CString id=unitname; - id.Delete(0, 4); - int n=atoi(id); - + CString id = unitname; + id.Delete(0, 4); + int n = atoi(id); + + if (nTreeMax) { continue; } - m_Available.AddString(unitname); + m_Available.AddString(unitname); } } } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CRTPDlg::OnAdd() +void CRTPDlg::OnAdd() { - int sel=m_Available.GetCurSel(); - if(sel<0) return; + int sel = m_Available.GetCurSel(); + if (sel < 0) return; CString currentname; m_Available.GetText(sel, currentname); @@ -121,10 +121,10 @@ void CRTPDlg::OnAdd() m_Used.AddString(currentname); } -void CRTPDlg::OnRemove() +void CRTPDlg::OnRemove() { - int sel=m_Used.GetCurSel(); - if(sel<0) return; + int sel = m_Used.GetCurSel(); + if (sel < 0) return; CString currentname; m_Used.GetText(sel, currentname); @@ -133,10 +133,9 @@ void CRTPDlg::OnRemove() m_Available.AddString(currentname); } -void CRTPDlg::OnOK() +void CRTPDlg::OnOK() { - if(m_Used.GetCount()<=0) - { + if (m_Used.GetCount() <= 0) { //AfxMessageBox("Please select at least one tree","Error", MB_OK); return; } @@ -144,38 +143,36 @@ void CRTPDlg::OnOK() rndterrainsrc.clear(); int i; - for(i=0;iGetUnitTypeID(m_LastSelected); - - PICDATA* p=&treeinfo[id].pic; //ovrlpics[m_currentOverlay][i]; - - if(p->pic==NULL) - { + int id = Map->GetUnitTypeID(m_LastSelected); + + PICDATA* p = &treeinfo[id].pic; //ovrlpics[m_currentOverlay][i]; + + + if (p->pic == NULL) { CString type; - type=m_LastSelected; + type = m_LastSelected; - if(missingimages.find(type)==missingimages.end()) - { + if (missingimages.find(type) == missingimages.end()) { theApp.m_loading->LoadUnitGraphic(type); Map->UpdateTreeInfo(&type); - p=&treeinfo[id].pic; + p = &treeinfo[id].pic; } - if(p->pic==NULL) - { - missingimages[type]=TRUE; + if (p->pic == NULL) { + missingimages[type] = TRUE; } } - int curwidth=p->wMaxWidth; - int curheight=p->wMaxHeight; + int curwidth = p->wMaxWidth; + int curheight = p->wMaxHeight; BITMAPINFO biinfo; memset(&biinfo, 0, sizeof(BITMAPINFO)); - biinfo.bmiHeader.biBitCount=24; - biinfo.bmiHeader.biWidth=curwidth; - biinfo.bmiHeader.biHeight=curheight; - biinfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); - biinfo.bmiHeader.biClrUsed=0; - biinfo.bmiHeader.biPlanes=1; - biinfo.bmiHeader.biCompression=BI_RGB; - biinfo.bmiHeader.biClrImportant=0; + biinfo.bmiHeader.biBitCount = 24; + biinfo.bmiHeader.biWidth = curwidth; + biinfo.bmiHeader.biHeight = curheight; + biinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + biinfo.bmiHeader.biClrUsed = 0; + biinfo.bmiHeader.biPlanes = 1; + biinfo.bmiHeader.biCompression = BI_RGB; + biinfo.bmiHeader.biClrImportant = 0; - int pitch=curwidth*3; - if(pitch==0) return; + int pitch = curwidth * 3; + if (pitch == 0) return; - if(pitch%sizeof(DWORD)) - { - pitch+=sizeof(DWORD)-(curwidth*3)%sizeof(DWORD); + if (pitch % sizeof(DWORD)) { + pitch += sizeof(DWORD) - (curwidth * 3) % sizeof(DWORD); } - BYTE* colors=new(BYTE[pitch*curheight]); - memset(colors, 255, pitch*(curheight)); + BYTE* colors = new(BYTE[pitch * curheight]); + memset(colors, 255, pitch * (curheight)); - RGBTRIPLE* pal=palIso; + RGBTRIPLE* pal = palIso; #ifdef NOSURFACES - if(p->pal==iPalTheater) pal=palTheater; - if(p->pal==iPalUnit) pal=palUnit; + if (p->pal == iPalTheater) pal = palTheater; + if (p->pal == iPalUnit) pal = palUnit; #endif - int k,l; - for(k=0;kpic)[l+k*curwidth]) - { - memcpy(&colors[l*3+(curheight-k-1)*pitch], &pal[((BYTE*)p->pic)[l+k*curwidth]], 3); + int k, l; + for (k = 0; k < curheight; k++) { + for (l = 0; l < curwidth; l++) { + if (((BYTE*)p->pic)[l + k * curwidth]) { + memcpy(&colors[l * 3 + (curheight - k - 1) * pitch], &pal[((BYTE*)p->pic)[l + k * curwidth]], 3); } } } @@ -298,14 +287,14 @@ void CRTPDlg::OnPaint() CBrush f; f.Attach(GetStockObject(WHITE_BRUSH)); - dc.FillRect(&pr,&f); + dc.FillRect(&pr, &f); f.Detach(); auto clientDC = m_Preview.GetWindowDC(); - StretchDIBits(clientDC->GetSafeHdc(), 20, 30,curwidth, curheight, + StretchDIBits(clientDC->GetSafeHdc(), 20, 30, curwidth, curheight, 0, 0, curwidth, curheight, colors, &biinfo, DIB_RGB_COLORS, SRCCOPY); delete[] colors; - + // Kein Aufruf von CDialog::OnPaint() für Zeichnungsnachrichten } diff --git a/MissionEditor/RTPDlg.h b/MissionEditor/RTPDlg.h index 18a6a6c..bfc6c1f 100644 --- a/MissionEditor/RTPDlg.h +++ b/MissionEditor/RTPDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_RTPDLG_H__8E65AA00_2C54_11D5_89B2_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CRTPDlg : public CDialog { -// Konstruktion + // Konstruktion public: CRTPDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -48,7 +48,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CRTPDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/RightFrame.cpp b/MissionEditor/RightFrame.cpp index 2f3e14c..79945b9 100644 --- a/MissionEditor/RightFrame.cpp +++ b/MissionEditor/RightFrame.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // RightFrame.cpp: Implementierungsdatei @@ -55,38 +55,38 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CRightFrame -BOOL CRightFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) +BOOL CRightFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { SIZE z; - z.cx=200; - z.cy=700; + z.cx = 200; + z.cy = 700; //if(z.cy<100) z.cy=100; CRect r; - r.right=200; - r.bottom=200; - - - if(!m_Splitter.CreateStatic(this,2,1)) return FALSE; - + r.right = 200; + r.bottom = 200; - if(!m_Splitter.CreateView(0,0, + + if (!m_Splitter.CreateStatic(this, 2, 1)) return FALSE; + + + if (!m_Splitter.CreateView(0, 0, RUNTIME_CLASS(CIsoView), z, pContext)) return FALSE; - z.cy=100; + z.cy = 100; - if(!m_Splitter.CreateView(1,0, + if (!m_Splitter.CreateView(1, 0, RUNTIME_CLASS(CTileSetBrowserFrame), z, pContext)) return FALSE; GetClientRect(&r); - m_Splitter.SetRowInfo(0, GetSystemMetrics(SM_CYFULLSCREEN)/2, 20); - m_Splitter.SetRowInfo(1, GetSystemMetrics(SM_CYFULLSCREEN)/2, 10); + m_Splitter.SetRowInfo(0, GetSystemMetrics(SM_CYFULLSCREEN) / 2, 20); + m_Splitter.SetRowInfo(1, GetSystemMetrics(SM_CYFULLSCREEN) / 2, 10); //SetWindowLong(m_Splitter->m_hWnd, GWL_STYLE, m_rightFrame->GetStyle() ! WS_THICKFRAME); @@ -95,29 +95,29 @@ BOOL CRightFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) return CFrameWnd::OnCreateClient(lpcs, pContext); } -BOOL CRightFrame::PreCreateWindow(CREATESTRUCT& cs) +BOOL CRightFrame::PreCreateWindow(CREATESTRUCT& cs) { // cs.style=WS_OVERLAPPED && WS_CAPTION && WS_SYSMENU && WS_MINIMIZEBOX && WS_MAXIMIZEBOX; - + return CFrameWnd::PreCreateWindow(cs); } -void CRightFrame::OnSize(UINT nType, int cx, int cy) +void CRightFrame::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); - + } -void CRightFrame::RecalcLayout(BOOL bNotify) +void CRightFrame::RecalcLayout(BOOL bNotify) { // TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen - + CFrameWnd::RecalcLayout(bNotify); } -void CRightFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) +void CRightFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { - + CFrameWnd::OnChar(nChar, nRepCnt, nFlags); } diff --git a/MissionEditor/RightFrame.h b/MissionEditor/RightFrame.h index 76e1a0b..187cc12 100644 --- a/MissionEditor/RightFrame.h +++ b/MissionEditor/RightFrame.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_RIGHTFRAME_H__22553762_8405_11D4_9C87_EE62BC46B24A__INCLUDED_) @@ -39,16 +39,16 @@ protected: // Attribute public: -// Operationen + // Operationen public: CSplitterWnd m_Splitter; -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CRightFrame) - public: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CRightFrame) +public: virtual void RecalcLayout(BOOL bNotify = TRUE); - protected: +protected: virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL diff --git a/MissionEditor/SaveMapOptionsDlg.cpp b/MissionEditor/SaveMapOptionsDlg.cpp index e955f52..9891601 100644 --- a/MissionEditor/SaveMapOptionsDlg.cpp +++ b/MissionEditor/SaveMapOptionsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // SaveMapOptionsDlg.cpp: Implementierungsdatei @@ -54,10 +54,10 @@ CSaveMapOptionsDlg::CSaveMapOptionsDlg(CWnd* pParent /*=NULL*/) m_Standard = FALSE; m_TeamGame = FALSE; //}}AFX_DATA_INIT - - CIniFile& ini=Map->GetIniFile(); - if(!Map->IsMultiplayer()) - m_PreviewMode=1; + + CIniFile& ini = Map->GetIniFile(); + if (!Map->IsMultiplayer()) + m_PreviewMode = 1; m_MapName = ini.GetString("Basic", "Name"); } @@ -70,7 +70,7 @@ void CSaveMapOptionsDlg::DoDataExchange(CDataExchange* pDX) DDX_Radio(pDX, IDC_COMPRESS, m_Compress); DDX_Radio(pDX, IDC_PREVIEWMODE, m_PreviewMode); DDX_Text(pDX, IDC_MAPNAME, m_MapName); - #ifdef RA2_MODE +#ifdef RA2_MODE DDX_Check(pDX, IDC_AIRWAR, m_AirWar); DDX_Check(pDX, IDC_COOPERATIVE, m_Cooperative); DDX_Check(pDX, IDC_DUEL, m_Duel); @@ -80,7 +80,7 @@ void CSaveMapOptionsDlg::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_NUKEWAR, m_Nukewar); DDX_Check(pDX, IDC_STANDARD, m_Standard); DDX_Check(pDX, IDC_TEAMGAME, m_TeamGame); - #endif +#endif //}}AFX_DATA_MAP } @@ -93,13 +93,12 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CSaveMapOptionsDlg -BOOL CSaveMapOptionsDlg::OnInitDialog() +BOOL CSaveMapOptionsDlg::OnInitDialog() { CDialog::OnInitDialog(); - CIniFile& ini=Map->GetIniFile(); - if(!Map->IsMultiplayer()) - { + CIniFile& ini = Map->GetIniFile(); + if (!Map->IsMultiplayer()) { GetDlgItem(IDC_PREVIEWMODE)->EnableWindow(FALSE); GetDlgItem(IDC_NOPREVIEW)->EnableWindow(FALSE); GetDlgItem(IDC_EXISTINGPREVIEW)->EnableWindow(FALSE); @@ -116,7 +115,7 @@ BOOL CSaveMapOptionsDlg::OnInitDialog() GetDlgItem(IDC_TEAMGAME)->EnableWindow(FALSE); #endif } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/SaveMapOptionsDlg.h b/MissionEditor/SaveMapOptionsDlg.h index a90f1d6..34ef922 100644 --- a/MissionEditor/SaveMapOptionsDlg.h +++ b/MissionEditor/SaveMapOptionsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SAVEMAPOPTIONSDLG_H__DD7874E1_CED2_11D4_9C87_444553540000__INCLUDED_) @@ -32,7 +32,7 @@ class CSaveMapOptionsDlg : public CDialog { -// Konstruktion + // Konstruktion public: CSaveMapOptionsDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -57,7 +57,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CSaveMapOptionsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/SavingDlg.cpp b/MissionEditor/SavingDlg.cpp index 2f1684f..c63e4af 100644 --- a/MissionEditor/SavingDlg.cpp +++ b/MissionEditor/SavingDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // SavingDlg.cpp: Implementierungsdatei @@ -64,8 +64,8 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CSavingDlg -void CSavingDlg::PostNcDestroy() +void CSavingDlg::PostNcDestroy() { - + // CDialog::PostNcDestroy(); } diff --git a/MissionEditor/SavingDlg.h b/MissionEditor/SavingDlg.h index 9820494..2423365 100644 --- a/MissionEditor/SavingDlg.h +++ b/MissionEditor/SavingDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SAVINGDLG_H__9E604CC1_850C_11D4_9C87_BC8AE639B54A__INCLUDED_) @@ -34,21 +34,21 @@ class CSavingDlg : public CDialog { -// Konstruktion + // Konstruktion public: CSavingDlg(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten //{{AFX_DATA(CSavingDlg) enum { IDD = IDD_SAVING }; - // HINWEIS: Der Klassen-Assistent fügt hier Datenelemente ein - //}}AFX_DATA + // HINWEIS: Der Klassen-Assistent fügt hier Datenelemente ein +//}}AFX_DATA // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CSavingDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/ScriptTypes.cpp b/MissionEditor/ScriptTypes.cpp index 5964a04..81668f3 100644 --- a/MissionEditor/ScriptTypes.cpp +++ b/MissionEditor/ScriptTypes.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ScriptTypes.cpp: Implementierungsdatei @@ -106,7 +106,7 @@ enum TeamMissionType { TMISSION_MOVETO_OWN_BUILDING_WITH_PROPERTY, }; -char const * TMissions[TMISSION_COUNT] = { +char const* TMissions[TMISSION_COUNT] = { "Attack...", "Attack Waypoint...", "Go Berzerk", @@ -168,7 +168,7 @@ char const * TMissions[TMISSION_COUNT] = { "Move to own building", }; -char const * TMissionsHelp[TMISSION_COUNT] = { +char const* TMissionsHelp[TMISSION_COUNT] = { "Attack some general target", "Attack anything nearby the specified waypoint", "Cyborg members of the team will go berzerk.", @@ -231,14 +231,14 @@ char const * TMissionsHelp[TMISSION_COUNT] = { }; -char const *TargetProperties[TPROPERTY_COUNT] = { +char const* TargetProperties[TPROPERTY_COUNT] = { "Least Threat", "Greatest Threat", "Nearest", "Farthest", }; -char const *UnloadTypeNames[UNLOAD_COUNT] = { +char const* UnloadTypeNames[UNLOAD_COUNT] = { "Keep Transports, Keep Units", "Keep Transports, Lose Units", "Lose Transports, Keep Units", @@ -299,23 +299,23 @@ END_MESSAGE_MAP() void CScriptTypes::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_ScriptType.GetCurSel(); + int sel = m_ScriptType.GetCurSel(); - - while(m_ScriptType.DeleteString(0)!=CB_ERR); + + while (m_ScriptType.DeleteString(0) != CB_ERR); // MW 07/24/01: clear dialog m_DescriptionEx.SetWindowText(""); - m_Name=""; + m_Name = ""; m_Param.SetWindowText(""); m_Action.SetWindowText(""); m_Type.SetCurSel(-1); UpdateData(FALSE); - + for (auto const& [seq, type] : ini["ScriptTypes"]) { CString desc = type; desc += " ("; @@ -333,42 +333,42 @@ void CScriptTypes::UpdateDialog() } -void CScriptTypes::OnEditchangeScripttype() +void CScriptTypes::OnEditchangeScripttype() { - + } -void CScriptTypes::OnSelchangeScripttype() +void CScriptTypes::OnSelchangeScripttype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Action.GetCurSel(); - while(m_Action.DeleteString(0)!=CB_ERR); + int sel = m_Action.GetCurSel(); + while (m_Action.DeleteString(0) != CB_ERR); CString Scripttype; - if(m_ScriptType.GetCurSel()<0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); - + m_Name = ini.GetString(Scripttype, "Name"); int count = ini[Scripttype].Size() - 1; int i; for (i = 0; i < count; i++) { char c[50]; - itoa(i,c,10); + itoa(i, c, 10); m_Action.AddString(c); } m_Action.SetCurSel(0); - if(sel>=0) m_Action.SetCurSel(sel); + if (sel >= 0) m_Action.SetCurSel(sel); OnSelchangeAction(); - + UpdateData(FALSE); } -void CScriptTypes::OnSelchangeAction() +void CScriptTypes::OnSelchangeAction() { CIniFile& ini = Map->GetIniFile(); @@ -391,25 +391,25 @@ void CScriptTypes::OnSelchangeAction() m_Param.SetWindowText(GetParam(ini.GetString(Scripttype, action), 1)); - + } -void CScriptTypes::OnChangeName() +void CScriptTypes::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - CEdit* n=(CEdit*)GetDlgItem(IDC_NAME); + CEdit* n = (CEdit*)GetDlgItem(IDC_NAME); - DWORD pos=n->GetSel(); + DWORD pos = n->GetSel(); CString Scripttype; if (m_ScriptType.GetCurSel() < 0) { return; } m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); - + ini.SetString(Scripttype, "Name", m_Name); @@ -418,15 +418,15 @@ void CScriptTypes::OnChangeName() n->SetSel(pos); } -void CScriptTypes::OnEditchangeType() +void CScriptTypes::OnEditchangeType() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - while(m_Param.DeleteString(0)!=CB_ERR); + while (m_Param.DeleteString(0) != CB_ERR); CString Scripttype; char action[50]; - if(m_Action.GetCurSel()<0) return; - if(m_ScriptType.GetCurSel()<0) return; + if (m_Action.GetCurSel() < 0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); @@ -434,13 +434,12 @@ void CScriptTypes::OnEditchangeType() //m_Type.GetWindowText(type); //TruncSpace(type); //MessageBox("beep"); - int type=m_Type.GetCurSel(); - + int type = m_Type.GetCurSel(); + int i; char tmp[50]; - switch(type) - { + switch (type) { case 0: ListTargets(m_Param); m_Desc.SetWindowText("Target:"); @@ -467,23 +466,22 @@ void CScriptTypes::OnEditchangeType() break; case 6: m_Desc.SetWindowText("Script action #:"); - while(m_Param.DeleteString(0)!=CB_ERR); + while (m_Param.DeleteString(0) != CB_ERR); for (i = 1; i <= ini[Scripttype].Size() - 1; i++) { m_Param.AddString(itoa(i, tmp, 10)); } break; case 8: m_Desc.SetWindowText("Split groups:"); - while(m_Param.DeleteString(0)!=CB_ERR); + while (m_Param.DeleteString(0) != CB_ERR); int i; - for(i=0;iGetUnitName(bldTypeSec.Nth(i).second); - m_Param.AddString(s); - } - break; + { + m_Desc.SetWindowText("Type to move/attack:"); + auto const& bldTypeSec = rules["BuildingTypes"]; + for (i = 0; i < bldTypeSec.Size(); i++) { + char c[50]; + itoa(i, c, 10); + CString s = c; + + s += " "; + //s+=rules.sections[*rules.sections["BuildingTypes"].GetValue(i)].values["Name"]; + s += Map->GetUnitName(bldTypeSec.Nth(i).second); + m_Param.AddString(s); } + break; + } default: m_Desc.SetWindowText("Parameter of action:"); } - + itoa(m_Action.GetCurSel(), action, 10); char types[50]; @@ -529,30 +527,29 @@ void CScriptTypes::OnEditchangeType() ini.SetString(Scripttype, action, SetParam(ini.GetString(Scripttype, action), 0, types)); } -void CScriptTypes::OnSelchangeType() +void CScriptTypes::OnSelchangeType() { CString str; - if(m_Type.GetCurSel()>-1) - { + if (m_Type.GetCurSel() > -1) { //m_Type.GetLBText(m_Type.GetCurSel(), str); //m_Type.SetWindowText(str); m_DescriptionEx.SetWindowText(TMissionsHelp[m_Type.GetCurSel()]); } - + OnEditchangeType(); } -void CScriptTypes::OnEditchangeParam() +void CScriptTypes::OnEditchangeParam() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString Scripttype; char action[50]; - if(m_Action.GetCurSel()<0) return; - if(m_ScriptType.GetCurSel()<0) return; + if (m_Action.GetCurSel() < 0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); @@ -560,62 +557,61 @@ void CScriptTypes::OnEditchangeParam() m_Param.GetWindowText(param); TruncSpace(param); - param=TranslateHouse(param); + param = TranslateHouse(param); itoa(m_Action.GetCurSel(), action, 10); ini.SetString(Scripttype, action, SetParam(ini.GetString(Scripttype, action), 1, param)); } -void CScriptTypes::OnSelchangeParam() +void CScriptTypes::OnSelchangeParam() { m_Param.SetWindowText(GetText(&m_Param)); - OnEditchangeParam(); + OnEditchangeParam(); } -void CScriptTypes::OnAddaction() +void CScriptTypes::OnAddaction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString Scripttype; - if(m_ScriptType.GetCurSel()<0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); char action[20]; int count = ini[Scripttype].Size() - 1; - itoa(count,action,10); + itoa(count, action, 10); ini.SetString(Scripttype, action, "0,0"); UpdateDialog(); } -void CScriptTypes::OnDeleteaction() +void CScriptTypes::OnDeleteaction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString Scripttype; - if(m_Action.GetCurSel()<0) return; - if(m_ScriptType.GetCurSel()<0) return; + if (m_Action.GetCurSel() < 0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); - + // okay, action is now the deleted one... int i; - for(i=m_Action.GetCurSel(); iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CString ID=GetFreeID(); - - CString p=GetFree("ScriptTypes"); + CString ID = GetFreeID(); + + CString p = GetFree("ScriptTypes"); ini.SetString("ScriptTypes", p, ID); ini.SetString(ID, "Name", "New script"); - - + + int i; - for(i=0;iGetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + CString Scripttype; - if(m_ScriptType.GetCurSel()<0) return; + if (m_ScriptType.GetCurSel() < 0) return; m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype); TruncSpace(Scripttype); - int res=MessageBox("Are you sure to delete this ScriptType? Don´t forget to delete any references to this ScriptType","Delete ScriptType", MB_YESNO | MB_ICONQUESTION); + int res = MessageBox("Are you sure to delete this ScriptType? Don´t forget to delete any references to this ScriptType", "Delete ScriptType", MB_YESNO | MB_ICONQUESTION); if (res != IDYES) { return; } @@ -677,9 +671,9 @@ void CScriptTypes::OnDelete() -void CScriptTypes::ListBehaviours(CComboBox &cb) +void CScriptTypes::ListBehaviours(CComboBox& cb) { - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); cb.AddString("0 - Sleep"); cb.AddString("1 - Attack nearest enemy"); @@ -711,40 +705,37 @@ void CScriptTypes::ListBehaviours(CComboBox &cb) cb.AddString("27 - Paradrop overlay drop zone"); cb.AddString("28 - Wait"); cb.AddString("29 - Attack move"); - if(yuri_mode) - { - // cb.AddString("30 - Spyplane approach"); - // cb.AddString("31 - Spyplane retreat"); + if (yuri_mode) { + // cb.AddString("30 - Spyplane approach"); + // cb.AddString("31 - Spyplane retreat"); } } -BOOL CScriptTypes::OnInitDialog() +BOOL CScriptTypes::OnInitDialog() { CDialog::OnInitDialog(); - - while(m_Type.DeleteString(0)!=CB_ERR); - + while (m_Type.DeleteString(0) != CB_ERR); + + int i; - for(i=0;i0) - { + //p+=" - "; + p += TMissions[i]; + + if (strlen(TMissions[i]) > 0) { m_Type.AddString(p); } } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/ScriptTypes.h b/MissionEditor/ScriptTypes.h index 632d1e2..3e976bd 100644 --- a/MissionEditor/ScriptTypes.h +++ b/MissionEditor/ScriptTypes.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SCRIPTTYPES_H__981EF700_951E_11D3_B63B_BCCF9C98B341__INCLUDED_) @@ -34,14 +34,14 @@ class CScriptTypes : public CDialog { DECLARE_DYNCREATE(CScriptTypes) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CScriptTypes(); ~CScriptTypes(); -// Dialogfelddaten - //{{AFX_DATA(CScriptTypes) + // Dialogfelddaten + //{{AFX_DATA(CScriptTypes) enum { IDD = IDD_SCRIPTTYPES }; CEdit m_DescriptionEx; CStatic m_Desc; @@ -56,7 +56,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CScriptTypes) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/SearchWaypointDlg.cpp b/MissionEditor/SearchWaypointDlg.cpp index a344356..f32c5de 100644 --- a/MissionEditor/SearchWaypointDlg.cpp +++ b/MissionEditor/SearchWaypointDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // SearchWaypointDlg.cpp: Implementierungsdatei @@ -62,41 +62,39 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CSearchWaypointDlg -BOOL CSearchWaypointDlg::OnInitDialog() +BOOL CSearchWaypointDlg::OnInitDialog() { CDialog::OnInitDialog(); - CListBox& ctrl=*(CListBox*)GetDlgItem(IDC_WAYPOINTS); + CListBox& ctrl = *(CListBox*)GetDlgItem(IDC_WAYPOINTS); - while(ctrl.DeleteString(0)!=LB_ERR); + while (ctrl.DeleteString(0) != LB_ERR); int i; - int count=Map->GetWaypointCount(); + int count = Map->GetWaypointCount(); - for(i=0;iGetWaypointData(i, &id, &pos); ctrl.SetItemData(ctrl.InsertString(i, id), i); } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CSearchWaypointDlg::OnOK() +void CSearchWaypointDlg::OnOK() { - CListBox& ctrl=*(CListBox*)GetDlgItem(IDC_WAYPOINTS); + CListBox& ctrl = *(CListBox*)GetDlgItem(IDC_WAYPOINTS); - int sel=ctrl.GetCurSel(); + int sel = ctrl.GetCurSel(); - if(sel<0) m_WaypointIndex=-1; - else - { - m_WaypointIndex=ctrl.GetItemData(sel); + if (sel < 0) m_WaypointIndex = -1; + else { + m_WaypointIndex = ctrl.GetItemData(sel); } - + CDialog::OnOK(); } diff --git a/MissionEditor/SearchWaypointDlg.h b/MissionEditor/SearchWaypointDlg.h index 6cb34b5..0309766 100644 --- a/MissionEditor/SearchWaypointDlg.h +++ b/MissionEditor/SearchWaypointDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SEARCHWAYPOINTDLG_H__28D1CCC0_874C_11D5_89B3_00E07D97C331__INCLUDED_) @@ -32,7 +32,7 @@ class CSearchWaypointDlg : public CDialog { -// Konstruktion + // Konstruktion public: int m_WaypointIndex; CSearchWaypointDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -47,7 +47,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CSearchWaypointDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/ShutDownDlg.cpp b/MissionEditor/ShutDownDlg.cpp index 56f98d1..92d030a 100644 --- a/MissionEditor/ShutDownDlg.cpp +++ b/MissionEditor/ShutDownDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ShutDownDlg.cpp: Implementierungsdatei @@ -65,7 +65,7 @@ END_MESSAGE_MAP() // Behandlungsroutinen für Nachrichten CShutDownDlg -void CShutDownDlg::PostNcDestroy() +void CShutDownDlg::PostNcDestroy() { // delete this; } diff --git a/MissionEditor/ShutDownDlg.h b/MissionEditor/ShutDownDlg.h index 24a019d..d543a56 100644 --- a/MissionEditor/ShutDownDlg.h +++ b/MissionEditor/ShutDownDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SHUTDOWNDLG_H__28D9E061_8340_11D4_9C87_A1B9E12BB04A__INCLUDED_) @@ -34,21 +34,21 @@ class CShutDownDlg : public CDialog { -// Konstruktion + // Konstruktion public: CShutDownDlg(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten //{{AFX_DATA(CShutDownDlg) enum { IDD = IDD_SHUTDOWN }; - // HINWEIS: Der Klassen-Assistent fügt hier Datenelemente ein - //}}AFX_DATA + // HINWEIS: Der Klassen-Assistent fügt hier Datenelemente ein +//}}AFX_DATA // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CShutDownDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/SingleplayerSettings.cpp b/MissionEditor/SingleplayerSettings.cpp index 24d34d4..e82c6b4 100644 --- a/MissionEditor/SingleplayerSettings.cpp +++ b/MissionEditor/SingleplayerSettings.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // SingleplayerSettings.cpp: implementation file @@ -42,7 +42,7 @@ IMPLEMENT_DYNCREATE(CSingleplayerSettings, CDialog) CSingleplayerSettings::CSingleplayerSettings() : CDialog(IDD) { //{{AFX_DATA_INIT(CSingleplayerSettings) - + //}}AFX_DATA_INIT } @@ -90,7 +90,7 @@ END_MESSAGE_MAP() void CSingleplayerSettings::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); auto const& sec = ini["Basic"]; @@ -121,7 +121,7 @@ void CSingleplayerSettings::UpdateDialog() ListMovies(m_PostScore, TRUE); ListMovies(m_PreMapSelect, TRUE); - + UpdateStrings(); } @@ -131,63 +131,63 @@ void CSingleplayerSettings::OnEditchangeIntro() ini.SetString("Basic", "Intro", GetText(&m_Intro)); } -void CSingleplayerSettings::OnEditchangeBrief() +void CSingleplayerSettings::OnEditchangeBrief() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Brief", GetText(&m_Brief)); } -void CSingleplayerSettings::OnEditchangeWin() +void CSingleplayerSettings::OnEditchangeWin() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Win", GetText(&m_Win)); } -void CSingleplayerSettings::OnEditchangeLose() +void CSingleplayerSettings::OnEditchangeLose() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Lose", GetText(&m_Lose)); } -void CSingleplayerSettings::OnEditchangeAction() +void CSingleplayerSettings::OnEditchangeAction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "Action", GetText(&m_Action)); } -void CSingleplayerSettings::OnEditchangePostscore() +void CSingleplayerSettings::OnEditchangePostscore() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "PostScore", GetText(&m_PostScore)); } -void CSingleplayerSettings::OnEditchangePremapselect() +void CSingleplayerSettings::OnEditchangePremapselect() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "PreMapSelect", GetText(&m_PreMapSelect)); } -void CSingleplayerSettings::OnEditchangeStartingdropships() +void CSingleplayerSettings::OnEditchangeStartingdropships() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "StartingDropships", GetText(&m_StartingDropships)); } -void CSingleplayerSettings::OnChangeCarryovermoney() +void CSingleplayerSettings::OnChangeCarryovermoney() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "CarryOverMoney", GetText(&m_CarryOverMoney)); } -void CSingleplayerSettings::OnEditchangeTimerinherit() +void CSingleplayerSettings::OnEditchangeTimerinherit() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "TimerInherit", GetText(&m_TimerInherit)); } -void CSingleplayerSettings::OnEditchangeFillsilos() +void CSingleplayerSettings::OnEditchangeFillsilos() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); ini.SetString("Basic", "FillSilos", GetText(&m_FillSilos)); } @@ -215,7 +215,7 @@ void CSingleplayerSettings::UpdateStrings() #endif } -void CSingleplayerSettings::PostNcDestroy() +void CSingleplayerSettings::PostNcDestroy() { // do not call CDialog::PostNcDestroy(); // CDialog::PostNcDestroy(); diff --git a/MissionEditor/SingleplayerSettings.h b/MissionEditor/SingleplayerSettings.h index 835e23f..415e85e 100644 --- a/MissionEditor/SingleplayerSettings.h +++ b/MissionEditor/SingleplayerSettings.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SINGLEPLAYERSETTINGS_H__082D6780_CA89_11D3_B63B_00485453E8BA__INCLUDED_) @@ -36,15 +36,15 @@ class CSingleplayerSettings : public CDialog { DECLARE_DYNCREATE(CSingleplayerSettings) -// construction + // construction public: void UpdateStrings(); void UpdateDialog(); CSingleplayerSettings(); ~CSingleplayerSettings(); -// dialog field data - //{{AFX_DATA(CSingleplayerSettings) + // dialog field data + //{{AFX_DATA(CSingleplayerSettings) enum { IDD = IDD_SINGLEPLAYER }; CMyComboBox m_TimerInherit; CMyComboBox m_StartingDropships; @@ -62,7 +62,7 @@ public: // overwriteables //{{AFX_VIRTUAL(CSingleplayerSettings) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // ddx/ddv support virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/SpecialFlags.cpp b/MissionEditor/SpecialFlags.cpp index 1399449..317c131 100644 --- a/MissionEditor/SpecialFlags.cpp +++ b/MissionEditor/SpecialFlags.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // SpecialFlags.cpp: Implementierungsdatei @@ -103,7 +103,7 @@ END_MESSAGE_MAP() void CSpecialFlags::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); auto const& sec = ini["SpecialFlags"]; m_DestroyableBridges.SetWindowText(sec.GetString("DestroyableBridges")); @@ -121,8 +121,8 @@ void CSpecialFlags::UpdateDialog() m_Visceroids.SetWindowText(sec.GetString("Visceroids")); #ifdef RA2_MODE - SetDlgItemText(IDC_LTIBERIUMGROWS,"Ore grows:"); - SetDlgItemText(IDC_LTIBERIUMSPREADS,"Ore spreads:"); + SetDlgItemText(IDC_LTIBERIUMGROWS, "Ore grows:"); + SetDlgItemText(IDC_LTIBERIUMSPREADS, "Ore spreads:"); GetDlgItem(IDC_LTIBERIUMEXPLOSIVE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_TIBERIUMEXPLOSIVE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_HARVESTERIMMUNE)->ShowWindow(SW_HIDE); @@ -140,106 +140,106 @@ void CSpecialFlags::UpdateDialog() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CSpecialFlags -void CSpecialFlags::OnEditchangeTiberiumgrows() +void CSpecialFlags::OnEditchangeTiberiumgrows() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_TiberiumGrows); + str = GetText(&m_TiberiumGrows); ini.SetString("SpecialFlags", "TiberiumGrows", str); } -void CSpecialFlags::OnEditchangeTiberiumspreads() +void CSpecialFlags::OnEditchangeTiberiumspreads() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_TiberiumSpreads); + str = GetText(&m_TiberiumSpreads); ini.SetString("SpecialFlags", "TiberiumSpreads", str); } -void CSpecialFlags::OnEditchangeTiberiumexplosive() +void CSpecialFlags::OnEditchangeTiberiumexplosive() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_TiberiumExplosive); + str = GetText(&m_TiberiumExplosive); ini.SetString("SpecialFlags", "TiberiumExplosive", str); } -void CSpecialFlags::OnEditchangeDestroyablebridges() +void CSpecialFlags::OnEditchangeDestroyablebridges() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_DestroyableBridges); + str = GetText(&m_DestroyableBridges); ini.SetString("SpecialFlags", "DestroyableBridges", str); } -void CSpecialFlags::OnEditchangeMcvdeploy() +void CSpecialFlags::OnEditchangeMcvdeploy() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_MCVDeploy); + str = GetText(&m_MCVDeploy); ini.SetString("SpecialFlags", "MCVDeploy", str); } -void CSpecialFlags::OnEditchangeInitialveteran() +void CSpecialFlags::OnEditchangeInitialveteran() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_InitialVeteran); + str = GetText(&m_InitialVeteran); ini.SetString("SpecialFlags", "InitialVeteran", str); } -void CSpecialFlags::OnEditchangeFixedalliance() +void CSpecialFlags::OnEditchangeFixedalliance() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_FixedAlliance); + str = GetText(&m_FixedAlliance); ini.SetString("SpecialFlags", "FixedAlliance", str); } -void CSpecialFlags::OnEditchangeHarvesterimmune() +void CSpecialFlags::OnEditchangeHarvesterimmune() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_HarvesterImmune); + str = GetText(&m_HarvesterImmune); ini.SetString("SpecialFlags", "HarvesterImmune", str); } -void CSpecialFlags::OnEditchangeFogofwar() +void CSpecialFlags::OnEditchangeFogofwar() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_FogOfWar); + str = GetText(&m_FogOfWar); ini.SetString("SpecialFlags", "FogOfWar", str); } -void CSpecialFlags::OnEditchangeInert() +void CSpecialFlags::OnEditchangeInert() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_Inert); + str = GetText(&m_Inert); ini.SetString("SpecialFlags", "Inert", str); } -void CSpecialFlags::OnEditchangeIonstorms() +void CSpecialFlags::OnEditchangeIonstorms() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_IonStorms); + str = GetText(&m_IonStorms); ini.SetString("SpecialFlags", "IonStorms", str); } -void CSpecialFlags::OnEditchangeMeteorites() +void CSpecialFlags::OnEditchangeMeteorites() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_Meteorites); + str = GetText(&m_Meteorites); ini.SetString("SpecialFlags", "Meteorites", str); } -void CSpecialFlags::OnEditchangeVisceroids() +void CSpecialFlags::OnEditchangeVisceroids() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString str; - str=GetText(&m_Visceroids); + str = GetText(&m_Visceroids); ini.SetString("SpecialFlags", "Visceroids", str); } diff --git a/MissionEditor/SpecialFlags.h b/MissionEditor/SpecialFlags.h index e02146e..3d9ef95 100644 --- a/MissionEditor/SpecialFlags.h +++ b/MissionEditor/SpecialFlags.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_SPECIALFLAGS_H__500DF000_7058_11D3_99E1_97DB32807805__INCLUDED_) @@ -32,7 +32,7 @@ class CSpecialFlags : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateDialog(); CSpecialFlags(CWnd* pParent = NULL); // Standardkonstruktor @@ -59,7 +59,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CSpecialFlags) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/StdAfx.cpp b/MissionEditor/StdAfx.cpp index e687021..8c0c6cd 100644 --- a/MissionEditor/StdAfx.cpp +++ b/MissionEditor/StdAfx.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // stdafx.cpp : Quelltextdatei, die nur die Standard-Includes einbindet @@ -30,7 +30,7 @@ TILEDATA::~TILEDATA() { - memset(this,0, sizeof(TILEDATA)); + memset(this, 0, sizeof(TILEDATA)); } diff --git a/MissionEditor/StdAfx.h b/MissionEditor/StdAfx.h index 456a46f..9433283 100644 --- a/MissionEditor/StdAfx.h +++ b/MissionEditor/StdAfx.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // stdafx.h : include everything that should be available everywhere in the code diff --git a/MissionEditor/Structs.h b/MissionEditor/Structs.h index d536611..e2d8d86 100644 --- a/MissionEditor/Structs.h +++ b/MissionEditor/Structs.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /************************************** @@ -49,8 +49,7 @@ enum class TheaterChar : char inline TheaterChar toTheaterChar(char c) { - switch (c) - { + switch (c) { case 'T': return TheaterChar::T; case 'A': @@ -67,7 +66,7 @@ inline TheaterChar toTheaterChar(char c) return TheaterChar::Generic; default: return TheaterChar::None; - } + } } struct CLIPBOARD_MAPCOPY_ENTRY @@ -76,7 +75,7 @@ struct CLIPBOARD_MAPCOPY_ENTRY BYTE overlay; BYTE overlaydata; WORD wGround; - WORD bMapData; + WORD bMapData; BYTE bSubTile; BYTE bHeight; BYTE bMapData2; @@ -108,7 +107,7 @@ picdata Holds information for every picture: a directdraw surface, and additional data */ -struct PICDATA{ +struct PICDATA { PICDATA() = default; PICDATA(const PICDATA& c) = default; PICDATA& operator=(const PICDATA& c) = default; @@ -124,7 +123,7 @@ struct PICDATA{ std::shared_ptr> rawPic; std::shared_ptr> _vBorder; #endif - + FSunPackLib::VoxelNormalClass normalClass = FSunPackLib::VoxelNormalClass::Unknown; short x = 0; // for SHPs (starting point of main graphic inside surface) short y = 0; // for SHPs (starting point of main graphic inside surface) @@ -152,7 +151,7 @@ TILEPIC / TILEDATA Holds information for every tile/subtile in TS. */ -struct SUBTILE{ +struct SUBTILE { #ifndef NOSURFACES LPDIRECTDRAWSURFACE4 pic; #else @@ -160,9 +159,9 @@ struct SUBTILE{ BOOL bNotExtracted; // pic is not extracted, even if NOSURFACES_EXTRACT is specifed. Probably there is inner transparency! #endif BYTE* pic; // optionally use direct blitting? This is either a palette index array or non-palette data (if NOSURFACES_EXTRACT is specified) - VBORDER * vborder; + VBORDER* vborder; #endif - + WORD wWidth; // width of tile WORD wHeight; // height " short sX; // x starting pos @@ -181,7 +180,7 @@ struct SUBTILE{ return ProjectedVec(sX, sY); } }; -struct TILEDATA{ +struct TILEDATA { TILEDATA() = default; ~TILEDATA(); WORD wTileSet = 0; @@ -196,7 +195,7 @@ struct TILEDATA{ BOOL bMarbleMadness = FALSE; WORD wMarbleGround = 0xFFFF; -public: +public: RECT rect = { 0 }; TILEDATA* lpReplacements = nullptr; @@ -209,7 +208,7 @@ actiondata CViewObjects sets this data struct, and CIsoView uses it to interact with the user´s CViewObjects and terrain editing choice */ -struct ACTIONDATA{ +struct ACTIONDATA { DWORD mode; DWORD type; DWORD data; @@ -224,12 +223,12 @@ struct ACTIONDATA{ void reset(); }; -struct SIDEINFO{ +struct SIDEINFO { CString name; int orig_n; -}; +}; -struct HOUSEINFO{ +struct HOUSEINFO { CString name; SIDEINFO* side; // side is used for rules.ini owner= settings RGBTRIPLE color; @@ -240,8 +239,8 @@ struct HOUSEINFO{ Unittype infos **********************/ -/* -building infos +/* +building infos */ struct BUILDING_INFO { @@ -285,12 +284,12 @@ enum ConditionEnum { struct AITrigInfo { - union{ - struct{ - int Number; - ConditionEnum Condition; - }; - char Padding[32]; + union { + struct { + int Number; + ConditionEnum Condition; + }; + char Padding[32]; }; }; @@ -304,54 +303,52 @@ struct XCString { //wString=new(WCHAR[2]); //memset(wString, 0, 4); - wString=NULL; - bUsedDefault=FALSE; - len=0; + wString = NULL; + bUsedDefault = FALSE; + len = 0; } ~XCString() { - if(wString) delete[] wString; - len=0; - wString=NULL; + if (wString) delete[] wString; + len = 0; + wString = NULL; } void SetString(const CHAR* cString) { - len=strlen(cString); + len = strlen(cString); + + this->cString = cString; + + if (wString) delete[] wString; + + bUsedDefault = FALSE; + wString = new(WCHAR[len + 1]); + memset(wString, 0, (len + 1) * 2); - this->cString=cString; - - if(wString) delete[] wString; - - bUsedDefault=FALSE; - wString=new(WCHAR[len+1]); - memset(wString, 0, (len+1)*2); - //MultiByteToWideChar(CP_ACP, WC_COMPOSITECHECK, cString, len, wString, len+1); - mbstowcs(wString, cString, len); + mbstowcs(wString, cString, len); } void SetString(const WCHAR* wString, int len) { - this->len=len; + this->len = len; - if(this->wString) delete[] this->wString; - - bUsedDefault=FALSE; + if (this->wString) delete[] this->wString; - this->wString=new(WCHAR[len+1]); - memset(this->wString, 0, (len+1)*2); - memcpy(this->wString, wString, len*2); + bUsedDefault = FALSE; + + this->wString = new(WCHAR[len + 1]); + memset(this->wString, 0, (len + 1) * 2); + memcpy(this->wString, wString, len * 2); auto bufferSize = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, this->wString, len + 1, nullptr, 0, NULL, &bUsedDefault); - if (bufferSize == 0) - { + if (bufferSize == 0) { cString = ""; return; // failed } std::vector bByte(bufferSize + 4, 0); - if (WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, this->wString, len + 1, (LPSTR)bByte.data(), bufferSize, NULL, &bUsedDefault) == 0) - { + if (WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, this->wString, len + 1, (LPSTR)bByte.data(), bufferSize, NULL, &bUsedDefault) == 0) { cString = ""; return; // failed } @@ -374,7 +371,7 @@ AITRIGGERTYPE{}; Data for ai trigger types */ -struct AITRIGGERTYPE{ +struct AITRIGGERTYPE { CString ID; // ai trigger id CString name; // param 1 CString teamtype1; // param 2 @@ -400,7 +397,7 @@ struct AITRIGGERTYPE{ STDOBJECTDATA Data for Trees, Units, Infantry, Aircraft & Structures -This should be used for painting procedure... +This should be used for painting procedure... except if you want to draw the upgrades on buildings */ struct STDOBJECTDATA @@ -417,7 +414,7 @@ STRUCTURE Data for a structure */ -struct STRUCTURE{ +struct STRUCTURE { CString house; // 1 CString type; // 2 CString strength; // 3 @@ -435,11 +432,11 @@ struct STRUCTURE{ CString upgrade3; // 15 CString flag3; // 16 CString flag4; // 17 - unsigned deleted:1; + unsigned deleted : 1; }; // structure data especially for painting -struct STRUCTUREPAINT{ +struct STRUCTUREPAINT { COLORREF col; CString type; short x; @@ -458,7 +455,7 @@ struct INFANTRY{}; Data for an infantry unit */ -struct INFANTRY{ +struct INFANTRY { CString house; // 1 CString type; // 2 CString strength; // 3 @@ -473,10 +470,10 @@ struct INFANTRY{ CString flag3; // 12 CString flag4; // 13 CString flag5; // 14 - unsigned deleted:1; + unsigned deleted : 1; }; -struct UNIT{ +struct UNIT { CString house; // 1 CString type; // 2 CString strength; // 3 @@ -491,12 +488,12 @@ struct UNIT{ CString flag4; // 12 CString flag5; // 13 CString flag6; // 14 - unsigned deleted:1; + unsigned deleted : 1; }; -struct AIRCRAFT{ +struct AIRCRAFT { CString house; // 1 CString type; // 2 CString strength; // 3 @@ -509,23 +506,23 @@ struct AIRCRAFT{ CString flag2; // 10 CString flag3; // 11 CString flag4; // 12 - unsigned deleted:1; + unsigned deleted : 1; }; -struct TERRAIN{ +struct TERRAIN { CString type; int x; int y; - unsigned deleted:1; + unsigned deleted : 1; }; // MW 08/07/01: Smudge #ifdef SMUDGE_SUPP -struct SMUDGE{ +struct SMUDGE { CString type; int x; int y; - unsigned deleted:1; + unsigned deleted : 1; }; #endif @@ -534,7 +531,7 @@ NODE Data for a node */ -struct NODE{ +struct NODE { CString house; CString type; CString x; @@ -555,95 +552,89 @@ struct RA2STRFILEHEAD struct RA2STRINGENTRY { - RA2STRINGENTRY(){ + RA2STRINGENTRY() { //memset(this, 0, sizeof(RA2STRINGENTRY)); - id=NULL; - value=NULL; - value_asc=0; - value_asc_size=0; + id = NULL; + value = NULL; + value_asc = 0; + value_asc_size = 0; dwFlag = 0; id_size = 0; value_size = 0; } - ~RA2STRINGENTRY(){ - if(value) delete[] value; - if(id) delete[] id; - if(value_asc) delete[] value_asc; - value=NULL; - value_size=0; - id=NULL; - id_size=0; - value_asc=0; - value_asc_size=0; + ~RA2STRINGENTRY() { + if (value) delete[] value; + if (id) delete[] id; + if (value_asc) delete[] value_asc; + value = NULL; + value_size = 0; + id = NULL; + id_size = 0; + value_asc = 0; + value_asc_size = 0; } RA2STRINGENTRY(RA2STRINGENTRY& ref) { - value=NULL; - value_size=0; - id=NULL; + value = NULL; + value_size = 0; + id = NULL; id_size = 0; - value_asc=0; - value_asc_size=0; - - if(ref.value_size && ref.value) - { - value_size=ref.value_size; - value=new(WCHAR[value_size+1]); - memcpy(value, ref.value, value_size*sizeof(WCHAR)); - value[value_size]=0; + value_asc = 0; + value_asc_size = 0; + + if (ref.value_size && ref.value) { + value_size = ref.value_size; + value = new(WCHAR[value_size + 1]); + memcpy(value, ref.value, value_size * sizeof(WCHAR)); + value[value_size] = 0; } - if(ref.id_size && ref.id) - { - id_size=ref.id_size; - id=new(CHAR[id_size+1]); - memcpy(id, ref.id, id_size*sizeof(CHAR)); - id[id_size]=0; + if (ref.id_size && ref.id) { + id_size = ref.id_size; + id = new(CHAR[id_size + 1]); + memcpy(id, ref.id, id_size * sizeof(CHAR)); + id[id_size] = 0; } - if(ref.value_asc_size && ref.value_asc) - { - value_asc_size=ref.value_asc_size; - value_asc=new(CHAR[value_asc_size+1]); - memcpy(value_asc, ref.value_asc, value_asc_size*sizeof(CHAR)); - value_asc[value_asc_size]=0; + if (ref.value_asc_size && ref.value_asc) { + value_asc_size = ref.value_asc_size; + value_asc = new(CHAR[value_asc_size + 1]); + memcpy(value_asc, ref.value_asc, value_asc_size * sizeof(CHAR)); + value_asc[value_asc_size] = 0; } - dwFlag=ref.dwFlag; + dwFlag = ref.dwFlag; } RA2STRINGENTRY& operator=(RA2STRINGENTRY& ref) { - if(value) delete[] value; - if(id) delete[] id; - value=NULL; - value_size=0; - id=NULL; - value_asc=0; - value_asc_size=0; - - if(ref.value_size) - { - value_size=ref.value_size; - value=new(WCHAR[value_size+1]); - memcpy(value, ref.value, value_size*sizeof(WCHAR)); - value[value_size]=0; + if (value) delete[] value; + if (id) delete[] id; + value = NULL; + value_size = 0; + id = NULL; + value_asc = 0; + value_asc_size = 0; + + if (ref.value_size) { + value_size = ref.value_size; + value = new(WCHAR[value_size + 1]); + memcpy(value, ref.value, value_size * sizeof(WCHAR)); + value[value_size] = 0; } - if(ref.id_size) - { - id_size=ref.id_size; - id=new(CHAR[id_size+1]); - memcpy(id, ref.id, id_size*sizeof(CHAR)); - id[id_size]=0; + if (ref.id_size) { + id_size = ref.id_size; + id = new(CHAR[id_size + 1]); + memcpy(id, ref.id, id_size * sizeof(CHAR)); + id[id_size] = 0; } - if(ref.value_asc_size) - { - value_asc_size=ref.value_asc_size; - value_asc=new(CHAR[value_asc_size+1]); - memcpy(value_asc, ref.value_asc, value_asc_size*sizeof(CHAR)); - value_asc[value_asc_size]=0; + if (ref.value_asc_size) { + value_asc_size = ref.value_asc_size; + value_asc = new(CHAR[value_asc_size + 1]); + memcpy(value_asc, ref.value_asc, value_asc_size * sizeof(CHAR)); + value_asc[value_asc_size] = 0; } - dwFlag=ref.dwFlag; + dwFlag = ref.dwFlag; return *this; } - + DWORD dwFlag; CHAR* id; DWORD id_size; diff --git a/MissionEditor/TSOptions.cpp b/MissionEditor/TSOptions.cpp index 6d15d0b..4e8cd87 100644 --- a/MissionEditor/TSOptions.cpp +++ b/MissionEditor/TSOptions.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TSOptions.cpp: implementation @@ -72,7 +72,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CTSOptions -void CTSOptions::OnChoose() +void CTSOptions::OnChoose() { #ifndef RA2_MODE CFileDialog fd(TRUE, NULL, "Sun.exe", OFN_FILEMUSTEXIST, "Tiberian Sun EXE|Sun.exe|"); @@ -87,24 +87,24 @@ void CTSOptions::OnChoose() delete fd; } -void CTSOptions::OnOK() +void CTSOptions::OnOK() { this->GetDlgItem(IDC_EDIT1)->GetWindowText(m_TSEXE); - int n=m_Language.GetItemData(m_Language.GetCurSel()); - + int n = m_Language.GetItemData(m_Language.GetCurSel()); + m_LanguageName = language["Languages"].Nth(n).second; CDialog::OnOK(); } -BOOL CTSOptions::OnInitDialog() +BOOL CTSOptions::OnInitDialog() { CDialog::OnInitDialog(); - + m_TSExe.SetWindowText((LPCTSTR)theApp.m_Options.TSExe); - - if(theApp.m_Options.bSearchLikeTS) m_LikeTS=0; - else m_LikeTS=1; + + if (theApp.m_Options.bSearchLikeTS) m_LikeTS = 0; + else m_LikeTS = 1; m_PreferLocalTheaterFiles = theApp.m_Options.bPreferLocalTheaterFiles ? TRUE : FALSE; @@ -119,6 +119,6 @@ BOOL CTSOptions::OnInitDialog() m_Language.SetCurSel(i); } } - - return TRUE; + + return TRUE; } diff --git a/MissionEditor/TSOptions.h b/MissionEditor/TSOptions.h index 329cfd7..b50930b 100644 --- a/MissionEditor/TSOptions.h +++ b/MissionEditor/TSOptions.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TSOPTIONS_H__AFDC93E0_651A_11D3_99E0_B9A145C86B12__INCLUDED_) @@ -32,7 +32,7 @@ class CTSOptions : public CDialog { -// Konstruktion + // Konstruktion public: BOOL m_PreferLocalTheaterFiles; CString m_LanguageName; @@ -51,7 +51,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTSOptions) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL @@ -65,7 +65,7 @@ protected: virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() -private: +private: }; //{{AFX_INSERT_LOCATION}} diff --git a/MissionEditor/Tags.cpp b/MissionEditor/Tags.cpp index 34ec382..fbc07df 100644 --- a/MissionEditor/Tags.cpp +++ b/MissionEditor/Tags.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Tags.cpp: Implementierungsdatei @@ -81,12 +81,12 @@ END_MESSAGE_MAP() void CTags::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Tag.GetCurSel(); - - while(m_Tag.DeleteString(0)!=CB_ERR); - while(m_Trigger.DeleteString(0)!=CB_ERR); + int sel = m_Tag.GetCurSel(); + + while (m_Tag.DeleteString(0) != CB_ERR); + while (m_Trigger.DeleteString(0) != CB_ERR); int i; for (auto const& [type, def] : ini["Tags"]) { @@ -106,24 +106,22 @@ void CTags::UpdateDialog() m_Trigger.AddString(s); } - if(m_Tag.SetCurSel(0)!=CB_ERR) + if (m_Tag.SetCurSel(0) != CB_ERR) OnSelchangeTag(); - if(sel!=-1) - { - if(m_Tag.SetCurSel(sel)!=CB_ERR) - { + if (sel != -1) { + if (m_Tag.SetCurSel(sel) != CB_ERR) { OnSelchangeTag(); } } } -void CTags::OnSelchangeTag() +void CTags::OnSelchangeTag() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); + int index = m_Tag.GetCurSel(); if (index < 0) { return; } @@ -134,59 +132,59 @@ void CTags::OnSelchangeTag() } CString data = ini.GetString("Tags", type); - m_Name=GetParam(data,1); - CString trigger=GetParam(data,2); - CString typ=trigger; + m_Name = GetParam(data, 1); + CString trigger = GetParam(data, 2); + CString typ = trigger; - trigger+=" ("; + trigger += " ("; auto const& def = ini.GetString("Triggers", typ); - if(!def.IsEmpty()) { + if (!def.IsEmpty()) { trigger += GetParam(def, 2); } - trigger+=")"; + trigger += ")"; m_Trigger.SetWindowText(trigger); - - - m_Repeat.SetWindowText(GetParam(data,0)); - + + m_Repeat.SetWindowText(GetParam(data, 0)); + + UpdateData(FALSE); } -void CTags::OnChangeName() +void CTags::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - CEdit& name=*(CEdit*)GetDlgItem(IDC_NAME); - int sel2=name.GetSel(); + CEdit& name = *(CEdit*)GetDlgItem(IDC_NAME); + int sel2 = name.GetSel(); - int index=m_Tag.GetCurSel(); - if(index<0) return; + int index = m_Tag.GetCurSel(); + if (index < 0) return; CString type; m_Tag.GetLBText(index, type); - if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0); + if (type.Find(" ") >= 0) type.SetAt(type.Find(" "), 0); auto const& data = ini.GetString("Tags", type); - + CString tag, repeat; tag = GetParam(data, 2); repeat = GetParam(data, 0); - auto const& constructed = repeat + "," + m_Name + "," + tag; + auto const& constructed = repeat + "," + m_Name + "," + tag; ini.SetString("Tags", type, constructed); UpdateDialog(); name.SetSel(sel2); } -void CTags::OnEditchangeRepeat() +void CTags::OnEditchangeRepeat() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); + int index = m_Tag.GetCurSel(); if (index < 0) { return; } @@ -200,31 +198,31 @@ void CTags::OnEditchangeRepeat() type.SetAt(type.Find(" "), 0); } - auto const data=ini.GetString("Tags", type); - + auto const data = ini.GetString("Tags", type); + CString trigger, name; trigger = GetParam(data, 2); name = GetParam(data, 1); - auto const constructed = str + "," + name + "," + trigger; + auto const constructed = str + "," + name + "," + trigger; ini.SetString("Tags", type, constructed); - + UpdateDialog(); } -void CTags::OnSelchangeRepeat() +void CTags::OnSelchangeRepeat() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); - if(index<0) return; + int index = m_Tag.GetCurSel(); + if (index < 0) return; - int v=m_Repeat.GetCurSel(); + int v = m_Repeat.GetCurSel(); CString str; - - m_Repeat.GetLBText(v,str); + + m_Repeat.GetLBText(v, str); CString type; @@ -240,54 +238,54 @@ void CTags::OnSelchangeRepeat() name = GetParam(data, 1); auto const constructed = str + "," + name + "," + trigger; ini.SetString("Tags", type, constructed); - + UpdateDialog(); } -void CTags::OnEditchangeTrigger() +void CTags::OnEditchangeTrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); - if(index<0) return; + int index = m_Tag.GetCurSel(); + if (index < 0) return; CString str; m_Trigger.GetWindowText(str); - if(str.Find(" ")>=0) str.SetAt(str.Find(" "),0); + if (str.Find(" ") >= 0) str.SetAt(str.Find(" "), 0); CString type; m_Tag.GetLBText(index, type); - if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0); + if (type.Find(" ") >= 0) type.SetAt(type.Find(" "), 0); auto const data = ini.GetString("Tags", type); - + CString repeat, name; repeat = GetParam(data, 0); name = GetParam(data, 1); auto const constructed = repeat + "," + name + "," + (LPCTSTR)str; ini.SetString("Tags", type, constructed); - + //UpdateDialog(); - + } -void CTags::OnSelchangeTrigger() +void CTags::OnSelchangeTrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); + int index = m_Tag.GetCurSel(); if (index < 0) { return; } - int v=m_Trigger.GetCurSel(); + int v = m_Trigger.GetCurSel(); CString str; - - m_Trigger.GetLBText(v,str); - + + m_Trigger.GetLBText(v, str); + if (str.Find(" ") >= 0) { str.SetAt(str.Find(" "), 0); } @@ -299,21 +297,21 @@ void CTags::OnSelchangeTrigger() } auto const data = ini.GetString("Tags", type); - + CString repeat, name; - repeat=GetParam(data,0); - name=GetParam(data,1); - auto const constructed =repeat+","+name+","+(LPCTSTR)str; + repeat = GetParam(data, 0); + name = GetParam(data, 1); + auto const constructed = repeat + "," + name + "," + (LPCTSTR)str; ini.SetString("Tags", type, constructed); //UpdateDialog(); } -void CTags::OnDelete() +void CTags::OnDelete() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int index=m_Tag.GetCurSel(); + int index = m_Tag.GetCurSel(); if (index < 0) { return; } @@ -324,23 +322,23 @@ void CTags::OnDelete() type.SetAt(type.Find(" "), 0); } - int res=MessageBox("Are you sure to delete the selected tag? This may cause the attached trigger to don´t work anymore, if no other tag has the trigger attached.","Delete tag", MB_YESNO); + int res = MessageBox("Are you sure to delete the selected tag? This may cause the attached trigger to don´t work anymore, if no other tag has the trigger attached.", "Delete tag", MB_YESNO); if (res == IDNO) { return; } - + ini.RemoveValueByKey("Tags", type); UpdateDialog(); } -void CTags::OnAdd() +void CTags::OnAdd() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CString ID=GetFreeID(); + CString ID = GetFreeID(); if (ini["Triggers"].Size() < 1) { - MessageBox("Before creating tags, you need at least one trigger.","Error"); + MessageBox("Before creating tags, you need at least one trigger.", "Error"); return; }; @@ -349,18 +347,16 @@ void CTags::OnAdd() data += ini["Triggers"].Nth(0).first; ini.SetString("Tags", ID, data); - + UpdateDialog(); int i; - for(i=0;i=0) j.SetAt(j.Find(" "),0); + m_Tag.GetLBText(i, j); + if (j.Find(" ") >= 0) j.SetAt(j.Find(" "), 0); - if(j==ID) - { + if (j == ID) { m_Tag.SetCurSel(i); break; } diff --git a/MissionEditor/Tags.h b/MissionEditor/Tags.h index 2371db6..cd27fe3 100644 --- a/MissionEditor/Tags.h +++ b/MissionEditor/Tags.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TAGS_H__103BF600_9378_11D3_B63B_8867017BB441__INCLUDED_) @@ -34,14 +34,14 @@ class CTags : public CDialog { DECLARE_DYNCREATE(CTags) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CTags(); ~CTags(); -// Dialogfelddaten - //{{AFX_DATA(CTags) + // Dialogfelddaten + //{{AFX_DATA(CTags) enum { IDD = IDD_TAGS }; CComboBox m_Repeat; CComboBox m_Tag; @@ -53,7 +53,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTags) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TaskForce.cpp b/MissionEditor/TaskForce.cpp index e6096b1..c487da2 100644 --- a/MissionEditor/TaskForce.cpp +++ b/MissionEditor/TaskForce.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TaskForce.cpp: Implementierungsdatei @@ -90,29 +90,29 @@ END_MESSAGE_MAP() void CTaskForce::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_TaskForces.GetCurSel(); - int sel2=m_Units.GetCurSel(); + int sel = m_TaskForces.GetCurSel(); + int sel2 = m_Units.GetCurSel(); - while(m_TaskForces.DeleteString(0)!=CB_ERR); - while(m_Units.DeleteString(0)!=LB_ERR); - while(m_UnitType.DeleteString(0)!=CB_ERR); + while (m_TaskForces.DeleteString(0) != CB_ERR); + while (m_Units.DeleteString(0) != LB_ERR); + while (m_UnitType.DeleteString(0) != CB_ERR); // MW 07/24/01: Clear - m_Group=""; - m_Name=""; - m_NumberOfUnits=0; + m_Group = ""; + m_Name = ""; + m_NumberOfUnits = 0; UpdateData(FALSE); int i; - auto const& sec=ini["TaskForces"]; + auto const& sec = ini["TaskForces"]; for (auto const& [seq, id] : sec) { CString s; - s= id; - s+=" ("; + s = id; + s += " ("; s += ini[id].GetString("Name"); - s+=")"; + s += ")"; m_TaskForces.AddString(s); } @@ -149,37 +149,36 @@ void CTaskForce::UpdateDialog() OnSelchangeTaskforces(); } - - - if(!(sel2<0)) - { - if(m_Units.SetCurSel(sel2)!=LB_ERR) - OnSelchangeUnits(); + + + if (!(sel2 < 0)) { + if (m_Units.SetCurSel(sel2) != LB_ERR) + OnSelchangeUnits(); } - + } -void CTaskForce::OnEditchangeTaskforces() +void CTaskForce::OnEditchangeTaskforces() { // TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen - + } -void CTaskForce::OnSelchangeTaskforces() +void CTaskForce::OnSelchangeTaskforces() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString tf; - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); - auto const & sec=ini[tf]; + auto const& sec = ini[tf]; m_Name = sec.GetString("Name"); m_Group = sec.GetString("Group"); - + int i; while (m_Units.DeleteString(0) != LB_ERR); for (i = 0; i < sec.Size() - 2; i++) { @@ -205,42 +204,42 @@ void CTaskForce::OnSelchangeTaskforces() } } -void CTaskForce::OnSelchangeUnits() +void CTaskForce::OnSelchangeUnits() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Units.GetCurSel(); - int u=m_Units.GetItemData(sel); + int sel = m_Units.GetCurSel(); + int u = m_Units.GetItemData(sel); CString tf; - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); auto const& sec = ini[tf]; - auto const& data=sec.Nth(u).second; - CString c=GetParam(data, 0); - + auto const& data = sec.Nth(u).second; + CString c = GetParam(data, 0); + CString s; - CString type=GetParam(data,1); + CString type = GetParam(data, 1); /*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end()) s=ini.sections[(char*)(LPCTSTR)type].values["Name"]; else s=rules.sections[(char*)(LPCTSTR)type].values["Name"];*/ - s=Map->GetUnitName(type); + s = Map->GetUnitName(type); m_UnitType.SetWindowText(((CString)(LPCTSTR)type + (CString)" (" + s + (CString)")")); - m_NumberOfUnits=atoi(c); + m_NumberOfUnits = atoi(c); UpdateData(FALSE); } -void CTaskForce::OnDeleteunit() +void CTaskForce::OnDeleteunit() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Units.GetCurSel(); + int sel = m_Units.GetCurSel(); if (sel < 0) { return; } - int u=m_Units.GetItemData(sel); + int u = m_Units.GetItemData(sel); CString tf; tf = GetText(&m_TaskForces); @@ -266,53 +265,53 @@ void CTaskForce::OnDeleteunit() sec->RemoveByKey(l); sec->RemoveAt(lastpos); m_Units.DeleteString(sel); - + UpdateDialog(); return; } -void CTaskForce::OnChangeNumberunits() +void CTaskForce::OnChangeNumberunits() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Units.GetCurSel(); + int sel = m_Units.GetCurSel(); if (sel < 0) { return; } - int u=m_Units.GetItemData(sel); + int u = m_Units.GetItemData(sel); CString tf; - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); auto sec = ini.TryGetSection(tf); - + char k[50], n[50]; itoa(u, k, 10); itoa(m_NumberOfUnits, n, 10); - auto const& data=sec->GetString(k); - CString c=GetParam(data, 1); + auto const& data = sec->GetString(k); + CString c = GetParam(data, 1); sec->SetString(k, n + (CString)"," + c); UpdateDialog(); } -void CTaskForce::OnChangeName() +void CTaskForce::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - CEdit& n=*(CEdit*)GetDlgItem(IDC_NAME); - DWORD pos=n.GetSel(); + CEdit& n = *(CEdit*)GetDlgItem(IDC_NAME); + DWORD pos = n.GetSel(); if (m_TaskForces.GetCurSel() < 0) { return; } CString tf; - tf=GetText(&m_TaskForces); - + tf = GetText(&m_TaskForces); + TruncSpace(tf); ini.SetString(tf, "Name", m_Name); @@ -321,28 +320,28 @@ void CTaskForce::OnChangeName() n.SetSel(pos); } -void CTaskForce::OnEditchangeUnittype() +void CTaskForce::OnEditchangeUnittype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Units.GetCurSel(); + int sel = m_Units.GetCurSel(); if (sel < 0) { return; } - int u=m_Units.GetItemData(sel); + int u = m_Units.GetItemData(sel); CString tf; - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); auto sec = ini.TryGetSection(tf); ASSERT(sec != nullptr); char k[50]; itoa(u, k, 10); - + CString count = GetParam(sec->GetString(k), 0); - CString type=GetText(&m_UnitType); + CString type = GetText(&m_UnitType); TruncSpace(type); - + sec->SetString(k, count + "," + (char*)(LPCTSTR)type); CString ut; @@ -350,20 +349,20 @@ void CTaskForce::OnEditchangeUnittype() UpdateDialog(); m_UnitType.SetWindowText(ut); - + } -void CTaskForce::OnSelchangeUnittype() +void CTaskForce::OnSelchangeUnittype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Units.GetCurSel(); + int sel = m_Units.GetCurSel(); if (sel < 0) { return; } - int u=m_Units.GetItemData(sel); + int u = m_Units.GetItemData(sel); CString tf; - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); auto sec = ini.TryGetSection(tf); @@ -371,76 +370,76 @@ void CTaskForce::OnSelchangeUnittype() char k[50]; itoa(u, k, 10); - - CString count=GetParam(sec->GetString(k), 0); - CString type=GetText(&m_UnitType); + + CString count = GetParam(sec->GetString(k), 0); + CString type = GetText(&m_UnitType); TruncSpace(type); - + sec->SetString(k, count + "," + type); - UpdateDialog(); + UpdateDialog(); //m_UnitType.SetWindowText("H"); } -void CTaskForce::OnAddunit() +void CTaskForce::OnAddunit() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString tf; if (m_TaskForces.GetCurSel() < 0) { return; } - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); auto sec = ini.TryGetSection(tf); ASSERT(sec != nullptr); char k[50]; - int c=m_Units.GetCount(); + int c = m_Units.GetCount(); if (c == LB_ERR) { c = 0; } itoa(c, k, 10); - + sec->SetString(k, "1" + (CString)"," + rules["InfantryTypes"].Nth(0).second); - + UpdateDialog(); } -void CTaskForce::OnDeletetaskforce() +void CTaskForce::OnDeletetaskforce() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); CString tf; if (m_TaskForces.GetCurSel() < 0) { return; } - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); int res; - res=MessageBox("Are you sure to delete the selected task force? If you delete it, make sure to eliminate ANY references to this task force in team-types.","Delete task force",MB_YESNO); + res = MessageBox("Are you sure to delete the selected task force? If you delete it, make sure to eliminate ANY references to this task force in team-types.", "Delete task force", MB_YESNO); if (res == IDNO) { return; } ini.RemoveValueByKey("TaskForces", tf); ini.DeleteSection(tf); - while(m_Units.DeleteString(0)!=LB_ERR); + while (m_Units.DeleteString(0) != LB_ERR); //UpdateDialog(); ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE); } CString GetFree(const char* section); -void CTaskForce::OnAddtaskforce() +void CTaskForce::OnAddtaskforce() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CString ID=GetFreeID(); - CString tf=GetFree("TaskForces"); + CString ID = GetFreeID(); + CString tf = GetFree("TaskForces"); ini.SetString("TaskForces", tf, ID); ini.SetString(ID, "Name", "New task force"); @@ -451,27 +450,25 @@ void CTaskForce::OnAddtaskforce() ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE); int i; - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); @@ -479,7 +476,7 @@ void CTaskForce::OnChangeGroup() if (m_TaskForces.GetCurSel() < 0) { return; } - tf=GetText(&m_TaskForces); + tf = GetText(&m_TaskForces); TruncSpace(tf); diff --git a/MissionEditor/TaskForce.h b/MissionEditor/TaskForce.h index e84716a..4ca7e15 100644 --- a/MissionEditor/TaskForce.h +++ b/MissionEditor/TaskForce.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TASKFORCE_H__58AF6EC0_92E3_11D3_B63B_85DE97E7FB41__INCLUDED_) @@ -34,14 +34,14 @@ class CTaskForce : public CDialog { DECLARE_DYNCREATE(CTaskForce) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CTaskForce(); ~CTaskForce(); -// Dialogfelddaten - //{{AFX_DATA(CTaskForce) + // Dialogfelddaten + //{{AFX_DATA(CTaskForce) enum { IDD = IDD_TASKFORCES }; CComboBox m_UnitType; CListBox m_Units; @@ -55,7 +55,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTaskForce) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TeamTypes.cpp b/MissionEditor/TeamTypes.cpp index 6b12537..5d22498 100644 --- a/MissionEditor/TeamTypes.cpp +++ b/MissionEditor/TeamTypes.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TeamTypes.cpp: Implementierungsdatei @@ -181,8 +181,7 @@ END_MESSAGE_MAP() BOOL stob(const char* s) { - if(_stricmp(s,"no")==NULL) - { + if (_stricmp(s, "no") == NULL) { return FALSE; } return TRUE; @@ -190,13 +189,13 @@ BOOL stob(const char* s) CString btos(BOOL b) { - CString s="no"; - if(b==TRUE) s="yes"; + CString s = "no"; + if (b == TRUE) s = "yes"; return s; } -int letter2number(char let){ - int reply=let-'A'; +int letter2number(char let) { + int reply = let - 'A'; /*if(let=='A')reply=0; if(let=='B')reply=1; if(let=='C')reply=2; @@ -227,8 +226,8 @@ int letter2number(char let){ } -char number2letter(int let){ - int reply=let+'A'; +char number2letter(int let) { + int reply = let + 'A'; /*if(let==0)reply='A'; if(let==1)reply='B'; if(let==2)reply='C'; @@ -262,107 +261,100 @@ char number2letter(int let){ int GetWaypoint(const char* c) { - if(strlen(c)==0) return -1; - int i; - int res=0; - for(i=0;iShowWindow(SW_HIDE); m_MCD_L.ShowWindow(SW_HIDE); } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CComboBox& taskforces=*(CComboBox*)GetDlgItem(IDC_TASKFORCE); - CComboBox& scripts=*(CComboBox*)GetDlgItem(IDC_SCRIPT); - CComboBox& houses=*(CComboBox*)GetDlgItem(IDC_HOUSE); + CComboBox& taskforces = *(CComboBox*)GetDlgItem(IDC_TASKFORCE); + CComboBox& scripts = *(CComboBox*)GetDlgItem(IDC_SCRIPT); + CComboBox& houses = *(CComboBox*)GetDlgItem(IDC_HOUSE); - int sel=m_TeamTypes.GetCurSel(); + int sel = m_TeamTypes.GetCurSel(); - while(m_TeamTypes.DeleteString(0)!=CB_ERR); - while(taskforces.DeleteString(0)!=CB_ERR); - while(scripts.DeleteString(0)!=CB_ERR); + while (m_TeamTypes.DeleteString(0) != CB_ERR); + while (taskforces.DeleteString(0) != CB_ERR); + while (scripts.DeleteString(0) != CB_ERR); // MW 07/24/01: Clear: - m_Aggressive=0; - m_Annoyance=0; - m_AreTeamMembersRecruitable=0; - m_Autocreate=0; - m_AvoidThreats=0; - m_Droppod=0; - m_Full=0; - m_Group=""; - m_GuardSlower=0; - m_House=""; - m_IonImmune=0; - m_IsBaseDefense=0; - m_Loadable=0; - m_LooseRecruit=0; - m_Max=""; - m_Name=""; - m_OnlyTargetHouseEnemy=0; - m_OnTransOnly=0; - m_Prebuild=0; - m_Priority=""; - m_Recruiter=0; - m_Reinforce=0; - m_Script=""; - m_Suicide=0; - m_Tag=""; - m_TaskForce=""; - m_TechLevel=""; - m_TransportReturnsOnUnload=0; - m_TransportWaypoint=""; - m_VeteranLevel=""; - m_MindControlDecision=""; + m_Aggressive = 0; + m_Annoyance = 0; + m_AreTeamMembersRecruitable = 0; + m_Autocreate = 0; + m_AvoidThreats = 0; + m_Droppod = 0; + m_Full = 0; + m_Group = ""; + m_GuardSlower = 0; + m_House = ""; + m_IonImmune = 0; + m_IsBaseDefense = 0; + m_Loadable = 0; + m_LooseRecruit = 0; + m_Max = ""; + m_Name = ""; + m_OnlyTargetHouseEnemy = 0; + m_OnTransOnly = 0; + m_Prebuild = 0; + m_Priority = ""; + m_Recruiter = 0; + m_Reinforce = 0; + m_Script = ""; + m_Suicide = 0; + m_Tag = ""; + m_TaskForce = ""; + m_TechLevel = ""; + m_TransportReturnsOnUnload = 0; + m_TransportWaypoint = ""; + m_VeteranLevel = ""; + m_MindControlDecision = ""; UpdateData(FALSE); - + int i; - auto updateStringForCBox = [&ini](CComboBox& box , const CString& sec) { + auto updateStringForCBox = [&ini](CComboBox& box, const CString& sec) { for (auto const& [seq, id] : ini[sec]) { CString str; @@ -384,9 +376,9 @@ void CTeamTypes::UpdateDialog() ListTags(*(CComboBox*)GetDlgItem(IDC_TAG), FALSE); (*(CComboBox*)GetDlgItem(IDC_TAG)).InsertString(0, GetLanguageStringACP("None")); - + CComboBox* house; - house=(CComboBox*)GetDlgItem(IDC_HOUSE); + house = (CComboBox*)GetDlgItem(IDC_HOUSE); /*while(house->DeleteString(0)!=CB_ERR); // houses: rules.ini + map definitions! @@ -396,7 +388,7 @@ void CTeamTypes::UpdateDialog() // we use the map definitions! for(i=0;iAddString(*ini.sections["Houses"].GetValue(i)); + house->AddString(*ini.sections["Houses"].GetValue(i)); } } else @@ -404,13 +396,13 @@ void CTeamTypes::UpdateDialog() wasnohouse: for(i=0;iAddString(*rules.sections["Houses"].GetValue(i)); - } + house->AddString(*rules.sections["Houses"].GetValue(i)); + } }*/ ListHouses(*house, FALSE, TRUE, TRUE); CComboBox* wayp; - wayp=(CComboBox*)GetDlgItem(IDC_WAYPOINT); + wayp = (CComboBox*)GetDlgItem(IDC_WAYPOINT); while (wayp->DeleteString(0) != CB_ERR); // houses: rules.ini + map definitions! @@ -418,16 +410,16 @@ void CTeamTypes::UpdateDialog() wayp->AddString(num); } - wayp=(CComboBox*)GetDlgItem(IDC_TRANSPORTWAYPOINT); + wayp = (CComboBox*)GetDlgItem(IDC_TRANSPORTWAYPOINT); - while(wayp->DeleteString(0)!=CB_ERR); + while (wayp->DeleteString(0) != CB_ERR); // houses: rules.ini + map definitions! - wayp->SetItemData(wayp->InsertString(0,TranslateStringACP("None")),0); - + wayp->SetItemData(wayp->InsertString(0, TranslateStringACP("None")), 0); + for (auto const& [num, _] : ini["Waypoints"]) { wayp->SetItemData(wayp->AddString(num), 1); } - + #ifdef TS_MODE wayp->ShowWindow(SW_HIDE); #endif @@ -437,25 +429,25 @@ void CTeamTypes::UpdateDialog() m_TeamTypes.SetCurSel(sel); } OnSelchangeTeamtypes(); - - + + } -void CTeamTypes::OnSelchangeTeamtypes() +void CTeamTypes::OnSelchangeTeamtypes() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_TeamTypes.GetCurSel() < 0) { return; } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); auto const& sec = ini[str]; - m_Aggressive= sec.GetBool("Aggressive"); + m_Aggressive = sec.GetBool("Aggressive"); m_Annoyance = sec.GetBool("Annoyance"); m_AreTeamMembersRecruitable = sec.GetBool("AreTeamMembersRecruitable"); m_Autocreate = sec.GetBool("Autocreate"); @@ -499,21 +491,21 @@ void CTeamTypes::OnSelchangeTeamtypes() m_TaskForce += " (" + taskForceName + ")"; } m_TechLevel = sec.GetString("TechLevel"); - m_TransportReturnsOnUnload= sec.GetBool("TransportsReturnOnUnload"); + m_TransportReturnsOnUnload = sec.GetBool("TransportsReturnOnUnload"); m_VeteranLevel = sec.GetString("VeteranLevel"); - + if (yuri_mode) { m_MindControlDecision = sec.GetString("MindControlDecision"); } - + int w = GetWaypoint(sec["Waypoint"]); char c[50]; - itoa(w,c,10); - if(w!=-1) - m_Waypoint=c; + itoa(w, c, 10); + if (w != -1) + m_Waypoint = c; else - m_Waypoint=""; + m_Waypoint = ""; #ifdef RA2_MODE if (sec.GetBool("UseTransportOrigin")) { @@ -530,23 +522,23 @@ void CTeamTypes::OnSelchangeTeamtypes() } #endif - m_Whiner= sec.GetBool("Whiner"); + m_Whiner = sec.GetBool("Whiner"); UpdateData(FALSE); } -void CTeamTypes::OnChangeName() +void CTeamTypes::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); - if(m_TeamTypes.GetCount()==0) return; + if (m_TeamTypes.GetCount() == 0) return; - CEdit& n=*(CEdit*)GetDlgItem(IDC_NAME); - DWORD pos=n.GetSel(); + CEdit& n = *(CEdit*)GetDlgItem(IDC_NAME); + DWORD pos = n.GetSel(); CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "Name", m_Name); @@ -556,22 +548,22 @@ void CTeamTypes::OnChangeName() n.SetSel(pos); } -void CTeamTypes::OnDeleteteamtype() +void CTeamTypes::OnDeleteteamtype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_TeamTypes.GetCurSel() != -1) { - int res=MessageBox("Are you sure that you want to delete the selected team-type? If you delete it, don´t forget to delete any reference to the team-type.","Delete team-type",MB_YESNO); + int res = MessageBox("Are you sure that you want to delete the selected team-type? If you delete it, don´t forget to delete any reference to the team-type.", "Delete team-type", MB_YESNO); if (res == IDNO) { return; } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (auto pSec = ini.TryGetSection("TeamTypes")) { pSec->RemoveValue(str); } @@ -581,9 +573,9 @@ void CTeamTypes::OnDeleteteamtype() //UpdateDialog(); } -void CTeamTypes::OnEditchangeVeteranlevel() +void CTeamTypes::OnEditchangeVeteranlevel() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -591,7 +583,7 @@ void CTeamTypes::OnEditchangeVeteranlevel() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "VeteranLevel", m_VeteranLevel); @@ -599,7 +591,7 @@ void CTeamTypes::OnEditchangeVeteranlevel() void CTeamTypes::OnEditchangeHouse() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -613,9 +605,9 @@ void CTeamTypes::OnEditchangeHouse() ini.SetString(str, "House", TranslateHouse(m_House)); } -void CTeamTypes::OnChangePriority() +void CTeamTypes::OnChangePriority() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -623,15 +615,15 @@ void CTeamTypes::OnChangePriority() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "Priority", m_Priority); } -void CTeamTypes::OnChangeMax() +void CTeamTypes::OnChangeMax() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -639,15 +631,15 @@ void CTeamTypes::OnChangeMax() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "Max", m_Max); } -void CTeamTypes::OnEditchangeTechlevel() +void CTeamTypes::OnEditchangeTechlevel() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -655,15 +647,15 @@ void CTeamTypes::OnEditchangeTechlevel() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "TechLevel", m_TechLevel); } -void CTeamTypes::OnEditchangeGroup() +void CTeamTypes::OnEditchangeGroup() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -671,15 +663,15 @@ void CTeamTypes::OnEditchangeGroup() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetString(str, "Group", m_Group); } -void CTeamTypes::OnEditchangeWaypoint() +void CTeamTypes::OnEditchangeWaypoint() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -687,7 +679,7 @@ void CTeamTypes::OnEditchangeWaypoint() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); auto sec = ini.TryGetSection(str); ASSERT(sec != nullptr); @@ -699,9 +691,9 @@ void CTeamTypes::OnEditchangeWaypoint() } } -void CTeamTypes::OnEditchangeScript() +void CTeamTypes::OnEditchangeScript() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -709,17 +701,17 @@ void CTeamTypes::OnEditchangeScript() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); - CString tmp=m_Script; + CString tmp = m_Script; TruncSpace(tmp); ini.SetString(str, "Script", tmp); } -void CTeamTypes::OnEditchangeTaskforce() +void CTeamTypes::OnEditchangeTaskforce() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -727,57 +719,56 @@ void CTeamTypes::OnEditchangeTaskforce() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); - CString tmp=m_TaskForce; + CString tmp = m_TaskForce; TruncSpace(tmp); ini.SetString(str, "TaskForce", tmp); } -void CTeamTypes::OnKillfocusVeteranlevel() +void CTeamTypes::OnKillfocusVeteranlevel() { - OnEditchangeVeteranlevel(); + OnEditchangeVeteranlevel(); } -void CTeamTypes::OnKillfocusHouse() +void CTeamTypes::OnKillfocusHouse() { - OnEditchangeHouse(); + OnEditchangeHouse(); } -void CTeamTypes::OnKillfocusTechlevel() +void CTeamTypes::OnKillfocusTechlevel() { - OnEditchangeTechlevel(); + OnEditchangeTechlevel(); } -void CTeamTypes::OnKillfocusGroup() +void CTeamTypes::OnKillfocusGroup() { - OnEditchangeGroup(); + OnEditchangeGroup(); } -void CTeamTypes::OnKillfocusWaypoint() +void CTeamTypes::OnKillfocusWaypoint() { - OnEditchangeWaypoint(); + OnEditchangeWaypoint(); } -void CTeamTypes::OnKillfocusScript() +void CTeamTypes::OnKillfocusScript() { - OnEditchangeScript(); + OnEditchangeScript(); } -void CTeamTypes::OnKillfocusTaskforce() +void CTeamTypes::OnKillfocusTaskforce() { - OnEditchangeTaskforce(); + OnEditchangeTaskforce(); } -void CTeamTypes::OnShowWindow(BOOL bShow, UINT nStatus) +void CTeamTypes::OnShowWindow(BOOL bShow, UINT nStatus) { CDialog::OnShowWindow(bShow, nStatus); - - if(!bShow) - { + + if (!bShow) { OnKillfocusGroup(); OnKillfocusHouse(); OnKillfocusScript(); @@ -788,16 +779,16 @@ void CTeamTypes::OnShowWindow(BOOL bShow, UINT nStatus) OnKillfocusTag(); #ifdef RA2_MODE OnKillfocusTransportwaypoint(); - if(yuri_mode) OnKillfocusMindcontroldecision(); + if (yuri_mode) OnKillfocusMindcontroldecision(); #endif } } -void CTeamTypes::OnLoadable() +void CTeamTypes::OnLoadable() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -805,15 +796,15 @@ void CTeamTypes::OnLoadable() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Loadable", m_Loadable); } -void CTeamTypes::OnFull() +void CTeamTypes::OnFull() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -821,15 +812,15 @@ void CTeamTypes::OnFull() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Loadable", m_Full); } -void CTeamTypes::OnAnnoyance() +void CTeamTypes::OnAnnoyance() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -837,15 +828,15 @@ void CTeamTypes::OnAnnoyance() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Annoyance", m_Annoyance); } -void CTeamTypes::OnGuardslower() +void CTeamTypes::OnGuardslower() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -853,15 +844,15 @@ void CTeamTypes::OnGuardslower() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Annoyance", m_GuardSlower); } -void CTeamTypes::OnRecruiter() +void CTeamTypes::OnRecruiter() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -869,15 +860,15 @@ void CTeamTypes::OnRecruiter() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Annoyance", m_Recruiter); } -void CTeamTypes::OnDroppod() +void CTeamTypes::OnDroppod() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -885,15 +876,15 @@ void CTeamTypes::OnDroppod() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Annoyance", m_Droppod); } -void CTeamTypes::OnWhiner() +void CTeamTypes::OnWhiner() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -901,15 +892,15 @@ void CTeamTypes::OnWhiner() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Whiner", m_Whiner); } -void CTeamTypes::OnLooserecruit() +void CTeamTypes::OnLooserecruit() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -917,15 +908,15 @@ void CTeamTypes::OnLooserecruit() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "LooseRecruit", m_LooseRecruit); } -void CTeamTypes::OnAggressive() +void CTeamTypes::OnAggressive() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -933,15 +924,15 @@ void CTeamTypes::OnAggressive() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "LooseRecruit", m_Aggressive); } -void CTeamTypes::OnSuicide() +void CTeamTypes::OnSuicide() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -949,15 +940,15 @@ void CTeamTypes::OnSuicide() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Suicide", m_Suicide); } -void CTeamTypes::OnAutocreate() +void CTeamTypes::OnAutocreate() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -965,15 +956,15 @@ void CTeamTypes::OnAutocreate() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Autocreate", m_Autocreate); } -void CTeamTypes::OnPrebuild() +void CTeamTypes::OnPrebuild() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -981,15 +972,15 @@ void CTeamTypes::OnPrebuild() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Prebuild", m_Prebuild); } -void CTeamTypes::OnOntransonly() +void CTeamTypes::OnOntransonly() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -997,15 +988,15 @@ void CTeamTypes::OnOntransonly() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "OnTransOnly", m_OnTransOnly); } -void CTeamTypes::OnReinforce() +void CTeamTypes::OnReinforce() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1013,15 +1004,15 @@ void CTeamTypes::OnReinforce() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Reinforce", m_Reinforce); } -void CTeamTypes::OnAvoidthreats() +void CTeamTypes::OnAvoidthreats() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1029,15 +1020,15 @@ void CTeamTypes::OnAvoidthreats() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "Reinforce", m_AvoidThreats); } -void CTeamTypes::OnIonimmune() +void CTeamTypes::OnIonimmune() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1045,15 +1036,15 @@ void CTeamTypes::OnIonimmune() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "IonImmune", m_IonImmune); } -void CTeamTypes::OnTransportreturnsonunload() +void CTeamTypes::OnTransportreturnsonunload() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1061,15 +1052,15 @@ void CTeamTypes::OnTransportreturnsonunload() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "TransportsReturnOnUnload", m_TransportReturnsOnUnload); } -void CTeamTypes::OnAreteammembersrecruitable() +void CTeamTypes::OnAreteammembersrecruitable() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1077,15 +1068,15 @@ void CTeamTypes::OnAreteammembersrecruitable() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "AreTeamMembersRecruitable", m_AreTeamMembersRecruitable); } -void CTeamTypes::OnIsbasedefense() +void CTeamTypes::OnIsbasedefense() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1093,15 +1084,15 @@ void CTeamTypes::OnIsbasedefense() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "IsBaseDefense", m_IsBaseDefense); } -void CTeamTypes::OnOnlytargethouseenemy() +void CTeamTypes::OnOnlytargethouseenemy() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1109,7 +1100,7 @@ void CTeamTypes::OnOnlytargethouseenemy() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); ini.SetBool(str, "IsBaseDefense", m_OnlyTargetHouseEnemy); @@ -1117,13 +1108,13 @@ void CTeamTypes::OnOnlytargethouseenemy() CString GetFree(const char* section); -void CTeamTypes::OnNewteamtype() +void CTeamTypes::OnNewteamtype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CString id=GetFreeID(); + CString id = GetFreeID(); CString p; - p=GetFree("TeamTypes"); + p = GetFree("TeamTypes"); // TODO: change default value ini.SetString("TeamTypes", p, id); @@ -1162,32 +1153,30 @@ void CTeamTypes::OnNewteamtype() } #endif - - + + //UpdateDialog(); ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE); int i; - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1205,7 +1194,7 @@ void CTeamTypes::OnEditchangeTag() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); auto sec = ini.TryGetSection(str); @@ -1219,18 +1208,18 @@ void CTeamTypes::OnEditchangeTag() } } -void CTeamTypes::OnKillfocusTag() +void CTeamTypes::OnKillfocusTag() { - OnEditchangeTag(); + OnEditchangeTag(); } -void CTeamTypes::OnEditchangeTransportwaypoint() +void CTeamTypes::OnEditchangeTransportwaypoint() { #ifndef RA2_MODE return; #endif - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1238,7 +1227,7 @@ void CTeamTypes::OnEditchangeTransportwaypoint() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); auto sec = ini.TryGetSection(str); ASSERT(sec != nullptr); @@ -1248,17 +1237,17 @@ void CTeamTypes::OnEditchangeTransportwaypoint() return; } sec->SetString("TransportWaypoint", GetWaypoint(atoi(m_TransportWaypoint))); - sec->SetBool( "UseTransportOrigin", true); + sec->SetBool("UseTransportOrigin", true); } -void CTeamTypes::OnKillfocusTransportwaypoint() +void CTeamTypes::OnKillfocusTransportwaypoint() { - OnEditchangeTransportwaypoint(); + OnEditchangeTransportwaypoint(); } -void CTeamTypes::OnEditchangeMindcontroldecision() +void CTeamTypes::OnEditchangeMindcontroldecision() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(TRUE); if (m_TeamTypes.GetCount() == 0) { @@ -1266,16 +1255,16 @@ void CTeamTypes::OnEditchangeMindcontroldecision() } CString str; - str=GetText(&m_TeamTypes); + str = GetText(&m_TeamTypes); TruncSpace(str); auto sec = ini.TryGetSection(str); ASSERT(sec != nullptr); - CString tmp=m_MindControlDecision; + CString tmp = m_MindControlDecision; TruncSpace(tmp); sec->SetString("MindControlDecision", std::move(tmp)); } -void CTeamTypes::OnKillfocusMindcontroldecision() +void CTeamTypes::OnKillfocusMindcontroldecision() { - OnEditchangeMindcontroldecision(); + OnEditchangeMindcontroldecision(); } diff --git a/MissionEditor/TeamTypes.h b/MissionEditor/TeamTypes.h index f697372..491b200 100644 --- a/MissionEditor/TeamTypes.h +++ b/MissionEditor/TeamTypes.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ //{{AFX_INCLUDES() @@ -38,14 +38,14 @@ class CTeamTypes : public CDialog { DECLARE_DYNCREATE(CTeamTypes) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CTeamTypes(); ~CTeamTypes(); -// Dialogfelddaten - //{{AFX_DATA(CTeamTypes) + // Dialogfelddaten + //{{AFX_DATA(CTeamTypes) enum { IDD = IDD_TEAMTYPES }; CStatic m_MCD_L; CComboBox m_TeamTypes; @@ -88,7 +88,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTeamTypes) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TerrainDlg.cpp b/MissionEditor/TerrainDlg.cpp index 54b3196..b6c5fed 100644 --- a/MissionEditor/TerrainDlg.cpp +++ b/MissionEditor/TerrainDlg.cpp @@ -126,11 +126,10 @@ void CTerrainDlg::Update() while (TileSet->DeleteString(0) != CB_ERR); - if (tiles) - { + if (tiles) { int i; int tilecount = 0; - for (i = 0;i < 10000;i++) { + for (i = 0; i < 10000; i++) { CString tset; char c[50]; itoa(i, c, 10); @@ -232,8 +231,7 @@ DWORD CTerrainDlg::GetTileID(DWORD dwTileSet, int iTile) { int i, e; DWORD tilecount = 0; - for (i = 0; i < 10000; i++) - { + for (i = 0; i < 10000; i++) { CString tset; char c[50]; itoa(i, c, 10); diff --git a/MissionEditor/TerrainDlg.h b/MissionEditor/TerrainDlg.h index 5b2206d..b35208f 100644 --- a/MissionEditor/TerrainDlg.h +++ b/MissionEditor/TerrainDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TERRAINDLG_H__9746CA41_703A_11D4_9C87_EB588B546B1A__INCLUDED_) @@ -32,7 +32,7 @@ class CTerrainDlg : public CDialogBar { -// Konstruktion + // Konstruktion public: DWORD GetTileID(DWORD dwTileSet, int iTile); void Update(); @@ -47,9 +47,9 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTerrainDlg) - public: +public: virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL); - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung virtual void PostNcDestroy(); //}}AFX_VIRTUAL diff --git a/MissionEditor/TerrainModifier.cpp b/MissionEditor/TerrainModifier.cpp index 38574b2..e5972da 100644 --- a/MissionEditor/TerrainModifier.cpp +++ b/MissionEditor/TerrainModifier.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TerrainModifier.cpp: Implementierung der Klasse CTerrainModifier. @@ -28,7 +28,7 @@ #ifdef _DEBUG #undef THIS_FILE -static char THIS_FILE[]=__FILE__; +static char THIS_FILE[] = __FILE__; #define new DEBUG_NEW #endif diff --git a/MissionEditor/TerrainModifier.h b/MissionEditor/TerrainModifier.h index ef2a9d1..6befed2 100644 --- a/MissionEditor/TerrainModifier.h +++ b/MissionEditor/TerrainModifier.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TerrainModifier.h: Schnittstelle für die Klasse CTerrainModifier. @@ -31,7 +31,7 @@ #include "MapModifier.h" -class CTerrainModifier : public CMapModifier +class CTerrainModifier : public CMapModifier { public: CTerrainModifier(); diff --git a/MissionEditor/TextDrawer.cpp b/MissionEditor/TextDrawer.cpp index c878715..05209e7 100644 --- a/MissionEditor/TextDrawer.cpp +++ b/MissionEditor/TextDrawer.cpp @@ -1,22 +1,22 @@ #include "TextDrawer.h" /* - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -25,162 +25,148 @@ #include "Vec2.h" #include "MissionEditorPackLib.h" -TextDrawer::TextDrawer(IDirectDraw4* pDirectDraw, int fontSizeInPoints, COLORREF col, COLORREF shadowCol): m_fontSizeInPoints(fontSizeInPoints), m_col(col), m_shadowCol(shadowCol) +TextDrawer::TextDrawer(IDirectDraw4* pDirectDraw, int fontSizeInPoints, COLORREF col, COLORREF shadowCol) : m_fontSizeInPoints(fontSizeInPoints), m_col(col), m_shadowCol(shadowCol) { - auto dc = CDC::FromHandle(::GetDC(NULL)); - auto fontSizeInPixels = -MulDiv(fontSizeInPoints, dc->GetDeviceCaps(LOGPIXELSY), 72); - m_fontSizeInPixels = fontSizeInPixels; + auto dc = CDC::FromHandle(::GetDC(NULL)); + auto fontSizeInPixels = -MulDiv(fontSizeInPoints, dc->GetDeviceCaps(LOGPIXELSY), 72); + m_fontSizeInPixels = fontSizeInPixels; - CFont f; - f.CreateFont(fontSizeInPixels, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, NONANTIALIASED_QUALITY, VARIABLE_PITCH, "COURIER NEW"); + CFont f; + f.CreateFont(fontSizeInPixels, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, NONANTIALIASED_QUALITY, VARIABLE_PITCH, "COURIER NEW"); - // Build a string that contains all required characters in order - std::string s; - for (char c = 32; c <= 126; ++c) - s.push_back(c); + // Build a string that contains all required characters in order + std::string s; + for (char c = 32; c <= 126; ++c) + s.push_back(c); - // get the extent in pixels of all characters - dc->SelectObject(f); - const auto extent = dc->GetTextExtent(s.c_str(), s.size()); + // get the extent in pixels of all characters + dc->SelectObject(f); + const auto extent = dc->GetTextExtent(s.c_str(), s.size()); - // Now create the DirectDraw surface - DDSURFACEDESC2 desc = { 0 }; - desc.dwSize = sizeof(desc); - desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - desc.dwWidth = extent.cx; - desc.dwHeight = extent.cy * 2; + // Now create the DirectDraw surface + DDSURFACEDESC2 desc = { 0 }; + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + desc.dwWidth = extent.cx; + desc.dwHeight = extent.cy * 2; - m_charExtent.set(extent.cx / s.size(), extent.cy); + m_charExtent.set(extent.cx / s.size(), extent.cy); - auto bkcol = col == RGB(10, 10, 10) ? RGB(11, 11, 11) : RGB(10, 10, 10); + auto bkcol = col == RGB(10, 10, 10) ? RGB(11, 11, 11) : RGB(10, 10, 10); - auto pSurface = CComPtr(); - if (pDirectDraw->CreateSurface(&desc, &pSurface, nullptr) != DD_OK) - return; + auto pSurface = CComPtr(); + if (pDirectDraw->CreateSurface(&desc, &pSurface, nullptr) != DD_OK) + return; - desc.dwFlags |= DDSD_PIXELFORMAT; - pSurface->GetSurfaceDesc(&desc); - if (pSurface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) - { - FSunPackLib::ColorConverter c(desc.ddpfPixelFormat); - std::int32_t backcolor = c.GetColor(bkcol); - auto bytes_per_pixel = (desc.ddpfPixelFormat.dwRGBBitCount + 7) / 8; - BYTE* const pImage = static_cast(desc.lpSurface); - for (int i=0; i < desc.dwWidth; ++i) - { - for (int e = 0; e < desc.dwHeight; ++e) - { - memcpy(&pImage[e * desc.lPitch + i * bytes_per_pixel], &backcolor, bytes_per_pixel); - } - } - pSurface->Unlock(NULL); - } + desc.dwFlags |= DDSD_PIXELFORMAT; + pSurface->GetSurfaceDesc(&desc); + if (pSurface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) { + FSunPackLib::ColorConverter c(desc.ddpfPixelFormat); + std::int32_t backcolor = c.GetColor(bkcol); + auto bytes_per_pixel = (desc.ddpfPixelFormat.dwRGBBitCount + 7) / 8; + BYTE* const pImage = static_cast(desc.lpSurface); + for (int i = 0; i < desc.dwWidth; ++i) { + for (int e = 0; e < desc.dwHeight; ++e) { + memcpy(&pImage[e * desc.lPitch + i * bytes_per_pixel], &backcolor, bytes_per_pixel); + } + } + pSurface->Unlock(NULL); + } - - - HDC hDC; - if (pSurface->GetDC(&hDC) != DD_OK) - return; - // Draw the string with all characters onto the surface - SelectObject(hDC, f); - SetBkMode(hDC, TRANSPARENT); - if (shadowCol != CLR_INVALID) - { - SetTextColor(hDC, shadowCol); - if (!TextOutA(hDC, 0, extent.cy, s.c_str(), s.size())) - return; - } - SetTextColor(hDC, col); - if (!TextOutA(hDC, 0, 0, s.c_str(), s.size())) - return; - if (pSurface->ReleaseDC(hDC) != DD_OK) - return; + HDC hDC; + if (pSurface->GetDC(&hDC) != DD_OK) + return; - // set transparency key to top left - FSunPackLib::SetColorKey(pSurface, CLR_INVALID); - - // Everything fine, pass ownership of surface to m_fontSurface - m_fontSurface.Attach(pSurface.Detach()); + // Draw the string with all characters onto the surface + SelectObject(hDC, f); + SetBkMode(hDC, TRANSPARENT); + if (shadowCol != CLR_INVALID) { + SetTextColor(hDC, shadowCol); + if (!TextOutA(hDC, 0, extent.cy, s.c_str(), s.size())) + return; + } + SetTextColor(hDC, col); + if (!TextOutA(hDC, 0, 0, s.c_str(), s.size())) + return; + + if (pSurface->ReleaseDC(hDC) != DD_OK) + return; + + // set transparency key to top left + FSunPackLib::SetColorKey(pSurface, CLR_INVALID); + + // Everything fine, pass ownership of surface to m_fontSurface + m_fontSurface.Attach(pSurface.Detach()); } bool TextDrawer::isValid() const { - return m_fontSurface != nullptr; + return m_fontSurface != nullptr; } void TextDrawer::RenderText(IDirectDrawSurface4* target, int x, int y, const std::string& text, bool centered) const { - if (!isValid()) - return; + if (!isValid()) + return; - auto shadowOffset = 1 + m_fontSizeInPixels / 32; + auto shadowOffset = 1 + m_fontSizeInPixels / 32; - const int lineOffset = m_charExtent.y / 4; - ProjectedVec cur(x, y); - const int cw = m_charExtent.x; - const int ch = m_charExtent.y; + const int lineOffset = m_charExtent.y / 4; + ProjectedVec cur(x, y); + const int cw = m_charExtent.x; + const int ch = m_charExtent.y; - if (centered) - { - cur -= GetExtent(text) / 2; - } + if (centered) { + cur -= GetExtent(text) / 2; + } - for (const auto c: text) - { - if (c == '\n') - { - cur.set(x, cur.y + ch + lineOffset); - } - else if (c >= 32 && c <= 126) - { - auto i = c - 32; + for (const auto c : text) { + if (c == '\n') { + cur.set(x, cur.y + ch + lineOffset); + } else if (c >= 32 && c <= 126) { + auto i = c - 32; - - if (m_shadowCol != CLR_INVALID) - { - RECT s_shadow{ i * cw, ch, i * cw + cw, ch + ch }; - - target->BltFast(cur.x + 0 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x + 0 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x + 1 * shadowOffset, cur.y + 0 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x - 1 * shadowOffset, cur.y + 0 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x + 1 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x - 1 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x + 1 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - target->BltFast(cur.x - 1 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - } + if (m_shadowCol != CLR_INVALID) { + RECT s_shadow{ i * cw, ch, i * cw + cw, ch + ch }; - RECT s{ i * cw, 0, i * cw + cw, ch }; - target->BltFast(cur.x, cur.y, m_fontSurface, &s, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); - cur.x += cw; - } - } + target->BltFast(cur.x + 0 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x + 0 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x + 1 * shadowOffset, cur.y + 0 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x - 1 * shadowOffset, cur.y + 0 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + + target->BltFast(cur.x + 1 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x - 1 * shadowOffset, cur.y + 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x + 1 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + target->BltFast(cur.x - 1 * shadowOffset, cur.y - 1 * shadowOffset, m_fontSurface, &s_shadow, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + } + + RECT s{ i * cw, 0, i * cw + cw, ch }; + target->BltFast(cur.x, cur.y, m_fontSurface, &s, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT); + cur.x += cw; + } + } } ProjectedVec TextDrawer::GetExtent(const std::string& text) const { - ProjectedVec cur(0, 0); - const int lineOffset = m_charExtent.y / 4; - const int cw = m_charExtent.x; - const int ch = m_charExtent.y; - ProjectedVec maxpos(0, 0); - for (const auto c : text) - { - if (c == '\n') - { - cur.set(0, cur.y + ch + lineOffset); - } - else if (c >= 32 && c <= 126) - { - cur.x += cw; - maxpos.set(max(maxpos.x, cur.x), max(maxpos.y, cur.y + ch)); - } - - } - return maxpos; + ProjectedVec cur(0, 0); + const int lineOffset = m_charExtent.y / 4; + const int cw = m_charExtent.x; + const int ch = m_charExtent.y; + ProjectedVec maxpos(0, 0); + for (const auto c : text) { + if (c == '\n') { + cur.set(0, cur.y + ch + lineOffset); + } else if (c >= 32 && c <= 126) { + cur.x += cw; + maxpos.set(max(maxpos.x, cur.x), max(maxpos.y, cur.y + ch)); + } + + } + return maxpos; } diff --git a/MissionEditor/TextDrawer.h b/MissionEditor/TextDrawer.h index 99fdc86..340daa1 100644 --- a/MissionEditor/TextDrawer.h +++ b/MissionEditor/TextDrawer.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include @@ -29,19 +29,19 @@ class TextDrawer { public: - TextDrawer(IDirectDraw4* pDirectDraw, int fontSizeInPoints, COLORREF col, COLORREF shadowCol=CLR_INVALID); + TextDrawer(IDirectDraw4* pDirectDraw, int fontSizeInPoints, COLORREF col, COLORREF shadowCol = CLR_INVALID); - bool isValid() const; + bool isValid() const; - void RenderText(IDirectDrawSurface4* target, int x, int y, const std::string& text, bool centered=false) const; + void RenderText(IDirectDrawSurface4* target, int x, int y, const std::string& text, bool centered = false) const; - ProjectedVec GetExtent(const std::string& text) const; + ProjectedVec GetExtent(const std::string& text) const; private: - CComPtr m_fontSurface; - ProjectedVec m_charExtent; - int m_fontSizeInPoints; - int m_fontSizeInPixels; - COLORREF m_col; - COLORREF m_shadowCol; + CComPtr m_fontSurface; + ProjectedVec m_charExtent; + int m_fontSizeInPoints; + int m_fontSizeInPixels; + COLORREF m_col; + COLORREF m_shadowCol; }; \ No newline at end of file diff --git a/MissionEditor/TileSetBrowserFrame.h b/MissionEditor/TileSetBrowserFrame.h index 7b36572..59ae753 100644 --- a/MissionEditor/TileSetBrowserFrame.h +++ b/MissionEditor/TileSetBrowserFrame.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TILESETBROWSERFRAME_H__1FD3DBE1_7D2F_11D4_9C87_444553540000__INCLUDED_) @@ -42,16 +42,16 @@ public: // Attribute public: -// Operationen + // Operationen public: CTerrainDlg m_bar; -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CTileSetBrowserFrame) - public: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CTileSetBrowserFrame) +public: virtual void RecalcLayout(BOOL bNotify = TRUE); - protected: +protected: virtual void PostNcDestroy(); virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); //}}AFX_VIRTUAL diff --git a/MissionEditor/TileSetBrowserView.cpp b/MissionEditor/TileSetBrowserView.cpp index a9e1182..257cbb8 100644 --- a/MissionEditor/TileSetBrowserView.cpp +++ b/MissionEditor/TileSetBrowserView.cpp @@ -51,11 +51,9 @@ CTileSetBrowserView::CTileSetBrowserView() CTileSetBrowserView::~CTileSetBrowserView() { - if (m_lpDDS) - { + if (m_lpDDS) { int i; - for (i = 0;i < m_tilecount;i++) - { + for (i = 0; i < m_tilecount; i++) { if (m_lpDDS[i]) m_lpDDS[i]->Release(); } delete[] m_lpDDS; @@ -114,13 +112,11 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) int cur_y = 0; int cur_x = 0; - if (m_CurrentMode == 1) - { + if (m_CurrentMode == 1) { DWORD dwID = GetTileID(m_currentTileSet, 0); int i; - for (i = 0;i < m_tilecount;i++) - { + for (i = 0; i < m_tilecount; i++) { char c[50]; itoa(i, c, 10); @@ -129,10 +125,8 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) //pDC.TextOut(cur_x, cur_y, c); #ifdef RA2_MODE - if ((m_currentTileSet == 80 && Map->GetTheater() == "TEMPERATE") || (m_currentTileSet == 73 && Map->GetTheater() == "SNOW") || (m_currentTileSet == 101 && Map->GetTheater() == "URBAN")) - { - if (i == 10 || i == 15) - { + if ((m_currentTileSet == 80 && Map->GetTheater() == "TEMPERATE") || (m_currentTileSet == 73 && Map->GetTheater() == "SNOW") || (m_currentTileSet == 101 && Map->GetTheater() == "URBAN")) { + if (i == 10 || i == 15) { dwID++; // don´t forget this here, too continue; } @@ -143,8 +137,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) RECT r; GetClientRect(&r); - if (cur_y + curheight + (m_tile_height - curheight) / 2 >= this->GetScrollPos(SB_VERT) && cur_y <= GetScrollPos(SB_VERT) + r.bottom) - { + if (cur_y + curheight + (m_tile_height - curheight) / 2 >= this->GetScrollPos(SB_VERT) && cur_y <= GetScrollPos(SB_VERT) + r.bottom) { HDC hDC = NULL; m_lpDDS[i]->GetDC(&hDC); @@ -165,8 +158,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) DeleteDC(hTmpDC); DeleteObject(hBitmap); - if (AD.mode == ACTIONMODE_SETTILE && AD.type == dwID) - { + if (AD.mode == ACTIONMODE_SETTILE && AD.type == dwID) { CPen p; CBrush b; p.CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); @@ -184,8 +176,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) cur_x += m_tile_width; if (max_r == 0) max_r = 1; - if (i % max_r == max_r - 1) - { + if (i % max_r == max_r - 1) { cur_y += m_tile_height; cur_x = 0; } @@ -196,15 +187,12 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) } } #ifndef NOSURFACES - else if (m_CurrentMode == 2) - { + else if (m_CurrentMode == 2) { int i; - for (i = 0;i < max_ovrl_img;i++) - { + for (i = 0; i < max_ovrl_img; i++) { PICDATA* p = ovrlpics[m_currentOverlay][i]; - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { DDSURFACEDESC2 desc; memset(&desc, 0, sizeof(DDSURFACEDESC2)); @@ -234,8 +222,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) DeleteDC(hTmpDC); DeleteObject(hBitmap); - if (AD.mode == ACTIONMODE_PLACE && AD.data2 == m_currentOverlay && AD.data3 == i && AD.data == 33 && AD.type == 6) - { + if (AD.mode == ACTIONMODE_PLACE && AD.data2 == m_currentOverlay && AD.data3 == i && AD.data == 33 && AD.type == 6) { CPen p; CBrush b; p.CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); @@ -252,8 +239,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) cur_x += m_tile_width; if (max_r == 0) max_r = 1; - if (i % max_r == max_r - 1) - { + if (i % max_r == max_r - 1) { cur_y += m_tile_height; cur_x = 0; } @@ -261,15 +247,12 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) } } #else - else if (m_CurrentMode == 2) - { + else if (m_CurrentMode == 2) { int i; - for (i = 0;i < max_ovrl_img;i++) - { + for (i = 0; i < max_ovrl_img; i++) { PICDATA* p = ovrlpics[m_currentOverlay][i]; - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { int curwidth = p->wMaxWidth; int curheight = p->wMaxHeight; @@ -289,8 +272,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) if (pitch == 0) continue; - if (pitch % sizeof(DWORD)) - { + if (pitch % sizeof(DWORD)) { pitch += sizeof(DWORD) - (curwidth * 3) % sizeof(DWORD); } @@ -304,12 +286,9 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) pal = palUnit; int k, l; - for (k = 0;k < curheight;k++) - { - for (l = 0;l < curwidth;l++) - { - if (((BYTE*)p->pic)[l + k * curwidth]) - { + for (k = 0; k < curheight; k++) { + for (l = 0; l < curwidth; l++) { + if (((BYTE*)p->pic)[l + k * curwidth]) { memcpy(&colors[l * 3 + (curheight - k - 1) * pitch], &pal[((BYTE*)p->pic)[l + k * curwidth]], 3); } } @@ -320,8 +299,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) delete[] colors; - if (AD.mode == ACTIONMODE_PLACE && AD.data2 == m_currentOverlay && AD.data3 == i && AD.data == 33 && AD.type == 6) - { + if (AD.mode == ACTIONMODE_PLACE && AD.data2 == m_currentOverlay && AD.data3 == i && AD.data == 33 && AD.type == 6) { CPen p; CBrush b; p.CreatePen(PS_SOLID, 1, RGB(255, 0, 0)); @@ -339,8 +317,7 @@ void CTileSetBrowserView::OnDraw(CDC* pDC) cur_x += m_tile_width; if (max_r == 0) max_r = 1; - if (i % max_r == max_r - 1) - { + if (i % max_r == max_r - 1) { cur_y += m_tile_height; cur_x = 0; } @@ -381,8 +358,7 @@ DWORD CTileSetBrowserView::GetTileID(DWORD dwTileSet, DWORD dwType) { int i, e; DWORD tilecount = 0; - for (i = 0; i < 10000; i++) - { + for (i = 0; i < 10000; i++) { CString tset; char c[50]; itoa(i, c, 10); @@ -399,8 +375,7 @@ DWORD CTileSetBrowserView::GetTileID(DWORD dwTileSet, DWORD dwType) } auto const tilesInSet = pSec->GetInteger("TilesInSet"); - for (e = 0; e < tilesInSet; e++) - { + for (e = 0; e < tilesInSet; e++) { if (i == dwTileSet && e == dwType) return tilecount; tilecount++; @@ -435,10 +410,8 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw) int i; int max = tiles->GetInteger("TileSet" + tset, "TilesInSet"); DWORD dwStartID = GetTileID(dwTileSet, 0); - if ((*tiledata)[dwStartID].wTileCount && (*tiledata)[dwStartID].tiles[0].pic) - { - if (!bOnlyRedraw) - { + if ((*tiledata)[dwStartID].wTileCount && (*tiledata)[dwStartID].tiles[0].pic) { + if (!bOnlyRedraw) { AD.mode = ACTIONMODE_SETTILE; AD.type = dwStartID; AD.data = 0; @@ -465,18 +438,16 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw) } } DWORD dwID; - for (i = 0;i < max;i++) - { + for (i = 0; i < max; i++) { CString str; char c[50]; itoa(i, c, 10); - for (e = 0;e < 2 - strlen(c);e++) + for (e = 0; e < 2 - strlen(c); e++) str += "0"; str += c; dwID = dwStartID + i; // just faster than always calling GetTileID() - if (dwID < *tiledata_count) - { + if (dwID < *tiledata_count) { if ((*tiledata)[dwID].rect.right - (*tiledata)[dwID].rect.left > m_tile_width) m_tile_width = (*tiledata)[dwID].rect.right - (*tiledata)[dwID].rect.left; if (GetAddedHeight(dwID) + (*tiledata)[dwID].rect.bottom - (*tiledata)[dwID].rect.top > m_tile_height) m_tile_height = GetAddedHeight(dwID) + (*tiledata)[dwID].rect.bottom - (*tiledata)[dwID].rect.top; } @@ -485,11 +456,9 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw) m_tile_width += 6; m_tile_height += 6; - if (m_lpDDS) - { + if (m_lpDDS) { int i; - for (i = 0;i < m_tilecount;i++) - { + for (i = 0; i < m_tilecount; i++) { if (m_lpDDS[i]) m_lpDDS[i]->Release(); } delete[] m_lpDDS; @@ -498,8 +467,7 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw) m_tilecount = max; m_lpDDS = new(LPDIRECTDRAWSURFACE4[m_tilecount]); - for (i = 0;i < m_tilecount;i++) - { + for (i = 0; i < m_tilecount; i++) { m_lpDDS[i] = RenderTile(dwStartID + i); } @@ -553,26 +521,22 @@ __forceinline void BlitTerrainTSB(void* dst, int x, int y, int dleft, int dtop, srcRect.right = swidth; srcRect.bottom = sheight; blrect.left = x; - if (blrect.left < 0) - { + if (blrect.left < 0) { srcRect.left = 1 - blrect.left; blrect.left = 1; } blrect.top = y; - if (blrect.top < 0) - { + if (blrect.top < 0) { srcRect.top = 1 - blrect.top; blrect.top = 1; } blrect.right = (x + swidth); - if (x + swidth > dright) - { + if (x + swidth > dright) { srcRect.right = dright - x;//swidth-((x+swidth)-dright); blrect.right = dright; } blrect.bottom = (y + sheight); - if (y + sheight > dbottom) - { + if (y + sheight > dbottom) { srcRect.bottom = dbottom - y;//sheight-((y+sheight)-dbottom); blrect.bottom = dbottom; } @@ -584,43 +548,33 @@ __forceinline void BlitTerrainTSB(void* dst, int x, int y, int dleft, int dtop, #ifdef NOSURFACES_EXTRACT int pos = 0; - if (!st.bNotExtracted) - { - for (e = srcRect.top;e < srcRect.bottom;e++) - { + if (!st.bNotExtracted) { + for (e = srcRect.top; e < srcRect.bottom; e++) { short& left = st.vborder[e].left; short& right = st.vborder[e].right; - if (right >= left) - { + if (right >= left) { void* dest = ((BYTE*)dst + (blrect.left + left) * bpp + (blrect.top + e) * dpitch); memcpy(dest, &st.pic[pos], bpp * (right - left + 1)); pos += (right - left + 1) * bpp; } } - } - else + } else #endif - for (e = srcRect.top;e < srcRect.bottom;e++) - { + for (e = srcRect.top; e < srcRect.bottom; e++) { short& left = st.vborder[e].left; short& right = st.vborder[e].right; - for (i = left;i <= right;i++) - { - if (i < srcRect.left || i >= srcRect.right) - { + for (i = left; i <= right; i++) { + if (i < srcRect.left || i >= srcRect.right) { //dest+=bpp; - } - else - { + } else { BYTE& val = src[i + e * swidth]; - if (val) - { + if (val) { void* dest = ((BYTE*)dst + (blrect.left + i) * bpp + (blrect.top + e) * dpitch); memcpy(dest, &iPalIso[val], bpp); @@ -637,10 +591,8 @@ __forceinline void BlitTerrainTSB(void* dst, int x, int y, int dleft, int dtop, LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderTile(DWORD dwID) { - if (theApp.m_Options.bMarbleMadness) - { - if ((*tiledata)[dwID].wMarbleGround != 0xFFFF) - { + if (theApp.m_Options.bMarbleMadness) { + if ((*tiledata)[dwID].wMarbleGround != 0xFFFF) { dwID = (*tiledata)[dwID].wMarbleGround; } } @@ -656,8 +608,7 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderTile(DWORD dwID) int added_height = GetAddedHeight(dwID); ddsd.dwHeight = (*tiledata)[dwID].rect.bottom - (*tiledata)[dwID].rect.top + added_height; ddsd.dwWidth = (*tiledata)[dwID].rect.right - (*tiledata)[dwID].rect.left; - if (lpdd->CreateSurface(&ddsd, &lpdds, NULL) != DD_OK) - { + if (lpdd->CreateSurface(&ddsd, &lpdds, NULL) != DD_OK) { return NULL; } @@ -670,10 +621,8 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderTile(DWORD dwID) int y_added = ddsd.dwHeight - ((*tiledata)[dwID].cx * f_y / 2 + (*tiledata)[dwID].cy * f_y / 2); int i, e, p = 0;; - for (i = 0;i < (*tiledata)[dwID].cx;i++) - { - for (e = 0;e < (*tiledata)[dwID].cy;e++) - { + for (i = 0; i < (*tiledata)[dwID].cx; i++) { + for (e = 0; e < (*tiledata)[dwID].cy; e++) { int drawx = e * f_x / 2 - i * f_x / 2 - (*tiledata)[dwID].rect.left; int drawy = e * f_y / 2 + i * f_y / 2 - (*tiledata)[dwID].rect.top; @@ -681,8 +630,7 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderTile(DWORD dwID) drawy += added_height + (*tiledata)[dwID].tiles[p].sY - (*tiledata)[dwID].tiles[p].bZHeight * f_y / 2; //drawy+=y_added; - if ((*tiledata)[dwID].tiles[p].pic) - { + if ((*tiledata)[dwID].tiles[p].pic) { RECT dest; dest.left = drawx; dest.top = drawy; @@ -754,26 +702,22 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) int tile_width = m_tile_width; int tile_height = m_tile_height; - if (m_CurrentMode == 1) - { + if (m_CurrentMode == 1) { DWORD dwID = GetTileID(m_currentTileSet, 0); int i; - for (i = 0;i < m_tilecount;i++) - { + for (i = 0; i < m_tilecount; i++) { int curwidth = (*tiledata)[dwID].rect.right - (*tiledata)[dwID].rect.left; int curheight = (*tiledata)[dwID].rect.bottom - (*tiledata)[dwID].rect.top; curwidth = m_tile_width; curheight = m_tile_height; #ifdef RA2_MODE - if ((m_currentTileSet == 80 && Map->GetTheater() == "TEMPERATE") || (m_currentTileSet == 73 && Map->GetTheater() == "SNOW") || (m_currentTileSet == 101 && Map->GetTheater() == "URBAN")) - { + if ((m_currentTileSet == 80 && Map->GetTheater() == "TEMPERATE") || (m_currentTileSet == 73 && Map->GetTheater() == "SNOW") || (m_currentTileSet == 101 && Map->GetTheater() == "URBAN")) { - if (i == 10 || i == 15) - { + if (i == 10 || i == 15) { dwID++; // don´t forget this continue; } @@ -783,8 +727,7 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) int posaddedx = (m_tile_width - curwidth) / 2; int posaddedy = (m_tile_height - curheight) / 2; - if (point.x > cur_x + posaddedx && point.y > cur_y + posaddedy && point.x < cur_x + tile_width - posaddedx && point.y < cur_y + tile_height - posaddedy) - { + if (point.x > cur_x + posaddedx && point.y > cur_y + posaddedy && point.x < cur_x + tile_width - posaddedx && point.y < cur_y + tile_height - posaddedy) { char c[50]; itoa(GetAddedHeight(dwID), c, 10); OutputDebugString(c); @@ -801,8 +744,7 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) if (oldid > *tiledata_count) oldid = 0; - if (oldmode != ACTIONMODE_SETTILE || (*tiledata)[oldid].wTileSet != m_currentTileSet) - { + if (oldmode != ACTIONMODE_SETTILE || (*tiledata)[oldid].wTileSet != m_currentTileSet) { ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.m_BrushSize = 0; ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.UpdateData(FALSE); ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = 1; @@ -827,8 +769,7 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) } cur_x += tile_width; - if (i % max_r == max_r - 1) - { + if (i % max_r == max_r - 1) { cur_y += tile_height; cur_x = 0; } @@ -837,23 +778,18 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) dwID++; } - } - else if (m_CurrentMode == 2) - { + } else if (m_CurrentMode == 2) { int i; - for (i = 0;i < max_ovrl_img;i++) - { + for (i = 0; i < max_ovrl_img; i++) { PICDATA* p = ovrlpics[m_currentOverlay][i]; - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { int curwidth = m_tile_width; int curheight = m_tile_height; int posaddedx = (m_tile_width - curwidth) / 2; int posaddedy = (m_tile_height - curheight) / 2; - if (point.x > cur_x + posaddedx && point.y > cur_y + posaddedy && point.x < cur_x + tile_width - posaddedx && point.y < cur_y + tile_height - posaddedy) - { + if (point.x > cur_x + posaddedx && point.y > cur_y + posaddedy && point.x < cur_x + tile_width - posaddedx && point.y < cur_y + tile_height - posaddedy) { AD.mode = ACTIONMODE_PLACE; AD.type = 6; AD.data = 33; @@ -864,8 +800,7 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point) } cur_x += tile_width; - if (i % max_r == max_r - 1) - { + if (i % max_r == max_r - 1) { cur_y += tile_height; cur_x = 0; } @@ -890,10 +825,8 @@ int CTileSetBrowserView::GetAddedHeight(DWORD dwID) //for(i=0;i<(*tiledata)[dwID].wTileCount;i++) { int i, e, p = 0;; - for (i = 0;i < (*tiledata)[dwID].cx;i++) - { - for (e = 0;e < (*tiledata)[dwID].cy;e++) - { + for (i = 0; i < (*tiledata)[dwID].cx; i++) { + for (e = 0; e < (*tiledata)[dwID].cy; e++) { int drawy = e * f_y / 2 + i * f_y / 2 - (*tiledata)[dwID].rect.top; drawy += (*tiledata)[dwID].tiles[p].sY - (*tiledata)[dwID].tiles[p].bZHeight * f_y / 2; @@ -921,40 +854,32 @@ void CTileSetBrowserView::SetOverlay(DWORD dwID) // m_tilecount=0; int iovrlcount = 0; BOOL bFound = FALSE; - for (k = 0;k < max_ovrl_img;k++) - { + for (k = 0; k < max_ovrl_img; k++) { PICDATA* p = ovrlpics[dwID][k]; - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { bFound = TRUE; } } - if (!bFound) - { + if (!bFound) { theApp.m_loading->LoadOverlayGraphic(rules["OverlayTypes"].Nth(dwID).second, dwID); ((CFinalSunDlg*)(theApp.m_pMainWnd))->m_view.m_isoview->UpdateOverlayPictures(); //p=ovrlpics[dwID][k]; } - for (k = 0;k < max_ovrl_img;k++) - { + for (k = 0; k < max_ovrl_img; k++) { PICDATA* p = ovrlpics[dwID][k]; - if (p == NULL || p->pic == NULL) - { + if (p == NULL || p->pic == NULL) { //if(!p->bTried) { } } - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { iovrlcount++; } } - for (k = 0;k < max_ovrl_img;k++) - { + for (k = 0; k < max_ovrl_img; k++) { PICDATA* p = ovrlpics[dwID][k]; - if (p != NULL && p->pic != NULL) - { + if (p != NULL && p->pic != NULL) { need_pos = k; need_width = p->wMaxWidth; need_height = p->wMaxHeight; @@ -1011,8 +936,7 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderOverlay(DWORD dwType, DWORD dwDa int added_height = GetAddedHeight(dwID); ddsd.dwHeight =//(*tiledata)[dwID].rect.bottom-(*tiledata)[dwID].rect.top+added_height; ddsd.dwWidth = (*tiledata)[dwID].rect.right - (*tiledata)[dwID].rect.left; - if (lpdd->CreateSurface(&ddsd, &lpdds, NULL) != DD_OK) - { + if (lpdd->CreateSurface(&ddsd, &lpdds, NULL) != DD_OK) { return NULL; } @@ -1025,10 +949,8 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderOverlay(DWORD dwType, DWORD dwDa int y_added = ddsd.dwHeight - ((*tiledata)[dwID].cx * f_y / 2 + (*tiledata)[dwID].cy * f_y / 2); int i, e, p = 0;; - for (i = 0;i < (*tiledata)[dwID].cx;i++) - { - for (e = 0;e < (*tiledata)[dwID].cy;e++) - { + for (i = 0; i < (*tiledata)[dwID].cx; i++) { + for (e = 0; e < (*tiledata)[dwID].cy; e++) { int drawx = e * f_x / 2 - i * f_x / 2 - (*tiledata)[dwID].rect.left; int drawy = e * f_y / 2 + i * f_y / 2 - (*tiledata)[dwID].rect.top; @@ -1036,8 +958,7 @@ LPDIRECTDRAWSURFACE4 CTileSetBrowserView::RenderOverlay(DWORD dwType, DWORD dwDa drawy += added_height + (*tiledata)[dwID].tiles[p].sY - (*tiledata)[dwID].tiles[p].bZHeight * f_y / 2; //drawy+=y_added; - if ((*tiledata)[dwID].tiles[p].pic) - { + if ((*tiledata)[dwID].tiles[p].pic) { RECT dest; dest.left = drawx; dest.top = drawy; diff --git a/MissionEditor/TileSetBrowserView.h b/MissionEditor/TileSetBrowserView.h index a641223..73e21df 100644 --- a/MissionEditor/TileSetBrowserView.h +++ b/MissionEditor/TileSetBrowserView.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TILESETBROWSERVIEW_H__3DD92021_7D37_11D4_9C87_97337B61A44A__INCLUDED_) @@ -36,16 +36,16 @@ public: CTileSetBrowserView(); // Dynamische Erstellung verwendet geschützten Konstruktor DECLARE_DYNCREATE(CTileSetBrowserView) -// Attribute + // Attribute public: -// Operationen + // Operationen public: -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CTileSetBrowserView) - protected: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CTileSetBrowserView) +protected: virtual void OnDraw(CDC* pDC); // Überschrieben zum Zeichnen dieser Ansicht virtual void OnInitialUpdate(); // Zum ersten Mal nach der Konstruktion virtual void PostNcDestroy(); @@ -59,7 +59,7 @@ public: int m_bottom_needed; void DrawIt(); LPDIRECTDRAWSURFACE4* m_lpDDS; - void SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw=FALSE); + void SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw = FALSE); DWORD GetTileID(DWORD dwTileSet, DWORD dwType); int m_currentTileSet; virtual ~CTileSetBrowserView(); diff --git a/MissionEditor/TipDlg.cpp b/MissionEditor/TipDlg.cpp index aa19fa0..11e8425 100644 --- a/MissionEditor/TipDlg.cpp +++ b/MissionEditor/TipDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -55,12 +55,12 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/) CIniFile optini; CString iniFile; - - iniFile=AppPath; + + iniFile = AppPath; #ifndef RA2_MODE - iniFile+="\\FinalSun.ini"; + iniFile += "\\FinalSun.ini"; #else - iniFile+="\\FinalAlert.ini"; + iniFile += "\\FinalAlert.ini"; #endif optini.LoadFile(iniFile); @@ -69,16 +69,15 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/) UINT iFilePos = optini.GetInteger(szSection, szIntFilePos); // try top open the tips file - CString tipsfile=AppPath; - tipsfile+="\\tips."; + CString tipsfile = AppPath; + tipsfile += "\\tips."; tipsfile += language.GetString(theApp.m_Options.LanguageName + "Header", "ExtensionName"); m_pStream = fopen(tipsfile, "r"); - if (m_pStream == NULL) - { - m_strTip=GetLanguageStringACP("CG_IDS_FILE_ABSENT"); + if (m_pStream == NULL) { + m_strTip = GetLanguageStringACP("CG_IDS_FILE_ABSENT"); return; - } + } //now check if the tips file is changed! (check the date the tips file was created) struct _stat buf; @@ -93,7 +92,7 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/) if (fseek(m_pStream, iFilePos, SEEK_SET) != 0) { AfxMessageBox(GetLanguageStringACP("CG_IDP_FILE_CORRUPT")); - } else { + } else { GetNextTipString(m_strTip); } @@ -102,17 +101,16 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/) CTipDlg::~CTipDlg() { - if (m_pStream != NULL) - { + if (m_pStream != NULL) { CIniFile optini; CString iniFile; - - iniFile=AppPath; + + iniFile = AppPath; #ifndef RA2_MODE - iniFile+="\\FinalSun.ini"; + iniFile += "\\FinalSun.ini"; #else - iniFile+="\\FinalAlert.ini"; + iniFile += "\\FinalAlert.ini"; #endif optini.LoadFile(iniFile); @@ -121,7 +119,7 @@ CTipDlg::~CTipDlg() fclose(m_pStream); } } - + void CTipDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); @@ -153,18 +151,13 @@ void CTipDlg::GetNextTipString(CString& strNext) LPTSTR lpsz = strNext.GetBuffer(MAX_BUFLEN); BOOL bStop = FALSE; - while (!bStop) - { - if (_fgetts(lpsz, MAX_BUFLEN, m_pStream) == NULL) - { - if (fseek(m_pStream, 0, SEEK_SET) != 0) + while (!bStop) { + if (_fgetts(lpsz, MAX_BUFLEN, m_pStream) == NULL) { + if (fseek(m_pStream, 0, SEEK_SET) != 0) AfxMessageBox(GetLanguageStringACP("CG_IDP_FILE_CORRUPT")); - } - else - { - if (*lpsz != ' ' && *lpsz != '\t' && - *lpsz != '\n' && *lpsz != ';') - { + } else { + if (*lpsz != ' ' && *lpsz != '\t' && + *lpsz != '\n' && *lpsz != ';') { bStop = TRUE; } } @@ -183,16 +176,16 @@ HBRUSH CTipDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) void CTipDlg::OnOK() { CDialog::OnOK(); - - // actualize startup + + // actualize startup CIniFile optini; CString iniFile; - - iniFile=AppPath; + + iniFile = AppPath; #ifndef RA2_MODE - iniFile+="\\FinalSun.ini"; + iniFile += "\\FinalSun.ini"; #else - iniFile+="\\FinalAlert.ini"; + iniFile += "\\FinalAlert.ini"; #endif optini.LoadFile(iniFile); @@ -213,7 +206,7 @@ BOOL CTipDlg::OnInitDialog() SetDlgItemText(IDOK, GetLanguageStringACP("TipDialogClose")); SetWindowText(GetLanguageStringACP("TipDialogCaption")); - return TRUE; + return TRUE; } void CTipDlg::OnPaint() @@ -242,15 +235,15 @@ void CTipDlg::OnPaint() dcTmp.CreateCompatibleDC(&dc); dcTmp.SelectObject(&bmp); rect.bottom = bmpInfo.bmHeight + rect.top; - dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), + dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(), &dcTmp, 0, 0, SRCCOPY); // draw "Did you know" in the correct language CString strMessage; - strMessage=GetLanguageStringACP("CG_IDS_DIDYOUKNOW"); + strMessage = GetLanguageStringACP("CG_IDS_DIDYOUKNOW"); rect.left += bmpInfo.bmWidth; dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE); - + } diff --git a/MissionEditor/TipDlg.h b/MissionEditor/TipDlg.h index bccf4a4..164c7d9 100644 --- a/MissionEditor/TipDlg.h +++ b/MissionEditor/TipDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(TIPDLG_H_INCLUDED_) @@ -28,7 +28,7 @@ class CTipDlg : public CDialog { -// Konstruktion + // Konstruktion public: CTipDlg(CWnd* pParent = NULL); // Standard-Konstruktor @@ -41,10 +41,10 @@ public: FILE* m_pStream; -// Überschreibungen - // Vom Klassen-Assistenten generierte Überschreibungen virtueller Funktionen - //{{AFX_VIRTUAL(CTipDlg) - protected: + // Überschreibungen + // Vom Klassen-Assistenten generierte Überschreibungen virtueller Funktionen + //{{AFX_VIRTUAL(CTipDlg) +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/ToolSettingsBar.cpp b/MissionEditor/ToolSettingsBar.cpp index d6a65e3..d2838ea 100644 --- a/MissionEditor/ToolSettingsBar.cpp +++ b/MissionEditor/ToolSettingsBar.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ToolSettingsBar.cpp: Implementierungsdatei @@ -68,75 +68,74 @@ END_MESSAGE_MAP() -void CToolSettingsBar::OnSelchangeBrushsize() +void CToolSettingsBar::OnSelchangeBrushsize() { UpdateData(TRUE); - - int bx,by; - switch(m_BrushSize) - { + int bx, by; + + switch (m_BrushSize) { case 0: - bx=1; - by=1; + bx = 1; + by = 1; break; case 1: - bx=2; - by=2; + bx = 2; + by = 2; break; case 2: - bx=3; - by=3; + bx = 3; + by = 3; break; case 3: - bx=4; - by=4; + bx = 4; + by = 4; break; case 4: - bx=5; - by=5; + bx = 5; + by = 5; break; case 5: - bx=10; - by=10; + bx = 10; + by = 10; break; case 6: - bx=1; - by=2; + bx = 1; + by = 2; break; case 7: - bx=2; - by=1; + bx = 2; + by = 1; break; case 8: - bx=1; - by=3; + bx = 1; + by = 3; break; case 9: - bx=3; - by=1; + bx = 3; + by = 1; break; } - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x=bx; - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y=by; + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = bx; + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y = by; } -BOOL CToolSettingsBar::OnInitDialog() +BOOL CToolSettingsBar::OnInitDialog() { - m_BrushSize=0; + m_BrushSize = 0; UpdateData(FALSE); ((CComboBox*)GetDlgItem(IDC_BRUSHSIZE))->SetCurSel(0); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CToolSettingsBar::OnShowWindow(BOOL bShow, UINT nStatus) +void CToolSettingsBar::OnShowWindow(BOOL bShow, UINT nStatus) { CDialogBar::OnShowWindow(bShow, nStatus); - UpdateData(FALSE); + UpdateData(FALSE); } diff --git a/MissionEditor/ToolSettingsBar.h b/MissionEditor/ToolSettingsBar.h index 81daa98..c6ec0cf 100644 --- a/MissionEditor/ToolSettingsBar.h +++ b/MissionEditor/ToolSettingsBar.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TOOLSETTINGSBAR_H__582DFEA1_7F44_11D4_9C87_F809D2CDBE4A__INCLUDED_) @@ -32,7 +32,7 @@ class CToolSettingsBar : public CDialogBar { -// Konstruktion + // Konstruktion public: CToolSettingsBar(CWnd* pParent = NULL); // Standardkonstruktor @@ -46,7 +46,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CToolSettingsBar) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Trees.cpp b/MissionEditor/Trees.cpp index d27c7c5..57bce3d 100644 --- a/MissionEditor/Trees.cpp +++ b/MissionEditor/Trees.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Trees.cpp: Implementierungsdatei @@ -80,38 +80,37 @@ void CTrees::UpdateDialog() m_TreeList.SetRedraw(FALSE); // first clear the list - while(m_TreeList.DeleteString(0)!=LB_ERR); + while (m_TreeList.DeleteString(0) != LB_ERR); // okay add all trees int i; - CIniFileSection& sec=ini.sections["Terrain"]; - - - for(i=0;idata(); + str = sec.GetValueName(i)->data(); - int pos=atoi(str); + int pos = atoi(str); - str+=(CString)" "+ sec.GetValue(i)->data(); - int x,y,z; + str += (CString)" " + sec.GetValue(i)->data(); + int x, y, z; GetXYPos((char*)sec.GetValueName(i)->data(), &x, &y); char c[50]; itoa(x, c, 10); - str+=" ("; - str+=c; - str+="/"; + str += " ("; + str += c; + str += "/"; itoa(y, c, 10); - str+=c; - - z=GetPos(x,y,0); + str += c; + + z = GetPos(x, y, 0); itoa(z, c, 10); - str+="/"; - str+=c; - str+=")"; + str += "/"; + str += c; + str += ")"; m_TreeList.InsertString(-1, str); @@ -121,72 +120,72 @@ void CTrees::UpdateDialog() m_TreeList.RedrawWindow(); } -BOOL CTrees::OnInitDialog() +BOOL CTrees::OnInitDialog() { CPropertyPage::OnInitDialog(); - + // TODO: Zusätzliche Initialisierung hier einfügen - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } -void CTrees::OnSelchangeTreelist() +void CTrees::OnSelchangeTreelist() { - int i=m_TreeList.GetCurSel(); + int i = m_TreeList.GetCurSel(); CString str; m_TreeList.GetText(i, str); - str.SetAt(str.Find(" ", 0),0); + str.SetAt(str.Find(" ", 0), 0); - m_Type.SetWindowText( ini.sections["Terrain"].values[ (char*)(LPCTSTR)str ].data() ); + m_Type.SetWindowText(ini.sections["Terrain"].values[(char*)(LPCTSTR)str].data()); string pos; - int x,y,z; + int x, y, z; GetXYPos((char*)ini.sections["Terrain"].GetValueName(i)->data(), &x, &y); char c[50]; itoa(x, c, 10); - pos=c; - pos+="/"; + pos = c; + pos += "/"; itoa(y, c, 10); - pos+=c; - pos+="/"; + pos += c; + pos += "/"; itoa(z, c, 10); - pos+=c; + pos += c; m_Pos.SetWindowText(pos.data()); } -void CTrees::OnEditchangeType() +void CTrees::OnEditchangeType() { - - + + } -void CTrees::OnKillfocusType() +void CTrees::OnKillfocusType() { - int i=m_TreeList.GetCurSel(); + int i = m_TreeList.GetCurSel(); - if(i==-1) return; + if (i == -1) return; m_TreeList.SetRedraw(FALSE); CString str; m_TreeList.GetText(i, str); - str.SetAt(str.Find(" ", 0),0); - + str.SetAt(str.Find(" ", 0), 0); + CString type; m_Type.GetWindowText(type); - if(ini.sections["Terrain"].values[(char*)(LPCTSTR)str]==(char*)(LPCTSTR)type) return; + if (ini.sections["Terrain"].values[(char*)(LPCTSTR)str] == (char*)(LPCTSTR)type) return; - ini.sections["Terrain"].values[(char*)(LPCTSTR)str]=type; + ini.sections["Terrain"].values[(char*)(LPCTSTR)str] = type; UpdateDialog(); @@ -209,67 +208,67 @@ void CTrees::OnKillfocusType() itoa(y, c, 10); str_+=c; str_+=")"; - + m_TreeList.DeleteString(i); m_TreeList.InsertString(i, str_);*/ - + m_TreeList.SetRedraw(TRUE); m_TreeList.RedrawWindow(); m_TreeList.SetCurSel(i); } -void CTrees::OnKillFocus(CWnd* pNewWnd) +void CTrees::OnKillFocus(CWnd* pNewWnd) { CPropertyPage::OnKillFocus(pNewWnd); - - - - + + + + } -void CTrees::OnShowWindow(BOOL bShow, UINT nStatus) +void CTrees::OnShowWindow(BOOL bShow, UINT nStatus) { CPropertyPage::OnShowWindow(bShow, nStatus); - - OnKillfocusType(); + + OnKillfocusType(); } -void CTrees::OnDelete() +void CTrees::OnDelete() { - int pos=m_TreeList.GetCurSel(); - if(pos==-1) return; - + int pos = m_TreeList.GetCurSel(); + if (pos == -1) return; + CString cutree; //m_TreeList.GetText(pos, cutree); - cutree=ini.sections["Terrain"].GetValueName(pos)->data(); + cutree = ini.sections["Terrain"].GetValueName(pos)->data(); - ini.sections["Terrain"].values.erase((string)(char*)(LPCTSTR) cutree); + ini.sections["Terrain"].values.erase((string)(char*)(LPCTSTR)cutree); //m_TreeList.SetRedraw(FALSE); UpdateDialog(); m_TreeList.SetCurSel(pos); //m_TreeList.SetRedraw(TRUE); - + } -void CTrees::OnNew() +void CTrees::OnNew() { - int pos=m_TreeList.GetCurSel(); + int pos = m_TreeList.GetCurSel(); CPos p; - if(p.DoModal()==IDCANCEL) return; + if (p.DoModal() == IDCANCEL) return; - int h=GetPos(atoi(p.m_x), atoi(p.m_y), 0); + int h = GetPos(atoi(p.m_x), atoi(p.m_y), 0); char k[50]; itoa(h, k, 10); - ini.sections["Terrain"].values[k]="TREE01"; + ini.sections["Terrain"].values[k] = "TREE01"; UpdateDialog(); m_TreeList.SetCurSel(pos); - + } diff --git a/MissionEditor/Trees.h b/MissionEditor/Trees.h index 2c35dad..6862aef 100644 --- a/MissionEditor/Trees.h +++ b/MissionEditor/Trees.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TREES_H__8ACDE600_72AB_11D3_99E1_95E76FDD1C05__INCLUDED_) @@ -34,14 +34,14 @@ class CTrees : public CPropertyPage { DECLARE_DYNCREATE(CTrees) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CTrees(); ~CTrees(); -// Dialogfelddaten - //{{AFX_DATA(CTrees) + // Dialogfelddaten + //{{AFX_DATA(CTrees) enum { IDD = IDD_TREES }; CEdit m_Pos; CComboBox m_Type; @@ -52,7 +52,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTrees) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TriggerActionsDlg.cpp b/MissionEditor/TriggerActionsDlg.cpp index 9cdbd67..a2b95e0 100644 --- a/MissionEditor/TriggerActionsDlg.cpp +++ b/MissionEditor/TriggerActionsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TriggerActionsDlg.cpp: Implementierungsdatei @@ -41,9 +41,9 @@ static char THIS_FILE[] = __FILE__; BOOL IsWaypointFormat(CString s) { - if(s.GetLength()==0) return TRUE; - - if(s[0]>='A' && s[0]<='Z') + if (s.GetLength() == 0) return TRUE; + + if (s[0] >= 'A' && s[0] <= 'Z') return TRUE; return FALSE; @@ -90,70 +90,68 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CTriggerActionsDlg -void CTriggerActionsDlg::OnSelchangeAction() +void CTriggerActionsDlg::OnSelchangeAction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + if (m_currentTrigger.GetLength() == 0) return; + int selev = m_Action.GetCurSel(); + if (selev < 0) return; + int curev = m_Action.GetItemData(selev); - if(m_currentTrigger.GetLength()==0) return; - int selev=m_Action.GetCurSel(); - if(selev<0) return; - int curev=m_Action.GetItemData(selev); - int i; CString ActionData; ActionData = ini.GetString("Actions", m_currentTrigger); - - int startpos=1+curev*8; - CString ActionType=GetParam(ActionData,startpos); + + int startpos = 1 + curev * 8; + CString ActionType = GetParam(ActionData, startpos); m_ActionType.SetWindowText(ActionType); - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(m_currentTrigger.GetLength()==0) return; - int selev=m_Action.GetCurSel(); - if(selev<0) return; - int curev=m_Action.GetItemData(selev); + if (m_currentTrigger.GetLength() == 0) return; + int selev = m_Action.GetCurSel(); + if (selev < 0) return; + int curev = m_Action.GetItemData(selev); - CString e1,e2; - while(m_Parameter.DeleteString(0)!=CB_ERR); + CString e1, e2; + while (m_Parameter.DeleteString(0) != CB_ERR); - CString eventtype,eventdata; + CString eventtype, eventdata; m_ActionType.GetWindowText(eventtype); TruncSpace(eventtype); - if(eventtype.GetLength()==0) - { - eventtype="0"; + if (eventtype.GetLength() == 0) { + eventtype = "0"; m_ActionType.SetWindowText(eventtype); } - CString acsec="Actions"; + CString acsec = "Actions"; #ifdef RA2_MODE - acsec="ActionsRA2"; + acsec = "ActionsRA2"; #endif - - int pos=1+8*curev; - - ini.SetString("Actions",m_currentTrigger, SetParam(ini.GetString("Actions", m_currentTrigger), pos, (LPCTSTR)eventtype)); + + int pos = 1 + 8 * curev; + + ini.SetString("Actions", m_currentTrigger, SetParam(ini.GetString("Actions", m_currentTrigger), pos, (LPCTSTR)eventtype)); auto const& eventDef = g_data[acsec][eventtype]; if (eventDef.IsEmpty()) { @@ -169,20 +167,20 @@ void CTriggerActionsDlg::OnEditchangeActiontype() } #endif - CString desc=GetParam(eventdata,10); - desc.Replace("%1",","); - m_ActionDescription.SetWindowText(desc); - + CString desc = GetParam(eventdata, 10); + desc.Replace("%1", ","); + m_ActionDescription.SetWindowText(desc); + CString ptype[6]; - ptype[0]=GetParam(eventdata,1); - ptype[1]=GetParam(eventdata,2); - ptype[2]=GetParam(eventdata,3); - ptype[3]=GetParam(eventdata,4); - ptype[4]=GetParam(eventdata,5); - ptype[5]=GetParam(eventdata,6); + ptype[0] = GetParam(eventdata, 1); + ptype[1] = GetParam(eventdata, 2); + ptype[2] = GetParam(eventdata, 3); + ptype[3] = GetParam(eventdata, 4); + ptype[4] = GetParam(eventdata, 5); + ptype[5] = GetParam(eventdata, 6); int pListType[6]; - memset(pListType, 0, 6*sizeof(int)); + memset(pListType, 0, 6 * sizeof(int)); if (atoi(ptype[0]) >= 0) { pListType[0] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[0]), 1)); @@ -219,7 +217,7 @@ void CTriggerActionsDlg::OnEditchangeActiontype() // MW fix for waypoint/number issue CString code; - BOOL bNoWP=FALSE; + BOOL bNoWP = FALSE; code = GetParam(ini["Actions"][m_currentTrigger], pos + 1); if (g_data["DontSaveAsWP"].HasValue(code)) { bNoWP = TRUE; @@ -227,16 +225,16 @@ void CTriggerActionsDlg::OnEditchangeActiontype() // conversion below: if (IsWaypointFormat( - GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6) - ) + GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6) + ) && bNoWP) { int number = GetWaypoint(GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6)); char c[50]; itoa(number, c, 10); ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6, c)); } else if (!IsWaypointFormat( - GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6) - ) + GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6) + ) && !bNoWP) { int wp = atoi(GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6)); CString s = GetWaypoint(wp); @@ -244,51 +242,49 @@ void CTriggerActionsDlg::OnEditchangeActiontype() }; - if(atoi(GetParam(eventdata, 7))==1) - { - if(bNoWP) + if (atoi(GetParam(eventdata, 7)) == 1) { + if (bNoWP) m_Parameter.SetItemData(m_Parameter.AddString(TranslateStringACP("Number")), -1); else m_Parameter.SetItemData(m_Parameter.AddString(TranslateStringACP("Waypoint")), -1); } m_ParamValue.SetWindowText(""); - if(m_Parameter.GetCount()>0) { + if (m_Parameter.GetCount() > 0) { m_Parameter.SetCurSel(0); OnSelchangeParameter(); } } -void CTriggerActionsDlg::OnSelchangeParameter() +void CTriggerActionsDlg::OnSelchangeParameter() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(m_currentTrigger.GetLength()==0) return; - int selev=m_Action.GetCurSel(); - if(selev<0) return; - int curev=m_Action.GetItemData(selev); + if (m_currentTrigger.GetLength() == 0) return; + int selev = m_Action.GetCurSel(); + if (selev < 0) return; + int curev = m_Action.GetItemData(selev); - int curselparam=m_Parameter.GetCurSel(); - if(curselparam<0) - { + int curselparam = m_Parameter.GetCurSel(); + if (curselparam < 0) { m_ParamValue.SetWindowText(""); return; } - - int curparam=m_Parameter.GetItemData(curselparam); - - - + + int curparam = m_Parameter.GetItemData(curselparam); + + + auto const& ActionData = ini["Actions"][m_currentTrigger]; - - int startpos=1+curev*8; + + int startpos = 1 + curev * 8; CString code; - BOOL bNoWP=FALSE; - code=GetParam(ActionData, startpos+1); + BOOL bNoWP = FALSE; + code = GetParam(ActionData, startpos + 1); if (g_data["DontSaveAsWP"].HasValue(code)) { bNoWP = TRUE; } @@ -311,8 +307,7 @@ void CTriggerActionsDlg::OnSelchangeParameter() CString tmp; m_ParamValue.GetLBText(i, tmp); TruncSpace(tmp); - if (tmp == GetParam(ActionData, startpos + 1 + curparam)) - { + if (tmp == GetParam(ActionData, startpos + 1 + curparam)) { m_ParamValue.SetCurSel(i); bFound = TRUE; break; @@ -361,32 +356,31 @@ void CTriggerActionsDlg::OnSelchangeParameter() } } -void CTriggerActionsDlg::OnEditchangeParamvalue() +void CTriggerActionsDlg::OnEditchangeParamvalue() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - if(m_currentTrigger.GetLength()==0) return; - int selev=m_Action.GetCurSel(); - if(selev<0) return; - int curev=m_Action.GetItemData(selev); + if (m_currentTrigger.GetLength() == 0) return; + int selev = m_Action.GetCurSel(); + if (selev < 0) return; + int curev = m_Action.GetItemData(selev); - int curselparam=m_Parameter.GetCurSel(); - if(curselparam<0) - { + int curselparam = m_Parameter.GetCurSel(); + if (curselparam < 0) { m_ParamValue.SetWindowText(""); return; } - int curparam=m_Parameter.GetItemData(curselparam); - + int curparam = m_Parameter.GetItemData(curselparam); + auto const& ActionData = ini["Actions"][m_currentTrigger]; - - int startpos=1+curev*8; + + int startpos = 1 + curev * 8; CString code; - BOOL bNoWP=FALSE; - code=GetParam(ActionData, startpos+1); + BOOL bNoWP = FALSE; + code = GetParam(ActionData, startpos + 1); if (g_data["DontSaveAsWP"].HasValue(code)) { bNoWP = TRUE; } @@ -396,12 +390,12 @@ void CTriggerActionsDlg::OnEditchangeParamvalue() TruncSpace(newVal); newVal.TrimLeft(); - if(newVal.Find(",",0)>=0) newVal.SetAt(newVal.Find(",",0), 0); + if (newVal.Find(",", 0) >= 0) newVal.SetAt(newVal.Find(",", 0), 0); - if(curparam>=0) { + if (curparam >= 0) { ini.SetString("Actions", m_currentTrigger, SetParam(ActionData, startpos + 1 + curparam, newVal)); // waypoint FIX MW: OR NUMBER!!! - } else if (curparam == -1) { + } else if (curparam == -1) { int pos = 1 + 8 * curev + 7; CString waypoint = newVal; @@ -414,9 +408,9 @@ void CTriggerActionsDlg::OnEditchangeParamvalue() } -void CTriggerActionsDlg::OnNewaction() +void CTriggerActionsDlg::OnNewaction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_currentTrigger.GetLength() == 0) { return; @@ -428,27 +422,27 @@ void CTriggerActionsDlg::OnNewaction() int cval = atoi(GetParam(sec.GetString(m_currentTrigger), 0)); cval++; char c[50]; - itoa(cval,c,10); - + itoa(cval, c, 10); + auto action = SetParam(sec.GetString(m_currentTrigger), 0, c); action += ",0,0,0,0,0,0,0,A"; sec.SetString(m_currentTrigger, action); UpdateDialog(); - m_Action.SetCurSel(cval-1); - OnSelchangeAction(); + m_Action.SetCurSel(cval - 1); + OnSelchangeAction(); } -void CTriggerActionsDlg::OnDeleteaction() +void CTriggerActionsDlg::OnDeleteaction() { - CIniFile& ini=Map->GetIniFile(); - if(m_currentTrigger.GetLength()==0) return; + CIniFile& ini = Map->GetIniFile(); + if (m_currentTrigger.GetLength() == 0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - int curev=m_Action.GetItemData(sel2); - if(MessageBox("Do you really want to delete this action?","Delete action", MB_YESNO)==IDNO) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; + int curev = m_Action.GetItemData(sel2); + if (MessageBox("Do you really want to delete this action?", "Delete action", MB_YESNO) == IDNO) return; auto sec = ini.TryGetSection("Actions"); @@ -457,14 +451,14 @@ void CTriggerActionsDlg::OnDeleteaction() CString data; data = sec->GetString(m_currentTrigger); - int v=atoi(GetParam(data,0)); + int v = atoi(GetParam(data, 0)); char c[50]; v--; - itoa(v,c,10); - data=SetParam(data,0, c); + itoa(v, c, 10); + data = SetParam(data, 0, c); - int pos=1+curev*8; - int posc=1+v*8; + int pos = 1 + curev * 8; + int posc = 1 + v * 8; int i; for (i = 0; i < 8; i++) { data = SetParam(data, pos + i, GetParam(data, posc + i)); @@ -473,15 +467,13 @@ void CTriggerActionsDlg::OnDeleteaction() // MW April 17th, 2002: // fixed: (char*)(LPCTSTR)data should not be modified directly, // Instead, moving to a buffer - char* str_act=new(char[data.GetLength()+1]); - strcpy(str_act, (LPCSTR) data); - char* cupos=str_act;//(char*)(LPCTSTR)data; - for(i=0;iSetString(m_currentTrigger, str_act); delete[] str_act; UpdateDialog(); - + } void CTriggerActionsDlg::UpdateDialog() @@ -498,22 +490,21 @@ void CTriggerActionsDlg::UpdateDialog() // MW 07/20/01 Clear(); - if(m_currentTrigger.GetLength()==0) - { - while(m_Action.DeleteString(0)!=CB_ERR); + if (m_currentTrigger.GetLength() == 0) { + while (m_Action.DeleteString(0) != CB_ERR); return; } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); // 9.3.2001: Only support specified section #ifndef RA2_MODE - CString sec="Actions"; + CString sec = "Actions"; #else - CString sec="ActionsRA2"; + CString sec = "ActionsRA2"; #endif - while(m_ActionType.DeleteString(0)!=CB_ERR); + while (m_ActionType.DeleteString(0) != CB_ERR); int i; for (auto const& [eventid, eventdata] : g_data[sec]) { //GetParam(*g_data.sections["Actions"].GetValue(i),13); @@ -531,11 +522,11 @@ void CTriggerActionsDlg::UpdateDialog() #endif m_ActionType.AddString(text); } - } + } + + int cur_sel = m_Action.GetCurSel(); + while (m_Action.DeleteString(0) != CB_ERR); - int cur_sel=m_Action.GetCurSel(); - while(m_Action.DeleteString(0)!=CB_ERR); - auto const& Data = ini["Actions"][m_currentTrigger]; int count = atoi(GetParam(Data, 0)); @@ -550,20 +541,20 @@ void CTriggerActionsDlg::UpdateDialog() m_Action.SetItemData(m_Action.AddString(s), i); } - if(cur_sel<0) cur_sel=0; - if(cur_sel>=count) cur_sel=count-1; + if (cur_sel < 0) cur_sel = 0; + if (cur_sel >= count) cur_sel = count - 1; m_Action.SetCurSel(cur_sel); OnSelchangeAction(); -} + } // MW 07/20/01 void CTriggerActionsDlg::Clear() { - m_ActionType.SetWindowText(""); - while(m_Parameter.DeleteString(0)!=LB_ERR); + m_ActionType.SetWindowText(""); + while (m_Parameter.DeleteString(0) != LB_ERR); m_ParamValue.SetWindowText(""); m_ActionDescription.SetWindowText(""); } diff --git a/MissionEditor/TriggerActionsDlg.h b/MissionEditor/TriggerActionsDlg.h index ad213b8..92b62c2 100644 --- a/MissionEditor/TriggerActionsDlg.h +++ b/MissionEditor/TriggerActionsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TRIGGERACTIONSDLG_H__234BEB21_96D7_11D4_9C87_E6A6DF12E04A__INCLUDED_) @@ -32,7 +32,7 @@ class CTriggerActionsDlg : public CDialog { -// Konstruktion + // Konstruktion public: void Clear(); void UpdateDialog(); @@ -53,7 +53,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTriggerActionsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TriggerEditorDlg.cpp b/MissionEditor/TriggerEditorDlg.cpp index e73b1c4..d48469d 100644 --- a/MissionEditor/TriggerEditorDlg.cpp +++ b/MissionEditor/TriggerEditorDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TriggerEditorDlg.cpp: Implementierungsdatei @@ -75,19 +75,19 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CTriggerEditorDlg -void CTriggerEditorDlg::OnOK() +void CTriggerEditorDlg::OnOK() { - + } -void CTriggerEditorDlg::OnCancel() +void CTriggerEditorDlg::OnCancel() { // TODO: Zusätzlichen Bereinigungscode hier einfügen - + CDialog::OnCancel(); } -BOOL CTriggerEditorDlg::OnInitDialog() +BOOL CTriggerEditorDlg::OnInitDialog() { CDialog::OnInitDialog(); @@ -98,34 +98,34 @@ BOOL CTriggerEditorDlg::OnInitDialog() m_TriggerOptions.Create(CTriggerOptionsDlg::IDD, &m_tab); RECT r; m_tab.GetItemRect(0, &r); - int top=m_tab.GetRowCount()*r.bottom+5; + int top = m_tab.GetRowCount() * r.bottom + 5; m_tab.GetClientRect(&r); - int bottom=r.bottom-top-3; - m_TriggerOptions.SetWindowPos(NULL, 10, top, r.right-20, bottom, SWP_NOZORDER); + int bottom = r.bottom - top - 3; + m_TriggerOptions.SetWindowPos(NULL, 10, top, r.right - 20, bottom, SWP_NOZORDER); m_TriggerOptions.ShowWindow(SW_SHOW); m_TriggerEvents.Create(CTriggerEventsDlg::IDD, &m_tab); - m_TriggerEvents.SetWindowPos(NULL, 10, top, r.right-20, bottom, SWP_NOZORDER); + m_TriggerEvents.SetWindowPos(NULL, 10, top, r.right - 20, bottom, SWP_NOZORDER); m_TriggerActions.Create(CTriggerActionsDlg::IDD, &m_tab); - m_TriggerActions.SetWindowPos(NULL, 10, top, r.right-20, bottom, SWP_NOZORDER); - + m_TriggerActions.SetWindowPos(NULL, 10, top, r.right - 20, bottom, SWP_NOZORDER); + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } void CTriggerEditorDlg::UpdateDialog() { int i; - CIniFile& ini=Map->GetIniFile(); - - int curSel=m_Trigger.GetCurSel(); - int curData=-1; - if(curSel!=-1) - curData=m_Trigger.GetItemData(curSel); + CIniFile& ini = Map->GetIniFile(); - - while(m_Trigger.DeleteString(0)!=CB_ERR); + int curSel = m_Trigger.GetCurSel(); + int curData = -1; + if (curSel != -1) + curData = m_Trigger.GetItemData(curSel); + + + while (m_Trigger.DeleteString(0) != CB_ERR); m_Trigger.SetWindowText(""); @@ -149,34 +149,33 @@ void CTriggerEditorDlg::UpdateDialog() if (curData >= m_Trigger.GetCount()) { curData = m_Trigger.GetCount() - 1; } - + if (ini["Triggers"].Size()) { m_Trigger.SetCurSel(0); } - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); - CString ID_T=GetFreeID(); + CString ID_T = GetFreeID(); ini.SetString("Triggers", ID_T, Map->GetHouseID(0, TRUE) + ",,New trigger,0,1,1,1,0"); ini.SetString("Events", ID_T, "0"); ini.SetString("Actions", ID_T, "0"); //if(MessageBox("Trigger created. If you want to create a simple tag now, press Yes. The tag will be called ""New tag"", you should name it like the trigger (after you have set up the trigger).","Trigger created",MB_YESNO)) { - CString ID_TAG=GetFreeID(); - ini.SetString("Tags",ID_TAG, "0,New tag," + ID_T); + CString ID_TAG = GetFreeID(); + ini.SetString("Tags", ID_TAG, "0,New tag," + ID_T); } ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE); @@ -187,20 +186,20 @@ void CTriggerEditorDlg::OnNewtrigger() } } OnSelchangeTrigger(); - + } -void CTriggerEditorDlg::OnDeletetrigger() +void CTriggerEditorDlg::OnDeletetrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int curtrig=m_Trigger.GetItemData(sel); + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int curtrig = m_Trigger.GetItemData(sel); + + int res = MessageBox("If you want to delete all attached tags, too, press 'Yes'.\nIf you don´t want to delete these tags, press 'No'.\nIf you want to cancel deletion of the trigger, press 'Cancel'.\n\nNote: CellTags will never be deleted using this function", "Delete trigger", MB_YESNOCANCEL); + if (res == IDCANCEL) return; - int res=MessageBox("If you want to delete all attached tags, too, press 'Yes'.\nIf you don´t want to delete these tags, press 'No'.\nIf you want to cancel deletion of the trigger, press 'Cancel'.\n\nNote: CellTags will never be deleted using this function","Delete trigger", MB_YESNOCANCEL); - if(res==IDCANCEL) return; - auto const& triggerId = ini["Triggers"].Nth(curtrig).first; if (res == IDYES) { @@ -226,16 +225,16 @@ void CTriggerEditorDlg::OnDeletetrigger() -void CTriggerEditorDlg::OnSelchangeTrigger() +void CTriggerEditorDlg::OnSelchangeTrigger() { - OnEditchangeTrigger(); + OnEditchangeTrigger(); } -void CTriggerEditorDlg::OnEditchangeTrigger() +void CTriggerEditorDlg::OnEditchangeTrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int curSel=m_Trigger.GetCurSel(); + int curSel = m_Trigger.GetCurSel(); if (curSel < 0) { m_TriggerOptions.m_currentTrigger = ""; if (m_TriggerOptions.m_hWnd) { @@ -252,11 +251,11 @@ void CTriggerEditorDlg::OnEditchangeTrigger() return; } - int curInd=m_Trigger.GetItemData(curSel); + int curInd = m_Trigger.GetItemData(curSel); - auto const triggerId=ini["Triggers"].Nth(curInd).first; + auto const triggerId = ini["Triggers"].Nth(curInd).first; - m_TriggerOptions.m_currentTrigger=triggerId; + m_TriggerOptions.m_currentTrigger = triggerId; if (m_TriggerOptions.m_hWnd) { m_TriggerOptions.UpdateDialog(); } @@ -270,14 +269,13 @@ void CTriggerEditorDlg::OnEditchangeTrigger() } } -void CTriggerEditorDlg::OnSelchangeTriggertab(NMHDR* pNMHDR, LRESULT* pResult) +void CTriggerEditorDlg::OnSelchangeTriggertab(NMHDR* pNMHDR, LRESULT* pResult) { m_TriggerEvents.ShowWindow(SW_HIDE); m_TriggerOptions.ShowWindow(SW_HIDE); m_TriggerActions.ShowWindow(SW_HIDE); - switch(m_tab.GetCurSel()) - { + switch (m_tab.GetCurSel()) { case 0: m_TriggerOptions.ShowWindow(SW_SHOW); m_TriggerOptions.UpdateDialog(); @@ -291,20 +289,20 @@ void CTriggerEditorDlg::OnSelchangeTriggertab(NMHDR* pNMHDR, LRESULT* pResult) m_TriggerActions.UpdateData(); break; } - + *pResult = 0; } -void CTriggerEditorDlg::OnPlaceonmap() +void CTriggerEditorDlg::OnPlaceonmap() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } - int curtrig=m_Trigger.GetItemData(sel); + int curtrig = m_Trigger.GetItemData(sel); auto const triggerId = ini["Triggers"].Nth(curtrig).first; CString tag; @@ -317,20 +315,20 @@ void CTriggerEditorDlg::OnPlaceonmap() } - AD.mode=ACTIONMODE_CELLTAG; - AD.type=4; - AD.data_s=tag; + AD.mode = ACTIONMODE_CELLTAG; + AD.type = 4; + AD.data_s = tag; } -void CTriggerEditorDlg::OnClone() +void CTriggerEditorDlg::OnClone() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } - int curtrig=m_Trigger.GetItemData(sel); + int curtrig = m_Trigger.GetItemData(sel); auto const& triggerId = ini["Triggers"].Nth(curtrig).first; diff --git a/MissionEditor/TriggerEditorDlg.h b/MissionEditor/TriggerEditorDlg.h index ae333e1..0d9c31e 100644 --- a/MissionEditor/TriggerEditorDlg.h +++ b/MissionEditor/TriggerEditorDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TRIGGEREDITORDLG_H__E9CA56E1_93E6_11D4_9C87_F3E3AC59A04A__INCLUDED_) @@ -37,7 +37,7 @@ class CTriggerEditorDlg : public CDialog { -// Konstruktion + // Konstruktion public: void Clear(); CTriggerActionsDlg m_TriggerActions; @@ -57,7 +57,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTriggerEditorDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TriggerEventsDlg.cpp b/MissionEditor/TriggerEventsDlg.cpp index 580548d..4b1394d 100644 --- a/MissionEditor/TriggerEventsDlg.cpp +++ b/MissionEditor/TriggerEventsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TriggerEventsDlg.cpp: Implementierungsdatei @@ -78,66 +78,63 @@ END_MESSAGE_MAP() // MW 07/23/01: Added this because startpos=1+curev*3 isn´t anymore valid for calculating the next event int GetEventParamStart(const CString& EventData, int param) { - int count=atoi(GetParam(EventData, 0)); - if(param>=count) return -1; + int count = atoi(GetParam(EventData, 0)); + if (param >= count) return -1; - int pos=1; + int pos = 1; int i; - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_currentTrigger.GetLength() == 0) { return; } - CIniFileSection& sec=ini.AddSection("Events"); + CIniFileSection& sec = ini.AddSection("Events"); int cval = atoi(GetParam(sec.GetString(m_currentTrigger), 0)); cval++; char c[50]; - itoa(cval,c,10); - + itoa(cval, c, 10); + sec.SetString(m_currentTrigger, SetParam(sec[m_currentTrigger], 0, c)); sec.SetString(m_currentTrigger, ",0,0,0"); UpdateDialog(); - m_Event.SetCurSel(cval-1); - OnSelchangeEvent(); + m_Event.SetCurSel(cval - 1); + OnSelchangeEvent(); } int FindTokenX(CString data, char token, int n) { - if(n<=0) return -1; + if (n <= 0) return -1; - int found=0; - int pos=0; - while(foundGetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_currentTrigger.GetLength() == 0) { return; } - int sel2=m_Event.GetCurSel(); + int sel2 = m_Event.GetCurSel(); if (sel2 < 0) { return; } - int curev=m_Event.GetItemData(sel2); + int curev = m_Event.GetItemData(sel2); if (MessageBox("Do you really want to delete this event?", "Delete event", MB_YESNO) == IDNO) { return; } - auto const & orig_data = ini["Events"][m_currentTrigger]; + auto const& orig_data = ini["Events"][m_currentTrigger]; CString data = orig_data; - int v=atoi(GetParam(data,0)); + int v = atoi(GetParam(data, 0)); char c[50]; v--; - itoa(v,c,10); - data=SetParam(data,0, c); + itoa(v, c, 10); + data = SetParam(data, 0, c); - int pos=GetEventParamStart(orig_data, curev);//1+curev*3; + int pos = GetEventParamStart(orig_data, curev);//1+curev*3; //int posc=GetEventParamStart(orig_data, v);//1+v*3; - + // MW 07/23/01: // NEW DELETE EVENT CODE... // Now check for those 2 param + code events... - BOOL bEvent1Needs4=FALSE; + BOOL bEvent1Needs4 = FALSE; + - if (GetParam(data, pos + 1) == "2") { bEvent1Needs4 = TRUE; } - - int count=3; + + int count = 3; if (bEvent1Needs4) { count = 4; } - int del_start=FindTokenX(data, ',', pos); - int del_end=FindTokenX(data, ',', pos+count); + int del_start = FindTokenX(data, ',', pos); + int del_end = FindTokenX(data, ',', pos + count); if (del_end < 0) { // beyond end, so delete all... - del_end=data.GetLength(); + del_end = data.GetLength(); } - data.Delete(del_start, del_end-del_start); + data.Delete(del_start, del_end - del_start); /* old delete event code, that used replacement. Not possible anymore because of 4 values/event sometimes now - + int i; for(i=0;i<3;i++) data=SetParam(data,pos+i, GetParam(data,posc+i)); @@ -224,33 +221,33 @@ void CTriggerEventsDlg::OnDeleteevent() ini.SetString("Events", m_currentTrigger, data); UpdateDialog(); - + } -void CTriggerEventsDlg::OnSelchangeEvent() +void CTriggerEventsDlg::OnSelchangeEvent() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_currentTrigger.GetLength() == 0) { return; } - int selev=m_Event.GetCurSel(); + int selev = m_Event.GetCurSel(); if (selev < 0) { return; } - int curev=m_Event.GetItemData(selev); + int curev = m_Event.GetItemData(selev); + - int i; auto const& EventData = ini["Events"][m_currentTrigger]; - - int startpos=GetEventParamStart(EventData, curev); //1+curev*3; - CString EventType=GetParam(EventData,startpos); + + int startpos = GetEventParamStart(EventData, curev); //1+curev*3; + CString EventType = GetParam(EventData, startpos); m_EventType.SetWindowText(EventType); for (i = 0; i < m_EventType.GetCount(); i++) { CString tmp; - m_EventType.GetLBText(i,tmp); + m_EventType.GetLBText(i, tmp); TruncSpace(tmp); if (tmp == EventType) { m_EventType.SetCurSel(i); @@ -260,24 +257,24 @@ void CTriggerEventsDlg::OnSelchangeEvent() OnEditchangeEventtype(); } -void CTriggerEventsDlg::OnEditchangeEventtype() +void CTriggerEventsDlg::OnEditchangeEventtype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (m_currentTrigger.GetLength() == 0) { return; } - int selev=m_Event.GetCurSel(); + int selev = m_Event.GetCurSel(); if (selev < 0) { return; } - int curev=m_Event.GetItemData(selev); + int curev = m_Event.GetItemData(selev); - CString e1,e2; - while(m_Parameter.DeleteString(0)!=CB_ERR); + CString e1, e2; + while (m_Parameter.DeleteString(0) != CB_ERR); - CString eventtype,eventdata; + CString eventtype, eventdata; m_EventType.GetWindowText(eventtype); TruncSpace(eventtype); @@ -287,18 +284,18 @@ void CTriggerEventsDlg::OnEditchangeEventtype() } int pos = GetEventParamStart(ini["Events"][m_currentTrigger], curev); //1+3*curev; - + BOOL bAlready4 = FALSE; if (atoi(GetParam(ini["Events"][m_currentTrigger], pos + 1)) == 2) { bAlready4 = TRUE; } - + ini.SetString("Events", m_currentTrigger, SetParam(ini["Events"][m_currentTrigger], pos, eventtype)); - CString evsec="Events"; + CString evsec = "Events"; #ifdef RA2_MODE - evsec="EventsRA2"; + evsec = "EventsRA2"; #endif @@ -314,18 +311,18 @@ void CTriggerEventsDlg::OnEditchangeEventtype() } #endif - CString desc=GetParam(eventdata,5); - desc.Replace("%1",","); - m_EventDescription.SetWindowText(desc); - + CString desc = GetParam(eventdata, 5); + desc.Replace("%1", ","); + m_EventDescription.SetWindowText(desc); + CString ptype[2]; - ptype[0]=GetParam(eventdata,1); - ptype[1]=GetParam(eventdata,2); + ptype[0] = GetParam(eventdata, 1); + ptype[1] = GetParam(eventdata, 2); int pListType[2]; - pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); - pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); + pListType[0] = atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); + pListType[1] = atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); int code = atoi(GetParam(g_data["ParamTypes"][ptype[0]], 2)); // usually 0 @@ -372,12 +369,12 @@ void CTriggerEventsDlg::OnEditchangeEventtype() } m_ParamValue.SetWindowText(""); - if(m_Parameter.GetCount()>0) { + if (m_Parameter.GetCount() > 0) { m_Parameter.SetCurSel(0); OnSelchangeParameter(); } - - + + auto triggerInfoCopy = ini["Triggers"][m_currentTrigger]; if (RepairTrigger(triggerInfoCopy)) { ini.SetString("Triggers", m_currentTrigger, triggerInfoCopy); @@ -438,13 +435,11 @@ void CTriggerEventsDlg::OnSelchangeParameter() int i; BOOL bFound = FALSE; - for (i = 0; i < m_ParamValue.GetCount(); i++) - { + for (i = 0; i < m_ParamValue.GetCount(); i++) { CString tmp; m_ParamValue.GetLBText(i, tmp); TruncSpace(tmp); - if (tmp == GetParam(EventData, startpos + 1 + original_cuparam)) - { + if (tmp == GetParam(EventData, startpos + 1 + original_cuparam)) { m_ParamValue.SetCurSel(i); bFound = TRUE; break; @@ -488,8 +483,7 @@ void CTriggerEventsDlg::OnEditchangeParamvalue() int curev = m_Event.GetItemData(selev); int curselparam = m_Parameter.GetCurSel(); - if (curselparam < 0) - { + if (curselparam < 0) { m_ParamValue.SetWindowText(""); return; } @@ -518,21 +512,20 @@ void CTriggerEventsDlg::UpdateDialog() // MW 07/20/01 Clear(); - if(m_currentTrigger.GetLength()==0) - { - while(m_Event.DeleteString(0)!=CB_ERR); + if (m_currentTrigger.GetLength() == 0) { + while (m_Event.DeleteString(0) != CB_ERR); return; } - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - while(m_EventType.DeleteString(0)!=CB_ERR); + while (m_EventType.DeleteString(0) != CB_ERR); int i; //9.3.2001: Only use specified section, do not merge #ifndef RA2_MODE - CString sec="Events"; + CString sec = "Events"; #else - CString sec="EventsRA2"; + CString sec = "EventsRA2"; #endif for (auto const& [eventid, eventdata] : g_data[sec]) { @@ -551,29 +544,27 @@ void CTriggerEventsDlg::UpdateDialog() #else - if (GetParam(eventdata, 6) == "1") - { + if (GetParam(eventdata, 6) == "1") { #endif m_EventType.AddString(text); } - } + } - int cur_sel=m_Event.GetCurSel(); - while(m_Event.DeleteString(0)!=CB_ERR); - + int cur_sel = m_Event.GetCurSel(); + while (m_Event.DeleteString(0) != CB_ERR); + auto const& data = ini["Events"][m_currentTrigger]; int count = atoi(GetParam(data, 0)); - for(i=0;i. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TRIGGEREVENTSDLG_H__13CDEBA1_961C_11D4_9C87_BD9803B9B54A__INCLUDED_) @@ -34,7 +34,7 @@ class CTriggerEventsDlg : public CDialog { -// Konstruktion + // Konstruktion public: void Clear(); CString m_currentTrigger; @@ -55,7 +55,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTriggerEventsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/TriggerOptionsDlg.cpp b/MissionEditor/TriggerOptionsDlg.cpp index 05331ca..a25631a 100644 --- a/MissionEditor/TriggerOptionsDlg.cpp +++ b/MissionEditor/TriggerOptionsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // TriggerOptionsDlg.cpp: Implementierungsdatei @@ -146,8 +146,7 @@ void CTriggerOptionsDlg::OnChangeName() newName = " "; } - if (newName.Find(",", 0) >= 0) - {//newName.SetAt(newName.Find(",",0), 0); + if (newName.Find(",", 0) >= 0) {//newName.SetAt(newName.Find(",",0), 0); newName = newName.Left(newName.Find(",", 0)); m_Name.SetWindowText(newName); @@ -177,20 +176,20 @@ void CTriggerOptionsDlg::OnChangeName() } } -void CTriggerOptionsDlg::OnEditchangeHouse() +void CTriggerOptionsDlg::OnEditchangeHouse() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) { return; } CString newHouse; m_House.GetWindowText(newHouse); - - - - newHouse=TranslateHouse(newHouse); + + + + newHouse = TranslateHouse(newHouse); newHouse.TrimLeft(); TruncSpace(newHouse); @@ -199,17 +198,17 @@ void CTriggerOptionsDlg::OnEditchangeHouse() } ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 0, newHouse)); - + auto triggerCopy = ini["Triggers"][m_currentTrigger]; if (RepairTrigger(triggerCopy)) { ini.SetString("Triggers", m_currentTrigger, triggerCopy); } } -void CTriggerOptionsDlg::OnEditchangeAttachedtrigger() +void CTriggerOptionsDlg::OnEditchangeAttachedtrigger() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) { return; } @@ -222,24 +221,24 @@ void CTriggerOptionsDlg::OnEditchangeAttachedtrigger() if (newTrigger.Find(",", 0) >= 0) { newTrigger.SetAt(newTrigger.Find(",", 0), 0); } - + ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 1, newTrigger)); - - + + } -void CTriggerOptionsDlg::OnKillfocusName() +void CTriggerOptionsDlg::OnKillfocusName() { - ((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog(); + ((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog(); } -void CTriggerOptionsDlg::OnKillFocus(CWnd* pNewWnd) +void CTriggerOptionsDlg::OnKillFocus(CWnd* pNewWnd) { CDialog::OnKillFocus(pNewWnd); - - ((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog(); + + ((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog(); } void CTriggerOptionsDlg::OnEditchangeTriggertype() @@ -307,15 +306,15 @@ void CTriggerOptionsDlg::OnDisabled() ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 3, param)); } -void CTriggerOptionsDlg::OnEasy() +void CTriggerOptionsDlg::OnEasy() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) { return; } - BOOL bEasy=FALSE; + BOOL bEasy = FALSE; if (m_Easy.GetCheck() == 0) { bEasy = FALSE; } else { @@ -326,40 +325,40 @@ void CTriggerOptionsDlg::OnEasy() ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 4, param)); } -void CTriggerOptionsDlg::OnMedium() +void CTriggerOptionsDlg::OnMedium() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) { return; } - BOOL bMedium=FALSE; + BOOL bMedium = FALSE; if (m_Medium.GetCheck() == 0) { bMedium = FALSE; } else { bMedium = TRUE; } - + auto const param = bMedium ? "1" : "0"; ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 5, param)); } -void CTriggerOptionsDlg::OnHard() +void CTriggerOptionsDlg::OnHard() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) { return; } - BOOL bHard=FALSE; + BOOL bHard = FALSE; if (m_Hard.GetCheck() == 0) { bHard = FALSE; } else { bHard = TRUE; } - + auto const param = bHard ? "1" : "0"; ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 6, param)); } @@ -367,5 +366,5 @@ void CTriggerOptionsDlg::OnHard() //MW 07/20/01 void CTriggerOptionsDlg::Clear() { - + } diff --git a/MissionEditor/TriggerOptionsDlg.h b/MissionEditor/TriggerOptionsDlg.h index b9641fd..3a96609 100644 --- a/MissionEditor/TriggerOptionsDlg.h +++ b/MissionEditor/TriggerOptionsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TRIGGEROPTIONSDLG_H__FA26A541_949D_11D4_9C87_CBD54CC4BF4A__INCLUDED_) @@ -32,7 +32,7 @@ class CTriggerOptionsDlg : public CDialog { -// Konstruktion + // Konstruktion public: void Clear(); virtual BOOL PreTranslateMessage(MSG* pMsg); @@ -57,7 +57,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTriggerOptionsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Triggers.cpp b/MissionEditor/Triggers.cpp index bce2fd7..a202f65 100644 --- a/MissionEditor/Triggers.cpp +++ b/MissionEditor/Triggers.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Triggers.cpp: Implementierungsdatei @@ -161,30 +161,30 @@ END_MESSAGE_MAP() void CTriggers::UpdateDialog() { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - int selat=m_Action.GetCurSel(); - int selev=m_Event.GetCurSel(); - while(m_Trigger.DeleteString(0)!=CB_ERR); - while(m_Trigger2.DeleteString(0)!=CB_ERR); - while(m_Action.DeleteString(0)!=CB_ERR); - while(m_Event.DeleteString(0)!=CB_ERR); - while(m_ActionWaypoint.DeleteString(0)!=CB_ERR); - while(m_House.DeleteString(0)!=CB_ERR); - while(m_ActionType.DeleteString(0)!=CB_ERR); - while(m_EventType.DeleteString(0)!=CB_ERR); - - m_LE1="Parameter 1"; - m_LE2="Parameter 2"; - m_LA1="Param1"; - m_LA2="Param2"; - m_LA3="Param3"; - m_LA4="Param4"; - m_LA5="Param5"; - m_LA6="Param6"; + int sel = m_Trigger.GetCurSel(); + int selat = m_Action.GetCurSel(); + int selev = m_Event.GetCurSel(); + + while (m_Trigger.DeleteString(0) != CB_ERR); + while (m_Trigger2.DeleteString(0) != CB_ERR); + while (m_Action.DeleteString(0) != CB_ERR); + while (m_Event.DeleteString(0) != CB_ERR); + while (m_ActionWaypoint.DeleteString(0) != CB_ERR); + while (m_House.DeleteString(0) != CB_ERR); + while (m_ActionType.DeleteString(0) != CB_ERR); + while (m_EventType.DeleteString(0) != CB_ERR); + + m_LE1 = "Parameter 1"; + m_LE2 = "Parameter 2"; + m_LA1 = "Param1"; + m_LA2 = "Param2"; + m_LA3 = "Param3"; + m_LA4 = "Param4"; + m_LA5 = "Param5"; + m_LA6 = "Param6"; int i; @@ -198,7 +198,7 @@ void CTriggers::UpdateDialog() m_Trigger.AddString(s); m_Trigger2.AddString(s); } - + for (auto const& [eventid, eventdata] : g_data["Events"]) { CString text = eventid + " " + GetParam(eventdata, 0); m_EventType.AddString(text); @@ -208,57 +208,57 @@ void CTriggers::UpdateDialog() CString text = actionid + " " + GetParam(actiondata, 0); m_ActionType.AddString(text); } - - + + ListHouses(m_House, FALSE); CComboBox* wayp; - wayp=(CComboBox*)GetDlgItem(IDC_ACTIONWAYPOINT); - while(wayp->DeleteString(0)!=CB_ERR); + wayp = (CComboBox*)GetDlgItem(IDC_ACTIONWAYPOINT); + while (wayp->DeleteString(0) != CB_ERR); for (auto const& [num, coord] : ini["Waypoints"]) { wayp->AddString(num); } - if(sel==-1 || m_Trigger.SetCurSel(sel)==FALSE) { + if (sel == -1 || m_Trigger.SetCurSel(sel) == FALSE) { m_Trigger.SetCurSel(0); } - if(selat==-1 || m_Trigger.SetCurSel(selat)==FALSE) { + if (selat == -1 || m_Trigger.SetCurSel(selat) == FALSE) { m_Action.SetCurSel(0); } - if(selev==-1 || m_Trigger.SetCurSel(selev)==FALSE) { + if (selev == -1 || m_Trigger.SetCurSel(selev) == FALSE) { m_Event.SetCurSel(0); } OnSelchangeTrigger(); - + } -void CTriggers::OnSelchangeTrigger() +void CTriggers::OnSelchangeTrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; - while(m_Action.DeleteString(0)!=CB_ERR); - while(m_Event.DeleteString(0)!=CB_ERR); + while (m_Action.DeleteString(0) != CB_ERR); + while (m_Event.DeleteString(0) != CB_ERR); CString TriggerData, EventData, ActionData; CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - + TriggerData = ini.GetString("Triggers", CurrentTrigger); EventData = ini.GetString("Events", CurrentTrigger); ActionData = ini.GetString("Actions", CurrentTrigger); - m_Name=GetParam(TriggerData, 2); - m_House.SetWindowText(TranslateHouse(GetParam(TriggerData,0), TRUE)); - + m_Name = GetParam(TriggerData, 2); + m_House.SetWindowText(TranslateHouse(GetParam(TriggerData, 0), TRUE)); - CString trig2=GetParam(TriggerData,1); + + CString trig2 = GetParam(TriggerData, 1); if (ini["Triggers"].Exists(trig2)) { trig2 += " ("; trig2 += GetParam(ini["Triggers"][GetParam(TriggerData, 1)], 2); @@ -266,11 +266,11 @@ void CTriggers::OnSelchangeTrigger() } m_Trigger2.SetWindowText(trig2); - m_F1=GetParam(TriggerData,3); - m_F2=GetParam(TriggerData,4); - m_F3=GetParam(TriggerData,5); - m_F4=GetParam(TriggerData,6); - m_F5=GetParam(TriggerData,7); + m_F1 = GetParam(TriggerData, 3); + m_F2 = GetParam(TriggerData, 4); + m_F3 = GetParam(TriggerData, 5); + m_F4 = GetParam(TriggerData, 6); + m_F5 = GetParam(TriggerData, 7); // okay, now list all events and actions @@ -278,40 +278,38 @@ void CTriggers::OnSelchangeTrigger() int i; // events - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int selev = m_Event.GetCurSel(); + if (selev < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int selev=m_Event.GetCurSel(); - if(selev<0) return; - int i; CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -319,71 +317,69 @@ void CTriggers::OnSelchangeEvent() auto const& eventData = ini["Events"][CurrentTrigger]; - - int startpos=1+selev*3; - CString EventType=GetParam(eventData,startpos); + + int startpos = 1 + selev * 3; + CString EventType = GetParam(eventData, startpos); m_EventType.SetWindowText(EventType); - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int selac=m_Action.GetCurSel(); - if(selac<0) return; + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int selac = m_Action.GetCurSel(); + if (selac < 0) return; int i; CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - auto const& ActionData=ini["Actions"][CurrentTrigger]; + auto const& ActionData = ini["Actions"][CurrentTrigger]; - int startpos=1+selac*8; - CString ActionType=GetParam(ActionData,startpos); + int startpos = 1 + selac * 8; + CString ActionType = GetParam(ActionData, startpos); m_ActionType.SetWindowText(ActionType); - for(i=0;iGetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -395,33 +391,33 @@ void CTriggers::OnEditchangeHouse() CString house; m_House.GetWindowText(house); - house=TranslateHouse(house); - + house = TranslateHouse(house); + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 0, house)); } -void CTriggers::OnSelchangeHouse() +void CTriggers::OnSelchangeHouse() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int csel=m_House.GetCurSel(); + int csel = m_House.GetCurSel(); CString house; - m_House.GetLBText(csel,house); + m_House.GetLBText(csel, house); m_House.SetWindowText(house); OnEditchangeHouse(); } -void CTriggers::OnChangeName() +void CTriggers::OnChangeName() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - - CEdit& name=*(CEdit*)GetDlgItem(IDC_NAME); - int esel=name.GetSel(); - int sel=m_Trigger.GetCurSel(); + CEdit& name = *(CEdit*)GetDlgItem(IDC_NAME); + + int esel = name.GetSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -430,23 +426,23 @@ void CTriggers::OnChangeName() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 2, m_Name)); UpdateDialog(); - + m_Trigger.SetCurSel(sel); OnSelchangeTrigger(); name.SetSel(esel); } -void CTriggers::OnChangeFlag1() +void CTriggers::OnChangeFlag1() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -459,13 +455,13 @@ void CTriggers::OnChangeFlag1() ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 3, m_F1)); } -void CTriggers::OnChangeFlag2() +void CTriggers::OnChangeFlag2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -476,16 +472,16 @@ void CTriggers::OnChangeFlag2() ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 4, m_F2)); - + } -void CTriggers::OnChangeFlag3() +void CTriggers::OnChangeFlag3() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -494,19 +490,19 @@ void CTriggers::OnChangeFlag3() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 5, m_F3)); - + } -void CTriggers::OnChangeFlag4() +void CTriggers::OnChangeFlag4() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -515,18 +511,18 @@ void CTriggers::OnChangeFlag4() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - - ini.SetString("Triggers",CurrentTrigger,SetParam(ini["Triggers"][CurrentTrigger], 6, m_F4)); + + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 6, m_F4)); } -void CTriggers::OnChangeFlag5() +void CTriggers::OnChangeFlag5() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); UpdateData(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -535,16 +531,16 @@ void CTriggers::OnChangeFlag5() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 7, m_F5)); } -void CTriggers::OnEditchangeTrigger2() +void CTriggers::OnEditchangeTrigger2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -556,35 +552,35 @@ void CTriggers::OnEditchangeTrigger2() CString trg; m_Trigger2.GetWindowText(trg); TruncSpace(trg); - + ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 1, trg)); } -void CTriggers::OnSelchangeTrigger2() +void CTriggers::OnSelchangeTrigger2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int csel=m_Trigger2.GetCurSel(); + int csel = m_Trigger2.GetCurSel(); CString trg; - m_Trigger2.GetLBText(csel,trg); + m_Trigger2.GetLBText(csel, trg); m_Trigger2.SetWindowText(trg); OnEditchangeTrigger2(); } -void CTriggers::OnEditchangeEventtype() +void CTriggers::OnEditchangeEventtype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Event.GetCurSel(); - if(sel2<0) return; + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Event.GetCurSel(); + if (sel2 < 0) return; - CString e1,e2; + CString e1, e2; m_E1.GetWindowText(e1); m_E2.GetWindowText(e2); - while(m_E2.DeleteString(0)!=CB_ERR); - while(m_E1.DeleteString(0)!=CB_ERR); + while (m_E2.DeleteString(0) != CB_ERR); + while (m_E1.DeleteString(0) != CB_ERR); m_E1.SetWindowText(e1); m_E2.SetWindowText(e2); @@ -596,67 +592,64 @@ void CTriggers::OnEditchangeEventtype() m_EventType.GetWindowText(eventtype); TruncSpace(eventtype); - int pos=1+3*sel2; - + int pos = 1 + 3 * sel2; + ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, eventtype)); if (g_data["Events"].FindIndex(eventtype) < 0) { return; } - + CString ptype[2]; - ptype[0]=GetParam(g_data["Events"][eventtype],1); - ptype[1]=GetParam(g_data["Events"][eventtype],2); + ptype[0] = GetParam(g_data["Events"][eventtype], 1); + ptype[1] = GetParam(g_data["Events"][eventtype], 2); int pListType[2]; - pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); - pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); + pListType[0] = atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); + pListType[1] = atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); int i; - for(i=0;i<2;i++) - { + for (i = 0; i < 2; i++) { CString* label; - if(i==0) label=&m_LE1; - if(i==1) label=&m_LE2; + if (i == 0) label = &m_LE1; + if (i == 1) label = &m_LE2; CComboBox* cb; - if(i==0) cb=&m_E1; - if(i==1) cb=&m_E2; + if (i == 0) cb = &m_E1; + if (i == 1) cb = &m_E2; CString old_sel; cb->GetWindowText(old_sel); TruncSpace(old_sel); - if(atoi(ptype[i])<0) - { + if (atoi(ptype[i]) < 0) { char c[50]; itoa(abs(atoi(ptype[i])), c, 10); cb->SetWindowText(c); - *label="Static"; + *label = "Static"; continue; } - *label=GetParam(g_data["ParamTypes"][ptype[i]], 0); + *label = GetParam(g_data["ParamTypes"][ptype[i]], 0); + - HandleParamList(*cb, pListType[i]); - + cb->SetWindowText(old_sel); int e; - for(e=0;eGetCount();e++) - { + for (e = 0; e < cb->GetCount(); e++) { CString tmp; - cb->GetLBText(e,tmp); + cb->GetLBText(e, tmp); TruncSpace(tmp); - if(tmp==old_sel) + if (tmp == old_sel) cb->SetCurSel(e); } - + } - + UpdateData(FALSE); @@ -664,26 +657,26 @@ void CTriggers::OnEditchangeEventtype() -void CTriggers::OnSelchangeEventtype() +void CTriggers::OnSelchangeEventtype() { - int csel=m_EventType.GetCurSel(); + int csel = m_EventType.GetCurSel(); CString trg; - m_EventType.GetLBText(csel,trg); + m_EventType.GetLBText(csel, trg); m_EventType.SetWindowText(trg); OnEditchangeEventtype(); - - + + } -void CTriggers::OnEditchangeEventparam1() +void CTriggers::OnEditchangeEventparam1() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Event.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Event.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -693,30 +686,30 @@ void CTriggers::OnEditchangeEventparam1() m_E1.GetWindowText(param1); TruncSpace(param1); - int pos=1+3*sel2+1; - + int pos = 1 + 3 * sel2 + 1; + ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, param1)); - + } -void CTriggers::OnSelchangeEventparam1() +void CTriggers::OnSelchangeEventparam1() { - int csel=m_E1.GetCurSel(); + int csel = m_E1.GetCurSel(); CString trg; - m_E1.GetLBText(csel,trg); + m_E1.GetLBText(csel, trg); m_E1.SetWindowText(trg); OnEditchangeEventparam1(); } -void CTriggers::OnEditchangeEventparam2() +void CTriggers::OnEditchangeEventparam2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Event.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Event.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -726,48 +719,48 @@ void CTriggers::OnEditchangeEventparam2() m_E2.GetWindowText(param2); TruncSpace(param2); - int pos=1+3*sel2+2; - + int pos = 1 + 3 * sel2 + 2; + ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, param2)); - + } -void CTriggers::OnSelchangeEventparam2() +void CTriggers::OnSelchangeEventparam2() { - int csel=m_E2.GetCurSel(); + int csel = m_E2.GetCurSel(); CString trg; - m_E2.GetLBText(csel,trg); + m_E2.GetLBText(csel, trg); m_E2.SetWindowText(trg); OnEditchangeEventparam2(); } -void CTriggers::OnEditchangeActiontype() +void CTriggers::OnEditchangeActiontype() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString a; m_A1.GetWindowText(a); - while(m_A1.DeleteString(0)!=CB_ERR); + while (m_A1.DeleteString(0) != CB_ERR); m_A1.SetWindowText(a); m_A2.GetWindowText(a); - while(m_A2.DeleteString(0)!=CB_ERR); + while (m_A2.DeleteString(0) != CB_ERR); m_A2.SetWindowText(a); m_A3.GetWindowText(a); - while(m_A3.DeleteString(0)!=CB_ERR); + while (m_A3.DeleteString(0) != CB_ERR); m_A3.SetWindowText(a); m_A4.GetWindowText(a); - while(m_A4.DeleteString(0)!=CB_ERR); + while (m_A4.DeleteString(0) != CB_ERR); m_A4.SetWindowText(a); m_A5.GetWindowText(a); - while(m_A5.DeleteString(0)!=CB_ERR); + while (m_A5.DeleteString(0) != CB_ERR); m_A5.SetWindowText(a); m_A6.GetWindowText(a); - while(m_A6.DeleteString(0)!=CB_ERR); + while (m_A6.DeleteString(0) != CB_ERR); m_A6.SetWindowText(a); @@ -779,252 +772,249 @@ void CTriggers::OnEditchangeActiontype() m_ActionType.GetWindowText(actiontype); TruncSpace(actiontype); - int pos=1+8*sel2; - + int pos = 1 + 8 * sel2; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, actiontype)); if (g_data["Actions"].FindIndex(actiontype) < 0) { return; } - + CString ptype[6]; - ptype[0]=GetParam(g_data["Actions"][actiontype],1); - ptype[1]=GetParam(g_data["Actions"][actiontype],2); - ptype[2]=GetParam(g_data["Actions"][actiontype],3); - ptype[3]=GetParam(g_data["Actions"][actiontype],4); - ptype[4]=GetParam(g_data["Actions"][actiontype],5); - ptype[5]=GetParam(g_data["Actions"][actiontype],6); + ptype[0] = GetParam(g_data["Actions"][actiontype], 1); + ptype[1] = GetParam(g_data["Actions"][actiontype], 2); + ptype[2] = GetParam(g_data["Actions"][actiontype], 3); + ptype[3] = GetParam(g_data["Actions"][actiontype], 4); + ptype[4] = GetParam(g_data["Actions"][actiontype], 5); + ptype[5] = GetParam(g_data["Actions"][actiontype], 6); if (GetParam(g_data["Actions"][actiontype], 7) == "0") { - m_LAW="Unused"; + m_LAW = "Unused"; } else { m_LAW = "Waypoint:"; } int pListType[6]; - pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); - pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); + pListType[0] = atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1)); + pListType[1] = atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1)); + - int i; - for(i=0;i<6;i++) - { + for (i = 0; i < 6; i++) { CString* label; - if(i==0) label=&m_LA1; - if(i==1) label=&m_LA2; - if(i==2) label=&m_LA3; - if(i==3) label=&m_LA4; - if(i==4) label=&m_LA5; - if(i==5) label=&m_LA6; + if (i == 0) label = &m_LA1; + if (i == 1) label = &m_LA2; + if (i == 2) label = &m_LA3; + if (i == 3) label = &m_LA4; + if (i == 4) label = &m_LA5; + if (i == 5) label = &m_LA6; CComboBox* cb; - if(i==0) cb=&m_A1; - if(i==1) cb=&m_A2; - if(i==2) cb=&m_A3; - if(i==3) cb=&m_A4; - if(i==4) cb=&m_A5; - if(i==5) cb=&m_A6; + if (i == 0) cb = &m_A1; + if (i == 1) cb = &m_A2; + if (i == 2) cb = &m_A3; + if (i == 3) cb = &m_A4; + if (i == 4) cb = &m_A5; + if (i == 5) cb = &m_A6; CString old_sel; cb->GetWindowText(old_sel); TruncSpace(old_sel); - if(atoi(ptype[i])<0) - { + if (atoi(ptype[i]) < 0) { char c[50]; itoa(abs(atoi(ptype[i])), c, 10); cb->SetWindowText(c); - *label="Static"; + *label = "Static"; continue; } *label = GetParam(g_data["ParamTypes"][ptype[i]], 0); - + HandleParamList(*cb, pListType[i]); - + cb->SetWindowText(old_sel); int e; - for(e=0;eGetCount();e++) - { + for (e = 0; e < cb->GetCount(); e++) { CString tmp; - cb->GetLBText(e,tmp); + cb->GetLBText(e, tmp); TruncSpace(tmp); - if(tmp==old_sel) + if (tmp == old_sel) cb->SetCurSel(e); } - + } -/* + /* - switch(atoi(actiontype)) - { - case 0: - case 23: - case 24: - case 46: - case 47: - m_LA1="Unused:"; - m_LA2="Unused:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - case 1: - case 2: - case 3: - case 6: - case 36: - case 74: - m_LA1="Unused:"; - m_LA2="House:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - ListHouses(m_A2); - break; + switch(atoi(actiontype)) + { + case 0: + case 23: + case 24: + case 46: + case 47: + m_LA1="Unused:"; + m_LA2="Unused:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + case 1: + case 2: + case 3: + case 6: + case 36: + case 74: + m_LA1="Unused:"; + m_LA2="House:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + ListHouses(m_A2); + break; - case 4: - m_LA1="Unknown =1:"; - m_LA2="TeamType:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - m_A1.SetWindowText("1"); - OnEditchangeActionparam1(); - ListTeamTypes(m_A2); - break; - case 5: - m_LA1="Unused?:"; - m_LA2="TeamType:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - ListTeamTypes(m_A2); - break; + case 4: + m_LA1="Unknown =1:"; + m_LA2="TeamType:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + m_A1.SetWindowText("1"); + OnEditchangeActionparam1(); + ListTeamTypes(m_A2); + break; + case 5: + m_LA1="Unused?:"; + m_LA2="TeamType:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + ListTeamTypes(m_A2); + break; - case 7: - m_LA1="Unknown =1:"; - m_LA2="TeamType:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - m_A1.SetWindowText("1"); - OnEditchangeActionparam1(); - ListTeamTypes(m_A2); - break; - case 8: - case 17: - case 18: - m_LA1="Unused:"; - m_LA2="Waypoint:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - ListWaypoints(m_A2); - break; + case 7: + m_LA1="Unknown =1:"; + m_LA2="TeamType:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + m_A1.SetWindowText("1"); + OnEditchangeActionparam1(); + ListTeamTypes(m_A2); + break; + case 8: + case 17: + case 18: + m_LA1="Unused:"; + m_LA2="Waypoint:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + ListWaypoints(m_A2); + break; - case 27: - m_LA1="Unused:"; - m_LA2="Duration:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - case 43: - m_LA1="Unused:"; - m_LA2="Unknown:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - m_A2.SetWindowText("7"); - OnEditchangeActionparam2(); - break; - case 44: - m_LA1="Unused:"; - m_LA2="Duration:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - case 48: - m_LA1="Unused:"; - m_LA2="Speed:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - case 55: - m_LA1="Unused:"; - m_LA2="Unknown:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - m_A2.SetWindowText("1"); - OnEditchangeActionparam2(); - break; - case 56: - m_LA1="Unused:"; - m_LA2="Global:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - case 58: - m_LA1="Unused:"; - m_LA2="Size:"; - m_LA3="Unused:"; - m_LA4="Unused:"; - m_LA5="Unused:"; - m_LA6="Unused:"; - break; - default: - m_LA1="Param1:"; - m_LA2="Param2:"; - m_LA3="Param3:"; - m_LA4="Param4:"; - m_LA5="Param5:"; - m_LA6="Param6:"; - } -*/ + case 27: + m_LA1="Unused:"; + m_LA2="Duration:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + case 43: + m_LA1="Unused:"; + m_LA2="Unknown:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + m_A2.SetWindowText("7"); + OnEditchangeActionparam2(); + break; + case 44: + m_LA1="Unused:"; + m_LA2="Duration:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + case 48: + m_LA1="Unused:"; + m_LA2="Speed:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + case 55: + m_LA1="Unused:"; + m_LA2="Unknown:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + m_A2.SetWindowText("1"); + OnEditchangeActionparam2(); + break; + case 56: + m_LA1="Unused:"; + m_LA2="Global:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + case 58: + m_LA1="Unused:"; + m_LA2="Size:"; + m_LA3="Unused:"; + m_LA4="Unused:"; + m_LA5="Unused:"; + m_LA6="Unused:"; + break; + default: + m_LA1="Param1:"; + m_LA2="Param2:"; + m_LA3="Param3:"; + m_LA4="Param4:"; + m_LA5="Param5:"; + m_LA6="Param6:"; + } + */ UpdateData(FALSE); } -void CTriggers::OnSelchangeActiontype() +void CTriggers::OnSelchangeActiontype() { - int csel=m_ActionType.GetCurSel(); + int csel = m_ActionType.GetCurSel(); CString trg; - m_ActionType.GetLBText(csel,trg); + m_ActionType.GetLBText(csel, trg); m_ActionType.SetWindowText(trg); - OnEditchangeActiontype(); + OnEditchangeActiontype(); } -void CTriggers::OnEditchangeActionwaypoint() +void CTriggers::OnEditchangeActionwaypoint() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1034,36 +1024,36 @@ void CTriggers::OnEditchangeActionwaypoint() m_ActionWaypoint.GetWindowText(waypoint); TruncSpace(waypoint); - waypoint=GetWaypoint(atoi(waypoint)); + waypoint = GetWaypoint(atoi(waypoint)); + + int pos = 1 + 8 * sel2 + 7; - int pos=1+8*sel2+7; - ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, waypoint)); - + } -void CTriggers::OnSelchangeActionwaypoint() +void CTriggers::OnSelchangeActionwaypoint() { - int csel=m_ActionWaypoint.GetCurSel(); + int csel = m_ActionWaypoint.GetCurSel(); CString trg; - m_ActionWaypoint.GetLBText(csel,trg); + m_ActionWaypoint.GetLBText(csel, trg); m_ActionWaypoint.SetWindowText(trg); OnEditchangeActionwaypoint(); } -void CTriggers::OnEditchangeActionparam1() +void CTriggers::OnEditchangeActionparam1() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } - int sel2=m_Action.GetCurSel(); + int sel2 = m_Action.GetCurSel(); if (sel2 < 0) { return; } - + CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1073,30 +1063,30 @@ void CTriggers::OnEditchangeActionparam1() m_A1.GetWindowText(p1); TruncSpace(p1); - int pos=1+8*sel2+1; - + int pos = 1 + 8 * sel2 + 1; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p1)); - + } -void CTriggers::OnSelchangeActionparam1() +void CTriggers::OnSelchangeActionparam1() { - int csel=m_A1.GetCurSel(); + int csel = m_A1.GetCurSel(); CString trg; - m_A1.GetLBText(csel,trg); + m_A1.GetLBText(csel, trg); m_A1.SetWindowText(trg); OnEditchangeActionparam1(); } -void CTriggers::OnEditchangeActionparam2() +void CTriggers::OnEditchangeActionparam2() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1106,30 +1096,30 @@ void CTriggers::OnEditchangeActionparam2() m_A2.GetWindowText(p2); TruncSpace(p2); - int pos=1+8*sel2+2; - + int pos = 1 + 8 * sel2 + 2; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p2)); - + } -void CTriggers::OnSelchangeActionparam2() +void CTriggers::OnSelchangeActionparam2() { - int csel=m_A2.GetCurSel(); + int csel = m_A2.GetCurSel(); CString trg; - m_A2.GetLBText(csel,trg); + m_A2.GetLBText(csel, trg); m_A2.SetWindowText(trg); - OnEditchangeActionparam2(); + OnEditchangeActionparam2(); } -void CTriggers::OnEditchangeActionparam3() +void CTriggers::OnEditchangeActionparam3() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1139,30 +1129,30 @@ void CTriggers::OnEditchangeActionparam3() m_A3.GetWindowText(p3); TruncSpace(p3); - int pos=1+8*sel2+3; - + int pos = 1 + 8 * sel2 + 3; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p3)); - + } -void CTriggers::OnSelchangeActionparam3() +void CTriggers::OnSelchangeActionparam3() { - int csel=m_A3.GetCurSel(); + int csel = m_A3.GetCurSel(); CString trg; - m_A3.GetLBText(csel,trg); + m_A3.GetLBText(csel, trg); m_A3.SetWindowText(trg); OnEditchangeActionparam3(); } -void CTriggers::OnEditchangeActionparam4() +void CTriggers::OnEditchangeActionparam4() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1172,30 +1162,30 @@ void CTriggers::OnEditchangeActionparam4() m_A4.GetWindowText(p4); TruncSpace(p4); - int pos=1+8*sel2+4; - + int pos = 1 + 8 * sel2 + 4; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p4)); - + } -void CTriggers::OnSelchangeActionparam4() +void CTriggers::OnSelchangeActionparam4() { - int csel=m_A4.GetCurSel(); + int csel = m_A4.GetCurSel(); CString trg; - m_A4.GetLBText(csel,trg); + m_A4.GetLBText(csel, trg); m_A4.SetWindowText(trg); - OnEditchangeActionparam4(); + OnEditchangeActionparam4(); } -void CTriggers::OnEditchangeActionparam5() +void CTriggers::OnEditchangeActionparam5() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1205,30 +1195,30 @@ void CTriggers::OnEditchangeActionparam5() m_A5.GetWindowText(p5); TruncSpace(p5); - int pos=1+8*sel2+5; - + int pos = 1 + 8 * sel2 + 5; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p5)); - + } -void CTriggers::OnSelchangeActionparam5() +void CTriggers::OnSelchangeActionparam5() { - int csel=m_A5.GetCurSel(); + int csel = m_A5.GetCurSel(); CString trg; - m_A5.GetLBText(csel,trg); + m_A5.GetLBText(csel, trg); m_A5.SetWindowText(trg); OnEditchangeActionparam5(); } -void CTriggers::OnEditchangeActionparam6() +void CTriggers::OnEditchangeActionparam6() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); + + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; - CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); @@ -1238,47 +1228,47 @@ void CTriggers::OnEditchangeActionparam6() m_A6.GetWindowText(p6); TruncSpace(p6); - int pos=1+8*sel2+6; - + int pos = 1 + 8 * sel2 + 6; + ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p6)); - + } -void CTriggers::OnSelchangeActionparam6() +void CTriggers::OnSelchangeActionparam6() { - int csel=m_A6.GetCurSel(); + int csel = m_A6.GetCurSel(); CString trg; - m_A6.GetLBText(csel,trg); + m_A6.GetLBText(csel, trg); m_A6.SetWindowText(trg); OnEditchangeActionparam6(); } -void CTriggers::OnAddevent() +void CTriggers::OnAddevent() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; CString CurrentTrigger; m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - CIniFileSection& sec=ini.AddSection("Events"); + CIniFileSection& sec = ini.AddSection("Events"); - int cval=atoi(GetParam(sec[CurrentTrigger],0)); + int cval = atoi(GetParam(sec[CurrentTrigger], 0)); cval++; char c[50]; - itoa(cval,c,10); - + itoa(cval, c, 10); + sec.SetString(CurrentTrigger, SetParam(sec[CurrentTrigger], 0, c) + ",13,0,0"); UpdateDialog(); m_Trigger.SetCurSel(sel); OnSelchangeTrigger(); - m_Event.SetCurSel(cval-1); + m_Event.SetCurSel(cval - 1); OnSelchangeEvent(); } @@ -1335,11 +1325,11 @@ void CTriggers::OnDeleteevent() OnSelchangeTrigger(); } -void CTriggers::OnAddaction() +void CTriggers::OnAddaction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -1349,31 +1339,31 @@ void CTriggers::OnAddaction() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - CIniFileSection& sec=ini.AddSection("Actions"); + CIniFileSection& sec = ini.AddSection("Actions"); - int cval=atoi(GetParam(sec[CurrentTrigger],0)); + int cval = atoi(GetParam(sec[CurrentTrigger], 0)); cval++; char c[50]; - itoa(cval,c,10); - + itoa(cval, c, 10); + sec.SetString(CurrentTrigger, SetParam(sec[CurrentTrigger], 0, c) + ",0,0,0,0,0,0,0,A"); UpdateDialog(); m_Trigger.SetCurSel(sel); OnSelchangeTrigger(); - m_Action.SetCurSel(cval-1); - OnSelchangeAction(); + m_Action.SetCurSel(cval - 1); + OnSelchangeAction(); } -void CTriggers::OnDeleteaction() +void CTriggers::OnDeleteaction() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); - if(sel<0) return; - int sel2=m_Action.GetCurSel(); - if(sel2<0) return; + int sel = m_Trigger.GetCurSel(); + if (sel < 0) return; + int sel2 = m_Action.GetCurSel(); + if (sel2 < 0) return; if (MessageBox("Do you really want to delete this action?", "Delete action", MB_YESNO) == IDNO) { return; } @@ -1386,17 +1376,17 @@ void CTriggers::OnDeleteaction() auto data = sec[CurrentTrigger]; - int v=atoi(GetParam(data,0)); + int v = atoi(GetParam(data, 0)); char c[50]; v--; - itoa(v,c,10); - data=SetParam(data,0, c); + itoa(v, c, 10); + data = SetParam(data, 0, c); - int pos=1+sel2*8; - int posc=1+v*8; + int pos = 1 + sel2 * 8; + int posc = 1 + v * 8; int i; - for(i=0;i<3;i++) - data=SetParam(data,pos+i, GetParam(data,posc+i)); + for (i = 0; i < 3; i++) + data = SetParam(data, pos + i, GetParam(data, posc + i)); LPCSTR cupos = data.operator LPCSTR(); for (auto i = 0; i < posc; i++) { @@ -1408,18 +1398,18 @@ void CTriggers::OnDeleteaction() } ini.SetString("Actions", CurrentTrigger, data); - UpdateDialog(); + UpdateDialog(); m_Trigger.SetCurSel(sel); OnSelchangeTrigger(); } -void CTriggers::OnDeletetrigger() +void CTriggers::OnDeletetrigger() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - int sel=m_Trigger.GetCurSel(); + int sel = m_Trigger.GetCurSel(); if (sel < 0) { return; } @@ -1432,9 +1422,9 @@ void CTriggers::OnDeletetrigger() m_Trigger.GetLBText(sel, CurrentTrigger); TruncSpace(CurrentTrigger); - ini.RemoveValueByKey( "Triggers",CurrentTrigger); - ini.RemoveValueByKey( "Events",CurrentTrigger); - ini.RemoveValueByKey( "Actions",CurrentTrigger); + ini.RemoveValueByKey("Triggers", CurrentTrigger); + ini.RemoveValueByKey("Events", CurrentTrigger); + ini.RemoveValueByKey("Actions", CurrentTrigger); //UpdateDialog(); ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE); diff --git a/MissionEditor/Triggers.h b/MissionEditor/Triggers.h index 451e6dd..e54a610 100644 --- a/MissionEditor/Triggers.h +++ b/MissionEditor/Triggers.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_TRIGGERS_H__1E811180_939D_11D3_B63B_F94AB129C441__INCLUDED_) @@ -34,14 +34,14 @@ class CTriggers : public CDialog { DECLARE_DYNCREATE(CTriggers) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CTriggers(); ~CTriggers(); -// Dialogfelddaten - //{{AFX_DATA(CTriggers) + // Dialogfelddaten + //{{AFX_DATA(CTriggers) enum { IDD = IDD_TRIGGERS }; CComboBox m_E2; CComboBox m_E1; @@ -80,7 +80,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CTriggers) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Tube.cpp b/MissionEditor/Tube.cpp index dfa5a40..b67699b 100644 --- a/MissionEditor/Tube.cpp +++ b/MissionEditor/Tube.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "StdAfx.h" @@ -33,13 +33,13 @@ int sgn(int v) return v > 0 ? 1 : 0; } -CTube::CTube(std::uint16_t tubeID, std::uint16_t startX, std::uint16_t startY, ETubeDirection direction, std::uint16_t endX, std::uint16_t endY, const std::vector& tubeParts): +CTube::CTube(std::uint16_t tubeID, std::uint16_t startX, std::uint16_t startY, ETubeDirection direction, std::uint16_t endX, std::uint16_t endY, const std::vector& tubeParts) : CTube(startX, startY, direction, endX, endY, tubeParts) { m_tubeId = tubeID; } -CTube::CTube(const std::uint16_t startX, const std::uint16_t startY, const ETubeDirection direction, const std::uint16_t endX, const std::uint16_t endY, const std::vector& tubeParts): +CTube::CTube(const std::uint16_t startX, const std::uint16_t startY, const ETubeDirection direction, const std::uint16_t endX, const std::uint16_t endY, const std::vector& tubeParts) : CTube() { m_startX = startX; @@ -50,7 +50,7 @@ CTube::CTube(const std::uint16_t startX, const std::uint16_t startY, const ETube m_tubeParts = tubeParts; } -CTube::CTube(std::uint16_t tubeId, const std::string& value): +CTube::CTube(std::uint16_t tubeId, const std::string& value) : m_tubeId(tubeId) { m_startY = stoi(GetParam(value, 0)); @@ -60,8 +60,7 @@ CTube::CTube(std::uint16_t tubeId, const std::string& value): m_endX = stoi(GetParam(value, 4)); std::string readDirS; - for (std::size_t e = 5; !(readDirS = GetParam(value, e)).empty(); ++e) - { + for (std::size_t e = 5; !(readDirS = GetParam(value, e)).empty(); ++e) { const auto readDir = stoi(readDirS); m_tubeParts.push_back(ToTubeDirection(readDir)); } @@ -94,7 +93,7 @@ CTube CTube::reverse(std::uint16_t newTubeID) const // reverse direction tube parts auto reversed = m_tubeParts | std::views::reverse | - std::views::transform([](auto dir) {return opposite_dir(dir);}) | + std::views::transform([](auto dir) {return opposite_dir(dir); }) | std::views::common; // find the first defined direction in the reversed list @@ -120,17 +119,15 @@ bool CTube::isEqual(const CTube& r, bool ignoreId) const const auto& largerTubeParts = r.m_tubeParts.size() >= m_tubeParts.size() ? r.m_tubeParts : m_tubeParts; const auto& smallerTubeParts = r.m_tubeParts.size() < m_tubeParts.size() ? r.m_tubeParts : m_tubeParts; - for (auto i = 0; i < smallerTubeParts.size(); ++i) - { + for (auto i = 0; i < smallerTubeParts.size(); ++i) { if (largerTubeParts[i] != smallerTubeParts[i]) return false; } - for (auto i = smallerTubeParts.size(); i < largerTubeParts.size(); ++i) - { + for (auto i = smallerTubeParts.size(); i < largerTubeParts.size(); ++i) { if (largerTubeParts[i] != ETubeDirection::Undefined) return false; } - + return m_direction == r.m_direction && m_startX == r.m_startX && m_startY == r.m_startY && r.m_endX == r.m_endX && r.m_endY == r.m_endY; } @@ -154,7 +151,7 @@ CTube CTube::autocreate(std::uint16_t startX, std::uint16_t startY, std::uint16_ ti.m_endX = endX; ti.m_endY = endY; - + int xadd = sgn(endX - curx); int yadd = sgn(endY - cury); @@ -217,8 +214,7 @@ bool dir_to_xy(ETubeDirection dir, MapVec& vec) {-1, -1}, // 7 }; const auto iDir = to_int(dir); - if (iDir < 0 || iDir > 7) - { + if (iDir < 0 || iDir > 7) { vec.x = 0; vec.y = 0; return false; @@ -240,13 +236,12 @@ bool CTube::touches(const MapCoords& mc) const { bool touches = false; walk([this, &mc, &touches](const auto& wi) { - if (wi.pos == mc) - { + if (wi.pos == mc) { touches = true; return false; } return true; - }); + }); return touches; } @@ -269,7 +264,7 @@ bool CTube::append(std::uint16_t endX, std::uint16_t endY, int forceStraightPart { auto newTubeParts = m_tubeParts; MapCoords end(endX, endY); - + // remove delimiters auto oldLast = std::find(newTubeParts.begin(), newTubeParts.end(), ETubeDirection::Undefined); newTubeParts.resize(oldLast - newTubeParts.begin()); @@ -277,66 +272,61 @@ bool CTube::append(std::uint16_t endX, std::uint16_t endY, int forceStraightPart // now find current x/y MapCoords cur = getStartCoords(); std::vector existingPositions; - if(!walk([&cur, &existingPositions](const WalkInfo& wi) { + if (!walk([&cur, &existingPositions](const WalkInfo& wi) { cur = wi.pos; existingPositions.push_back(wi.pos); return true; - })) + })) return false; - - // if no enter direction was given, set it now - this should only be true if there are no existingPositions - if (m_direction == ETubeDirection::Undefined) - { - const bool xMajor = abs(end.x - m_startX) > abs(end.y - m_startY); - MapVec add(sgn(end.x - m_startX), sgn(end.y - m_startY)); - add.x = xMajor ? add.x : 0; - add.y = xMajor ? 0 : add.y; - m_direction = kDiffToDir[add.x + 1][add.y + 1]; - } - auto endOnExistingIt = std::find(existingPositions.begin(), existingPositions.end(), end); - if (endOnExistingIt != existingPositions.end()) - { - if (endOnExistingIt == existingPositions.begin()) - return false; // zero length remaining + // if no enter direction was given, set it now - this should only be true if there are no existingPositions + if (m_direction == ETubeDirection::Undefined) { + const bool xMajor = abs(end.x - m_startX) > abs(end.y - m_startY); + MapVec add(sgn(end.x - m_startX), sgn(end.y - m_startY)); + add.x = xMajor ? add.x : 0; + add.y = xMajor ? 0 : add.y; + m_direction = kDiffToDir[add.x + 1][add.y + 1]; + } + + auto endOnExistingIt = std::find(existingPositions.begin(), existingPositions.end(), end); + if (endOnExistingIt != existingPositions.end()) { + if (endOnExistingIt == existingPositions.begin()) + return false; // zero length remaining + + // shorten + auto remaining = endOnExistingIt - existingPositions.begin(); + newTubeParts.resize(remaining); + newTubeParts.push_back(ETubeDirection::Undefined); + m_endX = end.x; + m_endY = end.y; + m_tubeParts = std::move(newTubeParts); + return true; + } + + int n = 0; + while (end != cur) { + MapVec add(sgn(end.x - cur.x), sgn(end.y - cur.y)); + if (newTubeParts.size() < 1 && forceStraightParts < 0) { + // the first tube part should be in the same direction as the enter direction + dir_to_xy(m_direction, add); + } + if (n++ < forceStraightParts) { + const bool xMajorPart = abs(end.x - m_endX) > abs(end.y - m_endY); + add.x = xMajorPart ? add.x : 0; + add.y = xMajorPart ? 0 : add.y; + } + cur += add; + //if (std::find(existingPositions.begin(), existingPositions.end(), std::make_pair(curX, curY)) != existingPositions.end()) + // return false; // intersection - maybe shorten? maybe we can even allow it if TS accepts it? + newTubeParts.push_back(kDiffToDir[add.x + 1][add.y + 1]); + } - // shorten - auto remaining = endOnExistingIt - existingPositions.begin(); - newTubeParts.resize(remaining); newTubeParts.push_back(ETubeDirection::Undefined); - m_endX = end.x; - m_endY = end.y; + m_endX = cur.x; + m_endY = cur.y; m_tubeParts = std::move(newTubeParts); - return true; - } - - int n = 0; - while (end != cur) - { - MapVec add(sgn(end.x - cur.x), sgn(end.y - cur.y)); - if (newTubeParts.size() < 1 && forceStraightParts < 0) - { - // the first tube part should be in the same direction as the enter direction - dir_to_xy(m_direction, add); - } - if (n++ < forceStraightParts) - { - const bool xMajorPart = abs(end.x - m_endX) > abs(end.y - m_endY); - add.x = xMajorPart ? add.x : 0; - add.y = xMajorPart ? 0 : add.y; - } - cur += add; - //if (std::find(existingPositions.begin(), existingPositions.end(), std::make_pair(curX, curY)) != existingPositions.end()) - // return false; // intersection - maybe shorten? maybe we can even allow it if TS accepts it? - newTubeParts.push_back(kDiffToDir[add.x + 1][add.y + 1]); - } - newTubeParts.push_back(ETubeDirection::Undefined); - m_endX = cur.x; - m_endY = cur.y; - m_tubeParts = std::move(newTubeParts); - - return true; + return true; } bool CTube::walk(const std::function& walker) const @@ -345,8 +335,7 @@ bool CTube::walk(const std::function& walker) const WalkInfo wi; wi.pos = MapCoords(m_startX, m_startY); - for (auto dir : m_tubeParts) - { + for (auto dir : m_tubeParts) { wi.direction = dir; dir_to_xy(wi.direction, diff); wi.next_pos = (wi.direction == ETubeDirection::Undefined) ? MapCoords(-1, -1) : wi.pos + diff; @@ -355,7 +344,7 @@ bool CTube::walk(const std::function& walker) const if (wi.direction == ETubeDirection::Undefined) break; wi.pos = wi.next_pos; - } + } return true; } diff --git a/MissionEditor/Tube.h b/MissionEditor/Tube.h index dfdcbc6..a86be7d 100644 --- a/MissionEditor/Tube.h +++ b/MissionEditor/Tube.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -26,27 +26,27 @@ enum class ETubeDirection : char { - Undefined = -1, - Top=0, - TopRight=1, - Right=2, - BottomRight=3, - Bottom=4, - BottomLeft=5, - Left=6, - TopLeft=7, + Undefined = -1, + Top = 0, + TopRight = 1, + Right = 2, + BottomRight = 3, + Bottom = 4, + BottomLeft = 5, + Left = 6, + TopLeft = 7, }; inline ETubeDirection ToTubeDirection(const std::underlying_type_t dir) { - if (dir > 7 || dir < -1) - return ETubeDirection::Undefined; - return static_cast(dir); + if (dir > 7 || dir < -1) + return ETubeDirection::Undefined; + return static_cast(dir); } inline auto to_int(const ETubeDirection dir) { - return static_cast>(dir); + return static_cast>(dir); } ETubeDirection opposite_dir(ETubeDirection dir); @@ -55,90 +55,90 @@ bool dir_to_xy(ETubeDirection dir, MapVec& y); class CTube { public: - struct WalkInfo - { - MapCoords pos; - ETubeDirection direction = ETubeDirection::Undefined; - MapCoords next_pos; - }; + struct WalkInfo + { + MapCoords pos; + ETubeDirection direction = ETubeDirection::Undefined; + MapCoords next_pos; + }; public: - CTube() = default; - CTube(std::uint16_t tubeId, const std::string& s); - CTube( - std::uint16_t tubeID, - std::uint16_t startX, - std::uint16_t startY, - ETubeDirection direction, - std::uint16_t endX, - std::uint16_t endY, - const std::vector& tubeParts - ); - CTube( - std::uint16_t startX, - std::uint16_t startY, - ETubeDirection direction, - std::uint16_t endX, - std::uint16_t endY, - const std::vector& tubeParts - ); + CTube() = default; + CTube(std::uint16_t tubeId, const std::string& s); + CTube( + std::uint16_t tubeID, + std::uint16_t startX, + std::uint16_t startY, + ETubeDirection direction, + std::uint16_t endX, + std::uint16_t endY, + const std::vector& tubeParts + ); + CTube( + std::uint16_t startX, + std::uint16_t startY, + ETubeDirection direction, + std::uint16_t endX, + std::uint16_t endY, + const std::vector& tubeParts + ); - CTube reverse(std::uint16_t newTubeID=0xFFFF) const; + CTube reverse(std::uint16_t newTubeID = 0xFFFF) const; - // full equivalency including id - bool operator==(const CTube& r) const = default; + // full equivalency including id + bool operator==(const CTube& r) const = default; - bool isEqual(const CTube& r, bool ignoreId) const; + bool isEqual(const CTube& r, bool ignoreId) const; - // Create tube with simple algorithm - static CTube autocreate(std::uint16_t startX, std::uint16_t startY, std::uint16_t endX, std::uint16_t endY, int straightStartParts=1); + // Create tube with simple algorithm + static CTube autocreate(std::uint16_t startX, std::uint16_t startY, std::uint16_t endX, std::uint16_t endY, int straightStartParts = 1); - const std::vector& GetTubeParts() const - { - return m_tubeParts; - } + const std::vector& GetTubeParts() const + { + return m_tubeParts; + } - void setId(std::uint16_t id) - { - m_tubeId = id; - } + void setId(std::uint16_t id) + { + m_tubeId = id; + } - bool isCounterpart(const CTube& other) const - { - return getStartCoords() == other.getEndCoords() && getEndCoords() == other.getStartCoords(); - } + bool isCounterpart(const CTube& other) const + { + return getStartCoords() == other.getEndCoords() && getEndCoords() == other.getStartCoords(); + } - bool hasId() const - { - return m_tubeId != 0xFFFF; - } - auto getId() const { return m_tubeId; } - auto getStartX() const { return m_startX; } - auto getStartY() const { return m_startY; } - MapCoords getStartCoords() const { return MapCoords(m_startX, m_startY); } - auto getInitialDirection() const { return m_direction; } - ETubeDirection getLastDirection() const; - auto getEndX() const { return m_endX; } - auto getEndY() const { return m_endY; } - MapCoords getEndCoords() const { return MapCoords(m_endX, m_endY); } + bool hasId() const + { + return m_tubeId != 0xFFFF; + } + auto getId() const { return m_tubeId; } + auto getStartX() const { return m_startX; } + auto getStartY() const { return m_startY; } + MapCoords getStartCoords() const { return MapCoords(m_startX, m_startY); } + auto getInitialDirection() const { return m_direction; } + ETubeDirection getLastDirection() const; + auto getEndX() const { return m_endX; } + auto getEndY() const { return m_endY; } + MapCoords getEndCoords() const { return MapCoords(m_endX, m_endY); } - bool touches(const MapCoords& mc) const; + bool touches(const MapCoords& mc) const; - std::string toString() const; + std::string toString() const; - bool append(std::uint16_t endX, std::uint16_t endY, int forceStraightParts=-1); + bool append(std::uint16_t endX, std::uint16_t endY, int forceStraightParts = -1); - bool walk(const std::function& walker) const; + bool walk(const std::function& walker) const; - bool isValid() const; + bool isValid() const; private: - std::uint16_t m_tubeId = 0xFFFF; // ID of tube - std::uint16_t m_startX = 0; - std::uint16_t m_startY = 0; - ETubeDirection m_direction = ETubeDirection::Undefined; - std::uint16_t m_endX = 0; - std::uint16_t m_endY = 0; - std::vector m_tubeParts; + std::uint16_t m_tubeId = 0xFFFF; // ID of tube + std::uint16_t m_startX = 0; + std::uint16_t m_startY = 0; + ETubeDirection m_direction = ETubeDirection::Undefined; + std::uint16_t m_endX = 0; + std::uint16_t m_endY = 0; + std::vector m_tubeParts; }; \ No newline at end of file diff --git a/MissionEditor/TubeTool.cpp b/MissionEditor/TubeTool.cpp index 5c9c8ff..64e33cf 100644 --- a/MissionEditor/TubeTool.cpp +++ b/MissionEditor/TubeTool.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "StdAfx.h" @@ -44,8 +44,7 @@ std::unique_ptr findTubeEndAt(const MapCoords& mapCoords3d, const Project std::vector findTubesAt(const ProjectedCoords& projCoords, const CMapData& map) { std::vector foundTubes; - for (auto& t : map.GetTubes()) - { + for (auto& t : map.GetTubes()) { auto coords = map.ToMapCoords3d(projCoords, map.GetHeightAt(t->getStartCoords())); if (t->touches(coords)) foundTubes.push_back(t->getId()); @@ -53,20 +52,18 @@ std::vector findTubesAt(const ProjectedCoords& projCoords, const return foundTubes; } -AddTubeTool::AddTubeTool(CMapData& map, CIsoView& view, bool bidirectional): MapTool(map, view), - m_bidirectional(bidirectional) +AddTubeTool::AddTubeTool(CMapData& map, CIsoView& view, bool bidirectional) : MapTool(map, view), +m_bidirectional(bidirectional) { - + } void AddTubeTool::finish() { if (m_tube) { - if (m_tube->isValid()) - { + if (m_tube->isValid()) { getMap().SetTube(m_tube.get()); - if (m_bidirectional) - { + if (m_bidirectional) { auto t2 = m_tube->reverse(); getMap().SetTube(&t2); } @@ -80,11 +77,9 @@ void AddTubeTool::finish() bool AddTubeTool::onRButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags) { - if (!m_modified_tubes.empty()) - { + if (!m_modified_tubes.empty()) { // reset modified tubes to original state - for (auto& tube : m_modified_tubes) - { + for (auto& tube : m_modified_tubes) { getMap().SetTube(tube.get()); } } @@ -109,13 +104,11 @@ void AddTubeTool::onLButtonUp(const ProjectedCoords& projCoords, const MapCoords m_tube = std::move(tube); // also find reverse direction - if (m_bidirectional) - { + if (m_bidirectional) { const auto& tubes = getMap().GetTubes(); auto reversed = m_tube->reverse(); auto reverseIt = std::find_if(tubes.begin(), tubes.end(), [&reversed](const auto& tube) { return tube->isEqual(reversed, true); }); - if (reverseIt != tubes.end()) - { + if (reverseIt != tubes.end()) { m_modified_tubes.push_back(std::make_unique(**reverseIt)); getMap().DeleteTube((*reverseIt)->getId()); } @@ -128,20 +121,15 @@ void AddTubeTool::onLButtonUp(const ProjectedCoords& projCoords, const MapCoords // create a new tube, first click m_tube = std::move(createNewTube(mapCoords3d)); } - } - else - { + } else { int z = getMap().GetHeightAt(m_tube->getStartCoords()); auto mc = getMap().ToMapCoords3d(projCoords, z); - if (m_tube->getEndCoords() == MapCoords(mc.x, mc.y)) - { + if (m_tube->getEndCoords() == MapCoords(mc.x, mc.y)) { finish(); - } - else - { + } else { m_tube->append(mc.x, mc.y, m_tube->GetTubeParts().empty() ? 2 : 0); } - + } getView().RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); @@ -167,39 +155,30 @@ void AddTubeTool::onMouseMove(const ProjectedCoords& projCoords, const MapCoords auto mc = getMap().ToMapCoords3d(projCoords, z); m_mm_tube->append(mc.x, mc.y, m_tube->GetTubeParts().empty() ? 2 : 0); getView().RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else - { + } else { auto tube = getTubeToModify(mapCoords3d, projCoords, flags); - if (tube) - { - m_hover_tube = std::move(tube); + if (tube) { + m_hover_tube = std::move(tube); getView().RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } - else if (m_hover_tube) - { + } else if (m_hover_tube) { m_hover_tube.reset(); getView().RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - } + } } } void AddTubeTool::render() { - if (m_mm_tube) - { + if (m_mm_tube) { // mouse-move tube getView().DrawTube(*m_mm_tube); - } - else if (m_tube) { + } else if (m_tube) { getView().DrawTube(*m_tube); - } - else if (m_hover_tube) - { + } else if (m_hover_tube) { COLORREF col = RGB(0, 255, 0); getView().DrawTube(*m_hover_tube, nullptr, &col); } - + } RemoveTubeTool::RemoveTubeTool(CMapData& map, CIsoView& view) : MapTool(map, view) @@ -211,15 +190,11 @@ void RemoveTubeTool::onMouseMove(const ProjectedCoords& projCoords, const MapCoo auto& m = getMap(); std::vector tubes = findTubesAt(projCoords, getMap()); - if ((flags & MapToolMouseFlags::LBUTTON) == MapToolMouseFlags::LBUTTON) - { - for (auto& id : tubes) - { + if ((flags & MapToolMouseFlags::LBUTTON) == MapToolMouseFlags::LBUTTON) { + for (auto& id : tubes) { m.DeleteTube(id); - } - } - else - { + } + } else { m_hover_tubes.reserve(tubes.size()); std::transform(tubes.begin(), tubes.end(), std::back_inserter(m_hover_tubes), [this](std::uint16_t tubeId) { return std::make_unique(*getMap().GetTube(tubeId)); }); } @@ -229,14 +204,13 @@ void RemoveTubeTool::onMouseMove(const ProjectedCoords& projCoords, const MapCoo void RemoveTubeTool::render() { - for(auto& tube: m_hover_tubes) - { + for (auto& tube : m_hover_tubes) { COLORREF col = RGB(0, 255, 0); getView().DrawTube(*tube, nullptr, &col); } } -ModifyTubeTool::ModifyTubeTool(CMapData& map, CIsoView& view, bool bidirectional): AddTubeTool(map, view, bidirectional) +ModifyTubeTool::ModifyTubeTool(CMapData& map, CIsoView& view, bool bidirectional) : AddTubeTool(map, view, bidirectional) { } diff --git a/MissionEditor/TubeTool.h b/MissionEditor/TubeTool.h index bb11779..25162aa 100644 --- a/MissionEditor/TubeTool.h +++ b/MissionEditor/TubeTool.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -24,45 +24,45 @@ #include class CTube; -class AddTubeTool: public MapTool +class AddTubeTool : public MapTool { public: - AddTubeTool(CMapData& map, CIsoView& view, bool bidirectional); - virtual ~AddTubeTool() = default; + AddTubeTool(CMapData& map, CIsoView& view, bool bidirectional); + virtual ~AddTubeTool() = default; - void finish(); + void finish(); - virtual bool onRButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); - virtual void onLButtonDblClick(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); - virtual void onLButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); - virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); - virtual void render(); + virtual bool onRButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); + virtual void onLButtonDblClick(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); + virtual void onLButtonUp(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); + virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); + virtual void render(); protected: - AddTubeTool& operator=(const AddTubeTool& other) = delete; + AddTubeTool& operator=(const AddTubeTool& other) = delete; - virtual std::unique_ptr getTubeToModify(const MapCoords& mapCoords3d, const ProjectedCoords& projCoords, MapToolMouseFlags flags) const; - virtual std::unique_ptr createNewTube(const MapCoords& mapCoords3d) const; + virtual std::unique_ptr getTubeToModify(const MapCoords& mapCoords3d, const ProjectedCoords& projCoords, MapToolMouseFlags flags) const; + virtual std::unique_ptr createNewTube(const MapCoords& mapCoords3d) const; private: - std::unique_ptr m_tube; - std::unique_ptr m_mm_tube; - std::unique_ptr m_hover_tube; - std::vector> m_modified_tubes; - bool m_bidirectional; + std::unique_ptr m_tube; + std::unique_ptr m_mm_tube; + std::unique_ptr m_hover_tube; + std::vector> m_modified_tubes; + bool m_bidirectional; }; class ModifyTubeTool : public AddTubeTool { public: - ModifyTubeTool(CMapData& map, CIsoView& view, bool bidirectional); - virtual ~ModifyTubeTool() = default; + ModifyTubeTool(CMapData& map, CIsoView& view, bool bidirectional); + virtual ~ModifyTubeTool() = default; protected: - ModifyTubeTool& operator=(const AddTubeTool& other) = delete; + ModifyTubeTool& operator=(const AddTubeTool& other) = delete; - virtual std::unique_ptr getTubeToModify(const MapCoords& mapCoords3d, const ProjectedCoords& projCoords, MapToolMouseFlags flags) const; - virtual std::unique_ptr createNewTube(const MapCoords& mapCoords3d) const; + virtual std::unique_ptr getTubeToModify(const MapCoords& mapCoords3d, const ProjectedCoords& projCoords, MapToolMouseFlags flags) const; + virtual std::unique_ptr createNewTube(const MapCoords& mapCoords3d) const; private: }; @@ -70,16 +70,16 @@ private: class RemoveTubeTool : public MapTool { public: - RemoveTubeTool(CMapData& map, CIsoView& view); - virtual ~RemoveTubeTool() = default; + RemoveTubeTool(CMapData& map, CIsoView& view); + virtual ~RemoveTubeTool() = default; - virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); - virtual void render(); + virtual void onMouseMove(const ProjectedCoords& projCoords, const MapCoords& mapCoords3d, MapToolMouseFlags flags); + virtual void render(); protected: - RemoveTubeTool& operator=(const RemoveTubeTool& other) = delete; + RemoveTubeTool& operator=(const RemoveTubeTool& other) = delete; private: - std::vector> m_hover_tubes; + std::vector> m_hover_tubes; }; diff --git a/MissionEditor/Unit.cpp b/MissionEditor/Unit.cpp index 718b202..d91b960 100644 --- a/MissionEditor/Unit.cpp +++ b/MissionEditor/Unit.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Unit.cpp: Implementierungsdatei @@ -86,7 +86,7 @@ END_MESSAGE_MAP() void CUnit::Init(CString house, CString strength, CString direction, CString action, CString tag, CString flag1, CString flag2, CString flag3, CString flag4, CString flag5, CString flag6) { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); if (house.IsEmpty()) { auto const& houseSec = rules["Houses"]; @@ -98,52 +98,52 @@ void CUnit::Init(CString house, CString strength, CString direction, CString act m_house = TranslateHouse(house, TRUE); } - m_flag1=flag1; - m_flag2=flag2; - m_flag3=flag3; - m_flag4=flag4; - m_flag5=flag5; - m_flag6=flag6; - m_action=action; - m_strength=strength; - m_tag=tag; - m_direction=direction; + m_flag1 = flag1; + m_flag2 = flag2; + m_flag3 = flag3; + m_flag4 = flag4; + m_flag5 = flag5; + m_flag6 = flag6; + m_action = action; + m_strength = strength; + m_tag = tag; + m_direction = direction; } -BOOL CUnit::OnInitDialog() +BOOL CUnit::OnInitDialog() { CDialog::OnInitDialog(); - + // init the common (!) dialog things int i; - CComboBox* house, *tag; - house=(CComboBox*)GetDlgItem(IDC_HOUSE); - tag=(CComboBox*)GetDlgItem(IDC_TAG); + CComboBox* house, * tag; + house = (CComboBox*)GetDlgItem(IDC_HOUSE); + tag = (CComboBox*)GetDlgItem(IDC_TAG); ListHouses(*house, FALSE); - ListTags(*tag,TRUE); + ListTags(*tag, TRUE); + + - - UpdateData(FALSE); - m_strength_ctrl.SetRange(0,256); + m_strength_ctrl.SetRange(0, 256); m_strength_ctrl.SetPos(atoi(m_strength)); - + UpdateStrings(); - return TRUE; + return TRUE; } -void CUnit::OnOK() +void CUnit::OnOK() { CDialog::OnOK(); - m_strength=GetText(&m_strength_ctrl); + m_strength = GetText(&m_strength_ctrl); UpdateData(); - TruncSpace(m_tag); - m_house=TranslateHouse(m_house); - + TruncSpace(m_tag); + m_house = TranslateHouse(m_house); + + - } void CUnit::UpdateStrings() diff --git a/MissionEditor/Unit.h b/MissionEditor/Unit.h index e191286..6b9958f 100644 --- a/MissionEditor/Unit.h +++ b/MissionEditor/Unit.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_UNIT_H__44A11CC3_84B6_11D3_B63B_F881F458F743__INCLUDED_) @@ -32,11 +32,11 @@ class CUnit : public CDialog { -// Konstruktion + // Konstruktion public: void UpdateStrings(); CString m_strength; - void Init(CString house="", CString strength="256", CString direction="64", CString action="Guard", CString tag="None", CString flag1="0", CString flag2="0", CString flag3="0", CString flag4="0", CString flag5="0", CString flag6="0"); + void Init(CString house = "", CString strength = "256", CString direction = "64", CString action = "Guard", CString tag = "None", CString flag1 = "0", CString flag2 = "0", CString flag3 = "0", CString flag4 = "0", CString flag5 = "0", CString flag6 = "0"); CUnit(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten @@ -59,7 +59,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CUnit) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/UserScriptsDlg.cpp b/MissionEditor/UserScriptsDlg.cpp index 8e602ba..4a6e8b0 100644 --- a/MissionEditor/UserScriptsDlg.cpp +++ b/MissionEditor/UserScriptsDlg.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // UserScriptsDlg.cpp: Implementierungsdatei @@ -60,14 +60,14 @@ struct JumpLineData int line; }; -class CUserScript +class CUserScript { public: void RaiseErr(int n, const char* str); char errortext[250]; int error; int functioncount; - int GetFunction(int index, CString* name, CString *params[], int* paramcount); + int GetFunction(int index, CString* name, CString* params[], int* paramcount); int FindJumpLine(CString name); int LoadFile(const char* filename); CUserScript(); @@ -84,232 +84,193 @@ private: CUserScript::CUserScript() { - functioncount=0; - functiondata=NULL; + functioncount = 0; + functiondata = NULL; } CUserScript::~CUserScript() { - if(functiondata!=NULL) free( functiondata); + if (functiondata != NULL) free(functiondata); } int CUserScript::FindJumpLine(CString name) { - if(jumplinedata.find(name)==jumplinedata.end()) return -1; + if (jumplinedata.find(name) == jumplinedata.end()) return -1; return jumplinedata[name]; } -int CUserScript::LoadFile(const char *setupfile) +int CUserScript::LoadFile(const char* setupfile) { - filename=setupfile; - - int file=_open(setupfile, _O_RDONLY); - if(file==-1) - { + filename = setupfile; + + int file = _open(setupfile, _O_RDONLY); + if (file == -1) { MessageBox(0, "Error opening script file", "Error", MB_ICONERROR); return -1; } - int parsepos=0, filesize=0; - BOOL inFunction=FALSE; - BOOL inParam=FALSE; - BOOL inComment=FALSE; - BOOL inFunctionHead=FALSE; - BOOL inNewOrder=TRUE; - BOOL inJumpLine=FALSE; + int parsepos = 0, filesize = 0; + BOOL inFunction = FALSE; + BOOL inParam = FALSE; + BOOL inComment = FALSE; + BOOL inFunctionHead = FALSE; + BOOL inNewOrder = TRUE; + BOOL inJumpLine = FALSE; - - - while(!(_eof(file))) - { + + + while (!(_eof(file))) { unsigned char c; - int res=_read(file,(void*) &c, 1); - if(res>0) filesize++; + int res = _read(file, (void*)&c, 1); + if (res > 0) filesize++; } _lseek(file, 0, SEEK_SET); - unsigned char *data=new(unsigned char[filesize+5]); - data[filesize]=0; - for (parsepos=0;parseposdata(), 0); - } - else - { + } else { // add character to param - functiondata[functioncount-1].param[functiondata[functioncount-1].paramcount-1]+=data[parsepos]; - if(data[parsepos]=='"' && data[parsepos+1]=='"') parsepos++; // ignore the next " + functiondata[functioncount - 1].param[functiondata[functioncount - 1].paramcount - 1] += data[parsepos]; + if (data[parsepos] == '"' && data[parsepos + 1] == '"') parsepos++; // ignore the next " } - } - else if(inFunction==TRUE && inParam==FALSE && inFunctionHead==FALSE) - { - if(IsCharAlphaNumeric(data[parsepos])!=0) - { - *functiondata[functioncount-1].name+=data[parsepos]; - } - else - { - inFunction=FALSE; + } else if (inFunction == TRUE && inParam == FALSE && inFunctionHead == FALSE) { + if (IsCharAlphaNumeric(data[parsepos]) != 0) { + *functiondata[functioncount - 1].name += data[parsepos]; + } else { + inFunction = FALSE; //MessageBox(0, functiondata[functioncount-1].name->data(), "FUNCTIONAME", 0); } } - else if(inFunctionHead==TRUE && inParam==FALSE) - { - if(data[parsepos]=='"') - { + else if (inFunctionHead == TRUE && inParam == FALSE) { + if (data[parsepos] == '"') { // add a param! - inParam=TRUE; - functiondata[functioncount-1].AddParam(); - functiondata[functioncount-1].param[functiondata[functioncount-1].paramcount-1]=""; + inParam = TRUE; + functiondata[functioncount - 1].AddParam(); + functiondata[functioncount - 1].param[functiondata[functioncount - 1].paramcount - 1] = ""; } - if(data[parsepos]==')') - { - inFunctionHead=FALSE; + if (data[parsepos] == ')') { + inFunctionHead = FALSE; //MessageBox(0, (char*)&data[parsepos], "", 0); } } - else if(inJumpLine==TRUE) - { - if(data[parsepos]!=':') - { + else if (inJumpLine == TRUE) { + if (data[parsepos] != ':') { char d[2]; - d[0]=data[parsepos]; - d[1]=0; + d[0] = data[parsepos]; + d[1] = 0; strcat((char*)jumplinename, d); - } - else - { - jumplinedata[jumplinename]=functioncount; + } else { + jumplinedata[jumplinename] = functioncount; //MessageBox(0,(char*)jumplinename,"",0); memset(jumplinename, 0, 512); - inJumpLine=FALSE; - inNewOrder=TRUE; + inJumpLine = FALSE; + inNewOrder = TRUE; } } - - + + } ///////////////////////// - - delete[] (data); + + delete[](data); return 0; } -int CUserScript::GetFunction(int index, CString *name, CString * params[], int* paramcount) +int CUserScript::GetFunction(int index, CString* name, CString* params[], int* paramcount) { - if(index<0 || index>=functioncount) return -1; + if (index < 0 || index >= functioncount) return -1; + + *name = *functiondata[index].name; + *paramcount = functiondata[index].paramcount; - *name=*functiondata[index].name; - *paramcount=functiondata[index].paramcount; - //if(params==NULL) return 0; - if (*paramcount>0) - { - *params=new(CString[*paramcount]); - } - else *params=0; - + if (*paramcount > 0) { + *params = new(CString[*paramcount]); + } else *params = 0; + int i; - for(i=0;i<*paramcount;i++) - { + for (i = 0; i < *paramcount; i++) { //params[i]=new(CString); - CString* str=*params; - str[i]=functiondata[index].param[i]; + CString* str = *params; + str[i] = functiondata[index].param[i]; //memcpy((void*)params[i], (void*) &functiondata[index].param[i], &function //MessageBox(0,functiondata[index].param[i].data(),"",0); } @@ -323,10 +284,10 @@ void FunctionData::AddParam() //CString* tmp=NULL; //if(paramcount>0) //{ - + //tmp=new(CString[paramcount]); //memcpy((void*)tmp, param, sizeof(CString)*paramcount); - + //delete[] (functiondata); //delete is bad-> CStrings would be deallocated! //delete[](param); //param=NULL; @@ -340,38 +301,37 @@ void FunctionData::AddParam() //param=new(CString[paramcount+1]); // //memcpy((void*) param, (void*) tmp, sizeof(CString)*paramcount); - + //name=""; - CString* newparam=new(CString[paramcount+1]); + CString* newparam = new(CString[paramcount + 1]); int i; - for(i=0;i0) { - + tmp=new(FunctionData[functioncount]); memcpy((void*)tmp, functiondata, sizeof(FunctionData)*functioncount); delete[] functiondata; @@ -388,31 +348,31 @@ int CUserScript::AllocateFunction() } functiondata=new(FunctionData[functioncount+1]); - + memcpy((void*) functiondata, (void*) tmp, sizeof(FunctionData)*functioncount); - + functiondata[functioncount].name="";*/ - functiondata=(FunctionData*)realloc(functiondata, sizeof(FunctionData)*(functioncount+1)); - + functiondata = (FunctionData*)realloc(functiondata, sizeof(FunctionData) * (functioncount + 1)); + functiondata[functioncount].Init(); - *functiondata[functioncount].name="HUHU"; + *functiondata[functioncount].name = "HUHU"; functioncount++; //delete[] (tmp); return functioncount; } -void CUserScript::RaiseErr(int n, const char *str) +void CUserScript::RaiseErr(int n, const char* str) { } void FunctionData::Init() { - paramcount=0; - param=NULL; - name=new(CString); + paramcount = 0; + param = NULL; + name = new(CString); } @@ -602,30 +562,28 @@ extern CString GetFree(const char* section); BOOL IsValSet(CString val) { val.MakeLower(); - if(val=="false" || val=="no") return FALSE; // val is not set - if(val=="true" || val=="yes") return TRUE; - if(atoi(val)) return TRUE; + if (val == "false" || val == "no") return FALSE; // val is not set + if (val == "true" || val == "yes") return TRUE; + if (atoi(val)) return TRUE; return FALSE; } int get_player_count() { - if(Map->IsMultiplayer()==FALSE) return 1; + if (Map->IsMultiplayer() == FALSE) return 1; int i; - int wp_count=0; - for(i=0;iGetWaypointCount();i++) - { + int wp_count = 0; + for (i = 0; i < Map->GetWaypointCount(); i++) { CString id; DWORD pos; Map->GetWaypointData(i, &id, &pos); int idi; - idi=atoi(id); - if(idi!=i) break; - if(idi>=0 && idi<8) - { - wp_count++; - } + idi = atoi(id); + if (idi != i) break; + if (idi >= 0 && idi < 8) { + wp_count++; + } } return wp_count; @@ -639,411 +597,298 @@ struct FUNC_INFO int paramcount; }; -void CUserScriptsDlg::OnOK() +void CUserScriptsDlg::OnOK() { UpdateData(TRUE); //srand((unsigned)time(NULL)); - if(m_Script.GetLength()==0) return; + if (m_Script.GetLength() == 0) return; CUserScript s; - s.LoadFile((CString)AppPath+(CString)"\\Scripts\\"+m_Script); + s.LoadFile((CString)AppPath + (CString)"\\Scripts\\" + m_Script); - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); - BOOL bUpdate=FALSE; - BOOL bUpdateOnlyMission=TRUE; - BOOL bNoRepos=TRUE; - BOOL bSafeMode=TRUE; + BOOL bUpdate = FALSE; + BOOL bUpdateOnlyMission = TRUE; + BOOL bNoRepos = TRUE; + BOOL bSafeMode = TRUE; map variables; char c[50]; - - CString report=m_Script+" Report:\r\n\r\n"; - BOOL bAutoUpdate=TRUE; - BOOL bAllowLoop=TRUE; // for now we enable this, as we´ve introduced a loop counter - + CString report = m_Script + " Report:\r\n\r\n"; + + BOOL bAutoUpdate = TRUE; + BOOL bAllowLoop = TRUE; // for now we enable this, as we´ve introduced a loop counter + // stuff for faster CMapData processing: - BOOL bUpdateWaypoints=FALSE; - BOOL bOldUpdate=Map->m_noAutoObjectUpdate; + BOOL bUpdateWaypoints = FALSE; + BOOL bOldUpdate = Map->m_noAutoObjectUpdate; + + BOOL bDeleteAllowed = FALSE; // shall the script be able to delete stuff? + BOOL bAddAllowed = FALSE; // " delete stuff + + - BOOL bDeleteAllowed=FALSE; // shall the script be able to delete stuff? - BOOL bAddAllowed=FALSE; // " delete stuff - - - // for delete/add stuff: - int lastInfantryDeleted=-1; - CString lastStructureDeleted=""; - int lastTerrainDeleted=-1; - CString lastUnitDeleted=""; - CString lastAircraftDeleted=""; + int lastInfantryDeleted = -1; + CString lastStructureDeleted = ""; + int lastTerrainDeleted = -1; + CString lastUnitDeleted = ""; + CString lastAircraftDeleted = ""; - BOOL bIgnoreLoopCounts=FALSE; - int loop_count=0; + BOOL bIgnoreLoopCounts = FALSE; + int loop_count = 0; map functions; // get function ids int i; - for(i=0;iGetWidth(), c, 10); - variables["%Width%"]=c; + variables["%Width%"] = c; itoa(Map->GetHeight(), c, 10); - variables["%Height%"]=c; + variables["%Height%"] = c; itoa(Map->GetIsoSize(), c, 10); - variables["%IsoSize%"]=c; + variables["%IsoSize%"] = c; itoa(Map->GetWaypointCount(), c, 10); - variables["%WaypointCount%"]=c; + variables["%WaypointCount%"] = c; itoa(Map->GetUnitCount(), c, 10); - variables["%UnitCount%"]=c; + variables["%UnitCount%"] = c; itoa(Map->GetInfantryCount(), c, 10); - variables["%InfantryCount%"]=c; + variables["%InfantryCount%"] = c; itoa(Map->GetStructureCount(), c, 10); - variables["%StructureCount%"]=c; + variables["%StructureCount%"] = c; itoa(Map->GetAircraftCount(), c, 10); - variables["%AircraftCount%"]=c; + variables["%AircraftCount%"] = c; itoa(Map->GetTerrainCount(), c, 10); - variables["%TerrainCount%"]=c; - variables["%Theater%"]=Map->GetTheater(); + variables["%TerrainCount%"] = c; + variables["%Theater%"] = Map->GetTheater(); itoa(get_player_count(), c, 10); - variables["%PlayerCount%"]=c; + variables["%PlayerCount%"] = c; itoa(Map->GetHousesCount(FALSE), c, 10); - variables["%HousesCount%"]=c; + variables["%HousesCount%"] = c; itoa(Map->GetHousesCount(TRUE), c, 10); - variables["%CountriesCount%"]=c; + variables["%CountriesCount%"] = c; - if(bDeleteAllowed) - { - variables["%DeleteAllowed%"]="1"; - } - else - variables["%DeleteAllowed%"]="0"; + if (bDeleteAllowed) { + variables["%DeleteAllowed%"] = "1"; + } else + variables["%DeleteAllowed%"] = "0"; - if(bAddAllowed) - { - variables["%AddAllowed%"]="1"; - } - else - variables["%AddAllowed%"]="0"; + if (bAddAllowed) { + variables["%AddAllowed%"] = "1"; + } else + variables["%AddAllowed%"] = "0"; - if(bSafeMode) - variables["%SafeMode%"]="1"; + if (bSafeMode) + variables["%SafeMode%"] = "1"; else - variables["%SafeMode%"]="0"; - + variables["%SafeMode%"] = "0"; + //CString name; - int name=functions[i].type; - - int paramcount=functions[i].paramcount; - - CString* params=NULL; + int name = functions[i].type; - if(paramcount) - { - params=new(CString[paramcount]); + int paramcount = functions[i].paramcount; + + CString* params = NULL; + + if (paramcount) { + params = new(CString[paramcount]); int e; - for(e=0;e::iterator e; - - - for(e=variables.begin();e!=variables.end();e++) - { - for(h=0;hfirst, e->second); } } @@ -1053,111 +898,89 @@ void CUserScriptsDlg::OnOK() delete[] replaceVariables; - if(name==ID_ASK_CONTINUE) - { - if(paramcount<1) - { + if (name == ID_ASK_CONTINUE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - int res=MessageBox(params[0], "Continue?", MB_YESNO); - if(res==IDNO) break; - } - else if(name==ID_MESSAGE) - { - if(paramcount<2) - { + int res = MessageBox(params[0], "Continue?", MB_YESNO); + if (res == IDNO) break; + } else if (name == ID_MESSAGE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } MessageBox(params[0], params[1]); - } - else if(name==ID_MESSAGE_YES_NO) - { - if(paramcount<3) - { + } else if (name == ID_MESSAGE_YES_NO) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - int res=MessageBox(params[1], params[2], MB_YESNO); - if(res==IDYES) - { - variables[params[0]]="1"; - } - else - variables[params[0]]="0"; - } - else if(name==ID_ADD_TRIGGER) - { - if(paramcount<5) - { + int res = MessageBox(params[1], params[2], MB_YESNO); + if (res == IDYES) { + variables[params[0]] = "1"; + } else + variables[params[0]] = "0"; + } else if (name == ID_ADD_TRIGGER) { + if (paramcount < 5) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>5) - { - if(params[5].GetLength()>0) - { - if(!IsValSet(params[5])) goto nextline; + if (paramcount > 5) { + if (params[5].GetLength() > 0) { + if (!IsValSet(params[5])) goto nextline; } } - if(!bAddAllowed) goto nextline; + if (!bAddAllowed) goto nextline; - - CString ID_T=GetFreeID(); - if(params[0].GetLength()>0) - { - variables[params[0]]=ID_T; - } + CString ID_T = GetFreeID(); + + if (params[0].GetLength() > 0) { + variables[params[0]] = ID_T; + } ini.SetString("Triggers", ID_T, params[1]); ini.SetString("Events", ID_T, params[2]); ini.SetString("Actions", ID_T, params[3]); - BOOL tag=TRUE; + BOOL tag = TRUE; params[4].MakeLower(); - if(params[4]=="false" || params[4]=="no") tag=FALSE; + if (params[4] == "false" || params[4] == "no") tag = FALSE; - if(tag) { - auto const ID_TAG=GetFreeID(); + if (tag) { + auto const ID_TAG = GetFreeID(); CString def = "0,"; def += GetParam(params[1], 2);; def += ","; @@ -1165,55 +988,45 @@ void CUserScriptsDlg::OnOK() ini.SetString("Tags", ID_TAG, def); } - report+="Trigger " + GetParam(params[1],2) + " added\r\n"; - - bUpdate=TRUE; - } - else if(name==ID_SET_INI_KEY) - { - if(paramcount<3) - { + report += "Trigger " + GetParam(params[1], 2) + " added\r\n"; + + bUpdate = TRUE; + } else if (name == ID_SET_INI_KEY) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - + //if(ini.sections[params[0]].FindIndex(params[1])>=0) { - if(bSafeMode) goto nextline; + if (bSafeMode) goto nextline; } ini.SetString(params[0], params[1], params[2]); - report +=params[0]+(CString)"->"+params[1]+(CString) " set to \"" + params[2] + "\"\r\n"; - - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_GET_INI_KEY) - { - if(paramcount<3) - { + report += params[0] + (CString)"->" + params[1] + (CString)" set to \"" + params[2] + "\"\r\n"; + + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_GET_INI_KEY) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } @@ -1222,954 +1035,761 @@ void CUserScriptsDlg::OnOK() } else { variables[params[0]] = ini.GetString(params[1], params[2]); } - } - else if(name==ID_SET_SAFE_MODE) - { - if(paramcount<2) - { + } else if (name == ID_SET_SAFE_MODE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - BOOL enabled=TRUE; + BOOL enabled = TRUE; params[0].MakeLower(); - if(params[0]=="false" || params[0]=="no") enabled=FALSE; + if (params[0] == "false" || params[0] == "no") enabled = FALSE; - if(!enabled) - { + if (!enabled) { CString s; - s="This script wants to disable INI protection. For some scripts this may be necessary, but it can seriously damage your Map-> Reason why script wants to disable INI protection:\n"; - s+=params[1]; - s+="\n\nDisable INI protection?"; + s = "This script wants to disable INI protection. For some scripts this may be necessary, but it can seriously damage your Map-> Reason why script wants to disable INI protection:\n"; + s += params[1]; + s += "\n\nDisable INI protection?"; - int res=MessageBox(s, "Disable INI protection?", MB_YESNO | MB_DEFBUTTON2); - if(res==IDNO) goto nextline; + int res = MessageBox(s, "Disable INI protection?", MB_YESNO | MB_DEFBUTTON2); + if (res == IDNO) goto nextline; } - if(!enabled) report+="INI Protection disabled\r\n"; - if(enabled) report+="INI Protection enabled\r\n"; + if (!enabled) report += "INI Protection disabled\r\n"; + if (enabled) report += "INI Protection enabled\r\n"; - bSafeMode=enabled; - } - else if(name==ID_SET_VARIABLE) - { - if(paramcount<2) - { + bSafeMode = enabled; + } else if (name == ID_SET_VARIABLE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - variables[params[0]]=params[1]; - } - else if(name==ID_ADD) - { - if(paramcount<2) - { + variables[params[0]] = params[1]; + } else if (name == ID_ADD) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int n; - n=atoi(variables[params[0]]); - int n2=atoi(params[1]); - n+=n2; + n = atoi(variables[params[0]]); + int n2 = atoi(params[1]); + n += n2; char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_INSERT) - { - if(paramcount<3) - { + variables[params[0]] = c; + } else if (name == ID_INSERT) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - int pos=atoi(params[2]); + int pos = atoi(params[2]); - if(pos<0) - { - pos=variables[params[0]].GetLength(); + if (pos < 0) { + pos = variables[params[0]].GetLength(); } variables[params[0]].Insert(pos, params[1]); - } - else if(name==ID_REPLACE) - { - if(paramcount<3) - { + } else if (name == ID_REPLACE) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } - } + } variables[params[0]].Replace(params[1], params[2]); - } - else if(name==ID_TRIM) - { - if(paramcount<1) - { + } else if (name == ID_TRIM) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } variables[params[0]].TrimLeft(); variables[params[0]].TrimRight(); - } - else if(name==ID_NOT) - { - if(paramcount<1) - { + } else if (name == ID_NOT) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - if(IsValSet(variables[params[0]])) - variables[params[0]]="0"; + if (IsValSet(variables[params[0]])) + variables[params[0]] = "0"; else - variables[params[0]]="1"; - } - else if(name==ID_AND) - { - if(paramcount<2) - { + variables[params[0]] = "1"; + } else if (name == ID_AND) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } - - BOOL bSet=TRUE; + + BOOL bSet = TRUE; int k; - for(k=1;k2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int len=params[1].GetLength(); + int len = params[1].GetLength(); char c[50]; itoa(len, c, 10); - variables[params[0]]=c; - } - else if(name==ID_REMOVE) - { - if(paramcount<2) - { + variables[params[0]] = c; + } else if (name == ID_REMOVE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - if(atoi(params[1])>=variables[params[0]].GetLength() || atoi(params[1])<0 || atoi(params[2])<0) - { - MessageBox("Invalid index or length for remove command, script cancelled.","Error"); + if (atoi(params[1]) >= variables[params[0]].GetLength() || atoi(params[1]) < 0 || atoi(params[2]) < 0) { + MessageBox("Invalid index or length for remove command, script cancelled.", "Error"); delete[] params; break; } - variables[params[0]].Delete(atoi(params[1]),atoi(params[2])); - } - else if(name==ID_GETCHAR) - { - if(paramcount<3) - { + variables[params[0]].Delete(atoi(params[1]), atoi(params[2])); + } else if (name == ID_GETCHAR) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - if(atoi(params[2])>=params[1].GetLength() || atoi(params[2])<0) - { - MessageBox("Invalid index for GetChar command, script cancelled.","Error"); + if (atoi(params[2]) >= params[1].GetLength() || atoi(params[2]) < 0) { + MessageBox("Invalid index for GetChar command, script cancelled.", "Error"); delete[] params; break; } - variables[params[0]]=params[1].GetAt(atoi(params[2])); - } - else if(name==ID_SUBSTRACT) - { - if(paramcount<2) - { + variables[params[0]] = params[1].GetAt(atoi(params[2])); + } else if (name == ID_SUBSTRACT) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int n; - n=atoi(variables[params[0]]); - int n2=atoi(params[1]); - n-=n2; + n = atoi(variables[params[0]]); + int n2 = atoi(params[1]); + n -= n2; char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_MULTI) - { - if(paramcount<2) - { + variables[params[0]] = c; + } else if (name == ID_MULTI) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int n; - n=atoi(variables[params[0]]); - int n2=atoi(params[1]); - n=n*n2; + n = atoi(variables[params[0]]); + int n2 = atoi(params[1]); + n = n * n2; char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_DIVIDE) - { - if(paramcount<2) - { + variables[params[0]] = c; + } else if (name == ID_DIVIDE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int n; - n=atoi(variables[params[0]]); - int n2=atoi(params[1]); + n = atoi(variables[params[0]]); + int n2 = atoi(params[1]); - if(n2==0) - { + if (n2 == 0) { MessageBox("Division through 0, script cancelled", "Division through 0"); delete[] params; break; } - n=n/n2; + n = n / n2; char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_MODULO) - { - if(paramcount<2) - { + variables[params[0]] = c; + } else if (name == ID_MODULO) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int n; - n=atoi(variables[params[0]]); - int n2=atoi(params[1]); + n = atoi(variables[params[0]]); + int n2 = atoi(params[1]); - if(n2==0) - { + if (n2 == 0) { MessageBox("Division through 0, script cancelled", "Division through 0"); delete[] params; break; } - n=n%n2; + n = n % n2; char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_SET_WAYPOINT) - { - if(paramcount<3) - { + variables[params[0]] = c; + } else if (name == ID_SET_WAYPOINT) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - int n=atoi(params[0]); - CString id=params[0]; - if(n<0) - { - id=""; + int n = atoi(params[0]); + CString id = params[0]; + if (n < 0) { + id = ""; } - if(bSafeMode && n>=0) - { - if(ini["Waypoints"].FindIndex(id)>=0) - { + if (bSafeMode && n >= 0) { + if (ini["Waypoints"].FindIndex(id) >= 0) { goto nextline; } } - DWORD pos=atoi(params[1])+atoi(params[2])*Map->GetIsoSize(); - - if(posGetIsoSize()*Map->GetIsoSize()) - { + DWORD pos = atoi(params[1]) + atoi(params[2]) * Map->GetIsoSize(); + + if (pos < Map->GetIsoSize() * Map->GetIsoSize()) { //Map->m_noAutoObjectUpdate=TRUE; Map->AddWaypoint(id, pos); - bUpdateWaypoints=TRUE; + bUpdateWaypoints = TRUE; //Map->m_noAutoObjectUpdate=bOldUpdate; - report+="Waypoint " + id + " set.\r\n"; - } - else - { - report+="Waypoint " + id + " moving failed!\r\n"; + report += "Waypoint " + id + " set.\r\n"; + } else { + report += "Waypoint " + id + " moving failed!\r\n"; } - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_REQUIRES_MP) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_REQUIRES_MP) { // check bool - if(paramcount>0) - { - if(params[0].GetLength()>0) - { - if(!IsValSet(params[0])) goto nextline; + if (paramcount > 0) { + if (params[0].GetLength() > 0) { + if (!IsValSet(params[0])) goto nextline; } } - if(Map->IsMultiplayer()==FALSE) - { + if (Map->IsMultiplayer() == FALSE) { MessageBox("This script requires a multiplayer map and cannot be used with singleplayer maps", "Error"); break; } - } - else if(name==ID_REQUIRES_SP) - { + } else if (name == ID_REQUIRES_SP) { // check bool - if(paramcount>0) - { - if(params[0].GetLength()>0) - { - if(!IsValSet(params[0])) goto nextline; + if (paramcount > 0) { + if (params[0].GetLength() > 0) { + if (!IsValSet(params[0])) goto nextline; } } - if(Map->IsMultiplayer()==TRUE) - { + if (Map->IsMultiplayer() == TRUE) { MessageBox("This script requires a singleplayer map and cannot be used with multiplayer maps", "Error"); break; } - } - else if(name==ID_ADD_AI_TRIGGER) - { - if(paramcount<2) - { + } else if (name == ID_ADD_AI_TRIGGER) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - if(!bAddAllowed) goto nextline; + if (!bAddAllowed) goto nextline; - CString ID_T=GetFreeID(); + CString ID_T = GetFreeID(); - if(params[0].GetLength()>0) - { - variables[params[0]]=ID_T; - } + if (params[0].GetLength() > 0) { + variables[params[0]] = ID_T; + } ini.SetString("AITriggerTypes", ID_T, params[1]); - report+="AI Trigger " + GetParam(params[1],0) + " added\r\n"; - - bUpdate=TRUE; - } - else if(name==ID_ADD_TAG) - { - if(paramcount<2) - { + report += "AI Trigger " + GetParam(params[1], 0) + " added\r\n"; + + bUpdate = TRUE; + } else if (name == ID_ADD_TAG) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - if(!bAddAllowed) goto nextline; - - CString ID_T=GetFreeID(); + if (!bAddAllowed) goto nextline; - if(params[0].GetLength()>0) - { - variables[params[0]]=ID_T; - } + CString ID_T = GetFreeID(); - CString ID_TAG=ID_T; //GetFreeID(); + if (params[0].GetLength() > 0) { + variables[params[0]] = ID_T; + } + + CString ID_TAG = ID_T; //GetFreeID(); ini.SetString("Tags", ID_TAG, params[1]); - report+="Tag " + GetParam(params[1],1) + " added\r\n"; - - bUpdate=TRUE; - } - else if(name==ID_RESIZE) - { - if(paramcount<4) - { + report += "Tag " + GetParam(params[1], 1) + " added\r\n"; + + bUpdate = TRUE; + } else if (name == ID_RESIZE) { + if (paramcount < 4) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>4) - { - if(params[4].GetLength()>0) - { - if(!IsValSet(params[4])) goto nextline; + if (paramcount > 4) { + if (params[4].GetLength() > 0) { + if (!IsValSet(params[4])) goto nextline; } } - int res=MessageBox("This script wants to resize the map. Resize map?", "Resize map?", MB_YESNO); - if(res==IDNO) goto nextline; + int res = MessageBox("This script wants to resize the map. Resize map?", "Resize map?", MB_YESNO); + if (res == IDNO) goto nextline; - if(atoi(params[2])>200 || atoi(params[3])>200) - { + if (atoi(params[2]) > 200 || atoi(params[3]) > 200) { MessageBox("Resizing map failed. Script cancelled.", "Error"); break; } Map->ResizeMap(atoi(params[0]), atoi(params[1]), atoi(params[2]), atoi(params[3])); - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - bNoRepos=FALSE; - } - else if(name==ID_IS) - { - if(paramcount<4) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + bNoRepos = FALSE; + } else if (name == ID_IS) { + if (paramcount < 4) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>4) - { - if(params[4].GetLength()>0) - { - if(!IsValSet(params[4])) goto nextline; + if (paramcount > 4) { + if (params[4].GetLength() > 0) { + if (!IsValSet(params[4])) goto nextline; } } - BOOL bIs=FALSE; + BOOL bIs = FALSE; - if(params[1]=="<") - { - if(atoi(params[0])=") - { - if(atoi(params[0])>=atoi(params[2])) bIs=TRUE; + if (params[1] == ">=") { + if (atoi(params[0]) >= atoi(params[2])) bIs = TRUE; } - if(params[1]==">") - { - if(atoi(params[0])>atoi(params[2])) bIs=TRUE; + if (params[1] == ">") { + if (atoi(params[0]) > atoi(params[2])) bIs = TRUE; } - if(params[1]=="!=") - { - if(atoi(params[0])!=atoi(params[2])) bIs=TRUE; - if(params[0]!=params[2]) bIs=TRUE; + if (params[1] == "!=") { + if (atoi(params[0]) != atoi(params[2])) bIs = TRUE; + if (params[0] != params[2]) bIs = TRUE; } - CString s="0"; - if(bIs) s="1"; + CString s = "0"; + if (bIs) s = "1"; - - - variables[params[3]]=s; - - } - else if(name==ID_CANCEL) - { + + + variables[params[3]] = s; + + } else if (name == ID_CANCEL) { // check bool - if(paramcount>0) - { - if(params[0].GetLength()>0) - { - if(!IsValSet(params[0])) goto nextline; + if (paramcount > 0) { + if (params[0].GetLength() > 0) { + if (!IsValSet(params[0])) goto nextline; } } break; - } - else if(name==ID_PRINT) - { - - if(paramcount<1) - { + } else if (name == ID_PRINT) { + + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - report+=params[0]; - report+="\r\n"; + report += params[0]; + report += "\r\n"; - - } - else if(name==ID_TOLOWER) - { - - if(paramcount<1) - { + + } else if (name == ID_TOLOWER) { + + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } variables[params[0]].MakeLower(); - - } - else if(name==ID_TOUPPER) - { - - if(paramcount<1) - { + + } else if (name == ID_TOUPPER) { + + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } variables[params[0]].MakeUpper(); - } - else if(name==ID_GET_FREE_WAYPOINT) - { - if(paramcount<1) - { + } else if (name == ID_GET_FREE_WAYPOINT) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - variables[params[0]]=GetFree("Waypoints"); - } - else if(name==ID_UINPUT_GET_INTEGER) - { - - if(paramcount<4) - { + variables[params[0]] = GetFree("Waypoints"); + } else if (name == ID_UINPUT_GET_INTEGER) { + + if (paramcount < 4) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>4) - { - if(params[4].GetLength()>0) - { - if(!IsValSet(params[4])) goto nextline; + if (paramcount > 4) { + if (params[4].GetLength() > 0) { + if (!IsValSet(params[4])) goto nextline; } } - BOOL ok=FALSE; - int n=0; - while(!ok) - { - CString s=InputBox(params[1], "Enter Integer"); - ok=TRUE; + BOOL ok = FALSE; + int n = 0; + while (!ok) { + CString s = InputBox(params[1], "Enter Integer"); + ok = TRUE; - if(s.GetLength()==0) ok=FALSE; + if (s.GetLength() == 0) ok = FALSE; - n=atoi(s); - if(params[2].GetLength()>0) - { - if(n 0) { + if (n < atoi(params[2])) ok = FALSE; } - if(params[3].GetLength()>0) - { - if(n>atoi(params[3])) ok=FALSE; + if (params[3].GetLength() > 0) { + if (n > atoi(params[3])) ok = FALSE; } } char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_UINPUT_GET_STRING) - { - - if(paramcount<2) - { + variables[params[0]] = c; + } else if (name == ID_UINPUT_GET_STRING) { + + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - BOOL ok=FALSE; + BOOL ok = FALSE; CString s; - while(!ok) - { - s=InputBox(params[1], "Enter String"); - ok=TRUE; + while (!ok) { + s = InputBox(params[1], "Enter String"); + ok = TRUE; - if (s.GetLength()==0) ok=FALSE; + if (s.GetLength() == 0) ok = FALSE; } - variables[params[0]]=s; - } - else if(name==ID_UINPUT_GET_HOUSE) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_UINPUT_GET_HOUSE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } CComboUInputDlg dlg; - dlg.m_type=COMBOUINPUT_HOUSES; - dlg.m_Caption=params[1]; + dlg.m_type = COMBOUINPUT_HOUSES; + dlg.m_Caption = params[1]; dlg.DoModal(); - - variables[params[0]]=dlg.m_Combo; - } - else if(name==ID_UINPUT_GET_COUNTRY) - { - if(paramcount<2) - { + + variables[params[0]] = dlg.m_Combo; + } else if (name == ID_UINPUT_GET_COUNTRY) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } CComboUInputDlg dlg; - dlg.m_type=COMBOUINPUT_COUNTRIES; - dlg.m_Caption=params[1]; + dlg.m_type = COMBOUINPUT_COUNTRIES; + dlg.m_Caption = params[1]; dlg.DoModal(); - - variables[params[0]]=dlg.m_Combo; - } - else if(name==ID_UINPUT_GET_TRIGGER) - { - if(paramcount<2) - { + + variables[params[0]] = dlg.m_Combo; + } else if (name == ID_UINPUT_GET_TRIGGER) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } CComboUInputDlg dlg; - dlg.m_type=COMBOUINPUT_TRIGGERS; - dlg.m_Caption=params[1]; + dlg.m_type = COMBOUINPUT_TRIGGERS; + dlg.m_Caption = params[1]; dlg.DoModal(); - - variables[params[0]]=dlg.m_Combo; - } - else if(name==ID_UINPUT_GET_TAG) - { - if(paramcount<2) - { + + variables[params[0]] = dlg.m_Combo; + } else if (name == ID_UINPUT_GET_TAG) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } CComboUInputDlg dlg; - dlg.m_type=COMBOUINPUT_TAGS; - dlg.m_Caption=params[1]; + dlg.m_type = COMBOUINPUT_TAGS; + dlg.m_Caption = params[1]; dlg.DoModal(); - - variables[params[0]]=dlg.m_Combo; + + variables[params[0]] = dlg.m_Combo; } /*else if(name==ID_UINPUT_GET_MANUAL) - { - if(paramcount<4) + { + if(paramcount<4) { ReportScriptError(i); delete[] params; @@ -2190,53 +1810,44 @@ void CUserScriptsDlg::OnOK() dlg.m_Caption=params[1]; dlg.bTruncateStrings=IsValSet(params[2]); - + dlg.DoModal(); - + variables[params[0]]=dlg.m_Combo; }*/ - else if(name==ID_JUMP_TO_LINE) - { - if(paramcount<1) - { + else if (name == ID_JUMP_TO_LINE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - if(!bAllowLoop) - { - int res=MessageBox("This script tries to use loops. Some scripts may require this. However, this holds the risk of infinite loops, which may cause the FinalSun/FinalAlert2 to crash. Do you want to allow looping for this script?", "Allow looping?", MB_YESNO); - if(res==IDYES) - { - bAllowLoop=TRUE; - }else - - goto nextline; // not allowed in safe mode because of possible infinte loops# + + if (!bAllowLoop) { + int res = MessageBox("This script tries to use loops. Some scripts may require this. However, this holds the risk of infinite loops, which may cause the FinalSun/FinalAlert2 to crash. Do you want to allow looping for this script?", "Allow looping?", MB_YESNO); + if (res == IDYES) { + bAllowLoop = TRUE; + } else + + goto nextline; // not allowed in safe mode because of possible infinte loops# } - if(!bIgnoreLoopCounts) - { + if (!bIgnoreLoopCounts) { loop_count++; - if(loop_count>300) - { - int res=MessageBox("This script has exceeded the 300 loops limit. Do you want to remove the loop limit (not recommended, inherits risk of infinite loops if script has bugs)? If you press no, the script will stop after another 300 loops to ask you again. If you press cancel, the script will be cancelled.", "Loop Limit exceeded", MB_YESNOCANCEL | MB_DEFBUTTON2); - if(res==IDYES) bIgnoreLoopCounts=TRUE; - if(res==IDNO) loop_count=0; - if(res==IDCANCEL) - { + if (loop_count > 300) { + int res = MessageBox("This script has exceeded the 300 loops limit. Do you want to remove the loop limit (not recommended, inherits risk of infinite loops if script has bugs)? If you press no, the script will stop after another 300 loops to ask you again. If you press cancel, the script will be cancelled.", "Loop Limit exceeded", MB_YESNOCANCEL | MB_DEFBUTTON2); + if (res == IDYES) bIgnoreLoopCounts = TRUE; + if (res == IDNO) loop_count = 0; + if (res == IDCANCEL) { delete[] params; break; } @@ -2244,1012 +1855,837 @@ void CUserScriptsDlg::OnOK() } } - - int n=s.FindJumpLine(params[0]); - if(n<0 || n>s.functioncount) - { - + + int n = s.FindJumpLine(params[0]); + if (n<0 || n>s.functioncount) { + ReportScriptError(i); delete[] params; break; } - i=n-1; // not n, as the for loop adds 1 again! + i = n - 1; // not n, as the for loop adds 1 again! goto nextline_no_update; - } - else if(name==ID_SET_AUTO_UPDATE) - { - if(paramcount<1) - { + } else if (name == ID_SET_AUTO_UPDATE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - bAutoUpdate=IsValSet(params[0]); + bAutoUpdate = IsValSet(params[0]); goto nextline; - } - else if(name==ID_GET_RANDOM) - { - if(paramcount<1) - { + } else if (name == ID_GET_RANDOM) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - int n=rand(); // 0 and 32767 - + int n = rand(); // 0 and 32767 + char c[50]; itoa(n, c, 10); - variables[params[0]]=c; - } - else if(name==ID_ADD_TERRAIN) - { - if(paramcount<3) - { + variables[params[0]] = c; + } else if (name == ID_ADD_TERRAIN) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - if(!bAddAllowed) goto nextline; + if (!bAddAllowed) goto nextline; DWORD pos; - pos=atoi(params[1])+atoi(params[2])*Map->GetIsoSize(); + pos = atoi(params[1]) + atoi(params[2]) * Map->GetIsoSize(); - if(Map->GetTerrainAt(pos)<0) - { + if (Map->GetTerrainAt(pos) < 0) { Map->AddTerrain(params[0], pos); - report+="Terrain added: " + params[0] + (CString)" at " + params[1] + (CString)"/" + params[2] + "\r\n"; + report += "Terrain added: " + params[0] + (CString)" at " + params[1] + (CString)"/" + params[2] + "\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } } #ifdef SMUDGE_SUPP - else if(name==ID_ADD_SMUDGE) - { - if(paramcount<3) - { + else if (name == ID_ADD_SMUDGE) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } DWORD pos; - pos=atoi(params[1])+atoi(params[2])*Map->GetIsoSize(); + pos = atoi(params[1]) + atoi(params[2]) * Map->GetIsoSize(); - FIELDDATA* fd=Map->GetFielddataAt(pos); - if(fd->smudge<0) - { + FIELDDATA* fd = Map->GetFielddataAt(pos); + if (fd->smudge < 0) { SMUDGE s; - s.deleted=0; - s.type=params[0]; - s.x=atoi(params[1]); - s.y=atoi(params[2]); + s.deleted = 0; + s.type = params[0]; + s.x = atoi(params[1]); + s.y = atoi(params[2]); Map->AddSmudge(&s); - report+="Smudge added: " + params[0] + (CString) " at " + params[1] + (CString)"/" + params[2] + "\r\n"; + report += "Smudge added: " + params[0] + (CString)" at " + params[1] + (CString)"/" + params[2] + "\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } } #endif - else if(name==ID_GET_WAYPOINT_POS) - { - if(paramcount<3) - { + else if (name == ID_GET_WAYPOINT_POS) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - - BOOL bFound=FALSE; + + BOOL bFound = FALSE; DWORD pos; int k; - for(k=0;kGetWaypointCount();k++) - { + for (k = 0; k < Map->GetWaypointCount(); k++) { CString id; Map->GetWaypointData(k, &id, &pos); - if(id==params[0]) - { - bFound=TRUE; + if (id == params[0]) { + bFound = TRUE; break; } } - if(!bFound) pos=0; + if (!bFound) pos = 0; - int x=pos%Map->GetIsoSize(); - int y=pos/Map->GetIsoSize(); + int x = pos % Map->GetIsoSize(); + int y = pos / Map->GetIsoSize(); char c[50]; itoa(x, c, 10); - variables[params[1]]=c; + variables[params[1]] = c; itoa(y, c, 10); - variables[params[2]]=c; - } - else if(name==ID_GET_PARAM) - { - if(paramcount<3) - { + variables[params[2]] = c; + } else if (name == ID_GET_PARAM) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - - variables[params[0]]=GetParam(params[1], atoi(params[2])); - } - else if(name==ID_SET_PARAM) - { - if(paramcount<3) - { + + variables[params[0]] = GetParam(params[1], atoi(params[2])); + } else if (name == ID_SET_PARAM) { + if (paramcount < 3) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>3) - { - if(params[3].GetLength()>0) - { - if(!IsValSet(params[3])) goto nextline; + if (paramcount > 3) { + if (params[3].GetLength() > 0) { + if (!IsValSet(params[3])) goto nextline; } } - - variables[params[0]]=SetParam(variables[params[0]], atoi(params[1]), params[2]); - } - else if(name==ID_GET_PARAM_COUNT) - { - if(paramcount<2) - { + + variables[params[0]] = SetParam(variables[params[0]], atoi(params[1]), params[2]); + } else if (name == ID_GET_PARAM_COUNT) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } int k; - int count=1; // we start at 1 param even if no , exists! - for(k=0;k1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - + { CString s; - s="This script wants to delete objects or triggers from your map. For some scripts this may be necessary, but it can seriously damage your map. Reason why script wants to delete objects:\n"; - s+=params[0]; - s+="\n\nDo you want to allow the script to do this?"; + s = "This script wants to delete objects or triggers from your map. For some scripts this may be necessary, but it can seriously damage your map. Reason why script wants to delete objects:\n"; + s += params[0]; + s += "\n\nDo you want to allow the script to do this?"; - int res=MessageBox(s, "Allow deletion of objects?", MB_YESNO | MB_DEFBUTTON2); - if(res==IDNO) goto nextline; + int res = MessageBox(s, "Allow deletion of objects?", MB_YESNO | MB_DEFBUTTON2); + if (res == IDNO) goto nextline; } - bDeleteAllowed=TRUE; - } - else if(name==ID_ALLOW_ADD) - { - if(paramcount<1) - { + bDeleteAllowed = TRUE; + } else if (name == ID_ALLOW_ADD) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - + { CString s; - s="This script wants to add objects or triggers to your map. For some scripts this may be necessary, but it can seriously damage your map. Reason why script wants to add objects:\n"; - s+=params[0]; - s+="\n\nDo you want to allow the script to do this?"; + s = "This script wants to add objects or triggers to your map. For some scripts this may be necessary, but it can seriously damage your map. Reason why script wants to add objects:\n"; + s += params[0]; + s += "\n\nDo you want to allow the script to do this?"; - int res=MessageBox(s, "Allow adding of objects?", MB_YESNO | MB_DEFBUTTON2); - if(res==IDNO) goto nextline; + int res = MessageBox(s, "Allow adding of objects?", MB_YESNO | MB_DEFBUTTON2); + if (res == IDNO) goto nextline; } - bAddAllowed=TRUE; - } - else if(name==ID_DELETE_TERRAIN) - { - if(paramcount<1) - { + bAddAllowed = TRUE; + } else if (name == ID_DELETE_TERRAIN) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - if(!bDeleteAllowed ) goto nextline; - int index=atoi(params[0]); - if(index<0 || index>=Map->GetTerrainCount()) - { - report+="Terrain deletion failed, invalid index\r\n"; + if (!bDeleteAllowed) goto nextline; + + int index = atoi(params[0]); + if (index < 0 || index >= Map->GetTerrainCount()) { + report += "Terrain deletion failed, invalid index\r\n"; goto nextline; } - lastTerrainDeleted=index; + lastTerrainDeleted = index; Map->DeleteTerrain(index); - report+="Terrain deleted\r\n"; + report += "Terrain deleted\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_DELETE_INFANTRY) - { - if(paramcount<1) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_DELETE_INFANTRY) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - if(!bDeleteAllowed ) goto nextline; - int index=atoi(params[0]); - if(index<0 || index>=Map->GetInfantryCount()) - { - report+="Infantry deletion failed, invalid index\r\n"; + if (!bDeleteAllowed) goto nextline; + + int index = atoi(params[0]); + if (index < 0 || index >= Map->GetInfantryCount()) { + report += "Infantry deletion failed, invalid index\r\n"; goto nextline; } - lastInfantryDeleted=index; + lastInfantryDeleted = index; Map->DeleteInfantry(index); - report+="Infantry deleted\r\n"; + report += "Infantry deleted\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_DELETE_STRUCTURE) - { - if(paramcount<1) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_DELETE_STRUCTURE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - if(!bDeleteAllowed ) goto nextline; - int index=atoi(params[0]); - if(index<0 || index>=Map->GetStructureCount()) - { - report+="Structure deletion failed, invalid index\r\n"; + if (!bDeleteAllowed) goto nextline; + + int index = atoi(params[0]); + if (index < 0 || index >= Map->GetStructureCount()) { + report += "Structure deletion failed, invalid index\r\n"; goto nextline; } lastStructureDeleted = ini["Structures"].Nth(index).first; Map->DeleteStructure(index); - report+="Structure deleted\r\n"; + report += "Structure deleted\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_DELETE_VEHICLE) - { - if(paramcount<1) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_DELETE_VEHICLE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - if(!bDeleteAllowed ) goto nextline; - int index=atoi(params[0]); - if(index<0 || index>=Map->GetUnitCount()) - { - report+="Vehicle deletion failed, invalid index\r\n"; + if (!bDeleteAllowed) goto nextline; + + int index = atoi(params[0]); + if (index < 0 || index >= Map->GetUnitCount()) { + report += "Vehicle deletion failed, invalid index\r\n"; goto nextline; } lastUnitDeleted = ini["Units"].Nth(index).first; Map->DeleteUnit(index); - report+="Vehicle deleted\r\n"; + report += "Vehicle deleted\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_DELETE_AIRCRAFT) - { - if(paramcount<1) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_DELETE_AIRCRAFT) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } - - - if(!bDeleteAllowed ) goto nextline; - int index=atoi(params[0]); - if(index<0 || index>=Map->GetAircraftCount()) - { - report+="Aircraft deletion failed, invalid index\r\n"; + + if (!bDeleteAllowed) goto nextline; + + int index = atoi(params[0]); + if (index < 0 || index >= Map->GetAircraftCount()) { + report += "Aircraft deletion failed, invalid index\r\n"; goto nextline; } - + lastAircraftDeleted = ini["Aircraft"].Nth(index).first; Map->DeleteAircraft(index); - report+="Aircraft deleted\r\n"; + report += "Aircraft deleted\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - else if(name==ID_IS_INFANTRY_DELETED) - { - if(paramcount<2) - { + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; + } else if (name == ID_IS_INFANTRY_DELETED) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - CString deleted="1"; - int index=atoi(params[1]); - if(index>=0 && indexGetInfantryCount()) - { + CString deleted = "1"; + int index = atoi(params[1]); + if (index >= 0 && index < Map->GetInfantryCount()) { INFANTRY id; Map->GetInfantryData(index, &id); - if(id.deleted==0) deleted="0"; + if (id.deleted == 0) deleted = "0"; } - variables[params[0]]=deleted; - } - else if(name==ID_IS_TERRAIN_DELETED) - { - if(paramcount<2) - { + variables[params[0]] = deleted; + } else if (name == ID_IS_TERRAIN_DELETED) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - CString deleted="1"; - int index=atoi(params[1]); - if(index>=0 && indexGetTerrainCount()) - { + CString deleted = "1"; + int index = atoi(params[1]); + if (index >= 0 && index < Map->GetTerrainCount()) { TERRAIN id; Map->GetTerrainData(index, &id); - if(id.deleted==0) deleted="0"; + if (id.deleted == 0) deleted = "0"; } - variables[params[0]]=deleted; - } - else if(name==ID_ADD_INFANTRY) - { - if(paramcount<1) - { + variables[params[0]] = deleted; + } else if (name == ID_ADD_INFANTRY) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } // check param count - int count=1; // we start at 1 param even if no , exists! + int count = 1; // we start at 1 param even if no , exists! int k; - for(k=0;kAddInfantry(&id, NULL, NULL, NULL, lastInfantryDeleted)==FALSE) - { - report+="AddInfantry failed\r\n"; + if (Map->AddInfantry(&id, NULL, NULL, NULL, lastInfantryDeleted) == FALSE) { + report += "AddInfantry failed\r\n"; + } else { + report += "Infantry added\r\n"; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } - else - { - report+="Infantry added\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - } - else if(name==ID_ADD_VEHICLE) - { - if(paramcount<1) - { + } else if (name == ID_ADD_VEHICLE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } // check param count - int count=1; // we start at 1 param even if no , exists! + int count = 1; // we start at 1 param even if no , exists! int k; - for(k=0;kGetUnitAt(atoi(unit.x)+atoi(unit.y)*Map->GetIsoSize())>=0) - { - report+="AddVehicle failed\r\n"; + if (Map->GetUnitAt(atoi(unit.x) + atoi(unit.y) * Map->GetIsoSize()) >= 0) { + report += "AddVehicle failed\r\n"; goto nextline; } - if(Map->AddUnit(&unit, NULL, NULL, NULL, lastUnitDeleted)==FALSE) - { - report+="AddVehicle failed\r\n"; + if (Map->AddUnit(&unit, NULL, NULL, NULL, lastUnitDeleted) == FALSE) { + report += "AddVehicle failed\r\n"; + } else { + report += "Vehicle added\r\n"; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } - else - { - report+="Vehicle added\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - } - else if(name==ID_ADD_AIRCRAFT) - { - if(paramcount<1) - { + } else if (name == ID_ADD_AIRCRAFT) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } // check param count - int count=1; // we start at 1 param even if no , exists! + int count = 1; // we start at 1 param even if no , exists! int k; - for(k=0;kGetAirAt(atoi(air.x)+atoi(air.y)*Map->GetIsoSize())>=0) - { - report+="AddAircraft failed\r\n"; + if (Map->GetAirAt(atoi(air.x) + atoi(air.y) * Map->GetIsoSize()) >= 0) { + report += "AddAircraft failed\r\n"; goto nextline; } - if(Map->AddAircraft(&air, NULL, NULL, NULL, lastAircraftDeleted)==FALSE) - { - report+="AddAircraft failed\r\n"; + if (Map->AddAircraft(&air, NULL, NULL, NULL, lastAircraftDeleted) == FALSE) { + report += "AddAircraft failed\r\n"; + } else { + report += "Aircraft added\r\n"; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } - else - { - report+="Aircraft added\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - } - else if(name==ID_ADD_STRUCTURE) - { - if(paramcount<1) - { + } else if (name == ID_ADD_STRUCTURE) { + if (paramcount < 1) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>1) - { - if(params[1].GetLength()>0) - { - if(!IsValSet(params[1])) goto nextline; + if (paramcount > 1) { + if (params[1].GetLength() > 0) { + if (!IsValSet(params[1])) goto nextline; } } // check param count - int count=1; // we start at 1 param even if no , exists! + int count = 1; // we start at 1 param even if no , exists! int k; - for(k=0;kGetStructureAt(atoi(structure.x)+atoi(structure.y)*Map->GetIsoSize())>=0) - { - report+="AddStructure failed\r\n"; + if (Map->GetStructureAt(atoi(structure.x) + atoi(structure.y) * Map->GetIsoSize()) >= 0) { + report += "AddStructure failed\r\n"; goto nextline; } - if(Map->AddStructure(&structure, NULL, NULL, NULL, lastStructureDeleted)==FALSE) - { - report+="AddStructure failed\r\n"; + if (Map->AddStructure(&structure, NULL, NULL, NULL, lastStructureDeleted) == FALSE) { + report += "AddStructure failed\r\n"; + } else { + report += "Structure added\r\n"; + bUpdate = TRUE; + bUpdateOnlyMission = FALSE; } - else - { - report+="Structure added\r\n"; - bUpdate=TRUE; - bUpdateOnlyMission=FALSE; - } - } - else if(name==ID_GET_INFANTRY) - { - if(paramcount<2) - { + } else if (name == ID_GET_INFANTRY) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); + int index = atoi(params[1]); CString s; - if(index>=0 && indexGetInfantryCount()) - { + if (index >= 0 && index < Map->GetInfantryCount()) { INFANTRY id; Map->GetInfantryINIData(index, &s); } - variables[params[0]]=s; - } - else if(name==ID_GET_AIRCRAFT) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_GET_AIRCRAFT) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); + int index = atoi(params[1]); CString s; if (index >= 0 && index < Map->GetAircraftCount()) { s = ini["Aircraft"].Nth(index).second; } - variables[params[0]]=s; - } - else if(name==ID_GET_STRUCTURE) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_GET_STRUCTURE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); + int index = atoi(params[1]); CString s; if (index >= 0 && index < Map->GetStructureCount()) { s = ini["Structures"].Nth(index).second; } - variables[params[0]]=s; - } - else if(name==ID_GET_VEHICLE) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_GET_VEHICLE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); + int index = atoi(params[1]); CString s; if (index >= 0 && index < Map->GetUnitCount()) { s = ini["Units"].Nth(index).second; } - variables[params[0]]=s; - } - else if(name==ID_GET_HOUSE) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_GET_HOUSE) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); - + int index = atoi(params[1]); + CString s; - if(index>=0 && indexGetHousesCount(FALSE)) - { - s=Map->GetHouseID(index, FALSE); + if (index >= 0 && index < Map->GetHousesCount(FALSE)) { + s = Map->GetHouseID(index, FALSE); } - variables[params[0]]=s; - } - else if(name==ID_GET_COUNTRY) - { - if(paramcount<2) - { + variables[params[0]] = s; + } else if (name == ID_GET_COUNTRY) { + if (paramcount < 2) { ReportScriptError(i); delete[] params; break; } // check bool - if(paramcount>2) - { - if(params[2].GetLength()>0) - { - if(!IsValSet(params[2])) goto nextline; + if (paramcount > 2) { + if (params[2].GetLength() > 0) { + if (!IsValSet(params[2])) goto nextline; } } - int index=atoi(params[1]); - + int index = atoi(params[1]); + CString s; - if(index>=0 && indexGetHousesCount(TRUE)) - { - s=Map->GetHouseID(index, TRUE); + if (index >= 0 && index < Map->GetHousesCount(TRUE)) { + s = Map->GetHouseID(index, TRUE); } - variables[params[0]]=s; + variables[params[0]] = s; } - - else - { + + else { ReportScriptError(i); delete[] params; break; } - -nextline: - if(bAutoUpdate) - { - m_Report=report; + + nextline: + if (bAutoUpdate) { + m_Report = report; UpdateData(FALSE); } -nextline_no_update: + nextline_no_update: + + delete[] params; - delete[] params; - } - for(i=0;iUpdateIniFile(MAPDATA_UPDATE_FROM_INI); - if(bUpdate) ((CFinalSunDlg*)theApp.GetMainWnd())->UpdateDialogs(bUpdateOnlyMission, bNoRepos); - + if (bUpdate) ((CFinalSunDlg*)theApp.GetMainWnd())->UpdateDialogs(bUpdateOnlyMission, bNoRepos); + // CDialog::OnOK(); } -BOOL CUserScriptsDlg::OnInitDialog() +BOOL CUserScriptsDlg::OnInitDialog() { CDialog::OnInitDialog(); @@ -3257,26 +2693,24 @@ BOOL CUserScriptsDlg::OnInitDialog() CFileFind ff; - CString scripts=(CString)AppPath+"\\Scripts\\*.fscript"; + CString scripts = (CString)AppPath + "\\Scripts\\*.fscript"; { - + CFileFind ff; - if(ff.FindFile(scripts)) - { - CListBox* lb=(CListBox*)GetDlgItem(IDC_SCRIPTS); - - BOOL bWorking=TRUE; - - while(bWorking) - { - bWorking=ff.FindNextFile(); - lb->AddString(ff.GetFileName()); + if (ff.FindFile(scripts)) { + CListBox* lb = (CListBox*)GetDlgItem(IDC_SCRIPTS); + + BOOL bWorking = TRUE; + + while (bWorking) { + bWorking = ff.FindNextFile(); + lb->AddString(ff.GetFileName()); } } } - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } void CUserScriptsDlg::ReportScriptError(int line) @@ -3284,5 +2718,5 @@ void CUserScriptsDlg::ReportScriptError(int line) char c[50]; itoa(line, c, 10); - MessageBox("Script error in line " + (CString)c + ". Probably wrong parameter count or unknown function call.","Error"); + MessageBox("Script error in line " + (CString)c + ". Probably wrong parameter count or unknown function call.", "Error"); } diff --git a/MissionEditor/UserScriptsDlg.h b/MissionEditor/UserScriptsDlg.h index f04f550..e81f404 100644 --- a/MissionEditor/UserScriptsDlg.h +++ b/MissionEditor/UserScriptsDlg.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_USERSCRIPTSDLG_H__6A37EE40_9653_11D5_89B3_00E07D97C331__INCLUDED_) @@ -32,7 +32,7 @@ class CUserScriptsDlg : public CDialog { -// Konstruktion + // Konstruktion public: void ReportScriptError(int line); CUserScriptsDlg(CWnd* pParent = NULL); // Standardkonstruktor @@ -48,7 +48,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CUserScriptsDlg) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Vec2.h b/MissionEditor/Vec2.h index 2876ff8..c8560c2 100644 --- a/MissionEditor/Vec2.h +++ b/MissionEditor/Vec2.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once diff --git a/MissionEditor/ViewObjects.cpp b/MissionEditor/ViewObjects.cpp index 06c4312..cc18869 100644 --- a/MissionEditor/ViewObjects.cpp +++ b/MissionEditor/ViewObjects.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // ViewObjects.cpp: Implementierungsdatei @@ -42,13 +42,13 @@ static char THIS_FILE[] = __FILE__; ///////////////////////////////////////////////////////////////////////////// // CViewObjects -const int valadded=10000; +const int valadded = 10000; IMPLEMENT_DYNCREATE(CViewObjects, CTreeView) CViewObjects::CViewObjects() { - m_ready=FALSE; + m_ready = FALSE; } @@ -104,18 +104,18 @@ void CViewObjects::Dump(CDumpContext& dc) const CString GetTheaterLanguageString(LPCSTR lpString) { - CString s=lpString; - CString t=lpString; + CString s = lpString; + CString t = lpString; - if((tiledata)==&t_tiledata) t+="TEM"; - if((tiledata)==&s_tiledata) t+="SNO"; - if((tiledata)==&u_tiledata) t+="URB"; - if((tiledata)==&un_tiledata) t+="UBN"; - if((tiledata)==&l_tiledata) t+="LUN"; - if((tiledata)==&d_tiledata) t+="DES"; + if ((tiledata) == &t_tiledata) t += "TEM"; + if ((tiledata) == &s_tiledata) t += "SNO"; + if ((tiledata) == &u_tiledata) t += "URB"; + if ((tiledata) == &un_tiledata) t += "UBN"; + if ((tiledata) == &l_tiledata) t += "LUN"; + if ((tiledata) == &d_tiledata) t += "DES"; - CString res=GetLanguageStringACP(t); - if(res.GetLength()==0) res=GetLanguageStringACP(s); + CString res = GetLanguageStringACP(t); + if (res.GetLength() == 0) res = GetLanguageStringACP(s); return res; } @@ -124,253 +124,246 @@ CString GetTheaterLanguageString(LPCSTR lpString) // Behandlungsroutinen für Nachrichten CViewObjects -void CViewObjects::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) +void CViewObjects::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) { - CIniFile& ini=Map->GetIniFile(); - + CIniFile& ini = Map->GetIniFile(); + NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; - int val=pNMTreeView->itemNew.lParam; - if(val<0){ // return; - if(val==-2) { + int val = pNMTreeView->itemNew.lParam; + if (val < 0) { // return; + if (val == -2) { AD.reset(); - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } return; } - if(valm_view.m_isoview, true)); + break; + } + case 51: + { + AD.mode = ACTIONMODE_MAPTOOL; + AD.tool.reset(new ModifyTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, true)); + break; + } + case 52: + { + AD.mode = ACTIONMODE_MAPTOOL; + AD.tool.reset(new AddTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, false)); + break; + } + case 53: + { + AD.mode = ACTIONMODE_MAPTOOL; + AD.tool.reset(new ModifyTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, false)); + break; + } + case 54: + { + AD.mode = ACTIONMODE_MAPTOOL; + AD.tool.reset(new RemoveTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview)); + break; + } + + case 61: + if (!tiledata_count) break; + AD.type = 0; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(0); + break; + + case 62: + int i; + if (!tiledata_count) { break; } - case 20: // waypoint stuff now - { - AD.mode=ACTIONMODE_WAYPOINT; - AD.type=0; + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "SandTile")) { + break; + } + } + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(i); + break; + case 63: + if (!tiledata_count) { break; } - case 21: - { - AD.mode=3; - AD.type=1; - break; + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "RoughTile")) { + break; + } } - case 22: - { - AD.mode=3; - AD.type=2; - break; - } - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - { - AD.mode=3; - AD.type=3+val-23; - break; - } - case 36: // celltag stuff - { - AD.mode=4; - AD.type=0; - break; - } - case 37: - { - AD.mode=4; - AD.type=1; - break; - } - case 38: - { - AD.mode=4; - AD.type=2; - break; - } - case 40: // node stuff - { - AD.mode=5; - AD.type=0; - break; - } - case 41: - { - AD.mode=5; - AD.type=1; - break; - } - case 42: - { - AD.mode=5; - AD.type=2; - break; - } - case 50: - { - AD.mode=ACTIONMODE_MAPTOOL; - AD.tool.reset(new AddTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, true)); - break; - } - case 51: - { - AD.mode = ACTIONMODE_MAPTOOL; - AD.tool.reset(new ModifyTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, true)); - break; - } - case 52: - { - AD.mode = ACTIONMODE_MAPTOOL; - AD.tool.reset(new AddTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, false)); - break; - } - case 53: - { - AD.mode = ACTIONMODE_MAPTOOL; - AD.tool.reset(new ModifyTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview, false)); - break; - } - case 54: - { - AD.mode=ACTIONMODE_MAPTOOL; - AD.tool.reset(new RemoveTubeTool(*Map, *((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview)); - break; + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(i); + break; + case 64: + if (!tiledata_count) break; + for (i = 0; i < (*tiledata_count); i++) + if ((*tiledata)[i].wTileSet == waterset) break; + + if (((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x < 2 || + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y < 2) { + + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.m_BrushSize = 1; + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.UpdateData(FALSE); + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = 2; + ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y = 2; } - case 61: - if(!tiledata_count) break; - AD.type=0; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(0); + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 1; // use water placement logic + AD.z_data = 0; + break; + case 65: + if (!tiledata_count) { break; - - case 62: - int i; - if (!tiledata_count) { + } + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "GreenTile")) { break; } - for (i = 0; i < (*tiledata_count); i++) { - if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "SandTile")) { - break; - } - } - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(i); + } + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(i); + break; + case 66: + if (!tiledata_count) { break; - case 63: - if (!tiledata_count) { + } + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "PaveTile")) { break; } - for (i = 0; i < (*tiledata_count); i++) { - if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "RoughTile")) { - break; - } - } - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(i); + } + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(i); + break; + case 67: + if (!tiledata_count) { break; - case 64: - if(!tiledata_count) break; - for(i=0;i<(*tiledata_count);i++) - if((*tiledata)[i].wTileSet==waterset) break; + } + for (i = 0; i < (*tiledata_count); i++) { + if ((*tiledata)[i].wTileSet == g_data.GetInteger("NewUrbanInfo", "Morphable2")) { + break; + } + } + AD.type = i; + AD.mode = ACTIONMODE_SETTILE; + AD.data = 0; + AD.z_data = 0; + HandleBrushSize(i); + break; - if(((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x<2 || - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y<2) - { - - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.m_BrushSize=1; - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.UpdateData(FALSE); - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x=2; - ((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y=2; - } - - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=1; // use water placement logic - AD.z_data=0; - break; - case 65: - if (!tiledata_count) { - break; - } - for (i = 0; i < (*tiledata_count); i++) { - if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "GreenTile")) { - break; - } - } - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(i); - break; - case 66: - if (!tiledata_count) { - break; - } - for (i = 0; i < (*tiledata_count); i++) { - if ((*tiledata)[i].wTileSet == tiles->GetInteger("General", "PaveTile")) { - break; - } - } - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(i); - break; - case 67: - if (!tiledata_count) { - break; - } - for (i = 0; i < (*tiledata_count); i++) { - if ((*tiledata)[i].wTileSet == g_data.GetInteger("NewUrbanInfo", "Morphable2")) { - break; - } - } - AD.type=i; - AD.mode=ACTIONMODE_SETTILE; - AD.data=0; - AD.z_data=0; - HandleBrushSize(i); - break; - } - } - else - { - int subpos=val%valadded; - int pos=val/valadded; + } else { + int subpos = val % valadded; + int pos = val / valadded; - AD.mode=1; - AD.type=pos; - AD.data=subpos; + AD.mode = 1; + AD.type = pos; + AD.data = subpos; - if (pos == 1) - { + if (pos == 1) { CString sec = "InfantryTypes"; - if (subpos < rules[sec].Size()) - { + if (subpos < rules[sec].Size()) { // standard unit! AD.data_s = rules[sec].Nth(subpos).second; @@ -406,22 +399,17 @@ void CViewObjects::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) } else { AD.data_s = ini[sec].Nth(subpos - rules[sec].Size()).second; } - } - else if(pos==5) { - - CString sec="TerrainTypes"; + } else if (pos == 5) { + + CString sec = "TerrainTypes"; + + if (subpos == 999) { - if(subpos==999) - { - CRTPDlg dlg; - if(dlg.DoModal()==IDOK) - { - AD.mode=ACTIONMODE_RANDOMTERRAIN; + if (dlg.DoModal() == IDOK) { + AD.mode = ACTIONMODE_RANDOMTERRAIN; } - } - else - { + } else { if (subpos < rules[sec].Size()) { // standard unit! AD.data_s = rules[sec].Nth(subpos).second; @@ -429,38 +417,28 @@ void CViewObjects::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) AD.data_s = ini[sec].Nth(subpos - rules[sec].Size()).second; } } - } - else if(pos==6) - { - if(subpos<100) - { + } else if (pos == 6) { + if (subpos < 100) { // general overlay functions! - if(subpos==1) - { - AD.data=31; - AD.data2=atoi(InputBox("Please enter the value (0-255) of the overlay. Don´t exceed this range.","Set overlay manually")); + if (subpos == 1) { + AD.data = 31; + AD.data2 = atoi(InputBox("Please enter the value (0-255) of the overlay. Don´t exceed this range.", "Set overlay manually")); + + } else if (subpos == 2) { + AD.data = 32; + AD.data2 = atoi(InputBox("Please enter the value (0-255) of the overlay-data. Don´t exceed this range.", "Set overlay manually")); } - else if(subpos==2) - { - AD.data=32; - AD.data2=atoi(InputBox("Please enter the value (0-255) of the overlay-data. Don´t exceed this range.","Set overlay manually")); - } - - } - else - { - AD.data2=subpos%100; - AD.data=subpos/100; + } else { + AD.data2 = subpos % 100; + AD.data = subpos / 100; if (AD.data >= 30) { - AD.data = 30; + AD.data = 30; AD.data2 = subpos % 1000; } } - } - else if(pos==7) - { + } else if (pos == 7) { // set owner //if(ini.find(MAPHOUSES)!=ini.end() && ini[MAPHOUSES].Size()>0) if (ini[MAPHOUSES].Size() > 0) { @@ -469,18 +447,17 @@ void CViewObjects::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) AD.data_s = rules[HOUSES].Nth(subpos).second; } - currentOwner=AD.data_s; + currentOwner = AD.data_s; } #ifdef SMUDGE_SUPP - else if(pos==8) - { - - - CString sec="SmudgeTypes"; + else if (pos == 8) { - if(subposGetIniFile(); - - tree.Select(0,TVGN_CARET ); - tree.DeleteAllItems(); - - CString sTreeRoots[15]; - sTreeRoots[0]=GetLanguageStringACP("InfantryObList"); - sTreeRoots[1]=GetLanguageStringACP("VehiclesObList"); - sTreeRoots[2]=GetLanguageStringACP("AircraftObList"); - sTreeRoots[3]=GetLanguageStringACP("StructuresObList"); - sTreeRoots[4]=GetLanguageStringACP("TerrainObList"); - sTreeRoots[5]=GetLanguageStringACP("OverlayObList"); - sTreeRoots[6]=GetLanguageStringACP("WaypointsObList"); - sTreeRoots[7]=GetLanguageStringACP("CelltagsObList"); - sTreeRoots[8]=GetLanguageStringACP("BaseNodesObList"); - sTreeRoots[9]=GetLanguageStringACP("TunnelObList"); - sTreeRoots[10]=GetLanguageStringACP("DelObjObList"); - sTreeRoots[11]=GetLanguageStringACP("ChangeOwnerObList"); - sTreeRoots[12]=GetLanguageStringACP("StartpointsObList"); - sTreeRoots[13]=GetLanguageStringACP("GroundObList"); - sTreeRoots[14]=GetLanguageStringACP("SmudgesObList"); + CTreeCtrl& tree = GetTreeCtrl(); + CIniFile& ini = Map->GetIniFile(); - int i=0; + tree.Select(0, TVGN_CARET); + tree.DeleteAllItems(); + + CString sTreeRoots[15]; + sTreeRoots[0] = GetLanguageStringACP("InfantryObList"); + sTreeRoots[1] = GetLanguageStringACP("VehiclesObList"); + sTreeRoots[2] = GetLanguageStringACP("AircraftObList"); + sTreeRoots[3] = GetLanguageStringACP("StructuresObList"); + sTreeRoots[4] = GetLanguageStringACP("TerrainObList"); + sTreeRoots[5] = GetLanguageStringACP("OverlayObList"); + sTreeRoots[6] = GetLanguageStringACP("WaypointsObList"); + sTreeRoots[7] = GetLanguageStringACP("CelltagsObList"); + sTreeRoots[8] = GetLanguageStringACP("BaseNodesObList"); + sTreeRoots[9] = GetLanguageStringACP("TunnelObList"); + sTreeRoots[10] = GetLanguageStringACP("DelObjObList"); + sTreeRoots[11] = GetLanguageStringACP("ChangeOwnerObList"); + sTreeRoots[12] = GetLanguageStringACP("StartpointsObList"); + sTreeRoots[13] = GetLanguageStringACP("GroundObList"); + sTreeRoots[14] = GetLanguageStringACP("SmudgesObList"); + + int i = 0; //TV_InsertItemW(tree.m_hWnd, L"HELLO", 5, TVI_LAST, TVI_ROOT, -2); auto const translatedNoObj = GetLanguageStringACP("NothingObList"); - HTREEITEM first=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, + HTREEITEM first = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, translatedNoObj, i, i, 0, 0, -2, TVI_ROOT, TVI_LAST); HTREEITEM rootitems[15]; // we want the change owner at the top - - if(!Map->IsMultiplayer() || !theApp.m_Options.bEasy) - rootitems[11]=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, - sTreeRoots[11], i, i, 0, 0, i, TVI_ROOT, TVI_LAST); - - for(i=0;i<10;i++) - { - BOOL bAllow=TRUE; - if(theApp.m_Options.bEasy) - { - if(i>=6 && i<=9) - bAllow=FALSE; + if (!Map->IsMultiplayer() || !theApp.m_Options.bEasy) + rootitems[11] = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, + sTreeRoots[11], i, i, 0, 0, i, TVI_ROOT, TVI_LAST); + + + for (i = 0; i < 10; i++) { + BOOL bAllow = TRUE; + if (theApp.m_Options.bEasy) { + if (i >= 6 && i <= 9) + bAllow = FALSE; } // no tunnels in ra2 mode - if (editor_mode == ra2_mode && i == 9 && !g_data.GetBool("Debug","AllowTunnels")) { + if (editor_mode == ra2_mode && i == 9 && !g_data.GetBool("Debug", "AllowTunnels")) { bAllow = FALSE; } @@ -624,197 +598,179 @@ void CViewObjects::UpdateDialog() } - rootitems[13]=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, sTreeRoots[13], 13, 13, 0, 0, 13, TVI_ROOT, first); + rootitems[13] = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, sTreeRoots[13], 13, 13, 0, 0, 13, TVI_ROOT, first); - rootitems[12]=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, - sTreeRoots[12], 12,12, 0, 0, 12, TVI_ROOT, TVI_LAST); + rootitems[12] = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, + sTreeRoots[12], 12, 12, 0, 0, 12, TVI_ROOT, TVI_LAST); - rootitems[10]=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, - sTreeRoots[10], 10, 10, 0, 0, 10, TVI_ROOT, TVI_LAST); + rootitems[10] = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, + sTreeRoots[10], 10, 10, 0, 0, 10, TVI_ROOT, TVI_LAST); #ifdef SMUDGE_SUPP - rootitems[14]=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, - sTreeRoots[14], 14, 14, 0, 0, 10, TVI_ROOT, rootitems[4]); + rootitems[14] = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, + sTreeRoots[14], 14, 14, 0, 0, 10, TVI_ROOT, rootitems[4]); #endif HTREEITEM structhouses[64]; #ifdef RA2_MODE - HTREEITEM hAllied=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Allied"), 0, 0,0,0,-1,rootitems[3], TVI_LAST); - HTREEITEM hSoviet=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Soviet"), 0, 0,0,0,-1,rootitems[3], TVI_LAST); - HTREEITEM hYuri=NULL; - if(yuri_mode) - { - hYuri=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Yuri"), 0, 0, 0, 0, -1, rootitems[3], TVI_LAST); + HTREEITEM hAllied = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Allied"), 0, 0, 0, 0, -1, rootitems[3], TVI_LAST); + HTREEITEM hSoviet = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Soviet"), 0, 0, 0, 0, -1, rootitems[3], TVI_LAST); + HTREEITEM hYuri = NULL; + if (yuri_mode) { + hYuri = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("Yuri"), 0, 0, 0, 0, -1, rootitems[3], TVI_LAST); } - for(i=0;iIsMultiplayer()) - max=1; - else - { - + if (!Map->IsMultiplayer()) + max = 1; + else { + } - for(e=0;eGetTheater()==THEATER3) - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetTheaterLanguageString("GroundPave2ObList"),0,0,0,0,67,rootitems[13], TVI_LAST); + if (Map->GetTheater() == THEATER3) + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetTheaterLanguageString("GroundPave2ObList"), 0, 0, 0, 0, 67, rootitems[13], TVI_LAST); #endif - if(!theApp.m_Options.bEasy) - { - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateCelltagObList"), 0,0,0,0, 36, rootitems[7], TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelCelltagObList"), 0,0,0,0, 37, rootitems[7], TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CelltagPropObList"), 0,0,0,0, 38, rootitems[7], TVI_LAST ); + if (!theApp.m_Options.bEasy) { + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateCelltagObList"), 0, 0, 0, 0, 36, rootitems[7], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelCelltagObList"), 0, 0, 0, 0, 37, rootitems[7], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CelltagPropObList"), 0, 0, 0, 0, 38, rootitems[7], TVI_LAST); } - if(!theApp.m_Options.bEasy) - { - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateNodeNoDelObList"), 0,0,0,0, 40, rootitems[8], TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateNodeDelObList"), 0,0,0,0, 41, rootitems[8], TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelNodeObList"), 0,0,0,0, 42, rootitems[8], TVI_LAST ); + if (!theApp.m_Options.bEasy) { + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateNodeNoDelObList"), 0, 0, 0, 0, 40, rootitems[8], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("CreateNodeDelObList"), 0, 0, 0, 0, 41, rootitems[8], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelNodeObList"), 0, 0, 0, 0, 42, rootitems[8], TVI_LAST); } - HTREEITEM deleteoverlay=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrlObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); - HTREEITEM tiberium=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("GrTibObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); + HTREEITEM deleteoverlay = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrlObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); + HTREEITEM tiberium = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("GrTibObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); //HTREEITEM bluetiberium=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BlTibObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); #ifndef RA2_MODE - HTREEITEM veinhole=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinholeObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); + HTREEITEM veinhole = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinholeObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); #endif - HTREEITEM bridges=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BridgesObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); - HTREEITEM alloverlay=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OthObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); - HTREEITEM everyoverlay=NULL; - - if(!theApp.m_Options.bEasy) - { - everyoverlay=tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("AllObList"), 0,0,0,0, -1, rootitems[5], TVI_LAST ); + HTREEITEM bridges = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BridgesObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); + HTREEITEM alloverlay = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OthObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); + HTREEITEM everyoverlay = NULL; + + if (!theApp.m_Options.bEasy) { + everyoverlay = tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("AllObList"), 0, 0, 0, 0, -1, rootitems[5], TVI_LAST); } - if(!theApp.m_Options.bEasy) - { - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OvrlManuallyObList"), 0,0,0,0, valadded*6+1, rootitems[5], TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OvrlDataManuallyObList"), 0,0,0,0, valadded*6+2, rootitems[5], TVI_LAST ); + if (!theApp.m_Options.bEasy) { + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OvrlManuallyObList"), 0, 0, 0, 0, valadded * 6 + 1, rootitems[5], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("OvrlDataManuallyObList"), 0, 0, 0, 0, valadded * 6 + 2, rootitems[5], TVI_LAST); } - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl0ObList"), 0,0,0,0, valadded*6+100+0, deleteoverlay, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl1ObList"), 0,0,0,0, valadded*6+100+1, deleteoverlay, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl2ObList"), 0,0,0,0, valadded*6+100+2, deleteoverlay, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl3ObList"), 0,0,0,0, valadded*6+100+3, deleteoverlay, TVI_LAST ); - + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl0ObList"), 0, 0, 0, 0, valadded * 6 + 100 + 0, deleteoverlay, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl1ObList"), 0, 0, 0, 0, valadded * 6 + 100 + 1, deleteoverlay, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl2ObList"), 0, 0, 0, 0, valadded * 6 + 100 + 2, deleteoverlay, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelOvrl3ObList"), 0, 0, 0, 0, valadded * 6 + 100 + 3, deleteoverlay, TVI_LAST); + //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawRanTibObList"), 0,0,0,0, valadded*6+200+0, tiberium, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawTibObList"), 0,0,0,0, valadded*6+200+10, tiberium, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawTibObList"), 0, 0, 0, 0, valadded * 6 + 200 + 10, tiberium, TVI_LAST); //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("IncTibSizeObList"), 0,0,0,0, valadded*6+200+20, tiberium, TVI_LAST ); //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DecTibSizeObList"), 0,0,0,0, valadded*6+200+21, tiberium, TVI_LAST ); - + //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawRanTibObList"), 0,0,0,0, valadded*6+300+0, bluetiberium, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawTib2ObList"), 0,0,0,0, valadded*6+300+10, tiberium, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DrawTib2ObList"), 0, 0, 0, 0, valadded * 6 + 300 + 10, tiberium, TVI_LAST); //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("IncTibSizeObList"), 0,0,0,0, valadded*6+300+20, bluetiberium, TVI_LAST ); //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DecTibSizeObList"), 0,0,0,0, valadded*6+300+21, bluetiberium, TVI_LAST ); #ifndef RA2_MODE - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinholeObList"), 0,0,0,0, valadded*6+400+0, veinhole, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinsObList"), 0,0,0,0, valadded*6+400+1, veinhole, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinholeObList"), 0, 0, 0, 0, valadded * 6 + 400 + 0, veinhole, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("VeinsObList"), 0, 0, 0, 0, valadded * 6 + 400 + 1, veinhole, TVI_LAST); #endif - if(Map->GetTheater()!=THEATER4 && Map->GetTheater()!=THEATER5) - { - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallBridgeObList"), 0,0,0,0, valadded*6+500+1, bridges, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BigBridgeObList"), 0,0,0,0, valadded*6+500+0, bridges, TVI_LAST ); - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BigTrackBridgeObList"), 0,0,0,0, valadded*6+500+2, bridges, TVI_LAST ); + if (Map->GetTheater() != THEATER4 && Map->GetTheater() != THEATER5) { + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 1, bridges, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BigBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 0, bridges, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("BigTrackBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 2, bridges, TVI_LAST); #ifdef RA2_MODE - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallConcreteBridgeObList"), 0,0,0,0, valadded*6+500+3, bridges, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallConcreteBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 3, bridges, TVI_LAST); #endif - } - else - { - if(Map->GetTheater()==THEATER5) - { - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallBridgeObList"), 0,0,0,0, valadded*6+500+1, bridges, TVI_LAST ); + } else { + if (Map->GetTheater() == THEATER5) { + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 1, bridges, TVI_LAST); #ifdef RA2_MODE - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallConcreteBridgeObList"), 0,0,0,0, valadded*6+500+3, bridges, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("SmallConcreteBridgeObList"), 0, 0, 0, 0, valadded * 6 + 500 + 3, bridges, TVI_LAST); #endif } } #ifndef RA2_MODE - if (!theApp.m_Options.bEasy && isTrue(g_data["Debug"]["AllowTunnels"])) - { + if (!theApp.m_Options.bEasy && isTrue(g_data["Debug"]["AllowTunnels"])) { tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("NewTunnelObList"), 0, 0, 0, 0, 50, rootitems[9], TVI_LAST); tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("ModifyTunnelObList"), 0, 0, 0, 0, 51, rootitems[9], TVI_LAST); - if (isTrue(g_data["Debug"]["AllowUnidirectionalTunnels"])) - { + if (isTrue(g_data["Debug"]["AllowUnidirectionalTunnels"])) { tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("NewTunnelSingleObList"), 0, 0, 0, 0, 52, rootitems[9], TVI_LAST); tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("ModifyTunnelSingleObList"), 0, 0, 0, 0, 53, rootitems[9], TVI_LAST); } tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelTunnelObList"), 0, 0, 0, 0, 54, rootitems[9], TVI_LAST); } #else - if (!theApp.m_Options.bEasy && g_data.GetBool( "Debug","AllowTunnels")) { + if (!theApp.m_Options.bEasy && g_data.GetBool("Debug", "AllowTunnels")) { tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("NewTunnelObList"), 0, 0, 0, 0, 50, rootitems[9], TVI_LAST); tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("ModifyTunnelObList"), 0, 0, 0, 0, 51, rootitems[9], TVI_LAST); if (g_data.GetBool("Debug", "AllowUnidirectionalTunnels")) { tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("NewTunnelSingleObList"), 0, 0, 0, 0, 52, rootitems[9], TVI_LAST); tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("ModifyTunnelSingleObList"), 0, 0, 0, 0, 53, rootitems[9], TVI_LAST); } - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelTunnelObList"), 0,0,0,0, 54, rootitems[9], TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("DelTunnelObList"), 0, 0, 0, 0, 54, rootitems[9], TVI_LAST); } #endif - if(!theApp.m_Options.bEasy || !Map->IsMultiplayer()) - { - if(ini[MAPHOUSES].Size()>0) { - for(i=0;iIsMultiplayer()) { + if (ini[MAPHOUSES].Size() > 0) { + for (i = 0; i < ini[MAPHOUSES].Size(); i++) { #ifdef RA2_MODE auto const& name = ini[MAPHOUSES].Nth(i).second; if (!name.CompareNoCase("nod") || !name.CompareNoCase("gdi")) { @@ -822,13 +778,11 @@ void CViewObjects::UpdateDialog() } #endif - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, TranslateHouse(name, TRUE), 0,0,0,0, valadded*7+i, rootitems[11], TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, TranslateHouse(name, TRUE), 0, 0, 0, 0, valadded * 7 + i, rootitems[11], TVI_LAST); } - } - else - { - for(i=0;i0) - { - if(ini[MAPHOUSES].FindValue("Neutral")>=0) - currentOwner="Neutral"; + if (ini[MAPHOUSES].Size() > 0) { + if (ini[MAPHOUSES].FindValue("Neutral") >= 0) + currentOwner = "Neutral"; else - currentOwner=ini[MAPHOUSES].Nth(0).second; - } - else - currentOwner="Neutral"; - + currentOwner = ini[MAPHOUSES].Nth(0).second; + } else + currentOwner = "Neutral"; + } - - for(i=0;i 0) { - + #ifdef RA2_MODE - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE - if((i>=39 && i<=60) || (i>=180 && i<=201) || i==239 || i==178 || i==167 || i==126 - || (i>=122 && i<=125) || i==1 || (i>=0x03 && i<=0x17) || (i>=0x3d && i<=0x43) - || (i>=0x4a && i<=0x65) || (i>=0xcd && i<=0xec)) - { - if(!g_data.GetBool("Debug", "DisplayAllOverlay")) { + if ((i >= 39 && i <= 60) || (i >= 180 && i <= 201) || i == 239 || i == 178 || i == 167 || i == 126 + || (i >= 122 && i <= 125) || i == 1 || (i >= 0x03 && i <= 0x17) || (i >= 0x3d && i <= 0x43) + || (i >= 0x4a && i <= 0x65) || (i >= 0xcd && i <= 0xec)) { + if (!g_data.GetBool("Debug", "DisplayAllOverlay")) { e++; continue; } @@ -913,15 +858,14 @@ void CViewObjects::UpdateDialog() val.Replace("TIB", "ORE"); #endif - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, val , 0,0,0,0, valadded*6+3000+e, everyoverlay, TVI_LAST ); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, val, 0, 0, 0, 0, valadded * 6 + 3000 + e, everyoverlay, TVI_LAST); e++; } } } - - - for(i=0;iGetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE - if(g_data["IgnoreRA2"].FindValue(unitname)>=0) continue; + if (g_data["IgnoreRA2"].FindValue(unitname) >= 0) continue; #else - if(g_data["IgnoreTS"].FindValue(unitname) >= 0) continue; + if (g_data["IgnoreTS"].FindValue(unitname) >= 0) continue; #endif - WCHAR* addedString=Map->GetUnitName(unitname); - if(!addedString) continue; + WCHAR* addedString = Map->GetUnitName(unitname); + if (!addedString) continue; //addedString=TranslateStringACP(addedString); //addedString+=" ("; //addedString+=unitname+")"; - TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[0], valadded*1+i); - + TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[0], valadded * 1 + i); + //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, addedString, 0,0,0,0, valadded*1+i, rootitems[0], TVI_LAST ); } // okay, now the user-defined types: @@ -973,35 +917,34 @@ void CViewObjects::UpdateDialog() } } - CString theater=Map->GetTheater(); + CString theater = Map->GetTheater(); - - auto needed_terrain=TheaterChar::None; + + auto needed_terrain = TheaterChar::None; if (tiledata == &s_tiledata) { needed_terrain = TheaterChar::A; } else if (tiledata == &t_tiledata) { needed_terrain = TheaterChar::T; } auto const& bldTypeSec = rules["BuildingTypes"]; - for(i=0;i< bldTypeSec.Size();i++) - { - + for (i = 0; i < bldTypeSec.Size(); i++) { + auto const& unitname = bldTypeSec.Nth(i).second; if (unitname.IsEmpty()) { continue; } - + #ifdef RA2_MODE - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE @@ -1013,27 +956,27 @@ void CViewObjects::UpdateDialog() continue; } - WCHAR* addedString=Map->GetUnitName(unitname); + WCHAR* addedString = Map->GetUnitName(unitname); if (!addedString) { continue; } - CString owner=rules[unitname]["Owner"]; - int baseplanningside=-1; + CString owner = rules[unitname]["Owner"]; + int baseplanningside = -1; #ifdef RA2_MODE - baseplanningside=-1; + baseplanningside = -1; #endif baseplanningside = rules.GetInteger(unitname, "AIBasePlanningSide", baseplanningside); baseplanningside = g_data.GetInteger(unitname, "AIBasePlanningSide", baseplanningside); - int id=Map->GetBuildingID(unitname); - if(id<0 /*|| (buildinginfo[id].pic[0].bTerrain!=0 && buildinginfo[id].pic[0].bTerrain!=needed_terrain)*/) + int id = Map->GetBuildingID(unitname); + if (id < 0 /*|| (buildinginfo[id].pic[0].bTerrain!=0 && buildinginfo[id].pic[0].bTerrain!=needed_terrain)*/) continue; - if(theater==THEATER0 && !buildinginfo[id].bTemp) { /*MessageBox("Ignored", unitname,0);*/ continue;} - if(theater==THEATER1 && !buildinginfo[id].bSnow) { /*MessageBox("Ignored", unitname,0);*/ continue;} - if(theater==THEATER2 && !buildinginfo[id].bUrban) { /*MessageBox("Ignored", unitname,0);*/ continue;} + if (theater == THEATER0 && !buildinginfo[id].bTemp) { /*MessageBox("Ignored", unitname,0);*/ continue; } + if (theater == THEATER1 && !buildinginfo[id].bSnow) { /*MessageBox("Ignored", unitname,0);*/ continue; } + if (theater == THEATER2 && !buildinginfo[id].bUrban) { /*MessageBox("Ignored", unitname,0);*/ continue; } // check if mapfile contains other value for owner owner = ini.GetStringOr(unitname, "Owner", owner); @@ -1043,38 +986,35 @@ void CViewObjects::UpdateDialog() //addedString+=" ("; //addedString+=unitname+")"; - BOOL addedfor[3]={FALSE,FALSE,FALSE}; + BOOL addedfor[3] = { FALSE,FALSE,FALSE }; // MW fixed below for YR... uhhh... int e; - BOOL bAdded=FALSE; - for(e=0;eGetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE @@ -1165,16 +1096,16 @@ void CViewObjects::UpdateDialog() if (g_data["IgnoreTS"].FindValue(unitname) >= 0) continue; #endif - WCHAR* addedString=Map->GetUnitName(unitname); - if(!addedString) continue; + WCHAR* addedString = Map->GetUnitName(unitname); + if (!addedString) continue; //addedString=TranslateStringACP(addedString); //addedString+=" ("; //addedString+=unitname+")"; - TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[2], valadded*3+i); - + TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[2], valadded * 3 + i); + //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, addedString, 0,0,0,0, valadded*3+i, rootitems[2], TVI_LAST ); } @@ -1194,41 +1125,41 @@ void CViewObjects::UpdateDialog() } } - + auto const& vehTypeSec = rules["VehicleTypes"]; - for(i=0;i< vehTypeSec.Size();i++) { + for (i = 0; i < vehTypeSec.Size(); i++) { auto const& unitname = vehTypeSec.Nth(i).second; if (unitname.GetLength() == 0) { continue; } #ifdef RA2_MODE - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif - + #ifdef RA2_MODE if (g_data["IgnoreRA2"].FindValue(unitname) >= 0) continue; #else if (g_data["IgnoreTS"].FindValue(unitname) >= 0) continue; #endif - WCHAR* addedString=Map->GetUnitName(unitname); - if(!addedString) continue; + WCHAR* addedString = Map->GetUnitName(unitname); + if (!addedString) continue; //addedString=TranslateStringACP(addedString); //addedString+=" ("; //addedString+=unitname+")"; - TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[1], valadded*4+i); - + TV_InsertItemW(tree.m_hWnd, addedString, wcslen(addedString), TVI_LAST, rootitems[1], valadded * 4 + i); + //tree.InsertItem(TVIF_PARAM | TVIF_TEXT, addedString, 0,0,0,0, valadded*4+i, rootitems[1], TVI_LAST ); } // okay, now the user-defined types: @@ -1247,35 +1178,35 @@ void CViewObjects::UpdateDialog() } - #ifdef RA2_MODE - HTREEITEM hTrees=tree.InsertItem(GetLanguageStringACP("TreesObList"), rootitems[4], TVI_LAST); - HTREEITEM hTL=tree.InsertItem(GetLanguageStringACP("TrafficLightsObList"), rootitems[4], TVI_LAST); - HTREEITEM hSigns=tree.InsertItem(GetLanguageStringACP("SignsObList"), rootitems[4], TVI_LAST); - HTREEITEM hLightPosts=tree.InsertItem(GetLanguageStringACP("LightPostsObList"), rootitems[4], TVI_LAST); - #endif - +#ifdef RA2_MODE + HTREEITEM hTrees = tree.InsertItem(GetLanguageStringACP("TreesObList"), rootitems[4], TVI_LAST); + HTREEITEM hTL = tree.InsertItem(GetLanguageStringACP("TrafficLightsObList"), rootitems[4], TVI_LAST); + HTREEITEM hSigns = tree.InsertItem(GetLanguageStringACP("SignsObList"), rootitems[4], TVI_LAST); + HTREEITEM hLightPosts = tree.InsertItem(GetLanguageStringACP("LightPostsObList"), rootitems[4], TVI_LAST); +#endif + // random tree placer #ifdef RA2_MODE - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("RndTreeObList"), 0,0,0,0, valadded*5+999, hTrees, TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("RndTreeObList"), 0, 0, 0, 0, valadded * 5 + 999, hTrees, TVI_LAST); #else - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("RndTreeObList"), 0,0,0,0, valadded*5+999, rootitems[4], TVI_LAST); + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, GetLanguageStringACP("RndTreeObList"), 0, 0, 0, 0, valadded * 5 + 999, rootitems[4], TVI_LAST); #endif auto const& terrainTypeSec = rules["TerrainTypes"]; for (i = 0; i < terrainTypeSec.Size(); i++) { auto const& unitname = terrainTypeSec.Nth(i).second; - CString addedString=Map->GetUnitName(unitname); + CString addedString = Map->GetUnitName(unitname); #ifdef RA2_MODE - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE @@ -1288,54 +1219,53 @@ void CViewObjects::UpdateDialog() #else if (g_data["IgnoreTerrainTS"].FindValue(unitname) >= 0) continue; #endif - - addedString=TranslateStringACP(addedString); - - UINT flags=MF_STRING; - - HTREEITEM howner=rootitems[4]; - #ifdef RA2_MODE - if(unitname.Find("SIGN")>=0) howner=hSigns; - if(unitname.Find("TRFF")>=0) howner=hTL; - if(unitname.Find("TREE")>=0) howner=hTrees; - if(unitname.Find("LT")>=0) howner=hLightPosts; - #endif - + addedString = TranslateStringACP(addedString); + + UINT flags = MF_STRING; + + HTREEITEM howner = rootitems[4]; + #ifdef RA2_MODE - if(howner==hTrees) - { - int TreeMin=atoi(g_data[Map->GetTheater()+"Limits"]["TreeMin"]); - int TreeMax=atoi(g_data[Map->GetTheater()+"Limits"]["TreeMax"]); - - CString id=unitname; - id.Delete(0, 4); - int n=atoi(id); + if (unitname.Find("SIGN") >= 0) howner = hSigns; + if (unitname.Find("TRFF") >= 0) howner = hTL; + if (unitname.Find("TREE") >= 0) howner = hTrees; + if (unitname.Find("LT") >= 0) howner = hLightPosts; +#endif - if(nTreeMax) continue; +#ifdef RA2_MODE + if (howner == hTrees) { + int TreeMin = atoi(g_data[Map->GetTheater() + "Limits"]["TreeMin"]); + int TreeMax = atoi(g_data[Map->GetTheater() + "Limits"]["TreeMax"]); + + CString id = unitname; + id.Delete(0, 4); + int n = atoi(id); + + if (nTreeMax) continue; } #endif - if(unitname.GetLength()>0 && unitname!="VEINTREE" && unitname.Find("ICE")<0 && unitname.Find("BOXES")<0 && unitname.Find("SPKR")<0) // out with it :-) - tree.InsertItem(TVIF_PARAM | TVIF_TEXT, (addedString+ " (" + unitname +")"), 0,0,0,0, valadded*5+i, howner, TVI_LAST ); + if (unitname.GetLength() > 0 && unitname != "VEINTREE" && unitname.Find("ICE") < 0 && unitname.Find("BOXES") < 0 && unitname.Find("SPKR") < 0) // out with it :-) + tree.InsertItem(TVIF_PARAM | TVIF_TEXT, (addedString + " (" + unitname + ")"), 0, 0, 0, 0, valadded * 5 + i, howner, TVI_LAST); } #ifdef SMUDGE_SUPP auto const& smudgeTypeSec = rules["TerrainTypes"]; for (i = 0; i < smudgeTypeSec.Size(); i++) { auto const& unitname = smudgeTypeSec.Nth(i).second; - CString addedString=unitname; + CString addedString = unitname; #ifdef RA2_MODE - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER2 && g_data["IgnoreUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER3 && g_data["IgnoreNewUrbanRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER4 && g_data["IgnoreLunarRA2"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER5 && g_data["IgnoreDesertRA2"].FindValue(unitname) >= 0) continue; #else - if (Map->GetTheater()==THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; - if (Map->GetTheater()==THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER0 && g_data["IgnoreTemperateTS"].FindValue(unitname) >= 0) continue; + if (Map->GetTheater() == THEATER1 && g_data["IgnoreSnowTS"].FindValue(unitname) >= 0) continue; #endif #ifdef RA2_MODE @@ -1343,57 +1273,57 @@ void CViewObjects::UpdateDialog() #else if (g_data["IgnoreTS"].FindValue(unitname) >= 0) continue; #endif - - addedString=TranslateStringACP(addedString); - - UINT flags=MF_STRING; - - HTREEITEM howner=rootitems[14]; - + addedString = TranslateStringACP(addedString); + + UINT flags = MF_STRING; + + HTREEITEM howner = rootitems[14]; + + if (unitname.GetLength() > 0) { tree.InsertItem(TVIF_PARAM | TVIF_TEXT, unitname, 0, 0, 0, 0, valadded * 8 + i, howner, TVI_LAST); } } #endif - + OutputDebugString("Objectbrowser redraw finished\n"); - + } -int CViewObjects::OnCreate(LPCREATESTRUCT lpCreateStruct) +int CViewObjects::OnCreate(LPCREATESTRUCT lpCreateStruct) { - lpCreateStruct->style|=TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS; + lpCreateStruct->style |= TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SHOWSELALWAYS; if (CTreeView::OnCreate(lpCreateStruct) == -1) return -1; - - + + return 0; } -void CViewObjects::OnInitialUpdate() +void CViewObjects::OnInitialUpdate() { CTreeView::OnInitialUpdate(); - - - m_ready=TRUE; + + + m_ready = TRUE; } -void CViewObjects::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult) +void CViewObjects::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult) { TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR; // TODO: Code für die Behandlungsroutine der Steuerelement-Benachrichtigung hier einfügen - + *pResult = 0; } -void CViewObjects::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CViewObjects::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen - + // CTreeView::OnKeyDown(nChar, nRepCnt, nFlags); } diff --git a/MissionEditor/ViewObjects.h b/MissionEditor/ViewObjects.h index f48c04b..b4019ca 100644 --- a/MissionEditor/ViewObjects.h +++ b/MissionEditor/ViewObjects.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_VIEWOBJECTS_H__360F4320_9B82_11D3_B63B_EC44EDA1D441__INCLUDED_) @@ -71,21 +71,21 @@ protected: CViewObjects(); // Dynamische Erstellung verwendet geschützten Konstruktor DECLARE_DYNCREATE(CViewObjects) -// Attribute + // Attribute public: -// Operationen + // Operationen public: CTreeCtrl* tree; BOOL m_ready; void UpdateDialog(); -// Überschreibungen - // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen - //{{AFX_VIRTUAL(CViewObjects) - public: + // Überschreibungen + // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen + //{{AFX_VIRTUAL(CViewObjects) +public: virtual void OnInitialUpdate(); - protected: +protected: virtual void OnDraw(CDC* pDC); // Überschrieben zum Zeichnen dieser Ansicht //}}AFX_VIRTUAL diff --git a/MissionEditor/WaypointID.cpp b/MissionEditor/WaypointID.cpp index 4496e89..3fe365d 100644 --- a/MissionEditor/WaypointID.cpp +++ b/MissionEditor/WaypointID.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // WaypointID.cpp: Implementierungsdatei @@ -64,15 +64,14 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CWaypointID -void CWaypointID::OnFree() +void CWaypointID::OnFree() { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int i; CString freen; - for (i = 0; i > -1; i++) - { + for (i = 0; i > -1; i++) { char d[50]; itoa(i, d, 10); if (ini.GetString("Waypoints", d).IsEmpty()) { @@ -84,26 +83,25 @@ void CWaypointID::OnFree() m_id.SetWindowText(freen); } -void CWaypointID::OnOK() +void CWaypointID::OnOK() { CString h; m_id.GetWindowText(h); - if(h.GetLength()<1) - { + if (h.GetLength() < 1) { return; } - - m_value=atoi(h); + + m_value = atoi(h); CDialog::OnOK(); } -BOOL CWaypointID::OnInitDialog() +BOOL CWaypointID::OnInitDialog() { CDialog::OnInitDialog(); - + OnFree(); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/WaypointID.h b/MissionEditor/WaypointID.h index 11f023a..79011ff 100644 --- a/MissionEditor/WaypointID.h +++ b/MissionEditor/WaypointID.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_WAYPOINTID_H__7F75C740_89FE_11D3_B63B_F82C84AD2A41__INCLUDED_) @@ -32,7 +32,7 @@ class CWaypointID : public CDialog { -// Konstruktion + // Konstruktion public: int m_value; CWaypointID(CWnd* pParent = NULL); // Standardkonstruktor @@ -47,7 +47,7 @@ public: // Überschreibungen // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CWaypointID) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/Waypoints.cpp b/MissionEditor/Waypoints.cpp index ef9a014..5ff2775 100644 --- a/MissionEditor/Waypoints.cpp +++ b/MissionEditor/Waypoints.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // Waypoints.cpp: Implementierungsdatei @@ -76,38 +76,37 @@ void CWaypoints::UpdateDialog() m_Waypoints.SetRedraw(FALSE); // first clear the list - while(m_Waypoints.DeleteString(0)!=LB_ERR); + while (m_Waypoints.DeleteString(0) != LB_ERR); // okay add all trees int i; - CIniFileSection& sec=ini.sections["Waypoints"]; - + CIniFileSection& sec = ini.sections["Waypoints"]; + char c[50]; - for(i=0;idata(); + str = sec.GetValueName(i)->data(); - - str+=", "; - str+=sec.GetValue(i)->data(); - int x,y,z; + str += ", "; + str += sec.GetValue(i)->data(); + + int x, y, z; GetXYPos((char*)sec.GetValue(i)->data(), &x, &y); - - itoa(x, c,10); - str+=", "; - str+=c; - itoa(y, c,10); - str+="/"; - str+=c; - - z=GetPos(x, y, 0); + + itoa(x, c, 10); + str += ", "; + str += c; + itoa(y, c, 10); + str += "/"; + str += c; + + z = GetPos(x, y, 0); itoa(z, c, 10); - str+="/"; - str+=c; + str += "/"; + str += c; /*int pos=atoi(str); @@ -122,7 +121,7 @@ void CWaypoints::UpdateDialog() itoa(y, c, 10); str+=c; str+=")";*/ - + m_Waypoints.InsertString(-1, str); } @@ -131,69 +130,69 @@ void CWaypoints::UpdateDialog() } -void CWaypoints::OnSelchangeWaypoints() +void CWaypoints::OnSelchangeWaypoints() { - int i=m_Waypoints.GetCurSel(); - if(i==-1) return; + int i = m_Waypoints.GetCurSel(); + if (i == -1) return; CString str; m_Waypoints.GetText(i, str); - str.SetAt(str.Find(",",0), 0); + str.SetAt(str.Find(",", 0), 0); // ok str now specifies the waypoint id m_Pos.SetWindowText(ini.sections["Waypoints"].values[(char*)(LPCTSTR)str].data()); } -void CWaypoints::OnKillfocusPos() +void CWaypoints::OnKillfocusPos() { - int i=m_Waypoints.GetCurSel(); - if(i==-1) return; + int i = m_Waypoints.GetCurSel(); + if (i == -1) return; CString str; m_Waypoints.GetText(i, str); - str.SetAt(str.Find(",",0), 0); + str.SetAt(str.Find(",", 0), 0); // ok str now specifies the waypoint id - ini.sections["Waypoints"].values[(char*)(LPCTSTR)str]=GetText(&m_Pos); + ini.sections["Waypoints"].values[(char*)(LPCTSTR)str] = GetText(&m_Pos); UpdateDialog(); m_Waypoints.SetCurSel(i); } -void CWaypoints::OnKillFocus(CWnd* pNewWnd) +void CWaypoints::OnKillFocus(CWnd* pNewWnd) { CPropertyPage::OnKillFocus(pNewWnd); - - + + } -void CWaypoints::OnShowWindow(BOOL bShow, UINT nStatus) +void CWaypoints::OnShowWindow(BOOL bShow, UINT nStatus) { CPropertyPage::OnShowWindow(bShow, nStatus); - - OnKillfocusPos(); + + OnKillfocusPos(); } -void CWaypoints::OnDelete() +void CWaypoints::OnDelete() { - int pos=m_Waypoints.GetCurSel(); - if(pos==-1) return; - + int pos = m_Waypoints.GetCurSel(); + if (pos == -1) return; + CString cuwayp; //m_TreeList.GetText(pos, cutree); - cuwayp=ini.sections["Waypoints"].GetValueName(pos)->data(); + cuwayp = ini.sections["Waypoints"].GetValueName(pos)->data(); - ini.sections["Waypoints"].values.erase((string)(char*)(LPCTSTR) cuwayp); + ini.sections["Waypoints"].values.erase((string)(char*)(LPCTSTR)cuwayp); m_Waypoints.SetRedraw(FALSE); UpdateDialog(); m_Waypoints.SetCurSel(pos); - m_Waypoints.SetRedraw(TRUE); + m_Waypoints.SetRedraw(TRUE); } -BOOL CWaypoints::OnInitDialog() +BOOL CWaypoints::OnInitDialog() { CPropertyPage::OnInitDialog(); CBitmap m; @@ -201,5 +200,5 @@ BOOL CWaypoints::OnInitDialog() m_dbg.SetBitmap(m); return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben + // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } diff --git a/MissionEditor/Waypoints.h b/MissionEditor/Waypoints.h index ab438a0..34810e3 100644 --- a/MissionEditor/Waypoints.h +++ b/MissionEditor/Waypoints.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #if !defined(AFX_WAYPOINTS_H__B0ED0400_7374_11D3_99E1_BB3FC259EC06__INCLUDED_) @@ -34,14 +34,14 @@ class CWaypoints : public CPropertyPage { DECLARE_DYNCREATE(CWaypoints) -// Konstruktion + // Konstruktion public: void UpdateDialog(); CWaypoints(); ~CWaypoints(); -// Dialogfelddaten - //{{AFX_DATA(CWaypoints) + // Dialogfelddaten + //{{AFX_DATA(CWaypoints) enum { IDD = IDD_WAYPOINTS }; CStatic m_dbg; CListBox m_Waypoints; @@ -52,7 +52,7 @@ public: // Überschreibungen // Der Klassen-Assistent generiert virtuelle Funktionsüberschreibungen //{{AFX_VIRTUAL(CWaypoints) - protected: +protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung //}}AFX_VIRTUAL diff --git a/MissionEditor/constants.cpp b/MissionEditor/constants.cpp index 76c60e9..ae2131f 100644 --- a/MissionEditor/constants.cpp +++ b/MissionEditor/constants.cpp @@ -1,19 +1,19 @@ /* - 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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ diff --git a/MissionEditor/functions.cpp b/MissionEditor/functions.cpp index 40bb6e7..aa5f21f 100644 --- a/MissionEditor/functions.cpp +++ b/MissionEditor/functions.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // standard functions @@ -58,15 +58,13 @@ std::wstring utf8ToUtf16(const std::string& utf8) // unterminatedCountWChars will be the count of WChars NOT including the terminating zero (due to passing in utf8.size() instead of -1) auto utf8Count = utf8.size(); auto unterminatedCountWChars = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, nullptr, 0); - if (unterminatedCountWChars == 0) - { + if (unterminatedCountWChars == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } std::wstring utf16; utf16.resize(unterminatedCountWChars); - if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, utf16.data(), unterminatedCountWChars) == 0) - { + if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, utf16.data(), unterminatedCountWChars) == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } return utf16; @@ -82,15 +80,13 @@ std::wstring utf8ToUtf16(const char* utf8) // unterminatedCountWChars will be the count of WChars NOT including the terminating zero (due to passing in utf8.size() instead of -1) auto unterminatedCountWChars = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8, utf8Count, nullptr, 0); - if (unterminatedCountWChars == 0) - { + if (unterminatedCountWChars == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } std::wstring utf16; utf16.resize(unterminatedCountWChars); - if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8, utf8Count, utf16.data(), unterminatedCountWChars) == 0) - { + if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8, utf8Count, utf16.data(), unterminatedCountWChars) == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } return utf16; @@ -106,15 +102,13 @@ std::string utf16ToCP(const std::wstring& utf16, int CP) // unterminatedCountWChars will be the count of WChars NOT including the terminating zero (due to passing in utf8.size() instead of -1) auto utf16Count = utf16.size(); auto unterminatedCountChars = WideCharToMultiByte(CP, CP == CP_UTF8 ? WC_ERR_INVALID_CHARS : 0, utf16.data(), utf16Count, nullptr, 0, nullptr, nullptr); - if (unterminatedCountChars == 0) - { + if (unterminatedCountChars == 0) { throw std::runtime_error(CP == CP_UTF8 ? "UTF16 -> UTF8 conversion failed" : "UTF16 -> MultiByte conversion failed"); } std::string cps; cps.resize(unterminatedCountChars); - if (WideCharToMultiByte(CP, CP == CP_UTF8 ? WC_ERR_INVALID_CHARS : 0, utf16.data(), utf16Count, cps.data(), unterminatedCountChars, nullptr, nullptr) == 0) - { + if (WideCharToMultiByte(CP, CP == CP_UTF8 ? WC_ERR_INVALID_CHARS : 0, utf16.data(), utf16Count, cps.data(), unterminatedCountChars, nullptr, nullptr) == 0) { throw std::runtime_error(CP == CP_UTF8 ? "UTF16 -> UTF8 conversion failed" : "UTF16 -> MultiByte conversion failed"); } return cps; @@ -131,14 +125,14 @@ std::string utf16ToACP(const std::wstring& utf16) } // strcpy for overlapping strings -char *strcpy_safe( char *strDestination, const char *strSource ) +char* strcpy_safe(char* strDestination, const char* strSource) { /*char* buffer=new(char[strlen(strSource)+1]); strcpy(buffer, strSource); strcpy(strDestination, buffer);*/ - int len=strlen(strSource)+1; + int len = strlen(strSource) + 1; memmove(strDestination, strSource, len); return strDestination; @@ -147,13 +141,13 @@ char *strcpy_safe( char *strDestination, const char *strSource ) CString TranslateHouse(CString original, BOOL bToUI) { #ifdef RA2_MODE - if(bToUI) { + if (bToUI) { // CCStrings[*rules.sections[HOUSES].GetValue(i)].wString - for(auto const& pair : rules.GetSection(HOUSES)) { + for (auto const& pair : rules.GetSection(HOUSES)) { original.Replace(pair.second, CCStrings[pair.second].cString); } } else { - for(auto const& pair : rules.GetSection(HOUSES)) { + for (auto const& pair : rules.GetSection(HOUSES)) { original.Replace(CCStrings[pair.second].cString, pair.second); } } @@ -170,14 +164,14 @@ bool deleteFile(const std::string& u8FilePath) // set the status bar text in the main dialog void SetMainStatusBar(const char* text) { - CFinalSunDlg* dlg=(CFinalSunDlg*)theApp.GetMainWnd(); + CFinalSunDlg* dlg = (CFinalSunDlg*)theApp.GetMainWnd(); dlg->SetText(text); } // set the status bar text in the main dialog to ready void SetMainStatusBarReady() { - CFinalSunDlg* dlg=(CFinalSunDlg*)theApp.GetMainWnd(); + CFinalSunDlg* dlg = (CFinalSunDlg*)theApp.GetMainWnd(); dlg->SetReady();; } @@ -210,44 +204,40 @@ bool RepairTrigger(CString& triggerdata) // make some UI noise void Sound(int ID) { - if(theApp.m_Options.bNoSounds) return; + if (theApp.m_Options.bNoSounds) return; - if(ID==SOUND_NONE) return; - - LPCSTR lpSound=NULL; + if (ID == SOUND_NONE) return; - if(ID==SOUND_POSITIVE) - { - lpSound=MAKEINTRESOURCE(IDR_WAVE1); - } - else if(ID==SOUND_NEGATIVE) - lpSound=MAKEINTRESOURCE(IDR_WAVE2); - else if(ID==SOUND_LAYDOWNTILE) - lpSound=MAKEINTRESOURCE(IDR_WAVE3); + LPCSTR lpSound = NULL; + + if (ID == SOUND_POSITIVE) { + lpSound = MAKEINTRESOURCE(IDR_WAVE1); + } else if (ID == SOUND_NEGATIVE) + lpSound = MAKEINTRESOURCE(IDR_WAVE2); + else if (ID == SOUND_LAYDOWNTILE) + lpSound = MAKEINTRESOURCE(IDR_WAVE3); - if(lpSound) - { + if (lpSound) { PlaySound(lpSound, GetModuleHandle(NULL), SND_ASYNC | SND_RESOURCE); } } -void HandleParamList(CComboBox &cb, int type) +void HandleParamList(CComboBox& cb, int type) { CString oldText; cb.GetWindowText(oldText); - - switch(type) - { - case PARAMTYPE_NOTHING: - { - while(cb.DeleteString(0)!=CB_ERR); - cb.SetWindowText(oldText); - - //cb.AddString("0"); - } - break; + switch (type) { + case PARAMTYPE_NOTHING: + { + while (cb.DeleteString(0) != CB_ERR); + cb.SetWindowText(oldText); + + + //cb.AddString("0"); + } + break; case PARAMTYPE_HOUSES: ListHouses(cb, TRUE, TRUE, TRUE); break; @@ -332,29 +322,28 @@ void ShowOptionsDialog() CString app = "FinalSun"; #endif - std::string iniFile=""; + std::string iniFile = ""; CIniFile optini; - iniFile=u8AppDataPath; + iniFile = u8AppDataPath; #ifndef RA2_MODE - iniFile+="\\FinalSun.ini"; + iniFile += "\\FinalSun.ini"; #else - iniFile+="\\FinalAlert.ini"; + iniFile += "\\FinalAlert.ini"; #endif optini.LoadFile(iniFile); CTSOptions opt; - opt.m_TSEXE=theApp.m_Options.TSExe; - if(opt.DoModal()==IDCANCEL) return; - theApp.m_Options.TSExe=opt.m_TSEXE; + opt.m_TSEXE = theApp.m_Options.TSExe; + if (opt.DoModal() == IDCANCEL) return; + theApp.m_Options.TSExe = opt.m_TSEXE; optini.SetString(game, "Exe", theApp.m_Options.TSExe); optini.SetString(app, "Language", opt.m_LanguageName); - BOOL bOldSearch=theApp.m_Options.bSearchLikeTS; - if(!(opt.m_LikeTS==1)) { + BOOL bOldSearch = theApp.m_Options.bSearchLikeTS; + if (!(opt.m_LikeTS == 1)) { optini.SetString(app, "FileSearchLikeGame", "yes"); - theApp.m_Options.bSearchLikeTS=TRUE; - } - else { - theApp.m_Options.bSearchLikeTS=FALSE; + theApp.m_Options.bSearchLikeTS = TRUE; + } else { + theApp.m_Options.bSearchLikeTS = FALSE; optini.SetString(app, "FileSearchLikeGame", "no"); } @@ -367,13 +356,13 @@ void ShowOptionsDialog() ( (bOldPreferLocalTheaterFiles != theApp.m_Options.bPreferLocalTheaterFiles) || (bOldSearch != theApp.m_Options.bSearchLikeTS) - ) && bOptionsStartup == FALSE) + ) && bOptionsStartup == FALSE) MessageBox(0, GetLanguageStringACP("RestartNeeded"), "Restart", 0); - - CString oldLang=theApp.m_Options.LanguageName; - theApp.m_Options.LanguageName=opt.m_LanguageName; - if(oldLang!=theApp.m_Options.LanguageName && theApp.m_pMainWnd!=NULL && theApp.m_pMainWnd->m_hWnd!=NULL) + + CString oldLang = theApp.m_Options.LanguageName; + theApp.m_Options.LanguageName = opt.m_LanguageName; + if (oldLang != theApp.m_Options.LanguageName && theApp.m_pMainWnd != NULL && theApp.m_pMainWnd->m_hWnd != NULL) ((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateStrings(); optini.SaveFile(iniFile); @@ -383,11 +372,10 @@ void ShowOptionsDialog() BOOL DoesFileExist(LPCSTR szFile) { std::wstring file = utf8ToUtf16(szFile); - HANDLE hFound=CreateFileW(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, 0, NULL); - - if (hFound != INVALID_HANDLE_VALUE) - { + HANDLE hFound = CreateFileW(file.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, 0, NULL); + + if (hFound != INVALID_HANDLE_VALUE) { CloseHandle(hFound); return TRUE; } @@ -405,18 +393,18 @@ CString ToACP(const CString& utf8) CString TranslateStringVariables(int n, const char* originaltext, const char* inserttext) { char c[50]; - itoa(n,c,10); + itoa(n, c, 10); char seekedstring[50]; - seekedstring[0]='%'; - seekedstring[1]=0; + seekedstring[0] = '%'; + seekedstring[1] = 0; strcat(seekedstring, c); - - CString orig=originaltext; - if(orig.Find(seekedstring)<0) return orig; + + CString orig = originaltext; + if (orig.Find(seekedstring) < 0) return orig; orig.Replace(seekedstring, inserttext); - + return orig; } @@ -428,13 +416,13 @@ CString GetLanguageStringACP(CString name) if (auto const& translated = language.GetSection(strRA2Sec).TryGetString(name)) { return ToACP(*translated); } - if(auto const& def = language.GetSection("English-StringsRA2").TryGetString(name)) { + if (auto const& def = language.GetSection("English-StringsRA2").TryGetString(name)) { return ToACP(*def); } #endif auto const defSec = theApp.m_Options.LanguageName + "-Strings"; auto const translated = language.GetSection(defSec).TryGetString(name); - if(!translated) { + if (!translated) { CString s = language.GetSection("English-Strings").GetStringOr(name, name); #ifndef RA2_MODE s = TranslateStringVariables(9, s, "FinalSun"); @@ -461,7 +449,7 @@ CString GetLanguageStringACP(CString name) #endif #endif - + return ToACP(s); } @@ -485,18 +473,18 @@ CString TranslateStringACP(CString u8EnglishString) void TruncSpace(string& str) { - CString cstr=str.data(); + CString cstr = str.data(); TruncSpace(cstr); - str=cstr; + str = cstr; } void TruncSpace(CString& str) { str.TrimLeft(); str.TrimRight(); - if(str.Find(" ")>=0) str.Delete(str.Find(" "), str.GetLength()-str.Find(" ")); + if (str.Find(" ") >= 0) str.Delete(str.Find(" "), str.GetLength() - str.Find(" ")); } -CString GetText(CWnd* wnd){ +CString GetText(CWnd* wnd) { CString str; wnd->GetWindowText(str); return str; @@ -504,21 +492,20 @@ CString GetText(CWnd* wnd){ CString GetText(CSliderCtrl* wnd) { - int v=wnd->GetPos(); + int v = wnd->GetPos(); char c[150]; - itoa(v,c,10); + itoa(v, c, 10); return(c); } -CString GetText(CComboBox* wnd){ +CString GetText(CComboBox* wnd) { CString str; - if(wnd->GetCurSel()!=-1) - { + if (wnd->GetCurSel() != -1) { wnd->GetLBText(wnd->GetCurSel(), str); return str; } - + wnd->GetWindowText(str); return(str); @@ -526,125 +513,122 @@ CString GetText(CComboBox* wnd){ -void Info(const char* data, string& house, string& type, int& strength, int& x, int& y, string & other) +void Info(const char* data, string& house, string& type, int& strength, int& x, int& y, string& other) { - other=""; - house=GetParam(data, 0); - type=GetParam(data, 1); - strength=atoi(GetParam(data, 2)); - y=atoi(GetParam(data, 3)); - x=atoi(GetParam(data, 4)); + other = ""; + house = GetParam(data, 0); + type = GetParam(data, 1); + strength = atoi(GetParam(data, 2)); + y = atoi(GetParam(data, 3)); + x = atoi(GetParam(data, 4)); CString tmp; - BOOL takeABreak=FALSE; - int i=1; - do{ - - tmp=GetParam(data, 4+i); + BOOL takeABreak = FALSE; + int i = 1; + do { + + tmp = GetParam(data, 4 + i); //MessageBox(0,tmp.data(),"",0); - if(tmp!="") - { - other+=","; - other+=tmp; - } - else - { - takeABreak=TRUE; + if (tmp != "") { + other += ","; + other += tmp; + } else { + takeABreak = TRUE; break; } i++; - }while(takeABreak==FALSE); + } while (takeABreak == FALSE); }; -void UnitInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, string& actiontrigger, int & u1, int & u2, int& u3, int& u4, int& u5, int& u6) +void UnitInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, string& actiontrigger, int& u1, int& u2, int& u3, int& u4, int& u5, int& u6) { - house=GetParam(data, 0); - type=GetParam(data, 1); - strength=atoi(GetParam(data, 2)); - y=atoi(GetParam(data, 3)); - x=atoi(GetParam(data, 4)); - direction=atoi(GetParam(data, 5)); - action=GetParam(data, 6); - actiontrigger=GetParam(data, 7); - u1=atoi(GetParam(data, 8)); - u2=atoi(GetParam(data, 9)); - u3=atoi(GetParam(data, 10)); - u4=atoi(GetParam(data, 11)); - u5=atoi(GetParam(data, 12)); - u6=atoi(GetParam(data, 13)); + house = GetParam(data, 0); + type = GetParam(data, 1); + strength = atoi(GetParam(data, 2)); + y = atoi(GetParam(data, 3)); + x = atoi(GetParam(data, 4)); + direction = atoi(GetParam(data, 5)); + action = GetParam(data, 6); + actiontrigger = GetParam(data, 7); + u1 = atoi(GetParam(data, 8)); + u2 = atoi(GetParam(data, 9)); + u3 = atoi(GetParam(data, 10)); + u4 = atoi(GetParam(data, 11)); + u5 = atoi(GetParam(data, 12)); + u6 = atoi(GetParam(data, 13)); } -void AirInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, string& actiontrigger, int & u1, int & u2, int& u3, int& u4) +void AirInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, string& actiontrigger, int& u1, int& u2, int& u3, int& u4) { - house=GetParam(data, 0); - type=GetParam(data, 1); - strength=atoi(GetParam(data, 2)); - y=atoi(GetParam(data, 3)); - x=atoi(GetParam(data, 4)); - direction=atoi(GetParam(data, 5)); - action=GetParam(data, 6); - actiontrigger=GetParam(data, 7); - u1=atoi(GetParam(data, 8)); - u2=atoi(GetParam(data, 9)); - u3=atoi(GetParam(data, 10)); - u4=atoi(GetParam(data, 11)); + house = GetParam(data, 0); + type = GetParam(data, 1); + strength = atoi(GetParam(data, 2)); + y = atoi(GetParam(data, 3)); + x = atoi(GetParam(data, 4)); + direction = atoi(GetParam(data, 5)); + action = GetParam(data, 6); + actiontrigger = GetParam(data, 7); + u1 = atoi(GetParam(data, 8)); + u2 = atoi(GetParam(data, 9)); + u3 = atoi(GetParam(data, 10)); + u4 = atoi(GetParam(data, 11)); } -void InfanteryInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& pos, string& action, int& direction, string& actiontrigger, int & u1, int & u2, int& u3, int& u4, int& u5) +void InfanteryInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& pos, string& action, int& direction, string& actiontrigger, int& u1, int& u2, int& u3, int& u4, int& u5) { - house=GetParam(data, 0); - type=GetParam(data, 1); - strength=atoi(GetParam(data, 2)); - y=atoi(GetParam(data, 3)); - x=atoi(GetParam(data, 4)); - pos=atoi(GetParam(data, 5)); - action=GetParam(data, 6); - direction=atoi(GetParam(data, 7)); - actiontrigger=GetParam(data, 8); - u1=atoi(GetParam(data, 9)); - u2=atoi(GetParam(data, 10)); - u3=atoi(GetParam(data, 11)); - u4=atoi(GetParam(data, 12)); - u5=atoi(GetParam(data, 12)); + house = GetParam(data, 0); + type = GetParam(data, 1); + strength = atoi(GetParam(data, 2)); + y = atoi(GetParam(data, 3)); + x = atoi(GetParam(data, 4)); + pos = atoi(GetParam(data, 5)); + action = GetParam(data, 6); + direction = atoi(GetParam(data, 7)); + actiontrigger = GetParam(data, 8); + u1 = atoi(GetParam(data, 9)); + u2 = atoi(GetParam(data, 10)); + u3 = atoi(GetParam(data, 11)); + u4 = atoi(GetParam(data, 12)); + u5 = atoi(GetParam(data, 12)); } -void StructureInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, int & u1, int & u2, int& energy, int& upgrades, int& u5, string& upgrade1, string& upgrade2, string& upgrade3, int& u9, int& u10) +void StructureInfo(const char* data, string& house, string& type, int& strength, int& x, int& y, int& direction, string& action, int& u1, int& u2, int& energy, int& upgrades, int& u5, string& upgrade1, string& upgrade2, string& upgrade3, int& u9, int& u10) { - house=GetParam(data, 0); - type=GetParam(data, 1); - strength=atoi(GetParam(data, 2)); - y=atoi(GetParam(data, 3)); - x=atoi(GetParam(data, 4)); - direction=atoi(GetParam(data, 5)); - action=GetParam(data, 6); - u1=atoi(GetParam(data, 7)); - u2=atoi(GetParam(data, 8)); - energy=atoi(GetParam(data, 9)); - upgrades=atoi(GetParam(data, 10)); - u5=atoi(GetParam(data, 11)); - upgrade1=GetParam(data, 12); - upgrade2=GetParam(data, 13); - upgrade3=GetParam(data, 14); - u9=atoi(GetParam(data, 15)); - u10=atoi(GetParam(data, 16)); + house = GetParam(data, 0); + type = GetParam(data, 1); + strength = atoi(GetParam(data, 2)); + y = atoi(GetParam(data, 3)); + x = atoi(GetParam(data, 4)); + direction = atoi(GetParam(data, 5)); + action = GetParam(data, 6); + u1 = atoi(GetParam(data, 7)); + u2 = atoi(GetParam(data, 8)); + energy = atoi(GetParam(data, 9)); + upgrades = atoi(GetParam(data, 10)); + u5 = atoi(GetParam(data, 11)); + upgrade1 = GetParam(data, 12); + upgrade2 = GetParam(data, 13); + upgrade3 = GetParam(data, 14); + u9 = atoi(GetParam(data, 15)); + u10 = atoi(GetParam(data, 16)); } void PosToXY(const char* pos, int* X, int* Y) { - int Posleng; - //int XX, YY; - char Pos[100]; - strcpy(Pos, pos); - char XS[10], YS[10]; - Posleng = strlen(Pos); - strcpy(YS, Pos+Posleng-3); - Pos[Posleng-3]=0; - strcpy(XS, Pos); + int Posleng; + //int XX, YY; + char Pos[100]; + strcpy(Pos, pos); + char XS[10], YS[10]; + Posleng = strlen(Pos); + strcpy(YS, Pos + Posleng - 3); + Pos[Posleng - 3] = 0; + strcpy(XS, Pos); - *X = atoi(XS); - *Y = atoi(YS); + *X = atoi(XS); + *Y = atoi(YS); } @@ -656,8 +640,7 @@ bool HSVToRGB(const float h, const float s, const float v, float& r, float& g, f const float c = s * v; const float x = c * (1 - fabs(fmod(h / 60.0, 2.0) - 1)); const float m = v - c; - switch(h_) - { + switch (h_) { case 0: r = c, g = x, b = 0.0; break; @@ -804,38 +787,36 @@ void ListRulesGlobals(CComboBox& cb) extern TranslationMap AllStrings; void ListTutorial(CComboBox& cb) { - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); #ifndef RA2_MODE int i; - for(i=0;i::iterator it; - it _it=AllStrings.begin(); + it _it = AllStrings.begin(); /*it begin; it end; begin=CCStrings.begin(); end=CCStrings.end();*/ int i; - for(i=0;ifirst; - s+=" : "; - s+=_it->second.cString; + s = _it->first; + s += " : "; + s += _it->second.cString; cb.AddString(s); _it++; @@ -862,7 +843,7 @@ void ListTriggers(CComboBox& cb) void ListYesNo(CComboBox& cb) { - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); cb.AddString("1 " + GetLanguageStringACP("Yes")); cb.AddString("0 " + GetLanguageStringACP("No")); } @@ -924,25 +905,25 @@ void ListParticles(CComboBox& cb) void ListCrateTypes(CComboBox& cb) { - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); } void ListSpeechBubbleTypes(CComboBox& cb) { - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); } void ListMovies(CComboBox& cb, BOOL bListNone, BOOL bListParam) { - if(!bListParam) { + if (!bListParam) { int sel = cb.GetCurSel(); while (cb.DeleteString(0) != CB_ERR); - if (bListNone) { + if (bListNone) { cb.AddString(""); } auto const& movieList = art.GetSection("Movies"); - for (auto idx = 0; idx < movieList.Size();++idx) { + for (auto idx = 0; idx < movieList.Size(); ++idx) { if (idx < atoi(g_data.GetString("MovieList", "Start"))) { continue; } @@ -1027,9 +1008,9 @@ int RepairRulesHouses() } // MW 07/27/01: Modified for etc in YR -void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) +void ListHouses(CComboBox& cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) { - CIniFile& ini=Map->GetIniFile(); + CIniFile& ini = Map->GetIniFile(); int sel = cb.GetCurSel(); int crulesh = GetRulesHousesSize(); @@ -1044,16 +1025,14 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) while (cb.DeleteString(0) != CB_ERR); // houses: rules.ini + map definitions! auto const mapHouseList = ini.TryGetSection(sSection); - if(mapHouseList) { + if (mapHouseList) { if (mapHouseList->Size() == 0) { goto wasnohouse; } // we use the map definitions! - - if(yuri_mode && bPlayers) - { - if(bNumbers) - { + + if (yuri_mode && bPlayers) { + if (bNumbers) { cb.AddString("4475 "); cb.AddString("4476 "); cb.AddString("4477 "); @@ -1061,10 +1040,8 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) cb.AddString("4479 "); cb.AddString("4480 "); cb.AddString("4481 "); - cb.AddString("4482 "); - } - else - { + cb.AddString("4482 "); + } else { cb.AddString(""); cb.AddString(""); cb.AddString(""); @@ -1075,9 +1052,9 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) cb.AddString(""); } - + } - + for (auto i = 0; i < mapHouseList->Size(); i++) { CString j; @@ -1088,12 +1065,12 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) continue; } #endif - - if(bNumbers) { + + if (bNumbers) { char idxStr[50]; itoa(i, idxStr, 10); #ifdef RA2_MODE - if(bCountries) { + if (bCountries) { int preexisting = 0; int e; auto const& rulesMapList = rules.GetSection(sSection); @@ -1106,8 +1083,7 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) auto const& mapHouseID = mapHouseList->Nth(i).second; auto const& idxInRules = rulesMapList.FindValue(mapHouseID); itoa(idxInRules, idxStr, 10); - } - else { + } else { itoa(i + crulesh - preexisting, idxStr, 10); } } @@ -1115,55 +1091,52 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) j = idxStr; j += " "; j += TranslateHouse(mapHouseList->Nth(i).second, TRUE); - } - else { + } else { j = TranslateHouse(mapHouseList->Nth(i).second, TRUE); } - cb.AddString(j); + cb.AddString(j); } - } - else { - wasnohouse: + } else { + wasnohouse: - if(bNumbers) { + if (bNumbers) { auto const& rulesHouseList = rules.GetSection(HOUSES); - for(auto const& [key, val] : rulesHouseList) { + for (auto const& [key, val] : rulesHouseList) { CString houseRecord; #ifdef RA2_MODE - houseRecord= val; + houseRecord = val; houseRecord.MakeLower(); if (houseRecord == "nod" || houseRecord == "gdi") { continue; } #endif - houseRecord= key; + houseRecord = key; houseRecord += " "; houseRecord += TranslateHouse(val, TRUE); - - cb.AddString(houseRecord); + + cb.AddString(houseRecord); } if (!yuri_mode || !bPlayers) { for (auto i = 0; i < 8; i++) { - int k=i; - #ifdef RA2_MODE - k+=crulesh; - - + int k = i; +#ifdef RA2_MODE + k += crulesh; + + //rules.sections[HOUSES].values.size(); - #endif +#endif CString j; char c[50]; - itoa(k,c,10); - j+=c; - j+=" Multi-Player "; - itoa(i,c,10); - j+=c; - cb.AddString(j); + itoa(k, c, 10); + j += c; + j += " Multi-Player "; + itoa(i, c, 10); + j += c; + cb.AddString(j); } - } - else { + } else { cb.AddString("4475 "); cb.AddString("4476 "); cb.AddString("4477 "); @@ -1173,9 +1146,8 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) cb.AddString("4481 "); cb.AddString("4482 "); } - } - else { - if(yuri_mode && bPlayers) { + } else { + if (yuri_mode && bPlayers) { cb.AddString(""); cb.AddString(""); cb.AddString(""); @@ -1183,7 +1155,7 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) cb.AddString(""); cb.AddString(""); cb.AddString(""); - cb.AddString(""); + cb.AddString(""); } auto const& rulesHouseList = rules.GetSection(HOUSES); @@ -1217,7 +1189,7 @@ void ListHouses(CComboBox &cb, BOOL bNumbers, BOOL bCountries, BOOL bPlayers) } -void ListTeamTypes(CComboBox &cb, BOOL bListNone) +void ListTeamTypes(CComboBox& cb, BOOL bListNone) { CIniFile& ini = Map->GetIniFile(); @@ -1241,7 +1213,7 @@ void ListTeamTypes(CComboBox &cb, BOOL bListNone) } } -void ListWaypoints(CComboBox &cb) +void ListWaypoints(CComboBox& cb) { CIniFile& ini = Map->GetIniFile(); @@ -1258,11 +1230,11 @@ void ListWaypoints(CComboBox &cb) } } -void ListTargets(CComboBox &cb) +void ListTargets(CComboBox& cb) { - int sel=cb.GetCurSel(); + int sel = cb.GetCurSel(); - while(cb.DeleteString(0)!=CB_ERR); + while (cb.DeleteString(0) != CB_ERR); cb.AddString("1 - Not specified"); cb.AddString("2 - Buildings"); @@ -1273,7 +1245,7 @@ void ListTargets(CComboBox &cb) cb.AddString("7 - Base defenses"); cb.AddString("9 - Power plants"); - if(sel>=0) cb.SetCurSel(sel); + if (sel >= 0) cb.SetCurSel(sel); } @@ -1283,7 +1255,7 @@ CString GetHouseSectionName(CString lpHouse) #ifndef RA2_MODE return lpHouse; #else - return lpHouse+" House"; + return lpHouse + " House"; #endif } @@ -1330,30 +1302,25 @@ CString GetFreeID() return ""; } -void GetNodeName(CString & name, int n) +void GetNodeName(CString& name, int n) { char c[5]; char p[6]; - memset(p,0,6); - itoa(n,c,10); - strcpy(p,c); - - if(strlen(c)==1) - { - memcpy(c,"00", 2); - strcpy(c+2, p); - } - else if(strlen(c)==2) - { - memcpy(c,"0", 1); - strcpy(c+1, p); - } - else if(strlen(c)==3) - { - strcpy(c, p); + memset(p, 0, 6); + itoa(n, c, 10); + strcpy(p, c); + + if (strlen(c) == 1) { + memcpy(c, "00", 2); + strcpy(c + 2, p); + } else if (strlen(c) == 2) { + memcpy(c, "0", 1); + strcpy(c + 1, p); + } else if (strlen(c) == 3) { + strcpy(c, p); } - name=c; + name = c; } int GetNodeAt(CString& owner, CString& buildingTypeID, int x, int y) @@ -1402,7 +1369,7 @@ int GetNodeAt(CString& owner, CString& buildingTypeID, int x, int y) d[1] = 0; w = atoi(d); if (w == 0) { - w = 1; + w = 1; } memcpy(d, (LPCTSTR)art.GetString(arttype, "Foundation") + 2, 1); d[1] = 0; @@ -1452,34 +1419,26 @@ void GetDrawBorder(const BYTE* data, int width, int line, int& left, int& right, int i; const BYTE* lpStart = data + line * width; - if (flags == 0) - { + if (flags == 0) { // left border: - for (i = 0;i < width;i++) - { - if (lpStart[i] || i == width - 1) - { + for (i = 0; i < width; i++) { + if (lpStart[i] || i == width - 1) { left = i; break; } } // right border: - for (i = width - 1;i >= 0;i--) - { - if (lpStart[i] || i == 0) - { + for (i = width - 1; i >= 0; i--) { + if (lpStart[i] || i == 0) { right = i; break; } } - if (TranspInside) - { - for (i = left;i <= right;i++) - { - if (!lpStart[i]) - { + if (TranspInside) { + for (i = left; i <= right; i++) { + if (!lpStart[i]) { *TranspInside = TRUE; break; } @@ -1488,7 +1447,7 @@ void GetDrawBorder(const BYTE* data, int width, int line, int& left, int& right, } } -CComPtr BitmapToSurface(IDirectDraw4 * pDD, const CBitmap& bitmap) +CComPtr BitmapToSurface(IDirectDraw4* pDD, const CBitmap& bitmap) { BITMAP bm; GetObject(bitmap, sizeof(bm), &bm); @@ -1522,7 +1481,7 @@ CComPtr BitmapToSurface(IDirectDraw4 * pDD, const CBitmap& auto success = surfaceDC.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &bitmapDC, 0, 0, SRCCOPY); surfaceDC.Detach(); pSurface->ReleaseDC(hSurfaceDC); - + return pSurface; } diff --git a/MissionEditor/functions.h b/MissionEditor/functions.h index 669196a..f4f6156 100644 --- a/MissionEditor/functions.h +++ b/MissionEditor/functions.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef FUNC_INCLUDED @@ -36,7 +36,7 @@ void SetMainStatusBarReady(); CString TranslateStringVariables(int n, const char* originaltext, const char* inserttext); // Alliance->Korea etc... -CString TranslateHouse(CString original, BOOL bToUI=FALSE); +CString TranslateHouse(CString original, BOOL bToUI = FALSE); // show options dialog void ShowOptionsDialog(); @@ -67,7 +67,7 @@ void ClearNode(int n, string owner); CString GetFreeID(); -void HandleParamList(CComboBox &cb, int type); +void HandleParamList(CComboBox& cb, int type); // sets 0 if there is a space in the string, so truncates it at the first space occupation void TruncSpace(string& str); @@ -78,12 +78,12 @@ BOOL DoesFileExist(LPCSTR szFile); // Lists some things -void ListHouses(CComboBox &cb, BOOL bNumbers=FALSE, BOOL bCountries=FALSE, BOOL bPlayers=FALSE); -void ListTeamTypes(CComboBox &cb, BOOL bListNone=FALSE); -void ListWaypoints(CComboBox &cb); +void ListHouses(CComboBox& cb, BOOL bNumbers = FALSE, BOOL bCountries = FALSE, BOOL bPlayers = FALSE); +void ListTeamTypes(CComboBox& cb, BOOL bListNone = FALSE); +void ListWaypoints(CComboBox& cb); void ListTargets(CComboBox& cb); void ListTags(CComboBox& cb, BOOL bListNone); -void ListMovies(CComboBox& cb, BOOL bListNone, BOOL bListParam=FALSE); +void ListMovies(CComboBox& cb, BOOL bListNone, BOOL bListParam = FALSE); void ListBuildings(CComboBox& cb, bool useIniName = false); void ListUnits(CComboBox& cb); void ListAircraft(CComboBox& cb); @@ -115,7 +115,7 @@ CString GetHouseSectionName(CString lpHouse); int RepairRulesHouses(); // strcpy_safe allows overlapping of source & destination. strcpy may be faster though! -char *strcpy_safe( char *strDestination, const char *strSource ); +char* strcpy_safe(char* strDestination, const char* strSource); /**************************************** language support functions [12/18/1999] @@ -137,20 +137,20 @@ CString TranslateStringACP(WCHAR* u16EnglishString); sound functions [03/16/2001] ****************************************/ -// general play sound function. uses parameter in defines.h. Does only play if user has not deactivated sounds + // general play sound function. uses parameter in defines.h. Does only play if user has not deactivated sounds void Sound(int ID); class BitmapNotFound : std::runtime_error { public: - BitmapNotFound(): std::runtime_error("Bitmap not found") {} + BitmapNotFound() : std::runtime_error("Bitmap not found") {} }; std::unique_ptr BitmapFromResource(int resource_id); std::unique_ptr BitmapFromFile(const CString& filepath); -CComPtr BitmapToSurface(IDirectDraw4 * pDD, const CBitmap& bitmap); +CComPtr BitmapToSurface(IDirectDraw4* pDD, const CBitmap& bitmap); #endif \ No newline at end of file diff --git a/MissionEditor/inlines.h b/MissionEditor/inlines.h index c3435e5..07f3c88 100644 --- a/MissionEditor/inlines.h +++ b/MissionEditor/inlines.h @@ -81,16 +81,13 @@ inline CString GetUnitPictureFilename(LPCTSTR lpUnitName, DWORD dwPicIndex) itoa(dwPicIndex, n, 10); - if (pics.find(artname + n) != pics.end()) - { + if (pics.find(artname + n) != pics.end()) { filename = artname; // yes, found filename += n; - } - else if (pics.find(artname + ".bmp") != pics.end()) // since June, 15th (Matze): Only use BMP if no SHP/VXL exists + } else if (pics.find(artname + ".bmp") != pics.end()) // since June, 15th (Matze): Only use BMP if no SHP/VXL exists { filename = (CString)artname + ".bmp"; - } - else + } else filename = ""; return filename; @@ -101,8 +98,7 @@ inline CString GetParam(const CString& data, const int param) int paramStrPos = 0; int curParam = param; - while (curParam--) - { + while (curParam--) { auto nextComma = data.Find(',', paramStrPos); if (nextComma < 0) return CString(); // RVO; param not found @@ -119,8 +115,7 @@ inline std::string GetParam(const std::string& data, const int param) int paramStrPos = 0; int curParam = param; - while (curParam--) - { + while (curParam--) { auto nextComma = data.find(',', paramStrPos); if (nextComma == std::string::npos) return std::string(); // RVO; param not found @@ -143,11 +138,9 @@ inline std::vector Split(const CString& data, char separator) int lastComma = -1; const auto len = data.GetLength(); std::vector res; - while (lastComma < len) - { + while (lastComma < len) { nextComma = data.Find(separator, lastComma + 1); - if (nextComma < 0) - { + if (nextComma < 0) { res.push_back(data.Mid(lastComma + 1)); break; } @@ -172,8 +165,7 @@ inline CString Join(const CString& join, const std::vector& strings) len += s.GetLength() + join.GetLength(); res.Preallocate(len + 1); int remaining = strings.size(); - for (auto& s : strings) - { + for (auto& s : strings) { res += s; if (--remaining) res += join; @@ -189,8 +181,7 @@ inline std::string Join(const std::string& join, const std::ranges::input_range len += s.size() + join.size(); res.reserve(len + 1); int remaining = strings.size(); - for (const auto& s : strings) - { + for (const auto& s : strings) { res += s; if (--remaining) res += join; diff --git a/MissionEditor/ovrlinline.h b/MissionEditor/ovrlinline.h index 1706238..a1f83a2 100644 --- a/MissionEditor/ovrlinline.h +++ b/MissionEditor/ovrlinline.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef INCL_OVRL_INLINE @@ -25,7 +25,7 @@ inline BOOL isGreenTiberium(int type) { - return (type>0x65 && type<=0x79) || (type>0x82 && type<0xa7); + return (type > 0x65 && type <= 0x79) || (type > 0x82 && type < 0xa7); } #endif \ No newline at end of file diff --git a/MissionEditor/res/FinalSun.rc2 b/MissionEditor/res/FinalSun.rc2 index 03e4f37..0ca4d72 100644 --- a/MissionEditor/res/FinalSun.rc2 +++ b/MissionEditor/res/FinalSun.rc2 @@ -3,7 +3,7 @@ // #ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ +#error this file is not editable by Microsoft Visual C++ #endif //APSTUDIO_INVOKED diff --git a/MissionEditor/structs.cpp b/MissionEditor/structs.cpp index 113f18f..545128b 100644 --- a/MissionEditor/structs.cpp +++ b/MissionEditor/structs.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "StdAfx.h" @@ -29,28 +29,27 @@ ACTIONDATA::~ACTIONDATA() } void ACTIONDATA::reset() { - mode = 0; - type = 0; - data = 0; - data2 = 0; - data3 = 0; - z_data = 0; - data_s = ""; - tool.reset(); + mode = 0; + type = 0; + data = 0; + data2 = 0; + data3 = 0; + z_data = 0; + data_s = ""; + tool.reset(); } void PICDATA::createVBorder() { - ASSERT(!vborder); - ASSERT(pic && bType != PICDATA_TYPE_BMP); - _vBorder = std::make_shared>(wMaxHeight); - vborder = _vBorder->data(); - int k; - for (k = 0;k < wMaxHeight;k++) - { - int l, r; - GetDrawBorder(static_cast(pic), wMaxWidth, k, l, r, 0); - vborder[k].left = l; - vborder[k].right = r; - } + ASSERT(!vborder); + ASSERT(pic && bType != PICDATA_TYPE_BMP); + _vBorder = std::make_shared>(wMaxHeight); + vborder = _vBorder->data(); + int k; + for (k = 0; k < wMaxHeight; k++) { + int l, r; + GetDrawBorder(static_cast(pic), wMaxWidth, k, l, r, 0); + vborder[k].left = l; + vborder[k].right = r; + } } \ No newline at end of file diff --git a/MissionEditor/tests.cpp b/MissionEditor/tests.cpp index 308959b..db51e84 100644 --- a/MissionEditor/tests.cpp +++ b/MissionEditor/tests.cpp @@ -55,17 +55,12 @@ bool ReportTest(const char* file, int line, const char* function, const char* as bool run_test(const std::function& f) { - try - { + try { f(); return true; - } - catch(const TestError& e) - { + } catch (const TestError& e) { std::cout << e.what() << std::endl; - } - catch (const std::exception& e) - { + } catch (const std::exception& e) { std::cout << "ERROR: Exception occurred: " << e.what() << std::endl; } return false; @@ -80,7 +75,7 @@ int main(int argc, char* argv[]) int Tests::run() { int failed_tests = 0; - std::vector> test_functions({ + std::vector> test_functions({ [this]() { test_inlines(); }, [this]() { test_tube_create(); }, [this]() { test_tube_reverse(); }, @@ -88,9 +83,8 @@ int Tests::run() [this]() { test_tube_delimiter(); }, [this]() { test_hsv(); }, [this]() { test_iso(); }, - }); - for (const auto f : test_functions) - { + }); + for (const auto f : test_functions) { if (!run_test(f)) ++failed_tests; } @@ -137,7 +131,7 @@ void Tests::test_tube_create() using namespace TubeDirections; REPORT_TEST(CTube::autocreate(50, 50, 50, 50) == CTube(50, 50, XX, 50, 50, std::vector({ XX }))); - REPORT_TEST(CTube::autocreate(50, 50, 55, 50) == CTube(50, 50, BC, 55, 50, std::vector({ BC, BC, BC, BC, BC, XX}))); + REPORT_TEST(CTube::autocreate(50, 50, 55, 50) == CTube(50, 50, BC, 55, 50, std::vector({ BC, BC, BC, BC, BC, XX }))); REPORT_TEST(CTube::autocreate(50, 50, 45, 50) == CTube(50, 50, TC, 45, 50, std::vector({ TC, TC, TC, TC, TC, XX }))); REPORT_TEST(CTube::autocreate(50, 50, 45, 45, 0) == CTube(50, 50, CL, 45, 45, std::vector({ TL, TL, TL, TL, TL, XX }))); REPORT_TEST(CTube::autocreate(50, 50, 45, 45) == CTube(50, 50, CL, 45, 45, std::vector({ CL, TL, TL, TL, TL, TC, XX }))); @@ -151,14 +145,14 @@ void Tests::test_tube_reverse() { using namespace TubeDirections; - REPORT_TEST(CTube(50, 50, BC, 55, 50, std::vector({ BC, BC, BC, BC, BC, XX})).reverse() == - CTube(55, 50, TC, 50, 50, std::vector({ TC, TC, TC, TC, TC, XX }))); + REPORT_TEST(CTube(50, 50, BC, 55, 50, std::vector({ BC, BC, BC, BC, BC, XX })).reverse() == + CTube(55, 50, TC, 50, 50, std::vector({ TC, TC, TC, TC, TC, XX }))); REPORT_TEST(CTube(50, 50, TC, 45, 46, std::vector({ TC, TL, TL, TL, TL, XX })).reverse() == - CTube(45, 46, BR, 50, 50, std::vector({ BR, BR, BR, BR, BC, XX }))); + CTube(45, 46, BR, 50, 50, std::vector({ BR, BR, BR, BR, BC, XX }))); REPORT_TEST(CTube(50, 50, BC, 51, 50, std::vector({ BC, XX })).reverse() == - CTube(51, 50, TC, 50, 50, std::vector({ TC, XX }))); + CTube(51, 50, TC, 50, 50, std::vector({ TC, XX }))); REPORT_TEST(CTube(50, 50, BC, 52, 50, std::vector({ BC, BC, XX })).reverse() == - CTube(52, 50, TC, 50, 50, std::vector({ TC, TC, XX }))); + CTube(52, 50, TC, 50, 50, std::vector({ TC, TC, XX }))); } @@ -243,5 +237,5 @@ void Tests::test_iso() REPORT_TEST(d.ProjectCoords3d(MapCoords(1, 1), 1) == ProjectedCoords((26 - 2) * f_x / 2, f_y / 2)); REPORT_TEST(d.ToMapCoords3d(ProjectedCoords((26 - 2) * f_x / 2, 0), 0) == MapCoords(0, 0)); - + } diff --git a/MissionEditor/tests.h b/MissionEditor/tests.h index cc8d9ea..8020c80 100644 --- a/MissionEditor/tests.h +++ b/MissionEditor/tests.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -26,10 +26,10 @@ public: private: void test_inlines(); - void test_tube_create(); - void test_tube_reverse(); - void test_tube_append(); - void test_tube_delimiter(); - void test_hsv(); - void test_iso(); + void test_tube_create(); + void test_tube_reverse(); + void test_tube_append(); + void test_tube_delimiter(); + void test_hsv(); + void test_iso(); }; \ No newline at end of file diff --git a/MissionEditor/variables.cpp b/MissionEditor/variables.cpp index d577172..7096691 100644 --- a/MissionEditor/variables.cpp +++ b/MissionEditor/variables.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /************************************* @@ -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 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 tilesets_start; @@ -110,58 +110,58 @@ vector 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 manager; - CComPtr local_app_data; - CComHeapPtr local_app_data_folder; - HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&manager)); - if (SUCCEEDED(hr)) { - //std::shared_ptr 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 manager; + CComPtr local_app_data; + CComHeapPtr local_app_data_folder; + HRESULT hr = CoCreateInstance(CLSID_KnownFolderManager, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&manager)); + if (SUCCEEDED(hr)) { + //std::shared_ptr 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 \ No newline at end of file diff --git a/MissionEditor/variables.h b/MissionEditor/variables.h index 30ec9b0..da8ef19 100644 --- a/MissionEditor/variables.h +++ b/MissionEditor/variables.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /******************************************* diff --git a/MissionEditorPackLib/MissionEditorPackLib.cpp b/MissionEditorPackLib/MissionEditorPackLib.cpp index c0ddd39..67b1149 100644 --- a/MissionEditorPackLib/MissionEditorPackLib.cpp +++ b/MissionEditorPackLib/MissionEditorPackLib.cpp @@ -87,8 +87,7 @@ __forceinline void CreateConvLookUpTable(DDPIXELFORMAT& pf, HTSPALETTE hPalette) f << "CreateConvLookUpTable() called" << endl; f.flush();*/ - if (memcmp(&pf, &cur_pf[hPalette - 1], sizeof(DDPIXELFORMAT)) || bFirstConv[hPalette - 1]) - { + if (memcmp(&pf, &cur_pf[hPalette - 1], sizeof(DDPIXELFORMAT)) || bFirstConv[hPalette - 1]) { bFirstConv[hPalette - 1] = FALSE; cur_pf[hPalette - 1] = pf; @@ -100,8 +99,7 @@ __forceinline void CreateConvLookUpTable(DDPIXELFORMAT& pf, HTSPALETTE hPalette) /*f << "Calculating colors" << endl; f.flush();*/ int i; - for (i = 0;i < 256;i++) - { + for (i = 0; i < 256; i++) { conv_color[hPalette - 1][i] = conv.get_color(ts_palettes[hPalette - 1][i].r, ts_palettes[hPalette - 1][i].g, ts_palettes[hPalette - 1][i].b); } transp_conv_color[hPalette - 1] = conv.get_color(245, 245, 245); @@ -123,15 +121,13 @@ namespace FSunPackLib // unterminatedCountWChars will be the count of WChars NOT including the terminating zero (due to passing in utf8.size() instead of -1) auto unterminatedCountWChars = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, nullptr, 0); - if (unterminatedCountWChars == 0) - { + if (unterminatedCountWChars == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } std::wstring utf16; utf16.resize(unterminatedCountWChars); - if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, utf16.data(), unterminatedCountWChars) == 0) - { + if (MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, utf16.data(), unterminatedCountWChars) == 0) { throw std::runtime_error("UTF8 -> UTF16 conversion failed"); } return utf16; @@ -143,15 +139,12 @@ namespace FSunPackLib template int open_write(F& file, const std::string& u8FilePath) { - try - { + try { auto u16FilePath = utf8ToUtf16(u8FilePath); Cwin_handle target_file_handle(CreateFileW(u16FilePath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); if (target_file_handle) return file.open(target_file_handle); - } - catch (std::runtime_error) - { + } catch (std::runtime_error) { return 2; } return 1; @@ -160,15 +153,12 @@ namespace FSunPackLib template int open_read(F& file, const std::string& u8FilePath) { - try - { + try { auto u16FilePath = utf8ToUtf16(u8FilePath); Cwin_handle target_file_handle(CreateFileW(u16FilePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); if (target_file_handle) return file.open(target_file_handle); - } - catch (std::runtime_error) - { + } catch (std::runtime_error) { return 2; } return 1; @@ -222,8 +212,7 @@ namespace FSunPackLib UINT i; UINT DP = 0; UINT SP = 0; - for (i = 0;i < nSections;i++) - { + for (i = 0; i < nSections; i++) { UINT packLen = encode80(&sp[SP], &data[DP + 4], length); //ConvertToF80(&sp[SP], length, &data[DP+4]); memcpy(&data[DP], &packLen, 3); @@ -272,14 +261,12 @@ namespace FSunPackLib const auto spEnd = sp + SourceLength; const t_pack_section_header* secHeader = nullptr; size_t totalSize = 0; - for (auto curSP = sp; curSP < sp + SourceLength;) - { + for (auto curSP = sp; curSP < sp + SourceLength;) { secHeader = (reinterpret_cast(curSP)); curSP += secHeader->size_in + sizeof(t_pack_section_header); totalSize += secHeader->size_out; } - if (totalSize > max_size) - { + if (totalSize > max_size) { return false; } @@ -307,8 +294,7 @@ namespace FSunPackLib UINT SP = 0; UINT DP = 0; - while (SP < SourceLength) - { + while (SP < SourceLength) { WORD wSrcSize; WORD wExtrSize; memcpy(&wSrcSize, sp + SP, 2); @@ -337,13 +323,10 @@ namespace FSunPackLib if (pDDS->Lock(nullptr, &desc, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, nullptr) != DD_OK) return color; - if (desc.lpSurface == nullptr) - { + if (desc.lpSurface == nullptr) { pDDS->Unlock(nullptr); return color; - } - else - { + } else { auto bytes_per_pixel = (desc.ddpfPixelFormat.dwRGBBitCount + 7) / 8; memcpy(&color, desc.lpSurface, bytes_per_pixel > 4 ? 4 : bytes_per_pixel); pDDS->Unlock(nullptr); @@ -376,10 +359,8 @@ namespace FSunPackLib HMIXFILE XCC_OpenMix(LPCTSTR szMixFile, HMIXFILE hOwner) { DWORD i, d = 0xFFFFFFFF; - for (i = 0;i <= dwMixFileCount && i < 2000;i++) - { - if (mixfiles[i].is_open() == false) - { + for (i = 0; i <= dwMixFileCount && i < 2000; i++) { + if (mixfiles[i].is_open() == false) { d = i; break; } @@ -389,8 +370,7 @@ namespace FSunPackLib std::string sMixFile = szMixFile; - if (hOwner == NULL) - { + if (hOwner == NULL) { if (open_read(mixfiles[d], sMixFile)) return NULL; //mixfiles[dwMixFileCount].enable_mix_expansion(); @@ -399,18 +379,13 @@ namespace FSunPackLib dwMixFileCount++; return d + 1;//dwMixFileCount; - } - else if (hOwner > 0 && (hOwner - 1) < dwMixFileCount) - { - if (szMixFile[0] == L'_' && szMixFile[1] == L'I' && szMixFile[2] == L'D') - { + } else if (hOwner > 0 && (hOwner - 1) < dwMixFileCount) { + if (szMixFile[0] == L'_' && szMixFile[1] == L'I' && szMixFile[2] == L'D') { char id[256]; strcpy_s(id, &sMixFile[3]); int iId = atoi(id); if (mixfiles[d].open(iId, mixfiles[hOwner - 1])) return NULL; - } - else - { + } else { if (mixfiles[d].open(sMixFile, mixfiles[hOwner - 1])) return NULL; } @@ -484,29 +459,25 @@ namespace FSunPackLib Ccc_file file(true); - if (szFilename[0] == '_' && szFilename[1] == 'I' && szFilename[2] == 'D') - { + if (szFilename[0] == '_' && szFilename[1] == 'I' && szFilename[2] == 'D') { char id[256]; strcpy_s(id, &szFilename[3]); int iId = atoi(id); if (file.open(iId, mixfiles[hOwner])) return NULL; - } - else - { + } else { if (file.open(szFilename, mixfiles[hOwner]) != 0) return FALSE; } - + Cfile32 target_file; if (open_write(target_file, szSaveTo)) return FALSE; const int bufferSize = static_cast(min(file.get_size(), 1024 * 1024)); std::vector buffer(bufferSize); - for (auto p = 0; p < file.get_size();) - { + for (auto p = 0; p < file.get_size();) { const auto toRead = static_cast(min(file.get_size() - p, bufferSize)); if (file.read(buffer.data(), toRead)) return FALSE; @@ -573,13 +544,10 @@ namespace FSunPackLib if (cur_tmp.is_open()) cur_tmp.close(); - if (hOwner == NULL) - { + if (hOwner == NULL) { if (open_read(cur_tmp, szTMP)) return FALSE; - } - else - { + } else { if (cur_tmp.open(szTMP, mixfiles[hOwner - 1])) return FALSE; } @@ -594,15 +562,11 @@ namespace FSunPackLib { if (cur_shp.is_open()) cur_shp.close(); - if (hOwner == NULL) - { - if (open_read(cur_shp, szSHP) != 0) - { + if (hOwner == NULL) { + if (open_read(cur_shp, szSHP) != 0) { return FALSE; } - } - else - { + } else { int id = mixfiles[hOwner - 1].get_id(mixfiles[hOwner - 1].get_game(), szSHP); int size = mixfiles[hOwner - 1].get_size(id); if (size == 0) @@ -629,15 +593,13 @@ namespace FSunPackLib if (lpTileType) *lpTileType = ihead.terrain_type; - if (lpRgbLeft) - { + if (lpRgbLeft) { lpRgbLeft->rgbtRed = ihead.radar_red_left; lpRgbLeft->rgbtGreen = ihead.radar_green_left; lpRgbLeft->rgbtBlue = ihead.radar_blue_left; } - if (lpRgbRight) - { + if (lpRgbRight) { lpRgbRight->rgbtRed = ihead.radar_red_right; lpRgbRight->rgbtGreen = ihead.radar_green_right; lpRgbRight->rgbtBlue = ihead.radar_blue_right; @@ -645,8 +607,7 @@ namespace FSunPackLib int cx = cur_tmp.get_cx(); int cy = cur_tmp.get_cy(); - if (cur_tmp.has_extra_graphics(iTile)) - { + if (cur_tmp.has_extra_graphics(iTile)) { int cy_extra = cur_tmp.get_cy_extra(iTile); int y_extra = cur_tmp.get_y_extra(iTile) - cur_tmp.get_y(iTile); int cx_extra = cur_tmp.get_cx_extra(iTile); @@ -654,15 +615,13 @@ namespace FSunPackLib int y_added = 0;//cur_tmp.get_x(iTile); int x_added = 0;//cur_tmp.get_y(iTile); - if (y_extra < 0) - { + if (y_extra < 0) { y_added -= y_extra; cy -= y_extra; y_extra = 0; } - if (x_extra < 0) - { + if (x_extra < 0) { x_added -= x_extra; cx -= x_extra; x_extra = 0; @@ -672,8 +631,7 @@ namespace FSunPackLib if (cy_extra + y_extra > cy) cy = cy_extra + y_extra; if (cx_extra + x_extra > cx) cx = cx_extra + x_extra; - if (lpPos != NULL) - { + if (lpPos != NULL) { //int xTile, yTile; //xTile=iTile%cur_tmp.get_cblocks_x(); //yTile=iTile/cur_tmp.get_cblocks_x(); @@ -686,11 +644,8 @@ namespace FSunPackLib if (lpWidth != NULL) *lpWidth = cx; if (lpHeight != NULL) *lpHeight = cy; - } - else - { - if (lpPos != NULL) - { + } else { + if (lpPos != NULL) { lpPos->x = 0;//cur_tmp.get_x(iTile);; lpPos->y = 0;//cur_tmp.get_y(iTile); } @@ -708,8 +663,7 @@ namespace FSunPackLib int x, y, cx, cy; cur_tmp.get_rect(x, y, cx, cy); - if (lpRect != NULL) - { + if (lpRect != NULL) { lpRect->left = x; lpRect->top = y; lpRect->right = x + cx; @@ -739,8 +693,7 @@ namespace FSunPackLib auto& head = cur_shp.header(); - if (head.cx == 0 || head.cy == 0) - { + if (head.cx == 0 || head.cy == 0) { return FALSE; } @@ -753,10 +706,8 @@ namespace FSunPackLib int pic; std::vector decode_image_buffer; - for (pic = 0;pic < iCount;pic++) - { - if (cur_shp.get_image_header(iImageIndex + pic)) - { + for (pic = 0; pic < iCount; pic++) { + if (cur_shp.get_image_header(iImageIndex + pic)) { imghead = *(cur_shp.get_image_header(iImageIndex + pic)); // if(imghead.offset!=0) { @@ -782,23 +733,19 @@ namespace FSunPackLib pdds[pic]->GetPixelFormat(&pf); - if (cur_shp.is_compressed(iImageIndex + pic)) - { + if (cur_shp.is_compressed(iImageIndex + pic)) { decode_image_buffer.resize(imghead.cx * imghead.cy); image = decode_image_buffer.data(); decode3(cur_shp.get_image(iImageIndex + pic), image, imghead.cx, imghead.cy); - } - else + } else image = (unsigned char*)cur_shp.get_image(iImageIndex + pic); - if ((pf.dwFlags & DDPF_RGB) && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) - { + if ((pf.dwFlags & DDPF_RGB) && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) { CreateConvLookUpTable(pf, hPalette); - if (pdds[pic]->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) - { + if (pdds[pic]->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) { BYTE* dest = (BYTE*)ddsd.lpSurface; pitch = ddsd.lPitch; @@ -811,26 +758,20 @@ namespace FSunPackLib else if (pf.dwRGBBitCount <= 24) bytesize = 3; else if (pf.dwRGBBitCount <= 32) bytesize = 4; - if (dest) - { + if (dest) { int i, e; - for (i = 0; i < head.cx; i++) - { - for (e = 0;e < head.cy;e++) - { + for (i = 0; i < head.cx; i++) { + for (e = 0; e < head.cy; e++) { DWORD dwRead = 0xFFFFFFFF; DWORD dwWrite = i * bytesize + e * pitch; if (i >= imghead.x && e >= imghead.y && i < imghead.x + imghead.cx && e < imghead.y + imghead.cy) dwRead = (i - imghead.x) + (e - imghead.y) * imghead.cx; - if (dwRead != 0xFFFFFFFF && image[dwRead] != 0) - { + if (dwRead != 0xFFFFFFFF && image[dwRead] != 0) { DWORD col = conv_color[hPalette - 1][image[dwRead]]; memcpy(&dest[dwWrite], &col, bytesize); - } - else - { + } else { DWORD col = transp_conv_color[hPalette - 1]; memcpy(&dest[dwWrite], &col, bytesize); } @@ -841,30 +782,23 @@ namespace FSunPackLib pdds[pic]->Unlock(NULL); } - } - else - { + } else { HDC hDC; while (pdds[pic]->GetDC(&hDC) == DDERR_WASSTILLDRAWING); { int i, e; - for (i = 0; i < head.cx; i++) - { - for (e = 0;e < head.cy;e++) - { + for (i = 0; i < head.cx; i++) { + for (e = 0; e < head.cy; e++) { DWORD dwRead = 0xFFFFFFFF; //DWORD dwWrite=i*bytesize+e*pitch; if (i >= imghead.x && e >= imghead.y && i < imghead.x + imghead.cx && e < imghead.y + imghead.cy) dwRead = (i - imghead.x) + (e - imghead.y) * imghead.cx; - if (dwRead != 0xFFFFFFFF && image[dwRead] != 0) - { + if (dwRead != 0xFFFFFFFF && image[dwRead] != 0) { t_palet_entry& p = ts_palettes[hPalette - 1][image[dwRead]]; SetPixel(hDC, i, e, RGB(p.r, p.g, p.b)); - } - else - { + } else { SetPixel(hDC, i, e, RGB(245, 245, 245)); } @@ -896,47 +830,39 @@ namespace FSunPackLib auto& head = cur_shp.header(); - if (head.cx == 0 || head.cy == 0) - { + if (head.cx == 0 || head.cy == 0) { return FALSE; } std::vector decode_image_buffer; - if (cur_shp.get_image_header(iImageIndex)) - { + if (cur_shp.get_image_header(iImageIndex)) { imghead = *(cur_shp.get_image_header(iImageIndex)); // if(imghead.offset!=0) { - if (cur_shp.is_compressed(iImageIndex)) - { + if (cur_shp.is_compressed(iImageIndex)) { decode_image_buffer.resize(imghead.cx * imghead.cy); image = decode_image_buffer.data(); decode3(cur_shp.get_image(iImageIndex), image, imghead.cx, imghead.cy); - } - else + } else image = (unsigned char*)cur_shp.get_image(iImageIndex); pic.resize(head.cx * head.cy); int i, e; - for (i = 0; i < head.cx; i++) - { - for (e = 0;e < head.cy;e++) - { + for (i = 0; i < head.cx; i++) { + for (e = 0; e < head.cy; e++) { DWORD dwRead = 0xFFFFFFFF; DWORD dwWrite = i + e * head.cx; if (i >= imghead.x && e >= imghead.y && i < imghead.x + imghead.cx && e < imghead.y + imghead.cy) dwRead = (i - imghead.x) + (e - imghead.y) * imghead.cx; - if (dwRead != 0xFFFFFFFF) - { + if (dwRead != 0xFFFFFFFF) { pic[dwWrite] = image[dwRead]; - } - else + } else pic[dwWrite] = 0; } @@ -959,8 +885,7 @@ namespace FSunPackLib auto& head = cur_shp.header(); - if (head.cx == 0 || head.cy == 0) - { + if (head.cx == 0 || head.cy == 0) { return FALSE; } @@ -969,42 +894,34 @@ namespace FSunPackLib int pic; std::vector decode_image_buffer; - for (pic = 0;pic < iCount;pic++) - { - if (cur_shp.get_image_header(iImageIndex + pic)) - { + for (pic = 0; pic < iCount; pic++) { + if (cur_shp.get_image_header(iImageIndex + pic)) { imghead = *(cur_shp.get_image_header(iImageIndex + pic)); // if(imghead.offset!=0) { - if (cur_shp.is_compressed(iImageIndex + pic)) - { + if (cur_shp.is_compressed(iImageIndex + pic)) { decode_image_buffer.resize(imghead.cx * imghead.cy); image = decode_image_buffer.data(); decode3(cur_shp.get_image(iImageIndex + pic), image, imghead.cx, imghead.cy); - } - else + } else image = (unsigned char*)cur_shp.get_image(iImageIndex + pic); lpPics[pic] = new(BYTE[head.cx * head.cy]); int i, e; - for (i = 0; i < head.cx; i++) - { - for (e = 0;e < head.cy;e++) - { + for (i = 0; i < head.cx; i++) { + for (e = 0; e < head.cy; e++) { DWORD dwRead = 0xFFFFFFFF; DWORD dwWrite = i + e * head.cx; if (i >= imghead.x && e >= imghead.y && i < imghead.x + imghead.cx && e < imghead.y + imghead.cy) dwRead = (i - imghead.x) + (e - imghead.y) * imghead.cx; - if (dwRead != 0xFFFFFFFF) - { + if (dwRead != 0xFFFFFFFF) { lpPics[pic][dwWrite] = image[dwRead]; - } - else + } else lpPics[pic][dwWrite] = 0; } @@ -1040,21 +957,18 @@ namespace FSunPackLib int x_added = 0; - if (f.has_extra_graphics(i)) - { + if (f.has_extra_graphics(i)) { cy_extra = f.get_cy_extra(i); y_extra = f.get_y_extra(i) - f.get_y(i); cx_extra = f.get_cx_extra(i); x_extra = f.get_x_extra(i) - f.get_x(i); - if (y_extra < 0) - { + if (y_extra < 0) { y_added = -y_extra; tile_cy -= y_extra; y_extra = 0; } - if (x_extra < 0) - { + if (x_extra < 0) { x_added = -x_extra; tile_cx -= x_extra; x_extra = 0; @@ -1078,8 +992,7 @@ namespace FSunPackLib int x = f.header().cx / 2; int cx = 0; int y; - for (y = 0; y < f.header().cy / 2; y++) - { + for (y = 0; y < f.header().cy / 2; y++) { cx += 4; x -= 2; if (w_line + x < d + tile_cx * tile_cy) @@ -1087,8 +1000,7 @@ namespace FSunPackLib r += cx; w_line += tile_cx; } - for (; y < f.header().cy - 1; y++) - { + for (; y < f.header().cy - 1; y++) { cx -= 4; x += 2; if (w_line + x < d + tile_cx * tile_cy) @@ -1098,8 +1010,7 @@ namespace FSunPackLib } - if (f.has_extra_graphics(i)) - { + if (f.has_extra_graphics(i)) { r += std_cx * std_cy / 2; w_line = d; @@ -1108,30 +1019,22 @@ namespace FSunPackLib skip_y = 0; int cx, cy; - if (x_extra < 0) - { + if (x_extra < 0) { cx = cx_extra; - } - else - { + } else { cx = cx_extra; w_line += x_extra; } - if (y_extra < 0) - { + if (y_extra < 0) { cy = cy_extra; - } - else - { + } else { cy = cy_extra; w_line += y_extra * (tile_cx); } - for (y = 0; y < cy - skip_y; y++) - { + for (y = 0; y < cy - skip_y; y++) { byte* w = w_line; - for (int x = 0; x < cx - skip_x; x++) - { + for (int x = 0; x < cx - skip_x; x++) { int v = *r++; if (v) *w = v; @@ -1163,27 +1066,22 @@ namespace FSunPackLib int pic; - for (pic = 0;pic < iCount;pic++) - { + for (pic = 0; pic < iCount; pic++) { int cx, cy; int z = pic + iStart; - if (!cur_tmp.get_index()[z]) - { + if (!cur_tmp.get_index()[z]) { pdds[pic] = NULL; - } - else - { + } else { XCC_GetTMPTileInfo(z, NULL, &cx, &cy, NULL, NULL, NULL, NULL, NULL); - if (cx > 0 && cy > 0) - { + if (cx > 0 && cy > 0) { //const byte* r = cur_tmp.get_image(iStart+pic); //new byte[cx * cy]; // byte transp=r[0]; ZeroMemory(&ddsd, sizeof(ddsd)); @@ -1194,8 +1092,7 @@ namespace FSunPackLib ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; byte* image = NULL; - if (pdd->CreateSurface(&ddsd, &pdds[pic], NULL) == DD_OK) - { + if (pdd->CreateSurface(&ddsd, &pdds[pic], NULL) == DD_OK) { last_succeeded_operation = 2101; @@ -1207,8 +1104,7 @@ namespace FSunPackLib BOOL bFastLoaded = FALSE; - if ((pf.dwFlags & DDPF_RGB) && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) - { + if ((pf.dwFlags & DDPF_RGB) && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) { last_succeeded_operation = 21011; @@ -1239,8 +1135,7 @@ namespace FSunPackLib lockr.right = cx; lockr.bottom = cy; - if (pdds[pic]->Lock(&lockr, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) - { + if (pdds[pic]->Lock(&lockr, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) { last_succeeded_operation = 21013; @@ -1248,8 +1143,7 @@ namespace FSunPackLib int pitch = ddsd.lPitch; - if (ddsd.dwFlags & DDSD_PIXELFORMAT) - { + if (ddsd.dwFlags & DDSD_PIXELFORMAT) { // pixel format overwritten @@ -1265,8 +1159,7 @@ namespace FSunPackLib } - if (ddsd.dwFlags & DDSD_LINEARSIZE) - { + if (ddsd.dwFlags & DDSD_LINEARSIZE) { pitch = ddsd.dwLinearSize / cy; } @@ -1287,20 +1180,15 @@ namespace FSunPackLib bFastLoaded = TRUE; - for (i = 0; i < cx; i++) - { - for (e = 0;e < cy;e++) - { + for (i = 0; i < cx; i++) { + for (e = 0; e < cy; e++) { DWORD dwWrite = i * bytesize + e * pitch; DWORD dwRead = i + e * cx; - if (image[dwRead] != 0) - { + if (image[dwRead] != 0) { DWORD col = conv_color[hPalette - 1][image[dwRead]]; memcpy(&dest[dwWrite], &col, bytesize); - } - else - { + } else { DWORD col = transp_conv_color[hPalette - 1]; memcpy(&dest[dwWrite], &col, bytesize); } @@ -1339,19 +1227,14 @@ namespace FSunPackLib HDC hDC; while (pdds[pic]->GetDC(&hDC) == DDERR_WASSTILLDRAWING) {}; - for (i = 0; i < cx; i++) - { - for (e = 0;e < cy;e++) - { + for (i = 0; i < cx; i++) { + for (e = 0; e < cy; e++) { DWORD dwRead = i + e * cx; - if (image[dwRead] != 0) - { + if (image[dwRead] != 0) { t_palet_entry& p = ts_palettes[hPalette - 1][image[dwRead]]; SetPixel(hDC, i, e, RGB(p.r, p.g, p.b)); - } - else - { + } else { SetPixel(hDC, i, e, RGB(245, 245, 245)); } @@ -1382,25 +1265,20 @@ namespace FSunPackLib int pic; - for (pic = 0;pic < iCount;pic++) - { + for (pic = 0; pic < iCount; pic++) { int cx, cy; int z = pic + iStart; - if (!cur_tmp.get_index()[z]) - { + if (!cur_tmp.get_index()[z]) { lpTileArray[pic] = NULL; - } - else - { + } else { XCC_GetTMPTileInfo(z, NULL, &cx, &cy, NULL, NULL, NULL, NULL, NULL); - if (cx > 0 && cy > 0) - { + if (cx > 0 && cy > 0) { byte* image = NULL; @@ -1436,8 +1314,7 @@ namespace FSunPackLib if (convert_palet) convert_palet_18_to_24(p); - for (long i = 0; i < 256; i++) - { + for (long i = 0; i < 256; i++) { color_table[i].r = p[i].r; color_table[i].g = p[i].g; color_table[i].b = p[i].b; @@ -1499,15 +1376,12 @@ namespace FSunPackLib std::transform(HVA.begin(), HVA.end(), HVA.begin(), [](unsigned char c) { return std::tolower(c); }); HVA = std::regex_replace(HVA, std::regex(".vxl$"), ".hva"); - if (hMixFile == NULL) - { + if (hMixFile == NULL) { if (open_read(cur_vxl, lpVXLFile)) return FALSE; if (open_read(cur_hva, HVA)) return FALSE; - } - else - { + } else { if (cur_vxl.open(lpVXLFile, mixfiles[hMixFile - 1])) return FALSE; if (cur_hva.open(HVA, mixfiles[hMixFile - 1])) @@ -1539,8 +1413,7 @@ namespace FSunPackLib if (section >= cur_vxl.get_c_section_headers()) return FALSE; - switch (cur_vxl.get_section_tailer(section)->unknown) - { + switch (cur_vxl.get_section_tailer(section)->unknown) { case 1: normalClass = VoxelNormalClass::Gen1; break; @@ -1556,7 +1429,7 @@ namespace FSunPackLib default: normalClass = VoxelNormalClass::Unknown; } - + return TRUE; } @@ -1573,12 +1446,9 @@ namespace FSunPackLib maxVec = minVec = Vec3f(section_tailer.x_min_scale, section_tailer.y_min_scale, section_tailer.z_min_scale); // get projected coordinates of all bounding box corners - for (int x = 0; x < 2; ++x) - { - for (int y = 0; y < 2; ++y) - { - for (int z = 0; z < 2; ++z) - { + for (int x = 0; x < 2; ++x) { + for (int y = 0; y < 2; ++y) { + for (int z = 0; z < 2; ++z) { Vec3f cur = matrix * (Vec3f( x == 0 ? section_tailer.x_min_scale : section_tailer.x_max_scale, y == 0 ? section_tailer.y_min_scale : section_tailer.y_max_scale, @@ -1638,8 +1508,7 @@ namespace FSunPackLib last_succeeded_operation = 11; // output center 2d coordinates - if (i_center_x || i_center_y) - { + if (i_center_x || i_center_y) { Vec3f s_pixel = center + Vec3f(0.0f, 0.f, 0.0f); Vec3f d_pixel = scaledMatrix * s_pixel; @@ -1655,8 +1524,7 @@ namespace FSunPackLib } last_succeeded_operation = 12; - if (i_center_x_zmax || i_center_y_zmax) - { + if (i_center_x_zmax || i_center_y_zmax) { Vec3f s_pixel = center; Vec3f d_pixel = scaledMatrix * s_pixel; @@ -1673,21 +1541,16 @@ namespace FSunPackLib // Vec3f minPixel(1000, 1000, 1000); int j = 0; - for (int y = 0; y < cy1; y++) - { - for (int x = 0; x < cx1; x++) - { + for (int y = 0; y < cy1; y++) { + for (int x = 0; x < cx1; x++) { const byte* r = cur_vxl.get_span_data(iSection, j); - if (r) - { + if (r) { int z = 0; int last_z_reported = -5000; - while (z < cz1) - { + while (z < cz1) { z += *r++; int count = *r++; - while (count--) - { + while (count--) { Vec3f s_pixel = Vec3f(static_cast(x), static_cast(y), static_cast(z)); Vec3f m_pixel = (translateToWorldMatrix * (scaleToWorldMatrix * s_pixel)); assert(minimum(m_pixel, minScale).equals(minScale, 0.001f)); @@ -1700,10 +1563,8 @@ namespace FSunPackLib d_pixel += modelOffset; // minPixel.minimum(d_pixel); - if (x == i3dCenterX && y == i3dCenterY) - { - if (z >= last_z_reported) - { + if (x == i3dCenterX && y == i3dCenterY) { + if (z >= last_z_reported) { last_z_reported = z; if (i_center_x_zmax) *i_center_x_zmax = static_cast(d_pixel.x()); if (i_center_y_zmax) *i_center_y_zmax = static_cast(d_pixel.y()); @@ -1715,8 +1576,7 @@ namespace FSunPackLib int py = static_cast(d_pixel.y() + 0.5f); int ofs = px + rtWidth * py; - if (px >= 0 && py >= 0 && px < rtWidth && py < rtHeight && d_pixel.z() > image_z[ofs]) - { + if (px >= 0 && py >= 0 && px < rtWidth && py < rtHeight && d_pixel.z() > image_z[ofs]) { image[ofs] = *r++; // lighting calc auto normalIndex = *r++; @@ -1727,8 +1587,7 @@ namespace FSunPackLib assert(fabs(normal.squaredLength() - 1.0f) < 0.01f); lighting[ofs] = max(0, static_cast(lightVal * 255.0f)); image_z[ofs] = static_cast(d_pixel.z()); - } - else + } else r += 2;; z++; } @@ -1759,16 +1618,14 @@ namespace FSunPackLib int iBodySection = -1; int iLargestSection = 0; int iLargestVolume = 0; - for (i = 0; i < cur_vxl.get_c_section_tailers(); i++) - { + for (i = 0; i < cur_vxl.get_c_section_tailers(); i++) { const auto& header = cur_vxl.get_section_header(i); const auto& tailer = cur_vxl.get_section_tailer(i); Vec3f secMinVec, secMaxVec; GetVXLSectionBounds(i, rotation, postHVAOffset, secMinVec, secMaxVec); auto extent = secMaxVec - secMinVec; auto volume = static_cast(extent.x() * extent.y() * extent.z()); - if (volume >= iLargestVolume) - { + if (volume >= iLargestVolume) { iLargestVolume = volume; iLargestSection = i; } @@ -1803,8 +1660,7 @@ namespace FSunPackLib int x_center = 0, y_center = 0; int x_center_zmax = 0, y_center_zmax = 0; - for (i = 0; i < cur_vxl.get_c_section_headers(); i++) - { + for (i = 0; i < cur_vxl.get_c_section_headers(); i++) { auto iNormalTable = cur_vxl.get_section_tailer(i)->unknown; const auto& normalTable = normalTables.isValidTable(iNormalTable) ? normalTables.getTable(iNormalTable) : emptyNormalTable; if (i != iMainSection) @@ -1853,8 +1709,7 @@ namespace FSunPackLib BOOL bUseGDI = FALSE; - if (pf.dwFlags & DDPF_RGB && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) - { + if (pf.dwFlags & DDPF_RGB && pf.dwRBitMask && pf.dwGBitMask && pf.dwBBitMask) { CreateConvLookUpTable(pf, hPalette); @@ -1869,14 +1724,12 @@ namespace FSunPackLib memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); ddsd.dwSize = sizeof(DDSURFACEDESC2); - if (pdds[0]->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) - { + if (pdds[0]->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT | DDLOCK_NOSYSLOCK, NULL) == DD_OK) { pitch = ddsd.lPitch; BYTE* dest = (BYTE*)ddsd.lpSurface; - if (dest) - { + if (dest) { int bytesize = (pf.dwRGBBitCount + 1) / 8; if (bytesize < 1) bytesize = 1; @@ -1889,24 +1742,18 @@ namespace FSunPackLib int k, e; //HDC dc; //pdds[0]->GetDC(&dc); - for (k = 0;k < rtWidth;k++) - { - for (e = 0;e < rtHeight;e++) - { + for (k = 0; k < rtWidth; k++) { + for (e = 0; e < rtHeight; e++) { //t_palet_entry p=ts_palettes[hPalette-1][image[k+e*cl_max]]; - if (k >= left && e >= top && k < right && e < bottom) - { + if (k >= left && e >= top && k < right && e < bottom) { //SetPixel(dc, k-left, e-top, RGB(p.r, p.g, p.b) ); DWORD dwWrite = k * bytesize + e * ddsd.lPitch; int pos = k + e * rtWidth; - if (pos < c_pixels && image[pos] != 0) - { + if (pos < c_pixels && image[pos] != 0) { DWORD col = conv_color[hPalette - 1][image[k + e * rtWidth]]; memcpy(&dest[dwWrite], &col, bytesize); - } - else - { + } else { DWORD col = transp_conv_color[hPalette - 1]; memcpy(&dest[dwWrite], &col, bytesize); } @@ -1921,13 +1768,10 @@ namespace FSunPackLib } pdds[0]->Unlock(NULL); - } - else bUseGDI = TRUE; - } - else bUseGDI = TRUE; + } else bUseGDI = TRUE; + } else bUseGDI = TRUE; - if (bUseGDI) - { + if (bUseGDI) { HDC hDC; while (pdds[0]->GetDC(&hDC) == DDERR_WASSTILLDRAWING); @@ -1936,24 +1780,18 @@ namespace FSunPackLib int k, e; //HDC dc; //pdds[0]->GetDC(&dc); - for (k = 0;k < rtWidth;k++) - { - for (e = 0;e < rtHeight;e++) - { + for (k = 0; k < rtWidth; k++) { + for (e = 0; e < rtHeight; e++) { //t_palet_entry p=ts_palettes[hPalette-1][image[k+e*cl_max]]; - if (k >= left && e >= top && k < right && e < bottom) - { + if (k >= left && e >= top && k < right && e < bottom) { //SetPixel(dc, k-left, e-top, RGB(p.r, p.g, p.b) ); //DWORD dwWrite=k*bytesize+e*ddsd.lPitch; int pos = k + e * rtWidth; - if (pos < c_pixels && image[pos] != 0) - { + if (pos < c_pixels && image[pos] != 0) { t_palet_entry& p = ts_palettes[hPalette - 1][image[k + e * rtWidth]]; SetPixel(hDC, k, e, RGB(p.r, p.g, p.b)); - } - else - { + } else { SetPixel(hDC, k, e, RGB(245, 245, 245)); } @@ -1994,16 +1832,14 @@ namespace FSunPackLib int iBodySection = -1; int iLargestSection = 0; int iLargestVolume = 0; - for (i = 0; i < cur_vxl.get_c_section_tailers(); i++) - { + for (i = 0; i < cur_vxl.get_c_section_tailers(); i++) { const auto& header = cur_vxl.get_section_header(i); const auto& tailer = cur_vxl.get_section_tailer(i); Vec3f secMinVec, secMaxVec; GetVXLSectionBounds(i, rotation, modelOffset, secMinVec, secMaxVec); auto extent = secMaxVec - secMinVec; auto volume = static_cast(extent.x() * extent.y() * extent.z()); - if (volume >= iLargestVolume) - { + if (volume >= iLargestVolume) { iLargestVolume = volume; iLargestSection = i; } @@ -2037,8 +1873,7 @@ namespace FSunPackLib int x_center = 0, y_center = 0; int x_center_zmax = 0, y_center_zmax = 0; - for (i = 0; i < cur_vxl.get_c_section_headers(); i++) - { + for (i = 0; i < cur_vxl.get_c_section_headers(); i++) { auto iNormalTable = cur_vxl.get_section_tailer(i)->unknown; const auto& normalTable = normalTables.isValidTable(iNormalTable) ? normalTables.getTable(iNormalTable) : emptyNormalTable; if (i != iMainSection) @@ -2064,8 +1899,7 @@ namespace FSunPackLib int width = right - left; int height = bottom - top; - if (vxlrect) - { + if (vxlrect) { vxlrect->left = 0; vxlrect->right = width; vxlrect->bottom = height; @@ -2074,21 +1908,18 @@ namespace FSunPackLib #ifdef _DEBUG // draw lines around RT - for (i = 0; i < width; ++i) - { + for (i = 0; i < width; ++i) { lighting[i] = 1; lighting[i + (height - 1) * width] = 1; image[i] = 1; image[i + (height - 1) * width] = 1; } - for (i = 0; i < height; ++i) - { + for (i = 0; i < height; ++i) { image[i * width + width - 1] = 1; image[i * width] = 1; } // draw center - if (x_center > 0 && y_center > 0 && x_center < width - 1 && y_center < height - 1) - { + if (x_center > 0 && y_center > 0 && x_center < width - 1 && y_center < height - 1) { image[x_center + y_center * width] = 1; image[x_center - 1 + y_center * width] = 1; image[x_center + 1 + y_center * width] = 1; @@ -2103,7 +1934,7 @@ namespace FSunPackLib return TRUE; } - + HTSPALETTE LoadTSPalette(const std::string& szPalette, HMIXFILE hPaletteOwner) { @@ -2112,23 +1943,17 @@ namespace FSunPackLib if (dwPalCount > 255) return NULL; - if (hPaletteOwner == NULL) - { + if (hPaletteOwner == NULL) { if (open_read(pal, szPalette)) return NULL; - } - else - { - if (szPalette[0] == '_' && szPalette[1] == 'I' && szPalette[2] == 'D') - { + } else { + if (szPalette[0] == '_' && szPalette[1] == 'I' && szPalette[2] == 'D') { char id[256]; strcpy_s(id, &szPalette[3]); int iId = atoi(id); if (pal.open(iId, mixfiles[hPaletteOwner - 1])) return NULL; - } - else - { + } else { if (pal.open(szPalette, mixfiles[hPaletteOwner - 1]) != 0) return NULL; } @@ -2148,7 +1973,7 @@ namespace FSunPackLib pal.close(); return dwPalCount; - + } HTSPALETTE LoadTSPalette(LPCSTR szPalette, HMIXFILE hPaletteOwner) @@ -2160,14 +1985,12 @@ namespace FSunPackLib { if (hPalette == NULL || hPalette > dwPalCount) return FALSE; - if (orig != NULL) - { + if (orig != NULL) { orig->rgbtRed = ts_palettes[hPalette - 1][bIndex].r; orig->rgbtGreen = ts_palettes[hPalette - 1][bIndex].g; orig->rgbtBlue = ts_palettes[hPalette - 1][bIndex].b; } - if (rgb != NULL) - { + if (rgb != NULL) { ts_palettes[hPalette - 1][bIndex].r = rgb->rgbtRed; ts_palettes[hPalette - 1][bIndex].g = rgb->rgbtGreen; ts_palettes[hPalette - 1][bIndex].b = rgb->rgbtBlue; @@ -2182,8 +2005,7 @@ namespace FSunPackLib t_game GameToXCCGame(FSunPackLib::Game game) { t_game xcc_game(game_unknown); - switch (game) - { + switch (game) { case TS: xcc_game = game_ts; break; @@ -2210,13 +2032,11 @@ namespace FSunPackLib Cmix_file_write mix(GameToXCCGame(game)); DWORD i; - for (i = 0;i < dwFileCount;i++) - { + for (i = 0; i < dwFileCount; i++) { LPCSTR lpFile = lpFiles[i]; Cvirtual_binary file = Cvirtual_binary(std::string(lpFile)); - if (file.data()) - { + if (file.data()) { mix.add_file(lpFile, file); } } diff --git a/MissionEditorPackLib/MissionEditorPackLib.h b/MissionEditorPackLib/MissionEditorPackLib.h index dac3524..ef73036 100644 --- a/MissionEditorPackLib/MissionEditorPackLib.h +++ b/MissionEditorPackLib/MissionEditorPackLib.h @@ -63,13 +63,13 @@ namespace FSunPackLib TS_FS }; - enum class VoxelNormalClass: std::uint8_t + enum class VoxelNormalClass : std::uint8_t { Unknown = 0, Gen1 = 1, TS = 2, Gen3 = 3, - RA2 = 4, + RA2 = 4, }; extern "C" extern bool _DEBUG_EnableLogs; // only useable in debug library builds @@ -95,61 +95,61 @@ namespace FSunPackLib std::shared_ptr m_impl; }; -// base 64 -/* -Converts hex data to Base64 data. -sp - source poINTer -len - length of hex data -Returns a poINTer to the base64 data. Caller must free this memory. -*/ + // base 64 + /* + Converts hex data to Base64 data. + sp - source poINTer + len - length of hex data + Returns a poINTer to the base64 data. Caller must free this memory. + */ BYTE* EncodeBase64(BYTE* sp, UINT len); -/* -Converts Base64 data to hex data. -sp - source poINTer -dp - dest buffer (should be as large as sp) -Returns the hex data length -*/ + /* + Converts Base64 data to hex data. + sp - source poINTer + dp - dest buffer (should be as large as sp) + Returns the hex data length + */ size_t DecodeBase64(const char* sp, std::vector& dest); -// format 80 -/* -Pack to a simple format 80 pack like Overlay & OverlayData-Pack -sp - source poINTer (should be the 262144 bytes for overlay & overlaydata) -len - length of the source data (should be 262144) -nSections - section count. should be 32 -dest - poINTer to dest poINTer. Function allocates memory, caller must free this memory. -Returns the length of the packed data. -*/ + // format 80 + /* + Pack to a simple format 80 pack like Overlay & OverlayData-Pack + sp - source poINTer (should be the 262144 bytes for overlay & overlaydata) + len - length of the source data (should be 262144) + nSections - section count. should be 32 + dest - poINTer to dest poINTer. Function allocates memory, caller must free this memory. + Returns the length of the packed data. + */ INT EncodeF80(BYTE* sp, UINT len, UINT nSections, BYTE** dest); -/* -Extracts a simple format 80 pack like the Overlay & OverlayData-Pack -Note that it extracts a whole pack, not just a simple section. -In order to simply decode/encode Format80, you should use ConvertFromF80 and ConvertToF80 - sp - source poINTer -SourceLength - length of the source - dp - dest buffer - max_size - maximum allowed destination size -*/ + /* + Extracts a simple format 80 pack like the Overlay & OverlayData-Pack + Note that it extracts a whole pack, not just a simple section. + In order to simply decode/encode Format80, you should use ConvertFromF80 and ConvertToF80 + sp - source poINTer + SourceLength - length of the source + dp - dest buffer + max_size - maximum allowed destination size + */ bool DecodeF80(const BYTE* sp, UINT SourceLength, std::vector& dp, std::size_t max_size); -// IsoMapPack5 -/* -Pack IsoMapPack5. -sp - source poINTer -SourceLength - length of source -dp - destination buffer -Returns size of packed data -*/ + // IsoMapPack5 + /* + Pack IsoMapPack5. + sp - source poINTer + SourceLength - length of source + dp - destination buffer + Returns size of packed data + */ UINT EncodeIsoMapPack5(BYTE* sp, UINT SourceLength, BYTE** dp); -/* -Unpack IsoMapPack5. -sp - source poINTer -SourceLength - length of source -dp - destination buffer -*/ + /* + Unpack IsoMapPack5. + sp - source poINTer + SourceLength - length of source + dp - destination buffer + */ UINT DecodeIsoMapPack5(BYTE* sp, UINT SourceLength, BYTE* dp, HWND hProgressBar, BOOL bDebugMode); BOOL XCC_Initialize(BOOL bUseCache); @@ -171,9 +171,9 @@ dp - destination buffer BOOL XCC_GetSHPHeader(SHPHEADER* pHeader); -/* -Returns the SHP image header of a image in a SHP file -*/ + /* + Returns the SHP image header of a image in a SHP file + */ BOOL XCC_GetSHPImageHeader(int iImageIndex, SHPIMAGEHEADER* pImageHeader); diff --git a/MissionEditorPackLib/Vec3.h b/MissionEditorPackLib/Vec3.h index 70a5969..5781794 100644 --- a/MissionEditorPackLib/Vec3.h +++ b/MissionEditorPackLib/Vec3.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -26,207 +26,207 @@ template class Vec3 { public: - Vec3() = default; - Vec3(T x, T y, T z) : v{ x, y, z } - { - } - Vec3(T v_[3]) : v{ v_[0], v_[1], v_[2] } - { - } + Vec3() = default; + Vec3(T x, T y, T z) : v{ x, y, z } + { + } + Vec3(T v_[3]) : v{ v_[0], v_[1], v_[2] } + { + } - T& operator[](unsigned int i) { - assert(i < 3); - return v[i]; - } + T& operator[](unsigned int i) { + assert(i < 3); + return v[i]; + } - const T& operator[](unsigned int i) const { - assert(i < 3); - return v[i]; - } + const T& operator[](unsigned int i) const { + assert(i < 3); + return v[i]; + } - inline T dot(const Vec3& other) const { - return v[0] * other.v[0] + v[1] * other.v[1] + v[2] * other.v[2]; - } + inline T dot(const Vec3& other) const { + return v[0] * other.v[0] + v[1] * other.v[1] + v[2] * other.v[2]; + } - inline T length() const - { - return static_cast(sqrt(squaredLength())); - } + inline T length() const + { + return static_cast(sqrt(squaredLength())); + } - inline T squaredLength() const - { - return dot(*this); - } + inline T squaredLength() const + { + return dot(*this); + } - inline Vec3& normalize() - { - T invL = T(1) / length(); - v[0] *= invL; - v[1] *= invL; - v[2] *= invL; - return *this; - } + inline Vec3& normalize() + { + T invL = T(1) / length(); + v[0] *= invL; + v[1] *= invL; + v[2] *= invL; + return *this; + } - inline Vec3& negate() - { - v[0] = -v[0]; - v[1] = -v[1]; - v[2] = -v[2]; - return *this; - } + inline Vec3& negate() + { + v[0] = -v[0]; + v[1] = -v[1]; + v[2] = -v[2]; + return *this; + } - inline Vec3& inverse() - { - v[0] = T(1) / v[0]; - v[1] = T(1) / v[1]; - v[2] = T(1) / v[2]; - return *this; - } + inline Vec3& inverse() + { + v[0] = T(1) / v[0]; + v[1] = T(1) / v[1]; + v[2] = T(1) / v[2]; + return *this; + } - inline Vec3& minimum(const Vec3& v2) - { - v[0] = min(v[0], v2[0]); - v[1] = min(v[1], v2[1]); - v[2] = min(v[2], v2[2]); - return *this; - } + inline Vec3& minimum(const Vec3& v2) + { + v[0] = min(v[0], v2[0]); + v[1] = min(v[1], v2[1]); + v[2] = min(v[2], v2[2]); + return *this; + } - inline Vec3& maximum(const Vec3& v2) - { - v[0] = max(v[0], v2[0]); - v[1] = max(v[1], v2[1]); - v[2] = max(v[2], v2[2]); - return *this; - } + inline Vec3& maximum(const Vec3& v2) + { + v[0] = max(v[0], v2[0]); + v[1] = max(v[1], v2[1]); + v[2] = max(v[2], v2[2]); + return *this; + } - inline Vec3& operator *=(const Vec3& v2) { - v[0] *= v2[0]; - v[1] *= v2[1]; - v[2] *= v2[2]; - return *this; - } + inline Vec3& operator *=(const Vec3& v2) { + v[0] *= v2[0]; + v[1] *= v2[1]; + v[2] *= v2[2]; + return *this; + } - inline Vec3& operator *=(const T scale) { - v[0] *= scale; - v[1] *= scale; - v[2] *= scale; - return *this; - } + inline Vec3& operator *=(const T scale) { + v[0] *= scale; + v[1] *= scale; + v[2] *= scale; + return *this; + } - inline Vec3& operator /=(const Vec3& v2) { - v[0] /= v2[0]; - v[1] /= v2[1]; - v[2] /= v2[2]; - return *this; - } + inline Vec3& operator /=(const Vec3& v2) { + v[0] /= v2[0]; + v[1] /= v2[1]; + v[2] /= v2[2]; + return *this; + } - inline Vec3& operator /=(const T scale) { - v[0] /= scale; - v[1] /= scale; - v[2] /= scale; - return *this; - } + inline Vec3& operator /=(const T scale) { + v[0] /= scale; + v[1] /= scale; + v[2] /= scale; + return *this; + } - inline Vec3& operator +=(const Vec3& other) { - v[0] += other.v[0]; - v[1] += other.v[1]; - v[2] += other.v[2]; - return *this; - } + inline Vec3& operator +=(const Vec3& other) { + v[0] += other.v[0]; + v[1] += other.v[1]; + v[2] += other.v[2]; + return *this; + } - inline Vec3& operator -=(const Vec3& other) { - v[0] -= other.v[0]; - v[1] -= other.v[1]; - v[2] -= other.v[2]; - return *this; - } + inline Vec3& operator -=(const Vec3& other) { + v[0] -= other.v[0]; + v[1] -= other.v[1]; + v[2] -= other.v[2]; + return *this; + } - inline bool equals(const Vec3& other, T epsilon=T(0.001)) - { - return fabs(v[0] - other.v[0]) <= epsilon && fabs(v[1] - other.v[1]) <= epsilon && fabs(v[2] - other.v[2]) <= epsilon; - } + inline bool equals(const Vec3& other, T epsilon = T(0.001)) + { + return fabs(v[0] - other.v[0]) <= epsilon && fabs(v[1] - other.v[1]) <= epsilon && fabs(v[2] - other.v[2]) <= epsilon; + } - T x() const { return v[0]; } - T y() const { return v[1]; } - T z() const { return v[2]; } + T x() const { return v[0]; } + T y() const { return v[1]; } + T z() const { return v[2]; } - T v[3] = { 0, 0, 0 }; + T v[3] = { 0, 0, 0 }; }; template< class T> inline Vec3 operator+(const Vec3& l, const Vec3& r) { - auto res = l; - res += r; - return res; + auto res = l; + res += r; + return res; } template< class T> inline Vec3 operator-(const Vec3& l, const Vec3& r) { - auto res = l; - res -= r; - return res; + auto res = l; + res -= r; + return res; } template< class T> inline Vec3 normalize(Vec3 v) { - return v.normalize(); + return v.normalize(); } template< class T> inline Vec3 negate(Vec3 v) { - return v.negate(); + return v.negate(); } template< class T> inline Vec3 inverse(Vec3 v) { - return v.inverse(); + return v.inverse(); } template< class T> inline Vec3 minimum(Vec3 v, const Vec3& v2) { - v.minimum(v2); - return v; + v.minimum(v2); + return v; } template< class T> inline Vec3 maximum(Vec3 v, const Vec3& v2) { - v.maximum(v2); - return v; + v.maximum(v2); + return v; } template< class T> inline Vec3 operator /(Vec3 v, T scale) { - v /= scale; - return v; + v /= scale; + return v; } template< class T> inline Vec3 operator *(Vec3 v, Vec3 v2) { - v *= v2; - return v; + v *= v2; + return v; } template< class T> inline Vec3 operator /(Vec3 v, Vec3 v2) { - v /= v2; - return v; + v /= v2; + return v; } template< class T> inline Vec3 operator *(Vec3 v, T scale) { - v *= scale; - return v; + v *= scale; + return v; } typedef Vec3 Vec3f; @@ -236,86 +236,82 @@ template class Matrix3_4 { public: - Matrix3_4(const T (&m_)[3][4]) - { - for (int row = 0; row < 3; ++row) - { - for (int col = 0; col < 4; ++col) - { - m[row][col] = m_[row][col]; - } - } - } + Matrix3_4(const T(&m_)[3][4]) + { + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 4; ++col) { + m[row][col] = m_[row][col]; + } + } + } - Matrix3_4(const T* m_) - { - for (int row = 0; row < 3; ++row) - { - for (int col = 0; col < 4; ++col) - { - m[row][col] = m_[row * 4 + col]; - } - } - } - - Vec3 operator *(const Vec3 v) const - { - auto x = v[0]; - auto y = v[1]; - auto z = v[2]; - return Vec3( - x * m[0][0] + y * m[0][1] + z * m[0][2] + m[0][3], - x * m[1][0] + y * m[1][1] + z * m[1][2] + m[1][3], - x * m[2][0] + y * m[2][1] + z * m[2][2] + m[2][3] - ); - } + Matrix3_4(const T* m_) + { + for (int row = 0; row < 3; ++row) { + for (int col = 0; col < 4; ++col) { + m[row][col] = m_[row * 4 + col]; + } + } + } - Matrix3_4& scaledColumn(unsigned int iColumn, T scale) - { - assert(iColumn < 4); - m[0][iColumn] *= scale; - m[1][iColumn] *= scale; - m[2][iColumn] *= scale; - return *this; - } + Vec3 operator *(const Vec3 v) const + { + auto x = v[0]; + auto y = v[1]; + auto z = v[2]; + return Vec3( + x * m[0][0] + y * m[0][1] + z * m[0][2] + m[0][3], + x * m[1][0] + y * m[1][1] + z * m[1][2] + m[1][3], + x * m[2][0] + y * m[2][1] + z * m[2][2] + m[2][3] + ); + } - Matrix3_4 scaleColumn(unsigned int iColumn, T scale) const - { - assert(iColumn < 4); - Matrix3_4 copy(*this); - copy.m[0][iColumn] *= scale; - copy.m[1][iColumn] *= scale; - copy.m[2][iColumn] *= scale; - return copy; - } + Matrix3_4& scaledColumn(unsigned int iColumn, T scale) + { + assert(iColumn < 4); + m[0][iColumn] *= scale; + m[1][iColumn] *= scale; + m[2][iColumn] *= scale; + return *this; + } - Matrix3_4& setColumn(unsigned int iColumn, const Vec3& v) - { - assert(iColumn < 4); - m[0][iColumn] = v[0]; - m[1][iColumn] = v[1]; - m[2][iColumn] = v[2]; - return *this; - } + Matrix3_4 scaleColumn(unsigned int iColumn, T scale) const + { + assert(iColumn < 4); + Matrix3_4 copy(*this); + copy.m[0][iColumn] *= scale; + copy.m[1][iColumn] *= scale; + copy.m[2][iColumn] *= scale; + return copy; + } - Vec3f getColumn(unsigned int iColumn) const - { - assert(iColumn < 4); - return Vec3f(m[0][iColumn], m[1][iColumn], m[2][iColumn]); - } + Matrix3_4& setColumn(unsigned int iColumn, const Vec3& v) + { + assert(iColumn < 4); + m[0][iColumn] = v[0]; + m[1][iColumn] = v[1]; + m[2][iColumn] = v[2]; + return *this; + } - static Matrix3_4 translation(const Vec3 v) - { - return Matrix3_4({ {1, 0, 0, v.x()}, {0, 1, 0, v.y()}, {0, 0, 1, v.z()}}); - } + Vec3f getColumn(unsigned int iColumn) const + { + assert(iColumn < 4); + return Vec3f(m[0][iColumn], m[1][iColumn], m[2][iColumn]); + } - static Matrix3_4 scale(const Vec3 v) - { - return Matrix3_4({ {v.x(), 0, 0, 0}, {0, v.y(), 0, 0}, {0, 0, v.z(), 0}}); - } + static Matrix3_4 translation(const Vec3 v) + { + return Matrix3_4({ {1, 0, 0, v.x()}, {0, 1, 0, v.y()}, {0, 0, 1, v.z()} }); + } + + static Matrix3_4 scale(const Vec3 v) + { + return Matrix3_4({ {v.x(), 0, 0, 0}, {0, v.y(), 0, 0}, {0, 0, v.z(), 0} }); + } public: - T m[3][4] = { {1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, 1, 1}}; + T m[3][4] = { {1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, 1, 1} }; }; typedef Matrix3_4 Matrix3_4f; \ No newline at end of file diff --git a/MissionEditorPackLib/VoxelNormals.cpp b/MissionEditorPackLib/VoxelNormals.cpp index 97e4281..7aa7d85 100644 --- a/MissionEditorPackLib/VoxelNormals.cpp +++ b/MissionEditorPackLib/VoxelNormals.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "stdafx.h" @@ -26,78 +26,70 @@ template T read(std::istream& s) { - T t; - auto p1 = s.tellg(); - auto n = sizeof(T); - s.read(reinterpret_cast(&t), sizeof(T)); - auto p2 = s.tellg(); - auto p3 = p2 - p1; - //s >> t; - return t; + T t; + auto p1 = s.tellg(); + auto n = sizeof(T); + s.read(reinterpret_cast(&t), sizeof(T)); + auto p2 = s.tellg(); + auto p3 = p2 - p1; + //s >> t; + return t; }; template std::array read(std::istream& s) { - std::array t; - s.read(reinterpret_cast(t.data()), sizeof(T) * N); - return t; + std::array t; + s.read(reinterpret_cast(t.data()), sizeof(T) * N); + return t; }; VoxelNormalTable::VoxelNormalTable(std::istream& f) { - auto oldEx = f.exceptions(); - f.exceptions(f.failbit | f.badbit); - try - { - load(f); - } - catch (const std::exception& ex) - { - f.exceptions(oldEx); - throw ex; - } - + auto oldEx = f.exceptions(); + f.exceptions(f.failbit | f.badbit); + try { + load(f); + } catch (const std::exception& ex) { + f.exceptions(oldEx); + throw ex; + } + } void VoxelNormalTable::load(std::istream& f) { - auto count = read(f); - m_normals.clear(); - m_normals.reserve(count); - for (auto i = 0; i < count; ++i) - { - auto v = read(f); - m_normals.push_back(Vec3f(v.data())); - } + auto count = read(f); + m_normals.clear(); + m_normals.reserve(count); + for (auto i = 0; i < count; ++i) { + auto v = read(f); + m_normals.push_back(Vec3f(v.data())); + } } VoxelNormalTables::VoxelNormalTables(std::istream& f) { - auto oldEx = f.exceptions(); - f.exceptions(f.failbit | f.badbit); - try - { + auto oldEx = f.exceptions(); + f.exceptions(f.failbit | f.badbit); + try { - load(f); - - } - catch(const std::exception& ex) - { - f.exceptions(oldEx); - throw ex; - } + load(f); + + } catch (const std::exception& ex) { + f.exceptions(oldEx); + throw ex; + } } void VoxelNormalTables::load(std::istream& f) { - auto tableCount = read(f); - for (std::uint32_t i = 0; i < tableCount; ++i) - { - auto normalClass = read(f); - VoxelNormalTable table(f); - auto normalIndex = normalClass - 1; - m_tables.resize(std::max(m_tables.size(), static_cast(normalClass))); - m_tables[normalIndex] = std::move(table); - } + auto tableCount = read(f); + for (std::uint32_t i = 0; i < tableCount; ++i) { + auto normalClass = read(f); + VoxelNormalTable table(f); + auto normalIndex = normalClass - 1; + m_tables.resize(std::max(m_tables.size(), static_cast(normalClass))); + m_tables[normalIndex] = std::move(table); + } } diff --git a/MissionEditorPackLib/VoxelNormals.h b/MissionEditorPackLib/VoxelNormals.h index b589cb3..989f9e7 100644 --- a/MissionEditorPackLib/VoxelNormals.h +++ b/MissionEditorPackLib/VoxelNormals.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #pragma once @@ -27,47 +27,47 @@ class VoxelNormalTable { public: - VoxelNormalTable() = default; - VoxelNormalTable(std::istream& f); - VoxelNormalTable(VoxelNormalTable&& other) noexcept = default; - VoxelNormalTable& operator=(const VoxelNormalTable& other) = default; - VoxelNormalTable& operator=(VoxelNormalTable&& other) noexcept = default; + VoxelNormalTable() = default; + VoxelNormalTable(std::istream& f); + VoxelNormalTable(VoxelNormalTable&& other) noexcept = default; + VoxelNormalTable& operator=(const VoxelNormalTable& other) = default; + VoxelNormalTable& operator=(VoxelNormalTable&& other) noexcept = default; - Vec3f operator[] (unsigned int iNormal) const - { - return iNormal < m_normals.size() ? m_normals[iNormal] : Vec3f(0, 1, 0); - } + Vec3f operator[] (unsigned int iNormal) const + { + return iNormal < m_normals.size() ? m_normals[iNormal] : Vec3f(0, 1, 0); + } private: - void load(std::istream& f); + void load(std::istream& f); private: - std::vector m_normals; + std::vector m_normals; }; class VoxelNormalTables { public: - VoxelNormalTables() = default; - VoxelNormalTables(std::istream& f); + VoxelNormalTables() = default; + VoxelNormalTables(std::istream& f); - bool isValidTable(const std::uint8_t normalClass) const - { - return normalClass > 0 && normalClass <= m_tables.size(); - } + bool isValidTable(const std::uint8_t normalClass) const + { + return normalClass > 0 && normalClass <= m_tables.size(); + } - // Returns the given normal table. Throws on invalid normalClass. - const VoxelNormalTable& getTable(const std::uint8_t normalClass) const - { - if (!isValidTable(normalClass)) - throw std::range_error("Table for normal class does not exist"); - return m_tables[normalClass - 1]; - } + // Returns the given normal table. Throws on invalid normalClass. + const VoxelNormalTable& getTable(const std::uint8_t normalClass) const + { + if (!isValidTable(normalClass)) + throw std::range_error("Table for normal class does not exist"); + return m_tables[normalClass - 1]; + } private: - void load(std::istream& f); + void load(std::istream& f); private: - // we use a vector instead of map for fast lookup - std::vector m_tables; + // we use a vector instead of map for fast lookup + std::vector m_tables; }; diff --git a/UnitTest/CIni_Test.cpp b/UnitTest/CIni_Test.cpp index c22031b..fc2a8de 100644 --- a/UnitTest/CIni_Test.cpp +++ b/UnitTest/CIni_Test.cpp @@ -13,17 +13,17 @@ class IniTestHelper iniFile.close(); } - public : - IniTestHelper(std::string&& name, const char* pContent) : - m_fileName(std::move(name)) - { - ASSERT(!m_fileName.empty()); - ASSERT(pContent != nullptr); - writeDownContent(pContent); - } - ~IniTestHelper() { - remove(m_fileName.c_str()); - } +public: + IniTestHelper(std::string&& name, const char* pContent) : + m_fileName(std::move(name)) + { + ASSERT(!m_fileName.empty()); + ASSERT(pContent != nullptr); + writeDownContent(pContent); + } + ~IniTestHelper() { + remove(m_fileName.c_str()); + } }; diff --git a/UnitTest/StdAfx.h b/UnitTest/StdAfx.h index 6addd5a..457cae7 100644 --- a/UnitTest/StdAfx.h +++ b/UnitTest/StdAfx.h @@ -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 . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ // stdafx.h : include everything that should be available everywhere in the code