From 3856ae505a9eca28961d6636a8a3e1a134b262de Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 27 Jul 2024 11:17:39 -0400 Subject: [PATCH] [jak3] Some cleanup/fixes around curve and light-trail (#3608) They still don't work yet, this is just naming/comments to help with debug. The vehicle tracks are now at least trying to draw, but like the others, don't actually show up. --- decompiler/config/jak3/all-types.gc | 120 ++-- .../config/jak3/ntsc_v1/type_casts.jsonc | 38 +- goal_src/jak3/engine/common-obs/curves.gc | 163 ++--- goal_src/jak3/engine/common-obs/water.gc | 18 +- .../gfx/generic/lightning/lightning-new.gc | 4 +- .../gfx/sprite/particles/light-trails-h.gc | 73 ++- .../gfx/sprite/particles/light-trails.gc | 555 ++++++++++-------- .../jak3/engine/target/gun/gun-blue-shot.gc | 15 +- .../jak3/engine/target/gun/gun-dark-shot.gc | 8 +- goal_src/jak3/engine/target/gun/gun-part.gc | 32 +- .../jak3/engine/target/gun/gun-red-shot.gc | 10 +- .../levels/city/blow-tower/blow-tower-obs.gc | 2 +- .../levels/city/blow-tower/blow-tower-obs2.gc | 129 +++- .../levels/city/blow-tower/cty-blow-tower.gc | 16 +- .../jak3/levels/city/hijack/kg-vehicles.gc | 4 +- .../levels/city/port/attack/ctyport-attack.gc | 4 +- .../jak3/levels/city/port/attack/h-torpedo.gc | 22 +- .../levels/city/protect/assault-enemies.gc | 20 +- .../jak3/levels/city/protect/assault-task.gc | 2 +- .../jak3/levels/desert/chase/wcar-catapult.gc | 2 +- .../jak3/levels/desert/hover/des-beast.gc | 12 +- goal_src/jak3/levels/desert/hover/mh-flyer.gc | 12 +- .../levels/desert/rescue/desert-rescue.gc | 39 +- .../desert/wvehicle/wvehicle-effects.gc | 251 ++++++-- .../levels/desert/wvehicle/wvehicle-part.gc | 10 +- .../jak3/levels/factory/factory-manager.gc | 12 +- .../jak3/levels/forest/forest-kill-plants.gc | 14 +- goal_src/jak3/levels/glider/glider-ring.gc | 14 +- goal_src/jak3/levels/mine/mine-platforms.gc | 6 +- goal_src/jak3/levels/mine/prebot-setup.gc | 16 +- .../wascity/bbush/des-bush-time-chase.gc | 20 +- goal_src/jak3/levels/wascity/dm-flyer.gc | 12 +- .../jak3/levels/wascity/maker-projectile.gc | 12 +- .../jak3/levels/wascity/wasdef-manager.gc | 12 +- .../jak3/engine/common-obs/curves_REF.gc | 154 ++--- .../jak3/engine/common-obs/water_REF.gc | 18 +- .../generic/lightning/lightning-new_REF.gc | 8 +- .../sprite/particles/light-trails-h_REF.gc | 68 +-- .../gfx/sprite/particles/light-trails_REF.gc | 555 ++++++++++-------- .../engine/target/gun/gun-blue-shot_REF.gc | 14 +- .../engine/target/gun/gun-dark-shot_REF.gc | 8 +- .../jak3/engine/target/gun/gun-part_REF.gc | 32 +- .../engine/target/gun/gun-red-shot_REF.gc | 10 +- .../engine/target/gun/gun-yellow-shot_REF.gc | 2 +- .../city/blow-tower/blow-tower-obs2_REF.gc | 14 +- .../city/blow-tower/blow-tower-obs_REF.gc | 6 +- .../city/blow-tower/cty-blow-tower_REF.gc | 16 +- .../levels/city/hijack/kg-vehicles_REF.gc | 4 +- .../city/port/attack/ctyport-attack_REF.gc | 4 +- .../levels/city/port/attack/h-torpedo_REF.gc | 26 +- .../city/protect/assault-enemies_REF.gc | 20 +- .../levels/city/protect/assault-task_REF.gc | 2 +- .../levels/desert/chase/wcar-catapult_REF.gc | 6 +- .../levels/desert/hover/des-beast-2_REF.gc | 6 +- .../jak3/levels/desert/hover/des-beast_REF.gc | 12 +- .../jak3/levels/desert/hover/mh-flyer_REF.gc | 16 +- .../levels/desert/rescue/desert-rescue_REF.gc | 20 +- .../desert/rescue/rope-prim-system_REF.gc | 12 +- .../desert/wvehicle/wcar-projectiles_REF.gc | 2 +- .../desert/wvehicle/wvehicle-part_REF.gc | 10 +- .../levels/factory/factory-manager_REF.gc | 16 +- .../levels/forest/forest-kill-plants_REF.gc | 14 +- .../jak3/levels/glider/glider-ring_REF.gc | 18 +- .../jak3/levels/mine/mine-platforms_REF.gc | 6 +- .../jak3/levels/mine/prebot-setup_REF.gc | 20 +- .../wascity/bbush/des-bush-time-chase_REF.gc | 20 +- .../jak3/levels/wascity/dm-flyer_REF.gc | 16 +- .../levels/wascity/maker-projectile_REF.gc | 16 +- .../jak3/levels/wascity/wasdef-manager_REF.gc | 16 +- test/offline/config/jak3/config.jsonc | 3 +- 70 files changed, 1633 insertions(+), 1236 deletions(-) diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 0f79463f7a..b846b47fb9 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -34196,7 +34196,17 @@ ;; curves ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defenum loop-behavior + :type uint64 + :bitfield #f + (wrap) + (clamp) + (b2) + (use-default) + ) + (deftype float-pair (structure) + "Two floats. Specifies one point on a piecewise linear curve." ((first float :offset-assert 0) (second float :offset-assert 4) (x float :offset 0) @@ -34208,6 +34218,7 @@ ) (deftype float-pair-array (inline-array-class) + "Array of points used to make a piecewise linear curve." ((data float-pair :dynamic :inline :offset-assert 16) ) :method-count-assert 14 @@ -34216,39 +34227,50 @@ ) (deftype curve2d (basic) + "Interface for evaluating a 2d curve. + The input is a float (x-position) and the output is a float (y-position). + The curve is over (0, 1). Values outside of the range are either clamped + or wrapped depending on the loop-behavior flag." () :method-count-assert 10 :size-assert #x4 :flag-assert #xa00000004 (:methods - (curve2d-method-9 (_type_ float int) float) ;; 9 + (evaluate "Compute value of curve at the given position." (_type_ float loop-behavior) float) ;; 9 ) ) (deftype curve-color (basic) + "Interface for evaluating a color curve. The input is a float, representing + progress through the curve, and the result is a floating point rgba color." () :method-count-assert 10 :size-assert #x4 :flag-assert #xa00000004 (:methods - (curve-color-method-9 (_type_ float rgbaf int) rgbaf) ;; 9 + (evaluate "Compute value of curve at the given position." (_type_ float rgbaf loop-behavior) rgbaf) ;; 9 ) ) (deftype curve2d-piecewise (curve2d) + "Implementation of 2d-curve for a piecewise linear curve. + Not particularly efficient - each evaluation needs to check each point." ((pts float-pair-array :offset-assert 4) - (default-loop-behavior uint64 :offset-assert 8) + (default-loop-behavior loop-behavior :offset-assert 8) ) :method-count-assert 12 :size-assert #x10 :flag-assert #xc00000010 (:methods - (curve2d-piecewise-method-10 (_type_ int symbol int) none) ;; 10 + (allocate! "Allocate memory for points." (_type_ int symbol symbol) none) ;; 10 (curve2d-piecewise-method-11 (_type_) none) ;; 11 ) ) (deftype curve2d-fast (curve2d) + "Implementation of 2d piecewise linear curve which tries to be faster. + While it is faster, it places the huge restriction that you can only have 4 points. + Note that the xs should be negative here." ((xs vector :inline :offset-assert 16) (ys vector :inline :offset-assert 32) (one-over-x-deltas vector :inline :offset-assert 48) @@ -34259,6 +34281,9 @@ ) (deftype curve-color-fast (curve-color) + "Implementation of color curve which tries to be faster. + While it is faster, it again has the restriction that you only + get 4 piecewise sections." ((xs vector :inline :offset-assert 16) (ys vector 4 :inline :offset-assert 32) (one-over-x-deltas vector :inline :offset-assert 96) @@ -34269,6 +34294,8 @@ ) (deftype color-pair (structure) + "Single section of a piecewise linear color curve. + Unlike the fast version, this stores x values exactly like you'd expect." ((first float :offset-assert 0) (second rgbaf :inline :offset-assert 16) (x float :offset 0) @@ -34280,6 +34307,7 @@ ) (deftype color-pair-array (inline-array-class) + "Array of points for piecewise linear color curve." ((data color-pair :dynamic :inline :offset-assert 16) ) :method-count-assert 14 @@ -34288,21 +34316,22 @@ ) (deftype curve-color-piecewise (curve-color) + "Implementation of curve-color." ((pts color-pair-array :offset-assert 4) - (default-loop-behavior uint64 :offset-assert 8) + (default-loop-behavior loop-behavior :offset-assert 8) ) :method-count-assert 11 :size-assert #x10 :flag-assert #xb00000010 (:methods - (curve-color-piecewise-method-10 (_type_ int symbol uint) none) ;; 10 + (allocate! "Allocate memory for points." (_type_ int symbol symbol) none) ;; 10 ) ) -(define-extern rgbaf-lerp! (function rgbaf rgbaf rgbaf float rgbaf)) -(define-extern evaluate-curve-fast (function curve2d-fast rgbaf rgbaf float)) -(define-extern evaluate-color-curve-fast (function curve-color-fast rgbaf rgbaf rgbaf)) -(define-extern rgba<-rgbaf (function rgba rgbaf int)) +(define-extern rgbaf-lerp! "Lerp all four components of rgba." (function rgbaf rgbaf rgbaf float rgbaf)) +(define-extern evaluate-curve-fast "Evaluate a curve2d-fast at the given value." (function curve2d-fast float float)) +(define-extern evaluate-color-curve-fast "Evaluate a color-curve-fast at the given value." (function curve-color-fast float rgbaf rgbaf)) +(define-extern rgba<-rgbaf "Convert rgbaf to rgba. Seems like the input rgba's value is not used in any way." (function rgba rgbaf rgba)) (define-extern *curve-unity* curve2d-fast) (define-extern *curve-linear-up* curve2d-fast) (define-extern *curve-linear-down* curve2d-fast) @@ -34679,6 +34708,14 @@ :flag-assert #xe00000010 ) +(defenum lie-mode + :type uint64 + (appearance0) + (appearance1) + (appearance2) + (use-two-strips 3) + ) + (deftype light-trail-composition (structure) ((color-mode uint64 :offset-assert 0) (color-curve curve-color-piecewise :offset-assert 8) @@ -34696,8 +34733,8 @@ (uv-mode uint64 :offset-assert 72) (uv-repeat-dist float :offset-assert 80) (max-age time-frame :offset-assert 88) - (tex-id uint32 :offset-assert 96) - (lie-mode uint64 :offset-assert 104) + (tex-id texture-id :offset-assert 96) + (lie-mode lie-mode :offset-assert 104) (lie-vector vector :inline :offset-assert 112) (zbuffer? symbol :offset-assert 128) (use-tape-mode? symbol :offset-assert 132) @@ -34711,7 +34748,7 @@ (deftype light-trail-breadcrumb (structure) ((pos vector :inline :offset-assert 0) - (birth-time uint32 :offset 12 :decomp-as time-frame) + (birth-time uint32 :offset 12 :decomp-as time-frame :score 1) ) :method-count-assert 9 :size-assert #x10 @@ -34726,15 +34763,22 @@ :flag-assert #xe00000010 ) +(defenum light-trail-decision + :type uint64 + (added 0) + (not-added 1) + (reset 2) + ) + (deftype light-trail (basic) - ((crumb-array (array light-trail-breadcrumb) :offset-assert 4) + ((crumb-array (array uint8) :offset-assert 4) (crumb-size uint8 :offset-assert 8) (crumb-count int16 :offset-assert 10) (max-crumb-count int16 :offset-assert 12) (appearance light-trail-composition :offset-assert 16) (start-marker uint64 :offset-assert 24) (end-marker uint64 :offset-assert 32) - (decision uint64 :offset-assert 40) + (decision light-trail-decision :offset-assert 40) (total-distance-traveled float :offset-assert 48) (strip prim-strip :offset-assert 52) (strip2 prim-strip :offset-assert 56) @@ -34744,19 +34788,19 @@ :size-assert #x80 :flag-assert #x1600000080 (:methods - (light-trail-method-9 (_type_ light-trail-composition int) none) ;; 9 - (light-trail-method-10 (_type_) none) ;; 10 - (light-trail-method-11 (_type_ vector time-frame) int) ;; 11 - (light-trail-method-12 (_type_) none) ;; 12 - (light-trail-method-13 (_type_) int) ;; 13 - (light-trail-method-14 (_type_) none) ;; 14 + (setup! "Initialize, including allocation of crumbs and strips on the process heap." (_type_ light-trail-composition int) none) ;; 9 + (reset! "Clear all tracked crumbs." (_type_) none) ;; 10 + (add-crumb! "Try adding a crumb, kicking out the oldest if there's not enough room. This may reject if it's too close to the previous." (_type_ vector time-frame) int) ;; 11 + (build-prim-strip! "Build the mesh for this light trail." (_type_) none) ;; 12 + (common-trans! "Call this on each frame to handle max-age." (_type_) int) ;; 13 + (expire-old-points! "Internal function to kill off points that are too old." (_type_) none) ;; 14 (light-trail-method-15 (_type_) none) ;; 15 - (add-vert! (_type_ prim-strip vector float float float) none) ;; 16 - (light-trail-method-17 (_type_ vector float float vector float) symbol) ;; 17 - (light-trail-method-18 (_type_ light-trail-breadcrumb int vector vector) none) ;; 18 - (light-trail-method-19 (_type_ float int) none) ;; 19 + (add-vert-to-prim-strip! "Add a single vertex to the prim." (_type_ prim-strip vector rgba float float) none) ;; 16 + (add-tri-pair-to-prim! "Add two vertices to the prim strip to add two triangles" (_type_ vector rgba float vector float) symbol) ;; 17 + (calc-vertex-pos! (_type_ light-trail-breadcrumb int vector vector) none) ;; 18 + (crumb-age-out-callback "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." (_type_ float int) none) ;; 19 (reset-crumbs! (_type_) none) ;; 20 - (light-trail-method-21 (_type_ vector) none) ;; 21 + (replace-last-crumb! "Similar to add-crumb, but will modify the last crumb instead of advancing." (_type_ vector) none) ;; 21 ) ) @@ -34774,7 +34818,7 @@ :size-assert #x80 :flag-assert #x1800000080 (:methods - (weapon-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) ;; 22 + (add-crumb-with-offset "Given two points, add the first and offset to a crumb." (_type_ vector vector) light-trail-breadcrumb) ;; 22 (weapon-trail-method-23 (_type_ vector vector) none) ;; 23 ) ) @@ -34793,8 +34837,8 @@ :size-assert #x80 :flag-assert #x1800000080 (:methods - (tread-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) ;; 22 - (tread-trail-method-23 (_type_ vector vector) light-trail-breadcrumb) ;; 23 + (add-crumb-with-offset (_type_ vector vector) none) ;; 22 + (tread-trail-method-23 (_type_ vector vector) none) ;; 23 ) ) @@ -34834,11 +34878,11 @@ die ;; 15 ) (:methods - (light-trail-tracker-method-16 (_type_ process-focusable vector) vector) ;; 16 - (light-trail-tracker-method-17 (_type_ process-focusable) symbol) ;; 17 - (light-trail-tracker-method-18 (_type_ process-focusable) symbol) ;; 18 - (light-trail-tracker-method-19 (_type_) symbol) ;; 19 - (light-trail-tracker-method-20 (_type_ vector) none) ;; 20 + (get-tracked-object-pos (_type_ process-focusable vector) vector) ;; 16 + (should-track? (_type_ process-focusable) symbol) ;; 17 + (should-end? (_type_ process-focusable) symbol) ;; 18 + (should-draw? (_type_) symbol) ;; 19 + (add-crumb! (_type_ vector) none) ;; 20 ) ) @@ -57861,7 +57905,7 @@ (deftype tire-trail-crumb (light-trail-breadcrumb) ((offset vector :inline :offset-assert 16) - (uu float :offset 28) + (uu float :offset 28 :score 1) ) :method-count-assert 9 :size-assert #x20 @@ -57874,13 +57918,13 @@ :size-assert #x80 :flag-assert #x1800000080 (:methods - (tire-trail-method-22 (_type_) none) ;; 22 - (tire-trail-method-23 (_type_) none) ;; 23 + (add-crumb-with-offset-and-uu (_type_ vector vector float) none) ;; 22 + (tire-trail-method-23 (_type_ vector vector float) none) ;; 23 ) ) (deftype tire-trail-tracker (light-trail-tracker) - () + ((trail tire-trail :override)) :method-count-assert 21 :size-assert #xac :flag-assert #x15003000ac diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index a82a18d848..ab8d28d5d0 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -1850,6 +1850,8 @@ ["_stack_", 148, "float"], ["_stack_", 152, "float"], ["_stack_", 156, "float"], + [25, "a1", "light-trail-breadcrumb"], + [178, "s4", "light-trail-breadcrumb"], [556, "a0", "vector"] ], "compute-trail-scaled-t": [[17, "v1", "float"]], @@ -2683,8 +2685,13 @@ [[21, 25], "a0", "prim-strip"] ], "(event tracking light-trail-tracker)": [[55, "v1", "float"]], - "(method 21 light-trail)": [[50, "v1", "light-trail-breadcrumb"]], - "(method 14 light-trail)": [[47, "a0", "uint"]], + "(method 21 light-trail)": [[[18, 64], "gp", "light-trail-breadcrumb"]], + "(method 14 light-trail)": [ + [47, "a0", "uint"], + [[10, 32], "a1", "light-trail-breadcrumb"], + [[34, 60], "s3", "light-trail-breadcrumb"], + [[34, 73], "s2", "light-trail-breadcrumb"] + ], "debug-menu-item-var-update-display-str": [ [48, "v1", "int"], [63, "v1", "int"], @@ -2736,14 +2743,18 @@ [30, "gp", "process-drawable"] ], "(method 23 weapon-trail)": [ - [62, "v1", "light-trail-breadcrumb"], - [65, "v1", "light-trail-breadcrumb"] + [[0, 100], "gp", "weapon-trail-crumb"] ], "(method 22 weapon-trail)": [[32, "v0", "light-trail-breadcrumb"]], "(method 22 tread-trail)": [[19, "v0", "light-trail-breadcrumb"]], "(method 23 tread-trail)": [ - [51, "v1", "light-trail-breadcrumb"], - [67, "v0", "light-trail-breadcrumb"] + [[0, 100], "s5", "tread-trail-crumb"] + ], + "(method 23 tire-trail)": [ + [[0, 74], "s5", "tire-trail-crumb"] + ], + "(method 22 tire-trail)": [ + [[18, 24], "v1", "tire-trail-crumb"] ], "(trans idle fma-sphere)": [[39, "a2", "process-drawable"]], "part-water-splash-callback": [[3, "v1", "float"]], @@ -6428,11 +6439,11 @@ ], "cshape-reaction-scorp-shot": [[15, "v1", "v-scorp-shot"]], "(method 78 wvehicle)": [ - [262, "s1", "process-focusable"], - [271, "s1", "process-focusable"], - [287, "s1", "process-focusable"], - [309, "s1", "process-focusable"], - [322, "s1", "process-focusable"], + [262, "s1", "tire-trail-tracker"], + [271, "s1", "tire-trail-tracker"], + [287, "s1", "tire-trail-tracker"], + [309, "s1", "tire-trail-tracker"], + [322, "s1", "tire-trail-tracker"], [358, "v1", "collide-shape-prim-group"] ], "(method 97 wvehicle)": [ @@ -6551,7 +6562,10 @@ [15, "v1", "process-drawable"], [22, "v1", "process-drawable"] ], - "(method 19 tire-trail)": [], + "(method 19 tire-trail)": [ + [[5, 28], "s5", "tire-trail-crumb"], + [[5, 28], "s4", "tire-trail-crumb"] + ], "vehicle-spawn": [[93, "gp", "vehicle"]], "vehicle-spawn-hack": [[41, "gp", "vehicle"]], "(method 11 w-parking-spot)": [[42, "v0", "vector"]], diff --git a/goal_src/jak3/engine/common-obs/curves.gc b/goal_src/jak3/engine/common-obs/curves.gc index bf11617009..ab0c53d9aa 100644 --- a/goal_src/jak3/engine/common-obs/curves.gc +++ b/goal_src/jak3/engine/common-obs/curves.gc @@ -20,9 +20,19 @@ (define-extern particle-color-curve-white* curve-color-fast) (define-extern *trail-color-curve-red* curve-color-fast) +(defenum loop-behavior + :type uint64 + :bitfield #f + (wrap) + (clamp) + (b2) + (use-default) + ) + ;; DECOMP BEGINS (deftype float-pair (structure) + "Two floats. Specifies one point on a piecewise linear curve." ((first float) (second float) (x float :overlay-at first) @@ -32,6 +42,7 @@ (deftype float-pair-array (inline-array-class) + "Array of points used to make a piecewise linear curve." ((data float-pair :inline :dynamic) ) ) @@ -40,33 +51,44 @@ (set! (-> float-pair-array heap-base) (the-as uint 16)) (deftype curve2d (basic) + "Interface for evaluating a 2d curve. +The input is a float (x-position) and the output is a float (y-position). +The curve is over (0, 1). Values outside of the range are either clamped +or wrapped depending on the loop-behavior flag." () (:methods - (curve2d-method-9 (_type_ float int) float) + (evaluate (_type_ float loop-behavior) float) ) ) (deftype curve-color (basic) + "Interface for evaluating a color curve. The input is a float, representing +progress through the curve, and the result is a floating point rgba color." () (:methods - (curve-color-method-9 (_type_ float rgbaf int) rgbaf) + (evaluate (_type_ float rgbaf loop-behavior) rgbaf) ) ) (deftype curve2d-piecewise (curve2d) + "Implementation of 2d-curve for a piecewise linear curve. +Not particularly efficient - each evaluation needs to check each point." ((pts float-pair-array) - (default-loop-behavior uint64) + (default-loop-behavior loop-behavior) ) (:methods - (curve2d-piecewise-method-10 (_type_ int symbol int) none) + (allocate! (_type_ int symbol symbol) none) (curve2d-piecewise-method-11 (_type_) none) ) ) (deftype curve2d-fast (curve2d) + "Implementation of 2d piecewise linear curve which tries to be faster. +While it is faster, it places the huge restriction that you can only have 4 points. +Note that the xs should be negative here." ((xs vector :inline) (ys vector :inline) (one-over-x-deltas vector :inline) @@ -75,12 +97,16 @@ (defun rgbaf-lerp! ((arg0 rgbaf) (arg1 rgbaf) (arg2 rgbaf) (arg3 float)) + "Lerp all four components of rgba." (vector-lerp! arg0 arg1 arg2 arg3) (set! (-> arg0 w) (lerp (-> arg1 w) (-> arg2 w) arg3)) arg0 ) (deftype curve-color-fast (curve-color) + "Implementation of color curve which tries to be faster. +While it is faster, it again has the restriction that you only +get 4 piecewise sections." ((xs vector :inline) (ys vector 4 :inline) (one-over-x-deltas vector :inline) @@ -89,6 +115,8 @@ (deftype color-pair (structure) + "Single section of a piecewise linear color curve. +Unlike the fast version, this stores x values exactly like you'd expect." ((first float) (second rgbaf :inline) (x float :overlay-at first) @@ -98,6 +126,7 @@ (deftype color-pair-array (inline-array-class) + "Array of points for piecewise linear color curve." ((data color-pair :inline :dynamic) ) ) @@ -106,53 +135,53 @@ (set! (-> color-pair-array heap-base) (the-as uint 32)) (deftype curve-color-piecewise (curve-color) + "Implementation of curve-color." ((pts color-pair-array) - (default-loop-behavior uint64) + (default-loop-behavior loop-behavior) ) (:methods - (curve-color-piecewise-method-10 (_type_ int symbol uint) none) + (allocate! (_type_ int symbol symbol) none) ) ) -(defmethod curve2d-piecewise-method-10 ((this curve2d-piecewise) (arg0 int) (arg1 symbol) (arg2 int)) +(defmethod allocate! ((this curve2d-piecewise) (arg0 int) (arg1 symbol) (arg2 symbol)) + "Allocate memory for points." (set! (-> this pts) ((method-of-type float-pair-array new) arg1 float-pair-array arg0)) - (set! (-> this default-loop-behavior) (the-as uint (if arg2 - 0 - 1 - ) - ) + (set! (-> this default-loop-behavior) (if arg2 + (loop-behavior wrap) + (loop-behavior clamp) + ) ) 0 (none) ) -(defmethod curve-color-piecewise-method-10 ((this curve-color-piecewise) (arg0 int) (arg1 symbol) (arg2 uint)) +(defmethod allocate! ((this curve-color-piecewise) (arg0 int) (arg1 symbol) (arg2 symbol)) + "Allocate memory for points." (set! (-> this pts) ((method-of-type color-pair-array new) arg1 color-pair-array arg0)) - (set! (-> this default-loop-behavior) (the-as uint (if arg2 - 0 - 1 - ) - ) + (set! (-> this default-loop-behavior) (if arg2 + (loop-behavior wrap) + (loop-behavior clamp) + ) ) 0 (none) ) -(defmethod curve-color-method-9 ((this curve-color-piecewise) (arg0 float) (arg1 rgbaf) (arg2 int)) +(defmethod evaluate ((this curve-color-piecewise) (arg0 float) (arg1 rgbaf) (arg2 loop-behavior)) + "Compute value of curve at the given position." (when (or (< 1.0 arg0) (< arg0 0.0)) - (if (= arg2 3) - (set! arg2 (the-as int (-> this default-loop-behavior))) - ) - (let ((v1-8 arg2)) - (cond - ((zero? v1-8) - (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) - ) - ((= v1-8 1) - (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) - ) + (if (= arg2 (loop-behavior use-default)) + (set! arg2 (-> this default-loop-behavior)) ) + (case arg2 + (((loop-behavior wrap)) + (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) + ) + (((loop-behavior clamp)) + (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) + ) ) ) (when (= arg0 0.0) @@ -175,20 +204,19 @@ (the-as rgbaf #f) ) -(defmethod curve2d-method-9 ((this curve2d-piecewise) (arg0 float) (arg1 int)) +(defmethod evaluate ((this curve2d-piecewise) (arg0 float) (arg1 loop-behavior)) + "Compute value of curve at the given position." (when (or (< 1.0 arg0) (< arg0 0.0)) - (if (= arg1 3) - (set! arg1 (the-as int (-> this default-loop-behavior))) - ) - (let ((v1-8 arg1)) - (cond - ((zero? v1-8) - (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) - ) - ((= v1-8 1) - (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) - ) + (if (= arg1 (loop-behavior use-default)) + (set! arg1 (-> this default-loop-behavior)) ) + (case arg1 + (((loop-behavior wrap)) + (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) + ) + (((loop-behavior clamp)) + (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) + ) ) ) (if (= arg0 0.0) @@ -210,7 +238,8 @@ ) ;; WARN: Return type mismatch number vs float. -(defun evaluate-curve-fast ((arg0 curve2d-fast) (arg1 rgbaf) (arg2 rgbaf)) +(defun evaluate-curve-fast ((arg0 curve2d-fast) (arg1 float)) + "Evaluate a curve2d-fast at the given value." (local-vars (v0-0 number)) (rlet ((acc :class vf) (vf0 :class vf) @@ -222,7 +251,7 @@ (vf29 :class vf) ) (init-vf0-vector) - (let ((a2-1 (new 'stack-no-clear 'vector)) + (let ((a2-0 (new 'stack-no-clear 'vector)) (v1-0 (new 'stack-no-clear 'vector)) ) (.mov vf27 arg1) @@ -234,10 +263,10 @@ (.add.x.vf vf28 vf24 vf27) (.mul.w.vf acc vf25 vf0) (.add.mul.vf vf29 vf28 vf26 acc) - (.svf (&-> a2-1 quad) vf28) + (.svf (&-> a2-0 quad) vf28) (.svf (&-> v1-0 quad) vf29) - (let ((a0-1 (-> a2-1 z)) - (a1-1 (-> a2-1 y)) + (let ((a0-1 (-> a2-0 z)) + (a1-1 (-> a2-0 y)) ) (nop!) (b! (>= (the-as int a0-1) 0) cfg-3 :delay (set! v0-0 (-> v1-0 z))) @@ -251,7 +280,8 @@ ) ;; WARN: Return type mismatch number vs float. -(defmethod curve2d-method-9 ((this curve2d-fast) (arg0 float) (arg1 int)) +(defmethod evaluate ((this curve2d-fast) (arg0 float) (arg1 loop-behavior)) + "Compute value of curve at the given position." (local-vars (v0-0 number)) (rlet ((acc :class vf) (vf0 :class vf) @@ -293,7 +323,8 @@ ) ) -(defun evaluate-color-curve-fast ((arg0 curve-color-fast) (arg1 rgbaf) (arg2 rgbaf)) +(defun evaluate-color-curve-fast ((arg0 curve-color-fast) (arg1 float) (arg2 rgbaf)) + "Evaluate a color-curve-fast at the given value." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -347,7 +378,8 @@ ) ) -(defmethod curve-color-method-9 ((this curve-color-fast) (arg0 float) (arg1 rgbaf) (arg2 int)) +(defmethod evaluate ((this curve-color-fast) (arg0 float) (arg1 rgbaf) (arg2 loop-behavior)) + "Compute value of curve at the given position." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -409,22 +441,21 @@ ) ) -;; WARN: Return type mismatch rgba vs int. (defun rgba<-rgbaf ((arg0 rgba) (arg1 rgbaf)) - (the-as int (copy-and-set-field - (copy-and-set-field - (copy-and-set-field - (copy-and-set-field arg0 r (the int (* 128.0 (-> arg1 x)))) - g - (the int (* 128.0 (-> arg1 y))) - ) - b - (the int (* 128.0 (-> arg1 z))) - ) - a - (the int (* 128.0 (-> arg1 w))) - ) - ) + "Convert rgbaf to rgba. Seems like the input rgba's value is not used in any way." + (copy-and-set-field + (copy-and-set-field + (copy-and-set-field + (copy-and-set-field arg0 r (the int (* 128.0 (-> arg1 x)))) + g + (the int (* 128.0 (-> arg1 y))) + ) + b + (the int (* 128.0 (-> arg1 z))) + ) + a + (the int (* 128.0 (-> arg1 w))) + ) ) (if #t @@ -456,7 +487,7 @@ (when (or (zero? *curve-linear-up-hold*) (!= loading-level global)) (set! *curve-linear-up-hold* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-linear-up-hold* 2 'loading-level (the-as int #f)) + (allocate! *curve-linear-up-hold* 2 'loading-level #f) ) (set! (-> *curve-linear-up-hold* pts data 0 first) 0.0) diff --git a/goal_src/jak3/engine/common-obs/water.gc b/goal_src/jak3/engine/common-obs/water.gc index afe1d74b21..231acd69ea 100644 --- a/goal_src/jak3/engine/common-obs/water.gc +++ b/goal_src/jak3/engine/common-obs/water.gc @@ -67,7 +67,7 @@ (when (or (zero? *water-simple-alpha-curve-in*) (!= loading-level global)) (set! *water-simple-alpha-curve-in* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-in* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-in* 2 'loading-level #f) ) (set! (-> *water-simple-alpha-curve-in* pts data 0 first) 0.0) @@ -80,7 +80,7 @@ (when (or (zero? *growing-curve*) (!= loading-level global)) (set! *growing-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *growing-curve* 2 'loading-level (the-as int #f)) + (allocate! *growing-curve* 2 'loading-level #f) ) (set! (-> *growing-curve* pts data 0 first) 0.0) @@ -93,7 +93,7 @@ (when (or (zero? *water-simple-alpha-curve-fade-out*) (!= loading-level global)) (set! *water-simple-alpha-curve-fade-out* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-fade-out* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-fade-out* 2 'loading-level #f) ) (set! (-> *water-simple-alpha-curve-fade-out* pts data 0 first) 0.0) @@ -106,7 +106,7 @@ (when (or (zero? *color-curve-tan-brown*) (!= loading-level global)) (set! *color-curve-tan-brown* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *color-curve-tan-brown* 2 'loading-level (the-as uint #f)) + (allocate! *color-curve-tan-brown* 2 'loading-level #f) ) (set! (-> *color-curve-tan-brown* pts data 0 first) 0.0) @@ -155,15 +155,13 @@ (set! (-> *water-wake-trail* uv-repeat-dist) 40960.0) -(set! (-> *water-wake-trail* lie-mode) (the-as uint 1)) +(set! (-> *water-wake-trail* lie-mode) (lie-mode appearance1)) (set! (-> *water-wake-trail* max-age) (seconds 3)) (if #f - (set! (-> *water-wake-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *water-wake-trail* tex-id) (the-as uint #x500800)) + (set! (-> *water-wake-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *water-wake-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) (set! (-> *water-wake-trail* width-curve) *growing-curve*) @@ -195,7 +193,7 @@ (let* ((v1-18 (estimate-light-trail-mem-usage (the-as uint (-> s5-0 max-num-crumbs)) - (the-as uint (= (-> s5-0 appearance lie-mode) 3)) + (the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-0 (get-process *default-dead-pool* light-trail-tracker-water (+ v1-18 8192) 1)) diff --git a/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc b/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc index 3cf75556a4..df2a90e6b1 100644 --- a/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc +++ b/goal_src/jak3/engine/gfx/generic/lightning/lightning-new.gc @@ -645,10 +645,10 @@ (let ((v1-2 arg0)) (cond ((zero? v1-2) - (curve2d-method-9 arg3 (/ arg2 arg4) 3) + (evaluate arg3 (/ arg2 arg4) (loop-behavior use-default)) ) ((= v1-2 1) - (curve2d-method-9 arg3 arg1 3) + (evaluate arg3 arg1 (loop-behavior use-default)) ) ((= v1-2 2) (let* ((v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/light-trails-h.gc b/goal_src/jak3/engine/gfx/sprite/particles/light-trails-h.gc index faaa0e1518..718b04a98a 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/light-trails-h.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/light-trails-h.gc @@ -5,6 +5,21 @@ ;; name in dgo: light-trails-h ;; dgos: GAME +(defenum lie-mode + :type uint64 + (appearance0) + (appearance1) + (appearance2) + (use-two-strips 3) + ) + +(defenum light-trail-decision + :type uint64 + (added 0) + (not-added 1) + (reset 2) + ) + ;; DECOMP BEGINS (deftype color-array (inline-array-class) @@ -32,8 +47,8 @@ (uv-mode uint64) (uv-repeat-dist float) (max-age time-frame) - (tex-id uint32) - (lie-mode uint64) + (tex-id texture-id) + (lie-mode lie-mode) (lie-vector vector :inline) (zbuffer? symbol) (use-tape-mode? symbol) @@ -59,33 +74,33 @@ (set! (-> breadcrumb-array heap-base) (the-as uint 16)) (deftype light-trail (basic) - ((crumb-array (array light-trail-breadcrumb)) + ((crumb-array (array uint8)) (crumb-size uint8) (crumb-count int16) (max-crumb-count int16) (appearance light-trail-composition) (start-marker uint64) (end-marker uint64) - (decision uint64) + (decision light-trail-decision) (total-distance-traveled float) (strip prim-strip) (strip2 prim-strip) (cache-vector vector 4 :inline) ) (:methods - (light-trail-method-9 (_type_ light-trail-composition int) none) - (light-trail-method-10 (_type_) none) - (light-trail-method-11 (_type_ vector time-frame) int) - (light-trail-method-12 (_type_) none) - (light-trail-method-13 (_type_) int) - (light-trail-method-14 (_type_) none) + (setup! (_type_ light-trail-composition int) none) + (reset! (_type_) none) + (add-crumb! (_type_ vector time-frame) int) + (build-prim-strip! (_type_) none) + (common-trans! (_type_) int) + (expire-old-points! (_type_) none) (light-trail-method-15 (_type_) none) - (add-vert! (_type_ prim-strip vector float float float) none) - (light-trail-method-17 (_type_ vector float float vector float) symbol) - (light-trail-method-18 (_type_ light-trail-breadcrumb int vector vector) none) - (light-trail-method-19 (_type_ float int) none) + (add-vert-to-prim-strip! (_type_ prim-strip vector rgba float float) none) + (add-tri-pair-to-prim! (_type_ vector rgba float vector float) symbol) + (calc-vertex-pos! (_type_ light-trail-breadcrumb int vector vector) none) + (crumb-age-out-callback (_type_ float int) none) (reset-crumbs! (_type_) none) - (light-trail-method-21 (_type_ vector) none) + (replace-last-crumb! (_type_ vector) none) ) ) @@ -99,7 +114,7 @@ (deftype weapon-trail (light-trail) () (:methods - (weapon-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) + (add-crumb-with-offset (_type_ vector vector) light-trail-breadcrumb) (weapon-trail-method-23 (_type_ vector vector) none) ) ) @@ -114,8 +129,8 @@ (deftype tread-trail (light-trail) () (:methods - (tread-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) - (tread-trail-method-23 (_type_ vector vector) light-trail-breadcrumb) + (add-crumb-with-offset (_type_ vector vector) none) + (tread-trail-method-23 (_type_ vector vector) none) ) ) @@ -149,11 +164,11 @@ die ) (:methods - (light-trail-tracker-method-16 (_type_ process-focusable vector) vector) - (light-trail-tracker-method-17 (_type_ process-focusable) symbol) - (light-trail-tracker-method-18 (_type_ process-focusable) symbol) - (light-trail-tracker-method-19 (_type_) symbol) - (light-trail-tracker-method-20 (_type_ vector) none) + (get-tracked-object-pos (_type_ process-focusable vector) vector) + (should-track? (_type_ process-focusable) symbol) + (should-end? (_type_ process-focusable) symbol) + (should-draw? (_type_) symbol) + (add-crumb! (_type_ vector) none) ) ) @@ -183,13 +198,13 @@ (set! (-> self next-line-check-time) 0) (set! (-> self last-add-frame-val) (the-as uint 0)) (set! (-> self offscreen?) #f) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (when (-> arg0 track-immediately?) (let ((gp-1 (handle->process (-> self tracked-object)))) - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-1)) - (light-trail-method-11 + (if (should-track? self (the-as process-focusable gp-1)) + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) (seconds 10000) ) ) @@ -206,7 +221,7 @@ (set! (-> self joint0) (-> arg0 joint0)) (set! (-> self joint1) (-> arg0 joint1)) (set! (-> self offscreen?) #f) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (go-virtual tracking) ) @@ -216,7 +231,7 @@ (set! (-> self offscreen?) #f) (set! (-> self next-line-check-time) 0) (set! (-> self last-add-frame-val) (the-as uint 0)) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (go-virtual tracking) ) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc b/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc index 68f562bfe0..eb7238fb19 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/light-trails.gc @@ -7,42 +7,36 @@ ;; DECOMP BEGINS -(defmethod light-trail-method-9 ((this light-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this light-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this appearance) arg0) (set! (-> this crumb-size) (the-as uint (max 16 (the-as int (-> this crumb-size))))) - (set! (-> this crumb-array) - (the-as - (array light-trail-breadcrumb) - (new 'process 'boxed-array uint8 (* arg1 (the-as int (-> this crumb-size)))) - ) - ) + (set! (-> this crumb-array) (new 'process 'boxed-array uint8 (* arg1 (the-as int (-> this crumb-size))))) (set! (-> this max-crumb-count) arg1) (set! (-> this crumb-count) 0) - (set! (-> this strip) - (new 'process 'prim-strip (* arg1 2) (the-as texture-id (-> arg0 tex-id)) (the-as string #f)) - ) + (set! (-> this strip) (new 'process 'prim-strip (* arg1 2) (-> arg0 tex-id) (the-as string #f))) (set! (-> this strip2) #f) - (if (= (-> this appearance lie-mode) 3) - (set! (-> this strip2) - (new 'process 'prim-strip (* arg1 2) (the-as texture-id (-> arg0 tex-id)) (the-as string #f)) - ) + (if (= (-> this appearance lie-mode) (lie-mode use-two-strips)) + (set! (-> this strip2) (new 'process 'prim-strip (* arg1 2) (-> arg0 tex-id) (the-as string #f))) ) - (light-trail-method-10 this) + (reset! this) 0 (none) ) ;; WARN: Return type mismatch float vs none. -(defmethod light-trail-method-10 ((this light-trail)) +(defmethod reset! ((this light-trail)) + "Clear all tracked crumbs." (set! (-> this crumb-count) 0) (set! (-> this start-marker) (the-as uint (current-time))) (set! (-> this end-marker) (the-as uint (current-time))) - (set! (-> this decision) (the-as uint 2)) + (set! (-> this decision) (light-trail-decision reset)) (set! (-> this total-distance-traveled) 0.0) (none) ) -(defmethod light-trail-method-11 ((this light-trail) (arg0 vector) (arg1 time-frame)) +(defmethod add-crumb! ((this light-trail) (arg0 vector) (arg1 time-frame)) + "Try adding a crumb, kicking out the oldest if there's not enough room. This may reject if it's too close to the previous." (local-vars (s3-0 int)) (with-pp (if (< (seconds 5000) arg1) @@ -56,7 +50,7 @@ ) (cond ((< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) (set! s3-0 1) (goto cfg-12) ) @@ -87,7 +81,7 @@ (set! f0-5 (- f2-0 f1-2)) ) (set! (-> a1-5 pos quad) (-> arg0 quad)) - (set! (-> a1-5 pos w) (the-as float (the int (- (the float (+ (-> this start-marker) arg1)) f0-5)))) + (set! (-> a1-5 birth-time) (the-as uint (the int (- (the float (+ (-> this start-marker) arg1)) f0-5)))) ) (mem-copy! (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (-> this crumb-count))) @@ -96,27 +90,33 @@ ) ) (+! (-> this crumb-count) 1) - (set! (-> this decision) (the-as uint 0)) + (set! (-> this decision) (light-trail-decision added)) (label cfg-12) s3-0 ) ) -(defmethod light-trail-method-21 ((this light-trail) (arg0 vector)) +(defmethod replace-last-crumb! ((this light-trail) (arg0 vector)) + "Similar to add-crumb, but will modify the last crumb instead of advancing." (with-pp (let ((v1-0 (-> this crumb-count))) 0.0 (cond ((zero? v1-0) - (light-trail-method-11 this arg0 (seconds 10000)) + (add-crumb! this arg0 (seconds 10000)) ) (else - (set! (-> this decision) (the-as uint 0)) - (let ((gp-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))))) - (let ((f0-1 (vector-vector-distance (the-as vector (&+ gp-0 0)) arg0))) + (set! (-> this decision) (light-trail-decision added)) + (let ((gp-0 (the-as + light-trail-breadcrumb + (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))) + ) + ) + ) + (let ((f0-1 (vector-vector-distance (-> gp-0 pos) arg0))) (+! (-> this total-distance-traveled) f0-1) (if (< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) ) ) (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) @@ -126,10 +126,10 @@ (if (-> this appearance use-tape-mode?) (set! f0-4 (- f2-0 f1-3)) ) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 0)) pos quad) (-> arg0 quad)) - (set! (-> gp-0 3) + (set! (-> gp-0 pos quad) (-> arg0 quad)) + (set! (-> gp-0 birth-time) (the-as - light-trail-breadcrumb + uint (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) ) ) @@ -142,10 +142,11 @@ ) ) -(defmethod add-vert! ((this light-trail) (arg0 prim-strip) (arg1 vector) (arg2 float) (arg3 float) (arg4 float)) +(defmethod add-vert-to-prim-strip! ((this light-trail) (arg0 prim-strip) (arg1 vector) (arg2 rgba) (arg3 float) (arg4 float)) + "Add a single vertex to the prim." (let ((v1-3 (-> arg0 data (-> arg0 num-verts)))) (set! (-> v1-3 pos quad) (-> arg1 quad)) - (set! (-> v1-3 col) (the-as rgba arg2)) + (set! (-> v1-3 col) arg2) (set! (-> v1-3 stq x) arg3) (set! (-> v1-3 stq y) arg4) ) @@ -154,31 +155,74 @@ (none) ) -(defmethod light-trail-method-17 ((this light-trail) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 float)) +(defmethod add-tri-pair-to-prim! ((this light-trail) (arg0 vector) (arg1 rgba) (arg2 float) (arg3 vector) (arg4 float)) + "Add two vertices to the prim strip to add two triangles" (if (< (+ (-> this strip allocated-num-verts) -2) (-> this strip num-verts)) (return #f) ) (cond - ((= (-> this appearance lie-mode) 3) + ((= (-> this appearance lie-mode) (lie-mode use-two-strips)) (let ((s1-0 (new 'stack-no-clear 'vector))) (set! (-> s1-0 quad) (-> this cache-vector 0 quad)) (vector-normalize! s1-0 (* 0.5 arg2)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s1-0) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-0 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-0) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-0 -1.0) + arg1 + arg4 + 1.0 + ) ) (let ((s1-1 (new 'stack-no-clear 'vector))) (set! (-> s1-1 quad) (-> this cache-vector 1 quad)) (vector-normalize! s1-1 (* 0.5 arg2)) - (add-vert! this (-> this strip2) (vector+! (new 'stack-no-clear 'vector) arg0 s1-1) arg1 arg4 0.0) - (add-vert! this (-> this strip2) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-1 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip2) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-1) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip2) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-1 -1.0) + arg1 + arg4 + 1.0 + ) ) ) (else (let ((s1-2 (new 'stack-no-clear 'vector))) (set! (-> s1-2 quad) (-> arg3 quad)) (vector-normalize! s1-2 (* 0.5 arg2)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s1-2) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-2 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-2) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-2 -1.0) + arg1 + arg4 + 1.0 + ) ) ) ) @@ -226,7 +270,7 @@ (kmemclose) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this light-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this light-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) (cond ((> (the-as uint arg1) 0) @@ -240,36 +284,35 @@ ) ) ) - (let ((a2-9 (-> this appearance lie-mode))) - (cond - ((= a2-9 1) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - ) - ((zero? a2-9) - (vector-cross! arg3 (vector-! (new 'stack-no-clear 'vector) (-> arg0 pos) arg2) v1-0) - ) - ((= a2-9 2) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (vector-cross! arg3 v1-0 arg3) - ) - ((= a2-9 3) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (set! (-> this cache-vector 0 quad) (-> arg3 quad)) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (vector-cross! arg3 v1-0 arg3) - (set! (-> this cache-vector 1 quad) (-> arg3 quad)) - ) - ) + (case (-> this appearance lie-mode) + (((lie-mode appearance1)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + ) + (((lie-mode appearance0)) + (vector-cross! arg3 (vector-! (new 'stack-no-clear 'vector) (-> arg0 pos) arg2) v1-0) + ) + (((lie-mode appearance2)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (vector-cross! arg3 v1-0 arg3) + ) + (((lie-mode use-two-strips)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (set! (-> this cache-vector 0 quad) (-> arg3 quad)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (vector-cross! arg3 v1-0 arg3) + (set! (-> this cache-vector 1 quad) (-> arg3 quad)) + ) ) ) (none) ) -(defmethod light-trail-method-12 ((this light-trail)) +(defmethod build-prim-strip! ((this light-trail)) + "Build the mesh for this light trail." (local-vars (sv-64 time-frame) (sv-72 uint) @@ -301,12 +344,14 @@ ) (while (>= s3-0 s4-0) (let* ((v1-5 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s4-0 -1))))) - (a1-3 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s4-0)))) - (a0-6 (- (-> this start-marker) (the-as uint (-> a1-3 3)))) + (a1-3 (the-as object (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s4-0))))) + (a0-6 (- (-> this start-marker) (-> (the-as light-trail-breadcrumb a1-3) birth-time))) ) - (when (and (>= a0-6 0) (< a0-6 (-> this appearance max-age))) + (when (and (>= (the-as int a0-6) 0) (< (the-as time-frame a0-6) (-> this appearance max-age))) (set! *total-length* - (+ *total-length* (vector-vector-distance (the-as vector (&+ v1-5 0)) (the-as vector (&+ a1-3 0)))) + (+ *total-length* + (vector-vector-distance (the-as vector (&+ v1-5 0)) (the-as vector (&+ (the-as (pointer uint8) a1-3) 0))) + ) ) (set! (-> *dist-cache-array* s4-0) *total-length*) ) @@ -328,7 +373,7 @@ (set! sv-128 (math-camera-pos)) (set! sv-132 (new 'stack-no-clear 'vector)) (set! (-> this strip num-verts) (the-as uint 0)) - (set! (-> this strip tex-id) (the-as texture-id (-> this appearance tex-id))) + (set! (-> this strip tex-id) (-> this appearance tex-id)) (cond ((not (-> this appearance zbuffer?)) (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) @@ -363,7 +408,7 @@ ) (when (-> this strip2) (set! (-> this strip2 num-verts) (the-as uint 0)) - (set! (-> this strip2 tex-id) (the-as texture-id (-> this appearance tex-id))) + (set! (-> this strip2 tex-id) (-> this appearance tex-id)) (cond ((not (-> this appearance zbuffer?)) (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) @@ -399,9 +444,13 @@ ) (countdown (s5-1 (-> s5-0 0)) (let* ((s3-1 s5-1) - (s4-1 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1))) + (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) ) - (set! sv-136 (/ (the float (+ (- (-> this start-marker) (the-as uint (-> s4-1 3))) sv-80)) (the float sv-64))) + (set! sv-136 + (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) + (the float sv-64) + ) + ) (when (or (< 1.0 sv-136) (< sv-136 0.0)) ) (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) @@ -423,10 +472,10 @@ f28-0 f26-0 (-> this appearance alpha-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-140 (curve2d-method-9 (-> this appearance alpha-curve-1) sv-140 3)) + (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) ) (when (-> this appearance alpha-curve-2) (set! sv-144 @@ -437,10 +486,10 @@ f28-0 f26-0 (-> this appearance alpha-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-144 (curve2d-method-9 (-> this appearance alpha-curve-2) sv-144 3)) + (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) ) (when (-> this appearance width-curve) (set! sv-148 @@ -451,10 +500,10 @@ f28-0 f26-0 (-> this appearance width-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-148 (curve2d-method-9 (-> this appearance width-curve) sv-148 3)) + (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) ) (set! sv-152 (compute-trail-scaled-t @@ -464,7 +513,7 @@ f28-0 f26-0 (-> this appearance uv-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) (when (or (< 1.0 sv-152) (< sv-152 0.0)) @@ -485,14 +534,14 @@ f28-0 f26-0 (-> this appearance color-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (curve-color-method-9 (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) 3) + (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) ) ) (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) - (light-trail-method-18 this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) + (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) ) @@ -500,30 +549,34 @@ (set! (-> s2-0 3 z) (- sv-152)) (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) - (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ s4-1 0)) (-> s2-0 4 x)) + (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) - (light-trail-method-17 this (-> s2-0 0) (-> s2-0 3 x) (-> s2-0 3 y) (-> s2-0 1) 0.0) - (light-trail-method-17 this (-> s2-0 0) (-> s2-0 3 x) (-> s2-0 3 y) (-> s2-0 1) 1.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) ) ) - (light-trail-method-17 + (add-tri-pair-to-prim! this - (the-as vector (&+ s4-1 0)) - (the-as float (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200))) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) sv-196 sv-204 sv-152 ) (when (> s3-1 0) (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) - (set! sv-88 (+ sv-88 (vector-vector-distance (the-as vector (&+ s4-1 0)) (the-as vector (&+ v1-149 0))))) + (set! sv-88 + (+ sv-88 + (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) + ) + ) ) ) (set! sv-92 sv-152) - (set! (-> sv-104 quad) (-> (the-as vector (&+ s4-1 0)) quad)) + (set! (-> sv-104 quad) (-> (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) quad)) (set! sv-96 sv-196) (set! (-> sv-100 quad) (-> sv-200 quad)) (set! (-> sv-132 quad) (-> sv-204 quad)) @@ -535,22 +588,27 @@ (none) ) -(defmethod light-trail-method-19 ((this light-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this light-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." 0 (none) ) ;; WARN: Return type mismatch pointer vs none. -(defmethod light-trail-method-14 ((this light-trail)) +(defmethod expire-old-points! ((this light-trail)) + "Internal function to kill off points that are too old." (let ((s4-0 (new 'stack-no-clear 'light-trail-breadcrumb)) (s5-0 -1) ) (let ((s3-0 (-> this crumb-count))) (dotimes (s2-0 s3-0) - (let ((a1-0 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s2-0))))) + (let ((a1-0 + (the-as light-trail-breadcrumb (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s2-0)))) + ) + ) (cond - ((< (the-as uint (-> a1-0 3)) (-> this end-marker)) - (mem-copy! (the-as pointer s4-0) a1-0 16) + ((< (-> a1-0 birth-time) (-> this end-marker)) + (mem-copy! (the-as pointer s4-0) (the-as pointer a1-0) 16) (set! s5-0 s2-0) ) (else @@ -562,17 +620,19 @@ ) (label cfg-8) (when (>= s5-0 0) - (let ((s3-1 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s5-0 1))))) - (s2-1 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s5-0)))) + (let ((s3-1 (the-as object (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s5-0 1)))))) + (s2-1 + (the-as light-trail-breadcrumb (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s5-0)))) + ) ) - (let* ((f0-1 (the float (- (-> this start-marker) (the-as uint (-> s3-1 3))))) - (f1-1 (the float (- (-> this start-marker) (the-as uint (-> s4-0 pos w))))) + (let* ((f0-1 (the float (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s3-1) birth-time)))) + (f1-1 (the float (- (-> this start-marker) (the-as uint (-> s4-0 birth-time))))) (f30-0 (/ (- (the float (-> this appearance max-age)) f0-1) (- f1-1 f0-1))) ) - (light-trail-method-19 this f30-0 s5-0) - (vector-lerp! (the-as vector (&+ s2-1 0)) (the-as vector (&+ s3-1 0)) (-> s4-0 pos) f30-0) + (crumb-age-out-callback this f30-0 s5-0) + (vector-lerp! (-> s2-1 pos) (the-as vector (&+ (the-as (pointer uint8) s3-1) 0)) (-> s4-0 pos) f30-0) ) - (set! (-> s2-1 3) (the-as light-trail-breadcrumb (-> this end-marker))) + (set! (-> s2-1 birth-time) (-> this end-marker)) ) (when (> s5-0 0) (set! (-> this crumb-count) (- (-> this crumb-count) s5-0)) @@ -587,37 +647,36 @@ (none) ) -(defmethod light-trail-method-13 ((this light-trail)) +(defmethod common-trans! ((this light-trail)) + "Call this on each frame to handle max-age." (with-pp (if (<= (-> this crumb-count) 0) (return 0) ) - (let ((v1-3 (-> this decision))) - (cond - ((= v1-3 2) - (return 0) - ) - ((zero? v1-3) - (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) - (let ((v1-8 (- (-> this start-marker) (the-as uint (-> this appearance max-age))))) - (when (< (the-as int (-> this end-marker)) (the-as int v1-8)) - (set! (-> this end-marker) v1-8) - (light-trail-method-14 this) - ) + (case (-> this decision) + (((light-trail-decision reset)) + (return 0) + ) + (((light-trail-decision added)) + (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + (let ((v1-8 (- (-> this start-marker) (the-as uint (-> this appearance max-age))))) + (when (< (the-as int (-> this end-marker)) (the-as int v1-8)) + (set! (-> this end-marker) v1-8) + (expire-old-points! this) ) ) - ((= v1-3 1) - (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) - (when (< (the-as int (-> this start-marker)) (the-as int (-> this end-marker))) - (reset-crumbs! this) - (set! (-> this end-marker) (-> this start-marker)) - ) - (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) - (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + ) + (((light-trail-decision not-added)) + (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) + (when (< (the-as int (-> this start-marker)) (the-as int (-> this end-marker))) + (reset-crumbs! this) + (set! (-> this end-marker) (-> this start-marker)) ) - ) + (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) + (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + ) ) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) 0 ) ) @@ -630,8 +689,8 @@ (defbehavior light-trail-tracker-common-post light-trail-tracker () (cond - ((light-trail-tracker-method-19 self) - (light-trail-method-12 (-> self trail)) + ((should-draw? self) + (build-prim-strip! (-> self trail)) ) (else (set! (-> self trail strip num-verts) (the-as uint 0)) @@ -651,26 +710,23 @@ (case (-> block param 0) (('add-crumb) (let ((a1-1 (handle->process (-> self tracked-object)))) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable a1-1) (new 'stack-no-clear 'vector)) - ) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable a1-1) (new 'stack-no-clear 'vector))) ) ) (('add-crumb-elapsed) (let ((a1-4 (handle->process (-> self tracked-object)))) - (light-trail-method-11 + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable a1-4) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable a1-4) (new 'stack-no-clear 'vector)) (the-as time-frame (the int (the-as float (-> block param 1)))) ) ) ) (('add-crumb-pos) - (light-trail-tracker-method-20 self (the-as vector (-> block param 1))) + (add-crumb! self (the-as vector (-> block param 1))) ) (('replace-last-crumb) - (light-trail-method-21 (-> self trail) (the-as vector (-> block param 1))) + (replace-last-crumb! (-> self trail) (the-as vector (-> block param 1))) ) (('die) (go-virtual die) @@ -683,17 +739,14 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual die) ) (else - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-0)) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector)) - ) + (if (should-track? self (the-as process-focusable gp-0)) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector))) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) 0 ) ) @@ -709,7 +762,7 @@ '() ) :trans (behavior () - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code (behavior () (until #f @@ -739,7 +792,7 @@ this ) -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker) (arg0 process-focusable) (arg1 vector)) (let ((a0-2 (if (type? arg0 process-focusable) arg0 ) @@ -752,11 +805,11 @@ arg1 ) -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker) (arg0 process-focusable)) #t ) -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-water) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-water) (arg0 process-focusable) (arg1 vector)) (let ((a0-2 (if (type? arg0 process-focusable) arg0 ) @@ -775,7 +828,7 @@ ) ;; WARN: Return type mismatch object vs symbol. -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-water) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-water) (arg0 process-focusable)) (the-as symbol (and *target* (or (logtest? (water-flag touch-water) (-> *target* water flags)) (logtest? (-> *target* control status) (collide-status on-water)) ) @@ -783,11 +836,11 @@ ) ) -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker) (arg0 process-focusable)) (not arg0) ) -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker-water) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker-water) (arg0 process-focusable)) (let ((v1-0 (if (type? arg0 process-focusable) arg0 ) @@ -815,14 +868,14 @@ ) ) -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker-projectile) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker-projectile) (arg0 process-focusable)) (if (not arg0) (set! (-> this tracked-object) (the-as handle #f)) ) #f ) -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-projectile) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-projectile) (arg0 process-focusable) (arg1 vector)) (let ((a0-1 arg0)) (if a0-1 (set! (-> arg1 quad) (-> a0-1 root trans quad)) @@ -840,13 +893,10 @@ (go-virtual hang-on) ) (else - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-0)) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector)) - ) + (if (should-track? self (the-as process-focusable gp-0)) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector))) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -864,7 +914,7 @@ (if (time-elapsed? (-> self state-time) (seconds 2)) (go-virtual die) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code sleep-code :post light-trail-tracker-common-post @@ -879,7 +929,7 @@ (if (time-elapsed? (-> self state-time) (seconds 2)) (go-virtual die) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code sleep-code :post light-trail-tracker-common-post @@ -898,7 +948,7 @@ (let ((a1-1 (-> block param 1)) (a2-1 (-> block param 2)) ) - (weapon-trail-method-22 (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) + (add-crumb-with-offset (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) ) ) ) @@ -909,7 +959,7 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual hang-on) ) (else @@ -925,10 +975,10 @@ ) ) ) - (weapon-trail-method-22 (-> self trail) s5-0 a2-0) + (add-crumb-with-offset (-> self trail) s5-0 a2-0) ) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -942,7 +992,7 @@ :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('reset) - (light-trail-method-10 (-> self trail)) + (reset! (-> self trail)) ) (('notice) (case (-> block param 0) @@ -953,7 +1003,7 @@ (let ((a1-1 (-> block param 0)) (a2-1 (-> block param 1)) ) - (tread-trail-method-22 (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) + (add-crumb-with-offset (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) ) ) ) @@ -964,7 +1014,7 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual die) ) (else @@ -973,7 +1023,7 @@ (setup-dma-and-tex (-> self trail strip) a1-2) ) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -983,26 +1033,28 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this weapon-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this weapon-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (set! (-> arg3 quad) (-> (&+ arg0 16) pos quad)) (none) ) -(defmethod light-trail-method-9 ((this weapon-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this weapon-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this crumb-size) (the-as uint 32)) (call-parent-method this arg0 arg1) (none) ) -;; WARN: Return type mismatch (pointer light-trail-breadcrumb) vs light-trail-breadcrumb. -(defmethod weapon-trail-method-22 ((this weapon-trail) (arg0 vector) (arg1 vector)) +;; WARN: Return type mismatch (pointer uint8) vs light-trail-breadcrumb. +(defmethod add-crumb-with-offset ((this weapon-trail) (arg0 vector) (arg1 vector)) + "Given two points, add the first and offset to a crumb." (let ((gp-0 (new 'stack-no-clear 'vector)) (v1-0 (new 'stack-no-clear 'vector)) ) (vector-! gp-0 arg1 arg0) (vector-float*! gp-0 gp-0 0.5) (vector+! v1-0 arg0 gp-0) - (let ((v1-1 (light-trail-method-11 this v1-0 (seconds 10000)))) + (let ((v1-1 (add-crumb! this v1-0 (seconds 10000)))) (the-as light-trail-breadcrumb (when (!= v1-1 1) @@ -1024,7 +1076,7 @@ ;; WARN: Return type mismatch object vs none. (defmethod weapon-trail-method-23 ((this weapon-trail) (arg0 vector) (arg1 vector)) - (local-vars (gp-0 (pointer light-trail-breadcrumb)) (f0-2 float)) + (local-vars (gp-0 weapon-trail-crumb) (f0-2 float)) (with-pp (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -1033,18 +1085,20 @@ 0.0 (cond ((zero? v1-0) - (weapon-trail-method-22 this arg0 arg1) + (add-crumb-with-offset this arg0 arg1) ) ((begin - (set! (-> this decision) (the-as uint 0)) - (set! gp-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + (set! (-> this decision) (light-trail-decision added)) + (set! gp-0 + (the-as weapon-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + ) (vector-! s4-0 arg1 arg0) (vector-float*! s4-0 s4-0 0.5) (vector+! s3-0 arg0 s4-0) - (set! f0-2 (vector-vector-distance (the-as vector (&+ gp-0 0)) s3-0)) + (set! f0-2 (vector-vector-distance (-> gp-0 pos) s3-0)) (< f0-2 40.96) ) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) ) (else (+! (-> this total-distance-traveled) f0-2) @@ -1055,11 +1109,11 @@ (if (-> this appearance use-tape-mode?) (set! f0-6 (- f2-0 f1-2)) ) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 0)) pos quad) (-> s3-0 quad)) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 16)) pos quad) (-> s4-0 quad)) - (set! (-> gp-0 3) + (set! (-> gp-0 pos quad) (-> s3-0 quad)) + (set! (-> gp-0 offset quad) (-> s4-0 quad)) + (set! (-> gp-0 birth-time) (the-as - light-trail-breadcrumb + uint (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-6)) ) ) @@ -1072,7 +1126,8 @@ ) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-19 ((this weapon-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this weapon-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." (let ((v1-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) arg1))) (a2-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ arg1 1)))) ) @@ -1081,7 +1136,8 @@ (none) ) -(defmethod light-trail-method-17 ((this weapon-trail) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 float)) +(defmethod add-tri-pair-to-prim! ((this weapon-trail) (arg0 vector) (arg1 rgba) (arg2 float) (arg3 vector) (arg4 float)) + "Add two vertices to the prim strip to add two triangles" (when (< (+ (-> this strip allocated-num-verts) -2) (-> this strip num-verts)) (format 0 "Out of stuff (~d)~%" (-> this strip allocated-num-verts)) (return #f) @@ -1089,14 +1145,28 @@ (vector-float*! arg3 arg3 arg2) (let ((s2-0 (new 'stack-no-clear 'vector))) (set! (-> s2-0 quad) (-> arg3 quad)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s2-0) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s2-0 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s2-0) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s2-0 -1.0) + arg1 + arg4 + 1.0 + ) ) #f ) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this tread-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this tread-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) (cond ((> (the-as uint arg1) 0) @@ -1115,14 +1185,16 @@ (none) ) -(defmethod light-trail-method-9 ((this tread-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this tread-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this crumb-size) (the-as uint 32)) (call-parent-method this arg0 arg1) (none) ) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-19 ((this tread-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this tread-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." (let ((v1-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) arg1))) (a2-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ arg1 1)))) ) @@ -1131,75 +1203,70 @@ (none) ) -;; WARN: Return type mismatch (pointer light-trail-breadcrumb) vs light-trail-breadcrumb. -(defmethod tread-trail-method-22 ((this tread-trail) (arg0 vector) (arg1 vector)) - (let ((v1-1 (light-trail-method-11 this arg0 (seconds 10000)))) - (the-as - light-trail-breadcrumb - (when (!= v1-1 1) - (let ((v0-1 - (the-as - object - (&+ (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ (-> this crumb-count) -1))) 16) +;; WARN: Return type mismatch (pointer uint8) vs none. +(defmethod add-crumb-with-offset ((this tread-trail) (arg0 vector) (arg1 vector)) + (let ((v1-1 (add-crumb! this arg0 (seconds 10000)))) + (if (!= v1-1 1) + (set! (-> (the-as + light-trail-breadcrumb + (&+ (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ (-> this crumb-count) -1))) 16) + ) + pos + quad ) - ) + (-> arg1 quad) ) - (set! (-> (the-as light-trail-breadcrumb v0-1) pos quad) (-> arg1 quad)) - v0-1 - ) ) - ) ) + (none) ) -;; WARN: Return type mismatch object vs light-trail-breadcrumb. +;; WARN: Return type mismatch object vs none. (defmethod tread-trail-method-23 ((this tread-trail) (arg0 vector) (arg1 vector)) (with-pp (let ((v1-0 (-> this crumb-count))) 0.0 - (the-as - light-trail-breadcrumb - (cond - ((zero? v1-0) - (tread-trail-method-22 this arg0 arg1) - ) - (else - (set! (-> this decision) (the-as uint 0)) - (let ((s5-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))))) - (let ((f0-1 (vector-vector-distance (the-as vector (&+ s5-0 0)) arg0))) - (+! (-> this total-distance-traveled) f0-1) - (if (< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) - ) - ) - (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) - (f2-0 (the float (-> this appearance max-age))) - (f0-4 0.0) - ) - (if (-> this appearance use-tape-mode?) - (set! f0-4 (- f2-0 f1-3)) - ) - (set! (-> (the-as light-trail-breadcrumb (&+ s5-0 0)) pos quad) (-> arg0 quad)) - (set! (-> s5-0 3) - (the-as - light-trail-breadcrumb - (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) - ) - ) - ) - (let ((v0-0 (the-as object (&+ s5-0 16)))) - (set! (-> (the-as light-trail-breadcrumb v0-0) pos quad) (-> arg1 quad)) - v0-0 + (cond + ((zero? v1-0) + (add-crumb-with-offset this arg0 arg1) + ) + (else + (set! (-> this decision) (light-trail-decision added)) + (let ((s5-0 + (the-as tread-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + ) ) + (let ((f0-1 (vector-vector-distance (-> s5-0 pos) arg0))) + (+! (-> this total-distance-traveled) f0-1) + (if (< f0-1 40.96) + (set! (-> this decision) (light-trail-decision not-added)) + ) ) + (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) + (f2-0 (the float (-> this appearance max-age))) + (f0-4 0.0) + ) + (if (-> this appearance use-tape-mode?) + (set! f0-4 (- f2-0 f1-3)) + ) + (set! (-> s5-0 pos quad) (-> arg0 quad)) + (set! (-> s5-0 birth-time) + (the-as + uint + (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) + ) + ) + ) + (set! (-> s5-0 normal quad) (-> arg1 quad)) ) ) ) ) + (none) ) ) -(defmethod light-trail-tracker-method-19 ((this light-trail-tracker)) +(defmethod should-draw? ((this light-trail-tracker)) (let ((a1-0 (handle->process (-> this tracked-object)))) #t (let ((v1-4 #t)) @@ -1254,10 +1321,10 @@ ) ;; WARN: Return type mismatch uint vs none. -(defmethod light-trail-tracker-method-20 ((this light-trail-tracker) (arg0 vector)) +(defmethod add-crumb! ((this light-trail-tracker) (arg0 vector)) (if (zero? (mod (-> this last-add-frame-val) (-> this trail appearance frame-stagger))) - (light-trail-method-11 (-> this trail) arg0 (seconds 10000)) - (light-trail-method-21 (-> this trail) arg0) + (add-crumb! (-> this trail) arg0 (seconds 10000)) + (replace-last-crumb! (-> this trail) arg0) ) (+! (-> this last-add-frame-val) 1) (none) diff --git a/goal_src/jak3/engine/target/gun/gun-blue-shot.gc b/goal_src/jak3/engine/target/gun/gun-blue-shot.gc index 12138ec3a7..d366c28f3b 100644 --- a/goal_src/jak3/engine/target/gun/gun-blue-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-blue-shot.gc @@ -321,7 +321,7 @@ ) -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-blue-3) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-blue-3) (arg0 process-focusable)) #f ) @@ -351,15 +351,13 @@ (set! (-> *blue-shot-trail* uv-repeat-dist) 163840.0) -(set! (-> *blue-shot-trail* lie-mode) (the-as uint 0)) +(set! (-> *blue-shot-trail* lie-mode) (lie-mode appearance0)) (set! (-> *blue-shot-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *blue-shot-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *blue-shot-trail* tex-id) (the-as uint #x500f00)) + (set! (-> *blue-shot-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *blue-shot-trail* tex-id) (new 'static 'texture-id :index #xf :page #x5)) ) (set! (-> *blue-shot-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*)) @@ -407,7 +405,7 @@ (set! (-> s5-0 track-immediately?) #t) (let* ((v1-30 (estimate-light-trail-mem-usage (the-as uint (-> s5-0 max-num-crumbs)) - (the-as uint (= (-> s5-0 appearance lie-mode) 3)) + (the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1)) @@ -670,7 +668,6 @@ (spawn-projectile gun-blue-shot-3 sv-148 (ppointer->process (-> sv-144 gun)) *default-dead-pool*) ) -;; WARN: Return type mismatch symbol vs none. (defun draw-beam-segment () #f ) @@ -1005,7 +1002,7 @@ (when (or (zero? *uv-loop-curve*) (!= loading-level global)) (set! *uv-loop-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *uv-loop-curve* 2 'loading-level (the-as int #t)) + (allocate! *uv-loop-curve* 2 'loading-level #t) ) (set! (-> *uv-loop-curve* pts data 0 first) 0.0) diff --git a/goal_src/jak3/engine/target/gun/gun-dark-shot.gc b/goal_src/jak3/engine/target/gun/gun-dark-shot.gc index d4a190ff97..d203d33968 100644 --- a/goal_src/jak3/engine/target/gun/gun-dark-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-dark-shot.gc @@ -844,7 +844,7 @@ (when (= (process->handle this) (-> *last-active-nuke* last-active-nuke)) 0.0 (let* ((f0-3 (/ (the float (- (current-time) (-> this state-time))) (the float (-> this blur-time)))) - (f0-4 (curve2d-method-9 (-> this blur-curve) f0-3 3)) + (f0-4 (evaluate (-> this blur-curve) f0-3 (loop-behavior use-default))) (f0-5 (- 1.0 f0-4)) ) (blit-displays-work-method-17 @@ -866,7 +866,7 @@ 0.0 0.0 (let ((f0-4 (/ (the float (- (current-time) (-> this state-time))) (the float (-> this flash-time))))) - (curve-color-method-9 (-> this fade-curve) f0-4 (the-as rgbaf gp-0) 3) + (evaluate (-> this fade-curve) f0-4 (the-as rgbaf gp-0) (loop-behavior use-default)) ) (set! (-> gp-0 x) (* 255.0 (-> gp-0 x))) (set! (-> gp-0 y) (* 255.0 (-> gp-0 y))) @@ -1303,8 +1303,8 @@ 0.0 0.0 (let ((f30-0 1.0) - (f28-0 (curve2d-method-9 *gun-dark-3-nuke-mushroom-size-curve-x* f26-0 3)) - (f26-1 (curve2d-method-9 *gun-dark-3-nuke-mushroom-size-curve-y* f26-0 3)) + (f28-0 (evaluate *gun-dark-3-nuke-mushroom-size-curve-x* f26-0 (loop-behavior use-default))) + (f26-1 (evaluate *gun-dark-3-nuke-mushroom-size-curve-y* f26-0 (loop-behavior use-default))) ) (when (time-elapsed? (-> self state-time) (seconds 5)) (let ((f30-1 (* 0.00066666666 (the float (+ (- (seconds -5) (-> self state-time)) (current-time)))))) diff --git a/goal_src/jak3/engine/target/gun/gun-part.gc b/goal_src/jak3/engine/target/gun/gun-part.gc index 50658fcced..a788130826 100644 --- a/goal_src/jak3/engine/target/gun/gun-part.gc +++ b/goal_src/jak3/engine/target/gun/gun-part.gc @@ -835,7 +835,7 @@ gun (when (or (zero? *curve-linear-up-red*) (!= loading-level global)) (set! *curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-linear-up-red* pts data 0 first) 0.0) @@ -872,15 +872,13 @@ gun (set! (-> *red-shot-3-trail* uv-repeat-dist) 16384000.0) -(set! (-> *red-shot-3-trail* lie-mode) (the-as uint 0)) +(set! (-> *red-shot-3-trail* lie-mode) (lie-mode appearance0)) (set! (-> *red-shot-3-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *red-shot-3-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *red-shot-3-trail* tex-id) (the-as uint #x100300)) + (set! (-> *red-shot-3-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *red-shot-3-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *red-shot-3-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*)) @@ -903,7 +901,7 @@ gun (when (or (zero? *curve-yellow2-shot-alpha*) (!= loading-level global)) (set! *curve-yellow2-shot-alpha* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-yellow2-shot-alpha* 21 'loading-level (the-as int #f)) + (allocate! *curve-yellow2-shot-alpha* 21 'loading-level #f) ) (set! (-> *curve-yellow2-shot-alpha* pts data 0 first) 0.0) @@ -1039,15 +1037,13 @@ gun (set! (-> *yellow-shot-2-trail* uv-repeat-dist) 20480.0) -(set! (-> *yellow-shot-2-trail* lie-mode) (the-as uint 0)) +(set! (-> *yellow-shot-2-trail* lie-mode) (lie-mode appearance0)) (set! (-> *yellow-shot-2-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *yellow-shot-2-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *yellow-shot-2-trail* tex-id) (the-as uint #x501e00)) + (set! (-> *yellow-shot-2-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *yellow-shot-2-trail* tex-id) (new 'static 'texture-id :index #x1e :page #x5)) ) (set! (-> *yellow-shot-2-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*)) @@ -3864,7 +3860,7 @@ gun (when (or (zero? *gun-dark-3-nuke-fade-curve*) (!= loading-level global)) (set! *gun-dark-3-nuke-fade-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *gun-dark-3-nuke-fade-curve* 5 'loading-level (the-as uint #f)) + (allocate! *gun-dark-3-nuke-fade-curve* 5 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-fade-curve* pts data 0 first) 0.0) @@ -3923,7 +3919,7 @@ gun (when (or (zero? *gun-dark-3-nuke-blur-curve*) (!= loading-level global)) (set! *gun-dark-3-nuke-blur-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-blur-curve* 4 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-blur-curve* 4 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-blur-curve* pts data 0 first) 0.0) @@ -3948,7 +3944,7 @@ gun (when (or (zero? *gun-dark-3-nuke-mushroom-size-curve-x*) (!= loading-level global)) (set! *gun-dark-3-nuke-mushroom-size-curve-x* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-mushroom-size-curve-x* 2 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-mushroom-size-curve-x* 2 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-mushroom-size-curve-x* pts data 0 first) 0.0) @@ -3961,7 +3957,7 @@ gun (when (or (zero? *gun-dark-3-nuke-mushroom-size-curve-y*) (!= loading-level global)) (set! *gun-dark-3-nuke-mushroom-size-curve-y* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-mushroom-size-curve-y* 2 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-mushroom-size-curve-y* 2 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-mushroom-size-curve-y* pts data 0 first) 0.0) @@ -4210,7 +4206,7 @@ gun (when (or (zero? *gun-dark-3-nuke-fade-curve-small*) (!= loading-level global)) (set! *gun-dark-3-nuke-fade-curve-small* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *gun-dark-3-nuke-fade-curve-small* 5 'loading-level (the-as uint #f)) + (allocate! *gun-dark-3-nuke-fade-curve-small* 5 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-fade-curve-small* pts data 0 first) 0.0) @@ -4269,7 +4265,7 @@ gun (when (or (zero? *gun-dark-3-nuke-blur-curve-small*) (!= loading-level global)) (set! *gun-dark-3-nuke-blur-curve-small* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-blur-curve-small* 4 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-blur-curve-small* 4 'loading-level #f) ) (set! (-> *gun-dark-3-nuke-blur-curve-small* pts data 0 first) 0.0) diff --git a/goal_src/jak3/engine/target/gun/gun-red-shot.gc b/goal_src/jak3/engine/target/gun/gun-red-shot.gc index 574eb9787a..0d7f4c3a39 100644 --- a/goal_src/jak3/engine/target/gun/gun-red-shot.gc +++ b/goal_src/jak3/engine/target/gun/gun-red-shot.gc @@ -150,7 +150,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-28 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1)) @@ -1356,7 +1356,7 @@ (when (or (zero? *impact-blur*) (!= loading-level global)) (set! *impact-blur* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *impact-blur* 3 'loading-level (the-as int #f)) + (allocate! *impact-blur* 3 'loading-level #f) ) (set! (-> *impact-blur* pts data 0 first) 0.0) @@ -1373,7 +1373,7 @@ (when (or (zero? *shockwave-blur-red-2*) (!= loading-level global)) (set! *shockwave-blur-red-2* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *shockwave-blur-red-2* 5 'loading-level (the-as int #f)) + (allocate! *shockwave-blur-red-2* 5 'loading-level #f) ) (set! (-> *shockwave-blur-red-2* pts data 0 first) 0.0) @@ -1488,7 +1488,7 @@ (adjust-warp-radius-and-alpha self) (let ((f0-14 (-> self current-stage-t))) 0.0 - (let* ((f0-16 (- 1.0 (curve2d-method-9 *impact-blur* f0-14 3))) + (let* ((f0-16 (- 1.0 (evaluate *impact-blur* f0-14 (loop-behavior use-default)))) (f0-19 (lerp f0-16 1.0 (fmax 0.0 (- 0.5 (-> self strength))))) ) (blit-displays-work-method-17 *blit-displays-work* (-> self origin) 2 (fmin 1.0 f0-19) #f) @@ -1966,7 +1966,7 @@ (while (-> self child) (let ((f0-11 (* 0.0044444446 (the float (- (current-time) (-> self state-time)))))) 0.0 - (let* ((f0-13 (- 1.0 (curve2d-method-9 *impact-blur* f0-11 1))) + (let* ((f0-13 (- 1.0 (evaluate *impact-blur* f0-11 (loop-behavior clamp)))) (f0-14 (lerp f0-13 1.0 f30-1)) ) (set! (-> *display* force-sync) (the-as uint 2)) diff --git a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc index 214f725d0b..194eeb87d2 100644 --- a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc +++ b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs.gc @@ -1300,7 +1300,7 @@ (let* ((f0-0 0.9) (f1-1 (* 0.0033333334 (the float (current-time)))) (f0-1 (/ (- f1-1 (* (the float (the int (/ f1-1 f0-0))) f0-0)) f0-0)) - (f0-2 (curve2d-method-9 *curve-linear-up-down* f0-1 3)) + (f0-2 (evaluate *curve-linear-up-down* f0-1 (loop-behavior use-default))) (f0-3 (sin (lerp -16384.0 16384.0 f0-2))) (f0-4 (+ 1.0 f0-3)) (f0-5 (* 0.5 f0-4)) diff --git a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc index 5f9237e227..c72446819d 100644 --- a/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc +++ b/goal_src/jak3/levels/city/blow-tower/blow-tower-obs2.gc @@ -1336,7 +1336,7 @@ (when (or (zero? *grunt-jump-curve*) (!= loading-level global)) (set! *grunt-jump-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *grunt-jump-curve* 3 'loading-level (the-as int #t)) + (allocate! *grunt-jump-curve* 3 'loading-level #t) ) (set! (-> *grunt-jump-curve* pts data 0 first) 0.0) @@ -1395,7 +1395,7 @@ ) (let ((f0-15 f30-0)) 0.0 - (let* ((f0-16 (curve2d-method-9 *grunt-jump-curve* f0-15 3)) + (let* ((f0-16 (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default))) (f0-17 (* f0-16 f0-16)) (f0-18 (lerp (-> this jump-height-percentage-start) (-> this jump-height-percentage-end) f0-17)) (f0-20 (- (* 2.0 f0-18) (* f0-18 f0-18))) @@ -1527,7 +1527,7 @@ (when (or (zero? *grunt-dists*) (!= loading-level global)) (set! *grunt-dists* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *grunt-dists* 5 'loading-level (the-as int #t)) + (allocate! *grunt-dists* 5 'loading-level #t) ) (set! (-> *grunt-dists* pts data 0 first) 0.0) @@ -1617,7 +1617,7 @@ (vector-float*! gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) - (curve2d-method-9 *grunt-dists* f26-0 3) + (evaluate *grunt-dists* f26-0 (loop-behavior use-default)) ) (vector+float*! (-> self root trans) (-> self root trans) gp-0 1.0) ) @@ -1636,7 +1636,7 @@ (let* ((f26-1 (ja-frame-num 0)) (f0-27 (/ f26-1 (the float (ja-num-frames 0)))) (gp-1 (new-stack-vector0)) - (f28-2 (curve2d-method-9 *curve-linear-up-down* f0-27 3)) + (f28-2 (evaluate *curve-linear-up-down* f0-27 (loop-behavior use-default))) ) (vector-float*! gp-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) (vector+float*! gp-1 gp-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) @@ -1735,6 +1735,121 @@ ) ) +;; TODO +; ;; ERROR: failed type prop at 0: Could not figure out load: (set! v1 (l.d (+ a0 220))) +; ;; ERROR: Unsupported inline assembly instruction kind - [sllv a1, v1, r0] +; (defun grunt-part-callback ((a0-0 bt-grunt)) +; (local-vars +; (v0-1 none) +; (v0-2 none) +; (v0-3 none) +; (v1-0 none) +; (v1-1 none) +; (v1-3 none) +; (v1-4 none) +; (v1-5 none) +; (v1-6 none) +; (v1-7 none) +; (v1-9 none) +; (v1-10 none) +; (v1-11 none) +; (a0-1 none) +; (a1-0 none) +; (a1-1 none) +; (a1-2 none) +; (a1-3 none) +; (a1-4 none) +; (a1-5 none) +; (a1-6 none) +; (a1-7 none) +; (a2-0 none) +; (a2-1 none) +; (a2-2 none) +; (a2-3 none) +; (a2-4 none) +; (a2-5 none) +; (a2-6 none) +; (a2-7 none) +; (a2-8 none) +; (a3-0 none) +; (a3-1 none) +; (t0-0 none) +; (t0-1 none) +; (t1-0 none) +; (t9-0 none) +; (t9-1 none) +; (sp-0 none) +; (f0-0 none) +; (f0-1 none) +; ) +; (with-pp +; (when (begin +; (and (begin (set! v1-0 (the-as none (l.d (+ a0-0 220)))) (set! a1-0 (the-as none (subu-s7 v1-0))) (nonzero? a1-0)) +; (begin +; (if (begin +; (.sllv a1-2 v1-0 r0) +; (set! a2-0 (the-as none (l.wu a1-2))) +; (set! a1-3 (the-as none (l.w (+ a2-0 40)))) +; (set! v1-1 (the-as none (sra v1-0 32))) +; (= v1-1 a1-3) +; ) +; (set! a1-1 (the-as none a2-0)) +; ) +; (set! v1-2 (the-as none a1-1)) +; ) +; ) +; a1-1 +; ) +; (and (begin (set! v1-3 (the-as none (l.wu (+ a1-1 68)))) v1-3) (begin +; (set! v1-5 (the-as none (l.wu (+ a1-1 68)))) +; (set! v1-6 (the-as none (l.wu v1-5))) +; (set! a2-1 (the-as none 'riding-idle-ship)) +; (set! v1-4 (the-as none (= v1-6 a2-1))) +; ) +; ) +; (cond +; ((not v1-4) +; (set! v1-7 (the-as none (l.wu (+ a0-0 -4)))) +; (set! t9-0 (the-as none (l.wu (+ v1-7 56)))) +; (call!) +; (set! v1-8 (the-as none v0-1)) +; (set! t9-1 (the-as none enter-state)) +; (set! v1-9 (the-as none empty-state)) +; (s.w! (+ s6-0 68) v1-9) +; (call!) +; ) +; (else +; (set! v1-10 (the-as none (+ sp-0 16))) +; (set! a2-2 (the-as none (l.wu (+ a1-1 124)))) +; (set! a2-3 (the-as none (+ a2-2 12))) +; (set! a2-4 (the-as none (l.q a2-3))) +; (s.q! v1-10 a2-4) +; (set! a1-4 (the-as none (l.wu (+ a1-1 128)))) +; (set! a1-5 (the-as none (l.wu (+ a1-4 28)))) +; (set! a1-6 (the-as none (+ a1-5 0))) +; (set! a2-5 (the-as none v1-10)) +; (set! a3-0 (the-as none v1-10)) +; (set! t0-0 (the-as none (+ a1-6 16))) +; (set! t1-0 (the-as none #x45a66666)) +; (set! f0-0 (the-as none (gpr->fpr t1-0))) +; (set! a2-6 (the-as none (vecplusfloattimes a2-5 a3-0 t0-0 f0-0))) +; (set! a2-7 (the-as none v1-10)) +; (set! a3-1 (the-as none v1-10)) +; (set! a1-7 (the-as none (+ a1-6 32))) +; (set! t0-1 (the-as none #x4599999a)) +; (set! f0-1 (the-as none (gpr->fpr t0-1))) +; (set! a2-8 (the-as none (vecplusfloattimes a2-7 a3-1 a1-7 f0-1))) +; (set! a0-1 (the-as none (l.wu (+ a0-0 124)))) +; (set! v0-3 (the-as none (+ a0-1 12))) +; (set! v1-11 (the-as none (l.q v1-10))) +; (s.q! v0-3 v1-11) +; ) +; ) +; ) +; (ret-none) +; ) +; ) + (defmethod bt-grunt-method-54 ((this bt-grunt) (arg0 vector)) (let ((v1-2 (-> this node-list data 0 bone transform))) (set! (-> arg0 quad) (-> this root trans quad)) @@ -1866,7 +1981,7 @@ ) ) ) - (+! (-> self root trans y) (* 409.6 (curve2d-method-9 *grunt-idle-shift* f0-2 3))) + (+! (-> self root trans y) (* 409.6 (evaluate *grunt-idle-shift* f0-2 (loop-behavior use-default)))) ) ) :code (behavior ((arg0 symbol)) @@ -1951,7 +2066,7 @@ (let ((f28-1 (ja-frame-num 0))) (let* ((f0-15 (/ f28-1 (the float (ja-num-frames 0)))) (gp-1 (new-stack-vector0)) - (f26-0 (curve2d-method-9 *curve-linear-up-down* f0-15 3)) + (f26-0 (evaluate *curve-linear-up-down* f0-15 (loop-behavior use-default))) ) (vector-float*! gp-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) (vector+float*! gp-1 gp-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) diff --git a/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc b/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc index 94e7b2628a..9ea4cca237 100644 --- a/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc +++ b/goal_src/jak3/levels/city/blow-tower/cty-blow-tower.gc @@ -536,7 +536,7 @@ (when (or (zero? *bt-height-adjust*) (!= loading-level global)) (set! *bt-height-adjust* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-height-adjust* 4 'loading-level (the-as int #t)) + (allocate! *bt-height-adjust* 4 'loading-level #t) ) (set! (-> *bt-height-adjust* pts data 0 first) 0.0) @@ -574,7 +574,7 @@ (set! f0-7 (* f0-7 f0-7)) ) ) - (let* ((f0-8 (curve2d-method-9 *bt-height-adjust* f0-7 3)) + (let* ((f0-8 (evaluate *bt-height-adjust* f0-7 (loop-behavior use-default))) (f0-9 (lerp (-> this start-path-height-offset) (-> this dest-path-height-offset) f0-8)) ) (set! (-> this path-height-vel) (* (- f0-9 (-> this path-height-offset)) (-> pp clock frames-per-second))) @@ -1770,7 +1770,7 @@ (when (or (zero? *bt-clamp-curve-x*) (!= loading-level global)) (set! *bt-clamp-curve-x* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-clamp-curve-x* 7 'loading-level (the-as int #t)) + (allocate! *bt-clamp-curve-x* 7 'loading-level #t) ) (set! (-> *bt-clamp-curve-x* pts data 0 first) 0.0) @@ -1803,7 +1803,7 @@ (when (or (zero? *bt-accel-curve*) (!= loading-level global)) (set! *bt-accel-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-accel-curve* 4 'loading-level (the-as int #t)) + (allocate! *bt-accel-curve* 4 'loading-level #t) ) (set! (-> *bt-accel-curve* pts data 0 first) 0.0) @@ -1935,8 +1935,12 @@ ) (set! (-> this y-boost-scalar) (fmax 0.0 (fmin 2.5 (-> this y-boost-scalar)))) (set! (-> this x-boost-scalar) (fmax 0.0 (fmin 2.5 (-> this x-boost-scalar)))) - (set! (-> this rotyv) (* (-> this rotyv) (curve2d-method-9 *bt-accel-curve* (-> this y-boost-scalar) 2))) - (set! (-> this rotxv) (* (-> this rotxv) (curve2d-method-9 *bt-accel-curve* (-> this x-boost-scalar) 2))) + (set! (-> this rotyv) + (* (-> this rotyv) (evaluate *bt-accel-curve* (-> this y-boost-scalar) (loop-behavior b2))) + ) + (set! (-> this rotxv) + (* (-> this rotxv) (evaluate *bt-accel-curve* (-> this x-boost-scalar) (loop-behavior b2))) + ) (set! (-> this rotxv) (* 0.8 (-> this rotxv))) (+! (-> this roty) (* (-> this rotyv) (seconds-per-frame))) (+! (-> this rotx) (* (-> this rotxv) (seconds-per-frame))) diff --git a/goal_src/jak3/levels/city/hijack/kg-vehicles.gc b/goal_src/jak3/levels/city/hijack/kg-vehicles.gc index 0f12b40205..4f003c0e78 100644 --- a/goal_src/jak3/levels/city/hijack/kg-vehicles.gc +++ b/goal_src/jak3/levels/city/hijack/kg-vehicles.gc @@ -19,7 +19,7 @@ (when (or (zero? *hijack-suck-curve*) (!= loading-level global)) (set! *hijack-suck-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *hijack-suck-curve* 4 'loading-level (the-as int #t)) + (allocate! *hijack-suck-curve* 4 'loading-level #t) ) (set! (-> *hijack-suck-curve* pts data 0 first) 0.0) @@ -44,7 +44,7 @@ (let* ((f1-0 (the float (-> *game-info* sub-task-list (game-task-node city-hijack-vehicle-escape) death-count))) (f0-2 (fmax 0.0 (fmin 15.0 f1-0))) ) - (set! f30-0 (curve2d-method-9 *hijack-suck-curve* f0-2 2)) + (set! f30-0 (evaluate *hijack-suck-curve* f0-2 (loop-behavior b2))) ) ) f30-0 diff --git a/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc b/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc index 74bf4903c0..e1335da4e1 100644 --- a/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc +++ b/goal_src/jak3/levels/city/port/attack/ctyport-attack.gc @@ -3019,7 +3019,7 @@ (set! (-> this sprites 1 color w) 0) (let ((f0-11 (* 0.011111111 (the float (- (current-time) (-> this spike-time)))))) 0.0 - (let ((f0-12 (curve2d-method-9 *hud-boost-curve* f0-11 3))) + (let ((f0-12 (evaluate *hud-boost-curve* f0-11 (loop-behavior use-default)))) (set! (-> this tt-current) (lerp (-> this tt-prev) (-> this tt-next) f0-12)) ) ) @@ -3039,7 +3039,7 @@ (f0-23 (lerp 1.0 0.3 f28-2)) (f1-16 (* 0.0033333334 (the float (current-time)))) (f0-24 (/ (- f1-16 (* (the float (the int (/ f1-16 f0-23))) f0-23)) f0-23)) - (f1-18 (* f28-2 (curve2d-method-9 *curve-linear-up-down* f0-24 3))) + (f1-18 (* f28-2 (evaluate *curve-linear-up-down* f0-24 (loop-behavior use-default)))) (f28-3 (fmax 0.0 (fmin 1.0 f1-18))) ) (set! (-> this sprites 3 color x) (the int (lerp 128.0 192.0 f28-3))) diff --git a/goal_src/jak3/levels/city/port/attack/h-torpedo.gc b/goal_src/jak3/levels/city/port/attack/h-torpedo.gc index 1c37ee6163..f4a8ea0a87 100644 --- a/goal_src/jak3/levels/city/port/attack/h-torpedo.gc +++ b/goal_src/jak3/levels/city/port/attack/h-torpedo.gc @@ -56,7 +56,7 @@ (when (or (zero? *growing-curve-torpedo*) (!= loading-level global)) (set! *growing-curve-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *growing-curve-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *growing-curve-torpedo* 2 'loading-level #f) ) (set! (-> *growing-curve-torpedo* pts data 0 first) 0.0) @@ -69,7 +69,7 @@ (when (or (zero? *water-simple-alpha-curve-fade-out-torpedo*) (!= loading-level global)) (set! *water-simple-alpha-curve-fade-out-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-fade-out-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-fade-out-torpedo* 2 'loading-level #f) ) (set! (-> *water-simple-alpha-curve-fade-out-torpedo* pts data 0 first) 0.0) @@ -82,7 +82,7 @@ (when (or (zero? *color-curve-tan-brown-torpedo*) (!= loading-level global)) (set! *color-curve-tan-brown-torpedo* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *color-curve-tan-brown-torpedo* 2 'loading-level (the-as uint #f)) + (allocate! *color-curve-tan-brown-torpedo* 2 'loading-level #f) ) (set! (-> *color-curve-tan-brown-torpedo* pts data 0 first) 0.0) @@ -107,7 +107,7 @@ (when (or (zero? *water-simple-alpha-curve-in-torpedo*) (!= loading-level global)) (set! *water-simple-alpha-curve-in-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-in-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-in-torpedo* 2 'loading-level #f) ) (set! (-> *water-simple-alpha-curve-in-torpedo* pts data 0 first) 0.0) @@ -144,15 +144,13 @@ (set! (-> *torpedo-wake-trail* uv-repeat-dist) 81920.0) -(set! (-> *torpedo-wake-trail* lie-mode) (the-as uint 1)) +(set! (-> *torpedo-wake-trail* lie-mode) (lie-mode appearance1)) (set! (-> *torpedo-wake-trail* max-age) (seconds 0.3)) (if #f - (set! (-> *torpedo-wake-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *torpedo-wake-trail* tex-id) (the-as uint #x500800)) + (set! (-> *torpedo-wake-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *torpedo-wake-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) (set! (-> *torpedo-wake-trail* width-curve) *growing-curve-torpedo*) @@ -1468,13 +1466,13 @@ ) -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-torpedo) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-torpedo) (arg0 process-focusable)) (let ((v1-0 arg0)) (and (-> (the-as htorpedo v1-0) on-water?) (< (-> v1-0 root trans y) 20480.0)) ) ) -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-torpedo) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-torpedo) (arg0 process-focusable) (arg1 vector)) (let ((v1-0 arg0)) (when v1-0 (set! (-> arg1 quad) (-> v1-0 root trans quad)) @@ -1525,7 +1523,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-34 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-torpedo (+ v1-34 8192) 1)) diff --git a/goal_src/jak3/levels/city/protect/assault-enemies.gc b/goal_src/jak3/levels/city/protect/assault-enemies.gc index 2434fe2681..8b5020cec4 100644 --- a/goal_src/jak3/levels/city/protect/assault-enemies.gc +++ b/goal_src/jak3/levels/city/protect/assault-enemies.gc @@ -1465,15 +1465,13 @@ (set! (-> *assault-bombbot-trail* uv-repeat-dist) 4096000.0) -(set! (-> *assault-bombbot-trail* lie-mode) (the-as uint 0)) +(set! (-> *assault-bombbot-trail* lie-mode) (lie-mode appearance0)) (set! (-> *assault-bombbot-trail* max-age) (seconds 0.1)) (if #f - (set! (-> *assault-bombbot-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *assault-bombbot-trail* tex-id) (the-as uint #x100300)) + (set! (-> *assault-bombbot-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *assault-bombbot-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *assault-bombbot-trail* width-curve) (the-as curve2d-piecewise *curve-assault-bombbot-shot-width*)) @@ -1520,15 +1518,13 @@ (set! (-> *assault-bombbot-trail-2* uv-repeat-dist) 4096000.0) -(set! (-> *assault-bombbot-trail-2* lie-mode) (the-as uint 0)) +(set! (-> *assault-bombbot-trail-2* lie-mode) (lie-mode appearance0)) (set! (-> *assault-bombbot-trail-2* max-age) (seconds 0.1)) (if #f - (set! (-> *assault-bombbot-trail-2* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *assault-bombbot-trail-2* tex-id) (the-as uint #x100300)) + (set! (-> *assault-bombbot-trail-2* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *assault-bombbot-trail-2* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *assault-bombbot-trail-2* width-curve) @@ -1639,7 +1635,7 @@ (set! (-> gp-0 track-immediately?) #t) (let* ((v1-11 (estimate-light-trail-mem-usage (the-as uint (-> gp-0 max-num-crumbs)) - (the-as uint (= (-> gp-0 appearance lie-mode) 3)) + (the-as uint (= (-> gp-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-11 8192) 1)) @@ -1659,7 +1655,7 @@ (set! (-> gp-0 appearance) *assault-bombbot-trail-2*) (let* ((v1-20 (estimate-light-trail-mem-usage (the-as uint (-> gp-0 max-num-crumbs)) - (the-as uint (= (-> gp-0 appearance lie-mode) 3)) + (the-as uint (= (-> gp-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-20 8192) 1)) diff --git a/goal_src/jak3/levels/city/protect/assault-task.gc b/goal_src/jak3/levels/city/protect/assault-task.gc index c2bebe758c..8b27286ee4 100644 --- a/goal_src/jak3/levels/city/protect/assault-task.gc +++ b/goal_src/jak3/levels/city/protect/assault-task.gc @@ -143,7 +143,7 @@ (when (or (zero? *port-assault-blur-curve*) (!= loading-level global)) (set! *port-assault-blur-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *port-assault-blur-curve* 4 'loading-level (the-as int #t)) + (allocate! *port-assault-blur-curve* 4 'loading-level #t) ) (set! (-> *port-assault-blur-curve* pts data 0 first) 0.0) diff --git a/goal_src/jak3/levels/desert/chase/wcar-catapult.gc b/goal_src/jak3/levels/desert/chase/wcar-catapult.gc index 110b1a25a9..3a29d45e4b 100644 --- a/goal_src/jak3/levels/desert/chase/wcar-catapult.gc +++ b/goal_src/jak3/levels/desert/chase/wcar-catapult.gc @@ -1342,7 +1342,7 @@ (when (or (zero? *v-catapult-shot-impact-blur*) (!= loading-level global)) (set! *v-catapult-shot-impact-blur* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *v-catapult-shot-impact-blur* 3 'loading-level (the-as int #f)) + (allocate! *v-catapult-shot-impact-blur* 3 'loading-level #f) ) (set! (-> *v-catapult-shot-impact-blur* pts data 0 first) 0.0) diff --git a/goal_src/jak3/levels/desert/hover/des-beast.gc b/goal_src/jak3/levels/desert/hover/des-beast.gc index 221e8b2593..fe51b17ed4 100644 --- a/goal_src/jak3/levels/desert/hover/des-beast.gc +++ b/goal_src/jak3/levels/desert/hover/des-beast.gc @@ -28,7 +28,7 @@ (when (or (zero? *curve-beast-linear-up-red*) (!= loading-level global)) (set! *curve-beast-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-beast-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-beast-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-beast-linear-up-red* pts data 0 first) 0.0) @@ -88,15 +88,13 @@ (set! (-> *beast-grenade-trail* uv-repeat-dist) 16384000.0) -(set! (-> *beast-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *beast-grenade-trail* lie-mode) (lie-mode appearance0)) (set! (-> *beast-grenade-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *beast-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *beast-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *beast-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *beast-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *beast-grenade-trail* width-curve) (the-as curve2d-piecewise *curve-grenade-linear-trail*)) @@ -946,7 +944,7 @@ (set! (-> s5-1 track-immediately?) #t) (let* ((v1-22 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-22 8192) 1)) diff --git a/goal_src/jak3/levels/desert/hover/mh-flyer.gc b/goal_src/jak3/levels/desert/hover/mh-flyer.gc index cf5a9a2ff2..07b0f3b810 100644 --- a/goal_src/jak3/levels/desert/hover/mh-flyer.gc +++ b/goal_src/jak3/levels/desert/hover/mh-flyer.gc @@ -33,7 +33,7 @@ (when (or (zero? *mh-flyer-curve-linear-up-red*) (!= loading-level global)) (set! *mh-flyer-curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *mh-flyer-curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *mh-flyer-curve-linear-up-red* 2 'loading-level #f) ) (set! (-> *mh-flyer-curve-linear-up-red* pts data 0 first) 0.0) @@ -93,15 +93,13 @@ (set! (-> *mh-flyer-missile-trail* uv-repeat-dist) 16384000.0) -(set! (-> *mh-flyer-missile-trail* lie-mode) (the-as uint 0)) +(set! (-> *mh-flyer-missile-trail* lie-mode) (lie-mode appearance0)) (set! (-> *mh-flyer-missile-trail* max-age) (seconds 1)) (if #f - (set! (-> *mh-flyer-missile-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *mh-flyer-missile-trail* tex-id) (the-as uint #x100300)) + (set! (-> *mh-flyer-missile-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *mh-flyer-missile-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *mh-flyer-missile-trail* width-curve) @@ -476,7 +474,7 @@ (set! (-> s5-5 track-immediately?) #t) (let* ((v0-8 (estimate-light-trail-mem-usage (the-as uint (-> s5-5 max-num-crumbs)) - (the-as uint (= (-> s5-5 appearance lie-mode) 3)) + (the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-8 8192) 1)) diff --git a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc index 583b02d319..1765dbb0d7 100644 --- a/goal_src/jak3/levels/desert/rescue/desert-rescue.gc +++ b/goal_src/jak3/levels/desert/rescue/desert-rescue.gc @@ -1071,15 +1071,13 @@ (set! (-> *transport-tread-settings* uv-repeat-dist) 20480.0) -(set! (-> *transport-tread-settings* lie-mode) (the-as uint 0)) +(set! (-> *transport-tread-settings* lie-mode) (lie-mode appearance0)) (set! (-> *transport-tread-settings* max-age) (seconds 20)) (if "tread-marks" - (set! (-> *transport-tread-settings* tex-id) - (the-as uint (lookup-texture-id-by-name "tread-marks" (the-as string #f))) - ) - (set! (-> *transport-tread-settings* tex-id) (the-as uint #x100300)) + (set! (-> *transport-tread-settings* tex-id) (lookup-texture-id-by-name "tread-marks" (the-as string #f))) + (set! (-> *transport-tread-settings* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *transport-tread-settings* width-curve) (the-as curve2d-piecewise *curve-unity*)) @@ -1170,14 +1168,12 @@ (vector+float*! s2-0 s2-0 (-> v1-4 fvec) -27852.8) (vector+float*! s3-0 s2-0 (-> v1-4 rvec) -14131.2) (vector+float*! s5-0 s2-0 (-> v1-4 rvec) 14131.2) - (set! (-> *transport-tread-settings* tex-id) - (the-as uint (lookup-texture-id-by-name "tread-marks" (the-as string #f))) - ) + (set! (-> *transport-tread-settings* tex-id) (lookup-texture-id-by-name "tread-marks" (the-as string #f))) (set! (-> s3-0 y) (probe-ground2 this s3-0 s4-0)) (+! (-> s3-0 y) 409.6) (let ((v1-11 (the-as tread-trail-tracker (handle->process (-> this tread1))))) (if (zero? (mod (-> this tread-last-spawn-index) (-> this tread-frequency))) - (tread-trail-method-22 (-> v1-11 trail) s3-0 s4-0) + (add-crumb-with-offset (-> v1-11 trail) s3-0 s4-0) (tread-trail-method-23 (-> v1-11 trail) s3-0 s4-0) ) ) @@ -1185,7 +1181,7 @@ (+! (-> s5-0 y) 409.6) (let ((v1-21 (the-as tread-trail-tracker (handle->process (-> this tread2))))) (if (zero? (mod (-> this tread-last-spawn-index) (-> this tread-frequency))) - (tread-trail-method-22 (-> v1-21 trail) s5-0 s4-0) + (add-crumb-with-offset (-> v1-21 trail) s5-0 s4-0) (tread-trail-method-23 (-> v1-21 trail) s5-0 s4-0) ) ) @@ -1389,7 +1385,7 @@ (let* ((v1-64 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-2 (get-process *default-dead-pool* tread-trail-tracker (+ v1-64 8192) 1)) @@ -1410,7 +1406,7 @@ (let* ((v1-73 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-3 (get-process *default-dead-pool* tread-trail-tracker (+ v1-73 8192) 1)) @@ -2477,11 +2473,11 @@ :code sleep-code ) -(defmethod task-manager-method-25 ((this task-manager-desert-rescue)) - (send-event (handle->process (-> this current-passenger)) 'die-fast) - (call-parent-method this) - (none) - ) +; (defmethod task-manager-method-25 ((this task-manager-desert-rescue)) +; (send-event (handle->process (-> this current-passenger)) 'die-fast) +; (call-parent-method this) +; (none) +; ) (defstate finish-task (task-manager-desert-rescue) :virtual #t @@ -2525,11 +2521,10 @@ (none) ) -;; og:preserve-this duplicate -; (defmethod task-manager-method-25 ((this task-manager-desert-rescue)) -; (call-parent-method this) -; (none) -; ) +(defmethod task-manager-method-25 ((this task-manager-desert-rescue)) + (call-parent-method this) + (none) + ) (defmethod task-manager-desert-rescue-method-45 ((this task-manager-desert-rescue) (arg0 int)) (let ((v1-0 arg0)) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-effects.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-effects.gc index 695382ebb5..ad63a831a0 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-effects.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-effects.gc @@ -93,15 +93,13 @@ (set! (-> *wheel-trail-info* uv-repeat-dist) 8192.0) -(set! (-> *wheel-trail-info* lie-mode) (the-as uint 0)) +(set! (-> *wheel-trail-info* lie-mode) (lie-mode appearance0)) (set! (-> *wheel-trail-info* max-age) (seconds 3)) (if #f - (set! (-> *wheel-trail-info* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *wheel-trail-info* tex-id) (the-as uint #x100300)) + (set! (-> *wheel-trail-info* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *wheel-trail-info* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *wheel-trail-info* width-curve) (the-as curve2d-piecewise *curve-unity*)) @@ -132,37 +130,205 @@ (deftype tire-trail (light-trail) () (:methods - (tire-trail-method-22 (_type_) none) - (tire-trail-method-23 (_type_) none) + (add-crumb-with-offset-and-uu (_type_ vector vector float) none) + (tire-trail-method-23 (_type_ vector vector float) none) ) ) ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this tire-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this tire-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (set! (-> arg3 quad) (-> (&+ arg0 16) pos quad)) (none) ) -(defmethod light-trail-method-9 ((this tire-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this tire-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this crumb-size) (the-as uint 32)) (call-parent-method this arg0 arg1) (none) ) +;; WARN: Return type mismatch float vs none. +(defmethod add-crumb-with-offset-and-uu ((this tire-trail) (arg0 vector) (arg1 vector) (arg2 float)) + (let ((v1-1 (add-crumb! this arg0 (seconds 10000)))) + (when (!= v1-1 1) + (let ((v1-4 (the-as + tire-trail-crumb + (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ (-> this crumb-count) -1))) + ) + ) + ) + (set! (-> v1-4 offset quad) (-> arg1 quad)) + (set! (-> v1-4 uu) arg2) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod tire-trail-method-23 ((this tire-trail) (arg0 vector) (arg1 vector) (arg2 float)) + (local-vars (s5-0 tire-trail-crumb) (f0-1 float)) + (with-pp + (let ((v1-0 (-> this crumb-count))) + 0.0 + (cond + ((zero? v1-0) + (add-crumb-with-offset-and-uu this arg0 arg1 arg2) + ) + ((begin + (set! (-> this decision) (light-trail-decision added)) + (set! s5-0 + (the-as tire-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + ) + (set! f0-1 (vector-vector-distance (-> s5-0 pos) arg0)) + (< f0-1 40.96) + ) + (set! (-> this decision) (light-trail-decision not-added)) + ) + (else + (+! (-> this total-distance-traveled) f0-1) + (let ((f1-2 (the float (- (-> this start-marker) (-> this end-marker)))) + (f2-0 (the float (-> this appearance max-age))) + (f0-5 0.0) + ) + (if (-> this appearance use-tape-mode?) + (set! f0-5 (- f2-0 f1-2)) + ) + (set! (-> s5-0 pos quad) (-> arg0 quad)) + (set! (-> s5-0 offset quad) (-> arg1 quad)) + (set! (-> s5-0 birth-time) + (the-as + uint + (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-5)) + ) + ) + ) + (set! (-> s5-0 uu) arg2) + ) + ) + ) + (none) + ) + ) + +;; WARN: Return type mismatch float vs none. +(defmethod crumb-age-out-callback ((this tire-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." + (let* ((s5-0 (the-as tire-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) arg1)))) + (s4-0 + (the-as tire-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ arg1 1)))) + ) + (f30-0 (-> s5-0 uu)) + ) + (vector-lerp! (-> s5-0 offset) (-> s4-0 offset) (-> s5-0 offset) arg0) + (set! (-> s5-0 uu) (lerp (-> s4-0 uu) f30-0 arg0)) + ) + (none) + ) + +(defmethod add-tri-pair-to-prim! ((this tire-trail) (arg0 vector) (arg1 rgba) (arg2 float) (arg3 vector) (arg4 float)) + "Add two vertices to the prim strip to add two triangles" + (when (< (+ (-> this strip allocated-num-verts) -2) (-> this strip num-verts)) + (format 0 "Out of stuff (~d)~%" (-> this strip allocated-num-verts)) + (return #f) + ) + (let ((s3-0 (new 'stack-no-clear 'matrix))) + (vector+! (-> s3-0 rvec) arg0 arg3) + (vector-! (-> s3-0 uvec) arg0 arg3) + (add-vert-to-prim-strip! this (-> this strip) (-> s3-0 rvec) arg1 arg4 0.0) + (add-vert-to-prim-strip! this (-> this strip) (-> s3-0 uvec) arg1 arg4 1.0) + ) + #f + ) + +(deftype tire-trail-tracker (light-trail-tracker) + ((trail tire-trail :override) + ) + ) + + +(defbehavior tire-trail-tracker-init-by-other tire-trail-tracker ((arg0 light-trail-tracker-spawn-params)) + (set! (-> self tracked-object) (-> arg0 tracked-obj)) + (set! (-> self trail) (new 'process 'tire-trail)) + (set! (-> self offscreen?) #f) + (set! (-> self next-line-check-time) 0) + (set! (-> self last-add-frame-val) (the-as uint 0)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (change-parent self *rigid-body-queue-manager*) + (go-virtual tracking) + ) + +(defstate tracking (tire-trail-tracker) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('reset) + (reset! (-> self trail)) + ) + (('die) + (go-virtual die) + ) + ) + ) + :trans (behavior () + (let ((v1-1 (handle->process (-> self tracked-object)))) + (cond + (v1-1 + (if (and v1-1 (nonzero? (-> (the-as process-drawable v1-1) draw))) + (setup-dma-and-tex (-> self trail strip) (-> (the-as process-drawable v1-1) draw)) + ) + (common-trans! (-> self trail)) + ) + (else + (go-virtual die) + ) + ) + ) + ) + :code sleep-code + :post light-trail-tracker-common-post + ) + +;; WARN: Return type mismatch process vs tire-trail-tracker. +(defun spawn-tire-trail-tracker ((arg0 process) (arg1 light-trail-tracker-spawn-params)) + (let ((v1-2 (+ (estimate-light-trail-mem-usage (the-as uint (-> arg1 max-num-crumbs)) (the-as uint #f)) + (* (-> arg1 max-num-crumbs) 16) + ) + ) + (s4-0 (the-as process #f)) + ) + (let* ((s3-0 (get-process *default-dead-pool* tire-trail-tracker (+ v1-2 1024) 1)) + (v1-3 (when s3-0 + (let ((t9-2 (method-of-type process activate))) + (t9-2 s3-0 arg0 "tire-trail" (the-as pointer #x70004000)) + ) + (run-now-in-process s3-0 tire-trail-tracker-init-by-other arg1) + (-> s3-0 ppointer) + ) + ) + ) + (if v1-3 + (set! s4-0 (-> v1-3 0)) + ) + ) + (the-as tire-trail-tracker s4-0) + ) + ) + (defmethod wvehicle-method-195 ((this wvehicle)) - ; TODO trail tracker stuff - ; (let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) - ; (set! (-> s5-0 tracked-obj) (process->handle this)) - ; (set! (-> s5-0 max-num-crumbs) 80) - ; (set! (-> s5-0 appearance) *wheel-trail-info*) - ; (dotimes (s4-0 (-> this info physics-model wheel-count)) - ; (when (not (handle->process (-> this wheel s4-0 tread-tracker))) - ; (set! (-> *wheel-trail-info* tex-id) (the-as uint (-> this wheel s4-0 info tread-tid))) - ; (set! (-> this wheel s4-0 tread-tracker) (process->handle (spawn-tire-trail-tracker this s5-0))) - ; ) - ; ) - ; ) + (let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params))) + (set! (-> s5-0 tracked-obj) (process->handle this)) + (set! (-> s5-0 max-num-crumbs) 80) + (set! (-> s5-0 appearance) *wheel-trail-info*) + (dotimes (s4-0 (-> this info physics-model wheel-count)) + (when (not (handle->process (-> this wheel s4-0 tread-tracker))) + (set! (-> *wheel-trail-info* tex-id) (-> this wheel s4-0 info tread-tid)) + (set! (-> this wheel s4-0 tread-tracker) (process->handle (spawn-tire-trail-tracker this s5-0))) + ) + ) + ) 0 (none) ) @@ -539,7 +705,7 @@ ) ) ) - (set! (-> *wheel-trail-info* tex-id) (the-as uint (-> s1-0 tread-tid))) + (set! (-> *wheel-trail-info* tex-id) (-> s1-0 tread-tid)) ) (let ((s1-1 (handle->process (-> s2-0 tread-tracker)))) (when s1-1 @@ -569,35 +735,24 @@ (cond ((>= (- (-> s5-0 cur-time) (-> s2-0 tread-time)) (the-as uint 50)) (set! (-> s2-0 tread-time) (-> s5-0 cur-time)) - (let* ((a0-42 (-> (the-as process-focusable s1-1) root)) - (t9-13 (method-of-object a0-42 y-angle)) - ) + (add-crumb-with-offset-and-uu + (-> (the-as tire-trail-tracker s1-1) trail) (-> s5-0 surface-pos) (-> s5-0 offset) - 0 - (t9-13 a0-42) + 0.0 ) ) (else - (let* ((a0-43 (-> (the-as process-focusable s1-1) root)) - (t9-14 (method-of-object a0-43 global-y-angle-to-point)) - (a1-29 (-> s5-0 surface-pos)) - ) - (-> s5-0 offset) - 0 - (t9-14 a0-43 a1-29) - ) + (tire-trail-method-23 (-> (the-as tire-trail-tracker s1-1) trail) (-> s5-0 surface-pos) (-> s5-0 offset) 0.0) ) ) (when (not (logtest? (-> s2-0 flags) 2)) (+! (-> s5-0 surface-pos y) -2048.0) - (let* ((a0-44 (-> (the-as process-focusable s1-1) root)) - (t9-15 (method-of-object a0-44 y-angle)) - ) + (add-crumb-with-offset-and-uu + (-> (the-as tire-trail-tracker s1-1) trail) (-> s5-0 surface-pos) (-> s5-0 zero-offset) - 0 - (t9-15 a0-44) + 0.0 ) (set! (-> s2-0 tread-time) (+ (-> s5-0 cur-time) -50)) ) @@ -606,22 +761,18 @@ (when (logtest? (-> s2-0 flags) 2) (set! (-> s2-0 tread-time) (-> s5-0 cur-time)) (+! (-> s5-0 surface-pos y) -2048.0) - (let* ((a0-45 (-> (the-as process-focusable s1-1) root)) - (t9-16 (method-of-object a0-45 y-angle)) - ) + (add-crumb-with-offset-and-uu + (-> (the-as tire-trail-tracker s1-1) trail) (-> s5-0 surface-pos) (-> s5-0 zero-offset) - 0 - (t9-16 a0-45) + 0.0 ) (+! (-> s5-0 surface-pos y) 2048.0) - (let* ((a0-46 (-> (the-as process-focusable s1-1) root)) - (t9-17 (method-of-object a0-46 y-angle)) - ) + (add-crumb-with-offset-and-uu + (-> (the-as tire-trail-tracker s1-1) trail) (-> s5-0 surface-pos) (-> s5-0 offset) - 0 - (t9-17 a0-46) + 0.0 ) (set! (-> s2-0 tread-time) (+ (-> s5-0 cur-time) -50)) ) diff --git a/goal_src/jak3/levels/desert/wvehicle/wvehicle-part.gc b/goal_src/jak3/levels/desert/wvehicle/wvehicle-part.gc index 5feff8cf50..2c4a94b02f 100644 --- a/goal_src/jak3/levels/desert/wvehicle/wvehicle-part.gc +++ b/goal_src/jak3/levels/desert/wvehicle/wvehicle-part.gc @@ -894,7 +894,7 @@ (when (or (zero? *curve-toad-linear-up-red*) (!= loading-level global)) (set! *curve-toad-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-toad-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-toad-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-toad-linear-up-red* pts data 0 first) 0.0) @@ -954,15 +954,13 @@ (set! (-> *toad-grenade-trail* uv-repeat-dist) 16384000.0) -(set! (-> *toad-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *toad-grenade-trail* lie-mode) (lie-mode appearance0)) (set! (-> *toad-grenade-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *toad-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *toad-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *toad-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *toad-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *toad-grenade-trail* width-curve) (the-as curve2d-piecewise *curve-grenade-linear-toad-trail*)) diff --git a/goal_src/jak3/levels/factory/factory-manager.gc b/goal_src/jak3/levels/factory/factory-manager.gc index c8f283eaee..30233164f4 100644 --- a/goal_src/jak3/levels/factory/factory-manager.gc +++ b/goal_src/jak3/levels/factory/factory-manager.gc @@ -42,7 +42,7 @@ ) -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-vehicle) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-vehicle) (arg0 process-focusable)) #f ) @@ -72,15 +72,13 @@ (set! (-> *factory-fighter-trail* uv-repeat-dist) 16384000.0) -(set! (-> *factory-fighter-trail* lie-mode) (the-as uint 0)) +(set! (-> *factory-fighter-trail* lie-mode) (lie-mode appearance0)) (set! (-> *factory-fighter-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *factory-fighter-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *factory-fighter-trail* tex-id) (the-as uint #x100300)) + (set! (-> *factory-fighter-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *factory-fighter-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *factory-fighter-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*)) @@ -1167,7 +1165,7 @@ (let* ((v1-38 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-vehicle (+ v1-38 8192) 1)) diff --git a/goal_src/jak3/levels/forest/forest-kill-plants.gc b/goal_src/jak3/levels/forest/forest-kill-plants.gc index 4e72dbc86b..d67bd31061 100644 --- a/goal_src/jak3/levels/forest/forest-kill-plants.gc +++ b/goal_src/jak3/levels/forest/forest-kill-plants.gc @@ -196,15 +196,13 @@ (set! (-> *eco-green-trail* uv-repeat-dist) 102399.99) -(set! (-> *eco-green-trail* lie-mode) (the-as uint 3)) +(set! (-> *eco-green-trail* lie-mode) (lie-mode use-two-strips)) (set! (-> *eco-green-trail* max-age) (seconds 2)) (if #f - (set! (-> *eco-green-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *eco-green-trail* tex-id) (the-as uint #x500800)) + (set! (-> *eco-green-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *eco-green-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) (set! (-> *eco-green-trail* width-curve) (the-as curve2d-piecewise *eco-width-curve*)) @@ -231,11 +229,11 @@ ;; WARN: Return type mismatch object vs symbol. -(defmethod light-trail-tracker-method-17 ((this eco-green-trail-tracker) (arg0 process-focusable)) +(defmethod should-track? ((this eco-green-trail-tracker) (arg0 process-focusable)) (the-as symbol (and *target* (focus-test? *target* board) (< 0.0 (-> *target* fact eco-green)))) ) -(defmethod light-trail-tracker-method-16 ((this eco-green-trail-tracker) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this eco-green-trail-tracker) (arg0 process-focusable) (arg1 vector)) (if *target* (vector<-cspace! arg1 (-> *target* node-list data 37)) ) @@ -357,7 +355,7 @@ (let* ((v1-62 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* eco-green-trail-tracker (+ v1-62 8192) 1)) diff --git a/goal_src/jak3/levels/glider/glider-ring.gc b/goal_src/jak3/levels/glider/glider-ring.gc index bff26def1d..e17529591a 100644 --- a/goal_src/jak3/levels/glider/glider-ring.gc +++ b/goal_src/jak3/levels/glider/glider-ring.gc @@ -14,7 +14,7 @@ (when (or (zero? *curve-glider-ring-linear-up-red*) (!= loading-level global)) (set! *curve-glider-ring-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-glider-ring-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-glider-ring-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-glider-ring-linear-up-red* pts data 0 first) 0.0) @@ -74,15 +74,13 @@ (set! (-> *glider-ring-trail* uv-repeat-dist) 16384000.0) -(set! (-> *glider-ring-trail* lie-mode) (the-as uint 0)) +(set! (-> *glider-ring-trail* lie-mode) (lie-mode appearance0)) (set! (-> *glider-ring-trail* max-age) (seconds 1)) (if #f - (set! (-> *glider-ring-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *glider-ring-trail* tex-id) (the-as uint #x100300)) + (set! (-> *glider-ring-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *glider-ring-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *glider-ring-trail* width-curve) (the-as curve2d-piecewise *curve-glider-ring-linear-trail*)) @@ -108,7 +106,7 @@ ) -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-glider-ring) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-glider-ring) (arg0 process-focusable)) #f ) @@ -691,7 +689,7 @@ (let* ((v1-64 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) diff --git a/goal_src/jak3/levels/mine/mine-platforms.gc b/goal_src/jak3/levels/mine/mine-platforms.gc index 854e312086..e20f5509f2 100644 --- a/goal_src/jak3/levels/mine/mine-platforms.gc +++ b/goal_src/jak3/levels/mine/mine-platforms.gc @@ -339,7 +339,7 @@ (when (or (zero? *drill-loop-mid-curve*) (!= loading-level global)) (set! *drill-loop-mid-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *drill-loop-mid-curve* 3 'loading-level (the-as int #t)) + (allocate! *drill-loop-mid-curve* 3 'loading-level #t) ) (set! (-> *drill-loop-mid-curve* pts data 0 first) 0.0) @@ -365,7 +365,7 @@ (let ((f0-3 (* 0.07692308 (+ -15.0 f30-0)))) 0.0 0.0 - (let* ((f26-0 (curve2d-method-9 *drill-loop-mid-curve* f0-3 3)) + (let* ((f26-0 (evaluate *drill-loop-mid-curve* f0-3 (loop-behavior use-default))) (f28-0 (lerp -0.5 0.25 f26-0)) ) (sound-play-by-name @@ -393,7 +393,7 @@ (let ((f0-15 (* 0.055555556 (+ -28.0 f30-0)))) 0.0 0.0 - (let* ((f26-1 (curve2d-method-9 *drill-loop-mid-curve* f0-15 3)) + (let* ((f26-1 (evaluate *drill-loop-mid-curve* f0-15 (loop-behavior use-default))) (f28-1 (lerp -0.5 0.25 f26-1)) ) (sound-play-by-name diff --git a/goal_src/jak3/levels/mine/prebot-setup.gc b/goal_src/jak3/levels/mine/prebot-setup.gc index 42c47138b2..0d8e224188 100644 --- a/goal_src/jak3/levels/mine/prebot-setup.gc +++ b/goal_src/jak3/levels/mine/prebot-setup.gc @@ -502,7 +502,7 @@ (when (or (zero? *prebot-sword-color-curve*) (!= loading-level global)) (set! *prebot-sword-color-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *prebot-sword-color-curve* 2 'loading-level (the-as uint #t)) + (allocate! *prebot-sword-color-curve* 2 'loading-level #t) ) (set! (-> *prebot-sword-color-curve* pts data 0 first) 0.0) @@ -527,7 +527,7 @@ (when (or (zero? *prebot-sword-white-red-curve*) (!= loading-level global)) (set! *prebot-sword-white-red-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *prebot-sword-white-red-curve* 3 'loading-level (the-as uint #t)) + (allocate! *prebot-sword-white-red-curve* 3 'loading-level #t) ) (set! (-> *prebot-sword-white-red-curve* pts data 0 first) 0.0) @@ -595,15 +595,15 @@ (set! (-> *prebot-sword-color-array* uv-repeat-dist) 40960.0) -(set! (-> *prebot-sword-color-array* lie-mode) (the-as uint 0)) +(set! (-> *prebot-sword-color-array* lie-mode) (lie-mode appearance0)) (set! (-> *prebot-sword-color-array* max-age) (seconds 0.3)) (if #f (set! (-> *prebot-sword-color-array* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (lookup-texture-id-by-name (the-as string #f) (the-as string #f)) ) - (set! (-> *prebot-sword-color-array* tex-id) (the-as uint #x100300)) + (set! (-> *prebot-sword-color-array* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *prebot-sword-color-array* width-curve) (the-as curve2d-piecewise *prebot-sword-width-curve*)) @@ -681,12 +681,10 @@ (set! (-> s5-1 joint0) 3) (set! (-> s5-1 joint1) 5) (set! (-> s5-1 appearance) *prebot-sword-color-array*) - (set! (-> *prebot-sword-color-array* tex-id) - (the-as uint (lookup-texture-id-by-name "sword-trail-low" (the-as string #f))) - ) + (set! (-> *prebot-sword-color-array* tex-id) (lookup-texture-id-by-name "sword-trail-low" (the-as string #f))) (let* ((v1-43 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* weapon-trail-tracker (+ v1-43 8192) 1)) diff --git a/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc b/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc index 99890fd97d..cb0869a647 100644 --- a/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc +++ b/goal_src/jak3/levels/wascity/bbush/des-bush-time-chase.gc @@ -305,15 +305,13 @@ (set! (-> *bb-timer-chase-trail* uv-repeat-dist) 163840.0) -(set! (-> *bb-timer-chase-trail* lie-mode) (the-as uint 0)) +(set! (-> *bb-timer-chase-trail* lie-mode) (lie-mode appearance0)) (set! (-> *bb-timer-chase-trail* max-age) (seconds 4)) (if #f - (set! (-> *bb-timer-chase-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *bb-timer-chase-trail* tex-id) (the-as uint #x100300)) + (set! (-> *bb-timer-chase-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *bb-timer-chase-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *bb-timer-chase-trail* width-curve) (the-as curve2d-piecewise *curve-linear-up*)) @@ -404,12 +402,12 @@ ((-> self start-tracking?) (when (time-elapsed? (-> self time-offset) (seconds 0.05)) (set-time! (-> self time-offset)) - (when (light-trail-tracker-method-17 self (the-as process-focusable gp-1)) + (when (should-track? self (the-as process-focusable gp-1)) (set! (-> self trail start-marker) (the-as uint 0)) (set! (-> self trail end-marker) (the-as uint 0)) - (light-trail-method-11 + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) 0 ) ) @@ -432,7 +430,7 @@ :post light-trail-tracker-common-post ) -(defmethod light-trail-tracker-method-19 ((this timer-chase-trail)) +(defmethod should-draw? ((this timer-chase-trail)) #t ) @@ -445,13 +443,13 @@ (set! (-> gp-1 tracked-obj) (process->handle self)) (set! (-> gp-1 appearance) *bb-timer-chase-trail*) (set! (-> *bb-timer-chase-trail* tex-id) - (the-as uint (lookup-texture-id-by-name "des-bush-timer-chase-trail" (the-as string #f))) + (lookup-texture-id-by-name "des-bush-timer-chase-trail" (the-as string #f)) ) (set! (-> gp-1 max-num-crumbs) 500) (set! (-> gp-1 track-immediately?) #f) (let* ((v1-18 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-0 (get-process *default-dead-pool* timer-chase-trail (+ v1-18 8192) 1)) diff --git a/goal_src/jak3/levels/wascity/dm-flyer.gc b/goal_src/jak3/levels/wascity/dm-flyer.gc index ac2f6a1c69..4be6c1f2f4 100644 --- a/goal_src/jak3/levels/wascity/dm-flyer.gc +++ b/goal_src/jak3/levels/wascity/dm-flyer.gc @@ -35,7 +35,7 @@ (when (or (zero? *dm-flyer-curve-linear-up-red*) (!= loading-level global)) (set! *dm-flyer-curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *dm-flyer-curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *dm-flyer-curve-linear-up-red* 2 'loading-level #f) ) (set! (-> *dm-flyer-curve-linear-up-red* pts data 0 first) 0.0) @@ -95,15 +95,13 @@ (set! (-> *dm-flyer-missile-trail* uv-repeat-dist) 16384000.0) -(set! (-> *dm-flyer-missile-trail* lie-mode) (the-as uint 0)) +(set! (-> *dm-flyer-missile-trail* lie-mode) (lie-mode appearance0)) (set! (-> *dm-flyer-missile-trail* max-age) (seconds 1)) (if #f - (set! (-> *dm-flyer-missile-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *dm-flyer-missile-trail* tex-id) (the-as uint #x100300)) + (set! (-> *dm-flyer-missile-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *dm-flyer-missile-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *dm-flyer-missile-trail* width-curve) @@ -572,7 +570,7 @@ (set! (-> s5-5 track-immediately?) #t) (let* ((v0-12 (estimate-light-trail-mem-usage (the-as uint (-> s5-5 max-num-crumbs)) - (the-as uint (= (-> s5-5 appearance lie-mode) 3)) + (the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-12 8192) 1)) diff --git a/goal_src/jak3/levels/wascity/maker-projectile.gc b/goal_src/jak3/levels/wascity/maker-projectile.gc index 3e8ea8e3b2..4fc10fb159 100644 --- a/goal_src/jak3/levels/wascity/maker-projectile.gc +++ b/goal_src/jak3/levels/wascity/maker-projectile.gc @@ -29,7 +29,7 @@ (when (or (zero? *curve-maker-linear-up-red*) (!= loading-level global)) (set! *curve-maker-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-maker-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-maker-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-maker-linear-up-red* pts data 0 first) 0.0) @@ -89,15 +89,13 @@ (set! (-> *maker-grenade-trail* uv-repeat-dist) 16384000.0) -(set! (-> *maker-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *maker-grenade-trail* lie-mode) (lie-mode appearance0)) (set! (-> *maker-grenade-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *maker-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *maker-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *maker-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *maker-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *maker-grenade-trail* width-curve) (the-as curve2d-piecewise *curve-maker-grenade-linear-trail*)) @@ -873,7 +871,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-32 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-32 8192) 1)) diff --git a/goal_src/jak3/levels/wascity/wasdef-manager.gc b/goal_src/jak3/levels/wascity/wasdef-manager.gc index f50017292e..e8947f495f 100644 --- a/goal_src/jak3/levels/wascity/wasdef-manager.gc +++ b/goal_src/jak3/levels/wascity/wasdef-manager.gc @@ -407,7 +407,7 @@ (when (or (zero? *curve-maker-entry-linear-up-red*) (!= loading-level global)) (set! *curve-maker-entry-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-maker-entry-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-maker-entry-linear-up-red* 2 'loading-level #f) ) (set! (-> *curve-maker-entry-linear-up-red* pts data 0 first) 0.0) @@ -467,15 +467,13 @@ (set! (-> *maker-entry-trail* uv-repeat-dist) 16384000.0) -(set! (-> *maker-entry-trail* lie-mode) (the-as uint 0)) +(set! (-> *maker-entry-trail* lie-mode) (lie-mode appearance0)) (set! (-> *maker-entry-trail* max-age) (seconds 0.5)) (if #f - (set! (-> *maker-entry-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *maker-entry-trail* tex-id) (the-as uint #x100300)) + (set! (-> *maker-entry-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *maker-entry-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) (set! (-> *maker-entry-trail* width-curve) (the-as curve2d-piecewise *curve-maker-entry-linear-trail*)) @@ -2367,7 +2365,7 @@ (let* ((v1-104 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-104 8192) 1)) diff --git a/test/decompiler/reference/jak3/engine/common-obs/curves_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/curves_REF.gc index be28d83c04..660fef4ac5 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/curves_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/curves_REF.gc @@ -3,6 +3,7 @@ ;; definition of type float-pair (deftype float-pair (structure) + "Two floats. Specifies one point on a piecewise linear curve." ((first float) (second float) (x float :overlay-at first) @@ -27,6 +28,7 @@ ;; definition of type float-pair-array (deftype float-pair-array (inline-array-class) + "Array of points used to make a piecewise linear curve." ((data float-pair :inline :dynamic) ) ) @@ -50,9 +52,13 @@ ;; definition of type curve2d (deftype curve2d (basic) + "Interface for evaluating a 2d curve. +The input is a float (x-position) and the output is a float (y-position). +The curve is over (0, 1). Values outside of the range are either clamped +or wrapped depending on the loop-behavior flag." () (:methods - (curve2d-method-9 (_type_ float int) float) + (evaluate (_type_ float loop-behavior) float) ) ) @@ -69,9 +75,11 @@ ;; definition of type curve-color (deftype curve-color (basic) + "Interface for evaluating a color curve. The input is a float, representing +progress through the curve, and the result is a floating point rgba color." () (:methods - (curve-color-method-9 (_type_ float rgbaf int) rgbaf) + (evaluate (_type_ float rgbaf loop-behavior) rgbaf) ) ) @@ -88,11 +96,13 @@ ;; definition of type curve2d-piecewise (deftype curve2d-piecewise (curve2d) + "Implementation of 2d-curve for a piecewise linear curve. +Not particularly efficient - each evaluation needs to check each point." ((pts float-pair-array) - (default-loop-behavior uint64) + (default-loop-behavior loop-behavior) ) (:methods - (curve2d-piecewise-method-10 (_type_ int symbol int) none) + (allocate! (_type_ int symbol symbol) none) (curve2d-piecewise-method-11 (_type_) none) ) ) @@ -112,6 +122,9 @@ ;; definition of type curve2d-fast (deftype curve2d-fast (curve2d) + "Implementation of 2d piecewise linear curve which tries to be faster. +While it is faster, it places the huge restriction that you can only have 4 points. +Note that the xs should be negative here." ((xs vector :inline) (ys vector :inline) (one-over-x-deltas vector :inline) @@ -134,6 +147,7 @@ ;; definition for function rgbaf-lerp! (defun rgbaf-lerp! ((arg0 rgbaf) (arg1 rgbaf) (arg2 rgbaf) (arg3 float)) + "Lerp all four components of rgba." (vector-lerp! arg0 arg1 arg2 arg3) (set! (-> arg0 w) (lerp (-> arg1 w) (-> arg2 w) arg3)) arg0 @@ -141,6 +155,9 @@ ;; definition of type curve-color-fast (deftype curve-color-fast (curve-color) + "Implementation of color curve which tries to be faster. +While it is faster, it again has the restriction that you only +get 4 piecewise sections." ((xs vector :inline) (ys vector 4 :inline) (one-over-x-deltas vector :inline) @@ -163,6 +180,8 @@ ;; definition of type color-pair (deftype color-pair (structure) + "Single section of a piecewise linear color curve. +Unlike the fast version, this stores x values exactly like you'd expect." ((first float) (second rgbaf :inline) (x float :overlay-at first) @@ -187,6 +206,7 @@ ;; definition of type color-pair-array (deftype color-pair-array (inline-array-class) + "Array of points for piecewise linear color curve." ((data color-pair :inline :dynamic) ) ) @@ -210,11 +230,12 @@ ;; definition of type curve-color-piecewise (deftype curve-color-piecewise (curve-color) + "Implementation of curve-color." ((pts color-pair-array) - (default-loop-behavior uint64) + (default-loop-behavior loop-behavior) ) (:methods - (curve-color-piecewise-method-10 (_type_ int symbol uint) none) + (allocate! (_type_ int symbol symbol) none) ) ) @@ -233,13 +254,13 @@ ;; definition for method 10 of type curve2d-piecewise ;; WARN: Return type mismatch int vs none. -(defmethod curve2d-piecewise-method-10 ((this curve2d-piecewise) (arg0 int) (arg1 symbol) (arg2 int)) +(defmethod allocate! ((this curve2d-piecewise) (arg0 int) (arg1 symbol) (arg2 symbol)) + "Allocate memory for points." (set! (-> this pts) ((method-of-type float-pair-array new) arg1 float-pair-array arg0)) - (set! (-> this default-loop-behavior) (the-as uint (if arg2 - 0 - 1 - ) - ) + (set! (-> this default-loop-behavior) (if arg2 + (loop-behavior wrap) + (loop-behavior clamp) + ) ) 0 (none) @@ -247,13 +268,13 @@ ;; definition for method 10 of type curve-color-piecewise ;; WARN: Return type mismatch int vs none. -(defmethod curve-color-piecewise-method-10 ((this curve-color-piecewise) (arg0 int) (arg1 symbol) (arg2 uint)) +(defmethod allocate! ((this curve-color-piecewise) (arg0 int) (arg1 symbol) (arg2 symbol)) + "Allocate memory for points." (set! (-> this pts) ((method-of-type color-pair-array new) arg1 color-pair-array arg0)) - (set! (-> this default-loop-behavior) (the-as uint (if arg2 - 0 - 1 - ) - ) + (set! (-> this default-loop-behavior) (if arg2 + (loop-behavior wrap) + (loop-behavior clamp) + ) ) 0 (none) @@ -261,20 +282,19 @@ ;; definition for method 9 of type curve-color-piecewise ;; INFO: Used lq/sq -(defmethod curve-color-method-9 ((this curve-color-piecewise) (arg0 float) (arg1 rgbaf) (arg2 int)) +(defmethod evaluate ((this curve-color-piecewise) (arg0 float) (arg1 rgbaf) (arg2 loop-behavior)) + "Compute value of curve at the given position." (when (or (< 1.0 arg0) (< arg0 0.0)) - (if (= arg2 3) - (set! arg2 (the-as int (-> this default-loop-behavior))) - ) - (let ((v1-8 arg2)) - (cond - ((zero? v1-8) - (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) - ) - ((= v1-8 1) - (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) - ) + (if (= arg2 (loop-behavior use-default)) + (set! arg2 (-> this default-loop-behavior)) ) + (case arg2 + (((loop-behavior wrap)) + (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) + ) + (((loop-behavior clamp)) + (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) + ) ) ) (when (= arg0 0.0) @@ -298,20 +318,19 @@ ) ;; definition for method 9 of type curve2d-piecewise -(defmethod curve2d-method-9 ((this curve2d-piecewise) (arg0 float) (arg1 int)) +(defmethod evaluate ((this curve2d-piecewise) (arg0 float) (arg1 loop-behavior)) + "Compute value of curve at the given position." (when (or (< 1.0 arg0) (< arg0 0.0)) - (if (= arg1 3) - (set! arg1 (the-as int (-> this default-loop-behavior))) - ) - (let ((v1-8 arg1)) - (cond - ((zero? v1-8) - (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) - ) - ((= v1-8 1) - (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) - ) + (if (= arg1 (loop-behavior use-default)) + (set! arg1 (-> this default-loop-behavior)) ) + (case arg1 + (((loop-behavior wrap)) + (set! arg0 (- arg0 (* (the float (the int (/ arg0 1.0))) 1.0))) + ) + (((loop-behavior clamp)) + (set! arg0 (fmax 0.0 (fmin 1.0 arg0))) + ) ) ) (if (= arg0 0.0) @@ -334,7 +353,8 @@ ;; definition for function evaluate-curve-fast ;; WARN: Return type mismatch number vs float. -(defun evaluate-curve-fast ((arg0 curve2d-fast) (arg1 rgbaf) (arg2 rgbaf)) +(defun evaluate-curve-fast ((arg0 curve2d-fast) (arg1 float)) + "Evaluate a curve2d-fast at the given value." (local-vars (v0-0 number)) (rlet ((acc :class vf) (vf0 :class vf) @@ -346,7 +366,7 @@ (vf29 :class vf) ) (init-vf0-vector) - (let ((a2-1 (new 'stack-no-clear 'vector)) + (let ((a2-0 (new 'stack-no-clear 'vector)) (v1-0 (new 'stack-no-clear 'vector)) ) (.mov vf27 arg1) @@ -358,10 +378,10 @@ (.add.x.vf vf28 vf24 vf27) (.mul.w.vf acc vf25 vf0) (.add.mul.vf vf29 vf28 vf26 acc) - (.svf (&-> a2-1 quad) vf28) + (.svf (&-> a2-0 quad) vf28) (.svf (&-> v1-0 quad) vf29) - (let ((a0-1 (-> a2-1 z)) - (a1-1 (-> a2-1 y)) + (let ((a0-1 (-> a2-0 z)) + (a1-1 (-> a2-0 y)) ) (nop!) (b! (>= (the-as int a0-1) 0) cfg-3 :delay (set! v0-0 (-> v1-0 z))) @@ -376,7 +396,8 @@ ;; definition for method 9 of type curve2d-fast ;; WARN: Return type mismatch number vs float. -(defmethod curve2d-method-9 ((this curve2d-fast) (arg0 float) (arg1 int)) +(defmethod evaluate ((this curve2d-fast) (arg0 float) (arg1 loop-behavior)) + "Compute value of curve at the given position." (local-vars (v0-0 number)) (rlet ((acc :class vf) (vf0 :class vf) @@ -419,7 +440,8 @@ ) ;; definition for function evaluate-color-curve-fast -(defun evaluate-color-curve-fast ((arg0 curve-color-fast) (arg1 rgbaf) (arg2 rgbaf)) +(defun evaluate-color-curve-fast ((arg0 curve-color-fast) (arg1 float) (arg2 rgbaf)) + "Evaluate a color-curve-fast at the given value." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -474,7 +496,8 @@ ) ;; definition for method 9 of type curve-color-fast -(defmethod curve-color-method-9 ((this curve-color-fast) (arg0 float) (arg1 rgbaf) (arg2 int)) +(defmethod evaluate ((this curve-color-fast) (arg0 float) (arg1 rgbaf) (arg2 loop-behavior)) + "Compute value of curve at the given position." (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -537,22 +560,21 @@ ) ;; definition for function rgba<-rgbaf -;; WARN: Return type mismatch rgba vs int. (defun rgba<-rgbaf ((arg0 rgba) (arg1 rgbaf)) - (the-as int (copy-and-set-field - (copy-and-set-field - (copy-and-set-field - (copy-and-set-field arg0 r (the int (* 128.0 (-> arg1 x)))) - g - (the int (* 128.0 (-> arg1 y))) - ) - b - (the int (* 128.0 (-> arg1 z))) - ) - a - (the int (* 128.0 (-> arg1 w))) - ) - ) + "Convert rgbaf to rgba. Seems like the input rgba's value is not used in any way." + (copy-and-set-field + (copy-and-set-field + (copy-and-set-field + (copy-and-set-field arg0 r (the int (* 128.0 (-> arg1 x)))) + g + (the int (* 128.0 (-> arg1 y))) + ) + b + (the int (* 128.0 (-> arg1 z))) + ) + a + (the int (* 128.0 (-> arg1 w))) + ) ) ;; failed to figure out what this is: @@ -588,7 +610,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-linear-up-hold*) (!= loading-level global)) (set! *curve-linear-up-hold* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-linear-up-hold* 2 'loading-level (the-as int #f)) + (allocate! *curve-linear-up-hold* 2 'loading-level #f) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc index 8ff76ed73f..5702c70063 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc @@ -64,7 +64,7 @@ ;; failed to figure out what this is: (when (or (zero? *water-simple-alpha-curve-in*) (!= loading-level global)) (set! *water-simple-alpha-curve-in* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-in* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-in* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -82,7 +82,7 @@ ;; failed to figure out what this is: (when (or (zero? *growing-curve*) (!= loading-level global)) (set! *growing-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *growing-curve* 2 'loading-level (the-as int #f)) + (allocate! *growing-curve* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -100,7 +100,7 @@ ;; failed to figure out what this is: (when (or (zero? *water-simple-alpha-curve-fade-out*) (!= loading-level global)) (set! *water-simple-alpha-curve-fade-out* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-fade-out* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-fade-out* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -118,7 +118,7 @@ ;; failed to figure out what this is: (when (or (zero? *color-curve-tan-brown*) (!= loading-level global)) (set! *color-curve-tan-brown* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *color-curve-tan-brown* 2 'loading-level (the-as uint #f)) + (allocate! *color-curve-tan-brown* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -190,17 +190,15 @@ (set! (-> *water-wake-trail* uv-repeat-dist) 40960.0) ;; failed to figure out what this is: -(set! (-> *water-wake-trail* lie-mode) (the-as uint 1)) +(set! (-> *water-wake-trail* lie-mode) (lie-mode appearance1)) ;; failed to figure out what this is: (set! (-> *water-wake-trail* max-age) (seconds 3)) ;; failed to figure out what this is: (if #f - (set! (-> *water-wake-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *water-wake-trail* tex-id) (the-as uint #x500800)) + (set! (-> *water-wake-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *water-wake-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) ;; failed to figure out what this is: @@ -243,7 +241,7 @@ (let* ((v1-18 (estimate-light-trail-mem-usage (the-as uint (-> s5-0 max-num-crumbs)) - (the-as uint (= (-> s5-0 appearance lie-mode) 3)) + (the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-0 (get-process *default-dead-pool* light-trail-tracker-water (+ v1-18 8192) 1)) diff --git a/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc index 0783a92797..0f614f338f 100644 --- a/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/generic/lightning/lightning-new_REF.gc @@ -667,10 +667,10 @@ (let ((v1-2 arg0)) (cond ((zero? v1-2) - (curve2d-method-9 arg3 (/ arg2 arg4) 3) + (evaluate arg3 (/ arg2 arg4) (loop-behavior use-default)) ) ((= v1-2 1) - (curve2d-method-9 arg3 arg1 3) + (evaluate arg3 arg1 (loop-behavior use-default)) ) ((= v1-2 2) (let* ((v1-6 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -877,7 +877,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails-h_REF.gc index 148b116ea0..67da9ee735 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails-h_REF.gc @@ -42,8 +42,8 @@ (uv-mode uint64) (uv-repeat-dist float) (max-age time-frame) - (tex-id uint32) - (lie-mode uint64) + (tex-id texture-id) + (lie-mode lie-mode) (lie-vector vector :inline) (zbuffer? symbol) (use-tape-mode? symbol) @@ -101,7 +101,7 @@ ) (format #t "[~8x] ~A~%" this 'light-trail-breadcrumb) (format #t "~1Tpos: #~%" (-> this pos)) - (format #t "~1Tbirth-time: ~D~%" (-> this pos w)) + (format #t "~1Tbirth-time: ~D~%" (-> this birth-time)) (label cfg-4) this ) @@ -131,33 +131,33 @@ ;; definition of type light-trail (deftype light-trail (basic) - ((crumb-array (array light-trail-breadcrumb)) + ((crumb-array (array uint8)) (crumb-size uint8) (crumb-count int16) (max-crumb-count int16) (appearance light-trail-composition) (start-marker uint64) (end-marker uint64) - (decision uint64) + (decision light-trail-decision) (total-distance-traveled float) (strip prim-strip) (strip2 prim-strip) (cache-vector vector 4 :inline) ) (:methods - (light-trail-method-9 (_type_ light-trail-composition int) none) - (light-trail-method-10 (_type_) none) - (light-trail-method-11 (_type_ vector time-frame) int) - (light-trail-method-12 (_type_) none) - (light-trail-method-13 (_type_) int) - (light-trail-method-14 (_type_) none) + (setup! (_type_ light-trail-composition int) none) + (reset! (_type_) none) + (add-crumb! (_type_ vector time-frame) int) + (build-prim-strip! (_type_) none) + (common-trans! (_type_) int) + (expire-old-points! (_type_) none) (light-trail-method-15 (_type_) none) - (add-vert! (_type_ prim-strip vector float float float) none) - (light-trail-method-17 (_type_ vector float float vector float) symbol) - (light-trail-method-18 (_type_ light-trail-breadcrumb int vector vector) none) - (light-trail-method-19 (_type_ float int) none) + (add-vert-to-prim-strip! (_type_ prim-strip vector rgba float float) none) + (add-tri-pair-to-prim! (_type_ vector rgba float vector float) symbol) + (calc-vertex-pos! (_type_ light-trail-breadcrumb int vector vector) none) + (crumb-age-out-callback (_type_ float int) none) (reset-crumbs! (_type_) none) - (light-trail-method-21 (_type_ vector) none) + (replace-last-crumb! (_type_ vector) none) ) ) @@ -198,7 +198,7 @@ ) (format #t "[~8x] ~A~%" this 'weapon-trail-crumb) (format #t "~1Tpos: #~%" (-> this pos)) - (format #t "~1Tbirth-time: ~D~%" (-> this pos w)) + (format #t "~1Tbirth-time: ~D~%" (-> this birth-time)) (format #t "~1Toffset: #~%" (-> this offset)) (label cfg-4) this @@ -208,7 +208,7 @@ (deftype weapon-trail (light-trail) () (:methods - (weapon-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) + (add-crumb-with-offset (_type_ vector vector) light-trail-breadcrumb) (weapon-trail-method-23 (_type_ vector vector) none) ) ) @@ -250,7 +250,7 @@ ) (format #t "[~8x] ~A~%" this 'tread-trail-crumb) (format #t "~1Tpos: #~%" (-> this pos)) - (format #t "~1Tbirth-time: ~D~%" (-> this pos w)) + (format #t "~1Tbirth-time: ~D~%" (-> this birth-time)) (format #t "~1Tnormal: #~%" (-> this normal)) (label cfg-4) this @@ -260,8 +260,8 @@ (deftype tread-trail (light-trail) () (:methods - (tread-trail-method-22 (_type_ vector vector) light-trail-breadcrumb) - (tread-trail-method-23 (_type_ vector vector) light-trail-breadcrumb) + (add-crumb-with-offset (_type_ vector vector) none) + (tread-trail-method-23 (_type_ vector vector) none) ) ) @@ -350,11 +350,11 @@ die ) (:methods - (light-trail-tracker-method-16 (_type_ process-focusable vector) vector) - (light-trail-tracker-method-17 (_type_ process-focusable) symbol) - (light-trail-tracker-method-18 (_type_ process-focusable) symbol) - (light-trail-tracker-method-19 (_type_) symbol) - (light-trail-tracker-method-20 (_type_ vector) none) + (get-tracked-object-pos (_type_ process-focusable vector) vector) + (should-track? (_type_ process-focusable) symbol) + (should-end? (_type_ process-focusable) symbol) + (should-draw? (_type_) symbol) + (add-crumb! (_type_ vector) none) ) ) @@ -432,13 +432,13 @@ (set! (-> self next-line-check-time) 0) (set! (-> self last-add-frame-val) (the-as uint 0)) (set! (-> self offscreen?) #f) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (when (-> arg0 track-immediately?) (let ((gp-1 (handle->process (-> self tracked-object)))) - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-1)) - (light-trail-method-11 + (if (should-track? self (the-as process-focusable gp-1)) + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) (seconds 10000) ) ) @@ -456,7 +456,7 @@ (set! (-> self joint0) (-> arg0 joint0)) (set! (-> self joint1) (-> arg0 joint1)) (set! (-> self offscreen?) #f) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (go-virtual tracking) ) @@ -467,7 +467,7 @@ (set! (-> self offscreen?) #f) (set! (-> self next-line-check-time) 0) (set! (-> self last-add-frame-val) (the-as uint 0)) - (light-trail-method-9 (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) + (setup! (-> self trail) (-> arg0 appearance) (-> arg0 max-num-crumbs)) (go-virtual tracking) ) @@ -514,7 +514,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc index 0cfc2e20cf..9253a49f56 100644 --- a/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/sprite/particles/light-trails_REF.gc @@ -3,45 +3,39 @@ ;; definition for method 9 of type light-trail ;; WARN: Return type mismatch int vs none. -(defmethod light-trail-method-9 ((this light-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this light-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this appearance) arg0) (set! (-> this crumb-size) (the-as uint (max 16 (the-as int (-> this crumb-size))))) - (set! (-> this crumb-array) - (the-as - (array light-trail-breadcrumb) - (new 'process 'boxed-array uint8 (* arg1 (the-as int (-> this crumb-size)))) - ) - ) + (set! (-> this crumb-array) (new 'process 'boxed-array uint8 (* arg1 (the-as int (-> this crumb-size))))) (set! (-> this max-crumb-count) arg1) (set! (-> this crumb-count) 0) - (set! (-> this strip) - (new 'process 'prim-strip (* arg1 2) (the-as texture-id (-> arg0 tex-id)) (the-as string #f)) - ) + (set! (-> this strip) (new 'process 'prim-strip (* arg1 2) (-> arg0 tex-id) (the-as string #f))) (set! (-> this strip2) #f) - (if (= (-> this appearance lie-mode) 3) - (set! (-> this strip2) - (new 'process 'prim-strip (* arg1 2) (the-as texture-id (-> arg0 tex-id)) (the-as string #f)) - ) + (if (= (-> this appearance lie-mode) (lie-mode use-two-strips)) + (set! (-> this strip2) (new 'process 'prim-strip (* arg1 2) (-> arg0 tex-id) (the-as string #f))) ) - (light-trail-method-10 this) + (reset! this) 0 (none) ) ;; definition for method 10 of type light-trail ;; WARN: Return type mismatch float vs none. -(defmethod light-trail-method-10 ((this light-trail)) +(defmethod reset! ((this light-trail)) + "Clear all tracked crumbs." (set! (-> this crumb-count) 0) (set! (-> this start-marker) (the-as uint (current-time))) (set! (-> this end-marker) (the-as uint (current-time))) - (set! (-> this decision) (the-as uint 2)) + (set! (-> this decision) (light-trail-decision reset)) (set! (-> this total-distance-traveled) 0.0) (none) ) ;; definition for method 11 of type light-trail ;; INFO: Used lq/sq -(defmethod light-trail-method-11 ((this light-trail) (arg0 vector) (arg1 time-frame)) +(defmethod add-crumb! ((this light-trail) (arg0 vector) (arg1 time-frame)) + "Try adding a crumb, kicking out the oldest if there's not enough room. This may reject if it's too close to the previous." (local-vars (s3-0 int)) (with-pp (if (< (seconds 5000) arg1) @@ -55,7 +49,7 @@ ) (cond ((< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) (set! s3-0 1) (goto cfg-12) ) @@ -86,7 +80,7 @@ (set! f0-5 (- f2-0 f1-2)) ) (set! (-> a1-5 pos quad) (-> arg0 quad)) - (set! (-> a1-5 pos w) (the-as float (the int (- (the float (+ (-> this start-marker) arg1)) f0-5)))) + (set! (-> a1-5 birth-time) (the-as uint (the int (- (the float (+ (-> this start-marker) arg1)) f0-5)))) ) (mem-copy! (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (-> this crumb-count))) @@ -95,7 +89,7 @@ ) ) (+! (-> this crumb-count) 1) - (set! (-> this decision) (the-as uint 0)) + (set! (-> this decision) (light-trail-decision added)) (label cfg-12) s3-0 ) @@ -104,21 +98,27 @@ ;; definition for method 21 of type light-trail ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod light-trail-method-21 ((this light-trail) (arg0 vector)) +(defmethod replace-last-crumb! ((this light-trail) (arg0 vector)) + "Similar to add-crumb, but will modify the last crumb instead of advancing." (with-pp (let ((v1-0 (-> this crumb-count))) 0.0 (cond ((zero? v1-0) - (light-trail-method-11 this arg0 (seconds 10000)) + (add-crumb! this arg0 (seconds 10000)) ) (else - (set! (-> this decision) (the-as uint 0)) - (let ((gp-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))))) - (let ((f0-1 (vector-vector-distance (the-as vector (&+ gp-0 0)) arg0))) + (set! (-> this decision) (light-trail-decision added)) + (let ((gp-0 (the-as + light-trail-breadcrumb + (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))) + ) + ) + ) + (let ((f0-1 (vector-vector-distance (-> gp-0 pos) arg0))) (+! (-> this total-distance-traveled) f0-1) (if (< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) ) ) (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) @@ -128,10 +128,10 @@ (if (-> this appearance use-tape-mode?) (set! f0-4 (- f2-0 f1-3)) ) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 0)) pos quad) (-> arg0 quad)) - (set! (-> gp-0 3) + (set! (-> gp-0 pos quad) (-> arg0 quad)) + (set! (-> gp-0 birth-time) (the-as - light-trail-breadcrumb + uint (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) ) ) @@ -147,10 +147,11 @@ ;; definition for method 16 of type light-trail ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod add-vert! ((this light-trail) (arg0 prim-strip) (arg1 vector) (arg2 float) (arg3 float) (arg4 float)) +(defmethod add-vert-to-prim-strip! ((this light-trail) (arg0 prim-strip) (arg1 vector) (arg2 rgba) (arg3 float) (arg4 float)) + "Add a single vertex to the prim." (let ((v1-3 (-> arg0 data (-> arg0 num-verts)))) (set! (-> v1-3 pos quad) (-> arg1 quad)) - (set! (-> v1-3 col) (the-as rgba arg2)) + (set! (-> v1-3 col) arg2) (set! (-> v1-3 stq x) arg3) (set! (-> v1-3 stq y) arg4) ) @@ -161,31 +162,74 @@ ;; definition for method 17 of type light-trail ;; INFO: Used lq/sq -(defmethod light-trail-method-17 ((this light-trail) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 float)) +(defmethod add-tri-pair-to-prim! ((this light-trail) (arg0 vector) (arg1 rgba) (arg2 float) (arg3 vector) (arg4 float)) + "Add two vertices to the prim strip to add two triangles" (if (< (+ (-> this strip allocated-num-verts) -2) (-> this strip num-verts)) (return #f) ) (cond - ((= (-> this appearance lie-mode) 3) + ((= (-> this appearance lie-mode) (lie-mode use-two-strips)) (let ((s1-0 (new 'stack-no-clear 'vector))) (set! (-> s1-0 quad) (-> this cache-vector 0 quad)) (vector-normalize! s1-0 (* 0.5 arg2)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s1-0) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-0 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-0) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-0 -1.0) + arg1 + arg4 + 1.0 + ) ) (let ((s1-1 (new 'stack-no-clear 'vector))) (set! (-> s1-1 quad) (-> this cache-vector 1 quad)) (vector-normalize! s1-1 (* 0.5 arg2)) - (add-vert! this (-> this strip2) (vector+! (new 'stack-no-clear 'vector) arg0 s1-1) arg1 arg4 0.0) - (add-vert! this (-> this strip2) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-1 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip2) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-1) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip2) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-1 -1.0) + arg1 + arg4 + 1.0 + ) ) ) (else (let ((s1-2 (new 'stack-no-clear 'vector))) (set! (-> s1-2 quad) (-> arg3 quad)) (vector-normalize! s1-2 (* 0.5 arg2)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s1-2) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-2 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s1-2) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s1-2 -1.0) + arg1 + arg4 + 1.0 + ) ) ) ) @@ -240,7 +284,7 @@ ;; definition for method 18 of type light-trail ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this light-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this light-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) (cond ((> (the-as uint arg1) 0) @@ -254,30 +298,28 @@ ) ) ) - (let ((a2-9 (-> this appearance lie-mode))) - (cond - ((= a2-9 1) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - ) - ((zero? a2-9) - (vector-cross! arg3 (vector-! (new 'stack-no-clear 'vector) (-> arg0 pos) arg2) v1-0) - ) - ((= a2-9 2) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (vector-cross! arg3 v1-0 arg3) - ) - ((= a2-9 3) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (set! (-> this cache-vector 0 quad) (-> arg3 quad)) - (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) - (set! (-> arg3 y) 0.0) - (vector-cross! arg3 v1-0 arg3) - (set! (-> this cache-vector 1 quad) (-> arg3 quad)) - ) - ) + (case (-> this appearance lie-mode) + (((lie-mode appearance1)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + ) + (((lie-mode appearance0)) + (vector-cross! arg3 (vector-! (new 'stack-no-clear 'vector) (-> arg0 pos) arg2) v1-0) + ) + (((lie-mode appearance2)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (vector-cross! arg3 v1-0 arg3) + ) + (((lie-mode use-two-strips)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (set! (-> this cache-vector 0 quad) (-> arg3 quad)) + (vector-cross! arg3 v1-0 (-> this appearance lie-vector)) + (set! (-> arg3 y) 0.0) + (vector-cross! arg3 v1-0 arg3) + (set! (-> this cache-vector 1 quad) (-> arg3 quad)) + ) ) ) (none) @@ -286,7 +328,8 @@ ;; definition for method 12 of type light-trail ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defmethod light-trail-method-12 ((this light-trail)) +(defmethod build-prim-strip! ((this light-trail)) + "Build the mesh for this light trail." (local-vars (sv-64 time-frame) (sv-72 uint) @@ -318,12 +361,14 @@ ) (while (>= s3-0 s4-0) (let* ((v1-5 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s4-0 -1))))) - (a1-3 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s4-0)))) - (a0-6 (- (-> this start-marker) (the-as uint (-> a1-3 3)))) + (a1-3 (the-as object (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s4-0))))) + (a0-6 (- (-> this start-marker) (-> (the-as light-trail-breadcrumb a1-3) birth-time))) ) - (when (and (>= a0-6 0) (< a0-6 (-> this appearance max-age))) + (when (and (>= (the-as int a0-6) 0) (< (the-as time-frame a0-6) (-> this appearance max-age))) (set! *total-length* - (+ *total-length* (vector-vector-distance (the-as vector (&+ v1-5 0)) (the-as vector (&+ a1-3 0)))) + (+ *total-length* + (vector-vector-distance (the-as vector (&+ v1-5 0)) (the-as vector (&+ (the-as (pointer uint8) a1-3) 0))) + ) ) (set! (-> *dist-cache-array* s4-0) *total-length*) ) @@ -345,7 +390,7 @@ (set! sv-128 (math-camera-pos)) (set! sv-132 (new 'stack-no-clear 'vector)) (set! (-> this strip num-verts) (the-as uint 0)) - (set! (-> this strip tex-id) (the-as texture-id (-> this appearance tex-id))) + (set! (-> this strip tex-id) (-> this appearance tex-id)) (cond ((not (-> this appearance zbuffer?)) (set! (-> this strip adnops 0 cmds) (gs-reg64 test-1)) @@ -380,7 +425,7 @@ ) (when (-> this strip2) (set! (-> this strip2 num-verts) (the-as uint 0)) - (set! (-> this strip2 tex-id) (the-as texture-id (-> this appearance tex-id))) + (set! (-> this strip2 tex-id) (-> this appearance tex-id)) (cond ((not (-> this appearance zbuffer?)) (set! (-> this strip2 adnops 0 cmds) (gs-reg64 test-1)) @@ -416,9 +461,13 @@ ) (countdown (s5-1 (-> s5-0 0)) (let* ((s3-1 s5-1) - (s4-1 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1))) + (s4-1 (the-as object (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) s3-1)))) ) - (set! sv-136 (/ (the float (+ (- (-> this start-marker) (the-as uint (-> s4-1 3))) sv-80)) (the float sv-64))) + (set! sv-136 + (/ (the float (+ (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s4-1) birth-time)) sv-80)) + (the float sv-64) + ) + ) (when (or (< 1.0 sv-136) (< sv-136 0.0)) ) (when (and (>= 1.0 sv-136) (>= sv-136 0.0)) @@ -440,10 +489,10 @@ f28-0 f26-0 (-> this appearance alpha-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-140 (curve2d-method-9 (-> this appearance alpha-curve-1) sv-140 3)) + (set! sv-140 (evaluate (-> this appearance alpha-curve-1) sv-140 (loop-behavior use-default))) ) (when (-> this appearance alpha-curve-2) (set! sv-144 @@ -454,10 +503,10 @@ f28-0 f26-0 (-> this appearance alpha-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-144 (curve2d-method-9 (-> this appearance alpha-curve-2) sv-144 3)) + (set! sv-144 (evaluate (-> this appearance alpha-curve-2) sv-144 (loop-behavior use-default))) ) (when (-> this appearance width-curve) (set! sv-148 @@ -468,10 +517,10 @@ f28-0 f26-0 (-> this appearance width-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (set! sv-148 (curve2d-method-9 (-> this appearance width-curve) sv-148 3)) + (set! sv-148 (evaluate (-> this appearance width-curve) sv-148 (loop-behavior use-default))) ) (set! sv-152 (compute-trail-scaled-t @@ -481,7 +530,7 @@ f28-0 f26-0 (-> this appearance uv-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) (when (or (< 1.0 sv-152) (< sv-152 0.0)) @@ -502,14 +551,14 @@ f28-0 f26-0 (-> this appearance color-repeat-dist) - (the-as vector (&+ s4-1 0)) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) ) ) - (curve-color-method-9 (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) 3) + (evaluate (-> this appearance color-curve) sv-156 (the-as rgbaf sv-200) (loop-behavior use-default)) ) ) (set! (-> sv-200 w) (* (-> sv-200 w) sv-192)) - (light-trail-method-18 this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) + (calc-vertex-pos! this (the-as light-trail-breadcrumb s4-1) s3-1 sv-128 sv-204) (when (or (and (= (-> this appearance uv-mode) 3) (< sv-92 sv-152)) (and (!= (-> this appearance uv-mode) 3) (< sv-152 sv-92)) ) @@ -517,30 +566,34 @@ (set! (-> s2-0 3 z) (- sv-152)) (set! (-> s2-0 3 w) (- sv-92 (-> s2-0 3 z))) (set! (-> s2-0 4 x) (/ sv-92 (-> s2-0 3 w))) - (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ s4-1 0)) (-> s2-0 4 x)) + (vector-lerp! (-> s2-0 0) sv-104 (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (-> s2-0 4 x)) (rgbaf-lerp! (the-as rgbaf (-> s2-0 2)) sv-100 (the-as rgbaf sv-200) (-> s2-0 4 x)) (set! (-> s2-0 3 y) (lerp sv-96 sv-196 (-> s2-0 4 x))) (vector-lerp! (-> s2-0 1) sv-132 sv-204 (-> s2-0 4 x)) (set! (-> s2-0 3 x) (the-as float (rgba<-rgbaf (the-as rgba (-> s2-0 3 x)) (the-as rgbaf (-> s2-0 2))))) - (light-trail-method-17 this (-> s2-0 0) (-> s2-0 3 x) (-> s2-0 3 y) (-> s2-0 1) 0.0) - (light-trail-method-17 this (-> s2-0 0) (-> s2-0 3 x) (-> s2-0 3 y) (-> s2-0 1) 1.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 0.0) + (add-tri-pair-to-prim! this (-> s2-0 0) (the-as rgba (-> s2-0 3 x)) (-> s2-0 3 y) (-> s2-0 1) 1.0) ) ) - (light-trail-method-17 + (add-tri-pair-to-prim! this - (the-as vector (&+ s4-1 0)) - (the-as float (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200))) + (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) + (rgba<-rgbaf (the-as rgba (new 'stack-no-clear 'rgbaf)) (the-as rgbaf sv-200)) sv-196 sv-204 sv-152 ) (when (> s3-1 0) (let ((v1-149 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ s3-1 -1))))) - (set! sv-88 (+ sv-88 (vector-vector-distance (the-as vector (&+ s4-1 0)) (the-as vector (&+ v1-149 0))))) + (set! sv-88 + (+ sv-88 + (vector-vector-distance (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) (the-as vector (&+ v1-149 0))) + ) + ) ) ) (set! sv-92 sv-152) - (set! (-> sv-104 quad) (-> (the-as vector (&+ s4-1 0)) quad)) + (set! (-> sv-104 quad) (-> (the-as vector (&+ (the-as (pointer uint8) s4-1) 0)) quad)) (set! sv-96 sv-196) (set! (-> sv-100 quad) (-> sv-200 quad)) (set! (-> sv-132 quad) (-> sv-204 quad)) @@ -554,23 +607,28 @@ ;; definition for method 19 of type light-trail ;; WARN: Return type mismatch int vs none. -(defmethod light-trail-method-19 ((this light-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this light-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." 0 (none) ) ;; definition for method 14 of type light-trail ;; WARN: Return type mismatch pointer vs none. -(defmethod light-trail-method-14 ((this light-trail)) +(defmethod expire-old-points! ((this light-trail)) + "Internal function to kill off points that are too old." (let ((s4-0 (new 'stack-no-clear 'light-trail-breadcrumb)) (s5-0 -1) ) (let ((s3-0 (-> this crumb-count))) (dotimes (s2-0 s3-0) - (let ((a1-0 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s2-0))))) + (let ((a1-0 + (the-as light-trail-breadcrumb (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s2-0)))) + ) + ) (cond - ((< (the-as uint (-> a1-0 3)) (-> this end-marker)) - (mem-copy! (the-as pointer s4-0) a1-0 16) + ((< (-> a1-0 birth-time) (-> this end-marker)) + (mem-copy! (the-as pointer s4-0) (the-as pointer a1-0) 16) (set! s5-0 s2-0) ) (else @@ -582,17 +640,19 @@ ) (label cfg-8) (when (>= s5-0 0) - (let ((s3-1 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s5-0 1))))) - (s2-1 (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s5-0)))) + (let ((s3-1 (the-as object (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint (+ s5-0 1)))))) + (s2-1 + (the-as light-trail-breadcrumb (&+ (-> this crumb-array data) (* (-> this crumb-size) (the-as uint s5-0)))) + ) ) - (let* ((f0-1 (the float (- (-> this start-marker) (the-as uint (-> s3-1 3))))) - (f1-1 (the float (- (-> this start-marker) (the-as uint (-> s4-0 pos w))))) + (let* ((f0-1 (the float (- (-> this start-marker) (-> (the-as light-trail-breadcrumb s3-1) birth-time)))) + (f1-1 (the float (- (-> this start-marker) (the-as uint (-> s4-0 birth-time))))) (f30-0 (/ (- (the float (-> this appearance max-age)) f0-1) (- f1-1 f0-1))) ) - (light-trail-method-19 this f30-0 s5-0) - (vector-lerp! (the-as vector (&+ s2-1 0)) (the-as vector (&+ s3-1 0)) (-> s4-0 pos) f30-0) + (crumb-age-out-callback this f30-0 s5-0) + (vector-lerp! (-> s2-1 pos) (the-as vector (&+ (the-as (pointer uint8) s3-1) 0)) (-> s4-0 pos) f30-0) ) - (set! (-> s2-1 3) (the-as light-trail-breadcrumb (-> this end-marker))) + (set! (-> s2-1 birth-time) (-> this end-marker)) ) (when (> s5-0 0) (set! (-> this crumb-count) (- (-> this crumb-count) s5-0)) @@ -608,37 +668,36 @@ ) ;; definition for method 13 of type light-trail -(defmethod light-trail-method-13 ((this light-trail)) +(defmethod common-trans! ((this light-trail)) + "Call this on each frame to handle max-age." (with-pp (if (<= (-> this crumb-count) 0) (return 0) ) - (let ((v1-3 (-> this decision))) - (cond - ((= v1-3 2) - (return 0) - ) - ((zero? v1-3) - (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) - (let ((v1-8 (- (-> this start-marker) (the-as uint (-> this appearance max-age))))) - (when (< (the-as int (-> this end-marker)) (the-as int v1-8)) - (set! (-> this end-marker) v1-8) - (light-trail-method-14 this) - ) + (case (-> this decision) + (((light-trail-decision reset)) + (return 0) + ) + (((light-trail-decision added)) + (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + (let ((v1-8 (- (-> this start-marker) (the-as uint (-> this appearance max-age))))) + (when (< (the-as int (-> this end-marker)) (the-as int v1-8)) + (set! (-> this end-marker) v1-8) + (expire-old-points! this) ) ) - ((= v1-3 1) - (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) - (when (< (the-as int (-> this start-marker)) (the-as int (-> this end-marker))) - (reset-crumbs! this) - (set! (-> this end-marker) (-> this start-marker)) - ) - (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) - (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + ) + (((light-trail-decision not-added)) + (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) + (when (< (the-as int (-> this start-marker)) (the-as int (-> this end-marker))) + (reset-crumbs! this) + (set! (-> this end-marker) (-> this start-marker)) ) - ) + (+! (-> this end-marker) (- (current-time) (-> pp clock old-frame-counter))) + (+! (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter))) + ) ) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) 0 ) ) @@ -654,8 +713,8 @@ ;; definition for function light-trail-tracker-common-post (defbehavior light-trail-tracker-common-post light-trail-tracker () (cond - ((light-trail-tracker-method-19 self) - (light-trail-method-12 (-> self trail)) + ((should-draw? self) + (build-prim-strip! (-> self trail)) ) (else (set! (-> self trail strip num-verts) (the-as uint 0)) @@ -676,26 +735,23 @@ (case (-> block param 0) (('add-crumb) (let ((a1-1 (handle->process (-> self tracked-object)))) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable a1-1) (new 'stack-no-clear 'vector)) - ) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable a1-1) (new 'stack-no-clear 'vector))) ) ) (('add-crumb-elapsed) (let ((a1-4 (handle->process (-> self tracked-object)))) - (light-trail-method-11 + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable a1-4) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable a1-4) (new 'stack-no-clear 'vector)) (the-as time-frame (the int (the-as float (-> block param 1)))) ) ) ) (('add-crumb-pos) - (light-trail-tracker-method-20 self (the-as vector (-> block param 1))) + (add-crumb! self (the-as vector (-> block param 1))) ) (('replace-last-crumb) - (light-trail-method-21 (-> self trail) (the-as vector (-> block param 1))) + (replace-last-crumb! (-> self trail) (the-as vector (-> block param 1))) ) (('die) (go-virtual die) @@ -708,17 +764,14 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual die) ) (else - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-0)) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector)) - ) + (if (should-track? self (the-as process-focusable gp-0)) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector))) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) 0 ) ) @@ -735,7 +788,7 @@ '() ) :trans (behavior () - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code (behavior () (until #f @@ -769,7 +822,7 @@ ;; definition for method 16 of type light-trail-tracker ;; INFO: Used lq/sq -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker) (arg0 process-focusable) (arg1 vector)) (let ((a0-2 (if (type? arg0 process-focusable) arg0 ) @@ -783,13 +836,13 @@ ) ;; definition for method 17 of type light-trail-tracker -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker) (arg0 process-focusable)) #t ) ;; definition for method 16 of type light-trail-tracker-water ;; INFO: Used lq/sq -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-water) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-water) (arg0 process-focusable) (arg1 vector)) (let ((a0-2 (if (type? arg0 process-focusable) arg0 ) @@ -809,7 +862,7 @@ ;; definition for method 17 of type light-trail-tracker-water ;; WARN: Return type mismatch object vs symbol. -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-water) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-water) (arg0 process-focusable)) (the-as symbol (and *target* (or (logtest? (water-flag touch-water) (-> *target* water flags)) (logtest? (-> *target* control status) (collide-status on-water)) ) @@ -818,12 +871,12 @@ ) ;; definition for method 18 of type light-trail-tracker -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker) (arg0 process-focusable)) (not arg0) ) ;; definition for method 18 of type light-trail-tracker-water -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker-water) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker-water) (arg0 process-focusable)) (let ((v1-0 (if (type? arg0 process-focusable) arg0 ) @@ -853,7 +906,7 @@ ) ;; definition for method 18 of type light-trail-tracker-projectile -(defmethod light-trail-tracker-method-18 ((this light-trail-tracker-projectile) (arg0 process-focusable)) +(defmethod should-end? ((this light-trail-tracker-projectile) (arg0 process-focusable)) (if (not arg0) (set! (-> this tracked-object) (the-as handle #f)) ) @@ -862,7 +915,7 @@ ;; definition for method 16 of type light-trail-tracker-projectile ;; INFO: Used lq/sq -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-projectile) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-projectile) (arg0 process-focusable) (arg1 vector)) (let ((a0-1 arg0)) (if a0-1 (set! (-> arg1 quad) (-> a0-1 root trans quad)) @@ -881,13 +934,10 @@ (go-virtual hang-on) ) (else - (if (light-trail-tracker-method-17 self (the-as process-focusable gp-0)) - (light-trail-tracker-method-20 - self - (light-trail-tracker-method-16 self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector)) - ) + (if (should-track? self (the-as process-focusable gp-0)) + (add-crumb! self (get-tracked-object-pos self (the-as process-focusable gp-0) (new 'stack-no-clear 'vector))) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -906,7 +956,7 @@ (if (time-elapsed? (-> self state-time) (seconds 2)) (go-virtual die) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code sleep-code :post light-trail-tracker-common-post @@ -922,7 +972,7 @@ (if (time-elapsed? (-> self state-time) (seconds 2)) (go-virtual die) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) :code sleep-code :post light-trail-tracker-common-post @@ -942,7 +992,7 @@ (let ((a1-1 (-> block param 1)) (a2-1 (-> block param 2)) ) - (weapon-trail-method-22 (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) + (add-crumb-with-offset (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) ) ) ) @@ -953,7 +1003,7 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual hang-on) ) (else @@ -969,10 +1019,10 @@ ) ) ) - (weapon-trail-method-22 (-> self trail) s5-0 a2-0) + (add-crumb-with-offset (-> self trail) s5-0 a2-0) ) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -987,7 +1037,7 @@ :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('reset) - (light-trail-method-10 (-> self trail)) + (reset! (-> self trail)) ) (('notice) (case (-> block param 0) @@ -998,7 +1048,7 @@ (let ((a1-1 (-> block param 0)) (a2-1 (-> block param 1)) ) - (tread-trail-method-22 (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) + (add-crumb-with-offset (-> self trail) (the-as vector a1-1) (the-as vector a2-1)) ) ) ) @@ -1009,7 +1059,7 @@ :trans (behavior () (let ((gp-0 (handle->process (-> self tracked-object)))) (cond - ((light-trail-tracker-method-18 self (the-as process-focusable gp-0)) + ((should-end? self (the-as process-focusable gp-0)) (go-virtual die) ) (else @@ -1018,7 +1068,7 @@ (setup-dma-and-tex (-> self trail strip) a1-2) ) ) - (light-trail-method-13 (-> self trail)) + (common-trans! (-> self trail)) ) ) ) @@ -1030,13 +1080,14 @@ ;; definition for method 18 of type weapon-trail ;; INFO: Used lq/sq ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this weapon-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this weapon-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (set! (-> arg3 quad) (-> (&+ arg0 16) pos quad)) (none) ) ;; definition for method 9 of type weapon-trail -(defmethod light-trail-method-9 ((this weapon-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this weapon-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this crumb-size) (the-as uint 32)) (call-parent-method this arg0 arg1) (none) @@ -1044,15 +1095,16 @@ ;; definition for method 22 of type weapon-trail ;; INFO: Used lq/sq -;; WARN: Return type mismatch (pointer light-trail-breadcrumb) vs light-trail-breadcrumb. -(defmethod weapon-trail-method-22 ((this weapon-trail) (arg0 vector) (arg1 vector)) +;; WARN: Return type mismatch (pointer uint8) vs light-trail-breadcrumb. +(defmethod add-crumb-with-offset ((this weapon-trail) (arg0 vector) (arg1 vector)) + "Given two points, add the first and offset to a crumb." (let ((gp-0 (new 'stack-no-clear 'vector)) (v1-0 (new 'stack-no-clear 'vector)) ) (vector-! gp-0 arg1 arg0) (vector-float*! gp-0 gp-0 0.5) (vector+! v1-0 arg0 gp-0) - (let ((v1-1 (light-trail-method-11 this v1-0 (seconds 10000)))) + (let ((v1-1 (add-crumb! this v1-0 (seconds 10000)))) (the-as light-trail-breadcrumb (when (!= v1-1 1) @@ -1076,7 +1128,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod weapon-trail-method-23 ((this weapon-trail) (arg0 vector) (arg1 vector)) - (local-vars (gp-0 (pointer light-trail-breadcrumb)) (f0-2 float)) + (local-vars (gp-0 weapon-trail-crumb) (f0-2 float)) (with-pp (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -1085,18 +1137,20 @@ 0.0 (cond ((zero? v1-0) - (weapon-trail-method-22 this arg0 arg1) + (add-crumb-with-offset this arg0 arg1) ) ((begin - (set! (-> this decision) (the-as uint 0)) - (set! gp-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + (set! (-> this decision) (light-trail-decision added)) + (set! gp-0 + (the-as weapon-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + ) (vector-! s4-0 arg1 arg0) (vector-float*! s4-0 s4-0 0.5) (vector+! s3-0 arg0 s4-0) - (set! f0-2 (vector-vector-distance (the-as vector (&+ gp-0 0)) s3-0)) + (set! f0-2 (vector-vector-distance (-> gp-0 pos) s3-0)) (< f0-2 40.96) ) - (set! (-> this decision) (the-as uint 1)) + (set! (-> this decision) (light-trail-decision not-added)) ) (else (+! (-> this total-distance-traveled) f0-2) @@ -1107,11 +1161,11 @@ (if (-> this appearance use-tape-mode?) (set! f0-6 (- f2-0 f1-2)) ) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 0)) pos quad) (-> s3-0 quad)) - (set! (-> (the-as light-trail-breadcrumb (&+ gp-0 16)) pos quad) (-> s4-0 quad)) - (set! (-> gp-0 3) + (set! (-> gp-0 pos quad) (-> s3-0 quad)) + (set! (-> gp-0 offset quad) (-> s4-0 quad)) + (set! (-> gp-0 birth-time) (the-as - light-trail-breadcrumb + uint (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-6)) ) ) @@ -1125,7 +1179,8 @@ ;; definition for method 19 of type weapon-trail ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-19 ((this weapon-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this weapon-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." (let ((v1-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) arg1))) (a2-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ arg1 1)))) ) @@ -1136,7 +1191,8 @@ ;; definition for method 17 of type weapon-trail ;; INFO: Used lq/sq -(defmethod light-trail-method-17 ((this weapon-trail) (arg0 vector) (arg1 float) (arg2 float) (arg3 vector) (arg4 float)) +(defmethod add-tri-pair-to-prim! ((this weapon-trail) (arg0 vector) (arg1 rgba) (arg2 float) (arg3 vector) (arg4 float)) + "Add two vertices to the prim strip to add two triangles" (when (< (+ (-> this strip allocated-num-verts) -2) (-> this strip num-verts)) (format 0 "Out of stuff (~d)~%" (-> this strip allocated-num-verts)) (return #f) @@ -1144,15 +1200,29 @@ (vector-float*! arg3 arg3 arg2) (let ((s2-0 (new 'stack-no-clear 'vector))) (set! (-> s2-0 quad) (-> arg3 quad)) - (add-vert! this (-> this strip) (vector+! (new 'stack-no-clear 'vector) arg0 s2-0) arg1 arg4 0.0) - (add-vert! this (-> this strip) (vector+float*! (new 'stack-no-clear 'vector) arg0 s2-0 -1.0) arg1 arg4 1.0) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+! (new 'stack-no-clear 'vector) arg0 s2-0) + arg1 + arg4 + 0.0 + ) + (add-vert-to-prim-strip! + this + (-> this strip) + (vector+float*! (new 'stack-no-clear 'vector) arg0 s2-0 -1.0) + arg1 + arg4 + 1.0 + ) ) #f ) ;; definition for method 18 of type tread-trail ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-18 ((this tread-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) +(defmethod calc-vertex-pos! ((this tread-trail) (arg0 light-trail-breadcrumb) (arg1 int) (arg2 vector) (arg3 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) (cond ((> (the-as uint arg1) 0) @@ -1172,7 +1242,8 @@ ) ;; definition for method 9 of type tread-trail -(defmethod light-trail-method-9 ((this tread-trail) (arg0 light-trail-composition) (arg1 int)) +(defmethod setup! ((this tread-trail) (arg0 light-trail-composition) (arg1 int)) + "Initialize, including allocation of crumbs and strips on the process heap." (set! (-> this crumb-size) (the-as uint 32)) (call-parent-method this arg0 arg1) (none) @@ -1180,7 +1251,8 @@ ;; definition for method 19 of type tread-trail ;; WARN: Return type mismatch vector vs none. -(defmethod light-trail-method-19 ((this tread-trail) (arg0 float) (arg1 int)) +(defmethod crumb-age-out-callback ((this tread-trail) (arg0 float) (arg1 int)) + "To be implemented by the user to smoothly interpolate out non-default entries in their crumb type." (let ((v1-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) arg1))) (a2-2 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ arg1 1)))) ) @@ -1191,78 +1263,73 @@ ;; definition for method 22 of type tread-trail ;; INFO: Used lq/sq -;; WARN: Return type mismatch (pointer light-trail-breadcrumb) vs light-trail-breadcrumb. -(defmethod tread-trail-method-22 ((this tread-trail) (arg0 vector) (arg1 vector)) - (let ((v1-1 (light-trail-method-11 this arg0 (seconds 10000)))) - (the-as - light-trail-breadcrumb - (when (!= v1-1 1) - (let ((v0-1 - (the-as - object - (&+ (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ (-> this crumb-count) -1))) 16) +;; WARN: Return type mismatch (pointer uint8) vs none. +(defmethod add-crumb-with-offset ((this tread-trail) (arg0 vector) (arg1 vector)) + (let ((v1-1 (add-crumb! this arg0 (seconds 10000)))) + (if (!= v1-1 1) + (set! (-> (the-as + light-trail-breadcrumb + (&+ (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ (-> this crumb-count) -1))) 16) + ) + pos + quad ) - ) + (-> arg1 quad) ) - (set! (-> (the-as light-trail-breadcrumb v0-1) pos quad) (-> arg1 quad)) - v0-1 - ) ) - ) ) + (none) ) ;; definition for method 23 of type tread-trail ;; INFO: Used lq/sq -;; WARN: Return type mismatch object vs light-trail-breadcrumb. +;; WARN: Return type mismatch object vs none. (defmethod tread-trail-method-23 ((this tread-trail) (arg0 vector) (arg1 vector)) (with-pp (let ((v1-0 (-> this crumb-count))) 0.0 - (the-as - light-trail-breadcrumb - (cond - ((zero? v1-0) - (tread-trail-method-22 this arg0 arg1) - ) - (else - (set! (-> this decision) (the-as uint 0)) - (let ((s5-0 (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1))))) - (let ((f0-1 (vector-vector-distance (the-as vector (&+ s5-0 0)) arg0))) - (+! (-> this total-distance-traveled) f0-1) - (if (< f0-1 40.96) - (set! (-> this decision) (the-as uint 1)) - ) - ) - (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) - (f2-0 (the float (-> this appearance max-age))) - (f0-4 0.0) - ) - (if (-> this appearance use-tape-mode?) - (set! f0-4 (- f2-0 f1-3)) - ) - (set! (-> (the-as light-trail-breadcrumb (&+ s5-0 0)) pos quad) (-> arg0 quad)) - (set! (-> s5-0 3) - (the-as - light-trail-breadcrumb - (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) - ) - ) - ) - (let ((v0-0 (the-as object (&+ s5-0 16)))) - (set! (-> (the-as light-trail-breadcrumb v0-0) pos quad) (-> arg1 quad)) - v0-0 + (cond + ((zero? v1-0) + (add-crumb-with-offset this arg0 arg1) + ) + (else + (set! (-> this decision) (light-trail-decision added)) + (let ((s5-0 + (the-as tread-trail-crumb (&+ (-> this crumb-array data) (* (the-as int (-> this crumb-size)) (+ v1-0 -1)))) + ) ) + (let ((f0-1 (vector-vector-distance (-> s5-0 pos) arg0))) + (+! (-> this total-distance-traveled) f0-1) + (if (< f0-1 40.96) + (set! (-> this decision) (light-trail-decision not-added)) + ) ) + (let ((f1-3 (the float (- (-> this start-marker) (-> this end-marker)))) + (f2-0 (the float (-> this appearance max-age))) + (f0-4 0.0) + ) + (if (-> this appearance use-tape-mode?) + (set! f0-4 (- f2-0 f1-3)) + ) + (set! (-> s5-0 pos quad) (-> arg0 quad)) + (set! (-> s5-0 birth-time) + (the-as + uint + (the int (- (the float (+ (-> this start-marker) (- (current-time) (-> pp clock old-frame-counter)))) f0-4)) + ) + ) + ) + (set! (-> s5-0 normal quad) (-> arg1 quad)) ) ) ) ) + (none) ) ) ;; definition for method 19 of type light-trail-tracker -(defmethod light-trail-tracker-method-19 ((this light-trail-tracker)) +(defmethod should-draw? ((this light-trail-tracker)) (let ((a1-0 (handle->process (-> this tracked-object)))) #t (let ((v1-4 #t)) @@ -1318,10 +1385,10 @@ ;; definition for method 20 of type light-trail-tracker ;; WARN: Return type mismatch uint vs none. -(defmethod light-trail-tracker-method-20 ((this light-trail-tracker) (arg0 vector)) +(defmethod add-crumb! ((this light-trail-tracker) (arg0 vector)) (if (zero? (mod (-> this last-add-frame-val) (-> this trail appearance frame-stagger))) - (light-trail-method-11 (-> this trail) arg0 (seconds 10000)) - (light-trail-method-21 (-> this trail) arg0) + (add-crumb! (-> this trail) arg0 (seconds 10000)) + (replace-last-crumb! (-> this trail) arg0) ) (+! (-> this last-add-frame-val) 1) (none) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc index f0aa25f643..640356954b 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-blue-shot_REF.gc @@ -351,7 +351,7 @@ ) ;; definition for method 17 of type light-trail-tracker-blue-3 -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-blue-3) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-blue-3) (arg0 process-focusable)) #f ) @@ -394,17 +394,15 @@ (set! (-> *blue-shot-trail* uv-repeat-dist) 163840.0) ;; failed to figure out what this is: -(set! (-> *blue-shot-trail* lie-mode) (the-as uint 0)) +(set! (-> *blue-shot-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *blue-shot-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *blue-shot-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *blue-shot-trail* tex-id) (the-as uint #x500f00)) + (set! (-> *blue-shot-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *blue-shot-trail* tex-id) (new 'static 'texture-id :index #xf :page #x5)) ) ;; failed to figure out what this is: @@ -464,7 +462,7 @@ (set! (-> s5-0 track-immediately?) #t) (let* ((v1-30 (estimate-light-trail-mem-usage (the-as uint (-> s5-0 max-num-crumbs)) - (the-as uint (= (-> s5-0 appearance lie-mode) 3)) + (the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1)) @@ -1269,7 +1267,7 @@ ;; failed to figure out what this is: (when (or (zero? *uv-loop-curve*) (!= loading-level global)) (set! *uv-loop-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *uv-loop-curve* 2 'loading-level (the-as int #t)) + (allocate! *uv-loop-curve* 2 'loading-level #t) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc index 85869a70b3..3cc1d66c93 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-dark-shot_REF.gc @@ -993,7 +993,7 @@ (when (= (process->handle this) (-> *last-active-nuke* last-active-nuke)) 0.0 (let* ((f0-3 (/ (the float (- (current-time) (-> this state-time))) (the float (-> this blur-time)))) - (f0-4 (curve2d-method-9 (-> this blur-curve) f0-3 3)) + (f0-4 (evaluate (-> this blur-curve) f0-3 (loop-behavior use-default))) (f0-5 (- 1.0 f0-4)) ) (blit-displays-work-method-17 @@ -1016,7 +1016,7 @@ 0.0 0.0 (let ((f0-4 (/ (the float (- (current-time) (-> this state-time))) (the float (-> this flash-time))))) - (curve-color-method-9 (-> this fade-curve) f0-4 (the-as rgbaf gp-0) 3) + (evaluate (-> this fade-curve) f0-4 (the-as rgbaf gp-0) (loop-behavior use-default)) ) (set! (-> gp-0 x) (* 255.0 (-> gp-0 x))) (set! (-> gp-0 y) (* 255.0 (-> gp-0 y))) @@ -1462,8 +1462,8 @@ 0.0 0.0 (let ((f30-0 1.0) - (f28-0 (curve2d-method-9 *gun-dark-3-nuke-mushroom-size-curve-x* f26-0 3)) - (f26-1 (curve2d-method-9 *gun-dark-3-nuke-mushroom-size-curve-y* f26-0 3)) + (f28-0 (evaluate *gun-dark-3-nuke-mushroom-size-curve-x* f26-0 (loop-behavior use-default))) + (f26-1 (evaluate *gun-dark-3-nuke-mushroom-size-curve-y* f26-0 (loop-behavior use-default))) ) (when (time-elapsed? (-> self state-time) (seconds 5)) (let ((f30-1 (* 0.00066666666 (the float (+ (- (seconds -5) (-> self state-time)) (current-time)))))) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc index 004ac224f9..248a70bd77 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-part_REF.gc @@ -867,7 +867,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *curve-linear-up-red*) (!= loading-level global)) (set! *curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -921,17 +921,15 @@ gun (set! (-> *red-shot-3-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *red-shot-3-trail* lie-mode) (the-as uint 0)) +(set! (-> *red-shot-3-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *red-shot-3-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *red-shot-3-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *red-shot-3-trail* tex-id) (the-as uint #x100300)) + (set! (-> *red-shot-3-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *red-shot-3-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -964,7 +962,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *curve-yellow2-shot-alpha*) (!= loading-level global)) (set! *curve-yellow2-shot-alpha* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-yellow2-shot-alpha* 21 'loading-level (the-as int #f)) + (allocate! *curve-yellow2-shot-alpha* 21 'loading-level #f) ) ;; failed to figure out what this is: @@ -1157,17 +1155,15 @@ gun (set! (-> *yellow-shot-2-trail* uv-repeat-dist) 20480.0) ;; failed to figure out what this is: -(set! (-> *yellow-shot-2-trail* lie-mode) (the-as uint 0)) +(set! (-> *yellow-shot-2-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *yellow-shot-2-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *yellow-shot-2-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *yellow-shot-2-trail* tex-id) (the-as uint #x501e00)) + (set! (-> *yellow-shot-2-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *yellow-shot-2-trail* tex-id) (new 'static 'texture-id :index #x1e :page #x5)) ) ;; failed to figure out what this is: @@ -4175,7 +4171,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-fade-curve*) (!= loading-level global)) (set! *gun-dark-3-nuke-fade-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *gun-dark-3-nuke-fade-curve* 5 'loading-level (the-as uint #f)) + (allocate! *gun-dark-3-nuke-fade-curve* 5 'loading-level #f) ) ;; failed to figure out what this is: @@ -4262,7 +4258,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-blur-curve*) (!= loading-level global)) (set! *gun-dark-3-nuke-blur-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-blur-curve* 4 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-blur-curve* 4 'loading-level #f) ) ;; failed to figure out what this is: @@ -4298,7 +4294,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-mushroom-size-curve-x*) (!= loading-level global)) (set! *gun-dark-3-nuke-mushroom-size-curve-x* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-mushroom-size-curve-x* 2 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-mushroom-size-curve-x* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -4316,7 +4312,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-mushroom-size-curve-y*) (!= loading-level global)) (set! *gun-dark-3-nuke-mushroom-size-curve-y* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-mushroom-size-curve-y* 2 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-mushroom-size-curve-y* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -4585,7 +4581,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-fade-curve-small*) (!= loading-level global)) (set! *gun-dark-3-nuke-fade-curve-small* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *gun-dark-3-nuke-fade-curve-small* 5 'loading-level (the-as uint #f)) + (allocate! *gun-dark-3-nuke-fade-curve-small* 5 'loading-level #f) ) ;; failed to figure out what this is: @@ -4672,7 +4668,7 @@ gun ;; failed to figure out what this is: (when (or (zero? *gun-dark-3-nuke-blur-curve-small*) (!= loading-level global)) (set! *gun-dark-3-nuke-blur-curve-small* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *gun-dark-3-nuke-blur-curve-small* 4 'loading-level (the-as int #f)) + (allocate! *gun-dark-3-nuke-blur-curve-small* 4 'loading-level #f) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc index 4a07ecf1f2..3106ae0591 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-red-shot_REF.gc @@ -187,7 +187,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-28 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1)) @@ -1619,7 +1619,7 @@ ;; failed to figure out what this is: (when (or (zero? *impact-blur*) (!= loading-level global)) (set! *impact-blur* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *impact-blur* 3 'loading-level (the-as int #f)) + (allocate! *impact-blur* 3 'loading-level #f) ) ;; failed to figure out what this is: @@ -1643,7 +1643,7 @@ ;; failed to figure out what this is: (when (or (zero? *shockwave-blur-red-2*) (!= loading-level global)) (set! *shockwave-blur-red-2* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *shockwave-blur-red-2* 5 'loading-level (the-as int #f)) + (allocate! *shockwave-blur-red-2* 5 'loading-level #f) ) ;; failed to figure out what this is: @@ -1773,7 +1773,7 @@ (adjust-warp-radius-and-alpha self) (let ((f0-14 (-> self current-stage-t))) 0.0 - (let* ((f0-16 (- 1.0 (curve2d-method-9 *impact-blur* f0-14 3))) + (let* ((f0-16 (- 1.0 (evaluate *impact-blur* f0-14 (loop-behavior use-default)))) (f0-19 (lerp f0-16 1.0 (fmax 0.0 (- 0.5 (-> self strength))))) ) (blit-displays-work-method-17 *blit-displays-work* (-> self origin) 2 (fmin 1.0 f0-19) #f) @@ -2322,7 +2322,7 @@ (while (-> self child) (let ((f0-11 (* 0.0044444446 (the float (- (current-time) (-> self state-time)))))) 0.0 - (let* ((f0-13 (- 1.0 (curve2d-method-9 *impact-blur* f0-11 1))) + (let* ((f0-13 (- 1.0 (evaluate *impact-blur* f0-11 (loop-behavior clamp)))) (f0-14 (lerp f0-13 1.0 f30-1)) ) (set! (-> *display* force-sync) (the-as uint 2)) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc index 7ce203e94e..13e4a0c579 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-yellow-shot_REF.gc @@ -1953,7 +1953,7 @@ (set! (-> s5-1 track-immediately?) #t) (let* ((v1-34 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (gp-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-34 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc index 70f3393bd0..4747b34745 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs2_REF.gc @@ -1495,7 +1495,7 @@ ;; failed to figure out what this is: (when (or (zero? *grunt-jump-curve*) (!= loading-level global)) (set! *grunt-jump-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *grunt-jump-curve* 3 'loading-level (the-as int #t)) + (allocate! *grunt-jump-curve* 3 'loading-level #t) ) ;; failed to figure out what this is: @@ -1561,7 +1561,7 @@ ) (let ((f0-15 f30-0)) 0.0 - (let* ((f0-16 (curve2d-method-9 *grunt-jump-curve* f0-15 3)) + (let* ((f0-16 (evaluate *grunt-jump-curve* f0-15 (loop-behavior use-default))) (f0-17 (* f0-16 f0-16)) (f0-18 (lerp (-> this jump-height-percentage-start) (-> this jump-height-percentage-end) f0-17)) (f0-20 (- (* 2.0 f0-18) (* f0-18 f0-18))) @@ -1698,7 +1698,7 @@ ;; failed to figure out what this is: (when (or (zero? *grunt-dists*) (!= loading-level global)) (set! *grunt-dists* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *grunt-dists* 5 'loading-level (the-as int #t)) + (allocate! *grunt-dists* 5 'loading-level #t) ) ;; failed to figure out what this is: @@ -1799,7 +1799,7 @@ (vector-float*! gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) - (curve2d-method-9 *grunt-dists* f26-0 3) + (evaluate *grunt-dists* f26-0 (loop-behavior use-default)) ) (vector+float*! (-> self root trans) (-> self root trans) gp-0 1.0) ) @@ -1818,7 +1818,7 @@ (let* ((f26-1 (ja-frame-num 0)) (f0-27 (/ f26-1 (the float (ja-num-frames 0)))) (gp-1 (new-stack-vector0)) - (f28-2 (curve2d-method-9 *curve-linear-up-down* f0-27 3)) + (f28-2 (evaluate *curve-linear-up-down* f0-27 (loop-behavior use-default))) ) (vector-float*! gp-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) (vector+float*! gp-1 gp-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) @@ -2105,7 +2105,7 @@ ) ) ) - (+! (-> self root trans y) (* 409.6 (curve2d-method-9 *grunt-idle-shift* f0-2 3))) + (+! (-> self root trans y) (* 409.6 (evaluate *grunt-idle-shift* f0-2 (loop-behavior use-default)))) ) ) :code (behavior ((arg0 symbol)) @@ -2194,7 +2194,7 @@ (let ((f28-1 (ja-frame-num 0))) (let* ((f0-15 (/ f28-1 (the float (ja-num-frames 0)))) (gp-1 (new-stack-vector0)) - (f26-0 (curve2d-method-9 *curve-linear-up-down* f0-15 3)) + (f26-0 (evaluate *curve-linear-up-down* f0-15 (loop-behavior use-default))) ) (vector-float*! gp-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) (vector+float*! gp-1 gp-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) -1228.8) diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc index b122ab3cc8..24a180069d 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/blow-tower-obs_REF.gc @@ -1515,7 +1515,7 @@ (let* ((f0-0 0.9) (f1-1 (* 0.0033333334 (the float (current-time)))) (f0-1 (/ (- f1-1 (* (the float (the int (/ f1-1 f0-0))) f0-0)) f0-0)) - (f0-2 (curve2d-method-9 *curve-linear-up-down* f0-1 3)) + (f0-2 (evaluate *curve-linear-up-down* f0-1 (loop-behavior use-default))) (f0-3 (sin (lerp -16384.0 16384.0 f0-2))) (f0-4 (+ 1.0 f0-3)) (f0-5 (* 0.5 f0-4)) @@ -2223,7 +2223,3 @@ :code sleep-code :post ja-post ) - - - - diff --git a/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc b/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc index 5bab832cea..83b68e8a07 100644 --- a/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/blow-tower/cty-blow-tower_REF.gc @@ -824,7 +824,7 @@ ;; failed to figure out what this is: (when (or (zero? *bt-height-adjust*) (!= loading-level global)) (set! *bt-height-adjust* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-height-adjust* 4 'loading-level (the-as int #t)) + (allocate! *bt-height-adjust* 4 'loading-level #t) ) ;; failed to figure out what this is: @@ -871,7 +871,7 @@ (set! f0-7 (* f0-7 f0-7)) ) ) - (let* ((f0-8 (curve2d-method-9 *bt-height-adjust* f0-7 3)) + (let* ((f0-8 (evaluate *bt-height-adjust* f0-7 (loop-behavior use-default))) (f0-9 (lerp (-> this start-path-height-offset) (-> this dest-path-height-offset) f0-8)) ) (set! (-> this path-height-vel) (* (- f0-9 (-> this path-height-offset)) (-> pp clock frames-per-second))) @@ -2162,7 +2162,7 @@ ;; failed to figure out what this is: (when (or (zero? *bt-clamp-curve-x*) (!= loading-level global)) (set! *bt-clamp-curve-x* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-clamp-curve-x* 7 'loading-level (the-as int #t)) + (allocate! *bt-clamp-curve-x* 7 'loading-level #t) ) ;; failed to figure out what this is: @@ -2210,7 +2210,7 @@ ;; failed to figure out what this is: (when (or (zero? *bt-accel-curve*) (!= loading-level global)) (set! *bt-accel-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *bt-accel-curve* 4 'loading-level (the-as int #t)) + (allocate! *bt-accel-curve* 4 'loading-level #t) ) ;; failed to figure out what this is: @@ -2352,8 +2352,12 @@ ) (set! (-> this y-boost-scalar) (fmax 0.0 (fmin 2.5 (-> this y-boost-scalar)))) (set! (-> this x-boost-scalar) (fmax 0.0 (fmin 2.5 (-> this x-boost-scalar)))) - (set! (-> this rotyv) (* (-> this rotyv) (curve2d-method-9 *bt-accel-curve* (-> this y-boost-scalar) 2))) - (set! (-> this rotxv) (* (-> this rotxv) (curve2d-method-9 *bt-accel-curve* (-> this x-boost-scalar) 2))) + (set! (-> this rotyv) + (* (-> this rotyv) (evaluate *bt-accel-curve* (-> this y-boost-scalar) (loop-behavior b2))) + ) + (set! (-> this rotxv) + (* (-> this rotxv) (evaluate *bt-accel-curve* (-> this x-boost-scalar) (loop-behavior b2))) + ) (set! (-> this rotxv) (* 0.8 (-> this rotxv))) (+! (-> this roty) (* (-> this rotyv) (seconds-per-frame))) (+! (-> this rotx) (* (-> this rotxv) (seconds-per-frame))) diff --git a/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc b/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc index d8d8adccfe..93e630762d 100644 --- a/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/hijack/kg-vehicles_REF.gc @@ -12,7 +12,7 @@ ;; failed to figure out what this is: (when (or (zero? *hijack-suck-curve*) (!= loading-level global)) (set! *hijack-suck-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *hijack-suck-curve* 4 'loading-level (the-as int #t)) + (allocate! *hijack-suck-curve* 4 'loading-level #t) ) ;; failed to figure out what this is: @@ -46,7 +46,7 @@ (let* ((f1-0 (the float (-> *game-info* sub-task-list (game-task-node city-hijack-vehicle-escape) death-count))) (f0-2 (fmax 0.0 (fmin 15.0 f1-0))) ) - (set! f30-0 (curve2d-method-9 *hijack-suck-curve* f0-2 2)) + (set! f30-0 (evaluate *hijack-suck-curve* f0-2 (loop-behavior b2))) ) ) f30-0 diff --git a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc index fa72d9efe8..d50e5f74e8 100644 --- a/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/port/attack/ctyport-attack_REF.gc @@ -3240,7 +3240,7 @@ (set! (-> this sprites 1 color w) 0) (let ((f0-11 (* 0.011111111 (the float (- (current-time) (-> this spike-time)))))) 0.0 - (let ((f0-12 (curve2d-method-9 *hud-boost-curve* f0-11 3))) + (let ((f0-12 (evaluate *hud-boost-curve* f0-11 (loop-behavior use-default)))) (set! (-> this tt-current) (lerp (-> this tt-prev) (-> this tt-next) f0-12)) ) ) @@ -3260,7 +3260,7 @@ (f0-23 (lerp 1.0 0.3 f28-2)) (f1-16 (* 0.0033333334 (the float (current-time)))) (f0-24 (/ (- f1-16 (* (the float (the int (/ f1-16 f0-23))) f0-23)) f0-23)) - (f1-18 (* f28-2 (curve2d-method-9 *curve-linear-up-down* f0-24 3))) + (f1-18 (* f28-2 (evaluate *curve-linear-up-down* f0-24 (loop-behavior use-default)))) (f28-3 (fmax 0.0 (fmin 1.0 f1-18))) ) (set! (-> this sprites 3 color x) (the int (lerp 128.0 192.0 f28-3))) diff --git a/test/decompiler/reference/jak3/levels/city/port/attack/h-torpedo_REF.gc b/test/decompiler/reference/jak3/levels/city/port/attack/h-torpedo_REF.gc index d4db65acf1..2014b4977b 100644 --- a/test/decompiler/reference/jak3/levels/city/port/attack/h-torpedo_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/port/attack/h-torpedo_REF.gc @@ -41,7 +41,7 @@ ;; failed to figure out what this is: (when (or (zero? *growing-curve-torpedo*) (!= loading-level global)) (set! *growing-curve-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *growing-curve-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *growing-curve-torpedo* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -59,7 +59,7 @@ ;; failed to figure out what this is: (when (or (zero? *water-simple-alpha-curve-fade-out-torpedo*) (!= loading-level global)) (set! *water-simple-alpha-curve-fade-out-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-fade-out-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-fade-out-torpedo* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -77,7 +77,7 @@ ;; failed to figure out what this is: (when (or (zero? *color-curve-tan-brown-torpedo*) (!= loading-level global)) (set! *color-curve-tan-brown-torpedo* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *color-curve-tan-brown-torpedo* 2 'loading-level (the-as uint #f)) + (allocate! *color-curve-tan-brown-torpedo* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -113,7 +113,7 @@ ;; failed to figure out what this is: (when (or (zero? *water-simple-alpha-curve-in-torpedo*) (!= loading-level global)) (set! *water-simple-alpha-curve-in-torpedo* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *water-simple-alpha-curve-in-torpedo* 2 'loading-level (the-as int #f)) + (allocate! *water-simple-alpha-curve-in-torpedo* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -167,17 +167,15 @@ (set! (-> *torpedo-wake-trail* uv-repeat-dist) 81920.0) ;; failed to figure out what this is: -(set! (-> *torpedo-wake-trail* lie-mode) (the-as uint 1)) +(set! (-> *torpedo-wake-trail* lie-mode) (lie-mode appearance1)) ;; failed to figure out what this is: (set! (-> *torpedo-wake-trail* max-age) (seconds 0.3)) ;; failed to figure out what this is: (if #f - (set! (-> *torpedo-wake-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *torpedo-wake-trail* tex-id) (the-as uint #x500800)) + (set! (-> *torpedo-wake-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *torpedo-wake-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) ;; failed to figure out what this is: @@ -1622,7 +1620,7 @@ ) ;; definition for method 17 of type light-trail-tracker-torpedo -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-torpedo) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-torpedo) (arg0 process-focusable)) (let ((v1-0 arg0)) (and (-> (the-as htorpedo v1-0) on-water?) (< (-> v1-0 root trans y) 20480.0)) ) @@ -1630,7 +1628,7 @@ ;; definition for method 16 of type light-trail-tracker-torpedo ;; INFO: Used lq/sq -(defmethod light-trail-tracker-method-16 ((this light-trail-tracker-torpedo) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this light-trail-tracker-torpedo) (arg0 process-focusable) (arg1 vector)) (let ((v1-0 arg0)) (when v1-0 (set! (-> arg1 quad) (-> v1-0 root trans quad)) @@ -1682,7 +1680,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-34 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-torpedo (+ v1-34 8192) 1)) @@ -2091,7 +2089,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc index 14bcb78648..6716b38faa 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/assault-enemies_REF.gc @@ -1753,17 +1753,15 @@ (set! (-> *assault-bombbot-trail* uv-repeat-dist) 4096000.0) ;; failed to figure out what this is: -(set! (-> *assault-bombbot-trail* lie-mode) (the-as uint 0)) +(set! (-> *assault-bombbot-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *assault-bombbot-trail* max-age) (seconds 0.1)) ;; failed to figure out what this is: (if #f - (set! (-> *assault-bombbot-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *assault-bombbot-trail* tex-id) (the-as uint #x100300)) + (set! (-> *assault-bombbot-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *assault-bombbot-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -1832,17 +1830,15 @@ (set! (-> *assault-bombbot-trail-2* uv-repeat-dist) 4096000.0) ;; failed to figure out what this is: -(set! (-> *assault-bombbot-trail-2* lie-mode) (the-as uint 0)) +(set! (-> *assault-bombbot-trail-2* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *assault-bombbot-trail-2* max-age) (seconds 0.1)) ;; failed to figure out what this is: (if #f - (set! (-> *assault-bombbot-trail-2* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *assault-bombbot-trail-2* tex-id) (the-as uint #x100300)) + (set! (-> *assault-bombbot-trail-2* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *assault-bombbot-trail-2* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -1970,7 +1966,7 @@ (set! (-> gp-0 track-immediately?) #t) (let* ((v1-11 (estimate-light-trail-mem-usage (the-as uint (-> gp-0 max-num-crumbs)) - (the-as uint (= (-> gp-0 appearance lie-mode) 3)) + (the-as uint (= (-> gp-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-11 8192) 1)) @@ -1990,7 +1986,7 @@ (set! (-> gp-0 appearance) *assault-bombbot-trail-2*) (let* ((v1-20 (estimate-light-trail-mem-usage (the-as uint (-> gp-0 max-num-crumbs)) - (the-as uint (= (-> gp-0 appearance lie-mode) 3)) + (the-as uint (= (-> gp-0 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-20 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc b/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc index 8b80593d19..da907c0458 100644 --- a/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc +++ b/test/decompiler/reference/jak3/levels/city/protect/assault-task_REF.gc @@ -211,7 +211,7 @@ ;; failed to figure out what this is: (when (or (zero? *port-assault-blur-curve*) (!= loading-level global)) (set! *port-assault-blur-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *port-assault-blur-curve* 4 'loading-level (the-as int #t)) + (allocate! *port-assault-blur-curve* 4 'loading-level #t) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc b/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc index 8a5d811107..c3726fbe80 100644 --- a/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/chase/wcar-catapult_REF.gc @@ -1481,7 +1481,7 @@ ;; failed to figure out what this is: (when (or (zero? *v-catapult-shot-impact-blur*) (!= loading-level global)) (set! *v-catapult-shot-impact-blur* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *v-catapult-shot-impact-blur* 3 'loading-level (the-as int #f)) + (allocate! *v-catapult-shot-impact-blur* 3 'loading-level #f) ) ;; failed to figure out what this is: @@ -2412,7 +2412,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc index 369ba80d89..60134e87d2 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/des-beast-2_REF.gc @@ -510,7 +510,7 @@ (set! (-> s5-1 track-immediately?) #t) (let* ((v1-28 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1)) @@ -1178,7 +1178,3 @@ ) (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc index c3d67716d5..572d4701a5 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/des-beast_REF.gc @@ -4,7 +4,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-beast-linear-up-red*) (!= loading-level global)) (set! *curve-beast-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-beast-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-beast-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -83,17 +83,15 @@ (set! (-> *beast-grenade-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *beast-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *beast-grenade-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *beast-grenade-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *beast-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *beast-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *beast-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *beast-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -1040,7 +1038,7 @@ (set! (-> s5-1 track-immediately?) #t) (let* ((v1-22 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-22 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc b/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc index 4901a3284d..f4d9be8ab0 100644 --- a/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/hover/mh-flyer_REF.gc @@ -24,7 +24,7 @@ ;; failed to figure out what this is: (when (or (zero? *mh-flyer-curve-linear-up-red*) (!= loading-level global)) (set! *mh-flyer-curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *mh-flyer-curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *mh-flyer-curve-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -103,17 +103,15 @@ (set! (-> *mh-flyer-missile-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *mh-flyer-missile-trail* lie-mode) (the-as uint 0)) +(set! (-> *mh-flyer-missile-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *mh-flyer-missile-trail* max-age) (seconds 1)) ;; failed to figure out what this is: (if #f - (set! (-> *mh-flyer-missile-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *mh-flyer-missile-trail* tex-id) (the-as uint #x100300)) + (set! (-> *mh-flyer-missile-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *mh-flyer-missile-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -541,7 +539,7 @@ (set! (-> s5-5 track-immediately?) #t) (let* ((v0-8 (estimate-light-trail-mem-usage (the-as uint (-> s5-5 max-num-crumbs)) - (the-as uint (= (-> s5-5 appearance lie-mode) 3)) + (the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-8 8192) 1)) @@ -1601,7 +1599,3 @@ (mh-flyer-method-158 self) (go-virtual on-path) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc index 91f755e56e..51374c488f 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/desert-rescue_REF.gc @@ -1179,17 +1179,15 @@ (set! (-> *transport-tread-settings* uv-repeat-dist) 20480.0) ;; failed to figure out what this is: -(set! (-> *transport-tread-settings* lie-mode) (the-as uint 0)) +(set! (-> *transport-tread-settings* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *transport-tread-settings* max-age) (seconds 20)) ;; failed to figure out what this is: (if "tread-marks" - (set! (-> *transport-tread-settings* tex-id) - (the-as uint (lookup-texture-id-by-name "tread-marks" (the-as string #f))) - ) - (set! (-> *transport-tread-settings* tex-id) (the-as uint #x100300)) + (set! (-> *transport-tread-settings* tex-id) (lookup-texture-id-by-name "tread-marks" (the-as string #f))) + (set! (-> *transport-tread-settings* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -1330,14 +1328,12 @@ (vector+float*! s2-0 s2-0 (-> v1-4 fvec) -27852.8) (vector+float*! s3-0 s2-0 (-> v1-4 rvec) -14131.2) (vector+float*! s5-0 s2-0 (-> v1-4 rvec) 14131.2) - (set! (-> *transport-tread-settings* tex-id) - (the-as uint (lookup-texture-id-by-name "tread-marks" (the-as string #f))) - ) + (set! (-> *transport-tread-settings* tex-id) (lookup-texture-id-by-name "tread-marks" (the-as string #f))) (set! (-> s3-0 y) (probe-ground2 this s3-0 s4-0)) (+! (-> s3-0 y) 409.6) (let ((v1-11 (the-as tread-trail-tracker (handle->process (-> this tread1))))) (if (zero? (mod (-> this tread-last-spawn-index) (-> this tread-frequency))) - (tread-trail-method-22 (-> v1-11 trail) s3-0 s4-0) + (add-crumb-with-offset (-> v1-11 trail) s3-0 s4-0) (tread-trail-method-23 (-> v1-11 trail) s3-0 s4-0) ) ) @@ -1345,7 +1341,7 @@ (+! (-> s5-0 y) 409.6) (let ((v1-21 (the-as tread-trail-tracker (handle->process (-> this tread2))))) (if (zero? (mod (-> this tread-last-spawn-index) (-> this tread-frequency))) - (tread-trail-method-22 (-> v1-21 trail) s5-0 s4-0) + (add-crumb-with-offset (-> v1-21 trail) s5-0 s4-0) (tread-trail-method-23 (-> v1-21 trail) s5-0 s4-0) ) ) @@ -1559,7 +1555,7 @@ (let* ((v1-64 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-2 (get-process *default-dead-pool* tread-trail-tracker (+ v1-64 8192) 1)) @@ -1580,7 +1576,7 @@ (let* ((v1-73 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-3 (get-process *default-dead-pool* tread-trail-tracker (+ v1-73 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc b/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc index dad2245e1e..b451e98b80 100644 --- a/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/rescue/rope-prim-system_REF.gc @@ -85,10 +85,10 @@ (set! (-> sv-260 z) 1.0) (set! (-> sv-260 w) sv-128) (set! sv-256 (rgba<-rgbaf (the-as rgba sv-256) sv-260)) - (add-prim-vert this (-> this strip1) sv-240 (the-as rgba sv-256) 0.0 sv-132) - (add-prim-vert this (-> this strip1) sv-244 (the-as rgba sv-256) 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-248 (the-as rgba sv-256) 1.0 sv-132) - (add-prim-vert this (-> this strip2) sv-252 (the-as rgba sv-256) 0.0 sv-132) + (add-prim-vert this (-> this strip1) sv-240 sv-256 0.0 sv-132) + (add-prim-vert this (-> this strip1) sv-244 sv-256 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-248 sv-256 1.0 sv-132) + (add-prim-vert this (-> this strip2) sv-252 sv-256 0.0 sv-132) (+! f30-0 sv-136) ) ) @@ -328,7 +328,3 @@ ) #f ) - - - - diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc index c8d38a2d3f..4248482192 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wcar-projectiles_REF.gc @@ -599,7 +599,7 @@ (let* ((v1-26 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-26 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-part_REF.gc b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-part_REF.gc index ab5fb9fef5..0173be8c84 100644 --- a/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-part_REF.gc +++ b/test/decompiler/reference/jak3/levels/desert/wvehicle/wvehicle-part_REF.gc @@ -951,7 +951,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-toad-linear-up-red*) (!= loading-level global)) (set! *curve-toad-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-toad-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-toad-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -1030,17 +1030,15 @@ (set! (-> *toad-grenade-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *toad-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *toad-grenade-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *toad-grenade-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *toad-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *toad-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *toad-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *toad-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc b/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc index 2f61be87db..0da4978651 100644 --- a/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/factory/factory-manager_REF.gc @@ -78,7 +78,7 @@ ) ;; definition for method 17 of type light-trail-tracker-vehicle -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-vehicle) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-vehicle) (arg0 process-focusable)) #f ) @@ -121,17 +121,15 @@ (set! (-> *factory-fighter-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *factory-fighter-trail* lie-mode) (the-as uint 0)) +(set! (-> *factory-fighter-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *factory-fighter-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *factory-fighter-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *factory-fighter-trail* tex-id) (the-as uint #x100300)) + (set! (-> *factory-fighter-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *factory-fighter-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -1289,7 +1287,7 @@ (let* ((v1-38 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-vehicle (+ v1-38 8192) 1)) @@ -2063,7 +2061,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc b/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc index 13cc8fd6a8..de3575f3e5 100644 --- a/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc +++ b/test/decompiler/reference/jak3/levels/forest/forest-kill-plants_REF.gc @@ -239,17 +239,15 @@ (set! (-> *eco-green-trail* uv-repeat-dist) 102399.99) ;; failed to figure out what this is: -(set! (-> *eco-green-trail* lie-mode) (the-as uint 3)) +(set! (-> *eco-green-trail* lie-mode) (lie-mode use-two-strips)) ;; failed to figure out what this is: (set! (-> *eco-green-trail* max-age) (seconds 2)) ;; failed to figure out what this is: (if #f - (set! (-> *eco-green-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *eco-green-trail* tex-id) (the-as uint #x500800)) + (set! (-> *eco-green-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *eco-green-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5)) ) ;; failed to figure out what this is: @@ -299,12 +297,12 @@ ;; definition for method 17 of type eco-green-trail-tracker ;; WARN: Return type mismatch object vs symbol. -(defmethod light-trail-tracker-method-17 ((this eco-green-trail-tracker) (arg0 process-focusable)) +(defmethod should-track? ((this eco-green-trail-tracker) (arg0 process-focusable)) (the-as symbol (and *target* (focus-test? *target* board) (< 0.0 (-> *target* fact eco-green)))) ) ;; definition for method 16 of type eco-green-trail-tracker -(defmethod light-trail-tracker-method-16 ((this eco-green-trail-tracker) (arg0 process-focusable) (arg1 vector)) +(defmethod get-tracked-object-pos ((this eco-green-trail-tracker) (arg0 process-focusable) (arg1 vector)) (if *target* (vector<-cspace! arg1 (-> *target* node-list data 37)) ) @@ -455,7 +453,7 @@ (let* ((v1-62 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* eco-green-trail-tracker (+ v1-62 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc b/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc index 9ef7318466..1e6b2fbb27 100644 --- a/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc +++ b/test/decompiler/reference/jak3/levels/glider/glider-ring_REF.gc @@ -4,7 +4,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-glider-ring-linear-up-red*) (!= loading-level global)) (set! *curve-glider-ring-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-glider-ring-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-glider-ring-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -83,17 +83,15 @@ (set! (-> *glider-ring-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *glider-ring-trail* lie-mode) (the-as uint 0)) +(set! (-> *glider-ring-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *glider-ring-trail* max-age) (seconds 1)) ;; failed to figure out what this is: (if #f - (set! (-> *glider-ring-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *glider-ring-trail* tex-id) (the-as uint #x100300)) + (set! (-> *glider-ring-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *glider-ring-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -142,7 +140,7 @@ ) ;; definition for method 17 of type light-trail-tracker-glider-ring -(defmethod light-trail-tracker-method-17 ((this light-trail-tracker-glider-ring) (arg0 process-focusable)) +(defmethod should-track? ((this light-trail-tracker-glider-ring) (arg0 process-focusable)) #f ) @@ -823,7 +821,7 @@ (let* ((v1-64 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-glider-ring (+ v1-64 8192) 1)) @@ -978,7 +976,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc b/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc index 255c65330c..2349de605e 100644 --- a/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/mine-platforms_REF.gc @@ -398,7 +398,7 @@ ;; failed to figure out what this is: (when (or (zero? *drill-loop-mid-curve*) (!= loading-level global)) (set! *drill-loop-mid-curve* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *drill-loop-mid-curve* 3 'loading-level (the-as int #t)) + (allocate! *drill-loop-mid-curve* 3 'loading-level #t) ) ;; failed to figure out what this is: @@ -431,7 +431,7 @@ (let ((f0-3 (* 0.07692308 (+ -15.0 f30-0)))) 0.0 0.0 - (let* ((f26-0 (curve2d-method-9 *drill-loop-mid-curve* f0-3 3)) + (let* ((f26-0 (evaluate *drill-loop-mid-curve* f0-3 (loop-behavior use-default))) (f28-0 (lerp -0.5 0.25 f26-0)) ) (sound-play-by-name @@ -459,7 +459,7 @@ (let ((f0-15 (* 0.055555556 (+ -28.0 f30-0)))) 0.0 0.0 - (let* ((f26-1 (curve2d-method-9 *drill-loop-mid-curve* f0-15 3)) + (let* ((f26-1 (evaluate *drill-loop-mid-curve* f0-15 (loop-behavior use-default))) (f28-1 (lerp -0.5 0.25 f26-1)) ) (sound-play-by-name diff --git a/test/decompiler/reference/jak3/levels/mine/prebot-setup_REF.gc b/test/decompiler/reference/jak3/levels/mine/prebot-setup_REF.gc index 20453fba5a..54c5216697 100644 --- a/test/decompiler/reference/jak3/levels/mine/prebot-setup_REF.gc +++ b/test/decompiler/reference/jak3/levels/mine/prebot-setup_REF.gc @@ -686,7 +686,7 @@ ;; failed to figure out what this is: (when (or (zero? *prebot-sword-color-curve*) (!= loading-level global)) (set! *prebot-sword-color-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *prebot-sword-color-curve* 2 'loading-level (the-as uint #t)) + (allocate! *prebot-sword-color-curve* 2 'loading-level #t) ) ;; failed to figure out what this is: @@ -722,7 +722,7 @@ ;; failed to figure out what this is: (when (or (zero? *prebot-sword-white-red-curve*) (!= loading-level global)) (set! *prebot-sword-white-red-curve* (new 'loading-level 'curve-color-piecewise)) - (curve-color-piecewise-method-10 *prebot-sword-white-red-curve* 3 'loading-level (the-as uint #t)) + (allocate! *prebot-sword-white-red-curve* 3 'loading-level #t) ) ;; failed to figure out what this is: @@ -819,7 +819,7 @@ (set! (-> *prebot-sword-color-array* uv-repeat-dist) 40960.0) ;; failed to figure out what this is: -(set! (-> *prebot-sword-color-array* lie-mode) (the-as uint 0)) +(set! (-> *prebot-sword-color-array* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *prebot-sword-color-array* max-age) (seconds 0.3)) @@ -827,9 +827,9 @@ ;; failed to figure out what this is: (if #f (set! (-> *prebot-sword-color-array* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (lookup-texture-id-by-name (the-as string #f) (the-as string #f)) ) - (set! (-> *prebot-sword-color-array* tex-id) (the-as uint #x100300)) + (set! (-> *prebot-sword-color-array* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -918,12 +918,10 @@ (set! (-> s5-1 joint0) 3) (set! (-> s5-1 joint1) 5) (set! (-> s5-1 appearance) *prebot-sword-color-array*) - (set! (-> *prebot-sword-color-array* tex-id) - (the-as uint (lookup-texture-id-by-name "sword-trail-low" (the-as string #f))) - ) + (set! (-> *prebot-sword-color-array* tex-id) (lookup-texture-id-by-name "sword-trail-low" (the-as string #f))) (let* ((v1-43 (estimate-light-trail-mem-usage (the-as uint (-> s5-1 max-num-crumbs)) - (the-as uint (= (-> s5-1 appearance lie-mode) 3)) + (the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* weapon-trail-tracker (+ v1-43 8192) 1)) @@ -1345,7 +1343,3 @@ ) (prebot-go-next-stage) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc b/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc index 27c564eaba..a8ea293695 100644 --- a/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/bbush/des-bush-time-chase_REF.gc @@ -334,17 +334,15 @@ (set! (-> *bb-timer-chase-trail* uv-repeat-dist) 163840.0) ;; failed to figure out what this is: -(set! (-> *bb-timer-chase-trail* lie-mode) (the-as uint 0)) +(set! (-> *bb-timer-chase-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *bb-timer-chase-trail* max-age) (seconds 4)) ;; failed to figure out what this is: (if #f - (set! (-> *bb-timer-chase-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *bb-timer-chase-trail* tex-id) (the-as uint #x100300)) + (set! (-> *bb-timer-chase-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *bb-timer-chase-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -463,12 +461,12 @@ ((-> self start-tracking?) (when (time-elapsed? (-> self time-offset) (seconds 0.05)) (set-time! (-> self time-offset)) - (when (light-trail-tracker-method-17 self (the-as process-focusable gp-1)) + (when (should-track? self (the-as process-focusable gp-1)) (set! (-> self trail start-marker) (the-as uint 0)) (set! (-> self trail end-marker) (the-as uint 0)) - (light-trail-method-11 + (add-crumb! (-> self trail) - (light-trail-tracker-method-16 self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) + (get-tracked-object-pos self (the-as process-focusable gp-1) (new 'stack-no-clear 'vector)) 0 ) ) @@ -493,7 +491,7 @@ ) ;; definition for method 19 of type timer-chase-trail -(defmethod light-trail-tracker-method-19 ((this timer-chase-trail)) +(defmethod should-draw? ((this timer-chase-trail)) #t ) @@ -508,13 +506,13 @@ (set! (-> gp-1 tracked-obj) (process->handle self)) (set! (-> gp-1 appearance) *bb-timer-chase-trail*) (set! (-> *bb-timer-chase-trail* tex-id) - (the-as uint (lookup-texture-id-by-name "des-bush-timer-chase-trail" (the-as string #f))) + (lookup-texture-id-by-name "des-bush-timer-chase-trail" (the-as string #f)) ) (set! (-> gp-1 max-num-crumbs) 500) (set! (-> gp-1 track-immediately?) #f) (let* ((v1-18 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-0 (get-process *default-dead-pool* timer-chase-trail (+ v1-18 8192) 1)) diff --git a/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc b/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc index f724eca064..fe99ce0a9c 100644 --- a/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/dm-flyer_REF.gc @@ -24,7 +24,7 @@ ;; failed to figure out what this is: (when (or (zero? *dm-flyer-curve-linear-up-red*) (!= loading-level global)) (set! *dm-flyer-curve-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *dm-flyer-curve-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *dm-flyer-curve-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -103,17 +103,15 @@ (set! (-> *dm-flyer-missile-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *dm-flyer-missile-trail* lie-mode) (the-as uint 0)) +(set! (-> *dm-flyer-missile-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *dm-flyer-missile-trail* max-age) (seconds 1)) ;; failed to figure out what this is: (if #f - (set! (-> *dm-flyer-missile-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *dm-flyer-missile-trail* tex-id) (the-as uint #x100300)) + (set! (-> *dm-flyer-missile-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *dm-flyer-missile-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -640,7 +638,7 @@ (set! (-> s5-5 track-immediately?) #t) (let* ((v0-12 (estimate-light-trail-mem-usage (the-as uint (-> s5-5 max-num-crumbs)) - (the-as uint (= (-> s5-5 appearance lie-mode) 3)) + (the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-12 8192) 1)) @@ -682,7 +680,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc b/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc index ebc84c096d..5c40e5ffb8 100644 --- a/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/maker-projectile_REF.gc @@ -4,7 +4,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-maker-linear-up-red*) (!= loading-level global)) (set! *curve-maker-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-maker-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-maker-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -83,17 +83,15 @@ (set! (-> *maker-grenade-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *maker-grenade-trail* lie-mode) (the-as uint 0)) +(set! (-> *maker-grenade-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *maker-grenade-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *maker-grenade-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *maker-grenade-trail* tex-id) (the-as uint #x100300)) + (set! (-> *maker-grenade-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *maker-grenade-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -948,7 +946,7 @@ (set! (-> s5-2 track-immediately?) #t) (let* ((v1-32 (estimate-light-trail-mem-usage (the-as uint (-> s5-2 max-num-crumbs)) - (the-as uint (= (-> s5-2 appearance lie-mode) 3)) + (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-32 8192) 1)) @@ -967,7 +965,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc index 29dae7b7ca..3bbc7fc02d 100644 --- a/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc +++ b/test/decompiler/reference/jak3/levels/wascity/wasdef-manager_REF.gc @@ -445,7 +445,7 @@ ;; failed to figure out what this is: (when (or (zero? *curve-maker-entry-linear-up-red*) (!= loading-level global)) (set! *curve-maker-entry-linear-up-red* (new 'loading-level 'curve2d-piecewise)) - (curve2d-piecewise-method-10 *curve-maker-entry-linear-up-red* 2 'loading-level (the-as int #f)) + (allocate! *curve-maker-entry-linear-up-red* 2 'loading-level #f) ) ;; failed to figure out what this is: @@ -524,17 +524,15 @@ (set! (-> *maker-entry-trail* uv-repeat-dist) 16384000.0) ;; failed to figure out what this is: -(set! (-> *maker-entry-trail* lie-mode) (the-as uint 0)) +(set! (-> *maker-entry-trail* lie-mode) (lie-mode appearance0)) ;; failed to figure out what this is: (set! (-> *maker-entry-trail* max-age) (seconds 0.5)) ;; failed to figure out what this is: (if #f - (set! (-> *maker-entry-trail* tex-id) - (the-as uint (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) - ) - (set! (-> *maker-entry-trail* tex-id) (the-as uint #x100300)) + (set! (-> *maker-entry-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f))) + (set! (-> *maker-entry-trail* tex-id) (new 'static 'texture-id :index #x3 :page #x1)) ) ;; failed to figure out what this is: @@ -2569,7 +2567,7 @@ (let* ((v1-104 (estimate-light-trail-mem-usage (the-as uint (-> gp-1 max-num-crumbs)) - (the-as uint (= (-> gp-1 appearance lie-mode) 3)) + (the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips))) ) ) (s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-104 8192) 1)) @@ -2909,7 +2907,3 @@ 0 (none) ) - - - - diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 32c18ca30d..1b3e122609 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -387,7 +387,8 @@ "find-reposition-pt", // asm "(method 19 cloth-system)", - "(method 37 cloth-system)" + "(method 37 cloth-system)", + "(method 19 rope-prim-system)" ], "skip_compile_states": {