mirror of
https://github.com/open-goal/jak-project.git
synced 2025-02-22 07:03:16 +00:00
anim-tester-x
+ cam flip fixes + logxor!
decomp (#1359)
* `anim-tester-x` + cam flip fixes + `logxor!` decomp * Update anim-tester-x.gc
This commit is contained in:
parent
0212aa10c9
commit
19944ebe10
@ -1769,6 +1769,8 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
|
||||
return "logior!";
|
||||
case FixedOperatorKind::LOGXOR:
|
||||
return "logxor";
|
||||
case FixedOperatorKind::LOGXOR_IN_PLACE:
|
||||
return "logxor!";
|
||||
case FixedOperatorKind::LOGNOR:
|
||||
return "lognor";
|
||||
case FixedOperatorKind::LOGNOT:
|
||||
|
@ -2406,7 +2406,8 @@ void SetFormFormElement::push_to_stack(const Env& env, FormPool& pool, FormStack
|
||||
{FixedOperatorKind::ADDITION_PTR, FixedOperatorKind::ADDITION_PTR_IN_PLACE, 0},
|
||||
{FixedOperatorKind::LOGAND, FixedOperatorKind::LOGAND_IN_PLACE, 0},
|
||||
{FixedOperatorKind::LOGIOR, FixedOperatorKind::LOGIOR_IN_PLACE, 0},
|
||||
{FixedOperatorKind::LOGCLEAR, FixedOperatorKind::LOGCLEAR_IN_PLACE, 0}};
|
||||
{FixedOperatorKind::LOGCLEAR, FixedOperatorKind::LOGCLEAR_IN_PLACE, 0},
|
||||
{FixedOperatorKind::LOGXOR, FixedOperatorKind::LOGXOR_IN_PLACE, 0}};
|
||||
|
||||
typedef struct {
|
||||
std::string orig_name;
|
||||
@ -2439,9 +2440,8 @@ void SetFormFormElement::push_to_stack(const Env& env, FormPool& pool, FormStack
|
||||
}
|
||||
ASSERT_MSG(
|
||||
inplace_call,
|
||||
fmt::format(
|
||||
"Somehow, no appropriate inplace call was generated for (set! {}) -> {}",
|
||||
call_info.orig_name, call_info.inplace_name));
|
||||
fmt::format("no appropriate inplace call was generated for (set! {}) -> {}",
|
||||
call_info.orig_name, call_info.inplace_name));
|
||||
stack.push_form_element(inplace_call, true);
|
||||
return;
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ enum class FixedOperatorKind {
|
||||
LOGIOR,
|
||||
LOGIOR_IN_PLACE,
|
||||
LOGXOR,
|
||||
LOGXOR_IN_PLACE,
|
||||
LOGNOR,
|
||||
LOGNOT,
|
||||
LOGCLEAR,
|
||||
|
@ -4911,7 +4911,7 @@
|
||||
:flag-assert #xb00000010
|
||||
(:methods
|
||||
(new (symbol type int basic) _type_ 0)
|
||||
;; these methods dont exist
|
||||
;; these methods dont exist for this type
|
||||
(load-to-heap-by-name (_type_ string symbol kheap int) art-group 9)
|
||||
(set-loaded-art (_type_ art-group) art-group 10)
|
||||
)
|
||||
@ -5788,7 +5788,7 @@
|
||||
(define-extern set-display-env (function display-env int int int int int int display-env))
|
||||
(define-extern set-draw-env (function draw-env int int int int int int draw-env))
|
||||
(define-extern get-video-mode (function symbol))
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags none))
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags float))
|
||||
(define-extern set-draw-env-offset (function draw-env int int int draw-env))
|
||||
(define-extern put-display-alpha-env (function display-env none))
|
||||
(define-extern set-display2 (function display int int int int int display))
|
||||
|
@ -578,9 +578,6 @@ uint32_t link_control::work_v2() {
|
||||
if (m_segment_process == 0) {
|
||||
m_heap_gap =
|
||||
m_object_data - m_heap->current; // distance between end of heap and start of object
|
||||
if (m_object_data.offset < m_heap->current.offset) {
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_heap_gap <
|
||||
|
@ -294,6 +294,7 @@
|
||||
("anim-tester.o" "anim-tester")
|
||||
("viewer.o" "viewer")
|
||||
("part-tester.o" "part-tester")
|
||||
("anim-tester-x.o" "anim-tester-x") ;; added
|
||||
("default-menu.o" "default-menu")
|
||||
("subtitle.o" "subtitle") ;; added
|
||||
)
|
||||
|
@ -290,6 +290,7 @@
|
||||
("anim-tester.o" "anim-tester")
|
||||
("viewer.o" "viewer")
|
||||
("part-tester.o" "part-tester")
|
||||
("anim-tester-x.o" "anim-tester-x") ;; added
|
||||
("default-menu.o" "default-menu")
|
||||
("subtitle.o" "subtitle") ;; added
|
||||
("dir-tpages.go" "dir-tpages")
|
||||
|
@ -2329,10 +2329,10 @@
|
||||
)
|
||||
)
|
||||
;; changed for pc port, only used for Third-Person Vertical camera
|
||||
(*
|
||||
(if (and PC_PORT (-> *pc-settings* third-camera-vflip?)) 1.0 -1.0)
|
||||
f0-0
|
||||
)
|
||||
(#if PC_PORT
|
||||
(* (if (-> *pc-settings* third-camera-vflip?) -1.0 1.0) f0-0)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1481,7 +1481,7 @@
|
||||
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 1045]
|
||||
(defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control))
|
||||
(local-vars
|
||||
(sv-192 (function string dma-buffer int int font-color font-flags none))
|
||||
(sv-192 (function string dma-buffer int int font-color font-flags float))
|
||||
(sv-208 (function _varargs_ object))
|
||||
)
|
||||
(let ((gp-0 (-> arg1 the-node))
|
||||
|
@ -3977,6 +3977,11 @@
|
||||
(defmacro new-dm-submenu (text menu)
|
||||
`(new 'debug 'debug-menu-item-submenu ,text ,menu)
|
||||
)
|
||||
(defmacro new-dm-var-float (text var func inc min max)
|
||||
`(debug-menu-item-var-make-float (new 'debug 'debug-menu-item-var ,text ,var (* 8 20))
|
||||
(the-as (function int debug-menu-msg float float float) ,func)
|
||||
,inc #t ,min ,max 1)
|
||||
)
|
||||
|
||||
(defun dm-want-level-toggle-pick-func ((arg0 pair) (arg1 debug-menu-msg))
|
||||
(let* ((levname (the-as symbol (car arg0)))
|
||||
@ -4243,6 +4248,19 @@
|
||||
))
|
||||
)
|
||||
|
||||
(defmacro dm-lambda-float-var (val)
|
||||
"helper macro for making float buttons"
|
||||
`(lambda (arg (msg debug-menu-msg) (newval float))
|
||||
(cond
|
||||
((= msg (debug-menu-msg press))
|
||||
(set! ,val newval)
|
||||
)
|
||||
(else
|
||||
,val
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
(defmacro dm-lambda-meters-var (val)
|
||||
"helper macro for making meters buttons"
|
||||
`(lambda (arg (msg debug-menu-msg) (newval float))
|
||||
@ -4413,6 +4431,71 @@
|
||||
(-> *pc-settings* mood-overrides (/ pal 8))
|
||||
)
|
||||
|
||||
(defun dm-anim-tester-x-flag-func ((action symbol) (msg debug-menu-msg))
|
||||
(case action
|
||||
(('at-show-joint-info)
|
||||
(if (= msg (debug-menu-msg press))
|
||||
(logxor! (-> *ATX-settings* flags) (atx-flags show-joints)))
|
||||
(return (logtest? (-> *ATX-settings* flags) (atx-flags show-joints)))
|
||||
)
|
||||
)
|
||||
#f)
|
||||
|
||||
(defun dm-anim-tester-x-func ((action symbol))
|
||||
(unless *atx*
|
||||
(atx-start))
|
||||
|
||||
(case action
|
||||
(('pick-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode art-group))
|
||||
(false! *camera-read-buttons*)
|
||||
)
|
||||
(('at-pick-joint-anim)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode anim))
|
||||
(false! *camera-read-buttons*)
|
||||
)
|
||||
)
|
||||
(('pick-mesh-geo)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode mgeo))
|
||||
(false! *camera-read-buttons*)
|
||||
)
|
||||
)
|
||||
(('pick-joint-geo)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode jgeo))
|
||||
(false! *camera-read-buttons*)
|
||||
)
|
||||
)
|
||||
(('at-cam-free-floating)
|
||||
(send-event *camera* 'change-state cam-free-floating 0)
|
||||
)
|
||||
(('at-cam-orbit)
|
||||
(send-event *camera* 'change-state cam-orbit 0)
|
||||
)
|
||||
)
|
||||
0)
|
||||
|
||||
(defun debug-menu-make-anim-tester-x-menu ((ctx debug-menu-context))
|
||||
(let ((menu (new 'debug 'debug-menu ctx "Anim Tester X menu")))
|
||||
;; master toggle
|
||||
(debug-menu-append-item menu (new-dm-func "Start" #f atx-start))
|
||||
(debug-menu-append-item menu (new-dm-func "Stop" #f atx-stop))
|
||||
(debug-menu-append-item menu (new-dm-var-float "Speed" (the int #f) (dm-lambda-float-var (-> *ATX-settings* speed)) 0.01 -10.0 10.0))
|
||||
(debug-menu-append-item menu (new-dm-var-float "Frame Num" (the int #f) (dm-lambda-float-var (-> *ATX-settings* frame-num)) 0.1 0.0 99999.0))
|
||||
(debug-menu-append-item menu (new-dm-func "Pick Art Group" 'pick-art-group dm-anim-tester-x-func))
|
||||
(debug-menu-append-item menu (new-dm-func "Pick Anim" 'at-pick-joint-anim dm-anim-tester-x-func))
|
||||
(debug-menu-append-item menu (new-dm-func "Pick Mesh" 'pick-mesh-geo dm-anim-tester-x-func))
|
||||
(debug-menu-append-item menu (new-dm-func "Pick Skeleton" 'pick-joint-geo dm-anim-tester-x-func))
|
||||
(debug-menu-append-item menu (new-dm-flag "Show Joint Info" 'at-show-joint-info dm-anim-tester-x-flag-func))
|
||||
(debug-menu-append-item menu (new-dm-func "Free Floating cam" 'at-cam-free-floating dm-anim-tester-x-func))
|
||||
(debug-menu-append-item menu (new-dm-func "Orbit cam" 'at-cam-orbit dm-anim-tester-x-func))
|
||||
|
||||
(new-dm-submenu "Anim Tester X" menu)
|
||||
)
|
||||
)
|
||||
|
||||
(when (-> *debug-menu-context* root-menu)
|
||||
(debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-load-menu *debug-menu-context*))
|
||||
(debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-part-menu *debug-menu-context*))
|
||||
@ -4582,9 +4665,12 @@
|
||||
(debug-menu-append-item (-> *debug-menu-context* root-menu) other-menu-node)
|
||||
)
|
||||
|
||||
(debug-menu-append-item (-> (the debug-menu-item-submenu (caddddr (-> *debug-menu-context* root-menu items))) submenu)
|
||||
(debug-menu-append-item (-> (the debug-menu-item-submenu (ref (-> *debug-menu-context* root-menu items) 4)) submenu)
|
||||
(debug-menu-make-collision-renderer-menu *debug-menu-context*))
|
||||
|
||||
(debug-menu-append-item (-> (the debug-menu-item-submenu (car (-> *debug-menu-context* root-menu items))) submenu)
|
||||
(debug-menu-make-anim-tester-x-menu *debug-menu-context*))
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
@ -984,16 +984,16 @@
|
||||
|
||||
(defun debug-menu-context-render ((arg0 debug-menu-context))
|
||||
"Render all menus"
|
||||
(let ((y-pos 6))
|
||||
(let ((x-pos 6))
|
||||
;; loop down the stack of menus
|
||||
(dotimes (stack-idx (-> arg0 sel-length))
|
||||
;; the menu being drawn at this depth
|
||||
(let ((menu (-> arg0 sel-menu stack-idx)))
|
||||
;; the thing that's selected at this depth.
|
||||
(let ((selection (-> menu selected-item)))
|
||||
(debug-menu-render menu y-pos 28 selection (+ (- -1 stack-idx) (-> arg0 sel-length)))
|
||||
(debug-menu-render menu x-pos 28 selection (+ (- -1 stack-idx) (-> arg0 sel-length)))
|
||||
)
|
||||
(set! y-pos (+ y-pos 3 (-> menu pix-width)))
|
||||
(set! x-pos (+ x-pos 3 (-> menu pix-width)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -766,4 +766,4 @@
|
||||
|
||||
|
||||
(define-extern draw-string (function string dma-buffer font-context float))
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags none))
|
||||
(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags float))
|
@ -1815,17 +1815,7 @@
|
||||
|
||||
(defun draw-string-xy ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags font-flags))
|
||||
"Draw a string at the given xy location."
|
||||
(let ((context (new 'stack 'font-context
|
||||
*font-default-matrix*
|
||||
x
|
||||
y
|
||||
0.0
|
||||
color
|
||||
flags
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((context (new 'stack 'font-context *font-default-matrix* x y 0.0 color flags)))
|
||||
(draw-string str buf context)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
@ -202,35 +202,35 @@
|
||||
|
||||
(defmacro analog-input-vertical-first (in offset center-val max-val out-range)
|
||||
"Same as analog-input but respects First-Person Vertical camera control setting."
|
||||
`(*
|
||||
(if (and PC_PORT (-> *pc-settings* first-camera-vflip?)) 1.0 -1.0)
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
`(#if PC_PORT
|
||||
(* (if (-> *pc-settings* first-camera-vflip?) -1.0 1.0) (analog-input ,in ,offset ,center-val ,max-val ,out-range))
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro analog-input-horizontal-first (in offset center-val max-val out-range)
|
||||
"Same as analog-input but respects First-Person Horizontal camera control setting."
|
||||
`(*
|
||||
(if (and PC_PORT (-> *pc-settings* first-camera-hflip?)) 1.0 -1.0)
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
`(#if PC_PORT
|
||||
(* (if (-> *pc-settings* first-camera-hflip?) -1.0 1.0) (analog-input ,in ,offset ,center-val ,max-val ,out-range))
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro analog-input-vertical-third (in offset center-val max-val out-range)
|
||||
"Same as analog-input but respects Third-Person Vertical camera control setting."
|
||||
`(*
|
||||
(if (and PC_PORT (-> *pc-settings* third-camera-vflip?)) 1.0 -1.0)
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
`(#if PC_PORT
|
||||
(* (if (-> *pc-settings* third-camera-vflip?) -1.0 1.0) (analog-input ,in ,offset ,center-val ,max-val ,out-range))
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro analog-input-horizontal-third (in offset center-val max-val out-range)
|
||||
"Same as analog-input but respects Third-Person Horizontal camera control setting."
|
||||
`(*
|
||||
(if (and PC_PORT (-> *pc-settings* third-camera-hflip?)) 1.0 -1.0)
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
`(#if PC_PORT
|
||||
(* (if (-> *pc-settings* third-camera-hflip?) -1.0 1.0) (analog-input ,in ,offset ,center-val ,max-val ,out-range))
|
||||
(analog-input ,in ,offset ,center-val ,max-val ,out-range)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun cpad-set-buzz! ((pad cpad-info) (buzz-idx int) (buzz-amount int) (duration time-frame))
|
||||
"Turn on vibration motor 'buzz-idx' for duration, at magnitude buzz-amount."
|
||||
|
@ -36,17 +36,18 @@
|
||||
(s5-0 *target*)
|
||||
)
|
||||
(set! (-> a1-1 y) (+ 4096.0 (-> a1-1 y)))
|
||||
(when (>= (fill-and-probe-using-y-probe
|
||||
*collide-cache*
|
||||
a1-1
|
||||
(the-as float 20480.0)
|
||||
(collide-kind background cak-1 cak-2 cak-3 water powerup crate enemy wall-object ground-object mother-spider)
|
||||
s5-0
|
||||
s3-0
|
||||
(new 'static 'pat-surface :noentity #x1)
|
||||
)
|
||||
0.0
|
||||
)
|
||||
;; NOTE : added *target* check here.
|
||||
(when (and s5-0 (>= (fill-and-probe-using-y-probe
|
||||
*collide-cache*
|
||||
a1-1
|
||||
(the-as float 20480.0)
|
||||
(collide-kind background cak-1 cak-2 cak-3 water powerup crate enemy wall-object ground-object mother-spider)
|
||||
s5-0
|
||||
s3-0
|
||||
(new 'static 'pat-surface :noentity #x1)
|
||||
)
|
||||
0.0
|
||||
))
|
||||
(let ((s2-0 (new 'stack-no-clear 'vector))
|
||||
(s4-1 (new 'stack-no-clear 'quaternion))
|
||||
)
|
||||
@ -92,6 +93,8 @@
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(set! sv-16 *target*)
|
||||
;; NOTE : added check here
|
||||
(if (not sv-16) (return #f))
|
||||
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
||||
(new 'stack-no-clear 'vector)
|
||||
(let ((s5-0 (new 'stack-no-clear 'quaternion)))
|
||||
@ -173,6 +176,8 @@
|
||||
)
|
||||
|
||||
(defun part-tracker-track-target-joint ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
|
||||
;; NOTE : added this check
|
||||
(if (not *target*) (return #f))
|
||||
(let* ((v1-0 *target*)
|
||||
(v1-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> v1-0 node-list data (the int (-> arg1 user-float)))))
|
||||
)
|
||||
|
@ -1953,6 +1953,7 @@
|
||||
(goal-src "pc/pckernel.gc" "settings")
|
||||
(goal-src "pc/subtitle.gc" "text" "pckernel" "hint-control" "loader-h" "gsound" "ambient")
|
||||
(goal-src "pc/progress-pc.gc" "progress" "pckernel")
|
||||
(goal-src "pc/anim-tester-x.gc" "pckernel" "gstring" "joint" "process-drawable" "art-h" "effect-control")
|
||||
|
||||
(group-list "all-code"
|
||||
`(,@(reverse *all-gc*))
|
||||
|
@ -435,13 +435,13 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro aif (condition true false)
|
||||
(defmacro aif (condition true &rest false)
|
||||
"Anaphoric if, similar to Common Lisp"
|
||||
|
||||
`(let ((it ,condition))
|
||||
(if it
|
||||
,true
|
||||
,false
|
||||
,@false
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -769,10 +769,6 @@
|
||||
`(car (cdr (cdr (cdr ,arg))))
|
||||
)
|
||||
|
||||
(defmacro caddddr (arg)
|
||||
`(car (cdr (cdr (cdr (cdr ,arg)))))
|
||||
)
|
||||
|
||||
(defmacro dcons (a b)
|
||||
`(new 'debug 'pair ,a ,b)
|
||||
)
|
||||
|
691
goal_src/pc/anim-tester-x.gc
Normal file
691
goal_src/pc/anim-tester-x.gc
Normal file
@ -0,0 +1,691 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
#|
|
||||
|
||||
Code for the PC port anim tester. It's like their original anim tester tool, but actually functional, and with
|
||||
different features.
|
||||
|
||||
|#
|
||||
|
||||
;; debug-only file!
|
||||
(declare-file (debug))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; constants
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; types and enums
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;;;------------------------
|
||||
;; settings
|
||||
;;;------------------------
|
||||
|
||||
|
||||
(deftype atx-item (basic)
|
||||
((next atx-item :offset-assert 4)
|
||||
(text string)
|
||||
|
||||
(extra basic)
|
||||
(group art-group :overlay-at extra)
|
||||
(jgeo art-joint-geo :overlay-at extra)
|
||||
(janim art-joint-anim :overlay-at extra)
|
||||
(mgeo merc-ctrl :overlay-at extra)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type string basic) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod new atx-item ((allocation symbol) (type-to-make type) (text string) (extra basic))
|
||||
"make a new atx-item"
|
||||
|
||||
(let ((obj (object-new allocation type-to-make (the int (-> type-to-make size)))))
|
||||
(set! (-> obj next) #f)
|
||||
(set! (-> obj text) text)
|
||||
(set! (-> obj extra) extra)
|
||||
|
||||
obj)
|
||||
)
|
||||
|
||||
(deftype atx-list (structure)
|
||||
((head atx-item :offset-assert 0)
|
||||
(tail atx-item)
|
||||
(selection int16)
|
||||
(offset int16)
|
||||
(func (function atx-item object))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defenum atx-flags
|
||||
:bitfield #t
|
||||
:type int32
|
||||
(eye)
|
||||
(blerc)
|
||||
(show-joints)
|
||||
)
|
||||
|
||||
(deftype anim-tester-x-settings (structure)
|
||||
(
|
||||
(speed float)
|
||||
(frame-num float)
|
||||
(mode symbol)
|
||||
(flags atx-flags)
|
||||
(list-ctrl atx-list :inline)
|
||||
)
|
||||
)
|
||||
|
||||
(define *ATX-settings* (new 'static 'anim-tester-x-settings :speed 1.0
|
||||
:mode 'loop
|
||||
:flags (atx-flags)))
|
||||
|
||||
|
||||
(deftype atx-item-art-group (atx-item)
|
||||
((ja-list atx-list :inline)
|
||||
(jg-list atx-list :inline)
|
||||
(mg-list atx-list :inline)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type string art-group) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
;;;----------------------------------
|
||||
;; process
|
||||
;;;----------------------------------
|
||||
|
||||
|
||||
(defenum atx-edit-mode
|
||||
:type uint8
|
||||
(none)
|
||||
(art-group)
|
||||
(anim)
|
||||
(mgeo)
|
||||
(jgeo)
|
||||
)
|
||||
|
||||
|
||||
(deftype anim-tester-x (process-drawable)
|
||||
(
|
||||
(edit-mode atx-edit-mode)
|
||||
(cur-list atx-list)
|
||||
(selected-art-group atx-item-art-group)
|
||||
|
||||
(cur-art-group art-group)
|
||||
(cur-joint-geo art-joint-geo)
|
||||
(cur-mesh-geo merc-ctrl)
|
||||
(cur-joint-anim art-joint-anim)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; list functions and macros
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defmacro do-atx-list (bindings &rest body)
|
||||
"iterate through an atx-list."
|
||||
(with-gensyms (next)
|
||||
`(let ((,(car bindings) (-> ,(cadr bindings) head)))
|
||||
(while ,(car bindings)
|
||||
(let ((,next (-> ,(car bindings) next)))
|
||||
|
||||
,@body
|
||||
|
||||
(set! ,(car bindings) ,next)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun atx-list-init! ((lst atx-list))
|
||||
"initialize an atx-list"
|
||||
(set! (-> lst head) #f)
|
||||
(set! (-> lst tail) #f)
|
||||
(set! (-> lst selection) 0)
|
||||
(set! (-> lst offset) 0)
|
||||
(set! (-> lst func) (the (function atx-item object) nothing))
|
||||
lst)
|
||||
|
||||
(defun atx-list-size ((lst atx-list))
|
||||
"return size of an atx-list"
|
||||
(let ((items 0))
|
||||
(do-atx-list (item lst) (1+! items))
|
||||
items)
|
||||
)
|
||||
|
||||
(defun atx-list-append ((lst atx-list) (item atx-item))
|
||||
"append an item to a list. returns the added item."
|
||||
|
||||
(if (not (-> lst head)) (set! (-> lst head) item))
|
||||
(if (-> lst tail) (set! (-> lst tail next) item))
|
||||
(set! (-> lst tail) item)
|
||||
item)
|
||||
|
||||
(defun atx-list-remove ((lst atx-list) (item atx-item))
|
||||
"remove an item from a list. removes all instances of that item. but it's weird if you have multiple..."
|
||||
|
||||
(cond
|
||||
((= (-> lst head) item)
|
||||
(set! (-> lst head) (-> item next))
|
||||
(if (= (-> lst tail) item)
|
||||
(set! (-> lst tail) #f)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((last (the atx-item #f))
|
||||
(i 0))
|
||||
(do-atx-list (it lst)
|
||||
(when (= it item)
|
||||
(if (>= (-> lst selection) i)
|
||||
(1-! (-> lst selection)))
|
||||
(set! (-> last next) (-> it next))
|
||||
(set! it last)
|
||||
)
|
||||
(set! last it)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0)
|
||||
|
||||
(defun atx-list-remove-by-object ((lst atx-list) (obj basic))
|
||||
"remove all items with a specific object from a list."
|
||||
|
||||
(do-atx-list (it lst)
|
||||
(if (= (-> it extra) obj)
|
||||
(atx-list-remove lst it)
|
||||
)
|
||||
)
|
||||
0)
|
||||
|
||||
(defun atx-list-get-by-index ((lst atx-list) (idx int))
|
||||
"get an item by its index."
|
||||
|
||||
(let ((items 0))
|
||||
(do-atx-list (item lst)
|
||||
(if (= items idx)
|
||||
(return item))
|
||||
(1+! items))
|
||||
items)
|
||||
(the atx-item #f))
|
||||
|
||||
(defun atx-list-get-by-name ((lst atx-list) (name string))
|
||||
"get an item by its index."
|
||||
|
||||
(do-atx-list (item lst)
|
||||
(if (string= (-> item text) name)
|
||||
(return item))
|
||||
)
|
||||
(the atx-item #f))
|
||||
|
||||
|
||||
(defmacro atx-interface-square-to-menu ()
|
||||
`(when (cpad-pressed? 0 square)
|
||||
(cpad-clear! 0 square)
|
||||
(true! *camera-read-buttons*)
|
||||
(set! (-> self edit-mode) (atx-edit-mode none))
|
||||
(set! (-> *debug-menu-context* is-hidden) #f)
|
||||
)
|
||||
)
|
||||
|
||||
(defun atx-list-interface ((lst atx-list) (title string) (warning string) (sel-obj basic))
|
||||
"run interface and draw an atx-list"
|
||||
|
||||
(let ((items-drawn (-> lst offset))
|
||||
(i 0)
|
||||
(color (font-color dim-white))
|
||||
(text-len 0.0))
|
||||
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
|
||||
(bucket-id debug-no-zbuf))
|
||||
|
||||
(when (nonzero? (length title))
|
||||
(set! text-len (draw-string-xy title buf 9 (+ 28 4 (* items-drawn 8)) (font-color dim-white) (font-flags shadow kerning)))
|
||||
(1+! items-drawn)
|
||||
)
|
||||
|
||||
(do-atx-list (item lst)
|
||||
(let ((selected? (= i (-> lst selection))))
|
||||
|
||||
(set! color (if (= (-> item extra) sel-obj) (font-color yellow-green) (font-color dim-white)))
|
||||
|
||||
(let ((this-len (draw-string-xy (-> item group name) buf 21 (+ 28 4 (* items-drawn 8)) color (font-flags shadow kerning))))
|
||||
(if (> this-len text-len)
|
||||
(set! text-len this-len)))
|
||||
|
||||
(if selected?
|
||||
(draw-string-xy ">" buf 9 (+ 28 4 (* items-drawn 8)) color (font-flags shadow kerning)))
|
||||
|
||||
(1+! items-drawn)
|
||||
(1+! i)
|
||||
|
||||
))
|
||||
|
||||
(when (not (-> lst head))
|
||||
(draw-string-xy warning buf 21 (+ 28 4 8) (font-color red) (font-flags shadow kerning))
|
||||
(1+! items-drawn))
|
||||
|
||||
)
|
||||
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
|
||||
(bucket-id debug))
|
||||
|
||||
|
||||
(draw-sprite2d-xy buf 6 (+ 28 (* (-> lst offset) 8))
|
||||
(+ 6 12 12 (the int text-len)) (+ 8 (* 8 (- items-drawn (-> lst offset))))
|
||||
(static-rgba 0 0 0 64))
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
(when (-> lst head)
|
||||
(if (cpad-pressed? 0 down)
|
||||
(+! (-> lst selection) 1))
|
||||
(if (cpad-pressed? 0 right)
|
||||
(+! (-> lst selection) 5))
|
||||
(if (cpad-pressed? 0 up)
|
||||
(-! (-> lst selection) 1))
|
||||
(if (cpad-pressed? 0 left)
|
||||
(-! (-> lst selection) 5))
|
||||
(if (< (-> lst selection) 0)
|
||||
(set! (-> lst selection) (1- (atx-list-size lst))))
|
||||
(if (>= (-> lst selection) (atx-list-size lst))
|
||||
(set! (-> lst selection) 0))
|
||||
(if (cpad-pressed? 0 x)
|
||||
((-> lst func) (atx-list-get-by-index lst (-> lst selection)))
|
||||
)
|
||||
|
||||
(when (< 16 (+ (-> lst selection) (-> lst offset)))
|
||||
(set! (-> lst offset) (- 16 (-> lst selection)))
|
||||
)
|
||||
(when (< (+ (-> lst selection) (-> lst offset)) 0)
|
||||
(set! (-> lst offset) (- 0 (-> lst selection)))
|
||||
)
|
||||
)
|
||||
0)
|
||||
|
||||
|
||||
(defbehavior atx-list-art-group-func anim-tester-x ((item atx-item-art-group))
|
||||
|
||||
(if (not (and (type-type? (-> item type) atx-item-art-group)
|
||||
(-> item group)
|
||||
(-> item ja-list head)
|
||||
(-> item jg-list head)
|
||||
(-> item mg-list head)
|
||||
))
|
||||
(return #f))
|
||||
|
||||
(set! (-> self selected-art-group) item)
|
||||
(set! (-> self edit-mode) (atx-edit-mode anim))
|
||||
(set! (-> self cur-art-group) (-> item group))
|
||||
(set! (-> self cur-joint-anim) (-> item ja-list head janim))
|
||||
(set! (-> self cur-joint-geo) (-> item jg-list head jgeo))
|
||||
(set! (-> self cur-mesh-geo) (-> item mg-list head mgeo))
|
||||
(ja-no-eval :frame-num 0.0)
|
||||
0)
|
||||
|
||||
(defbehavior atx-list-joint-anim-func anim-tester-x ((item atx-item))
|
||||
|
||||
(if (not (-> item janim))
|
||||
(return #f))
|
||||
(set! (-> self cur-joint-anim) (-> item janim))
|
||||
(ja-no-eval :frame-num 0.0)
|
||||
0)
|
||||
(defbehavior atx-list-joint-geo-func anim-tester-x ((item atx-item))
|
||||
|
||||
(if (not (-> item janim))
|
||||
(return #f))
|
||||
(set! (-> self cur-joint-geo) (-> item jgeo))
|
||||
0)
|
||||
(defbehavior atx-list-mesh-geo-func anim-tester-x ((item atx-item))
|
||||
|
||||
(if (not (-> item janim))
|
||||
(return #f))
|
||||
(set! (-> self cur-mesh-geo) (-> item mgeo))
|
||||
0)
|
||||
|
||||
|
||||
|
||||
(defmethod new atx-item-art-group ((allocation symbol) (type-to-make type) (text string) (ag art-group))
|
||||
"make a new atx-item"
|
||||
|
||||
(let ((obj (object-new allocation type-to-make (the int (-> type-to-make size)))))
|
||||
(set! (-> obj next) #f)
|
||||
(set! (-> obj text) text)
|
||||
(set! (-> obj group) ag)
|
||||
|
||||
(atx-list-init! (-> obj ja-list))
|
||||
(atx-list-init! (-> obj jg-list))
|
||||
(atx-list-init! (-> obj mg-list))
|
||||
(set! (-> obj ja-list func) atx-list-joint-anim-func)
|
||||
(set! (-> obj jg-list func) atx-list-joint-geo-func)
|
||||
(set! (-> obj mg-list func) atx-list-mesh-geo-func)
|
||||
|
||||
obj)
|
||||
)
|
||||
|
||||
|
||||
|
||||
;;;----------------------------------------------
|
||||
;; globals
|
||||
;;;----------------------------------------------
|
||||
|
||||
;; initialize the lists in the static defs
|
||||
(atx-list-init! (-> *ATX-settings* list-ctrl))
|
||||
(set! (-> *ATX-settings* list-ctrl func) atx-list-art-group-func)
|
||||
|
||||
;; the actual process.
|
||||
(define-perm *atx* (pointer anim-tester-x) #f)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; states
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
|
||||
(defbehavior anim-tester-x-reset anim-tester-x ()
|
||||
"reset the anim tester to default settings"
|
||||
|
||||
(format #t "resetting anim tester~%")
|
||||
(set! (-> self edit-mode) (atx-edit-mode none))
|
||||
(set! (-> self selected-art-group) #f)
|
||||
(set! (-> self cur-art-group) #f)
|
||||
(set! (-> self cur-joint-anim) #f)
|
||||
(set! (-> self cur-joint-geo) #f)
|
||||
(set! (-> self cur-mesh-geo) #f)
|
||||
0)
|
||||
|
||||
|
||||
(defbehavior clean-art-groups anim-tester-x ()
|
||||
"purge possible invalid art groups automatically."
|
||||
(do-atx-list (it (-> *ATX-settings* list-ctrl))
|
||||
(when (!= (-> it group type) art-group)
|
||||
(when (= it (-> self selected-art-group))
|
||||
(anim-tester-x-reset)
|
||||
)
|
||||
(atx-list-remove (-> *ATX-settings* list-ctrl) it)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defbehavior anim-tester-x-interface anim-tester-x ()
|
||||
"UI controls for anim tester"
|
||||
|
||||
(set! (-> *debug-menu-context* is-hidden) #t)
|
||||
(set! (-> self cur-list) #f)
|
||||
|
||||
(case (-> self edit-mode)
|
||||
(((atx-edit-mode none))
|
||||
(set! (-> *debug-menu-context* is-hidden) #f))
|
||||
(((atx-edit-mode art-group))
|
||||
(set! (-> self cur-list) (-> *ATX-settings* list-ctrl))
|
||||
(atx-list-interface (-> self cur-list) "---- pick art group ----" "Add an art group with atx-add-group" (-> self cur-art-group))
|
||||
(atx-interface-square-to-menu)
|
||||
)
|
||||
(((atx-edit-mode anim))
|
||||
(set! (-> self cur-list) (-> self selected-art-group ja-list))
|
||||
(atx-list-interface (-> self cur-list) "---- pick anim ----" "" (-> self cur-joint-anim))
|
||||
(atx-interface-square-to-menu)
|
||||
)
|
||||
(((atx-edit-mode jgeo))
|
||||
(set! (-> self cur-list) (-> self selected-art-group jg-list))
|
||||
(atx-list-interface (-> self cur-list) "---- pick skeleton ----" "" (-> self cur-joint-geo))
|
||||
(atx-interface-square-to-menu)
|
||||
)
|
||||
(((atx-edit-mode mgeo))
|
||||
(set! (-> self cur-list) (-> self selected-art-group mg-list))
|
||||
(atx-list-interface (-> self cur-list) "---- pick mesh ----" "" (-> self cur-mesh-geo))
|
||||
(atx-interface-square-to-menu)
|
||||
)
|
||||
)
|
||||
|
||||
0)
|
||||
|
||||
|
||||
(defstate anim-tester-x-process (anim-tester-x)
|
||||
|
||||
:trans (behavior ()
|
||||
(clean-art-groups)
|
||||
|
||||
(if (= *master-mode* 'menu)
|
||||
(anim-tester-x-interface)
|
||||
(set! *camera-read-buttons* #t)
|
||||
)
|
||||
(when (!= *master-mode* 'menu)
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf) (-> self root trans) *color-white*)
|
||||
)
|
||||
(none))
|
||||
|
||||
:code (behavior ()
|
||||
|
||||
(loop
|
||||
|
||||
(when (and (-> self cur-joint-geo) (!= (-> self cur-joint-geo) (-> self draw jgeo)))
|
||||
(process-disconnect self)
|
||||
(set! (-> self draw art-group) (-> self cur-art-group))
|
||||
(set! (-> self draw cur-lod) -1)
|
||||
(set! (-> self draw jgeo) (-> self cur-joint-geo))
|
||||
(set! (-> self draw sink-group) (-> *level* level-default foreground-sink-group 1))
|
||||
(set! (-> self draw lod-set lod 0 geo) (-> self cur-mesh-geo))
|
||||
(set! (-> self draw lod-set lod 0 dist) (meters 999999))
|
||||
(set! (-> self draw bounds w) (meters 10))
|
||||
(set! (-> self draw data-format) (the-as uint 1))
|
||||
(vector-copy! (-> self draw color-mult) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0))
|
||||
(vector-copy! (-> self draw color-emissive) (new 'static 'vector))
|
||||
(set! (-> self draw secondary-interp) 0.0)
|
||||
(set! (-> self draw shadow) #f)
|
||||
(set! (-> self draw shadow-ctrl) #f)
|
||||
(set! (-> self draw ripple) #f)
|
||||
(set! (-> self draw level-index) (the-as uint 2))
|
||||
(set! (-> self node-list) (make-nodes-from-jg (-> self draw jgeo) *default-skel-template* 'debug))
|
||||
(if (not (-> self skel effect))
|
||||
(set! (-> self skel effect) (new 'process 'effect-control self)))
|
||||
(fill-skeleton-cache self)
|
||||
(lod-set! (-> self draw) 0)
|
||||
(ja-channel-set! 0)
|
||||
)
|
||||
|
||||
(cond
|
||||
((-> self cur-joint-geo)
|
||||
(if (> 1 (-> self skel active-channels))
|
||||
(ja-channel-set! 1))
|
||||
(set! (-> self draw lod-set lod 0 geo) (-> self cur-mesh-geo))
|
||||
(ja-no-eval :group! (-> self cur-joint-anim))
|
||||
(when (!= *master-mode* 'menu)
|
||||
(case (-> *ATX-settings* mode)
|
||||
(('loop)
|
||||
(ja :num! (loop! (-> *ATX-settings* speed)))
|
||||
)
|
||||
(('identity)
|
||||
(ja :num! (identity (-> *ATX-settings* frame-num)))
|
||||
)
|
||||
(('seek)
|
||||
(ja :num! (seek! max (-> *ATX-settings* speed)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(TODO-RENAME-9 (-> self align))
|
||||
(TODO-RENAME-10 (-> self align) 31 1.0 1.0 1.0)
|
||||
)
|
||||
(else
|
||||
(if (!= *master-mode* 'menu)
|
||||
(format *stdcon* "~%~%no art selected~%")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(suspend))
|
||||
)
|
||||
|
||||
:post (behavior ()
|
||||
(when (-> self cur-joint-geo)
|
||||
(ja-post)
|
||||
(when (!= *master-mode* 'menu)
|
||||
(when (logtest? (-> *ATX-settings* flags) (atx-flags show-joints))
|
||||
(draw-joint-spheres self)
|
||||
)
|
||||
(format *stdcon* "~%~%")
|
||||
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; helper functions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defbehavior anim-tester-x-init-by-other anim-tester-x ()
|
||||
"external initializer for anim-tester-x process"
|
||||
|
||||
(logclear! (-> self mask) (process-mask menu))
|
||||
(set! (-> self root) (new 'process 'trsqv))
|
||||
(set! (-> self draw) (new 'process 'draw-control self (the art-joint-geo #f)))
|
||||
(set! (-> self draw dma-add-func) dma-add-process-drawable)
|
||||
(set! (-> self skel) (new 'process 'joint-control 24)) ;; allocate 24 anim channels
|
||||
(set! (-> self align) (new 'process 'align-control self))
|
||||
(quaternion-identity! (-> self root quat))
|
||||
(vector-identity! (-> self root scale))
|
||||
(position-in-front-of-camera! (-> self root trans) (meters 10) (meters 1))
|
||||
(anim-tester-x-reset)
|
||||
(go anim-tester-x-process)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
(defun atx-stop ()
|
||||
"kill the anim tester process"
|
||||
|
||||
(kill-by-type anim-tester-x *default-pool*)
|
||||
(set! *atx* (the (pointer anim-tester-x) #f)))
|
||||
|
||||
(defun atx-start ()
|
||||
"start the anim tester process"
|
||||
|
||||
(when *atx*
|
||||
(atx-stop)
|
||||
)
|
||||
|
||||
(if *target*
|
||||
(stop 'play))
|
||||
(set! *atx* (process-new anim-tester-x anim-tester-x-init-by-other
|
||||
:from *pc-dead-pool*
|
||||
:stack-size (* 8 1024)))
|
||||
(set! *camera-orbit-target* *atx*)
|
||||
(send-event *camera* 'change-state cam-free-floating 0)
|
||||
)
|
||||
|
||||
|
||||
(defun atx-add-new-art-group ((ag art-group))
|
||||
|
||||
(let ((ag-item (the atx-item-art-group (atx-list-append (-> *ATX-settings* list-ctrl)
|
||||
(new 'debug 'atx-item-art-group (-> ag name) ag)))))
|
||||
(dotimes (i (-> ag length))
|
||||
(when (-> ag data i)
|
||||
(case (-> ag data i type)
|
||||
((art-joint-geo) (atx-list-append (-> ag-item jg-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
((merc-ctrl) (atx-list-append (-> ag-item mg-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
((art-joint-anim) (atx-list-append (-> ag-item ja-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
)
|
||||
)
|
||||
)
|
||||
ag-item)
|
||||
)
|
||||
|
||||
(defun atx-add-group ((name string) (level-name symbol))
|
||||
|
||||
(protect ((-> *level* log-in-level-bsp))
|
||||
(set! (-> *level* log-in-level-bsp) (aif (level-get *level* level-name) (-> it bsp)))
|
||||
(let ((ag (load-to-heap-by-name (-> *level* level-default art-group) name #t debug 0)))
|
||||
(cond
|
||||
(ag
|
||||
(if (not *atx*) (atx-start))
|
||||
|
||||
(atx-add-new-art-group ag)
|
||||
)
|
||||
(else
|
||||
(format #t "ERROR: no art-group ~A~%" name)
|
||||
)
|
||||
)
|
||||
))
|
||||
0)
|
||||
|
||||
(defun atx-append-group ((append-to string) (name string) (level-name symbol))
|
||||
|
||||
(protect ((-> *level* log-in-level-bsp))
|
||||
(set! (-> *level* log-in-level-bsp) (aif (level-get *level* level-name) (-> it bsp)))
|
||||
(let ((ag (load-to-heap-by-name (-> *level* level-default art-group) name #t debug 0)))
|
||||
(cond
|
||||
(ag
|
||||
(if (not *atx*) (atx-start))
|
||||
|
||||
(let ((ag-item (the atx-item-art-group (atx-list-get-by-name (-> *ATX-settings* list-ctrl) append-to))))
|
||||
(when (not ag-item)
|
||||
(format #t "ERROR: art-group ~A not loaded~%" append-to)
|
||||
(return #f)
|
||||
)
|
||||
(dotimes (i (-> ag length))
|
||||
(when (-> ag data i)
|
||||
(case (-> ag data i type)
|
||||
((art-joint-geo) (atx-list-append (-> ag-item jg-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
((merc-ctrl) (atx-list-append (-> ag-item mg-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
((art-joint-anim) (atx-list-append (-> ag-item ja-list) (new 'debug 'atx-item (-> ag name) (-> ag data i))))
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
(else
|
||||
(format #t "ERROR: no art-group ~A~%" name)
|
||||
)
|
||||
)
|
||||
))
|
||||
0)
|
||||
|
||||
(defun atx-add-level-group ()
|
||||
|
||||
(if (not *atx*) (atx-start))
|
||||
|
||||
(do-atx-list (item (-> *ATX-settings* list-ctrl))
|
||||
(if (or (and (>= (-> item group) (-> *level* level 0 heap base)) (< (-> item group) (-> *level* level 0 heap top)))
|
||||
(and (>= (-> item group) (-> *level* level 1 heap base)) (< (-> item group) (-> *level* level 1 heap top))))
|
||||
(atx-list-remove (-> *ATX-settings* list-ctrl) item)
|
||||
)
|
||||
)
|
||||
(dotimes (i 2)
|
||||
(doarray (ag (-> *level* level i art-group data-array))
|
||||
(atx-add-new-art-group (the art-group ag))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun atx-add-common-group ()
|
||||
|
||||
(if (not *atx*) (atx-start))
|
||||
(doarray (ag (-> *level* level 2 art-group data-array))
|
||||
(atx-add-new-art-group (the art-group ag))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -806,3 +806,15 @@
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; process pools
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;; the actor pool for PC processes! it has space for 2 processes, with 16K of space.
|
||||
(defconstant PC_PROC_DEFAULT_STACK_SIZE 1024)
|
||||
(define *pc-dead-pool* (new 'global 'dead-pool 2 (* 16 1024) '*pc-dead-pool*))
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -158,9 +158,7 @@
|
||||
;;;----------------------------------------------
|
||||
|
||||
|
||||
;; the actor pool for PC processes! it has 1K of space for 1 process.
|
||||
(define *pc-dead-pool* (new 'global 'dead-pool 1 (* 1 1024) '*pc-dead-pool*))
|
||||
(define *subtitle-temp-string* (new 'global 'string 16 (the string #f)))
|
||||
;; the subtitle process.
|
||||
(define *subtitle* (the (pointer subtitle) #f))
|
||||
|
||||
;; subtitle text data
|
||||
@ -791,11 +789,11 @@
|
||||
|
||||
(set! *subtitle* (process-new subtitle subtitle-init-by-other
|
||||
:from *pc-dead-pool* :to *display-pool*
|
||||
:stack-size (* 1 1024)))
|
||||
:stack-size PC_PROC_DEFAULT_STACK_SIZE))
|
||||
)
|
||||
|
||||
|
||||
;; start the subtitle process
|
||||
;; start the subtitle process when this file loads.
|
||||
(subtitle-start)
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ int main(int argc, char** argv) {
|
||||
ts.seek_past_whitespace_and_comments();
|
||||
std::string found_username;
|
||||
while (ts.text_remains()) {
|
||||
auto character = std::string(1, ts.read());
|
||||
auto character = std::string(1, ts.peek());
|
||||
if (!std::regex_match(character, allowed_chars)) {
|
||||
break;
|
||||
}
|
||||
|
2
test/decompiler/reference/engine/camera/cam-combiner_REF.gc
generated
vendored
2
test/decompiler/reference/engine/camera/cam-combiner_REF.gc
generated
vendored
@ -313,7 +313,7 @@
|
||||
)
|
||||
)
|
||||
((and (< 16384.0 f28-1) (< (vector-dot (-> self flip-control-axis) s4-1) 0.0))
|
||||
(set! (-> *camera* master-options) (logxor (-> *camera* master-options) 16))
|
||||
(logxor! (-> *camera* master-options) 16)
|
||||
)
|
||||
)
|
||||
(set! (-> self flip-control-axis quad) (-> s4-1 quad))
|
||||
|
2
test/decompiler/reference/engine/debug/anim-tester_REF.gc
generated
vendored
2
test/decompiler/reference/engine/debug/anim-tester_REF.gc
generated
vendored
@ -1732,7 +1732,7 @@
|
||||
;; Used lq/sq
|
||||
(defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control))
|
||||
(local-vars
|
||||
(sv-192 (function string dma-buffer int int font-color font-flags none))
|
||||
(sv-192 (function string dma-buffer int int font-color font-flags float))
|
||||
(sv-208 (function _varargs_ object))
|
||||
)
|
||||
(let ((gp-0 (-> arg1 the-node))
|
||||
|
14
test/decompiler/reference/engine/debug/default-menu_REF.gc
generated
vendored
14
test/decompiler/reference/engine/debug/default-menu_REF.gc
generated
vendored
@ -53,10 +53,10 @@
|
||||
(send-event *camera* 'reset-root)
|
||||
)
|
||||
((= arg0 9)
|
||||
(set! (-> *camera* master-options) (logxor (-> *camera* master-options) 1))
|
||||
(logxor! (-> *camera* master-options) 1)
|
||||
)
|
||||
((= arg0 10)
|
||||
(set! (-> *camera* master-options) (logxor (-> *camera* master-options) 4))
|
||||
(logxor! (-> *camera* master-options) 4)
|
||||
)
|
||||
((= arg0 11)
|
||||
(send-event *camera* 'toggle-slave-option 32)
|
||||
@ -491,7 +491,7 @@
|
||||
(let ((v1-0 (find-instance-by-name *edit-instance*)))
|
||||
(when v1-0
|
||||
(if (= arg1 (debug-menu-msg press))
|
||||
(set! (-> v1-0 flags) (logxor (-> v1-0 flags) (the-as uint arg0)))
|
||||
(logxor! (-> v1-0 flags) (the-as uint arg0))
|
||||
)
|
||||
(logtest? (-> v1-0 flags) arg0)
|
||||
)
|
||||
@ -597,7 +597,7 @@
|
||||
(cond
|
||||
(v1-0
|
||||
(if (= arg1 (debug-menu-msg press))
|
||||
(set! (-> v1-0 flags) (logxor (-> v1-0 flags) 1))
|
||||
(logxor! (-> v1-0 flags) 1)
|
||||
)
|
||||
(zero? (logand (-> v1-0 flags) 1))
|
||||
)
|
||||
@ -3347,13 +3347,13 @@
|
||||
(case arg0
|
||||
(('at-apply-align)
|
||||
(if (= arg1 (debug-menu-msg press))
|
||||
(set! (-> *anim-tester* 0 flags) (logxor (-> *anim-tester* 0 flags) (anim-tester-flags fanimt5)))
|
||||
(logxor! (-> *anim-tester* 0 flags) (anim-tester-flags fanimt5))
|
||||
)
|
||||
(return (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt5)))
|
||||
)
|
||||
(('at-show-joint-info)
|
||||
(if (= arg1 (debug-menu-msg press))
|
||||
(set! (-> *anim-tester* 0 flags) (logxor (-> *anim-tester* 0 flags) (anim-tester-flags fanimt4)))
|
||||
(logxor! (-> *anim-tester* 0 flags) (anim-tester-flags fanimt4))
|
||||
)
|
||||
(return (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt4)))
|
||||
)
|
||||
@ -3830,7 +3830,7 @@
|
||||
(lambda ((arg0 int) (arg1 debug-menu-msg))
|
||||
(when (= arg1 (debug-menu-msg press))
|
||||
(if *target*
|
||||
(set! (-> *target* state-flags) (logxor (-> *target* state-flags) (state-flags sf04)))
|
||||
(logxor! (-> *target* state-flags) (state-flags sf04))
|
||||
)
|
||||
)
|
||||
(the-as symbol (and *target* (logtest? (-> *target* state-flags) (state-flags sf04))))
|
||||
|
2
test/decompiler/reference/engine/gfx/font_REF.gc
generated
vendored
2
test/decompiler/reference/engine/gfx/font_REF.gc
generated
vendored
@ -557,12 +557,10 @@
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
|
||||
;; definition for function draw-string-xy
|
||||
;; INFO: Return type mismatch float vs none.
|
||||
(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 font-flags))
|
||||
(let ((a2-2 (new 'stack 'font-context *font-default-matrix* arg2 arg3 0.0 arg4 arg5)))
|
||||
(draw-string arg0 arg1 a2-2)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function draw-string-adv
|
||||
|
4
test/decompiler/reference/engine/sparticle/sparticle_REF.gc
generated
vendored
4
test/decompiler/reference/engine/sparticle/sparticle_REF.gc
generated
vendored
@ -241,9 +241,7 @@
|
||||
)
|
||||
)
|
||||
(let ((t0-5 (+ t0-4 a2-8)))
|
||||
(set! (-> arg0 alloc-table (+ v1-0 a3-0))
|
||||
(logxor (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8)))
|
||||
)
|
||||
(logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8)))
|
||||
(+! (-> arg0 num-alloc arg1) 1)
|
||||
(let ((v1-9 (-> arg0 cpuinfo-table t0-5)))
|
||||
(set! (-> v1-9 valid) #t)
|
||||
|
2
test/decompiler/reference/levels/maincave/mother-spider_REF.gc
generated
vendored
2
test/decompiler/reference/levels/maincave/mother-spider_REF.gc
generated
vendored
@ -623,7 +623,7 @@
|
||||
(when (logtest? s4-1 1)
|
||||
(cond
|
||||
((>= (+ (-> *display* base-frame-counter) (seconds -1)) (-> obj leg-socket-part-time s3-0))
|
||||
(set! (-> obj leg-socket-part-mask) (logxor (-> obj leg-socket-part-mask) (ash 1 s3-0)))
|
||||
(logxor! (-> obj leg-socket-part-mask) (ash 1 s3-0))
|
||||
)
|
||||
(else
|
||||
(let ((v1-20 (-> *mother-spider-leg-infos* s3-0))
|
||||
|
2
test/decompiler/reference/levels/sunken/qbert-plat_REF.gc
generated
vendored
2
test/decompiler/reference/levels/sunken/qbert-plat_REF.gc
generated
vendored
@ -462,7 +462,7 @@
|
||||
(set! (-> self last-plat-triggered) (the-as int v1-2))
|
||||
(let ((s5-1 (= (-> self plat-states-needed-to-open-door) (-> self plat-states))))
|
||||
(let ((v1-3 (ash 1 v1-2)))
|
||||
(set! (-> self plat-states) (logxor (-> self plat-states) (the-as uint v1-3)))
|
||||
(logxor! (-> self plat-states) (the-as uint v1-3))
|
||||
(if (zero? (logand v1-3 (-> self plat-states)))
|
||||
(level-hint-spawn
|
||||
(game-text-id sunken-qbert-plat-hint)
|
||||
|
Loading…
x
Reference in New Issue
Block a user