jak-project/goal_src/jak3/engine/geometry/vol-h.gc
Hat Kid 2969833b2d
decomp3: more engine stuff, detect non-virtual state inheritance (#3377)
- `speech`
- `ambient`
- `water-h`
- `vol-h`
- `generic-obs`
- `carry-h`
- `pilot-h`
- `board-h`
- `gun-h`
- `flut-h`
- `indax-h`
- `lightjak-h`
- `darkjak-h`
- `target-util`
- `history`
- `collide-reaction-target`
- `logic-target`
- `sidekick`
- `projectile`
- `voicebox`
- `ragdoll-edit`
- most of `ragdoll` (not added to gsrc yet)
- `curves`
- `find-nearest`
- `lightjak-wings`
- `target-handler`
- `target-anim`
- `target`
- `target2`
- `target-swim`
- `target-lightjak`
- `target-invisible`
- `target-death`
- `target-gun`
- `gun-util`
- `board-util`
- `target-board`
- `board-states`
- `mech-h`
- `vol`
- `vent`
- `viewer`
- `gem-pool`
- `collectables`
- `crates`
- `secrets-menu`

Additionally:

- Detection of non-virtual state inheritance
- Added a config file that allows overriding the process stack size set
by `stack-size-set!` calls
- Fix for integer multiplication with `r0`
- Fixed detection for the following macros:
	- `static-attack-info`
- `defpart` and `defpartgroup` (probably still needs adjustments, uses
Jak 2 implementation at the moment)
- `sound-play` (Jak 3 seems to always call `sound-play-by-name` with a
`sound-group` of 0, so the macro has been temporarily defaulted to use
that)

One somewhat significant change made here that should be noted is that
the return type of `process::init-from-entity!` was changed to `object`.
I've been thinking about this for a while, since it looks a bit nicer
without the `(none)` at the end and I have recently encountered init
methods that early return `0`.
2024-03-03 15:15:27 -05:00

118 lines
3.6 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: vol-h.gc
;; name in dgo: vol-h
;; dgos: GAME
;; +++vol-flags
(defenum vol-flags
:bitfield #t
:type uint32
(display?)
(vol-flags-1)
)
;; ---vol-flags
;; DECOMP BEGINS
(deftype plane-volume (structure)
((volume-type symbol)
(point-count int16)
(normal-count int16)
(first-point (pointer vector))
(first-normal (pointer vector))
(num-planes int32)
(plane (inline-array plane))
)
:pack-me
(:methods
(plane-volume-method-9 (_type_ symbol vector-array vector-array) plane-volume)
(debug-draw (_type_) none)
(point-in-vol? (_type_ vector float) symbol)
)
)
(deftype vol-control (basic)
((flags vol-flags)
(process process-drawable)
(pos-vol-count int32)
(pos-vol plane-volume 32 :inline)
(neg-vol-count int32)
(neg-vol plane-volume 32 :inline)
(debug-point vector-array)
(debug-normal vector-array)
)
(:methods
(new (symbol type process-drawable) _type_)
(debug-draw (_type_) none)
(vol-control-method-10 (_type_ plane) symbol)
(should-display? (_type_) symbol)
)
)
;; WARN: Return type mismatch object vs vol-control.
(defmethod new vol-control ((allocation symbol) (type-to-make type) (arg0 process-drawable))
(let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as vol-control gp-0))
(go process-drawable-art-error "memory")
(set! gp-0 0)
(goto cfg-13)
)
(set! (-> (the-as vol-control gp-0) process) arg0)
(let* ((s5-1 (-> (the-as vol-control gp-0) process entity))
(s4-0 (-> ((method-of-type res-lump lookup-tag-idx) s5-1 'vol 'base -1000000000.0) lo))
)
(when (>= (the-as int s4-0) 0)
(let ((s3-0 (the-as int s4-0))
(s2-0 (-> s5-1 tag s4-0))
)
0
(while (= (-> s2-0 name) (-> s5-1 tag s4-0 name))
(let ((v1-12 (make-property-data s5-1 0.0 (the-as res-tag-pair s3-0) (the-as pointer #f)))
(a0-8 (-> (the-as vol-control gp-0) pos-vol (-> (the-as vol-control gp-0) pos-vol-count)))
)
(set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count)))
(set! (-> a0-8 plane) (the-as (inline-array plane) v1-12))
)
(+! (-> (the-as vol-control gp-0) pos-vol-count) 1)
(+! s3-0 1)
(set! s2-0 (-> s5-1 tag s3-0))
)
)
)
)
(let* ((s5-2 (-> (the-as vol-control gp-0) process entity))
(s4-1 (-> ((method-of-type res-lump lookup-tag-idx) s5-2 'cutoutvol 'base -1000000000.0) lo))
)
(when (>= (the-as int s4-1) 0)
(let ((s3-1 (the-as int s4-1))
(s2-1 (-> s5-2 tag s4-1))
)
0
(while (= (-> s2-1 name) (-> s5-2 tag s4-1 name))
(let ((v1-31 (make-property-data s5-2 0.0 (the-as res-tag-pair s3-1) (the-as pointer #f)))
(a0-19 (-> (the-as vol-control gp-0) neg-vol (-> (the-as vol-control gp-0) neg-vol-count)))
)
(set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count)))
(set! (-> a0-19 plane) (the-as (inline-array plane) v1-31))
)
(+! (-> (the-as vol-control gp-0) neg-vol-count) 1)
(+! s3-1 1)
(set! s2-1 (-> s5-2 tag s3-1))
)
)
)
)
(label cfg-13)
(the-as vol-control gp-0)
)
)
(defmethod should-display? ((this vol-control))
(and *display-vol-marks* (logtest? (-> this flags) (vol-flags display?)))
)