mirror of
https://github.com/open-goal/jak-project
synced 2026-06-04 10:49:04 -04:00
scripts: new linter script to detect goal_src files with trailing whitespace (#3387)
Removes trailing whitespace from goal_src files, eventually the formatter will do this as well but it's not ready yet so this is a decent interim solution. A competent text editor will also do this / flag it for you.
This commit is contained in:
@@ -41,6 +41,9 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for Trailing Whitespace in goal_src
|
||||
run: python ./scripts/ci/lint-trailing-whitespace.py
|
||||
|
||||
- name: Check for Unresolved Conflicts
|
||||
run: python ./scripts/gsrc/check-for-conflicts.py
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ tasks:
|
||||
desc: "Format code"
|
||||
cmds:
|
||||
- cmd: python ./scripts/cpp/format-includes.py
|
||||
- cmd: python ./scripts/ci/lint-trailing-whitespace.py --fix
|
||||
- cmd: python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test tools lsp -i
|
||||
- task: format-json
|
||||
# DECOMPILING
|
||||
@@ -153,6 +154,9 @@ tasks:
|
||||
desc: Finds and tries to fix invalid translation Characters
|
||||
cmds:
|
||||
- python ./scripts/ci/lint-characters.py --fix
|
||||
lint:
|
||||
cmds:
|
||||
- python ./scripts/ci/lint-trailing-whitespace.py
|
||||
# TESTS
|
||||
offline-tests: # ran by jenkins
|
||||
cmds:
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
(let ((s5-1 (-> *level* level gp-1)))
|
||||
(when (= (-> s5-1 status) 'active)
|
||||
(let ((a2-0 (/ (+ (-> s5-1 bsp visible-list-length) 15) 16)))
|
||||
|
||||
|
||||
;; start by setting all-visible to something truthy (either original, or #t)
|
||||
;; below, we'll try to figure out a way to get vis data and set this back to #f.
|
||||
(set! (-> s5-1 all-visible?) (if (-> s5-1 all-visible?)
|
||||
@@ -138,21 +138,21 @@
|
||||
(set! s4-0 (-> s5-1 vis-info (-> s5-1 vis-self-index)))
|
||||
;; adj vis info (idx will be 7 if there's no adj right now, and will give us #f)
|
||||
(set! s3-0 (-> s5-1 vis-info (-> s5-1 vis-adj-index)))
|
||||
|
||||
|
||||
(let ((v1-32 #f)) ;; should use self vis
|
||||
(set! a0-16 #f) ;; should use adj vis
|
||||
|
||||
|
||||
;; see if we want self vis
|
||||
(when s4-0
|
||||
(set! v1-32 (nonzero? (logand (shl #x8000 16) (-> s4-0 flags))))
|
||||
|
||||
|
||||
;; not sure when this would happen, but make sure that our leaf
|
||||
;; index is in bounds (maybe if you use the wrong version of levels)
|
||||
(if (< (-> s4-0 length) (-> s4-0 from-bsp current-leaf-idx))
|
||||
(set! v1-32 #f)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; see if we want adj vis.
|
||||
(when s3-0
|
||||
(set! a0-16 (nonzero? (logand (shl #x8000 16) (-> s3-0 flags))))
|
||||
|
||||
@@ -1696,7 +1696,7 @@
|
||||
; (.mula.s f0-9 f3-0)
|
||||
; (.madda.s f1-2 f4-0)
|
||||
; (.madd.s f0-10 f2-0 f5-0)
|
||||
(set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-0)))
|
||||
(set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-0)))
|
||||
)
|
||||
(let* ((f1-3 (t9-10 f0-10))
|
||||
(f0-12 (* arg3 f1-3))
|
||||
|
||||
@@ -148,8 +148,8 @@
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(.lvf vf1 (&-> vf1-val quad))
|
||||
(.lvf vf2 (&-> vf2-val quad))
|
||||
(.lvf vf1 (&-> vf1-val quad))
|
||||
(.lvf vf2 (&-> vf2-val quad))
|
||||
(.mov vf3 rad)
|
||||
(.mul.vf vf4 vf2 vf2)
|
||||
(.mul.vf vf3 vf3 vf3)
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
)
|
||||
;; upload the function dma
|
||||
(dma-buffer-add-vu-function gp-0 collide-vu0-block 0)
|
||||
|
||||
|
||||
;; end dma chain
|
||||
(let* ((v1-1 gp-0)
|
||||
(a0-5 (the-as object (-> v1-1 base)))
|
||||
@@ -238,7 +238,7 @@
|
||||
(set! (-> (the-as (pointer uint64) a0-5) 1) (the-as uint 0))
|
||||
(set! (-> v1-1 base) (&+ (the-as pointer a0-5) 16))
|
||||
)
|
||||
|
||||
|
||||
;; go!
|
||||
(.sync.l)
|
||||
(dma-buffer-send-chain (the-as dma-bank-source #x10008000) gp-0)
|
||||
@@ -256,7 +256,7 @@
|
||||
0
|
||||
;; load vu0 program
|
||||
(collide-upload-vu0)
|
||||
|
||||
|
||||
;; iterate over trees
|
||||
(let ((s5-1 (-> s5-0 drawable-trees)))
|
||||
(dotimes (s4-0 (-> s5-1 length))
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
"Get a touching-shapes-entry for the two shapes. If one exists, it will be returned. Otherwise a new one will be made."
|
||||
(let ((v0-0 (the-as touching-shapes-entry (-> this touching-shapes)))) ;; the candidate
|
||||
(let ((v1-0 (the-as touching-shapes-entry #f))) ;; a good one
|
||||
|
||||
|
||||
;; loop over all touching shapes
|
||||
(countdown (a3-0 (-> this num-touching-shapes))
|
||||
(let ((t0-0 (-> v0-0 cshape1)))
|
||||
@@ -154,7 +154,7 @@
|
||||
)
|
||||
(&+! v0-0 16)
|
||||
)
|
||||
|
||||
|
||||
;; done looping.
|
||||
(cond
|
||||
(v1-0 ;; did we find an unused slot? if so return it
|
||||
@@ -172,7 +172,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; if we're doing a new one, set it up.
|
||||
(set! (-> v0-0 cshape1) arg0)
|
||||
(set! (-> v0-0 cshape2) arg1)
|
||||
@@ -204,7 +204,7 @@
|
||||
;; "I moved forward 0.3, so I now have 0.7 left to move (but potentially in a different direction because I bounced off of B)"
|
||||
;; "What happens if I move forward 0.7 timesteps?"
|
||||
;; .. repeat ..
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -220,12 +220,12 @@
|
||||
You can provide triangles if you want, but you don't have to.
|
||||
The logic for calling this twice for the same prims in between calls to update-from-step-size is a little weird
|
||||
so I suspect this never happens (and it's probably cheaper to avoid this duplication in the actual prim collision code)."
|
||||
|
||||
|
||||
;; I don't know why they made this type, but I'm guessing it's to avoid the compiler spilling to the stack
|
||||
(let ((gp-0 (new 'stack-no-clear 'add-prims-touching-work)))
|
||||
(set! (-> gp-0 tri1) arg3)
|
||||
(set! (-> gp-0 tri2) arg4)
|
||||
|
||||
|
||||
;; first, grab the entry for the collide-shapes involved.
|
||||
(let ((s2-0 (get-shapes-entry this (-> arg0 cshape) (-> arg1 cshape))))
|
||||
(when s2-0
|
||||
@@ -281,7 +281,7 @@
|
||||
(set! s0-0 (-> s0-0 next))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; nope, didn't find an entry, so make a new one.
|
||||
(let ((s0-1 (alloc-node *touching-prims-entry-pool*)))
|
||||
;; allocate a new node, link it.
|
||||
@@ -300,7 +300,7 @@
|
||||
;; if we're >0, we have to move (which we haven't done yet) to actually collide.
|
||||
;; flag us as resolve-u (meaning our u is from the resolve function, which looks at what _would_
|
||||
;; happen if we did it all at once.)
|
||||
|
||||
|
||||
;; if we're <0, we started in collision (possible, if we didnt' converge on the last frame)
|
||||
;; we should still add, but we don't need to bother with the "did we go far enough" checks.
|
||||
(set! (-> s2-0 resolve-u) 1)
|
||||
@@ -349,7 +349,7 @@
|
||||
(when (nonzero? (-> this resolve-u))
|
||||
;; remember we did it
|
||||
(set! (-> this resolve-u) 0)
|
||||
|
||||
|
||||
;; loop through touching-shape-entries
|
||||
(let ((s5-0 (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (s4-0 (-> this num-touching-shapes))
|
||||
@@ -363,7 +363,7 @@
|
||||
(let ((s3-0 (-> s5-0 head)))
|
||||
(while s3-0
|
||||
(let ((f0-0 (-> s3-0 u)))
|
||||
(set! s3-0
|
||||
(set! s3-0
|
||||
(cond
|
||||
((>= f0-0 0.0)
|
||||
;; we'd have to take a step to hit this one!
|
||||
@@ -432,22 +432,22 @@
|
||||
;; the touching list will run its logic on it regardless.
|
||||
;; this is fixed here by creating a really large list of 2 handles per collide shape and storing all collided
|
||||
;; process handles there. (process->handle) is then safe to use.
|
||||
|
||||
|
||||
; (* 2 TOUCHING_LIST_LENGTH) -> 64
|
||||
(let ((handles (new 'stack-no-clear 'array 'handle 64)))
|
||||
|
||||
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
|
||||
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> handles (+ 0 (* 2 i))) (process->handle (-> c1 process)))
|
||||
(set! (-> handles (+ 1 (* 2 i))) (process->handle (-> c2 process)))
|
||||
)
|
||||
@@ -456,19 +456,19 @@
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(let ((entry (the-as touching-shapes-entry (-> this touching-shapes))))
|
||||
(countdown (i (-> this num-touching-shapes))
|
||||
(let ((c1 (-> entry cshape1)))
|
||||
(when c1
|
||||
(let ((c2 (-> entry cshape2)))
|
||||
|
||||
|
||||
;; not quite sure why, but we make it look like cshape1 (s4) is target always.
|
||||
;; I guess this makes it so the target/enemy events are always sent in the same order.
|
||||
(when (= (-> c2 process type) target)
|
||||
(swap! c1 c2)
|
||||
)
|
||||
|
||||
|
||||
;; send events!
|
||||
(let (
|
||||
(c1-proc (handle->process (-> handles (+ 0 (* 2 i)))))
|
||||
@@ -501,7 +501,7 @@
|
||||
(set! entry (-> (the-as (inline-array touching-shapes-entry) entry) 1))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
0
|
||||
(none)
|
||||
@@ -627,7 +627,7 @@
|
||||
that is inside of both spheres, and get the midpoint of that."
|
||||
(let* ((s4-0 (-> this prim1 cprim))
|
||||
(s3-0 (-> this prim2 cprim))
|
||||
|
||||
|
||||
;; compute the offset between the prim cores.
|
||||
(gp-1 (vector-!
|
||||
(new 'stack-no-clear 'vector)
|
||||
@@ -636,7 +636,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; subtract off the two radius. this is now the offset between the "closest" points (and is negative)
|
||||
(let ((f1-2 (- (- (vector-length gp-1) (-> s3-0 prim-core world-sphere w)) (-> s4-0 prim-core world-sphere w))))
|
||||
;; this offset is the radius, minus half the overlap distance
|
||||
|
||||
@@ -388,7 +388,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(#when PC_PORT (when *debug-segment*
|
||||
(if *display-bones*
|
||||
(draw-bone-lines obj))
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
(when (transform-point-qword! (-> s5-0 vector 0) pt)
|
||||
|
||||
(with-dma-buffer-add-bucket ((v1-7 (-> (current-frame) debug-buf)) bucket)
|
||||
|
||||
|
||||
(with-cnt-vif-block (v1-7)
|
||||
(dma-buffer-add-gif-tag v1-7
|
||||
(new 'static 'gif-tag64 :nloop 1 :eop 1 :pre 1 :nreg 8 :prim (gif-prim tri-strip))
|
||||
@@ -144,7 +144,7 @@
|
||||
)
|
||||
(set! (-> p0 w) 1.0)
|
||||
(set! (-> p1 w) 1.0)
|
||||
|
||||
|
||||
(when (and (transform-point-qword! (-> s4-0 vector 0) p0)
|
||||
(transform-point-qword! (-> s4-0 vector 1) p1)
|
||||
)
|
||||
@@ -154,7 +154,7 @@
|
||||
:prim (gif-prim line))
|
||||
(gs-reg-list rgbaq xyzf2 rgbaq xyzf2)
|
||||
)
|
||||
(case mode
|
||||
(case mode
|
||||
(('fade-depth)
|
||||
(let ((f0-3 (fminmax (* (1/ #xffffff) (the float (-> s4-0 vector 0 z))) 0.2 1.0)))
|
||||
(set! (-> s1-0 vector 0 x) (the int (* (the float (-> first-color r)) f0-3)))
|
||||
@@ -198,16 +198,16 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(defun-debug internal-draw-debug-text-3d ((bucket bucket-id) (str string) (location vector) (font-color-id font-color) (offset vector2h))
|
||||
"Draw text at the given location (in 3D), with a 2D offset."
|
||||
(let ((s2-0 (new 'stack-no-clear 'vector4w)))
|
||||
(set! (-> s2-0 quad) (the-as uint128 0))
|
||||
(when (transform-point-qword! (the-as vector4w s2-0) location)
|
||||
|
||||
|
||||
(with-dma-buffer-add-bucket ((s3-0 (-> (current-frame) debug-buf)) bucket)
|
||||
|
||||
|
||||
(let ((a2-2 (new 'stack 'font-context *font-default-matrix*
|
||||
(+ (+ (-> offset x) -1792) (/ (-> s2-0 x) 16))
|
||||
(- (+ (+ (-> offset y) -8) (/ (-> s2-0 y) 16))
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
|
||||
(defmethod print-mem-usage ((this memory-usage-block) (arg0 level) (arg1 object))
|
||||
"Print memory usage. Uses a foramt that will fit on screen."
|
||||
|
||||
|
||||
;; print header (same in normal and compact mode)
|
||||
(let ((s3-0 (&- (-> arg0 heap current) (the-as uint (-> arg0 heap base)))))
|
||||
(let ((v1-2 (+ (-> this data 59 total) (-> this data 60 total))))
|
||||
@@ -326,10 +326,10 @@
|
||||
(if (< s2-0 (-> arg0 mem-usage))
|
||||
(format arg1 "~3L")
|
||||
)
|
||||
|
||||
|
||||
;; Format is:
|
||||
;; --LevelName---ActualLevelHeapUseKB--of--SlightlyTooSmallHeapSizeKB---ActorHeapUseKB--of---ActorHeapSizeKb---DmaThisFrameKB/--MaxDmaKbEver
|
||||
(format arg1 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--"
|
||||
(format arg1 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--"
|
||||
(-> arg0 name)
|
||||
(sar s3-0 10)
|
||||
(sar s2-0 10)
|
||||
@@ -363,19 +363,19 @@
|
||||
|
||||
(when (not *stats-memory-short*)
|
||||
;; print the table
|
||||
|
||||
|
||||
;; compute debug dma usage.
|
||||
(set! (-> *dma-mem-usage* data 84 total)
|
||||
(* (dma-buffer-length (-> *display* frames (-> *display* last-screen) frame debug-buf)) 16)
|
||||
)
|
||||
|
||||
|
||||
;; the left column is level heap, the right column is non-debug dma.
|
||||
|
||||
|
||||
(format arg1 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%"
|
||||
(sar (+ (-> this data 56 total) (-> this data 57 total) (-> this data 58 total)) 10)
|
||||
(sar (-> *dma-mem-usage* data 84 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " bsp-leaf-vis-iop ~192H~5DK~%"
|
||||
(sar (if (-> arg0 vis-info (-> arg0 vis-self-index))
|
||||
(the-as int (-> arg0 vis-info (-> arg0 vis-self-index) allocated-length))
|
||||
@@ -384,10 +384,10 @@
|
||||
10
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " bsp-leaf-vis-adj ~192H~5DK~%" (sar (+ (-> this data 59 total) (-> this data 60 total)) 10))
|
||||
(format arg1 " level-code ~192H~5DK~%" (sar (-> this data 63 total) 10))
|
||||
|
||||
|
||||
(format arg1 " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 1 total)
|
||||
(-> this data 2 total)
|
||||
@@ -402,7 +402,7 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 1 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%"
|
||||
(sar (+ (-> this data 9 total)
|
||||
(-> this data 10 total)
|
||||
@@ -417,7 +417,7 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 85 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 18 total)
|
||||
(-> this data 20 total)
|
||||
@@ -428,7 +428,7 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 9 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " shrub-proto ~192H~5DK ~280Htie-near~456H~5DK~%"
|
||||
(sar (+ (-> this data 25 total)
|
||||
(-> this data 26 total)
|
||||
@@ -444,12 +444,12 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 15 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%"
|
||||
(sar (-> this data 34 total) 10)
|
||||
(sar (-> *dma-mem-usage* data 27 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " collision ~192H~5DK ~280Htie-generic~456H~5DK~%"
|
||||
(sar (+ (-> this data 50 total)
|
||||
(-> this data 51 total)
|
||||
@@ -462,7 +462,7 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 17 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%"
|
||||
(sar (+ (-> this data 35 total)
|
||||
(-> this data 36 total)
|
||||
@@ -485,7 +485,7 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 35 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%"
|
||||
(sar (+ (-> this data 65 total)
|
||||
(-> this data 66 total)
|
||||
@@ -499,12 +499,12 @@
|
||||
)
|
||||
(sar (-> *dma-mem-usage* data 86 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " textures ~192H~5DK ~280Htextures~456H~5DK~%"
|
||||
(sar (-> this data 79 total) 10)
|
||||
(sar (-> *dma-mem-usage* data 79 total) 10)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " entity ~192H~5DK~%"
|
||||
(sar (+ (-> this data 64 total)
|
||||
(-> this data 43 total)
|
||||
@@ -518,7 +518,7 @@
|
||||
10
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(format arg1 " misc ~192H~5DK ~280Hsprite~456H~5DK~%"
|
||||
(sar (+ (-> this data 0 total)
|
||||
(-> this data 61 total)
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
(-> self root trans)
|
||||
(the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
|
||||
)
|
||||
|
||||
|
||||
;; og:preserve-this
|
||||
;; change this line to change the particle group to test
|
||||
;; notes:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
(defmethod collide-with-box ((this draw-node) (arg0 int) (arg1 collide-list))
|
||||
"Find collisions with the box in the current collision query, add results to collide-list."
|
||||
|
||||
|
||||
;; loop over ourself and our brothers
|
||||
(dotimes (s3-0 arg0)
|
||||
(if (collide-cache-using-box-test (-> this bsphere)) ;; do we collide with the bounding sphere?
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
(defmethod unpack-vis ((this drawable-tree) (arg0 (pointer int8)) (arg1 (pointer int8)))
|
||||
"Copy our visibility data from arg1 to arg0, unpacking it."
|
||||
(local-vars (t5-1 int))
|
||||
|
||||
|
||||
;; grab the first array
|
||||
(let* ((v1-0 (the-as drawable-inline-array-node (-> this data 0)))
|
||||
;; first elt in top array
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
(+! (-> arg0 data 43 used) v1-6)
|
||||
(+! (-> arg0 data 43 total) (logand -16 (+ v1-6 15)))
|
||||
)
|
||||
|
||||
|
||||
;; note: does something with flags here.
|
||||
(mem-usage (-> this actor) arg0 (logior arg1 64))
|
||||
(the-as drawable-actor 0)
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
(defmethod get-level ((this entity))
|
||||
"Get the level that the entity belongs to."
|
||||
|
||||
|
||||
;; loop over levels
|
||||
(dotimes (v1-0 (-> *level* length))
|
||||
(let ((a1-3 (-> *level* level v1-0)))
|
||||
@@ -353,7 +353,7 @@
|
||||
(if (and (the-as process proc-draw) (zero? (-> proc-draw draw)))
|
||||
(set! proc-draw (the-as process-drawable #f))
|
||||
)
|
||||
|
||||
|
||||
;; first char is r or ' '. r for run.
|
||||
;; second char is d or ' '. I think d is draw.
|
||||
;; third char is a number 0-4 or a ' '. This is the lod.
|
||||
@@ -425,13 +425,13 @@
|
||||
)
|
||||
(format #t "~8D ~3D ~-4S #x~4X" (-> this extra perm aid) (-> this extra perm task) t0-3 (-> this extra perm status))
|
||||
)
|
||||
|
||||
|
||||
;; location
|
||||
(if (= mode 'entity-meters)
|
||||
(format #t " :trans ~14m ~14m ~14m " (-> this extra trans x) (-> this extra trans y) (-> this extra trans z))
|
||||
(format #t " :trans ~14f ~14f ~14f " (-> this extra trans x) (-> this extra trans y) (-> this extra trans z))
|
||||
)
|
||||
|
||||
|
||||
;; if we have an associated process, print info.
|
||||
(let* ((s3-2 (-> this extra process))
|
||||
(s4-2 (if (and (nonzero? s3-2) (type-type? (-> s3-2 type) process-drawable))
|
||||
@@ -482,7 +482,7 @@
|
||||
'art-group: print art groups instead.
|
||||
'entity-meters: print entity location in meters.
|
||||
'entity-perm: also print entity-perm values."
|
||||
|
||||
|
||||
;; no way this fit on their screen back in ~2000.
|
||||
(format #t " id address name aid tsk lev status x y z address name state heap flags~%" 0 0 0)
|
||||
(dotimes (s3-0 (-> this length))
|
||||
@@ -518,11 +518,11 @@
|
||||
|
||||
(defmethod add-to-level! ((this entity) (lev-group level-group) (lev level) (aid actor-id))
|
||||
"Add us to a level."
|
||||
|
||||
|
||||
;; grab the first free link
|
||||
(let ((level-link (-> lev entity data (-> lev entity length))))
|
||||
(+! (-> lev entity length) 1)
|
||||
|
||||
|
||||
;; attach the entity to the link
|
||||
(set! (-> level-link process) #f)
|
||||
(set! (-> level-link entity) this)
|
||||
@@ -545,13 +545,13 @@
|
||||
(set! (-> level-link next-link) level-link)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; remember the start of the list
|
||||
(set! (-> lev-group entity-link) level-link)
|
||||
;; update the trans.
|
||||
(set! (-> level-link trans quad) (-> this trans quad))
|
||||
)
|
||||
|
||||
|
||||
;; set us up
|
||||
(set! (-> this extra perm aid) aid)
|
||||
(set! (-> this extra level) lev)
|
||||
@@ -623,7 +623,7 @@
|
||||
(sv-32 (function process-drawable vector vector none))
|
||||
(sv-48 process-tree)
|
||||
)
|
||||
|
||||
|
||||
(format 0 "call to update-vis-volumes, which may have a compiler bug.~%")
|
||||
(dotimes (s5-0 (-> this length))
|
||||
(let ((v1-3 (-> this level s5-0)))
|
||||
@@ -698,7 +698,7 @@
|
||||
(s2-0 (-> v0-0 1))
|
||||
)
|
||||
(let ((s0-0 (-> sv-32 extra trans)))
|
||||
|
||||
|
||||
;; sometimes the nav-mesh may be in a different actor, I guess.
|
||||
;; so try to look that up.
|
||||
(set! sv-16 sv-32)
|
||||
@@ -707,7 +707,7 @@
|
||||
(set! sv-16 v0-1)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(cond
|
||||
((and (type-type? (-> sv-16 type) entity-actor) (nonzero? (-> (the-as entity-actor sv-16) nav-mesh)))
|
||||
;; we got a nav-mesh! compute the bounding box
|
||||
@@ -720,7 +720,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; add some padding to make a 6x6 meter box.
|
||||
(let ((f1-0 -12288.0)
|
||||
(f0-0 12288.0)
|
||||
@@ -771,7 +771,7 @@
|
||||
(let ((s0-0 (-> s1-0 0))
|
||||
(s1-1 (-> s1-0 1))
|
||||
)
|
||||
|
||||
|
||||
;; This technically will work on type objects because it just checks for value equality.
|
||||
;; the code here is super weird. I have no idea what was going on, or why there are two or's.
|
||||
(when (not (or (name= sv-16 money)
|
||||
@@ -1215,21 +1215,21 @@
|
||||
(defun init-entity ((proc process) (ent entity-actor))
|
||||
"This function starts up an entity!
|
||||
The process should not be activated yet."
|
||||
|
||||
|
||||
;;(birth-log "(init-entity ~A)~%" ent)
|
||||
|
||||
|
||||
;; activate the process. It goes in the entity-pool, which is a child of the main active-pool.
|
||||
(activate proc *entity-pool* (res-lump-struct ent 'name basic) (the-as pointer #x70004000))
|
||||
|
||||
|
||||
;; link the entity and the process
|
||||
(set! (-> proc entity) ent)
|
||||
(set! (-> ent extra process) proc)
|
||||
|
||||
|
||||
;;(birth-log "activated: ~A ~A, now doing init ~A~%" proc ent (method-of-object proc init-from-entity!))
|
||||
|
||||
|
||||
;; run the initializer
|
||||
(run-now-in-process proc (method-of-object proc init-from-entity!) proc ent)
|
||||
|
||||
|
||||
(none)
|
||||
)
|
||||
|
||||
@@ -1243,7 +1243,7 @@
|
||||
|
||||
(defmethod birth! ((this entity-actor))
|
||||
"Create a process for this entity and start it."
|
||||
|
||||
|
||||
;; temp
|
||||
; (when (or (not (this-etype? process))
|
||||
; ;; disallowed types
|
||||
@@ -1255,7 +1255,7 @@
|
||||
; (logior! (-> this extra perm status) (entity-perm-status bit-0))
|
||||
; (return this)
|
||||
; )
|
||||
|
||||
|
||||
;;(birth-log "call to birth! on ~A~%" this)
|
||||
|
||||
(let* ((entity-type (-> this etype))
|
||||
@@ -1316,7 +1316,7 @@
|
||||
"Birth everything in the level."
|
||||
;; (local-vars (v1-71 int) (s5-0 int))
|
||||
;; (.mfc0 s5-0 Count)
|
||||
|
||||
|
||||
;; how many actors do we need?
|
||||
(let ((actor-count (if (nonzero? (-> this actors))
|
||||
(-> this actors length)
|
||||
@@ -1339,10 +1339,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; reset our entity links array to 0.
|
||||
(set! (-> this level entity length) 0)
|
||||
|
||||
|
||||
;; NOTE: we don't actually birth the actors. It is too slow.
|
||||
;; so it gets spread over multiple frames later.
|
||||
(when (nonzero? (-> this actors))
|
||||
@@ -1354,7 +1354,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(let ((existing-amb-count (if (nonzero? (-> this ambients))
|
||||
(-> this ambients length)
|
||||
0
|
||||
@@ -1376,7 +1376,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> this level ambient length) 0)
|
||||
0
|
||||
(let ((amb-array (-> this level ambient))
|
||||
@@ -1399,7 +1399,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
; (.mfc0 v1-71 Count)
|
||||
; (let ((a3-3 (- v1-71 s5-0)))
|
||||
; (format 0 "Done ~S in ~D~%" "birth" a3-3)
|
||||
|
||||
@@ -843,7 +843,7 @@ This is updated from the entity system used in Crash 2, which had most of these
|
||||
)
|
||||
;; ref to non-inline data. Inline data would have been counted above.
|
||||
(when (not (part-group-pointer? (the-as pointer tag-data)))
|
||||
(case (-> (the-as basic tag-data) type)
|
||||
(case (-> (the-as basic tag-data) type)
|
||||
((symbol type)
|
||||
)
|
||||
((string)
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
The cause can be 'dead if you die, or 'game to reset everything.
|
||||
If save-to-load is not #f will load data from that.
|
||||
If continue-point-override is not #f, will use that."
|
||||
|
||||
|
||||
(local-vars (v0-0 int) (sv-96 symbol))
|
||||
(case cause
|
||||
(('dead)
|
||||
@@ -567,7 +567,7 @@
|
||||
|
||||
;; some sort of hack for eco vents.
|
||||
(b!
|
||||
(and (logtest? (-> (the-as collide-shape (-> this process root)) root-prim prim-core action)
|
||||
(and (logtest? (-> (the-as collide-shape (-> this process root)) root-prim prim-core action)
|
||||
(collide-action racer)
|
||||
)
|
||||
(type-type? (-> (handle->process source-handle) type) vent)
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
|
||||
(defmethod save-game! ((this game-info) (arg0 game-save) (arg1 string))
|
||||
"Update the game-save to have the info from the current game state"
|
||||
|
||||
|
||||
;; some stuff lives in the levels and needs to be copied into game-info.
|
||||
(dotimes (s3-0 (-> *level* length))
|
||||
(let ((a1-1 (-> *level* level s3-0)))
|
||||
@@ -347,7 +347,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; set common data
|
||||
(set! (-> arg0 length) 0)
|
||||
(set! (-> arg0 version) 1)
|
||||
@@ -1194,12 +1194,12 @@
|
||||
|
||||
(defmethod relocate ((this auto-save) (arg0 int))
|
||||
"Relocate an auto-save process by arg0 bytes."
|
||||
|
||||
|
||||
;; update our reference particle launch control, which is allocated on our process heap
|
||||
(if (nonzero? (-> this part))
|
||||
(&+! (-> this part) arg0)
|
||||
)
|
||||
|
||||
|
||||
;; then relocate the process. This will relocate the heap (memory, and basics on it).
|
||||
(the-as auto-save ((method-of-type process relocate) this arg0))
|
||||
)
|
||||
@@ -1221,7 +1221,7 @@
|
||||
(print-game-text *temp-string* gp-0 #f 128 22)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; auto-save drawing
|
||||
(when (and (= (-> self mode) 'auto-save) (!= (-> self next-state name) 'done))
|
||||
(let ((gp-1
|
||||
@@ -1238,7 +1238,7 @@
|
||||
(set! (-> v1-17 height) (the float 20))
|
||||
)
|
||||
(set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large))
|
||||
|
||||
|
||||
;; if this is the first time saving, display a warning.
|
||||
(when (zero? (-> *game-info* auto-save-count))
|
||||
(print-game-text (lookup-text! *common-text* (text-id saving-data) #f) gp-1 #f 128 22)
|
||||
@@ -1260,7 +1260,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; flash the icon.
|
||||
(when (< (mod (-> *display* real-frame-counter) 300) 270)
|
||||
(if (> (-> self part matrix) 0)
|
||||
@@ -1300,13 +1300,13 @@
|
||||
(send-event notify-proc 'notify 'error 16)
|
||||
(return #f)
|
||||
)
|
||||
|
||||
|
||||
;; set us as the auto save proc
|
||||
(set! (-> *game-info* auto-save-proc) (process->handle self))
|
||||
(set! (-> *game-info* auto-save-status) (mc-status-code ok))
|
||||
(stack-size-set! (-> self main-thread) 512)
|
||||
(logclear! (-> self mask) (process-mask pause menu progress))
|
||||
|
||||
|
||||
;; setup ourself
|
||||
(set! (-> self card) card-idx)
|
||||
(set! (-> self which) file-idx)
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
;; name in dgo: settings
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(#when PC_PORT
|
||||
(#when PC_PORT
|
||||
(define *progress-flava* -1)
|
||||
)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod update-from-engine ((this setting-data) (arg0 engine))
|
||||
"this goes through the list of desired setting changes in
|
||||
"this goes through the list of desired setting changes in
|
||||
the engine/connection list and updates the setting-data"
|
||||
(let ((conn (the-as connection (-> arg0 alive-list-end)))
|
||||
(s4-0 (-> arg0 alive-list-end prev0))
|
||||
@@ -281,7 +281,7 @@
|
||||
"Do a per-frame update of all settings"
|
||||
;; compute all settings
|
||||
(apply-settings this)
|
||||
|
||||
|
||||
;; now handle the special ones.
|
||||
(let ((gp-0 (-> this current)))
|
||||
(let ((s5-1 (-> this target)))
|
||||
@@ -324,7 +324,7 @@
|
||||
(set! (-> gp-0 language) (-> s5-1 language))
|
||||
(set-language (-> gp-0 language))
|
||||
)
|
||||
|
||||
|
||||
;; try to load music
|
||||
(when (and (!= (-> s5-1 music) (-> gp-0 music))
|
||||
(and (< 0.0 (-> *setting-control* current music-volume)) (zero? (rpc-busy? 1)) *sound-bank-1* *sound-bank-2*)
|
||||
@@ -341,7 +341,7 @@
|
||||
)
|
||||
(set! (-> gp-0 music) (-> s5-1 music))
|
||||
)
|
||||
|
||||
|
||||
;; set sound flava
|
||||
(set! (-> s5-1 sound-flava) (the-as uint (flava-lookup (-> gp-0 music) (the-as music-flava (-> s5-1 sound-flava)))))
|
||||
(set! (-> gp-0 sound-flava) (-> s5-1 sound-flava))
|
||||
@@ -351,7 +351,7 @@
|
||||
(sound-set-flava (-> gp-0 sound-flava))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; update display settings
|
||||
(when (!= (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
|
||||
(set! (-> gp-0 aspect-ratio) (-> s5-1 aspect-ratio))
|
||||
@@ -371,7 +371,7 @@
|
||||
(set! (-> *video-parms* display-dy) (* (/ (-> s5-1 screeny) 2) 2))
|
||||
(set! (-> *video-parms* set-video-mode) #t)
|
||||
)
|
||||
|
||||
|
||||
;; update display bg color
|
||||
(set! (-> gp-0 bg-a-speed) (-> s5-1 bg-a-speed))
|
||||
(set! (-> gp-0 bg-a-force) (-> s5-1 bg-a-force))
|
||||
@@ -391,14 +391,14 @@
|
||||
(set! (-> v1-60 bgcolor b) (the int (* 255.0 (-> gp-0 bg-b))))
|
||||
(set! (-> v1-60 pmode alp) (the int (* 255.0 (- 1.0 f0-39))))
|
||||
)
|
||||
|
||||
|
||||
;; ??
|
||||
(set! (-> *level* border?) (-> gp-0 border-mode))
|
||||
;; common pool texture page mask
|
||||
(set! (-> *texture-pool* common-page-mask) (-> gp-0 common-page))
|
||||
(set! (-> *cpad-list* cpads 0 buzz) (-> gp-0 vibration))
|
||||
|
||||
(case (-> gp-0 ocean-off)
|
||||
|
||||
(case (-> gp-0 ocean-off)
|
||||
((#t)
|
||||
(set! *ocean-off* #t)
|
||||
)
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
)
|
||||
((= (-> this current-stage) -1)
|
||||
;; state unknown
|
||||
(game-task none)
|
||||
(game-task none)
|
||||
)
|
||||
(else
|
||||
;; look up the current cstage's task
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
|
||||
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
|
||||
)
|
||||
:gif0 (new 'static 'gif-tag64
|
||||
:nloop 1
|
||||
:eop 1
|
||||
:gif0 (new 'static 'gif-tag64
|
||||
:nloop 1
|
||||
:eop 1
|
||||
:pre 1
|
||||
:prim (gs-prim-type sprite) ;; actually #b001101010110
|
||||
:flg (gif-flag packed)
|
||||
@@ -35,9 +35,9 @@
|
||||
:dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt))
|
||||
:vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1)
|
||||
)
|
||||
:gif0 (new 'static 'gif-tag64
|
||||
:nloop 1
|
||||
:eop 1
|
||||
:gif0 (new 'static 'gif-tag64
|
||||
:nloop 1
|
||||
:eop 1
|
||||
:pre 1
|
||||
:prim (gs-prim-type sprite) ;; actually #b00100010110
|
||||
:flg (gif-flag packed)
|
||||
|
||||
@@ -1801,7 +1801,7 @@
|
||||
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 (-> *video-parms* relative-y-scale)))
|
||||
|
||||
(draw-string str buf font-ctxt)
|
||||
|
||||
|
||||
;; un-scaling globals *font-default-matrix*, *video-params*
|
||||
(set! (-> *font-default-matrix* vector 0 x) orig-mat-x-scale)
|
||||
(set! (-> *font-default-matrix* vector 1 y) orig-mat-y-scale)
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
(defun generic-work-init ((arg0 generic-dma-foreground-sink))
|
||||
"Initialize generic-work."
|
||||
;; copy to scratchpad copy of the work
|
||||
(quad-copy! (the-as pointer (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work consts))
|
||||
(the-as pointer *generic-consts*)
|
||||
(quad-copy! (the-as pointer (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work consts))
|
||||
(the-as pointer *generic-consts*)
|
||||
27)
|
||||
;; set buffer addresses
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves gifbuf-adr)
|
||||
@@ -136,7 +136,7 @@
|
||||
;;(s.q! (+ a2-0 48) a3-0)
|
||||
(set! (-> a2-0 vector 3 quad) a3-0)
|
||||
)
|
||||
|
||||
|
||||
(if arg1
|
||||
;;(quad-copy! (the-as pointer (+ #x3190 #x70000000)) (the-as pointer arg1) 7)
|
||||
(quad-copy! (the pointer (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work lights)) (the-as pointer arg1) 7)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
(new 'static 'rgba :r #x40 :b #x40 :a #x80)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(reset! (-> *perf-stats* data 1))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves to-vu0-waits)
|
||||
(the-as uint 0)
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
;; first, initialize the generic renderer.
|
||||
(generic-initialize-without-sink (-> *math-camera* perspective) *default-lights*)
|
||||
|
||||
|
||||
;; next, initialize the merc-specific stuff.
|
||||
;; this give us function pointers to
|
||||
;; - mercneric-convert
|
||||
@@ -92,7 +92,7 @@
|
||||
;; - high-speed-reject
|
||||
;; and also loads the mercneric-vu0-block block with an offset of 280.
|
||||
(generic-merc-init-asm)
|
||||
|
||||
|
||||
;; set a limit, so we don't write off the end of the dma buffer.
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work in-buf merc shadow write-limit)
|
||||
(&+ (-> arg0 end) -65536)
|
||||
@@ -147,7 +147,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
; (let ((v1-44 (-> arg0 base)))
|
||||
; (.sync.l)
|
||||
; (.cache dxwbin v1-44 0)
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
)
|
||||
)
|
||||
(reset! (-> *perf-stats* data 2))
|
||||
|
||||
|
||||
(when (nonzero? arg2)
|
||||
(let ((s4-0 (-> arg1 base)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves basep) (the-as uint (-> arg1 base)))
|
||||
(generic-initialize arg0 (-> *math-camera* perspective) *default-lights*)
|
||||
(generic-tie-dma-to-spad-sync arg2 (-> (scratchpad-object terrain-context) work foreground generic-work in-buf tie input-a))
|
||||
; (let ((v1-24 (+ 716 (the-as int #x70000000))))
|
||||
|
||||
|
||||
;; set up tie memory layout.
|
||||
(let ((v1-24 (-> (scratchpad-object terrain-context) work foreground generic-work in-buf tie shadow)))
|
||||
(set! (-> v1-24 end-of-chain) (the-as uint 0))
|
||||
@@ -52,16 +52,16 @@
|
||||
(set! (-> v1-26 generic-interp-dproc) generic-interp-dproc) ;; todo
|
||||
(set! (-> v1-26 generic-no-light-dproc) generic-no-light-dproc) ;; todo
|
||||
)
|
||||
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color r)
|
||||
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color r)
|
||||
(the int (-> *time-of-day-context* current-sun env-color x)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color g)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color g)
|
||||
(the int (-> *time-of-day-context* current-sun env-color y)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color b)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color b)
|
||||
(the int (-> *time-of-day-context* current-sun env-color z)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color a)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color a)
|
||||
(the int (-> *time-of-day-context* current-sun env-color w)))
|
||||
|
||||
|
||||
; (let ((v1-27 *time-of-day-context*))
|
||||
; (let ((a0-26 (+ 16 (the-as int #x70000000))))
|
||||
; (.lvf vf1 (&-> v1-27 current-sun env-color quad))
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
(old-part-frame-counter time-frame)
|
||||
|
||||
;; timing stats for how fast the engine is currently running.
|
||||
(time-ratio float) ;; engine speed, 1.0 = full speed
|
||||
(time-ratio float) ;; engine speed, 1.0 = full speed
|
||||
(seconds-per-frame float) ;; 1/fps
|
||||
(frames-per-second float) ;; fps
|
||||
(time-factor float) ;; 6 on PAL, 5 on NTSC, "ticks" / frame
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; setup sky stuff
|
||||
(dotimes (s4-5 2)
|
||||
(make-sky-textures arg0 s4-5)
|
||||
|
||||
@@ -16397,4 +16397,4 @@
|
||||
#xf902fd03
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
(defun ocean-mid-setup-constants ((arg0 ocean-mid-constants))
|
||||
"Generate the ocean VU1 renderer constants in-place."
|
||||
|
||||
|
||||
;; the usual camera math
|
||||
(let ((v1-0 *math-camera*))
|
||||
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
|
||||
@@ -18,12 +18,12 @@
|
||||
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
|
||||
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3072.0)
|
||||
)
|
||||
|
||||
|
||||
;; is this 393216 the size of a triangle? (96 meters)
|
||||
(set-vector! (-> arg0 constants) 0.5 0.5 0.0 393216.0)
|
||||
(set-vector! (-> arg0 constants2) 0.5 0.5 1.0 0.0)
|
||||
|
||||
|
||||
|
||||
(let ((v1-3 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-3)
|
||||
@@ -266,7 +266,7 @@
|
||||
(set-vector! (-> arg0 index-table 6) 9 12 12 0)
|
||||
(set-vector! (-> arg0 index-table 7) 0 0 3 0)
|
||||
|
||||
|
||||
|
||||
(set-vector! (-> arg0 pos0) 0.0 0.0 0.0 1.0)
|
||||
(set-vector! (-> arg0 pos1) 393216.0 0.0 0.0 1.0)
|
||||
(set-vector! (-> arg0 pos2) 0.0 0.0 393216.0 1.0)
|
||||
@@ -520,7 +520,7 @@
|
||||
|
||||
(defun ocean-mid-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float))
|
||||
"Add DMA data to upload data needed to draw an ocean tile."
|
||||
|
||||
|
||||
;; calculate the location of the tile.
|
||||
(let ((gp-0 (new-stack-vector0)))
|
||||
(let ((v1-1 (-> *ocean-map* start-corner)))
|
||||
@@ -529,10 +529,10 @@
|
||||
(set! (-> gp-0 z) (+ (-> v1-1 z) (* 3145728.0 (the float arg1))))
|
||||
)
|
||||
(set! (-> gp-0 w) 1.0)
|
||||
|
||||
|
||||
;; compute combined matrix
|
||||
(ocean-mid-add-matrices arg0 gp-0)
|
||||
|
||||
|
||||
;; upload color.
|
||||
(let ((v1-4 (+ (the-as uint (-> *ocean-map* ocean-colors)) (* (+ (* 416 arg1) (* arg2 8)) 4))))
|
||||
(dotimes (a0-6 9)
|
||||
@@ -1008,7 +1008,7 @@
|
||||
|
||||
(defun sphere-cull-for-ocean ((arg0 vector))
|
||||
"NOTE: added in PC port"
|
||||
|
||||
|
||||
(local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
@@ -1027,7 +1027,7 @@
|
||||
(.lvf vf18 (&-> v1-5 plane 2 quad))
|
||||
(.lvf vf19 (&-> v1-5 plane 3 quad))
|
||||
)
|
||||
|
||||
|
||||
(.lvf vf10 (&-> arg0 quad))
|
||||
(.mul.x.vf acc vf16 vf10)
|
||||
(.add.mul.y.vf acc vf17 vf10 acc)
|
||||
@@ -1106,28 +1106,28 @@
|
||||
)
|
||||
(+! (-> p0 x) x0)
|
||||
(+! (-> p0 z) y0)
|
||||
|
||||
|
||||
(+! (-> p1 x) (+ x0 3145728.0))
|
||||
(+! (-> p1 z) y0)
|
||||
|
||||
|
||||
(+! (-> p2 x) x0)
|
||||
(+! (-> p2 z) (+ y0 3145728.0))
|
||||
|
||||
|
||||
(+! (-> p1s x) (+ x0 314572.0))
|
||||
(+! (-> p1s z) y0)
|
||||
|
||||
|
||||
(+! (-> p2s x) x0)
|
||||
(+! (-> p2s z) (+ y0 314572.0))
|
||||
|
||||
|
||||
(+! (-> p3 x) (+ x0 3145728.0))
|
||||
(+! (-> p3 z) (+ y0 3145728.0))
|
||||
|
||||
|
||||
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf) p0 p1s p2s color0)
|
||||
;; (add-debug-flat-triangle #t (bucket-id debug-no-zbuf) p3 p1 p2 color0)
|
||||
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) p0 p1 p2 color1)
|
||||
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) p3 p1 p2 color1)
|
||||
(format (clear *temp-string*) "o: ~d ~d ~d ~b" x y (+ (* 6 y) x) masks)
|
||||
|
||||
|
||||
(add-debug-text-3d
|
||||
#t
|
||||
(bucket-id debug-no-zbuf)
|
||||
@@ -1161,7 +1161,7 @@
|
||||
)
|
||||
;; upload VU1 program
|
||||
(dma-buffer-add-vu-function arg0 ocean-mid-block 1)
|
||||
|
||||
|
||||
;; set up base+offset for the VU1 program uploads
|
||||
(let* ((v1-3 arg0)
|
||||
(a0-6 (the-as object (-> v1-3 base)))
|
||||
@@ -1177,7 +1177,7 @@
|
||||
|
||||
;; run program to initialize VU1 renderer
|
||||
(ocean-mid-add-call arg0 0)
|
||||
|
||||
|
||||
;; set up VF registers for sphere culling.
|
||||
(let ((v1-5 *math-camera*))
|
||||
(.lvf vf16 (&-> v1-5 plane 0 quad))
|
||||
@@ -1190,7 +1190,7 @@
|
||||
(.lvf vf23 (&-> v1-5 guard-plane 3 quad))
|
||||
)
|
||||
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
|
||||
|
||||
|
||||
;; draw tiles!
|
||||
(let ((s5-0 (-> *math-camera* trans)))
|
||||
(dotimes (s4-0 6) ;; x?
|
||||
@@ -1231,8 +1231,8 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
;; for now, skip seams.
|
||||
;; when it's both on and cam is low
|
||||
(when (not (or *ocean-near-off* (< 196608.0 (fabs (-> *math-camera* trans y)))))
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
;; definition for symbol *ocean-texture-work*, type ocean-texture-work
|
||||
(define *ocean-texture-work*
|
||||
(define *ocean-texture-work*
|
||||
(new 'static 'ocean-texture-work
|
||||
:sprite-tmpl
|
||||
(new 'static 'dma-gif-packet
|
||||
@@ -77,7 +77,7 @@
|
||||
(set! (-> arg0 giftag regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyz2))
|
||||
)
|
||||
|
||||
|
||||
;; these are VU1 data addresses
|
||||
(set-vector! (-> arg0 buffers) 384 583 384 583)
|
||||
(set-vector! (-> arg0 dests) 782 881 782 881)
|
||||
|
||||
@@ -351,7 +351,7 @@
|
||||
|
||||
(defun shrub-init-frame ((arg0 dma-buffer) (arg1 gs-test))
|
||||
"Generate DMA to initialize to shrubbery renderer VU1 and GS."
|
||||
|
||||
|
||||
;; init VU1
|
||||
(shrub-do-init-frame arg0)
|
||||
;; init GS.
|
||||
@@ -475,11 +475,11 @@
|
||||
; (-> (the-as drawable-group (-> arg0 data 0)) length)
|
||||
; s3-0
|
||||
; )
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; NOTE: this part is completely rewritten for PC
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(when (logtest? *vu1-enable-user* (vu1-renderer-mask shrubbery))
|
||||
(let* ((s2-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
(s3-1 (-> s2-1 base))
|
||||
@@ -505,7 +505,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(read! (-> *perf-stats* data (perf-stat-bucket inst-shrub)))
|
||||
(reset! (-> *perf-stats* data (perf-stat-bucket proto-shrub)))
|
||||
; (draw-prototype-inline-array-shrub s4-0 s3-0)
|
||||
|
||||
@@ -178,10 +178,10 @@
|
||||
(vf31 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
|
||||
|
||||
(with-vf (vf13 vf14 vf23 vf24 vf25 vf26 vf28 vf29 vf30 vf31)
|
||||
:rw 'write
|
||||
|
||||
|
||||
(let ((v1-0 *math-camera*)
|
||||
(a0-0 (new-stack-vector0))
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
(let ((s5-0 0))
|
||||
(while (!= (-> this init-specs s5-0 field) (sp-field-id spt-end))
|
||||
(let ((init-spec (-> this init-specs s5-0)))
|
||||
(format #t "~T~S : ~F / #x~X / ~D~%"
|
||||
(format #t "~T~S : ~F / #x~X / ~D~%"
|
||||
(enum->string sp-field-id (-> init-spec field))
|
||||
(-> init-spec initial-valuef)
|
||||
(-> init-spec initial-valuef)
|
||||
@@ -231,7 +231,7 @@
|
||||
|
||||
(defun particle-setup-adgif ((arg0 adgif-shader) (arg1 texture-id))
|
||||
"Set up the adgif for a particle and the given texture."
|
||||
|
||||
|
||||
;; grab the texture
|
||||
(let ((a1-1 (lookup-texture-by-id arg1)))
|
||||
;; set up some texture stuff
|
||||
@@ -242,18 +242,18 @@
|
||||
(adgif-shader<-texture! arg0 a1-1)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; we'll use the usual tex0/tex1/miptbp1
|
||||
(set! (-> arg0 prims 1) (gs-reg64 tex0-1))
|
||||
(set! (-> arg0 prims 3) (gs-reg64 tex1-1))
|
||||
(set! (-> arg0 prims 5) (gs-reg64 miptbp1-1))
|
||||
|
||||
|
||||
;; clamp will use something weird
|
||||
(set! (-> arg0 clamp-reg) (gs-reg64 zbuf-1))
|
||||
;; this is sometimes "gs-miptbp" instead.
|
||||
(set! (-> arg0 prims 9) (gs-reg64 alpha-1))
|
||||
(set! (-> arg0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
|
||||
|
||||
;; og:preserve-this clamp is actually zbuf for sparticles, not gs-clamp.
|
||||
(set! (-> arg0 clamp) (the gs-clamp (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24) :zmsk #x1)))
|
||||
0
|
||||
@@ -283,14 +283,14 @@
|
||||
(defun sp-queue-launch ((arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 vector))
|
||||
"Queue a launch from the given launcher, at the given position."
|
||||
(let ((v1-0 *sp-launch-queue*))
|
||||
|
||||
|
||||
;; og:preserve-this constant
|
||||
;; make sure we have room in the queue
|
||||
(when (= (-> v1-0 in-use) SPARTICLE_QUEUE_SIZE)
|
||||
(format 0 "ERROR: sp-launch-particles called during processing, and queue is full~%")
|
||||
(return 0)
|
||||
)
|
||||
|
||||
|
||||
;; make a new entry in the queue
|
||||
(let ((a3-5 (-> v1-0 queue (-> v1-0 in-use))))
|
||||
(set! (-> a3-5 sp-system) arg0)
|
||||
@@ -310,7 +310,7 @@
|
||||
(let ((s2-0 (new 'stack-no-clear 'matrix))
|
||||
(s3-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
|
||||
|
||||
;; use the field-init-spec to create a totally new launchinfo.
|
||||
(sp-init-fields!
|
||||
(the-as (pointer float) (-> s5-0 launchrot))
|
||||
@@ -319,13 +319,13 @@
|
||||
(sp-field-id launch-fields-end)
|
||||
#t
|
||||
)
|
||||
|
||||
;; rotate vel to include the launchrot and conerot
|
||||
|
||||
;; rotate vel to include the launchrot and conerot
|
||||
(matrix-rotate-xyz! s2-0 (-> s5-0 launchrot))
|
||||
(vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s2-0)
|
||||
(matrix-rotate-xyz! s2-0 (-> s5-0 conerot))
|
||||
(vector3s-matrix*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s2-0)
|
||||
|
||||
|
||||
;; cone axis (pre-rotation to local, y is default, but there's a flag for z)
|
||||
(if (logtest? (sp-cpuinfo-flag launch-along-z) (-> arg1 flags))
|
||||
(set-vector! s3-0 0.0 0.0 (-> s5-0 coneradius) 1.0)
|
||||
@@ -338,7 +338,7 @@
|
||||
(+! (-> arg0 launchrot y) (-> s3-0 y))
|
||||
(+! (-> arg0 launchrot z) (-> s3-0 z))
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; if desired, apply addition y rotation.
|
||||
(when (!= (-> s5-0 rotate-y) 0.0)
|
||||
@@ -346,7 +346,7 @@
|
||||
(matrix-rotate-y! s3-1 (-> s5-0 rotate-y))
|
||||
(vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s3-1)
|
||||
(vector3s-rotate*! (the-as vector3s (-> arg1 vel-sxvel)) (the-as vector3s (-> arg1 vel-sxvel)) s3-1)
|
||||
|
||||
|
||||
;; optionally rotate acc.
|
||||
(if (not (logtest? (sp-cpuinfo-flag use-global-acc) (-> arg1 flags)))
|
||||
(vector3s-rotate*! (the-as vector3s (-> arg1 acc)) (the-as vector3s (-> arg1 acc)) s3-1)
|
||||
@@ -372,7 +372,7 @@
|
||||
(let ((a1-1 (new 'stack-no-clear 'vector))
|
||||
(s5-0 (new 'stack-no-clear 'quaternion))
|
||||
)
|
||||
|
||||
|
||||
;; convert conerot to a quaternion
|
||||
(set-vector!
|
||||
a1-1
|
||||
@@ -400,7 +400,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; scale the rate of rot-syvel (it's multiplied by a rate already)
|
||||
(cond
|
||||
(*sp-60-hz*
|
||||
@@ -459,7 +459,7 @@
|
||||
|
||||
;; for whatever reason the enemy death launch stuff is defined here.
|
||||
;; it doesn't use the adgif cache.
|
||||
;; but it's a nice example for how to set the
|
||||
;; but it's a nice example for how to set the
|
||||
|
||||
(define *death-adgif* (the-as adgif-shader #f))
|
||||
|
||||
@@ -480,7 +480,7 @@
|
||||
(let ((v1-0 #x437f0000))
|
||||
(.mov vf31 v1-0)
|
||||
)
|
||||
|
||||
|
||||
(let ((s5-0 (new 'stack-no-clear 'sprite-vec-data-2d))
|
||||
;; get a particle, from the particle system
|
||||
;; this gets us a "cpuinfo", which is the state of a particle.
|
||||
@@ -490,7 +490,7 @@
|
||||
;; if it fails, give up.
|
||||
(return 0)
|
||||
)
|
||||
|
||||
|
||||
(let* ((a1-2 (-> arg1 init-specs 0))
|
||||
;; initialize the sprite fields. this is done to a temporary structure on the stack
|
||||
;; the death particle effect has some special initialization stuff below that will
|
||||
@@ -504,7 +504,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; initialize the cpu fields, this is the initial particle state.
|
||||
(sp-init-fields!
|
||||
(&-> gp-0 omega)
|
||||
@@ -514,11 +514,11 @@
|
||||
#t
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; convert rotations
|
||||
(set! (-> s5-0 matrix) 0)
|
||||
(set! (-> s5-0 rot) (the float (sar (shl (the int (-> s5-0 rot)) 48) 48)))
|
||||
|
||||
|
||||
;; convert color/position.
|
||||
(.lvf vf4 (&-> s5-0 color quad))
|
||||
(.lvf vf5 (&-> s5-0 x-y-z-sx quad))
|
||||
@@ -526,14 +526,14 @@
|
||||
(.add.vf vf5 vf5 vf30 :mask #b111)
|
||||
(.svf (&-> s5-0 color quad) vf4)
|
||||
(.svf (&-> s5-0 x-y-z-sx quad) vf5)
|
||||
|
||||
|
||||
(when (not *death-adgif*)
|
||||
;; first time we get here, set up the adgif shader.
|
||||
(set! *death-adgif* (new 'static 'adgif-shader))
|
||||
(particle-adgif *death-adgif* (new 'static 'texture-id :index #x18 :page #x2))
|
||||
(set! (-> *death-adgif* alpha) (new 'static 'gs-alpha :b #x2 :d #x1))
|
||||
)
|
||||
|
||||
|
||||
;; copy the death-adgif to the adgif of our particle
|
||||
(let ((v1-14 (-> *death-adgif* quad 0 quad)))
|
||||
(set! (-> gp-0 adgif quad 0 quad) v1-14)
|
||||
@@ -550,7 +550,7 @@
|
||||
(let ((v1-22 (-> *death-adgif* quad 4 quad)))
|
||||
(set! (-> gp-0 adgif quad 4 quad) v1-22)
|
||||
)
|
||||
|
||||
|
||||
;; set up some color stuff.
|
||||
(.lvf vf4 (&-> (-> *time-of-day-context* current-prt-color) quad))
|
||||
(.lvf vf5 (&-> s5-0 color quad))
|
||||
@@ -559,11 +559,11 @@
|
||||
(.mul.vf vf6 vf6 vf4 :mask #b111)
|
||||
(.svf (&-> s5-0 color quad) vf5)
|
||||
(.svf (&-> gp-0 fade quad) vf6)
|
||||
|
||||
;;
|
||||
|
||||
;;
|
||||
(set! (-> gp-0 key) (the-as sparticle-launch-control 0))
|
||||
(set! (-> gp-0 binding) #f)
|
||||
|
||||
|
||||
;; copy the sprite data
|
||||
(let ((v1-26 (-> gp-0 sprite)))
|
||||
(.lvf vf1 (&-> s5-0 x-y-z-sx quad))
|
||||
@@ -574,11 +574,11 @@
|
||||
(.sub.w.vf vf3 vf0 vf0 :mask #b1000)
|
||||
(.svf (&-> v1-26 color quad) vf3)
|
||||
)
|
||||
|
||||
|
||||
;; we're done!
|
||||
(logior! (-> gp-0 flags) (sp-cpuinfo-flag ready-to-launch))
|
||||
(set! (-> gp-0 cache-alpha) (-> s5-0 a))
|
||||
|
||||
|
||||
;; I'm not really sure how the particles get launched from here yet.
|
||||
)
|
||||
0
|
||||
@@ -707,7 +707,7 @@
|
||||
|
||||
(defun sp-relaunch-particle-3d ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d))
|
||||
"relaunch a 3d particle"
|
||||
|
||||
|
||||
;; do all the 3d-specific stuff here, the general relaunch only does 2d fields.
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -797,7 +797,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; a launch-control is an instance of a particle effect group. it holds the definition and the state.
|
||||
;; the launch-controls are always associated with a process. this allows the memory to be reclaimed once the
|
||||
;; the launch-controls are always associated with a process. this allows the memory to be reclaimed once the
|
||||
;; particles are despawned.
|
||||
|
||||
(defmethod initialize ((this sparticle-launch-control) (arg0 sparticle-launch-group) (arg1 process))
|
||||
@@ -811,10 +811,10 @@
|
||||
(set! (-> this matrix) 0)
|
||||
(set! (-> this last-spawn-frame) (the-as int (+ (-> *display* real-actual-frame-counter) (seconds -0.007))))
|
||||
(set! (-> this last-spawn-time) 0)
|
||||
|
||||
|
||||
;; iterate through the effects in the group
|
||||
(dotimes (s3-0 (-> arg0 length))
|
||||
|
||||
|
||||
(let* ((a0-2 (-> arg0 launcher s3-0)) ;; the group-item (definition of the effect)
|
||||
(a1-2 (-> *part-id-table* (-> a0-2 launcher))) ;; the actual effect for the group item
|
||||
(v1-9 (-> this data s5-0)) ;; our state for this particular instance of this effect within the group.
|
||||
@@ -873,7 +873,7 @@
|
||||
|
||||
(defmethod kill-and-free-particles ((this sparticle-launch-control))
|
||||
"kill all the particles"
|
||||
|
||||
|
||||
;; clear the flag.
|
||||
(countdown (v1-0 (-> this length))
|
||||
(let ((a0-3 (-> this data v1-0)))
|
||||
@@ -882,7 +882,7 @@
|
||||
)
|
||||
(set! (-> this local-clock) 0)
|
||||
(set! (-> this fade) 1.0)
|
||||
|
||||
|
||||
;; kill the particles (let them go back to the sparticle system.)
|
||||
(kill-all-particles-with-key this)
|
||||
;; release matrices
|
||||
@@ -916,7 +916,7 @@
|
||||
;; sphere with offset
|
||||
(let ((gp-1 (vector+! (new 'stack-no-clear 'vector) arg0 (the-as vector (-> v1-0 bounds)))))
|
||||
(set! (-> gp-1 w) f0-0)
|
||||
|
||||
|
||||
;; debug draw sphere
|
||||
(if (and *display-actor-vis*
|
||||
(or (not *display-actor-anim*)
|
||||
@@ -931,7 +931,7 @@
|
||||
(new 'static 'rgba :g #xff :a #x80)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; og:preserve-this can we see it?
|
||||
(#if (not PC_PORT)
|
||||
(sphere-in-view-frustum? (the-as sphere gp-1))
|
||||
@@ -950,7 +950,7 @@
|
||||
|
||||
(defmethod spawn ((this sparticle-launch-control) (arg0 vector))
|
||||
(set! (-> this center quad) (-> arg0 quad))
|
||||
|
||||
|
||||
;; og:preserve-this
|
||||
;; check if we are visible (remove this check to force particles to be drawn.)
|
||||
(if (not (or (is-visible? this arg0)
|
||||
@@ -962,7 +962,7 @@
|
||||
(let ((s4-0 *particle-300hz-timer*)
|
||||
(s5-0 (-> this last-spawn-time))
|
||||
)
|
||||
|
||||
|
||||
;; weird stuff for frame counting
|
||||
(let ((v1-8 (-> *display* real-actual-frame-counter)))
|
||||
(if (!= v1-8 (+ (-> this last-spawn-frame) 1))
|
||||
@@ -976,7 +976,7 @@
|
||||
(+! (-> this local-clock) (logand (the-as int (-> *sp-frame-time* x)) 255))
|
||||
(set! s4-0 (-> this local-clock))
|
||||
)
|
||||
|
||||
|
||||
(let ((f30-0 (vector-vector-distance arg0 (math-camera-pos)))
|
||||
;; hour mask
|
||||
(s3-1 (ash 1 (if *time-of-day-proc*
|
||||
@@ -989,12 +989,12 @@
|
||||
(if (nonzero? (-> this matrix)) ;; if we have an additional matrix, say we're at the camera so we always draw.
|
||||
(set! f30-0 0.0)
|
||||
)
|
||||
|
||||
|
||||
;; og:preserve-this if we have ps2 particles off, say we're at the camera
|
||||
(with-pc
|
||||
(if (not (-> *pc-settings* ps2-parts?))
|
||||
(set! f30-0 0.0)))
|
||||
|
||||
|
||||
;; loop over particles in the group.
|
||||
(let ((s2-1 (-> this length)))
|
||||
(while (begin (label cfg-79) (nonzero? s2-1))
|
||||
@@ -1012,18 +1012,18 @@
|
||||
(if (!= (-> v1-29 falloff-to) 0.0)
|
||||
(set! f0-2 (- 1.0 (/ f30-0 (-> v1-29 falloff-to))))
|
||||
)
|
||||
|
||||
|
||||
;; reject if bad type
|
||||
(let ((a0-26 sparticle-launcher))
|
||||
(b! (!= (-> a1-4 type) a0-26) cfg-78 :delay (nop!))
|
||||
)
|
||||
|
||||
|
||||
;; og:preserve-this PAL patch here
|
||||
;; ??
|
||||
(b! (zero? (logand (-> v1-29 flags) (sp-group-item-flag launch-asap bit6)))
|
||||
cfg-36 :delay (nop!)
|
||||
)
|
||||
|
||||
|
||||
(when (or (zero? (logand (-> a3-0 flags) (sp-launch-state-flags particles-active)))
|
||||
(logtest? (-> v1-29 flags) (sp-group-item-flag bit6))
|
||||
)
|
||||
@@ -1045,10 +1045,10 @@
|
||||
)
|
||||
)
|
||||
(b! #t cfg-77 :delay (nop!))
|
||||
|
||||
|
||||
|
||||
|
||||
(label cfg-36)
|
||||
|
||||
|
||||
;; reject if bad time of day
|
||||
(when (logtest? s3-1 (-> v1-29 hour-mask))
|
||||
0
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
(defun sprite-init-distorter ((dma-buff dma-buffer) (frame-base-pointer uint))
|
||||
"Set up DMA for setting up the sprite-distorter renderer"
|
||||
;;(format #t "distorter: ~d~%" (-> *sprite-aux-list* entry))
|
||||
|
||||
|
||||
;; set up GS registers
|
||||
(dma-buffer-add-gs-set dma-buff
|
||||
;; dont update zbuffer
|
||||
@@ -147,8 +147,8 @@
|
||||
(&+! (-> dma-buff base) 16)
|
||||
)
|
||||
(let ((aspect-vec (the-as vector (-> dma-buff base))))
|
||||
(set-vector! aspect-vec
|
||||
(-> *sprite-distorter-sine-tables* aspx)
|
||||
(set-vector! aspect-vec
|
||||
(-> *sprite-distorter-sine-tables* aspx)
|
||||
(-> *sprite-distorter-sine-tables* aspy)
|
||||
0.0
|
||||
0.0
|
||||
|
||||
@@ -658,7 +658,7 @@
|
||||
:imm (new 'static 'vif-unpack-imm :flg 1 :addr 1))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
#|
|
||||
;(when (= mscal-addr 3)
|
||||
(dotimes (i num-sprites)
|
||||
@@ -706,7 +706,7 @@
|
||||
;; and use the other mpg.
|
||||
(set! mscal-addr 109)
|
||||
)
|
||||
|
||||
|
||||
;;(format #t "group ~d 2D ~d~%" group-idx (-> sprites num-valid group-idx))
|
||||
|
||||
;; loop over chunks
|
||||
|
||||
@@ -47,22 +47,22 @@
|
||||
(defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag) (lev level))
|
||||
"Draw the normal tfrag tree! Added the lev argument for time-of-day integer times"
|
||||
(local-vars (r0-0 none) (a0-20 int) (a0-22 int) (a0-38 int) (a0-40 int) (sv-16 (pointer uint8)))
|
||||
|
||||
|
||||
|
||||
|
||||
(when (logtest? *vu1-enable-user* (vu1-renderer-mask tfrag))
|
||||
|
||||
|
||||
;; first, do draw node culling.
|
||||
;; the culling is done in batches, doing all nodes at one depth before going to the enxt.
|
||||
;; only arrays of draw nodes can be culled - tfragments themselves can't (they are the wrong size)
|
||||
|
||||
|
||||
|
||||
|
||||
(let ((s5-0 (+ (-> arg0 length) -1))) ;; get the number of trees with draw-nodes (see doc, the last one is always tfragments)
|
||||
|
||||
|
||||
;; TODO
|
||||
#|
|
||||
(when (nonzero? s5-0) ;; only if we have draw-nodes (levels like INT have only like 2 tfrags)
|
||||
(dotimes (s4-0 s5-0) ;; loop over tree depths
|
||||
|
||||
|
||||
;; not sure of the details yet, but we take two levels as inputs
|
||||
(let* ((v1-7 (-> arg0 arrays s4-0))
|
||||
(a0-4 (-> arg0 arrays (+ s4-0 1)))
|
||||
@@ -81,16 +81,16 @@
|
||||
)
|
||||
)
|
||||
|#
|
||||
|
||||
|
||||
;; draw, using the full list of all tfrags (not tree format)
|
||||
(let* ((v1-13 (the-as drawable-inline-array-tfrag (-> arg0 arrays s5-0)))
|
||||
(s4-1 (-> v1-13 data))
|
||||
(s3-0 (-> v1-13 length))
|
||||
)
|
||||
|
||||
|
||||
;; pointer to vis data for the first tfrag
|
||||
(set! sv-16 (&-> (scratchpad-object terrain-context) work background vis-list (/ (-> s4-1 0 id) 8)))
|
||||
|
||||
|
||||
;; all DMA
|
||||
(let ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf base)))
|
||||
;; (format *stdcon* " #x~X~%" s5-1)
|
||||
@@ -98,31 +98,31 @@
|
||||
(let* ((s1-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
(s2-0 (-> s1-0 base))
|
||||
)
|
||||
|
||||
|
||||
;; clear stats
|
||||
(set! (-> *tfrag-work* wait-to-spr) (the-as uint 0))
|
||||
(set! (-> *tfrag-work* wait-from-spr) (the-as uint 0))
|
||||
|
||||
|
||||
;; initialize dma buffer
|
||||
(tfrag-init-buffer
|
||||
(tfrag-init-buffer
|
||||
s1-0
|
||||
(new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) :aref #x26 :zte #x1 :ztst (gs-ztest greater-equal))
|
||||
0
|
||||
lev
|
||||
)
|
||||
|
||||
|
||||
;; do the draw!
|
||||
(reset! (-> *perf-stats* data 5))
|
||||
;;(format 0 "DRAW: ~D~%" s3-0)
|
||||
;; (draw-inline-array-tfrag sv-16 (the-as drawable-inline-array s4-1) s3-0 s1-0)
|
||||
(read! (-> *perf-stats* data 5))
|
||||
|
||||
|
||||
;; update stats for the draw
|
||||
(update-wait-stats (-> *perf-stats* data 5) (the-as uint 0) (-> *tfrag-work* wait-to-spr) (-> *tfrag-work* wait-from-spr))
|
||||
|
||||
|
||||
;; finish dma buffer
|
||||
(tfrag-end-buffer s1-0)
|
||||
|
||||
|
||||
;; close dma packet
|
||||
(let ((a3-3 (-> s1-0 base)))
|
||||
(let ((v1-38 (the-as object (-> s1-0 base))))
|
||||
@@ -142,8 +142,8 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
;; (format *stdcon* " #x~X~%" (-> *display* frames (-> *display* on-screen) frame global-buf base))
|
||||
;; DMA for TFRAG NEAR
|
||||
; (let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
@@ -180,7 +180,7 @@
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
|
||||
|
||||
;; DMA memory stats
|
||||
(let ((v1-69 *dma-mem-usage*))
|
||||
(when (nonzero? v1-69)
|
||||
@@ -264,7 +264,7 @@
|
||||
(set! (-> (the-as dma-packet v1-34) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> s2-0 base) (&+ (the-as pointer v1-34) 16))
|
||||
)
|
||||
|
||||
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(the-as
|
||||
@@ -378,7 +378,7 @@
|
||||
)
|
||||
(when (logtest? *vu1-enable-user* (vu1-renderer-mask trans-tfrag))
|
||||
(let ((s5-0 (+ (-> arg0 length) -1)))
|
||||
#| TODO
|
||||
#| TODO
|
||||
(when (nonzero? s5-0)
|
||||
(dotimes (s4-0 s5-0)
|
||||
(let* ((v1-7 (-> arg0 arrays s4-0))
|
||||
@@ -413,7 +413,7 @@
|
||||
)
|
||||
)
|
||||
)|#
|
||||
|
||||
|
||||
(let* ((v1-13 (-> arg0 arrays s5-0))
|
||||
(s5-1 (&+ v1-13 32))
|
||||
(s4-1 (-> v1-13 length))
|
||||
@@ -426,7 +426,7 @@
|
||||
(set! (-> *tfrag-work* wait-from-spr) (the-as uint 0))
|
||||
(tfrag-init-buffer s2-0 (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal)) 1 lev)
|
||||
(reset! (-> *perf-stats* data 5))
|
||||
|
||||
|
||||
;; (draw-inline-array-tfrag sv-16 s5-1 s4-1 s2-0)
|
||||
(update-wait-stats
|
||||
(-> *perf-stats* data 5)
|
||||
@@ -456,7 +456,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
#|
|
||||
(let*
|
||||
((s2-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
@@ -999,7 +999,7 @@
|
||||
(defmethod debug-draw ((this tfragment) (arg0 drawable) (arg1 display-frame))
|
||||
(-> arg1 global-buf)
|
||||
(edge-debug-lines (-> this debug-data debug-lines))
|
||||
|
||||
|
||||
(add-debug-sphere #t (bucket-id debug) (-> this bsphere) (-> this bsphere w) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
|
||||
;;(add-debug-x #t (bucket-id debug) (-> this bsphere) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
|
||||
(none)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
;; definition for symbol *instance-tie-work*, type instance-tie-work
|
||||
|
||||
;; helpful constants for the instance drawing EE asm.
|
||||
(define *instance-tie-work*
|
||||
(define *instance-tie-work*
|
||||
(new 'static 'instance-tie-work
|
||||
:wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0)
|
||||
:constant (new 'static 'vector :x 4096.0 :y 128.0)
|
||||
@@ -45,7 +45,7 @@
|
||||
(set! (-> *instance-tie-work* upload-color-ret vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1))
|
||||
|
||||
;; helpful constants for the prototype drawing EE asm
|
||||
(define *prototype-tie-work*
|
||||
(define *prototype-tie-work*
|
||||
(new 'static 'prototype-tie-work
|
||||
:upload-palette-0 (new 'static 'dma-packet
|
||||
:dma (new 'static 'dma-tag :id (dma-tag-id cnt))
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
(defmethod login ((this tie-fragment))
|
||||
"Initialize the shaders for a tie-fragment"
|
||||
|
||||
|
||||
;; the gif data is just adgif shaders, each are 5 qw's
|
||||
(let ((s5-0 (-> this gif-ref))
|
||||
(s4-0 (/ (-> this tex-count) (the-as uint 5)))
|
||||
@@ -103,12 +103,12 @@ this
|
||||
(+! (-> arg0 data 0 used) v1-7)
|
||||
(+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15)))
|
||||
)
|
||||
|
||||
|
||||
;; do our drawables
|
||||
(dotimes (s3-0 (-> this length))
|
||||
(mem-usage (-> this data s3-0) arg0 arg1)
|
||||
)
|
||||
|
||||
|
||||
;; do our prototypes, but with a flag set!
|
||||
(mem-usage (-> this prototypes prototype-array-tie) arg0 (logior arg1 1))
|
||||
this
|
||||
@@ -141,7 +141,7 @@ this
|
||||
(set! this this)
|
||||
(goto cfg-13)
|
||||
)
|
||||
|
||||
|
||||
;; not an instance, count the memory of the prototype.
|
||||
(set! (-> arg0 length) (max 18 (-> arg0 length)))
|
||||
(set! (-> arg0 data 9 name) "tie-fragment")
|
||||
@@ -209,12 +209,12 @@ this
|
||||
(let ((s3-0 (-> this bucket-ptr)))
|
||||
;; unused
|
||||
(+ (-> arg0 data 19 used) (-> arg0 data 20 used) (-> arg0 data 21 used) (-> arg0 data 22 used))
|
||||
|
||||
|
||||
;; loop over all 4 possible geometries
|
||||
(dotimes (s2-0 4)
|
||||
(let ((a0-10 (-> s3-0 geometry-override s2-0)))
|
||||
(when (nonzero? a0-10) ;; only if we actually have it.
|
||||
(mem-usage a0-10 arg0
|
||||
(mem-usage a0-10 arg0
|
||||
(logior (logior (cond ;; based on which geom we are, pick the right color bucket.
|
||||
((= s2-0 1) 4)
|
||||
((= s2-0 2) 8)
|
||||
@@ -300,11 +300,11 @@ this
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun tie-init-consts ((arg0 tie-consts) (arg1 int))
|
||||
"Initialize TIE constants. arg1 enables alpha blending"
|
||||
|
||||
|
||||
;; set the adgif shader tag (just 5x a+d's)
|
||||
(set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
|
||||
|
||||
;; based on the menu drawing mode, create the template tag for geometry.
|
||||
(cond
|
||||
((zero? *subdivide-draw-mode*) ;; normal textured
|
||||
@@ -344,12 +344,12 @@ this
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; the main drawing tag: st, rgbaq, xyzf per vertex (same in all draws modes)
|
||||
(set! (-> arg0 strgif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
|
||||
|
||||
;; some magic constants
|
||||
(let ((f1-0 8388894.0)
|
||||
(f2-0 8389078.0)
|
||||
@@ -367,14 +367,14 @@ this
|
||||
(set! (-> arg0 clrbufs vector4w y) 242)
|
||||
(set! (-> arg0 clrbufs vector4w z) 198)
|
||||
(set! (-> arg0 clrbufs vector4w w) 242)
|
||||
|
||||
|
||||
;; looks like tie can toggle on and off alpha testing during the draw
|
||||
;; tra = transparent, def = default?
|
||||
(set! (-> arg0 atestgif tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
||||
(set! (-> arg0 atestgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> arg0 atest-tra cmd) (gs-reg test-1))
|
||||
(set! (-> arg0 atest-tra data)
|
||||
(the uint
|
||||
(the uint
|
||||
(new 'static 'gs-test
|
||||
:ate #x1
|
||||
:atst (gs-atest greater-equal)
|
||||
@@ -388,7 +388,7 @@ this
|
||||
(set! (-> arg0 atest-def data)
|
||||
(the uint (new 'static 'gs-test :atst (gs-atest not-equal) :zte #x1 :ztst (gs-ztest greater-equal)))
|
||||
)
|
||||
|
||||
|
||||
;; more magic constants
|
||||
(set! (-> arg0 misc vector4w x) 0)
|
||||
(set! (-> arg0 misc vector4w y) -1)
|
||||
@@ -400,7 +400,7 @@ this
|
||||
(when (logtest? *vu1-enable-user* (vu1-renderer-mask tie))
|
||||
;; add the tie code
|
||||
(dma-buffer-add-vu-function arg0 tie-vu1-block 1)
|
||||
|
||||
|
||||
;; set up the given gs-test register
|
||||
(let* ((v1-3 arg0)
|
||||
(a0-2 (the-as object (-> v1-3 base)))
|
||||
@@ -450,7 +450,7 @@ this
|
||||
(set! (-> (the-as dma-packet a0-12) vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
||||
(set! (-> v1-9 base) (&+ (the-as pointer a0-12) 16))
|
||||
)
|
||||
|
||||
|
||||
;; initialize the VIF's ROW register
|
||||
(let* ((v1-10 arg0)
|
||||
(a0-14 (the-as object (-> v1-10 base)))
|
||||
@@ -507,7 +507,7 @@ this
|
||||
(set! (-> (the-as (pointer gs-reg64) a1-4) 1) (gs-reg64 test-1))
|
||||
(set! (-> v1-5 base) (&+ a1-4 16))
|
||||
)
|
||||
|
||||
|
||||
;; restore the stmask register
|
||||
(let* ((v1-6 arg0)
|
||||
(a1-6 (the-as object (-> v1-6 base)))
|
||||
@@ -517,7 +517,7 @@ this
|
||||
(set! (-> (the-as dma-packet a1-6) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> v1-6 base) (&+ (the-as pointer a1-6) 16))
|
||||
)
|
||||
|
||||
|
||||
;; this calls a TIE program that... does nothing?
|
||||
(let* ((v1-7 arg0)
|
||||
(a0-1 (-> v1-7 base))
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
(-> (scratchpad-object terrain-bsp :offset TERRAIN_BSP_SCRATCHPAD) lev-index)
|
||||
1
|
||||
)
|
||||
|
||||
|
||||
;; 2
|
||||
(foreground-engine-execute
|
||||
(-> this level foreground-draw-engine 2)
|
||||
@@ -333,7 +333,7 @@
|
||||
(defmethod debug-draw ((this bsp-header) (arg0 drawable) (arg1 display-frame))
|
||||
"This is some sort of debugging thing. It calls debug-draw on the drawables
|
||||
with the scratchpad and vfs set up."
|
||||
|
||||
|
||||
(let ((s4-0 (-> this level)))
|
||||
;; set up some stuff in the scratchpad
|
||||
(set! (-> (scratchpad-object terrain-bsp :offset TERRAIN_BSP_SCRATCHPAD) lev-index) (-> s4-0 index))
|
||||
@@ -606,7 +606,7 @@
|
||||
(when bsp-hdr
|
||||
(let* ((table-size (-> bsp-hdr texture-remap-table-len)) ;; in 64-bit entries
|
||||
(table-data-ptr (-> bsp-hdr texture-remap-table))
|
||||
(table-data-start table-data-ptr)
|
||||
(table-data-start table-data-ptr)
|
||||
(mask1 (the-as uint #xfffffff8)) ;; mask for table entry addresses
|
||||
(masked-tex-id (logand (the-as uint #xffffff00) tex-id)) ;; bits of tex-id we care about
|
||||
(table-data-end (&+ table-data-start (* table-size 8)))
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
"Update the vis-bits for the level with the given vis info.
|
||||
arg1 unused. if the vis-file flag isn't set, will use arg2 as vis data."
|
||||
(local-vars (t0-3 uint128) (vis-buffer object))
|
||||
|
||||
|
||||
(let* ((cam-leaf-idx (-> vis-info from-bsp current-leaf-idx)) ;; current bsp leaf of camera
|
||||
(curr-vis-str (-> vis-info current-vis-string)) ;; currently loaded vis-string.
|
||||
(desired-vis-str (-> vis-info vis-string cam-leaf-idx)) ;; vis-string offset for bsp leaf.
|
||||
@@ -126,7 +126,7 @@
|
||||
0
|
||||
(+ 16 #x70000000)
|
||||
(+ 2064 #x70000000)
|
||||
|
||||
|
||||
;; this is the same string we asked for last time.
|
||||
(when (= curr-vis-str desired-vis-str)
|
||||
(cond
|
||||
@@ -147,7 +147,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; wait for any pending load to finish before trying to change things.
|
||||
(when (logtest? (vis-info-flag waiting-for-iop-to-ee) (-> vis-info flags))
|
||||
(when (check-busy *ramdisk-rpc*)
|
||||
@@ -155,7 +155,7 @@
|
||||
)
|
||||
(logclear! (-> vis-info flags) (vis-info-flag waiting-for-iop-to-ee))
|
||||
)
|
||||
|
||||
|
||||
;; ok, we can now change the current string and request from iop.
|
||||
(set! (-> vis-info current-vis-string) desired-vis-str)
|
||||
;; this branch picks between .VIS file ramdisk and BSP file visibility data.
|
||||
@@ -165,12 +165,12 @@
|
||||
(set! vis-buffer (the-as (pointer uint8) (+ arg2 desired-vis-str)))
|
||||
(b! #t cfg-27 :delay (nop!))
|
||||
(label cfg-15)
|
||||
|
||||
|
||||
;; start a ramdisk load. This should have already been done as part of level loading anyway.
|
||||
;; so this will just get the ramdisk file ID.
|
||||
(let ((vis-load-result (vis-load this)))
|
||||
(b! (nonzero? vis-load-result) cfg-21)
|
||||
|
||||
|
||||
;; ramdisk failed, make everything visible.
|
||||
(let* ((dest-bits (-> vis-info vis-bits))
|
||||
(len (-> this bsp visible-list-length))
|
||||
@@ -212,8 +212,8 @@
|
||||
)
|
||||
(set! result #f) ;; this takes time, so quit and report that we failed.
|
||||
(b! #t cfg-55 :delay (nop!))
|
||||
|
||||
|
||||
|
||||
|
||||
;; we'll get here once the compressed vis data is in vis-buffer
|
||||
;; this can come from IOP->EE or from the BSP file directly
|
||||
(label cfg-27)
|
||||
@@ -233,9 +233,9 @@
|
||||
;; but then copy the vis buffer directly.
|
||||
(mem-copy! (the-as pointer spad-start) (the-as pointer vis-buffer) list-len)
|
||||
)
|
||||
|
||||
|
||||
(while (nonzero? lower-flag-bits)
|
||||
(case (logand lower-flag-bits 7)
|
||||
(case (logand lower-flag-bits 7)
|
||||
((1) ;; decomp type 1: this unpacks data that exploits the BVH tree structure.
|
||||
;; it omits 0's for children of invisible parents. But to unpack, we need
|
||||
;; to know all the BVHs in the level.
|
||||
@@ -277,7 +277,7 @@
|
||||
(set! spad-end (the-as int vis-buffer))
|
||||
(.sra lower-flag-bits lower-flag-bits 3)
|
||||
)
|
||||
|
||||
|
||||
;; now vis-buffer points to the uncompressed data.
|
||||
;; if things went well, we shouldn't have any bits set for drawables that don't exist.
|
||||
;; we can check this by anding with the all visible list, and confirming it doesn't
|
||||
@@ -315,7 +315,7 @@
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; just in case we failed the above check, and with the all visible list anyway.
|
||||
;; also copy from vis-buffer (may be spad) to the final vis-bits output
|
||||
(let ((v1-71 (the-as object vis-buffer))
|
||||
|
||||
@@ -142,12 +142,12 @@ struct DgoHeader {
|
||||
The 'busy status indicates it is still going
|
||||
The 'error status indicates the load failed.
|
||||
The 'complete status means the load is finished, and length-out contains the loaded length."
|
||||
|
||||
|
||||
;; still going..
|
||||
(if (check-busy *load-str-rpc*)
|
||||
(return 'busy)
|
||||
)
|
||||
|
||||
|
||||
;; not busy, we can free the lock
|
||||
(set! *load-str-lock* #f)
|
||||
;; also lock the queue. Not sure why?
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
)
|
||||
|
||||
(defmethod new rpc-buffer ((allocation symbol) (type-to-make type) (elt-size uint) (elt-count uint))
|
||||
"Create a new rpc-buffer with room for elt-count elements of elt-size.
|
||||
"Create a new rpc-buffer with room for elt-count elements of elt-size.
|
||||
The element array is 64-byte aligned."
|
||||
;; we make room for a buffer of size elt-size * elt-count that is _64 byte_ aligned.
|
||||
(let ((this (object-new allocation type-to-make (the int (+ (-> type-to-make size) 63 (* elt-size elt-count))))))
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
)
|
||||
|
||||
(defun is-cd-in? ()
|
||||
|
||||
|
||||
(declare (inline))
|
||||
(zero? (-> *sound-iop-info* nocd))
|
||||
)
|
||||
@@ -863,16 +863,16 @@
|
||||
`(begin
|
||||
;; append a new music to the flava table
|
||||
(set! (-> *flava-table* row (-> *flava-table* count) music) (quote ,name))
|
||||
|
||||
|
||||
;; reset this music's flavas
|
||||
(dotimes (n 50)
|
||||
(set! (-> *flava-table* row (-> *flava-table* count) flava n) 0)
|
||||
)
|
||||
|
||||
|
||||
;; increase the music count
|
||||
;; (this should probably be done after...)
|
||||
(1+! (-> *flava-table* count))
|
||||
|
||||
|
||||
;; set the flavas or whatever they're called
|
||||
,@(apply (lambda (x) `(set! (-> *flava-table* row (1- (-> *flava-table* count)) flava (music-flava ,(first x))) ,(second x))) flavas)
|
||||
)
|
||||
|
||||
@@ -729,7 +729,7 @@
|
||||
(((hud-collectable-view game-totals))
|
||||
;; show orbs collected/total across entire game
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
"~D~%/~D"
|
||||
(the int (-> *game-info* money-total))
|
||||
2000 ;;(-> (the progress (-> *progress-process* 0)) total-nb-of-orbs)
|
||||
@@ -746,7 +746,7 @@
|
||||
(let ((lvl-idx (-> *level-task-data-remap* (+ (-> *target* current-level info index) -1))))
|
||||
;; show orbs collected/total this level
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
"~D~%/~D"
|
||||
(-> *game-info* money-per-level lvl-idx)
|
||||
(-> *game-counts* data lvl-idx money-count)
|
||||
@@ -1125,7 +1125,7 @@
|
||||
(((hud-collectable-view game-totals))
|
||||
;; show cells collected/total across entire game
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
"~D~%/~D"
|
||||
(the int (-> *game-info* fuel))
|
||||
101 ;;(-> (the progress (-> *progress-process* 0)) total-nb-of-power-cells)
|
||||
@@ -1150,7 +1150,7 @@
|
||||
|
||||
;; show cells/total collected this level
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
"~D~%/~D"
|
||||
completed-task-count
|
||||
(-> *level-task-data* lvl-idx nb-of-tasks)
|
||||
@@ -1419,7 +1419,7 @@
|
||||
(((hud-collectable-view game-totals))
|
||||
;; show flies collected/total across entire game
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
" ~D~% /~D"
|
||||
(the int (-> *game-info* buzzer-total))
|
||||
112 ;; (-> (the progress (-> *progress-process* 0)) total-nb-of-buzzers)
|
||||
@@ -1436,7 +1436,7 @@
|
||||
(let ((lvl-idx (-> *level-task-data-remap* (+ (-> *target* current-level info index) -1))))
|
||||
;; show flies collected/total this level
|
||||
(draw-string-xy-scaled
|
||||
(string-format
|
||||
(string-format
|
||||
" ~D~% /~D"
|
||||
(buzzer-count *game-info* (-> *level-task-data* lvl-idx task-info (-> *level-task-data* lvl-idx buzzer-task-index) task-id))
|
||||
(-> *game-counts* data lvl-idx buzzer-count)
|
||||
@@ -1913,19 +1913,19 @@
|
||||
)
|
||||
;; og:preserve-this
|
||||
(#when PC_PORT
|
||||
|
||||
|
||||
(let ((base-x (-> this particles 2 init-pos x)))
|
||||
(+! base-x (* (- 512.0 base-x) (- 1.0 (-> *pc-settings* aspect-ratio-reciprocal))))
|
||||
(set! (-> this particles 0 init-pos x) 435.0)
|
||||
(set! (-> this particles 1 init-pos x) 432.0)
|
||||
(set! (-> this particles 2 init-pos x) 435.0)
|
||||
|
||||
|
||||
(when (not (-> *pc-settings* use-vis?))
|
||||
(dotimes (i (-> this nb-of-particles))
|
||||
(set! (-> this particles i init-pos x) (+ base-x (* (-> *pc-settings* aspect-ratio-reciprocal) (- (-> this particles i init-pos x) base-x))))
|
||||
|
||||
))
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
0
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
(sidekick-hint-rounddoor #x23c)
|
||||
(sidekick-hint-lurkerm #x23d)
|
||||
(sidekick-hint-tower #x23e)
|
||||
|
||||
|
||||
(sidekick-reminder-fish #x240)
|
||||
|
||||
(firecanyon-need-cells #x24f)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
(format '#t "[~8x] ~A~%" this (-> this type))
|
||||
(format '#t "~Tlength: ~D~%" (-> this length))
|
||||
(format '#t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data))
|
||||
|
||||
|
||||
(let ((i 0))
|
||||
(while (< i (-> this length))
|
||||
(format '#t "~T [~D] #x~X ~A~%" i (-> this data i id) (-> this data i text))
|
||||
|
||||
@@ -528,7 +528,7 @@
|
||||
;; first, update the oscillator and assume we aren't in a bouncing part
|
||||
(update! (-> this osc) arg0)
|
||||
(set! (-> this state) 0)
|
||||
|
||||
|
||||
(when (>= (-> this osc value) (-> this max-value))
|
||||
;; boucing off of the ceiling. first, saturate to max-val
|
||||
(set! (-> this osc value) (-> this max-value))
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
(let ((v1-0 (new 'static 'vector4w :x #x1000 :y #x1000 :z #x1000)))
|
||||
(.mov vf9 (the uint128 radius)) ;; vf9.x = radius
|
||||
(.lvf vf3 (&-> line quad)) ;; vf3 = line
|
||||
(let ((a0-1 (-> v1-0 quad))) ;; a0-1 = 0x1000,
|
||||
(let ((a0-1 (-> v1-0 quad))) ;; a0-1 = 0x1000,
|
||||
(.ftoi.vf vf21 vf3) ;; vf21 is the line
|
||||
(.lvf vf1 (&-> origin quad)) ;; vf1 is the origin
|
||||
(.mul.vf vf8 vf3 vf3) ;;
|
||||
(.mul.vf vf8 vf3 vf3) ;;
|
||||
(let ((v1-1 *collide-work*))
|
||||
(.add.vf vf2 vf1 vf3) ;; vf2 is the endpoint
|
||||
;;(set! (-> obj ignore-mask) pat-ignore)
|
||||
@@ -53,7 +53,7 @@
|
||||
)
|
||||
(format 0 "BAD case in setup-collide-for-line-sphere")
|
||||
(b! #t cfg-13 :delay (nop!))
|
||||
|
||||
|
||||
(label cfg-3)
|
||||
(.add.y.vf vf8 vf8 vf8 :mask #b1)
|
||||
;;(set! (-> obj num-tris) 0)
|
||||
@@ -144,19 +144,19 @@
|
||||
(defun debug-draw-collide-work ((my-off float))
|
||||
(when (not (paused?))
|
||||
(+! *debug-counter* 1)
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
;; create a test input that moves around sandover
|
||||
(let ((origin (new 'static 'vector :y (meters 7.0) :x (meters 5.) :z (meters 0.0)))
|
||||
(line (new 'static 'vector :y (meters 5.0) :x (meters -5.0)))
|
||||
(radius (meters 2.0))
|
||||
(val (+ my-off (* 0.003 (the float *debug-counter*))))
|
||||
)
|
||||
|
||||
|
||||
(set! (-> line z) (* (sin (degrees val)) (meters 35.0)))
|
||||
(set! (-> line x) (* (cos (degrees val)) (meters 35.0)))
|
||||
|
||||
|
||||
(let ((dbg2 (/ val 2)))
|
||||
(set! (-> origin x) (* (sin (degrees dbg2)) (meters 100.)))
|
||||
(set! (-> origin z) (* (cos (* 3.0 (degrees dbg2))) (meters 100.)))
|
||||
@@ -164,15 +164,15 @@
|
||||
)
|
||||
#|
|
||||
;;; PROBE (at the frag finding level)
|
||||
|
||||
|
||||
;; setup the collide work
|
||||
(setup-collide-for-line-sphere origin line radius)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;; clear collide list
|
||||
(set! (-> *collide-list* num-items) 0)
|
||||
|
||||
|
||||
;; loop over active levels
|
||||
(dotimes (lev-idx (-> *level* length))
|
||||
(let ((lev (-> *level* level lev-idx)))
|
||||
@@ -182,11 +182,11 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; print results
|
||||
(format *stdcon* "got ~d in list~%" (-> *collide-list* num-items))
|
||||
(format *stdcon* "cam at: ~`vector`P~%" (camera-pos))
|
||||
|
||||
|
||||
(let ((old-count 0))
|
||||
;; visualize results
|
||||
(dotimes (i (-> *collide-list* num-items))
|
||||
@@ -196,7 +196,7 @@
|
||||
(+! old-count 1)
|
||||
(add-debug-sphere #t (bucket-id debug-draw0) (-> inst bsphere) (-> inst bsphere w) (new 'static 'rgba :b #x80 :a #x80))
|
||||
)
|
||||
|
||||
|
||||
(when (not inst)
|
||||
(+! old-count 1)
|
||||
;;(format *stdcon* "NI: ~A~%" mesh)
|
||||
@@ -205,21 +205,21 @@
|
||||
;
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; now test the other one
|
||||
(set! (-> *collide-list* num-items) 0)
|
||||
(collide-probe-make-list (-> *level* level 0) *collide-list*)
|
||||
|
||||
|
||||
;; these should come out the same, if we did it right.
|
||||
(format *stdcon* "COMPARE: ~d ~d~%" (-> *collide-list* num-items) old-count)
|
||||
|
||||
|
||||
(dotimes (i (-> *collide-list* num-items))
|
||||
(let ((mesh (the collide-frag-mesh (-> *collide-list* items i mesh)))
|
||||
(inst (the instance-tie (-> *collide-list* items i inst))))
|
||||
(when inst
|
||||
(add-debug-sphere #t (bucket-id debug-draw0) (-> inst bsphere) (* 0.95 (-> inst bsphere w)) (new 'static 'rgba :b #x80 :r #x80 :a #x80))
|
||||
)
|
||||
|
||||
|
||||
(when (not inst)
|
||||
;;(format *stdcon* "NI: ~A~%" mesh)
|
||||
(add-debug-sphere #t (bucket-id debug-draw0) (vector-as-floats (-> mesh base-trans)) (meters 6.0) (new 'static 'rgba :g #x30 :a #x80))
|
||||
@@ -229,22 +229,22 @@
|
||||
)
|
||||
)
|
||||
|#
|
||||
|
||||
|
||||
;; CCACHE (fill from bounding box)
|
||||
(let ((bbox-fake (new 'stack 'bounding-box))
|
||||
(bbox (new 'stack 'bounding-box)))
|
||||
|
||||
|
||||
;; make box
|
||||
(set! (-> bbox-fake min quad) (-> origin quad))
|
||||
(vector+! (-> bbox-fake max) origin line)
|
||||
|
||||
|
||||
(dotimes (i 3)
|
||||
(set! (-> bbox min data i) (fmin (-> bbox-fake min data i) (-> bbox-fake max data i)))
|
||||
(set! (-> bbox max data i) (fmax (-> bbox-fake min data i) (-> bbox-fake max data i)))
|
||||
)
|
||||
(set! (-> bbox min w) 1.0)
|
||||
(set! (-> bbox max w) 1.0)
|
||||
|
||||
|
||||
;; BBOX
|
||||
;; draw box
|
||||
;(add-debug-box #t (bucket-id debug-draw0) (-> bbox min) (-> bbox max) (new 'static 'rgba :g #x30 :a #x80))
|
||||
@@ -255,16 +255,16 @@
|
||||
; (the process-drawable #f)
|
||||
; (the pat-surface 0)
|
||||
; )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;; Y PROBE
|
||||
; (+! (-> bbox min y) (meters 8.0))
|
||||
; (let ((vec (new 'stack-no-clear 'vector)))
|
||||
; (set! (-> vec quad) (-> bbox min quad))
|
||||
; (-! (-> vec y) (meters 20.0))
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (bucket-id debug-draw0)
|
||||
; (-> bbox min)
|
||||
; vec
|
||||
@@ -274,12 +274,12 @@
|
||||
; )
|
||||
; )
|
||||
; (fill-using-y-probe *collide-cache* (-> bbox min) (meters 20.0) (collide-kind background) (the process-drawable #f) (the uint 0))
|
||||
|
||||
|
||||
;; LINE SPHERE
|
||||
; (fill-using-line-sphere *collide-cache* origin line radius (collide-kind background) (the process-drawable #f) 0)
|
||||
; ;; draw the line we're going to check
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (bucket-id debug-draw0)
|
||||
; origin
|
||||
; (vector+! (new 'stack-no-clear 'vector) origin line)
|
||||
@@ -287,7 +287,7 @@
|
||||
; #f
|
||||
; (the rgba -1)
|
||||
; )
|
||||
|
||||
|
||||
; ;; debug draw spheres along the line
|
||||
; (dotimes (i 10)
|
||||
; (add-debug-sphere
|
||||
@@ -302,14 +302,14 @@
|
||||
; (new 'static 'rgba :g #x80 :r #x80 :b #x80 :a #x80)
|
||||
; )
|
||||
; )
|
||||
|
||||
|
||||
;; Y probe (actual probe)
|
||||
(+! (-> bbox min y) (meters 8.0))
|
||||
(let ((vec (new 'stack-no-clear 'vector)))
|
||||
(set! (-> vec quad) (-> bbox min quad))
|
||||
(-! (-> vec y) (meters 20.0))
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (add-debug-line
|
||||
; #t
|
||||
; (bucket-id debug-draw0)
|
||||
; (-> bbox min)
|
||||
; vec
|
||||
@@ -318,9 +318,9 @@
|
||||
; (the rgba -1)
|
||||
; )
|
||||
)
|
||||
|
||||
|
||||
(let ((result (new 'stack-no-clear 'collide-tri-result)))
|
||||
|
||||
|
||||
(let ((u (fill-and-probe-using-y-probe *collide-cache* (-> bbox min) (meters 20.0) (collide-kind background) (the process-drawable #f) result (the uint 0))))
|
||||
(-! (-> bbox min y) (* u (meters 20.0)))
|
||||
;; (format *stdcon* "u = ~f : ~`vector`P ~%" u (-> result vertex 0))
|
||||
@@ -333,19 +333,19 @@
|
||||
)
|
||||
)
|
||||
;(add-debug-outline-triangle #t (bucket-id debug-draw1) (-> result vertex 0) (-> result vertex 1) (-> result vertex 2) (new 'static 'rgba :r #x80 :g #x80 :a #x80))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;(debug-draw *collide-cache*)
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
#f
|
||||
)
|
||||
)
|
||||
@@ -354,7 +354,7 @@
|
||||
;;(kill-by-name 'debug-drawer *active-pool*)
|
||||
(let ((proc (get-process *nk-dead-pool* process 1024)))
|
||||
(activate proc *active-pool* 'debug-drawer *kernel-dram-stack*)
|
||||
(run-next-time-in-process
|
||||
(run-next-time-in-process
|
||||
proc
|
||||
(lambda ()
|
||||
(let ((my-off (rand-vu-float-range 0.0 1000.0)))
|
||||
@@ -362,11 +362,11 @@
|
||||
(debug-draw-collide-work my-off)
|
||||
(suspend)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@
|
||||
(set! (-> cam-pos y) (meters -2.))
|
||||
;;(debug-set-camera-pos-rot! cam-pos cam-inv-rot)
|
||||
;;(hack-update-camera cam-pos cam-inv-rot)
|
||||
|
||||
|
||||
|
||||
|
||||
;; create some test points
|
||||
(let ((p0 (new 'static 'vector :x (meters .8) :y (meters .2) :z (meters 2.0)))
|
||||
(p1 (new 'static 'vector :x (meters .3) :y (meters .3) :z (meters 2.5)))
|
||||
(p2 (new 'static 'vector :x (meters .5) :y (meters .7) :z (meters 1.5)))
|
||||
)
|
||||
|
||||
|
||||
;;(add-debug-point #t (bucket-id debug-draw0) (new 'static 'vector))
|
||||
(add-debug-x #t (bucket-id debug-draw0) (new 'static 'vector) (new 'static 'rgba :g #x80 :a #x80))
|
||||
(add-debug-box #t (bucket-id debug-draw0) p0 p2 (new 'static 'rgba :b #x80 :a #x80))
|
||||
@@ -100,7 +100,7 @@
|
||||
(set! (-> *part-id-table* 38 init-specs 5 initial-valuef) f30-0)
|
||||
(set! (-> *part-id-table* 38 init-specs 5 random-rangef) f30-0)
|
||||
)
|
||||
|
||||
|
||||
(dotimes (i 10)
|
||||
(launch-particles (-> *part-id-table* 37) gp-0)
|
||||
(launch-particles (-> *part-id-table* 38) gp-0)
|
||||
@@ -150,10 +150,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; no way to move camera relative y (up/down)
|
||||
(set! (-> local-trans y) 0.0)
|
||||
|
||||
|
||||
;; in and out movement
|
||||
(set! (-> local-trans z)
|
||||
(cond
|
||||
@@ -169,11 +169,11 @@
|
||||
)
|
||||
)
|
||||
(set! (-> local-trans w) 1.0)
|
||||
|
||||
|
||||
(when fast-mode
|
||||
(vector-float*! local-trans local-trans 10.)
|
||||
)
|
||||
|
||||
|
||||
;; rotate this into world frame
|
||||
(let ((inv-cam-rot (new-stack-vector0))
|
||||
(cam-rot-mat (new-stack-matrix0)))
|
||||
@@ -184,14 +184,14 @@
|
||||
;; and rotate the translation.
|
||||
(vector-matrix*! local-trans local-trans cam-rot-mat)
|
||||
)
|
||||
|
||||
|
||||
;; and update the transform
|
||||
(vector+! (-> trans trans) (-> trans trans) local-trans)
|
||||
|
||||
|
||||
|
||||
|
||||
;; don't forget to fix w.
|
||||
(set! (-> trans trans w) 1.0)
|
||||
|
||||
|
||||
;; global translation
|
||||
(let ((diff (if fast-mode 10000.0 2000.0)))
|
||||
(if (cpad-hold? 0 l1)
|
||||
@@ -202,7 +202,7 @@
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; rotation (don't allow camera roll)
|
||||
(if (cpad-hold? 0 x)
|
||||
(set! (-> trans rot x) (+ 200. (-> trans rot x)))
|
||||
@@ -216,7 +216,7 @@
|
||||
(if (cpad-hold? 0 right)
|
||||
(set! (-> trans rot y) (+ -300. (-> trans rot y)))
|
||||
)
|
||||
|
||||
|
||||
(set! (-> trans scale x) 1.)
|
||||
(set! (-> trans scale y) 1.)
|
||||
(set! (-> trans scale z) 1.)
|
||||
@@ -313,7 +313,7 @@
|
||||
(set! (-> settings meters 2) (meters 20.0))
|
||||
(set! (-> settings meters 3) (meters 20.0))
|
||||
(set! (-> settings meters 4) (meters 20.0))
|
||||
|
||||
|
||||
; (set! (-> settings meters 0) (-> settings far idx))
|
||||
; (set! (-> settings meters 4) (-> settings close idx))
|
||||
; (let ((f0-3 (* 0.14285715 (- (-> settings meters 0) (-> settings meters 4)))))
|
||||
@@ -341,12 +341,12 @@
|
||||
(defun load-slot-1 ((lev symbol))
|
||||
(load-state-want-levels (-> *load-state* want 0 name) lev)
|
||||
(set! *debug-load-level* lev)
|
||||
(process-new-function
|
||||
(process-new-function
|
||||
process
|
||||
(lambda ()
|
||||
(lambda ()
|
||||
(suspend)
|
||||
(suspend)
|
||||
|
||||
|
||||
(while (!= (-> *level* data 1 status) 'loaded)
|
||||
(format 0 "waiting...~%")
|
||||
(suspend)
|
||||
|
||||
@@ -17,7 +17,7 @@ There's an error message:
|
||||
"~%Alternatively, try removing pskernel.gc and debug-handlers.gc from project.cl, do an (lg) and then (:r) again~%"
|
||||
|
||||
My theory is that debug-handlers.gc held crash handlers, and on load would install them using functions defined in pskernel.gc.
|
||||
In the retail game, they removed debug-handlers, but not pskernel.
|
||||
In the retail game, they removed debug-handlers, but not pskernel.
|
||||
|
||||
In the PC port, all of these functions are just stubs.
|
||||
|#
|
||||
@@ -50,7 +50,7 @@ In the PC port, all of these functions are just stubs.
|
||||
)
|
||||
|
||||
(defun kernel-copy-function (unused source dest size)
|
||||
"Copy size words from source to dest. The a0 argument is ignored.
|
||||
"Copy size words from source to dest. The a0 argument is ignored.
|
||||
Uses registers a0, a1, a2, a3"
|
||||
(nyi-break kernel-copy-function)
|
||||
)
|
||||
|
||||
@@ -509,7 +509,7 @@
|
||||
(f0-4 (* arg0 (cos (-> this heading))))
|
||||
)
|
||||
;; og:preserve-this changed for high fps
|
||||
(set! (-> this root transv x) (* DISPLAY_FPS_RATIO f30-1))
|
||||
(set! (-> this root transv x) (* DISPLAY_FPS_RATIO f30-1))
|
||||
(set! (-> this root transv z) (* DISPLAY_FPS_RATIO f0-4))
|
||||
)
|
||||
0
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
)
|
||||
|
||||
(defbehavior robotboss-yellow-eco-off robotboss ()
|
||||
;; patches the one frame of ghost yellow eco bug that can
|
||||
;; patches the one frame of ghost yellow eco bug that can
|
||||
;; occcur under certain conditions when robot-boss-yellow-eco-off is called.
|
||||
(#when PC_PORT
|
||||
(logclear! (-> self alts 7 extra perm status) (entity-perm-status bit-3))
|
||||
|
||||
@@ -1627,7 +1627,7 @@
|
||||
((-> (method-of-type process-taskable play-anim) exit))
|
||||
0
|
||||
(none))
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -167,8 +167,8 @@
|
||||
(defbehavior fleeing-nav-enemy-adjust-nav-info fleeing-nav-enemy ()
|
||||
(let ((f30-0 (vector-vector-distance (-> *camera* tpos-curr-adj) (-> *camera* tpos-old-adj))))
|
||||
;; og:preserve-this
|
||||
;; High FPS fix: stop-chase and notice distances are calculated between a min/max range where
|
||||
;; the further the camera moved since last frame decides how close the chosen value is to the
|
||||
;; High FPS fix: stop-chase and notice distances are calculated between a min/max range where
|
||||
;; the further the camera moved since last frame decides how close the chosen value is to the
|
||||
;; max distance. Since this is called more often above 60 FPS, the distance is skewed to the
|
||||
;; lower end. This scales the distance back up based on the FPS ratio.
|
||||
(set! f30-0 (/ f30-0 DISPLAY_FPS_RATIO))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
;; name: sunken-obs.gc
|
||||
;; name in dgo: sunken-obs
|
||||
;; dgos: L1, SUN, SUNKEN
|
||||
|
||||
|
||||
(declare-type seaweed basic)
|
||||
(define-extern *seaweed* seaweed)
|
||||
|
||||
|
||||
@@ -543,14 +543,14 @@
|
||||
((cpad-pressed? 0 right)
|
||||
(cpad-clear! 0 right)
|
||||
(+! (-> lst selection) 1)
|
||||
(set! need-update #t))
|
||||
(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))
|
||||
|
||||
@@ -512,7 +512,7 @@
|
||||
(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)
|
||||
(atx-add-level-group)
|
||||
)
|
||||
|
||||
(defun dm-anim-tester-x-func ((action symbol))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
;; custom entity functions for pc port
|
||||
(defun-debug entity-inspect-draw ((inspect-info entity-debug-inspect))
|
||||
"draw text about an entity on screen"
|
||||
|
||||
|
||||
(update-pad inspect-info 0)
|
||||
(let* ((e (-> inspect-info entity)) (name (res-lump-struct e 'name string)))
|
||||
(set! *display-actor-anim* (the string (and (-> inspect-info show-actor-info) name)))
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
;; tag info
|
||||
(format (clear *debug-temp-string*) "~3L~2D)~0L ~20L~A~0L:" i (-> e tag i name) (-> e tag i elt-type))
|
||||
|
||||
|
||||
;; tag data - special cases first
|
||||
(cond
|
||||
;; some water-height info
|
||||
@@ -227,7 +227,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; draw a string for each tag instead of all at once. allows using smaller strings.
|
||||
(draw-string-xy *debug-temp-string* debug-buf 352 cur-y (font-color default) (font-flags shadow kerning middle))
|
||||
(+! cur-y y-adv)
|
||||
@@ -236,7 +236,7 @@
|
||||
))
|
||||
;; set max scroll based on how large the whole text was, ignore first 20 lines.
|
||||
(set! (-> inspect-info scroll-y-max) (max 0 (+ -20 (/ (- cur-y begin-y) 8))))
|
||||
|
||||
|
||||
)
|
||||
)))
|
||||
|
||||
|
||||
@@ -497,10 +497,10 @@
|
||||
))
|
||||
((and (= 'debug *cheat-mode*) (= (-> obj battle-entity) (actor-by-name "flying-lurker-1")))
|
||||
(let ((battle (the process-drawable battle)))
|
||||
|
||||
|
||||
(if *target*
|
||||
(set! (-> obj battle-alive) (the int (/ (vector-vector-distance (-> battle root trans) (target-pos 0)) METER_LENGTH))))
|
||||
|
||||
|
||||
(update-display-status obj (-> obj want-skel) (-> obj battle-entity) 0 #t)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
(third-camera-v-inverted? symbol) ;; third-person vertical camera inverted
|
||||
(music-fadeout? symbol) ;; music fadeout toggle.
|
||||
(music-fadein? symbol) ;; music fadein toggle.
|
||||
|
||||
|
||||
(territory int16)
|
||||
|
||||
(bingo pc-bingo-info :inline) ;; bingo integration. does nothing for now.
|
||||
@@ -295,7 +295,7 @@
|
||||
|
||||
(defmethod reset pc-settings ((obj pc-settings) (call-handlers symbol))
|
||||
"Reset everything back to default settings
|
||||
|
||||
|
||||
If call-handlers = #t then events will be sent to the runtime kernel to update OS settings
|
||||
such as window size, etc.
|
||||
If you just want to set the settings and handle the fields yourself later, set call-handlers to #f
|
||||
@@ -520,7 +520,7 @@
|
||||
|
||||
(dolist (ex extra)
|
||||
(set! out (cons (car ex) out)))
|
||||
|
||||
|
||||
out)
|
||||
)
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
(when (zero? (-> date stat))
|
||||
(set-time-of-day (+ (the float (bcd->dec (-> date hour))) (/ (the float (bcd->dec (-> date minute))) 60))))
|
||||
))
|
||||
|
||||
|
||||
(pc-set-gfx-hack (pc-gfx-hack no-tex) (logtest? (-> obj cheats) (pc-cheats no-tex)))
|
||||
|
||||
(if (pc-cheats? (-> obj cheats) mirror)
|
||||
@@ -332,7 +332,7 @@
|
||||
|
||||
(defmethod update-led pc-settings-jak1 ((obj pc-settings-jak1))
|
||||
"set the controller led color by modifying the controller-led-color vector"
|
||||
|
||||
|
||||
;; default color is just blue.
|
||||
(set! (-> obj controller-led-color r) 0.0)
|
||||
(set! (-> obj controller-led-color g) 0.0)
|
||||
@@ -563,7 +563,7 @@
|
||||
|
||||
(defmethod handle-output-settings pc-settings-jak1 ((obj pc-settings-jak1) (file file-stream))
|
||||
"handle the text writing output for the 'settings' group"
|
||||
|
||||
|
||||
((method-of-type pc-settings handle-output-settings) obj file)
|
||||
(format file " (money-starburst? ~A)~%" (-> obj money-starburst?))
|
||||
(format file " (extra-hud? ~A)~%" (-> obj extra-hud?))
|
||||
|
||||
@@ -34,26 +34,26 @@
|
||||
|
||||
(defun-debug font-encode-test-start ()
|
||||
"start the encode test proc"
|
||||
|
||||
|
||||
(unless (process-by-name 'font-encode *active-pool*)
|
||||
(process-spawn-function process :name 'font-encode
|
||||
(lambda :behavior process ()
|
||||
(let ((fnt (new 'stack 'font-context *font-default-matrix* FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y 0.0
|
||||
(font-color red) (font-flags shadow kerning large middle)))
|
||||
)
|
||||
|
||||
|
||||
(set-width! fnt 400)
|
||||
(set-height! fnt 100)
|
||||
|
||||
|
||||
(loop
|
||||
(suspend)
|
||||
|
||||
|
||||
(if (or (cpad-pressed? 0 left) (cpad-hold? 0 l1))
|
||||
(-! *font-string-val* 1))
|
||||
(if (or (cpad-pressed? 0 right) (cpad-hold? 0 r1))
|
||||
(+! *font-string-val* 1))
|
||||
(minmax! *font-string-val* 1 #x1ff)
|
||||
|
||||
|
||||
(clear *font-string*)
|
||||
(cond
|
||||
((>= *font-string-val* #x100)
|
||||
@@ -66,7 +66,7 @@
|
||||
(set! (-> *font-string* data 1) 0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set-origin! fnt FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y)
|
||||
(set-flags! fnt (font-flags shadow kerning large middle))
|
||||
(print-game-text *font-string* fnt #f 128 24)
|
||||
@@ -78,7 +78,7 @@
|
||||
(print-game-text (string-format "#x~x" *font-string-val*) fnt #f 128 12)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
(defun-debug font-encode-test-stop ()
|
||||
"stop the encode test proc"
|
||||
|
||||
|
||||
(kill-by-name 'font-encode *active-pool*)
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; mimicking Java's util.Random https://docs.oracle.com/javase/8/docs/api/java/util/Random.html
|
||||
;;;; This is a linear congruential pseudorandom number generator, as defined by D. H. Lehmer
|
||||
;;;; This is a linear congruential pseudorandom number generator, as defined by D. H. Lehmer
|
||||
;;;; and described by Donald E. Knuth in The Art of Computer Programming, Volume 3: Seminumerical Algorithms, section 3.2.1.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"pack system time into 64-bits for randomization purposes."
|
||||
(let ((date (new 'stack-no-clear 'scf-time)))
|
||||
(scf-get-time date)
|
||||
|
||||
|
||||
(logior (the int (-> date stat))
|
||||
(shl (-> date second) 8)
|
||||
(shl (-> date minute) 16)
|
||||
@@ -47,7 +47,7 @@
|
||||
(shr (-> *knuth-rand-state* seed) (- 48 bits))
|
||||
)
|
||||
|
||||
(defun knuth-rand-next-int ()
|
||||
(defun knuth-rand-next-int ()
|
||||
(knuth-rand-advance-seed)
|
||||
(-> *knuth-rand-state* seed)
|
||||
)
|
||||
|
||||
@@ -91,7 +91,7 @@ This is used for funny cheat codes and the like.
|
||||
|
||||
(defun target-joint-callback-pc ((obj target))
|
||||
"custom animation callback for *target*"
|
||||
|
||||
|
||||
(let ((neckA-idx (cspace-index-by-name obj "neckA")))
|
||||
(cond
|
||||
((pc-cheats? (-> *pc-settings* cheats) small-head) (scale-joints obj neckA-idx #t *cheat-small-head-scale*))
|
||||
@@ -107,7 +107,7 @@ This is used for funny cheat codes and the like.
|
||||
|
||||
(defun process-drawable-joint-callback-pc ((obj process-drawable))
|
||||
"custom animation callback for any process drawable"
|
||||
|
||||
|
||||
(when (pc-cheats? (-> *pc-settings* cheats) oh-my-goodness)
|
||||
;; don't ask.
|
||||
(scale-joints obj (cspace-index-by-name obj "lbood") #t (new 'static 'vector :x 2.0 :y 2.0 :z 2.0 :w 1.0))
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
(format *stdcon* " ~0k~3Lcpad ~D~0L~%" ii)
|
||||
(dotimes (j 8)
|
||||
(dotimes (i 2)
|
||||
(format *stdcon* " ")
|
||||
(format *stdcon* " ")
|
||||
(let* (
|
||||
(btn-idx (+ i(* j 2)))
|
||||
(btn-name (-> *pc-pad-button-names* btn-idx))
|
||||
@@ -114,7 +114,7 @@
|
||||
(format *stdcon* "~8L~S: " btn-name)
|
||||
;; longest button string is TRIANGLE, which is 8 characters in length
|
||||
;; but only shows up in the left column. CIRCLE and SQUARE are longest in the right with 6
|
||||
(dotimes (_ (-
|
||||
(dotimes (_ (-
|
||||
(cond ((= i 0) 8) ((= i 1) 6))
|
||||
(length btn-name)))
|
||||
(format *stdcon* " ")
|
||||
@@ -138,20 +138,20 @@
|
||||
))
|
||||
(set! (-> *pc-pad-proc-list* show) (ppointer->handle procp))
|
||||
)
|
||||
|
||||
|
||||
(format #t "That process is already running. :-)~%")
|
||||
)
|
||||
)
|
||||
|
||||
(defun-debug pc-pad-show-stop ()
|
||||
"Stop the PC port pad debug display"
|
||||
|
||||
|
||||
(kill-by-name 'pc-pad-show *active-pool*)
|
||||
)
|
||||
|
||||
(defun-debug pc-pad-input-start ((pad-idx int))
|
||||
"Start the PC port pad debug key mapping"
|
||||
|
||||
|
||||
(if (not (handle->process (-> *pc-pad-proc-list* input)))
|
||||
(let ((procp
|
||||
(process-spawn pc-pad-proc :name 'pc-pad-input
|
||||
@@ -166,14 +166,14 @@
|
||||
))
|
||||
(set! (-> *pc-pad-proc-list* input) (ppointer->handle procp))
|
||||
)
|
||||
|
||||
|
||||
(format #t "That process is already running. :-)~%")
|
||||
)
|
||||
)
|
||||
|
||||
(defun-debug pc-pad-input-stop ()
|
||||
"Stop the PC port pad debug key mapping"
|
||||
|
||||
|
||||
(kill-by-name 'pc-pad-input *active-pool*)
|
||||
(pc-pad-input-mode-set 'canceled)
|
||||
)
|
||||
@@ -201,7 +201,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defstate pc-pi-new-mapping (pc-pad-proc)
|
||||
|
||||
|
||||
:enter (behavior () (set! (-> self input-index) (pc-pad-input-index-get)) )
|
||||
:code (behavior ()
|
||||
(set-state-time)
|
||||
@@ -224,11 +224,11 @@
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
|
||||
(defstate pc-pi-canceled (pc-pad-proc)
|
||||
|
||||
|
||||
:code (behavior ()
|
||||
(set-state-time)
|
||||
(until (time-passed? PC_PAD_INPUT_NOTICE_TIME)
|
||||
@@ -242,7 +242,7 @@
|
||||
)
|
||||
|
||||
(defstate pc-pi-done (pc-pad-proc)
|
||||
|
||||
|
||||
:enter (behavior () (set! (-> self input-index) 16))
|
||||
:code (behavior ()
|
||||
(pc-pad-input-map-save!)
|
||||
@@ -268,7 +268,7 @@
|
||||
)
|
||||
|
||||
(defstate pc-pi-mapping-button (pc-pad-proc)
|
||||
|
||||
|
||||
:code (behavior ()
|
||||
(loop
|
||||
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
|
||||
@@ -304,7 +304,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3933,7 +3933,7 @@
|
||||
(function "race-bike-a" #f ,(lambda () (dm-pilot-race-mode 0) (none)))
|
||||
(function "race-bike-b" #f ,(lambda () (dm-pilot-race-mode 1) (none)))
|
||||
;; race-bike-c doesn't actually work?
|
||||
(function "race-bike-c" #f ,(lambda () (dm-pilot-race-mode 2) (none)))
|
||||
(function "race-bike-c" #f ,(lambda () (dm-pilot-race-mode 2) (none)))
|
||||
;; race-bike-d/e require one of the stadium race tasks to be active
|
||||
(function "race-bike-d" #f ,(lambda () (dm-pilot-race-mode 3) (none)))
|
||||
(function "race-bike-e" #f ,(lambda () (dm-pilot-race-mode 4) (none)))
|
||||
|
||||
@@ -1154,7 +1154,7 @@
|
||||
;; tune
|
||||
(set! (-> s5-0 sound-tune) (-> s4-0 sound-tune))
|
||||
(sound-set-midi-reg 4 (the-as int (-> s5-0 sound-tune)))
|
||||
|
||||
|
||||
(when (!= (-> s5-0 sound-stinger) (-> s4-0 sound-stinger))
|
||||
(set! (-> s5-0 sound-stinger) (-> s4-0 sound-stinger))
|
||||
(sound-set-midi-reg 0 (-> s5-0 sound-stinger))
|
||||
|
||||
@@ -38,7 +38,7 @@ across the screen. The resolution of the circle is defined by the number of "tur
|
||||
|
||||
(kmemclose)
|
||||
|
||||
;; Called from update-math-camera.
|
||||
;; Called from update-math-camera.
|
||||
;; Whenever the camera's aspect ratio changes, recalculates the *sprite-distorter-sine-tables*.
|
||||
;;
|
||||
;; Every two vectors in 'entry' contain the position and texture coordinates for a vertex.
|
||||
@@ -159,8 +159,8 @@ across the screen. The resolution of the circle is defined by the number of "tur
|
||||
(&+! (-> dma-buff base) 16)
|
||||
)
|
||||
(let ((aspect-vec (the-as vector (-> dma-buff base))))
|
||||
(set-vector! aspect-vec
|
||||
(-> *sprite-distorter-sine-tables* aspx)
|
||||
(set-vector! aspect-vec
|
||||
(-> *sprite-distorter-sine-tables* aspx)
|
||||
(-> *sprite-distorter-sine-tables* aspy)
|
||||
0.0
|
||||
0.0
|
||||
|
||||
@@ -602,7 +602,7 @@ The cpad-set-buzz! function can be used for vibration.
|
||||
)
|
||||
(set! (-> pad button0-rel 0) (logclear (-> pad button0-abs 0) (-> pad button0-abs 1)))
|
||||
(set! (-> history button0-rel 0) (-> pad button0-rel 0))
|
||||
|
||||
|
||||
|
||||
(when *cpad-debug*
|
||||
(set! (-> pad leftx) (the-as uint 255))
|
||||
|
||||
@@ -501,9 +501,9 @@
|
||||
;; contains handles, to see if the to/from processes are still alive.
|
||||
(deftype event-message-block (structure)
|
||||
((to-handle handle) ;; who to send to
|
||||
(to (pointer process) :overlay-at to-handle)
|
||||
(to (pointer process) :overlay-at to-handle)
|
||||
(form-handle handle) ;; who is doing the sending
|
||||
(from (pointer process) :overlay-at form-handle)
|
||||
(from (pointer process) :overlay-at form-handle)
|
||||
(param uint64 6) ;; the data being sent
|
||||
(message symbol) ;; the message name
|
||||
(num-params int32)
|
||||
@@ -723,4 +723,4 @@
|
||||
|
||||
(defmacro time-elapsed? (time duration)
|
||||
`(>= (- (current-time) ,time) ,duration)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
(let ((a0-20 (get-rider-in-seat (the-as vehicle s4-1) s2-0)))
|
||||
;; og:preserve-this added for hijack lines cheat
|
||||
(when (and a0-20 (or (type-type? (-> a0-20 type) citizen-norm-rider) (type-type? (-> a0-20 type) crimson-guard-rider)))
|
||||
(let ((cheat? (pc-cheats? (-> *pc-settings* cheats) hijack-lines))
|
||||
(let ((cheat? (pc-cheats? (-> *pc-settings* cheats) hijack-lines))
|
||||
(chance? (rand-vu-percent? (-> *pc-cheat-state* hijack-speech-chance))))
|
||||
(when (and cheat? chance?)
|
||||
(add-process *gui-control* self (gui-channel jak) (gui-action play)
|
||||
|
||||
@@ -1322,7 +1322,7 @@
|
||||
(set! h (the int 10.0))
|
||||
(set! x (- (+ (/ (-> screen-pos x) 16) -1792) (/ w 2)))
|
||||
(set! y (+ (+ (/ (-> screen-pos y) 16) -1855) 20))
|
||||
|
||||
|
||||
(draw-health-bar x y w h (-> this hit-points) 1.0 (bucket-id debug-no-zbuf1))
|
||||
)))
|
||||
)
|
||||
|
||||
@@ -1091,7 +1091,7 @@ This commonly includes things such as:
|
||||
(defun sewesc-deactivate ()
|
||||
"deactivate func for sewesc.
|
||||
added."
|
||||
|
||||
|
||||
(kill-by-name "skill-sewesc-from-sewer-tracker" *active-pool*)
|
||||
(kill-by-name "skill-sewesc-from-sewer" *active-pool*)
|
||||
|
||||
@@ -1104,7 +1104,7 @@ This commonly includes things such as:
|
||||
(defun sewesc-activate ()
|
||||
"activate func for sewesc.
|
||||
added."
|
||||
|
||||
|
||||
(process-spawn-function process :name "skill-sewesc-from-sewer-tracker"
|
||||
(lambda :behavior process ()
|
||||
(suspend)
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
(-! (-> self font origin x) (/ (-> self font width) 2))
|
||||
;; now move it up
|
||||
(-! (-> self font origin y) (-> self y-ofs)))
|
||||
|
||||
|
||||
:code (behavior ()
|
||||
(let ((state-time (current-time)))
|
||||
;; move up for a bit
|
||||
@@ -68,7 +68,7 @@
|
||||
(suspend))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
:post (behavior ()
|
||||
(when (and (-> self on-screen?) ;; text is onscreen
|
||||
(pc-cheats? (-> *pc-settings* cheats) health-bars) ;; cheat enabled
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
(if (zero? (-> self font))
|
||||
(set! (-> self font) (new 'process 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning))))
|
||||
|
||||
|
||||
(set-scale! (-> self font) (lerp-scale 0.45 0.8 (the float (-> self damage)) 1.0 15.0))
|
||||
(set-flags! (-> self font) (font-flags shadow kerning large middle))
|
||||
(set-width! (-> self font) 100)
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
(defbehavior damage-number-init-by-other damage-number ((dmg int) (pos vector) (parent-mask process-mask))
|
||||
"initialize a damage-number"
|
||||
|
||||
|
||||
;; copy params
|
||||
(set! (-> self damage) dmg)
|
||||
(set! (-> self parent-mask) parent-mask)
|
||||
@@ -127,7 +127,7 @@
|
||||
|
||||
(defstate active (damage-number-metalkor)
|
||||
:virtual #t
|
||||
|
||||
|
||||
:post (behavior ()
|
||||
(if *debug-segment*
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf2) (-> self trans) *color-cyan*))
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
(defbehavior damage-number-metalkor-init-by-other damage-number-metalkor ((dmg float) (pos vector) (parent-mask process-mask))
|
||||
"initialize a damage-number-metalkor"
|
||||
|
||||
|
||||
;; copy params
|
||||
(set! (-> self damage-metalkor) dmg)
|
||||
(set! (-> self damage) (/ (the int (* (-> self damage-metalkor) 10000)) 4))
|
||||
@@ -176,7 +176,7 @@
|
||||
|
||||
(defun draw-health-bar ((x int) (y int) (width int) (height int) (hit-points float) (hit-points-max float) (bucket bucket-id))
|
||||
"Draw a rectangular health bar at the given location. color fades from green to yellow to red."
|
||||
|
||||
|
||||
(let* ((color (static-rgba 0 0 0 #x80))
|
||||
(bar-w (the int (* (/ hit-points hit-points-max) (max 0 (+ width -4)))))
|
||||
(x2 (+ x width))
|
||||
@@ -229,7 +229,7 @@
|
||||
|
||||
(deftype health-bar (process)
|
||||
((ppointer (pointer health-bar) :override)
|
||||
|
||||
|
||||
(trans-2d vector4w :inline)
|
||||
(width float)
|
||||
(height float)
|
||||
@@ -237,7 +237,7 @@
|
||||
(font font-context)
|
||||
(hit-points-max float)
|
||||
(hit-points float)
|
||||
|
||||
|
||||
;; who this bar is for
|
||||
(owner handle)
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
)
|
||||
|
||||
(defmethod new health-bar-manager ((allocation symbol) (type-to-make type))
|
||||
|
||||
|
||||
(let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(set! (-> this head) #f)
|
||||
(set! (-> this tail) #f)
|
||||
@@ -295,7 +295,7 @@
|
||||
)
|
||||
)
|
||||
(set! (-> this tail) bar-ptr)
|
||||
|
||||
|
||||
bar-ptr)
|
||||
|
||||
(defmethod remove-from-list ((this health-bar-manager) (bar-ptr (pointer health-bar)))
|
||||
@@ -359,12 +359,12 @@
|
||||
(set-depth! (-> self font) (/ (-> self trans-2d z) 16))
|
||||
;; now center (we could do this earlier but it's fine)
|
||||
(-! (-> self font origin x) (/ (-> self width) 2)))
|
||||
|
||||
|
||||
:code (behavior ()
|
||||
(while (and (handle->process (-> self owner)) (not (case (-> (handle->process (-> self owner)) next-state name) (('inactive 'hidden) #t))))
|
||||
(suspend))
|
||||
)
|
||||
|
||||
|
||||
:post (behavior ()
|
||||
(when (and (-> self on-screen?) ;; text is onscreen
|
||||
(pc-cheats? (-> *pc-settings* cheats) health-bars) ;; cheat enabled
|
||||
@@ -390,7 +390,7 @@
|
||||
|
||||
(defbehavior health-bar-init-by-other health-bar ((hit-points int) (hit-points-max int) (owner handle))
|
||||
"initialize a health-bar"
|
||||
|
||||
|
||||
;; copy params
|
||||
(set! (-> self hit-points-max) (the float hit-points-max))
|
||||
(set! (-> self hit-points) (the float hit-points))
|
||||
@@ -437,7 +437,7 @@
|
||||
|
||||
(defmethod set-proc-bar-hit-points ((this health-bar-manager) (proc process-drawable) (hit-points int))
|
||||
"simply set the hit points (not max hit points) of a process's health bar"
|
||||
|
||||
|
||||
(let ((the-bar (get-bar-for-process this proc)))
|
||||
(send-event (ppointer->process the-bar) 'set-hit-points hit-points)
|
||||
the-bar)
|
||||
|
||||
@@ -545,14 +545,14 @@
|
||||
((cpad-pressed? 0 right)
|
||||
(cpad-clear! 0 right)
|
||||
(+! (-> lst selection) 1)
|
||||
(set! need-update #t))
|
||||
(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))
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
;; (eq? (-> *level* level idx name) (-> info name))
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun dm-display-level-toggle-pick-func ((arg0 symbol) (arg1 debug-menu-msg))
|
||||
;; (let ((the-level (level-get *level* arg0)))
|
||||
;; (if (not the-level)
|
||||
@@ -68,43 +68,43 @@
|
||||
;; (and the-level (-> the-level display?))
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun debug-menu-make-load-want-menu ((ctx debug-menu-context) (lev-idx int))
|
||||
;;
|
||||
;;
|
||||
;; (let ((want-menu (new 'debug 'debug-menu ctx "Level want menu")))
|
||||
;;
|
||||
;;
|
||||
;; (let ((iter *level-load-list*))
|
||||
;; (while (not (or (null? iter) (null? (cdr iter)) (null? (cddr iter))))
|
||||
;; (debug-menu-append-item want-menu (new-dm-flag (symbol->string (the-as symbol (car iter))) (dcons (car iter) lev-idx) dm-want-level-toggle-pick-func))
|
||||
;;
|
||||
;;
|
||||
;; (set! iter (cdr iter))
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (new-dm-submenu (new 'debug 'string 0 (string-format "Want ~D" lev-idx)) want-menu)
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun debug-menu-make-load-display-menu ((ctx debug-menu-context))
|
||||
;;
|
||||
;;
|
||||
;; (let ((display-menu (new 'debug 'debug-menu ctx "Level display menu")))
|
||||
;;
|
||||
;;
|
||||
;; (let ((iter *level-load-list*))
|
||||
;; (while (not (or (null? iter) (null? (cdr iter)) (null? (cddr iter))))
|
||||
;; (debug-menu-append-item display-menu (new-dm-flag (symbol->string (the-as symbol (car iter))) (car iter) dm-display-level-toggle-pick-func))
|
||||
;;
|
||||
;;
|
||||
;; (set! iter (cdr iter))
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (new-dm-submenu "Display" display-menu)
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun debug-menu-make-load-teleport-menu ((ctx debug-menu-context))
|
||||
;;
|
||||
;;
|
||||
;; (let ((teleport-menu (new 'debug 'debug-menu ctx "Camera teleport menu")))
|
||||
;;
|
||||
;;
|
||||
;; (let ((iter *level-load-list*))
|
||||
;; (while (not (or (null? iter) (null? (cdr iter)) (null? (cddr iter))))
|
||||
;; (debug-menu-append-item teleport-menu
|
||||
@@ -121,15 +121,15 @@
|
||||
;; )
|
||||
;; )
|
||||
;; ))
|
||||
;;
|
||||
;;
|
||||
;; (set! iter (cdr iter))
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (new-dm-submenu "Camera teleport" teleport-menu)
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun debug-menu-make-load-menu ((ctx debug-menu-context))
|
||||
;; (let ((load-menu (new 'debug 'debug-menu ctx "Load menu")))
|
||||
;; (debug-menu-append-item load-menu (new-dm-bool "Level Border" *display-level-border* dm-boolean-toggle-pick-func))
|
||||
@@ -143,12 +143,12 @@
|
||||
;; (-> *setting-control* default border-mode)
|
||||
;; )
|
||||
;; )))
|
||||
;;
|
||||
;;
|
||||
;; (debug-menu-append-item load-menu (debug-menu-make-load-want-menu ctx 0)) ;; Want 0
|
||||
;; (debug-menu-append-item load-menu (debug-menu-make-load-want-menu ctx 1)) ;; Want 1
|
||||
;; (debug-menu-append-item load-menu (debug-menu-make-load-display-menu ctx)) ;; Display
|
||||
;; (debug-menu-append-item load-menu (debug-menu-make-load-teleport-menu ctx)) ;; Camera teleport
|
||||
;;
|
||||
;;
|
||||
;; (new-dm-submenu "Load" load-menu)
|
||||
;; )
|
||||
;; )
|
||||
@@ -505,7 +505,7 @@
|
||||
(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)
|
||||
(atx-add-level-group)
|
||||
)
|
||||
|
||||
(defun dm-anim-tester-x-func ((action symbol))
|
||||
@@ -594,7 +594,7 @@
|
||||
;; lst
|
||||
;; )
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (defun debug-menu-make-music-player-menu ((ctx debug-menu-context))
|
||||
;; (let ((music-menu (new 'debug 'debug-menu ctx "Music player menu")))
|
||||
;; (dotimes (i (-> *music-flava-name-list* length))
|
||||
@@ -994,7 +994,7 @@
|
||||
|
||||
;; (defun bg-custom ((level-name symbol))
|
||||
;; "Modified version of bg for the PC Port custom levels."
|
||||
;;
|
||||
;;
|
||||
;; ;; lookup info
|
||||
;; (format 0 "(bg-custom ~A)%" level-name)
|
||||
;; (let ((lev-info (lookup-level-info level-name)))
|
||||
@@ -1002,27 +1002,27 @@
|
||||
;; (format 0 "Unable to (bg-custom ~A), the level was not found in *level-load-list*~%" level-name)
|
||||
;; (return #f)
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; ;; kill jak (rip)
|
||||
;; (format 0 "doing stop~%")
|
||||
;; (stop 'play)
|
||||
;;
|
||||
;;
|
||||
;; ;; kill levels
|
||||
;; (dotimes (i 2)
|
||||
;; (unload! (-> *level* data i))
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; ;; enable visiblity. the custom level won't use it, but we want it on so other levels can be loaded.
|
||||
;; (set! (-> *level* vis?) #t)
|
||||
;;
|
||||
;;
|
||||
;; ;; disable border and play mode to prevent loading levels
|
||||
;; (set! (-> *level* border?) #f)
|
||||
;; (set! (-> *setting-control* default border-mode) #f)
|
||||
;; (set! (-> *level* play?) #f)
|
||||
;;
|
||||
;;
|
||||
;; ;; disable actor vis
|
||||
;; (set! *vis-actors* #f)
|
||||
;;
|
||||
;;
|
||||
;; (format 0 "doing level load~%")
|
||||
;; ;; allocate level. This may start the loading process, but won't finish it.
|
||||
;; (let ((lev (level-get-for-use *level* level-name 'active)))
|
||||
@@ -1031,7 +1031,7 @@
|
||||
;; (return #f)
|
||||
;; )
|
||||
;; (format 0 "about to start load loop, game will freeze and hopefully come back soon~%")
|
||||
;;
|
||||
;;
|
||||
;; ;; spin in a loop and load it. This will cause the game to freeze during the load,
|
||||
;; ;; but this is good enough for now.
|
||||
;; (while (or (= (-> lev status) 'loading)
|
||||
@@ -1040,19 +1040,19 @@
|
||||
;; )
|
||||
;; (load-continue lev)
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (when (not (-> lev info continues))
|
||||
;; (format 0 "level info has no continues, can't load it.~%")
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (let ((cont (car (-> lev info continues))))
|
||||
;; (start 'play (the continue-point cont))
|
||||
;; )
|
||||
;;
|
||||
;;
|
||||
;; (vis-load lev)
|
||||
;; (set! (-> lev all-visible?) #f)
|
||||
;; (set! (-> lev force-all-visible?) #t)
|
||||
;;
|
||||
;;
|
||||
;; ;; reset things
|
||||
;; ;(initialize! *game-info* 'game (the-as game-save #f) (the-as string #f))
|
||||
;; )
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
(defun entity-inspect-draw ((inspect-info entity-debug-inspect))
|
||||
"draw text about an entity on screen"
|
||||
|
||||
|
||||
(let ((LINE_HEIGHT (the int (ceil (* (get-debug-font-scale-factor) 15)))))
|
||||
(update-pad inspect-info 0)
|
||||
(let* ((e (-> inspect-info entity)) (name (res-lump-struct e 'name string)))
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
;; tag info
|
||||
(format (clear *debug-temp-string*) "~3L~2D)~0L ~20L~A~0L: " i (-> e tag i name) (-> e tag i elt-type))
|
||||
|
||||
|
||||
;; tag data - special cases first
|
||||
(cond
|
||||
;; some water-height info
|
||||
@@ -322,7 +322,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; draw a string for each tag instead of all at once. allows using smaller strings.
|
||||
(draw-string-xy *debug-temp-string* debug-buf 352 cur-y (font-color default) (font-flags shadow kerning middle))
|
||||
(+! cur-y y-adv)
|
||||
@@ -331,7 +331,7 @@
|
||||
))
|
||||
;; set max scroll based on how large the whole text was, ignore first 20 lines.
|
||||
(set! (-> inspect-info scroll-y-max) (max 0 (+ (the int (/ (the float -20) (get-debug-font-scale-factor))) (/ (- cur-y begin-y) LINE_HEIGHT))))
|
||||
|
||||
|
||||
)
|
||||
))))
|
||||
|
||||
|
||||
@@ -1319,7 +1319,7 @@
|
||||
)
|
||||
(cond
|
||||
((and purchased? (not unlocked?))
|
||||
|
||||
|
||||
(let ((unlock-text (lookup-text! *common-text* (-> info unlock) #f)))
|
||||
(print-game-text
|
||||
(case (-> info unlock)
|
||||
@@ -1397,7 +1397,7 @@
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-cheats-locked) #f) font #f 44 (bucket-id progress))
|
||||
(set-flags! font (font-flags kerning large))
|
||||
)
|
||||
|
||||
|
||||
;; --- from here on, the cheat is fully unlocked! ---
|
||||
((= (-> info can-toggle) #t)
|
||||
;; simple on-off switch
|
||||
@@ -1532,7 +1532,7 @@
|
||||
(draw-cheat-list (-> *pc-cheats-list* (- item max-item)) arg0 arg1 1 arg3 sliding-y))
|
||||
)
|
||||
((>= (- item prev) 0)
|
||||
|
||||
|
||||
(draw-highlight (+ item-y 22) 22 sv-16)
|
||||
(dotimes (i 7)
|
||||
(let* ((this-item (+ item -3 i)))
|
||||
@@ -3191,7 +3191,7 @@
|
||||
(set! (-> this scroll-index) (the float (-> this selected-index)))
|
||||
(seek-ease! (-> this scroll-index) (the float (-> this selected-index)) (* 0.15 (-> PP clock time-adjust-ratio)) 0.3 (* 0.0015 (-> PP clock time-adjust-ratio))))
|
||||
(set! (-> font origin y) (- 194.0 (* (-> this scroll-index) text-height) (- text-pad)))
|
||||
|
||||
|
||||
;; now draw the list!
|
||||
(let ((valid-index 0))
|
||||
(dotimes (i (-> this num-resolutions))
|
||||
@@ -3200,7 +3200,7 @@
|
||||
(let ((this-w 0) (this-h 0) (this-aspect 0.0))
|
||||
(pc-get-resolution i (& this-w) (& this-h))
|
||||
(set! this-aspect (/ (the float this-w) (the float this-h)))
|
||||
|
||||
|
||||
(when (or (= (pc-get-display-mode) 'windowed)
|
||||
(< (fabs (- (-> this win-aspect) this-aspect)) 0.05))
|
||||
(if (= valid-index (-> this selected-index))
|
||||
@@ -3212,7 +3212,7 @@
|
||||
(1+! valid-index)
|
||||
))
|
||||
)
|
||||
|
||||
|
||||
(when (fullscreen?)
|
||||
;; draw extra hardcoded cases
|
||||
(if (= valid-index (-> this selected-index))
|
||||
@@ -3229,7 +3229,7 @@
|
||||
(+! (-> font origin y) text-height)
|
||||
(1+! valid-index)
|
||||
))
|
||||
|
||||
|
||||
)
|
||||
(else
|
||||
;; wtf?? just print an ominous warning.
|
||||
@@ -3243,7 +3243,7 @@
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-error-no-resolutions) #f) font #f 44 (bucket-id progress))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(end-scissor-resolution box 1.0)
|
||||
)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
(defenum kill-stats-source
|
||||
:type uint8
|
||||
(unknown)
|
||||
|
||||
|
||||
(gun-yellow)
|
||||
(gun-red)
|
||||
(gun-blue)
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
(indax-punch)
|
||||
(indax-spin)
|
||||
|
||||
|
||||
(guard)
|
||||
(sig)
|
||||
(ashelin)
|
||||
@@ -58,7 +58,7 @@
|
||||
(grim)
|
||||
(mog)
|
||||
(metalhead)
|
||||
|
||||
|
||||
(bot)
|
||||
(enemy)
|
||||
|
||||
@@ -155,14 +155,14 @@
|
||||
|
||||
(defmethod initialize ((this kill-statistics))
|
||||
"initialize a kill-statistics to the default values"
|
||||
|
||||
|
||||
(dotimes (i KILL_STATS_MAX_ENEMY_TYPES)
|
||||
(set! (-> this enemies i name) #f)
|
||||
(dotimes (ii KILL_STATS_MAX_SOURCE)
|
||||
(set! (-> this enemies i sources ii) 0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
0)
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
(when (not kill-stats)
|
||||
(format 0 "out of stats memory!~%")
|
||||
(return 0))
|
||||
|
||||
|
||||
(+! (-> kill-stats sources source) 1))
|
||||
)
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
(let ((kill-stats (get-enemy-stats this name)))
|
||||
(if (not kill-stats)
|
||||
(return 0))
|
||||
|
||||
|
||||
(-> kill-stats sources source))
|
||||
)
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
(kills 0))
|
||||
(if (not kill-stats)
|
||||
(return 0))
|
||||
|
||||
|
||||
(dotimes (i KILL_STATS_MAX_SOURCE)
|
||||
(+! kills (-> kill-stats sources i)))
|
||||
kills)
|
||||
@@ -307,7 +307,7 @@
|
||||
|
||||
(cond
|
||||
((symbol-member? (-> en-type symbol) '(kid kid-escort)) 'kid)
|
||||
|
||||
|
||||
((= en-type metalhead-predator) 'predator)
|
||||
((= en-type metalhead-grunt) 'grunt)
|
||||
((= en-type metalhead-flitter) 'flitter)
|
||||
@@ -351,7 +351,7 @@
|
||||
|
||||
(defun is-metalhead? ((p process))
|
||||
"is p a metal head enemy?"
|
||||
|
||||
|
||||
(let ((p-type (remap-enemy-type-name (-> p type)))
|
||||
(iter *metalhead-types*))
|
||||
(while (not (null? iter))
|
||||
@@ -366,7 +366,7 @@
|
||||
|
||||
(defun killed-each-metalhead? ()
|
||||
"#t = every metal head type has been killed once."
|
||||
|
||||
|
||||
(let ((iter *metalhead-types*))
|
||||
(while (not (null? iter))
|
||||
(let ((cur (the symbol (car iter))))
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
((target-darkjak-bomb1) (kill-stats-source darkjak-bomb1))
|
||||
(else (kill-stats-source unknown))))
|
||||
(((penetrate dark-skin touch) (penetrate dark-giant dark-skin touch)) (kill-stats-source unknown))
|
||||
|
||||
|
||||
(((penetrate jak-yellow-shot generic-attack)) (kill-stats-source gun-yellow))
|
||||
(((penetrate jak-red-shot generic-attack)) (kill-stats-source gun-red))
|
||||
(((penetrate jak-blue-shot generic-attack)) (kill-stats-source gun-blue))
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
(defun add-to-kill-stats ((enemy enemy) (attack enemy-attack-info))
|
||||
"adds a kill to the statistics tracker"
|
||||
|
||||
|
||||
;; (format #t "enemy ~A killed (incoming ~e sec ago)~%" (-> enemy name) (- (-> PP clock old-frame-counter) (-> attack attack-time)))
|
||||
;; (format #t "~Tattacker: ~A~%" (handle->process (-> attack attacker-handle)))
|
||||
;; (format #t "~Tpu: ")
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
(gui gui-connection)
|
||||
)
|
||||
:pack-me
|
||||
|
||||
|
||||
(:methods
|
||||
(clear-line (_type_) int))
|
||||
)
|
||||
@@ -239,7 +239,7 @@
|
||||
(queue subtitle2-queue-element PC_SUBTITLE_QUEUE_SIZE :inline)
|
||||
(lines subtitle2-line-queue 2 :inline)
|
||||
(line-queue-idx int8)
|
||||
|
||||
|
||||
;; debug
|
||||
(cheat-backup symbol)
|
||||
(checking-lines? symbol)
|
||||
@@ -323,7 +323,7 @@
|
||||
(dotimes (i (pc-subtitle2-speaker max))
|
||||
(set! (-> *subtitle2-speaker-color-table* i) (-> *font-work* color-table (font-color red) color 0))
|
||||
)
|
||||
|
||||
|
||||
(set-subtitle-speaker-color! computer (static-rgba #x60 #x60 #x60 #x80))
|
||||
(set-subtitle-speaker-color! jak (static-rgba #x70 #x80 #x00 #x80))
|
||||
(set-subtitle-speaker-color! darkjak (static-rgba #x68 #x68 #x80 #x80))
|
||||
@@ -351,7 +351,7 @@
|
||||
(set-subtitle-speaker-color! precursor (static-rgba #x00 #x60 #x80 #x80))
|
||||
(set-subtitle-speaker-color! citizen-male (static-rgba #x70 #x70 #x70 #x80))
|
||||
(set-subtitle-speaker-color! citizen-female (static-rgba #x70 #x70 #x70 #x80))
|
||||
|
||||
|
||||
(set-subtitle-speaker-color<-speaker! kid jak)
|
||||
(set-subtitle-speaker-color<-speaker! guard-a guard)
|
||||
(set-subtitle-speaker-color<-speaker! guard-b guard)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
;; invalid name so return invalid scene.
|
||||
(if (not name)
|
||||
(return (the subtitle2-scene #f)))
|
||||
|
||||
|
||||
;; bounds checking
|
||||
(when (> (length name) (-> *vag-temp-string* allocated-length))
|
||||
(format 0 "vag temp string is too short!! wanted: ~D chars~%" (length name)))
|
||||
@@ -80,7 +80,7 @@
|
||||
(defmethod get-line-at-pos ((obj subtitle2-scene) (pos float) (index int))
|
||||
"return the subtitle line at that position. #f = none found
|
||||
index is which line to return, since you can have multiple lines that cover the same position."
|
||||
|
||||
|
||||
(let ((found 0))
|
||||
|
||||
(dotimes (i (length obj))
|
||||
@@ -90,7 +90,7 @@
|
||||
(return (-> obj lines i)))
|
||||
(1+! found)
|
||||
)))
|
||||
|
||||
|
||||
(the subtitle2-line #f))
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@
|
||||
(set-origin! font (the int (/ (- 512.0 (-> font width)) 2))
|
||||
(the int (* (if (-> self have-message?) 0.524 0.698) 416)))
|
||||
(set-height! font (the int (* (-> *SUBTITLE2-bank* lines) 44)))
|
||||
|
||||
|
||||
;; if we have the minimap, set the right border to 74.4% of screen width. shrink if larger than that.
|
||||
;; TODO scale this with aspect.
|
||||
(when (and (-> self have-minimap?)
|
||||
@@ -378,7 +378,7 @@
|
||||
|
||||
(defmethod draw-subtitles ((self subtitle2))
|
||||
"do the subtitle drawing"
|
||||
|
||||
|
||||
;; check the gui queue for lines to add to the line queue
|
||||
(let ((line-queue-old (if (zero? (-> self line-queue-idx)) (-> self lines 0) (-> self lines 1)))
|
||||
(line-queue (if (zero? (-> self line-queue-idx)) (-> self lines 1) (-> self lines 0)))
|
||||
@@ -488,20 +488,20 @@
|
||||
(1+! lines-done)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> self have-subtitles?) subtitles-drawn?)
|
||||
(when (not (-> self have-subtitles?))
|
||||
(set-action! *gui-control* (gui-action hidden) (-> self gui-id)
|
||||
(gui-channel none) (gui-action none) (the-as string #f) (the-as (function gui-connection symbol) #f) (the-as process #f)))
|
||||
|
||||
(set! (-> self font origin y) start-y)))
|
||||
|
||||
|
||||
0)
|
||||
|
||||
(when *debug-segment*
|
||||
(defmethod debug-print-queue ((self subtitle2))
|
||||
"print the queue to *stdcon0*"
|
||||
|
||||
|
||||
(format *stdcon0* "q: ~%")
|
||||
(dotimes (i PC_SUBTITLE_QUEUE_SIZE)
|
||||
(if (-> self queue i gui)
|
||||
@@ -520,7 +520,7 @@
|
||||
|
||||
(defmethod debug-print-speakers ((self subtitle2))
|
||||
"print all speakers onscreen"
|
||||
|
||||
|
||||
(if (not *subtitle2-text*)
|
||||
(return 0))
|
||||
|
||||
@@ -640,14 +640,14 @@
|
||||
:post (behavior ()
|
||||
|
||||
(draw-subtitles self)
|
||||
|
||||
|
||||
(when *debug-segment*
|
||||
(if *display-subtitle-speakers*
|
||||
(debug-print-speakers self))
|
||||
(if PC_SUBTITLE_DEBUG
|
||||
(debug-print-queue self))
|
||||
)
|
||||
|
||||
|
||||
(when (-> self movie-mode?)
|
||||
(set! (-> self movie-gui) #f)
|
||||
(set! (-> self movie-mode?) #f)
|
||||
|
||||
@@ -27,7 +27,7 @@ A "connection" is really just a function that gets called when the engine runs,
|
||||
(deftype connectable (structure)
|
||||
"A connectable is the linked-list node part of a connection.
|
||||
The connections themselves are owned by the engine.
|
||||
|
||||
|
||||
The `next0`/`prev0` references are used for how this belongs in the connectable list
|
||||
belonging to the [[engine]]. These terminate on special nodes stored in the engine:
|
||||
`alive-list`/`alive-list-end` for the active connections, and `dead-list`/`dead-list-end`
|
||||
|
||||
@@ -197,7 +197,7 @@ This is updated from the entity system used in Crash 2, which had most of these
|
||||
Correct lookups return a res-tag-pair, which contains one tag index in the lower 32 bits and one in the upper 32 bits.
|
||||
Depending on the mode, they may be the same, or they may be two tags that you should interpolate
|
||||
between, if the exact time was not found.
|
||||
|
||||
|
||||
@param name-sym should be the name of the thing you want.
|
||||
@param time is for the timestamp you want.
|
||||
If mode = 'base, then both the indices are the same and the timestamp is ignored.
|
||||
|
||||
@@ -423,7 +423,7 @@
|
||||
)
|
||||
|
||||
(defun forward-down-nopitch->inv-matrix ((arg0 matrix) (arg1 vector) (arg2 vector))
|
||||
"Create a matrix representing an inverse transform where arg1 is forward (+z)
|
||||
"Create a matrix representing an inverse transform where arg1 is forward (+z)
|
||||
and arg2 is down (-y). Will not use the pitch of forward."
|
||||
(vector-normalize-copy! (-> arg0 uvec) arg2 1.0)
|
||||
(vector-negate! (-> arg0 uvec) (-> arg0 uvec))
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import glob
|
||||
import re
|
||||
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--fix", action="store_true")
|
||||
parser.set_defaults(fix=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
folders_to_check = ["goal_src"]
|
||||
|
||||
flagged_instances = []
|
||||
|
||||
for folder in folders_to_check:
|
||||
files_to_check = glob.glob("./{}/**/*.gc".format(folder), recursive=True)
|
||||
files_to_check += glob.glob("./{}/**/*.gs".format(folder), recursive=True)
|
||||
files_to_check += glob.glob("./{}/**/*.gd".format(folder), recursive=True)
|
||||
for filename in files_to_check:
|
||||
# Get the file contents
|
||||
with open(filename, "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
lines_with_trailing_whitespace = [line.rstrip('\n').endswith(' ') for line in lines]
|
||||
if any(lines_with_trailing_whitespace):
|
||||
flagged_instances.append(filename)
|
||||
if args.fix:
|
||||
cleaned_lines = [line.rstrip() + '\n' if line.rstrip() != line else line for line in lines]
|
||||
with open(filename, 'w') as file:
|
||||
file.writelines(cleaned_lines)
|
||||
|
||||
if len(flagged_instances) == 0:
|
||||
exit(0)
|
||||
|
||||
if args.fix:
|
||||
print("Fixed whitespace in {} files:".format(len(flagged_instances)))
|
||||
else:
|
||||
print("Found empty whitespace in the following files, please trim them:")
|
||||
for file in flagged_instances:
|
||||
print(file)
|
||||
exit(1)
|
||||
Reference in New Issue
Block a user