[jak2, jak3] Unstretch moon and sun (#3822)

Fix the issue where the moon gets wide when using PC aspect ratios


![image](https://github.com/user-attachments/assets/db0ad274-5ee4-4ec3-92b6-650d295f8622)

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2025-01-04 12:39:23 -05:00
committed by GitHub
parent 2b226fedea
commit e0acc2d15f
2 changed files with 43 additions and 0 deletions
+20
View File
@@ -37,6 +37,24 @@ vf30: cam 1 (premultiplied by hmge)
vf31: cam 0 (premultiplied by hmge)
|#
(defun update-pc-sky-scaling ()
(let ((scale-factor (if (-> *pc-settings* use-vis?)
1.0
(-> *video-params* relative-x-scale))))
(set! (-> *sky-work* sun-coords 0 x) (* scale-factor -267.0))
(set! (-> *sky-work* sun-coords 1 x) (* scale-factor 267.0))
(set! (-> *sky-work* green-coords 0 x) (* scale-factor -126.0))
(set! (-> *sky-work* green-coords 1 x) (* scale-factor 126.0))
(set! (-> *sky-work* moon0-coords 0 x) (* scale-factor -357.0))
(set! (-> *sky-work* moon0-coords 1 x) (* scale-factor 357.0))
(set! (-> *sky-work* moon1-coords 0 x) (* scale-factor -1207.0))
(set! (-> *sky-work* moon1-coords 1 x) (* scale-factor 1207.0))
(set! (-> *sky-work* moon2-coords 0 x) (* scale-factor -232.0))
(set! (-> *sky-work* moon2-coords 1 x) (* scale-factor 232.0))
)
(none)
)
;; DECOMP BEGINS
;; set the xy component of vf24 (texture offset for large poly renderer) to values / 65,536
@@ -776,6 +794,8 @@ vf31: cam 0 (premultiplied by hmge)
)
(defmethod draw ((this sky-work))
;; og:preserve-this
(update-pc-sky-scaling)
(let ((v1-0 *time-of-day-context*)
(a0-1 #f)
)
+23
View File
@@ -20,6 +20,27 @@
(def-mips2c render-sky-tri (function (inline-array sky-vertex) dma-buffer none))
(defun update-pc-sky-scaling ()
"Update values in sky-work so the moon/sun don't look stretched."
(let ((scale-factor (if (-> *pc-settings* use-vis?)
1.0
(-> *video-params* relative-x-scale))))
(set! (-> *sky-work* sun-coords 0 x) (* scale-factor -267.0))
(set! (-> *sky-work* sun-coords 1 x) (* scale-factor 267.0))
(set! (-> *sky-work* green-coords 0 x) (* scale-factor -126.0))
(set! (-> *sky-work* green-coords 1 x) (* scale-factor 126.0))
(set! (-> *sky-work* moon0-coords 0 x) (* scale-factor -357.0))
(set! (-> *sky-work* moon0-coords 1 x) (* scale-factor 357.0))
(set! (-> *sky-work* moon1-coords 0 x) (* scale-factor -1207.0))
(set! (-> *sky-work* moon1-coords 1 x) (* scale-factor 1207.0))
(set! (-> *sky-work* moon2-coords 0 x) (* scale-factor -232.0))
(set! (-> *sky-work* moon2-coords 1 x) (* scale-factor 232.0))
(set! (-> *sky-work* day-star-coords 0 x) (* scale-factor -126.0))
(set! (-> *sky-work* day-star-coords 1 x) (* scale-factor 126.0))
)
(none)
)
;; WARN: Return type mismatch pointer vs none.
;; ERROR: Function may read a register that is not set: ra
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
@@ -637,6 +658,8 @@
)
(defmethod draw ((this sky-work))
;; og:preserve-this
(update-pc-sky-scaling)
(let ((s4-0 *time-of-day-context*)
(v1-0 #f)
)