diff --git a/common/goos/Interpreter.cpp b/common/goos/Interpreter.cpp index 90b61eb7ba..51f48e826a 100644 --- a/common/goos/Interpreter.cpp +++ b/common/goos/Interpreter.cpp @@ -181,7 +181,7 @@ void Interpreter::throw_eval_error(const Object& o, const std::string& err) { */ Object Interpreter::eval_with_rewind(const Object& obj, const std::shared_ptr& env) { - Object result = EmptyListObject::make_new(); + Object result = Object::make_empty_list(); try { result = eval(obj, env); } catch (std::runtime_error& e) { @@ -433,7 +433,7 @@ Object Interpreter::eval_list_return_last(const Object& form, Object rest, const std::shared_ptr& env) { Object o = std::move(rest); - Object rv = EmptyListObject::make_new(); + Object rv = Object::make_empty_list(); for (;;) { if (o.is_pair()) { auto op = o.as_pair(); @@ -949,7 +949,7 @@ Object Interpreter::eval_exit(const Object& form, (void)args; (void)env; want_exit = true; - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -964,7 +964,7 @@ Object Interpreter::eval_begin(const Object& form, } if (args.unnamed.empty()) { - return EmptyListObject::make_new(); + return Object::make_empty_list(); } else { return args.unnamed.back(); } @@ -985,7 +985,7 @@ Object Interpreter::eval_read(const Object& form, throw_eval_error(form, std::string("reader error inside of read:\n") + e.what()); } - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -1002,7 +1002,7 @@ Object Interpreter::eval_read_file(const Object& form, } catch (std::runtime_error& e) { throw_eval_error(form, std::string("reader error inside of read-file:\n") + e.what()); } - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -1026,7 +1026,7 @@ Object Interpreter::eval_load_file(const Object& form, } catch (std::runtime_error& e) { throw_eval_error(form, std::string("eval error inside of load-file:\n") + e.what()); } - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -1042,7 +1042,7 @@ Object Interpreter::eval_print(const Object& form, if (!disable_printing) { printf("%s\n", args.unnamed.at(0).print().c_str()); } - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -1059,7 +1059,7 @@ Object Interpreter::eval_inspect(const Object& form, printf("%s\n", args.unnamed.at(0).inspect().c_str()); } - return EmptyListObject::make_new(); + return Object::make_empty_list(); } /*! @@ -1157,7 +1157,7 @@ Object Interpreter::eval_plus(const Object& form, default: throw_eval_error(form, "+ must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1196,7 +1196,7 @@ Object Interpreter::eval_times(const Object& form, default: throw_eval_error(form, "* must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1240,7 +1240,7 @@ Object Interpreter::eval_minus(const Object& form, default: throw_eval_error(form, "- must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1273,7 +1273,7 @@ Object Interpreter::eval_divide(const Object& form, default: throw_eval_error(form, "/ must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1312,7 +1312,7 @@ Object Interpreter::eval_numequals(const Object& form, default: throw_eval_error(form, "+ must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } return SymbolObject::make_new(reader.symbolTable, result ? "#t" : "#f"); @@ -1342,7 +1342,7 @@ Object Interpreter::eval_lt(const Object& form, default: throw_eval_error(form, "< must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1370,7 +1370,7 @@ Object Interpreter::eval_gt(const Object& form, default: throw_eval_error(form, "> must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1398,7 +1398,7 @@ Object Interpreter::eval_leq(const Object& form, default: throw_eval_error(form, "<= must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1426,7 +1426,7 @@ Object Interpreter::eval_geq(const Object& form, default: throw_eval_error(form, ">= must have a numeric argument"); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } @@ -1568,7 +1568,7 @@ Object Interpreter::eval_error(const Object& form, (void)env; vararg_check(form, args, {ObjectType::STRING}, {}); throw_eval_error(form, "Error: " + args.unnamed.at(0).as_string()->data); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } Object Interpreter::eval_string_ref(const Object& form, @@ -1626,7 +1626,7 @@ Object Interpreter::eval_ash(const Object& form, return Object::make_integer(val >> -sa); } else { throw_eval_error(form, fmt::format("Shift amount {} is out of range", sa)); - return EmptyListObject::make_new(); + return Object::make_empty_list(); } } diff --git a/common/goos/Object.cpp b/common/goos/Object.cpp index 79acf9a5ed..60cd1a2e2d 100644 --- a/common/goos/Object.cpp +++ b/common/goos/Object.cpp @@ -46,11 +46,6 @@ namespace goos { -std::shared_ptr gEmptyList = std::make_shared(); -std::shared_ptr& get_empty_list() { - return gEmptyList; -} - /*! * Convert type to string (name in brackets) */ @@ -151,13 +146,13 @@ Object SymbolObject::make_new(SymbolTable& st, const std::string& name) { */ Object build_list(const std::vector& objects) { if (objects.empty()) { - return EmptyListObject::make_new(); + return Object::make_empty_list(); } // this is by far the most expensive part of parsing, so this is done a bit carefully. // we maintain a std::shared_ptr that represents the list, built from back to front. std::shared_ptr head = - std::make_shared(objects.back(), EmptyListObject::make_new()); + std::make_shared(objects.back(), Object::make_empty_list()); s64 idx = ((s64)objects.size()) - 2; while (idx >= 0) { @@ -180,13 +175,13 @@ Object build_list(const std::vector& objects) { Object build_list(std::vector&& objects) { if (objects.empty()) { - return EmptyListObject::make_new(); + return Object::make_empty_list(); } // this is by far the most expensive part of parsing, so this is done a bit carefully. // we maintain a std::shared_ptr that represents the list, built from back to front. std::shared_ptr head = - std::make_shared(objects.back(), EmptyListObject::make_new()); + std::make_shared(objects.back(), Object::make_empty_list()); s64 idx = ((s64)objects.size()) - 2; while (idx >= 0) { diff --git a/common/goos/Object.h b/common/goos/Object.h index 53df8d81cc..134901dc64 100644 --- a/common/goos/Object.h +++ b/common/goos/Object.h @@ -186,6 +186,8 @@ class Object { return float_obj.print(); case ObjectType::CHAR: return char_obj.print(); + case ObjectType::EMPTY_LIST: + return "()"; default: return heap_obj->print(); } @@ -199,6 +201,8 @@ class Object { return float_obj.inspect(); case ObjectType::CHAR: return char_obj.inspect(); + case ObjectType::EMPTY_LIST: + return "[empty list] ()\n"; default: return heap_obj->inspect(); } @@ -228,6 +232,12 @@ class Object { return o; } + static Object make_empty_list() { + Object o; + o.type = ObjectType::EMPTY_LIST; + return o; + } + PairObject* as_pair() const; EnvironmentObject* as_env() const; std::shared_ptr as_env_ptr() const; @@ -292,31 +302,6 @@ class Object { bool operator!=(const Object& other) const { return !((*this) == other); } }; -// There is a single heap allocated EmptyListObject. -class EmptyListObject; -std::shared_ptr& get_empty_list(); - -class EmptyListObject : public HeapObject { - public: - EmptyListObject() = default; - static Object make_new() { - Object obj; - obj.type = ObjectType::EMPTY_LIST; - obj.heap_obj = get_empty_list(); - return obj; - } - - std::string print() const override { return "()"; } - - std::string inspect() const override { - char buff[256]; - sprintf(buff, "[empty list] ()\n"); - return std::string(buff); - } - - ~EmptyListObject() = default; -}; - class SymbolTable; /*! diff --git a/common/goos/PrettyPrinter.cpp b/common/goos/PrettyPrinter.cpp index 6ad132809c..4b81c82a59 100644 --- a/common/goos/PrettyPrinter.cpp +++ b/common/goos/PrettyPrinter.cpp @@ -834,14 +834,17 @@ std::string to_string(const goos::Object& obj, int line_length) { return pretty; } -goos::Reader pretty_printer_reader; +std::unique_ptr pretty_printer_reader; goos::Reader& get_pretty_printer_reader() { - return pretty_printer_reader; + if (!pretty_printer_reader) { + pretty_printer_reader = std::make_unique(); + } + return *pretty_printer_reader; } goos::Object to_symbol(const std::string& str) { - return goos::SymbolObject::make_new(pretty_printer_reader.symbolTable, str); + return goos::SymbolObject::make_new(get_pretty_printer_reader().symbolTable, str); } goos::Object build_list(const std::string& str) { @@ -849,12 +852,12 @@ goos::Object build_list(const std::string& str) { } goos::Object build_list(const goos::Object& obj) { - return goos::PairObject::make_new(obj, goos::EmptyListObject::make_new()); + return goos::PairObject::make_new(obj, goos::Object::make_empty_list()); } goos::Object build_list(const std::vector& objects) { if (objects.empty()) { - return goos::EmptyListObject::make_new(); + return goos::Object::make_empty_list(); } else { return build_list(objects.data(), objects.size()); } @@ -868,7 +871,7 @@ goos::Object build_list(const goos::Object* objects, int count) { if (count - 1) { cdr = build_list(objects + 1, count - 1); } else { - cdr = goos::EmptyListObject::make_new(); + cdr = goos::Object::make_empty_list(); } return goos::PairObject::make_new(car, cdr); } @@ -876,7 +879,7 @@ goos::Object build_list(const goos::Object* objects, int count) { // build a list out of a vector of strings that are converted to symbols goos::Object build_list(const std::vector& symbols) { if (symbols.empty()) { - return goos::EmptyListObject::make_new(); + return goos::Object::make_empty_list(); } std::vector f; f.reserve(symbols.size()); diff --git a/common/util/FontUtils.cpp b/common/util/FontUtils.cpp index dd80856bb5..6ab9895bee 100644 --- a/common/util/FontUtils.cpp +++ b/common/util/FontUtils.cpp @@ -372,7 +372,7 @@ RemapInfo* jak1_bytes_to_utf8(const char* in) { if (info.bytes.size() == 0) continue; bool found = true; - for (int i = 0; found && i < info.bytes.size(); ++i) { + for (int i = 0; found && i < (int)info.bytes.size(); ++i) { if (uint8_t(in[i]) != info.bytes.at(i)) { found = false; } diff --git a/decompiler/ObjectFile/LinkedObjectFile.cpp b/decompiler/ObjectFile/LinkedObjectFile.cpp index 923aa050f3..e878ca2c4b 100644 --- a/decompiler/ObjectFile/LinkedObjectFile.cpp +++ b/decompiler/ObjectFile/LinkedObjectFile.cpp @@ -841,8 +841,8 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector // resulting form. we can't have a totally empty list (as an empty list looks like a symbol, // so it wouldn't be flagged), so it's safe to make this a pair. - auto result = goos::PairObject::make_new(goos::EmptyListObject::make_new(), - goos::EmptyListObject::make_new()); + auto result = + goos::PairObject::make_new(goos::Object::make_empty_list(), goos::Object::make_empty_list()); // the current pair to fill out. auto fill = result; @@ -859,7 +859,7 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector if (is_empty_list(seg, cdr_addr)) { // the list has ended! - fill.as_pair()->cdr = goos::EmptyListObject::make_new(); + fill.as_pair()->cdr = goos::Object::make_empty_list(); return result; } else { // cdr object should be aligned. @@ -869,8 +869,8 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector if (cdr_word.kind == LinkedWord::PTR && (labels.at(cdr_word.label_id).offset & 7) == 2) { // yes, proper list. add another pair and link it in to the list. goal_print_obj = labels.at(cdr_word.label_id).offset; - fill.as_pair()->cdr = goos::PairObject::make_new(goos::EmptyListObject::make_new(), - goos::EmptyListObject::make_new()); + fill.as_pair()->cdr = goos::PairObject::make_new(goos::Object::make_empty_list(), + goos::Object::make_empty_list()); fill = fill.as_pair()->cdr; } else { // improper list, put the last thing in and end @@ -936,7 +936,7 @@ goos::Object LinkedObjectFile::to_form_script_object(int seg, } } } else if (word.kind == LinkedWord::EMPTY_PTR) { - result = goos::EmptyListObject::make_new(); + result = goos::Object::make_empty_list(); } else { std::string debug; append_word_to_string(debug, word); diff --git a/decompiler/analysis/mips2c.cpp b/decompiler/analysis/mips2c.cpp index 6e4cc2ed7d..1321bba89e 100644 --- a/decompiler/analysis/mips2c.cpp +++ b/decompiler/analysis/mips2c.cpp @@ -770,6 +770,12 @@ Mips2C_Line handle_por(const Instruction& i0, const std::string& instr_string) { } } +Mips2C_Line handle_vopmula(const Instruction& i0, const std::string& instr_string) { + return { + fmt::format("c->vopmula({}, {});", reg_to_name(i0.get_src(0)), reg_to_name(i0.get_src(1))), + instr_string}; +} + Mips2C_Line handle_lui(const Instruction& i0, const std::string& instr_string) { return {fmt::format("c->lui({}, {});", reg_to_name(i0.get_dst(0)), i0.get_src(0).get_imm()), instr_string}; @@ -859,6 +865,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output, case InstructionKind::PMAXW: case InstructionKind::SUBU: case InstructionKind::DSRAV: + case InstructionKind::VOPMSUB: return handle_generic_op3(i0, instr_str, {}); case InstructionKind::MULS: return handle_generic_op3(i0, instr_str, "muls"); @@ -924,6 +931,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output, return handle_clts(i0, instr_str); case InstructionKind::VWAITQ: return handle_plain_op(i0, instr_str, "vwaitq"); + case InstructionKind::VOPMULA: + return handle_vopmula(i0, instr_str); default: unknown_count++; return handle_unknown(instr_str); diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index eeff4ac980..107163da3a 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -499,7 +499,7 @@ (bucket-1 1) (bucket-2 2) - (bucket-3 3) + (sky-draw 3) (tfrag-tex0 5) ;; merc0 10 ;; generic0 11 @@ -9096,7 +9096,7 @@ (backup-load-state-and-set-cmds (_type_ pair) int 17) (restore-load-state-and-cleanup (_type_) int 18) (restore-load-state (_type_) int 19) - (dummy-20 () none 20) + (set-force-inside! (_type_ symbol symbol) none 20) ) ) @@ -15536,7 +15536,7 @@ (define-extern sprite-draw (function display none)) (define-extern sprite-allocate-user-hvdf (function int)) (define-extern sprite-release-user-hvdf (function int none)) -(define-extern sprite-get-user-hvdf (function int qword)) +(define-extern sprite-get-user-hvdf (function int vector)) ;; - Symbols @@ -17703,12 +17703,23 @@ :flag-assert #x900000010 ) +(defenum load-boundary-cmd + :type uint8 + (invalid 0) + (load 1) + (cmd2 2) + (display 3) + (vis 4) + (force-vis 5) + (checkpt 6) + ) + (deftype load-boundary-crossing-command (structure) - ((cmd uint8 :offset-assert 0) + ((cmd load-boundary-cmd :offset-assert 0) (bparm uint8 3 :offset-assert 1) - ;(parm UNKNOWN 2 :offset-assert 4) - (lev0 basic :offset-assert 4) - (lev1 basic :offset-assert 8) + (parm uint32 2 :offset-assert 4) + (lev0 basic :offset 4) + (lev1 basic :offset 8) (displev basic :offset 4) (dispcmd basic :offset 8) (nick basic :offset 4) @@ -17722,18 +17733,29 @@ :flag-assert #x90000000c ) +(defenum load-boundary-flags + :type uint8 + :bitfield #t + (closed 0) + (player 1) + ) + (deftype load-boundary (basic) ((num-points uint16 :offset-assert 4) - (flags uint8 :offset-assert 6) + (flags load-boundary-flags :offset-assert 6) (top-plane float :offset-assert 8) (bot-plane float :offset-assert 12) (tri-cnt int32 :offset-assert 16) - (next basic :offset-assert 20) + (next load-boundary :offset-assert 20) (cmd-fwd load-boundary-crossing-command :inline :offset-assert 24) (cmd-bwd load-boundary-crossing-command :inline :offset-assert 36) (rejector vector :inline :offset-assert 48) - (data uint128 1 :offset-assert 64) + (data lbvtx 1 :inline :offset-assert 64) + (data2 lbvtx :dynamic :inline :offset 64) ) + (:methods + (new (symbol type int symbol symbol) _type_ 0) + ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 @@ -17741,8 +17763,8 @@ ;; - Unknowns -;;(define-extern *load-boundary-list* object) ;; unknown type -;;(define-extern *load-boundary-target* object) ;; unknown type +(define-extern *load-boundary-list* load-boundary) ;; guess for now +(define-extern *load-boundary-target* (inline-array lbvtx)) ;; unknown type ;; ---------------------- @@ -17754,7 +17776,7 @@ ;; - Types (deftype lb-editor-parms (basic) - ((boundary basic :offset-assert 4) + ((boundary load-boundary :offset-assert 4) (vertex int32 :offset-assert 8) (x-origin float :offset-assert 12) (z-origin float :offset-assert 16) @@ -17766,65 +17788,65 @@ ;; - Functions -(define-extern check-closed-boundary function) -(define-extern check-open-boundary function) +(define-extern check-closed-boundary (function load-boundary lbvtx lbvtx symbol)) +(define-extern check-open-boundary (function load-boundary lbvtx lbvtx symbol)) (define-extern load-state-want-vis (function symbol int)) (define-extern load-state-want-levels (function symbol symbol int)) (define-extern load-state-want-display-level (function symbol symbol int)) (define-extern load-state-want-force-vis (function symbol symbol int)) -(define-extern command-get-param (function object symbol symbol)) +(define-extern command-get-param (function object object object)) (define-extern entity-birth-no-kill (function entity none)) (define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed (define-extern command-list-get-process (function object process)) -(define-extern command-get-quoted-param (function object symbol symbol)) +(define-extern command-get-quoted-param (function object object object)) (define-extern command-get-int (function object int int)) (define-extern ambient-hint-spawn (function string vector process-tree symbol object)) (define-extern command-get-float (function object float float)) (define-extern process-by-ename (function string process)) -(define-extern point-in-polygon function) -(define-extern try-corner function) -(define-extern split-monotone-polygon function) -(define-extern fix-boundary-normals function) -(define-extern triangulate-boundary function) -(define-extern find-bounding-circle function) -(define-extern render-boundary function) -(define-extern check-boundary function) -(define-extern edit-load-boundaries function) -(define-extern copy-load-command! function) -(define-extern copy-load-boundary! function) -(define-extern lb-add-plane function) -(define-extern lb-add function) -(define-extern save-boundary-cmd function) -(define-extern replace-load-boundary function) -(define-extern format-boundary-cmd function) -(define-extern boundary-set-color function) -(define-extern add-boundary-shader function) -(define-extern draw-boundary-cap function) -(define-extern draw-boundary-side function) -(define-extern init-boundary-regs function) -(define-extern render-boundary-tri function) -(define-extern render-boundary-quad function) +(define-extern point-in-polygon (function load-boundary vector symbol)) +(define-extern try-corner (function object int symbol)) +(define-extern split-monotone-polygon (function load-boundary int none)) +(define-extern fix-boundary-normals (function load-boundary none)) +(define-extern triangulate-boundary (function load-boundary object)) +(define-extern find-bounding-circle (function load-boundary none)) +(define-extern render-boundary (function load-boundary none)) +(define-extern check-boundary (function load-boundary none)) +(define-extern edit-load-boundaries (function none)) +(define-extern copy-load-command! (function load-boundary-crossing-command load-boundary-crossing-command none)) +(define-extern copy-load-boundary! (function load-boundary load-boundary none)) +(define-extern lb-add-plane (function load-boundary)) +(define-extern lb-add (function load-boundary)) +(define-extern save-boundary-cmd (function load-boundary-crossing-command string file-stream none)) +(define-extern replace-load-boundary (function load-boundary load-boundary none)) +(define-extern format-boundary-cmd (function load-boundary-crossing-command none)) +(define-extern boundary-set-color (function lbvtx load-boundary-crossing-command none)) +(define-extern add-boundary-shader (function texture-id dma-buffer none)) +(define-extern draw-boundary-cap (function load-boundary float dma-buffer symbol none)) +(define-extern draw-boundary-side (function load-boundary integer integer dma-buffer symbol none)) +(define-extern init-boundary-regs (function none)) +(define-extern render-boundary-tri (function lbvtx dma-buffer none)) +(define-extern render-boundary-quad (function lbvtx dma-buffer none)) (define-extern draw-boundary-polygon function) -(define-extern lb-del function) -(define-extern lb-add-vtx-before function) -(define-extern lb-add-vtx-after function) -(define-extern lb-del-vtx function) -(define-extern load-boundary-from-template function) -(define-extern ---lb-save function) -(define-extern lb-add-load function) -(define-extern lb-add-load-plane function) -(define-extern lb-flip function) -(define-extern lb-set-camera function) -(define-extern lb-set-player function) -(define-extern lb-copy function) +(define-extern lb-del (function none)) +(define-extern lb-add-vtx-before (function none)) +(define-extern lb-add-vtx-after (function none)) +(define-extern lb-del-vtx (function none)) +(define-extern load-boundary-from-template (function (array object) none)) +(define-extern ---lb-save (function none)) +(define-extern lb-add-load (function object object none)) +(define-extern lb-add-load-plane (function object object none)) +(define-extern lb-flip (function none)) +(define-extern lb-set-camera (function none)) +(define-extern lb-set-player (function none)) +(define-extern lb-copy (function none)) (define-extern render-boundaries (function none)) -(define-extern command-get-time function) +(define-extern command-get-time (function object int int)) ;; - Unknowns (define-extern *backup-load-state* load-state) (define-extern *display-load-commands* symbol) -(define-extern *triangulation-buffer* pointer) +(define-extern *triangulation-buffer* (inline-array lbvtx)) (define-extern *lb-editor-parms* lb-editor-parms) (define-extern *boundary-polygon* (inline-array lbvtx)) @@ -17837,7 +17859,7 @@ ;; - Unknowns -;;(define-extern *static-load-boundary-list* object) ;; unknown type +(define-extern *static-load-boundary-list* (array array)) ;; unknown type ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index f14dc84af6..32daec6e84 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -360,6 +360,7 @@ "(anon-function 2 target-tube)", "(anon-function 5 orbit-plat)", "(anon-function 2 ogreboss)" + ], // these functions use pairs and the decompiler @@ -405,7 +406,11 @@ "(method 21 swamp-rat-nest-dummy-a)", "(method 21 swamp-rat-nest-dummy-b)", "(method 21 swamp-rat-nest-dummy-c)", - "(method 27 battlecontroller)" + "(method 27 battlecontroller)", + "load-boundary-from-template", + "command-get-time", + "command-get-param", + "command-get-quoted-param" ], // If format is used with the wrong number of arguments, @@ -545,6 +550,12 @@ "render-sky-tri", "init-sky-regs", "set-tex-offset", - "adgif-shader<-texture-with-update!" + "adgif-shader<-texture-with-update!", + "init-boundary-regs", + "draw-boundary-polygon", + "render-boundary-quad", + "render-boundary-tri" ] } + + diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index 4e2b9b3412..0d0f11e28f 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -334,7 +334,10 @@ "shadow-cpu": [["L122", "shadow-data"]], - "load-boundary": [["L327", "(inline-array lbvtx)", 3]], + "load-boundary": [ + ["L327", "(inline-array lbvtx)", 12], + ["L324", "vector"] + ], "default-menu": [ ["L6251", "float", true], diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 563474abde..2382fae035 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -2641,5 +2641,32 @@ [224, "vector"] ], + "lb-flip":[ + [16, "load-boundary-crossing-command"] + ], + + "---lb-save":[ + [16, "file-stream"] + ], + + "edit-load-boundaries":[ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + + "triangulate-boundary":[ + [16, "lbvtx"] + ], + + "fix-boundary-normals":[ + [16, "vector"] + ], + + "check-closed-boundary":[ + [16, "vector"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 82acee0e68..b47d95efd7 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -1103,8 +1103,10 @@ "blackout": [[[20, 24], "v1", "dma-packet"]], "(method 15 load-state)": [ [31, "t9", "(function int)"], - [291, "s5", "entity-actor"], - [370, "s3", "process-drawable"] + [[291,303], "s5", "entity-actor"], + [370, "s3", "process-drawable"], + [343, "s5", "symbol"], + [21, "s5", "symbol"] ], "yakow-default-event-handler": [ [27, "a0", "collide-shape"], @@ -3973,5 +3975,62 @@ "(trans fisher-done)": [[[41, 46], "v1", "dma-packet"]], + "load-boundary-from-template": [ + [[2, 60], "s5", "(array float)"], + [42, "a0", "pair"], + [54, "a0", "pair"] + ], + + "command-get-int":[ + [27, "gp", "bfloat"] + ], + + "command-get-float":[ + [30, "gp", "bfloat"] + ], + + "command-get-time":[ + [46, "gp", "bfloat"] + ], + + "command-get-param":[ + [125, "gp", "bfloat"] + ], + + "command-list-get-process":[ + [[78, 88], "s4", "process-drawable"] + ], + + "add-boundary-shader":[ + [[5,8], "a1", "gs-gif-tag"], + [[11, 35], "s5", "adgif-shader"] + ], + + "render-boundary":[ + [[22, 26], "a0", "dma-packet"], + [[32, 35], "a0", "gs-gif-tag"], + + [40, "a0", "(pointer gs-zbuf)"], + [42, "a0", "(pointer gs-reg64)"], + [44, "a0", "(pointer gs-test)"], + [46, "a0", "(pointer gs-reg64)"], + [48, "a0", "(pointer gs-alpha)"], + [50, "a0", "(pointer gs-reg64)"], + [[110, 117], "s2", "dma-packet"], + [[120, 123], "v1", "dma-packet"] + ], + + "real-main-draw-hook":[ + [[225, 229], "a0", "dma-packet"], + [[235, 238], "a0", "gs-gif-tag"], + [243, "a0", "(pointer gs-zbuf)"], + [245, "a0", "(pointer gs-reg64)"], + [247, "a0", "(pointer gs-test)"], + [249, "a0", "(pointer gs-reg64)"], + [251, "a0", "(pointer gs-alpha)"], + [253, "a0", "(pointer gs-reg64)"], + [[270, 273], "v1", "dma-packet"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 2bd555604e..1cd0fba08b 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -963,8 +963,8 @@ goos::Object decompile_value(const TypeSpec& type, memcpy(&value, bytes.data(), 8); // only rewrite if exact. - s64 seconds_int = value / TICKS_PER_SECOND; - if (seconds_int * TICKS_PER_SECOND == value) { + s64 seconds_int = value / (s64)TICKS_PER_SECOND; + if (seconds_int * (s64)TICKS_PER_SECOND == value) { return pretty_print::to_symbol(fmt::format("(seconds {})", seconds_int)); } double seconds = (double)value / TICKS_PER_SECOND; @@ -1057,7 +1057,7 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label, int array_allocated_length = size_word_2.data; auto content_type_info = ts.lookup_type(content_type); - if (content_type_info->is_reference()) { + if (content_type_info->is_reference() || content_type == TypeSpec("object")) { // easy, stride of 4. std::vector result = { pretty_print::to_symbol("new"), pretty_print::to_symbol("'static"), @@ -1071,14 +1071,25 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label, if (word.kind == LinkedWord::PLAIN_DATA && word.data == 0) { result.push_back(pretty_print::to_symbol("0")); } else if (word.kind == LinkedWord::PTR) { - result.push_back( - decompile_at_label(content_type, labels.at(word.label_id), labels, words, ts, file)); + if (content_type == TypeSpec("object")) { + result.push_back( + decompile_at_label_guess_type(labels.at(word.label_id), labels, words, ts, file)); + } else { + result.push_back( + decompile_at_label(content_type, labels.at(word.label_id), labels, words, ts, file)); + } } else if (word.kind == LinkedWord::SYM_PTR) { result.push_back(pretty_print::to_symbol(fmt::format("'{}", word.symbol_name))); } else { - throw std::runtime_error( - fmt::format("Unknown content type in boxed array of references, word idx {}", - first_elt_word_idx + elt)); + if (content_type == TypeSpec("object") && word.kind == LinkedWord::PLAIN_DATA && + (word.data & 0b111) == 0) { + s32 val = word.data; + result.push_back(pretty_print::to_symbol(fmt::format("(the binteger {})", val / 8))); + } else { + throw std::runtime_error( + fmt::format("Unknown content type in boxed array of references, word idx {}", + first_elt_word_idx + elt)); + } } } diff --git a/game/fake_iso.txt b/game/fake_iso.txt index d5f4f208b9..9d25c86953 100644 --- a/game/fake_iso.txt +++ b/game/fake_iso.txt @@ -18,4 +18,7 @@ SAVEGAME.ICO resources/SAVEGAME.ICO 5COMMON.TXT out/iso/5COMMON.TXT 0TEST.TXT out/iso/0TEST.TXT VI1.DGO out/iso/VI1.DGO -VI3.DGO out/iso/VI3.DGO \ No newline at end of file +VI2.DGO out/iso/VI2.DGO +VI3.DGO out/iso/VI3.DGO +TRA.DGO out/iso/TRA.DGO +FIN.DGO out/iso/FIN.DGO \ No newline at end of file diff --git a/game/graphics/opengl_renderer/DirectRenderer.cpp b/game/graphics/opengl_renderer/DirectRenderer.cpp index 14298beaef..65b8fb6ec8 100644 --- a/game/graphics/opengl_renderer/DirectRenderer.cpp +++ b/game/graphics/opengl_renderer/DirectRenderer.cpp @@ -236,6 +236,18 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) { // currently gouraud is handled in setup. const auto& state = m_prim_gl_state; if (state.texture_enable) { + float alpha_reject = 0.; + if (m_test_state.alpha_test_enable) { + switch (m_test_state.alpha_test) { + case GsTest::AlphaTest::ALWAYS: + break; + case GsTest::AlphaTest::GEQUAL: + alpha_reject = m_test_state.aref / 128.f; + break; + default: + assert(false); + } + } if (m_texture_state.tcc) { if (m_mode == Mode::SPRITE_CPU) { render_state->shaders[ShaderId::SPRITE_CPU].activate(); @@ -243,9 +255,17 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) { assert(false); } else { render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].activate(); + glUniform1f( + glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(), + "alpha_reject"), + alpha_reject); } } else { render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED_TCC0].activate(); + glUniform1f( + glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED_TCC0].id(), + "alpha_reject"), + alpha_reject); } update_gl_texture(render_state); } else { @@ -306,8 +326,14 @@ void DirectRenderer::update_gl_texture(SharedRenderState* render_state) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + if (m_texture_state.enable_tex_filt) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + glUniform1i( glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(), "T0"), 0); } @@ -364,10 +390,6 @@ void DirectRenderer::update_gl_test() { assert(false); } - if (state.alpha_test_enable) { - assert(state.alpha_test == GsTest::AlphaTest::ALWAYS); - } - if (state.depth_writes) { glDepthMask(GL_TRUE); } else { @@ -538,7 +560,7 @@ void DirectRenderer::render_gif(const u8* data, eop = tag.eop(); } - assert(offset == size); + assert((offset + 15) / 16 == size / 16); // fmt::print("{}\n", GifTag(data).print()); } @@ -572,7 +594,7 @@ void DirectRenderer::handle_ad(const u8* data, break; case GsRegisterAddress::TEX1_1: - handle_tex1_1(value); + handle_tex1_1(value, render_state, prof); break; case GsRegisterAddress::TEXA: handle_texa(value); @@ -600,17 +622,26 @@ void DirectRenderer::handle_ad(const u8* data, } } -void DirectRenderer::handle_tex1_1(u64 val) { +void DirectRenderer::handle_tex1_1(u64 val, + SharedRenderState* render_state, + ScopedProfilerNode& prof) { GsTex1 reg(val); // for now, we aren't going to handle mipmapping. I don't think it's used with direct. // assert(reg.mxl() == 0); // if that's true, we can ignore LCM, MTBA, L, K - // MMAG/MMIN specify texture filtering. For now, assume always linear - assert(reg.mmag() == true); - if (!(reg.mmin() == 1 || reg.mmin() == 4)) { // with mipmap off, both of these are linear - // lg::error("unsupported mmin"); + bool want_tex_filt = reg.mmag(); + + if (want_tex_filt != m_texture_state.enable_tex_filt) { + flush_pending(render_state, prof); + m_texture_state.enable_tex_filt = want_tex_filt; } + + // MMAG/MMIN specify texture filtering. For now, assume always linear + // assert(reg.mmag() == true); + // if (!(reg.mmin() == 1 || reg.mmin() == 4)) { // with mipmap off, both of these are linear + // // lg::error("unsupported mmin"); + // } } void DirectRenderer::handle_tex0_1_packed(const u8* data, @@ -720,7 +751,7 @@ void DirectRenderer::handle_test1(u64 val, ScopedProfilerNode& prof) { GsTest reg(val); if (reg.alpha_test_enable()) { - assert(reg.alpha_test() == GsTest::AlphaTest::ALWAYS); + // assert(reg.alpha_test() == GsTest::AlphaTest::ALWAYS); } assert(!reg.date()); if (m_test_state.current_register != reg) { @@ -728,6 +759,7 @@ void DirectRenderer::handle_test1(u64 val, flush_pending(render_state, prof); m_test_state.from_register(reg); m_test_state_needs_gl_update = true; + m_prim_gl_state_needs_gl_update = true; } } diff --git a/game/graphics/opengl_renderer/DirectRenderer.h b/game/graphics/opengl_renderer/DirectRenderer.h index a356380047..fc82fd4ecb 100644 --- a/game/graphics/opengl_renderer/DirectRenderer.h +++ b/game/graphics/opengl_renderer/DirectRenderer.h @@ -84,7 +84,7 @@ class DirectRenderer : public BucketRenderer { SharedRenderState* render_state, ScopedProfilerNode& prof); void handle_tex0_1(u64 val, SharedRenderState* render_state, ScopedProfilerNode& prof); - void handle_tex1_1(u64 val); + void handle_tex1_1(u64 val, SharedRenderState* render_state, ScopedProfilerNode& prof); void handle_texa(u64 val); void handle_xyzf2_common(u32 x, @@ -157,6 +157,8 @@ class DirectRenderer : public BucketRenderer { bool using_mt4hh = false; bool tcc = false; bool needs_gl_update = true; + + bool enable_tex_filt = true; } m_texture_state; // state set through the prim/rgbaq register that doesn't require changing GL stuff diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index f00f376a13..db2ec2bd80 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -162,7 +162,7 @@ void OpenGLRenderer::draw_renderer_selection_window() { */ void OpenGLRenderer::setup_frame(int window_width_px, int window_height_px) { glViewport(0, 0, window_width_px, window_height_px); - glClearColor(0.5, 0.5, 0.5, 1.0); + glClearColor(0.0, 0.0, 0.0, 0.0); glClearDepth(0.0); glDepthMask(GL_TRUE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -286,7 +286,7 @@ void OpenGLRenderer::finish_screenshot(const std::string& output_name, int width // flip upside down in place for (int h = 0; h < height / 2; h++) { for (int w = 0; w < width; w++) { - std::swap(buffer[h * width + w], buffer[(height - h) * width + w]); + std::swap(buffer[h * width + w], buffer[(height - h - 1) * width + w]); } } diff --git a/game/graphics/opengl_renderer/SkyRenderer.cpp b/game/graphics/opengl_renderer/SkyRenderer.cpp index 740eef4002..933c1e7cb7 100644 --- a/game/graphics/opengl_renderer/SkyRenderer.cpp +++ b/game/graphics/opengl_renderer/SkyRenderer.cpp @@ -322,41 +322,56 @@ void SkyRenderer::render(DmaFollower& dma, assert(setup_packet.size_bytes == 16 * 4); m_direct_renderer.render_gif(setup_packet.data, setup_packet.size_bytes, render_state, prof); - auto draw_setup_packet = dma.read_and_advance(); - assert(draw_setup_packet.size_bytes == 16 * 5); - m_direct_renderer.render_gif(draw_setup_packet.data, draw_setup_packet.size_bytes, render_state, - prof); - // tex0: tbw = 1, th = 5, hw = 5, sky-base-block - // mmag/mmin = 1 - // clamp - // drawing. - int dma_idx = 0; - while (dma.current_tag().kind == DmaTag::Kind::CNT) { - m_frame_stats.gif_packets++; - auto data = dma.read_and_advance(); - assert(data.vifcode0().kind == VifCode::Kind::NOP); - assert(data.vifcode1().kind == VifCode::Kind::DIRECT); - assert(data.vifcode1().immediate == data.size_bytes / 16); - if (m_enabled) { - m_direct_renderer.render_gif(data.data, data.size_bytes, render_state, prof); + if (dma.current_tag().qwc == 5) { + auto draw_setup_packet = dma.read_and_advance(); + m_direct_renderer.render_gif(draw_setup_packet.data, draw_setup_packet.size_bytes, render_state, + prof); + // tex0: tbw = 1, th = 5, hw = 5, sky-base-block + // mmag/mmin = 1 + // clamp + // drawing. + int dma_idx = 0; + while (dma.current_tag().kind == DmaTag::Kind::CNT) { + m_frame_stats.gif_packets++; + auto data = dma.read_and_advance(); + assert(data.vifcode0().kind == VifCode::Kind::NOP); + assert(data.vifcode1().kind == VifCode::Kind::DIRECT); + assert(data.vifcode1().immediate == data.size_bytes / 16); + if (m_enabled) { + m_direct_renderer.render_gif(data.data, data.size_bytes, render_state, prof); + } + dma_idx++; + } + + auto empty = dma.read_and_advance(); + assert(empty.size_bytes == 0); + assert(empty.vif0() == 0); + assert(empty.vif1() == 0); + + assert(dma.current_tag().kind == DmaTag::Kind::CALL); + dma.read_and_advance(); + dma.read_and_advance(); // cnt + assert(dma.current_tag().kind == DmaTag::Kind::RET); + dma.read_and_advance(); // ret + dma.read_and_advance(); // ret + assert(dma.current_tag_offset() == render_state->next_bucket); + } else { + while (dma.current_tag_offset() != render_state->next_bucket) { + auto data = dma.read_and_advance(); + if (data.size_bytes && m_enabled) { + m_direct_renderer.render_vif(data.vif0(), data.vif1(), data.data, data.size_bytes, + render_state, prof); + } + + if (dma.current_tag_offset() == render_state->default_regs_buffer) { + dma.read_and_advance(); // cnt + assert(dma.current_tag().kind == DmaTag::Kind::RET); + dma.read_and_advance(); // ret + } } - dma_idx++; } m_direct_renderer.flush_pending(render_state, prof); - - auto empty = dma.read_and_advance(); - assert(empty.size_bytes == 0); - assert(empty.vif0() == 0); - assert(empty.vif1() == 0); - - assert(dma.current_tag().kind == DmaTag::Kind::CALL); - dma.read_and_advance(); - dma.read_and_advance(); // cnt - assert(dma.current_tag().kind == DmaTag::Kind::RET); - dma.read_and_advance(); // ret - dma.read_and_advance(); // ret - assert(dma.current_tag_offset() == render_state->next_bucket); } void SkyRenderer::draw_debug_window() { diff --git a/game/graphics/opengl_renderer/shaders/direct_basic_textured.frag b/game/graphics/opengl_renderer/shaders/direct_basic_textured.frag index bbd6421192..6fdd84872a 100644 --- a/game/graphics/opengl_renderer/shaders/direct_basic_textured.frag +++ b/game/graphics/opengl_renderer/shaders/direct_basic_textured.frag @@ -3,11 +3,15 @@ out vec4 color; in vec4 fragment_color; -in vec2 tex_coord; +in vec3 tex_coord; uniform sampler2D tex_T0; +uniform float alpha_reject; void main() { //vec4 T0 = texture(tex_T0, tex_coord); - vec4 T0 = textureProj(tex_T0, vec3(tex_coord, 1.0)); + vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z); color = fragment_color * T0 * 2.0; + if (color.a <= alpha_reject) { + discard; + } } diff --git a/game/graphics/opengl_renderer/shaders/direct_basic_textured.vert b/game/graphics/opengl_renderer/shaders/direct_basic_textured.vert index beeff2725d..e5c6ca8ecb 100644 --- a/game/graphics/opengl_renderer/shaders/direct_basic_textured.vert +++ b/game/graphics/opengl_renderer/shaders/direct_basic_textured.vert @@ -5,10 +5,10 @@ layout (location = 1) in vec4 rgba_in; layout (location = 2) in vec3 tex_coord_in; out vec4 fragment_color; -out vec2 tex_coord; +out vec3 tex_coord; void main() { gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32, position_in.z, 1.0); fragment_color = vec4(rgba_in.x, rgba_in.y, rgba_in.z, rgba_in.w * 2.); - tex_coord = tex_coord_in.xy; + tex_coord = tex_coord_in; } \ No newline at end of file diff --git a/game/graphics/opengl_renderer/shaders/direct_basic_textured_tcc0.frag b/game/graphics/opengl_renderer/shaders/direct_basic_textured_tcc0.frag index 4b01c977ee..90f5ad9cbe 100644 --- a/game/graphics/opengl_renderer/shaders/direct_basic_textured_tcc0.frag +++ b/game/graphics/opengl_renderer/shaders/direct_basic_textured_tcc0.frag @@ -5,11 +5,14 @@ out vec4 color; in vec4 fragment_color; in vec3 tex_coord; uniform sampler2D tex_T0; - +uniform float alpha_reject; void main() { vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z); //vec4 T0 = textureProj(tex_T0, vec3(tex_coord.xy, 1.0)); T0.w = 1.0; color = fragment_color * T0 * 2.0; + if (color.a <= alpha_reject) { + discard; + } } diff --git a/game/graphics/opengl_renderer/shaders/sky.frag b/game/graphics/opengl_renderer/shaders/sky.frag index b2ff0385ec..669ac5a38c 100644 --- a/game/graphics/opengl_renderer/shaders/sky.frag +++ b/game/graphics/opengl_renderer/shaders/sky.frag @@ -9,5 +9,5 @@ uniform sampler2D tex_T0; void main() { vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z); T0.w = 1.0; - color = fragment_color * T0 * 2.0; + color = fragment_color * T0 * 1.0; } diff --git a/game/graphics/texture/TextureConverter.cpp b/game/graphics/texture/TextureConverter.cpp index 58c18243f5..4e42f8f6af 100644 --- a/game/graphics/texture/TextureConverter.cpp +++ b/game/graphics/texture/TextureConverter.cpp @@ -169,7 +169,29 @@ void TextureConverter::download_rgba8888(u8* result, out_offset += 4; } } - } else { + } else if (psm == int(PSM::PSMCT16) && clut_psm == 0) { + // plain 16-bit texture + // not a clut. + // will store output pixels, rgba (8888) + + // width is like the TEX0 register, in 64 texel units. + // not sure what the other widths are yet. + int read_width = 64 * goal_tex_width; + + // loop over pixels in output texture image + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + // read as the PSMT8 type. The dest field tells us a block offset. + auto addr8 = psmct16_addr(x, y, read_width) + vram_addr * 256; + u16 value = *(u16*)(m_vram.data() + addr8); + u32 val32 = rgba16_to_rgba32(value); + memcpy(result + out_offset, &val32, 4); + out_offset += 4; + } + } + } + + else { assert(false); } diff --git a/game/kernel/kprint.cpp b/game/kernel/kprint.cpp index 361dab7cbe..4681a380dd 100644 --- a/game/kernel/kprint.cpp +++ b/game/kernel/kprint.cpp @@ -12,6 +12,7 @@ #include "common/goal_constants.h" #include "common/common_types.h" #include "common/cross_os_debug/xdbg.h" +#include "game/sce/sif_ee.h" #include "kprint.h" #include "kmachine.h" #include "kboot.h" @@ -1076,7 +1077,13 @@ s32 format_impl(uint64_t* args) { *PrintPendingLocal3 = 0; return 0; } else if (type == *Ptr>(s7.offset + FIX_SYM_FILE_STREAM_TYPE)) { - assert(false); // file stream nyi + size_t len = strlen(PrintPendingLocal3); + // sceWrite + ee::sceWrite(*Ptr(original_dest + 12), PrintPendingLocal3, len); + + PrintPending = make_ptr(PrintPendingLocal2).cast(); + *PrintPendingLocal3 = 0; + return 0; } } assert(false); // unknown destination diff --git a/game/mips2c/functions/sky_tng.cpp b/game/mips2c/functions/sky_tng.cpp index 219ed3cc95..e3174d89ba 100644 --- a/game/mips2c/functions/sky_tng.cpp +++ b/game/mips2c/functions/sky_tng.cpp @@ -1110,3 +1110,452 @@ void link() { } // namespace set_sky_vf23_value } // namespace Mips2C + +namespace Mips2C { +namespace init_boundary_regs { +struct Cache { + void* math_camera; // *math-camera* + void* sky_tng_data; // *sky-tng-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + c->daddiu(sp, sp, -16); // daddiu sp, sp, -16 + c->sd(fp, 8, sp); // sd fp, 8(sp) + c->mov64(fp, t9); // or fp, t9, r0 + c->load_symbol(v1, cache.math_camera); // lw v1, *math-camera*(s7) + c->load_symbol(a0, cache.sky_tng_data); // lw a0, *sky-tng-data*(s7) + c->daddiu(a0, a0, 60); // daddiu a0, a0, 60 + c->lwc1(f0, 828, v1); // lwc1 f0, 828(v1) + c->swc1(f0, 0, a0); // swc1 f0, 0(a0) + c->lwc1(f0, 128, v1); // lwc1 f0, 128(v1) + c->swc1(f0, 4, a0); // swc1 f0, 4(a0) + c->lwc1(f0, 124, v1); // lwc1 f0, 124(v1) + c->swc1(f0, 8, a0); // swc1 f0, 8(a0) + c->fprs[f0] = 3071.0; // lwc1 f0, L532(fp) + c->swc1(f0, 12, a0); // swc1 f0, 12(a0) + c->lqc2(vf31, 572, v1); // lqc2 vf31, 572(v1) + c->lqc2(vf30, 588, v1); // lqc2 vf30, 588(v1) + c->lqc2(vf29, 604, v1); // lqc2 vf29, 604(v1) + c->lqc2(vf28, 620, v1); // lqc2 vf28, 620(v1) + c->lqc2(vf14, 700, v1); // lqc2 vf14, 700(v1) + c->lqc2(vf26, 716, v1); // lqc2 vf26, 716(v1) + c->lqc2(vf25, 732, v1); // lqc2 vf25, 732(v1) + c->load_symbol(v1, cache.sky_tng_data); // lw v1, *sky-tng-data*(s7) + c->lqc2(vf13, 60, v1); // lqc2 vf13, 60(v1) + c->vmul(DEST::xyzw, vf31, vf31, vf14); // vmul.xyzw vf31, vf31, vf14 + c->vmul(DEST::xyzw, vf30, vf30, vf14); // vmul.xyzw vf30, vf30, vf14 + c->vmul(DEST::xyzw, vf29, vf29, vf14); // vmul.xyzw vf29, vf29, vf14 + c->vmul(DEST::xyzw, vf28, vf28, vf14); // vmul.xyzw vf28, vf28, vf14 + c->vmove(DEST::xyzw, vf24, vf0); // vmove.xyzw vf24, vf0 + c->mov128_gpr_vf(v1, vf24); // qmfc2.i v1, vf24 + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(fp, 8, sp); // ld fp, 8(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 16); // daddiu sp, sp, 16 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + sky_regs_vfs.copy_vfs_from_other(c); + return c->gprs[v0].du64[0]; +} + +void link() { + cache.math_camera = intern_from_c("*math-camera*").c(); + cache.sky_tng_data = intern_from_c("*sky-tng-data*").c(); + gLinkedFunctionTable.reg("init-boundary-regs", execute, 32); +} + +} // namespace init_boundary_regs +} // namespace Mips2C + + +namespace Mips2C { +namespace draw_boundary_polygon { +struct Cache { + void* clip_polygon_against_negative_hyperplane; // clip-polygon-against-negative-hyperplane + void* clip_polygon_against_positive_hyperplane; // clip-polygon-against-positive-hyperplane +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + // nop // sll r0, r0, 0 + c->daddiu(sp, sp, -8); // daddiu sp, sp, -8 + // nop // sll r0, r0, 0 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->load_symbol(t9, cache.clip_polygon_against_positive_hyperplane);// lw t9, clip-polygon-against-positive-hyperplane(s7) + c->mov64(a2, t4); // or a2, t4, r0 + c->mov64(a3, t5); // or a3, t5, r0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->daddu(t2, a2, r0); // daddu t2, a2, r0 + //c->jalr(call_addr); // jalr ra, t9 + clip_polygon_against_positive_hyperplane::execute(ctxt); + bc = c->sgpr64(t0) == 0; // beq t0, r0, L480 + // nop // sll r0, r0, 0 + if (bc) {goto block_7;} // branch non-likely + + c->mov64(a2, t5); // or a2, t5, r0 + c->mov64(a3, t4); // or a3, t4, r0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->daddiu(t2, a2, 4); // daddiu t2, a2, 4 + //c->jalr(call_addr); // jalr ra, t9 + clip_polygon_against_positive_hyperplane::execute(ctxt); + bc = c->sgpr64(t0) == 0; // beq t0, r0, L480 + c->load_symbol(t9, cache.clip_polygon_against_negative_hyperplane);// lw t9, clip-polygon-against-negative-hyperplane(s7) + if (bc) {goto block_7;} // branch non-likely + + c->mov64(a2, t4); // or a2, t4, r0 + c->mov64(a3, t5); // or a3, t5, r0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->daddu(t2, a2, r0); // daddu t2, a2, r0 + //c->jalr(call_addr); // jalr ra, t9 + clip_polygon_against_negative_hyperplane::execute(ctxt); + bc = c->sgpr64(t0) == 0; // beq t0, r0, L480 + // nop // sll r0, r0, 0 + if (bc) {goto block_7;} // branch non-likely + + c->mov64(a2, t5); // or a2, t5, r0 + c->mov64(a3, t4); // or a3, t4, r0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->daddiu(t2, a2, 4); // daddiu t2, a2, 4 + //c->jalr(call_addr); // jalr ra, t9 + clip_polygon_against_negative_hyperplane::execute(ctxt); + bc = c->sgpr64(t0) == 0; // beq t0, r0, L480 + c->lw(a3, 4, a1); // lw a3, 4(a1) + if (bc) {goto block_7;} // branch non-likely + + c->mov64(a2, t4); // or a2, t4, r0 + // nop // sll r0, r0, 0 + c->sqc2(vf27, 0, a3); // sqc2 vf27, 0(a3) + c->daddiu(a3, a3, 16); // daddiu a3, a3, 16 + c->sw(t0, -16, a3); // sw t0, -16(a3) + // nop // sll r0, r0, 0 + + block_5: + c->lqc2(vf1, 0, a2); // lqc2 vf1, 0(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf2, 16, a2); // lqc2 vf2, 16(a2) + // nop // sll r0, r0, 0 + c->lqc2(vf3, 32, a2); // lqc2 vf3, 32(a2) + c->vdiv(vf0, BC::w, vf1, BC::w); // vdiv Q, vf0.w, vf1.w + c->vmul(DEST::xyzw, vf1, vf1, vf26); // vmul.xyzw vf1, vf1, vf26 + // nop // sll r0, r0, 0 + c->vftoi0(DEST::xyzw, vf3, vf3); // vftoi0.xyzw vf3, vf3 + // nop // sll r0, r0, 0 + c->vadd(DEST::xyzw, vf2, vf2, vf24); // vadd.xyzw vf2, vf2, vf24 + // nop // sll r0, r0, 0 + c->vwaitq(); // vwaitq + // nop // sll r0, r0, 0 + c->vmulq(DEST::xyz, vf1, vf1); // vmulq.xyz vf1, vf1, Q + c->sqc2(vf3, 16, a3); // sqc2 vf3, 16(a3) + c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q + c->daddiu(a2, a2, 48); // daddiu a2, a2, 48 + c->vadd(DEST::xyzw, vf1, vf1, vf25); // vadd.xyzw vf1, vf1, vf25 + c->daddiu(a3, a3, 48); // daddiu a3, a3, 48 + c->vmax_bc(DEST::z, BC::z, vf1, vf1, vf0); // vmaxz.z vf1, vf1, vf0 + // nop // sll r0, r0, 0 + c->vmini_bc(DEST::w, BC::z, vf1, vf1, vf13); // vminiz.w vf1, vf1, vf13 + // nop // sll r0, r0, 0 + c->vmax_bc(DEST::w, BC::y, vf1, vf1, vf13); // vmaxy.w vf1, vf1, vf13 + // nop // sll r0, r0, 0 + c->sqc2(vf2, -48, a3); // sqc2 vf2, -48(a3) + c->daddiu(t0, t0, -1); // daddiu t0, t0, -1 + c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t0) != 0; // bne t0, r0, L479 + c->sqc2(vf1, -16, a3); // sqc2 vf1, -16(a3) + if (bc) {goto block_5;} // branch non-likely + + c->sw(a3, 4, a1); // sw a3, 4(a1) + // nop // sll r0, r0, 0 + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->daddiu(v0, s7, 8); // daddiu v0, s7, 8 + //jr ra // jr ra + c->daddiu(sp, sp, 8); // daddiu sp, sp, 8 + goto end_of_function; // return + + + block_7: + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->mov64(v0, s7); // or v0, s7, r0 + //jr ra // jr ra + c->daddiu(sp, sp, 8); // daddiu sp, sp, 8 + goto end_of_function; // return + + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.clip_polygon_against_negative_hyperplane = intern_from_c("clip-polygon-against-negative-hyperplane").c(); + cache.clip_polygon_against_positive_hyperplane = intern_from_c("clip-polygon-against-positive-hyperplane").c(); + gLinkedFunctionTable.reg("draw-boundary-polygon", execute, 32); +} + +} // namespace draw_boundary_polygon +} // namespace Mips2C + + +namespace Mips2C { +namespace render_boundary_quad { +struct Cache { + void* math_camera; // *math-camera* + void* draw_boundary_polygon; // draw-boundary-polygon + void* fake_scratchpad_data; +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + c->copy_vfs_from_other(&sky_regs_vfs); + u32 call_addr = 0; + c->mov64(v1, a0); // or v1, a0, r0 + c->load_symbol(v1, cache.math_camera); // lw v1, *math-camera*(s7) + c->lqc2(vf14, 700, v1); // lqc2 vf14, 700(v1) + //c->lui(t4, 28672); // lui t4, 28672 + //c->ori(t4, t4, 12288); // ori t4, t4, 12288 + get_fake_spad_addr(t4, cache.fake_scratchpad_data, 12288, c); + //c->lui(t5, 28672); // lui t5, 28672 + //c->ori(t5, t5, 14336); // ori t5, t5, 14336 + get_fake_spad_addr(t5, cache.fake_scratchpad_data, 14336, c); + c->mov64(a3, t4); // or a3, t4, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf1, 0, a0); // lqc2 vf1, 0(a0) + c->addiu(t0, r0, 4); // addiu t0, r0, 4 + c->lqc2(vf2, 16, a0); // lqc2 vf2, 16(a0) + // nop // sll r0, r0, 0 + c->lqc2(vf3, 32, a0); // lqc2 vf3, 32(a0) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf1); // vmulax.xyzw acc, vf31, vf1 + c->lqc2(vf4, 48, a0); // lqc2 vf4, 48(a0) + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf1); // vmadday.xyzw acc, vf30, vf1 + c->lqc2(vf5, 64, a0); // lqc2 vf5, 64(a0) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf1); // vmaddaz.xyzw acc, vf29, vf1 + c->lqc2(vf6, 80, a0); // lqc2 vf6, 80(a0) + c->vmadd_bc(DEST::xyzw, BC::w, vf1, vf28, vf1); // vmaddw.xyzw vf1, vf28, vf1 + c->lqc2(vf7, 96, a0); // lqc2 vf7, 96(a0) + // nop // sll r0, r0, 0 + c->lqc2(vf8, 112, a0); // lqc2 vf8, 112(a0) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf4); // vmulax.xyzw acc, vf31, vf4 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf4); // vmadday.xyzw acc, vf30, vf4 + c->lqc2(vf10, 144, a0); // lqc2 vf10, 144(a0) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf4); // vmaddaz.xyzw acc, vf29, vf4 + c->lqc2(vf11, 160, a0); // lqc2 vf11, 160(a0) + c->vmadd_bc(DEST::xyzw, BC::w, vf4, vf28, vf4); // vmaddw.xyzw vf4, vf28, vf4 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->sqc2(vf2, 16, a3); // sqc2 vf2, 16(a3) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf7); // vmulax.xyzw acc, vf31, vf7 + c->sqc2(vf3, 32, a3); // sqc2 vf3, 32(a3) + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf7); // vmadday.xyzw acc, vf30, vf7 + c->sqc2(vf5, 64, a3); // sqc2 vf5, 64(a3) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf7); // vmaddaz.xyzw acc, vf29, vf7 + c->sqc2(vf3, 80, a3); // sqc2 vf3, 80(a3) + c->vmadd_bc(DEST::xyzw, BC::w, vf7, vf28, vf7); // vmaddw.xyzw vf7, vf28, vf7 + c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf3, 128, a3); // sqc2 vf3, 128(a3) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf10); // vmulax.xyzw acc, vf31, vf10 + c->sqc2(vf11, 160, a3); // sqc2 vf11, 160(a3) + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf10); // vmadday.xyzw acc, vf30, vf10 + c->sqc2(vf3, 176, a3); // sqc2 vf3, 176(a3) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf10); // vmaddaz.xyzw acc, vf29, vf10 + c->sqc2(vf2, 208, a3); // sqc2 vf2, 208(a3) + c->vmadd_bc(DEST::xyzw, BC::w, vf10, vf28, vf10); // vmaddw.xyzw vf10, vf28, vf10 + c->sqc2(vf3, 224, a3); // sqc2 vf3, 224(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 0, a3); // sqc2 vf1, 0(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 192, a3); // sqc2 vf1, 192(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 48, a3); // sqc2 vf4, 48(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf7, 96, a3); // sqc2 vf7, 96(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf10, 144, a3); // sqc2 vf10, 144(a3) + c->load_symbol(t9, cache.draw_boundary_polygon); // lw t9, draw-boundary-polygon(s7) + c->vsub(DEST::xyzw, vf4, vf4, vf1); // vsub.xyzw vf4, vf4, vf1 + // nop // sll r0, r0, 0 + c->vsub(DEST::xyzw, vf7, vf7, vf1); // vsub.xyzw vf7, vf7, vf1 + // nop // sll r0, r0, 0 + c->vopmula(vf4, vf7); // vopmula.xyz acc, vf4, vf7 + // nop // sll r0, r0, 0 + c->vopmsub(vf10, vf7, vf4); // vopmsub.xyz vf10, vf7, vf4 + // nop // sll r0, r0, 0 + c->vmul(DEST::xyzw, vf10, vf10, vf1); // vmul.xyzw vf10, vf10, vf1 + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::y, BC::x, vf10, vf10, vf10); // vaddx.y vf10, vf10, vf10 + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::y, BC::z, vf10, vf10, vf10); // vaddz.y vf10, vf10, vf10 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(v0, vf10); // qmfc2.i v0, vf10 + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(v0)) >= 0; // bgez v0, L477 + // nop // sll r0, r0, 0 + if (bc) {goto block_2;} // branch non-likely + + // Unknown instr: jr t9 + draw_boundary_polygon::execute(ctxt); + goto end_of_function; + // nop // sll r0, r0, 0 + + block_2: + c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 80, a3); // sqc2 vf6, 80(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 128, a3); // sqc2 vf6, 128(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 176, a3); // sqc2 vf6, 176(a3) + // nop // sll r0, r0, 0 + // Unknown instr: jr t9 + draw_boundary_polygon::execute(ctxt); + // nop // sll r0, r0, 0 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.math_camera = intern_from_c("*math-camera*").c(); + cache.draw_boundary_polygon = intern_from_c("draw-boundary-polygon").c(); + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("render-boundary-quad", execute, 32); +} + +} // namespace render_boundary_quad +} // namespace Mips2C + +namespace Mips2C { +namespace render_boundary_tri { +struct Cache { + void* draw_boundary_polygon; // draw-boundary-polygon + void* fake_scratchpad_data; +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->copy_vfs_from_other(&sky_regs_vfs); + c->mov64(v1, a0); // or v1, a0, r0 +// c->lui(t4, 28672); // lui t4, 28672 +// c->ori(t4, t4, 12288); // ori t4, t4, 12288 + get_fake_spad_addr(t4, cache.fake_scratchpad_data, 12288, c); +// c->lui(t5, 28672); // lui t5, 28672 +// c->ori(t5, t5, 14336); // ori t5, t5, 14336 + get_fake_spad_addr(t5, cache.fake_scratchpad_data, 14336, c); + c->mov64(a3, t4); // or a3, t4, r0 + // nop // sll r0, r0, 0 + c->lqc2(vf1, 0, a0); // lqc2 vf1, 0(a0) + c->addiu(t0, r0, 3); // addiu t0, r0, 3 + c->lqc2(vf2, 16, a0); // lqc2 vf2, 16(a0) + // nop // sll r0, r0, 0 + c->lqc2(vf3, 32, a0); // lqc2 vf3, 32(a0) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf1); // vmulax.xyzw acc, vf31, vf1 + c->lqc2(vf4, 48, a0); // lqc2 vf4, 48(a0) + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf1); // vmadday.xyzw acc, vf30, vf1 + c->lqc2(vf5, 64, a0); // lqc2 vf5, 64(a0) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf1); // vmaddaz.xyzw acc, vf29, vf1 + c->lqc2(vf6, 80, a0); // lqc2 vf6, 80(a0) + c->vmadd_bc(DEST::xyzw, BC::w, vf1, vf28, vf1); // vmaddw.xyzw vf1, vf28, vf1 + c->lqc2(vf7, 96, a0); // lqc2 vf7, 96(a0) + // nop // sll r0, r0, 0 + c->lqc2(vf8, 112, a0); // lqc2 vf8, 112(a0) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf4); // vmulax.xyzw acc, vf31, vf4 + // nop // sll r0, r0, 0 + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf4); // vmadday.xyzw acc, vf30, vf4 + c->sqc2(vf2, 16, a3); // sqc2 vf2, 16(a3) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf4); // vmaddaz.xyzw acc, vf29, vf4 + c->sqc2(vf3, 32, a3); // sqc2 vf3, 32(a3) + c->vmadd_bc(DEST::xyzw, BC::w, vf4, vf28, vf4); // vmaddw.xyzw vf4, vf28, vf4 + c->sqc2(vf5, 64, a3); // sqc2 vf5, 64(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf3, 80, a3); // sqc2 vf3, 80(a3) + c->vmula_bc(DEST::xyzw, BC::x, vf31, vf7); // vmulax.xyzw acc, vf31, vf7 + c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3) + c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf7); // vmadday.xyzw acc, vf30, vf7 + c->sqc2(vf3, 128, a3); // sqc2 vf3, 128(a3) + c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf7); // vmaddaz.xyzw acc, vf29, vf7 + c->sqc2(vf2, 160, a3); // sqc2 vf2, 160(a3) + c->vmadd_bc(DEST::xyzw, BC::w, vf7, vf28, vf7); // vmaddw.xyzw vf7, vf28, vf7 + c->sqc2(vf3, 176, a3); // sqc2 vf3, 176(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 0, a3); // sqc2 vf1, 0(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf1, 144, a3); // sqc2 vf1, 144(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf4, 48, a3); // sqc2 vf4, 48(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf7, 96, a3); // sqc2 vf7, 96(a3) + c->load_symbol(t9, cache.draw_boundary_polygon); // lw t9, draw-boundary-polygon(s7) + c->vsub(DEST::xyzw, vf4, vf4, vf1); // vsub.xyzw vf4, vf4, vf1 + // nop // sll r0, r0, 0 + c->vsub(DEST::xyzw, vf7, vf7, vf1); // vsub.xyzw vf7, vf7, vf1 + // nop // sll r0, r0, 0 + c->vopmula(vf4, vf7); // vopmula.xyz acc, vf4, vf7 + // nop // sll r0, r0, 0 + c->vopmsub(vf10, vf7, vf4); // vopmsub.xyz vf10, vf7, vf4 + // nop // sll r0, r0, 0 + c->vmul(DEST::xyzw, vf10, vf10, vf1); // vmul.xyzw vf10, vf10, vf1 + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::y, BC::x, vf10, vf10, vf10); // vaddx.y vf10, vf10, vf10 + // nop // sll r0, r0, 0 + c->vadd_bc(DEST::y, BC::z, vf10, vf10, vf10); // vaddz.y vf10, vf10, vf10 + // nop // sll r0, r0, 0 + c->mov128_gpr_vf(v0, vf10); // qmfc2.i v0, vf10 + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(v0)) >= 0; // bgez v0, L475 + // nop // sll r0, r0, 0 + if (bc) {goto block_2;} // branch non-likely + + // Unknown instr: jr t9 + draw_boundary_polygon::execute(ctxt); + goto end_of_function; + // nop // sll r0, r0, 0 + + block_2: + c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 80, a3); // sqc2 vf6, 80(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 128, a3); // sqc2 vf6, 128(a3) + // nop // sll r0, r0, 0 + c->sqc2(vf6, 176, a3); // sqc2 vf6, 176(a3) + // nop // sll r0, r0, 0 + // Unknown instr: jr t9 + draw_boundary_polygon::execute(ctxt); + // nop // sll r0, r0, 0 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.draw_boundary_polygon = intern_from_c("draw-boundary-polygon").c(); + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("render-boundary-tri", execute, 32); +} + +} // namespace render_boundary_tri +} // namespace Mips2C diff --git a/game/mips2c/mips2c_private.h b/game/mips2c/mips2c_private.h index 0080daef33..235e531216 100644 --- a/game/mips2c/mips2c_private.h +++ b/game/mips2c/mips2c_private.h @@ -701,6 +701,24 @@ struct ExecutionContext { void vwaitq() {} + void vopmula(int src0, int src1) { + auto s0 = vf_src(src0); + auto s1 = vf_src(src1); + + acc.f[0] = s0.f[1] * s1.f[2]; + acc.f[1] = s0.f[2] * s1.f[0]; + acc.f[2] = s0.f[0] * s1.f[1]; + } + + void vopmsub(int dst, int src0, int src1) { + auto s0 = vf_src(src0); // fs + auto s1 = vf_src(src1); // ft + + vfs[dst].f[0] = acc.f[0] - s0.f[1] * s1.f[2]; + vfs[dst].f[1] = acc.f[1] - s0.f[2] * s1.f[0]; + vfs[dst].f[2] = acc.f[2] - s0.f[0] * s1.f[1]; + } + std::string print_vf_float(int vf) { auto src = vf_src(vf); return fmt::format("{} {} {} {}", src.f[0], src.f[1], src.f[2], src.f[3]); diff --git a/game/mips2c/mips2c_table.cpp b/game/mips2c/mips2c_table.cpp index 9cd405ba7c..254a9acf27 100644 --- a/game/mips2c/mips2c_table.cpp +++ b/game/mips2c/mips2c_table.cpp @@ -72,6 +72,22 @@ namespace adgif_shader_texture_with_update { extern void link(); } +namespace init_boundary_regs { +extern void link(); +} + +namespace render_boundary_quad { +extern void link(); +} + +namespace render_boundary_tri { +extern void link(); +} + +namespace draw_boundary_polygon { +extern void link(); +} + LinkedFunctionTable gLinkedFunctionTable; Rng gRng; std::unordered_map> gMips2CLinkCallbacks = { @@ -83,7 +99,10 @@ std::unordered_map> gMips2CLinkCallbacks = {"sky-tng", {draw_large_polygon::link, init_sky_regs::link, clip_polygon_against_positive_hyperplane::link, render_sky_quad::link, render_sky_tri::link, set_tex_offset::link, set_sky_vf27::link, - set_sky_vf23_value::link}}}; + set_sky_vf23_value::link}}, + {"load-boundary", + {init_boundary_regs::link, render_boundary_quad::link, render_boundary_tri::link, + draw_boundary_polygon::link}}}; void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) { const auto& it = m_executes.insert({name, {exec, Ptr()}}); diff --git a/game/sce/sif_ee.cpp b/game/sce/sif_ee.cpp index dda891f3ab..b1df933e3e 100644 --- a/game/sce/sif_ee.cpp +++ b/game/sce/sif_ee.cpp @@ -98,19 +98,25 @@ s32 sceSifBindRpc(sceSifClientData* bd, u32 request, u32 mode) { } s32 sceOpen(const char* filename, s32 flag) { - auto name = file_util::get_file_path({filename}); FILE* fp = nullptr; switch (flag) { - case SCE_RDONLY: + case SCE_RDONLY: { + auto name = file_util::get_file_path({filename}); fp = fopen(name.c_str(), "r"); - break; - default: - assert(false); - } + if (!fp) { + printf("[SCE] sceOpen(%s) failed.\n", name.c_str()); + return -1; + } + } break; - if (!fp) { - printf("[SCE] sceOpen(%s) failed.\n", name.c_str()); - return -1; + default: { + auto name = file_util::get_file_path({"debug_out", filename}); + fp = fopen(name.c_str(), "w"); + if (!fp) { + printf("[SCE] sceOpen(%s) failed.\n", name.c_str()); + return -1; + } + } break; } s32 fp_idx = sce_fds.size() + 1; @@ -145,11 +151,13 @@ s32 sceRead(s32 fd, void* buf, s32 nbyte) { } s32 sceWrite(s32 fd, const void* buf, s32 nbyte) { - (void)fd; - (void)buf; - (void)nbyte; - assert(false); - return 0; + auto kv = sce_fds.find(fd); + if (kv == sce_fds.end()) { + assert(false); + return -1; + } else { + return fwrite(buf, 1, nbyte, kv->second); + } } s32 sceLseek(s32 fd, s32 offset, s32 where) { diff --git a/goal_src/dgos/fin.gd b/goal_src/dgos/fin.gd new file mode 100644 index 0000000000..c00a997012 --- /dev/null +++ b/goal_src/dgos/fin.gd @@ -0,0 +1,40 @@ + +("FIN.DGO" + ("robotboss-h.o" "robotboss-h") + ("robotboss-part.o" "robotboss-part") + ("sage-finalboss-part.o" "sage-finalboss-part") + ("light-eco.o" "light-eco") + ("robotboss-weapon.o" "robotboss-weapon") + ("robotboss-misc.o" "robotboss-misc") + ("green-eco-lurker.o" "green-eco-lurker") + ("robotboss.o" "robotboss") + ("final-door.o" "final-door") + ("sage-finalboss-FIN.o" "sage-finalboss") + ("tpage-1419.go" "tpage-1419") + ("tpage-1420.go" "tpage-1420") + ("tpage-634.go" "tpage-634") + ("tpage-1418.go" "tpage-1418") + ("tpage-545.go" "tpage-545") + ("darkecobomb-ag.go" "darkecobomb") + ("ecoclaw-ag.go" "ecoclaw") + ("ecovalve-ag-FIN.go" "ecovalve") + ("finalbosscam-ag.go" "finalbosscam") + ("green-eco-lurker-ag.go" "green-eco-lurker") + ("green-sagecage-ag.go" "green-sagecage") + ("greenshot-ag.go" "greenshot") + ("jak-white-ag.go" "jak-white") + ("light-eco-ag.go" "light-eco") + ("plat-eco-finalboss-ag.go" "plat-eco-finalboss") + ("power-left-ag.go" "power-left") + ("power-right-ag.go" "power-right") + ("powercellalt-ag.go" "powercellalt") + ("redring-ag.go" "redring") + ("robotboss-ag.go" "robotboss") + ("robotboss-blueeco-ag.go" "robotboss-blueeco") + ("robotboss-cinematic-ag.go" "robotboss-cinematic") + ("robotboss-redeco-ag.go" "robotboss-redeco") + ("robotboss-yelloweco-ag.go" "robotboss-yelloweco") + ("silodoor-ag.go" "silodoor") + ("water-anim-finalboss-ag.go" "water-anim-finalboss") + ("finalboss-vis.go" "finalboss-vis") + ) \ No newline at end of file diff --git a/goal_src/dgos/tra.gd b/goal_src/dgos/tra.gd new file mode 100644 index 0000000000..9fb8d47ece --- /dev/null +++ b/goal_src/dgos/tra.gd @@ -0,0 +1,21 @@ +("TRA.DGO" + ("training-obs.o" "training-obs") + ("training-part.o" "training-part") + ("tpage-1309.go" "tpage-1309") + ("tpage-1311.go" "tpage-1311") + ("tpage-1310.go" "tpage-1310") + ("tpage-1308.go" "tpage-1308") + ("tpage-775.go" "tpage-775") + ("ecovalve-ag-TRA.go" "ecovalve") + ("jng-iris-door-ag-TRA.go" "jng-iris-door") + ("plat-eco-ag-TRA.go" "plat-eco") + ("pontoonfive-ag-TRA.go" "pontoonfive") + ("scarecrow-a-ag.go" "scarecrow-a") + ("scarecrow-b-ag.go" "scarecrow-b") + ("sharkey-ag-BEA-TRA-VI2.go" "sharkey") + ("trainingcam-ag.go" "trainingcam") + ("warp-gate-switch-ag-TRA.go" "warp-gate-switch") + ("warpgate-ag.go" "warpgate") + ("water-anim-training-ag.go" "water-anim-training") + ("training-vis.go" "training-vis") + ) \ No newline at end of file diff --git a/goal_src/dgos/vi2.gd b/goal_src/dgos/vi2.gd new file mode 100644 index 0000000000..32c0e0aa4b --- /dev/null +++ b/goal_src/dgos/vi2.gd @@ -0,0 +1,54 @@ +("VI2.DGO" + ("villagep-obs.o" "villagep-obs") + ("oracle.o" "oracle") + ("village2-part.o" "village2-part") + ("village2-obs.o" "village2-obs") + ("village2-part2.o" "village2-part2") + ("gambler.o" "gambler") + ("warrior.o" "warrior") + ("geologist.o" "geologist") + ("swamp-blimp.o" "swamp-blimp") + ("sage-bluehut.o" "sage-bluehut") + ("flutflut-bluehut.o" "flutflut-bluehut") + ("assistant-village2.o" "assistant-village2") + ("sunken-elevator.o" "sunken-elevator") + ("tpage-919.go" "tpage-919") + ("tpage-922.go" "tpage-922") + ("tpage-920.go" "tpage-920") + ("tpage-921.go" "tpage-921") + ("tpage-1476.go" "tpage-1476") + ("allpontoons-ag.go" "allpontoons") + ("assistant-village2-ag.go" "assistant-village2") + ("barrel-ag-VI2.go" "barrel") + ("ceilingflag-ag.go" "ceilingflag") + ("exit-chamber-dummy-ag.go" "exit-chamber-dummy") + ("fireboulder-ag.go" "fireboulder") + ("flutflut-bluehut-ag.go" "flutflut-bluehut") + ("gambler-ag.go" "gambler") + ("geologist-ag.go" "geologist") + ("jaws-ag.go" "jaws") + ("medres-rolling-ag.go" "medres-rolling") + ("medres-rolling1-ag.go" "medres-rolling1") + ("medres-village2-ag.go" "medres-village2") + ("ogreboss-village2-ag.go" "ogreboss-village2") + ("oracle-ag-VI2.go" "oracle") + ("orb-cache-top-ag-VI2.go" "orb-cache-top") + ("pontoonfive-ag-VI2.go" "pontoonfive") + ("pontoonten-ag.go" "pontoonten") + ("precursor-arm-ag.go" "precursor-arm") + ("sage-bluehut-ag.go" "sage-bluehut") + ("sharkey-ag-BEA-TRA-VI2.go" "sharkey") + ("sunken-elevator-ag.go" "sunken-elevator") + ("swamp-blimp-ag.go" "swamp-blimp") + ("swamp-rope-ag.go" "swamp-rope") + ("swamp-tetherrock-ag.go" "swamp-tetherrock") + ("swamp-tetherrock-explode-ag.go" "swamp-tetherrock-explode") + ("swampcam-ag-VI2.go" "swampcam") + ("village-cam-ag-VI2.go" "village-cam") + ("village2cam-ag.go" "village2cam") + ("warp-gate-switch-ag-VI2.go" "warp-gate-switch") + ("warpgate-ag.go" "warpgate") + ("warrior-ag.go" "warrior") + ("water-anim-village2-ag.go" "water-anim-village2") + ("village2-vis.go" "village2-vis") + ) \ No newline at end of file diff --git a/goal_src/engine/ambient/mood.gc b/goal_src/engine/ambient/mood.gc index 04bdd748f7..fb01bc07f5 100644 --- a/goal_src/engine/ambient/mood.gc +++ b/goal_src/engine/ambient/mood.gc @@ -1149,73 +1149,75 @@ ) ) (when (not *lightning-frame-done*) - (let ((gp-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> gp-3 command) (sound-command set-param)) - (set! (-> gp-3 id) *thunder-id0*) - (let ((a1-23 (camera-pos))) - (let ((s5-3 pp)) - (when (= a1-23 #t) - (if - (and - s5-3 - (type-type? (-> s5-3 type) process-drawable) - (nonzero? (-> (the-as process-drawable s5-3) root)) - ) - (set! a1-23 (-> (the-as process-drawable s5-3) root trans)) - (set! a1-23 (the-as vector #f)) - ) - ) - ) - (sound-trans-convert (-> gp-3 parms trans) a1-23) - ) - (set! (-> gp-3 parms mask) (the-as uint 32)) - (-> gp-3 id) + (#when PC_DEBUG_SOUND_ENABLE + (let ((gp-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-3 command) (sound-command set-param)) + (set! (-> gp-3 id) *thunder-id0*) + (let ((a1-23 (camera-pos))) + (let ((s5-3 pp)) + (when (= a1-23 #t) + (if + (and + s5-3 + (type-type? (-> s5-3 type) process-drawable) + (nonzero? (-> (the-as process-drawable s5-3) root)) + ) + (set! a1-23 (-> (the-as process-drawable s5-3) root trans)) + (set! a1-23 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (-> gp-3 parms trans) a1-23) + ) + (set! (-> gp-3 parms mask) (the-as uint 32)) + (-> gp-3 id) + ) + (let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-4 command) (sound-command set-param)) + (set! (-> gp-4 id) *thunder-id1*) + (let ((a1-25 (camera-pos))) + (let ((s5-4 pp)) + (when (= a1-25 #t) + (if + (and + s5-4 + (type-type? (-> s5-4 type) process-drawable) + (nonzero? (-> (the-as process-drawable s5-4) root)) + ) + (set! a1-25 (-> (the-as process-drawable s5-4) root trans)) + (set! a1-25 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (-> gp-4 parms trans) a1-25) + ) + (set! (-> gp-4 parms mask) (the-as uint 32)) + (-> gp-4 id) + ) + (let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-5 command) (sound-command set-param)) + (set! (-> gp-5 id) *thunder-id2*) + (let ((a1-27 (camera-pos))) + (let ((s5-5 pp)) + (when (= a1-27 #t) + (if + (and + s5-5 + (type-type? (-> s5-5 type) process-drawable) + (nonzero? (-> (the-as process-drawable s5-5) root)) + ) + (set! a1-27 (-> (the-as process-drawable s5-5) root trans)) + (set! a1-27 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (-> gp-5 parms trans) a1-27) + ) + (set! (-> gp-5 parms mask) (the-as uint 32)) + (-> gp-5 id) + ) + ) ) - (let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> gp-4 command) (sound-command set-param)) - (set! (-> gp-4 id) *thunder-id1*) - (let ((a1-25 (camera-pos))) - (let ((s5-4 pp)) - (when (= a1-25 #t) - (if - (and - s5-4 - (type-type? (-> s5-4 type) process-drawable) - (nonzero? (-> (the-as process-drawable s5-4) root)) - ) - (set! a1-25 (-> (the-as process-drawable s5-4) root trans)) - (set! a1-25 (the-as vector #f)) - ) - ) - ) - (sound-trans-convert (-> gp-4 parms trans) a1-25) - ) - (set! (-> gp-4 parms mask) (the-as uint 32)) - (-> gp-4 id) - ) - (let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) - (set! (-> gp-5 command) (sound-command set-param)) - (set! (-> gp-5 id) *thunder-id2*) - (let ((a1-27 (camera-pos))) - (let ((s5-5 pp)) - (when (= a1-27 #t) - (if - (and - s5-5 - (type-type? (-> s5-5 type) process-drawable) - (nonzero? (-> (the-as process-drawable s5-5) root)) - ) - (set! a1-27 (-> (the-as process-drawable s5-5) root trans)) - (set! a1-27 (the-as vector #f)) - ) - ) - ) - (sound-trans-convert (-> gp-5 parms trans) a1-27) - ) - (set! (-> gp-5 parms mask) (the-as uint 32)) - (-> gp-5 id) - ) - ) (set! *lightning-frame-done* #t) (none) ) diff --git a/goal_src/engine/dma/dma-h.gc b/goal_src/engine/dma/dma-h.gc index 318fe46ca6..73c75d3f92 100644 --- a/goal_src/engine/dma/dma-h.gc +++ b/goal_src/engine/dma/dma-h.gc @@ -215,7 +215,7 @@ (bucket-1 1) (bucket-2 2) - (bucket-3 3) + (sky-draw 3) (tfrag-tex0 5) ;; merc0 10 ;; generic0 11 diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index af9c04507b..a9159a7e1b 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -75,3 +75,5 @@ (define-extern *hint-semaphore* (pointer level-hint)) + +(define-extern ambient-hint-spawn (function string vector process-tree symbol object)) diff --git a/goal_src/engine/draw/drawable.gc b/goal_src/engine/draw/drawable.gc index 3a0830425e..7bf6179a37 100644 --- a/goal_src/engine/draw/drawable.gc +++ b/goal_src/engine/draw/drawable.gc @@ -129,6 +129,22 @@ ;; sky ;; todo - disabled sky + (when (zero? (logand *vu1-enable-user* 8)) + (with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf)) (bucket-id sky-draw)) + (dma-buffer-add-gs-set dma-buf + (zbuf-1 (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24))) + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + (screen-gradient + dma-buf + (-> *display* bg-clear-color 0) + (-> *display* bg-clear-color 1) + (-> *display* bg-clear-color 2) + (-> *display* bg-clear-color 3) + ) + ) + ) (when (logtest? *vu1-enable-user* 8) (cond ((and (-> *time-of-day-context* sky) *sky-drawn*) @@ -163,7 +179,9 @@ (debug-draw-actors *level* *display-actor-marks*) ;; collide-shape-debug ) + (render-boundaries) ;; boundaries + ;; touching ;; method15 level ;; collide stats ) diff --git a/goal_src/engine/entity/entity-h.gc b/goal_src/engine/entity/entity-h.gc index 910ddb4f99..7728d82083 100644 --- a/goal_src/engine/entity/entity-h.gc +++ b/goal_src/engine/entity/entity-h.gc @@ -199,3 +199,5 @@ (define-extern *spawn-actors* symbol) ;; TODO - for cam-start (define-extern reset-cameras (function none)) +(define-extern process-by-ename (function string process)) +(define-extern entity-birth-no-kill (function entity none)) \ No newline at end of file diff --git a/goal_src/engine/game/game-info-h.gc b/goal_src/engine/game/game-info-h.gc index afa19a2022..4d2e76636c 100644 --- a/goal_src/engine/game/game-info-h.gc +++ b/goal_src/engine/game/game-info-h.gc @@ -69,7 +69,7 @@ (backup-load-state-and-set-cmds (_type_ pair) int 17) (restore-load-state-and-cleanup (_type_) int 18) (restore-load-state (_type_) int 19) - (dummy-20 () none 20) + (set-force-inside! (_type_ symbol symbol) none 20) ) ) diff --git a/goal_src/engine/game/game-save.gc b/goal_src/engine/game/game-save.gc index 83ad53490a..12c50a2cfe 100644 --- a/goal_src/engine/game/game-save.gc +++ b/goal_src/engine/game/game-save.gc @@ -1764,34 +1764,29 @@ ;; flash the icon. (when (< (mod (-> *display* real-frame-counter) 300) 270) - (when (> (-> self part matrix) 0) - (let ((gp-2 (sprite-get-user-hvdf (-> self part matrix)))) - (set! (-> gp-2 vector4w x) (the-as int 1842.0)) - (set! (-> gp-2 vector4w y) (the-as int - (the float (+ (the int (* 0.5 (- (* (if (= (get-aspect-ratio) 'aspect16x9) - 370.0 - 360.0 - ) - (-> *video-parms* relative-y-scale) - ) - (the float (-> *video-parms* screen-sy)) - ) - ) - ) - 2048 - ) - ) - ) - ) - (set! - (-> gp-2 vector4w z) - (the-as int (+ -1024.0 (-> *math-camera* hvdf-off z))) - ) - (set! (-> gp-2 vector4w w) (the-as int (-> *math-camera* hvdf-off w))) - ) + (if (> (-> self part matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> self part matrix)) + 1842.0 + (the float (+ (the int (* 0.5 (- (* (if (= (get-aspect-ratio) 'aspect16x9) + 370.0 + 360.0 + ) + (-> *video-parms* relative-y-scale) + ) + (the float (-> *video-parms* screen-sy)) + ) + ) + ) + 2048 + ) ) - (spawn (-> self part) *zero-vector*) + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) ) + (spawn (-> self part) *zero-vector*) + ) ) (none) ) diff --git a/goal_src/engine/game/generic-obs-h.gc b/goal_src/engine/game/generic-obs-h.gc index 3633265cb8..09f9f88d81 100644 --- a/goal_src/engine/game/generic-obs-h.gc +++ b/goal_src/engine/game/generic-obs-h.gc @@ -179,3 +179,6 @@ (die () _type_ :state 14) ) ) + +(declare-type sparticle-launch-group basic) +(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed \ No newline at end of file diff --git a/goal_src/engine/gfx/sky/sky-tng.gc b/goal_src/engine/gfx/sky/sky-tng.gc index 4de28a024b..2c3e0a3f75 100644 --- a/goal_src/engine/gfx/sky/sky-tng.gc +++ b/goal_src/engine/gfx/sky/sky-tng.gc @@ -1052,7 +1052,7 @@ ) (dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id bucket-3) + (bucket-id sky-draw) s5-0 (the-as (pointer dma-tag) a3-0) ) diff --git a/goal_src/engine/gfx/sprite/sprite.gc b/goal_src/engine/gfx/sprite/sprite.gc index 7fd2d8ff57..f2da46f85d 100644 --- a/goal_src/engine/gfx/sprite/sprite.gc +++ b/goal_src/engine/gfx/sprite/sprite.gc @@ -971,7 +971,7 @@ (defun sprite-get-user-hvdf ((arg0 int)) "Get an HVDF entry by index" - (-> *sprite-hvdf-data* data arg0) + (the-as vector (-> *sprite-hvdf-data* data arg0)) ) diff --git a/goal_src/engine/level/load-boundary-data.gc b/goal_src/engine/level/load-boundary-data.gc index af2f482894..b925e9fe5f 100644 --- a/goal_src/engine/level/load-boundary-data.gc +++ b/goal_src/engine/level/load-boundary-data.gc @@ -5,3 +5,4154 @@ ;; name in dgo: load-boundary-data ;; dgos: GAME, ENGINE +(set! (-> *lb-editor-parms* boundary) #f) +(define *load-boundary-list* (the-as load-boundary #f)) + +(define *static-load-boundary-list* + (the-as (array array) + (new 'static 'boxed-array + :type array :length 168 :allocated-length 168 + (new 'static 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new 'static 'boxed-array + :type float :length 6 :allocated-length 6 + 2404087.0 + 1792990.9 + 11801113.0 + -19782276.0 + 12074740.0 + -19333410.0 + ) + '((the binteger 6) "finalboss-fight" #f) + '((the binteger 6) "finalboss-start" #f) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 980265.2 + 890780.8 + 3118024.0 + -13706895.0 + 3079293.0 + -13672758.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "snow-outside-cave" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1050557.6 + 904951.44 + 3464265.8 + -13649148.0 + 3491810.2 + -13487760.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "snow-outside-fort" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1161083.5 + 1033513.1 + 3172378.2 + -14293381.0 + 3169853.0 + -14196348.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "snow-by-ice-lake" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 155912.27 + -524288.0 + -302473.8 + -358921.62 + -189703.34 + -88103.32 + -213883.9 + -45797.734 + -569183.0 + -33546.773 + ) + '( + (the binteger 3) beach display + ) + '( + (the binteger 3) beach display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 164302.47 + -304623.5 + 11519060.0 + -18551140.0 + 11449090.0 + -18346224.0 + 11380415.0 + -18514332.0 + ) + '( + (the binteger 6) "citadel-entrance" #f + ) + '( + (the binteger 6) "citadel-entrance" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 272053.7 + -655558.1 + 4808600.0 + -12651164.0 + 4530877.0 + -12508498.0 + ) + '( + (the binteger 6) "maincave-to-robocave" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 171371.14 + -524288.0 + -676129.1 + -6924696.0 + -680121.3 + -6757647.5 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 36361.89 + -36137.29 + 12126351.0 + -19001848.0 + 12122353.0 + -18877466.0 + ) + '( + (the binteger 6) "citadel-generator-start" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -198.1726 + -146531.1 + 11416193.0 + -19794980.0 + 11485550.0 + -19797886.0 + ) + '( + (the binteger 6) "citadel-plat-start" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 39044.12 + -141510.19 + 10894763.0 + -18893140.0 + 10898940.0 + -18972940.0 + ) + '( + (the binteger 6) "citadel-launch-start" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 376514.56 + -524288.0 + 418480.47 + -2126829.2 + 768319.25 + -2135490.8 + ) + '( + (the binteger 3) village1 #f + ) + '( + (the binteger 3) village1 display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 326689.0 + -524288.0 + 143748.83 + -3601507.8 + 179947.44 + -3912510.8 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) firecanyon village1 + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 524288.0 + 265248.94 + 10092448.0 + -16790240.0 + 10078353.0 + -16477023.0 + ) + '( + (the binteger 6) "lavatube-after-ribbon" #f + ) + '( + (the binteger 6) "lavatube-after-ribbon" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -257783.72 + 11326069.0 + -18525588.0 + 11278355.0 + -18072140.0 + ) + '( + (the binteger 6) "lavatube-end" #f + ) + '( + (the binteger 6) "lavatube-end" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 290551.75 + -524288.0 + 4047454.5 + -14186495.0 + 3804332.0 + -13805874.0 + ) + '( + (the binteger 6) "ogre-end" #f + ) + '( + (the binteger 6) "ogre-end" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 275555.12 + -524288.0 + 927462.1 + -7305133.0 + 763242.75 + -7308856.5 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -28209.512 + -524288.0 + 4869388.0 + -12242570.0 + 4850643.0 + -12138500.0 + 4982147.0 + -12130348.0 + 5004734.0 + -12257655.0 + ) + '( + (the binteger 3) maincave #f + ) + '( + (the binteger 3) maincave display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 28870.227 + -524288.0 + 4869388.0 + -12242570.0 + 4850643.0 + -12138500.0 + 4982147.0 + -12130348.0 + 5004734.0 + -12257655.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) mai #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -35278.418 + -524288.0 + 4869388.0 + -12242570.0 + 4850643.0 + -12138500.0 + 4982147.0 + -12130348.0 + 5004734.0 + -12257655.0 + ) + '( + (the binteger 4) rob #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + -6276.127 + -424794.84 + 10794323.0 + -19184136.0 + 11542925.0 + -19117040.0 + 11854880.0 + -18949898.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) citadel lavatube + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -424794.84 + 11251180.0 + -18687074.0 + 11606826.0 + -18673318.0 + ) + '( + (the binteger 3) lavatube #f + ) + '( + (the binteger 3) lavatube display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 275554.94 + 103589.16 + 769670.25 + -8183583.5 + 945858.75 + -8171829.5 + ) + '( + (the binteger 6) "ogre-race" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 145672.28 + -274960.53 + 9277345.0 + -14277290.0 + 9266303.0 + -13929350.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) village3 lavatube + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 361505.03 + 141642.4 + 5280860.0 + -14529410.0 + 5363850.0 + -14811145.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) lav #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 361505.03 + 141642.4 + 5145395.0 + -14585060.0 + 4969281.0 + -14637079.0 + ) + '( + (the binteger 3) lavatube #f + ) + '( + (the binteger 3) lavatube display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 329926.2 + 114555.875 + 4630288.0 + -14662835.0 + 4776346.0 + -14281154.0 + 5078574.5 + -14217605.0 + ) + '( + (the binteger 1) village3 lavatube + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 107354.85 + -647564.3 + -279364.62 + 131636.45 + -270673.44 + 160221.88 + ) + '( + (the binteger 3) beach #f + ) + '( + (the binteger 3) beach display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 404182.75 + -524288.0 + 4167032.0 + -13159265.0 + 4419089.0 + -12857725.0 + 4712033.0 + -13110535.0 + ) + '( + (the binteger 3) village3 display + ) + '( + (the binteger 3) village3 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 561218.0 + -22197.672 + 5192028.0 + -12126635.0 + 4954258.5 + -11802688.0 + ) + '( + (the binteger 4) rob #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 561218.0 + -15459.172 + 5076681.0 + -12251444.0 + 4974694.0 + -12024020.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) mai #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 297752.7 + -524288.0 + 53651.58 + -6363675.5 + 58039.688 + -6204528.0 + ) + '( + (the binteger 3) village2 special-vis + ) + '( + (the binteger 3) village2 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 296695.72 + -524288.0 + -590053.06 + -6197793.0 + 39494.13 + -6504359.5 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 334675.1 + 183791.47 + -655431.8 + -7037484.5 + -667642.5 + -6660005.5 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 380333.4 + -40101.156 + 1818615.8 + -1094335.5 + 1622619.2 + -978791.7 + ) + '( + (the binteger 3) village1 special-vis + ) + '( + (the binteger 3) village1 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 22 :allocated-length 22 + 401929.88 + -524288.0 + -363218.53 + -2089629.0 + -558766.7 + -1816698.6 + -769622.8 + -2043451.9 + -816882.1 + -2051455.1 + -950145.6 + -2013974.5 + -967790.6 + -1907695.0 + -1064691.2 + -1966847.9 + -1147540.0 + -1944348.2 + -1243268.9 + -2202510.2 + -1249669.5 + -2319393.8 + ) + '( + (the binteger 3) village1 display + ) + '( + (the binteger 3) village1 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 285200.53 + -524288.0 + 4042240.5 + -12645708.0 + 4297681.5 + -12507810.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) maincave darkcave + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 272053.7 + -655558.1 + 4806917.0 + -12655241.0 + 4529194.0 + -12512575.0 + ) + '( + (the binteger 1) maincave robocave + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 350009.84 + -524288.0 + 4421414.0 + -13636154.0 + 4589708.5 + -13556925.0 + ) + '( + (the binteger 3) maincave #f + ) + '( + (the binteger 3) maincave display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -1761940.5 + -1946392.4 + 2518956.8 + -7372510.5 + 2450104.8 + -7215005.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "sunkenb-helix" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 330190.47 + -524288.0 + 4536550.0 + -13960169.0 + 4678894.0 + -14351620.0 + 4428100.5 + -14425283.0 + 4353558.0 + -14051260.0 + ) + '( + (the binteger 1) village3 ogre + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 253886.0 + -524288.0 + 4168931.0 + -14104075.0 + 4117809.5 + -13471865.0 + ) + '( + (the binteger 4) vi3 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 290551.75 + -524288.0 + 4130630.2 + -14104385.0 + 3887507.8 + -13723764.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) ogr #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -632567.56 + -576346.5 + 2344408.2 + -7388373.0 + 2348460.5 + -7279539.0 + 2466947.8 + -7247920.5 + 2439049.2 + -7385641.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) sun #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -467010.03 + -701076.44 + 3209649.0 + -6960872.0 + 3057429.0 + -6862769.0 + ) + '( + (the binteger 6) "sunken1" #f + ) + '( + (the binteger 6) "sunken2" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -512925.12 + -681521.44 + 2371019.5 + -6795812.0 + 2389408.2 + -6532305.5 + ) + '( + (the binteger 3) village2 #f + ) + '( + (the binteger 3) village2 display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 110684.67 + -524288.0 + 1839143.8 + -7520194.5 + 1840360.8 + -7670893.0 + 1846512.6 + -7685321.0 + ) + '( + (the binteger 6) "swamp-start" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 95661.45 + -524288.0 + 2672740.5 + -8278830.0 + 2639106.8 + -8402343.0 + ) + '( + (the binteger 6) "swamp-game" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 112904.26 + -524288.0 + 1486306.8 + -8266304.5 + 1610530.4 + -8198038.0 + ) + '( + (the binteger 6) "swamp-cave1" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 164830.97 + -524288.0 + -419912.5 + 3042100.0 + -133547.3 + 3439924.0 + -102430.38 + 3661115.2 + 428069.8 + 3364700.5 + ) + '( + (the binteger 6) "misty-start" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 321007.44 + -524288.0 + -907311.4 + 3456990.5 + -757819.7 + 3679705.0 + -638801.4 + 3763613.2 + -573459.2 + 3651802.5 + -883808.56 + 3444019.2 + ) + '( + (the binteger 6) "misty-silo" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -91155.664 + -524288.0 + 2079358.8 + -6774793.5 + 2079358.8 + -6569993.5 + 2284159.5 + -6569993.5 + 2284159.5 + -6774793.5 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) vi2 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -176048.66 + -524288.0 + 2079358.8 + -6774793.5 + 2079358.8 + -6569993.5 + 2284159.5 + -6569993.5 + 2284159.5 + -6774793.5 + ) + '( + (the binteger 4) sun #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 263068.94 + -524288.0 + 1947299.0 + -7277401.0 + 1663485.5 + -7296843.5 + ) + '( + (the binteger 4) vi2 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 240937.31 + -524288.0 + 1655335.4 + -7355865.0 + 1914029.8 + -7344404.5 + ) + '( + (the binteger 4) swa #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 192776.28 + -524288.0 + 1720459.0 + -7252616.5 + 1888000.6 + -7230796.5 + ) + '( + (the binteger 3) swamp display + ) + '( + (the binteger 3) swamp #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 524288.0 + -524288.0 + 1543607.5 + -7296055.0 + 1536684.1 + -6977798.0 + 1589661.2 + -6897839.0 + 1929451.4 + -7131590.5 + ) + '( + (the binteger 1) village2 swamp + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 524288.0 + -524288.0 + 474877.1 + -6501738.5 + 641064.94 + -6682781.0 + 774879.44 + -6780504.5 + ) + '( + (the binteger 4) rol #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 524288.0 + -524288.0 + 836810.7 + -6707271.0 + 673225.56 + -6637296.5 + 468429.44 + -6424190.5 + ) + '( + (the binteger 4) vi2 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 388789.16 + -524288.0 + -137499.97 + -464508.47 + -239475.86 + -332696.8 + ) + '( + (the binteger 4) vi1 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 18 :allocated-length 18 + 152569.25 + -524288.0 + -177363.28 + -182574.97 + -107676.53 + -61124.004 + -172878.95 + 81598.42 + -327656.6 + 227590.64 + -406536.56 + 216199.72 + -485581.56 + 261065.92 + -515573.0 + 191171.4 + -1338912.4 + 229231.64 + ) + '( + (the binteger 3) beach #f + ) + '( + (the binteger 3) beach display-no-wait + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 272530.25 + -524288.0 + -249675.55 + -391214.2 + -130347.68 + -500937.6 + ) + '( + (the binteger 3) firecanyon display + ) + '( + (the binteger 3) firecanyon #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 18 :allocated-length 18 + -87713.6 + -524288.0 + 1090401.8 + -1274678.5 + 1058803.0 + -1235478.5 + 1060181.1 + -1193262.0 + 1117220.8 + -1154488.0 + 1164595.1 + -1185104.8 + 1176762.0 + -1210675.4 + 1173468.1 + -1244727.8 + 1125869.1 + -1275753.6 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) jun #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 301122.1 + -524288.0 + 1525182.5 + 2034822.6 + 842849.06 + -804235.94 + ) + '( + (the binteger 4) vi1 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 325169.56 + -524288.0 + 894672.4 + -779382.3 + 1767576.5 + 1188691.0 + ) + '( + (the binteger 4) jun #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 326953.3 + -524288.0 + 81844.7 + -727707.5 + 15797.286 + 118401.266 + 414386.16 + 120639.44 + 1232901.1 + 1021193.6 + ) + '( + (the binteger 1) village1 jungle + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 166814.4 + -524288.0 + 401796.53 + -610932.7 + 350019.12 + -489639.75 + 470693.25 + -460100.72 + ) + '( + (the binteger 3) jungle display-no-wait + ) + '( + (the binteger 3) jungle #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 18 :allocated-length 18 + 375701.16 + -524288.0 + 1453916.1 + -987016.2 + 1461937.5 + -967184.75 + 1482761.0 + -957298.8 + 1505932.0 + -966185.4 + 1514189.1 + -989654.4 + 1503102.1 + -1010133.7 + 1481864.2 + -1017569.2 + 1464112.8 + -1010652.75 + ) + '( + (the binteger 1) jungle jungleb + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 322236.66 + -524288.0 + -140670.9 + -353851.75 + 6646.948 + -375187.7 + -4327.104 + -433914.72 + ) + '( + (the binteger 1) village1 firecanyon + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 168425.08 + -524288.0 + -201897.2 + -213989.42 + -71567.484 + -81526.12 + -112773.18 + 78722.41 + -115380.56 + 447390.62 + -241892.22 + 711968.75 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) village1 beach + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 524288.0 + -524288.0 + 420024.44 + -4814527.0 + 420024.44 + -4609727.0 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 388393.3 + -524288.0 + -261189.34 + -3825337.5 + -50913.258 + -4000428.0 + ) + '( + (the binteger 1) village2 firecanyon + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 388789.16 + -524288.0 + -269444.6 + -496662.28 + -126883.84 + -507940.1 + ) + '( + (the binteger 4) fic #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 332899.12 + -524288.0 + -1124255.8 + -298838.28 + -351702.84 + -248529.5 + ) + '( + (the binteger 4) bea #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 332899.12 + -524288.0 + -1208873.8 + -81858.37 + -319884.62 + -196373.8 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) vi1 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 335013.2 + -524288.0 + 1300341.5 + -6072380.5 + 1543875.5 + -6043701.0 + ) + '( + (the binteger 4) vi2 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 370820.16 + -524288.0 + 1400421.9 + -5994967.5 + 1298001.9 + -5991312.0 + ) + '( + (the binteger 4) fic #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 14 :allocated-length 14 + 313079.75 + -524288.0 + 823858.3 + -7076852.5 + 1476263.1 + -6966768.0 + 1548741.4 + -6505285.5 + 1380369.1 + -6357914.0 + 1125477.6 + -6285041.0 + 1188517.2 + -6036264.5 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) village2 rolling + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 233141.69 + -524288.0 + 742218.2 + -6802828.0 + 1334365.1 + -6818752.0 + 1357111.0 + -6436508.0 + 1047644.1 + -6334948.5 + 643162.44 + -6208203.0 + ) + '( + (the binteger 3) rolling #f + ) + '( + (the binteger 3) rolling display-no-wait + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 431070.97 + -524288.0 + 974018.4 + -7117512.5 + 1070822.5 + -7081258.0 + 1526121.6 + -7123133.0 + 1541163.8 + -7418157.0 + ) + '( + (the binteger 1) village2 ogre + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 396387.06 + 57211.875 + 1213439.8 + -7288315.5 + 1227811.9 + -7079770.5 + 912550.5 + -7099027.5 + ) + '( + (the binteger 3) ogre #f + ) + '( + (the binteger 3) ogre display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 336796.9 + -524288.0 + 825355.2 + -7235151.5 + 920252.2 + -7300986.5 + ) + '( + (the binteger 4) ogr #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 292930.06 + -524288.0 + 998340.94 + -7272782.5 + 934710.06 + -7195729.5 + ) + '( + (the binteger 4) vi2 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 524288.0 + -168464.31 + 1927868.4 + -7085362.5 + 1605545.0 + -6870818.5 + 1615227.8 + -6471577.5 + 2177376.0 + -6131660.5 + ) + '( + (the binteger 1) village2 sunken + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 360646.25 + -187424.25 + 2042524.0 + -7300480.5 + 1824194.5 + -6847887.0 + 1852328.8 + -6568462.5 + 2270167.8 + -6228972.5 + ) + '( + (the binteger 3) sunken special + ) + '( + (the binteger 3) sunken #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 18 :allocated-length 18 + 126432.83 + -524288.0 + 1453916.1 + -987016.2 + 1461937.5 + -967184.75 + 1482761.0 + -957298.8 + 1505932.0 + -966185.4 + 1514189.1 + -989654.4 + 1503102.1 + -1010133.7 + 1481864.2 + -1017569.2 + 1464112.8 + -1010652.75 + ) + '( + (the binteger 3) jungleb display + ) + '( + (the binteger 3) jungleb #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 18 :allocated-length 18 + 74968.55 + -616976.44 + 1453916.1 + -987016.2 + 1461937.5 + -967184.75 + 1482761.0 + -957298.8 + 1505932.0 + -966185.4 + 1514189.1 + -989654.4 + 1503102.1 + -1010133.7 + 1481864.2 + -1017569.2 + 1464112.8 + -1010652.75 + ) + '( + (the binteger 4) jub #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 137771.25 + -524288.0 + 404573.2 + 4098422.0 + 236215.77 + 4114074.5 + ) + '( + (the binteger 6) "misty-bike" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 145077.7 + -524288.0 + -376094.4 + 4543663.0 + -376094.4 + 4748463.0 + ) + '( + (the binteger 6) "misty-backside" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 255537.56 + -524288.0 + -1005929.1 + 4193984.0 + -872937.2 + 4300299.0 + -756972.8 + 4208626.0 + -1025873.2 + 4087144.5 + ) + '( + (the binteger 6) "misty-silo2" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 99096.8 + -524288.0 + 1975605.4 + -8630552.0 + 1975421.4 + -8528661.0 + ) + '( + (the binteger 6) "swamp-cave2" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 141113.8 + -524288.0 + 1980493.5 + -7897138.0 + 2047652.4 + -7873304.0 + 2060152.6 + -7931657.5 + 1993817.2 + -7976457.0 + ) + '( + (the binteger 6) "swamp-cave3" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 262804.7 + -524288.0 + 2140291.2 + -6096639.0 + 1590722.8 + -6463647.0 + 1413458.0 + -6340959.0 + 1149150.8 + -6278411.0 + 1219588.5 + -6039556.5 + ) + '( + (the binteger 1) firecanyon village2 + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 206253.42 + -524288.0 + 1430296.9 + -5984384.0 + 1438999.2 + -6119296.0 + 1420048.6 + -6125594.0 + ) + '( + (the binteger 3) firecanyon display + ) + '( + (the binteger 3) firecanyon #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -432061.9 + -714884.06 + 2715718.5 + -7342267.0 + 2815001.5 + -7150704.5 + ) + '( + (the binteger 3) sunkenb display + ) + '( + (the binteger 3) sunkenb #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -899402.06 + -1098784.5 + 2282077.5 + -6677879.5 + 2080828.8 + -6613302.0 + ) + '( + (the binteger 4) sun #f + ) + '( + (the binteger 4) sub #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -451749.12 + -610039.7 + 3063970.5 + -6604280.5 + 3000425.2 + -6456572.0 + ) + '( + (the binteger 6) "sunken1" #f + ) + '( + (the binteger 6) "sunken-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -626555.75 + -524288.0 + 2344408.2 + -7388373.0 + 2348460.5 + -7279539.0 + 2466947.8 + -7247920.5 + 2439049.2 + -7385641.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "sunken2" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 198788.14 + -524288.0 + 2287878.0 + -13944549.0 + 2434369.8 + -13646915.0 + ) + '( + (the binteger 3) village3 display + ) + '( + (the binteger 3) village3 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 355162.84 + -524288.0 + 4346461.0 + -14010600.0 + 4474615.5 + -13949533.0 + ) + '( + (the binteger 3) ogre #f + ) + '( + (the binteger 3) ogre display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 331577.72 + -524288.0 + 4510445.5 + -13872985.0 + 4620850.5 + -14134173.0 + 4822450.0 + -13951485.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) village3 maincave + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 333031.2 + -77890.09 + 4321252.0 + -13451169.0 + 4538566.5 + -13427408.0 + ) + '( + (the binteger 4) vi3 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 289560.78 + -524288.0 + 4160078.2 + -13363984.0 + 4657438.0 + -13195000.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) mai #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 561218.0 + -20347.875 + 5015965.5 + -12265124.0 + 4969636.0 + -12062795.0 + ) + '( + (the binteger 3) robocave display + ) + '( + (the binteger 3) robocave #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 319289.8 + 97180.91 + 4060842.2 + -12186625.0 + 3956508.8 + -12221835.0 + ) + '( + (the binteger 3) darkcave display + ) + '( + (the binteger 3) darkcave #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 390797.47 + -106231.74 + 1625981.8 + -982050.1 + 1826157.5 + -984055.0 + 1963614.9 + -752705.06 + ) + '( + (the binteger 3) village1 special-vis + ) + '( + (the binteger 3) village1 display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 442784.28 + -39440.535 + 1899973.9 + -1546112.1 + 1741479.5 + -1291697.1 + 1490514.9 + -1133170.4 + ) + '( + (the binteger 3) village1 #f + ) + '( + (the binteger 3) village1 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 449040.3 + -98105.81 + 1507840.9 + -1133057.6 + 1611146.1 + -1038699.56 + ) + '( + (the binteger 3) village1 #f + ) + '( + (the binteger 3) village1 display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 291779.53 + 185641.23 + -556363.7 + -6215175.0 + -677982.3 + -6112309.0 + -462479.25 + -5758803.0 + ) + '( + (the binteger 3) village2 special-vis + ) + '( + (the binteger 3) village2 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 324244.66 + -524288.0 + -385887.97 + -7048725.0 + -652583.3 + -7045665.0 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 330785.0 + -783128.7 + 4214055.0 + -14490533.0 + 4245485.0 + -14027390.0 + 4509959.5 + -14260475.0 + 4466017.5 + -14619070.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) village3 snow + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 897222.0 + -455448.7 + 4214055.0 + -14490533.0 + 4286877.5 + -13964385.0 + 4509959.5 + -14260475.0 + 4466017.5 + -14619070.0 + ) + '( + (the binteger 3) snow #f + ) + '( + (the binteger 3) snow display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 401275.84 + -524288.0 + 3809930.2 + -13126660.0 + 4387680.5 + -12726350.0 + 4965741.5 + -12733760.0 + ) + '( + (the binteger 1) village3 maincave + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 319289.8 + 97180.91 + 4037056.5 + -12145660.0 + 3932723.0 + -12180870.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) mai #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 319289.8 + 97180.91 + 3967407.0 + -12047450.0 + 3919676.8 + -12152098.0 + ) + '( + (the binteger 4) dar #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 415367.12 + -20612.129 + 1473631.5 + -1157821.2 + 1414393.4 + -1193464.1 + 1354583.2 + -1238710.8 + 1291658.0 + -1325844.0 + 1151230.6 + -1642343.9 + ) + '( + (the binteger 3) village1 display + ) + '( + (the binteger 3) village1 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 194295.77 + -524288.0 + 1993232.0 + -7776360.5 + 1646617.0 + -7919841.0 + 1546310.5 + -7956902.0 + 1497602.9 + -8055146.5 + 1350810.2 + -7725342.0 + ) + '( + (the binteger 3) village2 display + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1275705.8 + 885660.7 + 4210123.5 + -14454620.0 + 4252965.5 + -14048015.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) sno #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 361505.03 + 141642.4 + 5145395.0 + -14585060.0 + 4969281.0 + -14637079.0 + ) + '( + (the binteger 3) lavatube #f + ) + '( + (the binteger 3) lavatube display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 361505.03 + 141642.4 + 5192246.0 + -14612985.0 + 4946641.5 + -14744985.0 + ) + '( + (the binteger 4) vi3 #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 361505.03 + 141642.4 + 5280860.0 + -14529410.0 + 5363850.0 + -14811145.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) lav #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 320479.0 + -64214.67 + 6465568.5 + -14156115.0 + 6450754.5 + -13712894.0 + ) + '( + (the binteger 3) village3 #f + ) + '( + (the binteger 3) village3 display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 389780.5 + 201622.14 + 4218813.0 + -14413355.0 + 4331064.0 + -14524060.0 + ) + '( + (the binteger 1) village3 maincave + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1170068.4 + 988919.7 + 2574083.2 + -13973545.0 + 2427817.5 + -13884534.0 + ) + '( + (the binteger 6) "snow-across-from-flut" #f + ) + '( + (the binteger 6) "snow-flut-flut" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 3) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 810280.2 + -196608.0 + 3324084.2 + -13758485.0 + 3324084.2 + -13553685.0 + 3528884.2 + -13553685.0 + 3528884.2 + -13758485.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "snow-outside-fort" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 303302.1 + -28407.746 + 1482670.0 + -13217540.0 + 1703776.4 + -13157055.0 + ) + '( + (the binteger 1) ogre village3 + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -194295.75 + 11067174.0 + -18596720.0 + 11019460.0 + -18143272.0 + ) + '( + (the binteger 3) citadel display + ) + '( + (the binteger 3) citadel #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -194295.75 + 11220495.0 + -18577436.0 + 11172783.0 + -18123988.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) lav #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -424794.84 + 11261218.0 + -18621614.0 + 11616860.0 + -18607858.0 + ) + '( + (the binteger 4) cit #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 532744.06 + 222822.31 + 10045198.0 + -16826564.0 + 10052340.0 + -16500909.0 + ) + '( + (the binteger 1) lavatube citadel + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 30786.04 + -568353.0 + 10853810.0 + -19982956.0 + 10857980.0 + -18851744.0 + 11800185.0 + -18657540.0 + 12119948.0 + -19841458.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) citadel finalboss + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + -37128.273 + -568353.0 + 10635460.0 + -19261390.0 + 10641390.0 + -18641098.0 + 11673320.0 + -18631850.0 + 11992955.0 + -19068516.0 + ) + '( + (the binteger 1) citadel lavatube + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 739722.7 + -524288.0 + 11253410.0 + -19459740.0 + 11298895.0 + -19163528.0 + 11606400.0 + -19156774.0 + 11646273.0 + -19462514.0 + ) + '( + (the binteger 4) cit #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 1552977.4 + -524288.0 + 11253410.0 + -19459740.0 + 11298895.0 + -19163528.0 + 11606400.0 + -19156774.0 + 11646273.0 + -19462514.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 4) fin #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -432061.9 + -714884.06 + 2624020.8 + -7238923.5 + 2730103.5 + -7108117.5 + ) + '( + (the binteger 6) "sunken-tube1" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 237131.75 + 116405.63 + 4134430.0 + -12531289.0 + 4249137.0 + -12480849.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "maincave-to-darkcave" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 108378.74 + -18630.201 + 1381972.9 + -8272129.5 + 1309181.4 + -8143856.5 + ) + '( + (the binteger 6) "swamp-dock1" #f + ) + '( + (the binteger 6) "swamp-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 164632.73 + -17573.172 + 1651940.5 + -8481208.0 + 1575238.2 + -8380055.5 + ) + '( + (the binteger 6) "swamp-dock2" #f + ) + '( + (the binteger 6) "swamp-cave1" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 321734.22 + 33164.38 + 1472616.8 + -5741056.5 + 1161522.8 + -5738810.0 + ) + '( + (the binteger 6) "firecanyon-end" #f + ) + '( + (the binteger 6) "firecanyon-end" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 339769.8 + -46839.75 + -211696.3 + -784710.75 + 49935.15 + -742140.3 + ) + '( + (the binteger 6) "firecanyon-start" #f + ) + '( + (the binteger 6) "firecanyon-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 482151.97 + 69896.25 + 869008.6 + -8462477.0 + 644078.75 + -8259235.5 + ) + '( + (the binteger 6) "ogre-race" #f + ) + '( + (the binteger 6) "ogre-race" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 322923.34 + 4096.0 + 5678575.5 + -14614474.0 + 5457999.0 + -14391688.0 + ) + '( + (the binteger 6) "lavatube-start" #f + ) + '( + (the binteger 6) "lavatube-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 178704.39 + -135168.0 + 8996384.0 + -14239175.0 + 9096633.0 + -13873403.0 + ) + '( + (the binteger 6) "lavatube-middle" #f + ) + '( + (the binteger 6) "lavatube-middle" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 247477.67 + -148711.25 + 5555559.5 + -11770044.0 + 5324678.0 + -11402115.0 + ) + '( + (the binteger 6) "robocave-bottom" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + -451749.12 + -610039.7 + 3050601.8 + -6609894.0 + 2987056.5 + -6462185.5 + ) + '( + (the binteger 1) sunken sunkenb + ) + '( + (the binteger 1) sunken village2 + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 66328.8 + -101805.46 + 11021305.0 + -19546492.0 + 10991630.0 + -19494320.0 + ) + '( + (the binteger 6) "citadel-launch-end" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 87535.54 + -29596.91 + 11275635.0 + -19680194.0 + 11230883.0 + -19653924.0 + ) + '( + (the binteger 6) "citadel-plat-end" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 60515.062 + -64214.72 + 11902198.0 + -19492924.0 + 11856455.0 + -19580640.0 + ) + '( + (the binteger 6) "citadel-generator-end" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1064497.0 + 893654.6 + 3369717.2 + -13470538.0 + 3489005.0 + -13470209.0 + ) + '( + (the binteger 6) "snow-outside-fort" #f + ) + '( + (the binteger 6) "snow-fort" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 276440.2 + -524288.0 + -1054117.4 + -7015874.0 + -1180891.2 + -6733353.5 + -911788.4 + -6482925.0 + ) + '( + (the binteger 3) village2 special-vis + ) + '( + (the binteger 3) village2 #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 263663.44 + 1585.5251 + -677970.94 + -6693857.0 + -802274.3 + -6692809.0 + ) + '( + (the binteger 3) village2 #f + ) + '( + (the binteger 3) village2 special-vis + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 363883.3 + -524288.0 + 710516.0 + -605717.3 + 777812.4 + -117024.52 + ) + '( + (the binteger 3) jungle display + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 524288.0 + -524288.0 + 719872.1 + -6597869.0 + 1159159.1 + -6425164.5 + 1041836.25 + -6827792.0 + ) + '( + (the binteger 3) rolling display + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 524288.0 + -524288.0 + 568817.3 + -9466220.0 + 1127492.5 + -9043683.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 1) ogre village2 + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 12 :allocated-length 12 + 408146.53 + -227129.81 + 5624547.0 + -11755375.0 + 5604783.5 + -11539414.0 + 5326020.0 + -11550233.0 + 5180106.5 + -11499346.0 + 5148654.0 + -11322573.0 + ) + '( + (the binteger 3) maincave special + ) + '( + (the binteger 3) maincave display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 294119.2 + 213916.9 + 11495250.0 + -19186980.0 + 11398090.0 + -19190674.0 + ) + '( + (the binteger 3) finalboss #f + ) + '( + (the binteger 3) finalboss display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 1470264.6 + -524288.0 + 11253410.0 + -19459740.0 + 11298895.0 + -19163528.0 + 11606400.0 + -19156774.0 + 11646273.0 + -19462514.0 + ) + '( + (the binteger 3) citadel display + ) + '( + (the binteger 3) citadel special + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 104778.336 + -424794.84 + 11249043.0 + -18841486.0 + 11604685.0 + -18827730.0 + ) + '( + (the binteger 6) "citadel-start" #f + ) + '( + (the binteger 6) "citadel-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 1094292.4 + 858838.25 + 3677046.8 + -13838594.0 + 3773559.8 + -13867715.0 + 3837479.8 + -13675041.0 + 3663758.2 + -13804749.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "snow-pass-to-fort" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1220937.6 + 1035428.9 + 2930553.2 + -14107145.0 + 3128871.8 + -14038774.0 + ) + '( + (the binteger 6) "snow-by-ice-lake-alt" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 1051944.6 + 888765.56 + 3366128.0 + -13638805.0 + 3362401.8 + -13489235.0 + ) + '( + (the binteger 6) "snow-outside-fort" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 524288.0 + -524288.0 + 1123579.9 + -6421303.0 + 1006257.0 + -6823930.5 + ) + '( + (the binteger 6) "village2-start" #f + ) + '( + (the binteger 6) "village2-dock" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 1) + (new + 'static + 'boxed-array + :type float :length 10 :allocated-length 10 + 742498.56 + -727105.9 + 4214055.0 + -14490533.0 + 4286877.5 + -13964385.0 + 4509959.5 + -14260475.0 + 4466017.5 + -14619070.0 + ) + '( + (the binteger 4) vi3 #f + ) + '( + (the binteger 3) snow display + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 318034.56 + 119907.06 + 4952800.5 + -14636175.0 + 5113453.5 + -14560723.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "village3-farside" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 383504.6 + 120699.85 + 4445610.0 + -14468618.0 + 4343087.0 + -14334280.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "village3-farside" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 302707.6 + 144615.2 + 4420238.5 + -13645623.0 + 4595041.0 + -13553850.0 + ) + '( + (the binteger 6) "village3-farside" #f + ) + '( + 0 #f #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + (the binteger 2) + (new + 'static + 'boxed-array + :type float :length 6 :allocated-length 6 + 335938.0 + 140849.53 + 4397294.5 + -14125599.0 + 4545135.5 + -14064108.0 + ) + '( + 0 #f #f + ) + '( + (the binteger 6) "village3-start" #f + ) + ) + (new + 'static + 'boxed-array + :type object :length 4 :allocated-length 4 + 0 + (new + 'static + 'boxed-array + :type float :length 8 :allocated-length 8 + 404182.75 + -524288.0 + 4161991.8 + -13086341.0 + 4414040.5 + -12784800.0 + 4706984.5 + -13037610.0 + ) + '( + (the binteger 6) "maincave-start" #f + ) + '( + 0 #f #f + ) + ) + ) + ) + ) + +(let* ((gp-0 (-> *static-load-boundary-list* length)) + (s5-0 0) + (a0-1 (-> *static-load-boundary-list* s5-0)) + ) + (while (< s5-0 gp-0) + (load-boundary-from-template (the-as (array object) a0-1)) + (+! s5-0 1) + (set! a0-1 (-> *static-load-boundary-list* s5-0)) + ) + ) + + diff --git a/goal_src/engine/level/load-boundary-h.gc b/goal_src/engine/level/load-boundary-h.gc index 732a4c6e41..624f8e6439 100644 --- a/goal_src/engine/level/load-boundary-h.gc +++ b/goal_src/engine/level/load-boundary-h.gc @@ -5,5 +5,133 @@ ;; name in dgo: load-boundary-h ;; dgos: GAME, ENGINE +;; Load Boundary +;; This system is responsible for more than just the load boundaries - it also processes the commands +;; from cutscenes to kill/birth certain objects. + +;; It also manages the "load state", which manages what levels are loading. +;; Crossing load boundaries will change this state. +;; Cutscene playback can also change this state. + +;; the vertex type used for load boundaries +(deftype lbvtx (structure) + ((x float :offset-assert 0) + (y float :offset-assert 4) + (z float :offset-assert 8) + (v0 uint8 :offset-assert 12) + (v1 uint8 :offset-assert 13) + (v2 uint8 :offset-assert 14) + (ix uint8 :offset-assert 15) + (quad uint128 :offset 0) + (v vector :inline :offset 0) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; the types of commands in load boundaries +(defenum load-boundary-cmd + :type uint8 + (invalid 0) ;; default value + (load 1) ;; load a level! + (cmd2 2) ;; unused? + (display 3) ;; display a level + (vis 4) ;; load the vis data for a level (?) + (force-vis 5) ;; force load the vis data (?) + (checkpt 6) ;; assign a checkpoint. + ) + +;; command to execute when crossing. +;; there are 3 1-byte paramaters and 2 4-byte parameters. +(deftype load-boundary-crossing-command (structure) + ((cmd load-boundary-cmd :offset-assert 0) + (bparm uint8 3 :offset-assert 1) + (parm uint32 2 :offset-assert 4) + (lev0 basic :offset 4) + (lev1 basic :offset 8) + (displev basic :offset 4) + (dispcmd basic :offset 8) + (nick basic :offset 4) + (forcelev basic :offset 4) + (forceonoff basic :offset 8) + (checkname basic :offset 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +(defenum load-boundary-flags + :type uint8 + :bitfield #t + (closed 0) ;; if set, the boundary is a closed area + (player 1) ;; if set activate on player cross instead of camera + ) + +;; actual boundary +;; vertices come after this in memory +(deftype load-boundary (basic) + ((num-points uint16 :offset-assert 4) + (flags load-boundary-flags :offset-assert 6) + (top-plane float :offset-assert 8) + (bot-plane float :offset-assert 12) + (tri-cnt int32 :offset-assert 16) + (next load-boundary :offset-assert 20) + (cmd-fwd load-boundary-crossing-command :inline :offset-assert 24) + (cmd-bwd load-boundary-crossing-command :inline :offset-assert 36) + (rejector vector :inline :offset-assert 48) + (data lbvtx 1 :inline :offset-assert 64) + (data2 lbvtx :inline :dynamic :offset 64) + ) + :method-count-assert 9 + :size-assert #x50 + :flag-assert #x900000050 + (:methods + (new (symbol type int symbol symbol) _type_ 0) + ) + ) + +;; linked list of all boundaries (gets set up in load-boundary-data) +(define *load-boundary-list* (the-as load-boundary #f)) + +;; current tri/quad +(define *load-boundary-target* (the-as (inline-array lbvtx) (malloc 'global 64))) + +(defmethod new load-boundary ((allocation symbol) (type-to-make type) (arg0 int) (arg1 symbol) (arg2 symbol)) + "Construct a new load-boundary with room for arg0 vertices. arg1 is closed, arg2 is to add to main list." + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* (+ arg0 -1) 16)))))) + (set! (-> v0-0 num-points) (the-as uint arg0)) + (cond + (arg1 + (set! (-> v0-0 flags) (load-boundary-flags closed)) + ) + (else + (set! (-> v0-0 flags) (load-boundary-flags)) + 0 + ) + ) + (set! (-> v0-0 top-plane) 524288.0) + (set! (-> v0-0 bot-plane) -524288.0) + (dotimes (v1-4 arg0) + (set! (-> v0-0 data v1-4 quad) (the-as uint128 0)) + (set! (-> v0-0 data v1-4 ix) (the-as uint v1-4)) + ) + (set! (-> v0-0 tri-cnt) 0) + (set-vector! (-> v0-0 rejector) 0.0 0.0 0.0 268435460.0) + (set! (-> v0-0 cmd-fwd cmd) (load-boundary-cmd invalid)) + (set! (-> v0-0 cmd-bwd cmd) (load-boundary-cmd invalid)) + (when arg2 + (set! (-> v0-0 next) *load-boundary-list*) + (set! *load-boundary-list* v0-0) + ) + (if (not arg2) + (set! (-> v0-0 next) #f) + ) + v0-0 + ) + ) + (define-extern *load-state* load-state) diff --git a/goal_src/engine/level/load-boundary.gc b/goal_src/engine/level/load-boundary.gc index d9442e57e7..5db216d0d0 100644 --- a/goal_src/engine/level/load-boundary.gc +++ b/goal_src/engine/level/load-boundary.gc @@ -5,6 +5,1631 @@ ;; name in dgo: load-boundary ;; dgos: GAME, ENGINE +;; the editor state +(deftype lb-editor-parms (basic) + ((boundary load-boundary :offset-assert 4) + (vertex int32 :offset-assert 8) + (x-origin float :offset-assert 12) + (z-origin float :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x14 + :flag-assert #x900000014 + ) + +(define *lb-editor-parms* (new 'global 'lb-editor-parms)) +(set! (-> *lb-editor-parms* boundary) #f) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Editor Rendering +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-extern draw-boundary-cap (function load-boundary float dma-buffer symbol none)) +(define-extern draw-boundary-side (function load-boundary integer integer dma-buffer symbol none)) +(define-extern triangulate-boundary (function load-boundary object)) +(define-extern find-bounding-circle (function load-boundary none)) +(define-extern check-boundary (function load-boundary none)) +(define-extern split-monotone-polygon (function load-boundary int none)) +(define-extern fix-boundary-normals (function load-boundary none)) + +;; The editor uses the same system as sky for drawing large polygons. + +;; using mips2c so we get the regs in C++. +(def-mips2c init-boundary-regs (function none)) +#| +(defun-debug init-boundary-regs () + (local-vars (v1-2 float)) + (rlet ((vf0 :class vf) + (vf13 :class vf) + (vf14 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf28 :class vf) + (vf29 :class vf) + (vf30 :class vf) + (vf31 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 *math-camera*)) + (set-vector! + (-> *sky-tng-data* fog) + (-> v1-0 pfog0) + (-> v1-0 fog-min) + (-> v1-0 fog-max) + 3071.0 + ) + (.lvf vf31 (&-> v1-0 camera-temp vector 0 quad)) + (.lvf vf30 (&-> v1-0 camera-temp vector 1 quad)) + (.lvf vf29 (&-> v1-0 camera-temp vector 2 quad)) + (.lvf vf28 (&-> v1-0 camera-temp vector 3 quad)) + (.lvf vf14 (&-> v1-0 hmge-scale quad)) + (.lvf vf26 (&-> v1-0 inv-hmge-scale quad)) + (.lvf vf25 (&-> v1-0 hvdf-off quad)) + ) + (.lvf vf13 (&-> *sky-tng-data* fog quad)) + (.mul.vf vf31 vf31 vf14) + (.mul.vf vf30 vf30 vf14) + (.mul.vf vf29 vf29 vf14) + (.mul.vf vf28 vf28 vf14) + (.mov.vf vf24 vf0) + (.mov v1-2 vf24) + 0 + (none) + ) + ) +|# + +(defun-debug add-boundary-shader ((arg0 texture-id) (arg1 dma-buffer)) + "Add the adgif shader to the dma-buffer. It's never changed during load boundary rendering" + (let* ((v1-0 arg1) + (a1-1 (the-as object (-> v1-0 base))) + ) + (set! + (-> (the-as gs-gif-tag a1-1) tag) + (new 'static 'gif-tag64 :nloop #x1 :nreg #x5) + ) + (set! + (-> (the-as gs-gif-tag a1-1) regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id a+d) + :regs1 (gif-reg-id a+d) + :regs2 (gif-reg-id a+d) + :regs3 (gif-reg-id a+d) + :regs4 (gif-reg-id a+d) + ) + ) + (set! (-> v1-0 base) (&+ (the-as pointer a1-1) 16)) + ) + (let ((s5-0 (the-as adgif-shader (-> arg1 base)))) + (adgif-shader<-texture-simple! s5-0 (lookup-texture-by-id arg0)) + (set! (-> s5-0 alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> s5-0 tex0 tfx) 0) + (set! (-> s5-0 tex1 mmag) 0) + (set! (-> s5-0 clamp) (new 'static 'gs-clamp)) + ) + 0 + (&+! (-> arg1 base) 80) + (none) + ) + +;; note: draw-boundary-polygon is in C++ only, called from the two functions below. + +;; render-boundary-quad +(def-mips2c render-boundary-quad (function lbvtx dma-buffer none)) +;; render-boundary-tri +(def-mips2c render-boundary-tri (function lbvtx dma-buffer none)) + +;; the polygon curently rendering. +(define *boundary-polygon* (new 'static 'inline-array lbvtx 12 + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + (new 'static 'lbvtx) + ) + ) + + +(defun-debug draw-boundary-side ((arg0 load-boundary) (arg1 integer) (arg2 integer) (arg3 dma-buffer) (arg4 symbol)) + (rlet ((vf27 :class vf)) + (let ((v1-2 (-> arg0 data arg1))) + (let ((a1-3 (-> arg0 data arg2))) + (let ((a2-2 (-> *boundary-polygon* 0))) + (set! (-> a2-2 x) (-> v1-2 x)) + (set! (-> a2-2 y) (-> arg0 bot-plane)) + (set! (-> a2-2 z) (-> v1-2 z)) + (set! (-> a2-2 v w) 1.0) + ) + (let ((a2-4 (-> *boundary-polygon* 3))) + (set! (-> a2-4 x) (-> a1-3 x)) + (set! (-> a2-4 y) (-> arg0 bot-plane)) + (set! (-> a2-4 z) (-> a1-3 z)) + (set! (-> a2-4 v w) 1.0) + ) + (let ((a2-6 (-> *boundary-polygon* 6))) + (set! (-> a2-6 x) (-> a1-3 x)) + (set! (-> a2-6 y) (-> arg0 top-plane)) + (set! (-> a2-6 z) (-> a1-3 z)) + (set! (-> a2-6 v w) 1.0) + ) + ) + (let ((a1-5 (-> *boundary-polygon* 9))) + (set! (-> a1-5 x) (-> v1-2 x)) + (set! (-> a1-5 y) (-> arg0 top-plane)) + (set! (-> a1-5 z) (-> v1-2 z)) + (set! (-> a1-5 v w) 1.0) + ) + ) + (cond + (arg4 + (let ((v1-4 (-> *boundary-polygon* 1))) + (set! (-> v1-4 x) 0.0) + (set! (-> v1-4 y) 0.0) + (set! (-> v1-4 z) 1.0) + (set! (-> v1-4 v w) 1.0) + ) + (let ((v1-6 (-> *boundary-polygon* 4))) + (set! (-> v1-6 x) 1.0) + (set! (-> v1-6 y) 0.0) + (set! (-> v1-6 z) 1.0) + (set! (-> v1-6 v w) 1.0) + ) + (let ((v1-8 (-> *boundary-polygon* 7))) + (set! (-> v1-8 x) 1.0) + (set! (-> v1-8 y) 8.0) + (set! (-> v1-8 z) 1.0) + (set! (-> v1-8 v w) 1.0) + ) + (let ((v1-10 (-> *boundary-polygon* 10))) + (set! (-> v1-10 x) 0.0) + (set! (-> v1-10 y) 8.0) + (set! (-> v1-10 z) 1.0) + (set! (-> v1-10 v w) 1.0) + ) + ) + (else + (let ((v1-12 (-> *boundary-polygon* 1))) + (set! (-> v1-12 x) 1.0) + (set! (-> v1-12 y) 0.0) + (set! (-> v1-12 z) 1.0) + (set! (-> v1-12 v w) 1.0) + ) + (let ((v1-14 (-> *boundary-polygon* 4))) + (set! (-> v1-14 x) 0.0) + (set! (-> v1-14 y) 0.0) + (set! (-> v1-14 z) 1.0) + (set! (-> v1-14 v w) 1.0) + ) + (let ((v1-16 (-> *boundary-polygon* 7))) + (set! (-> v1-16 x) 0.0) + (set! (-> v1-16 y) 8.0) + (set! (-> v1-16 z) 1.0) + (set! (-> v1-16 v w) 1.0) + ) + (let ((v1-18 (-> *boundary-polygon* 10))) + (set! (-> v1-18 x) 1.0) + (set! (-> v1-18 y) 8.0) + (set! (-> v1-18 z) 1.0) + (set! (-> v1-18 v w) 1.0) + ) + ) + ) + (init-boundary-regs) + ;;(.lvf vf27 (&-> *sky-tng-data* giftag-roof qword)) + (set-sky-vf27 (&-> *sky-tng-data* giftag-roof qword)) + (render-boundary-quad (-> *boundary-polygon* 0) arg3) + 0 + (none) + ) + ) + +(defun-debug draw-boundary-cap ((arg0 load-boundary) (arg1 float) (arg2 dma-buffer) (arg3 symbol)) + (rlet ((vf27 :class vf)) + (dotimes (s2-0 (-> arg0 tri-cnt)) + (let ((a1-1 (-> arg0 data (-> arg0 data s2-0 v0))) + (a0-1 (-> arg0 data (-> arg0 data s2-0 v1))) + (v1-15 (-> arg0 data (-> arg0 data s2-0 v2))) + ) + (let ((a2-2 (-> *boundary-polygon* 0))) + (set! (-> a2-2 x) (-> a1-1 x)) + (set! (-> a2-2 y) arg1) + (set! (-> a2-2 z) (-> a1-1 z)) + (set! (-> a2-2 v w) 1.0) + ) + (let ((a1-3 (-> *boundary-polygon* 3))) + (set! (-> a1-3 x) (-> a0-1 x)) + (set! (-> a1-3 y) arg1) + (set! (-> a1-3 z) (-> a0-1 z)) + (set! (-> a1-3 v w) 1.0) + ) + (let ((a0-3 (-> *boundary-polygon* 6))) + (set! (-> a0-3 x) (-> v1-15 x)) + (set! (-> a0-3 y) arg1) + (set! (-> a0-3 z) (-> v1-15 z)) + (set! (-> a0-3 v w) 1.0) + ) + ) + (cond + (arg3 + (let ((v1-17 (-> *boundary-polygon* 1))) + (set! (-> v1-17 x) 0.0) + (set! (-> v1-17 y) 0.0) + (set! (-> v1-17 z) 1.0) + (set! (-> v1-17 v w) 1.0) + ) + (let ((v1-19 (-> *boundary-polygon* 4))) + (set! (-> v1-19 x) 0.0) + (set! (-> v1-19 y) 1.0) + (set! (-> v1-19 z) 1.0) + (set! (-> v1-19 v w) 1.0) + ) + (let ((v1-21 (-> *boundary-polygon* 7))) + (set! (-> v1-21 x) 1.0) + (set! (-> v1-21 y) 0.0) + (set! (-> v1-21 z) 1.0) + (set! (-> v1-21 v w) 1.0) + ) + ) + (else + (let ((v1-23 (-> *boundary-polygon* 1))) + (set! (-> v1-23 x) 1.0) + (set! (-> v1-23 y) 0.0) + (set! (-> v1-23 z) 1.0) + (set! (-> v1-23 v w) 1.0) + ) + (let ((v1-25 (-> *boundary-polygon* 4))) + (set! (-> v1-25 x) 1.0) + (set! (-> v1-25 y) 1.0) + (set! (-> v1-25 z) 1.0) + (set! (-> v1-25 v w) 1.0) + ) + (let ((v1-27 (-> *boundary-polygon* 7))) + (set! (-> v1-27 x) 0.0) + (set! (-> v1-27 y) 0.0) + (set! (-> v1-27 z) 1.0) + (set! (-> v1-27 v w) 1.0) + ) + ) + ) + (init-boundary-regs) + ;;(.lvf vf27 (&-> *sky-tng-data* giftag-roof qword)) + (set-sky-vf27 (&-> *sky-tng-data* giftag-roof qword)) + (render-boundary-tri (-> *boundary-polygon* 0) arg2) + ) + 0 + (none) + ) + ) + +(defun-debug boundary-set-color ((arg0 lbvtx) (arg1 load-boundary-crossing-command)) + "Set the color based on the color." + (case (-> arg1 cmd) + (((load-boundary-cmd load)) + (let ((v1-1 arg0)) + (set! (-> v1-1 x) 128.0) + (set! (-> v1-1 y) 128.0) + (set! (-> v1-1 z) 128.0) + (set! (-> v1-1 v w) 128.0) + ) + ) + (((load-boundary-cmd cmd2)) + (let ((v1-2 arg0)) + (set! (-> v1-2 x) 0.0) + (set! (-> v1-2 y) 0.0) + (set! (-> v1-2 z) 0.0) + (set! (-> v1-2 v w) 128.0) + ) + ) + (((load-boundary-cmd display)) + (cond + ((-> arg1 lev1) + (let ((v1-4 arg0)) + (set! (-> v1-4 x) 128.0) + (set! (-> v1-4 y) 128.0) + (set! (-> v1-4 z) 0.0) + (set! (-> v1-4 v w) 128.0) + ) + ) + (else + (let ((v1-5 arg0)) + (set! (-> v1-5 x) 64.0) + (set! (-> v1-5 y) 64.0) + (set! (-> v1-5 z) 0.0) + (set! (-> v1-5 v w) 128.0) + ) + ) + ) + ) + (((load-boundary-cmd vis)) + (let ((v1-6 arg0)) + (set! (-> v1-6 x) 128.0) + (set! (-> v1-6 y) 0.0) + (set! (-> v1-6 z) 0.0) + (set! (-> v1-6 v w) 128.0) + ) + ) + (((load-boundary-cmd checkpt)) + (let ((v1-7 arg0)) + (set! (-> v1-7 x) 0.0) + (set! (-> v1-7 y) 128.0) + (set! (-> v1-7 z) 128.0) + (set! (-> v1-7 v w) 128.0) + ) + ) + (else + (let ((v1-8 arg0)) + (set! (-> v1-8 x) 64.0) + (set! (-> v1-8 y) 64.0) + (set! (-> v1-8 z) 64.0) + (set! (-> v1-8 v w) 128.0) + ) + ) + ) + 0 + (none) + ) + + +(defun-debug render-boundary ((arg0 load-boundary)) + (let* ((s3-0 (or (!= arg0 (-> *lb-editor-parms* boundary)) + (logtest? (-> *display* real-actual-frame-counter) 4) + ) + ) + (s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (gp-0 (-> s5-0 base)) + ) + (let* ((v1-8 s5-0) + (a0-5 (the-as object (-> v1-8 base))) + ) + (set! (-> (the-as dma-packet a0-5) dma) + (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + ) + (set! (-> (the-as dma-packet a0-5) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-5) vif1) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + (set! (-> v1-8 base) (&+ (the-as pointer a0-5) 16)) + ) + (let* ((v1-9 s5-0) + (a0-7 (the-as object (-> v1-9 base))) + ) + (set! (-> (the-as gs-gif-tag a0-7) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3) + ) + (set! (-> (the-as gs-gif-tag a0-7) regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id a+d) + :regs1 (gif-reg-id a+d) + :regs2 (gif-reg-id a+d) + :regs3 (gif-reg-id a+d) + :regs4 (gif-reg-id a+d) + :regs5 (gif-reg-id a+d) + :regs6 (gif-reg-id a+d) + :regs7 (gif-reg-id a+d) + :regs8 (gif-reg-id a+d) + :regs9 (gif-reg-id a+d) + :regs10 (gif-reg-id a+d) + :regs11 (gif-reg-id a+d) + :regs12 (gif-reg-id a+d) + :regs13 (gif-reg-id a+d) + :regs14 (gif-reg-id a+d) + :regs15 (gif-reg-id a+d) + ) + ) + (set! (-> v1-9 base) (&+ (the-as pointer a0-7) 16)) + ) + (let* ((v1-10 s5-0) + (a0-9 (-> v1-10 base)) + ) + (set! (-> (the-as (pointer gs-zbuf) a0-9) 0) + (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-9) 1) (gs-reg64 zbuf-1)) + (set! (-> (the-as (pointer gs-test) a0-9) 2) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-9) 3) (gs-reg64 test-1)) + (set! (-> (the-as (pointer gs-alpha) a0-9) 4) + (new 'static 'gs-alpha :b #x1 :d #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-9) 5) (gs-reg64 alpha-1)) + (set! (-> v1-10 base) (&+ a0-9 48)) + ) + (boundary-set-color (-> *boundary-polygon* 2) (-> arg0 cmd-fwd)) + (boundary-set-color (-> *boundary-polygon* 5) (-> arg0 cmd-bwd)) + (let ((s2-0 (the-as object (-> s5-0 base)))) + (&+! (-> s5-0 base) 16) + (add-boundary-shader (new 'static 'texture-id :index #x33 :page #x2) s5-0) + (cond + ((logtest? (-> arg0 flags) (load-boundary-flags closed)) + (draw-boundary-cap arg0 (-> arg0 top-plane) s5-0 s3-0) + ) + (else + (dotimes (s1-0 (the-as int (+ (-> arg0 num-points) -1))) + (draw-boundary-side arg0 s1-0 (+ s1-0 1) s5-0 s3-0) + ) + ) + ) + (close-sky-buffer s5-0) + (let ((v1-25 (/ (+ (- -16 (the-as int s2-0)) (the-as int (-> s5-0 base))) 16))) + (set! (-> (the-as dma-packet s2-0) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-25) + ) + (set! (-> (the-as dma-packet s2-0) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet s2-0) vif1) + (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25) + ) + ) + ) + (let ((a3-2 (-> s5-0 base))) + (let ((v1-29 (the-as object (-> s5-0 base)))) + (set! (-> (the-as dma-packet v1-29) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-29) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-29) vif1) (new 'static 'vif-tag)) + (set! (-> s5-0 base) (&+ (the-as pointer v1-29) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id debug-draw0) + gp-0 + (the-as (pointer dma-tag) a3-2) + ) + ) + ) + 0 + (none) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;; +;; Load Boundary File +;;;;;;;;;;;;;;;;;;;;;;;;; + +;; the load-boundary-data.gc file can be re-generated after editing load boundaries. + +(defun-debug format-boundary-cmd ((arg0 load-boundary-crossing-command)) + (case (-> arg0 cmd) + (((load-boundary-cmd load)) + (format *stdcon* " LOAD(~A,~A)~%" (-> arg0 lev0) (-> arg0 lev1)) + ) + (((load-boundary-cmd cmd2)) + ) + (((load-boundary-cmd display)) + (if (-> arg0 lev1) + (format *stdcon* " DISPLAY(~A,~A)~%" (-> arg0 lev0) (-> arg0 lev1)) + (format *stdcon* " DISPLAY(~A,OFF)~%" (-> arg0 lev0)) + ) + ) + (((load-boundary-cmd vis)) + (format *stdcon* " VIS(~A)~%" (-> arg0 lev0)) + ) + (((load-boundary-cmd checkpt)) + (format *stdcon* " CHECKPT(~A)~%" (-> arg0 lev0)) + ) + ) + 0 + (none) + ) + +(defun-debug edit-load-boundaries () + (let* ((gp-0 *lb-editor-parms*) + (s5-0 (-> gp-0 boundary)) + ) + (format *stdcon* "~3L") + (cond + ((not s5-0) + (format *stdcon* "No load boundary selected - use Player 2 pad to select~%") + ) + (else + (format *stdcon* "Selected load boundary ~X~%" s5-0) + (if (logtest? (-> s5-0 flags) (load-boundary-flags player)) + (format *stdcon* "PLAYER activated~%") + (format *stdcon* "CAMERA activated~%") + ) + (when (nonzero? (-> s5-0 cmd-fwd cmd)) + (format *stdcon* "in->out~%") + (format-boundary-cmd (-> s5-0 cmd-fwd)) + ) + (when (nonzero? (-> s5-0 cmd-bwd cmd)) + (format *stdcon* "out->in~%") + (format-boundary-cmd (-> s5-0 cmd-bwd)) + ) + ) + ) + (format *stdcon* "~0L") + (let ((s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s3-0 quad) (-> *math-camera* inv-camera-rot vector 0 quad)) + (set! (-> s4-0 quad) (-> *math-camera* inv-camera-rot vector 1 quad)) + (set! (-> s3-0 y) 0.0) + (set! (-> s4-0 y) 0.0) + (when (and s5-0 (!= -1 (-> gp-0 vertex))) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s2-0 quad) (-> s5-0 data (-> gp-0 vertex) quad)) + (set! (-> s2-0 y) (-> s5-0 top-plane)) + (add-debug-sphere + #t + (bucket-id debug-draw1) + s2-0 + 8192.0 + (new 'static 'rgba :a #x80) + ) + (when (zero? (logand (-> s5-0 flags) (load-boundary-flags closed))) + (set! (-> s2-0 y) (-> s5-0 bot-plane)) + (add-debug-sphere + #t + (bucket-id debug-draw1) + s2-0 + 8192.0 + (new 'static 'rgba :a #x80) + ) + ) + ) + ) + (let* ((f30-1 (* 4096.0 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0))) + (f28-1 (* 4096.0 (analog-input (the-as int (-> *cpad-list* cpads 1 lefty)) 128.0 48.0 110.0 -1.0))) + (f30-2 (+ f30-1 (* 409.6 (analog-input (the-as int (-> *cpad-list* cpads 1 rightx)) 128.0 48.0 110.0 -1.0)))) + (f0-10 (+ f28-1 (* 409.6 (analog-input (the-as int (-> *cpad-list* cpads 1 righty)) 128.0 48.0 110.0 -1.0)))) + ) + (cond + ((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x)) + (cond + ((= (-> gp-0 vertex) -1) + (dotimes (v1-37 (the-as int (-> s5-0 num-points))) + (+! (-> s5-0 data v1-37 x) (* f30-2 (-> s3-0 x))) + (+! (-> s5-0 data v1-37 z) (* f30-2 (-> s3-0 z))) + (+! (-> s5-0 data v1-37 x) (* f0-10 (-> s4-0 x))) + (+! (-> s5-0 data v1-37 z) (* f0-10 (-> s4-0 z))) + ) + ) + (else + (+! (-> s5-0 data (-> gp-0 vertex) x) (* f30-2 (-> s3-0 x))) + (+! (-> s5-0 data (-> gp-0 vertex) z) (* f30-2 (-> s3-0 z))) + (+! (-> s5-0 data (-> gp-0 vertex) x) (* f0-10 (-> s4-0 x))) + (+! (-> s5-0 data (-> gp-0 vertex) z) (* f0-10 (-> s4-0 z))) + ) + ) + (set! (-> s5-0 tri-cnt) 0) + 0 + ) + ((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1)) + (if s5-0 + (+! (-> s5-0 top-plane) f0-10) + ) + ) + ((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2)) + (if s5-0 + (+! (-> s5-0 bot-plane) f0-10) + ) + ) + ((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons up)) + (if s5-0 + (set! s5-0 (-> s5-0 next)) + (set! s5-0 *load-boundary-list*) + ) + (set! (-> gp-0 vertex) -1) + ) + ((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down)) + (cond + ((= s5-0 *load-boundary-list*) + (set! s5-0 (the-as load-boundary #f)) + ) + (else + (let ((v1-95 *load-boundary-list*)) + (while v1-95 + (when (= s5-0 (-> v1-95 next)) + (set! s5-0 v1-95) + (set! v1-95 (the-as load-boundary #f)) + ) + (if v1-95 + (set! v1-95 (-> v1-95 next)) + ) + ) + ) + ) + ) + (set! (-> gp-0 vertex) -1) + ) + ((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons right)) + (+! (-> gp-0 vertex) 1) + (if (= (-> gp-0 vertex) (-> s5-0 num-points)) + (set! (-> gp-0 vertex) -1) + ) + ) + ((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left)) + (+! (-> gp-0 vertex) -1) + (if (= (-> gp-0 vertex) -2) + (set! (-> gp-0 vertex) (the-as int (+ (-> s5-0 num-points) -1))) + ) + ) + ) + ) + ) + (set! (-> gp-0 boundary) s5-0) + ) + 0 + (none) + ) + +(defun-debug copy-load-command! ((arg0 load-boundary-crossing-command) (arg1 load-boundary-crossing-command)) + (set! (-> arg0 cmd) (-> arg1 cmd)) + (dotimes (v1-1 3) + (set! (-> arg0 bparm v1-1) (-> arg1 bparm v1-1)) + ) + (dotimes (v1-4 2) + (set! (-> arg0 parm v1-4) (-> arg1 parm v1-4)) + ) + 0 + (none) + ) + +(defun-debug copy-load-boundary! ((arg0 load-boundary) (arg1 load-boundary)) + (set! (-> arg0 flags) (-> arg1 flags)) + (set! (-> arg0 top-plane) (-> arg1 top-plane)) + (set! (-> arg0 bot-plane) (-> arg1 bot-plane)) + (set! (-> arg0 tri-cnt) 0) + (copy-load-command! (-> arg0 cmd-fwd) (-> arg1 cmd-fwd)) + (copy-load-command! (-> arg0 cmd-bwd) (-> arg1 cmd-bwd)) + 0 + (none) + ) + +(defun-debug replace-load-boundary ((arg0 load-boundary) (arg1 load-boundary)) + (set! (-> arg1 next) (-> arg0 next)) + (if (= (-> *lb-editor-parms* boundary) arg0) + (set! (-> *lb-editor-parms* boundary) arg1) + ) + (when (= arg0 *load-boundary-list*) + (set! *load-boundary-list* arg1) + (return 0) + ) + (let ((v1-9 *load-boundary-list*)) + (while (and v1-9 (!= (-> v1-9 next) arg0)) + (set! v1-9 (-> v1-9 next)) + ) + (when v1-9 + (set! (-> v1-9 next) arg1) + (return 0) + ) + ) + (format 0 "ERROR: Couldn't find old boundary in list!!!!~%") + 0 + (none) + ) + +(defun-debug lb-del () + (let ((v1-1 (-> *lb-editor-parms* boundary))) + (set! (-> *lb-editor-parms* boundary) #f) + (when (not v1-1) + (format 0 "No boundary selected~%") + (return 0) + ) + (when (= v1-1 *load-boundary-list*) + (set! *load-boundary-list* (-> v1-1 next)) + (return 0) + ) + (let ((a0-5 *load-boundary-list*)) + (while (and a0-5 (!= (-> a0-5 next) v1-1)) + (set! a0-5 (-> a0-5 next)) + ) + (when a0-5 + (set! (-> a0-5 next) (-> v1-1 next)) + (return 0) + ) + ) + ) + (format 0 "ERROR: Couldn't find old boundary in list!!!!~%") + 0 + (none) + ) + +(defun-debug lb-add-vtx-before () + (let* ((v1-0 *lb-editor-parms*) + (gp-0 (-> v1-0 boundary)) + (s4-0 (-> v1-0 vertex)) + ) + (when (not gp-0) + (format 0 "No boundary selected~%") + (return 0) + ) + (when (= s4-0 -1) + (format 0 "No vertex selected~%") + (return 0) + ) + (let ((s5-0 (new 'global 'load-boundary (the-as int (+ (-> gp-0 num-points) 1)) #f #f))) + (copy-load-boundary! s5-0 gp-0) + (let ((v1-8 0)) + (while (< v1-8 s4-0) + (set! (-> s5-0 data v1-8 quad) (-> gp-0 data v1-8 quad)) + (+! v1-8 1) + ) + (cond + ((zero? s4-0) + (set! (-> s5-0 data v1-8 x) + (* 0.5 (+ (-> gp-0 data 0 x) (-> gp-0 data (+ (-> gp-0 num-points) -1) x)))) + (set! (-> s5-0 data v1-8 z) + (* 0.5 (+ (-> gp-0 data 0 z) (-> gp-0 data (+ (-> gp-0 num-points) -1) z)))) + ) + (else + (set! (-> s5-0 data v1-8 x) + (* 0.5 (+ (-> gp-0 data (+ s4-0 -1) x) (-> gp-0 data s4-0 x))) + ) + (set! (-> s5-0 data v1-8 z) + (* 0.5 (+ (-> gp-0 data (+ s4-0 -1) z) (-> gp-0 data s4-0 z))) + ) + ) + ) + (let ((v1-9 (+ v1-8 1))) + (while (>= (the-as int (-> gp-0 num-points)) v1-9) + (set! (-> s5-0 data v1-9 quad) (-> gp-0 data (+ v1-9 -1) quad)) + (+! v1-9 1) + ) + ) + ) + (replace-load-boundary gp-0 s5-0) + ) + ) + 0 + (none) + ) + +(defun-debug lb-add-vtx-after () + (let ((gp-0 *lb-editor-parms*)) + (let ((s5-0 (-> gp-0 boundary)) + (s3-0 (-> gp-0 vertex)) + ) + (when (not s5-0) + (format 0 "No boundary selected~%") + (return 0) + ) + (when (= s3-0 -1) + (format 0 "No vertex selected~%") + (return 0) + ) + (let ((s4-0 (new 'global 'load-boundary (the-as int (+ (-> s5-0 num-points) 1)) #f #f))) + (copy-load-boundary! s4-0 s5-0) + (let ((v1-7 0)) + (while (>= s3-0 v1-7) + (set! (-> s4-0 data v1-7 quad) (-> s5-0 data v1-7 quad)) + (+! v1-7 1) + ) + (cond + ((= s3-0 (+ (-> s5-0 num-points) -1)) + (set! (-> s4-0 data v1-7 x) + (* 0.5 (+ (-> s5-0 data 0 x) (-> s5-0 data (+ (-> s5-0 num-points) -1) x))) + ) + (set! (-> s4-0 data v1-7 z) + (* 0.5 (+ (-> s5-0 data 0 z) (-> s5-0 data (+ (-> s5-0 num-points) -1) z))) + ) + ) + (else + (set! (-> s4-0 data v1-7 x) + (* 0.5 (+ (-> s5-0 data (+ s3-0 1) x) (-> s5-0 data s3-0 x))) + ) + (set! (-> s4-0 data v1-7 z) + (* 0.5 (+ (-> s5-0 data (+ s3-0 1) z) (-> s5-0 data s3-0 z))) + ) + ) + ) + (let ((v1-8 (+ v1-7 1))) + (while (>= (the-as int (-> s5-0 num-points)) v1-8) + (set! (-> s4-0 data v1-8 quad) (-> s5-0 data (+ v1-8 -1) quad)) + (+! v1-8 1) + ) + ) + ) + (replace-load-boundary s5-0 s4-0) + ) + ) + (+! (-> gp-0 vertex) 1) + ) + 0 + (none) + ) + +(defun-debug lb-del-vtx () + (let* ((gp-0 *lb-editor-parms*) + (s5-0 (-> gp-0 boundary)) + ) + (let ((s3-0 (-> gp-0 vertex))) + (when (not s5-0) + (format 0 "No boundary selected~%") + (return 0) + ) + (when (= s3-0 -1) + (format 0 "No vertex selected~%") + (return 0) + ) + (let ((s4-0 (new 'global 'load-boundary (the-as int (+ (-> s5-0 num-points) -1)) #f #f))) + (copy-load-boundary! s4-0 s5-0) + (let ((v1-7 0)) + (while (< v1-7 s3-0) + (set! (-> s4-0 data v1-7 quad) (-> s5-0 data v1-7 quad)) + (+! v1-7 1) + ) + (let ((v1-8 (+ v1-7 1))) + (while (< v1-8 (the-as int (-> s5-0 num-points))) + (set! (-> s4-0 data (+ v1-8 -1) quad) (-> s5-0 data v1-8 quad)) + (+! v1-8 1) + ) + ) + ) + (replace-load-boundary s5-0 s4-0) + ) + ) + (if (= (-> gp-0 vertex) (+ (-> s5-0 num-points) -1)) + (set! (-> gp-0 vertex) -1) + ) + ) + 0 + (none) + ) + +(defun-debug save-boundary-cmd ((arg0 load-boundary-crossing-command) (arg1 string) (arg2 file-stream)) + (case (-> arg0 cmd) + (((load-boundary-cmd load)) + (format arg2 " :~S (load ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1)) + ) + (((load-boundary-cmd cmd2)) + ) + (((load-boundary-cmd display)) + (format arg2 " :~S (display ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1)) + ) + (((load-boundary-cmd vis)) + (format arg2 " :~S (vis ~A #f)~%" arg1 (-> arg0 lev0)) + ) + (((load-boundary-cmd force-vis)) + (format arg2 " :~S (force-vis ~A ~A)~%" arg1 (-> arg0 lev0) (-> arg0 lev1)) + ) + (((load-boundary-cmd checkpt)) + (format arg2 " :~S (checkpt ~A #f)~%" arg1 (-> arg0 lev0)) + ) + ) + 0 + (none) + ) + +(defun load-boundary-from-template ((arg0 (array object))) + (let* ((s5-0 (the-as (array float) (-> arg0 1))) + (a2-0 (+ (/ (-> s5-0 length) 2) -1)) + (v0-0 (new 'global 'load-boundary a2-0 #f #t)) + ) + (set! + (-> v0-0 flags) + (the-as load-boundary-flags (/ (the-as int (-> arg0 0)) 8)) + ) + (set! (-> v0-0 top-plane) (-> s5-0 0)) + (set! (-> v0-0 bot-plane) (-> s5-0 1)) + (let ((v1-5 2)) + (while (< v1-5 (-> s5-0 length)) + (let ((a0-6 (-> v0-0 data (+ (/ v1-5 2) -1)))) + (set! (-> a0-6 x) (-> s5-0 v1-5)) + (set! (-> a0-6 z) (-> s5-0 (+ v1-5 1))) + ) + (+! v1-5 2) + ) + ) + (let ((v1-7 (-> v0-0 cmd-fwd)) + (a0-9 (-> arg0 2)) + ) + (set! + (-> v1-7 cmd) + (the-as load-boundary-cmd (/ (the-as int (car (the-as pair a0-9))) 8)) + ) + (set! (-> v1-7 lev0) (the-as basic (car (cdr a0-9)))) + (set! (-> v1-7 lev1) (the-as basic (car (cdr (cdr a0-9))))) + ) + (let ((v1-8 (-> v0-0 cmd-bwd)) + (a0-13 (-> arg0 3)) + ) + (set! + (-> v1-8 cmd) + (the-as load-boundary-cmd (/ (the-as int (car (the-as pair a0-13))) 8)) + ) + (set! (-> v1-8 lev0) (the-as basic (car (cdr a0-13)))) + (set! (-> v1-8 lev1) (the-as basic (car (cdr (cdr a0-13))))) + ) + ) + (none) + ) + +(defun-debug ---lb-save () + (clear *temp-string*) + (format *temp-string* "game/load-boundary-data.gc") + (let ((gp-0 (new 'stack 'file-stream *temp-string* 'write))) + (format gp-0 ";-*-Lisp-*-~%") + (format gp-0 "(in-package goal)~%~%") + (format gp-0 ";; reset boundary in editor~%") + (format gp-0 "(set! (-> *lb-editor-parms* boundary) #f)~%~%") + (format gp-0 ";; reset all existing load boundaries~%") + (format gp-0 "(set! *load-boundary-list* #f)~%~%") + (format + gp-0 + "(define *static-load-boundary-list* (new 'static 'array 'array 0~%~%" + ) + (let ((s5-0 *load-boundary-list*)) + (while s5-0 + (format + gp-0 + "(static-load-boundary :flags (~S~S)~%" + (if (logtest? (-> s5-0 flags) (load-boundary-flags closed)) + "closed " + "" + ) + (if (logtest? (-> s5-0 flags) (load-boundary-flags player)) + "player " + "" + ) + ) + (format + gp-0 + " :top ~f :bot ~f~%" + (-> s5-0 top-plane) + (-> s5-0 bot-plane) + ) + (format gp-0 " :points (") + (dotimes (s4-0 (the-as int (-> s5-0 num-points))) + (format gp-0 " ~f ~f " (-> s5-0 data s4-0 x) (-> s5-0 data s4-0 z)) + ) + (format gp-0 ")~%") + (save-boundary-cmd (-> s5-0 cmd-fwd) "fwd" gp-0) + (save-boundary-cmd (-> s5-0 cmd-bwd) "bwd" gp-0) + (format gp-0 " )~%~%") + (set! s5-0 (-> s5-0 next)) + ) + ) + (format + gp-0 + "))~%~%(doarray (i *static-load-boundary-list*)~% (load-boundary-from-template i)~% )~%~%" + ) + (file-stream-close gp-0) + ) + (format 0 "Written ~S~%" *temp-string*) + 0 + (none) + ) + +(defun-debug lb-add () + (let ((gp-0 (new 'global 'load-boundary 2 #f #t))) + (let ((v1-1 (camera-pos))) + (set! (-> gp-0 data 0 x) (-> v1-1 x)) + (set! (-> gp-0 data 0 z) (-> v1-1 z)) + (set! (-> gp-0 data2 1 x) (-> v1-1 x)) + (set! (-> gp-0 data2 1 z) (+ 204800.0 (-> v1-1 z))) + ) + (set! (-> *lb-editor-parms* boundary) gp-0) + (set! (-> *lb-editor-parms* vertex) -1) + gp-0 + ) + ) + +(defun-debug lb-add-plane () + (let ((gp-0 (new 'global 'load-boundary 4 #t #t))) + (let ((v1-1 (camera-pos))) + (set! (-> gp-0 data 0 x) (-> v1-1 x)) + (set! (-> gp-0 data 0 z) (-> v1-1 z)) + (set! (-> gp-0 data2 1 x) (-> v1-1 x)) + (set! (-> gp-0 data2 1 z) (+ 204800.0 (-> v1-1 z))) + (set! (-> gp-0 data2 2 x) (+ 204800.0 (-> v1-1 x))) + (set! (-> gp-0 data2 2 z) (+ 204800.0 (-> v1-1 z))) + (set! (-> gp-0 data2 3 x) (+ 204800.0 (-> v1-1 x))) + (set! (-> gp-0 data2 3 z) (-> v1-1 z)) + ) + (set! (-> *lb-editor-parms* boundary) gp-0) + (set! (-> *lb-editor-parms* vertex) -1) + gp-0 + ) + ) + +(defun-debug lb-add-load ((arg0 object) (arg1 object)) + (let ((v1-0 (lb-add))) + (set! (-> v1-0 cmd-fwd cmd) (load-boundary-cmd load)) + (set! (-> v1-0 cmd-fwd lev0) (the-as basic arg0)) + (set! (-> v1-0 cmd-fwd lev1) (the-as basic arg1)) + ) + 0 + (none) + ) + +(defun-debug lb-add-load-plane ((arg0 object) (arg1 object)) + (let ((v1-0 (lb-add-plane))) + (set! (-> v1-0 cmd-fwd cmd) (load-boundary-cmd load)) + (set! (-> v1-0 cmd-fwd lev0) (the-as basic arg0)) + (set! (-> v1-0 cmd-fwd lev1) (the-as basic arg1)) + ) + 0 + (none) + ) + +(defun lb-flip () + (let ((gp-0 (-> *lb-editor-parms* boundary))) + (when (not gp-0) + (format 0 "No boundary selected~%") + (return 0) + ) + (let ((s5-0 (new 'stack 'load-boundary-crossing-command))) + (copy-load-command! s5-0 (-> gp-0 cmd-fwd)) + (copy-load-command! (-> gp-0 cmd-fwd) (-> gp-0 cmd-bwd)) + (copy-load-command! (-> gp-0 cmd-bwd) s5-0) + ) + ) + (none) + ) + +(defun lb-set-camera () + (let ((v1-1 (-> *lb-editor-parms* boundary))) + (when (not v1-1) + (format 0 "No boundary selected~%") + (return 0) + ) + (logclear! (-> v1-1 flags) (load-boundary-flags player)) + ) + 0 + (none) + ) + +(defun lb-set-player () + (let ((v1-1 (-> *lb-editor-parms* boundary))) + (when (not v1-1) + (format 0 "No boundary selected~%") + (return 0) + ) + (logior! (-> v1-1 flags) (load-boundary-flags player)) + ) + 0 + (none) + ) + +(defun-debug lb-copy () + (let ((s5-0 (-> *lb-editor-parms* boundary))) + (when (not s5-0) + (format 0 "No boundary selected~%") + (return 0) + ) + (let + ((gp-0 (new 'global 'load-boundary (the-as int (-> s5-0 num-points)) #f #t)) + ) + (copy-load-boundary! gp-0 s5-0) + (dotimes (v1-4 (the-as int (-> s5-0 num-points))) + (set! (-> gp-0 data v1-4 quad) (-> s5-0 data v1-4 quad)) + ) + (set! (-> *lb-editor-parms* boundary) gp-0) + ) + ) + 0 + (none) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Main Load Render Hook +;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun render-boundaries () + (when (-> *level* border?) + (set! (-> *load-boundary-target* 2 quad) (-> *load-boundary-target* 0 quad)) + (set! (-> *load-boundary-target* 3 quad) (-> *load-boundary-target* 1 quad)) + (set! (-> *load-boundary-target* 0 quad) (-> (camera-pos) quad)) + (set! (-> *load-boundary-target* 1 quad) (-> (target-pos 0) quad)) + (let ((gp-2 *load-boundary-list*)) + (while gp-2 + (when (zero? (-> gp-2 tri-cnt)) + (triangulate-boundary gp-2) + (find-bounding-circle gp-2) + ) + (if *display-load-boundaries* + (render-boundary gp-2) + ) + (check-boundary gp-2) + (set! gp-2 (-> gp-2 next)) + ) + ) + ) + (if *display-load-boundaries* + (edit-load-boundaries) + ) + 0 + (none) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; The Math Stuff +;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun find-bounding-circle ((arg0 load-boundary)) + (let ((f1-0 268435460.0) + (f3-0 -268435460.0) + (f0-0 268435460.0) + (f2-0 -268435460.0) + ) + (dotimes (v1-0 (the-as int (-> arg0 num-points))) + (if (< (-> arg0 data v1-0 x) f1-0) + (set! f1-0 (-> arg0 data v1-0 x)) + ) + (if (< f3-0 (-> arg0 data v1-0 x)) + (set! f3-0 (-> arg0 data v1-0 x)) + ) + (if (< (-> arg0 data v1-0 z) f0-0) + (set! f0-0 (-> arg0 data v1-0 z)) + ) + (if (< f2-0 (-> arg0 data v1-0 z)) + (set! f2-0 (-> arg0 data v1-0 z)) + ) + ) + (let* ((f3-2 (* 0.5 (+ f1-0 f3-0))) + (f2-2 (* 0.5 (+ f0-0 f2-0))) + (f1-1 (- f3-2 f1-0)) + (f0-1 (- f2-2 f0-0)) + (f0-4 (sqrtf (+ (* f1-1 f1-1) (* f0-1 f0-1)))) + ) + (set-vector! (-> arg0 rejector) f3-2 0.0 f2-2 f0-4) + ) + ) + 0 + (none) + ) + +(define *triangulation-buffer* (the-as (inline-array lbvtx) (malloc 'global 4096))) + +(defun triangulate-boundary ((arg0 load-boundary)) + (when (zero? (logand (-> arg0 flags) (load-boundary-flags closed))) + (set! (-> arg0 tri-cnt) 1) + (return (the-as object 0)) + ) + (let ((s5-0 *triangulation-buffer*)) + (new 'stack 'lbvtx) + (let ((s4-0 (-> arg0 num-points))) + (set! (-> arg0 tri-cnt) 0) + (dotimes (v1-7 (the-as int s4-0)) + (let ((a0-4 (-> arg0 data v1-7 quad))) + (set! (-> s5-0 v1-7 quad) a0-4) + ) + (if (zero? v1-7) + (set! (-> s5-0 v1-7 v0) (+ s4-0 -1)) + (set! (-> s5-0 v1-7 v0) (the-as uint (+ v1-7 -1))) + ) + (cond + ((= v1-7 (+ s4-0 -1)) + (set! (-> s5-0 v1-7 v1) (the-as uint 0)) + 0 + ) + (else + (set! (-> s5-0 v1-7 v1) (the-as uint (+ v1-7 1))) + ) + ) + (set! (-> s5-0 v1-7 v2) (the-as uint 1)) + ) + (while #t + (let ((a1-11 -1)) + (let ((f0-0 268435460.0)) + (dotimes (v1-10 (the-as int s4-0)) + (when (nonzero? (-> s5-0 v1-10 v2)) + (when + (or + (< (-> s5-0 v1-10 z) f0-0) + (and + (= (-> s5-0 v1-10 z) f0-0) + (< (-> s5-0 v1-10 x) (-> s5-0 a1-11 x)) + ) + ) + (set! f0-0 (-> s5-0 v1-10 z)) + (set! a1-11 v1-10) + ) + ) + ) + ) + (let* ((v1-14 (-> s5-0 a1-11)) + (a2-0 (-> s5-0 (-> v1-14 v0))) + (a0-36 (-> s5-0 (-> v1-14 v1))) + (f0-2 (- (-> v1-14 x) (-> a2-0 x))) + (f1-5 (- (-> v1-14 z) (-> a2-0 z))) + (f2-3 (- (-> a0-36 x) (-> v1-14 x))) + ) + (when (< (- (* f0-2 (- (-> a0-36 z) (-> v1-14 z))) (* f2-3 f1-5)) 0.0) + (dotimes (v1-16 (the-as int s4-0)) + (let ((a0-39 (-> s5-0 v1-16 v0))) + (set! (-> s5-0 v1-16 v0) (-> s5-0 v1-16 v1)) + (set! (-> s5-0 v1-16 v1) a0-39) + ) + ) + ) + ) + (let ((s3-0 a1-11) + (a0-40 (-> s5-0 a1-11 v0)) + (v1-23 (-> s5-0 a1-11 v1)) + ) + (let ((a2-6 0)) + (while (>= (-> s5-0 a0-40 z) (-> s5-0 s3-0 z)) + (set! s3-0 (the-as int a0-40)) + (set! a0-40 (-> s5-0 (the-as uint s3-0) v0)) + (+! a2-6 1) + (when (= a2-6 10) + (break!) + 0 + ) + ) + ) + (while (and (!= s3-0 a1-11) (>= (-> s5-0 s3-0 z) (-> s5-0 a0-40 z))) + (set! s3-0 (the-as int a0-40)) + (set! a0-40 (-> s5-0 (the-as uint s3-0) v0)) + ) + (when (= s3-0 a1-11) + (split-monotone-polygon arg0 a1-11) + (fix-boundary-normals arg0) + (return (the-as object 0)) + ) + (let ((s2-0 a1-11)) + (while + (and + (>= (-> s5-0 v1-23 z) (-> s5-0 s2-0 z)) + (>= (-> s5-0 s3-0 z) (-> s5-0 v1-23 z)) + ) + (set! s2-0 (the-as int v1-23)) + (set! v1-23 (-> s5-0 (the-as uint s2-0) v1)) + ) + (let ((s1-0 (-> s5-0 s3-0 v0)) + (s0-0 (-> s5-0 s2-0 v1)) + ) + (set! (-> s5-0 s3-0 v0) (the-as uint s2-0)) + (set! (-> s5-0 s2-0 v1) (the-as uint s3-0)) + (let ((v1-37 (-> s5-0 s3-0 v1))) + (while (!= v1-37 s2-0) + (set! (-> s5-0 v1-37 v2) (the-as uint 0)) + (set! v1-37 (-> s5-0 v1-37 v1)) + ) + ) + (split-monotone-polygon arg0 a1-11) + (set! (-> s5-0 s3-0 v0) s1-0) + (set! (-> s5-0 s2-0 v1) s0-0) + ) + (set! (-> s5-0 s2-0 v0) (the-as uint s3-0)) + (set! (-> s5-0 s3-0 v1) (the-as uint s2-0)) + ) + ) + ) + ) + ) + ) + 0 + ) + +(defun try-corner ((arg0 object) (arg1 int)) + (let* ((v1-0 *triangulation-buffer*) + (a0-3 (-> v1-0 arg1 v0)) + (a1-3 (-> v1-0 arg1 v1)) + (f0-1 (- (-> v1-0 a0-3 x) (-> v1-0 a1-3 x))) + (f1-2 (- (-> v1-0 a0-3 z) (-> v1-0 a1-3 z))) + (a2-10 (-> v1-0 a1-3 v1)) + ) + (while (!= a2-10 a0-3) + (let ((f2-2 (- (-> v1-0 a2-10 x) (-> v1-0 a1-3 x))) + (f3-2 (- (-> v1-0 a2-10 z) (-> v1-0 a1-3 z))) + ) + (if (< (- (* f2-2 f1-2) (* f0-1 f3-2)) 0.0) + (return #f) + ) + ) + (set! a2-10 (-> v1-0 a2-10 v1)) + ) + ) + #t + ) + +(defun split-monotone-polygon ((arg0 load-boundary) (arg1 int)) + (let ((s5-0 *triangulation-buffer*)) + (while #t + (when (= (-> s5-0 (-> s5-0 (-> s5-0 arg1 v0) v0) v0) arg1) + (let ((v1-10 (-> arg0 tri-cnt))) + (set! (-> arg0 data v1-10 v0) (the-as uint arg1)) + (set! (-> arg0 data v1-10 v1) (-> s5-0 arg1 v0)) + (set! (-> arg0 data v1-10 v2) (-> s5-0 (-> s5-0 arg1 v0) v0)) + ) + (+! (-> arg0 tri-cnt) 1) + (return 0) + ) + (let ((s3-0 arg1)) + (while (not (try-corner arg0 s3-0)) + (set! s3-0 (the-as int (-> s5-0 s3-0 v1))) + (when (= (the-as uint s3-0) arg1) + ) + ) + (let ((a0-13 (-> arg0 tri-cnt))) + (set! arg1 (the-as int (-> s5-0 s3-0 v0))) + (let ((v1-25 (-> s5-0 s3-0 v1))) + (set! (-> arg0 data a0-13 v0) (the-as uint arg1)) + (set! (-> arg0 data a0-13 v1) (the-as uint s3-0)) + (set! (-> arg0 data a0-13 v2) v1-25) + (+! (-> arg0 tri-cnt) 1) + (set! (-> s5-0 (the-as uint arg1) v1) v1-25) + (set! (-> s5-0 v1-25 v0) (the-as uint arg1)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defun fix-boundary-normals ((arg0 load-boundary)) + (dotimes (s5-0 (-> arg0 tri-cnt)) + (let ((a1-0 (-> arg0 data (-> arg0 data s5-0 v0))) + (a2-0 (-> arg0 data (-> arg0 data s5-0 v1))) + (a3-0 (-> arg0 data (-> arg0 data s5-0 v2))) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (normal-of-plane + s4-0 + (the-as vector a1-0) + (the-as vector a2-0) + (the-as vector a3-0) + ) + (if (or (!= (-> s4-0 x) 0.0) (!= (-> s4-0 z) 0.0)) + (format 0 "ERROR in the load-boundary code : tell Eddie!!!~%") + ) + (when (< (-> s4-0 y) 0.0) + (let ((v1-22 (-> arg0 data s5-0 v0))) + (set! (-> arg0 data s5-0 v0) (-> arg0 data s5-0 v1)) + (set! (-> arg0 data s5-0 v1) v1-22) + ) + ) + ) + ) + 0 + (none) + ) + +(defun point-in-polygon ((arg0 load-boundary) (arg1 vector)) + (dotimes (v1-0 (-> arg0 tri-cnt)) + (let* ((a2-5 (-> arg0 data (-> arg0 data v1-0 v0))) + (t0-0 (-> arg0 data (-> arg0 data v1-0 v1))) + (a3-10 (-> arg0 data (-> arg0 data v1-0 v2))) + (f0-1 (- (-> t0-0 x) (-> a3-10 x))) + (f1-2 (- (-> t0-0 z) (-> a3-10 z))) + (f2-2 (- (-> t0-0 x) (-> arg1 x))) + (f3-2 (- (-> t0-0 z) (-> arg1 z))) + ) + (when (>= (- (* f2-2 f1-2) (* f0-1 f3-2)) 0.0) + (let ((f0-5 (- (-> t0-0 x) (-> arg1 x))) + (f1-7 (- (-> t0-0 z) (-> arg1 z))) + (f2-5 (- (-> t0-0 x) (-> a2-5 x))) + (f3-5 (- (-> t0-0 z) (-> a2-5 z))) + ) + (when (>= (- (* f2-5 f1-7) (* f0-5 f3-5)) 0.0) + (let ((f0-9 (- (-> arg1 x) (-> a3-10 x))) + (f1-12 (- (-> arg1 z) (-> a3-10 z))) + (f2-8 (- (-> arg1 x) (-> a2-5 x))) + (f3-8 (- (-> arg1 z) (-> a2-5 z))) + ) + (if (>= (- (* f2-8 f1-12) (* f0-9 f3-8)) 0.0) + (return #t) + ) + ) + ) + ) + ) + ) + ) + #f + ) + +(defun check-closed-boundary ((arg0 load-boundary) (arg1 lbvtx) (arg2 lbvtx)) + (if + (and (< (-> arg0 top-plane) (-> arg1 y)) (< (-> arg0 top-plane) (-> arg2 y))) + (return (the-as symbol 0)) + ) + (if + (and (< (-> arg1 y) (-> arg0 top-plane)) (< (-> arg2 y) (-> arg0 top-plane))) + (return (the-as symbol 0)) + ) + (let + ((f0-6 (/ (- (-> arg1 y) (-> arg2 y)) (- (-> arg0 top-plane) (-> arg2 y)))) + (a1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a1-1 x) (+ (-> arg2 x) (* f0-6 (- (-> arg1 x) (-> arg2 x))))) + (set! (-> a1-1 y) (+ (-> arg2 y) (* f0-6 (- (-> arg1 y) (-> arg2 y))))) + (set! (-> a1-1 z) (+ (-> arg2 z) (* f0-6 (- (-> arg1 z) (-> arg2 z))))) + (when (point-in-polygon arg0 a1-1) + (if (< (-> arg0 top-plane) (-> arg1 y)) + (return (the-as symbol 2)) + ) + (return (the-as symbol 1)) + ) + ) + (the-as symbol 0) + ) + +(defun check-open-boundary ((arg0 load-boundary) (arg1 lbvtx) (arg2 lbvtx)) + (let ((f0-0 (-> arg2 x)) + (f1-0 (-> arg2 z)) + (f2-0 (-> arg1 x)) + (f3-0 (-> arg1 z)) + (f6-0 (-> arg0 data 0 x)) + (f7-0 (-> arg0 data 0 z)) + (a3-0 1) + (v1-0 0) + ) + (if (and (= f0-0 f2-0) (= f1-0 f3-0)) + (return (the-as symbol 0)) + ) + (let ((f4-0 (- f2-0 f0-0)) + (f5-0 (- f3-0 f1-0)) + ) + (while (< a3-0 (the-as int (-> arg0 num-points))) + (let ((f8-0 (-> arg0 data a3-0 x)) + (f9-0 (-> arg0 data a3-0 z)) + ) + (let ((f10-2 (- (* (- f7-0 f1-0) f4-0) (* (- f6-0 f0-0) f5-0))) + (f11-4 + (- (* (- f7-0 f1-0) (- f8-0 f6-0)) (* (- f6-0 f0-0) (- f9-0 f7-0))) + ) + (f12-5 (- (* (- f8-0 f6-0) f5-0) (* (- f9-0 f7-0) f4-0))) + ) + (when (!= f12-5 0.0) + (let ((f10-3 (/ f10-2 f12-5)) + (f11-5 (/ f11-4 f12-5)) + ) + (if (and (>= f10-3 0.0) (>= 1.0 f10-3)) + 0 + ) + (when (and (>= f10-3 0.0) (>= 1.0 f10-3) (< 0.0 f11-5) (>= 1.0 f11-5)) + (let ((f10-5 (+ (-> arg2 y) (* f10-3 (- (-> arg1 y) (-> arg2 y)))))) + (when + (and (>= f10-5 (-> arg0 bot-plane)) (>= (-> arg0 top-plane) f10-5)) + (let + ((f6-3 + (- + (* (- f2-0 f6-0) (- f9-0 f7-0)) + (* (- f3-0 f7-0) (- f8-0 f6-0)) + ) + ) + ) + (if (< 0.0 f6-3) + (+! v1-0 1) + (+! v1-0 -1) + ) + ) + ) + ) + ) + ) + ) + ) + (set! f6-0 f8-0) + (set! f7-0 f9-0) + ) + (+! a3-0 1) + ) + ) + (if (> v1-0 0) + (return (the-as symbol 1)) + ) + (if (< v1-0 0) + (return (the-as symbol 2)) + ) + ) + (the-as symbol 0) + ) + +;;;;;;;;;;;;;;;;;;;;;;;; +;; Load Commands +;;;;;;;;;;;;;;;;;;;;;;;; + +(defun command-get-int ((arg0 object) (arg1 int)) + (cond + ((null? arg0) + arg1 + ) + ((type-type? (rtype-of arg0) binteger) + (/ (the-as int arg0) 8) + ) + ((type-type? (rtype-of arg0) bfloat) + (the int (-> (the-as bfloat arg0) data)) + ) + (else + arg1 + ) + ) + ) + +(defun command-get-float ((arg0 object) (arg1 float)) + (cond + ((null? arg0) + arg1 + ) + ((type-type? (rtype-of arg0) binteger) + (the float (/ (the-as int arg0) 8)) + ) + ((type-type? (rtype-of arg0) bfloat) + (-> (the-as bfloat arg0) data) + ) + (else + arg1 + ) + ) + ) + +(defun command-get-time ((arg0 object) (arg1 int)) + (cond + ((null? arg0) + arg1 + ) + ((and (pair? arg0) (= (car arg0) 'seconds)) + (the int (* 300.0 (command-get-float (car (cdr arg0)) 0.0))) + ) + ((type-type? (rtype-of arg0) binteger) + (/ (the-as int arg0) 8) + ) + ((type-type? (rtype-of arg0) bfloat) + (the int (-> (the-as bfloat arg0) data)) + ) + (else + arg1 + ) + ) + ) + +(defun command-get-param ((arg0 object) (arg1 object)) + (cond + ((null? arg0) + arg1 + ) + ((and (pair? arg0) (= (car arg0) 'seconds)) + (the int (* 300.0 (command-get-float (car (cdr arg0)) 0.0))) + ) + ((and (pair? arg0) (= (car arg0) 'meters)) + (* 4096.0 (command-get-float (car (cdr arg0)) 0.0)) + ) + ((and (pair? arg0) (= (car arg0) 'deg)) + (* 182.04445 (command-get-float (car (cdr arg0)) 0.0)) + ) + ((and (pair? arg0) (= (car arg0) 'static-vectorm)) + (let ((s4-0 (the-as object (new 'static 'vector)))) + (set-vector! + (the-as vector s4-0) + (* 4096.0 (command-get-float (car (cdr arg0)) 0.0)) + (* 4096.0 (command-get-float (car (cdr (cdr arg0))) 0.0)) + (* 4096.0 (command-get-float (car (cdr (cdr (cdr arg0)))) 0.0)) + 1.0 + ) + s4-0 + ) + ) + ((type-type? (rtype-of arg0) binteger) + (/ (the-as int arg0) 8) + ) + ((type-type? (rtype-of arg0) bfloat) + (-> (the-as bfloat arg0) data) + ) + (else + arg0 + ) + ) + ) + +(defun command-get-quoted-param ((arg0 object) (arg1 object)) + (if (and (pair? arg0) (= (car arg0) 'quote)) + (command-get-param (car (cdr arg0)) arg1) + (command-get-param arg0 arg1) + ) + ) (defmethod reset! load-state ((obj load-state)) (set! (-> obj want 0 name) #f) @@ -24,7 +1649,7 @@ ) (defmethod want-levels load-state ((obj load-state) (arg0 symbol) (arg1 symbol)) - (dotimes (v1-0 LEVEL_COUNT) + (dotimes (v1-0 2) (cond ((= (-> obj want v1-0 name) arg0) (set! arg0 #f) @@ -38,24 +1663,24 @@ ) ) (when arg0 - (dotimes (v1-4 LEVEL_COUNT) + (dotimes (v1-4 2) (when (not (-> obj want v1-4 name)) (set! (-> obj want v1-4 name) arg0) (set! (-> obj want v1-4 display?) #f) (set! (-> obj want v1-4 force-vis?) #f) (set! (-> obj want v1-4 force-inside?) #f) - (set! v1-4 LEVEL_COUNT) + (set! v1-4 2) ) ) ) (when arg1 - (dotimes (v1-10 LEVEL_COUNT) + (dotimes (v1-10 2) (when (not (-> obj want v1-10 name)) (set! (-> obj want v1-10 name) arg1) (set! (-> obj want v1-10 display?) #f) (set! (-> obj want v1-10 force-vis?) #f) (set! (-> obj want v1-10 force-inside?) #f) - (set! v1-10 LEVEL_COUNT) + (set! v1-10 2) ) ) ) @@ -63,7 +1688,7 @@ ) (defmethod want-display-level load-state ((obj load-state) (arg0 symbol) (arg1 symbol)) - (dotimes (v1-0 LEVEL_COUNT) + (dotimes (v1-0 2) (when (= (-> obj want v1-0 name) arg0) (set! (-> obj want v1-0 display?) arg1) (return 0) @@ -81,8 +1706,8 @@ ) (defmethod want-force-vis load-state ((obj load-state) (arg0 symbol) (arg1 symbol)) - (dotimes (v1-0 LEVEL_COUNT) - (if (= (-> obj want v1-0 name) arg0) + (dotimes (v1-0 2) + (when (= (-> obj want v1-0 name) arg0) (set! (-> obj want v1-0 force-vis?) arg1) (return 0) ) @@ -91,6 +1716,18 @@ 0 ) +(defmethod set-force-inside! load-state ((obj load-state) (arg0 symbol) (arg1 symbol)) + (dotimes (v1-0 2) + (when (= (-> obj want v1-0 name) arg0) + (set! (-> obj want v1-0 force-inside?) arg1) + (return 0) + ) + ) + (format 0 "ERROR: can't force inside on ~A because it isn't loaded~%" arg0) + 0 + (none) + ) + (defun load-state-want-levels ((arg0 symbol) (arg1 symbol)) (want-levels *load-state* arg0 arg1) ) @@ -107,9 +1744,612 @@ (want-force-vis *load-state* arg0 arg1) ) - (define *display-load-commands* #f) (define *backup-load-state* (new 'global 'load-state)) -(define-perm *load-state* load-state (new 'global 'load-state)) +(defmethod backup-load-state-and-set-cmds load-state ((obj load-state) (arg0 pair)) + (dotimes (s4-0 256) + (when (-> obj object-name s4-0) + (format 0 "WARNING: load state somehow aquired object command ~A~%" + (-> obj object-name s4-0) + ) + (set! (-> obj object-name s4-0) #f) + ) + ) + (mem-copy! (&-> *backup-load-state* type) (&-> obj type) 2092) + (set! (-> *backup-load-state* command-list) '()) + (set! (-> obj command-list) arg0) + 0 + ) +(defmethod restore-load-state-and-cleanup load-state ((obj load-state)) + (execute-commands-up-to obj 100000.0) + (dotimes (s5-0 256) + (when (-> obj object-name s5-0) + (let ((a0-3 (entity-by-name (the-as string (-> obj object-name s5-0))))) + (set! + (-> a0-3 extra perm status) + (the-as entity-perm-status (-> obj object-status s5-0)) + ) + (if (-> a0-3 extra process) + (kill! a0-3) + ) + ) + (set! (-> obj object-name s5-0) #f) + ) + ) + (mem-copy! (&-> obj type) (&-> *backup-load-state* type) 2092) + 0 + ) + +(defmethod restore-load-state load-state ((obj load-state)) + (dotimes (v1-0 256) + (if (-> obj object-name v1-0) + (set! (-> obj object-name v1-0) #f) + ) + ) + (mem-copy! (&-> obj type) (&-> *backup-load-state* type) 2092) + 0 + ) + +(defun command-list-get-process ((arg0 object)) + (with-pp + (set! arg0 (cond + ((null? arg0) + #f + ) + ((type-type? (rtype-of arg0) process) + (empty) + arg0 + ) + ((= arg0 'target) + *target* + ) + ((= arg0 'sidekick) + (if *target* + (ppointer->process (-> *target* sidekick)) + ) + ) + ((= arg0 'self) + pp + ) + ((= arg0 'parent) + (ppointer->process (-> pp parent)) + ) + ((= arg0 'camera) + *camera* + ) + ((type-type? (rtype-of arg0) string) + (let ((v1-14 (process-by-ename (the-as string arg0)))) + (cond + (v1-14 + (empty) + v1-14 + ) + (else + (let ((s5-0 (ppointer->process (-> pp child)))) + (while s5-0 + (let* ((s3-0 s5-0) + (s4-0 + (if + (and + (nonzero? s3-0) + (type-type? (-> s3-0 type) process-drawable) + ) + s3-0 + ) + ) + ) + (when + (and + s4-0 + (nonzero? (-> (the-as process-drawable s4-0) draw)) + (nonzero? + (-> (the-as process-drawable s4-0) draw art-group) + ) + (string= + (the-as string arg0) + (-> (the-as process-drawable s4-0) draw art-group name) + ) + ) + (set! arg0 s4-0) + (goto cfg-56) + ) + ) + (set! s5-0 (ppointer->process (-> s5-0 brother))) + ) + ) + (the-as process #f) + ) + ) + ) + ) + (else + #f + ) + ) + ) + (label cfg-56) + (the-as process arg0) + ) + ) + +(defmethod execute-commands-up-to load-state ((obj load-state) (arg0 float)) + (while (not (null? (-> obj command-list))) + (let ((f0-0 (command-get-float (car (car (-> obj command-list))) 0.0)) + (s4-0 (cdr (car (-> obj command-list)))) + ) + (if (< arg0 f0-0) + (return (the-as int #f)) + ) + (if *display-load-commands* + (format + 0 + "NOTICE: ~D: ~f: execute command ~A~%" + (-> *display* base-frame-counter) + f0-0 + s4-0 + ) + ) + (cond + ((pair? (car s4-0)) + (let ((a1-3 (car s4-0))) + (while (not (null? s4-0)) + (execute-command obj (the-as pair a1-3)) + (set! s4-0 (cdr s4-0)) + (set! a1-3 (car s4-0)) + ) + ) + ) + (else + (execute-command obj s4-0) + ) + ) + ) + (set! (-> obj command-list) (cdr (-> obj command-list))) + ) + 0 + ) + + +(defmethod execute-command load-state ((obj load-state) (arg0 pair)) + (local-vars (v1-26 int) (v1-57 int)) + (with-pp + (cond + ((null? arg0) + ) + ((pair? arg0) + (let ((v1-4 (car arg0)) + (gp-0 (cdr arg0)) + ) + (cond + ((= v1-4 'set!) + (let ((s5-1 (command-get-param (car gp-0) #f))) + (if s5-1 + (set! + (-> (the-as symbol s5-1) value) + (command-get-param (car (cdr gp-0)) #f) + ) + ) + ) + ) + ((= v1-4 'eval) + ((the-as (function int) (command-get-param (car gp-0) #f))) + ) + ((= v1-4 'want-vis) + (want-vis obj (the-as symbol (command-get-param (car gp-0) #f))) + ) + ((= v1-4 'want-levels) + (want-levels + obj + (the-as symbol (command-get-param (car gp-0) #f)) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + ) + ) + ((= v1-4 'display-level) + (want-display-level + obj + (the-as symbol (command-get-param (car gp-0) #f)) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + ) + ) + ((= v1-4 'want-force-vis) + (want-force-vis + obj + (the-as symbol (command-get-param (car gp-0) #f)) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + ) + ) + ((= v1-4 'want-force-inside) + (set-force-inside! + obj + (the-as symbol (command-get-param (car gp-0) #f)) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + ) + ) + ((= v1-4 'alive) + (let ((s4-5 (command-get-param (car gp-0) #f))) + (when s4-5 + (let ((gp-1 (entity-by-name (the-as string s4-5)))) + (when gp-1 + (dotimes (v1-25 256) + (when (not (-> obj object-name v1-25)) + (set! (-> obj object-name v1-25) (the-as symbol s4-5)) + (set! + (-> obj object-status v1-25) + (the-as basic (-> gp-1 extra perm status)) + ) + (set! v1-26 v1-25) + (goto cfg-29) + ) + ) + (set! v1-26 -1) + (label cfg-29) + (when (>= v1-26 0) + (entity-birth-no-kill gp-1) + (let ((a0-45 (-> gp-1 extra process))) + (when a0-45 + (logclear! (-> a0-45 mask) (process-mask actor-pause)) + (logclear! + (-> a0-45 mask) + (-> *kernel-context* prevent-from-run) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ((= v1-4 'dead) + (let ((s3-4 (command-get-param (car gp-0) #f))) + (when s3-4 + (let ((s4-6 (entity-by-name (the-as string s3-4)))) + (when s4-6 + (dotimes (gp-2 256) + (when + (string= + (the-as string (-> obj object-name gp-2)) + (the-as string s3-4) + ) + (set! + (-> s4-6 extra perm status) + (the-as entity-perm-status (-> obj object-status gp-2)) + ) + (if (-> s4-6 extra process) + (kill! s4-6) + ) + (set! (-> obj object-name gp-2) #f) + (goto cfg-45) + ) + ) + ) + ) + ) + ) + (label cfg-45) + ) + ((= v1-4 'kill) + (let ((s4-7 (command-get-param (car gp-0) #f))) + (when s4-7 + (let ((gp-3 (entity-by-name (the-as string s4-7)))) + (when gp-3 + (dotimes (v1-56 256) + (when (not (-> obj object-name v1-56)) + (set! (-> obj object-name v1-56) (the-as symbol s4-7)) + (set! + (-> obj object-status v1-56) + (the-as basic (-> gp-3 extra perm status)) + ) + (set! v1-57 v1-56) + (goto cfg-56) + ) + ) + (set! v1-57 -1) + (label cfg-56) + (when (>= v1-57 0) + (if (-> gp-3 extra process) + (kill! gp-3) + ) + (logior! (-> gp-3 extra perm status) (entity-perm-status dead)) + ) + ) + ) + ) + ) + ) + ((= v1-4 'special) + (let ((a0-70 (command-get-param (car gp-0) #f))) + (when a0-70 + (let ((s5-2 (entity-by-name (the-as string a0-70)))) + (if s5-2 + (dummy-30 + (the-as entity-actor s5-2) + (entity-perm-status bit-7) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + ) + ) + ) + ) + ) + ) + ((= v1-4 'active) + (let ((gp-4 (command-get-param (car gp-0) #f))) + (while (!= (level-status *level* (the-as symbol gp-4)) 'active) + (suspend) + ) + ) + ) + ((= v1-4 'part-tracker) + (let* ((s5-4 (command-get-param (car gp-0) #f)) + (a0-81 (command-get-param (car (cdr gp-0)) #f)) + (gp-5 (entity-by-name (the-as string a0-81))) + (s4-9 + (lookup-part-group-by-name + (symbol->string (the-as symbol s5-4)) + ) + ) + (s5-5 + (if + (and + (nonzero? s4-9) + (type-type? (-> s4-9 type) sparticle-launch-group) + ) + s4-9 + ) + ) + ) + (when (and gp-5 s5-5) + (let* ((s3-6 (-> gp-5 extra process)) + (s4-10 + (if + (and + (nonzero? s3-6) + (type-type? (-> s3-6 type) process-drawable) + ) + (the-as process-drawable s3-6) + ) + ) + (s3-7 (get-process *default-dead-pool* part-tracker #x4000)) + ) + (when s3-7 + (let ((t9-41 (method-of-type part-tracker activate)) + (a0-86 s3-7) + (a1-40 (the process-tree (ppointer->process (-> *setting-control* current movie)))) + ) + (set! a1-40 + (cond + (a1-40 + a1-40 + ) + (else + *entity-pool* + ) + ) + ) + (t9-41 + (the-as part-tracker a0-86) + a1-40 + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s3-7 part-tracker-init s5-5 -1 #f #f #f (if s4-10 + (-> + s4-10 + root + trans + ) + (-> + gp-5 + extra + trans + ) + ) + ) + (-> s3-7 ppointer) + ) + ) + ) + ) + ) + ((= v1-4 'auto-save) + (auto-save-command + (the-as symbol (command-get-param (car gp-0) #f)) + 0 + 0 + *default-pool* + ) + ) + ((= v1-4 'shadow) + (let ((s5-7 (command-list-get-process (car gp-0))) + (v1-95 (command-get-quoted-param (car (cdr gp-0)) #f)) + ) + (send-event s5-7 'shadow v1-95) + ) + ) + ((= v1-4 'time-of-day) + (when *time-of-day-proc* + (let ((v1-99 (command-get-int (car gp-0) 0))) + (cond + ((< v1-99 0) + (set! (-> *time-of-day-proc* 0 time-ratio) 300.0) + ) + (else + (set! (-> *time-of-day-proc* 0 hour) v1-99) + (set! (-> *time-of-day-proc* 0 minute) 0) + (set! (-> *time-of-day-proc* 0 frame) 0) + (set! (-> *time-of-day-proc* 0 time-ratio) 0.0) + ) + ) + ) + ) + ) + ((= v1-4 'save) + (mem-copy! (&-> *backup-load-state* type) (&-> obj type) 2092) + (set! (-> *backup-load-state* command-list) '()) + (dotimes (v1-112 256) + (if (-> *backup-load-state* object-name v1-112) + (set! (-> *backup-load-state* object-name v1-112) #f) + ) + ) + ) + ((= v1-4 'setting-reset) + (set-setting! + *setting-control* + pp + (the-as symbol (command-get-param (car gp-0) #f)) + (the-as symbol (command-get-param (car (cdr gp-0)) #f)) + 0.0 + 0 + ) + ) + ((= v1-4 'setting-unset) + (clear-pending-settings-from-process + *setting-control* + pp + (the-as symbol (command-get-param (car gp-0) #f)) + ) + ) + ((= v1-4 'blackout) + (set-blackout-frames + (the int (* 5.0000005 (the float (command-get-int (car gp-0) 0)))) + ) + ) + ((= v1-4 'teleport) + (set! *teleport* #t) + ) + ((= v1-4 'joint) + (send-event + (ppointer->process (-> *setting-control* current movie)) + 'joint + (command-get-param (car gp-0) #f) + ) + (set! *teleport-count* 2) + ) + ((= v1-4 'ambient) + (ambient-hint-spawn + (the-as string (command-get-param (car (cdr gp-0)) #f)) + (the-as vector #f) + *entity-pool* + (the-as symbol (command-get-param (car gp-0) #f)) + ) + ) + ((= v1-4 'send-event) + (let ((s5-13 (command-list-get-process (car gp-0))) + (s4-14 (command-get-quoted-param (car (cdr gp-0)) #f)) + (gp-6 (cdr (cdr gp-0))) + ) + (when (and s5-13 (not (null? s4-14))) + (let ((s3-11 (new 'stack-no-clear 'event-message-block))) + (set! (-> s3-11 from) pp) + (let ((a0-142 gp-6)) + (set! + (-> s3-11 num-params) + ((method-of-type (rtype-of a0-142) length) a0-142) + ) + ) + (set! (-> s3-11 message) (the-as symbol s4-14)) + (set! + (-> s3-11 param 0) + (the-as uint (command-get-quoted-param (car gp-6) #f)) + ) + (set! + (-> s3-11 param 1) + (the-as uint (command-get-quoted-param (car (cdr gp-6)) #f)) + ) + (set! + (-> s3-11 param 2) + (the-as uint (command-get-quoted-param (car (cdr (cdr gp-6))) #f)) + ) + (send-event-function s5-13 s3-11) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defun check-boundary ((arg0 load-boundary)) + (local-vars (s5-0 object)) + (let ((a1-0 (if (logtest? (-> arg0 flags) (load-boundary-flags player)) + (-> *load-boundary-target* 1) + (-> *load-boundary-target* 0) + ) + ) + (a2-0 (if (logtest? (-> arg0 flags) (load-boundary-flags player)) + (-> *load-boundary-target* 3) + (-> *load-boundary-target* 2) + ) + ) + ) + 0 + (let ((f0-1 (- (-> a1-0 x) (-> arg0 rejector x))) + (f1-2 (- (-> a1-0 z) (-> arg0 rejector z))) + ) + (cond + ((< + (+ (* f0-1 f0-1) (* f1-2 f1-2)) + (* (-> arg0 rejector w) (-> arg0 rejector w)) + ) + (if (logtest? (-> arg0 flags) (load-boundary-flags closed)) + (set! s5-0 (check-closed-boundary arg0 a1-0 a2-0)) + (set! s5-0 (check-open-boundary arg0 a1-0 a2-0)) + ) + ) + (else + (set! s5-0 0) + (goto cfg-28) + ) + ) + ) + ) + (let ((s4-0 (the-as load-boundary-crossing-command #f))) + (if (= (the-as symbol s5-0) 1) + (set! s4-0 (-> arg0 cmd-fwd)) + ) + (if (= (the-as symbol s5-0) 2) + (set! s4-0 (-> arg0 cmd-bwd)) + ) + (when s4-0 + (cond + ((= (-> s4-0 cmd) (load-boundary-cmd vis)) + (load-state-want-vis (the-as symbol (-> s4-0 lev0))) + ) + ((= (-> s4-0 cmd) (load-boundary-cmd load)) + (load-state-want-levels + (the-as symbol (-> s4-0 lev0)) + (the-as symbol (-> s4-0 lev1)) + ) + ) + ((= (-> s4-0 cmd) (load-boundary-cmd display)) + (load-state-want-display-level + (the-as symbol (-> s4-0 lev0)) + (the-as symbol (-> s4-0 lev1)) + ) + ) + ((= (-> s4-0 cmd) (load-boundary-cmd force-vis)) + (load-state-want-force-vis + (the-as symbol (-> s4-0 lev0)) + (the-as symbol (-> s4-0 lev1)) + ) + ) + ((= (-> s4-0 cmd) (load-boundary-cmd checkpt)) + (format 0 "Setting continue to ~A~%" (-> s4-0 lev0)) + (set-continue! *game-info* (-> s4-0 lev0)) + ) + ) + ) + ) + (label cfg-28) + (none) + ) + +(define-perm *load-state* load-state (new 'global 'load-state)) \ No newline at end of file diff --git a/goal_src/engine/ps2/rpc-h.gc b/goal_src/engine/ps2/rpc-h.gc index 81ebbda620..5cc0be5c63 100644 --- a/goal_src/engine/ps2/rpc-h.gc +++ b/goal_src/engine/ps2/rpc-h.gc @@ -205,9 +205,10 @@ (let ((current-buffer (-> obj current))) (when (= (-> current-buffer elt-count) (-> current-buffer elt-used)) ;; oops, we're full. - (if (= 0 (-> obj rpc-port)) + (when (= 0 (-> obj rpc-port)) ;; if we're RPC 0, this is evidently a situation to warn about. (format 0 "WARNING: too many sound commands queued~%") + ;;(sound-buffer-dump) ) ;; otherwise we just flush ;; seems kinda dangerous. these could be the wrong parameters... diff --git a/goal_src/engine/ui/progress/progress.gc b/goal_src/engine/ui/progress/progress.gc index dbde3cde3a..4985ab0a4b 100644 --- a/goal_src/engine/ui/progress/progress.gc +++ b/goal_src/engine/ui/progress/progress.gc @@ -770,10 +770,10 @@ (set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z)) (when (> (-> obj particles s5-0 part matrix) 0) (let ((v1-53 (sprite-get-user-hvdf (-> obj particles s5-0 part matrix)))) - (set! (-> v1-53 vector x) (the float (+ (the int (-> obj particles s5-0 pos x)) 2048))) - (set! (-> v1-53 vector y) (the float (+ (the int (-> obj particles s5-0 pos y)) 2048))) - (set! (-> v1-53 vector z) (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))) - (set! (-> v1-53 vector w) (-> *math-camera* hvdf-off w)) + (set! (-> v1-53 x) (the float (+ (the int (-> obj particles s5-0 pos x)) 2048))) + (set! (-> v1-53 y) (the float (+ (the int (-> obj particles s5-0 pos y)) 2048))) + (set! (-> v1-53 z) (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z)))) + (set! (-> v1-53 w) (-> *math-camera* hvdf-off w)) ) ) (spawn (-> obj particles s5-0 part) *null-vector*) diff --git a/goal_src/examples/debug-draw-example.gc b/goal_src/examples/debug-draw-example.gc index ec41e0f5eb..a52aeb38be 100644 --- a/goal_src/examples/debug-draw-example.gc +++ b/goal_src/examples/debug-draw-example.gc @@ -143,10 +143,10 @@ (set! (-> local-trans z) (cond ((logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons down)) - -800.0 + -1600.0 ) ((logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons up)) - 800.0 + 1600.0 ) (else 0.0 @@ -175,10 +175,10 @@ ;; global translation (if (logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons l1)) - (set! (-> trans trans y) (+ 800.0 (-> trans trans y))) + (set! (-> trans trans y) (+ 2000.0 (-> trans trans y))) ) (if (logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r1)) - (set! (-> trans trans y) (+ -800.0 (-> trans trans y))) + (set! (-> trans trans y) (+ -2000.0 (-> trans trans y))) ) ;; rotation (don't allow camera roll) diff --git a/goal_src/game.gp b/goal_src/game.gp index ff715948d0..9a99f63929 100644 --- a/goal_src/game.gp +++ b/goal_src/game.gp @@ -210,9 +210,38 @@ "out/iso/KERNEL.CGO" "out/iso/GAME.CGO" "out/iso/VI1.DGO" + "out/iso/VI2.DGO" "out/iso/VI3.DGO" + "out/iso/TRA.DGO" + "out/iso/FIN.DGO" ) +;;;;;;;;;;;;;;;;;;;;;;;; +;; Common Level Objects +;;;;;;;;;;;;;;;;;;;;;;;; + +;; as we find objects that exist in multiple levels, put them here + +(copy-gos + "warpgate-ag" + "sharkey-ag-BEA-TRA-VI2" + ) + + +;;;;;;;;;;;;;;;;;;;;; +;; Common Level Code +;;;;;;;;;;;;;;;;;;;;; + +(goal-src-sequence + "levels/" + :deps ;; no idea what these depend on, make it depend on the whole engine + ("out/obj/default-menu.o") + + "village_common/villagep-obs.gc" + "village_common/oracle.gc" + + ) + ;;;;;;;;;;;;;;;;;;;;; ;; Village 1 @@ -229,8 +258,6 @@ :deps ;; no idea what these depend on, make it depend on the whole engine ("out/obj/default-menu.o") - "village_common/villagep-obs.gc" - "village_common/oracle.gc" "village1/farmer.gc" "village1/explorer.gc" "village1/assistant.gc" @@ -280,20 +307,111 @@ "village-cam-ag-VI1" "village1cam-ag" "warp-gate-switch-ag-VI1-VI3" - "warpgate-ag" "water-anim-village1-ag" "windmill-sail-ag" "windspinner-ag" "yakow-ag" "village1-vis" ) + +;;;;;;;;;;;;;;;;;;;;; +;; Training +;;;;;;;;;;;;;;;;;;;;; + +;; the definition of the DGO package for the level +(cgo "TRA.DGO" + "tra.gd") + +;; The code +(goal-src-sequence + "levels/training/" + :deps ("out/obj/default-menu.o") ;; makes us depend on the whole engine + + "training-obs.gc" + "training-part.gc" + ) + +;; the textures +(copy-textures 1309 1311 1310 1308 775) + +(copy-gos + "ecovalve-ag-TRA" + "jng-iris-door-ag-TRA" + "plat-eco-ag-TRA" + "pontoonfive-ag-TRA" + "scarecrow-a-ag" + "scarecrow-b-ag" + "trainingcam-ag" + "warp-gate-switch-ag-TRA" + "water-anim-training-ag" + "training-vis" + ) + +;;;;;;;;;;;;;;;;;;;;; +;; Village 2 +;;;;;;;;;;;;;;;;;;;;; + +(cgo "VI2.DGO" "vi2.gd") + +(goal-src-sequence + "levels/village2/" + :deps ("out/obj/default-menu.o") + "village2-part.gc" + "village2-obs.gc" + "village2-part2.gc" + "gambler.gc" + "warrior.gc" + "geologist.gc" + "swamp-blimp.gc" + "sage-bluehut.gc" + "flutflut-bluehut.gc" + "assistant-village2.gc" + "sunken-elevator.gc" + ) + +(copy-textures 919 922 920 921 1476) + +(copy-gos + "allpontoons-ag" + "assistant-village2-ag" + "barrel-ag-VI2" + "ceilingflag-ag" + "exit-chamber-dummy-ag" + "fireboulder-ag" + "flutflut-bluehut-ag" + "gambler-ag" + "geologist-ag" + "jaws-ag" + "medres-rolling-ag" + "medres-rolling1-ag" + "medres-village2-ag" + "ogreboss-village2-ag" + "oracle-ag-VI2" + "orb-cache-top-ag-VI2" + "pontoonfive-ag-VI2" + "pontoonten-ag" + "precursor-arm-ag" + "sage-bluehut-ag" + "sunken-elevator-ag" + "swamp-blimp-ag" + "swamp-rope-ag" + "swamp-tetherrock-ag" + "swamp-tetherrock-explode-ag" + "swampcam-ag-VI2" + "village-cam-ag-VI2" + "village2cam-ag" + "warp-gate-switch-ag-VI2" + "warrior-ag" + "water-anim-village2-ag" + "village2-vis" + ) ;;;;;;;;;;;;;;;;;;;;; ;; Village 3 ;;;;;;;;;;;;;;;;;;;;; ;; the definition for the DGO file. -(cgo "VI3.DGO""vi3.gd") +(cgo "VI3.DGO" "vi3.gd") ;; the code (goal-src-sequence @@ -334,6 +452,55 @@ "village3-vis" ) +;;;;;;;;;;;;;;;;;;;;; +;; Final Boss +;;;;;;;;;;;;;;;;;;;;; + +(cgo "FIN.DGO" "fin.gd") + +(goal-src-sequence + "levels/finalboss/" + :deps ("out/obj/default-menu.o") + + "robotboss-h.gc" + "robotboss-part.gc" + "sage-finalboss-part.gc" + "light-eco.gc" + "robotboss-weapon.gc" + "robotboss-misc.gc" + "green-eco-lurker.gc" + "robotboss.gc" + "final-door.gc" + "sage-finalboss-FIN.gc" + ) + +(copy-textures 1419 1420 634 1418 545) + +(copy-gos + "darkecobomb-ag" + "ecoclaw-ag" + "ecovalve-ag-FIN" + "finalbosscam-ag" + "green-eco-lurker-ag" + "green-sagecage-ag" + "greenshot-ag" + "jak-white-ag" + "light-eco-ag" + "plat-eco-finalboss-ag" + "power-left-ag" + "power-right-ag" + "powercellalt-ag" + "redring-ag" + "robotboss-ag" + "robotboss-blueeco-ag" + "robotboss-cinematic-ag" + "robotboss-redeco-ag" + "robotboss-yelloweco-ag" + "silodoor-ag" + "water-anim-finalboss-ag" + "finalboss-vis" + ) + ;;;;;;;;;;;;;;;;;;;;; ;; Game Engine Code ;;;;;;;;;;;;;;;;;;;;; diff --git a/goalc/compiler/Util.cpp b/goalc/compiler/Util.cpp index 5dbdcf3800..47e0e3bafb 100644 --- a/goalc/compiler/Util.cpp +++ b/goalc/compiler/Util.cpp @@ -271,7 +271,7 @@ std::vector Compiler::get_list_as_vector(const goos::Object& o, n++; } else if (cur->is_empty_list()) { if (rest_out) { - *rest_out = goos::EmptyListObject::make_new(); + *rest_out = goos::Object::make_empty_list(); } return result; } diff --git a/goalc/debugger/Debugger.cpp b/goalc/debugger/Debugger.cpp index be94280299..20951d5c02 100644 --- a/goalc/debugger/Debugger.cpp +++ b/goalc/debugger/Debugger.cpp @@ -225,6 +225,8 @@ std::vector Debugger::get_backtrace(u64 rip, u64 rsp) { frame.rip_info.func_debug->stack_usage) { fmt::print("{} from {}\n", frame.rip_info.function_name, frame.rip_info.func_debug->obj_name); // we're good! + auto disasm = disassemble_at_rip(frame.rip_info); + fmt::print("{}\n", disasm.text); u64 rsp_at_call = rsp + *frame.rip_info.func_debug->stack_usage; u64 next_rip = 0; diff --git a/goalc/make/MakeSystem.cpp b/goalc/make/MakeSystem.cpp index 08f90bd124..eee4cf6851 100644 --- a/goalc/make/MakeSystem.cpp +++ b/goalc/make/MakeSystem.cpp @@ -109,7 +109,7 @@ goos::Object MakeSystem::handle_defstep(const goos::Object& form, m_output_to_step.insert({output, step}); } - return goos::EmptyListObject::make_new(); + return goos::Object::make_empty_list(); } /*! diff --git a/scripts/sublime_text/goal.sublime-syntax b/scripts/sublime_text/goal.sublime-syntax index a3cbaab043..358cc0216d 100644 --- a/scripts/sublime_text/goal.sublime-syntax +++ b/scripts/sublime_text/goal.sublime-syntax @@ -9,15 +9,15 @@ contexts: main: # Important keywords for blocks/control flow/etc - - match: \b(?i:begin|block|return-from|cond|when|if|unless|let|else|while|rlet|countdown|dotimes)\b + - match: \b(?i:begin|block|return-from|cond|return|when|if|unless|let|else|while|rlet|countdown|dotimes|case)\b scope: keyword.control.goal # Less important keywords - - match: \b(?i:the-as|the|logior|logand|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|and|not|suspend|lambda)\b + - match: \b(?i:the-as|the|logior|logand|logtest\?|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|declare-type|and|not|lambda|suspend)\s scope: keyword.operator.goal # Definition forms like (def thing value) - - match: \b(?i:(defun|defmacro|deftype|define|defconstant|defun-debug|define-extern))\b\s+([\w\-!?<>]*) + - match: \b(?i:(defun|defmacro|deftype|define|defconstant|defun-debug|define-extern))\s+([\w\-!?<>]*) scope: meta.function.goal captures: 1: keyword.declaration.function.goal @@ -59,7 +59,7 @@ contexts: 1: punctuation.definition.comment.goal # Built-in, numeric type - - match: \b(uint128|int128|float|int64|uint64|int32|uint32|int16|uint16|int8|uint8|binteger|int|uint|pointer)\b + - match: \b(uint128|int128|float|int64|uint64|int32|uint32|int16|uint16|int8|uint8|binteger|int|uint|pointer|array|inline-array)\b scope: storage.type - match: (?i:#t|#f|'\(\)) diff --git a/test/decompiler/reference/engine/game/game-info-h_REF.gc b/test/decompiler/reference/engine/game/game-info-h_REF.gc index f5d81cc152..8595459e7b 100644 --- a/test/decompiler/reference/engine/game/game-info-h_REF.gc +++ b/test/decompiler/reference/engine/game/game-info-h_REF.gc @@ -94,7 +94,7 @@ (backup-load-state-and-set-cmds (_type_ pair) int 17) (restore-load-state-and-cleanup (_type_) int 18) (restore-load-state (_type_) int 19) - (dummy-20 () none 20) + (set-force-inside! (_type_ symbol symbol) none 20) ) ) diff --git a/test/decompiler/reference/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/engine/gfx/sprite/sprite_REF.gc index b67eab7730..6ef93a6bd3 100644 --- a/test/decompiler/reference/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/engine/gfx/sprite/sprite_REF.gc @@ -1256,6 +1256,7 @@ ) ;; definition for function sprite-get-user-hvdf +;; INFO: Return type mismatch qword vs vector. (defun sprite-get-user-hvdf ((arg0 int)) - (-> *sprite-hvdf-data* data arg0) + (the-as vector (-> *sprite-hvdf-data* data arg0)) ) diff --git a/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc index 4121cc313a..11a6554031 100644 --- a/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc +++ b/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc @@ -304,7 +304,7 @@ (define GSH_ENABLE #f) ;; definition for symbol GSH_BUCKET, type bucket-id -(define GSH_BUCKET (bucket-id bucket-3)) +(define GSH_BUCKET (bucket-id sky-draw)) ;; definition for symbol GSH_WHICH_STAT, type int (define GSH_WHICH_STAT 1) diff --git a/test/test_goos.cpp b/test/test_goos.cpp index ff8191da3f..15d53c349f 100644 --- a/test/test_goos.cpp +++ b/test/test_goos.cpp @@ -957,11 +957,9 @@ TEST(GoosObject, char_to_string) { * Test the EmptyListObject */ TEST(GoosObject, EmptyList) { -// TODO-Windows -#ifdef __linux__ // create two empty lists - Object nil = EmptyListObject::make_new(); - Object nil2 = EmptyListObject::make_new(); + Object nil = Object::make_empty_list(); + Object nil2 = Object::make_empty_list(); // check type is set EXPECT_TRUE(nil.is_empty_list()); @@ -969,16 +967,9 @@ TEST(GoosObject, EmptyList) { // check equality operator EXPECT_TRUE(nil == nil2); - // check we get the same heap allocated object - auto elo = std::dynamic_pointer_cast(nil.heap_obj); - auto elo2 = std::dynamic_pointer_cast(nil2.heap_obj); - EXPECT_TRUE(elo); - EXPECT_TRUE(elo == elo2); - // check print and inspect EXPECT_EQ(nil.print(), "()"); EXPECT_EQ(nil.inspect(), "[empty list] ()\n"); -#endif } /*! diff --git a/third-party/googletest b/third-party/googletest index 7153098229..955c7f837e 160000 --- a/third-party/googletest +++ b/third-party/googletest @@ -1 +1 @@ -Subproject commit 7153098229e88295f9655ff1d3b0e2fa9eada5f8 +Subproject commit 955c7f837efad184ec63e771c42542d37545eaef