;;-*-Lisp-*- (in-package goal) ;; name: cam-states-dbg.gc ;; name in dgo: cam-states-dbg ;; dgos: ENGINE, GAME ;; DECOMP BEGINS (deftype cam-point-watch-bank (basic) ((speed float) (rot-speed degrees) ) ) (define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))) (defstate cam-point-watch (camera-slave) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('teleport) #f ) (else (cam-standard-event-handler proc argc message block) ) ) ) :enter (behavior () (when (not (-> self enter-has-run)) (set! (-> self pivot-rad) 40960.0) (set! (-> self blend-from-type) (the-as uint 1)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) ) ) :code (behavior () (until #f (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) (f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0)) ) (cond ((cpad-hold? (-> *CAMERA-bank* joypad) r2) (set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) (set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) (+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) (+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) ) (else (set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0)))) (set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0)))) (+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0)) (+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)) ) ) ) (let ((s4-0 (new-stack-vector0))) (let ((s3-0 (new-stack-matrix0))) (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) (vector-matrix*! s4-0 s4-0 s3-0) ) (forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)) ) (set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z))) (if (< (-> self pivot-rad) 4096.0) (set! (-> self pivot-rad) 4096.0) ) (set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0) (vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking))) ) ) (suspend) 0 ) #f ) ) (deftype cam-free-bank (basic) ((speed float) (rot-speed degrees) ) ) (define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6))) (defun cam-mouse-input ((arg0 vector) (arg1 vector)) (let ((v1-0 (new 'stack-no-clear 'vector))) (vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1)) (cond ((mouse-hold? left) (let ((a0-7 (new 'stack-no-clear 'vector))) 0.0 (vector-! a0-7 (-> *math-camera* trans) (-> *setting-control* cam-current mouse-tumble-point)) (let ((f30-0 (vector-length a0-7))) (cond (#f (let* ((f28-0 (* 0.01 f30-0 (-> v1-0 x))) (f26-0 (* 0.01 f30-0 (-> v1-0 y))) (f0-5 f28-0) (f0-7 (* f0-5 f0-5)) (f1-2 f26-0) (f0-8 (+ f0-7 (* f1-2 f1-2))) (f1-5 f30-0) (f22-0 (- (sqrtf (+ f0-8 (* f1-5 f1-5))) f30-0)) (f24-0 (atan f26-0 f30-0)) (f0-12 (atan (- f28-0) f30-0)) ) (+! (-> arg1 x) f28-0) (+! (-> arg1 y) f26-0) (+! (-> arg1 z) f22-0) (+! (-> arg0 x) f24-0) (set! (-> arg0 y) (+ (-> arg0 y) f0-12)) ) ) (else (+! (-> arg0 y) (* (- (-> v1-0 x)) (-> *CAM_FREE-bank* rot-speed))) (set! (-> arg0 x) (+ (-> arg0 x) (* (-> v1-0 y) (-> *CAM_FREE-bank* rot-speed)))) ) ) ) ) ) ((mouse-hold? right) (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) (set! (-> arg1 z) (+ (-> arg1 z) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))) ) ((mouse-hold? middle) (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) (set! (-> arg1 y) (+ (-> arg1 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))) ) ) ) ) (defun cam-free-floating-input ((arg0 vector) (arg1 vector) (arg2 symbol) (arg3 int)) (with-pp (when *camera* (if (-> *setting-control* cam-current mouse-input) (cam-mouse-input arg0 arg1) ) (let ((s3-0 (and (-> *setting-control* cam-current cpad1-skip-buttons) (= arg3 1)))) (when (not s3-0) (when (and (!= *master-mode* 'menu) (not *cam-layout*)) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 x) (set! (-> arg0 x) (- (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 6)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 triangle) (+! (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 4)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 square) (+! (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 7)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 circle) (set! (-> arg0 y) (- (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 5)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) ) ) (when arg2 (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 l2) (+! (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 10)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 r2) (set! (-> arg0 z) (- (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 11)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed) ) ) ) ) ) ) ) (when (nonzero? arg3) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 left) (+! (-> arg1 x) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 right) (set! (-> arg1 x) (- (-> arg1 x) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 up) (+! (-> arg1 z) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 down) (set! (-> arg1 z) (- (-> arg1 z) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) ) ) ) (cond ((logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)) ) ((cpad-hold? arg3 r2) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 r1) (+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed)) ) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 l1) (set! (-> arg1 y) (- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed)) ) ) ) ) ) ) ) (else (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 r1) (+! (-> arg1 y) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? arg3 l1) (set! (-> arg1 y) (- (-> arg1 y) (+ (-> *CAM_FREE-bank* speed) (analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)) ) ) ) ) ) ) ) (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) ;; og:preserve-this (f26-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) (f0-60 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ) (cond ((and (not s3-0) (cpad-hold? arg3 r2)) (cond ((cpad-hold? arg3 l2) (set! (-> arg0 y) (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) (set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) ) (else (set! (-> arg0 y) (- (-> arg0 y) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed)))) (set! (-> arg0 x) (- (-> arg0 x) (* (- f0-60) (-> *CAM_FREE-bank* rot-speed)))) ) ) (+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14)) (+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)) ) ((and (not s3-0) (cpad-hold? arg3 l2)) (+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed))) (+! (-> arg1 y) (* f0-60 (-> *CAM_FREE-bank* speed))) (+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))) ) (else (set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))) (set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-60)))) (+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14)) (+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14)) ) ) ) ) ) (vector-float*! arg0 arg0 (-> pp clock time-adjust-ratio)) (vector-float*! arg1 arg1 (-> pp clock time-adjust-ratio)) ) ) ) (deftype camera-free-floating-move-info (structure) ((rv vector :inline) (tv vector :inline) (up vector :inline) (tm matrix :inline) ) ) (defun cam-free-floating-move ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int)) (if (logtest? (-> *cpad-list* cpads arg3 valid) 128) (return (the-as vector #f)) ) (if (= *master-mode* 'menu) (return (the-as vector #f)) ) (let ((s3-0 (new 'stack 'camera-free-floating-move-info))) (cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3) (cond (arg2 (matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y)) (matrix*! arg0 arg0 (-> s3-0 tm)) (cond ((< (vector-dot (-> arg0 vector 1) arg2) 0.0) (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2) ) (else (vector-negate! (-> s3-0 up) arg2) (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)) ) ) ) (else (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) (matrix*! arg0 arg0 (-> s3-0 tm)) ) ) (matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x))) (matrix*! arg0 arg0 (-> s3-0 tm)) (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z))) (matrix*! arg0 arg0 (-> s3-0 tm)) (vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0) (vector+! arg1 arg1 (-> s3-0 tv)) ) ) (defstate cam-free-floating (camera-slave) :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) (case message (('teleport) #f ) (else (cam-standard-event-handler proc argc message block) ) ) ) :enter (behavior () (when (not (-> self enter-has-run)) (set! (-> self blend-from-type) (the-as uint 1)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) (send-event *camera-combiner* 'stop-tracking) ) ) :code (behavior () (until #f (let ((a2-0 (-> *camera* local-down))) (if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT)) (set! a2-0 (the-as vector #f)) ) (cam-free-floating-move (the-as matrix (-> self tracking)) (-> self trans) a2-0 (the-as int (-> *CAMERA-bank* joypad)) ) ) (suspend) ) #f ) )