Files
jak-project/goal_src/jak2/pc/debug/pc-debug-methods.gc
ManDude e130244271 [jak2] scalable debug font + fix debug menu widescreen bugs (#3044)
also hides empty (no commands) regions from the viewers by default now.
2023-09-30 21:19:47 +01:00

88 lines
3.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
#|
Various debugging displays made for the pc port. This file includes overrides or game-specific implementations.
|#
;; debug-only file!
(declare-file (debug))
(defmethod print-debug-misc pc-settings-jak2 ((obj pc-settings-jak2))
"prints various miscellaneous debug text to the game console, according to what's enabled in this object."
#f
)
(defconstant MEM_BAR_HEIGHT (the int (* 14.0 (get-debug-font-scale-factor)))) ;; total height of the bar
(defconstant MEM_BAR_BOTTOM 416) ;; x coord for the bottom side of the bar list
(defconstant MEM_BAR_NUM (+ LEVEL_MAX 5)) ;; amount of memory usage bars (override later if wanted)
(defmethod draw-memory pc-settings-jak2 ((obj pc-settings-jak2) (buf dma-buffer))
"draw the memory heap status in the bottom right corner"
(when *display-heap-status*
(let ((idx 0)
(level-heap-colors (new 'static 'array rgba 3 (static-rgba 32 255 255 64)
(static-rgba 255 32 255 64)
(static-rgba 255 255 32 64)
)))
(draw-memory-bar-kheap buf global :idx idx :color (static-rgba 32 32 255 64))
(draw-memory-bar-kheap buf debug :idx (1+! idx) :color (static-rgba 255 32 32 64))
(dotimes (i LEVEL_MAX)
(draw-memory-bar-kheap buf (-> *level* level i heap)
:name (aif (-> *level* level i borrow-from-level)
(string-format "(~A)l~D<-l~D" (-> *level* level i name) i (-> it index))
(string-format "(~A)l~D" (-> *level* level i name) i))
:idx (1+! idx) :color (-> level-heap-colors (mod i 3)))
)
(draw-memory-bar-dead-pool-heap buf *nk-dead-pool* :name "actor" :idx (1+! idx) :color (static-rgba 32 255 32 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) global-buf)))
:total (length (-> *display* frames (-> *display* on-screen) global-buf))
:name "dma-global" :idx (1+! idx) :color (static-rgba 32 32 255 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) debug-buf)))
:total (length (-> *display* frames (-> *display* on-screen) debug-buf))
:name "dma-debug" :idx (1+! idx) :color (static-rgba 255 32 32 64))
)
#t)
)
(define *region-debug-inspect* (the drawable-region-prim #f))
(define *display-region-inside* #f)
(define *merge-region-prims* #f)
(define *display-city-info* #f)
(define *city-info-x* 0)
(define *city-info-y* 0)
(define *city-info-z* 0)
(define *debug-track-skill* #f)
(defun debug-track-skill ()
"draws a line and prints the distance to every skill in every active level"
(let ((start-pos (target-pos 0)))
(dotimes (i (-> *level* length))
(let ((lev (-> *level* level i)))
(when (= (-> lev status) 'active)
;; actor entities
(let ((actors (-> lev bsp actors)))
(when (nonzero? actors)
(dotimes (ii (-> actors length))
(let ((e (-> actors data ii actor)))
(when (and (= (-> e etype symbol) 'skill) (or (not (-> e extra)) (zero? (-> e extra)) (not (logtest? (-> e extra perm status) (entity-perm-status dead)))))
(add-debug-line #t (bucket-id debug-no-zbuf1) start-pos (-> e trans) (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1))
(format *stdcon* "~S at ~m ~m ~m (~m away)~%" (res-lump-struct e 'name string) (-> e trans x) (-> e trans y) (-> e trans z) (vector-vector-distance start-pos (-> e trans)))
)
)
)
)
)
)
)
)
)
#f)