2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
2024-05-12 12:37:59 -04:00
|
|
|
(bundles "ENGINE.CGO" "GAME.CGO")
|
|
|
|
(require "engine/entity/res.gc")
|
|
|
|
(require "kernel/gstate.gc")
|
|
|
|
(require "engine/draw/drawable-h.gc")
|
|
|
|
(require "engine/game/main-h.gc")
|
|
|
|
(require "engine/entity/entity-h.gc")
|
|
|
|
(require "engine/game/game-h.gc")
|
2020-09-04 14:44:23 -04:00
|
|
|
|
2021-11-24 00:33:10 -05:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
2021-06-12 21:52:55 -04:00
|
|
|
(deftype plane-volume (structure)
|
2024-06-05 22:17:31 -04:00
|
|
|
((volume-type symbol)
|
|
|
|
(point-count int16)
|
|
|
|
(normal-count int16)
|
|
|
|
(first-point (pointer vector))
|
|
|
|
(first-normal (pointer vector))
|
|
|
|
(num-planes int32)
|
|
|
|
(plane (inline-array plane)))
|
2021-06-12 21:52:55 -04:00
|
|
|
:pack-me
|
|
|
|
(:methods
|
2024-06-05 22:17:31 -04:00
|
|
|
(init-vol! (_type_ symbol vector-array vector-array) symbol)
|
|
|
|
(debug-draw (_type_) none)
|
|
|
|
(point-in-vol? (_type_ vector float) symbol)))
|
2021-11-24 00:33:10 -05:00
|
|
|
|
2021-06-12 21:52:55 -04:00
|
|
|
(deftype vol-control (basic)
|
2024-06-05 22:17:31 -04:00
|
|
|
((flags uint32)
|
|
|
|
(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))
|
2021-06-12 21:52:55 -04:00
|
|
|
(:methods
|
2024-06-05 22:17:31 -04:00
|
|
|
(new (symbol type process-drawable) _type_)
|
|
|
|
(init! (_type_) symbol)
|
|
|
|
(point-in-vol? (_type_ vector) symbol)
|
|
|
|
(vol-control-method-11 (_type_) symbol)))
|
2021-11-24 00:33:10 -05:00
|
|
|
|
2021-12-18 17:15:11 -05:00
|
|
|
(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)
|
2024-06-05 22:17:31 -04:00
|
|
|
(goto cfg-13))
|
2021-12-18 17:15:11 -05:00
|
|
|
(set! (-> (the-as vol-control gp-0) process) arg0)
|
|
|
|
(let* ((s5-1 (the-as res-lump (-> (the-as vol-control gp-0) process entity)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(s4-0 (-> ((method-of-type res-lump lookup-tag-idx) (the-as entity-actor s5-1) 'vol 'exact 0.0) lo)))
|
2021-12-18 17:15:11 -05:00
|
|
|
(when (>= (the-as int s4-0) 0)
|
2022-02-12 12:26:19 -05:00
|
|
|
(let ((s3-0 (the-as int s4-0))
|
2024-06-05 22:17:31 -04:00
|
|
|
(s2-0 (-> s5-1 tag s4-0)))
|
2021-12-18 17:15:11 -05:00
|
|
|
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)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(a0-8 (-> (the-as vol-control gp-0) pos-vol (-> (the-as vol-control gp-0) pos-vol-count))))
|
2021-12-18 17:15:11 -05:00
|
|
|
(set! (-> a0-8 num-planes) (the-as int (-> s2-0 elt-count)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(set! (-> a0-8 plane) (the-as (inline-array plane) v1-12)))
|
2021-12-18 17:15:11 -05:00
|
|
|
(+! (-> (the-as vol-control gp-0) pos-vol-count) 1)
|
|
|
|
(+! s3-0 1)
|
2024-06-05 22:17:31 -04:00
|
|
|
(set! s2-0 (-> s5-1 tag s3-0))))))
|
2021-12-18 17:15:11 -05:00
|
|
|
(let* ((s5-2 (the-as res-lump (-> (the-as vol-control gp-0) process entity)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(s4-1 (-> ((method-of-type res-lump lookup-tag-idx) (the-as entity-actor s5-2) 'cutoutvol 'exact 0.0) lo)))
|
2021-12-18 17:15:11 -05:00
|
|
|
(when (>= (the-as int s4-1) 0)
|
2022-02-12 12:26:19 -05:00
|
|
|
(let ((s3-1 (the-as int s4-1))
|
2024-06-05 22:17:31 -04:00
|
|
|
(s2-1 (-> s5-2 tag s4-1)))
|
2021-12-18 17:15:11 -05:00
|
|
|
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)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(a0-19 (-> (the-as vol-control gp-0) neg-vol (-> (the-as vol-control gp-0) neg-vol-count))))
|
2021-12-18 17:15:11 -05:00
|
|
|
(set! (-> a0-19 num-planes) (the-as int (-> s2-1 elt-count)))
|
2024-06-05 22:17:31 -04:00
|
|
|
(set! (-> a0-19 plane) (the-as (inline-array plane) v1-31)))
|
2021-12-18 17:15:11 -05:00
|
|
|
(+! (-> (the-as vol-control gp-0) neg-vol-count) 1)
|
|
|
|
(+! s3-1 1)
|
2024-06-05 22:17:31 -04:00
|
|
|
(set! s2-1 (-> s5-2 tag s3-1))))))
|
2021-12-18 17:15:11 -05:00
|
|
|
(label cfg-13)
|
2024-06-05 22:17:31 -04:00
|
|
|
(the-as vol-control gp-0)))
|
2021-06-12 21:52:55 -04:00
|
|
|
|
2023-10-29 23:20:02 -04:00
|
|
|
(defmethod vol-control-method-11 ((this vol-control))
|
2024-06-05 22:17:31 -04:00
|
|
|
(and *display-vol-marks* (logtest? (-> this flags) 1)))
|