;;-*-Lisp-*- (in-package goal) ;; name: com-elevator.gc ;; name in dgo: com-elevator ;; dgos: PAS, TOD ;; DECOMP BEGINS (deftype com-elevator (elevator) ((camera-startup vector 2 :inline) (use-camera-startup? symbol 2) (sound-id sound-id) ) (:methods (com-elevator-method-49 (_type_ symbol) none) ) ) (defskelgroup skel-com-elevator com-elevator com-elevator-lod0-jg com-elevator-idle-ja ((com-elevator-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 5.6 9.2) ) (defmethod get-art-group ((this com-elevator)) "@returns The associated [[art-group]]" (art-group-get-by-name *level* "skel-com-elevator" (the-as (pointer uint32) #f)) ) (defmethod move-between-points ((this com-elevator) (arg0 vector) (arg1 float) (arg2 float)) "Move between two points on the elevator's path @param vec TODO not sure @param point-a The first point fetched from the elevator's path @param point-b The second point fetched from the path @see [[path-control]] and [[elevator]]" (let ((s4-0 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) arg1 'interp)) (a0-3 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) arg2 'interp)) (v1-3 (-> this root trans)) ) (when (and (< (-> a0-3 y) (-> s4-0 y)) (< (-> arg0 y) (+ -8192.0 (-> v1-3 y)))) (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg0 v1-3))) (vector-inv-orient-by-quat! s4-2 s4-2 (-> this root quat)) (and (< (fabs (-> s4-2 x)) 24576.0) (< 0.0 (-> s4-2 z)) (< (-> s4-2 z) 49152.0)) ) ) ) ) (defmethod commited-to-ride? ((this com-elevator)) "@returns if the target is considered within the elevator area enough to begin descending/ascending" (let* ((s5-0 *target*) (a0-2 (if (type? s5-0 process-focusable) s5-0 ) ) ) (and (when a0-2 (let* ((v1-2 (get-trans a0-2 0)) (s5-2 (vector-! (new 'stack-no-clear 'vector) v1-2 (-> this root trans))) ) (vector-inv-orient-by-quat! s5-2 s5-2 (-> this root quat)) (and (< (fabs (-> s5-2 x)) 20480.0) (< 0.0 (-> s5-2 z)) (< (-> s5-2 z) 40960.0)) ) ) (let ((gp-1 (res-lump-struct (-> this entity) 'on-notice structure))) (not (if gp-1 (script-eval (the-as pair gp-1)) ) ) ) ) ) ) (defmethod com-elevator-method-49 ((this com-elevator) (arg0 symbol)) (let ((v1-3 (-> (the-as collide-shape-prim-group (-> this root root-prim)) child 1))) (cond (arg0 (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle pusher)) (set! (-> v1-3 prim-core collide-with) (collide-spec jak player-list)) ) (else (set! (-> v1-3 prim-core collide-as) (collide-spec)) (set! (-> v1-3 prim-core collide-with) (collide-spec)) 0 ) ) ) (none) ) (defstate dormant (com-elevator) :virtual #t :enter (behavior () (call-parent-state-handler enter) (process-entity-status! self (entity-perm-status subtask-complete) #t) ) ) (defstate running (com-elevator) :virtual #t :enter (behavior () (let ((t9-0 (-> (method-of-type elevator running) enter))) (if t9-0 (t9-0) ) ) (com-elevator-method-49 self #t) (if (not (logtest? (-> self elevator-status) (elevator-status moving))) (set-setting! 'allow-look-around #f 0.0 0) ) ) :exit (behavior () (sound-stop (-> self sound-id)) (sound-play "com-elevator-e") (let ((t9-3 (-> (method-of-type elevator running) exit))) (if t9-3 (t9-3) ) ) (com-elevator-method-49 self #f) (remove-setting! 'allow-look-around) ) :code (behavior () (suspend-for (seconds 1)) (sound-play "com-elevator-s") (logior! (-> self elevator-status) (elevator-status waiting-to-ascend)) (until #f (suspend) (sound-play "com-elevator-lp" :id (-> self sound-id)) (when (= (-> self path-pos) 1.0) (let ((v1-11 (the int (-> self move-pos 1)))) (if (-> self use-camera-startup? v1-11) (persist-with-delay *setting-control* 'string-startup-vector (seconds 0.05) 'string-startup-vector 'abs (the-as float (-> self camera-startup v1-11)) 0 ) ) ) (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) ) ) #f ) ) (defmethod activate-elevator ((this com-elevator)) "Puts the elevator initially into the correct state. This is typically based upon game completion" (cond ((logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)) (go (method-of-object this dormant)) ) ((logtest? (-> this params flags) (elevator-flags elevator-flags-6)) (go (method-of-object this arrived)) ) (else (go (method-of-object this waiting)) ) ) ) (defmethod deactivate ((this com-elevator)) "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this sound-id)) (call-parent-method this) (none) ) ;; WARN: Return type mismatch sound-id vs none. (defmethod init-plat! ((this com-elevator)) "Does any necessary initial platform setup. For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." (dotimes (s5-0 (-> this path curve num-cverts)) (let ((a1-1 (res-lump-struct (-> this entity) 'string-startup-vector structure :time (the float s5-0)))) (cond (a1-1 (vector-normalize-copy! (-> this camera-startup s5-0) (the-as vector a1-1) 1.0) (set! (-> this use-camera-startup? s5-0) #t) ) (else (set! (-> this use-camera-startup? s5-0) #f) ) ) ) ) (set! (-> this sound-id) (new-sound-id)) (none) ) (defmethod init-plat-collision! ((this com-elevator)) "TODO - collision stuff for setting up the platform" (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) (set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-query vector vector object) nothing) ) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) (set! (-> s5-0 total-prims) (the-as uint 3)) (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) (set! (-> s4-0 prim-core action) (collide-action solid rideable)) (set! (-> s4-0 transform-index) 3) (set-vector! (-> s4-0 local-sphere) 0.0 0.0 22937.6 37683.2) (set! (-> s5-0 root-prim) s4-0) ) (pusher-init s5-0) (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) (set! (-> v1-15 prim-core action) (collide-action solid rideable)) (set! (-> v1-15 transform-index) 3) (set-vector! (-> v1-15 local-sphere) 0.0 0.0 22937.6 37683.2) ) (let ((v1-17 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) (set! (-> v1-17 prim-core action) (collide-action solid)) (set! (-> v1-17 transform-index) 3) (set-vector! (-> v1-17 local-sphere) 0.0 0.0 22937.6 39321.6) ) (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) (let ((v1-20 (-> s5-0 root-prim))) (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) ) (set! (-> this root) s5-0) ) (com-elevator-method-49 this #f) (none) ) (deftype tomb-trans-elevator (com-elevator) ((unknown-gijh1bn2i3hb1 int32) ) ) (defstate running (tomb-trans-elevator) :virtual #t :enter (behavior () (let ((t9-0 (-> (method-of-type com-elevator running) enter))) (if t9-0 (t9-0) ) ) (if (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) (set-setting! 'jump #f 0.0 0) ) ) :exit (behavior () (let ((t9-0 (-> (method-of-type com-elevator running) exit))) (if t9-0 (t9-0) ) ) (sound-stop (-> self sound-id)) (sound-play "tmb-elev-stop") (if (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) (remove-setting! 'jump) ) ) :code (behavior () (suspend-for (seconds 1)) (logior! (-> self elevator-status) (elevator-status waiting-to-ascend)) (until #f (sound-play "tmb-elevator-lp" :id (-> self sound-id)) (suspend) (when (= (-> self path-pos) 1.0) (let ((v1-10 (the int (-> self move-pos 1)))) (if (-> self use-camera-startup? v1-10) (persist-with-delay *setting-control* 'string-startup-vector (seconds 0.05) 'string-startup-vector 'abs (the-as float (-> self camera-startup v1-10)) 0 ) ) ) (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) ) ) #f ) ) (defmethod deactivate ((this tomb-trans-elevator)) "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this sound-id)) (call-parent-method this) (none) ) ;; WARN: Return type mismatch sound-id vs none. (defmethod init-plat! ((this tomb-trans-elevator)) "Does any necessary initial platform setup. For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." (call-parent-method this) (set! (-> this sound-id) (new-sound-id)) (none) )