mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
[jak2] text aspect ratio fixes (#2251)
Fixes the aspect ratio of the font renderer (Jak 2 does not need the same hacks as Jak 1), the custom letterbox/pillarbox sizes and fixes the heap display. --------- Co-authored-by: water <awaterford111445@gmail.com>
This commit is contained in:
parent
909da024fc
commit
ad9a532ff9
|
@ -313,7 +313,7 @@ void OpenGLRenderer::init_bucket_renderers_jak2() {
|
|||
init_bucket_renderer<DirectRenderer>("progress", BucketCategory::OTHER, BucketId::PROGRESS,
|
||||
0x8000);
|
||||
init_bucket_renderer<DirectRenderer>("screen-filter", BucketCategory::OTHER,
|
||||
BucketId::SCREEN_FILTER, 0x8000);
|
||||
BucketId::SCREEN_FILTER, 256);
|
||||
init_bucket_renderer<DirectRenderer>("bucket-322", BucketCategory::OTHER, BucketId::BUCKET_322,
|
||||
0x8000);
|
||||
init_bucket_renderer<DirectRenderer>("debug2", BucketCategory::OTHER, BucketId::DEBUG2, 0x8000);
|
||||
|
|
|
@ -284,15 +284,22 @@
|
|||
)
|
||||
)
|
||||
|
||||
(defmacro define-once (name value)
|
||||
"define once. Does not set the symbol if it already has a value. It must have been at least forward-declared first!"
|
||||
`(begin
|
||||
(if (or (not ,name) (zero? ,name))
|
||||
(set! ,name ,value)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro define-perm (name type value)
|
||||
"Define 'permanent', meaning the original definition will not be blown away by a file reload.
|
||||
If the value of the symbol is unset (zero) or set to false, it will be defined.
|
||||
Otherwise, no effect, other than to inform the type system of the symbol type."
|
||||
`(begin
|
||||
(define-extern ,name ,type)
|
||||
(if (or (not ,name) (zero? ,name))
|
||||
(set! ,name ,value)
|
||||
)
|
||||
(define-once ,name ,value)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -16,22 +16,25 @@
|
|||
(defconstant MEM_BAR_HEIGHT 8) ;; total height of the bar
|
||||
(defconstant MEM_BAR_NUM 7) ;; amount of bars (override later if wanted)
|
||||
(defconstant MEM_BAR_BG_COL (static-rgba 64 64 64 64)) ;; color for the empty part of the bar
|
||||
(defconstant MEM_BAR_X (- 480 MEM_BAR_WIDTH)) ;; x coord for left side of the bar list
|
||||
(defconstant MEM_BAR_Y (- 224 4 (* MEM_BAR_HEIGHT MEM_BAR_NUM))) ;; y coord for top side of the bar list
|
||||
(defconstant MEM_BAR_RIGHT 480) ;; x coord for the right side of the bar list
|
||||
(defconstant MEM_BAR_BOTTOM 224) ;; x coord for the bottom side of the bar list
|
||||
|
||||
(defconstant MEM_BAR_X (- MEM_BAR_RIGHT MEM_BAR_WIDTH)) ;; x coord for left side of the bar list
|
||||
(defconstant MEM_BAR_Y (- MEM_BAR_BOTTOM 4 (* MEM_BAR_HEIGHT MEM_BAR_NUM))) ;; y coord for top side of the bar list
|
||||
|
||||
(defmacro draw-memory-bar-generic (buf &key remain &key total &key name &key idx &key color)
|
||||
"draw a memory usage bar"
|
||||
`(let* (
|
||||
(total (the float ,total))
|
||||
(remain (the float ,remain))
|
||||
(used-p (/ (- total remain) total))
|
||||
(used-p (if (zero? total) 0.0 (/ (- total remain) total)))
|
||||
(used-x (the int (* used-p MEM_BAR_WIDTH)))
|
||||
(used-y (+ MEM_BAR_Y (* ,idx MEM_BAR_HEIGHT)))
|
||||
)
|
||||
(draw-sprite2d-xy ,buf MEM_BAR_X used-y used-x MEM_BAR_HEIGHT ,color)
|
||||
(draw-sprite2d-xy ,buf (+ MEM_BAR_X used-x) used-y (- MEM_BAR_WIDTH used-x) MEM_BAR_HEIGHT MEM_BAR_BG_COL)
|
||||
(draw-string-xy ,name ,buf MEM_BAR_X used-y (font-color red) (font-flags shadow kerning right))
|
||||
(draw-string-xy (string-format "~,,2f%" (* used-p 100)) ,buf (+ MEM_BAR_X used-x) used-y (font-color red) (font-flags shadow kerning middle))
|
||||
(draw-string-xy (string-format "~,,2f%" (* used-p 100)) ,buf (+ MEM_BAR_X used-x) used-y (font-color default) (font-flags shadow kerning middle))
|
||||
(draw-string-xy (string-format "~,,1fM" (/ total (* 1024 1024))) ,buf (+ MEM_BAR_X MEM_BAR_WIDTH) used-y (font-color red) (font-flags shadow kerning left))
|
||||
)
|
||||
)
|
||||
|
|
|
@ -279,12 +279,7 @@
|
|||
(update-speedrun obj))
|
||||
|
||||
(when (not (-> obj use-vis?))
|
||||
(set! (-> (get-video-params) relative-x-scale) (-> obj aspect-ratio-reciprocal))
|
||||
(set! (-> (get-video-params) relative-x-scale-reciprical) (-> obj aspect-ratio-scale))
|
||||
(set! (-> *font-default-matrix* vector 0 x) (-> (get-video-params) relative-x-scale))
|
||||
)
|
||||
(when (not (-> obj use-vis?))
|
||||
(update-progress-video-hacks obj)
|
||||
(update-video-hacks obj)
|
||||
)
|
||||
(cond
|
||||
((-> obj force-actors?)
|
||||
|
|
|
@ -330,7 +330,7 @@
|
|||
(update-to-os (_type_) none)
|
||||
(update-discord-rpc (_type_) object)
|
||||
(update-speedrun (_type_) object)
|
||||
(update-progress-video-hacks (_type_) object)
|
||||
(update-video-hacks (_type_) object)
|
||||
(reset (_type_) none)
|
||||
(reset-audio (_type_) none)
|
||||
(reset-input (_type_) none)
|
||||
|
|
|
@ -299,8 +299,12 @@
|
|||
(speedrun-mode-update))
|
||||
0)
|
||||
|
||||
(defmethod update-progress-video-hacks pc-settings-jak1 ((obj pc-settings-jak1))
|
||||
"update the graphics hacks used for the progress menu. ugh."
|
||||
(defmethod update-video-hacks pc-settings-jak1 ((obj pc-settings-jak1))
|
||||
"update the graphics hacks used for sprites and other things. ugh."
|
||||
|
||||
(set! (-> (get-video-params) relative-x-scale) (-> obj aspect-ratio-reciprocal))
|
||||
(set! (-> (get-video-params) relative-x-scale-reciprical) (-> obj aspect-ratio-scale))
|
||||
(set! (-> *font-default-matrix* vector 0 x) (-> (get-video-params) relative-x-scale))
|
||||
|
||||
(set-hud-aspect-ratio 'aspect4x3 'ntsc) ;; set hud aspect ratios every frame because why not?
|
||||
|
||||
|
@ -356,7 +360,7 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(define *pc-settings* (new 'global 'pc-settings-jak1))
|
||||
(define-once *pc-settings* (new 'global 'pc-settings-jak1))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -41,16 +41,18 @@
|
|||
(cond
|
||||
((< (-> *pc-settings* aspect-ratio) ASPECT_16X9)
|
||||
;; too tall. needs vertical letterboxing.
|
||||
(let ((lbx-h (the int (* 112.0 (- 1.0 (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9))))))
|
||||
(let ((lbx-h (the int (* 208.0 (- 1.0 (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9))))))
|
||||
;(format 0 "using new letterbox! size: ~D~%" lbx-h)
|
||||
(draw-sprite2d-xy dma-buf 0 0 512 lbx-h (new 'static 'rgba :a #x80))
|
||||
(draw-sprite2d-xy dma-buf 0 (- 448 lbx-h) 512 lbx-h (new 'static 'rgba :a #x80))
|
||||
(draw-sprite2d-xy dma-buf 0 (- 416 lbx-h) 512 lbx-h (new 'static 'rgba :a #x80))
|
||||
)
|
||||
)
|
||||
((> (-> *pc-settings* aspect-ratio) ASPECT_16X9)
|
||||
;; too wide. needs horizontal letterboxing.
|
||||
(let ((lbx-w (the int (* 256.0 (- 1.0 (/ ASPECT_16X9 (-> *pc-settings* aspect-ratio)))))))
|
||||
(draw-sprite2d-xy dma-buf 0 0 lbx-w 448 (new 'static 'rgba :a #x80))
|
||||
(draw-sprite2d-xy dma-buf (- 512 lbx-w) 0 lbx-w 448 (new 'static 'rgba :a #x80))
|
||||
;(format 0 "using new pillarbox! size: ~D~%" lbx-w)
|
||||
(draw-sprite2d-xy dma-buf 0 0 lbx-w 416 (new 'static 'rgba :a #x80))
|
||||
(draw-sprite2d-xy dma-buf (- 512 lbx-w) 0 lbx-w 416 (new 'static 'rgba :a #x80))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#f)
|
||||
)
|
||||
|
||||
(defconstant MEM_BAR_HEIGHT 14) ;; total height of the bar
|
||||
(defconstant MEM_BAR_BOTTOM 416) ;; x coord for the bottom side of the bar list
|
||||
(defconstant MEM_BAR_NUM 11) ;; 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"
|
||||
|
@ -31,7 +33,7 @@
|
|||
(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* length))
|
||||
(if (!= (-> *level* level i status) 'inactive) (draw-memory-bar-kheap buf (-> *level* level i heap) :name (string-format "l~D" i) :idx (1+! idx) :color (-> level-heap-colors i)))
|
||||
(draw-memory-bar-kheap buf (-> *level* level i heap) :name (string-format "l~D" i) :idx (1+! idx) :color (-> level-heap-colors i))
|
||||
)
|
||||
(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
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
)
|
||||
|
||||
(defmethod get-game-language! pc-settings-jak2 ((obj pc-settings-jak2))
|
||||
(-> *setting-control* user-default language)
|
||||
(get-current-language)
|
||||
)
|
||||
|
||||
(defmethod update-discord-rpc pc-settings-jak2 ((obj pc-settings-jak2))
|
||||
|
@ -78,10 +78,11 @@
|
|||
#f
|
||||
)
|
||||
|
||||
(defmethod update-progress-video-hacks pc-settings-jak2 ((obj pc-settings-jak2))
|
||||
(defmethod update-video-hacks pc-settings-jak2 ((obj pc-settings-jak2))
|
||||
"update the graphics hacks used for the progress menu. ugh."
|
||||
|
||||
#f
|
||||
(set! (-> (get-video-params) relative-x-scale) (-> obj aspect-ratio-reciprocal))
|
||||
(set! (-> (get-video-params) relative-x-scale-reciprical) (-> obj aspect-ratio-scale))
|
||||
)
|
||||
|
||||
|
||||
|
@ -111,7 +112,7 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(define *pc-settings* (new 'global 'pc-settings-jak2))
|
||||
(define-once *pc-settings* (new 'global 'pc-settings-jak2))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
Loading…
Reference in a new issue