Files
jak-project/goal_src/jak2/engine/process-drawable/simple-focus.gc
T
ManDude ff924f6b00 improve decomp of state handlers and art groups (#3014)
- state handlers that are not inlined lambdas have smarter type
checking, getting rid of 99.9% of the casts emitted (they were not
useful)
- art groups were not being properly linked to their "master" groups.
- `max` in `ja` in Jak 2 was not being detected.

Another huge PR...
2023-09-23 09:53:50 -04:00

64 lines
1.6 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: simple-focus.gc
;; name in dgo: simple-focus
;; dgos: GAME, COMMON
;; DECOMP BEGINS
(deftype simple-focus (process-focusable)
((first-time? symbol :offset-assert 204)
)
:heap-base #x50
:method-count-assert 28
:size-assert #xd0
:flag-assert #x1c005000d0
(:methods
(idle () _type_ :state 27)
)
)
(defmethod get-trans simple-focus ((obj simple-focus) (arg0 int))
"@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])"
(-> obj root trans)
)
(defmethod run-logic? simple-focus ((obj simple-focus))
(when (-> obj first-time?)
(set! (-> obj first-time?) #f)
#t
)
)
(defstate idle (simple-focus)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('move-trans)
(let ((v0-0 (-> self root trans)))
(set! (-> v0-0 quad) (-> (the-as vector (-> block param 0)) quad))
v0-0
)
)
)
)
:code sleep-code
)
;; WARN: Return type mismatch object vs none.
(defbehavior simple-focus-init-by-other simple-focus ()
"Initializes the new [[simple-focus]]. `first-time?` will be set to [[#t]]"
(let ((root (new 'process 'trsqv)))
(set! (-> self root) (the-as collide-shape root))
(vector-identity! (-> root scale))
(quaternion-identity! (-> root quat))
)
(logclear! (-> self mask) (process-mask enemy))
(set! (-> self first-time?) #t)
(set! (-> self event-hook) (-> (method-of-object self idle) event))
(go-virtual idle)
(none)
)