Files
jak-project/goal_src/levels/jungle/jungle-elevator.gc
T
ManDude 25b0e1be7d [decomp] collectables + works ingame! (#971)
* decomp: `collectables`

* fix types

* `powerups` and fixes

* fixes

* Merge branch 'pr/929' into d/temp/collectables

* fix collide stuff

* update things...

* update

* update

* temp bump global heap mem

* fix `defstate` hooks wrong/unnecessary sets & collide stuff for collectables

* dumb mistakes :)

* stub out broken process-drawable stuff

* update refs

* add `:no-inspect` key and save some memory & remove birth logs

* Update kmachine.h

* clang

* add citadel

* fix no-inspect key

* fix tests!!

* fix stupid mistake in `collide-shape-prim-sphere` alloc

* comment annoying print

* feedback

* fix edge-case probably

* remove `:no-inspect`s
2021-11-23 18:25:57 -05:00

201 lines
4.7 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: jungle-elevator.gc
;; name in dgo: jungle-elevator
;; dgos: JUN, JUNGLE, L1
;; DECOMP BEGINS
(deftype jungle-elevator (plat-button)
((bottom-height float :offset-assert 240)
(teleport-if-below-y float :offset-assert 244)
(teleport-if-above-y float :offset-assert 248)
)
:heap-base #x90
:method-count-assert 33
:size-assert #xfc
:flag-assert #x21009000fc
)
(defmethod can-activate? jungle-elevator ((obj jungle-elevator))
(and
((method-of-type plat-button can-activate?) obj)
(task-complete? *game-info* (game-task jungle-tower))
)
)
(defstate plat-button-move-downward (jungle-elevator)
:virtual #t
:enter
(behavior ()
(let
((t9-0 (-> (method-of-type plat-button plat-button-move-downward) enter)))
(if t9-0
(t9-0)
)
)
(set! (-> self draw light-index) (the-as uint 255))
(set! (-> self bottom-height) (-> jungle bottom-height))
(set! (-> jungle bottom-height) (-> jungleb bottom-height))
(send-event *target* 'reset-pickup 'eco)
(none)
)
:exit
(behavior ()
(set! (-> jungle bottom-height) (-> self bottom-height))
(let
((t9-0 (-> (method-of-type plat-button plat-button-move-downward) exit)))
(if t9-0
(t9-0)
)
)
(none)
)
:trans
(behavior ()
(let ((s5-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
)
(set! (-> s5-0 quad) (-> self root-override trans quad))
(let
((t9-1
(->
(the-as (state plat-button) (find-parent-method jungle-elevator 23))
trans
)
)
)
(if t9-1
(t9-1)
)
)
(vector-! gp-0 (-> self root-override trans) s5-0)
(when (< (-> self path-pos) 0.9)
(TODO-RENAME-28 (-> *target* control) gp-0)
(send-event *target* 'reset-height)
)
)
(if
(and
(>= (-> self path-pos) 0.2)
(< (- (-> *display* base-frame-counter) (-> self state-time)) 60)
)
(load-commands-set! *level* (load-command-get-index *level* 'jungle 0))
)
(none)
)
)
(defstate plat-button-move-upward (jungle-elevator)
:virtual #t
:enter
(behavior ()
(let ((t9-0 (-> (method-of-type plat-button plat-button-move-upward) enter)))
(if t9-0
(t9-0)
)
)
(set! (-> self draw light-index) (the-as uint 255))
(set! (-> self bottom-height) (-> jungle bottom-height))
(set! (-> jungle bottom-height) (-> jungleb bottom-height))
(set! (-> self grab-player?) (process-grab? *target*))
(none)
)
:exit
(behavior ()
(set! (-> jungle bottom-height) (-> self bottom-height))
(let ((t9-0 (-> (method-of-type plat-button plat-button-move-upward) exit)))
(if t9-0
(t9-0)
)
)
(none)
)
:trans
(behavior ()
(let ((t9-0 (-> (method-of-type plat-button plat-button-move-upward) trans)))
(if t9-0
(t9-0)
)
)
(if
(and
(< (-> self path-pos) 0.8)
(< (- (-> *display* base-frame-counter) (-> self state-time)) 60)
)
(load-commands-set! *level* (load-command-get-index *level* 'jungle 1))
)
(none)
)
)
(defstate plat-button-at-end (jungle-elevator)
:virtual #t
:code
(behavior ()
(cond
((!= (-> self path-pos) 0.0)
(set! (-> self draw light-index) (the-as uint 1))
(let ((a1-1 (res-lump-struct (-> self entity) 'continue-name structure)))
(when a1-1
(let ((v1-4 (set-continue! *game-info* (the-as basic a1-1))))
(load-commands-set! *level* (-> v1-4 load-commands))
)
)
)
)
(else
(set! (-> self draw light-index) (the-as uint 255))
(load-commands-set! *level* '())
)
)
(let ((t9-4 (-> (method-of-type plat-button plat-button-at-end) code)))
(if t9-4
((the-as (function none :behavior plat-button) t9-4))
)
)
(none)
)
)
(defmethod should-teleport? jungle-elevator ((obj jungle-elevator))
(let ((f0-0 (-> (camera-pos) y)))
(case (-> obj path-pos)
((0.0)
(when (< f0-0 (-> obj teleport-if-below-y))
(set! (-> obj draw light-index) (the-as uint 1))
(return #t)
)
)
((1.0)
(when (< (-> obj teleport-if-above-y) f0-0)
(set! (-> obj draw light-index) (the-as uint 255))
(return #t)
)
)
)
)
#f
)
(defmethod can-target-move? jungle-elevator ((obj jungle-elevator))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(eval-path-curve! (-> obj path) s5-0 0.4 'interp)
(set! (-> obj teleport-if-above-y) (-> s5-0 y))
(eval-path-curve! (-> obj path) s5-0 0.6 'interp)
(set! (-> obj teleport-if-below-y) (-> s5-0 y))
)
(set! (-> obj draw light-index) (the-as uint 255))
(set! (-> obj bidirectional?) #f)
(let ((v0-2 #t))
(set! (-> obj should-grab-player?) v0-2)
v0-2
)
)