2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: ripple.gc
|
|
|
|
;; name in dgo: ripple
|
|
|
|
;; dgos: GAME, ENGINE
|
|
|
|
|
2021-06-26 22:52:52 -04:00
|
|
|
(define-extern ripple-execute-init (function none))
|
|
|
|
(define-extern ripple-create-wave-table (function ripple-wave-set int))
|
|
|
|
(define-extern ripple-apply-wave-table (function merc-effect symbol))
|
|
|
|
|
|
|
|
(deftype ripple-request (structure)
|
|
|
|
((waveform ripple-wave :offset-assert 0)
|
|
|
|
(effect merc-effect :offset-assert 4)
|
|
|
|
)
|
|
|
|
:pack-me
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x8
|
|
|
|
:flag-assert #x900000008
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype ripple-globals (structure)
|
|
|
|
((count int32 :offset-assert 0)
|
|
|
|
(requests ripple-request 16 :inline :offset-assert 4)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x84
|
|
|
|
:flag-assert #x900000084
|
|
|
|
)
|
|
|
|
|
|
|
|
(define *ripple-globals* (new 'global 'ripple-globals))
|
|
|
|
|
|
|
|
(defun ripple-make-request ((arg0 ripple-wave) (arg1 merc-effect))
|
|
|
|
(let ((v1-1 (-> *ripple-globals* count))
|
|
|
|
(a2-1 (-> *ripple-globals* requests))
|
|
|
|
(a3-0 0)
|
|
|
|
)
|
|
|
|
(when (< v1-1 16)
|
|
|
|
(dotimes (t0-1 v1-1)
|
|
|
|
(if (= arg1 (-> a2-1 t0-1 effect))
|
|
|
|
(set! a3-0 1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(when (zero? a3-0)
|
|
|
|
(set! (-> a2-1 v1-1 effect) arg1)
|
|
|
|
(set! (-> a2-1 v1-1 waveform) arg0)
|
|
|
|
(set! (-> *ripple-globals* count) (+ (-> *ripple-globals* count) 1))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
|
2021-08-22 20:12:47 -04:00
|
|
|
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (the int (-> arg0 frame-save))))))
|
2021-06-26 22:52:52 -04:00
|
|
|
(when (!= f0-1 0.0)
|
|
|
|
(dotimes (v1-4 (-> arg0 count))
|
|
|
|
(let ((a1-4 (-> arg0 wave v1-4)))
|
|
|
|
(set! (-> a1-4 offs) (+ (-> a1-4 offs) (* f0-1 (-> a1-4 delta))))
|
|
|
|
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
|
|
|
|
)
|
|
|
|
)
|
2021-08-22 20:12:47 -04:00
|
|
|
(set! (-> arg0 frame-save) (the uint (-> *display* integral-frame-counter)))
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; definition for function ripple-execute-init
|
|
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
|
|
|
|
;; definition for function ripple-create-wave-table
|
|
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
|
|
|
|
;; definition for function ripple-apply-wave-table
|
|
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
|
|
|
|
(defun ripple-execute ()
|
|
|
|
(when (-> *ripple-globals* count)
|
|
|
|
(ripple-execute-init)
|
|
|
|
(let ((gp-0 0)
|
|
|
|
(s5-0 (-> *ripple-globals* count))
|
|
|
|
(s4-0 (-> *ripple-globals* requests))
|
|
|
|
)
|
|
|
|
(while (!= gp-0 s5-0)
|
|
|
|
(when (-> s4-0 gp-0 waveform)
|
|
|
|
(let ((s3-0 gp-0)
|
|
|
|
(s2-0 (-> s4-0 gp-0 waveform))
|
|
|
|
)
|
|
|
|
(ripple-create-wave-table (the-as ripple-wave-set s2-0))
|
|
|
|
(while (!= s3-0 s5-0)
|
|
|
|
(when (= s2-0 (-> s4-0 s3-0 waveform))
|
|
|
|
(ripple-apply-wave-table (-> s4-0 s3-0 effect))
|
|
|
|
(set! (-> s4-0 s3-0 waveform) #f)
|
|
|
|
)
|
|
|
|
(+! s3-0 1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(+! gp-0 1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> *ripple-globals* count) 0)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; definition for function ripple-matrix-scale
|
|
|
|
;; ERROR: function was not converted to expressions. Cannot decompile.
|
|
|
|
|
|
|
|
(defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float))
|
2021-06-27 12:11:30 -04:00
|
|
|
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
|
|
|
|
(s5-0 (new-stack-vector0))
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
2021-06-27 12:11:30 -04:00
|
|
|
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
|
|
|
|
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
2021-06-27 12:11:30 -04:00
|
|
|
(set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
|
|
|
|
(set! (-> s5-0 y) 0.0)
|
|
|
|
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
2021-06-27 12:11:30 -04:00
|
|
|
(set! (-> s5-0 w) 0.0)
|
|
|
|
(vector+! s5-0 s5-0 (-> arg0 root trans))
|
|
|
|
(add-debug-sphere
|
|
|
|
#t
|
|
|
|
(bucket-id debug-draw0)
|
|
|
|
s5-0
|
|
|
|
2048.0
|
|
|
|
(new 'static 'rgba :r #xff :g #xff :a #x80)
|
|
|
|
)
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
2021-06-27 12:11:30 -04:00
|
|
|
(none)
|
2021-06-26 22:52:52 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
(defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float))
|
|
|
|
(let ((f30-0 0.0))
|
|
|
|
(dotimes (s3-0 (-> arg0 count))
|
|
|
|
(let* ((v1-3 (-> arg0 wave s3-0))
|
|
|
|
(f0-2 (+ (+ (-> v1-3 offs) (* arg1 (-> v1-3 xmul)))
|
|
|
|
(* arg2 (-> v1-3 zmul))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(+! f30-0 (* (-> v1-3 scale) (cos f0-2)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(fmax -127.0 (fmin 127.0 f30-0))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; definition for function ripple-find-height
|
2021-08-07 16:15:41 -04:00
|
|
|
(defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector))
|
2021-06-26 22:52:52 -04:00
|
|
|
(local-vars (sv-16 float) (sv-32 float))
|
|
|
|
(let* ((f30-0 (-> arg0 root trans y))
|
|
|
|
(v1-1 (-> arg0 draw))
|
|
|
|
(a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect))
|
|
|
|
)
|
|
|
|
(if (or (zero? (logand (-> a1-5 0 effect-bits) 4)) (not (-> v1-1 ripple)))
|
|
|
|
(return f30-0)
|
|
|
|
)
|
|
|
|
(let* ((a1-6 (-> a1-5 0 extra-info))
|
|
|
|
(s4-0
|
|
|
|
(the-as
|
|
|
|
mei-ripple
|
|
|
|
(+ (the-as uint a1-6) (the-as uint (* (-> a1-6 ripple-offset) 16)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(gp-0 (-> v1-1 ripple))
|
|
|
|
(s5-0 (-> gp-0 waveform))
|
|
|
|
)
|
|
|
|
(if (not (-> gp-0 waveform))
|
|
|
|
(return f30-0)
|
|
|
|
)
|
|
|
|
(if (not (-> s5-0 converted))
|
|
|
|
(return f30-0)
|
|
|
|
)
|
|
|
|
(let* ((f28-0 (- (-> arg2 x) (-> arg0 root trans x)))
|
|
|
|
(f26-0 (- (-> arg2 z) (-> arg0 root trans z)))
|
|
|
|
(f22-0 (+ (quaternion-y-angle (-> arg0 root quat)) (-> s4-0 angle)))
|
|
|
|
(f24-0 (cos f22-0))
|
|
|
|
(f1-3 (sin f22-0))
|
|
|
|
(f0-4 (- (* f28-0 f24-0) (* f26-0 f1-3)))
|
|
|
|
(f1-5 (+ (* f26-0 f24-0) (* f28-0 f1-3)))
|
|
|
|
(f2-3 (/ 1.0 (-> s4-0 grid-size)))
|
|
|
|
(f28-1 (* f2-3 (- f0-4 (-> s4-0 x-base))))
|
|
|
|
(f26-1 (* f2-3 (- f1-5 (-> s4-0 z-base))))
|
|
|
|
)
|
|
|
|
(ripple-update-waveform-offs s5-0)
|
|
|
|
(let* ((f22-1 (the float (the int f28-1)))
|
|
|
|
(f24-1 (the float (the int f26-1)))
|
|
|
|
(f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1))
|
|
|
|
)
|
|
|
|
(set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1))
|
|
|
|
(set! sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1)))
|
|
|
|
(let*
|
|
|
|
((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1)))
|
|
|
|
(f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0))))
|
|
|
|
(f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32))))
|
|
|
|
(f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22))))
|
|
|
|
(f0-23 (-> gp-0 faded-scale))
|
|
|
|
)
|
|
|
|
(if (< f0-23 0.0)
|
|
|
|
(set! f0-23 (-> gp-0 global-scale))
|
|
|
|
)
|
|
|
|
(+ f30-0 (* (* 0.0078125 f1-12) f0-23))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|