Skip to content

Commit

Permalink
[jak2, jak3] Unstretch moon and sun (#3822)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
water111 and water111 authored Jan 4, 2025
1 parent 2b226fe commit e0acc2d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
20 changes: 20 additions & 0 deletions goal_src/jak2/engine/gfx/sky/sky-tng.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
)
Expand Down
23 changes: 23 additions & 0 deletions goal_src/jak3/engine/gfx/sky/sky-tng.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
)
Expand Down

0 comments on commit e0acc2d

Please sign in to comment.