mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
910 lines
38 KiB
Common Lisp
910 lines
38 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: ropebridge.gc
|
|
;; name in dgo: ropebridge
|
|
;; dgos: GAME, COMMON, L1
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype ropebridge-tuning (structure)
|
|
((num-springs int32 :offset-assert 0)
|
|
(num-spring-points int32 :offset-assert 4)
|
|
(col-mesh-indexes (pointer uint8) :offset-assert 8)
|
|
(view-frustum-radius float :offset-assert 12)
|
|
(root-prim-radius float :offset-assert 16)
|
|
(desired-spring-len float :offset-assert 20)
|
|
(gravity float :offset-assert 24)
|
|
(spring-coefficient float :offset-assert 28)
|
|
(spring-mass float :offset-assert 32)
|
|
(friction float :offset-assert 36)
|
|
(max-influence-dist float :offset-assert 40)
|
|
(rider-max-gravity float :offset-assert 44)
|
|
(max-bonk-influence-dist float :offset-assert 48)
|
|
(rider-bonk-force float :offset-assert 52)
|
|
(rider-bonk-min float :offset-assert 56)
|
|
(rider-bonk-max float :offset-assert 60)
|
|
(normal-board-len float :offset-assert 64)
|
|
(bridge-end-to-end-len float :offset-assert 68)
|
|
(rest-state symbol :offset-assert 72)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x4c
|
|
:flag-assert #x90000004c
|
|
)
|
|
|
|
|
|
(define *ropebridge-70-rest-state* (new 'static 'inline-array vector 35
|
|
(new 'static 'vector :x -2361.8552 :y 8191.9688 :z -1.9208 :w -0.1275)
|
|
(new 'static 'vector :x -4584.7974 :y 16383.936 :z -3.5561 :w -0.0995)
|
|
(new 'static 'vector :x -6668.8125 :y 24575.91 :z -5.0685 :w 0.035)
|
|
(new 'static 'vector :x -8613.924 :y 32767.895 :z -6.1218 :w 0.1992)
|
|
(new 'static 'vector :x -10420.142 :y 40959.875 :z -6.9367 :w 0.0449)
|
|
(new 'static 'vector :x -12087.479 :y 49151.86 :z -8.0159 :w -0.1151)
|
|
(new 'static 'vector :x -13615.937 :y 57343.848 :z -9.2313 :w 0.1964)
|
|
(new 'static 'vector :x -15005.52 :y 65535.84 :z -9.975 :w 0.1667)
|
|
(new 'static 'vector :x -16256.195 :y 73727.84 :z -10.6569 :w -0.1727)
|
|
(new 'static 'vector :x -17367.94 :y 81919.84 :z -11.9885 :w 0.271)
|
|
(new 'static 'vector :x -18340.738 :y 90111.85 :z -13.5812 :w -0.1759)
|
|
(new 'static 'vector :x -19174.588 :y 98303.85 :z -15.0931 :w 0.363)
|
|
(new 'static 'vector :x -19869.475 :y 106495.86 :z -16.4569 :w 0.1326)
|
|
(new 'static 'vector :x -20425.404 :y 114687.86 :z -17.9534 :w 0.2799)
|
|
(new 'static 'vector :x -20842.35 :y 122879.875 :z -18.7552 :w 0.3967)
|
|
(new 'static 'vector :x -21120.309 :y 131071.88 :z -19.6815 :w -0.4682)
|
|
(new 'static 'vector :x -21259.275 :y 139263.89 :z -20.0082 :w -0.3457)
|
|
(new 'static 'vector :x -21259.275 :y 147455.9 :z -19.9398 :w -0.0757)
|
|
(new 'static 'vector :x -21120.31 :y 155647.92 :z -19.5994 :w 0.9825)
|
|
(new 'static 'vector :x -20842.354 :y 163839.92 :z -18.8809 :w 0.0018)
|
|
(new 'static 'vector :x -20425.402 :y 172031.94 :z -17.8884 :w 0.1869)
|
|
(new 'static 'vector :x -19869.475 :y 180223.95 :z -16.6081 :w 0.6356)
|
|
(new 'static 'vector :x -19174.584 :y 188415.97 :z -15.0626 :w 0.5303)
|
|
(new 'static 'vector :x -18340.738 :y 196607.98 :z -13.5152 :w 0.1638)
|
|
(new 'static 'vector :x -17367.94 :y 204799.98 :z -11.9936 :w 0.0825)
|
|
(new 'static 'vector :x -16256.193 :y 212991.98 :z -10.6949 :w 0.3726)
|
|
(new 'static 'vector :x -15005.518 :y 221183.95 :z -9.9551 :w 0.0157)
|
|
(new 'static 'vector :x -13615.937 :y 229375.98 :z -9.2192 :w 0.5676)
|
|
(new 'static 'vector :x -12087.478 :y 237568.0 :z -7.9867 :w 0.9663)
|
|
(new 'static 'vector :x -10420.145 :y 245760.0 :z -6.9835 :w -0.4067)
|
|
(new 'static 'vector :x -8613.921 :y 253952.0 :z -6.0589 :w 0.2085)
|
|
(new 'static 'vector :x -6668.8105 :y 262144.0 :z -5.0582 :w 0.8373)
|
|
(new 'static 'vector :x -4584.7974 :y 270336.0 :z -3.5881 :w 1.1422)
|
|
(new 'static 'vector :x -2361.8545 :y 278528.0 :z -1.8908 :w 1.4099)
|
|
(new 'static 'vector :y 286720.0)
|
|
)
|
|
)
|
|
|
|
(define *ropebridge-52-rest-state* (new 'static 'inline-array vector 26
|
|
(new 'static 'vector :x -1737.1892 :y 8191.979 :z 12.1884 :w 0.1708)
|
|
(new 'static 'vector :x -3335.4602 :y 16383.967 :z 25.0793 :w 0.0007)
|
|
(new 'static 'vector :x -4794.766 :y 24575.955 :z 37.6373 :w -0.0002)
|
|
(new 'static 'vector :x -6115.041 :y 32767.947 :z 50.0327 :w 0.0733)
|
|
(new 'static 'vector :x -7296.247 :y 40959.934 :z 59.5924 :w -0.033)
|
|
(new 'static 'vector :x -8338.399 :y 49151.93 :z 64.8644 :w -0.0244)
|
|
(new 'static 'vector :x -9241.526 :y 57343.938 :z 70.8964 :w 0.072)
|
|
(new 'static 'vector :x -10005.708 :y 65535.938 :z 76.9547 :w 0.0023)
|
|
(new 'static 'vector :x -10630.993 :y 73727.945 :z 79.8365 :w 0.2395)
|
|
(new 'static 'vector :x -11117.421 :y 81919.95 :z 79.5707 :w 0.0572)
|
|
(new 'static 'vector :x -11464.953 :y 90111.96 :z 78.7975 :w -0.0422)
|
|
(new 'static 'vector :x -11673.532 :y 98303.96 :z 77.7957 :w 0.019)
|
|
(new 'static 'vector :x -11743.086 :y 106495.95 :z 77.2108 :w -0.3523)
|
|
(new 'static 'vector :x -11673.532 :y 114687.96 :z 77.7399 :w 0.197)
|
|
(new 'static 'vector :x -11464.951 :y 122879.97 :z 78.838 :w 0.0763)
|
|
(new 'static 'vector :x -11117.423 :y 131071.98 :z 79.5788 :w 0.423)
|
|
(new 'static 'vector :x -10630.993 :y 139263.98 :z 79.8296 :w -0.2595)
|
|
(new 'static 'vector :x -10005.708 :y 147455.98 :z 76.9285 :w 0.7404)
|
|
(new 'static 'vector :x -9241.526 :y 155647.98 :z 70.8901 :w 0.2474)
|
|
(new 'static 'vector :x -8338.398 :y 163840.0 :z 64.9246 :w -0.0395)
|
|
(new 'static 'vector :x -7296.2456 :y 172032.0 :z 59.556 :w 0.5165)
|
|
(new 'static 'vector :x -6115.0415 :y 180224.0 :z 50.0342 :w 0.8282)
|
|
(new 'static 'vector :x -4794.7666 :y 188416.0 :z 37.644 :w 0.0407)
|
|
(new 'static 'vector :x -3335.4592 :y 196608.0 :z 25.1033 :w -0.258)
|
|
(new 'static 'vector :x -1737.1888 :y 204800.02 :z 12.1495 :w 1.1935)
|
|
(new 'static 'vector :y 212992.0)
|
|
)
|
|
)
|
|
|
|
(define *ropebridge-32-rest-state* (new 'static 'inline-array vector 16
|
|
(new 'static 'vector :x -1041.5476 :y 8191.998 :z -4.4282 :w -0.0321)
|
|
(new 'static 'vector :x -1944.2802 :y 16383.992 :z -8.0124 :w 0.0452)
|
|
(new 'static 'vector :x -2708.21 :y 24576.0 :z -11.5897 :w 0.311)
|
|
(new 'static 'vector :x -3333.2952 :y 32767.992 :z -15.9391 :w -0.1053)
|
|
(new 'static 'vector :x -3819.4963 :y 40959.984 :z -19.7012 :w -0.1924)
|
|
(new 'static 'vector :x -4166.8076 :y 49152.0 :z -22.6499 :w 0.3457)
|
|
(new 'static 'vector :x -4375.184 :y 57343.996 :z -24.2658 :w 0.0078)
|
|
(new 'static 'vector :x -4444.632 :y 65536.0 :z -24.3671 :w -0.1826)
|
|
(new 'static 'vector :x -4375.184 :y 73728.0 :z -24.2597 :w -0.0109)
|
|
(new 'static 'vector :x -4166.8076 :y 81920.0 :z -22.6363 :w 0.4393)
|
|
(new 'static 'vector :x -3819.4968 :y 90112.0 :z -19.7122 :w 0.0509)
|
|
(new 'static 'vector :x -3333.2952 :y 98304.01 :z -15.9279 :w 0.091)
|
|
(new 'static 'vector :x -2708.21 :y 106496.01 :z -11.5961 :w -0.3329)
|
|
(new 'static 'vector :x -1944.28 :y 114688.01 :z -8.0186 :w 0.2261)
|
|
(new 'static 'vector :x -1041.5474 :y 122880.016 :z -4.4277 :w 0.1558)
|
|
(new 'static 'vector :y 131072.0)
|
|
)
|
|
)
|
|
|
|
(define *ropebridge-36-rest-state* (new 'static 'inline-array vector 18
|
|
(new 'static 'vector :x -1180.706 :y 8191.9907 :z -0.027 :w -0.0559)
|
|
(new 'static 'vector :x -2222.5103 :y 16383.984 :z -0.0441 :w -0.0457)
|
|
(new 'static 'vector :x -3125.4124 :y 24575.979 :z -0.047 :w -0.004)
|
|
(new 'static 'vector :x -3889.4092 :y 32767.977 :z -0.0962 :w 0.1168)
|
|
(new 'static 'vector :x -4514.496 :y 40959.977 :z -0.1679 :w 0.2095)
|
|
(new 'static 'vector :x -5000.6753 :y 49151.977 :z -0.3088 :w 0.0938)
|
|
(new 'static 'vector :x -5347.9487 :y 57343.98 :z -0.5083 :w -0.0745)
|
|
(new 'static 'vector :x -5556.315 :y 65535.98 :z -0.6251 :w 0.2297)
|
|
(new 'static 'vector :x -5625.7715 :y 73727.984 :z -0.6877 :w -0.1315)
|
|
(new 'static 'vector :x -5556.3154 :y 81919.99 :z -0.6232 :w 0.4198)
|
|
(new 'static 'vector :x -5347.948 :y 90111.99 :z -0.5092 :w -0.0617)
|
|
(new 'static 'vector :x -5000.675 :y 98303.99 :z -0.2973 :w 0.1242)
|
|
(new 'static 'vector :x -4514.4956 :y 106496.0 :z -0.1663 :w 0.1304)
|
|
(new 'static 'vector :x -3889.4084 :y 114688.0 :z -0.0908 :w 0.3045)
|
|
(new 'static 'vector :x -3125.4133 :y 122880.0 :z -0.0447 :w 0.0666)
|
|
(new 'static 'vector :x -2222.5103 :y 131072.0 :z -0.0628 :w 0.4962)
|
|
(new 'static 'vector :x -1180.706 :y 139264.0 :z -0.0328 :w 0.6014)
|
|
(new 'static 'vector :y 147456.0)
|
|
)
|
|
)
|
|
|
|
(define
|
|
*ropebridge-tunings*
|
|
(new 'static 'inline-array ropebridge-tuning 6
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 16
|
|
:num-spring-points 17
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 16 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3)
|
|
:view-frustum-radius 81920.0
|
|
:root-prim-radius 81920.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 131072.0
|
|
:rest-state '*ropebridge-32-rest-state*
|
|
)
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 18
|
|
:num-spring-points 19
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 32
|
|
#x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3 #x3
|
|
#x3 #x3 #x3 #x3 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0
|
|
#x0 #x0 #x0 #x0
|
|
)
|
|
:view-frustum-radius 98304.0
|
|
:root-prim-radius 98304.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 147456.0
|
|
:rest-state '*ropebridge-36-rest-state*
|
|
)
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 26
|
|
:num-spring-points 27
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 32
|
|
#x3 #x3 #x3 #x3 #x3 #x1 #x4 #x4 #x2 #x3 #x3 #x3 #x3
|
|
#x3 #x3 #x3 #x3 #x3 #x1 #x4 #x4 #x4 #x2 #x3 #x3 #x3
|
|
#x0 #x0 #x0 #x0 #x0 #x0
|
|
)
|
|
:view-frustum-radius 122880.0
|
|
:root-prim-radius 122880.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 212992.0
|
|
:rest-state '*ropebridge-52-rest-state*
|
|
)
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 35
|
|
:num-spring-points 36
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 48
|
|
#x3 #x3 #x3 #x3 #x3 #x1 #x4 #x4 #x2 #x7 #x4 #x4 #x2 #x3 #x3
|
|
#x1 #x4 #x4 #x4 #x2 #x3 #x3 #x3 #x6 #x4 #x4 #x5 #x3 #x3 #x3
|
|
#x3 #x3 #x3 #x3 #x3 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0
|
|
#x0 #x0 #x0
|
|
)
|
|
:view-frustum-radius 163840.0
|
|
:root-prim-radius 163840.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 286720.0
|
|
:rest-state '*ropebridge-70-rest-state*
|
|
)
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 18
|
|
:num-spring-points 19
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 32
|
|
#x3 #x3 #x3 #x3 #x1 #x4 #x4 #x4 #x6 #x3 #x5 #x4 #x4 #x4
|
|
#x2 #x3 #x3 #x3 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0
|
|
#x0 #x0 #x0 #x0
|
|
)
|
|
:view-frustum-radius 98304.0
|
|
:root-prim-radius 98304.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 147456.0
|
|
:rest-state '*ropebridge-36-rest-state*
|
|
)
|
|
(new 'static 'ropebridge-tuning
|
|
:num-springs 18
|
|
:num-spring-points 19
|
|
:col-mesh-indexes
|
|
(new 'static 'array uint8 32
|
|
#x3 #x3 #x3 #x3 #x1 #x4 #x4 #x2 #x1 #x4 #x4 #x2 #x3 #x1 #x4
|
|
#x4 #x2 #x3 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0
|
|
#x0 #x0
|
|
)
|
|
:view-frustum-radius 98304.0
|
|
:root-prim-radius 98304.0
|
|
:desired-spring-len 4096.0
|
|
:gravity -22.755556
|
|
:spring-coefficient 0.16384
|
|
:spring-mass 0.018
|
|
:friction 0.97
|
|
:max-influence-dist 49152.0
|
|
:rider-max-gravity -56.88889
|
|
:max-bonk-influence-dist 49152.0
|
|
:rider-bonk-force 49152.0
|
|
:rider-bonk-min 8192.0
|
|
:rider-bonk-max 77824.0
|
|
:normal-board-len 8192.0
|
|
:bridge-end-to-end-len 147456.0
|
|
:rest-state '*ropebridge-36-rest-state*
|
|
)
|
|
)
|
|
)
|
|
|
|
(deftype ropebridge-spring-point (structure)
|
|
((local-pos vector :inline :offset-assert 0)
|
|
(vel vector :inline :offset-assert 16)
|
|
(extra-force vector :inline :offset-assert 32)
|
|
)
|
|
:pack-me
|
|
:method-count-assert 9
|
|
:size-assert #x30
|
|
:flag-assert #x900000030
|
|
)
|
|
|
|
|
|
(deftype ropebridge (process-drawable)
|
|
((root-override collide-shape :offset 112)
|
|
(subtype uint64 :offset-assert 176)
|
|
(subtype-name string :offset-assert 184)
|
|
(agitated-time-stamp time-frame :offset-assert 192)
|
|
(bonk-time-stamp time-frame :offset-assert 200)
|
|
(attack-flop-time-stamp time-frame :offset-assert 208)
|
|
(player-attack-id uint64 :offset-assert 216)
|
|
(sleep-dist float :offset-assert 224)
|
|
(do-physics? basic :offset-assert 228)
|
|
(tuning ropebridge-tuning :offset-assert 232)
|
|
(world-matrix matrix :inline :offset-assert 240)
|
|
(inv-world-matrix matrix :inline :offset-assert 304)
|
|
(extra-trans vector :inline :offset-assert 368)
|
|
(spring-point ropebridge-spring-point 36 :inline :offset-assert 384)
|
|
)
|
|
:heap-base #x7d0
|
|
:method-count-assert 29
|
|
:size-assert #x840
|
|
:flag-assert #x1d07d00840
|
|
(:methods
|
|
(set-vel-from-impact (_type_ uint vector int float) none 20)
|
|
(set-vel-from-riders (_type_) none 21)
|
|
(set-vel-from-rider (_type_ uint vector int) none 22)
|
|
(clear-spring-forces (_type_) none 23)
|
|
(debug-draw (_type_) none 24)
|
|
(set-to-rest-state (_type_) none 25)
|
|
(add-collision-meshes (_type_) none 26)
|
|
(do-integration (_type_) none 27)
|
|
(dummy-28 (_type_) none 28)
|
|
)
|
|
(:states
|
|
ropebridge-idle
|
|
)
|
|
)
|
|
|
|
|
|
(defskelgroup *ropebridge-32-sg* ropebridge-32
|
|
0
|
|
3
|
|
((1 (meters 20)) (2 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 4)
|
|
)
|
|
|
|
(defskelgroup *snow-bridge-36-sg* snow-bridge-36
|
|
0
|
|
3
|
|
((1 (meters 20)) (2 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 3.8)
|
|
)
|
|
|
|
(defskelgroup *ropebridge-52-sg* ropebridge-52
|
|
0
|
|
3
|
|
((1 (meters 20)) (2 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 3.6)
|
|
)
|
|
|
|
(defskelgroup *ropebridge-70-sg* ropebridge-70
|
|
0
|
|
3
|
|
((1 (meters 20)) (2 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 3.6)
|
|
)
|
|
|
|
(defskelgroup *ropebridge-36-sg* ropebridge-36
|
|
0
|
|
3
|
|
((1 (meters 20)) (2 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 4)
|
|
)
|
|
|
|
(defskelgroup *vil3-bridge-36-sg* vil3-bridge-36
|
|
0
|
|
2
|
|
((1 (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
:longest-edge (meters 3.6)
|
|
)
|
|
|
|
(defstate ropebridge-idle (ropebridge)
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(let ((f0-0 -1.0))
|
|
(cond
|
|
((= arg2 'bonk)
|
|
(when (>= (- (-> *display* base-frame-counter) (-> self bonk-time-stamp)) (seconds 0.2))
|
|
(set! (-> self bonk-time-stamp) (-> *display* base-frame-counter))
|
|
(set! f0-0 (the-as float (-> arg3 param 1)))
|
|
(if (>= f0-0 (-> self tuning rider-bonk-max))
|
|
(set! f0-0 (-> self tuning rider-bonk-max))
|
|
)
|
|
)
|
|
)
|
|
((and (= arg2 'attack) (= (-> arg3 param 1) 'flop))
|
|
(let ((v1-17 (-> arg3 param 2)))
|
|
(when (!= v1-17 (-> self player-attack-id))
|
|
(set! (-> self player-attack-id) v1-17)
|
|
(set! (-> self attack-flop-time-stamp) (-> *display* base-frame-counter))
|
|
(set! f0-0 (* 1.1 (-> self tuning rider-bonk-max)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(the-as
|
|
object
|
|
(when (and (>= f0-0 (-> self tuning rider-bonk-min)) (-> arg3 param 0))
|
|
(set! (-> self agitated-time-stamp) (-> *display* base-frame-counter))
|
|
(let* ((f30-0 (/ (* (- f0-0 (-> self tuning rider-bonk-min)) (-> self tuning rider-bonk-force))
|
|
(- (-> self tuning rider-bonk-max) (-> self tuning rider-bonk-min))
|
|
)
|
|
)
|
|
(gp-0 (the-as object (-> arg3 param 0)))
|
|
(a0-7 (-> (the-as touching-shapes-entry gp-0) head))
|
|
(s4-0 (-> self root-override))
|
|
(s5-0 (get-touched-prim a0-7 s4-0 (the-as touching-shapes-entry gp-0)))
|
|
(v1-33 ((method-of-type touching-shapes-entry get-touched-shape) (the-as touching-shapes-entry gp-0) s4-0))
|
|
(gp-1 (new 'stack-no-clear 'vector))
|
|
)
|
|
(vector-matrix*! gp-1 (-> v1-33 trans) (-> self inv-world-matrix))
|
|
(let ((s5-1 (-> s5-0 prim-id)))
|
|
(let ((v1-37 (-> self spring-point s5-1)))
|
|
(new 'stack-no-clear 'vector)
|
|
(&+ v1-37 48)
|
|
)
|
|
(set-vel-from-impact self s5-1 gp-1 -1 f30-0)
|
|
(set-vel-from-impact self (+ s5-1 1) gp-1 1 f30-0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:code
|
|
(behavior ()
|
|
(while #t
|
|
(suspend)
|
|
(detect-riders! (-> self root-override))
|
|
(when (-> self do-physics?)
|
|
(clear-spring-forces self)
|
|
(set-vel-from-riders self)
|
|
(do-integration self)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:post
|
|
(behavior ()
|
|
(ja-post)
|
|
(let ((gp-0 (-> self root-override)))
|
|
(update-transforms! gp-0)
|
|
(when (-> self do-physics?)
|
|
(pull-riders! gp-0)
|
|
(do-push-aways! gp-0)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod set-vel-from-impact ropebridge ((obj ropebridge) (arg0 uint) (arg1 vector) (arg2 int) (arg3 float))
|
|
(while #t
|
|
(let ((f0-2 (fabs (- (-> arg1 z) (-> obj spring-point (the-as int arg0) local-pos z)))))
|
|
(if (< (-> obj tuning max-bonk-influence-dist) f0-2)
|
|
(return #f)
|
|
)
|
|
(let* ((f0-4 (/ (* 8.0 f0-2) (-> obj tuning max-bonk-influence-dist)))
|
|
(f0-5 (+ 1.0 f0-4))
|
|
(f0-6 (/ 1.0 f0-5))
|
|
)
|
|
(set! (-> obj spring-point (the-as int arg0) vel y)
|
|
(- (-> obj spring-point (the-as int arg0) vel y) (* f0-6 arg3))
|
|
)
|
|
)
|
|
)
|
|
(set! arg0 (+ arg0 arg2))
|
|
(if (or (< (the-as int arg0) 0) (>= (the-as int arg0) (-> obj tuning num-spring-points)))
|
|
(return #f)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod clear-spring-forces ropebridge ((obj ropebridge))
|
|
(let ((v1-0 (the-as ropebridge-spring-point (-> obj spring-point))))
|
|
(countdown (a0-2 (-> obj tuning num-spring-points))
|
|
(set! (-> v1-0 extra-force quad) (the-as uint128 0))
|
|
(nop!)
|
|
(nop!)
|
|
(&+! v1-0 48)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod set-vel-from-riders ropebridge ((obj ropebridge))
|
|
(let ((v1-1 (-> obj root-override riders)))
|
|
(when v1-1
|
|
(let ((s5-0 (the-as collide-sticky-rider (-> v1-1 rider))))
|
|
(countdown (s4-0 (-> v1-1 num-riders))
|
|
(let ((v1-3 (handle->process (-> s5-0 rider-handle))))
|
|
(when v1-3
|
|
(let ((v1-5 (-> (the-as process-drawable v1-3) root))
|
|
(s2-0 (-> s5-0 sticky-prim))
|
|
)
|
|
(when s2-0
|
|
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
|
(vector-matrix*! s3-0 (-> v1-5 trans) (-> obj inv-world-matrix))
|
|
(let ((s2-1 (-> s2-0 prim-id)))
|
|
(set-vel-from-rider obj s2-1 s3-0 -1)
|
|
(set-vel-from-rider obj (+ s2-1 1) s3-0 1)
|
|
)
|
|
)
|
|
(set! (-> obj agitated-time-stamp) (-> *display* base-frame-counter))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(&+! s5-0 32)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod set-vel-from-rider ropebridge ((obj ropebridge) (arg0 uint) (arg1 vector) (arg2 int))
|
|
(while #t
|
|
(let ((f0-0 (vector-vector-distance arg1 (the-as vector (-> obj spring-point (the-as int arg0))))))
|
|
(if (< (-> obj tuning max-influence-dist) f0-0)
|
|
(return #f)
|
|
)
|
|
(let* ((f0-2 (/ (* 8.0 f0-0) (-> obj tuning max-influence-dist)))
|
|
(f0-3 (+ 1.0 f0-2))
|
|
(f0-4 (/ 1.0 f0-3))
|
|
)
|
|
(+! (-> obj spring-point (the-as int arg0) extra-force y) (* f0-4 (-> obj tuning rider-max-gravity)))
|
|
)
|
|
)
|
|
(+! arg0 arg2)
|
|
(if (or (< (the-as int arg0) 0) (>= (the-as int arg0) (-> obj tuning num-spring-points)))
|
|
(return #f)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod do-integration ropebridge ((obj ropebridge))
|
|
(local-vars (a2-1 float) (a3-0 float))
|
|
(rlet ((Q :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf10 :class vf)
|
|
(vf11 :class vf)
|
|
(vf12 :class vf)
|
|
(vf13 :class vf)
|
|
(vf14 :class vf)
|
|
(vf15 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
(vf8 :class vf)
|
|
(vf9 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((v1-1 (-> obj tuning gravity)))
|
|
(.mov vf9 v1-1)
|
|
)
|
|
(.add.x.vf vf9 vf0 vf9 :mask #b10)
|
|
(.mov.vf vf9 vf0 :mask #b1101)
|
|
0
|
|
(let ((v1-4 (-> obj tuning friction)))
|
|
(.mov vf12 v1-4)
|
|
)
|
|
(.add.x.vf vf12 vf0 vf12 :mask #b10)
|
|
(.add.x.vf vf12 vf0 vf12 :mask #b100)
|
|
0
|
|
(let ((v1-7 (/ 1.0 (-> obj tuning spring-mass))))
|
|
(.mov vf14 v1-7)
|
|
)
|
|
(.add.x.vf vf14 vf0 vf14 :mask #b10)
|
|
(.add.x.vf vf14 vf0 vf14 :mask #b100)
|
|
0
|
|
(let ((v1-11 (+ (-> obj tuning num-spring-points) -2)))
|
|
(let* ((a2-0 (-> obj spring-point))
|
|
(a1-1 (-> a2-0 1))
|
|
)
|
|
(.lvf vf2 (&-> a2-0 0 local-pos quad))
|
|
(label cfg-1)
|
|
(.lvf vf1 (&-> a1-1 extra-force quad))
|
|
(.lvf vf3 (&-> a1-1 local-pos quad))
|
|
(.add.vf vf1 vf1 vf9 :mask #b111)
|
|
(.sub.vf vf5 vf2 vf3)
|
|
(.mul.vf vf7 vf5 vf5 :mask #b111)
|
|
(.add.y.vf vf7 vf7 vf7 :mask #b1)
|
|
(.add.z.vf vf7 vf7 vf7 :mask #b1)
|
|
(.mov a2-1 vf7)
|
|
(let ((f0-5 (- a2-1 (-> obj tuning desired-spring-len))))
|
|
(when (< 0.0 f0-5)
|
|
(.div.vf Q vf0 vf7 :fsf #b11 :ftf #b0)
|
|
(.wait.vf)
|
|
(.mul.vf vf5 vf5 Q)
|
|
(let ((a2-5 (* f0-5 (-> obj tuning spring-coefficient))))
|
|
(.mov vf10 a2-5)
|
|
)
|
|
(.mul.x.vf vf10 vf5 vf10 :mask #b111)
|
|
(.add.vf vf1 vf1 vf10 :mask #b111)
|
|
0
|
|
)
|
|
)
|
|
(let ((a2-8 (&+ a1-1 48)))
|
|
(.lvf vf4 (&-> a2-8 local-pos quad))
|
|
(.sub.vf vf6 vf4 vf3)
|
|
(.mul.vf vf8 vf6 vf6 :mask #b111)
|
|
(.add.y.vf vf8 vf8 vf8 :mask #b1)
|
|
(.add.z.vf vf8 vf8 vf8 :mask #b1)
|
|
(.mov a3-0 vf8)
|
|
(let ((f0-8 (- a3-0 (-> obj tuning desired-spring-len))))
|
|
(when (< 0.0 f0-8)
|
|
(.div.vf Q vf0 vf8 :fsf #b11 :ftf #b0)
|
|
(.wait.vf)
|
|
(.mul.vf vf6 vf6 Q)
|
|
(let ((a3-4 (* f0-8 (-> obj tuning spring-coefficient))))
|
|
(.mov vf10 a3-4)
|
|
)
|
|
(.mul.x.vf vf10 vf6 vf10 :mask #b111)
|
|
(.add.vf vf1 vf1 vf10 :mask #b111)
|
|
0
|
|
)
|
|
)
|
|
(.mul.vf vf15 vf1 vf14 :mask #b111)
|
|
(.lvf vf11 (&-> a1-1 vel quad))
|
|
(.add.vf vf11 vf11 vf15 :mask #b111)
|
|
(.mul.vf vf11 vf11 vf12 :mask #b111)
|
|
(.svf (&-> a1-1 vel quad) vf11)
|
|
(set! a1-1 a2-8)
|
|
)
|
|
)
|
|
(.mov.vf vf2 vf3)
|
|
(.mov.vf vf3 vf4)
|
|
(+! v1-11 -1)
|
|
(b! (> v1-11 0) cfg-1 :delay (nop!))
|
|
)
|
|
(let ((v1-13 (-> *display* seconds-per-frame)))
|
|
(.mov vf13 v1-13)
|
|
)
|
|
(.add.x.vf vf13 vf0 vf13 :mask #b10)
|
|
(.add.x.vf vf13 vf0 vf13 :mask #b100)
|
|
0
|
|
(let ((v1-17 (+ (-> obj tuning num-spring-points) -2)))
|
|
(let ((a0-1 (the-as object (&-> obj stack 320))))
|
|
(label cfg-7)
|
|
(.lvf vf11 (&-> (the-as (inline-array vector) a0-1) 1 quad))
|
|
(.lvf vf3 (&-> (the-as (inline-array vector) a0-1) 0 quad))
|
|
(.mul.vf vf11 vf11 vf13 :mask #b111)
|
|
(.add.vf vf3 vf3 vf11 :mask #b111)
|
|
(.svf (&-> (the-as (inline-array vector) a0-1) 0 quad) vf3)
|
|
(set! a0-1 (-> (the-as (inline-array vector) a0-1) 3))
|
|
)
|
|
(+! v1-17 -1)
|
|
(b! (> v1-17 0) cfg-7 :delay (nop!))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod debug-draw ropebridge ((obj ropebridge))
|
|
(let ((gp-0 (-> obj node-list data 0 bone transform))
|
|
(s5-0 (the-as ropebridge-spring-point (-> obj spring-point)))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(countdown (s3-0 (-> obj tuning num-spring-points))
|
|
(vector-matrix*! s4-0 (-> s5-0 local-pos) gp-0)
|
|
(add-debug-sphere #t (bucket-id debug-draw0) s4-0 2048.0 (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40))
|
|
(&+! s5-0 48)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod set-to-rest-state ropebridge ((obj ropebridge))
|
|
(rlet ((vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((a1-0 (the-as structure (-> obj tuning rest-state))))
|
|
(cond
|
|
((the-as symbol a1-0)
|
|
(let ((v1-1 (the-as ropebridge-spring-point (-> obj spring-point)))
|
|
(a1-1 (the-as vector (-> (the-as vector a1-0) x)))
|
|
)
|
|
(.svf (&-> v1-1 local-pos quad) vf0)
|
|
(.svf (&-> v1-1 vel quad) vf0)
|
|
(countdown (a0-3 (+ (-> obj tuning num-spring-points) -1))
|
|
(&+! v1-1 48)
|
|
(.svf (&-> v1-1 local-pos quad) vf0)
|
|
(.svf (&-> v1-1 vel quad) vf0)
|
|
(set! (-> v1-1 local-pos y) (-> a1-1 x))
|
|
(set! (-> v1-1 local-pos z) (-> a1-1 y))
|
|
(set! (-> v1-1 vel y) (-> a1-1 z))
|
|
(set! (-> v1-1 vel z) (-> a1-1 w))
|
|
(&+! a1-1 16)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let ((a1-2 8192.0))
|
|
(.mov.vf vf1 vf0)
|
|
(let ((v1-3 (the-as ropebridge-spring-point (-> obj spring-point))))
|
|
(.mov vf2 a1-2)
|
|
(.add.x.vf vf2 vf0 vf2)
|
|
(.mov.vf vf2 vf0 :mask #b1011)
|
|
(countdown (a0-5 (-> obj tuning num-spring-points))
|
|
(.svf (&-> v1-3 local-pos quad) vf1)
|
|
(.svf (&-> v1-3 vel quad) vf0)
|
|
(.add.vf vf1 vf1 vf2 :mask #b111)
|
|
(&+! v1-3 48)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defun ropebridge-joint-callback ((arg0 ropebridge))
|
|
(let ((s5-0 (-> arg0 node-list data 3 bone transform)))
|
|
(matrix-identity! s5-0)
|
|
(set-vector! (-> s5-0 vector 3) 0.0 0.0 (- (-> arg0 tuning normal-board-len)) 1.0)
|
|
)
|
|
(let* ((s5-1 (-> arg0 spring-point))
|
|
(s3-0 (the-as object s5-1))
|
|
(s4-0 0)
|
|
)
|
|
(while (< s4-0 (-> arg0 tuning num-springs))
|
|
(set! s3-0 (&+ (the-as ropebridge-spring-point s3-0) 48))
|
|
(let ((v1-4 (new 'stack-no-clear 'vector)))
|
|
(vector-! v1-4 (-> (the-as ropebridge-spring-point s3-0) local-pos) (the-as vector (-> s5-1 0)))
|
|
(let ((f0-8 (- (atan (-> v1-4 y) (-> v1-4 z))))
|
|
(s2-0 (-> arg0 node-list data (+ s4-0 4) bone transform))
|
|
)
|
|
(matrix-rotate-x! s2-0 f0-8)
|
|
(set! (-> s2-0 vector 3 quad) (-> s5-1 0 local-pos quad))
|
|
)
|
|
)
|
|
(set! s5-1 (the-as (inline-array ropebridge-spring-point) (the-as ropebridge-spring-point s3-0)))
|
|
(+! s4-0 1)
|
|
)
|
|
(let ((s4-1 (-> arg0 node-list data (+ s4-0 4) bone transform)))
|
|
(matrix-identity! s4-1)
|
|
(set! (-> s4-1 vector 3 quad) (-> s5-1 0 local-pos quad))
|
|
)
|
|
)
|
|
(dotimes (s5-2 (+ (-> arg0 tuning num-springs) 2))
|
|
(let ((a1-3 (-> arg0 node-list data (+ s5-2 3) bone transform)))
|
|
(matrix*! a1-3 a1-3 (-> arg0 world-matrix))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod add-collision-meshes ropebridge ((obj ropebridge))
|
|
(let* ((s5-0 (-> obj root-override))
|
|
(s3-0 (-> obj tuning))
|
|
(s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint (-> s3-0 num-springs)) 0))
|
|
)
|
|
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
|
(set! (-> s4-0 collide-with) (collide-kind target))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 (-> s3-0 root-prim-radius))
|
|
(set! (-> s4-0 transform-index) (+ (/ (-> s3-0 num-springs) 2) 4))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid ca-1))
|
|
(set-root-prim! s5-0 s4-0)
|
|
(let ((s3-1 (-> obj tuning col-mesh-indexes)))
|
|
(dotimes (s2-0 (-> obj tuning num-springs))
|
|
(let* ((a3-1 (-> s3-1 s2-0))
|
|
(a1-3 (new 'process 'collide-shape-prim-mesh s5-0 a3-1 (the-as uint s2-0)))
|
|
)
|
|
(set! (-> a1-3 prim-core action) (collide-action solid ca-1))
|
|
(set! (-> a1-3 prim-core collide-as) (collide-kind ground-object))
|
|
(set! (-> a1-3 collide-with) (collide-kind target))
|
|
(set! (-> a1-3 prim-core offense) (collide-offense indestructible))
|
|
(set-vector! (-> a1-3 local-sphere) 0.0 6144.0 4096.0 18022.4)
|
|
(set! (-> a1-3 transform-index) (+ s2-0 4))
|
|
(append-prim s4-0 a1-3)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod run-logic? ropebridge ((obj ropebridge))
|
|
(or (zero? (logand (-> obj mask) (process-mask actor-pause)))
|
|
(< (- (-> *display* base-frame-counter) (-> obj agitated-time-stamp)) (seconds 5))
|
|
(or (>= (-> obj sleep-dist) (vector-vector-distance (-> obj root-override trans) (math-camera-pos)))
|
|
(and (nonzero? (-> obj skel)) (!= (-> obj skel root-channel 0) (-> obj skel channel)))
|
|
(and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-status no-skeleton-update)))
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod dummy-28 ropebridge ((obj ropebridge))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-from-entity! ropebridge ((obj ropebridge) (arg0 entity-actor))
|
|
(let ((s4-0 (res-lump-struct (-> obj entity) 'art-name structure)))
|
|
(if (not s4-0)
|
|
(set! s4-0 "ropebridge-32")
|
|
)
|
|
(if (= (-> (the-as symbol s4-0) type) symbol)
|
|
(set! s4-0 (symbol->string (the-as symbol s4-0)))
|
|
)
|
|
(set! (-> obj subtype-name) (the-as string s4-0))
|
|
(set! (-> obj subtype) (the-as uint (cond
|
|
((string= (the-as string s4-0) "ropebridge-32")
|
|
0
|
|
)
|
|
((string= (the-as string s4-0) "ropebridge-36")
|
|
1
|
|
)
|
|
((string= (the-as string s4-0) "ropebridge-52")
|
|
2
|
|
)
|
|
((string= (the-as string s4-0) "ropebridge-70")
|
|
3
|
|
)
|
|
((string= (the-as string s4-0) "snow-bridge-36")
|
|
4
|
|
)
|
|
((string= (the-as string s4-0) "vil3-bridge-36")
|
|
5
|
|
)
|
|
(else
|
|
0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> obj tuning) (-> *ropebridge-tunings* (the-as int (-> obj subtype))))
|
|
(set! (-> obj agitated-time-stamp) (-> *display* base-frame-counter))
|
|
(set! (-> obj bonk-time-stamp) (-> *display* base-frame-counter))
|
|
(set! (-> obj attack-flop-time-stamp) (-> *display* base-frame-counter))
|
|
(set-vector! (-> obj extra-trans) 0.0 0.0 (- (* 0.5 (-> obj tuning bridge-end-to-end-len))) 1.0)
|
|
(set! (-> obj do-physics?) #t)
|
|
(let ((a0-13 (new 'process 'collide-shape obj (collide-list-enum hit-by-player))))
|
|
(set! (-> obj root-override) a0-13)
|
|
(alloc-riders a0-13 3)
|
|
)
|
|
(add-collision-meshes obj)
|
|
(process-drawable-from-entity! obj arg0)
|
|
(initialize-skeleton-by-name obj (-> obj subtype-name) '())
|
|
(logior! (-> obj skel status) (janim-status inited))
|
|
(let ((v1-29 (-> obj tuning)))
|
|
(set! (-> obj draw bounds w) (-> v1-29 view-frustum-radius))
|
|
(set! (-> obj sleep-dist) (+ 40960.0 (* 0.5 (-> v1-29 bridge-end-to-end-len))))
|
|
(if (or (< 35 (-> v1-29 num-springs)) (< 36 (-> v1-29 num-spring-points)))
|
|
(format 0 "ERROR: ##########~%Exceeded max # of springs in ropebridge! Stomping memory!~%##########~%")
|
|
)
|
|
)
|
|
(set! (-> obj skel postbind-function) ropebridge-joint-callback)
|
|
(matrix<-transformq+trans!
|
|
(-> obj world-matrix)
|
|
(the-as transformq (-> obj root-override trans))
|
|
(-> obj extra-trans)
|
|
)
|
|
(matrix-4x4-inverse! (-> obj inv-world-matrix) (-> obj world-matrix))
|
|
(set-to-rest-state obj)
|
|
(go ropebridge-idle)
|
|
(none)
|
|
)
|
|
|
|
|
|
|
|
|