fix draw-string-xy-scaled cropping (#3041)

fixes #3038 


https://github.com/open-goal/jak-project/assets/2515356/5b7a490f-e1fb-4a12-a3d9-b576a2c1d574
This commit is contained in:
Matt Dallmeyer 2023-09-30 16:17:50 -07:00 committed by GitHub
parent e130244271
commit d149838485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1784,36 +1784,31 @@
;; Added for PC port ;; Added for PC port
(defun draw-string-xy-scaled ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags font-flags) (scale float)) (defun draw-string-xy-scaled ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags font-flags) (scale float))
"Draw a string at the given xy location, with the given scale." "Draw a string at the given xy location, with the given scale."
(let ((font-ctxt (new 'stack 'font-context *font-default-matrix* x y 0.0 color flags))) (let* ((font-ctxt (new 'stack 'font-context *font-default-matrix* x y 0.0 color flags))
(let ((scaled-width (* (-> font-ctxt width) scale)) (scaled-width (* (-> font-ctxt width) scale))
(scaled-height (* (-> font-ctxt height) scale)) (scaled-height (* (-> font-ctxt height) scale))
(orig-mat-x-scale (-> font-ctxt mat vector 0 x)) (orig-mat-x-scale (-> font-ctxt mat vector 0 x))
(orig-mat-y-scale (-> font-ctxt mat vector 1 y)) (orig-mat-y-scale (-> font-ctxt mat vector 1 y))
(orig-vid-parms-x-scale (-> *video-parms* relative-x-scale)) (orig-vid-parms-x-scale (-> *video-parms* relative-x-scale))
(orig-vid-parms-y-scale (-> *video-parms* relative-y-scale)) (orig-vid-parms-y-scale (-> *video-parms* relative-y-scale))
) )
(*! (-> font-ctxt scale) scale) ;; scaling globals *font-default-matrix*, *video-parms* (based on print-game-text scaling)
(set! (-> font-ctxt width) scaled-width) (*! (-> *font-default-matrix* vector 0 x) scale)
(set! (-> font-ctxt height) scaled-height) (*! (-> *font-default-matrix* vector 1 y) scale)
(*! (-> *video-parms* relative-x-scale) scale)
;; scaling globals *font-default-matrix*, *video-parms* (based on print-game-text scaling) (*! (-> *video-parms* relative-y-scale) scale)
(*! (-> *font-default-matrix* vector 0 x) scale) (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale)))
(*! (-> *font-default-matrix* vector 1 y) scale) (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 (-> *video-parms* relative-y-scale)))
(*! (-> *video-parms* relative-x-scale) scale)
(*! (-> *video-parms* relative-y-scale) scale)
(set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale)))
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 scale))
(draw-string str buf font-ctxt) (draw-string str buf font-ctxt)
;; un-scaling globals *font-default-matrix*, *video-params* ;; un-scaling globals *font-default-matrix*, *video-params*
(set! (-> *font-default-matrix* vector 0 x) orig-mat-x-scale) (set! (-> *font-default-matrix* vector 0 x) orig-mat-x-scale)
(set! (-> *font-default-matrix* vector 1 y) orig-mat-y-scale) (set! (-> *font-default-matrix* vector 1 y) orig-mat-y-scale)
(set! (-> *video-parms* relative-x-scale) orig-vid-parms-x-scale) (set! (-> *video-parms* relative-x-scale) orig-vid-parms-x-scale)
(set! (-> *video-parms* relative-y-scale) orig-vid-parms-y-scale) (set! (-> *video-parms* relative-y-scale) orig-vid-parms-y-scale)
(set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale)))
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 (-> *video-parms* relative-y-scale))) (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 (-> *video-parms* relative-y-scale)))
)
) )
(none) (none)
) )