mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 21:43:27 -04:00
formatter: bunch of updates to the formatter
This commit is contained in:
@@ -11,4 +11,40 @@ Separate Top Level
|
||||
|
||||
(println "test")
|
||||
|
||||
(println "test")
|
||||
(println "test")
|
||||
|
||||
===
|
||||
Consolidate Top Level
|
||||
===
|
||||
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
(require "engine/draw/drawable-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
|
||||
---
|
||||
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
(require "engine/draw/drawable-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
|
||||
===
|
||||
Consolidate Top Level - Ignore and space out comment
|
||||
===
|
||||
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
(require "engine/draw/drawable-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
|
||||
;; Some comment
|
||||
|
||||
---
|
||||
|
||||
(in-package goal)
|
||||
(bundles "ENGINE.CGO" "GAME.CGO")
|
||||
(require "engine/draw/drawable-h.gc")
|
||||
(require "kernel/gstate.gc")
|
||||
|
||||
;; Some comment
|
||||
@@ -105,7 +105,7 @@ Block Comment - Allow Annotations
|
||||
(println "test")
|
||||
|
||||
===
|
||||
Block Comment - In Form - TODO Improve
|
||||
Block Comment - In Form
|
||||
===
|
||||
|
||||
(println
|
||||
@@ -118,9 +118,9 @@ Block Comment - In Form - TODO Improve
|
||||
|
||||
(println
|
||||
#|
|
||||
block comment
|
||||
test
|
||||
|#
|
||||
block comment
|
||||
test
|
||||
|#
|
||||
"test")
|
||||
|
||||
===
|
||||
@@ -139,7 +139,7 @@ At the end of a form
|
||||
)
|
||||
|
||||
===
|
||||
Block at the end of a form - TODO Improve
|
||||
Block at the end of a form
|
||||
===
|
||||
|
||||
(println
|
||||
@@ -151,12 +151,12 @@ Block at the end of a form - TODO Improve
|
||||
|
||||
(println "hello world"
|
||||
#|
|
||||
wow look at that block comment
|
||||
|#
|
||||
wow look at that block comment
|
||||
|#
|
||||
)
|
||||
|
||||
===
|
||||
Inline at the end of a form - TODO-A handle hanging in this instance better
|
||||
Inline at the end of a single element form
|
||||
===
|
||||
|
||||
(println
|
||||
@@ -165,7 +165,6 @@ Inline at the end of a form - TODO-A handle hanging in this instance better
|
||||
|
||||
---
|
||||
|
||||
(println
|
||||
"hello world" ;; this is a comment
|
||||
(println "hello world" ;; this is a comment
|
||||
)
|
||||
|
||||
|
||||
@@ -42,3 +42,36 @@ Multiline condition hang
|
||||
(or (and (-> this opened-with-start?) (not (cpad-hold? 0 start)) (not (cpad-hold? 0 start)))
|
||||
(and (not (-> this opened-with-start?)) (not (cpad-hold? 0 select)))))
|
||||
(set! (-> this ignore-menu-toggle?) #f))
|
||||
|
||||
===
|
||||
Consolidation of if
|
||||
===
|
||||
|
||||
(if (and
|
||||
(-> this data s2-0) ;; entry is populated
|
||||
(= (-> this data s2-0 type) arg1) ;; type is right
|
||||
(or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) ;; name is right. also seek past ag name, and try again.
|
||||
)
|
||||
(return (the-as joint (-> this data s2-0))))
|
||||
|
||||
---
|
||||
|
||||
(if (and (-> this data s2-0) ;; entry is populated
|
||||
(= (-> this data s2-0 type) arg1) ;; type is right
|
||||
(or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0))) ;; name is right. also seek past ag name, and try again.
|
||||
)
|
||||
(return (the-as joint (-> this data s2-0))))
|
||||
|
||||
===
|
||||
Consolidation of if 2
|
||||
===
|
||||
|
||||
(if (or (not s5-1) (= (-> s5-1 name) 'default))
|
||||
(login this) ;; not part of level load, just normal login.
|
||||
)
|
||||
|
||||
---
|
||||
|
||||
(if (or (not s5-1) (= (-> s5-1 name) 'default))
|
||||
(login this) ;; not part of level load, just normal login.
|
||||
)
|
||||
@@ -0,0 +1,86 @@
|
||||
===
|
||||
With Bitfield and Type Info
|
||||
===
|
||||
|
||||
(defenum
|
||||
process-mask
|
||||
:bitfield
|
||||
#t
|
||||
:type
|
||||
uint32
|
||||
(execute 0) ;; 1
|
||||
(draw 1) ;; 2
|
||||
(pause 2) ;; 4
|
||||
(menu 3) ;; 8
|
||||
(progress 4) ;; 16
|
||||
(actor-pause 5) ;; 32
|
||||
(sleep 6) ;; 64
|
||||
(sleep-code 7) ;; 128
|
||||
(process-tree 8) ;; 256 not an actual process, just a "tree node" for organization
|
||||
(heap-shrunk 9) ;; 512
|
||||
(going 10) ;; 1024
|
||||
(movie 11) ;; 2048
|
||||
(movie-subject 12) ;; 4096
|
||||
(target 13) ;; 8192
|
||||
(sidekick 14) ;; 16384
|
||||
(crate 15) ;; 32768
|
||||
(collectable 16) ;; 65536
|
||||
(enemy 17) ;; 131072
|
||||
(camera 18) ;; 262144
|
||||
(platform 19) ;; 524288
|
||||
(ambient 20) ;; 1048576
|
||||
(entity 21) ;; 2097152
|
||||
(projectile 22) ;; 4194304
|
||||
(attackable 23) ;; 8388608
|
||||
(death 24) ;; 16777216
|
||||
)
|
||||
|
||||
---
|
||||
|
||||
(defenum process-mask
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
(execute 0) ;; 1
|
||||
(draw 1) ;; 2
|
||||
(pause 2) ;; 4
|
||||
(menu 3) ;; 8
|
||||
(progress 4) ;; 16
|
||||
(actor-pause 5) ;; 32
|
||||
(sleep 6) ;; 64
|
||||
(sleep-code 7) ;; 128
|
||||
(process-tree 8) ;; 256 not an actual process, just a "tree node" for organization
|
||||
(heap-shrunk 9) ;; 512
|
||||
(going 10) ;; 1024
|
||||
(movie 11) ;; 2048
|
||||
(movie-subject 12) ;; 4096
|
||||
(target 13) ;; 8192
|
||||
(sidekick 14) ;; 16384
|
||||
(crate 15) ;; 32768
|
||||
(collectable 16) ;; 65536
|
||||
(enemy 17) ;; 131072
|
||||
(camera 18) ;; 262144
|
||||
(platform 19) ;; 524288
|
||||
(ambient 20) ;; 1048576
|
||||
(entity 21) ;; 2097152
|
||||
(projectile 22) ;; 4194304
|
||||
(attackable 23) ;; 8388608
|
||||
(death 24) ;; 16777216
|
||||
)
|
||||
|
||||
|
||||
===
|
||||
Form heads that overlap with built-in forms
|
||||
===
|
||||
|
||||
(defenum pc-prof-event
|
||||
(begin
|
||||
0)
|
||||
(end 1)
|
||||
(instant 2))
|
||||
|
||||
---
|
||||
|
||||
(defenum pc-prof-event
|
||||
(begin 0)
|
||||
(end 1)
|
||||
(instant 2))
|
||||
@@ -82,3 +82,18 @@ Basic behavior
|
||||
(quaternion-copy! (-> gp-0 quat) (-> arg0 quat))
|
||||
(vector-identity! (-> gp-0 scale))
|
||||
(the-as symbol (send-event *camera* 'teleport-to-transformq gp-0))))
|
||||
|
||||
===
|
||||
Methods - new
|
||||
===
|
||||
|
||||
(defmethod new align-control
|
||||
((allocation symbol) (type-to-make type) (proc process-drawable))
|
||||
"Create a new align-control."
|
||||
(+ 1 1))
|
||||
|
||||
---
|
||||
|
||||
(defmethod new align-control ((allocation symbol) (type-to-make type) (proc process-drawable))
|
||||
"Create a new align-control."
|
||||
(+ 1 1))
|
||||
@@ -81,3 +81,70 @@ begin
|
||||
(begin
|
||||
"hello"
|
||||
(println "world"))
|
||||
|
||||
===
|
||||
Inlining flowed form
|
||||
===
|
||||
|
||||
(or something (begin (+ 1 2) (= 2 2)))
|
||||
|
||||
---
|
||||
|
||||
(or something (begin (+ 1 2) (= 2 2)))
|
||||
|
||||
===
|
||||
Long array creation
|
||||
===
|
||||
|
||||
(let ((arr (new
|
||||
'static
|
||||
'array
|
||||
uint32
|
||||
16
|
||||
#x7b2191b ;; = 6 ^ 129112349
|
||||
#x7b21914 ;; = 9 ^ 129112349
|
||||
#x7b21916 ;; = 11 ^ 129112349
|
||||
#x7b21913 ;; = 14 ^ 129112349
|
||||
#x7b21909 ;; = 20 ^ 129112349
|
||||
#x7b21908 ;; = 21 ^ 129112349
|
||||
#x7b2190a ;; = 23 ^ 129112349
|
||||
#x7b21907 ;; = 26 ^ 129112349
|
||||
#x7b2191b ;; = 6 ^ 129112349
|
||||
#x7b21917 ;; = 10 ^ 129112349
|
||||
#x7b21916 ;; = 11 ^ 129112349
|
||||
#x7b2190c ;; = 17 ^ 129112349
|
||||
#x7b21909 ;; = 20 ^ 129112349
|
||||
#x7b2190b ;; = 22 ^ 129112349
|
||||
#x7b2190a ;; = 23 ^ 129112349
|
||||
#x7b21900 ;; = 29 ^ 129112349
|
||||
)))
|
||||
(dotimes (i 16)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground joint-work frm-jmp-table i)
|
||||
(the-as (function none) (-> arr i)))))
|
||||
|
||||
---
|
||||
|
||||
(let ((arr (new 'static
|
||||
'array
|
||||
uint32
|
||||
16
|
||||
#x7b2191b ;; = 6 ^ 129112349
|
||||
#x7b21914 ;; = 9 ^ 129112349
|
||||
#x7b21916 ;; = 11 ^ 129112349
|
||||
#x7b21913 ;; = 14 ^ 129112349
|
||||
#x7b21909 ;; = 20 ^ 129112349
|
||||
#x7b21908 ;; = 21 ^ 129112349
|
||||
#x7b2190a ;; = 23 ^ 129112349
|
||||
#x7b21907 ;; = 26 ^ 129112349
|
||||
#x7b2191b ;; = 6 ^ 129112349
|
||||
#x7b21917 ;; = 10 ^ 129112349
|
||||
#x7b21916 ;; = 11 ^ 129112349
|
||||
#x7b2190c ;; = 17 ^ 129112349
|
||||
#x7b21909 ;; = 20 ^ 129112349
|
||||
#x7b2190b ;; = 22 ^ 129112349
|
||||
#x7b2190a ;; = 23 ^ 129112349
|
||||
#x7b21900 ;; = 29 ^ 129112349
|
||||
)))
|
||||
(dotimes (i 16)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground joint-work frm-jmp-table i)
|
||||
(the-as (function none) (-> arr i)))))
|
||||
@@ -1,52 +1,92 @@
|
||||
===
|
||||
TODO - Basic State
|
||||
Basic State
|
||||
===
|
||||
|
||||
(defstate active (enemy)
|
||||
:virtual #t
|
||||
:event enemy-event-handler
|
||||
:enter (behavior ()
|
||||
(defstate joint-exploder-shatter (joint-exploder)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(let* ((f1-0 (the float (- (current-time) (-> self state-time))))
|
||||
(f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration)))))
|
||||
(f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))))
|
||||
(if (< f1-2 0.0) (set! f1-2 0.0))
|
||||
(set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0))
|
||||
(dotimes (v1-8 5)
|
||||
(set! (-> self lists v1-8 pre-moved?) #f))
|
||||
(dotimes (gp-0 5)
|
||||
(let ((s5-0 (-> self lists gp-0)))
|
||||
(when (>= (-> s5-0 head) 0)
|
||||
(when (not (-> s5-0 pre-moved?))
|
||||
(joint-exploder-method-25 self s5-0)
|
||||
(if (nonzero? gp-0) (joint-exploder-method-28 self s5-0))))))
|
||||
(let ((gp-1 (new 'stack-no-clear 'bounding-box)))
|
||||
(let ((v1-26 (-> self root trans))) (set! (-> gp-1 min quad) (-> v1-26 quad)) (set! (-> gp-1 max quad) (-> v1-26 quad)))
|
||||
(dotimes (s5-1 5)
|
||||
(let ((s4-0 (-> self lists s5-1)))
|
||||
(if (-> s4-0 bbox-valid?) (add-box! gp-1 (-> s4-0 bbox)))
|
||||
(if (nonzero? s5-1) (joint-exploder-method-22 self s4-0))))
|
||||
(let ((s5-2 (-> self draw bounds)))
|
||||
(set-vector! s5-2
|
||||
(* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x)))
|
||||
(* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y)))
|
||||
(* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z)))
|
||||
1.0)
|
||||
(let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max)))))
|
||||
(vector-! s5-2 s5-2 (-> self root trans))
|
||||
(set! (-> s5-2 w) f0-12))))
|
||||
0)
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(logclear! (-> self enemy-flags) (enemy-flag cam-attack-mode))
|
||||
(when (logtest? (-> self enemy-flags) (enemy-flag enable-on-active))
|
||||
(logclear! (-> self enemy-flags) (enemy-flag enable-on-active))
|
||||
(let ((gp-0 (-> self on-active)))
|
||||
(if gp-0
|
||||
(script-eval gp-0 :vector (-> self root trans))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags)))
|
||||
(if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup))
|
||||
(logior! (-> self mask) (process-mask actor-pause))
|
||||
(logclear! (-> self mask) (process-mask actor-pause))
|
||||
)
|
||||
)
|
||||
)
|
||||
:trans (behavior ()
|
||||
(when (time-elapsed? (-> self state-time) (seconds 0.1))
|
||||
(let ((v1-3 (-> self focus aware)))
|
||||
(cond
|
||||
((< (the-as int v1-3) 1)
|
||||
(go-virtual idle)
|
||||
)
|
||||
((< 1 (the-as int v1-3))
|
||||
(go-virtual notice)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
:code (behavior ()
|
||||
(ja-channel-push! 1 (seconds 0.1))
|
||||
(sleep-code)
|
||||
)
|
||||
:post (behavior ()
|
||||
(idle-control-method-10 (-> self idle-anim-player) self)
|
||||
(enemy-simple-post)
|
||||
)
|
||||
)
|
||||
(until (time-elapsed? (-> self state-time) (-> self tuning duration))
|
||||
(suspend)
|
||||
(ja :num! (loop!))))
|
||||
:post
|
||||
ja-post)
|
||||
|
||||
---
|
||||
|
||||
TODO
|
||||
(defstate joint-exploder-shatter (joint-exploder)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time)))
|
||||
:trans
|
||||
(behavior ()
|
||||
(let* ((f1-0 (the float (- (current-time) (-> self state-time))))
|
||||
(f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration)))))
|
||||
(f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))))
|
||||
(if (< f1-2 0.0) (set! f1-2 0.0))
|
||||
(set-vector! (-> self scale-vector) f0-2 f1-2 f0-2 1.0))
|
||||
(dotimes (v1-8 5)
|
||||
(set! (-> self lists v1-8 pre-moved?) #f))
|
||||
(dotimes (gp-0 5)
|
||||
(let ((s5-0 (-> self lists gp-0)))
|
||||
(when (>= (-> s5-0 head) 0)
|
||||
(when (not (-> s5-0 pre-moved?))
|
||||
(joint-exploder-method-25 self s5-0)
|
||||
(if (nonzero? gp-0) (joint-exploder-method-28 self s5-0))))))
|
||||
(let ((gp-1 (new 'stack-no-clear 'bounding-box)))
|
||||
(let ((v1-26 (-> self root trans))) (set! (-> gp-1 min quad) (-> v1-26 quad)) (set! (-> gp-1 max quad) (-> v1-26 quad)))
|
||||
(dotimes (s5-1 5)
|
||||
(let ((s4-0 (-> self lists s5-1)))
|
||||
(if (-> s4-0 bbox-valid?) (add-box! gp-1 (-> s4-0 bbox)))
|
||||
(if (nonzero? s5-1) (joint-exploder-method-22 self s4-0))))
|
||||
(let ((s5-2 (-> self draw bounds)))
|
||||
(set-vector! s5-2
|
||||
(* 0.5 (+ (-> gp-1 min x) (-> gp-1 max x)))
|
||||
(* 0.5 (+ (-> gp-1 min y) (-> gp-1 max y)))
|
||||
(* 0.5 (+ (-> gp-1 min z) (-> gp-1 max z)))
|
||||
1.0)
|
||||
(let ((f0-12 (+ 16384.0 (vector-vector-distance s5-2 (-> gp-1 max)))))
|
||||
(vector-! s5-2 s5-2 (-> self root trans))
|
||||
(set! (-> s5-2 w) f0-12))))
|
||||
0)
|
||||
:code
|
||||
(behavior ()
|
||||
(set-time! (-> self state-time))
|
||||
(until (time-elapsed? (-> self state-time) (-> self tuning duration))
|
||||
(suspend)
|
||||
(ja :num! (loop!))))
|
||||
:post ja-post)
|
||||
|
||||
@@ -105,3 +105,91 @@ Types - With Methods and States
|
||||
pov-camera-playing
|
||||
pov-camera-start-playing
|
||||
pov-camera-startup))
|
||||
|
||||
===
|
||||
With flags
|
||||
===
|
||||
|
||||
(deftype process-tree (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(mask process-mask :offset-assert 8)
|
||||
(parent (pointer process-tree) :offset-assert 12)
|
||||
(brother (pointer process-tree) :offset-assert 16)
|
||||
(child (pointer process-tree) :offset-assert 20)
|
||||
(ppointer (pointer process) :offset-assert 24)
|
||||
(self process-tree :offset-assert 28))
|
||||
(:methods
|
||||
(new (symbol type basic) _type_)
|
||||
(activate (_type_ process-tree basic pointer) process-tree) ;; 9
|
||||
(deactivate (_type_) none) ;; 10
|
||||
(init-from-entity! (_type_ entity-actor) none) ;; 11
|
||||
(run-logic? (_type_) symbol) ;; 12
|
||||
(process-tree-method-13 () none) ;; 13
|
||||
)
|
||||
:size-assert
|
||||
#x20
|
||||
:method-count-assert
|
||||
14
|
||||
:no-runtime-type ;; already defined by kscheme. Don't do it again.
|
||||
)
|
||||
|
||||
---
|
||||
|
||||
(deftype process-tree (basic)
|
||||
((name basic :offset-assert 4)
|
||||
(mask process-mask :offset-assert 8)
|
||||
(parent (pointer process-tree) :offset-assert 12)
|
||||
(brother (pointer process-tree) :offset-assert 16)
|
||||
(child (pointer process-tree) :offset-assert 20)
|
||||
(ppointer (pointer process) :offset-assert 24)
|
||||
(self process-tree :offset-assert 28))
|
||||
(:methods
|
||||
(new (symbol type basic) _type_)
|
||||
(activate (_type_ process-tree basic pointer) process-tree) ;; 9
|
||||
(deactivate (_type_) none) ;; 10
|
||||
(init-from-entity! (_type_ entity-actor) none) ;; 11
|
||||
(run-logic? (_type_) symbol) ;; 12
|
||||
(process-tree-method-13 () none) ;; 13
|
||||
)
|
||||
:size-assert #x20
|
||||
:method-count-assert 14
|
||||
:no-runtime-type ;; already defined by kscheme. Don't do it again.
|
||||
)
|
||||
|
||||
===
|
||||
Single value column
|
||||
===
|
||||
|
||||
(deftype joint-control-channel (structure)
|
||||
((parent joint-control)
|
||||
(command symbol)
|
||||
(frame-interp float)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(num-func (function joint-control-channel float float float))
|
||||
(param float 2)
|
||||
(group-sub-index int16)
|
||||
(group-size int16)
|
||||
(dist meters)
|
||||
(eval-time uint32)
|
||||
(inspector-amount float))
|
||||
(:methods
|
||||
(debug-print-frames (_type_) _type_)))
|
||||
|
||||
---
|
||||
|
||||
(deftype joint-control-channel (structure)
|
||||
((parent joint-control)
|
||||
(command symbol)
|
||||
(frame-interp float)
|
||||
(frame-group art-joint-anim)
|
||||
(frame-num float)
|
||||
(num-func (function joint-control-channel float float float))
|
||||
(param float 2)
|
||||
(group-sub-index int16)
|
||||
(group-size int16)
|
||||
(dist meters)
|
||||
(eval-time uint32)
|
||||
(inspector-amount float))
|
||||
(:methods
|
||||
(debug-print-frames (_type_) _type_)))
|
||||
|
||||
@@ -56,7 +56,7 @@ std::vector<TestDefinition> get_test_definitions(const fs::path& file_path) {
|
||||
if (!curr_test.name.empty() && line.empty()) {
|
||||
i++;
|
||||
while (true) {
|
||||
if (contents.at(i) == "---") {
|
||||
if (str_util::trim(contents.at(i)) == "---") {
|
||||
i++;
|
||||
curr_test.input = str_util::trim(curr_test.input);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user