mirror of
https://github.com/open-goal/jak-project
synced 2026-05-25 07:23:19 -04:00
125 lines
3.0 KiB
Common Lisp
125 lines
3.0 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: entity.gc
|
|
;; name in dgo: entity
|
|
;; dgos: GAME, ENGINE
|
|
|
|
;; needs cleanup, but this does work!
|
|
(defun entity-by-name ((arg0 string))
|
|
(dotimes (s5-0 (-> *level* length))
|
|
(let ((s4-0 (the-as basic (-> *level* level s5-0))))
|
|
(when (= (-> (the-as level s4-0) status) 'active)
|
|
(let ((s3-0 (-> (the-as level s4-0) bsp actors)))
|
|
(when (nonzero? s3-0)
|
|
(dotimes (s2-0 (-> s3-0 length))
|
|
(let ((s1-0 (-> s3-0 data s2-0 actor)))
|
|
(if
|
|
(name=
|
|
(the-as
|
|
basic
|
|
((method-of-type res-lump get-property-struct)
|
|
(the-as res-lump s1-0)
|
|
'name
|
|
'interp
|
|
-1000000000.0
|
|
#f
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
arg0
|
|
)
|
|
(return (the entity s1-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((s3-1 (-> (the-as level s4-0) bsp ambients)))
|
|
(when (nonzero? s3-1)
|
|
(dotimes (s2-1 (-> s3-1 length))
|
|
(let ((s1-1 (-> s3-1 data s2-1 ambient)))
|
|
(if
|
|
(name=
|
|
(the-as
|
|
basic
|
|
((method-of-type res-lump get-property-struct)
|
|
(the-as res-lump s1-1)
|
|
'name
|
|
'interp
|
|
-1000000000.0
|
|
#f
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
arg0
|
|
)
|
|
(return (the entity s1-1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! s4-0 (-> (the-as level s4-0) bsp cameras))
|
|
(when (nonzero? (the-as (array entity-camera) s4-0))
|
|
(dotimes (s3-2 (-> (the-as (array entity-camera) s4-0) length))
|
|
(let ((s2-2 (-> (the-as (array entity-camera) s4-0) s3-2)))
|
|
(if
|
|
(name=
|
|
(the-as
|
|
basic
|
|
((method-of-type res-lump get-property-struct)
|
|
s2-2
|
|
'name
|
|
'interp
|
|
-1000000000.0
|
|
#f
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
arg0
|
|
)
|
|
(return (the entity s2-2))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(the-as entity #f)
|
|
)
|
|
|
|
(defun entity-by-type ((arg0 type))
|
|
(dotimes (s5-0 (-> *level* length))
|
|
(let ((v1-3 (-> *level* level s5-0)))
|
|
(when (= (-> v1-3 status) 'active)
|
|
(let ((s4-0 (-> v1-3 bsp actors)))
|
|
(when (nonzero? s4-0)
|
|
(dotimes (s3-0 (-> s4-0 length))
|
|
(let ((s2-0 (-> s4-0 data s3-0 actor)))
|
|
(if
|
|
(and
|
|
(type-type? (-> s2-0 type) entity-actor)
|
|
(= (-> s2-0 etype) arg0)
|
|
)
|
|
(return s2-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(the-as entity-actor #f)
|
|
)
|
|
|
|
;; TODO - for misty-teetertotter | rigid-body
|
|
(define-extern process-drawable-from-entity! (function process-drawable object none))
|
|
;; TODO - for misty-warehouse
|
|
(define-extern process-entity-status! (function process entity-perm-status symbol int))
|