jak-project/goal_src/engine/entity/entity-h.gc
Tyler Wilding d37e6c548e
decomp: camera | cam-combiner | cam-start | cam-update (#621)
* started process on `camera`

* the bulk of `camera` is finished, with the exception of a few

* decomp: Confirmed function ret value

* decomp: `cam-combiner` dead code issue

* stash

* decomp: finish `cam-combiner`

* decomp: finish `cam-start`

* decomp: mostly finish `cam-update`, just needs polish now

* `cam-standard-event-handler` still causing issues

* `cam-combiner` issues with top-level `s6` usage

* decomp: update reference tests

* decomp: finalize `cam-start`

* decomp: `cam-update` cleaned up everything except the array of planes issue

* label correction

* still blocked in cam-combiner over casting issues

* decomp:  resolve issues in `cam-start`

* decomp: finalize `cam-update`

* stash

* decomp: finalize `cam-combiner`

* decomp: finalize `camera`

* decomp: address feedback
2021-07-30 22:18:35 -04:00

215 lines
6.3 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: entity-h.gc
;; name in dgo: entity-h
;; dgos: GAME, ENGINE
(define *generate-actor-vis* #f)
(define *generate-actor-vis-start* #f)
(define *generate-actor-vis-output* #f)
(defenum entity-perm-status
:bitfield #t
:type uint16
(bit-0 0)
(bit-1 1)
(dead 2)
(bit-3 3)
(bit-4 4)
(user-set-from-cstage 5)
(complete 6)
(bit-7 7)
(real-complete 8)
(bit-9 9)
)
;; definition of type entity-perm
(deftype entity-perm (structure)
((user-object object 2 :offset-assert 0)
(user-uint64 uint64 :offset 0)
(user-float float 2 :offset 0)
(user-int32 int32 2 :offset 0)
(user-uint32 uint32 2 :offset 0)
(user-int16 int16 4 :offset 0)
(user-uint16 uint16 4 :offset 0)
(user-int8 int8 8 :offset 0)
(user-uint8 uint8 8 :offset 0)
(status entity-perm-status :offset-assert 8)
(dummy uint8 1 :offset-assert 10)
(task game-task :offset-assert 11)
(aid actor-id :offset-assert 12)
(quad uint128 :offset 0)
)
:pack-me
:method-count-assert 10
:size-assert #x10
:flag-assert #xa00000010
(:methods
(update-perm! (_type_ symbol entity-perm-status) _type_ 9)
)
)
(deftype entity-links (structure)
((prev-link entity-links :offset-assert 0)
(next-link entity-links :offset-assert 4)
(entity entity :offset-assert 8)
(process process :offset-assert 12)
(level level :offset-assert 16)
(vis-id int32 :offset-assert 20)
(trans vector :inline :offset-assert 32)
(perm entity-perm :inline :offset-assert 48)
(status uint16 :offset 56)
(aid actor-id :offset 60)
(task game-task :offset 59)
)
:method-count-assert 10
:size-assert #x40
:flag-assert #xa00000040
(:methods
(dummy-9 () none 9)
)
)
(deftype entity-perm-array (inline-array-class)
((data entity-perm :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(set! (-> entity-perm-array heap-base) (the-as uint 16))
(deftype entity-links-array (inline-array-class)
((data entity-links :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(set! (-> entity-links-array heap-base) (the-as uint 64))
(deftype entity (res-lump)
((trans vector :inline :offset-assert 32)
(aid uint32 :offset-assert 48)
)
:method-count-assert 27
:size-assert #x34
:flag-assert #x1b00000034
(:methods
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
)
)
(deftype entity-camera (entity)
((connect connectable :inline :offset-assert 64)
)
:method-count-assert 27
:size-assert #x50
:flag-assert #x1b00000050
)
(deftype entity-ambient-data (structure)
((user-object object 3 :offset-assert 0)
(function basic :offset-assert 12)
(quad uint128 :offset 0)
(user-uint64 uint64 1 :offset 0)
(user-float float 3 :offset 0)
(user-int32 int32 3 :offset 0)
(user-uint32 uint32 3 :offset 0)
(user-int16 int16 6 :offset 0)
(user-uint16 uint16 6 :offset 0)
(user-int8 int8 12 :offset 0)
(user-uint8 uint8 12 :offset 0)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype entity-ambient-data-array (inline-array-class)
()
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(set! (-> entity-ambient-data-array heap-base) (the-as uint 16))
(deftype entity-ambient (entity)
()
:method-count-assert 29
:size-assert #x34
:flag-assert #x1d00000034
(:methods
(dummy-27 () none 27)
(dummy-28 () none 28)
)
)
(deftype entity-actor (entity)
((nav-mesh nav-mesh :offset-assert 52)
(etype type :offset-assert 56)
(task uint8 :offset-assert 60)
(vis-id uint16 :offset-assert 62)
(quat quaternion :inline :offset-assert 64)
)
:method-count-assert 31
:size-assert #x50
:flag-assert #x1f00000050
(:methods
(next-actor (_type_) entity-actor 27)
(prev-actor (_type_) entity-actor 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
)
)
(deftype entity-info (basic)
((ptype type :offset-assert 4)
(package basic :offset-assert 8)
(art-group pair :offset-assert 12)
(pool basic :offset-assert 16)
(heap-size int32 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x18
:flag-assert #x900000018
)
;; NOTE - this is a strange pattern...this symbol isn't defined until a later file 'navigate'
;; But this seems to be setting the symbol to nothing if it's not found, but of course, our compiler freaks out
(define-extern entity-nav-login (function entity-actor none))
(if (zero? entity-nav-login)
(set! entity-nav-login (the-as (function entity-actor none) nothing))
)
(deftype actor-bank (basic)
((pause-dist float :offset-assert 4)
(birth-dist float :offset-assert 8)
(birth-max int32 :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(define *ACTOR-bank*
(new 'static 'actor-bank
:pause-dist (meters 50) ;; actor activity range?
:birth-dist (meters 220) ;; draw distance or something?
:birth-max 10 ;; maximum actor births per frame? (it is known they dont all happen at once)
)
)
(defun-extern entity-by-name string entity)
(defun-extern entity-by-type type entity-actor)
(defun-extern entity-by-aid uint entity)
(define-extern reset-actors (function symbol none))
(define-extern *spawn-actors* symbol)
;; TODO - for cam-start
(define-extern reset-cameras (function none))