Skip to content

Commit 880a7ef

Browse files
committed
fix: auto-format codebase
1 parent e6e94a0 commit 880a7ef

15 files changed

Lines changed: 59 additions & 50 deletions

examples/zen2zen.cc

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
#include "zenkit/vobs/Camera.hh"
44

55
#include <zenkit/Archive.hh>
6+
#include <zenkit/Logger.hh>
67
#include <zenkit/SaveGame.hh>
78
#include <zenkit/World.hh>
8-
#include <zenkit/Logger.hh>
99

1010
#include <iostream>
1111

1212
void print_usage() {
1313
std::cerr << "Usage: zen2zen [-f FORMAT] [-i VERSION_INPUT] [-o VERSION_OUTPUT] INPUT OUTPUT\n\n"
14-
<< "Converts ZenGin archives from and to different formats.\n\n"
15-
<< "Options:\n"
16-
<< "\t-f FORMAT \t\tSet the output file format (default: ascii)\n"
17-
<< "\t-i,--version-in VERSION_INPUT \t\tSet the game version the archive is from (default: gothic1)\n"
18-
<< "\t-o,--version-out VERSION_OUTPUT\t\tSet the game version the archive should be converted to (default: gothic1)\n\n"
19-
<< "Possible values:\n"
20-
<< "\tFORMAT \t\tascii, binary, binsafe\n"
21-
<< "\tVERSION_INPUT \t\t1, g1, gothic1, 2, g2, gothic2\n"
22-
<< "\tVERSION_OUTPUT\t\t1, g1, gothic1, 2, g2, gothic2\n";
14+
<< "Converts ZenGin archives from and to different formats.\n\n"
15+
<< "Options:\n"
16+
<< "\t-f FORMAT \t\tSet the output file format (default: ascii)\n"
17+
<< "\t-i,--version-in VERSION_INPUT \t\tSet the game version the archive is from (default: gothic1)\n"
18+
<< "\t-o,--version-out VERSION_OUTPUT\t\tSet the game version the archive should be converted to "
19+
"(default: gothic1)\n\n"
20+
<< "Possible values:\n"
21+
<< "\tFORMAT \t\tascii, binary, binsafe\n"
22+
<< "\tVERSION_INPUT \t\t1, g1, gothic1, 2, g2, gothic2\n"
23+
<< "\tVERSION_OUTPUT\t\t1, g1, gothic1, 2, g2, gothic2\n";
2324
}
2425

