Files
jak-project/common/formatter/rules/rule_config.cpp
T
water111 85725401d2 [jak2] Hopefully improve sky performance (#3130)
Switches the slime look up table to be a texture, since I guess intel
drivers are terrible and putting the array in the shader makes it
extremely slow.

Also, a few minor changes:
- removed art-groups from the test-zone levels since this causes the
compiler to re-decompile the game, and makes the launcher slower. (left
it in commented out)
- Switched `decompile_code` to false by default in jak 2, in case people
run the decompiler and don't want to wait forever
- Fixed build warnings
2023-11-04 09:33:16 -04:00

50 lines
1.5 KiB
C++

#include "rule_config.h"
#include "common/formatter/formatter_tree.h"
namespace formatter_rules {
namespace config {
// TODO - populate these more
// TODO - this could be greatly simplified with C++20's designated initialization
FormFormattingConfig new_flow_rule(int start_index) {
FormFormattingConfig cfg;
cfg.hang_forms = false;
cfg.inline_until_index = start_index;
return cfg;
}
FormFormattingConfig new_binding_rule() {
FormFormattingConfig cfg;
cfg.hang_forms = false;
cfg.combine_first_two_lines = true;
auto binding_list_config = std::make_shared<FormFormattingConfig>();
binding_list_config->hang_forms = false;
binding_list_config->indentation_width = 1;
binding_list_config->indentation_width_for_index = [](FormFormattingConfig /*cfg*/, int index) {
if (index == 0) {
return 0;
}
return 4;
};
binding_list_config->should_prevent_inlining = [](FormFormattingConfig /*config*/, int num_refs) {
// Only prevent inlining a binding list, if there are more than 1 bindings
if (num_refs > 1) {
return true;
}
return false;
};
binding_list_config->prevent_inlining =
true; // TODO - we only want to prevent inlining if there are more than 2 elements
cfg.index_configs.emplace(1, binding_list_config);
return cfg;
}
const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config = {
{"defun", new_flow_rule(3)},
{"defmethod", new_flow_rule(4)},
{"let", new_binding_rule()}};
} // namespace config
} // namespace formatter_rules