mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 04:22:13 -04:00
suffering through floats
This commit is contained in:
@@ -190,7 +190,7 @@ TP_Type SimpleExpression::get_type(const TypeState& input,
|
||||
}
|
||||
// new for jak 2:
|
||||
if (env.version == GameVersion::Jak2 && in_type.is_integer_constant() &&
|
||||
in_type.get_integer_constant() <= UINT32_MAX) {
|
||||
(s64)((s32)in_type.get_integer_constant()) == (s64)in_type.get_integer_constant()) {
|
||||
return TP_Type::make_from_ts("float");
|
||||
}
|
||||
return in_type;
|
||||
@@ -407,6 +407,8 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
|
||||
return TP_Type::make_from_ts(TypeSpec("float"));
|
||||
}
|
||||
return TP_Type::make_from_ts(TypeSpec("int"));
|
||||
} else {
|
||||
return TP_Type::make_from_ts(TypeSpec("uint"));
|
||||
}
|
||||
} break;
|
||||
|
||||
|
||||
@@ -694,6 +694,15 @@ void SimpleExpressionElement::update_from_stack_identity(const Env& env,
|
||||
}
|
||||
}
|
||||
|
||||
bool u64_valid_for_float_constant(u64 in) {
|
||||
u32 top = in >> 32;
|
||||
if (top == 0 || top == UINT32_MAX) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleExpressionElement::update_from_stack_gpr_to_fpr(const Env& env,
|
||||
FormPool& pool,
|
||||
FormStack& stack,
|
||||
@@ -724,12 +733,10 @@ void SimpleExpressionElement::update_from_stack_gpr_to_fpr(const Env& env,
|
||||
auto frm = pool.alloc_sequence_form(nullptr, src_fes);
|
||||
if (src_fes.size() == 1) {
|
||||
auto int_constant = get_goal_integer_constant(frm, env);
|
||||
|
||||
if (int_constant && (*int_constant <= UINT32_MAX)) {
|
||||
if (int_constant && u64_valid_for_float_constant(*int_constant)) {
|
||||
float flt;
|
||||
|
||||
memcpy(&flt, &int_constant.value(), sizeof(float));
|
||||
|
||||
result->push_back(pool.alloc_element<ConstantFloatElement>(flt));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,7 @@ std::unique_ptr<AtomicOp> make_asm_op(const Instruction& i0, int idx) {
|
||||
case InstructionKind::MSUBAS:
|
||||
case InstructionKind::MSUBS:
|
||||
case InstructionKind::ADDAS:
|
||||
case InstructionKind::RSQRTS:
|
||||
|
||||
// Moves / Loads / Stores
|
||||
case InstructionKind::CTC2:
|
||||
|
||||
+341
-461
File diff suppressed because it is too large
Load Diff
@@ -37,7 +37,7 @@
|
||||
"(anon-function 54 script)", "(anon-function 52 script)", "(anon-function 49 script)", "(anon-function 33 script)", "debug-menu-func-decode",
|
||||
"scene-player-init", "(method 77 spyder)", "(method 77 flamer)", "(method 77 grenadier)", "(method 224 bot)", "(method 77 rapid-gunner)",
|
||||
// until loop without nop:
|
||||
"rand-vu-int-count-excluding", "rand-vu-int-range-exclude", "(method 9 history)", "history-print", "history-draw",
|
||||
"(method 9 history)", "history-print", "history-draw",
|
||||
"(method 9 sparticle-launcher)", "(method 18 tracking-spline)", "cam-string-find-position-rel!", "cam-layout-entity-volume-info-create",
|
||||
"process-drawable-shock-skel-effect", "target-history-print", "display-list-control", "anim-test-anim-list-handler",
|
||||
"anim-test-sequence-list-handler", "anim-tester-get-playing-item", "(method 9 mysql-nav-graph)", "(method 58 nav-graph-editor)",
|
||||
@@ -47,7 +47,7 @@
|
||||
// actual asm
|
||||
"quad-copy!", "return-from-thread", "return-from-thread-dead", "reset-and-call", "(method 10 cpu-thread)",
|
||||
"(method 11 cpu-thread)", "(method 0 catch-frame)", "throw-dispatch", "throw", "run-function-in-process",
|
||||
"set-to-run-bootstrap", "return-from-exception",
|
||||
"set-to-run-bootstrap", "return-from-exception", "exp",
|
||||
|
||||
"symlink2", "blerc-a-fragment", "blerc-execute", "foreground-check-longest-edge-asm", "generic-light-proc",
|
||||
"shadow-add-single-edges","shadow-add-facing-single-tris", "shadow-add-double-tris", "shadow-add-double-edges",
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
{
|
||||
"profile": [
|
||||
["L14", "profile-work"]
|
||||
],
|
||||
|
||||
"math": [
|
||||
["L103", "(pointer float)", 32],
|
||||
["L102", "(pointer float)", 32]
|
||||
],
|
||||
|
||||
// possible for auto-labeling
|
||||
"vector-h": [
|
||||
["L36", "vector"],
|
||||
["L35", "vector"],
|
||||
["L34", "vector"],
|
||||
["L33", "vector"],
|
||||
["L32", "vector"],
|
||||
["L31", "vector"],
|
||||
["L30", "vector"]
|
||||
],
|
||||
|
||||
"matrix": [
|
||||
["L65", "matrix"]
|
||||
],
|
||||
"quaternion-h": [
|
||||
["L1", "quaternion"]
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,63 @@
|
||||
{
|
||||
// possible for automatic detection:
|
||||
"(method 23 trsqv)": [[16, "vector"]],
|
||||
"(method 24 trsqv)": [[16, "vector"]],
|
||||
"(method 18 bounding-box)": [[16, "vector"], [32, "vector"]],
|
||||
"(method 12 bounding-box)": [[16, "liang-barsky-line-clip-params"]],
|
||||
"matrixp*!": [[16, "matrix"]],
|
||||
"vector3s-matrix*!": [[16, "vector"]],
|
||||
|
||||
"vector3s-rotate*!": [[16, "vector"]],
|
||||
|
||||
"matrix-rotate-zyx!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-rotate-xyz!": [
|
||||
[16, "vector"],
|
||||
[32, "vector"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-rotate-zxy!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-rotate-yxz!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-rotate-yzx!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-rotate-yxy!": [
|
||||
[16, "vector"],
|
||||
[32, "vector"],
|
||||
[48, "vector"]
|
||||
],
|
||||
"matrix-rotate-yx!": [[16, "matrix"]],
|
||||
"transform-matrix-calc!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"transform-matrix-parent-calc!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix->quat": [
|
||||
[16, "matrix"]
|
||||
],
|
||||
"matrix<-quat": [
|
||||
[16, "vector"],
|
||||
[32, "matrix"]
|
||||
],
|
||||
"matrix->transformq": [
|
||||
[16, "matrix"]
|
||||
],
|
||||
"matrix-rotate-xyz-2!": [
|
||||
[16, "matrix"],
|
||||
[80, "matrix"]
|
||||
],
|
||||
"matrix-with-scale->quaternion": [[16, "matrix"]],
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
||||
@@ -65,5 +65,29 @@
|
||||
[101, "t9", "(function object object object object object object none)"]
|
||||
],
|
||||
"send-event-function": [[[7, 15], "a0", "process"]],
|
||||
|
||||
"logf": [
|
||||
[12, "f0", "float"],
|
||||
[12, "f1", "float"],
|
||||
[19, "f0", "float"],
|
||||
[19, "f1", "float"]
|
||||
],
|
||||
|
||||
"log2f": [
|
||||
[12, "f0", "float"],
|
||||
[12, "f1", "float"],
|
||||
[19, "f0", "float"],
|
||||
[19, "f1", "float"]
|
||||
],
|
||||
|
||||
"log2": [[3, "v1", "int"]],
|
||||
|
||||
"cube-root": [
|
||||
[[0,33], "f0", "float"],
|
||||
[[0,33], "f1", "float"],
|
||||
[[0,33], "f2", "float"]
|
||||
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
("ENGINE.CGO"
|
||||
("types-h.o" "types-h")
|
||||
("vu1-macros.o" "vu1-macros")
|
||||
("math.o" "math")
|
||||
("vector-h.o" "vector-h")
|
||||
("gravity-h.o" "gravity-h")
|
||||
("bounding-box-h.o" "bounding-box-h")
|
||||
("matrix-h.o" "matrix-h")
|
||||
("quaternion-h.o" "quaternion-h")
|
||||
("euler-h.o" "euler-h")
|
||||
("transform-h.o" "transform-h")
|
||||
("geometry-h.o" "geometry-h")
|
||||
("trigonometry-h.o" "trigonometry-h")
|
||||
("transformq-h.o" "transformq-h")
|
||||
("bounding-box.o" "bounding-box")
|
||||
("matrix.o" "matrix")
|
||||
("transform.o" "transform")
|
||||
("quaternion.o" "quaternion")
|
||||
("euler.o" "euler")
|
||||
("trigonometry.o" "trigonometry")
|
||||
("gsound-h.o" "gsound-h")
|
||||
("timer-h.o" "timer-h")
|
||||
("vif-h.o" "vif-h")
|
||||
("dma-h.o" "dma-h")
|
||||
("video-h.o" "video-h")
|
||||
("vu1-user-h.o" "vu1-user-h")
|
||||
("profile-h.o" "profile-h")
|
||||
("dma.o" "dma")
|
||||
("dma-buffer.o" "dma-buffer")
|
||||
("dma-bucket.o" "dma-bucket")
|
||||
("dma-disasm.o" "dma-disasm")
|
||||
("pad.o" "pad")
|
||||
("gs.o" "gs")
|
||||
("display-h.o" "display-h")
|
||||
("geometry.o" "geometry")
|
||||
("timer.o" "timer")
|
||||
("vector.o" "vector")
|
||||
("file-io.o" "file-io")
|
||||
("loader-h.o" "loader-h")
|
||||
("texture-h.o" "texture-h")
|
||||
("texture-anim-h.o" "texture-anim-h")
|
||||
("lights-h.o" "lights-h")
|
||||
("mood-h.o" "mood-h")
|
||||
("level-h.o" "level-h")
|
||||
("capture-h.o" "capture-h")
|
||||
("math-camera-h.o" "math-camera-h")
|
||||
("math-camera.o" "math-camera")
|
||||
("font-h.o" "font-h")
|
||||
("decomp-h.o" "decomp-h")
|
||||
("profile.o" "profile")
|
||||
("display.o" "display")
|
||||
("connect.o" "connect")
|
||||
("text-id-h.o" "text-id-h")
|
||||
("text-h.o" "text-h")
|
||||
("camera-defs-h.o" "camera-defs-h")
|
||||
("trail-h.o" "trail-h")
|
||||
("minimap-h.o" "minimap-h")
|
||||
("bigmap-h.o" "bigmap-h")
|
||||
("settings-h.o" "settings-h")
|
||||
("capture.o" "capture")
|
||||
("memory-usage-h.o" "memory-usage-h")
|
||||
("blit-displays-h.o" "blit-displays-h")
|
||||
("texture.o" "texture")
|
||||
("main-h.o" "main-h")
|
||||
("mspace-h.o" "mspace-h")
|
||||
("drawable-h.o" "drawable-h")
|
||||
("drawable-group-h.o" "drawable-group-h")
|
||||
("drawable-inline-array-h.o" "drawable-inline-array-h")
|
||||
("draw-node-h.o" "draw-node-h")
|
||||
("drawable-tree-h.o" "drawable-tree-h")
|
||||
("drawable-actor-h.o" "drawable-actor-h")
|
||||
("region-h.o" "region-h")
|
||||
("traffic-h.o" "traffic-h")
|
||||
("game-task-h.o" "game-task-h")
|
||||
("task-control-h.o" "task-control-h")
|
||||
("generic-h.o" "generic-h")
|
||||
("sky-h.o" "sky-h")
|
||||
("ocean-h.o" "ocean-h")
|
||||
("ocean-trans-tables.o" "ocean-trans-tables")
|
||||
("ocean-tables.o" "ocean-tables")
|
||||
("ocean-frames.o" "ocean-frames")
|
||||
("time-of-day-h.o" "time-of-day-h")
|
||||
("art-h.o" "art-h")
|
||||
("generic-vu1-h.o" "generic-vu1-h")
|
||||
("merc-h.o" "merc-h")
|
||||
("generic-merc-h.o" "generic-merc-h")
|
||||
("generic-tie-h.o" "generic-tie-h")
|
||||
("generic-work-h.o" "generic-work-h")
|
||||
("shadow-cpu-h.o" "shadow-cpu-h")
|
||||
("shadow-vu1-h.o" "shadow-vu1-h")
|
||||
("memcard-h.o" "memcard-h")
|
||||
("game-info-h.o" "game-info-h")
|
||||
("gui-h.o" "gui-h")
|
||||
("ambient-h.o" "ambient-h")
|
||||
("speech-h.o" "speech-h")
|
||||
("wind-h.o" "wind-h")
|
||||
("prototype-h.o" "prototype-h")
|
||||
("joint-h.o" "joint-h")
|
||||
("bones-h.o" "bones-h")
|
||||
("foreground-h.o" "foreground-h")
|
||||
("engines.o" "engines")
|
||||
("lightning-h.o" "lightning-h")
|
||||
("res-h.o" "res-h")
|
||||
("res.o" "res")
|
||||
("lights.o" "lights")
|
||||
("dynamics-h.o" "dynamics-h")
|
||||
("surface-h.o" "surface-h")
|
||||
("pat-h.o" "pat-h")
|
||||
("fact-h.o" "fact-h")
|
||||
("aligner-h.o" "aligner-h")
|
||||
("penetrate-h.o" "penetrate-h")
|
||||
("game-h.o" "game-h")
|
||||
("script-h.o" "script-h")
|
||||
("scene-h.o" "scene-h")
|
||||
("sync-info-h.o" "sync-info-h")
|
||||
("pov-camera-h.o" "pov-camera-h")
|
||||
("smush-control-h.o" "smush-control-h")
|
||||
("debug-h.o" "debug-h")
|
||||
("joint-mod-h.o" "joint-mod-h")
|
||||
("collide-func-h.o" "collide-func-h")
|
||||
("collide-mesh-h.o" "collide-mesh-h")
|
||||
("collide-shape-h.o" "collide-shape-h")
|
||||
("generic-obs-h.o" "generic-obs-h")
|
||||
("trajectory-h.o" "trajectory-h")
|
||||
("collide-target-h.o" "collide-target-h")
|
||||
("collide-touch-h.o" "collide-touch-h")
|
||||
("collide-edge-grab-h.o" "collide-edge-grab-h")
|
||||
("process-drawable-h.o" "process-drawable-h")
|
||||
("process-focusable.o" "process-focusable")
|
||||
("process-taskable-h.o" "process-taskable-h")
|
||||
("focus.o" "focus")
|
||||
("effect-control-h.o" "effect-control-h")
|
||||
("collide-frag-h.o" "collide-frag-h")
|
||||
("collide-hash-h.o" "collide-hash-h")
|
||||
("chain-physics-h.o" "chain-physics-h")
|
||||
("projectile-h.o" "projectile-h")
|
||||
("find-nearest-h.o" "find-nearest-h")
|
||||
("target-h.o" "target-h")
|
||||
("stats-h.o" "stats-h")
|
||||
("bsp-h.o" "bsp-h")
|
||||
("collide-cache-h.o" "collide-cache-h")
|
||||
("collide-h.o" "collide-h")
|
||||
("shrubbery-h.o" "shrubbery-h")
|
||||
("tie-h.o" "tie-h")
|
||||
("tfrag-h.o" "tfrag-h")
|
||||
("background-h.o" "background-h")
|
||||
("subdivide-h.o" "subdivide-h")
|
||||
("entity-h.o" "entity-h")
|
||||
("sprite-h.o" "sprite-h")
|
||||
("simple-sprite-h.o" "simple-sprite-h")
|
||||
("eye-h.o" "eye-h")
|
||||
("sparticle-launcher-h.o" "sparticle-launcher-h")
|
||||
("sparticle-h.o" "sparticle-h")
|
||||
("actor-link-h.o" "actor-link-h")
|
||||
("camera-h.o" "camera-h")
|
||||
("cam-debug-h.o" "cam-debug-h")
|
||||
("cam-interface-h.o" "cam-interface-h")
|
||||
("cam-update-h.o" "cam-update-h")
|
||||
("hud-h.o" "hud-h")
|
||||
("progress-h.o" "progress-h")
|
||||
("rpc-h.o" "rpc-h")
|
||||
("path-h.o" "path-h")
|
||||
("nav-mesh-h.o" "nav-mesh-h")
|
||||
("nav-control-h.o" "nav-control-h")
|
||||
("spatial-hash-h.o" "spatial-hash-h")
|
||||
("actor-hash-h.o" "actor-hash-h")
|
||||
("load-dgo.o" "load-dgo")
|
||||
("ramdisk.o" "ramdisk")
|
||||
("gsound.o" "gsound")
|
||||
("transformq.o" "transformq")
|
||||
("collide-func.o" "collide-func")
|
||||
("joint.o" "joint")
|
||||
("joint-mod.o" "joint-mod")
|
||||
("chain-physics.o" "chain-physics")
|
||||
("cylinder.o" "cylinder")
|
||||
("wind-work.o" "wind-work")
|
||||
("wind.o" "wind")
|
||||
("bsp.o" "bsp")
|
||||
("subdivide.o" "subdivide")
|
||||
("sprite.o" "sprite")
|
||||
("sprite-distort.o" "sprite-distort")
|
||||
("sprite-glow.o" "sprite-glow")
|
||||
("debug-sphere.o" "debug-sphere")
|
||||
("debug.o" "debug")
|
||||
("history.o" "history")
|
||||
("merc-vu1.o" "merc-vu1")
|
||||
("emerc-vu1.o" "emerc-vu1")
|
||||
("merc-blend-shape.o" "merc-blend-shape")
|
||||
("merc.o" "merc")
|
||||
("emerc.o" "emerc")
|
||||
("ripple.o" "ripple")
|
||||
("bones.o" "bones")
|
||||
("debug-foreground.o" "debug-foreground")
|
||||
("foreground.o" "foreground")
|
||||
("generic-vu0.o" "generic-vu0")
|
||||
("generic-vu1.o" "generic-vu1")
|
||||
("generic-effect.o" "generic-effect")
|
||||
("generic-merc.o" "generic-merc")
|
||||
("generic-tie.o" "generic-tie")
|
||||
("shadow-cpu.o" "shadow-cpu")
|
||||
("shadow-vu1.o" "shadow-vu1")
|
||||
("warp.o" "warp")
|
||||
("texture-anim.o" "texture-anim")
|
||||
("texture-anim-funcs.o" "texture-anim-funcs")
|
||||
("texture-anim-tables.o" "texture-anim-tables")
|
||||
("blit-displays.o" "blit-displays")
|
||||
("font-data.o" "font-data")
|
||||
("font.o" "font")
|
||||
("decomp.o" "decomp")
|
||||
("background.o" "background")
|
||||
("draw-node.o" "draw-node")
|
||||
("shrubbery.o" "shrubbery")
|
||||
("shrub-work.o" "shrub-work")
|
||||
("tfrag-near.o" "tfrag-near")
|
||||
("tfrag.o" "tfrag")
|
||||
("tfrag-methods.o" "tfrag-methods")
|
||||
("tfrag-work.o" "tfrag-work")
|
||||
("tie.o" "tie")
|
||||
("etie-vu1.o" "etie-vu1")
|
||||
("etie-near-vu1.o" "etie-near-vu1")
|
||||
("tie-near.o" "tie-near")
|
||||
("tie-work.o" "tie-work")
|
||||
("tie-methods.o" "tie-methods")
|
||||
("sync-info.o" "sync-info")
|
||||
("trajectory.o" "trajectory")
|
||||
("sparticle-launcher.o" "sparticle-launcher")
|
||||
("sparticle.o" "sparticle")
|
||||
("entity-table.o" "entity-table")
|
||||
("loader.o" "loader")
|
||||
("game-info.o" "game-info")
|
||||
("game-task.o" "game-task")
|
||||
("game-save.o" "game-save")
|
||||
("settings.o" "settings")
|
||||
("mood-tables.o" "mood-tables")
|
||||
("mood-tables2.o" "mood-tables2")
|
||||
("mood.o" "mood")
|
||||
("mood-funcs.o" "mood-funcs")
|
||||
("mood-funcs2.o" "mood-funcs2")
|
||||
("weather-part.o" "weather-part")
|
||||
("time-of-day.o" "time-of-day")
|
||||
("sky-data.o" "sky-data")
|
||||
("sky-tng.o" "sky-tng")
|
||||
("load-state.o" "load-state")
|
||||
("level-info.o" "level-info")
|
||||
("level.o" "level")
|
||||
("text.o" "text")
|
||||
("collide-hash.o" "collide-hash")
|
||||
("collide-probe.o" "collide-probe")
|
||||
("collide-frag.o" "collide-frag")
|
||||
("collide-mesh.o" "collide-mesh")
|
||||
("collide-touch.o" "collide-touch")
|
||||
("collide-edge-grab.o" "collide-edge-grab")
|
||||
("collide-shape.o" "collide-shape")
|
||||
("collide-shape-rider.o" "collide-shape-rider")
|
||||
("collide.o" "collide")
|
||||
("collide-planes.o" "collide-planes")
|
||||
("spatial-hash.o" "spatial-hash")
|
||||
("actor-hash.o" "actor-hash")
|
||||
("merc-death.o" "merc-death")
|
||||
("water-flow.o" "water-flow")
|
||||
("water-h.o" "water-h")
|
||||
("camera.o" "camera")
|
||||
("cam-interface.o" "cam-interface")
|
||||
("cam-master.o" "cam-master")
|
||||
("cam-states.o" "cam-states")
|
||||
("cam-states-dbg.o" "cam-states-dbg")
|
||||
("cam-combiner.o" "cam-combiner")
|
||||
("cam-update.o" "cam-update")
|
||||
("vol-h.o" "vol-h")
|
||||
("cam-layout.o" "cam-layout")
|
||||
("cam-debug.o" "cam-debug")
|
||||
("cam-start.o" "cam-start")
|
||||
("process-drawable.o" "process-drawable")
|
||||
("ambient.o" "ambient")
|
||||
("speech.o" "speech")
|
||||
("region.o" "region")
|
||||
("fma-sphere.o" "fma-sphere")
|
||||
("script.o" "script")
|
||||
("generic-obs.o" "generic-obs")
|
||||
("lightning.o" "lightning")
|
||||
("carry-h.o" "carry-h")
|
||||
("pilot-h.o" "pilot-h")
|
||||
("gun-h.o" "gun-h")
|
||||
("board-h.o" "board-h")
|
||||
("darkjak-h.o" "darkjak-h")
|
||||
("target-util.o" "target-util")
|
||||
("target-part.o" "target-part")
|
||||
("gun-part.o" "gun-part")
|
||||
("collide-reaction-target.o" "collide-reaction-target")
|
||||
("logic-target.o" "logic-target")
|
||||
("sidekick.o" "sidekick")
|
||||
("voicebox.o" "voicebox")
|
||||
("collectables-part.o" "collectables-part")
|
||||
("debug-part.o" "debug-part")
|
||||
("find-nearest.o" "find-nearest")
|
||||
("task-arrow.o" "task-arrow")
|
||||
("projectile.o" "projectile")
|
||||
("target-handler.o" "target-handler")
|
||||
("target-anim.o" "target-anim")
|
||||
("target.o" "target")
|
||||
("target2.o" "target2")
|
||||
("target-swim.o" "target-swim")
|
||||
("target-carry.o" "target-carry")
|
||||
("target-darkjak.o" "target-darkjak")
|
||||
("target-death.o" "target-death")
|
||||
("target-gun.o" "target-gun")
|
||||
("gun-util.o" "gun-util")
|
||||
("gun-blue-shot.o" "gun-blue-shot")
|
||||
("gun-yellow-shot.o" "gun-yellow-shot")
|
||||
("gun-red-shot.o" "gun-red-shot")
|
||||
("gun-dark-shot.o" "gun-dark-shot")
|
||||
("gun-states.o" "gun-states")
|
||||
("board-util.o" "board-util")
|
||||
("target-board.o" "target-board")
|
||||
("board-part.o" "board-part")
|
||||
("board-states.o" "board-states")
|
||||
("mech-h.o" "mech-h")
|
||||
("menu.o" "menu")
|
||||
("drawable.o" "drawable")
|
||||
("drawable-group.o" "drawable-group")
|
||||
("drawable-inline-array.o" "drawable-inline-array")
|
||||
("drawable-tree.o" "drawable-tree")
|
||||
("prototype.o" "prototype")
|
||||
("main-collide.o" "main-collide")
|
||||
("video.o" "video")
|
||||
("main.o" "main")
|
||||
("collide-cache.o" "collide-cache")
|
||||
("collide-debug.o" "collide-debug")
|
||||
("relocate.o" "relocate")
|
||||
("memory-usage.o" "memory-usage")
|
||||
("entity.o" "entity")
|
||||
("path.o" "path")
|
||||
("vol.o" "vol")
|
||||
("nav-mesh.o" "nav-mesh")
|
||||
("nav-control.o" "nav-control")
|
||||
("aligner.o" "aligner")
|
||||
("water.o" "water")
|
||||
("collectables.o" "collectables")
|
||||
("task-control.o" "task-control")
|
||||
("scene.o" "scene")
|
||||
("pov-camera.o" "pov-camera")
|
||||
("powerups.o" "powerups")
|
||||
("crates.o" "crates")
|
||||
("hud.o" "hud")
|
||||
("hud-classes.o" "hud-classes")
|
||||
("progress-static.o" "progress-static")
|
||||
("progress.o" "progress")
|
||||
("progress-draw.o" "progress-draw")
|
||||
("ocean.o" "ocean")
|
||||
("ocean-vu0.o" "ocean-vu0")
|
||||
("ocean-texture.o" "ocean-texture")
|
||||
("ocean-mid.o" "ocean-mid")
|
||||
("ocean-transition.o" "ocean-transition")
|
||||
("ocean-near.o" "ocean-near")
|
||||
("minimap.o" "minimap")
|
||||
("bigmap-data.o" "bigmap-data")
|
||||
("bigmap.o" "bigmap")
|
||||
("eye.o" "eye")
|
||||
("glist-h.o" "glist-h")
|
||||
("glist.o" "glist")
|
||||
("anim-tester.o" "anim-tester")
|
||||
("viewer.o" "viewer")
|
||||
("part-tester.o" "part-tester")
|
||||
("editable-h.o" "editable-h")
|
||||
("editable.o" "editable")
|
||||
("editable-player.o" "editable-player")
|
||||
("mysql-nav-graph.o" "mysql-nav-graph")
|
||||
("nav-graph-editor.o" "nav-graph-editor")
|
||||
("sampler.o" "sampler")
|
||||
("default-menu.o" "default-menu")
|
||||
)
|
||||
@@ -5,3 +5,52 @@
|
||||
;; name in dgo: bounding-box-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype bounding-box (structure)
|
||||
((min vector :inline :offset-assert 0)
|
||||
(max vector :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 21
|
||||
:size-assert #x20
|
||||
:flag-assert #x1500000020
|
||||
(:methods
|
||||
(add-spheres! (_type_ (inline-array sphere) int) int 9)
|
||||
(add-box! (_type_ bounding-box) int 10)
|
||||
(add-point! (_type_ vector) none 11)
|
||||
(intersects-line-segment? (_type_ vector vector) symbol 12)
|
||||
(set-from-point-offset! (_type_ vector vector) none 13)
|
||||
(set-from-point-offset-pad! (_type_ vector vector float) int 14)
|
||||
(set-to-point! (_type_ vector vector float) none 15)
|
||||
(set-from-sphere! (_type_ sphere) none 16)
|
||||
(set-from-spheres! (_type_ (inline-array sphere) int) int 17)
|
||||
(get-bounding-sphere (_type_ vector) vector 18)
|
||||
(inside-xyz? (bounding-box vector) symbol 19)
|
||||
(inside-xz? (bounding-box vector) symbol 20)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype bounding-box4w (structure)
|
||||
((min vector4w :inline :offset-assert 0)
|
||||
(max vector4w :inline :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
(deftype bounding-box-both (structure)
|
||||
((box bounding-box :inline :offset-assert 0)
|
||||
(box4w bounding-box4w :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
(deftype bounding-box-array (inline-array-class)
|
||||
((data bounding-box :inline :dynamic :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
(set! (-> bounding-box-array heap-base) (the-as uint 32))
|
||||
|
||||
@@ -5,3 +5,295 @@
|
||||
;; name in dgo: bounding-box
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(defmethod inside-xyz? bounding-box ((obj bounding-box) (arg0 vector))
|
||||
(and (< (-> obj min x) (-> arg0 x))
|
||||
(< (-> obj min y) (-> arg0 y))
|
||||
(< (-> obj min z) (-> arg0 z))
|
||||
(< (-> arg0 x) (-> obj max x))
|
||||
(< (-> arg0 y) (-> obj max y))
|
||||
(< (-> arg0 z) (-> obj max z))
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod inside-xz? bounding-box ((obj bounding-box) (arg0 vector))
|
||||
(and (< (-> obj min x) (-> arg0 x))
|
||||
(< (-> obj min z) (-> arg0 z))
|
||||
(< (-> arg0 x) (-> obj max x))
|
||||
(< (-> arg0 z) (-> obj max z))
|
||||
)
|
||||
)
|
||||
|
||||
(defun box-vector-enside? ((arg0 bounding-box) (arg1 vector))
|
||||
(and (< (-> arg0 min x) (-> arg1 x))
|
||||
(< (-> arg0 min y) (-> arg1 y))
|
||||
(< (-> arg0 min z) (-> arg1 z))
|
||||
(< (-> arg1 x) (-> arg0 max x))
|
||||
(< (-> arg1 y) (-> arg0 max y))
|
||||
(< (-> arg1 z) (-> arg0 max z))
|
||||
)
|
||||
)
|
||||
|
||||
(defun box-vector-inside? ((arg0 bounding-box) (arg1 vector))
|
||||
(and (>= (-> arg1 x) (-> arg0 min x))
|
||||
(>= (-> arg1 y) (-> arg0 min y))
|
||||
(>= (-> arg1 z) (-> arg0 min z))
|
||||
(>= (-> arg0 max x) (-> arg1 x))
|
||||
(>= (-> arg0 max y) (-> arg1 y))
|
||||
(>= (-> arg0 max z) (-> arg1 z))
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-from-point-offset! bounding-box ((obj bounding-box) (arg0 vector) (arg1 vector))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf3 (&-> arg1 quad))
|
||||
(.lvf vf4 (&-> arg0 quad))
|
||||
(.add.vf vf5 vf4 vf3)
|
||||
(.min.vf vf1 vf4 vf5)
|
||||
(.max.vf vf2 vf4 vf5)
|
||||
(.mov.vf vf1 vf0 :mask #b1000)
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.svf (&-> obj min quad) vf1)
|
||||
(.svf (&-> obj max quad) vf2)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod add-point! bounding-box ((obj bounding-box) (arg0 vector))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
)
|
||||
(.lvf vf1 (&-> obj min quad))
|
||||
(.lvf vf2 (&-> obj max quad))
|
||||
(.lvf vf3 (&-> arg0 quad))
|
||||
(.min.vf vf1 vf1 vf3)
|
||||
(.max.vf vf2 vf2 vf3)
|
||||
(.svf (&-> obj min quad) vf1)
|
||||
(.svf (&-> obj max quad) vf2)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod add-box! bounding-box ((obj bounding-box) (arg0 bounding-box))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
)
|
||||
(.lvf vf1 (&-> obj min quad))
|
||||
(.lvf vf2 (&-> obj max quad))
|
||||
(.lvf vf3 (&-> arg0 min quad))
|
||||
(.lvf vf4 (&-> arg0 max quad))
|
||||
(.min.vf vf1 vf1 vf3)
|
||||
(.max.vf vf2 vf2 vf4)
|
||||
(.svf (&-> obj min quad) vf1)
|
||||
(.svf (&-> obj max quad) vf2)
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-to-point! bounding-box ((obj bounding-box) (arg0 vector) (arg1 vector) (arg2 float))
|
||||
(set! (-> obj min quad) (-> arg0 quad))
|
||||
(set! (-> obj max quad) (-> arg0 quad))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defmethod set-from-point-offset-pad! bounding-box ((obj bounding-box) (arg0 vector) (arg1 vector) (arg2 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf4 (&-> arg1 quad))
|
||||
(.lvf vf5 (&-> arg0 quad))
|
||||
(.mov vf1 arg2)
|
||||
(.add.vf vf6 vf5 vf4)
|
||||
(.min.vf vf2 vf5 vf6)
|
||||
(.max.vf vf3 vf5 vf6)
|
||||
(.add.x.vf vf3 vf3 vf1 :mask #b111)
|
||||
(.sub.x.vf vf2 vf2 vf1 :mask #b111)
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mov.vf vf3 vf0 :mask #b1000)
|
||||
(.svf (&-> obj min quad) vf2)
|
||||
(.svf (&-> obj max quad) vf3)
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-from-sphere! bounding-box ((obj bounding-box) (arg0 sphere))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> arg0 quad))
|
||||
(.sub.w.vf vf2 vf1 vf1 :mask #b111)
|
||||
(.add.w.vf vf3 vf1 vf1 :mask #b111)
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mov.vf vf3 vf0 :mask #b1000)
|
||||
(.svf (&-> obj min quad) vf2)
|
||||
(.svf (&-> obj max quad) vf3)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-from-spheres! bounding-box ((obj bounding-box) (spheres (inline-array sphere)) (count int))
|
||||
"Reset box to hold the given spheres. Note: this implementation could be optimized."
|
||||
;; This is also unrolled, but does 7 at a time.
|
||||
(rlet ((vf0 :class vf)
|
||||
(current-min :class vf)
|
||||
(current-max :class vf)
|
||||
(sph-min :class vf)
|
||||
(sph-max :class vf)
|
||||
(sph :class vf))
|
||||
;; init constant
|
||||
(init-vf0-vector)
|
||||
;; init min/max. in the case we don't have any spheres, we should return (0,0,0,1) for min/max.
|
||||
(set! current-min vf0)
|
||||
(set! current-max vf0)
|
||||
|
||||
(dotimes (i count)
|
||||
(.lvf sph (-> spheres i))
|
||||
(.sub.w.vf sph-min sph sph :mask #b111)
|
||||
(.add.w.vf sph-max sph sph :mask #b111)
|
||||
(cond
|
||||
((zero? i)
|
||||
(set! current-min sph-min)
|
||||
(set! current-max sph-max)
|
||||
)
|
||||
(else
|
||||
(.min.vf current-min current-min sph-min :mask #b111)
|
||||
(.max.vf current-max current-max sph-max :mask #b111)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(.svf (-> obj min) current-min)
|
||||
(.svf (-> obj max) current-max)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod add-spheres! bounding-box ((obj bounding-box) (spheres (inline-array sphere)) (count int))
|
||||
"Add count spheres."
|
||||
;; the PS2 implementation is very optimized
|
||||
;; It is unrolled and 'software pipelined' to do 4 at a time.
|
||||
;; This is slightly less optimized.
|
||||
(rlet ((current-min :class vf)
|
||||
(current-max :class vf)
|
||||
(sph-min :class vf)
|
||||
(sph-max :class vf)
|
||||
(sph :class vf))
|
||||
|
||||
(when (nonzero? count)
|
||||
;; load these outside the loop
|
||||
(.lvf current-min (-> obj min))
|
||||
(.lvf current-max (-> obj max))
|
||||
|
||||
(dotimes (i count)
|
||||
(.lvf sph (-> spheres i))
|
||||
(.sub.w.vf sph-min sph sph :mask #b111)
|
||||
(.add.w.vf sph-max sph sph :mask #b111)
|
||||
(.min.vf current-min current-min sph-min :mask #b111)
|
||||
(.max.vf current-max current-max sph-max :mask #b111)
|
||||
)
|
||||
|
||||
(.svf (-> obj min) current-min)
|
||||
(.svf (-> obj max) current-max)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod get-bounding-sphere bounding-box ((obj bounding-box) (arg0 vector))
|
||||
(let* ((a1-2 (vector-! (new 'stack-no-clear 'vector) (-> obj max) (-> obj min)))
|
||||
(a0-3 (vector-float*! (new 'stack-no-clear 'vector) a1-2 0.5))
|
||||
)
|
||||
(vector+! arg0 (-> obj min) a0-3)
|
||||
(set! (-> arg0 w) (vector-length a0-3))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
(deftype liang-barsky-line-clip-params (structure)
|
||||
((te float :offset-assert 0)
|
||||
(tl float :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
(defun liang-barsky-line-clipt ((arg0 liang-barsky-line-clip-params) (arg1 float) (arg2 float))
|
||||
(cond
|
||||
((< 0.0 arg1)
|
||||
(let ((f0-2 (/ arg2 arg1)))
|
||||
(if (< (-> arg0 tl) f0-2)
|
||||
(return #f)
|
||||
)
|
||||
(if (< (-> arg0 te) f0-2)
|
||||
(set! (-> arg0 te) f0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
((< arg1 0.0)
|
||||
(let ((f0-5 (/ arg2 arg1)))
|
||||
(if (< f0-5 (-> arg0 te))
|
||||
(return #f)
|
||||
)
|
||||
(if (< f0-5 (-> arg0 tl))
|
||||
(set! (-> arg0 tl) f0-5)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (< 0.0 arg2)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
#t
|
||||
)
|
||||
|
||||
(defmethod intersects-line-segment? bounding-box ((obj bounding-box) (arg0 vector) (arg1 vector))
|
||||
(let ((f28-0 (- (-> arg1 x) (-> arg0 x)))
|
||||
(f30-0 (- (-> arg1 z) (-> arg0 z)))
|
||||
)
|
||||
(cond
|
||||
((and (= f28-0 0.0) (= f30-0 0.0))
|
||||
(let ((f1-2 (-> arg0 x))
|
||||
(f0-4 (-> arg0 z))
|
||||
)
|
||||
(and (>= f1-2 (-> obj min x)) (>= (-> obj max x) f1-2) (>= f0-4 (-> obj min z)) (>= (-> obj max z) f0-4))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((s4-0 (new 'stack-no-clear 'liang-barsky-line-clip-params)))
|
||||
(set! (-> s4-0 te) 0.0)
|
||||
(set! (-> s4-0 tl) 1.0)
|
||||
(and (liang-barsky-line-clipt s4-0 f28-0 (- (-> obj min x) (-> arg0 x)))
|
||||
(liang-barsky-line-clipt s4-0 (- f28-0) (- (-> arg0 x) (-> obj max x)))
|
||||
(liang-barsky-line-clipt s4-0 f30-0 (- (-> obj min z) (-> arg0 z)))
|
||||
(liang-barsky-line-clipt s4-0 (- f30-0) (- (-> arg0 z) (-> obj max z)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,3 +5,30 @@
|
||||
;; name in dgo: geometry-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype curve (structure)
|
||||
((cverts (inline-array vector) :offset-assert 0)
|
||||
(num-cverts int32 :offset-assert 4)
|
||||
(knots (pointer float) :offset-assert 8)
|
||||
(num-knots int32 :offset-assert 12)
|
||||
(length float :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x14
|
||||
:flag-assert #x900000014
|
||||
)
|
||||
|
||||
(deftype border-plane (basic)
|
||||
((name symbol :offset-assert 4)
|
||||
(action basic :offset-assert 8)
|
||||
(slot int8 :offset-assert 12)
|
||||
(trans vector :inline :offset-assert 16)
|
||||
(normal vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x30
|
||||
:flag-assert #xb00000030
|
||||
(:methods
|
||||
(debug-draw! (_type_) none 9)
|
||||
(point-past-plane? (_type_ vector) symbol 10)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,3 +5,12 @@
|
||||
;; name in dgo: euler-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(define EulSafe (new 'static 'boxed-array :type int32 0 1 2 0))
|
||||
(define EulNext (new 'static 'boxed-array :type int32 1 2 0 1))
|
||||
|
||||
(deftype euler-angles (vector)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
@@ -5,3 +5,790 @@
|
||||
;; name in dgo: math
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(defun truncate ((arg0 float))
|
||||
(the float (the int arg0))
|
||||
)
|
||||
|
||||
(defun floor ((arg0 float))
|
||||
(let ((f0-3 (the float (the int arg0))))
|
||||
(if (or (>= arg0 0.0) (= arg0 f0-3))
|
||||
f0-3
|
||||
(+ -1.0 f0-3)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun ceil ((arg0 float))
|
||||
(let ((f0-3 (the float (the int arg0))))
|
||||
(if (or (>= 0.0 arg0) (= arg0 f0-3))
|
||||
f0-3
|
||||
(+ 1.0 f0-3)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun integral? ((arg0 float))
|
||||
(= (the float (the int arg0)) arg0)
|
||||
)
|
||||
|
||||
(defun fractional-part ((arg0 float))
|
||||
(- arg0 (the float (the int arg0)))
|
||||
)
|
||||
|
||||
(defun sawtooth-wave ((arg0 float))
|
||||
(let ((f0-2 (- arg0 (the float (the int arg0)))))
|
||||
(if (< f0-2 0.0)
|
||||
(set! f0-2 (+ 1.0 f0-2))
|
||||
)
|
||||
f0-2
|
||||
)
|
||||
)
|
||||
|
||||
(defun triangle-wave ((arg0 float))
|
||||
(let* ((f0-1 (* 0.25 (+ -1.0 arg0)))
|
||||
(f0-3 (- f0-1 (the float (the int f0-1))))
|
||||
)
|
||||
(if (< f0-3 0.0)
|
||||
(set! f0-3 (+ 1.0 f0-3))
|
||||
)
|
||||
(+ -1.0 (fabs (+ -2.0 (* 4.0 f0-3))))
|
||||
)
|
||||
)
|
||||
|
||||
(defun log-x-plus-1-order9 ((arg0 float))
|
||||
(* arg0 (+ 1.0
|
||||
(* arg0 (+ -0.5
|
||||
(* arg0 (+ 0.33333334
|
||||
(* arg0 (+ -0.25
|
||||
(* arg0 (+ 0.2
|
||||
(* arg0 (+ -0.16666666
|
||||
(* arg0 (+ 0.14285715
|
||||
(* arg0 (+ -0.125
|
||||
(* 0.11111111 arg0)))))))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun logf ((arg0 float))
|
||||
(let ((v1-1 (the-as int (+ (shr (the-as int arg0) 23) -126)))
|
||||
(a0-2 (the-as number (logior #x3f000000 (logand (the-as uint #x807fffff) (the-as uint arg0)))))
|
||||
)
|
||||
(when (< (the-as float a0-2) 0.70710677)
|
||||
(set! a0-2 (+ (the-as float a0-2) (the-as float a0-2)))
|
||||
(set! v1-1 (the-as int (+ (the-as uint v1-1) -1)))
|
||||
)
|
||||
(let ((f0-5 (+ (the-as float -1.0) (the-as float a0-2))))
|
||||
(+ (* f0-5
|
||||
(+ 1.0 (* f0-5
|
||||
(+ -0.5 (* f0-5
|
||||
(+ 0.33333334 (* f0-5
|
||||
(+ -0.25 (* f0-5
|
||||
(+ 0.2 (* f0-5
|
||||
(+ -0.16666666 (* f0-5
|
||||
(+ 0.14285715 (* f0-5
|
||||
(+ -0.125 (* 0.11111111 f0-5)))))))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(* 0.6931472 (the float v1-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun log2f ((arg0 float))
|
||||
(let ((v1-1 (the-as int (+ (shr (the-as int arg0) 23) -126)))
|
||||
(a0-2 (the-as number (logior #x3f000000 (logand (the-as uint #x807fffff) (the-as uint arg0)))))
|
||||
)
|
||||
(when (< (the-as float a0-2) 0.70710677)
|
||||
(set! a0-2 (+ (the-as float a0-2) (the-as float a0-2)))
|
||||
(set! v1-1 (the-as int (+ (the-as uint v1-1) -1)))
|
||||
)
|
||||
(let* ((f0-5 (+ (the-as float -1.0) (the-as float a0-2)))
|
||||
(f0-7 (* f0-5 (+ 1.0
|
||||
(* f0-5 (+ -0.5
|
||||
(* f0-5 (+ 0.33333334
|
||||
(* f0-5 (+ -0.25
|
||||
(* f0-5 (+ 0.2
|
||||
(* f0-5 (+ -0.16666666
|
||||
(* f0-5 (+ 0.14285715
|
||||
(* f0-5 (+ -0.125
|
||||
(* 0.11111111 f0-5)))))))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+ (* 1.442695 f0-7) (the float v1-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype float-type (uint32)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(define exp-slead (new 'static 'array float 32
|
||||
1.0
|
||||
1.0218964
|
||||
1.0442734
|
||||
1.0671387
|
||||
1.0905075
|
||||
1.1143799
|
||||
1.1387863
|
||||
1.1637192
|
||||
1.1892014
|
||||
1.2152405
|
||||
1.2418518
|
||||
1.2690506
|
||||
1.2968369
|
||||
1.3252335
|
||||
1.354248
|
||||
1.3839035
|
||||
1.4142075
|
||||
1.4451752
|
||||
1.4768219
|
||||
1.5091629
|
||||
1.5422058
|
||||
1.5759735
|
||||
1.6104889
|
||||
1.645752
|
||||
1.6817856
|
||||
1.7186127
|
||||
1.7562485
|
||||
1.7947083
|
||||
1.8340073
|
||||
1.8741608
|
||||
1.9151993
|
||||
1.9571381
|
||||
)
|
||||
)
|
||||
|
||||
(define exp-strail (new 'static 'array float 32
|
||||
0.0
|
||||
0.0000007863494
|
||||
0.00000040596257
|
||||
0.0000017288019
|
||||
0.00000022534104
|
||||
0.0000068597833
|
||||
0.0000023188388
|
||||
0.0000056815315
|
||||
0.0000057600223
|
||||
0.0000068814647
|
||||
0.000006005433
|
||||
0.0000003590472
|
||||
0.0000027016238
|
||||
0.000003183687
|
||||
0.000007500062
|
||||
0.000006378546
|
||||
0.000006103877
|
||||
0.0000056360786
|
||||
0.0000042465254
|
||||
0.0000015247614
|
||||
0.000005014861
|
||||
0.000007334366
|
||||
0.0000014403477
|
||||
0.000003525029
|
||||
0.000007247011
|
||||
0.000006627224
|
||||
0.0000036862523
|
||||
0.00000082304996
|
||||
0.0000008232258
|
||||
0.0000068675085
|
||||
0.000007281612
|
||||
0.000006062652
|
||||
)
|
||||
)
|
||||
|
||||
(defun exp ((arg float))
|
||||
(local-vars
|
||||
(f0 float)
|
||||
(f1 float)
|
||||
(f2 float)
|
||||
(f3 float)
|
||||
(f4 float)
|
||||
(f5 float)
|
||||
(f6 float)
|
||||
(f7 float)
|
||||
(f8 float)
|
||||
(f10 float)
|
||||
(f11 float)
|
||||
(f12 float)
|
||||
(f13 float)
|
||||
(f14 float)
|
||||
(f15 float)
|
||||
(f16 float)
|
||||
(f17 float)
|
||||
(f18 float)
|
||||
(a2 int)
|
||||
(v0 float)
|
||||
(v1 int)
|
||||
(a1 int)
|
||||
(a3 int)
|
||||
(t0 int)
|
||||
(a0-2 int)
|
||||
)
|
||||
|
||||
(set! f0 arg)
|
||||
(set! f0 (fabs f0))
|
||||
(set! f1 (the-as float #x435c6bba))
|
||||
;;(b! (>=.s f1 f0) L44 (nop!))
|
||||
(when-goto (>= f1 f0) L44)
|
||||
|
||||
(set! f0 0.0)
|
||||
(set! f1 arg)
|
||||
;;(b! (>=.s f0 f1) L42 (nop!))
|
||||
(when-goto (>= f0 f1) L42)
|
||||
|
||||
(set! v0 (the-as float #x7f7fffff))
|
||||
;;(b! #t L43 (nop!))
|
||||
(goto L43)
|
||||
|
||||
(label L42)
|
||||
(set! v0 (the-as float #x0))
|
||||
|
||||
(label L43)
|
||||
;;(b! #t L49 (nop!))
|
||||
(goto L49)
|
||||
|
||||
|
||||
(label L44)
|
||||
(set! f1 (the-as float #x33000000))
|
||||
;;(b! (>=.s f0 f1) L45 (nop!))
|
||||
(when-goto (>= f0 f1) L45)
|
||||
|
||||
(set! f0 (the-as float #x3f800000))
|
||||
(set! f1 arg)
|
||||
(set! f0 (+ f0 f1))
|
||||
(set! v0 f0)
|
||||
;;(b! #t L49 (nop!))
|
||||
(goto L49)
|
||||
|
||||
(label L45)
|
||||
(set! f16 (the-as float #x4238aa3b))
|
||||
(set! f12 (the-as float #x3cb17200))
|
||||
(set! f13 (the-as float #x333fbe8e))
|
||||
(set! f14 (the-as float #x3f000044))
|
||||
(set! f15 (the-as float #x3e2aaaec))
|
||||
(set! f0 arg)
|
||||
(set! f0 (* f0 f16))
|
||||
;;(set! f0 (f2i f0))
|
||||
;;(set! a2 (fpr->gpr f0))
|
||||
(set! a2 (the int f0))
|
||||
(set! v1 (logand a2 31))
|
||||
(set! a1 (- a2 v1))
|
||||
(set! a3 512)
|
||||
(set! t0 a2)
|
||||
;;(bl! (<0.si t0) L46 (no-delay!))
|
||||
;;(set! t0 (- t0))
|
||||
(set! t0 (abs t0))
|
||||
|
||||
;;(label L46)
|
||||
;;(b! (>=.si a3 t0) L47 (nop!))
|
||||
(when-goto (>= a3 t0) L47)
|
||||
;;(set! f17 a1)
|
||||
;;(set! f18 v1)
|
||||
;;(set! f17 (i2f f17))
|
||||
;;(set! f18 (i2f f18))
|
||||
(set! f17 (the float a1))
|
||||
(set! f18 (the float v1))
|
||||
(set! f17 (* f17 f12))
|
||||
(set! f18 (* f18 f12))
|
||||
(set! f0 arg)
|
||||
(set! f17 (- f0 f17))
|
||||
;;(b! #t L48 (set! f2 (-.s f17 f18)))
|
||||
(set! f2 (- f17 f18))
|
||||
(goto L48)
|
||||
|
||||
(label L47)
|
||||
;;(set! f17 (gpr->fpr a2))
|
||||
;;(set! f17 (i2f f17))
|
||||
(set! f17 (the float a2))
|
||||
(set! f17 (* f17 f12))
|
||||
(set! f0 arg)
|
||||
(set! f2 (- f0 f17))
|
||||
|
||||
(label L48)
|
||||
(set! a0-2 (- a2))
|
||||
;;(set! f17 (gpr->fpr a0))
|
||||
;;(set! f17 (i2f f17))
|
||||
(set! f17 (the float a0-2))
|
||||
(set! f3 (* f17 f13))
|
||||
(set! a0-2 (sar a1 5))
|
||||
(set! f4 (+ f2 f3))
|
||||
(set! f6 (* f4 f15))
|
||||
(set! f6 (+ f14 f6))
|
||||
(set! f6 (* f4 f6))
|
||||
(set! f6 (* f4 f6))
|
||||
(set! f5 (+ f3 f6))
|
||||
(set! f5 (+ f2 f5))
|
||||
;;(set! a1 exp-slead)
|
||||
;;(set! a2 (sll v1 2))
|
||||
;;(set! a1 (+ a1 a2))
|
||||
;;(set! f10 (l.f a1))
|
||||
(set! f10 (-> exp-slead v1))
|
||||
;;(set! a1 exp-strail)
|
||||
;;(set! v1 (sll v1 2))
|
||||
;;(set! v1 (+ a1 v1))
|
||||
;;(set! f11 (l.f v1))
|
||||
(set! f11 (-> exp-strail v1))
|
||||
(set! f7 (+ f10 f11))
|
||||
(set! f8 (* f7 f5))
|
||||
(set! f8 (+ f11 f8))
|
||||
(set! f8 (+ f8 f10))
|
||||
(set! v1 (the-as int f8))
|
||||
(set! a0-2 (logand a0-2 511))
|
||||
(set! a0-2 (shl a0-2 23))
|
||||
(set! v0 (the-as float (+ v1 a0-2)))
|
||||
(label L49)
|
||||
v0
|
||||
)
|
||||
|
||||
(defun pow ((arg0 float) (arg1 float))
|
||||
(exp (* arg1 (logf arg0)))
|
||||
)
|
||||
|
||||
(defun print-exp ((arg0 float))
|
||||
(let* ((f30-1 (floor (/ (logf (fabs arg0)) (logf 10.0))))
|
||||
(f0-4 (pow 10.0 f30-1))
|
||||
)
|
||||
(format #t "~fe~d" (/ arg0 f0-4) (the int f30-1))
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(deftype rgba (uint32)
|
||||
((r uint8 :offset 0 :size 8)
|
||||
(g uint8 :offset 8 :size 8)
|
||||
(b uint8 :offset 16 :size 8)
|
||||
(a uint8 :offset 24 :size 8)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(deftype xyzw (uint128)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype xyzwh (uint128)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(defun print-time ((arg0 object) (arg1 time-frame))
|
||||
0
|
||||
0
|
||||
0
|
||||
(let* ((f0-1 (* 0.0033333334 (the float arg1)))
|
||||
(a2-0 (the int (* 0.016666668 f0-1)))
|
||||
(f0-2 (- f0-1 (* 60.0 (the float a2-0))))
|
||||
(a3-0 (the int f0-2))
|
||||
(f0-3 (- f0-2 (the float a3-0)))
|
||||
(t0-0 (the int (* 1000.0 f0-3)))
|
||||
)
|
||||
(format arg0 "~d:~2,'0,d:~3,'0,d" a2-0 a3-0 t0-0)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun log2 ((arg0 int))
|
||||
(+ (sar (the-as int (the float arg0)) 23) -127)
|
||||
)
|
||||
|
||||
(defun seek ((arg0 float) (arg1 float) (arg2 float))
|
||||
(let ((f2-0 (- arg1 arg0)))
|
||||
(cond
|
||||
((>= arg2 (fabs f2-0))
|
||||
arg1
|
||||
)
|
||||
((>= f2-0 0.0)
|
||||
(+ arg0 arg2)
|
||||
)
|
||||
(else
|
||||
(- arg0 arg2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun seek-ease ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
|
||||
(let ((f2-0 (- arg1 arg0)))
|
||||
(when (>= arg3 (fabs f2-0))
|
||||
(set! arg2 (* arg2 (- 1.0 (/ (- arg3 (fabs f2-0)) arg3))))
|
||||
(if (< arg2 arg4)
|
||||
(set! arg2 arg4)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((>= arg2 (fabs f2-0))
|
||||
arg1
|
||||
)
|
||||
((>= f2-0 0.0)
|
||||
(+ arg0 arg2)
|
||||
)
|
||||
(else
|
||||
(- arg0 arg2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun seek-ease-in-out ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float) (arg5 float) (arg6 float))
|
||||
(let ((f2-0 (- arg2 arg0)))
|
||||
(let ((f4-1 (- arg0 arg1)))
|
||||
(when (>= arg4 (fabs f4-1))
|
||||
(set! arg3 (* arg3 (- 1.0 (/ (- arg4 (fabs f4-1)) arg4))))
|
||||
(if (< arg3 arg6)
|
||||
(set! arg3 arg6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (>= arg5 (fabs f2-0))
|
||||
(set! arg3 (* arg3 (- 1.0 (/ (- arg5 (fabs f2-0)) arg5))))
|
||||
(if (< arg3 arg6)
|
||||
(set! arg3 arg6)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((>= arg3 (fabs f2-0))
|
||||
arg2
|
||||
)
|
||||
((>= f2-0 0.0)
|
||||
(+ arg0 arg3)
|
||||
)
|
||||
(else
|
||||
(- arg0 arg3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun lerp ((arg0 float) (arg1 float) (arg2 float))
|
||||
(+ arg0 (* arg2 (- arg1 arg0)))
|
||||
)
|
||||
|
||||
(defun-debug lerp-scale-old ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
|
||||
(let ((f0-1 (fmax 0.0 (fmin 1.0 (/ (- arg2 arg3) (- arg4 arg3))))))
|
||||
(+ (* (- 1.0 f0-1) arg0) (* f0-1 arg1))
|
||||
)
|
||||
)
|
||||
|
||||
(defun lerp-scale ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
|
||||
;;(local-vars (f0-2 float))
|
||||
(let* (;; (v1-0 #x3f800000)
|
||||
(f1-0 0.0)
|
||||
(f0-0 1.0)
|
||||
(f4-0 arg2)
|
||||
(f2-0 arg3)
|
||||
(f3-0 arg4)
|
||||
(f1-2 (fmin (fmax (/ (- f4-0 f2-0) (- f3-0 f2-0)) f1-0) f0-0))
|
||||
(f0-1 (- f0-0 f1-2))
|
||||
(f2-3 arg0)
|
||||
(f3-1 arg1)
|
||||
)
|
||||
(+ (* f0-1 f2-3) (* f1-2 f3-1))
|
||||
;;(.mula.s f0-1 f2-3)
|
||||
;;(.madd.s f0-2 f1-2 f3-1)
|
||||
)
|
||||
;; f0-2
|
||||
)
|
||||
|
||||
(defun lerp-clamp ((arg0 float) (arg1 float) (arg2 float))
|
||||
(cond
|
||||
((>= 0.0 arg2)
|
||||
arg0
|
||||
)
|
||||
((>= arg2 1.0)
|
||||
arg1
|
||||
)
|
||||
(else
|
||||
(+ (* (- 1.0 arg2) arg0) (* arg2 arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun seekl ((arg0 int) (arg1 int) (arg2 int))
|
||||
(let* ((v1-0 (- arg1 arg0))
|
||||
(a3-0 (abs v1-0)))
|
||||
(cond
|
||||
((>= arg2 a3-0)
|
||||
arg1
|
||||
)
|
||||
((>= v1-0 0)
|
||||
(+ arg0 arg2)
|
||||
)
|
||||
(else
|
||||
(- arg0 arg2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; random vu hardware
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; in the PS2 there is a R register for generating random numbers
|
||||
;; it is a "32-bit" register, but the upper bits are fixed so it always
|
||||
;; represents a float in (1, 2).
|
||||
;; we don't have this register on x86, so we add a special global: *_vu-reg-R_*
|
||||
(define *_vu-reg-R_* 0)
|
||||
|
||||
(defun rand-vu-init ((seed float))
|
||||
"Initialize the VU0 random generator"
|
||||
;; (.ctc2.i R arg0)
|
||||
;; (.cfc2.i v0 R)
|
||||
(set! *_vu-reg-R_*
|
||||
(logior #x3F800000 (logand (the-as int seed) #x007FFFFF))
|
||||
)
|
||||
(the-as float *_vu-reg-R_*)
|
||||
)
|
||||
|
||||
;; this is _almost_ sqrt(2) = 1.414
|
||||
(rand-vu-init 1.418091058731079)
|
||||
|
||||
;; rand-vu
|
||||
(defun rand-vu ()
|
||||
"Get a random number in [0, 1) and advance the random generator."
|
||||
;; (.vrget.xyzw vf1) - get current random
|
||||
(let ((current-random *_vu-reg-R_*))
|
||||
;; here they update the random generate with some junk
|
||||
;; for now, we don't do this in OpenGOAL.
|
||||
;; (.vsqrty Q vf1)
|
||||
;; (.vaddq.x vf2 vf0 Q) ;; you're not allowed to do this!
|
||||
;; (.vrxorw vf2)
|
||||
|
||||
;; and advance
|
||||
;; (.vrnext.xyzw vf1)
|
||||
(let ((x (logand 1 (shr current-random 4)))
|
||||
(y (logand 1 (shr current-random 22)))
|
||||
)
|
||||
(set! current-random (shl current-random 1))
|
||||
(set! current-random (logxor current-random (logxor x y)))
|
||||
(set! *_vu-reg-R_* (logior #x3f800000 (logand current-random #x7fffff)))
|
||||
)
|
||||
)
|
||||
|
||||
;; (.vsubw.xyzw vf1 vf1 vf0)
|
||||
;; (.qmfc2.i v0 vf1)
|
||||
(- (the-as float *_vu-reg-R_*) 1.0)
|
||||
)
|
||||
|
||||
;; rand-vu-nostep
|
||||
(defun rand-vu-nostep ()
|
||||
"Get the number currently in the random generator.
|
||||
This will be equal to the last call of (rand-vu)
|
||||
This will not update the random generator"
|
||||
(- (the-as float *_vu-reg-R_*) 1.0)
|
||||
)
|
||||
|
||||
(defun rand-vu-float-range ((arg0 float) (arg1 float))
|
||||
(+ arg0 (* (rand-vu) (- arg1 arg0)))
|
||||
)
|
||||
|
||||
(defun rand-vu-percent? ((arg0 float))
|
||||
(>= arg0 (rand-vu))
|
||||
)
|
||||
|
||||
(defun rand-vu-int-range ((arg0 int) (arg1 int))
|
||||
(if (< arg0 arg1)
|
||||
(set! arg1 (+ arg1 1))
|
||||
(set! arg0 (+ arg0 1))
|
||||
)
|
||||
(let ((f0-4 (rand-vu-float-range (the float arg0) (the float arg1))))
|
||||
(if (< f0-4 0.0)
|
||||
(set! f0-4 (+ -1.0 f0-4))
|
||||
)
|
||||
(the int f0-4)
|
||||
)
|
||||
)
|
||||
|
||||
(defun rand-vu-int-count ((arg0 int))
|
||||
(the int (* (rand-vu) (the float arg0)))
|
||||
)
|
||||
|
||||
(defun rand-vu-int-count-excluding ((arg0 int) (arg1 int))
|
||||
(let ((s4-0 0)
|
||||
(s5-0 0)
|
||||
)
|
||||
(let ((v1-0 1))
|
||||
(while (nonzero? arg0)
|
||||
(+! arg0 -1)
|
||||
(if (zero? (logand arg1 v1-0))
|
||||
(+! s4-0 1)
|
||||
)
|
||||
(set! v1-0 (* v1-0 2))
|
||||
)
|
||||
)
|
||||
(when (> s4-0 0)
|
||||
(let ((v1-4 (the int (* (rand-vu) (the float s4-0))))
|
||||
(a0-1 1)
|
||||
)
|
||||
(until #f
|
||||
(while (logtest? arg1 a0-1)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(+! s5-0 1)
|
||||
(set! a0-1 (* a0-1 2))
|
||||
)
|
||||
(if (zero? v1-4)
|
||||
(goto cfg-14)
|
||||
)
|
||||
(+! v1-4 -1)
|
||||
(+! s5-0 1)
|
||||
(set! a0-1 (* a0-1 2))
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
(label cfg-14)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
|
||||
(defun rand-vu-int-range-exclude ((arg0 int) (arg1 int) (arg2 int))
|
||||
(until #f
|
||||
(let ((v1-0 (rand-vu-int-range arg0 arg1)))
|
||||
(if (!= v1-0 arg2)
|
||||
(return v1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as int #f)
|
||||
)
|
||||
|
||||
(deftype random-generator (basic)
|
||||
((seed uint32 :offset-assert 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
(define *random-generator* (new 'global 'random-generator))
|
||||
|
||||
(set! (-> *random-generator* seed) (the-as uint #x666edd1e))
|
||||
|
||||
(defmacro sext32-64 (x)
|
||||
"Sign extend a 32-bit value to 64-bits"
|
||||
`(sar (shl ,x 32) 32)
|
||||
)
|
||||
|
||||
(defun rand-uint31-gen ((gen random-generator))
|
||||
"Generate a supposedly random integer.
|
||||
Note, this might not quite be right.
|
||||
But the highest bit is always zero, like it says
|
||||
and it looks kinda random to me."
|
||||
(let* ((sd (-> gen seed))
|
||||
;; addiu v1, r0, 16807
|
||||
;; mult3 v0, v1, a1
|
||||
(prod (imul64 16807 sd))
|
||||
;; mfhi v1
|
||||
(hi (shr prod 32)) ;; sign extend this?
|
||||
(lo (sar (shl prod 32) 32))
|
||||
;; daddu v1, v1, v1
|
||||
(v1 (+ hi hi))
|
||||
;; srl a1, v0, 31
|
||||
(a1 (logand #xffffffff (shr lo 31)))
|
||||
;; or v1, v1, a1
|
||||
;; daddu v0, v0 v1
|
||||
(result (+ lo (logior v1 a1)))
|
||||
)
|
||||
(set! result (shr (logand #xffffffff (shl result 1)) 1))
|
||||
(set! (-> gen seed) result)
|
||||
(the uint result)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro rand-float-gen (&key (gen *random-generator*))
|
||||
"Generate a float from [0, 1)"
|
||||
`(+ -1.0 (the-as float (logior #x3f800000 (/ (rand-uint31-gen ,gen) 256))))
|
||||
)
|
||||
|
||||
(defun cube-root ((arg0 float))
|
||||
(the-as
|
||||
float
|
||||
(cond
|
||||
((!= arg0 (the-as float 0.0))
|
||||
(let* ((v1-0 arg0)
|
||||
(a1-2 (+ (logand (shr (the-as int v1-0) 23) 255) -127))
|
||||
(f0-1
|
||||
(the-as
|
||||
float
|
||||
(logior (logand (the-as uint #x807fffff) (the-as uint v1-0)) (shl (+ (/ (the-as int a1-2) 3) 127) 23))
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (v1-3 6)
|
||||
(set! f0-1
|
||||
(- f0-1 (/ (- (* (* f0-1 f0-1) f0-1) arg0)
|
||||
(* (* 3.0 f0-1) f0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
f0-1
|
||||
)
|
||||
)
|
||||
(else
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun int-noise ((arg0 int))
|
||||
(let ((v1-1 (logxor (shl arg0 13) arg0)))
|
||||
(- 1.0 (* 0.0000000009313226
|
||||
(the float (logand #x7fffffff (+ #x5208dd0d (* v1-1 (+ #xc0ae5 (* (* #x3d73 v1-1) v1-1))))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun smooth-step ((arg0 float))
|
||||
(the-as float (cond
|
||||
((>= 0.0 arg0)
|
||||
0
|
||||
)
|
||||
((>= arg0 1.0)
|
||||
#x3f800000
|
||||
)
|
||||
(else
|
||||
(* arg0 arg0 (+ 3.0 (* -2.0 arg0)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun smooth-interp ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
|
||||
(+ arg0 (* (- arg1 arg0) (smooth-step (/ (- arg2 arg3) (- arg4 arg3)))))
|
||||
)
|
||||
@@ -5,3 +5,50 @@
|
||||
;; name in dgo: matrix-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype matrix (structure)
|
||||
((data float 16 :offset-assert 0)
|
||||
(vector vector 4 :offset 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
(trans vector :inline :offset 48)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x40
|
||||
:flag-assert #xa00000040
|
||||
(:methods
|
||||
(transform-vectors! (_type_ (inline-array vector) (inline-array vector) int) none 9)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype matrix3 (structure)
|
||||
((data float 12 :offset-assert 0)
|
||||
(vector vector 3 :offset 0)
|
||||
(quad uint128 3 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
(deftype matrix4h (structure)
|
||||
((data int16 16 :offset-assert 0)
|
||||
(vector4h vector4h 4 :offset 0)
|
||||
(long int64 4 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
(defun matrix-copy! ((arg0 matrix) (arg1 matrix))
|
||||
(let ((v1-0 (-> arg1 quad 0))
|
||||
(a2-0 (-> arg1 quad 1))
|
||||
(a3-0 (-> arg1 quad 2))
|
||||
(a1-1 (-> arg1 trans quad))
|
||||
)
|
||||
(set! (-> arg0 quad 0) v1-0)
|
||||
(set! (-> arg0 quad 1) a2-0)
|
||||
(set! (-> arg0 quad 2) a3-0)
|
||||
(set! (-> arg0 trans quad) a1-1)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,3 +5,22 @@
|
||||
;; name in dgo: quaternion-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype quaternion (structure)
|
||||
((data float 4 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
(w float :offset 12)
|
||||
(vec vector :inline :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(define *unity-quaternion* (new 'static 'quaternion :data (new 'static 'array float 4 0.0 0.0 0.0 1.0)))
|
||||
|
||||
(define-extern quaternion->matrix (function matrix quaternion matrix))
|
||||
(define-extern matrix->quaternion (function quaternion matrix quaternion))
|
||||
(define-extern vector-y-angle (function vector float))
|
||||
|
||||
@@ -5,3 +5,22 @@
|
||||
;; name in dgo: transform-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype transform (structure)
|
||||
((trans vector :inline :offset-assert 0)
|
||||
(rot vector :inline :offset-assert 16)
|
||||
(scale vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
(deftype trs (basic)
|
||||
((trans vector :inline :offset-assert 16)
|
||||
(rot vector :inline :offset-assert 32)
|
||||
(scale vector :inline :offset-assert 48)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
@@ -5,3 +5,79 @@
|
||||
;; name in dgo: transform
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(defmethod print transform ((obj transform))
|
||||
(format #t "#<transform @ #x~X~%" obj)
|
||||
(format #t "~T~Ttrans:~F ~F ~F ~F ~%" (-> obj trans x) (-> obj trans y) (-> obj trans z) (-> obj trans w))
|
||||
(format #t "~T~Trot: ~F ~F ~F ~F ~%" (-> obj rot x) (-> obj rot y) (-> obj rot z) (-> obj rot w))
|
||||
(format #t "~T~Tscale:~F ~F ~F ~F>" (-> obj scale x) (-> obj scale y) (-> obj scale z) (-> obj scale w))
|
||||
obj
|
||||
)
|
||||
|
||||
(defmethod new trs ((allocation symbol) (type-to-make type))
|
||||
(let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(set! (-> gp-0 trans w) 1.0)
|
||||
(set! (-> gp-0 rot w) 1.0)
|
||||
(vector-identity! (-> gp-0 scale))
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
|
||||
(defun transform-matrix-calc! ((arg0 transform) (arg1 matrix))
|
||||
(let ((s4-0 (new 'stack-no-clear 'matrix)))
|
||||
(set! (-> s4-0 quad 0) (the-as uint128 0))
|
||||
(set! (-> s4-0 quad 1) (the-as uint128 0))
|
||||
(set! (-> s4-0 quad 2) (the-as uint128 0))
|
||||
(set! (-> s4-0 trans quad) (the-as uint128 0))
|
||||
(let ((s3-0 (new 'stack-no-clear 'matrix)))
|
||||
(set! (-> s3-0 quad 0) (the-as uint128 0))
|
||||
(set! (-> s3-0 quad 1) (the-as uint128 0))
|
||||
(set! (-> s3-0 quad 2) (the-as uint128 0))
|
||||
(set! (-> s3-0 trans quad) (the-as uint128 0))
|
||||
(matrix-identity! arg1)
|
||||
(matrix-translate! arg1 (-> arg0 trans))
|
||||
(matrix-rotate-y! s4-0 (-> arg0 rot y))
|
||||
(matrix*! s3-0 s4-0 arg1)
|
||||
(matrix-rotate-x! s4-0 (-> arg0 rot x))
|
||||
(matrix*! arg1 s4-0 s3-0)
|
||||
(matrix-rotate-z! s4-0 (-> arg0 rot z))
|
||||
(matrix*! s3-0 s4-0 arg1)
|
||||
(matrix-scale! s4-0 (-> arg0 scale))
|
||||
(matrix*! arg1 s4-0 s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun transform-matrix-parent-calc! ((arg0 transform) (arg1 matrix) (arg2 vector))
|
||||
(let ((s4-0 (new 'stack-no-clear 'matrix)))
|
||||
(set! (-> s4-0 quad 0) (the-as uint128 0))
|
||||
(set! (-> s4-0 quad 1) (the-as uint128 0))
|
||||
(set! (-> s4-0 quad 2) (the-as uint128 0))
|
||||
(set! (-> s4-0 trans quad) (the-as uint128 0))
|
||||
(let ((s3-0 (new 'stack-no-clear 'matrix)))
|
||||
(set! (-> s3-0 quad 0) (the-as uint128 0))
|
||||
(set! (-> s3-0 quad 1) (the-as uint128 0))
|
||||
(set! (-> s3-0 quad 2) (the-as uint128 0))
|
||||
(set! (-> s3-0 trans quad) (the-as uint128 0))
|
||||
(matrix-identity! s3-0)
|
||||
(matrix-translate! s3-0 (-> arg0 trans))
|
||||
(matrix-inv-scale! s4-0 arg2)
|
||||
(matrix*! arg1 s4-0 s3-0)
|
||||
(matrix-rotate-y! s4-0 (-> arg0 rot y))
|
||||
(matrix*! s3-0 s4-0 arg1)
|
||||
(matrix-rotate-x! s4-0 (-> arg0 rot x))
|
||||
(matrix*! arg1 s4-0 s3-0)
|
||||
(matrix-rotate-z! s4-0 (-> arg0 rot z))
|
||||
(matrix*! s3-0 s4-0 arg1)
|
||||
(matrix-scale! s4-0 (-> arg0 scale))
|
||||
(matrix*! arg1 s4-0 s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun trs-matrix-calc! ((arg0 trs) (arg1 matrix))
|
||||
(transform-matrix-calc! (the-as transform (-> arg0 trans)) arg1)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,3 +5,62 @@
|
||||
;; name in dgo: transformq-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype transformq (transform)
|
||||
((quat quaternion :inline :offset 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
(deftype trsq (trs)
|
||||
((quat quaternion :inline :offset 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
(deftype trsqv (trsq)
|
||||
((pause-adjust-distance meters :offset 4)
|
||||
(nav-radius meters :offset 8)
|
||||
(transv vector :inline :offset-assert 64)
|
||||
(rotv vector :inline :offset-assert 80)
|
||||
(scalev vector :inline :offset-assert 96)
|
||||
(dir-targ quaternion :inline :offset-assert 112)
|
||||
(angle-change-time uint64 :offset-assert 128)
|
||||
(old-y-angle-diff float :offset-assert 136)
|
||||
)
|
||||
:method-count-assert 28
|
||||
:size-assert #x8c
|
||||
:flag-assert #x1c0000008c
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-13 () none 13)
|
||||
(dummy-14 () none 14)
|
||||
(dummy-15 () none 15)
|
||||
(dummy-16 () none 16)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(dummy-20 () none 20)
|
||||
(dummy-21 () none 21)
|
||||
(y-angle (_type_) float 22)
|
||||
(global-y-angle-to-point (_type_ vector) float 23)
|
||||
(relative-y-angle-to-point (_type_ vector) float 24)
|
||||
(dummy-25 () none 25)
|
||||
(dummy-26 () none 26)
|
||||
(dummy-27 () none 27)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod global-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
|
||||
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))
|
||||
)
|
||||
|
||||
(defmethod relative-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
|
||||
(deg-diff (y-angle obj) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans))))
|
||||
)
|
||||
@@ -5,3 +5,8 @@
|
||||
;; name in dgo: trigonometry-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(define-extern deg-diff (function float float float))
|
||||
(define-extern sin (function float float))
|
||||
(define-extern vector-sincos! (function vector vector vector int))
|
||||
(define-extern cos (function float float))
|
||||
(define-extern atan (function float float float))
|
||||
|
||||
@@ -5,3 +5,647 @@
|
||||
;; name in dgo: vector-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(define-extern vector-cross! (function vector vector vector vector))
|
||||
(define-extern vector-float*! (function vector vector float vector))
|
||||
(define-extern vector-identity! (function vector vector))
|
||||
(define-extern vector-length (function vector float))
|
||||
(define-extern vector-length-squared (function vector float))
|
||||
(define-extern vector-normalize! (function vector float vector))
|
||||
(define-extern vector-normalize-copy! (function vector vector float vector))
|
||||
|
||||
|
||||
(defmacro init-vf0-vector ()
|
||||
"Initializes the VF0 vector which is a constant vector in the VU set to <0,0,0,1>"
|
||||
`(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
|
||||
)
|
||||
|
||||
(deftype bit-array (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(allocated-length int32 :offset-assert 8)
|
||||
(_pad uint8 :offset-assert 12)
|
||||
(bytes uint8 :dynamic :offset 12)
|
||||
)
|
||||
:method-count-assert 13
|
||||
:size-assert #xd
|
||||
:flag-assert #xd0000000d
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(get-bit (_type_ int) symbol 9)
|
||||
(clear-bit (_type_ int) int 10)
|
||||
(set-bit (_type_ int) int 11)
|
||||
(clear-all! (_type_) _type_ 12)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod new bit-array ((allocation symbol) (type-to-make type) (arg0 int))
|
||||
(let ((v0-0 (object-new allocation type-to-make (+ (/ (logand -8 (+ arg0 7)) 8) -1 (-> type-to-make size)))))
|
||||
(set! (-> v0-0 length) arg0)
|
||||
(set! (-> v0-0 allocated-length) arg0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod length bit-array ((obj bit-array))
|
||||
(-> obj length)
|
||||
)
|
||||
|
||||
(defmethod asize-of bit-array ((obj bit-array))
|
||||
(the-as int (+ (-> obj type size) (/ (logand -8 (+ (-> obj allocated-length) 7)) 8)))
|
||||
)
|
||||
|
||||
(defmethod get-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(let ((v1-2 (-> obj bytes (/ arg0 8))))
|
||||
(logtest? v1-2 (ash 1 (logand arg0 7)))
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod clear-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(logclear! (-> obj bytes (/ arg0 8)) (ash 1 (logand arg0 7)))
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod set-bit bit-array ((obj bit-array) (arg0 int))
|
||||
(logior! (-> obj bytes (/ arg0 8)) (ash 1 (logand arg0 7)))
|
||||
0
|
||||
)
|
||||
|
||||
(defmethod clear-all! bit-array ((obj bit-array))
|
||||
(countdown (v1-2 (/ (logand -8 (+ (-> obj allocated-length) 7)) 8))
|
||||
(nop!)
|
||||
(nop!)
|
||||
(set! (-> obj bytes v1-2) (the-as uint 0))
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
(deftype vector16ub (structure)
|
||||
((data uint8 16 :offset-assert 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype vector4ub (structure)
|
||||
((data uint8 4 :offset-assert 0)
|
||||
(x uint8 :offset 0)
|
||||
(y uint8 :offset 1)
|
||||
(z uint8 :offset 2)
|
||||
(w uint8 :offset 3)
|
||||
(clr uint32 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(deftype vector4b (structure)
|
||||
((data int8 4 :offset-assert 0)
|
||||
(x int8 :offset 0)
|
||||
(y int8 :offset 1)
|
||||
(z int8 :offset 2)
|
||||
(w int8 :offset 3)
|
||||
(clr int32 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(deftype vector2ub (structure)
|
||||
((data uint8 2 :offset-assert 0)
|
||||
(x uint8 :offset 0)
|
||||
(y uint8 :offset 1)
|
||||
(clr uint16 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2
|
||||
:flag-assert #x900000002
|
||||
)
|
||||
|
||||
(deftype vector2b (structure)
|
||||
((data int8 2 :offset-assert 0)
|
||||
(x int8 :offset 0)
|
||||
(y int8 :offset 1)
|
||||
(clr int16 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x2
|
||||
:flag-assert #x900000002
|
||||
)
|
||||
|
||||
(deftype vector2h (structure)
|
||||
((data int16 2 :offset-assert 0)
|
||||
(x int16 :offset 0)
|
||||
(y int16 :offset 2)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(deftype vector2uh (structure)
|
||||
((data uint16 2 :offset-assert 0)
|
||||
(x uint16 :offset 0)
|
||||
(y uint16 :offset 2)
|
||||
(val uint32 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
(deftype vector3h (structure)
|
||||
((data int16 3 :offset-assert 0)
|
||||
(x int16 :offset 0)
|
||||
(y int16 :offset 2)
|
||||
(z int16 :offset 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x6
|
||||
:flag-assert #x900000006
|
||||
)
|
||||
|
||||
(deftype vector3uh (structure)
|
||||
((data uint16 3 :offset-assert 0)
|
||||
(x uint16 :offset 0)
|
||||
(y uint16 :offset 2)
|
||||
(z uint16 :offset 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x6
|
||||
:flag-assert #x900000006
|
||||
)
|
||||
|
||||
(deftype vector2w (structure)
|
||||
((data int32 2 :offset-assert 0)
|
||||
(x int32 :offset 0)
|
||||
(y int32 :offset 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
(deftype vector3w (structure)
|
||||
((data int32 3 :offset-assert 0)
|
||||
(x int32 :offset 0)
|
||||
(y int32 :offset 4)
|
||||
(z int32 :offset 8)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xc
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
(deftype vector4w (structure)
|
||||
((data uint32 4 :offset-assert 0)
|
||||
(x int32 :offset 0)
|
||||
(y int32 :offset 4)
|
||||
(z int32 :offset 8)
|
||||
(w int32 :offset 12)
|
||||
(dword uint64 2 :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype vector2 (structure)
|
||||
((data float 2 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
(deftype vector3 (structure)
|
||||
((data float 3 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xc
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
(deftype vector4 (structure)
|
||||
((data float 4 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
(w float :offset 12)
|
||||
(dword uint64 2 :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(defmethod print vector4w ((obj vector4w))
|
||||
(format #t "#<vector4w ~D ~D ~D ~D @ #x~X>" (-> obj x) (-> obj y) (-> obj z) (-> obj w) obj)
|
||||
obj
|
||||
)
|
||||
|
||||
(deftype vector4w-2 (structure)
|
||||
((data int32 8 :offset-assert 0)
|
||||
(quad uint128 2 :offset 0)
|
||||
(vector vector4w 2 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
(deftype vector4w-3 (structure)
|
||||
((data int32 12 :offset-assert 0)
|
||||
(quad uint128 3 :offset 0)
|
||||
(vector vector4w 3 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
(deftype vector4w-4 (structure)
|
||||
((data int32 16 :offset-assert 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
(vector vector4w 4 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
|
||||
(deftype vector4h (structure)
|
||||
((data int16 4 :offset-assert 0)
|
||||
(x int16 :offset 0)
|
||||
(y int16 :offset 2)
|
||||
(z int16 :offset 4)
|
||||
(w int16 :offset 6)
|
||||
(long uint64 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
(deftype vector8h (structure)
|
||||
((data int16 8 :offset-assert 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype vector16b (structure)
|
||||
((data int8 16 :offset-assert 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(defmethod inspect vector ((obj vector))
|
||||
(format #t "[~8x] vector~%" obj)
|
||||
(format #t "~T[~F] [~F] [~F] [~F]~%" (-> obj x) (-> obj y) (-> obj z) (-> obj w))
|
||||
obj
|
||||
)
|
||||
|
||||
(defmethod print vector ((obj vector))
|
||||
(format #t "#<vector ~F ~F ~F ~F @ #x~X>" (-> obj x) (-> obj y) (-> obj z) (-> obj w) obj)
|
||||
obj
|
||||
)
|
||||
|
||||
(define *null-vector* (new 'static 'vector :w 1.0))
|
||||
(define *identity-vector* (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0))
|
||||
(define *x-vector* (new 'static 'vector :x 1.0 :w 1.0))
|
||||
(define *y-vector* (new 'static 'vector :y 1.0 :w 1.0))
|
||||
(define *z-vector* (new 'static 'vector :z 1.0 :w 1.0))
|
||||
(define *up-vector* (new 'static 'vector :y 1.0 :w 1.0))
|
||||
|
||||
(deftype vector4s-3 (structure)
|
||||
((data float 12 :offset-assert 0)
|
||||
(quad uint128 3 :offset 0)
|
||||
(vector vector 3 :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x30
|
||||
:flag-assert #x900000030
|
||||
)
|
||||
|
||||
(deftype vector-array (inline-array-class)
|
||||
((data vector :inline :dynamic :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
(set! (-> vector-array heap-base) (the-as uint 16))
|
||||
|
||||
(deftype rgbaf (vector)
|
||||
((r float :offset 0)
|
||||
(g float :offset 4)
|
||||
(b float :offset 8)
|
||||
(a float :offset 12)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype plane (vector)
|
||||
((a float :offset 0)
|
||||
(b float :offset 4)
|
||||
(c float :offset 8)
|
||||
(d float :offset 12)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype sphere (vector)
|
||||
((r float :offset 12)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype isphere (vec4s)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype box8s (structure)
|
||||
((data float 8 :offset-assert 0)
|
||||
(quad uint128 2 :offset 0)
|
||||
(vector vector 2 :offset 0)
|
||||
(min vector :inline :offset 0)
|
||||
(max vector :inline :offset 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
(deftype box8s-array (inline-array-class)
|
||||
((data box8s :inline :dynamic :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
(set! (-> box8s-array heap-base) (the-as uint 32))
|
||||
|
||||
(deftype cylinder (structure)
|
||||
((origin vector :inline :offset-assert 0)
|
||||
(axis vector :inline :offset-assert 16)
|
||||
(radius float :offset-assert 32)
|
||||
(length float :offset-assert 36)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x28
|
||||
:flag-assert #xb00000028
|
||||
(:methods
|
||||
(debug-draw (_type_ vector4w) none 9)
|
||||
(ray-capsule-intersect (_type_ vector vector) float 10)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype cylinder-flat (structure)
|
||||
((origin vector :inline :offset-assert 0)
|
||||
(axis vector :inline :offset-assert 16)
|
||||
(radius float :offset-assert 32)
|
||||
(length float :offset-assert 36)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x28
|
||||
:flag-assert #xb00000028
|
||||
(:methods
|
||||
(debug-draw (_type_ vector4w) none 9)
|
||||
(ray-flat-cyl-intersect (_type_ vector vector) float 10)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype vertical-planes (structure)
|
||||
((data uint128 4 :offset-assert 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
)
|
||||
|
||||
(deftype vertical-planes-array (basic)
|
||||
((length uint32 :offset-assert 4)
|
||||
(data vertical-planes :inline :dynamic :offset-assert 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype qword (structure)
|
||||
((data uint32 4 :offset-assert 0)
|
||||
(byte uint8 16 :offset 0)
|
||||
(hword uint16 8 :offset 0)
|
||||
(word uint32 4 :offset 0)
|
||||
(dword uint64 2 :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
(vector vector :inline :offset 0)
|
||||
(vector4w vector4w :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(deftype vector3s (structure)
|
||||
((data float 3 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xc
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
(defun vector-dot ((a vector) (b vector))
|
||||
"Take the dot product of two vectors.
|
||||
Only does the x, y, z compoments.
|
||||
Originally handwritten assembly to space out loads and use FPU accumulator"
|
||||
(declare (inline))
|
||||
(let ((result 0.))
|
||||
(+! result (* (-> a x) (-> b x)))
|
||||
(+! result (* (-> a y) (-> b y)))
|
||||
(+! result (* (-> a z) (-> b z)))
|
||||
result
|
||||
)
|
||||
)
|
||||
|
||||
(defun vector-dot-vu ((arg0 vector) (arg1 vector))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(.lvf vf1 (&-> arg0 quad))
|
||||
(.lvf vf2 (&-> arg1 quad))
|
||||
(.mul.vf vf1 vf1 vf2)
|
||||
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
||||
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
||||
(.mov v0-0 vf1)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
(defun vector4-dot ((a vector) (b vector))
|
||||
"Take the dot product of two vectors.
|
||||
Does the x, y, z, and w compoments"
|
||||
(declare (inline))
|
||||
(let ((result 0.))
|
||||
(+! result (* (-> a x) (-> b x)))
|
||||
(+! result (* (-> a y) (-> b y)))
|
||||
(+! result (* (-> a z) (-> b z)))
|
||||
(+! result (* (-> a w) (-> b w)))
|
||||
result
|
||||
)
|
||||
)
|
||||
|
||||
(defun vector4-dot-vu ((arg0 vector) (arg1 vector))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> arg0 quad))
|
||||
(.lvf vf2 (&-> arg1 quad))
|
||||
(.mul.vf vf1 vf1 vf2)
|
||||
(.add.w.vf vf3 vf0 vf0 :mask #b1)
|
||||
(.mul.x.vf acc vf3 vf1 :mask #b1)
|
||||
(.add.mul.y.vf acc vf3 vf1 acc :mask #b1)
|
||||
(.add.mul.z.vf acc vf3 vf1 acc :mask #b1)
|
||||
(.add.mul.w.vf vf1 vf3 vf1 acc :mask #b1)
|
||||
(.mov v0-0 vf1)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
(defun vector+! ((dst vector) (a vector) (b vector))
|
||||
"Set dst = a + b. The w component of dst is set to 0."
|
||||
(declare (inline))
|
||||
(rlet ((vf0 :class vf :reset-here #t)
|
||||
(vf1 :class vf :reset-here #t)
|
||||
(vf2 :class vf :reset-here #t)
|
||||
(vf3 :class vf :reset-here #t))
|
||||
;; load vectors
|
||||
(.lvf vf2 a)
|
||||
(.lvf vf3 b)
|
||||
(init-vf0-vector)
|
||||
;; add
|
||||
(.add.vf vf1 vf2 vf3)
|
||||
;; set w = 1
|
||||
(.blend.vf vf1 vf1 vf0 :mask #b1000)
|
||||
;; store
|
||||
(.svf dst vf1)
|
||||
)
|
||||
dst
|
||||
)
|
||||
|
||||
(defun vector-! ((dst vector) (a vector) (b vector))
|
||||
"Set dst = a - b. The w componenent of dst is set to 0."
|
||||
(declare (inline))
|
||||
(rlet ((vf0 :class vf :reset-here #t)
|
||||
(vf1 :class vf :reset-here #t)
|
||||
(vf2 :class vf :reset-here #t)
|
||||
(vf3 :class vf :reset-here #t))
|
||||
;; load vectors
|
||||
(.lvf vf2 a)
|
||||
(.lvf vf3 b)
|
||||
(init-vf0-vector)
|
||||
;; subtract
|
||||
(.sub.vf vf1 vf2 vf3)
|
||||
;; set w = 1
|
||||
(.blend.vf vf1 vf1 vf0 :mask #b1000)
|
||||
;; store
|
||||
(.svf dst vf1)
|
||||
)
|
||||
dst
|
||||
)
|
||||
|
||||
(defun vector-zero! ((dest vector))
|
||||
"Set xyzw to 0."
|
||||
(declare (inline))
|
||||
(rlet ((vf1 :class vf :reset-here #t))
|
||||
;; set vf1 = 0
|
||||
(.xor.vf vf1 vf1 vf1)
|
||||
;; store the 0
|
||||
(.svf dest vf1)
|
||||
)
|
||||
dest
|
||||
)
|
||||
|
||||
(defun vector-reset! ((dst vector))
|
||||
"Set vector to 0,0,0,1."
|
||||
(declare (inline))
|
||||
(vector-zero! dst)
|
||||
(set! (-> dst w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
(defun vector-copy! ((arg0 vector) (arg1 vector))
|
||||
(set! (-> arg0 quad) (-> arg1 quad))
|
||||
arg0
|
||||
)
|
||||
|
||||
(defun vector-length< ((arg0 vector) (arg1 float))
|
||||
(let ((f0-0 (vector-length-squared arg0))
|
||||
(f1-0 arg1)
|
||||
)
|
||||
(< f0-0 (* f1-0 f1-0))
|
||||
)
|
||||
)
|
||||
|
||||
(defun vector-length> ((arg0 vector) (arg1 float))
|
||||
(< (* arg1 arg1) (vector-length-squared arg0))
|
||||
)
|
||||
|
||||
(define *zero-vector* (new 'static 'vector))
|
||||
|
||||
|
||||
(defmacro new-stack-vector0 ()
|
||||
"Get a stack vector that's set to 0.
|
||||
This is more efficient than (new 'stack 'vector) because
|
||||
this doesn't call the constructor."
|
||||
`(let ((vec (new 'stack-no-clear 'vector)))
|
||||
(set! (-> vec quad) (the-as uint128 0))
|
||||
vec
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro set-vector! (v xv yv zv wv)
|
||||
"Set all fields in a vector"
|
||||
(with-gensyms (vec)
|
||||
`(let ((,vec ,v))
|
||||
(set! (-> ,vec x) ,xv)
|
||||
(set! (-> ,vec y) ,yv)
|
||||
(set! (-> ,vec z) ,zv)
|
||||
(set! (-> ,vec w) ,wv)
|
||||
,vec
|
||||
))
|
||||
)
|
||||
@@ -30,6 +30,14 @@
|
||||
;; Timer HW
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defenum timer-clock-selection
|
||||
:type uint8
|
||||
(busclk 0)
|
||||
(busclk/16 1)
|
||||
(busclk/256 2)
|
||||
(hblank 3)
|
||||
)
|
||||
|
||||
(deftype timer-mode (uint32)
|
||||
((clks timer-clock-selection :offset 0 :size 2)
|
||||
(gate uint8 :offset 2 :size 1)
|
||||
|
||||
@@ -5,3 +5,9 @@
|
||||
;; name in dgo: types-h
|
||||
;; dgos: ENGINE, GAME
|
||||
|
||||
(deftype part-id (uint32)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
@@ -161,6 +161,404 @@
|
||||
|
||||
(cgo "KERNEL.CGO" "kernel.gd")
|
||||
|
||||
;;;;;;;;;;;;;
|
||||
;; engine
|
||||
;;;;;;;;;;;;;
|
||||
|
||||
(goal-src-sequence
|
||||
"engine/"
|
||||
:deps
|
||||
("$OUT/obj/gcommon.o"
|
||||
"$OUT/obj/gstate.o"
|
||||
"$OUT/obj/gstring.o"
|
||||
"$OUT/obj/gkernel.o"
|
||||
)
|
||||
"util/types-h.gc"
|
||||
"ps2/vu1-macros.gc"
|
||||
"math/math.gc"
|
||||
"math/vector-h.gc"
|
||||
"physics/gravity-h.gc"
|
||||
"geometry/bounding-box-h.gc"
|
||||
"math/matrix-h.gc"
|
||||
"math/quaternion-h.gc"
|
||||
"math/euler-h.gc"
|
||||
"math/transform-h.gc"
|
||||
"geometry/geometry-h.gc"
|
||||
"math/trigonometry-h.gc"
|
||||
"math/transformq-h.gc"
|
||||
"geometry/bounding-box.gc"
|
||||
"math/matrix.gc"
|
||||
"math/transform.gc"
|
||||
"math/quaternion.gc"
|
||||
"math/euler.gc"
|
||||
"math/trigonometry.gc"
|
||||
"sound/gsound-h.gc"
|
||||
"ps2/timer-h.gc"
|
||||
"ps2/vif-h.gc"
|
||||
"dma/dma-h.gc"
|
||||
"gfx/hw/video-h.gc"
|
||||
"gfx/vu1-user-h.gc"
|
||||
"util/profile-h.gc"
|
||||
"dma/dma.gc"
|
||||
"dma/dma-buffer.gc"
|
||||
"dma/dma-bucket.gc"
|
||||
"dma/dma-disasm.gc"
|
||||
"ps2/pad.gc"
|
||||
"gfx/hw/gs.gc"
|
||||
"gfx/hw/display-h.gc"
|
||||
"geometry/geometry.gc"
|
||||
"ps2/timer.gc"
|
||||
"math/vector.gc"
|
||||
"load/file-io.gc"
|
||||
"load/loader-h.gc"
|
||||
"gfx/texture/texture-h.gc"
|
||||
"gfx/texture/texture-anim-h.gc"
|
||||
"gfx/lights-h.gc"
|
||||
"gfx/mood/mood-h.gc"
|
||||
"level/level-h.gc"
|
||||
"util/capture-h.gc"
|
||||
"gfx/math-camera-h.gc"
|
||||
"gfx/math-camera.gc"
|
||||
"gfx/font-h.gc"
|
||||
"load/decomp-h.gc"
|
||||
"util/profile.gc"
|
||||
"gfx/hw/display.gc"
|
||||
"engine/connect.gc"
|
||||
"ui/text-id-h.gc"
|
||||
"ui/text-h.gc"
|
||||
"camera/camera-defs-h.gc"
|
||||
)
|
||||
|
||||
(goal-src-sequence
|
||||
"levels/"
|
||||
:deps ("$OUT/obj/camera-defs-h.o")
|
||||
"city/common/trail-h.gc"
|
||||
)
|
||||
|
||||
(goal-src-sequence
|
||||
"engine/"
|
||||
:deps
|
||||
("$OUT/obj/trail-h.o")
|
||||
"ui/minimap-h.gc"
|
||||
"ui/bigmap-h.gc"
|
||||
"game/settings-h.gc"
|
||||
"util/capture.gc"
|
||||
"debug/memory-usage-h.gc"
|
||||
"gfx/blit-displays-h.gc"
|
||||
"gfx/texture/texture.gc"
|
||||
"game/main-h.gc"
|
||||
"anim/mspace-h.gc"
|
||||
"draw/drawable-h.gc"
|
||||
"draw/drawable-group-h.gc"
|
||||
"draw/drawable-inline-array-h.gc"
|
||||
"draw/draw-node-h.gc"
|
||||
"draw/drawable-tree-h.gc"
|
||||
"draw/drawable-actor-h.gc"
|
||||
"level/region-h.gc"
|
||||
"ai/traffic-h.gc"
|
||||
"game/task/game-task-h.gc"
|
||||
"game/task/task-control-h.gc"
|
||||
"gfx/generic/generic-h.gc"
|
||||
"gfx/sky/sky-h.gc"
|
||||
"gfx/ocean/ocean-h.gc"
|
||||
"gfx/ocean/ocean-trans-tables.gc"
|
||||
"gfx/ocean/ocean-tables.gc"
|
||||
"gfx/ocean/ocean-frames.gc"
|
||||
"gfx/mood/time-of-day-h.gc"
|
||||
"data/art-h.gc"
|
||||
"gfx/generic/generic-vu1-h.gc"
|
||||
"gfx/merc/merc-h.gc"
|
||||
"gfx/merc/generic-merc-h.gc"
|
||||
"gfx/tie/generic-tie-h.gc"
|
||||
"gfx/generic/generic-work-h.gc"
|
||||
"gfx/foreground/shadow-cpu-h.gc"
|
||||
"gfx/foreground/shadow-vu1-h.gc"
|
||||
"ps2/memcard-h.gc"
|
||||
"game/game-info-h.gc"
|
||||
"ui/gui-h.gc"
|
||||
"ambient/ambient-h.gc"
|
||||
"sound/speech-h.gc"
|
||||
"gfx/background/wind-h.gc"
|
||||
"gfx/background/prototype-h.gc"
|
||||
"anim/joint-h.gc"
|
||||
"gfx/foreground/bones-h.gc"
|
||||
"gfx/foreground/foreground-h.gc"
|
||||
"engine/engines.gc"
|
||||
"gfx/lightning-h.gc"
|
||||
"entity/res-h.gc"
|
||||
"entity/res.gc"
|
||||
"gfx/lights.gc"
|
||||
"physics/dynamics-h.gc"
|
||||
"target/surface-h.gc"
|
||||
"collide/pat-h.gc"
|
||||
"game/fact-h.gc"
|
||||
"anim/aligner-h.gc"
|
||||
"game/penetrate-h.gc"
|
||||
"game/game-h.gc"
|
||||
"util/script-h.gc"
|
||||
"scene/scene-h.gc"
|
||||
"util/sync-info-h.gc"
|
||||
"camera/pov-camera-h.gc"
|
||||
"util/smush-control-h.gc"
|
||||
"debug/debug-h.gc"
|
||||
"anim/joint-mod-h.gc"
|
||||
"collide/collide-func-h.gc"
|
||||
"collide/collide-mesh-h.gc"
|
||||
"collide/collide-shape-h.gc"
|
||||
"common_objs/generic-obs-h.gc"
|
||||
"physics/trajectory-h.gc"
|
||||
"collide/collide-target-h.gc"
|
||||
"collide/collide-touch-h.gc"
|
||||
"collide/collide-edge-grab-h.gc"
|
||||
"process-drawable/process-drawable-h.gc"
|
||||
"process-drawable/process-focusable.gc"
|
||||
"process-drawable/process-taskable-h.gc"
|
||||
"process-drawable/focus.gc"
|
||||
"game/effect-control-h.gc"
|
||||
"collide/collide-frag-h.gc"
|
||||
"spatial-hash/collide-hash-h.gc"
|
||||
"physics/chain-physics-h.gc"
|
||||
"common_objs/projectile-h.gc"
|
||||
"collide/find-nearest-h.gc"
|
||||
"target/target-h.gc"
|
||||
"debug/stats-h.gc"
|
||||
"level/bsp-h.gc"
|
||||
"collide/collide-cache-h.gc"
|
||||
"collide/collide-h.gc"
|
||||
"gfx/shrub/shrubbery-h.gc"
|
||||
"gfx/tie/tie-h.gc"
|
||||
"gfx/tfrag/tfrag-h.gc"
|
||||
"gfx/background/background-h.gc"
|
||||
"gfx/background/subdivide-h.gc"
|
||||
"entity/entity-h.gc"
|
||||
"gfx/sprite/sprite-h.gc"
|
||||
"gfx/sprite/simple-sprite-h.gc"
|
||||
"gfx/foreground/eye-h.gc"
|
||||
"gfx/sprite/particles/sparticle-launcher-h.gc"
|
||||
"gfx/sprite/particles/sparticle-h.gc"
|
||||
"entity/actor-link-h.gc"
|
||||
"camera/camera-h.gc"
|
||||
"camera/cam-debug-h.gc"
|
||||
"camera/cam-interface-h.gc"
|
||||
"camera/cam-update-h.gc"
|
||||
"ui/hud-h.gc"
|
||||
"ui/progress/progress-h.gc"
|
||||
"ps2/rpc-h.gc"
|
||||
"geometry/path-h.gc"
|
||||
"nav/nav-mesh-h.gc"
|
||||
"nav/nav-control-h.gc"
|
||||
"spatial-hash/spatial-hash-h.gc"
|
||||
"spatial-hash/actor-hash-h.gc"
|
||||
"load/load-dgo.gc"
|
||||
"load/ramdisk.gc"
|
||||
"sound/gsound.gc"
|
||||
"math/transformq.gc"
|
||||
"collide/collide-func.gc"
|
||||
"anim/joint.gc"
|
||||
"anim/joint-mod.gc"
|
||||
"physics/chain-physics.gc"
|
||||
"geometry/cylinder.gc"
|
||||
"gfx/background/wind-work.gc"
|
||||
"gfx/background/wind.gc"
|
||||
"level/bsp.gc"
|
||||
"gfx/background/subdivide.gc"
|
||||
"gfx/sprite/sprite.gc"
|
||||
"gfx/sprite/sprite-distort.gc"
|
||||
"gfx/sprite/sprite-glow.gc"
|
||||
"debug/debug-sphere.gc"
|
||||
"debug/debug.gc"
|
||||
"debug/history.gc"
|
||||
"gfx/merc/merc-vu1.gc"
|
||||
"gfx/merc/emerc-vu1.gc"
|
||||
"gfx/merc/merc-blend-shape.gc"
|
||||
"gfx/merc/merc.gc"
|
||||
"gfx/merc/emerc.gc"
|
||||
"gfx/foreground/ripple.gc"
|
||||
"gfx/foreground/bones.gc"
|
||||
"gfx/foreground/debug-foreground.gc"
|
||||
"gfx/foreground/foreground.gc"
|
||||
"gfx/generic/generic-vu0.gc"
|
||||
"gfx/generic/generic-vu1.gc"
|
||||
"gfx/generic/generic-effect.gc"
|
||||
"gfx/generic/generic-merc.gc"
|
||||
"gfx/generic/generic-tie.gc"
|
||||
"gfx/foreground/shadow-cpu.gc"
|
||||
"gfx/foreground/shadow-vu1.gc"
|
||||
"gfx/warp.gc"
|
||||
"gfx/texture/texture-anim.gc"
|
||||
"gfx/texture/texture-anim-funcs.gc"
|
||||
"gfx/texture/texture-anim-tables.gc"
|
||||
"gfx/blit-displays.gc"
|
||||
"data/font-data.gc"
|
||||
"gfx/font.gc"
|
||||
"load/decomp.gc"
|
||||
"gfx/background/background.gc"
|
||||
"draw/draw-node.gc"
|
||||
"gfx/shrub/shrubbery.gc"
|
||||
"gfx/shrub/shrub-work.gc"
|
||||
"gfx/tfrag/tfrag-near.gc"
|
||||
"gfx/tfrag/tfrag.gc"
|
||||
"gfx/tfrag/tfrag-methods.gc"
|
||||
"gfx/tfrag/tfrag-work.gc"
|
||||
"gfx/tie/tie.gc"
|
||||
"gfx/tie/etie-vu1.gc"
|
||||
"gfx/tie/etie-near-vu1.gc"
|
||||
"gfx/tie/tie-near.gc"
|
||||
"gfx/tie/tie-work.gc"
|
||||
"gfx/tie/tie-methods.gc"
|
||||
"util/sync-info.gc"
|
||||
"physics/trajectory.gc"
|
||||
"gfx/sprite/particles/sparticle-launcher.gc"
|
||||
"gfx/sprite/particles/sparticle.gc"
|
||||
"entity/entity-table.gc"
|
||||
"load/loader.gc"
|
||||
"game/game-info.gc"
|
||||
"game/task/game-task.gc"
|
||||
"game/game-save.gc"
|
||||
"game/settings.gc"
|
||||
"gfx/mood/mood-tables.gc"
|
||||
"gfx/mood/mood-tables2.gc"
|
||||
"gfx/mood/mood.gc"
|
||||
"gfx/mood/mood-funcs.gc"
|
||||
"gfx/mood/mood-funcs2.gc"
|
||||
"gfx/mood/weather-part.gc"
|
||||
"gfx/mood/time-of-day.gc"
|
||||
"gfx/sky/sky-data.gc"
|
||||
"gfx/sky/sky-tng.gc"
|
||||
"load/load-state.gc"
|
||||
"level/level-info.gc"
|
||||
"level/level.gc"
|
||||
"ui/text.gc"
|
||||
"spatial-hash/collide-hash.gc"
|
||||
"collide/collide-probe.gc"
|
||||
"collide/collide-frag.gc"
|
||||
"collide/collide-mesh.gc"
|
||||
"collide/collide-touch.gc"
|
||||
"collide/collide-edge-grab.gc"
|
||||
"collide/collide-shape.gc"
|
||||
"collide/collide-shape-rider.gc"
|
||||
"collide/collide.gc"
|
||||
"collide/collide-planes.gc"
|
||||
"spatial-hash/spatial-hash.gc"
|
||||
"spatial-hash/actor-hash.gc"
|
||||
"gfx/merc/merc-death.gc"
|
||||
"common_objs/water-flow.gc"
|
||||
"common_objs/water-h.gc"
|
||||
"camera/camera.gc"
|
||||
"camera/cam-interface.gc"
|
||||
"camera/cam-master.gc"
|
||||
"camera/cam-states.gc"
|
||||
"camera/cam-states-dbg.gc"
|
||||
"camera/cam-combiner.gc"
|
||||
"camera/cam-update.gc"
|
||||
"geometry/vol-h.gc"
|
||||
"camera/cam-layout.gc"
|
||||
"camera/cam-debug.gc"
|
||||
"camera/cam-start.gc"
|
||||
"process-drawable/process-drawable.gc"
|
||||
"ambient/ambient.gc"
|
||||
"sound/speech.gc"
|
||||
"level/region.gc"
|
||||
"anim/fma-sphere.gc"
|
||||
"util/script.gc"
|
||||
"common_objs/generic-obs.gc"
|
||||
"gfx/lightning.gc"
|
||||
"target/mech_suit/carry-h.gc"
|
||||
"game/pilot-h.gc"
|
||||
"target/gun/gun-h.gc"
|
||||
"target/board/board-h.gc"
|
||||
"target/darkjak-h.gc"
|
||||
"target/target-util.gc"
|
||||
"target/target-part.gc"
|
||||
"target/gun/gun-part.gc"
|
||||
"target/collide-reaction-target.gc"
|
||||
"target/logic-target.gc"
|
||||
"target/sidekick.gc"
|
||||
"common_objs/voicebox.gc"
|
||||
"common_objs/collectables-part.gc"
|
||||
"debug/debug-part.gc"
|
||||
"collide/find-nearest.gc"
|
||||
"game/task/task-arrow.gc"
|
||||
"common_objs/projectile.gc"
|
||||
"target/target-handler.gc"
|
||||
"target/target-anim.gc"
|
||||
"target/target.gc"
|
||||
"target/target2.gc"
|
||||
"target/target-swim.gc"
|
||||
"target/target-carry.gc"
|
||||
"target/target-darkjak.gc"
|
||||
"target/target-death.gc"
|
||||
"target/target-gun.gc"
|
||||
"target/gun/gun-util.gc"
|
||||
"target/gun/gun-blue-shot.gc"
|
||||
"target/gun/gun-yellow-shot.gc"
|
||||
"target/gun/gun-red-shot.gc"
|
||||
"target/gun/gun-dark-shot.gc"
|
||||
"target/gun/gun-states.gc"
|
||||
"target/board/board-util.gc"
|
||||
"target/board/target-board.gc"
|
||||
"target/board/board-part.gc"
|
||||
"target/board/board-states.gc"
|
||||
"target/mech_suit/mech-h.gc"
|
||||
"debug/menu.gc"
|
||||
"draw/drawable.gc"
|
||||
"draw/drawable-group.gc"
|
||||
"draw/drawable-inline-array.gc"
|
||||
"draw/drawable-tree.gc"
|
||||
"gfx/background/prototype.gc"
|
||||
"collide/main-collide.gc"
|
||||
"gfx/hw/video.gc"
|
||||
"game/main.gc"
|
||||
"collide/collide-cache.gc"
|
||||
"collide/collide-debug.gc"
|
||||
"entity/relocate.gc"
|
||||
"debug/memory-usage.gc"
|
||||
"entity/entity.gc"
|
||||
"geometry/path.gc"
|
||||
"geometry/vol.gc"
|
||||
"nav/nav-mesh.gc"
|
||||
"nav/nav-control.gc"
|
||||
"anim/aligner.gc"
|
||||
"common_objs/water.gc"
|
||||
"common_objs/collectables.gc"
|
||||
"game/task/task-control.gc"
|
||||
"scene/scene.gc"
|
||||
"camera/pov-camera.gc"
|
||||
"common_objs/powerups.gc"
|
||||
"common_objs/crates.gc"
|
||||
"ui/hud.gc"
|
||||
"ui/hud-classes.gc"
|
||||
"ui/progress/progress-static.gc"
|
||||
"ui/progress/progress.gc"
|
||||
"ui/progress/progress-draw.gc"
|
||||
"gfx/ocean/ocean.gc"
|
||||
"gfx/ocean/ocean-vu0.gc"
|
||||
"gfx/ocean/ocean-texture.gc"
|
||||
"gfx/ocean/ocean-mid.gc"
|
||||
"gfx/ocean/ocean-transition.gc"
|
||||
"gfx/ocean/ocean-near.gc"
|
||||
"ui/minimap.gc"
|
||||
"ui/bigmap-data.gc"
|
||||
"ui/bigmap.gc"
|
||||
"gfx/foreground/eye.gc"
|
||||
"util/glist-h.gc"
|
||||
"util/glist.gc"
|
||||
"debug/anim-tester.gc"
|
||||
"debug/viewer.gc"
|
||||
"debug/part-tester.gc"
|
||||
"debug/editable-h.gc"
|
||||
"debug/editable.gc"
|
||||
"debug/editable-player.gc"
|
||||
"debug/nav/mysql-nav-graph.gc"
|
||||
"debug/nav/nav-graph-editor.gc"
|
||||
"debug/sampler.gc"
|
||||
"debug/default-menu.gc"
|
||||
|
||||
)
|
||||
|
||||
(cgo "ENGINE.CGO" "engine.gd")
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ISO Group
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
@@ -359,10 +359,10 @@
|
||||
)
|
||||
|
||||
;; need to forward declare this, we haven't loaded the string library yet.
|
||||
(define-extern name= (function basic basic symbol))
|
||||
(define-extern name= (function object object symbol))
|
||||
|
||||
(defun nmember ((arg0 basic) (arg1 object))
|
||||
(while (not (or (null? arg1) (name= (the-as basic (car arg1)) arg0)))
|
||||
(while (not (or (null? arg1) (name= (car arg1) arg0)))
|
||||
(set! arg1 (cdr arg1))
|
||||
)
|
||||
(if (not (null? arg1))
|
||||
|
||||
@@ -158,6 +158,25 @@
|
||||
|
||||
;; definition for function name=
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(defun name= ((arg0 object) (arg1 object))
|
||||
"Do arg0 and arg1 have the same name?
|
||||
This can use either strings or symbols"
|
||||
(cond
|
||||
((= arg0 arg1)
|
||||
;; Either same symbols, or same string objects, fast check pass!
|
||||
#t)
|
||||
((and (= (rtype-of arg0) string) (= (rtype-of arg1) string))
|
||||
(string= (the-as string arg0) (the-as string arg1))
|
||||
)
|
||||
((and (= (rtype-of arg0) string) (= (rtype-of arg1) symbol))
|
||||
(string= (the-as string arg0) (symbol->string arg1))
|
||||
)
|
||||
((and (= (rtype-of arg1) string) (= (rtype-of arg0) symbol))
|
||||
(string= (the-as string arg1) (symbol->string arg0))
|
||||
)
|
||||
;; no need to check symbol - symbol, that would have passed the first check.
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun copyn-string<-charp ((arg0 string) (arg1 (pointer uint8)) (arg2 int))
|
||||
|
||||
Reference in New Issue
Block a user