mirror of
https://github.com/open-goal/jak-project
synced 2026-06-25 10:12:14 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
247 lines
8.0 KiB
Common Lisp
Vendored
Generated
247 lines
8.0 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 25 of type pov-camera
|
|
(defmethod check-for-abort ((this pov-camera))
|
|
(when (or (and (time-elapsed? (-> this debounce-start-time) (seconds 0.2)) (cpad-pressed? 0 triangle))
|
|
(logtest? (-> this flags) (pov-camera-flag allow-abort))
|
|
)
|
|
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
|
|
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
|
|
(when (logtest? (-> this flags) (pov-camera-flag notify-of-abort))
|
|
(send-event (handle->process (-> this notify-handle)) 'notify 'abort-request)
|
|
#t
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 26 of type pov-camera
|
|
(defmethod target-grabbed? ((this pov-camera))
|
|
(or (not *target*) (process-grab? *target*))
|
|
)
|
|
|
|
;; definition for method 28 of type pov-camera
|
|
(defmethod target-released? ((this pov-camera))
|
|
(or (not *target*) (process-release? *target*))
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate pov-camera-startup (pov-camera)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(go-virtual pov-camera-start-playing)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate pov-camera-start-playing (pov-camera)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(logclear! (-> self mask) (process-mask actor-pause))
|
|
(while (not (target-grabbed? self))
|
|
(suspend)
|
|
)
|
|
(let ((gp-0 0))
|
|
(let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f))))
|
|
(if v1-7
|
|
(set! gp-0 (+ (-> v1-7 number) 1))
|
|
)
|
|
)
|
|
(let ((v1-10 (process-spawn othercam self gp-0 #t #t :to self)))
|
|
(send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear))
|
|
)
|
|
)
|
|
(go-virtual pov-camera-playing)
|
|
)
|
|
)
|
|
|
|
;; definition for function pov-camera-play-and-reposition
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float))
|
|
(let ((s4-0 #f))
|
|
(ja-no-eval :group! arg0 :num! (seek! max arg2) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(let ((v1-4 (and (not s4-0) (< (the float (+ (-> (ja-group) data 0 length) -4)) (ja-frame-num 0)))))
|
|
(when v1-4
|
|
(set! s4-0 #t)
|
|
(send-event *camera* 'teleport-to-vector-start-string arg1)
|
|
)
|
|
)
|
|
(suspend)
|
|
(ja :num! (seek! max arg2))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate pov-camera-playing (pov-camera)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('abort)
|
|
(when (logtest? (-> self flags) (pov-camera-flag notify-of-abort))
|
|
(logior! (-> self flags) (pov-camera-flag allow-abort))
|
|
(if (= (-> self anim-name type) string)
|
|
(go-virtual pov-camera-abort)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-time! (-> self debounce-start-time))
|
|
(if (= (-> self anim-name type) string)
|
|
(backup-load-state-and-set-cmds *load-state* (-> self command-list))
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(if (= (-> self anim-name type) string)
|
|
(restore-load-state-and-cleanup *load-state*)
|
|
)
|
|
(remove-setting! 'music-volume)
|
|
(remove-setting! 'sfx-volume)
|
|
)
|
|
:code (behavior ()
|
|
(add-setting! 'music-volume 'rel (-> self music-volume-movie) 0)
|
|
(add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0)
|
|
(cond
|
|
((= (-> self anim-name type) string)
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(check-for-abort self)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
((= (-> self anim-name type) spool-anim)
|
|
(ja-play-spooled-anim
|
|
(the-as spool-anim (-> self anim-name))
|
|
(the-as art-joint-anim #f)
|
|
(the-as art-joint-anim #f)
|
|
(method-of-object self check-for-abort)
|
|
)
|
|
)
|
|
)
|
|
(go-virtual pov-camera-done-playing)
|
|
)
|
|
:post (behavior ()
|
|
(if (= (-> self anim-name type) string)
|
|
(execute-commands-up-to *load-state* (ja-aframe-num 0))
|
|
)
|
|
(ja-post)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate pov-camera-abort (pov-camera)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(logior! (-> self flags) (pov-camera-flag allow-abort))
|
|
)
|
|
:code (behavior ()
|
|
(set-blackout-frames (seconds 0.035))
|
|
(suspend)
|
|
(suspend)
|
|
(go-virtual pov-camera-done-playing)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate pov-camera-done-playing (pov-camera)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(while (not (target-released? self))
|
|
(suspend)
|
|
)
|
|
(send-event (handle->process (-> self notify-handle)) 'notify 'die)
|
|
(suspend)
|
|
(suspend)
|
|
(cleanup-for-death self)
|
|
(deactivate self)
|
|
)
|
|
)
|
|
|
|
;; definition for method 27 of type pov-camera
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod pre-startup-callback ((this pov-camera))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 29 of type pov-camera
|
|
;; INFO: Return type mismatch symbol vs none.
|
|
(defmethod set-stack-size! ((this pov-camera))
|
|
(none)
|
|
)
|
|
|
|
;; definition for function pov-camera-init-by-other
|
|
;; INFO: Used lq/sq
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defbehavior pov-camera-init-by-other pov-camera ((arg0 vector) (arg1 skeleton-group) (arg2 string) (arg3 pov-camera-flag) (arg4 process-drawable) (arg5 pair))
|
|
(set-stack-size! self)
|
|
(set! (-> *game-info* pov-camera-handle) (process->handle self))
|
|
(set! (-> self flags) arg3)
|
|
(set! (-> self command-list) arg5)
|
|
(set! (-> self music-volume-movie) 100.0)
|
|
(set! (-> self sfx-volume-movie) 100.0)
|
|
(if arg4
|
|
(set! (-> self notify-handle) (process->handle arg4))
|
|
(set! (-> self notify-handle) (the-as handle #f))
|
|
)
|
|
(set-time! (-> self debounce-start-time))
|
|
(logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile))
|
|
(set! (-> self root) (new 'process 'trsqv))
|
|
(set! (-> self root trans quad) (-> arg0 quad))
|
|
(when (logtest? (-> self flags) (pov-camera-flag inherit-orientation))
|
|
(let ((v1-20 (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable))
|
|
arg4
|
|
)
|
|
)
|
|
)
|
|
(quaternion-copy! (-> self root quat) (-> v1-20 root quat))
|
|
)
|
|
)
|
|
(initialize-skeleton self arg1 '())
|
|
(logior! (-> self draw status) (draw-status skip-bones))
|
|
(logior! (-> self skel status) (janim-status inited))
|
|
(set! (-> self anim-name) arg2)
|
|
(cond
|
|
((= (-> arg2 type) string)
|
|
(logior! (-> self skel status) (janim-status spool))
|
|
(let ((s5-1 (lookup-art (-> self draw art-group) arg2 art-joint-anim)))
|
|
(if (not s5-1)
|
|
(go process-drawable-art-error arg2)
|
|
)
|
|
(ja-channel-set! 1)
|
|
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1))
|
|
)
|
|
)
|
|
((= (-> arg2 type) spool-anim)
|
|
)
|
|
)
|
|
(set! (-> self mask-to-clear) (process-mask movie enemy platform projectile))
|
|
(set! (-> self event-hook) (lambda :behavior pov-camera
|
|
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('mask)
|
|
(let ((v0-0 (the-as number (-> arg3 param 0))))
|
|
(set! (-> self mask-to-clear) (the-as process-mask v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
(('music-movie-volume)
|
|
(set! (-> self music-volume-movie) (the-as float (-> arg3 param 0)))
|
|
)
|
|
(('sfx-movie-volume)
|
|
(set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(pre-startup-callback self)
|
|
(go-virtual pov-camera-startup)
|
|
(none)
|
|
)
|