diff --git a/common/goal_constants.h b/common/goal_constants.h index 974e291620..81f5a46fbe 100644 --- a/common/goal_constants.h +++ b/common/goal_constants.h @@ -1,8 +1,5 @@ #pragma once -#ifndef JAK_GOAL_CONSTANTS_H -#define JAK_GOAL_CONSTANTS_H - #include "common_types.h" constexpr s32 BINTEGER_OFFSET = 0; @@ -36,4 +33,7 @@ constexpr u64 EE_MAIN_MEM_MAP = 0x2123000000; // intentionally > 32-bit to // so this should be used only for debugging. constexpr bool EE_MEM_LOW_MAP = false; -#endif // JAK_GOAL_CONSTANTS_H +constexpr double METER_LENGTH = 4096.0; +constexpr double DEGREES_PER_ROT = 65536.0; +constexpr double DEGREES_LENGTH = DEGREES_PER_ROT / 360.0; +constexpr u64 TICKS_PER_SECOND = 300.0; diff --git a/common/type_system/TypeSystem.cpp b/common/type_system/TypeSystem.cpp index 8ab18a34e2..4c06256052 100644 --- a/common/type_system/TypeSystem.cpp +++ b/common/type_system/TypeSystem.cpp @@ -965,6 +965,13 @@ void TypeSystem::add_builtin_types() { add_builtin_value_type("uinteger", "uint64", 8); add_builtin_value_type("uinteger", "uint128", 16, false, false, RegClass::INT_128); + // add special units types. + add_builtin_value_type("float", "meters", 4, false, false, RegClass::FLOAT) + ->set_runtime_type("float"); + add_builtin_value_type("float", "degrees", 4, false, false, RegClass::FLOAT) + ->set_runtime_type("float"); + add_builtin_value_type("uint64", "seconds", 8, false, false)->set_runtime_type("uint64"); + auto int_type = add_builtin_value_type("integer", "int", 8, false, true); int_type->disallow_in_runtime(); auto uint_type = add_builtin_value_type("uinteger", "uint", 8, false, false); @@ -1352,8 +1359,23 @@ bool TypeSystem::typecheck_and_throw(const TypeSpec& expected, /*! * Is actual of type expected? For base types. */ -bool TypeSystem::typecheck_base_types(const std::string& expected, +bool TypeSystem::typecheck_base_types(const std::string& input_expected, const std::string& actual) const { + std::string expected = input_expected; + + // the unit types aren't picky. + if (expected == "meters") { + expected = "float"; + } + + if (expected == "seconds") { + expected = "uint"; + } + + if (expected == "degrees") { + expected = "float"; + } + // just to make sure it exists. lookup_type_allow_partial_def(expected); diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 2f07f8a60f..58f5c1e941 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -557,7 +557,7 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input, if (m_kind == Kind::ADD && tc(dts, TypeSpec("structure"), arg0_type) && arg1_type.is_integer_constant()) { auto type_info = dts.ts.lookup_type(arg0_type.typespec()); - if (type_info->get_size_in_memory() == arg1_type.get_integer_constant()) { + if ((u64)type_info->get_size_in_memory() == arg1_type.get_integer_constant()) { return TP_Type::make_from_ts(arg0_type.typespec()); } } diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 0eae101166..06d36e1c1f 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1274,6 +1274,7 @@ class ConstantFloatElement : public FormElement { FormStack& stack, std::vector* result, bool allow_side_effects) override; + float value() const { return m_value; } private: float m_value; @@ -1770,5 +1771,9 @@ GenericElement* alloc_generic_token_op(const std::string& name, const std::vector& args, FormPool& pool); Form* alloc_var_form(const RegisterAccess& var, FormPool& pool); -Form* try_cast_simplify(Form* in, const TypeSpec& new_type, FormPool& pool, const Env& env); +Form* try_cast_simplify(Form* in, + const TypeSpec& new_type, + FormPool& pool, + const Env& env, + bool tc_pass = false); } // namespace decompiler diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 19edd46998..a8df31fc8e 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -64,14 +64,59 @@ Form* strip_pcypld_64(Form* in) { return in; } } + +std::optional get_goal_float_constant(Form* in) { + auto as_fc = in->try_as_element(); + if (as_fc) { + return as_fc->value(); + } + return {}; +} } // namespace -Form* try_cast_simplify(Form* in, const TypeSpec& new_type, FormPool& pool, const Env& env) { +Form* try_cast_simplify(Form* in, + const TypeSpec& new_type, + FormPool& pool, + const Env& env, + bool tc_pass) { auto in_as_cast = dynamic_cast(in->try_as_single_element()); if (in_as_cast && in_as_cast->type() == new_type) { return in; // no need to cast again, it already has it! } + if (new_type == TypeSpec("meters")) { + auto fc = get_goal_float_constant(in); + + if (fc) { + double div = (double)*fc / METER_LENGTH; // GOOS will use doubles here + if (div * METER_LENGTH == *fc) { + return pool.alloc_single_element_form( + nullptr, + GenericOperator::make_function( + pool.alloc_single_element_form(nullptr, "meters")), + pool.alloc_single_element_form(nullptr, div)); + } else { + lg::error("Floating point value {} could not be converted to meters.", *fc); + } + } + } + + if (new_type == TypeSpec("degrees")) { + auto fc = get_goal_float_constant(in); + if (fc) { + double div = (double)*fc / DEGREES_LENGTH; // GOOS will use doubles here + if (div * DEGREES_LENGTH == *fc) { + return pool.alloc_single_element_form( + nullptr, + GenericOperator::make_function( + pool.alloc_single_element_form(nullptr, "degrees")), + pool.alloc_single_element_form(nullptr, div)); + } else { + lg::error("Floating point value {} could not be converted to degrees.", *fc); + } + } + } + auto type_info = env.dts->ts.lookup_type(new_type); auto bitfield_info = dynamic_cast(type_info); if (bitfield_info) { @@ -91,7 +136,11 @@ Form* try_cast_simplify(Form* in, const TypeSpec& new_type, FormPool& pool, cons } } - return nullptr; + if (tc_pass) { + return in; + } else { + return nullptr; + } } bool Form::has_side_effects() { @@ -285,8 +334,12 @@ void pop_helper(const std::vector& vars, /*! * This should be used to generate all casts. */ -Form* cast_form(Form* in, const TypeSpec& new_type, FormPool& pool, const Env& env) { - auto result = try_cast_simplify(in, new_type, pool, env); +Form* cast_form(Form* in, + const TypeSpec& new_type, + FormPool& pool, + const Env& env, + bool tc_pass = false) { + auto result = try_cast_simplify(in, new_type, pool, env, tc_pass); if (result) { return result; } @@ -340,15 +393,12 @@ std::vector pop_to_forms(const std::vector& vars, return forms; } -// TODO - if we start using child classes of float/int/uint for things like degrees/meters -// we may need to adjust these. - /*! * type == float (exactly)? */ bool is_float_type(const Env& env, int my_idx, RegisterAccess var) { auto type = env.get_types_before_op(my_idx).get(var.reg()).typespec(); - return type == TypeSpec("float"); + return env.dts->ts.tc(TypeSpec("float"), type); } /*! @@ -436,6 +486,10 @@ Form* make_cast_if_needed(Form* in, if (in_type == out_type) { return in; } + + if (out_type == TypeSpec("float") && env.dts->ts.tc(TypeSpec("float"), in_type)) { + return in; + } return cast_form(in, out_type, pool, env); } @@ -548,7 +602,8 @@ void SimpleExpressionElement::update_from_stack_fpr_to_gpr(const Env& env, bool allow_side_effects) { auto src = m_expr.get_arg(0); auto src_type = env.get_types_before_op(m_my_idx).get(src.var().reg()); - if (src_type.typespec() == TypeSpec("float") || src_type.typespec() == TypeSpec("int")) { + if (env.dts->ts.tc(TypeSpec("float"), src_type.typespec()) || + src_type.typespec() == TypeSpec("int")) { // set ourself to identity. m_expr = src.as_expr(); // then go again. @@ -2229,8 +2284,9 @@ void FunctionCallElement::update_from_stack(const Env& env, } auto desired_arg_type = function_type.get_arg(arg_id); - if (!env.dts->ts.tc(desired_arg_type, actual_arg_type)) { - arg_forms.push_back(cast_form(val, desired_arg_type, pool, env)); + if (env.dts->should_attempt_cast_simplify(desired_arg_type, actual_arg_type)) { + arg_forms.push_back(cast_form(val, desired_arg_type, pool, env, + env.dts->ts.tc(desired_arg_type, actual_arg_type))); } else { arg_forms.push_back(val); } diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 74122e1c3d..1ce871a73d 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -2166,8 +2166,8 @@ ) (deftype trsqv (trsq) - ((pause-adjust-distance float :offset 4) ;; todo meters - (nav-radius float :offset 8) ;; todo meters + ((pause-adjust-distance meters :offset 4) + (nav-radius meters :offset 8) (transv vector :inline :offset-assert 64) (rotv vector :inline :offset-assert 80) (scalev vector :inline :offset-assert 96) @@ -4779,7 +4779,7 @@ (bsp-mask uint64 :offset-assert 80) (bsphere sphere :offset-assert 88) (buzzer int32 :offset-assert 92) - (bottom-height float :offset-assert 96) ;; meters + (bottom-height meters :offset-assert 96) (run-packages pair :offset-assert 100) (prev-level basic :offset-assert 104) (next-level basic :offset-assert 108) @@ -4830,7 +4830,7 @@ (ambient entity-ambient-data-array :offset-assert 288) (closest-object float 9 :offset-assert 292) (upload-size int32 9 :offset-assert 328) - (level-distance float :offset-assert 364) ; meters + (level-distance meters :offset-assert 364) (inside-sphere? symbol :offset-assert 368) (inside-boxes? symbol :offset-assert 372) (display? symbol :offset-assert 376) @@ -4977,9 +4977,9 @@ ) (deftype math-camera (basic) - ((d float :offset-assert 4) ;; meters - (f float :offset-assert 8) ;; meters - (fov float :offset-assert 12) ;; deg + ((d meters :offset-assert 4) + (f meters :offset-assert 8) + (fov degrees :offset-assert 12) (x-ratio float :offset-assert 16) (y-ratio float :offset-assert 20) (x-pix float :offset-assert 24) @@ -4991,8 +4991,8 @@ (y-clip-ratio-in float :offset-assert 48) (y-clip-ratio-over float :offset-assert 52) (cull-info cull-info :inline :offset-assert 56) - (fog-start float :offset-assert 120) ;; meters - (fog-end float :offset-assert 124) ;; meters + (fog-start meters :offset-assert 120) + (fog-end meters :offset-assert 124) (fog-max float :offset-assert 128) (fog-min float :offset-assert 132) (reset int32 :offset-assert 136) @@ -7100,8 +7100,8 @@ (deftype mood-fog (structure) ((fog-color vector :inline :offset-assert 0) (fog-dists vector :inline :offset-assert 16) - (fog-start float :offset 16) ;; meters - (fog-end float :offset 20) ;;meters + (fog-start meters :offset 16) + (fog-end meters :offset 20) (fog-max float :offset 24) (fog-min float :offset 28) (erase-color vector :inline :offset-assert 32) @@ -7496,11 +7496,11 @@ (jgeo int32 :offset-assert 8) (janim int32 :offset-assert 12) (bounds vector :inline :offset-assert 16) - (radius float :offset 28) ;; meters + (radius meters :offset 28) (mgeo uint16 4 :offset-assert 32) (max-lod int32 :offset-assert 40) (lod-dist float 4 :offset-assert 44) - (longest-edge float :offset-assert 60) ;; meters + (longest-edge meters :offset-assert 60) (texture-level int8 :offset-assert 64) (version int8 :offset-assert 65) (shadow int8 :offset-assert 66) @@ -7515,7 +7515,7 @@ (declare-type merc-ctrl art-element) (deftype lod-group (structure) ((geo merc-ctrl :offset-assert 0) - (dist float :offset-assert 4) ;; meters + (dist meters :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -7556,7 +7556,7 @@ (cur-lod int8 :offset-assert 62) (desired-lod int8 :offset-assert 63) (ripple ripple-control :offset-assert 64) - (longest-edge float :offset-assert 68) ;; meters + (longest-edge meters :offset-assert 68) (longest-edge? uint32 :offset 68) (light-index uint8 :offset-assert 72) (dummy uint8 2 :offset-assert 73) @@ -7571,7 +7571,7 @@ (shadow-ctrl shadow-control :offset-assert 96) (origin vector :inline :offset-assert 112) (bounds vector :inline :offset-assert 128) - (radius float :offset 140) ;; meters + (radius meters :offset 140) (color-mult rgbaf :inline :offset-assert 144) (color-emissive rgbaf :inline :offset-assert 160) (secondary-interp float :offset-assert 176) @@ -8942,10 +8942,10 @@ (rdists vector :inline :offset-assert 48) (next uint32 4 :offset-assert 64) (count uint16 4 :offset-assert 80) - (near-plane float :offset 32) ;; meters - (near-stiff float :offset 36) ;; meters - (mid-plane float :offset 40) ;; meters - (far-plane float :offset 44) ;; meters + (near-plane meters :offset 32) + (near-stiff meters :offset 36) + (mid-plane meters :offset 40) + (far-plane meters :offset 44) (rlength-near float :offset 48) (rlength-stiff float :offset 52) (rlength-mid float :offset 56) @@ -9059,7 +9059,7 @@ (param float 2 :offset-assert 24) (group-sub-index int16 :offset-assert 32) (group-size int16 :offset-assert 34) - (dist float :offset-assert 36) ;; meters + (dist meters :offset-assert 36) (eval-time uint32 :offset-assert 40) (inspector-amount float :offset-assert 44) ) @@ -9385,12 +9385,12 @@ (deftype dynamics (basic) ((name basic :offset-assert 4) - (gravity-max float :offset-assert 8) ;; meters - (gravity-length float :offset-assert 12) ;; meters + (gravity-max meters :offset-assert 8) + (gravity-length meters :offset-assert 12) (gravity vector :inline :offset-assert 16) (gravity-normal vector :inline :offset-assert 32) - (walk-distance float :offset-assert 48) ;; meters - (run-distance float :offset-assert 52) ;; meters + (walk-distance meters :offset-assert 48) + (run-distance meters :offset-assert 52) ) :method-count-assert 9 :size-assert #x38 @@ -9570,17 +9570,17 @@ ((eco-level-max float :offset-assert 4) (eco-single-inc float :offset-assert 8) (eco-full-inc float :offset-assert 12) - (eco-single-timeout uint64 :offset-assert 16) ; usec - (eco-full-timeout uint64 :offset-assert 24) ; usec - (dummy uint64 :offset-assert 32) ; usec + (eco-single-timeout seconds :offset-assert 16) + (eco-full-timeout seconds :offset-assert 24) + (dummy seconds :offset-assert 32) (health-max-default float :offset-assert 40) (health-single-inc float :offset-assert 44) (eco-pill-max-default float :offset-assert 48) (health-small-inc float :offset-assert 52) (buzzer-max-default float :offset-assert 56) (buzzer-single-inc float :offset-assert 60) - (suck-bounce-dist float :offset-assert 64) ; meters - (suck-suck-dist float :offset-assert 68) ; meters + (suck-bounce-dist meters :offset-assert 64) + (suck-suck-dist meters :offset-assert 68) (default-pill-inc float :offset-assert 72) ) :method-count-assert 9 @@ -9611,7 +9611,7 @@ ((eco-type int32 :offset-assert 40) (eco-level float :offset-assert 44) (eco-pickup-time uint64 :offset-assert 48) - (eco-timeout uint64 :offset-assert 56) ;; usec + (eco-timeout seconds :offset-assert 56) (health float :offset-assert 64) (health-max float :offset-assert 68) (buzzer float :offset-assert 72) @@ -9636,12 +9636,12 @@ (deftype fact-info-enemy (fact-info) ((speed float :offset-assert 40) - (idle-distance float :offset-assert 44) ; meters - (notice-top float :offset-assert 48) ; meters - (notice-bottom float :offset-assert 52) ; meters - (cam-horz float :offset-assert 56) ; meters - (cam-vert float :offset-assert 60) ; meters - (cam-notice-dist float :offset-assert 64) ; meters + (idle-distance meters :offset-assert 44) + (notice-top meters :offset-assert 48) + (notice-bottom meters :offset-assert 52) + (cam-horz meters :offset-assert 56) + (cam-vert meters :offset-assert 60) + (cam-notice-dist meters :offset-assert 64) ) :method-count-assert 12 :size-assert #x44 @@ -9678,7 +9678,7 @@ (matrix matrix 2 :inline :offset-assert 32) (transform transform 2 :inline :offset-assert 160) (delta transformq :inline :offset-assert 256) - (last-speed float :offset-assert 304);; meters + (last-speed meters :offset-assert 304) (align transformq :inline :offset 160) ) :method-count-assert 14 @@ -9801,13 +9801,13 @@ (invinc-time uint64 :offset-assert 56) (mask uint32 :offset-assert 64) (mode basic :offset-assert 68) - (shove-back float :offset-assert 72) ;; meters - (shove-up float :offset-assert 76) ;; meters - (speed float :offset-assert 80) ;; meters - (dist float :offset-assert 84) ;; meters + (shove-back meters :offset-assert 72) + (shove-up meters :offset-assert 76) + (speed meters :offset-assert 80) + (dist meters :offset-assert 84) (control float :offset-assert 88) (angle basic :offset-assert 92) - (rotate-to float :offset-assert 96) ;; deg + (rotate-to degrees :offset-assert 96) (prev-state basic :offset-assert 100) ) :method-count-assert 10 @@ -9869,7 +9869,7 @@ (deftype part-spawner (process-drawable) ((mode uint32 :offset-assert 176) (enable basic :offset-assert 180) - (radius float :offset-assert 184) ;; meters + (radius meters :offset-assert 184) (world-sphere sphere :inline :offset-assert 192) ) :heap-base #x60 @@ -9958,8 +9958,8 @@ (deftype swingpole (process) ((root basic :offset-assert 112) (dir vector :inline :offset-assert 128) - (range float :offset-assert 144) ;; meters - (edge-length float :offset-assert 148) ;; meters + (range meters :offset-assert 144) + (edge-length meters :offset-assert 148) ) :heap-base #x30 :method-count-assert 14 @@ -10251,7 +10251,7 @@ ((initial-position vector :inline :offset-assert 0) (initial-velocity vector :inline :offset-assert 16) (time float :offset-assert 32) - (gravity float :offset-assert 36) ;; meters + (gravity meters :offset-assert 36) ) :method-count-assert 16 :size-assert #x28 @@ -10341,8 +10341,8 @@ (notice-time uint64 :offset-assert 112) (flex-blend float :offset-assert 120) (blend float :offset-assert 124) - (max-dist float :offset-assert 128) ;; meters - (ignore-angle float :offset-assert 132) ;; deg + (max-dist meters :offset-assert 128) + (ignore-angle degrees :offset-assert 132) (up uint8 :offset-assert 136) (nose uint8 :offset-assert 137) (ear uint8 :offset-assert 138) @@ -10676,7 +10676,7 @@ (action uint32 :offset 40) (offense int8 :offset 44) (prim-type int8 :offset 45) - (radius float :offset 60) ;; meters + (radius meters :offset 60) ) :method-count-assert 28 :size-assert #x48 @@ -10871,7 +10871,7 @@ (ground-poly-normal vector :inline :offset-assert 368) (ground-touch-point vector :inline :offset-assert 384) (shadow-pos vector :inline :offset-assert 400) - (ground-impact-vel float :offset-assert 416) ;; meters + (ground-impact-vel meters :offset-assert 416) (surface-angle float :offset-assert 420) (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) @@ -13176,8 +13176,8 @@ (deftype sparticle-group-item (structure) ((launcher uint32 :offset-assert 0) - (fade-after float :offset-assert 4) ;; meters - (falloff-to float :offset-assert 8) ;; meters + (fade-after meters :offset-assert 4) + (falloff-to meters :offset-assert 8) (flags uint16 :offset-assert 12) (period uint16 :offset-assert 14) (length uint16 :offset-assert 16) @@ -13397,12 +13397,12 @@ (joypad uint32 :offset-assert 8) (min-detectable-velocity float :offset-assert 12) (attack-timeout uint64 :offset-assert 16) - (default-string-max-y float :offset-assert 24) ; meters - (default-string-min-y float :offset-assert 28) ; meters - (default-string-max-z float :offset-assert 32) ; meters - (default-string-min-z float :offset-assert 36) ; meters - (default-string-push-z float :offset-assert 40) ; meters - (default-tilt-adjust float :offset-assert 44) ; deg + (default-string-max-y meters :offset-assert 24) + (default-string-min-y meters :offset-assert 28) + (default-string-max-z meters :offset-assert 32) + (default-string-min-z meters :offset-assert 36) + (default-string-push-z meters :offset-assert 40) + (default-tilt-adjust degrees :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 @@ -14201,7 +14201,7 @@ (dest-pos vector :inline :offset-assert 32) (current-poly nav-poly :offset-assert 48) (next-poly nav-poly :offset-assert 52) - (len float :offset-assert 56) ;; meters + (len meters :offset-assert 56) (last-edge int8 :offset-assert 60) (terminated basic :offset-assert 64) (reached-dest basic :offset-assert 68) @@ -14357,7 +14357,7 @@ (next-poly nav-poly :offset-assert 32) (target-poly nav-poly :offset-assert 36) (portal nav-route-portal 2 :offset-assert 40) ;; guess - (nearest-y-threshold float :offset-assert 48) ;; meters + (nearest-y-threshold meters :offset-assert 48) (event-temp vector :inline :offset-assert 64) (old-travel vector :inline :offset-assert 80) (blocked-travel vector :inline :offset-assert 96) @@ -15098,7 +15098,7 @@ ;; - Unknowns -(define-extern add-debug-vector (function symbol bucket-id vector vector float rgba symbol)) +(define-extern add-debug-vector (function symbol bucket-id vector vector meters rgba symbol)) (define-extern *debug-lines* (inline-array debug-line)) (define-extern *debug-lines-trk* debug-tracking-thang) (define-extern *debug-text-3ds* (inline-array debug-text-3d)) @@ -17577,24 +17577,24 @@ (process process :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) - (ripple-size float :offset-assert 20) ; meters + (ripple-size meters :offset-assert 20) (enter-water-time uint64 :offset-assert 24) (wade-time uint64 :offset-assert 32) (on-water-time uint64 :offset-assert 40) (enter-swim-time uint64 :offset-assert 48) (swim-time uint64 :offset-assert 56) - (base-height float :offset-assert 64) ; meters - (wade-height float :offset-assert 68) ; meters - (swim-height float :offset-assert 72) ; meters - (surface-height float :offset-assert 76) ; meters - (bottom-height float :offset-assert 80) ; meters - (height float :offset-assert 84) ; meters + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (height meters :offset-assert 84) (height-offset float 4 :offset-assert 88) - (real-ocean-offset float :offset 88) ; meters - (ocean-offset float :offset 92) ; meters - (bob-offset float :offset 96) ; meters - (align-offset float :offset 100) ; meters - (swim-depth float :offset-assert 104) ; meters + (real-ocean-offset meters :offset 88) + (ocean-offset meters :offset 92) + (bob-offset meters :offset 96) + (align-offset meters :offset 100) + (swim-depth meters :offset-assert 104) (bob smush-control :inline :offset-assert 112) (volume uint64 :offset-assert 144) ;; handle? (bottom vector 2 :inline :offset-assert 160) @@ -17605,7 +17605,7 @@ (drip-wetness float :offset-assert 260) (drip-time uint64 :offset-assert 264) (drip-speed float :offset-assert 272) - (drip-height float :offset-assert 276) ; meters + (drip-height meters :offset-assert 276) (drip-mult float :offset-assert 280) ) :method-count-assert 17 @@ -17625,10 +17625,10 @@ ) (deftype water-vol (process-drawable) - ((water-height float :offset-assert 176) ;; meters - (wade-height float :offset-assert 180) ;; meters - (swim-height float :offset-assert 184) ;; meters - (bottom-height float :offset-assert 188) ;; meters + ((water-height meters :offset-assert 176) + (wade-height meters :offset-assert 180) + (swim-height meters :offset-assert 184) + (bottom-height meters :offset-assert 188) (attack-event basic :offset-assert 192) (target uint64 :offset-assert 200) (flags uint32 :offset-assert 208) @@ -17729,9 +17729,9 @@ ;; - Types (deftype camera-master-bank (basic) - ((onscreen-head-height float :offset-assert 4) ;; meters - (onscreen-foot-height float :offset-assert 8) ;; meters - (target-height float :offset-assert 12) ;; meters + ((onscreen-head-height meters :offset-assert 4) + (onscreen-foot-height meters :offset-assert 8) + (target-height meters :offset-assert 12) (up-move-to-pitch-ratio-in-air float :offset-assert 16) (down-move-to-pitch-ratio-in-air float :offset-assert 20) (up-move-to-pitch-on-ground float :offset-assert 24) @@ -17920,8 +17920,8 @@ ;; - Types (deftype cam-point-watch-bank (basic) - ((speed float :offset-assert 4) - (rot-speed float :offset-assert 8) ;; deg + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) ) :method-count-assert 9 :size-assert #xc @@ -17929,8 +17929,8 @@ ) (deftype cam-free-bank (basic) - ((speed float :offset-assert 4) - (rot-speed float :offset-assert 8) ;; deg + ((speed float :offset-assert 4) + (rot-speed degrees :offset-assert 8) ) :method-count-assert 9 :size-assert #xc @@ -18769,8 +18769,8 @@ ; (flop-radius meters :offset-assert 512) ; (flop0-offset vector :inline :offset-assert 528) ; (flop1-offset vector :inline :offset-assert 544) -; (stuck-time useconds :offset-assert 560) -; (stuck-timeout useconds :offset-assert 568) +; (stuck-time seconds :offset-assert 560) +; (stuck-timeout seconds :offset-assert 568) ; (stuck-distance meters :offset-assert 576) ; (tongue-pull-speed-min float :offset-assert 580) ; (tongue-pull-speed-max float :offset-assert 584) @@ -21945,33 +21945,33 @@ (die-anim int32 :offset-assert 40) (neck-joint int32 :offset-assert 44) (player-look-at-joint int32 :offset-assert 48) - (run-travel-speed float :offset-assert 52) ; meters - (run-rotate-speed float :offset-assert 56) ; deg - (run-acceleration float :offset-assert 60) ; meters - (run-turn-time uint64 :offset-assert 64) ; seconds - (walk-travel-speed float :offset-assert 72) ; meters - (walk-rotate-speed float :offset-assert 76) ; deg - (walk-acceleration float :offset-assert 80) ; meters - (walk-turn-time uint64 :offset-assert 88) ; seconds - (attack-shove-back float :offset-assert 96) ; meters - (attack-shove-up float :offset-assert 100) ; meters - (shadow-size float :offset-assert 104) ; meters - (notice-nav-radius float :offset-assert 108) ; meters - (nav-nearest-y-threshold float :offset-assert 112) ; meters - (notice-distance float :offset-assert 116) ; meters - (proximity-notice-distance float :offset-assert 120) ; meters - (stop-chase-distance float :offset-assert 124) ; meters - (frustration-distance float :offset-assert 128) ; meters + (run-travel-speed meters :offset-assert 52) + (run-rotate-speed degrees :offset-assert 56) + (run-acceleration meters :offset-assert 60) + (run-turn-time seconds :offset-assert 64) + (walk-travel-speed meters :offset-assert 72) + (walk-rotate-speed degrees :offset-assert 76) + (walk-acceleration meters :offset-assert 80) + (walk-turn-time seconds :offset-assert 88) + (attack-shove-back meters :offset-assert 96) + (attack-shove-up meters :offset-assert 100) + (shadow-size meters :offset-assert 104) + (notice-nav-radius meters :offset-assert 108) + (nav-nearest-y-threshold meters :offset-assert 112) + (notice-distance meters :offset-assert 116) + (proximity-notice-distance meters :offset-assert 120) + (stop-chase-distance meters :offset-assert 124) + (frustration-distance meters :offset-assert 128) (frustration-time uint64 :offset-assert 136) (die-anim-hold-frame float :offset-assert 144) (jump-anim-start-frame float :offset-assert 148) (jump-land-anim-end-frame float :offset-assert 152) - (jump-height-min float :offset-assert 156) ; meters + (jump-height-min meters :offset-assert 156) (jump-height-factor float :offset-assert 160) (jump-start-anim-speed float :offset-assert 164) - (shadow-max-y float :offset-assert 168) ; meters - (shadow-min-y float :offset-assert 172) ; meters - (shadow-locus-dist float :offset-assert 176) ; meters + (shadow-max-y meters :offset-assert 168) + (shadow-min-y meters :offset-assert 172) + (shadow-locus-dist meters :offset-assert 176) (use-align basic :offset-assert 180) (draw-shadow basic :offset-assert 184) (move-to-ground basic :offset-assert 188) @@ -23956,15 +23956,15 @@ ; (deftype pelican-bank (basic) ; ((circle-speed meters :offset-assert 4) -; (dive-time useconds :offset-assert 8) -; (to-nest0-time useconds :offset-assert 16) -; (to-nest1-time useconds :offset-assert 24) -; (land-time useconds :offset-assert 32) -; (from-nest-time useconds :offset-assert 40) -; (spit-time useconds :offset-assert 48) -; (pre-spit-wait-time useconds :offset-assert 56) -; (post-spit-wait-time useconds :offset-assert 64) -; (run-away-time useconds :offset-assert 72) +; (dive-time seconds :offset-assert 8) +; (to-nest0-time seconds :offset-assert 16) +; (to-nest1-time seconds :offset-assert 24) +; (land-time seconds :offset-assert 32) +; (from-nest-time seconds :offset-assert 40) +; (spit-time seconds :offset-assert 48) +; (pre-spit-wait-time seconds :offset-assert 56) +; (post-spit-wait-time seconds :offset-assert 64) +; (run-away-time seconds :offset-assert 72) ; ) ; :method-count-assert 9 ; :size-assert #x50 @@ -30285,17 +30285,17 @@ ; ((y-offset meters :offset-assert 176) ; (y-offset-grips meters :offset-assert 180) ; (height meters :offset-assert 184) -; (turn deg :offset-assert 188) -; (tilt deg :offset-assert 192) -; (target-turn deg :offset-assert 196) -; (target-tilt deg :offset-assert 200) +; (turn degrees :offset-assert 188) +; (tilt degrees :offset-assert 192) +; (target-turn degrees :offset-assert 196) +; (target-tilt degrees :offset-assert 200) ; (base vector :inline :offset-assert 208) ; (reflector-trans vector :inline :offset-assert 224) ; (next-reflector-trans vector :inline :offset-assert 240) ; (prev-reflector-trans vector :inline :offset-assert 256) ; (old-camera-matrix matrix :inline :offset-assert 272) ; (reflector uint32 :offset-assert 336) -; (gauge-rot deg :offset-assert 340) +; (gauge-rot degrees :offset-assert 340) ; (lock-time uint64 :offset-assert 344) ; (aligned? basic :offset-assert 352) ; (raised? basic :offset-assert 356) @@ -31121,9 +31121,9 @@ ; (rot vector :inline :offset-assert 80) ; (rot-old vector :inline :offset-assert 96) ; (rotv vector :inline :offset-assert 112) -; (lean-rotx deg :offset-assert 128) -; (change-roty deg :offset-assert 132) -; (change-roty-old deg :offset-assert 136) +; (lean-rotx degrees :offset-assert 128) +; (change-roty degrees :offset-assert 132) +; (change-roty-old degrees :offset-assert 136) ; (quat vector :inline :offset-assert 144) ; (surface-y meters :offset-assert 160) ; (surface-vy meters :offset-assert 164) @@ -31140,7 +31140,7 @@ ; (hill-value float :offset-assert 268) ; (hill-ground-value float :offset-assert 272) ; (hill-offset meters :offset-assert 276) -; (hill-rotx deg :offset-assert 280) +; (hill-rotx degrees :offset-assert 280) ; (hill-boost meters :offset-assert 284) ; (bob-timer float :offset-assert 288) ; (bob-meta-timer float :offset-assert 292) @@ -31150,19 +31150,19 @@ ; (bob-period float :offset-assert 308) ; (bob-meta-time uint64 :offset-assert 312) ; (bob-hit-ground-time uint64 :offset-assert 320) -; (cur-rotx deg :offset-assert 328) -; (targ-rotx deg :offset-assert 332) +; (cur-rotx degrees :offset-assert 328) +; (targ-rotx degrees :offset-assert 332) ; (speed-rotx float :offset-assert 336) -; (mult-rotx deg :offset-assert 340) +; (mult-rotx degrees :offset-assert 340) ; (front-blade basic :offset-assert 344) -; (front-rot deg :offset-assert 348) -; (front-rotv deg :offset-assert 352) +; (front-rot degrees :offset-assert 348) +; (front-rotv degrees :offset-assert 352) ; (bottom-blade basic :offset-assert 356) -; (bottom-rot deg :offset-assert 360) +; (bottom-rot degrees :offset-assert 360) ; (front basic :offset-assert 364) -; (front-turn deg :offset-assert 368) +; (front-turn degrees :offset-assert 368) ; (tail basic :offset-assert 372) -; (tail-tilt deg :offset-assert 376) +; (tail-tilt degrees :offset-assert 376) ; (transv-max meters :offset-assert 380) ; (slide-down-time UNKNOWN 2 :offset-assert 384) ; (slide-enter-time uint64 :offset-assert 400) @@ -31207,7 +31207,7 @@ ; ) ; (deftype racer-bank (basic) -; ((slide-hold-time useconds :offset-assert 8) +; ((slide-hold-time seconds :offset-assert 8) ; (heat-max float :offset-assert 16) ; (hotcoals-heat-inc float :offset-assert 20) ; (lava-heat-inc float :offset-assert 24) @@ -31222,8 +31222,8 @@ ; (boost-curve-max meters :offset-assert 60) ; (boost-level-max meters :offset-assert 64) ; (boost-level-inc meters :offset-assert 68) -; (boost-duration useconds :offset-assert 72) -; (default-front-blade deg :offset-assert 80) +; (boost-duration seconds :offset-assert 72) +; (default-front-blade degrees :offset-assert 80) ; (yellow-projectile-speed meters :offset-assert 84) ; ) ; :method-count-assert 9 @@ -31977,7 +31977,7 @@ ; (push-velocity vector :inline :offset-assert 224) ; (home-base vector :inline :offset-assert 240) ; (dest-base vector :inline :offset-assert 256) -; (dest-rot deg :offset-assert 272) +; (dest-rot degrees :offset-assert 272) ; (enable-turn-around basic :offset-assert 276) ; (rotating basic :offset-assert 280) ; (in-pen basic :offset-assert 284) diff --git a/decompiler/util/DecompilerTypeSystem.cpp b/decompiler/util/DecompilerTypeSystem.cpp index 1065977707..bfb28cecdb 100644 --- a/decompiler/util/DecompilerTypeSystem.cpp +++ b/decompiler/util/DecompilerTypeSystem.cpp @@ -434,4 +434,21 @@ TypeSpec DecompilerTypeSystem::lookup_symbol_type(const std::string& name) const return kv->second; } } + +bool DecompilerTypeSystem::should_attempt_cast_simplify(const TypeSpec& expected, + const TypeSpec& actual) const { + if (expected == TypeSpec("meters") && actual == TypeSpec("float")) { + return true; + } + + if (expected == TypeSpec("seconds") && actual == TypeSpec("uint64")) { + return true; + } + + if (expected == TypeSpec("degrees") && actual == TypeSpec("float")) { + return true; + } + + return !ts.tc(expected, actual); +} } // namespace decompiler diff --git a/decompiler/util/DecompilerTypeSystem.h b/decompiler/util/DecompilerTypeSystem.h index d1ec31e446..03f2eb0639 100644 --- a/decompiler/util/DecompilerTypeSystem.h +++ b/decompiler/util/DecompilerTypeSystem.h @@ -43,6 +43,7 @@ class DecompilerTypeSystem { int get_format_arg_count(const std::string& str) const; int get_format_arg_count(const TP_Type& type) const; TypeSpec lookup_symbol_type(const std::string& name) const; + bool should_attempt_cast_simplify(const TypeSpec& expected, const TypeSpec& actual) const; // todo - totally eliminate this. struct { diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 8b237ffffa..d31a4d4ce4 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -857,11 +857,35 @@ goos::Object decompile_value(const TypeSpec& type, } else { return pretty_print::to_symbol(fmt::format("{}", value)); } + } else if (type == TypeSpec("seconds")) { + assert(bytes.size() == 8); + u64 value; + memcpy(&value, bytes.data(), 8); + + // only rewrite if exact. + u64 seconds = value / TICKS_PER_SECOND; + if (seconds * TICKS_PER_SECOND == value) { + return pretty_print::to_symbol(fmt::format("(seconds {})", seconds)); + } + + return pretty_print::to_symbol(fmt::format("#x{:x}", value)); } else if (ts.tc(TypeSpec("uint64"), type)) { assert(bytes.size() == 8); u64 value; memcpy(&value, bytes.data(), 8); return pretty_print::to_symbol(fmt::format("#x{:x}", value)); + } else if (type == TypeSpec("meters")) { + assert(bytes.size() == 4); + float value; + memcpy(&value, bytes.data(), 4); + double meters = (double)value / METER_LENGTH; + return pretty_print::build_list("meters", pretty_print::float_representation(meters)); + } else if (type == TypeSpec("degrees")) { + assert(bytes.size() == 4); + float value; + memcpy(&value, bytes.data(), 4); + double degrees = (double)value / DEGREES_LENGTH; + return pretty_print::build_list("degrees", pretty_print::float_representation(degrees)); } else if (ts.tc(TypeSpec("float"), type)) { assert(bytes.size() == 4); float value; diff --git a/docs/markdown/progress-notes/changelog.md b/docs/markdown/progress-notes/changelog.md index 494ea29a28..19dadf9560 100644 --- a/docs/markdown/progress-notes/changelog.md +++ b/docs/markdown/progress-notes/changelog.md @@ -177,4 +177,5 @@ - Lambdas and methods now support `:behavior` to specify the current process type. - `defbehavior` has been added to define a global behavior. - Auto-generated inspect methods of process now start by calling the parent type's inspect, like in GOAL. -- Fields with type `(inline-array thing)` can now be set in statics. \ No newline at end of file +- Fields with type `(inline-array thing)` can now be set in statics. +- `meters`, `degrees`, and `seconds` types have been added. \ No newline at end of file diff --git a/goal_src/engine/anim/aligner-h.gc b/goal_src/engine/anim/aligner-h.gc index 134f144a53..41e6eb6a4d 100644 --- a/goal_src/engine/anim/aligner-h.gc +++ b/goal_src/engine/anim/aligner-h.gc @@ -7,15 +7,15 @@ (deftype align-control (basic) - ((flags uint32 :offset-assert 4) - (process process-drawable :offset-assert 8) - (frame-group art-joint-anim :offset-assert 12) - (frame-num float :offset-assert 16) - (matrix matrix 2 :inline :offset-assert 32) - (transform transform 2 :inline :offset-assert 160) - (delta transformq :inline :offset-assert 256) - (last-speed float :offset-assert 304);; meters - (align transformq :inline :offset 160) + ((flags uint32 :offset-assert 4) + (process process-drawable :offset-assert 8) + (frame-group art-joint-anim :offset-assert 12) + (frame-num float :offset-assert 16) + (matrix matrix 2 :inline :offset-assert 32) + (transform transform 2 :inline :offset-assert 160) + (delta transformq :inline :offset-assert 256) + (last-speed meters :offset-assert 304) + (align transformq :inline :offset 160) ) :method-count-assert 14 :size-assert #x134 diff --git a/goal_src/engine/anim/joint-h.gc b/goal_src/engine/anim/joint-h.gc index 87878901d9..5586766985 100644 --- a/goal_src/engine/anim/joint-h.gc +++ b/goal_src/engine/anim/joint-h.gc @@ -16,7 +16,7 @@ (param float 2 :offset-assert 24) (group-sub-index int16 :offset-assert 32) (group-size int16 :offset-assert 34) - (dist float :offset-assert 36) ;; meters + (dist meters :offset-assert 36) (eval-time uint32 :offset-assert 40) (inspector-amount float :offset-assert 44) ) diff --git a/goal_src/engine/camera/camera-h.gc b/goal_src/engine/camera/camera-h.gc index 0209a32012..19fc1d4e1f 100644 --- a/goal_src/engine/camera/camera-h.gc +++ b/goal_src/engine/camera/camera-h.gc @@ -7,16 +7,16 @@ ;; definition of type camera-bank (deftype camera-bank (basic) - ((collide-move-rad float :offset-assert 4) - (joypad uint32 :offset-assert 8) - (min-detectable-velocity float :offset-assert 12) - (attack-timeout uint64 :offset-assert 16) - (default-string-max-y float :offset-assert 24) - (default-string-min-y float :offset-assert 28) - (default-string-max-z float :offset-assert 32) - (default-string-min-z float :offset-assert 36) - (default-string-push-z float :offset-assert 40) - (default-tilt-adjust float :offset-assert 44) + ((collide-move-rad float :offset-assert 4) + (joypad uint32 :offset-assert 8) + (min-detectable-velocity float :offset-assert 12) + (attack-timeout uint64 :offset-assert 16) + (default-string-max-y meters :offset-assert 24) + (default-string-min-y meters :offset-assert 28) + (default-string-max-z meters :offset-assert 32) + (default-string-min-z meters :offset-assert 36) + (default-string-push-z meters :offset-assert 40) + (default-tilt-adjust degrees :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 @@ -29,12 +29,12 @@ :collide-move-rad 1638.4 :min-detectable-velocity 40.96 :attack-timeout #x4b - :default-string-max-y 12288.0 - :default-string-min-y 4096.0 - :default-string-max-z 51200.0 - :default-string-min-z 20480.0 - :default-string-push-z 40960.0 - :default-tilt-adjust -1183.289 + :default-string-max-y (meters 3.0) + :default-string-min-y (meters 1.0) + :default-string-max-z (meters 12.5) + :default-string-min-z (meters 5.0) + :default-string-push-z (meters 10.0) + :default-tilt-adjust (degrees -6.5000005) ) ) diff --git a/goal_src/engine/camera/math-camera-h.gc b/goal_src/engine/camera/math-camera-h.gc index 739087b1e1..b26b00cd59 100644 --- a/goal_src/engine/camera/math-camera-h.gc +++ b/goal_src/engine/camera/math-camera-h.gc @@ -47,54 +47,54 @@ ) (deftype math-camera (basic) - ((d float :offset-assert 4) ;; meters, camera near plane - (f float :offset-assert 8) ;; meters, camera far plane - (fov float :offset-assert 12) ;; deg, field of view angle - (x-ratio float :offset-assert 16) - (y-ratio float :offset-assert 20) - (x-pix float :offset-assert 24) - (x-clip float :offset-assert 28) - (x-clip-ratio-in float :offset-assert 32) - (x-clip-ratio-over float :offset-assert 36) - (y-pix float :offset-assert 40) - (y-clip float :offset-assert 44) - (y-clip-ratio-in float :offset-assert 48) - (y-clip-ratio-over float :offset-assert 52) - (cull-info cull-info :inline :offset-assert 56) - (fog-start float :offset-assert 120) ;; meters - (fog-end float :offset-assert 124) ;; meters - (fog-max float :offset-assert 128) - (fog-min float :offset-assert 132) - (reset int32 :offset-assert 136) - (smooth-step float :offset-assert 140) - (smooth-t float :offset-assert 144) - (perspective matrix :inline :offset-assert 160) - (isometric matrix :inline :offset-assert 224) - (sprite-2d matrix :inline :offset-assert 288) - (sprite-2d-hvdf vector :inline :offset-assert 352) - (camera-rot matrix :inline :offset-assert 368) - (inv-camera-rot matrix :inline :offset-assert 432) - (inv-camera-rot-smooth matrix :inline :offset-assert 496) - (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) - (camera-temp matrix :inline :offset-assert 576) - (prev-camera-temp matrix :inline :offset-assert 640) - (hmge-scale vector :inline :offset-assert 704) - (inv-hmge-scale vector :inline :offset-assert 720) - (hvdf-off vector :inline :offset-assert 736) - (guard vector :inline :offset-assert 752) - (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) - (vis-gifs-quads uint128 4 :offset 768) - (giftex vis-gif-tag :offset 768) - (gifgr vis-gif-tag :offset 784) - (giftex-trans vis-gif-tag :offset 800) - (gifgr-trans vis-gif-tag :offset 816) - (pfog0 float :offset-assert 832) - (pfog1 float :offset-assert 836) - (trans vector :inline :offset-assert 848) - (plane uint128 4 :offset-assert 864) - (guard-plane uint128 4 :offset-assert 928) - (shrub-mat matrix :inline :offset-assert 992) - (fov-correction-factor float :offset-assert 1056) + ((d meters :offset-assert 4) + (f meters :offset-assert 8) + (fov degrees :offset-assert 12) + (x-ratio float :offset-assert 16) + (y-ratio float :offset-assert 20) + (x-pix float :offset-assert 24) + (x-clip float :offset-assert 28) + (x-clip-ratio-in float :offset-assert 32) + (x-clip-ratio-over float :offset-assert 36) + (y-pix float :offset-assert 40) + (y-clip float :offset-assert 44) + (y-clip-ratio-in float :offset-assert 48) + (y-clip-ratio-over float :offset-assert 52) + (cull-info cull-info :inline :offset-assert 56) + (fog-start meters :offset-assert 120) + (fog-end meters :offset-assert 124) + (fog-max float :offset-assert 128) + (fog-min float :offset-assert 132) + (reset int32 :offset-assert 136) + (smooth-step float :offset-assert 140) + (smooth-t float :offset-assert 144) + (perspective matrix :inline :offset-assert 160) + (isometric matrix :inline :offset-assert 224) + (sprite-2d matrix :inline :offset-assert 288) + (sprite-2d-hvdf vector :inline :offset-assert 352) + (camera-rot matrix :inline :offset-assert 368) + (inv-camera-rot matrix :inline :offset-assert 432) + (inv-camera-rot-smooth matrix :inline :offset-assert 496) + (inv-camera-rot-smooth-from quaternion :inline :offset-assert 560) + (camera-temp matrix :inline :offset-assert 576) + (prev-camera-temp matrix :inline :offset-assert 640) + (hmge-scale vector :inline :offset-assert 704) + (inv-hmge-scale vector :inline :offset-assert 720) + (hvdf-off vector :inline :offset-assert 736) + (guard vector :inline :offset-assert 752) + (vis-gifs vis-gif-tag 4 :inline :offset-assert 768) + (vis-gifs-quads uint128 4 :offset 768) + (giftex vis-gif-tag :offset 768) + (gifgr vis-gif-tag :offset 784) + (giftex-trans vis-gif-tag :offset 800) + (gifgr-trans vis-gif-tag :offset 816) + (pfog0 float :offset-assert 832) + (pfog1 float :offset-assert 836) + (trans vector :inline :offset-assert 848) + (plane uint128 4 :offset-assert 864) + (guard-plane uint128 4 :offset-assert 928) + (shrub-mat matrix :inline :offset-assert 992) + (fov-correction-factor float :offset-assert 1056) ) (:methods (new (symbol type) _type_ 0) diff --git a/goal_src/engine/collide/collide-shape-h.gc b/goal_src/engine/collide/collide-shape-h.gc index db9c7449ca..3ac61960b2 100644 --- a/goal_src/engine/collide/collide-shape-h.gc +++ b/goal_src/engine/collide/collide-shape-h.gc @@ -145,7 +145,7 @@ (offense int8 :offset 44) (prim-type int8 :offset 45) ;; overlay of the local-sphere w - (radius float :offset 60) ;; meters + (radius meters :offset 60) ) :method-count-assert 28 :size-assert #x48 @@ -354,7 +354,7 @@ (ground-poly-normal vector :inline :offset-assert 368) (ground-touch-point vector :inline :offset-assert 384) (shadow-pos vector :inline :offset-assert 400) - (ground-impact-vel float :offset-assert 416) ;; meters + (ground-impact-vel meters :offset-assert 416) (surface-angle float :offset-assert 420) (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) diff --git a/goal_src/engine/data/art-h.gc b/goal_src/engine/data/art-h.gc index e8f6143dd7..1a793e796e 100644 --- a/goal_src/engine/data/art-h.gc +++ b/goal_src/engine/data/art-h.gc @@ -201,20 +201,20 @@ ) (deftype skeleton-group (basic) - ((art-group-name basic :offset-assert 4) - (jgeo int32 :offset-assert 8) - (janim int32 :offset-assert 12) - (bounds vector :inline :offset-assert 16) - (radius float :offset 28) - (mgeo uint16 4 :offset-assert 32) - (max-lod int32 :offset-assert 40) - (lod-dist float 4 :offset-assert 44) - (longest-edge float :offset-assert 60) - (texture-level int8 :offset-assert 64) - (version int8 :offset-assert 65) - (shadow int8 :offset-assert 66) - (sort int8 :offset-assert 67) - (_pad uint8 4 :offset-assert 68) + ((art-group-name basic :offset-assert 4) + (jgeo int32 :offset-assert 8) + (janim int32 :offset-assert 12) + (bounds vector :inline :offset-assert 16) + (radius meters :offset 28) + (mgeo uint16 4 :offset-assert 32) + (max-lod int32 :offset-assert 40) + (lod-dist float 4 :offset-assert 44) + (longest-edge meters :offset-assert 60) + (texture-level int8 :offset-assert 64) + (version int8 :offset-assert 65) + (shadow int8 :offset-assert 66) + (sort int8 :offset-assert 67) + (_pad uint8 4 :offset-assert 68) ) :method-count-assert 9 :size-assert #x48 @@ -223,8 +223,8 @@ (declare-type merc-ctrl basic) (deftype lod-group (structure) - ((geo merc-ctrl :offset-assert 0) - (dist float :offset-assert 4) ;; meters + ((geo merc-ctrl :offset-assert 0) + (dist meters :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -265,7 +265,7 @@ (cur-lod int8 :offset-assert 62) (desired-lod int8 :offset-assert 63) (ripple ripple-control :offset-assert 64) - (longest-edge float :offset-assert 68) ;; meters + (longest-edge meters :offset-assert 68) (longest-edge? uint32 :offset 68) (light-index uint8 :offset-assert 72) (dummy uint8 2 :offset-assert 73) @@ -280,7 +280,7 @@ (shadow-ctrl shadow-control :offset-assert 96) (origin vector :inline :offset-assert 112) (bounds vector :inline :offset-assert 128) - (radius float :offset 140) ;; meters + (radius meters :offset 140) (color-mult rgbaf :inline :offset-assert 144) (color-emissive rgbaf :inline :offset-assert 160) (secondary-interp float :offset-assert 176) diff --git a/goal_src/engine/debug/debug.gc b/goal_src/engine/debug/debug.gc index f7e01565f6..f7420e26cd 100644 --- a/goal_src/engine/debug/debug.gc +++ b/goal_src/engine/debug/debug.gc @@ -1176,7 +1176,7 @@ ) ) -(defun-debug add-debug-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 float) (arg5 rgba)) +(defun-debug add-debug-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 meters) (arg5 rgba)) (if (not arg0) (return #f) ) diff --git a/goal_src/engine/game/fact-h.gc b/goal_src/engine/game/fact-h.gc index 5f1c4e9c7c..b43b2dae1d 100644 --- a/goal_src/engine/game/fact-h.gc +++ b/goal_src/engine/game/fact-h.gc @@ -9,21 +9,21 @@ ;; All game code should reference *FACT-bank* to determine these parameters (deftype fact-bank (basic) - ((eco-level-max float :offset-assert 4) - (eco-single-inc float :offset-assert 8) - (eco-full-inc float :offset-assert 12) - (eco-single-timeout uint64 :offset-assert 16) ; usec - (eco-full-timeout uint64 :offset-assert 24) ; usec - (dummy uint64 :offset-assert 32) ; usec - (health-max-default float :offset-assert 40) - (health-single-inc float :offset-assert 44) - (eco-pill-max-default float :offset-assert 48) - (health-small-inc float :offset-assert 52) - (buzzer-max-default float :offset-assert 56) - (buzzer-single-inc float :offset-assert 60) - (suck-bounce-dist float :offset-assert 64) ; meters - (suck-suck-dist float :offset-assert 68) ; meters - (default-pill-inc float :offset-assert 72) + ((eco-level-max float :offset-assert 4) + (eco-single-inc float :offset-assert 8) + (eco-full-inc float :offset-assert 12) + (eco-single-timeout seconds :offset-assert 16) + (eco-full-timeout seconds :offset-assert 24) + (dummy seconds :offset-assert 32) + (health-max-default float :offset-assert 40) + (health-single-inc float :offset-assert 44) + (eco-pill-max-default float :offset-assert 48) + (health-small-inc float :offset-assert 52) + (buzzer-max-default float :offset-assert 56) + (buzzer-single-inc float :offset-assert 60) + (suck-bounce-dist meters :offset-assert 64) + (suck-suck-dist meters :offset-assert 68) + (default-pill-inc float :offset-assert 72) ) :method-count-assert 9 :size-assert #x4c @@ -101,23 +101,23 @@ ) (deftype fact-info-target (fact-info) - ((eco-type int32 :offset-assert 40) - (eco-level float :offset-assert 44) - (eco-pickup-time uint64 :offset-assert 48) - (eco-timeout uint64 :offset-assert 56) ;; usec - (health float :offset-assert 64) - (health-max float :offset-assert 68) - (buzzer float :offset-assert 72) - (buzzer-max float :offset-assert 76) - (eco-pill float :offset-assert 80) - (eco-pill-max float :offset-assert 84) - (health-pickup-time uint64 :offset-assert 88) - (eco-source uint64 :offset-assert 96) - (eco-source-time uint64 :offset-assert 104) - (money-pickup-time uint64 :offset-assert 112) - (buzzer-pickup-time uint64 :offset-assert 120) - (fuel-cell-pickup-time uint64 :offset-assert 128) - (eco-pill-pickup-time uint64 :offset-assert 136) + ((eco-type int32 :offset-assert 40) + (eco-level float :offset-assert 44) + (eco-pickup-time uint64 :offset-assert 48) + (eco-timeout seconds :offset-assert 56) + (health float :offset-assert 64) + (health-max float :offset-assert 68) + (buzzer float :offset-assert 72) + (buzzer-max float :offset-assert 76) + (eco-pill float :offset-assert 80) + (eco-pill-max float :offset-assert 84) + (health-pickup-time uint64 :offset-assert 88) + (eco-source uint64 :offset-assert 96) + (eco-source-time uint64 :offset-assert 104) + (money-pickup-time uint64 :offset-assert 112) + (buzzer-pickup-time uint64 :offset-assert 120) + (fuel-cell-pickup-time uint64 :offset-assert 128) + (eco-pill-pickup-time uint64 :offset-assert 136) ) :method-count-assert 12 :size-assert #x90 @@ -128,13 +128,13 @@ ) (deftype fact-info-enemy (fact-info) - ((speed float :offset-assert 40) - (idle-distance float :offset-assert 44) ; meters - (notice-top float :offset-assert 48) ; meters - (notice-bottom float :offset-assert 52) ; meters - (cam-horz float :offset-assert 56) ; meters - (cam-vert float :offset-assert 60) ; meters - (cam-notice-dist float :offset-assert 64) ; meters + ((speed float :offset-assert 40) + (idle-distance meters :offset-assert 44) + (notice-top meters :offset-assert 48) + (notice-bottom meters :offset-assert 52) + (cam-horz meters :offset-assert 56) + (cam-vert meters :offset-assert 60) + (cam-notice-dist meters :offset-assert 64) ) :method-count-assert 12 :size-assert #x44 diff --git a/goal_src/engine/game/game-h.gc b/goal_src/engine/game/game-h.gc index 9db75e3018..31438ff196 100644 --- a/goal_src/engine/game/game-h.gc +++ b/goal_src/engine/game/game-h.gc @@ -96,21 +96,21 @@ ) (deftype attack-info (structure) - ((trans vector :inline :offset-assert 0) - (vector vector :inline :offset-assert 16) - (intersection vector :inline :offset-assert 32) - (attacker uint64 :offset-assert 48) ;; handle - (invinc-time uint64 :offset-assert 56) - (mask uint32 :offset-assert 64) - (mode basic :offset-assert 68) - (shove-back float :offset-assert 72) ;; meters - (shove-up float :offset-assert 76) ;; meters - (speed float :offset-assert 80) ;; meters - (dist float :offset-assert 84) ;; meters - (control float :offset-assert 88) - (angle basic :offset-assert 92) - (rotate-to float :offset-assert 96) ;; deg - (prev-state basic :offset-assert 100) + ((trans vector :inline :offset-assert 0) + (vector vector :inline :offset-assert 16) + (intersection vector :inline :offset-assert 32) + (attacker uint64 :offset-assert 48) ;; handle + (invinc-time uint64 :offset-assert 56) + (mask uint32 :offset-assert 64) + (mode basic :offset-assert 68) + (shove-back meters :offset-assert 72) + (shove-up meters :offset-assert 76) + (speed meters :offset-assert 80) + (dist meters :offset-assert 84) + (control float :offset-assert 88) + (angle basic :offset-assert 92) + (rotate-to degrees :offset-assert 96) + (prev-state basic :offset-assert 100) ) :method-count-assert 10 :size-assert #x68 diff --git a/goal_src/engine/game/generic-obs-h.gc b/goal_src/engine/game/generic-obs-h.gc index 373bbfbc26..f22323a187 100644 --- a/goal_src/engine/game/generic-obs-h.gc +++ b/goal_src/engine/game/generic-obs-h.gc @@ -33,7 +33,7 @@ (deftype part-spawner (process-drawable) ((mode uint32 :offset-assert 176) (enable basic :offset-assert 180) - (radius float :offset-assert 184) ;; meters + (radius meters :offset-assert 184) (world-sphere sphere :inline :offset-assert 192) ) :heap-base #x60 @@ -122,8 +122,8 @@ (deftype swingpole (process) ((root basic :offset-assert 112) (dir vector :inline :offset-assert 128) - (range float :offset-assert 144) ;; meters - (edge-length float :offset-assert 148) ;; meters + (range meters :offset-assert 144) + (edge-length meters :offset-assert 148) ) :heap-base #x30 :method-count-assert 14 diff --git a/goal_src/engine/gfx/mood-h.gc b/goal_src/engine/gfx/mood-h.gc index 8ec5c92988..90935660a0 100644 --- a/goal_src/engine/gfx/mood-h.gc +++ b/goal_src/engine/gfx/mood-h.gc @@ -6,13 +6,13 @@ ;; dgos: GAME, ENGINE (deftype mood-fog (structure) - ((fog-color vector :inline :offset-assert 0) - (fog-dists vector :inline :offset-assert 16) - (fog-start float :offset 16) ;; meters - (fog-end float :offset 20) ;;meters - (fog-max float :offset 24) - (fog-min float :offset 28) - (erase-color vector :inline :offset-assert 32) + ((fog-color vector :inline :offset-assert 0) + (fog-dists vector :inline :offset-assert 16) + (fog-start meters :offset 16) + (fog-end meters :offset 20) + (fog-max float :offset 24) + (fog-min float :offset 28) + (erase-color vector :inline :offset-assert 32) ) :method-count-assert 9 :size-assert #x30 diff --git a/goal_src/engine/gfx/tie/prototype-h.gc b/goal_src/engine/gfx/tie/prototype-h.gc index c16c62c3d7..c8a2aa19f6 100644 --- a/goal_src/engine/gfx/tie/prototype-h.gc +++ b/goal_src/engine/gfx/tie/prototype-h.gc @@ -6,25 +6,25 @@ ;; dgos: GAME, ENGINE (deftype prototype-bucket (basic) - ((name basic :offset-assert 4) - (flags uint32 :offset-assert 8) - (in-level uint16 :offset-assert 12) - (utextures uint16 :offset-assert 14) - (geometry drawable 4 :offset-assert 16) - (dists vector :inline :offset-assert 32) - (rdists vector :inline :offset-assert 48) - (next uint32 4 :offset-assert 64) - (count uint16 4 :offset-assert 80) - (near-plane float :offset 32) - (near-stiff float :offset 36) - (mid-plane float :offset 40) - (far-plane float :offset 44) - (rlength-near float :offset 48) - (rlength-stiff float :offset 52) - (rlength-mid float :offset 56) - (stiffness float :offset 60) - (next-clear uint128 :offset 64) - (count-clear uint64 :offset 80) + ((name basic :offset-assert 4) + (flags uint32 :offset-assert 8) + (in-level uint16 :offset-assert 12) + (utextures uint16 :offset-assert 14) + (geometry drawable 4 :offset-assert 16) + (dists vector :inline :offset-assert 32) + (rdists vector :inline :offset-assert 48) + (next uint32 4 :offset-assert 64) + (count uint16 4 :offset-assert 80) + (near-plane meters :offset 32) + (near-stiff meters :offset 36) + (mid-plane meters :offset 40) + (far-plane meters :offset 44) + (rlength-near float :offset 48) + (rlength-stiff float :offset 52) + (rlength-mid float :offset 56) + (stiffness float :offset 60) + (next-clear uint128 :offset 64) + (count-clear uint64 :offset 80) ) :method-count-assert 9 :size-assert #x58 diff --git a/goal_src/engine/gfx/water/water-h.gc b/goal_src/engine/gfx/water/water-h.gc index 2da83f1299..47cdfcb711 100644 --- a/goal_src/engine/gfx/water/water-h.gc +++ b/goal_src/engine/gfx/water/water-h.gc @@ -7,40 +7,40 @@ ;; definition of type water-control (deftype water-control (basic) - ((flags uint32 :offset-assert 4) - (process process :offset-assert 8) - (joint-index int32 :offset-assert 12) - (top-y-offset float :offset-assert 16) - (ripple-size float :offset-assert 20) ; meters - (enter-water-time uint64 :offset-assert 24) - (wade-time uint64 :offset-assert 32) - (on-water-time uint64 :offset-assert 40) - (enter-swim-time uint64 :offset-assert 48) - (swim-time uint64 :offset-assert 56) - (base-height float :offset-assert 64) ; meters - (wade-height float :offset-assert 68) ; meters - (swim-height float :offset-assert 72) ; meters - (surface-height float :offset-assert 76) ; meters - (bottom-height float :offset-assert 80) ; meters - (height float :offset-assert 84) ; meters - (height-offset float 4 :offset-assert 88) - (real-ocean-offset float :offset 88) ; meters - (ocean-offset float :offset 92) ; meters - (bob-offset float :offset 96) ; meters - (align-offset float :offset 100) ; meters - (swim-depth float :offset-assert 104) ; meters - (bob smush-control :inline :offset-assert 112) - (volume uint64 :offset-assert 144) ;; handle? - (bottom vector 2 :inline :offset-assert 160) - (top vector 2 :inline :offset-assert 192) - (enter-water-pos vector :inline :offset-assert 224) - (drip-old-pos vector :inline :offset-assert 240) - (drip-joint-index int32 :offset-assert 256) - (drip-wetness float :offset-assert 260) - (drip-time uint64 :offset-assert 264) - (drip-speed float :offset-assert 272) - (drip-height float :offset-assert 276) ; meters - (drip-mult float :offset-assert 280) + ((flags uint32 :offset-assert 4) + (process process :offset-assert 8) + (joint-index int32 :offset-assert 12) + (top-y-offset float :offset-assert 16) + (ripple-size meters :offset-assert 20) + (enter-water-time uint64 :offset-assert 24) + (wade-time uint64 :offset-assert 32) + (on-water-time uint64 :offset-assert 40) + (enter-swim-time uint64 :offset-assert 48) + (swim-time uint64 :offset-assert 56) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (height meters :offset-assert 84) + (height-offset float 4 :offset-assert 88) + (real-ocean-offset meters :offset 88) + (ocean-offset meters :offset 92) + (bob-offset meters :offset 96) + (align-offset meters :offset 100) + (swim-depth meters :offset-assert 104) + (bob smush-control :inline :offset-assert 112) + (volume uint64 :offset-assert 144) + (bottom vector 2 :inline :offset-assert 160) + (top vector 2 :inline :offset-assert 192) + (enter-water-pos vector :inline :offset-assert 224) + (drip-old-pos vector :inline :offset-assert 240) + (drip-joint-index int32 :offset-assert 256) + (drip-wetness float :offset-assert 260) + (drip-time uint64 :offset-assert 264) + (drip-speed float :offset-assert 272) + (drip-height meters :offset-assert 276) + (drip-mult float :offset-assert 280) ) :method-count-assert 17 :size-assert #x11c @@ -86,10 +86,10 @@ ) (deftype water-vol (process-drawable) - ((water-height float :offset-assert 176) - (wade-height float :offset-assert 180) - (swim-height float :offset-assert 184) - (bottom-height float :offset-assert 188) + ((water-height meters :offset-assert 176) + (wade-height meters :offset-assert 180) + (swim-height meters :offset-assert 184) + (bottom-height meters :offset-assert 188) (attack-event basic :offset-assert 192) (target uint64 :offset-assert 200) (flags uint32 :offset-assert 208) diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index a110836c8f..b90367860a 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -65,7 +65,7 @@ (bsp-mask uint64 :offset-assert 80) ;; ?? (bsphere sphere :offset-assert 88) ;; boundings sphere of level? (buzzer int32 :offset-assert 92) ;; which task is the scout fly? - (bottom-height float :offset-assert 96) ;; meters + (bottom-height meters :offset-assert 96) (run-packages pair :offset-assert 100) ;; possibly unused? (prev-level basic :offset-assert 104) (next-level basic :offset-assert 108) @@ -118,7 +118,7 @@ (ambient entity-ambient-data-array :offset-assert 288) (closest-object float 9 :offset-assert 292) (upload-size int32 9 :offset-assert 328) - (level-distance float :offset-assert 364) ; meters + (level-distance meters :offset-assert 364) (inside-sphere? symbol :offset-assert 368) (inside-boxes? symbol :offset-assert 372) (display? symbol :offset-assert 376) diff --git a/goal_src/engine/level/level-info.gc b/goal_src/engine/level/level-info.gc index 8b391e3682..2fea2e14d0 100644 --- a/goal_src/engine/level/level-info.gc +++ b/goal_src/engine/level/level-info.gc @@ -107,7 +107,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x -5079040.0 :z 4055040.0 :w 1024000.0) :buzzer 95 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common" "villagep") :wait-for-load #f ) @@ -228,7 +228,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x -444416.0 :y 133120.0 :z 360448.0 :w 843776.0) :buzzer 75 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -273,7 +273,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x -819200.0 :z -1556480.0 :w 1474560.0) :buzzer 20 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -318,7 +318,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 1474560.0 :y 2519040.0 :z -983040.0 :w 2457600.0) :buzzer 7 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -361,7 +361,7 @@ :alt-load-commands '() :bsphere (new 'static 'sphere :x 1486848.0 :y -1269760.0 :z -1064960.0 :w 1228800.0) :buzzer 7 - :bottom-height -327680.0 + :bottom-height (meters -80.0) :run-packages '("common" "jungle") :wait-for-load #f ) @@ -527,7 +527,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :z 4096000.0 :w 1269760.0) :buzzer 28 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #f ) @@ -585,7 +585,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 419840.0 :y 151552.0 :z -3006464.0 :w 2048000.0) :buzzer 68 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -658,7 +658,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 1392640.0 :y 81920.0 :z -6770688.0 :w 696320.0) :buzzer 76 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -744,7 +744,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 2867200.0 :y -2048000.0 :z -6553600.0 :w 2048000.0) :buzzer 49 - :bottom-height -2048000.0 + :bottom-height (meters -500.0) :run-packages '("common") :wait-for-load #f ) @@ -802,7 +802,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 2867200.0 :y -2048000.0 :z -6553600.0 :w 2048000.0) :buzzer 49 - :bottom-height -2048000.0 + :bottom-height (meters -500.0) :run-packages '("common" "sunken") :wait-for-load #f ) @@ -979,7 +979,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 1986560.0 :z -8417280.0 :w 1003520.0) :buzzer 43 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1024,7 +1024,7 @@ :bsphere (new 'static 'sphere :x -753664.0 :y 131072.0 :z -6569984.0 :w 974848.0) :buzzer 57 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1096,7 +1096,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 2334720.0 :y 180224.0 :z -10653696.0 :w 3653632.0) :buzzer 88 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1170,7 +1170,7 @@ :bsphere (new 'static 'sphere :x 4571136.0 :y 389120.0 :z -14323712.0 :w 409600.0) :buzzer 77 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #f ) @@ -1327,7 +1327,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 3072000.0 :y 1142784.0 :z -14028800.0 :w 1290240.0) :buzzer 65 - :bottom-height 524288.0 + :bottom-height (meters 128.0) :run-packages '("common") :wait-for-load #f ) @@ -1399,7 +1399,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 4517888.0 :y 114688.0 :z -12484608.0 :w 655360.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common") :wait-for-load #f ) @@ -1443,7 +1443,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 3620864.0 :y 266240.0 :z -11935744.0 :w 368640.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common" "maincave") :wait-for-load #t ) @@ -1502,7 +1502,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 5529600.0 :y 81920.0 :z -11468800.0 :w 512000.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common" "maincave") :wait-for-load #t ) @@ -1592,7 +1592,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 8806400.0 :y 131072.0 :z -15564800.0 :w 3174400.0) :buzzer 90 - :bottom-height -286720.0 + :bottom-height (meters -70.0) :run-packages '("common") :wait-for-load #t ) @@ -1773,7 +1773,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 11436032.0 :y -462848.0 :z -19750912.0 :w 1228800.0) :buzzer 91 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common") :wait-for-load #t ) @@ -1837,7 +1837,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x 11837440.0 :y 2129920.0 :z -19578880.0 :w 778240.0) :buzzer 91 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common") :wait-for-load #f ) @@ -1865,7 +1865,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -1909,7 +1909,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -1953,7 +1953,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x -40960.0 :z 40960.0 :w 1126400.0) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -1996,7 +1996,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :w 167772160000.0) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '() :wait-for-load #t ) @@ -2024,7 +2024,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :w 167772160000.0) - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '() :wait-for-load #t ) diff --git a/goal_src/engine/math/transformq-h.gc b/goal_src/engine/math/transformq-h.gc index 4989383ae1..398c079dfb 100644 --- a/goal_src/engine/math/transformq-h.gc +++ b/goal_src/engine/math/transformq-h.gc @@ -28,14 +28,14 @@ ;; Representing a translate/rotate/scale with a quaternion and a velocity. ;; definition of type trsqv (deftype trsqv (trsq) - ((pause-adjust-distance float :offset 4) - (nav-radius float :offset 8) - (transv vector :inline :offset-assert 64) - (rotv vector :inline :offset-assert 80) - (scalev vector :inline :offset-assert 96) - (dir-targ quaternion :inline :offset-assert 112) - (angle-change-time uint64 :offset-assert 128) - (old-y-angle-diff float :offset-assert 136) + ((pause-adjust-distance meters :offset 4) + (nav-radius meters :offset 8) + (transv vector :inline :offset-assert 64) + (rotv vector :inline :offset-assert 80) + (scalev vector :inline :offset-assert 96) + (dir-targ quaternion :inline :offset-assert 112) + (angle-change-time uint64 :offset-assert 128) + (old-y-angle-diff float :offset-assert 136) ) :method-count-assert 28 :size-assert #x8c diff --git a/goal_src/engine/nav/navigate-h.gc b/goal_src/engine/nav/navigate-h.gc index 6861bb4f3b..48d1a2df07 100644 --- a/goal_src/engine/nav/navigate-h.gc +++ b/goal_src/engine/nav/navigate-h.gc @@ -40,17 +40,17 @@ ) (deftype nav-ray (structure) - ((current-pos vector :inline :offset-assert 0) - (dir vector :inline :offset-assert 16) - (dest-pos vector :inline :offset-assert 32) - (current-poly nav-poly :offset-assert 48) - (next-poly nav-poly :offset-assert 52) - (len float :offset-assert 56) - (last-edge int8 :offset-assert 60) - (terminated basic :offset-assert 64) - (reached-dest basic :offset-assert 68) - (hit-boundary basic :offset-assert 72) - (hit-gap basic :offset-assert 76) + ((current-pos vector :inline :offset-assert 0) + (dir vector :inline :offset-assert 16) + (dest-pos vector :inline :offset-assert 32) + (current-poly nav-poly :offset-assert 48) + (next-poly nav-poly :offset-assert 52) + (len meters :offset-assert 56) + (last-edge int8 :offset-assert 60) + (terminated basic :offset-assert 64) + (reached-dest basic :offset-assert 68) + (hit-boundary basic :offset-assert 72) + (hit-gap basic :offset-assert 76) ) :method-count-assert 9 :size-assert #x50 @@ -194,20 +194,20 @@ ) (deftype nav-control (basic) - ((flags nav-control-flags :offset-assert 4) - (process basic :offset-assert 8) - (shape collide-shape :offset-assert 12) - (mesh nav-mesh :offset-assert 16) - (gap-event basic :offset-assert 20) - (block-event basic :offset-assert 24) - (current-poly nav-poly :offset-assert 28) - (next-poly nav-poly :offset-assert 32) - (target-poly nav-poly :offset-assert 36) - (portal nav-route-portal 2 :offset-assert 40) - (nearest-y-threshold float :offset-assert 48) - (event-temp vector :inline :offset-assert 64) - (old-travel vector :inline :offset-assert 80) - (blocked-travel vector :inline :offset-assert 96) + ((flags nav-control-flags :offset-assert 4) + (process basic :offset-assert 8) + (shape collide-shape :offset-assert 12) + (mesh nav-mesh :offset-assert 16) + (gap-event basic :offset-assert 20) + (block-event basic :offset-assert 24) + (current-poly nav-poly :offset-assert 28) + (next-poly nav-poly :offset-assert 32) + (target-poly nav-poly :offset-assert 36) + (portal nav-route-portal 2 :offset-assert 40) + (nearest-y-threshold meters :offset-assert 48) + (event-temp vector :inline :offset-assert 64) + (old-travel vector :inline :offset-assert 80) + (blocked-travel vector :inline :offset-assert 96) (prev-pos vector :inline :offset-assert 112) (extra-nav-sphere vector :inline :offset-assert 128) (travel vector :inline :offset-assert 144) diff --git a/goal_src/engine/physics/dynamics-h.gc b/goal_src/engine/physics/dynamics-h.gc index 699c67f43c..d1568e63ca 100644 --- a/goal_src/engine/physics/dynamics-h.gc +++ b/goal_src/engine/physics/dynamics-h.gc @@ -6,13 +6,13 @@ ;; dgos: GAME, ENGINE (deftype dynamics (basic) - ((name basic :offset-assert 4) - (gravity-max float :offset-assert 8) ;; meters - (gravity-length float :offset-assert 12) ;; meters - (gravity vector :inline :offset-assert 16) - (gravity-normal vector :inline :offset-assert 32) - (walk-distance float :offset-assert 48) ;; meters - (run-distance float :offset-assert 52) ;; meters + ((name basic :offset-assert 4) + (gravity-max meters :offset-assert 8) + (gravity-length meters :offset-assert 12) + (gravity vector :inline :offset-assert 16) + (gravity-normal vector :inline :offset-assert 32) + (walk-distance meters :offset-assert 48) + (run-distance meters :offset-assert 52) ) :method-count-assert 9 :size-assert #x38 diff --git a/goal_src/engine/physics/trajectory-h.gc b/goal_src/engine/physics/trajectory-h.gc index bfa313d51b..566d3deef5 100644 --- a/goal_src/engine/physics/trajectory-h.gc +++ b/goal_src/engine/physics/trajectory-h.gc @@ -7,10 +7,10 @@ ;; definition of type trajectory (deftype trajectory (structure) - ((initial-position vector :inline :offset-assert 0) - (initial-velocity vector :inline :offset-assert 16) - (time float :offset-assert 32) - (gravity float :offset-assert 36) + ((initial-position vector :inline :offset-assert 0) + (initial-velocity vector :inline :offset-assert 16) + (time float :offset-assert 32) + (gravity meters :offset-assert 36) ) :method-count-assert 16 :size-assert #x28 diff --git a/goal_src/engine/sparticle/sparticle-launcher-h.gc b/goal_src/engine/sparticle/sparticle-launcher-h.gc index 834eb18272..9a322de7d9 100644 --- a/goal_src/engine/sparticle/sparticle-launcher-h.gc +++ b/goal_src/engine/sparticle/sparticle-launcher-h.gc @@ -36,15 +36,15 @@ ) (deftype sparticle-group-item (structure) - ((launcher uint32 :offset-assert 0) - (fade-after float :offset-assert 4) - (falloff-to float :offset-assert 8) - (flags uint16 :offset-assert 12) - (period uint16 :offset-assert 14) - (length uint16 :offset-assert 16) - (offset uint16 :offset-assert 18) - (hour-mask uint32 :offset-assert 20) - (binding uint32 :offset-assert 24) + ((launcher uint32 :offset-assert 0) + (fade-after meters :offset-assert 4) + (falloff-to meters :offset-assert 8) + (flags uint16 :offset-assert 12) + (period uint16 :offset-assert 14) + (length uint16 :offset-assert 16) + (offset uint16 :offset-assert 18) + (hour-mask uint32 :offset-assert 20) + (binding uint32 :offset-assert 24) ) :method-count-assert 9 :size-assert #x1c diff --git a/goal_src/engine/target/joint-mod-h.gc b/goal_src/engine/target/joint-mod-h.gc index fd9f113d36..2a2f2c1bd1 100644 --- a/goal_src/engine/target/joint-mod-h.gc +++ b/goal_src/engine/target/joint-mod-h.gc @@ -32,25 +32,25 @@ ;; Although the mode is a bitfield, it appears that multiple kinds of mods cannot be ;; activated at the same time. (deftype joint-mod (basic) - ((mode joint-mod-handler-mode :offset-assert 4) - (process process-drawable :offset-assert 8) - (joint cspace :offset-assert 12) - (target vector :inline :offset-assert 16) - (twist vector :inline :offset-assert 32) - (twist-max vector :inline :offset-assert 48) - (trans vector :inline :offset-assert 64) - (quat quaternion :inline :offset-assert 80) - (scale vector :inline :offset-assert 96) - (notice-time uint64 :offset-assert 112) - (flex-blend float :offset-assert 120) - (blend float :offset-assert 124) - (max-dist float :offset-assert 128) - (ignore-angle float :offset-assert 132) - (up uint8 :offset-assert 136) - (nose uint8 :offset-assert 137) - (ear uint8 :offset-assert 138) - (shutting-down? basic :offset-assert 140) - (parented-scale? basic :offset 128) + ((mode joint-mod-handler-mode :offset-assert 4) + (process process-drawable :offset-assert 8) + (joint cspace :offset-assert 12) + (target vector :inline :offset-assert 16) + (twist vector :inline :offset-assert 32) + (twist-max vector :inline :offset-assert 48) + (trans vector :inline :offset-assert 64) + (quat quaternion :inline :offset-assert 80) + (scale vector :inline :offset-assert 96) + (notice-time uint64 :offset-assert 112) + (flex-blend float :offset-assert 120) + (blend float :offset-assert 124) + (max-dist meters :offset-assert 128) + (ignore-angle degrees :offset-assert 132) + (up uint8 :offset-assert 136) + (nose uint8 :offset-assert 137) + (ear uint8 :offset-assert 138) + (shutting-down? basic :offset-assert 140) + (parented-scale? basic :offset 128) ) :method-count-assert 16 :size-assert #x90 diff --git a/goal_src/levels/common/nav-enemy-h.gc b/goal_src/levels/common/nav-enemy-h.gc index acaaa6f39d..f597872312 100644 --- a/goal_src/levels/common/nav-enemy-h.gc +++ b/goal_src/levels/common/nav-enemy-h.gc @@ -7,57 +7,57 @@ ;; definition of type nav-enemy-info (deftype nav-enemy-info (basic) - ((idle-anim int32 :offset-assert 4) - (walk-anim int32 :offset-assert 8) - (turn-anim int32 :offset-assert 12) - (notice-anim int32 :offset-assert 16) - (run-anim int32 :offset-assert 20) - (jump-anim int32 :offset-assert 24) - (jump-land-anim int32 :offset-assert 28) - (victory-anim int32 :offset-assert 32) - (taunt-anim int32 :offset-assert 36) - (die-anim int32 :offset-assert 40) - (neck-joint int32 :offset-assert 44) - (player-look-at-joint int32 :offset-assert 48) - (run-travel-speed float :offset-assert 52) - (run-rotate-speed float :offset-assert 56) - (run-acceleration float :offset-assert 60) - (run-turn-time uint64 :offset-assert 64) - (walk-travel-speed float :offset-assert 72) - (walk-rotate-speed float :offset-assert 76) - (walk-acceleration float :offset-assert 80) - (walk-turn-time uint64 :offset-assert 88) - (attack-shove-back float :offset-assert 96) - (attack-shove-up float :offset-assert 100) - (shadow-size float :offset-assert 104) - (notice-nav-radius float :offset-assert 108) - (nav-nearest-y-threshold float :offset-assert 112) - (notice-distance float :offset-assert 116) - (proximity-notice-distance float :offset-assert 120) - (stop-chase-distance float :offset-assert 124) - (frustration-distance float :offset-assert 128) - (frustration-time uint64 :offset-assert 136) - (die-anim-hold-frame float :offset-assert 144) - (jump-anim-start-frame float :offset-assert 148) - (jump-land-anim-end-frame float :offset-assert 152) - (jump-height-min float :offset-assert 156) - (jump-height-factor float :offset-assert 160) - (jump-start-anim-speed float :offset-assert 164) - (shadow-max-y float :offset-assert 168) - (shadow-min-y float :offset-assert 172) - (shadow-locus-dist float :offset-assert 176) - (use-align basic :offset-assert 180) - (draw-shadow basic :offset-assert 184) - (move-to-ground basic :offset-assert 188) - (hover-if-no-ground basic :offset-assert 192) - (use-momentum basic :offset-assert 196) - (use-flee basic :offset-assert 200) - (use-proximity-notice basic :offset-assert 204) - (use-jump-blocked basic :offset-assert 208) - (use-jump-patrol basic :offset-assert 212) - (gnd-collide-with uint64 :offset-assert 216) - (debug-draw-neck basic :offset-assert 224) - (debug-draw-jump basic :offset-assert 228) + ((idle-anim int32 :offset-assert 4) + (walk-anim int32 :offset-assert 8) + (turn-anim int32 :offset-assert 12) + (notice-anim int32 :offset-assert 16) + (run-anim int32 :offset-assert 20) + (jump-anim int32 :offset-assert 24) + (jump-land-anim int32 :offset-assert 28) + (victory-anim int32 :offset-assert 32) + (taunt-anim int32 :offset-assert 36) + (die-anim int32 :offset-assert 40) + (neck-joint int32 :offset-assert 44) + (player-look-at-joint int32 :offset-assert 48) + (run-travel-speed meters :offset-assert 52) + (run-rotate-speed degrees :offset-assert 56) + (run-acceleration meters :offset-assert 60) + (run-turn-time seconds :offset-assert 64) + (walk-travel-speed meters :offset-assert 72) + (walk-rotate-speed degrees :offset-assert 76) + (walk-acceleration meters :offset-assert 80) + (walk-turn-time seconds :offset-assert 88) + (attack-shove-back meters :offset-assert 96) + (attack-shove-up meters :offset-assert 100) + (shadow-size meters :offset-assert 104) + (notice-nav-radius meters :offset-assert 108) + (nav-nearest-y-threshold meters :offset-assert 112) + (notice-distance meters :offset-assert 116) + (proximity-notice-distance meters :offset-assert 120) + (stop-chase-distance meters :offset-assert 124) + (frustration-distance meters :offset-assert 128) + (frustration-time uint64 :offset-assert 136) + (die-anim-hold-frame float :offset-assert 144) + (jump-anim-start-frame float :offset-assert 148) + (jump-land-anim-end-frame float :offset-assert 152) + (jump-height-min meters :offset-assert 156) + (jump-height-factor float :offset-assert 160) + (jump-start-anim-speed float :offset-assert 164) + (shadow-max-y meters :offset-assert 168) + (shadow-min-y meters :offset-assert 172) + (shadow-locus-dist meters :offset-assert 176) + (use-align basic :offset-assert 180) + (draw-shadow basic :offset-assert 184) + (move-to-ground basic :offset-assert 188) + (hover-if-no-ground basic :offset-assert 192) + (use-momentum basic :offset-assert 196) + (use-flee basic :offset-assert 200) + (use-proximity-notice basic :offset-assert 204) + (use-jump-blocked basic :offset-assert 208) + (use-jump-patrol basic :offset-assert 212) + (gnd-collide-with uint64 :offset-assert 216) + (debug-draw-neck basic :offset-assert 224) + (debug-draw-jump basic :offset-assert 228) ) :method-count-assert 9 :size-assert #xe8 diff --git a/goalc/compiler/compilation/Type.cpp b/goalc/compiler/compilation/Type.cpp index 58719ca3ec..b617eeb0ab 100644 --- a/goalc/compiler/compilation/Type.cpp +++ b/goalc/compiler/compilation/Type.cpp @@ -166,6 +166,10 @@ void Compiler::generate_field_description(const goos::Object& form, // Structure str_template += fmt::format("{}{}: #<{} @ #x~X>~%", tabs, f.name(), f.type().print()); format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env)); + } else if (f.type() == TypeSpec("seconds")) { + // seconds + str_template += fmt::format("{}{}: (seconds ~e)~%", tabs, f.name()); + format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env)); } else if (m_ts.tc(m_ts.make_typespec("integer"), f.type())) { // Integer if (m_ts.lookup_type(f.type())->get_load_size() > 8) { @@ -175,6 +179,14 @@ void Compiler::generate_field_description(const goos::Object& form, format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env)); } + } else if (f.type() == TypeSpec("meters")) { + // meters + str_template += fmt::format("{}{}: (meters ~m)~%", tabs, f.name()); + format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env)); + } else if (f.type() == TypeSpec("degrees")) { + // degrees + str_template += fmt::format("{}{}: (degrees ~r)~%", tabs, f.name()); + format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(env)); } else if (m_ts.tc(m_ts.make_typespec("float"), f.type())) { // Float str_template += fmt::format("{}{}: ~f~%", tabs, f.name()); diff --git a/test/decompiler/reference/decompiler-macros.gc b/test/decompiler/reference/decompiler-macros.gc index b89a5bdbd0..ed281abd9f 100644 --- a/test/decompiler/reference/decompiler-macros.gc +++ b/test/decompiler/reference/decompiler-macros.gc @@ -127,3 +127,66 @@ ) ) ) + + +(defglobalconstant METER_LENGTH 4096.0) + +(defmacro meters (x) + "Convert number to meters. + If the input is a constant float or integer, the result will be a + compile time constant float. Otherwise, it will not be constant." + + ;; we don't have enough constant propagation for the compiler to figure this out. + (cond + ((float? x) + (* METER_LENGTH x) + ) + ((integer? x) + (* METER_LENGTH x) + ) + (#t + `(* METER_LENGTH ,x) + ) + ) + ) + +(defglobalconstant DEGREES_PER_ROT 65536.0) + +(defmacro degrees (x) + "Convert number to degrees unit. + Will keep a constant float/int constant." + (cond + ((or (float? x) (integer? x)) + (* DEGREES_PER_ROT (/ (+ 0.0 x) 360.0)) + ) + (#t + `(* (/ (the float ,x) 360.0) + DEGREES_PER_ROT + ) + ) + ) + ) + +(defglobalconstant TICKS_PER_SECOND 300) ;; 5 t/frame @ 60fps, 6 t/frame @ 50fps + +(defmacro seconds (x) + "Convert number to seconds unit." + (cond + ((float? x) + (* 1.0 TICKS_PER_SECOND x) + ) + ((integer? x) + (* TICKS_PER_SECOND x) + ) + (#t + `(* 1.0 TICKS_PER_SECOND ,x) + ) + ) + ) + +;; maybe rename to "velocity"? +(defmacro vel-tick (vel) + "turn a velocity value into a per-tick value" + `(* (/ 1.0 ,TICKS_PER_SECOND) ,vel) + ) + diff --git a/test/decompiler/reference/engine/anim/aligner-h_REF.gc b/test/decompiler/reference/engine/anim/aligner-h_REF.gc index a671ec63b3..adfa6b29ac 100644 --- a/test/decompiler/reference/engine/anim/aligner-h_REF.gc +++ b/test/decompiler/reference/engine/anim/aligner-h_REF.gc @@ -10,7 +10,7 @@ (matrix matrix 2 :inline :offset-assert 32) (transform transform 2 :inline :offset-assert 160) (delta transformq :inline :offset-assert 256) - (last-speed float :offset-assert 304) + (last-speed meters :offset-assert 304) (align transformq :inline :offset 160) ) :method-count-assert 14 @@ -65,7 +65,3 @@ obj ) ) - - - - diff --git a/test/decompiler/reference/engine/anim/joint-h_REF.gc b/test/decompiler/reference/engine/anim/joint-h_REF.gc index b758055996..a3c5b1456c 100644 --- a/test/decompiler/reference/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/engine/anim/joint-h_REF.gc @@ -12,7 +12,7 @@ (param float 2 :offset-assert 24) (group-sub-index int16 :offset-assert 32) (group-size int16 :offset-assert 34) - (dist float :offset-assert 36) + (dist meters :offset-assert 36) (eval-time uint32 :offset-assert 40) (inspector-amount float :offset-assert 44) ) diff --git a/test/decompiler/reference/engine/camera/camera-h_REF.gc b/test/decompiler/reference/engine/camera/camera-h_REF.gc index 27f35ab5df..8420b4c816 100644 --- a/test/decompiler/reference/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/camera-h_REF.gc @@ -3,16 +3,16 @@ ;; definition of type camera-bank (deftype camera-bank (basic) - ((collide-move-rad float :offset-assert 4) - (joypad uint32 :offset-assert 8) - (min-detectable-velocity float :offset-assert 12) - (attack-timeout uint64 :offset-assert 16) - (default-string-max-y float :offset-assert 24) - (default-string-min-y float :offset-assert 28) - (default-string-max-z float :offset-assert 32) - (default-string-min-z float :offset-assert 36) - (default-string-push-z float :offset-assert 40) - (default-tilt-adjust float :offset-assert 44) + ((collide-move-rad float :offset-assert 4) + (joypad uint32 :offset-assert 8) + (min-detectable-velocity float :offset-assert 12) + (attack-timeout uint64 :offset-assert 16) + (default-string-max-y meters :offset-assert 24) + (default-string-min-y meters :offset-assert 28) + (default-string-max-z meters :offset-assert 32) + (default-string-min-z meters :offset-assert 36) + (default-string-push-z meters :offset-assert 40) + (default-tilt-adjust degrees :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 @@ -62,12 +62,12 @@ :collide-move-rad 1638.4 :min-detectable-velocity 40.96 :attack-timeout #x4b - :default-string-max-y 12288.0 - :default-string-min-y 4096.0 - :default-string-max-z 51200.0 - :default-string-min-z 20480.0 - :default-string-push-z 40960.0 - :default-tilt-adjust -1183.289 + :default-string-max-y (meters 3.0) + :default-string-min-y (meters 1.0) + :default-string-max-z (meters 12.5) + :default-string-min-z (meters 5.0) + :default-string-push-z (meters 10.0) + :default-tilt-adjust (degrees -6.5000005) ) ) diff --git a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc index 51eeadfaec..942d3ca572 100644 --- a/test/decompiler/reference/engine/camera/math-camera-h_REF.gc +++ b/test/decompiler/reference/engine/camera/math-camera-h_REF.gc @@ -72,9 +72,9 @@ ;; definition of type math-camera (deftype math-camera (basic) - ((d float :offset-assert 4) - (f float :offset-assert 8) - (fov float :offset-assert 12) + ((d meters :offset-assert 4) + (f meters :offset-assert 8) + (fov degrees :offset-assert 12) (x-ratio float :offset-assert 16) (y-ratio float :offset-assert 20) (x-pix float :offset-assert 24) @@ -86,8 +86,8 @@ (y-clip-ratio-in float :offset-assert 48) (y-clip-ratio-over float :offset-assert 52) (cull-info cull-info :inline :offset-assert 56) - (fog-start float :offset-assert 120) - (fog-end float :offset-assert 124) + (fog-start meters :offset-assert 120) + (fog-end meters :offset-assert 124) (fog-max float :offset-assert 128) (fog-min float :offset-assert 132) (reset int32 :offset-assert 136) diff --git a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc index c185cf2d93..4f33a22fc8 100644 --- a/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-shape-h_REF.gc @@ -234,7 +234,7 @@ (action uint32 :offset 40) (offense int8 :offset 44) (prim-type int8 :offset 45) - (radius float :offset 60) + (radius meters :offset 60) ) :method-count-assert 28 :size-assert #x48 @@ -490,7 +490,7 @@ (ground-poly-normal vector :inline :offset-assert 368) (ground-touch-point vector :inline :offset-assert 384) (shadow-pos vector :inline :offset-assert 400) - (ground-impact-vel float :offset-assert 416) + (ground-impact-vel meters :offset-assert 416) (surface-angle float :offset-assert 420) (poly-angle float :offset-assert 424) (touch-angle float :offset-assert 428) diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index dbdcc3b7a2..87141b9679 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -325,11 +325,11 @@ (jgeo int32 :offset-assert 8) (janim int32 :offset-assert 12) (bounds vector :inline :offset-assert 16) - (radius float :offset 28) + (radius meters :offset 28) (mgeo uint16 4 :offset-assert 32) (max-lod int32 :offset-assert 40) (lod-dist float 4 :offset-assert 44) - (longest-edge float :offset-assert 60) + (longest-edge meters :offset-assert 60) (texture-level int8 :offset-assert 64) (version int8 :offset-assert 65) (shadow int8 :offset-assert 66) @@ -363,7 +363,7 @@ ;; definition of type lod-group (deftype lod-group (structure) ((geo merc-ctrl :offset-assert 0) - (dist float :offset-assert 4) + (dist meters :offset-assert 4) ) :pack-me :method-count-assert 9 @@ -419,7 +419,7 @@ (cur-lod int8 :offset-assert 62) (desired-lod int8 :offset-assert 63) (ripple ripple-control :offset-assert 64) - (longest-edge float :offset-assert 68) + (longest-edge meters :offset-assert 68) (longest-edge? uint32 :offset 68) (light-index uint8 :offset-assert 72) (dummy uint8 2 :offset-assert 73) @@ -434,7 +434,7 @@ (shadow-ctrl shadow-control :offset-assert 96) (origin vector :inline :offset-assert 112) (bounds vector :inline :offset-assert 128) - (radius float :offset 140) + (radius meters :offset 140) (color-mult rgbaf :inline :offset-assert 144) (color-emissive rgbaf :inline :offset-assert 160) (secondary-interp float :offset-assert 176) diff --git a/test/decompiler/reference/engine/game/fact-h_REF.gc b/test/decompiler/reference/engine/game/fact-h_REF.gc index a9b980840f..60aedd49d0 100644 --- a/test/decompiler/reference/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/engine/game/fact-h_REF.gc @@ -3,21 +3,21 @@ ;; definition of type fact-bank (deftype fact-bank (basic) - ((eco-level-max float :offset-assert 4) - (eco-single-inc float :offset-assert 8) - (eco-full-inc float :offset-assert 12) - (eco-single-timeout uint64 :offset-assert 16) - (eco-full-timeout uint64 :offset-assert 24) - (dummy uint64 :offset-assert 32) - (health-max-default float :offset-assert 40) - (health-single-inc float :offset-assert 44) - (eco-pill-max-default float :offset-assert 48) - (health-small-inc float :offset-assert 52) - (buzzer-max-default float :offset-assert 56) - (buzzer-single-inc float :offset-assert 60) - (suck-bounce-dist float :offset-assert 64) - (suck-suck-dist float :offset-assert 68) - (default-pill-inc float :offset-assert 72) + ((eco-level-max float :offset-assert 4) + (eco-single-inc float :offset-assert 8) + (eco-full-inc float :offset-assert 12) + (eco-single-timeout seconds :offset-assert 16) + (eco-full-timeout seconds :offset-assert 24) + (dummy seconds :offset-assert 32) + (health-max-default float :offset-assert 40) + (health-single-inc float :offset-assert 44) + (eco-pill-max-default float :offset-assert 48) + (health-small-inc float :offset-assert 52) + (buzzer-max-default float :offset-assert 56) + (buzzer-single-inc float :offset-assert 60) + (suck-bounce-dist meters :offset-assert 64) + (suck-suck-dist meters :offset-assert 68) + (default-pill-inc float :offset-assert 72) ) :method-count-assert 9 :size-assert #x4c @@ -52,17 +52,17 @@ :eco-level-max 2.0 :eco-single-inc 1.0 :eco-full-inc 5.0 - :eco-single-timeout #x5dc - :eco-full-timeout #x1770 - :dummy #x1194 + :eco-single-timeout (seconds 5) + :eco-full-timeout (seconds 20) + :dummy (seconds 15) :health-max-default 3.0 :health-single-inc 1.0 :eco-pill-max-default 50.0 :health-small-inc 1.0 :buzzer-max-default 7.0 :buzzer-single-inc 1.0 - :suck-bounce-dist 73728.0 - :suck-suck-dist 30720.0 + :suck-bounce-dist (meters 18.0) + :suck-suck-dist (meters 7.5) ) ) @@ -139,23 +139,23 @@ ;; definition of type fact-info-target (deftype fact-info-target (fact-info) - ((eco-type int32 :offset-assert 40) - (eco-level float :offset-assert 44) - (eco-pickup-time uint64 :offset-assert 48) - (eco-timeout uint64 :offset-assert 56) - (health float :offset-assert 64) - (health-max float :offset-assert 68) - (buzzer float :offset-assert 72) - (buzzer-max float :offset-assert 76) - (eco-pill float :offset-assert 80) - (eco-pill-max float :offset-assert 84) - (health-pickup-time uint64 :offset-assert 88) - (eco-source uint64 :offset-assert 96) - (eco-source-time uint64 :offset-assert 104) - (money-pickup-time uint64 :offset-assert 112) - (buzzer-pickup-time uint64 :offset-assert 120) - (fuel-cell-pickup-time uint64 :offset-assert 128) - (eco-pill-pickup-time uint64 :offset-assert 136) + ((eco-type int32 :offset-assert 40) + (eco-level float :offset-assert 44) + (eco-pickup-time uint64 :offset-assert 48) + (eco-timeout seconds :offset-assert 56) + (health float :offset-assert 64) + (health-max float :offset-assert 68) + (buzzer float :offset-assert 72) + (buzzer-max float :offset-assert 76) + (eco-pill float :offset-assert 80) + (eco-pill-max float :offset-assert 84) + (health-pickup-time uint64 :offset-assert 88) + (eco-source uint64 :offset-assert 96) + (eco-source-time uint64 :offset-assert 104) + (money-pickup-time uint64 :offset-assert 112) + (buzzer-pickup-time uint64 :offset-assert 120) + (fuel-cell-pickup-time uint64 :offset-assert 128) + (eco-pill-pickup-time uint64 :offset-assert 136) ) :method-count-assert 12 :size-assert #x90 @@ -196,13 +196,13 @@ ;; definition of type fact-info-enemy (deftype fact-info-enemy (fact-info) - ((speed float :offset-assert 40) - (idle-distance float :offset-assert 44) - (notice-top float :offset-assert 48) - (notice-bottom float :offset-assert 52) - (cam-horz float :offset-assert 56) - (cam-vert float :offset-assert 60) - (cam-notice-dist float :offset-assert 64) + ((speed float :offset-assert 40) + (idle-distance meters :offset-assert 44) + (notice-top meters :offset-assert 48) + (notice-bottom meters :offset-assert 52) + (cam-horz meters :offset-assert 56) + (cam-vert meters :offset-assert 60) + (cam-notice-dist meters :offset-assert 64) ) :method-count-assert 12 :size-assert #x44 diff --git a/test/decompiler/reference/engine/game/game-h_REF.gc b/test/decompiler/reference/engine/game/game-h_REF.gc index bb2899a3c0..f781e48454 100644 --- a/test/decompiler/reference/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-h_REF.gc @@ -120,21 +120,21 @@ ;; definition of type attack-info (deftype attack-info (structure) - ((trans vector :inline :offset-assert 0) - (vector vector :inline :offset-assert 16) - (intersection vector :inline :offset-assert 32) - (attacker uint64 :offset-assert 48) - (invinc-time uint64 :offset-assert 56) - (mask uint32 :offset-assert 64) - (mode basic :offset-assert 68) - (shove-back float :offset-assert 72) - (shove-up float :offset-assert 76) - (speed float :offset-assert 80) - (dist float :offset-assert 84) - (control float :offset-assert 88) - (angle basic :offset-assert 92) - (rotate-to float :offset-assert 96) - (prev-state basic :offset-assert 100) + ((trans vector :inline :offset-assert 0) + (vector vector :inline :offset-assert 16) + (intersection vector :inline :offset-assert 32) + (attacker uint64 :offset-assert 48) + (invinc-time uint64 :offset-assert 56) + (mask uint32 :offset-assert 64) + (mode basic :offset-assert 68) + (shove-back meters :offset-assert 72) + (shove-up meters :offset-assert 76) + (speed meters :offset-assert 80) + (dist meters :offset-assert 84) + (control float :offset-assert 88) + (angle basic :offset-assert 92) + (rotate-to degrees :offset-assert 96) + (prev-state basic :offset-assert 100) ) :method-count-assert 10 :size-assert #x68 diff --git a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc index f78e3d5a96..759737c39c 100644 --- a/test/decompiler/reference/engine/game/generic-obs-h_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs-h_REF.gc @@ -52,7 +52,7 @@ (deftype part-spawner (process-drawable) ((mode uint32 :offset-assert 176) (enable basic :offset-assert 180) - (radius float :offset-assert 184) + (radius meters :offset-assert 184) (world-sphere sphere :inline :offset-assert 192) ) :heap-base #x60 @@ -211,8 +211,8 @@ (deftype swingpole (process) ((root basic :offset-assert 112) (dir vector :inline :offset-assert 128) - (range float :offset-assert 144) - (edge-length float :offset-assert 148) + (range meters :offset-assert 144) + (edge-length meters :offset-assert 148) ) :heap-base #x30 :method-count-assert 14 diff --git a/test/decompiler/reference/engine/gfx/mood-h_REF.gc b/test/decompiler/reference/engine/gfx/mood-h_REF.gc index e7224fb136..79605a47be 100644 --- a/test/decompiler/reference/engine/gfx/mood-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/mood-h_REF.gc @@ -5,8 +5,8 @@ (deftype mood-fog (structure) ((fog-color vector :inline :offset-assert 0) (fog-dists vector :inline :offset-assert 16) - (fog-start float :offset 16) - (fog-end float :offset 20) + (fog-start meters :offset 16) + (fog-end meters :offset 20) (fog-max float :offset 24) (fog-min float :offset 28) (erase-color vector :inline :offset-assert 32) diff --git a/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc index f7c4f23cf6..75390ea833 100644 --- a/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sparticle/sparticle-launcher-h_REF.gc @@ -64,8 +64,8 @@ ;; definition of type sparticle-group-item (deftype sparticle-group-item (structure) ((launcher uint32 :offset-assert 0) - (fade-after float :offset-assert 4) - (falloff-to float :offset-assert 8) + (fade-after meters :offset-assert 4) + (falloff-to meters :offset-assert 8) (flags uint16 :offset-assert 12) (period uint16 :offset-assert 14) (length uint16 :offset-assert 16) diff --git a/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc b/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc index 89554ea127..a4689345dd 100644 --- a/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/tie/prototype-h_REF.gc @@ -12,10 +12,10 @@ (rdists vector :inline :offset-assert 48) (next uint32 4 :offset-assert 64) (count uint16 4 :offset-assert 80) - (near-plane float :offset 32) - (near-stiff float :offset 36) - (mid-plane float :offset 40) - (far-plane float :offset 44) + (near-plane meters :offset 32) + (near-stiff meters :offset 36) + (mid-plane meters :offset 40) + (far-plane meters :offset 44) (rlength-near float :offset 48) (rlength-stiff float :offset 52) (rlength-mid float :offset 56) diff --git a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc index 8f09db4d35..97f7f3a6a7 100644 --- a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc @@ -7,24 +7,24 @@ (process process :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) - (ripple-size float :offset-assert 20) + (ripple-size meters :offset-assert 20) (enter-water-time uint64 :offset-assert 24) (wade-time uint64 :offset-assert 32) (on-water-time uint64 :offset-assert 40) (enter-swim-time uint64 :offset-assert 48) (swim-time uint64 :offset-assert 56) - (base-height float :offset-assert 64) - (wade-height float :offset-assert 68) - (swim-height float :offset-assert 72) - (surface-height float :offset-assert 76) - (bottom-height float :offset-assert 80) - (height float :offset-assert 84) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (height meters :offset-assert 84) (height-offset float 4 :offset-assert 88) - (real-ocean-offset float :offset 88) - (ocean-offset float :offset 92) - (bob-offset float :offset 96) - (align-offset float :offset 100) - (swim-depth float :offset-assert 104) + (real-ocean-offset meters :offset 88) + (ocean-offset meters :offset 92) + (bob-offset meters :offset 96) + (align-offset meters :offset 100) + (swim-depth meters :offset-assert 104) (bob smush-control :inline :offset-assert 112) (volume uint64 :offset-assert 144) (bottom vector 2 :inline :offset-assert 160) @@ -35,7 +35,7 @@ (drip-wetness float :offset-assert 260) (drip-time uint64 :offset-assert 264) (drip-speed float :offset-assert 272) - (drip-height float :offset-assert 276) + (drip-height meters :offset-assert 276) (drip-mult float :offset-assert 280) ) :method-count-assert 17 @@ -136,10 +136,10 @@ ;; definition of type water-vol (deftype water-vol (process-drawable) - ((water-height float :offset-assert 176) - (wade-height float :offset-assert 180) - (swim-height float :offset-assert 184) - (bottom-height float :offset-assert 188) + ((water-height meters :offset-assert 176) + (wade-height meters :offset-assert 180) + (swim-height meters :offset-assert 184) + (bottom-height meters :offset-assert 188) (attack-event basic :offset-assert 192) (target uint64 :offset-assert 200) (flags uint32 :offset-assert 208) diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index 61baaa0716..085f81e682 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -71,7 +71,7 @@ (bsp-mask uint64 :offset-assert 80) (bsphere sphere :offset-assert 88) (buzzer int32 :offset-assert 92) - (bottom-height float :offset-assert 96) + (bottom-height meters :offset-assert 96) (run-packages pair :offset-assert 100) (prev-level basic :offset-assert 104) (next-level basic :offset-assert 108) @@ -158,7 +158,7 @@ (ambient entity-ambient-data-array :offset-assert 288) (closest-object float 9 :offset-assert 292) (upload-size int32 9 :offset-assert 328) - (level-distance float :offset-assert 364) + (level-distance meters :offset-assert 364) (inside-sphere? symbol :offset-assert 368) (inside-boxes? symbol :offset-assert 372) (display? symbol :offset-assert 376) diff --git a/test/decompiler/reference/engine/level/level-info_REF.gc b/test/decompiler/reference/engine/level/level-info_REF.gc index cb56870a2d..815fcf2234 100644 --- a/test/decompiler/reference/engine/level/level-info_REF.gc +++ b/test/decompiler/reference/engine/level/level-info_REF.gc @@ -223,7 +223,7 @@ :bsphere (new 'static 'sphere :x -5079040.0 :z 4055040.0 :w 1024000.0) :buzzer 95 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common" "villagep") :wait-for-load #f ) @@ -453,7 +453,7 @@ :bsphere (new 'static 'sphere :x -444416.0 :y 133120.0 :z 360448.0 :w 843776.0) :buzzer 75 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -518,7 +518,7 @@ :bsphere (new 'static 'sphere :x -819200.0 :z -1556480.0 :w 1474560.0) :buzzer 20 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -586,7 +586,7 @@ :bsphere (new 'static 'sphere :x 1474560.0 :y 2519040.0 :z -983040.0 :w 2457600.0) :buzzer 7 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -646,7 +646,7 @@ :bsphere (new 'static 'sphere :x 1486848.0 :y -1269760.0 :z -1064960.0 :w 1228800.0) :buzzer 7 - :bottom-height -327680.0 + :bottom-height (meters -80.0) :run-packages '("common" "jungle") :wait-for-load #f ) @@ -1038,7 +1038,7 @@ :bsphere (new 'static 'sphere :z 4096000.0 :w 1269760.0) :buzzer 28 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #f ) @@ -1130,7 +1130,7 @@ :bsphere (new 'static 'sphere :x 419840.0 :y 151552.0 :z -3006464.0 :w 2048000.0) :buzzer 68 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1251,7 +1251,7 @@ :bsphere (new 'static 'sphere :x 1392640.0 :y 81920.0 :z -6770688.0 :w 696320.0) :buzzer 76 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1396,7 +1396,7 @@ :bsphere (new 'static 'sphere :x 2867200.0 :y -2048000.0 :z -6553600.0 :w 2048000.0) :buzzer 49 - :bottom-height -2048000.0 + :bottom-height (meters -500.0) :run-packages '("common") :wait-for-load #f ) @@ -1485,7 +1485,7 @@ :bsphere (new 'static 'sphere :x 2867200.0 :y -2048000.0 :z -6553600.0 :w 2048000.0) :buzzer 49 - :bottom-height -2048000.0 + :bottom-height (meters -500.0) :run-packages '("common" "sunken") :wait-for-load #f ) @@ -1850,7 +1850,7 @@ :bsphere (new 'static 'sphere :x 1986560.0 :z -8417280.0 :w 1003520.0) :buzzer 43 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -1914,7 +1914,7 @@ :bsphere (new 'static 'sphere :x -753664.0 :y 131072.0 :z -6569984.0 :w 974848.0) :buzzer 57 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -2034,7 +2034,7 @@ :bsphere (new 'static 'sphere :x 2334720.0 :y 180224.0 :z -10653696.0 :w 3653632.0) :buzzer 88 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #t ) @@ -2155,7 +2155,7 @@ :bsphere (new 'static 'sphere :x 4571136.0 :y 389120.0 :z -14323712.0 :w 409600.0) :buzzer 77 - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '("common") :wait-for-load #f ) @@ -2444,7 +2444,7 @@ :bsphere (new 'static 'sphere :x 3072000.0 :y 1142784.0 :z -14028800.0 :w 1290240.0) :buzzer 65 - :bottom-height 524288.0 + :bottom-height (meters 128.0) :run-packages '("common") :wait-for-load #f ) @@ -2564,7 +2564,7 @@ :bsphere (new 'static 'sphere :x 4517888.0 :y 114688.0 :z -12484608.0 :w 655360.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common") :wait-for-load #f ) @@ -2625,7 +2625,7 @@ :bsphere (new 'static 'sphere :x 3620864.0 :y 266240.0 :z -11935744.0 :w 368640.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common" "maincave") :wait-for-load #t ) @@ -2714,7 +2714,7 @@ :bsphere (new 'static 'sphere :x 5529600.0 :y 81920.0 :z -11468800.0 :w 512000.0) :buzzer 85 - :bottom-height -245760.0 + :bottom-height (meters -60.0) :run-packages '("common" "maincave") :wait-for-load #t ) @@ -2862,7 +2862,7 @@ :bsphere (new 'static 'sphere :x 8806400.0 :y 131072.0 :z -15564800.0 :w 3174400.0) :buzzer 90 - :bottom-height -286720.0 + :bottom-height (meters -70.0) :run-packages '("common") :wait-for-load #t ) @@ -3179,7 +3179,7 @@ :bsphere (new 'static 'sphere :x 11436032.0 :y -462848.0 :z -19750912.0 :w 1228800.0) :buzzer 91 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common") :wait-for-load #t ) @@ -3275,7 +3275,7 @@ :bsphere (new 'static 'sphere :x 11837440.0 :y 2129920.0 :z -19578880.0 :w 778240.0) :buzzer 91 - :bottom-height -466944.0 + :bottom-height (meters -114.0) :run-packages '("common") :wait-for-load #f ) @@ -3304,7 +3304,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -3363,7 +3363,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -3424,7 +3424,7 @@ :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :x -40960.0 :z 40960.0 :w 1126400.0) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '("common") :wait-for-load #f ) @@ -3484,7 +3484,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :w 167772160000.0) - :bottom-height -40960000000.0 + :bottom-height (meters -10000000.0) :run-packages '() :wait-for-load #t ) @@ -3513,7 +3513,7 @@ :alt-load-commands '() :bsp-mask #xffffffffffffffff :bsphere (new 'static 'sphere :w 167772160000.0) - :bottom-height -81920.0 + :bottom-height (meters -20.0) :run-packages '() :wait-for-load #t ) diff --git a/test/decompiler/reference/engine/math/transformq-h_REF.gc b/test/decompiler/reference/engine/math/transformq-h_REF.gc index ccbc5baf85..626d193b02 100644 --- a/test/decompiler/reference/engine/math/transformq-h_REF.gc +++ b/test/decompiler/reference/engine/math/transformq-h_REF.gc @@ -41,8 +41,8 @@ ;; definition of type trsqv (deftype trsqv (trsq) - ((pause-adjust-distance float :offset 4) - (nav-radius float :offset 8) + ((pause-adjust-distance meters :offset 4) + (nav-radius meters :offset 8) (transv vector :inline :offset-assert 64) (rotv vector :inline :offset-assert 80) (scalev vector :inline :offset-assert 96) diff --git a/test/decompiler/reference/engine/nav/navigate-h_REF.gc b/test/decompiler/reference/engine/nav/navigate-h_REF.gc index 7b30793a36..6a2109816f 100644 --- a/test/decompiler/reference/engine/nav/navigate-h_REF.gc +++ b/test/decompiler/reference/engine/nav/navigate-h_REF.gc @@ -67,7 +67,7 @@ (dest-pos vector :inline :offset-assert 32) (current-poly nav-poly :offset-assert 48) (next-poly nav-poly :offset-assert 52) - (len float :offset-assert 56) + (len meters :offset-assert 56) (last-edge int8 :offset-assert 60) (terminated basic :offset-assert 64) (reached-dest basic :offset-assert 68) @@ -357,7 +357,7 @@ (next-poly nav-poly :offset-assert 32) (target-poly nav-poly :offset-assert 36) (portal nav-route-portal 2 :offset-assert 40) - (nearest-y-threshold float :offset-assert 48) + (nearest-y-threshold meters :offset-assert 48) (event-temp vector :inline :offset-assert 64) (old-travel vector :inline :offset-assert 80) (blocked-travel vector :inline :offset-assert 96) diff --git a/test/decompiler/reference/engine/physics/dynamics-h_REF.gc b/test/decompiler/reference/engine/physics/dynamics-h_REF.gc index c9162fb4ee..c26466c033 100644 --- a/test/decompiler/reference/engine/physics/dynamics-h_REF.gc +++ b/test/decompiler/reference/engine/physics/dynamics-h_REF.gc @@ -4,12 +4,12 @@ ;; definition of type dynamics (deftype dynamics (basic) ((name basic :offset-assert 4) - (gravity-max float :offset-assert 8) - (gravity-length float :offset-assert 12) + (gravity-max meters :offset-assert 8) + (gravity-length meters :offset-assert 12) (gravity vector :inline :offset-assert 16) (gravity-normal vector :inline :offset-assert 32) - (walk-distance float :offset-assert 48) - (run-distance float :offset-assert 52) + (walk-distance meters :offset-assert 48) + (run-distance meters :offset-assert 52) ) :method-count-assert 9 :size-assert #x38 @@ -53,13 +53,13 @@ *standard-dynamics* (new 'static 'dynamics :name 'standard - :gravity-max 163840.0 - :gravity-length 245760.0 + :gravity-max (meters 40.0) + :gravity-length (meters 60.0) :gravity (new 'static 'vector :y 245760.0 :w 1.0) :gravity-normal (new 'static 'vector :y 1.0 :w 1.0) - :walk-distance 8192.0 - :run-distance 20480.0 + :walk-distance (meters 2.0) + :run-distance (meters 5.0) ) ) diff --git a/test/decompiler/reference/engine/physics/trajectory-h_REF.gc b/test/decompiler/reference/engine/physics/trajectory-h_REF.gc index 4378093ade..ed1044dc54 100644 --- a/test/decompiler/reference/engine/physics/trajectory-h_REF.gc +++ b/test/decompiler/reference/engine/physics/trajectory-h_REF.gc @@ -6,7 +6,7 @@ ((initial-position vector :inline :offset-assert 0) (initial-velocity vector :inline :offset-assert 16) (time float :offset-assert 32) - (gravity float :offset-assert 36) + (gravity meters :offset-assert 36) ) :method-count-assert 16 :size-assert #x28 diff --git a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc index b89f9128c5..c2353db5ad 100644 --- a/test/decompiler/reference/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/engine/target/joint-mod-h_REF.gc @@ -15,8 +15,8 @@ (notice-time uint64 :offset-assert 112) (flex-blend float :offset-assert 120) (blend float :offset-assert 124) - (max-dist float :offset-assert 128) - (ignore-angle float :offset-assert 132) + (max-dist meters :offset-assert 128) + (ignore-angle degrees :offset-assert 132) (up uint8 :offset-assert 136) (nose uint8 :offset-assert 137) (ear uint8 :offset-assert 138) @@ -156,7 +156,7 @@ (set! (-> v1-2 z) 1.0) (set! (-> v1-2 w) 1.0) ) - (set! (-> obj max-dist) (the-as float #f)) + (set! (-> obj max-dist) (the-as meters #f)) ) (((joint-mod-handler-mode joint-set*)) (set! (-> joint param0) joint-mod-joint-set*-handler) @@ -170,7 +170,7 @@ (set! (-> v1-4 z) 1.0) (set! (-> v1-4 w) 1.0) ) - (set! (-> obj max-dist) (the-as float #f)) + (set! (-> obj max-dist) (the-as meters #f)) ) ) ) diff --git a/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc b/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc index 14fa435de8..a41db3e67a 100644 --- a/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc +++ b/test/decompiler/reference/levels/common/nav-enemy-h_REF.gc @@ -3,57 +3,57 @@ ;; definition of type nav-enemy-info (deftype nav-enemy-info (basic) - ((idle-anim int32 :offset-assert 4) - (walk-anim int32 :offset-assert 8) - (turn-anim int32 :offset-assert 12) - (notice-anim int32 :offset-assert 16) - (run-anim int32 :offset-assert 20) - (jump-anim int32 :offset-assert 24) - (jump-land-anim int32 :offset-assert 28) - (victory-anim int32 :offset-assert 32) - (taunt-anim int32 :offset-assert 36) - (die-anim int32 :offset-assert 40) - (neck-joint int32 :offset-assert 44) - (player-look-at-joint int32 :offset-assert 48) - (run-travel-speed float :offset-assert 52) - (run-rotate-speed float :offset-assert 56) - (run-acceleration float :offset-assert 60) - (run-turn-time uint64 :offset-assert 64) - (walk-travel-speed float :offset-assert 72) - (walk-rotate-speed float :offset-assert 76) - (walk-acceleration float :offset-assert 80) - (walk-turn-time uint64 :offset-assert 88) - (attack-shove-back float :offset-assert 96) - (attack-shove-up float :offset-assert 100) - (shadow-size float :offset-assert 104) - (notice-nav-radius float :offset-assert 108) - (nav-nearest-y-threshold float :offset-assert 112) - (notice-distance float :offset-assert 116) - (proximity-notice-distance float :offset-assert 120) - (stop-chase-distance float :offset-assert 124) - (frustration-distance float :offset-assert 128) - (frustration-time uint64 :offset-assert 136) - (die-anim-hold-frame float :offset-assert 144) - (jump-anim-start-frame float :offset-assert 148) - (jump-land-anim-end-frame float :offset-assert 152) - (jump-height-min float :offset-assert 156) - (jump-height-factor float :offset-assert 160) - (jump-start-anim-speed float :offset-assert 164) - (shadow-max-y float :offset-assert 168) - (shadow-min-y float :offset-assert 172) - (shadow-locus-dist float :offset-assert 176) - (use-align basic :offset-assert 180) - (draw-shadow basic :offset-assert 184) - (move-to-ground basic :offset-assert 188) - (hover-if-no-ground basic :offset-assert 192) - (use-momentum basic :offset-assert 196) - (use-flee basic :offset-assert 200) - (use-proximity-notice basic :offset-assert 204) - (use-jump-blocked basic :offset-assert 208) - (use-jump-patrol basic :offset-assert 212) - (gnd-collide-with uint64 :offset-assert 216) - (debug-draw-neck basic :offset-assert 224) - (debug-draw-jump basic :offset-assert 228) + ((idle-anim int32 :offset-assert 4) + (walk-anim int32 :offset-assert 8) + (turn-anim int32 :offset-assert 12) + (notice-anim int32 :offset-assert 16) + (run-anim int32 :offset-assert 20) + (jump-anim int32 :offset-assert 24) + (jump-land-anim int32 :offset-assert 28) + (victory-anim int32 :offset-assert 32) + (taunt-anim int32 :offset-assert 36) + (die-anim int32 :offset-assert 40) + (neck-joint int32 :offset-assert 44) + (player-look-at-joint int32 :offset-assert 48) + (run-travel-speed meters :offset-assert 52) + (run-rotate-speed degrees :offset-assert 56) + (run-acceleration meters :offset-assert 60) + (run-turn-time seconds :offset-assert 64) + (walk-travel-speed meters :offset-assert 72) + (walk-rotate-speed degrees :offset-assert 76) + (walk-acceleration meters :offset-assert 80) + (walk-turn-time seconds :offset-assert 88) + (attack-shove-back meters :offset-assert 96) + (attack-shove-up meters :offset-assert 100) + (shadow-size meters :offset-assert 104) + (notice-nav-radius meters :offset-assert 108) + (nav-nearest-y-threshold meters :offset-assert 112) + (notice-distance meters :offset-assert 116) + (proximity-notice-distance meters :offset-assert 120) + (stop-chase-distance meters :offset-assert 124) + (frustration-distance meters :offset-assert 128) + (frustration-time uint64 :offset-assert 136) + (die-anim-hold-frame float :offset-assert 144) + (jump-anim-start-frame float :offset-assert 148) + (jump-land-anim-end-frame float :offset-assert 152) + (jump-height-min meters :offset-assert 156) + (jump-height-factor float :offset-assert 160) + (jump-start-anim-speed float :offset-assert 164) + (shadow-max-y meters :offset-assert 168) + (shadow-min-y meters :offset-assert 172) + (shadow-locus-dist meters :offset-assert 176) + (use-align basic :offset-assert 180) + (draw-shadow basic :offset-assert 184) + (move-to-ground basic :offset-assert 188) + (hover-if-no-ground basic :offset-assert 192) + (use-momentum basic :offset-assert 196) + (use-flee basic :offset-assert 200) + (use-proximity-notice basic :offset-assert 204) + (use-jump-blocked basic :offset-assert 208) + (use-jump-patrol basic :offset-assert 212) + (gnd-collide-with uint64 :offset-assert 216) + (debug-draw-neck basic :offset-assert 224) + (debug-draw-jump basic :offset-assert 228) ) :method-count-assert 9 :size-assert #xe8