diff --git a/source_files/fastPRNG/.clang-format b/source_files/fastPRNG/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/source_files/fastPRNG/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/source_files/fltk/.clang-format b/source_files/fltk/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/source_files/fltk/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/source_files/miniz/.clang-format b/source_files/miniz/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/source_files/miniz/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/source_files/obsidian_main/aj_map.cc b/source_files/obsidian_main/aj_map.cc index 520b994d10..fbfdb837aa 100644 --- a/source_files/obsidian_main/aj_map.cc +++ b/source_files/obsidian_main/aj_map.cc @@ -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); @@ -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 diff --git a/source_files/obsidian_main/aj_poly.h b/source_files/obsidian_main/aj_poly.h index b250d38a32..3080d91dea 100644 --- a/source_files/obsidian_main/aj_poly.h +++ b/source_files/obsidian_main/aj_poly.h @@ -120,7 +120,14 @@ class sidedef_c { std::array 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 { @@ -153,7 +160,7 @@ class linedef_c { flags(), special(), tag(), - args() { } + args() {} }; class thing_c { diff --git a/source_files/obsidian_main/aj_structs.h b/source_files/obsidian_main/aj_structs.h index ee8039b0f8..20f1d6eb3d 100644 --- a/source_files/obsidian_main/aj_structs.h +++ b/source_files/obsidian_main/aj_structs.h @@ -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 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; @@ -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 arg; // special arguments + u8_t special; // special type + std::array arg; // special arguments } PACKEDATTR raw_hexen_thing_t; diff --git a/source_files/obsidian_main/csg_bsp.cc b/source_files/obsidian_main/csg_bsp.cc index a105c19b81..3a74a123b2 100644 --- a/source_files/obsidian_main/csg_bsp.cc +++ b/source_files/obsidian_main/csg_bsp.cc @@ -1948,7 +1948,7 @@ void CSG_BSP(double grid, bool is_clip_hull) { R->ClockwiseSnags(); } - //CSG_SwallowBrushes(); + // CSG_SwallowBrushes(); CSG_DiscoverGaps(); diff --git a/source_files/obsidian_main/csg_doom.cc b/source_files/obsidian_main/csg_doom.cc index 30f1ab06f8..c7aabaf16d 100644 --- a/source_files/obsidian_main/csg_doom.cc +++ b/source_files/obsidian_main/csg_doom.cc @@ -1657,7 +1657,6 @@ static void AlignTextures() { } i += 1; - } count += prev_count + next_count; @@ -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; @@ -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"); @@ -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; }); diff --git a/source_files/obsidian_main/dm_prefab.cc b/source_files/obsidian_main/dm_prefab.cc index b82d19c3f0..486c134762 100644 --- a/source_files/obsidian_main/dm_prefab.cc +++ b/source_files/obsidian_main/dm_prefab.cc @@ -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"); diff --git a/source_files/obsidian_main/g_doom.cc b/source_files/obsidian_main/g_doom.cc index 914917ba36..112f71d161 100644 --- a/source_files/obsidian_main/g_doom.cc +++ b/source_files/obsidian_main/g_doom.cc @@ -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"); @@ -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 @@ -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 @@ -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; @@ -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"; @@ -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()); } } diff --git a/source_files/obsidian_main/g_quake.cc b/source_files/obsidian_main/g_quake.cc index 9cb5592c46..f25cacb4aa 100644 --- a/source_files/obsidian_main/g_quake.cc +++ b/source_files/obsidian_main/g_quake.cc @@ -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); diff --git a/source_files/obsidian_main/g_quake2.cc b/source_files/obsidian_main/g_quake2.cc index 1f849d51c7..c4127c31d3 100644 --- a/source_files/obsidian_main/g_quake2.cc +++ b/source_files/obsidian_main/g_quake2.cc @@ -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++) { diff --git a/source_files/obsidian_main/g_quake3.cc b/source_files/obsidian_main/g_quake3.cc index 3c147def7c..27e76250fc 100644 --- a/source_files/obsidian_main/g_quake3.cc +++ b/source_files/obsidian_main/g_quake3.cc @@ -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; } diff --git a/source_files/obsidian_main/images.h b/source_files/obsidian_main/images.h index 83ff980819..1b03919d11 100644 --- a/source_files/obsidian_main/images.h +++ b/source_files/obsidian_main/images.h @@ -8,82 +8,72 @@ #ifndef WIN32 static const char *obsidian_icon[] = { -/* columns rows colors chars-per-pixel */ -"64 61 11 1 ", -" c #312F2B", -". c #413E33", -"X c #514D3A", -"o c #605B42", -"O c #736D4B", -"+ c #847C52", -"@ c #938A5A", -"# c #A49A62", -"$ c #B5A96A", -"% c #C7B972", -"& c #CEC276", -/* pixels */ -"@@@@@@@@@@##$$$$%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%$$$#@@@+OOooX", -"@@@@@@@@@@##$$$$%%%%&% O&&&&%%$$$#@@@+OOooX", -"@@##@@@@@###$$$$%%%%&$ o&&&&%%%$$$#@@@+OOoXX", -"@##########$$$$%%%%%&# o%&&&&%%%$$$#@@+OOooXX", -"@#########$$$$%%%%%%&@ X%&&&&&%%$$$$##@+OOooXX", -"@#######$$$$$$%%%%%&&O .$&%%&&&%%%$$$#@@+OOooXX", -"@####$$$$$$$$%%%%%%&&o $&%%%&&%%%%$$$#@@+OOooXX", -"@###$$$$$$$$$%%%%%%&&X #&%%%%&&%#$%$$##@@+OOoooX", -"####$$$$$$$$%@Xo$%%&& @&$o+%%%%X .$$$##@@+OOOooo", -"####$$$$$$$%# @+$&&&&&&&&&&&&@ +&%X o++ X@$#@@++OOOooo", -"@###$$$$$%$#. .#%&&&&&&&&&# O&&X .@#@@++OOOOOo", -"@###$$$$$%@ X$&$ o&&o X@@@++OOOOOO", -"@###$$$$$%X XO%&%. o&&@ @@@+++OOOOO", -"@###$$$$$$o o@$%&%X X%&%$@X o@@@@+++OOOO", -"####$$$$$%$ X@%%%&&o .$&&%%%%@X O#@@@@@+++OO", -"@###$$$$$%%@ O$&&%&&+ $&&%%%%%%$o o##@@@@@@@++O", -"@###$$$$$%%+ O%&&&&&@ #&&%%%%%%%%$O +###@@@@@@++O", -"@###$$$$$%%o O%&&&&&$ @&&&&&&&%%%%%$O o####@@@@@@+O", -"####$$$$$$O O%%&&&&$ +&&&&&&&&&&%%%%$o O####@@@@@++", -"@###$$$$$$X X$%%&&&%X O&%%%%%#. X$#####@@@++", -"@###$$$$$+ @%%%&&&o o&&%%%%%%+ +$####@@@++", -"@###$$$$$o o%%%%&&O o%&%%%%$%%$X o$$###@@@++", -"@@##$$$$$X @%%%%&&&&&&&&&&@ X%&%%%$%$%%%@ .#$###@@@+O", -"O@@#$$$$+ X$%%%&&&&&&&&&&$ .%&%%%$$$$%%%$. +$$##@@@+O", -"OO@##$$$O O%%%%&&&&&&%&&%. $&&%%%$%%%%%%%O +$$##@@@++", -"oOO@##$@X X#%%%%&&&&&&&&&o $&&%%%%%%%%%%&&$X X@###@@@++", -"oOO@o. o$%%%%&&&&&&&&O #&&%%%%%%%%%%&&&$o .o@@@++", -"oOO+ O$%%%%&&&&&&&# @&&&&&&&%%%%%%&&&%O @@@++", -"OOOO O%%%%%&&&&&&$ +&&&&&&&&&%%%%%&&&%O @@@+O", -"OOOO O%%%%%&&&&&%X O&%%%%&&&&%+ @@@+O", -"OOOO O%%%%%%&&&&O X%&%%%%&&&&%O @@@+O", -"OOOO O$%%%%%&&&&&&&&&&&# $&%%%%%&&&&%O @@@++", -"OOOO o$%%%%%&&&&&&&&&&&X @&%%%%%%%&&&$o @@@++", -"ooOOOoX. X#%%%%%&&&&&%%%%&@ O&&%%%%%%%&&&$X .oO@@@@++", -"oooOO+@@O O%%%%%&&&&&%%%&%. X&&%%%%%%%&&&&O O$###@@@+O", -"XooOO+@@O .$%%%%%&&&&%%&&@ $&&%%%%%%%&&&$. +$##@@@@+O", -"XXoOOO@@@. +%%%%%&&&&%%&% #&&%%%%%%%%&&&@ .#$###@@@+O", -"XXooOO+@@o X$%%%%&&&&%&&O +&&&%%%%%%%%&&%X o$$##@@@@+O", -"XXooOO+@@O @%%%%&&&&&&% o&&&&%%%%%%%%%&@ +$$##@@@++O", -"XXooOOO@@@X X$%%%&&&&&&O .%&&&&%%%%%%%%&$. X$$$##@@@+OO", -"XoooOOO+@@O o$%%&&&&&$ $&&&&&&&%%%%%%$o O$$$##@@@OOo", -"oooOOOO+@@#o O%%&&&&&o @&&&&&&&&&%%%%%o o$$$$##@@+OoX", -"oOOOOOO+@@@O O%&&&&$ o&%%%$o +$$$$#@@+OOoX", -"OOOOOO++@@@O o$&&&o $&%%#o o$$$##@@+OoXX", -"OOOOO+++@@@ X@%&&&&&&&&&$ O&&$+. @$$##@@OOoXX", -"O++@++@@@@. X$%&&&&&&&O $&#X X#$##@+OooX.", -"@@@@@@@@@O .O$$$%&% O&# +$#@@OOoXX.", -"@@@@@@@@@+ XoO#&@ %&o @##@+OOoXX ", -"@@@@@@@@@@@X #&o @&@ @$##@+OooXX ", -"@@@#####@@#+. o@o o&$ .&&X o@o +$$#@@+OooX..", -"@@@#########@X o+$$%+X @&O @&@ X+%%&@X @$$$#@@OOooXX.", -"O@@##########@@#$$$$%%@o. &&.X&& .o+%%%%&&$@@%$$$#@+OOooXX.", -"OO@@###$$$$$$#$$$$$$%%%&$@+XO&# #&@ +@$%%%%%%&&&&%%$$##@+OooXXXX", -"OO@@###$$$$$$$$$$$$$%%%%%%%##&oo&$ X%%%%%%%%%&&&%%%$$#@@OOoooXXX", -"oOO@@##$$$$$$$$$$$$$%%%%%%%%&$ $&O O%%%%%%%%%&&&%%%$$#@+OOoooXXX", -"XoO+@@#$$$$$$$$$$$$$%%%%%%%%&+O&# @%%%%%%%%%&&&%%$$##@+OOooooXX", -"XoOO@@##$$$$$$$$%%%%%%%%%%%&&X%&o %%%%%%%%%%&&&%%$$#@@+OOOoooXX", -"XoOO+@##$$$$$$%%%%%%%%%%%%%&#+&%%%%%%%%%%%%%%&&&%$$$#@@++OOoooXX", -"ooOO+@@#$$$$$%%%%%%%%%%%%%%&O%&%%%%%%%%%%%%%%%&%%$$$#@@@+OOoooXX", -"ooOOO@@#$$$$%%%%%%%%%%%%%%&%@&%%%%%%%%%%%%%%%%&%%$$$##@@+OOoooXX", -"oOOOO@@##$$%%%%%%%%%%&&&%%&#&&%%%%%%%%%%%%%%%%&%%$$$##@@+OOoooXX" -}; + /* columns rows colors chars-per-pixel */ + "64 61 11 1 ", " c #312F2B", ". c #413E33", "X c #514D3A", "o c #605B42", + "O c #736D4B", "+ c #847C52", "@ c #938A5A", "# c #A49A62", "$ c #B5A96A", + "% c #C7B972", "& c #CEC276", + /* pixels */ + "@@@@@@@@@@##$$$$%%%%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%%$$$#@@@+OOooX", + "@@@@@@@@@@##$$$$%%%%&% O&&&&%%$$$#@@@+OOooX", + "@@##@@@@@###$$$$%%%%&$ o&&&&%%%$$$#@@@+OOoXX", + "@##########$$$$%%%%%&# o%&&&&%%%$$$#@@+OOooXX", + "@#########$$$$%%%%%%&@ X%&&&&&%%$$$$##@+OOooXX", + "@#######$$$$$$%%%%%&&O .$&%%&&&%%%$$$#@@+OOooXX", + "@####$$$$$$$$%%%%%%&&o $&%%%&&%%%%$$$#@@+OOooXX", + "@###$$$$$$$$$%%%%%%&&X #&%%%%&&%#$%$$##@@+OOoooX", + "####$$$$$$$$%@Xo$%%&& @&$o+%%%%X .$$$##@@+OOOooo", + "####$$$$$$$%# @+$&&&&&&&&&&&&@ +&%X o++ X@$#@@++OOOooo", + "@###$$$$$%$#. .#%&&&&&&&&&# O&&X .@#@@++OOOOOo", + "@###$$$$$%@ X$&$ o&&o X@@@++OOOOOO", + "@###$$$$$%X XO%&%. o&&@ @@@+++OOOOO", + "@###$$$$$$o o@$%&%X X%&%$@X o@@@@+++OOOO", + "####$$$$$%$ X@%%%&&o .$&&%%%%@X O#@@@@@+++OO", + "@###$$$$$%%@ O$&&%&&+ $&&%%%%%%$o o##@@@@@@@++O", + "@###$$$$$%%+ O%&&&&&@ #&&%%%%%%%%$O +###@@@@@@++O", + "@###$$$$$%%o O%&&&&&$ @&&&&&&&%%%%%$O o####@@@@@@+O", + "####$$$$$$O O%%&&&&$ +&&&&&&&&&&%%%%$o O####@@@@@++", + "@###$$$$$$X X$%%&&&%X O&%%%%%#. X$#####@@@++", + "@###$$$$$+ @%%%&&&o o&&%%%%%%+ +$####@@@++", + "@###$$$$$o o%%%%&&O o%&%%%%$%%$X o$$###@@@++", + "@@##$$$$$X @%%%%&&&&&&&&&&@ X%&%%%$%$%%%@ .#$###@@@+O", + "O@@#$$$$+ X$%%%&&&&&&&&&&$ .%&%%%$$$$%%%$. +$$##@@@+O", + "OO@##$$$O O%%%%&&&&&&%&&%. $&&%%%$%%%%%%%O +$$##@@@++", + "oOO@##$@X X#%%%%&&&&&&&&&o $&&%%%%%%%%%%&&$X X@###@@@++", + "oOO@o. o$%%%%&&&&&&&&O #&&%%%%%%%%%%&&&$o .o@@@++", + "oOO+ O$%%%%&&&&&&&# @&&&&&&&%%%%%%&&&%O @@@++", + "OOOO O%%%%%&&&&&&$ +&&&&&&&&&%%%%%&&&%O @@@+O", + "OOOO O%%%%%&&&&&%X O&%%%%&&&&%+ @@@+O", + "OOOO O%%%%%%&&&&O X%&%%%%&&&&%O @@@+O", + "OOOO O$%%%%%&&&&&&&&&&&# $&%%%%%&&&&%O @@@++", + "OOOO o$%%%%%&&&&&&&&&&&X @&%%%%%%%&&&$o @@@++", + "ooOOOoX. X#%%%%%&&&&&%%%%&@ O&&%%%%%%%&&&$X .oO@@@@++", + "oooOO+@@O O%%%%%&&&&&%%%&%. X&&%%%%%%%&&&&O O$###@@@+O", + "XooOO+@@O .$%%%%%&&&&%%&&@ $&&%%%%%%%&&&$. +$##@@@@+O", + "XXoOOO@@@. +%%%%%&&&&%%&% #&&%%%%%%%%&&&@ .#$###@@@+O", + "XXooOO+@@o X$%%%%&&&&%&&O +&&&%%%%%%%%&&%X o$$##@@@@+O", + "XXooOO+@@O @%%%%&&&&&&% o&&&&%%%%%%%%%&@ +$$##@@@++O", + "XXooOOO@@@X X$%%%&&&&&&O .%&&&&%%%%%%%%&$. X$$$##@@@+OO", + "XoooOOO+@@O o$%%&&&&&$ $&&&&&&&%%%%%%$o O$$$##@@@OOo", + "oooOOOO+@@#o O%%&&&&&o @&&&&&&&&&%%%%%o o$$$$##@@+OoX", + "oOOOOOO+@@@O O%&&&&$ o&%%%$o +$$$$#@@+OOoX", + "OOOOOO++@@@O o$&&&o $&%%#o o$$$##@@+OoXX", + "OOOOO+++@@@ X@%&&&&&&&&&$ O&&$+. @$$##@@OOoXX", + "O++@++@@@@. X$%&&&&&&&O $&#X X#$##@+OooX.", + "@@@@@@@@@O .O$$$%&% O&# +$#@@OOoXX.", + "@@@@@@@@@+ XoO#&@ %&o @##@+OOoXX ", + "@@@@@@@@@@@X #&o @&@ @$##@+OooXX ", + "@@@#####@@#+. o@o o&$ .&&X o@o +$$#@@+OooX..", + "@@@#########@X o+$$%+X @&O @&@ X+%%&@X @$$$#@@OOooXX.", + "O@@##########@@#$$$$%%@o. &&.X&& .o+%%%%&&$@@%$$$#@+OOooXX.", + "OO@@###$$$$$$#$$$$$$%%%&$@+XO&# #&@ +@$%%%%%%&&&&%%$$##@+OooXXXX", + "OO@@###$$$$$$$$$$$$$%%%%%%%##&oo&$ X%%%%%%%%%&&&%%%$$#@@OOoooXXX", + "oOO@@##$$$$$$$$$$$$$%%%%%%%%&$ $&O O%%%%%%%%%&&&%%%$$#@+OOoooXXX", + "XoO+@@#$$$$$$$$$$$$$%%%%%%%%&+O&# @%%%%%%%%%&&&%%$$##@+OOooooXX", + "XoOO@@##$$$$$$$$%%%%%%%%%%%&&X%&o %%%%%%%%%%&&&%%$$#@@+OOOoooXX", + "XoOO+@##$$$$$$%%%%%%%%%%%%%&#+&%%%%%%%%%%%%%%&&&%$$$#@@++OOoooXX", + "ooOO+@@#$$$$$%%%%%%%%%%%%%%&O%&%%%%%%%%%%%%%%%&%%$$$#@@@+OOoooXX", + "ooOOO@@#$$$$%%%%%%%%%%%%%%&%@&%%%%%%%%%%%%%%%%&%%$$$##@@+OOoooXX", + "oOOOO@@##$$%%%%%%%%%%&&&%%&#&&%%%%%%%%%%%%%%%%&%%$$$##@@+OOoooXX"}; #endif typedef struct { diff --git a/source_files/obsidian_main/lib_util.cc b/source_files/obsidian_main/lib_util.cc index 1694115ea2..de107c04d8 100644 --- a/source_files/obsidian_main/lib_util.cc +++ b/source_files/obsidian_main/lib_util.cc @@ -107,15 +107,11 @@ std::string NumToString(int value) { return num_string; } -std::string NumToString(double value) { - return std::to_string(value); -} +std::string NumToString(double value) { return std::to_string(value); } -/* This can be used instead when Mingw's GCC can use charconv with floating point numbers - Dasho -std::string NumToString(double value) { - std::string num_string; - num_string.resize(50, ' '); - static_cast(std::to_chars( +/* This can be used instead when Mingw's GCC can use charconv with floating +point numbers - Dasho std::string NumToString(double value) { std::string +num_string; num_string.resize(50, ' '); static_cast(std::to_chars( num_string.data(), num_string.data() + num_string.size(), value)); return num_string; }*/ @@ -134,16 +130,12 @@ int StringToHex(std::string value) { return actual_number; } -double StringToDouble(std::string value) { - return stod(value); -} +double StringToDouble(std::string value) { return stod(value); } -/* This can be used instead when Mingw's GCC can use charconv with floating point numbers - Dasho -double StringToDouble(std::string value) { - double actual_number; - static_cast(std::from_chars(value.data(), value.data() + value.size(), - actual_number)); - return actual_number; +/* This can be used instead when Mingw's GCC can use charconv with floating +point numbers - Dasho double StringToDouble(std::string value) { double +actual_number; static_cast(std::from_chars(value.data(), value.data() + +value.size(), actual_number)); return actual_number; }*/ char *mem_gets(char *buf, int size, const char **str_ptr) { @@ -208,7 +200,6 @@ u32_t StringHash(std::string str) { return hash;*/ return std::hash{}(str); - } double PerpDist(double x, double y, double x1, double y1, double x2, diff --git a/source_files/obsidian_main/m_addons.cc b/source_files/obsidian_main/m_addons.cc index d6317eb9ea..43b15af631 100644 --- a/source_files/obsidian_main/m_addons.cc +++ b/source_files/obsidian_main/m_addons.cc @@ -74,7 +74,8 @@ bool VFS_AddArchive(std::filesystem::path filename, bool options_file) { std::filesystem::path new_name = fmt::format("{}/addons/{}", home_dir.string(), filename.string()); if (!std::filesystem::exists(new_name)) { - new_name = fmt::format("{}/addons/{}", install_dir.string(), filename.string()); + new_name = fmt::format("{}/addons/{}", install_dir.string(), + filename.string()); } filename = new_name; } @@ -173,14 +174,15 @@ void VFS_ScanForAddons() { for (auto &file : std::filesystem::directory_iterator(dir_name)) { if (file.path().has_extension() && - StringCaseCmp(file.path().extension().generic_string(), ".pk3") == 0) { + StringCaseCmp(file.path().extension().generic_string(), ".pk3") == + 0) { result1 += 1; list.push_back(file.path()); } } if (StringCaseCmp(home_dir.generic_string(), - install_dir.generic_string()) != 0) { + install_dir.generic_string()) != 0) { dir_name = home_dir; dir_name /= "addons"; if (!std::filesystem::exists(dir_name)) { @@ -197,8 +199,10 @@ void VFS_ScanForAddons() { list2.push_back(file.path()); } } - //std::vector().swap(list2); - for (auto x : list2) { list.push_back(x); } + // std::vector().swap(list2); + for (auto x : list2) { + list.push_back(x); + } } no_home_addon_dir: @@ -342,7 +346,8 @@ class UI_Addon : public Fl_Group { button = new UI_CustomCheckBox(x + kf_w(6), y + kf_h(4), w - kf_w(12), kf_h(24), ""); - button->copy_label(fmt::format(" {}", info->name.filename().string()).c_str()); + button->copy_label( + fmt::format(" {}", info->name.filename().string()).c_str()); button->labelfont(font_style); button->selection_color(SELECTION); // if (tip) diff --git a/source_files/obsidian_main/m_dialog.cc b/source_files/obsidian_main/m_dialog.cc index 3a85e34c81..4ceb438f6c 100644 --- a/source_files/obsidian_main/m_dialog.cc +++ b/source_files/obsidian_main/m_dialog.cc @@ -330,7 +330,8 @@ void DLG_EditSeed(void) { #undef max #endif unsigned long long split_limit = - (std::numeric_limits::max() / 127); // It is intentional that I am using the max for signed - Dasho + (std::numeric_limits::max() / + 127); // It is intentional that I am using the max for signed - Dasho next_rand_seed = split_limit; for (size_t i = 0; i < word.size(); i++) { char character = word.at(i); diff --git a/source_files/obsidian_main/m_lua.cc b/source_files/obsidian_main/m_lua.cc index 3cba81a24f..b5e5b757b0 100644 --- a/source_files/obsidian_main/m_lua.cc +++ b/source_files/obsidian_main/m_lua.cc @@ -482,12 +482,15 @@ int gui_add_module(lua_State *L) { } if (single_pane) { - main_win->left_mods->AddModule(id, label, tip, red, green, blue, suboptions); + main_win->left_mods->AddModule(id, label, tip, red, green, blue, + suboptions); } else { if (!StringCaseCmp(where, "left")) { - main_win->left_mods->AddModule(id, label, tip, red, green, blue, suboptions); + main_win->left_mods->AddModule(id, label, tip, red, green, blue, + suboptions); } else if (!StringCaseCmp(where, "right")) { - main_win->right_mods->AddModule(id, label, tip, red, green, blue, suboptions); + main_win->right_mods->AddModule(id, label, tip, red, green, blue, + suboptions); } else { return luaL_error(L, "add_module: unknown where value '%s'\n", where.c_str()); @@ -579,7 +582,8 @@ int gui_add_module_option(lua_State *L) { // FIXME : error if module is unknown - main_win->left_mods->AddOption(module, option, label, tip, longtip, gap, randomize_group); + main_win->left_mods->AddOption(module, option, label, tip, longtip, gap, + randomize_group); if (!single_pane) { main_win->right_mods->AddOption(module, option, label, tip, longtip, gap, randomize_group); @@ -630,9 +634,9 @@ int gui_add_module_slider_option(lua_State *L) { gap, min, max, inc, units, presets, nan, randomize_group); if (!single_pane) { - main_win->right_mods->AddSliderOption(module, option, label, tip, - longtip, gap, min, max, inc, - units, presets, nan, randomize_group); + main_win->right_mods->AddSliderOption( + module, option, label, tip, longtip, gap, min, max, inc, units, + presets, nan, randomize_group); } return 0; @@ -1381,12 +1385,13 @@ static bool Script_CallFunc(std::string func_name, int nresult = 0, // this will appear in the log file too if (main_win) { - main_win->label( - fmt::format("[ ERROR ] {} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION) - .c_str()); + main_win->label(fmt::format("[ ERROR ] {} {}", _(OBSIDIAN_TITLE), + OBSIDIAN_VERSION) + .c_str()); DLG_ShowError(_("Script Error: %s"), err_msg); main_win->label( - fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION).c_str()); + fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION) + .c_str()); } lua_pop(LUA_ST, 2); // ob_traceback, message return false; @@ -1708,17 +1713,18 @@ void ob_invoke_hook(std::string hookname) { bool ob_build_cool_shit() { if (!Script_CallFunc("ob_build_cool_shit", 1)) { if (main_win) { - main_win->label( - fmt::format("[ ERROR ] {} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION) - .c_str()); + main_win->label(fmt::format("[ ERROR ] {} {}", _(OBSIDIAN_TITLE), + OBSIDIAN_VERSION) + .c_str()); } Main::ProgStatus(_("Script Error")); if (main_win) { main_win->label( - fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION).c_str()); - #ifdef WIN32 + fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION) + .c_str()); +#ifdef WIN32 Main::Blinker(); - #endif +#endif } return false; } diff --git a/source_files/obsidian_main/m_options.cc b/source_files/obsidian_main/m_options.cc index 6c0eab0e0c..4448bd9530 100644 --- a/source_files/obsidian_main/m_options.cc +++ b/source_files/obsidian_main/m_options.cc @@ -81,7 +81,8 @@ static bool Options_ParseLine(std::string buf) { return true; } - // For options file, don't strip whitespace as it can cause issue with addon paths that have whitespace - Dasho + // For options file, don't strip whitespace as it can cause issue with addon + // paths that have whitespace - Dasho /*while (std::find(buf.begin(), buf.end(), ' ') != buf.end()) { buf.erase(std::find(buf.begin(), buf.end(), ' ')); @@ -92,7 +93,7 @@ static bool Options_ParseLine(std::string buf) { return false; } - //pos = buf.find('=', 0); // Fix pos after whitespace deletion + // pos = buf.find('=', 0); // Fix pos after whitespace deletion std::string name = buf.substr(0, pos - 1); std::string value = buf.substr(pos + 2); @@ -138,8 +139,8 @@ bool Options_Save(std::filesystem::path filename) { std::ofstream option_fp(filename, std::ios::out); if (!option_fp.is_open()) { - LogPrintf("Error: unable to create file: {}\n({})\n\n", filename.string(), - strerror(errno)); + LogPrintf("Error: unable to create file: {}\n({})\n\n", + filename.string(), strerror(errno)); return false; } @@ -157,9 +158,12 @@ bool Options_Save(std::filesystem::path filename) { option_fp << "debug_messages = " << (debug_messages ? 1 : 0) << "\n"; option_fp << "limit_break = " << (limit_break ? 1 : 0) << "\n"; option_fp << "preserve_failures = " << (preserve_failures ? 1 : 0) << "\n"; - option_fp << "preserve_old_config = " << (preserve_old_config ? 1 : 0) << "\n"; - option_fp << "randomize_architecture = " << (randomize_architecture ? 1 : 0) << "\n"; - option_fp << "randomize_monsters = " << (randomize_monsters ? 1 : 0) << "\n"; + option_fp << "preserve_old_config = " << (preserve_old_config ? 1 : 0) + << "\n"; + option_fp << "randomize_architecture = " << (randomize_architecture ? 1 : 0) + << "\n"; + option_fp << "randomize_monsters = " << (randomize_monsters ? 1 : 0) + << "\n"; option_fp << "randomize_pickups = " << (randomize_pickups ? 1 : 0) << "\n"; option_fp << "randomize_misc = " << (randomize_misc ? 1 : 0) << "\n"; option_fp << "filename_prefix = " << filename_prefix << "\n"; @@ -261,8 +265,9 @@ class UI_OptionsWin : public Fl_Window { t_language = "AUTO"; } } - fl_alert("%s", _("Obsidian will now close to apply language changes.\nObsidian will be in your selected language" - " when you restart the program.")); + fl_alert("%s", _("Obsidian will now close to apply language " + "changes.\nObsidian will be in your selected language" + " when you restart the program.")); main_action = MAIN_QUIT; @@ -366,7 +371,8 @@ slider limits for Obsidian.\nAny bugs, crashes, or errors as a result of this wi } static void callback_SetCustomPrefix(Fl_Widget *w, void *data) { - const char *user_buf = fl_input("%s", custom_prefix.c_str(), _("Enter Custom Prefix Format:")); + const char *user_buf = fl_input("%s", custom_prefix.c_str(), + _("Enter Custom Prefix Format:")); if (user_buf) { custom_prefix = user_buf; @@ -494,7 +500,8 @@ UI_OptionsWin::UI_OptionsWin(int W, int H, const char *label) cy += opt_limit_break->h() + y_step * .5; - opt_preserve_failures = new UI_CustomCheckBox(cx, cy, W - cx - pad, kf_h(24), ""); + opt_preserve_failures = + new UI_CustomCheckBox(cx, cy, W - cx - pad, kf_h(24), ""); opt_preserve_failures->copy_label(_(" Preserve Failed Builds")); opt_preserve_failures->value(preserve_failures ? 1 : 0); opt_preserve_failures->callback(callback_PreserveFailures, this); diff --git a/source_files/obsidian_main/m_theme.cc b/source_files/obsidian_main/m_theme.cc index 84cf41ad9c..b10d41b32b 100644 --- a/source_files/obsidian_main/m_theme.cc +++ b/source_files/obsidian_main/m_theme.cc @@ -275,8 +275,8 @@ bool Theme_Options_Save(std::filesystem::path filename) { std::ofstream option_fp(filename); if (!option_fp.is_open()) { - LogPrintf("Error: unable to create file: {}\n({})\n\n", filename.string(), - strerror(errno)); + LogPrintf("Error: unable to create file: {}\n({})\n\n", + filename.string(), strerror(errno)); return false; } @@ -876,22 +876,16 @@ class UI_ThemeWin : public Fl_Window { "./theme/fonts/SourceSansPro/SourceSansPro-Regular.ttf"); v_unload_private_font( "./theme/fonts/SourceSansPro/SourceSansPro-Bold.ttf"); - v_unload_private_font( - "./theme/fonts/Kalam/Kalam-Regular.ttf"); - v_unload_private_font( - "./theme/fonts/Kalam/Kalam-Bold.ttf"); - v_unload_private_font( - "./theme/fonts/3270/3270.ttf"); - v_unload_private_font( - "./theme/fonts/Workbench/Workbench.ttf"); + v_unload_private_font("./theme/fonts/Kalam/Kalam-Regular.ttf"); + v_unload_private_font("./theme/fonts/Kalam/Kalam-Bold.ttf"); + v_unload_private_font("./theme/fonts/3270/3270.ttf"); + v_unload_private_font("./theme/fonts/Workbench/Workbench.ttf"); v_unload_private_font( "./theme/fonts/FPD-Pressure/FPDPressure-Light.otf"); v_unload_private_font( "./theme/fonts/FPD-Pressure/FPDPressure-Regular.otf"); - v_unload_private_font( - "./theme/fonts/DramaSans/DramaSans.ttf"); - v_unload_private_font( - "./theme/fonts/SamIAm/MiniSmallCaps.ttf"); + v_unload_private_font("./theme/fonts/DramaSans/DramaSans.ttf"); + v_unload_private_font("./theme/fonts/SamIAm/MiniSmallCaps.ttf"); } main_action = MAIN_RESTART; diff --git a/source_files/obsidian_main/m_trans.cc b/source_files/obsidian_main/m_trans.cc index 53aa520224..c38fcf3bcc 100644 --- a/source_files/obsidian_main/m_trans.cc +++ b/source_files/obsidian_main/m_trans.cc @@ -1073,13 +1073,15 @@ void Trans_SetLanguage() { } // see if the translation file exists - std::string path = fmt::format("{}/language/{}.po", install_dir.string(), langcode); + std::string path = + fmt::format("{}/language/{}.po", install_dir.string(), langcode); if (!std::filesystem::exists(path)) { // if language has a territory field (like zh_TW or en_AU) then // try again with the plain language code. - path = fmt::format("{}/language/{}.po", install_dir.string(), lang_plain); + path = + fmt::format("{}/language/{}.po", install_dir.string(), lang_plain); } FILE *fp = fopen(path.c_str(), "rb"); diff --git a/source_files/obsidian_main/main.cc b/source_files/obsidian_main/main.cc index 8f62031088..36e2d8565f 100644 --- a/source_files/obsidian_main/main.cc +++ b/source_files/obsidian_main/main.cc @@ -137,33 +137,34 @@ FLASHWINFO blinker; #endif static void main_win_surprise_config_CB(Fl_Widget *w, void *data) { - Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; - const Fl_Menu_Item *checkbox = menu->find_item(main_win_surprise_config_CB); - preserve_old_config = (checkbox->value() != 0) ? true : false; + Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; + const Fl_Menu_Item *checkbox = menu->find_item(main_win_surprise_config_CB); + preserve_old_config = (checkbox->value() != 0) ? true : false; } static void main_win_architecture_config_CB(Fl_Widget *w, void *data) { - Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; - const Fl_Menu_Item *checkbox = menu->find_item(main_win_architecture_config_CB); - randomize_architecture = (checkbox->value() != 0) ? true : false; + Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; + const Fl_Menu_Item *checkbox = + menu->find_item(main_win_architecture_config_CB); + randomize_architecture = (checkbox->value() != 0) ? true : false; } static void main_win_monsters_config_CB(Fl_Widget *w, void *data) { - Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; - const Fl_Menu_Item *checkbox = menu->find_item(main_win_monsters_config_CB); - randomize_monsters = (checkbox->value() != 0) ? true : false; + Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; + const Fl_Menu_Item *checkbox = menu->find_item(main_win_monsters_config_CB); + randomize_monsters = (checkbox->value() != 0) ? true : false; } static void main_win_pickups_config_CB(Fl_Widget *w, void *data) { - Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; - const Fl_Menu_Item *checkbox = menu->find_item(main_win_pickups_config_CB); - randomize_pickups = (checkbox->value() != 0) ? true : false; + Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; + const Fl_Menu_Item *checkbox = menu->find_item(main_win_pickups_config_CB); + randomize_pickups = (checkbox->value() != 0) ? true : false; } static void main_win_misc_config_CB(Fl_Widget *w, void *data) { - Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; - const Fl_Menu_Item *checkbox = menu->find_item(main_win_misc_config_CB); - randomize_misc = (checkbox->value() != 0) ? true : false; + Fl_Menu_Bar *menu = (Fl_Menu_Bar *)w; + const Fl_Menu_Item *checkbox = menu->find_item(main_win_misc_config_CB); + randomize_misc = (checkbox->value() != 0) ? true : false; } /* ----- user information ----------------------------- */ @@ -385,7 +386,8 @@ void Determine_LoggingFile() { std::ofstream fp{logging_file}; if (!fp.is_open()) { - Main::FatalError("Cannot create log file: {}\n", logging_file.string()); + Main::FatalError("Cannot create log file: {}\n", + logging_file.string()); } fp.close(); @@ -455,7 +457,6 @@ static int DetermineScaling() { bool Main::LoadInternalFont(const char *fontpath, const int fontnum, const char *fontname) { - /* set the extra font */ if (i_load_private_font(fontpath)) { Fl::set_font(fontnum, fontname); @@ -559,8 +560,8 @@ void Main::PopulateFontMap() { } } - if (LoadInternalFont("./theme/fonts/3270/3270.ttf", - current_free_font, "3270 Condensed")) { + if (LoadInternalFont("./theme/fonts/3270/3270.ttf", current_free_font, + "3270 Condensed")) { Fl::set_font(current_free_font + 1, "3270 Condensed"); font_menu_items.push_back( std::map{{"3270", current_free_font}}); @@ -571,18 +572,19 @@ void Main::PopulateFontMap() { current_free_font, "Workbench Light Regular")) { if (LoadInternalFont("./theme/fonts/Workbench/Workbench.ttf", current_free_font + 1, "Workbench Regular")) { - font_menu_items.push_back( - std::map{{"Workbench", current_free_font}}); + font_menu_items.push_back(std::map{ + {"Workbench", current_free_font}}); current_free_font += 2; } } if (LoadInternalFont("./theme/fonts/FPD-Pressure/FPDPressure-Light.otf", current_free_font, "FPD Pressure Light")) { - if (LoadInternalFont("./theme/fonts/FPD-Pressure/FPDPressure-Regular.otf", - current_free_font + 1, "FPD Pressure")) { - font_menu_items.push_back( - std::map{{"FPD Pressure", current_free_font}}); + if (LoadInternalFont( + "./theme/fonts/FPD-Pressure/FPDPressure-Regular.otf", + current_free_font + 1, "FPD Pressure")) { + font_menu_items.push_back(std::map{ + {"FPD Pressure", current_free_font}}); current_free_font += 2; } } @@ -602,7 +604,6 @@ void Main::PopulateFontMap() { std::map{{"Sam I Am", current_free_font}}); current_free_font += 2; } - } // lossy conversion, size_t? @@ -796,9 +797,7 @@ void SetupFltk() { } // namespace Main #ifdef WIN32 -void Main::Blinker() { - FlashWindowEx(&blinker); -} +void Main::Blinker() { FlashWindowEx(&blinker); } #endif void Main::Ticker() { @@ -825,8 +824,7 @@ void Main::Detail::Shutdown(const bool error) { if (!preserve_old_config) { Cookie_Save(config_file); } - } - else { + } else { Cookie_Save(config_file); } } @@ -959,9 +957,9 @@ bool Build_Cool_Shit() { if (main_win) { main_win->build_box->string_seed = ""; - #ifdef WIN32 +#ifdef WIN32 Main::Blinker(); - #endif +#endif } } else { if (main_win) { @@ -983,7 +981,8 @@ bool Build_Cool_Shit() { main_action = 0; if (main_win) { main_win->label( - fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION).c_str()); + fmt::format("{} {}", _(OBSIDIAN_TITLE), OBSIDIAN_VERSION) + .c_str()); } Main::ProgStatus(_("Cancelled")); } @@ -1022,16 +1021,17 @@ restart:; batch_mode = true; batch_output_file = argv::list[batch_arg + 1]; - #ifdef WIN32 - if (AllocConsole()) { - freopen("CONOUT$", "r", stdin); - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); - } - #endif +#ifdef WIN32 + if (AllocConsole()) { + freopen("CONOUT$", "r", stdin); + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } +#endif } - // These switches will only apply in batch mode, as the GUI has its own mechanism for randomization of options - Dasho + // These switches will only apply in batch mode, as the GUI has its own + // mechanism for randomization of options - Dasho if (argv::Find(0, "randomize-all") >= 0) { if (batch_mode) { @@ -1067,7 +1067,7 @@ restart:; } } - skiprest: +skiprest: Determine_WorkingPath(argv[0]); Determine_InstallDir(argv[0]); @@ -1203,23 +1203,35 @@ restart:; // Have to add these after reading existing settings - Dasho if (main_win) { - main_win->menu_bar->add("Surprise Me/Preserve Old Config", NULL, main_win_surprise_config_CB, 0, FL_MENU_TOGGLE | (preserve_old_config ? FL_MENU_VALUE : 0)); - main_win->menu_bar->add("Surprise Me/Randomize Architecture", NULL, main_win_architecture_config_CB, 0, FL_MENU_TOGGLE | (randomize_architecture ? FL_MENU_VALUE : 0)); - main_win->menu_bar->add("Surprise Me/Randomize Monsters", NULL, main_win_monsters_config_CB, 0, FL_MENU_TOGGLE | (randomize_monsters ? FL_MENU_VALUE : 0)); - main_win->menu_bar->add("Surprise Me/Randomize Pickups", NULL, main_win_pickups_config_CB, 0, FL_MENU_TOGGLE | (randomize_pickups ? FL_MENU_VALUE : 0)); - main_win->menu_bar->add("Surprise Me/Randomize Misc", NULL, main_win_misc_config_CB, 0, FL_MENU_TOGGLE | (randomize_misc ? FL_MENU_VALUE : 0)); + main_win->menu_bar->add( + "Surprise Me/Preserve Old Config", NULL, + main_win_surprise_config_CB, 0, + FL_MENU_TOGGLE | (preserve_old_config ? FL_MENU_VALUE : 0)); + main_win->menu_bar->add( + "Surprise Me/Randomize Architecture", NULL, + main_win_architecture_config_CB, 0, + FL_MENU_TOGGLE | (randomize_architecture ? FL_MENU_VALUE : 0)); + main_win->menu_bar->add( + "Surprise Me/Randomize Monsters", NULL, main_win_monsters_config_CB, + 0, FL_MENU_TOGGLE | (randomize_monsters ? FL_MENU_VALUE : 0)); + main_win->menu_bar->add( + "Surprise Me/Randomize Pickups", NULL, main_win_pickups_config_CB, + 0, FL_MENU_TOGGLE | (randomize_pickups ? FL_MENU_VALUE : 0)); + main_win->menu_bar->add( + "Surprise Me/Randomize Misc", NULL, main_win_misc_config_CB, 0, + FL_MENU_TOGGLE | (randomize_misc ? FL_MENU_VALUE : 0)); } - #ifdef WIN32 +#ifdef WIN32 main_win->icon((const void *)LoadIcon(fl_display, MAKEINTRESOURCE(1))); - #else - #ifdef UNIX - fl_register_images(); - Fl_Pixmap program_icon(obsidian_icon); - Fl_RGB_Image rgb_icon(&program_icon, FL_BLACK); - UI_MainWin::default_icon(&rgb_icon); - #endif - #endif +#else +#ifdef UNIX + fl_register_images(); + Fl_Pixmap program_icon(obsidian_icon); + Fl_RGB_Image rgb_icon(&program_icon, FL_BLACK); + UI_MainWin::default_icon(&rgb_icon); +#endif +#endif // show window (pass some dummy arguments) { @@ -1229,9 +1241,11 @@ restart:; main_win->show(1 /* argc */, fake_argv); } - #ifdef WIN32 // Populate structure for taskbar/window flash. Must be done after main_win->show() function - Dasho - blinker = { sizeof(FLASHWINFO), fl_xid(main_win), FLASHW_ALL | FLASHW_TIMERNOFG, 0, 0 }; - #endif +#ifdef WIN32 // Populate structure for taskbar/window flash. Must be done after + // main_win->show() function - Dasho + blinker = {sizeof(FLASHWINFO), fl_xid(main_win), + FLASHW_ALL | FLASHW_TIMERNOFG, 0, 0}; +#endif // kill the stupid bright background of the "plastic" scheme if (widget_theme == 3) { @@ -1293,8 +1307,7 @@ restart:; if (!preserve_old_config) { Cookie_Save(config_file); } - } - else { + } else { Cookie_Save(config_file); } @@ -1325,8 +1338,7 @@ restart:; if (!preserve_old_config) { Cookie_Save(config_file); } - } - else { + } else { Cookie_Save(config_file); } } diff --git a/source_files/obsidian_main/q_common.h b/source_files/obsidian_main/q_common.h index 81060c59c4..50a0bf9b6e 100644 --- a/source_files/obsidian_main/q_common.h +++ b/source_files/obsidian_main/q_common.h @@ -40,7 +40,6 @@ enum quake_subformat_e { /***** CLASSES ****************/ class qLump_c { - public: std::string name; diff --git a/source_files/obsidian_main/q_light.cc b/source_files/obsidian_main/q_light.cc index 8bdd345d27..1cc194d6c3 100644 --- a/source_files/obsidian_main/q_light.cc +++ b/source_files/obsidian_main/q_light.cc @@ -1481,7 +1481,8 @@ static const int grid_xy_deltas[9 * 2] = {0, 0, +9, +9, +9, -9, -9, +9, -9, -9, +18, +18, +18, -18, -18, +18, -18, -18}; -static void Q3_CalcAngularDirection(std::array vec3, dlightgrid3_t *out) { +static void Q3_CalcAngularDirection(std::array vec3, + dlightgrid3_t *out) { float x = vec3[0]; float y = vec3[1]; float z = vec3[2]; @@ -1506,7 +1507,8 @@ static void Q3_CalcAngularDirection(std::array vec3, dlightgrid3_t *ou } } -static void Q3_ColorToBytes(int r, int g, int b, float mul, std::array out) { +static void Q3_ColorToBytes(int r, int g, int b, float mul, + std::array out) { float r2 = r * mul; float g2 = g * mul; float b2 = b * mul; diff --git a/source_files/obsidian_main/subprocess-mingw.h b/source_files/obsidian_main/subprocess-mingw.h index ca69f4d64c..6cdc472f1d 100644 --- a/source_files/obsidian_main/subprocess-mingw.h +++ b/source_files/obsidian_main/subprocess-mingw.h @@ -364,16 +364,18 @@ int subprocess_create_named_pipe_helper(void **rd, void **wr) { SUBPROCESS_NULL, 1}; char name[256] = {0}; - *rd = CreateNamedPipeA(name, pipeAccessInbound | fileFlagOverlapped, - pipeTypeByte | pipeWait, 1, 4096, 4096, - reinterpret_cast(SUBPROCESS_NULL), - SUBPROCESS_PTR_CAST(LPSECURITY_ATTRIBUTES, &saAttr)); + *rd = CreateNamedPipeA( + name, pipeAccessInbound | fileFlagOverlapped, pipeTypeByte | pipeWait, + 1, 4096, 4096, + reinterpret_cast(SUBPROCESS_NULL), + SUBPROCESS_PTR_CAST(LPSECURITY_ATTRIBUTES, &saAttr)); if (invalidHandleValue == rd) { return -1; } - *wr = CreateFileA(name, genericWrite, reinterpret_cast(SUBPROCESS_NULL), + *wr = CreateFileA(name, genericWrite, + reinterpret_cast(SUBPROCESS_NULL), SUBPROCESS_PTR_CAST(LPSECURITY_ATTRIBUTES, &saAttr), openExisting, fileAttributeNormal, SUBPROCESS_NULL); diff --git a/source_files/obsidian_main/sys_xoshiro.cc b/source_files/obsidian_main/sys_xoshiro.cc index f29ce83cb1..eb79bb383e 100644 --- a/source_files/obsidian_main/sys_xoshiro.cc +++ b/source_files/obsidian_main/sys_xoshiro.cc @@ -4,8 +4,8 @@ Xoshiro256 Random Generator By Dashodanger, 2020 This is meant to be a replacement for the AJ_Random library that -uses the fastPRNG xoshiro256 implementation for random number generation. -Usage will be as similar to AJ_Random as possible in order to minimize +uses the fastPRNG xoshiro256 implementation for random number generation. +Usage will be as similar to AJ_Random as possible in order to minimize changes in other sections of code. */ @@ -17,13 +17,16 @@ void xoshiro_Reseed(unsigned long long newseed) { xoshiro.seed(newseed); } unsigned long long xoshiro_UInt() { long long rand_num = (long long)(xoshiro.xoshiro256p()); - if (rand_num >= 0) { return rand_num; } + if (rand_num >= 0) { + return rand_num; + } return -rand_num; } double xoshiro_Double() { return xoshiro.xoshiro256p_UNI(); } -// This probably isn't super efficient, but it is rarely used and shouldn't make a huge overall hit to performance - Dasho +// This probably isn't super efficient, but it is rarely used and shouldn't make +// a huge overall hit to performance - Dasho int xoshiro_Between(int low, int high) { return (int)(xoshiro.xoshiro256p_Range(low, high)); } diff --git a/source_files/obsidian_main/ui_boxes.h b/source_files/obsidian_main/ui_boxes.h index c0d1978110..e9c0058f20 100644 --- a/source_files/obsidian_main/ui_boxes.h +++ b/source_files/obsidian_main/ui_boxes.h @@ -1,4 +1,5 @@ -// Headers for custom FLTK box drawing routines so that Theme colors are honored - Dasho +// Headers for custom FLTK box drawing routines so that Theme colors are honored +// - Dasho void cgleam_gleam_color(Fl_Color c); void cgleam_shade_rect_top_bottom(int x, int y, int w, int h, Fl_Color fg1, diff --git a/source_files/obsidian_main/ui_build.cc b/source_files/obsidian_main/ui_build.cc index 284ab5d38f..7c5334b3b3 100644 --- a/source_files/obsidian_main/ui_build.cc +++ b/source_files/obsidian_main/ui_build.cc @@ -271,7 +271,9 @@ void UI_Build::Prog_Nodes(int pos, int limit) { } float val = node_along + (node_fracs * pos); - if (val > 1) { val = 1; } + if (val > 1) { + val = 1; + } prog_label = fmt::format("{0:.2f}%", val * 100); @@ -290,12 +292,12 @@ void UI_Build::Prog_Nodes(int pos, int limit) { } void UI_Build::SetStatus(std::string_view msg) { - //int limit = (int)sizeof(status_label); + // int limit = (int)sizeof(status_label); #ifdef WIN32 #undef min #endif - //strncpy(status_label, msg.data(), std::min(limit, msg.size())); + // strncpy(status_label, msg.data(), std::min(limit, msg.size())); status_label = msg; if (StringCaseCmp(status_label, "Success") == 0) { diff --git a/source_files/obsidian_main/ui_module.cc b/source_files/obsidian_main/ui_module.cc index ee2115474d..186c8fe9ae 100644 --- a/source_files/obsidian_main/ui_module.cc +++ b/source_files/obsidian_main/ui_module.cc @@ -44,7 +44,9 @@ UI_Module::UI_Module(int X, int Y, int W, int H, std::string id, mod_button = new UI_CustomCheckBox(X + kf_w(6), Y + kf_h(5), W - kf_w(12), kf_h(24)); mod_button->box(FL_NO_BOX); - if (!suboptions) { mod_button->down_box(FL_NO_BOX); } + if (!suboptions) { + mod_button->down_box(FL_NO_BOX); + } mod_button->color(WINDOW_BG); if (Is_UI()) { @@ -90,7 +92,8 @@ typedef struct { } opt_change_callback_data_t; void UI_Module::AddOption(std::string opt, std::string label, std::string tip, - std::string longtip, int gap, std::string randomize_group) { + std::string longtip, int gap, + std::string randomize_group) { int nw = this->parent()->w(); // int nh = kf_h(30); @@ -98,8 +101,10 @@ void UI_Module::AddOption(std::string opt, std::string label, std::string tip, int ny = y() + cur_opt_y - kf_h(15); if (longtip.empty()) { - longtip = - fmt::format("Detailed help not yet written for this setting.\nCurrent short help/tooltip:\n{}", tip); + longtip = fmt::format( + "Detailed help not yet written for this setting.\nCurrent short " + "help/tooltip:\n{}", + tip); } UI_RChoice *rch = new UI_RChoice(nx, ny + kf_h(15), nw * .95, @@ -167,8 +172,10 @@ void UI_Module::AddSliderOption(std::string opt, std::string label, int ny = y() + cur_opt_y - kf_h(15); if (longtip.empty()) { - longtip = - fmt::format("Detailed help not yet written for this setting.\nCurrent short help/tooltip:\n{}", tip); + longtip = fmt::format( + "Detailed help not yet written for this setting.\nCurrent short " + "help/tooltip:\n{}", + tip); } label = fmt::format("{}: ", label); @@ -323,7 +330,8 @@ void UI_Module::AddSliderOption(std::string opt, std::string label, } void UI_Module::AddButtonOption(std::string opt, std::string label, - std::string tip, std::string longtip, int gap, std::string randomize_group) { + std::string tip, std::string longtip, int gap, + std::string randomize_group) { int nw = this->parent()->w(); // int nh = kf_h(30); @@ -331,8 +339,10 @@ void UI_Module::AddButtonOption(std::string opt, std::string label, int ny = y() + cur_opt_y - kf_h(15); if (longtip.empty()) { - longtip = - fmt::format("Detailed help not yet written for this setting.\nCurrent short help/tooltip:\n{}", tip); + longtip = fmt::format( + "Detailed help not yet written for this setting.\nCurrent short " + "help/tooltip:\n{}", + tip); } UI_RButton *rbt = new UI_RButton(nx, ny + kf_h(15), nw * .95, kf_h(24)); @@ -422,7 +432,8 @@ void UI_Module::update_Enable() { } } -void UI_Module::randomize_Values(std::vector selected_randomize_groups) { +void UI_Module::randomize_Values( + std::vector selected_randomize_groups) { std::map::const_iterator IT; std::map::const_iterator IT2; std::map::const_iterator IT3; @@ -449,7 +460,9 @@ void UI_Module::randomize_Values(std::vector selected_randomize_gro M->nan_options->value(0); M->nan_options->do_callback(); } - M->mod_slider->value(M->mod_slider->round(xoshiro.xoshiro256p_Range(M->mod_slider->minimum(), M->mod_slider->maximum()))); + M->mod_slider->value( + M->mod_slider->round(xoshiro.xoshiro256p_Range( + M->mod_slider->minimum(), M->mod_slider->maximum()))); M->mod_slider->do_callback(); break; } @@ -856,7 +869,8 @@ typedef struct { } mod_enable_callback_data_t; void UI_CustomMods::AddModule(std::string id, std::string label, - std::string tip, int red, int green, int blue, bool suboptions) { + std::string tip, int red, int green, int blue, + bool suboptions) { UI_Module *M = new UI_Module(mx, my, mw - 4, kf_h(34), id, label, tip, red, green, blue, suboptions); @@ -875,7 +889,8 @@ void UI_CustomMods::AddModule(std::string id, std::string label, bool UI_CustomMods::AddOption(std::string module, std::string option, std::string label, std::string tip, - std::string longtip, int gap, std::string randomize_group) { + std::string longtip, int gap, + std::string randomize_group) { UI_Module *M = FindID(module); if (!M) { @@ -893,7 +908,8 @@ bool UI_CustomMods::AddSliderOption(std::string module, std::string option, std::string label, std::string tip, std::string longtip, int gap, double min, double max, double inc, std::string units, - std::string presets, std::string nan, std::string randomize_group) { + std::string presets, std::string nan, + std::string randomize_group) { UI_Module *M = FindID(module); if (!M) { @@ -910,7 +926,8 @@ bool UI_CustomMods::AddSliderOption(std::string module, std::string option, bool UI_CustomMods::AddButtonOption(std::string module, std::string option, std::string label, std::string tip, - std::string longtip, int gap, std::string randomize_group) { + std::string longtip, int gap, + std::string randomize_group) { UI_Module *M = FindID(module); if (!M) { @@ -1444,7 +1461,8 @@ void UI_CustomMods::SurpriseMe() { UI_Module *M = (UI_Module *)mod_pack->child(j); SYS_ASSERT(M); std::vector selected_randomize_groups; - if (randomize_architecture) selected_randomize_groups.push_back("architecture"); + if (randomize_architecture) + selected_randomize_groups.push_back("architecture"); if (randomize_monsters) selected_randomize_groups.push_back("monsters"); if (randomize_pickups) selected_randomize_groups.push_back("pickups"); if (randomize_misc) selected_randomize_groups.push_back("misc"); diff --git a/source_files/obsidian_main/ui_module.h b/source_files/obsidian_main/ui_module.h index 8490017d48..6a5fe55513 100644 --- a/source_files/obsidian_main/ui_module.h +++ b/source_files/obsidian_main/ui_module.h @@ -68,7 +68,8 @@ class UI_Module : public Fl_Group { std::string nan, std::string randomize_group); void AddButtonOption(std::string opt, std::string label, std::string tip, - std::string longtip, int gap, std::string randomize_group); + std::string longtip, int gap, + std::string randomize_group); void AddOptionChoice(std::string option, std::string id, std::string label); @@ -140,7 +141,8 @@ class UI_CustomMods : public Fl_Group { bool EnableMod(std::string id, bool enable); bool AddOption(std::string module, std::string option, std::string label, - std::string tip, std::string longtip, int gap, std::string randomize_group); + std::string tip, std::string longtip, int gap, + std::string randomize_group); bool AddSliderOption(std::string module, std::string option, std::string label, std::string tip, @@ -150,7 +152,8 @@ class UI_CustomMods : public Fl_Group { bool AddButtonOption(std::string module, std::string option, std::string label, std::string tip, - std::string longtip, int gap, std::string randomize_group); + std::string longtip, int gap, + std::string randomize_group); void AddOptionChoice(std::string module, std::string option, std::string id, std::string label); diff --git a/source_files/obsidian_main/ui_widgets.cc b/source_files/obsidian_main/ui_widgets.cc index 9df44d33e0..e1eba2d2a7 100644 --- a/source_files/obsidian_main/ui_widgets.cc +++ b/source_files/obsidian_main/ui_widgets.cc @@ -261,7 +261,6 @@ UI_CustomCheckBox::~UI_CustomCheckBox() {} // Will also, in the absence of a down box, revert to drawing +/- instead. // This is for modules that expand into a series of options void UI_CustomCheckBox::draw() { - int W = labelsize(); int bx = Fl::box_dx(box()); // box frame width int dx = bx + 2; // relative position of check mark etc. @@ -293,12 +292,12 @@ void UI_CustomCheckBox::draw() { fl_color(FONT_COLOR); int tx = x() + dx + 3; int tw = W - 6; - int d1 = tw/3; - int d2 = tw-d1; - int ty = y() + dy + (W+d2)/2-d1-2; + int d1 = tw / 3; + int d2 = tw - d1; + int ty = y() + dy + (W + d2) / 2 - d1 - 2; fl_xyline(tx, ty, tx + tw); - fl_yxline(tx+d1+2, ty-d1-2, ty+d1+2); - } + fl_yxline(tx + d1 + 2, ty - d1 - 2, ty + d1 + 2); + } } lx = dx + W + 2; draw_label(x() + lx, y(), w() - lx - bx, h()); diff --git a/source_files/obsidian_main/ui_window.cc b/source_files/obsidian_main/ui_window.cc index 88f108f583..19136d2b48 100644 --- a/source_files/obsidian_main/ui_window.cc +++ b/source_files/obsidian_main/ui_window.cc @@ -46,9 +46,9 @@ static void main_win_close_CB(Fl_Widget *w, void *data) { } static void main_win_surprise_go_CB(Fl_Widget *w, void *data) { - main_win->left_mods->SurpriseMe(); - if (main_win->right_mods) main_win->right_mods->SurpriseMe(); - did_randomize = true; + main_win->left_mods->SurpriseMe(); + if (main_win->right_mods) main_win->right_mods->SurpriseMe(); + did_randomize = true; } // diff --git a/source_files/qsavetex/.clang-format b/source_files/qsavetex/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/source_files/qsavetex/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/source_files/wingetopt/.clang-format b/source_files/wingetopt/.clang-format new file mode 100644 index 0000000000..e3845288a2 --- /dev/null +++ b/source_files/wingetopt/.clang-format @@ -0,0 +1 @@ +DisableFormat: true