Skip to content

Commit

Permalink
format pass #1 (disable format in all but obsidian_main)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phytolizer committed Jan 6, 2022
1 parent 13977e8 commit 778fa1b
Show file tree
Hide file tree
Showing 34 changed files with 361 additions and 295 deletions.
1 change: 1 addition & 0 deletions source_files/fastPRNG/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DisableFormat: true
1 change: 1 addition & 0 deletions source_files/fltk/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DisableFormat: true
1 change: 1 addition & 0 deletions source_files/miniz/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DisableFormat: true
15 changes: 10 additions & 5 deletions source_files/obsidian_main/aj_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ bool LoadSectors() {
sector->floor_h = LE_S16(raw->floor_h);
sector->ceil_h = LE_S16(raw->ceil_h);

std::copy(raw->floor_tex.data(), raw->floor_tex.data() + 8, sector->floor_tex.data());
std::copy(raw->ceil_tex.data(), raw->ceil_tex.data() + 8, sector->ceil_tex.data());
std::copy(raw->floor_tex.data(), raw->floor_tex.data() + 8,
sector->floor_tex.data());
std::copy(raw->ceil_tex.data(), raw->ceil_tex.data() + 8,
sector->ceil_tex.data());

sector->light = LE_U16(raw->light);
sector->special = LE_U16(raw->special);
Expand Down Expand Up @@ -358,9 +360,12 @@ bool LoadSidedefs() {
side->x_offset = LE_S16(raw->x_offset);
side->y_offset = LE_S16(raw->y_offset);

std::copy(raw->upper_tex.data(), raw->upper_tex.data() + 8, side->upper_tex.data());
std::copy(raw->mid_tex.data(), raw->mid_tex.data() + 8, side->mid_tex.data());
std::copy(raw->lower_tex.data(), raw->lower_tex.data() + 8, side->lower_tex.data());
std::copy(raw->upper_tex.data(), raw->upper_tex.data() + 8,
side->upper_tex.data());
std::copy(raw->mid_tex.data(), raw->mid_tex.data() + 8,
side->mid_tex.data());
std::copy(raw->lower_tex.data(), raw->lower_tex.data() + 8,
side->lower_tex.data());
}

return true; // OK
Expand Down
11 changes: 9 additions & 2 deletions source_files/obsidian_main/aj_poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ class sidedef_c {
std::array<char, 10> mid_tex;

public:
sidedef_c() : index(-1), sector(), x_offset(), y_offset(), upper_tex(), lower_tex(), mid_tex() { }
sidedef_c()
: index(-1),
sector(),
x_offset(),
y_offset(),
upper_tex(),
lower_tex(),
mid_tex() {}
};

class linedef_c {
Expand Down Expand Up @@ -153,7 +160,7 @@ class linedef_c {
flags(),
special(),
tag(),
args() { }
args() {}
};

class thing_c {
Expand Down
16 changes: 8 additions & 8 deletions source_files/obsidian_main/aj_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ typedef struct {
} PACKEDATTR raw_linedef_t;

typedef struct {
u16_t start; // from this vertex...
u16_t end; // ... to this vertex
u16_t flags; // linedef flags (impassible, etc)
u8_t type; // linedef type
u16_t start; // from this vertex...
u16_t end; // ... to this vertex
u16_t flags; // linedef flags (impassible, etc)
u8_t type; // linedef type
std::array<u8_t, 5> specials; // hexen specials
u16_t sidedef1; // right sidedef
u16_t sidedef2; // left sidedef
u16_t sidedef1; // right sidedef
u16_t sidedef2; // left sidedef

} PACKEDATTR raw_hexen_linedef_t;

Expand Down Expand Up @@ -109,8 +109,8 @@ typedef struct {
u16_t type; // type of thing
u16_t options; // when appears, deaf, dormant, etc..

u8_t special; // special type
std::array<u8_t, 5> arg; // special arguments
u8_t special; // special type
std::array<u8_t, 5> arg; // special arguments

} PACKEDATTR raw_hexen_thing_t;

Expand Down
2 changes: 1 addition & 1 deletion source_files/obsidian_main/csg_bsp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ void CSG_BSP(double grid, bool is_clip_hull) {
R->ClockwiseSnags();
}

//CSG_SwallowBrushes();
// CSG_SwallowBrushes();

CSG_DiscoverGaps();

Expand Down
10 changes: 4 additions & 6 deletions source_files/obsidian_main/csg_doom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,6 @@ static void AlignTextures() {
}

i += 1;

}

count += prev_count + next_count;
Expand Down Expand Up @@ -2547,8 +2546,7 @@ int Doom::sidedef_c::Write() {

int sec_index = sector->Write();

AddSidedef(sec_index, lower, mid, upper,
x_offset & 1023, y_offset);
AddSidedef(sec_index, lower, mid, upper, x_offset & 1023, y_offset);
}

return index;
Expand Down Expand Up @@ -2715,8 +2713,9 @@ static void WriteFraggleScript() {
continue;
}

HeaderPrintf(" spawn(%s, %d, %d, %d, %d);\n", thing.fs_name.c_str(),
thing.x, thing.y, thing.angle, thing.z);
HeaderPrintf(" spawn(%s, %d, %d, %d, %d);\n",
thing.fs_name.c_str(), thing.x, thing.y, thing.angle,
thing.z);
}

HeaderPrintf("}\n\n");
Expand All @@ -2730,7 +2729,6 @@ static void WriteFraggleScript() {
//------------------------------------------------------------------------

void FreeStuff() {

// This is erroring out right now
std::for_each(vertices.begin(), vertices.end(), [](auto *i) { delete i; });
std::for_each(linedefs.begin(), linedefs.end(), [](auto *i) { delete i; });
Expand Down
2 changes: 1 addition & 1 deletion source_files/obsidian_main/dm_prefab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ int wadfab_get_side(lua_State *L) {

lua_pushstring(L, SD->mid_tex.data());
lua_setfield(L, -2, "mid_tex");

lua_pushinteger(L, index);
lua_setfield(L, -2, "sidedef_index");

Expand Down
45 changes: 29 additions & 16 deletions source_files/obsidian_main/g_doom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,14 @@ static bool BuildNodes(std::filesystem::path filename) {
}
}
}

if (StringCaseCmp(current_engine, "zdoom") == 0) {
if (!build_nodes) {
LogPrintf("Skipping nodes per user selection...\n");
return true;
}
}

// Is this really the best way to do this at the moment? - Dasho
int map_nums;
std::string wadlength = ob_get_param("length");
Expand All @@ -793,32 +793,38 @@ static bool BuildNodes(std::filesystem::path filename) {
} else if (StringCaseCmp(wadlength, "few") == 0) {
map_nums = 4;
} else if (StringCaseCmp(wadlength, "episode") == 0) {
if (StringCaseCmp(current_game, "doom2") == 0 || StringCaseCmp(current_game, "plutonia") == 0 || StringCaseCmp(current_game, "tnt") == 0) {
if (StringCaseCmp(current_game, "doom2") == 0 ||
StringCaseCmp(current_game, "plutonia") == 0 ||
StringCaseCmp(current_game, "tnt") == 0) {
map_nums = 11;
} else {
// Hexen is included in this although I don't think it's accurate. Will fix as Hexen support evolves - Dasho
// Hexen is included in this although I don't think it's accurate.
// Will fix as Hexen support evolves - Dasho
map_nums = 9;
}
} else {
if (StringCaseCmp(current_game, "doom2") == 0 || StringCaseCmp(current_game, "plutonia") == 0 || StringCaseCmp(current_game, "tnt") == 0) {
if (StringCaseCmp(current_game, "doom2") == 0 ||
StringCaseCmp(current_game, "plutonia") == 0 ||
StringCaseCmp(current_game, "tnt") == 0) {
map_nums = 32;
} else if (StringCaseCmp(current_game, "doom1") == 0) {
map_nums = 27;
} else if (StringCaseCmp(current_game, "ultdoom") == 0) {
map_nums = 36;
} else {
// Heretic and Hexen have the same value for this currently, as I used Heretic as a template for Hexen. Will fix
// as Hexen support evolves - Dasho
// Heretic and Hexen have the same value for this currently, as I
// used Heretic as a template for Hexen. Will fix as Hexen support
// evolves - Dasho
map_nums = 45;
}
}
if (zdmain(filename, current_engine, UDMF_mode, build_reject, map_nums) != 0) {
if (zdmain(filename, current_engine, UDMF_mode, build_reject, map_nums) !=
0) {
Main::ProgStatus(_("ZDBSP Error!"));
return false;
}

return true;

}

} // namespace Doom
Expand All @@ -839,7 +845,6 @@ class game_interface_c : public ::game_interface_c {
void BeginLevel();
void EndLevel();
void Property(std::string key, std::string value);

};
} // namespace Doom

Expand Down Expand Up @@ -869,7 +874,8 @@ bool Doom::game_interface_c::Start(const char *preset) {

current_engine = ob_get_param("engine");

// Need to preempt the rest of this process for now if we are using Vanilla Doom
// Need to preempt the rest of this process for now if we are using Vanilla
// Doom
if (StringCaseCmp(current_engine, "vanilla") == 0) {
build_reject = StringToInt(ob_get_param("bool_build_reject"));
return true;
Expand All @@ -882,14 +888,15 @@ bool Doom::game_interface_c::Start(const char *preset) {

if (main_win) main_win->build_box->Prog_Init(20, N_("CSG"));

if (StringCaseCmp(current_engine, "zdoom") == 0 || StringCaseCmp(current_engine, "eternity") == 0) {
if (StringCaseCmp(current_engine, "zdoom") == 0 ||
StringCaseCmp(current_engine, "eternity") == 0) {
build_reject = false;
map_format = ob_get_param("map_format");
build_nodes = StringToInt(ob_get_param("bool_build_nodes_udmf"));
} else if (StringCaseCmp(current_engine, "edge") == 0) {
build_reject = false;
map_format = "binary";
build_nodes = StringToInt(ob_get_param("bool_build_nodes_edge"));
build_nodes = StringToInt(ob_get_param("bool_build_nodes_edge"));
} else {
build_reject = StringToInt(ob_get_param("bool_build_reject"));
map_format = "binary";
Expand Down Expand Up @@ -936,13 +943,19 @@ bool Doom::game_interface_c::Finish(bool build_ok) {
}
mz_zip_archive zip_file;
mz_zip_zero_struct(&zip_file);
if(mz_zip_writer_init_file(&zip_file, zip_filename.generic_string().c_str(), 0)) {
mz_zip_writer_add_file(&zip_file, filename.filename().generic_string().c_str(), filename.generic_string().c_str(), NULL, 0, MZ_DEFAULT_COMPRESSION);
if (mz_zip_writer_init_file(&zip_file,
zip_filename.generic_string().c_str(), 0)) {
mz_zip_writer_add_file(&zip_file,
filename.filename().generic_string().c_str(),
filename.generic_string().c_str(), NULL, 0,
MZ_DEFAULT_COMPRESSION);
mz_zip_writer_finalize_archive(&zip_file);
mz_zip_writer_end(&zip_file);
std::filesystem::remove(filename);
} else {
LogPrintf("Zipping output WAD to {} failed! Retaining original WAD.\n", zip_filename.generic_string());
LogPrintf(
"Zipping output WAD to {} failed! Retaining original WAD.\n",
zip_filename.generic_string());
}
}

Expand Down
2 changes: 1 addition & 1 deletion source_files/obsidian_main/g_quake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ int Q1_add_tex_wad(lua_State *L) {
// Note: filename must be relative (no path)

std::filesystem::path name = luaL_optstring(L, 1, "");

if (std::filesystem::exists(name)) {
qk_texture_wad = name.string();
lua_pushboolean(L, 1);
Expand Down
2 changes: 1 addition & 1 deletion source_files/obsidian_main/g_quake2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ u16_t Q2_AddTexInfo(std::string texture, int flags, int value, float *s4,
Main::FatalError("Quake2 texture name too long: '{}'\n", texture);
}

//strcpy(raw_tex.texture, texture);
// strcpy(raw_tex.texture, texture);
std::copy(texture.data(), texture.data() + texture.size(), raw_tex.texture);

for (int k = 0; k < 4; k++) {
Expand Down
3 changes: 2 additions & 1 deletion source_files/obsidian_main/g_quake3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ static s32_t Q3_AddBrush(const csg_brush_c *A) {
}
} else if (A->bflags & BFLAG_NoDraw) {
raw_brush.shaderNum = SHADER_COMMON_CLIP;
} else if ((A->t.face.getStr("tex", "")).find("skies/") != std::string::npos) {
} else if ((A->t.face.getStr("tex", "")).find("skies/") !=
std::string::npos) {
raw_brush.shaderNum = SHADER_COMMON_SKY;
}

Expand Down
Loading

0 comments on commit 778fa1b

Please sign in to comment.