mirror of
https://github.com/open-goal/jak-project.git
synced 2026-11-07 09:26:09 -10:00
Compare commits
23
Commits
master
...
v/format-jak1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de710e86ad | ||
|
|
209a997717 | ||
|
|
c528cf9ec3 | ||
|
|
4a746655a2 | ||
|
|
005fd46a96 | ||
|
|
e67a3ea4c3 | ||
|
|
0e4b6f2c11 | ||
|
|
eadfcca261 | ||
|
|
f00dbf15fe | ||
|
|
ba88a54902 | ||
|
|
59194f78a0 | ||
|
|
6d183980db | ||
|
|
eadd3e877c | ||
|
|
d637daf3f1 | ||
|
|
434ff62d3d | ||
|
|
6eaeb31930 | ||
|
|
32ec1c0100 | ||
|
|
0f40f33dfd | ||
|
|
588b27cbcf | ||
|
|
44c08d23a5 | ||
|
|
9f2bcf6519 | ||
|
|
59d25e41a7 | ||
|
|
42a8df39ef |
No files matched your search
+134
-34
@@ -7,42 +7,58 @@
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - Unit-Tests - Summary",
|
||||
"args": ["--gtest_brief=1"]
|
||||
"args": [
|
||||
"--gtest_brief=1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - Unit-Tests - Verbose",
|
||||
"args": ["--gtest_brief=0"]
|
||||
"args": [
|
||||
"--gtest_brief=0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - Draft Tests - Verbose",
|
||||
"args": ["--gtest_brief=0", "--gtest_filter=\"*Draft*\""]
|
||||
"args": [
|
||||
"--gtest_brief=0",
|
||||
"--gtest_filter=\"*Draft*\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - TypeConsistency - Verbose",
|
||||
"args": ["--gtest_brief=0", "--gtest_filter=\"*TypeConsistency*\""]
|
||||
"args": [
|
||||
"--gtest_brief=0",
|
||||
"--gtest_filter=\"*TypeConsistency*\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - TypeConsistency - Jak 2 - Verbose",
|
||||
"args": ["--gtest_brief=0", "--gtest_filter=\"*Jak2TypeConsistency*\""]
|
||||
"args": [
|
||||
"--gtest_brief=0",
|
||||
"--gtest_filter=\"*Jak2TypeConsistency*\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - WithGameTests - Verbose",
|
||||
"args": ["--gtest_brief=0", "--gtest_filter=\"*WithGameTests*\""]
|
||||
"args": [
|
||||
"--gtest_brief=0",
|
||||
"--gtest_filter=\"*WithGameTests*\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
@@ -113,56 +129,110 @@
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 1 - Runtime",
|
||||
"args": ["-v", "--game", "jak1", "--", "-fakeiso", "-debug"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--game",
|
||||
"jak1",
|
||||
"--",
|
||||
"-fakeiso",
|
||||
"-debug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 1 - Runtime (boot)",
|
||||
"args": ["-v", "--game", "jak1", "--", "-boot", "-fakeiso", "-debug"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--portable",
|
||||
"--game",
|
||||
"jak1",
|
||||
"--",
|
||||
"-boot",
|
||||
"-fakeiso",
|
||||
"-debug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 2 - Runtime (no boot)",
|
||||
"args": ["-v", "--game", "jak2", "--", "-fakeiso", "-debug"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--game",
|
||||
"jak2",
|
||||
"--",
|
||||
"-fakeiso",
|
||||
"-debug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 2 - Runtime (boot)",
|
||||
"args": ["-v", "--game", "jak2", "--", "-boot", "-fakeiso", "-debug"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--game",
|
||||
"jak2",
|
||||
"--",
|
||||
"-boot",
|
||||
"-fakeiso",
|
||||
"-debug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 2 - Runtime (release)",
|
||||
"args": ["-v", "--game", "jak2", "--", "-boot", "-fakeiso"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--game",
|
||||
"jak2",
|
||||
"--",
|
||||
"-boot",
|
||||
"-fakeiso"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "gk.exe (bin\\gk.exe)",
|
||||
"name": "Game - Jak 3 - Runtime (boot)",
|
||||
"args": ["-v", "--game", "jak3", "--", "-boot", "-fakeiso", "-debug"]
|
||||
"args": [
|
||||
"-v",
|
||||
"--game",
|
||||
"jak3",
|
||||
"--",
|
||||
"-boot",
|
||||
"-fakeiso",
|
||||
"-debug"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc.exe (bin\\goalc.exe)",
|
||||
"name": "REPL - Jak 1",
|
||||
"args": ["--user-auto", "--game", "jak1"]
|
||||
"args": [
|
||||
"--user-auto",
|
||||
"--game",
|
||||
"jak1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc.exe (bin\\goalc.exe)",
|
||||
"name": "REPL - Jak 2",
|
||||
"args": ["--user-auto", "--game", "jak2"]
|
||||
"args": [
|
||||
"--user-auto",
|
||||
"--game",
|
||||
"jak2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
@@ -262,14 +332,26 @@
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "memory_dump_tool.exe (bin\\memory_dump_tool.exe)",
|
||||
"name": "Tools - EE Memory Analyze - Jak 1",
|
||||
"args": ["\"${workspaceRoot}/eeMemory.bin\"", "--output-path", "\"${workspaceRoot}\"", "--game", "jak1"]
|
||||
"args": [
|
||||
"\"${workspaceRoot}/eeMemory.bin\"",
|
||||
"--output-path",
|
||||
"\"${workspaceRoot}\"",
|
||||
"--game",
|
||||
"jak1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "memory_dump_tool.exe (bin\\memory_dump_tool.exe)",
|
||||
"name": "Tools - EE Memory Analyze - Jak 2",
|
||||
"args": ["\"${workspaceRoot}/eeMemory.bin\"", "--output-path", "\"${workspaceRoot}\"", "--game", "jak2"]
|
||||
"args": [
|
||||
"\"${workspaceRoot}/eeMemory.bin\"",
|
||||
"--output-path",
|
||||
"\"${workspaceRoot}\"",
|
||||
"--game",
|
||||
"jak2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
@@ -286,35 +368,53 @@
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "extractor.exe (bin\\extractor.exe)",
|
||||
"name": "Tools - Extractor - Full",
|
||||
"args": ["\"E:\\ISOs\\Jak\\Jak 1.iso\""]
|
||||
"args": [
|
||||
"\"E:\\ISOs\\Jak\\Jak 1.iso\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "lsp.exe (bin\\lsp.exe)",
|
||||
"name" : "Tools - LSP",
|
||||
"args" : []
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "lsp.exe (bin\\lsp.exe)",
|
||||
"name": "Tools - LSP",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "type_searcher.exe (bin\\type_searcher.exe)",
|
||||
"name" : "Tools - Type Searcher",
|
||||
"args" : ["--game", "jak2", "--output-path", "./search-results.json", "--size", 255, "--fields", "[{\\\"type\\\":\\\"quaternion\\\",\\\"offset\\\":48}]"]
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "type_searcher.exe (bin\\type_searcher.exe)",
|
||||
"name": "Tools - Type Searcher",
|
||||
"args": [
|
||||
"--game",
|
||||
"jak2",
|
||||
"--output-path",
|
||||
"./search-results.json",
|
||||
"--size",
|
||||
255,
|
||||
"--fields",
|
||||
"[{\\\"type\\\":\\\"quaternion\\\",\\\"offset\\\":48}]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type" : "default",
|
||||
"project" : "CMakeLists.txt",
|
||||
"projectTarget" : "formatter.exe (bin\\formatter.exe)",
|
||||
"name" : "Tools - Formatter - Inplace",
|
||||
"args" : ["--write", "--file", "C:\\Users\\xtvas\\Repos\\opengoal\\jak-project\\decompiler_out\\jak3\\mood-h_disasm.gc"]
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "formatter.exe (bin\\formatter.exe)",
|
||||
"name": "Tools - Formatter - Inplace",
|
||||
"args": [
|
||||
"--write",
|
||||
"--file",
|
||||
"C:\\Users\\xtvas\\Repositories\\opengoal\\jak-project\\goal_src\\jak1\\engine\\camera\\cam-states.gc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"project": "CMakeLists.txt",
|
||||
"projectTarget": "goalc-test.exe (bin\\goalc-test.exe)",
|
||||
"name": "Tests - Formatter",
|
||||
"args": ["--gtest_brief=0", "--gtest_filter=\"*FormatterTests*\""]
|
||||
"args": [
|
||||
"--gtest_brief=0",
|
||||
"--gtest_filter=\"*FormatterTests*\""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -8,10 +8,10 @@
|
||||
"name": "run python script",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/scripts/gsrc/copy-common-naming.py",
|
||||
"program": "${workspaceFolder}/scripts/gsrc/compare-compilation-outputs.py",
|
||||
"console": "integratedTerminal",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": ["--update-names-from-refs", "--decompiler", "./out/build/Release/bin/decompiler"]
|
||||
"args": []
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -12,7 +12,6 @@ Also in general I found it _really_ hard to find modern and easy to understand a
|
||||
Atleast for me, it helps to understand the path code takes as it flows through the formatting process. Originally I tried to do as much at once for sake of efficiency but this just makes things incredibly hard to reason about and fix bugs. So like any problem that is complex, break it down, the formatter goes through many distinct phases chipping away at the problem:
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme': 'dark', "flowchart" : { "curve" : "basis" } } }%%
|
||||
flowchart TB
|
||||
subgraph top1 [Build a Formatting Tree]
|
||||
direction TB
|
||||
|
||||
@@ -33,14 +33,16 @@ int hang_indentation_width(const FormatterTreeNode& curr_node) {
|
||||
return 1 + hang_indentation_width(first_elt);
|
||||
}
|
||||
|
||||
// TODO - this doesn't account for paren's width contribution!
|
||||
int get_total_form_inlined_width(const FormatterTreeNode& curr_node) {
|
||||
if (curr_node.token) {
|
||||
return curr_node.token->length();
|
||||
}
|
||||
int width = 1;
|
||||
for (const auto& ref : curr_node.refs) {
|
||||
width += get_total_form_inlined_width(ref);
|
||||
for (int i = 0; i < curr_node.refs.size(); i++) {
|
||||
width += get_total_form_inlined_width(curr_node.refs.at(i));
|
||||
if (i != curr_node.refs.size() - 1) {
|
||||
width += 1; // add the space between elements
|
||||
}
|
||||
}
|
||||
return width + 1;
|
||||
}
|
||||
@@ -49,7 +51,9 @@ int get_total_form_inlined_width(const FormatterTreeNode& curr_node) {
|
||||
void apply_formatting_config(
|
||||
FormatterTreeNode& curr_node,
|
||||
std::optional<std::shared_ptr<formatter_rules::config::FormFormattingConfig>>
|
||||
config_from_parent = {}) {
|
||||
config_from_parent = {},
|
||||
std::optional<std::shared_ptr<formatter_rules::config::FormFormattingConfig>>
|
||||
config_merge_from_parent = {}) {
|
||||
using namespace formatter_rules;
|
||||
// node is empty, base-case
|
||||
if (curr_node.token || curr_node.refs.empty()) {
|
||||
@@ -65,6 +69,13 @@ void apply_formatting_config(
|
||||
predefined_config = config::opengoal_form_config.at(form_head.value());
|
||||
curr_node.formatting_config = predefined_config.value();
|
||||
}
|
||||
|
||||
if (config_merge_from_parent) {
|
||||
const auto& merge_config = *config_merge_from_parent.value();
|
||||
curr_node.formatting_config.parent_mutable_extra_indent +=
|
||||
merge_config.parent_mutable_extra_indent;
|
||||
curr_node.formatting_config.prevent_inlining = merge_config.prevent_inlining;
|
||||
}
|
||||
} else if (config_from_parent) {
|
||||
// TODO - doesn't merge just replaces, a bit inflexible
|
||||
predefined_config = *config_from_parent.value();
|
||||
@@ -104,7 +115,7 @@ void apply_formatting_config(
|
||||
if (curr_node.formatting_config.has_constant_pairs) {
|
||||
for (int i = 0; i < (int)curr_node.refs.size(); i++) {
|
||||
auto& child_ref = curr_node.refs.at(i);
|
||||
const auto type = child_ref.metadata.node_type;
|
||||
const auto& type = child_ref.metadata.node_type;
|
||||
if (constant_types.find(type) == constant_types.end() &&
|
||||
constant_pairs::is_element_second_in_constant_pair(curr_node, child_ref, i)) {
|
||||
child_ref.formatting_config.parent_mutable_extra_indent = 2;
|
||||
@@ -129,13 +140,16 @@ void apply_formatting_config(
|
||||
auto& ref = curr_node.refs.at(i);
|
||||
if (!ref.token) {
|
||||
// If the child has a pre-defined configuration at that index, we pass it along
|
||||
if (predefined_config &&
|
||||
predefined_config->index_configs.find(i) != predefined_config->index_configs.end()) {
|
||||
apply_formatting_config(ref, predefined_config->index_configs.at(i));
|
||||
if (predefined_config && predefined_config->index_config_override.find(i) !=
|
||||
predefined_config->index_config_override.end()) {
|
||||
apply_formatting_config(ref, {}, predefined_config->index_config_override.at(i));
|
||||
} else if (predefined_config && predefined_config->index_configs.find(i) !=
|
||||
predefined_config->index_configs.end()) {
|
||||
apply_formatting_config(ref, predefined_config->index_configs.at(i), {});
|
||||
} else if (predefined_config && predefined_config->default_index_config) {
|
||||
apply_formatting_config(ref, predefined_config->default_index_config);
|
||||
apply_formatting_config(ref, predefined_config->default_index_config, {});
|
||||
} else {
|
||||
apply_formatting_config(ref);
|
||||
apply_formatting_config(ref, {}, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,10 +165,27 @@ void apply_formatting_config(
|
||||
max_columns = field.refs.size();
|
||||
}
|
||||
}
|
||||
// if only one field has a value in the max col position, it looks weird for it to be indented
|
||||
bool ignore_final_column_width = true;
|
||||
int fields_with_atleast_max_col = 0;
|
||||
for (const auto& field : curr_node.refs) {
|
||||
if ((int)field.refs.size() == max_columns) {
|
||||
fields_with_atleast_max_col++;
|
||||
if (fields_with_atleast_max_col > 1) {
|
||||
ignore_final_column_width = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now find the column max widths
|
||||
std::vector<int> column_max_widths = {};
|
||||
for (int col = 0; col < max_columns; col++) {
|
||||
column_max_widths.push_back(0);
|
||||
// -2 because its the indentation before the final column that we want to skip
|
||||
if (col >= curr_node.formatting_config.num_columns_to_compute_widths ||
|
||||
(ignore_final_column_width && col == max_columns - 2)) {
|
||||
continue;
|
||||
}
|
||||
for (const auto& field : curr_node.refs) {
|
||||
if ((int)field.refs.size() > col) {
|
||||
const auto width = get_total_form_inlined_width(field.refs.at(col));
|
||||
@@ -202,6 +233,10 @@ bool form_contains_node_that_prevents_inlining(const FormatterTreeNode& curr_nod
|
||||
bool can_node_be_inlined(const FormatterTreeNode& curr_node, int cursor_pos) {
|
||||
using namespace formatter_rules;
|
||||
if (curr_node.formatting_config.force_inline) {
|
||||
// Ensure there are no comments, this still trumps this
|
||||
if (form_contains_comment(curr_node)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// First off, we cannot inline the top level
|
||||
@@ -264,13 +299,15 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
|
||||
// Add new line entry
|
||||
if (ref.token) {
|
||||
// Cleanup block-comments
|
||||
std::string val = ref.token_str();
|
||||
if (ref.metadata.node_type == "block_comment") {
|
||||
// TODO - change this sanitization to return a list of lines instead of a single new-lined
|
||||
// line
|
||||
val = comments::format_block_comment(ref.token_str());
|
||||
const auto comment_lines = comments::format_block_comment(ref.token_str());
|
||||
for (const auto& line : comment_lines) {
|
||||
form_lines.push_back(line);
|
||||
}
|
||||
} else {
|
||||
form_lines.push_back(ref.token_str());
|
||||
}
|
||||
form_lines.push_back(val);
|
||||
|
||||
if (!curr_node.metadata.is_top_level && i == (int)curr_node.refs.size() - 1 &&
|
||||
(ref.metadata.is_comment)) {
|
||||
// if there's an inline comment at the end of a form, we have to force the paren to the next
|
||||
@@ -292,26 +329,41 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
|
||||
if (i == (int)curr_node.refs.size() - 1 && form_lines.size() > 1 &&
|
||||
(curr_node.formatting_config.hang_forms ||
|
||||
curr_node.formatting_config.combine_first_two_lines)) {
|
||||
form_lines.at(0) += fmt::format(" {}", form_lines.at(1));
|
||||
form_lines.at(0) += fmt::format(" {}", str_util::ltrim(form_lines.at(1)));
|
||||
form_lines.erase(form_lines.begin() + 1);
|
||||
} else if ((i + 1) < (int)curr_node.refs.size()) {
|
||||
const auto& next_ref = curr_node.refs.at(i + 1);
|
||||
// combine the next inline comment or constant pair
|
||||
if ((next_ref.metadata.node_type == "comment" && next_ref.metadata.is_inline) ||
|
||||
(curr_node.formatting_config.has_constant_pairs &&
|
||||
constant_pairs::is_element_second_in_constant_pair(curr_node, next_ref, i + 1))) {
|
||||
constant_pairs::is_element_second_in_constant_pair(curr_node, next_ref, i + 1)) ||
|
||||
constant_pairs::is_element_second_in_constant_pair_new(curr_node.refs.at(i), next_ref)) {
|
||||
// TODO
|
||||
// has issues with not consolidating first lines, this should probably just be moved to
|
||||
// outside this loop for simplicity, do it later
|
||||
if (next_ref.token) {
|
||||
form_lines.at(form_lines.size() - 1) += fmt::format(" {}", next_ref.token.value());
|
||||
form_lines.at(form_lines.size() - 1) += fmt::format(" {}", next_ref.token_str());
|
||||
i++;
|
||||
// We have to handle hang-consolidation here or else it will never be reached above!
|
||||
if (i == (int)curr_node.refs.size() - 1 && form_lines.size() > 1 &&
|
||||
(curr_node.formatting_config.hang_forms ||
|
||||
curr_node.formatting_config.combine_first_two_lines)) {
|
||||
form_lines.at(0) += fmt::format(" {}", form_lines.at(1));
|
||||
form_lines.erase(form_lines.begin() + 1);
|
||||
}
|
||||
} else if (can_node_be_inlined(next_ref, cursor_pos)) {
|
||||
const auto& lines = apply_formatting(next_ref, {}, cursor_pos); // TODO - cursor pos
|
||||
for (const auto& line : lines) {
|
||||
form_lines.at(form_lines.size() - 1) += fmt::format(" {}", line);
|
||||
}
|
||||
i++;
|
||||
// We have to handle hang-consolidation here or else it will never be reached above!
|
||||
if (i == (int)curr_node.refs.size() - 1 && form_lines.size() > 1 &&
|
||||
(curr_node.formatting_config.hang_forms ||
|
||||
curr_node.formatting_config.combine_first_two_lines)) {
|
||||
form_lines.at(0) += fmt::format(" {}", form_lines.at(1));
|
||||
form_lines.erase(form_lines.begin() + 1);
|
||||
}
|
||||
}
|
||||
if (!curr_node.metadata.is_top_level && next_ref.metadata.node_type == "comment" &&
|
||||
(i + 1) == (int)curr_node.refs.size()) {
|
||||
@@ -328,7 +380,9 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
|
||||
// Consolidate any lines if the configuration requires it
|
||||
// TODO there is a hack here so that multi-line forms that are consolidated still line up properly
|
||||
// i have to make consolidate a more first-class feature of the config
|
||||
if (curr_node.formatting_config.inline_until_index(form_lines)) {
|
||||
// TODO - hacky, but prevents a bad situation, clean up
|
||||
if (curr_node.formatting_config.inline_until_index(form_lines) &&
|
||||
!str_util::contains(form_lines.at(0), ";")) {
|
||||
std::vector<std::string> new_form_lines = {};
|
||||
const auto original_form_head_width = str_util::split(form_lines.at(0), '\n').at(0).length();
|
||||
bool consolidating_lines = true;
|
||||
@@ -374,22 +428,32 @@ std::vector<std::string> apply_formatting(const FormatterTreeNode& curr_node,
|
||||
form_lines[form_lines.size() - 1] =
|
||||
fmt::format("{}{}", form_lines[form_lines.size() - 1], form_surround_end);
|
||||
}
|
||||
std::string curr_form = "";
|
||||
if (curr_node.formatting_config.parent_mutable_extra_indent > 0) {
|
||||
curr_form += str_util::repeat(curr_node.formatting_config.parent_mutable_extra_indent, " ");
|
||||
}
|
||||
if (inline_form) {
|
||||
form_lines = {fmt::format("{}", fmt::join(form_lines, " "))};
|
||||
// NOTE - not sure about this, if we are inlining a form, it always makes sense to eliminate
|
||||
// trailing whitespace the only issue i can foresee is related to strings that span multiple
|
||||
// lines.
|
||||
std::vector<std::string> new_form_lines = {};
|
||||
for (const auto& form_line : form_lines) {
|
||||
new_form_lines.push_back(str_util::ltrim(form_line));
|
||||
}
|
||||
form_lines = {fmt::format("{}", fmt::join(new_form_lines, " "))};
|
||||
} else {
|
||||
bool currently_in_block_comment = false;
|
||||
for (int i = 0; i < (int)form_lines.size(); i++) {
|
||||
if (i > 0) {
|
||||
auto& line = form_lines.at(i);
|
||||
auto& line = form_lines.at(i);
|
||||
if (str_util::contains(line, "|#")) {
|
||||
currently_in_block_comment = false;
|
||||
}
|
||||
if (i > 0 && !currently_in_block_comment) {
|
||||
line = fmt::format("{}{}",
|
||||
str_util::repeat(curr_node.formatting_config.indentation_width_for_index(
|
||||
curr_node.formatting_config, i),
|
||||
" "),
|
||||
line);
|
||||
}
|
||||
if (str_util::contains(line, "#|") && !str_util::contains(line, "|#")) {
|
||||
currently_in_block_comment = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return form_lines;
|
||||
|
||||
@@ -79,18 +79,18 @@ FormatterTree::FormatterTree(const std::string& source, const TSNode& root_node)
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, std::vector<std::string>> node_type_ignorable_contents = {
|
||||
{"list_lit", {"(", ")"}},
|
||||
{"quoting_lit", {"'"}},
|
||||
{"unquoting_lit", {","}},
|
||||
{"quasi_quoting_lit", {"`"}}};
|
||||
{"list_lit", {"(", ")"}}};
|
||||
|
||||
// TODO make an imperative version eventually
|
||||
// TODO - cleanup duplication
|
||||
void FormatterTree::construct_formatter_tree_recursive(const std::string& source,
|
||||
TSNode curr_node,
|
||||
FormatterTreeNode& tree_node,
|
||||
std::optional<std::string> node_prefix) {
|
||||
if (ts_node_child_count(curr_node) == 0) {
|
||||
tree_node.refs.push_back(FormatterTreeNode(source, curr_node));
|
||||
auto new_node = FormatterTreeNode(source, curr_node);
|
||||
new_node.node_prefix = node_prefix;
|
||||
tree_node.refs.push_back(new_node);
|
||||
return;
|
||||
}
|
||||
const std::string curr_node_type = ts_node_type(curr_node);
|
||||
@@ -105,11 +105,37 @@ void FormatterTree::construct_formatter_tree_recursive(const std::string& source
|
||||
tree_node.refs.push_back(FormatterTreeNode(source, curr_node));
|
||||
return;
|
||||
} else if (curr_node_type == "quoting_lit") {
|
||||
next_node_prefix = "'";
|
||||
if (node_prefix) {
|
||||
node_prefix.value() += "'";
|
||||
} else {
|
||||
node_prefix = "'";
|
||||
}
|
||||
construct_formatter_tree_recursive(source, ts_node_child(curr_node, 1), tree_node, node_prefix);
|
||||
return;
|
||||
} else if (curr_node_type == "unquoting_lit") {
|
||||
next_node_prefix = ",";
|
||||
if (node_prefix) {
|
||||
node_prefix.value() += ",";
|
||||
} else {
|
||||
node_prefix = ",";
|
||||
}
|
||||
construct_formatter_tree_recursive(source, ts_node_child(curr_node, 1), tree_node, node_prefix);
|
||||
return;
|
||||
} else if (curr_node_type == "quasi_quoting_lit") {
|
||||
next_node_prefix = "`";
|
||||
if (node_prefix) {
|
||||
node_prefix.value() += "`";
|
||||
} else {
|
||||
node_prefix = "`";
|
||||
}
|
||||
construct_formatter_tree_recursive(source, ts_node_child(curr_node, 1), tree_node, node_prefix);
|
||||
return;
|
||||
} else if (curr_node_type == "unquote_splicing_lit") {
|
||||
if (node_prefix) {
|
||||
node_prefix.value() += ",@";
|
||||
} else {
|
||||
node_prefix = ",@";
|
||||
}
|
||||
construct_formatter_tree_recursive(source, ts_node_child(curr_node, 1), tree_node, node_prefix);
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> skippable_nodes = {};
|
||||
if (node_type_ignorable_contents.find(curr_node_type) != node_type_ignorable_contents.end()) {
|
||||
@@ -117,6 +143,7 @@ void FormatterTree::construct_formatter_tree_recursive(const std::string& source
|
||||
}
|
||||
for (size_t i = 0; i < ts_node_child_count(curr_node); i++) {
|
||||
const auto child_node = ts_node_child(curr_node, i);
|
||||
auto debug_child = ts_node_string(child_node);
|
||||
const auto contents = get_source_code(source, child_node);
|
||||
bool skip_node = false;
|
||||
for (const auto& skippable_content : skippable_nodes) {
|
||||
@@ -129,19 +156,22 @@ void FormatterTree::construct_formatter_tree_recursive(const std::string& source
|
||||
continue;
|
||||
}
|
||||
if (curr_node_type == "list_lit") {
|
||||
construct_formatter_tree_recursive(source, child_node, list_node, next_node_prefix);
|
||||
construct_formatter_tree_recursive(source, child_node, list_node, {});
|
||||
if (node_prefix) {
|
||||
list_node.node_prefix = node_prefix;
|
||||
}
|
||||
} else {
|
||||
construct_formatter_tree_recursive(source, child_node, tree_node, next_node_prefix);
|
||||
// TODO - im not sure if this is correct
|
||||
construct_formatter_tree_recursive(source, child_node, tree_node, node_prefix);
|
||||
if (node_prefix && !tree_node.refs.empty()) {
|
||||
tree_node.refs.at(tree_node.refs.size() - 1).node_prefix = node_prefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (curr_node_type == "list_lit") {
|
||||
// special case for empty lists
|
||||
if (node_prefix && !list_node.node_prefix) {
|
||||
list_node.node_prefix = node_prefix;
|
||||
}
|
||||
tree_node.refs.push_back(list_node);
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,16 @@ namespace formatter_rules {
|
||||
// differentiate between a quoted symbol and a quoted form
|
||||
const std::set<std::string> constant_types = {"kwd_lit", "num_lit", "str_lit",
|
||||
"char_lit", "null_lit", "bool_lit"};
|
||||
const std::set<std::string> constant_type_forms = {"meters", "seconds", "degrees"};
|
||||
|
||||
namespace constant_list {
|
||||
bool is_constant_list(const FormatterTreeNode& node) {
|
||||
if (!node.is_list() || node.refs.empty()) {
|
||||
return false;
|
||||
}
|
||||
if (!node.refs.at(0).token) {
|
||||
return true;
|
||||
}
|
||||
const auto& type = node.refs.at(0).metadata.node_type;
|
||||
return constant_types.find(type) != constant_types.end();
|
||||
}
|
||||
@@ -36,21 +40,28 @@ bool should_insert_blank_line(const FormatterTreeNode& containing_node,
|
||||
if (node.metadata.is_comment && node.metadata.num_blank_lines_following == 0) {
|
||||
return false;
|
||||
}
|
||||
// If the next form is a comment and is inline, don't insert a comment
|
||||
// If the next form is a comment and is inline, don't insert a new line
|
||||
if ((index + 1) < (int)containing_node.refs.size() &&
|
||||
containing_node.refs.at(index + 1).metadata.is_comment &&
|
||||
containing_node.refs.at(index + 1).metadata.is_inline) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO - only if the form doesn't fit on a single line
|
||||
if (node.formatting_config.elide_top_level_newline) {
|
||||
if ((index + 1) < (int)containing_node.refs.size() &&
|
||||
containing_node.refs.at(index + 1).metadata.is_comment) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace blank_lines
|
||||
|
||||
namespace comments {
|
||||
std::string format_block_comment(const std::string& comment) {
|
||||
std::vector<std::string> format_block_comment(const std::string& comment) {
|
||||
// Normalize block comments, remove any trailing or leading whitespace
|
||||
// Only allow annotations on the first line, like #|@file
|
||||
// Don't mess with internal indentation as the user might intend it to be a certain way.
|
||||
@@ -71,12 +82,22 @@ std::string format_block_comment(const std::string& comment) {
|
||||
// Remove trailing whitespace
|
||||
comment_contents = str_util::rtrim(comment_contents);
|
||||
// remove |#
|
||||
// TODO - check suffix
|
||||
comment_contents.pop_back();
|
||||
comment_contents.pop_back();
|
||||
if (str_util::ends_with(comment_contents, "|#")) {
|
||||
comment_contents.pop_back();
|
||||
comment_contents.pop_back();
|
||||
}
|
||||
comment_contents = str_util::rtrim(comment_contents);
|
||||
new_comment += fmt::format("\n{}\n|#", comment_contents);
|
||||
return new_comment;
|
||||
std::vector<std::string> lines = {new_comment};
|
||||
const auto contents_as_lines = str_util::split_string(comment_contents, "\n");
|
||||
if (contents_as_lines.size() > 1) {
|
||||
for (const auto& line : contents_as_lines) {
|
||||
lines.push_back(line);
|
||||
}
|
||||
lines.push_back("|#");
|
||||
} else {
|
||||
lines.at(0) = fmt::format("{} {} |#", new_comment, str_util::trim(contents_as_lines.at(0)));
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
} // namespace comments
|
||||
|
||||
@@ -101,6 +122,46 @@ bool is_element_second_in_constant_pair(const FormatterTreeNode& containing_node
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO - potentially remove the above
|
||||
bool is_element_second_in_constant_pair_new(const FormatterTreeNode& prev_node,
|
||||
const FormatterTreeNode& curr_node) {
|
||||
if (prev_node.metadata.node_type == "kwd_lit") {
|
||||
// Handle standard constant types
|
||||
// TODO - pair up sym_names as well
|
||||
if (constant_types.find(curr_node.metadata.node_type) != constant_types.end()) {
|
||||
if (curr_node.metadata.node_type != "kwd_lit") {
|
||||
// NOTE - there is ambiugity here which cannot be totally solved (i think?)
|
||||
// if the element itself is also a keyword, assume this is two adjacent keywords and they
|
||||
// should not be paired
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Quoted symbols
|
||||
if (curr_node.metadata.node_type == "sym_name" && curr_node.node_prefix &&
|
||||
(curr_node.node_prefix.value() == "'" || curr_node.node_prefix.value() == ",")) {
|
||||
return true;
|
||||
}
|
||||
if (!curr_node.refs.empty()) {
|
||||
// Constant forms special cases (ie. meters)
|
||||
if (constant_type_forms.find(curr_node.refs.at(0).token_str()) != constant_type_forms.end()) {
|
||||
return true;
|
||||
}
|
||||
// If they are just a list of symbol names (enum or simple method call)
|
||||
bool all_symbols = true;
|
||||
for (const auto& ref : curr_node.refs) {
|
||||
if (ref.metadata.node_type != "sym_name") {
|
||||
all_symbols = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_symbols) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool form_should_be_constant_paired(const FormatterTreeNode& node) {
|
||||
// Criteria for a list to be constant paired:
|
||||
// - needs to start with a non-symbol
|
||||
|
||||
@@ -36,7 +36,7 @@ bool should_insert_blank_line(const FormatterTreeNode& containing_node,
|
||||
//
|
||||
// Reference - https://github.com/kkinnear/zprint/blob/main/doc/options/comments.md
|
||||
namespace comments {
|
||||
std::string format_block_comment(const std::string& comment);
|
||||
std::vector<std::string> format_block_comment(const std::string& comment);
|
||||
}
|
||||
|
||||
// Paired elements in a list will be kept in-line rather than the default new-line indentation
|
||||
@@ -72,6 +72,8 @@ const static int min_pair_amount = 4;
|
||||
bool is_element_second_in_constant_pair(const FormatterTreeNode& containing_node,
|
||||
const FormatterTreeNode& node,
|
||||
const int index);
|
||||
bool is_element_second_in_constant_pair_new(const FormatterTreeNode& prev_node,
|
||||
const FormatterTreeNode& curr_node);
|
||||
bool form_should_be_constant_paired(const FormatterTreeNode& node);
|
||||
} // namespace constant_pairs
|
||||
|
||||
|
||||
@@ -1,24 +1,146 @@
|
||||
#include "rule_config.h"
|
||||
|
||||
#include "common/util/string_util.h"
|
||||
|
||||
namespace formatter_rules {
|
||||
namespace config {
|
||||
|
||||
static FormFormattingConfig new_inlinable_simple_flow_rule() {
|
||||
return {.config_set = true, .hang_forms = false};
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_permissive_flow_rule() {
|
||||
return {.config_set = true, .hang_forms = false, .combine_first_two_lines = true};
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_flow_rule(int start_index) {
|
||||
static FormFormattingConfig new_flow_rule(int start_index, bool has_constant_pairs = false) {
|
||||
return {.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index = [start_index](const std::vector<std::string>& /*curr_lines*/) {
|
||||
return start_index;
|
||||
}};
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& /*curr_lines*/) { return start_index; },
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_function_rule(int start_index, bool has_constant_pairs = false) {
|
||||
FormFormattingConfig cfg = {
|
||||
.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& /*curr_lines*/) { return start_index; },
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
auto arg_list_config = std::make_shared<FormFormattingConfig>();
|
||||
arg_list_config->force_inline = true;
|
||||
arg_list_config->hang_forms = false;
|
||||
cfg.index_configs.emplace(2, arg_list_config);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_inlineable_flow_rule(int start_index,
|
||||
bool has_constant_pairs = false) {
|
||||
return {.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& curr_lines) {
|
||||
int total_width = 0;
|
||||
for (const auto& line : curr_lines) {
|
||||
// Check for comments
|
||||
// TODO - this shows how this isn't really the best strategy but it holds up
|
||||
if (str_util::contains(line, ";")) {
|
||||
// Can't inline, there's a comment!
|
||||
return start_index;
|
||||
}
|
||||
total_width += line.length();
|
||||
// an empty line implies a new-line was forced, this is bleeding implementation
|
||||
// details, but fine for now
|
||||
if (line.empty()) {
|
||||
return start_index;
|
||||
}
|
||||
}
|
||||
if (total_width <= 120) {
|
||||
return (int)curr_lines.size();
|
||||
}
|
||||
return start_index;
|
||||
},
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_defstate_rule(int start_index, bool has_constant_pairs = false) {
|
||||
FormFormattingConfig cfg = {
|
||||
.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& /*curr_lines*/) { return start_index; },
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
std::vector<int> state_handler_indexes = {4, 6, 8, 10,
|
||||
12, 14}; // NOTE - not all of these have to be defined
|
||||
for (const auto& index : state_handler_indexes) {
|
||||
auto temp_config = std::make_shared<FormFormattingConfig>();
|
||||
temp_config->prevent_inlining = true;
|
||||
temp_config->parent_mutable_extra_indent = 2;
|
||||
cfg.index_config_override.emplace(index, temp_config);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_defmethod_rule(int start_index, bool has_constant_pairs = false) {
|
||||
// TODO - might be nice to have a function that returns a config based on a given index, instead
|
||||
// of hardcoding them!
|
||||
// Right now this only works for non-`new` methods (else we may bleed into the body of a normal
|
||||
// method)
|
||||
auto arg_list_config = std::make_shared<FormFormattingConfig>();
|
||||
arg_list_config->force_inline = true;
|
||||
arg_list_config->hang_forms = false;
|
||||
FormFormattingConfig cfg = {.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& curr_lines) {
|
||||
if (curr_lines.size() >= 2 && curr_lines.at(1) == "new") {
|
||||
// defmethod was changed to omit the type name for everything
|
||||
// except the `new` method, so special case.
|
||||
return start_index + 1;
|
||||
}
|
||||
return start_index;
|
||||
},
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
cfg.index_configs.emplace(2, arg_list_config);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_lambda_rule(int start_index, bool has_constant_pairs = false) {
|
||||
FormFormattingConfig cfg = {.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index =
|
||||
[start_index](const std::vector<std::string>& curr_lines) {
|
||||
if (curr_lines.size() >= 2 && curr_lines.at(1) == ":behavior") {
|
||||
// defmethod was changed to omit the type name for everything
|
||||
// except the `new` method, so special case.
|
||||
return start_index + 2;
|
||||
}
|
||||
return start_index;
|
||||
},
|
||||
.has_constant_pairs = has_constant_pairs};
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_defenum_rule() {
|
||||
auto temp_list_config = std::make_shared<FormFormattingConfig>();
|
||||
temp_list_config->force_inline = true;
|
||||
temp_list_config->hang_forms = false;
|
||||
return {
|
||||
.config_set = true,
|
||||
.hang_forms = false,
|
||||
.inline_until_index = [](const std::vector<std::string>& /*curr_lines*/) { return 2; },
|
||||
.has_constant_pairs = true,
|
||||
.default_index_config = temp_list_config,
|
||||
};
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_deftype_rule(
|
||||
int start_index,
|
||||
int num_columns_to_compute_widths,
|
||||
const std::vector<int>& inlining_preventation_indices) {
|
||||
FormFormattingConfig cfg;
|
||||
cfg.has_constant_pairs = true;
|
||||
cfg.config_set = true;
|
||||
cfg.hang_forms = false;
|
||||
cfg.inline_until_index = [start_index](std::vector<std::string> curr_lines) {
|
||||
@@ -39,6 +161,7 @@ static FormFormattingConfig new_deftype_rule(
|
||||
temp_config->default_index_config = temp_list_config;
|
||||
if (index == 3) {
|
||||
temp_config->determine_column_widths_for_list_elements = true;
|
||||
temp_config->num_columns_to_compute_widths = num_columns_to_compute_widths;
|
||||
}
|
||||
cfg.index_configs.emplace(index, temp_config);
|
||||
}
|
||||
@@ -74,6 +197,29 @@ static FormFormattingConfig new_binding_rule(int form_head_width) {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_inline_binding_rule(int form_head_width) {
|
||||
FormFormattingConfig cfg;
|
||||
cfg.config_set = true;
|
||||
cfg.hang_forms = false;
|
||||
cfg.combine_first_two_lines = true;
|
||||
auto binding_list_config = std::make_shared<FormFormattingConfig>();
|
||||
binding_list_config->config_set = true;
|
||||
binding_list_config->hang_forms = false;
|
||||
binding_list_config->indentation_width = 1;
|
||||
binding_list_config->indentation_width_for_index = [form_head_width](FormFormattingConfig /*cfg*/,
|
||||
int index) {
|
||||
if (index == 0) {
|
||||
return 0;
|
||||
}
|
||||
return form_head_width;
|
||||
};
|
||||
binding_list_config->should_prevent_inlining = [](FormFormattingConfig /*config*/, int num_refs) {
|
||||
return false;
|
||||
};
|
||||
cfg.index_configs.emplace(1, binding_list_config);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_pair_rule(bool combine_first_two_expr) {
|
||||
FormFormattingConfig cfg;
|
||||
cfg.config_set = true;
|
||||
@@ -88,23 +234,70 @@ static FormFormattingConfig new_pair_rule(bool combine_first_two_expr) {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static FormFormattingConfig new_top_level_inline_form(bool elide_new_line) {
|
||||
return {.force_inline = true, .elide_top_level_newline = elide_new_line};
|
||||
}
|
||||
|
||||
const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config = {
|
||||
{"case", new_pair_rule(true)},
|
||||
{"cond", new_pair_rule(false)},
|
||||
{"defmethod", new_flow_rule(3)},
|
||||
{"deftype", new_deftype_rule(3, {3, 4, 5, 6})},
|
||||
{"#cond", new_pair_rule(false)},
|
||||
{"in-package", new_top_level_inline_form(true)},
|
||||
{"bundles", new_top_level_inline_form(true)},
|
||||
{"require", new_top_level_inline_form(true)},
|
||||
{"def-art-elt", new_top_level_inline_form(true)},
|
||||
{"def-joint-node", new_top_level_inline_form(true)},
|
||||
{"declare-file", new_top_level_inline_form(false)},
|
||||
{"defenum", new_defenum_rule()},
|
||||
{"defmethod", new_defmethod_rule(3)},
|
||||
{"lambda", new_lambda_rule(2)},
|
||||
{"deftype", new_deftype_rule(3, 1, {3, 4, 5, 6})},
|
||||
{"defun", new_flow_rule(3)},
|
||||
{"defun-recursive", new_flow_rule(4)},
|
||||
{"defun-debug-recursive", new_flow_rule(4)},
|
||||
{"defun-debug", new_flow_rule(3)},
|
||||
{"defbehavior", new_flow_rule(4)},
|
||||
{"if", new_permissive_flow_rule()},
|
||||
{"if", new_inlineable_flow_rule(2)},
|
||||
{"#if", new_inlineable_flow_rule(2)},
|
||||
{"define", new_permissive_flow_rule()},
|
||||
{"def-mips2c", new_permissive_flow_rule()},
|
||||
{"defconstant", new_permissive_flow_rule()},
|
||||
{"defglobalconstant", new_permissive_flow_rule()},
|
||||
{"defmethod-mips2c", new_permissive_flow_rule()},
|
||||
{"define-extern", new_permissive_flow_rule()},
|
||||
{"defmacro", new_flow_rule(3)},
|
||||
{"declare-type", new_permissive_flow_rule()},
|
||||
{"defmacro", new_function_rule(3)},
|
||||
{"desfun", new_function_rule(3)},
|
||||
{"defskelgroup", new_flow_rule(2, true)},
|
||||
{"defpartgroup", new_flow_rule(2, true)},
|
||||
{"defpart", new_flow_rule(2, true)},
|
||||
{"defstate", new_defstate_rule(3, true)},
|
||||
{"behavior", new_flow_rule(2)},
|
||||
{"dotimes", new_flow_rule(2)},
|
||||
{"dolist", new_flow_rule(2)},
|
||||
{"process-spawn-function", new_flow_rule(2)},
|
||||
{"let", new_binding_rule(4)},
|
||||
{"protect", new_binding_rule(4)},
|
||||
{"let*", new_binding_rule(5)},
|
||||
{"rlet", new_binding_rule(5)},
|
||||
{"when", new_flow_rule(2)},
|
||||
{"unless", new_flow_rule(2)},
|
||||
{"with-profiler", new_flow_rule(2)},
|
||||
{"with-pc", new_flow_rule(0)},
|
||||
{"#unless", new_flow_rule(2)},
|
||||
{"#when", new_flow_rule(2)},
|
||||
{"countdown", new_flow_rule(2)},
|
||||
{"until", new_flow_rule(2)},
|
||||
{"loop", new_flow_rule(0)},
|
||||
{"while", new_flow_rule(2)},
|
||||
{"begin", new_flow_rule(0)},
|
||||
{"seval", new_flow_rule(0)},
|
||||
{"with-pp", new_flow_rule(0)},
|
||||
{"with-gensyms", new_flow_rule(2)},
|
||||
{"with-vf0", new_flow_rule(0)},
|
||||
{"with-vf", new_inline_binding_rule(8)},
|
||||
{"with-cnt-vif-block", new_inline_binding_rule(19)},
|
||||
{"local-vars", new_inlinable_simple_flow_rule()},
|
||||
{"with-dma-buffer-add-bucket", new_flow_rule(2)}};
|
||||
} // namespace config
|
||||
} // namespace formatter_rules
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
// TODO - some way to apply a config to all list elements (index configs with -1?)
|
||||
namespace formatter_rules {
|
||||
namespace config {
|
||||
struct FormFormattingConfig {
|
||||
@@ -33,9 +32,14 @@ struct FormFormattingConfig {
|
||||
int parent_mutable_extra_indent = 0;
|
||||
std::optional<std::shared_ptr<FormFormattingConfig>> default_index_config;
|
||||
std::unordered_map<int, std::shared_ptr<FormFormattingConfig>> index_configs = {};
|
||||
// TODO / NOTe - not fully implemented, only doing `parent_mutable_extra_indent` right now
|
||||
std::unordered_map<int, std::shared_ptr<FormFormattingConfig>> index_config_override = {};
|
||||
|
||||
bool determine_column_widths_for_list_elements = false;
|
||||
int num_columns_to_compute_widths = 0;
|
||||
std::vector<int> list_element_column_widths = {};
|
||||
|
||||
bool elide_top_level_newline = false;
|
||||
};
|
||||
|
||||
extern const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "common/util/FileUtil.h"
|
||||
#include "common/util/Timer.h"
|
||||
#include "common/util/string_util.h"
|
||||
#include <common/formatter/formatter.h>
|
||||
|
||||
#include "decompiler/IR2/Form.h"
|
||||
#include "decompiler/analysis/analyze_inspect_method.h"
|
||||
@@ -872,9 +873,22 @@ void ObjectFileDB::ir2_write_results(const fs::path& output_dir,
|
||||
auto file_name = output_dir / (obj.to_unique_name() + "_ir2.asm");
|
||||
file_util::write_text_file(file_name, file_text);
|
||||
|
||||
auto final = ir2_final_out(obj, imports, {});
|
||||
auto unformatted_code = ir2_final_out(obj, imports, {});
|
||||
auto final_name = output_dir / (obj.to_unique_name() + "_disasm.gc");
|
||||
file_util::write_text_file(final_name, final);
|
||||
if (config.format_code) {
|
||||
const auto formatted_code = formatter::format_code(unformatted_code);
|
||||
if (!formatted_code) {
|
||||
lg::error(
|
||||
"Was unable to format the decompiled result of {}, make a github issue. Writing "
|
||||
"unformatted code",
|
||||
obj.to_unique_name());
|
||||
file_util::write_text_file(final_name, unformatted_code);
|
||||
} else {
|
||||
file_util::write_text_file(final_name, formatted_code.value());
|
||||
}
|
||||
} else {
|
||||
file_util::write_text_file(final_name, unformatted_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ Config make_config_via_json(nlohmann::json& json) {
|
||||
}
|
||||
config.disassemble_code = json.at("disassemble_code").get<bool>();
|
||||
config.decompile_code = json.at("decompile_code").get<bool>();
|
||||
if (json.contains("format_code")) {
|
||||
config.format_code = json.at("format_code").get<bool>();
|
||||
}
|
||||
config.write_hex_near_instructions = json.at("write_hex_near_instructions").get<bool>();
|
||||
config.write_scripts = json.at("write_scripts").get<bool>();
|
||||
config.disassemble_data = json.at("disassemble_data").get<bool>();
|
||||
|
||||
@@ -111,6 +111,7 @@ struct Config {
|
||||
|
||||
bool disassemble_code = false;
|
||||
bool decompile_code = false;
|
||||
bool format_code = false;
|
||||
bool write_scripts = false;
|
||||
bool disassemble_data = false;
|
||||
bool process_tpages = false;
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
// run the first pass of the decompiler
|
||||
"find_functions": true,
|
||||
|
||||
// will attempt to run the decompiled output through the OpenGOAL formatter
|
||||
// this will be skipped in offline tests
|
||||
"format_code": true,
|
||||
|
||||
////////////////////////////
|
||||
// DATA ANALYSIS OPTIONS
|
||||
////////////////////////////
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
;; jak 1 - specific library stuff.
|
||||
|
||||
(defmacro __get_jak1_full_game () *jak1-full-game*)
|
||||
(defmacro __get_jak1_full_game ()
|
||||
*jak1-full-game*)
|
||||
|
||||
(defconstant *jak1-full-game* (__get_jak1_full_game))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -20,26 +22,21 @@
|
||||
|
||||
(defmacro basic? (obj)
|
||||
;; todo, make this more efficient
|
||||
`(= 4 (logand (the integer ,obj) #b111))
|
||||
)
|
||||
`(= 4 (logand (the integer ,obj) #b111)))
|
||||
|
||||
(defmacro pair? (obj)
|
||||
;; todo, make this more efficient
|
||||
;`(= 2 (logand (the integer ,obj) #b111))
|
||||
`(< (shl (the-as int ,obj) 62) 0)
|
||||
)
|
||||
`(< (shl (the-as int ,obj) 62) 0))
|
||||
|
||||
(defmacro not-pair? (obj)
|
||||
`(>= (shl (the-as int ,obj) 62) 0)
|
||||
)
|
||||
`(>= (shl (the-as int ,obj) 62) 0))
|
||||
|
||||
(defmacro binteger? (obj)
|
||||
`(zero? (logand (the integer ,obj) #b111))
|
||||
)
|
||||
`(zero? (logand (the integer ,obj) #b111)))
|
||||
|
||||
(defmacro rtype-of (obj)
|
||||
`(cond ((binteger? ,obj) binteger)
|
||||
((pair? ,obj) pair)
|
||||
(else (-> (the basic ,obj) type))
|
||||
)
|
||||
)
|
||||
`(cond
|
||||
((binteger? ,obj) binteger)
|
||||
((pair? ,obj) pair)
|
||||
(else (-> (the basic ,obj) type))))
|
||||
@@ -1,14 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/draw/drawable-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
|
||||
;; name: aligner-h.gc
|
||||
;; name in dgo: aligner-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defenum align-flags
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
@@ -18,53 +12,46 @@
|
||||
(defenum align-opts
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
(adjust-x-vel) ;; adjust x
|
||||
(adjust-y-vel) ;; adjust y
|
||||
(adjust-x-vel) ;; adjust x
|
||||
(adjust-y-vel) ;; adjust y
|
||||
(adjust-xz-vel) ;; adjust both x and z. (don't set this with adjust-x)
|
||||
(keep-other-velocities) ;; if set, keep xz plane velocities if their alignment isn't requested
|
||||
(adjust-quat) ;; adjust the orientation
|
||||
(adjust-quat) ;; adjust the orientation
|
||||
(alop0)
|
||||
(alop1)
|
||||
(alop2)
|
||||
(alop3)
|
||||
(alop4)
|
||||
(alop5)
|
||||
(no-gravity) ;; do not apply any gravity
|
||||
(no-gravity) ;; do not apply any gravity
|
||||
(ignore-y-if-zero) ;; if set and the alignment velocity is 0 in y, don't apply it.
|
||||
)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype align-control (basic)
|
||||
((flags align-flags)
|
||||
(process process-drawable)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(matrix matrix 2 :inline)
|
||||
(transform transform 2 :inline)
|
||||
(delta transformq :inline)
|
||||
(last-speed meters)
|
||||
(align transformq :inline :overlay-at (-> transform 0 trans x))
|
||||
)
|
||||
((flags align-flags)
|
||||
(process process-drawable)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(matrix matrix 2 :inline)
|
||||
(transform transform 2 :inline)
|
||||
(delta transformq :inline)
|
||||
(last-speed meters)
|
||||
(align transformq :inline :overlay-at (-> transform 0 trans x)))
|
||||
(:methods
|
||||
(new (symbol type process-drawable) _type_)
|
||||
(compute-alignment! (_type_) transformq)
|
||||
(align! (_type_ align-opts float float float) trsqv)
|
||||
(align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv)
|
||||
(first-transform (_type_) transform)
|
||||
(snd-transform (_type_) transform)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type process-drawable) _type_)
|
||||
(compute-alignment! (_type_) transformq)
|
||||
(align! (_type_ align-opts float float float) trsqv)
|
||||
(align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv)
|
||||
(first-transform (_type_) transform)
|
||||
(snd-transform (_type_) transform)))
|
||||
|
||||
(defmethod new align-control ((allocation symbol) (type-to-make type) (proc process-drawable))
|
||||
"Create a new align-control."
|
||||
(let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(when (zero? this)
|
||||
(go process-drawable-art-error "memory")
|
||||
(return (the align-control 0))
|
||||
)
|
||||
(return (the align-control 0)))
|
||||
(set! (-> this process) proc)
|
||||
this
|
||||
)
|
||||
)
|
||||
this))
|
||||
@@ -1,14 +1,9 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/anim/aligner-h.gc")
|
||||
(require "engine/common-obs/process-drawable.gc")
|
||||
|
||||
;; name: aligner.gc
|
||||
;; name in dgo: aligner
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
||||
@@ -22,46 +17,26 @@
|
||||
(v1-5 (-> a0-3 frame-group))
|
||||
(a0-4 (-> a0-3 command))
|
||||
(a1-0 'stack)
|
||||
(a2-0 (= a0-4 a1-0))
|
||||
)
|
||||
(a2-0 (= a0-4 a1-0)))
|
||||
(cond
|
||||
((or a2-0 (begin (set! a1-0 'stack1) (= a0-4 a1-0)))
|
||||
)
|
||||
((or a2-0 (begin (set! a1-0 'stack1) (= a0-4 a1-0))))
|
||||
(else
|
||||
(when (!= (-> v1-5 type) art-joint-anim)
|
||||
;; og:preserve-this
|
||||
(go process-drawable-art-error "align joint-anim")
|
||||
(abandon-thread)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (!= (-> v1-5 type) art-joint-anim)
|
||||
;; og:preserve-this
|
||||
(go process-drawable-art-error "align joint-anim")
|
||||
(abandon-thread)
|
||||
0))))))
|
||||
(let* ((a0-8 (-> this process skel root-channel 0))
|
||||
(v1-16 (-> a0-8 frame-group))
|
||||
(f0-0 (-> a0-8 frame-num))
|
||||
)
|
||||
(f0-0 (-> a0-8 frame-num)))
|
||||
(= (-> a0-8 num-func) num-func-loop!)
|
||||
(cond
|
||||
((or (not v1-16) (!= (-> this frame-group) v1-16))
|
||||
(set! a0-9 #t)
|
||||
)
|
||||
((= (-> a0-8 num-func) num-func-loop!)
|
||||
(set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> this frame-num))) 0.0))
|
||||
)
|
||||
(else
|
||||
(set! a0-9 (= f0-0 0.0))
|
||||
)
|
||||
)
|
||||
(if a0-9
|
||||
(logior! (-> this flags) (align-flags disabled))
|
||||
(logclear! (-> this flags) (align-flags disabled))
|
||||
)
|
||||
((or (not v1-16) (!= (-> this frame-group) v1-16)) (set! a0-9 #t))
|
||||
((= (-> a0-8 num-func) num-func-loop!) (set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> this frame-num))) 0.0)))
|
||||
(else (set! a0-9 (= f0-0 0.0))))
|
||||
(if a0-9 (logior! (-> this flags) (align-flags disabled)) (logclear! (-> this flags) (align-flags disabled)))
|
||||
(set! (-> this frame-group) v1-16)
|
||||
(set! (-> this frame-num) f0-0)
|
||||
)
|
||||
(set! (-> this frame-num) f0-0))
|
||||
(mem-copy! (the-as pointer (-> this transform 1)) (the-as pointer (-> this transform)) 48)
|
||||
(quaternion-copy! (the-as quaternion (-> this transform 1 rot)) (-> this align quat))
|
||||
(set! (-> this transform 1 scale quad) (-> this align scale quad))
|
||||
@@ -70,13 +45,11 @@
|
||||
(v1-19 (-> a3-0 0 vector 0 quad))
|
||||
(a0-18 (-> a3-0 0 vector 1 quad))
|
||||
(a1-12 (-> a3-0 0 vector 2 quad))
|
||||
(a3-1 (-> a3-0 0 vector 3 quad))
|
||||
)
|
||||
(a3-1 (-> a3-0 0 vector 3 quad)))
|
||||
(set! (-> a2-5 0 quad) v1-19)
|
||||
(set! (-> a2-5 1 quad) a0-18)
|
||||
(set! (-> a2-5 2 quad) a1-12)
|
||||
(set! (-> a2-5 3 quad) a3-1)
|
||||
)
|
||||
(set! (-> a2-5 3 quad) a3-1))
|
||||
(let ((s5-1 (-> this process node-list data 1)))
|
||||
(cspace<-matrix-no-push-joint! s5-1 (-> this process skel))
|
||||
(let* ((v1-23 (-> this matrix))
|
||||
@@ -84,104 +57,65 @@
|
||||
(a0-21 (-> a3-2 vector 0 quad))
|
||||
(a1-14 (-> a3-2 vector 1 quad))
|
||||
(a2-6 (-> a3-2 vector 2 quad))
|
||||
(a3-3 (-> a3-2 vector 3 quad))
|
||||
)
|
||||
(a3-3 (-> a3-2 vector 3 quad)))
|
||||
(set! (-> v1-23 0 vector 0 quad) a0-21)
|
||||
(set! (-> v1-23 0 vector 1 quad) a1-14)
|
||||
(set! (-> v1-23 0 vector 2 quad) a2-6)
|
||||
(set! (-> v1-23 0 vector 3 quad) a3-3)
|
||||
)
|
||||
(vector*! (the-as vector (-> this transform)) (-> s5-1 bone transform vector 3) (-> this process root scale))
|
||||
)
|
||||
(vector-!
|
||||
(the-as vector (-> this delta))
|
||||
(the-as vector (-> this transform))
|
||||
(the-as vector (-> this transform 1))
|
||||
)
|
||||
(set-vector!
|
||||
(-> this align scale)
|
||||
(vector-length (the-as vector (-> this matrix)))
|
||||
(vector-length (-> this matrix 0 vector 1))
|
||||
(vector-length (-> this matrix 0 vector 2))
|
||||
1.0
|
||||
)
|
||||
(set! (-> v1-23 0 vector 3 quad) a3-3))
|
||||
(vector*! (the-as vector (-> this transform)) (-> s5-1 bone transform vector 3) (-> this process root scale)))
|
||||
(vector-! (the-as vector (-> this delta)) (the-as vector (-> this transform)) (the-as vector (-> this transform 1)))
|
||||
(set-vector! (-> this align scale)
|
||||
(vector-length (the-as vector (-> this matrix)))
|
||||
(vector-length (-> this matrix 0 vector 1))
|
||||
(vector-length (-> this matrix 0 vector 2))
|
||||
1.0)
|
||||
(vector-! (-> this delta scale) (-> this align scale) (-> this transform 1 scale))
|
||||
(let ((a2-8 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> this align scale))))
|
||||
(quaternion-normalize!
|
||||
(matrix->quaternion (-> this align quat) (matrix*! a2-8 (the-as matrix (-> this matrix)) a2-8))
|
||||
)
|
||||
)
|
||||
(let ((a1-24 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot))))
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! (-> this delta quat) a1-24 (-> this align quat)))
|
||||
)
|
||||
(-> this delta)
|
||||
)
|
||||
)
|
||||
(quaternion-normalize! (matrix->quaternion (-> this align quat) (matrix*! a2-8 (the-as matrix (-> this matrix)) a2-8))))
|
||||
(let ((a1-24 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot)))))
|
||||
(quaternion-normalize! (quaternion*! (-> this delta quat) a1-24 (-> this align quat))))
|
||||
(-> this delta)))
|
||||
|
||||
(defmethod first-transform ((this align-control))
|
||||
(the-as transform (-> this transform))
|
||||
)
|
||||
(the-as transform (-> this transform)))
|
||||
|
||||
(defmethod snd-transform ((this align-control))
|
||||
(-> this transform 1)
|
||||
)
|
||||
(-> this transform 1))
|
||||
|
||||
(defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float))
|
||||
(when (not (logtest? (-> this flags) (align-flags disabled)))
|
||||
(let* ((a0-1 (-> this process))
|
||||
(t9-0 (method-of-object a0-1 apply-alignment))
|
||||
(v1-4 (-> this delta))
|
||||
(t1-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(t1-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> t1-0 x) arg1)
|
||||
(set! (-> t1-0 y) arg2)
|
||||
(set! (-> t1-0 z) arg3)
|
||||
(set! (-> t1-0 w) 1.0)
|
||||
(t9-0 a0-1 arg0 v1-4 t1-0)
|
||||
)
|
||||
)
|
||||
(-> this process root)
|
||||
)
|
||||
(t9-0 a0-1 arg0 v1-4 t1-0)))
|
||||
(-> this process root))
|
||||
|
||||
(defmethod set-and-limit-velocity ((this trsqv) (arg0 int) (arg1 vector) (arg2 float))
|
||||
(let ((gp-0 (-> this transv)))
|
||||
(when (logtest? arg0 4)
|
||||
(set! (-> gp-0 x) (-> arg1 x))
|
||||
(set! (-> gp-0 z) (-> arg1 z))
|
||||
(let ((f0-4 (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2)))
|
||||
(vector-xz-normalize! gp-0 f0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
(let ((f0-4 (fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2))) (vector-xz-normalize! gp-0 f0-4))))
|
||||
this)
|
||||
|
||||
(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float))
|
||||
(when (not (logtest? (-> this flags) (align-flags disabled)))
|
||||
(let ((s5-0 (-> this delta)))
|
||||
(let ((s3-0 (-> this process root transv)))
|
||||
(if (logtest? arg0 (align-opts adjust-y-vel))
|
||||
(set! (-> s3-0 y) (* (-> s5-0 trans y) arg3 (-> *display* frames-per-second)))
|
||||
)
|
||||
(set! (-> s3-0 y) (* (-> s5-0 trans y) arg3 (-> *display* frames-per-second))))
|
||||
(when (logtest? arg0 (align-opts adjust-xz-vel))
|
||||
(set! (-> s3-0 x) (-> arg1 x))
|
||||
(set! (-> s3-0 z) (-> arg1 z))
|
||||
(let ((f0-8 (* (fmin (vector-xz-length arg1) (* (vector-xz-length (-> s5-0 trans)) arg4))
|
||||
(-> *display* frames-per-second)
|
||||
)
|
||||
)
|
||||
(t9-2 vector-xz-normalize!)
|
||||
)
|
||||
(let ((f0-8 (* (fmin (vector-xz-length arg1) (* (vector-xz-length (-> s5-0 trans)) arg4)) (-> *display* frames-per-second)))
|
||||
(t9-2 vector-xz-normalize!))
|
||||
(set! (-> this last-speed) f0-8)
|
||||
(t9-2 s3-0 f0-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-2 s3-0 f0-8))))
|
||||
(if (logtest? arg0 (align-opts adjust-quat))
|
||||
(quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> this process root)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat))))))
|
||||
(-> this process root))
|
||||
@@ -1,250 +1,165 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/collide/collide-cache.gc")
|
||||
(require "engine/common-obs/process-drawable.gc")
|
||||
|
||||
;; name: joint-exploder.gc
|
||||
;; name in dgo: joint-exploder
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype joint-exploder-tuning (structure)
|
||||
((explosion uint64)
|
||||
(duration time-frame)
|
||||
(gravity float)
|
||||
(rot-speed float)
|
||||
(fountain-rand-transv-lo vector :inline)
|
||||
(fountain-rand-transv-hi vector :inline)
|
||||
(away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo)
|
||||
(away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi x))
|
||||
(away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi y))
|
||||
(away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi z))
|
||||
(away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi w))
|
||||
)
|
||||
((explosion uint64)
|
||||
(duration time-frame)
|
||||
(gravity float)
|
||||
(rot-speed float)
|
||||
(fountain-rand-transv-lo vector :inline)
|
||||
(fountain-rand-transv-hi vector :inline)
|
||||
(away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo)
|
||||
(away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi x))
|
||||
(away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi y))
|
||||
(away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi z))
|
||||
(away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi w)))
|
||||
(:methods
|
||||
(new (symbol type int) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type int) _type_)))
|
||||
|
||||
(deftype joint-exploder-static-joint-params (structure)
|
||||
((joint-index int16)
|
||||
(parent-joint-index int16)
|
||||
)
|
||||
)
|
||||
|
||||
((joint-index int16)
|
||||
(parent-joint-index int16)))
|
||||
|
||||
(deftype joint-exploder-static-params (basic)
|
||||
((joints (array joint-exploder-static-joint-params))
|
||||
)
|
||||
)
|
||||
|
||||
((joints (array joint-exploder-static-joint-params))))
|
||||
|
||||
(deftype joint-exploder-joint (structure)
|
||||
((next int16)
|
||||
(prev int16)
|
||||
(joint-index int16)
|
||||
(rspeed float)
|
||||
(mat matrix :inline)
|
||||
(rmat matrix :inline)
|
||||
(transv vector :inline)
|
||||
(prev-pos vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((next int16)
|
||||
(prev int16)
|
||||
(joint-index int16)
|
||||
(rspeed float)
|
||||
(mat matrix :inline)
|
||||
(rmat matrix :inline)
|
||||
(transv vector :inline)
|
||||
(prev-pos vector :inline)))
|
||||
|
||||
(deftype joint-exploder-joints (basic)
|
||||
((num-joints int32)
|
||||
(joint joint-exploder-joint :inline :dynamic :offset 16)
|
||||
)
|
||||
((num-joints int32)
|
||||
(joint joint-exploder-joint :inline :dynamic :offset 16))
|
||||
(:methods
|
||||
(new (symbol type joint-exploder-static-params) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type joint-exploder-static-params) _type_)))
|
||||
|
||||
(deftype joint-exploder-list (structure)
|
||||
((head int32)
|
||||
(pre-moved? symbol)
|
||||
(bbox-valid? symbol)
|
||||
(bbox bounding-box :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((head int32)
|
||||
(pre-moved? symbol)
|
||||
(bbox-valid? symbol)
|
||||
(bbox bounding-box :inline)))
|
||||
|
||||
(deftype joint-exploder (process-drawable)
|
||||
((parent-override (pointer process-drawable) :overlay-at parent)
|
||||
(die-if-below-y float)
|
||||
(die-if-beyond-xz-dist-sqrd float)
|
||||
(joints joint-exploder-joints)
|
||||
(static-params joint-exploder-static-params)
|
||||
(anim art-joint-anim)
|
||||
(scale-vector vector :inline)
|
||||
(tuning joint-exploder-tuning :inline)
|
||||
(lists joint-exploder-list 5 :inline)
|
||||
)
|
||||
((parent-override (pointer process-drawable) :overlay-at parent)
|
||||
(die-if-below-y float)
|
||||
(die-if-beyond-xz-dist-sqrd float)
|
||||
(joints joint-exploder-joints)
|
||||
(static-params joint-exploder-static-params)
|
||||
(anim art-joint-anim)
|
||||
(scale-vector vector :inline)
|
||||
(tuning joint-exploder-tuning :inline)
|
||||
(lists joint-exploder-list 5 :inline))
|
||||
(:methods
|
||||
(joint-exploder-method-20 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-21 (_type_ joint-exploder-list joint-exploder-joint) none)
|
||||
(joint-exploder-method-22 (_type_ joint-exploder-list) symbol)
|
||||
(joint-exploder-method-23 (_type_) symbol)
|
||||
(joint-exploder-method-24 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-25 (_type_ joint-exploder-list) symbol)
|
||||
(joint-exploder-method-26 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-27 (_type_ joint-exploder-list int) joint-exploder-list)
|
||||
(joint-exploder-method-28 (_type_ joint-exploder-list) none)
|
||||
)
|
||||
(joint-exploder-method-20 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-21 (_type_ joint-exploder-list joint-exploder-joint) none)
|
||||
(joint-exploder-method-22 (_type_ joint-exploder-list) symbol)
|
||||
(joint-exploder-method-23 (_type_) symbol)
|
||||
(joint-exploder-method-24 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-25 (_type_ joint-exploder-list) symbol)
|
||||
(joint-exploder-method-26 (_type_ joint-exploder-list int) int)
|
||||
(joint-exploder-method-27 (_type_ joint-exploder-list int) joint-exploder-list)
|
||||
(joint-exploder-method-28 (_type_ joint-exploder-list) none))
|
||||
(:states
|
||||
joint-exploder-shatter
|
||||
)
|
||||
)
|
||||
|
||||
joint-exploder-shatter))
|
||||
|
||||
(defmethod asize-of ((this joint-exploder-joints))
|
||||
(the-as int (+ (-> this type size) (* 176 (-> this num-joints))))
|
||||
)
|
||||
(the-as int (+ (-> this type size) (* 176 (-> this num-joints)))))
|
||||
|
||||
(defmethod new joint-exploder-joints ((allocation symbol) (type-to-make type) (arg0 joint-exploder-static-params))
|
||||
(let* ((gp-0 (-> arg0 joints length))
|
||||
(v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 176 gp-0)))))
|
||||
)
|
||||
(v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 176 gp-0))))))
|
||||
(set! (-> v0-0 num-joints) gp-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
v0-0))
|
||||
|
||||
(defun joint-exploder-joint-callback ((arg0 joint-exploder))
|
||||
(let ((gp-0 (-> arg0 node-list)))
|
||||
(let ((s4-0 (-> arg0 joints)))
|
||||
(countdown (s3-0 (-> s4-0 num-joints))
|
||||
(let* ((v1-3 (-> s4-0 joint s3-0))
|
||||
(a0-5 (-> gp-0 data (-> v1-3 joint-index) bone transform))
|
||||
)
|
||||
(matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat))
|
||||
)
|
||||
)
|
||||
)
|
||||
(a0-5 (-> gp-0 data (-> v1-3 joint-index) bone transform)))
|
||||
(matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat)))))
|
||||
(let ((s5-1 (-> arg0 scale-vector)))
|
||||
(countdown (s4-1 (-> gp-0 length))
|
||||
(let ((a2-1 (-> gp-0 data s4-1 bone transform)))
|
||||
(scale-matrix! a2-1 s5-1 a2-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a2-1 (-> gp-0 data s4-1 bone transform))) (scale-matrix! a2-1 s5-1 a2-1)))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod joint-exploder-method-24 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
|
||||
(let ((v0-0 (joint-exploder-method-26 this arg0 arg1)))
|
||||
(let* ((v1-1 (-> this joints))
|
||||
(v1-2 (-> v1-1 joint arg1))
|
||||
)
|
||||
(v1-2 (-> v1-1 joint arg1)))
|
||||
(set! (-> v1-2 mat vector 0 quad) (the-as uint128 0))
|
||||
(set! (-> v1-2 mat vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> v1-2 mat vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> v1-2 mat vector 3 quad) (-> this root trans quad))
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(set! (-> v1-2 mat vector 3 quad) (-> this root trans quad)))
|
||||
v0-0))
|
||||
|
||||
(defmethod joint-exploder-method-26 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
|
||||
(let* ((v1-0 (-> this joints))
|
||||
(a2-1 (-> v1-0 joint arg1))
|
||||
(a0-4 (-> a2-1 prev))
|
||||
(v0-0 (-> a2-1 next))
|
||||
)
|
||||
(v0-0 (-> a2-1 next)))
|
||||
(cond
|
||||
((>= a0-4 0)
|
||||
(set! (-> v1-0 joint a0-4 next) v0-0)
|
||||
(if (>= v0-0 0)
|
||||
(set! (-> (the-as joint-exploder-joint (-> v1-0 joint v0-0)) prev) a0-4)
|
||||
)
|
||||
)
|
||||
(if (>= v0-0 0) (set! (-> (the-as joint-exploder-joint (-> v1-0 joint v0-0)) prev) a0-4)))
|
||||
(else
|
||||
(set! (-> arg0 head) v0-0)
|
||||
(cond
|
||||
((>= v0-0 0)
|
||||
(let ((v1-2 (-> v1-0 joint v0-0)))
|
||||
(set! (-> v1-2 prev) -1)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> arg0 bbox-valid?) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 head) v0-0)
|
||||
(cond
|
||||
((>= v0-0 0) (let ((v1-2 (-> v1-0 joint v0-0))) (set! (-> v1-2 prev) -1)))
|
||||
(else (set! (-> arg0 bbox-valid?) #f)))))
|
||||
v0-0))
|
||||
|
||||
(defmethod joint-exploder-method-20 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
|
||||
(let* ((v1-0 (-> this joints))
|
||||
(a3-0 (-> v1-0 joint arg1))
|
||||
(a0-4 (-> arg0 head))
|
||||
)
|
||||
(a0-4 (-> arg0 head)))
|
||||
(set! (-> arg0 head) arg1)
|
||||
(set! (-> a3-0 prev) -1)
|
||||
(set! (-> a3-0 next) a0-4)
|
||||
(when (>= a0-4 0)
|
||||
(set! (-> (the-as joint-exploder-joint (-> v1-0 joint a0-4)) prev) arg1)
|
||||
arg1
|
||||
)
|
||||
)
|
||||
)
|
||||
arg1)))
|
||||
|
||||
(defmethod joint-exploder-method-21 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint))
|
||||
(let ((a1-1 (-> arg1 mat vector 3)))
|
||||
(cond
|
||||
((-> arg0 bbox-valid?)
|
||||
(add-point! (-> arg0 bbox) (the-as vector3s a1-1))
|
||||
)
|
||||
((-> arg0 bbox-valid?) (add-point! (-> arg0 bbox) (the-as vector3s a1-1)))
|
||||
(else
|
||||
(set! (-> arg0 bbox-valid?) #t)
|
||||
(set! (-> arg0 bbox min quad) (-> a1-1 quad))
|
||||
(set! (-> arg0 bbox max quad) (-> a1-1 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 bbox-valid?) #t)
|
||||
(set! (-> arg0 bbox min quad) (-> a1-1 quad))
|
||||
(set! (-> arg0 bbox max quad) (-> a1-1 quad)))))
|
||||
(add-point! (-> arg0 bbox) (the-as vector3s (-> arg1 prev-pos)))
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
|
||||
(local-vars (sv-16 int) (sv-32 int) (sv-48 int))
|
||||
(let ((s4-0 (the-as joint-exploder-list #f)))
|
||||
(let ((v1-0 1))
|
||||
(until (= v1-0 5)
|
||||
(let ((a0-4 (-> this lists v1-0)))
|
||||
(when (< (-> a0-4 head) 0)
|
||||
(set! s4-0 a0-4)
|
||||
(goto cfg-6)
|
||||
)
|
||||
)
|
||||
(+! v1-0 1)
|
||||
)
|
||||
)
|
||||
(let ((a0-4 (-> this lists v1-0))) (when (< (-> a0-4 head) 0) (set! s4-0 a0-4) (goto cfg-6)))
|
||||
(+! v1-0 1)))
|
||||
(label cfg-6)
|
||||
(let ((s3-0 (the-as object s4-0)))
|
||||
(cond
|
||||
((the-as joint-exploder-list s3-0)
|
||||
(set! (-> (the-as joint-exploder-list s3-0) pre-moved?) #t)
|
||||
(set! (-> (the-as joint-exploder-list s3-0) bbox-valid?) #f)
|
||||
)
|
||||
(else
|
||||
(set! s3-0 (-> this lists))
|
||||
)
|
||||
)
|
||||
(set! (-> (the-as joint-exploder-list s3-0) bbox-valid?) #f))
|
||||
(else (set! s3-0 (-> this lists))))
|
||||
(set! (-> arg0 bbox-valid?) #f)
|
||||
(let ((s2-0 (-> this joints))
|
||||
(s1-0 (-> arg0 head))
|
||||
)
|
||||
(s1-0 (-> arg0 head)))
|
||||
(cond
|
||||
((zero? arg1)
|
||||
(let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x)))))
|
||||
@@ -255,17 +170,8 @@
|
||||
(set! sv-16 (joint-exploder-method-26 this arg0 s1-0))
|
||||
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
|
||||
(set! s1-0 sv-16)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0)
|
||||
)
|
||||
(else
|
||||
(joint-exploder-method-21 this arg0 s0-0)
|
||||
(set! s1-0 (-> s0-0 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0))
|
||||
(else (joint-exploder-method-21 this arg0 s0-0) (set! s1-0 (-> s0-0 next))))))))
|
||||
((= arg1 1)
|
||||
(let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y)))))
|
||||
(while (>= s1-0 0)
|
||||
@@ -275,17 +181,8 @@
|
||||
(set! sv-32 (joint-exploder-method-26 this arg0 s1-0))
|
||||
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
|
||||
(set! s1-0 sv-32)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1)
|
||||
)
|
||||
(else
|
||||
(joint-exploder-method-21 this arg0 s0-1)
|
||||
(set! s1-0 (-> s0-1 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1))
|
||||
(else (joint-exploder-method-21 this arg0 s0-1) (set! s1-0 (-> s0-1 next))))))))
|
||||
((= arg1 2)
|
||||
(let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z)))))
|
||||
(while (>= s1-0 0)
|
||||
@@ -295,67 +192,33 @@
|
||||
(set! sv-48 (joint-exploder-method-26 this arg0 s1-0))
|
||||
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
|
||||
(set! s1-0 sv-48)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2)
|
||||
)
|
||||
(else
|
||||
(joint-exploder-method-21 this arg0 s0-2)
|
||||
(set! s1-0 (-> s0-2 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
s4-0
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2))
|
||||
(else (joint-exploder-method-21 this arg0 s0-2) (set! s1-0 (-> s0-2 next)))))))))))
|
||||
s4-0))
|
||||
|
||||
(defmethod joint-exploder-method-28 ((this joint-exploder) (arg0 joint-exploder-list))
|
||||
(when (and (-> arg0 bbox-valid?) (>= (-> arg0 head) 0))
|
||||
(cond
|
||||
((< 20480.0 (- (-> arg0 bbox max x) (-> arg0 bbox min x)))
|
||||
(let ((a1-2 (joint-exploder-method-27 this arg0 0)))
|
||||
(if a1-2
|
||||
(joint-exploder-method-28 this a1-2)
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-28 this arg0)
|
||||
)
|
||||
(let ((a1-2 (joint-exploder-method-27 this arg0 0))) (if a1-2 (joint-exploder-method-28 this a1-2)))
|
||||
(joint-exploder-method-28 this arg0))
|
||||
((< 20480.0 (- (-> arg0 bbox max y) (-> arg0 bbox min y)))
|
||||
(let ((a1-5 (joint-exploder-method-27 this arg0 1)))
|
||||
(if a1-5
|
||||
(joint-exploder-method-28 this a1-5)
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-28 this arg0)
|
||||
)
|
||||
(let ((a1-5 (joint-exploder-method-27 this arg0 1))) (if a1-5 (joint-exploder-method-28 this a1-5)))
|
||||
(joint-exploder-method-28 this arg0))
|
||||
((< 20480.0 (- (-> arg0 bbox max z) (-> arg0 bbox min z)))
|
||||
(let ((a1-8 (joint-exploder-method-27 this arg0 2)))
|
||||
(if a1-8
|
||||
(joint-exploder-method-28 this a1-8)
|
||||
)
|
||||
)
|
||||
(joint-exploder-method-28 this arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(let ((a1-8 (joint-exploder-method-27 this arg0 2))) (if a1-8 (joint-exploder-method-28 this a1-8)))
|
||||
(joint-exploder-method-28 this arg0))))
|
||||
(none))
|
||||
|
||||
(defmethod joint-exploder-method-25 ((this joint-exploder) (arg0 joint-exploder-list))
|
||||
(set! (-> arg0 bbox-valid?) #f)
|
||||
(set! (-> arg0 pre-moved?) #t)
|
||||
(let ((s4-0 (-> this joints))
|
||||
(f30-0 (* (-> this tuning gravity) (seconds-per-frame)))
|
||||
(s3-0 (-> arg0 head))
|
||||
)
|
||||
(s3-0 (-> arg0 head)))
|
||||
(while (>= s3-0 0)
|
||||
(let* ((s2-0 (-> s4-0 joint s3-0))
|
||||
(s1-0 (-> s2-0 mat vector 3))
|
||||
)
|
||||
(s1-0 (-> s2-0 mat vector 3)))
|
||||
(set! (-> s2-0 prev-pos quad) (-> s1-0 quad))
|
||||
(+! (-> s2-0 transv y) f30-0)
|
||||
(vector-v+! s1-0 s1-0 (-> s2-0 transv))
|
||||
@@ -364,156 +227,101 @@
|
||||
(f5-0 (-> s2-0 rmat vector 0 x))
|
||||
(f4-0 (-> s2-0 rmat vector 0 y))
|
||||
(f3-0 (-> s2-0 rmat vector 1 x))
|
||||
(f1-2 (-> s2-0 rmat vector 1 y))
|
||||
)
|
||||
(f1-2 (-> s2-0 rmat vector 1 y)))
|
||||
(set! (-> s2-0 rmat vector 0 x) (- (* f5-0 f0-3) (* f4-0 f2-1)))
|
||||
(set! (-> s2-0 rmat vector 0 y) (+ (* f5-0 f2-1) (* f4-0 f0-3)))
|
||||
(set! (-> s2-0 rmat vector 1 x) (- (* f3-0 f0-3) (* f1-2 f2-1)))
|
||||
(set! (-> s2-0 rmat vector 1 y) (+ (* f3-0 f2-1) (* f1-2 f0-3)))
|
||||
)
|
||||
(set! (-> s2-0 rmat vector 1 y) (+ (* f3-0 f2-1) (* f1-2 f0-3))))
|
||||
(cond
|
||||
((or (< (-> s1-0 y) (-> this die-if-below-y))
|
||||
(< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans)))
|
||||
)
|
||||
(set! s3-0 (joint-exploder-method-24 this arg0 s3-0))
|
||||
)
|
||||
(else
|
||||
(joint-exploder-method-21 this arg0 s2-0)
|
||||
(set! s3-0 (-> s2-0 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
(< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))))
|
||||
(set! s3-0 (joint-exploder-method-24 this arg0 s3-0)))
|
||||
(else (joint-exploder-method-21 this arg0 s2-0) (set! s3-0 (-> s2-0 next)))))))
|
||||
#f)
|
||||
|
||||
(defmethod joint-exploder-method-22 ((this joint-exploder) (arg0 joint-exploder-list))
|
||||
(fill-using-bounding-box
|
||||
*collide-cache*
|
||||
(-> arg0 bbox)
|
||||
(collide-kind background)
|
||||
this
|
||||
(new 'static 'pat-surface :noentity #x1)
|
||||
)
|
||||
(fill-using-bounding-box *collide-cache*
|
||||
(-> arg0 bbox)
|
||||
(collide-kind background)
|
||||
this
|
||||
(new 'static 'pat-surface :noentity #x1))
|
||||
(let ((gp-1 (-> this joints))
|
||||
(v1-2 (-> arg0 head))
|
||||
)
|
||||
(v1-2 (-> arg0 head)))
|
||||
(while (>= v1-2 0)
|
||||
(let ((s5-1 (-> gp-1 joint v1-2)))
|
||||
(let ((s4-0 (-> s5-1 mat vector 3))
|
||||
(a2-1 (new 'stack-no-clear 'vector))
|
||||
(s3-0 (new 'stack-no-clear 'collide-tri-result))
|
||||
)
|
||||
(s3-0 (new 'stack-no-clear 'collide-tri-result)))
|
||||
(vector-! a2-1 s4-0 (-> s5-1 prev-pos))
|
||||
(when (>= (probe-using-line-sphere
|
||||
*collide-cache*
|
||||
(-> s5-1 prev-pos)
|
||||
a2-1
|
||||
40.96
|
||||
(collide-kind background)
|
||||
s3-0
|
||||
(new 'static 'pat-surface :noentity #x1)
|
||||
)
|
||||
0.0
|
||||
)
|
||||
(when (>= (probe-using-line-sphere *collide-cache*
|
||||
(-> s5-1 prev-pos)
|
||||
a2-1
|
||||
40.96
|
||||
(collide-kind background)
|
||||
s3-0
|
||||
(new 'static 'pat-surface :noentity #x1))
|
||||
0.0)
|
||||
(set! (-> s4-0 quad) (-> s3-0 intersect quad))
|
||||
(let ((f28-0 (vector-xz-length (-> s5-1 transv))))
|
||||
(vector-reflect! (-> s5-1 transv) (-> s5-1 transv) (-> s3-0 normal))
|
||||
(let ((f30-0 (-> s5-1 transv y)))
|
||||
(set! (-> s5-1 transv y) 0.0)
|
||||
(vector-normalize! (-> s5-1 transv) (* 0.75 f28-0))
|
||||
(set! (-> s5-1 transv y) (* 0.7 f30-0))
|
||||
)
|
||||
)
|
||||
(set! (-> s5-1 transv y) (* 0.7 f30-0))))
|
||||
(+! (-> s4-0 y) (* 40.96 (-> s3-0 normal y)))
|
||||
(set! (-> s4-0 w) 1.0)
|
||||
(set! (-> s5-1 rspeed) (* 0.5 (-> s5-1 rspeed)))
|
||||
)
|
||||
)
|
||||
(set! v1-2 (-> s5-1 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
(set! (-> s5-1 rspeed) (* 0.5 (-> s5-1 rspeed)))))
|
||||
(set! v1-2 (-> s5-1 next)))))
|
||||
#f)
|
||||
|
||||
(defstate joint-exploder-shatter (joint-exploder)
|
||||
:enter (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
)
|
||||
:trans (behavior ()
|
||||
(let* ((f1-0 (the float (- (current-time) (-> self state-time))))
|
||||
(f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration)))))
|
||||
(f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration))))))
|
||||
)
|
||||
(if (< f1-2 0.0)
|
||||
(set! f1-2 0.0)
|
||||
)
|
||||
(set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0)
|
||||
)
|
||||
(dotimes (v1-8 5)
|
||||
(set! (-> self lists v1-8 pre-moved?) #f)
|
||||
)
|
||||
(dotimes (gp-0 5)
|
||||
(let ((s5-0 (-> self lists gp-0)))
|
||||
(when (>= (-> s5-0 head) 0)
|
||||
(when (not (-> s5-0 pre-moved?))
|
||||
(joint-exploder-method-25 self s5-0)
|
||||
(if (nonzero? gp-0)
|
||||
(joint-exploder-method-28 self s5-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((gp-1 (new 'stack-no-clear 'bounding-box)))
|
||||
(let ((v1-26 (-> self root trans)))
|
||||
(set! (-> gp-1 min quad) (-> v1-26 quad))
|
||||
(set! (-> gp-1 max quad) (-> v1-26 quad))
|
||||
)
|
||||
(dotimes (s5-1 5)
|
||||
(let ((s4-0 (-> self lists s5-1)))
|
||||
(if (-> s4-0 bbox-valid?)
|
||||
(add-box! gp-1 (-> s4-0 bbox))
|
||||
)
|
||||
(if (nonzero? s5-1)
|
||||
(joint-exploder-method-22 self s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s5-2 (-> self draw bounds)))
|
||||
(set-vector!
|
||||
s5-2
|
||||
(* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x)))
|
||||
(* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y)))
|
||||
(* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z)))
|
||||
1.0
|
||||
)
|
||||
(let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max)))))
|
||||
(vector-! s5-2 s5-2 (-> self root trans))
|
||||
(set! (-> s5-2 w) f0-12)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
:code (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(until (time-elapsed? (-> self state-time) (-> self tuning duration))
|
||||
(suspend)
|
||||
(ja :num! (loop!))
|
||||
)
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(let* ((f1-0 (the float (- (current-time) (-> self state-time))))
|
||||
(f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration)))))
|
||||
(f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))))
|
||||
(if (< f1-2 0.0) (set! f1-2 0.0))
|
||||
(set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0))
|
||||
(dotimes (v1-8 5)
|
||||
(set! (-> self lists v1-8 pre-moved?) #f))
|
||||
(dotimes (gp-0 5)
|
||||
(let ((s5-0 (-> self lists gp-0)))
|
||||
(when (>= (-> s5-0 head) 0)
|
||||
(when (not (-> s5-0 pre-moved?))
|
||||
(joint-exploder-method-25 self s5-0)
|
||||
(if (nonzero? gp-0) (joint-exploder-method-28 self s5-0))))))
|
||||
(let ((gp-1 (new 'stack-no-clear 'bounding-box)))
|
||||
(let ((v1-26 (-> self root trans))) (set! (-> gp-1 min quad) (-> v1-26 quad)) (set! (-> gp-1 max quad) (-> v1-26 quad)))
|
||||
(dotimes (s5-1 5)
|
||||
(let ((s4-0 (-> self lists s5-1)))
|
||||
(if (-> s4-0 bbox-valid?) (add-box! gp-1 (-> s4-0 bbox)))
|
||||
(if (nonzero? s5-1) (joint-exploder-method-22 self s4-0))))
|
||||
(let ((s5-2 (-> self draw bounds)))
|
||||
(set-vector! s5-2
|
||||
(* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x)))
|
||||
(* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y)))
|
||||
(* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z)))
|
||||
1.0)
|
||||
(let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max)))))
|
||||
(vector-! s5-2 s5-2 (-> self root trans))
|
||||
(set! (-> s5-2 w) f0-12))))
|
||||
0)
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(until (time-elapsed? (-> self state-time) (-> self tuning duration))
|
||||
(suspend)
|
||||
(ja :num! (loop!))))
|
||||
:post ja-post)
|
||||
|
||||
(defmethod joint-exploder-method-23 ((this joint-exploder))
|
||||
(let ((gp-0 (-> this joints)))
|
||||
(dotimes (s4-0 (-> gp-0 num-joints))
|
||||
(let ((v1-2 (-> this static-params joints s4-0))
|
||||
(s3-0 (-> gp-0 joint s4-0))
|
||||
)
|
||||
(s3-0 (-> gp-0 joint s4-0)))
|
||||
(let ((a0-6 (-> v1-2 parent-joint-index)))
|
||||
(set! (-> s3-0 prev) (+ s4-0 -1))
|
||||
(set! (-> s3-0 next) (+ s4-0 1))
|
||||
@@ -521,95 +329,61 @@
|
||||
(set! (-> s3-0 rspeed) (-> this tuning rot-speed))
|
||||
(cond
|
||||
((>= a0-6 0)
|
||||
(if (zero? a0-6)
|
||||
(set! a0-6 (-> v1-2 joint-index))
|
||||
)
|
||||
(if (zero? a0-6) (set! a0-6 (-> v1-2 joint-index)))
|
||||
(let* ((a3-0 (-> this parent-override 0 node-list data a0-6 bone transform))
|
||||
(a2-0 (-> s3-0 mat))
|
||||
(v1-9 (-> a3-0 vector 0 quad))
|
||||
(a0-8 (-> a3-0 vector 1 quad))
|
||||
(a1-4 (-> a3-0 vector 2 quad))
|
||||
(a3-1 (-> a3-0 vector 3 quad))
|
||||
)
|
||||
(a3-1 (-> a3-0 vector 3 quad)))
|
||||
(set! (-> a2-0 vector 0 quad) v1-9)
|
||||
(set! (-> a2-0 vector 1 quad) a0-8)
|
||||
(set! (-> a2-0 vector 2 quad) a1-4)
|
||||
(set! (-> a2-0 vector 3 quad) a3-1)
|
||||
)
|
||||
(matrix-identity! (-> s3-0 rmat))
|
||||
)
|
||||
(set! (-> a2-0 vector 3 quad) a3-1))
|
||||
(matrix-identity! (-> s3-0 rmat)))
|
||||
(else
|
||||
(let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform))
|
||||
(a2-1 (-> s3-0 mat))
|
||||
(v1-15 (-> a3-2 vector 0 quad))
|
||||
(a0-11 (-> a3-2 vector 1 quad))
|
||||
(a1-5 (-> a3-2 vector 2 quad))
|
||||
(a3-3 (-> a3-2 vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-1 vector 0 quad) v1-15)
|
||||
(set! (-> a2-1 vector 1 quad) a0-11)
|
||||
(set! (-> a2-1 vector 2 quad) a1-5)
|
||||
(set! (-> a2-1 vector 3 quad) a3-3)
|
||||
)
|
||||
(matrix-identity! (-> s3-0 rmat))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform))
|
||||
(a2-1 (-> s3-0 mat))
|
||||
(v1-15 (-> a3-2 vector 0 quad))
|
||||
(a0-11 (-> a3-2 vector 1 quad))
|
||||
(a1-5 (-> a3-2 vector 2 quad))
|
||||
(a3-3 (-> a3-2 vector 3 quad)))
|
||||
(set! (-> a2-1 vector 0 quad) v1-15)
|
||||
(set! (-> a2-1 vector 1 quad) a0-11)
|
||||
(set! (-> a2-1 vector 2 quad) a1-5)
|
||||
(set! (-> a2-1 vector 3 quad) a3-3))
|
||||
(matrix-identity! (-> s3-0 rmat)))))
|
||||
(case (-> this tuning explosion)
|
||||
((1)
|
||||
(vector-! (-> s3-0 transv) (-> s3-0 mat vector 3) (-> this tuning fountain-rand-transv-lo))
|
||||
(vector-normalize!
|
||||
(-> s3-0 transv)
|
||||
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y))
|
||||
)
|
||||
(vector-normalize! (-> s3-0 transv)
|
||||
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y)))
|
||||
(+! (-> s3-0 transv y)
|
||||
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w))
|
||||
)
|
||||
(set! (-> s3-0 transv w) 1.0)
|
||||
)
|
||||
(rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w)))
|
||||
(set! (-> s3-0 transv w) 1.0))
|
||||
(else
|
||||
(let ((s1-1 (-> this tuning fountain-rand-transv-lo))
|
||||
(s2-1 (-> this tuning fountain-rand-transv-hi))
|
||||
)
|
||||
(set-vector!
|
||||
(-> s3-0 transv)
|
||||
(rand-vu-float-range (-> s1-1 x) (-> s2-1 x))
|
||||
(rand-vu-float-range (-> s1-1 y) (-> s2-1 y))
|
||||
(rand-vu-float-range (-> s1-1 z) (-> s2-1 z))
|
||||
1.0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s1-1 (-> this tuning fountain-rand-transv-lo))
|
||||
(s2-1 (-> this tuning fountain-rand-transv-hi)))
|
||||
(set-vector! (-> s3-0 transv)
|
||||
(rand-vu-float-range (-> s1-1 x) (-> s2-1 x))
|
||||
(rand-vu-float-range (-> s1-1 y) (-> s2-1 y))
|
||||
(rand-vu-float-range (-> s1-1 z) (-> s2-1 z))
|
||||
1.0))))))
|
||||
(when (nonzero? (-> gp-0 num-joints))
|
||||
(let ((v1-26 (-> gp-0 joint (+ (-> gp-0 num-joints) -1))))
|
||||
(set! (-> v1-26 next) -1)
|
||||
)
|
||||
(let ((v1-26 (-> gp-0 joint (+ (-> gp-0 num-joints) -1)))) (set! (-> v1-26 next) -1))
|
||||
(let ((v1-27 (the-as joint-exploder-list (&-> this stack 224))))
|
||||
(set! (-> v1-27 head) 0)
|
||||
(let ((s5-1 (-> v1-27 bbox)))
|
||||
(let ((v1-28 (the-as structure (-> gp-0 joint 0 mat vector 3))))
|
||||
(set! (-> s5-1 min quad) (-> (the-as matrix v1-28) vector 0 quad))
|
||||
(set! (-> s5-1 max quad) (-> (the-as matrix v1-28) vector 0 quad))
|
||||
)
|
||||
(set! (-> s5-1 max quad) (-> (the-as matrix v1-28) vector 0 quad)))
|
||||
(dotimes (s4-1 (-> gp-0 num-joints))
|
||||
(add-point! s5-1 (the-as vector3s (+ (the-as uint (-> gp-0 joint 0 mat vector 3)) (* 176 s4-1))))
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
(add-point! s5-1 (the-as vector3s (+ (the-as uint (-> gp-0 joint 0 mat vector 3)) (* 176 s4-1)))))))
|
||||
#f)))
|
||||
|
||||
(defmethod relocate ((this joint-exploder) (arg0 int))
|
||||
(if (nonzero? (-> this joints))
|
||||
(&+! (-> this joints) arg0)
|
||||
)
|
||||
(the-as joint-exploder ((method-of-type process-drawable relocate) this arg0))
|
||||
)
|
||||
(if (nonzero? (-> this joints)) (&+! (-> this joints) arg0))
|
||||
(the-as joint-exploder ((method-of-type process-drawable relocate) this arg0)))
|
||||
|
||||
(defbehavior joint-exploder-init-by-other joint-exploder ((arg0 skeleton-group) (arg1 int) (arg2 joint-exploder-static-params) (arg3 joint-exploder-static-params))
|
||||
(set! (-> self static-params) arg3)
|
||||
@@ -620,9 +394,7 @@
|
||||
(let ((a0-6 (-> self lists v1-1)))
|
||||
(set! (-> a0-6 head) -1)
|
||||
(set! (-> a0-6 bbox-valid?) #f)
|
||||
(set! (-> a0-6 pre-moved?) #f)
|
||||
)
|
||||
)
|
||||
(set! (-> a0-6 pre-moved?) #f)))
|
||||
(logior! (-> self mask) (process-mask enemy))
|
||||
(set! (-> self root) (new 'process 'trsqv))
|
||||
(set! (-> self root trans quad) (-> self parent-override 0 root trans quad))
|
||||
@@ -638,13 +410,11 @@
|
||||
(set! (-> self die-if-below-y) (+ -102400.0 (-> self root trans y)))
|
||||
(set! (-> self skel postbind-function) joint-exploder-joint-callback)
|
||||
(go joint-exploder-shatter)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod new joint-exploder-tuning ((allocation symbol) (type-to-make type) (arg0 int))
|
||||
(let ((t9-0 (method-of-type structure new))
|
||||
(v1-1 type-to-make)
|
||||
)
|
||||
(v1-1 type-to-make))
|
||||
(-> type-to-make size)
|
||||
(let ((v0-0 (the-as joint-exploder-tuning (t9-0 allocation v1-1))))
|
||||
(set! (-> v0-0 explosion) (the-as uint arg0))
|
||||
@@ -654,17 +424,11 @@
|
||||
(cond
|
||||
((zero? arg0)
|
||||
(set-vector! (-> v0-0 fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0)
|
||||
(set-vector! (-> v0-0 fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0)
|
||||
)
|
||||
(set-vector! (-> v0-0 fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0))
|
||||
((= arg0 1)
|
||||
(vector-reset! (-> v0-0 fountain-rand-transv-lo))
|
||||
(set! (-> v0-0 fountain-rand-transv-hi x) 49152.0)
|
||||
(set! (-> v0-0 fountain-rand-transv-hi y) 163840.0)
|
||||
(set! (-> v0-0 fountain-rand-transv-hi z) 20480.0)
|
||||
(set! (-> v0-0 fountain-rand-transv-hi w) 61440.0)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> v0-0 fountain-rand-transv-hi w) 61440.0)))
|
||||
v0-0)))
|
||||
@@ -1,19 +1,17 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: joint-h.gc
|
||||
;; name in dgo: joint-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(declare-type joint-control basic)
|
||||
|
||||
(declare-type effect-control basic)
|
||||
|
||||
(define-extern cspace<-parented-transformq-joint! (function cspace transformq none))
|
||||
|
||||
(define-extern cspace<-transformq! (function cspace transformq matrix))
|
||||
|
||||
(define-extern vector<-cspace! (function vector cspace vector))
|
||||
|
||||
(define-extern create-interpolated-joint-animation-frame (function (inline-array vector) int process-drawable int))
|
||||
|
||||
(defenum janim-status
|
||||
@@ -27,8 +25,7 @@
|
||||
(spool 5)
|
||||
(blerc-done 6)
|
||||
(eye-done 7)
|
||||
(eye 8)
|
||||
)
|
||||
(eye 8))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
@@ -38,87 +35,71 @@
|
||||
;; A single joint control channel. It can control some number of joints through a single animation.
|
||||
;; Multiple channels are blended together to create smooth transitions between animations.
|
||||
(deftype joint-control-channel (structure)
|
||||
((parent joint-control)
|
||||
(command symbol)
|
||||
(frame-interp float)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(num-func (function joint-control-channel float float float))
|
||||
(param float 2)
|
||||
(group-sub-index int16)
|
||||
(group-size int16)
|
||||
(dist meters)
|
||||
(eval-time uint32)
|
||||
(inspector-amount float)
|
||||
)
|
||||
((parent joint-control)
|
||||
(command symbol)
|
||||
(frame-interp float)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(num-func (function joint-control-channel float float float))
|
||||
(param float 2)
|
||||
(group-sub-index int16)
|
||||
(group-size int16)
|
||||
(dist meters)
|
||||
(eval-time uint32)
|
||||
(inspector-amount float))
|
||||
(:methods
|
||||
(debug-print-frames (_type_) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
(debug-print-frames (_type_) _type_)))
|
||||
|
||||
(deftype joint-control (basic)
|
||||
((status janim-status)
|
||||
(allocated-length int16)
|
||||
(root-channel (inline-array joint-control-channel) :offset 16)
|
||||
(blend-index int32)
|
||||
(active-channels int32)
|
||||
(generate-frame-function (function (inline-array vector) int process-drawable int))
|
||||
(prebind-function (function pointer int process-drawable none))
|
||||
(postbind-function (function process-drawable none))
|
||||
(effect effect-control)
|
||||
(channel joint-control-channel 3 :inline)
|
||||
(frame-group0 art-joint-anim :overlay-at (-> channel 0 frame-group))
|
||||
(frame-num0 float :overlay-at (-> channel 0 frame-num))
|
||||
(frame-interp0 float :overlay-at (-> channel 0 frame-interp))
|
||||
(frame-group1 art-joint-anim :offset 108)
|
||||
(frame-num1 float :offset 112)
|
||||
(frame-interp1 float :offset 104)
|
||||
(frame-group2 art-joint-anim :offset 156)
|
||||
(frame-num2 float :offset 160)
|
||||
(frame-interp2 float :offset 152)
|
||||
)
|
||||
((status janim-status)
|
||||
(allocated-length int16)
|
||||
(root-channel (inline-array joint-control-channel) :offset 16)
|
||||
(blend-index int32)
|
||||
(active-channels int32)
|
||||
(generate-frame-function (function (inline-array vector) int process-drawable int))
|
||||
(prebind-function (function pointer int process-drawable none))
|
||||
(postbind-function (function process-drawable none))
|
||||
(effect effect-control)
|
||||
(channel joint-control-channel 3 :inline)
|
||||
(frame-group0 art-joint-anim :overlay-at (-> channel 0 frame-group))
|
||||
(frame-num0 float :overlay-at (-> channel 0 frame-num))
|
||||
(frame-interp0 float :overlay-at (-> channel 0 frame-interp))
|
||||
(frame-group1 art-joint-anim :offset 108)
|
||||
(frame-num1 float :offset 112)
|
||||
(frame-interp1 float :offset 104)
|
||||
(frame-group2 art-joint-anim :offset 156)
|
||||
(frame-num2 float :offset 160)
|
||||
(frame-interp2 float :offset 152))
|
||||
(:methods
|
||||
(new (symbol type int) _type_)
|
||||
(current-cycle-distance (_type_) float)
|
||||
(debug-print-channels (_type_ symbol) int)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type int) _type_)
|
||||
(current-cycle-distance (_type_) float)
|
||||
(debug-print-channels (_type_ symbol) int)))
|
||||
|
||||
(deftype matrix-stack (structure)
|
||||
((top matrix)
|
||||
(data matrix 24 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((top matrix)
|
||||
(data matrix 24 :inline)))
|
||||
|
||||
(deftype channel-upload-info (structure)
|
||||
((fixed joint-anim-compressed-fixed)
|
||||
(fixed-qwc int32)
|
||||
(frame joint-anim-compressed-frame)
|
||||
(frame-qwc int32)
|
||||
(amount float)
|
||||
(interp float)
|
||||
)
|
||||
:pack-me
|
||||
)
|
||||
|
||||
((fixed joint-anim-compressed-fixed)
|
||||
(fixed-qwc int32)
|
||||
(frame joint-anim-compressed-frame)
|
||||
(frame-qwc int32)
|
||||
(amount float)
|
||||
(interp float))
|
||||
:pack-me)
|
||||
|
||||
(deftype joint-work (structure)
|
||||
((temp-mtx matrix :inline)
|
||||
(joint-stack matrix-stack :inline)
|
||||
(fix-jmp-table (function none) 16)
|
||||
(frm-jmp-table (function none) 16)
|
||||
(pair-jmp-table (function none) 16)
|
||||
(uploads channel-upload-info 24 :inline)
|
||||
(num-uploads int32)
|
||||
(mtx-acc matrix 2 :inline)
|
||||
(tq-acc transformq 100 :inline)
|
||||
(jacp-hdr joint-anim-compressed-hdr :inline)
|
||||
(fixed-data joint-anim-compressed-fixed :inline)
|
||||
(frame-data joint-anim-compressed-frame 2 :inline)
|
||||
(flatten-array float 576 :overlay-at mtx-acc)
|
||||
(flattened vector 24 :inline :overlay-at mtx-acc)
|
||||
)
|
||||
)
|
||||
((temp-mtx matrix :inline)
|
||||
(joint-stack matrix-stack :inline)
|
||||
(fix-jmp-table (function none) 16)
|
||||
(frm-jmp-table (function none) 16)
|
||||
(pair-jmp-table (function none) 16)
|
||||
(uploads channel-upload-info 24 :inline)
|
||||
(num-uploads int32)
|
||||
(mtx-acc matrix 2 :inline)
|
||||
(tq-acc transformq 100 :inline)
|
||||
(jacp-hdr joint-anim-compressed-hdr :inline)
|
||||
(fixed-data joint-anim-compressed-fixed :inline)
|
||||
(frame-data joint-anim-compressed-frame 2 :inline)
|
||||
(flatten-array float 576 :overlay-at mtx-acc)
|
||||
(flattened vector 24 :inline :overlay-at mtx-acc)))
|
||||
File diff suppressed because it is too large.
Load diff
+377
-896
File diff suppressed because it is too large.
Load diff
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel/gcommon.gc")
|
||||
|
||||
;; name: mspace-h.gc
|
||||
;; name in dgo: mspace-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; this file contains types for the skeletal animation system.
|
||||
@@ -20,42 +15,32 @@
|
||||
;; - The skeleton: This is an inline array of bones. (called skeleton)
|
||||
;; - The joint-control (not in this file): this has the logic for running joint animations. (called skel)
|
||||
|
||||
|
||||
;; First, the joint. This type just describes how the skeleton is connected and the bind pose.
|
||||
(deftype joint (basic)
|
||||
((name string)
|
||||
(number int32)
|
||||
(parent joint)
|
||||
(bind-pose matrix :inline)
|
||||
)
|
||||
)
|
||||
((name string)
|
||||
(number int32)
|
||||
(parent joint)
|
||||
(bind-pose matrix :inline)))
|
||||
|
||||
;; I believe this stores offsets, in bytes, of where there are stored
|
||||
;; (possibly in the scratchpad)
|
||||
(deftype bone-cache (structure)
|
||||
((bone-matrix uint32)
|
||||
(parent-matrix uint32)
|
||||
(dummy uint32)
|
||||
(frame uint32)
|
||||
)
|
||||
)
|
||||
((bone-matrix uint32)
|
||||
(parent-matrix uint32)
|
||||
(dummy uint32)
|
||||
(frame uint32)))
|
||||
|
||||
;; The "bone" stores the final positions of the bodies.
|
||||
;; This is a world space transform.
|
||||
(deftype bone (structure)
|
||||
((transform matrix :inline)
|
||||
(position vector :inline :overlay-at (-> transform vector 3))
|
||||
(scale vector :inline)
|
||||
(cache bone-cache :inline)
|
||||
)
|
||||
)
|
||||
((transform matrix :inline)
|
||||
(position vector :inline :overlay-at (-> transform vector 3))
|
||||
(scale vector :inline)
|
||||
(cache bone-cache :inline)))
|
||||
|
||||
;; Like a real skeleton, this is a collection of bones for a single character.
|
||||
(deftype skeleton (inline-array-class)
|
||||
((bones bone :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
((bones bone :inline :dynamic)))
|
||||
|
||||
(set! (-> skeleton heap-base) (the-as uint 96))
|
||||
|
||||
@@ -72,39 +57,23 @@
|
||||
;; node 4 is the first real joint (for jak, it's upper body).
|
||||
|
||||
(deftype cspace (structure)
|
||||
((parent cspace)
|
||||
(joint joint)
|
||||
(joint-num int16)
|
||||
(geo basic)
|
||||
(bone bone)
|
||||
(param0 function)
|
||||
(param1 basic)
|
||||
(param2 basic)
|
||||
)
|
||||
((parent cspace)
|
||||
(joint joint)
|
||||
(joint-num int16)
|
||||
(geo basic)
|
||||
(bone bone)
|
||||
(param0 function)
|
||||
(param1 basic)
|
||||
(param2 basic))
|
||||
(:methods
|
||||
(new (symbol type basic) _type_)
|
||||
(reset-and-assign-geo! (_type_ basic) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type basic) _type_)
|
||||
(reset-and-assign-geo! (_type_ basic) _type_)))
|
||||
|
||||
(deftype cspace-array (inline-array-class)
|
||||
((data cspace :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
((data cspace :inline :dynamic)))
|
||||
|
||||
(set! (-> cspace-array heap-base) (the-as uint 32))
|
||||
|
||||
(defmethod print ((this cspace))
|
||||
(format
|
||||
#t
|
||||
"#<cspace ~S @ #x~X>"
|
||||
(if (-> this joint)
|
||||
(-> this joint name)
|
||||
"nojoint"
|
||||
)
|
||||
this
|
||||
)
|
||||
this
|
||||
)
|
||||
(format #t "#<cspace ~S @ #x~X>" (if (-> this joint) (-> this joint name) "nojoint") this)
|
||||
this)
|
||||
@@ -1,292 +1,186 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/gfx/hw/display.gc")
|
||||
(require "engine/camera/camera.gc")
|
||||
|
||||
;; name: cam-combiner.gc
|
||||
;; name in dgo: cam-combiner
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defstate cam-combiner-active (camera-combiner)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('point-of-interest)
|
||||
(cond
|
||||
((-> block param 0)
|
||||
(set! (-> self tracking use-point-of-interest) #t)
|
||||
(set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> block param 0)) quad))
|
||||
(set! (-> self tracking point-of-interest-blend target) 1.0)
|
||||
)
|
||||
(else
|
||||
(set! (-> self tracking use-point-of-interest) #f)
|
||||
(set! (-> self tracking point-of-interest-blend target) 0.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('set-interpolation)
|
||||
(set! (-> self interp-val) 0.0)
|
||||
(set! (-> self interp-step) (/ 5.0 (the float (-> block param 0))))
|
||||
)
|
||||
(('teleport)
|
||||
(when (nonzero? (-> self tracking-status))
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #f)
|
||||
(slave-set-rotation!
|
||||
(-> self tracking)
|
||||
(-> self trans)
|
||||
(the-as float (-> self tracking-options))
|
||||
(-> self fov)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
(('stop-tracking)
|
||||
(set! (-> self tracking-status) (the-as uint 0))
|
||||
0
|
||||
)
|
||||
(('start-tracking)
|
||||
(cond
|
||||
((< argc 1)
|
||||
(let ((t9-2 format)
|
||||
(a0-15 0)
|
||||
(a1-3 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* start-tracking~%")
|
||||
)
|
||||
(let ((v1-7 (-> block param 0)))
|
||||
(rtype-of v1-7)
|
||||
)
|
||||
(t9-2 a0-15 a1-3)
|
||||
)
|
||||
)
|
||||
((let ((t9-3 type-type?)
|
||||
(v1-8 (-> block param 0))
|
||||
)
|
||||
(not (t9-3 (rtype-of v1-8) camera-slave))
|
||||
)
|
||||
(let ((t9-4 format)
|
||||
(a0-18 0)
|
||||
(a1-5 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* start-tracking~%")
|
||||
(v1-10 (-> block param 0))
|
||||
)
|
||||
(t9-4 a0-18 a1-5 (rtype-of v1-10))
|
||||
)
|
||||
)
|
||||
((zero? (-> self tracking-status))
|
||||
(set! (-> self tracking-status) (the-as uint 1))
|
||||
(let ((gp-1 (the-as object (-> block param 0))))
|
||||
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options)))
|
||||
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow))
|
||||
(copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust))
|
||||
(copy-cam-float-seeker
|
||||
(-> self tracking underwater-blend)
|
||||
(-> (the-as camera-slave gp-1) tracking underwater-blend)
|
||||
)
|
||||
(set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest))
|
||||
(set! (-> self tracking point-of-interest quad)
|
||||
(-> (the-as camera-slave gp-1) tracking point-of-interest quad)
|
||||
)
|
||||
(copy-cam-float-seeker
|
||||
(-> self tracking point-of-interest-blend)
|
||||
(-> (the-as camera-slave gp-1) tracking point-of-interest-blend)
|
||||
)
|
||||
(let ((gp-2 (+ (the-as uint gp-1) 108)))
|
||||
(cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f)
|
||||
(slave-set-rotation!
|
||||
(-> self tracking)
|
||||
(the-as vector gp-2)
|
||||
(the-as float (-> self tracking-options))
|
||||
(-> self fov)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('copy-tracking)
|
||||
(cond
|
||||
((< argc 1)
|
||||
(let ((t9-10 format)
|
||||
(a0-27 0)
|
||||
(a1-11 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* copy-tracking~%")
|
||||
)
|
||||
(let ((v1-23 (-> block param 0)))
|
||||
(rtype-of v1-23)
|
||||
)
|
||||
(t9-10 a0-27 a1-11)
|
||||
)
|
||||
)
|
||||
((let ((t9-11 type-type?)
|
||||
(v1-24 (-> block param 0))
|
||||
)
|
||||
(not (t9-11 (rtype-of v1-24) camera-slave))
|
||||
)
|
||||
(let ((t9-12 format)
|
||||
(a0-30 0)
|
||||
(a1-13 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* copy-tracking~%")
|
||||
(v1-25 (-> block param 0))
|
||||
)
|
||||
(t9-12 a0-30 a1-13 (rtype-of v1-25))
|
||||
)
|
||||
)
|
||||
((nonzero? (-> self tracking-status))
|
||||
#f
|
||||
)
|
||||
(else
|
||||
(set! (-> self tracking-status) (the-as uint 1))
|
||||
(let ((gp-3 (the-as camera-slave (-> block param 0))))
|
||||
(set! (-> self tracking-options) (the-as int (-> gp-3 options)))
|
||||
(set! (-> self tracking no-follow) (-> gp-3 tracking no-follow))
|
||||
(copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust))
|
||||
(copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend))
|
||||
(set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad))
|
||||
(set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad))
|
||||
(let* ((a2-17 (-> self tracking))
|
||||
(a3-3 (-> gp-3 tracking))
|
||||
(v1-36 (-> a3-3 inv-mat vector 0 quad))
|
||||
(a0-37 (-> a3-3 inv-mat vector 1 quad))
|
||||
(a1-16 (-> a3-3 inv-mat vector 2 quad))
|
||||
(a3-4 (-> a3-3 inv-mat vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-17 inv-mat vector 0 quad) v1-36)
|
||||
(set! (-> a2-17 inv-mat vector 1 quad) a0-37)
|
||||
(set! (-> a2-17 inv-mat vector 2 quad) a1-16)
|
||||
(set! (-> a2-17 inv-mat vector 3 quad) a3-4)
|
||||
)
|
||||
(set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest))
|
||||
(set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad))
|
||||
(copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(local-vars (sv-160 cam-rotation-tracker))
|
||||
(loop
|
||||
(when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0))
|
||||
(set! (-> self tracking-status) (the-as uint 0))
|
||||
0
|
||||
)
|
||||
(when *camera*
|
||||
(let ((s5-0 (-> *camera* slave 0))
|
||||
(s4-0 (-> *camera* slave 1))
|
||||
(f30-0 (parameter-ease-sin-clamp (-> self interp-val)))
|
||||
(gp-0 (new-stack-vector0))
|
||||
)
|
||||
(set! (-> gp-0 quad) (-> self trans quad))
|
||||
(when s5-0
|
||||
(cond
|
||||
(s4-0
|
||||
(vector-lerp-clamp! (-> self trans) (-> s5-0 0 trans) (-> s4-0 0 trans) f30-0)
|
||||
(set! (-> self fov) (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0))
|
||||
(set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s5-0 0 trans)))
|
||||
(set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s4-0 0 trans)))
|
||||
(cond
|
||||
((= (-> self tracking-status) 1)
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
|
||||
(slave-set-rotation!
|
||||
(-> self tracking)
|
||||
(-> self trans)
|
||||
(the-as float (-> self tracking-options))
|
||||
(-> self fov)
|
||||
#t
|
||||
)
|
||||
(let* ((a2-4 (-> self inv-camera-rot))
|
||||
(a3-2 (-> self tracking))
|
||||
(v1-20 (-> a3-2 inv-mat vector 0 quad))
|
||||
(a0-10 (-> a3-2 inv-mat vector 1 quad))
|
||||
(a1-6 (-> a3-2 inv-mat vector 2 quad))
|
||||
(a3-3 (-> a3-2 inv-mat vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-4 vector 0 quad) v1-20)
|
||||
(set! (-> a2-4 vector 1 quad) a0-10)
|
||||
(set! (-> a2-4 vector 2 quad) a1-6)
|
||||
(set! (-> a2-4 vector 3 quad) a3-3)
|
||||
)
|
||||
)
|
||||
(else
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('point-of-interest)
|
||||
(cond
|
||||
((-> block param 0)
|
||||
(set! (-> self tracking use-point-of-interest) #t)
|
||||
(set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> block param 0)) quad))
|
||||
(set! (-> self tracking point-of-interest-blend target) 1.0))
|
||||
(else (set! (-> self tracking use-point-of-interest) #f) (set! (-> self tracking point-of-interest-blend target) 0.0))))
|
||||
(('set-interpolation)
|
||||
(set! (-> self interp-val) 0.0)
|
||||
(set! (-> self interp-step) (/ 5.0 (the float (-> block param 0)))))
|
||||
(('teleport)
|
||||
(when (nonzero? (-> self tracking-status))
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #f)
|
||||
(slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #f)))
|
||||
(('stop-tracking) (set! (-> self tracking-status) (the-as uint 0)) 0)
|
||||
(('start-tracking)
|
||||
(cond
|
||||
((< argc 1)
|
||||
(let ((t9-2 format)
|
||||
(a0-15 0)
|
||||
(a1-3 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* start-tracking~%"))
|
||||
(let ((v1-7 (-> block param 0))) (rtype-of v1-7))
|
||||
(t9-2 a0-15 a1-3)))
|
||||
((let ((t9-3 type-type?)
|
||||
(v1-8 (-> block param 0)))
|
||||
(not (t9-3 (rtype-of v1-8) camera-slave)))
|
||||
(let ((t9-4 format)
|
||||
(a0-18 0)
|
||||
(a1-5 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* start-tracking~%")
|
||||
(v1-10 (-> block param 0)))
|
||||
(t9-4 a0-18 a1-5 (rtype-of v1-10))))
|
||||
((zero? (-> self tracking-status))
|
||||
(set! (-> self tracking-status) (the-as uint 1))
|
||||
(let ((gp-1 (the-as object (-> block param 0))))
|
||||
(set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options)))
|
||||
(set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow))
|
||||
(copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust))
|
||||
(copy-cam-float-seeker (-> self tracking underwater-blend) (-> (the-as camera-slave gp-1) tracking underwater-blend))
|
||||
(set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest))
|
||||
(set! (-> self tracking point-of-interest quad) (-> (the-as camera-slave gp-1) tracking point-of-interest quad))
|
||||
(copy-cam-float-seeker (-> self tracking point-of-interest-blend)
|
||||
(-> (the-as camera-slave gp-1) tracking point-of-interest-blend))
|
||||
(let ((gp-2 (+ (the-as uint gp-1) 108)))
|
||||
(cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f)
|
||||
(slave-set-rotation! (-> self tracking) (the-as vector gp-2) (the-as float (-> self tracking-options)) (-> self fov) #f))))))
|
||||
(('copy-tracking)
|
||||
(cond
|
||||
((< argc 1)
|
||||
(let ((t9-10 format)
|
||||
(a0-27 0)
|
||||
(a1-11 "ERROR <GMJ>: missing camera-slave parameter to *camera-combiner* copy-tracking~%"))
|
||||
(let ((v1-23 (-> block param 0))) (rtype-of v1-23))
|
||||
(t9-10 a0-27 a1-11)))
|
||||
((let ((t9-11 type-type?)
|
||||
(v1-24 (-> block param 0)))
|
||||
(not (t9-11 (rtype-of v1-24) camera-slave)))
|
||||
(let ((t9-12 format)
|
||||
(a0-30 0)
|
||||
(a1-13 "ERROR <GMJ>: invalid type '~A' to *camera-combiner* copy-tracking~%")
|
||||
(v1-25 (-> block param 0)))
|
||||
(t9-12 a0-30 a1-13 (rtype-of v1-25))))
|
||||
((nonzero? (-> self tracking-status)) #f)
|
||||
(else
|
||||
(set! (-> self tracking-status) (the-as uint 1))
|
||||
(let ((gp-3 (the-as camera-slave (-> block param 0))))
|
||||
(set! (-> self tracking-options) (the-as int (-> gp-3 options)))
|
||||
(set! (-> self tracking no-follow) (-> gp-3 tracking no-follow))
|
||||
(copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust))
|
||||
(copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend))
|
||||
(set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad))
|
||||
(set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad))
|
||||
(let* ((a2-17 (-> self tracking))
|
||||
(a3-3 (-> gp-3 tracking))
|
||||
(v1-36 (-> a3-3 inv-mat vector 0 quad))
|
||||
(a0-37 (-> a3-3 inv-mat vector 1 quad))
|
||||
(a1-16 (-> a3-3 inv-mat vector 2 quad))
|
||||
(a3-4 (-> a3-3 inv-mat vector 3 quad)))
|
||||
(set! (-> a2-17 inv-mat vector 0 quad) v1-36)
|
||||
(set! (-> a2-17 inv-mat vector 1 quad) a0-37)
|
||||
(set! (-> a2-17 inv-mat vector 2 quad) a1-16)
|
||||
(set! (-> a2-17 inv-mat vector 3 quad) a3-4))
|
||||
(set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest))
|
||||
(set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad))
|
||||
(copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend))))))))
|
||||
:code
|
||||
(behavior ()
|
||||
(local-vars (sv-160 cam-rotation-tracker))
|
||||
(loop
|
||||
(when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0))
|
||||
(set! (-> self tracking-status) (the-as uint 0))
|
||||
0)
|
||||
(when *camera*
|
||||
(let ((s5-0 (-> *camera* slave 0))
|
||||
(s4-0 (-> *camera* slave 1))
|
||||
(f30-0 (parameter-ease-sin-clamp (-> self interp-val)))
|
||||
(gp-0 (new-stack-vector0)))
|
||||
(set! (-> gp-0 quad) (-> self trans quad))
|
||||
(when s5-0
|
||||
(cond
|
||||
(s4-0
|
||||
(vector-lerp-clamp! (-> self trans) (-> s5-0 0 trans) (-> s4-0 0 trans) f30-0)
|
||||
(set! (-> self fov) (lerp-clamp (-> s5-0 0 fov) (-> s4-0 0 fov) f30-0))
|
||||
(set! (-> self dist-from-src) (vector-vector-distance (-> self trans) (-> s5-0 0 trans)))
|
||||
(set! (-> self dist-from-dest) (vector-vector-distance (-> self trans) (-> s4-0 0 trans)))
|
||||
(cond
|
||||
((= (-> self tracking-status) 1)
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
|
||||
(slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #t)
|
||||
(let* ((a2-4 (-> self inv-camera-rot))
|
||||
(a3-2 (-> self tracking))
|
||||
(v1-20 (-> a3-2 inv-mat vector 0 quad))
|
||||
(a0-10 (-> a3-2 inv-mat vector 1 quad))
|
||||
(a1-6 (-> a3-2 inv-mat vector 2 quad))
|
||||
(a3-3 (-> a3-2 inv-mat vector 3 quad)))
|
||||
(set! (-> a2-4 vector 0 quad) v1-20)
|
||||
(set! (-> a2-4 vector 1 quad) a0-10)
|
||||
(set! (-> a2-4 vector 2 quad) a1-6)
|
||||
(set! (-> a2-4 vector 3 quad) a3-3)))
|
||||
(else
|
||||
(set! sv-160 (-> s5-0 0 tracking))
|
||||
(let ((s2-0 (-> s5-0 0 trans))
|
||||
(s5-1 (-> s4-0 0 tracking))
|
||||
(s0-0 (-> s4-0 0 trans))
|
||||
)
|
||||
(s0-0 (-> s4-0 0 trans)))
|
||||
(cond
|
||||
((= (-> self tracking-status) 3)
|
||||
(cam-calc-follow! (-> self tracking) s2-0 #t)
|
||||
(slave-set-rotation! (-> self tracking) s2-0 (the-as float (-> self tracking-options)) (-> self fov) #t)
|
||||
(set! sv-160 (-> self tracking))
|
||||
(set! s2-0 (-> self trans))
|
||||
)
|
||||
(set! s2-0 (-> self trans)))
|
||||
((= (-> self tracking-status) 2)
|
||||
(cam-calc-follow! (-> self tracking) s0-0 #t)
|
||||
(slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t)
|
||||
(set! s5-1 (-> self tracking))
|
||||
(set! s0-0 (-> self trans))
|
||||
)
|
||||
)
|
||||
(set! s0-0 (-> self trans))))
|
||||
(let ((s1-0 (new 'stack-no-clear 'matrix)))
|
||||
(dotimes (v1-35 3)
|
||||
(set! (-> s1-0 vector v1-35 quad) (the-as uint128 0))
|
||||
)
|
||||
(set! (-> s1-0 vector v1-35 quad) (the-as uint128 0)))
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
(let ((s4-1 (new-stack-vector0)))
|
||||
0.0
|
||||
(let ((s3-0 (new-stack-matrix0)))
|
||||
(vector-!
|
||||
(the-as vector (-> s1-0 vector))
|
||||
(the-as vector (-> sv-160 inv-mat))
|
||||
(the-as vector (-> s5-1 inv-mat))
|
||||
)
|
||||
(vector-! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat)))
|
||||
(vector-! (-> s1-0 vector 1) (-> sv-160 inv-mat vector 1) (-> s5-1 inv-mat vector 1))
|
||||
(vector-! (-> s1-0 vector 2) (-> sv-160 inv-mat vector 2) (-> s5-1 inv-mat vector 2))
|
||||
(let ((f26-0 (vector-length (the-as vector (-> s1-0 vector))))
|
||||
(f28-0 (vector-length (-> s1-0 vector 1)))
|
||||
(f0-13 (vector-length (-> s1-0 vector 2)))
|
||||
)
|
||||
(f0-13 (vector-length (-> s1-0 vector 2))))
|
||||
(cond
|
||||
((and (< f26-0 f28-0) (< f26-0 f0-13))
|
||||
(vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2))
|
||||
)
|
||||
((and (< f28-0 f26-0) (< f28-0 f0-13))
|
||||
(vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2))
|
||||
)
|
||||
(else
|
||||
(vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))
|
||||
)
|
||||
)
|
||||
)
|
||||
((and (< f26-0 f28-0) (< f26-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2)))
|
||||
((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2)))
|
||||
(else (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)))))
|
||||
(vector-normalize! s4-1 1.0)
|
||||
(let ((f0-16 (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1)))
|
||||
(f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1)))
|
||||
(f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1)))
|
||||
)
|
||||
(f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1))))
|
||||
(cond
|
||||
((and (< f0-16 f1-2) (< f0-16 f2-2))
|
||||
(vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) s4-1)
|
||||
(vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1)
|
||||
)
|
||||
(vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1))
|
||||
((< f1-2 f2-2)
|
||||
(vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 1) s4-1)
|
||||
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1)
|
||||
)
|
||||
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1))
|
||||
(else
|
||||
(vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1)
|
||||
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1)
|
||||
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1))))
|
||||
(vector-normalize! (the-as vector (-> s1-0 vector)) 1.0)
|
||||
(vector-normalize! (-> s1-0 vector 1) 1.0)
|
||||
(vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))
|
||||
(if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0)
|
||||
(vector-negate! s4-1 s4-1)
|
||||
)
|
||||
(if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) (vector-negate! s4-1 s4-1))
|
||||
(let ((f28-1 (acos (vector-dot (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)))))
|
||||
(cond
|
||||
((logtest? (-> *camera* master-options) 8)
|
||||
@@ -297,136 +191,75 @@
|
||||
(vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> s1-0 vector)) (-> *camera* local-down))
|
||||
(vector-flatten! (-> s1-0 vector 1) (-> s1-0 vector 1) (-> *camera* local-down))
|
||||
(when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0))
|
||||
(< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0))
|
||||
)
|
||||
(< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0)))
|
||||
(vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (the-as vector (-> s1-0 vector)))
|
||||
(when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01)))))
|
||||
((and (< 16384.0 f28-1) (< (vector-dot (-> self flip-control-axis) s4-1) 0.0))
|
||||
(logxor! (-> *camera* master-options) 16)
|
||||
)
|
||||
)
|
||||
(logxor! (-> *camera* master-options) 16)))
|
||||
(set! (-> self flip-control-axis quad) (-> s4-1 quad))
|
||||
(when (logtest? (-> *camera* master-options) 16)
|
||||
(set! f28-1 (- 65536.0 f28-1))
|
||||
(vector-negate! s4-1 s4-1)
|
||||
)
|
||||
(let ((f30-1 (* f28-1 (- 1.0 f30-0))))
|
||||
(matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1))
|
||||
)
|
||||
)
|
||||
(matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value)))
|
||||
)
|
||||
((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t)))
|
||||
)
|
||||
((paused?)
|
||||
)
|
||||
(else
|
||||
(+! (-> self interp-val) (* (-> self interp-step) (-> *display* time-adjust-ratio)))
|
||||
)
|
||||
)
|
||||
(when (>= (-> self interp-val) 1.0)
|
||||
(deactivate (-> *camera* slave 0 0))
|
||||
(set! (-> *camera* slave 0) (-> *camera* slave 1))
|
||||
(set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f))
|
||||
(+! (-> *camera* num-slaves) -1)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> self dist-from-src) 409600.0)
|
||||
(set! (-> self dist-from-dest) 0.0)
|
||||
(set! (-> self trans quad) (-> s5-0 0 trans quad))
|
||||
(set! (-> self fov) (-> s5-0 0 fov))
|
||||
(cond
|
||||
((= (-> self tracking-status) 2)
|
||||
(set! (-> self tracking-status) (the-as uint 1))
|
||||
)
|
||||
((= (-> self tracking-status) 3)
|
||||
(set! (-> self tracking-status) (the-as uint 0))
|
||||
0
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((= (-> self tracking-status) 1)
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
|
||||
(slave-set-rotation!
|
||||
(-> self tracking)
|
||||
(-> self trans)
|
||||
(the-as float (-> self tracking-options))
|
||||
(-> self fov)
|
||||
#t
|
||||
)
|
||||
(let* ((v1-143 (-> self inv-camera-rot))
|
||||
(a3-8 (-> self tracking))
|
||||
(a0-80 (-> a3-8 inv-mat vector 0 quad))
|
||||
(a1-45 (-> a3-8 inv-mat vector 1 quad))
|
||||
(a2-21 (-> a3-8 inv-mat vector 2 quad))
|
||||
(a3-9 (-> a3-8 inv-mat vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-143 vector 0 quad) a0-80)
|
||||
(set! (-> v1-143 vector 1 quad) a1-45)
|
||||
(set! (-> v1-143 vector 2 quad) a2-21)
|
||||
(set! (-> v1-143 vector 3 quad) a3-9)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(vector-negate! s4-1 s4-1))
|
||||
(let ((f30-1 (* f28-1 (- 1.0 f30-0)))) (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1))))
|
||||
(matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0)))))))
|
||||
(cond
|
||||
((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value))))
|
||||
((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t))))
|
||||
((paused?))
|
||||
(else (+! (-> self interp-val) (* (-> self interp-step) (-> *display* time-adjust-ratio)))))
|
||||
(when (>= (-> self interp-val) 1.0)
|
||||
(deactivate (-> *camera* slave 0 0))
|
||||
(set! (-> *camera* slave 0) (-> *camera* slave 1))
|
||||
(set! (-> *camera* slave 1) (the-as (pointer camera-slave) #f))
|
||||
(+! (-> *camera* num-slaves) -1)))
|
||||
(else
|
||||
(set! (-> self dist-from-src) 409600.0)
|
||||
(set! (-> self dist-from-dest) 0.0)
|
||||
(set! (-> self trans quad) (-> s5-0 0 trans quad))
|
||||
(set! (-> self fov) (-> s5-0 0 fov))
|
||||
(cond
|
||||
((= (-> self tracking-status) 2) (set! (-> self tracking-status) (the-as uint 1)))
|
||||
((= (-> self tracking-status) 3) (set! (-> self tracking-status) (the-as uint 0)) 0))
|
||||
(cond
|
||||
((= (-> self tracking-status) 1)
|
||||
(cam-calc-follow! (-> self tracking) (-> self trans) #t)
|
||||
(slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self tracking-options)) (-> self fov) #t)
|
||||
(let* ((v1-143 (-> self inv-camera-rot))
|
||||
(a3-8 (-> self tracking))
|
||||
(a0-80 (-> a3-8 inv-mat vector 0 quad))
|
||||
(a1-45 (-> a3-8 inv-mat vector 1 quad))
|
||||
(a2-21 (-> a3-8 inv-mat vector 2 quad))
|
||||
(a3-9 (-> a3-8 inv-mat vector 3 quad)))
|
||||
(set! (-> v1-143 vector 0 quad) a0-80)
|
||||
(set! (-> v1-143 vector 1 quad) a1-45)
|
||||
(set! (-> v1-143 vector 2 quad) a2-21)
|
||||
(set! (-> v1-143 vector 3 quad) a3-9)))
|
||||
(else
|
||||
(let* ((v1-144 (-> self inv-camera-rot))
|
||||
(a3-10 (-> s5-0 0 tracking))
|
||||
(a0-82 (-> a3-10 inv-mat vector 0 quad))
|
||||
(a1-46 (-> a3-10 inv-mat vector 1 quad))
|
||||
(a2-22 (-> a3-10 inv-mat vector 2 quad))
|
||||
(a3-11 (-> a3-10 inv-mat vector 3 quad))
|
||||
)
|
||||
(a3-11 (-> a3-10 inv-mat vector 3 quad)))
|
||||
(set! (-> v1-144 vector 0 quad) a0-82)
|
||||
(set! (-> v1-144 vector 1 quad) a1-46)
|
||||
(set! (-> v1-144 vector 2 quad) a2-22)
|
||||
(set! (-> v1-144 vector 3 quad) a3-11)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-! (-> self velocity) (-> self trans) gp-0)
|
||||
)
|
||||
)
|
||||
(if (and *dproc* *debug-segment*)
|
||||
(add-frame
|
||||
(-> *display* frames (-> *display* on-screen) frame profile-bar 0)
|
||||
'camera
|
||||
(new 'static 'rgba :b #xff :a #x80)
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> v1-144 vector 3 quad) a3-11)))))))
|
||||
(vector-! (-> self velocity) (-> self trans) gp-0)))
|
||||
(if (and *dproc* *debug-segment*)
|
||||
(add-frame (-> *display* frames (-> *display* on-screen) frame profile-bar 0) 'camera (new 'static 'rgba :b #xff :a #x80)))
|
||||
(suspend))))
|
||||
|
||||
(defbehavior cam-combiner-init camera-combiner ()
|
||||
(stack-size-set! (-> self main-thread) 512)
|
||||
(set! *camera-combiner* self)
|
||||
(vector-reset! (-> self trans))
|
||||
(matrix-identity! (-> self inv-camera-rot))
|
||||
(if *math-camera*
|
||||
(set! (-> self fov) (-> *math-camera* fov))
|
||||
(set! (-> self fov) 11650.845)
|
||||
)
|
||||
(if *math-camera* (set! (-> self fov) (-> *math-camera* fov)) (set! (-> self fov) 11650.845))
|
||||
(set! (-> self interp-val) 0.0)
|
||||
(set! (-> self interp-step) 0.125)
|
||||
(set! (-> self tracking-status) (the-as uint 0))
|
||||
(vector-reset! (-> self velocity))
|
||||
(go cam-combiner-active)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
@@ -1,47 +1,70 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: cam-debug-h.gc
|
||||
;; name in dgo: cam-debug-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; TODO - for misty-obs
|
||||
(define-extern *camera-old-level* string) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-cpu* int) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-vu* int) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-tfrag-bytes* int) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-stat-string-tfrag* string) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-stat-string-tfrag-near* string) ;; unknown type
|
||||
|
||||
(define-extern *camera-old-stat-string-total* string) ;; unknown type
|
||||
|
||||
;; TODO - for cam-layout
|
||||
(define-extern camera-line-setup (function vector4w none))
|
||||
|
||||
(define-extern camera-line-draw (function vector vector symbol))
|
||||
|
||||
(define-extern camera-line (function vector vector vector4w none))
|
||||
|
||||
(define-extern camera-cross (function vector vector vector vector4w meters basic))
|
||||
|
||||
(define-extern camera-fov-frame (function matrix vector float float float vector4w none))
|
||||
|
||||
(define-extern cam-slave-options->string (function cam-slave-options object string))
|
||||
|
||||
(define-extern cam-index-options->string (function cam-index-options object string))
|
||||
|
||||
(define-extern debug-set-camera-pos-rot! (function vector matrix vector))
|
||||
|
||||
(define-extern camera-slave-debug (function camera-slave none))
|
||||
|
||||
;; TODO - for cam-states
|
||||
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
|
||||
|
||||
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none))
|
||||
|
||||
(define-extern slave-los-state->string (function slave-los-state string))
|
||||
|
||||
(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed
|
||||
|
||||
;; TODO - for rolling-lightning-mole
|
||||
(define-extern camera-line-rel (function vector vector vector4w none))
|
||||
|
||||
(declare-type clm basic)
|
||||
|
||||
(define-extern *clm* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-edit* clm)
|
||||
|
||||
(define-extern *clm-focalpull-attr* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-index-attr* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-intro-attr* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-spline-attr* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-vol-attr* clm) ;; unknown type
|
||||
|
||||
(define-extern *clm-select* clm) ;; unknown type
|
||||
|
||||
;; DECOMP BEGINS
|
||||
@@ -58,16 +81,11 @@
|
||||
(set! *redline-index* (+ *redline-index* 1))
|
||||
(when (>= *redline-index* 400)
|
||||
(set! *redline-index* 0)
|
||||
0
|
||||
)
|
||||
(none)
|
||||
)
|
||||
0)
|
||||
(none))
|
||||
|
||||
(defun float-lookup-redline ((arg0 float))
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *redline-index*) 400)))
|
||||
(-> *redline-table* a0-3)
|
||||
)
|
||||
)
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *redline-index*) 400))) (-> *redline-table* a0-3)))
|
||||
|
||||
(define *blueline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
||||
|
||||
@@ -78,16 +96,11 @@
|
||||
(set! *blueline-index* (+ *blueline-index* 1))
|
||||
(when (>= *blueline-index* 400)
|
||||
(set! *blueline-index* 0)
|
||||
0
|
||||
)
|
||||
(none)
|
||||
)
|
||||
0)
|
||||
(none))
|
||||
|
||||
(defun float-lookup-blueline ((arg0 float))
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *blueline-index*) 400)))
|
||||
(-> *blueline-table* a0-3)
|
||||
)
|
||||
)
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *blueline-index*) 400))) (-> *blueline-table* a0-3)))
|
||||
|
||||
(define *greenline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
||||
|
||||
@@ -98,16 +111,11 @@
|
||||
(set! *greenline-index* (+ *greenline-index* 1))
|
||||
(when (>= *greenline-index* 400)
|
||||
(set! *greenline-index* 0)
|
||||
0
|
||||
)
|
||||
(none)
|
||||
)
|
||||
0)
|
||||
(none))
|
||||
|
||||
(defun float-lookup-greenline ((arg0 float))
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *greenline-index*) 400)))
|
||||
(-> *greenline-table* a0-3)
|
||||
)
|
||||
)
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *greenline-index*) 400))) (-> *greenline-table* a0-3)))
|
||||
|
||||
(define *yellowline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
||||
|
||||
@@ -118,16 +126,11 @@
|
||||
(set! *yellowline-index* (+ *yellowline-index* 1))
|
||||
(when (>= *yellowline-index* 400)
|
||||
(set! *yellowline-index* 0)
|
||||
0
|
||||
)
|
||||
(none)
|
||||
)
|
||||
0)
|
||||
(none))
|
||||
|
||||
(defun float-lookup-yellowline ((arg0 float))
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *yellowline-index*) 400)))
|
||||
(-> *yellowline-table* a0-3)
|
||||
)
|
||||
)
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *yellowline-index*) 400))) (-> *yellowline-table* a0-3)))
|
||||
|
||||
(define *timeplot-table* (the-as (pointer float) (malloc 'debug 1600)))
|
||||
|
||||
@@ -138,20 +141,12 @@
|
||||
(set! *timeplot-index* (+ *timeplot-index* 1))
|
||||
(when (>= *timeplot-index* 400)
|
||||
(set! *timeplot-index* 0)
|
||||
0
|
||||
)
|
||||
(none)
|
||||
)
|
||||
0)
|
||||
(none))
|
||||
|
||||
(defun float-lookup-timeplot ((arg0 float))
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *timeplot-index*) 400)))
|
||||
(-> *timeplot-table* a0-3)
|
||||
)
|
||||
)
|
||||
(let ((a0-3 (mod (+ (the int arg0) -1 *timeplot-index*) 400))) (-> *timeplot-table* a0-3)))
|
||||
|
||||
(define-perm *cam-layout* symbol #f)
|
||||
|
||||
0
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,24 +1,26 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/camera-h.gc")
|
||||
(require "engine/math/matrix-h.gc")
|
||||
|
||||
;; name: cam-interface-h.gc
|
||||
;; name in dgo: cam-interface-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; NOTE - forward declaration needed for cam-interface
|
||||
(define-extern *camera-dummy-vector* vector)
|
||||
|
||||
(define-extern *camera* camera-master) ;; unknown type
|
||||
|
||||
(define *camera-read-analog* #t)
|
||||
|
||||
(define *camera-read-buttons* #t)
|
||||
|
||||
(define *cam-free-move-along-z* #t)
|
||||
|
||||
(define-perm *camera-init-mat* matrix #f)
|
||||
|
||||
(define-perm *camera* camera-master #f)
|
||||
|
||||
(define-perm *camera-combiner* camera-combiner #f)
|
||||
|
||||
(define-perm *camera-orbit-target* (pointer process-drawable) #f)
|
||||
|
||||
(define-extern position-in-front-of-camera! (function vector float float vector))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/cam-interface-h.gc")
|
||||
(require "engine/math/quaternion.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
@@ -9,77 +8,50 @@
|
||||
(require "engine/entity/entity-h.gc")
|
||||
(require "engine/math/transformq-h.gc")
|
||||
|
||||
;; name: cam-interface.gc
|
||||
;; name in dgo: cam-interface
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
;; definition for function position-in-front-of-camera!
|
||||
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
|
||||
(vector-float*! arg0 (-> *math-camera* inv-camera-rot vector 2) arg1)
|
||||
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
|
||||
(vector+! arg0 arg0 (-> *math-camera* trans))
|
||||
arg0
|
||||
)
|
||||
arg0)
|
||||
|
||||
;; definition for function matrix-local->world
|
||||
(defun matrix-local->world ((arg0 symbol) (arg1 symbol))
|
||||
(if arg0
|
||||
(-> *math-camera* inv-camera-rot-smooth)
|
||||
(-> *math-camera* inv-camera-rot)
|
||||
)
|
||||
)
|
||||
(if arg0 (-> *math-camera* inv-camera-rot-smooth) (-> *math-camera* inv-camera-rot)))
|
||||
|
||||
;; definition for function matrix-world->local
|
||||
(defun matrix-world->local ()
|
||||
(-> *math-camera* camera-rot)
|
||||
)
|
||||
(-> *math-camera* camera-rot))
|
||||
|
||||
(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
|
||||
|
||||
;; definition for function camera-pos
|
||||
;; INFO: Return type mismatch object vs vector.
|
||||
(defun camera-pos ()
|
||||
(the-as vector (cond
|
||||
(*camera-combiner*
|
||||
(-> *camera-combiner* stack)
|
||||
)
|
||||
(*math-camera*
|
||||
(-> *math-camera* trans)
|
||||
)
|
||||
(else
|
||||
*camera-dummy-vector*
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as vector
|
||||
(cond
|
||||
(*camera-combiner* (-> *camera-combiner* stack))
|
||||
(*math-camera* (-> *math-camera* trans))
|
||||
(else *camera-dummy-vector*))))
|
||||
|
||||
;; definition for function math-camera-pos
|
||||
(defun math-camera-pos ()
|
||||
(-> *math-camera* trans)
|
||||
)
|
||||
(-> *math-camera* trans))
|
||||
|
||||
;; definition for function camera-angle
|
||||
(defun camera-angle ()
|
||||
(let ((f0-0 (-> *math-camera* camera-rot data 0))
|
||||
(f1-0 (-> *math-camera* camera-rot data 2))
|
||||
)
|
||||
(atan f1-0 f0-0)
|
||||
)
|
||||
)
|
||||
(f1-0 (-> *math-camera* camera-rot data 2)))
|
||||
(atan f1-0 f0-0)))
|
||||
|
||||
;; definition for function camera-teleport-to-entity
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
;; Used lq/sq
|
||||
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
|
||||
(let ((gp-0 (new 'stack 'transformq)))
|
||||
(set! (-> gp-0 trans quad)
|
||||
(-> (the-as transform (-> arg0 extra)) scale quad)
|
||||
)
|
||||
(set! (-> gp-0 trans quad) (-> (the-as transform (-> arg0 extra)) scale quad))
|
||||
(quaternion-copy! (-> gp-0 quat) (-> arg0 quat))
|
||||
(vector-identity! (-> gp-0 scale))
|
||||
(send-event *camera* 'teleport-to-transformq gp-0)
|
||||
)
|
||||
(send-event *camera* 'teleport-to-transformq gp-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
+1909
-2729
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/cam-combiner.gc")
|
||||
|
||||
;; name: cam-start.gc
|
||||
;; name in dgo: cam-start
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defun cam-stop ()
|
||||
@@ -17,28 +12,21 @@
|
||||
(set! *camera* #f)
|
||||
(set! *camera-combiner* #f)
|
||||
(set! *camera-base-mode* cam-string)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defun cam-start ((arg0 symbol))
|
||||
(cam-stop)
|
||||
(process-spawn camera-combiner :init cam-combiner-init :from *camera-dead-pool* :to *camera-pool*)
|
||||
(set! *camera*
|
||||
(the-as camera-master
|
||||
(ppointer->process
|
||||
(process-spawn-function camera-master cam-master-init :from *camera-master-dead-pool* :to *camera-pool*)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if arg0
|
||||
(reset-cameras)
|
||||
)
|
||||
(ppointer->process (process-spawn-function camera-master
|
||||
cam-master-init
|
||||
:from
|
||||
*camera-master-dead-pool*
|
||||
:to
|
||||
*camera-pool*))))
|
||||
(if arg0 (reset-cameras))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(cam-start #f)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,98 +1,67 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/camera.gc")
|
||||
(require "pc/pckernel-impl.gc")
|
||||
|
||||
;; name: cam-states-dbg.gc
|
||||
;; name in dgo: cam-states-dbg
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype cam-point-watch-bank (basic)
|
||||
((speed float)
|
||||
(rot-speed degrees)
|
||||
)
|
||||
)
|
||||
|
||||
((speed float)
|
||||
(rot-speed degrees)))
|
||||
|
||||
(define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6)))
|
||||
|
||||
(defstate cam-point-watch (camera-slave)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport)
|
||||
#f
|
||||
)
|
||||
(else
|
||||
(cam-standard-event-handler proc argc message block)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(set! (-> self pivot-rad) 40960.0)
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(let ((s5-0 (new-stack-vector0))
|
||||
(gp-0 (new-stack-vector0))
|
||||
)
|
||||
(when *camera-read-analog*
|
||||
(let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0))
|
||||
(f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0))
|
||||
(f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0))
|
||||
(f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0))
|
||||
)
|
||||
(cond
|
||||
((cpad-hold? (-> *CAMERA-bank* joypad) r2)
|
||||
(set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))))
|
||||
(set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))))
|
||||
(+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
|
||||
(+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
|
||||
)
|
||||
(else
|
||||
(set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))))
|
||||
(set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))))
|
||||
(+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
|
||||
(+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-0 (new-stack-vector0)))
|
||||
(let ((s3-0 (new-stack-matrix0)))
|
||||
(matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x)))
|
||||
(vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0)
|
||||
(matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y)))
|
||||
(vector-matrix*! s4-0 s4-0 s3-0)
|
||||
)
|
||||
(forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down))
|
||||
)
|
||||
(set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z)))
|
||||
(if (< (-> self pivot-rad) 4096.0)
|
||||
(set! (-> self pivot-rad) 4096.0)
|
||||
)
|
||||
(set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0)
|
||||
(vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking)))
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport) #f)
|
||||
(else (cam-standard-event-handler proc argc message block))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(set! (-> self pivot-rad) 40960.0)
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))))
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(let ((s5-0 (new-stack-vector0))
|
||||
(gp-0 (new-stack-vector0)))
|
||||
(when *camera-read-analog*
|
||||
(let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0))
|
||||
(f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0))
|
||||
(f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0))
|
||||
(f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 -1.0)))
|
||||
(cond
|
||||
((cpad-hold? (-> *CAMERA-bank* joypad) r2)
|
||||
(set! (-> s5-0 y) (- (-> s5-0 y) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))))
|
||||
(set! (-> s5-0 x) (- (-> s5-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))))
|
||||
(+! (-> gp-0 x) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
|
||||
(+! (-> gp-0 z) (* 0.2 (-> *CAM_POINT_WATCH-bank* speed) f30-0)))
|
||||
(else
|
||||
(set! (-> s5-0 y) (- (-> s5-0 y) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f26-0))))
|
||||
(set! (-> s5-0 x) (- (-> s5-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* rot-speed) (- f0-0))))
|
||||
(+! (-> gp-0 x) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f28-0))
|
||||
(+! (-> gp-0 z) (* 2.0 (-> *CAM_POINT_WATCH-bank* speed) f30-0)))))
|
||||
(let ((s4-0 (new-stack-vector0)))
|
||||
(let ((s3-0 (new-stack-matrix0)))
|
||||
(matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x)))
|
||||
(vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0)
|
||||
(matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y)))
|
||||
(vector-matrix*! s4-0 s4-0 s3-0))
|
||||
(forward-down->inv-matrix (the-as matrix (-> self tracking)) s4-0 (-> *camera* local-down)))
|
||||
(set! (-> self pivot-rad) (- (-> self pivot-rad) (-> gp-0 z)))
|
||||
(if (< (-> self pivot-rad) 4096.0) (set! (-> self pivot-rad) 4096.0))
|
||||
(set-vector! gp-0 0.0 0.0 (- (-> self pivot-rad)) 1.0)
|
||||
(vector-matrix*! (-> self trans) gp-0 (the-as matrix (-> self tracking)))))
|
||||
(suspend)
|
||||
0)))
|
||||
|
||||
(deftype cam-free-bank (basic)
|
||||
((speed float)
|
||||
(rot-speed degrees)
|
||||
)
|
||||
)
|
||||
|
||||
((speed float)
|
||||
(rot-speed degrees)))
|
||||
|
||||
(define *CAM_FREE-bank* (new 'static 'cam-free-bank :speed 1600.0 :rot-speed (degrees 0.6)))
|
||||
|
||||
@@ -100,350 +69,187 @@
|
||||
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 x)
|
||||
(set! (-> arg0 x)
|
||||
(- (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 6))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 x)
|
||||
(- (-> arg0 x)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 6)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed)))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 triangle)
|
||||
(+! (-> arg0 x) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 4))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg0 x)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 4)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 square)
|
||||
(+! (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 7))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg0 y)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 7)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 circle)
|
||||
(set! (-> arg0 y)
|
||||
(- (-> arg0 y) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 5))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 y)
|
||||
(- (-> arg0 y)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 5)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))))
|
||||
(when arg2
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 l2)
|
||||
(+! (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 10))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg0 z)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 10)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 r2)
|
||||
(set! (-> arg0 z)
|
||||
(- (-> arg0 z) (+ (-> *CAM_FREE-bank* rot-speed) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 11))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(-> *CAM_FREE-bank* rot-speed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 z)
|
||||
(- (-> arg0 z)
|
||||
(+ (-> *CAM_FREE-bank* rot-speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 11)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* rot-speed))))))))
|
||||
(cond
|
||||
((not *cam-free-move-along-z*)
|
||||
)
|
||||
((not *camera-read-analog*)
|
||||
)
|
||||
((not *cam-free-move-along-z*))
|
||||
((not *camera-read-analog*))
|
||||
((cpad-hold? arg3 r2)
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 r1)
|
||||
(+! (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 9))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(* 0.2 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg1 y)
|
||||
(+ (* 0.2 (-> *CAM_FREE-bank* speed))
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed)))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 l1)
|
||||
(set! (-> arg1 y)
|
||||
(- (-> arg1 y) (+ (* 0.2 (-> *CAM_FREE-bank* speed)) (analog-input
|
||||
(the-as int (-> *cpad-list* cpads arg3 abutton 8))
|
||||
0.0
|
||||
32.0
|
||||
230.0
|
||||
(* 0.2 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg1 y)
|
||||
(- (-> arg1 y)
|
||||
(+ (* 0.2 (-> *CAM_FREE-bank* speed))
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (* 0.2 (-> *CAM_FREE-bank* speed)))))))))
|
||||
(else
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 r1)
|
||||
(+! (-> arg1 y)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 l1)
|
||||
(set! (-> arg1 y)
|
||||
(- (-> arg1 y)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 r1)
|
||||
(+! (-> arg1 y)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 9)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 l1)
|
||||
(set! (-> arg1 y)
|
||||
(- (-> arg1 y)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 8)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))))))
|
||||
(when (and (!= *master-mode* 'menu) (not *cam-layout*))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 left)
|
||||
(+! (-> arg1 x)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg1 x)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 1)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 right)
|
||||
(set! (-> arg1 x)
|
||||
(- (-> arg1 x)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg1 x)
|
||||
(- (-> arg1 x)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 0)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed)))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 up)
|
||||
(+! (-> arg1 z)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> arg1 z)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 2)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))
|
||||
(when *camera-read-buttons*
|
||||
(if (cpad-hold? arg3 down)
|
||||
(set! (-> arg1 z)
|
||||
(- (-> arg1 z)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg1 z)
|
||||
(- (-> arg1 z)
|
||||
(+ (-> *CAM_FREE-bank* speed)
|
||||
(analog-input (the-as int (-> *cpad-list* cpads arg3 abutton 3)) 0.0 32.0 230.0 (-> *CAM_FREE-bank* speed))))))))
|
||||
(when *camera-read-analog*
|
||||
(let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0))
|
||||
(f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0))
|
||||
(f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
|
||||
(f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
|
||||
(f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
|
||||
(f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
|
||||
)
|
||||
(when *display-load-boundaries*
|
||||
(when (and (!= arg3 1)
|
||||
(not (cpad-hold? 1 x))
|
||||
(not (cpad-hold? 1 r1))
|
||||
(not (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2)))
|
||||
)
|
||||
(not (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2))))
|
||||
(+! f28-14 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0))
|
||||
(+! f30-14 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0))
|
||||
(+! f24-0 (analog-input (the-as int (-> *cpad-list* cpads 1 rightx)) 128.0 48.0 110.0 -1.0))
|
||||
(+! f26-0 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))
|
||||
)
|
||||
)
|
||||
(+! f26-0 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0))))
|
||||
(cond
|
||||
((cpad-hold? arg3 r2)
|
||||
(cond
|
||||
((cpad-hold? arg3 l2)
|
||||
(set! (-> arg0 y) (- (-> arg0 y) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0))))
|
||||
)
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* 0.5 (-> *CAM_FREE-bank* rot-speed) (- f26-0)))))
|
||||
(else
|
||||
(set! (-> arg0 y) (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))))
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed))))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 y) (- (-> arg0 y) (* (- f24-0) (-> *CAM_FREE-bank* rot-speed))))
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* (- f26-0) (-> *CAM_FREE-bank* rot-speed))))))
|
||||
(+! (-> arg1 x) (* 0.2 (-> *CAM_FREE-bank* speed) f28-14))
|
||||
(+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14))
|
||||
)
|
||||
(+! (-> arg1 z) (* 0.2 (-> *CAM_FREE-bank* speed) f30-14)))
|
||||
((cpad-hold? arg3 l2)
|
||||
(+! (-> arg1 x) (* f28-14 (-> *CAM_FREE-bank* speed)))
|
||||
(+! (-> arg1 y) (* f26-0 (-> *CAM_FREE-bank* speed)))
|
||||
(+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed)))
|
||||
)
|
||||
(+! (-> arg1 z) (* f30-14 (-> *CAM_FREE-bank* speed))))
|
||||
(else
|
||||
(set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0))))
|
||||
(+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14))
|
||||
(+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 y) (- (-> arg0 y) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f24-0))))
|
||||
(set! (-> arg0 x) (- (-> arg0 x) (* 2.0 (-> *CAM_FREE-bank* rot-speed) (- f26-0))))
|
||||
(+! (-> arg1 x) (* 2.0 (-> *CAM_FREE-bank* speed) f28-14))
|
||||
(+! (-> arg1 z) (* 2.0 (-> *CAM_FREE-bank* speed) f30-14))))))
|
||||
(vector-float*! arg0 arg0 (-> *display* time-adjust-ratio))
|
||||
(vector-float*! arg1 arg1 (-> *display* time-adjust-ratio))
|
||||
)
|
||||
(vector-float*! arg1 arg1 (-> *display* time-adjust-ratio)))
|
||||
|
||||
(deftype camera-free-floating-move-info (structure)
|
||||
((rv vector :inline)
|
||||
(tv vector :inline)
|
||||
(up vector :inline)
|
||||
(tm matrix :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((rv vector :inline)
|
||||
(tv vector :inline)
|
||||
(up vector :inline)
|
||||
(tm matrix :inline)))
|
||||
|
||||
(defun cam-free-floating-move ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 int))
|
||||
(if (logtest? (-> *cpad-list* cpads arg3 valid) 128)
|
||||
(return (the-as vector #f))
|
||||
)
|
||||
(if (= *master-mode* 'menu)
|
||||
(return (the-as vector #f))
|
||||
)
|
||||
(if (logtest? (-> *cpad-list* cpads arg3 valid) 128) (return (the-as vector #f)))
|
||||
(if (= *master-mode* 'menu) (return (the-as vector #f)))
|
||||
(let ((s3-0 (new 'stack 'camera-free-floating-move-info)))
|
||||
(cam-free-floating-input (-> s3-0 rv) (-> s3-0 tv) (not arg2) arg3)
|
||||
(cond
|
||||
(arg2
|
||||
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
|
||||
(matrix*! arg0 arg0 (-> s3-0 tm))
|
||||
(cond
|
||||
((< (vector-dot (-> arg0 vector 1) arg2) 0.0)
|
||||
(forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2)
|
||||
)
|
||||
(else
|
||||
(vector-negate! (-> s3-0 up) arg2)
|
||||
(forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up))
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y)))
|
||||
(matrix*! arg0 arg0 (-> s3-0 tm))
|
||||
)
|
||||
)
|
||||
(matrix-axis-angle! (-> s3-0 tm) arg2 (-> s3-0 rv y))
|
||||
(matrix*! arg0 arg0 (-> s3-0 tm))
|
||||
(cond
|
||||
((< (vector-dot (-> arg0 vector 1) arg2) 0.0) (forward-down->inv-matrix arg0 (-> arg0 vector 2) arg2))
|
||||
(else (vector-negate! (-> s3-0 up) arg2) (forward-down->inv-matrix arg0 (-> arg0 vector 2) (-> s3-0 up)))))
|
||||
(else (matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 1) (- (-> s3-0 rv y))) (matrix*! arg0 arg0 (-> s3-0 tm))))
|
||||
(matrix-axis-angle! (-> s3-0 tm) (the-as vector (-> arg0 vector)) (- (-> s3-0 rv x)))
|
||||
(matrix*! arg0 arg0 (-> s3-0 tm))
|
||||
(matrix-axis-angle! (-> s3-0 tm) (-> arg0 vector 2) (- (-> s3-0 rv z)))
|
||||
(matrix*! arg0 arg0 (-> s3-0 tm))
|
||||
(vector-matrix*! (-> s3-0 tv) (-> s3-0 tv) arg0)
|
||||
(vector+! arg1 arg1 (-> s3-0 tv))
|
||||
)
|
||||
)
|
||||
(vector+! arg1 arg1 (-> s3-0 tv))))
|
||||
|
||||
(defstate cam-free-floating (camera-slave)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport)
|
||||
#f
|
||||
)
|
||||
(else
|
||||
(cam-standard-event-handler proc argc message block)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))
|
||||
(send-event *camera-combiner* 'stop-tracking)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(let ((a2-0 (-> *camera* local-down)))
|
||||
(if (logtest? (-> self options) 8)
|
||||
(set! a2-0 (the-as vector #f))
|
||||
)
|
||||
(cam-free-floating-move
|
||||
(the-as matrix (-> self tracking))
|
||||
(-> self trans)
|
||||
a2-0
|
||||
(the-as int (-> *CAMERA-bank* joypad))
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport) #f)
|
||||
(else (cam-standard-event-handler proc argc message block))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))
|
||||
(send-event *camera-combiner* 'stop-tracking)))
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(let ((a2-0 (-> *camera* local-down)))
|
||||
(if (logtest? (-> self options) 8) (set! a2-0 (the-as vector #f)))
|
||||
(cam-free-floating-move (the-as matrix (-> self tracking)) (-> self trans) a2-0 (the-as int (-> *CAMERA-bank* joypad))))
|
||||
(suspend))))
|
||||
|
||||
(deftype camera-orbit-info (structure)
|
||||
((radius float)
|
||||
(rot float)
|
||||
(target-off vector :inline)
|
||||
(orbit-off vector :inline)
|
||||
(radius-lerp float)
|
||||
)
|
||||
)
|
||||
|
||||
((radius float)
|
||||
(rot float)
|
||||
(target-off vector :inline)
|
||||
(orbit-off vector :inline)
|
||||
(radius-lerp float)))
|
||||
|
||||
(deftype CAM_ORBIT-bank (basic)
|
||||
((RADIUS_MAX float)
|
||||
(RADIUS_MIN float)
|
||||
(TARGET_OFF_ADJUST float)
|
||||
(ORBIT_OFF_ADJUST float)
|
||||
)
|
||||
)
|
||||
((RADIUS_MAX float)
|
||||
(RADIUS_MIN float)
|
||||
(TARGET_OFF_ADJUST float)
|
||||
(ORBIT_OFF_ADJUST float)))
|
||||
|
||||
|
||||
(define *CAM_ORBIT-bank* (new 'static 'CAM_ORBIT-bank
|
||||
:RADIUS_MAX 61440.0
|
||||
:RADIUS_MIN 409.6
|
||||
:TARGET_OFF_ADJUST 81.92
|
||||
:ORBIT_OFF_ADJUST 81.92
|
||||
)
|
||||
)
|
||||
(define *CAM_ORBIT-bank*
|
||||
(new 'static 'CAM_ORBIT-bank :RADIUS_MAX 61440.0 :RADIUS_MIN 409.6 :TARGET_OFF_ADJUST 81.92 :ORBIT_OFF_ADJUST 81.92))
|
||||
|
||||
(define *camera-orbit-info* (new 'static 'camera-orbit-info))
|
||||
|
||||
@@ -454,114 +260,63 @@
|
||||
(set! (-> *camera-orbit-info* orbit-off y) 4096.0)
|
||||
|
||||
(defstate cam-orbit (camera-slave)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport)
|
||||
#f
|
||||
)
|
||||
(else
|
||||
(cam-standard-event-handler proc argc message block)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(if (not *camera-orbit-target*)
|
||||
(cam-slave-go cam-free-floating)
|
||||
)
|
||||
(let ((v1-4 (new-stack-vector0)))
|
||||
(vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans))
|
||||
(set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z)))
|
||||
)
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))
|
||||
)
|
||||
)
|
||||
:exit (behavior ()
|
||||
'()
|
||||
)
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(if (not *camera-orbit-target*)
|
||||
(cam-slave-go cam-free-floating)
|
||||
)
|
||||
(when *camera-read-analog*
|
||||
(let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05)))
|
||||
(cond
|
||||
((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0)
|
||||
(+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))))
|
||||
)
|
||||
((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))
|
||||
(+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))
|
||||
)
|
||||
(else
|
||||
(+! (-> *camera-orbit-info* radius-lerp) f0-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> *camera-orbit-info* radius)
|
||||
(lerp (-> *CAM_ORBIT-bank* RADIUS_MIN) (-> *CAM_ORBIT-bank* RADIUS_MAX) (-> *camera-orbit-info* radius-lerp))
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((cpad-hold? 0 l2)
|
||||
(if (cpad-hold? 0 l1)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('teleport) #f)
|
||||
(else (cam-standard-event-handler proc argc message block))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(when (not (-> self enter-has-run))
|
||||
(if (not *camera-orbit-target*) (cam-slave-go cam-free-floating))
|
||||
(let ((v1-4 (new-stack-vector0)))
|
||||
(vector-! v1-4 (-> self trans) (-> *camera-orbit-target* 0 root trans))
|
||||
(set! (-> *camera-orbit-info* rot) (atan (-> v1-4 x) (-> v1-4 z))))
|
||||
(set! (-> self blend-from-type) (the-as uint 1))
|
||||
(set! (-> self blend-to-type) (the-as uint 1))))
|
||||
:exit
|
||||
(behavior ()
|
||||
'())
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(if (not *camera-orbit-target*) (cam-slave-go cam-free-floating))
|
||||
(when *camera-read-analog*
|
||||
(let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05)))
|
||||
(cond
|
||||
((< (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp))) f0-0)
|
||||
(+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- 1.0 (-> *camera-orbit-info* radius-lerp)))))
|
||||
((< f0-0 (* 0.05 (- (-> *camera-orbit-info* radius-lerp))))
|
||||
(+! (-> *camera-orbit-info* radius-lerp) (* 0.05 (- (-> *camera-orbit-info* radius-lerp)))))
|
||||
(else (+! (-> *camera-orbit-info* radius-lerp) f0-0))))
|
||||
(set! (-> *camera-orbit-info* radius)
|
||||
(lerp (-> *CAM_ORBIT-bank* RADIUS_MIN) (-> *CAM_ORBIT-bank* RADIUS_MAX) (-> *camera-orbit-info* radius-lerp))))
|
||||
(cond
|
||||
((cpad-hold? 0 l2)
|
||||
(if (cpad-hold? 0 l1)
|
||||
(set! (-> *camera-orbit-info* target-off y)
|
||||
(- (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST))
|
||||
)
|
||||
)
|
||||
(if (cpad-hold? 0 r1)
|
||||
(+! (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (cpad-hold? 0 l1)
|
||||
(set! (-> *camera-orbit-info* orbit-off y)
|
||||
(- (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST))
|
||||
)
|
||||
)
|
||||
(if (cpad-hold? 0 r1)
|
||||
(+! (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when *camera-read-analog*
|
||||
(let ((f0-20
|
||||
(analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame)))
|
||||
)
|
||||
)
|
||||
(set! (-> *camera-orbit-info* rot)
|
||||
(the float (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((gp-0 (new-stack-vector0)))
|
||||
(let ((s5-0 (new-stack-vector0)))
|
||||
(set-vector!
|
||||
(-> self trans)
|
||||
(+ (-> *camera-orbit-target* 0 root trans x)
|
||||
(* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
|
||||
)
|
||||
(-> *camera-orbit-target* 0 root trans y)
|
||||
(+ (-> *camera-orbit-target* 0 root trans z)
|
||||
(* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius))
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector+! (-> self trans) (-> self trans) (-> *camera-orbit-info* orbit-off))
|
||||
(vector+!
|
||||
(-> self tracking follow-pt)
|
||||
(-> *camera-orbit-target* 0 root trans)
|
||||
(-> *camera-orbit-info* target-off)
|
||||
)
|
||||
(vector-! s5-0 (-> self trans) (-> self tracking follow-pt))
|
||||
(set! (-> gp-0 y) (the float (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48)))
|
||||
(set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0)))
|
||||
)
|
||||
(set! (-> gp-0 z) 0.0)
|
||||
(matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(- (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST))))
|
||||
(if (cpad-hold? 0 r1) (+! (-> *camera-orbit-info* target-off y) (-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST))))
|
||||
(else
|
||||
(if (cpad-hold? 0 l1)
|
||||
(set! (-> *camera-orbit-info* orbit-off y)
|
||||
(- (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST))))
|
||||
(if (cpad-hold? 0 r1) (+! (-> *camera-orbit-info* orbit-off y) (-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)))))
|
||||
(when *camera-read-analog*
|
||||
(let ((f0-20 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame)))))
|
||||
(set! (-> *camera-orbit-info* rot) (the float (sar (shl (the int (+ (-> *camera-orbit-info* rot) f0-20)) 48) 48)))))
|
||||
(let ((gp-0 (new-stack-vector0)))
|
||||
(let ((s5-0 (new-stack-vector0)))
|
||||
(set-vector! (-> self trans)
|
||||
(+ (-> *camera-orbit-target* 0 root trans x) (* (sin (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)))
|
||||
(-> *camera-orbit-target* 0 root trans y)
|
||||
(+ (-> *camera-orbit-target* 0 root trans z) (* (cos (-> *camera-orbit-info* rot)) (-> *camera-orbit-info* radius)))
|
||||
1.0)
|
||||
(vector+! (-> self trans) (-> self trans) (-> *camera-orbit-info* orbit-off))
|
||||
(vector+! (-> self tracking follow-pt) (-> *camera-orbit-target* 0 root trans) (-> *camera-orbit-info* target-off))
|
||||
(vector-! s5-0 (-> self trans) (-> self tracking follow-pt))
|
||||
(set! (-> gp-0 y) (the float (sar (shl (the int (+ 32768.0 (atan (-> s5-0 x) (-> s5-0 z)))) 48) 48)))
|
||||
(set! (-> gp-0 x) (atan (-> s5-0 y) (vector-xz-length s5-0))))
|
||||
(set! (-> gp-0 z) 0.0)
|
||||
(matrix-rotate-zxy! (the-as matrix (-> self tracking)) gp-0))
|
||||
(suspend))))
|
||||
+1368
-2672
File diff suppressed because it is too large.
Load diff
@@ -1,29 +1,29 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/matrix.gc")
|
||||
(require "engine/util/smush-control-h.gc")
|
||||
|
||||
;; name: cam-update-h.gc
|
||||
;; name in dgo: cam-update-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defenum external-cam-option
|
||||
:bitfield #t
|
||||
(allow-z 0)
|
||||
)
|
||||
(allow-z 0))
|
||||
|
||||
(define *external-cam-options* (external-cam-option))
|
||||
(define *external-cam-mode* #f)
|
||||
(define-perm *camera-look-through-other* int 0)
|
||||
(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845))
|
||||
(define-perm *camera-other-trans* vector (vector-reset! (new 'global 'vector)))
|
||||
(define-perm *camera-other-matrix* matrix (matrix-identity! (new 'global 'matrix)))
|
||||
(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control)))
|
||||
(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
|
||||
|
||||
(define *external-cam-mode* #f)
|
||||
|
||||
(define-perm *camera-look-through-other* int 0)
|
||||
|
||||
(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845))
|
||||
|
||||
(define-perm *camera-other-trans* vector (vector-reset! (new 'global 'vector)))
|
||||
|
||||
(define-perm *camera-other-matrix* matrix (matrix-identity! (new 'global 'matrix)))
|
||||
|
||||
(define-perm *camera-smush-control* smush-control (set-zero! (new 'global 'smush-control)))
|
||||
|
||||
(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
|
||||
|
||||
;; TODO - actually defined in cam-states-dbg
|
||||
(define-extern cam-free-floating-move (function matrix vector vector int vector))
|
||||
|
||||
(define-extern cam-free-floating-input (function vector vector symbol int vector))
|
||||
@@ -1,7 +1,6 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/gfx/tie/tie-h.gc")
|
||||
(require "engine/level/bsp-h.gc")
|
||||
(require "engine/gfx/math-camera.gc")
|
||||
@@ -12,10 +11,6 @@
|
||||
(require "engine/gfx/background/wind.gc")
|
||||
(require "engine/math/quaternion.gc")
|
||||
|
||||
;; name: cam-update.gc
|
||||
;; name in dgo: cam-update
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; Once the camera's position and orientation has been calculated,
|
||||
;; the camera and visibility outputs are updated in this file.
|
||||
|
||||
@@ -28,10 +23,8 @@
|
||||
(set! (-> (&-> arg0 0 data arg4) 0) (-> s4-0 x))
|
||||
(set! (-> (&-> arg0 0 data arg4) 4) (-> s4-0 y))
|
||||
(set! (-> (&-> arg0 0 data arg4) 8) (-> s4-0 z))
|
||||
(set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(set! (-> (&-> arg0 0 data arg4) 12) (-> s4-0 w)))
|
||||
(none))
|
||||
|
||||
(defun set-point ((arg0 vector) (arg1 float) (arg2 float) (arg3 float))
|
||||
"Set a vector to an xyz point (sets w = 1.0)"
|
||||
@@ -39,8 +32,7 @@
|
||||
(set! (-> arg0 y) arg2)
|
||||
(set! (-> arg0 z) arg3)
|
||||
(set! (-> arg0 w) 1.0)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float))
|
||||
"Compute the frustum planes from the given camera."
|
||||
@@ -50,8 +42,7 @@
|
||||
(let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d)))
|
||||
(f26-0 (* arg2 (-> arg0 y-ratio) (-> arg0 d)))
|
||||
(f28-0 (* arg2 (-> arg0 x-ratio) (-> arg0 f)))
|
||||
(f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f)))
|
||||
)
|
||||
(f24-0 (* arg2 (-> arg0 y-ratio) (-> arg0 f))))
|
||||
(set-point (-> s5-0 hither-top-left) (- f30-0) f26-0 (-> arg0 d))
|
||||
(set-point (-> s5-0 hither-top-right) f30-0 f26-0 (-> arg0 d))
|
||||
(set-point (-> s5-0 hither-bottom-left) (- f30-0) (- f26-0) (-> arg0 d))
|
||||
@@ -59,8 +50,7 @@
|
||||
(set-point (-> s5-0 yon-top-left) (- f28-0) f24-0 (-> arg0 f))
|
||||
(set-point (-> s5-0 yon-top-right) f28-0 f24-0 (-> arg0 f))
|
||||
(set-point (-> s5-0 yon-bottom-left) (- f28-0) (- f24-0) (-> arg0 f))
|
||||
(set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f))
|
||||
)
|
||||
(set-point (-> s5-0 yon-bottom-right) f28-0 (- f24-0) (-> arg0 f)))
|
||||
(vector-matrix*! (-> s5-0 hither-top-left) (-> s5-0 hither-top-left) (-> arg0 inv-camera-rot))
|
||||
(vector-matrix*! (-> s5-0 hither-top-right) (-> s5-0 hither-top-right) (-> arg0 inv-camera-rot))
|
||||
(vector-matrix*! (-> s5-0 hither-bottom-left) (-> s5-0 hither-bottom-left) (-> arg0 inv-camera-rot))
|
||||
@@ -72,14 +62,11 @@
|
||||
(let ((s2-0 (new-stack-vector0))
|
||||
(s3-1 (new-stack-vector0))
|
||||
(s1-0 (new-stack-vector0))
|
||||
(s0-0 (new-stack-vector0))
|
||||
)
|
||||
(s0-0 (new-stack-vector0)))
|
||||
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
|
||||
(set! sv-240 (new 'stack-no-clear 'vector))
|
||||
(set! (-> sv-240 quad) (the-as uint128 0))
|
||||
(let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad)))
|
||||
(set! (-> sv-240 quad) v1-5)
|
||||
)
|
||||
(let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad))) (set! (-> sv-240 quad) v1-5))
|
||||
(vector-! s2-0 (-> s5-0 yon-top-left) sv-240)
|
||||
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
|
||||
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
|
||||
@@ -88,15 +75,9 @@
|
||||
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
|
||||
(plane-from-points arg1 s3-1 s2-0 sv-240 2)
|
||||
(let ((t9-20 plane-from-points)
|
||||
(t0-3 3)
|
||||
)
|
||||
(t9-20 arg1 s1-0 s0-0 sv-240 t0-3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(t0-3 3))
|
||||
(t9-20 arg1 s1-0 s0-0 sv-240 t0-3)))))
|
||||
(none))
|
||||
|
||||
;; if we should still attempt vis updates when outside of the bsp's boxes.
|
||||
(define *update-leaf-when-outside-bsp* #t)
|
||||
@@ -112,29 +93,17 @@
|
||||
(dotimes (s5-0 (-> *level* length))
|
||||
(let ((v1-4 (-> *level* level s5-0)))
|
||||
(when (= (-> v1-4 status) 'active)
|
||||
(if (and (nonzero? (-> v1-4 bsp nodes))
|
||||
(or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?))
|
||||
)
|
||||
;; will store in the bsp's current-leaf-idx.
|
||||
(bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(if (and (nonzero? (-> v1-4 bsp nodes)) (or *update-leaf-when-outside-bsp* (-> v1-4 inside-boxes?)))
|
||||
;; will store in the bsp's current-leaf-idx.
|
||||
(bsp-camera-asm (-> v1-4 bsp) (-> arg0 trans))))))
|
||||
;; do vis updates.
|
||||
(dotimes (gp-1 (-> *level* length))
|
||||
(let ((s5-1 (-> *level* level gp-1)))
|
||||
(when (= (-> s5-1 status) 'active)
|
||||
(let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16)))
|
||||
|
||||
;; start by setting all-visible to something truthy (either original, or #t)
|
||||
;; below, we'll try to figure out a way to get vis data and set this back to #f.
|
||||
(set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?)
|
||||
(-> s5-1 all-visible?)
|
||||
#t
|
||||
)
|
||||
)
|
||||
(set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?) (-> s5-1 all-visible?) #t))
|
||||
(cond
|
||||
((or (not (-> s5-1 force-all-visible?)) (-> s5-1 inside-boxes?))
|
||||
;; we are inside the level's bsp, we should attempt vis stuff.
|
||||
@@ -142,101 +111,57 @@
|
||||
((or *artist-all-visible* (zero? (-> s5-1 bsp nodes)))
|
||||
;; we have no bsp, or manual override all visible. Copy the all vis list
|
||||
;; to our vis string.
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
|
||||
)
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0))
|
||||
((begin
|
||||
;; our vis info
|
||||
(set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index)))
|
||||
;; adj vis info (idx will be 7 if there's no adj right now, and will give us #f)
|
||||
(set! s3-0 (-> s5-1 vis-info (-> s5-1 vis-adj-index)))
|
||||
|
||||
(let ((v1-32 #f)) ;; should use self vis
|
||||
(set! a0-16 #f) ;; should use adj vis
|
||||
|
||||
;; see if we want self vis
|
||||
(when s4-0
|
||||
(set! v1-32 (nonzero? (logand (shl #x8000 16) (-> s4-0 flags))))
|
||||
|
||||
;; not sure when this would happen, but make sure that our leaf
|
||||
;; index is in bounds (maybe if you use the wrong version of levels)
|
||||
(if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx))
|
||||
(set! v1-32 #f)
|
||||
)
|
||||
)
|
||||
|
||||
(if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx)) (set! v1-32 #f)))
|
||||
;; see if we want adj vis.
|
||||
(when s3-0
|
||||
(set! a0-16 (nonzero? (logand (shl #x8000 16) (-> s3-0 flags))))
|
||||
(if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx))
|
||||
(set! a0-16 #f)
|
||||
)
|
||||
)
|
||||
(if (< (-> s3-0 length) (-> s3-0 from-bsp current-leaf-idx)) (set! a0-16 #f)))
|
||||
v1-32 ;; this is the cond condition, and is if we want the self vis.
|
||||
)
|
||||
)
|
||||
))
|
||||
;; want self. clear all visible if we aren't loading.
|
||||
(if (!= (-> s5-1 all-visible?) 'loading)
|
||||
(set! (-> s5-1 all-visible?) #f)
|
||||
)
|
||||
(if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f))
|
||||
(when (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (-> s4-0 string-block))
|
||||
;; success! Remove all other vis strings.
|
||||
;; if update vis failed (due to still loading, etc), keep previous.
|
||||
(countdown (v1-40 8)
|
||||
(let ((a0-22 (-> s5-1 vis-info v1-40)))
|
||||
(when a0-22
|
||||
(if (!= a0-22 s4-0)
|
||||
(set! (-> a0-22 current-vis-string) (the-as uint -1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (!= a0-22 s4-0) (set! (-> a0-22 current-vis-string) (the-as uint -1))))))
|
||||
;; successful vis update, remove all-visible.
|
||||
(set! (-> s5-1 all-visible?) #f)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-1 all-visible?) #f)))
|
||||
;; same case as above, but if we want to use the other vis.
|
||||
(a0-16
|
||||
(if (!= (-> s5-1 all-visible?) 'loading)
|
||||
(set! (-> s5-1 all-visible?) #f)
|
||||
)
|
||||
(when
|
||||
(update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block))
|
||||
(countdown (v1-50 8)
|
||||
(let ((a0-27 (-> s5-1 vis-info v1-50)))
|
||||
(when a0-27
|
||||
(if (!= a0-27 s3-0)
|
||||
(set! (-> a0-27 current-vis-string) (the-as uint -1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-1 all-visible?) #f)
|
||||
)
|
||||
)
|
||||
(if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f))
|
||||
(when (update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block))
|
||||
(countdown (v1-50 8)
|
||||
(let ((a0-27 (-> s5-1 vis-info v1-50)))
|
||||
(when a0-27
|
||||
(if (!= a0-27 s3-0) (set! (-> a0-27 current-vis-string) (the-as uint -1))))))
|
||||
(set! (-> s5-1 all-visible?) #f)))
|
||||
((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?))
|
||||
;; if we're in between vis, then leave the old string.
|
||||
)
|
||||
(else
|
||||
;; couldn't find any vis, just make everything visible
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; couldn't find any vis, just make everything visible
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0))))
|
||||
(else
|
||||
;; outside boxes, and force all visible is set.
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (and *stats-bsp* (= *master-mode* 'game))
|
||||
(format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
;; outside boxes, and force all visible is set.
|
||||
(quad-copy! (-> s5-1 vis-bits) (-> s5-1 bsp all-visible-list) a2-0))))
|
||||
(if (and *stats-bsp* (= *master-mode* 'game)) (format *stdcon* "~0kleaf-index = ~d~%" (-> s5-1 bsp current-leaf-idx))))))
|
||||
#f))
|
||||
|
||||
(define *save-camera-inv-rot* (new 'global 'matrix))
|
||||
|
||||
@@ -244,48 +169,27 @@
|
||||
|
||||
(defun move-camera-from-pad ((arg0 math-camera))
|
||||
(let ((v1-0 *external-cam-mode*)
|
||||
(s5-0 0)
|
||||
)
|
||||
(s5-0 0))
|
||||
(cond
|
||||
((= v1-0 'locked)
|
||||
(set! v1-0 #f)
|
||||
)
|
||||
((= v1-0 'pad-1)
|
||||
(set! s5-0 1)
|
||||
)
|
||||
((not *camera-combiner*)
|
||||
(set! v1-0 'pad-0)
|
||||
)
|
||||
)
|
||||
((= v1-0 'locked) (set! v1-0 #f))
|
||||
((= v1-0 'pad-1) (set! s5-0 1))
|
||||
((not *camera-combiner*) (set! v1-0 'pad-0)))
|
||||
(when v1-0
|
||||
(let ((s4-1
|
||||
(vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0))
|
||||
)
|
||||
)
|
||||
(if (= (vector-length s4-1) 0.0)
|
||||
(set! (-> s4-1 y) -1.0)
|
||||
)
|
||||
(if (logtest? *external-cam-options* (external-cam-option allow-z))
|
||||
(set! s4-1 (the-as vector #f))
|
||||
)
|
||||
(cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-1 (vector-negate-in-place! (vector-normalize-copy! (new-stack-vector0) (-> *standard-dynamics* gravity) 1.0))))
|
||||
(if (= (vector-length s4-1) 0.0) (set! (-> s4-1 y) -1.0))
|
||||
(if (logtest? *external-cam-options* (external-cam-option allow-z)) (set! s4-1 (the-as vector #f)))
|
||||
(cam-free-floating-move *save-camera-inv-rot* (-> arg0 trans) s4-1 s5-0))))
|
||||
(let* ((a2-2 (-> *math-camera* inv-camera-rot))
|
||||
(a3-1 *save-camera-inv-rot*)
|
||||
(v1-11 (-> a3-1 vector 0 quad))
|
||||
(a0-14 (-> a3-1 vector 1 quad))
|
||||
(a1-2 (-> a3-1 vector 2 quad))
|
||||
(a3-2 (-> a3-1 vector 3 quad))
|
||||
)
|
||||
(a3-2 (-> a3-1 vector 3 quad)))
|
||||
(set! (-> a2-2 vector 0 quad) v1-11)
|
||||
(set! (-> a2-2 vector 1 quad) a0-14)
|
||||
(set! (-> a2-2 vector 2 quad) a1-2)
|
||||
(set! (-> a2-2 vector 3 quad) a3-2)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(set! (-> a2-2 vector 3 quad) a3-2))
|
||||
arg0)
|
||||
|
||||
;; og:preserve-this PAL patch here (moved from cam-debug)
|
||||
(defun external-cam-reset! ()
|
||||
@@ -297,18 +201,14 @@
|
||||
(a0-2 (-> a3-0 vector 0 quad))
|
||||
(a1-0 (-> a3-0 vector 1 quad))
|
||||
(a2-0 (-> a3-0 vector 2 quad))
|
||||
(a3-1 (-> a3-0 vector 3 quad))
|
||||
)
|
||||
(a3-1 (-> a3-0 vector 3 quad)))
|
||||
(set! (-> v1-6 vector 0 quad) a0-2)
|
||||
(set! (-> v1-6 vector 1 quad) a1-0)
|
||||
(set! (-> v1-6 vector 2 quad) a2-0)
|
||||
(set! (-> v1-6 vector 3 quad) a3-1)
|
||||
)
|
||||
(set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))
|
||||
)
|
||||
(set! (-> v1-6 vector 3 quad) a3-1))
|
||||
(set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(define *start-timer* (the-as int #f))
|
||||
|
||||
@@ -319,87 +219,51 @@
|
||||
(defun update-camera ()
|
||||
(when *start-timer*
|
||||
(when (= *timer-value* 180)
|
||||
(format
|
||||
#t
|
||||
"Player pos = ~F ~F ~F~%"
|
||||
(-> *target* control trans x)
|
||||
(-> *target* control trans y)
|
||||
(-> *target* control trans z)
|
||||
)
|
||||
(set! (-> *start-pos* quad) (-> *target* control trans quad))
|
||||
)
|
||||
(format #t
|
||||
"Player pos = ~F ~F ~F~%"
|
||||
(-> *target* control trans x)
|
||||
(-> *target* control trans y)
|
||||
(-> *target* control trans z))
|
||||
(set! (-> *start-pos* quad) (-> *target* control trans quad)))
|
||||
(when (= *timer-value* 480)
|
||||
(format
|
||||
#t
|
||||
"Player pos = ~F ~F ~F~%"
|
||||
(-> *target* control trans x)
|
||||
(-> *target* control trans y)
|
||||
(-> *target* control trans z)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"Dist = ~F~%"
|
||||
(* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*))
|
||||
)
|
||||
(set! *start-timer* (the-as int #f))
|
||||
)
|
||||
(if (< 179 *timer-value*)
|
||||
(format *stdcon* "~%~%Time = ~D~%" *timer-value*)
|
||||
)
|
||||
(set! *timer-value* (+ *timer-value* 1))
|
||||
)
|
||||
(format #t
|
||||
"Player pos = ~F ~F ~F~%"
|
||||
(-> *target* control trans x)
|
||||
(-> *target* control trans y)
|
||||
(-> *target* control trans z))
|
||||
(format #t "Dist = ~F~%" (* 0.00024414062 (vector-vector-xz-distance (-> *target* control trans) *start-pos*)))
|
||||
(set! *start-timer* (the-as int #f)))
|
||||
(if (< 179 *timer-value*) (format *stdcon* "~%~%Time = ~D~%" *timer-value*))
|
||||
(set! *timer-value* (+ *timer-value* 1)))
|
||||
(when (not *start-timer*)
|
||||
(set! *timer-value* 0)
|
||||
0
|
||||
)
|
||||
0)
|
||||
(dotimes (gp-1 2)
|
||||
(let ((s5-1 (-> *level* level gp-1)))
|
||||
(when (!= (-> s5-1 status) 'inactive)
|
||||
(let ((a0-14 (new-stack-vector0)))
|
||||
(vector-! a0-14 (the-as vector (-> s5-1 info bsphere)) (-> *math-camera* trans))
|
||||
(set! (-> s5-1 level-distance) (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w))))
|
||||
)
|
||||
(set! (-> s5-1 level-distance) (fmax 0.0 (- (vector-length a0-14) (-> s5-1 info bsphere w)))))
|
||||
(when *display-level-spheres*
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> s5-1 info bsphere)
|
||||
(-> s5-1 info bsphere w)
|
||||
(new 'static 'rgba :r #xff :a #x80)
|
||||
)
|
||||
(format
|
||||
*stdcon*
|
||||
"~f ~f ~f ~f~%"
|
||||
(* 0.00024414062 (-> s5-1 info bsphere x))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere y))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere z))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere w))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(update-math-camera
|
||||
*math-camera*
|
||||
(-> *setting-control* current video-mode)
|
||||
(-> *setting-control* current aspect-ratio)
|
||||
)
|
||||
(add-debug-sphere #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> s5-1 info bsphere)
|
||||
(-> s5-1 info bsphere w)
|
||||
(new 'static 'rgba :r #xff :a #x80))
|
||||
(format *stdcon*
|
||||
"~f ~f ~f ~f~%"
|
||||
(* 0.00024414062 (-> s5-1 info bsphere x))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere y))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere z))
|
||||
(* 0.00024414062 (-> s5-1 info bsphere w)))))))
|
||||
(update-math-camera *math-camera* (-> *setting-control* current video-mode) (-> *setting-control* current aspect-ratio))
|
||||
(update! *camera-smush-control*)
|
||||
(cond
|
||||
((or (= *master-mode* 'pause) (= *master-mode* 'progress) *progress-process*)
|
||||
)
|
||||
((>= *camera-look-through-other* 2)
|
||||
(set! *camera-look-through-other* 1)
|
||||
)
|
||||
((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu))
|
||||
(set! *camera-look-through-other* 0)
|
||||
0
|
||||
)
|
||||
)
|
||||
((or (= *master-mode* 'pause) (= *master-mode* 'progress) *progress-process*))
|
||||
((>= *camera-look-through-other* 2) (set! *camera-look-through-other* 1))
|
||||
((and (= *camera-look-through-other* 1) (!= *master-mode* 'menu)) (set! *camera-look-through-other* 0) 0))
|
||||
(cond
|
||||
(*external-cam-mode*
|
||||
(move-camera-from-pad *math-camera*)
|
||||
)
|
||||
(*external-cam-mode* (move-camera-from-pad *math-camera*))
|
||||
((nonzero? *camera-look-through-other*)
|
||||
(set! (-> *math-camera* fov) (-> *camera-other-fov* data))
|
||||
(set! (-> *math-camera* trans quad) (-> *camera-other-trans* quad))
|
||||
@@ -409,26 +273,21 @@
|
||||
(v1-86 (-> a3-4 vector 0 quad))
|
||||
(a0-29 (-> a3-4 vector 1 quad))
|
||||
(a1-10 (-> a3-4 vector 2 quad))
|
||||
(a3-5 (-> a3-4 vector 3 quad))
|
||||
)
|
||||
(a3-5 (-> a3-4 vector 3 quad)))
|
||||
(set! (-> a2-9 vector 0 quad) v1-86)
|
||||
(set! (-> a2-9 vector 1 quad) a0-29)
|
||||
(set! (-> a2-9 vector 2 quad) a1-10)
|
||||
(set! (-> a2-9 vector 3 quad) a3-5)
|
||||
)
|
||||
(set! (-> a2-9 vector 3 quad) a3-5))
|
||||
(let* ((a2-10 *save-camera-inv-rot*)
|
||||
(a3-6 *camera-other-matrix*)
|
||||
(v1-87 (-> a3-6 vector 0 quad))
|
||||
(a0-30 (-> a3-6 vector 1 quad))
|
||||
(a1-11 (-> a3-6 vector 2 quad))
|
||||
(a3-7 (-> a3-6 vector 3 quad))
|
||||
)
|
||||
(a3-7 (-> a3-6 vector 3 quad)))
|
||||
(set! (-> a2-10 vector 0 quad) v1-87)
|
||||
(set! (-> a2-10 vector 1 quad) a0-30)
|
||||
(set! (-> a2-10 vector 2 quad) a1-11)
|
||||
(set! (-> a2-10 vector 3 quad) a3-7)
|
||||
)
|
||||
)
|
||||
(set! (-> a2-10 vector 3 quad) a3-7)))
|
||||
((and *camera-combiner* (not *external-cam-mode*))
|
||||
(set! (-> *math-camera* fov) (-> *camera-combiner* fov))
|
||||
(set! (-> *math-camera* trans quad) (-> *camera-combiner* trans quad))
|
||||
@@ -438,151 +297,104 @@
|
||||
(a0-36 (-> a3-8 vector 0 quad))
|
||||
(a1-12 (-> a3-8 vector 1 quad))
|
||||
(a2-11 (-> a3-8 vector 2 quad))
|
||||
(a3-9 (-> a3-8 vector 3 quad))
|
||||
)
|
||||
(a3-9 (-> a3-8 vector 3 quad)))
|
||||
(set! (-> v1-100 vector 0 quad) a0-36)
|
||||
(set! (-> v1-100 vector 1 quad) a1-12)
|
||||
(set! (-> v1-100 vector 2 quad) a2-11)
|
||||
(set! (-> v1-100 vector 3 quad) a3-9)
|
||||
)
|
||||
(set! (-> v1-100 vector 3 quad) a3-9))
|
||||
(let* ((v1-101 *save-camera-inv-rot*)
|
||||
(a3-10 (-> *camera-combiner* inv-camera-rot))
|
||||
(a0-38 (-> a3-10 vector 0 quad))
|
||||
(a1-13 (-> a3-10 vector 1 quad))
|
||||
(a2-12 (-> a3-10 vector 2 quad))
|
||||
(a3-11 (-> a3-10 vector 3 quad))
|
||||
)
|
||||
(a3-11 (-> a3-10 vector 3 quad)))
|
||||
(set! (-> v1-101 vector 0 quad) a0-38)
|
||||
(set! (-> v1-101 vector 1 quad) a1-13)
|
||||
(set! (-> v1-101 vector 2 quad) a2-12)
|
||||
(set! (-> v1-101 vector 3 quad) a3-11)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(move-camera-from-pad *math-camera*)
|
||||
)
|
||||
)
|
||||
(set! (-> v1-101 vector 3 quad) a3-11)))
|
||||
(else (move-camera-from-pad *math-camera*)))
|
||||
(matrix-transpose! (-> *math-camera* camera-rot) (-> *math-camera* inv-camera-rot))
|
||||
(cond
|
||||
(*camera-no-mip-correction*
|
||||
(set! (-> *math-camera* fov-correction-factor) 1.0)
|
||||
)
|
||||
(*camera-no-mip-correction* (set! (-> *math-camera* fov-correction-factor) 1.0))
|
||||
(else
|
||||
(let ((f0-28 (fmin 11650.845 (-> *math-camera* fov))))
|
||||
(set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f0-28 (fmin 11650.845 (-> *math-camera* fov))))
|
||||
(set! (-> *math-camera* fov-correction-factor) (* 0.00008583069 f0-28)))))
|
||||
(if (< 0.0 (-> *math-camera* smooth-t))
|
||||
(set! (-> *math-camera* smooth-t) (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step)))
|
||||
)
|
||||
(set! (-> *math-camera* smooth-t) (- (-> *math-camera* smooth-t) (-> *math-camera* smooth-step))))
|
||||
(cond
|
||||
((< 0.0 (-> *math-camera* smooth-t))
|
||||
(let ((gp-2 (new-stack-quaternion0)))
|
||||
(matrix->quaternion gp-2 (-> *math-camera* inv-camera-rot))
|
||||
(quaternion-slerp! gp-2 gp-2 (-> *math-camera* inv-camera-rot-smooth-from) (-> *math-camera* smooth-t))
|
||||
(quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2)
|
||||
)
|
||||
)
|
||||
(quaternion->matrix (-> *math-camera* inv-camera-rot-smooth) gp-2)))
|
||||
(else
|
||||
(let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth))
|
||||
(a3-13 (-> *math-camera* inv-camera-rot))
|
||||
(a0-45 (-> a3-13 vector 0 quad))
|
||||
(a1-18 (-> a3-13 vector 1 quad))
|
||||
(a2-14 (-> a3-13 vector 2 quad))
|
||||
(a3-14 (-> a3-13 vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-124 vector 0 quad) a0-45)
|
||||
(set! (-> v1-124 vector 1 quad) a1-18)
|
||||
(set! (-> v1-124 vector 2 quad) a2-14)
|
||||
(set! (-> v1-124 vector 3 quad) a3-14)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((v1-124 (-> *math-camera* inv-camera-rot-smooth))
|
||||
(a3-13 (-> *math-camera* inv-camera-rot))
|
||||
(a0-45 (-> a3-13 vector 0 quad))
|
||||
(a1-18 (-> a3-13 vector 1 quad))
|
||||
(a2-14 (-> a3-13 vector 2 quad))
|
||||
(a3-14 (-> a3-13 vector 3 quad)))
|
||||
(set! (-> v1-124 vector 0 quad) a0-45)
|
||||
(set! (-> v1-124 vector 1 quad) a1-18)
|
||||
(set! (-> v1-124 vector 2 quad) a2-14)
|
||||
(set! (-> v1-124 vector 3 quad) a3-14))))
|
||||
(if (and (!= *master-mode* 'menu) *display-camera-info*)
|
||||
(format
|
||||
*stdcon*
|
||||
"cam pos ~M ~M ~M~%"
|
||||
(-> *math-camera* trans x)
|
||||
(-> *math-camera* trans y)
|
||||
(-> *math-camera* trans z)
|
||||
)
|
||||
)
|
||||
(format *stdcon* "cam pos ~M ~M ~M~%" (-> *math-camera* trans x) (-> *math-camera* trans y) (-> *math-camera* trans z)))
|
||||
(when (zero? (-> *math-camera* reset))
|
||||
(let* ((v1-136 (-> *math-camera* prev-camera-temp))
|
||||
(a3-16 (-> *math-camera* camera-temp))
|
||||
(a0-50 (-> a3-16 vector 0 quad))
|
||||
(a1-20 (-> a3-16 vector 1 quad))
|
||||
(a2-16 (-> a3-16 vector 2 quad))
|
||||
(a3-17 (-> a3-16 vector 3 quad))
|
||||
)
|
||||
(a3-17 (-> a3-16 vector 3 quad)))
|
||||
(set! (-> v1-136 vector 0 quad) a0-50)
|
||||
(set! (-> v1-136 vector 1 quad) a1-20)
|
||||
(set! (-> v1-136 vector 2 quad) a2-16)
|
||||
(set! (-> v1-136 vector 3 quad) a3-17)
|
||||
)
|
||||
)
|
||||
(set! (-> v1-136 vector 3 quad) a3-17)))
|
||||
(let ((gp-3 (-> *math-camera* camera-temp))
|
||||
(s4-1 (-> *math-camera* camera-rot))
|
||||
(s5-2 (-> *math-camera* inv-camera-rot))
|
||||
(s3-0 (-> *math-camera* trans))
|
||||
)
|
||||
(s3-0 (-> *math-camera* trans)))
|
||||
(let ((s2-0 (new-stack-vector0)))
|
||||
(set! (-> s2-0 x) (- (-> s3-0 x)))
|
||||
(set! (-> s2-0 y) (- (-> s3-0 y)))
|
||||
(set! (-> s2-0 z) (- (-> s3-0 z)))
|
||||
(set! (-> s2-0 w) 1.0)
|
||||
(vector-matrix*! s2-0 s2-0 s4-1)
|
||||
(set! (-> s4-1 vector 3 quad) (-> s2-0 quad))
|
||||
)
|
||||
(set! (-> s4-1 vector 3 quad) (-> s2-0 quad)))
|
||||
(matrix*! gp-3 s4-1 (-> *math-camera* perspective))
|
||||
(set! (-> s5-2 vector 3 quad) (-> s3-0 quad))
|
||||
)
|
||||
(set! (-> s5-2 vector 3 quad) (-> s3-0 quad)))
|
||||
(when (nonzero? (-> *math-camera* reset))
|
||||
(let* ((v1-148 (-> *math-camera* prev-camera-temp))
|
||||
(a3-18 (-> *math-camera* camera-temp))
|
||||
(a0-54 (-> a3-18 vector 0 quad))
|
||||
(a1-23 (-> a3-18 vector 1 quad))
|
||||
(a2-19 (-> a3-18 vector 2 quad))
|
||||
(a3-19 (-> a3-18 vector 3 quad))
|
||||
)
|
||||
(a3-19 (-> a3-18 vector 3 quad)))
|
||||
(set! (-> v1-148 vector 0 quad) a0-54)
|
||||
(set! (-> v1-148 vector 1 quad) a1-23)
|
||||
(set! (-> v1-148 vector 2 quad) a2-19)
|
||||
(set! (-> v1-148 vector 3 quad) a3-19)
|
||||
)
|
||||
(set! (-> v1-148 vector 3 quad) a3-19))
|
||||
(set! (-> *math-camera* reset) 0)
|
||||
0
|
||||
)
|
||||
0)
|
||||
(let ((f0-45 (-> *math-camera* fog-min))
|
||||
(f1-10 (-> *math-camera* fog-max))
|
||||
)
|
||||
(f1-10 (-> *math-camera* fog-max)))
|
||||
(let ((f2-0 (-> *math-camera* d)))
|
||||
(set! (-> *instance-tie-work* hmge-d x) f0-45)
|
||||
(set! (-> *instance-tie-work* hmge-d y) f1-10)
|
||||
(set! (-> *instance-tie-work* hmge-d z) (* 32.0 f2-0))
|
||||
(set! (-> *instance-tie-work* hmge-d w) (* f2-0 (-> *math-camera* hmge-scale w)))
|
||||
(let ((v1-160 (-> *math-camera* hvdf-off quad)))
|
||||
(set! (-> *instance-tie-work* hvdf-offset quad) v1-160)
|
||||
)
|
||||
(let ((v1-160 (-> *math-camera* hvdf-off quad))) (set! (-> *instance-tie-work* hvdf-offset quad) v1-160))
|
||||
(set! (-> *instance-shrub-work* hmge-d x) f0-45)
|
||||
(set! (-> *instance-shrub-work* hmge-d y) f1-10)
|
||||
(set! (-> *instance-shrub-work* hmge-d z) (* 3.0 f2-0))
|
||||
(set! (-> *instance-shrub-work* hmge-d w) (* f2-0 (-> *math-camera* hmge-scale w)))
|
||||
(set! (-> *instance-shrub-work* billboard-const x)
|
||||
(/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio)))
|
||||
)
|
||||
(set! (-> *instance-shrub-work* billboard-const y)
|
||||
(/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio)))
|
||||
)
|
||||
)
|
||||
(set! (-> *instance-shrub-work* billboard-const x) (/ (-> *math-camera* x-pix) (* f2-0 (-> *math-camera* x-ratio))))
|
||||
(set! (-> *instance-shrub-work* billboard-const y) (/ (-> *math-camera* y-pix) (* f2-0 (-> *math-camera* y-ratio)))))
|
||||
(set! (-> *instance-shrub-work* billboard-const z) f0-45)
|
||||
(set! (-> *instance-shrub-work* billboard-const w) f1-10)
|
||||
)
|
||||
(set! (-> *instance-shrub-work* billboard-const w) f1-10))
|
||||
(set! (-> *instance-shrub-work* constants w) (the-as float (-> *math-camera* vis-gifs 0 fog0)))
|
||||
(let ((a0-56 (-> *math-camera* hvdf-off quad)))
|
||||
(set! (-> *instance-shrub-work* hvdf-offset quad) a0-56)
|
||||
)
|
||||
(let ((a0-56 (-> *math-camera* hvdf-off quad))) (set! (-> *instance-shrub-work* hvdf-offset quad) a0-56))
|
||||
(update-view-planes *math-camera* (-> *math-camera* plane) 1.0)
|
||||
(update-view-planes *math-camera* (-> *math-camera* guard-plane) 4.0)
|
||||
(set! (-> *instance-shrub-work* guard-plane 0 quad) (-> *math-camera* guard-plane 0 quad))
|
||||
@@ -594,12 +406,5 @@
|
||||
(set! (-> *instance-tie-work* guard-plane 2 quad) (-> *math-camera* guard-plane 2 quad))
|
||||
(set! (-> *instance-tie-work* guard-plane 3 quad) (-> *math-camera* guard-plane 3 quad))
|
||||
(update-visible *math-camera*)
|
||||
(if (not (paused?))
|
||||
(update-wind *wind-work* *wind-scales*)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(if (not (paused?)) (update-wind *wind-work* *wind-scales*))
|
||||
#f)
|
||||
@@ -1,33 +1,38 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector-h.gc")
|
||||
(require "engine/gfx/hw/display-h.gc")
|
||||
|
||||
;; name: camera-h.gc
|
||||
;; name in dgo: camera-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; TODO - for cam-layout
|
||||
(define-extern v-slrp2! (function vector vector vector float vector float vector))
|
||||
|
||||
(define-extern v-slrp3! (function vector vector vector vector float vector))
|
||||
|
||||
(declare-type camera-slave process)
|
||||
|
||||
(declare-type camera-master process)
|
||||
|
||||
(declare-type tracking-point structure)
|
||||
|
||||
(declare-type cam-rotation-tracker structure)
|
||||
|
||||
(declare-type camera-combiner process)
|
||||
|
||||
;; TODO - for cam-master
|
||||
;; TODO - for camera
|
||||
(define-extern camera-line-rel-len (function vector vector float vector4w none))
|
||||
|
||||
(define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector))
|
||||
|
||||
(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none))
|
||||
|
||||
;; TODO - for cam-combiner
|
||||
(define-extern paused? (function symbol))
|
||||
|
||||
;; TODO - for cam-start
|
||||
(define-extern cam-master-init (function none :behavior camera-master))
|
||||
|
||||
|
||||
(defenum cam-slave-options
|
||||
:bitfield #t
|
||||
(BUTT_CAM)
|
||||
@@ -47,135 +52,111 @@
|
||||
(BIKE_MODE)
|
||||
(NO_ROTATE)
|
||||
(STICKY_ANGLE)
|
||||
(AIR_EXIT)
|
||||
)
|
||||
(AIR_EXIT))
|
||||
|
||||
(defenum cam-index-options
|
||||
:type uint32
|
||||
:bitfield #t
|
||||
(RADIAL)
|
||||
(SPHERICAL)
|
||||
)
|
||||
(SPHERICAL))
|
||||
|
||||
(defenum slave-los-state
|
||||
:type uint32
|
||||
(none 0)
|
||||
(cw 1)
|
||||
(ccw 2)
|
||||
(between 3)
|
||||
)
|
||||
(between 3))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype camera-bank (basic)
|
||||
((collide-move-rad float)
|
||||
(joypad uint32)
|
||||
(min-detectable-velocity float)
|
||||
(attack-timeout time-frame)
|
||||
(default-string-max-y meters)
|
||||
(default-string-min-y meters)
|
||||
(default-string-max-z meters)
|
||||
(default-string-min-z meters)
|
||||
(default-string-push-z meters)
|
||||
(default-tilt-adjust degrees)
|
||||
)
|
||||
)
|
||||
((collide-move-rad float)
|
||||
(joypad uint32)
|
||||
(min-detectable-velocity float)
|
||||
(attack-timeout time-frame)
|
||||
(default-string-max-y meters)
|
||||
(default-string-min-y meters)
|
||||
(default-string-max-z meters)
|
||||
(default-string-min-z meters)
|
||||
(default-string-push-z meters)
|
||||
(default-tilt-adjust degrees)))
|
||||
|
||||
|
||||
(define *CAMERA-bank* (new 'static 'camera-bank
|
||||
:collide-move-rad 1638.4
|
||||
:min-detectable-velocity 40.96
|
||||
:attack-timeout (seconds 0.25)
|
||||
:default-string-max-y (meters 3)
|
||||
:default-string-min-y (meters 1)
|
||||
:default-string-max-z (meters 12.5)
|
||||
:default-string-min-z (meters 5)
|
||||
:default-string-push-z (meters 10)
|
||||
:default-tilt-adjust (degrees -6.5000005)
|
||||
)
|
||||
)
|
||||
(define *CAMERA-bank*
|
||||
(new 'static
|
||||
'camera-bank
|
||||
:collide-move-rad 1638.4
|
||||
:min-detectable-velocity 40.96
|
||||
:attack-timeout (seconds 0.25)
|
||||
:default-string-max-y (meters 3)
|
||||
:default-string-min-y (meters 1)
|
||||
:default-string-max-z (meters 12.5)
|
||||
:default-string-min-z (meters 5)
|
||||
:default-string-push-z (meters 10)
|
||||
:default-tilt-adjust (degrees -6.5000005)))
|
||||
|
||||
(deftype cam-index (structure)
|
||||
((flags cam-index-options)
|
||||
(vec vector 2 :inline :offset 16)
|
||||
)
|
||||
((flags cam-index-options)
|
||||
(vec vector 2 :inline :offset 16))
|
||||
(:methods
|
||||
(cam-index-method-9 (_type_ symbol entity vector curve) symbol)
|
||||
(cam-index-method-10 (_type_ vector) float)
|
||||
)
|
||||
)
|
||||
|
||||
(cam-index-method-9 (_type_ symbol entity vector curve) symbol)
|
||||
(cam-index-method-10 (_type_ vector) float)))
|
||||
|
||||
(deftype tracking-point (structure)
|
||||
((position vector :inline)
|
||||
(direction vector :inline)
|
||||
(tp-length float)
|
||||
(next int32)
|
||||
(incarnation int32)
|
||||
)
|
||||
)
|
||||
|
||||
((position vector :inline)
|
||||
(direction vector :inline)
|
||||
(tp-length float)
|
||||
(next int32)
|
||||
(incarnation int32)))
|
||||
|
||||
(deftype tracking-spline-sampler (structure)
|
||||
((cur-pt int32)
|
||||
(partial-pt float)
|
||||
)
|
||||
)
|
||||
|
||||
((cur-pt int32)
|
||||
(partial-pt float)))
|
||||
|
||||
(deftype tracking-spline (structure)
|
||||
((point tracking-point 32 :inline)
|
||||
(summed-len float)
|
||||
(free-point int32)
|
||||
(used-point int32)
|
||||
(partial-point float)
|
||||
(end-point int32)
|
||||
(next-to-last-point int32)
|
||||
(max-move float)
|
||||
(sample-len float)
|
||||
(used-count int32)
|
||||
(old-position vector :inline)
|
||||
(debug-old-position vector :inline)
|
||||
(debug-out-position vector :inline)
|
||||
(debug-last-point int32)
|
||||
)
|
||||
((point tracking-point 32 :inline)
|
||||
(summed-len float)
|
||||
(free-point int32)
|
||||
(used-point int32)
|
||||
(partial-point float)
|
||||
(end-point int32)
|
||||
(next-to-last-point int32)
|
||||
(max-move float)
|
||||
(sample-len float)
|
||||
(used-count int32)
|
||||
(old-position vector :inline)
|
||||
(debug-old-position vector :inline)
|
||||
(debug-out-position vector :inline)
|
||||
(debug-last-point int32))
|
||||
(:methods
|
||||
(tracking-spline-method-9 (_type_) none)
|
||||
(tracking-spline-method-10 (_type_ vector) none)
|
||||
(print-nth-point (_type_ int) none)
|
||||
(tracking-spline-method-12 (_type_) none)
|
||||
(tracking-spline-method-13 (_type_ int) none)
|
||||
(tracking-spline-method-14 (_type_ tracking-spline-sampler) none)
|
||||
(tracking-spline-method-15 (_type_) none)
|
||||
(tracking-spline-method-16 (_type_ float) none)
|
||||
(tracking-spline-method-17 (_type_ vector float float symbol) int)
|
||||
(tracking-spline-method-18 (_type_ float vector tracking-spline-sampler) vector)
|
||||
(tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector)
|
||||
(tracking-spline-method-20 (_type_ vector int) none)
|
||||
(tracking-spline-method-21 (_type_ vector float float) vector)
|
||||
(tracking-spline-method-22 (_type_ float) none)
|
||||
(tracking-spline-method-23 (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(tracking-spline-method-9 (_type_) none)
|
||||
(tracking-spline-method-10 (_type_ vector) none)
|
||||
(print-nth-point (_type_ int) none)
|
||||
(tracking-spline-method-12 (_type_) none)
|
||||
(tracking-spline-method-13 (_type_ int) none)
|
||||
(tracking-spline-method-14 (_type_ tracking-spline-sampler) none)
|
||||
(tracking-spline-method-15 (_type_) none)
|
||||
(tracking-spline-method-16 (_type_ float) none)
|
||||
(tracking-spline-method-17 (_type_ vector float float symbol) int)
|
||||
(tracking-spline-method-18 (_type_ float vector tracking-spline-sampler) vector)
|
||||
(tracking-spline-method-19 (_type_ float vector tracking-spline-sampler) vector)
|
||||
(tracking-spline-method-20 (_type_ vector int) none)
|
||||
(tracking-spline-method-21 (_type_ vector float float) vector)
|
||||
(tracking-spline-method-22 (_type_ float) none)
|
||||
(tracking-spline-method-23 (_type_) none)))
|
||||
|
||||
(deftype cam-float-seeker (structure)
|
||||
((target float)
|
||||
(value float)
|
||||
(vel float)
|
||||
(accel float)
|
||||
(max-vel float)
|
||||
(max-partial float)
|
||||
)
|
||||
((target float)
|
||||
(value float)
|
||||
(vel float)
|
||||
(accel float)
|
||||
(max-vel float)
|
||||
(max-partial float))
|
||||
:pack-me
|
||||
(:methods
|
||||
(init-cam-float-seeker (_type_ float float float float) none)
|
||||
(copy-cam-float-seeker (_type_ _type_) none)
|
||||
(update! (_type_ float) none)
|
||||
(jump-to-target! (_type_ float) float)
|
||||
)
|
||||
)
|
||||
|
||||
(init-cam-float-seeker (_type_ float float float float) none)
|
||||
(copy-cam-float-seeker (_type_ _type_) none)
|
||||
(update! (_type_ float) none)
|
||||
(jump-to-target! (_type_ float) float)))
|
||||
|
||||
(defmethod init-cam-float-seeker ((this cam-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
|
||||
(set! (-> this target) arg0)
|
||||
@@ -185,8 +166,7 @@
|
||||
(set! (-> this max-vel) arg2)
|
||||
(set! (-> this max-partial) arg3)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod copy-cam-float-seeker ((this cam-float-seeker) (arg0 cam-float-seeker))
|
||||
(set! (-> this target) (-> arg0 target))
|
||||
@@ -196,278 +176,226 @@
|
||||
(set! (-> this max-vel) (-> arg0 max-vel))
|
||||
(set! (-> this max-partial) (-> arg0 max-partial))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod update! ((this cam-float-seeker) (offset float))
|
||||
0.0
|
||||
0.0
|
||||
(let* ((pos-error (- (+ (-> this target) offset) (-> this value)))
|
||||
(partial-velocity-limit (* (-> this max-partial) (fabs pos-error)))
|
||||
)
|
||||
(let ((daccel (* pos-error (* (-> this accel) (-> *display* time-adjust-ratio)))))
|
||||
(+! (-> this vel) daccel)
|
||||
)
|
||||
(partial-velocity-limit (* (-> this max-partial) (fabs pos-error))))
|
||||
(let ((daccel (* pos-error (* (-> this accel) (-> *display* time-adjust-ratio))))) (+! (-> this vel) daccel))
|
||||
(let ((abs-vel (fabs (-> this vel)))
|
||||
(abs-vel-limit (fmin partial-velocity-limit (-> this max-vel)))
|
||||
)
|
||||
(if (< abs-vel-limit abs-vel)
|
||||
(set! (-> this vel) (* (-> this vel) (/ abs-vel-limit abs-vel)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((dpos (* (-> this vel) (-> *display* time-adjust-ratio))))
|
||||
(+! (-> this value) dpos)
|
||||
)
|
||||
(abs-vel-limit (fmin partial-velocity-limit (-> this max-vel))))
|
||||
(if (< abs-vel-limit abs-vel) (set! (-> this vel) (* (-> this vel) (/ abs-vel-limit abs-vel))))))
|
||||
(let ((dpos (* (-> this vel) (-> *display* time-adjust-ratio)))) (+! (-> this value) dpos))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod jump-to-target! ((this cam-float-seeker) (arg0 float))
|
||||
(set! (-> this value) (+ (-> this target) arg0))
|
||||
(set! (-> this vel) 0.0)
|
||||
)
|
||||
(set! (-> this vel) 0.0))
|
||||
|
||||
(deftype cam-vector-seeker (structure)
|
||||
((target vector :inline)
|
||||
(value vector :inline)
|
||||
(vel vector :inline)
|
||||
(accel float)
|
||||
(max-vel float)
|
||||
(max-partial float)
|
||||
)
|
||||
((target vector :inline)
|
||||
(value vector :inline)
|
||||
(vel vector :inline)
|
||||
(accel float)
|
||||
(max-vel float)
|
||||
(max-partial float))
|
||||
(:methods
|
||||
(init! (_type_ vector float float float) none)
|
||||
(update! (_type_ vector) none)
|
||||
)
|
||||
)
|
||||
|
||||
(init! (_type_ vector float float float) none)
|
||||
(update! (_type_ vector) none)))
|
||||
|
||||
(defmethod init! ((this cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float))
|
||||
(cond
|
||||
(arg0
|
||||
(set! (-> this target quad) (-> arg0 quad))
|
||||
(set! (-> this value quad) (-> arg0 quad))
|
||||
)
|
||||
(else
|
||||
(vector-reset! (-> this target))
|
||||
(vector-reset! (-> this value))
|
||||
)
|
||||
)
|
||||
(arg0 (set! (-> this target quad) (-> arg0 quad)) (set! (-> this value quad) (-> arg0 quad)))
|
||||
(else (vector-reset! (-> this target)) (vector-reset! (-> this value))))
|
||||
(vector-reset! (-> this vel))
|
||||
(set! (-> this accel) arg1)
|
||||
(set! (-> this max-vel) arg2)
|
||||
(set! (-> this max-partial) arg3)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod update! ((this cam-vector-seeker) (arg0 vector))
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
0.0
|
||||
(cond
|
||||
(arg0
|
||||
(vector+! gp-0 (-> this target) arg0)
|
||||
(vector-! gp-0 gp-0 (-> this value))
|
||||
)
|
||||
(else
|
||||
(vector-! gp-0 (-> this target) (-> this value))
|
||||
)
|
||||
)
|
||||
(arg0 (vector+! gp-0 (-> this target) arg0) (vector-! gp-0 gp-0 (-> this value)))
|
||||
(else (vector-! gp-0 (-> this target) (-> this value))))
|
||||
(let ((f30-1 (* (-> this max-partial) (vector-length gp-0))))
|
||||
(vector-float*! gp-0 gp-0 (* (-> this accel) (-> *display* time-adjust-ratio)))
|
||||
(vector+! (-> this vel) (-> this vel) gp-0)
|
||||
(let ((f0-4 (vector-length (-> this vel)))
|
||||
(f1-2 (fmin f30-1 (-> this max-vel)))
|
||||
)
|
||||
(if (< f1-2 f0-4)
|
||||
(vector-float*! (-> this vel) (-> this vel) (/ f1-2 f0-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
(f1-2 (fmin f30-1 (-> this max-vel))))
|
||||
(if (< f1-2 f0-4) (vector-float*! (-> this vel) (-> this vel) (/ f1-2 f0-4)))))
|
||||
(vector-float*! gp-0 (-> this vel) (-> *display* time-adjust-ratio))
|
||||
(vector+! (-> this value) (-> this value) gp-0)
|
||||
)
|
||||
(vector+! (-> this value) (-> this value) gp-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(deftype cam-rotation-tracker (structure)
|
||||
((inv-mat matrix :inline)
|
||||
(no-follow basic)
|
||||
(follow-pt vector :inline)
|
||||
(follow-off vector :inline)
|
||||
(follow-blend float)
|
||||
(tilt-adjust cam-float-seeker :inline)
|
||||
(use-point-of-interest basic)
|
||||
(point-of-interest vector :inline)
|
||||
(point-of-interest-blend cam-float-seeker :inline)
|
||||
(underwater-blend cam-float-seeker :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((inv-mat matrix :inline)
|
||||
(no-follow basic)
|
||||
(follow-pt vector :inline)
|
||||
(follow-off vector :inline)
|
||||
(follow-blend float)
|
||||
(tilt-adjust cam-float-seeker :inline)
|
||||
(use-point-of-interest basic)
|
||||
(point-of-interest vector :inline)
|
||||
(point-of-interest-blend cam-float-seeker :inline)
|
||||
(underwater-blend cam-float-seeker :inline)))
|
||||
|
||||
(deftype camera-combiner (process)
|
||||
((trans vector :inline)
|
||||
(inv-camera-rot matrix :inline)
|
||||
(fov float)
|
||||
(interp-val float)
|
||||
(interp-step float)
|
||||
(dist-from-src float)
|
||||
(dist-from-dest float)
|
||||
(flip-control-axis vector :inline)
|
||||
(velocity vector :inline)
|
||||
(tracking-status uint64)
|
||||
(tracking-options int32)
|
||||
(tracking cam-rotation-tracker :inline)
|
||||
)
|
||||
((trans vector :inline)
|
||||
(inv-camera-rot matrix :inline)
|
||||
(fov float)
|
||||
(interp-val float)
|
||||
(interp-step float)
|
||||
(dist-from-src float)
|
||||
(dist-from-dest float)
|
||||
(flip-control-axis vector :inline)
|
||||
(velocity vector :inline)
|
||||
(tracking-status uint64)
|
||||
(tracking-options int32)
|
||||
(tracking cam-rotation-tracker :inline))
|
||||
(:states
|
||||
cam-combiner-active
|
||||
)
|
||||
)
|
||||
|
||||
cam-combiner-active))
|
||||
|
||||
(deftype camera-slave (process)
|
||||
((trans vector :inline)
|
||||
(fov float)
|
||||
(fov0 float)
|
||||
(fov1 float)
|
||||
(fov-index cam-index :inline)
|
||||
(tracking cam-rotation-tracker :inline)
|
||||
(view-off-param float)
|
||||
(unknown-symbol symbol :offset 412)
|
||||
(view-off vector :inline)
|
||||
(min-z-override float)
|
||||
(view-flat vector :inline)
|
||||
(string-vel-dir uint32)
|
||||
(string-trans vector :inline)
|
||||
(position-spline tracking-spline :inline)
|
||||
(pivot-pt vector :inline)
|
||||
(pivot-rad float)
|
||||
(circular-follow vector :inline)
|
||||
(max-angle-offset float)
|
||||
(max-angle-curr float)
|
||||
(options uint32)
|
||||
(cam-entity entity)
|
||||
(velocity vector :inline)
|
||||
(desired-pos vector :inline)
|
||||
(time-dist-too-far uint32)
|
||||
(los-state slave-los-state)
|
||||
(good-point vector :inline)
|
||||
(los-tgt-spline-pt int32)
|
||||
(los-tgt-spline-pt-incarnation int32)
|
||||
(los-last-pos vector :inline)
|
||||
(intro-curve curve :inline)
|
||||
(intro-offset vector :inline)
|
||||
(intro-t float)
|
||||
(intro-t-step float)
|
||||
(outro-exit-value float)
|
||||
(spline-exists basic)
|
||||
(spline-curve curve :inline)
|
||||
(spline-offset vector :inline)
|
||||
(index cam-index :inline)
|
||||
(saved-pt vector :inline)
|
||||
(spline-tt float)
|
||||
(spline-follow-dist float)
|
||||
(change-event-from (pointer process-drawable))
|
||||
(enter-has-run symbol)
|
||||
(blend-from-type uint64)
|
||||
(blend-to-type uint64)
|
||||
(have-phony-joystick basic)
|
||||
(phony-joystick-x float)
|
||||
(phony-joystick-y float)
|
||||
(string-min-val vector :inline)
|
||||
(string-max-val vector :inline)
|
||||
(string-val-locked basic)
|
||||
)
|
||||
((trans vector :inline)
|
||||
(fov float)
|
||||
(fov0 float)
|
||||
(fov1 float)
|
||||
(fov-index cam-index :inline)
|
||||
(tracking cam-rotation-tracker :inline)
|
||||
(view-off-param float)
|
||||
(unknown-symbol symbol :offset 412)
|
||||
(view-off vector :inline)
|
||||
(min-z-override float)
|
||||
(view-flat vector :inline)
|
||||
(string-vel-dir uint32)
|
||||
(string-trans vector :inline)
|
||||
(position-spline tracking-spline :inline)
|
||||
(pivot-pt vector :inline)
|
||||
(pivot-rad float)
|
||||
(circular-follow vector :inline)
|
||||
(max-angle-offset float)
|
||||
(max-angle-curr float)
|
||||
(options uint32)
|
||||
(cam-entity entity)
|
||||
(velocity vector :inline)
|
||||
(desired-pos vector :inline)
|
||||
(time-dist-too-far uint32)
|
||||
(los-state slave-los-state)
|
||||
(good-point vector :inline)
|
||||
(los-tgt-spline-pt int32)
|
||||
(los-tgt-spline-pt-incarnation int32)
|
||||
(los-last-pos vector :inline)
|
||||
(intro-curve curve :inline)
|
||||
(intro-offset vector :inline)
|
||||
(intro-t float)
|
||||
(intro-t-step float)
|
||||
(outro-exit-value float)
|
||||
(spline-exists basic)
|
||||
(spline-curve curve :inline)
|
||||
(spline-offset vector :inline)
|
||||
(index cam-index :inline)
|
||||
(saved-pt vector :inline)
|
||||
(spline-tt float)
|
||||
(spline-follow-dist float)
|
||||
(change-event-from (pointer process-drawable))
|
||||
(enter-has-run symbol)
|
||||
(blend-from-type uint64)
|
||||
(blend-to-type uint64)
|
||||
(have-phony-joystick basic)
|
||||
(phony-joystick-x float)
|
||||
(phony-joystick-y float)
|
||||
(string-min-val vector :inline)
|
||||
(string-max-val vector :inline)
|
||||
(string-val-locked basic))
|
||||
(:states
|
||||
*camera-base-mode*
|
||||
cam-bike
|
||||
cam-billy
|
||||
cam-circular
|
||||
cam-decel
|
||||
cam-endlessfall
|
||||
cam-eye
|
||||
cam-fixed
|
||||
cam-fixed-read-entity
|
||||
cam-free-floating
|
||||
cam-launcher-longfall
|
||||
cam-launcher-shortfall
|
||||
cam-lookat
|
||||
cam-mistycannon
|
||||
cam-orbit
|
||||
cam-periscope
|
||||
cam-point-watch
|
||||
cam-pov
|
||||
cam-pov-track
|
||||
cam-pov180
|
||||
cam-robotboss
|
||||
cam-spline
|
||||
cam-standoff
|
||||
cam-standoff-read-entity
|
||||
cam-stick
|
||||
cam-string
|
||||
)
|
||||
)
|
||||
|
||||
*camera-base-mode*
|
||||
cam-bike
|
||||
cam-billy
|
||||
cam-circular
|
||||
cam-decel
|
||||
cam-endlessfall
|
||||
cam-eye
|
||||
cam-fixed
|
||||
cam-fixed-read-entity
|
||||
cam-free-floating
|
||||
cam-launcher-longfall
|
||||
cam-launcher-shortfall
|
||||
cam-lookat
|
||||
cam-mistycannon
|
||||
cam-orbit
|
||||
cam-periscope
|
||||
cam-point-watch
|
||||
cam-pov
|
||||
cam-pov-track
|
||||
cam-pov180
|
||||
cam-robotboss
|
||||
cam-spline
|
||||
cam-standoff
|
||||
cam-standoff-read-entity
|
||||
cam-stick
|
||||
cam-string))
|
||||
|
||||
(deftype camera-master (process)
|
||||
((master-options uint32)
|
||||
(num-slaves int32)
|
||||
(slave (pointer camera-slave) 2)
|
||||
(slave-options uint32)
|
||||
(view-off-param-save float)
|
||||
(changer uint32)
|
||||
(cam-entity entity)
|
||||
(stringMinLength float)
|
||||
(stringMaxLength float)
|
||||
(stringMinHeight float)
|
||||
(stringMaxHeight float)
|
||||
(string-min cam-vector-seeker :inline)
|
||||
(string-max cam-vector-seeker :inline)
|
||||
(string-push-z float)
|
||||
(stringCliffHeight float)
|
||||
(no-intro uint32)
|
||||
(force-blend uint32)
|
||||
(force-blend-time uint32)
|
||||
(local-down vector :inline)
|
||||
(drawable-target handle)
|
||||
(which-bone int32)
|
||||
(pov-handle handle)
|
||||
(pov-bone int32)
|
||||
(being-attacked symbol)
|
||||
(attack-start time-frame)
|
||||
(on-ground symbol)
|
||||
(under-water int32)
|
||||
(on-pole symbol)
|
||||
(tgt-rot-mat matrix :inline)
|
||||
(tgt-face-mat matrix :inline)
|
||||
(tpos-old vector :inline)
|
||||
(tpos-curr vector :inline)
|
||||
(target-height float)
|
||||
(tpos-old-adj vector :inline)
|
||||
(tpos-curr-adj vector :inline)
|
||||
(tpos-tgt vector :inline)
|
||||
(upspeed float)
|
||||
(pitch-off vector :inline)
|
||||
(foot-offset float)
|
||||
(head-offset float)
|
||||
(target-spline tracking-spline :inline)
|
||||
(ease-from vector :inline)
|
||||
(ease-t float)
|
||||
(ease-step float)
|
||||
(ease-to vector :inline)
|
||||
(outro-curve curve :inline)
|
||||
(outro-t float)
|
||||
(outro-t-step float)
|
||||
(outro-exit-value float)
|
||||
(water-drip-time time-frame)
|
||||
(water-drip sparticle-launch-control)
|
||||
(water-drip-mult float)
|
||||
(water-drip-speed float)
|
||||
)
|
||||
((master-options uint32)
|
||||
(num-slaves int32)
|
||||
(slave (pointer camera-slave) 2)
|
||||
(slave-options uint32)
|
||||
(view-off-param-save float)
|
||||
(changer uint32)
|
||||
(cam-entity entity)
|
||||
(stringMinLength float)
|
||||
(stringMaxLength float)
|
||||
(stringMinHeight float)
|
||||
(stringMaxHeight float)
|
||||
(string-min cam-vector-seeker :inline)
|
||||
(string-max cam-vector-seeker :inline)
|
||||
(string-push-z float)
|
||||
(stringCliffHeight float)
|
||||
(no-intro uint32)
|
||||
(force-blend uint32)
|
||||
(force-blend-time uint32)
|
||||
(local-down vector :inline)
|
||||
(drawable-target handle)
|
||||
(which-bone int32)
|
||||
(pov-handle handle)
|
||||
(pov-bone int32)
|
||||
(being-attacked symbol)
|
||||
(attack-start time-frame)
|
||||
(on-ground symbol)
|
||||
(under-water int32)
|
||||
(on-pole symbol)
|
||||
(tgt-rot-mat matrix :inline)
|
||||
(tgt-face-mat matrix :inline)
|
||||
(tpos-old vector :inline)
|
||||
(tpos-curr vector :inline)
|
||||
(target-height float)
|
||||
(tpos-old-adj vector :inline)
|
||||
(tpos-curr-adj vector :inline)
|
||||
(tpos-tgt vector :inline)
|
||||
(upspeed float)
|
||||
(pitch-off vector :inline)
|
||||
(foot-offset float)
|
||||
(head-offset float)
|
||||
(target-spline tracking-spline :inline)
|
||||
(ease-from vector :inline)
|
||||
(ease-t float)
|
||||
(ease-step float)
|
||||
(ease-to vector :inline)
|
||||
(outro-curve curve :inline)
|
||||
(outro-t float)
|
||||
(outro-t-step float)
|
||||
(outro-exit-value float)
|
||||
(water-drip-time time-frame)
|
||||
(water-drip sparticle-launch-control)
|
||||
(water-drip-mult float)
|
||||
(water-drip-speed float))
|
||||
(:states
|
||||
cam-master-active
|
||||
list-keeper-active
|
||||
)
|
||||
)
|
||||
cam-master-active
|
||||
list-keeper-active))
|
||||
+469
-1182
File diff suppressed because it is too large.
Load diff
@@ -1,23 +1,18 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/game/game-h.gc")
|
||||
|
||||
;; name: pov-camera-h.gc
|
||||
;; name in dgo: pov-camera-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defenum pov-camera-flag
|
||||
:bitfield #t
|
||||
:type int32
|
||||
(notify-of-abort 0)
|
||||
(allow-abort 1)
|
||||
(inherit-orientation 2)
|
||||
)
|
||||
(inherit-orientation 2))
|
||||
|
||||
(declare-type pov-camera process-drawable)
|
||||
(define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator
|
||||
|
||||
(define-extern pov-camera-init-by-other
|
||||
(function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
@@ -25,28 +20,24 @@
|
||||
;; for example, the introduction to orbs in geyser, or the camera that shows you where the steps to fire canyon
|
||||
;; are.
|
||||
(deftype pov-camera (process-drawable)
|
||||
((cspace-array cspace-array :overlay-at root)
|
||||
(flags pov-camera-flag)
|
||||
(debounce-start-time time-frame)
|
||||
(notify-handle handle)
|
||||
(anim-name string)
|
||||
(command-list pair)
|
||||
(mask-to-clear process-mask)
|
||||
(music-volume-movie float)
|
||||
(sfx-volume-movie float)
|
||||
)
|
||||
((cspace-array cspace-array :overlay-at root)
|
||||
(flags pov-camera-flag)
|
||||
(debounce-start-time time-frame)
|
||||
(notify-handle handle)
|
||||
(anim-name string)
|
||||
(command-list pair)
|
||||
(mask-to-clear process-mask)
|
||||
(music-volume-movie float)
|
||||
(sfx-volume-movie float))
|
||||
(:state-methods
|
||||
pov-camera-abort
|
||||
pov-camera-done-playing
|
||||
pov-camera-playing
|
||||
pov-camera-start-playing
|
||||
pov-camera-startup
|
||||
)
|
||||
pov-camera-abort
|
||||
pov-camera-done-playing
|
||||
pov-camera-playing
|
||||
pov-camera-start-playing
|
||||
pov-camera-startup)
|
||||
(:methods
|
||||
(check-for-abort (_type_) symbol)
|
||||
(target-grabbed? (_type_) symbol)
|
||||
(pre-startup-callback (_type_) none)
|
||||
(target-released? (_type_) symbol)
|
||||
(set-stack-size! (_type_) none)
|
||||
)
|
||||
)
|
||||
(check-for-abort (_type_) symbol)
|
||||
(target-grabbed? (_type_) symbol)
|
||||
(pre-startup-callback (_type_) none)
|
||||
(target-released? (_type_) symbol)
|
||||
(set-stack-size! (_type_) none)))
|
||||
@@ -1,64 +1,44 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/pov-camera-h.gc")
|
||||
(require "engine/common-obs/water.gc")
|
||||
|
||||
;; name: pov-camera.gc
|
||||
;; name in dgo: pov-camera
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod check-for-abort ((this pov-camera))
|
||||
(when (or (and (time-elapsed? (-> this debounce-start-time) (seconds 0.2)) (cpad-pressed? 0 triangle))
|
||||
(logtest? (-> this flags) (pov-camera-flag allow-abort))
|
||||
)
|
||||
(logtest? (-> this flags) (pov-camera-flag allow-abort)))
|
||||
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
|
||||
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
|
||||
(when (logtest? (-> this flags) (pov-camera-flag notify-of-abort))
|
||||
(send-event (handle->process (-> this notify-handle)) 'notify 'abort-request)
|
||||
#t
|
||||
)
|
||||
)
|
||||
)
|
||||
#t)))
|
||||
|
||||
(defmethod target-grabbed? ((this pov-camera))
|
||||
(or (not *target*) (process-grab? *target*))
|
||||
)
|
||||
(or (not *target*) (process-grab? *target*)))
|
||||
|
||||
(defmethod target-released? ((this pov-camera))
|
||||
(or (not *target*) (process-release? *target*))
|
||||
)
|
||||
(or (not *target*) (process-release? *target*)))
|
||||
|
||||
(defstate pov-camera-startup (pov-camera)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(go-virtual pov-camera-start-playing)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(go-virtual pov-camera-start-playing)))
|
||||
|
||||
(defstate pov-camera-start-playing (pov-camera)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(logclear! (-> self mask) (process-mask actor-pause))
|
||||
(while (not (target-grabbed? self))
|
||||
(suspend)
|
||||
)
|
||||
(let ((gp-0 0))
|
||||
(let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f))))
|
||||
(if v1-7
|
||||
(set! gp-0 (+ (-> v1-7 number) 1))
|
||||
)
|
||||
)
|
||||
(let ((v1-10 (process-spawn othercam self gp-0 #t #t :to self)))
|
||||
(send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear))
|
||||
)
|
||||
)
|
||||
(go-virtual pov-camera-playing)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(logclear! (-> self mask) (process-mask actor-pause))
|
||||
(while (not (target-grabbed? self))
|
||||
(suspend))
|
||||
(let ((gp-0 0))
|
||||
(let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f)))) (if v1-7 (set! gp-0 (+ (-> v1-7 number) 1))))
|
||||
(let ((v1-10 (process-spawn othercam self gp-0 #t #t :to self)))
|
||||
(send-event (ppointer->process v1-10) 'mask (-> self mask-to-clear))))
|
||||
(go-virtual pov-camera-playing)))
|
||||
|
||||
(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float))
|
||||
(let ((s4-0 #f))
|
||||
@@ -67,110 +47,82 @@
|
||||
(let ((v1-4 (and (not s4-0) (< (the float (+ (-> (ja-group) data 0 length) -4)) (ja-frame-num 0)))))
|
||||
(when v1-4
|
||||
(set! s4-0 #t)
|
||||
(send-event *camera* 'teleport-to-vector-start-string arg1)
|
||||
)
|
||||
)
|
||||
(send-event *camera* 'teleport-to-vector-start-string arg1)))
|
||||
(suspend)
|
||||
(ja :num! (seek! max arg2))
|
||||
)
|
||||
)
|
||||
(ja :num! (seek! max arg2))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defstate pov-camera-playing (pov-camera)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('abort)
|
||||
(when (logtest? (-> self flags) (pov-camera-flag notify-of-abort))
|
||||
(logior! (-> self flags) (pov-camera-flag allow-abort))
|
||||
(if (= (-> self anim-name type) string)
|
||||
(go-virtual pov-camera-abort)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(set-time! (-> self debounce-start-time))
|
||||
(if (= (-> self anim-name type) string)
|
||||
(backup-load-state-and-set-cmds *load-state* (-> self command-list))
|
||||
)
|
||||
)
|
||||
:exit (behavior ()
|
||||
(if (= (-> self anim-name type) string)
|
||||
(restore-load-state-and-cleanup *load-state*)
|
||||
)
|
||||
(remove-setting! 'music-volume)
|
||||
(remove-setting! 'sfx-volume)
|
||||
)
|
||||
:code (behavior ()
|
||||
(add-setting! 'music-volume 'rel (-> self music-volume-movie) 0)
|
||||
(add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0)
|
||||
(cond
|
||||
((= (-> self anim-name type) string)
|
||||
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(check-for-abort self)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
((= (-> self anim-name type) spool-anim)
|
||||
(ja-play-spooled-anim
|
||||
(the-as spool-anim (-> self anim-name))
|
||||
(the-as art-joint-anim #f)
|
||||
(the-as art-joint-anim #f)
|
||||
(method-of-object self check-for-abort)
|
||||
)
|
||||
)
|
||||
)
|
||||
(go-virtual pov-camera-done-playing)
|
||||
)
|
||||
:post (behavior ()
|
||||
(if (= (-> self anim-name type) string)
|
||||
(execute-commands-up-to *load-state* (ja-aframe-num 0))
|
||||
)
|
||||
(ja-post)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('abort)
|
||||
(when (logtest? (-> self flags) (pov-camera-flag notify-of-abort))
|
||||
(logior! (-> self flags) (pov-camera-flag allow-abort))
|
||||
(if (= (-> self anim-name type) string) (go-virtual pov-camera-abort))))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self debounce-start-time))
|
||||
(if (= (-> self anim-name type) string) (backup-load-state-and-set-cmds *load-state* (-> self command-list))))
|
||||
:exit
|
||||
(behavior ()
|
||||
(if (= (-> self anim-name type) string) (restore-load-state-and-cleanup *load-state*))
|
||||
(remove-setting! 'music-volume)
|
||||
(remove-setting! 'sfx-volume))
|
||||
:code
|
||||
(behavior ()
|
||||
(add-setting! 'music-volume 'rel (-> self music-volume-movie) 0)
|
||||
(add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0)
|
||||
(cond
|
||||
((= (-> self anim-name type) string)
|
||||
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(check-for-abort self)
|
||||
(suspend)
|
||||
(ja :num! (seek!))))
|
||||
((= (-> self anim-name type) spool-anim)
|
||||
(ja-play-spooled-anim (the-as spool-anim (-> self anim-name))
|
||||
(the-as art-joint-anim #f)
|
||||
(the-as art-joint-anim #f)
|
||||
(method-of-object self check-for-abort))))
|
||||
(go-virtual pov-camera-done-playing))
|
||||
:post
|
||||
(behavior ()
|
||||
(if (= (-> self anim-name type) string) (execute-commands-up-to *load-state* (ja-aframe-num 0)))
|
||||
(ja-post)))
|
||||
|
||||
(defstate pov-camera-abort (pov-camera)
|
||||
:virtual #t
|
||||
:enter (behavior ()
|
||||
(logior! (-> self flags) (pov-camera-flag allow-abort))
|
||||
)
|
||||
:code (behavior ()
|
||||
(set-blackout-frames (seconds 0.035))
|
||||
(suspend)
|
||||
(suspend)
|
||||
(go-virtual pov-camera-done-playing)
|
||||
)
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(logior! (-> self flags) (pov-camera-flag allow-abort)))
|
||||
:code
|
||||
(behavior ()
|
||||
(set-blackout-frames (seconds 0.035))
|
||||
(suspend)
|
||||
(suspend)
|
||||
(go-virtual pov-camera-done-playing)))
|
||||
|
||||
(defstate pov-camera-done-playing (pov-camera)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(while (not (target-released? self))
|
||||
:code
|
||||
(behavior ()
|
||||
(while (not (target-released? self))
|
||||
(suspend))
|
||||
(send-event (handle->process (-> self notify-handle)) 'notify 'die)
|
||||
(suspend)
|
||||
)
|
||||
(send-event (handle->process (-> self notify-handle)) 'notify 'die)
|
||||
(suspend)
|
||||
(suspend)
|
||||
(cleanup-for-death self)
|
||||
(deactivate self)
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
(cleanup-for-death self)
|
||||
(deactivate self)))
|
||||
|
||||
(defmethod pre-startup-callback ((this pov-camera))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod set-stack-size! ((this pov-camera))
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior pov-camera-init-by-other pov-camera ((arg0 vector) (arg1 skeleton-group) (arg2 string) (arg3 pov-camera-flag) (arg4 process-drawable) (arg5 pair))
|
||||
(set-stack-size! self)
|
||||
@@ -179,23 +131,14 @@
|
||||
(set! (-> self command-list) arg5)
|
||||
(set! (-> self music-volume-movie) 100.0)
|
||||
(set! (-> self sfx-volume-movie) 100.0)
|
||||
(if arg4
|
||||
(set! (-> self notify-handle) (process->handle arg4))
|
||||
(set! (-> self notify-handle) (the-as handle #f))
|
||||
)
|
||||
(if arg4 (set! (-> self notify-handle) (process->handle arg4)) (set! (-> self notify-handle) (the-as handle #f)))
|
||||
(set-time! (-> self debounce-start-time))
|
||||
(logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile))
|
||||
(set! (-> self root) (new 'process 'trsqv))
|
||||
(set! (-> self root trans quad) (-> arg0 quad))
|
||||
(when (logtest? (-> self flags) (pov-camera-flag inherit-orientation))
|
||||
(let ((v1-20 (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable))
|
||||
arg4
|
||||
)
|
||||
)
|
||||
)
|
||||
(quaternion-copy! (-> self root quat) (-> v1-20 root quat))
|
||||
)
|
||||
)
|
||||
(let ((v1-20 (if (and (nonzero? arg4) (type-type? (-> arg4 type) process-drawable)) arg4)))
|
||||
(quaternion-copy! (-> self root quat) (-> v1-20 root quat))))
|
||||
(initialize-skeleton self arg1 '())
|
||||
(logior! (-> self draw status) (draw-status skip-bones))
|
||||
(logior! (-> self skel status) (janim-status inited))
|
||||
@@ -204,36 +147,17 @@
|
||||
((= (-> arg2 type) string)
|
||||
(logior! (-> self skel status) (janim-status spool))
|
||||
(let ((s5-1 (lookup-art (-> self draw art-group) arg2 art-joint-anim)))
|
||||
(if (not s5-1)
|
||||
(go process-drawable-art-error arg2)
|
||||
)
|
||||
(if (not s5-1) (go process-drawable-art-error arg2))
|
||||
(ja-channel-set! 1)
|
||||
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1))
|
||||
)
|
||||
)
|
||||
((= (-> arg2 type) spool-anim)
|
||||
)
|
||||
)
|
||||
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1))))
|
||||
((= (-> arg2 type) spool-anim)))
|
||||
(set! (-> self mask-to-clear) (process-mask movie enemy platform projectile))
|
||||
(set! (-> self event-hook) (lambda :behavior pov-camera
|
||||
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
(('mask)
|
||||
(let ((v0-0 (the-as number (-> arg3 param 0))))
|
||||
(set! (-> self mask-to-clear) (the-as process-mask v0-0))
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(('music-movie-volume)
|
||||
(set! (-> self music-volume-movie) (the-as float (-> arg3 param 0)))
|
||||
)
|
||||
(('sfx-movie-volume)
|
||||
(set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> self event-hook)
|
||||
(lambda :behavior pov-camera ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
(('mask) (let ((v0-0 (the-as number (-> arg3 param 0)))) (set! (-> self mask-to-clear) (the-as process-mask v0-0)) v0-0))
|
||||
(('music-movie-volume) (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0))))
|
||||
(('sfx-movie-volume) (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0)))))))
|
||||
(pre-startup-callback self)
|
||||
(go-virtual pov-camera-startup)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
@@ -1,15 +1,11 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: collide-cache-h.gc
|
||||
;; name in dgo: collide-cache-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define-extern collide-cache-using-line-sphere-test (function vector symbol))
|
||||
|
||||
(define-extern collide-cache-using-y-probe-test (function vector symbol))
|
||||
|
||||
(define-extern collide-cache-using-box-test (function vector symbol))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
@@ -19,45 +15,35 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(deftype collide-using-spheres-params (structure)
|
||||
((spheres (inline-array sphere))
|
||||
(num-spheres uint32)
|
||||
(collide-with collide-kind)
|
||||
(proc process-drawable)
|
||||
(ignore-pat pat-surface)
|
||||
(solid-only basic)
|
||||
)
|
||||
)
|
||||
((spheres (inline-array sphere))
|
||||
(num-spheres uint32)
|
||||
(collide-with collide-kind)
|
||||
(proc process-drawable)
|
||||
(ignore-pat pat-surface)
|
||||
(solid-only basic)))
|
||||
|
||||
;; primitive using sphere-sphere
|
||||
(deftype collide-puss-sphere (structure)
|
||||
((bsphere sphere :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((bsphere sphere :inline)
|
||||
(bbox4w bounding-box4w :inline)))
|
||||
|
||||
(deftype collide-puss-work (structure)
|
||||
((closest-pt vector :inline)
|
||||
(tri-normal vector :inline)
|
||||
(tri-bbox4w bounding-box4w :inline)
|
||||
(spheres-bbox4w bounding-box4w :inline)
|
||||
(spheres collide-puss-sphere 64 :inline)
|
||||
)
|
||||
((closest-pt vector :inline)
|
||||
(tri-normal vector :inline)
|
||||
(tri-bbox4w bounding-box4w :inline)
|
||||
(spheres-bbox4w bounding-box4w :inline)
|
||||
(spheres collide-puss-sphere 64 :inline))
|
||||
(:methods
|
||||
(collide-puss-work-method-9 (_type_ object object) symbol)
|
||||
(collide-puss-work-method-10 (_type_ object object) symbol)
|
||||
)
|
||||
)
|
||||
(collide-puss-work-method-9 (_type_ object object) symbol)
|
||||
(collide-puss-work-method-10 (_type_ object object) symbol)))
|
||||
|
||||
;; primitive using y probe
|
||||
(deftype collide-puyp-work (structure)
|
||||
((best-u float)
|
||||
(ignore-pat pat-surface)
|
||||
(tri-out collide-tri-result)
|
||||
(start-pos vector :inline)
|
||||
(move-dist vector :inline)
|
||||
)
|
||||
)
|
||||
((best-u float)
|
||||
(ignore-pat pat-surface)
|
||||
(tri-out collide-tri-result)
|
||||
(start-pos vector :inline)
|
||||
(move-dist vector :inline)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Main Cache Types
|
||||
@@ -66,105 +52,88 @@
|
||||
;; The triangles stored in the cache.
|
||||
;; This is a common return type of collision queries.
|
||||
(deftype collide-cache-tri (structure)
|
||||
((vertex vector 3 :inline) ;; actual locations
|
||||
(extra-quad uint128 :offset 48)
|
||||
(pat pat-surface :overlay-at extra-quad) ; metadata about the surface of this tri
|
||||
(prim-index uint16 :offset 52) ; in the collide-cache-prim list
|
||||
(user16 uint16 :offset 54)
|
||||
(user32 uint32 2 :offset 56)
|
||||
)
|
||||
)
|
||||
((vertex vector 3 :inline) ;; actual locations
|
||||
(extra-quad uint128 :offset 48)
|
||||
(pat pat-surface :overlay-at extra-quad) ; metadata about the surface of this tri
|
||||
(prim-index uint16 :offset 52) ; in the collide-cache-prim list
|
||||
(user16 uint16 :offset 54)
|
||||
(user32 uint32 2 :offset 56)))
|
||||
|
||||
;; The primitives stored in the cache.
|
||||
;; The "core" is extracted from the normal collide-shape-prim and placed inline here.
|
||||
(deftype collide-cache-prim (structure)
|
||||
((prim-core collide-prim-core :inline)
|
||||
(extra-quad uint128)
|
||||
(ccache collide-cache :overlay-at extra-quad)
|
||||
(prim collide-shape-prim :offset 36)
|
||||
(first-tri uint16 :offset 40)
|
||||
(num-tris uint16 :offset 42)
|
||||
(unused uint8 4 :offset 44)
|
||||
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
||||
(collide-as collide-kind :overlay-at (-> prim-core collide-as))
|
||||
(action collide-action :overlay-at (-> prim-core action))
|
||||
(offense collide-offense :overlay-at (-> prim-core offense))
|
||||
(prim-type int8 :overlay-at (-> prim-core prim-type))
|
||||
)
|
||||
((prim-core collide-prim-core :inline)
|
||||
(extra-quad uint128)
|
||||
(ccache collide-cache :overlay-at extra-quad)
|
||||
(prim collide-shape-prim :offset 36)
|
||||
(first-tri uint16 :offset 40)
|
||||
(num-tris uint16 :offset 42)
|
||||
(unused uint8 4 :offset 44)
|
||||
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
||||
(collide-as collide-kind :overlay-at (-> prim-core collide-as))
|
||||
(action collide-action :overlay-at (-> prim-core action))
|
||||
(offense collide-offense :overlay-at (-> prim-core offense))
|
||||
(prim-type int8 :overlay-at (-> prim-core prim-type)))
|
||||
(:methods
|
||||
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float)
|
||||
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float)
|
||||
)
|
||||
)
|
||||
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float)
|
||||
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float)))
|
||||
|
||||
;; The actual cache!
|
||||
(deftype collide-cache (basic)
|
||||
((num-tris int32)
|
||||
(num-prims int32)
|
||||
(num-prims-u uint32 :overlay-at num-prims)
|
||||
(ignore-mask pat-surface)
|
||||
(proc process-drawable)
|
||||
(collide-box bounding-box :inline)
|
||||
(collide-box4w bounding-box4w :inline)
|
||||
(collide-with collide-kind)
|
||||
(prims collide-cache-prim 100 :inline)
|
||||
(tris collide-cache-tri 461 :inline)
|
||||
)
|
||||
((num-tris int32)
|
||||
(num-prims int32)
|
||||
(num-prims-u uint32 :overlay-at num-prims)
|
||||
(ignore-mask pat-surface)
|
||||
(proc process-drawable)
|
||||
(collide-box bounding-box :inline)
|
||||
(collide-box4w bounding-box4w :inline)
|
||||
(collide-with collide-kind)
|
||||
(prims collide-cache-prim 100 :inline)
|
||||
(tris collide-cache-tri 461 :inline))
|
||||
(:methods
|
||||
(debug-draw (_type_) none)
|
||||
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float)
|
||||
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
||||
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float)
|
||||
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none)
|
||||
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none)
|
||||
(fill-using-spheres (_type_ collide-using-spheres-params) none)
|
||||
(fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none)
|
||||
(initialize (_type_) none)
|
||||
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float)
|
||||
(probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
||||
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float)
|
||||
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none)
|
||||
(fill-from-foreground-using-box (_type_) none)
|
||||
(fill-from-foreground-using-line-sphere (_type_) none)
|
||||
(fill-from-foreground-using-y-probe (_type_) none)
|
||||
(fill-from-water (_type_ water-control) none)
|
||||
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none)
|
||||
(collide-cache-method-27 (_type_) none)
|
||||
(collide-cache-method-28 (_type_) none)
|
||||
(collide-cache-method-29 (_type_ collide-frag-mesh) none)
|
||||
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none)
|
||||
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector)
|
||||
(unpack-background-collide-mesh (_type_ object object object) none)
|
||||
)
|
||||
)
|
||||
|
||||
(debug-draw (_type_) none)
|
||||
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float)
|
||||
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
||||
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float)
|
||||
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none)
|
||||
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none)
|
||||
(fill-using-spheres (_type_ collide-using-spheres-params) none)
|
||||
(fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none)
|
||||
(initialize (_type_) none)
|
||||
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float)
|
||||
(probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
||||
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float)
|
||||
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none)
|
||||
(fill-from-foreground-using-box (_type_) none)
|
||||
(fill-from-foreground-using-line-sphere (_type_) none)
|
||||
(fill-from-foreground-using-y-probe (_type_) none)
|
||||
(fill-from-water (_type_ water-control) none)
|
||||
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none)
|
||||
(collide-cache-method-27 (_type_) none)
|
||||
(collide-cache-method-28 (_type_) none)
|
||||
(collide-cache-method-29 (_type_ collide-frag-mesh) none)
|
||||
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none)
|
||||
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector)
|
||||
(unpack-background-collide-mesh (_type_ object object object) none)))
|
||||
|
||||
(deftype collide-list-item (structure)
|
||||
((mesh collide-frag-mesh)
|
||||
(inst basic)
|
||||
)
|
||||
)
|
||||
|
||||
((mesh collide-frag-mesh)
|
||||
(inst basic)))
|
||||
|
||||
(deftype collide-list (structure)
|
||||
((num-items int32)
|
||||
(items collide-list-item 256 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((num-items int32)
|
||||
(items collide-list-item 256 :inline)))
|
||||
|
||||
(deftype collide-work (structure)
|
||||
((collide-sphere-neg-r sphere :inline)
|
||||
(collide-box4w bounding-box4w :inline)
|
||||
(inv-mat matrix :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((collide-sphere-neg-r sphere :inline)
|
||||
(collide-box4w bounding-box4w :inline)
|
||||
(inv-mat matrix :inline)))
|
||||
|
||||
(define-perm *collide-work* collide-work (new 'global 'collide-work))
|
||||
|
||||
;; og:preserve-this
|
||||
(defglobalconstant BIG_COLLIDE_CACHE_SIZE 5000)
|
||||
|
||||
(define-perm *collide-cache* collide-cache (new 'global 'collide-cache))
|
||||
|
||||
(#when PC_PORT
|
||||
@@ -173,11 +142,6 @@
|
||||
;; but start it at the default.
|
||||
(define *collide-cache-max-tris* 460)
|
||||
(defmacro activate-big-collide-cache! ()
|
||||
`(set! *collide-cache-max-tris* BIG_COLLIDE_CACHE_SIZE)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
`(set! *collide-cache-max-tris* BIG_COLLIDE_CACHE_SIZE)))
|
||||
|
||||
(define-perm *collide-list* collide-list (new 'global 'collide-list))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,14 +1,9 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector-h.gc")
|
||||
(require "engine/geometry/bounding-box-h.gc")
|
||||
|
||||
;; name: collide-edge-grab-h.gc
|
||||
;; name in dgo: collide-edge-grab-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Edge Grab
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -20,143 +15,138 @@
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype edge-grab-info (structure)
|
||||
((world-vertex vector 6 :inline)
|
||||
(local-vertex vector 6 :inline)
|
||||
(actor-cshape-prim-offset int32)
|
||||
(actor-handle handle)
|
||||
(hanging-matrix matrix :inline)
|
||||
(edge-vertex vector 2 :inline :overlay-at (-> world-vertex 0))
|
||||
(center-hold vector :inline :overlay-at (-> world-vertex 2))
|
||||
(tri-vertex vector 3 :inline :overlay-at (-> world-vertex 3))
|
||||
(left-hand-hold vector :inline)
|
||||
(right-hand-hold vector :inline)
|
||||
(center-hold-old vector :inline)
|
||||
(edge-tri-pat uint32)
|
||||
)
|
||||
((world-vertex vector 6 :inline)
|
||||
(local-vertex vector 6 :inline)
|
||||
(actor-cshape-prim-offset int32)
|
||||
(actor-handle handle)
|
||||
(hanging-matrix matrix :inline)
|
||||
(edge-vertex vector 2 :inline :overlay-at (-> world-vertex 0))
|
||||
(center-hold vector :inline :overlay-at (-> world-vertex 2))
|
||||
(tri-vertex vector 3 :inline :overlay-at (-> world-vertex 3))
|
||||
(left-hand-hold vector :inline)
|
||||
(right-hand-hold vector :inline)
|
||||
(center-hold-old vector :inline)
|
||||
(edge-tri-pat uint32))
|
||||
(:methods
|
||||
(edge-grab-info-method-9 (_type_) symbol)
|
||||
(debug-draw (_type_) symbol)
|
||||
)
|
||||
)
|
||||
(edge-grab-info-method-9 (_type_) symbol)
|
||||
(debug-draw (_type_) symbol)))
|
||||
|
||||
;; og:preserve-this
|
||||
(declare-type collide-cache-tri structure)
|
||||
(deftype collide-edge-tri (structure)
|
||||
((ctri collide-cache-tri)
|
||||
(normal vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype collide-edge-tri (structure)
|
||||
((ctri collide-cache-tri)
|
||||
(normal vector :inline)))
|
||||
|
||||
(deftype collide-edge-edge (structure)
|
||||
((ignore basic)
|
||||
(etri collide-edge-tri)
|
||||
(vertex-ptr (inline-array vector) 2)
|
||||
(outward vector :inline)
|
||||
(edge-vec-norm vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((ignore basic)
|
||||
(etri collide-edge-tri)
|
||||
(vertex-ptr (inline-array vector) 2)
|
||||
(outward vector :inline)
|
||||
(edge-vec-norm vector :inline)))
|
||||
|
||||
(deftype collide-edge-hold-item (structure)
|
||||
((next collide-edge-hold-item)
|
||||
(rating float)
|
||||
(split int8)
|
||||
(edge collide-edge-edge)
|
||||
(center-pt vector :inline)
|
||||
(outward-pt vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((next collide-edge-hold-item)
|
||||
(rating float)
|
||||
(split int8)
|
||||
(edge collide-edge-edge)
|
||||
(center-pt vector :inline)
|
||||
(outward-pt vector :inline)))
|
||||
|
||||
(deftype collide-edge-hold-list (structure)
|
||||
((num-allocs uint32)
|
||||
(num-attempts uint32)
|
||||
(head collide-edge-hold-item)
|
||||
(items collide-edge-hold-item 32 :inline)
|
||||
(attempts qword 32 :inline)
|
||||
)
|
||||
((num-allocs uint32)
|
||||
(num-attempts uint32)
|
||||
(head collide-edge-hold-item)
|
||||
(items collide-edge-hold-item 32 :inline)
|
||||
(attempts qword 32 :inline))
|
||||
(:methods
|
||||
(debug-draw (_type_) object)
|
||||
(add-to-list! (_type_ collide-edge-hold-item) none)
|
||||
)
|
||||
)
|
||||
(debug-draw (_type_) object)
|
||||
(add-to-list! (_type_ collide-edge-hold-item) none)))
|
||||
|
||||
;; og:preserve-this
|
||||
(declare-type collide-cache basic)
|
||||
|
||||
(declare-type collide-shape basic)
|
||||
|
||||
(deftype collide-edge-work (structure)
|
||||
((ccache collide-cache)
|
||||
(cshape collide-shape)
|
||||
(num-verts uint32)
|
||||
(num-edges uint32)
|
||||
(num-tris uint32)
|
||||
(cache-fill-box bounding-box :inline)
|
||||
(within-reach-box bounding-box :inline)
|
||||
(within-reach-box4w bounding-box4w :inline)
|
||||
(search-pt vector :inline)
|
||||
(search-dir-vec vector :inline)
|
||||
(max-dist-sqrd-to-outward-pt float)
|
||||
(max-dir-cosa-delta float)
|
||||
(split-dists float 2)
|
||||
(outward-offset vector :inline)
|
||||
(local-cache-fill-box bounding-box :inline)
|
||||
(local-within-reach-box bounding-box :inline)
|
||||
(local-player-spheres sphere 12 :inline)
|
||||
(world-player-spheres sphere 12 :inline)
|
||||
(local-player-hanging-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 0))
|
||||
(world-player-hanging-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 0))
|
||||
(local-player-leap-up-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 6))
|
||||
(world-player-leap-up-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 6))
|
||||
(verts vector 64 :inline)
|
||||
(edges collide-edge-edge 96 :inline)
|
||||
(tris collide-edge-tri 48 :inline)
|
||||
(hold-list collide-edge-hold-list :inline)
|
||||
)
|
||||
((ccache collide-cache)
|
||||
(cshape collide-shape)
|
||||
(num-verts uint32)
|
||||
(num-edges uint32)
|
||||
(num-tris uint32)
|
||||
(cache-fill-box bounding-box :inline)
|
||||
(within-reach-box bounding-box :inline)
|
||||
(within-reach-box4w bounding-box4w :inline)
|
||||
(search-pt vector :inline)
|
||||
(search-dir-vec vector :inline)
|
||||
(max-dist-sqrd-to-outward-pt float)
|
||||
(max-dir-cosa-delta float)
|
||||
(split-dists float 2)
|
||||
(outward-offset vector :inline)
|
||||
(local-cache-fill-box bounding-box :inline)
|
||||
(local-within-reach-box bounding-box :inline)
|
||||
(local-player-spheres sphere 12 :inline)
|
||||
(world-player-spheres sphere 12 :inline)
|
||||
(local-player-hanging-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 0))
|
||||
(world-player-hanging-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 0))
|
||||
(local-player-leap-up-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 6))
|
||||
(world-player-leap-up-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 6))
|
||||
(verts vector 64 :inline)
|
||||
(edges collide-edge-edge 96 :inline)
|
||||
(tris collide-edge-tri 48 :inline)
|
||||
(hold-list collide-edge-hold-list :inline))
|
||||
(:methods
|
||||
(search-for-edges (_type_ collide-edge-hold-list) symbol)
|
||||
(debug-draw-edges (_type_) object)
|
||||
(debug-draw-tris (_type_) none)
|
||||
(debug-draw-sphere (_type_) symbol)
|
||||
(compute-center-point! (_type_ collide-edge-edge vector) float)
|
||||
(collide-edge-work-method-14 (_type_ vector vector int) float)
|
||||
(find-grabbable-edges! (_type_) none)
|
||||
(find-grabbable-tris! (_type_) none)
|
||||
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol)
|
||||
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol)
|
||||
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol)
|
||||
)
|
||||
)
|
||||
(search-for-edges (_type_ collide-edge-hold-list) symbol)
|
||||
(debug-draw-edges (_type_) object)
|
||||
(debug-draw-tris (_type_) none)
|
||||
(debug-draw-sphere (_type_) symbol)
|
||||
(compute-center-point! (_type_ collide-edge-edge vector) float)
|
||||
(collide-edge-work-method-14 (_type_ vector vector int) float)
|
||||
(find-grabbable-edges! (_type_) none)
|
||||
(find-grabbable-tris! (_type_) none)
|
||||
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol)
|
||||
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol)
|
||||
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol)))
|
||||
|
||||
|
||||
(define *collide-edge-work* (new 'static 'collide-edge-work
|
||||
:max-dist-sqrd-to-outward-pt 37748736.0
|
||||
:max-dir-cosa-delta 0.6
|
||||
:split-dists (new 'static 'array float 2 1024.0 1433.6)
|
||||
:outward-offset (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0)
|
||||
:local-cache-fill-box (new 'static 'bounding-box
|
||||
:min (new 'static 'vector :x -8192.0 :y -11059.2 :z -8192.0 :w 1.0)
|
||||
:max (new 'static 'vector :x 8192.0 :y 24576.0 :z 8192.0 :w 1.0)
|
||||
)
|
||||
:local-within-reach-box (new 'static 'bounding-box
|
||||
:min (new 'static 'vector :x -6144.0 :y 5324.8 :z -6144.0 :w 1.0)
|
||||
:max (new 'static 'vector :x 6144.0 :y 11059.2 :z 6144.0 :w 1.0)
|
||||
)
|
||||
:local-player-spheres (new 'static 'inline-array sphere 12
|
||||
(new 'static 'sphere :x 1720.32 :y -819.2 :w 1433.6)
|
||||
(new 'static 'sphere :x 2293.76 :y -3276.8 :w 1884.16)
|
||||
(new 'static 'sphere :x 1966.08 :y -6144.0 :w 1556.48)
|
||||
(new 'static 'sphere :x 1966.08 :y -8601.6 :w 1556.48)
|
||||
(new 'static 'sphere :x 1761.28 :y -11059.2 :w 1351.68)
|
||||
(new 'static 'sphere :x 1679.36 :y -13312.0 :w 1269.76)
|
||||
(new 'static 'sphere :x -737.28 :y 4096.0 :w 3072.0)
|
||||
(new 'static 'sphere :x -737.28 :y 6553.6 :w 3072.0)
|
||||
(new 'static 'sphere :x -737.28 :y 9420.8 :w 3072.0)
|
||||
(new 'static 'sphere :x 1720.32 :y 3686.4 :w 2949.12)
|
||||
(new 'static 'sphere :x 1720.32 :y 5734.4 :w 2949.12)
|
||||
(new 'static 'sphere :x 1720.32 :y 8601.6 :w 2949.12)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define *collide-edge-work*
|
||||
(new 'static
|
||||
'collide-edge-work
|
||||
:max-dist-sqrd-to-outward-pt 37748736.0
|
||||
:max-dir-cosa-delta 0.6
|
||||
:split-dists
|
||||
(new 'static 'array float 2 1024.0 1433.6)
|
||||
:outward-offset
|
||||
(new 'static 'vector :x 708.608 :y 13312.0 :w 1.0)
|
||||
:local-cache-fill-box
|
||||
(new 'static
|
||||
'bounding-box
|
||||
:min
|
||||
(new 'static 'vector :x -8192.0 :y -11059.2 :z -8192.0 :w 1.0)
|
||||
:max
|
||||
(new 'static 'vector :x 8192.0 :y 24576.0 :z 8192.0 :w 1.0))
|
||||
:local-within-reach-box
|
||||
(new 'static
|
||||
'bounding-box
|
||||
:min
|
||||
(new 'static 'vector :x -6144.0 :y 5324.8 :z -6144.0 :w 1.0)
|
||||
:max
|
||||
(new 'static 'vector :x 6144.0 :y 11059.2 :z 6144.0 :w 1.0))
|
||||
:local-player-spheres
|
||||
(new 'static
|
||||
'inline-array
|
||||
sphere
|
||||
12
|
||||
(new 'static 'sphere :x 1720.32 :y -819.2 :w 1433.6)
|
||||
(new 'static 'sphere :x 2293.76 :y -3276.8 :w 1884.16)
|
||||
(new 'static 'sphere :x 1966.08 :y -6144.0 :w 1556.48)
|
||||
(new 'static 'sphere :x 1966.08 :y -8601.6 :w 1556.48)
|
||||
(new 'static 'sphere :x 1761.28 :y -11059.2 :w 1351.68)
|
||||
(new 'static 'sphere :x 1679.36 :y -13312.0 :w 1269.76)
|
||||
(new 'static 'sphere :x -737.28 :y 4096.0 :w 3072.0)
|
||||
(new 'static 'sphere :x -737.28 :y 6553.6 :w 3072.0)
|
||||
(new 'static 'sphere :x -737.28 :y 9420.8 :w 3072.0)
|
||||
(new 'static 'sphere :x 1720.32 :y 3686.4 :w 2949.12)
|
||||
(new 'static 'sphere :x 1720.32 :y 5734.4 :w 2949.12)
|
||||
(new 'static 'sphere :x 1720.32 :y 8601.6 :w 2949.12))))
|
||||
|
||||
(define-perm *edge-grab-info* edge-grab-info (new 'global 'edge-grab-info))
|
||||
@@ -1,7 +1,6 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/surface-h.gc")
|
||||
(require "engine/collide/collide-edge-grab-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
@@ -10,10 +9,6 @@
|
||||
(require "engine/collide/collide-shape-h.gc")
|
||||
(require "engine/debug/debug.gc")
|
||||
|
||||
;; name: collide-edge-grab.gc
|
||||
;; name in dgo: collide-edge-grab
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod find-edge-grabs! ((this target) (arg0 collide-cache))
|
||||
@@ -25,21 +20,18 @@
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
)
|
||||
(vf7 :class vf))
|
||||
(let ((gp-0 *collide-edge-work*))
|
||||
;; reset the edge work...
|
||||
(set! (-> gp-0 num-verts) (the-as uint 0))
|
||||
(set! (-> gp-0 num-edges) (the-as uint 0))
|
||||
(set! (-> gp-0 num-tris) (the-as uint 0))
|
||||
|
||||
(let ((v1-0 (-> this control)))
|
||||
(set! (-> gp-0 ccache) arg0)
|
||||
(.lvf vf1 (&-> gp-0 local-cache-fill-box min quad))
|
||||
(.lvf vf2 (&-> gp-0 local-cache-fill-box max quad))
|
||||
(set! (-> gp-0 cshape) v1-0)
|
||||
(.lvf vf3 (&-> v1-0 trans quad))
|
||||
)
|
||||
(.lvf vf3 (&-> v1-0 trans quad)))
|
||||
;; translate the cache filling box
|
||||
(.add.vf vf1 vf1 vf3 :mask #b111)
|
||||
(.add.vf vf2 vf2 vf3 :mask #b111)
|
||||
@@ -57,16 +49,12 @@
|
||||
(.svf (&-> gp-0 within-reach-box max quad) vf5)
|
||||
(.svf (&-> gp-0 within-reach-box4w min quad) vf6)
|
||||
(.svf (&-> gp-0 within-reach-box4w max quad) vf7)
|
||||
|
||||
;; Fill the collide cache!
|
||||
(fill-using-bounding-box
|
||||
arg0
|
||||
(-> gp-0 cache-fill-box)
|
||||
(-> this control root-prim collide-with)
|
||||
this
|
||||
(new 'static 'pat-surface :noentity #x1)
|
||||
)
|
||||
|
||||
(fill-using-bounding-box arg0
|
||||
(-> gp-0 cache-fill-box)
|
||||
(-> this control root-prim collide-with)
|
||||
this
|
||||
(new 'static 'pat-surface :noentity #x1))
|
||||
;; Filter out tris that can't be grabbed
|
||||
(find-grabbable-tris! gp-0)
|
||||
(when (nonzero? (-> gp-0 num-tris))
|
||||
@@ -82,22 +70,13 @@
|
||||
(search-for-edges gp-0 (-> gp-0 hold-list))
|
||||
(when (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
|
||||
(send-event *target* 'edge-grab)
|
||||
(return (the-as object #f))
|
||||
)
|
||||
)
|
||||
(return (the-as object #f))))
|
||||
;; use target's heading
|
||||
(vector-z-quaternion! (-> gp-0 search-dir-vec) (-> *target* control unknown-quaternion00))
|
||||
(search-for-edges gp-0 (-> gp-0 hold-list))
|
||||
(if (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*)
|
||||
(send-event *target* 'edge-grab)
|
||||
)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
)
|
||||
(if (find-best-grab! gp-0 (-> gp-0 hold-list) *edge-grab-info*) (send-event *target* 'edge-grab))
|
||||
0)))
|
||||
0))
|
||||
|
||||
(defmethod search-for-edges ((this collide-edge-work) (arg0 collide-edge-hold-list))
|
||||
"Iterate through edges, adding them to the collide-edge-hold-list, if they are good"
|
||||
@@ -106,8 +85,7 @@
|
||||
(set! (-> arg0 num-attempts) (the-as uint 0))
|
||||
(set! (-> arg0 head) #f)
|
||||
(let ((s4-0 (the-as collide-edge-hold-item (-> arg0 items)))
|
||||
(s3-0 (the-as collide-edge-edge (-> this edges)))
|
||||
)
|
||||
(s3-0 (the-as collide-edge-edge (-> this edges))))
|
||||
;; loop over edges
|
||||
(countdown (s2-0 (-> this num-edges))
|
||||
(when (not (-> s3-0 ignore))
|
||||
@@ -119,28 +97,19 @@
|
||||
(+! (-> arg0 num-allocs) 1)
|
||||
(when (= (-> arg0 num-allocs) 32)
|
||||
(format 0 "ERROR: Reached limit of edge grab hold items!~%")
|
||||
(return #f)
|
||||
)
|
||||
(&+! s4-0 48)
|
||||
)
|
||||
)
|
||||
(&+! s3-0 48)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
(return #f))
|
||||
(&+! s4-0 48)))
|
||||
(&+! s3-0 48)))
|
||||
#f)
|
||||
|
||||
;; add to list.
|
||||
(defmethod-mips2c "(method 10 collide-edge-hold-list)" 10 collide-edge-hold-list)
|
||||
|
||||
(deftype pbhp-stack-vars (structure)
|
||||
((edge collide-edge-edge)
|
||||
(allocated basic)
|
||||
(neg-hold-pt vector :inline)
|
||||
(split-vec vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((edge collide-edge-edge)
|
||||
(allocated basic)
|
||||
(neg-hold-pt vector :inline)
|
||||
(split-vec vector :inline)))
|
||||
|
||||
(defmethod-mips2c "(method 18 collide-edge-work)" 18 collide-edge-work)
|
||||
|
||||
@@ -148,29 +117,19 @@
|
||||
(local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector))
|
||||
(let* ((s3-0 (-> arg0 edge))
|
||||
(s1-0 (-> s3-0 etri ctri))
|
||||
(s4-0 (-> s1-0 prim-index))
|
||||
)
|
||||
(s4-0 (-> s1-0 prim-index)))
|
||||
(let ((s0-0 (new 'stack-no-clear 'vector)))
|
||||
(vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92)
|
||||
(let ((f0-0 (collide-edge-work-method-14 this (-> arg1 right-hand-hold) s0-0 (the-as int s4-0))))
|
||||
(if (< 491.52 f0-0)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
(if (< 491.52 f0-0) (return #f)))
|
||||
(set! sv-144 vector+*!)
|
||||
(set! sv-160 s0-0)
|
||||
(set! sv-176 (-> arg0 center-pt))
|
||||
(let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)))
|
||||
(a3-2 1105.92)
|
||||
)
|
||||
(sv-144 sv-160 sv-176 a2-3 a3-2)
|
||||
)
|
||||
(a3-2 1105.92))
|
||||
(sv-144 sv-160 sv-176 a2-3 a3-2))
|
||||
(let ((f0-1 (collide-edge-work-method-14 this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0))))
|
||||
(if (< 491.52 f0-1)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (< 491.52 f0-1) (return #f))))
|
||||
(set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad))
|
||||
(set! (-> arg1 world-vertex 4 quad) (-> s1-0 vertex 1 quad))
|
||||
(set! (-> arg1 world-vertex 5 quad) (-> s1-0 vertex 2 quad))
|
||||
@@ -179,23 +138,15 @@
|
||||
(set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad))
|
||||
(set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad))
|
||||
(set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
|
||||
(vector-normalize!
|
||||
(vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex)))
|
||||
1.0
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-cross!
|
||||
(the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 2)
|
||||
(-> arg1 hanging-matrix vector 1)
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector-cross!
|
||||
(-> arg1 hanging-matrix vector 2)
|
||||
(the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 1)
|
||||
)
|
||||
(vector-normalize! (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex)))
|
||||
1.0)
|
||||
(vector-normalize! (vector-cross! (the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 2)
|
||||
(-> arg1 hanging-matrix vector 1))
|
||||
1.0)
|
||||
(vector-cross! (-> arg1 hanging-matrix vector 2)
|
||||
(the-as vector (-> arg1 hanging-matrix))
|
||||
(-> arg1 hanging-matrix vector 1))
|
||||
(set! (-> arg1 hanging-matrix vector 3 quad) (-> arg1 center-hold quad))
|
||||
(transform-vectors! (-> arg1 hanging-matrix) (-> this world-player-spheres) (-> this local-player-spheres) 12)
|
||||
(let ((a1-13 (new 'stack-no-clear 'collide-using-spheres-params)))
|
||||
@@ -205,37 +156,20 @@
|
||||
(set! (-> a1-13 proc) #f)
|
||||
(set! (-> a1-13 ignore-pat) (new 'static 'pat-surface :noentity #x1))
|
||||
(set! (-> a1-13 solid-only) #t)
|
||||
(if (probe-using-spheres (-> this ccache) a1-13)
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
(if (probe-using-spheres (-> this ccache) a1-13) (return #f)))
|
||||
(let* ((v1-36 (the-as object (-> this ccache prims s4-0 prim)))
|
||||
(a0-35 (-> (the-as collide-shape-prim v1-36) cshape))
|
||||
)
|
||||
(a0-35 (-> (the-as collide-shape-prim v1-36) cshape)))
|
||||
(cond
|
||||
(a0-35
|
||||
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process))))
|
||||
(set! (-> arg1 actor-handle) (process->handle (-> a0-35 process)))
|
||||
(let ((a1-19
|
||||
(-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform)
|
||||
)
|
||||
(s5-1 (new 'stack-no-clear 'matrix))
|
||||
)
|
||||
(matrix-4x4-inverse! s5-1 a1-19)
|
||||
(dotimes (s4-1 6)
|
||||
(vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> arg1 actor-cshape-prim-offset) 0)
|
||||
(set! (-> arg1 actor-handle) (the-as handle #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#t
|
||||
)
|
||||
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process))))
|
||||
(set! (-> arg1 actor-handle) (process->handle (-> a0-35 process)))
|
||||
(let ((a1-19 (-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform))
|
||||
(s5-1 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-4x4-inverse! s5-1 a1-19)
|
||||
(dotimes (s4-1 6)
|
||||
(vector-matrix*! (-> arg1 local-vertex s4-1) (-> arg1 world-vertex s4-1) s5-1))))
|
||||
(else (set! (-> arg1 actor-cshape-prim-offset) 0) (set! (-> arg1 actor-handle) (the-as handle #f))))))
|
||||
#t)
|
||||
|
||||
(defmethod edge-grab-info-method-9 ((this edge-grab-info))
|
||||
(local-vars (v0-0 symbol) (v1-14 int))
|
||||
@@ -248,36 +182,19 @@
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
)
|
||||
(vf7 :class vf))
|
||||
(init-vf0-vector)
|
||||
(let ((s5-0 (the-as object #f)))
|
||||
(set! (-> this center-hold-old quad) (-> this center-hold quad))
|
||||
(let ((v1-1 (-> this actor-cshape-prim-offset)))
|
||||
(when (nonzero? v1-1)
|
||||
(let ((a0-5 (handle->process (-> this actor-handle))))
|
||||
(if (not (the-as process a0-5))
|
||||
(return #f)
|
||||
)
|
||||
(if (not (the-as process a0-5)) (return #f))
|
||||
(set! s5-0 (+ (the-as int a0-5) v1-1))
|
||||
(if (zero? (-> (the-as collide-shape-prim s5-0) prim-core collide-as))
|
||||
(return #f)
|
||||
)
|
||||
(let ((s4-0
|
||||
(-> (the-as process-drawable a0-5)
|
||||
node-list
|
||||
data
|
||||
(-> (the-as collide-shape-prim s5-0) transform-index)
|
||||
bone
|
||||
transform
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (zero? (-> (the-as collide-shape-prim s5-0) prim-core collide-as)) (return #f))
|
||||
(let ((s4-0 (-> (the-as process-drawable a0-5) node-list data (-> (the-as collide-shape-prim s5-0) transform-index) bone transform)))
|
||||
(dotimes (s3-0 6)
|
||||
(vector-matrix*! (-> this world-vertex s3-0) (-> this local-vertex s3-0) s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-matrix*! (-> this world-vertex s3-0) (-> this local-vertex s3-0) s4-0))))
|
||||
(.lvf vf1 (&-> this world-vertex 3 quad))
|
||||
(.lvf vf2 (&-> this world-vertex 4 quad))
|
||||
(.lvf vf3 (&-> this world-vertex 5 quad))
|
||||
@@ -295,46 +212,26 @@
|
||||
(nop!)
|
||||
(.mul.vf vf6 vf6 Q :mask #b111)
|
||||
(.mov v1-14 vf6)
|
||||
(b! (>= (the-as float (sar (the-as int v1-14) 32)) f1-0) cfg-17)
|
||||
)
|
||||
(b! (>= (the-as float (sar (the-as int v1-14) 32)) f1-0) cfg-17))
|
||||
(set! v0-0 #f)
|
||||
(b! #t cfg-27 :delay (nop!))
|
||||
(label cfg-17)
|
||||
(set! (-> this hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
|
||||
(vector-normalize!
|
||||
(vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (the-as vector (-> this world-vertex)))
|
||||
1.0
|
||||
)
|
||||
(vector-normalize!
|
||||
(vector-cross!
|
||||
(the-as vector (-> this hanging-matrix))
|
||||
(-> this hanging-matrix vector 2)
|
||||
(-> this hanging-matrix vector 1)
|
||||
)
|
||||
1.0
|
||||
)
|
||||
(vector-cross!
|
||||
(-> this hanging-matrix vector 2)
|
||||
(the-as vector (-> this hanging-matrix))
|
||||
(-> this hanging-matrix vector 1)
|
||||
)
|
||||
(vector-normalize! (vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (the-as vector (-> this world-vertex)))
|
||||
1.0)
|
||||
(vector-normalize! (vector-cross! (the-as vector (-> this hanging-matrix))
|
||||
(-> this hanging-matrix vector 2)
|
||||
(-> this hanging-matrix vector 1))
|
||||
1.0)
|
||||
(vector-cross! (-> this hanging-matrix vector 2)
|
||||
(the-as vector (-> this hanging-matrix))
|
||||
(-> this hanging-matrix vector 1))
|
||||
(set! (-> this hanging-matrix vector 3 quad) (-> this center-hold quad))
|
||||
(let ((v1-21 *collide-edge-work*))
|
||||
(transform-vectors!
|
||||
(-> this hanging-matrix)
|
||||
(-> v1-21 world-player-spheres)
|
||||
(-> v1-21 local-player-spheres)
|
||||
12
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(transform-vectors! (-> this hanging-matrix) (-> v1-21 world-player-spheres) (-> v1-21 local-player-spheres) 12))))
|
||||
(let ((v1-22 *collide-edge-work*)
|
||||
(a1-14 (new 'stack-no-clear 'collide-using-spheres-params))
|
||||
)
|
||||
(let ((a0-24 'target-edge-grab-jump))
|
||||
(b! (!= (-> *target* next-state name) a0-24) cfg-20 :delay (nop!))
|
||||
)
|
||||
(a1-14 (new 'stack-no-clear 'collide-using-spheres-params)))
|
||||
(let ((a0-24 'target-edge-grab-jump)) (b! (!= (-> *target* next-state name) a0-24) cfg-20 :delay (nop!)))
|
||||
(set! (-> a1-14 spheres) (-> v1-22 world-player-leap-up-spheres))
|
||||
(set! (-> a1-14 num-spheres) (the-as uint 6))
|
||||
(set! (-> a1-14 collide-with) (-> v1-22 cshape root-prim collide-with))
|
||||
@@ -350,26 +247,20 @@
|
||||
(set! (-> a1-14 ignore-pat) (new 'static 'pat-surface :noentity #x1))
|
||||
(set! (-> a1-14 solid-only) #t)
|
||||
(label cfg-21)
|
||||
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24)
|
||||
)
|
||||
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24))
|
||||
(set! v0-0 #f)
|
||||
(b! #t cfg-27 :delay (nop!))
|
||||
(the-as none 0)
|
||||
(label cfg-24)
|
||||
(b! (not (the-as int s5-0)) cfg-26)
|
||||
(let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape)))
|
||||
(send-event (-> v1-40 process) 'edge-grabbed this)
|
||||
)
|
||||
)
|
||||
(let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape))) (send-event (-> v1-40 process) 'edge-grabbed this)))
|
||||
(label cfg-26)
|
||||
(set! v0-0 #t)
|
||||
(label cfg-27)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
v0-0))
|
||||
|
||||
(defmethod-mips2c "(method 16 collide-edge-work)" 16 collide-edge-work)
|
||||
|
||||
(defmethod-mips2c "(method 15 collide-edge-work)" 15 collide-edge-work)
|
||||
|
||||
(defmethod collide-edge-work-method-14 ((this collide-edge-work) (arg0 vector) (arg1 vector) (arg2 int))
|
||||
@@ -382,20 +273,11 @@
|
||||
(let ((f0-0 (vector-segment-distance-point! arg1 (-> v1-3 vertex-ptr 0 0) (-> v1-3 vertex-ptr 1 0) s2-0)))
|
||||
(when (or (< f30-0 0.0) (< f0-0 f30-0))
|
||||
(set! f30-0 f0-0)
|
||||
(set! (-> arg0 quad) (-> s2-0 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 quad) (-> s2-0 quad)))))))))
|
||||
f30-0))
|
||||
|
||||
;; 17 cew
|
||||
(defmethod should-add-to-list? collide-edge-work ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 collide-edge-edge))
|
||||
(defmethod should-add-to-list? ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 collide-edge-edge))
|
||||
(local-vars
|
||||
(r0-0 uint128)
|
||||
(v1-1 uint128)
|
||||
@@ -405,8 +287,7 @@
|
||||
(v1-6 float)
|
||||
(a3-1 uint128)
|
||||
(t0-0 uint128)
|
||||
(t1-1 uint128)
|
||||
)
|
||||
(t1-1 uint128))
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -419,8 +300,7 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(nop!)
|
||||
@@ -436,10 +316,7 @@
|
||||
(.pcgtw t1-1 t0-0 t1-0)
|
||||
(.lvf vf4 (&-> this outward-offset quad))
|
||||
(.pcgtw a3-1 a3-0 t0-0)
|
||||
(.lvf vf5 (&-> v1-0 trans quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
(.lvf vf5 (&-> v1-0 trans quad)))))
|
||||
(.por v1-1 t1-1 a3-1)
|
||||
(let ((f0-0 (-> this max-dist-sqrd-to-outward-pt)))
|
||||
(.ppach v1-2 r0-0 v1-1)
|
||||
@@ -464,9 +341,7 @@
|
||||
(.mul.vf vf9 vf8 vf6)
|
||||
(.add.z.vf vf9 vf9 vf9 :mask #b1)
|
||||
(.mov v1-5 vf9)
|
||||
(b! (< v1-5 f1-0) cfg-4)
|
||||
)
|
||||
)
|
||||
(b! (< v1-5 f1-0) cfg-4)))
|
||||
(.sub.vf vf7 vf11 vf1)
|
||||
(.svf (&-> arg0 center-pt quad) vf1)
|
||||
(.mul.vf vf7 vf7 vf7)
|
||||
@@ -483,10 +358,7 @@
|
||||
(b! #t cfg-6 :delay (nop!))
|
||||
(set! v0-0 (the-as symbol 0))
|
||||
(label cfg-6)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
v0-0)))
|
||||
|
||||
(defmethod compute-center-point! ((this collide-edge-work) (arg0 collide-edge-edge) (arg1 vector))
|
||||
(local-vars (v0-0 float) (v1-1 float) (v1-2 float) (v1-3 float))
|
||||
@@ -502,18 +374,15 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(.mov.vf vf7 vf0)
|
||||
(.lvf vf1 (&-> this search-pt quad))
|
||||
(let ((f0-0 0.0))
|
||||
(let ((v1-0 (-> arg0 vertex-ptr 0))
|
||||
(a0-1 (-> arg0 vertex-ptr 1))
|
||||
)
|
||||
(a0-1 (-> arg0 vertex-ptr 1)))
|
||||
(.lvf vf2 (&-> v1-0 0 quad))
|
||||
(.lvf vf3 (&-> a0-1 0 quad))
|
||||
)
|
||||
(.lvf vf3 (&-> a0-1 0 quad)))
|
||||
(.sub.vf vf4 vf1 vf2)
|
||||
(.sub.vf vf5 vf3 vf2)
|
||||
(.mul.vf vf6 vf5 vf5)
|
||||
@@ -540,74 +409,41 @@
|
||||
(b! (< f3-0 f0-0) cfg-4 :likely-delay (set! f3-0 f0-0))
|
||||
(b! (< f1-0 f3-0) cfg-4 :likely-delay (set! f3-0 f1-0))
|
||||
(label cfg-4)
|
||||
(let ((v1-4 (* f3-0 f2-0)))
|
||||
(.mov vf11 v1-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-4 (* f3-0 f2-0))) (.mov vf11 v1-4))))))
|
||||
(.mul.x.vf vf7 vf5 vf11 :mask #b111)
|
||||
(.add.vf vf7 vf7 vf2 :mask #b111)
|
||||
(.svf (&-> arg1 quad) vf7)
|
||||
(.mov v0-0 vf7)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
v0-0))
|
||||
|
||||
(defmethod debug-draw ((this edge-grab-info))
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> this world-vertex))
|
||||
(-> this world-vertex 1)
|
||||
(new 'static 'rgba :r #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> this center-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x80)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> this left-hand-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x60)
|
||||
)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> this right-hand-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x60)
|
||||
)
|
||||
(add-debug-outline-triangle
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> this tri-vertex))
|
||||
(-> this world-vertex 4)
|
||||
(-> this world-vertex 5)
|
||||
(new 'static 'rgba :r #xff :a #x30)
|
||||
)
|
||||
(the-as symbol (cond
|
||||
((nonzero? (-> this actor-cshape-prim-offset))
|
||||
(if (handle->process (-> this actor-handle))
|
||||
(format *stdcon* "grab: ~A~%" (-> this actor-handle process 0 name))
|
||||
(format *stdcon* "grab: invalid handle~%")
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format *stdcon* "grab: ground~%")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(add-debug-line #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> this world-vertex))
|
||||
(-> this world-vertex 1)
|
||||
(new 'static 'rgba :r #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1))
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> this center-hold) 204.8 (new 'static 'rgba :r #xff :g #xff :a #x80))
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> this left-hand-hold) 204.8 (new 'static 'rgba :r #xff :g #xff :a #x60))
|
||||
(add-debug-sphere #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> this right-hand-hold)
|
||||
204.8
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x60))
|
||||
(add-debug-outline-triangle #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> this tri-vertex))
|
||||
(-> this world-vertex 4)
|
||||
(-> this world-vertex 5)
|
||||
(new 'static 'rgba :r #xff :a #x30))
|
||||
(the-as symbol
|
||||
(cond
|
||||
((nonzero? (-> this actor-cshape-prim-offset))
|
||||
(if (handle->process (-> this actor-handle))
|
||||
(format *stdcon* "grab: ~A~%" (-> this actor-handle process 0 name))
|
||||
(format *stdcon* "grab: invalid handle~%")))
|
||||
(else (format *stdcon* "grab: ground~%")))))
|
||||
|
||||
(defmethod debug-draw-edges ((this collide-edge-work))
|
||||
(let ((gp-0 0))
|
||||
@@ -615,65 +451,41 @@
|
||||
(let* ((s3-0 (-> this edges s4-0))
|
||||
(a2-0 (-> s3-0 vertex-ptr 0 0))
|
||||
(a3-0 (-> s3-0 vertex-ptr 1 0))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(s2-0 (new 'stack-no-clear 'vector)))
|
||||
(vector+! s2-0 a2-0 a3-0)
|
||||
(vector-float*! s2-0 s2-0 0.5)
|
||||
(cond
|
||||
((-> s3-0 ignore)
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(+! gp-0 1)
|
||||
)
|
||||
(add-debug-line #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50)
|
||||
#f
|
||||
(the-as rgba -1))
|
||||
(+! gp-0 1))
|
||||
(else
|
||||
(add-debug-line
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1)
|
||||
)
|
||||
(add-debug-vector
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
s2-0
|
||||
(-> s3-0 outward)
|
||||
(meters 0.3)
|
||||
(new 'static 'rgba :r #xff :a #x80)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(format *stdcon* "found ~D edges (and ~D ignored)~%" (- (-> this num-edges) (the-as uint gp-0)) gp-0)
|
||||
)
|
||||
)
|
||||
(add-debug-line #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x60)
|
||||
#f
|
||||
(the-as rgba -1))
|
||||
(add-debug-vector #t (bucket-id debug-no-zbuf) s2-0 (-> s3-0 outward) (meters 0.3) (new 'static 'rgba :r #xff :a #x80))))))
|
||||
(format *stdcon* "found ~D edges (and ~D ignored)~%" (- (-> this num-edges) (the-as uint gp-0)) gp-0)))
|
||||
|
||||
(defmethod debug-draw-sphere ((this collide-edge-work))
|
||||
(dotimes (s5-0 (the-as int (-> this num-verts)))
|
||||
(let ((a2-0 (-> this verts s5-0)))
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))))
|
||||
#f)
|
||||
|
||||
(defmethod debug-draw ((this collide-edge-hold-list))
|
||||
(let ((s4-0 (-> this head))
|
||||
(s5-0 0)
|
||||
)
|
||||
(s5-0 0))
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector))
|
||||
(s2-0 #t)
|
||||
)
|
||||
(s2-0 #t))
|
||||
(set! (-> s3-0 quad) (-> *target* control unknown-vector90 quad))
|
||||
(while s4-0
|
||||
(+! s5-0 1)
|
||||
@@ -681,129 +493,85 @@
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) s3-0 409.6 (new 'static 'rgba :a #x80))
|
||||
(cond
|
||||
(s2-0
|
||||
(set! s2-0 #f)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> s4-0 center-pt)
|
||||
614.4
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x80)
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80))
|
||||
)
|
||||
(set! s2-0 #f)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 center-pt) 614.4 (new 'static 'rgba :r #xff :g #xff :a #x80))
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80)))
|
||||
(else
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(-> s4-0 center-pt)
|
||||
614.4
|
||||
(new 'static 'rgba :r #x7f :g #x7f :a #x40)
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> s4-0 next))
|
||||
)
|
||||
)
|
||||
(format *stdcon* "hold list has ~D item(s)~%" s5-0)
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 center-pt) 614.4 (new 'static 'rgba :r #x7f :g #x7f :a #x40))
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))))
|
||||
(set! s4-0 (-> s4-0 next))))
|
||||
(format *stdcon* "hold list has ~D item(s)~%" s5-0))
|
||||
(dotimes (s5-1 (the-as int (-> this num-attempts)))
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> this attempts s5-1))
|
||||
409.6
|
||||
(new 'static 'rgba :a #x40)
|
||||
)
|
||||
)
|
||||
(format *stdcon* "hold list has ~D attempt(s)~%" (-> this num-attempts))
|
||||
)
|
||||
(add-debug-sphere #t (bucket-id debug-no-zbuf) (the-as vector (-> this attempts s5-1)) 409.6 (new 'static 'rgba :a #x40)))
|
||||
(format *stdcon* "hold list has ~D attempt(s)~%" (-> this num-attempts)))
|
||||
|
||||
(defmethod debug-draw-tris ((this collide-edge-work))
|
||||
(dotimes (s5-0 (the-as int (-> this num-tris)))
|
||||
(let* ((v1-3 (-> this tris s5-0 ctri))
|
||||
(t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64))
|
||||
)
|
||||
(add-debug-outline-triangle
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> v1-3 vertex))
|
||||
(-> v1-3 vertex 1)
|
||||
(-> v1-3 vertex 2)
|
||||
t1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64)))
|
||||
(add-debug-outline-triangle #t
|
||||
(bucket-id debug-no-zbuf)
|
||||
(the-as vector (-> v1-3 vertex))
|
||||
(-> v1-3 vertex 1)
|
||||
(-> v1-3 vertex 2)
|
||||
t1-0)))
|
||||
(none))
|
||||
|
||||
(let ((v1-1
|
||||
(new 'static 'surface
|
||||
:name '*rotate-surface*
|
||||
:turnv 1.0
|
||||
:turnvv 1.0
|
||||
:tiltv 1.0
|
||||
:tiltvv 1.0
|
||||
:transv-max 1.0
|
||||
:target-speed 1.0
|
||||
:seek0 153600.0
|
||||
:seek90 153600.0
|
||||
:seek180 256000.0
|
||||
:fric 153600.0
|
||||
:nonlin-fric-dist 5120.0
|
||||
:slip-factor 1.0
|
||||
:slope-down-factor 10240.0
|
||||
:slope-slip-angle 8192.0
|
||||
:impact-fric 1.0
|
||||
:bend-factor 0.8
|
||||
:bend-speed 4.0
|
||||
:alignv 1.0
|
||||
:slope-up-traction 1.0
|
||||
:align-speed 1.0
|
||||
:flags (surface-flags moving-ground)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-1 (new 'static
|
||||
'surface
|
||||
:name '*rotate-surface*
|
||||
:turnv 1.0
|
||||
:turnvv 1.0
|
||||
:tiltv 1.0
|
||||
:tiltvv 1.0
|
||||
:transv-max 1.0
|
||||
:target-speed 1.0
|
||||
:seek0 153600.0
|
||||
:seek90 153600.0
|
||||
:seek180 256000.0
|
||||
:fric 153600.0
|
||||
:nonlin-fric-dist 5120.0
|
||||
:slip-factor 1.0
|
||||
:slope-down-factor 10240.0
|
||||
:slope-slip-angle 8192.0
|
||||
:impact-fric 1.0
|
||||
:bend-factor 0.8
|
||||
:bend-speed 4.0
|
||||
:alignv 1.0
|
||||
:slope-up-traction 1.0
|
||||
:align-speed 1.0
|
||||
:flags (surface-flags moving-ground))))
|
||||
(define *rotate-surface* v1-1)
|
||||
(set! *rotate-surface* v1-1)
|
||||
(set! (-> v1-1 mult-hook)
|
||||
(the-as
|
||||
(function surface surface surface int none)
|
||||
(lambda ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) (if (= arg3 1)
|
||||
(set! (-> arg0 fric) 151756.8)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as (function surface surface surface int none)
|
||||
(lambda ((arg0 surface) (arg1 object) (arg2 object) (arg3 int))
|
||||
(if (= arg3 1) (set! (-> arg0 fric) 151756.8)))))
|
||||
(set! (-> v1-1 touch-hook) nothing)
|
||||
(set! (-> v1-1 active-hook) nothing)
|
||||
)
|
||||
(set! (-> v1-1 active-hook) nothing))
|
||||
|
||||
(let ((v1-2 (new 'static 'surface
|
||||
:name '*no-walk-surface*
|
||||
:turnv 0.5
|
||||
:turnvv 1.0
|
||||
:tiltv 1.0
|
||||
:tiltvv 1.0
|
||||
:transv-max 0.7
|
||||
:target-speed 0.7
|
||||
:seek0 24576.0
|
||||
:seek90 24576.0
|
||||
:seek180 24576.0
|
||||
:fric 23756.8
|
||||
:nonlin-fric-dist 4091904.0
|
||||
:slope-slip-angle 16384.0
|
||||
:bend-speed 4.0
|
||||
:alignv 0.5
|
||||
:slope-up-traction 0.9
|
||||
:align-speed 1.0
|
||||
:flags (surface-flags no-turn-around always-rotate-toward-transv)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-2 (new 'static
|
||||
'surface
|
||||
:name '*no-walk-surface*
|
||||
:turnv 0.5
|
||||
:turnvv 1.0
|
||||
:tiltv 1.0
|
||||
:tiltvv 1.0
|
||||
:transv-max 0.7
|
||||
:target-speed 0.7
|
||||
:seek0 24576.0
|
||||
:seek90 24576.0
|
||||
:seek180 24576.0
|
||||
:fric 23756.8
|
||||
:nonlin-fric-dist 4091904.0
|
||||
:slope-slip-angle 16384.0
|
||||
:bend-speed 4.0
|
||||
:alignv 0.5
|
||||
:slope-up-traction 0.9
|
||||
:align-speed 1.0
|
||||
:flags (surface-flags no-turn-around always-rotate-toward-transv))))
|
||||
(define *no-walk-surface* v1-2)
|
||||
(set! *no-walk-surface* v1-2)
|
||||
(set! (-> v1-2 mult-hook) (the-as (function surface surface surface int none) nothing))
|
||||
(set! (-> v1-2 touch-hook) nothing)
|
||||
(set! (-> v1-2 active-hook) nothing)
|
||||
)
|
||||
(set! (-> v1-2 active-hook) nothing))
|
||||
@@ -1,15 +1,10 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector-h.gc")
|
||||
(require "engine/draw/drawable-tree-h.gc")
|
||||
(require "engine/draw/drawable-inline-array-h.gc")
|
||||
|
||||
;; name: collide-frag-h.gc
|
||||
;; name in dgo: collide-frag-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;;;;;;;;;;;;;;;;;
|
||||
@@ -25,39 +20,25 @@
|
||||
; TODO - defined in drawable, but needed in collide-frag
|
||||
(define-extern sphere-cull (function vector symbol))
|
||||
|
||||
(deftype collide-frag-vertex (vector)
|
||||
()
|
||||
)
|
||||
|
||||
(deftype collide-frag-vertex (vector) ())
|
||||
|
||||
(deftype collide-frag-mesh (basic)
|
||||
((packed-data uint32)
|
||||
(pat-array uint32)
|
||||
(strip-data-len uint16)
|
||||
(poly-count uint16)
|
||||
(base-trans vector :inline)
|
||||
(vertex-count uint8 :overlay-at (-> base-trans w))
|
||||
(vertex-data-qwc uint8 :offset 29)
|
||||
(total-qwc uint8 :offset 30)
|
||||
(unused uint8 :offset 31)
|
||||
)
|
||||
)
|
||||
|
||||
((packed-data uint32)
|
||||
(pat-array uint32)
|
||||
(strip-data-len uint16)
|
||||
(poly-count uint16)
|
||||
(base-trans vector :inline)
|
||||
(vertex-count uint8 :overlay-at (-> base-trans w))
|
||||
(vertex-data-qwc uint8 :offset 29)
|
||||
(total-qwc uint8 :offset 30)
|
||||
(unused uint8 :offset 31)))
|
||||
|
||||
(deftype collide-fragment (drawable)
|
||||
((mesh collide-frag-mesh :offset 8)
|
||||
)
|
||||
)
|
||||
|
||||
((mesh collide-frag-mesh :offset 8)))
|
||||
|
||||
(deftype drawable-inline-array-collide-fragment (drawable-inline-array)
|
||||
((data collide-fragment 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
((data collide-fragment 1 :inline)
|
||||
(pad uint32)))
|
||||
|
||||
(deftype drawable-tree-collide-fragment (drawable-tree)
|
||||
((data-override drawable-inline-array :overlay-at (-> data 0))
|
||||
)
|
||||
)
|
||||
((data-override drawable-inline-array :overlay-at (-> data 0))))
|
||||
@@ -1,91 +1,66 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/level/bsp.gc")
|
||||
(require "engine/collide/collide-frag-h.gc")
|
||||
|
||||
;; name: collide-frag.gc
|
||||
;; name in dgo: collide-frag
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; This file contains the drawable-tree implementation for collide-fragment
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod login ((this drawable-tree-collide-fragment))
|
||||
this
|
||||
)
|
||||
this)
|
||||
|
||||
(defmethod draw ((this drawable-tree-collide-fragment) (arg0 drawable-tree-collide-fragment) (arg1 display-frame))
|
||||
"Note: this doesn't do anything (sadly)"
|
||||
(when *display-render-collision*
|
||||
(dotimes (s4-0 (-> this length))
|
||||
(draw (-> this data s4-0) (-> this data s4-0) arg1)
|
||||
)
|
||||
)
|
||||
(draw (-> this data s4-0) (-> this data s4-0) arg1)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod unpack-vis ((this drawable-tree-collide-fragment) (arg0 (pointer int8)) (arg1 (pointer int8)))
|
||||
arg1
|
||||
)
|
||||
arg1)
|
||||
|
||||
(defmethod collide-with-box ((this drawable-tree-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
"Collide everything in the tree with a box. Length arg doesn't matter here."
|
||||
(collide-with-box (-> this data-override) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod collide-y-probe ((this drawable-tree-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
(collide-y-probe (-> this data-override) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod collide-ray ((this drawable-tree-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
(collide-ray (-> this data-override) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod mem-usage ((this collide-fragment) (arg0 memory-usage-block) (arg1 int))
|
||||
(let ((s5-0 (if (logtest? arg1 1)
|
||||
53
|
||||
50
|
||||
)
|
||||
)
|
||||
(s4-0 (-> this mesh))
|
||||
)
|
||||
(let ((s5-0 (if (logtest? arg1 1) 53 50))
|
||||
(s4-0 (-> this mesh)))
|
||||
(set! (-> arg0 data s5-0 name) (symbol->string 'collide-fragment))
|
||||
(+! (-> arg0 data s5-0 count) 1)
|
||||
(let ((v1-11 (+ (asize-of this) (asize-of s4-0))))
|
||||
(+! (-> arg0 data s5-0 used) v1-11)
|
||||
(+! (-> arg0 data s5-0 total) (logand -16 (+ v1-11 15)))
|
||||
)
|
||||
(+! (-> arg0 data s5-0 total) (logand -16 (+ v1-11 15))))
|
||||
(set! (-> arg0 data (+ s5-0 1) name) "collision-poly")
|
||||
(+! (-> arg0 data (+ s5-0 1) count) (-> s4-0 poly-count))
|
||||
(let ((v1-22 (+ (-> s4-0 strip-data-len) (-> s4-0 poly-count))))
|
||||
(+! (-> arg0 data (+ s5-0 1) used) v1-22)
|
||||
(+! (-> arg0 data (+ s5-0 1) total) v1-22)
|
||||
)
|
||||
(+! (-> arg0 data (+ s5-0 1) total) v1-22))
|
||||
(set! (-> arg0 data (+ s5-0 2) name) "collision-vertex")
|
||||
(+! (-> arg0 data (+ s5-0 2) count) (-> s4-0 vertex-count))
|
||||
(let ((v1-31 (* (-> s4-0 vertex-data-qwc) 16)))
|
||||
(+! (-> arg0 data (+ s5-0 2) used) v1-31)
|
||||
(let ((v0-2 (+ (-> arg0 data (+ s5-0 2) total) v1-31)))
|
||||
(set! (-> arg0 data (+ s5-0 2) total) v0-2)
|
||||
(the-as collide-fragment v0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as collide-fragment v0-2)))))
|
||||
|
||||
(defmethod login ((this drawable-inline-array-collide-fragment))
|
||||
this
|
||||
)
|
||||
this)
|
||||
|
||||
(defmethod draw ((this collide-fragment) (arg0 collide-fragment) (arg1 display-frame))
|
||||
;; if we wanted to draw collide-fragment's we'd do it here.
|
||||
@@ -103,52 +78,34 @@
|
||||
; )
|
||||
;; (add-debug-point #t (bucket-id debug) (-> this bsphere))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod draw ((this drawable-inline-array-collide-fragment)
|
||||
(arg0 drawable-inline-array-collide-fragment)
|
||||
(arg1 display-frame)
|
||||
)
|
||||
(defmethod draw ((this drawable-inline-array-collide-fragment) (arg0 drawable-inline-array-collide-fragment) (arg1 display-frame))
|
||||
(dotimes (s4-0 (-> this length))
|
||||
(let ((s3-0 (-> this data s4-0)))
|
||||
(if (sphere-cull (-> s3-0 bsphere))
|
||||
(draw s3-0 s3-0 arg1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s3-0 (-> this data s4-0))) (if (sphere-cull (-> s3-0 bsphere)) (draw s3-0 s3-0 arg1))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod collide-with-box ((this drawable-inline-array-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
(collide-with-box (the-as collide-fragment (-> this data)) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod collide-y-probe ((this drawable-inline-array-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
(collide-y-probe (the-as collide-fragment (-> this data)) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod collide-ray ((this drawable-inline-array-collide-fragment) (arg0 int) (arg1 collide-list))
|
||||
(collide-ray (the-as collide-fragment (-> this data)) (-> this length) arg1)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod mem-usage ((this drawable-inline-array-collide-fragment) (arg0 memory-usage-block) (arg1 int))
|
||||
(set! (-> arg0 length) (max 1 (-> arg0 length)))
|
||||
(set! (-> arg0 data 0 name) (symbol->string 'drawable-group))
|
||||
(+! (-> arg0 data 0 count) 1)
|
||||
(let ((v1-7 32))
|
||||
(+! (-> arg0 data 0 used) v1-7)
|
||||
(+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15)))
|
||||
)
|
||||
(let ((v1-7 32)) (+! (-> arg0 data 0 used) v1-7) (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))))
|
||||
(dotimes (s3-0 (-> this length))
|
||||
(mem-usage (-> this data s3-0) arg0 arg1)
|
||||
)
|
||||
this
|
||||
)
|
||||
(mem-usage (-> this data s3-0) arg0 arg1))
|
||||
this)
|
||||
@@ -1,8 +1,5 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
;; name: collide-func-h.gc
|
||||
;; name in dgo: collide-func-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; empty!
|
||||
;; empty!
|
||||
@@ -1,15 +1,9 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector.gc")
|
||||
(require "kernel/gkernel-h.gc")
|
||||
|
||||
;; name: collide-func.gc
|
||||
;; name in dgo: collide-func
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
;; This file contains the primitive intersection functions used for collision.
|
||||
;; Most take a description of primitive and a "probe"
|
||||
;; The probe has an origin and a direction. The length of the direction vector is the length
|
||||
@@ -28,20 +22,10 @@
|
||||
|
||||
(defconstant COLLISION_MISS -100000000.0)
|
||||
|
||||
|
||||
|
||||
(defun raw-ray-sphere-intersect ((arg0 float))
|
||||
"DANGER: this function takes two arguments by vf registers.
|
||||
As a result, it doesn't work properly in OpenGOAL. See the functions below."
|
||||
(local-vars
|
||||
(v1-1 float)
|
||||
(v1-2 float)
|
||||
(v1-4 number)
|
||||
(a0-1 float)
|
||||
(a0-2 float)
|
||||
(a0-3 int)
|
||||
(a1-0 float)
|
||||
)
|
||||
(local-vars (v1-1 float) (v1-2 float) (v1-4 number) (a0-1 float) (a0-2 float) (a0-3 int) (a1-0 float))
|
||||
(crash!)
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
@@ -53,8 +37,7 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(.mov vf3 arg0) ;; vf3 = radius
|
||||
;; sphere is at the origin, vf1 is source of the ray (o)
|
||||
@@ -80,8 +63,7 @@
|
||||
(b! (< (the-as int a1-0) 0) cfg-7 :delay (set! a0-2 a0-1))
|
||||
(.mul.vf vf4 vf0 Q :mask #b1000)
|
||||
(.sub.vf vf9 vf8 vf7)
|
||||
(b! (= a0-2 v1-0) cfg-6 :delay (.mov v1-1 vf5))
|
||||
)
|
||||
(b! (= a0-2 v1-0) cfg-6 :delay (.mov v1-1 vf5)))
|
||||
(.sqrt.vf Q vf9 :ftf #b1)
|
||||
(b! (>= (the-as int v1-1) 0) cfg-6 :delay (.mov v1-2 vf9))
|
||||
(b! (< (the-as int v1-2) 0) cfg-6 :delay 1.0)
|
||||
@@ -93,33 +75,21 @@
|
||||
(.add.w.vf vf9 vf5 vf9 :mask #b10)
|
||||
(.mov a0-3 vf6)
|
||||
(.mul.w.vf vf9 vf9 vf4 :mask #b10)
|
||||
(b!
|
||||
(< (logand (the-as uint v1-4) (the-as uint a0-3)) 0)
|
||||
cfg-6
|
||||
:delay
|
||||
(.sub.y.vf vf4 vf0 vf9)
|
||||
)
|
||||
(b! (< (logand (the-as uint v1-4) (the-as uint a0-3)) 0) cfg-6 :delay (.sub.y.vf vf4 vf0 vf9))
|
||||
(b! #t cfg-7 :delay (.mov result vf4))
|
||||
(label cfg-6)
|
||||
(set! result -100000000.0)
|
||||
(label cfg-7)
|
||||
(the-as float result)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as float result))))
|
||||
|
||||
(defmacro pc-port-do-raw-ray-sphere-intersect (rad vf1-val vf2-val)
|
||||
"Calls to raw-ray-sphere-intersect should be replaced with this macro,
|
||||
and this should be given vf1, vf2, which contain the origin and direction of the probe."
|
||||
`(let ((vf1-storage (new 'stack-no-clear 'vector))
|
||||
(vf2-storage (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(.svf (&-> vf1-storage quad) ,vf1-val)
|
||||
(.svf (&-> vf2-storage quad) ,vf2-val)
|
||||
(pc-port-raw-ray-sphere-implementation ,rad vf1-storage vf2-storage)
|
||||
)
|
||||
)
|
||||
|
||||
(vf2-storage (new 'stack-no-clear 'vector)))
|
||||
(.svf (&-> vf1-storage quad) ,vf1-val)
|
||||
(.svf (&-> vf2-storage quad) ,vf2-val)
|
||||
(pc-port-raw-ray-sphere-implementation ,rad vf1-storage vf2-storage)))
|
||||
|
||||
(defun pc-port-raw-ray-sphere-implementation ((rad float) (vf1-val vector) (vf2-val vector))
|
||||
"This is one of the main primitives for collision.
|
||||
@@ -130,15 +100,7 @@
|
||||
- too far away (return MISS)
|
||||
- inside (return 0)
|
||||
"
|
||||
(local-vars
|
||||
(v1-1 int)
|
||||
(v1-2 int)
|
||||
(v1-4 int)
|
||||
(a0-1 float)
|
||||
(a0-2 float)
|
||||
(a0-3 int)
|
||||
(a1-0 int)
|
||||
)
|
||||
(local-vars (v1-1 int) (v1-2 int) (v1-4 int) (a0-1 float) (a0-2 float) (a0-3 int) (a1-0 int))
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -149,8 +111,7 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> vf1-val quad))
|
||||
(.lvf vf2 (&-> vf2-val quad))
|
||||
@@ -189,71 +150,54 @@
|
||||
(.add.w.vf vf9 vf5 vf9 :mask #b10)
|
||||
(.mov a0-3 vf6)
|
||||
(.mul.w.vf vf9 vf9 vf4 :mask #b10)
|
||||
|
||||
;; too far.
|
||||
(b! (< (logand (the-as int v1-4) (the-as int a0-3)) 0)
|
||||
cfg-6
|
||||
:delay (.sub.y.vf vf4 vf0 vf9)
|
||||
)
|
||||
(b! (< (logand (the-as int v1-4) (the-as int a0-3)) 0) cfg-6 :delay (.sub.y.vf vf4 vf0 vf9))
|
||||
(b! #t cfg-7 :delay (.mov result vf4))
|
||||
(label cfg-6)
|
||||
(set! result -100000000.0)
|
||||
(label cfg-7)
|
||||
(the-as float result)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(the-as float result))))
|
||||
|
||||
(defun ray-sphere-intersect ((ray-origin vector) (ray-dir vector) (sph-origin vector) (radius float))
|
||||
"Intersect a ray and sphere. Will return 0 if you are in the sphere, -huge number if you don't hit it.
|
||||
Returns the length of the ray to the first intersection."
|
||||
|
||||
;; offset stuff as if the sphere is at the origin.
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(vf2 :class vf))
|
||||
(.lvf vf1 (&-> ray-origin quad))
|
||||
(.lvf vf2 (&-> sph-origin quad))
|
||||
(.sub.vf vf1 vf1 vf2) ;; the sphere is at the origin in the actual intersection.
|
||||
(.lvf vf2 (&-> ray-dir quad))
|
||||
;;(raw-ray-sphere-intersect radius)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)
|
||||
)
|
||||
)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)))
|
||||
|
||||
(defun ray-circle-intersect ((ray-origin vector) (ray-dir vector) (circle-origin vector) (radius float))
|
||||
"Intersect ray with circle. Circle is on the y plane and this throws out the y components
|
||||
of ray-origin, circle-origin, and ray-dir"
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> ray-origin quad))
|
||||
(.mov.vf vf1 vf0 :mask #b10)
|
||||
(.lvf vf2 (&-> circle-origin quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
(.sub.vf vf1 vf1 vf2)
|
||||
(.lvf vf2 (&-> ray-dir quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
;;(raw-ray-sphere-intersect radius)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)
|
||||
)
|
||||
)
|
||||
(vf2 :class vf))
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> ray-origin quad))
|
||||
(.mov.vf vf1 vf0 :mask #b10)
|
||||
(.lvf vf2 (&-> circle-origin quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
(.sub.vf vf1 vf1 vf2)
|
||||
(.lvf vf2 (&-> ray-dir quad))
|
||||
(.mov.vf vf2 vf0 :mask #b10)
|
||||
;;(raw-ray-sphere-intersect radius)
|
||||
(pc-port-do-raw-ray-sphere-intersect radius vf1 vf2)))
|
||||
|
||||
(defun ray-cylinder-intersect ((ray-origin vector) (ray-dir vector) (cyl-origin vector) (cyl-axis vector) (cyl-rad float) (cyl-len float) (pt-out vector))
|
||||
(defun ray-cylinder-intersect ((ray-origin vector)
|
||||
(ray-dir vector)
|
||||
(cyl-origin vector)
|
||||
(cyl-axis vector)
|
||||
(cyl-rad float)
|
||||
(cyl-len float)
|
||||
(pt-out vector))
|
||||
"Intersect with a cylinder.
|
||||
Currently this is untested."
|
||||
(local-vars
|
||||
(v0-1 float)
|
||||
(v1-0 int)
|
||||
(v1-2 int)
|
||||
(a0-1 int)
|
||||
(a0-2 int)
|
||||
(a0-4 int)
|
||||
(a0-5 int)
|
||||
)
|
||||
(local-vars (v0-1 float) (v1-0 int) (v1-2 int) (a0-1 int) (a0-2 int) (a0-4 int) (a0-5 int))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
@@ -267,8 +211,7 @@
|
||||
(vf19 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf20 :class vf)
|
||||
(vf21 :class vf)
|
||||
)
|
||||
(vf21 :class vf))
|
||||
(.lvf vf10 (&-> ray-origin quad))
|
||||
(.lvf vf12 (&-> cyl-origin quad))
|
||||
(.sub.vf vf15 vf10 vf12)
|
||||
@@ -290,8 +233,7 @@
|
||||
(.mov a0-1 vf18)
|
||||
(let ((v1-1 (logand v1-0 (the-as uint a0-1))))
|
||||
(.sub.vf vf1 vf15 vf1)
|
||||
(b! (< v1-1 0) cfg-6 :delay (.sub.vf vf2 vf11 vf2))
|
||||
)
|
||||
(b! (< v1-1 0) cfg-6 :delay (.sub.vf vf2 vf11 vf2)))
|
||||
(.mov v1-2 vf19)
|
||||
(.mov a0-2 vf20)
|
||||
(b! (>= (the-as int (logior v1-2 (the-as uint a0-2))) 0) cfg-6 :delay (nop!))
|
||||
@@ -303,22 +245,14 @@
|
||||
(.mul.y.vf vf13 vf13 vf16)
|
||||
(.sub.x.vf vf19 vf16 vf14)
|
||||
(.mov a0-4 vf16)
|
||||
(b!
|
||||
(< (the-as int a0-4) 0)
|
||||
cfg-6
|
||||
:delay
|
||||
(.add.vf vf12 vf12 vf13 :mask #b111)
|
||||
)
|
||||
(b! (< (the-as int a0-4) 0) cfg-6 :delay (.add.vf vf12 vf12 vf13 :mask #b111))
|
||||
(.mov a0-5 vf19)
|
||||
(b! (>= (the-as int a0-5) 0) cfg-6 :delay (.svf (&-> pt-out quad) vf12))
|
||||
(b! #t cfg-7 :delay (set! v0-1 v1-4))
|
||||
)
|
||||
(b! #t cfg-7 :delay (set! v0-1 v1-4)))
|
||||
(label cfg-6)
|
||||
(set! v0-1 -100000000.0)
|
||||
(label cfg-7)
|
||||
v0-1
|
||||
)
|
||||
)
|
||||
v0-1))
|
||||
|
||||
(defun ray-plane-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 vector) (arg6 vector))
|
||||
"Unused."
|
||||
@@ -334,8 +268,7 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(.lvf vf3 (&-> arg5 quad))
|
||||
(.lvf vf1 (&-> arg4 quad))
|
||||
@@ -360,8 +293,7 @@
|
||||
(.mov a2-1 vf8)
|
||||
(.isqrt.vf Q vf0 vf5 :fsf #b11 :ftf #b0)
|
||||
(let ((f1-0 a2-1)
|
||||
(f2-0 v1-0)
|
||||
)
|
||||
(f2-0 v1-0))
|
||||
(cond
|
||||
((!= f2-0 0.0)
|
||||
(let ((f1-1 (/ f1-0 f2-0)))
|
||||
@@ -375,34 +307,23 @@
|
||||
(.add.mul.w.vf vf7 vf6 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 quad) vf7)
|
||||
(.mov v1-1 vf7)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
-100000000.0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
v0-0)))
|
||||
(else -100000000.0)))))
|
||||
|
||||
;; ray-triangle-intersect (unused)
|
||||
;; collide-do-primitives (used in moving-sphere-triangle-intersect)
|
||||
(def-mips2c collide-do-primitives (function float))
|
||||
|
||||
;; moving-sphere-triangle-intersect (used in cam)
|
||||
(def-mips2c moving-sphere-triangle-intersect (function vector vector float collide-cache-tri vector vector float))
|
||||
|
||||
;; moving-sphere-sphere-intersect (used in collide)
|
||||
(defun moving-sphere-sphere-intersect ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector))
|
||||
(let ((f30-0 (ray-sphere-intersect arg0 arg1 arg2 (+ (-> arg0 w) (-> arg2 w)))))
|
||||
(when (>= f30-0 0.0)
|
||||
(let ((s3-1 (vector-normalize! (vector-! (new-stack-vector0) arg2 arg0) (-> arg0 w))))
|
||||
(vector+*! arg3 arg0 arg1 f30-0)
|
||||
(vector+! arg3 arg3 s3-1)
|
||||
)
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
(vector+! arg3 arg3 s3-1)))
|
||||
f30-0))
|
||||
|
||||
;; moving-sphere-moving-sphere-intersect (unused)
|
||||
@@ -1,8 +1,4 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
;; name: collide-h.gc
|
||||
;; name in dgo: collide-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define *collide-test-flag* #f)
|
||||
(define *collide-test-flag* #f)
|
||||
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: collide-mesh-h.gc
|
||||
;; name in dgo: collide-mesh-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; The collide-mesh system is used for _moving_ meshes, like a platform.
|
||||
@@ -20,12 +15,10 @@
|
||||
;; The triangle involved in collision
|
||||
;; Note: this is reused for the background collision system.
|
||||
(deftype collide-tri-result (structure)
|
||||
((vertex vector 3 :inline)
|
||||
(intersect vector :inline)
|
||||
(normal vector :inline)
|
||||
(pat pat-surface)
|
||||
)
|
||||
)
|
||||
((vertex vector 3 :inline)
|
||||
(intersect vector :inline)
|
||||
(normal vector :inline)
|
||||
(pat pat-surface)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; static mesh data
|
||||
@@ -35,34 +28,29 @@
|
||||
;; The vertex indices index into the collide-mesh vertex-data array.
|
||||
;; Due to using uint8's you only get 256 vertices.
|
||||
(deftype collide-mesh-tri (structure)
|
||||
((vertex-index uint8 3)
|
||||
(unused uint8)
|
||||
(pat pat-surface)
|
||||
)
|
||||
:pack-me
|
||||
)
|
||||
((vertex-index uint8 3)
|
||||
(unused uint8)
|
||||
(pat pat-surface))
|
||||
:pack-me)
|
||||
|
||||
;; og:preserve-this
|
||||
(declare-type collide-mesh-cache-tri structure)
|
||||
|
||||
;; A collision mesh. Note that's it's bound to a specific joint.
|
||||
(deftype collide-mesh (basic)
|
||||
((joint-id int32)
|
||||
(num-tris uint32)
|
||||
(num-verts uint32)
|
||||
(vertex-data (inline-array vector))
|
||||
(tris collide-mesh-tri 1 :inline :offset 32)
|
||||
)
|
||||
((joint-id int32)
|
||||
(num-tris uint32)
|
||||
(num-verts uint32)
|
||||
(vertex-data (inline-array vector))
|
||||
(tris collide-mesh-tri 1 :inline :offset 32))
|
||||
(:methods
|
||||
(debug-draw-tris (_type_ process-drawable int) none)
|
||||
(overlap-test (_type_ collide-mesh-cache-tri vector) symbol)
|
||||
(should-push-away-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
|
||||
(sphere-on-platform-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
|
||||
(populate-cache! (_type_ collide-mesh-cache-tri matrix) none)
|
||||
(collide-mesh-math-1 (_type_ object object) none)
|
||||
(collide-mesh-math-2 (_type_ object object object) none)
|
||||
)
|
||||
)
|
||||
(debug-draw-tris (_type_ process-drawable int) none)
|
||||
(overlap-test (_type_ collide-mesh-cache-tri vector) symbol)
|
||||
(should-push-away-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
|
||||
(sphere-on-platform-test (_type_ collide-mesh-cache-tri collide-tri-result vector float) float)
|
||||
(populate-cache! (_type_ collide-mesh-cache-tri matrix) none)
|
||||
(collide-mesh-math-1 (_type_ object object) none)
|
||||
(collide-mesh-math-2 (_type_ object object object) none)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; cache
|
||||
@@ -78,19 +66,16 @@
|
||||
(defconstant COLLIDE_MESH_CACHE_SIZE #xa000)
|
||||
|
||||
(deftype collide-mesh-cache (basic)
|
||||
((used-size uint32)
|
||||
(max-size uint32)
|
||||
(id uint64)
|
||||
(data uint8 40960 :offset 32)
|
||||
)
|
||||
((used-size uint32)
|
||||
(max-size uint32)
|
||||
(id uint64)
|
||||
(data uint8 40960 :offset 32))
|
||||
(:methods
|
||||
(allocate! (_type_ int) int)
|
||||
(is-id? (_type_ int) symbol)
|
||||
(next-id! (_type_) uint)
|
||||
)
|
||||
)
|
||||
(allocate! (_type_ int) int)
|
||||
(is-id? (_type_ int) symbol)
|
||||
(next-id! (_type_) uint)))
|
||||
|
||||
(defmethod next-id! collide-mesh-cache ((obj collide-mesh-cache))
|
||||
(defmethod next-id! ((obj collide-mesh-cache))
|
||||
"Reset all used entries in the cache and increment the id.
|
||||
If the id is zero, set it to 1"
|
||||
;; ld v1, 12(a0)
|
||||
@@ -101,30 +86,22 @@
|
||||
(let ((v0 (+ v1 1)))
|
||||
;; beql v0, r0, L3
|
||||
;; addiu v0, r0, 1 (only taken if v0 = 0)
|
||||
(if (= v0 0)
|
||||
(set! v0 (the uint 1))
|
||||
)
|
||||
(if (= v0 0) (set! v0 (the uint 1)))
|
||||
;; L3:
|
||||
;; sd v0, 12(a0)
|
||||
(set! (-> obj id) v0)
|
||||
v0
|
||||
)
|
||||
)
|
||||
)
|
||||
v0)))
|
||||
|
||||
(defmethod is-id? ((this collide-mesh-cache) (arg0 int))
|
||||
"Is this our id?"
|
||||
(= (-> this id) arg0)
|
||||
)
|
||||
(= (-> this id) arg0))
|
||||
|
||||
;; possibly this is stored in the data of the collide-mesh-cache
|
||||
(deftype collide-mesh-cache-tri (structure)
|
||||
((vertex vector 3 :inline)
|
||||
(normal vector :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
(pat pat-surface :overlay-at (-> normal w))
|
||||
)
|
||||
)
|
||||
((vertex vector 3 :inline)
|
||||
(normal vector :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
(pat pat-surface :overlay-at (-> normal w))))
|
||||
|
||||
;; only allocate if we don't have an existing one.
|
||||
(define-perm *collide-mesh-cache* collide-mesh-cache (new 'global 'collide-mesh-cache))
|
||||
@@ -132,5 +109,7 @@
|
||||
;; og:preserve-this
|
||||
;; in all cases, re-init.
|
||||
(set! (-> *collide-mesh-cache* id) 1)
|
||||
|
||||
(set! (-> *collide-mesh-cache* used-size) 0)
|
||||
|
||||
(set! (-> *collide-mesh-cache* max-size) COLLIDE_MESH_CACHE_SIZE)
|
||||
@@ -1,40 +1,29 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/pat-h.gc")
|
||||
(require "engine/debug/debug.gc")
|
||||
(require "engine/collide/collide-mesh-h.gc")
|
||||
|
||||
;; name: collide-mesh.gc
|
||||
;; name in dgo: collide-mesh
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod asize-of ((this collide-mesh))
|
||||
"Compute the size in memory of a collide-mesh. Somehow this only counts num-tris and not verts."
|
||||
(the-as int (+ (-> collide-mesh size) (* (+ (-> this num-tris) -1) 8)))
|
||||
)
|
||||
(the-as int (+ (-> collide-mesh size) (* (+ (-> this num-tris) -1) 8))))
|
||||
|
||||
(defmethod mem-usage ((this collide-mesh) (arg0 memory-usage-block) (arg1 int))
|
||||
"Compute the memory usage of a collide-mesh."
|
||||
(set! (-> arg0 length) (max 79 (-> arg0 length)))
|
||||
(set! (-> arg0 data 78 name) "collide-mesh")
|
||||
(+! (-> arg0 data 78 count) 1)
|
||||
(let ((v1-6 (asize-of this)))
|
||||
(+! (-> arg0 data 78 used) v1-6)
|
||||
(+! (-> arg0 data 78 total) (logand -16 (+ v1-6 15)))
|
||||
)
|
||||
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 78 used) v1-6) (+! (-> arg0 data 78 total) (logand -16 (+ v1-6 15))))
|
||||
(set! (-> arg0 length) (max 79 (-> arg0 length)))
|
||||
(set! (-> arg0 data 78 name) "collide-mesh")
|
||||
(+! (-> arg0 data 78 count) 1)
|
||||
(let ((v1-16 (* (-> this num-verts) 16)))
|
||||
(+! (-> arg0 data 78 used) v1-16)
|
||||
(+! (-> arg0 data 78 total) (logand -16 (+ v1-16 15)))
|
||||
)
|
||||
(the-as collide-mesh 0)
|
||||
)
|
||||
(+! (-> arg0 data 78 total) (logand -16 (+ v1-16 15))))
|
||||
(the-as collide-mesh 0))
|
||||
|
||||
(defmethod debug-draw-tris ((this collide-mesh) (arg0 process-drawable) (arg1 int))
|
||||
"Draw a collide-mesh."
|
||||
@@ -46,17 +35,14 @@
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
)
|
||||
(vf7 :class vf))
|
||||
(init-vf0-vector)
|
||||
(let ((s5-0 (the-as object (-> this tris)))
|
||||
(s4-0 (-> arg0 node-list data arg1 bone transform))
|
||||
)
|
||||
(s4-0 (-> arg0 node-list data arg1 bone transform)))
|
||||
(countdown (s3-0 (-> this num-tris))
|
||||
(let ((a2-1 (new 'stack-no-clear 'vector))
|
||||
(a3-0 (new 'stack-no-clear 'vector))
|
||||
(t0-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(t0-0 (new 'stack-no-clear 'vector)))
|
||||
(.lvf vf4 (&-> s4-0 vector 0 quad))
|
||||
(.lvf vf5 (&-> s4-0 vector 1 quad))
|
||||
(.lvf vf6 (&-> s4-0 vector 2 quad))
|
||||
@@ -80,32 +66,20 @@
|
||||
(.svf (&-> a2-1 quad) vf1)
|
||||
(.svf (&-> a3-0 quad) vf2)
|
||||
(.svf (&-> t0-0 quad) vf3)
|
||||
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf) a2-1 a3-0 t0-0 t1-0)
|
||||
)
|
||||
)
|
||||
(set! s5-0 (-> (the-as (inline-array collide-mesh-tri) s5-0) 1))
|
||||
)
|
||||
)
|
||||
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf) a2-1 a3-0 t0-0 t1-0)))
|
||||
(set! s5-0 (-> (the-as (inline-array collide-mesh-tri) s5-0) 1))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
(none)))
|
||||
|
||||
(deftype sopt-work (structure)
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)))
|
||||
|
||||
(defmethod-mips2c "(method 12 collide-mesh)" 12 collide-mesh)
|
||||
|
||||
(deftype spat-work (structure)
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)))
|
||||
|
||||
(defmethod-mips2c "(method 11 collide-mesh)" 11 collide-mesh)
|
||||
|
||||
@@ -121,14 +95,11 @@
|
||||
(a3-0 (-> this data))
|
||||
(a2-0 (-> this max-size))
|
||||
(v1-2 (* v1-1 16))
|
||||
(a3-1 (&+ a3-0 a1-1))
|
||||
)
|
||||
(a3-1 (&+ a3-0 a1-1)))
|
||||
(let ((t1-0 (- a2-0 (the-as uint v1-2)))
|
||||
(t0-0 (-> this id))
|
||||
)
|
||||
(t0-0 (-> this id)))
|
||||
(b! (< (the-as int t1-0) 0) cfg-6 :delay (set! a1-2 (the-as int (+ a1-1 v1-2))))
|
||||
(b! (>= (the-as int (- a2-0 (the-as uint a1-2))) 0) cfg-5 :delay (set! a2-2 (the-as int (+ t0-0 1))))
|
||||
)
|
||||
(b! (>= (the-as int (- a2-0 (the-as uint a1-2))) 0) cfg-5 :delay (set! a2-2 (the-as int (+ t0-0 1)))))
|
||||
(b! (zero? (the-as uint a2-2)) cfg-4 :likely-delay (set! a2-2 1))
|
||||
(label cfg-4)
|
||||
(set! a1-2 v1-2)
|
||||
@@ -142,10 +113,7 @@
|
||||
(format 0 "ERROR: Attempted to allocate something bigger than the entire mesh cache!~%")
|
||||
(set! v0-0 (the-as (pointer uint8) #f))
|
||||
(label cfg-7)
|
||||
(the-as int v0-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as int v0-0))))
|
||||
|
||||
(defmethod populate-cache! ((this collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 matrix))
|
||||
(local-vars (t0-2 uint))
|
||||
@@ -163,13 +131,11 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(let ((t0-0 (scratchpad-object int))
|
||||
(v1-0 (-> this num-verts))
|
||||
)
|
||||
(v1-0 (-> this num-verts)))
|
||||
(nop!)
|
||||
(let ((a3-0 (-> this vertex-data)))
|
||||
(b! (zero? v1-0) cfg-3 :delay (.lvf vf1 (&-> arg1 vector 0 quad)))
|
||||
@@ -228,29 +194,23 @@
|
||||
(.svf (+ t0-1 16) vf10)
|
||||
(nop!)
|
||||
(.svf (+ t0-1 32) vf11)
|
||||
(b! (> (the-as int v1-0) 0) cfg-2 :delay (.svf (+ t0-1 48) vf12))
|
||||
)
|
||||
)
|
||||
)
|
||||
(b! (> (the-as int v1-0) 0) cfg-2 :delay (.svf (+ t0-1 48) vf12)))))
|
||||
(label cfg-3)
|
||||
(let ((v1-1 (the-as collide-mesh-tri (-> this tris))))
|
||||
(nop!)
|
||||
(let ((a2-1 (scratchpad-object int))
|
||||
(a0-1 (-> this num-tris))
|
||||
)
|
||||
(a0-1 (-> this num-tris)))
|
||||
(b! (zero? a0-1) cfg-6 :delay (set! t0-2 (-> v1-1 vertex-index 0)))
|
||||
(let* ((a1-1 (&+ arg0 -96))
|
||||
(let* ((a1-1 (&+ arg0 -96))
|
||||
(a3-1 (-> v1-1 vertex-index 1))
|
||||
(t0-3 (* t0-2 16))
|
||||
(t2-0 (-> v1-1 vertex-index 2))
|
||||
(t1-0 (* a3-1 16))
|
||||
(a3-2 (-> v1-1 pat))
|
||||
)
|
||||
(a3-2 (-> v1-1 pat)))
|
||||
(let* ((t2-1 (* t2-0 16))
|
||||
(t0-4 (+ t0-3 a2-1))
|
||||
(t1-1 (+ t1-0 a2-1))
|
||||
(t2-2 (+ t2-1 a2-1))
|
||||
)
|
||||
(t2-2 (+ t2-1 a2-1)))
|
||||
(label cfg-5)
|
||||
(+! a0-1 -1)
|
||||
(.lvf vf1 t0-4)
|
||||
@@ -283,14 +243,7 @@
|
||||
(.add.mul.z.vf vf7 vf0 vf7 acc :mask #b1000)
|
||||
(set! t1-1 (+ t2-4 a2-1))
|
||||
(.isqrt.vf Q vf0 vf7 :fsf #b11 :ftf #b11)
|
||||
(set! t2-2 (+ t3-0 a2-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! t2-2 (+ t3-0 a2-1)))))))))
|
||||
(.ftoi.vf vf8 vf8)
|
||||
(nop!)
|
||||
(.ftoi.vf vf9 vf9)
|
||||
@@ -305,22 +258,14 @@
|
||||
(.svf (&-> a1-1 normal quad) vf6)
|
||||
(nop!)
|
||||
(set! (-> a1-1 normal w) (the-as float a3-2))
|
||||
(b! (nonzero? a0-1) cfg-5 :delay (set! a3-2 (-> v1-1 pat)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(b! (nonzero? a0-1) cfg-5 :delay (set! a3-2 (-> v1-1 pat))))))
|
||||
(label cfg-6)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
(none)))
|
||||
|
||||
(deftype oot-work (structure)
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((intersect vector :inline)
|
||||
(sphere-bbox4w bounding-box4w :inline)))
|
||||
|
||||
(defmethod overlap-test ((this collide-mesh) (arg0 collide-mesh-cache-tri) (arg1 vector))
|
||||
(local-vars
|
||||
@@ -332,8 +277,7 @@
|
||||
(a1-4 uint128)
|
||||
(a1-7 uint)
|
||||
(a2-1 uint128)
|
||||
(a2-2 uint128)
|
||||
)
|
||||
(a2-2 uint128))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -341,13 +285,11 @@
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(vf6 :class vf))
|
||||
(init-vf0-vector)
|
||||
(set! zero (the-as uint128 0))
|
||||
(let ((s5-0 (new 'stack-no-clear 'matrix))
|
||||
(s4-0 arg0)
|
||||
)
|
||||
(s4-0 arg0))
|
||||
(.lvf vf2 (&-> arg1 quad))
|
||||
(let ((s3-0 (-> this num-tris)))
|
||||
(.sub.w.vf vf5 vf2 vf2)
|
||||
@@ -360,25 +302,13 @@
|
||||
(.svf (&-> s5-0 vector 2 quad) vf6)
|
||||
(label cfg-1)
|
||||
(b! (zero? s3-0) cfg-7 :delay (set! a2-1 (-> s4-0 bbox4w min quad)))
|
||||
(+! s3-0 -1)
|
||||
)
|
||||
(let ((a1-1 (-> s4-0 bbox4w max quad)))
|
||||
(.pcgtw a2-2 a2-1 a0-1)
|
||||
(.pcgtw a1-2 v1-0 a1-1)
|
||||
)
|
||||
(+! s3-0 -1))
|
||||
(let ((a1-1 (-> s4-0 bbox4w max quad))) (.pcgtw a2-2 a2-1 a0-1) (.pcgtw a1-2 v1-0 a1-1))
|
||||
(.por a1-3 a2-2 a1-2)
|
||||
(nop!)
|
||||
(.ppach a1-4 zero a1-3)
|
||||
(let ((a1-5 (shl (the-as int a1-4) 16)))
|
||||
(nop!)
|
||||
(b! (nonzero? a1-5) cfg-1 :likely-delay (set! s4-0 (&+ s4-0 96)))
|
||||
)
|
||||
(closest-pt-in-triangle
|
||||
(the-as vector (-> s5-0 vector))
|
||||
arg1
|
||||
(the-as matrix (-> s4-0 vertex))
|
||||
(-> s4-0 normal)
|
||||
)
|
||||
(let ((a1-5 (shl (the-as int a1-4) 16))) (nop!) (b! (nonzero? a1-5) cfg-1 :likely-delay (set! s4-0 (&+ s4-0 96))))
|
||||
(closest-pt-in-triangle (the-as vector (-> s5-0 vector)) arg1 (the-as matrix (-> s4-0 vertex)) (-> s4-0 normal))
|
||||
(.lvf vf1 (&-> s5-0 vector 0 quad))
|
||||
(.lvf vf2 (&-> arg1 quad))
|
||||
(set! v1-0 (-> s5-0 vector 1 quad))
|
||||
@@ -392,15 +322,5 @@
|
||||
(.sub.w.vf vf3 vf3 vf4 :mask #b1000)
|
||||
(.add.w.vf vf3 vf0 vf3 :mask #b10)
|
||||
(.mov a1-7 vf3)
|
||||
(b! (>= (the-as int a1-7) 0) cfg-1 :delay (set! s4-0 (&+ s4-0 96)))
|
||||
)
|
||||
(let ((v0-1 #t))
|
||||
(b! #t cfg-8 :delay (nop!))
|
||||
(the-as none 0)
|
||||
(label cfg-7)
|
||||
(set! v0-1 #f)
|
||||
(label cfg-8)
|
||||
v0-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(b! (>= (the-as int a1-7) 0) cfg-1 :delay (set! s4-0 (&+ s4-0 96))))
|
||||
(let ((v0-1 #t)) (b! #t cfg-8 :delay (nop!)) (the-as none 0) (label cfg-7) (set! v0-1 #f) (label cfg-8) v0-1)))
|
||||
@@ -1,7 +1,6 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/level/level-h.gc")
|
||||
(require "kernel/gkernel.gc")
|
||||
(require "engine/collide/collide-cache-h.gc")
|
||||
@@ -9,10 +8,6 @@
|
||||
(require "engine/collide/collide-frag-h.gc")
|
||||
(require "engine/draw/draw-node-h.gc")
|
||||
|
||||
;; name: collide-probe.gc
|
||||
;; name in dgo: collide-probe
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; The "collision probe" checks to see what the first triangle is in a given direction.
|
||||
@@ -28,16 +23,11 @@
|
||||
(defun creates-new-method? ((arg0 type) (arg1 int))
|
||||
"Is the method with the given ID in the given type a new method for this type?"
|
||||
;; does our parent have it?
|
||||
(let ((v1-1 (-> arg0 parent allocated-length)))
|
||||
(-> arg0 allocated-length)
|
||||
(>= arg1 (the-as int v1-1))
|
||||
)
|
||||
)
|
||||
(let ((v1-1 (-> arg0 parent allocated-length))) (-> arg0 allocated-length) (>= arg1 (the-as int v1-1))))
|
||||
|
||||
(defun overrides-parent-method? ((arg0 type) (arg1 int))
|
||||
"Does the method with the given ID in the given type override a method of its parent?"
|
||||
(!= (-> arg0 method-table arg1) (-> arg0 parent method-table arg1))
|
||||
)
|
||||
(!= (-> arg0 method-table arg1) (-> arg0 parent method-table arg1)))
|
||||
|
||||
(defun describe-methods ((arg0 type))
|
||||
"Print information about the methods of a type."
|
||||
@@ -47,25 +37,12 @@
|
||||
(format #t "~3d:~%" s4-0)
|
||||
(while (!= s3-0 basic)
|
||||
(cond
|
||||
((creates-new-method? s3-0 s4-0)
|
||||
(format #t " created by ~s.~%" (symbol->string (-> s3-0 symbol)))
|
||||
(set! s3-0 basic)
|
||||
)
|
||||
((creates-new-method? s3-0 s4-0) (format #t " created by ~s.~%" (symbol->string (-> s3-0 symbol))) (set! s3-0 basic))
|
||||
((overrides-parent-method? s3-0 s4-0)
|
||||
(format #t " overridden by ~s.~%" (symbol->string (-> s3-0 symbol)))
|
||||
(set! s3-0 (-> s3-0 parent))
|
||||
)
|
||||
(else
|
||||
(set! s3-0 (-> s3-0 parent))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
(set! s3-0 (-> s3-0 parent)))
|
||||
(else (set! s3-0 (-> s3-0 parent))))))))
|
||||
#f)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collide Fragment Debug
|
||||
@@ -75,36 +52,29 @@
|
||||
(defun indent-to ((arg0 int))
|
||||
"Print out arg0 spaces"
|
||||
(dotimes (s5-0 arg0)
|
||||
(format #t " ")
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(format #t " "))
|
||||
(none))
|
||||
|
||||
(defun-recursive probe-traverse-draw-node none ((arg0 draw-node) (arg1 int))
|
||||
"Print out info for a draw node, and recursively its children. They forgot to finish this one."
|
||||
(indent-to arg1)
|
||||
(format #t "[~08x] child-count: ~d, flags: ~d, dist: ~f, child: ~a~%"
|
||||
arg0
|
||||
(-> arg0 child-count)
|
||||
(-> arg0 flags)
|
||||
(-> arg0 distance)
|
||||
(-> arg0 child)
|
||||
)
|
||||
(format #t
|
||||
"[~08x] child-count: ~d, flags: ~d, dist: ~f, child: ~a~%"
|
||||
arg0
|
||||
(-> arg0 child-count)
|
||||
(-> arg0 flags)
|
||||
(-> arg0 distance)
|
||||
(-> arg0 child))
|
||||
(cond
|
||||
((nonzero? (-> arg0 flags))
|
||||
(let ((s4-0 (-> arg0 child)))
|
||||
(dotimes (s3-0 (the-as int (-> arg0 child-count)))
|
||||
(probe-traverse-draw-node (the-as draw-node (+ (the-as uint s4-0) (* s3-0 32))) (+ arg1 1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(probe-traverse-draw-node (the-as draw-node (+ (the-as uint s4-0) (* s3-0 32))) (+ arg1 1)))))
|
||||
(else
|
||||
;; we hit the leaves.
|
||||
)
|
||||
)
|
||||
;; we hit the leaves.
|
||||
))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defun probe-traverse-inline-array-node ((arg0 drawable-inline-array-node) (arg1 int))
|
||||
"Print out a drawable-inline-array-node, and recursively all children"
|
||||
@@ -114,13 +84,8 @@
|
||||
(dotimes (s3-0 s4-0)
|
||||
(indent-to arg1)
|
||||
(format #t "(~3d) ~a~%" s3-0 (-> arg0 data s3-0))
|
||||
(if (= (-> arg0 data s3-0 type) draw-node)
|
||||
(probe-traverse-draw-node (-> arg0 data s3-0) (+ arg1 1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(if (= (-> arg0 data s3-0 type) draw-node) (probe-traverse-draw-node (-> arg0 data s3-0) (+ arg1 1)))))
|
||||
(none))
|
||||
|
||||
(defun probe-traverse-collide-fragment ((arg0 drawable-tree-collide-fragment) (arg1 int))
|
||||
"Print out all levels of a drawabl-tree-collide-fragment."
|
||||
@@ -130,30 +95,20 @@
|
||||
(dotimes (s3-0 (+ s4-0 -1))
|
||||
(indent-to arg1)
|
||||
(if (= (-> arg0 data s3-0 type) drawable-inline-array-node)
|
||||
(probe-traverse-inline-array-node (the-as drawable-inline-array-node (-> arg0 data s3-0)) (+ arg1 1))
|
||||
(format #t "unknown: ~a~%" (-> arg0 data s3-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(probe-traverse-inline-array-node (the-as drawable-inline-array-node (-> arg0 data s3-0)) (+ arg1 1))
|
||||
(format #t "unknown: ~a~%" (-> arg0 data s3-0)))))
|
||||
(none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collide Probe Implementation
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(deftype collide-probe-stack-elem (structure)
|
||||
((child uint32)
|
||||
(count uint32)
|
||||
)
|
||||
)
|
||||
|
||||
((child uint32)
|
||||
(count uint32)))
|
||||
|
||||
(deftype collide-probe-stack (structure)
|
||||
((data collide-probe-stack-elem 1024 :inline)
|
||||
)
|
||||
)
|
||||
((data collide-probe-stack-elem 1024 :inline)))
|
||||
|
||||
;;(define *collide-probe-stack* (the-as pointer (+ 4192 #x70000000)))
|
||||
(define *collide-probe-stack* (scratchpad-object collide-probe-stack :offset 4192))
|
||||
@@ -163,19 +118,15 @@
|
||||
(def-mips2c collide-probe-node (function (inline-array draw-node) int collide-list int))
|
||||
|
||||
(defun print-out ((arg0 int))
|
||||
(format *stdcon* "~d~%" arg0)
|
||||
)
|
||||
(format *stdcon* "~d~%" arg0))
|
||||
|
||||
(defun collide-probe-instance-tie-collide-frags ()
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
;; collide-probe-instance-tie
|
||||
(def-mips2c collide-probe-instance-tie (function object int collide-list int int))
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collide Probe Setup/Wrappers
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -186,16 +137,12 @@
|
||||
(cond
|
||||
((< 1 (-> arg0 length))
|
||||
(let ((v1-1 (-> arg0 data-override)))
|
||||
(collide-probe-node (-> (the-as drawable-inline-array-node v1-1) data) (-> v1-1 length) arg1)
|
||||
)
|
||||
)
|
||||
(collide-probe-node (-> (the-as drawable-inline-array-node v1-1) data) (-> v1-1 length) arg1)))
|
||||
(else
|
||||
;; only 1 level in the tree. this is unsupported.
|
||||
)
|
||||
)
|
||||
;; only 1 level in the tree. this is unsupported.
|
||||
))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defun collide-probe-instance-tie-tree-make-list ((arg0 drawable-tree-instance-tie) (arg1 collide-list))
|
||||
"Given a TIE instance tree, make a list.
|
||||
@@ -203,58 +150,40 @@
|
||||
(cond
|
||||
((< 1 (-> arg0 length))
|
||||
(let ((v1-2 (-> arg0 data 0)))
|
||||
(collide-probe-instance-tie
|
||||
(-> (the-as drawable-inline-array-node v1-2) data)
|
||||
(-> (the-as drawable-inline-array-node v1-2) length)
|
||||
arg1
|
||||
1
|
||||
)
|
||||
)
|
||||
)
|
||||
(collide-probe-instance-tie (-> (the-as drawable-inline-array-node v1-2) data)
|
||||
(-> (the-as drawable-inline-array-node v1-2) length)
|
||||
arg1
|
||||
1)))
|
||||
((= (-> arg0 length) 1)
|
||||
;; between 1 and 8. Set flag 0 to indicate that we are using instance ties.
|
||||
(let ((v1-7 (-> arg0 data 0)))
|
||||
(collide-probe-instance-tie
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-7) data)
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-7) length)
|
||||
arg1
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
(collide-probe-instance-tie (-> (the-as drawable-inline-array-instance-tie v1-7) data)
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-7) length)
|
||||
arg1
|
||||
0))))
|
||||
0)
|
||||
|
||||
(defun collide-upload-vu0 ()
|
||||
"Upload the probe program to VU0."
|
||||
(#unless PC_PORT
|
||||
(let ((gp-0 *vu0-dma-list*))
|
||||
;; reset the buffer
|
||||
(let ((v1-0 gp-0))
|
||||
(set! (-> v1-0 base) (-> v1-0 data))
|
||||
(set! (-> v1-0 end) (&-> v1-0 data-buffer (-> v1-0 allocated-length)))
|
||||
)
|
||||
;; upload the function dma
|
||||
(dma-buffer-add-vu-function gp-0 collide-vu0-block 0)
|
||||
|
||||
;; end dma chain
|
||||
(let* ((v1-1 gp-0)
|
||||
(a0-5 (the-as object (-> v1-1 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-5) dma) (new 'static 'dma-tag :id (dma-tag-id end)))
|
||||
(set! (-> (the-as (pointer uint64) a0-5) 1) (the-as uint 0))
|
||||
(set! (-> v1-1 base) (&+ (the-as pointer a0-5) 16))
|
||||
)
|
||||
|
||||
;; go!
|
||||
(.sync.l)
|
||||
(dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0)
|
||||
)
|
||||
)
|
||||
(let ((gp-0 *vu0-dma-list*))
|
||||
;; reset the buffer
|
||||
(let ((v1-0 gp-0))
|
||||
(set! (-> v1-0 base) (-> v1-0 data))
|
||||
(set! (-> v1-0 end) (&-> v1-0 data-buffer (-> v1-0 allocated-length))))
|
||||
;; upload the function dma
|
||||
(dma-buffer-add-vu-function gp-0 collide-vu0-block 0)
|
||||
;; end dma chain
|
||||
(let* ((v1-1 gp-0)
|
||||
(a0-5 (the-as object (-> v1-1 base))))
|
||||
(set! (-> (the-as dma-packet a0-5) dma) (new 'static 'dma-tag :id (dma-tag-id end)))
|
||||
(set! (-> (the-as (pointer uint64) a0-5) 1) (the-as uint 0))
|
||||
(set! (-> v1-1 base) (&+ (the-as pointer a0-5) 16)))
|
||||
;; go!
|
||||
(.sync.l)
|
||||
(dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
;; main collide probe function:
|
||||
|
||||
@@ -264,7 +193,6 @@
|
||||
0
|
||||
;; load vu0 program
|
||||
(collide-upload-vu0)
|
||||
|
||||
;; iterate over trees
|
||||
(let ((s5-1 (-> s5-0 drawable-trees)))
|
||||
(dotimes (s4-0 (-> s5-1 length))
|
||||
@@ -276,56 +204,30 @@
|
||||
(cond
|
||||
((< 1 (-> v1-3 length))
|
||||
(let ((v1-4 (-> v1-3 data 0)))
|
||||
(collide-probe-instance-tie
|
||||
(-> (the-as drawable-inline-array-node v1-4) data)
|
||||
(-> (the-as drawable-inline-array-node v1-4) length)
|
||||
a2-0
|
||||
1
|
||||
)
|
||||
)
|
||||
)
|
||||
(collide-probe-instance-tie (-> (the-as drawable-inline-array-node v1-4) data)
|
||||
(-> (the-as drawable-inline-array-node v1-4) length)
|
||||
a2-0
|
||||
1)))
|
||||
((= (-> v1-3 length) 1)
|
||||
(let ((v1-6 (-> v1-3 data 0)))
|
||||
(collide-probe-instance-tie
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-6) data)
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-6) length)
|
||||
a2-0
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
(collide-probe-instance-tie (-> (the-as drawable-inline-array-instance-tie v1-6) data)
|
||||
(-> (the-as drawable-inline-array-instance-tie v1-6) length)
|
||||
a2-0
|
||||
0)))))
|
||||
0)
|
||||
((= (-> v1-3 type) drawable-tree-collide-fragment)
|
||||
;; collide with tfrags
|
||||
(let ((a2-1 arg1))
|
||||
(cond
|
||||
((< 1 (-> v1-3 length))
|
||||
(let ((v1-9 (-> v1-3 data 0)))
|
||||
(collide-probe-node
|
||||
(-> (the-as drawable-inline-array-node v1-9) data)
|
||||
(-> (the-as drawable-inline-array-node v1-9) length)
|
||||
a2-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
(else
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(collide-probe-node (-> (the-as drawable-inline-array-node v1-9) data)
|
||||
(-> (the-as drawable-inline-array-node v1-9) length)
|
||||
a2-1)))
|
||||
(else)))
|
||||
0)
|
||||
(else))))))
|
||||
(none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
;; Hacks
|
||||
@@ -336,65 +238,32 @@
|
||||
(defun distc ((arg0 vector) (arg1 vector))
|
||||
(let* ((f0-1 (- (-> arg0 x) (-> arg1 x)))
|
||||
(f0-3 (* f0-1 f0-1))
|
||||
(f1-2 (- (-> arg0 z) (-> arg1 z)))
|
||||
)
|
||||
(sqrtf (+ f0-3 (* f1-2 f1-2)))
|
||||
)
|
||||
)
|
||||
(f1-2 (- (-> arg0 z) (-> arg1 z))))
|
||||
(sqrtf (+ f0-3 (* f1-2 f1-2)))))
|
||||
|
||||
(defun interpolate ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
|
||||
(let ((f0-1 (- arg3 arg1))
|
||||
(f1-2 (- arg4 arg2))
|
||||
(f3-1 (- arg0 arg1))
|
||||
)
|
||||
(+ arg2 (/ (* f3-1 f1-2) f0-1))
|
||||
)
|
||||
)
|
||||
(f3-1 (- arg0 arg1)))
|
||||
(+ arg2 (/ (* f3-1 f1-2) f0-1))))
|
||||
|
||||
(defun misty-ambush-height ((arg0 vector))
|
||||
(let* ((a1-0 (new 'static 'vector :x -808960.0 :y 111656.96 :z 3924992.0))
|
||||
(f0-0 (distc arg0 a1-0))
|
||||
)
|
||||
(f0-0 (distc arg0 a1-0)))
|
||||
(cond
|
||||
((< f0-0 52019.2)
|
||||
111656.96
|
||||
)
|
||||
((>= 58982.4 f0-0)
|
||||
(interpolate f0-0 52019.2 111656.96 58982.4 116776.96)
|
||||
)
|
||||
((>= 124436.48 f0-0)
|
||||
(interpolate f0-0 58982.4 116776.96 124436.48 114688.0)
|
||||
)
|
||||
((>= 219217.92 f0-0)
|
||||
(interpolate f0-0 124436.48 114688.0 219217.92 113254.4)
|
||||
)
|
||||
(else
|
||||
113254.4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((< f0-0 52019.2) 111656.96)
|
||||
((>= 58982.4 f0-0) (interpolate f0-0 52019.2 111656.96 58982.4 116776.96))
|
||||
((>= 124436.48 f0-0) (interpolate f0-0 58982.4 116776.96 124436.48 114688.0))
|
||||
((>= 219217.92 f0-0) (interpolate f0-0 124436.48 114688.0 219217.92 113254.4))
|
||||
(else 113254.4))))
|
||||
|
||||
(defun misty-ambush-height-probe ((arg0 vector) (arg1 float))
|
||||
"Hack to manually compute the ground height in misty ambush."
|
||||
(let ((f0-0 (misty-ambush-height arg0)))
|
||||
(cond
|
||||
((< f0-0 (-> arg0 y))
|
||||
(/ (- (-> arg0 y) f0-0) arg1)
|
||||
)
|
||||
(else
|
||||
(format 0 "WARNING: ~%height = ~f, pos.y = ~f" (* 0.00024414062 f0-0) (* 0.00024414062 (-> arg0 y)))
|
||||
-1.0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((< f0-0 (-> arg0 y)) (/ (- (-> arg0 y) f0-0) arg1))
|
||||
(else (format 0 "WARNING: ~%height = ~f, pos.y = ~f" (* 0.00024414062 f0-0) (* 0.00024414062 (-> arg0 y))) -1.0))))
|
||||
|
||||
(defun pke-collide-test ()
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(none))
|
||||
@@ -1,7 +1,6 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/pat-h.gc")
|
||||
(require "engine/math/quaternion.gc")
|
||||
(require "kernel/gkernel-h.gc")
|
||||
@@ -9,10 +8,6 @@
|
||||
(require "engine/game/game-h.gc")
|
||||
(require "engine/engine/connect.gc")
|
||||
|
||||
;; name: collide-shape-h.gc
|
||||
;; name in dgo: collide-shape-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; What is collide-shape?
|
||||
;; A collide shape is a group of collision geometry. Typically, each actor will have a single collide shape.
|
||||
;; Each collide shape may contain a number of collide-shape-prim's.
|
||||
@@ -42,7 +37,6 @@
|
||||
;; - uses "collide-mesh-cache".
|
||||
;; - can't collide with water or the background.
|
||||
|
||||
|
||||
;; The "new" system:
|
||||
;; - is the only way to collide with the background/water
|
||||
;; - uses "collide-cache"
|
||||
@@ -53,7 +47,6 @@
|
||||
;; foreground meshes. The new system can just import foreground collision meshes
|
||||
;; into its collide cache.
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Collision queries:
|
||||
@@ -74,7 +67,6 @@
|
||||
;; This will call the reaction function. The default "default-collision-reaction" function is in collide-shape.gc
|
||||
;; will fill the touching list.
|
||||
|
||||
|
||||
;; Nav Enemy Collision (made up name)
|
||||
;; collide-shape-moving-method-58 and integrate-for-enemy-with-move-to-ground are nav-enemy specific.
|
||||
;; the details aren't super well understood yet. But they basically try to go forward if they aren't blocked.
|
||||
@@ -87,8 +79,8 @@
|
||||
;; for platforms, detect if somebody is on the platform. (on-platform-test)
|
||||
;; uses old system. Sends event adds to rider list.
|
||||
|
||||
|
||||
(declare-type touching-list structure)
|
||||
|
||||
(declare-type collide-shape-prim basic)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
@@ -101,57 +93,43 @@
|
||||
;; Sticky: when you hit the platform, your velocity immediately changes to match the thing.
|
||||
;; like when Jak lands on a platform.
|
||||
|
||||
|
||||
(deftype collide-sticky-rider (structure)
|
||||
((rider-handle handle)
|
||||
(sticky-prim collide-shape-prim)
|
||||
(prim-ry float)
|
||||
(rider-local-pos vector :inline)
|
||||
)
|
||||
((rider-handle handle)
|
||||
(sticky-prim collide-shape-prim)
|
||||
(prim-ry float)
|
||||
(rider-local-pos vector :inline))
|
||||
(:methods
|
||||
(set-rider! (_type_ handle) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
(set-rider! (_type_ handle) symbol)))
|
||||
|
||||
(defmethod set-rider! ((this collide-sticky-rider) (arg0 handle))
|
||||
"Set the rider and clear the primitive."
|
||||
(set! (-> this rider-handle) arg0)
|
||||
(set! (-> this sticky-prim) #f)
|
||||
#f
|
||||
)
|
||||
#f)
|
||||
|
||||
;; A collection of collide-sticky-riders
|
||||
;; dynamic type. There's one collide-sticky-rider per rider.
|
||||
(deftype collide-sticky-rider-group (basic)
|
||||
((num-riders int32)
|
||||
(allocated-riders int32)
|
||||
(rider collide-sticky-rider 1 :inline)
|
||||
)
|
||||
((num-riders int32)
|
||||
(allocated-riders int32)
|
||||
(rider collide-sticky-rider 1 :inline))
|
||||
(:methods
|
||||
(new (symbol type int) _type_)
|
||||
(add-rider! (_type_ process-drawable) collide-sticky-rider)
|
||||
(reset! (_type_) int)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type int) _type_)
|
||||
(add-rider! (_type_ process-drawable) collide-sticky-rider)
|
||||
(reset! (_type_) int)))
|
||||
|
||||
(defmethod reset! ((this collide-sticky-rider-group))
|
||||
"Reset all active riders"
|
||||
(set! (-> this num-riders) 0)
|
||||
0
|
||||
)
|
||||
0)
|
||||
|
||||
;; The rider will be pulled along by the object.
|
||||
;; This includes possibly rotating the rider (if the platform spins, it spins Jak too).
|
||||
(deftype pull-rider-info (structure)
|
||||
((rider collide-sticky-rider)
|
||||
(rider-cshape collide-shape-moving)
|
||||
(rider-delta-ry float)
|
||||
(rider-dest vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((rider collide-sticky-rider)
|
||||
(rider-cshape collide-shape-moving)
|
||||
(rider-delta-ry float)
|
||||
(rider-dest vector :inline)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collision Result
|
||||
@@ -161,37 +139,29 @@
|
||||
;; this computes a "move-vec" and "u". If you move along "move-vec" by "u", you will move out of collsion.
|
||||
;; It also tells you which primitives are colliding.
|
||||
(deftype collide-shape-intersect (basic)
|
||||
((move-vec vector :inline)
|
||||
(best-u float)
|
||||
(best-tri collide-tri-result :inline)
|
||||
(best-from-prim collide-shape-prim)
|
||||
(best-to-prim collide-shape-prim)
|
||||
)
|
||||
((move-vec vector :inline)
|
||||
(best-u float)
|
||||
(best-tri collide-tri-result :inline)
|
||||
(best-from-prim collide-shape-prim)
|
||||
(best-to-prim collide-shape-prim))
|
||||
(:methods
|
||||
(init! (_type_ vector) symbol)
|
||||
)
|
||||
)
|
||||
(init! (_type_ vector) symbol)))
|
||||
|
||||
;; Collision with just overlap distance, no vector.
|
||||
(deftype collide-overlap-result (structure)
|
||||
((best-dist float)
|
||||
(best-from-prim collide-shape-prim)
|
||||
(best-to-prim collide-shape-prim)
|
||||
(best-from-tri collide-tri-result :inline)
|
||||
)
|
||||
((best-dist float)
|
||||
(best-from-prim collide-shape-prim)
|
||||
(best-to-prim collide-shape-prim)
|
||||
(best-from-tri collide-tri-result :inline))
|
||||
(:methods
|
||||
(reset! (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(reset! (_type_) none)))
|
||||
|
||||
(defmethod reset! ((this collide-overlap-result))
|
||||
"Reset the result."
|
||||
(set! (-> this best-dist) 0.0)
|
||||
(set! (-> this best-from-prim) #f)
|
||||
(set! (-> this best-to-prim) #f)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Touching System
|
||||
@@ -201,24 +171,24 @@
|
||||
;; but this isn't well understood yet
|
||||
|
||||
(deftype overlaps-others-params (structure)
|
||||
((options uint32)
|
||||
(tlist touching-list)
|
||||
)
|
||||
)
|
||||
((options uint32)
|
||||
(tlist touching-list)))
|
||||
|
||||
;; The engine system is used to link collision checks with processes.
|
||||
;; This allows you to have lists of processes where the process will remove itself when it dies.
|
||||
(define *collide-hit-by-player-list* (new 'global 'engine 'collide-hit-by-player-list 768))
|
||||
|
||||
(define *collide-usually-hit-by-player-list* (new 'global 'engine 'collide-usually-hit-by-player-list 256))
|
||||
|
||||
(define *collide-hit-by-others-list* (new 'global 'engine 'collide-hit-by-others-list 96))
|
||||
|
||||
(define *collide-player-list* (new 'global 'engine 'collide-player-list 32))
|
||||
|
||||
(defenum collide-list-enum
|
||||
(hit-by-player)
|
||||
(usually-hit-by-player)
|
||||
(hit-by-others)
|
||||
(player)
|
||||
)
|
||||
(player))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collision Primitive Base
|
||||
@@ -226,7 +196,6 @@
|
||||
|
||||
;; These are the settings that can be set per primitive.
|
||||
|
||||
|
||||
(defenum collide-kind
|
||||
:type uint64
|
||||
:bitfield #t
|
||||
@@ -293,29 +262,28 @@
|
||||
(unknown-60 60)
|
||||
(unknown-61 61)
|
||||
(unknown-62 62)
|
||||
(unknown-63 63)
|
||||
)
|
||||
(unknown-63 63))
|
||||
|
||||
(defenum collide-action
|
||||
:type uint32
|
||||
:bitfield #t
|
||||
(solid 0) ;; used for solid things
|
||||
(rider-plat-sticky 1) ;; used for platforms in rider/platform interactions
|
||||
(rider-target 2) ;; used for target in rider/platform interactions
|
||||
(edgegrab-active 3) ;; set/cleared when entering/exiting edgegrab states
|
||||
(rider-plat 4) ;; used for platforms in rider/platform interactions
|
||||
(unused 5) ;; totally unused?
|
||||
(edgegrab-possible 6) ;; used when edge grab checks should be done
|
||||
(edgegrab-cam 7) ;; set/cleared when entering/exiting edgegrab states
|
||||
(swingpole-active 8) ;; set/cleared when entering/exiting swingpole states
|
||||
(racer 9) ;; set/cleared when entering/exiting racer states
|
||||
(attackable 10) ;; used for something to do with attacking/damaging
|
||||
(solid 0) ;; used for solid things
|
||||
(rider-plat-sticky 1) ;; used for platforms in rider/platform interactions
|
||||
(rider-target 2) ;; used for target in rider/platform interactions
|
||||
(edgegrab-active 3) ;; set/cleared when entering/exiting edgegrab states
|
||||
(rider-plat 4) ;; used for platforms in rider/platform interactions
|
||||
(unused 5) ;; totally unused?
|
||||
(edgegrab-possible 6) ;; used when edge grab checks should be done
|
||||
(edgegrab-cam 7) ;; set/cleared when entering/exiting edgegrab states
|
||||
(swingpole-active 8) ;; set/cleared when entering/exiting swingpole states
|
||||
(racer 9) ;; set/cleared when entering/exiting racer states
|
||||
(attackable 10) ;; used for something to do with attacking/damaging
|
||||
(attackable-unused 11) ;; seems to relate to attacking - set in several places but never tested for?
|
||||
(snowball 12) ;; set/cleared when entering/exiting snowball states
|
||||
(tube 13) ;; set/cleared when entering/exiting tube states
|
||||
(flut 14) ;; set/cleared when entering/exiting flutflut states
|
||||
(racer-grounded 15) ;; set/cleared when entering/exiting certain racer states w/ extra conditions
|
||||
(racer-unused 16) ;; seems to relate to racer - never set, only cleared in one place?
|
||||
(snowball 12) ;; set/cleared when entering/exiting snowball states
|
||||
(tube 13) ;; set/cleared when entering/exiting tube states
|
||||
(flut 14) ;; set/cleared when entering/exiting flutflut states
|
||||
(racer-grounded 15) ;; set/cleared when entering/exiting certain racer states w/ extra conditions
|
||||
(racer-unused 16) ;; seems to relate to racer - never set, only cleared in one place?
|
||||
)
|
||||
|
||||
;; this field is a bit confusing. you have to have a higher offense to win against an object.
|
||||
@@ -325,70 +293,67 @@
|
||||
(defenum collide-offense
|
||||
:type int8
|
||||
(no-offense 0)
|
||||
(touch 1) ;; just have to touch
|
||||
(normal-attack 2) ;; any attack (like a normal crate)
|
||||
(strong-attack 3) ;; hit with zoomer, slide, ground pound/flop, flut attack
|
||||
(indestructible 4) ;; can't attack it.
|
||||
(touch 1) ;; just have to touch
|
||||
(normal-attack 2) ;; any attack (like a normal crate)
|
||||
(strong-attack 3) ;; hit with zoomer, slide, ground pound/flop, flut attack
|
||||
(indestructible 4) ;; can't attack it.
|
||||
)
|
||||
|
||||
|
||||
;; Every primitive has a prim-core.
|
||||
;; this is a 32-byte chunk of data that can be pulled out an put in collide caches
|
||||
;; it stores the transformed world sphere and the collision settings
|
||||
(deftype collide-prim-core (structure)
|
||||
((world-sphere vector :inline)
|
||||
(collide-as collide-kind)
|
||||
(action collide-action)
|
||||
(offense collide-offense)
|
||||
(prim-type int8)
|
||||
(extra uint8 2)
|
||||
(quad uint128 2 :overlay-at (-> world-sphere quad))
|
||||
)
|
||||
)
|
||||
((world-sphere vector :inline)
|
||||
(collide-as collide-kind)
|
||||
(action collide-action)
|
||||
(offense collide-offense)
|
||||
(prim-type int8)
|
||||
(extra uint8 2)
|
||||
(quad uint128 2 :overlay-at (-> world-sphere quad))))
|
||||
|
||||
(declare-type collide-shape basic)
|
||||
|
||||
(declare-type collide-cache-prim structure)
|
||||
|
||||
(declare-type collide-shape-prim-group basic)
|
||||
|
||||
(declare-type collide-cache basic)
|
||||
|
||||
;; the base class for collision shapes.
|
||||
(deftype collide-shape-prim (basic)
|
||||
((cshape collide-shape)
|
||||
(prim-id uint32)
|
||||
(transform-index int8)
|
||||
(prim-core collide-prim-core :inline)
|
||||
(local-sphere vector :inline)
|
||||
(collide-with collide-kind)
|
||||
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
||||
(collide-as collide-kind :overlay-at (-> prim-core collide-as))
|
||||
(action collide-action :overlay-at (-> prim-core action))
|
||||
(offense collide-offense :overlay-at (-> prim-core offense))
|
||||
(prim-type int8 :overlay-at (-> prim-core prim-type))
|
||||
(radius meters :overlay-at (-> local-sphere w))
|
||||
)
|
||||
((cshape collide-shape)
|
||||
(prim-id uint32)
|
||||
(transform-index int8)
|
||||
(prim-core collide-prim-core :inline)
|
||||
(local-sphere vector :inline)
|
||||
(collide-with collide-kind)
|
||||
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
||||
(collide-as collide-kind :overlay-at (-> prim-core collide-as))
|
||||
(action collide-action :overlay-at (-> prim-core action))
|
||||
(offense collide-offense :overlay-at (-> prim-core offense))
|
||||
(prim-type int8 :overlay-at (-> prim-core prim-type))
|
||||
(radius meters :overlay-at (-> local-sphere w)))
|
||||
(:methods
|
||||
(new (symbol type collide-shape uint int) _type_)
|
||||
(move-by-vector! (_type_ vector) none)
|
||||
(find-prim-by-id (_type_ uint) collide-shape-prim)
|
||||
(debug-draw-world-sphere (_type_) symbol)
|
||||
(add-fg-prim-using-box (_type_ collide-cache) none)
|
||||
(add-fg-prim-using-line-sphere (_type_ collide-cache) none)
|
||||
(add-fg-prim-using-y-probe (_type_ collide-cache) none)
|
||||
(overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol)
|
||||
(overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol)
|
||||
(unused-17 () none)
|
||||
(collide-with-collide-cache-prim-mesh (_type_ collide-shape-intersect collide-cache-prim) none)
|
||||
(collide-with-collide-cache-prim-sphere (_type_ collide-shape-intersect collide-cache-prim) none)
|
||||
(add-to-bounding-box (_type_ collide-kind) symbol)
|
||||
(num-mesh (_type_ collide-shape-prim) int)
|
||||
(on-platform-test (_type_ collide-shape-prim collide-overlap-result float) none)
|
||||
(should-push-away-test (_type_ collide-shape-prim collide-overlap-result) none)
|
||||
(should-push-away-reverse-test (_type_ collide-shape-prim-group collide-overlap-result) none)
|
||||
(update-transforms! (_type_ process-drawable) symbol)
|
||||
(set-collide-as! (_type_ collide-kind) none)
|
||||
(set-collide-with! (_type_ collide-kind) none)
|
||||
)
|
||||
)
|
||||
(new (symbol type collide-shape uint int) _type_)
|
||||
(move-by-vector! (_type_ vector) none)
|
||||
(find-prim-by-id (_type_ uint) collide-shape-prim)
|
||||
(debug-draw-world-sphere (_type_) symbol)
|
||||
(add-fg-prim-using-box (_type_ collide-cache) none)
|
||||
(add-fg-prim-using-line-sphere (_type_ collide-cache) none)
|
||||
(add-fg-prim-using-y-probe (_type_ collide-cache) none)
|
||||
(overlaps-others-test (_type_ overlaps-others-params collide-shape-prim) symbol)
|
||||
(overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol)
|
||||
(unused-17 () none)
|
||||
(collide-with-collide-cache-prim-mesh (_type_ collide-shape-intersect collide-cache-prim) none)
|
||||
(collide-with-collide-cache-prim-sphere (_type_ collide-shape-intersect collide-cache-prim) none)
|
||||
(add-to-bounding-box (_type_ collide-kind) symbol)
|
||||
(num-mesh (_type_ collide-shape-prim) int)
|
||||
(on-platform-test (_type_ collide-shape-prim collide-overlap-result float) none)
|
||||
(should-push-away-test (_type_ collide-shape-prim collide-overlap-result) none)
|
||||
(should-push-away-reverse-test (_type_ collide-shape-prim-group collide-overlap-result) none)
|
||||
(update-transforms! (_type_ process-drawable) symbol)
|
||||
(set-collide-as! (_type_ collide-kind) none)
|
||||
(set-collide-with! (_type_ collide-kind) none)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Specific Collision Implementation
|
||||
@@ -402,43 +367,34 @@
|
||||
;; the pat is stored directly here.
|
||||
;; I believe the "local sphere" is used as the sphere.
|
||||
(deftype collide-shape-prim-sphere (collide-shape-prim)
|
||||
((pat pat-surface)
|
||||
)
|
||||
((pat pat-surface))
|
||||
(:methods
|
||||
(new (symbol type collide-shape uint) _type_)
|
||||
)
|
||||
)
|
||||
(new (symbol type collide-shape uint) _type_)))
|
||||
|
||||
;; mesh collision
|
||||
;; the pats are stored per tri in the mesh.
|
||||
;; These meshes interact with a cache automatically (a specific collide-shape-prim-mesh cache, not the
|
||||
;; more general collide-cache)
|
||||
(deftype collide-shape-prim-mesh (collide-shape-prim)
|
||||
((mesh collide-mesh)
|
||||
(mesh-id int32)
|
||||
(mesh-cache-id uint64)
|
||||
(mesh-cache-tris (inline-array collide-mesh-cache-tri))
|
||||
)
|
||||
((mesh collide-mesh)
|
||||
(mesh-id int32)
|
||||
(mesh-cache-id uint64)
|
||||
(mesh-cache-tris (inline-array collide-mesh-cache-tri)))
|
||||
(:methods
|
||||
(new (symbol type collide-shape uint uint) _type_)
|
||||
(change-mesh (_type_ int) none)
|
||||
)
|
||||
)
|
||||
(new (symbol type collide-shape uint uint) _type_)
|
||||
(change-mesh (_type_ int) none)))
|
||||
|
||||
;; A group of collide-shape-prim's
|
||||
(deftype collide-shape-prim-group (collide-shape-prim)
|
||||
((num-prims int32)
|
||||
(num-prims-u uint32 :overlay-at num-prims)
|
||||
(allocated-prims int32)
|
||||
(prim collide-shape-prim 1)
|
||||
(prims collide-shape-prim :dynamic :overlay-at (-> prim 0))
|
||||
)
|
||||
((num-prims int32)
|
||||
(num-prims-u uint32 :overlay-at num-prims)
|
||||
(allocated-prims int32)
|
||||
(prim collide-shape-prim 1)
|
||||
(prims collide-shape-prim :dynamic :overlay-at (-> prim 0)))
|
||||
(:methods
|
||||
(new (symbol type collide-shape uint int) _type_)
|
||||
(append-prim (_type_ collide-shape-prim) none)
|
||||
(add-to-non-empty-bounding-box (_type_ collide-kind) none)
|
||||
)
|
||||
)
|
||||
(new (symbol type collide-shape uint int) _type_)
|
||||
(append-prim (_type_ collide-shape-prim) none)
|
||||
(add-to-non-empty-bounding-box (_type_ collide-kind) none)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collide Shape
|
||||
@@ -452,6 +408,7 @@
|
||||
;; - riders
|
||||
|
||||
(declare-type collide-work structure)
|
||||
|
||||
(declare-type touching-shapes-entry structure)
|
||||
|
||||
(defenum nav-flags
|
||||
@@ -464,55 +421,51 @@
|
||||
(navf4 4)
|
||||
(navf5 5)
|
||||
(navf6 6)
|
||||
(navf7 7)
|
||||
)
|
||||
(navf7 7))
|
||||
|
||||
;; we're a child of trsqv, so we store a full transform + derivative.
|
||||
(deftype collide-shape (trsqv)
|
||||
((process process-drawable)
|
||||
(max-iteration-count uint8)
|
||||
(nav-flags nav-flags)
|
||||
(pad-byte uint8 2)
|
||||
(pat-ignore-mask pat-surface)
|
||||
(event-self symbol)
|
||||
(event-other symbol)
|
||||
(root-prim collide-shape-prim)
|
||||
(riders collide-sticky-rider-group)
|
||||
(backup-collide-as collide-kind)
|
||||
(backup-collide-with collide-kind)
|
||||
)
|
||||
((process process-drawable)
|
||||
(max-iteration-count uint8)
|
||||
(nav-flags nav-flags)
|
||||
(pad-byte uint8 2)
|
||||
(pat-ignore-mask pat-surface)
|
||||
(event-self symbol)
|
||||
(event-other symbol)
|
||||
(root-prim collide-shape-prim)
|
||||
(riders collide-sticky-rider-group)
|
||||
(backup-collide-as collide-kind)
|
||||
(backup-collide-with collide-kind))
|
||||
(:methods
|
||||
(new (symbol type process-drawable collide-list-enum) _type_)
|
||||
(move-by-vector! (_type_ vector) none)
|
||||
(alloc-riders (_type_ int) none)
|
||||
(move-to-point! (_type_ vector) none)
|
||||
(debug-draw (_type_) none)
|
||||
(fill-cache-for-shape! (_type_ float collide-kind) none)
|
||||
(fill-cache-integrate-and-collide! (_type_ vector collide-kind) none)
|
||||
(find-prim-by-id (_type_ uint) collide-shape-prim)
|
||||
(detect-riders! (_type_) symbol)
|
||||
(build-bounding-box-for-shape (_type_ bounding-box float collide-kind) symbol)
|
||||
(integrate-and-collide! (_type_ vector) none)
|
||||
(find-collision-meshes (_type_) symbol)
|
||||
(on-platform (_type_ collide-shape collide-overlap-result) symbol)
|
||||
(find-overlapping-shapes (_type_ overlaps-others-params) symbol)
|
||||
(calc-shove-up (_type_ attack-info float) vector)
|
||||
(should-push-away (_type_ collide-shape collide-overlap-result) symbol)
|
||||
(pull-rider! (_type_ pull-rider-info) none)
|
||||
(pull-riders! (_type_) symbol)
|
||||
(do-push-aways! (_type_) symbol)
|
||||
(set-root-prim! (_type_ collide-shape-prim) collide-shape-prim)
|
||||
(update-transforms! (_type_) symbol)
|
||||
(clear-collide-with-as (_type_) none)
|
||||
(restore-collide-with-as (_type_) none)
|
||||
(backup-collide-with-as (_type_) none)
|
||||
(set-root-prim-collide-with! (_type_ collide-kind) none)
|
||||
(set-root-prim-collide-as! (_type_ collide-kind) none)
|
||||
(set-collide-kinds (_type_ int collide-kind collide-kind) none)
|
||||
(set-collide-offense (_type_ int collide-offense) none)
|
||||
(send-shove-back (_type_ process touching-shapes-entry float float float) none)
|
||||
)
|
||||
)
|
||||
(new (symbol type process-drawable collide-list-enum) _type_)
|
||||
(move-by-vector! (_type_ vector) none)
|
||||
(alloc-riders (_type_ int) none)
|
||||
(move-to-point! (_type_ vector) none)
|
||||
(debug-draw (_type_) none)
|
||||
(fill-cache-for-shape! (_type_ float collide-kind) none)
|
||||
(fill-cache-integrate-and-collide! (_type_ vector collide-kind) none)
|
||||
(find-prim-by-id (_type_ uint) collide-shape-prim)
|
||||
(detect-riders! (_type_) symbol)
|
||||
(build-bounding-box-for-shape (_type_ bounding-box float collide-kind) symbol)
|
||||
(integrate-and-collide! (_type_ vector) none)
|
||||
(find-collision-meshes (_type_) symbol)
|
||||
(on-platform (_type_ collide-shape collide-overlap-result) symbol)
|
||||
(find-overlapping-shapes (_type_ overlaps-others-params) symbol)
|
||||
(calc-shove-up (_type_ attack-info float) vector)
|
||||
(should-push-away (_type_ collide-shape collide-overlap-result) symbol)
|
||||
(pull-rider! (_type_ pull-rider-info) none)
|
||||
(pull-riders! (_type_) symbol)
|
||||
(do-push-aways! (_type_) symbol)
|
||||
(set-root-prim! (_type_ collide-shape-prim) collide-shape-prim)
|
||||
(update-transforms! (_type_) symbol)
|
||||
(clear-collide-with-as (_type_) none)
|
||||
(restore-collide-with-as (_type_) none)
|
||||
(backup-collide-with-as (_type_) none)
|
||||
(set-root-prim-collide-with! (_type_ collide-kind) none)
|
||||
(set-root-prim-collide-as! (_type_ collide-kind) none)
|
||||
(set-collide-kinds (_type_ int collide-kind collide-kind) none)
|
||||
(set-collide-offense (_type_ int collide-offense) none)
|
||||
(send-shove-back (_type_ process touching-shapes-entry float float float) none)))
|
||||
|
||||
(defenum cshape-moving-flags
|
||||
:bitfield #t
|
||||
@@ -546,8 +499,7 @@
|
||||
(csmf26)
|
||||
(csmf27)
|
||||
(csmf28)
|
||||
(csmf29)
|
||||
)
|
||||
(csmf29))
|
||||
|
||||
(defenum cshape-reaction-flags
|
||||
:bitfield #t
|
||||
@@ -583,49 +535,45 @@
|
||||
(csrf28)
|
||||
(csrf29)
|
||||
(csrf30)
|
||||
(csrf31)
|
||||
)
|
||||
(csrf31))
|
||||
|
||||
;; A collide-shape for independently moving objects
|
||||
(deftype collide-shape-moving (collide-shape)
|
||||
((rider-time time-frame)
|
||||
(rider-last-move vector :inline)
|
||||
(trans-old vector 3 :inline)
|
||||
(poly-pat pat-surface)
|
||||
(cur-pat pat-surface)
|
||||
(ground-pat pat-surface)
|
||||
(status cshape-moving-flags)
|
||||
(old-status cshape-moving-flags)
|
||||
(prev-status cshape-moving-flags)
|
||||
(reaction-flag cshape-reaction-flags)
|
||||
(reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags))
|
||||
(no-reaction (function collide-shape-moving collide-shape-intersect vector vector none))
|
||||
(local-normal vector :inline)
|
||||
(surface-normal vector :inline)
|
||||
(poly-normal vector :inline)
|
||||
(ground-poly-normal vector :inline)
|
||||
(ground-touch-point vector :inline)
|
||||
(shadow-pos vector :inline)
|
||||
(ground-impact-vel meters)
|
||||
(surface-angle float)
|
||||
(poly-angle float)
|
||||
(touch-angle float)
|
||||
(coverage float)
|
||||
(dynam dynamics)
|
||||
(surf surface)
|
||||
)
|
||||
((rider-time time-frame)
|
||||
(rider-last-move vector :inline)
|
||||
(trans-old vector 3 :inline)
|
||||
(poly-pat pat-surface)
|
||||
(cur-pat pat-surface)
|
||||
(ground-pat pat-surface)
|
||||
(status cshape-moving-flags)
|
||||
(old-status cshape-moving-flags)
|
||||
(prev-status cshape-moving-flags)
|
||||
(reaction-flag cshape-reaction-flags)
|
||||
(reaction (function collide-shape-moving collide-shape-intersect vector vector cshape-moving-flags))
|
||||
(no-reaction (function collide-shape-moving collide-shape-intersect vector vector none))
|
||||
(local-normal vector :inline)
|
||||
(surface-normal vector :inline)
|
||||
(poly-normal vector :inline)
|
||||
(ground-poly-normal vector :inline)
|
||||
(ground-touch-point vector :inline)
|
||||
(shadow-pos vector :inline)
|
||||
(ground-impact-vel meters)
|
||||
(surface-angle float)
|
||||
(poly-angle float)
|
||||
(touch-angle float)
|
||||
(coverage float)
|
||||
(dynam dynamics)
|
||||
(surf surface))
|
||||
(:methods
|
||||
(set-and-handle-pat! (_type_ pat-surface) none)
|
||||
(integrate-no-collide! (_type_ vector) none)
|
||||
(collide-shape-moving-method-58 (_type_ vector) symbol)
|
||||
(integrate-for-enemy-with-move-to-ground! (_type_ vector collide-kind float symbol symbol symbol) none)
|
||||
(move-to-ground (_type_ float float symbol collide-kind) symbol)
|
||||
(move-to-ground-point! (_type_ vector vector vector) none)
|
||||
(compute-acc-due-to-gravity (_type_ vector float) vector)
|
||||
(step-collison! (_type_ vector vector float) float)
|
||||
(move-to-tri! (_type_ collide-tri-result vector) none)
|
||||
)
|
||||
)
|
||||
(set-and-handle-pat! (_type_ pat-surface) none)
|
||||
(integrate-no-collide! (_type_ vector) none)
|
||||
(collide-shape-moving-method-58 (_type_ vector) symbol)
|
||||
(integrate-for-enemy-with-move-to-ground! (_type_ vector collide-kind float symbol symbol symbol) none)
|
||||
(move-to-ground (_type_ float float symbol collide-kind) symbol)
|
||||
(move-to-ground-point! (_type_ vector vector vector) none)
|
||||
(compute-acc-due-to-gravity (_type_ vector float) vector)
|
||||
(step-collison! (_type_ vector vector float) float)
|
||||
(move-to-tri! (_type_ collide-tri-result vector) none)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; Basic Methods
|
||||
@@ -641,61 +589,54 @@
|
||||
(set! (-> v0-0 transform-index) -2)
|
||||
(set! (-> v0-0 prim-core offense) (collide-offense no-offense))
|
||||
(set! (-> v0-0 prim-core prim-type) -2)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
v0-0))
|
||||
|
||||
(defmethod new collide-shape-prim-sphere ((allocation symbol) (type-to-make type) (cshape collide-shape) (prim-id uint))
|
||||
"Allocate a new sphere primitive"
|
||||
|
||||
(let ((this (the collide-shape-prim-sphere ((method-of-type collide-shape-prim new) allocation type-to-make cshape prim-id (size-of collide-shape-prim-sphere)))))
|
||||
(set! (-> this pat) (new 'static 'pat-surface :mode (pat-mode obstacle)))
|
||||
(set! (-> this prim-core prim-type) -1)
|
||||
this
|
||||
)
|
||||
)
|
||||
(let ((this (the collide-shape-prim-sphere
|
||||
((method-of-type collide-shape-prim new) allocation type-to-make cshape prim-id (size-of collide-shape-prim-sphere)))))
|
||||
(set! (-> this pat) (new 'static 'pat-surface :mode (pat-mode obstacle)))
|
||||
(set! (-> this prim-core prim-type) -1)
|
||||
this))
|
||||
|
||||
(defmethod new collide-shape-prim-mesh ((allocation symbol) (type-to-make type) (cshape collide-shape) (mesh-id uint) (prim-id uint))
|
||||
"Allocate a new mesh primitive"
|
||||
|
||||
(let ((this (the collide-shape-prim-mesh ((method-of-type collide-shape-prim new) allocation type-to-make cshape prim-id (size-of collide-shape-prim-mesh)))))
|
||||
(let ((this (the collide-shape-prim-mesh
|
||||
((method-of-type collide-shape-prim new) allocation type-to-make cshape prim-id (size-of collide-shape-prim-mesh)))))
|
||||
(set! (-> this mesh) #f)
|
||||
(set! (-> this mesh-id) (the-as int mesh-id))
|
||||
(set! (-> this mesh-cache-id) (the-as uint 0))
|
||||
(set! (-> this prim-core prim-type) 1)
|
||||
(the-as collide-shape-prim-mesh this)
|
||||
)
|
||||
)
|
||||
(the-as collide-shape-prim-mesh this)))
|
||||
|
||||
(defmethod new collide-shape-prim-group ((allocation symbol) (type-to-make type) (cshape collide-shape) (elt-count uint) (prim-id int))
|
||||
"Allocate a group of primitives."
|
||||
|
||||
(let ((this (the collide-shape-prim-group ((method-of-type collide-shape-prim new) allocation type-to-make cshape (the uint prim-id) (the int (+ (-> type-to-make size) (* (+ elt-count -1) 4)))))))
|
||||
(let ((this (the collide-shape-prim-group
|
||||
((method-of-type collide-shape-prim new)
|
||||
allocation
|
||||
type-to-make
|
||||
cshape
|
||||
(the uint prim-id)
|
||||
(the int (+ (-> type-to-make size) (* (+ elt-count -1) 4)))))))
|
||||
(set! (-> this allocated-prims) (the int elt-count))
|
||||
(set! (-> this num-prims) 0)
|
||||
(set! (-> this prim-core prim-type) 0)
|
||||
(while (nonzero? elt-count)
|
||||
(+! elt-count -1)
|
||||
(set! (-> this prim elt-count) (the collide-shape-prim #f))
|
||||
(nop!)
|
||||
)
|
||||
this
|
||||
)
|
||||
)
|
||||
(nop!))
|
||||
this))
|
||||
|
||||
(defmethod length ((this collide-shape-prim-group))
|
||||
"How many primitives are used?"
|
||||
(-> this num-prims)
|
||||
)
|
||||
(-> this num-prims))
|
||||
|
||||
(defmethod asize-of ((this collide-shape-prim-group))
|
||||
"How big is this in memory?"
|
||||
(the-as int (+ (-> this type size) (* (+ (-> this allocated-prims) -1) 4)))
|
||||
)
|
||||
(the-as int (+ (-> this type size) (* (+ (-> this allocated-prims) -1) 4))))
|
||||
|
||||
(defmethod new collide-shape ((allocation symbol) (type-to-make type) (proc process-drawable) (collide-list-kind collide-list-enum))
|
||||
"Allocate a new collide-shape and add to a collide-list"
|
||||
|
||||
(let ((this (object-new allocation type-to-make (the int (-> type-to-make size)))))
|
||||
(set! (-> this process) proc)
|
||||
(set! (-> this max-iteration-count) 1)
|
||||
@@ -704,84 +645,67 @@
|
||||
(set! (-> this event-other) #f)
|
||||
(set! (-> this riders) #f)
|
||||
(set! (-> this root-prim) #f)
|
||||
|
||||
(case (-> proc type symbol)
|
||||
(('camera)
|
||||
(set! (-> this pat-ignore-mask) (new 'static 'pat-surface :nocamera #x1))
|
||||
)
|
||||
(else
|
||||
(set! (-> this pat-ignore-mask) (new 'static 'pat-surface :noentity #x1))
|
||||
)
|
||||
)
|
||||
(('camera) (set! (-> this pat-ignore-mask) (new 'static 'pat-surface :nocamera #x1)))
|
||||
(else (set! (-> this pat-ignore-mask) (new 'static 'pat-surface :noentity #x1))))
|
||||
;; reset transformation to the origin.
|
||||
(set! (-> this trans w) 1.0)
|
||||
(quaternion-identity! (-> this quat))
|
||||
(vector-identity! (-> this scale))
|
||||
|
||||
;; add us to right list.
|
||||
(case collide-list-kind
|
||||
(((collide-list-enum hit-by-player))
|
||||
(add-connection *collide-hit-by-player-list* proc #f this #f #f))
|
||||
|
||||
(((collide-list-enum usually-hit-by-player))
|
||||
(add-connection *collide-usually-hit-by-player-list* proc #f this #f #f))
|
||||
|
||||
(((collide-list-enum hit-by-others))
|
||||
(add-connection *collide-hit-by-others-list* proc #f this #f #f))
|
||||
|
||||
(((collide-list-enum player))
|
||||
(add-connection *collide-player-list* proc #f this #f #f))
|
||||
|
||||
(else
|
||||
(format 0 "Unsupported collide-list-enum in collide-shape constructor!~%")
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
)
|
||||
(((collide-list-enum hit-by-player)) (add-connection *collide-hit-by-player-list* proc #f this #f #f))
|
||||
(((collide-list-enum usually-hit-by-player)) (add-connection *collide-usually-hit-by-player-list* proc #f this #f #f))
|
||||
(((collide-list-enum hit-by-others)) (add-connection *collide-hit-by-others-list* proc #f this #f #f))
|
||||
(((collide-list-enum player)) (add-connection *collide-player-list* proc #f this #f #f))
|
||||
(else (format 0 "Unsupported collide-list-enum in collide-shape constructor!~%")))
|
||||
this))
|
||||
|
||||
(defmethod new collide-sticky-rider-group ((allocation symbol) (type-to-make type) (riders-amount int))
|
||||
"Allocate a new collide-sticky-rider-group with space for riders-amount sticky riders."
|
||||
|
||||
(let ((this (object-new allocation type-to-make (the int (+ (-> type-to-make size) (the uint (* (1- riders-amount) (size-of collide-sticky-rider))))))))
|
||||
(set! (-> this allocated-riders) riders-amount)
|
||||
(set! (-> this num-riders) 0)
|
||||
this
|
||||
)
|
||||
)
|
||||
(let ((this (object-new allocation
|
||||
type-to-make
|
||||
(the int (+ (-> type-to-make size) (the uint (* (1- riders-amount) (size-of collide-sticky-rider))))))))
|
||||
(set! (-> this allocated-riders) riders-amount)
|
||||
(set! (-> this num-riders) 0)
|
||||
this))
|
||||
|
||||
(defmethod length ((this collide-sticky-rider-group))
|
||||
(-> this num-riders)
|
||||
)
|
||||
(-> this num-riders))
|
||||
|
||||
(defmethod asize-of ((this collide-sticky-rider-group))
|
||||
(the-as int (+ (-> this type size) (* (+ (-> this allocated-riders) -1) 32)))
|
||||
)
|
||||
(the-as int (+ (-> this type size) (* (+ (-> this allocated-riders) -1) 32))))
|
||||
|
||||
(define *collide-shape-prim-backgnd* (new 'static 'collide-shape-prim-mesh
|
||||
:cshape #f
|
||||
:prim-core (new 'static 'collide-prim-core
|
||||
:world-sphere (new 'static 'vector :w 204800000.0)
|
||||
:collide-as (collide-kind background)
|
||||
:action (collide-action solid)
|
||||
:offense (collide-offense indestructible)
|
||||
:prim-type 2
|
||||
)
|
||||
:local-sphere (new 'static 'vector :w 204800000.0)
|
||||
:mesh #f
|
||||
)
|
||||
)
|
||||
(define *collide-shape-prim-backgnd*
|
||||
(new 'static
|
||||
'collide-shape-prim-mesh
|
||||
:cshape #f
|
||||
:prim-core
|
||||
(new 'static
|
||||
'collide-prim-core
|
||||
:world-sphere
|
||||
(new 'static 'vector :w 204800000.0)
|
||||
:collide-as (collide-kind background)
|
||||
:action (collide-action solid)
|
||||
:offense (collide-offense indestructible)
|
||||
:prim-type 2)
|
||||
:local-sphere
|
||||
(new 'static 'vector :w 204800000.0)
|
||||
:mesh #f))
|
||||
|
||||
(define *collide-shape-prim-water* (new 'static 'collide-shape-prim-mesh
|
||||
:cshape #f
|
||||
:prim-core (new 'static 'collide-prim-core
|
||||
:world-sphere (new 'static 'vector :w 204800000.0)
|
||||
:collide-as (collide-kind water)
|
||||
:action (collide-action solid)
|
||||
:offense (collide-offense indestructible)
|
||||
:prim-type 2
|
||||
)
|
||||
:local-sphere (new 'static 'vector :w 204800000.0)
|
||||
:mesh #f
|
||||
)
|
||||
)
|
||||
(define *collide-shape-prim-water*
|
||||
(new 'static
|
||||
'collide-shape-prim-mesh
|
||||
:cshape #f
|
||||
:prim-core
|
||||
(new 'static
|
||||
'collide-prim-core
|
||||
:world-sphere
|
||||
(new 'static 'vector :w 204800000.0)
|
||||
:collide-as (collide-kind water)
|
||||
:action (collide-action solid)
|
||||
:offense (collide-offense indestructible)
|
||||
:prim-type 2)
|
||||
:local-sphere
|
||||
(new 'static 'vector :w 204800000.0)
|
||||
:mesh #f))
|
||||
@@ -1,51 +1,28 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/collide-shape.gc")
|
||||
|
||||
;; name: collide-shape-rider.gc
|
||||
;; name in dgo: collide-shape-rider
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod on-platform ((this collide-shape) (arg0 collide-shape) (arg1 collide-overlap-result))
|
||||
"Are we on the platform? Returns #t/#f and also sets an overlap result."
|
||||
(let ((v1-0 arg1))
|
||||
(set! (-> v1-0 best-dist) 0.0)
|
||||
(set! (-> v1-0 best-from-prim) #f)
|
||||
(set! (-> v1-0 best-to-prim) #f)
|
||||
)
|
||||
(let ((v1-0 arg1)) (set! (-> v1-0 best-dist) 0.0) (set! (-> v1-0 best-from-prim) #f) (set! (-> v1-0 best-to-prim) #f))
|
||||
(set! (-> arg1 best-dist) 122.88)
|
||||
(let ((s5-0 (-> this root-prim))
|
||||
(s4-0 (-> arg0 root-prim))
|
||||
)
|
||||
(s4-0 (-> arg0 root-prim)))
|
||||
(when (and (logtest? (-> s5-0 collide-with) (-> s4-0 prim-core collide-as))
|
||||
(logtest? (-> s5-0 prim-core action) (collide-action rider-plat-sticky))
|
||||
(logtest? (-> s4-0 prim-core action) (collide-action rider-target))
|
||||
)
|
||||
(logtest? (-> s4-0 prim-core action) (collide-action rider-target)))
|
||||
(let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core)))
|
||||
(-> s5-0 prim-core world-sphere w)
|
||||
)
|
||||
(-> s4-0 prim-core world-sphere w)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (< f0-4 122.88)
|
||||
(on-platform-test s5-0 s4-0 arg1 f0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(< (-> arg1 best-dist) 122.88)
|
||||
)
|
||||
|
||||
(-> s5-0 prim-core world-sphere w))
|
||||
(-> s4-0 prim-core world-sphere w))))
|
||||
(if (< f0-4 122.88) (on-platform-test s5-0 s4-0 arg1 f0-4)))))
|
||||
(< (-> arg1 best-dist) 122.88))
|
||||
|
||||
(defmethod on-platform-test ((this collide-shape-prim) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float))
|
||||
(format 0 "ERROR: collide-shape-prim::on-platform-test was called illegally!~%")
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod on-platform-test ((this collide-shape-prim-group) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float))
|
||||
"Check if we're on the platform for a prim group."
|
||||
@@ -53,108 +30,60 @@
|
||||
(dotimes (s2-0 (-> this num-prims))
|
||||
(let ((s1-0 (-> this prims s2-0)))
|
||||
;; check collide kind
|
||||
(when (and (logtest? (-> s1-0 collide-with) s3-0)
|
||||
(logtest? (-> s1-0 prim-core action) (collide-action rider-plat-sticky))
|
||||
)
|
||||
(when (and (logtest? (-> s1-0 collide-with) s3-0) (logtest? (-> s1-0 prim-core action) (collide-action rider-plat-sticky)))
|
||||
;; check dist
|
||||
(let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s1-0 prim-core)) (the-as vector (-> arg0 prim-core)))
|
||||
(-> s1-0 prim-core world-sphere w)
|
||||
)
|
||||
(-> arg0 prim-core world-sphere w)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> s1-0 prim-core world-sphere w))
|
||||
(-> arg0 prim-core world-sphere w))))
|
||||
;; dist close enough, check!
|
||||
(if (< f0-2 122.88)
|
||||
(on-platform-test s1-0 arg0 arg1 f0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(if (< f0-2 122.88) (on-platform-test s1-0 arg0 arg1 f0-2)))))))
|
||||
(none))
|
||||
|
||||
(defmethod on-platform-test ((this collide-shape-prim-mesh) (arg0 collide-shape-prim) (arg1 collide-overlap-result) (arg2 float))
|
||||
"check if we're on the platform for a mesh."
|
||||
(case (-> arg0 type)
|
||||
;; mesh to group
|
||||
((collide-shape-prim-group)
|
||||
(let ((s3-0 (-> this collide-with)))
|
||||
(dotimes (s2-0 (-> (the-as collide-shape-prim-group arg0) num-prims))
|
||||
(let ((s1-0 (-> (the-as collide-shape-prim-group arg0) prims s2-0)))
|
||||
(when (and (logtest? s3-0 (-> s1-0 prim-core collide-as))
|
||||
(logtest? (-> s1-0 prim-core action) (collide-action rider-target))
|
||||
)
|
||||
(let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s1-0 prim-core)))
|
||||
(-> this prim-core world-sphere w)
|
||||
)
|
||||
(-> s1-0 prim-core world-sphere w)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (< f0-2 122.88)
|
||||
(on-platform-test this s1-0 arg1 f0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; mesh to sphere. use the collide-mesh-cache.
|
||||
((collide-shape-prim-sphere)
|
||||
(let ((s3-1 (-> this mesh)))
|
||||
(when s3-1
|
||||
(let ((s2-1 *collide-mesh-cache*))
|
||||
(when (!= (-> this mesh-cache-id) (-> s2-1 id))
|
||||
(let ((v1-17 (allocate! s2-1 (* 96 (-> s3-1 num-tris)))))
|
||||
(cond
|
||||
(v1-17
|
||||
(set! (-> this mesh-cache-tris) (the-as (inline-array collide-mesh-cache-tri) v1-17))
|
||||
(set! (-> this mesh-cache-id) (-> s2-1 id))
|
||||
(populate-cache!
|
||||
s3-1
|
||||
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
|
||||
(-> this cshape process node-list data (-> this transform-index) bone transform)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(return #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((s2-2 (new 'stack-no-clear 'collide-tri-result))
|
||||
(f0-4 (sphere-on-platform-test
|
||||
s3-1
|
||||
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
|
||||
s2-2
|
||||
(the-as vector (-> arg0 prim-core))
|
||||
(-> arg1 best-dist)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (< f0-4 (-> arg1 best-dist))
|
||||
(set! (-> arg1 best-dist) f0-4)
|
||||
(set! (-> arg1 best-from-prim) this)
|
||||
(set! (-> arg1 best-to-prim) arg0)
|
||||
(set! (-> arg1 best-from-tri vertex 0 quad) (-> s2-2 vertex 0 quad))
|
||||
(set! (-> arg1 best-from-tri vertex 1 quad) (-> s2-2 vertex 1 quad))
|
||||
(set! (-> arg1 best-from-tri vertex 2 quad) (-> s2-2 vertex 2 quad))
|
||||
(set! (-> arg1 best-from-tri intersect quad) (-> s2-2 intersect quad))
|
||||
(set! (-> arg1 best-from-tri normal quad) (-> s2-2 normal quad))
|
||||
(set! (-> arg1 best-from-tri pat) (-> s2-2 pat))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
;; mesh to group
|
||||
((collide-shape-prim-group)
|
||||
(let ((s3-0 (-> this collide-with)))
|
||||
(dotimes (s2-0 (-> (the-as collide-shape-prim-group arg0) num-prims))
|
||||
(let ((s1-0 (-> (the-as collide-shape-prim-group arg0) prims s2-0)))
|
||||
(when (and (logtest? s3-0 (-> s1-0 prim-core collide-as)) (logtest? (-> s1-0 prim-core action) (collide-action rider-target)))
|
||||
(let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s1-0 prim-core)))
|
||||
(-> this prim-core world-sphere w))
|
||||
(-> s1-0 prim-core world-sphere w))))
|
||||
(if (< f0-2 122.88) (on-platform-test this s1-0 arg1 f0-2))))))))
|
||||
;; mesh to sphere. use the collide-mesh-cache.
|
||||
((collide-shape-prim-sphere)
|
||||
(let ((s3-1 (-> this mesh)))
|
||||
(when s3-1
|
||||
(let ((s2-1 *collide-mesh-cache*))
|
||||
(when (!= (-> this mesh-cache-id) (-> s2-1 id))
|
||||
(let ((v1-17 (allocate! s2-1 (* 96 (-> s3-1 num-tris)))))
|
||||
(cond
|
||||
(v1-17
|
||||
(set! (-> this mesh-cache-tris) (the-as (inline-array collide-mesh-cache-tri) v1-17))
|
||||
(set! (-> this mesh-cache-id) (-> s2-1 id))
|
||||
(populate-cache! s3-1
|
||||
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
|
||||
(-> this cshape process node-list data (-> this transform-index) bone transform)))
|
||||
(else (return #f))))))
|
||||
(let* ((s2-2 (new 'stack-no-clear 'collide-tri-result))
|
||||
(f0-4 (sphere-on-platform-test s3-1
|
||||
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
|
||||
s2-2
|
||||
(the-as vector (-> arg0 prim-core))
|
||||
(-> arg1 best-dist))))
|
||||
(when (< f0-4 (-> arg1 best-dist))
|
||||
(set! (-> arg1 best-dist) f0-4)
|
||||
(set! (-> arg1 best-from-prim) this)
|
||||
(set! (-> arg1 best-to-prim) arg0)
|
||||
(set! (-> arg1 best-from-tri vertex 0 quad) (-> s2-2 vertex 0 quad))
|
||||
(set! (-> arg1 best-from-tri vertex 1 quad) (-> s2-2 vertex 1 quad))
|
||||
(set! (-> arg1 best-from-tri vertex 2 quad) (-> s2-2 vertex 2 quad))
|
||||
(set! (-> arg1 best-from-tri intersect quad) (-> s2-2 intersect quad))
|
||||
(set! (-> arg1 best-from-tri normal quad) (-> s2-2 normal quad))
|
||||
(set! (-> arg1 best-from-tri pat) (-> s2-2 pat))))))))
|
||||
(none))
|
||||
|
||||
(defmethod add-rider! ((this collide-sticky-rider-group) (arg0 process-drawable))
|
||||
"Add a rider to this platform."
|
||||
@@ -163,33 +92,21 @@
|
||||
((< (-> this num-riders) (-> this allocated-riders))
|
||||
(set! gp-0 (-> this rider (-> this num-riders)))
|
||||
(+! (-> this num-riders) 1)
|
||||
(let ((v1-6 gp-0))
|
||||
(set! (-> v1-6 rider-handle) (the-as handle arg0))
|
||||
(set! (-> v1-6 sticky-prim) #f)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format 0 "ERROR: Exeeded max number of riders!~%")
|
||||
)
|
||||
)
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
(let ((v1-6 gp-0)) (set! (-> v1-6 rider-handle) (the-as handle arg0)) (set! (-> v1-6 sticky-prim) #f)))
|
||||
(else (format 0 "ERROR: Exeeded max number of riders!~%")))
|
||||
gp-0))
|
||||
|
||||
(defmethod detect-riders! ((this collide-shape))
|
||||
"See who is riding us."
|
||||
(let ((s5-0 (-> this riders)))
|
||||
(when s5-0
|
||||
(let* ((v1-0 *collide-mesh-cache*)
|
||||
(a0-1 (-> v1-0 id))
|
||||
)
|
||||
(a0-1 (-> v1-0 id)))
|
||||
(set! (-> v1-0 used-size) (the-as uint 0))
|
||||
(let ((a0-2 (the-as int (+ a0-1 1))))
|
||||
(b! (zero? (the-as uint a0-2)) cfg-3 :likely-delay (set! a0-2 1))
|
||||
(label cfg-3)
|
||||
(set! (-> v1-0 id) (the-as uint a0-2))
|
||||
)
|
||||
)
|
||||
(set! (-> v1-0 id) (the-as uint a0-2))))
|
||||
(set! (-> s5-0 num-riders) 0)
|
||||
0
|
||||
(let ((s4-0 (-> this root-prim collide-with)))
|
||||
@@ -199,46 +116,26 @@
|
||||
(let ((s3-0 (-> v1-7 next0)))
|
||||
(while (!= v1-7 (-> *collide-player-list* alive-list-end))
|
||||
(let* ((s2-0 (-> (the-as connection v1-7) param1))
|
||||
(v1-8 (-> (the-as collide-shape s2-0) root-prim))
|
||||
)
|
||||
(v1-8 (-> (the-as collide-shape s2-0) root-prim)))
|
||||
(when (logtest? s4-0 (-> v1-8 prim-core collide-as))
|
||||
(when (and (logtest? (-> v1-8 prim-core action) (collide-action rider-target))
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-0) process))
|
||||
)
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-0) process)))
|
||||
(let ((s1-0 (new 'stack-no-clear 'collide-overlap-result)))
|
||||
(when (on-platform this (the-as collide-shape s2-0) s1-0)
|
||||
(let ((s4-1 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-0) process)))))
|
||||
)
|
||||
(let ((s4-1 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-0) process))))))
|
||||
(when s4-1
|
||||
(let ((a0-11 (-> s1-0 best-from-prim)))
|
||||
(set! (-> s4-1 sticky-prim) a0-11)
|
||||
(let ((s1-1
|
||||
(-> (the-as process-drawable (-> this process)) node-list data (-> a0-11 transform-index) bone transform)
|
||||
)
|
||||
)
|
||||
(let ((s1-1 (-> (the-as process-drawable (-> this process)) node-list data (-> a0-11 transform-index) bone transform)))
|
||||
(set! (-> s4-1 prim-ry) (matrix-y-angle s1-1))
|
||||
(let ((s0-0 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-4x4-inverse! s0-0 s1-1)
|
||||
(vector-matrix*! (-> s4-1 rider-local-pos) (-> (the-as collide-shape s2-0) trans) s0-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event (-> this process) 'ridden s4-1)
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> this root-prim collide-with))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-matrix*! (-> s4-1 rider-local-pos) (-> (the-as collide-shape s2-0) trans) s0-0))))
|
||||
(send-event (-> this process) 'ridden s4-1)))
|
||||
(set! s4-0 (-> this root-prim collide-with)))))))
|
||||
(set! v1-7 s3-0)
|
||||
*collide-player-list*
|
||||
(set! s3-0 (-> s3-0 next0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! s3-0 (-> s3-0 next0))))))
|
||||
(when (logtest? s4-0 (collide-kind cak-1 cak-2 cak-3))
|
||||
(when (logtest? s4-0 (collide-kind cak-1))
|
||||
(let ((v1-37 (-> *collide-hit-by-player-list* alive-list next0)))
|
||||
@@ -246,16 +143,13 @@
|
||||
(let ((s3-1 (-> v1-37 next0)))
|
||||
(while (!= v1-37 (-> *collide-hit-by-player-list* alive-list-end))
|
||||
(let* ((s2-1 (-> (the-as connection v1-37) param1))
|
||||
(v1-38 (-> (the-as collide-shape s2-1) root-prim))
|
||||
)
|
||||
(v1-38 (-> (the-as collide-shape s2-1) root-prim)))
|
||||
(when (logtest? s4-0 (-> v1-38 prim-core collide-as))
|
||||
(when (and (logtest? (-> v1-38 prim-core action) (collide-action rider-target))
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-1) process))
|
||||
)
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-1) process)))
|
||||
(let ((s1-2 (new 'stack-no-clear 'collide-overlap-result)))
|
||||
(when (on-platform this (the-as collide-shape s2-1) s1-2)
|
||||
(let ((s4-2 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-1) process)))))
|
||||
)
|
||||
(let ((s4-2 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-1) process))))))
|
||||
(when s4-2
|
||||
(let ((a0-30 (-> s1-2 best-from-prim)))
|
||||
(set! (-> s4-2 sticky-prim) a0-30)
|
||||
@@ -263,42 +157,25 @@
|
||||
(set! (-> s4-2 prim-ry) (matrix-y-angle s1-3))
|
||||
(let ((s0-1 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-4x4-inverse! s0-1 s1-3)
|
||||
(vector-matrix*! (-> s4-2 rider-local-pos) (-> (the-as collide-shape s2-1) trans) s0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event (-> this process) 'ridden s4-2)
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> this root-prim collide-with))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-matrix*! (-> s4-2 rider-local-pos) (-> (the-as collide-shape s2-1) trans) s0-1))))
|
||||
(send-event (-> this process) 'ridden s4-2)))
|
||||
(set! s4-0 (-> this root-prim collide-with)))))))
|
||||
(set! v1-37 s3-1)
|
||||
*collide-hit-by-player-list*
|
||||
(set! s3-1 (-> s3-1 next0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! s3-1 (-> s3-1 next0))))))
|
||||
(when (logtest? s4-0 (collide-kind cak-2))
|
||||
(let ((v1-66 (-> *collide-usually-hit-by-player-list* alive-list next0)))
|
||||
*collide-usually-hit-by-player-list*
|
||||
(let ((s3-2 (-> v1-66 next0)))
|
||||
(while (!= v1-66 (-> *collide-usually-hit-by-player-list* alive-list-end))
|
||||
(let* ((s2-2 (-> (the-as connection v1-66) param1))
|
||||
(v1-67 (-> (the-as collide-shape s2-2) root-prim))
|
||||
)
|
||||
(v1-67 (-> (the-as collide-shape s2-2) root-prim)))
|
||||
(when (logtest? s4-0 (-> v1-67 prim-core collide-as))
|
||||
(when (and (logtest? (-> v1-67 prim-core action) (collide-action rider-target))
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-2) process))
|
||||
)
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-2) process)))
|
||||
(let ((s1-4 (new 'stack-no-clear 'collide-overlap-result)))
|
||||
(when (on-platform this (the-as collide-shape s2-2) s1-4)
|
||||
(let ((s4-3 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-2) process)))))
|
||||
)
|
||||
(let ((s4-3 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-2) process))))))
|
||||
(when s4-3
|
||||
(let ((a0-49 (-> s1-4 best-from-prim)))
|
||||
(set! (-> s4-3 sticky-prim) a0-49)
|
||||
@@ -306,42 +183,25 @@
|
||||
(set! (-> s4-3 prim-ry) (matrix-y-angle s1-5))
|
||||
(let ((s0-2 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-4x4-inverse! s0-2 s1-5)
|
||||
(vector-matrix*! (-> s4-3 rider-local-pos) (-> (the-as collide-shape s2-2) trans) s0-2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event (-> this process) 'ridden s4-3)
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> this root-prim collide-with))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-matrix*! (-> s4-3 rider-local-pos) (-> (the-as collide-shape s2-2) trans) s0-2))))
|
||||
(send-event (-> this process) 'ridden s4-3)))
|
||||
(set! s4-0 (-> this root-prim collide-with)))))))
|
||||
(set! v1-66 s3-2)
|
||||
*collide-usually-hit-by-player-list*
|
||||
(set! s3-2 (-> s3-2 next0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! s3-2 (-> s3-2 next0))))))
|
||||
(when (logtest? s4-0 (collide-kind cak-3))
|
||||
(let ((v1-94 (-> *collide-hit-by-others-list* alive-list next0)))
|
||||
*collide-hit-by-others-list*
|
||||
(let ((s3-3 (-> v1-94 next0)))
|
||||
(while (!= v1-94 (-> *collide-hit-by-others-list* alive-list-end))
|
||||
(let* ((s2-3 (-> (the-as connection v1-94) param1))
|
||||
(v1-95 (-> (the-as collide-shape s2-3) root-prim))
|
||||
)
|
||||
(v1-95 (-> (the-as collide-shape s2-3) root-prim)))
|
||||
(when (logtest? s4-0 (-> v1-95 prim-core collide-as))
|
||||
(when (and (logtest? (-> v1-95 prim-core action) (collide-action rider-target))
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-3) process))
|
||||
)
|
||||
(!= (-> this process) (-> (the-as collide-shape s2-3) process)))
|
||||
(let ((s1-6 (new 'stack-no-clear 'collide-overlap-result)))
|
||||
(when (on-platform this (the-as collide-shape s2-3) s1-6)
|
||||
(let ((s4-4 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-3) process)))))
|
||||
)
|
||||
(let ((s4-4 (add-rider! s5-0 (the-as process-drawable (process->handle (-> (the-as collide-shape s2-3) process))))))
|
||||
(when s4-4
|
||||
(let ((a0-68 (-> s1-6 best-from-prim)))
|
||||
(set! (-> s4-4 sticky-prim) a0-68)
|
||||
@@ -349,32 +209,13 @@
|
||||
(set! (-> s4-4 prim-ry) (matrix-y-angle s1-7))
|
||||
(let ((s0-3 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-4x4-inverse! s0-3 s1-7)
|
||||
(vector-matrix*! (-> s4-4 rider-local-pos) (-> (the-as collide-shape s2-3) trans) s0-3)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event (-> this process) 'ridden s4-4)
|
||||
)
|
||||
)
|
||||
(set! s4-0 (-> this root-prim collide-with))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-matrix*! (-> s4-4 rider-local-pos) (-> (the-as collide-shape s2-3) trans) s0-3))))
|
||||
(send-event (-> this process) 'ridden s4-4)))
|
||||
(set! s4-0 (-> this root-prim collide-with)))))))
|
||||
(set! v1-94 s3-3)
|
||||
*collide-hit-by-others-list*
|
||||
(set! s3-3 (-> s3-3 next0))
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! s3-3 (-> s3-3 next0)))))
|
||||
#f))))))
|
||||
|
||||
(defmethod pull-riders! ((this collide-shape))
|
||||
"Move our riders."
|
||||
@@ -383,46 +224,30 @@
|
||||
(let ((s4-0 (new 'stack-no-clear 'pull-rider-info)))
|
||||
(countdown (s3-0 (-> s5-0 num-riders))
|
||||
(let* ((v1-2 (-> s5-0 rider s3-0))
|
||||
(a0-1 (-> v1-2 rider-handle))
|
||||
)
|
||||
(a0-1 (-> v1-2 rider-handle)))
|
||||
(when (handle->process a0-1)
|
||||
(set! (-> s4-0 rider) v1-2)
|
||||
(set! (-> s4-0 rider-cshape)
|
||||
(the-as collide-shape-moving (-> (the-as process-drawable (-> a0-1 process 0)) root))
|
||||
)
|
||||
(set! (-> s4-0 rider-cshape) (the-as collide-shape-moving (-> (the-as process-drawable (-> a0-1 process 0)) root)))
|
||||
(let ((a0-5 (-> v1-2 sticky-prim)))
|
||||
(when a0-5
|
||||
(let ((s2-0 (-> this process node-list data (-> a0-5 transform-index) bone transform)))
|
||||
(let ((s1-0 (-> s4-0 rider-dest)))
|
||||
(vector-matrix*! s1-0 (-> v1-2 rider-local-pos) s2-0)
|
||||
(vector-float*! s1-0 s1-0 (/ 1.0 (-> s1-0 w)))
|
||||
)
|
||||
(set! (-> s4-0 rider-delta-ry) (deg- (matrix-y-angle s2-0) (-> s4-0 rider prim-ry)))
|
||||
)
|
||||
(pull-rider! this s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-float*! s1-0 s1-0 (/ 1.0 (-> s1-0 w))))
|
||||
(set! (-> s4-0 rider-delta-ry) (deg- (matrix-y-angle s2-0) (-> s4-0 rider prim-ry))))
|
||||
(pull-rider! this s4-0)))))))
|
||||
#f)))
|
||||
|
||||
(defmethod pull-rider! ((this collide-shape) (arg0 pull-rider-info))
|
||||
"Move a rider."
|
||||
(local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none)))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
(vf2 :class vf))
|
||||
(init-vf0-vector)
|
||||
(let ((gp-0 (-> arg0 rider-cshape)))
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector))
|
||||
(s4-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(s4-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> s4-0 quad) (-> gp-0 trans quad))
|
||||
(vector-! s3-0 (-> arg0 rider-dest) s4-0)
|
||||
(cond
|
||||
@@ -432,64 +257,33 @@
|
||||
(let ((s0-0 gp-0))
|
||||
(set! sv-160 (method-of-object s0-0 fill-cache-for-shape!))
|
||||
(let ((a1-3 (+ 8192.0 (vector-length s3-0)))
|
||||
(a2-0 (-> gp-0 root-prim collide-with))
|
||||
)
|
||||
(sv-160 s0-0 a1-3 a2-0)
|
||||
)
|
||||
)
|
||||
(set! (-> this root-prim prim-core collide-as) s1-0)
|
||||
)
|
||||
(a2-0 (-> gp-0 root-prim collide-with)))
|
||||
(sv-160 s0-0 a1-3 a2-0)))
|
||||
(set! (-> this root-prim prim-core collide-as) s1-0))
|
||||
(let ((s2-1 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> s2-1 quad) (-> s3-0 quad))
|
||||
(let ((v1-12 s2-1))
|
||||
(.lvf vf1 (&-> s2-1 quad))
|
||||
(let ((f0-2 (-> *display* frames-per-second)))
|
||||
(.mov at-0 f0-2)
|
||||
)
|
||||
(let ((f0-2 (-> *display* frames-per-second))) (.mov at-0 f0-2))
|
||||
(.mov vf2 at-0)
|
||||
(.mov.vf vf1 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
|
||||
(.svf (&-> v1-12 quad) vf1)
|
||||
)
|
||||
(.svf (&-> v1-12 quad) vf1))
|
||||
(cond
|
||||
((type-type? (-> gp-0 type) collide-shape-moving)
|
||||
(let ((s3-1 (-> gp-0 status)))
|
||||
(integrate-and-collide! gp-0 s2-1)
|
||||
(set! (-> gp-0 status) s3-1)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(integrate-and-collide! gp-0 s2-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(move-by-vector! gp-0 s3-0)
|
||||
)
|
||||
)
|
||||
(let ((s3-1 (-> gp-0 status))) (integrate-and-collide! gp-0 s2-1) (set! (-> gp-0 status) s3-1)))
|
||||
(else (integrate-and-collide! gp-0 s2-1)))))
|
||||
(else (move-by-vector! gp-0 s3-0)))
|
||||
(when (type-type? (-> gp-0 type) collide-shape-moving)
|
||||
(let ((v1-18 (new 'stack-no-clear 'vector)))
|
||||
(vector-! v1-18 (-> gp-0 trans) s4-0)
|
||||
(vector-float*! (-> gp-0 rider-last-move) v1-18 (-> *display* frames-per-second))
|
||||
)
|
||||
(set-time! (-> gp-0 rider-time))
|
||||
)
|
||||
)
|
||||
(let ((f0-4 (-> arg0 rider-delta-ry)))
|
||||
(if (!= f0-4 0.0)
|
||||
(send-event (-> gp-0 process) 'rotate-y-angle f0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
(vector-float*! (-> gp-0 rider-last-move) v1-18 (-> *display* frames-per-second)))
|
||||
(set-time! (-> gp-0 rider-time))))
|
||||
(let ((f0-4 (-> arg0 rider-delta-ry))) (if (!= f0-4 0.0) (send-event (-> gp-0 process) 'rotate-y-angle f0-4))))
|
||||
(none)))
|
||||
|
||||
(defmethod alloc-riders ((this collide-shape) (arg0 int))
|
||||
(if (-> this riders)
|
||||
(format 0 "ERROR: colide-shape::alloc-riders is being called multiple times!~%")
|
||||
(set! (-> this riders) (new 'process 'collide-sticky-rider-group arg0))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(format 0 "ERROR: colide-shape::alloc-riders is being called multiple times!~%")
|
||||
(set! (-> this riders) (new 'process 'collide-sticky-rider-group arg0)))
|
||||
(none))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,199 +1,189 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/collide-shape-h.gc")
|
||||
|
||||
;; name: collide-target-h.gc
|
||||
;; name in dgo: collide-target-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; We believe that target's control-info may contain an array of these.
|
||||
;; Each collide-history is a record of a single collision event.
|
||||
(deftype collide-history (structure)
|
||||
((intersect vector :inline)
|
||||
(trans vector :inline)
|
||||
(transv vector :inline)
|
||||
(transv-out vector :inline)
|
||||
(local-normal vector :inline)
|
||||
(surface-normal vector :inline)
|
||||
(time time-frame)
|
||||
(status cshape-moving-flags)
|
||||
(pat pat-surface)
|
||||
(reaction-flag cshape-reaction-flags)
|
||||
)
|
||||
((intersect vector :inline)
|
||||
(trans vector :inline)
|
||||
(transv vector :inline)
|
||||
(transv-out vector :inline)
|
||||
(local-normal vector :inline)
|
||||
(surface-normal vector :inline)
|
||||
(time time-frame)
|
||||
(status cshape-moving-flags)
|
||||
(pat pat-surface)
|
||||
(reaction-flag cshape-reaction-flags))
|
||||
(:methods
|
||||
(update! (_type_ collide-shape-moving vector vector vector) _type_)
|
||||
)
|
||||
)
|
||||
(update! (_type_ collide-shape-moving vector vector vector) _type_)))
|
||||
|
||||
;; This is the collide shape for target (Jak).
|
||||
;; It is complicated.
|
||||
(deftype control-info (collide-shape-moving)
|
||||
((unknown-vector00 vector :inline :offset 448)
|
||||
(unknown-vector01 vector :inline :offset 464)
|
||||
(unknown-vector02 vector :inline :offset 480)
|
||||
(unknown-quaternion00 quaternion :inline :offset 496)
|
||||
(unknown-quaternion01 quaternion :inline :offset 512)
|
||||
(unknown-float00 float :offset 528)
|
||||
(unknown-float01 float :offset 532)
|
||||
(unknown-float02 float :offset 536)
|
||||
(unknown-vector10 vector :inline :offset 544)
|
||||
(unknown-vector11 vector :inline :offset 560)
|
||||
(unknown-vector12 vector :inline :offset 576)
|
||||
(unknown-vector13 vector :inline :offset 592)
|
||||
(unknown-vector14 vector :inline :offset 608)
|
||||
(unknown-vector15 vector :inline :offset 624)
|
||||
(unknown-vector16 vector :inline :offset 640)
|
||||
(unknown-dynamics00 dynamics :offset 656)
|
||||
(unknown-surface00 surface :offset 660)
|
||||
(unknown-surface01 surface :offset 664)
|
||||
(unknown-cpad-info00 cpad-info :offset 668)
|
||||
(unknown-float10 float :offset 672)
|
||||
(unknown-float11 float :offset 676)
|
||||
(unknown-float12 float :offset 680)
|
||||
(unknown-float13 float :offset 684)
|
||||
(unknown-vector20 vector :inline :offset 688)
|
||||
(unknown-vector21 vector :inline :offset 704)
|
||||
(unknown-vector22 vector :inline :offset 720)
|
||||
(unknown-vector23 vector :inline :offset 736)
|
||||
(unknown-vector-array00 vector 7 :inline :offset 752)
|
||||
(unknown-vector30 vector :inline :offset 880)
|
||||
(unknown-vector31 vector :inline :offset 896)
|
||||
(unknown-float20 float :offset 912)
|
||||
(unknown-float21 float :offset 916)
|
||||
(unknown-dword00 uint64 :offset 920)
|
||||
(unknown-matrix00 matrix :inline :offset 928)
|
||||
(unknown-matrix01 matrix :inline :offset 992)
|
||||
(unknown-matrix02 matrix :inline :offset 1056)
|
||||
(unknown-qword00 uint128 :offset 1136)
|
||||
(unknown-float30 float :offset 1140)
|
||||
(unknown-vector40 vector :inline :offset 1152)
|
||||
(unknown-float40 float :offset 1172)
|
||||
(unknown-float41 float :offset 1176)
|
||||
(unknown-int00 int32 :offset 1180)
|
||||
(unknown-float50 float :offset 1168)
|
||||
(unknown-vector50 vector :inline :offset 1184)
|
||||
(unknown-vector51 vector :inline :offset 1200)
|
||||
(unknown-vector52 vector :inline :offset 1216)
|
||||
(unknown-vector53 vector :inline :offset 1232)
|
||||
(last-known-safe-ground vector :inline :offset 1248)
|
||||
(unknown-vector55 vector :inline :offset 1264)
|
||||
(unknown-dword10 time-frame :offset 1280)
|
||||
(unknown-dword11 time-frame :offset 1288)
|
||||
(unknown-float60 float :offset 1300)
|
||||
(unknown-float61 float :offset 1304)
|
||||
(unknown-float62 float :offset 1308)
|
||||
(unknown-float63 float :offset 1312)
|
||||
(unknown-float64 float :offset 1316)
|
||||
(unknown-dword20 time-frame :offset 1320)
|
||||
(unknown-dword21 time-frame :offset 1328)
|
||||
(unknown-dword-coverage int64 :offset 1336)
|
||||
(unknown-float-coverage-0 float :offset 1344)
|
||||
(unknown-float-coverage-1 float :offset 1348)
|
||||
(unknown-float-coverage-2 float :offset 1352)
|
||||
(unknown-u32-coverage-0 uint32 :offset 1356)
|
||||
(unknown-vector-coverage-0 vector :inline :offset 1376)
|
||||
(unknown-vector-coverage-1 vector :inline :offset 1392)
|
||||
(unknown-vector-coverage-2 vector :inline :offset 1440)
|
||||
(unknown-vector-coverage-3 vector :inline :offset 1472)
|
||||
(unknown-vector60 vector :inline :offset 1456)
|
||||
(unknown-vector61 vector :inline :offset 1504)
|
||||
(unknown-float70 float :offset 1520)
|
||||
(unknown-float71 float :offset 1524)
|
||||
(unknown-vector70 vector :inline :offset 1536)
|
||||
(unknown-vector71 vector :inline :offset 1552)
|
||||
(unknown-vector72 vector :inline :offset 1568)
|
||||
(unknown-vector73 vector :inline :offset 1584)
|
||||
(unknown-handle00 handle :offset 1600)
|
||||
(unknown-sphere-array00 collide-shape-prim-sphere 3 :offset 1608)
|
||||
(unknown-sphere00 collide-shape-prim-sphere :offset 1632)
|
||||
(unknown-sphere01 collide-shape-prim-sphere :offset 1636)
|
||||
(unknown-sphere02 collide-shape-prim-sphere :offset 1640)
|
||||
(unknown-int50 int32 :offset 1656)
|
||||
(unknown-dword30 time-frame :offset 1664)
|
||||
(unknown-dword31 time-frame :offset 1672)
|
||||
(unknown-dword32 time-frame :offset 1680)
|
||||
(unknown-dword33 time-frame :offset 1688)
|
||||
(unknown-dword34 time-frame :offset 1696)
|
||||
(unknown-dword35 time-frame :offset 1704)
|
||||
(unknown-dword36 time-frame :offset 1712)
|
||||
(unknown-float80 float :offset 1724)
|
||||
(unknown-float81 float :offset 1728)
|
||||
(unknown-float82 float :offset 1732)
|
||||
(unknown-vector80 vector :inline :offset 1744)
|
||||
(unknown-cspace00 cspace :inline :offset 1760)
|
||||
(unknown-vector90 vector :inline :offset 1776)
|
||||
(unknown-vector91 vector :inline :offset 1792)
|
||||
(unknown-vector92 vector :inline :offset 1824)
|
||||
(unknown-cspace10 cspace :inline :offset 1808)
|
||||
(unknown-symbol00 symbol :offset 1840)
|
||||
(unknown-float90 float :offset 1844)
|
||||
(unknown-float91 float :offset 1848)
|
||||
(unknown-vector-array10 vector 16 :inline :offset 1856)
|
||||
(unknown-float100 float :offset 2112)
|
||||
(unknown-int10 int32 :offset 2116)
|
||||
(unknown-float110 float :offset 2120)
|
||||
(unknown-vector100 vector :inline :offset 2128)
|
||||
(unknown-vector101 vector :inline :offset 2144)
|
||||
(unknown-dword40 time-frame :offset 2160)
|
||||
(unknown-dword41 time-frame :offset 2168)
|
||||
(unknown-handle10 handle :offset 2176)
|
||||
(unknown-uint20 uint32 :offset 2184)
|
||||
(unknown-spoolanim00 spool-anim :overlay-at unknown-uint20)
|
||||
(unknown-int20 int32 :overlay-at unknown-spoolanim00)
|
||||
(unknown-symbol20 symbol :overlay-at unknown-int20)
|
||||
(unknown-float120 float :overlay-at unknown-symbol20)
|
||||
(unknown-int21 int32 :offset 2188)
|
||||
(unknown-uint30 uint32 :overlay-at unknown-int21)
|
||||
(unknown-float121 float :overlay-at unknown-uint30)
|
||||
(unknown-uint31 uint32 :offset 2192)
|
||||
(unknown-int37 int32 :overlay-at unknown-uint31)
|
||||
(unknown-float122 float :offset 2196)
|
||||
(unknown-float123 float :offset 2200)
|
||||
(unknown-float124 float :offset 2204)
|
||||
(unknown-vector102 vector :inline :offset 2224)
|
||||
(unknown-vector103 vector :inline :offset 2240)
|
||||
(unknown-quaternion02 quaternion :inline :offset 2256)
|
||||
(unknown-quaternion03 quaternion :inline :offset 2272)
|
||||
(unknown-smush00 smush-control :inline :offset 2288)
|
||||
(unknown-vector110 vector :inline :offset 2320)
|
||||
(unknown-vector111 vector :inline :offset 2336)
|
||||
(unknown-symbol30 symbol :offset 2384)
|
||||
(unknown-int31 uint32 :overlay-at unknown-symbol30)
|
||||
(unknown-dword50 int64 :offset 2392)
|
||||
(unknown-dword51 int64 :offset 2400)
|
||||
(unknown-pointer00 pointer :offset 2416)
|
||||
(unknown-symbol40 symbol :offset 2428)
|
||||
(unknown-dword60 int64 :offset 2432)
|
||||
(unknown-dword61 int64 :offset 2440)
|
||||
(unknown-dword62 int64 :offset 2448)
|
||||
(unknown-dword63 int64 :offset 2456)
|
||||
(unknown-halfword00 int16 :offset 2488)
|
||||
(history-length int16 :offset 2490)
|
||||
(history-data collide-history 128 :inline)
|
||||
(unknown-float140 float :offset 18944)
|
||||
(unknown-dword70 time-frame :offset 18952)
|
||||
(unknown-int40 int32 :offset 18880)
|
||||
(unknown-dword80 time-frame :offset 18888)
|
||||
(unknown-dword81 time-frame :offset 18896)
|
||||
(unknown-float130 float :offset 18904)
|
||||
(unknown-float131 float :offset 18908)
|
||||
(unknown-dword82 time-frame :offset 18912)
|
||||
(unknown-vector120 vector :inline :offset 18928)
|
||||
(unknown-float150 float :overlay-at unknown-float140)
|
||||
(unknown-vector121 vector :inline :offset 18960)
|
||||
(wall-pat pat-surface :offset 18976)
|
||||
(unknown-soundid00 sound-id :offset 18980)
|
||||
(unknown-float141 float :offset 18984)
|
||||
(unknown-soundid01 sound-id :offset 18988)
|
||||
(unknown-int34 int32 :offset 18992)
|
||||
(unknown-int35 int32 :offset 18996)
|
||||
(unknown-int36 int32 :offset 19000)
|
||||
)
|
||||
)
|
||||
((unknown-vector00 vector :inline :offset 448)
|
||||
(unknown-vector01 vector :inline :offset 464)
|
||||
(unknown-vector02 vector :inline :offset 480)
|
||||
(unknown-quaternion00 quaternion :inline :offset 496)
|
||||
(unknown-quaternion01 quaternion :inline :offset 512)
|
||||
(unknown-float00 float :offset 528)
|
||||
(unknown-float01 float :offset 532)
|
||||
(unknown-float02 float :offset 536)
|
||||
(unknown-vector10 vector :inline :offset 544)
|
||||
(unknown-vector11 vector :inline :offset 560)
|
||||
(unknown-vector12 vector :inline :offset 576)
|
||||
(unknown-vector13 vector :inline :offset 592)
|
||||
(unknown-vector14 vector :inline :offset 608)
|
||||
(unknown-vector15 vector :inline :offset 624)
|
||||
(unknown-vector16 vector :inline :offset 640)
|
||||
(unknown-dynamics00 dynamics :offset 656)
|
||||
(unknown-surface00 surface :offset 660)
|
||||
(unknown-surface01 surface :offset 664)
|
||||
(unknown-cpad-info00 cpad-info :offset 668)
|
||||
(unknown-float10 float :offset 672)
|
||||
(unknown-float11 float :offset 676)
|
||||
(unknown-float12 float :offset 680)
|
||||
(unknown-float13 float :offset 684)
|
||||
(unknown-vector20 vector :inline :offset 688)
|
||||
(unknown-vector21 vector :inline :offset 704)
|
||||
(unknown-vector22 vector :inline :offset 720)
|
||||
(unknown-vector23 vector :inline :offset 736)
|
||||
(unknown-vector-array00 vector 7 :inline :offset 752)
|
||||
(unknown-vector30 vector :inline :offset 880)
|
||||
(unknown-vector31 vector :inline :offset 896)
|
||||
(unknown-float20 float :offset 912)
|
||||
(unknown-float21 float :offset 916)
|
||||
(unknown-dword00 uint64 :offset 920)
|
||||
(unknown-matrix00 matrix :inline :offset 928)
|
||||
(unknown-matrix01 matrix :inline :offset 992)
|
||||
(unknown-matrix02 matrix :inline :offset 1056)
|
||||
(unknown-qword00 uint128 :offset 1136)
|
||||
(unknown-float30 float :offset 1140)
|
||||
(unknown-vector40 vector :inline :offset 1152)
|
||||
(unknown-float40 float :offset 1172)
|
||||
(unknown-float41 float :offset 1176)
|
||||
(unknown-int00 int32 :offset 1180)
|
||||
(unknown-float50 float :offset 1168)
|
||||
(unknown-vector50 vector :inline :offset 1184)
|
||||
(unknown-vector51 vector :inline :offset 1200)
|
||||
(unknown-vector52 vector :inline :offset 1216)
|
||||
(unknown-vector53 vector :inline :offset 1232)
|
||||
(last-known-safe-ground vector :inline :offset 1248)
|
||||
(unknown-vector55 vector :inline :offset 1264)
|
||||
(unknown-dword10 time-frame :offset 1280)
|
||||
(unknown-dword11 time-frame :offset 1288)
|
||||
(unknown-float60 float :offset 1300)
|
||||
(unknown-float61 float :offset 1304)
|
||||
(unknown-float62 float :offset 1308)
|
||||
(unknown-float63 float :offset 1312)
|
||||
(unknown-float64 float :offset 1316)
|
||||
(unknown-dword20 time-frame :offset 1320)
|
||||
(unknown-dword21 time-frame :offset 1328)
|
||||
(unknown-dword-coverage int64 :offset 1336)
|
||||
(unknown-float-coverage-0 float :offset 1344)
|
||||
(unknown-float-coverage-1 float :offset 1348)
|
||||
(unknown-float-coverage-2 float :offset 1352)
|
||||
(unknown-u32-coverage-0 uint32 :offset 1356)
|
||||
(unknown-vector-coverage-0 vector :inline :offset 1376)
|
||||
(unknown-vector-coverage-1 vector :inline :offset 1392)
|
||||
(unknown-vector-coverage-2 vector :inline :offset 1440)
|
||||
(unknown-vector-coverage-3 vector :inline :offset 1472)
|
||||
(unknown-vector60 vector :inline :offset 1456)
|
||||
(unknown-vector61 vector :inline :offset 1504)
|
||||
(unknown-float70 float :offset 1520)
|
||||
(unknown-float71 float :offset 1524)
|
||||
(unknown-vector70 vector :inline :offset 1536)
|
||||
(unknown-vector71 vector :inline :offset 1552)
|
||||
(unknown-vector72 vector :inline :offset 1568)
|
||||
(unknown-vector73 vector :inline :offset 1584)
|
||||
(unknown-handle00 handle :offset 1600)
|
||||
(unknown-sphere-array00 collide-shape-prim-sphere 3 :offset 1608)
|
||||
(unknown-sphere00 collide-shape-prim-sphere :offset 1632)
|
||||
(unknown-sphere01 collide-shape-prim-sphere :offset 1636)
|
||||
(unknown-sphere02 collide-shape-prim-sphere :offset 1640)
|
||||
(unknown-int50 int32 :offset 1656)
|
||||
(unknown-dword30 time-frame :offset 1664)
|
||||
(unknown-dword31 time-frame :offset 1672)
|
||||
(unknown-dword32 time-frame :offset 1680)
|
||||
(unknown-dword33 time-frame :offset 1688)
|
||||
(unknown-dword34 time-frame :offset 1696)
|
||||
(unknown-dword35 time-frame :offset 1704)
|
||||
(unknown-dword36 time-frame :offset 1712)
|
||||
(unknown-float80 float :offset 1724)
|
||||
(unknown-float81 float :offset 1728)
|
||||
(unknown-float82 float :offset 1732)
|
||||
(unknown-vector80 vector :inline :offset 1744)
|
||||
(unknown-cspace00 cspace :inline :offset 1760)
|
||||
(unknown-vector90 vector :inline :offset 1776)
|
||||
(unknown-vector91 vector :inline :offset 1792)
|
||||
(unknown-vector92 vector :inline :offset 1824)
|
||||
(unknown-cspace10 cspace :inline :offset 1808)
|
||||
(unknown-symbol00 symbol :offset 1840)
|
||||
(unknown-float90 float :offset 1844)
|
||||
(unknown-float91 float :offset 1848)
|
||||
(unknown-vector-array10 vector 16 :inline :offset 1856)
|
||||
(unknown-float100 float :offset 2112)
|
||||
(unknown-int10 int32 :offset 2116)
|
||||
(unknown-float110 float :offset 2120)
|
||||
(unknown-vector100 vector :inline :offset 2128)
|
||||
(unknown-vector101 vector :inline :offset 2144)
|
||||
(unknown-dword40 time-frame :offset 2160)
|
||||
(unknown-dword41 time-frame :offset 2168)
|
||||
(unknown-handle10 handle :offset 2176)
|
||||
(unknown-uint20 uint32 :offset 2184)
|
||||
(unknown-spoolanim00 spool-anim :overlay-at unknown-uint20)
|
||||
(unknown-int20 int32 :overlay-at unknown-spoolanim00)
|
||||
(unknown-symbol20 symbol :overlay-at unknown-int20)
|
||||
(unknown-float120 float :overlay-at unknown-symbol20)
|
||||
(unknown-int21 int32 :offset 2188)
|
||||
(unknown-uint30 uint32 :overlay-at unknown-int21)
|
||||
(unknown-float121 float :overlay-at unknown-uint30)
|
||||
(unknown-uint31 uint32 :offset 2192)
|
||||
(unknown-int37 int32 :overlay-at unknown-uint31)
|
||||
(unknown-float122 float :offset 2196)
|
||||
(unknown-float123 float :offset 2200)
|
||||
(unknown-float124 float :offset 2204)
|
||||
(unknown-vector102 vector :inline :offset 2224)
|
||||
(unknown-vector103 vector :inline :offset 2240)
|
||||
(unknown-quaternion02 quaternion :inline :offset 2256)
|
||||
(unknown-quaternion03 quaternion :inline :offset 2272)
|
||||
(unknown-smush00 smush-control :inline :offset 2288)
|
||||
(unknown-vector110 vector :inline :offset 2320)
|
||||
(unknown-vector111 vector :inline :offset 2336)
|
||||
(unknown-symbol30 symbol :offset 2384)
|
||||
(unknown-int31 uint32 :overlay-at unknown-symbol30)
|
||||
(unknown-dword50 int64 :offset 2392)
|
||||
(unknown-dword51 int64 :offset 2400)
|
||||
(unknown-pointer00 pointer :offset 2416)
|
||||
(unknown-symbol40 symbol :offset 2428)
|
||||
(unknown-dword60 int64 :offset 2432)
|
||||
(unknown-dword61 int64 :offset 2440)
|
||||
(unknown-dword62 int64 :offset 2448)
|
||||
(unknown-dword63 int64 :offset 2456)
|
||||
(unknown-halfword00 int16 :offset 2488)
|
||||
(history-length int16 :offset 2490)
|
||||
(history-data collide-history 128 :inline)
|
||||
(unknown-float140 float :offset 18944)
|
||||
(unknown-dword70 time-frame :offset 18952)
|
||||
(unknown-int40 int32 :offset 18880)
|
||||
(unknown-dword80 time-frame :offset 18888)
|
||||
(unknown-dword81 time-frame :offset 18896)
|
||||
(unknown-float130 float :offset 18904)
|
||||
(unknown-float131 float :offset 18908)
|
||||
(unknown-dword82 time-frame :offset 18912)
|
||||
(unknown-vector120 vector :inline :offset 18928)
|
||||
(unknown-float150 float :overlay-at unknown-float140)
|
||||
(unknown-vector121 vector :inline :offset 18960)
|
||||
(wall-pat pat-surface :offset 18976)
|
||||
(unknown-soundid00 sound-id :offset 18980)
|
||||
(unknown-float141 float :offset 18984)
|
||||
(unknown-soundid01 sound-id :offset 18988)
|
||||
(unknown-int34 int32 :offset 18992)
|
||||
(unknown-int35 int32 :offset 18996)
|
||||
(unknown-int36 int32 :offset 19000)))
|
||||
|
||||
(defmethod update! ((this collide-history) (cshape collide-shape-moving) (xs vector) (transv vector) (transv-out vector))
|
||||
"Update the collide-history element."
|
||||
@@ -207,5 +197,4 @@
|
||||
(set! (-> this status) (-> cshape status))
|
||||
(set! (-> this reaction-flag) (-> cshape reaction-flag))
|
||||
(set! (-> this pat) (-> cshape cur-pat))
|
||||
this
|
||||
)
|
||||
this)
|
||||
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: collide-touch-h.gc
|
||||
;; name in dgo: collide-touch-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Collide Touch
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -16,52 +11,40 @@
|
||||
;; As the collision is resolved, shapes are added and removed from the touching list.
|
||||
;; Once collision is done solving, you can send events or inspect what you touched!
|
||||
|
||||
|
||||
(defconstant TOUCHING_LIST_LENGTH 32)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; A record of a primitive which is touching another, possibly including the triangle that is involved.
|
||||
(deftype touching-prim (structure)
|
||||
((cprim collide-shape-prim)
|
||||
(has-tri? symbol)
|
||||
(tri collide-tri-result :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((cprim collide-shape-prim)
|
||||
(has-tri? symbol)
|
||||
(tri collide-tri-result :inline)))
|
||||
|
||||
;; A record of two primitives which are touching.
|
||||
(deftype touching-prims-entry (structure)
|
||||
((next touching-prims-entry)
|
||||
(prev touching-prims-entry)
|
||||
(allocated? symbol)
|
||||
(u float)
|
||||
(prim1 touching-prim :inline)
|
||||
(prim2 touching-prim :inline)
|
||||
)
|
||||
((next touching-prims-entry)
|
||||
(prev touching-prims-entry)
|
||||
(allocated? symbol)
|
||||
(u float)
|
||||
(prim1 touching-prim :inline)
|
||||
(prim2 touching-prim :inline))
|
||||
(:methods
|
||||
(get-touched-prim (_type_ trsqv touching-shapes-entry) collide-shape-prim)
|
||||
(touching-prims-entry-method-10 () none)
|
||||
(get-middle-of-bsphere-overlap (_type_ vector) vector)
|
||||
(get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result)
|
||||
)
|
||||
)
|
||||
|
||||
(get-touched-prim (_type_ trsqv touching-shapes-entry) collide-shape-prim)
|
||||
(touching-prims-entry-method-10 () none)
|
||||
(get-middle-of-bsphere-overlap (_type_ vector) vector)
|
||||
(get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result)))
|
||||
|
||||
;; A pool of up to 64 touching primitives. There is a linked list of freed entries.
|
||||
(deftype touching-prims-entry-pool (structure)
|
||||
((head touching-prims-entry)
|
||||
(nodes touching-prims-entry 64 :inline)
|
||||
)
|
||||
((head touching-prims-entry)
|
||||
(nodes touching-prims-entry 64 :inline))
|
||||
(:methods
|
||||
(new (symbol type) _type_)
|
||||
(alloc-node (_type_) touching-prims-entry)
|
||||
(get-free-node-count (_type_) int)
|
||||
(init-list! (_type_) none)
|
||||
(free-node (_type_ touching-prims-entry) touching-prims-entry)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type) _type_)
|
||||
(alloc-node (_type_) touching-prims-entry)
|
||||
(get-free-node-count (_type_) int)
|
||||
(init-list! (_type_) none)
|
||||
(free-node (_type_ touching-prims-entry) touching-prims-entry)))
|
||||
|
||||
(defmethod init-list! ((this touching-prims-entry-pool))
|
||||
"Initialize all entries to be not allocated and in a linked list."
|
||||
@@ -74,14 +57,9 @@
|
||||
(set! (-> current next) (the-as touching-prims-entry next))
|
||||
(set! (-> current allocated?) #f)
|
||||
(set! prev current)
|
||||
(set! current (the-as touching-prims-entry next))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> prev next) #f)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(set! current (the-as touching-prims-entry next)))))
|
||||
(set! (-> prev next) #f))
|
||||
(none))
|
||||
|
||||
(defmethod new touching-prims-entry-pool ((allocation symbol) (type-to-make type))
|
||||
"Allocate and initialize a new touching-prims-entry-pool"
|
||||
@@ -89,80 +67,66 @@
|
||||
;; Note - the original code passed (-> type-to-make size) as an argument.
|
||||
;; however, the new method of structure doesn't have this argument.
|
||||
;; it uses the same value for the size so it doesn't really matter.
|
||||
(let ((this (the touching-prims-entry-pool ((method-of-type structure new)
|
||||
allocation
|
||||
type-to-make
|
||||
;; (-> type-to-make size) see note
|
||||
)
|
||||
)))
|
||||
(let ((this (the touching-prims-entry-pool
|
||||
((method-of-type structure new)
|
||||
allocation
|
||||
type-to-make
|
||||
;; (-> type-to-make size) see note
|
||||
))))
|
||||
(init-list! this)
|
||||
this
|
||||
)
|
||||
)
|
||||
|
||||
this))
|
||||
|
||||
;; two collide shapes which are touching.
|
||||
;; This stores a list of primitive pairs which are touching.
|
||||
(deftype touching-shapes-entry (structure)
|
||||
((cshape1 collide-shape)
|
||||
(cshape2 collide-shape)
|
||||
(resolve-u int8)
|
||||
(head touching-prims-entry)
|
||||
)
|
||||
((cshape1 collide-shape)
|
||||
(cshape2 collide-shape)
|
||||
(resolve-u int8)
|
||||
(head touching-prims-entry))
|
||||
:allow-misaligned
|
||||
(:methods
|
||||
(touching-shapes-entry-method-9 (_type_) none)
|
||||
(get-touched-shape (_type_ collide-shape) collide-shape)
|
||||
(touching-shapes-entry-method-11 () none)
|
||||
(prims-touching? (_type_ collide-shape-moving uint) touching-prims-entry)
|
||||
(prims-touching-action? (_type_ collide-shape collide-action collide-action) touching-prims-entry)
|
||||
(touching-shapes-entry-method-14 () none)
|
||||
(free-touching-prims-list (_type_) symbol)
|
||||
(get-head (_type_) touching-prims-entry)
|
||||
(get-next (_type_ touching-prims-entry) touching-prims-entry)
|
||||
)
|
||||
)
|
||||
(touching-shapes-entry-method-9 (_type_) none)
|
||||
(get-touched-shape (_type_ collide-shape) collide-shape)
|
||||
(touching-shapes-entry-method-11 () none)
|
||||
(prims-touching? (_type_ collide-shape-moving uint) touching-prims-entry)
|
||||
(prims-touching-action? (_type_ collide-shape collide-action collide-action) touching-prims-entry)
|
||||
(touching-shapes-entry-method-14 () none)
|
||||
(free-touching-prims-list (_type_) symbol)
|
||||
(get-head (_type_) touching-prims-entry)
|
||||
(get-next (_type_ touching-prims-entry) touching-prims-entry)))
|
||||
|
||||
;; A list of (up to) TOUCHING_LIST_LENGTH pairs of colliding shapes
|
||||
(deftype touching-list (structure)
|
||||
((num-touching-shapes int32)
|
||||
(resolve-u int8)
|
||||
(touching-shapes touching-shapes-entry TOUCHING_LIST_LENGTH :inline)
|
||||
)
|
||||
((num-touching-shapes int32)
|
||||
(resolve-u int8)
|
||||
(touching-shapes touching-shapes-entry TOUCHING_LIST_LENGTH :inline))
|
||||
(:methods
|
||||
(new (symbol type) _type_)
|
||||
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none)
|
||||
(touching-list-method-10 () none)
|
||||
(update-from-step-size (_type_ float) none)
|
||||
(send-events-for-touching-shapes (_type_) none)
|
||||
(get-shapes-entry (_type_ collide-shape collide-shape) touching-shapes-entry)
|
||||
(free-all-prim-nodes (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type) _type_)
|
||||
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none)
|
||||
(touching-list-method-10 () none)
|
||||
(update-from-step-size (_type_ float) none)
|
||||
(send-events-for-touching-shapes (_type_) none)
|
||||
(get-shapes-entry (_type_ collide-shape collide-shape) touching-shapes-entry)
|
||||
(free-all-prim-nodes (_type_) none)))
|
||||
|
||||
(defmethod new touching-list ((allocation symbol) (type-to-make type))
|
||||
"See note in touching-prims-entry-pool"
|
||||
;; og:preserve-this
|
||||
(let ((this (the touching-list ((method-of-type structure new)
|
||||
allocation
|
||||
type-to-make
|
||||
;; (-> type-to-make size) see note
|
||||
)
|
||||
)))
|
||||
(let ((this (the touching-list
|
||||
((method-of-type structure new)
|
||||
allocation
|
||||
type-to-make
|
||||
;; (-> type-to-make size) see note
|
||||
))))
|
||||
(set! (-> this num-touching-shapes) 0)
|
||||
(set! (-> this resolve-u) 0)
|
||||
this
|
||||
)
|
||||
)
|
||||
this))
|
||||
|
||||
(defmethod get-head ((this touching-shapes-entry))
|
||||
(-> this head)
|
||||
)
|
||||
(-> this head))
|
||||
|
||||
(defmethod get-next ((this touching-shapes-entry) (arg0 touching-prims-entry))
|
||||
(-> arg0 next)
|
||||
)
|
||||
(-> arg0 next))
|
||||
|
||||
;; Allocate the global touching lists.
|
||||
;; We have a pool of prim pairs that can be used in any shape pair
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/collide/collide-touch-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
(require "engine/target/target-h.gc")
|
||||
(require "engine/collide/collide-shape-h.gc")
|
||||
(require "engine/collide/collide-mesh-h.gc")
|
||||
|
||||
;; name: collide-touch.gc
|
||||
;; name in dgo: collide-touch
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -34,41 +29,20 @@
|
||||
(defmethod get-free-node-count ((this touching-prims-entry-pool))
|
||||
"Get the number of nodes that are not in use."
|
||||
(let ((v0-0 0))
|
||||
(let ((v1-0 (-> this head)))
|
||||
(while v1-0
|
||||
(+! v0-0 1)
|
||||
(set! v1-0 (-> v1-0 next))
|
||||
(nop!)
|
||||
(nop!)
|
||||
(nop!)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(let ((v1-0 (-> this head))) (while v1-0 (+! v0-0 1) (set! v1-0 (-> v1-0 next)) (nop!) (nop!) (nop!)))
|
||||
v0-0))
|
||||
|
||||
(defmethod alloc-node ((this touching-prims-entry-pool))
|
||||
"Allocate a node. Will return #f if there are none left."
|
||||
(let ((gp-0 (-> this head)))
|
||||
(cond
|
||||
(gp-0
|
||||
(let ((v1-0 (-> gp-0 next)))
|
||||
(set! (-> this head) v1-0)
|
||||
(if v1-0
|
||||
(set! (-> v1-0 prev) #f)
|
||||
)
|
||||
)
|
||||
(set! (-> gp-0 allocated?) #t)
|
||||
(set! (-> gp-0 next) #f)
|
||||
(set! (-> gp-0 prev) #f)
|
||||
)
|
||||
(else
|
||||
(format 0 "ERROR: touching-prims-entry-pool::alloc-node() failed!~%")
|
||||
)
|
||||
)
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
(let ((v1-0 (-> gp-0 next))) (set! (-> this head) v1-0) (if v1-0 (set! (-> v1-0 prev) #f)))
|
||||
(set! (-> gp-0 allocated?) #t)
|
||||
(set! (-> gp-0 next) #f)
|
||||
(set! (-> gp-0 prev) #f))
|
||||
(else (format 0 "ERROR: touching-prims-entry-pool::alloc-node() failed!~%")))
|
||||
gp-0))
|
||||
|
||||
(defmethod free-node ((this touching-prims-entry-pool) (arg0 touching-prims-entry))
|
||||
"Free a node allocated with alloc-node"
|
||||
@@ -78,12 +52,7 @@
|
||||
(set! (-> arg0 next) v1-1)
|
||||
(set! (-> arg0 prev) #f)
|
||||
(set! (-> this head) arg0)
|
||||
(if v1-1
|
||||
(set! (-> v1-1 prev) arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-1 (set! (-> v1-1 prev) arg0)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Shapes Entry
|
||||
@@ -101,17 +70,8 @@
|
||||
(set! (-> this head) #f)
|
||||
(let ((s5-0 *touching-prims-entry-pool*))
|
||||
(while gp-0
|
||||
(let ((a1-0 gp-0))
|
||||
(set! gp-0 (-> a1-0 next))
|
||||
(free-node s5-0 a1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-0 gp-0)) (set! gp-0 (-> a1-0 next)) (free-node s5-0 a1-0))))
|
||||
#f))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Touching List
|
||||
@@ -124,78 +84,53 @@
|
||||
(let ((s5-0 (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (s4-0 (-> this num-touching-shapes))
|
||||
(free-touching-prims-list s5-0)
|
||||
(&+! s5-0 16)
|
||||
)
|
||||
)
|
||||
(&+! s5-0 16)))
|
||||
(set! (-> this num-touching-shapes) 0)
|
||||
(set! (-> this resolve-u) 0)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(none))
|
||||
|
||||
(defmethod get-shapes-entry ((this touching-list) (arg0 collide-shape) (arg1 collide-shape))
|
||||
"Get a touching-shapes-entry for the two shapes. If one exists, it will be returned. Otherwise a new one will be made."
|
||||
(let ((v0-0 (the-as touching-shapes-entry (-> this touching-shapes)))) ;; the candidate
|
||||
(let ((v1-0 (the-as touching-shapes-entry #f))) ;; a good one
|
||||
|
||||
(let ((v1-0 (the-as touching-shapes-entry #f))) ;; a good one
|
||||
;; loop over all touching shapes
|
||||
(countdown (a3-0 (-> this num-touching-shapes))
|
||||
(let ((t0-0 (-> v0-0 cshape1)))
|
||||
(set! v1-0
|
||||
(cond
|
||||
(t0-0
|
||||
;; in use. If it's match, return it (allows a,b or b,a to match a,b)
|
||||
(if (or (and (= t0-0 arg0) (= (-> v0-0 cshape2) arg1)) (and (= t0-0 arg1) (= (-> v0-0 cshape2) arg0)))
|
||||
(return v0-0)
|
||||
)
|
||||
;; otherwise bad
|
||||
v1-0
|
||||
)
|
||||
;; in use. If it's match, return it (allows a,b or b,a to match a,b)
|
||||
(if (or (and (= t0-0 arg0) (= (-> v0-0 cshape2) arg1)) (and (= t0-0 arg1) (= (-> v0-0 cshape2) arg0))) (return v0-0))
|
||||
;; otherwise bad
|
||||
v1-0)
|
||||
(else
|
||||
;; not in use. remember it's free and keep looking.
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! v0-0 16)
|
||||
)
|
||||
|
||||
;; not in use. remember it's free and keep looking.
|
||||
v0-0))))
|
||||
(&+! v0-0 16))
|
||||
;; done looping.
|
||||
(cond
|
||||
(v1-0 ;; did we find an unused slot? if so return it
|
||||
(set! v0-0 v1-0)
|
||||
)
|
||||
(set! v0-0 v1-0))
|
||||
(else
|
||||
;; need to add a new one
|
||||
(when (>= (-> this num-touching-shapes) TOUCHING_LIST_LENGTH)
|
||||
;; but there's no room!
|
||||
(format 0 "ERROR: touching-list::get-shapes-entry() failed!~%")
|
||||
(return (the-as touching-shapes-entry #f))
|
||||
)
|
||||
;; enough room, increase the size
|
||||
(+! (-> this num-touching-shapes) 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; need to add a new one
|
||||
(when (>= (-> this num-touching-shapes) TOUCHING_LIST_LENGTH)
|
||||
;; but there's no room!
|
||||
(format 0 "ERROR: touching-list::get-shapes-entry() failed!~%")
|
||||
(return (the-as touching-shapes-entry #f)))
|
||||
;; enough room, increase the size
|
||||
(+! (-> this num-touching-shapes) 1))))
|
||||
;; if we're doing a new one, set it up.
|
||||
(set! (-> v0-0 cshape1) arg0)
|
||||
(set! (-> v0-0 cshape2) arg1)
|
||||
(set! (-> v0-0 head) #f)
|
||||
(set! (-> v0-0 resolve-u) 1)
|
||||
(set! (-> this resolve-u) 1)
|
||||
(the-as touching-shapes-entry v0-0)
|
||||
)
|
||||
)
|
||||
(the-as touching-shapes-entry v0-0)))
|
||||
|
||||
(deftype add-prims-touching-work (structure)
|
||||
((tri1 collide-tri-result)
|
||||
(tri2 collide-tri-result)
|
||||
)
|
||||
)
|
||||
|
||||
((tri1 collide-tri-result)
|
||||
(tri2 collide-tri-result)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Touching List Update
|
||||
@@ -212,37 +147,22 @@
|
||||
;; "What happens if I move forward 0.7 timesteps?"
|
||||
;; .. repeat ..
|
||||
|
||||
|
||||
|
||||
|
||||
(defmethod add-touching-prims ((this touching-list)
|
||||
(arg0 collide-shape-prim)
|
||||
(arg1 collide-shape-prim)
|
||||
(arg2 float)
|
||||
(arg3 collide-tri-result)
|
||||
(arg4 collide-tri-result)
|
||||
)
|
||||
(defmethod add-touching-prims ((this touching-list) (arg0 collide-shape-prim) (arg1 collide-shape-prim) (arg2 float) (arg3 collide-tri-result) (arg4 collide-tri-result))
|
||||
"Tell the touching list that if we end taking a step of at least arg2, the prims arg0/arg1 will collide.
|
||||
However, you don't have to know for sure if you're going to take this big of a step yet.
|
||||
You can provide triangles if you want, but you don't have to.
|
||||
The logic for calling this twice for the same prims in between calls to update-from-step-size is a little weird
|
||||
so I suspect this never happens (and it's probably cheaper to avoid this duplication in the actual prim collision code)."
|
||||
|
||||
;; I don't know why they made this type, but I'm guessing it's to avoid the compiler spilling to the stack
|
||||
(let ((gp-0 (new 'stack-no-clear 'add-prims-touching-work)))
|
||||
(set! (-> gp-0 tri1) arg3)
|
||||
(set! (-> gp-0 tri2) arg4)
|
||||
|
||||
;; first, grab the entry for the collide-shapes involved.
|
||||
(let ((s2-0 (get-shapes-entry this (-> arg0 cshape) (-> arg1 cshape))))
|
||||
(when s2-0
|
||||
;; if we ask for a,b, that function might give us b,a. Detect that, and swap our collide shape prims.
|
||||
(when (= (-> s2-0 cshape1) (-> arg1 cshape))
|
||||
(let ((v1-4 arg0))
|
||||
(set! arg0 arg1)
|
||||
(set! arg1 v1-4)
|
||||
)
|
||||
)
|
||||
(let ((v1-4 arg0)) (set! arg0 arg1) (set! arg1 v1-4)))
|
||||
(let ((s0-0 (-> s2-0 head)))
|
||||
;; loop over all the entries in the shapes
|
||||
(while s0-0
|
||||
@@ -253,42 +173,24 @@
|
||||
;; this value is unused.
|
||||
(-> s0-0 u)
|
||||
(let ((v1-12 (-> s0-0 prim1))
|
||||
(a1-2 (-> gp-0 tri1))
|
||||
)
|
||||
(a1-2 (-> gp-0 tri1)))
|
||||
(cond
|
||||
(a1-2
|
||||
;; we have a tri, copy it
|
||||
(set! (-> v1-12 has-tri?) #t)
|
||||
(mem-copy! (the-as pointer (-> v1-12 tri)) (the-as pointer a1-2) 84)
|
||||
)
|
||||
;; we have a tri, copy it
|
||||
(set! (-> v1-12 has-tri?) #t)
|
||||
(mem-copy! (the-as pointer (-> v1-12 tri)) (the-as pointer a1-2) 84))
|
||||
(else
|
||||
;; no tri
|
||||
(set! (-> v1-12 has-tri?) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; no tri
|
||||
(set! (-> v1-12 has-tri?) #f))))
|
||||
;; same for the other tri.
|
||||
(let ((v1-15 (-> s0-0 prim2))
|
||||
(a1-3 (-> gp-0 tri2))
|
||||
)
|
||||
(a1-3 (-> gp-0 tri2)))
|
||||
(cond
|
||||
(a1-3
|
||||
(set! (-> v1-15 has-tri?) #t)
|
||||
(mem-copy! (the-as pointer (-> v1-15 tri)) (the-as pointer a1-3) 84)
|
||||
)
|
||||
(else
|
||||
(set! (-> v1-15 has-tri?) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(a1-3 (set! (-> v1-15 has-tri?) #t) (mem-copy! (the-as pointer (-> v1-15 tri)) (the-as pointer a1-3) 84))
|
||||
(else (set! (-> v1-15 has-tri?) #f)))))
|
||||
;; after we found the matching node for these prims, we're done!
|
||||
(return 0)
|
||||
)
|
||||
(set! s0-0 (-> s0-0 next))
|
||||
)
|
||||
)
|
||||
|
||||
(return 0))
|
||||
(set! s0-0 (-> s0-0 next))))
|
||||
;; nope, didn't find an entry, so make a new one.
|
||||
(let ((s0-1 (alloc-node *touching-prims-entry-pool*)))
|
||||
;; allocate a new node, link it.
|
||||
@@ -297,58 +199,31 @@
|
||||
(set! (-> s0-1 next) v1-22)
|
||||
(set! (-> s0-1 prev) #f)
|
||||
(set! (-> s2-0 head) s0-1)
|
||||
(if v1-22
|
||||
(set! (-> v1-22 prev) s0-1)
|
||||
)
|
||||
)
|
||||
(if v1-22 (set! (-> v1-22 prev) s0-1)))
|
||||
;; and set it up.
|
||||
(set! (-> s0-1 u) arg2)
|
||||
(when (>= arg2 0.0)
|
||||
;; if we're >0, we have to move (which we haven't done yet) to actually collide.
|
||||
;; flag us as resolve-u (meaning our u is from the resolve function, which looks at what _would_
|
||||
;; happen if we did it all at once.)
|
||||
|
||||
;; if we're <0, we started in collision (possible, if we didnt' converge on the last frame)
|
||||
;; we should still add, but we don't need to bother with the "did we go far enough" checks.
|
||||
(set! (-> s2-0 resolve-u) 1)
|
||||
(set! (-> this resolve-u) 1)
|
||||
)
|
||||
(set! (-> this resolve-u) 1))
|
||||
(let ((v1-26 (-> s0-1 prim1))
|
||||
(a1-4 (-> gp-0 tri1))
|
||||
)
|
||||
(a1-4 (-> gp-0 tri1)))
|
||||
(set! (-> v1-26 cprim) arg0)
|
||||
(cond
|
||||
(a1-4
|
||||
(set! (-> v1-26 has-tri?) #t)
|
||||
(mem-copy! (the-as pointer (-> v1-26 tri)) (the-as pointer a1-4) 84)
|
||||
)
|
||||
(else
|
||||
(set! (-> v1-26 has-tri?) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(a1-4 (set! (-> v1-26 has-tri?) #t) (mem-copy! (the-as pointer (-> v1-26 tri)) (the-as pointer a1-4) 84))
|
||||
(else (set! (-> v1-26 has-tri?) #f))))
|
||||
(let ((v1-29 (-> s0-1 prim2))
|
||||
(a1-5 (-> gp-0 tri2))
|
||||
)
|
||||
(a1-5 (-> gp-0 tri2)))
|
||||
(set! (-> v1-29 cprim) arg1)
|
||||
(cond
|
||||
(a1-5
|
||||
(set! (-> v1-29 has-tri?) #t)
|
||||
(mem-copy! (the-as pointer (-> v1-29 tri)) (the-as pointer a1-5) 84)
|
||||
)
|
||||
(else
|
||||
(set! (-> v1-29 has-tri?) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(a1-5 (set! (-> v1-29 has-tri?) #t) (mem-copy! (the-as pointer (-> v1-29 tri)) (the-as pointer a1-5) 84))
|
||||
(else (set! (-> v1-29 has-tri?) #f)))))))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod update-from-step-size ((this touching-list) (arg0 float))
|
||||
"Given that we actually will take a step size of arg0, remove things we won't actually hit."
|
||||
@@ -356,7 +231,6 @@
|
||||
(when (nonzero? (-> this resolve-u))
|
||||
;; remember we did it
|
||||
(set! (-> this resolve-u) 0)
|
||||
|
||||
;; loop through touching-shape-entries
|
||||
(let ((s5-0 (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (s4-0 (-> this num-touching-shapes))
|
||||
@@ -381,52 +255,26 @@
|
||||
;; we set the u to -1.0 to indicate that we're massively intersecting.
|
||||
;; this will no longer be eligible for removal because we actually hit it.
|
||||
(set! (-> s3-0 u) -1.0)
|
||||
(set! s3-0 (-> s3-0 next))
|
||||
)
|
||||
(set! s3-0 (-> s3-0 next)))
|
||||
(else
|
||||
;; we would have needed to move more than arg0 to hit this one.
|
||||
;; at least for now, remove by splicing out of the list and freeing.
|
||||
(let ((a1-1 s3-0)) ;; this
|
||||
(let ((v1-7 (-> s3-0 next))) ;; next
|
||||
(let ((a0-1 (-> s3-0 prev))) ;; prev
|
||||
(if a0-1
|
||||
(set! (-> a0-1 next) v1-7)
|
||||
(set! (-> s5-0 head) v1-7)
|
||||
)
|
||||
(if v1-7
|
||||
(set! (-> v1-7 prev) a0-1)
|
||||
)
|
||||
)
|
||||
(set! s3-0 v1-7)
|
||||
)
|
||||
(free-node *touching-prims-entry-pool* a1-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
s3-0
|
||||
)
|
||||
;; we would have needed to move more than arg0 to hit this one.
|
||||
;; at least for now, remove by splicing out of the list and freeing.
|
||||
(let ((a1-1 s3-0)) ;; this
|
||||
(let ((v1-7 (-> s3-0 next))) ;; next
|
||||
(let ((a0-1 (-> s3-0 prev))) ;; prev
|
||||
(if a0-1 (set! (-> a0-1 next) v1-7) (set! (-> s5-0 head) v1-7))
|
||||
(if v1-7 (set! (-> v1-7 prev) a0-1)))
|
||||
(set! s3-0 v1-7))
|
||||
(free-node *touching-prims-entry-pool* a1-1))))
|
||||
s3-0)
|
||||
(else
|
||||
;; not touching, advance to the next.
|
||||
(-> s3-0 next)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; not touching, advance to the next.
|
||||
(-> s3-0 next)))))))
|
||||
;; if we removed everything from this, mark it as dead (the allocation function will reuse it now)
|
||||
(if (not (-> s5-0 head))
|
||||
(set! (-> s5-0 cshape1) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! s5-0 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (not (-> s5-0 head)) (set! (-> s5-0 cshape1) #f))))
|
||||
(&+! s5-0 16))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod send-events-for-touching-shapes ((this touching-list))
|
||||
"Send all events for touching shapes.
|
||||
@@ -439,112 +287,57 @@
|
||||
;; the touching list will run its logic on it regardless.
|
||||
;; this is fixed here by creating a really large list of 2 handles per collide shape and storing all collided
|
||||
;; process handles there. (process->handle) is then safe to use.
|
||||
|
||||
; (* 2 TOUCHING_LIST_LENGTH) -> 64
|
||||
(let ((handles (new 'stack-no-clear 'array 'handle 64)))
|
||||
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2)
|
||||
)
|
||||
|
||||
(set! (-> handles (+ 0 (* 2 i))) (process->handle (-> c1 process)))
|
||||
(set! (-> handles (+ 1 (* 2 i))) (process->handle (-> c2 process)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1))
|
||||
)
|
||||
)
|
||||
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2)
|
||||
)
|
||||
|
||||
;; send events!
|
||||
(let (
|
||||
(c1-proc (handle->process (-> handles (+ 0 (* 2 i)))))
|
||||
(c2-proc (handle->process (-> handles (+ 1 (* 2 i)))))
|
||||
)
|
||||
(let ((v1-4 (-> c1 event-self)))
|
||||
(if v1-4
|
||||
(send-event c1-proc v1-4 :from c2-proc entry)
|
||||
)
|
||||
)
|
||||
(let ((v1-5 (-> c1 event-other)))
|
||||
(if v1-5
|
||||
(send-event c2-proc v1-5 :from c1-proc entry)
|
||||
)
|
||||
)
|
||||
(let ((v1-6 (-> c2 event-self)))
|
||||
(if v1-6
|
||||
(send-event c2-proc v1-6 :from c1-proc entry)
|
||||
)
|
||||
)
|
||||
(let ((v1-7 (-> c2 event-other)))
|
||||
(if v1-7
|
||||
(send-event c1-proc v1-7 :from c2-proc entry)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1))
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2))
|
||||
(set! (-> handles (+ 0 (* 2 i))) (process->handle (-> c1 process)))
|
||||
(set! (-> handles (+ 1 (* 2 i))) (process->handle (-> c2 process))))))
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1))))
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2))
|
||||
;; send events!
|
||||
(let ((c1-proc (handle->process (-> handles (+ 0 (* 2 i)))))
|
||||
(c2-proc (handle->process (-> handles (+ 1 (* 2 i))))))
|
||||
(let ((v1-4 (-> c1 event-self))) (if v1-4 (send-event c1-proc v1-4 :from c2-proc entry)))
|
||||
(let ((v1-5 (-> c1 event-other))) (if v1-5 (send-event c2-proc v1-5 :from c1-proc entry)))
|
||||
(let ((v1-6 (-> c2 event-self))) (if v1-6 (send-event c2-proc v1-6 :from c1-proc entry)))
|
||||
(let ((v1-7 (-> c2 event-other))) (if v1-7 (send-event c1-proc v1-7 :from c2-proc entry)))))))
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1)))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod prims-touching? touching-shapes-entry ((this touching-shapes-entry) (arg0 collide-shape-moving) (arg1 uint))
|
||||
(defmethod prims-touching? ((this touching-shapes-entry) (arg0 collide-shape-moving) (arg1 uint))
|
||||
"In a pair of collide shapes, is a prim from the given collide shape with the given prim-id mask touching the other shape?"
|
||||
(cond
|
||||
((= (-> this cshape1) arg0)
|
||||
(let ((v1-1 (-> this head)))
|
||||
(while v1-1
|
||||
(if (logtest? (-> v1-1 prim1 cprim prim-id) arg1)
|
||||
(return v1-1)
|
||||
)
|
||||
(set! v1-1 (-> v1-1 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (logtest? (-> v1-1 prim1 cprim prim-id) arg1) (return v1-1))
|
||||
(set! v1-1 (-> v1-1 next)))))
|
||||
((= (-> this cshape2) arg0)
|
||||
(let ((v1-4 (-> this head)))
|
||||
(while v1-4
|
||||
(if (logtest? (-> v1-4 prim2 cprim prim-id) arg1)
|
||||
(return v1-4)
|
||||
)
|
||||
(set! v1-4 (-> v1-4 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format 0 "ERROR: touching-shapes-entry::prims-touching? : Bogus cshape value!~%")
|
||||
)
|
||||
)
|
||||
(the-as touching-prims-entry #f)
|
||||
)
|
||||
(if (logtest? (-> v1-4 prim2 cprim prim-id) arg1) (return v1-4))
|
||||
(set! v1-4 (-> v1-4 next)))))
|
||||
(else (format 0 "ERROR: touching-shapes-entry::prims-touching? : Bogus cshape value!~%")))
|
||||
(the-as touching-prims-entry #f))
|
||||
|
||||
(defmethod prims-touching-action? touching-shapes-entry ((this touching-shapes-entry) (arg0 collide-shape) (arg1 collide-action) (arg2 collide-action))
|
||||
(defmethod prims-touching-action? ((this touching-shapes-entry) (arg0 collide-shape) (arg1 collide-action) (arg2 collide-action))
|
||||
"In a pair of collide shapes, find a pair of colliding prims where the prim from the given collide shape has at least one of the actions in arg1
|
||||
and none of the actions in arg2."
|
||||
(cond
|
||||
@@ -552,81 +345,38 @@
|
||||
(let ((v1-1 (-> this head)))
|
||||
(while v1-1
|
||||
(let ((a0-1 (-> v1-1 prim1 cprim)))
|
||||
(if (and (logtest? arg1 (-> a0-1 prim-core action)) (not (logtest? arg2 (-> a0-1 prim-core action))))
|
||||
(return v1-1)
|
||||
)
|
||||
)
|
||||
(set! v1-1 (-> v1-1 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (and (logtest? arg1 (-> a0-1 prim-core action)) (not (logtest? arg2 (-> a0-1 prim-core action)))) (return v1-1)))
|
||||
(set! v1-1 (-> v1-1 next)))))
|
||||
((= (-> this cshape2) arg0)
|
||||
(let ((v1-4 (-> this head)))
|
||||
(while v1-4
|
||||
(let ((a0-5 (-> v1-4 prim2 cprim)))
|
||||
(if (and (logtest? arg1 (-> a0-5 prim-core action)) (not (logtest? arg2 (-> a0-5 prim-core action))))
|
||||
(return v1-4)
|
||||
)
|
||||
)
|
||||
(set! v1-4 (-> v1-4 next))
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(format 0 "ERROR: touching-shapes-entry::prims-touching-action? : Bogus cshape value!~%")
|
||||
)
|
||||
)
|
||||
(the-as touching-prims-entry #f)
|
||||
)
|
||||
(if (and (logtest? arg1 (-> a0-5 prim-core action)) (not (logtest? arg2 (-> a0-5 prim-core action)))) (return v1-4)))
|
||||
(set! v1-4 (-> v1-4 next)))))
|
||||
(else (format 0 "ERROR: touching-shapes-entry::prims-touching-action? : Bogus cshape value!~%")))
|
||||
(the-as touching-prims-entry #f))
|
||||
|
||||
(defmethod get-touched-shape ((this touching-shapes-entry) (arg0 collide-shape))
|
||||
"Get the other shape in a pair of shapes."
|
||||
(cond
|
||||
((= (-> this cshape1) arg0)
|
||||
(return (-> this cshape2))
|
||||
)
|
||||
((= (-> this cshape2) arg0)
|
||||
(return (-> this cshape1))
|
||||
)
|
||||
)
|
||||
(the-as collide-shape #f)
|
||||
)
|
||||
((= (-> this cshape1) arg0) (return (-> this cshape2)))
|
||||
((= (-> this cshape2) arg0) (return (-> this cshape1))))
|
||||
(the-as collide-shape #f))
|
||||
|
||||
(defmethod get-touched-prim ((this touching-prims-entry) (arg0 trsqv) (arg1 touching-shapes-entry))
|
||||
"Get the primitive belonging to the collide shape that is touching."
|
||||
(cond
|
||||
((= (-> arg1 cshape1) arg0)
|
||||
(return (-> this prim1 cprim))
|
||||
)
|
||||
((= (-> arg1 cshape2) arg0)
|
||||
(return (-> this prim2 cprim))
|
||||
)
|
||||
)
|
||||
(the-as collide-shape-prim #f)
|
||||
)
|
||||
((= (-> arg1 cshape1) arg0) (return (-> this prim1 cprim)))
|
||||
((= (-> arg1 cshape2) arg0) (return (-> this prim2 cprim))))
|
||||
(the-as collide-shape-prim #f))
|
||||
|
||||
(defmethod get-touched-tri ((this touching-prims-entry) (arg0 collide-shape) (arg1 touching-shapes-entry))
|
||||
"Get the triangle belonging to the the collide shape that is touching (if it has one, otherwise #f)"
|
||||
(let ((v0-0 (the-as collide-tri-result #f)))
|
||||
(cond
|
||||
((= (-> arg1 cshape1) arg0)
|
||||
(let ((v1-2 (-> this prim1)))
|
||||
(if (-> v1-2 has-tri?)
|
||||
(set! v0-0 (-> v1-2 tri))
|
||||
)
|
||||
)
|
||||
)
|
||||
((= (-> arg1 cshape2) arg0)
|
||||
(let ((v1-5 (-> this prim2)))
|
||||
(if (-> v1-5 has-tri?)
|
||||
(set! v0-0 (-> v1-5 tri))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
((= (-> arg1 cshape1) arg0) (let ((v1-2 (-> this prim1))) (if (-> v1-2 has-tri?) (set! v0-0 (-> v1-2 tri)))))
|
||||
((= (-> arg1 cshape2) arg0) (let ((v1-5 (-> this prim2))) (if (-> v1-5 has-tri?) (set! v0-0 (-> v1-5 tri))))))
|
||||
v0-0))
|
||||
|
||||
(defmethod get-middle-of-bsphere-overlap ((this touching-prims-entry) (arg0 vector))
|
||||
"This is a bit weird...
|
||||
@@ -634,27 +384,12 @@
|
||||
that is inside of both spheres, and get the midpoint of that."
|
||||
(let* ((s4-0 (-> this prim1 cprim))
|
||||
(s3-0 (-> this prim2 cprim))
|
||||
|
||||
;; compute the offset between the prim cores.
|
||||
(gp-1 (vector-!
|
||||
(new 'stack-no-clear 'vector)
|
||||
(the-as vector (-> s3-0 prim-core))
|
||||
(the-as vector (-> s4-0 prim-core))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(gp-1 (vector-! (new 'stack-no-clear 'vector) (the-as vector (-> s3-0 prim-core)) (the-as vector (-> s4-0 prim-core)))))
|
||||
;; subtract off the two radius. this is now the offset between the "closest" points (and is negative)
|
||||
(let ((f1-2 (- (- (vector-length gp-1) (-> s3-0 prim-core world-sphere w)) (-> s4-0 prim-core world-sphere w))))
|
||||
;; this offset is the radius, minus half the overlap distance
|
||||
(vector-normalize! gp-1 (+ (-> s4-0 prim-core world-sphere w) (* 0.5 f1-2)))
|
||||
)
|
||||
(vector-normalize! gp-1 (+ (-> s4-0 prim-core world-sphere w) (* 0.5 f1-2))))
|
||||
;; so add it to s4's origin to get to the halfway point
|
||||
(vector+! arg0 gp-1 (the-as vector (-> s4-0 prim-core)))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(vector+! arg0 gp-1 (the-as vector (-> s4-0 prim-core))))
|
||||
arg0)
|
||||
@@ -1,32 +1,25 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: collide.gc
|
||||
;; name in dgo: collide
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define *collide-vif0-init* (the-as (array uint32) (new 'static 'boxed-array :type uint32
|
||||
#x30000000
|
||||
#x4d000000
|
||||
#x4d000000
|
||||
#x4d000000
|
||||
#x3f800000
|
||||
#x5000001
|
||||
#x20000000
|
||||
#x40404040
|
||||
#x1000404
|
||||
#x0
|
||||
#x0
|
||||
#x0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(define *collide-vif0-init*
|
||||
(the-as (array uint32)
|
||||
(new 'static
|
||||
'boxed-array
|
||||
:type
|
||||
uint32
|
||||
#x30000000
|
||||
#x4d000000
|
||||
#x4d000000
|
||||
#x4d000000
|
||||
#x3f800000
|
||||
#x5000001
|
||||
#x20000000
|
||||
#x40404040
|
||||
#x1000404
|
||||
#x0
|
||||
#x0
|
||||
#x0)))
|
||||
@@ -1,95 +1,78 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector-h.gc")
|
||||
(require "engine/gfx/tie/tie-h.gc")
|
||||
(require "engine/ps2/vu1-macros.gc")
|
||||
(require "engine/geometry/bounding-box-h.gc")
|
||||
(require "engine/math/math.gc")
|
||||
|
||||
;; name: main-collide.gc
|
||||
;; name in dgo: main-collide
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; definition for function drawable-sphere-box-intersect?
|
||||
;; WARN: Function may read a register that is not set: f31
|
||||
;; Used lq/sq
|
||||
(defun drawable-sphere-box-intersect? ((arg0 drawable) (arg1 bounding-box4w))
|
||||
(local-vars
|
||||
(r0-0 int)
|
||||
(r0-1 int)
|
||||
(r0-2 uint128)
|
||||
(r0-3 int)
|
||||
(v1-1 uint128)
|
||||
(v1-2 uint128)
|
||||
(v1-3 uint128)
|
||||
(a0-1 uint128)
|
||||
(a1-2 uint128)
|
||||
(a2-0 uint128)
|
||||
(f31-0 none)
|
||||
)
|
||||
(r0-0 int)
|
||||
(r0-1 int)
|
||||
(r0-2 uint128)
|
||||
(r0-3 int)
|
||||
(v1-1 uint128)
|
||||
(v1-2 uint128)
|
||||
(v1-3 uint128)
|
||||
(a0-1 uint128)
|
||||
(a1-2 uint128)
|
||||
(a2-0 uint128)
|
||||
(f31-0 none))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(.lvf vf1 (&-> arg0 bsphere quad))
|
||||
(.add.w.vf vf2 vf1 vf1 :mask #b111)
|
||||
(let ((v1-0 (-> arg1 min quad)))
|
||||
(.sub.w.vf vf1 vf1 vf1 :mask #b111)
|
||||
(let ((a1-1 (-> arg1 max quad)))
|
||||
(.ftoi.vf vf4 vf2)
|
||||
(nop!)
|
||||
(.ftoi.vf vf3 vf1)
|
||||
(nop!)
|
||||
(.mov a0-1 vf4)
|
||||
(nop!)
|
||||
(.mov a2-0 vf3)
|
||||
(nop!)
|
||||
(.pcgtw a1-2 a2-0 a1-1)
|
||||
)
|
||||
(.mov r0-0 f31-0)
|
||||
(.pcgtw v1-1 v1-0 a0-1)
|
||||
)
|
||||
(.mov r0-1 f31-0)
|
||||
(.por v1-2 a1-2 v1-1)
|
||||
(.mov r0-2 f31-0)
|
||||
(.ppach v1-3 r0-2 v1-2)
|
||||
(.mov r0-3 f31-0)
|
||||
(let ((v1-4 (shl (the-as int v1-3) 16)))
|
||||
(vf4 :class vf))
|
||||
(nop!)
|
||||
(zero? v1-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(nop!)
|
||||
(.lvf vf1 (&-> arg0 bsphere quad))
|
||||
(.add.w.vf vf2 vf1 vf1 :mask #b111)
|
||||
(let ((v1-0 (-> arg1 min quad)))
|
||||
(.sub.w.vf vf1 vf1 vf1 :mask #b111)
|
||||
(let ((a1-1 (-> arg1 max quad)))
|
||||
(.ftoi.vf vf4 vf2)
|
||||
(nop!)
|
||||
(.ftoi.vf vf3 vf1)
|
||||
(nop!)
|
||||
(.mov a0-1 vf4)
|
||||
(nop!)
|
||||
(.mov a2-0 vf3)
|
||||
(nop!)
|
||||
(.pcgtw a1-2 a2-0 a1-1))
|
||||
(.mov r0-0 f31-0)
|
||||
(.pcgtw v1-1 v1-0 a0-1))
|
||||
(.mov r0-1 f31-0)
|
||||
(.por v1-2 a1-2 v1-1)
|
||||
(.mov r0-2 f31-0)
|
||||
(.ppach v1-3 r0-2 v1-2)
|
||||
(.mov r0-3 f31-0)
|
||||
(let ((v1-4 (shl (the-as int v1-3) 16))) (nop!) (zero? v1-4))))
|
||||
|
||||
;; definition for function instance-sphere-box-intersect?
|
||||
;; WARN: Function may read a register that is not set: f31
|
||||
;; Used lq/sq
|
||||
(defun
|
||||
instance-sphere-box-intersect?
|
||||
((arg0 drawable) (arg1 instance-tie) (arg2 bounding-box4w))
|
||||
(defun instance-sphere-box-intersect? ((arg0 drawable) (arg1 instance-tie) (arg2 bounding-box4w))
|
||||
(local-vars
|
||||
(zero uint128)
|
||||
(v1-3 uint128)
|
||||
(v1-4 uint128)
|
||||
(v1-5 uint128)
|
||||
(a0-2 uint128)
|
||||
(a1-2 uint128)
|
||||
(a2-1 uint128)
|
||||
(a3-1 uint128)
|
||||
(a3-3 uint128)
|
||||
(a3-4 uint128)
|
||||
(t0-1 uint128)
|
||||
(t0-2 uint128)
|
||||
(t1-0 uint128)
|
||||
(t2-1 uint128)
|
||||
(t2-2 uint128)
|
||||
(f31-0 none)
|
||||
)
|
||||
(zero uint128)
|
||||
(v1-3 uint128)
|
||||
(v1-4 uint128)
|
||||
(v1-5 uint128)
|
||||
(a0-2 uint128)
|
||||
(a1-2 uint128)
|
||||
(a2-1 uint128)
|
||||
(a3-1 uint128)
|
||||
(a3-3 uint128)
|
||||
(a3-4 uint128)
|
||||
(t0-1 uint128)
|
||||
(t0-2 uint128)
|
||||
(t1-0 uint128)
|
||||
(t2-1 uint128)
|
||||
(t2-2 uint128)
|
||||
(f31-0 none))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -101,86 +84,73 @@
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(let ((v1-0 (-> arg1 max-scale)))
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(let ((a3-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
|
||||
(nop!)
|
||||
(let ((t2-0 (the-as uint128 (-> arg1 origin vector4h 0 long))))
|
||||
(.pextlh a3-1 a3-0 zero)
|
||||
(let ((t0-0 (the-as uint128 (-> arg1 origin vector4h 1 long))))
|
||||
(.pw.sra t1-0 a3-1 10)
|
||||
(let ((a3-2 (the-as uint128 (-> arg1 origin vector4h 2 long))))
|
||||
(.pextlh t2-1 t2-0 zero)
|
||||
(.pw.sra t2-2 t2-1 16)
|
||||
(.pextlh t0-1 t0-0 zero)
|
||||
(.mov vf8 t1-0)
|
||||
(.pw.sra t0-2 t0-1 16)
|
||||
(.mov vf5 t2-2)
|
||||
(.pextlh a3-3 a3-2 zero)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(.mov vf6 t0-2)
|
||||
(.pw.sra a3-4 a3-3 16)
|
||||
(.lvf vf9 (&-> arg1 bsphere quad))
|
||||
(let ((v1-0 (-> arg1 max-scale)))
|
||||
(nop!)
|
||||
(let ((a3-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
|
||||
(nop!)
|
||||
(let ((t2-0 (the-as uint128 (-> arg1 origin vector4h 0 long))))
|
||||
(.pextlh a3-1 a3-0 zero)
|
||||
(let ((t0-0 (the-as uint128 (-> arg1 origin vector4h 1 long))))
|
||||
(.pw.sra t1-0 a3-1 10)
|
||||
(let ((a3-2 (the-as uint128 (-> arg1 origin vector4h 2 long))))
|
||||
(.pextlh t2-1 t2-0 zero)
|
||||
(.pw.sra t2-2 t2-1 16)
|
||||
(.pextlh t0-1 t0-0 zero)
|
||||
(.mov vf8 t1-0)
|
||||
(.pw.sra t0-2 t0-1 16)
|
||||
(.mov vf5 t2-2)
|
||||
(.pextlh a3-3 a3-2 zero)))))
|
||||
(.mov vf6 t0-2)
|
||||
(.pw.sra a3-4 a3-3 16)
|
||||
(.lvf vf9 (&-> arg1 bsphere quad))
|
||||
(nop!)
|
||||
(.mov vf7 a3-4)
|
||||
(nop!)
|
||||
(.mov vf10 v1-0))
|
||||
(.itof.vf vf8 vf8)
|
||||
(nop!)
|
||||
(.mov vf7 a3-4)
|
||||
(vitof12.xyzw vf5 vf5)
|
||||
(nop!)
|
||||
(.mov vf10 v1-0)
|
||||
)
|
||||
(.itof.vf vf8 vf8)
|
||||
(nop!)
|
||||
(vitof12.xyzw vf5 vf5)
|
||||
(nop!)
|
||||
(vitof12.xyzw vf6 vf6)
|
||||
(nop!)
|
||||
(vitof12.xyzw vf7 vf7)
|
||||
(nop!)
|
||||
(.add.vf vf8 vf8 vf9 :mask #b111)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(.lvf vf9 (&-> arg0 bsphere quad))
|
||||
(vitof12.xyzw vf10 vf10)
|
||||
(nop!)
|
||||
(.mul.w.vf vf10 vf10 vf9 :mask #b1)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf5 vf9)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf6 vf9 acc)
|
||||
(let ((v1-2 (-> arg2 min quad)))
|
||||
(.add.mul.z.vf acc vf7 vf9 acc)
|
||||
(let ((a1-1 (-> arg2 max quad)))
|
||||
(.add.mul.w.vf vf1 vf8 vf0 acc)
|
||||
(nop!)
|
||||
(.add.x.vf vf2 vf1 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.sub.x.vf vf1 vf1 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.ftoi.vf vf4 vf2)
|
||||
(nop!)
|
||||
(.ftoi.vf vf3 vf1)
|
||||
(nop!)
|
||||
(.mov a0-2 vf4)
|
||||
(nop!)
|
||||
(.mov a2-1 vf3)
|
||||
(nop!)
|
||||
(.pcgtw a1-2 a2-1 a1-1)
|
||||
)
|
||||
(.pcgtw v1-3 v1-2 a0-2)
|
||||
)
|
||||
(.por v1-4 a1-2 v1-3)
|
||||
(.ppach v1-5 zero v1-4)
|
||||
(let ((v1-6 (shl (the-as int v1-5) 16)))
|
||||
(vitof12.xyzw vf6 vf6)
|
||||
(nop!)
|
||||
(zero? v1-6)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vitof12.xyzw vf7 vf7)
|
||||
(nop!)
|
||||
(.add.vf vf8 vf8 vf9 :mask #b111)
|
||||
(nop!)
|
||||
(nop!)
|
||||
(.lvf vf9 (&-> arg0 bsphere quad))
|
||||
(vitof12.xyzw vf10 vf10)
|
||||
(nop!)
|
||||
(.mul.w.vf vf10 vf10 vf9 :mask #b1)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf5 vf9)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf6 vf9 acc)
|
||||
(let ((v1-2 (-> arg2 min quad)))
|
||||
(.add.mul.z.vf acc vf7 vf9 acc)
|
||||
(let ((a1-1 (-> arg2 max quad)))
|
||||
(.add.mul.w.vf vf1 vf8 vf0 acc)
|
||||
(nop!)
|
||||
(.add.x.vf vf2 vf1 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.sub.x.vf vf1 vf1 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.ftoi.vf vf4 vf2)
|
||||
(nop!)
|
||||
(.ftoi.vf vf3 vf1)
|
||||
(nop!)
|
||||
(.mov a0-2 vf4)
|
||||
(nop!)
|
||||
(.mov a2-1 vf3)
|
||||
(nop!)
|
||||
(.pcgtw a1-2 a2-1 a1-1))
|
||||
(.pcgtw v1-3 v1-2 a0-2))
|
||||
(.por v1-4 a1-2 v1-3)
|
||||
(.ppach v1-5 zero v1-4)
|
||||
(let ((v1-6 (shl (the-as int v1-5) 16))) (nop!) (zero? v1-6))))
|
||||
|
||||
;; definition for function instance-tfragment-add-debug-sphere
|
||||
;; Used lq/sq
|
||||
@@ -190,37 +160,25 @@
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf12 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(let ((v1-0 (the-as uint128 (-> arg1 origin vector4h 3 long))))
|
||||
(.pextlh v1-1 v1-0 r0-0)
|
||||
)
|
||||
(.lvf vf9 (&-> arg0 bsphere quad))
|
||||
(.pw.sra v1-2 v1-1 10)
|
||||
(.lvf vf10 (&-> arg1 bsphere quad))
|
||||
(nop!)
|
||||
(.mov vf12 v1-2)
|
||||
(.itof.vf vf12 vf12)
|
||||
(nop!)
|
||||
(.add.vf vf10 vf10 vf12 :mask #b111)
|
||||
(nop!)
|
||||
(.add.vf vf9 vf9 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.add.w.vf vf11 vf0 vf9 :mask #b1)
|
||||
(nop!)
|
||||
(.mov a3-0 vf11)
|
||||
(nop!)
|
||||
(let ((a2-0 (new-stack-vector0)))
|
||||
(.svf (&-> a2-0 quad) vf9)
|
||||
(add-debug-sphere
|
||||
#t
|
||||
(bucket-id debug)
|
||||
a2-0
|
||||
a3-0
|
||||
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vf9 :class vf))
|
||||
(init-vf0-vector)
|
||||
(nop!)
|
||||
(let ((v1-0 (the-as uint128 (-> arg1 origin vector4h 3 long)))) (.pextlh v1-1 v1-0 r0-0))
|
||||
(.lvf vf9 (&-> arg0 bsphere quad))
|
||||
(.pw.sra v1-2 v1-1 10)
|
||||
(.lvf vf10 (&-> arg1 bsphere quad))
|
||||
(nop!)
|
||||
(.mov vf12 v1-2)
|
||||
(.itof.vf vf12 vf12)
|
||||
(nop!)
|
||||
(.add.vf vf10 vf10 vf12 :mask #b111)
|
||||
(nop!)
|
||||
(.add.vf vf9 vf9 vf10 :mask #b111)
|
||||
(nop!)
|
||||
(.add.w.vf vf11 vf0 vf9 :mask #b1)
|
||||
(nop!)
|
||||
(.mov a3-0 vf11)
|
||||
(nop!)
|
||||
(let ((a2-0 (new-stack-vector0)))
|
||||
(.svf (&-> a2-0 quad) vf9)
|
||||
(add-debug-sphere #t (bucket-id debug) a2-0 a3-0 (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)))))
|
||||
@@ -1,13 +1,7 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/math.gc")
|
||||
|
||||
;; name: pat-h.gc
|
||||
;; name in dgo: pat-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defenum pat-material
|
||||
:type uint8
|
||||
(stone)
|
||||
@@ -32,15 +26,13 @@
|
||||
(swamp)
|
||||
(stopproj)
|
||||
(rotate)
|
||||
(neutral)
|
||||
)
|
||||
(neutral))
|
||||
|
||||
(defenum pat-mode
|
||||
:type uint8
|
||||
(ground)
|
||||
(wall)
|
||||
(obstacle)
|
||||
)
|
||||
(obstacle))
|
||||
|
||||
(defenum pat-event
|
||||
:type uint8
|
||||
@@ -50,8 +42,7 @@
|
||||
(burn)
|
||||
(deadlyup)
|
||||
(burnup)
|
||||
(melt)
|
||||
)
|
||||
(melt))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
@@ -59,65 +50,67 @@
|
||||
;; It packs all data into a 32-bit pat-surface type.
|
||||
|
||||
(deftype pat-surface (uint32)
|
||||
((skip uint8 :offset 0 :size 3)
|
||||
(mode pat-mode :offset 3 :size 3)
|
||||
(material pat-material :offset 6 :size 6)
|
||||
(camera uint8 :offset 12 :size 2)
|
||||
(event pat-event :offset 14 :size 6)
|
||||
(noentity uint8 :offset 0 :size 1)
|
||||
(nocamera uint8 :offset 1 :size 1)
|
||||
(noedge uint8 :offset 2 :size 1)
|
||||
(nolineofsight uint8 :offset 12 :size 1)
|
||||
(unknown-bit uint8 :offset 15 :size 1)
|
||||
)
|
||||
)
|
||||
((skip uint8 :offset 0 :size 3)
|
||||
(mode pat-mode :offset 3 :size 3)
|
||||
(material pat-material :offset 6 :size 6)
|
||||
(camera uint8 :offset 12 :size 2)
|
||||
(event pat-event :offset 14 :size 6)
|
||||
(noentity uint8 :offset 0 :size 1)
|
||||
(nocamera uint8 :offset 1 :size 1)
|
||||
(noedge uint8 :offset 2 :size 1)
|
||||
(nolineofsight uint8 :offset 12 :size 1)
|
||||
(unknown-bit uint8 :offset 15 :size 1)))
|
||||
|
||||
(defun-debug pat-material->string ((pat pat-surface))
|
||||
(enum->string pat-material (-> pat material))
|
||||
)
|
||||
(enum->string pat-material (-> pat material)))
|
||||
|
||||
(defun-debug pat-mode->string ((pat pat-surface))
|
||||
(enum->string pat-mode (-> pat mode))
|
||||
)
|
||||
(enum->string pat-mode (-> pat mode)))
|
||||
|
||||
(defun-debug pat-event->string ((pat pat-surface))
|
||||
(enum->string pat-event (-> pat event))
|
||||
)
|
||||
(enum->string pat-event (-> pat event)))
|
||||
|
||||
;; for debug drawing pat's by mode.
|
||||
(deftype pat-mode-info (structure)
|
||||
((name string)
|
||||
(wall-angle float)
|
||||
(color rgba)
|
||||
(hilite-color rgba)
|
||||
)
|
||||
)
|
||||
((name string)
|
||||
(wall-angle float)
|
||||
(color rgba)
|
||||
(hilite-color rgba)))
|
||||
|
||||
|
||||
(define *pat-mode-info* (new 'static 'inline-array pat-mode-info 4
|
||||
(new 'static 'pat-mode-info
|
||||
:name "ground"
|
||||
:wall-angle 0.2
|
||||
:color (new 'static 'rgba :r #x7f :a #x40)
|
||||
:hilite-color (new 'static 'rgba :r #xff :a #x80)
|
||||
)
|
||||
(new 'static 'pat-mode-info
|
||||
:name "wall"
|
||||
:wall-angle 2.0
|
||||
:color (new 'static 'rgba :b #x7f :a #x40)
|
||||
:hilite-color (new 'static 'rgba :b #xff :a #x80)
|
||||
)
|
||||
(new 'static 'pat-mode-info
|
||||
:name "obstacle"
|
||||
:wall-angle 0.82
|
||||
:color (new 'static 'rgba :r #x7f :b #x7f :a #x40)
|
||||
:hilite-color (new 'static 'rgba :r #xff :b #xff :a #x80)
|
||||
)
|
||||
(new 'static 'pat-mode-info
|
||||
:name "pole"
|
||||
:wall-angle 2.0
|
||||
:color (new 'static 'rgba :r #x7f :g #x7f :a #x40)
|
||||
:hilite-color (new 'static 'rgba :r #xff :g #xff :a #x80)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define *pat-mode-info*
|
||||
(new 'static
|
||||
'inline-array
|
||||
pat-mode-info
|
||||
4
|
||||
(new 'static
|
||||
'pat-mode-info
|
||||
:name "ground"
|
||||
:wall-angle 0.2
|
||||
:color
|
||||
(new 'static 'rgba :r #x7f :a #x40)
|
||||
:hilite-color
|
||||
(new 'static 'rgba :r #xff :a #x80))
|
||||
(new 'static
|
||||
'pat-mode-info
|
||||
:name "wall"
|
||||
:wall-angle 2.0
|
||||
:color
|
||||
(new 'static 'rgba :b #x7f :a #x40)
|
||||
:hilite-color
|
||||
(new 'static 'rgba :b #xff :a #x80))
|
||||
(new 'static
|
||||
'pat-mode-info
|
||||
:name "obstacle"
|
||||
:wall-angle 0.82
|
||||
:color
|
||||
(new 'static 'rgba :r #x7f :b #x7f :a #x40)
|
||||
:hilite-color
|
||||
(new 'static 'rgba :r #xff :b #xff :a #x80))
|
||||
(new 'static
|
||||
'pat-mode-info
|
||||
:name "pole"
|
||||
:wall-angle 2.0
|
||||
:color
|
||||
(new 'static 'rgba :r #x7f :g #x7f :a #x40)
|
||||
:hilite-color
|
||||
(new 'static 'rgba :r #xff :g #xff :a #x80))))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,250 +1,200 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/nav-enemy.gc")
|
||||
|
||||
;; name: babak.gc
|
||||
;; name in dgo: babak
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype babak (nav-enemy)
|
||||
()
|
||||
(deftype babak (nav-enemy) ()
|
||||
(:states
|
||||
babak-run-to-cannon
|
||||
)
|
||||
)
|
||||
babak-run-to-cannon))
|
||||
|
||||
|
||||
(defskelgroup *babak-sg* babak babak-lod0-jg -1
|
||||
((babak-lod0-mg (meters 20)) (babak-lod1-mg (meters 40)) (babak-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 2 0 3)
|
||||
:longest-edge (meters 1)
|
||||
:shadow babak-shadow-mg
|
||||
)
|
||||
(defskelgroup *babak-sg*
|
||||
babak
|
||||
babak-lod0-jg
|
||||
-1
|
||||
((babak-lod0-mg (meters 20)) (babak-lod1-mg (meters 40)) (babak-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 2 0 3)
|
||||
:longest-edge (meters 1)
|
||||
:shadow babak-shadow-mg)
|
||||
|
||||
(defstate nav-enemy-patrol (babak)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(cond
|
||||
((ja-group? babak-give-up-hop-ja)
|
||||
(ja-channel-push! 1 (seconds 0.15))
|
||||
(ja-no-eval :group! babak-walk-ja :num! (seek!) :frame-num (ja-aframe 12.0 0))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
)
|
||||
)
|
||||
((the-as (function none) (-> (method-of-type nav-enemy nav-enemy-patrol) code)))
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(cond
|
||||
((ja-group? babak-give-up-hop-ja)
|
||||
(ja-channel-push! 1 (seconds 0.15))
|
||||
(ja-no-eval :group! babak-walk-ja :num! (seek!) :frame-num (ja-aframe 12.0 0))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))))
|
||||
(else (ja-channel-push! 1 (seconds 0.2))))
|
||||
((the-as (function none) (-> (method-of-type nav-enemy nav-enemy-patrol) code)))))
|
||||
|
||||
(defstate nav-enemy-chase (babak)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.9 1.1)))
|
||||
(cond
|
||||
((ja-group? babak-jump-land-ja)
|
||||
(ja-no-eval :num! (seek!))
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info run-anim))
|
||||
:num! (seek! max f30-0)
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info run-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
)
|
||||
)
|
||||
(loop
|
||||
(suspend)
|
||||
(ja :num! (loop! f30-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.9 1.1)))
|
||||
(cond
|
||||
((ja-group? babak-jump-land-ja)
|
||||
(ja-no-eval :num! (seek!))
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info run-anim)) :num! (seek! max f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0))))
|
||||
(else
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info run-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)))
|
||||
(loop
|
||||
(suspend)
|
||||
(ja :num! (loop! f30-0))))))
|
||||
|
||||
(defstate nav-enemy-stare (babak)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(set! (-> self turn-time) (seconds 0.2))
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.8 1.2)))
|
||||
(when (or (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf8))
|
||||
(and (nav-enemy-player-vulnerable?) (nav-enemy-rnd-percent? 0.5))
|
||||
)
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! babak-win-ja :num! (seek! (ja-aframe 68.0 0) f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 68.0 0) f30-0))
|
||||
)
|
||||
)
|
||||
(loop
|
||||
(when (not (nav-enemy-facing-player? 2730.6667))
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel))
|
||||
(ja-no-eval :num! (loop!))
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja :group! babak-turn-ja)
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(until (nav-enemy-facing-player? 1820.4445)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (loop! 0.75))
|
||||
)
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel))
|
||||
)
|
||||
(if (not (ja-group? babak-idle-ja))
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
)
|
||||
(ja-no-eval :group! babak-idle-ja :num! (seek! max f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0))
|
||||
)
|
||||
(when (nav-enemy-rnd-percent? 0.3)
|
||||
:code
|
||||
(behavior ()
|
||||
(set! (-> self turn-time) (seconds 0.2))
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.8 1.2)))
|
||||
(when (or (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf8))
|
||||
(and (nav-enemy-player-vulnerable?) (nav-enemy-rnd-percent? 0.5)))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! babak-win-ja :num! (seek! (ja-aframe 68.0 0) f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 68.0 0) f30-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(ja :num! (seek! (ja-aframe 68.0 0) f30-0))))
|
||||
(loop
|
||||
(when (not (nav-enemy-facing-player? 2730.6667))
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel))
|
||||
(ja-no-eval :num! (loop!))
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja :group! babak-turn-ja)
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(until (nav-enemy-facing-player? 1820.4445)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (loop! 0.75)))
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags enable-travel)))
|
||||
(if (not (ja-group? babak-idle-ja)) (ja-channel-push! 1 (seconds 0.2)))
|
||||
(ja-no-eval :group! babak-idle-ja :num! (seek! max f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max f30-0)))
|
||||
(when (nav-enemy-rnd-percent? 0.3)
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! babak-win-ja :num! (seek! (ja-aframe 68.0 0) f30-0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 68.0 0) f30-0))))))))
|
||||
|
||||
(defstate nav-enemy-give-up (babak)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(set! (-> self rotate-speed) 218453.33)
|
||||
(set! (-> self turn-time) (seconds 0.5))
|
||||
(ja-channel-push! 1 (seconds 0.15))
|
||||
(let ((s4-0 (-> self collide-info))
|
||||
(s5-0 (target-pos 0))
|
||||
)
|
||||
(when (< (fabs
|
||||
(deg-diff (y-angle s4-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s5-0 (-> s4-0 trans))))
|
||||
)
|
||||
12743.111
|
||||
)
|
||||
(ja-no-eval :group! babak-give-up-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
)
|
||||
(logclear! (-> self nav flags) (nav-control-flags navcf17 navcf19))
|
||||
(nav-enemy-get-new-patrol-point)
|
||||
(ja-no-eval :group! babak-give-up-hop-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek-to-point-toward-point!
|
||||
(-> self collide-info)
|
||||
(-> self nav destination-pos)
|
||||
(-> self rotate-speed)
|
||||
(-> self turn-time)
|
||||
)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(set! (-> self rotate-speed) 218453.33)
|
||||
(set! (-> self turn-time) (seconds 0.5))
|
||||
(ja-channel-push! 1 (seconds 0.15))
|
||||
(let ((s4-0 (-> self collide-info))
|
||||
(s5-0 (target-pos 0)))
|
||||
(when (< (fabs (deg-diff (y-angle s4-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s5-0 (-> s4-0 trans)))))
|
||||
12743.111)
|
||||
(ja-no-eval :group! babak-give-up-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!)))))
|
||||
(logclear! (-> self nav flags) (nav-control-flags navcf17 navcf19))
|
||||
(nav-enemy-get-new-patrol-point)
|
||||
(ja-no-eval :group! babak-give-up-hop-ja :num! (seek!) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek-to-point-toward-point! (-> self collide-info)
|
||||
(-> self nav destination-pos)
|
||||
(-> self rotate-speed)
|
||||
(-> self turn-time))
|
||||
(suspend)
|
||||
(ja :num! (seek!)))
|
||||
(go-virtual nav-enemy-patrol)))
|
||||
|
||||
(defstate nav-enemy-jump-land (babak)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(ja-no-eval :num! (seek!))
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info jump-land-anim))
|
||||
:num! (seek! (ja-aframe 32.0 0) 0.5)
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 32.0 0) 0.5))
|
||||
)
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-no-eval :num! (seek!))
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(ja-no-eval :group!
|
||||
(-> self draw art-group data (-> self nav-info jump-land-anim))
|
||||
:num!
|
||||
(seek! (ja-aframe 32.0 0) 0.5)
|
||||
:frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(ja-blend-eval)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 32.0 0) 0.5)))
|
||||
(go-virtual nav-enemy-chase)))
|
||||
|
||||
(define *babak-nav-enemy-info* (new 'static 'nav-enemy-info
|
||||
:idle-anim 5
|
||||
:walk-anim 6
|
||||
:turn-anim 16
|
||||
:notice-anim 7
|
||||
:run-anim 8
|
||||
:jump-anim 13
|
||||
:jump-land-anim 14
|
||||
:victory-anim 11
|
||||
:taunt-anim 11
|
||||
:die-anim 12
|
||||
:neck-joint 5
|
||||
:player-look-at-joint 5
|
||||
:run-travel-speed (meters 6)
|
||||
:run-rotate-speed (degrees 2880)
|
||||
:run-acceleration (meters 1)
|
||||
:run-turn-time (seconds 0.1)
|
||||
:walk-travel-speed (meters 3)
|
||||
:walk-rotate-speed (degrees 720)
|
||||
:walk-acceleration (meters 1)
|
||||
:walk-turn-time (seconds 0.5)
|
||||
:attack-shove-back (meters 3)
|
||||
:attack-shove-up (meters 2)
|
||||
:shadow-size (meters 2)
|
||||
:notice-nav-radius (meters 2)
|
||||
:nav-nearest-y-threshold (meters 10)
|
||||
:notice-distance (meters 30)
|
||||
:proximity-notice-distance (meters 20)
|
||||
:stop-chase-distance (meters 40)
|
||||
:frustration-distance (meters 8)
|
||||
:frustration-time (seconds 4)
|
||||
:die-anim-hold-frame 24.0
|
||||
:jump-anim-start-frame 10.0
|
||||
:jump-land-anim-end-frame 10000000000.0
|
||||
:jump-height-min (meters 3)
|
||||
:jump-height-factor 0.5
|
||||
:jump-start-anim-speed 1.0
|
||||
:shadow-max-y (meters 1)
|
||||
:shadow-min-y (meters -1)
|
||||
:shadow-locus-dist (meters 150)
|
||||
:use-align #t
|
||||
:draw-shadow #t
|
||||
:move-to-ground #t
|
||||
:hover-if-no-ground #f
|
||||
:use-momentum #f
|
||||
:use-flee #t
|
||||
:use-proximity-notice #t
|
||||
:use-jump-blocked #t
|
||||
:use-jump-patrol #f
|
||||
:gnd-collide-with (collide-kind background)
|
||||
:debug-draw-neck #f
|
||||
:debug-draw-jump #f
|
||||
)
|
||||
)
|
||||
(define *babak-nav-enemy-info*
|
||||
(new 'static
|
||||
'nav-enemy-info
|
||||
:idle-anim 5
|
||||
:walk-anim 6
|
||||
:turn-anim 16
|
||||
:notice-anim 7
|
||||
:run-anim 8
|
||||
:jump-anim 13
|
||||
:jump-land-anim 14
|
||||
:victory-anim 11
|
||||
:taunt-anim 11
|
||||
:die-anim 12
|
||||
:neck-joint 5
|
||||
:player-look-at-joint 5
|
||||
:run-travel-speed (meters 6)
|
||||
:run-rotate-speed (degrees 2880)
|
||||
:run-acceleration (meters 1)
|
||||
:run-turn-time (seconds 0.1)
|
||||
:walk-travel-speed (meters 3)
|
||||
:walk-rotate-speed (degrees 720)
|
||||
:walk-acceleration (meters 1)
|
||||
:walk-turn-time (seconds 0.5)
|
||||
:attack-shove-back (meters 3)
|
||||
:attack-shove-up (meters 2)
|
||||
:shadow-size (meters 2)
|
||||
:notice-nav-radius (meters 2)
|
||||
:nav-nearest-y-threshold (meters 10)
|
||||
:notice-distance (meters 30)
|
||||
:proximity-notice-distance (meters 20)
|
||||
:stop-chase-distance (meters 40)
|
||||
:frustration-distance (meters 8)
|
||||
:frustration-time (seconds 4)
|
||||
:die-anim-hold-frame 24.0
|
||||
:jump-anim-start-frame 10.0
|
||||
:jump-land-anim-end-frame 10000000000.0
|
||||
:jump-height-min (meters 3)
|
||||
:jump-height-factor 0.5
|
||||
:jump-start-anim-speed 1.0
|
||||
:shadow-max-y (meters 1)
|
||||
:shadow-min-y (meters -1)
|
||||
:shadow-locus-dist (meters 150)
|
||||
:use-align #t
|
||||
:draw-shadow #t
|
||||
:move-to-ground #t
|
||||
:hover-if-no-ground #f
|
||||
:use-momentum #f
|
||||
:use-flee #t
|
||||
:use-proximity-notice #t
|
||||
:use-jump-blocked #t
|
||||
:use-jump-patrol #f
|
||||
:gnd-collide-with (collide-kind background)
|
||||
:debug-draw-neck #f
|
||||
:debug-draw-jump #f))
|
||||
|
||||
(defmethod initialize-collision ((this babak))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0)))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> s4-0 collide-with) (collide-kind target))
|
||||
@@ -257,33 +207,27 @@
|
||||
(set! (-> s3-0 prim-core action) (collide-action solid))
|
||||
(set! (-> s3-0 prim-core offense) (collide-offense touch))
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 4096.0 0.0 3072.0)
|
||||
(append-prim s4-0 s3-0)
|
||||
)
|
||||
(append-prim s4-0 s3-0))
|
||||
(let ((s3-1 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 3))))
|
||||
(set! (-> s3-1 prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> s3-1 collide-with) (collide-kind target))
|
||||
(set! (-> s3-1 prim-core action) (collide-action solid))
|
||||
(set! (-> s3-1 prim-core offense) (collide-offense touch))
|
||||
(set-vector! (-> s3-1 local-sphere) 0.0 9830.4 0.0 3072.0)
|
||||
(append-prim s4-0 s3-1)
|
||||
)
|
||||
(append-prim s4-0 s3-1))
|
||||
(let ((s3-2 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 1))))
|
||||
(set! (-> s3-2 prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> s3-2 collide-with) (collide-kind target))
|
||||
(set! (-> s3-2 prim-core offense) (collide-offense normal-attack))
|
||||
(set! (-> s3-2 transform-index) 6)
|
||||
(set-vector! (-> s3-2 local-sphere) 0.0 0.0 0.0 2048.0)
|
||||
(append-prim s4-0 s3-2)
|
||||
)
|
||||
)
|
||||
(append-prim s4-0 s3-2)))
|
||||
(set! (-> s5-0 nav-radius) 6144.0)
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> s5-0 max-iteration-count) (the-as uint 2))
|
||||
(set! (-> this collide-info) s5-0)
|
||||
)
|
||||
(set! (-> this collide-info) s5-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod nav-enemy-method-48 ((this babak))
|
||||
(initialize-skeleton this *babak-sg* '())
|
||||
@@ -292,23 +236,14 @@
|
||||
(set! (-> this neck nose) (the-as uint 1))
|
||||
(set! (-> this neck ear) (the-as uint 2))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod nav-enemy-method-59 ((this babak))
|
||||
(cond
|
||||
((and (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
(logtest? (-> this enemy-info options) (fact-options has-power-cell))
|
||||
)
|
||||
(go (method-of-object this nav-enemy-fuel-cell))
|
||||
)
|
||||
((logtest? (-> this enemy-info options) (fact-options fop5))
|
||||
(go (method-of-object this nav-enemy-wait-for-cue))
|
||||
)
|
||||
(else
|
||||
(go (method-of-object this nav-enemy-idle))
|
||||
)
|
||||
)
|
||||
(logtest? (-> this enemy-info options) (fact-options has-power-cell)))
|
||||
(go (method-of-object this nav-enemy-fuel-cell)))
|
||||
((logtest? (-> this enemy-info options) (fact-options fop5)) (go (method-of-object this nav-enemy-wait-for-cue)))
|
||||
(else (go (method-of-object this nav-enemy-idle))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
@@ -1,284 +1,191 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/generic-obs.gc")
|
||||
(require "engine/target/logic-target.gc")
|
||||
|
||||
;; name: basebutton.gc
|
||||
;; name in dgo: basebutton
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype basebutton (process-drawable)
|
||||
((root collide-shape-moving :override)
|
||||
(down? symbol)
|
||||
(spawned-by-other? symbol)
|
||||
(move-to? symbol)
|
||||
(notify-actor entity-actor)
|
||||
(timeout float)
|
||||
(button-id int32)
|
||||
(event-going-down symbol)
|
||||
(event-down symbol)
|
||||
(event-going-up symbol)
|
||||
(event-up symbol)
|
||||
(anim-speed float)
|
||||
(move-to-pos vector :inline)
|
||||
(move-to-quat quaternion :inline)
|
||||
)
|
||||
((root collide-shape-moving :override)
|
||||
(down? symbol)
|
||||
(spawned-by-other? symbol)
|
||||
(move-to? symbol)
|
||||
(notify-actor entity-actor)
|
||||
(timeout float)
|
||||
(button-id int32)
|
||||
(event-going-down symbol)
|
||||
(event-down symbol)
|
||||
(event-going-up symbol)
|
||||
(event-up symbol)
|
||||
(anim-speed float)
|
||||
(move-to-pos vector :inline)
|
||||
(move-to-quat quaternion :inline))
|
||||
(:state-methods
|
||||
basebutton-down-idle
|
||||
basebutton-going-down
|
||||
basebutton-going-up
|
||||
basebutton-startup
|
||||
basebutton-up-idle
|
||||
)
|
||||
basebutton-down-idle
|
||||
basebutton-going-down
|
||||
basebutton-going-up
|
||||
basebutton-startup
|
||||
basebutton-up-idle)
|
||||
(:methods
|
||||
(reset! (_type_) float)
|
||||
(basebutton-method-26 (_type_) none)
|
||||
(basebutton-method-27 (_type_) collide-shape-moving)
|
||||
(arm-trigger-event! (_type_) symbol)
|
||||
(basebutton-method-29 (_type_ symbol entity) none)
|
||||
(move-to-vec-or-quat! (_type_ vector quaternion) quaternion)
|
||||
(press! (_type_ symbol) int)
|
||||
)
|
||||
)
|
||||
(reset! (_type_) float)
|
||||
(basebutton-method-26 (_type_) none)
|
||||
(basebutton-method-27 (_type_) collide-shape-moving)
|
||||
(arm-trigger-event! (_type_) symbol)
|
||||
(basebutton-method-29 (_type_ symbol entity) none)
|
||||
(move-to-vec-or-quat! (_type_ vector quaternion) quaternion)
|
||||
(press! (_type_ symbol) int)))
|
||||
|
||||
|
||||
(defskelgroup *generic-button-sg* generic-button generic-button-lod0-jg generic-button-idle-ja
|
||||
((generic-button-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3)
|
||||
)
|
||||
(defskelgroup *generic-button-sg*
|
||||
generic-button
|
||||
generic-button-lod0-jg
|
||||
generic-button-idle-ja
|
||||
((generic-button-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3))
|
||||
|
||||
(defmethod move-to-vec-or-quat! ((this basebutton) (arg0 vector) (arg1 quaternion))
|
||||
(set! (-> this move-to?) #t)
|
||||
(if arg0
|
||||
(set! (-> this move-to-pos quad) (-> arg0 quad))
|
||||
(set! (-> this move-to-pos quad) (-> this root trans quad))
|
||||
)
|
||||
(if arg1
|
||||
(quaternion-copy! (-> this move-to-quat) arg1)
|
||||
(quaternion-copy! (-> this move-to-quat) (-> this root quat))
|
||||
)
|
||||
)
|
||||
(if arg0 (set! (-> this move-to-pos quad) (-> arg0 quad)) (set! (-> this move-to-pos quad) (-> this root trans quad)))
|
||||
(if arg1 (quaternion-copy! (-> this move-to-quat) arg1) (quaternion-copy! (-> this move-to-quat) (-> this root quat))))
|
||||
|
||||
(defstate basebutton-startup (basebutton)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(if (-> self down?)
|
||||
(go-virtual basebutton-down-idle)
|
||||
(go-virtual basebutton-up-idle)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(if (-> self down?) (go-virtual basebutton-down-idle) (go-virtual basebutton-up-idle))))
|
||||
|
||||
(defstate basebutton-up-idle (basebutton)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('attack)
|
||||
(case (-> block param 1)
|
||||
(('flop)
|
||||
(basebutton-method-29 self (-> self event-going-down) (-> self notify-actor))
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-down)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('trigger)
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-down)
|
||||
)
|
||||
(('move-to)
|
||||
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(press! self #f)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (-> self move-to?)
|
||||
(rider-trans)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('attack)
|
||||
(case (-> block param 1)
|
||||
(('flop)
|
||||
(basebutton-method-29 self (-> self event-going-down) (-> self notify-actor))
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-down))))
|
||||
(('trigger) (sound-play "silo-button") (go-virtual basebutton-going-down))
|
||||
(('move-to) (move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1))))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(press! self #f))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (-> self move-to?) (rider-trans)))
|
||||
:code anim-loop
|
||||
:post (behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
(rider-post)
|
||||
)
|
||||
)
|
||||
)
|
||||
:post
|
||||
(behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
(rider-post))))
|
||||
|
||||
(defstate basebutton-going-down (basebutton)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('untrigger)
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-up)
|
||||
)
|
||||
(('move-to)
|
||||
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(press! self #t)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('untrigger) (sound-play "silo-button") (go-virtual basebutton-going-up))
|
||||
(('move-to) (move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1))))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(press! self #t))
|
||||
:trans rider-trans
|
||||
:code (behavior ()
|
||||
(ja-no-eval :num! (seek! max (-> self anim-speed)))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
)
|
||||
(basebutton-method-29 self (-> self event-down) (-> self notify-actor))
|
||||
(go-virtual basebutton-down-idle)
|
||||
)
|
||||
:post (behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
)
|
||||
(rider-post)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-no-eval :num! (seek! max (-> self anim-speed)))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed))))
|
||||
(basebutton-method-29 self (-> self event-down) (-> self notify-actor))
|
||||
(go-virtual basebutton-down-idle))
|
||||
:post
|
||||
(behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat)))
|
||||
(rider-post)))
|
||||
|
||||
(defstate basebutton-down-idle (basebutton)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('untrigger)
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-up)
|
||||
)
|
||||
(('move-to)
|
||||
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(press! self #t)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (-> self move-to?)
|
||||
(rider-trans)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(cond
|
||||
((= (-> self timeout) 0.0)
|
||||
(anim-loop)
|
||||
)
|
||||
(else
|
||||
(until (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self timeout))))
|
||||
(suspend)
|
||||
)
|
||||
(basebutton-method-29 self (-> self event-going-up) (-> self notify-actor))
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-up)
|
||||
)
|
||||
)
|
||||
)
|
||||
:post (behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
(rider-post)
|
||||
)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('untrigger) (sound-play "silo-button") (go-virtual basebutton-going-up))
|
||||
(('move-to) (move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1))))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(press! self #t))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (-> self move-to?) (rider-trans)))
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(cond
|
||||
((= (-> self timeout) 0.0) (anim-loop))
|
||||
(else
|
||||
(until (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self timeout))))
|
||||
(suspend))
|
||||
(basebutton-method-29 self (-> self event-going-up) (-> self notify-actor))
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-up))))
|
||||
:post
|
||||
(behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
(rider-post))))
|
||||
|
||||
(defstate basebutton-going-up (basebutton)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('move-to)
|
||||
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
||||
)
|
||||
(('trigger)
|
||||
(sound-play "silo-button")
|
||||
(go-virtual basebutton-going-down)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(press! self #f)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('move-to) (move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1))))
|
||||
(('trigger) (sound-play "silo-button") (go-virtual basebutton-going-down))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(press! self #f))
|
||||
:trans rider-trans
|
||||
:code (behavior ()
|
||||
(ja-no-eval :num! (seek! 0.0 (-> self anim-speed)))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! 0.0 (-> self anim-speed)))
|
||||
)
|
||||
(basebutton-method-29 self (-> self event-up) (-> self notify-actor))
|
||||
(go-virtual basebutton-up-idle)
|
||||
)
|
||||
:post (behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
||||
)
|
||||
(rider-post)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-no-eval :num! (seek! 0.0 (-> self anim-speed)))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! 0.0 (-> self anim-speed))))
|
||||
(basebutton-method-29 self (-> self event-up) (-> self notify-actor))
|
||||
(go-virtual basebutton-up-idle))
|
||||
:post
|
||||
(behavior ()
|
||||
(when (-> self move-to?)
|
||||
(set! (-> self move-to?) #f)
|
||||
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
||||
(quaternion-copy! (-> self root quat) (-> self move-to-quat)))
|
||||
(rider-post)))
|
||||
|
||||
(defmethod press! ((this basebutton) (arg0 symbol))
|
||||
(set! (-> this down?) arg0)
|
||||
(cond
|
||||
(arg0
|
||||
(if (not (-> this spawned-by-other?))
|
||||
(process-entity-status! this (entity-perm-status complete) #t)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (not (-> this spawned-by-other?))
|
||||
(process-entity-status! this (entity-perm-status complete) #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(arg0 (if (not (-> this spawned-by-other?)) (process-entity-status! this (entity-perm-status complete) #t)))
|
||||
(else (if (not (-> this spawned-by-other?)) (process-entity-status! this (entity-perm-status complete) #f)))))
|
||||
|
||||
(defmethod basebutton-method-29 ((this basebutton) (arg0 symbol) (arg1 entity))
|
||||
(with-pp
|
||||
(when arg0
|
||||
(cond
|
||||
(arg1
|
||||
(let ((v1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> v1-0 from) pp)
|
||||
(set! (-> v1-0 num-params) 0)
|
||||
(set! (-> v1-0 message) arg0)
|
||||
(let ((a1-1 arg1))
|
||||
(send-event-function
|
||||
(if a1-1
|
||||
(-> a1-1 extra process)
|
||||
)
|
||||
v1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (nonzero? (-> this link))
|
||||
(send-to-all (-> this link) arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
(let ((v1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> v1-0 from) pp)
|
||||
(set! (-> v1-0 num-params) 0)
|
||||
(set! (-> v1-0 message) arg0)
|
||||
(let ((a1-1 arg1)) (send-event-function (if a1-1 (-> a1-1 extra process)) v1-0))))
|
||||
(else (if (nonzero? (-> this link)) (send-to-all (-> this link) arg0)))))
|
||||
(none)))
|
||||
|
||||
(defmethod reset! ((this basebutton))
|
||||
(set! (-> this down?) #f)
|
||||
@@ -290,15 +197,10 @@
|
||||
(set! (-> this event-down) #f)
|
||||
(set! (-> this event-going-up) #f)
|
||||
(set! (-> this event-up) #f)
|
||||
(set! (-> this anim-speed) 1.0)
|
||||
)
|
||||
(set! (-> this anim-speed) 1.0))
|
||||
|
||||
(defmethod arm-trigger-event! ((this basebutton))
|
||||
(let ((v0-0 'trigger))
|
||||
(set! (-> this event-going-down) v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(let ((v0-0 'trigger)) (set! (-> this event-going-down) v0-0) v0-0))
|
||||
|
||||
(defmethod basebutton-method-26 ((this basebutton))
|
||||
(initialize-skeleton this *generic-button-sg* '())
|
||||
@@ -307,40 +209,22 @@
|
||||
(cond
|
||||
((-> this down?)
|
||||
(let ((s5-0 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval!
|
||||
s5-0
|
||||
(the-as art-joint-anim (-> this draw art-group data 2))
|
||||
num-func-identity
|
||||
)
|
||||
(set! (-> s5-0 frame-num)
|
||||
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 2)) data 0 length) -1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(joint-control-channel-group-eval! s5-0 (the-as art-joint-anim (-> this draw art-group data 2)) num-func-identity)
|
||||
(set! (-> s5-0 frame-num) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 2)) data 0 length) -1)))))
|
||||
(else
|
||||
(let ((s5-1 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval!
|
||||
s5-1
|
||||
(the-as art-joint-anim (-> this draw art-group data 2))
|
||||
num-func-identity
|
||||
)
|
||||
(set! (-> s5-1 frame-num) 0.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s5-1 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval! s5-1 (the-as art-joint-anim (-> this draw art-group data 2)) num-func-identity)
|
||||
(set! (-> s5-1 frame-num) 0.0))))
|
||||
(set! (-> this anim-speed) 2.0)
|
||||
(update-transforms! (-> this root))
|
||||
(ja-post)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod basebutton-method-27 ((this basebutton))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s5-0 1)
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
||||
@@ -355,8 +239,7 @@
|
||||
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s3-0 transform-index) 4)
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 12288.0)
|
||||
(append-prim s4-0 s3-0)
|
||||
)
|
||||
(append-prim s4-0 s3-0))
|
||||
(let ((s3-1 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0))))
|
||||
(set! (-> s3-1 prim-core collide-as) (collide-kind ground-object))
|
||||
(set! (-> s3-1 collide-with) (collide-kind target))
|
||||
@@ -364,49 +247,33 @@
|
||||
(set! (-> s3-1 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s3-1 transform-index) 3)
|
||||
(set-vector! (-> s3-1 local-sphere) 0.0 0.0 0.0 12288.0)
|
||||
(append-prim s4-0 s3-1)
|
||||
)
|
||||
)
|
||||
(append-prim s4-0 s3-1)))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root) s5-0)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
s5-0))
|
||||
|
||||
(defmethod init-from-entity! ((this basebutton) (arg0 entity-actor))
|
||||
(reset! this)
|
||||
(set! (-> this spawned-by-other?) #f)
|
||||
(set! (-> this button-id) -1)
|
||||
(let ((v1-4 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1))))
|
||||
(if (>= (the-as int v1-4) 0)
|
||||
(set! (-> this button-id) (the-as int v1-4))
|
||||
)
|
||||
)
|
||||
(if (>= (the-as int v1-4) 0) (set! (-> this button-id) (the-as int v1-4))))
|
||||
(when (or (res-lump-struct arg0 'next-actor structure) (res-lump-struct arg0 'prev-actor structure))
|
||||
(set! (-> this link) (new 'process 'actor-link-info this))
|
||||
(if (< (-> this button-id) 0)
|
||||
(set! (-> this button-id) (actor-count-before (-> this link)))
|
||||
)
|
||||
)
|
||||
(if (< (-> this button-id) 0) (set! (-> this button-id) (actor-count-before (-> this link)))))
|
||||
(basebutton-method-27 this)
|
||||
(process-drawable-from-entity! this arg0)
|
||||
(let ((v1-16 #f))
|
||||
(if (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
(set! v1-16 #t)
|
||||
)
|
||||
(set! (-> this down?) v1-16)
|
||||
)
|
||||
(if (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete))) (set! v1-16 #t))
|
||||
(set! (-> this down?) v1-16))
|
||||
(set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0))
|
||||
(set! (-> this timeout) (res-lump-float arg0 'timeout))
|
||||
(if (not (-> this spawned-by-other?))
|
||||
(nav-mesh-connect this (-> this root) (the-as nav-control #f))
|
||||
)
|
||||
(if (not (-> this spawned-by-other?)) (nav-mesh-connect this (-> this root) (the-as nav-control #f)))
|
||||
(arm-trigger-event! this)
|
||||
(basebutton-method-26 this)
|
||||
(go (method-of-object this basebutton-startup))
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior basebutton-init-by-other basebutton ((arg0 entity-actor) (arg1 vector) (arg2 quaternion) (arg3 entity-actor) (arg4 symbol) (arg5 float))
|
||||
(reset! self)
|
||||
@@ -415,9 +282,7 @@
|
||||
(set! (-> self down?) arg4)
|
||||
(set! (-> self notify-actor) arg3)
|
||||
(set! (-> self timeout) arg5)
|
||||
(if arg0
|
||||
(set! (-> self entity) arg0)
|
||||
)
|
||||
(if arg0 (set! (-> self entity) arg0))
|
||||
(basebutton-method-27 self)
|
||||
(set! (-> self root trans quad) (-> arg1 quad))
|
||||
(quaternion-copy! (-> self root quat) arg2)
|
||||
@@ -425,228 +290,167 @@
|
||||
(arm-trigger-event! self)
|
||||
(basebutton-method-26 self)
|
||||
(go-virtual basebutton-startup)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(define *warp-info* (new 'static 'boxed-array :type string
|
||||
"training-warp"
|
||||
"village1-warp"
|
||||
"village2-warp"
|
||||
"village3-warp"
|
||||
"citadel-warp"
|
||||
)
|
||||
)
|
||||
(define *warp-info*
|
||||
(new 'static 'boxed-array :type string "training-warp" "village1-warp" "village2-warp" "village3-warp" "citadel-warp"))
|
||||
|
||||
(deftype warp-gate (process-drawable)
|
||||
((level symbol)
|
||||
(level-slot int32)
|
||||
(min-slot int32)
|
||||
(max-slot int32)
|
||||
)
|
||||
((level symbol)
|
||||
(level-slot int32)
|
||||
(min-slot int32)
|
||||
(max-slot int32))
|
||||
(:state-methods
|
||||
idle
|
||||
active
|
||||
(use int level)
|
||||
hidden
|
||||
)
|
||||
)
|
||||
|
||||
idle
|
||||
active
|
||||
(use int level)
|
||||
hidden))
|
||||
|
||||
(defstate use (warp-gate)
|
||||
:virtual #t
|
||||
:trans (behavior ()
|
||||
(send-event *camera* 'joystick 0.0 0.0)
|
||||
)
|
||||
:code (behavior ((arg0 int) (arg1 level))
|
||||
(set-time! (-> self state-time))
|
||||
(when (not arg1)
|
||||
(process-release? *target*)
|
||||
(go-virtual idle)
|
||||
)
|
||||
(let ((s4-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> s4-0 from) self)
|
||||
(set! (-> s4-0 num-params) 3)
|
||||
(set! (-> s4-0 message) 'change-state)
|
||||
(set! (-> s4-0 param 0) (the-as uint target-warp-out))
|
||||
(let ((v1-9 (new 'static 'vector)))
|
||||
(set! (-> v1-9 quad) (-> self root trans quad))
|
||||
(set! (-> s4-0 param 1) (the-as uint v1-9))
|
||||
)
|
||||
(set! (-> s4-0 param 2) (the-as uint (target-pos 0)))
|
||||
(send-event-function *target* s4-0)
|
||||
)
|
||||
;; og:preserve-this
|
||||
;; NOTE : added case for "training" here. in the original game, the training level does NOT come
|
||||
;; with its own code for warp gates and buttons, and uses the villagep-obs imported from village1
|
||||
;; instead. opengoal loads files different enough that warp from training to anywhere except village1
|
||||
;; crashes the game due to running unlinked code. the original game also crashes, but it is not consistent.
|
||||
;; the citadel/lavatube case makes it so we wait until it's safe to unload both levels in the heaps,
|
||||
;; since the citadel warp gate is located in both levels at once (visually lavatube, technically citadel)
|
||||
;; we add "training" to the list here so that the training warp gate waits until it's safe to
|
||||
;; dispose the old code from memory.
|
||||
(case (-> self level)
|
||||
(('citadel 'lavatube 'training)
|
||||
(while (and *target* (not (logtest? (-> *target* draw status) (draw-status hidden))))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(load-state-want-levels (-> self level) (-> arg1 load-name))
|
||||
(while (or (not (member (level-status *level* (-> arg1 load-name)) '(loaded active)))
|
||||
(not (time-elapsed? (-> self state-time) (seconds 2)))
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set-blackout-frames (seconds 0.05))
|
||||
(start 'play (get-continue-by-name *game-info* (-> *warp-info* arg0)))
|
||||
(logior! (-> self mask) (process-mask sleep))
|
||||
(suspend)
|
||||
0
|
||||
)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(send-event *camera* 'joystick 0.0 0.0))
|
||||
:code
|
||||
(behavior ((arg0 int) (arg1 level))
|
||||
(set-time! (-> self state-time))
|
||||
(when (not arg1)
|
||||
(process-release? *target*)
|
||||
(go-virtual idle))
|
||||
(let ((s4-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> s4-0 from) self)
|
||||
(set! (-> s4-0 num-params) 3)
|
||||
(set! (-> s4-0 message) 'change-state)
|
||||
(set! (-> s4-0 param 0) (the-as uint target-warp-out))
|
||||
(let ((v1-9 (new 'static 'vector)))
|
||||
(set! (-> v1-9 quad) (-> self root trans quad))
|
||||
(set! (-> s4-0 param 1) (the-as uint v1-9)))
|
||||
(set! (-> s4-0 param 2) (the-as uint (target-pos 0)))
|
||||
(send-event-function *target* s4-0))
|
||||
;; og:preserve-this
|
||||
;; NOTE : added case for "training" here. in the original game, the training level does NOT come
|
||||
;; with its own code for warp gates and buttons, and uses the villagep-obs imported from village1
|
||||
;; instead. opengoal loads files different enough that warp from training to anywhere except village1
|
||||
;; crashes the game due to running unlinked code. the original game also crashes, but it is not consistent.
|
||||
;; the citadel/lavatube case makes it so we wait until it's safe to unload both levels in the heaps,
|
||||
;; since the citadel warp gate is located in both levels at once (visually lavatube, technically citadel)
|
||||
;; we add "training" to the list here so that the training warp gate waits until it's safe to
|
||||
;; dispose the old code from memory.
|
||||
(case (-> self level)
|
||||
(('citadel 'lavatube 'training)
|
||||
(while (and *target* (not (logtest? (-> *target* draw status) (draw-status hidden))))
|
||||
(suspend)))
|
||||
(else
|
||||
(load-state-want-levels (-> self level) (-> arg1 load-name))
|
||||
(while (or (not (member (level-status *level* (-> arg1 load-name)) '(loaded active)))
|
||||
(not (time-elapsed? (-> self state-time) (seconds 2))))
|
||||
(suspend))))
|
||||
(set-blackout-frames (seconds 0.05))
|
||||
(start 'play (get-continue-by-name *game-info* (-> *warp-info* arg0)))
|
||||
(logior! (-> self mask) (process-mask sleep))
|
||||
(suspend)
|
||||
0))
|
||||
|
||||
(define *warp-jump-mods* (new 'static 'surface
|
||||
:name 'jump
|
||||
:turnv 273066.66
|
||||
:turnvv 1820444.5
|
||||
:tiltv 32768.0
|
||||
:tiltvv 131072.0
|
||||
:transv-max 65536.0
|
||||
:target-speed 65536.0
|
||||
:slip-factor 1.0
|
||||
:slide-factor 1.0
|
||||
:slope-up-factor 1.0
|
||||
:slope-down-factor 1.0
|
||||
:slope-slip-angle 1.0
|
||||
:impact-fric 1.0
|
||||
:bend-factor 1.0
|
||||
:bend-speed 1.0
|
||||
:alignv 1.0
|
||||
:slope-up-traction 1.0
|
||||
:align-speed 1.0
|
||||
:mode 'air
|
||||
:flags (surface-flags always-rotate-toward-transv)
|
||||
)
|
||||
)
|
||||
(define *warp-jump-mods*
|
||||
(new 'static
|
||||
'surface
|
||||
:name 'jump
|
||||
:turnv 273066.66
|
||||
:turnvv 1820444.5
|
||||
:tiltv 32768.0
|
||||
:tiltvv 131072.0
|
||||
:transv-max 65536.0
|
||||
:target-speed 65536.0
|
||||
:slip-factor 1.0
|
||||
:slide-factor 1.0
|
||||
:slope-up-factor 1.0
|
||||
:slope-down-factor 1.0
|
||||
:slope-slip-angle 1.0
|
||||
:impact-fric 1.0
|
||||
:bend-factor 1.0
|
||||
:bend-speed 1.0
|
||||
:alignv 1.0
|
||||
:slope-up-traction 1.0
|
||||
:align-speed 1.0
|
||||
:mode 'air
|
||||
:flags (surface-flags always-rotate-toward-transv)))
|
||||
|
||||
(defstate target-warp-out (target)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('death-end)
|
||||
(let ((v0-0 (the-as object (logior (-> self draw status) (draw-status hidden)))))
|
||||
(set! (-> self draw status) (the-as draw-status v0-0))
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(else
|
||||
(target-generic-event-handler proc argc message block)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ((arg0 vector) (arg1 vector))
|
||||
(set-time! (-> self state-time))
|
||||
(logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf))
|
||||
(set! (-> self control unknown-surface00) *warp-jump-mods*)
|
||||
(set! (-> self control unknown-vector102 quad) (-> arg0 quad))
|
||||
(set! (-> self control unknown-vector103 quad) (-> arg1 quad))
|
||||
(+! (-> self control unknown-vector102 y) -4096.0)
|
||||
(set! (-> self control unknown-uint20) (the-as uint #f))
|
||||
(vector-reset! (-> self control transv))
|
||||
(logior! (-> self state-flags) (state-flags use-alt-cam-pos))
|
||||
(set! (-> self alt-cam-pos quad) (-> arg1 quad))
|
||||
)
|
||||
:exit (behavior ()
|
||||
(logclear! (-> self state-flags) (state-flags use-alt-cam-pos))
|
||||
)
|
||||
:code (behavior ((arg0 vector) (arg1 vector))
|
||||
(send-event *camera* 'change-state cam-fixed 0)
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 16.0 0)))
|
||||
)
|
||||
(vector-! (-> self control transv) (-> self control unknown-vector102) (-> self control trans))
|
||||
(vector-xz-normalize! (-> self control transv) 32768.0)
|
||||
(let ((gp-2 (new-stack-vector0)))
|
||||
(let ((f0-6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
|
||||
0.0
|
||||
(vector-! gp-2 (-> self control transv) (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-6))
|
||||
)
|
||||
(let* ((f0-7 (vector-length gp-2))
|
||||
(f1-1 f0-7)
|
||||
(f2-4
|
||||
(- (sqrtf
|
||||
(* 2.0
|
||||
(-> self control dynam gravity-length)
|
||||
(vector-dot
|
||||
(-> self control dynam gravity-normal)
|
||||
(vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector102) (-> self control trans))
|
||||
)
|
||||
)
|
||||
)
|
||||
(* 0.008333334 (- (-> self control dynam gravity-length)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector+!
|
||||
(-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-4)
|
||||
(vector-float*! gp-2 gp-2 (/ f0-7 f1-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(clear-collide-with-as (-> self control))
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> self trans-hook)
|
||||
(lambda :behavior target
|
||||
()
|
||||
(let ((gp-0 (new-stack-vector0))
|
||||
(f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
|
||||
)
|
||||
0.0
|
||||
(vector-! gp-0 (-> self control transv) (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0))
|
||||
(let* ((f0-3 (vector-length gp-0))
|
||||
(f1-0 f0-3)
|
||||
)
|
||||
(if (< f30-0 0.0)
|
||||
(set! f30-0 8192.0)
|
||||
)
|
||||
(vector+!
|
||||
(-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f30-0)
|
||||
(vector-float*! gp-0 gp-0 (/ f0-3 f1-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((gp-2 (vector-! (new-stack-vector0) (-> self control unknown-vector102) (-> self control trans))))
|
||||
(set! (-> gp-2 y) 0.0)
|
||||
(send-event *target* 'sidekick #f)
|
||||
(when (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) (-> self control unknown-spoolanim00))
|
||||
(time-elapsed? (-> self state-time) (seconds 0.05))
|
||||
)
|
||||
(vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (seconds-per-frame)))
|
||||
(set! (-> self control transv x) (* 0.95 (-> self control transv x)))
|
||||
(set! (-> self control transv z) (* 0.95 (-> self control transv z)))
|
||||
(when (not (-> self control unknown-spoolanim00))
|
||||
(send-event self 'do-effect 'death-warp-out -1.0)
|
||||
(let ((v0-2 #t))
|
||||
(set! (-> self control unknown-uint20) (the-as uint v0-2))
|
||||
v0-2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 40.0 0)) :frame-num (ja-aframe 16.0 0))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 40.0 0)))
|
||||
)
|
||||
(anim-loop)
|
||||
)
|
||||
:post target-no-stick-post
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('death-end)
|
||||
(let ((v0-0 (the-as object (logior (-> self draw status) (draw-status hidden)))))
|
||||
(set! (-> self draw status) (the-as draw-status v0-0))
|
||||
v0-0))
|
||||
(else (target-generic-event-handler proc argc message block))))
|
||||
:enter
|
||||
(behavior ((arg0 vector) (arg1 vector))
|
||||
(set-time! (-> self state-time))
|
||||
(logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf))
|
||||
(set! (-> self control unknown-surface00) *warp-jump-mods*)
|
||||
(set! (-> self control unknown-vector102 quad) (-> arg0 quad))
|
||||
(set! (-> self control unknown-vector103 quad) (-> arg1 quad))
|
||||
(+! (-> self control unknown-vector102 y) -4096.0)
|
||||
(set! (-> self control unknown-uint20) (the-as uint #f))
|
||||
(vector-reset! (-> self control transv))
|
||||
(logior! (-> self state-flags) (state-flags use-alt-cam-pos))
|
||||
(set! (-> self alt-cam-pos quad) (-> arg1 quad)))
|
||||
:exit
|
||||
(behavior ()
|
||||
(logclear! (-> self state-flags) (state-flags use-alt-cam-pos)))
|
||||
:code
|
||||
(behavior ((arg0 vector) (arg1 vector))
|
||||
(send-event *camera* 'change-state cam-fixed 0)
|
||||
(ja-channel-push! 1 (seconds 0.2))
|
||||
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 16.0 0))))
|
||||
(vector-! (-> self control transv) (-> self control unknown-vector102) (-> self control trans))
|
||||
(vector-xz-normalize! (-> self control transv) 32768.0)
|
||||
(let ((gp-2 (new-stack-vector0)))
|
||||
(let ((f0-6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
|
||||
0.0
|
||||
(vector-! gp-2 (-> self control transv) (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-6)))
|
||||
(let* ((f0-7 (vector-length gp-2))
|
||||
(f1-1 f0-7)
|
||||
(f2-4 (- (sqrtf (* 2.0
|
||||
(-> self control dynam gravity-length)
|
||||
(vector-dot (-> self control dynam gravity-normal)
|
||||
(vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector102) (-> self control trans)))))
|
||||
(* 0.008333334 (- (-> self control dynam gravity-length))))))
|
||||
(vector+! (-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-4)
|
||||
(vector-float*! gp-2 gp-2 (/ f0-7 f1-1)))))
|
||||
(clear-collide-with-as (-> self control))
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> self trans-hook)
|
||||
(lambda :behavior target ()
|
||||
(let ((gp-0 (new-stack-vector0))
|
||||
(f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
|
||||
0.0
|
||||
(vector-! gp-0 (-> self control transv) (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0))
|
||||
(let* ((f0-3 (vector-length gp-0))
|
||||
(f1-0 f0-3))
|
||||
(if (< f30-0 0.0) (set! f30-0 8192.0))
|
||||
(vector+! (-> self control transv)
|
||||
(vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f30-0)
|
||||
(vector-float*! gp-0 gp-0 (/ f0-3 f1-0)))))
|
||||
(let ((gp-2 (vector-! (new-stack-vector0) (-> self control unknown-vector102) (-> self control trans))))
|
||||
(set! (-> gp-2 y) 0.0)
|
||||
(send-event *target* 'sidekick #f)
|
||||
(when (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) (-> self control unknown-spoolanim00))
|
||||
(time-elapsed? (-> self state-time) (seconds 0.05)))
|
||||
(vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (seconds-per-frame)))
|
||||
(set! (-> self control transv x) (* 0.95 (-> self control transv x)))
|
||||
(set! (-> self control transv z) (* 0.95 (-> self control transv z)))
|
||||
(when (not (-> self control unknown-spoolanim00))
|
||||
(send-event self 'do-effect 'death-warp-out -1.0)
|
||||
(let ((v0-2 #t)) (set! (-> self control unknown-uint20) (the-as uint v0-2)) v0-2))))))
|
||||
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 40.0 0)) :frame-num (ja-aframe 16.0 0))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 40.0 0))))
|
||||
(anim-loop))
|
||||
:post target-no-stick-post)
|
||||
@@ -1,14 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/generic-obs.gc")
|
||||
(require "engine/game/projectiles.gc")
|
||||
|
||||
;; name: baseplat.gc
|
||||
;; name in dgo: baseplat
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
(defenum eco-door-flags
|
||||
:bitfield #t
|
||||
:type int32
|
||||
@@ -43,36 +37,30 @@
|
||||
(ecdf28)
|
||||
(ecdf29)
|
||||
(ecdf30)
|
||||
(ecdf31)
|
||||
)
|
||||
(ecdf31))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype baseplat (process-drawable)
|
||||
((root collide-shape-moving :override)
|
||||
(smush smush-control :inline)
|
||||
(basetrans vector :inline)
|
||||
(bouncing symbol)
|
||||
)
|
||||
((root collide-shape-moving :override)
|
||||
(smush smush-control :inline)
|
||||
(basetrans vector :inline)
|
||||
(bouncing symbol))
|
||||
(:methods
|
||||
(baseplat-method-20 (_type_) none)
|
||||
(baseplat-method-21 (_type_) none)
|
||||
(baseplat-method-22 (_type_) none)
|
||||
(get-unlit-skel (_type_) skeleton-group)
|
||||
(baseplat-method-24 (_type_) none)
|
||||
(baseplat-method-25 (_type_) sparticle-launch-group)
|
||||
(baseplat-method-26 (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(baseplat-method-20 (_type_) none)
|
||||
(baseplat-method-21 (_type_) none)
|
||||
(baseplat-method-22 (_type_) none)
|
||||
(get-unlit-skel (_type_) skeleton-group)
|
||||
(baseplat-method-24 (_type_) none)
|
||||
(baseplat-method-25 (_type_) sparticle-launch-group)
|
||||
(baseplat-method-26 (_type_) none)))
|
||||
|
||||
(defmethod baseplat-method-21 ((this baseplat))
|
||||
(logior! (-> this skel status) (janim-status inited))
|
||||
(set! (-> this basetrans quad) (-> this root trans quad))
|
||||
(set! (-> this bouncing) #f)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod baseplat-method-22 ((this baseplat))
|
||||
(activate! (-> this smush) -1.0 60 150 1.0 1.0)
|
||||
@@ -80,8 +68,7 @@
|
||||
(logclear! (-> this mask) (process-mask sleep))
|
||||
(logclear! (-> this mask) (process-mask sleep-code))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior plat-code baseplat ()
|
||||
(transform-post)
|
||||
@@ -92,14 +79,10 @@
|
||||
(when (not (-> self bouncing))
|
||||
(logior! (-> self mask) (process-mask sleep))
|
||||
(suspend)
|
||||
0
|
||||
)
|
||||
0)
|
||||
(while (-> self bouncing)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(suspend)))
|
||||
(none))
|
||||
|
||||
(defbehavior plat-trans baseplat ()
|
||||
(rider-trans)
|
||||
@@ -108,216 +91,147 @@
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> gp-0 quad) (-> self basetrans quad))
|
||||
(+! (-> gp-0 y) (* 819.2 (update! (-> self smush))))
|
||||
(move-to-point! (-> self root) gp-0)
|
||||
)
|
||||
(if (not (!= (-> self smush amp) 0.0))
|
||||
(set! (-> self bouncing) #f)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(move-to-point! (-> self root) (-> self basetrans))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(move-to-point! (-> self root) gp-0))
|
||||
(if (not (!= (-> self smush amp) 0.0)) (set! (-> self bouncing) #f)))
|
||||
(else (move-to-point! (-> self root) (-> self basetrans))))
|
||||
(none))
|
||||
|
||||
(defbehavior plat-post baseplat ()
|
||||
(baseplat-method-20 self)
|
||||
(rider-post)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod baseplat-method-25 ((this baseplat))
|
||||
(the-as sparticle-launch-group 0)
|
||||
)
|
||||
(the-as sparticle-launch-group 0))
|
||||
|
||||
(defmethod baseplat-method-20 ((this baseplat))
|
||||
(if (nonzero? (-> this part))
|
||||
(spawn (-> this part) (-> this root trans))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(if (nonzero? (-> this part)) (spawn (-> this part) (-> this root trans)))
|
||||
(none))
|
||||
|
||||
(defbehavior plat-event baseplat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
(('bonk)
|
||||
(baseplat-method-22 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(('bonk) (baseplat-method-22 self))))
|
||||
|
||||
(deftype eco-door (process-drawable)
|
||||
((root collide-shape :override)
|
||||
(speed float)
|
||||
(open-distance float)
|
||||
(close-distance float)
|
||||
(out-dir vector :inline)
|
||||
(open-sound sound-name)
|
||||
(close-sound sound-name)
|
||||
(state-actor entity-actor)
|
||||
(flags eco-door-flags)
|
||||
(locked symbol)
|
||||
(auto-close symbol)
|
||||
(one-way symbol)
|
||||
)
|
||||
((root collide-shape :override)
|
||||
(speed float)
|
||||
(open-distance float)
|
||||
(close-distance float)
|
||||
(out-dir vector :inline)
|
||||
(open-sound sound-name)
|
||||
(close-sound sound-name)
|
||||
(state-actor entity-actor)
|
||||
(flags eco-door-flags)
|
||||
(locked symbol)
|
||||
(auto-close symbol)
|
||||
(one-way symbol))
|
||||
(:state-methods
|
||||
door-closed
|
||||
door-opening
|
||||
door-open
|
||||
door-closing
|
||||
)
|
||||
door-closed
|
||||
door-opening
|
||||
door-open
|
||||
door-closing)
|
||||
(:methods
|
||||
(eco-door-method-24 (_type_) none)
|
||||
(eco-door-method-25 (_type_) none)
|
||||
(eco-door-method-26 (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(eco-door-method-24 (_type_) none)
|
||||
(eco-door-method-25 (_type_) none)
|
||||
(eco-door-method-26 (_type_) none)))
|
||||
|
||||
(defbehavior eco-door-event-handler eco-door ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
(('trigger)
|
||||
(set! (-> self locked) (not (-> self locked)))
|
||||
(cond
|
||||
((-> self locked)
|
||||
(if (= (-> self next-state name) 'door-closed)
|
||||
(sound-play "door-lock")
|
||||
)
|
||||
)
|
||||
(else
|
||||
(sound-play "door-unlock")
|
||||
)
|
||||
)
|
||||
#t
|
||||
)
|
||||
)
|
||||
)
|
||||
((-> self locked) (if (= (-> self next-state name) 'door-closed) (sound-play "door-lock")))
|
||||
(else (sound-play "door-unlock")))
|
||||
#t)))
|
||||
|
||||
eco-door-event-handler
|
||||
|
||||
(defstate door-closed (eco-door)
|
||||
:virtual #t
|
||||
:event eco-door-event-handler
|
||||
:code (behavior ()
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(suspend)
|
||||
(update-transforms! (-> self root))
|
||||
(ja-post)
|
||||
(loop
|
||||
(when (and *target*
|
||||
(>= (-> self open-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
(eco-door-method-26 self)
|
||||
(if (and (not (-> self locked))
|
||||
(or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(and (-> self one-way) (< (vector4-dot (-> self out-dir) (target-pos 0)) -8192.0))
|
||||
)
|
||||
)
|
||||
(go-virtual door-opening)
|
||||
)
|
||||
(level-hint-spawn (text-id zero) (the-as string #f) (-> self entity) *entity-pool* (game-task none))
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(update-transforms! (-> self root))
|
||||
(ja-post)
|
||||
(loop
|
||||
(when (and *target* (>= (-> self open-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))))
|
||||
(eco-door-method-26 self)
|
||||
(if (and (not (-> self locked))
|
||||
(or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(and (-> self one-way) (< (vector4-dot (-> self out-dir) (target-pos 0)) -8192.0))))
|
||||
(go-virtual door-opening))
|
||||
(level-hint-spawn (text-id zero) (the-as string #f) (-> self entity) *entity-pool* (game-task none)))
|
||||
(suspend))))
|
||||
|
||||
(defstate door-opening (eco-door)
|
||||
:virtual #t
|
||||
:event eco-door-event-handler
|
||||
:code (behavior ()
|
||||
(let ((gp-0
|
||||
(and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete))))
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
)
|
||||
)
|
||||
)
|
||||
(if gp-0
|
||||
(sound-play "blue-eco-on" :position (the-as symbol (-> self root trans)))
|
||||
)
|
||||
(sound-play-by-name (-> self open-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
|
||||
(clear-collide-with-as (-> self root))
|
||||
(until (ja-done? 0)
|
||||
(ja :num! (seek! max (-> self speed)))
|
||||
(if (and gp-0 (rand-vu-percent? 0.5))
|
||||
(spawn-projectile-blue *target*)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(go-virtual door-open)
|
||||
)
|
||||
:post transform-post
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((gp-0 (and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete))))
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue)))))
|
||||
(if gp-0 (sound-play "blue-eco-on" :position (the-as symbol (-> self root trans))))
|
||||
(sound-play-by-name (-> self open-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
|
||||
(clear-collide-with-as (-> self root))
|
||||
(until (ja-done? 0)
|
||||
(ja :num! (seek! max (-> self speed)))
|
||||
(if (and gp-0 (rand-vu-percent? 0.5)) (spawn-projectile-blue *target*))
|
||||
(suspend)))
|
||||
(go-virtual door-open))
|
||||
:post transform-post)
|
||||
|
||||
(defstate door-open (eco-door)
|
||||
:virtual #t
|
||||
:event eco-door-event-handler
|
||||
:code (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(clear-collide-with-as (-> self root))
|
||||
(ja :num-func num-func-identity :frame-num max)
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(suspend)
|
||||
(update-transforms! (-> self root))
|
||||
(ja-post)
|
||||
(loop
|
||||
(let ((f30-0 (vector4-dot (-> self out-dir) (target-pos 0)))
|
||||
(f28-0 (vector4-dot (-> self out-dir) (camera-pos)))
|
||||
)
|
||||
(when (and (-> self auto-close)
|
||||
(or (not *target*)
|
||||
(< (-> self close-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
)
|
||||
(if (and (>= (* f30-0 f28-0) 0.0) (< 16384.0 (fabs f28-0)))
|
||||
(go-virtual door-closing)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(clear-collide-with-as (-> self root))
|
||||
(ja :num-func num-func-identity :frame-num max)
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
(update-transforms! (-> self root))
|
||||
(ja-post)
|
||||
(loop
|
||||
(let ((f30-0 (vector4-dot (-> self out-dir) (target-pos 0)))
|
||||
(f28-0 (vector4-dot (-> self out-dir) (camera-pos))))
|
||||
(when (and (-> self auto-close)
|
||||
(or (not *target*)
|
||||
(< (-> self close-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans)))))
|
||||
(if (and (>= (* f30-0 f28-0) 0.0) (< 16384.0 (fabs f28-0))) (go-virtual door-closing))))
|
||||
(suspend))))
|
||||
|
||||
(defstate door-closing (eco-door)
|
||||
:virtual #t
|
||||
:event eco-door-event-handler
|
||||
:code (behavior ()
|
||||
(restore-collide-with-as (-> self root))
|
||||
(logclear! (-> self draw status) (draw-status hidden))
|
||||
(let ((gp-0 (new 'stack 'overlaps-others-params)))
|
||||
(set! (-> gp-0 options) (the-as uint 1))
|
||||
(set! (-> gp-0 tlist) #f)
|
||||
(while (find-overlapping-shapes (-> self root) gp-0)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(sound-play-by-name (-> self close-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
|
||||
(until (ja-done? 0)
|
||||
(ja :num! (seek! 0.0 (-> self speed)))
|
||||
(suspend)
|
||||
)
|
||||
(if (-> self locked)
|
||||
(sound-play "door-lock")
|
||||
)
|
||||
(go-virtual door-closed)
|
||||
)
|
||||
:post transform-post
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(restore-collide-with-as (-> self root))
|
||||
(logclear! (-> self draw status) (draw-status hidden))
|
||||
(let ((gp-0 (new 'stack 'overlaps-others-params)))
|
||||
(set! (-> gp-0 options) (the-as uint 1))
|
||||
(set! (-> gp-0 tlist) #f)
|
||||
(while (find-overlapping-shapes (-> self root) gp-0)
|
||||
(suspend)))
|
||||
(sound-play-by-name (-> self close-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
|
||||
(until (ja-done? 0)
|
||||
(ja :num! (seek! 0.0 (-> self speed)))
|
||||
(suspend))
|
||||
(if (-> self locked) (sound-play "door-lock"))
|
||||
(go-virtual door-closed))
|
||||
:post transform-post)
|
||||
|
||||
(defmethod eco-door-method-26 ((this eco-door))
|
||||
(when (-> this state-actor)
|
||||
(if (logtest? (-> this state-actor extra perm status) (entity-perm-status complete))
|
||||
(set! (-> this locked) (logtest? (-> this flags) (eco-door-flags ecdf01)))
|
||||
(set! (-> this locked) (logtest? (-> this flags) (eco-door-flags ecdf00)))
|
||||
)
|
||||
)
|
||||
(set! (-> this locked) (logtest? (-> this flags) (eco-door-flags ecdf01)))
|
||||
(set! (-> this locked) (logtest? (-> this flags) (eco-door-flags ecdf00)))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod eco-door-method-24 ((this eco-door))
|
||||
(let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
|
||||
@@ -328,36 +242,27 @@ eco-door-event-handler
|
||||
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s4-0 transform-index) 0)
|
||||
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 16384.0)
|
||||
(set-root-prim! s5-0 s4-0)
|
||||
)
|
||||
(set-root-prim! s5-0 s4-0))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root) s5-0)
|
||||
)
|
||||
(set! (-> this root) s5-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod eco-door-method-25 ((this eco-door))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod init-from-entity! ((this eco-door) (arg0 entity-actor))
|
||||
(eco-door-method-24 this)
|
||||
(process-drawable-from-entity! this arg0)
|
||||
(let ((f0-0 (res-lump-float (-> this entity) 'scale :default 1.0)))
|
||||
(set-vector! (-> this root scale) f0-0 f0-0 f0-0 1.0)
|
||||
)
|
||||
(set-vector! (-> this root scale) f0-0 f0-0 f0-0 1.0))
|
||||
(set! (-> this open-distance) 32768.0)
|
||||
(set! (-> this close-distance) 49152.0)
|
||||
(set! (-> this speed) 1.0)
|
||||
(set! (-> this state-actor) #f)
|
||||
(let ((v1-5 (entity-actor-lookup arg0 'state-actor 0)))
|
||||
(if v1-5
|
||||
(set! (-> this state-actor) v1-5)
|
||||
)
|
||||
)
|
||||
(let ((v1-5 (entity-actor-lookup arg0 'state-actor 0))) (if v1-5 (set! (-> this state-actor) v1-5)))
|
||||
(set! (-> this locked) #f)
|
||||
(set! (-> this flags) (res-lump-value arg0 'flags eco-door-flags))
|
||||
(eco-door-method-26 this)
|
||||
@@ -369,10 +274,7 @@ eco-door-event-handler
|
||||
(eco-door-method-25 this)
|
||||
(if (and (not (-> this auto-close))
|
||||
(-> this entity)
|
||||
(logtest? (-> this entity extra perm status) (entity-perm-status complete))
|
||||
)
|
||||
(go (method-of-object this door-open))
|
||||
(go (method-of-object this door-closed))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
(go (method-of-object this door-open))
|
||||
(go (method-of-object this door-closed)))
|
||||
(none))
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,116 +1,111 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/water-anim.gc")
|
||||
|
||||
;; name: dark-eco-pool.gc
|
||||
;; name in dgo: dark-eco-pool
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype dark-eco-pool (water-anim)
|
||||
()
|
||||
)
|
||||
(deftype dark-eco-pool (water-anim) ())
|
||||
|
||||
|
||||
(define ripple-for-misty-dark-eco-pool (new 'static 'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 3.0
|
||||
:wave (new 'static 'inline-array ripple-wave 4
|
||||
(new 'static 'ripple-wave :scale 40.0 :xdiv 2 :speed 0.5)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -2 :zdiv 2 :speed 2.0)
|
||||
(new 'static 'ripple-wave :scale 3.0 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define ripple-for-misty-dark-eco-pool
|
||||
(new 'static
|
||||
'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 3.0
|
||||
:wave
|
||||
(new 'static
|
||||
'inline-array
|
||||
ripple-wave
|
||||
4
|
||||
(new 'static 'ripple-wave :scale 40.0 :xdiv 2 :speed 0.5)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -2 :zdiv 2 :speed 2.0)
|
||||
(new 'static 'ripple-wave :scale 3.0 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave))))
|
||||
|
||||
(define ripple-for-maincave-dark-eco-pool
|
||||
(new 'static 'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 8.57
|
||||
:wave (new 'static 'inline-array ripple-wave 4
|
||||
(new 'static 'ripple-wave :scale 14.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 5.25 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 0.7 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave)
|
||||
)
|
||||
)
|
||||
)
|
||||
(new 'static
|
||||
'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 8.57
|
||||
:wave
|
||||
(new 'static
|
||||
'inline-array
|
||||
ripple-wave
|
||||
4
|
||||
(new 'static 'ripple-wave :scale 14.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 5.25 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 0.7 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave))))
|
||||
|
||||
(define ripple-for-finalboss-dark-eco-pool
|
||||
(new 'static 'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 4.0
|
||||
:wave (new 'static 'inline-array ripple-wave 4
|
||||
(new 'static 'ripple-wave :scale 25.0 :xdiv 2 :speed -2.0)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -2 :zdiv 2 :speed 3.0)
|
||||
(new 'static 'ripple-wave :scale 4.0 :xdiv 5 :zdiv 3 :speed 4.0)
|
||||
(new 'static 'ripple-wave)
|
||||
)
|
||||
)
|
||||
)
|
||||
(new 'static
|
||||
'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 4.0
|
||||
:wave
|
||||
(new 'static
|
||||
'inline-array
|
||||
ripple-wave
|
||||
4
|
||||
(new 'static 'ripple-wave :scale 25.0 :xdiv 2 :speed -2.0)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -2 :zdiv 2 :speed 3.0)
|
||||
(new 'static 'ripple-wave :scale 4.0 :xdiv 5 :zdiv 3 :speed 4.0)
|
||||
(new 'static 'ripple-wave))))
|
||||
|
||||
(define ripple-for-dark-eco-pool (new 'static 'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 3.0
|
||||
:wave (new 'static 'inline-array ripple-wave 4
|
||||
(new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 2.0 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave)
|
||||
)
|
||||
)
|
||||
)
|
||||
(define ripple-for-dark-eco-pool
|
||||
(new 'static
|
||||
'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 3.0
|
||||
:wave
|
||||
(new 'static
|
||||
'inline-array
|
||||
ripple-wave
|
||||
4
|
||||
(new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 2.0 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave))))
|
||||
|
||||
(define ripple-for-sunken-dark-eco-helix-room
|
||||
(new 'static 'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 8.0
|
||||
:wave (new 'static 'inline-array ripple-wave 4
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 5.625 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 0.75 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave)
|
||||
)
|
||||
)
|
||||
)
|
||||
(new 'static
|
||||
'ripple-wave-set
|
||||
:count 3
|
||||
:converted #f
|
||||
:normal-scale 8.0
|
||||
:wave
|
||||
(new 'static
|
||||
'inline-array
|
||||
ripple-wave
|
||||
4
|
||||
(new 'static 'ripple-wave :scale 15.0 :xdiv 1 :speed 1.0)
|
||||
(new 'static 'ripple-wave :scale 5.625 :xdiv -1 :zdiv 1 :speed 4.0)
|
||||
(new 'static 'ripple-wave :scale 0.75 :xdiv 5 :zdiv 3 :speed 2.0)
|
||||
(new 'static 'ripple-wave))))
|
||||
|
||||
(defmethod water-vol-method-25 ((this dark-eco-pool))
|
||||
(let ((t9-0 (method-of-type water-anim water-vol-method-25)))
|
||||
(t9-0 this)
|
||||
)
|
||||
(let ((t9-0 (method-of-type water-anim water-vol-method-25))) (t9-0 this))
|
||||
(logclear! (-> this flags) (water-flags wt23))
|
||||
(logior! (-> this flags) (water-flags wt24))
|
||||
(set! (-> this attack-event)
|
||||
(the-as symbol ((the-as
|
||||
(function res-lump symbol symbol float structure (pointer res-tag) pointer object)
|
||||
(method-of-type res-lump get-property-struct)
|
||||
)
|
||||
(-> this entity)
|
||||
'attack-event
|
||||
'interp
|
||||
-1000000000.0
|
||||
'dark-eco-pool
|
||||
(the-as (pointer res-tag) #f)
|
||||
*res-static-buf*
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(the-as symbol
|
||||
((the-as (function res-lump symbol symbol float structure (pointer res-tag) pointer object)
|
||||
(method-of-type res-lump get-property-struct))
|
||||
(-> this entity)
|
||||
'attack-event
|
||||
'interp
|
||||
-1000000000.0
|
||||
'dark-eco-pool
|
||||
(the-as (pointer res-tag) #f)
|
||||
*res-static-buf*)))
|
||||
(none))
|
||||
|
||||
(defmethod water-vol-method-22 ((this dark-eco-pool))
|
||||
(let ((t9-0 (method-of-type water-anim water-vol-method-22)))
|
||||
(t9-0 this)
|
||||
)
|
||||
(let ((t9-0 (method-of-type water-anim water-vol-method-22))) (t9-0 this))
|
||||
(let ((gp-0 (new 'process 'ripple-control)))
|
||||
(set! (-> this draw ripple) gp-0)
|
||||
(set! (-> gp-0 global-scale) 3072.0)
|
||||
@@ -119,53 +114,39 @@
|
||||
(set! (-> gp-0 waveform) ripple-for-dark-eco-pool)
|
||||
(set! (-> gp-0 query) (new 'process 'ripple-merc-query 100))
|
||||
(case (-> this look)
|
||||
((32)
|
||||
(set! (-> gp-0 waveform) ripple-for-misty-dark-eco-pool)
|
||||
)
|
||||
((15 16 17 18 19 20)
|
||||
(set! (-> gp-0 waveform) ripple-for-maincave-dark-eco-pool)
|
||||
)
|
||||
((40)
|
||||
(set! (-> gp-0 waveform) ripple-for-sunken-dark-eco-helix-room)
|
||||
)
|
||||
((41)
|
||||
(set! (-> gp-0 waveform) ripple-for-finalboss-dark-eco-pool)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
((32) (set! (-> gp-0 waveform) ripple-for-misty-dark-eco-pool))
|
||||
((15 16 17 18 19 20) (set! (-> gp-0 waveform) ripple-for-maincave-dark-eco-pool))
|
||||
((40) (set! (-> gp-0 waveform) ripple-for-sunken-dark-eco-helix-room))
|
||||
((41) (set! (-> gp-0 waveform) ripple-for-finalboss-dark-eco-pool))))
|
||||
(none))
|
||||
|
||||
(defpartgroup group-dark-eco-nasty
|
||||
:id 444
|
||||
:flags (use-local-clock)
|
||||
:bounds (static-bspherem 0 0 0 8)
|
||||
:parts ((sp-item 2020 :fade-after (meters 50)))
|
||||
)
|
||||
:parts ((sp-item 2020 :fade-after (meters 50))))
|
||||
|
||||
(defpart 2020
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0))
|
||||
(:scale-x (meters 1) (meters 4))
|
||||
(:scale-y (meters 0.25))
|
||||
(:r 255.0)
|
||||
(:g 255.0)
|
||||
(:b 255.0)
|
||||
(:a 96.0 32.0)
|
||||
(:scalevel-x (meters 0.1875))
|
||||
(:scalevel-y (meters -0.001875))
|
||||
(:fade-a -3.2)
|
||||
(:timer (seconds 0.035))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.05))
|
||||
(:next-launcher 2021)
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0))
|
||||
(:scale-x (meters 1) (meters 4))
|
||||
(:scale-y (meters 0.25))
|
||||
(:r 255.0)
|
||||
(:g 255.0)
|
||||
(:b 255.0)
|
||||
(:a 96.0 32.0)
|
||||
(:scalevel-x (meters 0.1875))
|
||||
(:scalevel-y (meters -0.001875))
|
||||
(:fade-a -3.2)
|
||||
(:timer (seconds 0.035))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.05))
|
||||
(:next-launcher 2021)))
|
||||
|
||||
(defpart 2021
|
||||
:init-specs ((:r 255.0) (:g 128.0 128.0) (:b 0.0) (:fade-a -1.28))
|
||||
)
|
||||
:init-specs ((:r 255.0) (:g 128.0 128.0) (:b 0.0) (:fade-a -1.28)))
|
||||
|
||||
(defpartgroup group-dark-eco-pool-nasty
|
||||
:id 445
|
||||
@@ -173,211 +154,189 @@
|
||||
:linger-duration (seconds 2)
|
||||
:flags (use-local-clock)
|
||||
:bounds (static-bspherem 0 0 0 12)
|
||||
:parts ((sp-item 2056 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017))
|
||||
(sp-item 2057 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017) :binding 2052)
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2058 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017) :binding 2054)
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
)
|
||||
)
|
||||
:parts
|
||||
((sp-item 2056 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017))
|
||||
(sp-item 2057 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017) :binding 2052)
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2052 :flags (start-dead launch-asap) :binding 2053)
|
||||
(sp-item 2053 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2058 :fade-after (meters 100) :period (seconds 2) :length (seconds 0.017) :binding 2054)
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
|
||||
(sp-item 2054 :flags (start-dead launch-asap) :binding 2055)
|
||||
(sp-item 2055 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))))
|
||||
|
||||
(defpart 2056
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 8))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 0.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 64.0)
|
||||
(:fade-a -1.8285716)
|
||||
(:timer (seconds 0.18))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 8))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 0.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 64.0)
|
||||
(:fade-a -1.8285716)
|
||||
(:timer (seconds 0.18))
|
||||
(:flags (bit2 bit3 bit14))))
|
||||
|
||||
(defpart 2057
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0 6.0)
|
||||
(:y (meters 1))
|
||||
(:scale-x (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:a 0.0)
|
||||
(:vel-y (meters 0.04) (meters 0.02))
|
||||
(:accel-y (meters -0.00083333335))
|
||||
(:friction 0.94)
|
||||
(:timer (seconds 0.8))
|
||||
(:flags (bit3))
|
||||
(:conerot-x (degrees 0) (degrees 140))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0 6.0)
|
||||
(:y (meters 1))
|
||||
(:scale-x (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:a 0.0)
|
||||
(:vel-y (meters 0.04) (meters 0.02))
|
||||
(:accel-y (meters -0.00083333335))
|
||||
(:friction 0.94)
|
||||
(:timer (seconds 0.8))
|
||||
(:flags (bit3))
|
||||
(:conerot-x (degrees 0) (degrees 140))
|
||||
(:conerot-y (degrees 0) (degrees 360))))
|
||||
|
||||
(defpart 2052
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0) (meters 16))
|
||||
(:z (meters 0.3) (meters 0.3))
|
||||
(:scale-x (meters 0.4) (meters 0.3))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 0.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 64.0 64.0)
|
||||
(:omega 0.0 65536.0)
|
||||
(:vel-x (meters 0.026666667) (meters 0.10666667))
|
||||
(:scalevel-x (meters -0.000909091))
|
||||
(:rotvel-z (degrees -0.3) 1 (degrees 0.6))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-g -0.26666668)
|
||||
(:fade-a -0.19393939)
|
||||
(:timer (seconds 0.2) (seconds 0.597))
|
||||
(:flags (bit2 bit3 bit7 bit14))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0) (meters 16))
|
||||
(:z (meters 0.3) (meters 0.3))
|
||||
(:scale-x (meters 0.4) (meters 0.3))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 0.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 64.0 64.0)
|
||||
(:omega 0.0 65536.0)
|
||||
(:vel-x (meters 0.026666667) (meters 0.10666667))
|
||||
(:scalevel-x (meters -0.000909091))
|
||||
(:rotvel-z (degrees -0.3) 1 (degrees 0.6))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-g -0.26666668)
|
||||
(:fade-a -0.19393939)
|
||||
(:timer (seconds 0.2) (seconds 0.597))
|
||||
(:flags (bit2 bit3 bit7 bit14))))
|
||||
|
||||
(defpart 2053
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 0.4) (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 32.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 32.0 32.0)
|
||||
(:scalevel-x (meters -0.0006190476))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-a -0.01904762)
|
||||
(:accel-y (meters -0.000100000005) (meters -0.00015))
|
||||
(:timer (seconds 0.1) (seconds 0.797))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.8))
|
||||
(:next-launcher 198)
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 0.4) (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 32.0 96.0)
|
||||
(:g 0.0 32.0)
|
||||
(:b 64.0 32.0)
|
||||
(:a 32.0 32.0)
|
||||
(:scalevel-x (meters -0.0006190476))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-a -0.01904762)
|
||||
(:accel-y (meters -0.000100000005) (meters -0.00015))
|
||||
(:timer (seconds 0.1) (seconds 0.797))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.8))
|
||||
(:next-launcher 198)))
|
||||
|
||||
(defpart 2058
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0 6.0)
|
||||
(:y (meters 1))
|
||||
(:scale-x (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:a 0.0)
|
||||
(:vel-y (meters 0.04) (meters 0.02))
|
||||
(:accel-y (meters -0.00083333335))
|
||||
(:friction 0.94)
|
||||
(:timer (seconds 0.8))
|
||||
(:flags (bit3))
|
||||
(:conerot-x (degrees 0) (degrees 140))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
||||
(:num 1.0 6.0)
|
||||
(:y (meters 1))
|
||||
(:scale-x (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:a 0.0)
|
||||
(:vel-y (meters 0.04) (meters 0.02))
|
||||
(:accel-y (meters -0.00083333335))
|
||||
(:friction 0.94)
|
||||
(:timer (seconds 0.8))
|
||||
(:flags (bit3))
|
||||
(:conerot-x (degrees 0) (degrees 140))
|
||||
(:conerot-y (degrees 0) (degrees 360))))
|
||||
|
||||
(defpart 2054
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0) (meters 16))
|
||||
(:z (meters 0.3) (meters 0.3))
|
||||
(:scale-x (meters 0.4) (meters 0.3))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 16.0 32.0)
|
||||
(:g 0.0 16.0)
|
||||
(:b 192.0 64.0)
|
||||
(:a 64.0 64.0)
|
||||
(:omega 0.0 65536.0)
|
||||
(:vel-x (meters 0.026666667) (meters 0.10666667))
|
||||
(:scalevel-x (meters -0.000909091))
|
||||
(:rotvel-z (degrees -0.3) 1 (degrees 0.6))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-g -0.26666668)
|
||||
(:fade-a -0.19393939)
|
||||
(:timer (seconds 0.2) (seconds 0.597))
|
||||
(:flags (bit2 bit3 bit7 bit14))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:y (meters 0) (meters 16))
|
||||
(:z (meters 0.3) (meters 0.3))
|
||||
(:scale-x (meters 0.4) (meters 0.3))
|
||||
(:rot-z (degrees 0) (degrees 360))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 16.0 32.0)
|
||||
(:g 0.0 16.0)
|
||||
(:b 192.0 64.0)
|
||||
(:a 64.0 64.0)
|
||||
(:omega 0.0 65536.0)
|
||||
(:vel-x (meters 0.026666667) (meters 0.10666667))
|
||||
(:scalevel-x (meters -0.000909091))
|
||||
(:rotvel-z (degrees -0.3) 1 (degrees 0.6))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-g -0.26666668)
|
||||
(:fade-a -0.19393939)
|
||||
(:timer (seconds 0.2) (seconds 0.597))
|
||||
(:flags (bit2 bit3 bit7 bit14))))
|
||||
|
||||
(defpart 2055
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 0.4) (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 16.0 32.0)
|
||||
(:g 0.0 16.0)
|
||||
(:b 192.0 64.0)
|
||||
(:a 32.0 32.0)
|
||||
(:scalevel-x (meters -0.0006190476))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-a -0.01904762)
|
||||
(:accel-y (meters -0.000100000005) (meters -0.00015))
|
||||
(:timer (seconds 0.1) (seconds 0.797))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.8))
|
||||
(:next-launcher 198)
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 1.0)
|
||||
(:scale-x (meters 0.4) (meters 0.1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:r 16.0 32.0)
|
||||
(:g 0.0 16.0)
|
||||
(:b 192.0 64.0)
|
||||
(:a 32.0 32.0)
|
||||
(:scalevel-x (meters -0.0006190476))
|
||||
(:scalevel-y :copy scalevel-x)
|
||||
(:fade-a -0.01904762)
|
||||
(:accel-y (meters -0.000100000005) (meters -0.00015))
|
||||
(:timer (seconds 0.1) (seconds 0.797))
|
||||
(:flags (bit2 bit3 bit14))
|
||||
(:next-time (seconds 0.8))
|
||||
(:next-launcher 198)))
|
||||
|
||||
(defstate water-vol-idle (dark-eco-pool)
|
||||
:virtual #t
|
||||
:trans (behavior ()
|
||||
(let ((t9-0 (-> (method-of-type water-anim water-vol-idle) trans)))
|
||||
(if t9-0
|
||||
(t9-0)
|
||||
)
|
||||
)
|
||||
(let* ((gp-0 (-> self draw ripple))
|
||||
(f0-1 (the float (logand (current-time) #xffff)))
|
||||
(f0-3 (cos (* 5.0 f0-1)))
|
||||
(f30-0 (* f0-3 f0-3))
|
||||
)
|
||||
(let ((s5-0 (-> self draw ripple query)))
|
||||
(set! (-> self draw ripple send-query) #t)
|
||||
(set! (-> s5-0 start-vertex) (rand-vu-int-range 0 255))
|
||||
(set! (-> s5-0 vertex-skip) 256)
|
||||
(when (zero? (rand-vu-int-range 0 15))
|
||||
(when (and (nonzero? (-> s5-0 vertex-count)) (< #x32000 (memory-free *nk-dead-pool*)))
|
||||
(let ((s3-0 (rand-vu-int-range 0 (+ (-> s5-0 vertex-count) -1))))
|
||||
(process-spawn
|
||||
part-tracker
|
||||
:init part-tracker-init
|
||||
(-> *part-group-id-table* 445)
|
||||
-1
|
||||
#f
|
||||
#f
|
||||
#f
|
||||
(-> s5-0 data s3-0)
|
||||
:to *entity-pool*
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(case (-> self look)
|
||||
((32)
|
||||
(set! (-> gp-0 global-scale) (* 4096.0 (* 1.5 (+ 1.0 f30-0))))
|
||||
(set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f30-0)))
|
||||
)
|
||||
(else
|
||||
(set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f30-0))))
|
||||
(set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f30-0)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(let ((t9-0 (-> (method-of-type water-anim water-vol-idle) trans))) (if t9-0 (t9-0)))
|
||||
(let* ((gp-0 (-> self draw ripple))
|
||||
(f0-1 (the float (logand (current-time) #xffff)))
|
||||
(f0-3 (cos (* 5.0 f0-1)))
|
||||
(f30-0 (* f0-3 f0-3)))
|
||||
(let ((s5-0 (-> self draw ripple query)))
|
||||
(set! (-> self draw ripple send-query) #t)
|
||||
(set! (-> s5-0 start-vertex) (rand-vu-int-range 0 255))
|
||||
(set! (-> s5-0 vertex-skip) 256)
|
||||
(when (zero? (rand-vu-int-range 0 15))
|
||||
(when (and (nonzero? (-> s5-0 vertex-count)) (< #x32000 (memory-free *nk-dead-pool*)))
|
||||
(let ((s3-0 (rand-vu-int-range 0 (+ (-> s5-0 vertex-count) -1))))
|
||||
(process-spawn part-tracker
|
||||
:init
|
||||
part-tracker-init
|
||||
(-> *part-group-id-table* 445)
|
||||
-1
|
||||
#f
|
||||
#f
|
||||
#f
|
||||
(-> s5-0 data s3-0)
|
||||
:to
|
||||
*entity-pool*)))))
|
||||
(case (-> self look)
|
||||
((32)
|
||||
(set! (-> gp-0 global-scale) (* 4096.0 (* 1.5 (+ 1.0 f30-0))))
|
||||
(set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f30-0))))
|
||||
(else
|
||||
(set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f30-0))))
|
||||
(set! (-> gp-0 individual-normal-scale) (+ 0.5 (* 0.5 f30-0))))))))
|
||||
@@ -1,32 +1,45 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/game/game-h.gc")
|
||||
|
||||
;; name: generic-obs-h.gc
|
||||
;; name in dgo: generic-obs-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define-extern mistycam-spawn (function none))
|
||||
|
||||
(define-extern beachcam-spawn (function none))
|
||||
|
||||
(declare-type camera-tracker process)
|
||||
|
||||
(define-extern process-grab? (function process symbol :behavior camera-tracker))
|
||||
|
||||
(define-extern process-release? (function process symbol :behavior process))
|
||||
|
||||
(define-extern fuel-cell type)
|
||||
|
||||
(define-extern birth-pickup-at-point (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process))
|
||||
(define-extern birth-pickup-at-point
|
||||
(function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process))
|
||||
|
||||
(declare-type collide-shape trsqv)
|
||||
|
||||
(declare-type collide-shape-moving collide-shape)
|
||||
|
||||
(declare-type sparticle-launch-group basic)
|
||||
|
||||
(declare-type part-tracker process)
|
||||
|
||||
(declare-type collide-prim-core structure)
|
||||
(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker))
|
||||
|
||||
(define-extern part-tracker-init
|
||||
(function sparticle-launch-group
|
||||
time-frame
|
||||
(function part-tracker none)
|
||||
(pointer process-drawable)
|
||||
process
|
||||
collide-prim-core
|
||||
none
|
||||
:behavior
|
||||
part-tracker))
|
||||
|
||||
(declare-type touch-tracker process-drawable)
|
||||
|
||||
(define-extern touch-tracker-init (function vector float time-frame none :behavior touch-tracker))
|
||||
|
||||
(define-extern eco-blue-glow (function vector none))
|
||||
@@ -40,163 +53,132 @@
|
||||
;; A manipy is a way to draw and move something. More complicated objects that want to draw multiple
|
||||
;; things may create a child manipy and then send it commands.
|
||||
(deftype manipy (process-drawable)
|
||||
((new-trans-hook (function none))
|
||||
(cur-trans-hook (function none))
|
||||
(cur-event-hook (function none))
|
||||
(new-joint-anim art-joint-anim)
|
||||
(new-joint-anim-blend uint64)
|
||||
(anim-mode symbol)
|
||||
(cur-grab-handle handle)
|
||||
(cur-target-handle handle)
|
||||
(old-grab-pos vector :inline)
|
||||
(joint joint-mod 4)
|
||||
(new-post-hook (function none))
|
||||
(cur-post-hook (function none))
|
||||
(clone-copy-trans symbol)
|
||||
(shadow-backup basic)
|
||||
(draw? symbol)
|
||||
)
|
||||
((new-trans-hook (function none))
|
||||
(cur-trans-hook (function none))
|
||||
(cur-event-hook (function none))
|
||||
(new-joint-anim art-joint-anim)
|
||||
(new-joint-anim-blend uint64)
|
||||
(anim-mode symbol)
|
||||
(cur-grab-handle handle)
|
||||
(cur-target-handle handle)
|
||||
(old-grab-pos vector :inline)
|
||||
(joint joint-mod 4)
|
||||
(new-post-hook (function none))
|
||||
(cur-post-hook (function none))
|
||||
(clone-copy-trans symbol)
|
||||
(shadow-backup basic)
|
||||
(draw? symbol))
|
||||
(:states
|
||||
manipy-idle
|
||||
)
|
||||
)
|
||||
|
||||
manipy-idle))
|
||||
|
||||
(deftype part-spawner (process-drawable)
|
||||
((mode (pointer sparticle-launch-group))
|
||||
(enable symbol)
|
||||
(radius meters)
|
||||
(world-sphere sphere :inline)
|
||||
)
|
||||
((mode (pointer sparticle-launch-group))
|
||||
(enable symbol)
|
||||
(radius meters)
|
||||
(world-sphere sphere :inline))
|
||||
(:methods
|
||||
(is-visible? (_type_) symbol)
|
||||
)
|
||||
(is-visible? (_type_) symbol))
|
||||
(:states
|
||||
part-spawner-active
|
||||
)
|
||||
)
|
||||
part-spawner-active))
|
||||
|
||||
;; a part-tracker will spawn particles, then linger for a bit, and then finally die.
|
||||
;; a more complicated object can use this to manage particles that do something interesting (like follow you)
|
||||
(deftype part-tracker (process)
|
||||
((root trsqv)
|
||||
(part sparticle-launch-control)
|
||||
(target handle)
|
||||
(callback (function part-tracker vector))
|
||||
(linger-callback (function part-tracker vector))
|
||||
(duration time-frame)
|
||||
(linger-duration time-frame)
|
||||
(start-time time-frame)
|
||||
(offset vector :inline)
|
||||
(userdata uint64)
|
||||
(user-time time-frame 2)
|
||||
(user-vector vector 2 :inline)
|
||||
(user-handle uint32 2)
|
||||
)
|
||||
((root trsqv)
|
||||
(part sparticle-launch-control)
|
||||
(target handle)
|
||||
(callback (function part-tracker vector))
|
||||
(linger-callback (function part-tracker vector))
|
||||
(duration time-frame)
|
||||
(linger-duration time-frame)
|
||||
(start-time time-frame)
|
||||
(offset vector :inline)
|
||||
(userdata uint64)
|
||||
(user-time time-frame 2)
|
||||
(user-vector vector 2 :inline)
|
||||
(user-handle uint32 2))
|
||||
(:states
|
||||
part-tracker-process
|
||||
)
|
||||
)
|
||||
part-tracker-process))
|
||||
|
||||
;; a camera-tracker can control the camera.
|
||||
(deftype camera-tracker (process)
|
||||
((grab-target handle :offset 120)
|
||||
(grab-event symbol)
|
||||
(release-event symbol)
|
||||
(old-global-mask process-mask)
|
||||
(old-self-mask process-mask)
|
||||
(old-parent-mask process-mask)
|
||||
(look-at-target handle)
|
||||
(pov-target handle)
|
||||
(work-process handle)
|
||||
(anim-process handle)
|
||||
(start-time time-frame)
|
||||
(callback basic)
|
||||
(userdata basic)
|
||||
(message basic)
|
||||
(border-value basic)
|
||||
(mask-to-clear process-mask)
|
||||
(script pair)
|
||||
(script-line pair)
|
||||
(script-func (function none))
|
||||
)
|
||||
((grab-target handle :offset 120)
|
||||
(grab-event symbol)
|
||||
(release-event symbol)
|
||||
(old-global-mask process-mask)
|
||||
(old-self-mask process-mask)
|
||||
(old-parent-mask process-mask)
|
||||
(look-at-target handle)
|
||||
(pov-target handle)
|
||||
(work-process handle)
|
||||
(anim-process handle)
|
||||
(start-time time-frame)
|
||||
(callback basic)
|
||||
(userdata basic)
|
||||
(message basic)
|
||||
(border-value basic)
|
||||
(mask-to-clear process-mask)
|
||||
(script pair)
|
||||
(script-line pair)
|
||||
(script-func (function none)))
|
||||
(:methods
|
||||
(eval (_type_ pair) process)
|
||||
)
|
||||
(eval (_type_ pair) process))
|
||||
(:states
|
||||
camera-tracker-process
|
||||
)
|
||||
)
|
||||
camera-tracker-process))
|
||||
|
||||
;; a touch tracker waits to be touched, then calls some callback function.
|
||||
(deftype touch-tracker (process-drawable)
|
||||
((root collide-shape-moving :override)
|
||||
(duration time-frame)
|
||||
(target handle)
|
||||
(event symbol)
|
||||
(run-function (function object))
|
||||
(callback (function touch-tracker none))
|
||||
(event-mode basic)
|
||||
)
|
||||
((root collide-shape-moving :override)
|
||||
(duration time-frame)
|
||||
(target handle)
|
||||
(event symbol)
|
||||
(run-function (function object))
|
||||
(callback (function touch-tracker none))
|
||||
(event-mode basic))
|
||||
(:states
|
||||
touch-tracker-idle
|
||||
)
|
||||
)
|
||||
touch-tracker-idle))
|
||||
|
||||
;; the classic pole
|
||||
(deftype swingpole (process)
|
||||
((root trsq)
|
||||
(dir vector :inline)
|
||||
(range meters)
|
||||
(edge-length meters)
|
||||
)
|
||||
((root trsq)
|
||||
(dir vector :inline)
|
||||
(range meters)
|
||||
(edge-length meters))
|
||||
(:states
|
||||
swingpole-active
|
||||
swingpole-stance
|
||||
)
|
||||
)
|
||||
swingpole-active
|
||||
swingpole-stance))
|
||||
|
||||
;; do you want to fish?
|
||||
(deftype gui-query (structure)
|
||||
((x-position int32)
|
||||
(y-position int32)
|
||||
(message string)
|
||||
(decision symbol)
|
||||
(only-allow-cancel symbol)
|
||||
(no-msg string)
|
||||
(message-space int32)
|
||||
)
|
||||
((x-position int32)
|
||||
(y-position int32)
|
||||
(message string)
|
||||
(decision symbol)
|
||||
(only-allow-cancel symbol)
|
||||
(no-msg string)
|
||||
(message-space int32))
|
||||
:pack-me
|
||||
(:methods
|
||||
(init! (_type_ string int int int symbol string) none)
|
||||
(get-response (_type_) symbol)
|
||||
)
|
||||
)
|
||||
(init! (_type_ string int int int symbol string) none)
|
||||
(get-response (_type_) symbol)))
|
||||
|
||||
;; control the camera from something else (an animation)
|
||||
(deftype othercam (process)
|
||||
((hand handle)
|
||||
(old-global-mask process-mask)
|
||||
(mask-to-clear process-mask)
|
||||
(cam-joint-index int32)
|
||||
(old-pos vector :inline)
|
||||
(old-mat-z vector :inline)
|
||||
(had-valid-frame basic)
|
||||
(border-value basic)
|
||||
(die? symbol)
|
||||
(survive-anim-end? symbol)
|
||||
(spooling? symbol)
|
||||
)
|
||||
((hand handle)
|
||||
(old-global-mask process-mask)
|
||||
(mask-to-clear process-mask)
|
||||
(cam-joint-index int32)
|
||||
(old-pos vector :inline)
|
||||
(old-mat-z vector :inline)
|
||||
(had-valid-frame basic)
|
||||
(border-value basic)
|
||||
(die? symbol)
|
||||
(survive-anim-end? symbol)
|
||||
(spooling? symbol))
|
||||
(:states
|
||||
othercam-running
|
||||
)
|
||||
)
|
||||
|
||||
othercam-running))
|
||||
|
||||
;; don't draw it! I guess used to disable things during development.
|
||||
(deftype process-hidden (process)
|
||||
()
|
||||
(deftype process-hidden (process) ()
|
||||
(:state-methods
|
||||
die
|
||||
)
|
||||
)
|
||||
die))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,17 +1,15 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/game/game-h.gc")
|
||||
|
||||
;; name: nav-enemy-h.gc
|
||||
;; name in dgo: nav-enemy-h
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
(declare-type nav-enemy process-drawable)
|
||||
|
||||
(define-extern nav-enemy-send-attack (function process touching-shapes-entry symbol object :behavior nav-enemy))
|
||||
|
||||
(define-extern nav-enemy-set-hit-from-direction (function process none :behavior nav-enemy))
|
||||
|
||||
(define-extern nav-enemy-get-new-patrol-point (function int :behavior nav-enemy))
|
||||
|
||||
(define-extern nav-enemy-test-point-near-nav-mesh? (function vector symbol :behavior nav-enemy))
|
||||
|
||||
(defenum nav-enemy-flags
|
||||
@@ -48,153 +46,145 @@
|
||||
(navenmf28 28)
|
||||
(navenmf29 29)
|
||||
(navenmf30 30)
|
||||
(navenmf31 31)
|
||||
)
|
||||
(navenmf31 31))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype nav-enemy-info (basic)
|
||||
((idle-anim int32)
|
||||
(walk-anim int32)
|
||||
(turn-anim int32)
|
||||
(notice-anim int32)
|
||||
(run-anim int32)
|
||||
(jump-anim int32)
|
||||
(jump-land-anim int32)
|
||||
(victory-anim int32)
|
||||
(taunt-anim int32)
|
||||
(die-anim int32)
|
||||
(neck-joint int32)
|
||||
(player-look-at-joint int32)
|
||||
(run-travel-speed meters)
|
||||
(run-rotate-speed degrees)
|
||||
(run-acceleration meters)
|
||||
(run-turn-time seconds)
|
||||
(walk-travel-speed meters)
|
||||
(walk-rotate-speed degrees)
|
||||
(walk-acceleration meters)
|
||||
(walk-turn-time seconds)
|
||||
(attack-shove-back meters)
|
||||
(attack-shove-up meters)
|
||||
(shadow-size meters)
|
||||
(notice-nav-radius meters)
|
||||
(nav-nearest-y-threshold meters)
|
||||
(notice-distance meters)
|
||||
(proximity-notice-distance meters)
|
||||
(stop-chase-distance meters)
|
||||
(frustration-distance meters)
|
||||
(frustration-time time-frame)
|
||||
(die-anim-hold-frame float)
|
||||
(jump-anim-start-frame float)
|
||||
(jump-land-anim-end-frame float)
|
||||
(jump-height-min meters)
|
||||
(jump-height-factor float)
|
||||
(jump-start-anim-speed float)
|
||||
(shadow-max-y meters)
|
||||
(shadow-min-y meters)
|
||||
(shadow-locus-dist meters)
|
||||
(use-align symbol)
|
||||
(draw-shadow symbol)
|
||||
(move-to-ground symbol)
|
||||
(hover-if-no-ground symbol)
|
||||
(use-momentum symbol)
|
||||
(use-flee symbol)
|
||||
(use-proximity-notice symbol)
|
||||
(use-jump-blocked symbol)
|
||||
(use-jump-patrol symbol)
|
||||
(gnd-collide-with collide-kind)
|
||||
(debug-draw-neck symbol)
|
||||
(debug-draw-jump symbol)
|
||||
)
|
||||
)
|
||||
|
||||
((idle-anim int32)
|
||||
(walk-anim int32)
|
||||
(turn-anim int32)
|
||||
(notice-anim int32)
|
||||
(run-anim int32)
|
||||
(jump-anim int32)
|
||||
(jump-land-anim int32)
|
||||
(victory-anim int32)
|
||||
(taunt-anim int32)
|
||||
(die-anim int32)
|
||||
(neck-joint int32)
|
||||
(player-look-at-joint int32)
|
||||
(run-travel-speed meters)
|
||||
(run-rotate-speed degrees)
|
||||
(run-acceleration meters)
|
||||
(run-turn-time seconds)
|
||||
(walk-travel-speed meters)
|
||||
(walk-rotate-speed degrees)
|
||||
(walk-acceleration meters)
|
||||
(walk-turn-time seconds)
|
||||
(attack-shove-back meters)
|
||||
(attack-shove-up meters)
|
||||
(shadow-size meters)
|
||||
(notice-nav-radius meters)
|
||||
(nav-nearest-y-threshold meters)
|
||||
(notice-distance meters)
|
||||
(proximity-notice-distance meters)
|
||||
(stop-chase-distance meters)
|
||||
(frustration-distance meters)
|
||||
(frustration-time time-frame)
|
||||
(die-anim-hold-frame float)
|
||||
(jump-anim-start-frame float)
|
||||
(jump-land-anim-end-frame float)
|
||||
(jump-height-min meters)
|
||||
(jump-height-factor float)
|
||||
(jump-start-anim-speed float)
|
||||
(shadow-max-y meters)
|
||||
(shadow-min-y meters)
|
||||
(shadow-locus-dist meters)
|
||||
(use-align symbol)
|
||||
(draw-shadow symbol)
|
||||
(move-to-ground symbol)
|
||||
(hover-if-no-ground symbol)
|
||||
(use-momentum symbol)
|
||||
(use-flee symbol)
|
||||
(use-proximity-notice symbol)
|
||||
(use-jump-blocked symbol)
|
||||
(use-jump-patrol symbol)
|
||||
(gnd-collide-with collide-kind)
|
||||
(debug-draw-neck symbol)
|
||||
(debug-draw-jump symbol)))
|
||||
|
||||
(deftype nav-enemy (process-drawable)
|
||||
((collide-info collide-shape-moving :overlay-at root)
|
||||
(enemy-info fact-info-enemy :overlay-at fact)
|
||||
(hit-from-dir vector :inline)
|
||||
(event-param-point vector :inline)
|
||||
(frustration-point vector :inline)
|
||||
(jump-dest vector :inline)
|
||||
(jump-trajectory trajectory :inline)
|
||||
(jump-time time-frame)
|
||||
(nav-info nav-enemy-info)
|
||||
(target-speed float)
|
||||
(momentum-speed float)
|
||||
(acceleration float)
|
||||
(rotate-speed float)
|
||||
(turn-time time-frame)
|
||||
(frustration-time time-frame)
|
||||
(speed-scale float)
|
||||
(neck joint-mod)
|
||||
(reaction-time time-frame)
|
||||
(notice-time time-frame)
|
||||
(state-timeout time-frame)
|
||||
(free-time time-frame)
|
||||
(touch-time time-frame)
|
||||
(nav-enemy-flags nav-enemy-flags)
|
||||
(incomming-attack-id handle)
|
||||
(jump-return-state (state process))
|
||||
(rand-gen random-generator)
|
||||
)
|
||||
((collide-info collide-shape-moving :overlay-at root)
|
||||
(enemy-info fact-info-enemy :overlay-at fact)
|
||||
(hit-from-dir vector :inline)
|
||||
(event-param-point vector :inline)
|
||||
(frustration-point vector :inline)
|
||||
(jump-dest vector :inline)
|
||||
(jump-trajectory trajectory :inline)
|
||||
(jump-time time-frame)
|
||||
(nav-info nav-enemy-info)
|
||||
(target-speed float)
|
||||
(momentum-speed float)
|
||||
(acceleration float)
|
||||
(rotate-speed float)
|
||||
(turn-time time-frame)
|
||||
(frustration-time time-frame)
|
||||
(speed-scale float)
|
||||
(neck joint-mod)
|
||||
(reaction-time time-frame)
|
||||
(notice-time time-frame)
|
||||
(state-timeout time-frame)
|
||||
(free-time time-frame)
|
||||
(touch-time time-frame)
|
||||
(nav-enemy-flags nav-enemy-flags)
|
||||
(incomming-attack-id handle)
|
||||
(jump-return-state (state process))
|
||||
(rand-gen random-generator))
|
||||
(:state-methods
|
||||
nav-enemy-attack
|
||||
nav-enemy-chase
|
||||
nav-enemy-flee
|
||||
nav-enemy-die
|
||||
nav-enemy-fuel-cell
|
||||
nav-enemy-give-up
|
||||
nav-enemy-jump
|
||||
nav-enemy-jump-land
|
||||
nav-enemy-idle
|
||||
nav-enemy-notice
|
||||
nav-enemy-patrol
|
||||
nav-enemy-stare
|
||||
nav-enemy-stop-chase
|
||||
nav-enemy-victory
|
||||
)
|
||||
nav-enemy-attack
|
||||
nav-enemy-chase
|
||||
nav-enemy-flee
|
||||
nav-enemy-die
|
||||
nav-enemy-fuel-cell
|
||||
nav-enemy-give-up
|
||||
nav-enemy-jump
|
||||
nav-enemy-jump-land
|
||||
nav-enemy-idle
|
||||
nav-enemy-notice
|
||||
nav-enemy-patrol
|
||||
nav-enemy-stare
|
||||
nav-enemy-stop-chase
|
||||
nav-enemy-victory)
|
||||
(:methods
|
||||
(nav-enemy-method-34 (_type_) none)
|
||||
(nav-enemy-wait-for-cue () _type_ :state)
|
||||
(nav-enemy-jump-to-point () _type_ :state)
|
||||
(nav-enemy-method-37 (_type_) none)
|
||||
(nav-enemy-method-38 (_type_) none)
|
||||
(common-post (_type_) none)
|
||||
(nav-enemy-method-40 (_type_) none)
|
||||
(nav-enemy-method-41 (_type_) none)
|
||||
(new-patrol-point! (_type_) int)
|
||||
(attack-handler (_type_ process event-message-block) object)
|
||||
(touch-handler (_type_ process event-message-block) object)
|
||||
(init-defaults! (_type_ nav-enemy-info) none)
|
||||
(target-in-range? (_type_ float) basic)
|
||||
(initialize-collision (_type_) none)
|
||||
(nav-enemy-method-48 (_type_) none)
|
||||
(init-jm! (_type_ nav-enemy-info) float)
|
||||
(nav-enemy-method-50 (_type_ vector) symbol)
|
||||
(nav-enemy-method-51 (_type_) none)
|
||||
(nav-enemy-method-52 (_type_ vector) symbol)
|
||||
(nav-enemy-method-53 (_type_) symbol)
|
||||
(nav-enemy-method-54 (_type_ vector) symbol)
|
||||
(nav-enemy-method-55 (_type_) symbol)
|
||||
(set-jump-height-factor! (_type_ int) none)
|
||||
(nav-enemy-method-57 (_type_) none)
|
||||
(nav-enemy-method-58 (_type_) none)
|
||||
(nav-enemy-method-59 (_type_) none)
|
||||
(nav-enemy-method-60 (_type_ symbol) symbol)
|
||||
(snow-bunny-attack () _type_ :state)
|
||||
(snow-bunny-chase-hop () _type_ :state)
|
||||
(snow-bunny-defend () _type_ :state)
|
||||
(nav-enemy-method-64 () _type_ :state)
|
||||
(snow-bunny-lunge () _type_ :state)
|
||||
(snow-bunny-nav-resume () _type_ :state)
|
||||
(snow-bunny-patrol-hop () _type_ :state)
|
||||
(snow-bunny-patrol-idle () _type_ :state)
|
||||
(nav-enemy-method-69 () _type_ :state)
|
||||
(snow-bunny-retreat-hop () _type_ :state)
|
||||
(snow-bunny-tune-spheres () _type_ :state)
|
||||
(nav-enemy-touch-handler (_type_ process event-message-block) object)
|
||||
(nav-enemy-attack-handler (_type_ process event-message-block) object)
|
||||
(nav-enemy-jump-blocked () _type_ :state)
|
||||
(nav-enemy-method-75 () _type_ :state)
|
||||
)
|
||||
)
|
||||
(nav-enemy-method-34 (_type_) none)
|
||||
(nav-enemy-wait-for-cue () _type_ :state)
|
||||
(nav-enemy-jump-to-point () _type_ :state)
|
||||
(nav-enemy-method-37 (_type_) none)
|
||||
(nav-enemy-method-38 (_type_) none)
|
||||
(common-post (_type_) none)
|
||||
(nav-enemy-method-40 (_type_) none)
|
||||
(nav-enemy-method-41 (_type_) none)
|
||||
(new-patrol-point! (_type_) int)
|
||||
(attack-handler (_type_ process event-message-block) object)
|
||||
(touch-handler (_type_ process event-message-block) object)
|
||||
(init-defaults! (_type_ nav-enemy-info) none)
|
||||
(target-in-range? (_type_ float) basic)
|
||||
(initialize-collision (_type_) none)
|
||||
(nav-enemy-method-48 (_type_) none)
|
||||
(init-jm! (_type_ nav-enemy-info) float)
|
||||
(nav-enemy-method-50 (_type_ vector) symbol)
|
||||
(nav-enemy-method-51 (_type_) none)
|
||||
(nav-enemy-method-52 (_type_ vector) symbol)
|
||||
(nav-enemy-method-53 (_type_) symbol)
|
||||
(nav-enemy-method-54 (_type_ vector) symbol)
|
||||
(nav-enemy-method-55 (_type_) symbol)
|
||||
(set-jump-height-factor! (_type_ int) none)
|
||||
(nav-enemy-method-57 (_type_) none)
|
||||
(nav-enemy-method-58 (_type_) none)
|
||||
(nav-enemy-method-59 (_type_) none)
|
||||
(nav-enemy-method-60 (_type_ symbol) symbol)
|
||||
(snow-bunny-attack () _type_ :state)
|
||||
(snow-bunny-chase-hop () _type_ :state)
|
||||
(snow-bunny-defend () _type_ :state)
|
||||
(nav-enemy-method-64 () _type_ :state)
|
||||
(snow-bunny-lunge () _type_ :state)
|
||||
(snow-bunny-nav-resume () _type_ :state)
|
||||
(snow-bunny-patrol-hop () _type_ :state)
|
||||
(snow-bunny-patrol-idle () _type_ :state)
|
||||
(nav-enemy-method-69 () _type_ :state)
|
||||
(snow-bunny-retreat-hop () _type_ :state)
|
||||
(snow-bunny-tune-spheres () _type_ :state)
|
||||
(nav-enemy-touch-handler (_type_ process event-message-block) object)
|
||||
(nav-enemy-attack-handler (_type_ process event-message-block) object)
|
||||
(nav-enemy-jump-blocked () _type_ :state)
|
||||
(nav-enemy-method-75 () _type_ :state)))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,121 +1,82 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/collectables.gc")
|
||||
(require "engine/common-obs/baseplat.gc")
|
||||
|
||||
;; name: orb-cache.gc
|
||||
;; name in dgo: orb-cache
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype orb-cache-top (baseplat)
|
||||
((active-distance float)
|
||||
(inactive-distance float)
|
||||
(money-list handle 60)
|
||||
(money-pos-list float 60)
|
||||
(money-pos-actual float 60)
|
||||
(platform-pos float)
|
||||
(root-pos float)
|
||||
(money int32)
|
||||
(activated symbol)
|
||||
)
|
||||
((active-distance float)
|
||||
(inactive-distance float)
|
||||
(money-list handle 60)
|
||||
(money-pos-list float 60)
|
||||
(money-pos-actual float 60)
|
||||
(platform-pos float)
|
||||
(root-pos float)
|
||||
(money int32)
|
||||
(activated symbol))
|
||||
(:methods
|
||||
(pos-logic (_type_ symbol) symbol)
|
||||
(calculate-pos (_type_ symbol) none)
|
||||
)
|
||||
(:states
|
||||
(orb-cache-top-activate symbol)
|
||||
(orb-cache-top-complete symbol)
|
||||
(orb-cache-top-idle symbol)
|
||||
)
|
||||
)
|
||||
(pos-logic (_type_ symbol) symbol)
|
||||
(calculate-pos (_type_ symbol) none))
|
||||
(:states (orb-cache-top-activate symbol)
|
||||
(orb-cache-top-complete symbol)
|
||||
(orb-cache-top-idle symbol)))
|
||||
|
||||
|
||||
(defskelgroup *orb-cache-top-sg* orb-cache-top orb-cache-top-lod0-jg orb-cache-top-idle-ja
|
||||
((orb-cache-top-lod0-mg (meters 20)) (orb-cache-top-lod1-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 4)
|
||||
)
|
||||
(defskelgroup *orb-cache-top-sg*
|
||||
orb-cache-top
|
||||
orb-cache-top-lod0-jg
|
||||
orb-cache-top-idle-ja
|
||||
((orb-cache-top-lod0-mg (meters 20)) (orb-cache-top-lod1-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 4))
|
||||
|
||||
(defstate orb-cache-top-idle (orb-cache-top)
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('eco-blue)
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(dotimes (gp-0 5)
|
||||
(spawn-projectile-blue *target*)
|
||||
)
|
||||
(increment-success-for-hint (text-id sidekick-hint-orb-cache-top))
|
||||
(go orb-cache-top-activate #f)
|
||||
)
|
||||
(else
|
||||
(plat-event proc argc message block)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (and (and *target* (>= 20480.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))))
|
||||
(not (send-event *target* 'query 'powerup (pickup-type eco-blue)))
|
||||
)
|
||||
(level-hint-spawn
|
||||
(text-id sidekick-hint-orb-cache-top)
|
||||
"sksp0009"
|
||||
(the-as entity #f)
|
||||
*entity-pool*
|
||||
(game-task none)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ((arg0 symbol))
|
||||
(if (and (not arg0) (-> self child))
|
||||
(sound-play "close-orb-cash")
|
||||
)
|
||||
(dotimes (gp-1 (-> self money))
|
||||
(let ((a0-4 (handle->process (-> self money-list gp-1))))
|
||||
(if a0-4
|
||||
(deactivate a0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
(process-entity-status! self (entity-perm-status complete) #f)
|
||||
(ja :group! orb-cache-top-idle-ja :num! (identity (ja-aframe 0.0 0)))
|
||||
(transform-post)
|
||||
(anim-loop)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('eco-blue)
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(dotimes (gp-0 5)
|
||||
(spawn-projectile-blue *target*))
|
||||
(increment-success-for-hint (text-id sidekick-hint-orb-cache-top))
|
||||
(go orb-cache-top-activate #f))
|
||||
(else (plat-event proc argc message block))))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (and (and *target* (>= 20480.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))))
|
||||
(not (send-event *target* 'query 'powerup (pickup-type eco-blue))))
|
||||
(level-hint-spawn (text-id sidekick-hint-orb-cache-top) "sksp0009" (the-as entity #f) *entity-pool* (game-task none))))
|
||||
:code
|
||||
(behavior ((arg0 symbol))
|
||||
(if (and (not arg0) (-> self child)) (sound-play "close-orb-cash"))
|
||||
(dotimes (gp-1 (-> self money))
|
||||
(let ((a0-4 (handle->process (-> self money-list gp-1)))) (if a0-4 (deactivate a0-4))))
|
||||
(process-entity-status! self (entity-perm-status complete) #f)
|
||||
(ja :group! orb-cache-top-idle-ja :num! (identity (ja-aframe 0.0 0)))
|
||||
(transform-post)
|
||||
(anim-loop)))
|
||||
|
||||
(defmethod baseplat-method-22 ((this orb-cache-top))
|
||||
(if (< 4096.0 (- (-> this basetrans y) (-> this root-pos)))
|
||||
(activate! (-> this smush) -1.0 60 150 1.0 1.0)
|
||||
(activate! (-> this smush) -0.5 60 150 1.0 1.0)
|
||||
)
|
||||
(activate! (-> this smush) -1.0 60 150 1.0 1.0)
|
||||
(activate! (-> this smush) -0.5 60 150 1.0 1.0))
|
||||
(set! (-> this bouncing) #t)
|
||||
(logclear! (-> this mask) (process-mask sleep))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod calculate-pos ((this orb-cache-top) (arg0 symbol))
|
||||
(let ((f0-0 0.0))
|
||||
(when arg0
|
||||
(set! f0-0 (+ 10240.0 (* 6144.0 (the float (+ (-> this money) -1)))))
|
||||
(if (< f0-0 2048.0)
|
||||
(set! f0-0 2048.0)
|
||||
)
|
||||
)
|
||||
(if (< f0-0 2048.0) (set! f0-0 2048.0)))
|
||||
(set! (-> this platform-pos) (+ (-> this root-pos) f0-0))
|
||||
(let ((f0-2 (+ -6144.0 f0-0)))
|
||||
(dotimes (v1-5 (-> this money))
|
||||
(set! (-> this money-pos-list v1-5) (+ (-> this root-pos) f0-2))
|
||||
(set! f0-2 (+ -6144.0 f0-2))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! f0-2 (+ -6144.0 f0-2)))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod pos-logic ((this orb-cache-top) (arg0 symbol))
|
||||
(dotimes (s4-0 (-> this money))
|
||||
@@ -123,173 +84,109 @@
|
||||
(dotimes (v1-6 (-> this money))
|
||||
(when (< s4-0 v1-6)
|
||||
(set! (-> this money-list (+ v1-6 -1)) (-> this money-list v1-6))
|
||||
(set! (-> this money-pos-actual (+ v1-6 -1)) (-> this money-pos-actual v1-6))
|
||||
)
|
||||
)
|
||||
(set! (-> this money-pos-actual (+ v1-6 -1)) (-> this money-pos-actual v1-6))))
|
||||
(+! (-> this money) -1)
|
||||
(calculate-pos this arg0)
|
||||
(+! s4-0 -1)
|
||||
(let ((v1-15 (-> this entity extra perm)))
|
||||
(logior! (-> v1-15 status) (entity-perm-status user-set-from-cstage))
|
||||
(+! (-> v1-15 user-int16 0) 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> v1-15 user-int16 0) 1))))
|
||||
(let ((s4-1 (new 'stack-no-clear 'vector))
|
||||
(s5-1 #t)
|
||||
)
|
||||
(s5-1 #t))
|
||||
(let ((s3-0 #f))
|
||||
(let ((f28-0 (- (-> this basetrans y) (-> this root-pos)))
|
||||
(f30-0 (- (-> this platform-pos) (-> this root-pos)))
|
||||
)
|
||||
(f30-0 (- (-> this platform-pos) (-> this root-pos))))
|
||||
(when (zero? (-> this money))
|
||||
(set! f30-0 2048.0)
|
||||
(set! s3-0 #t)
|
||||
)
|
||||
(set! s3-0 #t))
|
||||
(when (and (< f30-0 15155.2)
|
||||
(and *target* (>= 16384.0 (vector-vector-distance (-> this root trans) (-> *target* control trans))))
|
||||
(< (-> (target-pos 0) y) (-> this basetrans y))
|
||||
)
|
||||
(set! f30-0 (if (< 14131.2 f28-0)
|
||||
15155.2
|
||||
f28-0
|
||||
)
|
||||
)
|
||||
(set! s3-0 #f)
|
||||
)
|
||||
(< (-> (target-pos 0) y) (-> this basetrans y)))
|
||||
(set! f30-0 (if (< 14131.2 f28-0) 15155.2 f28-0))
|
||||
(set! s3-0 #f))
|
||||
(seek! (-> this basetrans y) (+ (-> this root-pos) f30-0) (* 40960.0 (seconds-per-frame)))
|
||||
(if (not (= (-> this basetrans y) (+ (-> this root-pos) f30-0)))
|
||||
(set! s5-1 #f)
|
||||
)
|
||||
)
|
||||
(if (not (= (-> this basetrans y) (+ (-> this root-pos) f30-0))) (set! s5-1 #f)))
|
||||
(dotimes (s2-0 (-> this money))
|
||||
(set! (-> s4-1 quad)
|
||||
(-> (the-as process-drawable (handle->process (-> this money-list s2-0))) root trans quad)
|
||||
)
|
||||
(set! (-> s4-1 quad) (-> (the-as process-drawable (handle->process (-> this money-list s2-0))) root trans quad))
|
||||
(seek! (-> this money-pos-actual s2-0) (-> this money-pos-list s2-0) (* 40960.0 (seconds-per-frame)))
|
||||
(if (not (= (-> this money-pos-actual s2-0) (-> this money-pos-list s2-0)))
|
||||
(set! s5-1 #f)
|
||||
)
|
||||
(if (not (= (-> this money-pos-actual s2-0) (-> this money-pos-list s2-0))) (set! s5-1 #f))
|
||||
(if (>= (-> this money-pos-actual s2-0) (+ -8192.0 (-> this root-pos)))
|
||||
(set! (-> s4-1 y) (-> this money-pos-actual s2-0))
|
||||
(set! (-> s4-1 y) (+ -8192.0 (-> this root-pos)))
|
||||
)
|
||||
(send-event (handle->process (-> this money-list s2-0)) 'trans s4-1)
|
||||
)
|
||||
(set! (-> s4-1 y) (-> this money-pos-actual s2-0))
|
||||
(set! (-> s4-1 y) (+ -8192.0 (-> this root-pos))))
|
||||
(send-event (handle->process (-> this money-list s2-0)) 'trans s4-1))
|
||||
(set! s3-0 (and s5-1 s3-0))
|
||||
(if s3-0
|
||||
(go orb-cache-top-complete #f)
|
||||
)
|
||||
)
|
||||
s5-1
|
||||
)
|
||||
)
|
||||
(if s3-0 (go orb-cache-top-complete #f)))
|
||||
s5-1))
|
||||
|
||||
(defstate orb-cache-top-activate (orb-cache-top)
|
||||
:event plat-event
|
||||
:exit (behavior ()
|
||||
(process-entity-status! self (entity-perm-status bit-3) #f)
|
||||
)
|
||||
:exit
|
||||
(behavior ()
|
||||
(process-entity-status! self (entity-perm-status bit-3) #f))
|
||||
:trans plat-trans
|
||||
:code (behavior ((arg0 symbol))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(calculate-pos self arg0)
|
||||
(if arg0
|
||||
(set! (-> self basetrans y) (-> self platform-pos))
|
||||
(sound-play "open-orb-cash")
|
||||
)
|
||||
(dotimes (s5-1 (-> self money))
|
||||
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> s4-1 quad) (-> self basetrans quad))
|
||||
(set! (-> s4-1 y) (-> self money-pos-list s5-1))
|
||||
(set! (-> self money-pos-actual s5-1) (-> s4-1 y))
|
||||
(set! (-> self money-list s5-1)
|
||||
(ppointer->handle
|
||||
(process-spawn money :init money-init-by-other-no-bob s4-1 *null-vector* 5 1.0 (-> self entity) :to self)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop
|
||||
(calculate-pos self #t)
|
||||
(while (not (or (not *target*)
|
||||
(< (-> self inactive-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
)
|
||||
(pos-logic self #t)
|
||||
(suspend)
|
||||
)
|
||||
(calculate-pos self #f)
|
||||
(while (and (not (and (and *target*
|
||||
(>= (-> self active-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
(let ((a1-11 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-11 from) self)
|
||||
(set! (-> a1-11 num-params) 2)
|
||||
(set! (-> a1-11 message) 'query)
|
||||
(set! (-> a1-11 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-11 param 1) (the-as uint 3))
|
||||
(or (send-event-function *target* a1-11) (-> self activated))
|
||||
)
|
||||
)
|
||||
)
|
||||
(not (pos-logic self #f))
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
(if (not (and (and *target*
|
||||
(>= (-> self active-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
(let ((a1-14 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-14 from) self)
|
||||
(set! (-> a1-14 num-params) 2)
|
||||
(set! (-> a1-14 message) 'query)
|
||||
(set! (-> a1-14 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-14 param 1) (the-as uint 3))
|
||||
(or (send-event-function *target* a1-14) (-> self activated))
|
||||
)
|
||||
)
|
||||
)
|
||||
(go orb-cache-top-idle arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
:post plat-post
|
||||
)
|
||||
:code
|
||||
(behavior ((arg0 symbol))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(calculate-pos self arg0)
|
||||
(if arg0 (set! (-> self basetrans y) (-> self platform-pos)) (sound-play "open-orb-cash"))
|
||||
(dotimes (s5-1 (-> self money))
|
||||
(let ((s4-1 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> s4-1 quad) (-> self basetrans quad))
|
||||
(set! (-> s4-1 y) (-> self money-pos-list s5-1))
|
||||
(set! (-> self money-pos-actual s5-1) (-> s4-1 y))
|
||||
(set! (-> self money-list s5-1)
|
||||
(ppointer->handle (process-spawn money :init money-init-by-other-no-bob s4-1 *null-vector* 5 1.0 (-> self entity) :to self)))))
|
||||
(loop
|
||||
(calculate-pos self #t)
|
||||
(while (not (or (not *target*)
|
||||
(< (-> self inactive-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans)))))
|
||||
(pos-logic self #t)
|
||||
(suspend))
|
||||
(calculate-pos self #f)
|
||||
(while (and (not (and (and *target*
|
||||
(>= (-> self active-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans))))
|
||||
(let ((a1-11 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-11 from) self)
|
||||
(set! (-> a1-11 num-params) 2)
|
||||
(set! (-> a1-11 message) 'query)
|
||||
(set! (-> a1-11 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-11 param 1) (the-as uint 3))
|
||||
(or (send-event-function *target* a1-11) (-> self activated)))))
|
||||
(not (pos-logic self #f)))
|
||||
(suspend))
|
||||
(if (not (and (and *target*
|
||||
(>= (-> self active-distance) (vector-vector-xz-distance (-> self root trans) (-> *target* control trans))))
|
||||
(let ((a1-14 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-14 from) self)
|
||||
(set! (-> a1-14 num-params) 2)
|
||||
(set! (-> a1-14 message) 'query)
|
||||
(set! (-> a1-14 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-14 param 1) (the-as uint 3))
|
||||
(or (send-event-function *target* a1-14) (-> self activated)))))
|
||||
(go orb-cache-top-idle arg0))))
|
||||
:post plat-post)
|
||||
|
||||
(defstate orb-cache-top-complete (orb-cache-top)
|
||||
:event plat-event
|
||||
:trans plat-trans
|
||||
:code (behavior ((arg0 symbol))
|
||||
(if (not arg0)
|
||||
(sound-play "close-orb-cash")
|
||||
)
|
||||
(ja :group! orb-cache-top-idle-ja :num! (identity (ja-aframe 0.0 0)))
|
||||
(new 'stack-no-clear 'vector)
|
||||
(set! (-> self basetrans y) (+ 2048.0 (-> self root-pos)))
|
||||
(anim-loop)
|
||||
)
|
||||
:post plat-post
|
||||
)
|
||||
:code
|
||||
(behavior ((arg0 symbol))
|
||||
(if (not arg0) (sound-play "close-orb-cash"))
|
||||
(ja :group! orb-cache-top-idle-ja :num! (identity (ja-aframe 0.0 0)))
|
||||
(new 'stack-no-clear 'vector)
|
||||
(set! (-> self basetrans y) (+ 2048.0 (-> self root-pos)))
|
||||
(anim-loop))
|
||||
:post plat-post)
|
||||
|
||||
(defmethod init-from-entity! ((this orb-cache-top) (arg0 entity-actor))
|
||||
(let ((a0-1 (-> this entity)))
|
||||
(if (when a0-1
|
||||
(let ((a0-2 (-> a0-1 extra perm task)))
|
||||
(if a0-2
|
||||
(= a0-2 (game-task none))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> this entity extra perm task) (game-task complete))
|
||||
)
|
||||
)
|
||||
(let ((a0-2 (-> a0-1 extra perm task))) (if a0-2 (= a0-2 (game-task none)))))
|
||||
(set! (-> this entity extra perm task) (game-task complete))))
|
||||
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s4-0 reaction) default-collision-reaction)
|
||||
(set! (-> s4-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s4-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s4-0 1)
|
||||
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
|
||||
(set! (-> s3-0 prim-core collide-as) (collide-kind ground-object blue-eco-suck))
|
||||
@@ -298,12 +195,10 @@
|
||||
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s3-0 transform-index) 0)
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 11468.8)
|
||||
(set-root-prim! s4-0 s3-0)
|
||||
)
|
||||
(set-root-prim! s4-0 s3-0))
|
||||
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s4-0)
|
||||
(set! (-> this root) s4-0)
|
||||
)
|
||||
(set! (-> this root) s4-0))
|
||||
(process-drawable-from-entity! this arg0)
|
||||
(logclear! (-> this mask) (process-mask actor-pause))
|
||||
(initialize-skeleton this *orb-cache-top-sg* '())
|
||||
@@ -316,28 +211,15 @@
|
||||
(set! (-> this root-pos) (-> this basetrans y))
|
||||
(set! (-> this platform-pos) (-> this root-pos))
|
||||
(set! (-> this activated)
|
||||
(the-as
|
||||
symbol
|
||||
(and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
)
|
||||
)
|
||||
(the-as symbol (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))))
|
||||
(let ((v1-39 (-> this entity extra perm)))
|
||||
(logior! (-> v1-39 status) (entity-perm-status user-set-from-cstage))
|
||||
(set! (-> this money) (- (-> this money) (-> v1-39 user-int16 0)))
|
||||
)
|
||||
(set! (-> this money) (- (-> this money) (-> v1-39 user-int16 0))))
|
||||
(dotimes (v1-42 (-> this money))
|
||||
(set! (-> this money-list v1-42) (the-as handle #f))
|
||||
)
|
||||
(set! (-> this money-list v1-42) (the-as handle #f)))
|
||||
(cond
|
||||
((zero? (-> this money))
|
||||
(go orb-cache-top-complete #t)
|
||||
)
|
||||
((zero? (-> this money)) (go orb-cache-top-complete #t))
|
||||
((and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
(go orb-cache-top-activate #t)
|
||||
)
|
||||
(else
|
||||
(go orb-cache-top-idle #f)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(go orb-cache-top-activate #t))
|
||||
(else (go orb-cache-top-idle #f)))
|
||||
(none))
|
||||
@@ -1,331 +1,238 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/generic-obs.gc")
|
||||
(require "engine/geometry/path.gc")
|
||||
|
||||
;; name: plat-button.gc
|
||||
;; name in dgo: plat-button
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype plat-button (process-drawable)
|
||||
((root collide-shape-moving :override)
|
||||
(go-back-if-lost-player? symbol)
|
||||
(grab-player? symbol)
|
||||
(should-grab-player? symbol)
|
||||
(path-pos float)
|
||||
(bidirectional? symbol)
|
||||
(allow-auto-kill symbol)
|
||||
(sound-id sound-id)
|
||||
(trans-off vector :inline)
|
||||
(spawn-pos vector :inline)
|
||||
)
|
||||
((root collide-shape-moving :override)
|
||||
(go-back-if-lost-player? symbol)
|
||||
(grab-player? symbol)
|
||||
(should-grab-player? symbol)
|
||||
(path-pos float)
|
||||
(bidirectional? symbol)
|
||||
(allow-auto-kill symbol)
|
||||
(sound-id sound-id)
|
||||
(trans-off vector :inline)
|
||||
(spawn-pos vector :inline))
|
||||
(:state-methods
|
||||
plat-button-at-end
|
||||
plat-button-idle
|
||||
plat-button-pressed
|
||||
plat-button-move-downward
|
||||
plat-button-move-upward
|
||||
plat-button-teleport-to-other-end
|
||||
)
|
||||
plat-button-at-end
|
||||
plat-button-idle
|
||||
plat-button-pressed
|
||||
plat-button-move-downward
|
||||
plat-button-move-upward
|
||||
plat-button-teleport-to-other-end)
|
||||
(:methods
|
||||
(can-activate? (_type_) symbol)
|
||||
(plat-button-method-27 (_type_) none)
|
||||
(plat-button-method-28 (_type_) collide-shape-moving)
|
||||
(can-target-move? (_type_) none)
|
||||
(should-teleport? (_type_) symbol)
|
||||
(plat-button-method-31 (_type_) none)
|
||||
(plat-button-method-32 (_type_) none)
|
||||
)
|
||||
)
|
||||
(can-activate? (_type_) symbol)
|
||||
(plat-button-method-27 (_type_) none)
|
||||
(plat-button-method-28 (_type_) collide-shape-moving)
|
||||
(can-target-move? (_type_) none)
|
||||
(should-teleport? (_type_) symbol)
|
||||
(plat-button-method-31 (_type_) none)
|
||||
(plat-button-method-32 (_type_) none)))
|
||||
|
||||
|
||||
(defskelgroup *plat-button-sg* plat-button plat-button-geo-jg plat-button-pressed-ja
|
||||
((plat-button-geo-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -1 0 6.6)
|
||||
)
|
||||
(defskelgroup *plat-button-sg*
|
||||
plat-button
|
||||
plat-button-geo-jg
|
||||
plat-button-pressed-ja
|
||||
((plat-button-geo-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -1 0 6.6))
|
||||
|
||||
(defmethod should-teleport? ((this plat-button))
|
||||
#f
|
||||
)
|
||||
#f)
|
||||
|
||||
(defmethod can-activate? ((this plat-button))
|
||||
(or (= (-> this path-pos) 0.0) (and (-> this bidirectional?) (= (-> this path-pos) 1.0)))
|
||||
)
|
||||
(or (= (-> this path-pos) 0.0) (and (-> this bidirectional?) (= (-> this path-pos) 1.0))))
|
||||
|
||||
(defstate plat-button-idle (plat-button)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('touch)
|
||||
(when (can-activate? self)
|
||||
(if (and ((method-of-type touching-shapes-entry prims-touching?)
|
||||
(the-as touching-shapes-entry (-> block param 0))
|
||||
(-> self root)
|
||||
(the-as uint 1)
|
||||
)
|
||||
(or (not (-> self should-grab-player?)) (set! (-> self grab-player?) (process-grab? *target*)))
|
||||
)
|
||||
(go-virtual plat-button-pressed)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(let ((gp-0 (can-activate? self)))
|
||||
(if gp-0
|
||||
(ja-no-eval :num! (seek! 0.0))
|
||||
(ja-no-eval :num! (seek!))
|
||||
)
|
||||
(loop
|
||||
(if (should-teleport? self)
|
||||
(go-virtual plat-button-teleport-to-other-end)
|
||||
)
|
||||
(let ((s5-0 (can-activate? self)))
|
||||
(when (!= s5-0 gp-0)
|
||||
(set! gp-0 s5-0)
|
||||
(if s5-0
|
||||
(ja-no-eval :num! (seek! 0.0))
|
||||
(ja-no-eval :num! (seek!))
|
||||
)
|
||||
)
|
||||
(when (not (ja-done? 0))
|
||||
(rider-trans)
|
||||
(if s5-0
|
||||
(ja :num! (seek! 0.0))
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(rider-post)
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('touch)
|
||||
(when (can-activate? self)
|
||||
(if (and ((method-of-type touching-shapes-entry prims-touching?)
|
||||
(the-as touching-shapes-entry (-> block param 0))
|
||||
(-> self root)
|
||||
(the-as uint 1))
|
||||
(or (not (-> self should-grab-player?)) (set! (-> self grab-player?) (process-grab? *target*))))
|
||||
(go-virtual plat-button-pressed))))))
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((gp-0 (can-activate? self)))
|
||||
(if gp-0 (ja-no-eval :num! (seek! 0.0)) (ja-no-eval :num! (seek!)))
|
||||
(loop
|
||||
(if (should-teleport? self) (go-virtual plat-button-teleport-to-other-end))
|
||||
(let ((s5-0 (can-activate? self)))
|
||||
(when (!= s5-0 gp-0)
|
||||
(set! gp-0 s5-0)
|
||||
(if s5-0 (ja-no-eval :num! (seek! 0.0)) (ja-no-eval :num! (seek!))))
|
||||
(when (not (ja-done? 0))
|
||||
(rider-trans)
|
||||
(if s5-0 (ja :num! (seek! 0.0)) (ja :num! (seek!)))
|
||||
(rider-post)))
|
||||
(suspend)))))
|
||||
|
||||
(defstate plat-button-teleport-to-other-end (plat-button)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(let ((f0-0 1.0))
|
||||
(if (>= (-> self path-pos) 0.5)
|
||||
(set! f0-0 0.0)
|
||||
)
|
||||
(set! (-> self path-pos) f0-0)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-0 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)
|
||||
)
|
||||
)
|
||||
(ja-post)
|
||||
(go-virtual plat-button-idle)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((f0-0 1.0))
|
||||
(if (>= (-> self path-pos) 0.5) (set! f0-0 0.0))
|
||||
(set! (-> self path-pos) f0-0)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-0 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)))
|
||||
(ja-post)
|
||||
(go-virtual plat-button-idle)))
|
||||
|
||||
(defstate plat-button-pressed (plat-button)
|
||||
:virtual #t
|
||||
:trans rider-trans
|
||||
:code (behavior ()
|
||||
(ja-no-eval :num! (seek!))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
(set! (-> self go-back-if-lost-player?) #t)
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(if (= (-> self path-pos) 0.0)
|
||||
(go-virtual plat-button-move-downward)
|
||||
(go-virtual plat-button-move-upward)
|
||||
)
|
||||
)
|
||||
:post rider-post
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-no-eval :num! (seek!))
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek!)))
|
||||
(set! (-> self go-back-if-lost-player?) #t)
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(if (= (-> self path-pos) 0.0) (go-virtual plat-button-move-downward) (go-virtual plat-button-move-upward)))
|
||||
:post rider-post)
|
||||
|
||||
(defbehavior plat-button-camera-on plat-button ()
|
||||
(let ((v1-1 (res-lump-struct (-> self entity) 'camera-name structure)))
|
||||
(if v1-1
|
||||
(send-event *camera* 'change-to-entity-by-name v1-1)
|
||||
)
|
||||
)
|
||||
(if v1-1 (send-event *camera* 'change-to-entity-by-name v1-1)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior plat-button-camera-off plat-button ()
|
||||
(send-event *camera* 'clear-entity)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defstate plat-button-move-downward (plat-button)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(when (or (= message 'touch) (= message 'attack))
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(when (or (= message 'touch) (= message 'attack))
|
||||
(set-time! (-> self state-time))
|
||||
#f))
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
#f
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(plat-button-camera-on)
|
||||
(set-setting! 'allow-look-around #f 0.0 0)
|
||||
)
|
||||
:exit (behavior ()
|
||||
(plat-button-camera-off)
|
||||
(remove-setting! 'allow-look-around)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (= (-> self path-pos) 1.0)
|
||||
(go-virtual plat-button-at-end)
|
||||
)
|
||||
(rider-trans)
|
||||
(when (-> self go-back-if-lost-player?)
|
||||
(when (or (not *target*)
|
||||
(and (time-elapsed? (-> self state-time) (seconds 4))
|
||||
(not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
|
||||
(not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> self go-back-if-lost-player?) #f)
|
||||
(go-virtual plat-button-move-upward)
|
||||
)
|
||||
)
|
||||
(let ((f0-4 (seek-with-smooth (-> self path-pos) 1.0 (* 0.1 (seconds-per-frame)) 0.25 0.001)))
|
||||
(set! (-> self path-pos) f0-4)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-4 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)
|
||||
)
|
||||
)
|
||||
(sound-play "elev-loop" :id (-> self sound-id))
|
||||
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-1 command) (sound-command set-param))
|
||||
(set! (-> gp-1 id) (-> self sound-id))
|
||||
(let ((a1-6 (-> self root trans)))
|
||||
(let ((s5-0 self))
|
||||
(when (= a1-6 #t)
|
||||
(if (and s5-0 (type-type? (-> s5-0 type) process-drawable) (nonzero? (-> s5-0 root)))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(plat-button-camera-on)
|
||||
(set-setting! 'allow-look-around #f 0.0 0))
|
||||
:exit
|
||||
(behavior ()
|
||||
(plat-button-camera-off)
|
||||
(remove-setting! 'allow-look-around))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (= (-> self path-pos) 1.0) (go-virtual plat-button-at-end))
|
||||
(rider-trans)
|
||||
(when (-> self go-back-if-lost-player?)
|
||||
(when (or (not *target*)
|
||||
(and (time-elapsed? (-> self state-time) (seconds 4))
|
||||
(not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
|
||||
(not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))))))
|
||||
(set! (-> self go-back-if-lost-player?) #f)
|
||||
(go-virtual plat-button-move-upward)))
|
||||
(let ((f0-4 (seek-with-smooth (-> self path-pos) 1.0 (* 0.1 (seconds-per-frame)) 0.25 0.001)))
|
||||
(set! (-> self path-pos) f0-4)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-4 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)))
|
||||
(sound-play "elev-loop" :id (-> self sound-id))
|
||||
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-1 command) (sound-command set-param))
|
||||
(set! (-> gp-1 id) (-> self sound-id))
|
||||
(let ((a1-6 (-> self root trans)))
|
||||
(let ((s5-0 self))
|
||||
(when (= a1-6 #t)
|
||||
(if (and s5-0 (type-type? (-> s5-0 type) process-drawable) (nonzero? (-> s5-0 root)))
|
||||
(set! a1-6 (-> s5-0 root trans))
|
||||
(set! a1-6 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-1 parms trans) a1-6)
|
||||
)
|
||||
(set! (-> gp-1 parms mask) (sound-mask trans))
|
||||
(-> gp-1 id)
|
||||
)
|
||||
(if (and (-> self grab-player?) (< 0.2 (-> self path-pos)))
|
||||
(set! (-> self grab-player?) (not (process-release? *target*)))
|
||||
)
|
||||
)
|
||||
(set! a1-6 (the-as vector #f)))))
|
||||
(sound-trans-convert (-> gp-1 parms trans) a1-6))
|
||||
(set! (-> gp-1 parms mask) (sound-mask trans))
|
||||
(-> gp-1 id))
|
||||
(if (and (-> self grab-player?) (< 0.2 (-> self path-pos))) (set! (-> self grab-player?) (not (process-release? *target*)))))
|
||||
:code anim-loop
|
||||
:post rider-post
|
||||
)
|
||||
:post rider-post)
|
||||
|
||||
(defstate plat-button-move-upward (plat-button)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(when (or (= message 'touch) (= message 'attack))
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(when (or (= message 'touch) (= message 'attack))
|
||||
(set-time! (-> self state-time))
|
||||
#f))
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
#f
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(plat-button-camera-on)
|
||||
(set-setting! 'allow-look-around #f 0.0 0)
|
||||
)
|
||||
:exit (behavior ()
|
||||
(plat-button-camera-off)
|
||||
(remove-setting! 'allow-look-around)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (= (-> self path-pos) 0.0)
|
||||
(go-virtual plat-button-at-end)
|
||||
)
|
||||
(rider-trans)
|
||||
(when (-> self go-back-if-lost-player?)
|
||||
(when (or (not *target*)
|
||||
(and (time-elapsed? (-> self state-time) (seconds 4))
|
||||
(not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
|
||||
(not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> self go-back-if-lost-player?) #f)
|
||||
(go-virtual plat-button-move-downward)
|
||||
)
|
||||
)
|
||||
(let ((f0-4 (seek-with-smooth (-> self path-pos) 0.0 (* 0.1 (seconds-per-frame)) 0.25 0.001)))
|
||||
(set! (-> self path-pos) f0-4)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-4 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)
|
||||
)
|
||||
)
|
||||
(sound-play "elev-loop" :id (-> self sound-id))
|
||||
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-1 command) (sound-command set-param))
|
||||
(set! (-> gp-1 id) (-> self sound-id))
|
||||
(let ((a1-6 (-> self root trans)))
|
||||
(let ((s5-0 self))
|
||||
(when (= a1-6 #t)
|
||||
(if (and s5-0 (type-type? (-> s5-0 type) process-drawable) (nonzero? (-> s5-0 root)))
|
||||
(process-entity-status! self (entity-perm-status bit-3) #t)
|
||||
(plat-button-camera-on)
|
||||
(set-setting! 'allow-look-around #f 0.0 0))
|
||||
:exit
|
||||
(behavior ()
|
||||
(plat-button-camera-off)
|
||||
(remove-setting! 'allow-look-around))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (= (-> self path-pos) 0.0) (go-virtual plat-button-at-end))
|
||||
(rider-trans)
|
||||
(when (-> self go-back-if-lost-player?)
|
||||
(when (or (not *target*)
|
||||
(and (time-elapsed? (-> self state-time) (seconds 4))
|
||||
(not (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
|
||||
(not (logtest? (-> *target* control status) (cshape-moving-flags onsurf)))))))
|
||||
(set! (-> self go-back-if-lost-player?) #f)
|
||||
(go-virtual plat-button-move-downward)))
|
||||
(let ((f0-4 (seek-with-smooth (-> self path-pos) 0.0 (* 0.1 (seconds-per-frame)) 0.25 0.001)))
|
||||
(set! (-> self path-pos) f0-4)
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(eval-path-curve! (-> self path) gp-0 f0-4 'interp)
|
||||
(vector+! gp-0 gp-0 (-> self trans-off))
|
||||
(move-to-point! (-> self root) gp-0)))
|
||||
(sound-play "elev-loop" :id (-> self sound-id))
|
||||
(let ((gp-1 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-1 command) (sound-command set-param))
|
||||
(set! (-> gp-1 id) (-> self sound-id))
|
||||
(let ((a1-6 (-> self root trans)))
|
||||
(let ((s5-0 self))
|
||||
(when (= a1-6 #t)
|
||||
(if (and s5-0 (type-type? (-> s5-0 type) process-drawable) (nonzero? (-> s5-0 root)))
|
||||
(set! a1-6 (-> s5-0 root trans))
|
||||
(set! a1-6 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-1 parms trans) a1-6)
|
||||
)
|
||||
(set! (-> gp-1 parms mask) (sound-mask trans))
|
||||
(-> gp-1 id)
|
||||
)
|
||||
(if (and (-> self grab-player?) (< (-> self path-pos) 0.8))
|
||||
(set! (-> self grab-player?) (not (process-release? *target*)))
|
||||
)
|
||||
)
|
||||
(set! a1-6 (the-as vector #f)))))
|
||||
(sound-trans-convert (-> gp-1 parms trans) a1-6))
|
||||
(set! (-> gp-1 parms mask) (sound-mask trans))
|
||||
(-> gp-1 id))
|
||||
(if (and (-> self grab-player?) (< (-> self path-pos) 0.8)) (set! (-> self grab-player?) (not (process-release? *target*)))))
|
||||
:code anim-loop
|
||||
:post rider-post
|
||||
)
|
||||
:post rider-post)
|
||||
|
||||
(defstate plat-button-at-end (plat-button)
|
||||
:virtual #t
|
||||
:code (behavior ()
|
||||
(if (-> self allow-auto-kill)
|
||||
(process-entity-status! self (entity-perm-status bit-3) #f)
|
||||
)
|
||||
(sound-stop (-> self sound-id))
|
||||
(sound-play "elev-land")
|
||||
(loop
|
||||
(if (or (not *target*) (< 268435460.0 (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))))
|
||||
(go-virtual plat-button-idle)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(if (-> self allow-auto-kill) (process-entity-status! self (entity-perm-status bit-3) #f))
|
||||
(sound-stop (-> self sound-id))
|
||||
(sound-play "elev-land")
|
||||
(loop
|
||||
(if (or (not *target*) (< 268435460.0 (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))))
|
||||
(go-virtual plat-button-idle))
|
||||
(suspend))))
|
||||
|
||||
(defmethod plat-button-method-28 ((this plat-button))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s5-0 1)
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
||||
@@ -341,8 +248,7 @@
|
||||
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s3-0 transform-index) 4)
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 -3072.0 0.0 7372.8)
|
||||
(append-prim s4-0 s3-0)
|
||||
)
|
||||
(append-prim s4-0 s3-0))
|
||||
(let ((s3-1 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 2))))
|
||||
(set! (-> s3-1 prim-core collide-as) (collide-kind ground-object))
|
||||
(set! (-> s3-1 collide-with) (collide-kind target))
|
||||
@@ -350,81 +256,56 @@
|
||||
(set! (-> s3-1 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s3-1 transform-index) 3)
|
||||
(set-vector! (-> s3-1 local-sphere) 0.0 -4096.0 0.0 27033.6)
|
||||
(append-prim s4-0 s3-1)
|
||||
)
|
||||
)
|
||||
(append-prim s4-0 s3-1)))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root) s5-0)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
s5-0))
|
||||
|
||||
(defmethod can-target-move? ((this plat-button))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod plat-button-method-27 ((this plat-button))
|
||||
(ja-channel-set! 1)
|
||||
(cond
|
||||
((can-activate? this)
|
||||
(let ((s5-0 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval!
|
||||
s5-0
|
||||
(the-as art-joint-anim (-> this draw art-group data 2))
|
||||
num-func-identity
|
||||
)
|
||||
(set! (-> s5-0 frame-num) 0.0)
|
||||
)
|
||||
)
|
||||
(joint-control-channel-group-eval! s5-0 (the-as art-joint-anim (-> this draw art-group data 2)) num-func-identity)
|
||||
(set! (-> s5-0 frame-num) 0.0)))
|
||||
(else
|
||||
(let ((s5-1 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval!
|
||||
s5-1
|
||||
(the-as art-joint-anim (-> this draw art-group data 2))
|
||||
num-func-identity
|
||||
)
|
||||
(set! (-> s5-1 frame-num)
|
||||
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 2)) data 0 length) -1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s5-1 (-> this skel root-channel 0)))
|
||||
(joint-control-channel-group-eval! s5-1 (the-as art-joint-anim (-> this draw art-group data 2)) num-func-identity)
|
||||
(set! (-> s5-1 frame-num) (the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 2)) data 0 length) -1))))))
|
||||
(ja-post)
|
||||
(update-transforms! (-> this root))
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod plat-button-method-31 ((this plat-button))
|
||||
(initialize-skeleton this *plat-button-sg* '())
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod plat-button-method-32 ((this plat-button))
|
||||
(go (method-of-object this plat-button-idle))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod init-from-entity! ((this plat-button) (arg0 entity-actor))
|
||||
(set! (-> this go-back-if-lost-player?) #f)
|
||||
(set! (-> this grab-player?) #f)
|
||||
(set! (-> this should-grab-player?) #f)
|
||||
(set! (-> this trans-off quad) (-> (the-as vector ((method-of-type res-lump get-property-struct)
|
||||
arg0
|
||||
'trans-offset
|
||||
'interp
|
||||
-1000000000.0
|
||||
*null-vector*
|
||||
(the-as (pointer res-tag) #f)
|
||||
*res-static-buf*
|
||||
)
|
||||
)
|
||||
quad
|
||||
)
|
||||
)
|
||||
(set! (-> this trans-off quad)
|
||||
(-> (the-as vector
|
||||
((method-of-type res-lump get-property-struct)
|
||||
arg0
|
||||
'trans-offset
|
||||
'interp
|
||||
-1000000000.0
|
||||
*null-vector*
|
||||
(the-as (pointer res-tag) #f)
|
||||
*res-static-buf*))
|
||||
quad))
|
||||
(set! (-> this bidirectional?) (nonzero? (res-lump-value arg0 'bidirectional uint128)))
|
||||
(plat-button-method-28 this)
|
||||
(process-drawable-from-entity! this arg0)
|
||||
@@ -437,12 +318,10 @@
|
||||
(set! (-> this path-pos) 0.0)
|
||||
(let ((s5-1 (-> this root trans)))
|
||||
(eval-path-curve! (-> this path) s5-1 (-> this path-pos) 'interp)
|
||||
(vector+! s5-1 s5-1 (-> this trans-off))
|
||||
)
|
||||
(vector+! s5-1 s5-1 (-> this trans-off)))
|
||||
(set! (-> this sound-id) (new-sound-id))
|
||||
(set! (-> this allow-auto-kill) #t)
|
||||
(can-target-move? this)
|
||||
(plat-button-method-27 this)
|
||||
(plat-button-method-32 this)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
@@ -1,226 +1,160 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/plat.gc")
|
||||
(require "engine/common-obs/baseplat.gc")
|
||||
|
||||
;; name: plat-eco.gc
|
||||
;; name in dgo: plat-eco
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype plat-eco (plat)
|
||||
((notice-dist float)
|
||||
(sync-offset-dest float)
|
||||
(sync-offset-faux float)
|
||||
(sync-linear-val float)
|
||||
(target handle)
|
||||
(unlit-look lod-set :inline)
|
||||
(lit-look lod-set :inline)
|
||||
)
|
||||
((notice-dist float)
|
||||
(sync-offset-dest float)
|
||||
(sync-offset-faux float)
|
||||
(sync-linear-val float)
|
||||
(target handle)
|
||||
(unlit-look lod-set :inline)
|
||||
(lit-look lod-set :inline))
|
||||
(:methods
|
||||
(notice-blue (handle) _type_ :state :overlay-at wad)
|
||||
)
|
||||
)
|
||||
(notice-blue (handle) _type_ :state :overlay-at wad)))
|
||||
|
||||
(defskelgroup *plat-eco-unlit-sg*
|
||||
plat-eco
|
||||
plat-eco-lod0-jg
|
||||
plat-eco-idle-ja
|
||||
((plat-eco-lod0-mg (meters 20)) (plat-eco-lod1-mg (meters 40)) (plat-eco-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3))
|
||||
|
||||
(defskelgroup *plat-eco-unlit-sg* plat-eco plat-eco-lod0-jg plat-eco-idle-ja
|
||||
((plat-eco-lod0-mg (meters 20)) (plat-eco-lod1-mg (meters 40)) (plat-eco-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3)
|
||||
)
|
||||
|
||||
(defskelgroup *plat-eco-lit-sg* plat-eco plat-eco-lod0-jg plat-eco-idle-ja
|
||||
((plat-eco-lit-lod0-mg (meters 20)) (plat-eco-lit-lod1-mg (meters 40)) (plat-eco-lit-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3)
|
||||
)
|
||||
(defskelgroup *plat-eco-lit-sg*
|
||||
plat-eco
|
||||
plat-eco-lod0-jg
|
||||
plat-eco-idle-ja
|
||||
((plat-eco-lit-lod0-mg (meters 20)) (plat-eco-lit-lod1-mg (meters 40)) (plat-eco-lit-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 3))
|
||||
|
||||
(defstate plat-idle (plat-eco)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))
|
||||
)
|
||||
(('eco-blue)
|
||||
(go-virtual notice-blue (process->handle proc))
|
||||
)
|
||||
(('ridden 'edge-grabbed)
|
||||
(when (send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:enter (behavior ()
|
||||
(lods-assign! (-> self draw) (-> self unlit-look))
|
||||
)
|
||||
:trans (behavior ()
|
||||
(when (and (and *target*
|
||||
(>= (-> self notice-dist) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
)
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))
|
||||
)
|
||||
(if (and *target*
|
||||
(>= (-> self notice-dist) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
||||
)
|
||||
(level-hint-spawn (text-id misty-eco-plat) "sksp0073" (the-as entity #f) *entity-pool* (game-task none))
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(ja-post)
|
||||
(update-transforms! (-> self root))
|
||||
(anim-loop)
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('wake) (go-virtual plat-path-active (the-as plat #f)))
|
||||
(('eco-blue) (go-virtual notice-blue (process->handle proc)))
|
||||
(('ridden 'edge-grabbed)
|
||||
(when (send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))))))
|
||||
:enter
|
||||
(behavior ()
|
||||
(lods-assign! (-> self draw) (-> self unlit-look)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(when (and (and *target* (>= (-> self notice-dist) (vector-vector-distance (-> self root trans) (-> *target* control trans))))
|
||||
(send-event *target* 'query 'powerup (pickup-type eco-blue)))
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f)))
|
||||
(if (and *target* (>= (-> self notice-dist) (vector-vector-distance (-> self root trans) (-> *target* control trans))))
|
||||
(level-hint-spawn (text-id misty-eco-plat) "sksp0073" (the-as entity #f) *entity-pool* (game-task none))))
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-post)
|
||||
(update-transforms! (-> self root))
|
||||
(anim-loop))
|
||||
:post ja-post)
|
||||
|
||||
(defstate notice-blue (plat-eco)
|
||||
:virtual override
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('wake)
|
||||
(sound-play "blue-eco-on" :position (the-as symbol (-> self root trans)))
|
||||
(go-virtual plat-path-active (the-as plat #f))
|
||||
)
|
||||
(('ridden 'edge-grabbed)
|
||||
(when (send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans (behavior ()
|
||||
((-> (method-of-object self plat-idle) trans))
|
||||
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-0 from) self)
|
||||
(set! (-> a1-0 num-params) 2)
|
||||
(set! (-> a1-0 message) 'query)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-0 param 1) (the-as uint 3))
|
||||
(if (and (not (send-event-function *target* a1-0))
|
||||
(begin (logior! (-> self mask) (process-mask sleep-code)) (not (-> self bouncing)))
|
||||
)
|
||||
(go-virtual plat-idle)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ((arg0 handle))
|
||||
(set! (-> self target) arg0)
|
||||
(loop
|
||||
(let* ((gp-0 (handle->process (-> self target)))
|
||||
(v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable))
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(when v1-4
|
||||
(let* ((gp-1 (-> (the-as process-drawable v1-4) root))
|
||||
(v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape))
|
||||
gp-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(when v1-6
|
||||
(let* ((s5-0 (-> self root root-prim prim-core))
|
||||
(a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core))
|
||||
(f30-0 (vector-vector-distance (the-as vector s5-0) (the-as vector a1-3)))
|
||||
)
|
||||
(when (rand-vu-percent? 0.5)
|
||||
(let ((gp-2 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> gp-2 quad) (-> s5-0 world-sphere quad))
|
||||
(dotimes (s5-1 3)
|
||||
(+! (-> gp-2 data s5-1) (rand-vu-float-range -5324.8 5324.8))
|
||||
)
|
||||
(eco-blue-glow gp-2)
|
||||
)
|
||||
)
|
||||
(set! (-> self bouncing) #t)
|
||||
(activate!
|
||||
(-> self smush)
|
||||
(lerp-scale
|
||||
(rand-vu-float-range 1.1 1.3)
|
||||
(rand-vu-float-range 1.0 1.02)
|
||||
f30-0
|
||||
(-> *FACT-bank* suck-suck-dist)
|
||||
(-> *FACT-bank* suck-bounce-dist)
|
||||
)
|
||||
60
|
||||
60
|
||||
1.0
|
||||
1.0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
:post (behavior ()
|
||||
(plat-trans)
|
||||
(plat-post)
|
||||
)
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('wake)
|
||||
(sound-play "blue-eco-on" :position (the-as symbol (-> self root trans)))
|
||||
(go-virtual plat-path-active (the-as plat #f)))
|
||||
(('ridden 'edge-grabbed)
|
||||
(when (send-event *target* 'query 'powerup (pickup-type eco-blue))
|
||||
(send-to-all (-> self link) 'wake)
|
||||
(go-virtual plat-path-active (the-as plat #f))))))
|
||||
:trans
|
||||
(behavior ()
|
||||
((-> (method-of-object self plat-idle) trans))
|
||||
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-0 from) self)
|
||||
(set! (-> a1-0 num-params) 2)
|
||||
(set! (-> a1-0 message) 'query)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-0 param 1) (the-as uint 3))
|
||||
(if (and (not (send-event-function *target* a1-0))
|
||||
(begin
|
||||
(logior! (-> self mask) (process-mask sleep-code))
|
||||
(not (-> self bouncing))))
|
||||
(go-virtual plat-idle))))
|
||||
:code
|
||||
(behavior ((arg0 handle))
|
||||
(set! (-> self target) arg0)
|
||||
(loop
|
||||
(let* ((gp-0 (handle->process (-> self target)))
|
||||
(v1-4 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) gp-0)))
|
||||
(when v1-4
|
||||
(let* ((gp-1 (-> (the-as process-drawable v1-4) root))
|
||||
(v1-6 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) collide-shape)) gp-1)))
|
||||
(when v1-6
|
||||
(let* ((s5-0 (-> self root root-prim prim-core))
|
||||
(a1-3 (-> (the-as collide-shape v1-6) root-prim prim-core))
|
||||
(f30-0 (vector-vector-distance (the-as vector s5-0) (the-as vector a1-3))))
|
||||
(when (rand-vu-percent? 0.5)
|
||||
(let ((gp-2 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> gp-2 quad) (-> s5-0 world-sphere quad))
|
||||
(dotimes (s5-1 3)
|
||||
(+! (-> gp-2 data s5-1) (rand-vu-float-range -5324.8 5324.8)))
|
||||
(eco-blue-glow gp-2)))
|
||||
(set! (-> self bouncing) #t)
|
||||
(activate! (-> self smush)
|
||||
(lerp-scale (rand-vu-float-range 1.1 1.3)
|
||||
(rand-vu-float-range 1.0 1.02)
|
||||
f30-0
|
||||
(-> *FACT-bank* suck-suck-dist)
|
||||
(-> *FACT-bank* suck-bounce-dist))
|
||||
60
|
||||
60
|
||||
1.0
|
||||
1.0))))))
|
||||
(suspend)))
|
||||
:post
|
||||
(behavior ()
|
||||
(plat-trans)
|
||||
(plat-post)))
|
||||
|
||||
(defstate plat-path-active (plat-eco)
|
||||
:virtual #t
|
||||
:enter (behavior ((arg0 plat))
|
||||
(lods-assign! (-> self draw) (-> self lit-look))
|
||||
(sync-now! (-> self sync) (-> self sync-linear-val))
|
||||
(set! (-> self sync-offset-faux) (-> self sync offset))
|
||||
(let* ((f0-3 (the float (-> self sync period)))
|
||||
(f1-1 (* 0.5 f0-3))
|
||||
)
|
||||
(if (< f1-1 (- (-> self sync-offset-dest) (-> self sync-offset-faux)))
|
||||
(+! (-> self sync-offset-faux) f0-3)
|
||||
)
|
||||
(if (< f1-1 (- (-> self sync-offset-faux) (-> self sync-offset-dest)))
|
||||
(set! (-> self sync-offset-faux) (- (-> self sync-offset-faux) f0-3))
|
||||
)
|
||||
)
|
||||
(cond
|
||||
(arg0
|
||||
(let ((f0-5 (-> self sync-offset-dest)))
|
||||
(set! (-> self sync offset) f0-5)
|
||||
(set! (-> self sync-offset-faux) f0-5)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(dotimes (gp-1 5)
|
||||
(spawn-projectile-blue *target*)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(when (!= (-> self sync-offset-faux) (-> self sync-offset-dest))
|
||||
(seek! (-> self sync-offset-faux) (-> self sync-offset-dest) (* 12.0 (seconds-per-frame)))
|
||||
(let* ((f0-7 (the float (-> self sync period)))
|
||||
(f1-3 (+ (-> self sync-offset-faux) f0-7))
|
||||
)
|
||||
(set! (-> self sync offset) (- f1-3 (* (the float (the int (/ f1-3 f0-7))) f0-7)))
|
||||
)
|
||||
)
|
||||
((-> (method-of-type plat plat-path-active) trans))
|
||||
)
|
||||
)
|
||||
:enter
|
||||
(behavior ((arg0 plat))
|
||||
(lods-assign! (-> self draw) (-> self lit-look))
|
||||
(sync-now! (-> self sync) (-> self sync-linear-val))
|
||||
(set! (-> self sync-offset-faux) (-> self sync offset))
|
||||
(let* ((f0-3 (the float (-> self sync period)))
|
||||
(f1-1 (* 0.5 f0-3)))
|
||||
(if (< f1-1 (- (-> self sync-offset-dest) (-> self sync-offset-faux))) (+! (-> self sync-offset-faux) f0-3))
|
||||
(if (< f1-1 (- (-> self sync-offset-faux) (-> self sync-offset-dest)))
|
||||
(set! (-> self sync-offset-faux) (- (-> self sync-offset-faux) f0-3))))
|
||||
(cond
|
||||
(arg0
|
||||
(let ((f0-5 (-> self sync-offset-dest))) (set! (-> self sync offset) f0-5) (set! (-> self sync-offset-faux) f0-5)))
|
||||
(else
|
||||
(process-entity-status! self (entity-perm-status complete) #t)
|
||||
(dotimes (gp-1 5)
|
||||
(spawn-projectile-blue *target*)))))
|
||||
:trans
|
||||
(behavior ()
|
||||
(when (!= (-> self sync-offset-faux) (-> self sync-offset-dest))
|
||||
(seek! (-> self sync-offset-faux) (-> self sync-offset-dest) (* 12.0 (seconds-per-frame)))
|
||||
(let* ((f0-7 (the float (-> self sync period)))
|
||||
(f1-3 (+ (-> self sync-offset-faux) f0-7)))
|
||||
(set! (-> self sync offset) (- f1-3 (* (the float (the int (/ f1-3 f0-7))) f0-7)))))
|
||||
((-> (method-of-type plat plat-path-active) trans))))
|
||||
|
||||
(defmethod baseplat-method-24 ((this plat-eco))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s5-0 1)
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object blue-eco-suck))
|
||||
@@ -229,23 +163,18 @@
|
||||
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s4-0 transform-index) 0)
|
||||
(set-vector! (-> s4-0 local-sphere) 0.0 -1228.8 0.0 13926.4)
|
||||
(set-root-prim! s5-0 s4-0)
|
||||
)
|
||||
(set-root-prim! s5-0 s4-0))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root) s5-0)
|
||||
)
|
||||
(set! (-> this root) s5-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod get-unlit-skel ((this plat-eco))
|
||||
*plat-eco-unlit-sg*
|
||||
)
|
||||
*plat-eco-unlit-sg*)
|
||||
|
||||
(defmethod get-lit-skel ((this plat-eco))
|
||||
*plat-eco-lit-sg*
|
||||
)
|
||||
*plat-eco-lit-sg*)
|
||||
|
||||
(defmethod init-from-entity! ((this plat-eco) (arg0 entity-actor))
|
||||
(logior! (-> this mask) (process-mask platform))
|
||||
@@ -254,20 +183,16 @@
|
||||
(baseplat-method-24 this)
|
||||
(process-drawable-from-entity! this arg0)
|
||||
(let ((s4-0 (get-unlit-skel this))
|
||||
(s5-1 (get-lit-skel this))
|
||||
)
|
||||
(s5-1 (get-lit-skel this)))
|
||||
(initialize-skeleton this s4-0 '())
|
||||
(setup-lods! (-> this unlit-look) s4-0 (-> this draw art-group) (-> this entity))
|
||||
(setup-lods! (-> this lit-look) s5-1 (-> this draw art-group) (-> this entity))
|
||||
)
|
||||
(setup-lods! (-> this lit-look) s5-1 (-> this draw art-group) (-> this entity)))
|
||||
(logclear! (-> this mask) (process-mask actor-pause))
|
||||
(update-transforms! (-> this root))
|
||||
(set! (-> this part) (create-launch-control (-> *part-group-id-table* 107) this))
|
||||
(set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0))
|
||||
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
||||
(set! (-> this fact)
|
||||
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
|
||||
)
|
||||
(set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)))
|
||||
(load-params! (-> this sync) this (the-as uint 3000) 0.0 0.15 0.15)
|
||||
(set! (-> this sync-offset-dest) (-> this sync offset))
|
||||
(set! (-> this sync-linear-val) (get-phase-offset (-> this sync)))
|
||||
@@ -279,10 +204,7 @@
|
||||
(baseplat-method-26 this)
|
||||
(baseplat-method-21 this)
|
||||
(if (or (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
||||
(< (-> this notice-dist) 0.0)
|
||||
)
|
||||
(go (method-of-object this plat-path-active) (the-as plat #t))
|
||||
(go (method-of-object this plat-idle))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(< (-> this notice-dist) 0.0))
|
||||
(go (method-of-object this plat-path-active) (the-as plat #t))
|
||||
(go (method-of-object this plat-idle)))
|
||||
(none))
|
||||
@@ -1,139 +1,102 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/generic-obs.gc")
|
||||
(require "engine/geometry/path.gc")
|
||||
(require "engine/util/sync-info.gc")
|
||||
|
||||
;; name: plat.gc
|
||||
;; name in dgo: plat
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defpartgroup group-standard-plat
|
||||
:id 107
|
||||
:bounds (static-bspherem 0 -12 0 14)
|
||||
:parts ((sp-item 363 :fade-after (meters 60) :falloff-to (meters 60))
|
||||
(sp-item 364 :fade-after (meters 160) :falloff-to (meters 160))
|
||||
)
|
||||
)
|
||||
:parts
|
||||
((sp-item 363 :fade-after (meters 60) :falloff-to (meters 60))
|
||||
(sp-item 364 :fade-after (meters 160) :falloff-to (meters 160))))
|
||||
|
||||
(defpart 363
|
||||
:init-specs ((:num 1.5)
|
||||
(:y (meters 1))
|
||||
(:rot-x 5)
|
||||
(:r 5324.8)
|
||||
(:g 4096.0)
|
||||
(:b 3686.4)
|
||||
(:vel-y (meters 0.0033333334))
|
||||
(:fade-b -16.383999)
|
||||
(:timer (seconds 0.085))
|
||||
(:flags (aux-list))
|
||||
(:conerot-x (degrees 140) (degrees 40))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
(:conerot-radius (meters 3))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:num 1.5)
|
||||
(:y (meters 1))
|
||||
(:rot-x 5)
|
||||
(:r 5324.8)
|
||||
(:g 4096.0)
|
||||
(:b 3686.4)
|
||||
(:vel-y (meters 0.0033333334))
|
||||
(:fade-b -16.383999)
|
||||
(:timer (seconds 0.085))
|
||||
(:flags (aux-list))
|
||||
(:conerot-x (degrees 140) (degrees 40))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
(:conerot-radius (meters 3))))
|
||||
|
||||
(defpart 364
|
||||
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 2.0)
|
||||
(:y (meters 1.5))
|
||||
(:scale-x (meters 2) (meters 1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:g 0.0 64.0)
|
||||
(:b 128.0 128.0)
|
||||
(:a 16.0 32.0)
|
||||
(:vel-y (meters 0.01))
|
||||
(:fade-g -0.42666668)
|
||||
(:fade-a -0.32)
|
||||
(:accel-y (meters -0.000033333334))
|
||||
(:friction 0.96)
|
||||
(:timer (seconds 0.5))
|
||||
(:flags (bit2 bit3))
|
||||
(:conerot-x (degrees 130) (degrees 100.00001))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
(:conerot-radius (meters 3))
|
||||
)
|
||||
)
|
||||
:init-specs
|
||||
((:texture (new 'static 'texture-id :index #xf :page #x2))
|
||||
(:num 2.0)
|
||||
(:y (meters 1.5))
|
||||
(:scale-x (meters 2) (meters 1))
|
||||
(:scale-y :copy scale-x)
|
||||
(:g 0.0 64.0)
|
||||
(:b 128.0 128.0)
|
||||
(:a 16.0 32.0)
|
||||
(:vel-y (meters 0.01))
|
||||
(:fade-g -0.42666668)
|
||||
(:fade-a -0.32)
|
||||
(:accel-y (meters -0.000033333334))
|
||||
(:friction 0.96)
|
||||
(:timer (seconds 0.5))
|
||||
(:flags (bit2 bit3))
|
||||
(:conerot-x (degrees 130) (degrees 100.00001))
|
||||
(:conerot-y (degrees 0) (degrees 360))
|
||||
(:conerot-radius (meters 3))))
|
||||
|
||||
(deftype plat (baseplat)
|
||||
((path-pos float)
|
||||
(sync sync-info-eased :inline)
|
||||
(sound-id sound-id)
|
||||
)
|
||||
((path-pos float)
|
||||
(sync sync-info-eased :inline)
|
||||
(sound-id sound-id))
|
||||
(:methods
|
||||
(get-lit-skel (_type_) skeleton-group)
|
||||
(plat-method-28 () none)
|
||||
(wad () _type_ :state)
|
||||
(plat-startup (plat) _type_ :state)
|
||||
(plat-idle () _type_ :state)
|
||||
(plat-path-active (plat) _type_ :state)
|
||||
)
|
||||
)
|
||||
(get-lit-skel (_type_) skeleton-group)
|
||||
(plat-method-28 () none)
|
||||
(wad () _type_ :state)
|
||||
(plat-startup (plat) _type_ :state)
|
||||
(plat-idle () _type_ :state)
|
||||
(plat-path-active (plat) _type_ :state)))
|
||||
|
||||
(defskelgroup *plat-sg*
|
||||
plat
|
||||
plat-lod0-jg
|
||||
plat-idle-ja
|
||||
((plat-lod0-mg (meters 20)) (plat-lod1-mg (meters 40)) (plat-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3))
|
||||
|
||||
(defskelgroup *plat-sg* plat plat-lod0-jg plat-idle-ja
|
||||
((plat-lod0-mg (meters 20)) (plat-lod1-mg (meters 40)) (plat-lod2-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3)
|
||||
)
|
||||
(defskelgroup *plat-jungleb-sg*
|
||||
plat-jungleb
|
||||
plat-jungleb-lod0-jg
|
||||
plat-jungleb-idle-ja
|
||||
((plat-jungleb-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3))
|
||||
|
||||
(defskelgroup *plat-jungleb-sg* plat-jungleb plat-jungleb-lod0-jg plat-jungleb-idle-ja
|
||||
((plat-jungleb-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3)
|
||||
)
|
||||
|
||||
(defskelgroup *plat-sunken-sg* plat-sunken plat-sunken-lod0-jg plat-sunken-idle-ja
|
||||
((plat-sunken-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3.2)
|
||||
)
|
||||
(defskelgroup *plat-sunken-sg*
|
||||
plat-sunken
|
||||
plat-sunken-lod0-jg
|
||||
plat-sunken-idle-ja
|
||||
((plat-sunken-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 -0.5 0 3.2))
|
||||
|
||||
(defmethod get-unlit-skel ((this plat))
|
||||
(cond
|
||||
((= (-> (if (-> this entity)
|
||||
(-> this entity extra level)
|
||||
(-> *level* level-default)
|
||||
)
|
||||
name
|
||||
)
|
||||
'jungleb
|
||||
)
|
||||
*plat-jungleb-sg*
|
||||
)
|
||||
((or (= (-> (if (-> this entity)
|
||||
(-> this entity extra level)
|
||||
(-> *level* level-default)
|
||||
)
|
||||
name
|
||||
)
|
||||
'sunken
|
||||
)
|
||||
(= (-> (if (-> this entity)
|
||||
(-> this entity extra level)
|
||||
(-> *level* level-default)
|
||||
)
|
||||
name
|
||||
)
|
||||
'sunkenb
|
||||
)
|
||||
)
|
||||
*plat-sunken-sg*
|
||||
)
|
||||
(else
|
||||
*plat-sg*
|
||||
)
|
||||
)
|
||||
)
|
||||
((= (-> (if (-> this entity) (-> this entity extra level) (-> *level* level-default)) name) 'jungleb) *plat-jungleb-sg*)
|
||||
((or (= (-> (if (-> this entity) (-> this entity extra level) (-> *level* level-default)) name) 'sunken)
|
||||
(= (-> (if (-> this entity) (-> this entity extra level) (-> *level* level-default)) name) 'sunkenb))
|
||||
*plat-sunken-sg*)
|
||||
(else *plat-sg*)))
|
||||
|
||||
(defmethod baseplat-method-24 ((this plat))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s5-0 1)
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
||||
@@ -142,103 +105,74 @@
|
||||
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s4-0 transform-index) 0)
|
||||
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13107.2)
|
||||
(set-root-prim! s5-0 s4-0)
|
||||
)
|
||||
(set-root-prim! s5-0 s4-0))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root) s5-0)
|
||||
)
|
||||
(set! (-> this root) s5-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod baseplat-method-26 ((this plat))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod baseplat-method-25 ((this plat))
|
||||
(the-as sparticle-launch-group (when (!= (-> (if (-> this entity)
|
||||
(-> this entity extra level)
|
||||
(-> *level* level-default)
|
||||
)
|
||||
name
|
||||
)
|
||||
'maincave
|
||||
)
|
||||
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 107) this)))
|
||||
(set! (-> this part) v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as sparticle-launch-group
|
||||
(when (!= (-> (if (-> this entity) (-> this entity extra level) (-> *level* level-default)) name) 'maincave)
|
||||
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 107) this))) (set! (-> this part) v0-0) v0-0))))
|
||||
|
||||
(defstate plat-startup (plat)
|
||||
:virtual #t
|
||||
:code (behavior ((arg0 plat))
|
||||
(cond
|
||||
((logtest? (-> self path flags) (path-control-flag not-found))
|
||||
(go-virtual plat-idle)
|
||||
)
|
||||
((> (-> self sync period) 0)
|
||||
(go-virtual plat-path-active arg0)
|
||||
)
|
||||
(else
|
||||
(go-virtual plat-idle)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ((arg0 plat))
|
||||
(cond
|
||||
((logtest? (-> self path flags) (path-control-flag not-found)) (go-virtual plat-idle))
|
||||
((> (-> self sync period) 0) (go-virtual plat-path-active arg0))
|
||||
(else (go-virtual plat-idle)))))
|
||||
|
||||
(defstate plat-idle (plat)
|
||||
:virtual #t
|
||||
:event plat-event
|
||||
:trans (behavior ()
|
||||
(baseplat-method-20 self)
|
||||
)
|
||||
:code (behavior ()
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(suspend)
|
||||
(loop
|
||||
(when (not (-> self bouncing))
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(logior! (-> self mask) (process-mask sleep-code))
|
||||
(suspend)
|
||||
0
|
||||
)
|
||||
(while (-> self bouncing)
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(baseplat-method-20 self))
|
||||
:code
|
||||
(behavior ()
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(suspend)
|
||||
(loop
|
||||
(when (not (-> self bouncing))
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(logior! (-> self mask) (process-mask sleep-code))
|
||||
(suspend)
|
||||
0)
|
||||
(while (-> self bouncing)
|
||||
(plat-trans)
|
||||
(rider-post)
|
||||
(suspend)))))
|
||||
|
||||
(defstate plat-path-active (plat)
|
||||
:virtual #t
|
||||
:event plat-event
|
||||
:exit (behavior ()
|
||||
(sound-stop (-> self sound-id))
|
||||
)
|
||||
:trans (behavior ()
|
||||
(set! (-> self path-pos) (if (logtest? (-> self fact options) (fact-options wrap-phase))
|
||||
(get-current-phase (-> self sync))
|
||||
(get-current-phase-with-mirror (-> self sync))
|
||||
)
|
||||
)
|
||||
(eval-path-curve! (-> self path) (-> self basetrans) (-> self path-pos) 'interp)
|
||||
(if (< (vector-vector-distance (-> self root trans) (ear-trans)) 81920.0)
|
||||
(sound-play "eco-plat-hover" :id (-> self sound-id) :position (the-as symbol (-> self root trans)))
|
||||
)
|
||||
(plat-trans)
|
||||
)
|
||||
:code (the-as (function plat object) anim-loop)
|
||||
:post plat-post
|
||||
)
|
||||
:exit
|
||||
(behavior ()
|
||||
(sound-stop (-> self sound-id)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(set! (-> self path-pos)
|
||||
(if (logtest? (-> self fact options) (fact-options wrap-phase))
|
||||
(get-current-phase (-> self sync))
|
||||
(get-current-phase-with-mirror (-> self sync))))
|
||||
(eval-path-curve! (-> self path) (-> self basetrans) (-> self path-pos) 'interp)
|
||||
(if (< (vector-vector-distance (-> self root trans) (ear-trans)) 81920.0)
|
||||
(sound-play "eco-plat-hover" :id (-> self sound-id) :position (the-as symbol (-> self root trans))))
|
||||
(plat-trans))
|
||||
:code
|
||||
(the-as (function plat object)
|
||||
anim-loop)
|
||||
:post plat-post)
|
||||
|
||||
(defmethod init-from-entity! ((this plat) (arg0 entity-actor))
|
||||
(logior! (-> this mask) (process-mask platform))
|
||||
@@ -250,40 +184,23 @@
|
||||
(baseplat-method-21 this)
|
||||
(baseplat-method-25 this)
|
||||
(load-params! (-> this sync) this (the-as uint 0) 0.0 0.15 0.15)
|
||||
(set! (-> this fact)
|
||||
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
|
||||
)
|
||||
(set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)))
|
||||
(set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0))
|
||||
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
||||
(set! (-> this sound-id) (new-sound-id))
|
||||
(cond
|
||||
((logtest? (-> this path flags) (path-control-flag not-found))
|
||||
(set! (-> this path-pos) 0.0)
|
||||
(let ((a0-14 this))
|
||||
(baseplat-method-26 a0-14)
|
||||
(go (method-of-object this plat-startup) a0-14)
|
||||
)
|
||||
)
|
||||
(let ((a0-14 this)) (baseplat-method-26 a0-14) (go (method-of-object this plat-startup) a0-14)))
|
||||
((> (-> this sync period) 0)
|
||||
(set! (-> this path-pos) (if (logtest? (-> this fact options) (fact-options wrap-phase))
|
||||
(get-current-phase (-> this sync))
|
||||
(get-current-phase-with-mirror (-> this sync))
|
||||
)
|
||||
)
|
||||
(set! (-> this path-pos)
|
||||
(if (logtest? (-> this fact options) (fact-options wrap-phase))
|
||||
(get-current-phase (-> this sync))
|
||||
(get-current-phase-with-mirror (-> this sync))))
|
||||
(eval-path-curve! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
||||
(let ((a0-18 this))
|
||||
(baseplat-method-26 a0-18)
|
||||
(go (method-of-object this plat-startup) a0-18)
|
||||
)
|
||||
)
|
||||
(let ((a0-18 this)) (baseplat-method-26 a0-18) (go (method-of-object this plat-startup) a0-18)))
|
||||
(else
|
||||
(set! (-> this path-pos) 0.0)
|
||||
(eval-path-curve! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
||||
(let ((a0-20 this))
|
||||
(baseplat-method-26 a0-20)
|
||||
(go (method-of-object this plat-startup) a0-20)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(set! (-> this path-pos) 0.0)
|
||||
(eval-path-curve! (-> this path) (-> this root trans) (-> this path-pos) 'interp)
|
||||
(let ((a0-20 this)) (baseplat-method-26 a0-20) (go (method-of-object this plat-startup) a0-20))))
|
||||
(none))
|
||||
@@ -1,114 +1,74 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/gfx/hw/display-h.gc")
|
||||
(require "engine/anim/joint-h.gc")
|
||||
(require "engine/game/game-h.gc")
|
||||
|
||||
;; name: process-drawable-h.gc
|
||||
;; name in dgo: process-drawable-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define-extern cspace-index-by-name (function process-drawable string int))
|
||||
|
||||
(define-extern cspace-by-name (function process-drawable string cspace))
|
||||
|
||||
(define-extern joint-control-reset! (function joint-control joint-control-channel none :behavior process-drawable))
|
||||
|
||||
(defun cspace-by-name-no-fail ((arg0 process-drawable) (arg1 string))
|
||||
"Get a cspace by name from the given process-drawable. If it fails, print an error and return the first one"
|
||||
(let ((result (cspace-by-name arg0 arg1)))
|
||||
(cond
|
||||
(result
|
||||
result
|
||||
)
|
||||
(else
|
||||
(format 0 "no cspace (~A)~%" arg1)
|
||||
(-> arg0 node-list data 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(result result)
|
||||
(else (format 0 "no cspace (~A)~%" arg1) (-> arg0 node-list data 0)))))
|
||||
|
||||
(defun cspace-index-by-name-no-fail ((arg0 process-drawable) (arg1 string))
|
||||
"Get the index of a cspace by name from the given process drawable. If it fails, print an error and return 0."
|
||||
(let ((v0-0 (cspace-index-by-name arg0 arg1)))
|
||||
(cond
|
||||
((< v0-0 0)
|
||||
(format 0 "no cspace[ndx] (~A)~%" arg1)
|
||||
0
|
||||
)
|
||||
(else
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
((< v0-0 0) (format 0 "no cspace[ndx] (~A)~%" arg1) 0)
|
||||
(else v0-0))))
|
||||
|
||||
;; The following functions can be applied to a joint-control-channel to change the frame number.
|
||||
;; They return the resulting frame number as well.
|
||||
|
||||
(defun num-func-none ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Don't change anything."
|
||||
(-> arg0 frame-num)
|
||||
)
|
||||
(-> arg0 frame-num))
|
||||
|
||||
(defun num-func-+! ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Increment the frame number, taking into account the animation speed and current game rate."
|
||||
(let ((f0-1 (+ (-> arg0 frame-num) (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))))))
|
||||
(set! (-> arg0 frame-num) f0-1)
|
||||
f0-1
|
||||
)
|
||||
)
|
||||
f0-1))
|
||||
|
||||
(defun num-func--! ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Decrement the frame number, taking into account the animation speed and current game rate."
|
||||
(let ((f0-1 (- (-> arg0 frame-num) (* arg1 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))))))
|
||||
(set! (-> arg0 frame-num) f0-1)
|
||||
f0-1
|
||||
)
|
||||
)
|
||||
f0-1))
|
||||
|
||||
(defun num-func-loop! ((chan joint-control-channel) (inc float) (arg2 float))
|
||||
"Like num-func-+!, but will wrap to 0 after going past the end."
|
||||
|
||||
;; get the duration from the joint-animation-compressed.
|
||||
(let* ((duration (the float (+ (-> chan frame-group data 0 length) -1)))
|
||||
;; increment (also add a full duration to it, I guess to avoid issues if inc is negative and we're near the start.)
|
||||
(after-inc
|
||||
(+ (-> chan frame-num) duration (* inc (* (-> chan frame-group speed) (-> *display* time-adjust-ratio))))
|
||||
)
|
||||
(after-inc (+ (-> chan frame-num) duration (* inc (* (-> chan frame-group speed) (-> *display* time-adjust-ratio)))))
|
||||
;; wrap.
|
||||
(wrapped (- after-inc (* (the float (the int (/ after-inc duration))) duration)))
|
||||
)
|
||||
(wrapped (- after-inc (* (the float (the int (/ after-inc duration))) duration))))
|
||||
(set! (-> chan frame-num) wrapped)
|
||||
wrapped
|
||||
)
|
||||
)
|
||||
wrapped))
|
||||
|
||||
(defun num-func-seek! ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Seek toward arg1 by at most arg2 (taking into account speed etc)"
|
||||
(let ((f0-3
|
||||
(seek (-> arg0 frame-num) arg1 (* arg2 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))))
|
||||
)
|
||||
)
|
||||
(let ((f0-3 (seek (-> arg0 frame-num) arg1 (* arg2 (* (-> arg0 frame-group speed) (-> *display* time-adjust-ratio))))))
|
||||
;; set it twice, just to make sure.
|
||||
(set! (-> arg0 frame-num) f0-3)
|
||||
(set! (-> arg0 frame-num) f0-3)
|
||||
f0-3
|
||||
)
|
||||
)
|
||||
f0-3))
|
||||
|
||||
(defun num-func-blend-in! ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Seek frame-interp toward 1. Once its there, do a joint-control-reset."
|
||||
(let ((f30-0 (seek (-> arg0 frame-interp) 1.0 (* arg1 (-> *display* time-adjust-ratio)))))
|
||||
(set! (-> arg0 frame-interp) f30-0)
|
||||
(set! (-> arg0 frame-interp) f30-0)
|
||||
(if (= f30-0 1.0)
|
||||
(joint-control-reset! (-> arg0 parent) arg0)
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
)
|
||||
(if (= f30-0 1.0) (joint-control-reset! (-> arg0 parent) arg0))
|
||||
f30-0))
|
||||
|
||||
(defun num-func-chan ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"Copies the frame number from the channel arg1."
|
||||
@@ -120,22 +80,14 @@
|
||||
(+ (the-as uint arg0)
|
||||
(the-as uint
|
||||
;; 48 * (difference in indices)
|
||||
(* 48 (- (the int arg1) (-> arg0 group-sub-index))))
|
||||
)
|
||||
)
|
||||
frame-num
|
||||
)
|
||||
)
|
||||
)
|
||||
(* 48 (- (the int arg1) (-> arg0 group-sub-index))))))
|
||||
frame-num)))
|
||||
(set! (-> arg0 frame-num) f0-2)
|
||||
f0-2
|
||||
)
|
||||
)
|
||||
f0-2))
|
||||
|
||||
(defun num-func-identity ((arg0 joint-control-channel) (arg1 float) (arg2 float))
|
||||
"seems to be the same thing as none."
|
||||
(-> arg0 frame-num)
|
||||
)
|
||||
(-> arg0 frame-num))
|
||||
|
||||
(defenum entity-perm-status
|
||||
:bitfield #t
|
||||
@@ -150,33 +102,19 @@
|
||||
(bit-7 7)
|
||||
(real-complete 8)
|
||||
(bit-9 9)
|
||||
(bit-10 10)
|
||||
)
|
||||
(bit-10 10))
|
||||
|
||||
(define-extern process-entity-status! (function process entity-perm-status symbol int))
|
||||
|
||||
(defmacro ja-group (&key (chan 0))
|
||||
"get the frame group for self. default channel is 0, the base channel. returns #f if no frame group."
|
||||
`(if (> (-> self skel active-channels) ,chan)
|
||||
(-> self skel root-channel ,chan frame-group))
|
||||
)
|
||||
`(if (> (-> self skel active-channels) ,chan) (-> self skel root-channel ,chan frame-group)))
|
||||
|
||||
(defmacro ja-group? (group &key (chan 0))
|
||||
"is self in this frame group on this channel? default is channel 0, which is the base channel."
|
||||
`(= (ja-group) ,group)
|
||||
)
|
||||
`(= (ja-group) ,group))
|
||||
|
||||
(defmacro ja (&key (chan 0)
|
||||
&key (group! #f)
|
||||
&key (num! #f)
|
||||
&key (param0 #f)
|
||||
&key (param1 #f)
|
||||
&key (num-func #f)
|
||||
&key (frame-num #f)
|
||||
&key (frame-interp #f)
|
||||
&key (dist #f)
|
||||
&key (eval? #t)
|
||||
)
|
||||
(defmacro ja (&key (chan 0) &key (group! #f) &key (num! #f) &key (param0 #f) &key (param1 #f) &key (num-func #f) &key (frame-num #f) &key (frame-interp #f) &key (dist #f) &key (eval? #t))
|
||||
"set various joint anim parameters for self and eval them.
|
||||
you can use this for playing animations!
|
||||
|
||||
@@ -205,53 +143,45 @@
|
||||
- min = the start of the animation.
|
||||
- max = the end of the animation.
|
||||
"
|
||||
|
||||
(let* ((num-args (if (pair? num!) (cdr num!) '()))
|
||||
(num! (if (pair? num!) (car num!) num!))
|
||||
(nf (cond
|
||||
((or (eq? num! 'identity)
|
||||
(eq? num! 'min)
|
||||
(eq? num! 'max)
|
||||
)
|
||||
'num-func-identity)
|
||||
((eq? num! 'none) 'num-func-none)
|
||||
((eq? num! '+!) 'num-func-+!)
|
||||
((eq? num! '-!) 'num-func--!)
|
||||
((eq? num! 'seek!) 'num-func-seek!)
|
||||
((eq? num! 'loop!) 'num-func-loop!)
|
||||
((eq? num! 'blend-in!) 'num-func-blend-in!)
|
||||
((eq? num! 'chan) 'num-func-chan)
|
||||
))
|
||||
(p0 (if param0 param0
|
||||
(cond
|
||||
((eq? num! 'chan) `(the float ,(car num-args)))
|
||||
((eq? num! '+!) (if (null? num-args) 1.0 (car num-args)))
|
||||
((eq? num! '-!) (if (null? num-args) 1.0 (car num-args)))
|
||||
((eq? num! 'loop!) (if (null? num-args) 1.0 (if (eq? 'max (car num-args))
|
||||
(if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length)))
|
||||
)
|
||||
(car num-args))))
|
||||
((eq? num! 'seek!) (if (or (null? num-args) (eq? (car num-args) 'max))
|
||||
(if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length)))
|
||||
)
|
||||
(car num-args)))
|
||||
)))
|
||||
(p1 (if param1 param1
|
||||
(cond
|
||||
((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args)))
|
||||
)))
|
||||
(frame-num (if (eq? 'max frame-num) (if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length)))
|
||||
)
|
||||
frame-num))
|
||||
(frame-group (if (or p0 p1 frame-num (not nf)) group! #f))
|
||||
)
|
||||
`(let ((ja-ch (-> self skel root-channel ,chan)))
|
||||
(num! (if (pair? num!) (car num!) num!))
|
||||
(nf (cond
|
||||
((or (eq? num! 'identity) (eq? num! 'min) (eq? num! 'max)) 'num-func-identity)
|
||||
((eq? num! 'none) 'num-func-none)
|
||||
((eq? num! '+!) 'num-func-+!)
|
||||
((eq? num! '-!) 'num-func--!)
|
||||
((eq? num! 'seek!) 'num-func-seek!)
|
||||
((eq? num! 'loop!) 'num-func-loop!)
|
||||
((eq? num! 'blend-in!) 'num-func-blend-in!)
|
||||
((eq? num! 'chan) 'num-func-chan)))
|
||||
(p0 (if param0
|
||||
param0
|
||||
(cond
|
||||
((eq? num! 'chan) `(the float ,(car num-args)))
|
||||
((eq? num! '+!) (if (null? num-args) 1.0 (car num-args)))
|
||||
((eq? num! '-!) (if (null? num-args) 1.0 (car num-args)))
|
||||
((eq? num! 'loop!)
|
||||
(if (null? num-args)
|
||||
1.0
|
||||
(if (eq? 'max (car num-args))
|
||||
(if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length))))
|
||||
(car num-args))))
|
||||
((eq? num! 'seek!)
|
||||
(if (or (null? num-args) (eq? (car num-args) 'max))
|
||||
(if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length))))
|
||||
(car num-args))))))
|
||||
(p1 (if param1 param1 (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))))))
|
||||
(frame-num (if (eq? 'max frame-num)
|
||||
(if group!
|
||||
`(the float (1- (-> (the art-joint-anim ,group!) data 0 length)))
|
||||
`(the float (1- (-> ja-ch frame-group data 0 length))))
|
||||
frame-num))
|
||||
(frame-group (if (or p0 p1 frame-num (not nf)) group! #f)))
|
||||
`(let ((ja-ch (-> self skel root-channel ,chan)))
|
||||
,(if frame-interp `(set! (-> ja-ch frame-interp) ,frame-interp) `(none))
|
||||
,(if dist `(set! (-> ja-ch dist) ,dist) `(none))
|
||||
,(if frame-group `(set! (-> ja-ch frame-group) (the art-joint-anim ,frame-group)) `(none))
|
||||
@@ -260,30 +190,25 @@
|
||||
,(if num-func `(set! (-> ja-ch num-func) ,num-func) `(none))
|
||||
,(if frame-num `(set! (-> ja-ch frame-num) ,frame-num) `(none))
|
||||
,(if nf
|
||||
`(,(if eval? 'joint-control-channel-group-eval! 'joint-control-channel-group!)
|
||||
ja-ch (the art-joint-anim ,group!) ,nf)
|
||||
`(none))
|
||||
`(,(if eval? 'joint-control-channel-group-eval! 'joint-control-channel-group!) ja-ch (the art-joint-anim ,group!) ,nf)
|
||||
`(none))
|
||||
,(cond
|
||||
((eq? num! 'min) `(set! (-> ja-ch frame-num) 0.0))
|
||||
((eq? num! 'max) (if group!
|
||||
`(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) data 0 length))))
|
||||
`(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group data 0 length))))
|
||||
))
|
||||
((eq? num! 'max)
|
||||
(if group!
|
||||
`(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) data 0 length))))
|
||||
`(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group data 0 length))))))
|
||||
((eq? num! 'identity) `(set! (-> ja-ch frame-num) ,(car num-args)))
|
||||
(#t `(none))
|
||||
)
|
||||
))
|
||||
)
|
||||
(#t `(none))))))
|
||||
|
||||
(defmacro ja-no-eval (&key (chan 0)
|
||||
&key (group! #f)
|
||||
&key (num! #f)
|
||||
&key (param0 #f)
|
||||
&key (param1 #f)
|
||||
&key (num-func #f)
|
||||
&key (frame-num #f)
|
||||
&key (frame-interp #f)
|
||||
&key (dist #f)
|
||||
)
|
||||
`(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :num-func ,num-func :frame-num ,frame-num :frame-interp ,frame-interp :dist ,dist)
|
||||
)
|
||||
(defmacro ja-no-eval (&key (chan 0) &key (group! #f) &key (num! #f) &key (param0 #f) &key (param1 #f) &key (num-func #f) &key (frame-num #f) &key (frame-interp #f) &key (dist #f))
|
||||
`(ja :eval? #f
|
||||
:chan ,chan
|
||||
:group! ,group!
|
||||
:num! ,num!
|
||||
:param0 ,param0
|
||||
:param1 ,param1
|
||||
:num-func ,num-func
|
||||
:frame-num ,frame-num
|
||||
:frame-interp ,frame-interp
|
||||
:dist ,dist))
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,58 +1,47 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: rigid-body-h.gc
|
||||
;; name in dgo: rigid-body-h
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype rigid-body (structure)
|
||||
((mass float)
|
||||
(inv-mass float)
|
||||
(lin-momentum-damping-factor float)
|
||||
(ang-momentum-damping-factor float)
|
||||
(inertial-tensor matrix :inline)
|
||||
(inv-inertial-tensor matrix :inline)
|
||||
(cm-offset-joint vector :inline)
|
||||
(position vector :inline)
|
||||
(rotation quaternion :inline)
|
||||
(lin-momentum vector :inline)
|
||||
(ang-momentum vector :inline)
|
||||
(lin-velocity vector :inline)
|
||||
(ang-velocity vector :inline)
|
||||
(inv-i-world matrix :inline)
|
||||
(matrix matrix :inline)
|
||||
(force vector :inline)
|
||||
(torque vector :inline)
|
||||
(max-ang-momentum float)
|
||||
(max-ang-velocity float)
|
||||
)
|
||||
((mass float)
|
||||
(inv-mass float)
|
||||
(lin-momentum-damping-factor float)
|
||||
(ang-momentum-damping-factor float)
|
||||
(inertial-tensor matrix :inline)
|
||||
(inv-inertial-tensor matrix :inline)
|
||||
(cm-offset-joint vector :inline)
|
||||
(position vector :inline)
|
||||
(rotation quaternion :inline)
|
||||
(lin-momentum vector :inline)
|
||||
(ang-momentum vector :inline)
|
||||
(lin-velocity vector :inline)
|
||||
(ang-velocity vector :inline)
|
||||
(inv-i-world matrix :inline)
|
||||
(matrix matrix :inline)
|
||||
(force vector :inline)
|
||||
(torque vector :inline)
|
||||
(max-ang-momentum float)
|
||||
(max-ang-velocity float))
|
||||
(:methods
|
||||
(rigid-body-method-9 (_type_ float float float float) none)
|
||||
(rigid-body-method-10 (_type_ float) none)
|
||||
(clear-force-torque! (_type_) none)
|
||||
(clear-momentum! (_type_) none)
|
||||
(rigid-body-method-13 (_type_ vector vector) none)
|
||||
(rigid-body-method-14 (_type_ vector vector) none)
|
||||
(rigid-body-method-15 (_type_ vector) none)
|
||||
(rigid-body-method-16 (_type_ vector vector float) none)
|
||||
(rigid-body-method-17 (_type_ vector vector) vector)
|
||||
(rigid-body-method-18 (_type_ vector) vector)
|
||||
(print-stats (_type_) none)
|
||||
(rigid-body-method-20 (_type_) none)
|
||||
(rigid-body-method-21 (_type_) none)
|
||||
(rigid-body-method-22 (_type_ vector quaternion float float) none)
|
||||
)
|
||||
)
|
||||
|
||||
(rigid-body-method-9 (_type_ float float float float) none)
|
||||
(rigid-body-method-10 (_type_ float) none)
|
||||
(clear-force-torque! (_type_) none)
|
||||
(clear-momentum! (_type_) none)
|
||||
(rigid-body-method-13 (_type_ vector vector) none)
|
||||
(rigid-body-method-14 (_type_ vector vector) none)
|
||||
(rigid-body-method-15 (_type_ vector) none)
|
||||
(rigid-body-method-16 (_type_ vector vector float) none)
|
||||
(rigid-body-method-17 (_type_ vector vector) vector)
|
||||
(rigid-body-method-18 (_type_ vector) vector)
|
||||
(print-stats (_type_) none)
|
||||
(rigid-body-method-20 (_type_) none)
|
||||
(rigid-body-method-21 (_type_) none)
|
||||
(rigid-body-method-22 (_type_ vector quaternion float float) none)))
|
||||
|
||||
(deftype rigid-body-control-point (structure)
|
||||
((local-pos vector :inline)
|
||||
(world-pos vector :inline)
|
||||
(velocity vector :inline)
|
||||
)
|
||||
)
|
||||
((local-pos vector :inline)
|
||||
(world-pos vector :inline)
|
||||
(velocity vector :inline)))
|
||||
@@ -1,14 +1,10 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/generic-obs.gc")
|
||||
(require "engine/common-obs/water-anim.gc")
|
||||
(require "engine/common-obs/rigid-body-h.gc")
|
||||
|
||||
;; name: rigid-body.gc
|
||||
;; name in dgo: rigid-body
|
||||
;; dgos: GAME, COMMON, L1
|
||||
;; note: changed for high fps
|
||||
|
||||
;; DECOMP BEGINS
|
||||
@@ -17,22 +13,19 @@
|
||||
(set! (-> this force quad) (-> *null-vector* quad))
|
||||
(set! (-> this torque quad) (-> *null-vector* quad))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod clear-momentum! ((this rigid-body))
|
||||
(set! (-> this lin-momentum quad) (-> *null-vector* quad))
|
||||
(set! (-> this ang-momentum quad) (-> *null-vector* quad))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-21 ((this rigid-body))
|
||||
(quaternion->matrix (-> this matrix) (-> this rotation))
|
||||
(rigid-body-method-18 this (-> this matrix vector 3))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-22 ((this rigid-body) (arg0 vector) (arg1 quaternion) (arg2 float) (arg3 float))
|
||||
(clear-force-torque! this)
|
||||
@@ -52,78 +45,48 @@
|
||||
(set! (-> this max-ang-velocity) 0.0)
|
||||
(set! (-> this max-ang-momentum) 0.0)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-9 ((this rigid-body) (arg0 float) (arg1 float) (arg2 float) (arg3 float))
|
||||
(set! (-> this mass) arg0)
|
||||
(let ((f0-1 arg0))
|
||||
(set! (-> this inv-mass) (/ 1.0 f0-1))
|
||||
)
|
||||
(let ((f0-1 arg0)) (set! (-> this inv-mass) (/ 1.0 f0-1)))
|
||||
(matrix-identity! (-> this inertial-tensor))
|
||||
(matrix-identity! (-> this inv-inertial-tensor))
|
||||
(let* ((f0-4 arg0)
|
||||
(f1-1 12.0)
|
||||
(f0-5 (* f0-4 (/ 1.0 f1-1)))
|
||||
)
|
||||
(f0-5 (* f0-4 (/ 1.0 f1-1))))
|
||||
(let* ((f1-4 arg2)
|
||||
(f1-6 (* f1-4 f1-4))
|
||||
(f2-1 arg3)
|
||||
)
|
||||
(set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1))))
|
||||
)
|
||||
(f2-1 arg3))
|
||||
(set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1)))))
|
||||
(let* ((f1-9 arg1)
|
||||
(f1-11 (* f1-9 f1-9))
|
||||
(f2-4 arg3)
|
||||
)
|
||||
(set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4))))
|
||||
)
|
||||
(f2-4 arg3))
|
||||
(set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4)))))
|
||||
(let* ((f1-14 arg1)
|
||||
(f1-16 (* f1-14 f1-14))
|
||||
(f2-7 arg2)
|
||||
)
|
||||
(set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7))))
|
||||
)
|
||||
)
|
||||
(let ((f0-7 (-> this inertial-tensor vector 0 x)))
|
||||
(set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7))
|
||||
)
|
||||
(let ((f0-10 (-> this inertial-tensor vector 1 y)))
|
||||
(set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-10))
|
||||
)
|
||||
(let ((f0-13 (-> this inertial-tensor vector 2 z)))
|
||||
(set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-13))
|
||||
)
|
||||
(f2-7 arg2))
|
||||
(set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7))))))
|
||||
(let ((f0-7 (-> this inertial-tensor vector 0 x))) (set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7)))
|
||||
(let ((f0-10 (-> this inertial-tensor vector 1 y))) (set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-10)))
|
||||
(let ((f0-13 (-> this inertial-tensor vector 2 z))) (set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-13)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-17 ((this rigid-body) (arg0 vector) (arg1 vector))
|
||||
(let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position))))
|
||||
(vector-cross! arg1 (-> this ang-velocity) v1-1)
|
||||
)
|
||||
(vector-cross! arg1 (-> this ang-velocity) v1-1))
|
||||
(vector+! arg1 arg1 (-> this lin-velocity))
|
||||
arg1
|
||||
)
|
||||
arg1)
|
||||
|
||||
(defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix))
|
||||
(let ((s2-0 (new 'stack-no-clear 'matrix))
|
||||
(s3-0 (new 'stack-no-clear 'matrix))
|
||||
)
|
||||
(s3-0 (new 'stack-no-clear 'matrix)))
|
||||
(matrix-transpose! s2-0 arg1)
|
||||
(cond
|
||||
(#t
|
||||
(matrix*! s3-0 arg1 arg2)
|
||||
(matrix*! arg0 s3-0 s2-0)
|
||||
)
|
||||
(else
|
||||
(matrix*! s3-0 s2-0 arg2)
|
||||
(matrix*! arg0 s3-0 arg1)
|
||||
)
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(#t (matrix*! s3-0 arg1 arg2) (matrix*! arg0 s3-0 s2-0))
|
||||
(else (matrix*! s3-0 s2-0 arg2) (matrix*! arg0 s3-0 arg1))))
|
||||
arg0)
|
||||
|
||||
(defmethod rigid-body-method-10 ((this rigid-body) (arg0 float))
|
||||
(vector+*! (-> this lin-momentum) (-> this lin-momentum) (-> this force) arg0)
|
||||
@@ -143,276 +106,206 @@
|
||||
(+! (-> this rotation x) (* (-> s4-0 x) arg0))
|
||||
(+! (-> this rotation y) (* (-> s4-0 y) arg0))
|
||||
(+! (-> this rotation z) (* (-> s4-0 z) arg0))
|
||||
(+! (-> this rotation w) (* (-> s4-0 w) arg0))
|
||||
)
|
||||
(+! (-> this rotation w) (* (-> s4-0 w) arg0)))
|
||||
(quaternion-normalize! (-> this rotation))
|
||||
(quaternion->matrix (-> this matrix) (-> this rotation))
|
||||
(rigid-body-method-18 this (-> this matrix vector 3))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-13 ((this rigid-body) (arg0 vector) (arg1 vector))
|
||||
(vector+! (-> this force) (-> this force) arg1)
|
||||
(let* ((v1-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position)))
|
||||
(a1-2 (vector-cross! (new 'stack-no-clear 'vector) v1-2 arg1))
|
||||
)
|
||||
(vector+! (-> this torque) (-> this torque) a1-2)
|
||||
)
|
||||
(a1-2 (vector-cross! (new 'stack-no-clear 'vector) v1-2 arg1)))
|
||||
(vector+! (-> this torque) (-> this torque) a1-2))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-16 ((this rigid-body) (arg0 vector) (arg1 vector) (arg2 float))
|
||||
(vector+! (-> this force) (-> this force) arg1)
|
||||
(let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position)))
|
||||
(s4-1 (vector-cross! (new 'stack-no-clear 'vector) a0-3 arg1))
|
||||
)
|
||||
(let ((f0-0 (vector-length a0-3)))
|
||||
(if (< arg2 f0-0)
|
||||
(vector-float*! s4-1 s4-1 (/ arg2 f0-0))
|
||||
)
|
||||
)
|
||||
(vector+! (-> this torque) (-> this torque) s4-1)
|
||||
)
|
||||
(s4-1 (vector-cross! (new 'stack-no-clear 'vector) a0-3 arg1)))
|
||||
(let ((f0-0 (vector-length a0-3))) (if (< arg2 f0-0) (vector-float*! s4-1 s4-1 (/ arg2 f0-0))))
|
||||
(vector+! (-> this torque) (-> this torque) s4-1))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-14 ((this rigid-body) (arg0 vector) (arg1 vector))
|
||||
(let ((s5-0 (new 'stack-no-clear 'vector))
|
||||
(s4-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(s4-0 (new 'stack-no-clear 'vector)))
|
||||
(vector-rotate*! s4-0 arg1 (-> this matrix))
|
||||
(vector-rotate*! s5-0 arg0 (-> this matrix))
|
||||
(vector+! s5-0 s5-0 (-> this position))
|
||||
(rigid-body-method-13 this s5-0 s4-0)
|
||||
)
|
||||
(rigid-body-method-13 this s5-0 s4-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-15 ((this rigid-body) (arg0 vector))
|
||||
(vector+! (-> this force) (-> this force) arg0)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-18 ((this rigid-body) (arg0 vector))
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(vector-rotate*! gp-0 (-> this cm-offset-joint) (-> this matrix))
|
||||
(vector-! arg0 (-> this position) gp-0)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(vector-! arg0 (-> this position) gp-0))
|
||||
arg0)
|
||||
|
||||
(defmethod print-stats ((this rigid-body))
|
||||
(format #t " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z))
|
||||
(format #t " torque ~f ~f ~f~%" (-> this torque x) (-> this torque y) (-> this torque z))
|
||||
(format #t " position ~M ~M ~M" (-> this position x) (-> this position y) (-> this position z))
|
||||
(format
|
||||
#t
|
||||
" rotation ~f ~f ~f ~f~%"
|
||||
(-> this rotation x)
|
||||
(-> this rotation y)
|
||||
(-> this rotation z)
|
||||
(-> this rotation w)
|
||||
)
|
||||
(format #t
|
||||
" rotation ~f ~f ~f ~f~%"
|
||||
(-> this rotation x)
|
||||
(-> this rotation y)
|
||||
(-> this rotation z)
|
||||
(-> this rotation w))
|
||||
(format #t " lin-mom ~M ~M ~M" (-> this lin-momentum x) (-> this lin-momentum y) (-> this lin-momentum z))
|
||||
(format #t " ang-mom ~f ~f ~f~%" (-> this ang-momentum x) (-> this ang-momentum y) (-> this ang-momentum z))
|
||||
(format #t " lin-vel ~M ~M ~M" (-> this lin-velocity x) (-> this lin-velocity y) (-> this lin-velocity z))
|
||||
(format #t " ang-vel ~f ~f ~f~%" (-> this ang-velocity x) (-> this ang-velocity y) (-> this ang-velocity z))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-method-20 ((this rigid-body))
|
||||
(format #t " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z))
|
||||
(format #t " torque ~f ~f ~f~%" (-> this torque x) (-> this torque y) (-> this torque z))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(deftype rigid-body-platform-constants (structure)
|
||||
((drag-factor float)
|
||||
(buoyancy-factor float)
|
||||
(max-buoyancy-depth meters)
|
||||
(gravity-factor float)
|
||||
(gravity meters)
|
||||
(player-weight meters)
|
||||
(player-bonk-factor float)
|
||||
(player-dive-factor float)
|
||||
(player-force-distance meters)
|
||||
(player-force-clamp meters)
|
||||
(player-force-timeout time-frame)
|
||||
(explosion-force meters)
|
||||
(linear-damping float)
|
||||
(angular-damping float)
|
||||
(control-point-count int32)
|
||||
(mass float)
|
||||
(inertial-tensor-x meters)
|
||||
(inertial-tensor-y meters)
|
||||
(inertial-tensor-z meters)
|
||||
(cm-joint-x meters)
|
||||
(cm-joint-y meters)
|
||||
(cm-joint-z meters)
|
||||
(idle-distance meters)
|
||||
(platform symbol)
|
||||
(sound-name string)
|
||||
)
|
||||
)
|
||||
|
||||
((drag-factor float)
|
||||
(buoyancy-factor float)
|
||||
(max-buoyancy-depth meters)
|
||||
(gravity-factor float)
|
||||
(gravity meters)
|
||||
(player-weight meters)
|
||||
(player-bonk-factor float)
|
||||
(player-dive-factor float)
|
||||
(player-force-distance meters)
|
||||
(player-force-clamp meters)
|
||||
(player-force-timeout time-frame)
|
||||
(explosion-force meters)
|
||||
(linear-damping float)
|
||||
(angular-damping float)
|
||||
(control-point-count int32)
|
||||
(mass float)
|
||||
(inertial-tensor-x meters)
|
||||
(inertial-tensor-y meters)
|
||||
(inertial-tensor-z meters)
|
||||
(cm-joint-x meters)
|
||||
(cm-joint-y meters)
|
||||
(cm-joint-z meters)
|
||||
(idle-distance meters)
|
||||
(platform symbol)
|
||||
(sound-name string)))
|
||||
|
||||
(deftype rigid-body-control-point-inline-array (inline-array-class)
|
||||
((data rigid-body-control-point :inline :dynamic :offset 16)
|
||||
)
|
||||
)
|
||||
|
||||
((data rigid-body-control-point :inline :dynamic :offset 16)))
|
||||
|
||||
(set! (-> rigid-body-control-point-inline-array heap-base) (the-as uint 48))
|
||||
|
||||
(deftype rigid-body-platform (process-drawable)
|
||||
((root-overlay collide-shape-moving :overlay-at root)
|
||||
(info rigid-body-platform-constants)
|
||||
(rbody rigid-body :inline)
|
||||
(control-point-array rigid-body-control-point-inline-array)
|
||||
(player-velocity vector :inline)
|
||||
(player-velocity-prev vector :inline)
|
||||
(player-force-position vector :inline)
|
||||
(player-force vector :inline)
|
||||
(sim-time-remaining float)
|
||||
(float-height-offset float)
|
||||
(player-attack-id int32)
|
||||
(player-bonk-timeout time-frame)
|
||||
(water-anim water-anim)
|
||||
(player-contact basic)
|
||||
(player-impulse collide-shape-prim-mesh)
|
||||
)
|
||||
((root-overlay collide-shape-moving :overlay-at root)
|
||||
(info rigid-body-platform-constants)
|
||||
(rbody rigid-body :inline)
|
||||
(control-point-array rigid-body-control-point-inline-array)
|
||||
(player-velocity vector :inline)
|
||||
(player-velocity-prev vector :inline)
|
||||
(player-force-position vector :inline)
|
||||
(player-force vector :inline)
|
||||
(sim-time-remaining float)
|
||||
(float-height-offset float)
|
||||
(player-attack-id int32)
|
||||
(player-bonk-timeout time-frame)
|
||||
(water-anim water-anim)
|
||||
(player-contact basic)
|
||||
(player-impulse collide-shape-prim-mesh))
|
||||
(:state-methods
|
||||
rigid-body-platform-idle
|
||||
rigid-body-platform-float
|
||||
)
|
||||
rigid-body-platform-idle
|
||||
rigid-body-platform-float)
|
||||
(:methods
|
||||
(rigid-body-platform-method-22 (_type_ vector float) float)
|
||||
(rigid-body-platform-method-23 (_type_ float) none)
|
||||
(rigid-body-platform-method-24 (_type_ rigid-body-control-point float) none)
|
||||
(rigid-body-platform-method-25 (_type_) none)
|
||||
(rigid-body-platform-method-26 (_type_) none)
|
||||
(rigid-body-platform-method-27 (_type_ vector) none)
|
||||
(rigid-body-platform-method-28 (_type_) none)
|
||||
(rigid-body-platform-method-29 (_type_ rigid-body-platform-constants) none)
|
||||
(rigid-body-platform-method-30 (_type_) none)
|
||||
(rigid-body-platform-method-31 (_type_) none)
|
||||
(rigid-body-platform-method-32 (_type_) sound-id)
|
||||
(rigid-body-platform-method-33 (_type_) object)
|
||||
(rigid-body-platform-method-34 (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(rigid-body-platform-method-22 (_type_ vector float) float)
|
||||
(rigid-body-platform-method-23 (_type_ float) none)
|
||||
(rigid-body-platform-method-24 (_type_ rigid-body-control-point float) none)
|
||||
(rigid-body-platform-method-25 (_type_) none)
|
||||
(rigid-body-platform-method-26 (_type_) none)
|
||||
(rigid-body-platform-method-27 (_type_ vector) none)
|
||||
(rigid-body-platform-method-28 (_type_) none)
|
||||
(rigid-body-platform-method-29 (_type_ rigid-body-platform-constants) none)
|
||||
(rigid-body-platform-method-30 (_type_) none)
|
||||
(rigid-body-platform-method-31 (_type_) none)
|
||||
(rigid-body-platform-method-32 (_type_) sound-id)
|
||||
(rigid-body-platform-method-33 (_type_) object)
|
||||
(rigid-body-platform-method-34 (_type_) none)))
|
||||
|
||||
(defmethod relocate ((this rigid-body-platform) (arg0 int))
|
||||
(if (nonzero? (-> this control-point-array))
|
||||
(set! (-> this control-point-array)
|
||||
(the-as rigid-body-control-point-inline-array (+ (the-as int (-> this control-point-array)) arg0))
|
||||
)
|
||||
)
|
||||
(call-parent-method this arg0)
|
||||
)
|
||||
(set! (-> this control-point-array)
|
||||
(the-as rigid-body-control-point-inline-array (+ (the-as int (-> this control-point-array)) arg0))))
|
||||
(call-parent-method this arg0))
|
||||
|
||||
(defmethod rigid-body-platform-method-22 ((this rigid-body-platform) (arg0 vector) (arg1 float))
|
||||
(let ((v1-0 (-> this water-anim)))
|
||||
0.0
|
||||
(+ (the-as float (cond
|
||||
(v1-0
|
||||
(let* ((a2-1 v1-0)
|
||||
(a0-1 (if a2-1
|
||||
(-> a2-1 ppointer-water-anim 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if a0-1
|
||||
(get-ripple-height a0-1 arg0)
|
||||
(-> v1-0 ppointer-water-anim 9)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(ocean-get-height arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> this float-height-offset)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+ (the-as float
|
||||
(cond
|
||||
(v1-0
|
||||
(let* ((a2-1 v1-0)
|
||||
(a0-1 (if a2-1 (-> a2-1 ppointer-water-anim 3))))
|
||||
(if a0-1 (get-ripple-height a0-1 arg0) (-> v1-0 ppointer-water-anim 9))))
|
||||
(else (ocean-get-height arg0))))
|
||||
(-> this float-height-offset))))
|
||||
|
||||
(defmethod rigid-body-platform-method-24 ((this rigid-body-platform) (arg0 rigid-body-control-point) (arg1 float))
|
||||
(set! (-> arg0 world-pos w) (rigid-body-platform-method-22 this (-> arg0 world-pos) arg1))
|
||||
(let* ((s4-0 (new 'stack-no-clear 'vector))
|
||||
(f0-2 (- (-> arg0 world-pos w) (-> arg0 world-pos y)))
|
||||
(f30-0 (/ f0-2 (-> this info max-buoyancy-depth)))
|
||||
)
|
||||
(f30-0 (/ f0-2 (-> this info max-buoyancy-depth))))
|
||||
(when (< 0.0 f0-2)
|
||||
(vector-float*! s4-0 *y-vector* (* (-> this rbody mass)
|
||||
(fmin 1.0 f30-0)
|
||||
(/ (-> this info gravity) (the float (-> this info control-point-count)))
|
||||
(-> this info gravity-factor)
|
||||
(-> this info buoyancy-factor)
|
||||
)
|
||||
)
|
||||
(vector-float*! s4-0
|
||||
*y-vector*
|
||||
(* (-> this rbody mass)
|
||||
(fmin 1.0 f30-0)
|
||||
(/ (-> this info gravity) (the float (-> this info control-point-count)))
|
||||
(-> this info gravity-factor)
|
||||
(-> this info buoyancy-factor)))
|
||||
(rigid-body-method-13 (-> this rbody) (-> arg0 world-pos) s4-0)
|
||||
(vector-float*! s4-0 (-> arg0 velocity) (* -1.0 (-> this info drag-factor) (fmin 1.0 f30-0)))
|
||||
(rigid-body-method-13 (-> this rbody) (-> arg0 world-pos) s4-0)
|
||||
)
|
||||
)
|
||||
(rigid-body-method-13 (-> this rbody) (-> arg0 world-pos) s4-0)))
|
||||
0
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-25 ((this rigid-body-platform))
|
||||
(when (or (-> this player-impulse) (-> this player-contact))
|
||||
(set! (-> this player-impulse) #f)
|
||||
(rigid-body-method-16
|
||||
(-> this rbody)
|
||||
(-> this player-force-position)
|
||||
(-> this player-force)
|
||||
(-> this info player-force-distance)
|
||||
)
|
||||
)
|
||||
(rigid-body-method-16 (-> this rbody)
|
||||
(-> this player-force-position)
|
||||
(-> this player-force)
|
||||
(-> this info player-force-distance)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-26 ((this rigid-body-platform))
|
||||
(let ((a1-0 (new 'stack-no-clear 'vector)))
|
||||
(vector-float*!
|
||||
a1-0
|
||||
*y-vector*
|
||||
(* -1.0 (-> this info gravity-factor) (-> this info gravity) (-> this rbody mass))
|
||||
)
|
||||
(rigid-body-method-15 (-> this rbody) a1-0)
|
||||
)
|
||||
(vector-float*! a1-0 *y-vector* (* -1.0 (-> this info gravity-factor) (-> this info gravity) (-> this rbody mass)))
|
||||
(rigid-body-method-15 (-> this rbody) a1-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-27 ((this rigid-body-platform) (arg0 vector))
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(vector-! gp-0 arg0 (-> this rbody position))
|
||||
(set! (-> gp-0 y) 0.0)
|
||||
(let* ((f0-1 (vector-length gp-0))
|
||||
(f1-1 (* 10.0 (fmax 0.0 (fmin 4096.0 (+ -4096.0 f0-1)))))
|
||||
)
|
||||
(f1-1 (* 10.0 (fmax 0.0 (fmin 4096.0 (+ -4096.0 f0-1))))))
|
||||
(when (< 0.0 f1-1)
|
||||
(vector-float*! gp-0 gp-0 (/ f1-1 f0-1))
|
||||
(rigid-body-method-15 (-> this rbody) gp-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(rigid-body-method-15 (-> this rbody) gp-0))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-23 ((this rigid-body-platform) (arg0 float))
|
||||
(let ((s4-0 (-> this rbody matrix)))
|
||||
@@ -420,42 +313,29 @@
|
||||
(let ((s2-0 (-> this control-point-array data s3-0)))
|
||||
(vector-matrix*! (-> s2-0 world-pos) (-> s2-0 local-pos) s4-0)
|
||||
(rigid-body-method-17 (-> this rbody) (-> s2-0 world-pos) (-> s2-0 velocity))
|
||||
(rigid-body-platform-method-24 this s2-0 arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(rigid-body-platform-method-24 this s2-0 arg0))))
|
||||
(rigid-body-platform-method-26 this)
|
||||
(rigid-body-platform-method-25 this)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-28 ((this rigid-body-platform))
|
||||
(if (-> this info platform)
|
||||
(detect-riders! (-> this root-overlay))
|
||||
)
|
||||
(if (-> this info platform) (detect-riders! (-> this root-overlay)))
|
||||
(set! (-> this player-velocity-prev quad) (-> this player-velocity quad))
|
||||
(if *target*
|
||||
(set! (-> this player-velocity quad) (-> *target* control transv quad))
|
||||
(set! (-> this player-velocity quad) (-> *null-vector* quad))
|
||||
)
|
||||
(+! (-> this sim-time-remaining)
|
||||
(* 0.0033333334 (the float (- (current-time) (-> *display* old-base-frame-counter))))
|
||||
)
|
||||
(set! (-> this player-velocity quad) (-> *target* control transv quad))
|
||||
(set! (-> this player-velocity quad) (-> *null-vector* quad)))
|
||||
(+! (-> this sim-time-remaining) (* 0.0033333334 (the float (- (current-time) (-> *display* old-base-frame-counter)))))
|
||||
(let ((f30-0 (* DISPLAY_FPS_RATIO 0.016666668)) ;; og:preserve-this changed for high fps
|
||||
(f28-0 (* 0.0033333334 (the float (logand #xffffff (current-time)))))
|
||||
)
|
||||
(f28-0 (* 0.0033333334 (the float (logand #xffffff (current-time))))))
|
||||
(while (>= (-> this sim-time-remaining) (* 0.5 f30-0))
|
||||
(clear-force-torque! (-> this rbody))
|
||||
(rigid-body-platform-method-23 this f28-0)
|
||||
(rigid-body-method-10 (-> this rbody) f30-0)
|
||||
(set! (-> this sim-time-remaining) (- (-> this sim-time-remaining) f30-0))
|
||||
)
|
||||
)
|
||||
(set! (-> this sim-time-remaining) (- (-> this sim-time-remaining) f30-0))))
|
||||
(set! (-> this player-contact) #f)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior rigid-body-platform-event-handler rigid-body-platform ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
||||
(case arg2
|
||||
@@ -463,30 +343,13 @@
|
||||
(when (time-elapsed? (-> self player-bonk-timeout) (-> self info player-force-timeout))
|
||||
(set-time! (-> self player-bonk-timeout))
|
||||
(let* ((s5-0 arg0)
|
||||
(v1-7 (if (and (nonzero? s5-0) (type-type? (-> s5-0 type) process-drawable))
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(v1-7 (if (and (nonzero? s5-0) (type-type? (-> s5-0 type) process-drawable)) s5-0)))
|
||||
(when v1-7
|
||||
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
|
||||
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-7) root trans quad))
|
||||
(let ((f0-4 (fmin
|
||||
(* 0.00012207031
|
||||
(the-as float (-> arg3 param 1))
|
||||
(-> self info player-bonk-factor)
|
||||
(-> self info player-weight)
|
||||
)
|
||||
(-> self info player-force-clamp)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-float*! (-> self player-force) *y-vector* (- f0-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f0-4 (fmin (* 0.00012207031 (the-as float (-> arg3 param 1)) (-> self info player-bonk-factor) (-> self info player-weight))
|
||||
(-> self info player-force-clamp))))
|
||||
(vector-float*! (-> self player-force) *y-vector* (- f0-4)))))))
|
||||
(('attack)
|
||||
(let ((v1-16 (-> arg3 param 2)))
|
||||
(when (!= v1-16 (-> self player-attack-id))
|
||||
@@ -496,71 +359,33 @@
|
||||
(when (time-elapsed? (-> self player-bonk-timeout) (-> self info player-force-timeout))
|
||||
(set-time! (-> self player-bonk-timeout))
|
||||
(let* ((gp-1 arg0)
|
||||
(v1-24 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) process-drawable))
|
||||
gp-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(v1-24 (if (and (nonzero? gp-1) (type-type? (-> gp-1 type) process-drawable)) gp-1)))
|
||||
(when v1-24
|
||||
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
|
||||
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-24) root trans quad))
|
||||
(let ((f0-9 (fmin
|
||||
(* 16.0 (-> self info player-weight) (-> self info player-dive-factor))
|
||||
(-> self info player-force-clamp)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-float*! (-> self player-force) *y-vector* (- f0-9))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f0-9 (fmin (* 16.0 (-> self info player-weight) (-> self info player-dive-factor)) (-> self info player-force-clamp))))
|
||||
(vector-float*! (-> self player-force) *y-vector* (- f0-9)))))))
|
||||
((= (-> arg3 param 1) 'explode)
|
||||
(let* ((gp-2 arg0)
|
||||
(v1-34 (if (and (nonzero? gp-2) (type-type? (-> gp-2 type) process-drawable))
|
||||
gp-2
|
||||
)
|
||||
)
|
||||
)
|
||||
(v1-34 (if (and (nonzero? gp-2) (type-type? (-> gp-2 type) process-drawable)) gp-2)))
|
||||
(when v1-34
|
||||
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
|
||||
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-34) root trans quad))
|
||||
(vector-! (-> self player-force) (-> self rbody position) (-> (the-as process-drawable v1-34) root trans))
|
||||
(vector-normalize! (-> self player-force) (-> self info explosion-force))
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(the-as vector #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-normalize! (-> self player-force) (-> self info explosion-force)))))
|
||||
(else (the-as vector #f))))))
|
||||
(('impulse)
|
||||
(let ((s5-1 arg0))
|
||||
(when (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) process-drawable))
|
||||
s5-1
|
||||
)
|
||||
(when (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) process-drawable)) s5-1)
|
||||
(set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
|
||||
(set! (-> self player-force-position quad) (-> self rbody position quad))
|
||||
(let ((v0-0 (-> self player-force)))
|
||||
(set! (-> v0-0 quad) (-> (the-as vector (-> arg3 param 0)) quad))
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v0-0 (-> self player-force))) (set! (-> v0-0 quad) (-> (the-as vector (-> arg3 param 0)) quad)) v0-0))))
|
||||
(('edge-grabbed)
|
||||
(let ((v1-44 (-> arg3 param 0)))
|
||||
(when (not (-> self player-impulse))
|
||||
(set! (-> self player-contact) #t)
|
||||
(set! (-> self player-force-position quad) (-> (the-as vector (+ v1-44 32)) quad))
|
||||
(vector-float*! (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-float*! (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight))))))
|
||||
(('ridden)
|
||||
(let ((v1-48 (the-as object (-> arg3 param 0))))
|
||||
(when (the-as uint v1-48)
|
||||
@@ -570,104 +395,66 @@
|
||||
(set! (-> self player-contact) #t)
|
||||
(set! (-> self player-force-position quad) (-> (the-as process-drawable v1-50) root trans quad))
|
||||
(set! (-> self player-force quad) (-> *null-vector* quad))
|
||||
(vector+*! (-> self player-force) (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector+*! (-> self player-force) (-> self player-force) *y-vector* (* -1.0 (-> self info player-weight)))))))))))
|
||||
|
||||
(defbehavior rigid-body-platform-post rigid-body-platform ()
|
||||
(set! (-> self rbody lin-momentum-damping-factor) (-> self info linear-damping))
|
||||
(set! (-> self rbody ang-momentum-damping-factor) (-> self info angular-damping))
|
||||
(if (-> self player-impulse)
|
||||
(sound-play-by-name
|
||||
(string->sound-name (-> self info sound-name))
|
||||
(new-sound-id)
|
||||
1024
|
||||
0
|
||||
0
|
||||
(sound-group sfx)
|
||||
#t
|
||||
)
|
||||
)
|
||||
(sound-play-by-name (string->sound-name (-> self info sound-name)) (new-sound-id) 1024 0 0 (sound-group sfx) #t))
|
||||
(rigid-body-platform-method-28 self)
|
||||
(quaternion-copy! (-> self root-overlay quat) (-> self rbody rotation))
|
||||
(rigid-body-method-18 (-> self rbody) (-> self root-overlay trans))
|
||||
(if (-> self info platform)
|
||||
(rider-post)
|
||||
(transform-post)
|
||||
)
|
||||
)
|
||||
(if (-> self info platform) (rider-post) (transform-post)))
|
||||
|
||||
(defstate rigid-body-platform-idle (rigid-body-platform)
|
||||
:virtual #t
|
||||
:trans (behavior ()
|
||||
(if (and *target* (>= (-> self info idle-distance)
|
||||
(vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))
|
||||
)
|
||||
)
|
||||
(go-virtual rigid-body-platform-float)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (and *target*
|
||||
(>= (-> self info idle-distance) (vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))))
|
||||
(go-virtual rigid-body-platform-float)))
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(suspend)))
|
||||
:post ja-post)
|
||||
|
||||
(defstate rigid-body-platform-float (rigid-body-platform)
|
||||
:virtual #t
|
||||
:event rigid-body-platform-event-handler
|
||||
:trans (behavior ()
|
||||
(if (or (not *target*) (< (-> self info idle-distance)
|
||||
(vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))
|
||||
)
|
||||
)
|
||||
(go-virtual rigid-body-platform-idle)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
:post rigid-body-platform-post
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (or (not *target*)
|
||||
(< (-> self info idle-distance) (vector-vector-distance (-> self root-overlay trans) (-> *target* control trans))))
|
||||
(go-virtual rigid-body-platform-idle)))
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(suspend)))
|
||||
:post rigid-body-platform-post)
|
||||
|
||||
(defmethod rigid-body-platform-method-29 ((this rigid-body-platform) (arg0 rigid-body-platform-constants))
|
||||
(set! (-> this info) arg0)
|
||||
(set! (-> this control-point-array)
|
||||
(new 'process 'rigid-body-control-point-inline-array (-> this info control-point-count))
|
||||
)
|
||||
(new 'process 'rigid-body-control-point-inline-array (-> this info control-point-count)))
|
||||
(logior! (-> this skel status) (janim-status inited))
|
||||
(update-transforms! (-> this root-overlay))
|
||||
(set-vector!
|
||||
(-> this rbody cm-offset-joint)
|
||||
(-> this info cm-joint-x)
|
||||
(-> this info cm-joint-y)
|
||||
(-> this info cm-joint-z)
|
||||
1.0
|
||||
)
|
||||
(rigid-body-method-22
|
||||
(-> this rbody)
|
||||
(-> this root-overlay trans)
|
||||
(-> this root-overlay quat)
|
||||
(-> this info linear-damping)
|
||||
(-> this info angular-damping)
|
||||
)
|
||||
(rigid-body-method-9
|
||||
(-> this rbody)
|
||||
(-> this info mass)
|
||||
(-> this info inertial-tensor-x)
|
||||
(-> this info inertial-tensor-y)
|
||||
(-> this info inertial-tensor-z)
|
||||
)
|
||||
(set-vector! (-> this rbody cm-offset-joint)
|
||||
(-> this info cm-joint-x)
|
||||
(-> this info cm-joint-y)
|
||||
(-> this info cm-joint-z)
|
||||
1.0)
|
||||
(rigid-body-method-22 (-> this rbody)
|
||||
(-> this root-overlay trans)
|
||||
(-> this root-overlay quat)
|
||||
(-> this info linear-damping)
|
||||
(-> this info angular-damping))
|
||||
(rigid-body-method-9 (-> this rbody)
|
||||
(-> this info mass)
|
||||
(-> this info inertial-tensor-x)
|
||||
(-> this info inertial-tensor-y)
|
||||
(-> this info inertial-tensor-z))
|
||||
(set! (-> this player-impulse) #f)
|
||||
(set! (-> this player-contact) #f)
|
||||
(set-time! (-> this player-bonk-timeout))
|
||||
@@ -676,16 +463,13 @@
|
||||
(set! (-> this player-velocity-prev quad) (-> *null-vector* quad))
|
||||
(set! (-> this water-anim) (the-as water-anim (entity-actor-lookup (-> this entity) 'water-actor 0)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-30 ((this rigid-body-platform))
|
||||
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s5-0 reaction) default-collision-reaction)
|
||||
(set! (-> s5-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s5-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(alloc-riders s5-0 1)
|
||||
(let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
|
||||
(set! (-> s4-0 prim-core collide-as) (collide-kind ground-object))
|
||||
@@ -694,47 +478,43 @@
|
||||
(set! (-> s4-0 prim-core offense) (collide-offense indestructible))
|
||||
(set! (-> s4-0 transform-index) 0)
|
||||
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 20480.0)
|
||||
(set-root-prim! s5-0 s4-0)
|
||||
)
|
||||
(set-root-prim! s5-0 s4-0))
|
||||
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s5-0)
|
||||
(set! (-> this root-overlay) s5-0)
|
||||
)
|
||||
(set! (-> this root-overlay) s5-0))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(define *rigid-body-platform-constants* (new 'static 'rigid-body-platform-constants
|
||||
:drag-factor 0.8
|
||||
:buoyancy-factor 1.5
|
||||
:max-buoyancy-depth (meters 1.5)
|
||||
:gravity-factor 1.0
|
||||
:gravity (meters 10)
|
||||
:player-weight (meters 6.6)
|
||||
:player-bonk-factor 1.0
|
||||
:player-dive-factor 1.0
|
||||
:player-force-distance (meters 1000)
|
||||
:player-force-clamp (meters 1000000)
|
||||
:player-force-timeout (seconds 0.1)
|
||||
:explosion-force (meters 1000)
|
||||
:linear-damping 1.0
|
||||
:angular-damping 1.0
|
||||
:control-point-count 1
|
||||
:mass 2.0
|
||||
:inertial-tensor-x (meters 3)
|
||||
:inertial-tensor-y (meters 2)
|
||||
:inertial-tensor-z (meters 3)
|
||||
:idle-distance (meters 50)
|
||||
:platform #t
|
||||
:sound-name #f
|
||||
)
|
||||
)
|
||||
(define *rigid-body-platform-constants*
|
||||
(new 'static
|
||||
'rigid-body-platform-constants
|
||||
:drag-factor 0.8
|
||||
:buoyancy-factor 1.5
|
||||
:max-buoyancy-depth (meters 1.5)
|
||||
:gravity-factor 1.0
|
||||
:gravity (meters 10)
|
||||
:player-weight (meters 6.6)
|
||||
:player-bonk-factor 1.0
|
||||
:player-dive-factor 1.0
|
||||
:player-force-distance (meters 1000)
|
||||
:player-force-clamp (meters 1000000)
|
||||
:player-force-timeout (seconds 0.1)
|
||||
:explosion-force (meters 1000)
|
||||
:linear-damping 1.0
|
||||
:angular-damping 1.0
|
||||
:control-point-count 1
|
||||
:mass 2.0
|
||||
:inertial-tensor-x (meters 3)
|
||||
:inertial-tensor-y (meters 2)
|
||||
:inertial-tensor-z (meters 3)
|
||||
:idle-distance (meters 50)
|
||||
:platform #t
|
||||
:sound-name #f))
|
||||
|
||||
(defmethod rigid-body-platform-method-34 ((this rigid-body-platform))
|
||||
(go (method-of-object this rigid-body-platform-idle))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod rigid-body-platform-method-31 ((this rigid-body-platform))
|
||||
(set! (-> this float-height-offset) 0.0)
|
||||
@@ -745,15 +525,10 @@
|
||||
(let ((f30-0 (* 65536.0 (/ (the float s4-0) (the float s5-0)))))
|
||||
(set! (-> s3-0 local-pos x) (* 12288.0 (sin f30-0)))
|
||||
(set! (-> s3-0 local-pos y) -10240.0)
|
||||
(set! (-> s3-0 local-pos z) (* 12288.0 (cos f30-0)))
|
||||
)
|
||||
(set! (-> s3-0 local-pos w) 1.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s3-0 local-pos z) (* 12288.0 (cos f30-0))))
|
||||
(set! (-> s3-0 local-pos w) 1.0))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod init-from-entity! ((this rigid-body-platform) (arg0 entity-actor))
|
||||
(logior! (-> this mask) (process-mask platform))
|
||||
@@ -762,5 +537,4 @@
|
||||
(rigid-body-platform-method-31 this)
|
||||
(rigid-body-platform-method-34 this)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,14 +1,9 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/common-obs/nav-enemy.gc")
|
||||
(require "engine/common-obs/water.gc")
|
||||
|
||||
;; name: sharkey.gc
|
||||
;; name in dgo: sharkey
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defpartgroup group-sharkey-splash
|
||||
@@ -17,81 +12,70 @@
|
||||
:linger-duration (seconds 2.6)
|
||||
:flags (use-local-clock)
|
||||
:bounds (static-bspherem 0 -12 0 14)
|
||||
:parts ((sp-item 124 :flags (is-3d) :period (seconds 3) :length (seconds 0.21))
|
||||
(sp-item 125 :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 126 :flags (is-3d) :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 127 :flags (is-3d) :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 128 :period (seconds 3) :length (seconds 0.035) :binding 129)
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
)
|
||||
)
|
||||
:parts
|
||||
((sp-item 124 :flags (is-3d) :period (seconds 3) :length (seconds 0.21))
|
||||
(sp-item 125 :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 126 :flags (is-3d) :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 127 :flags (is-3d) :period (seconds 3) :length (seconds 0.05))
|
||||
(sp-item 128 :period (seconds 3) :length (seconds 0.035) :binding 129)
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))
|
||||
(sp-item 129 :flags (start-dead) :period (seconds 3) :length (seconds 0.4))))
|
||||
|
||||
(deftype sharkey (nav-enemy)
|
||||
((dir vector :inline)
|
||||
(spawn-point vector :inline)
|
||||
(scale float)
|
||||
(anim-speed float)
|
||||
(y-max meters)
|
||||
(y-min meters)
|
||||
(attack-time float)
|
||||
(player-water-time time-frame)
|
||||
(player-in-water basic)
|
||||
(last-y float)
|
||||
(spawn-distance meters)
|
||||
(chase-speed meters)
|
||||
(y-speed meters)
|
||||
(sound-id sound-id)
|
||||
(enable-patrol basic)
|
||||
)
|
||||
)
|
||||
((dir vector :inline)
|
||||
(spawn-point vector :inline)
|
||||
(scale float)
|
||||
(anim-speed float)
|
||||
(y-max meters)
|
||||
(y-min meters)
|
||||
(attack-time float)
|
||||
(player-water-time time-frame)
|
||||
(player-in-water basic)
|
||||
(last-y float)
|
||||
(spawn-distance meters)
|
||||
(chase-speed meters)
|
||||
(y-speed meters)
|
||||
(sound-id sound-id)
|
||||
(enable-patrol basic)))
|
||||
|
||||
|
||||
(defskelgroup *sharkey-sg* sharkey sharkey-lod0-jg sharkey-idle-ja
|
||||
((sharkey-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 6)
|
||||
)
|
||||
(defskelgroup *sharkey-sg*
|
||||
sharkey
|
||||
sharkey-lod0-jg
|
||||
sharkey-idle-ja
|
||||
((sharkey-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 6))
|
||||
|
||||
(defmethod touch-handler ((this sharkey) (arg0 process) (arg1 event-message-block))
|
||||
#t
|
||||
)
|
||||
#t)
|
||||
|
||||
(defmethod attack-handler ((this sharkey) (arg0 process) (arg1 event-message-block))
|
||||
#t
|
||||
)
|
||||
#t)
|
||||
|
||||
nav-enemy-default-event-handler
|
||||
|
||||
(defmethod run-logic? ((this sharkey))
|
||||
(or (not (logtest? (-> this mask) (process-mask actor-pause)))
|
||||
(or (>= (+ (-> *ACTOR-bank* pause-dist) (-> this collide-info pause-adjust-distance))
|
||||
(vector-vector-distance (-> this collide-info trans) (math-camera-pos))
|
||||
)
|
||||
(vector-vector-distance (-> this collide-info trans) (math-camera-pos)))
|
||||
(and (nonzero? (-> this skel)) (!= (-> this skel root-channel 0) (-> this skel channel)))
|
||||
(and (nonzero? (-> this draw)) (logtest? (-> this draw status) (draw-status no-skeleton-update)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(and (nonzero? (-> this draw)) (logtest? (-> this draw status) (draw-status no-skeleton-update))))))
|
||||
|
||||
(defmethod nav-enemy-method-40 ((this sharkey))
|
||||
(nav-control-method-11 (-> this nav) (-> this nav target-pos))
|
||||
(let* ((f0-0 (vector-vector-xz-distance (-> this collide-info trans) (-> this nav target-pos)))
|
||||
(f30-0 (/ (- (fmin (-> this y-max) (-> this nav target-pos y)) (-> this collide-info trans y)) f0-0))
|
||||
)
|
||||
(set! (-> this nav travel y) (* 4.0 (vector-length (-> this nav travel)) f30-0))
|
||||
)
|
||||
(f30-0 (/ (- (fmin (-> this y-max) (-> this nav target-pos y)) (-> this collide-info trans y)) f0-0)))
|
||||
(set! (-> this nav travel y) (* 4.0 (vector-length (-> this nav travel)) f30-0)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod nav-enemy-method-37 ((this sharkey))
|
||||
(let ((s5-0 (new 'stack-no-clear 'vector)))
|
||||
@@ -99,86 +83,57 @@ nav-enemy-default-event-handler
|
||||
(vector-normalize-copy! s5-0 (-> this nav travel) 1.0)
|
||||
(vector-deg-seek (-> this dir) (-> this dir) s5-0 (* 65536.0 (seconds-per-frame)))
|
||||
(vector-normalize! (-> this dir) 1.0)
|
||||
(forward-up->quaternion (-> this collide-info quat) (-> this dir) *up-vector*)
|
||||
)
|
||||
)
|
||||
(forward-up->quaternion (-> this collide-info quat) (-> this dir) *up-vector*)))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod nav-enemy-method-41 ((this sharkey))
|
||||
(let* ((f0-1 (- (-> this target-speed) (-> this momentum-speed)))
|
||||
(f1-3 (fmin (* (-> this acceleration) (seconds-per-frame)) (fabs f0-1)))
|
||||
)
|
||||
(if (< f0-1 0.0)
|
||||
(set! (-> this momentum-speed) (- (-> this momentum-speed) f1-3))
|
||||
(+! (-> this momentum-speed) f1-3)
|
||||
)
|
||||
)
|
||||
(let ((f0-9 (fmin
|
||||
(* (-> this speed-scale) (-> this momentum-speed))
|
||||
(* (vector-length (-> this nav travel)) (-> *display* frames-per-second))
|
||||
)
|
||||
)
|
||||
)
|
||||
(vector-normalize-copy! (-> this collide-info transv) (-> this nav travel) f0-9)
|
||||
)
|
||||
(f1-3 (fmin (* (-> this acceleration) (seconds-per-frame)) (fabs f0-1))))
|
||||
(if (< f0-1 0.0) (set! (-> this momentum-speed) (- (-> this momentum-speed) f1-3)) (+! (-> this momentum-speed) f1-3)))
|
||||
(let ((f0-9 (fmin (* (-> this speed-scale) (-> this momentum-speed))
|
||||
(* (vector-length (-> this nav travel)) (-> *display* frames-per-second)))))
|
||||
(vector-normalize-copy! (-> this collide-info transv) (-> this nav travel) f0-9))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod common-post ((this sharkey))
|
||||
(let ((f30-0 (-> this water height))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(s5-0 (new 'stack-no-clear 'vector)))
|
||||
(let* ((f3-0 (- -36864.0 (-> this collide-info trans y)))
|
||||
(f0-2 (fmax 0.0 (fmin 1.0 (- 1.0 (* 0.00008138021 f3-0)))))
|
||||
)
|
||||
(set-vector! (-> this draw color-mult) f0-2 f0-2 f0-2 1.0)
|
||||
)
|
||||
(f0-2 (fmax 0.0 (fmin 1.0 (- 1.0 (* 0.00008138021 f3-0))))))
|
||||
(set-vector! (-> this draw color-mult) f0-2 f0-2 f0-2 1.0))
|
||||
(water-control-method-10 (-> this water))
|
||||
(let ((f28-0 (-> this collide-info trans y)))
|
||||
(when (or (and (< f30-0 f28-0) (>= f30-0 (-> this last-y))) (and (>= f30-0 f28-0) (< f30-0 (-> this last-y))))
|
||||
(set! (-> s5-0 quad) (-> this collide-info trans quad))
|
||||
(set! (-> s5-0 y) f30-0)
|
||||
(create-splash (-> this water) 1.0 s5-0 1 (-> this collide-info transv))
|
||||
)
|
||||
(set! (-> this last-y) f28-0)
|
||||
)
|
||||
)
|
||||
(create-splash (-> this water) 1.0 s5-0 1 (-> this collide-info transv)))
|
||||
(set! (-> this last-y) f28-0)))
|
||||
(call-parent-method this)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior sharkey-notice-player? sharkey ()
|
||||
(if *target*
|
||||
(and (< (- (-> *target* control trans y) (-> self y-max)) 0.0)
|
||||
(let ((gp-0 'racer))
|
||||
(!= gp-0 (send-event *target* 'query 'mode))
|
||||
)
|
||||
(nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos))
|
||||
)
|
||||
)
|
||||
)
|
||||
(and (< (- (-> *target* control trans y) (-> self y-max)) 0.0)
|
||||
(let ((gp-0 'racer)) (!= gp-0 (send-event *target* 'query 'mode)))
|
||||
(nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos)))))
|
||||
|
||||
(defun sharkey-get-player-position ((arg0 vector))
|
||||
(set! (-> arg0 quad) (-> (target-pos 5) quad))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior sharkey-reset-position sharkey ()
|
||||
(set! (-> self collide-info trans quad) (-> self entity extra trans quad))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defbehavior sharkey-move-to-attack-position sharkey ()
|
||||
(let ((s5-0 (new 'stack-no-clear 'vector))
|
||||
(s3-0 (new 'stack-no-clear 'vector))
|
||||
(gp-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(gp-0 (new 'stack-no-clear 'vector)))
|
||||
(let ((s4-0 (-> *target* control trans)))
|
||||
(let ((f30-0 4096000.0))
|
||||
(set! (-> s3-0 quad) (-> self entity extra trans quad))
|
||||
@@ -188,437 +143,346 @@ nav-enemy-default-event-handler
|
||||
(let ((f0-2 (vector-vector-xz-distance s4-0 s3-0)))
|
||||
(when (< f0-2 f30-0)
|
||||
(set! f30-0 f0-2)
|
||||
(set! (-> s5-0 quad) (-> s3-0 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 quad) (-> s3-0 quad))))))
|
||||
(vector-! (-> self dir) s4-0 s5-0)
|
||||
(vector-normalize! (-> self dir) 1.0)
|
||||
(vector+*! gp-0 s4-0 (-> self dir) (- (-> self spawn-distance)))
|
||||
)
|
||||
(vector+*! gp-0 s4-0 (-> self dir) (- (-> self spawn-distance))))
|
||||
(project-onto-nav-mesh (-> self nav) gp-0 gp-0)
|
||||
(set! (-> gp-0 y) (-> self y-min))
|
||||
(set! (-> self spawn-point quad) (-> gp-0 quad))
|
||||
)
|
||||
(set! (-> self spawn-point quad) (-> gp-0 quad)))
|
||||
(set! (-> self collide-info trans quad) (-> self spawn-point quad))
|
||||
(forward-up->quaternion (-> self collide-info quat) (-> self dir) *up-vector*)
|
||||
(set! (-> self momentum-speed) 0.0)
|
||||
)
|
||||
(set! (-> self momentum-speed) 0.0))
|
||||
|
||||
(defstate nav-enemy-idle (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:enter (behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0))
|
||||
)
|
||||
:exit (behavior ()
|
||||
(logclear! (-> self draw status) (draw-status hidden))
|
||||
)
|
||||
:trans (behavior ()
|
||||
(cond
|
||||
((-> self enable-patrol)
|
||||
(if (and (and *target* (>= (-> self enemy-info idle-distance)
|
||||
(vector-vector-distance (-> self collide-info trans) (-> *target* control trans))
|
||||
)
|
||||
)
|
||||
(time-elapsed? (-> self state-time) (-> self state-timeout))
|
||||
)
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
((sharkey-notice-player?)
|
||||
(when (not (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf0)))
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0))
|
||||
(set-time! (-> self notice-time))
|
||||
)
|
||||
(let ((a0-4 (nav-control-method-16 (-> self nav) (-> *target* control trans))))
|
||||
(when (or (and a0-4 (logtest? (-> a0-4 pat) 2)) (and (logtest? (-> self draw status) (draw-status hidden))
|
||||
(time-elapsed? (-> self notice-time) (-> self reaction-time))
|
||||
)
|
||||
)
|
||||
(sharkey-move-to-attack-position)
|
||||
(set! (-> self player-in-water) #t)
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (time-elapsed? (-> self notice-time) (seconds 10))
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info idle-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(until (= (-> self collide-info trans y) (-> self y-min))
|
||||
(ja :num! (loop! (-> self anim-speed)))
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-min) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(water-control-method-10 (-> self water))
|
||||
(ja-post)
|
||||
(suspend)
|
||||
)
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(anim-loop)
|
||||
)
|
||||
:post #f
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0)))
|
||||
:exit
|
||||
(behavior ()
|
||||
(logclear! (-> self draw status) (draw-status hidden)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(cond
|
||||
((-> self enable-patrol)
|
||||
(if (and (and *target*
|
||||
(>= (-> self enemy-info idle-distance)
|
||||
(vector-vector-distance (-> self collide-info trans) (-> *target* control trans))))
|
||||
(time-elapsed? (-> self state-time) (-> self state-timeout)))
|
||||
(go-virtual nav-enemy-patrol)))
|
||||
((sharkey-notice-player?)
|
||||
(when (not (logtest? (-> self nav-enemy-flags) (nav-enemy-flags navenmf0)))
|
||||
(logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0))
|
||||
(set-time! (-> self notice-time)))
|
||||
(let ((a0-4 (nav-control-method-16 (-> self nav) (-> *target* control trans))))
|
||||
(when (or (and a0-4 (logtest? (-> a0-4 pat) 2))
|
||||
(and (logtest? (-> self draw status) (draw-status hidden))
|
||||
(time-elapsed? (-> self notice-time) (-> self reaction-time))))
|
||||
(sharkey-move-to-attack-position)
|
||||
(set! (-> self player-in-water) #t)
|
||||
(go-virtual nav-enemy-chase))))
|
||||
(else
|
||||
(if (time-elapsed? (-> self notice-time) (seconds 10)) (logclear! (-> self nav-enemy-flags) (nav-enemy-flags navenmf0))))))
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info idle-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(until (= (-> self collide-info trans y) (-> self y-min))
|
||||
(ja :num! (loop! (-> self anim-speed)))
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-min) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(water-control-method-10 (-> self water))
|
||||
(ja-post)
|
||||
(suspend))
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(anim-loop))
|
||||
:post #f)
|
||||
|
||||
(defstate nav-enemy-patrol (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:trans (behavior ()
|
||||
(if (sharkey-notice-player?)
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(set! (-> self nav target-pos quad) (-> self spawn-point quad))
|
||||
(loop
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info walk-anim))
|
||||
:num! (seek! max (-> self anim-speed))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(cond
|
||||
((-> self enable-patrol)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame)))
|
||||
)
|
||||
(else
|
||||
(if (< (- (-> self collide-info trans y) (-> self y-min)) 409.6)
|
||||
(go-virtual nav-enemy-idle)
|
||||
)
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
:post (behavior ()
|
||||
(nav-enemy-travel-post)
|
||||
)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (sharkey-notice-player?) (go-virtual nav-enemy-chase)))
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(set! (-> self nav target-pos quad) (-> self spawn-point quad))
|
||||
(loop
|
||||
(ja-no-eval :group!
|
||||
(-> self draw art-group data (-> self nav-info walk-anim))
|
||||
:num!
|
||||
(seek! max (-> self anim-speed))
|
||||
:frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(cond
|
||||
((-> self enable-patrol)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame))))
|
||||
(else (if (< (- (-> self collide-info trans y) (-> self y-min)) 409.6) (go-virtual nav-enemy-idle))))
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed))))))
|
||||
:post
|
||||
(behavior ()
|
||||
(nav-enemy-travel-post)))
|
||||
|
||||
(defstate nav-enemy-notice (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:enter (behavior ()
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
:code (behavior ()
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(go-virtual nav-enemy-chase))
|
||||
:code
|
||||
(behavior ()
|
||||
(go-virtual nav-enemy-chase)))
|
||||
|
||||
(defbehavior sharkey-follow-trajectory sharkey ((arg0 float))
|
||||
(let ((gp-0 (-> self jump-trajectory)))
|
||||
(eval-position! gp-0 arg0 (-> self collide-info trans))
|
||||
(eval-velocity! gp-0 arg0 (-> self collide-info transv))
|
||||
)
|
||||
(eval-velocity! gp-0 arg0 (-> self collide-info transv)))
|
||||
(vector-normalize-copy! (-> self dir) (-> self collide-info transv) 1.0)
|
||||
(forward-up->quaternion (-> self collide-info quat) (-> self dir) *up-vector*)
|
||||
)
|
||||
(forward-up->quaternion (-> self collide-info quat) (-> self dir) *up-vector*))
|
||||
|
||||
(defstate nav-enemy-attack (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:code (behavior ()
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(current-time)
|
||||
(sound-play "bigshark-bite")
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> gp-0 quad) (-> self collide-info trans quad))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! sharkey-chomp-ja :num! (seek! (ja-aframe 3.0 0) 2.0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(sharkey-get-player-position s5-0)
|
||||
(setup-from-to-duration! (-> self jump-trajectory) gp-0 s5-0 3.0 -291.27112)
|
||||
(set! (-> self attack-time) (ja-aframe-num 0))
|
||||
(sharkey-follow-trajectory (-> self attack-time))
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 3.0 0) 2.0))
|
||||
)
|
||||
)
|
||||
(when (send-event *target* 'attack-invinc #f (static-attack-info ((mode 'sharkey))))
|
||||
(logclear! (-> self mask) (process-mask enemy))
|
||||
(vector-float*! (-> self collide-info transv) (-> self collide-info transv) 8.0)
|
||||
(set-time! (-> self state-time))
|
||||
(let ((f30-0 -409600.0)
|
||||
(f28-0 (-> self collide-info transv y))
|
||||
(f26-0 (-> self collide-info trans y))
|
||||
)
|
||||
(until (time-elapsed? (-> self state-time) (seconds 3))
|
||||
(ja-no-eval :group! sharkey-chomp-ja :num! (seek!) :frame-num (ja-aframe 3.0 0))
|
||||
(until (ja-done? 0)
|
||||
(+! f28-0 (* f30-0 (seconds-per-frame)))
|
||||
(+! f26-0 (* f28-0 (seconds-per-frame)))
|
||||
(set! (-> self collide-info transv y) f28-0)
|
||||
(when (< (-> self collide-info trans y) (-> self water height))
|
||||
(set! f28-0 (* 0.9 f28-0))
|
||||
(vector-float*! (-> self collide-info transv) (-> self collide-info transv) 0.9)
|
||||
)
|
||||
(vector-normalize-copy! (-> self dir) (-> self collide-info transv) 1.0)
|
||||
(forward-up->quaternion (-> self collide-info quat) (-> self dir) *up-vector*)
|
||||
(integrate-for-enemy-with-move-to-ground!
|
||||
(-> self collide-info)
|
||||
(-> self collide-info transv)
|
||||
(collide-kind background)
|
||||
8192.0
|
||||
#t
|
||||
#f
|
||||
#f
|
||||
)
|
||||
(set! (-> self collide-info trans y) f26-0)
|
||||
(suspend)
|
||||
(ja :num! (seek!))
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event *target* 'end-mode)
|
||||
(logior! (-> self mask) (process-mask enemy))
|
||||
)
|
||||
(sharkey-reset-position)
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(go-virtual nav-enemy-idle)
|
||||
)
|
||||
:post (behavior ()
|
||||
(nav-enemy-simple-post)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector))
|
||||
(s5-0 (new 'stack-no-clear 'vector)))
|
||||
(current-time)
|
||||
(sound-play "bigshark-bite")
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> gp-0 quad) (-> self collide-info trans quad))
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(ja-no-eval :group! sharkey-chomp-ja :num! (seek! (ja-aframe 3.0 0) 2.0) :frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(sharkey-get-player-position s5-0)
|
||||
(setup-from-to-duration! (-> self jump-trajectory) gp-0 s5-0 3.0 -291.27112)
|
||||
(set! (-> self attack-time) (ja-aframe-num 0))
|
||||
(sharkey-follow-trajectory (-> self attack-time))
|
||||
(suspend)
|
||||
(ja :num! (seek! (ja-aframe 3.0 0) 2.0))))
|
||||
(when (send-event *target* 'attack-invinc #f (static-attack-info ((mode 'sharkey))))
|
||||
(logclear! (-> self mask) (process-mask enemy))
|
||||
(vector-float*! (-> self collide-info transv) (-> self collide-info transv) 8.0)
|
||||
(set-time! (-> self state-time))
|
||||
(let ((f30-0 -409600.0)
|
||||
(f28-0 (-> self collide-info transv y))
|
||||
(f26-0 (-> self collide-info trans y)))
|
||||
(until (time-elapsed? (-> self state-time) (seconds 3))
|
||||
(ja-no-eval :group! sharkey-chomp-ja :num! (seek!) :frame-num (ja-aframe 3.0 0))
|
||||
(until (ja-done? 0)
|
||||
(+! f28-0 (* f30-0 (seconds-per-frame)))
|
||||
(+! f26-0 (* f28-0 (seconds-per-frame)))
|
||||
(set! (-> self collide-info transv y) f28-0)
|
||||
(when (< (-> self collide-info trans y) (-> self water height))
|
||||
(set! f28-0 (* 0.9 f28-0))
|
||||
(vector-float*! (-> self collide-info transv) (-> self collide-info transv) 0.9))
|
||||
(vector-normalize-copy! (-> self dir) (-> self collide-info transv) 1.0)
|
||||
(forward-up->quaternion (-> self collide-info quat) (-> self dir) *up-vector*)
|
||||
(integrate-for-enemy-with-move-to-ground! (-> self collide-info)
|
||||
(-> self collide-info transv)
|
||||
(collide-kind background)
|
||||
8192.0
|
||||
#t
|
||||
#f
|
||||
#f)
|
||||
(set! (-> self collide-info trans y) f26-0)
|
||||
(suspend)
|
||||
(ja :num! (seek!)))))
|
||||
(send-event *target* 'end-mode)
|
||||
(logior! (-> self mask) (process-mask enemy)))
|
||||
(sharkey-reset-position)
|
||||
(logior! (-> self draw status) (draw-status hidden))
|
||||
(go-virtual nav-enemy-idle))
|
||||
:post
|
||||
(behavior ()
|
||||
(nav-enemy-simple-post)))
|
||||
|
||||
(defstate nav-enemy-chase (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:exit (behavior ()
|
||||
(sound-stop (-> self sound-id))
|
||||
)
|
||||
:trans (behavior ()
|
||||
(if (not *target*)
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
(let ((gp-0 (-> *target* control trans)))
|
||||
(let ((s5-0 (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos)))
|
||||
(s4-0 'racer)
|
||||
(a1-0 (new 'stack-no-clear 'event-message-block))
|
||||
)
|
||||
(set! (-> a1-0 from) self)
|
||||
(set! (-> a1-0 num-params) 1)
|
||||
(set! (-> a1-0 message) 'query)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'mode))
|
||||
(if (or (= s4-0 (send-event-function *target* a1-0)) (not s5-0))
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
(when (logtest? (-> *target* control status) (cshape-moving-flags onground))
|
||||
(set! (-> self player-in-water) (logtest? (-> *target* control status) (cshape-moving-flags on-water)))
|
||||
(if (-> self player-in-water)
|
||||
(set-time! (-> self player-water-time))
|
||||
)
|
||||
)
|
||||
(if (and *target* (>= 8192.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans))))
|
||||
(go-virtual nav-enemy-attack)
|
||||
)
|
||||
(cond
|
||||
((-> self player-in-water)
|
||||
(set-time! (-> self free-time))
|
||||
(if (and (< (fabs (- (-> gp-0 y) (-> self collide-info trans y))) 40960.0)
|
||||
(< (vector-vector-xz-distance gp-0 (-> self collide-info trans)) 24576.0)
|
||||
)
|
||||
(go-virtual nav-enemy-attack)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(if (time-elapsed? (-> self free-time) (seconds 3))
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-10 (-> self nav target-poly)))
|
||||
(if (and a0-10 (logtest? (-> a0-10 pat) 2))
|
||||
:exit
|
||||
(behavior ()
|
||||
(sound-stop (-> self sound-id)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (not *target*) (go-virtual nav-enemy-patrol))
|
||||
(let ((gp-0 (-> *target* control trans)))
|
||||
(let ((s5-0 (nav-enemy-test-point-near-nav-mesh? (-> *target* control shadow-pos)))
|
||||
(s4-0 'racer)
|
||||
(a1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-0 from) self)
|
||||
(set! (-> a1-0 num-params) 1)
|
||||
(set! (-> a1-0 message) 'query)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'mode))
|
||||
(if (or (= s4-0 (send-event-function *target* a1-0)) (not s5-0)) (go-virtual nav-enemy-patrol)))
|
||||
(when (logtest? (-> *target* control status) (cshape-moving-flags onground))
|
||||
(set! (-> self player-in-water) (logtest? (-> *target* control status) (cshape-moving-flags on-water)))
|
||||
(if (-> self player-in-water) (set-time! (-> self player-water-time))))
|
||||
(if (and *target* (>= 8192.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans))))
|
||||
(go-virtual nav-enemy-attack))
|
||||
(cond
|
||||
((-> self player-in-water)
|
||||
(set-time! (-> self free-time))
|
||||
(if (and (< (fabs (- (-> gp-0 y) (-> self collide-info trans y))) 40960.0)
|
||||
(< (vector-vector-xz-distance gp-0 (-> self collide-info trans)) 24576.0))
|
||||
(go-virtual nav-enemy-attack)))
|
||||
(else (if (time-elapsed? (-> self free-time) (seconds 3)) (go-virtual nav-enemy-patrol)))))
|
||||
(let ((a0-10 (-> self nav target-poly)))
|
||||
(if (and a0-10 (logtest? (-> a0-10 pat) 2))
|
||||
(set! (-> self target-speed) (* 2.0 (-> self chase-speed)))
|
||||
(set! (-> self target-speed) (-> self chase-speed))
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(set-time! (-> self player-water-time))
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(sound-play "bigshark-idle")
|
||||
(loop
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info run-anim))
|
||||
:num! (seek! max (-> self anim-speed))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 (* 3.0 (seconds-per-frame)))
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
:post (behavior ()
|
||||
(sharkey-get-player-position (-> self nav target-pos))
|
||||
(nav-enemy-travel-post)
|
||||
(let* ((f3-0 (vector-vector-distance (-> self collide-info trans) (-> self nav target-pos)))
|
||||
(f1-2 (fmax 0.0 (fmin 1.0 (- 1.0 (/ (+ -24576.0 f3-0) (+ -24576.0 (-> self spawn-distance)))))))
|
||||
(f0-2 (+ 0.5 (* 1.5 f1-2)))
|
||||
)
|
||||
(sound-play
|
||||
"bigshark-alert"
|
||||
:id (-> self sound-id)
|
||||
:pitch f0-2
|
||||
:position (the-as symbol (-> self collide-info trans))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> self target-speed) (-> self chase-speed)))))
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self player-water-time))
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(sound-play "bigshark-idle")
|
||||
(loop
|
||||
(ja-no-eval :group!
|
||||
(-> self draw art-group data (-> self nav-info run-anim))
|
||||
:num!
|
||||
(seek! max (-> self anim-speed))
|
||||
:frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 (* 3.0 (seconds-per-frame)))
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed))))))
|
||||
:post
|
||||
(behavior ()
|
||||
(sharkey-get-player-position (-> self nav target-pos))
|
||||
(nav-enemy-travel-post)
|
||||
(let* ((f3-0 (vector-vector-distance (-> self collide-info trans) (-> self nav target-pos)))
|
||||
(f1-2 (fmax 0.0 (fmin 1.0 (- 1.0 (/ (+ -24576.0 f3-0) (+ -24576.0 (-> self spawn-distance)))))))
|
||||
(f0-2 (+ 0.5 (* 1.5 f1-2))))
|
||||
(sound-play "bigshark-alert" :id (-> self sound-id) :pitch f0-2 :position (the-as symbol (-> self collide-info trans))))))
|
||||
|
||||
(defstate nav-enemy-stop-chase (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(loop
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info walk-anim))
|
||||
:num! (seek! max (-> self anim-speed))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(loop
|
||||
(ja-no-eval :group!
|
||||
(-> self draw art-group data (-> self nav-info walk-anim))
|
||||
:num!
|
||||
(seek! max (-> self anim-speed))
|
||||
:frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))))))
|
||||
|
||||
(defstate nav-enemy-stare (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:trans (behavior ()
|
||||
(if (target-in-range? self (-> self nav-info notice-distance))
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
(if (time-elapsed? (-> self state-time) (-> self state-timeout))
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info idle-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(loop
|
||||
(ja :num! (loop! (-> self anim-speed)))
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (target-in-range? self (-> self nav-info notice-distance)) (go-virtual nav-enemy-chase))
|
||||
(if (time-elapsed? (-> self state-time) (-> self state-timeout)) (go-virtual nav-enemy-patrol)))
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.17))
|
||||
(ja :group! (-> self draw art-group data (-> self nav-info idle-anim)))
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(loop
|
||||
(ja :num! (loop! (-> self anim-speed)))
|
||||
(seek! (-> self anim-speed) 1.0 0.05)
|
||||
(seek! (-> self collide-info trans y) (-> self y-max) (* (-> self y-speed) (seconds-per-frame)))
|
||||
(suspend))))
|
||||
|
||||
(defstate nav-enemy-victory (sharkey)
|
||||
:virtual #t
|
||||
:event nav-enemy-default-event-handler
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(dotimes (gp-0 3)
|
||||
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info victory-anim))
|
||||
:num! (seek! max (-> self anim-speed))
|
||||
:frame-num 0.0
|
||||
)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))
|
||||
)
|
||||
)
|
||||
(go-virtual nav-enemy-stare)
|
||||
)
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.075))
|
||||
(dotimes (gp-0 3)
|
||||
(ja-no-eval :group!
|
||||
(-> self draw art-group data (-> self nav-info victory-anim))
|
||||
:num!
|
||||
(seek! max (-> self anim-speed))
|
||||
:frame-num 0.0)
|
||||
(until (ja-done? 0)
|
||||
(suspend)
|
||||
(ja :num! (seek! max (-> self anim-speed)))))
|
||||
(go-virtual nav-enemy-stare)))
|
||||
|
||||
(define *sharkey-nav-enemy-info* (new 'static 'nav-enemy-info
|
||||
:idle-anim 2
|
||||
:walk-anim 2
|
||||
:turn-anim -1
|
||||
:notice-anim 2
|
||||
:run-anim 2
|
||||
:jump-anim -1
|
||||
:jump-land-anim -1
|
||||
:victory-anim 2
|
||||
:taunt-anim 2
|
||||
:die-anim 2
|
||||
:neck-joint -1
|
||||
:player-look-at-joint 5
|
||||
:run-travel-speed (meters 12)
|
||||
:run-rotate-speed (degrees 1999.9999)
|
||||
:run-acceleration (meters 6)
|
||||
:run-turn-time (seconds 0.5)
|
||||
:walk-travel-speed (meters 6)
|
||||
:walk-rotate-speed (degrees 1999.9999)
|
||||
:walk-acceleration (meters 6)
|
||||
:walk-turn-time (seconds 0.5)
|
||||
:attack-shove-back (meters 1)
|
||||
:attack-shove-up (meters 0.5)
|
||||
:shadow-size (meters 2)
|
||||
:notice-nav-radius (meters 3)
|
||||
:nav-nearest-y-threshold (meters 10)
|
||||
:notice-distance (meters 500)
|
||||
:stop-chase-distance (meters 510)
|
||||
:frustration-distance (meters 8)
|
||||
:frustration-time (seconds 4)
|
||||
:die-anim-hold-frame 10000000000.0
|
||||
:jump-land-anim-end-frame 10000000000.0
|
||||
:jump-height-min (meters 1)
|
||||
:jump-height-factor 0.5
|
||||
:jump-start-anim-speed 1.0
|
||||
:shadow-max-y (meters 1)
|
||||
:shadow-min-y (meters -1)
|
||||
:shadow-locus-dist (meters 150)
|
||||
:use-align #f
|
||||
:draw-shadow #f
|
||||
:move-to-ground #f
|
||||
:hover-if-no-ground #f
|
||||
:use-momentum #t
|
||||
:use-flee #f
|
||||
:use-proximity-notice #f
|
||||
:use-jump-blocked #f
|
||||
:use-jump-patrol #f
|
||||
:gnd-collide-with (collide-kind background)
|
||||
:debug-draw-neck #f
|
||||
:debug-draw-jump #f
|
||||
)
|
||||
)
|
||||
(define *sharkey-nav-enemy-info*
|
||||
(new 'static
|
||||
'nav-enemy-info
|
||||
:idle-anim 2
|
||||
:walk-anim 2
|
||||
:turn-anim -1
|
||||
:notice-anim 2
|
||||
:run-anim 2
|
||||
:jump-anim -1
|
||||
:jump-land-anim -1
|
||||
:victory-anim 2
|
||||
:taunt-anim 2
|
||||
:die-anim 2
|
||||
:neck-joint -1
|
||||
:player-look-at-joint 5
|
||||
:run-travel-speed (meters 12)
|
||||
:run-rotate-speed (degrees 1999.9999)
|
||||
:run-acceleration (meters 6)
|
||||
:run-turn-time (seconds 0.5)
|
||||
:walk-travel-speed (meters 6)
|
||||
:walk-rotate-speed (degrees 1999.9999)
|
||||
:walk-acceleration (meters 6)
|
||||
:walk-turn-time (seconds 0.5)
|
||||
:attack-shove-back (meters 1)
|
||||
:attack-shove-up (meters 0.5)
|
||||
:shadow-size (meters 2)
|
||||
:notice-nav-radius (meters 3)
|
||||
:nav-nearest-y-threshold (meters 10)
|
||||
:notice-distance (meters 500)
|
||||
:stop-chase-distance (meters 510)
|
||||
:frustration-distance (meters 8)
|
||||
:frustration-time (seconds 4)
|
||||
:die-anim-hold-frame 10000000000.0
|
||||
:jump-land-anim-end-frame 10000000000.0
|
||||
:jump-height-min (meters 1)
|
||||
:jump-height-factor 0.5
|
||||
:jump-start-anim-speed 1.0
|
||||
:shadow-max-y (meters 1)
|
||||
:shadow-min-y (meters -1)
|
||||
:shadow-locus-dist (meters 150)
|
||||
:use-align #f
|
||||
:draw-shadow #f
|
||||
:move-to-ground #f
|
||||
:hover-if-no-ground #f
|
||||
:use-momentum #t
|
||||
:use-flee #f
|
||||
:use-proximity-notice #f
|
||||
:use-jump-blocked #f
|
||||
:use-jump-patrol #f
|
||||
:gnd-collide-with (collide-kind background)
|
||||
:debug-draw-neck #f
|
||||
:debug-draw-jump #f))
|
||||
|
||||
(defmethod init-from-entity! ((this sharkey) (arg0 entity-actor))
|
||||
(set! (-> this scale) (res-lump-float arg0 'scale :default 1.0))
|
||||
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
||||
(set! (-> s4-0 reaction) default-collision-reaction)
|
||||
(set! (-> s4-0 no-reaction)
|
||||
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
||||
)
|
||||
(set! (-> s4-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
|
||||
(let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 1))))
|
||||
(set! (-> s3-0 prim-core collide-as) (collide-kind enemy))
|
||||
(set! (-> s3-0 collide-with) (collide-kind target))
|
||||
(set! (-> s3-0 prim-core offense) (collide-offense normal-attack))
|
||||
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 (* 6144.0 (-> this scale)))
|
||||
(set-root-prim! s4-0 s3-0)
|
||||
)
|
||||
(set-root-prim! s4-0 s3-0))
|
||||
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
|
||||
(backup-collide-with-as s4-0)
|
||||
(set! (-> this collide-info) s4-0)
|
||||
)
|
||||
(set! (-> this collide-info) s4-0))
|
||||
(process-drawable-from-entity! this arg0)
|
||||
(initialize-skeleton this *sharkey-sg* '())
|
||||
(init-defaults! this *sharkey-nav-enemy-info*)
|
||||
@@ -636,8 +500,7 @@ nav-enemy-default-event-handler
|
||||
(set! (-> this anim-speed) 1.0)
|
||||
(set-vector! (-> this collide-info scale) (-> this scale) (-> this scale) (-> this scale) 1.0)
|
||||
(set! (-> this reaction-time)
|
||||
(the-as time-frame (the int (* 300.0 (res-lump-float (-> this entity) 'delay :default 1.0))))
|
||||
)
|
||||
(the-as time-frame (the int (* 300.0 (res-lump-float (-> this entity) 'delay :default 1.0)))))
|
||||
(set! (-> this spawn-distance) (res-lump-float (-> this entity) 'distance :default 122880.0))
|
||||
(set! (-> this chase-speed) (res-lump-float (-> this entity) 'speed :default 49152.0))
|
||||
(set! (-> this y-speed) (-> this chase-speed))
|
||||
@@ -645,5 +508,4 @@ nav-enemy-default-event-handler
|
||||
(set! (-> this sound-id) (new-sound-id))
|
||||
(set! (-> this enemy-info cam-vert) 49152.0)
|
||||
(go (method-of-object this nav-enemy-idle))
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
@@ -1,28 +1,19 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/sound/gsound.gc")
|
||||
|
||||
;; name: ticky.gc
|
||||
;; name in dgo: ticky
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype ticky (structure)
|
||||
((delay-til-ramp time-frame)
|
||||
(delay-til-timeout time-frame)
|
||||
(starting-time time-frame)
|
||||
(last-tick-time time-frame)
|
||||
)
|
||||
((delay-til-ramp time-frame)
|
||||
(delay-til-timeout time-frame)
|
||||
(starting-time time-frame)
|
||||
(last-tick-time time-frame))
|
||||
(:methods
|
||||
(sleep (_type_ time-frame) none)
|
||||
(reached-delay? (_type_ time-frame) symbol)
|
||||
(completed? (_type_) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
(sleep (_type_ time-frame) none)
|
||||
(reached-delay? (_type_ time-frame) symbol)
|
||||
(completed? (_type_) symbol)))
|
||||
|
||||
(defmethod sleep ((this ticky) (arg0 time-frame))
|
||||
(set-time! (-> this starting-time))
|
||||
@@ -30,36 +21,22 @@
|
||||
(set! (-> this delay-til-ramp) (max 0 (+ arg0 (seconds -4))))
|
||||
(set! (-> this last-tick-time) 0)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod completed? ((this ticky))
|
||||
(let ((gp-0 #f))
|
||||
(let ((v1-2 (- (current-time) (-> this starting-time))))
|
||||
(cond
|
||||
((>= v1-2 (-> this delay-til-timeout))
|
||||
(set! gp-0 #t)
|
||||
)
|
||||
((>= v1-2 (-> this delay-til-timeout)) (set! gp-0 #t))
|
||||
(else
|
||||
(let* ((f0-1 (fmin 1.0 (/ (the float (max 0 (- v1-2 (-> this delay-til-ramp))))
|
||||
(the float (- (-> this delay-til-timeout) (-> this delay-til-ramp)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(v1-7 (the int (lerp 105.0 41.0 f0-1)))
|
||||
)
|
||||
(when (time-elapsed? (-> this last-tick-time) v1-7)
|
||||
(set-time! (-> this last-tick-time))
|
||||
(sound-play "stopwatch")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
(let* ((f0-1 (fmin 1.0
|
||||
(/ (the float (max 0 (- v1-2 (-> this delay-til-ramp))))
|
||||
(the float (- (-> this delay-til-timeout) (-> this delay-til-ramp))))))
|
||||
(v1-7 (the int (lerp 105.0 41.0 f0-1))))
|
||||
(when (time-elapsed? (-> this last-tick-time) v1-7)
|
||||
(set-time! (-> this last-tick-time))
|
||||
(sound-play "stopwatch"))))))
|
||||
gp-0))
|
||||
|
||||
(defmethod reached-delay? ((this ticky) (arg0 time-frame))
|
||||
(time-elapsed? (-> this starting-time) arg0)
|
||||
)
|
||||
(time-elapsed? (-> this starting-time) arg0))
|
||||
@@ -1,30 +1,21 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "GAME.CGO")
|
||||
|
||||
(require "engine/math/quaternion.gc")
|
||||
(require "engine/game/game-h.gc")
|
||||
|
||||
;; name: tippy.gc
|
||||
;; name in dgo: tippy
|
||||
;; dgos: GAME, COMMON, L1
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype tippy (structure)
|
||||
((axis vector :inline)
|
||||
(angle float)
|
||||
(orig quaternion :inline)
|
||||
(dist-ratio float)
|
||||
(damping float)
|
||||
(1-damping float)
|
||||
)
|
||||
((axis vector :inline)
|
||||
(angle float)
|
||||
(orig quaternion :inline)
|
||||
(dist-ratio float)
|
||||
(damping float)
|
||||
(1-damping float))
|
||||
(:methods
|
||||
(reset! (_type_ process-drawable float float) none)
|
||||
(tippy-method-10 (_type_ process-drawable vector) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
(reset! (_type_ process-drawable float float) none)
|
||||
(tippy-method-10 (_type_ process-drawable vector) symbol)))
|
||||
|
||||
(defmethod reset! ((this tippy) (arg0 process-drawable) (arg1 float) (arg2 float))
|
||||
(set-vector! (-> this axis) 0.0 0.0 0.0 1.0)
|
||||
@@ -34,40 +25,30 @@
|
||||
(set! (-> this damping) arg2)
|
||||
(set! (-> this 1-damping) (- 1.0 arg2))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defmethod tippy-method-10 ((this tippy) (arg0 process-drawable) (arg1 vector))
|
||||
(let ((s4-0 #t))
|
||||
(cond
|
||||
(arg1
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
||||
0.0
|
||||
(set! (-> s3-0 x) (- (-> arg1 z) (-> arg0 root trans z)))
|
||||
(set! (-> s3-0 y) 0.0)
|
||||
(set! (-> s3-0 z) (- (-> arg0 root trans x) (-> arg1 x)))
|
||||
(let ((f0-6 (vector-length s3-0)))
|
||||
(vector-float*! s3-0 s3-0 (/ 1.0 f0-6))
|
||||
(let ((f30-0 (* f0-6 (-> this dist-ratio))))
|
||||
(set! (-> this axis x) (+ (* (-> this 1-damping) (-> this axis x)) (* (-> this damping) (-> s3-0 x))))
|
||||
(set! (-> this axis y) 0.0)
|
||||
(set! (-> this axis z) (+ (* (-> this 1-damping) (-> this axis z)) (* (-> this damping) (-> s3-0 z))))
|
||||
(vector-normalize! (-> this axis) 1.0)
|
||||
(set! (-> this angle) (+ (* (-> this 1-damping) (-> this angle)) (* (-> this damping) f30-0)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
||||
0.0
|
||||
(set! (-> s3-0 x) (- (-> arg1 z) (-> arg0 root trans z)))
|
||||
(set! (-> s3-0 y) 0.0)
|
||||
(set! (-> s3-0 z) (- (-> arg0 root trans x) (-> arg1 x)))
|
||||
(let ((f0-6 (vector-length s3-0)))
|
||||
(vector-float*! s3-0 s3-0 (/ 1.0 f0-6))
|
||||
(let ((f30-0 (* f0-6 (-> this dist-ratio))))
|
||||
(set! (-> this axis x) (+ (* (-> this 1-damping) (-> this axis x)) (* (-> this damping) (-> s3-0 x))))
|
||||
(set! (-> this axis y) 0.0)
|
||||
(set! (-> this axis z) (+ (* (-> this 1-damping) (-> this axis z)) (* (-> this damping) (-> s3-0 z))))
|
||||
(vector-normalize! (-> this axis) 1.0)
|
||||
(set! (-> this angle) (+ (* (-> this 1-damping) (-> this angle)) (* (-> this damping) f30-0)))))))
|
||||
(else
|
||||
(set! (-> this angle) (* (-> this 1-damping) (-> this angle)))
|
||||
(when (< (-> this angle) 182.04445)
|
||||
(set! (-> this angle) 0.0)
|
||||
(set! s4-0 #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> this angle) (* (-> this 1-damping) (-> this angle)))
|
||||
(when (< (-> this angle) 182.04445)
|
||||
(set! (-> this angle) 0.0)
|
||||
(set! s4-0 #f))))
|
||||
(quaternion-vector-angle! (-> arg0 root quat) (-> this axis) (-> this angle))
|
||||
(quaternion*! (-> arg0 root quat) (-> arg0 root quat) (-> this orig))
|
||||
s4-0
|
||||
)
|
||||
)
|
||||
s4-0))
|
||||
@@ -1,190 +1,140 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/camera/camera.gc")
|
||||
(require "engine/common-obs/process-drawable.gc")
|
||||
(require "engine/game/settings.gc")
|
||||
|
||||
;; name: voicebox.gc
|
||||
;; name in dgo: voicebox
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype camera-voicebox (camera-slave)
|
||||
()
|
||||
(deftype camera-voicebox (camera-slave) ()
|
||||
(:states
|
||||
cam-voicebox
|
||||
)
|
||||
)
|
||||
|
||||
cam-voicebox))
|
||||
|
||||
(deftype voicebox (process-drawable)
|
||||
((parent-override (pointer camera-voicebox) :overlay-at parent)
|
||||
(base-trans vector :inline)
|
||||
(seeker cam-float-seeker :inline)
|
||||
(blend float)
|
||||
(twist float)
|
||||
(hint handle)
|
||||
)
|
||||
((parent-override (pointer camera-voicebox) :overlay-at parent)
|
||||
(base-trans vector :inline)
|
||||
(seeker cam-float-seeker :inline)
|
||||
(blend float)
|
||||
(twist float)
|
||||
(hint handle))
|
||||
(:state-methods
|
||||
enter
|
||||
idle
|
||||
exit
|
||||
)
|
||||
)
|
||||
|
||||
enter
|
||||
idle
|
||||
exit))
|
||||
|
||||
(defstate empty-state (process)
|
||||
:code nothing
|
||||
)
|
||||
:code nothing)
|
||||
|
||||
(defskelgroup *voicebox-sg* speaker speaker-lod0-jg speaker-idle-ja
|
||||
((speaker-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 4)
|
||||
)
|
||||
(defskelgroup *voicebox-sg*
|
||||
speaker
|
||||
speaker-lod0-jg
|
||||
speaker-idle-ja
|
||||
((speaker-lod0-mg (meters 999999)))
|
||||
:bounds (static-spherem 0 0 0 4))
|
||||
|
||||
(defbehavior voicebox-track voicebox ()
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector))
|
||||
(s5-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(s5-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> gp-0 quad) (-> self parent-override 0 trans quad))
|
||||
(set! (-> s5-0 quad) (-> (target-pos 68) quad))
|
||||
(when *target*
|
||||
(let ((a2-0 (vector-z-quaternion! (new-stack-vector0) (-> *target* control unknown-quaternion00))))
|
||||
(vector+float*! s5-0 s5-0 a2-0 (* -16384.0 (- 1.0 (-> self blend))))
|
||||
)
|
||||
)
|
||||
(vector-lerp! (-> self root trans) gp-0 s5-0 (-> self blend))
|
||||
)
|
||||
(vector+float*! s5-0 s5-0 a2-0 (* -16384.0 (- 1.0 (-> self blend))))))
|
||||
(vector-lerp! (-> self root trans) gp-0 s5-0 (-> self blend)))
|
||||
(+! (-> self root trans y) (* 1638.4 (sin (* 54.613335 (the float (mod (current-time) 1200))))))
|
||||
(let ((gp-1 (new 'stack-no-clear 'quaternion)))
|
||||
(forward-up->quaternion
|
||||
gp-1
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) (target-pos 37) (-> self root trans)) 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0)
|
||||
)
|
||||
(rotate-toward-orientation! (-> self root) gp-1 65536.0 5461.3335)
|
||||
)
|
||||
(forward-up->quaternion gp-1
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) (target-pos 37) (-> self root trans)) 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0))
|
||||
(rotate-toward-orientation! (-> self root) gp-1 65536.0 5461.3335))
|
||||
(when *target*
|
||||
(let* ((gp-2 (-> *target* control))
|
||||
(s4-2 (-> self root trans))
|
||||
(f0-8
|
||||
(deg-diff (y-angle gp-2) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s4-2 (-> gp-2 trans))))
|
||||
)
|
||||
)
|
||||
(f0-8 (deg-diff (y-angle gp-2) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s4-2 (-> gp-2 trans))))))
|
||||
(if (< 0.0 f0-8)
|
||||
(seek! (-> self twist) -0.4 (* 0.3 (seconds-per-frame)))
|
||||
(seek! (-> self twist) 0.4 (* 0.3 (seconds-per-frame)))
|
||||
)
|
||||
)
|
||||
(seek! (-> self twist) -0.4 (* 0.3 (seconds-per-frame)))
|
||||
(seek! (-> self twist) 0.4 (* 0.3 (seconds-per-frame)))))
|
||||
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-9 from) self)
|
||||
(set! (-> a1-9 num-params) 0)
|
||||
(set! (-> a1-9 message) 'blocked-side?)
|
||||
(case (send-event-function (ppointer->process (-> self parent-override)) a1-9)
|
||||
((1)
|
||||
(set! (-> self twist) 0.5)
|
||||
)
|
||||
((2)
|
||||
(set! (-> self twist) -0.5)
|
||||
)
|
||||
((3)
|
||||
(set! (-> self twist) 0.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event (ppointer->process (-> self parent-override)) 'joystick (-> self twist) -1.0)
|
||||
)
|
||||
((1) (set! (-> self twist) 0.5))
|
||||
((2) (set! (-> self twist) -0.5))
|
||||
((3) (set! (-> self twist) 0.0))))
|
||||
(send-event (ppointer->process (-> self parent-override)) 'joystick (-> self twist) -1.0))
|
||||
(set! (-> self root scale x) (lerp-scale 1.0 0.0 (-> self blend) 0.8 1.0))
|
||||
(set! (-> self root scale y) (-> self root scale x))
|
||||
(set! (-> self root scale z) (-> self root scale x))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defstate enter (voicebox)
|
||||
:virtual #t
|
||||
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('die)
|
||||
(go-virtual exit)
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(voicebox-track)
|
||||
(if (< 0.1 (-> self blend))
|
||||
(point-toward-point-clear-roll-pitch! (-> self root) (target-pos 0))
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(set-setting! 'sound-flava #f 20.0 (music-flava assistant))
|
||||
(if (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action racer)))
|
||||
(send-event
|
||||
(ppointer->process (-> self parent-override))
|
||||
'set-dist
|
||||
(new 'static 'vector :z 8192.0 :w 1.0)
|
||||
(new 'static 'vector :y 20480.0 :z 12288.0 :w 1.0)
|
||||
)
|
||||
(send-event
|
||||
(ppointer->process (-> self parent-override))
|
||||
'set-dist
|
||||
(new 'static 'vector :z 16384.0 :w 1.0)
|
||||
(new 'static 'vector :y 20480.0 :z 40960.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
(init-cam-float-seeker (-> self seeker) 1.0 0.01 0.022222223 0.1)
|
||||
(set! (-> self seeker target) 0.0)
|
||||
(while (< 0.0001 (-> self blend))
|
||||
(update! (-> self seeker) 0.0)
|
||||
(set! (-> self blend) (-> self seeker value))
|
||||
(suspend)
|
||||
)
|
||||
(set! (-> self blend) 0.0)
|
||||
(go-virtual idle)
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
:event
|
||||
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
||||
(case message
|
||||
(('die) (go-virtual exit))))
|
||||
:trans
|
||||
(behavior ()
|
||||
(voicebox-track)
|
||||
(if (< 0.1 (-> self blend)) (point-toward-point-clear-roll-pitch! (-> self root) (target-pos 0))))
|
||||
:code
|
||||
(behavior ()
|
||||
(set-setting! 'sound-flava #f 20.0 (music-flava assistant))
|
||||
(if (and *target* (logtest? (-> *target* control root-prim prim-core action) (collide-action racer)))
|
||||
(send-event (ppointer->process (-> self parent-override))
|
||||
'set-dist
|
||||
(new 'static 'vector :z 8192.0 :w 1.0)
|
||||
(new 'static 'vector :y 20480.0 :z 12288.0 :w 1.0))
|
||||
(send-event (ppointer->process (-> self parent-override))
|
||||
'set-dist
|
||||
(new 'static 'vector :z 16384.0 :w 1.0)
|
||||
(new 'static 'vector :y 20480.0 :z 40960.0 :w 1.0)))
|
||||
(init-cam-float-seeker (-> self seeker) 1.0 0.01 0.022222223 0.1)
|
||||
(set! (-> self seeker target) 0.0)
|
||||
(while (< 0.0001 (-> self blend))
|
||||
(update! (-> self seeker) 0.0)
|
||||
(set! (-> self blend) (-> self seeker value))
|
||||
(suspend))
|
||||
(set! (-> self blend) 0.0)
|
||||
(go-virtual idle))
|
||||
:post ja-post)
|
||||
|
||||
(defstate idle (voicebox)
|
||||
:virtual #t
|
||||
:event (-> (method-of-type voicebox enter) event)
|
||||
:event
|
||||
(-> (method-of-type voicebox enter)
|
||||
event)
|
||||
:trans voicebox-track
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(suspend)
|
||||
(ja :num! (loop!))
|
||||
)
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(loop
|
||||
(suspend)
|
||||
(ja :num! (loop!))))
|
||||
:post ja-post)
|
||||
|
||||
(defstate exit (voicebox)
|
||||
:virtual #t
|
||||
:trans voicebox-track
|
||||
:code (behavior ()
|
||||
(remove-setting! 'sound-flava)
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> self seeker target) 1.0)
|
||||
(while (and (< (-> self blend) 0.9999) (not (and (not (handle->process (-> self hint)))
|
||||
(time-elapsed? (-> self state-time) (seconds 0.05))
|
||||
(-> *setting-control* current hint)
|
||||
)
|
||||
)
|
||||
)
|
||||
(update! (-> self seeker) 0.0)
|
||||
(set! (-> self blend) (-> self seeker value))
|
||||
:code
|
||||
(behavior ()
|
||||
(remove-setting! 'sound-flava)
|
||||
(set-time! (-> self state-time))
|
||||
(set! (-> self seeker target) 1.0)
|
||||
(while (and (< (-> self blend) 0.9999)
|
||||
(not (and (not (handle->process (-> self hint)))
|
||||
(time-elapsed? (-> self state-time) (seconds 0.05))
|
||||
(-> *setting-control* current hint))))
|
||||
(update! (-> self seeker) 0.0)
|
||||
(set! (-> self blend) (-> self seeker value))
|
||||
(suspend))
|
||||
(set! (-> self blend) 1.0)
|
||||
(send-event (ppointer->process (-> self parent-override)) 'go empty-state)
|
||||
(suspend)
|
||||
)
|
||||
(set! (-> self blend) 1.0)
|
||||
(send-event (ppointer->process (-> self parent-override)) 'go empty-state)
|
||||
(suspend)
|
||||
0
|
||||
)
|
||||
:post ja-post
|
||||
)
|
||||
0)
|
||||
:post ja-post)
|
||||
|
||||
(defbehavior voicebox-init-by-other voicebox ((arg0 vector) (arg1 handle))
|
||||
(set! (-> self root) (new 'process 'trsqv))
|
||||
@@ -194,27 +144,23 @@
|
||||
(initialize-skeleton self *voicebox-sg* '())
|
||||
(set! (-> self blend) 1.0)
|
||||
(go-virtual enter)
|
||||
(none)
|
||||
)
|
||||
(none))
|
||||
|
||||
(defstate cam-voicebox (camera-voicebox)
|
||||
:event (-> cam-string event)
|
||||
:enter (-> cam-string enter)
|
||||
:trans (behavior ()
|
||||
(if (not (logtest? (-> *camera* master-options) 2))
|
||||
(deactivate self)
|
||||
)
|
||||
)
|
||||
:code (-> cam-string code)
|
||||
)
|
||||
:event
|
||||
(-> cam-string
|
||||
event)
|
||||
:enter
|
||||
(-> cam-string
|
||||
enter)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if (not (logtest? (-> *camera* master-options) 2)) (deactivate self)))
|
||||
:code
|
||||
(-> cam-string
|
||||
code))
|
||||
|
||||
(defun voicebox-spawn ((arg0 process) (arg1 vector))
|
||||
(with-pp
|
||||
(let ((s4-0 (process-spawn camera-voicebox :init cam-slave-init cam-voicebox #f :from *camera-dead-pool* :to arg0))
|
||||
)
|
||||
(if s4-0
|
||||
(process-spawn voicebox arg1 (process->handle pp) :to (ppointer->process s4-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-0 (process-spawn camera-voicebox :init cam-slave-init cam-voicebox #f :from *camera-dead-pool* :to arg0)))
|
||||
(if s4-0 (process-spawn voicebox arg1 (process->handle pp) :to (ppointer->process s4-0))))))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,15 +1,9 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/game/main-h.gc")
|
||||
(require "engine/game/game-h.gc")
|
||||
(require "kernel/gkernel-h.gc")
|
||||
|
||||
;; name: water-h.gc
|
||||
;; name in dgo: water-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defenum water-flags
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
@@ -44,64 +38,58 @@
|
||||
(wt28)
|
||||
(wt29)
|
||||
(wt30)
|
||||
(wt31)
|
||||
)
|
||||
(wt31))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype water-control (basic)
|
||||
((flags water-flags)
|
||||
(process process-drawable)
|
||||
(joint-index int32)
|
||||
(top-y-offset float)
|
||||
(ripple-size meters)
|
||||
(enter-water-time time-frame)
|
||||
(wade-time time-frame)
|
||||
(on-water-time time-frame)
|
||||
(enter-swim-time time-frame)
|
||||
(swim-time time-frame)
|
||||
(base-height meters)
|
||||
(wade-height meters)
|
||||
(swim-height meters)
|
||||
(surface-height meters)
|
||||
(bottom-height meters)
|
||||
(height meters)
|
||||
(height-offset float 4)
|
||||
(real-ocean-offset meters :overlay-at (-> height-offset 0))
|
||||
(ocean-offset meters :overlay-at (-> height-offset 1))
|
||||
(bob-offset meters :overlay-at (-> height-offset 2))
|
||||
(align-offset meters :overlay-at (-> height-offset 3))
|
||||
(swim-depth meters)
|
||||
(bob smush-control :inline)
|
||||
(volume handle)
|
||||
(bottom vector 2 :inline)
|
||||
(top vector 2 :inline)
|
||||
(enter-water-pos vector :inline)
|
||||
(drip-old-pos vector :inline)
|
||||
(drip-joint-index int32)
|
||||
(drip-wetness float)
|
||||
(drip-time time-frame)
|
||||
(drip-speed float)
|
||||
(drip-height meters)
|
||||
(drip-mult float)
|
||||
)
|
||||
((flags water-flags)
|
||||
(process process-drawable)
|
||||
(joint-index int32)
|
||||
(top-y-offset float)
|
||||
(ripple-size meters)
|
||||
(enter-water-time time-frame)
|
||||
(wade-time time-frame)
|
||||
(on-water-time time-frame)
|
||||
(enter-swim-time time-frame)
|
||||
(swim-time time-frame)
|
||||
(base-height meters)
|
||||
(wade-height meters)
|
||||
(swim-height meters)
|
||||
(surface-height meters)
|
||||
(bottom-height meters)
|
||||
(height meters)
|
||||
(height-offset float 4)
|
||||
(real-ocean-offset meters :overlay-at (-> height-offset 0))
|
||||
(ocean-offset meters :overlay-at (-> height-offset 1))
|
||||
(bob-offset meters :overlay-at (-> height-offset 2))
|
||||
(align-offset meters :overlay-at (-> height-offset 3))
|
||||
(swim-depth meters)
|
||||
(bob smush-control :inline)
|
||||
(volume handle)
|
||||
(bottom vector 2 :inline)
|
||||
(top vector 2 :inline)
|
||||
(enter-water-pos vector :inline)
|
||||
(drip-old-pos vector :inline)
|
||||
(drip-joint-index int32)
|
||||
(drip-wetness float)
|
||||
(drip-time time-frame)
|
||||
(drip-speed float)
|
||||
(drip-height meters)
|
||||
(drip-mult float))
|
||||
(:methods
|
||||
(new (symbol type process int float float float) _type_)
|
||||
(water-control-method-9 (_type_) none)
|
||||
(water-control-method-10 (_type_) none)
|
||||
(start-bobbing! (_type_ float int int) none)
|
||||
(distance-from-surface (_type_) float)
|
||||
(create-splash (_type_ float vector int vector) none)
|
||||
(display-water-marks? (_type_) symbol)
|
||||
(water-control-method-15 (_type_) none)
|
||||
(water-control-method-16 (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type process int float float float) _type_)
|
||||
(water-control-method-9 (_type_) none)
|
||||
(water-control-method-10 (_type_) none)
|
||||
(start-bobbing! (_type_ float int int) none)
|
||||
(distance-from-surface (_type_) float)
|
||||
(create-splash (_type_ float vector int vector) none)
|
||||
(display-water-marks? (_type_) symbol)
|
||||
(water-control-method-15 (_type_) none)
|
||||
(water-control-method-16 (_type_) none)))
|
||||
|
||||
(defmethod display-water-marks? ((this water-control))
|
||||
(and *display-water-marks* (logtest? (-> this flags) (water-flags wt00)))
|
||||
)
|
||||
(and *display-water-marks* (logtest? (-> this flags) (water-flags wt00))))
|
||||
|
||||
(defmethod new water-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 float) (arg3 float) (arg4 float))
|
||||
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
@@ -114,35 +102,28 @@
|
||||
(set! (-> v0-0 volume) (the-as handle #f))
|
||||
(set! (-> v0-0 drip-mult) 1.0)
|
||||
(set! (-> v0-0 top-y-offset) arg2)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
v0-0))
|
||||
|
||||
(defmethod distance-from-surface ((this water-control))
|
||||
(- (-> this top 0 y) (-> this height))
|
||||
)
|
||||
(- (-> this top 0 y) (-> this height)))
|
||||
|
||||
(deftype water-vol (process-drawable)
|
||||
((water-height meters)
|
||||
(wade-height meters)
|
||||
(swim-height meters)
|
||||
(bottom-height meters)
|
||||
(attack-event symbol)
|
||||
(target handle)
|
||||
(flags water-flags)
|
||||
)
|
||||
((water-height meters)
|
||||
(wade-height meters)
|
||||
(swim-height meters)
|
||||
(bottom-height meters)
|
||||
(attack-event symbol)
|
||||
(target handle)
|
||||
(flags water-flags))
|
||||
(:state-methods
|
||||
water-vol-idle
|
||||
water-vol-startup
|
||||
)
|
||||
water-vol-idle
|
||||
water-vol-startup)
|
||||
(:methods
|
||||
(water-vol-method-22 (_type_) none)
|
||||
(reset-root! (_type_) none)
|
||||
(set-stack-size! (_type_) none)
|
||||
(water-vol-method-25 (_type_) none)
|
||||
(update! (_type_) none)
|
||||
(on-exit-water (_type_) none)
|
||||
(get-ripple-height (_type_ vector) float)
|
||||
(init! (_type_) none)
|
||||
)
|
||||
)
|
||||
(water-vol-method-22 (_type_) none)
|
||||
(reset-root! (_type_) none)
|
||||
(set-stack-size! (_type_) none)
|
||||
(water-vol-method-25 (_type_) none)
|
||||
(update! (_type_) none)
|
||||
(on-exit-water (_type_) none)
|
||||
(get-ripple-height (_type_ vector) float)
|
||||
(init! (_type_) none)))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2542,5 +2542,3 @@
|
||||
(def-art-elt yeti-ag yeti-jump-ja 10)
|
||||
(def-art-elt yeti-ag yeti-jump-land-ja 11)
|
||||
(def-art-elt yeti-ag yeti-turn-ja 12)
|
||||
|
||||
|
||||
+169
-251
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel/gcommon.gc")
|
||||
|
||||
;; name: art-h.gc
|
||||
;; name in dgo: art-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -17,99 +12,73 @@
|
||||
;; base type for all joint animations
|
||||
;; note that this refers to an animation for a single joint.
|
||||
(deftype joint-anim (basic)
|
||||
((name string)
|
||||
(number int16)
|
||||
(length int16)
|
||||
)
|
||||
)
|
||||
((name string)
|
||||
(number int16)
|
||||
(length int16)))
|
||||
|
||||
;; unused? joint-anims
|
||||
|
||||
(deftype joint-anim-matrix (joint-anim)
|
||||
((data matrix :inline :dynamic :offset 16)
|
||||
)
|
||||
)
|
||||
((data matrix :inline :dynamic :offset 16)))
|
||||
|
||||
(deftype joint-anim-transformq (joint-anim)
|
||||
((data transformq :inline :dynamic :offset 16)
|
||||
)
|
||||
)
|
||||
((data transformq :inline :dynamic :offset 16)))
|
||||
|
||||
(deftype joint-anim-drawable (joint-anim)
|
||||
((data drawable :dynamic)
|
||||
)
|
||||
)
|
||||
((data drawable :dynamic)))
|
||||
|
||||
;; joint-anim-compressed is the only type of joint-anim actually used.
|
||||
;; the actual data isn't in here, this is just some metadata
|
||||
;; again, this refers to a single joint
|
||||
(deftype joint-anim-compressed (joint-anim)
|
||||
((data uint32 :dynamic)
|
||||
)
|
||||
)
|
||||
((data uint32 :dynamic)))
|
||||
|
||||
;; a single "frame" in an animation, consists of matrices for each joint.
|
||||
;; unlike the previous types, this is for all of the joints involved in an animation.
|
||||
(deftype joint-anim-frame (structure)
|
||||
((matrices matrix 2 :inline)
|
||||
(data matrix :inline :dynamic)
|
||||
)
|
||||
((matrices matrix 2 :inline)
|
||||
(data matrix :inline :dynamic))
|
||||
(:methods
|
||||
(new (symbol type int) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
(new (symbol type int) _type_)))
|
||||
|
||||
(defmethod new joint-anim-frame ((allocation symbol) (type-to-make type) (arg0 int))
|
||||
"Create a new joint-anim-frame with enough room for arg0 matrices"
|
||||
(let ((v1-1 (max 0 (+ arg0 -2))))
|
||||
(the-as
|
||||
joint-anim-frame
|
||||
(new-dynamic-structure allocation type-to-make (the-as int (+ (-> type-to-make size) (* 48 v1-1))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as joint-anim-frame
|
||||
(new-dynamic-structure allocation type-to-make (the-as int (+ (-> type-to-make size) (* 48 v1-1)))))))
|
||||
|
||||
;; compression header - has info used by decompression algorithm
|
||||
(deftype joint-anim-compressed-hdr (structure)
|
||||
((control-bits uint32 14)
|
||||
(num-joints uint32)
|
||||
(matrix-bits uint32)
|
||||
)
|
||||
)
|
||||
((control-bits uint32 14)
|
||||
(num-joints uint32)
|
||||
(matrix-bits uint32)))
|
||||
|
||||
;; this has the data needed to initialize the decompressor - I believe this
|
||||
;; contains the starting poisition of the joints.
|
||||
(deftype joint-anim-compressed-fixed (structure)
|
||||
((hdr joint-anim-compressed-hdr :inline)
|
||||
(offset-64 uint32)
|
||||
(offset-32 uint32)
|
||||
(offset-16 uint32)
|
||||
(reserved uint32)
|
||||
(data vector 133 :inline)
|
||||
)
|
||||
)
|
||||
((hdr joint-anim-compressed-hdr :inline)
|
||||
(offset-64 uint32)
|
||||
(offset-32 uint32)
|
||||
(offset-16 uint32)
|
||||
(reserved uint32)
|
||||
(data vector 133 :inline)))
|
||||
|
||||
;; these are the actual compressed data frames.
|
||||
;; dynamically sized, depends on the number of joints and the decompression.
|
||||
(deftype joint-anim-compressed-frame (structure)
|
||||
((offset-64 uint32)
|
||||
(offset-32 uint32)
|
||||
(offset-16 uint32)
|
||||
(reserved uint32)
|
||||
(data vector 133 :inline)
|
||||
)
|
||||
)
|
||||
((offset-64 uint32)
|
||||
(offset-32 uint32)
|
||||
(offset-16 uint32)
|
||||
(reserved uint32)
|
||||
(data vector 133 :inline)))
|
||||
|
||||
;; table of frames
|
||||
(deftype joint-anim-compressed-control (structure)
|
||||
((num-frames uint32)
|
||||
(fixed-qwc uint32)
|
||||
(frame-qwc uint32)
|
||||
(fixed joint-anim-compressed-fixed)
|
||||
(data joint-anim-compressed-frame 1)
|
||||
)
|
||||
)
|
||||
((num-frames uint32)
|
||||
(fixed-qwc uint32)
|
||||
(frame-qwc uint32)
|
||||
(fixed joint-anim-compressed-fixed)
|
||||
(data joint-anim-compressed-frame 1)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ART
|
||||
@@ -118,90 +87,74 @@
|
||||
;; "art" is an overly general parent class of all art data.
|
||||
;; it can be either a container of arts (art-group) or a single art (art-element)
|
||||
(declare-type res-lump basic)
|
||||
|
||||
(deftype art (basic)
|
||||
((name string :offset 8)
|
||||
(length int32)
|
||||
(extra res-lump)
|
||||
)
|
||||
((name string :offset 8)
|
||||
(length int32)
|
||||
(extra res-lump))
|
||||
(:methods
|
||||
(login (_type_) _type_)
|
||||
(lookup-art (_type_ string type) joint)
|
||||
(lookup-idx-of-art (_type_ string type) int)
|
||||
(needs-link? (_type_) symbol)
|
||||
)
|
||||
)
|
||||
(login (_type_) _type_)
|
||||
(lookup-art (_type_ string type) joint)
|
||||
(lookup-idx-of-art (_type_ string type) int)
|
||||
(needs-link? (_type_) symbol)))
|
||||
|
||||
;; parent class of all single art things.
|
||||
(deftype art-element (art)
|
||||
((pad uint8 12)
|
||||
)
|
||||
)
|
||||
((pad uint8 12)))
|
||||
|
||||
;; unused. all animations use joints/skeletons.
|
||||
(deftype art-mesh-anim (art-element)
|
||||
((data basic :dynamic)
|
||||
)
|
||||
)
|
||||
((data basic :dynamic)))
|
||||
|
||||
;; joint animation.
|
||||
(declare-type merc-eye-anim-block structure)
|
||||
|
||||
(deftype art-joint-anim (art-element)
|
||||
((eye-anim-data merc-eye-anim-block :offset 4)
|
||||
(speed float :overlay-at (-> pad 0))
|
||||
(artist-base float :overlay-at (-> pad 4))
|
||||
(artist-step float :overlay-at (-> pad 8))
|
||||
(master-art-group-name string :offset 32)
|
||||
(master-art-group-index int32 :offset 36)
|
||||
(blerc-data (pointer uint8) :offset 40)
|
||||
(frames joint-anim-compressed-control :offset 44)
|
||||
(data joint-anim-compressed :dynamic)
|
||||
)
|
||||
)
|
||||
((eye-anim-data merc-eye-anim-block :offset 4)
|
||||
(speed float :overlay-at (-> pad 0))
|
||||
(artist-base float :overlay-at (-> pad 4))
|
||||
(artist-step float :overlay-at (-> pad 8))
|
||||
(master-art-group-name string :offset 32)
|
||||
(master-art-group-index int32 :offset 36)
|
||||
(blerc-data (pointer uint8) :offset 40)
|
||||
(frames joint-anim-compressed-control :offset 44)
|
||||
(data joint-anim-compressed :dynamic)))
|
||||
|
||||
;; a collection of arts.
|
||||
;; this is often stored as a -ag file in static level data.
|
||||
(deftype art-group (art)
|
||||
((info file-info :offset 4)
|
||||
(data art-element :dynamic :offset 32)
|
||||
)
|
||||
((info file-info :offset 4)
|
||||
(data art-element :dynamic :offset 32))
|
||||
(:methods
|
||||
(relocate (_type_ kheap (pointer uint8)) none :replace)
|
||||
(link-art! (_type_) art-group)
|
||||
(unlink-art! (_type_) int)
|
||||
)
|
||||
)
|
||||
(relocate (_type_ kheap (pointer uint8)) none :replace)
|
||||
(link-art! (_type_) art-group)
|
||||
(unlink-art! (_type_) int)))
|
||||
|
||||
;; unused
|
||||
(deftype art-mesh-geo (art-element)
|
||||
((data basic :dynamic)
|
||||
)
|
||||
)
|
||||
((data basic :dynamic)))
|
||||
|
||||
;; unused
|
||||
(deftype art-joint-geo (art-element)
|
||||
((data joint :dynamic)
|
||||
)
|
||||
)
|
||||
((data joint :dynamic)))
|
||||
|
||||
;; the "skeleton group" is defined in code and tells the engine
|
||||
;; how to actually use the art from the level data for this object.
|
||||
(deftype skeleton-group (basic)
|
||||
((art-group-name string)
|
||||
(jgeo int32)
|
||||
(janim int32)
|
||||
(bounds vector :inline)
|
||||
(radius meters :overlay-at (-> bounds w))
|
||||
(mgeo int16 4)
|
||||
(max-lod int32)
|
||||
(lod-dist float 4)
|
||||
(longest-edge meters)
|
||||
(texture-level int8)
|
||||
(version int8)
|
||||
(shadow int8)
|
||||
(sort int8)
|
||||
(_pad uint8 4)
|
||||
)
|
||||
)
|
||||
((art-group-name string)
|
||||
(jgeo int32)
|
||||
(janim int32)
|
||||
(bounds vector :inline)
|
||||
(radius meters :overlay-at (-> bounds w))
|
||||
(mgeo int16 4)
|
||||
(max-lod int32)
|
||||
(lod-dist float 4)
|
||||
(longest-edge meters)
|
||||
(texture-level int8)
|
||||
(version int8)
|
||||
(shadow int8)
|
||||
(sort int8)
|
||||
(_pad uint8 4)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Draw Control
|
||||
@@ -213,37 +166,32 @@
|
||||
|
||||
;; a merc level of detail
|
||||
(deftype lod-group (structure)
|
||||
((geo merc-ctrl)
|
||||
(dist meters)
|
||||
)
|
||||
:pack-me
|
||||
)
|
||||
((geo merc-ctrl)
|
||||
(dist meters))
|
||||
:pack-me)
|
||||
|
||||
;; the 4 levels of detail. the max-lod is the index of the highest lod that's actually used.
|
||||
;; it is the lowest detail.
|
||||
(deftype lod-set (structure)
|
||||
((lod lod-group 4 :inline)
|
||||
(max-lod int8)
|
||||
)
|
||||
((lod lod-group 4 :inline)
|
||||
(max-lod int8))
|
||||
:pack-me
|
||||
(:methods
|
||||
(setup-lods! (_type_ skeleton-group art-group entity) _type_)
|
||||
)
|
||||
)
|
||||
(setup-lods! (_type_ skeleton-group art-group entity) _type_)))
|
||||
|
||||
;; the draw statuses are somewhat confusing, as some are set by the engine
|
||||
;; and some are set by the game object code.
|
||||
(defenum draw-status
|
||||
:type uint8
|
||||
:bitfield #t
|
||||
(needs-clip 0) ;; set by engine, determines if object should be clipped
|
||||
(hidden 1) ;; set by user, can disable drawing and animation codes
|
||||
(no-anim 2) ;; set by engine, if there is no active joint animation
|
||||
(was-drawn 3) ;; set by engine, if we were drawn (passed cull checks)
|
||||
(no-skeleton-update 4) ;; set by engine, if our transforms are not valid
|
||||
(skip-bones 5) ;; set by user, skips call to draw-bones but does everything else
|
||||
(needs-clip 0) ;; set by engine, determines if object should be clipped
|
||||
(hidden 1) ;; set by user, can disable drawing and animation codes
|
||||
(no-anim 2) ;; set by engine, if there is no active joint animation
|
||||
(was-drawn 3) ;; set by engine, if we were drawn (passed cull checks)
|
||||
(no-skeleton-update 4) ;; set by engine, if our transforms are not valid
|
||||
(skip-bones 5) ;; set by user, skips call to draw-bones but does everything else
|
||||
(do-not-check-distance 6) ;; set by user, ignore in finding closest object for texture calcs
|
||||
(has-joint-channels 7) ;; set by engine, if the object has joint channels.
|
||||
(has-joint-channels 7) ;; set by engine, if the object has joint channels.
|
||||
)
|
||||
|
||||
;; only title seems to be used?
|
||||
@@ -256,143 +204,113 @@
|
||||
(drweff4 4)
|
||||
(drweff5 5)
|
||||
(drweff6 6)
|
||||
(drweff7 7)
|
||||
)
|
||||
(drweff7 7))
|
||||
|
||||
(declare-type ripple-control basic)
|
||||
|
||||
(declare-type shadow-geo basic)
|
||||
|
||||
(declare-type shadow-control basic)
|
||||
|
||||
;; the actual draw-control - this is just a collection of references to all info
|
||||
;; needed to do drawing.
|
||||
(deftype draw-control (basic)
|
||||
((status draw-status)
|
||||
(matrix-type uint8)
|
||||
(data-format uint8)
|
||||
(global-effect draw-effect)
|
||||
(art-group art-group)
|
||||
(jgeo art-joint-geo)
|
||||
(mgeo merc-ctrl)
|
||||
(dma-add-func (function process-drawable draw-control symbol object none))
|
||||
(skeleton skeleton)
|
||||
(lod-set lod-set :inline)
|
||||
(lod lod-group 4 :inline :overlay-at (-> lod-set lod 0))
|
||||
(max-lod int8 :overlay-at (-> lod-set max-lod))
|
||||
(force-lod int8)
|
||||
(cur-lod int8)
|
||||
(desired-lod int8)
|
||||
(ripple ripple-control)
|
||||
(longest-edge meters)
|
||||
(longest-edge? uint32 :overlay-at longest-edge)
|
||||
(light-index uint8)
|
||||
(dummy uint8 2)
|
||||
(death-draw-overlap uint8)
|
||||
(death-timer uint8)
|
||||
(death-timer-org uint8)
|
||||
(death-vertex-skip uint16)
|
||||
(death-effect uint32)
|
||||
(sink-group dma-foreground-sink-group)
|
||||
(process process)
|
||||
(shadow shadow-geo)
|
||||
(shadow-ctrl shadow-control)
|
||||
(origin vector :inline)
|
||||
(bounds vector :inline)
|
||||
(radius meters :overlay-at (-> bounds w))
|
||||
(color-mult rgbaf :inline)
|
||||
(color-emissive rgbaf :inline)
|
||||
(secondary-interp float)
|
||||
(current-secondary-interp float)
|
||||
(shadow-mask uint8)
|
||||
(level-index uint8)
|
||||
(origin-joint-index uint8)
|
||||
(shadow-joint-index uint8)
|
||||
)
|
||||
((status draw-status)
|
||||
(matrix-type uint8)
|
||||
(data-format uint8)
|
||||
(global-effect draw-effect)
|
||||
(art-group art-group)
|
||||
(jgeo art-joint-geo)
|
||||
(mgeo merc-ctrl)
|
||||
(dma-add-func (function process-drawable draw-control symbol object none))
|
||||
(skeleton skeleton)
|
||||
(lod-set lod-set :inline)
|
||||
(lod lod-group 4 :inline :overlay-at (-> lod-set lod 0))
|
||||
(max-lod int8 :overlay-at (-> lod-set max-lod))
|
||||
(force-lod int8)
|
||||
(cur-lod int8)
|
||||
(desired-lod int8)
|
||||
(ripple ripple-control)
|
||||
(longest-edge meters)
|
||||
(longest-edge? uint32 :overlay-at longest-edge)
|
||||
(light-index uint8)
|
||||
(dummy uint8 2)
|
||||
(death-draw-overlap uint8)
|
||||
(death-timer uint8)
|
||||
(death-timer-org uint8)
|
||||
(death-vertex-skip uint16)
|
||||
(death-effect uint32)
|
||||
(sink-group dma-foreground-sink-group)
|
||||
(process process)
|
||||
(shadow shadow-geo)
|
||||
(shadow-ctrl shadow-control)
|
||||
(origin vector :inline)
|
||||
(bounds vector :inline)
|
||||
(radius meters :overlay-at (-> bounds w))
|
||||
(color-mult rgbaf :inline)
|
||||
(color-emissive rgbaf :inline)
|
||||
(secondary-interp float)
|
||||
(current-secondary-interp float)
|
||||
(shadow-mask uint8)
|
||||
(level-index uint8)
|
||||
(origin-joint-index uint8)
|
||||
(shadow-joint-index uint8))
|
||||
(:methods
|
||||
(new (symbol type process art-joint-geo) _type_)
|
||||
(get-skeleton-origin (_type_) vector)
|
||||
(lod-set! (_type_ int) none)
|
||||
(lods-assign! (_type_ lod-set) none)
|
||||
)
|
||||
)
|
||||
(new (symbol type process art-joint-geo) _type_)
|
||||
(get-skeleton-origin (_type_) vector)
|
||||
(lod-set! (_type_ int) none)
|
||||
(lods-assign! (_type_ lod-set) none)))
|
||||
|
||||
(defmethod get-skeleton-origin ((this draw-control))
|
||||
"Get the origin of the skeleton. Must have up-to-date bones."
|
||||
(-> this skeleton bones 0 position)
|
||||
)
|
||||
(-> this skeleton bones 0 position))
|
||||
|
||||
;; look up the index of an art element in an art group.
|
||||
(desfun art-elt-index (ag-name elt-name)
|
||||
(if (number? elt-name)
|
||||
elt-name
|
||||
(let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name))))
|
||||
(if (not (car ag-info))
|
||||
-1
|
||||
(let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name))))
|
||||
(if (not (car elt-info))
|
||||
-1
|
||||
(cadr (cdr elt-info)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
elt-name
|
||||
(let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name))))
|
||||
(if (not (car ag-info))
|
||||
-1
|
||||
(let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name))))
|
||||
(if (not (car elt-info)) -1 (cadr (cdr elt-info))))))))
|
||||
|
||||
(defmacro joint-node-index (jg-name name)
|
||||
(let ((jg-info (hash-table-try-ref *jg-info* (symbol->string jg-name))))
|
||||
(if (not (car jg-info))
|
||||
-1
|
||||
(let ((joint-node (hash-table-try-ref (cdr jg-info) (if (integer? name) (int->string name) (symbol->string name)))))
|
||||
(if (not (car joint-node))
|
||||
-1
|
||||
(cadr (cdr joint-node)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (not (car jg-info))
|
||||
-1
|
||||
(let ((joint-node (hash-table-try-ref (cdr jg-info) (if (integer? name) (int->string name) (symbol->string name)))))
|
||||
(if (not (car joint-node)) -1 (cadr (cdr joint-node)))))))
|
||||
|
||||
(defmacro joint-node (jg name)
|
||||
`(-> self node-list data (joint-node-index ,jg ,name))
|
||||
)
|
||||
|
||||
(defmacro defskelgroup (name art-name joint-geom joint-anim lods
|
||||
&key (shadow 0)
|
||||
&key bounds
|
||||
&key (longest-edge 0.0)
|
||||
&key (texture-level 0)
|
||||
&key (sort 0)
|
||||
&key (version 6) ;; do NOT use this!
|
||||
)
|
||||
`(-> self node-list data (joint-node-index ,jg ,name)))
|
||||
|
||||
(defmacro defskelgroup (name art-name joint-geom joint-anim lods &key (shadow 0) &key bounds &key (longest-edge 0.0) &key (texture-level 0) &key (sort 0))
|
||||
"define a new static skeleton group"
|
||||
|
||||
`(let ((skel (new 'static 'skeleton-group
|
||||
:art-group-name ,(symbol->string art-name)
|
||||
:bounds ,bounds
|
||||
:longest-edge ,longest-edge
|
||||
:version ,version
|
||||
:max-lod ,(- (length lods) 1)
|
||||
:shadow ,(art-elt-index (string->symbol-format "{}-ag" art-name) shadow)
|
||||
:texture-level ,texture-level
|
||||
:sort ,sort
|
||||
)))
|
||||
;; set joint geometry and joint bones
|
||||
(set! (-> skel jgeo) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-geom))
|
||||
(set! (-> skel janim) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-anim))
|
||||
|
||||
;; set lods
|
||||
,@(apply-i (lambda (x i)
|
||||
`(begin
|
||||
(set! (-> skel mgeo ,i) ,(art-elt-index (string->symbol-format "{}-ag" art-name) (car x)))
|
||||
(set! (-> skel lod-dist ,i) ,(cadr x))
|
||||
)
|
||||
) lods)
|
||||
|
||||
;; define skel group
|
||||
(define ,name skel)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
`(let ((skel (new 'static
|
||||
'skeleton-group
|
||||
:art-group-name ,(symbol->string art-name)
|
||||
:bounds ,bounds
|
||||
:longest-edge ,longest-edge
|
||||
:version 6
|
||||
:max-lod
|
||||
,(- (length lods) 1)
|
||||
:shadow
|
||||
,(art-elt-index (string->symbol-format "{}-ag" art-name) shadow)
|
||||
:texture-level ,texture-level
|
||||
:sort ,sort)))
|
||||
;; set joint geometry and joint bones
|
||||
(set! (-> skel jgeo) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-geom))
|
||||
(set! (-> skel janim) ,(art-elt-index (string->symbol-format "{}-ag" art-name) joint-anim))
|
||||
;; set lods
|
||||
,@(apply-i (lambda (x i)
|
||||
`(begin
|
||||
(set! (-> skel mgeo ,i) ,(art-elt-index (string->symbol-format "{}-ag" art-name) (car x)))
|
||||
(set! (-> skel lod-dist ,i) ,(cadr x))))
|
||||
lods)
|
||||
;; define skel group
|
||||
(define ,name skel)))
|
||||
|
||||
(import "goal_src/jak1/engine/data/art-elts.gc")
|
||||
|
||||
(import "goal_src/jak1/engine/data/joint-nodes.gc")
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,37 +1,26 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel/gcommon.gc")
|
||||
|
||||
;; name: assert-h.gc
|
||||
;; name in dgo: assert-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype __assert-info-private-struct (structure)
|
||||
((filename string)
|
||||
(line-num uint16)
|
||||
(column-num uint16)
|
||||
)
|
||||
((filename string)
|
||||
(line-num uint16)
|
||||
(column-num uint16))
|
||||
(:methods
|
||||
(set-pos (_type_ string uint uint) int)
|
||||
(print-pos (_type_) int)
|
||||
)
|
||||
)
|
||||
|
||||
(set-pos (_type_ string uint uint) int)
|
||||
(print-pos (_type_) int)))
|
||||
|
||||
(defmethod set-pos ((this __assert-info-private-struct) (filename string) (line-num uint) (column-num uint))
|
||||
(set! (-> this filename) filename)
|
||||
(set! (-> this line-num) line-num)
|
||||
(set! (-> this column-num) column-num)
|
||||
0
|
||||
)
|
||||
0)
|
||||
|
||||
(defmethod print-pos ((this __assert-info-private-struct))
|
||||
(format #t "file ~S.gc, line ~D, col ~D.~%" (-> this filename) (-> this line-num) (-> this column-num))
|
||||
0
|
||||
)
|
||||
0)
|
||||
|
||||
(define *__private-assert-info* (new 'static '__assert-info-private-struct))
|
||||
@@ -1,60 +1,49 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/debug/assert-h.gc")
|
||||
|
||||
;; name: assert.gc
|
||||
;; name in dgo: assert
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
|
||||
(define *run-time-assert-enable* #t)
|
||||
|
||||
;; TODO macros
|
||||
|
||||
(defun __assert ((expr symbol) (msg string))
|
||||
"Assert that expr is truthy, print assert information otherwise"
|
||||
|
||||
(when (not expr)
|
||||
(format #t "(ASSERT ~S) FAILED in " msg)
|
||||
(print-pos *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
(print-pos *__private-assert-info*))
|
||||
0)
|
||||
|
||||
(defun __assert-min-max-range-float ((expr float) (minimum float) (maximum float) (msg-expr string) (msg-min string) (msg-max string))
|
||||
"Assert that float expr is a larger value than minimum and smaller than maximum, print assert information otherwise"
|
||||
|
||||
(when (or (< expr minimum) (< maximum expr))
|
||||
(format #t "(ASSERT_MIN_MAX_RANGE_FLOAT ~S ~S ~S) FAILED (values ~F ~F ~F) in "
|
||||
msg-expr msg-min msg-max
|
||||
expr minimum maximum)
|
||||
(print-pos *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
(format #t
|
||||
"(ASSERT_MIN_MAX_RANGE_FLOAT ~S ~S ~S) FAILED (values ~F ~F ~F) in "
|
||||
msg-expr
|
||||
msg-min
|
||||
msg-max
|
||||
expr
|
||||
minimum
|
||||
maximum)
|
||||
(print-pos *__private-assert-info*))
|
||||
0)
|
||||
|
||||
(defun __assert-min-max-range-int ((expr int) (minimum int) (maximum int) (msg-expr string) (msg-min string) (msg-max string))
|
||||
"Assert that integer expr is a larger value than minimum and smaller than maximum, print assert information otherwise"
|
||||
|
||||
(when (or (< expr minimum) (< maximum expr))
|
||||
(format #t "(ASSERT_MIN_MAX_RANGE_INT ~S ~S ~S) FAILED (values ~D ~D ~D) in "
|
||||
msg-expr msg-min msg-max
|
||||
expr minimum maximum)
|
||||
(print-pos *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
(format #t
|
||||
"(ASSERT_MIN_MAX_RANGE_INT ~S ~S ~S) FAILED (values ~D ~D ~D) in "
|
||||
msg-expr
|
||||
msg-min
|
||||
msg-max
|
||||
expr
|
||||
minimum
|
||||
maximum)
|
||||
(print-pos *__private-assert-info*))
|
||||
0)
|
||||
|
||||
(defun __assert-zero-lim-range-int ((expr int) (maximum int) (msg-expr string) (msg-max string))
|
||||
"Assert that integer expr is a larger value than zero and smaller than maximum, print assert information otherwise"
|
||||
|
||||
(when (or (< expr 0) (>= expr max))
|
||||
(format #t "(ASSERT_ZERO_LIM_RANGE_INT ~S ~S) FAILED (values ~D ~D) in "
|
||||
msg-expr msg-max
|
||||
expr maximum)
|
||||
(print-pos *__private-assert-info*)
|
||||
)
|
||||
0
|
||||
)
|
||||
(format #t "(ASSERT_ZERO_LIM_RANGE_INT ~S ~S) FAILED (values ~D ~D) in " msg-expr msg-max expr maximum)
|
||||
(print-pos *__private-assert-info*))
|
||||
0)
|
||||
@@ -1,18 +1,15 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: debug-h.gc
|
||||
;; name in dgo: debug-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; TODO - for anim-tester
|
||||
(define-extern *debug-menu-context* debug-menu-context)
|
||||
|
||||
(define-extern add-debug-matrix (function symbol bucket-id matrix matrix))
|
||||
|
||||
(define-extern add-debug-text-sphere (function symbol bucket-id vector float string rgba symbol))
|
||||
|
||||
;; TODO - for trajectory.gc
|
||||
(define-extern add-debug-line (function symbol bucket-id vector vector rgba symbol rgba symbol))
|
||||
|
||||
@@ -22,26 +19,20 @@
|
||||
|
||||
;; circular buffer of positions to draw.
|
||||
(deftype pos-history (structure)
|
||||
((points (inline-array vector))
|
||||
(num-points int32)
|
||||
(h-first int32)
|
||||
(h-last int32)
|
||||
)
|
||||
)
|
||||
((points (inline-array vector))
|
||||
(num-points int32)
|
||||
(h-first int32)
|
||||
(h-last int32)))
|
||||
|
||||
;; unused vertex type?
|
||||
(deftype debug-vertex (structure)
|
||||
((trans vector4w :inline)
|
||||
(normal vector3h :inline)
|
||||
(st vector2h :inline)
|
||||
(color uint32)
|
||||
)
|
||||
)
|
||||
((trans vector4w :inline)
|
||||
(normal vector3h :inline)
|
||||
(st vector2h :inline)
|
||||
(color uint32)))
|
||||
|
||||
;; buffer of debug vertices (unused?)
|
||||
(deftype debug-vertex-stats (basic)
|
||||
((length int32)
|
||||
(pos-count int32)
|
||||
(vertex debug-vertex 600 :inline)
|
||||
)
|
||||
)
|
||||
((length int32)
|
||||
(pos-count int32)
|
||||
(vertex debug-vertex 600 :inline)))
|
||||
@@ -1,65 +1,52 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/math/vector-h.gc")
|
||||
(require "engine/debug/debug-h.gc")
|
||||
(require "engine/math/math.gc")
|
||||
|
||||
;; name: debug-sphere.gc
|
||||
;; name in dgo: debug-sphere
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(defconstant DEBUG_SPHERE_SEC_AMT (#if (user? dass) 5 10))
|
||||
|
||||
(defconstant DEBUG_SPHERE_SEC_H DEBUG_SPHERE_SEC_AMT)
|
||||
|
||||
(defconstant DEBUG_SPHERE_SEC_W DEBUG_SPHERE_SEC_AMT)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype debug-sphere-table (basic)
|
||||
((point vector 300 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
((point vector 300 :inline)))
|
||||
|
||||
(defun make-debug-sphere-table ((arg0 debug-sphere-table))
|
||||
(local-vars (sv-80 int))
|
||||
(let ((s5-0 (new-stack-vector0))
|
||||
(f30-0 1.0)
|
||||
(s4-0 0)
|
||||
)
|
||||
(set-vector! s5-0 0.0 0.0 0.0 1.0)
|
||||
(dotimes (s3-0 DEBUG_SPHERE_SEC_H)
|
||||
(let ((f28-0 (* f30-0 (sin (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0)))))
|
||||
(f26-0 (* f30-0 (sin (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1))))))
|
||||
(s2-0 (new-stack-vector0))
|
||||
(s1-0 (new-stack-vector0))
|
||||
(s0-0 (new-stack-vector0))
|
||||
)
|
||||
(set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0))) f30-0)))
|
||||
(set! (-> s1-0 y) (-> s2-0 y))
|
||||
(set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1)))) f30-0)))
|
||||
(set! sv-80 0)
|
||||
(while (< sv-80 DEBUG_SPHERE_SEC_W)
|
||||
(set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
|
||||
(set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
|
||||
(set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
|
||||
(set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
|
||||
(set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
|
||||
(set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
|
||||
(set! (-> arg0 point s4-0 quad) (-> s2-0 quad))
|
||||
(set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad))
|
||||
(set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad))
|
||||
(+! s4-0 3)
|
||||
(set! sv-80 (+ sv-80 1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
(s4-0 0))
|
||||
(set-vector! s5-0 0.0 0.0 0.0 1.0)
|
||||
(dotimes (s3-0 DEBUG_SPHERE_SEC_H)
|
||||
(let ((f28-0 (* f30-0 (sin (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0)))))
|
||||
(f26-0 (* f30-0 (sin (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1))))))
|
||||
(s2-0 (new-stack-vector0))
|
||||
(s1-0 (new-stack-vector0))
|
||||
(s0-0 (new-stack-vector0)))
|
||||
(set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0))) f30-0)))
|
||||
(set! (-> s1-0 y) (-> s2-0 y))
|
||||
(set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1)))) f30-0)))
|
||||
(set! sv-80 0)
|
||||
(while (< sv-80 DEBUG_SPHERE_SEC_W)
|
||||
(set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
|
||||
(set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
|
||||
(set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
|
||||
(set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
|
||||
(set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
|
||||
(set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
|
||||
(set! (-> arg0 point s4-0 quad) (-> s2-0 quad))
|
||||
(set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad))
|
||||
(set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad))
|
||||
(+! s4-0 3)
|
||||
(set! sv-80 (+ sv-80 1))))))
|
||||
(none))
|
||||
|
||||
(define *debug-sphere-table* (new 'static 'debug-sphere-table))
|
||||
|
||||
(make-debug-sphere-table *debug-sphere-table*)
|
||||
|
||||
(defun add-debug-sphere-from-table ((arg0 bucket-id) (arg1 vector) (arg2 float) (arg3 rgba))
|
||||
@@ -68,13 +55,11 @@
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(vf5 :class vf))
|
||||
(let ((s4-0 (new-stack-vector0))
|
||||
(s3-0 (new-stack-vector0))
|
||||
(s2-0 (new-stack-vector0))
|
||||
(points (-> *debug-sphere-table* point))
|
||||
)
|
||||
(points (-> *debug-sphere-table* point)))
|
||||
(.lvf vf1 (&-> arg1 quad))
|
||||
(.mov vf2 arg2)
|
||||
(dotimes (s0-0 (* DEBUG_SPHERE_SEC_W DEBUG_SPHERE_SEC_H))
|
||||
@@ -92,10 +77,6 @@
|
||||
(.svf (&-> s3-0 quad) vf4)
|
||||
(.svf (&-> s2-0 quad) vf5)
|
||||
(add-debug-line #t arg0 s4-0 s3-0 arg3 #f (the-as rgba -1))
|
||||
(add-debug-line #t arg0 s4-0 s2-0 arg3 #f (the-as rgba -1))
|
||||
)
|
||||
)
|
||||
(add-debug-line #t arg0 s4-0 s2-0 arg3 #f (the-as rgba -1))))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
)
|
||||
(none)))
|
||||
+449
-783
File diff suppressed because it is too large.
Load diff
+2152
-3426
File diff suppressed because it is too large.
Load diff
@@ -1,13 +1,8 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "kernel-defs.gc")
|
||||
|
||||
;; name: memory-usage-h.gc
|
||||
;; name in dgo: memory-usage-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; this file is debug only
|
||||
@@ -23,26 +18,20 @@
|
||||
|
||||
;; Information for a single category.
|
||||
(deftype memory-usage-info (structure)
|
||||
((name string)
|
||||
(count int32)
|
||||
(used int32)
|
||||
(total int32)
|
||||
)
|
||||
)
|
||||
((name string)
|
||||
(count int32)
|
||||
(used int32)
|
||||
(total int32)))
|
||||
|
||||
;; Memory info for all categories
|
||||
(deftype memory-usage-block (basic)
|
||||
((work-bsp basic)
|
||||
(length int32)
|
||||
(data memory-usage-info 109 :inline)
|
||||
)
|
||||
((work-bsp basic)
|
||||
(length int32)
|
||||
(data memory-usage-info 109 :inline))
|
||||
(:methods
|
||||
(reset! (_type_) _type_)
|
||||
(calculate-total (_type_) int)
|
||||
(print-mem-usage (_type_ level object) none)
|
||||
)
|
||||
)
|
||||
|
||||
(reset! (_type_) _type_)
|
||||
(calculate-total (_type_) int)
|
||||
(print-mem-usage (_type_ level object) none)))
|
||||
|
||||
;; The main RAM usage memory info
|
||||
(define *mem-usage* (new 'debug 'memory-usage-block))
|
||||
@@ -63,115 +52,113 @@
|
||||
;; Memory usage stats are organized by the type of object.
|
||||
;; This enum allows you to go from type to the index in the memory-usage-block's data array.
|
||||
(defenum mem-usage-id
|
||||
:bitfield #f
|
||||
:type uint32
|
||||
(drawable-group 0)
|
||||
(tfragment 1)
|
||||
(tfragment-base 2)
|
||||
(tfragment-common 3)
|
||||
(tfragment-level0 4)
|
||||
(tfragment-level1 5)
|
||||
(tfragment-color 6)
|
||||
(tfragment-debug 7)
|
||||
(tfragment-pal 8)
|
||||
(tie-fragment 9)
|
||||
(tie-gif 10)
|
||||
(tie-points 11)
|
||||
(tie-colors 12)
|
||||
(tie-draw-points 13)
|
||||
(tie-debug 14)
|
||||
(tie-near 15)
|
||||
(tie-pal 16)
|
||||
(tie-generic 17)
|
||||
(instance-tie 18)
|
||||
(instance-tie-colors0 19)
|
||||
(instance-tie-colors1 20)
|
||||
(instance-tie-colors2 21)
|
||||
(instance-tie-colors3 22)
|
||||
(instance-tie-colors* 23)
|
||||
(prototype-bucket-shrub 24)
|
||||
(generic-shrub 25)
|
||||
(generic-shrub-data 26)
|
||||
(shrubbery 27)
|
||||
(shrubbery-object 28)
|
||||
(shrubbery-vertex 29)
|
||||
(shrubbery-color 30)
|
||||
(shrubbery-stq 31)
|
||||
(shrubbery-pal 32)
|
||||
(billboard 33)
|
||||
(instance-shrubbery 34)
|
||||
(pris-fragment 35)
|
||||
;; ??
|
||||
(entity 43)
|
||||
(camera 44)
|
||||
(nav-mesh 45)
|
||||
;; ??
|
||||
(res 48)
|
||||
(ambient 49)
|
||||
(collide-fragment-0 50)
|
||||
(collision-poly-0 51)
|
||||
(collision-vertex-0 52)
|
||||
(collide-fragment-1 53)
|
||||
(collision-poly-1 54)
|
||||
(collision-vertex-1 55)
|
||||
(bsp-main 56)
|
||||
(bsp-misc 57)
|
||||
(bsp-node 58)
|
||||
(bsp-leaf-vis-self 59)
|
||||
(bsp-leaf-vis-adj 60)
|
||||
(draw-node 61)
|
||||
(pat 62)
|
||||
(level-code 63)
|
||||
(entity-links 64) ;; or ambient links, its messed up
|
||||
(joint 65)
|
||||
(joint-anim-compressed 66)
|
||||
(joint-anim-compressed-control 67)
|
||||
(joint-anim-fixed 68)
|
||||
(joint-anim-frame 69)
|
||||
(art-group 70)
|
||||
(art-mesh-anim 71)
|
||||
(art-mesh-geo 72)
|
||||
(art-joint-geo 73)
|
||||
(art-joint-anim 74)
|
||||
(merc-ctrl 75)
|
||||
(joint-anim-drawable 76)
|
||||
(blend-shape 77)
|
||||
(collide-mesh 78)
|
||||
(texture 79)
|
||||
(string 80)
|
||||
(array 81)
|
||||
(sprite 82)
|
||||
(depth-cue 83)
|
||||
(debug-dma 84) ;; maybe
|
||||
(sky-dma 85) ;; maybe
|
||||
(pris-generic)
|
||||
(4k-dead-pool 87)
|
||||
(8k-dead-pool 88)
|
||||
(16k-dead-pool 89)
|
||||
(nk-dead-pool 90)
|
||||
(target-dead-pool 91)
|
||||
(camera-dead-pool 92)
|
||||
(debug-dead-pool 93)
|
||||
(process-active 94)
|
||||
(heap-total 95)
|
||||
(heap-process 96)
|
||||
(heap-header 97)
|
||||
(heap-thread 98)
|
||||
(heap-root 99)
|
||||
(heap-draw-control 100)
|
||||
(heap-joint-control 101)
|
||||
(heap-cspace 102)
|
||||
(heap-bone 103)
|
||||
(heap-part 104)
|
||||
(heap-collide-prim 105)
|
||||
(heap-misc 106)
|
||||
(shadow-geo 107)
|
||||
(eye-anim 108)
|
||||
)
|
||||
:bitfield #f
|
||||
:type uint32
|
||||
(drawable-group 0)
|
||||
(tfragment 1)
|
||||
(tfragment-base 2)
|
||||
(tfragment-common 3)
|
||||
(tfragment-level0 4)
|
||||
(tfragment-level1 5)
|
||||
(tfragment-color 6)
|
||||
(tfragment-debug 7)
|
||||
(tfragment-pal 8)
|
||||
(tie-fragment 9)
|
||||
(tie-gif 10)
|
||||
(tie-points 11)
|
||||
(tie-colors 12)
|
||||
(tie-draw-points 13)
|
||||
(tie-debug 14)
|
||||
(tie-near 15)
|
||||
(tie-pal 16)
|
||||
(tie-generic 17)
|
||||
(instance-tie 18)
|
||||
(instance-tie-colors0 19)
|
||||
(instance-tie-colors1 20)
|
||||
(instance-tie-colors2 21)
|
||||
(instance-tie-colors3 22)
|
||||
(instance-tie-colors* 23)
|
||||
(prototype-bucket-shrub 24)
|
||||
(generic-shrub 25)
|
||||
(generic-shrub-data 26)
|
||||
(shrubbery 27)
|
||||
(shrubbery-object 28)
|
||||
(shrubbery-vertex 29)
|
||||
(shrubbery-color 30)
|
||||
(shrubbery-stq 31)
|
||||
(shrubbery-pal 32)
|
||||
(billboard 33)
|
||||
(instance-shrubbery 34)
|
||||
(pris-fragment 35)
|
||||
;; ??
|
||||
(entity 43)
|
||||
(camera 44)
|
||||
(nav-mesh 45)
|
||||
;; ??
|
||||
(res 48)
|
||||
(ambient 49)
|
||||
(collide-fragment-0 50)
|
||||
(collision-poly-0 51)
|
||||
(collision-vertex-0 52)
|
||||
(collide-fragment-1 53)
|
||||
(collision-poly-1 54)
|
||||
(collision-vertex-1 55)
|
||||
(bsp-main 56)
|
||||
(bsp-misc 57)
|
||||
(bsp-node 58)
|
||||
(bsp-leaf-vis-self 59)
|
||||
(bsp-leaf-vis-adj 60)
|
||||
(draw-node 61)
|
||||
(pat 62)
|
||||
(level-code 63)
|
||||
(entity-links 64) ;; or ambient links, its messed up
|
||||
(joint 65)
|
||||
(joint-anim-compressed 66)
|
||||
(joint-anim-compressed-control 67)
|
||||
(joint-anim-fixed 68)
|
||||
(joint-anim-frame 69)
|
||||
(art-group 70)
|
||||
(art-mesh-anim 71)
|
||||
(art-mesh-geo 72)
|
||||
(art-joint-geo 73)
|
||||
(art-joint-anim 74)
|
||||
(merc-ctrl 75)
|
||||
(joint-anim-drawable 76)
|
||||
(blend-shape 77)
|
||||
(collide-mesh 78)
|
||||
(texture 79)
|
||||
(string 80)
|
||||
(array 81)
|
||||
(sprite 82)
|
||||
(depth-cue 83)
|
||||
(debug-dma 84) ;; maybe
|
||||
(sky-dma 85) ;; maybe
|
||||
(pris-generic)
|
||||
(4k-dead-pool 87)
|
||||
(8k-dead-pool 88)
|
||||
(16k-dead-pool 89)
|
||||
(nk-dead-pool 90)
|
||||
(target-dead-pool 91)
|
||||
(camera-dead-pool 92)
|
||||
(debug-dead-pool 93)
|
||||
(process-active 94)
|
||||
(heap-total 95)
|
||||
(heap-process 96)
|
||||
(heap-header 97)
|
||||
(heap-thread 98)
|
||||
(heap-root 99)
|
||||
(heap-draw-control 100)
|
||||
(heap-joint-control 101)
|
||||
(heap-cspace 102)
|
||||
(heap-bone 103)
|
||||
(heap-part 104)
|
||||
(heap-collide-prim 105)
|
||||
(heap-misc 106)
|
||||
(shadow-geo 107)
|
||||
(eye-anim 108))
|
||||
|
||||
;; get a memory usage id as an integer.
|
||||
(defmacro mem-usage-id-int (kind)
|
||||
`(the int (mem-usage-id ,kind))
|
||||
)
|
||||
`(the int (mem-usage-id ,kind)))
|
||||
|
||||
(defun-extern mem-size basic symbol int int)
|
||||
@@ -1,63 +1,37 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
|
||||
(require "engine/level/level.gc")
|
||||
|
||||
;; name: memory-usage.gc
|
||||
;; name in dgo: memory-usage
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; this file is debug only
|
||||
(declare-file (debug))
|
||||
|
||||
|
||||
(defmethod inspect ((this memory-usage-block))
|
||||
"Print the memory-usage by category. This is a large print."
|
||||
(format #t "-------------------------------------------------------------~%")
|
||||
(format #t " # name count bytes used aligned bytes~%")
|
||||
(format #t "-------------------------------------------------------------~%")
|
||||
(let ((s5-0 0)
|
||||
(s4-0 0)
|
||||
)
|
||||
(s4-0 0))
|
||||
(dotimes (s3-0 (-> this length))
|
||||
(let ((v1-2 (-> this data s3-0)))
|
||||
(+! s5-0 (-> v1-2 used))
|
||||
(+! s4-0 (-> v1-2 total))
|
||||
(format #t "~3D: ~20S ~7D ~8D ~8D~%"
|
||||
s3-0
|
||||
(-> v1-2 name)
|
||||
(-> v1-2 count)
|
||||
(-> v1-2 used)
|
||||
(-> v1-2 total)
|
||||
)
|
||||
)
|
||||
)
|
||||
(format #t "total: ~8D ~8D~%" s5-0 s4-0)
|
||||
)
|
||||
(format #t "~3D: ~20S ~7D ~8D ~8D~%" s3-0 (-> v1-2 name) (-> v1-2 count) (-> v1-2 used) (-> v1-2 total))))
|
||||
(format #t "total: ~8D ~8D~%" s5-0 s4-0))
|
||||
(format #t "-------------------------------------------------------------~%")
|
||||
this
|
||||
)
|
||||
this)
|
||||
|
||||
(defmethod mem-usage ((this object) (arg0 memory-usage-block) (arg1 int))
|
||||
"Most general mem-usage message. Just prints a warning, in case you expect this to do something."
|
||||
(if this
|
||||
(format #t "WARNING: mem-usage called on object, probably not what was wanted for ~A~%" this)
|
||||
)
|
||||
this
|
||||
)
|
||||
(if this (format #t "WARNING: mem-usage called on object, probably not what was wanted for ~A~%" this))
|
||||
this)
|
||||
|
||||
(defmethod calculate-total ((this memory-usage-block))
|
||||
"Compute the total memory usage of everything in the block."
|
||||
(let ((v0-0 0))
|
||||
(dotimes (v1-0 (-> this length))
|
||||
(+! v0-0 (-> this data v1-0 total))
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
(let ((v0-0 0)) (dotimes (v1-0 (-> this length)) (+! v0-0 (-> this data v1-0 total))) v0-0))
|
||||
|
||||
(defmethod reset! ((this memory-usage-block))
|
||||
"Reset all memory stats to 0."
|
||||
@@ -65,333 +39,223 @@
|
||||
(dotimes (v1-0 109)
|
||||
(set! (-> this data v1-0 used) 0)
|
||||
(set! (-> this data v1-0 total) 0)
|
||||
(set! (-> this data v1-0 count) 0)
|
||||
)
|
||||
this
|
||||
)
|
||||
(set! (-> this data v1-0 count) 0))
|
||||
this)
|
||||
|
||||
(defun mem-size ((arg0 basic) (arg1 symbol) (arg2 int))
|
||||
"Compute the size of arg0. If arg1, then print the result. Arg2 is flags"
|
||||
(let ((gp-0 (new 'stack 'memory-usage-block)))
|
||||
(mem-usage arg0 gp-0 arg2)
|
||||
(if arg1
|
||||
(inspect gp-0)
|
||||
)
|
||||
(calculate-total gp-0)
|
||||
)
|
||||
)
|
||||
(let ((gp-0 (new 'stack 'memory-usage-block))) (mem-usage arg0 gp-0 arg2) (if arg1 (inspect gp-0)) (calculate-total gp-0)))
|
||||
|
||||
(defmethod compute-memory-usage ((this level) (arg0 object))
|
||||
"Compute the memory usage of a level. arg0 will force a recalculation."
|
||||
(if (zero? (-> this mem-usage-block))
|
||||
(set! (-> this mem-usage-block) (new 'debug 'memory-usage-block))
|
||||
)
|
||||
(if (zero? (-> this mem-usage-block)) (set! (-> this mem-usage-block) (new 'debug 'memory-usage-block)))
|
||||
(set! arg0 (or (zero? (-> this mem-usage-block length)) arg0))
|
||||
(when arg0
|
||||
(mem-usage this (reset! (-> this mem-usage-block)) 0)
|
||||
(set! (-> this mem-usage) (calculate-total (-> this mem-usage-block)))
|
||||
)
|
||||
(-> this mem-usage-block)
|
||||
)
|
||||
(set! (-> this mem-usage) (calculate-total (-> this mem-usage-block))))
|
||||
(-> this mem-usage-block))
|
||||
|
||||
(defmethod mem-usage ((this process-tree) (arg0 memory-usage-block) (arg1 int))
|
||||
"Compute the memory usage of a process tree."
|
||||
(let ((v1-0 87))
|
||||
(let* ((a0-1 *dead-pool-list*)
|
||||
(a3-0 (car a0-1))
|
||||
)
|
||||
(a3-0 (car a0-1)))
|
||||
(while (not (null? a0-1))
|
||||
(set! (-> arg0 data v1-0 name) (symbol->string (the-as symbol a3-0)))
|
||||
(+! v1-0 1)
|
||||
(set! a0-1 (cdr a0-1))
|
||||
(set! a3-0 (car a0-1))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 length) (max (-> arg0 length) v1-0))
|
||||
)
|
||||
(set! a3-0 (car a0-1))))
|
||||
(set! (-> arg0 length) (max (-> arg0 length) v1-0)))
|
||||
(set! (-> arg0 data 93 name) "*debug-dead-pool*")
|
||||
(set! *temp-mem-usage* arg0)
|
||||
(when (logtest? arg1 32)
|
||||
(let* ((s5-0 87)
|
||||
(s4-0 *dead-pool-list*)
|
||||
(v1-4 (car s4-0))
|
||||
)
|
||||
(v1-4 (car s4-0)))
|
||||
(while (not (null? s4-0))
|
||||
(let ((a0-5 (-> (the-as symbol v1-4) value)))
|
||||
(set! *global-search-count* s5-0)
|
||||
(iterate-process-tree
|
||||
(the-as process-tree a0-5)
|
||||
(lambda ((arg0 basic))
|
||||
(let ((gp-0 *temp-mem-usage*)
|
||||
(s5-0 *global-search-count*)
|
||||
)
|
||||
(+! (-> gp-0 data s5-0 used) 1)
|
||||
(+! (-> gp-0 data s5-0 total) (logand -16 (+ (asize-of arg0) 15)))
|
||||
)
|
||||
#t
|
||||
)
|
||||
*null-kernel-context*
|
||||
)
|
||||
)
|
||||
(iterate-process-tree (the-as process-tree a0-5)
|
||||
(lambda ((arg0 basic))
|
||||
(let ((gp-0 *temp-mem-usage*)
|
||||
(s5-0 *global-search-count*))
|
||||
(+! (-> gp-0 data s5-0 used) 1)
|
||||
(+! (-> gp-0 data s5-0 total) (logand -16 (+ (asize-of arg0) 15))))
|
||||
#t)
|
||||
*null-kernel-context*))
|
||||
(+! s5-0 1)
|
||||
(set! s4-0 (cdr s4-0))
|
||||
(set! v1-4 (car s4-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(iterate-process-tree
|
||||
this
|
||||
(lambda ((arg0 process))
|
||||
(let ((gp-0 *temp-mem-usage*))
|
||||
(let ((s4-0 (cond
|
||||
((= (-> arg0 pool) *8k-dead-pool*)
|
||||
88
|
||||
)
|
||||
((= (-> arg0 pool) *16k-dead-pool*)
|
||||
89
|
||||
)
|
||||
((= (-> arg0 pool) *nk-dead-pool*)
|
||||
90
|
||||
)
|
||||
((= (-> arg0 pool) *target-dead-pool*)
|
||||
91
|
||||
)
|
||||
((= (-> arg0 pool) *camera-dead-pool*)
|
||||
92
|
||||
)
|
||||
((= (-> arg0 pool) *debug-dead-pool*)
|
||||
93
|
||||
)
|
||||
(else
|
||||
87
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! (-> gp-0 data s4-0 count) 1)
|
||||
(+! (-> gp-0 data s4-0 total) (logand -16 (+ (asize-of arg0) 15)))
|
||||
)
|
||||
(set! (-> gp-0 length) (max 95 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 94 name) "process-active")
|
||||
(+! (-> gp-0 data 94 count) 1)
|
||||
(let ((v1-23 (asize-of arg0)))
|
||||
(+! (-> gp-0 data 94 used) v1-23)
|
||||
(+! (-> gp-0 data 94 total) (logand -16 (+ v1-23 15)))
|
||||
)
|
||||
(set! (-> gp-0 length) (max 96 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 95 name) "heap-total")
|
||||
(+! (-> gp-0 data 95 count) 1)
|
||||
(let ((v1-34 (+ (- -4 (the-as int arg0)) (the-as int (-> arg0 heap-cur)))))
|
||||
(+! (-> gp-0 data 95 used) v1-34)
|
||||
(+! (-> gp-0 data 95 total) (logand -16 (+ v1-34 15)))
|
||||
)
|
||||
(set! (-> gp-0 length) (max 97 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 96 name) "heap-process")
|
||||
(+! (-> gp-0 data 96 count) 1)
|
||||
(let ((v1-45 (- (-> arg0 type size) (-> arg0 type heap-base))))
|
||||
(+! (-> gp-0 data 96 used) v1-45)
|
||||
(+! (-> gp-0 data 96 total) (logand -16 (+ v1-45 15)))
|
||||
)
|
||||
(set! (-> gp-0 length) (max 98 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 97 name) "heap-header")
|
||||
(+! (-> gp-0 data 97 count) 1)
|
||||
(let ((v1-55 (-> arg0 type heap-base)))
|
||||
(+! (-> gp-0 data 97 used) v1-55)
|
||||
(+! (-> gp-0 data 97 total) (logand -16 (+ v1-55 15)))
|
||||
)
|
||||
(set! (-> gp-0 length) (max 99 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 98 name) "heap-thread")
|
||||
(+! (-> gp-0 data 98 count) 1)
|
||||
(let ((v1-65 (asize-of (-> arg0 main-thread))))
|
||||
(+! (-> gp-0 data 98 used) v1-65)
|
||||
(+! (-> gp-0 data 98 total) (logand -16 (+ v1-65 15)))
|
||||
)
|
||||
(when (type-type? (-> arg0 type) process-drawable)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) root))
|
||||
(set! (-> gp-0 length) (max 100 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 99 name) "heap-root")
|
||||
(+! (-> gp-0 data 99 count) 1)
|
||||
(let ((v1-78 (asize-of (-> (the-as process-drawable arg0) root))))
|
||||
(+! (-> gp-0 data 99 used) v1-78)
|
||||
(+! (-> gp-0 data 99 total) (logand -16 (+ v1-78 15)))
|
||||
)
|
||||
(when (type-type? (-> (the-as process-drawable arg0) root type) collide-shape)
|
||||
(set! (-> gp-0 length) (max 106 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 105 name) "heap-collide-prim")
|
||||
(+! (-> gp-0 data 105 count) 1)
|
||||
(let ((v1-91 (asize-of (-> (the-as collide-shape (-> (the-as process-drawable arg0) root)) root-prim))))
|
||||
(+! (-> gp-0 data 105 used) v1-91)
|
||||
(+! (-> gp-0 data 105 total) (logand -16 (+ v1-91 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) node-list))
|
||||
(set! (-> gp-0 length) (max 103 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 102 name) "heap-cspace")
|
||||
(+! (-> gp-0 data 102 count) 1)
|
||||
(let ((v1-103 (asize-of (-> (the-as process-drawable arg0) node-list))))
|
||||
(+! (-> gp-0 data 102 used) v1-103)
|
||||
(+! (-> gp-0 data 102 total) (logand -16 (+ v1-103 15)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) draw))
|
||||
(set! (-> gp-0 length) (max 101 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 100 name) "heap-draw-control")
|
||||
(+! (-> gp-0 data 100 count) 1)
|
||||
(let ((v1-115 (asize-of (-> (the-as process-drawable arg0) draw))))
|
||||
(+! (-> gp-0 data 100 used) v1-115)
|
||||
(+! (-> gp-0 data 100 total) (logand -16 (+ v1-115 15)))
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) draw skeleton))
|
||||
(set! (-> gp-0 length) (max 104 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 103 name) "heap-bone")
|
||||
(+! (-> gp-0 data 103 count) 1)
|
||||
(let ((v1-129 (asize-of (-> (the-as process-drawable arg0) draw skeleton))))
|
||||
(+! (-> gp-0 data 103 used) v1-129)
|
||||
(+! (-> gp-0 data 103 total) (logand -16 (+ v1-129 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) skel))
|
||||
(set! (-> gp-0 length) (max 102 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 101 name) "heap-joint-control")
|
||||
(+! (-> gp-0 data 101 count) 1)
|
||||
(let ((v1-141 (asize-of (-> (the-as process-drawable arg0) skel))))
|
||||
(+! (-> gp-0 data 101 used) v1-141)
|
||||
(+! (-> gp-0 data 101 total) (logand -16 (+ v1-141 15)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) part))
|
||||
(set! (-> gp-0 length) (max 105 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 104 name) "heap-part")
|
||||
(+! (-> gp-0 data 104 count) 1)
|
||||
(let ((v1-153 (asize-of (-> (the-as process-drawable arg0) part))))
|
||||
(+! (-> gp-0 data 104 used) v1-153)
|
||||
(+! (-> gp-0 data 104 total) (logand -16 (+ v1-153 15)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) nav))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-165 (asize-of (-> (the-as process-drawable arg0) nav))))
|
||||
(+! (-> gp-0 data 106 used) v1-165)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-165 15)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) path))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-177 (asize-of (-> (the-as process-drawable arg0) path))))
|
||||
(+! (-> gp-0 data 106 used) v1-177)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-177 15)))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) vol))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-189 (asize-of (-> (the-as process-drawable arg0) vol))))
|
||||
(+! (-> gp-0 data 106 used) v1-189)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-189 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#t
|
||||
)
|
||||
*null-kernel-context*
|
||||
)
|
||||
this
|
||||
)
|
||||
(set! v1-4 (car s4-0)))))
|
||||
(iterate-process-tree this
|
||||
(lambda ((arg0 process))
|
||||
(let ((gp-0 *temp-mem-usage*))
|
||||
(let ((s4-0 (cond
|
||||
((= (-> arg0 pool) *8k-dead-pool*) 88)
|
||||
((= (-> arg0 pool) *16k-dead-pool*) 89)
|
||||
((= (-> arg0 pool) *nk-dead-pool*) 90)
|
||||
((= (-> arg0 pool) *target-dead-pool*) 91)
|
||||
((= (-> arg0 pool) *camera-dead-pool*) 92)
|
||||
((= (-> arg0 pool) *debug-dead-pool*) 93)
|
||||
(else 87))))
|
||||
(+! (-> gp-0 data s4-0 count) 1)
|
||||
(+! (-> gp-0 data s4-0 total) (logand -16 (+ (asize-of arg0) 15))))
|
||||
(set! (-> gp-0 length) (max 95 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 94 name) "process-active")
|
||||
(+! (-> gp-0 data 94 count) 1)
|
||||
(let ((v1-23 (asize-of arg0))) (+! (-> gp-0 data 94 used) v1-23) (+! (-> gp-0 data 94 total) (logand -16 (+ v1-23 15))))
|
||||
(set! (-> gp-0 length) (max 96 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 95 name) "heap-total")
|
||||
(+! (-> gp-0 data 95 count) 1)
|
||||
(let ((v1-34 (+ (- -4 (the-as int arg0)) (the-as int (-> arg0 heap-cur)))))
|
||||
(+! (-> gp-0 data 95 used) v1-34)
|
||||
(+! (-> gp-0 data 95 total) (logand -16 (+ v1-34 15))))
|
||||
(set! (-> gp-0 length) (max 97 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 96 name) "heap-process")
|
||||
(+! (-> gp-0 data 96 count) 1)
|
||||
(let ((v1-45 (- (-> arg0 type size) (-> arg0 type heap-base))))
|
||||
(+! (-> gp-0 data 96 used) v1-45)
|
||||
(+! (-> gp-0 data 96 total) (logand -16 (+ v1-45 15))))
|
||||
(set! (-> gp-0 length) (max 98 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 97 name) "heap-header")
|
||||
(+! (-> gp-0 data 97 count) 1)
|
||||
(let ((v1-55 (-> arg0 type heap-base)))
|
||||
(+! (-> gp-0 data 97 used) v1-55)
|
||||
(+! (-> gp-0 data 97 total) (logand -16 (+ v1-55 15))))
|
||||
(set! (-> gp-0 length) (max 99 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 98 name) "heap-thread")
|
||||
(+! (-> gp-0 data 98 count) 1)
|
||||
(let ((v1-65 (asize-of (-> arg0 main-thread))))
|
||||
(+! (-> gp-0 data 98 used) v1-65)
|
||||
(+! (-> gp-0 data 98 total) (logand -16 (+ v1-65 15))))
|
||||
(when (type-type? (-> arg0 type) process-drawable)
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) root))
|
||||
(set! (-> gp-0 length) (max 100 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 99 name) "heap-root")
|
||||
(+! (-> gp-0 data 99 count) 1)
|
||||
(let ((v1-78 (asize-of (-> (the-as process-drawable arg0) root))))
|
||||
(+! (-> gp-0 data 99 used) v1-78)
|
||||
(+! (-> gp-0 data 99 total) (logand -16 (+ v1-78 15))))
|
||||
(when (type-type? (-> (the-as process-drawable arg0) root type) collide-shape)
|
||||
(set! (-> gp-0 length) (max 106 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 105 name) "heap-collide-prim")
|
||||
(+! (-> gp-0 data 105 count) 1)
|
||||
(let ((v1-91 (asize-of (-> (the-as collide-shape (-> (the-as process-drawable arg0) root)) root-prim))))
|
||||
(+! (-> gp-0 data 105 used) v1-91)
|
||||
(+! (-> gp-0 data 105 total) (logand -16 (+ v1-91 15))))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) node-list))
|
||||
(set! (-> gp-0 length) (max 103 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 102 name) "heap-cspace")
|
||||
(+! (-> gp-0 data 102 count) 1)
|
||||
(let ((v1-103 (asize-of (-> (the-as process-drawable arg0) node-list))))
|
||||
(+! (-> gp-0 data 102 used) v1-103)
|
||||
(+! (-> gp-0 data 102 total) (logand -16 (+ v1-103 15)))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) draw))
|
||||
(set! (-> gp-0 length) (max 101 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 100 name) "heap-draw-control")
|
||||
(+! (-> gp-0 data 100 count) 1)
|
||||
(let ((v1-115 (asize-of (-> (the-as process-drawable arg0) draw))))
|
||||
(+! (-> gp-0 data 100 used) v1-115)
|
||||
(+! (-> gp-0 data 100 total) (logand -16 (+ v1-115 15))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) draw skeleton))
|
||||
(set! (-> gp-0 length) (max 104 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 103 name) "heap-bone")
|
||||
(+! (-> gp-0 data 103 count) 1)
|
||||
(let ((v1-129 (asize-of (-> (the-as process-drawable arg0) draw skeleton))))
|
||||
(+! (-> gp-0 data 103 used) v1-129)
|
||||
(+! (-> gp-0 data 103 total) (logand -16 (+ v1-129 15))))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) skel))
|
||||
(set! (-> gp-0 length) (max 102 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 101 name) "heap-joint-control")
|
||||
(+! (-> gp-0 data 101 count) 1)
|
||||
(let ((v1-141 (asize-of (-> (the-as process-drawable arg0) skel))))
|
||||
(+! (-> gp-0 data 101 used) v1-141)
|
||||
(+! (-> gp-0 data 101 total) (logand -16 (+ v1-141 15)))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) part))
|
||||
(set! (-> gp-0 length) (max 105 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 104 name) "heap-part")
|
||||
(+! (-> gp-0 data 104 count) 1)
|
||||
(let ((v1-153 (asize-of (-> (the-as process-drawable arg0) part))))
|
||||
(+! (-> gp-0 data 104 used) v1-153)
|
||||
(+! (-> gp-0 data 104 total) (logand -16 (+ v1-153 15)))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) nav))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-165 (asize-of (-> (the-as process-drawable arg0) nav))))
|
||||
(+! (-> gp-0 data 106 used) v1-165)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-165 15)))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) path))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-177 (asize-of (-> (the-as process-drawable arg0) path))))
|
||||
(+! (-> gp-0 data 106 used) v1-177)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-177 15)))))
|
||||
(when (nonzero? (-> (the-as process-drawable arg0) vol))
|
||||
(set! (-> gp-0 length) (max 107 (-> gp-0 length)))
|
||||
(set! (-> gp-0 data 106 name) "heap-misc")
|
||||
(+! (-> gp-0 data 106 count) 1)
|
||||
(let ((v1-189 (asize-of (-> (the-as process-drawable arg0) vol))))
|
||||
(+! (-> gp-0 data 106 used) v1-189)
|
||||
(+! (-> gp-0 data 106 total) (logand -16 (+ v1-189 15)))))))
|
||||
#t)
|
||||
*null-kernel-context*)
|
||||
this)
|
||||
|
||||
;; the max dma ever (excluding debug)
|
||||
(define *max-dma* 0)
|
||||
|
||||
(defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object))
|
||||
"Print memory usage. Uses a foramt that will fit on screen."
|
||||
|
||||
;; print header (same in normal and compact mode)
|
||||
(let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base)))))
|
||||
(let ((v1-2 (+ (-> this data 59 total) (-> this data 60 total))))
|
||||
(< #x10000 v1-2)
|
||||
)
|
||||
(let ((v1-2 (+ (-> this data 59 total) (-> this data 60 total)))) (< #x10000 v1-2))
|
||||
;; note: this uses a value that's slightly smaller than the real size.
|
||||
;; so this may show that you are using more memory you have, but this not true.
|
||||
(let ((s2-0 #xa1a333)
|
||||
(s1-0 (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) frame global-buf)) 16))
|
||||
)
|
||||
(s1-0 (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) frame global-buf)) 16)))
|
||||
(set! *max-dma* (max s1-0 *max-dma*))
|
||||
|
||||
;; turns memory usage red if you're using too much. This uses the sum of memory-usage blocks, which as far
|
||||
;; as I can tell, is not accurate (textures are negative, for example, but don't seem to be double counted (or even counted) elsewhere).
|
||||
(if (< s2-0 (-> arg0 mem-usage))
|
||||
(format arg1 "~3L")
|
||||
)
|
||||
|
||||
(if (< s2-0 (-> arg0 mem-usage)) (format arg1 "~3L"))
|
||||
;; Format is:
|
||||
;; --LevelName---ActualLevelHeapUseKB--of--SlightlyTooSmallHeapSizeKB---ActorHeapUseKB--of---ActorHeapSizeKb---DmaThisFrameKB/--MaxDmaKbEver
|
||||
(format arg1 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--"
|
||||
(format arg1
|
||||
"~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--"
|
||||
(-> arg0 name)
|
||||
(sar s3-0 10)
|
||||
(sar s2-0 10)
|
||||
(sar (memory-used *nk-dead-pool*) 10)
|
||||
(sar (memory-total *nk-dead-pool*) 10)
|
||||
)
|
||||
|
||||
(format arg1 "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(sar (memory-total *nk-dead-pool*) 10))
|
||||
(format arg1 "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10))))
|
||||
(when *stats-memory-short*
|
||||
(let ((s2-2 (if (cpad-hold? 1 l3)
|
||||
#t
|
||||
arg1
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s2-2 (if (cpad-hold? 1 l3) #t arg1)))
|
||||
;; print actor heap stats.
|
||||
(format s2-2 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%"
|
||||
(format s2-2
|
||||
"heap-~5,'-DK/~5,'-DK----~D---~D/~D~%"
|
||||
(sar (memory-used *nk-dead-pool*) 10)
|
||||
(sar (memory-total *nk-dead-pool*) 10)
|
||||
(compact-time *nk-dead-pool*)
|
||||
(-> *nk-dead-pool* compact-count)
|
||||
(-> *nk-dead-pool* compact-count-targ)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(-> *nk-dead-pool* compact-count-targ))))
|
||||
(when (not *stats-memory-short*)
|
||||
;; print the table
|
||||
|
||||
;; compute debug dma usage.
|
||||
(set! (-> *dma-mem-usage* data 84 total)
|
||||
(* (dma-buffer-length (-> *display* frames (-> *display* last-screen) frame debug-buf)) 16)
|
||||
)
|
||||
|
||||
(* (dma-buffer-length (-> *display* frames (-> *display* last-screen) frame debug-buf)) 16))
|
||||
;; the left column is level heap, the right column is non-debug dma.
|
||||
|
||||
(format arg1 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%"
|
||||
(format arg1
|
||||
" bsp ~192H~5DK ~280Hdebug~456H~5DK~%"
|
||||
(sar (+ (-> this data 56 total) (-> this data 57 total) (-> this data 58 total)) 10)
|
||||
(sar (-> *dma-mem-usage* data 84 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " bsp-leaf-vis-iop ~192H~5DK~%"
|
||||
(sar (if (-> arg0 vis-info (-> arg0 vis-self-index))
|
||||
(the-as int (-> arg0 vis-info (-> arg0 vis-self-index) allocated-length))
|
||||
0
|
||||
)
|
||||
10
|
||||
)
|
||||
)
|
||||
|
||||
(sar (-> *dma-mem-usage* data 84 total) 10))
|
||||
(format arg1
|
||||
" bsp-leaf-vis-iop ~192H~5DK~%"
|
||||
(sar (if (-> arg0 vis-info (-> arg0 vis-self-index)) (the-as int (-> arg0 vis-info (-> arg0 vis-self-index) allocated-length)) 0)
|
||||
10))
|
||||
(format arg1 " bsp-leaf-vis-adj ~192H~5DK~%" (sar (+ (-> this data 59 total) (-> this data 60 total)) 10))
|
||||
(format arg1 " level-code ~192H~5DK~%" (sar (-> this data 63 total) 10))
|
||||
|
||||
(format arg1 " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%"
|
||||
(format arg1
|
||||
" tfrag ~192H~5DK ~280Htfragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 1 total)
|
||||
(-> this data 2 total)
|
||||
(-> this data 3 total)
|
||||
@@ -399,14 +263,11 @@
|
||||
(-> this data 5 total)
|
||||
(-> this data 6 total)
|
||||
(-> this data 7 total)
|
||||
(-> this data 8 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 1 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%"
|
||||
(-> this data 8 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 1 total) 10))
|
||||
(format arg1
|
||||
" tie-proto ~192H~5DK ~280Hsky~456H~5DK~%"
|
||||
(sar (+ (-> this data 9 total)
|
||||
(-> this data 10 total)
|
||||
(-> this data 11 total)
|
||||
@@ -414,25 +275,15 @@
|
||||
(-> this data 13 total)
|
||||
(-> this data 14 total)
|
||||
(-> this data 16 total)
|
||||
(-> this data 17 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 85 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 18 total)
|
||||
(-> this data 20 total)
|
||||
(-> this data 21 total)
|
||||
(-> this data 22 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 9 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " shrub-proto ~192H~5DK ~280Htie-near~456H~5DK~%"
|
||||
(-> this data 17 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 85 total) 10))
|
||||
(format arg1
|
||||
" tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10)
|
||||
(sar (-> *dma-mem-usage* data 9 total) 10))
|
||||
(format arg1
|
||||
" shrub-proto ~192H~5DK ~280Htie-near~456H~5DK~%"
|
||||
(sar (+ (-> this data 25 total)
|
||||
(-> this data 26 total)
|
||||
(-> this data 27 total)
|
||||
@@ -441,32 +292,25 @@
|
||||
(-> this data 30 total)
|
||||
(-> this data 31 total)
|
||||
(-> this data 32 total)
|
||||
(-> this data 33 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 15 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%"
|
||||
(-> this data 33 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 15 total) 10))
|
||||
(format arg1
|
||||
" shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%"
|
||||
(sar (-> this data 34 total) 10)
|
||||
(sar (-> *dma-mem-usage* data 27 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " collision ~192H~5DK ~280Htie-generic~456H~5DK~%"
|
||||
(sar (-> *dma-mem-usage* data 27 total) 10))
|
||||
(format arg1
|
||||
" collision ~192H~5DK ~280Htie-generic~456H~5DK~%"
|
||||
(sar (+ (-> this data 50 total)
|
||||
(-> this data 51 total)
|
||||
(-> this data 52 total)
|
||||
(-> this data 53 total)
|
||||
(-> this data 54 total)
|
||||
(-> this data 55 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 17 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%"
|
||||
(-> this data 55 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 17 total) 10))
|
||||
(format arg1
|
||||
" pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 35 total)
|
||||
(-> this data 36 total)
|
||||
(-> this data 37 total)
|
||||
@@ -482,33 +326,26 @@
|
||||
(-> this data 75 total)
|
||||
(-> this data 78 total)
|
||||
(-> this data 77 total)
|
||||
(-> this data 108 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 35 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%"
|
||||
(-> this data 108 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 35 total) 10))
|
||||
(format arg1
|
||||
" pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%"
|
||||
(sar (+ (-> this data 65 total)
|
||||
(-> this data 66 total)
|
||||
(-> this data 67 total)
|
||||
(-> this data 68 total)
|
||||
(-> this data 69 total)
|
||||
(-> this data 74 total)
|
||||
(-> this data 76 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 86 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " textures ~192H~5DK ~280Htextures~456H~5DK~%"
|
||||
(-> this data 76 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 86 total) 10))
|
||||
(format arg1
|
||||
" textures ~192H~5DK ~280Htextures~456H~5DK~%"
|
||||
(sar (-> this data 79 total) 10)
|
||||
(sar (-> *dma-mem-usage* data 79 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 " entity ~192H~5DK~%"
|
||||
(sar (-> *dma-mem-usage* data 79 total) 10))
|
||||
(format arg1
|
||||
" entity ~192H~5DK~%"
|
||||
(sar (+ (-> this data 64 total)
|
||||
(-> this data 43 total)
|
||||
(-> this data 44 total)
|
||||
@@ -516,29 +353,16 @@
|
||||
(-> this data 49 total)
|
||||
(-> this data 48 total)
|
||||
(-> this data 46 total)
|
||||
(-> this data 47 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
)
|
||||
|
||||
(format arg1 " misc ~192H~5DK ~280Hsprite~456H~5DK~%"
|
||||
(-> this data 47 total))
|
||||
10))
|
||||
(format arg1
|
||||
" misc ~192H~5DK ~280Hsprite~456H~5DK~%"
|
||||
(sar (+ (-> this data 0 total)
|
||||
(-> this data 61 total)
|
||||
(-> this data 62 total)
|
||||
(-> this data 80 total)
|
||||
(-> this data 81 total)
|
||||
)
|
||||
10
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 82 total) 10)
|
||||
)
|
||||
|
||||
(format arg1 "~1K~0L")
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(-> this data 81 total))
|
||||
10)
|
||||
(sar (-> *dma-mem-usage* data 82 total) 10))
|
||||
(format arg1 "~1K~0L"))
|
||||
(none))
|
||||
+391
-930
File diff suppressed because it is too large.
Load diff
Loaded 100 of 565 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user