25-
2626
int main(int argc, char const** argv) {
2727
if (argc < 3) {
2828
print_usage();
@@ -58,25 +58,34 @@ int main(int argc, char const** argv) {
5858

5959
std::string_view arg = argv[++i];
6060
if (name == "-f" || name == "--format") {
61-
if (arg == "ascii") fmt = zenkit::ArchiveFormat::ASCII;
62-
else if (arg == "binary") fmt = zenkit::ArchiveFormat::BINARY;
63-
else if (arg == "binsafe") fmt = zenkit::ArchiveFormat::BINSAFE;
61+
if (arg == "ascii")
62+
fmt = zenkit::ArchiveFormat::ASCII;
63+
else if (arg == "binary")
64+
fmt = zenkit::ArchiveFormat::BINARY;
65+
else if (arg == "binsafe")
66+
fmt = zenkit::ArchiveFormat::BINSAFE;
6467
else {
6568
std::cerr << "Expected one of 'ascii' (default), 'binary' or 'binsafe' as a format\n";
6669
return 1;
6770
}
6871
} else if (name == "-i" || name == "--version-in") {
69-
if (arg == "1" || arg == "g1" || arg == "gothic1") ver_input = zenkit::GameVersion::GOTHIC_1;
70-
else if (arg == "2" || arg == "g2" || arg == "gothic2") ver_input = zenkit::GameVersion::GOTHIC_2;
72+
if (arg == "1" || arg == "g1" || arg == "gothic1")
73+
ver_input = zenkit::GameVersion::GOTHIC_1;
74+
else if (arg == "2" || arg == "g2" || arg == "gothic2")
75+
ver_input = zenkit::GameVersion::GOTHIC_2;
7176
else {
72-
std::cerr << "Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an input version\n";
77+
std::cerr << "Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an input "
78+
"version\n";
7379
return 1;
7480
}
7581
} else if (name == "-o" || name == "--version-out") {
76-
if (arg == "1" || arg == "g1" || arg == "gothic1") ver_output = zenkit::GameVersion::GOTHIC_1;
77-
else if (arg == "2" || arg == "g2" || arg == "gothic2") ver_output = zenkit::GameVersion::GOTHIC_2;
82+
if (arg == "1" || arg == "g1" || arg == "gothic1")
83+
ver_output = zenkit::GameVersion::GOTHIC_1;
84+
else if (arg == "2" || arg == "g2" || arg == "gothic2")
85+
ver_output = zenkit::GameVersion::GOTHIC_2;
7886
else {
79-
std::cerr << "Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an output version\n";
87+
std::cerr << "Expected one of '1', 'g1' or 'gothic1' (default) or '2', 'g2' or 'gothic2' as an output "
88+
"version\n";
8089
return 1;
8190
}
8291
} else {
@@ -93,10 +102,10 @@ int main(int argc, char const** argv) {
93102
auto a_out = zenkit::Write::to(positional[1]);
94103
auto a_ar_o = zenkit::WriteArchive::to(a_out.get(), fmt);
95104
a_ar_o->write_object(a, ver_output);
96-
} catch (const std::exception& e) {
105+
} catch (std::exception const& e) {
97106
std::cerr << "Error during conversion: " << e.what() << "\n";
98107
return -1;
99108
}
100109

101-
return 0;
110+
return 0;
102111
}

include/zenkit/world/BspTree.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#include "zenkit/Library.hh"
66
#include "zenkit/Misc.hh"
77

8+
#include <cstdint>
89
#include <string>
910
#include <vector>
10-
#include <cstdint>
1111

1212
namespace zenkit {
1313
class Read;

src/CutsceneLibrary.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: MIT
33
#include "zenkit/CutsceneLibrary.hh"
44
#include "zenkit/Archive.hh"
5-
#include "zenkit/Stream.hh"
65
#include "zenkit/Error.hh"
6+
#include "zenkit/Stream.hh"
77

88
#include "zenkit/vobs/Misc.hh"
99

src/Font.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright © 2021-2024 GothicKit Contributors.
22
// SPDX-License-Identifier: MIT
33
#include "zenkit/Font.hh"
4-
#include "zenkit/Stream.hh"
54
#include "zenkit/Error.hh"
5+
#include "zenkit/Stream.hh"
66

77
namespace zenkit {
88
bool FontGlyph::operator==(FontGlyph const& g) const noexcept {

src/Mesh.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ namespace zenkit {
277277
}
278278
});
279279

280-
281280
proto::write_chunk(w, MeshChunkType::VERTICES, [this](Write* c) {
282281
c->write_uint(static_cast<uint32_t>(this->vertices.size()));
283282

src/ModelScript.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include "Internal.hh"
88
#include "ModelScriptDsl.hh"
99

10-
#include <unordered_map>
1110
#include <sstream>
11+
#include <unordered_map>
1212

1313
namespace zenkit {
1414
enum class ModelScriptBinaryChunkType : uint16_t {

src/ModelScriptDsl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include "Internal.hh"
55

66
#include "zenkit/Error.hh"
7-
#include "zenkit/Stream.hh"
87
#include "zenkit/Misc.hh"
8+
#include "zenkit/Stream.hh"
99

1010
#define WARN_SYNTAX(msg) ZKLOGW("ModelScript", "Syntax error (line %d, column %d): %s", _m_line, _m_column, msg)
1111

src/ModelScriptDsl.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright © 2022-2024 GothicKit Contributors.
22
// SPDX-License-Identifier: MIT
33
#pragma once
4-
#include "zenkit/Stream.hh"
54
#include "zenkit/ModelScript.hh"
5+
#include "zenkit/Stream.hh"
66

77
#include <optional>
88
#include <string>

src/World.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ namespace zenkit {
178178
w.write_object_begin("MeshAndBsp", "", 0);
179179

180180
Write* raw = w.get_stream();
181-
raw->write_uint(version == GameVersion::GOTHIC_1 ? 0x2090000 : 0x4090000);
181+
raw->write_uint(version == GameVersion::GOTHIC_1 ? 0x2090000 : 0x4090000);
182182

183183
uint32_t size_off = raw->tell();
184184
raw->write_uint(0);

src/vobs/Camera.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ namespace zenkit {
4444
w.write_float("continuity", this->continuity);
4545
w.write_float("timeScale", this->time_scale);
4646
w.write_bool("timeIsFixed", this->time_fixed);
47-
w.write_raw("originalPose", reinterpret_cast<std::byte const*>(this->original_pose.pointer()), 4 * 4 * sizeof(float));
47+
w.write_raw("originalPose",
48+
reinterpret_cast<std::byte const*>(this->original_pose.pointer()),
49+
4 * 4 * sizeof(float));
4850
}
4951

5052
void VCutsceneCamera::parse(VCutsceneCamera& obj, ReadArchive& r, GameVersion version) {

0 commit comments

Comments
 (0)