[decompiler] decompile particle defs using specialized macros (#1077)

* [decompiler] `defpart` and `defpartgroup`

* support sounds in part defs natively

* make `meters_to_string`

* update refs

* clang

* make macros in pair only work inside `(unquote ...`

* update source

* update finish

* fix
This commit is contained in:
ManDude
2022-01-16 01:01:38 +00:00
committed by GitHub
parent f757f1b9ac
commit 27bb6c6384
265 changed files with 101320 additions and 137303 deletions
+9 -1
View File
@@ -1,7 +1,7 @@
#include <cmath>
#include "third-party/fmt/core.h"
#include "common/common_types.h"
#include "common/goal_constants.h"
#include "third-party/dragonbox.h"
#include "print_float.h"
#include "common/util/assert.h"
@@ -19,6 +19,14 @@ std::string float_to_string(float value, bool append_trailing_decimal) {
return {buff};
}
/*!
* Wrapper around float_to_string, for printing meters. Unlike float_to_string, it does not append
* decimals by default.
*/
std::string meters_to_string(float value, bool append_trailing_decimal) {
return float_to_string(value / METER_LENGTH, append_trailing_decimal);
}
int float_to_cstr(float value, char* buffer, bool append_trailing_decimal) {
assert(std::isfinite(value));
// dragonbox gives us: