decomp3: more engine stuff, support boxed stack arrays in compiler (#3424)

- `sync-info`
- `trajectory`
- `camera`
- `cam-update`
- `cam-states`
- `cam-states-dbg`
- `cam-master`
- `cam-layout`
- `cam-interface`
- `cam-combiner`

Closes #2016
This commit is contained in:
Hat Kid
2024-03-16 01:28:26 +01:00
committed by GitHub
parent f30b6927b7
commit 5a8b4e81f9
60 changed files with 28132 additions and 732 deletions
+6 -2
View File
@@ -3863,8 +3863,12 @@ void FunctionCallElement::update_from_stack(const Env& env,
if (got_stack_new) {
std::vector<Form*> stack_new_args;
stack_new_args.push_back(pool.form<ConstantTokenElement>("'stack"));
stack_new_args.push_back(pool.form<ConstantTokenElement>(
fmt::format("'{}", type_source_form->to_string(env))));
if (type_source_form->to_string(env) == "array") {
stack_new_args.push_back(pool.form<ConstantTokenElement>("'boxed-array"));
} else {
stack_new_args.push_back(pool.form<ConstantTokenElement>(
fmt::format("'{}", type_source_form->to_string(env))));
}
for (size_t i = 2; i < arg_forms.size(); i++) {
stack_new_args.push_back(arg_forms.at(i));
}
File diff suppressed because it is too large Load Diff
@@ -123,5 +123,6 @@
"collectables": [
[77, "(function part-tracker vector)"],
[78, "(function part-tracker vector)"]
]
],
"trajectory": [[15, "(function trajectory none)"]]
}
@@ -37,8 +37,6 @@
// checking boxed type is different now - these make the cfg stuff sad
"name=",
"(method 77 grenadier)",
// until loop without nop:
"target-history-print",
"display-list-control",
"anim-test-anim-list-handler",
"anim-test-sequence-list-handler",
@@ -285,5 +285,34 @@
["L287", "(inline-array vector)", 3],
["L283", "(inline-array vector)", 32],
["L265", "(inline-array vector)", 4]
]
],
"cam-states": [
["L821", "uint64", true],
["L818", "uint64", true],
["L820", "uint64", true],
["L819", "uint64", true]
],
"cam-states-dbg": [
["L59", "vector"],
["L60", "vector"]
],
"cam-layout": [
["L893", "uint64", true],
["L899", "uint64", true],
["L897", "uint64", true],
["L892", "uint64", true],
["L895", "uint64", true],
["L894", "uint64", true],
["L898", "uint64", true],
["L896", "uint64", true],
["L889", "uint64", true],
["L785", "vector"],
["L802", "vector4w"],
["L800", "vector4w"],
["L798", "vector4w"],
["L796", "vector4w"],
["L794", "vector4w"],
["L792", "vector4w"]
],
"level": [["L1003", "uint64", true]]
}
@@ -296,5 +296,68 @@
[32, "vector"]
],
"add-debug-points": [[16, "vector"]],
"add-debug-cursor": [[16, "vector"]]
"add-debug-cursor": [[16, "vector"]],
"(method 11 impact-control)": [[16, "touching-shapes-entry"]],
"(method 9 cubic-curve)": [[16, "trajectory"]],
"(method 10 cubic-curve)": [[16, "trajectory"]],
"(method 11 cubic-curve)": [[16, "trajectory"]],
"(method 12 cubic-curve)": [[16, "trajectory"]],
"(method 13 cubic-curve)": [[16, "trajectory"]],
"slave-set-rotation!": [
[96, "vector"],
[112, "matrix"],
[176, "vector"]
],
"v-slrp2!": [
[32, "vector"],
[64, "matrix"]
],
"v-slrp3!": [[32, "vector"]],
"(method 15 tracking-spline)": [
[16, "tracking-spline-sampler"],
[32, "vector"]
],
"(method 16 tracking-spline)": [
[16, "tracking-spline-sampler"],
[32, "tracking-spline-sampler"]
],
"(method 18 tracking-spline)": [[16, "tracking-spline-sampler"]],
"(code cam-eye)": [[112, "vector"]],
"(enter cam-circular)": [[32, "vector"]],
"cam-string-joystick": [
[32, "vector"],
[48, "vector"]
],
"cam-string-line-of-sight": [[192, "vector"]],
"cam-los-collide": [
[592, "vector"],
[608, "vector"]
],
"los-cw-ccw": [
[48, ["inline-array", "vector", 4]],
[16, "vector"],
[32, "vector"],
[112, "vector"]
],
"master-track-target": [[16, "vector"]],
"(code cam-point-watch)": [[16, "vector"]],
"cam-helper-temp": [[16, ["inline-array", "vector", 3]]],
"update-view-planes": [
[208, "vector"],
[224, "vector"]
],
"clmf-pos-rot": [[112, "matrix"]],
"cam-layout-entity-info": [[208, "vector"]],
"cam-layout-entity-volume-info-create": [
[80, "vector"],
[128, "vector"],
[32, "vector"],
[48, "vector"],
[64, "vector"],
[96, "vector"],
[144, "vector"],
[112, "vector"]
],
"(method 23 tracking-spline)": [[32, "vector"]],
"(method 21 tracking-spline)": [[16, "tracking-spline-sampler"]]
}
+227 -1
View File
@@ -2156,5 +2156,231 @@
//[85, "a0", "dma-packet"],
["_stack_", 16, "dma-packet"],
[91, "v1", "dma-packet"]
]
],
"target-history-print": [["_stack_", 32, "collide-status"]],
"(method 13 sync-linear)": [
["_stack_", 16, "res-tag"],
[27, "v0", "(pointer float)"]
],
"(method 13 sync-eased)": [
["_stack_", 16, "res-tag"],
[31, "v0", "(pointer float)"]
],
"(method 13 sync-paused)": [
["_stack_", 16, "res-tag"],
[29, "v0", "(pointer float)"]
],
"(method 11 impact-control)": [
[58, "v1", "collide-shape-prim"],
[66, "v1", "collide-shape-prim"]
],
"cam-slave-get-vector-with-offset": [
[59, "v0", "vector"],
[24, "v0", "vector"],
[69, "s3", "vector"]
],
"cam-slave-get-interp-time": [[29, "f0", "float"]],
"cam-standard-event-handler": [
[13, "gp", "(state camera-slave)"],
[19, "gp", "(state camera-slave)"],
[22, "gp", "(state camera-slave)"]
],
"cam-calc-follow!": [
["_stack_", 144, "float"],
["_stack_", 160, "float"]
],
"(method 15 tracking-spline)": [
[28, "a0", "int"],
[38, "a0", "int"]
],
"(code cam-pov)": [
[15, "a1", "process-drawable"],
[24, "a0", "process-drawable"]
],
"(code cam-pov180)": [
[15, "a1", "process-drawable"],
[23, "v1", "process-drawable"],
[45, "v1", "process-drawable"],
[58, "v1", "process-drawable"],
[80, "a1", "process-drawable"]
],
"(code cam-pov-track)": [
[19, "a1", "process-drawable"],
[30, "a0", "process-drawable"]
],
"(event cam-string)": [
[11, "v1", "vector"],
[44, "s5", "vector"],
[51, "s5", "vector"],
[53, "s5", "vector"],
[62, "s5", "vector"],
[69, "s5", "vector"],
[71, "s5", "vector"],
[80, "gp", "vector"],
[87, "gp", "vector"],
[89, "gp", "vector"],
[98, "gp", "vector"],
[105, "gp", "vector"],
[107, "gp", "vector"],
[141, "a0", "vector"],
[145, "a0", "vector"],
[174, "v1", "vector"],
[184, "v1", "float"],
[28, "v1", "float"],
[31, "v1", "float"]
],
"set-string-params": [[30, "v0", "entity-camera"]],
"cam-string-joystick": [[842, "v1", "process-drawable"]],
"cam-dist-analog-input": [[32, "f0", "float"]],
"cam-los-collide": [
[92, "s1", "(inline-array collide-cache-tri)"],
[205, "s1", "(inline-array collide-cache-tri)"],
[135, "s1", "(inline-array collide-cache-tri)"],
[140, "s1", "(inline-array collide-cache-tri)"],
[175, "s1", "(inline-array collide-cache-tri)"],
[375, "v1", "(inline-array tracking-spline)"]
],
"cam-los-spline-collide": [
[70, "s3", "(inline-array collide-cache-tri)"],
[88, "s3", "(inline-array collide-cache-tri)"]
],
"cam-draw-collide-cache": [
[[8, 14], "gp", "(inline-array collide-cache-tri)"]
],
"(method 16 camera-master)": [
[14, "a2", "process-focusable"],
[16, "v1", "int"]
],
"reset-follow": [
[14, "a0", "process-focusable"],
[17, "a0", "process-focusable"]
],
"(event cam-master-active)": [
[80, "gp", "matrix"],
[170, "s5", "vector"],
[275, "v1", "process"],
[330, "a0", "camera-slave"],
[448, "v1", "camera-slave"],
[512, "v1", "camera-slave"],
[542, "v1", "camera-slave"],
[611, "a0", "vector"],
[799, "v1", "float"],
[784, "v1", "vector"],
[589, "v1", "float"],
[593, "v1", "float"],
[602, "v1", "float"],
[606, "v1", "float"],
[796, "v1", "float"]
],
"master-track-target": [
[53, "gp", "process-focusable"],
[100, "gp", "process-focusable"],
[121, "gp", "process-focusable"],
[132, "gp", "process-focusable"],
[203, "gp", "process-focusable"],
[273, "gp", "process-focusable"],
[280, "gp", "process-focusable"],
[286, "gp", "process-focusable"],
[366, "gp", "process-focusable"],
[480, "gp", "process-focusable"],
[486, "gp", "process-focusable"],
[490, "gp", "process-focusable"],
[528, "gp", "process-focusable"],
[531, "gp", "process-focusable"],
[409, "gp", "process-focusable"],
[415, "gp", "process-focusable"],
[171, "gp", "process-focusable"],
[195, "gp", "process-focusable"]
],
"reset-target-tracking": [
[14, "gp", "process-focusable"],
[40, "gp", "process-focusable"],
[51, "gp", "process-focusable"],
[65, "gp", "process-focusable"],
[86, "gp", "process-focusable"],
[131, "gp", "process-focusable"]
],
"cam-free-floating-input": [
[179, "v1", "cpad-list"],
[191, "v1", "cpad-list"],
[203, "v1", "cpad-list"],
[215, "v1", "cpad-list"],
[229, "a0", "cpad-list"],
[237, "v1", "cpad-list"]
],
"(event cam-combiner-active)": [
[103, "gp", "camera-slave"],
[105, "gp", "camera-slave"],
[189, "gp", "camera-slave"],
[191, "gp", "camera-slave"],
[206, "gp", "camera-slave"],
[210, "gp", "camera-slave"],
[214, "gp", "camera-slave"],
[230, "gp", "camera-slave"],
[234, "gp", "camera-slave"]
],
"execute-cam-post-hook-engine": [
[8, "s5", "connection"],
[[14, 17], "s5", "connection"],
[18, "t9", "(function object object object object object)"],
[9, "s5", "connection"]
],
"cam-layout-init": [[10, "v1", "connection"]],
"cam-layout-function-call": [
[15, "gp", "(function string int basic object)"]
],
"cam-layout-do-action": [[99, "s5", "(function int symbol object)"]],
"cam-layout-do-menu": [
[[280, 363], "s4", "clm-list"],
[374, "v1", "clm-item"],
[[136, 182], "s3", "clm-list"],
[209, "a0", "clm-item"],
[219, "v1", "clm-item"],
[234, "s3", "clm-item"],
[239, "v1", "clm-item"],
[244, "s3", "clm-item"]
],
"clmf-save-all": [[18, "v1", "connection"]],
"cam-layout-save-campointsoffset": [[12, "v0", "vector"]],
"cam-layout-save-splineoffset": [
[37, "v0", "vector"],
[25, "v0", "vector"]
],
"cam-layout-save-interesting": [
[13, "v0", "vector"],
[38, "v0", "vector"]
],
"cam-layout-save-align": [
[38, "v0", "vector"],
[13, "v0", "vector"]
],
"cam-layout-save-pivot": [
[13, "v0", "vector"],
[38, "v0", "vector"]
],
"cam-layout-save-cam-trans": [
[29, "v0", "vector"],
[40, "v0", "vector"],
[93, "s5", "symbol"],
[95, "s2", "symbol"],
[94, "s2", "symbol"]
],
"cam-layout-save-cam-rot": [[13, "v0", "vector"]],
"clmf-next-entity": [[38, "a0", "connection"]],
"cam-layout-entity-info": [[202, "v1", "vector"]],
"cam-layout-entity-volume-info-create": [
["_stack_", 16, "res-tag"],
["_stack_", 164, "float"],
[16, "v0", "(inline-array vector)"]
],
"cam-layout-print": [[[22, 25], "v1", "dma-packet"]],
"(method 19 level-group)": [
[237, "s2", "continue-point"],
[191, "s0", "continue-point"],
[196, "s2", "continue-point"],
[207, "s0", "continue-point"],
[213, "s0", "continue-point"],
[222, "s0", "continue-point"]
],
"master-choose-entity": [[162, "s0", "(pointer camera-slave)"]]
}
+27 -192
View File
@@ -1735,249 +1735,84 @@
}
},
"transform-float-point": {
"args": [
"src-world-pt",
"dst-gs-screen-pt"
]
"args": ["src-world-pt", "dst-gs-screen-pt"]
},
"add-debug-point": {
"args": [
"enable",
"bucket",
"pt"
]
"args": ["enable", "bucket", "pt"]
},
"internal-draw-debug-line": {
"args": [
"bucket",
"p0",
"p1",
"color",
"mode",
"color2"
]
"args": ["bucket", "p0", "p1", "color", "mode", "color2"]
},
"internal-draw-debug-text-3d": {
"args": [
"bucket",
"text",
"pos",
"color",
"offset"
]
"args": ["bucket", "text", "pos", "color", "offset"]
},
"add-debug-outline-triangle": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"p2",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "p2", "color"]
},
"add-debug-triangle-normal": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"p2",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "p2", "color"]
},
"add-debug-flat-triangle": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"p2",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "p2", "color"]
},
"get-debug-text-3d": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"color",
"mode",
"color2"
]
"args": ["enable", "bucket", "p0", "p1", "color", "mode", "color2"]
},
"debug-reset-buffers": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "color"]
},
"add-debug-line": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"color",
"mode",
"color2"
]
"args": ["enable", "bucket", "p0", "p1", "color", "mode", "color2"]
},
"add-debug-line2d": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "color"]
},
"add-debug-box": {
"args": [
"enable",
"bucket",
"p0",
"p1",
"color"
]
"args": ["enable", "bucket", "p0", "p1", "color"]
},
"add-debug-box-with-transform": {
"args": [
"enable",
"bucket",
"box",
"mat",
"color"
]
"args": ["enable", "bucket", "box", "mat", "color"]
},
"add-debug-x": {
"args": [
"enable",
"bucket",
"pos",
"color"
]
"args": ["enable", "bucket", "pos", "color"]
},
"add-debug-cross": {
"args": [
"enable",
"bucket",
"pos",
"len"
]
"args": ["enable", "bucket", "pos", "len"]
},
"add-debug-text-3d": {
"args": [
"enable",
"bucket",
"text",
"pos",
"color",
"offset"
]
"args": ["enable", "bucket", "text", "pos", "color", "offset"]
},
"add-debug-sphere-with-transform": {
"args": [
"enable",
"bucket",
"pos",
"radius",
"mat",
"color"
]
"args": ["enable", "bucket", "pos", "radius", "mat", "color"]
},
"add-debug-sphere": {
"args": [
"enable",
"bucket",
"pos",
"radius",
"color"
]
"args": ["enable", "bucket", "pos", "radius", "color"]
},
"add-debug-text-sphere": {
"args": [
"enable",
"bucket",
"pos",
"radius",
"text",
"color"
]
"args": ["enable", "bucket", "pos", "radius", "text", "color"]
},
"add-debug-spheres": {
"args": [
"enable",
"bucket",
"spheres",
"count",
"color"
]
"args": ["enable", "bucket", "spheres", "count", "color"]
},
"add-debug-line-sphere": {
"args": [
"enable",
"bucket",
"base",
"dir",
"rad",
"color"
]
"args": ["enable", "bucket", "base", "dir", "rad", "color"]
},
"add-debug-circle": {
"args": [
"enable",
"bucket",
"origin",
"radius",
"color",
"mat"
]
"args": ["enable", "bucket", "origin", "radius", "color", "mat"]
},
"add-debug-vector": {
"args": [
"enable",
"bucket",
"base",
"dir",
"len-scale",
"color"
]
"args": ["enable", "bucket", "base", "dir", "len-scale", "color"]
},
"add-debug-matrix": {
"args": [
"enable",
"bucket",
"mat",
"len"
]
"args": ["enable", "bucket", "mat", "len"]
},
"add-debug-rot-matrix": {
"args": [
"enable",
"bucket",
"mat",
"len",
"trans"
]
"args": ["enable", "bucket", "mat", "len", "trans"]
},
"add-debug-quaternion": {
"args": [
"enable",
"bucket",
"trans",
"quat"
]
"args": ["enable", "bucket", "trans", "quat"]
},
"add-debug-cspace": {
"args": [
"enable",
"bucket",
"cs"
]
"args": ["enable", "bucket", "cs"]
}
}
+438
View File
@@ -7,3 +7,441 @@
;; DECOMP BEGINS
(defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float))
(local-vars (sv-144 cam-rotation-tracker))
(set! sv-144 (-> arg0 0 tracking))
(let ((s1-0 (-> arg0 0 trans))
(gp-0 (-> arg1 0 tracking))
(s0-0 (-> arg1 0 trans))
)
(cond
((= (-> self tracking-status) 3)
(cam-calc-follow! (-> self tracking) s1-0 #t)
(slave-set-rotation!
(-> self tracking)
s1-0
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#t
)
(set! sv-144 (-> self tracking))
(set! s1-0 (-> self trans))
)
((= (-> self tracking-status) 2)
(cam-calc-follow! (-> self tracking) s0-0 #t)
(slave-set-rotation!
(-> self tracking)
s0-0
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#t
)
(set! gp-0 (-> self tracking))
(set! s0-0 (-> self trans))
)
)
(let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 3)))
(dotimes (v1-14 3)
(set! (-> s2-0 v1-14 quad) (the-as uint128 0))
)
0.0
0.0
0.0
(let ((s4-0 (new-stack-vector0)))
0.0
(let ((s3-0 (new 'stack-no-clear 'matrix)))
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(vector-! (-> s2-0 0) (the-as vector (-> sv-144 inv-mat)) (the-as vector (-> gp-0 inv-mat)))
(vector-! (-> s2-0 1) (-> sv-144 inv-mat uvec) (-> gp-0 inv-mat uvec))
(vector-! (-> s2-0 2) (-> sv-144 inv-mat fvec) (-> gp-0 inv-mat fvec))
(let ((f0-6 (vector-length (-> s2-0 0)))
(f1-0 (vector-length (-> s2-0 1)))
(f2-0 (vector-length (-> s2-0 2)))
)
(cond
((and (< f0-6 f1-0) (< f0-6 f2-0))
(vector-cross! s4-0 (-> s2-0 1) (-> s2-0 2))
)
((and (< f1-0 f0-6) (< f1-0 f2-0))
(vector-cross! s4-0 (-> s2-0 0) (-> s2-0 2))
)
(else
(vector-cross! s4-0 (-> s2-0 0) (-> s2-0 1))
)
)
)
(vector-normalize! s4-0 1.0)
(let ((f0-9 (fabs (vector-dot (the-as vector (-> sv-144 inv-mat)) s4-0)))
(f1-3 (fabs (vector-dot (-> sv-144 inv-mat uvec) s4-0)))
(f2-3 (fabs (vector-dot (-> sv-144 inv-mat fvec) s4-0)))
)
(cond
((and (< f0-9 f1-3) (< f0-9 f2-3))
(vector-flatten! (-> s2-0 0) (the-as vector (-> sv-144 inv-mat)) s4-0)
(vector-flatten! (-> s2-0 1) (the-as vector (-> gp-0 inv-mat)) s4-0)
)
((< f1-3 f2-3)
(vector-flatten! (-> s2-0 0) (-> sv-144 inv-mat uvec) s4-0)
(vector-flatten! (-> s2-0 1) (-> gp-0 inv-mat uvec) s4-0)
)
(else
(vector-flatten! (-> s2-0 0) (-> sv-144 inv-mat fvec) s4-0)
(vector-flatten! (-> s2-0 1) (-> gp-0 inv-mat fvec) s4-0)
)
)
)
(vector-normalize! (-> s2-0 0) 1.0)
(vector-normalize! (-> s2-0 1) 1.0)
(vector-cross! (-> s2-0 2) (-> s2-0 0) (-> s2-0 1))
(if (< (vector-dot (-> s2-0 2) s4-0) 0.0)
(vector-negate! s4-0 s4-0)
)
(let ((f30-0 (acos (vector-dot (-> s2-0 0) (-> s2-0 1)))))
(cond
((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS))
(logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER))
(when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)))
(vector-! (-> s2-0 0) (-> *camera* tpos-curr) s1-0)
(vector-! (-> s2-0 1) s0-0 s1-0)
(vector-flatten! (-> s2-0 0) (-> s2-0 0) (-> *camera* local-down))
(vector-flatten! (-> s2-0 1) (-> s2-0 1) (-> *camera* local-down))
(when (and (< 4096.0 (vector-normalize-ret-len! (-> s2-0 0) 1.0))
(< 4096.0 (vector-normalize-ret-len! (-> s2-0 1) 1.0))
)
(vector-cross! (-> s2-0 2) (-> s2-0 1) (-> s2-0 0))
(when (< (vector-dot (-> s2-0 2) s4-0) -0.01)
)
)
)
)
((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0))
(logxor! (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER))
)
)
(set! (-> self flip-control-axis quad) (-> s4-0 quad))
(when (logtest? (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER))
(set! f30-0 (- 65536.0 f30-0))
(vector-negate! s4-0 s4-0)
)
(let ((f30-1 (* f30-0 (- 1.0 arg2))))
(matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1))
)
)
(matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0)
)
)
)
)
)
(defstate cam-combiner-active (camera-combiner)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-0 object))
(case message
(('fast-rot)
(set! v0-0 #t)
(set! (-> self fast-rot) (the-as basic v0-0))
v0-0
)
(('set-interpolation)
(let ((f0-1 (the float (-> block param 0))))
(cond
((>= 0.0 f0-1)
(set! (-> self interp-val) 1.0)
)
(else
(set! (-> self interp-val) 0.0)
(set! (-> self interp-step) (/ 5.0 f0-1))
)
)
)
)
(('teleport)
(when (nonzero? (-> self tracking-status))
(jump-to-target! (-> self tracking point-of-interest-blend) 0.0)
(cam-calc-follow! (-> self tracking) (-> self trans) #f)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#f
)
)
)
(('stop-tracking)
(set! (-> self tracking-status) (the-as uint 0))
0
)
(('start-tracking)
(cond
((< argc 1)
(let ((t9-3 format)
(a0-14 0)
(a1-4 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* start-tracking~%")
)
(let ((v1-8 (-> block param 0)))
(rtype-of v1-8)
)
(t9-3 a0-14 a1-4)
)
)
((not (type? (-> block param 0) camera-slave))
(let ((t9-5 format)
(a0-16 0)
(a1-6 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* start-tracking~%")
(v1-11 (-> block param 0))
)
(t9-5 a0-16 a1-6 (rtype-of v1-11))
)
)
((zero? (-> self tracking-status))
(set! (-> self tracking-status) (the-as uint 1))
(let ((gp-1 (the-as object (-> block param 0))))
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options)))
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow))
(copy-to (-> self tracking tilt-adjust) (the-as cam-float-seeker (+ (the-as uint gp-1) 320)))
(copy-to (-> self tracking underwater-blend) (the-as cam-float-seeker (+ (the-as uint gp-1) 368)))
(copy-to (-> self tracking point-of-interest-blend) (the-as cam-float-seeker (+ (the-as uint gp-1) 344)))
(let ((gp-2 (+ (the-as uint gp-1) 124)))
(cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f)
(slave-set-rotation!
(-> self tracking)
(the-as vector gp-2)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#f
)
)
)
)
)
)
(('copy-tracking)
(cond
((< argc 1)
(let ((t9-11 format)
(a0-23 0)
(a1-12 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* copy-tracking~%")
)
(let ((v1-23 (-> block param 0)))
(rtype-of v1-23)
)
(t9-11 a0-23 a1-12)
)
)
((not (type? (-> block param 0) camera-slave))
(let ((t9-13 format)
(a0-25 0)
(a1-14 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* copy-tracking~%")
(v1-25 (-> block param 0))
)
(t9-13 a0-25 a1-14 (rtype-of v1-25))
)
)
((nonzero? (-> self tracking-status))
#f
)
(else
(set! (-> self tracking-status) (the-as uint 1))
(let ((gp-3 (the-as object (-> block param 0))))
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-3) options)))
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-3) tracking no-follow))
(copy-to (-> self tracking tilt-adjust) (the-as cam-float-seeker (+ (the-as uint gp-3) 320)))
(copy-to (-> self tracking underwater-blend) (the-as cam-float-seeker (+ (the-as uint gp-3) 368)))
(set! (-> self tracking follow-off quad) (-> (the-as camera-slave gp-3) tracking follow-off quad))
(set! (-> self tracking follow-pt quad) (-> (the-as camera-slave gp-3) tracking follow-pt quad))
(let* ((a2-23 (-> self tracking))
(a3-7 (-> (the-as camera-slave gp-3) tracking))
(v1-37 (-> a3-7 inv-mat rvec quad))
(a0-32 (-> a3-7 inv-mat uvec quad))
(a1-17 (-> a3-7 inv-mat fvec quad))
(a3-8 (-> a3-7 inv-mat trans quad))
)
(set! (-> a2-23 inv-mat rvec quad) v1-37)
(set! (-> a2-23 inv-mat uvec quad) a0-32)
(set! (-> a2-23 inv-mat fvec quad) a1-17)
(set! (-> a2-23 inv-mat trans quad) a3-8)
)
(copy-to (-> self tracking point-of-interest-blend) (the-as cam-float-seeker (+ (the-as uint gp-3) 344)))
(set! (-> self tracking looking-at quad) (-> (the-as camera-slave gp-3) tracking looking-at quad))
(set! v0-0 (-> self tracking looking-interesting))
(set! (-> (the-as vector v0-0) quad) (-> (the-as camera-slave gp-3) tracking looking-interesting quad))
)
v0-0
)
)
)
)
)
:code (behavior ()
(until #f
(when (and (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)))
(!= (-> self tracking-status) 0)
)
(set! (-> self tracking-status) (the-as uint 0))
0
)
(when *camera*
(let ((s5-0 (-> *camera* slave))
(s4-0 (-> *camera* decel))
(f30-0 (parameter-ease-sin-clamp (-> self interp-val)))
(gp-0 (new-stack-vector0))
)
(set! (-> gp-0 quad) (-> self trans quad))
(when s5-0
(cond
((< (-> self interp-val) 1.0)
(vector-lerp-clamp! (-> self trans) (-> s4-0 0 trans) (-> s5-0 0 trans) f30-0)
(set! (-> self fov) (lerp-clamp (-> s4-0 0 fov) (-> s5-0 0 fov) f30-0))
(set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s4-0 0 trans)))
(set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s5-0 0 trans)))
(cond
((= (-> self tracking-status) 1)
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
(not (-> self fast-rot))
)
(let* ((a2-4 (-> self inv-camera-rot))
(a3-2 (-> self tracking))
(v1-22 (-> a3-2 inv-mat rvec quad))
(a0-10 (-> a3-2 inv-mat uvec quad))
(a1-6 (-> a3-2 inv-mat fvec quad))
(a3-3 (-> a3-2 inv-mat trans quad))
)
(set! (-> a2-4 rvec quad) v1-22)
(set! (-> a2-4 uvec quad) a0-10)
(set! (-> a2-4 fvec quad) a1-6)
(set! (-> a2-4 trans quad) a3-3)
)
)
(else
(cam-helper-temp s4-0 s5-0 f30-0)
)
)
(cond
((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value)))
)
((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t)))
)
((paused?)
)
(else
(+! (-> self interp-val) (* (-> self interp-step) (-> self clock time-adjust-ratio)))
)
)
)
(else
(set! (-> self dist-from-src) 409600.0)
(set! (-> self dist-from-dest) 0.0)
(set! (-> self trans quad) (-> s5-0 0 trans quad))
(set! (-> self fov) (-> s5-0 0 fov))
(cond
((= (-> self tracking-status) 2)
(set! (-> self tracking-status) (the-as uint 1))
)
((= (-> self tracking-status) 3)
(set! (-> self tracking-status) (the-as uint 0))
0
)
)
(cond
((= (-> self tracking-status) 1)
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
(not (-> self fast-rot))
)
(let* ((v1-51 (-> self inv-camera-rot))
(a3-5 (-> self tracking))
(a0-17 (-> a3-5 inv-mat rvec quad))
(a1-10 (-> a3-5 inv-mat uvec quad))
(a2-8 (-> a3-5 inv-mat fvec quad))
(a3-6 (-> a3-5 inv-mat trans quad))
)
(set! (-> v1-51 rvec quad) a0-17)
(set! (-> v1-51 uvec quad) a1-10)
(set! (-> v1-51 fvec quad) a2-8)
(set! (-> v1-51 trans quad) a3-6)
)
)
(else
(let* ((v1-52 (-> self inv-camera-rot))
(a3-7 (-> s5-0 0 tracking))
(a0-19 (-> a3-7 inv-mat rvec quad))
(a1-11 (-> a3-7 inv-mat uvec quad))
(a2-9 (-> a3-7 inv-mat fvec quad))
(a3-8 (-> a3-7 inv-mat trans quad))
)
(set! (-> v1-52 rvec quad) a0-19)
(set! (-> v1-52 uvec quad) a1-11)
(set! (-> v1-52 fvec quad) a2-9)
(set! (-> v1-52 trans quad) a3-8)
)
)
)
)
)
)
(vector-! (-> self velocity) (-> self trans) gp-0)
)
)
(set! (-> self fast-rot) #f)
(suspend)
)
#f
)
)
(defbehavior cam-combiner-init camera-combiner ()
(stack-size-set! (-> self main-thread) 512)
(vector-reset! (-> self trans))
(matrix-identity! (-> self inv-camera-rot))
(cond
(*math-camera*
(set! (-> self fov) (-> *math-camera* fov))
(set! (-> self trans quad) (-> *math-camera* trans quad))
(let* ((v1-6 (-> self inv-camera-rot))
(a3-0 (-> *math-camera* inv-camera-rot))
(a0-6 (-> a3-0 rvec quad))
(a1-1 (-> a3-0 uvec quad))
(a2-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> v1-6 rvec quad) a0-6)
(set! (-> v1-6 uvec quad) a1-1)
(set! (-> v1-6 fvec quad) a2-0)
(set! (-> v1-6 trans quad) a3-1)
)
)
(else
(set! (-> self fov) 11650.845)
)
)
(set! (-> self interp-val) 1.0)
(set! (-> self interp-step) 0.125)
(set! (-> self tracking-status) (the-as uint 0))
(set! (-> self fast-rot) #f)
(init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25)
(init
(-> self tracking follow-height-extra)
(-> *setting-control* cam-current extra-follow-height)
81.92
819.2
0.5
)
(vector-reset! (-> self velocity))
(go cam-combiner-active)
0
(none)
)
@@ -7,3 +7,104 @@
;; DECOMP BEGINS
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(vector-float*! arg0 (-> *math-camera* inv-camera-rot fvec) arg1)
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot uvec) arg2)
(vector+! arg0 arg0 (-> *math-camera* trans))
arg0
)
(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector))
(let ((a2-1 (vector-negate! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec)))
(a1-3 (vector-float*! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec) arg1))
)
(vector+! a1-3 a1-3 (-> *math-camera* trans))
(reverse-transform-point! arg0 a1-3 a2-1 arg2)
)
arg0
)
(defun matrix-local->world ((arg0 symbol) (arg1 symbol))
(if arg0
(-> *math-camera* inv-camera-rot-smooth)
(-> *math-camera* inv-camera-rot)
)
)
(defun matrix-world->local ((arg0 symbol) (arg1 object))
(-> *math-camera* camera-rot)
)
(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
(defun camera-pos ()
(cond
(*camera-combiner*
(-> *camera-combiner* trans)
)
(*math-camera*
(-> *math-camera* trans)
)
(else
*camera-dummy-vector*
)
)
)
(defun math-camera-pos ()
(-> *math-camera* trans)
)
(defun camera-matrix ()
(if *camera-combiner*
(-> *camera-combiner* inv-camera-rot)
(-> *math-camera* inv-camera-rot)
)
)
(defun math-camera-matrix ()
(-> *math-camera* inv-camera-rot)
)
(defun camera-angle ()
(let ((f0-0 (-> *math-camera* camera-rot rvec x))
(f1-0 (-> *math-camera* camera-rot rvec z))
)
(atan f1-0 f0-0)
)
)
;; WARN: Return type mismatch object vs symbol.
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
(let ((gp-0 (new 'stack 'transformq)))
(set! (-> gp-0 trans quad) (-> arg0 extra trans quad))
(quaternion-copy! (-> gp-0 quat) (-> arg0 quat))
(vector-identity! (-> gp-0 scale))
(the-as symbol (send-event *camera* 'teleport-to-transformq gp-0))
)
)
(defun camera-teleport-to-entity-named ((arg0 string))
(let* ((gp-0 (entity-by-name arg0))
(a0-3 (if (type? gp-0 entity-actor)
gp-0
)
)
)
(if a0-3
(camera-teleport-to-entity (the-as entity-actor a0-3))
(format #t "sorry, couldn't find an actor named '~S'~%" arg0)
)
)
0
(none)
)
(defun camera-teleport-to-location ((arg0 float) (arg1 float) (arg2 float))
(let ((v1-1 (new 'stack 'transformq)))
(set-vector! (-> v1-1 trans) (* 4096.0 arg0) (* 4096.0 arg1) (* 4096.0 arg2) 1.0)
(send-event *camera* 'teleport-to-transformq v1-1)
)
0
(none)
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -7,3 +7,416 @@
;; 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) (camera-blend-from-type unknown-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-no-clear 'matrix)))
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x)))
(vector-matrix*! s4-0 (-> self tracking inv-mat fvec) 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 matrix) (arg1 vector) (arg2 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((v1-0 (new 'stack-no-clear 'vector)))
(vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1))
(if (< (-> *camera* interest-dist) 409.6)
(set! (-> *camera* interest-dist) 409.6)
)
(let ((s3-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(let ((a0-9 (new 'stack-no-clear 'vector)))
0.0
(let ((a1-3 a0-9))
(let ((a2-4 (-> *math-camera* trans)))
(let ((a3-0 (-> arg0 fvec)))
(let ((t0-1 (-> *camera* interest-dist)))
(.mov vf7 t0-1)
)
(.lvf vf5 (&-> a3-0 quad))
)
(.lvf vf4 (&-> a2-4 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-3 quad) vf6)
)
(vector-! s3-0 (-> *math-camera* trans) a0-9)
)
(vector-length s3-0)
(cond
((mouse-hold? left)
(let ((f30-0 (* 72.81778 (-> *mouse* speedy)))
(f28-0 (* -72.81778 (-> *mouse* speedx)))
)
(let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0)))
(vector-orient-by-quat! s2-0 s3-0 a2-8)
)
(let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0)))
(vector-orient-by-quat! s2-0 s2-0 a2-10)
)
(vector-! s2-0 s2-0 s3-0)
(vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0))
(+! (-> arg2 x) (-> s2-0 x))
(+! (-> arg2 y) (-> s2-0 y))
(+! (-> arg2 z) (-> s2-0 z))
(+! (-> arg1 x) f30-0)
(set! (-> arg1 y) (+ (-> arg1 y) f28-0))
)
)
((mouse-hold? right)
(+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed)))
(set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x))))
(if (< (-> *camera* interest-dist) 409.6)
(set! (-> *camera* interest-dist) 409.6)
)
(when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0))
(let ((t0-2 (new 'static 'vector :w 1.0)))
(let ((v1-18 t0-2))
(let ((a0-33 (-> *setting-control* cam-current mouse-tumble-point)))
(let ((a1-12 (-> arg0 fvec)))
(let ((a2-13 8192.0))
(.mov vf7 a2-13)
)
(.lvf vf5 (&-> a1-12 quad))
)
(.lvf vf4 (&-> a0-33 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 (&-> v1-18 quad) vf6)
)
(set-setting! 'mouse-tumble-point 'abs t0-2 0)
)
)
)
((mouse-hold? middle)
(+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed)))
(+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))
(new 'static 'vector :w 1.0)
#f
)
)
)
)
)
)
(defun cam-free-floating-input ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int) (arg4 int))
(with-pp
(when *camera*
(if (-> *setting-control* cam-current mouse-input)
(cam-mouse-input arg0 arg1 arg2)
)
(let ((s3-0 (and (-> *setting-control* cam-current cpad1-skip-buttons) (= arg4 1)))
(f30-0 (-> *CAM_FREE-bank* speed))
)
(if *camera-turbo-free*
(set! f30-0 (* 10.0 f30-0))
)
(cond
((logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))
)
((cpad-hold? arg4 r2)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 r1)
(+! (-> arg2 y)
(+ (* 0.2 f30-0)
(analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 9)) 0.0 32.0 230.0 (* 0.2 f30-0))
)
)
)
)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 l1)
(set! (-> arg2 y)
(- (-> arg2 y)
(+ (* 0.2 f30-0)
(analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 8)) 0.0 32.0 230.0 (* 0.2 f30-0))
)
)
)
)
)
)
(else
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 r1)
(+! (-> arg2 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 9)) 0.0 32.0 230.0 f30-0))
)
)
)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 l1)
(set! (-> arg2 y)
(- (-> arg2 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 8)) 0.0 32.0 230.0 f30-0))
)
)
)
)
)
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((f26-2 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 leftx))
128.0
48.0
110.0
-1.0
)
)
(f28-4 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 lefty))
128.0
48.0
110.0
-1.0
)
)
(f24-0 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 rightx))
128.0
48.0
110.0
-1.0
)
)
(f0-19 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 righty))
128.0
48.0
110.0
-1.0
)
)
)
(cond
((and (not s3-0)
(logtest? (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 button0-abs 0)
(pad-buttons r2)
)
)
(cond
((logtest? (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 button0-abs 0)
(pad-buttons l2)
)
(set! (-> arg1 y) (- (-> arg1 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
(set! (-> arg1 x) (- (-> arg1 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f0-19))))
)
(else
(set! (-> arg1 y) (- (-> arg1 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))))
(set! (-> arg1 x) (- (-> arg1 x) (* (- f0-19) (-> *CAM_FREE-bank* rot-speed))))
)
)
(+! (-> arg2 x) (* 0.2 f30-0 f26-2))
(+! (-> arg2 z) (* 0.2 f30-0 f28-4))
)
((and (not s3-0) (cpad-hold? arg4 l2))
(+! (-> arg2 x) (* f26-2 f30-0))
(+! (-> arg2 y) (* f0-19 f30-0))
(+! (-> arg2 z) (* f28-4 f30-0))
)
(else
(set! (-> arg1 y) (- (-> arg1 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
(set! (-> arg1 x) (- (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-19))))
(+! (-> arg2 x) (* 2.0 f30-0 f26-2))
(+! (-> arg2 z) (* 2.0 f30-0 f28-4))
)
)
)
)
)
(when (not (-> *setting-control* cam-current mouse-input))
(vector-float*! arg1 arg1 (-> pp clock time-adjust-ratio))
(vector-float*! arg2 arg2 (-> 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 arg0 (-> s3-0 rv) (-> s3-0 tv) (the-as int (not arg2)) arg3)
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0)
(cond
(arg2
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
(matrix*! arg0 arg0 (-> s3-0 tm))
(cond
((< (vector-dot (-> arg0 uvec) arg2) 0.0)
(forward-down->inv-matrix arg0 (-> arg0 fvec) arg2)
)
(else
(vector-negate! (-> s3-0 up) arg2)
(forward-down->inv-matrix arg0 (-> arg0 fvec) (-> s3-0 up))
)
)
)
(else
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 uvec) (- (-> s3-0 rv y)))
(matrix*! arg0 arg0 (-> s3-0 tm))
)
)
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 rvec) (- (-> s3-0 rv x)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 fvec) (- (-> s3-0 rv z)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(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) (camera-blend-from-type unknown-1))
(set! (-> self blend-to-type) (camera-blend-to-type unknown-1))
(send-event *camera-combiner* 'stop-tracking)
)
)
:code (behavior ()
(until #f
(let ((gp-0 (-> *camera* local-down)))
(if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))
(set! gp-0 (the-as vector #f))
)
(when (not (-> *setting-control* cam-current mouse-input))
(if *amy-cam*
(matrix-rotate-y! (the-as matrix (-> self tracking)) 32768.0)
)
(cam-free-floating-move
(the-as matrix (-> self tracking))
(-> self trans)
gp-0
(the-as int (-> *CAMERA-bank* joypad))
)
(when *amy-cam*
(matrix-rotate-y! (the-as matrix (-> self tracking)) 32768.0)
(let ((a1-4 (matrix-rotate-x! (new 'stack-no-clear 'matrix) 16384.0)))
(matrix*! (the-as matrix (-> self tracking)) a1-4 (the-as matrix (-> self tracking)))
)
)
)
)
(suspend)
)
#f
)
)
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -34,9 +34,9 @@
(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control)))
(define-perm *camera-smush-control-horizontal* object (set-zero! (new 'global 'smush-control)))
(define-perm *camera-smush-control-horizontal* smush-control (set-zero! (new 'global 'smush-control)))
(define-perm *camera-smush-control-into* object (set-zero! (new 'global 'smush-control)))
(define-perm *camera-smush-control-into* smush-control (set-zero! (new 'global 'smush-control)))
(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
+692
View File
@@ -7,3 +7,695 @@
;; DECOMP BEGINS
(defun plane-from-points ((arg0 (inline-array plane)) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 int))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-cross! s4-0 arg1 arg2)
(vector-normalize! s4-0 1.0)
(set! (-> s4-0 w) (vector-dot s4-0 arg3))
(set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x))
(set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y))
(set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z))
(set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w))
)
)
(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(set! (-> arg0 x) arg1)
(set! (-> arg0 y) arg2)
(set! (-> arg0 z) arg3)
(set! (-> arg0 w) 1.0)
)
(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix))
(local-vars (sv-240 vector))
(when (not *artist-fix-frustum*)
(let ((s5-0 (new 'stack 'view-frustum)))
(let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d)))
(f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d)))
(f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f)))
(f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f)))
)
(set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d))
(set-point (-> s5-0 hither-bottom-right) f30-0 (- f26-0) (-> arg0 d))
(set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f))
(set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f))
)
(vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) arg3)
(vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-right) (-> s5-0 hither-bottom-right) arg3)
(vector-matrix*! (-> s5-0 yon-top-left) (-> s5-0 yon-top-left) arg3)
(vector-matrix*! (-> s5-0 yon-top-right) (-> s5-0 yon-top-right) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3)
(when (= arg2 1.0)
(let ((v1-4 *fog-texture-work*))
(vector-! (the-as vector (-> v1-4 corner)) (-> s5-0 yon-top-left) (-> arg3 trans))
(vector-! (-> v1-4 corner 1) (-> s5-0 yon-top-right) (-> arg3 trans))
(vector-! (-> v1-4 corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans))
(vector-! (-> v1-4 corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans))
)
)
(let ((s2-1 (new-stack-vector0))
(s3-1 (new-stack-vector0))
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0))
)
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(set! sv-240 (new 'stack-no-clear 'vector))
(set! (-> sv-240 quad) (the-as uint128 0))
(let ((v1-9 (-> arg3 trans quad)))
(set! (-> sv-240 quad) v1-9)
)
(vector-! s2-1 (-> s5-0 yon-top-left) sv-240)
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
(vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240)
(plane-from-points arg1 s2-1 s1-0 sv-240 0)
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
(plane-from-points arg1 s3-1 s2-1 sv-240 2)
(let ((t9-20 plane-from-points)
(t0-3 3)
)
(t9-20 arg1 s1-0 s0-0 sv-240 t0-3)
)
)
)
)
)
(define *update-leaf-when-outside-bsp* #t)
(defun update-visible ((arg0 math-camera))
(local-vars (s4-0 level-vis-info))
(when (not *artist-fix-visible*)
(dotimes (s5-0 (-> *level* length))
(let ((v1-5 (-> *level* level s5-0)))
(when (= (-> v1-5 status) 'active)
(if (and (nonzero? (-> v1-5 bsp nodes)) (or *update-leaf-when-outside-bsp* (-> v1-5 inside-boxes?)))
(bsp-camera-asm (-> v1-5 bsp) (-> arg0 trans))
)
)
)
)
(dotimes (gp-1 (-> *level* length))
(let ((s5-1 (-> *level* level gp-1)))
(when (= (-> s5-1 status) 'active)
(let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16)))
(set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?)
(-> s5-1 all-visible?)
#t
)
)
(cond
((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?))
(cond
((or *artist-all-visible* (not (-> s5-1 vis-info 0)))
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
(if (= (-> s5-1 all-visible?) 'loading)
(set! (-> s5-1 all-visible?) #t)
)
)
((begin
(set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index)))
(let ((v1-32 #f))
(when (and s4-0 (-> s4-0 from-bsp))
(set! v1-32 (logtest? (vis-info-flag vis-valid) (-> s4-0 flags)))
(if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx))
(set! v1-32 #f)
)
)
v1-32
)
)
(if (!= (-> s5-1 all-visible?) 'loading)
(set! (-> s5-1 all-visible?) #f)
)
(when (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (the-as (pointer uint8) (-> s4-0 string-block)))
(countdown (v1-40 8)
(let ((a0-27 (-> s5-1 vis-info v1-40)))
(when a0-27
(if (!= a0-27 s4-0)
(set! (-> a0-27 current-vis-string) (the-as uint -1))
)
)
)
)
(set! (-> s5-1 all-visible?) #f)
)
)
((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?))
)
(else
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
)
)
)
(else
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
)
)
)
)
)
)
)
(let ((gp-2 0))
(if (and *artist-fix-visible* (cpad-pressed? 0 r2))
(set! *fix-visible-level-mask* (logand (+ *fix-visible-level-mask* 1) 127))
)
(dotimes (s5-2 (-> *level* length))
(let ((s4-1 (-> *level* level s5-2)))
(when (= (-> s4-1 status) 'active)
(cond
((or *artist-fix-visible* *stats-bsp*)
(set! (-> s4-1 render?) (not (logtest? *fix-visible-level-mask* (ash 1 gp-2))))
(if (!= (-> s4-1 bsp visible-list-length) 4)
(format
*stdcon*
"~0kleaf-index ~8S ~C = ~d node ~d ~S ~S~%"
(-> s4-1 name)
(if (not (logtest? *fix-visible-level-mask* (ash 1 gp-2)))
88
32
)
(-> s4-1 bsp current-leaf-idx)
(-> s4-1 bsp cam-box-idx)
(if (zero? (-> s4-1 bsp cam-using-back))
"front"
"back"
)
(if (nonzero? (-> s4-1 bsp cam-outside-bsp))
"outside"
""
)
)
)
)
(else
(set! (-> s4-1 render?) #t)
)
)
(when (and *artist-fix-visible* (not (logtest? *fix-visible-level-mask* (ash 1 gp-2))))
(let ((s3-0 (-> s4-1 bsp current-leaf-idx))
(s2-0 (-> s4-1 bsp vis-spheres))
)
(-> s4-1 bsp vis-spheres-length)
(when (nonzero? s2-0)
(dotimes (s1-0 (-> s2-0 length))
(let* ((v1-95 (the int (-> s2-0 data s1-0 w)))
(a0-45 (abs v1-95))
)
(when (= a0-45 s3-0)
(if (>= v1-95 0)
(add-debug-sphere #t (bucket-id bucket583) (-> s2-0 data s1-0) (meters 1) (new 'static 'rgba :b #xff :a #x80))
(add-debug-sphere #t (bucket-id bucket583) (-> s2-0 data s1-0) (meters 1) (new 'static 'rgba :r #xff :a #x80))
)
)
)
)
)
)
(when (nonzero? (-> s4-1 bsp nodes))
(let ((v1-109 (-> s4-1 bsp nodes (-> s4-1 bsp cam-box-idx)))
(a2-7 (new 'stack-no-clear 'vector))
)
(set! (-> a2-7 quad) (-> s4-1 bsp bsp-offset quad))
(let ((a3-6 (new 'stack-no-clear 'vector)))
(set! (-> a3-6 quad) (-> s4-1 bsp bsp-offset quad))
(cond
((zero? (-> s4-1 bsp cam-using-back))
(+! (-> a2-7 x) (the float (* (-> v1-109 front-box-min x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a2-7 y) (the float (* (-> v1-109 front-box-min y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a2-7 z) (the float (* (-> v1-109 front-box-min z) (the int (-> s4-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-109 front-box-max x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-109 front-box-max y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-109 front-box-max z) (the int (-> s4-1 bsp bsp-scale z)))))
)
(else
(+! (-> a2-7 x) (the float (* (-> v1-109 back-box-min x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a2-7 y) (the float (* (-> v1-109 back-box-min y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a2-7 z) (the float (* (-> v1-109 back-box-min z) (the int (-> s4-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-109 back-box-max x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-109 back-box-max y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-109 back-box-max z) (the int (-> s4-1 bsp bsp-scale z)))))
)
)
(add-debug-box #t (bucket-id bucket583) a2-7 a3-6 (new 'static 'rgba :g #xff :b #xff :a #x80))
)
)
)
)
(if (!= (-> s4-1 bsp visible-list-length) 4)
(+! gp-2 1)
)
)
)
)
)
#f
)
(define *save-camera-inv-rot* (new 'global 'matrix))
(matrix-identity! *save-camera-inv-rot*)
(defun move-camera-from-pad ((arg0 math-camera))
(let ((v1-0 *external-cam-mode*)
(s5-0 0)
)
(cond
((= v1-0 'locked)
(set! v1-0 #f)
)
((= v1-0 'pad-1)
(set! s5-0 1)
)
((not *camera-combiner*)
(set! v1-0 'pad-0)
)
)
(when v1-0
(let ((a2-1
(vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0))
)
)
(if (= (vector-length a2-1) 0.0)
(set! (-> a2-1 y) -1.0)
)
(if (logtest? *external-cam-options* (external-cam-option allow-z))
(set! a2-1 (the-as vector #f))
)
(cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) a2-1 s5-0)
)
)
)
(let* ((a2-2 (-> *math-camera* inv-camera-rot))
(a3-1 *save-camera-inv-rot*)
(v1-14 (-> a3-1 rvec quad))
(a0-13 (-> a3-1 uvec quad))
(a1-2 (-> a3-1 fvec quad))
(a3-2 (-> a3-1 trans quad))
)
(set! (-> a2-2 rvec quad) v1-14)
(set! (-> a2-2 uvec quad) a0-13)
(set! (-> a2-2 fvec quad) a1-2)
(set! (-> a2-2 trans quad) a3-2)
)
arg0
)
(defun external-cam-reset! ()
(when (not (movie?))
(vector-reset! (-> *math-camera* trans))
(matrix-identity! (-> *math-camera* inv-camera-rot))
(when *camera-combiner*
(let* ((v1-7 (-> *math-camera* inv-camera-rot))
(a3-0 (-> *camera-combiner* inv-camera-rot))
(a0-2 (-> a3-0 rvec quad))
(a1-0 (-> a3-0 uvec quad))
(a2-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> v1-7 rvec quad) a0-2)
(set! (-> v1-7 uvec quad) a1-0)
(set! (-> v1-7 fvec quad) a2-0)
(set! (-> v1-7 trans quad) a3-1)
)
(set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))
)
)
0
(none)
)
(define *start-timer* (the-as int #f))
(define *timer-value* 0)
(define *start-pos* (new 'global 'vector))
(defun update-camera ()
(with-pp
(let ((gp-0 *math-camera*))
(let* ((a2-0 (-> gp-0 prev-inv-camera-rot))
(a3-0 (-> gp-0 inv-camera-rot))
(v1-0 (-> a3-0 rvec quad))
(a0-0 (-> a3-0 uvec quad))
(a1-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> a2-0 rvec quad) v1-0)
(set! (-> a2-0 uvec quad) a0-0)
(set! (-> a2-0 fvec quad) a1-0)
(set! (-> a2-0 trans quad) a3-1)
)
(set! (-> gp-0 prev-trans quad) (-> gp-0 trans quad))
(when *start-timer*
(when (= *timer-value* 180)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> *target* control trans x)
(-> *target* control trans y)
(-> *target* control trans z)
)
(set! (-> *start-pos* quad) (-> *target* control trans quad))
)
(when (= *timer-value* 480)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> *target* control trans x)
(-> *target* control trans y)
(-> *target* control trans z)
)
(format
#t
"Dist = ~F~%"
(* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*))
)
(set! *start-timer* (the-as int #f))
)
(if (< 179 *timer-value*)
(format *stdcon* "~%~%Time = ~D~%" *timer-value*)
)
(set! *timer-value* (+ *timer-value* 1))
)
(when (not *start-timer*)
(set! *timer-value* 0)
0
)
(let ((f0-9 (if (get-menu-mode *blit-displays-work*)
11650.845
(-> gp-0 fov)
)
)
)
(update-math-camera
gp-0
(-> *setting-control* user-current video-mode)
(-> *setting-control* user-current aspect-ratio)
f0-9
)
)
(cond
((or (= *master-mode* 'pause) (or (= *master-mode* 'freeze) (= *master-mode* 'progress) *progress-process*))
)
((>= *camera-look-through-other* 2)
(set! *camera-look-through-other* 1)
)
((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu))
(set! *camera-look-through-other* 0)
0
)
)
0.0
0.0
0.0
(let ((s5-1 (new 'stack-no-clear 'vector))
(s4-1 (-> pp clock))
)
(set! (-> pp clock) (-> *display* camera-clock))
(update! *camera-smush-control*)
(let ((f28-0 (get-no-update *camera-smush-control*)))
(update! *camera-smush-control-horizontal*)
(let ((f30-1 (get-no-update *camera-smush-control-horizontal*)))
(update! *camera-smush-control-into*)
(get-no-update *camera-smush-control-into*)
(set! (-> pp clock) s4-1)
(cond
(*external-cam-mode*
(move-camera-from-pad gp-0)
)
((nonzero? *camera-look-through-other*)
(set! (-> gp-0 fov) (-> *camera-other-fov* data))
(set! (-> gp-0 trans quad) (-> *camera-other-trans* quad))
(+! (-> gp-0 trans y) f28-0)
(let* ((a2-6 (-> gp-0 inv-camera-rot))
(a3-5 *camera-other-matrix*)
(v1-76 (-> a3-5 rvec quad))
(a0-34 (-> a3-5 uvec quad))
(a1-7 (-> a3-5 fvec quad))
(a3-6 (-> a3-5 trans quad))
)
(set! (-> a2-6 rvec quad) v1-76)
(set! (-> a2-6 uvec quad) a0-34)
(set! (-> a2-6 fvec quad) a1-7)
(set! (-> a2-6 trans quad) a3-6)
)
(let* ((a2-7 *save-camera-inv-rot*)
(a3-7 *camera-other-matrix*)
(v1-77 (-> a3-7 rvec quad))
(a0-35 (-> a3-7 uvec quad))
(a1-8 (-> a3-7 fvec quad))
(a3-8 (-> a3-7 trans quad))
)
(set! (-> a2-7 rvec quad) v1-77)
(set! (-> a2-7 uvec quad) a0-35)
(set! (-> a2-7 fvec quad) a1-8)
(set! (-> a2-7 trans quad) a3-8)
)
)
((and *camera-combiner* (not *external-cam-mode*))
(set! (-> gp-0 fov) (-> *camera-combiner* fov))
(set! (-> gp-0 trans quad) (-> *camera-combiner* trans quad))
(+! (-> gp-0 trans y) f28-0)
(let* ((v1-84 (-> gp-0 inv-camera-rot))
(a3-9 (-> *camera-combiner* inv-camera-rot))
(a0-40 (-> a3-9 rvec quad))
(a1-9 (-> a3-9 uvec quad))
(a2-8 (-> a3-9 fvec quad))
(a3-10 (-> a3-9 trans quad))
)
(set! (-> v1-84 rvec quad) a0-40)
(set! (-> v1-84 uvec quad) a1-9)
(set! (-> v1-84 fvec quad) a2-8)
(set! (-> v1-84 trans quad) a3-10)
)
(let* ((v1-85 *save-camera-inv-rot*)
(a3-11 (-> *camera-combiner* inv-camera-rot))
(a0-42 (-> a3-11 rvec quad))
(a1-10 (-> a3-11 uvec quad))
(a2-9 (-> a3-11 fvec quad))
(a3-12 (-> a3-11 trans quad))
)
(set! (-> v1-85 rvec quad) a0-42)
(set! (-> v1-85 uvec quad) a1-10)
(set! (-> v1-85 fvec quad) a2-9)
(set! (-> v1-85 trans quad) a3-12)
)
)
(*camera*
(move-camera-from-pad gp-0)
)
)
(when (or (nonzero? *camera-look-through-other*) (and *camera-combiner* (not *external-cam-mode*)))
0.0
(set-vector! s5-1 f30-1 0.0 0.0 1.0)
(vector-rotate*! s5-1 s5-1 (-> gp-0 inv-camera-rot))
(set! (-> s5-1 y) 0.0)
(vector+! (-> gp-0 trans) (-> gp-0 trans) s5-1)
)
)
)
)
(matrix-transpose! (-> gp-0 camera-rot) (-> gp-0 inv-camera-rot))
(cond
(*camera-no-mip-correction*
(set! (-> gp-0 fov-correction-factor) 1.0)
)
(else
(let ((f0-27 (fmin 11650.845 (-> gp-0 fov))))
(set! (-> gp-0 fov-correction-factor) (* 0.00008583069 f0-27))
)
)
)
(if (< 0.0 (-> gp-0 smooth-t))
(set! (-> gp-0 smooth-t) (- (-> gp-0 smooth-t) (-> gp-0 smooth-step)))
)
(cond
((< 0.0 (-> gp-0 smooth-t))
(let ((s5-2 (new-stack-quaternion0)))
(matrix->quaternion s5-2 (-> gp-0 inv-camera-rot))
(quaternion-slerp! s5-2 s5-2 (-> gp-0 inv-camera-rot-smooth-from) (-> gp-0 smooth-t))
(quaternion->matrix (-> gp-0 inv-camera-rot-smooth) s5-2)
)
)
(else
(let* ((a2-12 (-> gp-0 inv-camera-rot-smooth))
(a3-14 (-> gp-0 inv-camera-rot))
(v1-106 (-> a3-14 rvec quad))
(a0-51 (-> a3-14 uvec quad))
(a1-16 (-> a3-14 fvec quad))
(a3-15 (-> a3-14 trans quad))
)
(set! (-> a2-12 rvec quad) v1-106)
(set! (-> a2-12 uvec quad) a0-51)
(set! (-> a2-12 fvec quad) a1-16)
(set! (-> a2-12 trans quad) a3-15)
)
)
)
(when (and (!= *master-mode* 'menu) *display-camera-info*)
(when *target*
(let ((v1-112 (target-pos 0)))
(format *stdcon* "targ pos ~M ~M ~M~%" (-> v1-112 x) (-> v1-112 y) (-> v1-112 z))
)
)
(format
*stdcon*
"cam pos ~M ~M ~M fov ~R~%"
(-> gp-0 trans x)
(-> gp-0 trans y)
(-> gp-0 trans z)
(-> gp-0 fov)
)
(let ((v1-115 (-> *setting-control* cam-current)))
(format
*stdcon*
"string info min-l ~M max-l ~M min-h ~M max-h ~M~%"
(-> v1-115 string-min-length)
(-> v1-115 string-max-length)
(-> v1-115 string-min-height)
(-> v1-115 string-max-height)
)
)
)
(when (zero? (-> gp-0 reset))
(let* ((a2-16 (-> gp-0 prev-camera-temp))
(a3-19 (-> gp-0 camera-temp))
(v1-119 (-> a3-19 rvec quad))
(a0-58 (-> a3-19 uvec quad))
(a1-20 (-> a3-19 fvec quad))
(a3-20 (-> a3-19 trans quad))
)
(set! (-> a2-16 rvec quad) v1-119)
(set! (-> a2-16 uvec quad) a0-58)
(set! (-> a2-16 fvec quad) a1-20)
(set! (-> a2-16 trans quad) a3-20)
)
)
(let ((s3-1 (-> gp-0 camera-temp))
(s2-0 (-> gp-0 camera-rot))
(s5-3 (-> gp-0 inv-camera-rot))
(s4-2 (-> gp-0 trans))
)
(let ((s1-0 (new-stack-vector0)))
(set! (-> s1-0 x) (- (-> s4-2 x)))
(set! (-> s1-0 y) (- (-> s4-2 y)))
(set! (-> s1-0 z) (- (-> s4-2 z)))
(set! (-> s1-0 w) 1.0)
(vector-matrix*! s1-0 s1-0 s2-0)
(set! (-> s2-0 trans quad) (-> s1-0 quad))
)
(matrix*! s3-1 s2-0 (-> gp-0 perspective))
(set! (-> s5-3 trans quad) (-> s4-2 quad))
)
(when (nonzero? (-> gp-0 reset))
(let* ((a2-19 (-> gp-0 prev-camera-temp))
(a3-21 (-> gp-0 camera-temp))
(v1-125 (-> a3-21 rvec quad))
(a0-61 (-> a3-21 uvec quad))
(a1-23 (-> a3-21 fvec quad))
(a3-22 (-> a3-21 trans quad))
)
(set! (-> a2-19 rvec quad) v1-125)
(set! (-> a2-19 uvec quad) a0-61)
(set! (-> a2-19 fvec quad) a1-23)
(set! (-> a2-19 trans quad) a3-22)
)
(set! (-> gp-0 reset) 0)
0
)
(let ((f1-5 (-> gp-0 fog-min))
(f0-52 (-> gp-0 fog-max))
)
(let ((f2-0 (-> gp-0 d)))
(set! (-> *instance-tie-work* hmge-d x) f1-5)
(set! (-> *instance-tie-work* hmge-d y) f0-52)
(set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0))
(set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(let ((v1-132 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-tie-work* hvdf-offset quad) v1-132)
)
(set! (-> *instance-shrub-work* hmge-d x) f1-5)
(set! (-> *instance-shrub-work* hmge-d y) f0-52)
(set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0))
(set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(set! (-> *instance-shrub-work* billboard-const x) (/ (-> gp-0 x-pix) (* f2-0 (-> gp-0 x-ratio))))
(set! (-> *instance-shrub-work* billboard-const y) (/ (-> gp-0 y-pix) (* f2-0 (-> gp-0 y-ratio))))
)
(set! (-> *instance-shrub-work* billboard-const z) f1-5)
(set! (-> *instance-shrub-work* billboard-const w) f0-52)
)
(set! (-> *instance-shrub-work* constants w) (the-as float (-> gp-0 vis-gifs 0)))
(let ((a0-63 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-shrub-work* hvdf-offset quad) a0-63)
)
(update-view-planes gp-0 (-> gp-0 plane) 1.0 (-> gp-0 inv-camera-rot))
(update-view-planes gp-0 (-> gp-0 guard-plane) 2.0 (-> gp-0 inv-camera-rot))
(shrub-make-perspective-matrix (-> gp-0 shrub-mat) (-> gp-0 camera-temp))
(update-visible gp-0)
(when (-> *time-of-day-context* use-camera-other)
(let ((s4-3 (-> gp-0 camera-rot))
(s0-0 (-> gp-0 camera-rot-other-sky))
(s5-4 (-> gp-0 camera-rot-other-sprite))
(s3-2 (-> gp-0 camera-rot-other))
(s2-1 (-> gp-0 inv-camera-rot-other))
(s1-1 (-> gp-0 camera-temp-other))
)
(quaternion->matrix s0-0 (-> gp-0 quat-other))
(mem-copy! (the-as pointer s5-4) (the-as pointer s0-0) 64)
(set! (-> s5-4 trans quad) (-> gp-0 trans-other quad))
(set! (-> s5-4 trans w) 1.0)
(matrix*! s3-2 s5-4 s4-3)
(matrix-inverse-of-rot-trans! s2-1 s3-2)
(matrix*! s1-1 s3-2 (-> gp-0 perspective))
(update-view-planes gp-0 (-> gp-0 plane-other) 1.0 s2-1)
(update-view-planes gp-0 (-> gp-0 guard-plane-other) 2.0 s2-1)
(shrub-make-perspective-matrix (-> gp-0 shrub-mat-other) s1-1)
)
)
)
#f
)
)
(defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float))
(let ((v1-1 (level-get *level* arg0)))
(when v1-1
(logior! (-> v1-1 info level-flags) (level-flags lf10))
(let ((v0-1 (-> *math-camera* trans-other)))
(set! (-> v0-1 x) (* 4096.0 arg1))
(set! (-> v0-1 y) (* 4096.0 arg2))
(set! (-> v0-1 z) (* 4096.0 arg3))
(set! (-> v0-1 w) 1.0)
v0-1
)
)
)
)
(defun execute-cam-post-hook-engine ()
(let* ((gp-0 *cam-post-hook-engine*)
(s5-0 (-> gp-0 alive-list next0))
(s4-0 (-> s5-0 next0))
)
(while (!= s5-0 (-> gp-0 alive-list-end))
((the-as (function object object object object object) (-> (the-as connection s5-0) param0))
(get-process (the-as connection s5-0))
(-> (the-as connection s5-0) param1)
(-> (the-as connection s5-0) param2)
(-> (the-as connection s5-0) param2)
)
(set! s5-0 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
+55 -25
View File
@@ -9,8 +9,8 @@
(defenum cam-index-options
:type uint32
:bitfield #t
(RADIAL)
(SPHERICAL)
(RADIAL)
)
;; ---cam-index-options
@@ -66,6 +66,36 @@
(define-extern cam-stop (function symbol))
(define-extern cam-start (function symbol none))
(declare-type camera-slave process)
(declare-type cam-rotation-tracker structure)
(declare-type camera-master process)
;; camera
(define-extern camera-line-rel-len (function vector vector float vector4w none))
(define-extern camera-slave-debug (function camera-slave none))
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
(define-extern slave-set-rotation! (function cam-rotation-tracker vector cam-slave-options-u32 float symbol none))
(define-extern cam-master-effect (function none :behavior camera-master))
(define-extern camera-master-debug (function camera-master none))
;; cam-master
(define-extern group-rain-screend-drop sparticle-launch-group)
;; cam-states
(define-extern cam-debug-reset-coll-tri (function none))
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none))
(define-extern slave-los-state->string (function slave-los-state string))
;; cam-layout
(define-extern camera-line-setup (function vector4w none))
(define-extern camera-line-draw (function vector vector none))
(define-extern camera-line (function vector vector vector4w none))
(define-extern camera-cross (function vector vector vector vector4w meters none))
(define-extern camera-fov-frame (function matrix vector float float float vector4w symbol))
(define-extern cam-slave-options->string (function cam-slave-options object string))
(define-extern cam-index-options->string (function cam-index-options object string))
;; DECOMP BEGINS
(deftype cam-index (structure)
@@ -73,8 +103,8 @@
(vec vector 2 :inline)
)
(:methods
(cam-index-method-9 () none)
(cam-index-method-10 () none)
(cam-index-method-9 (_type_ symbol entity vector curve) symbol)
(cam-index-method-10 (_type_ vector) float)
)
)
@@ -113,21 +143,21 @@
(debug-last-point int32)
)
(:methods
(tracking-spline-method-9 () none)
(tracking-spline-method-10 () none)
(tracking-spline-method-11 () none)
(tracking-spline-method-12 () none)
(tracking-spline-method-13 () none)
(tracking-spline-method-14 () none)
(tracking-spline-method-15 () none)
(tracking-spline-method-16 () none)
(tracking-spline-method-17 () none)
(tracking-spline-method-18 () none)
(tracking-spline-method-19 () none)
(tracking-spline-method-20 () none)
(tracking-spline-method-21 () none)
(tracking-spline-method-22 () none)
(tracking-spline-method-23 () none)
(tracking-spline-method-9 (_type_) none)
(tracking-spline-method-10 (_type_ vector) none)
(debug-point-info (_type_ int) none)
(debug-all-points (_type_) none)
(tracking-spline-method-13 (_type_ int) none)
(tracking-spline-method-14 (_type_ tracking-spline-sampler) none)
(tracking-spline-method-15 (_type_) none)
(tracking-spline-method-16 (_type_ float) none)
(tracking-spline-method-17 (_type_ vector float float symbol) int)
(tracking-spline-method-18 (_type_ float vector vector tracking-spline-sampler) vector)
(tracking-spline-method-19 (_type_ float vector vector tracking-spline-sampler) vector)
(tracking-spline-method-20 (_type_ vector int) none)
(tracking-spline-method-21 (_type_ vector float float float float vector) vector)
(tracking-spline-method-22 (_type_ float) symbol)
(debug-draw-spline (_type_) none)
)
)
@@ -324,6 +354,9 @@
(tracking cam-rotation-tracker :inline)
(fast-rot basic)
)
(:states
cam-combiner-active
)
)
@@ -464,12 +497,9 @@
(:methods
(camera-master-method-14 (_type_ vector) vector)
(camera-master-method-15 (_type_ vector) vector)
(camera-master-method-16 () none)
(camera-master-method-16 (_type_ symbol) int)
)
(:states
cam-master-active
)
)
(define-extern cam-slave-go (function (state camera-slave) none :behavior camera-slave))
(define-extern cam-slave-init (function (state camera-slave) entity none :behavior camera-slave))
(define-extern cam-standard-event-handler (function process int symbol event-message-block object :behavior camera-slave))
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
(define-extern slave-set-rotation! (function cam-rotation-tracker vector cam-slave-options-u32 float symbol none))
File diff suppressed because it is too large Load Diff
@@ -5,5 +5,7 @@
;; name in dgo: find-nearest-h
;; dgos: GAME
(define-extern find-nearest-focusable (function (array collide-shape) vector float search-info-flag search-info-flag vector vector float process-focusable))
;; DECOMP BEGINS
+14 -21
View File
@@ -911,28 +911,21 @@
:virtual #t
:code (behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(new 'stack 'trajectory)
(set! (-> self base y) (-> self jump-pos y))
(let ((t9-1 (method-of-type trajectory trajectory-method-12)))
(-> self root trans)
(-> self jump-pos)
#x43960000
-1072586060
(t9-1)
)
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (seconds 1))
(the float (- (current-time) (-> self state-time)))
(let ((t9-2 (method-of-type trajectory trajectory-method-9)))
(-> self root trans)
(t9-2)
)
(transform-post)
(common-post self)
(suspend)
(if (nonzero? (-> self skel))
(ja :num! (loop! 0.5))
(let ((gp-0 (new 'stack 'trajectory)))
(set! (-> self base y) (-> self jump-pos y))
(setup-from-to-duration! gp-0 (-> self root trans) (-> self jump-pos) 300.0 -2.2755556)
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (seconds 1))
(let ((f0-2 (the float (- (current-time) (-> self state-time)))))
(compute-trans-at-time gp-0 f0-2 (-> self root trans))
)
(transform-post)
(common-post self)
(suspend)
(if (nonzero? (-> self skel))
(ja :num! (loop! 0.5))
)
)
)
(set! (-> self root trans quad) (-> self jump-pos quad))
(set! (-> self base quad) (-> self root trans quad))
@@ -3792,11 +3792,7 @@
(go-virtual die)
)
(('reset)
(-> self sync)
(let ((t9-1 (method-of-type sync-linear sync-info-method-15)))
0
(t9-1)
)
(sync-now! (-> self sync) 0.0)
)
(('play)
(sound-play-by-name (-> self spawn-sound) (new-sound-id) 1024 0 0 (sound-group) (-> self pos))
@@ -5,5 +5,7 @@
;; name in dgo: tie-work
;; dgos: GAME
(define-extern *instance-tie-work* instance-tie-work)
;; DECOMP BEGINS
@@ -5,5 +5,7 @@
;; name in dgo: shrub-work
;; dgos: GAME
(define-extern *instance-shrub-work* instance-shrub-work)
;; DECOMP BEGINS
@@ -5,6 +5,8 @@
;; name in dgo: shrubbery-h
;; dgos: GAME
(define-extern shrub-make-perspective-matrix (function matrix matrix matrix))
;; DECOMP BEGINS
(deftype billboard (drawable)
+2
View File
@@ -62,6 +62,8 @@ This probably started as a very simple structure, but now it is extremely compli
(actor-birth-order (pointer uint32) :offset 172)
(region-trees (array drawable-tree-region-prim) :offset 188)
(collide-hash collide-hash :offset 196)
(vis-spheres vector-array :offset 216)
(vis-spheres-length uint32 :offset 248)
(tfrag-masks texture-masks-array :offset 256)
(tfrag-closest (pointer float))
(tfrag-mask-count uint32 :overlay-at tfrag-closest)
+2 -2
View File
@@ -403,7 +403,7 @@
(level-method-13 () none)
(compute-memory-usage! (_type_ symbol) memory-usage-block)
(level-method-15 () none)
(level-method-16 () none)
(update-vis! (_type_ level-vis-info uint (pointer uint8)) symbol)
(level-method-17 () none)
(level-method-18 () none)
(level-method-19 () none)
@@ -471,7 +471,7 @@
(level-group-method-16 () none)
(level-group-method-17 () none)
(level-group-method-18 () none)
(level-group-method-19 () none)
(level-update (_type_) none)
(level-get-target-inside (_type_) level)
(level-group-method-21 () none)
(art-group-get-by-name (_type_ string (pointer level)) art-group)
+1 -1
View File
@@ -179,7 +179,7 @@
(:methods
(nav-control-method-9 () none)
(nav-control-method-10 () none)
(nav-control-method-11 () none)
(find-poly-containing-point-1 (_type_ vector) nav-poly)
(nav-control-method-12 () none)
(nav-control-method-13 () none)
(nav-control-method-14 () none)
+17 -16
View File
@@ -14,15 +14,15 @@
(gravity meters)
)
(:methods
(trajectory-method-9 () none)
(trajectory-method-10 () none)
(trajectory-method-11 () none)
(trajectory-method-12 () none)
(trajectory-method-13 () none)
(trajectory-method-14 () none)
(trajectory-method-15 () none)
(trajectory-method-16 () none)
(trajectory-method-17 () none)
(compute-trans-at-time (_type_ float vector) vector)
(compute-transv-at-time (_type_ float vector) vector)
(compute-time-until-apex (_type_) float)
(setup-from-to-duration! (_type_ vector vector float float) none)
(setup-from-to-xz-vel! (_type_ vector vector float float) none)
(setup-from-to-y-vel! (_type_ vector vector float float) none)
(setup-from-to-height! (_type_ vector vector float float) none)
(setup-from-to-duration-and-height! (_type_ vector vector float float) none)
(debug-draw (_type_) none)
)
)
@@ -39,7 +39,7 @@
(:methods
(new (symbol type process-drawable int float collide-spec) _type_)
(initialize (_type_ process-drawable int float collide-spec) impact-control)
(impact-control-method-10 () none)
(update-from-cspace (_type_) none)
(impact-control-method-11 (_type_ collide-query process pat-surface) float)
)
)
@@ -66,7 +66,7 @@
(:methods
(new (symbol type vector vector) _type_)
(initialize (_type_ vector vector) point-tracker)
(point-tracker-method-10 () none)
(point-tracker-method-10 (_type_ vector vector vector float) vector)
(point-tracker-method-11 (_type_ vector vector vector float) vector)
)
)
@@ -118,12 +118,13 @@
(deftype cubic-curve (structure)
((mat matrix :inline)
(vec vector 4 :inline :overlay-at (-> mat data 0))
)
(:methods
(cubic-curve-method-9 () none)
(cubic-curve-method-10 () none)
(cubic-curve-method-11 () none)
(cubic-curve-method-12 () none)
(cubic-curve-method-13 () none)
(cubic-curve-method-9 (_type_ vector vector vector vector) none)
(cubic-curve-method-10 (_type_ vector float) vector)
(cubic-curve-method-11 (_type_ vector float) vector)
(cubic-curve-method-12 (_type_ vector float) vector)
(debug-draw-curve (_type_) none)
)
)
+508
View File
@@ -7,3 +7,511 @@
;; DECOMP BEGINS
(defmethod compute-trans-at-time ((this trajectory) (arg0 float) (arg1 vector))
(vector+float*! arg1 (-> this initial-position) (-> this initial-velocity) arg0)
(+! (-> arg1 y) (* 0.5 arg0 arg0 (-> this gravity)))
arg1
)
(defmethod compute-transv-at-time ((this trajectory) (arg0 float) (arg1 vector))
(set! (-> arg1 quad) (-> this initial-velocity quad))
(+! (-> arg1 y) (* arg0 (-> this gravity)))
arg1
)
(defmethod compute-time-until-apex ((this trajectory))
(/ (- (-> this initial-velocity y)) (-> this gravity))
)
(defmethod setup-from-to-duration! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(set! (-> this initial-position quad) (-> arg0 quad))
(set! (-> this gravity) arg3)
(set! (-> this time) arg2)
(let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(vector-! (-> this initial-velocity) arg1 arg0)
(vector-xz-normalize! (-> this initial-velocity) f0-3)
)
(set! (-> this initial-velocity y) (- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* 0.5 arg2 (-> this gravity))))
0
(none)
)
(defmethod setup-from-to-xz-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(setup-from-to-duration! this arg0 arg1 f0-1 arg3)
)
0
(none)
)
(defmethod setup-from-to-y-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-0 arg2)
(f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3)))
(f0-3 900.0)
)
(when (>= f1-3 0.0)
(let ((f0-4 (sqrtf f1-3)))
(set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3)))
)
)
(setup-from-to-duration! this arg0 arg1 f0-3 arg3)
)
0
(none)
)
(defmethod setup-from-to-height! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-1 (+ arg2 (fmax (-> arg0 y) (-> arg1 y))))
(f1-4 (* 2.0 (- (-> arg0 y) f0-1) arg3))
(f0-4 4096.0)
)
(if (< 0.0 f1-4)
(set! f0-4 (sqrtf f1-4))
)
(setup-from-to-y-vel! this arg0 arg1 f0-4 arg3)
)
0
(none)
)
;; WARN: Function (method 16 trajectory) has a return type of none, but the expression builder found a return statement.
(defmethod setup-from-to-duration-and-height! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (- (-> arg1 y) (-> arg0 y))))
(cond
((= f0-1 0.0)
(let ((t9-0 (method-of-type trajectory setup-from-to-duration!))
(v1-2 arg2)
(f0-3 (* -8.0 arg3))
(f1-3 arg2)
)
(t9-0 this arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3)))
)
(return 0)
)
((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1))
(set! arg3 f0-1)
)
((and (< f0-1 0.0) (< arg3 0.0) (< f0-1 arg3))
(set! arg3 f0-1)
)
)
(let* ((f1-14 (/ (- arg3 f0-1) arg3))
(f0-6 -2.0)
(f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14)))))
(f0-8 (* f0-6 (* f1-18 f1-18) arg3))
)
(setup-from-to-duration! this arg0 arg1 arg2 f0-8)
)
)
0
(none)
)
(method-set!
trajectory
17
(if *debug-segment*
(lambda ((arg0 trajectory))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 10)
)
(set! (-> s4-0 quad) (-> arg0 initial-position quad))
(dotimes (s2-0 s3-0)
(set! (-> s5-0 quad) (-> s4-0 quad))
(let ((f0-1 (* (-> arg0 time) (/ (+ 1.0 (the float s2-0)) (the float s3-0)))))
(compute-trans-at-time arg0 f0-1 s4-0)
)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
s5-0
s4-0
(new 'static 'rgba :r #xff :a #x80)
#f
(the-as rgba -1)
)
)
)
0
(none)
)
nothing
)
)
(defmethod initialize ((this impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec))
(set! (-> this start-time) (the-as uint (current-time)))
(set! (-> this process) (the-as (pointer process-drawable) (process->ppointer arg0)))
(set! (-> this joint) arg1)
(set! (-> this radius) arg2)
(set! (-> this collide-with) (logclear arg3 (collide-spec water)))
(set! (-> this trans 0 quad) (the-as uint128 0))
(set! (-> this trans 1 quad) (the-as uint128 0))
this
)
(defmethod update-from-cspace ((this impact-control))
(when (>= (-> this joint) 0)
(set! (-> this trans 1 quad) (-> this trans 0 quad))
(vector<-cspace! (the-as vector (-> this trans)) (-> this process 0 node-list data (-> this joint)))
(vector-! (-> this dir) (the-as vector (-> this trans)) (-> this trans 1))
)
0
(none)
)
(defmethod impact-control-method-11 ((this impact-control) (arg0 collide-query) (arg1 process) (arg2 pat-surface))
(set! (-> arg0 start-pos quad) (-> this trans 1 quad))
(set! (-> arg0 move-dist quad) (-> this dir quad))
(let ((v1-2 (ppointer->process (-> this process)))
(a0-6 arg0)
)
(set! (-> a0-6 radius) (-> this radius))
(set! (-> a0-6 collide-with) (-> this collide-with))
(set! (-> a0-6 ignore-process0) v1-2)
(set! (-> a0-6 ignore-process1) #f)
(set! (-> a0-6 ignore-pat) arg2)
(set! (-> a0-6 action-mask) (collide-action solid))
)
(let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0)))
(when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> this dir))))
(let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry))
(s2-0 (-> arg0 best-other-tri collide-ptr))
(v1-12 (if (type? s2-0 collide-shape-prim)
s2-0
)
)
)
(set! (-> s3-0 cshape1) #f)
(set! (-> s3-0 cshape2) (if v1-12
(-> (the-as collide-shape-prim v1-12) cshape)
)
)
(set! (-> s3-0 resolve-u) (the int f30-0))
(set! (-> s3-0 head) #f)
(send-event
arg1
'impact-control
:from (if v1-12
(-> (the-as collide-shape-prim v1-12) cshape process)
arg1
)
#f
s3-0
this
arg0
)
)
)
f30-0
)
)
(defmethod initialize ((this point-tracker) (arg0 vector) (arg1 vector))
(set! (-> this trans 0 quad) (-> arg0 quad))
(set! (-> this trans 1 quad) (-> arg1 quad))
this
)
(defmethod point-tracker-method-10 ((this point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(cond
((>= 0.0 arg3)
(set! (-> arg0 quad) (-> arg1 quad))
)
((>= arg3 1.0)
(set! (-> arg0 quad) (-> arg2 quad))
)
(else
(let ((a1-2 (vector+float*! arg0 arg2 (vector-! (new 'stack-no-clear 'vector) arg1 arg2) (- 1.0 arg3))))
(vector-lerp! arg0 a1-2 arg2 arg3)
)
)
)
arg0
)
(defmethod point-tracker-method-11 ((this point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(with-pp
(let ((v1-1 (point-tracker-method-10 this (new 'stack-no-clear 'vector) arg1 arg2 arg3)))
(vector-! arg0 v1-1 arg1)
)
(vector-float*! arg0 arg0 (-> pp clock frames-per-second))
arg0
)
)
;; WARN: Return type mismatch process vs process-focusable.
(defmethod combo-tracker-method-13 ((this combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float))
(the-as
process-focusable
(cond
((send-event (handle->process arg0) 'combo)
(let ((gp-1 (handle->process arg0)))
(if (type? gp-1 process-focusable)
gp-1
)
)
)
(else
(let ((s1-0 (new 'stack-no-clear 'bounding-box))
(s2-1 (new 'stack 'boxed-array collide-shape 32))
)
(sphere<-vector+r! (the-as sphere s1-0) arg1 arg2)
(set! (-> s2-1 length) (fill-actor-list-for-box
*actor-hash*
s1-0
(the-as (pointer collide-shape) (-> s2-1 data))
(-> s2-1 allocated-length)
)
)
(let ((gp-2 (find-nearest-focusable
(the-as (array collide-shape) s2-1)
arg1
arg2
(if (= arg4 65536.0)
(search-info-flag crate enemy combo)
(search-info-flag crate enemy prefer-angle cull-angle combo)
)
(search-info-flag)
arg3
(the-as vector #f)
arg4
)
)
)
(if (type? gp-2 process-focusable)
gp-2
)
)
)
)
)
)
)
(defmethod combo-tracker-method-12 ((this combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame))
(initialize this arg0 arg1)
(set! (-> this target) (process->handle arg2))
(set! (-> this move-start-time) arg3)
this
)
(defmethod point-tracker-method-11 ((this combo-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(local-vars (at-0 int))
(with-pp
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((v1-1 (point-tracker-method-10 this (new 'stack-no-clear 'vector) arg1 arg2 arg3)))
(vector-! arg0 v1-1 arg1)
)
(let ((a1-4 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-4 from) (process->ppointer pp))
(set! (-> a1-4 num-params) 0)
(set! (-> a1-4 message) 'nav-control)
(let* ((s3-0 (send-event-function (handle->process (-> this target)) a1-4))
(s4-1 (if (type? s3-0 nav-control)
s3-0
)
)
)
(when s4-1
(cond
(((method-of-type nav-control find-poly-containing-point-1) (the-as nav-control s4-1) arg1)
(let ((t9-4 (method-of-type nav-control nav-control-method-20)))
#x45000000
(t9-4)
)
)
(else
(set! (-> arg0 quad) (the-as uint128 0))
)
)
)
)
)
(let ((v1-12 arg0))
(.lvf vf1 (&-> arg0 quad))
(let ((f0-0 (-> pp clock frames-per-second)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-12 quad) vf1)
)
arg0
)
)
)
(defun traj2d-calc-initial-speed-using-tilt ((arg0 traj2d-params))
(let ((f0-4 (* (- (* (-> arg0 x) (tan (-> arg0 initial-tilt))) (-> arg0 y)) (/ 2.0 (-> arg0 gravity)))))
(cond
((< 0.0 f0-4)
(set! (-> arg0 time) (sqrtf f0-4))
(set! (-> arg0 initial-speed) (/ (-> arg0 x) (* (-> arg0 time) (cos (-> arg0 initial-tilt)))))
#t
)
(else
(set! (-> arg0 time) 0.0)
(set! (-> arg0 initial-speed) 0.0)
#f
)
)
)
)
(defun traj3d-calc-initial-velocity-using-tilt ((arg0 traj3d-params))
(vector-! (-> arg0 diff) (-> arg0 dest) (-> arg0 src))
(let ((s5-0 (new 'stack-no-clear 'traj2d-params)))
(let ((v1-1 (-> arg0 diff)))
(set! (-> s5-0 x) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))))
)
(set! (-> s5-0 y) (-> arg0 diff y))
(set! (-> s5-0 gravity) (-> arg0 gravity))
(set! (-> s5-0 initial-tilt) (-> arg0 initial-tilt))
(cond
((traj2d-calc-initial-speed-using-tilt s5-0)
(set! (-> arg0 time) (-> s5-0 time))
(let* ((f26-0 (atan (-> arg0 diff x) (-> arg0 diff z)))
(f30-0 (-> arg0 initial-tilt))
(f24-0 (cos f30-0))
(f28-0 (-> s5-0 initial-speed))
)
(set! (-> arg0 initial-speed) f28-0)
(set! (-> arg0 initial-velocity x) (* f28-0 f24-0 (sin f26-0)))
(set! (-> arg0 initial-velocity z) (* f28-0 f24-0 (cos f26-0)))
(set! (-> arg0 initial-velocity y) (* f28-0 (sin f30-0)))
)
(set! (-> arg0 initial-velocity w) 1.0)
#t
)
(else
(set! (-> arg0 time) 0.0)
(set! (-> arg0 initial-speed) 0.0)
(vector-reset! (-> arg0 initial-velocity))
#f
)
)
)
)
(defmethod cubic-curve-method-9 ((this cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(set! (-> this vec 0 quad) (-> arg0 quad))
(set! (-> this mat uvec quad) (-> arg1 quad))
(let ((v1-2 (new 'stack-no-clear 'trajectory)))
(vector-! (-> v1-2 initial-velocity) arg2 arg0)
(vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0)
(let ((t1-7 (-> v1-2 initial-position)))
(let ((a1-3 (-> v1-2 initial-position)))
(let ((a3-2 arg1))
(let ((t2-1 -2.0))
(.mov vf7 t2-1)
)
(.lvf vf5 (&-> a3-2 quad))
)
(.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6)
)
(vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3)
(set! (-> this mat fvec quad) (-> v1-2 initial-position quad))
(vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0)
(vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1)
(vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3)
(set! (-> this mat trans quad) (-> v1-2 initial-position quad))
)
(dotimes (v1-5 4)
(set! (-> this vec v1-5 w) 0.0)
)
0
(none)
)
)
(defmethod cubic-curve-method-10 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(let ((f0-1 (* arg1 arg1)))
(set-vector! (-> v1-0 initial-position) 1.0 arg1 f0-1 (* f0-1 arg1))
)
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
(defmethod cubic-curve-method-11 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(set-vector! (-> v1-0 initial-position) 0.0 1.0 (* 2.0 arg1) (* 3.0 arg1 arg1))
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
(defmethod cubic-curve-method-12 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(set-vector! (-> v1-0 initial-position) 0.0 0.0 2.0 (* 6.0 arg1))
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
(defmethod debug-draw-curve ((this cubic-curve))
(let ((s5-0 (new 'stack-no-clear 'trajectory))
(s4-0 10)
)
(cubic-curve-method-10 this (-> s5-0 initial-velocity) 0.0)
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 initial-velocity) *color-red*)
(dotimes (s3-0 s4-0)
(set! (-> s5-0 initial-position quad) (-> s5-0 initial-velocity quad))
(let ((f0-2 (/ (+ 1.0 (the float s3-0)) (the float s4-0))))
(cubic-curve-method-10 this (-> s5-0 initial-velocity) f0-2)
)
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 initial-velocity) *color-red*)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
(-> s5-0 initial-position)
(-> s5-0 initial-velocity)
*color-red*
#f
(the-as rgba -1)
)
)
)
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
(cubic-curve-method-10 this (new 'stack-no-clear 'vector) 0.0)
(cubic-curve-method-11 this (new 'stack-no-clear 'vector) 0.0)
(meters 0.00024414062)
*color-white*
)
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
(cubic-curve-method-10 this (new 'stack-no-clear 'vector) 1.0)
(vector-negate! (new 'stack-no-clear 'vector) (cubic-curve-method-11 this (new 'stack-no-clear 'vector) 1.0))
(meters 0.00024414062)
*color-white*
)
0
(none)
)
+161 -3
View File
@@ -111,7 +111,166 @@
(none)
)
;; ERROR: function was not converted to expressions. Cannot decompile.
;; WARN: new jak 2 until loop case, check carefully
(defun-debug target-history-print ((arg0 history-iterator))
(local-vars
(sv-16 object)
(sv-24 int)
(sv-32 collide-status)
(sv-40 number)
(sv-44 vector)
(sv-48 vector)
(sv-52 vector)
(sv-56 vector)
(sv-60 vector)
(sv-64 vector)
(sv-68 number)
(sv-72 history-elt)
(sv-80 time-frame)
(sv-88 uint)
)
(set! sv-16 (-> arg0 out))
(set! sv-24 0)
(set! sv-32 (collide-status))
(set! sv-40 0)
(set! sv-44 *zero-vector*)
(set! sv-48 *zero-vector*)
(set! sv-52 *zero-vector*)
(set! sv-56 *zero-vector*)
(set! sv-60 *zero-vector*)
(set! sv-64 *zero-vector*)
(set! sv-68 0)
(until #f
(set! sv-72 (update-entries! arg0))
(if (not sv-72)
(return #f)
)
(set! sv-80 (frame-counter-delta arg0 sv-72))
(set! sv-88 (-> sv-72 record-id))
(when (!= sv-24 sv-88)
(set! sv-24 (the-as int sv-88))
(format
(-> arg0 out)
"~6D ~8S #x~8X "
sv-80
(if (logtest? sv-32 (collide-status no-touch))
"air"
(-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name)
)
sv-32
)
(format
(-> arg0 out)
"~C~C~C~C~C~C"
(if (not (logtest? (the-as int sv-40) 1))
103
87
)
(if (not (logtest? (the-as int sv-40) 2))
103
87
)
(cond
((logtest? (the-as int sv-40) 2048)
71
)
((not (logtest? (the-as int sv-40) 4))
103
)
(else
87
)
)
(cond
((logtest? (the-as int sv-40) 512)
66
)
((logtest? (the-as int sv-40) 8)
76
)
(else
99
)
)
(if (not (logtest? (the-as int sv-40) 16))
110
66
)
(if (not (logtest? (the-as int sv-40) 32))
103
65
)
)
(format
(-> arg0 out)
"~C~C "
(cond
((logtest? #x10000 (the-as int sv-40))
80
)
((logtest? (the-as int sv-40) #x8000)
85
)
((logtest? (the-as int sv-40) 64)
78
)
(else
95
)
)
(cond
((logtest? (the-as int sv-40) 1024)
76
)
((logtest? (the-as int sv-40) 256)
67
)
((logtest? (the-as int sv-40) 128)
108
)
(else
95
)
)
)
(format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z))
(format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z))
(format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z))
(format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z))
(format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z))
(format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z))
(format (-> arg0 out) "~%")
)
(case (-> sv-72 channel)
(((history-channel trans))
(set! sv-44 (-> sv-72 vector))
)
(((history-channel transv-in))
(set! sv-48 (-> sv-72 vector))
)
(((history-channel transv-out))
(set! sv-52 (-> sv-72 vector))
)
(((history-channel intersect))
(set! sv-56 (-> sv-72 vector))
)
(((history-channel pat))
(set! sv-68 (-> sv-72 vector x))
)
(((history-channel collide-status))
(set! sv-32 (-> sv-72 collide-status))
(set! sv-40 (-> sv-72 vector z))
)
(((history-channel surface-normal))
(set! sv-60 (-> sv-72 vector))
)
(((history-channel local-normal))
(set! sv-64 (-> sv-72 vector))
)
)
)
#f
)
(defun-debug target-print-stats ((arg0 target) (arg1 symbol))
(local-vars
@@ -2469,8 +2628,7 @@
(vector-average! (-> self control midpoint-of-hands) gp-0 s5-0)
)
(vector-! (-> self control ctrl-to-hands-offset) (-> self control midpoint-of-hands) (-> self control trans))
(-> self control impact-ctrl)
((method-of-type impact-control impact-control-method-10))
(update-from-cspace (-> self control impact-ctrl))
(cond
((focus-test? self edge-grab)
(target-compute-edge)
+21 -21
View File
@@ -37,13 +37,13 @@
(period uint32)
)
(:methods
(sync-info-method-9 () none)
(sync-info-method-10 () none)
(get-current-phase-no-mod (_type_) float)
(get-phase-offset (_type_) float)
(get-norm! (_type_ int) float)
(sync-info-method-12 () none)
(get-scaled-val! (_type_ float int) float)
(initialize! (_type_ sync-info-params) none)
(sync-info-method-14 () none)
(sync-info-method-15 () none)
(get-timeframe-offset! (_type_ time-frame) time-frame)
(sync-now! (_type_ float) none)
)
)
@@ -84,10 +84,10 @@
)
:pack-me
(:methods
(delayed-rand-float-method-9 () none)
(delayed-rand-float-method-10 () none)
(delayed-rand-float-method-11 () none)
(delayed-rand-float-method-12 () none)
(set-params! (_type_ int int float) float)
(reset! (_type_) float)
(update! (_type_) float)
(update-and-clear! (_type_) float)
)
)
@@ -102,8 +102,8 @@
)
:allow-misaligned
(:methods
(oscillating-float-method-9 () none)
(oscillating-float-method-10 () none)
(set-params! (_type_ float float float float) float)
(update! (_type_ float) float)
)
)
@@ -117,10 +117,10 @@
)
:allow-misaligned
(:methods
(bouncing-float-method-9 () none)
(bouncing-float-method-10 () none)
(bouncing-float-method-11 () none)
(bouncing-float-method-12 () none)
(set-params! (_type_ float float float float float float float) float)
(update! (_type_ float) float)
(at-min? (_type_) symbol)
(at-max? (_type_) symbol)
)
)
@@ -135,10 +135,10 @@
(value vector :inline)
)
(:methods
(delayed-rand-vector-method-9 () none)
(delayed-rand-vector-method-10 () none)
(delayed-rand-vector-method-11 () none)
(delayed-rand-vector-method-12 () none)
(set-params! (_type_ int int float float) vector)
(update-now! (_type_) vector)
(update-with-delay! (_type_) vector)
(update-with-delay-or-reset! (_type_) vector)
)
)
@@ -152,7 +152,7 @@
(accel float)
)
(:methods
(oscillating-vector-method-9 () none)
(oscillating-vector-method-10 () none)
(set-params! (_type_ vector float float float) vector)
(update! (_type_ vector) vector)
)
)
+576
View File
@@ -7,3 +7,579 @@
;; DECOMP BEGINS
;; WARN: Return type mismatch object vs none.
(defmethod initialize! ((this sync-info) (arg0 sync-info-params))
(format 0 "ERROR: Invalid call to sync-info::initialize!~%")
(none)
)
(defmethod get-current-phase-no-mod ((this sync-info))
(let* ((v1-0 (-> this period))
(f0-1 (the float v1-0))
(f1-2 (+ (the float (mod (the-as uint (current-time)) v1-0)) (-> this offset)))
)
(/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1)
)
)
(defmethod get-phase-offset ((this sync-info))
(/ (-> this offset) (the float (-> this period)))
)
(defmethod sync-now! ((this sync-info) (arg0 float))
(let* ((a2-0 (-> this period))
(f0-1 (the float a2-0))
(v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1)))
(f1-4 (+ (the float (mod (the-as uint (current-time)) a2-0)) (-> this offset)))
(f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1))
(f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> this offset)))
)
(set! (-> this offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1)))
)
0
(none)
)
(defmethod get-norm! ((this sync-info) (arg0 int))
(format 0 "ERROR: Unsupported sync-info::get-norm!~%")
0.0
)
(defmethod get-scaled-val! ((this sync-info) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
(defmethod get-timeframe-offset! ((this sync-info) (arg0 time-frame))
(if (zero? arg0)
(set! arg0 (current-time))
)
(let* ((v1-4 (-> this period))
(f0-1 (the float v1-4))
(f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> this offset)))
)
(+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1))))
)
)
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-linear) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-linear)
(format
0
"ERROR: <SW> Using wrong sync params in sync-linear::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s4-0 (the-as int (-> arg0 period)))
(f30-0 (-> arg0 percent))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s4-0 (the int (* 300.0 (-> v1-6 0))))
(set! f30-0 (-> v1-6 1))
)
)
)
)
(set! (-> this period) (the-as uint s4-0))
(let* ((f0-4 (the float s4-0))
(f1-1 (* f30-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
)
(none)
)
(defmethod get-norm! ((this sync-linear) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f0-1 (the float v1-4))
)
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f1-0 2.0)
(f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1)))
)
(if (>= f0-3 1.0)
(set! f0-3 (- 2.0 f0-3))
)
f0-3
)
)
(else
(let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset))))
(/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1)
)
)
)
)
)
(defmethod get-scaled-val! ((this sync-linear) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-eased) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-eased)
(format
0
"ERROR: <SW> Using wrong sync params in sync-eased::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s5-0 (the-as int (-> arg0 period)))
(f22-0 (-> arg0 percent))
(f24-0 (-> arg0 pause-in))
(f26-0 (-> arg0 pause-out))
(f30-0 (-> arg0 ease-in))
(f28-0 (-> arg0 ease-out))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s5-0 (the int (* 300.0 (-> v1-6 0))))
(set! f22-0 (-> v1-6 1))
(when (>= (-> sv-16 elt-count) (the-as uint 4))
(set! f30-0 (-> v1-6 2))
(set! f28-0 (-> v1-6 3))
(when (>= (-> sv-16 elt-count) (the-as uint 6))
(set! f24-0 (-> v1-6 4))
(set! f26-0 (-> v1-6 5))
)
)
)
)
)
)
(set! (-> this period) (the-as uint s5-0))
(let* ((f0-4 (the float s5-0))
(f1-1 (* f22-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
(cond
((< f26-0 0.0)
(set! f26-0 0.0)
)
((< 1.0 f26-0)
(set! f26-0 1.0)
)
)
(cond
((< f24-0 0.0)
(set! f24-0 0.0)
)
((< (- 1.0 f26-0) f24-0)
(set! f24-0 (- 1.0 f26-0))
)
)
(let ((f0-14 (the float s5-0)))
(set! (-> this pause-in) (* f24-0 f0-14))
(set! (-> this pause-out) (* f26-0 f0-14))
)
(if (< f30-0 0.0)
(set! f30-0 0.0)
)
(if (< 1.0 f30-0)
(set! f30-0 1.0)
)
(if (< f28-0 0.001)
(set! f28-0 0.001)
)
(if (< 1.0 f28-0)
(set! f28-0 1.0)
)
(let ((f0-20 (+ f30-0 f28-0)))
(when (< 1.0 f0-20)
(set! f0-20 1.0)
(set! f30-0 (- 1.0 f28-0))
)
(let* ((f1-6 (- 1.0 f0-20))
(f0-21 f30-0)
(f1-7 (+ f30-0 f1-6))
(f2-3 (* f0-21 f0-21))
(f3-3 (+ (* 2.0 f0-21 (- f1-7 f0-21)) f2-3))
(f4-3 (/ f0-21 (- 1.0 f1-7)))
(f3-4 (+ (* (- 1.0 f1-7) (- 1.0 f1-7) f4-3) f3-3))
)
(set! (-> this tlo) f0-21)
(set! (-> this thi) f1-7)
(set! (-> this ylo) f2-3)
(set! (-> this m2) f4-3)
(set! (-> this yend) f3-4)
)
)
)
(none)
)
(defmethod get-norm! ((this sync-eased) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f3-0 (the float v1-4))
(f0-1 (-> this pause-in))
(f2-0 (-> this pause-out))
(f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0))))
)
(the int (+ f0-1 f2-0 f3-0))
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0)))
(v1-6 #f)
)
(when (>= f3-2 (+ f1-1 f0-1))
(set! v1-6 #t)
(set! f3-2 (- f3-2 (+ f1-1 f0-1)))
f0-1
(set! f0-1 f2-0)
)
(cond
((< f3-2 f0-1)
(set! f3-2 f0-1)
)
((< (+ f0-1 f1-1) f3-2)
(set! f3-2 (+ f0-1 f1-1))
)
)
(let* ((f0-3 (/ (- f3-2 f0-1) f1-1))
(f1-2 (-> this tlo))
(f0-8 (/ (cond
((< f0-3 f1-2)
(* f0-3 f0-3)
)
((< f0-3 (-> this thi))
(+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> this ylo))
)
(else
(let ((f1-5 (- 1.0 f0-3)))
(- (-> this yend) (* f1-5 f1-5 (-> this m2)))
)
)
)
(-> this yend)
)
)
)
(if v1-6
(set! f0-8 (- 1.0 f0-8))
)
f0-8
)
)
)
(else
(format 0 "ERROR: <SW> Attempting to use sync-eased in unsupported non-pong mode.~%")
0.0
)
)
)
)
(defmethod get-scaled-val! ((this sync-eased) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-paused) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-paused)
(format
0
"ERROR: <SW> Using wrong sync params in sync-paused::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s5-0 (the-as int (-> arg0 period)))
(f26-0 (-> arg0 percent))
(f28-0 (-> arg0 pause-in))
(f30-0 (-> arg0 pause-out))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s5-0 (the int (* 300.0 (-> v1-6 0))))
(set! f26-0 (-> v1-6 1))
(when (>= (-> sv-16 elt-count) (the-as uint 4))
(set! f28-0 (-> v1-6 2))
(set! f30-0 (-> v1-6 3))
)
)
)
)
)
(set! (-> this period) (the-as uint s5-0))
(let* ((f0-4 (the float s5-0))
(f1-1 (* f26-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
(cond
((< f30-0 0.0)
(set! f30-0 0.0)
)
((< 1.0 f30-0)
(set! f30-0 1.0)
)
)
(cond
((< f28-0 0.0)
(set! f28-0 0.0)
)
((< (- 1.0 f30-0) f28-0)
(set! f28-0 (- 1.0 f30-0))
)
)
(let ((f0-14 (the float s5-0)))
(set! (-> this pause-in) (* f28-0 f0-14))
(set! (-> this pause-out) (* f30-0 f0-14))
)
)
(none)
)
(defmethod get-norm! ((this sync-paused) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f2-0 (the float v1-4))
(f0-1 (-> this pause-in))
(f1-0 (-> this pause-out))
)
(the int (+ f0-1 f1-0 f2-0))
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0)))
(f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0))))
(v1-7 #f)
)
(when (>= f3-6 (+ f2-2 f0-1))
(set! v1-7 #t)
(set! f3-6 (- f3-6 (+ f2-2 f0-1)))
(set! f0-1 f1-0)
)
(let* ((f1-1 (/ (- f3-6 f0-1) f2-2))
(f0-5 (fmax 0.0 (fmin 1.0 f1-1)))
)
(if v1-7
(set! f0-5 (- 1.0 f0-5))
)
f0-5
)
)
)
(else
(let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0)))
(f1-5 (- f2-0 (+ f0-1 f1-0)))
(f1-6 (/ (- f3-10 f0-1) f1-5))
)
(fmax 0.0 (fmin 1.0 f1-6))
)
)
)
)
)
(defmethod get-scaled-val! ((this sync-paused) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
(defmethod set-params! ((this delayed-rand-float) (arg0 int) (arg1 int) (arg2 float))
(set! (-> this min-time) arg0)
(set! (-> this max-time) arg1)
(set! (-> this max-val) (* 0.5 arg2))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(set! (-> this value) 0.0)
(-> this value)
)
(defmethod reset! ((this delayed-rand-float))
(set-time! (-> this start-time))
(set! (-> this timer) (rand-vu-int-range (-> this min-time) (-> this max-time)))
(set! (-> this value) (rand-vu-float-range (- (-> this max-val)) (-> this max-val)))
)
(defmethod update! ((this delayed-rand-float))
(if (time-elapsed? (-> this start-time) (-> this timer))
(reset! this)
)
(-> this value)
)
(defmethod update-and-clear! ((this delayed-rand-float))
(if (time-elapsed? (-> this start-time) (-> this timer))
(reset! this)
(set! (-> this value) 0.0)
)
(-> this value)
)
(defmethod set-params! ((this oscillating-float) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
(set! (-> this value) arg0)
(set! (-> this target) arg0)
(set! (-> this vel) 0.0)
(set! (-> this max-vel) arg2)
(set! (-> this damping) arg3)
(set! (-> this accel) arg1)
(-> this value)
)
(defmethod update! ((this oscillating-float) (arg0 float))
(with-pp
(let ((f0-3 (* (- (+ (-> this target) arg0) (-> this value)) (* (-> this accel) (-> pp clock time-adjust-ratio)))))
(+! (-> this vel) f0-3)
)
(set! (-> this vel) (fmin (-> this max-vel) (fmax (- (-> this max-vel)) (-> this vel))))
(set! (-> this vel) (* (-> this vel) (-> this damping)))
(+! (-> this value) (* (-> this vel) (-> pp clock time-adjust-ratio)))
(-> this value)
)
)
(defmethod set-params! ((this bouncing-float)
(arg0 float)
(arg1 float)
(arg2 float)
(arg3 float)
(arg4 float)
(arg5 float)
(arg6 float)
)
(set-params! (-> this osc) arg0 arg4 arg5 arg6)
(set! (-> this max-value) arg1)
(set! (-> this min-value) arg2)
(set! (-> this elasticity) arg3)
(set! (-> this state) 0)
(-> this osc value)
)
(defmethod update! ((this bouncing-float) (arg0 float))
(update! (-> this osc) arg0)
(set! (-> this state) 0)
(when (>= (-> this osc value) (-> this max-value))
(set! (-> this osc value) (-> this max-value))
(if (< 0.0 (-> this osc vel))
(set! (-> this osc vel) (* (-> this osc vel) (- (-> this elasticity))))
)
(set! (-> this state) 1)
)
(when (>= (-> this min-value) (-> this osc value))
(set! (-> this osc value) (-> this min-value))
(if (< (-> this osc vel) 0.0)
(set! (-> this osc vel) (* (-> this osc vel) (- (-> this elasticity))))
)
(set! (-> this state) -1)
)
(-> this osc value)
)
(defmethod at-min? ((this bouncing-float))
(= (-> this state) -1)
)
(defmethod at-max? ((this bouncing-float))
(= (-> this state) 1)
)
(defmethod set-params! ((this delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(set! (-> this min-time) arg0)
(set! (-> this max-time) arg1)
(set! (-> this xz-max) (* 0.5 arg2))
(set! (-> this y-max) (* 0.5 arg3))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(vector-reset! (-> this value))
(-> this value)
)
(defmethod update-now! ((this delayed-rand-vector))
(set-time! (-> this start-time))
(set! (-> this timer) (rand-vu-int-range (-> this min-time) (-> this max-time)))
(set! (-> this value x) (rand-vu-float-range (- (-> this xz-max)) (-> this xz-max)))
(set! (-> this value y) (rand-vu-float-range (- (-> this y-max)) (-> this y-max)))
(set! (-> this value z) (rand-vu-float-range (- (-> this xz-max)) (-> this xz-max)))
(-> this value)
)
(defmethod update-with-delay! ((this delayed-rand-vector))
(if (time-elapsed? (-> this start-time) (-> this timer))
(update-now! this)
)
(-> this value)
)
(defmethod update-with-delay-or-reset! ((this delayed-rand-vector))
(if (time-elapsed? (-> this start-time) (-> this timer))
(update-now! this)
(vector-reset! (-> this value))
)
(-> this value)
)
(defmethod set-params! ((this oscillating-vector) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(cond
(arg0
(set! (-> this value quad) (-> arg0 quad))
(set! (-> this target quad) (-> arg0 quad))
)
(else
(vector-reset! (-> this value))
(vector-reset! (-> this target))
)
)
(vector-reset! (-> this vel))
(set! (-> this max-vel) arg2)
(set! (-> this damping) arg3)
(set! (-> this accel) arg1)
(-> this value)
)
(defmethod update! ((this oscillating-vector) (arg0 vector))
(with-pp
(let ((v1-0 (new 'stack-no-clear 'vector)))
(cond
(arg0
(vector+! v1-0 (-> this target) arg0)
(vector-! v1-0 v1-0 (-> this value))
)
(else
(vector-! v1-0 (-> this target) (-> this value))
)
)
(vector-float*! v1-0 v1-0 (* (-> this accel) (-> pp clock time-adjust-ratio)))
(vector+! (-> this vel) (-> this vel) v1-0)
(let ((f0-2 (vector-length (-> this vel))))
(if (< (-> this max-vel) f0-2)
(vector-float*! (-> this vel) (-> this vel) (/ (-> this max-vel) f0-2))
)
)
(vector-float*! (-> this vel) (-> this vel) (-> this damping))
(vector-float*! v1-0 (-> this vel) (-> pp clock time-adjust-ratio))
(vector+! (-> this value) (-> this value) v1-0)
)
(-> this value)
)
)
+44 -6
View File
@@ -1120,7 +1120,9 @@ Val* Compiler::compile_stack_new(const goos::Object& form,
Env* env,
bool call_constructor,
bool use_singleton) {
auto type_of_object = parse_typespec(unquote(type), env);
auto type_str = symbol_string(unquote(type));
auto type_of_object =
type_str == "boxed-array" ? TypeSpec("array") : parse_typespec(unquote(type), env);
auto fe = env->function_env();
auto st_type_info = dynamic_cast<StructureType*>(m_ts.lookup_type(type_of_object));
if (st_type_info && st_type_info->is_always_stack_singleton()) {
@@ -1131,14 +1133,16 @@ Val* Compiler::compile_stack_new(const goos::Object& form,
}
}
if (type_of_object == TypeSpec("inline-array") || type_of_object == TypeSpec("array")) {
if (call_constructor) {
throw_compiler_error(form, "Constructing stack arrays is not yet supported");
if (type_str == "array" && call_constructor && type_of_object == TypeSpec("array")) {
throw_compiler_error(form, "Use 'boxed-array instead of 'array for boxed stack arrays.");
}
if (use_singleton) {
throw_compiler_error(form, "Singleton stack arrays are not yet supported");
}
bool is_inline = type_of_object == TypeSpec("inline-array");
auto elt_type = quoted_sym_as_string(pair_car(*rest));
auto elt_type = call_constructor && type_of_object == TypeSpec("array")
? symbol_string(pair_car(*rest))
: quoted_sym_as_string(pair_car(*rest));
rest = &pair_cdr(*rest);
auto count_obj = pair_car(*rest);
@@ -1155,8 +1159,42 @@ Val* Compiler::compile_stack_new(const goos::Object& form,
throw_compiler_error(form, "New array form got more arguments than expected");
}
auto ts = is_inline ? m_ts.make_inline_array_typespec(elt_type)
: m_ts.make_pointer_typespec(elt_type);
TypeSpec ts;
if (call_constructor && type_of_object == TypeSpec("array")) {
ts = m_ts.make_array_typespec("array", elt_type);
} else if (is_inline) {
ts = m_ts.make_inline_array_typespec(elt_type);
} else {
ts = m_ts.make_pointer_typespec(elt_type);
}
if (type_str == "boxed-array" && call_constructor && type_of_object == TypeSpec("array")) {
auto ti = m_ts.lookup_type(elt_type);
RegVal* mem;
std::vector<RegVal*> args;
int elt_size = ti->is_reference() ? 4 : ti->get_size_in_memory();
int mem_size =
m_ts.lookup_type(type_of_object)->get_size_in_memory() + constant_count * elt_size;
mem = fe->allocate_aligned_stack_variable(ts, mem_size, 16)->to_gpr(form, env);
// the new method actually takes a "symbol" according to the type system. So we have to cheat
// it.
mem->set_type(TypeSpec("symbol"));
args.push_back(mem);
// type
args.push_back(
compile_get_symbol_value(form, type_of_object.base_type(), env)->to_reg(form, env));
// element type
args.push_back(compile_get_symbol_value(form, elt_type, env)->to_reg(form, env));
// size
args.push_back(compile_integer(constant_count, env)->to_reg(form, env));
auto new_method = compile_get_method_of_type(form, type_of_object, "new", env);
auto new_obj = compile_real_function_call(form, new_method, args, env);
new_obj->set_type(ts);
return new_obj;
}
auto info = m_ts.get_deref_info(ts);
if (!info.can_deref) {
throw_compiler_error(form, "Cannot make an {} of {}\n", type_of_object.print(), ts.print());
+1 -1
View File
@@ -253,7 +253,7 @@
)
)
)
(let ((s4-0 (the-as (array float) (new 'stack 'array float 2))))
(let ((s4-0 (the-as (array float) (new 'stack 'boxed-array float 2))))
0.0
(let ((s5-0 0)
(f30-0 (-> arg0 current-interp))
+1 -1
View File
@@ -165,7 +165,7 @@
)
)
)
(let ((s5-1 (new 'stack 'array symbol 24)))
(let ((s5-1 (new 'stack 'boxed-array symbol 24)))
(set! (-> s5-1 length) 0)
(dotimes (s4-0 6)
(let ((a0-5 (-> this want s4-0 name)))
+1 -1
View File
@@ -2870,7 +2870,7 @@
#f
(label cfg-24)
(when v1-18
(let ((s5-1 (the-as (array cspace) (new 'stack 'array cspace 32))))
(let ((s5-1 (the-as (array cspace) (new 'stack 'boxed-array cspace 32))))
(let ((v1-21 0))
(set! (-> s5-1 length) 0)
(let ((a1-12 (-> arg0 node-list data sv-416))
+2 -2
View File
@@ -2330,8 +2330,8 @@ Process is recycled and moved to reserved, if it deactivates."
(when (not (update-guard-status-spots target-pos))
)
(when (update-guard-status-spots target-pos)
(set! guards (the-as (array crimson-guard) (new 'stack 'array crimson-guard 16)))
(set! guard-target-dists (the-as (array float) (new 'stack 'array float 16)))
(set! guards (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16)))
(set! guard-target-dists (the-as (array float) (new 'stack 'boxed-array float 16)))
(set! guard-idx 0)
(dotimes (guard-count (the-as int (-> this vehicle-tracker-array active-object-count)))
(case (-> this vehicle-tracker-array active-object-type-list guard-count)
+451
View File
@@ -0,0 +1,451 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function cam-helper-temp
;; INFO: Used lq/sq
(defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float))
(local-vars (sv-144 cam-rotation-tracker))
(set! sv-144 (-> arg0 0 tracking))
(let ((s1-0 (-> arg0 0 trans))
(gp-0 (-> arg1 0 tracking))
(s0-0 (-> arg1 0 trans))
)
(cond
((= (-> self tracking-status) 3)
(cam-calc-follow! (-> self tracking) s1-0 #t)
(slave-set-rotation!
(-> self tracking)
s1-0
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#t
)
(set! sv-144 (-> self tracking))
(set! s1-0 (-> self trans))
)
((= (-> self tracking-status) 2)
(cam-calc-follow! (-> self tracking) s0-0 #t)
(slave-set-rotation!
(-> self tracking)
s0-0
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#t
)
(set! gp-0 (-> self tracking))
(set! s0-0 (-> self trans))
)
)
(let ((s2-0 (new 'stack-no-clear 'inline-array 'vector 3)))
(dotimes (v1-14 3)
(set! (-> s2-0 v1-14 quad) (the-as uint128 0))
)
0.0
0.0
0.0
(let ((s4-0 (new-stack-vector0)))
0.0
(let ((s3-0 (new 'stack-no-clear 'matrix)))
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(vector-! (-> s2-0 0) (the-as vector (-> sv-144 inv-mat)) (the-as vector (-> gp-0 inv-mat)))
(vector-! (-> s2-0 1) (-> sv-144 inv-mat uvec) (-> gp-0 inv-mat uvec))
(vector-! (-> s2-0 2) (-> sv-144 inv-mat fvec) (-> gp-0 inv-mat fvec))
(let ((f0-6 (vector-length (-> s2-0 0)))
(f1-0 (vector-length (-> s2-0 1)))
(f2-0 (vector-length (-> s2-0 2)))
)
(cond
((and (< f0-6 f1-0) (< f0-6 f2-0))
(vector-cross! s4-0 (-> s2-0 1) (-> s2-0 2))
)
((and (< f1-0 f0-6) (< f1-0 f2-0))
(vector-cross! s4-0 (-> s2-0 0) (-> s2-0 2))
)
(else
(vector-cross! s4-0 (-> s2-0 0) (-> s2-0 1))
)
)
)
(vector-normalize! s4-0 1.0)
(let ((f0-9 (fabs (vector-dot (the-as vector (-> sv-144 inv-mat)) s4-0)))
(f1-3 (fabs (vector-dot (-> sv-144 inv-mat uvec) s4-0)))
(f2-3 (fabs (vector-dot (-> sv-144 inv-mat fvec) s4-0)))
)
(cond
((and (< f0-9 f1-3) (< f0-9 f2-3))
(vector-flatten! (-> s2-0 0) (the-as vector (-> sv-144 inv-mat)) s4-0)
(vector-flatten! (-> s2-0 1) (the-as vector (-> gp-0 inv-mat)) s4-0)
)
((< f1-3 f2-3)
(vector-flatten! (-> s2-0 0) (-> sv-144 inv-mat uvec) s4-0)
(vector-flatten! (-> s2-0 1) (-> gp-0 inv-mat uvec) s4-0)
)
(else
(vector-flatten! (-> s2-0 0) (-> sv-144 inv-mat fvec) s4-0)
(vector-flatten! (-> s2-0 1) (-> gp-0 inv-mat fvec) s4-0)
)
)
)
(vector-normalize! (-> s2-0 0) 1.0)
(vector-normalize! (-> s2-0 1) 1.0)
(vector-cross! (-> s2-0 2) (-> s2-0 0) (-> s2-0 1))
(if (< (vector-dot (-> s2-0 2) s4-0) 0.0)
(vector-negate! s4-0 s4-0)
)
(let ((f30-0 (acos (vector-dot (-> s2-0 0) (-> s2-0 1)))))
(cond
((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS))
(logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER))
(when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)))
(vector-! (-> s2-0 0) (-> *camera* tpos-curr) s1-0)
(vector-! (-> s2-0 1) s0-0 s1-0)
(vector-flatten! (-> s2-0 0) (-> s2-0 0) (-> *camera* local-down))
(vector-flatten! (-> s2-0 1) (-> s2-0 1) (-> *camera* local-down))
(when (and (< 4096.0 (vector-normalize-ret-len! (-> s2-0 0) 1.0))
(< 4096.0 (vector-normalize-ret-len! (-> s2-0 1) 1.0))
)
(vector-cross! (-> s2-0 2) (-> s2-0 1) (-> s2-0 0))
(when (< (vector-dot (-> s2-0 2) s4-0) -0.01)
)
)
)
)
((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0))
(logxor! (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER))
)
)
(set! (-> self flip-control-axis quad) (-> s4-0 quad))
(when (logtest? (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER))
(set! f30-0 (- 65536.0 f30-0))
(vector-negate! s4-0 s4-0)
)
(let ((f30-1 (* f30-0 (- 1.0 arg2))))
(matrix-axis-sin-cos! s3-0 s4-0 (sin f30-1) (cos f30-1))
)
)
(matrix*! (-> self inv-camera-rot) (the-as matrix gp-0) s3-0)
)
)
)
)
)
;; failed to figure out what this is:
(defstate cam-combiner-active (camera-combiner)
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-0 object))
(case message
(('fast-rot)
(set! v0-0 #t)
(set! (-> self fast-rot) (the-as basic v0-0))
v0-0
)
(('set-interpolation)
(let ((f0-1 (the float (-> block param 0))))
(cond
((>= 0.0 f0-1)
(set! (-> self interp-val) 1.0)
)
(else
(set! (-> self interp-val) 0.0)
(set! (-> self interp-step) (/ 5.0 f0-1))
)
)
)
)
(('teleport)
(when (nonzero? (-> self tracking-status))
(jump-to-target! (-> self tracking point-of-interest-blend) 0.0)
(cam-calc-follow! (-> self tracking) (-> self trans) #f)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#f
)
)
)
(('stop-tracking)
(set! (-> self tracking-status) (the-as uint 0))
0
)
(('start-tracking)
(cond
((< argc 1)
(let ((t9-3 format)
(a0-14 0)
(a1-4 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* start-tracking~%")
)
(let ((v1-8 (-> block param 0)))
(rtype-of v1-8)
)
(t9-3 a0-14 a1-4)
)
)
((not (type? (-> block param 0) camera-slave))
(let ((t9-5 format)
(a0-16 0)
(a1-6 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* start-tracking~%")
(v1-11 (-> block param 0))
)
(t9-5 a0-16 a1-6 (rtype-of v1-11))
)
)
((zero? (-> self tracking-status))
(set! (-> self tracking-status) (the-as uint 1))
(let ((gp-1 (the-as object (-> block param 0))))
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options)))
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow))
(copy-to (-> self tracking tilt-adjust) (the-as cam-float-seeker (+ (the-as uint gp-1) 320)))
(copy-to (-> self tracking underwater-blend) (the-as cam-float-seeker (+ (the-as uint gp-1) 368)))
(copy-to (-> self tracking point-of-interest-blend) (the-as cam-float-seeker (+ (the-as uint gp-1) 344)))
(let ((gp-2 (+ (the-as uint gp-1) 124)))
(cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f)
(slave-set-rotation!
(-> self tracking)
(the-as vector gp-2)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
#f
)
)
)
)
)
)
(('copy-tracking)
(cond
((< argc 1)
(let ((t9-11 format)
(a0-23 0)
(a1-12 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* copy-tracking~%")
)
(let ((v1-23 (-> block param 0)))
(rtype-of v1-23)
)
(t9-11 a0-23 a1-12)
)
)
((not (type? (-> block param 0) camera-slave))
(let ((t9-13 format)
(a0-25 0)
(a1-14 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* copy-tracking~%")
(v1-25 (-> block param 0))
)
(t9-13 a0-25 a1-14 (rtype-of v1-25))
)
)
((nonzero? (-> self tracking-status))
#f
)
(else
(set! (-> self tracking-status) (the-as uint 1))
(let ((gp-3 (the-as object (-> block param 0))))
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-3) options)))
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-3) tracking no-follow))
(copy-to (-> self tracking tilt-adjust) (the-as cam-float-seeker (+ (the-as uint gp-3) 320)))
(copy-to (-> self tracking underwater-blend) (the-as cam-float-seeker (+ (the-as uint gp-3) 368)))
(set! (-> self tracking follow-off quad) (-> (the-as camera-slave gp-3) tracking follow-off quad))
(set! (-> self tracking follow-pt quad) (-> (the-as camera-slave gp-3) tracking follow-pt quad))
(let* ((a2-23 (-> self tracking))
(a3-7 (-> (the-as camera-slave gp-3) tracking))
(v1-37 (-> a3-7 inv-mat rvec quad))
(a0-32 (-> a3-7 inv-mat uvec quad))
(a1-17 (-> a3-7 inv-mat fvec quad))
(a3-8 (-> a3-7 inv-mat trans quad))
)
(set! (-> a2-23 inv-mat rvec quad) v1-37)
(set! (-> a2-23 inv-mat uvec quad) a0-32)
(set! (-> a2-23 inv-mat fvec quad) a1-17)
(set! (-> a2-23 inv-mat trans quad) a3-8)
)
(copy-to (-> self tracking point-of-interest-blend) (the-as cam-float-seeker (+ (the-as uint gp-3) 344)))
(set! (-> self tracking looking-at quad) (-> (the-as camera-slave gp-3) tracking looking-at quad))
(set! v0-0 (-> self tracking looking-interesting))
(set! (-> (the-as vector v0-0) quad) (-> (the-as camera-slave gp-3) tracking looking-interesting quad))
)
v0-0
)
)
)
)
)
:code (behavior ()
(until #f
(when (and (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)))
(!= (-> self tracking-status) 0)
)
(set! (-> self tracking-status) (the-as uint 0))
0
)
(when *camera*
(let ((s5-0 (-> *camera* slave))
(s4-0 (-> *camera* decel))
(f30-0 (parameter-ease-sin-clamp (-> self interp-val)))
(gp-0 (new-stack-vector0))
)
(set! (-> gp-0 quad) (-> self trans quad))
(when s5-0
(cond
((< (-> self interp-val) 1.0)
(vector-lerp-clamp! (-> self trans) (-> s4-0 0 trans) (-> s5-0 0 trans) f30-0)
(set! (-> self fov) (lerp-clamp (-> s4-0 0 fov) (-> s5-0 0 fov) f30-0))
(set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s4-0 0 trans)))
(set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s5-0 0 trans)))
(cond
((= (-> self tracking-status) 1)
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
(not (-> self fast-rot))
)
(let* ((a2-4 (-> self inv-camera-rot))
(a3-2 (-> self tracking))
(v1-22 (-> a3-2 inv-mat rvec quad))
(a0-10 (-> a3-2 inv-mat uvec quad))
(a1-6 (-> a3-2 inv-mat fvec quad))
(a3-3 (-> a3-2 inv-mat trans quad))
)
(set! (-> a2-4 rvec quad) v1-22)
(set! (-> a2-4 uvec quad) a0-10)
(set! (-> a2-4 fvec quad) a1-6)
(set! (-> a2-4 trans quad) a3-3)
)
)
(else
(cam-helper-temp s4-0 s5-0 f30-0)
)
)
(cond
((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value)))
)
((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t)))
)
((paused?)
)
(else
(+! (-> self interp-val) (* (-> self interp-step) (-> self clock time-adjust-ratio)))
)
)
)
(else
(set! (-> self dist-from-src) 409600.0)
(set! (-> self dist-from-dest) 0.0)
(set! (-> self trans quad) (-> s5-0 0 trans quad))
(set! (-> self fov) (-> s5-0 0 fov))
(cond
((= (-> self tracking-status) 2)
(set! (-> self tracking-status) (the-as uint 1))
)
((= (-> self tracking-status) 3)
(set! (-> self tracking-status) (the-as uint 0))
0
)
)
(cond
((= (-> self tracking-status) 1)
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
(slave-set-rotation!
(-> self tracking)
(-> self trans)
(the-as cam-slave-options-u32 (-> self tracking-options))
(-> self fov)
(not (-> self fast-rot))
)
(let* ((v1-51 (-> self inv-camera-rot))
(a3-5 (-> self tracking))
(a0-17 (-> a3-5 inv-mat rvec quad))
(a1-10 (-> a3-5 inv-mat uvec quad))
(a2-8 (-> a3-5 inv-mat fvec quad))
(a3-6 (-> a3-5 inv-mat trans quad))
)
(set! (-> v1-51 rvec quad) a0-17)
(set! (-> v1-51 uvec quad) a1-10)
(set! (-> v1-51 fvec quad) a2-8)
(set! (-> v1-51 trans quad) a3-6)
)
)
(else
(let* ((v1-52 (-> self inv-camera-rot))
(a3-7 (-> s5-0 0 tracking))
(a0-19 (-> a3-7 inv-mat rvec quad))
(a1-11 (-> a3-7 inv-mat uvec quad))
(a2-9 (-> a3-7 inv-mat fvec quad))
(a3-8 (-> a3-7 inv-mat trans quad))
)
(set! (-> v1-52 rvec quad) a0-19)
(set! (-> v1-52 uvec quad) a1-11)
(set! (-> v1-52 fvec quad) a2-9)
(set! (-> v1-52 trans quad) a3-8)
)
)
)
)
)
)
(vector-! (-> self velocity) (-> self trans) gp-0)
)
)
(set! (-> self fast-rot) #f)
(suspend)
)
#f
)
)
;; definition for function cam-combiner-init
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defbehavior cam-combiner-init camera-combiner ()
(stack-size-set! (-> self main-thread) 512)
(vector-reset! (-> self trans))
(matrix-identity! (-> self inv-camera-rot))
(cond
(*math-camera*
(set! (-> self fov) (-> *math-camera* fov))
(set! (-> self trans quad) (-> *math-camera* trans quad))
(let* ((v1-6 (-> self inv-camera-rot))
(a3-0 (-> *math-camera* inv-camera-rot))
(a0-6 (-> a3-0 rvec quad))
(a1-1 (-> a3-0 uvec quad))
(a2-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> v1-6 rvec quad) a0-6)
(set! (-> v1-6 uvec quad) a1-1)
(set! (-> v1-6 fvec quad) a2-0)
(set! (-> v1-6 trans quad) a3-1)
)
)
(else
(set! (-> self fov) 11650.845)
)
)
(set! (-> self interp-val) 1.0)
(set! (-> self interp-step) 0.125)
(set! (-> self tracking-status) (the-as uint 0))
(set! (-> self fast-rot) #f)
(init (-> self tracking tilt-adjust) (-> *CAMERA-bank* default-tilt-adjust) 9.102222 91.022224 0.25)
(init
(-> self tracking follow-height-extra)
(-> *setting-control* cam-current extra-follow-height)
81.92
819.2
0.5
)
(vector-reset! (-> self velocity))
(go cam-combiner-active)
0
(none)
)
+124
View File
@@ -0,0 +1,124 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function position-in-front-of-camera!
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(vector-float*! arg0 (-> *math-camera* inv-camera-rot fvec) arg1)
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot uvec) arg2)
(vector+! arg0 arg0 (-> *math-camera* trans))
arg0
)
;; definition for function position-in-front-of-screen!
(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector))
(let ((a2-1 (vector-negate! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec)))
(a1-3 (vector-float*! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec) arg1))
)
(vector+! a1-3 a1-3 (-> *math-camera* trans))
(reverse-transform-point! arg0 a1-3 a2-1 arg2)
)
arg0
)
;; definition for function matrix-local->world
(defun matrix-local->world ((arg0 symbol) (arg1 symbol))
(if arg0
(-> *math-camera* inv-camera-rot-smooth)
(-> *math-camera* inv-camera-rot)
)
)
;; definition for function matrix-world->local
(defun matrix-world->local ((arg0 symbol) (arg1 object))
(-> *math-camera* camera-rot)
)
;; definition (perm) for symbol *camera-dummy-vector*, type vector
(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
;; definition for function camera-pos
(defun camera-pos ()
(cond
(*camera-combiner*
(-> *camera-combiner* trans)
)
(*math-camera*
(-> *math-camera* trans)
)
(else
*camera-dummy-vector*
)
)
)
;; definition for function math-camera-pos
(defun math-camera-pos ()
(-> *math-camera* trans)
)
;; definition for function camera-matrix
(defun camera-matrix ()
(if *camera-combiner*
(-> *camera-combiner* inv-camera-rot)
(-> *math-camera* inv-camera-rot)
)
)
;; definition for function math-camera-matrix
(defun math-camera-matrix ()
(-> *math-camera* inv-camera-rot)
)
;; definition for function camera-angle
(defun camera-angle ()
(let ((f0-0 (-> *math-camera* camera-rot rvec x))
(f1-0 (-> *math-camera* camera-rot rvec z))
)
(atan f1-0 f0-0)
)
)
;; definition for function camera-teleport-to-entity
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs symbol.
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
(let ((gp-0 (new 'stack 'transformq)))
(set! (-> gp-0 trans quad) (-> arg0 extra trans quad))
(quaternion-copy! (-> gp-0 quat) (-> arg0 quat))
(vector-identity! (-> gp-0 scale))
(the-as symbol (send-event *camera* 'teleport-to-transformq gp-0))
)
)
;; definition for function camera-teleport-to-entity-named
;; WARN: Return type mismatch int vs none.
(defun camera-teleport-to-entity-named ((arg0 string))
(let* ((gp-0 (entity-by-name arg0))
(a0-3 (if (type? gp-0 entity-actor)
gp-0
)
)
)
(if a0-3
(camera-teleport-to-entity (the-as entity-actor a0-3))
(format #t "sorry, couldn't find an actor named '~S'~%" arg0)
)
)
0
(none)
)
;; definition for function camera-teleport-to-location
;; WARN: Return type mismatch int vs none.
(defun camera-teleport-to-location ((arg0 float) (arg1 float) (arg2 float))
(let ((v1-1 (new 'stack 'transformq)))
(set-vector! (-> v1-1 trans) (* 4096.0 arg0) (* 4096.0 arg1) (* 4096.0 arg2) 1.0)
(send-event *camera* 'teleport-to-transformq v1-1)
)
0
(none)
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+468
View File
@@ -0,0 +1,468 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type cam-point-watch-bank
(deftype cam-point-watch-bank (basic)
((speed float)
(rot-speed degrees)
)
)
;; definition for method 3 of type cam-point-watch-bank
(defmethod inspect ((this cam-point-watch-bank))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tspeed: ~f~%" (-> this speed))
(format #t "~1Trot-speed: (deg ~r)~%" (-> this rot-speed))
(label cfg-4)
this
)
;; definition for symbol *CAM_POINT_WATCH-bank*, type cam-point-watch-bank
(define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6)))
;; failed to figure out what this is:
(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) (camera-blend-from-type unknown-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-no-clear 'matrix)))
(set! (-> s3-0 rvec quad) (the-as uint128 0))
(set! (-> s3-0 uvec quad) (the-as uint128 0))
(set! (-> s3-0 fvec quad) (the-as uint128 0))
(set! (-> s3-0 trans quad) (the-as uint128 0))
(matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x)))
(vector-matrix*! s4-0 (-> self tracking inv-mat fvec) 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
)
)
;; definition of type cam-free-bank
(deftype cam-free-bank (basic)
((speed float)
(rot-speed degrees)
)
)
;; definition for method 3 of type cam-free-bank
(defmethod inspect ((this cam-free-bank))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tspeed: ~f~%" (-> this speed))
(format #t "~1Trot-speed: (deg ~r)~%" (-> this rot-speed))
(label cfg-4)
this
)
;; definition for symbol *CAM_FREE-bank*, type cam-free-bank
(define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6)))
;; definition for function cam-mouse-input
(defun cam-mouse-input ((arg0 matrix) (arg1 vector) (arg2 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(let ((v1-0 (new 'stack-no-clear 'vector)))
(vector-! v1-0 (the-as vector (-> *mouse* pos)) (-> *mouse* pos 1))
(if (< (-> *camera* interest-dist) 409.6)
(set! (-> *camera* interest-dist) 409.6)
)
(let ((s3-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
)
(let ((a0-9 (new 'stack-no-clear 'vector)))
0.0
(let ((a1-3 a0-9))
(let ((a2-4 (-> *math-camera* trans)))
(let ((a3-0 (-> arg0 fvec)))
(let ((t0-1 (-> *camera* interest-dist)))
(.mov vf7 t0-1)
)
(.lvf vf5 (&-> a3-0 quad))
)
(.lvf vf4 (&-> a2-4 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-3 quad) vf6)
)
(vector-! s3-0 (-> *math-camera* trans) a0-9)
)
(vector-length s3-0)
(cond
((mouse-hold? left)
(let ((f30-0 (* 72.81778 (-> *mouse* speedy)))
(f28-0 (* -72.81778 (-> *mouse* speedx)))
)
(let ((a2-8 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> arg0 rvec) f30-0)))
(vector-orient-by-quat! s2-0 s3-0 a2-8)
)
(let ((a2-10 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *y-vector* f28-0)))
(vector-orient-by-quat! s2-0 s2-0 a2-10)
)
(vector-! s2-0 s2-0 s3-0)
(vector-matrix*! s2-0 s2-0 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) arg0))
(+! (-> arg2 x) (-> s2-0 x))
(+! (-> arg2 y) (-> s2-0 y))
(+! (-> arg2 z) (-> s2-0 z))
(+! (-> arg1 x) f30-0)
(set! (-> arg1 y) (+ (-> arg1 y) f28-0))
)
)
((mouse-hold? right)
(+! (-> arg2 z) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed)))
(set! (-> *camera* interest-dist) (- (-> *camera* interest-dist) (* (-> *CAM_FREE-bank* speed) (-> v1-0 x))))
(if (< (-> *camera* interest-dist) 409.6)
(set! (-> *camera* interest-dist) 409.6)
)
(when (< -8192.0 (vector-dot (-> arg0 fvec) s3-0))
(let ((t0-2 (new 'static 'vector :w 1.0)))
(let ((v1-18 t0-2))
(let ((a0-33 (-> *setting-control* cam-current mouse-tumble-point)))
(let ((a1-12 (-> arg0 fvec)))
(let ((a2-13 8192.0))
(.mov vf7 a2-13)
)
(.lvf vf5 (&-> a1-12 quad))
)
(.lvf vf4 (&-> a0-33 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 (&-> v1-18 quad) vf6)
)
(set-setting! 'mouse-tumble-point 'abs t0-2 0)
)
)
)
((mouse-hold? middle)
(+! (-> arg2 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed)))
(+! (-> arg2 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))
(new 'static 'vector :w 1.0)
#f
)
)
)
)
)
)
;; definition for function cam-free-floating-input
(defun cam-free-floating-input ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int) (arg4 int))
(with-pp
(when *camera*
(if (-> *setting-control* cam-current mouse-input)
(cam-mouse-input arg0 arg1 arg2)
)
(let ((s3-0 (and (-> *setting-control* cam-current cpad1-skip-buttons) (= arg4 1)))
(f30-0 (-> *CAM_FREE-bank* speed))
)
(if *camera-turbo-free*
(set! f30-0 (* 10.0 f30-0))
)
(cond
((logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))
)
((cpad-hold? arg4 r2)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 r1)
(+! (-> arg2 y)
(+ (* 0.2 f30-0)
(analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 9)) 0.0 32.0 230.0 (* 0.2 f30-0))
)
)
)
)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 l1)
(set! (-> arg2 y)
(- (-> arg2 y)
(+ (* 0.2 f30-0)
(analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 8)) 0.0 32.0 230.0 (* 0.2 f30-0))
)
)
)
)
)
)
(else
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 r1)
(+! (-> arg2 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 9)) 0.0 32.0 230.0 f30-0))
)
)
)
(when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
(if (cpad-hold? arg4 l1)
(set! (-> arg2 y)
(- (-> arg2 y)
(+ f30-0 (analog-input (the-as int (-> *cpad-list* cpads arg4 abutton 8)) 0.0 32.0 230.0 f30-0))
)
)
)
)
)
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((f26-2 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 leftx))
128.0
48.0
110.0
-1.0
)
)
(f28-4 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 lefty))
128.0
48.0
110.0
-1.0
)
)
(f24-0 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 rightx))
128.0
48.0
110.0
-1.0
)
)
(f0-19 (analog-input
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 righty))
128.0
48.0
110.0
-1.0
)
)
)
(cond
((and (not s3-0)
(logtest? (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 button0-abs 0)
(pad-buttons r2)
)
)
(cond
((logtest? (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 button0-abs 0)
(pad-buttons l2)
)
(set! (-> arg1 y) (- (-> arg1 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
(set! (-> arg1 x) (- (-> arg1 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f0-19))))
)
(else
(set! (-> arg1 y) (- (-> arg1 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))))
(set! (-> arg1 x) (- (-> arg1 x) (* (- f0-19) (-> *CAM_FREE-bank* rot-speed))))
)
)
(+! (-> arg2 x) (* 0.2 f30-0 f26-2))
(+! (-> arg2 z) (* 0.2 f30-0 f28-4))
)
((and (not s3-0) (cpad-hold? arg4 l2))
(+! (-> arg2 x) (* f26-2 f30-0))
(+! (-> arg2 y) (* f0-19 f30-0))
(+! (-> arg2 z) (* f28-4 f30-0))
)
(else
(set! (-> arg1 y) (- (-> arg1 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
(set! (-> arg1 x) (- (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f0-19))))
(+! (-> arg2 x) (* 2.0 f30-0 f26-2))
(+! (-> arg2 z) (* 2.0 f30-0 f28-4))
)
)
)
)
)
(when (not (-> *setting-control* cam-current mouse-input))
(vector-float*! arg1 arg1 (-> pp clock time-adjust-ratio))
(vector-float*! arg2 arg2 (-> pp clock time-adjust-ratio))
)
)
)
)
;; definition of type camera-free-floating-move-info
(deftype camera-free-floating-move-info (structure)
((rv vector :inline)
(tv vector :inline)
(up vector :inline)
(tm matrix :inline)
)
)
;; definition for method 3 of type camera-free-floating-move-info
(defmethod inspect ((this camera-free-floating-move-info))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'camera-free-floating-move-info)
(format #t "~1Trv: #<vector @ #x~X>~%" (-> this rv))
(format #t "~1Ttv: #<vector @ #x~X>~%" (-> this tv))
(format #t "~1Tup: #<vector @ #x~X>~%" (-> this up))
(format #t "~1Ttm: #<matrix @ #x~X>~%" (-> this tm))
(label cfg-4)
this
)
;; definition for function cam-free-floating-move
(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 arg0 (-> s3-0 rv) (-> s3-0 tv) (the-as int (not arg2)) arg3)
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0)
(cond
(arg2
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
(matrix*! arg0 arg0 (-> s3-0 tm))
(cond
((< (vector-dot (-> arg0 uvec) arg2) 0.0)
(forward-down->inv-matrix arg0 (-> arg0 fvec) arg2)
)
(else
(vector-negate! (-> s3-0 up) arg2)
(forward-down->inv-matrix arg0 (-> arg0 fvec) (-> s3-0 up))
)
)
)
(else
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 uvec) (- (-> s3-0 rv y)))
(matrix*! arg0 arg0 (-> s3-0 tm))
)
)
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 rvec) (- (-> s3-0 rv x)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 fvec) (- (-> s3-0 rv z)))
(matrix*! arg0 arg0 (-> s3-0 tm))
(vector+! arg1 arg1 (-> s3-0 tv))
)
)
;; failed to figure out what this is:
(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) (camera-blend-from-type unknown-1))
(set! (-> self blend-to-type) (camera-blend-to-type unknown-1))
(send-event *camera-combiner* 'stop-tracking)
)
)
:code (behavior ()
(until #f
(let ((gp-0 (-> *camera* local-down)))
(if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))
(set! gp-0 (the-as vector #f))
)
(when (not (-> *setting-control* cam-current mouse-input))
(if *amy-cam*
(matrix-rotate-y! (the-as matrix (-> self tracking)) 32768.0)
)
(cam-free-floating-move
(the-as matrix (-> self tracking))
(-> self trans)
gp-0
(the-as int (-> *CAMERA-bank* joypad))
)
(when *amy-cam*
(matrix-rotate-y! (the-as matrix (-> self tracking)) 32768.0)
(let ((a1-4 (matrix-rotate-x! (new 'stack-no-clear 'matrix) 16384.0)))
(matrix*! (the-as matrix (-> self tracking)) a1-4 (the-as matrix (-> self tracking)))
)
)
)
)
(suspend)
)
#f
)
)
File diff suppressed because it is too large Load Diff
+4 -8
View File
@@ -25,11 +25,11 @@
;; definition (perm) for symbol *camera-smush-control*, type smush-control
(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control)))
;; definition (perm) for symbol *camera-smush-control-horizontal*, type object
(define-perm *camera-smush-control-horizontal* object (set-zero! (new 'global 'smush-control)))
;; definition (perm) for symbol *camera-smush-control-horizontal*, type smush-control
(define-perm *camera-smush-control-horizontal* smush-control (set-zero! (new 'global 'smush-control)))
;; definition (perm) for symbol *camera-smush-control-into*, type object
(define-perm *camera-smush-control-into* object (set-zero! (new 'global 'smush-control)))
;; definition (perm) for symbol *camera-smush-control-into*, type smush-control
(define-perm *camera-smush-control-into* smush-control (set-zero! (new 'global 'smush-control)))
;; definition (perm) for symbol *camera-other-root*, type vector
(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
@@ -39,7 +39,3 @@
;; definition for symbol *manual-sample-point*, type symbol
(define *manual-sample-point* #f)
+720
View File
@@ -0,0 +1,720 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function plane-from-points
(defun plane-from-points ((arg0 (inline-array plane)) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 int))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-cross! s4-0 arg1 arg2)
(vector-normalize! s4-0 1.0)
(set! (-> s4-0 w) (vector-dot s4-0 arg3))
(set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x))
(set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y))
(set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z))
(set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w))
)
)
;; definition for function set-point
(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(set! (-> arg0 x) arg1)
(set! (-> arg0 y) arg2)
(set! (-> arg0 z) arg3)
(set! (-> arg0 w) 1.0)
)
;; definition for function update-view-planes
;; INFO: Used lq/sq
(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix))
(local-vars (sv-240 vector))
(when (not *artist-fix-frustum*)
(let ((s5-0 (new 'stack 'view-frustum)))
(let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d)))
(f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d)))
(f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f)))
(f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f)))
)
(set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d))
(set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d))
(set-point (-> s5-0 hither-bottom-right) f30-0 (- f26-0) (-> arg0 d))
(set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f))
(set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f))
(set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f))
)
(vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) arg3)
(vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) arg3)
(vector-matrix*! (-> s5-0 hither-bottom-right) (-> s5-0 hither-bottom-right) arg3)
(vector-matrix*! (-> s5-0 yon-top-left) (-> s5-0 yon-top-left) arg3)
(vector-matrix*! (-> s5-0 yon-top-right) (-> s5-0 yon-top-right) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-left) (-> s5-0 yon-bottom-left) arg3)
(vector-matrix*! (-> s5-0 yon-bottom-right) (-> s5-0 yon-bottom-right) arg3)
(when (= arg2 1.0)
(let ((v1-4 *fog-texture-work*))
(vector-! (the-as vector (-> v1-4 corner)) (-> s5-0 yon-top-left) (-> arg3 trans))
(vector-! (-> v1-4 corner 1) (-> s5-0 yon-top-right) (-> arg3 trans))
(vector-! (-> v1-4 corner 2) (-> s5-0 yon-bottom-left) (-> arg3 trans))
(vector-! (-> v1-4 corner 3) (-> s5-0 yon-bottom-right) (-> arg3 trans))
)
)
(let ((s2-1 (new-stack-vector0))
(s3-1 (new-stack-vector0))
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0))
)
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(set! sv-240 (new 'stack-no-clear 'vector))
(set! (-> sv-240 quad) (the-as uint128 0))
(let ((v1-9 (-> arg3 trans quad)))
(set! (-> sv-240 quad) v1-9)
)
(vector-! s2-1 (-> s5-0 yon-top-left) sv-240)
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
(vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240)
(plane-from-points arg1 s2-1 s1-0 sv-240 0)
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
(plane-from-points arg1 s3-1 s2-1 sv-240 2)
(let ((t9-20 plane-from-points)
(t0-3 3)
)
(t9-20 arg1 s1-0 s0-0 sv-240 t0-3)
)
)
)
)
)
;; definition for symbol *update-leaf-when-outside-bsp*, type symbol
(define *update-leaf-when-outside-bsp* #t)
;; definition for function update-visible
;; INFO: Used lq/sq
(defun update-visible ((arg0 math-camera))
(local-vars (s4-0 level-vis-info))
(when (not *artist-fix-visible*)
(dotimes (s5-0 (-> *level* length))
(let ((v1-5 (-> *level* level s5-0)))
(when (= (-> v1-5 status) 'active)
(if (and (nonzero? (-> v1-5 bsp nodes)) (or *update-leaf-when-outside-bsp* (-> v1-5 inside-boxes?)))
(bsp-camera-asm (-> v1-5 bsp) (-> arg0 trans))
)
)
)
)
(dotimes (gp-1 (-> *level* length))
(let ((s5-1 (-> *level* level gp-1)))
(when (= (-> s5-1 status) 'active)
(let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16)))
(set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?)
(-> s5-1 all-visible?)
#t
)
)
(cond
((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?))
(cond
((or *artist-all-visible* (not (-> s5-1 vis-info 0)))
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
(if (= (-> s5-1 all-visible?) 'loading)
(set! (-> s5-1 all-visible?) #t)
)
)
((begin
(set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index)))
(let ((v1-32 #f))
(when (and s4-0 (-> s4-0 from-bsp))
(set! v1-32 (logtest? (vis-info-flag vis-valid) (-> s4-0 flags)))
(if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx))
(set! v1-32 #f)
)
)
v1-32
)
)
(if (!= (-> s5-1 all-visible?) 'loading)
(set! (-> s5-1 all-visible?) #f)
)
(when (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (the-as (pointer uint8) (-> s4-0 string-block)))
(countdown (v1-40 8)
(let ((a0-27 (-> s5-1 vis-info v1-40)))
(when a0-27
(if (!= a0-27 s4-0)
(set! (-> a0-27 current-vis-string) (the-as uint -1))
)
)
)
)
(set! (-> s5-1 all-visible?) #f)
)
)
((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?))
)
(else
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
)
)
)
(else
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
)
)
)
)
)
)
)
(let ((gp-2 0))
(if (and *artist-fix-visible* (cpad-pressed? 0 r2))
(set! *fix-visible-level-mask* (logand (+ *fix-visible-level-mask* 1) 127))
)
(dotimes (s5-2 (-> *level* length))
(let ((s4-1 (-> *level* level s5-2)))
(when (= (-> s4-1 status) 'active)
(cond
((or *artist-fix-visible* *stats-bsp*)
(set! (-> s4-1 render?) (not (logtest? *fix-visible-level-mask* (ash 1 gp-2))))
(if (!= (-> s4-1 bsp visible-list-length) 4)
(format
*stdcon*
"~0kleaf-index ~8S ~C = ~d node ~d ~S ~S~%"
(-> s4-1 name)
(if (not (logtest? *fix-visible-level-mask* (ash 1 gp-2)))
88
32
)
(-> s4-1 bsp current-leaf-idx)
(-> s4-1 bsp cam-box-idx)
(if (zero? (-> s4-1 bsp cam-using-back))
"front"
"back"
)
(if (nonzero? (-> s4-1 bsp cam-outside-bsp))
"outside"
""
)
)
)
)
(else
(set! (-> s4-1 render?) #t)
)
)
(when (and *artist-fix-visible* (not (logtest? *fix-visible-level-mask* (ash 1 gp-2))))
(let ((s3-0 (-> s4-1 bsp current-leaf-idx))
(s2-0 (-> s4-1 bsp vis-spheres))
)
(-> s4-1 bsp vis-spheres-length)
(when (nonzero? s2-0)
(dotimes (s1-0 (-> s2-0 length))
(let* ((v1-95 (the int (-> s2-0 data s1-0 w)))
(a0-45 (abs v1-95))
)
(when (= a0-45 s3-0)
(if (>= v1-95 0)
(add-debug-sphere #t (bucket-id bucket583) (-> s2-0 data s1-0) (meters 1) (new 'static 'rgba :b #xff :a #x80))
(add-debug-sphere #t (bucket-id bucket583) (-> s2-0 data s1-0) (meters 1) (new 'static 'rgba :r #xff :a #x80))
)
)
)
)
)
)
(when (nonzero? (-> s4-1 bsp nodes))
(let ((v1-109 (-> s4-1 bsp nodes (-> s4-1 bsp cam-box-idx)))
(a2-7 (new 'stack-no-clear 'vector))
)
(set! (-> a2-7 quad) (-> s4-1 bsp bsp-offset quad))
(let ((a3-6 (new 'stack-no-clear 'vector)))
(set! (-> a3-6 quad) (-> s4-1 bsp bsp-offset quad))
(cond
((zero? (-> s4-1 bsp cam-using-back))
(+! (-> a2-7 x) (the float (* (-> v1-109 front-box-min x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a2-7 y) (the float (* (-> v1-109 front-box-min y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a2-7 z) (the float (* (-> v1-109 front-box-min z) (the int (-> s4-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-109 front-box-max x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-109 front-box-max y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-109 front-box-max z) (the int (-> s4-1 bsp bsp-scale z)))))
)
(else
(+! (-> a2-7 x) (the float (* (-> v1-109 back-box-min x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a2-7 y) (the float (* (-> v1-109 back-box-min y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a2-7 z) (the float (* (-> v1-109 back-box-min z) (the int (-> s4-1 bsp bsp-scale z)))))
(+! (-> a3-6 x) (the float (* (-> v1-109 back-box-max x) (the int (-> s4-1 bsp bsp-scale x)))))
(+! (-> a3-6 y) (the float (* (-> v1-109 back-box-max y) (the int (-> s4-1 bsp bsp-scale y)))))
(+! (-> a3-6 z) (the float (* (-> v1-109 back-box-max z) (the int (-> s4-1 bsp bsp-scale z)))))
)
)
(add-debug-box #t (bucket-id bucket583) a2-7 a3-6 (new 'static 'rgba :g #xff :b #xff :a #x80))
)
)
)
)
(if (!= (-> s4-1 bsp visible-list-length) 4)
(+! gp-2 1)
)
)
)
)
)
#f
)
;; definition for symbol *save-camera-inv-rot*, type matrix
(define *save-camera-inv-rot* (new 'global 'matrix))
;; failed to figure out what this is:
(matrix-identity! *save-camera-inv-rot*)
;; definition for function move-camera-from-pad
;; INFO: Used lq/sq
(defun move-camera-from-pad ((arg0 math-camera))
(let ((v1-0 *external-cam-mode*)
(s5-0 0)
)
(cond
((= v1-0 'locked)
(set! v1-0 #f)
)
((= v1-0 'pad-1)
(set! s5-0 1)
)
((not *camera-combiner*)
(set! v1-0 'pad-0)
)
)
(when v1-0
(let ((a2-1
(vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0))
)
)
(if (= (vector-length a2-1) 0.0)
(set! (-> a2-1 y) -1.0)
)
(if (logtest? *external-cam-options* (external-cam-option allow-z))
(set! a2-1 (the-as vector #f))
)
(cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) a2-1 s5-0)
)
)
)
(let* ((a2-2 (-> *math-camera* inv-camera-rot))
(a3-1 *save-camera-inv-rot*)
(v1-14 (-> a3-1 rvec quad))
(a0-13 (-> a3-1 uvec quad))
(a1-2 (-> a3-1 fvec quad))
(a3-2 (-> a3-1 trans quad))
)
(set! (-> a2-2 rvec quad) v1-14)
(set! (-> a2-2 uvec quad) a0-13)
(set! (-> a2-2 fvec quad) a1-2)
(set! (-> a2-2 trans quad) a3-2)
)
arg0
)
;; definition for function external-cam-reset!
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defun external-cam-reset! ()
(when (not (movie?))
(vector-reset! (-> *math-camera* trans))
(matrix-identity! (-> *math-camera* inv-camera-rot))
(when *camera-combiner*
(let* ((v1-7 (-> *math-camera* inv-camera-rot))
(a3-0 (-> *camera-combiner* inv-camera-rot))
(a0-2 (-> a3-0 rvec quad))
(a1-0 (-> a3-0 uvec quad))
(a2-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> v1-7 rvec quad) a0-2)
(set! (-> v1-7 uvec quad) a1-0)
(set! (-> v1-7 fvec quad) a2-0)
(set! (-> v1-7 trans quad) a3-1)
)
(set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))
)
)
0
(none)
)
;; definition for symbol *start-timer*, type int
(define *start-timer* (the-as int #f))
;; definition for symbol *timer-value*, type int
(define *timer-value* 0)
;; definition for symbol *start-pos*, type vector
(define *start-pos* (new 'global 'vector))
;; definition for function update-camera
;; INFO: Used lq/sq
(defun update-camera ()
(with-pp
(let ((gp-0 *math-camera*))
(let* ((a2-0 (-> gp-0 prev-inv-camera-rot))
(a3-0 (-> gp-0 inv-camera-rot))
(v1-0 (-> a3-0 rvec quad))
(a0-0 (-> a3-0 uvec quad))
(a1-0 (-> a3-0 fvec quad))
(a3-1 (-> a3-0 trans quad))
)
(set! (-> a2-0 rvec quad) v1-0)
(set! (-> a2-0 uvec quad) a0-0)
(set! (-> a2-0 fvec quad) a1-0)
(set! (-> a2-0 trans quad) a3-1)
)
(set! (-> gp-0 prev-trans quad) (-> gp-0 trans quad))
(when *start-timer*
(when (= *timer-value* 180)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> *target* control trans x)
(-> *target* control trans y)
(-> *target* control trans z)
)
(set! (-> *start-pos* quad) (-> *target* control trans quad))
)
(when (= *timer-value* 480)
(format
#t
"Player pos = ~F ~F ~F~%"
(-> *target* control trans x)
(-> *target* control trans y)
(-> *target* control trans z)
)
(format
#t
"Dist = ~F~%"
(* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*))
)
(set! *start-timer* (the-as int #f))
)
(if (< 179 *timer-value*)
(format *stdcon* "~%~%Time = ~D~%" *timer-value*)
)
(set! *timer-value* (+ *timer-value* 1))
)
(when (not *start-timer*)
(set! *timer-value* 0)
0
)
(let ((f0-9 (if (get-menu-mode *blit-displays-work*)
11650.845
(-> gp-0 fov)
)
)
)
(update-math-camera
gp-0
(-> *setting-control* user-current video-mode)
(-> *setting-control* user-current aspect-ratio)
f0-9
)
)
(cond
((or (= *master-mode* 'pause) (or (= *master-mode* 'freeze) (= *master-mode* 'progress) *progress-process*))
)
((>= *camera-look-through-other* 2)
(set! *camera-look-through-other* 1)
)
((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu))
(set! *camera-look-through-other* 0)
0
)
)
0.0
0.0
0.0
(let ((s5-1 (new 'stack-no-clear 'vector))
(s4-1 (-> pp clock))
)
(set! (-> pp clock) (-> *display* camera-clock))
(update! *camera-smush-control*)
(let ((f28-0 (get-no-update *camera-smush-control*)))
(update! *camera-smush-control-horizontal*)
(let ((f30-1 (get-no-update *camera-smush-control-horizontal*)))
(update! *camera-smush-control-into*)
(get-no-update *camera-smush-control-into*)
(set! (-> pp clock) s4-1)
(cond
(*external-cam-mode*
(move-camera-from-pad gp-0)
)
((nonzero? *camera-look-through-other*)
(set! (-> gp-0 fov) (-> *camera-other-fov* data))
(set! (-> gp-0 trans quad) (-> *camera-other-trans* quad))
(+! (-> gp-0 trans y) f28-0)
(let* ((a2-6 (-> gp-0 inv-camera-rot))
(a3-5 *camera-other-matrix*)
(v1-76 (-> a3-5 rvec quad))
(a0-34 (-> a3-5 uvec quad))
(a1-7 (-> a3-5 fvec quad))
(a3-6 (-> a3-5 trans quad))
)
(set! (-> a2-6 rvec quad) v1-76)
(set! (-> a2-6 uvec quad) a0-34)
(set! (-> a2-6 fvec quad) a1-7)
(set! (-> a2-6 trans quad) a3-6)
)
(let* ((a2-7 *save-camera-inv-rot*)
(a3-7 *camera-other-matrix*)
(v1-77 (-> a3-7 rvec quad))
(a0-35 (-> a3-7 uvec quad))
(a1-8 (-> a3-7 fvec quad))
(a3-8 (-> a3-7 trans quad))
)
(set! (-> a2-7 rvec quad) v1-77)
(set! (-> a2-7 uvec quad) a0-35)
(set! (-> a2-7 fvec quad) a1-8)
(set! (-> a2-7 trans quad) a3-8)
)
)
((and *camera-combiner* (not *external-cam-mode*))
(set! (-> gp-0 fov) (-> *camera-combiner* fov))
(set! (-> gp-0 trans quad) (-> *camera-combiner* trans quad))
(+! (-> gp-0 trans y) f28-0)
(let* ((v1-84 (-> gp-0 inv-camera-rot))
(a3-9 (-> *camera-combiner* inv-camera-rot))
(a0-40 (-> a3-9 rvec quad))
(a1-9 (-> a3-9 uvec quad))
(a2-8 (-> a3-9 fvec quad))
(a3-10 (-> a3-9 trans quad))
)
(set! (-> v1-84 rvec quad) a0-40)
(set! (-> v1-84 uvec quad) a1-9)
(set! (-> v1-84 fvec quad) a2-8)
(set! (-> v1-84 trans quad) a3-10)
)
(let* ((v1-85 *save-camera-inv-rot*)
(a3-11 (-> *camera-combiner* inv-camera-rot))
(a0-42 (-> a3-11 rvec quad))
(a1-10 (-> a3-11 uvec quad))
(a2-9 (-> a3-11 fvec quad))
(a3-12 (-> a3-11 trans quad))
)
(set! (-> v1-85 rvec quad) a0-42)
(set! (-> v1-85 uvec quad) a1-10)
(set! (-> v1-85 fvec quad) a2-9)
(set! (-> v1-85 trans quad) a3-12)
)
)
(*camera*
(move-camera-from-pad gp-0)
)
)
(when (or (nonzero? *camera-look-through-other*) (and *camera-combiner* (not *external-cam-mode*)))
0.0
(set-vector! s5-1 f30-1 0.0 0.0 1.0)
(vector-rotate*! s5-1 s5-1 (-> gp-0 inv-camera-rot))
(set! (-> s5-1 y) 0.0)
(vector+! (-> gp-0 trans) (-> gp-0 trans) s5-1)
)
)
)
)
(matrix-transpose! (-> gp-0 camera-rot) (-> gp-0 inv-camera-rot))
(cond
(*camera-no-mip-correction*
(set! (-> gp-0 fov-correction-factor) 1.0)
)
(else
(let ((f0-27 (fmin 11650.845 (-> gp-0 fov))))
(set! (-> gp-0 fov-correction-factor) (* 0.00008583069 f0-27))
)
)
)
(if (< 0.0 (-> gp-0 smooth-t))
(set! (-> gp-0 smooth-t) (- (-> gp-0 smooth-t) (-> gp-0 smooth-step)))
)
(cond
((< 0.0 (-> gp-0 smooth-t))
(let ((s5-2 (new-stack-quaternion0)))
(matrix->quaternion s5-2 (-> gp-0 inv-camera-rot))
(quaternion-slerp! s5-2 s5-2 (-> gp-0 inv-camera-rot-smooth-from) (-> gp-0 smooth-t))
(quaternion->matrix (-> gp-0 inv-camera-rot-smooth) s5-2)
)
)
(else
(let* ((a2-12 (-> gp-0 inv-camera-rot-smooth))
(a3-14 (-> gp-0 inv-camera-rot))
(v1-106 (-> a3-14 rvec quad))
(a0-51 (-> a3-14 uvec quad))
(a1-16 (-> a3-14 fvec quad))
(a3-15 (-> a3-14 trans quad))
)
(set! (-> a2-12 rvec quad) v1-106)
(set! (-> a2-12 uvec quad) a0-51)
(set! (-> a2-12 fvec quad) a1-16)
(set! (-> a2-12 trans quad) a3-15)
)
)
)
(when (and (!= *master-mode* 'menu) *display-camera-info*)
(when *target*
(let ((v1-112 (target-pos 0)))
(format *stdcon* "targ pos ~M ~M ~M~%" (-> v1-112 x) (-> v1-112 y) (-> v1-112 z))
)
)
(format
*stdcon*
"cam pos ~M ~M ~M fov ~R~%"
(-> gp-0 trans x)
(-> gp-0 trans y)
(-> gp-0 trans z)
(-> gp-0 fov)
)
(let ((v1-115 (-> *setting-control* cam-current)))
(format
*stdcon*
"string info min-l ~M max-l ~M min-h ~M max-h ~M~%"
(-> v1-115 string-min-length)
(-> v1-115 string-max-length)
(-> v1-115 string-min-height)
(-> v1-115 string-max-height)
)
)
)
(when (zero? (-> gp-0 reset))
(let* ((a2-16 (-> gp-0 prev-camera-temp))
(a3-19 (-> gp-0 camera-temp))
(v1-119 (-> a3-19 rvec quad))
(a0-58 (-> a3-19 uvec quad))
(a1-20 (-> a3-19 fvec quad))
(a3-20 (-> a3-19 trans quad))
)
(set! (-> a2-16 rvec quad) v1-119)
(set! (-> a2-16 uvec quad) a0-58)
(set! (-> a2-16 fvec quad) a1-20)
(set! (-> a2-16 trans quad) a3-20)
)
)
(let ((s3-1 (-> gp-0 camera-temp))
(s2-0 (-> gp-0 camera-rot))
(s5-3 (-> gp-0 inv-camera-rot))
(s4-2 (-> gp-0 trans))
)
(let ((s1-0 (new-stack-vector0)))
(set! (-> s1-0 x) (- (-> s4-2 x)))
(set! (-> s1-0 y) (- (-> s4-2 y)))
(set! (-> s1-0 z) (- (-> s4-2 z)))
(set! (-> s1-0 w) 1.0)
(vector-matrix*! s1-0 s1-0 s2-0)
(set! (-> s2-0 trans quad) (-> s1-0 quad))
)
(matrix*! s3-1 s2-0 (-> gp-0 perspective))
(set! (-> s5-3 trans quad) (-> s4-2 quad))
)
(when (nonzero? (-> gp-0 reset))
(let* ((a2-19 (-> gp-0 prev-camera-temp))
(a3-21 (-> gp-0 camera-temp))
(v1-125 (-> a3-21 rvec quad))
(a0-61 (-> a3-21 uvec quad))
(a1-23 (-> a3-21 fvec quad))
(a3-22 (-> a3-21 trans quad))
)
(set! (-> a2-19 rvec quad) v1-125)
(set! (-> a2-19 uvec quad) a0-61)
(set! (-> a2-19 fvec quad) a1-23)
(set! (-> a2-19 trans quad) a3-22)
)
(set! (-> gp-0 reset) 0)
0
)
(let ((f1-5 (-> gp-0 fog-min))
(f0-52 (-> gp-0 fog-max))
)
(let ((f2-0 (-> gp-0 d)))
(set! (-> *instance-tie-work* hmge-d x) f1-5)
(set! (-> *instance-tie-work* hmge-d y) f0-52)
(set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0))
(set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(let ((v1-132 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-tie-work* hvdf-offset quad) v1-132)
)
(set! (-> *instance-shrub-work* hmge-d x) f1-5)
(set! (-> *instance-shrub-work* hmge-d y) f0-52)
(set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0))
(set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> gp-0 hmge-scale w)))
(set! (-> *instance-shrub-work* billboard-const x) (/ (-> gp-0 x-pix) (* f2-0 (-> gp-0 x-ratio))))
(set! (-> *instance-shrub-work* billboard-const y) (/ (-> gp-0 y-pix) (* f2-0 (-> gp-0 y-ratio))))
)
(set! (-> *instance-shrub-work* billboard-const z) f1-5)
(set! (-> *instance-shrub-work* billboard-const w) f0-52)
)
(set! (-> *instance-shrub-work* constants w) (the-as float (-> gp-0 vis-gifs 0)))
(let ((a0-63 (-> gp-0 hvdf-off quad)))
(set! (-> *instance-shrub-work* hvdf-offset quad) a0-63)
)
(update-view-planes gp-0 (-> gp-0 plane) 1.0 (-> gp-0 inv-camera-rot))
(update-view-planes gp-0 (-> gp-0 guard-plane) 2.0 (-> gp-0 inv-camera-rot))
(shrub-make-perspective-matrix (-> gp-0 shrub-mat) (-> gp-0 camera-temp))
(update-visible gp-0)
(when (-> *time-of-day-context* use-camera-other)
(let ((s4-3 (-> gp-0 camera-rot))
(s0-0 (-> gp-0 camera-rot-other-sky))
(s5-4 (-> gp-0 camera-rot-other-sprite))
(s3-2 (-> gp-0 camera-rot-other))
(s2-1 (-> gp-0 inv-camera-rot-other))
(s1-1 (-> gp-0 camera-temp-other))
)
(quaternion->matrix s0-0 (-> gp-0 quat-other))
(mem-copy! (the-as pointer s5-4) (the-as pointer s0-0) 64)
(set! (-> s5-4 trans quad) (-> gp-0 trans-other quad))
(set! (-> s5-4 trans w) 1.0)
(matrix*! s3-2 s5-4 s4-3)
(matrix-inverse-of-rot-trans! s2-1 s3-2)
(matrix*! s1-1 s3-2 (-> gp-0 perspective))
(update-view-planes gp-0 (-> gp-0 plane-other) 1.0 s2-1)
(update-view-planes gp-0 (-> gp-0 guard-plane-other) 2.0 s2-1)
(shrub-make-perspective-matrix (-> gp-0 shrub-mat-other) s1-1)
)
)
)
#f
)
)
;; definition (debug) for function move-level-by-name
(defun-debug move-level-by-name ((arg0 symbol) (arg1 float) (arg2 float) (arg3 float))
(let ((v1-1 (level-get *level* arg0)))
(when v1-1
(logior! (-> v1-1 info level-flags) (level-flags lf10))
(let ((v0-1 (-> *math-camera* trans-other)))
(set! (-> v0-1 x) (* 4096.0 arg1))
(set! (-> v0-1 y) (* 4096.0 arg2))
(set! (-> v0-1 z) (* 4096.0 arg3))
(set! (-> v0-1 w) 1.0)
v0-1
)
)
)
)
;; definition for function execute-cam-post-hook-engine
(defun execute-cam-post-hook-engine ()
(let* ((gp-0 *cam-post-hook-engine*)
(s5-0 (-> gp-0 alive-list next0))
(s4-0 (-> s5-0 next0))
)
(while (!= s5-0 (-> gp-0 alive-list-end))
((the-as (function object object object object object) (-> (the-as connection s5-0) param0))
(get-process (the-as connection s5-0))
(-> (the-as connection s5-0) param1)
(-> (the-as connection s5-0) param2)
(-> (the-as connection s5-0) param2)
)
(set! s5-0 s4-0)
(set! s4-0 (-> s4-0 next0))
)
)
0
)
+24 -18
View File
@@ -7,8 +7,8 @@
(vec vector 2 :inline)
)
(:methods
(cam-index-method-9 () none)
(cam-index-method-10 () none)
(cam-index-method-9 (_type_ symbol entity vector curve) symbol)
(cam-index-method-10 (_type_ vector) float)
)
)
@@ -89,21 +89,21 @@
(debug-last-point int32)
)
(:methods
(tracking-spline-method-9 () none)
(tracking-spline-method-10 () none)
(tracking-spline-method-11 () none)
(tracking-spline-method-12 () none)
(tracking-spline-method-13 () none)
(tracking-spline-method-14 () none)
(tracking-spline-method-15 () none)
(tracking-spline-method-16 () none)
(tracking-spline-method-17 () none)
(tracking-spline-method-18 () none)
(tracking-spline-method-19 () none)
(tracking-spline-method-20 () none)
(tracking-spline-method-21 () none)
(tracking-spline-method-22 () none)
(tracking-spline-method-23 () none)
(tracking-spline-method-9 (_type_) none)
(tracking-spline-method-10 (_type_ vector) none)
(debug-point-info (_type_ int) none)
(debug-all-points (_type_) none)
(tracking-spline-method-13 (_type_ int) none)
(tracking-spline-method-14 (_type_ tracking-spline-sampler) none)
(tracking-spline-method-15 (_type_) none)
(tracking-spline-method-16 (_type_ float) none)
(tracking-spline-method-17 (_type_ vector float float symbol) int)
(tracking-spline-method-18 (_type_ float vector vector tracking-spline-sampler) vector)
(tracking-spline-method-19 (_type_ float vector vector tracking-spline-sampler) vector)
(tracking-spline-method-20 (_type_ vector int) none)
(tracking-spline-method-21 (_type_ vector float float float float vector) vector)
(tracking-spline-method-22 (_type_ float) symbol)
(debug-draw-spline (_type_) none)
)
)
@@ -394,6 +394,9 @@
(tracking cam-rotation-tracker :inline)
(fast-rot basic)
)
(:states
cam-combiner-active
)
)
;; definition for method 3 of type camera-combiner
@@ -630,7 +633,10 @@
(:methods
(camera-master-method-14 (_type_ vector) vector)
(camera-master-method-15 (_type_ vector) vector)
(camera-master-method-16 () none)
(camera-master-method-16 (_type_ symbol) int)
)
(:states
cam-master-active
)
)
File diff suppressed because it is too large Load Diff
+14 -21
View File
@@ -972,28 +972,21 @@
:virtual #t
:code (behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(new 'stack 'trajectory)
(set! (-> self base y) (-> self jump-pos y))
(let ((t9-1 (method-of-type trajectory trajectory-method-12)))
(-> self root trans)
(-> self jump-pos)
#x43960000
-1072586060
(t9-1)
)
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (seconds 1))
(the float (- (current-time) (-> self state-time)))
(let ((t9-2 (method-of-type trajectory trajectory-method-9)))
(-> self root trans)
(t9-2)
)
(transform-post)
(common-post self)
(suspend)
(if (nonzero? (-> self skel))
(ja :num! (loop! 0.5))
(let ((gp-0 (new 'stack 'trajectory)))
(set! (-> self base y) (-> self jump-pos y))
(setup-from-to-duration! gp-0 (-> self root trans) (-> self jump-pos) 300.0 -2.2755556)
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (seconds 1))
(let ((f0-2 (the float (- (current-time) (-> self state-time)))))
(compute-trans-at-time gp-0 f0-2 (-> self root trans))
)
(transform-post)
(common-post self)
(suspend)
(if (nonzero? (-> self skel))
(ja :num! (loop! 0.5))
)
)
)
(set! (-> self root trans quad) (-> self jump-pos quad))
(set! (-> self base quad) (-> self root trans quad))
+1 -5
View File
@@ -4451,11 +4451,7 @@
(go-virtual die)
)
(('reset)
(-> self sync)
(let ((t9-1 (method-of-type sync-linear sync-info-method-15)))
0
(t9-1)
)
(sync-now! (-> self sync) 0.0)
)
(('play)
(sound-play-by-name (-> self spawn-sound) (new-sound-id) 1024 0 0 (sound-group) (-> self pos))
+2
View File
@@ -59,6 +59,8 @@ This probably started as a very simple structure, but now it is extremely compli
(actor-birth-order (pointer uint32) :offset 172)
(region-trees (array drawable-tree-region-prim) :offset 188)
(collide-hash collide-hash :offset 196)
(vis-spheres vector-array :offset 216)
(vis-spheres-length uint32 :offset 248)
(tfrag-masks texture-masks-array :offset 256)
(tfrag-closest (pointer float))
(tfrag-mask-count uint32 :overlay-at tfrag-closest)
+2 -2
View File
@@ -441,7 +441,7 @@
(level-method-13 () none)
(compute-memory-usage! (_type_ symbol) memory-usage-block)
(level-method-15 () none)
(level-method-16 () none)
(update-vis! (_type_ level-vis-info uint (pointer uint8)) symbol)
(level-method-17 () none)
(level-method-18 () none)
(level-method-19 () none)
@@ -665,7 +665,7 @@
(level-group-method-16 () none)
(level-group-method-17 () none)
(level-group-method-18 () none)
(level-group-method-19 () none)
(level-update (_type_) none)
(level-get-target-inside (_type_) level)
(level-group-method-21 () none)
(art-group-get-by-name (_type_ string (pointer level)) art-group)
+1 -5
View File
@@ -280,7 +280,7 @@
(:methods
(nav-control-method-9 () none)
(nav-control-method-10 () none)
(nav-control-method-11 () none)
(find-poly-containing-point-1 (_type_ vector) nav-poly)
(nav-control-method-12 () none)
(nav-control-method-13 () none)
(nav-control-method-14 () none)
@@ -388,7 +388,3 @@
;; failed to figure out what this is:
0
+18 -17
View File
@@ -9,15 +9,15 @@
(gravity meters)
)
(:methods
(trajectory-method-9 () none)
(trajectory-method-10 () none)
(trajectory-method-11 () none)
(trajectory-method-12 () none)
(trajectory-method-13 () none)
(trajectory-method-14 () none)
(trajectory-method-15 () none)
(trajectory-method-16 () none)
(trajectory-method-17 () none)
(compute-trans-at-time (_type_ float vector) vector)
(compute-transv-at-time (_type_ float vector) vector)
(compute-time-until-apex (_type_) float)
(setup-from-to-duration! (_type_ vector vector float float) none)
(setup-from-to-xz-vel! (_type_ vector vector float float) none)
(setup-from-to-y-vel! (_type_ vector vector float float) none)
(setup-from-to-height! (_type_ vector vector float float) none)
(setup-from-to-duration-and-height! (_type_ vector vector float float) none)
(debug-draw (_type_) none)
)
)
@@ -49,7 +49,7 @@
(:methods
(new (symbol type process-drawable int float collide-spec) _type_)
(initialize (_type_ process-drawable int float collide-spec) impact-control)
(impact-control-method-10 () none)
(update-from-cspace (_type_) none)
(impact-control-method-11 (_type_ collide-query process pat-surface) float)
)
)
@@ -98,7 +98,7 @@
(:methods
(new (symbol type vector vector) _type_)
(initialize (_type_ vector vector) point-tracker)
(point-tracker-method-10 () none)
(point-tracker-method-10 (_type_ vector vector vector float) vector)
(point-tracker-method-11 (_type_ vector vector vector float) vector)
)
)
@@ -219,13 +219,14 @@
;; definition of type cubic-curve
(deftype cubic-curve (structure)
((mat matrix :inline)
(vec vector 4 :inline :overlay-at (-> mat data 0))
)
(:methods
(cubic-curve-method-9 () none)
(cubic-curve-method-10 () none)
(cubic-curve-method-11 () none)
(cubic-curve-method-12 () none)
(cubic-curve-method-13 () none)
(cubic-curve-method-9 (_type_ vector vector vector vector) none)
(cubic-curve-method-10 (_type_ vector float) vector)
(cubic-curve-method-11 (_type_ vector float) vector)
(cubic-curve-method-12 (_type_ vector float) vector)
(debug-draw-curve (_type_) none)
)
)
@@ -236,7 +237,7 @@
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'cubic-curve)
(format #t "~1Tmat: #<matrix @ #x~X>~%" (-> this mat))
(format #t "~1Tmat: #<matrix @ #x~X>~%" (-> this vec))
(label cfg-4)
this
)
+554
View File
@@ -0,0 +1,554 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 9 of type trajectory
(defmethod compute-trans-at-time ((this trajectory) (arg0 float) (arg1 vector))
(vector+float*! arg1 (-> this initial-position) (-> this initial-velocity) arg0)
(+! (-> arg1 y) (* 0.5 arg0 arg0 (-> this gravity)))
arg1
)
;; definition for method 10 of type trajectory
;; INFO: Used lq/sq
(defmethod compute-transv-at-time ((this trajectory) (arg0 float) (arg1 vector))
(set! (-> arg1 quad) (-> this initial-velocity quad))
(+! (-> arg1 y) (* arg0 (-> this gravity)))
arg1
)
;; definition for method 11 of type trajectory
(defmethod compute-time-until-apex ((this trajectory))
(/ (- (-> this initial-velocity y)) (-> this gravity))
)
;; definition for method 12 of type trajectory
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod setup-from-to-duration! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(set! (-> this initial-position quad) (-> arg0 quad))
(set! (-> this gravity) arg3)
(set! (-> this time) arg2)
(let ((f0-3 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(vector-! (-> this initial-velocity) arg1 arg0)
(vector-xz-normalize! (-> this initial-velocity) f0-3)
)
(set! (-> this initial-velocity y) (- (/ (- (-> arg1 y) (-> arg0 y)) arg2) (* 0.5 arg2 (-> this gravity))))
0
(none)
)
;; definition for method 13 of type trajectory
;; WARN: Return type mismatch int vs none.
(defmethod setup-from-to-xz-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (/ (vector-vector-xz-distance arg1 arg0) arg2)))
(setup-from-to-duration! this arg0 arg1 f0-1 arg3)
)
0
(none)
)
;; definition for method 14 of type trajectory
;; WARN: Return type mismatch int vs none.
(defmethod setup-from-to-y-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-0 arg2)
(f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3)))
(f0-3 900.0)
)
(when (>= f1-3 0.0)
(let ((f0-4 (sqrtf f1-3)))
(set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3)))
)
)
(setup-from-to-duration! this arg0 arg1 f0-3 arg3)
)
0
(none)
)
;; definition for method 15 of type trajectory
;; WARN: Return type mismatch int vs none.
(defmethod setup-from-to-height! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let* ((f0-1 (+ arg2 (fmax (-> arg0 y) (-> arg1 y))))
(f1-4 (* 2.0 (- (-> arg0 y) f0-1) arg3))
(f0-4 4096.0)
)
(if (< 0.0 f1-4)
(set! f0-4 (sqrtf f1-4))
)
(setup-from-to-y-vel! this arg0 arg1 f0-4 arg3)
)
0
(none)
)
;; definition for method 16 of type trajectory
;; WARN: Return type mismatch int vs none.
;; WARN: Function (method 16 trajectory) has a return type of none, but the expression builder found a return statement.
(defmethod setup-from-to-duration-and-height! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float))
(let ((f0-1 (- (-> arg1 y) (-> arg0 y))))
(cond
((= f0-1 0.0)
(let ((t9-0 (method-of-type trajectory setup-from-to-duration!))
(v1-2 arg2)
(f0-3 (* -8.0 arg3))
(f1-3 arg2)
)
(t9-0 this arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3)))
)
(return 0)
)
((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1))
(set! arg3 f0-1)
)
((and (< f0-1 0.0) (< arg3 0.0) (< f0-1 arg3))
(set! arg3 f0-1)
)
)
(let* ((f1-14 (/ (- arg3 f0-1) arg3))
(f0-6 -2.0)
(f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14)))))
(f0-8 (* f0-6 (* f1-18 f1-18) arg3))
)
(setup-from-to-duration! this arg0 arg1 arg2 f0-8)
)
)
0
(none)
)
;; failed to figure out what this is:
(method-set!
trajectory
17
(if *debug-segment*
(lambda ((arg0 trajectory))
(let ((s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 10)
)
(set! (-> s4-0 quad) (-> arg0 initial-position quad))
(dotimes (s2-0 s3-0)
(set! (-> s5-0 quad) (-> s4-0 quad))
(let ((f0-1 (* (-> arg0 time) (/ (+ 1.0 (the float s2-0)) (the float s3-0)))))
(compute-trans-at-time arg0 f0-1 s4-0)
)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
s5-0
s4-0
(new 'static 'rgba :r #xff :a #x80)
#f
(the-as rgba -1)
)
)
)
0
(none)
)
nothing
)
)
;; definition for method 9 of type impact-control
;; INFO: Used lq/sq
(defmethod initialize ((this impact-control) (arg0 process-drawable) (arg1 int) (arg2 float) (arg3 collide-spec))
(set! (-> this start-time) (the-as uint (current-time)))
(set! (-> this process) (the-as (pointer process-drawable) (process->ppointer arg0)))
(set! (-> this joint) arg1)
(set! (-> this radius) arg2)
(set! (-> this collide-with) (logclear arg3 (collide-spec water)))
(set! (-> this trans 0 quad) (the-as uint128 0))
(set! (-> this trans 1 quad) (the-as uint128 0))
this
)
;; definition for method 10 of type impact-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod update-from-cspace ((this impact-control))
(when (>= (-> this joint) 0)
(set! (-> this trans 1 quad) (-> this trans 0 quad))
(vector<-cspace! (the-as vector (-> this trans)) (-> this process 0 node-list data (-> this joint)))
(vector-! (-> this dir) (the-as vector (-> this trans)) (-> this trans 1))
)
0
(none)
)
;; definition for method 11 of type impact-control
;; INFO: Used lq/sq
(defmethod impact-control-method-11 ((this impact-control) (arg0 collide-query) (arg1 process) (arg2 pat-surface))
(set! (-> arg0 start-pos quad) (-> this trans 1 quad))
(set! (-> arg0 move-dist quad) (-> this dir quad))
(let ((v1-2 (ppointer->process (-> this process)))
(a0-6 arg0)
)
(set! (-> a0-6 radius) (-> this radius))
(set! (-> a0-6 collide-with) (-> this collide-with))
(set! (-> a0-6 ignore-process0) v1-2)
(set! (-> a0-6 ignore-process1) #f)
(set! (-> a0-6 ignore-pat) arg2)
(set! (-> a0-6 action-mask) (collide-action solid))
)
(let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* arg0)))
(when (and arg1 (>= f30-0 0.0) (>= 0.0 (vector-dot (-> arg0 best-other-tri normal) (-> this dir))))
(let* ((s3-0 (new 'stack-no-clear 'touching-shapes-entry))
(s2-0 (-> arg0 best-other-tri collide-ptr))
(v1-12 (if (type? s2-0 collide-shape-prim)
s2-0
)
)
)
(set! (-> s3-0 cshape1) #f)
(set! (-> s3-0 cshape2) (if v1-12
(-> (the-as collide-shape-prim v1-12) cshape)
)
)
(set! (-> s3-0 resolve-u) (the int f30-0))
(set! (-> s3-0 head) #f)
(send-event
arg1
'impact-control
:from (if v1-12
(-> (the-as collide-shape-prim v1-12) cshape process)
arg1
)
#f
s3-0
this
arg0
)
)
)
f30-0
)
)
;; definition for method 9 of type point-tracker
;; INFO: Used lq/sq
(defmethod initialize ((this point-tracker) (arg0 vector) (arg1 vector))
(set! (-> this trans 0 quad) (-> arg0 quad))
(set! (-> this trans 1 quad) (-> arg1 quad))
this
)
;; definition for method 10 of type point-tracker
;; INFO: Used lq/sq
(defmethod point-tracker-method-10 ((this point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(cond
((>= 0.0 arg3)
(set! (-> arg0 quad) (-> arg1 quad))
)
((>= arg3 1.0)
(set! (-> arg0 quad) (-> arg2 quad))
)
(else
(let ((a1-2 (vector+float*! arg0 arg2 (vector-! (new 'stack-no-clear 'vector) arg1 arg2) (- 1.0 arg3))))
(vector-lerp! arg0 a1-2 arg2 arg3)
)
)
)
arg0
)
;; definition for method 11 of type point-tracker
(defmethod point-tracker-method-11 ((this point-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(with-pp
(let ((v1-1 (point-tracker-method-10 this (new 'stack-no-clear 'vector) arg1 arg2 arg3)))
(vector-! arg0 v1-1 arg1)
)
(vector-float*! arg0 arg0 (-> pp clock frames-per-second))
arg0
)
)
;; definition for method 13 of type combo-tracker
;; WARN: Return type mismatch process vs process-focusable.
(defmethod combo-tracker-method-13 ((this combo-tracker) (arg0 handle) (arg1 vector) (arg2 float) (arg3 vector) (arg4 float))
(the-as
process-focusable
(cond
((send-event (handle->process arg0) 'combo)
(let ((gp-1 (handle->process arg0)))
(if (type? gp-1 process-focusable)
gp-1
)
)
)
(else
(let ((s1-0 (new 'stack-no-clear 'bounding-box))
(s2-1 (new 'stack 'boxed-array collide-shape 32))
)
(sphere<-vector+r! (the-as sphere s1-0) arg1 arg2)
(set! (-> s2-1 length) (fill-actor-list-for-box
*actor-hash*
s1-0
(the-as (pointer collide-shape) (-> s2-1 data))
(-> s2-1 allocated-length)
)
)
(let ((gp-2 (find-nearest-focusable
(the-as (array collide-shape) s2-1)
arg1
arg2
(if (= arg4 65536.0)
(search-info-flag crate enemy combo)
(search-info-flag crate enemy prefer-angle cull-angle combo)
)
(search-info-flag)
arg3
(the-as vector #f)
arg4
)
)
)
(if (type? gp-2 process-focusable)
gp-2
)
)
)
)
)
)
)
;; definition for method 12 of type combo-tracker
(defmethod combo-tracker-method-12 ((this combo-tracker) (arg0 vector) (arg1 vector) (arg2 process) (arg3 time-frame))
(initialize this arg0 arg1)
(set! (-> this target) (process->handle arg2))
(set! (-> this move-start-time) arg3)
this
)
;; definition for method 11 of type combo-tracker
;; INFO: Used lq/sq
(defmethod point-tracker-method-11 ((this combo-tracker) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float))
(local-vars (at-0 int))
(with-pp
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((v1-1 (point-tracker-method-10 this (new 'stack-no-clear 'vector) arg1 arg2 arg3)))
(vector-! arg0 v1-1 arg1)
)
(let ((a1-4 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-4 from) (process->ppointer pp))
(set! (-> a1-4 num-params) 0)
(set! (-> a1-4 message) 'nav-control)
(let* ((s3-0 (send-event-function (handle->process (-> this target)) a1-4))
(s4-1 (if (type? s3-0 nav-control)
s3-0
)
)
)
(when s4-1
(cond
(((method-of-type nav-control find-poly-containing-point-1) (the-as nav-control s4-1) arg1)
(let ((t9-4 (method-of-type nav-control nav-control-method-20)))
#x45000000
(t9-4)
)
)
(else
(set! (-> arg0 quad) (the-as uint128 0))
)
)
)
)
)
(let ((v1-12 arg0))
(.lvf vf1 (&-> arg0 quad))
(let ((f0-0 (-> pp clock frames-per-second)))
(.mov at-0 f0-0)
)
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-12 quad) vf1)
)
arg0
)
)
)
;; definition for function traj2d-calc-initial-speed-using-tilt
(defun traj2d-calc-initial-speed-using-tilt ((arg0 traj2d-params))
(let ((f0-4 (* (- (* (-> arg0 x) (tan (-> arg0 initial-tilt))) (-> arg0 y)) (/ 2.0 (-> arg0 gravity)))))
(cond
((< 0.0 f0-4)
(set! (-> arg0 time) (sqrtf f0-4))
(set! (-> arg0 initial-speed) (/ (-> arg0 x) (* (-> arg0 time) (cos (-> arg0 initial-tilt)))))
#t
)
(else
(set! (-> arg0 time) 0.0)
(set! (-> arg0 initial-speed) 0.0)
#f
)
)
)
)
;; definition for function traj3d-calc-initial-velocity-using-tilt
(defun traj3d-calc-initial-velocity-using-tilt ((arg0 traj3d-params))
(vector-! (-> arg0 diff) (-> arg0 dest) (-> arg0 src))
(let ((s5-0 (new 'stack-no-clear 'traj2d-params)))
(let ((v1-1 (-> arg0 diff)))
(set! (-> s5-0 x) (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z)))))
)
(set! (-> s5-0 y) (-> arg0 diff y))
(set! (-> s5-0 gravity) (-> arg0 gravity))
(set! (-> s5-0 initial-tilt) (-> arg0 initial-tilt))
(cond
((traj2d-calc-initial-speed-using-tilt s5-0)
(set! (-> arg0 time) (-> s5-0 time))
(let* ((f26-0 (atan (-> arg0 diff x) (-> arg0 diff z)))
(f30-0 (-> arg0 initial-tilt))
(f24-0 (cos f30-0))
(f28-0 (-> s5-0 initial-speed))
)
(set! (-> arg0 initial-speed) f28-0)
(set! (-> arg0 initial-velocity x) (* f28-0 f24-0 (sin f26-0)))
(set! (-> arg0 initial-velocity z) (* f28-0 f24-0 (cos f26-0)))
(set! (-> arg0 initial-velocity y) (* f28-0 (sin f30-0)))
)
(set! (-> arg0 initial-velocity w) 1.0)
#t
)
(else
(set! (-> arg0 time) 0.0)
(set! (-> arg0 initial-speed) 0.0)
(vector-reset! (-> arg0 initial-velocity))
#f
)
)
)
)
;; definition for method 9 of type cubic-curve
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod cubic-curve-method-9 ((this cubic-curve) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
)
(init-vf0-vector)
(set! (-> this vec 0 quad) (-> arg0 quad))
(set! (-> this mat uvec quad) (-> arg1 quad))
(let ((v1-2 (new 'stack-no-clear 'trajectory)))
(vector-! (-> v1-2 initial-velocity) arg2 arg0)
(vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) 3.0)
(let ((t1-7 (-> v1-2 initial-position)))
(let ((a1-3 (-> v1-2 initial-position)))
(let ((a3-2 arg1))
(let ((t2-1 -2.0))
(.mov vf7 t2-1)
)
(.lvf vf5 (&-> a3-2 quad))
)
(.lvf vf4 (&-> a1-3 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 (&-> t1-7 quad) vf6)
)
(vector-! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3)
(set! (-> this mat fvec quad) (-> v1-2 initial-position quad))
(vector-float*! (-> v1-2 initial-position) (-> v1-2 initial-velocity) -2.0)
(vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg1)
(vector+! (-> v1-2 initial-position) (-> v1-2 initial-position) arg3)
(set! (-> this mat trans quad) (-> v1-2 initial-position quad))
)
(dotimes (v1-5 4)
(set! (-> this vec v1-5 w) 0.0)
)
0
(none)
)
)
;; definition for method 10 of type cubic-curve
(defmethod cubic-curve-method-10 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(let ((f0-1 (* arg1 arg1)))
(set-vector! (-> v1-0 initial-position) 1.0 arg1 f0-1 (* f0-1 arg1))
)
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
;; definition for method 11 of type cubic-curve
(defmethod cubic-curve-method-11 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(set-vector! (-> v1-0 initial-position) 0.0 1.0 (* 2.0 arg1) (* 3.0 arg1 arg1))
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
;; definition for method 12 of type cubic-curve
(defmethod cubic-curve-method-12 ((this cubic-curve) (arg0 vector) (arg1 float))
(let ((v1-0 (new 'stack-no-clear 'trajectory)))
(set-vector! (-> v1-0 initial-position) 0.0 0.0 2.0 (* 6.0 arg1))
(vector-matrix*! arg0 (-> v1-0 initial-position) (the-as matrix (-> this vec)))
)
(set! (-> arg0 w) 1.0)
arg0
)
;; definition for method 13 of type cubic-curve
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod debug-draw-curve ((this cubic-curve))
(let ((s5-0 (new 'stack-no-clear 'trajectory))
(s4-0 10)
)
(cubic-curve-method-10 this (-> s5-0 initial-velocity) 0.0)
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 initial-velocity) *color-red*)
(dotimes (s3-0 s4-0)
(set! (-> s5-0 initial-position quad) (-> s5-0 initial-velocity quad))
(let ((f0-2 (/ (+ 1.0 (the float s3-0)) (the float s4-0))))
(cubic-curve-method-10 this (-> s5-0 initial-velocity) f0-2)
)
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 initial-velocity) *color-red*)
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
(-> s5-0 initial-position)
(-> s5-0 initial-velocity)
*color-red*
#f
(the-as rgba -1)
)
)
)
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
(cubic-curve-method-10 this (new 'stack-no-clear 'vector) 0.0)
(cubic-curve-method-11 this (new 'stack-no-clear 'vector) 0.0)
(meters 0.00024414062)
*color-white*
)
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
(cubic-curve-method-10 this (new 'stack-no-clear 'vector) 1.0)
(vector-negate! (new 'stack-no-clear 'vector) (cubic-curve-method-11 this (new 'stack-no-clear 'vector) 1.0))
(meters 0.00024414062)
*color-white*
)
0
(none)
)
+161 -3
View File
@@ -112,7 +112,166 @@
)
;; definition (debug) for function target-history-print
;; ERROR: function was not converted to expressions. Cannot decompile.
;; WARN: new jak 2 until loop case, check carefully
(defun-debug target-history-print ((arg0 history-iterator))
(local-vars
(sv-16 object)
(sv-24 int)
(sv-32 collide-status)
(sv-40 number)
(sv-44 vector)
(sv-48 vector)
(sv-52 vector)
(sv-56 vector)
(sv-60 vector)
(sv-64 vector)
(sv-68 number)
(sv-72 history-elt)
(sv-80 time-frame)
(sv-88 uint)
)
(set! sv-16 (-> arg0 out))
(set! sv-24 0)
(set! sv-32 (collide-status))
(set! sv-40 0)
(set! sv-44 *zero-vector*)
(set! sv-48 *zero-vector*)
(set! sv-52 *zero-vector*)
(set! sv-56 *zero-vector*)
(set! sv-60 *zero-vector*)
(set! sv-64 *zero-vector*)
(set! sv-68 0)
(until #f
(set! sv-72 (update-entries! arg0))
(if (not sv-72)
(return #f)
)
(set! sv-80 (frame-counter-delta arg0 sv-72))
(set! sv-88 (-> sv-72 record-id))
(when (!= sv-24 sv-88)
(set! sv-24 (the-as int sv-88))
(format
(-> arg0 out)
"~6D ~8S #x~8X "
sv-80
(if (logtest? sv-32 (collide-status no-touch))
"air"
(-> *pat-mode-info* (shr (shl (the-as int sv-68) 54) 61) name)
)
sv-32
)
(format
(-> arg0 out)
"~C~C~C~C~C~C"
(if (not (logtest? (the-as int sv-40) 1))
103
87
)
(if (not (logtest? (the-as int sv-40) 2))
103
87
)
(cond
((logtest? (the-as int sv-40) 2048)
71
)
((not (logtest? (the-as int sv-40) 4))
103
)
(else
87
)
)
(cond
((logtest? (the-as int sv-40) 512)
66
)
((logtest? (the-as int sv-40) 8)
76
)
(else
99
)
)
(if (not (logtest? (the-as int sv-40) 16))
110
66
)
(if (not (logtest? (the-as int sv-40) 32))
103
65
)
)
(format
(-> arg0 out)
"~C~C "
(cond
((logtest? #x10000 (the-as int sv-40))
80
)
((logtest? (the-as int sv-40) #x8000)
85
)
((logtest? (the-as int sv-40) 64)
78
)
(else
95
)
)
(cond
((logtest? (the-as int sv-40) 1024)
76
)
((logtest? (the-as int sv-40) 256)
67
)
((logtest? (the-as int sv-40) 128)
108
)
(else
95
)
)
)
(format (-> arg0 out) "trans: ~6,,2m ~6,,2m ~6,,2m " (-> sv-44 x) (-> sv-44 y) (-> sv-44 z))
(format (-> arg0 out) "int: ~6,,2m ~6,,2m ~6,,2m " (-> sv-56 x) (-> sv-56 y) (-> sv-56 z))
(format (-> arg0 out) "vel: ~6,,2m ~6,,2m ~6,,2m " (-> sv-48 x) (-> sv-48 y) (-> sv-48 z))
(format (-> arg0 out) "vel-out: ~6,,2m ~6,,2m ~6,,2m " (-> sv-52 x) (-> sv-52 y) (-> sv-52 z))
(format (-> arg0 out) "normal: ~6,,2f ~6,,2f ~6,,2f " (-> sv-60 x) (-> sv-60 y) (-> sv-60 z))
(format (-> arg0 out) "local: ~6,,2f ~6,,2f ~6,,2f " (-> sv-64 x) (-> sv-64 y) (-> sv-64 z))
(format (-> arg0 out) "~%")
)
(case (-> sv-72 channel)
(((history-channel trans))
(set! sv-44 (-> sv-72 vector))
)
(((history-channel transv-in))
(set! sv-48 (-> sv-72 vector))
)
(((history-channel transv-out))
(set! sv-52 (-> sv-72 vector))
)
(((history-channel intersect))
(set! sv-56 (-> sv-72 vector))
)
(((history-channel pat))
(set! sv-68 (-> sv-72 vector x))
)
(((history-channel collide-status))
(set! sv-32 (-> sv-72 collide-status))
(set! sv-40 (-> sv-72 vector z))
)
(((history-channel surface-normal))
(set! sv-60 (-> sv-72 vector))
)
(((history-channel local-normal))
(set! sv-64 (-> sv-72 vector))
)
)
)
#f
)
;; definition (debug) for function target-print-stats
;; INFO: Used lq/sq
@@ -2534,8 +2693,7 @@
(vector-average! (-> self control midpoint-of-hands) gp-0 s5-0)
)
(vector-! (-> self control ctrl-to-hands-offset) (-> self control midpoint-of-hands) (-> self control trans))
(-> self control impact-ctrl)
((method-of-type impact-control impact-control-method-10))
(update-from-cspace (-> self control impact-ctrl))
(cond
((focus-test? self edge-grab)
(target-compute-edge)
+21 -21
View File
@@ -43,13 +43,13 @@
(period uint32)
)
(:methods
(sync-info-method-9 () none)
(sync-info-method-10 () none)
(get-current-phase-no-mod (_type_) float)
(get-phase-offset (_type_) float)
(get-norm! (_type_ int) float)
(sync-info-method-12 () none)
(get-scaled-val! (_type_ float int) float)
(initialize! (_type_ sync-info-params) none)
(sync-info-method-14 () none)
(sync-info-method-15 () none)
(get-timeframe-offset! (_type_ time-frame) time-frame)
(sync-now! (_type_ float) none)
)
)
@@ -155,10 +155,10 @@
)
:pack-me
(:methods
(delayed-rand-float-method-9 () none)
(delayed-rand-float-method-10 () none)
(delayed-rand-float-method-11 () none)
(delayed-rand-float-method-12 () none)
(set-params! (_type_ int int float) float)
(reset! (_type_) float)
(update! (_type_) float)
(update-and-clear! (_type_) float)
)
)
@@ -190,8 +190,8 @@
)
:allow-misaligned
(:methods
(oscillating-float-method-9 () none)
(oscillating-float-method-10 () none)
(set-params! (_type_ float float float float) float)
(update! (_type_ float) float)
)
)
@@ -222,10 +222,10 @@
)
:allow-misaligned
(:methods
(bouncing-float-method-9 () none)
(bouncing-float-method-10 () none)
(bouncing-float-method-11 () none)
(bouncing-float-method-12 () none)
(set-params! (_type_ float float float float float float float) float)
(update! (_type_ float) float)
(at-min? (_type_) symbol)
(at-max? (_type_) symbol)
)
)
@@ -256,10 +256,10 @@
(value vector :inline)
)
(:methods
(delayed-rand-vector-method-9 () none)
(delayed-rand-vector-method-10 () none)
(delayed-rand-vector-method-11 () none)
(delayed-rand-vector-method-12 () none)
(set-params! (_type_ int int float float) vector)
(update-now! (_type_) vector)
(update-with-delay! (_type_) vector)
(update-with-delay-or-reset! (_type_) vector)
)
)
@@ -291,8 +291,8 @@
(accel float)
)
(:methods
(oscillating-vector-method-9 () none)
(oscillating-vector-method-10 () none)
(set-params! (_type_ vector float float float) vector)
(update! (_type_ vector) vector)
)
)
+620
View File
@@ -0,0 +1,620 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 13 of type sync-info
;; WARN: Return type mismatch object vs none.
(defmethod initialize! ((this sync-info) (arg0 sync-info-params))
(format 0 "ERROR: Invalid call to sync-info::initialize!~%")
(none)
)
;; definition for method 9 of type sync-info
(defmethod get-current-phase-no-mod ((this sync-info))
(let* ((v1-0 (-> this period))
(f0-1 (the float v1-0))
(f1-2 (+ (the float (mod (the-as uint (current-time)) v1-0)) (-> this offset)))
)
(/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1)
)
)
;; definition for method 10 of type sync-info
(defmethod get-phase-offset ((this sync-info))
(/ (-> this offset) (the float (-> this period)))
)
;; definition for method 15 of type sync-info
;; WARN: Return type mismatch int vs none.
(defmethod sync-now! ((this sync-info) (arg0 float))
(let* ((a2-0 (-> this period))
(f0-1 (the float a2-0))
(v1-0 (- arg0 (* (the float (the int (/ arg0 f0-1))) f0-1)))
(f1-4 (+ (the float (mod (the-as uint (current-time)) a2-0)) (-> this offset)))
(f1-6 (/ (- f1-4 (* (the float (the int (/ f1-4 f0-1))) f0-1)) f0-1))
(f1-10 (+ (* (- v1-0 f1-6) f0-1) f0-1 (-> this offset)))
)
(set! (-> this offset) (- f1-10 (* (the float (the int (/ f1-10 f0-1))) f0-1)))
)
0
(none)
)
;; definition for method 11 of type sync-info
(defmethod get-norm! ((this sync-info) (arg0 int))
(format 0 "ERROR: Unsupported sync-info::get-norm!~%")
0.0
)
;; definition for method 12 of type sync-info
(defmethod get-scaled-val! ((this sync-info) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; definition for method 14 of type sync-info
(defmethod get-timeframe-offset! ((this sync-info) (arg0 time-frame))
(if (zero? arg0)
(set! arg0 (current-time))
)
(let* ((v1-4 (-> this period))
(f0-1 (the float v1-4))
(f1-2 (+ (the float (mod arg0 (the-as time-frame v1-4))) (-> this offset)))
)
(+ arg0 (the int (- f0-1 (* (/ (- f1-2 (* (the float (the int (/ f1-2 f0-1))) f0-1)) f0-1) f0-1))))
)
)
;; definition for method 13 of type sync-linear
;; INFO: Used lq/sq
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-linear) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-linear)
(format
0
"ERROR: <SW> Using wrong sync params in sync-linear::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s4-0 (the-as int (-> arg0 period)))
(f30-0 (-> arg0 percent))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s4-0 (the int (* 300.0 (-> v1-6 0))))
(set! f30-0 (-> v1-6 1))
)
)
)
)
(set! (-> this period) (the-as uint s4-0))
(let* ((f0-4 (the float s4-0))
(f1-1 (* f30-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
)
(none)
)
;; definition for method 11 of type sync-linear
(defmethod get-norm! ((this sync-linear) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f0-1 (the float v1-4))
)
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f1-0 2.0)
(f2-2 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f0-3 (* f1-0 (/ (- f2-2 (* (the float (the int (/ f2-2 f0-1))) f0-1)) f0-1)))
)
(if (>= f0-3 1.0)
(set! f0-3 (- 2.0 f0-3))
)
f0-3
)
)
(else
(let ((f1-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset))))
(/ (- f1-5 (* (the float (the int (/ f1-5 f0-1))) f0-1)) f0-1)
)
)
)
)
)
;; definition for method 12 of type sync-linear
(defmethod get-scaled-val! ((this sync-linear) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; definition for method 13 of type sync-eased
;; INFO: Used lq/sq
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-eased) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-eased)
(format
0
"ERROR: <SW> Using wrong sync params in sync-eased::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s5-0 (the-as int (-> arg0 period)))
(f22-0 (-> arg0 percent))
(f24-0 (-> arg0 pause-in))
(f26-0 (-> arg0 pause-out))
(f30-0 (-> arg0 ease-in))
(f28-0 (-> arg0 ease-out))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s5-0 (the int (* 300.0 (-> v1-6 0))))
(set! f22-0 (-> v1-6 1))
(when (>= (-> sv-16 elt-count) (the-as uint 4))
(set! f30-0 (-> v1-6 2))
(set! f28-0 (-> v1-6 3))
(when (>= (-> sv-16 elt-count) (the-as uint 6))
(set! f24-0 (-> v1-6 4))
(set! f26-0 (-> v1-6 5))
)
)
)
)
)
)
(set! (-> this period) (the-as uint s5-0))
(let* ((f0-4 (the float s5-0))
(f1-1 (* f22-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
(cond
((< f26-0 0.0)
(set! f26-0 0.0)
)
((< 1.0 f26-0)
(set! f26-0 1.0)
)
)
(cond
((< f24-0 0.0)
(set! f24-0 0.0)
)
((< (- 1.0 f26-0) f24-0)
(set! f24-0 (- 1.0 f26-0))
)
)
(let ((f0-14 (the float s5-0)))
(set! (-> this pause-in) (* f24-0 f0-14))
(set! (-> this pause-out) (* f26-0 f0-14))
)
(if (< f30-0 0.0)
(set! f30-0 0.0)
)
(if (< 1.0 f30-0)
(set! f30-0 1.0)
)
(if (< f28-0 0.001)
(set! f28-0 0.001)
)
(if (< 1.0 f28-0)
(set! f28-0 1.0)
)
(let ((f0-20 (+ f30-0 f28-0)))
(when (< 1.0 f0-20)
(set! f0-20 1.0)
(set! f30-0 (- 1.0 f28-0))
)
(let* ((f1-6 (- 1.0 f0-20))
(f0-21 f30-0)
(f1-7 (+ f30-0 f1-6))
(f2-3 (* f0-21 f0-21))
(f3-3 (+ (* 2.0 f0-21 (- f1-7 f0-21)) f2-3))
(f4-3 (/ f0-21 (- 1.0 f1-7)))
(f3-4 (+ (* (- 1.0 f1-7) (- 1.0 f1-7) f4-3) f3-3))
)
(set! (-> this tlo) f0-21)
(set! (-> this thi) f1-7)
(set! (-> this ylo) f2-3)
(set! (-> this m2) f4-3)
(set! (-> this yend) f3-4)
)
)
)
(none)
)
;; definition for method 11 of type sync-eased
(defmethod get-norm! ((this sync-eased) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f3-0 (the float v1-4))
(f0-1 (-> this pause-in))
(f2-0 (-> this pause-out))
(f1-1 (* 0.5 (- f3-0 (+ f0-1 f2-0))))
)
(the int (+ f0-1 f2-0 f3-0))
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f4-7 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-2 (- f4-7 (* (the float (the int (/ f4-7 f3-0))) f3-0)))
(v1-6 #f)
)
(when (>= f3-2 (+ f1-1 f0-1))
(set! v1-6 #t)
(set! f3-2 (- f3-2 (+ f1-1 f0-1)))
f0-1
(set! f0-1 f2-0)
)
(cond
((< f3-2 f0-1)
(set! f3-2 f0-1)
)
((< (+ f0-1 f1-1) f3-2)
(set! f3-2 (+ f0-1 f1-1))
)
)
(let* ((f0-3 (/ (- f3-2 f0-1) f1-1))
(f1-2 (-> this tlo))
(f0-8 (/ (cond
((< f0-3 f1-2)
(* f0-3 f0-3)
)
((< f0-3 (-> this thi))
(+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> this ylo))
)
(else
(let ((f1-5 (- 1.0 f0-3)))
(- (-> this yend) (* f1-5 f1-5 (-> this m2)))
)
)
)
(-> this yend)
)
)
)
(if v1-6
(set! f0-8 (- 1.0 f0-8))
)
f0-8
)
)
)
(else
(format 0 "ERROR: <SW> Attempting to use sync-eased in unsupported non-pong mode.~%")
0.0
)
)
)
)
;; definition for method 12 of type sync-eased
(defmethod get-scaled-val! ((this sync-eased) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; definition for method 13 of type sync-paused
;; INFO: Used lq/sq
;; WARN: Return type mismatch float vs none.
(defmethod initialize! ((this sync-paused) (arg0 sync-info-params))
(local-vars (sv-16 res-tag))
(if (!= (-> arg0 sync-type) 'sync-paused)
(format
0
"ERROR: <SW> Using wrong sync params in sync-paused::initialize (got ~A)! Fix this!~%"
(-> arg0 sync-type)
)
)
(set! (-> this sync-flags) (-> arg0 sync-flags))
(let ((s5-0 (the-as int (-> arg0 period)))
(f26-0 (-> arg0 percent))
(f28-0 (-> arg0 pause-in))
(f30-0 (-> arg0 pause-out))
)
(let ((a0-3 (-> arg0 entity)))
(when a0-3
(set! sv-16 (new 'static 'res-tag))
(let ((v1-6 (res-lump-data a0-3 'sync (pointer float) :tag-ptr (& sv-16))))
(when v1-6
(set! s5-0 (the int (* 300.0 (-> v1-6 0))))
(set! f26-0 (-> v1-6 1))
(when (>= (-> sv-16 elt-count) (the-as uint 4))
(set! f28-0 (-> v1-6 2))
(set! f30-0 (-> v1-6 3))
)
)
)
)
)
(set! (-> this period) (the-as uint s5-0))
(let* ((f0-4 (the float s5-0))
(f1-1 (* f26-0 f0-4))
)
(set! (-> this offset) (- f1-1 (* (the float (the int (/ f1-1 f0-4))) f0-4)))
)
(cond
((< f30-0 0.0)
(set! f30-0 0.0)
)
((< 1.0 f30-0)
(set! f30-0 1.0)
)
)
(cond
((< f28-0 0.0)
(set! f28-0 0.0)
)
((< (- 1.0 f30-0) f28-0)
(set! f28-0 (- 1.0 f30-0))
)
)
(let ((f0-14 (the float s5-0)))
(set! (-> this pause-in) (* f28-0 f0-14))
(set! (-> this pause-out) (* f30-0 f0-14))
)
)
(none)
)
;; definition for method 11 of type sync-paused
(defmethod get-norm! ((this sync-paused) (arg0 int))
(if (zero? arg0)
(set! arg0 (the-as int (current-time)))
)
(let* ((v1-4 (-> this period))
(f2-0 (the float v1-4))
(f0-1 (-> this pause-in))
(f1-0 (-> this pause-out))
)
(the int (+ f0-1 f1-0 f2-0))
(cond
((logtest? (-> this sync-flags) (sync-flags pong))
(let* ((f3-5 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-6 (- f3-5 (* (the float (the int (/ f3-5 f2-0))) f2-0)))
(f2-2 (* 0.5 (- f2-0 (+ f0-1 f1-0))))
(v1-7 #f)
)
(when (>= f3-6 (+ f2-2 f0-1))
(set! v1-7 #t)
(set! f3-6 (- f3-6 (+ f2-2 f0-1)))
(set! f0-1 f1-0)
)
(let* ((f1-1 (/ (- f3-6 f0-1) f2-2))
(f0-5 (fmax 0.0 (fmin 1.0 f1-1)))
)
(if v1-7
(set! f0-5 (- 1.0 f0-5))
)
f0-5
)
)
)
(else
(let* ((f3-9 (+ (the float (mod arg0 (the-as int v1-4))) (-> this offset)))
(f3-10 (- f3-9 (* (the float (the int (/ f3-9 f2-0))) f2-0)))
(f1-5 (- f2-0 (+ f0-1 f1-0)))
(f1-6 (/ (- f3-10 f0-1) f1-5))
)
(fmax 0.0 (fmin 1.0 f1-6))
)
)
)
)
)
;; definition for method 12 of type sync-paused
(defmethod get-scaled-val! ((this sync-paused) (arg0 float) (arg1 int))
(* (get-norm! this arg1) arg0)
)
;; definition for method 9 of type delayed-rand-float
(defmethod set-params! ((this delayed-rand-float) (arg0 int) (arg1 int) (arg2 float))
(set! (-> this min-time) arg0)
(set! (-> this max-time) arg1)
(set! (-> this max-val) (* 0.5 arg2))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(set! (-> this value) 0.0)
(-> this value)
)
;; definition for method 10 of type delayed-rand-float
(defmethod reset! ((this delayed-rand-float))
(set-time! (-> this start-time))
(set! (-> this timer) (rand-vu-int-range (-> this min-time) (-> this max-time)))
(set! (-> this value) (rand-vu-float-range (- (-> this max-val)) (-> this max-val)))
)
;; definition for method 11 of type delayed-rand-float
(defmethod update! ((this delayed-rand-float))
(if (time-elapsed? (-> this start-time) (-> this timer))
(reset! this)
)
(-> this value)
)
;; definition for method 12 of type delayed-rand-float
(defmethod update-and-clear! ((this delayed-rand-float))
(if (time-elapsed? (-> this start-time) (-> this timer))
(reset! this)
(set! (-> this value) 0.0)
)
(-> this value)
)
;; definition for method 9 of type oscillating-float
(defmethod set-params! ((this oscillating-float) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
(set! (-> this value) arg0)
(set! (-> this target) arg0)
(set! (-> this vel) 0.0)
(set! (-> this max-vel) arg2)
(set! (-> this damping) arg3)
(set! (-> this accel) arg1)
(-> this value)
)
;; definition for method 10 of type oscillating-float
(defmethod update! ((this oscillating-float) (arg0 float))
(with-pp
(let ((f0-3 (* (- (+ (-> this target) arg0) (-> this value)) (* (-> this accel) (-> pp clock time-adjust-ratio)))))
(+! (-> this vel) f0-3)
)
(set! (-> this vel) (fmin (-> this max-vel) (fmax (- (-> this max-vel)) (-> this vel))))
(set! (-> this vel) (* (-> this vel) (-> this damping)))
(+! (-> this value) (* (-> this vel) (-> pp clock time-adjust-ratio)))
(-> this value)
)
)
;; definition for method 9 of type bouncing-float
(defmethod set-params! ((this bouncing-float)
(arg0 float)
(arg1 float)
(arg2 float)
(arg3 float)
(arg4 float)
(arg5 float)
(arg6 float)
)
(set-params! (-> this osc) arg0 arg4 arg5 arg6)
(set! (-> this max-value) arg1)
(set! (-> this min-value) arg2)
(set! (-> this elasticity) arg3)
(set! (-> this state) 0)
(-> this osc value)
)
;; definition for method 10 of type bouncing-float
(defmethod update! ((this bouncing-float) (arg0 float))
(update! (-> this osc) arg0)
(set! (-> this state) 0)
(when (>= (-> this osc value) (-> this max-value))
(set! (-> this osc value) (-> this max-value))
(if (< 0.0 (-> this osc vel))
(set! (-> this osc vel) (* (-> this osc vel) (- (-> this elasticity))))
)
(set! (-> this state) 1)
)
(when (>= (-> this min-value) (-> this osc value))
(set! (-> this osc value) (-> this min-value))
(if (< (-> this osc vel) 0.0)
(set! (-> this osc vel) (* (-> this osc vel) (- (-> this elasticity))))
)
(set! (-> this state) -1)
)
(-> this osc value)
)
;; definition for method 11 of type bouncing-float
(defmethod at-min? ((this bouncing-float))
(= (-> this state) -1)
)
;; definition for method 12 of type bouncing-float
(defmethod at-max? ((this bouncing-float))
(= (-> this state) 1)
)
;; definition for method 9 of type delayed-rand-vector
(defmethod set-params! ((this delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(set! (-> this min-time) arg0)
(set! (-> this max-time) arg1)
(set! (-> this xz-max) (* 0.5 arg2))
(set! (-> this y-max) (* 0.5 arg3))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(vector-reset! (-> this value))
(-> this value)
)
;; definition for method 10 of type delayed-rand-vector
(defmethod update-now! ((this delayed-rand-vector))
(set-time! (-> this start-time))
(set! (-> this timer) (rand-vu-int-range (-> this min-time) (-> this max-time)))
(set! (-> this value x) (rand-vu-float-range (- (-> this xz-max)) (-> this xz-max)))
(set! (-> this value y) (rand-vu-float-range (- (-> this y-max)) (-> this y-max)))
(set! (-> this value z) (rand-vu-float-range (- (-> this xz-max)) (-> this xz-max)))
(-> this value)
)
;; definition for method 11 of type delayed-rand-vector
(defmethod update-with-delay! ((this delayed-rand-vector))
(if (time-elapsed? (-> this start-time) (-> this timer))
(update-now! this)
)
(-> this value)
)
;; definition for method 12 of type delayed-rand-vector
(defmethod update-with-delay-or-reset! ((this delayed-rand-vector))
(if (time-elapsed? (-> this start-time) (-> this timer))
(update-now! this)
(vector-reset! (-> this value))
)
(-> this value)
)
;; definition for method 9 of type oscillating-vector
;; INFO: Used lq/sq
(defmethod set-params! ((this oscillating-vector) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
(cond
(arg0
(set! (-> this value quad) (-> arg0 quad))
(set! (-> this target quad) (-> arg0 quad))
)
(else
(vector-reset! (-> this value))
(vector-reset! (-> this target))
)
)
(vector-reset! (-> this vel))
(set! (-> this max-vel) arg2)
(set! (-> this damping) arg3)
(set! (-> this accel) arg1)
(-> this value)
)
;; definition for method 10 of type oscillating-vector
(defmethod update! ((this oscillating-vector) (arg0 vector))
(with-pp
(let ((v1-0 (new 'stack-no-clear 'vector)))
(cond
(arg0
(vector+! v1-0 (-> this target) arg0)
(vector-! v1-0 v1-0 (-> this value))
)
(else
(vector-! v1-0 (-> this target) (-> this value))
)
)
(vector-float*! v1-0 v1-0 (* (-> this accel) (-> pp clock time-adjust-ratio)))
(vector+! (-> this vel) (-> this vel) v1-0)
(let ((f0-2 (vector-length (-> this vel))))
(if (< (-> this max-vel) f0-2)
(vector-float*! (-> this vel) (-> this vel) (/ (-> this max-vel) f0-2))
)
)
(vector-float*! (-> this vel) (-> this vel) (-> this damping))
(vector-float*! v1-0 (-> this vel) (-> pp clock time-adjust-ratio))
(vector+! (-> this value) (-> this value) v1-0)
)
(-> this value)
)
)
@@ -0,0 +1,26 @@
(deftype test-stack-array-basic (basic)
((a uint32)
(b uint32)
)
)
(let ((x (new 'stack 'boxed-array uint32 2))
(y (new 'stack 'boxed-array test-stack-array-basic 2))
(z (new 'stack 'boxed-array uint64 2))
(a (new 'stack 'test-stack-array-basic))
(b (new 'stack 'test-stack-array-basic)))
(set! (-> x 0) 1)
(set! (-> x 1) 2)
(set! (-> a a) 3)
(set! (-> a b) 4)
(set! (-> b a) 5)
(set! (-> b b) 6)
(set! (-> y 0) a)
(set! (-> y 1) b)
(set! (-> z 0) 7)
(set! (-> z 1) 8)
;; 36
(+ (-> x 0) (-> x 1)
(-> y 0 a) (-> y 0 b) (-> y 1 a) (-> y 1 b)
(-> z 0) (-> z 1))
)
+4
View File
@@ -86,6 +86,10 @@ TEST_F(VariableTests, StackStructureAlignment) {
shared_compiler->runner.run_static_test(testCategory, "stack-structure-align.gc", {"1234\n"});
}
TEST_F(VariableTests, StackBoxedArray) {
shared_compiler->runner.run_static_test(testCategory, "stack-boxed-array.gc", {"36\n"});
}
TEST_F(VariableTests, GetSymbol) {
shared_compiler->runner.run_static_test(testCategory, "get-symbol-1.static.gc",
{"1375524\n"}); // 0x14fd24 in hex
+10 -3
View File
@@ -81,11 +81,18 @@
"target-send-attack",
// find-nearest
"find-nearest-focusable",
// sprite
"(method 3 sprite-aux-list)", // appears twice.
// sprite-distort
"sprite-draw-distorters", // asm
"bugfix?"
// debug
"bugfix?",
// camera-states
"cam-los-collide",
// camera
"v-slrp3!",
"v-slrp2!",
"slave-set-rotation!"
],
"skip_compile_states": {}