mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-21 07:37:45 -04:00
58a5440c8a
Makes a bunch of missions mostly playable, including: - `arena-training-1` - `arena-fight-1` - `wascity-chase` - `arena-fight-2` - `arena-fight-3` - `volcano-darkeco` - `desert-hover` - `nest-eggs` - `temple-climb` - `temple-oracle` - `temple-tests` - `desert-beast-battle` - `desert-turtle-training` - `desert-course-race` - `desert-artifact-race1` - `wascity-leaper-race` - `wascity-pre-game` - `sewer-met-hum` - `forest-kill-plants` - `forest-ring-chase` - `temple-defend` - `tower-destroy` - `desert-glide` --- Files: - `ripple` - `waswide-mood` - `sig-rider` - `nst-tasks` - `nst-part` - `nst-gas` - `nst-eggs-h` - `nst-obs` - `nst-mood` - `egg-spider` - `wasdoors-init` - `wasall-tasks` - `wvehicle-race` - `wcar-marauder` - `wcar-marauder-b` - `turret-control` - `was-squad-control` - `turtle-training` - `kleever-rider` - `course-race` - `artifact-race` - `desert-hover` - `desbeast-path-h` - `des-beast` - `desertg-obs` - `desertf-obs` - `desertd-obs` - `desert-dust-storm` - `des-cactus` - `race-hud` - `race-info` - `race-manager` - `tizard` - `flyingsaw` - `hover-training` - `temple-mood` - `temple-obs` - `temple-obs2` - `temple-part` - `temple-scenes` - `templex-mood` - `templex-obs` - `templex-part` - `tomb-baby-spider` - `target-turret-shot` - `target-turret` - `beast-battle-path` - `des-beast-2` - `mh-flyer` - `scorpion-gun` - `hover-enemy-h` - `hover-enemy` - `hover-formation-h` - `hover-formation` - `hover-nav-control-h` - `hover-nav-control` - `flamer-hover` - `hover-nav-templea` - `robo-hover` - `hover-nav-sewb` - `hover-nav-sewg` - `hover-nav-sewj` - `hover-nav-sewl` - `hover-nav-sewo` - `hover-nav-towera` - `tower-mood` - `tower-obs` - `tower-scenes` - `tower-part` - `eco-green-collider` - `forest-bridges` - `forest-kill-plants` - `forest-mood` - `forest-ring-chase` - `forest-tasks` - `forest-part` - `foresta-obs` - `hover-nav-foresta` - `mh-plant` - `dp-bipedal-part` - `dp-bipedal-shot` - `dp-bipedal` - `neo-spawner` - `for-turret` - `for-turret-shot` - `neo-wasp` - `neo-wasp-part` - `volcanox-scenes` - `volcanox-mood` - `volcano-scenes` - `volcano-mood` - `volcano-obs` - `volcano-obs2` - `chain-physics` - `rigid-body-plat` - `volcano-part` - `flamer-lava` - `flitter` - `spiky-frog` - `flut-wild` - `target-indax` - `target-indax-hang` - `mantis` - `volcanox-obs` - `spyder` - `wcar-faccar` - `mhcity-obs2` - `mhcity-part` - `mhcity-obs` - `dm-mine-spider` - `rapid-gunner` - `stadium-mood` - `stadium-scenes` - `stadiuma-mood` - `stadiuma-part` - `kanga-lizard` - `marauder` - `arena-scenes` - `wasstada-mood` - `wasstada-obs` - `wasstada-part` - `wasstadb-obs` - `wasstadc-obs` - `dm-flyer` - `maker-part` - `maker-projectile` - `skeet-part` - `wascity-turret` - `wasgun-h` - `wasgun-hud` - `wasgun-manager` - `nav-graph-h` - `traffic-engine-h` - `waswide-init` - `cty-borrow-manager-h` - `cty-borrow-manager` - `desert-part` - `height-map-h` - `height-map` - `traffic-height-map` - `vehicle-control` - `hvehicle-h` - `hvehicle` - `hvehicle-effects` - `hvehicle-physics` - `hvehicle-util` - `glider-h` - `glider-hud` - `glider-manager` - `glider-ring` - `glider-ring-part` - `h-glider` - `hanga-init` - `was-pre-game` - `was-leaper-race` - `flut-racer` - `desert-scenes` - `desert-lizard-h` - `desert-lizard-task` - `desert-lizard` - `throne-scenes` - `waspal-mood` - `waspala-obs` - `waspala-part` - `deswalk-obs` - `deswalk-part` - `terraformer-drone` - `terraformer-head` - `terraformer-part` - `terraformer-setup`
530 lines
20 KiB
Common Lisp
530 lines
20 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: wvehicle-race.gc
|
|
;; name in dgo: wvehicle-race
|
|
;; dgos: LPATK, LFACCAR, WASALL
|
|
|
|
(deftype wvehicle-race-stack-var0 (structure)
|
|
((vec0 vector :inline :offset 0)
|
|
(vec1 vector :inline :offset 16)
|
|
(vec2 vector :inline :offset 32)
|
|
(vec3 vector :inline :offset 48)
|
|
(vec4 vector :inline :offset 64)
|
|
(vec5 vector :inline :offset 80)
|
|
(vec6 vector :inline :offset 96)
|
|
(vec7 vector :inline :offset 112)
|
|
(vec8 vector :inline :offset 128)
|
|
(vec9 vector :inline :offset 144)
|
|
(vec10 vector :inline :offset 160)
|
|
(vec11 vector :inline :offset 176)
|
|
(float0 float :offset 192)
|
|
(byte0 uint8 :offset 196)
|
|
(sample race-path-sample :inline :offset 208)
|
|
(vec12 vector :inline :offset 240)
|
|
(vec13 vector :inline :offset 256)
|
|
(float1 float :offset 272)
|
|
(time uint32 :offset 276)
|
|
(float2 float :offset 280)
|
|
(float3 float :offset 284)
|
|
(float4 float :offset 288)
|
|
(float5 float :offset 292)
|
|
(float6 float :offset 296)
|
|
(float7 float :offset 300)
|
|
(float8 float :offset 304)
|
|
)
|
|
)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defmethod race-select-path-randomly-from-mask ((this wvehicle) (arg0 uint))
|
|
(let ((a0-1 0)
|
|
(v1-0 0)
|
|
(s5-0 (new 'stack-no-clear 'array 'int8 16))
|
|
)
|
|
(let ((a1-1 (logand arg0 255)))
|
|
(while (nonzero? a1-1)
|
|
(set! (-> s5-0 a0-1) v1-0)
|
|
(+! a0-1 (logand a1-1 1))
|
|
(+! v1-0 1)
|
|
(set! a1-1 (shr a1-1 1))
|
|
)
|
|
)
|
|
(when (> a0-1 0)
|
|
(let ((s5-1 (-> s5-0 (rand-vu-int-count a0-1))))
|
|
(format #t "wvehicle::race-select-path-randomly-from-mask: switching to path-~d~%" s5-1)
|
|
(race-control-method-9 (-> this race) s5-1 (-> this root trans))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod wvehicle-method-181 ((this wvehicle))
|
|
(local-vars (v1-23 float) (v1-32 float))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((a1-0 (new 'stack-no-clear 'wvehicle-physics-work)))
|
|
(set! (-> a1-0 cur-time) (the-as uint (current-time)))
|
|
(wvehicle-method-160 this a1-0)
|
|
)
|
|
(let ((s5-0 (-> this race)))
|
|
(when #t
|
|
(race-control-method-11 s5-0 0.0)
|
|
(let ((s4-0 (-> this rbody))
|
|
(f30-0 (seconds-per-frame))
|
|
)
|
|
1.0
|
|
(let ((s3-0 (new 'stack-no-clear 'wvehicle-physics-work))
|
|
(f28-0
|
|
(fmin
|
|
(* (+ (vector-length (-> s4-0 lin-velocity)) (* 163840.0 f30-0))
|
|
(/ 1.0 (fmax 1.0 (vector-length (-> s5-0 lin-velocity))))
|
|
)
|
|
(-> s5-0 racer-state speed-factor)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> s3-0 velocity x) 819200.0)
|
|
(quaternion-copy! (the-as quaternion (-> s3-0 force)) (-> s5-0 path-sample quat))
|
|
(vector-float*! (-> s3-0 mat fvec) (-> s5-0 lin-velocity) f28-0)
|
|
(vector-! (-> s3-0 mat trans) (the-as vector (-> s5-0 path-sample)) (-> s4-0 position))
|
|
(.lvf vf1 (&-> (-> s3-0 mat trans) quad))
|
|
(.add.w.vf vf2 vf0 vf0 :mask #b1)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.mul.x.vf acc vf2 vf1 :mask #b1)
|
|
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
|
|
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
|
|
(.mov v1-23 vf1)
|
|
(let ((f0-6 v1-23)
|
|
(f1-5 1.0)
|
|
(f2-2 40960.0)
|
|
)
|
|
(set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2))))
|
|
)
|
|
(let ((a1-5 (-> s3-0 mat fvec)))
|
|
(let ((v1-27 (-> s3-0 mat fvec)))
|
|
(let ((a0-6 (-> s3-0 mat trans)))
|
|
(let ((a2-1 1.0))
|
|
(.mov vf7 a2-1)
|
|
)
|
|
(.lvf vf5 (&-> a0-6 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-27 quad))
|
|
)
|
|
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
|
|
(.mul.x.vf acc vf5 vf7 :mask #b111)
|
|
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
|
|
(.svf (&-> a1-5 quad) vf6)
|
|
)
|
|
(vector-! (the-as vector (-> s3-0 mat)) (-> s3-0 mat fvec) (-> s4-0 lin-velocity))
|
|
(vector-float*! (the-as vector (-> s3-0 mat)) (the-as vector (-> s3-0 mat)) 16.0)
|
|
(let* ((v1-31 (-> s3-0 mat))
|
|
(f0-10 (-> s3-0 velocity x))
|
|
(f0-12 (* f0-10 f0-10))
|
|
)
|
|
(.lvf vf1 (&-> v1-31 rvec quad))
|
|
(.add.w.vf vf2 vf0 vf0 :mask #b1)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.mul.x.vf acc vf2 vf1 :mask #b1)
|
|
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
|
|
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
|
|
(.mov v1-32 vf1)
|
|
(if (< f0-12 v1-32)
|
|
(vector-normalize! (the-as vector (-> s3-0 mat)) (-> s3-0 velocity x))
|
|
)
|
|
)
|
|
(let ((a1-10 (-> s4-0 lin-velocity)))
|
|
(let ((v1-36 (-> s4-0 lin-velocity)))
|
|
(let ((a0-11 (-> s3-0 mat)))
|
|
(let ((a2-2 f30-0))
|
|
(.mov vf7 a2-2)
|
|
)
|
|
(.lvf vf5 (&-> a0-11 rvec quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-36 quad))
|
|
)
|
|
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
|
|
(.mul.x.vf acc vf5 vf7 :mask #b111)
|
|
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
|
|
(.svf (&-> a1-10 quad) vf6)
|
|
)
|
|
(let ((a1-11 (-> s4-0 position)))
|
|
(let ((v1-37 (-> s4-0 position)))
|
|
(let ((a0-12 (-> s4-0 lin-velocity)))
|
|
(let ((a2-3 f30-0))
|
|
(.mov vf7 a2-3)
|
|
)
|
|
(.lvf vf5 (&-> a0-12 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-37 quad))
|
|
)
|
|
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
|
|
(.mul.x.vf acc vf5 vf7 :mask #b111)
|
|
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
|
|
(.svf (&-> a1-11 quad) vf6)
|
|
)
|
|
(quaternion-pseudo-seek
|
|
(the-as quaternion (-> s4-0 rot))
|
|
(the-as quaternion (-> s4-0 rot))
|
|
(the-as quaternion (-> s3-0 force))
|
|
(* 10.0 f30-0)
|
|
)
|
|
(vector-float*! (-> s4-0 lin-momentum) (-> s4-0 lin-velocity) (-> this info info mass))
|
|
(vector-reset! (-> s4-0 ang-momentum))
|
|
(rigid-body-control-method-26 s4-0)
|
|
(init-velocities! s4-0)
|
|
(set! (-> this root transv quad) (-> s4-0 lin-velocity quad))
|
|
(quaternion-copy! (-> this root quat) (the-as quaternion (-> s4-0 rot)))
|
|
(rigid-body-control-method-25 s4-0 (-> this root trans))
|
|
(let* ((v1-54 (-> this node-list data 0 bone transform))
|
|
(a3-1 (-> s4-0 matrix))
|
|
(a0-21 (-> a3-1 rvec quad))
|
|
(a1-16 (-> a3-1 uvec quad))
|
|
(a2-5 (-> a3-1 fvec quad))
|
|
(a3-2 (-> a3-1 trans quad))
|
|
)
|
|
(set! (-> v1-54 rvec quad) a0-21)
|
|
(set! (-> v1-54 uvec quad) a1-16)
|
|
(set! (-> v1-54 fvec quad) a2-5)
|
|
(set! (-> v1-54 trans quad) a3-2)
|
|
)
|
|
(set! (-> this node-list data 0 bone transform trans quad) (-> this root trans quad))
|
|
(race-control-method-11 s5-0 (* f30-0 f28-0))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(vehicle-method-77 this)
|
|
(rigid-body-object-method-30 this)
|
|
(update-transforms (-> this root))
|
|
(let ((a1-18 (new 'stack-no-clear 'overlaps-others-params)))
|
|
(set! (-> a1-18 options) (overlaps-others-options))
|
|
(set! (-> a1-18 collide-with-filter) (collide-spec civilian enemy obstacle))
|
|
(set! (-> a1-18 tlist) *touching-list*)
|
|
(find-overlapping-shapes (-> this root) a1-18)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod wvehicle-method-177 ((this wvehicle) (arg0 vehicle-controls))
|
|
(local-vars (v1-90 float))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s4-0 (-> this race))
|
|
(gp-0 (new 'stack-no-clear 'wvehicle-race-stack-var0))
|
|
)
|
|
(mem-set32! (the-as pointer (-> gp-0 vec11)) 6 0)
|
|
(set! (-> gp-0 time) (the-as uint (current-time)))
|
|
(set! (-> gp-0 vec0 quad) (-> this rbody position quad))
|
|
(set! (-> gp-0 vec1 quad) (-> this rbody lin-velocity quad))
|
|
(set! (-> gp-0 float5) 0.0)
|
|
(set! (-> gp-0 vec8 quad) (-> this rbody matrix rvec quad))
|
|
(set! (-> gp-0 vec8 y) 0.0)
|
|
(vector-normalize! (-> gp-0 vec8) 1.0)
|
|
(set! (-> gp-0 vec9 quad) (-> this rbody matrix fvec quad))
|
|
(set! (-> gp-0 vec13 x) (* (-> this rbody ang-velocity y) (vector-length (-> this rbody lin-velocity))))
|
|
(set! (-> gp-0 float1) (seconds-per-frame))
|
|
(set! (-> gp-0 float8) (vector-dot (-> gp-0 vec1) (-> gp-0 vec9)))
|
|
(cond
|
|
((logtest? (vehicle-flag rammed-target) (-> this v-flags))
|
|
(if (or (and (< (the-as uint 600) (- (the-as uint (-> gp-0 time)) (-> this ram-time)))
|
|
(< (the-as uint 150) (- (the-as uint (-> gp-0 time)) (-> this impact-time)))
|
|
)
|
|
(and (logtest? (-> this v-flags) (vehicle-flag impact)) (< (-> this impact-local-pos z) 0.0))
|
|
)
|
|
(set! (-> this v-flags) (the-as vehicle-flag (logclear (-> this v-flags) (vehicle-flag rammed-target))))
|
|
)
|
|
)
|
|
(else
|
|
(when (logtest? (-> this v-flags) (vehicle-flag impact))
|
|
(when (and (< (- (-> gp-0 time) (-> this prev-impact-time)) (the-as uint 30))
|
|
(< 0.0 (-> this impact-local-pos z))
|
|
(< 0.0 (-> gp-0 float8))
|
|
(< (-> gp-0 float8) 40960.0)
|
|
)
|
|
(set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag rammed-target) (-> this v-flags))))
|
|
(set! (-> this ram-time) (-> gp-0 time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(race-control-method-12 s4-0 (-> gp-0 vec0))
|
|
(set! (-> gp-0 vec13 y) (vector-length (-> gp-0 vec1)))
|
|
(set! (-> gp-0 vec13 z) (vector-length (-> s4-0 lin-velocity)))
|
|
(set! (-> gp-0 vec13 w)
|
|
(* (-> gp-0 vec13 z) (fmax (-> s4-0 racer-state speed-factor) (-> this shortcut-speed-factor)))
|
|
)
|
|
(if (logtest? (vehicle-flag in-air turbo-boost) (-> this v-flags))
|
|
(set! (-> gp-0 vec13 w) (* 2.0 (-> gp-0 vec13 w)))
|
|
)
|
|
(let ((f0-18 (* 2.0 (-> this root root-prim local-sphere w))))
|
|
(set! (-> gp-0 float7) (* f0-18 f0-18))
|
|
)
|
|
(let ((s3-0 (-> this race state)))
|
|
(dotimes (s2-0 (-> s3-0 racer-count))
|
|
(let ((v1-60 (handle->process (-> s3-0 racer-array s2-0 racer))))
|
|
(when v1-60
|
|
(when (!= v1-60 this)
|
|
(set! (-> gp-0 vec2 quad) (-> (the-as process-drawable v1-60) root trans quad))
|
|
(set! (-> gp-0 vec3 quad) (-> (the-as process-drawable v1-60) root transv quad))
|
|
(set! (-> gp-0 vec4 quad) (-> (the-as process-drawable v1-60) rbody matrix fvec quad))
|
|
(set! (-> gp-0 float6)
|
|
(nearest-dist2-between-moving-points (-> gp-0 vec0) (-> gp-0 vec1) (-> gp-0 vec2) (-> gp-0 vec3) 0.5)
|
|
)
|
|
(when (< (-> gp-0 float6) (-> gp-0 float7))
|
|
(vector-! (-> gp-0 vec6) (-> gp-0 vec2) (-> gp-0 vec0))
|
|
(when (< 0.0 (vector-dot (-> gp-0 vec1) (-> gp-0 vec6)))
|
|
(set! (-> gp-0 vec13 w)
|
|
(fmin
|
|
(-> gp-0 vec13 w)
|
|
(* 0.95
|
|
(fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec4)))
|
|
(fmax 0.0 (vector-dot (-> gp-0 vec9) (-> gp-0 vec3)))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-76 (-> s4-0 path-sample)))
|
|
(set! (-> gp-0 vec11 x) (* 0.007874016 (the float (-> v1-76 stick-x))))
|
|
(set! (-> gp-0 vec11 w) (* 0.007874016 (the float (-> v1-76 stick-y))))
|
|
(set! (-> gp-0 vec11 y) (* 0.003921569 (the float (-> v1-76 throttle))))
|
|
(set! (-> gp-0 vec11 z) (if (logtest? (-> v1-76 flags) 1)
|
|
1.0
|
|
0.0
|
|
)
|
|
)
|
|
)
|
|
(set! (-> gp-0 float0) 0.0)
|
|
(let ((f0-35 (+ (-> s4-0 path-t) (* 1.875 (/ 1.0 (-> gp-0 vec13 z)) (-> gp-0 vec13 y)))))
|
|
(race-path-method-11 (-> s4-0 path) (-> gp-0 sample) (-> gp-0 vec12) f0-35)
|
|
)
|
|
(vector-! (-> gp-0 vec6) (the-as vector (-> s4-0 path-sample)) (-> gp-0 vec0))
|
|
(let* ((f0-36 (-> gp-0 float5))
|
|
(f1-24 1.0)
|
|
(f2-8 40960.0)
|
|
(f1-25 (/ f1-24 (* f2-8 f2-8)))
|
|
)
|
|
(.lvf vf1 (&-> (-> gp-0 vec6) quad))
|
|
(.add.w.vf vf2 vf0 vf0 :mask #b1)
|
|
(.mul.vf vf1 vf1 vf1)
|
|
(.mul.x.vf acc vf2 vf1 :mask #b1)
|
|
(.add.mul.y.vf acc vf2 vf1 acc :mask #b1)
|
|
(.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1)
|
|
(.mov v1-90 vf1)
|
|
(set! (-> gp-0 float5) (+ f0-36 (* f1-25 v1-90)))
|
|
)
|
|
(let ((f30-0 (-> gp-0 float5))
|
|
(f0-38 1.0)
|
|
(f1-27 40960.0)
|
|
)
|
|
(set! (-> gp-0 float5)
|
|
(+ f30-0 (* (/ f0-38 (* f1-27 f1-27)) (vector-vector-distance-squared (-> s4-0 lin-velocity) (-> gp-0 vec1))))
|
|
)
|
|
)
|
|
(set! (-> this path-deviation) (-> gp-0 float5))
|
|
(let ((a1-20 (-> gp-0 vec5)))
|
|
(let ((v1-94 (-> gp-0 vec12)))
|
|
(let ((a0-54 (-> gp-0 vec6)))
|
|
(let ((a2-4 1.0))
|
|
(.mov vf7 a2-4)
|
|
)
|
|
(.lvf vf5 (&-> a0-54 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-94 quad))
|
|
)
|
|
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
|
|
(.mul.x.vf acc vf5 vf7 :mask #b111)
|
|
(.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111)
|
|
(.svf (&-> a1-20 quad) vf6)
|
|
)
|
|
(vector-! (-> gp-0 vec7) (-> gp-0 vec5) (-> gp-0 vec1))
|
|
(vector-float*! (-> gp-0 vec10) (-> gp-0 vec7) 1.5)
|
|
(set! (-> gp-0 float2) 0.0)
|
|
(dotimes (v1-98 2)
|
|
(let ((a0-60 (-> this wheel (+ v1-98 2))))
|
|
(if (logtest? (-> a0-60 flags) 2)
|
|
(+! (-> gp-0 float2) (-> a0-60 side-vel))
|
|
)
|
|
)
|
|
)
|
|
(let ((f1-36
|
|
(+ (* 0.00036621094 (- (-> gp-0 vec13 w) (-> gp-0 vec13 y)) (-> gp-0 float1))
|
|
(* -0.000024414063 (fabs (-> gp-0 float2)))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this ai-controls throttle) (fmax 0.0 (fmin 1.0 (+ (-> this ai-controls throttle) f1-36))))
|
|
)
|
|
(set! (-> this ai-controls brake)
|
|
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ (- -4096.0 (-> gp-0 vec13 w)) (-> gp-0 vec13 y)))))
|
|
)
|
|
(+! (-> this ai-controls brake) (* (- (-> this ai-controls brake)) (fmin 1.0 (* 8.0 (-> gp-0 float1)))))
|
|
(set! (-> gp-0 float3) (* 0.00001001358 (vector-dot (-> gp-0 vec8) (-> gp-0 vec10))))
|
|
(set! (-> gp-0 float4) (* 0.00001001358 (- (-> gp-0 float2) (fmax -12288.0 (fmin 12288.0 (-> gp-0 float2))))))
|
|
(set! (-> this ai-controls steering) (fmax -1.0 (fmin 1.0 (+ (-> gp-0 float3) (-> gp-0 float4)))))
|
|
(set! (-> gp-0 vec11 x) (-> this ai-controls steering))
|
|
(set! (-> gp-0 vec11 y) (-> this ai-controls throttle))
|
|
(set! (-> gp-0 vec11 z) (-> this ai-controls brake))
|
|
(when (logtest? (vehicle-flag rammed-target) (-> this v-flags))
|
|
(set! (-> gp-0 vec11 y) 0.0)
|
|
(set! (-> gp-0 vec11 z) 1.0)
|
|
(set! (-> gp-0 vec11 x) (* -1.0 (-> gp-0 vec11 x)))
|
|
)
|
|
(if (logtest? (-> s4-0 path-sample flags) 2)
|
|
(logior! (-> gp-0 byte0) 1)
|
|
)
|
|
(vehicle-method-92 this (the-as vehicle-controls (-> gp-0 vec11)))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod wvehicle-method-183 ((this wvehicle) (arg0 vehicle-controls))
|
|
(wvehicle-method-177 this arg0)
|
|
(vehicle-method-117 this)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod wvehicle-method-184 ((this wvehicle))
|
|
(cond
|
|
((logtest? (-> this rbody flags) (rigid-body-flag enable-physics))
|
|
(if (and (logtest? (-> this v-flags) (vehicle-flag on-ground))
|
|
(not (logtest? (vehicle-flag turbo-boost) (-> this v-flags)))
|
|
(let ((f0-0 368640.0))
|
|
(or (< (* f0-0 f0-0) (-> this player-dist2))
|
|
(let ((f0-3 102400.0))
|
|
(and (< (* f0-3 f0-3) (-> this player-dist2))
|
|
(not (logtest? (-> this draw status) (draw-control-status on-screen)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(disable-physics! this)
|
|
)
|
|
)
|
|
(else
|
|
(let ((f0-6 (-> this player-dist2))
|
|
(f1-2 348160.0)
|
|
)
|
|
(if (and (< f0-6 (* f1-2 f1-2)) (let ((f0-7 (-> this player-dist2))
|
|
(f1-5 81920.0)
|
|
)
|
|
(or (< f0-7 (* f1-5 f1-5))
|
|
(logtest? (-> this draw status) (draw-control-status on-screen))
|
|
(logtest? (vehicle-flag turbo-boost) (-> this v-flags))
|
|
)
|
|
)
|
|
)
|
|
(apply-momentum! this)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod wvehicle-method-182 ((this wvehicle))
|
|
(let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 1)))
|
|
(set! (-> s5-0 0 quad) (-> this rbody position quad))
|
|
(set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 0) (camera-pos)))
|
|
(let ((s4-1 vector-vector-distance-squared)
|
|
(s5-1 (-> s5-0 0))
|
|
(a1-1 (target-pos 0))
|
|
)
|
|
(set! (-> this player-dist2) (s4-1 s5-1 a1-1))
|
|
(if (>= (the-as uint (- (current-time) (the-as int (-> this shortcut-time)))) (the-as uint 1500))
|
|
(set! (-> this shortcut-speed-factor) 0.0)
|
|
)
|
|
(wvehicle-method-184 this)
|
|
(if (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))
|
|
(wvehicle-method-183 this (the-as vehicle-controls a1-1))
|
|
(wvehicle-method-181 this)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod wvehicle-method-185 ((this wvehicle))
|
|
(let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 1)))
|
|
(set! (-> s5-0 0 quad) (-> this rbody position quad))
|
|
(set! (-> this camera-dist2) (vector-vector-distance-squared (-> s5-0 0) (camera-pos)))
|
|
(let ((s4-1 vector-vector-distance-squared)
|
|
(s5-1 (-> s5-0 0))
|
|
(a1-1 (target-pos 0))
|
|
)
|
|
(set! (-> this player-dist2) (s4-1 s5-1 a1-1))
|
|
(set! (-> this shortcut-speed-factor) 0.0)
|
|
(wvehicle-method-184 this)
|
|
(if (and (logtest? (vehicle-flag player-driving) (-> this v-flags))
|
|
(not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics)))
|
|
)
|
|
(apply-momentum! this)
|
|
)
|
|
(if (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))
|
|
(wvehicle-method-183 this (the-as vehicle-controls a1-1))
|
|
(wvehicle-method-181 this)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod race-setup ((this wvehicle) (arg0 int))
|
|
(let* ((a1-1 *race-state*)
|
|
(a2-0 (-> a1-1 racer-array arg0))
|
|
)
|
|
(race-control-method-10 (-> this race) a1-1 a2-0)
|
|
)
|
|
(set! (-> this shortcut-speed-factor) 0.0)
|
|
(let ((s4-0 #t))
|
|
(cond
|
|
((-> this race mesh)
|
|
(race-control-method-9 (-> this race) arg0 (-> this root trans))
|
|
(when (not (-> this race path))
|
|
(format 0 "ERROR: wvehicle::race-setup: no race-path found~%")
|
|
(set! s4-0 #f)
|
|
)
|
|
s4-0
|
|
)
|
|
(else
|
|
(format 0 "ERROR: wvehicle::race-setup: no race-mesh found~%")
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
)
|