[decomp] spatial-hash (#2009)

This commit is contained in:
water111
2022-11-11 16:23:26 -05:00
committed by GitHub
parent 136136e498
commit b2b47eec5c
27 changed files with 7654 additions and 230 deletions
+3 -1
View File
@@ -1092,7 +1092,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
result->push_back(pool.alloc_element<DerefElement>(args.at(1), out.addr_of, tokens));
return;
} else {
throw std::runtime_error("Failed to match for stride 1 address access with add.");
throw std::runtime_error(
fmt::format("Failed to match for stride 1 address access with add: {}",
args.at(0)->to_string(env)));
}
}
} else if (arg0_type.kind == TP_Type::Kind::INTEGER_CONSTANT_PLUS_VAR_MULT) {
+6
View File
@@ -1034,6 +1034,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op2_mask(i0, instr_str, "vabs");
case InstructionKind::VADDQ:
return handle_generic_op2_mask(i0, instr_str, "vaddq");
case InstructionKind::VMR32:
return handle_generic_op2_mask(i0, instr_str, "vmr32");
case InstructionKind::ANDI:
case InstructionKind::ORI:
case InstructionKind::XORI:
@@ -1108,6 +1110,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op3(i0, instr_str, "xor_");
case InstructionKind::AND:
return handle_generic_op3(i0, instr_str, "and_"); // and isn't allowed in C++
case InstructionKind::NOR:
return handle_generic_op3(i0, instr_str, "nor"); // and isn't allowed in C++
case InstructionKind::DADDIU:
return handle_daddiu(output, i0, instr_str, version);
case InstructionKind::ADDIU:
@@ -1159,6 +1163,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
return handle_generic_op2(i0, instr_str, "mtc1");
case InstructionKind::NEGS:
return handle_generic_op2(i0, instr_str, "negs");
case InstructionKind::ABSS:
return handle_generic_op2(i0, instr_str, "abss");
case InstructionKind::MOVS:
return handle_generic_op2(i0, instr_str, "movs");
case InstructionKind::CVTWS:
+45 -45
View File
@@ -22541,7 +22541,7 @@
((work grid-hash-work :offset-assert 4)
(search-box grid-hash-box :inline :offset-assert 8)
(bucket-size int16 :offset-assert 14)
(axis-scale uint32 3 :offset-assert 16)
(axis-scale float 3 :offset-assert 16)
(dimension-array int8 3 :offset-assert 28)
(vertical-cell-count int8 :offset-assert 31)
(bucket-array (pointer grid-hash-word) :offset-assert 32)
@@ -22560,24 +22560,24 @@
:size-assert #x58
:flag-assert #x1900000058
(:methods
(new (symbol type process int) _type_ 0)
(grid-hash-method-9 (_type_ int (array float) int) none 9)
(grid-hash-method-10 (_type_) none 10)
(grid-hash-method-11 (_type_) none 11)
(grid-hash-method-12 (_type_ vector) grid-hash-box 12)
(grid-hash-method-13 (_type_ vector float) grid-hash-box 13)
(draw-grid "Draws the grid-hash" (_type_ rgba) none 14)
(new (symbol type int int) _type_ 0)
(update-grid-for-objects-in-box (_type_ int vector vector) none 9)
(clear-bucket-array (_type_) none 10)
(setup-search-box (_type_ int vector vector vector) none 11)
(search-for-point (_type_ vector) (pointer uint8) 12)
(search-for-sphere (_type_ vector float) (pointer uint8) 13)
(draw "Draws the grid-hash" (_type_ rgba) none 14)
(dump-grid-info
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
(_type_) none 15)
(grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16)
(grid-hash-method-17 (_type_) none 17)
(verify-bits-in-bucket (_type_ grid-hash-box grid-hash-box) none 16)
(box-of-everything (_type_ object grid-hash-box) none 17)
(grid-hash-method-18 (_type_ grid-hash-box int) none 18)
(grid-hash-method-19 (_type_ grid-hash-box int) none 19)
(grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20)
(grid-hash-method-21 (_type_ float int int) none 21)
(grid-hash-method-22 (_type_ grid-hash-box sphere) none 22)
(grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23)
(do-search! (_type_ grid-hash-box (pointer uint8)) none 20)
(set-up-box (_type_ grid-hash-box vector vector) none 21)
(sphere-to-grid-box (_type_ grid-hash-box sphere) none 22)
(line-sphere-to-grid-box (_type_ grid-hash-box vector vector float) none 23)
(update-grid (_type_) none 24)
)
)
@@ -22606,15 +22606,16 @@
:size-assert #x68
:flag-assert #x2200000068
(:methods
(new (symbol type int int) _type_ 0)
(clear-objects! (_type_) none 25)
(sphere-hash-method-26 (_type_ vector) none 26)
(sphere-hash-method-27 (_type_) none 27)
(sphere-hash-method-28 (_type_) none 28)
(add-a-sphere (_type_ vector) int 26)
(add-a-sphere-with-flag (_type_ vector int) int 27)
(update-from-spheres (_type_) none 28)
(sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29)
(sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30)
(sphere-hash-method-31 (_type_ vector int int) none 31)
(sphere-hash-method-32 (_type_ vector vector float int) symbol 32)
(sphere-hash-method-33 (_type_ object int) none 33)
(sphere-hash-method-33 (_type_ sphere int) none 33)
)
)
@@ -22627,21 +22628,22 @@
)
(deftype spatial-hash (sphere-hash)
((object-array (pointer hash-object-info) :offset-assert 104)
(mem-object-array (pointer hash-object-info) :offset-assert 108)
(spr-object-array (pointer hash-object-info) :offset-assert 112)
((object-array (inline-array hash-object-info) :offset-assert 104)
(mem-object-array (inline-array hash-object-info) :offset-assert 108)
(spr-object-array (inline-array hash-object-info) :offset-assert 112)
)
:method-count-assert 41
:size-assert #x74
:flag-assert #x2900000074
(:methods
(spatial-hash-method-34 (_type_ vector hash-object-info) int 34)
(new (symbol type int int) _type_ 0)
(add-an-object (_type_ vector hash-object-info) int 34)
(spatial-hash-method-35 (_type_) none 35)
(fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36)
(spatial-hash-method-37 (_type_) none 37)
(spatial-hash-method-38 (_type_) none 38)
(fill-actor-list-for-vec+r (_type_ vector (pointer collide-shape) int) none 38)
(spatial-hash-method-39 (_type_ object hash-object-info) none 39)
(spatial-hash-method-40 (_type_) none 40)
(validate-objects (_type_) none 40)
)
)
@@ -26462,7 +26464,7 @@
(define-extern *grid-hash-work* grid-hash-work)
(define-extern validate-bucket-bits (function grid-hash (pointer grid-hash-word) symbol))
(define-extern draw-grid (function vector vector (pointer int8) rgba none))
(define-extern draw-sphere-box (function sphere none))
(define-extern draw-sphere-box (function sphere rgba none))
(define-extern draw-line-sphere (function vector vector float rgba none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -26480,20 +26482,20 @@
(deftype actor-hash-bucket (structure)
((length int16 :offset-assert 0)
(max-length int16 :offset-assert 2)
(data (pointer uint32) :offset-assert 4) ;; an array of....something TODO
(data (inline-array actor-cshape-ptr) :offset-assert 4) ;; an array of....something TODO
)
:allow-misaligned
:method-count-assert 10
:size-assert #x8
:flag-assert #xa00000008
(:methods
(actor-hash-bucket-method-9 () none 9)
(add-actor-cshape (_type_ collide-shape) none 9)
)
)
(deftype actor-hash-buckets (structure)
((hash basic :offset-assert 0)
(list basic :offset-assert 4)
((hash spatial-hash :offset-assert 0)
(list engine :offset-assert 4)
(data actor-hash-bucket 4 :inline :offset-assert 8)
(tpos vector :inline :offset-assert 80)
)
@@ -26501,7 +26503,7 @@
:size-assert #x60
:flag-assert #xa00000060
(:methods
(actor-hash-buckets-method-9 () none 9)
(hash-actors (_type_) none 9)
)
)
@@ -26513,7 +26515,6 @@
;; merc-death ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#|
(deftype death-info (basic)
((vertex-skip uint16 :offset-assert 4)
(timer uint8 :offset-assert 6)
@@ -26525,17 +26526,16 @@
:size-assert #x10
:flag-assert #x900000010
)
|#
;; (define-extern *merc-death-globals* object) ;; vector
;; (define-extern birth-func-death-sparks function) ;; (function none)
;; (define-extern death-seed death-info)
;; (define-extern start-seed-effect function)
;; (define-extern death-default death-info) ;; death-info
;; (define-extern death-warp-in death-info) ;; death-info
;; (define-extern death-warp-out death-info) ;; death-info
;; (define-extern sparticle-texture-glow-soft function)
;; (define-extern merc-death-spawn function) ;; (function int vector vector none)
(define-extern *merc-death-globals* vector)
(define-extern birth-func-death-sparks (function none))
(define-extern death-seed death-info)
(define-extern start-seed-effect (function process-drawable vector cspace none))
(define-extern death-default death-info)
(define-extern death-warp-in death-info)
(define-extern death-warp-out death-info)
(define-extern sparticle-texture-glow-soft (function sparticle-system sparticle-cpuinfo vector none))
(define-extern merc-death-spawn (function int vector vector none))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; water-flow ;;
@@ -26553,7 +26553,7 @@
)
(deftype flow-section-array (inline-array-class)
((data flow-section :dynamic :offset-assert 16)
((data flow-section :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
@@ -26574,9 +26574,9 @@
(:methods
(new (symbol type process-drawable res-lump) _type_ 0)
(draw-path (_type_) none 9)
(flow-control-method-10 () none 10)
(flow-control-method-11 () none 11)
(flow-control-method-12 () none 12)
(setup (_type_) none 10)
(push-process (_type_ process-focusable) none 11)
(find-and-push-things (_type_) none 12)
)
)
@@ -454,5 +454,8 @@
],
"crimson-guard-level": [
[28, "(function crimson-guard-level collide-shape-moving vector symbol)"]
],
"merc-death": [
[3, "(function none :behavior process-drawable)"]
]
}
+20 -2
View File
@@ -385,7 +385,9 @@
"(method 12 collide-shape-prim-group)": [1, 2, 3, 4, 5, 6],
"(method 13 collide-shape-prim)": [1, 2, 3, 4, 5, 6],
"(method 12 collide-shape-prim-sphere)": [1, 2, 3, 4, 5, 8, 10, 11, 13, 14, 15],
"(method 12 collide-shape-prim-mesh)": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16]
"(method 12 collide-shape-prim-mesh)": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16],
"(method 24 grid-hash)": [39, 35, 22, 15],
"(method 12 flow-control)": [11, 12, 13, 14, 15, 18, 20, 22, 29]
},
// Sometimes the game might use format strings that are fetched dynamically,
@@ -466,7 +468,23 @@
"init-ocean-far-regs",
"(method 14 ocean)",
"(method 15 ocean)",
"(method 16 ocean)"
"(method 16 ocean)",
"(method 18 grid-hash)",
"(method 19 grid-hash)",
"(method 20 grid-hash)",
"(method 22 grid-hash)",
"(method 28 sphere-hash)",
"(method 33 sphere-hash)",
"(method 29 sphere-hash)",
"(method 30 sphere-hash)",
"(method 31 sphere-hash)",
"(method 32 sphere-hash)",
"(method 33 spatial-hash)",
"(method 39 spatial-hash)",
"(method 36 spatial-hash)",
"(method 37 spatial-hash)",
"(method 35 spatial-hash)"
],
"mips2c_jump_table_functions": {},
@@ -1185,5 +1185,10 @@
[32, "vector"]
],
"spawn-metalhead-grenade": [[16, "projectile-init-by-other-params"]],
"spawn-metalhead-projectile": [[16, "projectile-init-by-other-params"]]
"spawn-metalhead-projectile": [[16, "projectile-init-by-other-params"]],
"(method 24 grid-hash)": [[16, "vector"]],
"(method 11 grid-hash)": [
[16, "vector"], [32, "vector"]
],
"(method 11 flow-control)": [[80, "vector"], [128, "vector"]]
}
+33
View File
@@ -4672,5 +4672,38 @@
[267, "v1", "art-joint-anim"],
[366, "v1", "art-joint-anim"],
[463, "v1", "art-joint-anim"]
],
"(method 10 grid-hash)": [
[12, "a0", "(pointer uint128)"]
],
"(method 24 grid-hash)": [
[78, "v1", "(pointer uint128)"],
[191, "t0", "(pointer int8)"],
[195, "a2", "(pointer uint8)"],
[237, "v1", "(pointer uint128)"]
],
"(method 11 grid-hash)": [
[[141, 147], "t6", "pointer"],
[128, "t1", "pointer"],
[149, "t4", "pointer"],
[152, "t1", "pointer"]
],
"(method 27 sphere-hash)": [
[44, "s2", "(pointer int8)"]
],
"(method 9 actor-hash-buckets)": [
[19, "v1", "connection"],
[[16, 160], "s4", "collide-shape"],
[76, "s4", "collide-shape"],
[108, "v1", "connection"]
],
"(method 12 flow-control)": [
[23, "a0", "connection"],
[24, "a0", "collide-shape"],
[71, "a0", "connection"],
[72, "a0", "collide-shape"]
],
"(method 10 flow-control)": [
["_stack_", 32, "flow-section"]
]
}
+14 -3
View File
@@ -290,6 +290,12 @@ goos::Object decompile_value_array(const TypeSpec& elt_type,
for (int j = start; j < end; j++) {
auto& word = obj_words.at(j / 4);
if (word.kind() != LinkedWord::PLAIN_DATA) {
if (word.kind() == LinkedWord::TYPE_PTR) {
throw std::runtime_error(
fmt::format("Got bad word in kind in array of values: expecting array of {}'s, got a "
"type pointer {}\n",
elt_type.print(), word.symbol_name()));
}
throw std::runtime_error(fmt::format(
"Got bad word in kind in array of values: expecting array of {}'s, got a {}\n",
elt_type.print(), (int)word.kind()));
@@ -426,6 +432,11 @@ goos::Object decomp_ref_to_integer_array_guess_size(
}
}
// if we end exactly on a type_ptr, take off an element.
if (all_words.at(my_seg).at((end_offset - 1) / 4).kind() == LinkedWord::TYPE_PTR) {
size_elts--;
}
return decompile_value_array(array_elt_type, elt_type_info, size_elts, stride, start_label.offset,
all_words.at(start_label.target_segment), ts);
}
@@ -726,9 +737,9 @@ const std::unordered_map<
{"racer-array", ArrayFieldDecompMeta(TypeSpec("race-racer-info"), 16)},
{"decision-point-array", ArrayFieldDecompMeta(TypeSpec("race-decision-point"), 16)}}},
{"actor-hash-bucket",
{{"data", ArrayFieldDecompMeta(TypeSpec("uint32"),
4,
ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}},
{{"data", ArrayFieldDecompMeta(TypeSpec("actor-cshape-ptr"),
16,
ArrayFieldDecompMeta::Kind::REF_TO_INLINE_ARR)}}},
{"xz-height-map",
{{"data", ArrayFieldDecompMeta(TypeSpec("int8"),
1,
+1
View File
@@ -92,6 +92,7 @@ set(RUNTIME_SOURCE
mips2c/jak2_functions/sky.cpp
mips2c/jak2_functions/sparticle.cpp
mips2c/jak2_functions/sparticle_launcher.cpp
mips2c/jak2_functions/spatial_hash.cpp
mips2c/jak2_functions/texture.cpp
mips2c/jak2_functions/ocean.cpp
mips2c/jak2_functions/ocean_vu0.cpp
File diff suppressed because it is too large Load Diff
+20
View File
@@ -828,6 +828,25 @@ struct ExecutionContext {
}
}
void vmr32(DEST mask, int dest, int src) {
auto s = vf_src(src);
if ((u64)mask & 1) {
vfs[dest].f[0] = s.f[1];
}
if ((u64)mask & 2) {
vfs[dest].f[1] = s.f[2];
}
if ((u64)mask & 4) {
vfs[dest].f[2] = s.f[3];
}
if ((u64)mask & 8) {
vfs[dest].f[3] = s.f[0];
}
}
void vsub(DEST mask, int dest, int src0, int src1) {
auto s0 = vf_src(src0);
auto s1 = vf_src(src1);
@@ -1107,6 +1126,7 @@ struct ExecutionContext {
}
void xor_(int dst, int src0, int src1) { gprs[dst].du64[0] = sgpr64(src0) ^ sgpr64(src1); }
void or_(int dst, int src0, int src1) { gprs[dst].du64[0] = sgpr64(src0) | sgpr64(src1); }
void nor(int dst, int src0, int src1) { gprs[dst].du64[0] = ~(sgpr64(src0) | sgpr64(src1)); }
void movz(int dst, int src0, int src1) {
if (sgpr64(src1) == 0) {
+26 -1
View File
@@ -166,6 +166,22 @@ namespace render_ocean_quad { extern void link(); }
namespace method_16_ocean { extern void link(); }
namespace method_15_ocean { extern void link(); }
namespace method_14_ocean { extern void link(); }
namespace method_18_grid_hash { extern void link(); }
namespace method_19_grid_hash { extern void link(); }
namespace method_20_grid_hash { extern void link(); }
namespace method_22_grid_hash { extern void link(); }
namespace method_28_sphere_hash { extern void link(); }
namespace method_33_sphere_hash { extern void link(); }
namespace method_29_sphere_hash { extern void link(); }
namespace method_30_sphere_hash { extern void link(); }
namespace method_31_sphere_hash { extern void link(); }
namespace method_32_sphere_hash { extern void link(); }
namespace method_33_spatial_hash { extern void link(); }
namespace method_39_spatial_hash { extern void link(); }
namespace method_36_spatial_hash { extern void link(); }
namespace method_37_spatial_hash { extern void link(); }
namespace method_35_spatial_hash { extern void link(); }
}
// clang-format on
@@ -275,7 +291,16 @@ PerGameVersion<std::unordered_map<std::string, std::vector<void (*)()>>> gMips2C
{jak2::method_16_ocean::link, jak2::method_15_ocean::link, jak2::method_14_ocean::link}},
{"ocean",
{jak2::init_ocean_far_regs::link, jak2::draw_large_polygon_ocean::link,
jak2::render_ocean_quad::link}}},
jak2::render_ocean_quad::link}},
{"spatial-hash",
{jak2::method_18_grid_hash::link, jak2::method_19_grid_hash::link,
jak2::method_20_grid_hash::link, jak2::method_22_grid_hash::link,
jak2::method_28_sphere_hash::link, jak2::method_33_sky_work::link,
jak2::method_29_sphere_hash::link, jak2::method_30_sphere_hash::link,
jak2::method_31_sphere_hash::link, jak2::method_32_sphere_hash::link,
jak2::method_33_spatial_hash::link, jak2::method_39_spatial_hash::link,
jak2::method_36_spatial_hash::link, jak2::method_37_spatial_hash::link,
jak2::method_35_spatial_hash::link, jak2::method_33_sphere_hash::link}}},
};
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
+58 -50
View File
@@ -40,6 +40,7 @@
)
)
(defmethod relocate water-anim ((obj water-anim) (arg0 int))
(if (nonzero? (-> obj flow))
(&+! (-> obj flow) arg0)
@@ -227,6 +228,7 @@
:flag-assert #x90000000c
)
(define *water-anim-look*
(new 'static 'boxed-array :type water-anim-look
(new 'static 'water-anim-look :skel-group "water-anim-nest-dark-eco-largepool" :anim 8 :ambient-sound-spec #f)
@@ -303,6 +305,8 @@
)
)
;; WARN: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210]
(defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-1 none))
(let ((v1-0 arg2))
@@ -326,60 +330,59 @@
v0-1
)
((= v1-0 'water)
(let ((s5-0 (the-as object (-> arg3 param 0))))
(let* ((s4-0 (the-as object (-> arg3 param 1)))
(gp-0 (if (type? (the-as process s4-0) process-focusable)
(the-as uint s4-0)
)
)
(let* ((s5-0 (the-as object (-> arg3 param 0)))
(s4-0 (the-as object (-> arg3 param 1)))
(gp-0 (if (type? (the-as process s4-0) process-focusable)
(the-as uint s4-0)
)
)
)
(when (and (logtest? (-> self flags) (water-flags deadly))
(logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags))
(the-as uint gp-0)
)
(let ((v1-15 (-> self attack-event)))
(case v1-15
((#f)
)
(when (and (logtest? (-> self flags) (water-flags deadly))
(logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags))
(the-as uint gp-0)
)
(let ((v1-15 (-> self attack-event)))
(case v1-15
((#f)
)
(('heat)
(send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame)))
)
(('drown-death 'lava 'dark-eco-pool)
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-10 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-10 from) (process->ppointer self))
(set! (-> a1-10 num-params) 2)
(set! (-> a1-10 message) 'attack-invinc)
(set! (-> a1-10 param 0) (the-as uint #f))
(let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-4 id) (-> self attack-id))
(set! (-> a2-4 mode) v1-15)
(set! (-> a1-10 param 1) (the-as uint a2-4))
)
(send-event-function (the-as process-focusable gp-0) a1-10)
(('heat)
(send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame)))
)
(('drown-death 'lava 'dark-eco-pool)
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-10 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-10 from) (process->ppointer self))
(set! (-> a1-10 num-params) 2)
(set! (-> a1-10 message) 'attack-invinc)
(set! (-> a1-10 param 0) (the-as uint #f))
(let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-4 id) (-> self attack-id))
(set! (-> a2-4 mode) v1-15)
(set! (-> a1-10 param 1) (the-as uint a2-4))
)
(send-event-function (the-as process-focusable gp-0) a1-10)
)
(send-event self 'notify 'attack)
)
)
(else
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) (process->ppointer self))
(set! (-> a1-13 num-params) 2)
(set! (-> a1-13 message) 'attack)
(set! (-> a1-13 param 0) (the-as uint #f))
(let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-6 id) (-> self attack-id))
(set! (-> a2-6 mode) v1-15)
(set! (-> a1-13 param 1) (the-as uint a2-6))
)
(send-event-function (the-as process-tree gp-0) a1-13)
)
(send-event self 'notify 'attack)
)
)
(else
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) (process->ppointer self))
(set! (-> a1-13 num-params) 2)
(set! (-> a1-13 message) 'attack)
(set! (-> a1-13 param 0) (the-as uint #f))
(let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-6 id) (-> self attack-id))
(set! (-> a2-6 mode) v1-15)
(set! (-> a1-13 param 1) (the-as uint a2-6))
)
(send-event-function (the-as process-tree gp-0) a1-13)
)
(send-event self 'notify 'attack)
)
)
)
(send-event self 'notify 'attack)
)
)
)
)
@@ -389,7 +392,7 @@
)
(let ((a0-40 (-> self flow)))
(if (nonzero? a0-40)
((method-of-object a0-40 flow-control-method-11))
(push-process a0-40 (the-as process-focusable gp-0))
)
)
)
@@ -461,11 +464,13 @@
(ripple-find-height obj 0 arg0)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod water-anim-method-27 water-anim ((obj water-anim))
"Empty."
(none)
)
;; WARN: Return type mismatch quaternion vs none.
(defmethod offset! water-anim ((obj water-anim))
"Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`."
(local-vars (sv-16 res-tag))
@@ -529,6 +534,7 @@
)
)
;; WARN: Return type mismatch water-flags vs none.
(defmethod water-anim-init! water-anim ((obj water-anim))
"Initialize a [[water-anim]]."
(local-vars (sv-16 res-tag))
@@ -599,6 +605,7 @@
(none)
)
;; WARN: Return type mismatch object vs none.
(defbehavior water-anim-init-by-other water-anim ((arg0 entity-actor))
(process-entity-set! self arg0)
(water-anim-method-27 self)
@@ -610,6 +617,7 @@
(none)
)
;; WARN: Return type mismatch object vs none.
(defmethod init-from-entity! water-anim ((obj water-anim) (arg0 entity-actor))
(water-anim-method-27 obj)
(reset-root! obj)
+310 -9
View File
@@ -28,16 +28,13 @@
:flag-assert #x900000040
)
(deftype flow-section-array (inline-array-class)
((data flow-section :dynamic :offset-assert 16)
((data flow-section :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(set! (-> flow-section-array heap-base) (the-as uint 64))
(deftype flow-control (basic)
@@ -54,13 +51,12 @@
(:methods
(new (symbol type process-drawable res-lump) _type_ 0)
(draw-path (_type_) none 9)
(flow-control-method-10 () none 10)
(flow-control-method-11 () none 11)
(flow-control-method-12 () none 12)
(setup (_type_) none 10)
(push-process (_type_ process-focusable) none 11)
(find-and-push-things (_type_) none 12)
)
)
(defmethod relocate flow-control ((obj flow-control) (arg0 int))
(if (nonzero? (-> obj sections))
(&+! (-> obj sections) arg0)
@@ -81,6 +77,307 @@
(none)
)
(defmethod push-process flow-control ((obj flow-control) (arg0 process-focusable))
(with-pp
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> (get-trans arg0 0) quad))
(set! (-> s5-0 w) 1.0)
(when (>= (vector4-dot s5-0 (the-as vector (-> obj leading))) 0.0)
(let* ((v1-7 (-> obj sections))
(a0-3 (-> v1-7 length))
(a3-0 (the-as object (-> obj leading)))
)
(dotimes (s3-1 a0-3)
(let ((s2-0 (-> v1-7 data s3-1)))
(when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0)
(let ((v1-8 (new 'stack-no-clear 'vector)))
(vector-! v1-8 s5-0 (-> s2-0 start))
(when (>= (-> obj belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir))))
(let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir)))
(f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7)))
)
(when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9))
(let* ((a0-11 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector))
(f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0)))
(f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing)))
)
(let ((a0-13 (new 'stack-no-clear 'vector)))
(let ((v1-13 (-> s2-0 start)))
(let ((a1-12 (-> s2-0 pull-dir)))
(let ((a2-6 12288.0))
(.mov vf7 a2-6)
)
(.lvf vf5 (&-> a1-12 quad))
)
(.lvf vf4 (&-> v1-13 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-13 quad) vf6)
)
0
(let ((f0-12 (/ f30-0 (- f30-0 f0-10)))
(s2-1 (new 'stack-no-clear 'vector))
)
(displacement-between-two-points-normalized! (-> obj path) s2-1 (+ (the float s3-1) f0-12))
(let ((v1-17 (new 'stack-no-clear 'vector)))
(vector-float*! v1-17 s2-1 (* (-> obj speed) (-> pp clock seconds-per-frame)))
(let ((a1-15 (new 'stack-no-clear 'vector)))
(let ((a0-17 v1-17))
(let ((a2-9 2048.0))
(.mov vf7 a2-9)
)
(.lvf vf5 (&-> a0-17 quad))
)
(.lvf vf4 (&-> s5-0 quad))
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-15 quad) vf6)
)
0
(send-event arg0 'push-trans v1-17 3000)
)
)
)
)
)
)
)
(return #f)
)
)
(set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* s3-1 64)))
)
)
)
)
0
(none)
)
)
)
(defmethod find-and-push-things flow-control ((obj flow-control))
(local-vars (a0-10 float) (a2-5 float) (a2-12 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
)
(init-vf0-vector)
(set! *actor-list-length* 0)
(if #t
(set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (-> obj collide-bounds) *actor-list* 256))
)
(when #t
(let ((a0-2 (-> *collide-player-list* alive-list next0)))
*collide-player-list*
(let ((v1-11 (-> a0-2 next0)))
(while (!= a0-2 (-> *collide-player-list* alive-list-end))
(let* ((a0-3 (-> (the-as connection a0-2) param1))
(a1-1 (-> (the-as collide-shape a0-3) root-prim))
)
(when (logtest? (-> a1-1 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list))
(let ((a1-2 (-> a1-1 prim-core)))
(let ((a2-4 a1-2)
(a3-1 (-> obj collide-bounds))
)
(.lvf vf2 (&-> a2-4 world-sphere quad))
(.lvf vf3 (&-> a3-1 quad))
)
(.sub.vf vf1 vf3 vf2)
(.mul.vf vf1 vf1 vf1)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.add.z.vf vf1 vf1 vf1 :mask #b1)
(.mov a2-5 vf1)
(let ((f0-0 a2-5)
(f1-1 (+ (-> a1-2 world-sphere w) (-> obj collide-bounds r)))
)
(when (< f0-0 (* f1-1 f1-1))
(when (< *actor-list-length* 256)
(set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3))
(set! *actor-list-length* (+ *actor-list-length* 1))
)
)
)
)
)
)
(set! a0-2 v1-11)
*collide-player-list*
(set! v1-11 (-> v1-11 next0))
)
)
)
)
(b! (not #f) cfg-20 :delay (empty-form))
(let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0)))
*collide-hit-by-player-list*
(let ((v1-18 (-> a0-5 next0)))
(b! #t cfg-18 :delay (nop!))
(label cfg-13)
(let ((a0-6 (-> (the-as connection a0-5) param1)))
(let ((a1-13 (-> (the-as collide-shape a0-6) root-prim)))
(b!
(not (logtest? (-> a1-13 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list)))
cfg-17
:delay (empty-form)
)
(let ((a1-14 (-> a1-13 prim-core)))
(let ((a2-11 a1-14)
(a3-2 (-> obj collide-bounds))
)
(.lvf vf2 (&-> a2-11 world-sphere quad))
(.lvf vf3 (&-> a3-2 quad))
)
(.sub.vf vf1 vf3 vf2)
(.mul.vf vf1 vf1 vf1)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.add.z.vf vf1 vf1 vf1 :mask #b1)
(.mov a2-12 vf1)
(let ((f0-1 a2-12)
(f1-5 (+ (-> a1-14 world-sphere w) (-> obj collide-bounds r)))
)
(b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f)
)
)
)
(b! (>= *actor-list-length* 256) cfg-17 :delay #f)
(set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6))
)
(set! *actor-list-length* (+ *actor-list-length* 1))
(label cfg-17)
(set! a0-5 v1-18)
*collide-hit-by-player-list*
(set! v1-18 (-> v1-18 next0))
)
(label cfg-18)
(b! (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) cfg-13 :delay (nop!))
)
(label cfg-20)
(let ((s5-0 0))
(b! #t cfg-29 :delay (nop!))
(label cfg-21)
(let* ((v1-23 (-> *actor-list* s5-0))
(a0-9 (-> v1-23 root-prim))
)
(when (logtest? (-> a0-9 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list))
(.lvf vf1 (&-> obj collide-bounds quad))
(.lvf vf2 (&-> a0-9 prim-core world-sphere quad))
(.sub.vf vf3 vf1 vf2)
(.add.w.vf vf4 vf1 vf2 :mask #b1000)
(.mul.vf vf3 vf3 vf3 :mask #b111)
(.mul.w.vf vf4 vf4 vf4 :mask #b1000)
(.mul.x.vf acc vf0 vf3 :mask #b1000)
(.add.mul.y.vf acc vf0 vf3 acc :mask #b1000)
(.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000)
(.sub.w.vf vf3 vf3 vf4 :mask #b1000)
(let ((f0-2 0.0))
(.add.w.vf vf3 vf0 vf3 :mask #b1)
(.mov a0-10 vf3)
(let ((s4-0 (-> v1-23 process)))
(b! (< f0-2 a0-10) cfg-27)
(let ((a1-29 (if (type? s4-0 process-focusable)
s4-0
)
)
)
(if a1-29
(push-process obj (the-as process-focusable a1-29))
)
)
)
)
(label cfg-27)
0
)
)
(+! s5-0 1)
(label cfg-29)
(b! (< s5-0 *actor-list-length*) cfg-21)
)
0
(none)
)
)
(defmethod setup flow-control ((obj flow-control))
(local-vars (sv-32 flow-section) (sv-48 flow-section))
(let* ((s5-0 (-> obj path))
(s4-0 (-> s5-0 curve num-cverts))
(s3-0 (new 'stack-no-clear 'vector))
)
(let ((s2-0 (new 'process 'flow-section-array (+ s4-0 -1))))
(set! (-> obj sections) s2-0)
(set! (-> obj collide-bounds quad) (the-as uint128 0))
(get-point-in-path! s5-0 s3-0 0.0 'interp)
(vector+! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) s3-0)
(let ((s1-0 (+ s4-0 -1)))
(set! sv-32 (the-as flow-section #f))
(dotimes (s0-0 s1-0)
(set! sv-48 (-> s2-0 data s0-0))
(set! (-> sv-48 start quad) (-> s3-0 quad))
(get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp)
(vector+! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) s3-0)
(vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start))
(vector-normalize! (-> sv-48 pull-dir) 1.0)
(set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad))
(set! (-> sv-48 trailing y) 0.0)
(vector-normalize! (-> sv-48 trailing) 1.0)
(set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0)
(set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing)))))
(when sv-32
(vector+!
(the-as vector (-> sv-32 trailing))
(the-as vector (-> sv-32 trailing))
(the-as vector (-> sv-48 trailing))
)
(vector-normalize! (-> sv-32 trailing) 1.0)
(set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing)))))
)
(set! sv-32 sv-48)
sv-32
)
)
)
(let ((s2-1 (-> obj sections data)))
(set! (-> obj leading quad) (-> s2-1 0 pull-dir quad))
(set! (-> obj leading y) 0.0)
(vector-normalize! (-> obj leading) 1.0)
(set! (-> obj leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> obj leading)))))
)
(let ((f0-19 (/ 1.0 (the float s4-0)))
(f30-0 0.0)
)
(vector-float*! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) f0-19)
(dotimes (s2-2 s4-0)
(get-point-in-path! s5-0 s3-0 (the float s2-2) 'interp)
(let ((f0-22 (vector-vector-distance-squared s3-0 (-> obj collide-bounds))))
(if (< f30-0 f0-22)
(set! f30-0 f0-22)
)
)
)
(set! (-> obj collide-bounds r) (+ (sqrtf f30-0) (-> obj belt-radius)))
)
)
0
(none)
)
(defmethod new flow-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 res-lump))
(if (not arg1)
(set! arg1 (-> arg0 entity))
@@ -97,7 +394,7 @@
)
(set! (-> s5-0 speed) (res-lump-float arg1 'speed :default 12288.0))
(set! (-> s5-0 belt-radius) (res-lump-float arg1 'extra-radius :default 16384.0))
((method-of-object s5-0 flow-control-method-10))
(setup s5-0)
)
(else
(go process-drawable-art-error "no flow path")
@@ -108,3 +405,7 @@
s5-0
)
)
+3
View File
@@ -7,3 +7,6 @@
;; DECOMP BEGINS
(kmemopen global "part-tables")
(define *lightning-spec-id-table* (new 'global 'boxed-array lightning-spec 128))
(kmemclose)
+154
View File
@@ -7,3 +7,157 @@
;; DECOMP BEGINS
(define *merc-death-globals* (new 'global 'vector))
(deftype death-info (basic)
((vertex-skip uint16 :offset-assert 4)
(timer uint8 :offset-assert 6)
(overlap uint8 :offset-assert 7)
(effect uint32 :offset-assert 8)
(sound symbol :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(defun birth-func-death-sparks ()
0
(none)
)
(define death-seed
(new 'static 'death-info :vertex-skip #x8 :timer #xe0 :overlap #xff :effect #x48 :sound 'temp-enemy-die)
)
(defun start-seed-effect ((arg0 process-drawable) (arg1 vector) (arg2 cspace))
(let ((v1-0 (-> arg0 draw))
(a1-1 death-seed)
)
(set! (-> v1-0 death-vertex-skip) (-> a1-1 vertex-skip))
(set! (-> v1-0 death-effect) (-> a1-1 effect))
(set! (-> v1-0 death-timer) (+ (-> a1-1 timer) 1))
(set! (-> v1-0 death-timer-org) (-> v1-0 death-timer))
(set! (-> v1-0 death-draw-overlap) (-> a1-1 overlap))
)
(send-event
arg0
'trans-hook
(lambda :behavior process-drawable () (set! (-> self draw death-timer) (the-as uint 200)) (none))
)
0
(none)
)
(defpart 72
:init-specs ((sp-flt spt-scale-x (meters 1))
(sp-flt spt-rot-x 409.6)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 64.0 196.0 1.0)
(sp-rnd-flt spt-g 196.0 64.0 1.0)
(sp-flt spt-b 0.0)
(sp-rnd-flt spt-a 4.0 2.0 1.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-func spt-func 'sparticle-texture-glow-soft)
)
)
(define death-default
(new 'static 'death-info :vertex-skip #xa :timer #x4b :overlap #x4 :effect #x49 :sound 'enemy-fizz)
)
(define death-warp-in
(new 'static 'death-info :vertex-skip #x96 :timer #x4b :effect #x4a :sound 'warpgate-tele)
)
(define death-warp-out
(new 'static 'death-info :vertex-skip #x96 :timer #x96 :effect #x4a :sound 'warpgate-tele)
)
(defun sparticle-texture-glow-soft ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(particle-adgif-callback (-> arg1 adgif) (new 'static 'texture-id :index #xca :page #xc))
(set! (-> arg1 sp-func) (the-as (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) 0))
0
(none)
)
(defpart 74
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-rnd-flt spt-g 32.0 64.0 1.0)
(sp-rnd-flt spt-b 128.0 128.0 1.0)
(sp-flt spt-a 128.0)
(sp-rnd-flt spt-scalevel-x (meters 0.02) (meters 0.02) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-rnd-flt spt-fade-a 0.0 -1.28 1.0)
(sp-rnd-flt spt-friction 0.92 0.02 1.0)
(sp-int spt-timer 500)
(sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-int-plain-rnd spt-next-time 30 19 1)
(sp-launcher-by-id spt-next-launcher 75)
)
)
(defpart 75
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-rnd-flt spt-omega 8.192 6.144 1.0)
(sp-rnd-flt spt-vel-x (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-vel-y (meters -0.026666667) (meters 0.093333334) 1.0)
(sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-scalevel-x (meters -0.001) (meters -0.008) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a 0.0)
(sp-func spt-func 'sparticle-motion-blur)
)
)
(defpart 73
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 150.0 1.0)
(sp-rnd-flt spt-g 32.0 64.0 1.0)
(sp-rnd-flt spt-b 128.0 128.0 1.0)
(sp-flt spt-a 128.0)
(sp-rnd-flt spt-scalevel-x (meters 0.02) (meters 0.02) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-rnd-flt spt-fade-a 0.0 -1.28 1.0)
(sp-rnd-flt spt-friction 0.92 0.02 1.0)
(sp-int spt-timer 500)
(sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-int-plain-rnd spt-next-time 30 19 1)
(sp-launcher-by-id spt-next-launcher 76)
)
)
(defpart 76
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-rnd-flt spt-omega 8.192 6.144 1.0)
(sp-rnd-flt spt-vel-x (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-vel-y (meters -0.026666667) (meters 0.093333334) 1.0)
(sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-scalevel-x (meters -0.001) (meters -0.008) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a 0.0)
(sp-func spt-func 'sparticle-motion-blur)
)
)
(defun merc-death-spawn ((arg0 int) (arg1 vector) (arg2 vector))
(let ((v1-2 (-> *part-id-table* arg0)))
(if (and (nonzero? v1-2) (= (-> v1-2 type) sparticle-launcher))
(sp-launch-particles-death *sp-particle-system-2d* v1-2 arg1)
)
)
0
(none)
)
@@ -7,3 +7,209 @@
;; DECOMP BEGINS
(kmemopen global "actor-hash")
(define *actor-hash* (new 'global 'spatial-hash 4096 256))
(kmemclose)
(deftype actor-cshape-ptr (structure)
((cshape collide-shape :offset-assert 0)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(deftype actor-hash-bucket (structure)
((length int16 :offset-assert 0)
(max-length int16 :offset-assert 2)
(data (inline-array actor-cshape-ptr) :offset-assert 4)
)
:allow-misaligned
:method-count-assert 10
:size-assert #x8
:flag-assert #xa00000008
(:methods
(add-actor-cshape (_type_ collide-shape) none 9)
)
)
(defmethod add-actor-cshape actor-hash-bucket ((obj actor-hash-bucket) (arg0 collide-shape))
(let ((v1-0 (-> obj length)))
(when (< v1-0 (-> obj max-length))
(set! (-> obj data v1-0 cshape) arg0)
(set! (-> obj length) (+ v1-0 1))
)
)
0
(none)
)
(deftype actor-hash-buckets (structure)
((hash spatial-hash :offset-assert 0)
(list engine :offset-assert 4)
(data actor-hash-bucket 4 :inline :offset-assert 8)
(tpos vector :inline :offset-assert 80)
)
:method-count-assert 10
:size-assert #x60
:flag-assert #xa00000060
(:methods
(hash-actors (_type_) none 9)
)
)
(defmethod hash-actors actor-hash-buckets ((obj actor-hash-buckets))
(local-vars (sv-16 hash-object-info) (sv-32 collide-prim-core) (sv-48 collide-shape) (sv-64 hash-object-info))
(set! (-> obj hash) *actor-hash*)
(set! (-> obj list) *collide-hit-by-others-list*)
(clear-objects! (-> obj hash))
(cond
((>= 256 (-> obj list length))
(let ((v1-5 (-> obj list alive-list next0)))
(-> obj list)
(let ((s5-0 (-> v1-5 next0)))
(while (!= v1-5 (-> obj list alive-list-end))
(let* ((s4-0 (the-as collide-shape (-> (the-as connection v1-5) param1)))
(s3-0 (-> obj hash))
(s1-0 (-> s4-0 root-prim prim-core))
(s0-0 s4-0)
(s2-0 (-> s3-0 object-count))
)
(set! s2-0
(cond
((< s2-0 (-> s3-0 max-object-count))
(let ((a0-7 (-> s3-0 sphere-array s2-0)))
(set! sv-16 (-> s3-0 object-array s2-0))
(mem-copy! (the-as pointer a0-7) (the-as pointer s1-0) 16)
)
(set! (-> sv-16 object) s0-0)
(dotimes (v1-12 3)
(set! (-> s3-0 box-min v1-12)
(fmin (-> s3-0 box-min v1-12) (- (-> s1-0 world-sphere data v1-12) (-> s1-0 world-sphere w)))
)
(set! (-> s3-0 box-max v1-12)
(fmax (-> s3-0 box-max v1-12) (+ (-> s1-0 world-sphere data v1-12) (-> s1-0 world-sphere w)))
)
)
(+! (-> s3-0 object-count) 1)
s2-0
)
(else
-1
)
)
)
(set! (-> s4-0 actor-hash-index) s2-0)
)
(set! v1-5 s5-0)
(-> obj list)
(set! s5-0 (-> s5-0 next0))
)
)
)
)
(else
(set! (-> obj tpos quad) (-> (target-pos 0) quad))
(dotimes (v1-21 4)
(set! (-> obj data v1-21 length) 0)
)
(let ((v1-25 (-> obj list alive-list next0)))
(-> obj list)
(let ((s5-2 (-> v1-25 next0)))
(while (!= v1-25 (-> obj list alive-list-end))
(let* ((s4-1 (the-as collide-shape (-> (the-as connection v1-25) param1)))
(f0-4 (vector-vector-distance-squared (-> obj tpos) (-> s4-1 trans)))
(f1-4 102400.0)
)
(cond
((< f0-4 (* f1-4 f1-4))
((method-of-type actor-hash-bucket add-actor-cshape) (the-as actor-hash-bucket (-> obj data)) s4-1)
)
((let ((f1-7 204800.0))
(< f0-4 (* f1-7 f1-7))
)
(add-actor-cshape (-> obj data 1) s4-1)
)
((let ((f1-10 307200.0))
(< f0-4 (* f1-10 f1-10))
)
(add-actor-cshape (-> obj data 2) s4-1)
)
(else
(add-actor-cshape (-> obj data 3) s4-1)
)
)
)
(set! v1-25 s5-2)
(-> obj list)
(set! s5-2 (-> s5-2 next0))
)
)
)
(dotimes (s5-3 4)
(let ((s4-2 (-> obj data s5-3)))
(countdown (s3-1 (-> s4-2 length))
(let ((s2-1 (-> s4-2 data s3-1 cshape))
(s1-1 (-> obj hash))
)
(set! sv-32 (-> s2-1 root-prim prim-core))
(set! sv-48 s2-1)
(let ((s0-1 (-> s1-1 object-count)))
(set! s0-1
(cond
((< s0-1 (-> s1-1 max-object-count))
(let ((a0-40 (-> s1-1 sphere-array s0-1)))
(set! sv-64 (-> s1-1 object-array s0-1))
(mem-copy! (the-as pointer a0-40) (the-as pointer sv-32) 16)
)
(set! (-> sv-64 object) sv-48)
(dotimes (v1-53 3)
(set! (-> s1-1 box-min v1-53)
(fmin (-> s1-1 box-min v1-53) (- (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w)))
)
(set! (-> s1-1 box-max v1-53)
(fmax (-> s1-1 box-max v1-53) (+ (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w)))
)
)
(+! (-> s1-1 object-count) 1)
s0-1
)
(else
-1
)
)
)
(set! (-> s2-1 actor-hash-index) s0-1)
)
)
)
)
)
)
)
(update-from-spheres (-> obj hash))
0
(none)
)
(define *actor-hash-buckets*
(new 'static 'actor-hash-buckets
:data (new 'static 'inline-array actor-hash-bucket 4
(new 'static 'actor-hash-bucket :max-length #x100 :data (new 'static 'inline-array actor-cshape-ptr 256))
(new 'static 'actor-hash-bucket :max-length #x100 :data (new 'static 'inline-array actor-cshape-ptr 256))
(new 'static 'actor-hash-bucket :max-length #x100 :data (new 'static 'inline-array actor-cshape-ptr 256))
(new 'static 'actor-hash-bucket :max-length #x100 :data (new 'static 'inline-array actor-cshape-ptr 256))
)
)
)
(defun update-actor-hash ()
(reset! (-> *perf-stats* data (perf-stat-bucket actor-hash)))
(hash-actors *actor-hash-buckets*)
(read! (-> *perf-stats* data (perf-stat-bucket actor-hash)))
(none)
)
@@ -31,7 +31,7 @@
((work grid-hash-work :offset-assert 4)
(search-box grid-hash-box :inline :offset-assert 8)
(bucket-size int16 :offset-assert 14)
(axis-scale uint32 3 :offset-assert 16)
(axis-scale float 3 :offset-assert 16)
(dimension-array int8 3 :offset-assert 28)
(vertical-cell-count int8 :offset-assert 31)
(bucket-array (pointer grid-hash-word) :offset-assert 32)
@@ -50,22 +50,22 @@
:size-assert #x58
:flag-assert #x1900000058
(:methods
(new (symbol type process int) _type_ 0)
(grid-hash-method-9 (_type_ int (array float) int) none 9)
(grid-hash-method-10 (_type_) none 10)
(grid-hash-method-11 (_type_) none 11)
(grid-hash-method-12 (_type_ vector) grid-hash-box 12)
(grid-hash-method-13 (_type_ vector float) grid-hash-box 13)
(draw-grid (_type_ rgba) none 14)
(new (symbol type int int) _type_ 0)
(update-grid-for-objects-in-box (_type_ int vector vector) none 9)
(clear-bucket-array (_type_) none 10)
(setup-search-box (_type_ int vector vector vector) none 11)
(search-for-point (_type_ vector) (pointer uint8) 12)
(search-for-sphere (_type_ vector float) (pointer uint8) 13)
(draw (_type_ rgba) none 14)
(dump-grid-info (_type_) none 15)
(grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16)
(grid-hash-method-17 (_type_) none 17)
(verify-bits-in-bucket (_type_ grid-hash-box grid-hash-box) none 16)
(box-of-everything (_type_ object grid-hash-box) none 17)
(grid-hash-method-18 (_type_ grid-hash-box int) none 18)
(grid-hash-method-19 (_type_ grid-hash-box int) none 19)
(grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20)
(grid-hash-method-21 (_type_ float int int) none 21)
(grid-hash-method-22 (_type_ grid-hash-box sphere) none 22)
(grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23)
(do-search! (_type_ grid-hash-box (pointer uint8)) none 20)
(set-up-box (_type_ grid-hash-box vector vector) none 21)
(sphere-to-grid-box (_type_ grid-hash-box sphere) none 22)
(line-sphere-to-grid-box (_type_ grid-hash-box vector vector float) none 23)
(update-grid (_type_) none 24)
)
)
@@ -96,15 +96,16 @@
:size-assert #x68
:flag-assert #x2200000068
(:methods
(new (symbol type int int) _type_ 0)
(clear-objects! (_type_) none 25)
(sphere-hash-method-26 (_type_ vector) none 26)
(sphere-hash-method-27 (_type_) none 27)
(sphere-hash-method-28 (_type_) none 28)
(add-a-sphere (_type_ vector) int 26)
(add-a-sphere-with-flag (_type_ vector int) int 27)
(update-from-spheres (_type_) none 28)
(sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29)
(sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30)
(sphere-hash-method-31 (_type_ vector int int) none 31)
(sphere-hash-method-32 (_type_ vector vector float int) symbol 32)
(sphere-hash-method-33 (_type_ object int) none 33)
(sphere-hash-method-33 (_type_ sphere int) none 33)
)
)
@@ -119,20 +120,21 @@
(deftype spatial-hash (sphere-hash)
((object-array (pointer hash-object-info) :offset-assert 104)
(mem-object-array (pointer hash-object-info) :offset-assert 108)
(spr-object-array (pointer hash-object-info) :offset-assert 112)
((object-array (inline-array hash-object-info) :offset-assert 104)
(mem-object-array (inline-array hash-object-info) :offset-assert 108)
(spr-object-array (inline-array hash-object-info) :offset-assert 112)
)
:method-count-assert 41
:size-assert #x74
:flag-assert #x2900000074
(:methods
(spatial-hash-method-34 (_type_ vector hash-object-info) int 34)
(new (symbol type int int) _type_ 0)
(add-an-object (_type_ vector hash-object-info) int 34)
(spatial-hash-method-35 (_type_) none 35)
(fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36)
(spatial-hash-method-37 (_type_) none 37)
(spatial-hash-method-38 (_type_) none 38)
(fill-actor-list-for-vec+r (_type_ vector (pointer collide-shape) int) none 38)
(spatial-hash-method-39 (_type_ object hash-object-info) none 39)
(spatial-hash-method-40 (_type_) none 40)
(validate-objects (_type_) none 40)
)
)
@@ -7,3 +7,902 @@
;; DECOMP BEGINS
(deftype grid-hash-work (basic)
((result-words uint8 32 :offset 16)
(result-bits uint8 32 :offset 16)
(object-id int32 :offset-assert 48)
(temp-box-min vector :inline :offset-assert 64)
(temp-box-max vector :inline :offset-assert 80)
(visit-count int32 :offset-assert 96)
(temp-time uint32 :offset-assert 100)
(queue-object-time uint32 :offset-assert 104)
(make-hash-time uint32 :offset-assert 108)
(search-time uint32 :offset-assert 112)
(add-object-time uint32 :offset-assert 116)
)
:method-count-assert 9
:size-assert #x78
:flag-assert #x900000078
)
(define *grid-hash-work* (new 'static 'grid-hash-work))
(defmethod new grid-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as grid-hash gp-0))
(set! gp-0 0)
(goto cfg-4)
)
(set! (-> (the-as grid-hash gp-0) work) *grid-hash-work*)
(set! (-> (the-as grid-hash gp-0) object-count) 0)
(set! (-> (the-as grid-hash gp-0) bucket-memory-size) arg0)
(set! (-> (the-as grid-hash gp-0) vertical-cell-count) 1)
(set! (-> (the-as grid-hash gp-0) min-cell-size) 16384.0)
(set! (-> (the-as grid-hash gp-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as grid-hash gp-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as grid-hash gp-0) bucket-array) (-> (the-as grid-hash gp-0) mem-bucket-array))
(set! (-> (the-as grid-hash gp-0) debug-draw) #f)
(set! (-> (the-as grid-hash gp-0) use-scratch-ram) #f)
(label cfg-4)
(the-as grid-hash gp-0)
)
)
(defmethod verify-bits-in-bucket grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 grid-hash-box))
(let ((s5-0 0))
0
(let ((v1-1 8)
(a0-1 (-> obj object-count))
(a1-2 (* (-> obj bucket-size) 8))
)
(while (< a0-1 a1-2)
(let ((a3-0 (- a0-1 (* (/ a0-1 v1-1) v1-1))))
(set! s5-0 (logior s5-0 (ash 1 a3-0)))
)
(+! a0-1 1)
)
)
(dotimes (s4-0 (-> obj bucket-count))
(let ((a3-2 (-> obj bucket-array (+ (-> obj bucket-size) -1 (* s4-0 (-> obj bucket-size))))))
(when (logtest? a3-2 s5-0)
(format 0 "bad bits in bucket ~d bucket-word ~8x test-word ~8x~%" s4-0 a3-2 s5-0)
(break!)
0
)
)
)
)
0
(none)
)
(defmethod box-of-everything grid-hash ((obj grid-hash) (arg0 object) (arg1 grid-hash-box))
(dotimes (v1-0 3)
(set! (-> arg1 min v1-0) (-> obj dimension-array v1-0))
(set! (-> arg1 max v1-0) -1)
)
(let* ((v1-3 (-> obj bucket-size))
(a3-4 (* (-> obj dimension-array 0) v1-3))
(t0-3 (* (-> obj dimension-array 2) a3-4))
(t1-0 (-> obj dimension-array 0))
(t2-0 (-> obj dimension-array 2))
(t3-0 (-> obj dimension-array 1))
(a0-2 (&-> (-> obj bucket-array) (/ (the-as int arg0) 8)))
(a1-2 (ash 1 (logand (the-as int arg0) 7)))
)
(dotimes (t4-3 t3-0)
(let ((t5-0 a0-2))
(dotimes (t6-0 t2-0)
(let ((t7-0 t5-0))
(dotimes (t8-0 t1-0)
(when (logtest? (-> t7-0 0) a1-2)
(set! (-> arg1 min 0) (min (-> arg1 min 0) t8-0))
(set! (-> arg1 min 1) (min (-> arg1 min 1) t4-3))
(set! (-> arg1 min 2) (min (-> arg1 min 2) t6-0))
(set! (-> arg1 max 0) (max (-> arg1 max 0) t8-0))
(set! (-> arg1 max 1) (max (-> arg1 max 1) t4-3))
(set! (-> arg1 max 2) (max (-> arg1 max 2) t6-0))
)
(&+! t7-0 v1-3)
)
)
(&+! t5-0 a3-4)
)
)
(&+! a0-2 t0-3)
)
)
0
(none)
)
(defun-debug validate-bucket-bits ((arg0 grid-hash) (arg1 (pointer grid-hash-word)))
(let ((s3-0 (-> arg0 object-count))
(s2-0 (* (-> arg0 bucket-size) 8))
(gp-0 0)
(s5-0 0)
)
(while (< s3-0 s2-0)
(let* ((s1-0 (/ s3-0 8))
(a0-1 (- s3-0 (* s1-0 8)))
)
(when (logtest? (-> arg1 s1-0) (ash 1 a0-1))
(format 0 "bit ~d, " s3-0)
(+! gp-0 1)
(set! s5-0 (the-as int (-> arg1 s1-0)))
)
)
(+! s3-0 1)
)
(when (> gp-0 0)
(format 0 "~%~d bad bits found~%" gp-0)
(format 0 "bad-word ~x~%" s5-0)
(break!)
0
)
)
(the-as symbol 0)
)
;; definition for method 18 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 18 grid-hash)" 18 grid-hash)
;; definition for method 19 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 19 grid-hash)" 19 grid-hash)
;; definition for method 20 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 20 grid-hash)" 20 grid-hash)
(defmethod set-up-box grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector))
(dotimes (v1-0 3)
(set! (-> arg0 min v1-0)
(the int
(fmax
0.0
(fmin
(* (- (-> arg1 data v1-0) (-> obj box-min v1-0)) (-> obj axis-scale v1-0))
(the float (+ (-> obj dimension-array v1-0) -1))
)
)
)
)
(set! (-> arg0 max v1-0)
(the int (fmax 0.0 (fmin
(* (- (-> arg2 data v1-0) (-> obj box-min v1-0)) (-> obj axis-scale v1-0))
(the float (+ (-> obj dimension-array v1-0) -1))
)
)
)
)
)
0
(none)
)
;; definition for method 22 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 22 grid-hash)" 22 grid-hash)
(defmethod line-sphere-to-grid-box grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector) (arg3 float))
(let ((s4-0 (new 'stack-no-clear 'grid-hash-box))
(s5-0 (new 'stack-no-clear 'grid-hash-box))
)
(let ((v1-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(set! (-> v1-0 quad) (-> arg1 quad))
(vector+! s2-0 arg1 arg2)
(set! (-> v1-0 w) arg3)
(set! (-> s2-0 w) arg3)
(sphere-to-grid-box obj s4-0 (the-as sphere v1-0))
(sphere-to-grid-box obj s5-0 (the-as sphere s2-0))
)
(set! (-> arg0 min 0) (min (-> s4-0 min 0) (-> s5-0 min 0)))
(set! (-> arg0 min 1) (min (-> s4-0 min 1) (-> s5-0 min 1)))
(set! (-> arg0 min 2) (min (-> s4-0 min 2) (-> s5-0 min 2)))
(set! (-> arg0 max 0) (max (-> s4-0 max 0) (-> s5-0 max 0)))
(set! (-> arg0 max 1) (max (-> s4-0 max 1) (-> s5-0 max 1)))
(set! (-> arg0 max 2) (max (-> s4-0 max 2) (-> s5-0 max 2)))
)
0
(none)
)
(defmethod clear-bucket-array grid-hash ((obj grid-hash))
(let ((v1-5 (/ (+ (* (* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (-> obj dimension-array 2))
(-> obj bucket-size)
)
15
)
16
)
)
(a0-1 (the-as (pointer uinteger) (-> obj bucket-array)))
)
(while (nonzero? v1-5)
(+! v1-5 -1)
(set! (-> (the-as (pointer uint128) a0-1) 0) (the-as uint128 0))
(set! a0-1 (&-> (the-as (pointer grid-hash-word) a0-1) 16))
)
)
0
(none)
)
(defmethod update-grid grid-hash ((obj grid-hash))
(let ((v1-0 (new 'stack-no-clear 'vector)))
(dotimes (a1-0 3)
(set! (-> v1-0 data a1-0) (fmax (-> obj min-cell-size) (- (-> obj box-max a1-0) (-> obj box-min a1-0))))
)
(b!
(and (> (-> obj object-count) 0) (< 0.0 (-> v1-0 x)) (< 0.0 (-> v1-0 y)) (< 0.0 (-> v1-0 z)))
cfg-23
:delay (empty-form)
)
(set! (-> obj bucket-count) 1)
(set! (-> obj bucket-size) 1)
(dotimes (v1-3 3)
(set! (-> obj box-min v1-3) 0.0)
(set! (-> obj box-max v1-3) 0.0)
(set! (-> obj axis-scale v1-3) 0.0)
(set! (-> obj dimension-array v1-3) 1)
)
(let* ((v1-6 obj)
(a0-6
(/ (+ (* (* (* (-> v1-6 dimension-array 0) (-> v1-6 dimension-array 1)) (-> v1-6 dimension-array 2))
(-> v1-6 bucket-size)
)
15
)
16
)
)
(v1-7 (the-as (pointer uinteger) (-> v1-6 bucket-array)))
)
(while (nonzero? a0-6)
(+! a0-6 -1)
(set! (-> (the-as (pointer uint128) v1-7) 0) (the-as uint128 0))
(set! v1-7 (&-> (the-as (pointer grid-hash-word) v1-7) 16))
)
)
0
(b! #t cfg-41 :delay (nop!))
(label cfg-23)
(let ((a1-18 8))
(set! (-> obj bucket-size) (/ (+ a1-18 -1 (-> obj object-count)) a1-18))
)
(set! (-> obj bucket-count)
(min (* (-> obj object-count) 16) (/ (-> obj bucket-memory-size) (-> obj bucket-size)))
)
(let ((f0-11
(sqrtf
(/ (the float (-> obj bucket-count)) (* (-> v1-0 x) (-> v1-0 z) (the float (-> obj vertical-cell-count))))
)
)
)
(let ((a1-27 (min 126 (+ (-> obj bucket-count) -1))))
(set! (-> obj dimension-array 0) (max 1 (min (the int (* f0-11 (-> v1-0 x))) a1-27)))
(set! (-> obj dimension-array 1) (-> obj vertical-cell-count))
(set! (-> obj dimension-array 2) (max 1 (min (the int (* f0-11 (-> v1-0 z))) a1-27)))
)
(let* ((f1-15 (* f0-11 (-> v1-0 z)))
(f1-17 (- f1-15 (the float (the int f1-15))))
(f0-12 (* f0-11 (-> v1-0 x)))
)
(cond
((< f1-17 (- f0-12 (the float (the int f0-12))))
(if (>= (-> obj bucket-count)
(* (* (+ (-> obj dimension-array 0) 1) (-> obj dimension-array 1)) (-> obj dimension-array 2))
)
(+! (-> obj dimension-array 0) 1)
)
)
(else
(if (>= (-> obj bucket-count)
(* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (+ (-> obj dimension-array 2) 1))
)
(+! (-> obj dimension-array 2) 1)
)
)
)
)
)
(dotimes (a1-40 2)
(let* ((a2-26 (* a1-40 2))
(a3-12 (max 1 (the int (/ (-> v1-0 data a2-26) (-> obj min-cell-size)))))
)
(set! (-> (the-as (pointer uint8) (+ a2-26 (the-as int obj))) 24)
(the-as uint (min (-> (the-as (pointer int8) (+ a2-26 (the-as int obj))) 24) a3-12))
)
)
)
(dotimes (a1-43 3)
(set! (-> obj axis-scale a1-43) (/ (the float (-> obj dimension-array a1-43)) (-> v1-0 data a1-43)))
)
)
(let ((a2-34 (* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (-> obj dimension-array 2))))
(b! (< (-> obj bucket-count) a2-34) cfg-40)
(let* ((v1-16 obj)
(a0-12
(/ (+ (* (* (* (-> v1-16 dimension-array 0) (-> v1-16 dimension-array 1)) (-> v1-16 dimension-array 2))
(-> v1-16 bucket-size)
)
15
)
16
)
)
(v1-17 (the-as (pointer uinteger) (-> v1-16 bucket-array)))
)
(while (nonzero? a0-12)
(+! a0-12 -1)
(set! (-> (the-as (pointer uint128) v1-17) 0) (the-as uint128 0))
(set! v1-17 (&-> (the-as (pointer grid-hash-word) v1-17) 16))
)
)
0
(b! #t cfg-41 :delay (nop!))
(label cfg-40)
(format
*stdcon*
"grid-hash::update-grid: bucket overflow! ~d dim ~d ~d ~d~%"
a2-34
(-> obj dimension-array 0)
(-> obj dimension-array 1)
(-> obj dimension-array 2)
)
)
(label cfg-41)
0
(none)
)
(defmethod update-grid-for-objects-in-box grid-hash ((obj grid-hash) (arg0 int) (arg1 vector) (arg2 vector))
(set! (-> obj object-count) arg0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) (-> arg1 data v1-0))
(set! (-> obj box-max v1-0) (-> arg2 data v1-0))
)
(update-grid obj)
0
(none)
)
(defmethod setup-search-box grid-hash ((obj grid-hash) (arg0 int) (arg1 vector) (arg2 vector) (arg3 vector))
(let ((v1-0 (new 'stack-no-clear 'vector))
(t1-0 (new 'stack-no-clear 'vector))
)
(dotimes (t2-0 3)
(set! (-> v1-0 data t2-0) (fmin (fmin (-> arg1 data t2-0) (-> arg2 data t2-0)) (-> arg3 data t2-0)))
(set! (-> t1-0 data t2-0) (fmax (fmax (-> arg1 data t2-0) (-> arg2 data t2-0)) (-> arg3 data t2-0)))
)
(let ((a2-3 obj)
(a3-1 (-> obj search-box))
)
(dotimes (t0-1 3)
(set! (-> a3-1 min t0-1)
(the int
(fmax
0.0
(fmin
(* (- (-> v1-0 data t0-1) (-> a2-3 box-min t0-1)) (-> a2-3 axis-scale t0-1))
(the float (+ (-> a2-3 dimension-array t0-1) -1))
)
)
)
)
(set! (-> a3-1 max t0-1)
(the int (fmax 0.0 (fmin
(* (- (-> t1-0 data t0-1) (-> a2-3 box-min t0-1)) (-> a2-3 axis-scale t0-1))
(the float (+ (-> a2-3 dimension-array t0-1) -1))
)
)
)
)
)
)
)
0
(set! (-> obj work object-id) arg0)
(let* ((t1-1 obj)
(t2-21 (-> obj search-box))
(a3-2 arg0)
(v1-5 (-> t1-1 bucket-size))
(a0-2 (* (-> t1-1 dimension-array 0) v1-5))
(a1-2 (* (-> t1-1 dimension-array 2) a0-2))
(a2-6 (+ (- 1 (-> t2-21 min 0)) (-> t2-21 max 0)))
(t0-6 (+ (- 1 (-> t2-21 min 2)) (-> t2-21 max 2)))
(t3-22 (+ (- 1 (-> t2-21 min 1)) (-> t2-21 max 1)))
(t1-3 (the-as
object
(+ (+ (* (-> t2-21 min 0) v1-5) (* (-> t2-21 min 1) a1-2) (* (-> t2-21 min 2) a0-2) (/ a3-2 8) 0)
(the-as int (the-as pointer (-> t1-1 bucket-array)))
)
)
)
(a3-4 (ash 1 (logand a3-2 7)))
(t2-28 t3-22)
)
(label cfg-10)
(let ((t3-23 t0-6)
(t4-6 t1-3)
)
(label cfg-11)
(let ((t5-2 a2-6)
(t6-0 t4-6)
)
(label cfg-12)
(nop!)
(let ((t7-0 (-> (the-as (pointer uint8) t6-0))))
(nop!)
(let ((t7-1 (logior t7-0 a3-4)))
(+! t5-2 -1)
(set! (-> (the-as (pointer uint8) t6-0)) t7-1)
)
)
(b! (nonzero? t5-2) cfg-12 :delay (set! t6-0 (&+ (the-as pointer t6-0) v1-5)))
)
(+! t3-23 -1)
(nop!)
(b! (nonzero? t3-23) cfg-11 :delay (set! t4-6 (&+ (the-as pointer t4-6) a0-2)))
)
(+! t2-28 -1)
(nop!)
(b! (nonzero? t2-28) cfg-10 :delay (set! t1-3 (&+ (the-as pointer t1-3) a1-2)))
)
0
0
(none)
)
(defmethod search-for-point grid-hash ((obj grid-hash) (arg0 vector))
(let ((v1-0 obj)
(a0-1 (-> obj search-box))
(a2-0 arg0)
)
(dotimes (a3-0 3)
(set! (-> a0-1 min a3-0)
(the int
(fmax
0.0
(fmin
(* (- (-> a2-0 data a3-0) (-> v1-0 box-min a3-0)) (-> v1-0 axis-scale a3-0))
(the float (+ (-> v1-0 dimension-array a3-0) -1))
)
)
)
)
(set! (-> a0-1 max a3-0)
(the int (fmax 0.0 (fmin
(* (- (-> arg0 data a3-0) (-> v1-0 box-min a3-0)) (-> v1-0 axis-scale a3-0))
(the float (+ (-> v1-0 dimension-array a3-0) -1))
)
)
)
)
)
)
0
(do-search! obj (-> obj search-box) (-> obj work result-words))
(-> obj work result-words)
)
(defmethod search-for-sphere grid-hash ((obj grid-hash) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'sphere)))
(set! (-> v1-0 quad) (-> arg0 quad))
(set! (-> v1-0 r) arg1)
(sphere-to-grid-box obj (-> obj search-box) v1-0)
)
(let ((s5-0 (-> obj work result-words))
(s4-0 0)
)
(label cfg-1)
(do-search! obj (-> obj search-box) s5-0)
(dotimes (v1-5 (-> obj bucket-size))
(set! s4-0 (logior s4-0 (-> s5-0 v1-5)))
)
(when (zero? s4-0)
(when (or (> (-> obj search-box min 0) 0)
(> (-> obj search-box min 2) 0)
(< (-> obj search-box max 0) (+ (-> obj dimension-array 0) -1))
(< (-> obj search-box max 2) (+ (-> obj dimension-array 2) -1))
)
(set! (-> obj search-box min 0) (max 0 (+ (-> obj search-box min 0) -1)))
(set! (-> obj search-box min 2) (max 0 (+ (-> obj search-box min 2) -1)))
(set! (-> obj search-box max 0) (min (+ (-> obj dimension-array 0) -1) (+ (-> obj search-box max 0) 1)))
(set! (-> obj search-box max 2) (min (+ (-> obj dimension-array 2) -1) (+ (-> obj search-box max 2) 1)))
(goto cfg-1)
)
)
)
(-> obj work result-words)
)
(defun-debug draw-grid ((arg0 vector) (arg1 vector) (arg2 (pointer int8)) (arg3 rgba))
(local-vars (sv-64 vector) (sv-68 vector) (sv-72 vector))
(set! sv-64 (new 'stack-no-clear 'vector))
(set! sv-68 (new 'stack-no-clear 'vector))
(set! sv-72 (new 'stack-no-clear 'vector))
(dotimes (v1-3 3)
(set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3))))
)
(set! (-> sv-68 x) (-> arg0 x))
(set! (-> sv-72 x) (-> arg1 x))
(dotimes (s2-0 (+ (-> arg2 1) 1))
(set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y))))
(set! (-> sv-72 y) (-> sv-68 y))
(dotimes (s1-0 (+ (-> arg2 2) 1))
(set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z))))
(set! (-> sv-72 z) (-> sv-68 z))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
(set! (-> sv-68 z) (-> arg0 z))
(set! (-> sv-72 z) (-> arg1 z))
(dotimes (s2-1 (+ (-> arg2 1) 1))
(set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y))))
(set! (-> sv-72 y) (-> sv-68 y))
(dotimes (s1-1 (+ (-> arg2 0) 1))
(set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x))))
(set! (-> sv-72 x) (-> sv-68 x))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
(set! (-> sv-68 y) (-> arg0 y))
(set! (-> sv-72 y) (-> arg1 y))
(dotimes (s3-1 (+ (-> arg2 0) 1))
(set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x))))
(set! (-> sv-72 x) (-> sv-68 x))
(dotimes (s2-2 (+ (-> arg2 2) 1))
(set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z))))
(set! (-> sv-72 z) (-> sv-68 z))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
0
(none)
)
(defmethod draw grid-hash ((obj grid-hash) (arg0 rgba))
"Draws the grid-hash"
(let ((v1-0 (new 'stack-no-clear 'vector))
(t0-0 (new 'stack-no-clear 'vector))
)
(dotimes (a2-0 3)
(set! (-> v1-0 data a2-0) (-> obj box-min a2-0))
(set! (-> t0-0 data a2-0) (-> obj box-max a2-0))
)
(draw-grid v1-0 t0-0 (-> obj dimension-array) arg0)
)
0
(none)
)
(defmethod dump-grid-info grid-hash ((obj grid-hash))
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
(if (-> obj debug-draw)
(draw obj *color-light-blue*)
)
(format
*stdcon*
"bucket memory ~d, bucket-size ~d, word-size ~d bits~%"
(-> obj bucket-memory-size)
(-> obj bucket-size)
8
)
(format
*stdcon*
"bucket dimensions ~d ~d ~d~%"
(-> obj dimension-array 0)
(-> obj dimension-array 1)
(-> obj dimension-array 2)
)
(format *stdcon* "object-count ~d, bucket-count ~d~%" (-> obj object-count) (-> obj bucket-count))
0
(none)
)
(defun-debug draw-sphere-box ((arg0 sphere) (arg1 rgba))
(local-vars (a1-0 none))
(let ((a2-0 (new 'stack-no-clear 'vector))
(a3-0 (new 'stack-no-clear 'vector))
)
(dotimes (v1-0 3)
(set! (-> a2-0 data v1-0) (- (-> arg0 data v1-0) (-> arg0 r)))
(set! (-> a3-0 data v1-0) (+ (-> arg0 data v1-0) (-> arg0 r)))
)
(add-debug-box #t (bucket-id debug-no-zbuf1) a2-0 a3-0 arg1)
)
0
(none)
)
(defun-debug draw-line-sphere ((arg0 vector) (arg1 vector) (arg2 float) (arg3 rgba))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector+! gp-0 arg0 arg1)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) arg0 arg2 arg3)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) gp-0 arg2 arg3)
)
0
(none)
)
(defmethod new sphere-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((s5-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as sphere-hash s5-0))
(set! s5-0 0)
(goto cfg-4)
)
(set! (-> (the-as sphere-hash s5-0) work) *grid-hash-work*)
(set! (-> (the-as sphere-hash s5-0) object-count) 0)
(set! (-> (the-as sphere-hash s5-0) bucket-memory-size) arg0)
(set! (-> (the-as sphere-hash s5-0) vertical-cell-count) 1)
(set! (-> (the-as sphere-hash s5-0) min-cell-size) 16384.0)
(set! (-> (the-as sphere-hash s5-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as sphere-hash s5-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as sphere-hash s5-0) bucket-array) (-> (the-as sphere-hash s5-0) mem-bucket-array))
(set! (-> (the-as sphere-hash s5-0) debug-draw) #f)
(set! (-> (the-as sphere-hash s5-0) use-scratch-ram) #f)
(set! (-> (the-as sphere-hash s5-0) max-object-count) arg1)
(set! (-> (the-as sphere-hash s5-0) mem-sphere-array) (the-as uint (malloc allocation (* arg1 16))))
(set! (-> (the-as sphere-hash s5-0) spr-sphere-array) (the-as uint (+ #x70000000 arg0)))
(set! (-> (the-as sphere-hash s5-0) sphere-array)
(the-as (inline-array sphere) (-> (the-as sphere-hash s5-0) mem-sphere-array))
)
(label cfg-4)
(the-as sphere-hash s5-0)
)
)
(defmethod clear-objects! sphere-hash ((obj sphere-hash))
(set! (-> obj object-count) 0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) 10000000000000000000000000000000000000.0)
(set! (-> obj box-max v1-0) -10000000000000000000000000000000000000.0)
)
(cond
((-> obj use-scratch-ram)
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj spr-sphere-array)))
(set! (-> obj bucket-array) (-> obj spr-bucket-array))
)
(else
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj mem-sphere-array)))
(set! (-> obj bucket-array) (-> obj mem-bucket-array))
)
)
0
(none)
)
;; definition for method 28 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 28 sphere-hash)" 28 sphere-hash)
;; definition for method 26 of type sphere-hash
(defmethod add-a-sphere sphere-hash ((obj sphere-hash) (arg0 vector))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((a0-2 (-> obj sphere-array gp-0)))
(mem-copy! (the-as pointer a0-2) (the-as pointer arg0) 16)
)
(dotimes (v1-2 3)
(set! (-> obj box-min v1-2) (fmin (-> obj box-min v1-2) (- (-> arg0 data v1-2) (-> arg0 w))))
(set! (-> obj box-max v1-2) (fmax (-> obj box-max v1-2) (+ (-> arg0 data v1-2) (-> arg0 w))))
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 27 of type sphere-hash
(defmethod add-a-sphere-with-flag sphere-hash ((obj sphere-hash) (arg0 vector) (arg1 int))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((s2-0 (the-as object (-> obj sphere-array gp-0))))
(mem-copy! (the-as pointer s2-0) (the-as pointer arg0) 16)
(dotimes (v1-2 3)
(set! (-> obj box-min v1-2) (fmin (-> obj box-min v1-2) (- (-> arg0 data v1-2) (-> arg0 w))))
(set! (-> obj box-max v1-2) (fmax (-> obj box-max v1-2) (+ (-> arg0 data v1-2) (-> arg0 w))))
)
(set! (-> (the-as (pointer int8) s2-0) 12) arg1)
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 33 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 33 sphere-hash)" 33 sphere-hash)
;; definition for method 29 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 29 sphere-hash)" 29 sphere-hash)
;; definition for method 30 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 30 sphere-hash)" 30 sphere-hash)
;; definition for method 31 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 31 sphere-hash)" 31 sphere-hash)
;; definition for method 32 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 32 sphere-hash)" 32 sphere-hash)
(defmethod dump-grid-info sphere-hash ((obj sphere-hash))
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
((the (function sphere-hash none) (find-parent-method sphere-hash 15)) obj)
(new 'stack-no-clear 'vector)
(let ((f30-0 6144.0))
(set! (-> obj work temp-box-min quad) (-> (target-pos 0) quad))
(+! (-> obj work temp-box-min y) f30-0)
)
(set! (-> obj work temp-box-max quad) (-> obj work temp-box-min quad))
(set! (-> obj work visit-count) 0)
(set! (-> obj debug-draw) #t)
(set! (-> obj work add-object-time) (the-as uint 0))
0
(none)
)
(defmethod new spatial-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as spatial-hash gp-0))
(set! gp-0 0)
(goto cfg-4)
)
(set! (-> (the-as spatial-hash gp-0) work) *grid-hash-work*)
(set! (-> (the-as spatial-hash gp-0) object-count) 0)
(set! (-> (the-as spatial-hash gp-0) bucket-memory-size) arg0)
(set! (-> (the-as spatial-hash gp-0) vertical-cell-count) 1)
(set! (-> (the-as spatial-hash gp-0) min-cell-size) 16384.0)
(set! (-> (the-as spatial-hash gp-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as spatial-hash gp-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as spatial-hash gp-0) bucket-array) (-> (the-as spatial-hash gp-0) mem-bucket-array))
(set! (-> (the-as spatial-hash gp-0) debug-draw) #f)
(set! (-> (the-as spatial-hash gp-0) use-scratch-ram) #f)
(set! (-> (the-as spatial-hash gp-0) max-object-count) arg1)
(set! (-> (the-as spatial-hash gp-0) mem-sphere-array) (the-as uint (malloc allocation (* arg1 16))))
(set! (-> (the-as spatial-hash gp-0) mem-object-array)
(the-as (inline-array hash-object-info) (malloc allocation (* arg1 16)))
)
(set! (-> (the-as spatial-hash gp-0) spr-sphere-array) (the-as uint (+ #x70000000 arg0)))
(set! (-> (the-as spatial-hash gp-0) spr-object-array)
(the-as (inline-array hash-object-info) (+ #x70000000 (* arg1 16) arg0))
)
(set! (-> (the-as spatial-hash gp-0) sphere-array)
(the-as (inline-array sphere) (-> (the-as spatial-hash gp-0) mem-sphere-array))
)
(set! (-> (the-as spatial-hash gp-0) object-array) (-> (the-as spatial-hash gp-0) mem-object-array))
(label cfg-4)
(the-as spatial-hash gp-0)
)
)
(defmethod clear-objects! spatial-hash ((obj spatial-hash))
(set! (-> obj object-count) 0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) 10000000000000000000000000000000000000.0)
(set! (-> obj box-max v1-0) -10000000000000000000000000000000000000.0)
)
(cond
((-> obj use-scratch-ram)
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj spr-sphere-array)))
(set! (-> obj object-array) (-> obj spr-object-array))
(set! (-> obj bucket-array) (-> obj spr-bucket-array))
)
(else
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj mem-sphere-array)))
(set! (-> obj object-array) (-> obj mem-object-array))
(set! (-> obj bucket-array) (-> obj mem-bucket-array))
)
)
0
(none)
)
;; definition for method 33 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 33 spatial-hash)" 33 spatial-hash)
;; definition for method 34 of type spatial-hash
(defmethod add-an-object spatial-hash ((obj spatial-hash) (arg0 vector) (arg1 hash-object-info))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((a0-2 (-> obj sphere-array gp-0))
(s2-0 (-> obj object-array gp-0))
)
(mem-copy! (the-as pointer a0-2) (the-as pointer arg0) 16)
(set! (-> s2-0 object) (the-as basic arg1))
)
(dotimes (v1-3 3)
(set! (-> obj box-min v1-3) (fmin (-> obj box-min v1-3) (- (-> arg0 data v1-3) (-> arg0 w))))
(set! (-> obj box-max v1-3) (fmax (-> obj box-max v1-3) (+ (-> arg0 data v1-3) (-> arg0 w))))
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 39 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 39 spatial-hash)" 39 spatial-hash)
;; definition for method 36 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 36 spatial-hash)" 36 spatial-hash)
;; definition for method 37 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 37 spatial-hash)" 37 spatial-hash)
;; definition for method 35 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod-mips2c "(method 35 spatial-hash)" 35 spatial-hash)
;; definition for method 38 of type spatial-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod fill-actor-list-for-vec+r spatial-hash ((obj spatial-hash) (arg0 vector) (arg1 (pointer collide-shape)) (arg2 int))
(let ((v1-0 (new 'stack-no-clear 'sphere)))
(set! (-> v1-0 quad) (-> arg0 quad))
(set! (-> v1-0 r) 0.0)
(fill-actor-list-for-sphere obj v1-0 arg1 arg2)
)
(none)
)
;; definition for method 40 of type spatial-hash
;; WARN: Return type mismatch int vs none.
(defmethod validate-objects spatial-hash ((obj spatial-hash))
(dotimes (s5-0 (-> obj object-count))
(let ((a0-2 (-> obj object-array s5-0 object)))
(when (not (valid? a0-2 basic (the-as symbol "") #t 0))
(break!)
0
)
)
)
0
(none)
)
+20 -20
View File
@@ -1505,26 +1505,26 @@
:post target-no-stick-post
)
;; (set! (-> *lightning-spec-id-table* 10) (new 'static 'lightning-spec
;; :name "lightning-darkjak-bomb1"
;; :flags (lightning-spec-flags lsf0 size-from-adjust-dist)
;; :adjust-distance #xa
;; :start-color #x80ffffff
;; :end-color #x80ffffff
;; :fade-to-color #x58f00bf
;; :fade-start-factor 0.2
;; :texture #xc08400
;; :reduction 0.42
;; :num-points 96
;; :box-size 32768.0
;; :merge-factor 0.2
;; :merge-count 2
;; :radius 2048.0
;; :duration 300.0
;; :duration-rand 90.0
;; :sound (static-sound-spec "transform-zap")
;; )
;; )
(set! (-> *lightning-spec-id-table* 10) (new 'static 'lightning-spec
:name "lightning-darkjak-bomb1"
:flags (lightning-spec-flags lsf0 size-from-adjust-dist)
:adjust-distance #xa
:start-color #x80ffffff
:end-color #x80ffffff
:fade-to-color #x58f00bf
:fade-start-factor 0.2
:texture #xc08400
:reduction 0.42
:num-points 96
:box-size 32768.0
:merge-factor 0.2
:merge-count 2
:radius 2048.0
:duration 300.0
:duration-rand 90.0
:sound (static-sound-spec "transform-zap")
)
)
;; WARN: Return type mismatch object vs none.
(defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int))
+49 -50
View File
@@ -399,60 +399,59 @@
v0-1
)
((= v1-0 'water)
(let ((s5-0 (the-as object (-> arg3 param 0))))
(let* ((s4-0 (the-as object (-> arg3 param 1)))
(gp-0 (if (type? (the-as process s4-0) process-focusable)
(the-as uint s4-0)
)
)
(let* ((s5-0 (the-as object (-> arg3 param 0)))
(s4-0 (the-as object (-> arg3 param 1)))
(gp-0 (if (type? (the-as process s4-0) process-focusable)
(the-as uint s4-0)
)
)
)
(when (and (logtest? (-> self flags) (water-flags deadly))
(logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags))
(the-as uint gp-0)
)
(let ((v1-15 (-> self attack-event)))
(case v1-15
((#f)
)
(when (and (logtest? (-> self flags) (water-flags deadly))
(logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags))
(the-as uint gp-0)
)
(let ((v1-15 (-> self attack-event)))
(case v1-15
((#f)
)
(('heat)
(send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame)))
)
(('drown-death 'lava 'dark-eco-pool)
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-10 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-10 from) (process->ppointer self))
(set! (-> a1-10 num-params) 2)
(set! (-> a1-10 message) 'attack-invinc)
(set! (-> a1-10 param 0) (the-as uint #f))
(let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-4 id) (-> self attack-id))
(set! (-> a2-4 mode) v1-15)
(set! (-> a1-10 param 1) (the-as uint a2-4))
)
(send-event-function (the-as process-focusable gp-0) a1-10)
(('heat)
(send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame)))
)
(('drown-death 'lava 'dark-eco-pool)
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-10 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-10 from) (process->ppointer self))
(set! (-> a1-10 num-params) 2)
(set! (-> a1-10 message) 'attack-invinc)
(set! (-> a1-10 param 0) (the-as uint #f))
(let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-4 id) (-> self attack-id))
(set! (-> a2-4 mode) v1-15)
(set! (-> a1-10 param 1) (the-as uint a2-4))
)
(send-event-function (the-as process-focusable gp-0) a1-10)
)
(send-event self 'notify 'attack)
)
)
(else
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) (process->ppointer self))
(set! (-> a1-13 num-params) 2)
(set! (-> a1-13 message) 'attack)
(set! (-> a1-13 param 0) (the-as uint #f))
(let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-6 id) (-> self attack-id))
(set! (-> a2-6 mode) v1-15)
(set! (-> a1-13 param 1) (the-as uint a2-6))
)
(send-event-function (the-as process-tree gp-0) a1-13)
)
(send-event self 'notify 'attack)
)
)
(else
(if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status)))
(let ((a1-13 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-13 from) (process->ppointer self))
(set! (-> a1-13 num-params) 2)
(set! (-> a1-13 message) 'attack)
(set! (-> a1-13 param 0) (the-as uint #f))
(let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id))))
(set! (-> a2-6 id) (-> self attack-id))
(set! (-> a2-6 mode) v1-15)
(set! (-> a1-13 param 1) (the-as uint a2-6))
)
(send-event-function (the-as process-tree gp-0) a1-13)
)
(send-event self 'notify 'attack)
)
)
)
(send-event self 'notify 'attack)
)
)
)
)
@@ -462,7 +461,7 @@
)
(let ((a0-40 (-> self flow)))
(if (nonzero? a0-40)
((method-of-object a0-40 flow-control-method-11))
(push-process a0-40 (the-as process-focusable gp-0))
)
)
)
+470
View File
@@ -0,0 +1,470 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function ray-plane-equation-intersect
(defun ray-plane-equation-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(let* ((f0-1 (vector4-dot arg3 arg1))
(f1-1 (vector-dot arg3 arg2))
(f30-0 (/ (- f0-1) f1-1))
)
(vector-v*float+! arg0 arg1 arg2 f30-0)
f30-0
)
)
;; definition of type flow-section
(deftype flow-section (structure)
((start vector :inline :offset-assert 0)
(trailing plane :inline :offset-assert 16)
(pull-dir vector :inline :offset-assert 32)
(radial-dir vector :inline :offset-assert 48)
)
:method-count-assert 9
:size-assert #x40
:flag-assert #x900000040
)
;; definition for method 3 of type flow-section
(defmethod inspect flow-section ((obj flow-section))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'flow-section)
(format #t "~1Tstart: #<vector @ #x~X>~%" (-> obj start))
(format #t "~1Ttrailing: #<plane @ #x~X>~%" (-> obj trailing))
(format #t "~1Tpull-dir: #<vector @ #x~X>~%" (-> obj pull-dir))
(format #t "~1Tradial-dir: #<vector @ #x~X>~%" (-> obj radial-dir))
(label cfg-4)
obj
)
;; definition of type flow-section-array
(deftype flow-section-array (inline-array-class)
((data flow-section :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
;; definition for method 3 of type flow-section-array
(defmethod inspect flow-section-array ((obj flow-section-array))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tlength: ~D~%" (-> obj length))
(format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length))
(format #t "~1Tdata[0] @ #x~X~%" (-> obj data))
(label cfg-4)
obj
)
;; failed to figure out what this is:
(set! (-> flow-section-array heap-base) (the-as uint 64))
;; definition of type flow-control
(deftype flow-control (basic)
((path path-control :offset-assert 4)
(speed float :offset-assert 8)
(belt-radius float :offset-assert 12)
(sections flow-section-array :offset-assert 16)
(leading plane :inline :offset-assert 32)
(collide-bounds sphere :inline :offset-assert 48)
)
:method-count-assert 13
:size-assert #x40
:flag-assert #xd00000040
(:methods
(new (symbol type process-drawable res-lump) _type_ 0)
(draw-path (_type_) none 9)
(setup (_type_) none 10)
(push-process (_type_ process-focusable) none 11)
(find-and-push-things (_type_) none 12)
)
)
;; definition for method 3 of type flow-control
(defmethod inspect flow-control ((obj flow-control))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tpath: ~A~%" (-> obj path))
(format #t "~1Tspeed: ~f~%" (-> obj speed))
(format #t "~1Tbelt-radius: ~f~%" (-> obj belt-radius))
(format #t "~1Tsections: ~A~%" (-> obj sections))
(format #t "~1Tleading: #<plane @ #x~X>~%" (-> obj leading))
(format #t "~1Tcollide-bounds: #<sphere @ #x~X>~%" (-> obj collide-bounds))
(label cfg-4)
obj
)
;; definition for method 7 of type flow-control
(defmethod relocate flow-control ((obj flow-control) (arg0 int))
(if (nonzero? (-> obj sections))
(&+! (-> obj sections) arg0)
)
(if (nonzero? (-> obj path))
(&+! (-> obj path) arg0)
)
((the-as (function flow-control int flow-control) (find-parent-method flow-control 7)) obj arg0)
)
;; definition for method 9 of type flow-control
;; WARN: Return type mismatch int vs none.
(defmethod draw-path flow-control ((obj flow-control))
(let ((a0-1 (-> obj path)))
(if (nonzero? a0-1)
(debug-draw a0-1)
)
)
0
(none)
)
;; definition for method 11 of type flow-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
;; WARN: Function (method 11 flow-control) has a return type of none, but the expression builder found a return statement.
(defmethod push-process flow-control ((obj flow-control) (arg0 process-focusable))
(with-pp
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(set! (-> s5-0 quad) (-> (get-trans arg0 0) quad))
(set! (-> s5-0 w) 1.0)
(when (>= (vector4-dot s5-0 (the-as vector (-> obj leading))) 0.0)
(let* ((v1-7 (-> obj sections))
(a0-3 (-> v1-7 length))
(a3-0 (the-as object (-> obj leading)))
)
(dotimes (s3-1 a0-3)
(let ((s2-0 (-> v1-7 data s3-1)))
(when (< (vector4-dot s5-0 (the-as vector (-> s2-0 trailing))) 0.0)
(let ((v1-8 (new 'stack-no-clear 'vector)))
(vector-! v1-8 s5-0 (-> s2-0 start))
(when (>= (-> obj belt-radius) (fabs (vector-dot v1-8 (-> s2-0 radial-dir))))
(let* ((f0-7 (vector-dot v1-8 (-> s2-0 pull-dir)))
(f0-9 (- (-> v1-8 y) (* (-> s2-0 pull-dir y) f0-7)))
)
(when (and (>= f0-9 -41984.0) (>= 41779.2 f0-9))
(let* ((a0-11 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector))
(f30-0 (ray-plane-equation-intersect a0-11 s5-0 (-> s2-0 pull-dir) (the-as vector a3-0)))
(f0-10 (ray-plane-equation-intersect s1-0 s5-0 (-> s2-0 pull-dir) (-> s2-0 trailing)))
)
(let ((a0-13 (new 'stack-no-clear 'vector)))
(let ((v1-13 (-> s2-0 start)))
(let ((a1-12 (-> s2-0 pull-dir)))
(let ((a2-6 12288.0))
(.mov vf7 a2-6)
)
(.lvf vf5 (&-> a1-12 quad))
)
(.lvf vf4 (&-> v1-13 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a0-13 quad) vf6)
)
0
(let ((f0-12 (/ f30-0 (- f30-0 f0-10)))
(s2-1 (new 'stack-no-clear 'vector))
)
(displacement-between-two-points-normalized! (-> obj path) s2-1 (+ (the float s3-1) f0-12))
(let ((v1-17 (new 'stack-no-clear 'vector)))
(vector-float*! v1-17 s2-1 (* (-> obj speed) (-> pp clock seconds-per-frame)))
(let ((a1-15 (new 'stack-no-clear 'vector)))
(let ((a0-17 v1-17))
(let ((a2-9 2048.0))
(.mov vf7 a2-9)
)
(.lvf vf5 (&-> a0-17 quad))
)
(.lvf vf4 (&-> s5-0 quad))
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.x.vf acc vf5 vf7 :mask #b111)
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
(.svf (&-> a1-15 quad) vf6)
)
0
(send-event arg0 'push-trans v1-17 3000)
)
)
)
)
)
)
)
(return #f)
)
)
(set! a3-0 (+ (the-as uint (-> v1-7 data 0 trailing)) (* s3-1 64)))
)
)
)
)
0
(none)
)
)
)
;; definition for method 12 of type flow-control
;; WARN: Return type mismatch int vs none.
(defmethod find-and-push-things flow-control ((obj flow-control))
(local-vars (a0-10 float) (a2-5 float) (a2-12 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
)
(init-vf0-vector)
(set! *actor-list-length* 0)
(if #t
(set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* (-> obj collide-bounds) *actor-list* 256))
)
(when #t
(let ((a0-2 (-> *collide-player-list* alive-list next0)))
*collide-player-list*
(let ((v1-11 (-> a0-2 next0)))
(while (!= a0-2 (-> *collide-player-list* alive-list-end))
(let* ((a0-3 (-> (the-as connection a0-2) param1))
(a1-1 (-> (the-as collide-shape a0-3) root-prim))
)
(when (logtest? (-> a1-1 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list))
(let ((a1-2 (-> a1-1 prim-core)))
(let ((a2-4 a1-2)
(a3-1 (-> obj collide-bounds))
)
(.lvf vf2 (&-> a2-4 world-sphere quad))
(.lvf vf3 (&-> a3-1 quad))
)
(.sub.vf vf1 vf3 vf2)
(.mul.vf vf1 vf1 vf1)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.add.z.vf vf1 vf1 vf1 :mask #b1)
(.mov a2-5 vf1)
(let ((f0-0 a2-5)
(f1-1 (+ (-> a1-2 world-sphere w) (-> obj collide-bounds r)))
)
(when (< f0-0 (* f1-1 f1-1))
(when (< *actor-list-length* 256)
(set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3))
(set! *actor-list-length* (+ *actor-list-length* 1))
)
)
)
)
)
)
(set! a0-2 v1-11)
*collide-player-list*
(set! v1-11 (-> v1-11 next0))
)
)
)
)
(b! (not #f) cfg-20 :delay (empty-form))
(let ((a0-5 (-> *collide-hit-by-player-list* alive-list next0)))
*collide-hit-by-player-list*
(let ((v1-18 (-> a0-5 next0)))
(b! #t cfg-18 :delay (nop!))
(label cfg-13)
(let ((a0-6 (-> (the-as connection a0-5) param1)))
(let ((a1-13 (-> (the-as collide-shape a0-6) root-prim)))
(b!
(not (logtest? (-> a1-13 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list)))
cfg-17
:delay (empty-form)
)
(let ((a1-14 (-> a1-13 prim-core)))
(let ((a2-11 a1-14)
(a3-2 (-> obj collide-bounds))
)
(.lvf vf2 (&-> a2-11 world-sphere quad))
(.lvf vf3 (&-> a3-2 quad))
)
(.sub.vf vf1 vf3 vf2)
(.mul.vf vf1 vf1 vf1)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.add.z.vf vf1 vf1 vf1 :mask #b1)
(.mov a2-12 vf1)
(let ((f0-1 a2-12)
(f1-5 (+ (-> a1-14 world-sphere w) (-> obj collide-bounds r)))
)
(b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f)
)
)
)
(b! (>= *actor-list-length* 256) cfg-17 :delay #f)
(set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6))
)
(set! *actor-list-length* (+ *actor-list-length* 1))
(label cfg-17)
(set! a0-5 v1-18)
*collide-hit-by-player-list*
(set! v1-18 (-> v1-18 next0))
)
(label cfg-18)
(b! (!= a0-5 (-> *collide-hit-by-player-list* alive-list-end)) cfg-13 :delay (nop!))
)
(label cfg-20)
(let ((s5-0 0))
(b! #t cfg-29 :delay (nop!))
(label cfg-21)
(let* ((v1-23 (-> *actor-list* s5-0))
(a0-9 (-> v1-23 root-prim))
)
(when (logtest? (-> a0-9 prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list))
(.lvf vf1 (&-> obj collide-bounds quad))
(.lvf vf2 (&-> a0-9 prim-core world-sphere quad))
(.sub.vf vf3 vf1 vf2)
(.add.w.vf vf4 vf1 vf2 :mask #b1000)
(.mul.vf vf3 vf3 vf3 :mask #b111)
(.mul.w.vf vf4 vf4 vf4 :mask #b1000)
(.mul.x.vf acc vf0 vf3 :mask #b1000)
(.add.mul.y.vf acc vf0 vf3 acc :mask #b1000)
(.add.mul.z.vf vf3 vf0 vf3 acc :mask #b1000)
(.sub.w.vf vf3 vf3 vf4 :mask #b1000)
(let ((f0-2 0.0))
(.add.w.vf vf3 vf0 vf3 :mask #b1)
(.mov a0-10 vf3)
(let ((s4-0 (-> v1-23 process)))
(b! (< f0-2 a0-10) cfg-27)
(let ((a1-29 (if (type? s4-0 process-focusable)
s4-0
)
)
)
(if a1-29
(push-process obj (the-as process-focusable a1-29))
)
)
)
)
(label cfg-27)
0
)
)
(+! s5-0 1)
(label cfg-29)
(b! (< s5-0 *actor-list-length*) cfg-21)
)
0
(none)
)
)
;; definition for method 10 of type flow-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod setup flow-control ((obj flow-control))
(local-vars (sv-32 flow-section) (sv-48 flow-section))
(let* ((s5-0 (-> obj path))
(s4-0 (-> s5-0 curve num-cverts))
(s3-0 (new 'stack-no-clear 'vector))
)
(let ((s2-0 (new 'process 'flow-section-array (+ s4-0 -1))))
(set! (-> obj sections) s2-0)
(set! (-> obj collide-bounds quad) (the-as uint128 0))
(get-point-in-path! s5-0 s3-0 0.0 'interp)
(vector+! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) s3-0)
(let ((s1-0 (+ s4-0 -1)))
(set! sv-32 (the-as flow-section #f))
(dotimes (s0-0 s1-0)
(set! sv-48 (-> s2-0 data s0-0))
(set! (-> sv-48 start quad) (-> s3-0 quad))
(get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp)
(vector+! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) s3-0)
(vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start))
(vector-normalize! (-> sv-48 pull-dir) 1.0)
(set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad))
(set! (-> sv-48 trailing y) 0.0)
(vector-normalize! (-> sv-48 trailing) 1.0)
(set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0)
(set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing)))))
(when sv-32
(vector+!
(the-as vector (-> sv-32 trailing))
(the-as vector (-> sv-32 trailing))
(the-as vector (-> sv-48 trailing))
)
(vector-normalize! (-> sv-32 trailing) 1.0)
(set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing)))))
)
(set! sv-32 sv-48)
sv-32
)
)
)
(let ((s2-1 (-> obj sections data)))
(set! (-> obj leading quad) (-> s2-1 0 pull-dir quad))
(set! (-> obj leading y) 0.0)
(vector-normalize! (-> obj leading) 1.0)
(set! (-> obj leading w) (- (vector-dot (the-as vector (-> s2-1 0)) (the-as vector (-> obj leading)))))
)
(let ((f0-19 (/ 1.0 (the float s4-0)))
(f30-0 0.0)
)
(vector-float*! (the-as vector (-> obj collide-bounds)) (the-as vector (-> obj collide-bounds)) f0-19)
(dotimes (s2-2 s4-0)
(get-point-in-path! s5-0 s3-0 (the float s2-2) 'interp)
(let ((f0-22 (vector-vector-distance-squared s3-0 (-> obj collide-bounds))))
(if (< f30-0 f0-22)
(set! f30-0 f0-22)
)
)
)
(set! (-> obj collide-bounds r) (+ (sqrtf f30-0) (-> obj belt-radius)))
)
)
0
(none)
)
;; definition for method 0 of type flow-control
(defmethod new flow-control ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 res-lump))
(if (not arg1)
(set! arg1 (-> arg0 entity))
)
(let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(when (nonzero? s5-0)
(let ((v1-6 (new 'process 'curve-control arg0 'flow -1000000000.0)))
(cond
((nonzero? v1-6)
(set! (-> s5-0 path) v1-6)
(logior! (-> v1-6 flags) (path-control-flag display draw-line draw-point draw-text))
(if (< (-> v1-6 curve num-cverts) 2)
(go process-drawable-art-error "bad flow path")
)
(set! (-> s5-0 speed) (res-lump-float arg1 'speed :default 12288.0))
(set! (-> s5-0 belt-radius) (res-lump-float arg1 'extra-radius :default 16384.0))
(setup s5-0)
)
(else
(go process-drawable-art-error "no flow path")
)
)
)
)
s5-0
)
)
+192
View File
@@ -0,0 +1,192 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *merc-death-globals*, type vector
(define *merc-death-globals* (new 'global 'vector))
;; definition of type death-info
(deftype death-info (basic)
((vertex-skip uint16 :offset-assert 4)
(timer uint8 :offset-assert 6)
(overlap uint8 :offset-assert 7)
(effect uint32 :offset-assert 8)
(sound symbol :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
;; definition for method 3 of type death-info
(defmethod inspect death-info ((obj death-info))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tvertex-skip: ~D~%" (-> obj vertex-skip))
(format #t "~1Ttimer: ~D~%" (-> obj timer))
(format #t "~1Toverlap: ~D~%" (-> obj overlap))
(format #t "~1Teffect: ~D~%" (-> obj effect))
(format #t "~1Tsound: ~A~%" (-> obj sound))
(label cfg-4)
obj
)
;; definition for function birth-func-death-sparks
;; WARN: Return type mismatch int vs none.
(defun birth-func-death-sparks ()
0
(none)
)
;; definition for symbol death-seed, type death-info
(define death-seed
(new 'static 'death-info :vertex-skip #x8 :timer #xe0 :overlap #xff :effect #x48 :sound 'temp-enemy-die)
)
;; definition for function start-seed-effect
;; WARN: Return type mismatch int vs none.
(defun start-seed-effect ((arg0 process-drawable) (arg1 vector) (arg2 cspace))
(let ((v1-0 (-> arg0 draw))
(a1-1 death-seed)
)
(set! (-> v1-0 death-vertex-skip) (-> a1-1 vertex-skip))
(set! (-> v1-0 death-effect) (-> a1-1 effect))
(set! (-> v1-0 death-timer) (+ (-> a1-1 timer) 1))
(set! (-> v1-0 death-timer-org) (-> v1-0 death-timer))
(set! (-> v1-0 death-draw-overlap) (-> a1-1 overlap))
)
(send-event
arg0
'trans-hook
(lambda :behavior process-drawable () (set! (-> self draw death-timer) (the-as uint 200)) (none))
)
0
(none)
)
;; failed to figure out what this is:
(defpart 72
:init-specs ((sp-flt spt-scale-x (meters 1))
(sp-flt spt-rot-x 409.6)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 64.0 196.0 1.0)
(sp-rnd-flt spt-g 196.0 64.0 1.0)
(sp-flt spt-b 0.0)
(sp-rnd-flt spt-a 4.0 2.0 1.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-func spt-func 'sparticle-texture-glow-soft)
)
)
;; definition for symbol death-default, type death-info
(define death-default
(new 'static 'death-info :vertex-skip #xa :timer #x4b :overlap #x4 :effect #x49 :sound 'enemy-fizz)
)
;; definition for symbol death-warp-in, type death-info
(define death-warp-in
(new 'static 'death-info :vertex-skip #x96 :timer #x4b :effect #x4a :sound 'warpgate-tele)
)
;; definition for symbol death-warp-out, type death-info
(define death-warp-out
(new 'static 'death-info :vertex-skip #x96 :timer #x96 :effect #x4a :sound 'warpgate-tele)
)
;; definition for function sparticle-texture-glow-soft
;; WARN: Return type mismatch int vs none.
(defun sparticle-texture-glow-soft ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
(particle-adgif-callback (-> arg1 adgif) (new 'static 'texture-id :index #xca :page #xc))
(set! (-> arg1 sp-func) (the-as (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none) 0))
0
(none)
)
;; failed to figure out what this is:
(defpart 74
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 32.0 32.0 1.0)
(sp-rnd-flt spt-g 32.0 64.0 1.0)
(sp-rnd-flt spt-b 128.0 128.0 1.0)
(sp-flt spt-a 128.0)
(sp-rnd-flt spt-scalevel-x (meters 0.02) (meters 0.02) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-rnd-flt spt-fade-a 0.0 -1.28 1.0)
(sp-rnd-flt spt-friction 0.92 0.02 1.0)
(sp-int spt-timer 500)
(sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-int-plain-rnd spt-next-time 30 19 1)
(sp-launcher-by-id spt-next-launcher 75)
)
)
;; failed to figure out what this is:
(defpart 75
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-rnd-flt spt-omega 8.192 6.144 1.0)
(sp-rnd-flt spt-vel-x (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-vel-y (meters -0.026666667) (meters 0.093333334) 1.0)
(sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-scalevel-x (meters -0.001) (meters -0.008) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a 0.0)
(sp-func spt-func 'sparticle-motion-blur)
)
)
;; failed to figure out what this is:
(defpart 73
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 150.0 1.0)
(sp-rnd-flt spt-g 32.0 64.0 1.0)
(sp-rnd-flt spt-b 128.0 128.0 1.0)
(sp-flt spt-a 128.0)
(sp-rnd-flt spt-scalevel-x (meters 0.02) (meters 0.02) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-rnd-flt spt-fade-a 0.0 -1.28 1.0)
(sp-rnd-flt spt-friction 0.92 0.02 1.0)
(sp-int spt-timer 500)
(sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-3 sp-cpuinfo-flag-12)
(sp-int-plain-rnd spt-next-time 30 19 1)
(sp-launcher-by-id spt-next-launcher 76)
)
)
;; failed to figure out what this is:
(defpart 76
:init-specs ((sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.2) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-a 64.0 32.0 1.0)
(sp-rnd-flt spt-omega 8.192 6.144 1.0)
(sp-rnd-flt spt-vel-x (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-vel-y (meters -0.026666667) (meters 0.093333334) 1.0)
(sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.10666667) 1.0)
(sp-rnd-flt spt-scalevel-x (meters -0.001) (meters -0.008) 1.0)
(sp-copy-from-other spt-scalevel-y -4)
(sp-flt spt-fade-a 0.0)
(sp-func spt-func 'sparticle-motion-blur)
)
)
;; definition for function merc-death-spawn
;; WARN: Return type mismatch int vs none.
(defun merc-death-spawn ((arg0 int) (arg1 vector) (arg2 vector))
(let ((v1-2 (-> *part-id-table* arg0)))
(if (and (nonzero? v1-2) (= (-> v1-2 type) sparticle-launcher))
(sp-launch-particles-death *sp-particle-system-2d* v1-2 arg1)
)
)
0
(none)
)
File diff suppressed because it is too large Load Diff
+26 -24
View File
@@ -38,7 +38,7 @@
((work grid-hash-work :offset-assert 4)
(search-box grid-hash-box :inline :offset-assert 8)
(bucket-size int16 :offset-assert 14)
(axis-scale uint32 3 :offset-assert 16)
(axis-scale float 3 :offset-assert 16)
(dimension-array int8 3 :offset-assert 28)
(vertical-cell-count int8 :offset-assert 31)
(bucket-array (pointer grid-hash-word) :offset-assert 32)
@@ -57,22 +57,22 @@
:size-assert #x58
:flag-assert #x1900000058
(:methods
(new (symbol type process int) _type_ 0)
(grid-hash-method-9 (_type_ int (array float) int) none 9)
(grid-hash-method-10 (_type_) none 10)
(grid-hash-method-11 (_type_) none 11)
(grid-hash-method-12 (_type_ vector) grid-hash-box 12)
(grid-hash-method-13 (_type_ vector float) grid-hash-box 13)
(draw-grid (_type_ rgba) none 14)
(new (symbol type int int) _type_ 0)
(update-grid-for-objects-in-box (_type_ int vector vector) none 9)
(clear-bucket-array (_type_) none 10)
(setup-search-box (_type_ int vector vector vector) none 11)
(search-for-point (_type_ vector) (pointer uint8) 12)
(search-for-sphere (_type_ vector float) (pointer uint8) 13)
(draw (_type_ rgba) none 14)
(dump-grid-info (_type_) none 15)
(grid-hash-method-16 (_type_ grid-hash-box grid-hash-box) none 16)
(grid-hash-method-17 (_type_) none 17)
(verify-bits-in-bucket (_type_ grid-hash-box grid-hash-box) none 16)
(box-of-everything (_type_ object grid-hash-box) none 17)
(grid-hash-method-18 (_type_ grid-hash-box int) none 18)
(grid-hash-method-19 (_type_ grid-hash-box int) none 19)
(grid-hash-method-20 (_type_ grid-hash-box (pointer uint8)) none 20)
(grid-hash-method-21 (_type_ float int int) none 21)
(grid-hash-method-22 (_type_ grid-hash-box sphere) none 22)
(grid-hash-method-23 (_type_ grid-hash-box vector vector float) none 23)
(do-search! (_type_ grid-hash-box (pointer uint8)) none 20)
(set-up-box (_type_ grid-hash-box vector vector) none 21)
(sphere-to-grid-box (_type_ grid-hash-box sphere) none 22)
(line-sphere-to-grid-box (_type_ grid-hash-box vector vector float) none 23)
(update-grid (_type_) none 24)
)
)
@@ -148,15 +148,16 @@
:size-assert #x68
:flag-assert #x2200000068
(:methods
(new (symbol type int int) _type_ 0)
(clear-objects! (_type_) none 25)
(sphere-hash-method-26 (_type_ vector) none 26)
(sphere-hash-method-27 (_type_) none 27)
(sphere-hash-method-28 (_type_) none 28)
(add-a-sphere (_type_ vector) int 26)
(add-a-sphere-with-flag (_type_ vector int) int 27)
(update-from-spheres (_type_) none 28)
(sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29)
(sphere-hash-method-30 (_type_ find-nav-sphere-ids-params) none 30)
(sphere-hash-method-31 (_type_ vector int int) none 31)
(sphere-hash-method-32 (_type_ vector vector float int) symbol 32)
(sphere-hash-method-33 (_type_ object int) none 33)
(sphere-hash-method-33 (_type_ sphere int) none 33)
)
)
@@ -216,21 +217,22 @@
;; definition of type spatial-hash
(deftype spatial-hash (sphere-hash)
((object-array (pointer hash-object-info) :offset-assert 104)
(mem-object-array (pointer hash-object-info) :offset-assert 108)
(spr-object-array (pointer hash-object-info) :offset-assert 112)
((object-array (inline-array hash-object-info) :offset-assert 104)
(mem-object-array (inline-array hash-object-info) :offset-assert 108)
(spr-object-array (inline-array hash-object-info) :offset-assert 112)
)
:method-count-assert 41
:size-assert #x74
:flag-assert #x2900000074
(:methods
(spatial-hash-method-34 (_type_ vector hash-object-info) int 34)
(new (symbol type int int) _type_ 0)
(add-an-object (_type_ vector hash-object-info) int 34)
(spatial-hash-method-35 (_type_) none 35)
(fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36)
(spatial-hash-method-37 (_type_) none 37)
(spatial-hash-method-38 (_type_) none 38)
(fill-actor-list-for-vec+r (_type_ vector (pointer collide-shape) int) none 38)
(spatial-hash-method-39 (_type_ object hash-object-info) none 39)
(spatial-hash-method-40 (_type_) none 40)
(validate-objects (_type_) none 40)
)
)
+951
View File
@@ -0,0 +1,951 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type grid-hash-work
(deftype grid-hash-work (basic)
((result-words uint8 32 :offset 16)
(result-bits uint8 32 :offset 16)
(object-id int32 :offset-assert 48)
(temp-box-min vector :inline :offset-assert 64)
(temp-box-max vector :inline :offset-assert 80)
(visit-count int32 :offset-assert 96)
(temp-time uint32 :offset-assert 100)
(queue-object-time uint32 :offset-assert 104)
(make-hash-time uint32 :offset-assert 108)
(search-time uint32 :offset-assert 112)
(add-object-time uint32 :offset-assert 116)
)
:method-count-assert 9
:size-assert #x78
:flag-assert #x900000078
)
;; definition for method 3 of type grid-hash-work
(defmethod inspect grid-hash-work ((obj grid-hash-work))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tresult-words[32] @ #x~X~%" (-> obj result-words))
(format #t "~1Tresult-bits[32] @ #x~X~%" (-> obj result-words))
(format #t "~1Tobject-id: ~D~%" (-> obj object-id))
(format #t "~1Ttemp-box-min: #<vector @ #x~X>~%" (-> obj temp-box-min))
(format #t "~1Ttemp-box-max: #<vector @ #x~X>~%" (-> obj temp-box-max))
(format #t "~1Tvisit-count: ~D~%" (-> obj visit-count))
(format #t "~1Ttemp-time: ~D~%" (-> obj temp-time))
(format #t "~1Tqueue-object-time: ~D~%" (-> obj queue-object-time))
(format #t "~1Tmake-hash-time: ~D~%" (-> obj make-hash-time))
(format #t "~1Tsearch-time: ~D~%" (-> obj search-time))
(format #t "~1Tadd-object-time: ~D~%" (-> obj add-object-time))
(label cfg-4)
obj
)
;; definition for symbol *grid-hash-work*, type grid-hash-work
(define *grid-hash-work* (new 'static 'grid-hash-work))
;; definition for method 0 of type grid-hash
;; WARN: Return type mismatch object vs grid-hash.
(defmethod new grid-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as grid-hash gp-0))
(set! gp-0 0)
(goto cfg-4)
)
(set! (-> (the-as grid-hash gp-0) work) *grid-hash-work*)
(set! (-> (the-as grid-hash gp-0) object-count) 0)
(set! (-> (the-as grid-hash gp-0) bucket-memory-size) arg0)
(set! (-> (the-as grid-hash gp-0) vertical-cell-count) 1)
(set! (-> (the-as grid-hash gp-0) min-cell-size) 16384.0)
(set! (-> (the-as grid-hash gp-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as grid-hash gp-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as grid-hash gp-0) bucket-array) (-> (the-as grid-hash gp-0) mem-bucket-array))
(set! (-> (the-as grid-hash gp-0) debug-draw) #f)
(set! (-> (the-as grid-hash gp-0) use-scratch-ram) #f)
(label cfg-4)
(the-as grid-hash gp-0)
)
)
;; definition for method 16 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod verify-bits-in-bucket grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 grid-hash-box))
(let ((s5-0 0))
0
(let ((v1-1 8)
(a0-1 (-> obj object-count))
(a1-2 (* (-> obj bucket-size) 8))
)
(while (< a0-1 a1-2)
(let ((a3-0 (- a0-1 (* (/ a0-1 v1-1) v1-1))))
(set! s5-0 (logior s5-0 (ash 1 a3-0)))
)
(+! a0-1 1)
)
)
(dotimes (s4-0 (-> obj bucket-count))
(let ((a3-2 (-> obj bucket-array (+ (-> obj bucket-size) -1 (* s4-0 (-> obj bucket-size))))))
(when (logtest? a3-2 s5-0)
(format 0 "bad bits in bucket ~d bucket-word ~8x test-word ~8x~%" s4-0 a3-2 s5-0)
(break!)
0
)
)
)
)
0
(none)
)
;; definition for method 17 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod box-of-everything grid-hash ((obj grid-hash) (arg0 object) (arg1 grid-hash-box))
(dotimes (v1-0 3)
(set! (-> arg1 min v1-0) (-> obj dimension-array v1-0))
(set! (-> arg1 max v1-0) -1)
)
(let* ((v1-3 (-> obj bucket-size))
(a3-4 (* (-> obj dimension-array 0) v1-3))
(t0-3 (* (-> obj dimension-array 2) a3-4))
(t1-0 (-> obj dimension-array 0))
(t2-0 (-> obj dimension-array 2))
(t3-0 (-> obj dimension-array 1))
(a0-2 (&-> (-> obj bucket-array) (/ (the-as int arg0) 8)))
(a1-2 (ash 1 (logand (the-as int arg0) 7)))
)
(dotimes (t4-3 t3-0)
(let ((t5-0 a0-2))
(dotimes (t6-0 t2-0)
(let ((t7-0 t5-0))
(dotimes (t8-0 t1-0)
(when (logtest? (-> t7-0 0) a1-2)
(set! (-> arg1 min 0) (min (-> arg1 min 0) t8-0))
(set! (-> arg1 min 1) (min (-> arg1 min 1) t4-3))
(set! (-> arg1 min 2) (min (-> arg1 min 2) t6-0))
(set! (-> arg1 max 0) (max (-> arg1 max 0) t8-0))
(set! (-> arg1 max 1) (max (-> arg1 max 1) t4-3))
(set! (-> arg1 max 2) (max (-> arg1 max 2) t6-0))
)
(&+! t7-0 v1-3)
)
)
(&+! t5-0 a3-4)
)
)
(&+! a0-2 t0-3)
)
)
0
(none)
)
;; definition (debug) for function validate-bucket-bits
;; WARN: Return type mismatch int vs symbol.
(defun-debug validate-bucket-bits ((arg0 grid-hash) (arg1 (pointer grid-hash-word)))
(let ((s3-0 (-> arg0 object-count))
(s2-0 (* (-> arg0 bucket-size) 8))
(gp-0 0)
(s5-0 0)
)
(while (< s3-0 s2-0)
(let* ((s1-0 (/ s3-0 8))
(a0-1 (- s3-0 (* s1-0 8)))
)
(when (logtest? (-> arg1 s1-0) (ash 1 a0-1))
(format 0 "bit ~d, " s3-0)
(+! gp-0 1)
(set! s5-0 (the-as int (-> arg1 s1-0)))
)
)
(+! s3-0 1)
)
(when (> gp-0 0)
(format 0 "~%~d bad bits found~%" gp-0)
(format 0 "bad-word ~x~%" s5-0)
(break!)
0
)
)
(the-as symbol 0)
)
;; definition for method 18 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 19 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 20 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 21 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod set-up-box grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector))
(dotimes (v1-0 3)
(set! (-> arg0 min v1-0)
(the int
(fmax
0.0
(fmin
(* (- (-> arg1 data v1-0) (-> obj box-min v1-0)) (-> obj axis-scale v1-0))
(the float (+ (-> obj dimension-array v1-0) -1))
)
)
)
)
(set! (-> arg0 max v1-0)
(the int (fmax 0.0 (fmin
(* (- (-> arg2 data v1-0) (-> obj box-min v1-0)) (-> obj axis-scale v1-0))
(the float (+ (-> obj dimension-array v1-0) -1))
)
)
)
)
)
0
(none)
)
;; definition for method 22 of type grid-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 23 of type grid-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod line-sphere-to-grid-box grid-hash ((obj grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector) (arg3 float))
(let ((s4-0 (new 'stack-no-clear 'grid-hash-box))
(s5-0 (new 'stack-no-clear 'grid-hash-box))
)
(let ((v1-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(set! (-> v1-0 quad) (-> arg1 quad))
(vector+! s2-0 arg1 arg2)
(set! (-> v1-0 w) arg3)
(set! (-> s2-0 w) arg3)
(sphere-to-grid-box obj s4-0 (the-as sphere v1-0))
(sphere-to-grid-box obj s5-0 (the-as sphere s2-0))
)
(set! (-> arg0 min 0) (min (-> s4-0 min 0) (-> s5-0 min 0)))
(set! (-> arg0 min 1) (min (-> s4-0 min 1) (-> s5-0 min 1)))
(set! (-> arg0 min 2) (min (-> s4-0 min 2) (-> s5-0 min 2)))
(set! (-> arg0 max 0) (max (-> s4-0 max 0) (-> s5-0 max 0)))
(set! (-> arg0 max 1) (max (-> s4-0 max 1) (-> s5-0 max 1)))
(set! (-> arg0 max 2) (max (-> s4-0 max 2) (-> s5-0 max 2)))
)
0
(none)
)
;; definition for method 10 of type grid-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod clear-bucket-array grid-hash ((obj grid-hash))
(let ((v1-5 (/ (+ (* (* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (-> obj dimension-array 2))
(-> obj bucket-size)
)
15
)
16
)
)
(a0-1 (the-as (pointer uinteger) (-> obj bucket-array)))
)
(while (nonzero? v1-5)
(+! v1-5 -1)
(set! (-> (the-as (pointer uint128) a0-1) 0) (the-as uint128 0))
(set! a0-1 (&-> (the-as (pointer grid-hash-word) a0-1) 16))
)
)
0
(none)
)
;; definition for method 24 of type grid-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod update-grid grid-hash ((obj grid-hash))
(let ((v1-0 (new 'stack-no-clear 'vector)))
(dotimes (a1-0 3)
(set! (-> v1-0 data a1-0) (fmax (-> obj min-cell-size) (- (-> obj box-max a1-0) (-> obj box-min a1-0))))
)
(b!
(and (> (-> obj object-count) 0) (< 0.0 (-> v1-0 x)) (< 0.0 (-> v1-0 y)) (< 0.0 (-> v1-0 z)))
cfg-23
:delay (empty-form)
)
(set! (-> obj bucket-count) 1)
(set! (-> obj bucket-size) 1)
(dotimes (v1-3 3)
(set! (-> obj box-min v1-3) 0.0)
(set! (-> obj box-max v1-3) 0.0)
(set! (-> obj axis-scale v1-3) 0.0)
(set! (-> obj dimension-array v1-3) 1)
)
(let* ((v1-6 obj)
(a0-6
(/ (+ (* (* (* (-> v1-6 dimension-array 0) (-> v1-6 dimension-array 1)) (-> v1-6 dimension-array 2))
(-> v1-6 bucket-size)
)
15
)
16
)
)
(v1-7 (the-as (pointer uinteger) (-> v1-6 bucket-array)))
)
(while (nonzero? a0-6)
(+! a0-6 -1)
(set! (-> (the-as (pointer uint128) v1-7) 0) (the-as uint128 0))
(set! v1-7 (&-> (the-as (pointer grid-hash-word) v1-7) 16))
)
)
0
(b! #t cfg-41 :delay (nop!))
(label cfg-23)
(let ((a1-18 8))
(set! (-> obj bucket-size) (/ (+ a1-18 -1 (-> obj object-count)) a1-18))
)
(set! (-> obj bucket-count)
(min (* (-> obj object-count) 16) (/ (-> obj bucket-memory-size) (-> obj bucket-size)))
)
(let ((f0-11
(sqrtf
(/ (the float (-> obj bucket-count)) (* (-> v1-0 x) (-> v1-0 z) (the float (-> obj vertical-cell-count))))
)
)
)
(let ((a1-27 (min 126 (+ (-> obj bucket-count) -1))))
(set! (-> obj dimension-array 0) (max 1 (min (the int (* f0-11 (-> v1-0 x))) a1-27)))
(set! (-> obj dimension-array 1) (-> obj vertical-cell-count))
(set! (-> obj dimension-array 2) (max 1 (min (the int (* f0-11 (-> v1-0 z))) a1-27)))
)
(let* ((f1-15 (* f0-11 (-> v1-0 z)))
(f1-17 (- f1-15 (the float (the int f1-15))))
(f0-12 (* f0-11 (-> v1-0 x)))
)
(cond
((< f1-17 (- f0-12 (the float (the int f0-12))))
(if (>= (-> obj bucket-count)
(* (* (+ (-> obj dimension-array 0) 1) (-> obj dimension-array 1)) (-> obj dimension-array 2))
)
(+! (-> obj dimension-array 0) 1)
)
)
(else
(if (>= (-> obj bucket-count)
(* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (+ (-> obj dimension-array 2) 1))
)
(+! (-> obj dimension-array 2) 1)
)
)
)
)
)
(dotimes (a1-40 2)
(let* ((a2-26 (* a1-40 2))
(a3-12 (max 1 (the int (/ (-> v1-0 data a2-26) (-> obj min-cell-size)))))
)
(set! (-> (the-as (pointer uint8) (+ a2-26 (the-as int obj))) 24)
(the-as uint (min (-> (the-as (pointer int8) (+ a2-26 (the-as int obj))) 24) a3-12))
)
)
)
(dotimes (a1-43 3)
(set! (-> obj axis-scale a1-43) (/ (the float (-> obj dimension-array a1-43)) (-> v1-0 data a1-43)))
)
)
(let ((a2-34 (* (* (-> obj dimension-array 0) (-> obj dimension-array 1)) (-> obj dimension-array 2))))
(b! (< (-> obj bucket-count) a2-34) cfg-40)
(let* ((v1-16 obj)
(a0-12
(/ (+ (* (* (* (-> v1-16 dimension-array 0) (-> v1-16 dimension-array 1)) (-> v1-16 dimension-array 2))
(-> v1-16 bucket-size)
)
15
)
16
)
)
(v1-17 (the-as (pointer uinteger) (-> v1-16 bucket-array)))
)
(while (nonzero? a0-12)
(+! a0-12 -1)
(set! (-> (the-as (pointer uint128) v1-17) 0) (the-as uint128 0))
(set! v1-17 (&-> (the-as (pointer grid-hash-word) v1-17) 16))
)
)
0
(b! #t cfg-41 :delay (nop!))
(label cfg-40)
(format
*stdcon*
"grid-hash::update-grid: bucket overflow! ~d dim ~d ~d ~d~%"
a2-34
(-> obj dimension-array 0)
(-> obj dimension-array 1)
(-> obj dimension-array 2)
)
)
(label cfg-41)
0
(none)
)
;; definition for method 9 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod update-grid-for-objects-in-box grid-hash ((obj grid-hash) (arg0 int) (arg1 vector) (arg2 vector))
(set! (-> obj object-count) arg0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) (-> arg1 data v1-0))
(set! (-> obj box-max v1-0) (-> arg2 data v1-0))
)
(update-grid obj)
0
(none)
)
;; definition for method 11 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod setup-search-box grid-hash ((obj grid-hash) (arg0 int) (arg1 vector) (arg2 vector) (arg3 vector))
(let ((v1-0 (new 'stack-no-clear 'vector))
(t1-0 (new 'stack-no-clear 'vector))
)
(dotimes (t2-0 3)
(set! (-> v1-0 data t2-0) (fmin (fmin (-> arg1 data t2-0) (-> arg2 data t2-0)) (-> arg3 data t2-0)))
(set! (-> t1-0 data t2-0) (fmax (fmax (-> arg1 data t2-0) (-> arg2 data t2-0)) (-> arg3 data t2-0)))
)
(let ((a2-3 obj)
(a3-1 (-> obj search-box))
)
(dotimes (t0-1 3)
(set! (-> a3-1 min t0-1)
(the int
(fmax
0.0
(fmin
(* (- (-> v1-0 data t0-1) (-> a2-3 box-min t0-1)) (-> a2-3 axis-scale t0-1))
(the float (+ (-> a2-3 dimension-array t0-1) -1))
)
)
)
)
(set! (-> a3-1 max t0-1)
(the int (fmax 0.0 (fmin
(* (- (-> t1-0 data t0-1) (-> a2-3 box-min t0-1)) (-> a2-3 axis-scale t0-1))
(the float (+ (-> a2-3 dimension-array t0-1) -1))
)
)
)
)
)
)
)
0
(set! (-> obj work object-id) arg0)
(let* ((t1-1 obj)
(t2-21 (-> obj search-box))
(a3-2 arg0)
(v1-5 (-> t1-1 bucket-size))
(a0-2 (* (-> t1-1 dimension-array 0) v1-5))
(a1-2 (* (-> t1-1 dimension-array 2) a0-2))
(a2-6 (+ (- 1 (-> t2-21 min 0)) (-> t2-21 max 0)))
(t0-6 (+ (- 1 (-> t2-21 min 2)) (-> t2-21 max 2)))
(t3-22 (+ (- 1 (-> t2-21 min 1)) (-> t2-21 max 1)))
(t1-3 (the-as
object
(+ (+ (* (-> t2-21 min 0) v1-5) (* (-> t2-21 min 1) a1-2) (* (-> t2-21 min 2) a0-2) (/ a3-2 8) 0)
(the-as int (the-as pointer (-> t1-1 bucket-array)))
)
)
)
(a3-4 (ash 1 (logand a3-2 7)))
(t2-28 t3-22)
)
(label cfg-10)
(let ((t3-23 t0-6)
(t4-6 t1-3)
)
(label cfg-11)
(let ((t5-2 a2-6)
(t6-0 t4-6)
)
(label cfg-12)
(nop!)
(let ((t7-0 (-> (the-as (pointer uint8) t6-0))))
(nop!)
(let ((t7-1 (logior t7-0 a3-4)))
(+! t5-2 -1)
(set! (-> (the-as (pointer uint8) t6-0)) t7-1)
)
)
(b! (nonzero? t5-2) cfg-12 :delay (set! t6-0 (+ (the-as pointer t6-0) v1-5)))
)
(+! t3-23 -1)
(nop!)
(b! (nonzero? t3-23) cfg-11 :delay (set! t4-6 (+ (the-as pointer t4-6) a0-2)))
)
(+! t2-28 -1)
(nop!)
(b! (nonzero? t2-28) cfg-10 :delay (set! t1-3 (+ (the-as pointer t1-3) a1-2)))
)
0
0
(none)
)
;; definition for method 12 of type grid-hash
(defmethod search-for-point grid-hash ((obj grid-hash) (arg0 vector))
(let ((v1-0 obj)
(a0-1 (-> obj search-box))
(a2-0 arg0)
)
(dotimes (a3-0 3)
(set! (-> a0-1 min a3-0)
(the int
(fmax
0.0
(fmin
(* (- (-> a2-0 data a3-0) (-> v1-0 box-min a3-0)) (-> v1-0 axis-scale a3-0))
(the float (+ (-> v1-0 dimension-array a3-0) -1))
)
)
)
)
(set! (-> a0-1 max a3-0)
(the int (fmax 0.0 (fmin
(* (- (-> arg0 data a3-0) (-> v1-0 box-min a3-0)) (-> v1-0 axis-scale a3-0))
(the float (+ (-> v1-0 dimension-array a3-0) -1))
)
)
)
)
)
)
0
(do-search! obj (-> obj search-box) (-> obj work result-words))
(-> obj work result-words)
)
;; definition for method 13 of type grid-hash
;; WARN: Found some very strange gotos. Check result carefully, this is not well tested.
;; INFO: Used lq/sq
(defmethod search-for-sphere grid-hash ((obj grid-hash) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'sphere)))
(set! (-> v1-0 quad) (-> arg0 quad))
(set! (-> v1-0 r) arg1)
(sphere-to-grid-box obj (-> obj search-box) v1-0)
)
(let ((s5-0 (-> obj work result-words))
(s4-0 0)
)
(label cfg-1)
(do-search! obj (-> obj search-box) s5-0)
(dotimes (v1-5 (-> obj bucket-size))
(set! s4-0 (logior s4-0 (-> s5-0 v1-5)))
)
(when (zero? s4-0)
(when (or (> (-> obj search-box min 0) 0)
(> (-> obj search-box min 2) 0)
(< (-> obj search-box max 0) (+ (-> obj dimension-array 0) -1))
(< (-> obj search-box max 2) (+ (-> obj dimension-array 2) -1))
)
(set! (-> obj search-box min 0) (max 0 (+ (-> obj search-box min 0) -1)))
(set! (-> obj search-box min 2) (max 0 (+ (-> obj search-box min 2) -1)))
(set! (-> obj search-box max 0) (min (+ (-> obj dimension-array 0) -1) (+ (-> obj search-box max 0) 1)))
(set! (-> obj search-box max 2) (min (+ (-> obj dimension-array 2) -1) (+ (-> obj search-box max 2) 1)))
(goto cfg-1)
)
)
)
(-> obj work result-words)
)
;; definition (debug) for function draw-grid
;; WARN: Return type mismatch int vs none.
(defun-debug draw-grid ((arg0 vector) (arg1 vector) (arg2 (pointer int8)) (arg3 rgba))
(local-vars (sv-64 vector) (sv-68 vector) (sv-72 vector))
(set! sv-64 (new 'stack-no-clear 'vector))
(set! sv-68 (new 'stack-no-clear 'vector))
(set! sv-72 (new 'stack-no-clear 'vector))
(dotimes (v1-3 3)
(set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3))))
)
(set! (-> sv-68 x) (-> arg0 x))
(set! (-> sv-72 x) (-> arg1 x))
(dotimes (s2-0 (+ (-> arg2 1) 1))
(set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y))))
(set! (-> sv-72 y) (-> sv-68 y))
(dotimes (s1-0 (+ (-> arg2 2) 1))
(set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z))))
(set! (-> sv-72 z) (-> sv-68 z))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
(set! (-> sv-68 z) (-> arg0 z))
(set! (-> sv-72 z) (-> arg1 z))
(dotimes (s2-1 (+ (-> arg2 1) 1))
(set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y))))
(set! (-> sv-72 y) (-> sv-68 y))
(dotimes (s1-1 (+ (-> arg2 0) 1))
(set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x))))
(set! (-> sv-72 x) (-> sv-68 x))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
(set! (-> sv-68 y) (-> arg0 y))
(set! (-> sv-72 y) (-> arg1 y))
(dotimes (s3-1 (+ (-> arg2 0) 1))
(set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x))))
(set! (-> sv-72 x) (-> sv-68 x))
(dotimes (s2-2 (+ (-> arg2 2) 1))
(set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z))))
(set! (-> sv-72 z) (-> sv-68 z))
(add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1))
)
)
0
(none)
)
;; definition for method 14 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod draw grid-hash ((obj grid-hash) (arg0 rgba))
"Draws the grid-hash"
(let ((v1-0 (new 'stack-no-clear 'vector))
(t0-0 (new 'stack-no-clear 'vector))
)
(dotimes (a2-0 3)
(set! (-> v1-0 data a2-0) (-> obj box-min a2-0))
(set! (-> t0-0 data a2-0) (-> obj box-max a2-0))
)
(draw-grid v1-0 t0-0 (-> obj dimension-array) arg0)
)
0
(none)
)
;; definition for method 15 of type grid-hash
;; WARN: Return type mismatch int vs none.
(defmethod dump-grid-info grid-hash ((obj grid-hash))
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
(if (-> obj debug-draw)
(draw obj *color-light-blue*)
)
(format
*stdcon*
"bucket memory ~d, bucket-size ~d, word-size ~d bits~%"
(-> obj bucket-memory-size)
(-> obj bucket-size)
8
)
(format
*stdcon*
"bucket dimensions ~d ~d ~d~%"
(-> obj dimension-array 0)
(-> obj dimension-array 1)
(-> obj dimension-array 2)
)
(format *stdcon* "object-count ~d, bucket-count ~d~%" (-> obj object-count) (-> obj bucket-count))
0
(none)
)
;; definition (debug) for function draw-sphere-box
;; WARN: Return type mismatch int vs none.
(defun-debug draw-sphere-box ((arg0 sphere) (arg1 rgba))
(let ((a2-0 (new 'stack-no-clear 'vector))
(a3-0 (new 'stack-no-clear 'vector))
)
(dotimes (v1-0 3)
(set! (-> a2-0 data v1-0) (- (-> arg0 data v1-0) (-> arg0 r)))
(set! (-> a3-0 data v1-0) (+ (-> arg0 data v1-0) (-> arg0 r)))
)
(add-debug-box #t (bucket-id debug-no-zbuf1) a2-0 a3-0 arg1)
)
0
(none)
)
;; definition (debug) for function draw-line-sphere
;; WARN: Return type mismatch int vs none.
(defun-debug draw-line-sphere ((arg0 vector) (arg1 vector) (arg2 float) (arg3 rgba))
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector+! gp-0 arg0 arg1)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) arg0 arg2 arg3)
(add-debug-sphere #t (bucket-id debug-no-zbuf1) gp-0 arg2 arg3)
)
0
(none)
)
;; definition for method 0 of type sphere-hash
;; WARN: Return type mismatch object vs sphere-hash.
(defmethod new sphere-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((s5-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as sphere-hash s5-0))
(set! s5-0 0)
(goto cfg-4)
)
(set! (-> (the-as sphere-hash s5-0) work) *grid-hash-work*)
(set! (-> (the-as sphere-hash s5-0) object-count) 0)
(set! (-> (the-as sphere-hash s5-0) bucket-memory-size) arg0)
(set! (-> (the-as sphere-hash s5-0) vertical-cell-count) 1)
(set! (-> (the-as sphere-hash s5-0) min-cell-size) 16384.0)
(set! (-> (the-as sphere-hash s5-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as sphere-hash s5-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as sphere-hash s5-0) bucket-array) (-> (the-as sphere-hash s5-0) mem-bucket-array))
(set! (-> (the-as sphere-hash s5-0) debug-draw) #f)
(set! (-> (the-as sphere-hash s5-0) use-scratch-ram) #f)
(set! (-> (the-as sphere-hash s5-0) max-object-count) arg1)
(set! (-> (the-as sphere-hash s5-0) mem-sphere-array) (the-as uint (malloc allocation (* arg1 16))))
(set! (-> (the-as sphere-hash s5-0) spr-sphere-array) (the-as uint (+ #x70000000 arg0)))
(set! (-> (the-as sphere-hash s5-0) sphere-array)
(the-as (inline-array sphere) (-> (the-as sphere-hash s5-0) mem-sphere-array))
)
(label cfg-4)
(the-as sphere-hash s5-0)
)
)
;; definition for method 25 of type sphere-hash
;; WARN: Return type mismatch int vs none.
(defmethod clear-objects! sphere-hash ((obj sphere-hash))
(set! (-> obj object-count) 0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) 10000000000000000000000000000000000000.0)
(set! (-> obj box-max v1-0) -10000000000000000000000000000000000000.0)
)
(cond
((-> obj use-scratch-ram)
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj spr-sphere-array)))
(set! (-> obj bucket-array) (-> obj spr-bucket-array))
)
(else
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj mem-sphere-array)))
(set! (-> obj bucket-array) (-> obj mem-bucket-array))
)
)
0
(none)
)
;; definition for method 28 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 26 of type sphere-hash
(defmethod add-a-sphere sphere-hash ((obj sphere-hash) (arg0 vector))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((a0-2 (-> obj sphere-array gp-0)))
(mem-copy! (the-as pointer a0-2) (the-as pointer arg0) 16)
)
(dotimes (v1-2 3)
(set! (-> obj box-min v1-2) (fmin (-> obj box-min v1-2) (- (-> arg0 data v1-2) (-> arg0 w))))
(set! (-> obj box-max v1-2) (fmax (-> obj box-max v1-2) (+ (-> arg0 data v1-2) (-> arg0 w))))
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 27 of type sphere-hash
(defmethod add-a-sphere-with-flag sphere-hash ((obj sphere-hash) (arg0 vector) (arg1 int))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((s2-0 (the-as object (-> obj sphere-array gp-0))))
(mem-copy! (the-as pointer s2-0) (the-as pointer arg0) 16)
(dotimes (v1-2 3)
(set! (-> obj box-min v1-2) (fmin (-> obj box-min v1-2) (- (-> arg0 data v1-2) (-> arg0 w))))
(set! (-> obj box-max v1-2) (fmax (-> obj box-max v1-2) (+ (-> arg0 data v1-2) (-> arg0 w))))
)
(set! (-> (the-as (pointer int8) s2-0) 12) arg1)
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 33 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 29 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 30 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 31 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 32 of type sphere-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 15 of type sphere-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod dump-grid-info sphere-hash ((obj sphere-hash))
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
((find-parent-method sphere-hash 15) obj)
(new 'stack-no-clear 'vector)
(let ((f30-0 6144.0))
(set! (-> obj work temp-box-min quad) (-> (target-pos 0) quad))
(+! (-> obj work temp-box-min y) f30-0)
)
(set! (-> obj work temp-box-max quad) (-> obj work temp-box-min quad))
(set! (-> obj work visit-count) 0)
(set! (-> obj debug-draw) #t)
(set! (-> obj work add-object-time) (the-as uint 0))
0
(none)
)
;; definition for method 0 of type spatial-hash
;; WARN: Return type mismatch object vs spatial-hash.
(defmethod new spatial-hash ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int))
(let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as spatial-hash gp-0))
(set! gp-0 0)
(goto cfg-4)
)
(set! (-> (the-as spatial-hash gp-0) work) *grid-hash-work*)
(set! (-> (the-as spatial-hash gp-0) object-count) 0)
(set! (-> (the-as spatial-hash gp-0) bucket-memory-size) arg0)
(set! (-> (the-as spatial-hash gp-0) vertical-cell-count) 1)
(set! (-> (the-as spatial-hash gp-0) min-cell-size) 16384.0)
(set! (-> (the-as spatial-hash gp-0) mem-bucket-array)
(the-as (pointer grid-hash-word) (malloc allocation arg0))
)
(set! (-> (the-as spatial-hash gp-0) spr-bucket-array) (the-as (pointer grid-hash-word) #x70000000))
(set! (-> (the-as spatial-hash gp-0) bucket-array) (-> (the-as spatial-hash gp-0) mem-bucket-array))
(set! (-> (the-as spatial-hash gp-0) debug-draw) #f)
(set! (-> (the-as spatial-hash gp-0) use-scratch-ram) #f)
(set! (-> (the-as spatial-hash gp-0) max-object-count) arg1)
(set! (-> (the-as spatial-hash gp-0) mem-sphere-array) (the-as uint (malloc allocation (* arg1 16))))
(set! (-> (the-as spatial-hash gp-0) mem-object-array)
(the-as (inline-array hash-object-info) (malloc allocation (* arg1 16)))
)
(set! (-> (the-as spatial-hash gp-0) spr-sphere-array) (the-as uint (+ #x70000000 arg0)))
(set! (-> (the-as spatial-hash gp-0) spr-object-array)
(the-as (inline-array hash-object-info) (+ #x70000000 (* arg1 16) arg0))
)
(set! (-> (the-as spatial-hash gp-0) sphere-array)
(the-as (inline-array sphere) (-> (the-as spatial-hash gp-0) mem-sphere-array))
)
(set! (-> (the-as spatial-hash gp-0) object-array) (-> (the-as spatial-hash gp-0) mem-object-array))
(label cfg-4)
(the-as spatial-hash gp-0)
)
)
;; definition for method 25 of type spatial-hash
;; WARN: Return type mismatch int vs none.
(defmethod clear-objects! spatial-hash ((obj spatial-hash))
(set! (-> obj object-count) 0)
(dotimes (v1-0 3)
(set! (-> obj box-min v1-0) 10000000000000000000000000000000000000.0)
(set! (-> obj box-max v1-0) -10000000000000000000000000000000000000.0)
)
(cond
((-> obj use-scratch-ram)
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj spr-sphere-array)))
(set! (-> obj object-array) (-> obj spr-object-array))
(set! (-> obj bucket-array) (-> obj spr-bucket-array))
)
(else
(set! (-> obj sphere-array) (the-as (inline-array sphere) (-> obj mem-sphere-array)))
(set! (-> obj object-array) (-> obj mem-object-array))
(set! (-> obj bucket-array) (-> obj mem-bucket-array))
)
)
0
(none)
)
;; definition for method 33 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 34 of type spatial-hash
(defmethod add-an-object spatial-hash ((obj spatial-hash) (arg0 vector) (arg1 hash-object-info))
(let ((gp-0 (-> obj object-count)))
(cond
((< gp-0 (-> obj max-object-count))
(let ((a0-2 (-> obj sphere-array gp-0))
(s2-0 (-> obj object-array gp-0))
)
(mem-copy! (the-as pointer a0-2) (the-as pointer arg0) 16)
(set! (-> s2-0 object) (the-as basic arg1))
)
(dotimes (v1-3 3)
(set! (-> obj box-min v1-3) (fmin (-> obj box-min v1-3) (- (-> arg0 data v1-3) (-> arg0 w))))
(set! (-> obj box-max v1-3) (fmax (-> obj box-max v1-3) (+ (-> arg0 data v1-3) (-> arg0 w))))
)
(+! (-> obj object-count) 1)
gp-0
)
(else
-1
)
)
)
)
;; definition for method 39 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 36 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 37 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 35 of type spatial-hash
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for method 38 of type spatial-hash
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod fill-actor-list-for-vec+r spatial-hash ((obj spatial-hash) (arg0 vector) (arg1 (pointer collide-shape)) (arg2 int))
(let ((v1-0 (new 'stack-no-clear 'sphere)))
(set! (-> v1-0 quad) (-> arg0 quad))
(set! (-> v1-0 r) 0.0)
(fill-actor-list-for-sphere obj v1-0 arg1 arg2)
)
(none)
)
;; definition for method 40 of type spatial-hash
;; WARN: Return type mismatch int vs none.
(defmethod validate-objects spatial-hash ((obj spatial-hash))
(dotimes (s5-0 (-> obj object-count))
(let ((a0-2 (-> obj object-array s5-0 object)))
(when (not (valid? a0-2 basic (the-as symbol "") #t 0))
(break!)
0
)
)
)
0
(none)
)
+3
View File
@@ -198,6 +198,9 @@
"(method 13 collide-shape-prim)",
"collide-shape-draw-debug-marks",
"(method 11 grid-hash)",
"(method 15 sphere-hash)",
"i-hopefully-will-never-exist-dont-add-anything-after-me-please"