diff --git a/common/util/Trie.h b/common/util/Trie.h index f4cf65cc75..a2002258a3 100644 --- a/common/util/Trie.h +++ b/common/util/Trie.h @@ -37,15 +37,9 @@ class Trie { ~Trie(); private: - static constexpr int CHAR_START = ' '; - static constexpr int CHAR_END = '~' + 1; - static constexpr int CHAR_SIZE = CHAR_END - CHAR_START; - - static int idx(char c) { - assert(c >= CHAR_START); - assert(c < CHAR_END); - return c - CHAR_START; - } + static constexpr int CHAR_SIZE = 256; + + static int idx(char c) { return (u8)c; } struct Node { T* value = nullptr; diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 67ac237219..06eab4f026 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -6503,7 +6503,7 @@ :size-assert #x20 :flag-assert #x1300000020 (:methods - (dummy-18 (_type_ vector) none 18) + (execute-ambient (_type_ vector) none 18) ) ) @@ -6536,7 +6536,7 @@ ;; inherited inspect of process (:methods (print-text (_type_) none 14) - (dummy-15 (_type_) symbol 15) + (appeared-for-long-enough? (_type_) symbol 15) ) (:states (level-hint-sidekick string) @@ -7845,9 +7845,8 @@ :flag-assert #x90000000c ) -(declare-type joint-anim-compressed-hdr structure) (deftype joint-anim-compressed (joint-anim) - ((data joint-anim-compressed-hdr :dynamic :offset-assert 12) ;; guess + ((data uint32 :dynamic :offset-assert 12) ) :method-count-assert 9 :size-assert #xc @@ -7856,7 +7855,7 @@ (deftype joint-anim-frame (structure) ((matrices matrix 2 :inline :offset-assert 0) - (data uint32 :dynamic :offset-assert 128) ;; guess + (data matrix :inline :dynamic :offset-assert 128) ) :method-count-assert 9 :size-assert #x80 @@ -7868,7 +7867,6 @@ (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) - (unknown-half int16 :score 100 :offset 6) ;; see pov-camera-play-and-reposition (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) @@ -7925,8 +7923,8 @@ :flag-assert #xd00000014 (:methods (login (_type_) _type_ 9) - (dummy-10 (_type_ string type) joint 10) ;; can also be art-joint-anim - (dummy-11 (_type_ string type) int 11) + (lookup-art (_type_ string type) joint 10) ;; can also be art-joint-anim + (lookup-idx-of-art (_type_ string type) int 11) (needs-link? (_type_) symbol 12) ) ) @@ -8033,7 +8031,7 @@ :size-assert #x21 :flag-assert #xa00000021 (:methods - (dummy-9 (_type_ skeleton-group art-group entity) _type_ 9) + (setup-lods! (_type_ skeleton-group art-group entity) _type_ 9) ) ) @@ -21255,7 +21253,7 @@ ;; - Functions -(define-extern pov-camera-play-and-reposition (function joint-anim-compressed vector float none :behavior pov-camera)) +(define-extern pov-camera-play-and-reposition (function art-joint-anim vector float none :behavior pov-camera)) ;; ---------------------- diff --git a/goal_src/engine/ambient/ambient.gc b/goal_src/engine/ambient/ambient.gc index fbd77593d5..cbae1e044d 100644 --- a/goal_src/engine/ambient/ambient.gc +++ b/goal_src/engine/ambient/ambient.gc @@ -242,7 +242,7 @@ (the-as symbol (and (the-as level-hint a0-0) (and (= (-> (the-as level-hint a0-0) next-state name) 'level-hint-normal) - (not (dummy-15 (the-as level-hint a0-0))) + (not (appeared-for-long-enough? (the-as level-hint a0-0))) ) ) ) @@ -398,7 +398,7 @@ (none) ) -(defmethod dummy-15 level-hint ((obj level-hint)) +(defmethod appeared-for-long-enough? level-hint ((obj level-hint)) (and (!= (-> obj next-state name) 'level-hint-sidekick) (< 1500 (-> obj total-time))) ) @@ -1097,7 +1097,7 @@ (define *execute-ambients* #t) -(defmethod dummy-18 drawable-ambient ((obj drawable-ambient) (arg0 vector)) +(defmethod execute-ambient drawable-ambient ((obj drawable-ambient) (arg0 vector)) ((-> obj ambient ambient-data function) obj arg0) 0 (none) diff --git a/goal_src/engine/anim/joint.gc b/goal_src/engine/anim/joint.gc index ec4e6308d1..3e122b14c6 100644 --- a/goal_src/engine/anim/joint.gc +++ b/goal_src/engine/anim/joint.gc @@ -240,12 +240,12 @@ #f ) -(defmethod dummy-10 art ((obj art) (arg0 string) (arg1 type)) +(defmethod lookup-art art ((obj art) (arg0 string) (arg1 type)) "Look-up an art with the given name and type." (the-as joint #f) ) -(defmethod dummy-11 art ((obj art) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art ((obj art) (arg0 string) (arg1 type)) "Look up the index of an art with the given name and type." (the-as int #f) ) @@ -351,7 +351,7 @@ ) ) -(defmethod dummy-10 art-group ((obj art-group) (arg0 string) (arg1 type)) +(defmethod lookup-art art-group ((obj art-group) (arg0 string) (arg1 type)) "Get the art with the given name and type. Set type to false if you don't care." (the-as joint @@ -369,7 +369,7 @@ ) ) ) - (the-as art-element #f) + (the-as art #f) ) (else ;; no type (also no weird after ag name check) @@ -378,13 +378,13 @@ (return (the-as joint (-> obj data s4-1))) ) ) - (the-as art-element #f) + (the-as art #f) ) ) ) ) -(defmethod dummy-11 art-group ((obj art-group) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art-group ((obj art-group) (arg0 string) (arg1 type)) "Get the index of the art with the given name and type. Set type to false if you don't care. Will return #f if the art is not found." (cond @@ -507,7 +507,7 @@ (the-as int (+ (-> art size) (* (-> obj length) 4))) ) -(defmethod dummy-10 art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) +(defmethod lookup-art art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 (dotimes (s3-0 (-> obj length)) @@ -528,7 +528,7 @@ ) ) -(defmethod dummy-11 art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 (dotimes (s3-0 (-> obj length)) @@ -655,7 +655,7 @@ (sv-48 joint-control-channel) (sv-52 object) (sv-56 int) - (sv-64 joint) + (sv-64 art-joint-anim) (sv-80 string) ) (set! sv-16 (+ (length (-> arg2 name)) 1)) @@ -687,10 +687,10 @@ ) ) ) - (set! sv-64 (dummy-10 arg1 *temp-string* art-joint-anim)) + (set! sv-64 (the-as art-joint-anim (lookup-art arg1 *temp-string* art-joint-anim))) (cond (sv-64 - (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) + (set! (-> sv-48 frame-group) sv-64) ) (else (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40))) diff --git a/goal_src/engine/anim/mspace-h.gc b/goal_src/engine/anim/mspace-h.gc index b2199eea3f..9cd473c6bd 100644 --- a/goal_src/engine/anim/mspace-h.gc +++ b/goal_src/engine/anim/mspace-h.gc @@ -5,22 +5,18 @@ ;; name in dgo: mspace-h ;; dgos: GAME, ENGINE -;; There's three main types: +;; this file contains types for the skeletal animation system. +;; the "bones" are the actual things with positions/orientations/scales in the game world. +;; the "joints" define how the bones are connected. +;; a "cspace" links together a bone, joint, and a way to control the joint (and bone) + +;; There's three main container types: ;; - The cspace-array. This contains references to the bones and the joints. (called node-list) ;; - The skeleton: This contains the bones. (called skeleton) -;; - The joint-control: this has the logic for running joint animations. (called skel) - -;; There's three system's involved with animation: -;; - joint control - this figures out which animations to play. -;; the big list of playing animations in *stats-target* are all the joint control channels. - -;; - joint decompression. The compressed joint animations store compressed joint data that must -;; be streamed and decompressed. - -;; - bones. This is figuring out the location of each "bone" in the world. +;; - The joint-control (not in this file): this has the logic for running joint animations. (called skel) -;; First, the joint. This type just describes how the skeleton is connected. +;; First, the joint. This type just describes how the skeleton is connected and the bind pose. (deftype joint (basic) ((name basic :offset-assert 4) ;; the joint's name (neckA, neckB, Rtoes, etc) (number int32 :offset-assert 8) ;; the joint's number in the cspace-array @@ -85,9 +81,9 @@ (joint-num int16 :offset-assert 8) ;; seems to be 0 always?? (geo basic :offset-assert 12) ;; seems to be #f always (bone bone :offset-assert 16) ;; points to our bone. - (param0 function :offset-assert 20) ;; ?? - (param1 basic :offset-assert 24) ;; ?? - (param2 basic :offset-assert 28) ;; ?? + (param0 function :offset-assert 20) ;; function to run to update. + (param1 basic :offset-assert 24) ;; parameter + (param2 basic :offset-assert 28) ;; parameter ) :method-count-assert 10 :size-assert #x20 diff --git a/goal_src/engine/camera/pov-camera.gc b/goal_src/engine/camera/pov-camera.gc index 809ef1da92..929ab2e42e 100644 --- a/goal_src/engine/camera/pov-camera.gc +++ b/goal_src/engine/camera/pov-camera.gc @@ -48,7 +48,7 @@ (suspend) ) (let ((gp-0 0)) - (let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f)))) + (let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f)))) (if v1-7 (set! gp-0 (+ (-> v1-7 number) 1)) ) @@ -71,14 +71,14 @@ ) ) -(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 joint-anim-compressed) (arg1 vector) (arg2 float)) +(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float)) (let ((s4-0 #f)) (let ((v1-2 (-> self skel root-channel 0))) - (set! (-> v1-2 frame-group) (the-as art-joint-anim arg0)) - (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1))) + (set! (-> v1-2 frame-group) arg0) + (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 0 length) -1))) (set! (-> v1-2 param 1) arg2) (set! (-> v1-2 frame-num) 0.0) - (joint-control-channel-group! v1-2 (the-as art-joint-anim arg0) num-func-seek!) + (joint-control-channel-group! v1-2 arg0 num-func-seek!) ) (until (ja-done? 0) (let ((v1-4 (and (not s4-0) (< (the float (+ (-> (if (> (-> self skel active-channels) 0) @@ -282,7 +282,7 @@ (cond ((= (-> arg2 type) string) (logior! (-> self skel status) 32) - (let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim))) + (let ((s5-1 (lookup-art (-> self draw art-group) arg2 art-joint-anim))) (if (not s5-1) (go process-drawable-art-error arg2) ) diff --git a/goal_src/engine/collide/collide-shape.gc b/goal_src/engine/collide/collide-shape.gc index 0fa84b1400..e9abdbbe13 100644 --- a/goal_src/engine/collide/collide-shape.gc +++ b/goal_src/engine/collide/collide-shape.gc @@ -2177,23 +2177,6 @@ (v1-0 (-> obj cshape)) (a0-1 (-> obj transform-index)) ) - ;; HACK set all bones to identity. Fixes some issues with press O to talk - ;; but doesn't seem to fix mesh issues (may be another bug there) - (#when NO_BONES_HACK - (cond - ((nonzero? a1-1) - (cond - ((>= a0-1 0) - (dotimes (i (-> a1-1 length)) - (matrix-identity! (-> a1-1 data i bone transform)) - (set! (-> a1-1 data i bone transform vector 3 quad) (-> v1-0 trans quad)) - ) - ) - ) - ) - ) - (set! a0-1 -2) - ) (cond ((nonzero? a1-1) diff --git a/goal_src/engine/data/art-h.gc b/goal_src/engine/data/art-h.gc index 17e5be8177..fb9378e57c 100644 --- a/goal_src/engine/data/art-h.gc +++ b/goal_src/engine/data/art-h.gc @@ -5,6 +5,12 @@ ;; name in dgo: art-h ;; dgos: GAME, ENGINE +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; joint animation +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; base type for all joint animations +;; note that this refers to an animation for a single joint. (deftype joint-anim (basic) ((name string :offset-assert 4) (number int16 :offset-assert 8) @@ -15,6 +21,8 @@ :flag-assert #x90000000c ) +;; unused? joint-anims + (deftype joint-anim-matrix (joint-anim) ((data matrix :inline :dynamic :offset 16) ) @@ -39,18 +47,22 @@ :flag-assert #x90000000c ) -(declare-type joint-anim-compressed-hdr structure) +;; joint-anim-compressed is the only type of joint-anim actually used. +;; the actual data isn't in here, this is just some metadata +;; again, this refers to a single joing (deftype joint-anim-compressed (joint-anim) - ((data joint-anim-compressed-hdr :dynamic :offset-assert 12) ;; guess + ((data uint32 :dynamic :offset-assert 12) ;; seems to always just be 1 zero. ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) +;; a single "frame" in an animtion, consists of matrices for each joint. +;; unlike the previous types, this is for all of the joints involved in an animation. (deftype joint-anim-frame (structure) - ((matrices matrix 2 :inline :offset-assert 0) - (data uint32 :dynamic :offset-assert 128) ;; guess + ((matrices matrix 2 :inline :offset-assert 0) ;; everybody has at least 2 matrices + (data matrix :inline :dynamic :offset-assert 128) ;; rest are dynamically sized. ) :method-count-assert 9 :size-assert #x80 @@ -61,6 +73,7 @@ ) (defmethod new joint-anim-frame ((allocation symbol) (type-to-make type) (arg0 int)) + "Create a new joint-anim-frame with enough room for arg0 matrices" (let ((v1-1 (max 0 (+ arg0 -2)))) (the-as joint-anim-frame (new-dynamic-structure @@ -71,9 +84,9 @@ ) ) +;; compression header - has info used by decompression algorithm (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) - (unknown-half int16 :offset 6) (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) @@ -82,19 +95,23 @@ :flag-assert #x900000040 ) +;; this has the data needed to initialize the decompressor - I believe this +;; contains the starting poisition of the joints. (deftype joint-anim-compressed-fixed (structure) ((hdr joint-anim-compressed-hdr :inline :offset-assert 0) (offset-64 uint32 :offset-assert 64) (offset-32 uint32 :offset-assert 68) (offset-16 uint32 :offset-assert 72) (reserved uint32 :offset-assert 76) - (data vector 133 :inline :offset-assert 80) ;; guess + (data vector 133 :inline :offset-assert 80) ;; length here can be shorter! ) :method-count-assert 9 :size-assert #x8a0 :flag-assert #x9000008a0 ) +;; these are the actual compressed data frames. +;; dynamically sized, depends on the number of joints and the decompression. (deftype joint-anim-compressed-frame (structure) ((offset-64 uint32 :offset-assert 0) (offset-32 uint32 :offset-assert 4) @@ -107,6 +124,7 @@ :flag-assert #x900000860 ) +;; table of frames (deftype joint-anim-compressed-control (structure) ((num-frames uint32 :offset-assert 0) (fixed-qwc uint32 :offset-assert 4) @@ -119,6 +137,12 @@ :flag-assert #x900000014 ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ART +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; "art" is an overly general parent class of all art data. +;; it can be either a container of arts (art-group) or a single art (art-element) (deftype art (basic) ((name string :offset 8) (length int32 :offset-assert 12) @@ -129,14 +153,13 @@ :flag-assert #xd00000014 (:methods (login (_type_) _type_ 9) - (dummy-10 (_type_ string type) joint 10) - (dummy-11 (_type_ string type) int 11) - ; (lookup-art (_type_ string type) joint 10) ;; can also be art-joint-anim - ; (lookup-idx-of-art (_type_ string type) int 11) + (lookup-art (_type_ string type) joint 10) ;; art or joint. + (lookup-idx-of-art (_type_ string type) int 11) (needs-link? (_type_) symbol 12) ) ) +;; parent class of all single art things. (deftype art-element (art) ((pad uint8 12)) :method-count-assert 13 @@ -144,6 +167,7 @@ :flag-assert #xd00000020 ) +;; unused. all animations use joints/skeletons. (deftype art-mesh-anim (art-element) ((data basic :dynamic :offset-assert 32)) :method-count-assert 13 @@ -151,6 +175,7 @@ :flag-assert #xd00000020 ) +;; joint animation. (deftype art-joint-anim (art-element) ;; figured out manually from custom inspect. ((_unknown (pointer int16) :offset 4) ;; no clue. used in mem-usage @@ -159,8 +184,14 @@ (artist-step float :offset 28) (master-art-group-name string :offset 32) (master-art-group-index int32 :offset 36) + + ;; facial animation (blerc-data (pointer uint8) :offset 40) ;; todo, this is probably something else + + ;; compressed animation data (frames joint-anim-compressed-control :offset 44) + + ;; per-joint info for each joint in the animation. (data joint-anim-compressed :dynamic) ) :method-count-assert 13 @@ -168,6 +199,8 @@ :flag-assert #xd00000030 ) +;; a collection of arts. +;; this is often stored as a -ag file in static level data. (deftype art-group (art) ((info file-info :offset 4) (data art-element :dynamic :offset 32) @@ -176,12 +209,14 @@ :size-assert #x20 :flag-assert #xf00000020 (:methods + ;; linker will call this one when it's loaded (relocate (_type_ kheap (pointer uint8)) none :replace 7) (link-art! (_type_) art-group 13) (unlink-art! (_type_) int 14) ) ) +;; unused (deftype art-mesh-geo (art-element) ((data basic :dynamic :offset-assert 32) ) @@ -190,6 +225,7 @@ :flag-assert #xd00000020 ) +;; unused (deftype art-joint-geo (art-element) ((data joint :dynamic :offset-assert 32) ) @@ -198,6 +234,8 @@ :flag-assert #xd00000020 ) +;; the "skeleton group" is defined in code and tells the engine +;; how to actually use the art from the level data for this object. (deftype skeleton-group (basic) ((art-group-name basic :offset-assert 4) (jgeo int32 :offset-assert 8) @@ -219,10 +257,18 @@ :flag-assert #x900000048 ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Draw Control +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; the draw-control has settings for drawing a foreground object. + (declare-type merc-ctrl basic) + +;; a merc level of detail (deftype lod-group (structure) - ((geo merc-ctrl :offset-assert 0) - (dist meters :offset-assert 4) + ((geo merc-ctrl :offset-assert 0) ;; the actual geometry to draw + (dist meters :offset-assert 4) ;; the distance from camera for this lod ) :pack-me :method-count-assert 9 @@ -230,6 +276,8 @@ :flag-assert #x900000008 ) +;; the 4 levels of detail. the max-lod is the index of the highest lod that's actually used. +;; it is the lowest detail. (deftype lod-set (structure) ((lod lod-group 4 :inline :offset-assert 0) (max-lod int8 :offset-assert 32) @@ -239,7 +287,7 @@ :size-assert #x21 :flag-assert #xa00000021 (:methods - (dummy-9 (_type_ skeleton-group art-group entity) _type_ 9) + (setup-lods! (_type_ skeleton-group art-group entity) _type_ 9) ) ) @@ -247,12 +295,12 @@ :type uint8 :bitfield #t (needs-clip 0) - (drwf01 1) - (drwf02 2) - (drwf03 3) + (drwf01 1) ;; hide + (drwf02 2) ;; no-anim + (drwf03 3) ;; draw (drwf04 4) - (drwf05 5) - (drwf06 6) + (drwf05 5) ;; no bones + (drwf06 6) ;; don't use for closest check (drwf07 7) ) diff --git a/goal_src/engine/debug/anim-tester.gc b/goal_src/engine/debug/anim-tester.gc index f258f2999d..b9da3d6494 100644 --- a/goal_src/engine/debug/anim-tester.gc +++ b/goal_src/engine/debug/anim-tester.gc @@ -2321,7 +2321,7 @@ ) (let ((s4-1 (the-as art-joint-anim - (dummy-10 (-> (the-as anim-test-obj s4-0) obj-art-group) (-> s5-1 privname) art-joint-anim) + (lookup-art (-> (the-as anim-test-obj s4-0) obj-art-group) (-> s5-1 privname) art-joint-anim) ) ) ) diff --git a/goal_src/engine/draw/draw-node-h.gc b/goal_src/engine/draw/draw-node-h.gc index 577d74b861..0fcbb95d9b 100644 --- a/goal_src/engine/draw/draw-node-h.gc +++ b/goal_src/engine/draw/draw-node-h.gc @@ -5,17 +5,22 @@ ;; name in dgo: draw-node-h ;; dgos: GAME, ENGINE -;; A "draw-node" is a way to group together a bunch of drawables (possibly other draw-nodes) -;; they do not support calling draw, but do support collision. -;; The typical use is to put a bunch of these in an inline array, then call collide on the first, -;; and pass in the length of the inline array. This will collide with all nodes in the list. -;; They are also used as groups for the culling system. +;; A "draw-node" is a way to group together a bunch of drawables (possibly other draw-nodes) in a BVH +;; This BVH is used for sphere-in-view culling and the broad phase collision detection. +;; _most_ uses of draw-node are in a special tree with these properties: +;; - between 1 and 8 roots. +;; - each child has between 1 and 8 children +;; - all leaves are stored at the same depth +;; - leaves at the same depth +;; - all nodes and leaves have visibility IDs + +;; shrub does not have these properties (deftype draw-node (drawable) - ((child-count uint8 :offset 6) ;; if our child requires a count - (flags uint8 :offset 7) - (child drawable :offset 8) ;; can be draw-node or any other drawable - (distance float :offset 12) + ((child-count uint8 :offset 6) ;; if our child requires a count + (flags uint8 :offset 7) ;; is our children leaf or draw-node? + (child drawable :offset 8) ;; can be draw-node or any other drawable + (distance float :offset 12) ;; used in shrub... ) :method-count-assert 18 :size-assert #x20 @@ -24,9 +29,7 @@ ) -;; It's annoying to work with draw-node's directly, so drawable-inline-array-node is a nice wrapper -;; that knows the array's length. - +;; for non-shrub uses of draw-node, this is used to store all the draw-nodes at a given depth. (deftype drawable-inline-array-node (drawable-inline-array) ((data draw-node 1 :inline) (pad uint32) @@ -41,6 +44,7 @@ ) ;; the types of these fields are a guess for now. +;; used for draw-node-cull function (deftype draw-node-dma (structure) ((banka draw-node 32 :inline :offset-assert 0) (bankb draw-node 32 :inline :offset-assert 1024) diff --git a/goal_src/engine/draw/drawable-actor-h.gc b/goal_src/engine/draw/drawable-actor-h.gc index e8bd703a8d..61d90077d6 100644 --- a/goal_src/engine/draw/drawable-actor-h.gc +++ b/goal_src/engine/draw/drawable-actor-h.gc @@ -5,7 +5,12 @@ ;; name in dgo: drawable-actor-h ;; dgos: GAME, ENGINE +;; the actors are also stored in a drawable-tree, but they use almost none of the features of drawable. +;; it's just a way to iterate over all actor data. + (declare-type entity-actor basic) + +;; the actual drawable is just a reference to the actor itself. (deftype drawable-actor (drawable) ((actor entity-actor :offset 8) ) @@ -14,12 +19,13 @@ :flag-assert #x1200000020 ) - +;; the tree of drawable-actors (deftype drawable-tree-actor (drawable-tree) () :flag-assert #x1200000024 ) +;; array of drawable-actor. (deftype drawable-inline-array-actor (drawable-inline-array) ((data drawable-actor 1 :inline) (pad uint8 4)) @@ -28,5 +34,6 @@ (defmethod draw drawable-tree-actor ((obj drawable-tree-actor) (arg0 drawable-tree-actor) (arg1 display-frame)) + "Do nothing, actor data is not drawn." (none) ) diff --git a/goal_src/engine/draw/drawable-ambient-h.gc b/goal_src/engine/draw/drawable-ambient-h.gc index 0225f13e07..463a49e988 100644 --- a/goal_src/engine/draw/drawable-ambient-h.gc +++ b/goal_src/engine/draw/drawable-ambient-h.gc @@ -10,6 +10,10 @@ (define-extern vector-for-ambient (function process-drawable vector vector)) +;; the "ambient" system has a bunch of triggers for background sounds, hints, and similar events. + +;; each ambient also has a simple drawable that just contains a reference to the entity. +;; this is basically only used to collect the currently active ambients. (deftype drawable-ambient (drawable) ((ambient entity-ambient :offset 8) ) @@ -17,10 +21,11 @@ :size-assert #x20 :flag-assert #x1300000020 (:methods - (dummy-18 (_type_ vector) none 18) + (execute-ambient (_type_ vector) none 18) ) ) +;; a drawable-tree of all the ambients in a level. (deftype drawable-tree-ambient (drawable-tree) () :method-count-assert 18 @@ -35,13 +40,20 @@ ) (defmethod draw drawable-tree-ambient ((obj drawable-tree-ambient) (arg0 drawable-tree-ambient) (arg1 display-frame)) + "Do nothing - ambients are not drawn." (none) ) (defmethod unpack-vis drawable-tree-ambient ((obj drawable-tree-ambient) (arg0 (pointer int8)) (arg1 (pointer int8))) + "Do nothing - ambients do not use vis." arg1 ) + +;; one of the more common ambients is a "level hint". This can be a few things: +;; - on screen text (level names) +;; - daxter audio (sidekick) +;; - voicebox audio (also called sidekick in some places...) (deftype level-hint (process) ((text-id-to-display game-text-id :offset-assert 112) (sound-to-play string :offset-assert 116) @@ -59,7 +71,7 @@ :flag-assert #x10004000a8 (:methods (print-text (_type_) none 14) - (dummy-15 (_type_) symbol 15) + (appeared-for-long-enough? (_type_) symbol 15) ) (:states (level-hint-ambient-sound string) @@ -70,6 +82,7 @@ ) ) +;; a list of ambients that are currently active. (deftype ambient-list (structure) ((num-items int32 :offset-assert 0) (items drawable-ambient 2048 :offset-assert 4) diff --git a/goal_src/engine/draw/drawable-group-h.gc b/goal_src/engine/draw/drawable-group-h.gc index 01fb2e91bc..607c5df27b 100644 --- a/goal_src/engine/draw/drawable-group-h.gc +++ b/goal_src/engine/draw/drawable-group-h.gc @@ -5,10 +5,17 @@ ;; name in dgo: drawable-group-h ;; dgos: GAME, ENGINE +;; drawable-group is the base class for some drawable containers. +;; it is itself a drawable, though it typically doesn't have an ID. +;; it contains a dynamically sized array of drawables (in GOAL this means references to drawable objects). +;; these are typically used for higher level organization - iterating through many drawable-groups is not efficient due to +;; all the references. +;; note that in general you shouldn't assume that calling "draw" on a group will actually call "draw" on all the members - +;; different children classes may specialize these methods. (same goes for all the methods) (deftype drawable-group (drawable) ((length int16 :offset 6) - (data drawable 1 :offset-assert 32) + (data drawable 1 :offset-assert 32) ;; note that you get 1 drawable in the type, the rest run off the end. ) (:methods (new (symbol type int) _type_) @@ -16,4 +23,5 @@ :flag-assert #x1200000024 ) +;; unused (define *collide-nodes* 0) diff --git a/goal_src/engine/draw/drawable-h.gc b/goal_src/engine/draw/drawable-h.gc index 85bd3a0db1..c434710d67 100644 --- a/goal_src/engine/draw/drawable-h.gc +++ b/goal_src/engine/draw/drawable-h.gc @@ -17,21 +17,39 @@ (declare-type drawable-error drawable) (deftype drawable (basic) - ((id int16 :offset-assert 4) ;; ID number (not always used) + ((id int16 :offset-assert 4) ;; ID number for visibility (not always used) (bsphere vector :inline :offset-assert 16) ;; bounding sphere ) :method-count-assert 18 :size-assert #x20 :flag-assert #x1200000020 (:methods + ;; initialize the drawable after it has been loaded. (login (_type_) _type_ 9) + ;; do some sort of drawing... this really does different things for different types. (draw (_type_ _type_ display-frame) none 10) + + ;; add collision meshes to the given collide list if they intersect the bounding box in *collide-work* + ;; the integer argument can be used to call this method on an inline-array of drawables (only some support this) + ;; this avoids the dynamic dispatch on each element of the array. (collide-with-box (_type_ int collide-list) none 11) + + ;; similar to above, but only add if the collision mesh intersects with a "y probe" (collide-y-probe (_type_ int collide-list) none 12) + + ;; similar to above, but only add if the collision mesh intersects a ray of spheres. (collide-ray (_type_ int collide-list) none 13) + + ;; different for different types, but generally collects debug statistics like numbers of triangles (collect-stats (_type_) none 14) + + ;; different for different types, but usually does nothing. (debug-draw (_type_ drawable display-frame) none 15) + + ;; given VIS data (uncompressed), compute the visiblity bit string. (unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 16) + + ;; find "ambients" inside the given sphere and add to list. (collect-ambients (_type_ sphere int ambient-list) none 17) ) ) diff --git a/goal_src/engine/draw/drawable-inline-array-h.gc b/goal_src/engine/draw/drawable-inline-array-h.gc index 447c99e708..f30a81257b 100644 --- a/goal_src/engine/draw/drawable-inline-array-h.gc +++ b/goal_src/engine/draw/drawable-inline-array-h.gc @@ -5,8 +5,14 @@ ;; name in dgo: drawable-inline-array-h ;; dgos: GAME, ENGINE +;; the drawable-inline-array is the other base class for a drawable container. +;; like drawable-group, it is a drawable itself. +;; it's used over drawable-group when there are a lot of drawables to iterate over because it is faster. + +;; a drawable-inline-array itself has no idea what it stores so you almost always need a more specific type. + (deftype drawable-inline-array (drawable) - ((length int16 :offset 6) ;; this is kinda weird. + ((length int16 :offset 6) ) :method-count-assert 18 :size-assert #x20 diff --git a/goal_src/engine/draw/drawable-tree-h.gc b/goal_src/engine/draw/drawable-tree-h.gc index c20219406f..1c1218c8fc 100644 --- a/goal_src/engine/draw/drawable-tree-h.gc +++ b/goal_src/engine/draw/drawable-tree-h.gc @@ -5,11 +5,15 @@ ;; name in dgo: drawable-tree-h ;; dgos: GAME, ENGINE +;; a drawable-tree is a top level grouping for all the drawables in a certain category. +;; for example, there might be a drawable-tree for all the tfrags, one for all the ties, etc. (deftype drawable-tree (drawable-group) () :flag-assert #x1200000024 ) +;; a drawable-tree-array contains all the drawable-trees in a level. +;; usually there aren't too many drawable trees (~5-15) (deftype drawable-tree-array (drawable-group) ((trees drawable-tree 1 :offset 32)) :flag-assert #x1200000024 diff --git a/goal_src/engine/draw/process-drawable.gc b/goal_src/engine/draw/process-drawable.gc index dfb1c67f34..5deed9dc76 100644 --- a/goal_src/engine/draw/process-drawable.gc +++ b/goal_src/engine/draw/process-drawable.gc @@ -106,7 +106,7 @@ (none) ) -(defmethod dummy-9 lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) +(defmethod setup-lods! lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) (local-vars (sv-16 res-tag)) (let ((s4-0 arg0) (s5-0 arg1) @@ -168,13 +168,13 @@ ) 0 (let ((v1-14 (dummy-9 (-> gp-0 data 1) #f))) - (set! (-> v1-14 joint) (-> arg0 data 0)) + (set! (-> v1-14 joint) (the-as joint (-> arg0 data 0))) (set! (-> v1-14 bone) (-> s4-1 bones 1)) (set! (-> v1-14 parent) (the-as cspace (-> gp-0 data))) (set! (-> v1-14 bone cache bone-matrix) (the-as uint 128)) ) (let ((v1-17 (dummy-9 (-> gp-0 data 2) #f))) - (set! (-> v1-17 joint) (-> arg0 data 1)) + (set! (-> v1-17 joint) (the-as joint (-> arg0 data 1))) (set! (-> v1-17 bone) (-> s4-1 bones 2)) (set! (-> v1-17 parent) (the-as cspace (-> gp-0 data))) (let ((a1-9 v1-17)) @@ -185,7 +185,7 @@ ) (let ((s3-0 3)) (while (< s3-0 (-> gp-0 length)) - (let* ((s1-0 (-> arg0 data (+ s3-0 -1))) + (let* ((s1-0 (the-as joint (-> arg0 data (+ s3-0 -1)))) (s2-0 (if (-> s1-0 parent) (+ (-> s1-0 parent number) 1) 0 @@ -513,7 +513,7 @@ ) ) ) - (if (not (dummy-9 (-> s3-0 lod-set) arg0 s4-0 (-> obj entity))) + (if (not (setup-lods! (-> s3-0 lod-set) arg0 s4-0 (-> obj entity))) (go process-drawable-art-error "mesh") ) (let ((v1-43 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1)))) diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index 544da4a43d..09e93de9d5 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -259,7 +259,7 @@ ) ((= v1-0 'art-joint-anim) (set! (-> self new-joint-anim) - (the-as art-joint-anim (dummy-10 (-> self draw art-group) (the-as string (-> arg3 param 0)) art-joint-anim)) + (the-as art-joint-anim (lookup-art (-> self draw art-group) (the-as string (-> arg3 param 0)) art-joint-anim)) ) (set! v0-0 (the-as none (-> arg3 param 1))) (set! (-> self new-joint-anim-blend) (the-as uint v0-0)) @@ -918,7 +918,7 @@ (when (= arg1 -10) (set! arg1 (the-as uint 0)) (when (> (-> (the-as process-drawable gp-0) skel active-channels) 0) - (let ((v1-11 (dummy-10 (-> (the-as process-drawable gp-0) draw jgeo) "camera" (the-as type #f)))) + (let ((v1-11 (lookup-art (-> (the-as process-drawable gp-0) draw jgeo) "camera" (the-as type #f)))) (if v1-11 (set! arg1 (the-as uint (+ (-> v1-11 number) 1))) ) diff --git a/goal_src/engine/game/main-h.gc b/goal_src/engine/game/main-h.gc index aab964463b..57fd34d4de 100644 --- a/goal_src/engine/game/main-h.gc +++ b/goal_src/engine/game/main-h.gc @@ -6,7 +6,6 @@ ;; dgos: GAME, ENGINE ;; Global engine settings: -(defglobalconstant NO_BONES_HACK #f) (define *stats-poly* #f) (define *stats-memory* #f) (define *stats-memory-short* #f) @@ -93,21 +92,43 @@ (define *subdivide-draw-mode* 0) (define *ocean-subdivide-draw-mode* 0) +;;;;;;;;;;;;;;;;;;;;;;; +;; Main Loop interface +;;;;;;;;;;;;;;;;;;;;;;; + ;; *dproc* is the display process. ;; It is the main loop of the game. ;; don't overwrite the dproc if we're reloading this file (define-perm *dproc* process #f) +;; is the main display loop running? Set to #f to kill it. (define *run* #f) + +;; did we teleport on the last frame? If so, it allows mood values to change immediately +;; instead of slowly fading between. (define *teleport* #f) + +;; set to a nonzero amount to apply the *teleport* for several frames. (define *teleport-count* 0) + +;; function to call in the main loop for drawing. (define *draw-hook* nothing) + +;; function to call in the main loop to run debug code (define *debug-hook* nothing) + +;; function to call in the main loop to run the debug menu (declare-type debug-menu-context basic) (define-extern *menu-hook* (function debug-menu-context)) + +;; function to call in the main loop to run the progress menu (define *progress-hook* nothing) + +;; function to call if main DMA transfer times out, to attempt to recover. (define *dma-timeout-hook* nothing) + +;; unused. (deftype frame-stats (structure) ((field-time uint64 2 :offset-assert 0) (field int32 :offset-assert 16) @@ -119,7 +140,7 @@ (define *frame-stats* (new 'static 'frame-stats)) - +;; full screen "filter" (just a giant quad over the whole screen) (deftype screen-filter (basic) ((draw? basic :offset-assert 4) (color rgba :offset-assert 8) diff --git a/goal_src/engine/game/main.gc b/goal_src/engine/game/main.gc index fabc3564c6..7fbdb0181c 100644 --- a/goal_src/engine/game/main.gc +++ b/goal_src/engine/game/main.gc @@ -636,7 +636,7 @@ ) (countdown (s4-2 (-> (scratchpad-object terrain-context) work ambient ambient-list num-items)) - (dummy-18 (-> (scratchpad-object terrain-context) work ambient ambient-list items s4-2) s5-1) + (execute-ambient (-> (scratchpad-object terrain-context) work ambient ambient-list items s4-2) s5-1) ) ) ) diff --git a/goal_src/engine/game/task/hint-control.gc b/goal_src/engine/game/task/hint-control.gc index bb70da8e41..e24e7d4a9d 100644 --- a/goal_src/engine/game/task/hint-control.gc +++ b/goal_src/engine/game/task/hint-control.gc @@ -422,7 +422,7 @@ (when *hint-semaphore* (set! v1-0 - (dummy-15 (the-as level-hint (ppointer->process *hint-semaphore*))) + (appeared-for-long-enough? (the-as level-hint (ppointer->process *hint-semaphore*))) ) 0 ) diff --git a/goal_src/engine/game/task/process-taskable.gc b/goal_src/engine/game/task/process-taskable.gc index 56e8d94527..ea79534755 100644 --- a/goal_src/engine/game/task/process-taskable.gc +++ b/goal_src/engine/game/task/process-taskable.gc @@ -1269,7 +1269,7 @@ ) (cond ((t9-0 (rtype-of v1-1) string) - (let ((v1-8 (dummy-10 + (let ((v1-8 (lookup-art (-> (the-as process-taskable (-> self hand process 0)) draw jgeo) (the-as string (-> arg3 param 0)) (the-as type #f) diff --git a/goal_src/engine/gfx/lights-h.gc b/goal_src/engine/gfx/lights-h.gc index 7dde683cee..c593ccf073 100644 --- a/goal_src/engine/gfx/lights-h.gc +++ b/goal_src/engine/gfx/lights-h.gc @@ -8,6 +8,8 @@ ;; It seems like some of these are unused. ;; The commonly used lights are vu-lights and light-group. +;; this type represents the lights that can be sent to the VU for merc (and maybe generic?) rendering. +;; it contains 3 directional lights and an ambient light. (deftype vu-lights (structure) ((direction vector 3 :inline :offset-assert 0) (color vector 3 :inline :offset-assert 48) @@ -18,6 +20,7 @@ :flag-assert #x900000070 ) +;; a single directional light. (deftype light (structure) ((direction vector :inline :offset-assert 0) (color rgbaf :inline :offset-assert 16) @@ -30,6 +33,7 @@ :flag-assert #x900000030 ) +;; unused? (deftype light-ellipse (structure) ((matrix matrix :inline :offset-assert 0) (color rgbaf :inline :offset-assert 64) @@ -46,6 +50,7 @@ ) ;; This likely doesn't work correctly in both GOAL and OpenGOAL +;; unused? (deftype light-array (array) () :method-count-assert 9 @@ -53,6 +58,7 @@ :flag-assert #x900000010 ) +;; unused? (deftype light-volume (basic) ((light-array light-array :offset-assert 4) ) @@ -61,6 +67,7 @@ :flag-assert #x900000008 ) +;; unused? (deftype light-volume-sphere (light-volume) ((bsphere sphere :inline :offset-assert 16) ) @@ -69,6 +76,7 @@ :flag-assert #x900000020 ) +;; unused? (deftype light-volume-planes (light-volume) ((planes vertical-planes :offset-assert 8) ) @@ -77,6 +85,7 @@ :flag-assert #x90000000c ) +;; unused? (deftype light-volume-array (array) () :method-count-assert 9 @@ -85,6 +94,7 @@ ) (defmethod print light ((obj light)) + "Print a directional light." (format #t "# obj levels data 0) (-> obj direction data 0) @@ -100,6 +110,7 @@ obj ) +;; the primary light type, used before conversion to vu-lights. (deftype light-group (structure) ((dir0 light :inline :offset-assert 0) (dir1 light :inline :offset-assert 48) diff --git a/goal_src/engine/gfx/mood-h.gc b/goal_src/engine/gfx/mood-h.gc index 597f591f97..67491702c4 100644 --- a/goal_src/engine/gfx/mood-h.gc +++ b/goal_src/engine/gfx/mood-h.gc @@ -5,6 +5,10 @@ ;; name in dgo: mood-h ;; dgos: GAME, ENGINE +;; the "mood" system sets the fog, lights, and sun to smoothly blend between two levels. +;; each level has 8 "moods". + +;; set of fog parameters (deftype mood-fog (structure) ((fog-color vector :inline :offset-assert 0) (fog-dists vector :inline :offset-assert 16) @@ -19,6 +23,7 @@ :flag-assert #x900000030 ) +;; a fog pattern for each of the 8 moods (deftype mood-fog-table (structure) ((data mood-fog 8 :inline :offset-assert 0) ) @@ -27,6 +32,7 @@ :flag-assert #x900000180 ) +;; a set of light parameters (deftype mood-lights (structure) ((direction vector :inline :offset-assert 0) (lgt-color vector :inline :offset-assert 16) @@ -39,6 +45,7 @@ :flag-assert #x900000050 ) +;; a light parameter for each of the 8 moods (deftype mood-lights-table (structure) ((data mood-lights 8 :inline :offset-assert 0) ) @@ -47,6 +54,7 @@ :flag-assert #x900000280 ) +;; settings for the sun (deftype mood-sun (structure) ((sun-color vector :inline :offset-assert 0) (env-color vector :inline :offset-assert 16) @@ -56,6 +64,7 @@ :flag-assert #x900000020 ) +;; sun settings for each of the 8 moods (deftype mood-sun-table (structure) ((data mood-sun 8 :inline :offset-assert 0) ) @@ -64,6 +73,7 @@ :flag-assert #x900000100 ) +;; all the current mood settings (deftype mood-context (basic) ((mood-fog-table mood-fog-table :offset-assert 4) (mood-lights-table mood-lights-table :offset-assert 8) @@ -77,6 +87,7 @@ (current-shadow vector :inline :offset-assert 128) (current-shadow-color vector :inline :offset-assert 144) (light-group light-group 8 :inline :offset-assert 160) + ;; these "times" are the time-of-day weights. the w is the weight, the rest is just 1. (times vector 8 :inline :offset-assert 1696) (sky-times float 8 :offset-assert 1824) (itimes vector4w 4 :inline :offset-assert 1856) diff --git a/goal_src/engine/gfx/sky/sky-h.gc b/goal_src/engine/gfx/sky/sky-h.gc index fdec7467d7..bc67485f23 100644 --- a/goal_src/engine/gfx/sky/sky-h.gc +++ b/goal_src/engine/gfx/sky/sky-h.gc @@ -5,17 +5,23 @@ ;; name in dgo: sky-h ;; dgos: GAME, ENGINE +;; the "sky" system draws the sky and determines colors for lights. +;; each level has 8 skies that are interpolated between. + +;; represents the skies that are used during a single hour. +;; there can be 1 or 2 skies used. (deftype sky-color-hour (structure) - ((snapshot1 int32 :offset-assert 0) - (snapshot2 int32 :offset-assert 4) - (morph-start float :offset-assert 8) - (morph-end float :offset-assert 12) + ((snapshot1 int32 :offset-assert 0) ;; the sky index at the start + (snapshot2 int32 :offset-assert 4) ;; the sky index at the end + (morph-start float :offset-assert 8) ;; blend between the two at the start of the hour + (morph-end float :offset-assert 12) ;; blend between the two at the end of the hour ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) +;; a sky-color-hour for each hour of the day. (deftype sky-color-day (structure) ((hour sky-color-hour 24 :inline :offset-assert 0) ) @@ -24,7 +30,15 @@ :flag-assert #x900000180 ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Old Sky Renderer +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; there's an old sky renderer that's no longer used. +;; it seems like it drew the suns and moon. +;; these types are designed for the old renderer, but partially used by the new one +;; these stores points on a squashed circle (xy only) (deftype sky-circle-data (structure) ((data vector 17 :inline :offset-assert 0) ) @@ -33,6 +47,7 @@ :flag-assert #x900000110 ) +;; sun particle tracks this (deftype sky-sun-data (structure) ((data uint128 4 :offset-assert 0) (pos vector :inline :offset 0) @@ -51,6 +66,7 @@ :flag-assert #x900000040 ) +;; moon particle tracks this (deftype sky-moon-data (structure) ((data uint128 2 :offset-assert 0) (pos vector :inline :offset 0) @@ -61,6 +77,7 @@ :flag-assert #x900000020 ) +;; parameters for the sun/moon motion. (deftype sky-orbit (structure) ((high-noon float :offset-assert 0) (tilt float :offset-assert 4) @@ -75,6 +92,7 @@ :flag-assert #x900000018 ) +;; sky data to send to old sky renderer. (deftype sky-upload-data (basic) ((circle sky-circle-data :inline :offset-assert 16) (sun sky-sun-data 2 :inline :offset-assert 288) @@ -86,8 +104,8 @@ :flag-assert #x9000001c0 ) +;; all sky data. This has a copy of sky-upload-data that's used by the new sky renderer. (deftype sky-parms (basic) - ;; check - the alignment on some of these. ((orbit sky-orbit 3 :inline :offset-assert 4) (upload-data sky-upload-data :inline :offset-assert 112) (sun-lights light-group :inline :offset-assert 560) @@ -113,9 +131,11 @@ ) (define *sky-parms* (new 'global 'sky-parms)) + +;; here's another sky-upload-data. It's just used to hold these cirlces. (define *sky-upload-data* (new 'global 'sky-upload-data)) -;; generate some sky data. +;; generate some points on a circle for the sky renderer. (dotimes (gp-0 17) (let ((f30-0 (+ MINUS_PI (* 0.39269906 (the float (logand gp-0 15)))))) (set! (-> *sky-upload-data* circle data gp-0 x) (* 2.2 (sin-rad f30-0))) @@ -125,6 +145,10 @@ (set! (-> *sky-upload-data* circle data gp-0 w) 0.0) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; new sky renderer (TNG) +;;;;;;;;;;;;;;;;;;;;;;;;;;; + (deftype sky-tng-data (basic) ((giftag-base gs-gif-tag :inline :offset-assert 16);; changed (giftag-roof gs-gif-tag :inline :offset-assert 32) @@ -164,6 +188,9 @@ :flag-assert #x900000030 ) + +;; the sky renderer writes sky and cloud textures to vram - these booleans tell you if +;; it has done this, and if the sky/cloud textures should be used. (define *sky-drawn* #f) (define *cloud-drawn* #f) diff --git a/goal_src/engine/gfx/time-of-day-h.gc b/goal_src/engine/gfx/time-of-day-h.gc index b3b4815582..60ac78df76 100644 --- a/goal_src/engine/gfx/time-of-day-h.gc +++ b/goal_src/engine/gfx/time-of-day-h.gc @@ -16,6 +16,8 @@ ;; DECOMP BEGINS +;; control time of day palette from outside the time of day system +;; (for example, the cave crystals and deadly water in LPC) (deftype palette-fade-control (structure) ((trans vector :inline :offset-assert 0) (fade float :offset-assert 16) @@ -26,7 +28,7 @@ :flag-assert #x900000018 ) - +;; group of 8 palette fade controls (deftype palette-fade-controls (basic) ((control palette-fade-control 8 :inline :offset-assert 16) ) @@ -39,9 +41,11 @@ ) ) - +;; the global palette fade control used by game objects to control time of day lighting effects (define-perm *palette-fade-controls* palette-fade-controls (new 'global 'palette-fade-controls)) +;; the time-of-day system runs a single process that just ticks time forward and controls +;; star/sun/moon/green-sun particle launch. (deftype time-of-day-proc (process) ((year int32 :offset-assert 112) (month int32 :offset-assert 116) @@ -71,7 +75,8 @@ ) ) - +;; a color palette that can be interpolated based on the time of day. +;; tie/tfrag/shrub all use these. (deftype time-of-day-palette (basic) ((width int32 :offset-assert 4) (height int32 :offset-assert 8) @@ -83,7 +88,7 @@ :flag-assert #x900000014 ) - +;; all time of day state. (deftype time-of-day-context (basic) ((active-count uint32 :offset-assert 4) (interp float :offset-assert 8) @@ -112,7 +117,7 @@ :flag-assert #x900000848 ) - +;; dma memory layout for time of day palette interpolation (deftype time-of-day-dma (structure) ((outa uint32 256 :offset-assert 0) (outb uint32 256 :offset-assert 1024) @@ -124,7 +129,8 @@ :flag-assert #x900001000 ) - +;; weird, either 8 (running) or 4 (not running) (define *time-of-day-mode* 8) +;; the global time of day context - this is used to access all mood and time of day data. (define *time-of-day-context* (new 'static 'time-of-day-context)) diff --git a/goal_src/engine/load/loader.gc b/goal_src/engine/load/loader.gc index fda5eec974..b6334047ab 100644 --- a/goal_src/engine/load/loader.gc +++ b/goal_src/engine/load/loader.gc @@ -983,7 +983,7 @@ ) ) (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (let ((s2-4 (the-as art-joint-anim (dummy-10 (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) (cond (s2-4 (ja-channel-set! 1) diff --git a/goal_src/engine/target/target2.gc b/goal_src/engine/target/target2.gc index 7d66387dc4..47161560d1 100644 --- a/goal_src/engine/target/target2.gc +++ b/goal_src/engine/target/target2.gc @@ -3661,7 +3661,7 @@ ) :code (behavior ((arg0 string) (arg1 handle)) - (let ((gp-0 (the-as art-joint-anim (dummy-10 (-> self draw art-group) arg0 art-joint-anim)))) + (let ((gp-0 (the-as art-joint-anim (lookup-art (-> self draw art-group) arg0 art-joint-anim)))) (when gp-0 (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) (ja-channel-set! 1) diff --git a/goal_src/levels/citadel/citadel-obs.gc b/goal_src/levels/citadel/citadel-obs.gc index 4167bc9343..a9048b04c2 100644 --- a/goal_src/levels/citadel/citadel-obs.gc +++ b/goal_src/levels/citadel/citadel-obs.gc @@ -1719,8 +1719,8 @@ (defmethod dummy-21 citb-generator ((obj citb-generator)) (initialize-skeleton obj *citb-generator-sg* '()) - (dummy-9 (-> obj normal-look) *citb-generator-sg* (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj broken-look) *citb-generator-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj normal-look) *citb-generator-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *citb-generator-broken-sg* (-> obj draw art-group) (-> obj entity)) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj birth-fuel-cell) (< (the-as uint 1) (the-as uint (-> obj entity extra perm task)))) (set! (-> obj trigger-others) #f) diff --git a/goal_src/levels/common/plat-eco.gc b/goal_src/levels/common/plat-eco.gc index 619ac58b56..4fe53414d7 100644 --- a/goal_src/levels/common/plat-eco.gc +++ b/goal_src/levels/common/plat-eco.gc @@ -312,8 +312,8 @@ (s5-1 (get-lit-skel obj)) ) (initialize-skeleton obj s4-0 '()) - (dummy-9 (-> obj unlit-look) s4-0 (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj lit-look) s5-1 (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj unlit-look) s4-0 (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj lit-look) s5-1 (-> obj draw art-group) (-> obj entity)) ) (logclear! (-> obj mask) (process-mask actor-pause)) (update-transforms! (-> obj root-override)) diff --git a/goal_src/levels/maincave/mother-spider-egg.gc b/goal_src/levels/maincave/mother-spider-egg.gc index 9eb61a1a94..04690eca4a 100644 --- a/goal_src/levels/maincave/mother-spider-egg.gc +++ b/goal_src/levels/maincave/mother-spider-egg.gc @@ -626,7 +626,7 @@ (set! (-> self mask) (logior (process-mask enemy) (-> self mask))) (set! (-> self mask) (logior (process-mask attackable) (-> self mask))) (initialize-skeleton self *mother-spider-egg-unbroken-sg* '()) - (dummy-9 (-> self broken-look) *mother-spider-egg-broken-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self broken-look) *mother-spider-egg-broken-sg* (-> self draw art-group) (-> self entity)) (set! (-> self draw shadow-ctrl) (new 'process 'shadow-control 0.0 0.0 614400.0 (the-as float 60) 245760.0)) (set! (-> self nav) (new 'process 'nav-control (-> self root-override) 16 40960.0)) (logior! (-> self nav flags) (nav-control-flags display-marks bit3 bit5 bit6 bit7)) diff --git a/goal_src/levels/misty/sidekick-human.gc b/goal_src/levels/misty/sidekick-human.gc index 29030186dd..ae44744f9b 100644 --- a/goal_src/levels/misty/sidekick-human.gc +++ b/goal_src/levels/misty/sidekick-human.gc @@ -1708,7 +1708,7 @@ 'eval (lambda :behavior sequenceC () - ((method-of-type lod-set dummy-9) + ((method-of-type lod-set setup-lods!) (the-as lod-set (&-> (the-as process-taskable (-> self parent 0)) stack 288)) *darkecocan-glow-sg* (-> self draw art-group) diff --git a/goal_src/levels/ogre/ogre-obs.gc b/goal_src/levels/ogre/ogre-obs.gc index 40be321f1b..7916c910be 100644 --- a/goal_src/levels/ogre/ogre-obs.gc +++ b/goal_src/levels/ogre/ogre-obs.gc @@ -1741,7 +1741,7 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *shortcut-boulder-whole-sg* '()) - (dummy-9 (-> obj broken-look) *shortcut-boulder-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *shortcut-boulder-broken-sg* (-> obj draw art-group) (-> obj entity)) (set-vector! (-> obj draw color-emissive) 0.125 0.0625 0.0 0.0) (go shortcut-boulder-idle) (none) diff --git a/goal_src/levels/robocave/spider-egg.gc b/goal_src/levels/robocave/spider-egg.gc index 9d15576b1f..f2eea8d627 100644 --- a/goal_src/levels/robocave/spider-egg.gc +++ b/goal_src/levels/robocave/spider-egg.gc @@ -337,7 +337,7 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *spider-egg-unbroken-sg* '()) - (dummy-9 (-> obj broken-look) *spider-egg-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *spider-egg-broken-sg* (-> obj draw art-group) (-> obj entity)) (set-vector! (-> obj root-override scale) 0.4 0.4 0.4 1.0) (if (not (move-to-ground (-> obj root-override) 12288.0 40960.0 #t (collide-kind background))) (go process-drawable-art-error "no ground") diff --git a/goal_src/levels/rolling/rolling-obs.gc b/goal_src/levels/rolling/rolling-obs.gc index e265fe2725..b16dd66a04 100644 --- a/goal_src/levels/rolling/rolling-obs.gc +++ b/goal_src/levels/rolling/rolling-obs.gc @@ -1078,8 +1078,8 @@ (set! (-> self root) (new 'process 'trsqv)) (set! (-> self root trans quad) (-> arg0 quad)) (initialize-skeleton self *rolling-start-whole-sg* '()) - (dummy-9 (-> self whole-look) *rolling-start-whole-sg* (-> self draw art-group) (-> self entity)) - (dummy-9 (-> self broken-look) *rolling-start-broken-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self whole-look) *rolling-start-whole-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self broken-look) *rolling-start-broken-sg* (-> self draw art-group) (-> self entity)) (let ((s5-1 (new 'stack-no-clear 'matrix))) (matrix-rotate-y! s5-1 arg1) (matrix->quaternion (-> self root quat) s5-1) diff --git a/goal_src/levels/sunken/puffer.gc b/goal_src/levels/sunken/puffer.gc index 8516934594..cb7f9fdad0 100644 --- a/goal_src/levels/sunken/puffer.gc +++ b/goal_src/levels/sunken/puffer.gc @@ -1200,8 +1200,8 @@ (set! (-> obj draw origin-joint-index) (the-as uint 3)) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) - (dummy-9 (-> obj nice-look) *puffer-sg* (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj mean-look) *puffer-mean-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj nice-look) *puffer-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj mean-look) *puffer-mean-sg* (-> obj draw art-group) (-> obj entity)) (load-params! (-> obj sync) obj (the-as uint 2400) 0.0 0.15 0.15) (set! (-> obj notice-dist) (res-lump-float arg0 'notice-dist :default 57344.0)) (set! (-> obj give-up-dist) (+ 20480.0 (-> obj notice-dist))) diff --git a/goal_src/levels/sunken/sunken-obs.gc b/goal_src/levels/sunken/sunken-obs.gc index 8a83521fdd..9a07674212 100644 --- a/goal_src/levels/sunken/sunken-obs.gc +++ b/goal_src/levels/sunken/sunken-obs.gc @@ -373,7 +373,7 @@ ) ) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 18)) + (the-as art-joint-anim (-> self draw art-group data 18)) (new 'static 'vector :x 2449408.0 :y -1822720.0 :z -7299072.0) 0.67 ) @@ -381,7 +381,7 @@ ((= v1-0 3) (ambient-hint-spawn "gamcam34" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 12)) + (the-as art-joint-anim (-> self draw art-group data 12)) (new 'static 'vector :x 2707456.0 :y -630784.0 :z -6635520.0) 1.0 ) @@ -389,7 +389,7 @@ ((= v1-0 4) (ambient-hint-spawn "gamcam35" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 13)) + (the-as art-joint-anim (-> self draw art-group data 13)) (new 'static 'vector :x 2834432.0 :y -634880.0 :z -6811648.0) 1.3 ) @@ -401,7 +401,7 @@ ((= v1-0 5) (ambient-hint-spawn "gamcam37" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 14)) + (the-as art-joint-anim (-> self draw art-group data 14)) (new 'static 'vector :x 2695168.0 :y -544768.0 :z -7077888.0) 1.0 ) @@ -409,7 +409,7 @@ ((= v1-0 6) (ambient-hint-spawn "gamcam36" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 15)) + (the-as art-joint-anim (-> self draw art-group data 15)) (new 'static 'vector :x 2482176.0 :y -516096.0 :z -6922240.0) 1.0 ) diff --git a/goal_src/levels/village2/village2-obs.gc b/goal_src/levels/village2/village2-obs.gc index b2253ed2a2..c47d64e892 100644 --- a/goal_src/levels/village2/village2-obs.gc +++ b/goal_src/levels/village2/village2-obs.gc @@ -77,7 +77,7 @@ ) ((= v1-0 2) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 4)) + (the-as art-joint-anim (-> self draw art-group data 4)) (new 'static 'vector :x 2199552.0 :y 40960.0 :z -6676480.0) 1.0 ) diff --git a/test/decompiler/reference/engine/ambient/ambient_REF.gc b/test/decompiler/reference/engine/ambient/ambient_REF.gc index f81049fbd1..cae1e74dbf 100644 --- a/test/decompiler/reference/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/engine/ambient/ambient_REF.gc @@ -246,7 +246,7 @@ (the-as symbol (and (the-as level-hint a0-0) (and (= (-> (the-as level-hint a0-0) next-state name) 'level-hint-normal) - (not (dummy-15 (the-as level-hint a0-0))) + (not (appeared-for-long-enough? (the-as level-hint a0-0))) ) ) ) @@ -415,7 +415,7 @@ ) ;; definition for method 15 of type level-hint -(defmethod dummy-15 level-hint ((obj level-hint)) +(defmethod appeared-for-long-enough? level-hint ((obj level-hint)) (and (!= (-> obj next-state name) 'level-hint-sidekick) (< 1500 (-> obj total-time))) ) @@ -1157,7 +1157,7 @@ ;; definition for method 18 of type drawable-ambient ;; INFO: Return type mismatch int vs none. -(defmethod dummy-18 drawable-ambient ((obj drawable-ambient) (arg0 vector)) +(defmethod execute-ambient drawable-ambient ((obj drawable-ambient) (arg0 vector)) ((-> obj ambient ambient-data function) obj arg0) 0 (none) diff --git a/test/decompiler/reference/engine/anim/joint_REF.gc b/test/decompiler/reference/engine/anim/joint_REF.gc index c44b416a12..d0553418b3 100644 --- a/test/decompiler/reference/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/engine/anim/joint_REF.gc @@ -252,13 +252,13 @@ ;; definition for method 10 of type art ;; INFO: Return type mismatch symbol vs joint. -(defmethod dummy-10 art ((obj art) (arg0 string) (arg1 type)) +(defmethod lookup-art art ((obj art) (arg0 string) (arg1 type)) (the-as joint #f) ) ;; definition for method 11 of type art ;; INFO: Return type mismatch symbol vs int. -(defmethod dummy-11 art ((obj art) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art ((obj art) (arg0 string) (arg1 type)) (the-as int #f) ) @@ -395,7 +395,7 @@ ;; definition for method 10 of type art-group ;; INFO: Return type mismatch art-element vs joint. -(defmethod dummy-10 art-group ((obj art-group) (arg0 string) (arg1 type)) +(defmethod lookup-art art-group ((obj art-group) (arg0 string) (arg1 type)) (the-as joint (cond @@ -425,7 +425,7 @@ ) ;; definition for method 11 of type art-group -(defmethod dummy-11 art-group ((obj art-group) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art-group ((obj art-group) (arg0 string) (arg1 type)) (cond (arg1 (let ((s3-0 (+ (length (-> obj name)) 1))) @@ -606,7 +606,7 @@ ) ;; definition for method 10 of type art-joint-geo -(defmethod dummy-10 art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) +(defmethod lookup-art art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 (dotimes (s3-0 (-> obj length)) @@ -628,7 +628,7 @@ ) ;; definition for method 11 of type art-joint-geo -(defmethod dummy-11 art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) +(defmethod lookup-idx-of-art art-joint-geo ((obj art-joint-geo) (arg0 string) (arg1 type)) (cond (arg1 (dotimes (s3-0 (-> obj length)) @@ -782,7 +782,7 @@ ) ) ) - (set! sv-64 (dummy-10 arg1 *temp-string* art-joint-anim)) + (set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim)) (cond (sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)) diff --git a/test/decompiler/reference/engine/camera/pov-camera_REF.gc b/test/decompiler/reference/engine/camera/pov-camera_REF.gc index 83eddea166..6bd197b578 100644 --- a/test/decompiler/reference/engine/camera/pov-camera_REF.gc +++ b/test/decompiler/reference/engine/camera/pov-camera_REF.gc @@ -47,7 +47,7 @@ (suspend) ) (let ((gp-0 0)) - (let ((v1-7 (dummy-10 (-> self draw jgeo) "camera" (the-as type #f)))) + (let ((v1-7 (lookup-art (-> self draw jgeo) "camera" (the-as type #f)))) (if v1-7 (set! gp-0 (+ (-> v1-7 number) 1)) ) @@ -72,14 +72,14 @@ ;; definition for function pov-camera-play-and-reposition ;; INFO: Return type mismatch int vs none. -(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 joint-anim-compressed) (arg1 vector) (arg2 float)) +(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float)) (let ((s4-0 #f)) (let ((v1-2 (-> self skel root-channel 0))) - (set! (-> v1-2 frame-group) (the-as art-joint-anim arg0)) - (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 9 unknown-half) -1))) + (set! (-> v1-2 frame-group) arg0) + (set! (-> v1-2 param 0) (the float (+ (-> arg0 data 0 length) -1))) (set! (-> v1-2 param 1) arg2) (set! (-> v1-2 frame-num) 0.0) - (joint-control-channel-group! v1-2 (the-as art-joint-anim arg0) num-func-seek!) + (joint-control-channel-group! v1-2 arg0 num-func-seek!) ) (until (ja-done? 0) (let ((v1-4 (and (not s4-0) (< (the float (+ (-> (if (> (-> self skel active-channels) 0) @@ -293,7 +293,7 @@ (cond ((= (-> arg2 type) string) (logior! (-> self skel status) 32) - (let ((s5-1 (dummy-10 (-> self draw art-group) arg2 art-joint-anim))) + (let ((s5-1 (lookup-art (-> self draw art-group) arg2 art-joint-anim))) (if (not s5-1) (go process-drawable-art-error arg2) ) diff --git a/test/decompiler/reference/engine/data/art-h_REF.gc b/test/decompiler/reference/engine/data/art-h_REF.gc index 8697ee5884..7ffaf0d5f4 100644 --- a/test/decompiler/reference/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/engine/data/art-h_REF.gc @@ -60,7 +60,7 @@ ;; definition of type joint-anim-compressed (deftype joint-anim-compressed (joint-anim) - ((data joint-anim-compressed-hdr :dynamic :offset-assert 12) + ((data uint32 :dynamic :offset-assert 12) ) :method-count-assert 9 :size-assert #xc @@ -78,8 +78,8 @@ ;; definition of type joint-anim-frame (deftype joint-anim-frame (structure) - ((matrices matrix 2 :inline :offset-assert 0) - (data uint32 :dynamic :offset-assert 128) + ((matrices matrix 2 :inline :offset-assert 0) + (data matrix :inline :dynamic :offset-assert 128) ) :method-count-assert 9 :size-assert #x80 @@ -111,7 +111,6 @@ ;; definition of type joint-anim-compressed-hdr (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) - (unknown-half int16 :offset 6) (num-joints uint32 :offset-assert 56) (matrix-bits uint32 :offset-assert 60) ) @@ -214,8 +213,8 @@ :flag-assert #xd00000014 (:methods (login (_type_) _type_ 9) - (dummy-10 (_type_ string type) joint 10) - (dummy-11 (_type_ string type) int 11) + (lookup-art (_type_ string type) joint 10) + (lookup-idx-of-art (_type_ string type) int 11) (needs-link? (_type_) symbol 12) ) ) @@ -376,7 +375,7 @@ :size-assert #x21 :flag-assert #xa00000021 (:methods - (dummy-9 (_type_ skeleton-group art-group entity) _type_ 9) + (setup-lods! (_type_ skeleton-group art-group entity) _type_ 9) ) ) diff --git a/test/decompiler/reference/engine/debug/anim-tester_REF.gc b/test/decompiler/reference/engine/debug/anim-tester_REF.gc index 0d599429ec..b13ae9312e 100644 --- a/test/decompiler/reference/engine/debug/anim-tester_REF.gc +++ b/test/decompiler/reference/engine/debug/anim-tester_REF.gc @@ -2579,7 +2579,7 @@ ) (let ((s4-1 (the-as art-joint-anim - (dummy-10 (-> (the-as anim-test-obj s4-0) obj-art-group) (-> s5-1 privname) art-joint-anim) + (lookup-art (-> (the-as anim-test-obj s4-0) obj-art-group) (-> s5-1 privname) art-joint-anim) ) ) ) diff --git a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc index ccc4c65bac..d81e807a2a 100644 --- a/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc +++ b/test/decompiler/reference/engine/draw/drawable-ambient-h_REF.gc @@ -9,7 +9,7 @@ :size-assert #x20 :flag-assert #x1300000020 (:methods - (dummy-18 (_type_ vector) none 18) + (execute-ambient (_type_ vector) none 18) ) ) @@ -70,7 +70,7 @@ :flag-assert #x10004000a8 (:methods (print-text (_type_) none 14) - (dummy-15 (_type_) symbol 15) + (appeared-for-long-enough? (_type_) symbol 15) ) (:states (level-hint-ambient-sound string) diff --git a/test/decompiler/reference/engine/draw/process-drawable_REF.gc b/test/decompiler/reference/engine/draw/process-drawable_REF.gc index 6c2d2ef62c..e5739234ac 100644 --- a/test/decompiler/reference/engine/draw/process-drawable_REF.gc +++ b/test/decompiler/reference/engine/draw/process-drawable_REF.gc @@ -113,7 +113,7 @@ ;; definition for method 9 of type lod-set ;; Used lq/sq -(defmethod dummy-9 lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) +(defmethod setup-lods! lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) (local-vars (sv-16 res-tag)) (let ((s4-0 arg0) (s5-0 arg1) @@ -515,7 +515,7 @@ ) ) ) - (if (not (dummy-9 (-> s3-0 lod-set) arg0 s4-0 (-> obj entity))) + (if (not (setup-lods! (-> s3-0 lod-set) arg0 s4-0 (-> obj entity))) (go process-drawable-art-error "mesh") ) (let ((v1-43 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1)))) diff --git a/test/decompiler/reference/engine/game/generic-obs_REF.gc b/test/decompiler/reference/engine/game/generic-obs_REF.gc index cc8dff91aa..a5fddff1c9 100644 --- a/test/decompiler/reference/engine/game/generic-obs_REF.gc +++ b/test/decompiler/reference/engine/game/generic-obs_REF.gc @@ -321,7 +321,7 @@ ) ((= v1-0 'art-joint-anim) (set! (-> self new-joint-anim) - (the-as art-joint-anim (dummy-10 (-> self draw art-group) (the-as string (-> arg3 param 0)) art-joint-anim)) + (the-as art-joint-anim (lookup-art (-> self draw art-group) (the-as string (-> arg3 param 0)) art-joint-anim)) ) (set! v0-0 (the-as none (-> arg3 param 1))) (set! (-> self new-joint-anim-blend) (the-as uint v0-0)) @@ -993,7 +993,7 @@ (when (= arg1 -10) (set! arg1 (the-as uint 0)) (when (> (-> (the-as process-drawable gp-0) skel active-channels) 0) - (let ((v1-11 (dummy-10 (-> (the-as process-drawable gp-0) draw jgeo) "camera" (the-as type #f)))) + (let ((v1-11 (lookup-art (-> (the-as process-drawable gp-0) draw jgeo) "camera" (the-as type #f)))) (if v1-11 (set! arg1 (the-as uint (+ (-> v1-11 number) 1))) ) diff --git a/test/decompiler/reference/engine/game/task/hint-control_REF.gc b/test/decompiler/reference/engine/game/task/hint-control_REF.gc index 06c792ecd9..b0089abe45 100644 --- a/test/decompiler/reference/engine/game/task/hint-control_REF.gc +++ b/test/decompiler/reference/engine/game/task/hint-control_REF.gc @@ -277,7 +277,7 @@ ) (when v1-0 (when *hint-semaphore* - (set! v1-0 (dummy-15 (the-as level-hint (ppointer->process *hint-semaphore*)))) + (set! v1-0 (appeared-for-long-enough? (the-as level-hint (ppointer->process *hint-semaphore*)))) 0 ) (when (and v1-0 (< (- (-> *display* base-frame-counter) (-> *game-info* hint-play-time)) 30)) diff --git a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc index 2a6be1295b..70617eb568 100644 --- a/test/decompiler/reference/engine/game/task/process-taskable_REF.gc +++ b/test/decompiler/reference/engine/game/task/process-taskable_REF.gc @@ -1332,7 +1332,7 @@ ) (cond ((t9-0 (rtype-of v1-1) string) - (let ((v1-8 (dummy-10 + (let ((v1-8 (lookup-art (-> (the-as process-taskable (-> self hand process 0)) draw jgeo) (the-as string (-> arg3 param 0)) (the-as type #f) diff --git a/test/decompiler/reference/engine/load/loader_REF.gc b/test/decompiler/reference/engine/load/loader_REF.gc index a710f8f08a..7c8c0a4e76 100644 --- a/test/decompiler/reference/engine/load/loader_REF.gc +++ b/test/decompiler/reference/engine/load/loader_REF.gc @@ -908,7 +908,7 @@ ) ) (spool-push *art-control* (-> arg0 name) spool-part self -20.0) - (let ((s2-4 (the-as art-joint-anim (dummy-10 (-> self draw art-group) (-> arg0 name) art-joint-anim)))) + (let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim)))) (cond (s2-4 (ja-channel-set! 1) diff --git a/test/decompiler/reference/engine/target/target2_REF.gc b/test/decompiler/reference/engine/target/target2_REF.gc index ddb448f8a7..42c87283bc 100644 --- a/test/decompiler/reference/engine/target/target2_REF.gc +++ b/test/decompiler/reference/engine/target/target2_REF.gc @@ -3716,7 +3716,7 @@ ) :code (behavior ((arg0 string) (arg1 handle)) - (let ((gp-0 (the-as art-joint-anim (dummy-10 (-> self draw art-group) arg0 art-joint-anim)))) + (let ((gp-0 (the-as art-joint-anim (lookup-art (-> self draw art-group) arg0 art-joint-anim)))) (when gp-0 (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) (ja-channel-set! 1) diff --git a/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc b/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc index 55dcee11c7..ca5e93021f 100644 --- a/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc +++ b/test/decompiler/reference/levels/citadel/citadel-obs_REF.gc @@ -2040,8 +2040,8 @@ ;; Used lq/sq (defmethod dummy-21 citb-generator ((obj citb-generator)) (initialize-skeleton obj *citb-generator-sg* '()) - (dummy-9 (-> obj normal-look) *citb-generator-sg* (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj broken-look) *citb-generator-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj normal-look) *citb-generator-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *citb-generator-broken-sg* (-> obj draw art-group) (-> obj entity)) (set! (-> obj link) (new 'process 'actor-link-info obj)) (set! (-> obj birth-fuel-cell) (< (the-as uint 1) (the-as uint (-> obj entity extra perm task)))) (set! (-> obj trigger-others) #f) diff --git a/test/decompiler/reference/levels/common/plat-eco_REF.gc b/test/decompiler/reference/levels/common/plat-eco_REF.gc index 78b43e616d..0f65e41231 100644 --- a/test/decompiler/reference/levels/common/plat-eco_REF.gc +++ b/test/decompiler/reference/levels/common/plat-eco_REF.gc @@ -332,8 +332,8 @@ (s5-1 (get-lit-skel obj)) ) (initialize-skeleton obj s4-0 '()) - (dummy-9 (-> obj unlit-look) s4-0 (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj lit-look) s5-1 (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj unlit-look) s4-0 (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj lit-look) s5-1 (-> obj draw art-group) (-> obj entity)) ) (logclear! (-> obj mask) (process-mask actor-pause)) (update-transforms! (-> obj root-override)) diff --git a/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc b/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc index 11923223a6..06d8bf8690 100644 --- a/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc +++ b/test/decompiler/reference/levels/maincave/mother-spider-egg_REF.gc @@ -650,7 +650,7 @@ (set! (-> self mask) (logior (process-mask enemy) (-> self mask))) (set! (-> self mask) (logior (process-mask attackable) (-> self mask))) (initialize-skeleton self *mother-spider-egg-unbroken-sg* '()) - (dummy-9 (-> self broken-look) *mother-spider-egg-broken-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self broken-look) *mother-spider-egg-broken-sg* (-> self draw art-group) (-> self entity)) (set! (-> self draw shadow-ctrl) (new 'process 'shadow-control 0.0 0.0 614400.0 (the-as float 60) 245760.0)) (set! (-> self nav) (new 'process 'nav-control (-> self root-override) 16 40960.0)) (logior! (-> self nav flags) (nav-control-flags display-marks bit3 bit5 bit6 bit7)) diff --git a/test/decompiler/reference/levels/misty/sidekick-human_REF.gc b/test/decompiler/reference/levels/misty/sidekick-human_REF.gc index e3890c0ffc..8a90f46347 100644 --- a/test/decompiler/reference/levels/misty/sidekick-human_REF.gc +++ b/test/decompiler/reference/levels/misty/sidekick-human_REF.gc @@ -1828,7 +1828,7 @@ 'eval (lambda :behavior sequenceC () - ((method-of-type lod-set dummy-9) + ((method-of-type lod-set setup-lods!) (the-as lod-set (&-> (the-as process-taskable (-> self parent 0)) stack 288)) *darkecocan-glow-sg* (-> self draw art-group) diff --git a/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc b/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc index d60f0d2f4f..e8991f619b 100644 --- a/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc +++ b/test/decompiler/reference/levels/ogre/ogre-obs_REF.gc @@ -1942,7 +1942,7 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *shortcut-boulder-whole-sg* '()) - (dummy-9 (-> obj broken-look) *shortcut-boulder-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *shortcut-boulder-broken-sg* (-> obj draw art-group) (-> obj entity)) (set-vector! (-> obj draw color-emissive) 0.125 0.0625 0.0 0.0) (go shortcut-boulder-idle) (none) diff --git a/test/decompiler/reference/levels/robocave/spider-egg_REF.gc b/test/decompiler/reference/levels/robocave/spider-egg_REF.gc index fd1a1ba8ec..ff860d1f85 100644 --- a/test/decompiler/reference/levels/robocave/spider-egg_REF.gc +++ b/test/decompiler/reference/levels/robocave/spider-egg_REF.gc @@ -343,7 +343,7 @@ ) (process-drawable-from-entity! obj arg0) (initialize-skeleton obj *spider-egg-unbroken-sg* '()) - (dummy-9 (-> obj broken-look) *spider-egg-broken-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj broken-look) *spider-egg-broken-sg* (-> obj draw art-group) (-> obj entity)) (set-vector! (-> obj root-override scale) 0.4 0.4 0.4 1.0) (if (not (move-to-ground (-> obj root-override) 12288.0 40960.0 #t (collide-kind background))) (go process-drawable-art-error "no ground") diff --git a/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc b/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc index 0f255f32f6..999939f64c 100644 --- a/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc +++ b/test/decompiler/reference/levels/rolling/rolling-obs_REF.gc @@ -1224,8 +1224,8 @@ (set! (-> self root) (new 'process 'trsqv)) (set! (-> self root trans quad) (-> arg0 quad)) (initialize-skeleton self *rolling-start-whole-sg* '()) - (dummy-9 (-> self whole-look) *rolling-start-whole-sg* (-> self draw art-group) (-> self entity)) - (dummy-9 (-> self broken-look) *rolling-start-broken-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self whole-look) *rolling-start-whole-sg* (-> self draw art-group) (-> self entity)) + (setup-lods! (-> self broken-look) *rolling-start-broken-sg* (-> self draw art-group) (-> self entity)) (let ((s5-1 (new 'stack-no-clear 'matrix))) (matrix-rotate-y! s5-1 arg1) (matrix->quaternion (-> self root quat) s5-1) diff --git a/test/decompiler/reference/levels/sunken/puffer_REF.gc b/test/decompiler/reference/levels/sunken/puffer_REF.gc index 036775a37c..5465d0631e 100644 --- a/test/decompiler/reference/levels/sunken/puffer_REF.gc +++ b/test/decompiler/reference/levels/sunken/puffer_REF.gc @@ -1269,8 +1269,8 @@ (set! (-> obj draw origin-joint-index) (the-as uint 3)) (logclear! (-> obj mask) (process-mask actor-pause)) (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) - (dummy-9 (-> obj nice-look) *puffer-sg* (-> obj draw art-group) (-> obj entity)) - (dummy-9 (-> obj mean-look) *puffer-mean-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj nice-look) *puffer-sg* (-> obj draw art-group) (-> obj entity)) + (setup-lods! (-> obj mean-look) *puffer-mean-sg* (-> obj draw art-group) (-> obj entity)) (load-params! (-> obj sync) obj (the-as uint 2400) 0.0 0.15 0.15) (set! (-> obj notice-dist) (res-lump-float arg0 'notice-dist :default 57344.0)) (set! (-> obj give-up-dist) (+ 20480.0 (-> obj notice-dist))) diff --git a/test/decompiler/reference/levels/sunken/sunken-obs_REF.gc b/test/decompiler/reference/levels/sunken/sunken-obs_REF.gc index d3104a6087..c585ba89cd 100644 --- a/test/decompiler/reference/levels/sunken/sunken-obs_REF.gc +++ b/test/decompiler/reference/levels/sunken/sunken-obs_REF.gc @@ -426,7 +426,7 @@ ) ) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 18)) + (the-as art-joint-anim (-> self draw art-group data 18)) (new 'static 'vector :x 2449408.0 :y -1822720.0 :z -7299072.0) 0.67 ) @@ -434,7 +434,7 @@ ((= v1-0 3) (ambient-hint-spawn "gamcam34" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 12)) + (the-as art-joint-anim (-> self draw art-group data 12)) (new 'static 'vector :x 2707456.0 :y -630784.0 :z -6635520.0) 1.0 ) @@ -442,7 +442,7 @@ ((= v1-0 4) (ambient-hint-spawn "gamcam35" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 13)) + (the-as art-joint-anim (-> self draw art-group data 13)) (new 'static 'vector :x 2834432.0 :y -634880.0 :z -6811648.0) 1.3 ) @@ -454,7 +454,7 @@ ((= v1-0 5) (ambient-hint-spawn "gamcam37" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 14)) + (the-as art-joint-anim (-> self draw art-group data 14)) (new 'static 'vector :x 2695168.0 :y -544768.0 :z -7077888.0) 1.0 ) @@ -462,7 +462,7 @@ ((= v1-0 6) (ambient-hint-spawn "gamcam36" (the-as vector #f) *entity-pool* 'camera) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 15)) + (the-as art-joint-anim (-> self draw art-group data 15)) (new 'static 'vector :x 2482176.0 :y -516096.0 :z -6922240.0) 1.0 ) diff --git a/test/decompiler/reference/levels/village2/village2-obs_REF.gc b/test/decompiler/reference/levels/village2/village2-obs_REF.gc index 6c862c35ca..ea853bc453 100644 --- a/test/decompiler/reference/levels/village2/village2-obs_REF.gc +++ b/test/decompiler/reference/levels/village2/village2-obs_REF.gc @@ -82,7 +82,7 @@ ) ((= v1-0 2) (pov-camera-play-and-reposition - (the-as joint-anim-compressed (-> self draw art-group data 4)) + (the-as art-joint-anim (-> self draw art-group data 4)) (new 'static 'vector :x 2199552.0 :y 40960.0 :z -6676480.0) 1.0 ) diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 867b91d683..673127a27a 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -195,7 +195,7 @@ Decompiler setup_decompiler(const std::vector& files, std::vector dgo_paths; if (args.iso_data_path.empty()) { for (auto& x : offline_config.dgos) { - dgo_paths.push_back(file_util::get_file_path({"iso_data", x})); + dgo_paths.push_back(file_util::get_file_path({"iso_data/jak1", x})); } } else { for (auto& x : offline_config.dgos) {