[decomp] clean up sync info (#735)

* clean up sync info

* clean up trajectory
This commit is contained in:
water111
2021-08-02 21:49:05 -04:00
committed by GitHub
parent 12446037bd
commit 5293f583a8
12 changed files with 1586 additions and 1002 deletions
+38 -65
View File
@@ -10173,15 +10173,15 @@
:size-assert #x8
:flag-assert #x1200000008
(:methods
(dummy-9 (_type_ float) float 9)
(dummy-10 (_type_) float 10)
(dummy-11 (_type_) float 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14) ;; 3 arg for parent 5 for child
(dummy-15 (_type_ process) float 15) ;; wip
(dummy-16 (_type_ float) float 16)
(dummy-17 (_type_) float 17)
(get-current-value (_type_ float) float 9)
(get-current-phase-no-mod (_type_) float 10)
(get-current-phase (_type_) float 11)
(get-current-value-with-mirror (_type_ float) float 12)
(get-current-phase-with-mirror (_type_) float 13)
(setup-params! (_type_ uint float float float) none 14)
(load-params! (_type_ process uint float float float) symbol 15)
(sync-now! (_type_ float) float 16)
(get-phase-offset (_type_) float 17)
)
)
@@ -10196,17 +10196,6 @@
:method-count-assert 18
:size-assert #x1c
:flag-assert #x120000001c
(:methods
;; (dummy-9 () none 9)
;; (dummy-10 () none 10)
;; (dummy-11 () none 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15) ;; wip
;; (dummy-16 () none 16)
;; (dummy-17 () none 17)
)
)
(deftype sync-info-paused (sync-info)
@@ -10216,17 +10205,6 @@
:method-count-assert 18
:size-assert #x10
:flag-assert #x1200000010
(:methods
(dummy-9 (_type_ float) float 9)
;; (dummy-10 () none 10)
(dummy-11 (_type_) float 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15) ;; wip
;; (dummy-16 () none 16)
;; (dummy-17 () none 17)
)
)
(deftype delayed-rand-float (structure)
@@ -10241,8 +10219,8 @@
:size-assert #x1c
:flag-assert #xb0000001c
(:methods
(dummy-9 (_type_ int int float) float 9)
(dummy-10 (_type_ ) float 10)
(set-params! (_type_ int int float) float 9)
(update! (_type_ ) float 10)
)
)
@@ -10258,8 +10236,8 @@
:size-assert #x18
:flag-assert #xb00000018
(:methods
(dummy-9 (_type_ float float float float) float 9)
(dummy-10 (_type_ float) float 10)
(set-params! (_type_ float float float float) float 9)
(update! (_type_ float) float 10)
)
)
@@ -10274,10 +10252,10 @@
:size-assert #x28
:flag-assert #xd00000028
(:methods
(dummy-9 (_type_ float float float float float float float) float 9)
(dummy-10 (_type_ float) float 10)
(dummy-11 (_type_) symbol 11) ;; bool
(dummy-12 (_type_) symbol 12) ;; bool
(set-params! (_type_ float float float float float float float) float 9)
(update! (_type_ float) float 10)
(at-min? (_type_) symbol 11) ;; bool
(at-max? (_type_) symbol 12) ;; bool
)
)
@@ -10294,10 +10272,10 @@
:size-assert #x30
:flag-assert #xd00000030
(:methods
(dummy-9 (_type_ int int float float) vector 9)
(dummy-10 (_type_) vector 10)
(dummy-11 (_type_) vector 11)
(dummy-12 (_type_) vector 12)
(set-params! (_type_ int int float float) vector 9)
(update-now! (_type_) vector 10)
(update-with-delay! (_type_) vector 11)
(update-with-delay-or-reset! (_type_) vector 12)
)
)
@@ -10313,8 +10291,8 @@
:size-assert #x3c
:flag-assert #xb0000003c
(:methods
(dummy-9 (_type_ vector float float float) vector 9)
(dummy-10 (_type_ vector) vector 10)
(set-params! (_type_ vector float float float) vector 9)
(update! (_type_ vector) vector 10)
)
)
@@ -10348,7 +10326,14 @@
(die-on-next-update! (_type_) _type_ 14)
)
)
;; trajectory-h
;; ----------------------
;; File - trajectory-h
;; Source Path - engine/physics/trajectory-h.gc
;; Containing DGOs - ['GAME', 'ENGINE']
;; Version - 3
(deftype trajectory (structure)
((initial-position vector :inline :offset-assert 0)
(initial-velocity vector :inline :offset-assert 16)
@@ -10359,28 +10344,16 @@
:size-assert #x28
:flag-assert #x1000000028
(:methods
(TODO-RENAME-9 (_type_ float vector) vector 9)
(TODO-RENAME-10 (_type_ float vector) vector 10)
(TODO-RENAME-11 (_type_ vector vector float float) none 11)
(TODO-RENAME-12 (_type_ vector vector float float) none 12)
(TODO-RENAME-13 (_type_ vector vector float float) none 13)
(TODO-RENAME-14 (_type_ vector vector float float) none 14)
(TODO-RENAME-15 (_type_) none 15)
(eval-position! (_type_ float vector) vector 9)
(eval-velocity! (_type_ float vector) vector 10)
(setup-from-to-duration! (_type_ vector vector float float) none 11)
(setup-from-to-xz-vel! (_type_ vector vector float float) none 12)
(setup-from-to-y-vel! (_type_ vector vector float float) none 13)
(setup-from-to-height! (_type_ vector vector float float) none 14)
(debug-draw! (_type_) none 15)
)
)
;; ----------------------
;; File - trajectory-h
;; Source Path - engine/physics/trajectory-h.gc
;; Containing DGOs - ['GAME', 'ENGINE']
;; Version - 3
;; - Unknowns
;;(define-extern trajectory object) ;; unknown type
;; ----------------------
;; File - debug-h
;; Source Path - engine/debug/debug-h.gc
@@ -406,13 +406,7 @@
"(anon-function 43 maincave-obs)",
"(anon-function 2 target-tube)",
"(anon-function 5 orbit-plat)",
"(anon-function 2 ogreboss)",
// not enough type info to decompile these
// (these are NOT actually asm functions)
"(method 15 sync-info)", // NEED *res-static-buf*
"(method 15 sync-info-eased)", // NEED *res-static-buf*
"(method 15 sync-info-paused)" // NEED *res-static-buf*
"(anon-function 2 ogreboss)"
],
@@ -527,6 +527,23 @@
["_stack_", 32, "res-tag"]
],
"(method 15 sync-info)": [
["_stack_", 16, "res-tag"],
[[19, 24], "v1", "(pointer float)"]
],
"(method 15 sync-info-eased)": [
["_stack_", 16, "res-tag"],
[[44, 49], "v1", "(pointer float)"],
[[26, 35], "v1", "(pointer float)"]
],
"(method 15 sync-info-paused)": [
["_stack_", 16, "res-tag"],
[[44, 49], "v1", "(pointer float)"],
[[26, 35], "v1", "(pointer float)"]
],
"(method 15 res-lump)": [[132, "s5", "res-tag-pair"]],
"(method 17 res-lump)": [[22, "s4", "(pointer pointer)"]],
@@ -1219,9 +1236,7 @@
[[106, 110], "v1", "dma-packet"]
],
"debug-menu-item-var-msg": [
[64, "t9", "(function int int int int int)"]
],
"debug-menu-item-var-msg": [[64, "t9", "(function int int int int int)"]],
"debug-menu-item-var-make-int": [
[21, "t9", "(function int int int int int)"]
@@ -1652,9 +1667,7 @@
[[28, 33], "t9", "(function object)"]
],
"(anon-function 1 cam-combiner)": [
[[0, 999], "s6", "camera-combiner"]
],
"(anon-function 1 cam-combiner)": [[[0, 999], "s6", "camera-combiner"]],
"(anon-function 2 cam-combiner)": [
[10, "a0", "vector"],
@@ -1688,9 +1701,7 @@
[[40, 42], "a1", "vector"]
],
"cam-slave-init-vars": [
[[0, 999], "s6", "camera-slave"]
],
"cam-slave-init-vars": [[[0, 999], "s6", "camera-slave"]],
"cam-slave-get-vector-with-offset": [[[52, 65], "s3", "vector"]],
@@ -1774,9 +1785,7 @@
[[17, 46], "v1", "matrix"]
],
"draw-ocean-transition": [
[255, "v1", "ocean-mid-mask"]
],
"draw-ocean-transition": [[255, "v1", "ocean-mid-mask"]],
// "ocean-trans-mask-ptrs-bit?": [
// [[32, 41], "a0", "(pointer ocean-trans-mask)"]
@@ -2558,7 +2558,7 @@
"sv-64": "spool-sound"
}
},
"(method 3 anim-tester)": {
"vars": {
"s5-0": ["s5-0", "anim-test-obj"],
@@ -2566,13 +2566,13 @@
"s3-0": ["s3-0", "anim-test-seq-item"]
}
},
"anim-test-obj-item-valid?": {
"vars": {
"s5-0": ["s5-0", "anim-test-sequence"]
}
},
"anim-test-obj-remove-invalid": {
"vars": {
//"s5-0": ["s5-0", "anim-test-sequence"],
@@ -2581,13 +2581,13 @@
"s2-0": ["s2-0", "anim-test-seq-item"]
}
},
"anim-tester-reset": {
"vars": {
"v1-1": ["v1-1", "anim-test-obj"]
}
},
"anim-tester-save-object-seqs": {
"vars": {
"s4-2": ["s4-2", "anim-test-seq-item"]
@@ -2772,36 +2772,36 @@
"level-remap-texture": {
"args": ["tex-id"],
"vars": {
"v1-1":"bsp-hdr",
"v1-1": "bsp-hdr",
"a3-0": "table-size",
"v1-2": ["table-data-start", "(pointer uint64)"],
"t0-0":"table-data-ptr",
"a1-1":"mask1",
"a2-1":"masked-tex-id",
"a3-2":"table-data-end",
"t0-3":"midpoint",
"t1-1":"diff"
"t0-0": "table-data-ptr",
"a1-1": "mask1",
"a2-1": "masked-tex-id",
"a3-2": "table-data-end",
"t0-3": "midpoint",
"t1-1": "diff"
}
},
"debug-menu-make-from-template": {
"vars": {
"s5-1": ["s5-1", "string"]
}
},
"debug-menu-item-var-render": {
"vars": {
"v1-14": ["v1-14", "dma-packet"]
}
},
"generic-add-constants": {
"vars": {
"a0-1": ["a0-1", "dma-packet"]
}
},
"generic-init-buf": {
"vars": {
"a0-2": ["a0-2", "dma-packet"],
@@ -2823,5 +2823,221 @@
}
},
"(method 14 sync-info)": {
"args": ["obj", "period", "phase"],
"vars": {
"f0-1": "period-float",
"f1-1": "value"
}
},
"(method 14 sync-info-eased)": {
"args": ["obj", "period", "phase", "out-param", "in-param"],
"vars": {
"f0-9": "total-easing-phase",
"f1-11": "total-normal-phase",
"f0-1": "period-float",
"f1-1": "value",
"f3-4": "y-end"
}
},
"(method 14 sync-info-paused)": {
"args": ["obj", "period", "phase", "out-param", "in-param"]
},
"(method 15 sync-info)": {
"args": [
"obj",
"proc",
"default-period",
"default-phase",
"default-out",
"default-in"
]
},
"(method 15 sync-info-eased)": {
"args": [
"obj",
"proc",
"default-period",
"default-phase",
"default-out",
"default-in"
]
},
"(method 15 sync-info-paused)": {
"args": [
"obj",
"proc",
"default-period",
"default-phase",
"default-out",
"default-in"
]
},
"(method 10 sync-info)": {
"vars": {
"v1-0": "period",
"f0-1": "period-float",
"f1-2": "current-time"
}
},
"(method 16 sync-info)": {
"args": ["obj", "user-time-offset"],
"vars": {
"a2-0": "period",
"f0-1": "period-float",
"v1-0": "wrapped-user-offset",
"f1-4": "current-time",
"f1-6": "current-time-wrapped",
"f1-10": "combined-offset",
"f0-3": "combined-offset-wrapped"
}
},
"(method 11 sync-info)": {
"vars": {
"v1-0": "period",
"f0-1": "period-float",
"f1-2": "current-time"
}
},
"(method 11 sync-info-paused)": {
"vars": {
"v1-0": "period",
"f1-0": "period-float",
"f0-1": "max-phase",
"f2-2": "current-time"
}
},
"(method 9 sync-info)": {
"args": ["obj", "max-val"],
"vars": {
"v1-0": "period",
"f0-1": "period-float",
"f1-2": "current-time"
}
},
"(method 13 sync-info)": {
"args": ["obj"],
"vars": {
"v1-0": "period",
"f1-0": "period-float",
"f2-2": "current-time",
"f0-1": "max-val",
"f0-2": "phase-out-of-2"
}
},
"(method 13 sync-info-eased)": {
"args": ["obj"],
"vars": {
"v1-0": "period",
"f1-0": "period-float",
"f0-1": "max-val",
"f2-2": "current-time",
"f0-2": "current-val",
"v1-2": "in-mirror?",
"f1-4": "tlo",
"f0-7": "eased-phase"
}
},
"(method 12 sync-info)": {
"args": ["obj", "max-out-val"],
"vars": {
"v1-0": "period",
"f1-0": "period-float",
"f0-1": "max-val",
"f2-2": "current-time",
"f0-2": "current-val"
}
},
"(method 12 sync-info-eased)": {
"args": ["obj", "max-out-val"]
},
"(method 12 sync-info-paused)": {
"args": ["obj", "max-out-val"]
},
"(method 9 delayed-rand-float)": {
"args": ["obj", "min-tim", "max-time", "max-times-two"]
},
"(method 10 oscillating-float)": {
"args": ["obj", "target-offset"],
"vars": { "f0-3": "acc" }
},
"(method 9 oscillating-float)": {
"args": ["obj", "init-val", "accel", "max-vel", "damping"]
},
"(method 9 bouncing-float)": {
"args": [
"obj",
"init-val",
"max-val",
"min-val",
"elast",
"accel",
"max-vel",
"damping"
]
},
"(method 9 delayed-rand-vector)": {
"args": ["obj", "min-time", "max-time", "xz-range", "y-range"]
},
"(method 9 oscillating-vector)": {
"args": ["obj", "init-val", "accel", "max-vel", "damping"]
},
"(method 10 oscillating-vector)": {
"args": ["obj", "target-offset"],
"vars": { "f0-2": "vel" }
},
"(method 9 trajectory)": {
"args": ["obj", "time", "result"]
},
"(method 10 trajectory)": {
"args": ["obj", "time", "result"]
},
"(method 11 trajectory)": {
"args": ["obj", "from", "to", "duration", "grav"],
"vars": { "f0-3": "xz-vel" }
},
"(method 12 trajectory)": {
"args": ["obj", "from", "to", "xz-vel", "grav"],
"vars": { "f0-1": "duration" }
},
"(method 13 trajectory)": {
"args": ["obj", "from", "to", "y-vel", "grav"]
},
"(method 15 trajectory)": {
"vars":{
"s5-0":"prev-pos",
"s4-0":"pos",
"s3-0":"num-segments",
"f0-1":"t-eval"
}
},
"aaaaaaaaaaaaaaaaaaaaaaa": {}
}
+11 -8
View File
@@ -5,7 +5,10 @@
;; name in dgo: trajectory-h
;; dgos: GAME, ENGINE
;; definition of type trajectory
;; Trajectory represents a ballistic trajectory.
;; First, call one of the setup methods to setup the trajectory object.
;; Then, use eval-position or eval-velocity to get the position or velocity of the
;; object along the trajectory.
(deftype trajectory (structure)
((initial-position vector :inline :offset-assert 0)
(initial-velocity vector :inline :offset-assert 16)
@@ -16,13 +19,13 @@
:size-assert #x28
:flag-assert #x1000000028
(:methods
(TODO-RENAME-9 (_type_ float vector) vector 9)
(TODO-RENAME-10 (_type_ float vector) vector 10)
(TODO-RENAME-11 (_type_ vector vector float float) none 11)
(TODO-RENAME-12 (_type_ vector vector float float) none 12)
(TODO-RENAME-13 (_type_ vector vector float float) none 13)
(TODO-RENAME-14 (_type_ vector vector float float) none 14)
(TODO-RENAME-15 (_type_) none 15)
(eval-position! (_type_ float vector) vector 9)
(eval-velocity! (_type_ float vector) vector 10)
(setup-from-to-duration! (_type_ vector vector float float) none 11)
(setup-from-to-xz-vel! (_type_ vector vector float float) none 12)
(setup-from-to-y-vel! (_type_ vector vector float float) none 13)
(setup-from-to-height! (_type_ vector vector float float) none 14)
(debug-draw! (_type_) none 15)
)
)
+68 -93
View File
@@ -5,94 +5,72 @@
;; name in dgo: trajectory
;; dgos: GAME, ENGINE
;; definition for method 9 of type trajectory
;; Used lq/sq
(defmethod TODO-RENAME-9 trajectory ((obj trajectory) (arg0 float) (arg1 vector))
(let ((v1-0 arg1))
(set! (-> v1-0 quad) (-> obj initial-position quad))
)
(set! (-> arg1 x) (+ (-> arg1 x) (* arg0 (-> obj initial-velocity x))))
(set! (-> arg1 y) (+ (-> arg1 y) (* arg0 (-> obj initial-velocity y))))
(set! (-> arg1 z) (+ (-> arg1 z) (* arg0 (-> obj initial-velocity z))))
(set! (-> arg1 y) (+ (-> arg1 y) (* (* (* 0.5 arg0) arg0) (-> obj gravity))))
arg1
(defmethod eval-position! trajectory ((obj trajectory) (time float) (result vector))
"Evaluate the position of the object at a give time"
(set! (-> result quad) (-> obj initial-position quad))
(+! (-> result x) (* time (-> obj initial-velocity x)))
(+! (-> result y) (* time (-> obj initial-velocity y)))
(+! (-> result z) (* time (-> obj initial-velocity z)))
(+! (-> result y) (* (* (* 0.5 time) time) (-> obj gravity)))
result
)
;; definition for method 10 of type trajectory
;; Used lq/sq
(defmethod
TODO-RENAME-10
trajectory
((obj trajectory) (arg0 float) (arg1 vector))
(let ((v1-0 arg1))
(set! (-> v1-0 quad) (-> obj initial-velocity quad))
)
(set! (-> arg1 y) (+ (-> arg1 y) (* arg0 (-> obj gravity))))
arg1
(defmethod eval-velocity! trajectory ((obj trajectory) (time float) (result vector))
"Evaluate the velocity of the object at a given time"
(set! (-> result quad) (-> obj initial-velocity quad))
(+! (-> result y) (* time (-> obj gravity)))
result
)
;; definition for method 11 of type trajectory
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod TODO-RENAME-11 trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(set! (-> obj initial-position quad) (-> arg0 quad))
(set! (-> obj gravity) arg3)
(set! (-> obj time) arg2)
(let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(vector-! (-> obj initial-velocity) arg1 arg0)
(vector-xz-normalize! (-> obj initial-velocity) f0-3)
(defmethod setup-from-to-duration! trajectory ((obj trajectory) (from vector) (to vector) (duration float) (grav float))
"Set up a trajectory that goes from->to in the given duration"
(set! (-> obj initial-position quad) (-> from quad))
(set! (-> obj gravity) grav)
(set! (-> obj time) duration)
;; the velocity we need in xz to make it in time
(let ((xz-vel (/ (vector-vector-xz-distance to from) duration)))
;; our velocity will point along from -> to
(vector-! (-> obj initial-velocity) to from)
;; but have magnitude that we calculated above.
(vector-xz-normalize! (-> obj initial-velocity) xz-vel)
)
(set!
(-> obj initial-velocity y)
(- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* (* 0.5 arg2) (-> obj gravity)))
)
(let ((v0-2 0))
;; solve for the y velocity that makes us land at the right height.
(set! (-> obj initial-velocity y)
(- (/ (- (-> to y) (-> from y)) duration)
(* (* 0.5 duration) (-> obj gravity))
)
(none)
)
;; definition for method 12 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-12
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
((method-of-type trajectory TODO-RENAME-11) obj arg0 arg1 f0-1 arg3)
)
(let ((v0-1 0))
)
(none)
)
;; definition for method 13 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-13
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-0 arg2)
(f1-3 (- (* f0-0 f0-0) (* (* 2.0 (- (-> arg0 y) (-> arg1 y))) arg3)))
(defmethod setup-from-to-xz-vel! trajectory ((obj trajectory) (from vector) (to vector) (xz-vel float) (grav float))
"Set up a trajectory that goes from->to with the given velocity"
;; just solve for the duration and use the previous
(let ((duration (/ (vector-vector-xz-distance to from) xz-vel)))
(setup-from-to-duration! obj from to duration grav)
)
(none)
)
(defmethod setup-from-to-y-vel! trajectory ((obj trajectory) (from vector) (to vector) (y-vel float) (grav float))
"Set up a trajectory with the given initial y velocity."
(let* ((f0-0 y-vel)
(f1-3 (- (* f0-0 f0-0) (* (* 2.0 (- (-> from y) (-> to y))) grav)))
(f0-3 900.0)
)
(when (>= f1-3 0.0)
(let ((f0-4 (sqrtf f1-3)))
(set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3)))
(set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav)))
)
)
((method-of-type trajectory TODO-RENAME-11) obj arg0 arg1 f0-3 arg3)
)
(let ((v0-1 0))
(setup-from-to-duration! obj from to f0-3 grav)
)
0
(none)
)
;; definition for method 14 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-14
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(defmethod setup-from-to-height! trajectory ((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
"Setup a trajectory that reaches a given height"
(let* ((f1-2 (+ arg2 (fmax (-> arg0 y) (-> arg1 y))))
(f1-5 (* (* 2.0 (- (-> arg0 y) f1-2)) arg3))
(f0-3 4096.0)
@@ -100,36 +78,33 @@
(if (< 0.0 f1-5)
(set! f0-3 (sqrtf f1-5))
)
((method-of-type trajectory TODO-RENAME-13) obj arg0 arg1 f0-3 arg3)
)
(let ((v0-1 0))
(setup-from-to-y-vel! obj arg0 arg1 f0-3 arg3)
)
(none)
)
;; definition for method 15 of type trajectory
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod TODO-RENAME-15 trajectory ((obj trajectory))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 10)
(defmethod debug-draw! trajectory ((obj trajectory))
"Draw the trajectory"
(let ((prev-pos (new 'stack-no-clear 'vector))
(pos (new 'stack-no-clear 'vector))
(num-segments 10)
)
(let ((v1-0 s4-0))
(set! (-> v1-0 quad) (-> obj initial-position quad))
(set! (-> pos quad) (-> obj initial-position quad))
(dotimes (s2-0 num-segments)
(set! (-> prev-pos quad) (-> pos quad))
(let ((t-eval (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float num-segments)))))
(eval-position! obj t-eval pos)
)
(add-debug-line
#t
(bucket-id debug-draw1)
prev-pos
pos
(new 'static 'rgba :r #xff :a #x80)
#f
(the-as rgba -1)
)
)
)
(dotimes (s2-0 s3-0)
(let ((v1-1 s5-0))
(set! (-> v1-1 quad) (-> s4-0 quad))
)
(let
((f0-1 (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float s3-0)))))
((method-of-type trajectory TODO-RENAME-9) obj f0-1 s4-0)
)
(add-debug-line #t (the bucket-id 68) s5-0 s4-0 (new 'static 'rgba :r #xff :a #x80) #f (the rgba -1))
)
)
(let ((v0-2 0))
)
(none)
)
+68 -77
View File
@@ -5,26 +5,35 @@
;; name in dgo: sync-info-h
;; dgos: GAME, ENGINE
;; The sync-info system is used to synchronize the motion of objects.
;; For example, platforms use this to have consistent relative positions.
;; There are also some non-syncronized movement helpers in here.
;; Simplest synchronization. Simply counts up, then resets once it reaches period.
;; For example, this is used to synchronize the "pies" in citadel.
(deftype sync-info (structure)
((offset float :offset-assert 0)
(period uint32 :offset-assert 4)
((offset float :offset-assert 0) ;; offset, stored as a time, not a phase.
(period uint32 :offset-assert 4) ;; period, stored in seconds units
)
:method-count-assert 18
:size-assert #x8
:flag-assert #x1200000008
(:methods
(dummy-9 (_type_ float) float 9)
(dummy-10 (_type_) float 10)
(dummy-11 (_type_) float 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15) ;; wip
(dummy-16 (_type_ float) float 16)
(dummy-17 (_type_) float 17)
)
(get-current-value (_type_ float) float 9)
(get-current-phase-no-mod (_type_) float 10)
(get-current-phase (_type_) float 11)
(get-current-value-with-mirror (_type_ float) float 12)
(get-current-phase-with-mirror (_type_) float 13)
(setup-params! (_type_ uint float float float) none 14)
(load-params! (_type_ process uint float float float) symbol 15)
(sync-now! (_type_ float) float 16)
(get-phase-offset (_type_) float 17)
)
)
;; Syncronized, but also includes some smoothing at the beginning.
;; This is used for motion of platforms.
(deftype sync-info-eased (sync-info)
((tlo float :offset-assert 8)
(thi float :offset-assert 12)
@@ -36,19 +45,10 @@
:method-count-assert 18
:size-assert #x1c
:flag-assert #x120000001c
(:methods
;; (dummy-9 () none 9)
;; (dummy-10 () none 10)
;; (dummy-11 () none 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15) ;; wip
;; (dummy-16 () none 16)
;; (dummy-17 () none 17)
)
)
;; Syncronized, but includes a pause.
;; This is used for whirlpools in lpc and the pushers in the yellow-eco room in snowy
(deftype sync-info-paused (sync-info)
((pause-after-out float :offset-assert 8)
(pause-after-in float :offset-assert 12)
@@ -56,19 +56,9 @@
:method-count-assert 18
:size-assert #x10
:flag-assert #x1200000010
(:methods
(dummy-9 (_type_ float) float 9)
;; (dummy-10 () none 10)
(dummy-11 (_type_) float 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15) ;; wip
;; (dummy-16 () none 16)
;; (dummy-17 () none 17)
)
)
;; This is a strange one. After a random amount of time, it changes to a random value.
(deftype delayed-rand-float (structure)
((min-time int32 :offset-assert 0)
(max-time int32 :offset-assert 4)
@@ -81,79 +71,80 @@
:size-assert #x1c
:flag-assert #xb0000001c
(:methods
(dummy-9 (_type_ int int float) float 9)
(dummy-10 (_type_ ) float 10)
)
(set-params! (_type_ int int float) float 9)
(update! (_type_) float 10)
)
)
(deftype oscillating-float (structure)
((value float :offset-assert 0)
(target float :offset-assert 4)
(vel float :offset-assert 8)
(max-vel float :offset-assert 12)
(damping float :offset-assert 16)
(accel float :offset-assert 20)
((value float :offset-assert 0)
(target float :offset-assert 4)
(vel float :offset-assert 8)
(max-vel float :offset-assert 12)
(damping float :offset-assert 16)
(accel float :offset-assert 20)
)
:method-count-assert 11
:size-assert #x18
:flag-assert #xb00000018
(:methods
(dummy-9 (_type_ float float float float) float 9)
(dummy-10 (_type_ float) float 10)
)
(set-params! (_type_ float float float float) float 9)
(update! (_type_ float) float 10)
)
)
(deftype bouncing-float (structure)
((osc oscillating-float :inline :offset-assert 0)
(max-value float :offset-assert 24)
(min-value float :offset-assert 28)
(elasticity float :offset-assert 32)
(state int32 :offset-assert 36)
((osc oscillating-float :inline :offset-assert 0)
(max-value float :offset-assert 24)
(min-value float :offset-assert 28)
(elasticity float :offset-assert 32)
(state int32 :offset-assert 36)
)
:method-count-assert 13
:size-assert #x28
:flag-assert #xd00000028
(:methods
(dummy-9 (_type_ float float float float float float float) float 9)
(dummy-10 (_type_ float) float 10)
(dummy-11 (_type_) symbol 11) ;; bool
(dummy-12 (_type_) symbol 12) ;; bool
)
(set-params! (_type_ float float float float float float float) float 9)
(update! (_type_ float) float 10)
(at-min? (_type_) symbol 11)
(at-max? (_type_) symbol 12)
)
)
(deftype delayed-rand-vector (structure)
((min-time int32 :offset-assert 0)
(max-time int32 :offset-assert 4)
(xz-max float :offset-assert 8)
(y-max float :offset-assert 12)
(timer int32 :offset-assert 16)
(start-time uint64 :offset-assert 24)
(value vector :inline :offset-assert 32)
((min-time int32 :offset-assert 0)
(max-time int32 :offset-assert 4)
(xz-max float :offset-assert 8)
(y-max float :offset-assert 12)
(timer int32 :offset-assert 16)
(start-time uint64 :offset-assert 24)
(value vector :inline :offset-assert 32)
)
:method-count-assert 13
:size-assert #x30
:flag-assert #xd00000030
(:methods
(dummy-9 (_type_ int int float float) vector 9)
(dummy-10 (_type_) vector 10)
(dummy-11 (_type_) vector 11)
(dummy-12 (_type_) vector 12)
)
(set-params! (_type_ int int float float) vector 9)
(update-now! (_type_) vector 10)
(update-with-delay! (_type_) vector 11)
(update-with-delay-or-reset! (_type_) vector 12)
)
)
(deftype oscillating-vector (structure)
((value vector :inline :offset-assert 0)
(target vector :inline :offset-assert 16)
(vel vector :inline :offset-assert 32)
(max-vel float :offset-assert 48)
(damping float :offset-assert 52)
(accel float :offset-assert 56)
((value vector :inline :offset-assert 0)
(target vector :inline :offset-assert 16)
(vel vector :inline :offset-assert 32)
(max-vel float :offset-assert 48)
(damping float :offset-assert 52)
(accel float :offset-assert 56)
)
:method-count-assert 11
:size-assert #x3c
:flag-assert #xb0000003c
(:methods
(dummy-9 (_type_ vector float float float) vector 9)
(dummy-10 (_type_ vector) vector 10)
)
(set-params! (_type_ vector float float float) vector 9)
(update! (_type_ vector) vector 10)
)
)
File diff suppressed because it is too large Load Diff
@@ -12,13 +12,13 @@
:size-assert #x28
:flag-assert #x1000000028
(:methods
(TODO-RENAME-9 (_type_ float vector) vector 9)
(TODO-RENAME-10 (_type_ float vector) vector 10)
(TODO-RENAME-11 (_type_ vector vector float float) none 11)
(TODO-RENAME-12 (_type_ vector vector float float) none 12)
(TODO-RENAME-13 (_type_ vector vector float float) none 13)
(TODO-RENAME-14 (_type_ vector vector float float) none 14)
(TODO-RENAME-15 (_type_) none 15)
(eval-position! (_type_ float vector) vector 9)
(eval-velocity! (_type_ float vector) vector 10)
(setup-from-to-duration! (_type_ vector vector float float) none 11)
(setup-from-to-xz-vel! (_type_ vector vector float float) none 12)
(setup-from-to-y-vel! (_type_ vector vector float float) none 13)
(setup-from-to-height! (_type_ vector vector float float) none 14)
(debug-draw! (_type_) none 15)
)
)
@@ -34,3 +34,7 @@
;; failed to figure out what this is:
0
@@ -3,43 +3,49 @@
;; definition for method 9 of type trajectory
;; Used lq/sq
(defmethod TODO-RENAME-9 trajectory ((obj trajectory) (arg0 float) (arg1 vector))
(set! (-> arg1 quad) (-> obj initial-position quad))
(+! (-> arg1 x) (* arg0 (-> obj initial-velocity x)))
(+! (-> arg1 y) (* arg0 (-> obj initial-velocity y)))
(+! (-> arg1 z) (* arg0 (-> obj initial-velocity z)))
(+! (-> arg1 y) (* (* (* 0.5 arg0) arg0) (-> obj gravity)))
arg1
(defmethod
eval-position!
trajectory
((obj trajectory) (time float) (result vector))
(set! (-> result quad) (-> obj initial-position quad))
(+! (-> result x) (* time (-> obj initial-velocity x)))
(+! (-> result y) (* time (-> obj initial-velocity y)))
(+! (-> result z) (* time (-> obj initial-velocity z)))
(+! (-> result y) (* (* (* 0.5 time) time) (-> obj gravity)))
result
)
;; definition for method 10 of type trajectory
;; Used lq/sq
(defmethod
TODO-RENAME-10
eval-velocity!
trajectory
((obj trajectory) (arg0 float) (arg1 vector))
(set! (-> arg1 quad) (-> obj initial-velocity quad))
(+! (-> arg1 y) (* arg0 (-> obj gravity)))
arg1
((obj trajectory) (time float) (result vector))
(set! (-> result quad) (-> obj initial-velocity quad))
(+! (-> result y) (* time (-> obj gravity)))
result
)
;; definition for method 11 of type trajectory
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod
TODO-RENAME-11
setup-from-to-duration!
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(set! (-> obj initial-position quad) (-> arg0 quad))
(set! (-> obj gravity) arg3)
(set! (-> obj time) arg2)
(let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(vector-! (-> obj initial-velocity) arg1 arg0)
(vector-xz-normalize! (-> obj initial-velocity) f0-3)
((obj trajectory) (from vector) (to vector) (duration float) (grav float))
(set! (-> obj initial-position quad) (-> from quad))
(set! (-> obj gravity) grav)
(set! (-> obj time) duration)
(let ((xz-vel (/ (vector-vector-xz-distance to from) duration)))
(vector-! (-> obj initial-velocity) to from)
(vector-xz-normalize! (-> obj initial-velocity) xz-vel)
)
(set!
(-> obj initial-velocity y)
(- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* (* 0.5 arg2) (-> obj gravity)))
(-
(/ (- (-> to y) (-> from y)) duration)
(* (* 0.5 duration) (-> obj gravity))
)
)
0
(none)
@@ -48,11 +54,11 @@
;; definition for method 12 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-12
setup-from-to-xz-vel!
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(TODO-RENAME-11 obj arg0 arg1 f0-1 arg3)
((obj trajectory) (from vector) (to vector) (xz-vel float) (grav float))
(let ((duration (/ (vector-vector-xz-distance to from) xz-vel)))
(setup-from-to-duration! obj from to duration grav)
)
0
(none)
@@ -61,19 +67,19 @@
;; definition for method 13 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-13
setup-from-to-y-vel!
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-0 arg2)
(f1-3 (- (* f0-0 f0-0) (* (* 2.0 (- (-> arg0 y) (-> arg1 y))) arg3)))
((obj trajectory) (from vector) (to vector) (y-vel float) (grav float))
(let* ((f0-0 y-vel)
(f1-3 (- (* f0-0 f0-0) (* (* 2.0 (- (-> from y) (-> to y))) grav)))
(f0-3 900.0)
)
(when (>= f1-3 0.0)
(let ((f0-4 (sqrtf f1-3)))
(set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3)))
(set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav)))
)
)
(TODO-RENAME-11 obj arg0 arg1 f0-3 arg3)
(setup-from-to-duration! obj from to f0-3 grav)
)
0
(none)
@@ -82,7 +88,7 @@
;; definition for method 14 of type trajectory
;; INFO: Return type mismatch int vs none.
(defmethod
TODO-RENAME-14
setup-from-to-height!
trajectory
((obj trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f1-2 (+ arg2 (fmax (-> arg0 y) (-> arg1 y))))
@@ -92,7 +98,7 @@
(if (< 0.0 f1-5)
(set! f0-3 (sqrtf f1-5))
)
(TODO-RENAME-13 obj arg0 arg1 f0-3 arg3)
(setup-from-to-y-vel! obj arg0 arg1 f0-3 arg3)
)
0
(none)
@@ -101,23 +107,26 @@
;; definition for method 15 of type trajectory
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod TODO-RENAME-15 trajectory ((obj trajectory))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 10)
(defmethod debug-draw! trajectory ((obj trajectory))
(let ((prev-pos (new 'stack-no-clear 'vector))
(pos (new 'stack-no-clear 'vector))
(num-segments 10)
)
(set! (-> s4-0 quad) (-> obj initial-position quad))
(dotimes (s2-0 s3-0)
(set! (-> s5-0 quad) (-> s4-0 quad))
(set! (-> pos quad) (-> obj initial-position quad))
(dotimes (s2-0 num-segments)
(set! (-> prev-pos quad) (-> pos quad))
(let
((f0-1 (* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float s3-0)))))
(TODO-RENAME-9 obj f0-1 s4-0)
((t-eval
(* (-> obj time) (/ (+ 1.0 (the float s2-0)) (the float num-segments)))
)
)
(eval-position! obj t-eval pos)
)
(add-debug-line
#t
(bucket-id debug-draw1)
s5-0
s4-0
prev-pos
pos
(new 'static 'rgba :r #xff :a #x80)
#f
(the-as rgba -1)
@@ -127,3 +136,7 @@
0
(none)
)
@@ -10,15 +10,15 @@
:size-assert #x8
:flag-assert #x1200000008
(:methods
(dummy-9 (_type_ float) float 9)
(dummy-10 (_type_) float 10)
(dummy-11 (_type_) float 11)
(dummy-12 (_type_ float) float 12)
(dummy-13 (_type_) float 13)
(dummy-14 (_type_ uint float float float) int 14)
(dummy-15 (_type_ process) float 15)
(dummy-16 (_type_ float) float 16)
(dummy-17 (_type_) float 17)
(get-current-value (_type_ float) float 9)
(get-current-phase-no-mod (_type_) float 10)
(get-current-phase (_type_) float 11)
(get-current-value-with-mirror (_type_ float) float 12)
(get-current-phase-with-mirror (_type_) float 13)
(setup-params! (_type_ uint float float float) none 14)
(load-params! (_type_ process uint float float float) symbol 15)
(sync-now! (_type_ float) float 16)
(get-phase-offset (_type_) float 17)
)
)
@@ -89,8 +89,8 @@
:size-assert #x1c
:flag-assert #xb0000001c
(:methods
(dummy-9 (_type_ int int float) float 9)
(dummy-10 (_type_) float 10)
(set-params! (_type_ int int float) float 9)
(update! (_type_) float 10)
)
)
@@ -119,8 +119,8 @@
:size-assert #x18
:flag-assert #xb00000018
(:methods
(dummy-9 (_type_ float float float float) float 9)
(dummy-10 (_type_ float) float 10)
(set-params! (_type_ float float float float) float 9)
(update! (_type_ float) float 10)
)
)
@@ -148,10 +148,10 @@
:size-assert #x28
:flag-assert #xd00000028
(:methods
(dummy-9 (_type_ float float float float float float float) float 9)
(dummy-10 (_type_ float) float 10)
(dummy-11 (_type_) symbol 11)
(dummy-12 (_type_) symbol 12)
(set-params! (_type_ float float float float float float float) float 9)
(update! (_type_ float) float 10)
(at-min? (_type_) symbol 11)
(at-max? (_type_) symbol 12)
)
)
@@ -180,10 +180,10 @@
:size-assert #x30
:flag-assert #xd00000030
(:methods
(dummy-9 (_type_ int int float float) vector 9)
(dummy-10 (_type_) vector 10)
(dummy-11 (_type_) vector 11)
(dummy-12 (_type_) vector 12)
(set-params! (_type_ int int float float) vector 9)
(update-now! (_type_) vector 10)
(update-with-delay! (_type_) vector 11)
(update-with-delay-or-reset! (_type_) vector 12)
)
)
@@ -213,8 +213,8 @@
:size-assert #x3c
:flag-assert #xb0000003c
(:methods
(dummy-9 (_type_ vector float float float) vector 9)
(dummy-10 (_type_ vector) vector 10)
(set-params! (_type_ vector float float float) vector 9)
(update! (_type_ vector) vector 10)
)
)
@@ -232,3 +232,7 @@
;; failed to figure out what this is:
0
File diff suppressed because it is too large Load Diff