jak-project/goal_src/jak2/engine/gfx/mood/mood-tables2.gc
ManDude 324def1303
split new pc features in some files into their own code files + address some old issues + ripple graphics improvements (#2216)
Moves PC-specific entity and debug menu things to `entity-debug.gc` and
`default-menu-pc.gc` respectively and makes `(declare-file (debug))`
work as it should (no need to wrap the entire file in `(when
*debug-segment*` now!).

Also changes the DGO descriptor format so that it's less verbose. It
might break custom levels, but the format change is very simple so it
should not be difficult for anyone to update to the new format. Sadly,
you lose the completely useless ability to use DGO object names that
don't match the source file name. The horror!

I've also gone ahead and expanded the force envmap option to also force
the ripple effect to be active. I did not notice any performance or
visual drawbacks from this. Gets rid of some distracting LOD and some
water pools appearing super flat (and pitch back for dark eco).

Fixes #1424
2023-02-13 21:39:14 +00:00

427 lines
18 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: mood-tables2.gc
;; name in dgo: mood-tables2
;; dgos: ENGINE, GAME
;; og:ignore-from-loc
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(define *overide-mood-color-table*
(new 'static 'mood-color-table :data (new 'static 'inline-array mood-color 8
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 1.375 :y 1.157)
:amb-color (new 'static 'vector :x 0.625 :y 0.553 :z 0.725 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 1.473 :y 1.337 :z 1.0)
:amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 1.473 :y 1.348 :z 1.15)
:amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 1.473 :y 1.337 :z 1.0)
:amb-color (new 'static 'vector :x 0.527 :y 0.652 :z 0.75 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 1.5 :y 1.148)
:amb-color (new 'static 'vector :x 0.5 :y 0.562 :z 0.75 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 0.05 :y 0.149 :z 0.375)
:amb-color (new 'static 'vector :x 0.35 :y 0.451 :z 0.625 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 0.1 :y 0.35 :z 0.5)
:amb-color (new 'static 'vector :x 0.3 :y 0.35 :z 0.5 :w 1.0)
)
(new 'static 'mood-color
:lgt-color (new 'static 'vector :x 0.1 :y 0.575 :z 0.4)
:amb-color (new 'static 'vector :x 0.3 :y 0.425 :z 0.5 :w 1.0)
)
)
)
)
(define *overide-mood-fog-table*
(new 'static 'mood-fog-table :data (new 'static 'inline-array mood-fog 8
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 160.0 :y 150.0 :z 200.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 150.0 :y 165.0 :z 220.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 128.0 :y 180.0 :z 243.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 150.0 :y 165.0 :z 220.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 160.0 :y 150.0 :z 200.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :x 16.0 :y 32.0 :z 100.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :y 24.0 :z 64.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
(new 'static 'mood-fog
:fog-color (new 'static 'vector :y 56.0 :z 72.0 :w 128.0)
:fog-dists (new 'static 'vector :x 262144.0 :y 3690496.0 :z 255.0 :w 64.0)
:erase-color (new 'static 'vector :w 128.0)
)
)
)
)
;; WARN: Return type mismatch pointer vs none.
(defun init-overide-table ((arg0 mood-table))
(set! (-> arg0 mood-fog-table) (new 'debug 'mood-fog-table))
(set! (-> arg0 mood-color-table) (new 'debug 'mood-color-table))
(set! (-> arg0 mood-channel-group) *no-cloud-mood-channel-group*)
(set! (-> arg0 mood-direction-table) *mood-direction-table*)
(set! (-> arg0 mood-sky-table) *mood-sky-table*)
(set! (-> arg0 mood-interp-table) *mood-interp-table*)
(mem-copy! (the-as pointer (-> arg0 mood-fog-table)) (the-as pointer *no-cloud-clear-mood-fog-table*) 384)
(mem-copy! (the-as pointer (-> arg0 mood-color-table)) (the-as pointer *no-cloud-mood-color-table*) 256)
(none)
)
(define *overide-table* (new 'static 'mood-table))
(init-overide-table *overide-table*)
;; WARN: Return type mismatch object vs none.
(defun print-mood-tables ()
"Print out the contents of the [[*overide-table*]]"
(mem-copy! (the-as pointer (-> *overide-table* mood-fog-table)) (the-as pointer *overide-mood-fog-table*) 384)
(mem-copy!
(the-as pointer (-> *overide-table* mood-color-table))
(the-as pointer *overide-mood-color-table*)
256
)
(dotimes (v1-2 8)
(vector-float*!
(the-as vector (-> *overide-table* mood-fog-table data v1-2))
(the-as vector (-> *overide-table* mood-fog-table data v1-2))
(-> *overide-table* mood-fog-table data v1-2 fog-color w)
)
(vector-float*!
(the-as vector (-> *overide-table* mood-color-table data v1-2))
(the-as vector (-> *overide-table* mood-color-table data v1-2))
(-> *overide-table* mood-color-table data v1-2 lgt-color w)
)
(vector-float*!
(the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* v1-2 32)))
(the-as vector (+ (the-as uint (-> *overide-table* mood-color-table data 0 amb-color)) (* v1-2 32)))
(-> *overide-table* mood-color-table data v1-2 amb-color w)
)
(set! (-> *overide-table* mood-fog-table data v1-2 fog-color w) 128.0)
(set! (-> *overide-table* mood-color-table data v1-2 lgt-color w) 0.0)
(set! (-> *overide-table* mood-color-table data v1-2 amb-color w) 1.0)
)
(format 0 "(define *overide-mood-color-table*~%")
(format 0 " (new 'static 'mood-color-table~%")
(format 0 " :data (new 'static 'inline-array 'mood-color 0~%")
(dotimes (gp-0 8)
(format 0 " (new 'static 'mood-color")
(let ((v1-5 gp-0))
(cond
((zero? v1-5)
(format 0 " ; sun rise~%")
)
((= v1-5 1)
(format 0 " ; morning~%")
)
((= v1-5 2)
(format 0 " ; noon~%")
)
((= v1-5 3)
(format 0 " ; afternoon~%")
)
((= v1-5 4)
(format 0 " ; sunset~%")
)
((= v1-5 5)
(format 0 " ; twilight~%")
)
((= v1-5 6)
(format 0 " ; evening~%")
)
((= v1-5 7)
(format 0 " ; green sun~%")
)
)
)
(format
0
" :lgt-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-color-table data gp-0 lgt-color x)
(-> *overide-table* mood-color-table data gp-0 lgt-color y)
(-> *overide-table* mood-color-table data gp-0 lgt-color z)
(-> *overide-table* mood-color-table data gp-0 lgt-color w)
)
(format
0
" :amb-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-color-table data gp-0 amb-color x)
(-> *overide-table* mood-color-table data gp-0 amb-color y)
(-> *overide-table* mood-color-table data gp-0 amb-color z)
(-> *overide-table* mood-color-table data gp-0 amb-color w)
)
(format 0 " )~%")
)
(format 0 " )~%")
(format 0 " )~%")
(format 0 " )~%")
(format 0 "(define *overide-mood-fog-table*~%")
(format 0 " (new 'static 'mood-fog-table~%")
(format 0 " :data (new 'static 'inline-array 'mood-fog 0~%")
(dotimes (gp-1 8)
(format 0 " (new 'static 'mood-fog")
(let ((v1-33 gp-1))
(cond
((zero? v1-33)
(format 0 " ; sun rise~%")
)
((= v1-33 1)
(format 0 " ; morning~%")
)
((= v1-33 2)
(format 0 " ; noon~%")
)
((= v1-33 3)
(format 0 " ; afternoon~%")
)
((= v1-33 4)
(format 0 " ; sunset~%")
)
((= v1-33 5)
(format 0 " ; twilight~%")
)
((= v1-33 6)
(format 0 " ; evening~%")
)
((= v1-33 7)
(format 0 " ; green sun~%")
)
)
)
(format
0
" :fog-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-fog-table data gp-1 fog-color x)
(-> *overide-table* mood-fog-table data gp-1 fog-color y)
(-> *overide-table* mood-fog-table data gp-1 fog-color z)
(-> *overide-table* mood-fog-table data gp-1 fog-color w)
)
(format
0
" :fog-start (meters ~f) :fog-end (meters ~f) :fog-min ~f :fog-max ~f ~%"
(-> *overide-table* mood-fog-table data gp-1 fog-dists x)
(-> *overide-table* mood-fog-table data gp-1 fog-dists y)
(-> *overide-table* mood-fog-table data gp-1 fog-dists w)
(-> *overide-table* mood-fog-table data gp-1 fog-dists z)
)
(format 0 " :erase-color (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 128.0)~%")
(format 0 " )~%")
)
(format 0 " )~%")
(format 0 " )~%")
(format 0 " )~%")
(format 0 "(define *overide-table* (new 'static 'mood-table))~%")
(none)
)
;; WARN: Return type mismatch object vs none.
(defun desaturate-mood-colors ((arg0 float) (arg1 float) (arg2 float))
"Unused - Generate GOAL code for a new [[*overide-mood-color-table*]] definition that desaturates the color
Apply said overrides to the [[*overide-table*]]"
(mem-copy!
(the-as pointer (-> *overide-table* mood-color-table))
(the-as pointer *no-cloud-mood-color-table*)
256
)
(dotimes (v1-1 8)
(let ((a1-3 (-> *overide-table* mood-color-table data v1-1))
(mood-colors
(the-as
(inline-array mood-color)
(-> (the-as (inline-array mood-color) (-> *overide-table* mood-color-table data 0 amb-color)) v1-1)
)
)
)
(let ((f1-2 (fmax (fmax (-> a1-3 lgt-color x) (-> a1-3 lgt-color y)) (-> a1-3 lgt-color z)))
(f0-4
(fmax (fmax (-> mood-colors 0 lgt-color x) (-> mood-colors 0 lgt-color y)) (-> mood-colors 0 lgt-color z))
)
)
(set! (-> a1-3 lgt-color x) (* (+ (-> a1-3 lgt-color x) (* (- f1-2 (-> a1-3 lgt-color x)) arg0)) arg1))
(set! (-> a1-3 lgt-color y) (* (+ (-> a1-3 lgt-color y) (* (- f1-2 (-> a1-3 lgt-color y)) arg0)) arg1))
(set! (-> a1-3 lgt-color z) (* (+ (-> a1-3 lgt-color z) (* (- f1-2 (-> a1-3 lgt-color z)) arg0)) arg1))
(set! (-> a1-3 lgt-color w) 0.0)
(set! (-> mood-colors 0 lgt-color x)
(* (+ (-> mood-colors 0 lgt-color x) (* (- f0-4 (-> mood-colors 0 lgt-color x)) arg0)) arg2)
)
(set! (-> mood-colors 0 lgt-color y)
(* (+ (-> mood-colors 0 lgt-color y) (* (- f0-4 (-> mood-colors 0 lgt-color x)) arg0)) arg2)
)
(set! (-> mood-colors 0 lgt-color z)
(* (+ (-> mood-colors 0 lgt-color z) (* (- f0-4 (-> mood-colors 0 lgt-color x)) arg0)) arg2)
)
)
(set! (-> mood-colors 0 lgt-color w) 1.0)
)
)
(format 0 "(define *overide-mood-color-table*~%")
(format 0 " (new 'static 'mood-color-table~%")
(format 0 " :data (new 'static 'inline-array 'mood-color 0~%")
(dotimes (gp-1 8)
(format 0 " (new 'static 'mood-color")
(let ((v1-4 gp-1))
(cond
((zero? v1-4)
(format 0 " ; sun rise~%")
)
((= v1-4 1)
(format 0 " ; morning~%")
)
((= v1-4 2)
(format 0 " ; noon~%")
)
((= v1-4 3)
(format 0 " ; afternoon~%")
)
((= v1-4 4)
(format 0 " ; sunset~%")
)
((= v1-4 5)
(format 0 " ; twilight~%")
)
((= v1-4 6)
(format 0 " ; evening~%")
)
((= v1-4 7)
(format 0 " ; green sun~%")
)
)
)
(format
0
" :lgt-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-color-table data gp-1 lgt-color x)
(-> *overide-table* mood-color-table data gp-1 lgt-color y)
(-> *overide-table* mood-color-table data gp-1 lgt-color z)
(-> *overide-table* mood-color-table data gp-1 lgt-color w)
)
(format
0
" :amb-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-color-table data gp-1 amb-color x)
(-> *overide-table* mood-color-table data gp-1 amb-color y)
(-> *overide-table* mood-color-table data gp-1 amb-color z)
(-> *overide-table* mood-color-table data gp-1 amb-color w)
)
(format 0 " )~%")
)
(format 0 " )~%")
(format 0 " )~%")
(format 0 " )~%")
(none)
)
;; WARN: Return type mismatch object vs none.
(defun desaturate-mood-fog ((arg0 (pointer mood-fog-table)) (arg1 float) (arg2 float))
"Unused - Generate GOAL code for a new [[*overide-mood-fog-table*]] definition that desaturates the fog color
Apply said overrides to the [[*overide-table*]]"
(mem-copy! (the-as pointer (-> *overide-table* mood-fog-table)) arg0 384)
(dotimes (v1-2 8)
(let ((a0-5 (-> *overide-table* mood-fog-table data v1-2)))
(let ((f0-2 (fmax (fmax (-> a0-5 fog-color x) (-> a0-5 fog-color y)) (-> a0-5 fog-color z))))
(set! (-> a0-5 fog-color x) (* (+ (-> a0-5 fog-color x) (* (- f0-2 (-> a0-5 fog-color x)) arg1)) arg2))
(set! (-> a0-5 fog-color y) (* (+ (-> a0-5 fog-color y) (* (- f0-2 (-> a0-5 fog-color y)) arg1)) arg2))
(set! (-> a0-5 fog-color z) (* (+ (-> a0-5 fog-color z) (* (- f0-2 (-> a0-5 fog-color z)) arg1)) arg2))
)
(set! (-> a0-5 fog-color w) 1.0)
)
)
(format 0 "(define *overide-mood-fog-table*~%")
(format 0 " (new 'static 'mood-fog-table~%")
(format 0 " :data (new 'static 'inline-array 'mood-fog 0~%")
(dotimes (gp-1 8)
(format 0 " (new 'static 'mood-fog")
(let ((v1-5 gp-1))
(cond
((zero? v1-5)
(format 0 " ; sun rise~%")
)
((= v1-5 1)
(format 0 " ; morning~%")
)
((= v1-5 2)
(format 0 " ; noon~%")
)
((= v1-5 3)
(format 0 " ; afternoon~%")
)
((= v1-5 4)
(format 0 " ; sunset~%")
)
((= v1-5 5)
(format 0 " ; twilight~%")
)
((= v1-5 6)
(format 0 " ; evening~%")
)
((= v1-5 7)
(format 0 " ; green sun~%")
)
)
)
(format
0
" :fog-color (new 'static 'vector :x ~f :y ~f :z ~f :w ~f)~%"
(-> *overide-table* mood-fog-table data gp-1 fog-color x)
(-> *overide-table* mood-fog-table data gp-1 fog-color y)
(-> *overide-table* mood-fog-table data gp-1 fog-color z)
(-> *overide-table* mood-fog-table data gp-1 fog-color w)
)
(format
0
" :fog-start (meters ~f) :fog-end (meters ~f) :fog-min ~f :fog-max ~f ~%"
(* 0.00024414062 (-> *overide-table* mood-fog-table data gp-1 fog-dists x))
(* 0.00024414062 (-> *overide-table* mood-fog-table data gp-1 fog-dists y))
(-> *overide-table* mood-fog-table data gp-1 fog-dists w)
(-> *overide-table* mood-fog-table data gp-1 fog-dists z)
)
(format 0 " :erase-color (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 128.0)~%")
(format 0 " )~%")
)
(format 0 " )~%")
(format 0 " )~%")
(format 0 " )~%")
(none)
)