mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 22:22:21 -04:00
jak3: port anim-tester-x (#3830)
This commit is contained in:
@@ -295,6 +295,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
|
||||
{"defun-debug", new_flow_rule(3)},
|
||||
{"defbehavior", new_flow_rule(4)},
|
||||
{"if", new_inlineable_flow_rule(2)},
|
||||
{"aif", new_inlineable_flow_rule(2)},
|
||||
{"#if", new_inlineable_flow_rule(2)},
|
||||
{"define", new_permissive_flow_rule()},
|
||||
{"def-mips2c", new_permissive_flow_rule()},
|
||||
@@ -305,10 +306,14 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
|
||||
{"declare-type", new_permissive_flow_rule()},
|
||||
{"defmacro", new_function_rule(3)},
|
||||
{"desfun", new_function_rule(3)},
|
||||
{"def-actor", new_flow_rule(2, true)},
|
||||
{"defskelgroup", new_flow_rule(2, true)},
|
||||
{"defpartgroup", new_flow_rule(2, true)},
|
||||
{"defpart", new_flow_rule(2, true)},
|
||||
{"defstate", new_defstate_rule(3, true)},
|
||||
{"defevent", new_flow_rule(2)},
|
||||
{"event", new_flow_rule(1)},
|
||||
{"defpost", new_flow_rule(2)},
|
||||
{"behavior", new_flow_rule(2)},
|
||||
{"dotimes", new_flow_rule(2)},
|
||||
{"dolist", new_flow_rule(2)},
|
||||
@@ -319,6 +324,7 @@ const std::unordered_map<std::string, FormFormattingConfig> opengoal_form_config
|
||||
{"rlet", new_binding_rule(5)},
|
||||
{"mlet", new_binding_rule(5)},
|
||||
{"when", new_flow_rule(2)},
|
||||
{"awhen", new_flow_rule(2)},
|
||||
{"unless", new_flow_rule(2)},
|
||||
{"with-profiler", new_flow_rule(2)},
|
||||
{"with-pc", new_flow_rule(0)},
|
||||
|
||||
@@ -511,7 +511,7 @@ void IsoQueueVagStream(ISO_VAGCommand* user_cmd) {
|
||||
if (!internal_stereo_cmd) {
|
||||
// allocating stereo failed, give up.
|
||||
internal_cmd->flags.scanned = 0;
|
||||
ASSERT_NOT_REACHED();
|
||||
// ASSERT_NOT_REACHED();
|
||||
ReleaseMessage(internal_cmd);
|
||||
RemoveVagCmd(internal_cmd);
|
||||
FreeVagCmd(internal_cmd);
|
||||
|
||||
@@ -255,7 +255,7 @@ s32 Grain::snd_SFX_GRAIN_TYPE_STOP(BlockSoundHandler& handler) {
|
||||
}
|
||||
|
||||
s32 Grain::snd_SFX_GRAIN_TYPE_RAND_PLAY(BlockSoundHandler& handler) {
|
||||
auto cp = std::get<ControlParams>(data);
|
||||
auto& cp = std::get<ControlParams>(data);
|
||||
auto options = cp.param[0];
|
||||
auto count = cp.param[1];
|
||||
auto& previous = cp.param[2];
|
||||
|
||||
@@ -311,6 +311,27 @@
|
||||
;; define skel group
|
||||
(define ,name skel)))
|
||||
|
||||
(defmacro def-actor (name &key (idle #f) &key (lods #f) &key (art (idle-ja)) &key (joints ()) &key (shadow 0) &key bounds &key (longest-edge 0.0) &key (texture-level 0) &key (sort 0))
|
||||
`(begin
|
||||
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-jg" name) 0)
|
||||
(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-lod0-mg" name) 1)
|
||||
,@(apply-i (lambda (x i)
|
||||
`(def-art-elt ,(string->symbol-format "{}-ag" name) ,(string->symbol-format "{}-{}" name x) ,(+ i 2)))
|
||||
art)
|
||||
,@(apply-i (lambda (x i) `(def-joint-node ,(string->symbol-format "{}-lod0-jg" name) ,(symbol->string x) ,(1+ i))) joints)
|
||||
(defskelgroup ,(string->symbol-format "*{}-sg*" name)
|
||||
,name
|
||||
,(string->symbol-format "{}-lod0-jg" name)
|
||||
,(if idle (string->symbol-format "{}-{}" name idle) (string->symbol-format "{}-{}" name (car art)))
|
||||
,(if lods
|
||||
`(,@(apply (lambda (x) `(,(string->symbol-format "{}-{}-mg" name (car x)) (meters ,(cadr x)))) lods))
|
||||
`((,(string->symbol-format "{}-lod0-mg" name) (meters 999999))))
|
||||
:shadow ,shadow
|
||||
:bounds (static-spherem ,@bounds)
|
||||
:longest-edge ,longest-edge
|
||||
:texture-level ,texture-level
|
||||
:sort ,sort)))
|
||||
|
||||
(import "goal_src/jak1/engine/data/art-elts.gc")
|
||||
|
||||
(import "goal_src/jak1/engine/data/joint-nodes.gc")
|
||||
|
||||
@@ -724,7 +724,7 @@
|
||||
(set! sv-24 f28-0))
|
||||
(logclear! (-> self skel status) (janim-status spool)))
|
||||
(else
|
||||
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~" self (-> arg0 name) spool-part)
|
||||
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part)
|
||||
(goto cfg-88))))
|
||||
(set! spool-part (+ spool-part 1)))
|
||||
(set! spool-part (+ spool-part -1))
|
||||
|
||||
@@ -8,20 +8,12 @@
|
||||
(bob-offset int64)
|
||||
(bob-amount float))
|
||||
(:methods
|
||||
(init-collision! (_type_) none))
|
||||
(init-collision! (_type_) object))
|
||||
(:state-methods
|
||||
idle))
|
||||
|
||||
(def-art-elt test-actor-ag test-actor-lod0-jg 0)
|
||||
(def-art-elt test-actor-ag test-actor-lod0-mg 1)
|
||||
(def-art-elt test-actor-ag test-actor-idle-ja 2)
|
||||
(defskelgroup *test-actor-sg*
|
||||
test-actor
|
||||
test-actor-lod0-jg
|
||||
test-actor-idle-ja
|
||||
((test-actor-lod0-mg (meters 9999999)))
|
||||
:bounds (static-spherem 0 0 0 5)
|
||||
:texture-level 2)
|
||||
(def-actor test-actor
|
||||
:bounds (0 0 0 5))
|
||||
|
||||
(defmethod init-collision! ((this test-actor))
|
||||
(let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
||||
@@ -54,8 +46,7 @@
|
||||
)
|
||||
(set! (-> cshape nav-radius) (* 0.75 (-> cshape root-prim local-sphere w)))
|
||||
(backup-collide-with-as cshape)
|
||||
(set! (-> this root) cshape))
|
||||
(none))
|
||||
(set! (-> this root) cshape)))
|
||||
|
||||
(defmethod init-from-entity! ((this test-actor) (e entity-actor))
|
||||
(logior! (-> this mask) (process-mask enemy))
|
||||
|
||||
@@ -418,6 +418,7 @@
|
||||
"visvol-edit.o"
|
||||
"collision-editor.o"
|
||||
"speech-manager.o"
|
||||
"anim-tester-x.o" ;; added
|
||||
"vag-player.o" ;; added
|
||||
"default-menu-pc.o" ;; added
|
||||
"dir-tpages.go"
|
||||
|
||||
@@ -1140,6 +1140,22 @@
|
||||
this
|
||||
)
|
||||
|
||||
(defmethod inspect ((this art-group))
|
||||
"Print all elements in an art-group."
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tinfo: ~A~%" (-> this info))
|
||||
(format #t "~Tlength: ~D~%" (-> this length))
|
||||
(format #t "~Tname: ~A~%" (-> this name))
|
||||
(if (-> this extra)
|
||||
(format #t "~Textra: ~I" (-> this extra))
|
||||
(format #t "~Textra: ~A~%" (-> this extra)))
|
||||
(format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data))
|
||||
(dotimes (i (-> this length))
|
||||
(if (-> this data i)
|
||||
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) (mem-size (-> this data i) #f 0))
|
||||
(format #t "~T [~D] ~A (~D bytes)~%" i (-> this data i) 0)))
|
||||
this)
|
||||
|
||||
(defmethod art-method-10 ((this art-group))
|
||||
(dotimes (s5-0 (-> this length))
|
||||
(if (-> this data s5-0)
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
;; name in dgo: memory-usage-h
|
||||
;; dgos: GAME
|
||||
|
||||
(define-extern mem-size (function basic symbol int int))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
;; this file is debug only
|
||||
|
||||
@@ -246,8 +246,16 @@ directly implemented by the OpenGOAL compiler
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(defmacro format-vf (&key (iter 0) &key (buf 0) &key (v (new-stack-vector0)) &rest regs)
|
||||
(with-gensyms (vec)
|
||||
`(let ((,vec ,v))
|
||||
,@(apply (lambda (reg)
|
||||
`(begin
|
||||
(.svf (&-> ,vec quad) ,reg)
|
||||
(format ,buf "[~D] ~A: ~f ~f ~f ~f~%" ,iter (quote ,reg) (-> ,vec x) (-> ,vec y) (-> ,vec z) (-> ,vec w))))
|
||||
regs)
|
||||
(1+! ,iter)
|
||||
,vec)))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
||||
@@ -0,0 +1,478 @@
|
||||
;;-*-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.
|
||||
|#
|
||||
|
||||
(declare-file (debug))
|
||||
|
||||
;;;------------------------
|
||||
;; settings
|
||||
;;;------------------------
|
||||
|
||||
(deftype atx-item (basic)
|
||||
((next atx-item :offset-assert 4)
|
||||
(text string)
|
||||
(extra art)
|
||||
(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 art) _type_)))
|
||||
|
||||
(defmethod new atx-item ((allocation symbol) (type-to-make type) (text string) (extra art))
|
||||
"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)
|
||||
(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)
|
||||
(cg-list atx-list :inline))
|
||||
(:methods
|
||||
(new (symbol type string art-group) _type_)))
|
||||
|
||||
;;;----------------------------------
|
||||
;; process
|
||||
;;;----------------------------------
|
||||
|
||||
(defenum atx-edit-mode
|
||||
:type uint8
|
||||
(none)
|
||||
(art-group)
|
||||
(anim)
|
||||
(mgeo)
|
||||
(jgeo)
|
||||
(cgeo))
|
||||
|
||||
(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)
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options 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 menu))
|
||||
(text-len (the draw-string-result 0)))
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf1))
|
||||
(when (nonzero? (length title))
|
||||
(set! text-len (draw-string-xy title buf 9 (+ 28 4 (* items-drawn 14)) (font-color menu) (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 green) (font-color menu)))
|
||||
(let ((this-len (draw-string-xy (-> item group name) buf 21 (+ 28 4 (* items-drawn 14)) 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 14)) color (font-flags shadow kerning)))
|
||||
(1+! items-drawn)
|
||||
(1+! i)))
|
||||
(when (not (-> lst head))
|
||||
(draw-string-xy warning buf 21 (+ 28 4 14) (font-color red) (font-flags shadow kerning))
|
||||
(1+! items-drawn)))
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-menu))
|
||||
(draw-sprite2d-xy buf
|
||||
6
|
||||
(+ 28 (* (-> lst offset) 14))
|
||||
(+ 6 14 14 (the int text-len))
|
||||
(+ 14 (* 14 (- items-drawn (-> lst offset))))
|
||||
(static-rgba 0 0 0 64)
|
||||
#x3fffff)))
|
||||
(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)
|
||||
; (-> item cg-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))
|
||||
(atx-list-init! (-> obj cg-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))
|
||||
(false! (-> self selected-art-group))
|
||||
(false! (-> self cur-art-group))
|
||||
(false! (-> self cur-joint-anim))
|
||||
(false! (-> self cur-joint-geo))
|
||||
(false! (-> self cur-mesh-geo))
|
||||
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)
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)))
|
||||
(when (!= *master-mode* 'menu)
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> self root trans) *color-white*)))
|
||||
:code
|
||||
(behavior ()
|
||||
(let ((need-update #f)
|
||||
(lst (the-as atx-list #f)))
|
||||
(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 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) (draw-control-data-format merc))
|
||||
(vector-copy! (-> self draw color-mult) (static-vector 1.0 1.0 1.0 1.0))
|
||||
(vector-copy! (-> self draw color-emissive) (static-vector 0. 0. 0. 0.))
|
||||
(false! (-> self draw shadow))
|
||||
(false! (-> self draw shadow-ctrl))
|
||||
(false! (-> self draw ripple))
|
||||
(set! (-> self draw level-index) (the uint 2))
|
||||
(set! (-> self node-list) (setup-cspace-and-add (-> self draw) (-> self draw jgeo) 'debug))
|
||||
(if (not (-> self skel effect)) (set! (-> self skel effect) (new 'process 'effect-control self)))
|
||||
(let ((skel (the skeleton-group (art-group-get-by-name *level* (string-format "skel-~S" (-> self cur-art-group name)) (the (pointer level) #f)))))
|
||||
(when skel
|
||||
(logior! (-> self draw global-effect) (-> skel global-effects))
|
||||
(when (-> skel clothing)
|
||||
(set! (-> self draw cloth-instances) (new 'process 'boxed-array cloth-on-skeleton (-> skel clothing length)))
|
||||
(set! (-> self draw cloth-instances length) (-> self draw cloth-instances allocated-length))
|
||||
(dotimes (i (-> skel clothing length))
|
||||
(set! (-> self draw cloth-instances i) (new 'process 'cloth-on-skeleton))
|
||||
(setup-from-params! (-> self draw cloth-instances i) (-> skel clothing i) (process->handle self))))))
|
||||
(lod-set! (-> self draw) 0)
|
||||
(ja-channel-set! 0)
|
||||
(set! lst (-> self selected-art-group ja-list)))
|
||||
(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))))))
|
||||
(compute-alignment! (-> self align))
|
||||
(align! (-> self align)
|
||||
(align-opts adjust-x-vel adjust-y-vel adjust-xz-vel keep-other-velocities adjust-quat)
|
||||
1.0
|
||||
1.0
|
||||
1.0))
|
||||
(else (if (!= *master-mode* 'menu) (format *stdcon* "~%~%no art selected~%"))))
|
||||
(when (and lst (-> lst head) (!= *master-mode* 'menu))
|
||||
(cond
|
||||
((cpad-pressed? 0 left) (cpad-clear! 0 left) (-! (-> lst selection) 1) (set! need-update #t))
|
||||
((cpad-pressed? 0 right) (cpad-clear! 0 right) (+! (-> lst selection) 1) (set! need-update #t)))
|
||||
(cond
|
||||
((< (-> lst selection) 0) (set! (-> lst selection) (1- (atx-list-size lst))))
|
||||
((>= (-> lst selection) (atx-list-size lst)) (set! (-> lst selection) 0)))
|
||||
(when need-update
|
||||
((-> lst func) (atx-list-get-by-index lst (-> lst selection)))
|
||||
(set! need-update #f)))
|
||||
(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 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 #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))
|
||||
|
||||
(defun atx-stop ()
|
||||
"kill the anim tester process"
|
||||
(kill-by-type anim-tester-x *active-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-spawn anim-tester-x :from *pc-dead-pool* :stack-size #x20000 :to *pc-pool*))
|
||||
;; (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 #f debug 0)))
|
||||
(format 0 "atx-add-group: ag ~A~%" ag)
|
||||
(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))
|
||||
(dotimes (i (-> *level* length))
|
||||
(when (and (>= (-> item group) (-> *level* level i heap base)) (< (-> item group) (-> *level* level i heap top)))
|
||||
(atx-list-remove (-> *ATX-settings* list-ctrl) item)
|
||||
(set! i (-> *level* length)))))
|
||||
(dotimes (i (-> *level* length))
|
||||
(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 (-> *level* length) art-group data-array)) (atx-add-new-art-group (the art-group ag))))
|
||||
@@ -482,95 +482,86 @@
|
||||
(= (-> *pc-settings* subtitle-speaker?) setting)
|
||||
)
|
||||
|
||||
;; (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-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-refresh ()
|
||||
;; (atx-start)
|
||||
;; (atx-list-init! (-> *ATX-settings* list-ctrl))
|
||||
;; (set! (-> *ATX-settings* list-ctrl func) atx-list-art-group-func)
|
||||
;; (atx-add-common-group)
|
||||
;; (atx-add-level-group)
|
||||
;; )
|
||||
(defun dm-anim-tester-x-refresh ()
|
||||
(atx-start)
|
||||
(atx-list-init! (-> *ATX-settings* list-ctrl))
|
||||
(set! (-> *ATX-settings* list-ctrl func) atx-list-art-group-func)
|
||||
(atx-add-common-group)
|
||||
(atx-add-level-group)
|
||||
)
|
||||
|
||||
;; (defun dm-anim-tester-x-func ((action symbol))
|
||||
;; (unless *atx*
|
||||
;; (atx-start))
|
||||
(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))
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
|
||||
)
|
||||
(('at-pick-joint-anim)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode anim))
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
|
||||
)
|
||||
)
|
||||
(('pick-mesh-geo)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode mgeo))
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
|
||||
)
|
||||
)
|
||||
(('pick-joint-geo)
|
||||
(when (-> *atx* 0 cur-art-group)
|
||||
(set! (-> *atx* 0 edit-mode) (atx-edit-mode jgeo))
|
||||
(logclear! (-> *camera* settings master-options) (cam-master-options 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)
|
||||
|
||||
;; (case action
|
||||
;; (('pick-art-group)
|
||||
;; (set! (-> *atx* 0 edit-mode) (atx-edit-mode art-group))
|
||||
;; ;; (false! *camera-read-buttons*)
|
||||
;; (logclear! (-> *camera* settings master-options) (cam-master-options 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*)
|
||||
;; (logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
|
||||
;; )
|
||||
;; )
|
||||
;; (('pick-mesh-geo)
|
||||
;; (when (-> *atx* 0 cur-art-group)
|
||||
;; (set! (-> *atx* 0 edit-mode) (atx-edit-mode mgeo))
|
||||
;; ;; (false! *camera-read-buttons*)
|
||||
;; (logclear! (-> *camera* settings master-options) (cam-master-options READ_BUTTONS))
|
||||
;; )
|
||||
;; )
|
||||
;; (('pick-joint-geo)
|
||||
;; (when (-> *atx* 0 cur-art-group)
|
||||
;; (set! (-> *atx* 0 edit-mode) (atx-edit-mode jgeo))
|
||||
;; ;; (false! *camera-read-buttons*)
|
||||
;; (logclear! (-> *camera* settings master-options) (cam-master-options 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 dm-anim-tester-x-speed-var-func (arg (msg debug-menu-msg) (newval float))
|
||||
(if (= msg (debug-menu-msg press))
|
||||
(set! (-> *ATX-settings* speed) newval)
|
||||
(-> *ATX-settings* speed)))
|
||||
|
||||
;; (defun dm-anim-tester-x-speed-var-func (arg (msg debug-menu-msg) (newval float))
|
||||
;; (if (= msg (debug-menu-msg press))
|
||||
;; (set! (-> *ATX-settings* speed) newval)
|
||||
;; (-> *ATX-settings* speed))
|
||||
;; )
|
||||
(defun dm-anim-tester-x-frame-num-var-func (arg (msg debug-menu-msg) (newval float))
|
||||
(if (= msg (debug-menu-msg press))
|
||||
(set! (-> *ATX-settings* frame-num) newval)
|
||||
(-> *ATX-settings* frame-num)))
|
||||
|
||||
;; (defun dm-anim-tester-x-frame-num-var-func (arg (msg debug-menu-msg) (newval float))
|
||||
;; (if (= msg (debug-menu-msg press))
|
||||
;; (set! (-> *ATX-settings* frame-num) newval)
|
||||
;; (-> *ATX-settings* frame-num))
|
||||
;; )
|
||||
|
||||
;; (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-anim-tester-x-speed-var-func 0.01 -10.0 10.0))
|
||||
;; (debug-menu-append-item menu (new-dm-var-float "Frame Num" (the int #f) dm-anim-tester-x-frame-num-var-func 0.1 0.0 99999.0))
|
||||
;; (debug-menu-append-item menu (new-dm-func "Refresh" #f dm-anim-tester-x-refresh))
|
||||
;; (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)
|
||||
;; )
|
||||
;; )
|
||||
(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-anim-tester-x-speed-var-func 0.01 -10.0 10.0))
|
||||
(debug-menu-append-item menu (new-dm-var-float "Frame Num" (the int #f) dm-anim-tester-x-frame-num-var-func 0.1 0.0 99999.0))
|
||||
(debug-menu-append-item menu (new-dm-func "Refresh" #f dm-anim-tester-x-refresh))
|
||||
(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-func "Pick Cloth" 'pick-cloth-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)))
|
||||
|
||||
;; (defun dm-music-player-func ((lst object))
|
||||
;; (kill-by-name 'dm-player *active-pool*)
|
||||
@@ -997,7 +988,7 @@
|
||||
|
||||
(debug-menu-append-item (debug-menu-find-from-template *debug-menu-context* '("Collision")) (debug-menu-make-collision-renderer-menu *debug-menu-context*))
|
||||
|
||||
;; (debug-menu-append-item (debug-menu-find-from-template *debug-menu-context* '("Artist")) (debug-menu-make-anim-tester-x-menu *debug-menu-context*))
|
||||
(debug-menu-append-item (debug-menu-find-from-template *debug-menu-context* '("Artist")) (debug-menu-make-anim-tester-x-menu *debug-menu-context*))
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -756,7 +756,7 @@
|
||||
|
||||
|
||||
;; the actor pool for PC processes! it has space for 4 processes, with 16K of space.
|
||||
(define *pc-dead-pool* (new 'global 'dead-pool 4 (* 16 1024) "*pc-dead-pool*"))
|
||||
(define *pc-dead-pool* (new 'global 'dead-pool 4 (* 128 1024) "*pc-dead-pool*"))
|
||||
(set! (-> *pc-pool* clock) (-> *display* base-clock))
|
||||
(+! (-> *display* base-clock ref-count) 1)
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<int>());
|
||||
}
|
||||
return std::make_unique<ResInt32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResInt32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"uint32",
|
||||
[](const std::string& name,
|
||||
@@ -127,7 +127,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<u32>());
|
||||
}
|
||||
return std::make_unique<ResUint32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResUint32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"enum-int32",
|
||||
[](const std::string& name,
|
||||
@@ -137,7 +137,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data = enum_from_json<s32>(json[i], dts);
|
||||
}
|
||||
return std::make_unique<ResInt32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResInt32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"enum-uint32",
|
||||
[](const std::string& name,
|
||||
@@ -147,7 +147,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data = enum_from_json<u32>(json[i], dts);
|
||||
}
|
||||
return std::make_unique<ResUint32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResUint32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
// special lumps
|
||||
{"eco-info",
|
||||
@@ -159,7 +159,7 @@ static std::unordered_map<std::string,
|
||||
data.push_back(static_cast<s32>(get_enum_val(json[1].get<std::string>(), dts)));
|
||||
// amount
|
||||
data.push_back(static_cast<s32>(get_enum_or_int(json[2], dts)));
|
||||
return std::make_unique<ResInt32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResInt32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"cell-info",
|
||||
[](const std::string& name,
|
||||
@@ -169,7 +169,7 @@ static std::unordered_map<std::string,
|
||||
// (pickup-type fuel-cell)
|
||||
data.push_back(6);
|
||||
data.push_back(static_cast<s32>(get_enum_or_int(json[1], dts)));
|
||||
return std::make_unique<ResInt32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResInt32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"buzzer-info",
|
||||
[](const std::string& name,
|
||||
@@ -181,7 +181,7 @@ static std::unordered_map<std::string,
|
||||
auto task = static_cast<s32>(get_enum_val(json[1].get<std::string>(), dts));
|
||||
auto buzzer = json[2].get<int>();
|
||||
data.push_back(task + (buzzer * (1 << 16)));
|
||||
return std::make_unique<ResInt32>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResInt32>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"water-height",
|
||||
[](const std::string& name,
|
||||
@@ -200,7 +200,7 @@ static std::unordered_map<std::string,
|
||||
if (json.size() >= 6) {
|
||||
data.push_back(json[5].get<float>() * METER_LENGTH);
|
||||
}
|
||||
return std::make_unique<ResFloat>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResFloat>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"symbol",
|
||||
[](const std::string& name,
|
||||
@@ -211,7 +211,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<std::string>());
|
||||
}
|
||||
return std::make_unique<ResSymbol>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResSymbol>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"type",
|
||||
[](const std::string& name,
|
||||
@@ -222,7 +222,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<std::string>());
|
||||
}
|
||||
return std::make_unique<ResType>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResType>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"string",
|
||||
[](const std::string& name,
|
||||
@@ -233,7 +233,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<std::string>());
|
||||
}
|
||||
return std::make_unique<ResString>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResString>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
// vectors
|
||||
{"vector",
|
||||
@@ -245,7 +245,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(vector_from_json(json[i]));
|
||||
}
|
||||
return std::make_unique<ResVector>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResVector>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"vector4m",
|
||||
[](const std::string& name,
|
||||
@@ -256,7 +256,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(vectorm4_from_json(json[i]));
|
||||
}
|
||||
return std::make_unique<ResVector>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResVector>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"vector3m",
|
||||
[](const std::string& name,
|
||||
@@ -267,7 +267,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(vectorm3_from_json(json[i]));
|
||||
}
|
||||
return std::make_unique<ResVector>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResVector>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"movie-pos",
|
||||
[](const std::string& name,
|
||||
@@ -278,7 +278,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(movie_pos_from_json(json[i]));
|
||||
}
|
||||
return std::make_unique<ResVector>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResVector>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"vector-vol",
|
||||
[](const std::string& name,
|
||||
@@ -289,7 +289,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(vector_vol_from_json(json[i]));
|
||||
}
|
||||
return std::make_unique<ResVector>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResVector>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
// floats
|
||||
{"float",
|
||||
@@ -301,7 +301,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<float>());
|
||||
}
|
||||
return std::make_unique<ResFloat>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResFloat>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"meters",
|
||||
[](const std::string& name,
|
||||
@@ -312,7 +312,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<float>() * METER_LENGTH);
|
||||
}
|
||||
return std::make_unique<ResFloat>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResFloat>(name, data, DEFAULT_RES_TIME);
|
||||
}},
|
||||
{"degrees", [](const std::string& name,
|
||||
const nlohmann::json& json,
|
||||
@@ -322,7 +322,7 @@ static std::unordered_map<std::string,
|
||||
for (size_t i = 1; i < json.size(); i++) {
|
||||
data.push_back(json[i].get<float>() * DEGREES_LENGTH);
|
||||
}
|
||||
return std::make_unique<ResFloat>(name, data, -1000000000.0000);
|
||||
return std::make_unique<ResFloat>(name, data, DEFAULT_RES_TIME);
|
||||
}}};
|
||||
|
||||
std::unique_ptr<Res> res_from_json_array(const std::string& name,
|
||||
|
||||
@@ -247,8 +247,8 @@ void Compiler::generate_field_description(const goos::Object& form,
|
||||
str_template += fmt::format("{}{}: #x~X~%", tabs, f.name());
|
||||
format_args.push_back(get_field_of_structure(type, reg, f.name(), env)->to_gpr(form, env));
|
||||
} else {
|
||||
// Otherwise, we havn't implemented it!
|
||||
str_template += fmt::format("{}{}: Undefined!~%", tabs, f.name());
|
||||
// Otherwise, we haven't implemented it!
|
||||
str_template += fmt::format("{}{}: Print not implemented!~%", tabs, f.name());
|
||||
}
|
||||
|
||||
compile_format_string(form, env, str_template, format_args);
|
||||
|
||||
Reference in New Issue
Block a user