jak-project/goal_src/jak1/engine/gfx/mood/mood-h.gc
ManDude b74399ed57
rework goal_src structure for jak 1 a bit (#1615)
* move files

* update game.gp
2022-07-05 16:00:09 -04:00

122 lines
4.3 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: mood-h.gc
;; name in dgo: mood-h
;; dgos: GAME, ENGINE
;; the "mood" system sets the fog, lights, and sun to smoothly blend between two levels.
;; each level has 8 "moods" corresponding to the 8 times of day.
;; the mood system blends together moods to create smooth transitions between levels and times of day.
;; set of fog parameters
(deftype mood-fog (structure)
((fog-color vector :inline :offset-assert 0)
(fog-dists vector :inline :offset-assert 16)
(fog-start meters :offset 16)
(fog-end meters :offset 20)
(fog-max float :offset 24)
(fog-min float :offset 28)
(erase-color vector :inline :offset-assert 32)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
;; a fog pattern for each of the 8 moods
(deftype mood-fog-table (structure)
((data mood-fog 8 :inline :offset-assert 0)
)
:method-count-assert 9
:size-assert #x180
:flag-assert #x900000180
)
;; a set of light parameters
(deftype mood-lights (structure)
((direction vector :inline :offset-assert 0)
(lgt-color vector :inline :offset-assert 16)
(prt-color vector :inline :offset-assert 32)
(amb-color vector :inline :offset-assert 48)
(shadow vector :inline :offset-assert 64)
)
:method-count-assert 9
:size-assert #x50
:flag-assert #x900000050
)
;; a light parameter for each of the 8 moods
(deftype mood-lights-table (structure)
((data mood-lights 8 :inline :offset-assert 0)
)
:method-count-assert 9
:size-assert #x280
:flag-assert #x900000280
)
;; settings for the sun
(deftype mood-sun (structure)
((sun-color vector :inline :offset-assert 0)
(env-color vector :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
;; sun settings for each of the 8 moods
(deftype mood-sun-table (structure)
((data mood-sun 8 :inline :offset-assert 0)
)
:method-count-assert 9
:size-assert #x100
:flag-assert #x900000100
)
;; all the current mood settings
(deftype mood-context (basic)
((mood-fog-table mood-fog-table :offset-assert 4)
(mood-lights-table mood-lights-table :offset-assert 8)
(mood-sun-table mood-sun-table :offset-assert 12)
(fog-interp sky-color-day :offset-assert 16)
(palette-interp sky-color-day :offset-assert 20)
(sky-texture-interp sky-color-day :offset-assert 24)
(current-fog mood-fog :inline :offset-assert 32)
(current-sun mood-sun :inline :offset-assert 80)
(current-prt-color vector :inline :offset-assert 112)
(current-shadow vector :inline :offset-assert 128)
(current-shadow-color vector :inline :offset-assert 144)
(light-group light-group 8 :inline :offset-assert 160)
;; these "times" are the time-of-day weights. the w is the weight, the rest is just 1.
(times vector 8 :inline :offset-assert 1696)
(sky-times float 8 :offset-assert 1824)
;; times as integers. For use in rendering code.
(itimes vector4w 4 :inline :offset-assert 1856)
(state uint8 16 :offset-assert 1920)
(num-stars float :offset-assert 1936)
(some-byte uint8 :offset 1939)
)
(:methods
(new (symbol type) _type_ 0)
)
:method-count-assert 9
:size-assert #x794
:flag-assert #x900000794
)
(defmethod new mood-context ((allocation symbol) (type-to-make type))
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set-vector! (-> v0-0 times 0) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 1) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 2) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 3) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 4) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 5) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 6) 1.0 1.0 1.0 0.0)
(set-vector! (-> v0-0 times 7) 1.0 1.0 1.0 0.0)
v0-0
)
)