From 49e3fa2963e8f1a5d233e04aa161854d3e7d8654 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 23 Oct 2021 10:41:11 -0400 Subject: [PATCH] fix decomp bugs and add ref tests (#930) --- decompiler/IR2/AtomicOpTypeAnalysis.cpp | 10 +- decompiler/config/all-types.gc | 2 +- .../config/jak1_ntsc_black_label/hacks.jsonc | 2 +- .../jak1_ntsc_black_label/type_casts.jsonc | 10 +- goal_src/engine/game/game-save.gc | 30 +- goal_src/engine/gfx/sky/sky.gc | 1 + goal_src/kernel/gkernel-h.gc | 2 +- goal_src/kernel/gstate.gc | 8 +- .../decompiler/reference/decompiler-macros.gc | 2 +- .../reference/engine/game/game-save_REF.gc | 2697 +++++++++++ .../reference/engine/gfx/hw/display_REF.gc | 18 +- .../reference/engine/gfx/sky/sky-h_REF.gc | 1 + .../reference/engine/gfx/sky/sky-tng_REF.gc | 1333 ++++++ .../reference/engine/gfx/texture_REF.gc | 2 +- .../reference/engine/gfx/time-of-day_REF.gc | 804 ++++ .../engine/level/load-boundary-data_REF.gc | 4172 +++++++++++++++++ .../engine/level/load-boundary-h_REF.gc | 185 + .../engine/level/load-boundary_REF.gc | 2560 ++++++++++ .../decompiler/reference/kernel/gstate_REF.gc | 13 +- .../levels/misty/misty-conveyor_REF.gc | 6 +- .../levels/swamp/swamp-rat-nest_REF.gc | 2 +- .../reference/levels/swamp/swamp-rat_REF.gc | 2 +- test/offline/config.jsonc | 9 + 23 files changed, 11819 insertions(+), 52 deletions(-) create mode 100644 test/decompiler/reference/engine/game/game-save_REF.gc create mode 100644 test/decompiler/reference/engine/gfx/sky/sky-tng_REF.gc create mode 100644 test/decompiler/reference/engine/gfx/time-of-day_REF.gc create mode 100644 test/decompiler/reference/engine/level/load-boundary-data_REF.gc create mode 100644 test/decompiler/reference/engine/level/load-boundary-h_REF.gc create mode 100644 test/decompiler/reference/engine/level/load-boundary_REF.gc diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 233cc61a5..8c7e1a2f7 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -594,12 +594,18 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input, return TP_Type::make_from_ts(arg0_type.typespec()); } - if ((m_kind == Kind::ADD || m_kind == Kind::SUB) && - arg1_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg0_type)) { + if (m_kind == Kind::ADD && arg1_type.typespec().base_type() == "pointer" && + tc(dts, TypeSpec("integer"), arg0_type)) { // plain pointer plus integer = plain pointer return TP_Type::make_from_ts(arg1_type.typespec()); } + if (m_kind == Kind::SUB && arg1_type.typespec().base_type() == "pointer" && + tc(dts, TypeSpec("integer"), arg0_type)) { + // plain pointer plus integer = plain pointer + return TP_Type::make_from_ts(arg0_type.typespec()); + } + if (m_kind == Kind::ADD && tc(dts, TypeSpec("structure"), arg0_type) && arg1_type.is_integer_constant()) { auto type_info = dts.ts.lookup_type(arg0_type.typespec()); diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 444462938..4840a2d06 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1596,7 +1596,7 @@ (define-extern enter-state (function object object object object object object object)) (define-extern inherit-state (function state state state)) -(define-extern send-event-function (function process event-message-block object)) +(define-extern send-event-function (function process-tree event-message-block object)) (define-extern looping-code (function symbol)) diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index 32daec6e8..447e2dbfd 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -501,7 +501,7 @@ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 ], "(method 11 fact-info-target)": [42], - "(anon-function 9 game-save)": [3, 4, 5, 6, 7, 8], + "(anon-function 9 game-save)": [3, 4, 5, 6, 7, 8, 10], //"(anon-function 9 game-save)":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "particle-adgif": [0, 1, 2, 3, 4, 5, 7], "sp-launch-particles-var": [ diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 3725714ce..4ba7fed3b 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -80,6 +80,10 @@ [101, "t9", "(function object object object object object object none)"] ], + "send-event-function": [ + [[7,12], "a0", "process"] + ], + // MATH "log2": [[3, "v1", "int"]], @@ -2044,11 +2048,11 @@ [[113, 165], "a0", "game-save-tag"], [[148, 166], "s2", "game-save-tag"], [[148, 168], "s4", "game-save-tag"], - [[171, 222], "a0", "game-save-tag"], - [[234, 241], "a0", "game-save-tag"], + [[171, 221], "a0", "game-save-tag"], + [[234, 240], "a0", "game-save-tag"], [[253, 276], "a0", "game-save-tag"], [[283, 302], "a0", "game-save-tag"], - [[319, 325], "a1", "game-save-tag"], + [[319, 324], "a1", "game-save-tag"], [[342, 348], "a1", "game-save-tag"], [[395, 468], "a0", "game-save-tag"], [[480, 488], "a0", "game-save-tag"], diff --git a/goal_src/engine/game/game-save.gc b/goal_src/engine/game/game-save.gc index 12c50a2cf..c5aac4c1e 100644 --- a/goal_src/engine/game/game-save.gc +++ b/goal_src/engine/game/game-save.gc @@ -1799,15 +1799,7 @@ (format 0 "auto-save-init!~%") ;; trying to create multiple auto save procs, bad idea. (when (handle->process (-> *game-info* auto-save-proc)) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) self) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'notify) - (set! (-> a1-2 param 0) (the-as uint 'error)) - (set! (-> a1-2 param 1) (the-as uint 16)) - (format 0 "auto save proc error~%") - (send-event-function (the-as process notify-proc) a1-2) - ) + (send-event notify-proc 'notify 'error 16) (return #f) ) @@ -2243,15 +2235,7 @@ (set! (-> self result) arg0) (let ((s5-0 *auto-save-info*)) (mem-copy! (the-as pointer s5-0) (the-as pointer (-> self info)) 300) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) self) - (set! (-> a1-2 num-params) 3) - (set! (-> a1-2 message) 'notify) - (set! (-> a1-2 param 0) (the-as uint 'error)) - (set! (-> a1-2 param 1) (the-as uint (-> self result))) - (set! (-> a1-2 param 2) (the-as uint s5-0)) - (send-event-function (handle->process (-> self notify)) a1-2) - ) + (send-event (handle->process (-> self notify)) 'notify 'error (-> self result) s5-0) ) (let ((t9-3 format) (a0-7 #t) @@ -2362,15 +2346,7 @@ ) (let ((gp-0 *auto-save-info*)) (mem-copy! (the-as pointer gp-0) (the-as pointer (-> self info)) 300) - (let ((a1-5 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-5 from) self) - (set! (-> a1-5 num-params) 3) - (set! (-> a1-5 message) 'notify) - (set! (-> a1-5 param 0) (the-as uint 'done)) - (set! (-> a1-5 param 1) (the-as uint 1)) - (set! (-> a1-5 param 2) (the-as uint gp-0)) - (send-event-function (handle->process (-> self notify)) a1-5) - ) + (send-event (handle->process (-> self notify)) 'notify 'done 1 gp-0) ) (case (-> self mode) (('auto-save) diff --git a/goal_src/engine/gfx/sky/sky.gc b/goal_src/engine/gfx/sky/sky.gc index 834de8483..3b74a71cf 100644 --- a/goal_src/engine/gfx/sky/sky.gc +++ b/goal_src/engine/gfx/sky/sky.gc @@ -118,6 +118,7 @@ ;; skipping old sky stuff (for now) (define sky-vu1-block (new 'static 'vu-function)) +;; this stuff seems to only be used by the "old" sky renderer, which is never used. ;; TODO sky-init-upload-data ;; sky-add-frame-data ;; sky-upload diff --git a/goal_src/kernel/gkernel-h.gc b/goal_src/kernel/gkernel-h.gc index fb0b040ae..5e400e478 100644 --- a/goal_src/kernel/gkernel-h.gc +++ b/goal_src/kernel/gkernel-h.gc @@ -429,7 +429,7 @@ ;; perhaps when deleting a process you could have it set self to #f? ;; I don't see this happen anywhere though, so it's not clear. `(let ((the-pp ,ppointer)) - (the process (if the-pp (-> the-pp 0 self))) + (the process-tree (if the-pp (-> the-pp 0 self))) ) ) diff --git a/goal_src/kernel/gstate.gc b/goal_src/kernel/gstate.gc index 1b87e4619..8f983017c 100644 --- a/goal_src/kernel/gstate.gc +++ b/goal_src/kernel/gstate.gc @@ -428,14 +428,14 @@ It type checks the arguments for the entry function. ) ) -(defun send-event-function ((proc process) (msg event-message-block)) +(defun send-event-function ((proc process-tree) (msg event-message-block)) "Function to send an event to a process. Please use the send-event macros when possible" (with-pp - (when (and proc (!= (-> proc type) process-tree) (-> proc event-hook)) + (when (and proc (!= (-> proc type) process-tree) (-> (the process proc) event-hook)) (let ((pp-backup pp)) - (set! pp proc) - (let ((result ((-> proc event-hook) (-> msg from) (-> msg num-params) (-> msg message) msg))) + (set! pp (the process proc)) + (let ((result ((-> (the process proc) event-hook) (-> msg from) (-> msg num-params) (-> msg message) msg))) (set! pp pp-backup) result ) diff --git a/test/decompiler/reference/decompiler-macros.gc b/test/decompiler/reference/decompiler-macros.gc index 5b3c3ea95..b66bde0bb 100644 --- a/test/decompiler/reference/decompiler-macros.gc +++ b/test/decompiler/reference/decompiler-macros.gc @@ -111,7 +111,7 @@ ;; perhaps when deleting a process you could have it set self to #f? ;; I don't see this happen anywhere though, so it's not clear. `(let ((the-pp ,ppointer)) - (the process (if the-pp (-> the-pp 0 self))) + (the process-tree (if the-pp (-> the-pp 0 self))) ) ) diff --git a/test/decompiler/reference/engine/game/game-save_REF.gc b/test/decompiler/reference/engine/game/game-save_REF.gc new file mode 100644 index 000000000..3af9aed7f --- /dev/null +++ b/test/decompiler/reference/engine/game/game-save_REF.gc @@ -0,0 +1,2697 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type game-save-tag +(deftype game-save-tag (structure) + ((user-object object 2 :offset-assert 0) + (user-uint64 uint64 :offset 0) + (user-float0 float :offset 0) + (user-float float 2 :offset 0) + (user-int32 int32 2 :offset 0) + (user-uint32 uint32 2 :offset 0) + (user-int16 int16 4 :offset 0) + (user-uint16 uint16 4 :offset 0) + (user-int8 int8 8 :offset 0) + (user-int80 int8 :offset 0) + (user-int81 int8 :offset 1) + (user-uint8 uint8 8 :offset 0) + (elt-count int32 :offset-assert 8) + (elt-size uint16 :offset-assert 12) + (elt-type game-save-elt :offset-assert 14) + ) + :method-count-assert 9 + :size-assert #x10 + :flag-assert #x900000010 + ) + +;; definition for method 3 of type game-save-tag +(defmethod inspect game-save-tag ((obj game-save-tag)) + (format #t "[~8x] ~A~%" obj 'game-save-tag) + (format #t "~Tuser-object[2] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-uint64: ~D~%" (-> obj user-uint64)) + (format #t "~Tuser-float0: ~f~%" (-> obj user-float0)) + (format #t "~Tuser-float[2] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-int32[2] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-uint32[2] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-int16[4] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-uint16[4] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-int8[8] @ #x~X~%" (-> obj user-object)) + (format #t "~Tuser-int80: ~D~%" (-> obj user-int80)) + (format #t "~Tuser-int81: ~D~%" (-> obj user-int81)) + (format #t "~Tuser-uint8[8] @ #x~X~%" (-> obj user-object)) + (format #t "~Telt-count: ~D~%" (-> obj elt-count)) + (format #t "~Telt-size: ~D~%" (-> obj elt-size)) + (format #t "~Telt-type: ~D~%" (-> obj elt-type)) + obj + ) + +;; definition of type game-save +(deftype game-save (basic) + ((version int32 :offset-assert 4) + (allocated-length int32 :offset-assert 8) + (length int32 :offset-assert 12) + (info-int32 int32 16 :offset-assert 16) + (info-int8 int8 64 :offset 16) + (level-index int32 :offset 16) + (fuel-cell-count float :offset 20) + (money-count float :offset 24) + (buzzer-count float :offset 28) + (completion-percentage float :offset 32) + (minute uint8 :offset 36) + (hour uint8 :offset 37) + (week uint8 :offset 38) + (day uint8 :offset 39) + (month uint8 :offset 40) + (year uint8 :offset 41) + (new-game int32 :offset 44) + (tag game-save-tag :inline :dynamic :offset-assert 80) + ) + :method-count-assert 12 + :size-assert #x50 + :flag-assert #xc00000050 + (:methods + (new (symbol type int) _type_ 0) + (save-to-file (_type_ string) _type_ 9) + (load-from-file! (_type_ string) _type_ 10) + (debug-print (_type_ symbol) _type_ 11) + ) + ) + +;; definition for method 3 of type game-save +;; INFO: this function exists in multiple non-identical object files +(defmethod inspect game-save ((obj game-save)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tversion: ~D~%" (-> obj version)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tinfo-int32[16] @ #x~X~%" (-> obj info-int32)) + (format #t "~Tinfo-int8[64] @ #x~X~%" (-> obj info-int32)) + (format #t "~Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~Tfuel-cell-count: ~f~%" (-> obj fuel-cell-count)) + (format #t "~Tmoney-count: ~f~%" (-> obj money-count)) + (format #t "~Tbuzzer-count: ~f~%" (-> obj buzzer-count)) + (format #t "~Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) + (format #t "~Tminute: #x~X~%" (-> obj minute)) + (format #t "~Thour: #x~X~%" (-> obj hour)) + (format #t "~Tweek: #x~X~%" (-> obj week)) + (format #t "~Tday: #x~X~%" (-> obj day)) + (format #t "~Tmonth: #x~X~%" (-> obj month)) + (format #t "~Tyear: #x~X~%" (-> obj year)) + (format #t "~Tnew-game: ~D~%" (-> obj new-game)) + (format #t "~Ttag[0] @ #x~X~%" (-> obj tag)) + obj + ) + +;; definition for method 5 of type game-save +;; INFO: Return type mismatch uint vs int. +(defmethod asize-of game-save ((obj game-save)) + (the-as int (+ (-> game-save size) (-> obj allocated-length))) + ) + +;; definition for method 0 of type game-save +(defmethod new game-save ((allocation symbol) (type-to-make type) (arg0 int)) + (let + ((v0-0 + (object-new + allocation + type-to-make + (the-as int (+ (-> type-to-make size) arg0)) + ) + ) + ) + (set! (-> v0-0 version) 1) + (set! (-> v0-0 allocated-length) arg0) + v0-0 + ) + ) + +;; definition (debug) for function game-save-elt->string +(defun-debug game-save-elt->string ((arg0 game-save-elt)) + (case arg0 + (((game-save-elt aspect-ratio)) + "aspect-ratio" + ) + (((game-save-elt video-mode)) + "video-mode" + ) + (((game-save-elt play-hints)) + "play-hints" + ) + (((game-save-elt vibration)) + "vibration" + ) + (((game-save-elt screeny)) + "screeny" + ) + (((game-save-elt screenx)) + "screenx" + ) + (((game-save-elt language)) + "language" + ) + (((game-save-elt dialog-volume)) + "dialog-volume" + ) + (((game-save-elt music-volume)) + "music-volume" + ) + (((game-save-elt sfx-volume)) + "sfx-volume" + ) + (((game-save-elt in-level-time)) + "in-level-time" + ) + (((game-save-elt auto-save-count)) + "auto-save-count" + ) + (((game-save-elt death-pos)) + "death-pos" + ) + (((game-save-elt deaths-per-level)) + "deaths-per-level" + ) + (((game-save-elt enter-level-time)) + "enter-level-time" + ) + (((game-save-elt fuel-cell-time)) + "fuel-cell-time" + ) + (((game-save-elt continue-time)) + "continue-time" + ) + (((game-save-elt fuel-cell-pickup-time)) + "fuel-cell-pickup-time" + ) + (((game-save-elt hit-time)) + "hit-time" + ) + (((game-save-elt death-time)) + "death-time" + ) + (((game-save-elt continue-timke)) + "continue-timke" + ) + (((game-save-elt game-start-time)) + "game-start-time" + ) + (((game-save-elt fuel-cell-deaths)) + "fuel-cell-deaths" + ) + (((game-save-elt continue-deaths)) + "continue-deaths" + ) + (((game-save-elt total-deaths)) + "total-deaths" + ) + (((game-save-elt level-open-list)) + "level-open-list" + ) + (((game-save-elt text-list)) + "text-list" + ) + (((game-save-elt hint-list)) + "hint-list" + ) + (((game-save-elt perm-list)) + "perm-list" + ) + (((game-save-elt task-list)) + "task-list" + ) + (((game-save-elt death-movie-tick)) + "death-movie-tick" + ) + (((game-save-elt fuel-cell)) + "fuel-cell" + ) + (((game-save-elt buzzer-total)) + "buzzer-total" + ) + (((game-save-elt moeny-per-level)) + "money-per-level" + ) + (((game-save-elt money-total)) + "money-total" + ) + (((game-save-elt money)) + "money" + ) + (((game-save-elt life)) + "life" + ) + (((game-save-elt continue)) + "continue" + ) + (((game-save-elt integral-time)) + "integral-time" + ) + (((game-save-elt game-time)) + "game-time" + ) + (((game-save-elt real-time)) + "real-time" + ) + (((game-save-elt base-time)) + "base-time" + ) + (((game-save-elt name)) + "name" + ) + (else + "*unknown*" + ) + ) + ) + +;; definition for function progress-level-index->string +(defun progress-level-index->string ((arg0 int)) + (if (< arg0 (-> *level-task-data* length)) + (lookup-text! *common-text* (-> *level-task-data* arg0 level-name-id) #f) + (the-as string #f) + ) + ) + +;; definition for method 11 of type game-save +;; Used lq/sq +(defmethod debug-print game-save ((obj game-save) (detail symbol)) + (local-vars (sv-16 int)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tversion: ~D~%" (-> obj version)) + (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~Tlength: ~D~%" (-> obj length)) + (format #t "~Tlevel-index: ~D~%" (-> obj level-index)) + (format #t "~Tfuel-cell-count: ~f~%" (-> obj fuel-cell-count)) + (format #t "~Tmoney-count: ~f~%" (-> obj money-count)) + (format #t "~Tbuzzer-count: ~f~%" (-> obj buzzer-count)) + (format #t "~Tcompletion-percentage: ~f~%" (-> obj completion-percentage)) + (format + #t + "~Tsave-time: ~x:~x ~x/~x/~x~%" + (-> obj hour) + (-> obj minute) + (-> obj day) + (-> obj month) + (-> obj year) + ) + (format #t "~Ttag[]: @ #x~X~%" (-> obj tag)) + (let ((tag (the-as game-save-tag (-> obj tag))) + (tag-idx 0) + ) + (while + (< (the-as int tag) (the-as int (&-> obj tag 0 user-int8 (-> obj length)))) + (let ((s2-0 format) + (s1-0 #t) + (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") + ) + (set! sv-16 tag-idx) + (let ((a3-2 (game-save-elt->string (-> tag elt-type))) + (t0-1 (-> tag elt-count)) + (t1-1 (-> tag elt-size)) + (t2-1 (-> tag user-uint64)) + (t3-0 (-> tag user-float0)) + ) + (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) + ) + ) + (let ((v1-0 (-> tag elt-type))) + (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) + (format #t "= \"~G\"~%" (&+ (the-as pointer tag) 16)) + (format #t "~%") + ) + ) + (when detail + (case (-> tag elt-type) + (((game-save-elt moeny-per-level) (game-save-elt deaths-per-level)) + (dotimes (prog-lev-idx (-> tag elt-count)) + (let ((lev-name (progress-level-index->string prog-lev-idx))) + (if lev-name + (format + #t + " ~-32S: ~D~%" + lev-name + (-> + (the-as + (pointer uint8) + (&+ + (the-as pointer (&-> (the-as (pointer uint8) tag) 16)) + prog-lev-idx + ) + ) + ) + ) + ) + ) + ) + ) + (((game-save-elt enter-level-time)) + (dotimes (s2-2 (-> tag elt-count)) + (let ((a2-14 (progress-level-index->string s2-2))) + (if a2-14 + (format + #t + " ~-32S: ~D~%" + a2-14 + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer tag) 16) (* s2-2 8)) + ) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (dotimes (s2-3 (-> tag elt-count)) + (let ((a2-15 (progress-level-index->string s2-3))) + (if a2-15 + (format + #t + " ~-32S: ~D~%" + a2-15 + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer tag) 16) (* s2-3 8)) + ) + ) + ) + ) + ) + ) + ) + (((game-save-elt fuel-cell-time)) + (dotimes (s2-4 (-> tag elt-count)) + (let ((a2-16 (game-task->string (the-as game-task s2-4)))) + (if a2-16 + (format + #t + " ~-32S: ~D~%" + a2-16 + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer tag) 16) (* s2-4 8)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! + tag + (the-as + game-save-tag + (&+ + (the-as pointer tag) + (logand -16 (+ (* (the-as int (-> tag elt-size)) (-> tag elt-count)) 31)) + ) + ) + ) + (+! tag-idx 1) + ) + ) + obj + ) + +;; definition for method 3 of type game-save +;; INFO: this function exists in multiple non-identical object files +(defmethod inspect game-save ((obj game-save)) + (debug-print obj #f) + ) + +;; definition for method 24 of type game-info +;; INFO: Return type mismatch game-save vs none. +(defmethod save-game! game-info ((obj game-info) (arg0 game-save) (arg1 string)) + (dotimes (s3-0 (-> *level* length)) + (let ((a1-1 (-> *level* level s3-0))) + (if (= (-> a1-1 status) 'active) + (copy-perms-from-level! obj a1-1) + ) + ) + ) + (set! (-> arg0 length) 0) + (set! (-> arg0 version) 1) + (set! + (-> arg0 level-index) + (-> (lookup-level-info (-> obj current-continue level)) index) + ) + (set! (-> arg0 fuel-cell-count) (-> obj fuel)) + (set! (-> arg0 money-count) (-> obj money-total)) + (set! (-> arg0 buzzer-count) (-> obj buzzer-total)) + (set! + (-> arg0 completion-percentage) + (calculate-completion (the-as progress #f)) + ) + (when (string= (-> obj current-continue name) "title-start") + (set! (-> arg0 new-game) 1) + (set! (-> arg0 level-index) (-> (lookup-level-info 'training) index)) + (set! (-> arg0 fuel-cell-count) 0.0) + (set! (-> arg0 money-count) 0.0) + (set! (-> arg0 buzzer-count) 0.0) + (set! (-> arg0 completion-percentage) 0.0) + ) + (let ((s3-1 (new 'stack 'scf-time))) + (scf-get-time s3-1) + (when (zero? (-> s3-1 stat)) + (set! (-> arg0 minute) (-> s3-1 minute)) + (set! (-> arg0 hour) (-> s3-1 hour)) + (set! (-> arg0 day) (-> s3-1 day)) + (set! (-> arg0 week) (-> s3-1 week)) + (set! (-> arg0 month) (-> s3-1 month)) + (set! (-> arg0 year) (-> s3-1 year)) + ) + ) + (let ((s3-2 (the-as object (-> arg0 tag)))) + (let ((s2-0 (-> (the-as (inline-array game-save-tag) s3-2) 0))) + (set! (-> s2-0 elt-type) (game-save-elt name)) + (set! (-> s2-0 elt-count) (+ (length arg1) 1)) + (set! (-> s2-0 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp + (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s3-2) 1)) + (-> arg1 data) + ) + (let + ((v1-37 + (&+ + (the-as pointer s3-2) + (+ + (logand + -16 + (+ (-> (the-as (inline-array game-save-tag) s3-2) 0 elt-count) 15) + ) + 16 + ) + ) + ) + ) + (let ((a0-15 (the-as game-save-tag (&+ v1-37 0)))) + (set! (-> a0-15 elt-type) (game-save-elt base-time)) + (set! (-> a0-15 elt-count) 0) + (set! + (-> a0-15 user-uint64) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (let ((v1-38 (&+ v1-37 16))) + (let ((a0-16 (the-as game-save-tag (&+ v1-38 0)))) + (set! (-> a0-16 elt-type) (game-save-elt real-time)) + (set! (-> a0-16 elt-count) 0) + (set! + (-> a0-16 user-uint64) + (the-as uint (-> *display* real-frame-counter)) + ) + ) + (let ((v1-39 (&+ v1-38 16))) + (let ((a0-17 (the-as game-save-tag (&+ v1-39 0)))) + (set! (-> a0-17 elt-type) (game-save-elt game-time)) + (set! (-> a0-17 elt-count) 0) + (set! + (-> a0-17 user-uint64) + (the-as uint (-> *display* game-frame-counter)) + ) + ) + (let ((v1-40 (&+ v1-39 16))) + (let ((a0-18 (the-as game-save-tag (&+ v1-40 0)))) + (set! (-> a0-18 elt-type) (game-save-elt integral-time)) + (set! (-> a0-18 elt-count) 0) + (set! + (-> a0-18 user-uint64) + (the-as uint (-> *display* integral-frame-counter)) + ) + ) + (let ((s4-1 (the-as object (&+ v1-40 16)))) + (let ((s3-3 (-> obj current-continue name))) + (let + ((s2-1 + (the-as game-save-tag (-> (the-as game-save-tag s4-1) user-object)) + ) + ) + (set! (-> s2-1 elt-type) (game-save-elt continue)) + (set! (-> s2-1 elt-count) (+ ((method-of-type string length) s3-3) 1)) + (set! (-> s2-1 elt-size) (the-as uint 1)) + ) + (copy-charp<-charp + (the-as + (pointer uint8) + (the-as game-save-tag (&+ (the-as game-save-tag s4-1) 16)) + ) + (-> s3-3 data) + ) + ) + (let + ((v1-50 + (&+ + (the-as pointer s4-1) + (+ + (logand -16 (+ (-> (the-as game-save-tag s4-1) elt-count) 15)) + 16 + ) + ) + ) + ) + (let ((a0-24 (the-as game-save-tag (&+ v1-50 0)))) + (set! (-> a0-24 elt-type) (game-save-elt life)) + (set! (-> a0-24 elt-count) 0) + (set! (-> a0-24 user-float0) (-> obj life)) + ) + (let ((v1-51 (&+ v1-50 16))) + (let ((a0-25 (the-as game-save-tag (&+ v1-51 0)))) + (set! (-> a0-25 elt-type) (game-save-elt buzzer-total)) + (set! (-> a0-25 elt-count) 0) + (set! (-> a0-25 user-float0) (-> obj buzzer-total)) + ) + (let ((v1-52 (&+ v1-51 16))) + (let ((a0-26 (the-as game-save-tag (&+ v1-52 0)))) + (set! (-> a0-26 elt-type) (game-save-elt fuel-cell)) + (set! (-> a0-26 elt-count) 0) + (set! (-> a0-26 user-float0) (-> obj fuel)) + ) + (let ((v1-53 (&+ v1-52 16))) + (let ((a0-27 (the-as game-save-tag (&+ v1-53 0)))) + (set! (-> a0-27 elt-type) (game-save-elt death-movie-tick)) + (set! (-> a0-27 elt-count) 0) + (set! + (-> a0-27 user-uint64) + (the-as uint (-> obj death-movie-tick)) + ) + ) + (let ((v1-54 (&+ v1-53 16))) + (let ((a0-28 (the-as game-save-tag (&+ v1-54 0)))) + (set! (-> a0-28 elt-type) (game-save-elt money)) + (set! (-> a0-28 elt-count) 0) + (set! (-> a0-28 user-float0) (-> obj money)) + ) + (let ((v1-55 (&+ v1-54 16))) + (let ((a0-29 (the-as game-save-tag (&+ v1-55 0)))) + (set! (-> a0-29 elt-type) (game-save-elt money-total)) + (set! (-> a0-29 elt-count) 0) + (set! (-> a0-29 user-float0) (-> obj money-total)) + ) + (let ((v1-56 (&+ v1-55 16))) + (let ((a0-30 (the-as game-save-tag (&+ v1-56 0)))) + (set! (-> a0-30 elt-type) (game-save-elt moeny-per-level)) + (set! (-> a0-30 elt-count) 32) + (set! (-> a0-30 elt-size) (the-as uint 1)) + ) + (let ((v1-57 (&+ v1-56 16))) + (dotimes (a0-31 32) + (set! + (-> (the-as (pointer uint8) (&+ v1-57 a0-31))) + (-> obj money-per-level a0-31) + ) + ) + (let ((v1-58 (&+ v1-57 32))) + (let ((a0-34 (the-as object (&+ v1-58 0)))) + (set! + (-> (the-as game-save-tag a0-34) elt-type) + (game-save-elt level-open-list) + ) + (set! (-> (the-as game-save-tag a0-34) elt-count) 32) + (set! + (-> (the-as game-save-tag a0-34) elt-size) + (the-as uint 1) + ) + ) + (let ((v1-59 (&+ v1-58 16))) + (dotimes (a0-35 32) + (set! + (-> (the-as (pointer uint8) (&+ v1-59 a0-35))) + (-> obj level-opened a0-35) + ) + ) + (let ((v1-60 (&+ v1-59 32)) + (s4-2 + (-> (the-as (pointer int32) (-> obj perm-list)) 0) + ) + ) + (let ((a0-39 (the-as game-save-tag (&+ v1-60 0)))) + (set! (-> a0-39 elt-type) (game-save-elt perm-list)) + (set! (-> a0-39 elt-count) s4-2) + (set! (-> a0-39 elt-size) (the-as uint 16)) + ) + (let ((s3-4 (&+ v1-60 16))) + (dotimes (s2-2 s4-2) + (mem-copy! + (the-as + pointer + (the-as game-save-tag (&+ s3-4 (* s2-2 16))) + ) + (the-as pointer (-> obj perm-list data s2-2)) + 16 + ) + ) + (let ((v1-68 (&+ s3-4 (logand -16 (+ (* s4-2 16) 15)))) + (s4-3 (-> obj task-perm-list length)) + ) + (let ((a0-45 (the-as game-save-tag (&+ v1-68 0)))) + (set! (-> a0-45 elt-type) (game-save-elt task-list)) + (set! (-> a0-45 elt-count) s4-3) + (set! (-> a0-45 elt-size) (the-as uint 16)) + ) + (let ((s3-5 (&+ v1-68 16))) + (dotimes (s2-3 s4-3) + (mem-copy! + (the-as + pointer + (the-as game-save-tag (&+ s3-5 (* s2-3 16))) + ) + (the-as pointer (-> obj task-perm-list data s2-3)) + 16 + ) + ) + (let ((a0-49 (&+ s3-5 (logand -16 (+ (* s4-3 16) 15)))) + (v1-79 + (/ + (logand + -8 + (+ (-> obj text-ids-seen allocated-length) 7) + ) + 8 + ) + ) + ) + (let ((a1-46 (the-as object (&+ a0-49 0)))) + (set! + (-> (the-as game-save-tag a1-46) elt-type) + (game-save-elt text-list) + ) + (set! (-> (the-as game-save-tag a1-46) elt-count) v1-79) + (set! + (-> (the-as game-save-tag a1-46) elt-size) + (the-as uint 1) + ) + ) + (let ((a0-50 (&+ a0-49 16))) + (dotimes (a1-47 v1-79) + (set! + (-> (the-as (pointer uint8) (&+ a0-50 a1-47))) + (-> obj text-ids-seen bytes a1-47) + ) + ) + (let ((a0-51 (&+ a0-50 (logand -16 (+ v1-79 15)))) + (v1-84 (-> obj hint-control length)) + ) + (let ((a1-51 (the-as game-save-tag (&+ a0-51 0)))) + (set! (-> a1-51 elt-type) (game-save-elt hint-list)) + (set! (-> a1-51 elt-count) v1-84) + (set! (-> a1-51 elt-size) (the-as uint 32)) + ) + (let ((a0-52 (&+ a0-51 16))) + (dotimes (a1-52 v1-84) + (set! + (-> + (the-as + (pointer int64) + (&+ a0-52 (* (* a1-52 4) 8)) + ) + ) + (-> obj hint-control a1-52 start-time) + ) + (set! + (-> + (the-as + (pointer int64) + (&+ a0-52 (* (+ (* a1-52 4) 1) 8)) + ) + ) + (-> obj hint-control a1-52 last-time-called) + ) + (set! + (-> + (the-as + (pointer int8) + (&+ a0-52 (+ (* a1-52 32) 16)) + ) + ) + (-> obj hint-control a1-52 num-attempts) + ) + (set! + (-> + (the-as + (pointer int8) + (&+ a0-52 (+ (* a1-52 32) 17)) + ) + ) + (-> obj hint-control a1-52 num-success) + ) + ) + (let ((v1-86 (&+ a0-52 (* v1-84 32)))) + (let ((a0-54 (the-as game-save-tag (&+ v1-86 0)))) + (set! + (-> a0-54 elt-type) + (game-save-elt auto-save-count) + ) + (set! (-> a0-54 elt-count) 0) + (set! + (-> a0-54 user-uint64) + (the-as uint (-> obj auto-save-count)) + ) + ) + (let ((v1-87 (&+ v1-86 16))) + (let ((a0-55 (the-as game-save-tag (&+ v1-87 0)))) + (set! + (-> a0-55 elt-type) + (game-save-elt total-deaths) + ) + (set! (-> a0-55 elt-count) 0) + (set! + (-> a0-55 user-uint64) + (the-as uint (-> obj total-deaths)) + ) + ) + (let ((v1-88 (&+ v1-87 16))) + (let ((a0-56 (the-as game-save-tag (&+ v1-88 0)))) + (set! + (-> a0-56 elt-type) + (game-save-elt continue-deaths) + ) + (set! (-> a0-56 elt-count) 0) + (set! + (-> a0-56 user-uint64) + (the-as uint (-> obj continue-deaths)) + ) + ) + (let ((v1-89 (&+ v1-88 16))) + (let ((a0-57 (the-as game-save-tag (&+ v1-89 0)))) + (set! + (-> a0-57 elt-type) + (game-save-elt fuel-cell-deaths) + ) + (set! (-> a0-57 elt-count) 0) + (set! + (-> a0-57 user-uint64) + (the-as uint (-> obj fuel-cell-deaths)) + ) + ) + (let ((v1-90 (&+ v1-89 16))) + (let + ((a0-58 (the-as game-save-tag (&+ v1-90 0)))) + (set! + (-> a0-58 elt-type) + (game-save-elt game-start-time) + ) + (set! (-> a0-58 elt-count) 0) + (set! + (-> a0-58 user-uint64) + (the-as uint (-> obj game-start-time)) + ) + ) + (let ((v1-91 (&+ v1-90 16))) + (let + ((a0-59 (the-as game-save-tag (&+ v1-91 0)))) + (set! + (-> a0-59 elt-type) + (game-save-elt continue-time) + ) + (set! (-> a0-59 elt-count) 0) + (set! + (-> a0-59 user-uint64) + (the-as uint (-> obj continue-time)) + ) + ) + (let ((v1-92 (&+ v1-91 16))) + (let + ((a0-60 (the-as game-save-tag (&+ v1-92 0)))) + (set! + (-> a0-60 elt-type) + (game-save-elt death-time) + ) + (set! (-> a0-60 elt-count) 0) + (set! + (-> a0-60 user-uint64) + (the-as uint (-> obj death-time)) + ) + ) + (let ((v1-93 (&+ v1-92 16))) + (let + ((a0-61 (the-as game-save-tag (&+ v1-93 0)))) + (set! + (-> a0-61 elt-type) + (game-save-elt hit-time) + ) + (set! (-> a0-61 elt-count) 0) + (set! + (-> a0-61 user-uint64) + (the-as uint (-> obj hit-time)) + ) + ) + (let ((v1-94 (&+ v1-93 16))) + (let + ((a0-62 (the-as game-save-tag (&+ v1-94 0))) + ) + (set! + (-> a0-62 elt-type) + (game-save-elt fuel-cell-pickup-time) + ) + (set! (-> a0-62 elt-count) 0) + (set! + (-> a0-62 user-uint64) + (the-as + uint + (-> obj fuel-cell-pickup-time) + ) + ) + ) + (let ((v1-95 (&+ v1-94 16))) + (let + ((a0-63 + (the-as game-save-tag (&+ v1-95 0)) + ) + ) + (set! + (-> a0-63 elt-type) + (game-save-elt fuel-cell-time) + ) + (set! (-> a0-63 elt-count) 116) + (set! (-> a0-63 elt-size) (the-as uint 8)) + ) + (let ((v1-96 (&+ v1-95 16))) + (let ((a0-64 (the-as object 0))) + (while (< (the-as int a0-64) 116) + (set! + (-> + (the-as + (pointer int64) + (&+ v1-96 (* (the-as int a0-64) 8)) + ) + ) + (-> + obj + fuel-cell-time + (the-as int a0-64) + ) + ) + (set! a0-64 (+ (the-as int a0-64) 1)) + ) + ) + (let ((v1-97 (&+ v1-96 928))) + (let + ((a0-67 + (the-as game-save-tag (&+ v1-97 0)) + ) + ) + (set! + (-> a0-67 elt-type) + (game-save-elt deaths-per-level) + ) + (set! (-> a0-67 elt-count) 32) + (set! + (-> a0-67 elt-size) + (the-as uint 1) + ) + ) + (let ((v1-98 (&+ v1-97 16))) + (dotimes (a0-68 32) + (set! + (-> + (the-as + (pointer uint8) + (&+ v1-98 a0-68) + ) + ) + (-> obj deaths-per-level a0-68) + ) + ) + (let ((v1-99 (&+ v1-98 32))) + (let + ((a0-71 + (the-as game-save-tag (&+ v1-99 0)) + ) + ) + (set! + (-> a0-71 elt-type) + (game-save-elt enter-level-time) + ) + (set! (-> a0-71 elt-count) 32) + (set! + (-> a0-71 elt-size) + (the-as uint 8) + ) + ) + (let ((v1-100 (&+ v1-99 16))) + (dotimes (a0-72 32) + (set! + (-> + (the-as + (pointer int64) + (&+ v1-100 (* a0-72 8)) + ) + ) + (-> obj enter-level-time a0-72) + ) + ) + (let ((v1-101 (&+ v1-100 256))) + (let + ((a0-75 + (the-as + game-save-tag + (&+ v1-101 0) + ) + ) + ) + (set! + (-> a0-75 elt-type) + (game-save-elt in-level-time) + ) + (set! (-> a0-75 elt-count) 32) + (set! + (-> a0-75 elt-size) + (the-as uint 8) + ) + ) + (let ((v1-102 (&+ v1-101 16))) + (dotimes (a0-76 32) + (set! + (-> + (the-as + (pointer int64) + (&+ v1-102 (* a0-76 8)) + ) + ) + (-> obj in-level-time a0-76) + ) + ) + (let ((v1-103 (&+ v1-102 256))) + (let + ((a0-79 + (the-as + game-save-tag + (&+ v1-103 0) + ) + ) + ) + (set! + (-> a0-79 elt-type) + (game-save-elt sfx-volume) + ) + (set! (-> a0-79 elt-count) 0) + (set! + (-> a0-79 user-float0) + (-> + *setting-control* + default + sfx-volume + ) + ) + ) + (let ((v1-104 (&+ v1-103 16))) + (let + ((a0-80 + (the-as + game-save-tag + (&+ v1-104 0) + ) + ) + ) + (set! + (-> a0-80 elt-type) + (game-save-elt music-volume) + ) + (set! (-> a0-80 elt-count) 0) + (set! + (-> a0-80 user-float0) + (-> + *setting-control* + default + music-volume + ) + ) + ) + (let ((v1-105 (&+ v1-104 16))) + (let + ((a0-81 + (the-as + game-save-tag + (&+ v1-105 0) + ) + ) + ) + (set! + (-> a0-81 elt-type) + (game-save-elt dialog-volume) + ) + (set! (-> a0-81 elt-count) 0) + (set! + (-> a0-81 user-float0) + (-> + *setting-control* + default + dialog-volume + ) + ) + ) + (let ((v1-106 (&+ v1-105 16))) + (let + ((a0-82 + (the-as + game-save-tag + (&+ v1-106 0) + ) + ) + ) + (set! + (-> a0-82 elt-type) + (game-save-elt language) + ) + (set! (-> a0-82 elt-count) 0) + (set! + (-> a0-82 user-uint64) + (the-as + uint + (-> + *setting-control* + default + language + ) + ) + ) + ) + (let ((v1-107 (&+ v1-106 16))) + (let + ((a0-83 + (the-as + game-save-tag + (&+ v1-107 0) + ) + ) + ) + (set! + (-> a0-83 elt-type) + (game-save-elt screenx) + ) + (set! (-> a0-83 elt-count) 0) + (set! + (-> a0-83 user-float0) + (the + float + (-> + *setting-control* + default + screenx + ) + ) + ) + ) + (let ((v1-108 (&+ v1-107 16))) + (let + ((a0-84 + (the-as + game-save-tag + (&+ v1-108 0) + ) + ) + ) + (set! + (-> a0-84 elt-type) + (game-save-elt screeny) + ) + (set! (-> a0-84 elt-count) 0) + (set! + (-> a0-84 user-float0) + (the + float + (-> + *setting-control* + default + screeny + ) + ) + ) + ) + (let ((v1-109 (&+ v1-108 16))) + (let + ((a0-85 + (the-as + game-save-tag + (&+ v1-109 0) + ) + ) + ) + (set! + (-> a0-85 elt-type) + (game-save-elt vibration) + ) + (set! (-> a0-85 elt-count) 0) + (set! + (-> a0-85 user-uint64) + (the-as + uint + (if + (-> + *setting-control* + default + vibration + ) + 1 + 0 + ) + ) + ) + ) + (let ((v1-110 (&+ v1-109 16))) + (let + ((a0-86 + (the-as + game-save-tag + (&+ v1-110 0) + ) + ) + ) + (set! + (-> a0-86 elt-type) + (game-save-elt play-hints) + ) + (set! + (-> a0-86 elt-count) + 0 + ) + (set! + (-> a0-86 user-uint64) + (the-as + uint + (if + (-> + *setting-control* + default + play-hints + ) + 1 + 0 + ) + ) + ) + ) + (let + ((v1-111 (&+ v1-110 16))) + (let + ((a0-87 + (the-as + game-save-tag + (&+ v1-111 0) + ) + ) + ) + (set! + (-> a0-87 elt-type) + (game-save-elt video-mode) + ) + (set! + (-> a0-87 elt-count) + 0 + ) + (let + ((a1-121 + (-> + *setting-control* + default + video-mode + ) + ) + ) + (set! + (-> a0-87 user-uint64) + (the-as uint (cond + ((= + a1-121 + 'ntsc + ) + 1 + ) + ((= + a1-121 + 'pal + ) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + ) + (let + ((v1-112 (&+ v1-111 16))) + (let + ((a0-88 + (the-as + object + (&+ v1-112 0) + ) + ) + ) + (set! + (-> + (the-as + game-save-tag + a0-88 + ) + elt-type + ) + (game-save-elt + aspect-ratio + ) + ) + (set! + (-> + (the-as + game-save-tag + a0-88 + ) + elt-count + ) + 0 + ) + (let + ((a1-125 + (-> + *setting-control* + default + aspect-ratio + ) + ) + ) + (set! + (-> + (the-as + (pointer int64) + a0-88 + ) + ) + (cond + ((= a1-125 'aspect4x3) + 1 + ) + ((= a1-125 'aspect16x9) + 2 + ) + (else + 0 + ) + ) + ) + ) + ) + (set! + (-> arg0 length) + (&- + (&+ v1-112 16) + (the-as + uint + (the-as + pointer + (-> arg0 tag) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (if (< (-> arg0 allocated-length) (-> arg0 length)) + (format + 0 + "ERROR: SAVEGAME: fatal error, save is using ~D of ~D bytes." + (-> arg0 length) + (-> arg0 allocated-length) + ) + ) + (none) + ) + +;; definition for method 25 of type game-info +(defmethod load-game! game-info ((obj game-info) (save game-save)) + (let ((save-data (the-as game-save-tag (-> save tag)))) + (while + (< + (the-as int save-data) + (the-as int (&-> save tag 0 user-int8 (-> save length))) + ) + (case (-> save-data elt-type) + (((game-save-elt sfx-volume)) + (set! + (-> *setting-control* default sfx-volume) + (-> save-data user-float0) + ) + ) + (((game-save-elt music-volume)) + (set! + (-> *setting-control* default music-volume) + (-> save-data user-float0) + ) + ) + (((game-save-elt dialog-volume)) + (set! + (-> *setting-control* default dialog-volume) + (-> save-data user-float0) + ) + ) + (((game-save-elt language)) + (set! + (-> *setting-control* default language) + (the-as language-enum (-> save-data user-uint64)) + ) + ) + (((game-save-elt vibration)) + (set! + (-> *setting-control* default vibration) + (= (-> save-data user-uint64) 1) + ) + ) + (((game-save-elt play-hints)) + (set! + (-> *setting-control* default play-hints) + (= (-> save-data user-uint64) 1) + ) + ) + ) + (set! + save-data + (the-as + game-save-tag + (&+ + (the-as pointer save-data) + (logand + -16 + (+ (* (the-as int (-> save-data elt-size)) (-> save-data elt-count)) 31) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> save new-game)) + (set-continue! obj "game-start") + (set! save save) + (goto cfg-134) + ) + (let ((data (the-as game-save-tag (-> save tag)))) + (while + (< + (the-as int data) + (the-as int (&-> save tag 0 user-int8 (-> save length))) + ) + (case (-> data elt-type) + (((game-save-elt base-time)) + (let ((old-base-frame (-> *display* base-frame-counter))) + (set! + (-> *display* base-frame-counter) + (the-as int (-> data user-uint64)) + ) + (set! + (-> *display* old-base-frame-counter) + (+ (-> *display* base-frame-counter) -1) + ) + (let + ((frame-counter-diff + (- (-> *display* base-frame-counter) old-base-frame) + ) + ) + (if (nonzero? (-> obj blackout-time)) + (+! (-> obj blackout-time) frame-counter-diff) + ) + (if (nonzero? (-> obj letterbox-time)) + (+! (-> obj letterbox-time) frame-counter-diff) + ) + (if (nonzero? (-> obj hint-play-time)) + (+! (-> obj hint-play-time) frame-counter-diff) + ) + (if (nonzero? (-> obj display-text-time)) + (+! (-> obj display-text-time) frame-counter-diff) + ) + ) + ) + (buzz-stop! 0) + ) + (((game-save-elt game-time)) + (set! + (-> *display* game-frame-counter) + (the-as int (-> data user-uint64)) + ) + (set! + (-> *display* old-game-frame-counter) + (+ (-> *display* game-frame-counter) -1) + ) + ) + (((game-save-elt real-time)) + (set! + (-> *display* real-frame-counter) + (the-as int (-> data user-uint64)) + ) + (set! + (-> *display* old-real-frame-counter) + (+ (-> *display* real-frame-counter) -1) + ) + ) + (((game-save-elt integral-time)) + (set! + (-> *display* integral-frame-counter) + (the-as int (-> data user-uint64)) + ) + (set! + (-> *display* old-integral-frame-counter) + (+ (-> *display* integral-frame-counter) -1) + ) + ) + (((game-save-elt continue)) + (format (clear *temp-string*) "~G" (&+ (the-as pointer data) 16)) + (set-continue! obj *temp-string*) + ) + (((game-save-elt life)) + (set! (-> obj life) (-> data user-float0)) + ) + (((game-save-elt buzzer-total)) + (set! (-> obj buzzer-total) (-> data user-float0)) + ) + (((game-save-elt fuel-cell)) + (set! (-> obj fuel) (-> data user-float0)) + ) + (((game-save-elt death-movie-tick)) + (set! (-> obj death-movie-tick) (the-as int (-> data user-uint64))) + ) + (((game-save-elt money)) + (set! (-> obj money) (-> data user-float0)) + ) + (((game-save-elt money-total)) + (set! (-> obj money-total) (-> data user-float0)) + ) + (((game-save-elt moeny-per-level)) + (let ((v1-34 (min 32 (-> data elt-count)))) + (dotimes (a0-76 v1-34) + (set! + (-> obj money-per-level a0-76) + (-> (the-as (pointer uint8) (&+ (the-as pointer data) 16)) a0-76) + ) + ) + ) + ) + (((game-save-elt level-open-list)) + (let ((v1-38 (min 32 (-> data elt-count)))) + (dotimes (a0-80 v1-38) + (set! + (-> obj level-opened a0-80) + (-> (the-as (pointer uint8) (&+ (the-as pointer data) 16)) a0-80) + ) + ) + ) + ) + (((game-save-elt perm-list)) + (let + ((s3-2 (min (-> data elt-count) (-> obj perm-list allocated-length)))) + (set! (-> obj perm-list length) s3-2) + (dotimes (s2-0 s3-2) + (mem-copy! + (the-as pointer (-> obj perm-list data s2-0)) + (&+ (&+ (the-as pointer data) 16) (* s2-0 16)) + 16 + ) + ) + ) + ) + (((game-save-elt task-list)) + (let + ((s3-4 + (min (-> data elt-count) (-> obj task-perm-list allocated-length)) + ) + ) + (set! (-> obj task-perm-list length) s3-4) + (dotimes (s2-1 s3-4) + (mem-copy! + (the-as pointer (-> obj task-perm-list data s2-1)) + (&+ (&+ (the-as pointer data) 16) (* s2-1 16)) + 16 + ) + ) + ) + ) + (((game-save-elt text-list)) + (let + ((v1-61 (/ (logand -8 (+ (-> obj text-ids-seen allocated-length) 7)) 8)) + (a0-94 (-> data elt-count)) + ) + (dotimes (a1-35 v1-61) + (cond + ((>= a1-35 a0-94) + (set! (-> obj text-ids-seen bytes a1-35) (the-as uint 0)) + 0 + ) + (else + (set! + (-> obj text-ids-seen bytes a1-35) + (-> (the-as (pointer uint8) (&+ (the-as pointer data) 16)) a1-35) + ) + ) + ) + ) + ) + ) + (((game-save-elt hint-list)) + (cond + ((= (-> obj hint-control length) (-> data elt-count)) + (let ((v1-65 (&+ (the-as pointer data) 16))) + (dotimes (a0-99 (-> data elt-count)) + (set! + (-> obj hint-control a0-99 start-time) + (the-as + int + (-> (the-as (pointer uint64) (&+ v1-65 (* (* a0-99 4) 8)))) + ) + ) + (set! + (-> obj hint-control a0-99 last-time-called) + (the-as + int + (-> (the-as (pointer uint64) (&+ v1-65 (* (+ (* a0-99 4) 1) 8)))) + ) + ) + (set! + (-> obj hint-control a0-99 num-attempts) + (-> + (the-as + (pointer int8) + (&+ (the-as (pointer uint8) v1-65) (+ (* a0-99 32) 16)) + ) + ) + ) + (set! + (-> obj hint-control a0-99 num-success) + (-> + (the-as + (pointer int8) + (&+ (the-as (pointer uint8) v1-65) (+ (* a0-99 32) 17)) + ) + ) + ) + ) + ) + ) + (else + (format + 0 + "WARNING: SAVEGAME: hint control list did not match current, ignoring~%" + ) + ) + ) + ) + (((game-save-elt auto-save-count)) + (set! (-> obj auto-save-count) (the-as int (-> data user-uint64))) + ) + (((game-save-elt total-deaths)) + (set! (-> obj total-deaths) (the-as int (-> data user-uint64))) + ) + (((game-save-elt continue-deaths)) + (set! (-> obj continue-deaths) (the-as int (-> data user-uint64))) + ) + (((game-save-elt fuel-cell-deaths)) + (set! (-> obj fuel-cell-deaths) (the-as int (-> data user-uint64))) + ) + (((game-save-elt game-start-time)) + (set! (-> obj game-start-time) (the-as int (-> data user-uint64))) + ) + (((game-save-elt continue-time)) + (set! (-> obj continue-time) (the-as int (-> data user-uint64))) + ) + (((game-save-elt death-time)) + (set! (-> obj death-time) (the-as int (-> data user-uint64))) + ) + (((game-save-elt hit-time)) + (set! (-> obj hit-time) (the-as int (-> data user-uint64))) + ) + (((game-save-elt fuel-cell-pickup-time)) + (set! (-> obj fuel-cell-pickup-time) (the-as int (-> data user-uint64))) + ) + (((game-save-elt deaths-per-level)) + (let ((v1-79 (min 32 (-> data elt-count)))) + (dotimes (a0-122 v1-79) + (set! + (-> obj deaths-per-level a0-122) + (-> (the-as (pointer uint8) (&+ (the-as pointer data) 16)) a0-122) + ) + ) + ) + ) + (((game-save-elt enter-level-time)) + (let ((v1-83 (min 32 (-> data elt-count)))) + (dotimes (a0-126 v1-83) + (set! + (-> obj enter-level-time a0-126) + (the-as + int + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer data) 16) (* a0-126 8)) + ) + ) + ) + ) + ) + ) + ) + (((game-save-elt in-level-time)) + (let ((v1-87 (min 32 (-> data elt-count)))) + (dotimes (a0-130 v1-87) + (set! + (-> obj in-level-time a0-130) + (the-as + int + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer data) 16) (* a0-130 8)) + ) + ) + ) + ) + ) + ) + ) + (((game-save-elt fuel-cell-time)) + (let ((v1-92 (min 32 (-> data elt-count)))) + (dotimes (a0-133 v1-92) + (set! + (-> obj fuel-cell-time a0-133) + (the-as + int + (-> + (the-as + (pointer uint64) + (&+ (&+ (the-as pointer data) 16) (* a0-133 8)) + ) + ) + ) + ) + ) + ) + ) + ) + (set! + data + (the-as + game-save-tag + (&+ + (the-as pointer data) + (logand + -16 + (+ (* (the-as int (-> data elt-size)) (-> data elt-count)) 31) + ) + ) + ) + ) + ) + ) + (dotimes (s4-1 (-> *level* length)) + (let ((a1-68 (-> *level* level s4-1))) + (if (= (-> a1-68 status) 'active) + (copy-perms-to-level! obj a1-68) + ) + ) + ) + (let ((s5-1 2) + (s4-2 115) + ) + (while (>= (the-as uint s4-2) (the-as uint s5-1)) + (get-task-status (the-as game-task s5-1)) + (+! s5-1 1) + ) + ) + (label cfg-134) + save + ) + +;; definition for method 9 of type game-save +(defmethod save-to-file game-save ((obj game-save) (arg0 string)) + (let ((s5-0 (new 'stack 'file-stream arg0 'write))) + (file-stream-write + s5-0 + (&-> obj type) + (+ (-> obj type size) (-> obj length)) + ) + (file-stream-close s5-0) + ) + obj + ) + +;; definition for method 10 of type game-save +(defmethod load-from-file! game-save ((obj game-save) (filename string)) + (let ((stream (new 'stack 'file-stream filename 'read))) + (let ((in-size (file-stream-length stream)) + (my-size (-> obj allocated-length)) + ) + (cond + ((>= (asize-of obj) in-size) + (cond + ((= (file-stream-read stream (&-> obj type) in-size) in-size) + (set! (-> obj type) game-save) + ) + (else + (format + 0 + "ERROR: SAVEGAME: save file ~A did not read correctly.~%" + stream + ) + (set! (-> obj length) 0) + 0 + ) + ) + ) + (else + (format 0 "ERROR: SAVEGAME: save file ~A is too big~%" stream) + ) + ) + (set! (-> obj allocated-length) my-size) + ) + (when (!= (-> obj version) 1) + (format + 0 + "ERROR: SAVEGAME: save file ~A was version ~d, but only ~d is supported.~%" + stream + (-> obj version) + 1 + ) + (set! (-> obj length) 0) + 0 + ) + (file-stream-close stream) + ) + obj + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 656) + (new 'static 'sparticle-launch-group + :length 1 + :duration #xbb8 + :linger-duration #x5dc + :flags (sp-group-flag screen-space) + :name "group-part-save-icon" + :launcher + (new 'static 'inline-array sparticle-group-item 1 (sp-item 2662)) + :bounds (new 'static 'sphere :w 409600.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 2662) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 11 + (sp-tex spt-texture (new 'static 'texture-id :index #x6b :page #x1cf)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 1.5)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 128.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags bit2 bit9 bit13) + (sp-end) + ) + ) + ) + +;; definition for symbol *auto-save-info*, type mc-slot-info +(define *auto-save-info* (new 'global 'mc-slot-info)) + +;; definition of type auto-save +(deftype auto-save (process) + ((card int32 :offset-assert 112) + (slot int32 :offset-assert 116) + (which int32 :offset-assert 120) + (buffer kheap :offset-assert 124) + (mode basic :offset-assert 128) + (result mc-status-code :offset-assert 132) + (save game-save :offset-assert 136) + (info mc-slot-info :inline :offset-assert 140) + (notify handle :offset-assert 440) + (state-time int64 :offset-assert 448) + (part sparticle-launch-control :offset-assert 456) + ) + :heap-base #x160 + :method-count-assert 23 + :size-assert #x1cc + :flag-assert #x17016001cc + (:methods + (get-heap () _type_ :state 14) + (get-card () _type_ :state 15) + (format-card () _type_ :state 16) + (create-file () _type_ :state 17) + (save () _type_ :state 18) + (restore () _type_ :state 19) + (error (mc-status-code) _type_ :state 20) + (done () _type_ :state 21) + (unformat-card () _type_ :state 22) + ) + ) + +;; definition for method 3 of type auto-save +(defmethod inspect auto-save ((obj auto-save)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Tcard: ~D~%" (-> obj card)) + (format #t "~T~Tslot: ~D~%" (-> obj slot)) + (format #t "~T~Twhich: ~D~%" (-> obj which)) + (format #t "~T~Tbuffer: #~%" (-> obj buffer)) + (format #t "~T~Tmode: ~A~%" (-> obj mode)) + (format #t "~T~Tresult: ~D~%" (-> obj result)) + (format #t "~T~Tsave: ~A~%" (-> obj save)) + (format #t "~T~Tinfo: #~%" (-> obj info)) + (format #t "~T~Tnotify: ~D~%" (-> obj notify)) + (format #t "~T~Tstate-time: ~D~%" (-> obj state-time)) + (format #t "~T~Tpart: ~A~%" (-> obj part)) + obj + ) + +;; definition for method 10 of type auto-save +(defmethod deactivate auto-save ((obj auto-save)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; definition for method 7 of type auto-save +;; INFO: Return type mismatch process vs auto-save. +(defmethod relocate auto-save ((obj auto-save) (arg0 int)) + (if (nonzero? (-> obj part)) + (&+! (-> obj part) arg0) + ) + (the-as auto-save ((method-of-type process relocate) obj arg0)) + ) + +;; definition for function auto-save-post +;; INFO: Return type mismatch object vs none. +(defbehavior auto-save-post auto-save () + (when + (and + (= *cheat-mode* 'debug) + (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3)) + ) + (let + ((gp-0 + (new + 'stack + 'font-context + *font-default-matrix* + 32 + 160 + 0.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-5 gp-0)) + (set! (-> v1-5 width) (the float 440)) + ) + (let ((v1-6 gp-0)) + (set! (-> v1-6 height) (the float 80)) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning)) + (format + (clear *temp-string*) + "~S / ~S ~D~%" + (-> self mode) + (-> self state name) + (-> self which) + ) + (print-game-text *temp-string* gp-0 #f 128 22) + ) + ) + (when (and (= (-> self mode) 'auto-save) (!= (-> self next-state name) 'done)) + (let + ((gp-1 + (new + 'stack + 'font-context + *font-default-matrix* + 20 + 40 + 0.0 + (font-color default) + (font-flags shadow kerning) + ) + ) + ) + (let ((v1-15 gp-1)) + (set! (-> v1-15 scale) 0.8) + ) + (let ((v1-16 gp-1)) + (set! (-> v1-16 width) (the float 472)) + ) + (let ((v1-17 gp-1)) + (set! (-> v1-17 height) (the float 20)) + ) + (set! (-> gp-1 flags) (font-flags shadow kerning middle left large)) + (when (zero? (-> *game-info* auto-save-count)) + (print-game-text + (lookup-text! *common-text* (game-text-id saving-data) #f) + gp-1 + #f + 128 + 22 + ) + (set! (-> gp-1 origin x) 20.0) + (set! (-> gp-1 origin y) 130.0) + (let ((v1-23 gp-1)) + (set! (-> v1-23 scale) 0.7) + ) + (let ((v1-24 gp-1)) + (set! (-> v1-24 height) (the float 40)) + ) + (let ((s5-2 print-game-text)) + ((the-as (function object string object none) format) + (clear *temp-string*) + (lookup-text! *common-text* (game-text-id do-not-remove-mem-card) #f) + 1 + ) + (s5-2 *temp-string* gp-1 #f 128 22) + ) + ) + ) + (when (< (mod (-> *display* real-frame-counter) 300) 270) + (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 + ) + ) + (+ -1024.0 (-> *math-camera* hvdf-off z)) + (-> *math-camera* hvdf-off w) + ) + ) + (spawn (-> self part) *zero-vector*) + ) + ) + (none) + ) + +;; failed to figure out what this is: +auto-save-post + +;; definition for function auto-save-init-by-other +;; INFO: Return type mismatch object vs none. +;; WARN: Expression building failed: Function auto-save-init-by-other has a return type of none, but the expression builder found a return statement. +(defbehavior + auto-save-init-by-other auto-save + ((desired-mode symbol) + (notify-proc process-tree) + (card-idx int) + (file-idx int) + ) + (when (handle->process (-> *game-info* auto-save-proc)) + (send-event notify-proc 'notify 'error 16) + (return #f) + ) + (set! (-> *game-info* auto-save-proc) (process->handle self)) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (stack-size-set! (-> self main-thread) 512) + (logclear! (-> self mask) (process-mask pause menu progress)) + (set! (-> self card) card-idx) + (set! (-> self which) file-idx) + (set! (-> self buffer) #f) + (set! (-> self mode) desired-mode) + (set! (-> self result) (mc-status-code ok)) + (set! (-> self save) #f) + (set! (-> self notify) (process->handle (the-as process notify-proc))) + (set! + (-> self part) + (create-launch-control (-> *part-group-id-table* 656) self) + ) + (set! (-> self part matrix) (sprite-allocate-user-hvdf)) + (cond + ((= desired-mode 'auto-save) + (if (not (-> *setting-control* current auto-save)) + (go-virtual error (mc-status-code no-auto-save)) + ) + (when (and (zero? (-> self card)) (-> *setting-control* current auto-save)) + (set! (-> self card) (-> *game-info* auto-save-card)) + (set! (-> self which) (-> *game-info* auto-save-which)) + ) + ) + ((= desired-mode 'error) + (set! (-> *setting-control* default auto-save) #f) + (go-virtual error (mc-status-code no-card)) + ) + ) + (set! (-> *setting-control* default auto-save) #f) + (go-virtual get-heap) + (none) + ) + +;; failed to figure out what this is: +(defstate get-heap (auto-save) + :virtual #t + :code + (behavior () + (set! (-> self state-time) (-> *display* real-frame-counter)) + (let ((a0-1 (reserve-alloc *art-control*))) + (while (not a0-1) + (if (>= (- (-> *display* real-frame-counter) (-> self state-time)) #x4650) + (go-virtual error (mc-status-code no-memory)) + ) + (suspend) + (set! a0-1 (reserve-alloc *art-control*)) + ) + (set! (-> self buffer) a0-1) + ) + (go-virtual get-card) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate get-card (auto-save) + :virtual #t + :code + (behavior () + (label cfg-0) + (mc-get-slot-info (-> self slot) (-> self info)) + (when (zero? (-> self info known)) + (suspend) + (goto cfg-0) + ) + (cond + ((zero? (-> self info handle)) + (go-virtual error (mc-status-code no-card)) + ) + ((zero? (-> self card)) + (set! (-> self card) (-> self info handle)) + ) + ((!= (-> self info handle) (-> self card)) + (go-virtual error (mc-status-code bad-handle)) + ) + ) + (case (-> self mode) + (('save 'auto-save) + (go-virtual save) + ) + (('save-last) + (set! (-> self which) (-> self info last-file)) + (if (= (-> self which) -1) + (go-virtual error (mc-status-code no-last)) + (go-virtual save) + ) + ) + (('restore) + (go-virtual restore) + ) + (('format-card) + (go-virtual format-card) + ) + (('unformat-card) + (go-virtual unformat-card) + ) + (('create-file) + (go-virtual create-file) + ) + (else + (go-virtual done) + ) + ) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate format-card (auto-save) + :virtual #t + :code + (behavior () + (when (zero? (-> self info formatted)) + (label cfg-1) + (set! (-> self result) (mc-format (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (label cfg-3) + (set! (-> self result) (the-as mc-status-code (mc-check-result))) + (let ((v1-4 (-> self result))) + (b! (nonzero? v1-4) cfg-5 :delay (nop!)) + (b! #t cfg-10 :delay (nop!)) + (label cfg-5) + (b! (= v1-4 (mc-status-code format-failed)) cfg-1 :delay (nop!)) + (nop!) + (b! (!= v1-4 (mc-status-code ok)) cfg-9 :delay (nop!)) + ) + (b! #t cfg-12 :delay (nop!)) + (the-as none 0) + (b! #t cfg-10 :delay (nop!)) + (label cfg-9) + (go-virtual error (-> self result)) + (label cfg-10) + (suspend) + (b! #t cfg-3 :delay (nop!)) + ) + (label cfg-12) + (case (-> self mode) + (('create-file 'save 'save-last 'auto-save 'restore) + (go-virtual create-file) + ) + ) + (go-virtual done) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate unformat-card (auto-save) + :virtual #t + :code + (behavior () + (when (nonzero? (-> self info formatted)) + (label cfg-1) + (set! (-> self result) (mc-unformat (-> self card))) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-1) + ) + (while #t + (set! (-> self result) (the-as mc-status-code (mc-check-result))) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-11) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + ) + (label cfg-11) + (go-virtual done) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate create-file (auto-save) + :virtual #t + :code + (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (if (< (-> self info mem-actual) (-> self info mem-required)) + (go-virtual error (mc-status-code no-space)) + ) + (let ((v1-12 (-> self buffer))) + (set! (-> v1-12 current) (-> v1-12 base)) + ) + (label cfg-6) + (set! + (-> self result) + (mc-create-file (-> self card) (the-as uint (-> self buffer base))) + ) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (while #t + (set! (-> self result) (the-as mc-status-code (mc-check-result))) + (case (-> self result) + (((mc-status-code busy)) + ) + (((mc-status-code ok)) + (goto cfg-16) + ) + (else + (go-virtual error (-> self result)) + ) + ) + (suspend) + ) + ) + ) + (label cfg-16) + (case (-> self mode) + (('restore) + (go-virtual restore) + ) + (('save 'save-last 'auto-save) + (go-virtual save) + ) + ) + (go-virtual done) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate save (auto-save) + :virtual #t + :code + (behavior () + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (case (-> self mode) + (('auto-save) + (+! (-> *game-info* auto-save-count) 1) + ) + ) + (let ((v1-14 (-> self buffer))) + (set! (-> v1-14 current) (-> v1-14 base)) + ) + (let ((gp-0 (the-as object loading-level))) + (set! loading-level (-> self buffer)) + (set! (-> self save) (new 'loading-level 'game-save #x10000)) + (save-game! *game-info* (-> self save) "save") + (set! loading-level (the-as kheap gp-0)) + 0 + (label cfg-7) + (set! + (-> self result) + (mc-save + (-> self card) + (-> self which) + (&-> (-> self save) type) + (the-as int (-> self save info-int32)) + ) + ) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-7) + ) + (while #t + (set! (-> self result) (the-as mc-status-code (mc-check-result))) + (let ((v1-24 (-> self result))) + (set! gp-0 (cond + ((= v1-24 (mc-status-code busy)) + #f + ) + ((= v1-24 (mc-status-code ok)) + (goto cfg-21) + gp-0 + ) + ((= v1-24 (mc-status-code write-error)) + (suspend) + gp-0 + ) + (else + (case (-> self mode) + (('auto-save) + (set! + (-> *game-info* auto-save-count) + (seekl (-> *game-info* auto-save-count) 0 1) + ) + ) + ) + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + ) + (label cfg-21) + (go-virtual done) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate restore (auto-save) + :virtual #t + :code + (behavior () + (local-vars (gp-0 object)) + (cond + ((zero? (-> self info formatted)) + (go-virtual error (mc-status-code no-format)) + ) + ((zero? (-> self info inited)) + (go-virtual error (mc-status-code no-file)) + ) + ) + (let ((v1-10 (-> self buffer))) + (set! (-> v1-10 current) (-> v1-10 base)) + ) + (if (zero? (-> self info file (-> self which) present)) + (go-virtual error (mc-status-code no-save)) + ) + (label cfg-6) + (set! + (-> self result) + (mc-load (-> self card) (-> self which) (-> self buffer base)) + ) + (when (!= (-> self result) (mc-status-code ok)) + (suspend) + (goto cfg-6) + ) + (while #t + (set! (-> self result) (the-as mc-status-code (mc-check-result))) + (let ((v1-22 (-> self result))) + (set! gp-0 (cond + ((= v1-22 (mc-status-code busy)) + #f + ) + ((= v1-22 (mc-status-code ok)) + (goto cfg-20) + gp-0 + ) + ((= v1-22 (mc-status-code read-error)) + (suspend) + gp-0 + ) + ((= v1-22 (mc-status-code new-game)) + (go-virtual error (mc-status-code no-save)) + ) + (else + (go-virtual error (-> self result)) + ) + ) + ) + ) + (suspend) + ) + (label cfg-20) + (set! (-> self save) (the-as game-save (&+ (-> self buffer base) 4))) + (let ((v1-34 (-> self save))) + (set! (-> v1-34 type) game-save) + (if (!= (-> v1-34 version) 1) + (go-virtual error (mc-status-code bad-version)) + ) + ) + (set-setting! *setting-control* self 'music-volume 'abs 0.0 0) + (set-setting! *setting-control* self 'sfx-volume 'abs 0.0 0) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (-> self save) (the-as string #f)) + (set-master-mode 'game) + (push-setting! *setting-control* self 'process-mask 'set 0.0 16) + (copy-settings-from-target! *setting-control*) + (dotimes (gp-1 15) + (suspend) + ) + (go-virtual done) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate error (auto-save) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'progress-allowed?) + #t + ) + ((= v1-0 'die) + (deactivate self) + ) + ) + ) + ) + ) + :code + (behavior ((arg0 mc-status-code)) + (if (-> self buffer) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> self result) arg0) + (let ((s5-0 *auto-save-info*)) + (mem-copy! (the-as pointer s5-0) (the-as pointer (-> self info)) 300) + (send-event + (handle->process (-> self notify)) + 'notify + 'error + (-> self result) + s5-0 + ) + ) + (let ((t9-3 format) + (a0-7 #t) + (a1-3 "SAVE ERROR: ~A~%") + (v1-12 (-> self result)) + ) + (t9-3 a0-7 a1-3 (cond + ((= v1-12 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-12 (mc-status-code no-process)) + "no-process" + ) + ((= v1-12 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-12 (mc-status-code no-space)) + "no-space" + ) + ((= v1-12 (mc-status-code no-save)) + "no-save" + ) + ((= v1-12 (mc-status-code no-file)) + "no-file" + ) + ((= v1-12 (mc-status-code no-format)) + "no-format" + ) + ((= v1-12 (mc-status-code no-last)) + "no-last" + ) + ((= v1-12 (mc-status-code no-card)) + "no-card" + ) + ((= v1-12 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-12 (mc-status-code new-game)) + "new-game" + ) + ((= v1-12 (mc-status-code read-error)) + "read-error" + ) + ((= v1-12 (mc-status-code write-error)) + "write-error" + ) + ((= v1-12 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-12 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-12 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-12 (mc-status-code ok)) + "ok" + ) + ((= v1-12 (mc-status-code busy)) + "busy" + ) + (else + "*unknown*" + ) + ) + ) + ) + (if (= (-> self result) (mc-status-code no-auto-save)) + (return #f) + ) + (case (-> self mode) + (('auto-save 'error) + (set! (-> self state-time) (-> *display* real-frame-counter)) + (set! (-> *game-info* auto-save-status) arg0) + (while (< (- (-> *display* real-frame-counter) (-> self state-time)) 60) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-frame-counter)) + ) + (suspend) + ) + (if (= arg0 (mc-status-code no-card)) + (activate-progress *dproc* (progress-screen memcard-removed)) + (activate-progress *dproc* (progress-screen memcard-auto-save-error)) + ) + ) + ) + (none) + ) + :post + auto-save-post + ) + +;; failed to figure out what this is: +(defstate done (auto-save) + :virtual #t + :code + (behavior () + (if (and (-> self buffer) (-> *art-control* reserve-buffer)) + (reserve-free *art-control* (-> self buffer)) + ) + (set! (-> *game-info* auto-save-status) (mc-status-code ok)) + (case (-> self mode) + (('save 'save-last 'auto-save 'restore) + (set! (-> *setting-control* default auto-save) #t) + (set! (-> *game-info* auto-save-card) (-> self card)) + (set! (-> *game-info* auto-save-which) (-> self which)) + ) + ) + (let ((gp-0 *auto-save-info*)) + (mem-copy! (the-as pointer gp-0) (the-as pointer (-> self info)) 300) + (send-event (handle->process (-> self notify)) 'notify 'done 1 gp-0) + ) + (case (-> self mode) + (('auto-save) + (when (= (-> *game-info* auto-save-count) 1) + (set! (-> self event-hook) (-> (method-of-object self error) event)) + (set! (-> self state-time) (-> *display* real-frame-counter)) + (while (< (- (-> *display* real-frame-counter) (-> self state-time)) 60) + (if (not (progress-allowed?)) + (set! (-> self state-time) (-> *display* real-frame-counter)) + ) + (suspend) + ) + (activate-progress *dproc* (progress-screen auto-save)) + ) + ) + ) + (none) + ) + :post + auto-save-post + ) + +;; definition for function auto-save-command +;; INFO: Return type mismatch (pointer process) vs none. +(defun + auto-save-command + ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree)) + (let ((s2-0 (get-process *default-dead-pool* auto-save #x4000))) + (when s2-0 + (let ((t9-1 (method-of-type auto-save activate))) + (t9-1 + (the-as auto-save s2-0) + *default-pool* + 'auto-save + (&-> *dram-stack* 14336) + ) + ) + (run-now-in-process s2-0 auto-save-init-by-other arg0 arg3 arg1 arg2) + (-> s2-0 ppointer) + ) + ) + (none) + ) + +;; definition for function auto-save-check +;; INFO: Return type mismatch int vs none. +(defun auto-save-check () + (when + (and + (-> *setting-control* current auto-save) + (not (handle->process (-> *game-info* auto-save-proc))) + ) + (mc-get-slot-info 0 *auto-save-info*) + (if + (and + (nonzero? (-> *auto-save-info* known)) + (or + (zero? (-> *auto-save-info* handle)) + (!= (-> *auto-save-info* handle) (-> *game-info* auto-save-card)) + ) + ) + (auto-save-command 'error 0 0 *default-pool*) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/gfx/hw/display_REF.gc b/test/decompiler/reference/engine/gfx/hw/display_REF.gc index 423c267fd..7a02449cd 100644 --- a/test/decompiler/reference/engine/gfx/hw/display_REF.gc +++ b/test/decompiler/reference/engine/gfx/hw/display_REF.gc @@ -591,7 +591,14 @@ ) (set! (-> a2-4 base) (&+ gif-buf 32)) ) - (let ((total-qwc (/ (&+ (- -16 (the-as int end-dma)) (-> buf base)) 16))) + (let + ((total-qwc + (/ + (the-as int (+ (- -16 (the-as int end-dma)) (the-as int (-> buf base)))) + 16 + ) + ) + ) (cond ((nonzero? total-qwc) (logior! @@ -715,7 +722,14 @@ (set! (-> (the-as (pointer uint64) gif-buf) 9) (the-as uint 0)) (set! (-> t0-2 base) (&+ gif-buf 80)) ) - (let ((total-qwc (/ (&+ (- -16 (the-as int end-dma)) (-> buf base)) 16))) + (let + ((total-qwc + (/ + (the-as int (+ (- -16 (the-as int end-dma)) (the-as int (-> buf base)))) + 16 + ) + ) + ) (cond ((nonzero? total-qwc) (logior! diff --git a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc index f521b26aa..d655f8168 100644 --- a/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/sky/sky-h_REF.gc @@ -294,6 +294,7 @@ ) ;; definition for method 3 of type sky-vertex +;; INFO: this function exists in multiple non-identical object files (defmethod inspect sky-vertex ((obj sky-vertex)) (format #t "[~8x] ~A~%" obj 'sky-vertex) (format #t "~Tpos: #~%" (-> obj pos)) diff --git a/test/decompiler/reference/engine/gfx/sky/sky-tng_REF.gc b/test/decompiler/reference/engine/gfx/sky/sky-tng_REF.gc new file mode 100644 index 000000000..5d0fc28a8 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/sky/sky-tng_REF.gc @@ -0,0 +1,1333 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *sky-work*, type sky-work +(define + *sky-work* + (new 'static 'sky-work + :adgif-tmpl + (new 'static 'dma-gif-packet + :dma-vif + (new 'static 'dma-packet + :dma + (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif + (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :draw-tmpl + (new 'static 'dma-gif-packet + :dma-vif + (new 'static 'dma-packet + :dma + (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif + (new 'static 'array uint64 2 #x508b400000008001 #x43431) + ) + :blend-tmpl + (new 'static 'dma-gif-packet + :dma-vif + (new 'static 'dma-packet + :dma + (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif + (new 'static 'array uint64 2 #x50ab400000008001 #x43431) + ) + :sky-data + (new 'static 'inline-array qword 5 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x80)) + (new 'static 'qword) + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x0 #x0 #xffffff #x0) + ) + (new 'static 'qword :data (new 'static 'array uint32 4 #x200 #x200 #x0 #x0)) + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x200 #x200 #xffffff #x0) + ) + ) + :cloud-data + (new 'static 'inline-array qword 5 + (new 'static 'qword :data (new 'static 'array uint32 4 #x0 #x0 #x0 #x80)) + (new 'static 'qword) + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x0 #x200 #xffffff #x0) + ) + (new 'static 'qword :data (new 'static 'array uint32 4 #x400 #x400 #x0 #x0)) + (new 'static 'qword + :data + (new 'static 'array uint32 4 #x400 #x600 #xffffff #x0) + ) + ) + ) + ) + +;; definition for function init-sky-tng-data +;; INFO: Return type mismatch int vs none. +(defun init-sky-tng-data ((arg0 sky-tng-data)) + (set! + (-> arg0 giftag-base tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan)) + :nreg #x3 + ) + ) + (set! + (-> arg0 giftag-base regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + ) + ) + (set! + (-> arg0 giftag-roof tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1) + :nreg #x3 + ) + ) + (set! + (-> arg0 giftag-roof regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + ) + ) + (set! + (-> arg0 giftag-ocean tag) + (new 'static 'gif-tag64 + :nloop #x1 + :eop #x1 + :pre #x1 + :prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1) + :nreg #x3 + ) + ) + (set! + (-> arg0 giftag-ocean regs) + (new 'static 'gif-tag-regs + :regs0 (gif-reg-id st) + :regs1 (gif-reg-id rgbaq) + :regs2 (gif-reg-id xyzf2) + ) + ) + (set! (-> arg0 time) 0.0) + (set! (-> arg0 off-s-0) (the-as uint 0)) + (set! (-> arg0 off-t-0) (the-as uint 0)) + (set! (-> arg0 off-s-1) (the-as uint 0)) + (set! (-> arg0 off-t-1) (the-as uint 0)) + 0 + (none) + ) + +;; definition for symbol *sky-tng-data*, type sky-tng-data +(define *sky-tng-data* (new 'global 'sky-tng-data)) + +;; failed to figure out what this is: +(init-sky-tng-data *sky-tng-data*) + +;; definition for method 3 of type sky-vertex +;; INFO: this function exists in multiple non-identical object files +(defmethod inspect sky-vertex ((obj sky-vertex)) + (format #t "sky-vertex [~X]:~%" obj) + (format + #t + "~TPos: [~F ~F ~F ~F]~%" + (-> obj pos x) + (-> obj pos y) + (-> obj pos z) + (-> obj pos w) + ) + (format + #t + "~TSTQ: [~F ~F ~F ~F]~%" + (-> obj stq x) + (-> obj stq y) + (-> obj stq z) + (-> obj stq w) + ) + (format + #t + "~TCol: [~F ~F ~F ~F]~%" + (-> obj col x) + (-> obj col y) + (-> obj col z) + (-> obj col w) + ) + obj + ) + +;; definition for function update-sky-tng-data +;; INFO: Return type mismatch int vs none. +(defun update-sky-tng-data ((arg0 float)) + (sky-make-sun-data *sky-parms* 0 arg0) + (sky-make-sun-data *sky-parms* 1 arg0) + (sky-make-moon-data *sky-parms* arg0) + (let ((v1-0 *sky-tng-data*)) + (+! (-> v1-0 off-s-0) 16) + (+! (-> v1-0 off-t-0) 32) + (+! (-> v1-0 off-s-1) -21) + (+! (-> v1-0 off-t-1) 42) + (set! (-> v1-0 time) arg0) + ) + 0 + (none) + ) + +;; definition for function init-sky-regs +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function set-tex-offset +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function draw-large-polygon +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function clip-polygon-against-positive-hyperplane +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function clip-polygon-against-negative-hyperplane +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function render-sky-quad +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function render-sky-tri +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function sky-duplicate-polys +;; ERROR: function has no type analysis. Cannot decompile. + +;; definition for function close-sky-buffer +;; INFO: Return type mismatch pointer vs none. +;; WARN: Function may read a register that is not set: ra +;; WARN: Unsupported inline assembly instruction kind - [jr ra] +;; Used lq/sq +(defun close-sky-buffer ((arg0 dma-buffer)) + (local-vars (ra-0 none)) + (nop!) + (let ((v1-0 #x8000) + (v0-0 (-> arg0 base)) + ) + (set! (-> (the-as (pointer int128) v0-0)) 0) + (nop!) + (set! (-> (the-as (pointer int32) v0-0)) v1-0) + (let ((v0-1 (&+ v0-0 16))) + (.jr ra-0) + (set! (-> arg0 base) v0-1) + ) + ) + (none) + ) + +;; definition for symbol sky-base-polygons, type (inline-array sky-vertex) +(define + sky-base-polygons + (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex + :pos (new 'static 'vector :z -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x 40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x 40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z 40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z 40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y -40960000.0) + :col + (new 'static 'vector :x 3.0 :y 18.0 :z 113.0 :w 128.0) + ) + ) + ) + +;; definition for symbol sky-roof-polygons, type (inline-array sky-vertex) +(define + sky-roof-polygons + (new 'static 'inline-array sky-vertex 12 + (new 'static 'sky-vertex + :pos (new 'static 'vector :z -40960000.0) + :stq (new 'static 'vector :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x 40960000.0) + :stq (new 'static 'vector :x 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y 10240000.0) + :stq + (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x 40960000.0) + :stq (new 'static 'vector :x 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z 40960000.0) + :stq + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y 10240000.0) + :stq + (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z 40960000.0) + :stq + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x -40960000.0) + :stq (new 'static 'vector :y 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y 10240000.0) + :stq + (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :x -40960000.0) + :stq (new 'static 'vector :y 1.0 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :z -40960000.0) + :stq (new 'static 'vector :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + (new 'static 'sky-vertex + :pos (new 'static 'vector :y 10240000.0) + :stq + (new 'static 'vector :x 0.5 :y 0.5 :z 1.0) + :col + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + ) + ) + ) + +;; definition for symbol sky-cloud-polygons, type (inline-array sky-vertex) +(define + sky-cloud-polygons + (new 'static 'inline-array sky-vertex 72 + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + (new 'static 'sky-vertex) + ) + ) + +;; definition for symbol sky-cloud-polygon-indices, type (pointer uint8) +(define + sky-cloud-polygon-indices + (new 'static 'array uint8 48 + #x0 + #x1 + #x9 + #x8 + #x1 + #x2 + #xa + #x9 + #x2 + #x3 + #xb + #xa + #x3 + #x0 + #x8 + #xb + #x8 + #x9 + #x5 + #x4 + #x9 + #xa + #x6 + #x5 + #xa + #xb + #x7 + #x6 + #xb + #x8 + #x4 + #x7 + #x4 + #x5 + #x6 + #x7 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + #x0 + ) + ) + +;; definition for function sky-tng-setup-cloud-layer +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun + sky-tng-setup-cloud-layer + ((arg0 float) (arg1 float) (arg2 vector) (arg3 (inline-array sky-vertex))) + (let ((f28-0 (sqrtf (- 1.0 (* arg0 arg0)))) + (f26-0 (sqrtf (- 1.0 (* arg1 arg1)))) + (s5-0 (new 'stack-no-clear 'inline-array 'sky-vertex 12)) + ) + (dotimes (s1-0 12) + ((method-of-type sky-vertex new) (the-as symbol (-> s5-0 s1-0)) sky-vertex) + ) + (let ((f30-0 0.5)) + (let ((f9-0 -22.0) + (f10-0 22.0) + (f11-0 -22.0) + (f8-0 22.0) + (f6-0 -4.0) + (f7-0 5.0) + (f12-0 -5.0) + (f13-0 4.0) + (f1-4 -2.0) + (f2-2 2.0) + (f4-0 -2.0) + (f0-4 2.0) + ) + 0.0 + 1.0 + -1.0 + 0.0 + (let* ((f3-5 (/ (- f1-4 f9-0) (- f10-0 f9-0))) + (f5-2 (/ (- f2-2 f9-0) (- f10-0 f9-0))) + (f15-1 (/ (- f4-0 f11-0) (- f8-0 f11-0))) + (f14-3 (/ (- f0-4 f11-0) (- f8-0 f11-0))) + (f3-7 (+ f6-0 (* f3-5 (- f7-0 f6-0)))) + (f5-4 (+ f6-0 (* f5-2 (- f7-0 f6-0)))) + ) + (+ f12-0 (* f15-1 (- f13-0 f12-0))) + (+ f12-0 (* f14-3 (- f13-0 f12-0))) + (let ((v1-5 (-> s5-0 0))) + (set! (-> v1-5 pos x) f9-0) + (set! (-> v1-5 pos y) 0.0) + (set! (-> v1-5 pos z) f11-0) + (set! (-> v1-5 pos w) 0.0) + ) + (let ((v1-6 (-> s5-0 1))) + (set! (-> v1-6 pos x) f10-0) + (set! (-> v1-6 pos y) 0.0) + (set! (-> v1-6 pos z) f11-0) + (set! (-> v1-6 pos w) 0.0) + ) + (let ((v1-7 (-> s5-0 2))) + (set! (-> v1-7 pos x) f10-0) + (set! (-> v1-7 pos y) 0.0) + (set! (-> v1-7 pos z) f8-0) + (set! (-> v1-7 pos w) 0.0) + ) + (let ((v1-8 (-> s5-0 3))) + (set! (-> v1-8 pos x) f9-0) + (set! (-> v1-8 pos y) 0.0) + (set! (-> v1-8 pos z) f8-0) + (set! (-> v1-8 pos w) 0.0) + ) + (set-vector! (-> s5-0 0 stq) f6-0 f6-0 1.0 1.0) + (set-vector! (-> s5-0 1 stq) f7-0 f6-0 1.0 1.0) + (set-vector! (-> s5-0 2 stq) f7-0 f7-0 1.0 1.0) + (set-vector! (-> s5-0 3 stq) f6-0 f7-0 1.0 1.0) + (let ((v1-13 (-> s5-0 4))) + (set! (-> v1-13 pos x) f1-4) + (set! (-> v1-13 pos y) 1.0) + (set! (-> v1-13 pos z) f4-0) + (set! (-> v1-13 pos w) 0.0) + ) + (let ((v1-14 (-> s5-0 5))) + (set! (-> v1-14 pos x) f2-2) + (set! (-> v1-14 pos y) 1.0) + (set! (-> v1-14 pos z) f4-0) + (set! (-> v1-14 pos w) 0.0) + ) + (let ((v1-15 (-> s5-0 6))) + (set! (-> v1-15 pos x) f2-2) + (set! (-> v1-15 pos y) 1.0) + (set! (-> v1-15 pos z) f0-4) + (set! (-> v1-15 pos w) 0.0) + ) + (let ((v1-16 (-> s5-0 7))) + (set! (-> v1-16 pos x) f1-4) + (set! (-> v1-16 pos y) 1.0) + (set! (-> v1-16 pos z) f0-4) + (set! (-> v1-16 pos w) 0.0) + ) + (set-vector! (-> s5-0 4 stq) f3-7 f3-7 1.0 1.0) + (set-vector! (-> s5-0 5 stq) f5-4 f3-7 1.0 1.0) + (set-vector! (-> s5-0 6 stq) f5-4 f5-4 1.0 1.0) + (set-vector! (-> s5-0 7 stq) f3-7 f5-4 1.0 1.0) + ) + ) + (dotimes (v1-21 4) + (let ((f0-14 (-> s5-0 v1-21 pos x)) + (f1-6 (-> s5-0 v1-21 pos z)) + ) + (set! (-> s5-0 v1-21 pos x) (+ (* f0-14 f26-0) (* f1-6 arg1))) + (set! (-> s5-0 v1-21 pos z) (- (* f1-6 f26-0) (* f0-14 arg1))) + ) + (set! (-> s5-0 v1-21 col quad) (-> arg2 quad)) + (set! (-> s5-0 v1-21 col w) 0.0) + ) + (dotimes (v1-24 4) + (let ((f0-18 (-> s5-0 (+ v1-24 4) pos x)) + (f1-8 (-> s5-0 (+ v1-24 4) pos z)) + ) + (set! (-> s5-0 (+ v1-24 4) pos x) (+ (* f0-18 f28-0) (* f1-8 arg0))) + (set! (-> s5-0 (+ v1-24 4) pos z) (- (* f1-8 f28-0) (* f0-18 arg0))) + ) + (set! (-> s5-0 (+ v1-24 4) col quad) (-> arg2 quad)) + ) + (dotimes (s3-1 4) + (vector4-lerp! + (the-as vector (-> s5-0 (+ s3-1 8))) + (the-as vector (-> s5-0 s3-1)) + (the-as vector (-> s5-0 (+ s3-1 4))) + f30-0 + ) + (vector4-lerp! + (-> s5-0 (+ s3-1 8) stq) + (-> s5-0 s3-1 stq) + (-> s5-0 (+ s3-1 4) stq) + f30-0 + ) + (set! (-> s5-0 (+ s3-1 8) col quad) (-> arg2 quad)) + ) + ) + (dotimes (v1-51 36) + (let ((a0-47 (-> sky-cloud-polygon-indices v1-51))) + (set! (-> arg3 v1-51 pos quad) (-> s5-0 a0-47 pos quad)) + (set! (-> arg3 v1-51 stq quad) (-> s5-0 a0-47 stq quad)) + (set! (-> arg3 v1-51 col quad) (-> s5-0 a0-47 col quad)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function sky-tng-setup-clouds +;; INFO: Return type mismatch int vs none. +(defun sky-tng-setup-clouds () + (let ((a2-0 (new 'static 'vector :x 20.0 :y 20.0 :z 20.0 :w 128.0)) + (gp-0 (new 'static 'vector :x 20.0 :y 20.0 :z 30.0 :w 128.0)) + ) + (sky-tng-setup-cloud-layer 0.0 0.0 a2-0 sky-cloud-polygons) + (sky-tng-setup-cloud-layer + 0.05584 + 0.01396 + gp-0 + (the-as (inline-array sky-vertex) (-> sky-cloud-polygons 36)) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(sky-tng-setup-clouds) + +;; definition for function render-sky-tng +;; INFO: Return type mismatch int vs none. +(defun render-sky-tng ((arg0 time-of-day-context)) + (local-vars (v1-84 float)) + (rlet ((vf23 :class vf) + (vf27 :class vf) + ) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #x40 :b #x40 :a #x80) + ) + ) + (let + ((gp-0 (-> *display* frames (-> *display* on-screen) frame global-buf base)) + ) + (let* + ((s4-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s5-0 (-> s4-0 base)) + ) + (let* ((v1-14 s4-0) + (a0-11 (the-as object (-> v1-14 base))) + ) + (set! + (-> (the-as dma-packet a0-11) dma) + (new 'static 'dma-tag :qwc #x4 :id (dma-tag-id cnt)) + ) + (set! (-> (the-as dma-packet a0-11) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet a0-11) vif1) + (new 'static 'vif-tag :imm #x4 :cmd (vif-cmd direct) :msk #x1) + ) + (set! (-> v1-14 base) (&+ (the-as pointer a0-11) 16)) + ) + (let* ((v1-15 s4-0) + (a0-13 (the-as object (-> v1-15 base))) + ) + (set! + (-> (the-as gs-gif-tag a0-13) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x3) + ) + (set! + (-> (the-as gs-gif-tag a0-13) 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-15 base) (&+ (the-as pointer a0-13) 16)) + ) + (let* ((v1-16 s4-0) + (a0-15 (-> v1-16 base)) + ) + (set! + (-> (the-as (pointer gs-zbuf) a0-15) 0) + (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24)) + ) + (set! (-> (the-as (pointer gs-reg64) a0-15) 1) (gs-reg64 zbuf-1)) + (set! + (-> (the-as (pointer gs-test) a0-15) 2) + (new 'static 'gs-test + :ate #x1 + :atst (gs-atest always) + :zte #x1 + :ztst (gs-ztest always) + ) + ) + (set! (-> (the-as (pointer gs-reg64) a0-15) 3) (gs-reg64 test-1)) + (set! + (-> (the-as (pointer gs-alpha) a0-15) 4) + (new 'static 'gs-alpha :b #x1 :d #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-15) 5) (gs-reg64 alpha-1)) + (set! (-> v1-16 base) (&+ a0-15 48)) + ) + (init-sky-regs) + (.lvf vf27 (&-> *sky-tng-data* giftag-roof qword)) + (when *sky-drawn* + (let* ((v1-20 s4-0) + (a0-17 (the-as object (-> v1-20 base))) + ) + (set! + (-> (the-as dma-packet a0-17) dma) + (new 'static 'dma-tag :qwc #x5 :id (dma-tag-id cnt)) + ) + (set! (-> (the-as dma-packet a0-17) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet a0-17) vif1) + (new 'static 'vif-tag :imm #x5 :cmd (vif-cmd direct) :msk #x1) + ) + (set! (-> v1-20 base) (&+ (the-as pointer a0-17) 16)) + ) + (let* ((v1-21 s4-0) + (a0-19 (the-as object (-> v1-21 base))) + ) + (set! + (-> (the-as gs-gif-tag a0-19) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x4) + ) + (set! + (-> (the-as gs-gif-tag a0-19) 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-21 base) (&+ (the-as pointer a0-19) 16)) + ) + (let* ((s3-0 s4-0) + (s2-0 (-> s3-0 base)) + ) + (set! + (-> (the-as (pointer gs-tex0) s2-0) 0) + (new 'static 'gs-tex0 + :tbw #x1 + :th (log2 32) + :tw (log2 32) + :tbp0 *sky-base-block* + ) + ) + (set! (-> (the-as (pointer gs-reg64) s2-0) 1) (gs-reg64 tex0-1)) + (set! + (-> (the-as (pointer gs-tex1) s2-0) 2) + (new 'static 'gs-tex1 :mmag #x1 :mmin #x1) + ) + (set! (-> (the-as (pointer gs-reg64) s2-0) 3) (gs-reg64 tex1-1)) + (set! + (-> (the-as (pointer gs-clamp) s2-0) 4) + (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode clamp) + :wmt (gs-tex-wrap-mode clamp) + ) + ) + (set! (-> (the-as (pointer gs-reg64) s2-0) 5) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer uint64) s2-0) 6) (the-as uint 0)) + (set! (-> (the-as (pointer gs-reg64) s2-0) 7) (gs-reg64 texflush)) + (set! (-> s3-0 base) (&+ s2-0 64)) + ) + (let ((s3-1 (the-as object (-> s4-0 base)))) + (&+! (-> s4-0 base) 16) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-roof-polygons 0)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-roof-polygons 3)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-roof-polygons 6)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-roof-polygons 9)) + s4-0 + ) + (close-sky-buffer s4-0) + (let + ((v1-46 + (/ + (the-as + int + (+ (- -16 (the-as int s3-1)) (the-as int (-> s4-0 base))) + ) + 16 + ) + ) + ) + (set! + (-> (the-as dma-packet s3-1) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-46) + ) + (set! (-> (the-as dma-packet s3-1) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet s3-1) vif1) + (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-46) + ) + ) + ) + ) + (when *cloud-drawn* + (let* ((v1-52 s4-0) + (a0-32 (the-as object (-> v1-52 base))) + ) + (set! + (-> (the-as dma-packet a0-32) dma) + (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + ) + (set! (-> (the-as dma-packet a0-32) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet a0-32) vif1) + (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + (set! (-> v1-52 base) (&+ (the-as pointer a0-32) 16)) + ) + (let* ((v1-53 s4-0) + (a0-34 (the-as object (-> v1-53 base))) + ) + (set! + (-> (the-as gs-gif-tag a0-34) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x5) + ) + (set! + (-> (the-as gs-gif-tag a0-34) 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-53 base) (&+ (the-as pointer a0-34) 16)) + ) + (let* ((s3-2 s4-0) + (s2-1 (-> s3-2 base)) + ) + (set! + (-> (the-as (pointer gs-alpha) s2-1) 0) + (new 'static 'gs-alpha :b #x2 :d #x1) + ) + (set! (-> (the-as (pointer gs-reg64) s2-1) 1) (gs-reg64 alpha-1)) + (set! + (-> (the-as (pointer gs-tex0) s2-1) 2) + (new 'static 'gs-tex0 + :tbw #x1 + :th (log2 64) + :tw (log2 64) + :tbp0 (+ *sky-base-block* 32) + ) + ) + (set! (-> (the-as (pointer gs-reg64) s2-1) 3) (gs-reg64 tex0-1)) + (set! + (-> (the-as (pointer gs-tex1) s2-1) 4) + (new 'static 'gs-tex1 :mmag #x1 :mmin #x1) + ) + (set! (-> (the-as (pointer gs-reg64) s2-1) 5) (gs-reg64 tex1-1)) + (set! (-> (the-as (pointer gs-clamp) s2-1) 6) (new 'static 'gs-clamp)) + (set! (-> (the-as (pointer gs-reg64) s2-1) 7) (gs-reg64 clamp-1)) + (set! (-> (the-as (pointer int64) s2-1) 8) 0) + (set! (-> (the-as (pointer gs-reg64) s2-1) 9) (gs-reg64 texflush)) + (set! (-> s3-2 base) (&+ s2-1 80)) + ) + (let ((s3-3 (the-as object (-> s4-0 base)))) + (&+! (-> s4-0 base) 16) + (init-sky-regs) + (let ((s2-2 (the-as object (-> sky-cloud-polygons 0)))) + (set-tex-offset + (the-as int (-> *sky-tng-data* off-s-0)) + (the-as int (-> *sky-tng-data* off-t-0)) + ) + (dotimes (s1-4 9) + (render-sky-quad (the-as int s2-2) s4-0) + (set! s2-2 (-> (the-as (inline-array sky-vertex) s2-2) 4)) + ) + (set-tex-offset + (the-as int (-> *sky-tng-data* off-s-1)) + (the-as int (-> *sky-tng-data* off-t-1)) + ) + (dotimes (s1-5 9) + (render-sky-quad (the-as int s2-2) s4-0) + (set! s2-2 (-> (the-as (inline-array sky-vertex) s2-2) 4)) + ) + ) + (.lvf vf27 (&-> *sky-tng-data* giftag-base qword)) + (let ((v1-83 #x43800000)) + (.mov vf23 v1-83) + ) + (.mov v1-84 vf23) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-base-polygons 0)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-base-polygons 3)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-base-polygons 6)) + s4-0 + ) + (render-sky-tri + (the-as (inline-array sky-vertex) (-> sky-base-polygons 9)) + s4-0 + ) + (close-sky-buffer s4-0) + (let + ((v1-92 + (/ + (the-as + int + (+ (- -16 (the-as int s3-3)) (the-as int (-> s4-0 base))) + ) + 16 + ) + ) + ) + (set! + (-> (the-as dma-packet s3-3) dma) + (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-92) + ) + (set! (-> (the-as dma-packet s3-3) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet s3-3) vif1) + (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-92) + ) + ) + ) + ) + (let ((a3-0 (-> s4-0 base))) + (let ((v1-96 (the-as object (-> s4-0 base)))) + (set! + (-> (the-as dma-packet v1-96) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-96) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-96) vif1) (new 'static 'vif-tag)) + (set! (-> s4-0 base) (&+ (the-as pointer v1-96) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (bucket-id sky-draw) + s5-0 + (the-as (pointer dma-tag) a3-0) + ) + ) + ) + (let ((v1-101 *dma-mem-usage*)) + (when (nonzero? v1-101) + (set! (-> v1-101 length) (max 86 (-> v1-101 length))) + (set! (-> v1-101 data 85 name) "sky") + (+! (-> v1-101 data 85 count) 1) + (+! + (-> v1-101 data 85 used) + (&- + (-> *display* frames (-> *display* on-screen) frame global-buf base) + (the-as uint gp-0) + ) + ) + (set! (-> v1-101 data 85 total) (-> v1-101 data 85 used)) + ) + ) + ) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #xff :b #xff :a #x80) + ) + ) + 0 + (none) + ) + ) + +;; definition for function copy-sky-texture +;; INFO: Return type mismatch pointer vs none. +;; Used lq/sq +(defun copy-sky-texture ((arg0 dma-buffer) (arg1 adgif-shader) (arg2 float)) + (let ((s5-0 (-> arg0 base))) + (let ((v1-0 (the int (+ 0.5 (* 128.0 arg2)))) + (a0-2 (-> *sky-work* sky-data)) + ) + (set! (-> a0-2 0 vector4w x) v1-0) + (set! (-> a0-2 0 vector4w y) v1-0) + (set! (-> a0-2 0 vector4w z) v1-0) + (set! (-> a0-2 0 vector4w w) 128) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 0) + (-> *sky-work* adgif-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 1) + (-> *sky-work* adgif-tmpl quad 1) + ) + (let ((s4-0 (the-as object (&-> (the-as (pointer uint128) s5-0) 2)))) + (quad-copy! (the-as (pointer uint128) s4-0) (the-as pointer arg1) 5) + (set! + (-> (the-as adgif-shader s4-0) clamp) + (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode clamp) + :wmt (gs-tex-wrap-mode clamp) + ) + ) + (set! + (-> (the-as adgif-shader s4-0) alpha) + (new 'static 'gs-miptbp :tbp1 #x68 :tbw2 #x20) + ) + ) + (cond + (*sky-drawn* + (set! + (-> (the-as (pointer uint128) s5-0) 7) + (-> *sky-work* blend-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 8) + (-> *sky-work* blend-tmpl quad 1) + ) + ) + (else + (set! + (-> (the-as (pointer uint128) s5-0) 7) + (-> *sky-work* draw-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 8) + (-> *sky-work* draw-tmpl quad 1) + ) + (set! *sky-drawn* #t) + ) + ) + (quad-copy! (&+ s5-0 144) (the-as pointer (-> *sky-work* sky-data)) 5) + (set! (-> arg0 base) (&+ s5-0 224)) + ) + (none) + ) + +;; definition for function copy-cloud-texture +;; INFO: Return type mismatch pointer vs none. +;; Used lq/sq +(defun copy-cloud-texture ((arg0 dma-buffer) (arg1 adgif-shader) (arg2 float)) + (let ((s5-0 (-> arg0 base))) + (let ((v1-0 (the int (+ 0.5 (* 128.0 arg2)))) + (a0-2 (-> *sky-work* cloud-data)) + ) + (set! (-> a0-2 0 vector4w x) v1-0) + (set! (-> a0-2 0 vector4w y) v1-0) + (set! (-> a0-2 0 vector4w z) v1-0) + (set! (-> a0-2 0 vector4w w) 128) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 0) + (-> *sky-work* adgif-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 1) + (-> *sky-work* adgif-tmpl quad 1) + ) + (let ((s4-0 (the-as object (&-> (the-as (pointer uint128) s5-0) 2)))) + (quad-copy! (the-as (pointer uint128) s4-0) (the-as pointer arg1) 5) + (set! + (-> (the-as adgif-shader s4-0) clamp) + (new 'static 'gs-clamp + :wms (gs-tex-wrap-mode clamp) + :wmt (gs-tex-wrap-mode clamp) + ) + ) + (set! + (-> (the-as adgif-shader s4-0) alpha) + (new 'static 'gs-miptbp :tbp1 #x68 :tbw2 #x20) + ) + ) + (cond + (*cloud-drawn* + (set! + (-> (the-as (pointer uint128) s5-0) 7) + (-> *sky-work* blend-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 8) + (-> *sky-work* blend-tmpl quad 1) + ) + ) + (else + (set! + (-> (the-as (pointer uint128) s5-0) 7) + (-> *sky-work* draw-tmpl dma-vif quad) + ) + (set! + (-> (the-as (pointer uint128) s5-0) 8) + (-> *sky-work* draw-tmpl quad 1) + ) + (set! *cloud-drawn* #t) + ) + ) + (quad-copy! (&+ s5-0 144) (the-as pointer (-> *sky-work* cloud-data)) 5) + (set! (-> arg0 base) (&+ s5-0 224)) + ) + (none) + ) + +;; definition for function make-sky-textures +;; INFO: Return type mismatch int vs none. +(defun make-sky-textures ((arg0 time-of-day-context) (arg1 int)) + (when + (and + (= (-> *level* level arg1 status) 'active) + (-> *level* level arg1 info sky) + ) + (let ((f30-0 (-> arg0 current-interp))) + (if (zero? arg1) + (set! f30-0 (- 1.0 f30-0)) + ) + (if (= (-> arg0 active-count) 1) + (set! f30-0 1.0) + ) + (when (!= f30-0 0.0) + (let ((gp-0 (if (zero? arg1) + 32 + 39 + ) + ) + (s1-0 (-> *level* level arg1 bsp adgifs)) + ) + (when (nonzero? s1-0) + (let* + ((s2-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) + (s3-0 (-> s2-0 base)) + ) + (set-display-gs-state s2-0 *sky-base-page* 64 96 0 0) + (dotimes (s0-0 8) + (let ((f0-3 (* (-> arg0 moods arg1 sky-times s0-0) f30-0))) + (if (!= f0-3 0.0) + (copy-sky-texture s2-0 (-> s1-0 data s0-0) f0-3) + ) + ) + ) + (copy-cloud-texture s2-0 (-> s1-0 data 8) f30-0) + (let* ((v1-31 s2-0) + (a0-19 (the-as object (-> v1-31 base))) + ) + (set! + (-> (the-as dma-packet a0-19) dma) + (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)) + ) + (set! (-> (the-as dma-packet a0-19) vif0) (new 'static 'vif-tag)) + (set! + (-> (the-as dma-packet a0-19) vif1) + (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1) + ) + (set! (-> v1-31 base) (&+ (the-as pointer a0-19) 16)) + ) + (let* ((v1-32 s2-0) + (a0-21 (the-as object (-> v1-32 base))) + ) + (set! + (-> (the-as gs-gif-tag a0-21) tag) + (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1) + ) + (set! + (-> (the-as gs-gif-tag a0-21) 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-32 base) (&+ (the-as pointer a0-21) 16)) + ) + (let* ((v1-33 s2-0) + (a0-23 (-> v1-33 base)) + ) + (set! + (-> (the-as (pointer gs-alpha) a0-23) 0) + (new 'static 'gs-alpha :b #x1 :d #x1) + ) + (set! (-> (the-as (pointer gs-reg64) a0-23) 1) (gs-reg64 alpha-1)) + (set! (-> v1-33 base) (&+ a0-23 16)) + ) + (reset-display-gs-state *display* s2-0 *oddeven*) + (let ((a3-1 (-> s2-0 base))) + (let ((v1-34 (the-as object (-> s2-0 base)))) + (set! + (-> (the-as dma-packet v1-34) dma) + (new 'static 'dma-tag :id (dma-tag-id next)) + ) + (set! (-> (the-as dma-packet v1-34) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-34) vif1) (new 'static 'vif-tag)) + (set! (-> s2-0 base) (&+ (the-as pointer v1-34) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) frame bucket-group) + (the-as bucket-id gp-0) + s3-0 + (the-as (pointer dma-tag) a3-1) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/engine/gfx/texture_REF.gc b/test/decompiler/reference/engine/gfx/texture_REF.gc index f56f12f53..7b5a2962f 100644 --- a/test/decompiler/reference/engine/gfx/texture_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture_REF.gc @@ -3036,7 +3036,7 @@ unlink-textures-in-heap! texture-page-dir ((obj texture-page-dir) (heap kheap)) - (local-vars (dist-past-end pointer)) + (local-vars (dist-past-end uint)) (let ((mem-start (-> heap base)) (mem-end (-> heap top-base)) ) diff --git a/test/decompiler/reference/engine/gfx/time-of-day_REF.gc b/test/decompiler/reference/engine/gfx/time-of-day_REF.gc new file mode 100644 index 000000000..8ece4c597 --- /dev/null +++ b/test/decompiler/reference/engine/gfx/time-of-day_REF.gc @@ -0,0 +1,804 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 5 of type time-of-day-palette +;; INFO: Return type mismatch uint vs int. +(defmethod asize-of time-of-day-palette ((obj time-of-day-palette)) + (the-as int (+ (-> obj type size) (* (* (-> obj height) (-> obj width)) 4))) + ) + +;; failed to figure out what this is: +(if (zero? time-of-day-effect) + (set! time-of-day-effect nothing) + ) + +;; definition for function time-of-day-update +;; INFO: Return type mismatch int vs none. +(defbehavior time-of-day-update time-of-day-proc () + (time-of-day-effect) + (cond + ((and + (or (>= (-> self hour) 19) (>= 5 (-> self hour))) + (and + (< 45.0 (-> *time-of-day-context* num-stars)) + (-> *time-of-day-context* sky) + ) + ) + (when + (and + *dproc* + (< (-> self star-count) (the int (-> *time-of-day-context* num-stars))) + ) + (spawn (-> self stars) (math-camera-pos)) + (+! (-> self star-count) 1) + ) + ) + ((> (-> self star-count) 0) + (forall-particles-with-key + (-> self stars) + (lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo)) + (if (< (the-as uint #x493e0) (-> arg1 next-time)) + (set! (-> arg1 next-time) (the-as uint 5)) + (sparticle-kill-it arg0 arg1) + ) + (none) + ) + #t + #t + ) + (set! (-> self star-count) 0) + 0 + ) + ) + (cond + ((and + (>= (-> self time-of-day) 6.25) + (< (-> self time-of-day) 18.75) + (!= (-> *time-of-day-context* sun-fade) 0.0) + ) + (when (and *dproc* (zero? (-> self sun-count))) + (spawn (-> self sun) (math-camera-pos)) + (+! (-> self sun-count) 1) + ) + ) + ((> (-> self sun-count) 0) + (kill-and-free-particles (-> self sun)) + (set! (-> self sun-count) 0) + 0 + ) + ) + (cond + ((and + (or (>= (-> self time-of-day) 21.75) (>= 10.25 (-> self time-of-day))) + (!= (-> *time-of-day-context* sun-fade) 0.0) + ) + (when (and *dproc* (zero? (-> self green-sun-count))) + (spawn (-> self green-sun) (math-camera-pos)) + (+! (-> self green-sun-count) 1) + ) + ) + ((> (-> self green-sun-count) 0) + (kill-and-free-particles (-> self green-sun)) + (set! (-> self green-sun-count) 0) + 0 + ) + ) + (update-sky-tng-data (-> self time-of-day)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate time-of-day-tick (time-of-day-proc) + :code + (behavior () + (while #t + (+! + (-> self frame) + (the int (* (-> self time-ratio) (-> *display* time-adjust-ratio))) + ) + (when (>= (-> self frame) 300) + (while (>= (-> self frame) 300) + (+! (-> self frame) -300) + (+! (-> self second) 1) + ) + (when (>= (-> self second) 60) + (while (>= (-> self second) 60) + (+! (-> self second) -60) + (+! (-> self minute) 1) + ) + (when (>= (-> self minute) 60) + (while (>= (-> self minute) 60) + (+! (-> self minute) -60) + (+! (-> self hour) 1) + ) + (when (>= (-> self hour) 24) + (while (>= (-> self hour) 24) + (+! (-> self hour) -24) + (+! (-> self day) 1) + ) + (when (>= (-> self day) 7) + (while (>= (-> self day) 7) + (+! (-> self day) -7) + (+! (-> self week) 1) + ) + (when (>= (-> self week) 4) + (while (>= (-> self week) 4) + (+! (-> self week) -4) + (+! (-> self month) 1) + ) + (when (>= (-> self month) 12) + (while (>= (-> self month) 12) + (+! (-> self month) -12) + (+! (-> self year) 1) + ) + ) + ) + ) + ) + ) + ) + ) + (let* ((f0-4 (the float (-> self frame))) + (f0-6 (+ (* 0.0033333334 f0-4) (the float (-> self second)))) + (f0-8 (+ (* 0.016666668 f0-6) (the float (-> self minute)))) + (f0-10 (+ (* 0.016666668 f0-8) (the float (-> self hour)))) + ) + (set! (-> self time-of-day) f0-10) + (set! (-> *time-of-day-context* time) f0-10) + ) + (suspend) + ) + (none) + ) + :post + time-of-day-update + ) + +;; definition for function init-time-of-day +;; INFO: Return type mismatch object vs none. +(defbehavior init-time-of-day time-of-day-proc () + (stack-size-set! (-> self main-thread) 128) + (set! (-> self year) 0) + (set! (-> self month) 0) + (set! (-> self week) 0) + (set! (-> self day) 0) + (set! (-> self hour) 0) + (set! (-> self minute) 0) + (set! (-> self second) 0) + (set! (-> self frame) 0) + (set! (-> self time-of-day) 0.0) + (if *time-of-day-fast* + (set! (-> self time-ratio) 18000.0) + (set! (-> self time-ratio) 300.0) + ) + (set! (-> self star-count) 0) + (set! + (-> self stars) + (create-launch-control (-> *part-group-id-table* 34) self) + ) + (set! + (-> self sun) + (create-launch-control (-> *part-group-id-table* 35) self) + ) + (set! + (-> self green-sun) + (create-launch-control (-> *part-group-id-table* 36) self) + ) + (go time-of-day-tick) + (none) + ) + +;; definition for function start-time-of-day +;; INFO: Return type mismatch (pointer process) vs none. +(defun start-time-of-day () + (kill-by-name 'time-of-day-proc *active-pool*) + (let ((gp-0 (get-process *default-dead-pool* time-of-day-proc #x4000))) + (set! *time-of-day-proc* (the-as (pointer time-of-day-proc) (when gp-0 + (let + ((t9-2 + (method-of-type + time-of-day-proc + activate + ) + ) + ) + (t9-2 + (the-as + time-of-day-proc + gp-0 + ) + *default-pool* + 'time-of-day-proc + (the-as + pointer + #x70004000 + ) + ) + ) + (run-now-in-process + gp-0 + init-time-of-day + ) + (-> + gp-0 + ppointer + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function time-of-day-setup +(defun time-of-day-setup ((arg0 symbol)) + (when arg0 + (cond + ((= (-> *time-of-day-proc* 0 time-ratio) 0.0) + (if *time-of-day-fast* + (set! (-> *time-of-day-proc* 0 time-ratio) 18000.0) + (set! (-> *time-of-day-proc* 0 time-ratio) 300.0) + ) + (set! *time-of-day-mode* 8) + ) + (else + (set! (-> *time-of-day-proc* 0 time-ratio) 0.0) + (set! *time-of-day-mode* 4) + (set! (-> *time-of-day-proc* 0 hour) 12) + (set! (-> *time-of-day-proc* 0 minute) 0) + 0 + ) + ) + ) + (if (= (-> *time-of-day-proc* 0 time-ratio) 0.0) + #f + #t + ) + ) + +;; definition for function set-time-of-day +;; INFO: Return type mismatch int vs none. +(defun set-time-of-day ((arg0 float)) + (let ((v1-0 *time-of-day-proc*)) + (set! (-> v1-0 0 hour) (the int arg0)) + (let ((a0-1 (* 60.0 (- arg0 (the float (the int arg0)))))) + (set! (-> v1-0 0 minute) (the int a0-1)) + (set! + (-> v1-0 0 second) + (the int (* 60.0 (- a0-1 (the float (the int a0-1))))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function time-of-day-interp-colors +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function time-of-day-interp-colors-scratch +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function init-time-of-day-context +(defun init-time-of-day-context ((arg0 time-of-day-context)) + (set-vector! (-> arg0 title-light-group dir0 color) 0.82 0.82 0.82 1.0) + (set-vector! (-> arg0 title-light-group dir1 color) 2.0 2.0 2.0 1.0) + (set-vector! (-> arg0 title-light-group ambi color) 0.5 0.5 0.5 1.0) + (set! (-> arg0 title-light-group dir0 levels x) 1.0) + (set! (-> arg0 title-light-group dir1 levels x) 1.0) + (let ((f0-14 1.0)) + (set! (-> arg0 title-light-group ambi levels x) f0-14) + f0-14 + ) + ) + +;; definition for function update-time-of-day +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun update-time-of-day ((arg0 time-of-day-context)) + (set! (-> arg0 sky) #f) + (set! (-> arg0 target-interp) 0.0) + (when *target* + (set! (-> *target* draw light-index) (the-as uint 0)) + (when (-> *target* sidekick) + (set! (-> *target* sidekick 0 draw light-index) (the-as uint 0)) + 0 + ) + ) + (dotimes (v1-12 (-> *level* length)) + (let ((a0-4 (-> *level* level v1-12))) + (when (= (-> a0-4 status) 'active) + (if (-> a0-4 info sky) + (set! (-> arg0 sky) #t) + ) + ) + ) + ) + (let ((s4-0 (the-as (array float) (new 'stack 'array float 2)))) + 0.0 + (let ((s5-0 0) + (f30-0 (-> arg0 current-interp)) + ) + (set! *lightning-frame-done* #f) + (set! *lightning-realtime-done* #f) + (dotimes (s3-0 2) + (let ((s2-0 (-> *level* level s3-0))) + (cond + ((!= (-> s2-0 status) 'inactive) + (set! (-> s4-0 s3-0) (-> s2-0 level-distance)) + (set! (-> arg0 moods s3-0) (-> s2-0 mood)) + ((-> s2-0 mood-func) (-> s2-0 mood) (-> arg0 time) s3-0) + (if (and (= (-> s2-0 status) 'active) (-> s2-0 info sky)) + (+! s5-0 1) + ) + ) + (else + (set! (-> s4-0 s3-0) 4095996000.0) + (set! (-> arg0 moods s3-0) *default-mood*) + (update-mood-default *default-mood* (-> arg0 time) 0) + ) + ) + ) + ) + (let* ((f0-6 (-> s4-0 0)) + (f1-0 (-> s4-0 1)) + (f28-0 (cond + ((= f1-0 4095996000.0) + 0.0 + ) + ((= f0-6 4095996000.0) + 1.0 + ) + ((= f0-6 f1-0) + 0.5 + ) + ((and + (< 0.0 (-> *math-camera* trans y)) + (= (-> *level* level0 name) 'village2) + (= (-> *level* level1 name) 'sunken) + ) + 0.0 + ) + ((and + (< 0.0 (-> *math-camera* trans y)) + (= (-> *level* level0 name) 'sunken) + (= (-> *level* level1 name) 'village2) + ) + 1.0 + ) + (else + (/ f0-6 (+ f0-6 f1-0)) + ) + ) + ) + ) + (if *teleport* + (set! f30-0 f28-0) + ) + (when (not (or (paused?) (= f28-0 f30-0))) + (let ((f0-7 (- f30-0 f28-0))) + (set! f30-0 (cond + ((= (-> *setting-control* current video-mode) 'pal) + (cond + ((< (fabs f0-7) 0.00396) + f28-0 + ) + ((< f0-7 0.0) + (+ 0.00396 f30-0) + ) + (else + (+ -0.00396 f30-0) + ) + ) + ) + ((< (fabs f0-7) 0.0033) + f28-0 + ) + ((< f0-7 0.0) + (+ 0.0033 f30-0) + ) + (else + (+ -0.0033 f30-0) + ) + ) + ) + ) + ) + (set! (-> arg0 active-count) (the-as uint s5-0)) + (set! (-> arg0 interp) f28-0) + ) + (set! (-> arg0 current-interp) f30-0) + (set! *sky-drawn* #f) + (set! *cloud-drawn* #f) + (let ((s5-1 (-> arg0 current-fog))) + (cond + ((= f30-0 0.0) + (let ((v1-67 (-> arg0 moods 0 current-fog))) + (set! (-> s5-1 fog-color quad) (-> v1-67 fog-color quad)) + (set! (-> s5-1 fog-dists quad) (-> v1-67 fog-dists quad)) + (set! (-> s5-1 erase-color quad) (-> v1-67 erase-color quad)) + ) + (set! + (-> arg0 current-prt-color quad) + (-> arg0 moods 0 current-prt-color quad) + ) + (set! + (-> arg0 current-sun sun-color quad) + (-> arg0 moods 0 current-sun sun-color quad) + ) + (set! + (-> arg0 current-sun env-color quad) + (-> arg0 moods 0 current-sun env-color quad) + ) + (set! + (-> arg0 current-shadow quad) + (-> arg0 moods 0 current-shadow quad) + ) + (set! + (-> arg0 current-shadow-color quad) + (-> arg0 moods 0 current-shadow-color quad) + ) + (dotimes (s4-1 8) + (quad-copy! + (the-as pointer (-> arg0 light-group s4-1)) + (the-as pointer (-> arg0 moods 0 light-group s4-1)) + 12 + ) + ) + (set! (-> arg0 num-stars) (-> arg0 moods 0 num-stars)) + (set! (-> arg0 sun-fade) (-> *level* level0 info sun-fade)) + ) + ((= f30-0 1.0) + (let ((v1-88 (-> arg0 moods 1 current-fog))) + (set! (-> s5-1 fog-color quad) (-> v1-88 fog-color quad)) + (set! (-> s5-1 fog-dists quad) (-> v1-88 fog-dists quad)) + (set! (-> s5-1 erase-color quad) (-> v1-88 erase-color quad)) + ) + (set! + (-> arg0 current-prt-color quad) + (-> arg0 moods 1 current-prt-color quad) + ) + (set! + (-> arg0 current-sun sun-color quad) + (-> arg0 moods 1 current-sun sun-color quad) + ) + (set! + (-> arg0 current-sun env-color quad) + (-> arg0 moods 1 current-sun env-color quad) + ) + (set! + (-> arg0 current-shadow quad) + (-> arg0 moods 1 current-shadow quad) + ) + (set! + (-> arg0 current-shadow-color quad) + (-> arg0 moods 1 current-shadow-color quad) + ) + (dotimes (s4-2 8) + (quad-copy! + (the-as pointer (-> arg0 light-group s4-2)) + (the-as pointer (-> arg0 moods 1 light-group s4-2)) + 12 + ) + ) + (set! (-> arg0 num-stars) (-> arg0 moods 1 num-stars)) + (set! (-> arg0 sun-fade) (-> *level* level1 info sun-fade)) + ) + (else + (let ((s4-3 (-> arg0 moods 0 current-fog)) + (s3-1 (-> arg0 moods 1 current-fog)) + ) + (vector4-lerp! + (-> s5-1 fog-color) + (-> s4-3 fog-color) + (-> s3-1 fog-color) + f30-0 + ) + (vector4-lerp! + (-> s5-1 fog-dists) + (-> s4-3 fog-dists) + (-> s3-1 fog-dists) + f30-0 + ) + (vector4-lerp! + (-> s5-1 erase-color) + (-> s4-3 erase-color) + (-> s3-1 erase-color) + f30-0 + ) + ) + (vector4-lerp! + (-> arg0 current-prt-color) + (-> arg0 moods 0 current-prt-color) + (-> arg0 moods 1 current-prt-color) + f30-0 + ) + (vector4-lerp! + (the-as vector (-> arg0 current-sun)) + (the-as vector (-> arg0 moods 0 current-sun)) + (the-as vector (-> arg0 moods 1 current-sun)) + f30-0 + ) + (vector4-lerp! + (-> arg0 current-sun env-color) + (-> arg0 moods 0 current-sun env-color) + (-> arg0 moods 1 current-sun env-color) + f30-0 + ) + (vector4-lerp! + (-> arg0 current-shadow) + (-> arg0 moods 0 current-shadow) + (-> arg0 moods 1 current-shadow) + f30-0 + ) + (vector4-lerp! + (-> arg0 current-shadow-color) + (-> arg0 moods 0 current-shadow-color) + (-> arg0 moods 1 current-shadow-color) + f30-0 + ) + (dotimes (s4-4 8) + (dotimes (s3-2 3) + (let ((s2-1 (+ (+ (* 48 s3-2) 156 (* 192 s4-4)) (the-as int arg0)))) + (let + ((s1-0 + (+ (+ (* 48 s3-2) 156 (* 192 s4-4)) (the-as int (-> arg0 moods 0))) + ) + (s0-0 + (+ (+ (* 48 s3-2) 156 (* 192 s4-4)) (the-as int (-> arg0 moods 1))) + ) + ) + (vector4-lerp! + (the-as vector (+ s2-1 0)) + (the-as vector (+ s1-0 0)) + (the-as vector (+ s0-0 0)) + f30-0 + ) + (vector4-lerp! + (the-as vector (+ s2-1 16)) + (the-as vector (+ s1-0 16)) + (the-as vector (+ s0-0 16)) + f30-0 + ) + (vector4-lerp! + (the-as vector (+ s2-1 32)) + (the-as vector (+ s1-0 32)) + (the-as vector (+ s0-0 32)) + f30-0 + ) + ) + (vector-normalize! (the-as vector (+ s2-1 0)) 1.0) + ) + ) + (let ((s3-3 (+ (the-as uint (-> arg0 light-group 0 ambi)) (* 192 s4-4))) + (s2-2 + (+ + (the-as uint (-> arg0 moods 0 light-group 0 ambi)) + (* 192 s4-4) + ) + ) + (s1-1 + (+ + (the-as uint (-> arg0 moods 1 light-group 0 ambi)) + (* 192 s4-4) + ) + ) + ) + (vector4-lerp! + (the-as vector (+ s3-3 0)) + (the-as vector (+ s2-2 0)) + (the-as vector (+ s1-1 0)) + f30-0 + ) + (vector4-lerp! + (the-as vector (+ s3-3 16)) + (the-as vector (+ s2-2 16)) + (the-as vector (+ s1-1 16)) + f30-0 + ) + (vector4-lerp! + (the-as vector (+ s3-3 32)) + (the-as vector (+ s2-2 32)) + (the-as vector (+ s1-1 32)) + f30-0 + ) + ) + ) + (set! + (-> arg0 num-stars) + (+ + (-> arg0 moods 0 num-stars) + (* (- (-> arg0 moods 1 num-stars) (-> arg0 moods 0 num-stars)) f30-0) + ) + ) + (let ((f0-20 (-> *level* level0 info sun-fade))) + (set! + (-> arg0 sun-fade) + (+ f0-20 (* f30-0 (- (-> *level* level1 info sun-fade) f0-20))) + ) + ) + ) + ) + (dotimes (s4-5 2) + (make-sky-textures arg0 s4-5) + ) + (set! (-> sky-base-polygons 0 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 1 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 2 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 3 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 4 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 5 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 6 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 7 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 8 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 9 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 10 col quad) (-> s5-1 erase-color quad)) + (set! (-> sky-base-polygons 11 col quad) (-> s5-1 erase-color quad)) + ) + ) + ) + (set! + (-> arg0 current-sun env-color x) + (* 0.5019608 (-> arg0 current-sun env-color x)) + ) + (set! + (-> arg0 current-sun env-color y) + (* 0.5019608 (-> arg0 current-sun env-color y)) + ) + (set! + (-> arg0 current-sun env-color z) + (* 0.5019608 (-> arg0 current-sun env-color z)) + ) + (set! + (-> arg0 current-sun env-color w) + (* 0.5019608 (-> arg0 current-sun env-color w)) + ) + (let ((v1-179 (-> arg0 current-fog))) + (set! + *fog-color* + (new 'static 'rgba + :r (the int (-> v1-179 fog-color x)) + :g (the int (-> v1-179 fog-color y)) + :b (the int (-> v1-179 fog-color z)) + ) + ) + ) + (let ((v1-184 (-> arg0 current-fog erase-color))) + (set! + (-> arg0 erase-color) + (new 'static 'rgba + :a #x80 + :b (the int (-> v1-184 z)) + :g (the int (-> v1-184 y)) + :r (the int (-> v1-184 x)) + ) + ) + ) + (set! (-> *math-camera* fog-start) (-> arg0 current-fog fog-dists x)) + (set! (-> *math-camera* fog-end) (-> arg0 current-fog fog-dists y)) + (set! (-> *math-camera* fog-max) (-> arg0 current-fog fog-dists z)) + (set! (-> *math-camera* fog-min) (-> arg0 current-fog fog-dists w)) + (let* ((v1-195 (-> *target* draw light-index)) + (f30-1 (-> arg0 target-interp)) + (s4-6 (-> arg0 light-group)) + (s5-2 (-> arg0 light-group v1-195)) + ) + (when (nonzero? v1-195) + (cond + ((= f30-1 1.0) + ) + ((= f30-1 0.0) + (quad-copy! + (the-as pointer (-> arg0 light-group v1-195)) + (the-as pointer (-> arg0 light-group)) + 12 + ) + ) + (else + (dotimes (s3-4 4) + (vector4-lerp! + (the-as vector (+ (the-as uint (-> s5-2 dir0)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s4-6 0)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s5-2 dir0)) (* 48 s3-4))) + f30-1 + ) + (vector4-lerp! + (the-as vector (+ (the-as uint (-> s5-2 dir0 color)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s4-6 0 dir0 color)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s5-2 dir0 color)) (* 48 s3-4))) + f30-1 + ) + (vector4-lerp! + (the-as vector (+ (the-as uint (-> s5-2 dir0 levels)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s4-6 0 dir0 levels)) (* 48 s3-4))) + (the-as vector (+ (the-as uint (-> s5-2 dir0 levels)) (* 48 s3-4))) + f30-1 + ) + (vector-normalize! + (the-as vector (+ (the-as uint (-> s5-2 dir0)) (* 48 s3-4))) + 1.0 + ) + ) + ) + ) + (let ((a2-30 (new 'stack-no-clear 'vector))) + (set! (-> a2-30 x) (- (-> s5-2 dir0 direction x))) + (set! (-> a2-30 y) (- (-> s5-2 dir0 direction y))) + (set! (-> a2-30 z) (- (-> s5-2 dir0 direction z))) + (when (< (-> s5-2 dir0 direction y) 0.9063) + (let* ((f0-56 0.4226) + (f1-17 (-> a2-30 x)) + (f1-19 (* f1-17 f1-17)) + (f2-7 (-> a2-30 z)) + (f0-57 (/ f0-56 (sqrtf (+ f1-19 (* f2-7 f2-7))))) + ) + (set! (-> a2-30 x) (* (-> a2-30 x) f0-57)) + (set! (-> a2-30 y) -0.9063) + (set! (-> a2-30 z) (* (-> a2-30 z) f0-57)) + ) + ) + (vector4-lerp! + (-> arg0 current-shadow) + (-> arg0 current-shadow) + a2-30 + f30-1 + ) + ) + (vector-normalize! (-> arg0 current-shadow) 1.0) + ) + ) + (reset! *palette-fade-controls*) + 0 + (none) + ) + +;; definition for method 10 of type palette-fade-controls +;; Used lq/sq +(defmethod + set-fade! + palette-fade-controls + ((obj palette-fade-controls) + (arg0 int) + (arg1 float) + (arg2 float) + (arg3 vector) + ) + (cond + ((and (>= arg0 0) (< arg0 8)) + (let ((v1-3 (-> obj control arg0))) + (when (< arg2 (-> v1-3 actor-dist)) + (if arg3 + (set! (-> v1-3 trans quad) (-> arg3 quad)) + ) + (set! (-> v1-3 fade) (fmax 0.0 (fmin 1.993 arg1))) + (let ((f0-3 arg2)) + (set! (-> v1-3 actor-dist) f0-3) + f0-3 + ) + ) + ) + ) + (else + (format 0 "ERROR: Bogus palette-fade-control index!~%") + ) + ) + ) + +;; definition for method 9 of type palette-fade-controls +(defmethod reset! palette-fade-controls ((obj palette-fade-controls)) + (countdown (v1-0 8) + (let ((a1-2 (-> obj control v1-0))) + (set! (-> a1-2 fade) 0.0) + (set! (-> a1-2 actor-dist) 4096000000.0) + ) + ) + #f + ) + +;; failed to figure out what this is: +(start-time-of-day) + + + + diff --git a/test/decompiler/reference/engine/level/load-boundary-data_REF.gc b/test/decompiler/reference/engine/level/load-boundary-data_REF.gc new file mode 100644 index 000000000..145a8be66 --- /dev/null +++ b/test/decompiler/reference/engine/level/load-boundary-data_REF.gc @@ -0,0 +1,4172 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(set! (-> *lb-editor-parms* boundary) #f) + +;; definition for symbol *load-boundary-list*, type load-boundary +(define *load-boundary-list* (the-as load-boundary #f)) + +;; definition for symbol *static-load-boundary-list*, type (array array) +(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 + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(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/test/decompiler/reference/engine/level/load-boundary-h_REF.gc b/test/decompiler/reference/engine/level/load-boundary-h_REF.gc new file mode 100644 index 000000000..acbb6975c --- /dev/null +++ b/test/decompiler/reference/engine/level/load-boundary-h_REF.gc @@ -0,0 +1,185 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type lbvtx +(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 + ) + +;; definition for method 3 of type lbvtx +;; Used lq/sq +(defmethod inspect lbvtx ((obj lbvtx)) + (format #t "[~8x] ~A~%" obj 'lbvtx) + (format #t "~Tx: ~f~%" (-> obj x)) + (format #t "~Ty: ~f~%" (-> obj y)) + (format #t "~Tz: ~f~%" (-> obj z)) + (format #t "~Tv0: ~D~%" (-> obj v0)) + (format #t "~Tv1: ~D~%" (-> obj v1)) + (format #t "~Tv2: ~D~%" (-> obj v2)) + (format #t "~Tix: ~D~%" (-> obj ix)) + (format #t "~Tquad: ~D~%" (-> obj quad)) + (format #t "~Tv: #~%" (&-> obj x)) + obj + ) + +;; definition of type load-boundary-crossing-command +(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 + ) + +;; definition for method 3 of type load-boundary-crossing-command +(defmethod + inspect + load-boundary-crossing-command + ((obj load-boundary-crossing-command)) + (format #t "[~8x] ~A~%" obj 'load-boundary-crossing-command) + (format #t "~Tcmd: ~D~%" (-> obj cmd)) + (format #t "~Tbparm[3] @ #x~X~%" (-> obj bparm)) + (format #t "~Tparm[2] @ #x~X~%" (-> obj parm)) + (format #t "~Tlev0: ~A~%" (-> obj lev0)) + (format #t "~Tlev1: ~A~%" (-> obj lev1)) + (format #t "~Tdisplev: ~A~%" (-> obj lev0)) + (format #t "~Tdispcmd: ~A~%" (-> obj lev1)) + (format #t "~Tnick: ~A~%" (-> obj lev0)) + (format #t "~Tforcelev: ~A~%" (-> obj lev0)) + (format #t "~Tforceonoff: ~A~%" (-> obj lev1)) + (format #t "~Tcheckname: ~A~%" (-> obj lev0)) + obj + ) + +;; definition of type load-boundary +(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) + ) + ) + +;; definition for method 3 of type load-boundary +(defmethod inspect load-boundary ((obj load-boundary)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tnum-points: ~D~%" (-> obj num-points)) + (format #t "~Tflags: ~D~%" (-> obj flags)) + (format #t "~Ttop-plane: ~f~%" (-> obj top-plane)) + (format #t "~Tbot-plane: ~f~%" (-> obj bot-plane)) + (format #t "~Ttri-cnt: ~D~%" (-> obj tri-cnt)) + (format #t "~Tnext: ~A~%" (-> obj next)) + (format + #t + "~Tcmd-fwd: #~%" + (-> obj cmd-fwd) + ) + (format + #t + "~Tcmd-bwd: #~%" + (-> obj cmd-bwd) + ) + (format #t "~Trejector: #~%" (-> obj rejector)) + (format #t "~Tdata[1] @ #x~X~%" (-> obj data)) + obj + ) + +;; definition for symbol *load-boundary-list*, type load-boundary +(define *load-boundary-list* (the-as load-boundary #f)) + +;; definition for symbol *load-boundary-target*, type (inline-array lbvtx) +(define *load-boundary-target* (the-as (inline-array lbvtx) (malloc 'global 64))) + +;; definition for method 0 of type load-boundary +;; Used lq/sq +(defmethod + new + load-boundary + ((allocation symbol) + (type-to-make type) + (arg0 int) + (arg1 symbol) + (arg2 symbol) + ) + (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 + ) + ) + +;; failed to figure out what this is: +0 + + + + diff --git a/test/decompiler/reference/engine/level/load-boundary_REF.gc b/test/decompiler/reference/engine/level/load-boundary_REF.gc new file mode 100644 index 000000000..629e5f1f2 --- /dev/null +++ b/test/decompiler/reference/engine/level/load-boundary_REF.gc @@ -0,0 +1,2560 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type lb-editor-parms +(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 + ) + +;; definition for method 3 of type lb-editor-parms +(defmethod inspect lb-editor-parms ((obj lb-editor-parms)) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~Tboundary: ~A~%" (-> obj boundary)) + (format #t "~Tvertex: ~D~%" (-> obj vertex)) + (format #t "~Tx-origin: ~f~%" (-> obj x-origin)) + (format #t "~Tz-origin: ~f~%" (-> obj z-origin)) + obj + ) + +;; definition for symbol *lb-editor-parms*, type lb-editor-parms +(define *lb-editor-parms* (new 'global 'lb-editor-parms)) + +;; failed to figure out what this is: +(set! (-> *lb-editor-parms* boundary) #f) + +;; definition (debug) for function init-boundary-regs +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition (debug) for function add-boundary-shader +;; INFO: Return type mismatch pointer vs none. +(defun-debug add-boundary-shader ((arg0 texture-id) (arg1 dma-buffer)) + (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) + ) + +;; definition (debug) for function draw-boundary-polygon +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition (debug) for function render-boundary-quad +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition (debug) for function render-boundary-tri +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for symbol *boundary-polygon*, type (inline-array lbvtx) +(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) + ) + ) + +;; definition (debug) for function draw-boundary-side +;; INFO: Return type mismatch int vs none. +(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)) + (render-boundary-quad (-> *boundary-polygon* 0) arg3) + 0 + (none) + ) + ) + +;; definition (debug) for function draw-boundary-cap +;; INFO: Return type mismatch int vs 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)) + (render-boundary-tri (-> *boundary-polygon* 0) arg2) + ) + 0 + (none) + ) + ) + +;; definition (debug) for function boundary-set-color +;; INFO: Return type mismatch int vs none. +(defun-debug + boundary-set-color + ((arg0 lbvtx) (arg1 load-boundary-crossing-command)) + (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) + ) + +;; definition (debug) for function render-boundary +;; INFO: Return type mismatch int vs 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 + (/ + (the-as int (+ (- -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) + ) + +;; definition (debug) for function format-boundary-cmd +;; INFO: Return type mismatch int vs none. +(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) + ) + +;; definition (debug) for function edit-load-boundaries +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(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) + ) + +;; definition (debug) for function copy-load-command! +;; INFO: Return type mismatch int vs 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) + ) + +;; definition (debug) for function copy-load-boundary! +;; INFO: Return type mismatch int vs 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) + ) + +;; definition (debug) for function replace-load-boundary +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function replace-load-boundary has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition (debug) for function lb-del +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-del has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition (debug) for function lb-add-vtx-before +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-add-vtx-before has a return type of none, but the expression builder found a return statement. +;; Used lq/sq +(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) + ) + +;; definition (debug) for function lb-add-vtx-after +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-add-vtx-after has a return type of none, but the expression builder found a return statement. +;; Used lq/sq +(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) + ) + +;; definition (debug) for function lb-del-vtx +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-del-vtx has a return type of none, but the expression builder found a return statement. +;; Used lq/sq +(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) + ) + +;; definition (debug) for function save-boundary-cmd +;; INFO: Return type mismatch int vs 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) + ) + +;; definition for function load-boundary-from-template +;; INFO: Return type mismatch load-boundary vs 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) + ) + +;; definition (debug) for function ---lb-save +;; INFO: Return type mismatch int vs 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) + ) + +;; definition (debug) for function lb-add +(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 + ) + ) + +;; definition (debug) for function lb-add-plane +(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 + ) + ) + +;; definition (debug) for function lb-add-load +;; INFO: Return type mismatch int vs none. +(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) + ) + +;; definition (debug) for function lb-add-load-plane +;; INFO: Return type mismatch int vs 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) + ) + +;; definition for function lb-flip +;; WARN: Expression building failed: Function lb-flip has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition for function lb-set-camera +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-set-camera has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition for function lb-set-player +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-set-player has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition (debug) for function lb-copy +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function lb-copy has a return type of none, but the expression builder found a return statement. +;; Used lq/sq +(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) + ) + +;; definition for function render-boundaries +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(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) + ) + +;; definition for function find-bounding-circle +;; INFO: Return type mismatch int vs none. +(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) + ) + +;; definition for symbol *triangulation-buffer*, type (inline-array lbvtx) +(define + *triangulation-buffer* + (the-as (inline-array lbvtx) (malloc 'global 4096)) + ) + +;; definition for function triangulate-boundary +;; INFO: Return type mismatch int vs object. +;; Used lq/sq +(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 + ) + +;; definition for function try-corner +(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 + ) + +;; definition for function split-monotone-polygon +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function split-monotone-polygon has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition for function fix-boundary-normals +;; INFO: Return type mismatch int vs 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) + ) + +;; definition for function point-in-polygon +(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 + ) + +;; definition for function check-closed-boundary +;; INFO: Return type mismatch int vs symbol. +(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) + ) + +;; definition for function check-open-boundary +;; INFO: Return type mismatch int vs symbol. +(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) + ) + +;; definition for function command-get-int +(defun command-get-int ((arg0 object) (arg1 int)) + (cond + ((null? arg0) + (empty) + 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 + (empty) + arg1 + ) + ) + ) + +;; definition for function command-get-float +(defun command-get-float ((arg0 object) (arg1 float)) + (cond + ((null? arg0) + (empty) + 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 + (empty) + arg1 + ) + ) + ) + +;; definition for function command-get-time +(defun command-get-time ((arg0 object) (arg1 int)) + (cond + ((null? arg0) + (empty) + 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 + (empty) + arg1 + ) + ) + ) + +;; definition for function command-get-param +(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 + ) + ) + ) + +;; definition for function command-get-quoted-param +(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) + ) + ) + +;; definition for method 9 of type load-state +(defmethod reset! load-state ((obj load-state)) + (set! (-> obj want 0 name) #f) + (set! (-> obj want 0 display?) #f) + (set! (-> obj want 0 force-vis?) #f) + (set! (-> obj want 0 force-inside?) #f) + (set! (-> obj want 1 name) #f) + (set! (-> obj want 1 display?) #f) + (set! (-> obj want 1 force-vis?) #f) + (set! (-> obj want 1 force-inside?) #f) + (set! (-> obj command-list) '()) + (dotimes (v1-1 256) + (set! (-> obj object-name v1-1) #f) + (set! (-> obj object-status v1-1) (the-as basic 0)) + ) + obj + ) + +;; definition for method 11 of type load-state +(defmethod want-levels load-state ((obj load-state) (arg0 symbol) (arg1 symbol)) + (dotimes (v1-0 2) + (cond + ((= (-> obj want v1-0 name) arg0) + (set! arg0 #f) + ) + ((= (-> obj want v1-0 name) arg1) + (set! arg1 #f) + ) + (else + (set! (-> obj want v1-0 name) #f) + ) + ) + ) + (when arg0 + (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 2) + ) + ) + ) + (when arg1 + (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 2) + ) + ) + ) + 0 + ) + +;; definition for method 12 of type load-state +(defmethod + want-display-level + 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 display?) arg1) + (return 0) + ) + ) + (if arg1 + (format 0 "ERROR: can't display ~A because it isn't loaded~%" arg0) + ) + 0 + ) + +;; definition for method 13 of type load-state +(defmethod want-vis load-state ((obj load-state) (arg0 symbol)) + (set! (-> obj vis-nick) arg0) + 0 + ) + +;; definition for method 14 of type load-state +(defmethod + want-force-vis + 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-vis?) arg1) + (return 0) + ) + ) + (format 0 "ERROR: can't force vis on ~A because it isn't loaded~%" arg0) + 0 + ) + +;; definition for method 20 of type load-state +;; INFO: Return type mismatch int vs none. +;; WARN: Expression building failed: Function (method 20 load-state) has a return type of none, but the expression builder found a return statement. +(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) + ) + +;; definition for function load-state-want-levels +(defun load-state-want-levels ((arg0 symbol) (arg1 symbol)) + (want-levels *load-state* arg0 arg1) + ) + +;; definition for function load-state-want-display-level +(defun load-state-want-display-level ((arg0 symbol) (arg1 symbol)) + (want-display-level *load-state* arg0 arg1) + ) + +;; definition for function load-state-want-vis +(defun load-state-want-vis ((arg0 symbol)) + (want-vis *load-state* arg0) + ) + +;; definition for function load-state-want-force-vis +(defun load-state-want-force-vis ((arg0 symbol) (arg1 symbol)) + (want-force-vis *load-state* arg0 arg1) + ) + +;; definition for symbol *display-load-commands*, type symbol +(define *display-load-commands* #f) + +;; definition for symbol *backup-load-state*, type load-state +(define *backup-load-state* (new 'global 'load-state)) + +;; definition for method 17 of type 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 + ) + +;; definition for method 18 of type load-state +(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 + ) + +;; definition for method 19 of type load-state +(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 + ) + +;; definition for function command-list-get-process +;; INFO: Return type mismatch object vs process. +(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) + ) + ) + +;; definition for method 16 of type load-state +(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 + ) + +;; definition for method 15 of type load-state +;; INFO: Return type mismatch int vs none. +(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 + (ppointer->process (-> *setting-control* current movie)) + ) + ) + (set! a1-40 (cond + (a1-40 + (empty) + 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) + ) + ) + +;; definition for function check-boundary +;; INFO: Return type mismatch object vs 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) + ) + +;; definition (perm) for symbol *load-state*, type load-state +(define-perm *load-state* load-state (new 'global 'load-state)) + + + + diff --git a/test/decompiler/reference/kernel/gstate_REF.gc b/test/decompiler/reference/kernel/gstate_REF.gc index 531492412..fe228ce8c 100644 --- a/test/decompiler/reference/kernel/gstate_REF.gc +++ b/test/decompiler/reference/kernel/gstate_REF.gc @@ -145,15 +145,20 @@ ) ;; definition for function send-event-function -(defun send-event-function ((arg0 process) (arg1 event-message-block)) +(defun send-event-function ((arg0 process-tree) (arg1 event-message-block)) (with-pp - (when (and arg0 (!= (-> arg0 type) process-tree) (-> arg0 event-hook)) + (when + (and + arg0 + (!= (-> arg0 type) process-tree) + (-> (the-as process arg0) event-hook) + ) (let ((gp-0 pp)) - (let ((s6-1 arg0)) + (let ((s6-1 (the-as process arg0))) ) (let ((v0-0 - ((-> arg0 event-hook) + ((-> (the-as process arg0) event-hook) (-> arg1 from) (-> arg1 num-params) (-> arg1 message) diff --git a/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc b/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc index c22e6975f..c8b9bfd72 100644 --- a/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc +++ b/test/decompiler/reference/levels/misty/misty-conveyor_REF.gc @@ -910,9 +910,9 @@ (let ((t9-8 send-event-function) (v1-42 (-> self object-on-paddle)) ) - (t9-8 (the-as process (if v1-42 - (-> v1-42 0 max-value) - ) + (t9-8 (the-as process-tree (if v1-42 + (-> v1-42 0 max-value) + ) ) a1-2 ) diff --git a/test/decompiler/reference/levels/swamp/swamp-rat-nest_REF.gc b/test/decompiler/reference/levels/swamp/swamp-rat-nest_REF.gc index 05dd8c408..30814c5ae 100644 --- a/test/decompiler/reference/levels/swamp/swamp-rat-nest_REF.gc +++ b/test/decompiler/reference/levels/swamp/swamp-rat-nest_REF.gc @@ -1633,7 +1633,7 @@ swamp-rat-nest-default-event-handler ) ) (if a0-1 - (send-event (the-as process a0-1) 'victory) + (send-event a0-1 'victory) ) ) (set! gp-0 (-> gp-0 0 brother)) diff --git a/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc b/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc index a183eac38..1480e7f03 100644 --- a/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc +++ b/test/decompiler/reference/levels/swamp/swamp-rat_REF.gc @@ -88,7 +88,7 @@ ) ) (if a0-4 - (send-event (the-as process a0-4) 'victory) + (send-event (the-as process-tree a0-4) 'victory) (go (method-of-object obj nav-enemy-victory)) ) ) diff --git a/test/offline/config.jsonc b/test/offline/config.jsonc index 49283cadf..e13261f10 100644 --- a/test/offline/config.jsonc +++ b/test/offline/config.jsonc @@ -89,6 +89,15 @@ // stat collection "start-perf-stat-collection", "end-perf-stat-collection", + // double definition + "(method 3 game-save)", + + // new stack boxed array + "update-time-of-day", + + // weird asm, was rewritten + "close-sky-buffer", + // float to int "(method 10 bsp-header)",