mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-04-30 17:11:40 -04:00
code reformatted .
This commit is contained in:
parent
76d336504f
commit
1de6ad56c2
265 changed files with 18240 additions and 21591 deletions
24
3rdParty/xcc/Library/StdAfx.cpp
vendored
24
3rdParty/xcc/Library/StdAfx.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
|
24
3rdParty/xcc/Library/StdAfx.h
vendored
24
3rdParty/xcc/Library/StdAfx.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
78
3rdParty/xcc/misc/blowfish.cpp
vendored
78
3rdParty/xcc/misc/blowfish.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <memory.h>
|
||||
|
||||
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<const uint32_t*>(s);
|
||||
uint32_t* w = reinterpret_cast<uint32_t*>(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<const uint32_t*>(s);
|
||||
uint32_t* w = reinterpret_cast<uint32_t*>(d);
|
||||
size >>= 3;
|
||||
while (size--)
|
||||
{
|
||||
while (size--) {
|
||||
uint32_t a = reverse(*r++);
|
||||
uint32_t b = reverse(*r++);
|
||||
decipher(a, b);
|
||||
|
|
24
3rdParty/xcc/misc/blowfish.h
vendored
24
3rdParty/xcc/misc/blowfish.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
695
3rdParty/xcc/misc/cc_file.cpp
vendored
695
3rdParty/xcc/misc/cc_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<int>(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<int>(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
|
||||
|
|
58
3rdParty/xcc/misc/cc_file.h
vendored
58
3rdParty/xcc/misc/cc_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
{
|
||||
|
|
32
3rdParty/xcc/misc/cc_file_sh.h
vendored
32
3rdParty/xcc/misc/cc_file_sh.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -24,8 +24,8 @@ template <class T>
|
|||
class Ccc_file_sh : public Ccc_file_small
|
||||
{
|
||||
public:
|
||||
const T& header() const
|
||||
{
|
||||
return *reinterpret_cast<const T*>(data());
|
||||
}
|
||||
const T& header() const
|
||||
{
|
||||
return *reinterpret_cast<const T*>(data());
|
||||
}
|
||||
};
|
||||
|
|
26
3rdParty/xcc/misc/cc_file_small.h
vendored
26
3rdParty/xcc/misc/cc_file_small.h
vendored
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cc_file.h>
|
||||
|
||||
class Ccc_file_small : public Ccc_file
|
||||
class Ccc_file_small : public Ccc_file
|
||||
{
|
||||
public:
|
||||
Ccc_file_small() : Ccc_file(true)
|
||||
|
|
46
3rdParty/xcc/misc/cc_structures.cpp
vendored
46
3rdParty/xcc/misc/cc_structures.cpp
vendored
|
@ -1,40 +1,40 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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",
|
||||
};
|
||||
|
|
104
3rdParty/xcc/misc/cc_structures.h
vendored
104
3rdParty/xcc/misc/cc_structures.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
24
3rdParty/xcc/misc/crc.h
vendored
24
3rdParty/xcc/misc/crc.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
32
3rdParty/xcc/misc/ddpf_conversion.cpp
vendored
32
3rdParty/xcc/misc/ddpf_conversion.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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)
|
||||
|
|
24
3rdParty/xcc/misc/ddpf_conversion.h
vendored
24
3rdParty/xcc/misc/ddpf_conversion.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
30
3rdParty/xcc/misc/file32.cpp
vendored
30
3rdParty/xcc/misc/file32.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<void>(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<void>(d, UnmapViewOfFile)) : Cvirtual_binary();
|
||||
}
|
||||
|
||||
Cvirtual_binary file32_read(const string& name)
|
||||
|
|
24
3rdParty/xcc/misc/file32.h
vendored
24
3rdParty/xcc/misc/file32.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
45
3rdParty/xcc/misc/fname.cpp
vendored
45
3rdParty/xcc/misc/fname.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
26
3rdParty/xcc/misc/fname.h
vendored
26
3rdParty/xcc/misc/fname.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
59
3rdParty/xcc/misc/hva_file.cpp
vendored
59
3rdParty/xcc/misc/hva_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<char*>(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<float*>(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);
|
||||
|
|
24
3rdParty/xcc/misc/hva_file.h
vendored
24
3rdParty/xcc/misc/hva_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
48
3rdParty/xcc/misc/id_log.cpp
vendored
48
3rdParty/xcc/misc/id_log.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<const int*>(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, "");
|
||||
|
|
24
3rdParty/xcc/misc/id_log.h
vendored
24
3rdParty/xcc/misc/id_log.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
28
3rdParty/xcc/misc/image_file.h
vendored
28
3rdParty/xcc/misc/image_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -29,7 +29,7 @@ class Cimage_file : public Cvideo_file<T>
|
|||
{
|
||||
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;
|
||||
|
|
189
3rdParty/xcc/misc/mix_decode.cpp
vendored
189
3rdParty/xcc/misc/mix_decode.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<byte> d)
|
||||
{
|
||||
static bool public_key_initialized = false;
|
||||
if (!public_key_initialized)
|
||||
{
|
||||
if (!public_key_initialized) {
|
||||
init_pubkey();
|
||||
public_key_initialized = true;
|
||||
}
|
||||
|
|
24
3rdParty/xcc/misc/mix_decode.h
vendored
24
3rdParty/xcc/misc/mix_decode.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
168
3rdParty/xcc/misc/mix_file.cpp
vendored
168
3rdParty/xcc/misc/mix_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdafx.h>
|
||||
|
@ -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<byte, cb_mix_key> key;
|
||||
get_blowfish_key(data + 4, key);
|
||||
|
@ -69,9 +68,7 @@ bool Cmix_file::is_valid()
|
|||
t_mix_header* header = reinterpret_cast<t_mix_header*>(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<const t_mix_header*>(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<int>(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<byte, cb_mix_key> 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<byte*>(&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<t_game>(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<t_game>(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<int, int>;
|
||||
|
||||
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<char>(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<char>(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<unsigned int>(name[i++]) << 24;
|
||||
|
|
30
3rdParty/xcc/misc/mix_file.h
vendored
30
3rdParty/xcc/misc/mix_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
27
3rdParty/xcc/misc/mix_file_write.cpp
vendored
27
3rdParty/xcc/misc/mix_file_write.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
@ -63,8 +63,7 @@ int Cmix_file_write::write(byte* d) const
|
|||
t_mix_index_entry* index = reinterpret_cast<t_mix_index_entry*>(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();
|
||||
|
|
26
3rdParty/xcc/misc/mix_file_write.h
vendored
26
3rdParty/xcc/misc/mix_file_write.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include <virtual_binary.h>
|
||||
#include "xcc_lmd_file_write.h"
|
||||
|
||||
class Cmix_file_write
|
||||
class Cmix_file_write
|
||||
{
|
||||
public:
|
||||
void add_file(int id, const Cvirtual_binary d);
|
||||
|
|
30
3rdParty/xcc/misc/null_ini_reader.h
vendored
30
3rdParty/xcc/misc/null_ini_reader.h
vendored
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
27
3rdParty/xcc/misc/pal_file.cpp
vendored
27
3rdParty/xcc/misc/pal_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
24
3rdParty/xcc/misc/pal_file.h
vendored
24
3rdParty/xcc/misc/pal_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
76
3rdParty/xcc/misc/palet.cpp
vendored
76
3rdParty/xcc/misc/palet.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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++;
|
||||
}
|
||||
|
|
24
3rdParty/xcc/misc/palet.h
vendored
24
3rdParty/xcc/misc/palet.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
30
3rdParty/xcc/misc/reg_key.cpp
vendored
30
3rdParty/xcc/misc/reg_key.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2006 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2006 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<BYTE> 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<char*>(&d.front()), cb_d - 1);
|
||||
else
|
||||
|
|
24
3rdParty/xcc/misc/reg_key.h
vendored
24
3rdParty/xcc/misc/reg_key.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2006 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2006 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
462
3rdParty/xcc/misc/shp_decode.cpp
vendored
462
3rdParty/xcc/misc/shp_decode.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<byte*>(& cb_p);
|
||||
edi_ptr = reinterpret_cast<byte*>(&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<unsigned char>(*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<const int16_t*>(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<unsigned char>(*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<const int16_t*>(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<const unsigned __int16*>(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<size_t>(r_end - r, 8192);
|
||||
t_pack_section_header& header = *reinterpret_cast<t_pack_section_header*>(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<const t_pack_section_header*>(r);
|
||||
r += sizeof(t_pack_section_header);
|
||||
if (format == 80)
|
||||
|
|
24
3rdParty/xcc/misc/shp_decode.h
vendored
24
3rdParty/xcc/misc/shp_decode.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
213
3rdParty/xcc/misc/shp_ts_file.cpp
vendored
213
3rdParty/xcc/misc/shp_ts_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<t_shp4_frame_header*>(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<const t_shp4_frame_header*>(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<const t_shp4_frame_header*>(r);
|
||||
int x = frame_header.lm;
|
||||
int y = frame_header.tm;
|
||||
|
|
34
3rdParty/xcc/misc/shp_ts_file.h
vendored
34
3rdParty/xcc/misc/shp_ts_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include "video_file.h"
|
||||
#include "virtual_image.h"
|
||||
|
||||
class Cshp_ts_file : public Cvideo_file<t_shp_ts_header>
|
||||
class Cshp_ts_file : public Cvideo_file<t_shp_ts_header>
|
||||
{
|
||||
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
|
||||
{
|
||||
|
|
82
3rdParty/xcc/misc/string_conversion.cpp
vendored
82
3rdParty/xcc/misc/string_conversion.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
|
24
3rdParty/xcc/misc/string_conversion.h
vendored
24
3rdParty/xcc/misc/string_conversion.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
32
3rdParty/xcc/misc/tmp_file.h
vendored
32
3rdParty/xcc/misc/tmp_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -21,16 +21,16 @@
|
|||
#include <cc_file_sh.h>
|
||||
#include <cc_structures.h>
|
||||
|
||||
class Ctmp_file : public Ccc_file_sh<t_tmp_header>
|
||||
class Ctmp_file : public Ccc_file_sh<t_tmp_header>
|
||||
{
|
||||
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 ||
|
||||
|
|
71
3rdParty/xcc/misc/tmp_ts_file.cpp
vendored
71
3rdParty/xcc/misc/tmp_ts_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
42
3rdParty/xcc/misc/tmp_ts_file.h
vendored
42
3rdParty/xcc/misc/tmp_ts_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
|
24
3rdParty/xcc/misc/vartypes.h
vendored
24
3rdParty/xcc/misc/vartypes.h
vendored
|
@ -1,20 +1,20 @@
|
|||
#pragma once
|
||||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
|
|
24
3rdParty/xcc/misc/video_decoder.cpp
vendored
24
3rdParty/xcc/misc/video_decoder.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
|
24
3rdParty/xcc/misc/virtual_audio.cpp
vendored
24
3rdParty/xcc/misc/virtual_audio.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
|
26
3rdParty/xcc/misc/virtual_audio.h
vendored
26
3rdParty/xcc/misc/virtual_audio.h
vendored
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
45
3rdParty/xcc/misc/virtual_binary.cpp
vendored
45
3rdParty/xcc/misc/virtual_binary.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
@ -23,14 +23,11 @@
|
|||
|
||||
Cvirtual_binary_source::Cvirtual_binary_source(const void* d, size_t cb_d, const std::shared_ptr<const void>& source)
|
||||
{
|
||||
if (source)
|
||||
{
|
||||
if (source) {
|
||||
m_data = const_cast<byte*>(reinterpret_cast<const byte*>(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();
|
||||
}
|
||||
|
||||
|
|
48
3rdParty/xcc/misc/virtual_binary.h
vendored
48
3rdParty/xcc/misc/virtual_binary.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2001 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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()
|
||||
{
|
||||
|
|
29
3rdParty/xcc/misc/virtual_file.cpp
vendored
29
3rdParty/xcc/misc/virtual_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
26
3rdParty/xcc/misc/virtual_file.h
vendored
26
3rdParty/xcc/misc/virtual_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
class Cvirtual_file
|
||||
class Cvirtual_file
|
||||
{
|
||||
public:
|
||||
int save(const string& fname) const;
|
||||
|
|
81
3rdParty/xcc/misc/virtual_image.cpp
vendored
81
3rdParty/xcc/misc/virtual_image.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<t_palet_entry*>(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<t_palet_entry*>(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<const t_palet_entry*>(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<const t_palet32entry*>(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<t_palet_entry*>(image_edit());
|
||||
while (count--)
|
||||
*w++ = t.palet()[*r++];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
assert(cb_pixel() == 4);
|
||||
t_palet32entry* w = reinterpret_cast<t_palet32entry*>(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<const t_palet_entry*>(t.data());
|
||||
t_palet_entry* d = reinterpret_cast<t_palet_entry*>(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;
|
||||
|
|
26
3rdParty/xcc/misc/virtual_image.h
vendored
26
3rdParty/xcc/misc/virtual_image.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
{
|
||||
return reinterpret_cast<const t_palet_entry*>(m_image.data())[ofs8(x, y)];
|
||||
}
|
||||
|
||||
|
||||
void pixel24(int x, int y, t_palet_entry v)
|
||||
{
|
||||
reinterpret_cast<t_palet_entry*>(m_image.data_edit())[ofs8(x, y)] = v;
|
||||
|
|
42
3rdParty/xcc/misc/virtual_tfile.cpp
vendored
42
3rdParty/xcc/misc/virtual_tfile.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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++;
|
||||
|
|
24
3rdParty/xcc/misc/virtual_tfile.h
vendored
24
3rdParty/xcc/misc/virtual_tfile.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
196
3rdParty/xcc/misc/vxl_file.cpp
vendored
196
3rdParty/xcc/misc/vxl_file.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<int>(*r++) << ',' << static_cast<int>(*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<t_vxl_section_header*>(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<t_vxl_section_tailer*>(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<const t_vxl4_section_header*>(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<const t_vxl4_section_header*>(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;
|
||||
}
|
||||
|
|
26
3rdParty/xcc/misc/vxl_file.h
vendored
26
3rdParty/xcc/misc/vxl_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
|
24
3rdParty/xcc/misc/win_handle.cpp
vendored
24
3rdParty/xcc/misc/win_handle.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2002 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2002 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
|
24
3rdParty/xcc/misc/win_handle.h
vendored
24
3rdParty/xcc/misc/win_handle.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2002 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2002 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
65
3rdParty/xcc/misc/xcc_dirs.cpp
vendored
65
3rdParty/xcc/misc/xcc_dirs.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
30
3rdParty/xcc/misc/xcc_dirs.h
vendored
30
3rdParty/xcc/misc/xcc_dirs.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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();
|
||||
|
|
26
3rdParty/xcc/misc/xcc_file.h
vendored
26
3rdParty/xcc/misc/xcc_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
24
3rdParty/xcc/misc/xcc_file_sh.h
vendored
24
3rdParty/xcc/misc/xcc_file_sh.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
24
3rdParty/xcc/misc/xcc_lmd_file.h
vendored
24
3rdParty/xcc/misc/xcc_lmd_file.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
27
3rdParty/xcc/misc/xcc_lmd_file_write.cpp
vendored
27
3rdParty/xcc/misc/xcc_lmd_file_write.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<char*>(w), i.c_str());
|
||||
w += i.length() + 1;
|
||||
}
|
||||
|
|
26
3rdParty/xcc/misc/xcc_lmd_file_write.h
vendored
26
3rdParty/xcc/misc/xcc_lmd_file_write.h
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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);
|
||||
|
|
24
3rdParty/xcc/misc/xcc_registry.cpp
vendored
24
3rdParty/xcc/misc/xcc_registry.cpp
vendored
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
|
26
3rdParty/xcc/misc/xcc_registry.h
vendored
26
3rdParty/xcc/misc/xcc_registry.h
vendored
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "reg_key.h"
|
||||
|
||||
class Cxcc_registry
|
||||
class Cxcc_registry
|
||||
{
|
||||
public:
|
||||
static int get_base_key(Creg_key&);
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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("<all>");
|
||||
ListTeamTypes(m_TeamType1, TRUE);
|
||||
ListTeamTypes(m_TeamType2, TRUE);
|
||||
|
||||
int i;
|
||||
for(i=0;i<Map->GetAITriggerTypeCount();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+="<none>";
|
||||
data += "<none>";
|
||||
}
|
||||
|
||||
data+=",<all>,";
|
||||
|
||||
|
||||
data += ",<all>,";
|
||||
|
||||
// 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+="<none>,0000000000000000000000000000000000000000000000000000000000000000,50.000000,30.000000,50.000000,1,0,1,1,";
|
||||
|
||||
data += "<none>,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+="<none>";
|
||||
data += "<none>";
|
||||
}
|
||||
|
||||
data+=",1,1,1";
|
||||
|
||||
data += ",1,1,1";
|
||||
|
||||
ini.SetString("AITriggerTypes", ID, data);
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
||||
// now make current id visible
|
||||
int i;
|
||||
for(i=0;i<m_AITriggerType.GetCount();i++)
|
||||
{
|
||||
for (i = 0; i < m_AITriggerType.GetCount(); i++) {
|
||||
CString cuString;
|
||||
m_AITriggerType.GetLBText(i, cuString);
|
||||
TruncSpace(cuString);
|
||||
|
||||
if(cuString==ID)
|
||||
{
|
||||
if (cuString == ID) {
|
||||
m_AITriggerType.SetCurSel(i);
|
||||
OnSelchangeAitriggertype();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAITriggerTypes::OnDelete()
|
||||
void CAITriggerTypes::OnDelete()
|
||||
{
|
||||
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);
|
||||
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
|
||||
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));
|
||||
if(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);
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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();
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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();
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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();
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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;i<bm.bmWidth;i++)
|
||||
{
|
||||
for(e=0;e<bm.bmHeight;e++)
|
||||
{
|
||||
COLORREF col=GetPixel(hDC, i, bm.bmHeight-e);
|
||||
for (i = 0; i < bm.bmWidth; i++) {
|
||||
for (e = 0; e < bm.bmHeight; e++) {
|
||||
COLORREF col = GetPixel(hDC, i, bm.bmHeight - e);
|
||||
|
||||
int x=(i)+mapdata.GetHeight()+1;
|
||||
int y=(e)+mapdata.GetWidth();
|
||||
int x = (i)+mapdata.GetHeight() + 1;
|
||||
int y = (e)+mapdata.GetWidth();
|
||||
|
||||
int xiso;
|
||||
int yiso;
|
||||
|
||||
yiso=mapdata.GetIsoSize()-(y - x);
|
||||
xiso=mapdata.GetIsoSize()-(x + y);
|
||||
yiso-=mapdata.GetHeight();
|
||||
yiso = mapdata.GetIsoSize() - (y - x);
|
||||
xiso = mapdata.GetIsoSize() - (x + y);
|
||||
yiso -= mapdata.GetHeight();
|
||||
|
||||
|
||||
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;
|
||||
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<isosize*isosize;i++)
|
||||
{
|
||||
for (i = 0; i < isosize * isosize; i++) {
|
||||
mapdata.SmoothAllAt(i);
|
||||
}
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
if(hUsed!=hBitmap) DeleteObject(hUsed);
|
||||
if (hUsed != hBitmap) DeleteObject(hUsed);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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"));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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;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);
|
||||
|
||||
|
||||
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<DWORD, BOOL> 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;i<count;i++)
|
||||
{
|
||||
if (m_bAlternative) dwStartSet = cliff2set_start;
|
||||
else dwStartSet = cliffset_start;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
CString cur=type;
|
||||
cur+=c;
|
||||
CString cur = type;
|
||||
cur += c;
|
||||
notusedascliff[dwStartSet + g_data.GetInteger(sec, cur)] = TRUE;
|
||||
}
|
||||
|
||||
CString corner_searched="";
|
||||
DWORD dwCurPos=dwPos;
|
||||
int isosize=Map->GetIsoSize();
|
||||
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;i<careables.size();i++)
|
||||
{
|
||||
TILEDATA& t=(*tiledata)[careables[i]];
|
||||
for (i = 0; i < careables.size(); i++) {
|
||||
TILEDATA& t = (*tiledata)[careables[i]];
|
||||
|
||||
if(m_addx>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;
|
||||
if (m_addx > 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;i<careables.size();i++)
|
||||
{
|
||||
TILEDATA& t=(*tiledata)[careables[i]];
|
||||
if(t.cx>t1.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;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;
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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_)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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;i<m_ManualStrings.size();i++)
|
||||
box->AddString(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();
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<CString> 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
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**************************
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <afxinet.h>
|
||||
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
|
@ -61,7 +61,7 @@ END_MESSAGE_MAP()
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Behandlungsroutinen für Nachrichten CDynamicGraphDlg
|
||||
|
||||
void CDynamicGraphDlg::PostNcDestroy()
|
||||
void CDynamicGraphDlg::PostNcDestroy()
|
||||
{
|
||||
// delete this;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue