mirror of
https://github.com/open-goal/jak-project
synced 2026-06-06 19:52:01 -04:00
64ae2d6d39
* move commonly used scripts to specific folders * fixes * Update test.sh * Update test.sh * Fix file permission * move commonly used scripts to specific folders * fixes * Update test.sh * Update test.sh * Fix file permission * [dynamics-h] clean-up * make things neat * update surface-h * [sync-info] decomp 1 * move commonly used scripts to specific folders * fixes * Update test.sh * Update test.sh * Fix file permission * move commonly used scripts to specific folders * fixes * Update test.sh * Update test.sh * Fix file permission * [sync-info] update decomp * Update gravity-h.gc * [windows] separate scripts for runtime w/ or w/o display * Update dynamics-h.gc * Add offline test for sync-info * clang
59 lines
1.7 KiB
Common Lisp
59 lines
1.7 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: dynamics-h.gc
|
|
;; name in dgo: dynamics-h
|
|
;; dgos: GAME, ENGINE
|
|
|
|
;; TODO move these elsewhere
|
|
(defglobalconstant TICKS_TO_SECONDS (/ 1.0 300)) ;; #x3b5a740e - 0.0033333333...
|
|
(defmacro vel-to-tick (vel)
|
|
"turn a velocity value into a per-tick value"
|
|
`(* ,TICKS_TO_SECONDS ,vel)
|
|
)
|
|
|
|
(deftype dynamics (basic)
|
|
((name basic :offset-assert 4)
|
|
(gravity-max float :offset-assert 8) ;; meters
|
|
(gravity-length float :offset-assert 12) ;; meters
|
|
(gravity vector :inline :offset-assert 16)
|
|
(gravity-normal vector :inline :offset-assert 32)
|
|
(walk-distance float :offset-assert 48) ;; meters
|
|
(run-distance float :offset-assert 52) ;; meters
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x38
|
|
:flag-assert #x900000038
|
|
)
|
|
|
|
(defun time-to-apex ((arg0 float) (arg1 float))
|
|
(the int (/ arg0 (- (vel-to-tick arg1))))
|
|
)
|
|
|
|
(defun time-to-ground ((velocity float) (gravity float) (height float))
|
|
"How long to fall from height?"
|
|
(let ((height-checked 0.0)
|
|
(ticks 0))
|
|
;; loop in ticks until we reach the ground
|
|
(while (< (- height) height-checked)
|
|
(let ((velocity (- velocity (vel-to-tick gravity))))
|
|
(+! height-checked (vel-to-tick velocity))
|
|
)
|
|
(+! ticks 1)
|
|
)
|
|
ticks
|
|
)
|
|
)
|
|
|
|
(define *standard-dynamics*
|
|
(new 'static 'dynamics
|
|
:name 'standard
|
|
:gravity-max GRAVITY_MAX
|
|
:gravity-length GRAVITY_AMOUNT
|
|
:gravity (new 'static 'vector :x 0.0 :y GRAVITY_AMOUNT :z 0.0 :w 1.0)
|
|
:gravity-normal (new 'static 'vector :x 0.0 :y 1.0 :z 0.0 :w 1.0)
|
|
:walk-distance (meters 2)
|
|
:run-distance (meters 5)
|
|
)
|
|
)
|