mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
f4085a4362
Cleans up every `dummy-*` and `TODO-RENAME-*` method up with either proper names or by renaming them to `[type-name]-method-[method-id]` similar to Jak 2's `all-types`. Also fixes the bad format string in `collide-cache` and adds the event handler hack to Jak 1. The game boots and runs fine, but I might have missed a PAL patch or other manual patches here and there, please double-check if possible.
396 lines
13 KiB
Common Lisp
396 lines
13 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: wedge-plats.gc
|
|
;; name in dgo: wedge-plats
|
|
;; dgos: L1, SUN, SUNKEN
|
|
|
|
(declare-type wedge-plat-outer process)
|
|
(declare-type wedge-plat-master process)
|
|
(declare-type wedge-plat process)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(import "goal_src/jak1/import/wedge-plat-outer-ag.gc")
|
|
(import "goal_src/jak1/import/wedge-plat-ag.gc")
|
|
|
|
(deftype wedge-plat-master (process)
|
|
((center vector :inline :offset-assert 112)
|
|
(rotspeed float :offset-assert 128)
|
|
(rotate-inner float :offset-assert 132)
|
|
(rotate-outer float :offset-assert 136)
|
|
)
|
|
:heap-base #x20
|
|
:method-count-assert 14
|
|
:size-assert #x8c
|
|
:flag-assert #xe0020008c
|
|
(:states
|
|
wedge-plat-master-idle
|
|
)
|
|
)
|
|
|
|
|
|
(defstate wedge-plat-master-idle (wedge-plat-master)
|
|
:code (behavior ()
|
|
(loop
|
|
(set! (-> self rotate-inner)
|
|
(the float
|
|
(sar (shl (the int (+ (-> self rotate-inner) (* (-> self rotspeed) (-> *display* seconds-per-frame)))) 48) 48)
|
|
)
|
|
)
|
|
(set! (-> self rotate-outer)
|
|
(the float
|
|
(sar (shl (the int (- (-> self rotate-outer) (* (-> self rotspeed) (-> *display* seconds-per-frame)))) 48) 48)
|
|
)
|
|
)
|
|
(suspend)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod init-from-entity! wedge-plat-master ((obj wedge-plat-master) (arg0 entity-actor))
|
|
(set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
|
|
(set! (-> obj center quad) (-> arg0 extra trans quad))
|
|
(set! (-> obj center y) (+ 819.2 (-> obj center y)))
|
|
(set! (-> obj rotspeed) (res-lump-float arg0 'rotspeed))
|
|
(set! (-> obj rotate-inner) 0.0)
|
|
(set! (-> obj rotate-outer) 0.0)
|
|
(logclear! (-> obj mask) (process-mask actor-pause))
|
|
(go wedge-plat-master-idle)
|
|
(none)
|
|
)
|
|
|
|
(deftype wedge-plat (baseplat)
|
|
((master wedge-plat-master :offset-assert 228)
|
|
(distance float :offset-assert 232)
|
|
(offset float :offset-assert 236)
|
|
)
|
|
:heap-base #x80
|
|
:method-count-assert 28
|
|
:size-assert #xf0
|
|
:flag-assert #x1c008000f0
|
|
(:methods
|
|
(wedge-plat-method-27 (_type_) symbol 27)
|
|
)
|
|
(:states
|
|
wedge-plat-idle
|
|
wedge-plat-tip
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup *wedge-plat-sg* wedge-plat wedge-plat-lod0-jg wedge-plat-idle-ja
|
|
((wedge-plat-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 6)
|
|
)
|
|
|
|
(defmethod wedge-plat-method-27 wedge-plat ((obj wedge-plat))
|
|
(let* ((a0-1 (-> obj master))
|
|
(v1-0 (if a0-1
|
|
(-> (the-as process-drawable (-> a0-1 ppointer)) brother)
|
|
)
|
|
)
|
|
)
|
|
(when v1-0
|
|
(let ((s4-0 (&-> v1-0 27))
|
|
(f30-0 (-> obj distance))
|
|
(f28-0 (the float (sar (shl (the int (+ (the-as float (-> v1-0 32)) (-> obj offset))) 48) 48)))
|
|
(s5-0 #f)
|
|
)
|
|
(quaternion-axis-angle!
|
|
(-> obj root-override quat)
|
|
0.0
|
|
1.0
|
|
0.0
|
|
(the float (sar (shl (the int (- 49152.0 f28-0)) 48) 48))
|
|
)
|
|
(set! (-> obj basetrans x) (+ (the-as float (-> s4-0 0)) (* f30-0 (cos f28-0))))
|
|
(set! (-> obj basetrans y) (the-as float (-> s4-0 1)))
|
|
(set! (-> obj basetrans z) (+ (the-as float (-> s4-0 2)) (* f30-0 (sin f28-0))))
|
|
(let ((f0-16 (cos f28-0)))
|
|
(if (or (< 0.95 f0-16) (< f0-16 -0.95))
|
|
(set! s5-0 #t)
|
|
)
|
|
)
|
|
s5-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defstate wedge-plat-idle (wedge-plat)
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
(the-as object (case event-type
|
|
(('bonk)
|
|
(the-as symbol (baseplat-method-22 self))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:trans (the-as (function none :behavior wedge-plat) plat-trans)
|
|
:code (behavior ()
|
|
(ja :num-func num-func-identity :frame-num (ja-aframe 0.0 0))
|
|
(loop
|
|
(if (wedge-plat-method-27 self)
|
|
(go wedge-plat-tip)
|
|
)
|
|
(suspend)
|
|
)
|
|
(none)
|
|
)
|
|
:post (the-as (function none :behavior wedge-plat) plat-post)
|
|
)
|
|
|
|
(defstate wedge-plat-tip (wedge-plat)
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
(the-as object (case event-type
|
|
(('bonk)
|
|
(the-as symbol (baseplat-method-22 self))
|
|
)
|
|
(('touch)
|
|
(send-event proc 'no-look-around (seconds 1.5))
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:trans (the-as (function none :behavior wedge-plat) plat-trans)
|
|
:code (behavior ()
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 60.0 0))
|
|
:frame-num (ja-aframe 0.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 60.0 0)))
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 100.0 0))
|
|
:frame-num (ja-aframe 60.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 100.0 0)))
|
|
)
|
|
(set! (-> self state-time) (-> *display* base-frame-counter))
|
|
(until (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1))
|
|
(ja :num-func num-func-identity :frame-num (ja-aframe 100.0 0))
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 153.0 0))
|
|
:frame-num (ja-aframe 100.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 153.0 0)))
|
|
)
|
|
(go wedge-plat-idle)
|
|
(none)
|
|
)
|
|
:post (the-as (function none :behavior wedge-plat) plat-post)
|
|
)
|
|
|
|
(defmethod init-from-entity! wedge-plat ((obj wedge-plat) (arg0 entity-actor))
|
|
(set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
|
|
(let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
|
|
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s4-0 reaction) default-collision-reaction)
|
|
(set! (-> s4-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
|
)
|
|
(alloc-riders s4-0 1)
|
|
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
|
|
(set! (-> s3-0 collide-with) (collide-kind target))
|
|
(set! (-> s3-0 prim-core action) (collide-action solid ca-1))
|
|
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-0 transform-index) 3)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 24576.0)
|
|
(set-root-prim! s4-0 s3-0)
|
|
)
|
|
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
|
(backup-collide-with-as s4-0)
|
|
(set! (-> obj root-override) s4-0)
|
|
)
|
|
(process-drawable-from-entity! obj arg0)
|
|
(initialize-skeleton obj *wedge-plat-sg* '())
|
|
(logior! (-> obj skel status) (janim-status inited))
|
|
(update-transforms! (-> obj root-override))
|
|
(baseplat-method-21 obj)
|
|
(set! (-> obj master) (the-as wedge-plat-master (entity-actor-lookup arg0 'alt-actor 0)))
|
|
(set! (-> obj offset) (res-lump-float arg0 'rotoffset))
|
|
(set! (-> obj distance) (res-lump-float arg0 'distance :default 36864.0))
|
|
(logclear! (-> obj mask) (process-mask actor-pause))
|
|
(go wedge-plat-idle)
|
|
(none)
|
|
)
|
|
|
|
(deftype wedge-plat-outer (wedge-plat)
|
|
()
|
|
:heap-base #x80
|
|
:method-count-assert 28
|
|
:size-assert #xf0
|
|
:flag-assert #x1c008000f0
|
|
(:states
|
|
wedge-plat-outer-idle
|
|
wedge-plat-outer-tip
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup *wedge-plat-outer-sg* wedge-plat-outer wedge-plat-outer-lod0-jg wedge-plat-outer-idle-ja
|
|
((wedge-plat-outer-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 8)
|
|
)
|
|
|
|
(defmethod wedge-plat-method-27 wedge-plat-outer ((obj wedge-plat-outer))
|
|
(let* ((a0-1 (-> obj master))
|
|
(v1-0 (if a0-1
|
|
(-> (the-as process-drawable (-> a0-1 ppointer)) brother)
|
|
)
|
|
)
|
|
)
|
|
(when v1-0
|
|
(let ((s4-0 (&-> v1-0 27))
|
|
(f30-0 (-> obj distance))
|
|
(f28-0 (the float (sar (shl (the int (+ (the-as float (-> v1-0 33)) (-> obj offset))) 48) 48)))
|
|
(s5-0 #f)
|
|
)
|
|
(quaternion-axis-angle!
|
|
(-> obj root-override quat)
|
|
0.0
|
|
1.0
|
|
0.0
|
|
(the float (sar (shl (the int (- 49152.0 f28-0)) 48) 48))
|
|
)
|
|
(set! (-> obj basetrans x) (+ (the-as float (-> s4-0 0)) (* f30-0 (cos f28-0))))
|
|
(set! (-> obj basetrans y) (the-as float (-> s4-0 1)))
|
|
(set! (-> obj basetrans z) (+ (the-as float (-> s4-0 2)) (* f30-0 (sin f28-0))))
|
|
(let ((f0-16 (sin f28-0)))
|
|
(if (or (< 0.95 f0-16) (< f0-16 -0.95))
|
|
(set! s5-0 #t)
|
|
)
|
|
)
|
|
s5-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defstate wedge-plat-outer-idle (wedge-plat-outer)
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
(the-as object (case event-type
|
|
(('bonk)
|
|
(the-as symbol (baseplat-method-22 self))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:trans (the-as (function none :behavior wedge-plat-outer) plat-trans)
|
|
:code (behavior ()
|
|
(loop
|
|
(ja :num-func num-func-identity :frame-num (ja-aframe 0.0 0))
|
|
(if (wedge-plat-method-27 self)
|
|
(go wedge-plat-outer-tip)
|
|
)
|
|
(suspend)
|
|
)
|
|
(none)
|
|
)
|
|
:post (the-as (function none :behavior wedge-plat-outer) plat-post)
|
|
)
|
|
|
|
(defstate wedge-plat-outer-tip (wedge-plat-outer)
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
(the-as object (case event-type
|
|
(('bonk)
|
|
(the-as object (baseplat-method-22 self))
|
|
)
|
|
(('touch)
|
|
(send-event proc 'no-look-around (seconds 1.5))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:trans (the-as (function none :behavior wedge-plat-outer) plat-trans)
|
|
:code (behavior ()
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 60.0 0))
|
|
:frame-num (ja-aframe 0.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 60.0 0)))
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 100.0 0))
|
|
:frame-num (ja-aframe 60.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 100.0 0)))
|
|
)
|
|
(set! (-> self state-time) (-> *display* base-frame-counter))
|
|
(until (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1))
|
|
(ja :num-func num-func-identity :frame-num (ja-aframe 100.0 0))
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
)
|
|
(ja-no-eval :group! (-> self draw art-group data 3)
|
|
:num! (seek! (ja-aframe 153.0 0))
|
|
:frame-num (ja-aframe 100.0 0)
|
|
)
|
|
(until (ja-done? 0)
|
|
(wedge-plat-method-27 self)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 153.0 0)))
|
|
)
|
|
(go wedge-plat-outer-idle)
|
|
(none)
|
|
)
|
|
:post (the-as (function none :behavior wedge-plat-outer) plat-post)
|
|
)
|
|
|
|
(defmethod init-from-entity! wedge-plat-outer ((obj wedge-plat-outer) (arg0 entity-actor))
|
|
(set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
|
|
(let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
|
|
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s4-0 reaction) default-collision-reaction)
|
|
(set! (-> s4-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
|
)
|
|
(alloc-riders s4-0 1)
|
|
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
|
|
(set! (-> s3-0 collide-with) (collide-kind target))
|
|
(set! (-> s3-0 prim-core action) (collide-action solid ca-1 ca-4))
|
|
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-0 transform-index) 3)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 32768.0)
|
|
(set-root-prim! s4-0 s3-0)
|
|
)
|
|
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
|
(backup-collide-with-as s4-0)
|
|
(set! (-> obj root-override) s4-0)
|
|
)
|
|
(process-drawable-from-entity! obj arg0)
|
|
(initialize-skeleton obj *wedge-plat-sg* '())
|
|
(logior! (-> obj skel status) (janim-status inited))
|
|
(update-transforms! (-> obj root-override))
|
|
(baseplat-method-21 obj)
|
|
(set! (-> obj master) (the-as wedge-plat-master (entity-actor-lookup arg0 'alt-actor 0)))
|
|
(set! (-> obj offset) (res-lump-float arg0 'rotoffset))
|
|
(set! (-> obj distance) (res-lump-float arg0 'distance :default 69632.0))
|
|
(logclear! (-> obj mask) (process-mask actor-pause))
|
|
(go wedge-plat-outer-idle)
|
|
(none)
|
|
)
|