Files
jak-project/goal_src/levels/common/ticky.gc
T
Tyler Wilding 3cfd50b618 decomp: finish ticky (#744)
Co-authored-by: water <awaterford111445@gmail.com>
2021-08-09 21:55:05 -04:00

91 lines
2.2 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: ticky.gc
;; name in dgo: ticky
;; dgos: GAME, COMMON, L1
;; definition of type ticky
(deftype ticky (structure)
((delay-til-ramp uint64 :offset-assert 0)
(delay-til-timeout uint64 :offset-assert 8)
(starting-time uint64 :offset-assert 16)
(last-tick-time uint64 :offset-assert 24)
)
:method-count-assert 12
:size-assert #x20
:flag-assert #xc00000020
(:methods
(sleep (_type_ uint) none 9)
(reached-delay? (_type_ uint) symbol 10)
(completed? (_type_) symbol 11)
)
)
;; definition for method 9 of type ticky
;; INFO: Return type mismatch int vs none.
(defmethod sleep ticky ((obj ticky) (arg0 uint))
(set! (-> obj starting-time) (-> *display* base-frame-counter))
(set! (-> obj delay-til-timeout) arg0)
(set! (-> obj delay-til-ramp) (max 0 (the-as int (+ arg0 -1200))))
(set! (-> obj last-tick-time) (the-as uint 0))
0
(none)
)
;; definition for method 11 of type ticky
(defmethod completed? ticky ((obj ticky))
(let ((gp-0 #f))
(let ((v1-2 (- (-> *display* base-frame-counter) (-> obj starting-time))))
(cond
((>= (the-as int v1-2) (the-as int (-> obj delay-til-timeout)))
(set! gp-0 #t)
)
(else
(let*
((f0-1
(fmin
1.0
(/
(the float (max 0 (the-as int (- v1-2 (-> obj delay-til-ramp)))))
(the float (- (-> obj delay-til-timeout) (-> obj delay-til-ramp)))
)
)
)
(v1-7 (the int (lerp 105.0 41.0 f0-1)))
)
(when
(>=
(the-as
int
(- (-> *display* base-frame-counter) (-> obj last-tick-time))
)
v1-7
)
(set! (-> obj last-tick-time) (-> *display* base-frame-counter))
(sound-play-by-name
(static-sound-name "stopwatch")
(new-sound-id)
1024
0
0
(the-as uint 1)
(the-as vector #t)
)
)
)
)
)
)
gp-0
)
)
;; definition for method 10 of type ticky
(defmethod reached-delay? ticky ((obj ticky) (arg0 uint))
(>=
(the-as int (- (-> *display* base-frame-counter) (-> obj starting-time)))
(the-as int arg0)
)
)