Skip to content

Commit

Permalink
jak3: add darkjak highres texture anim (#3611)
Browse files Browse the repository at this point in the history
Eyes don't work yet
  • Loading branch information
Hat-Kid authored Jul 28, 2024
1 parent 9d00097 commit ce97863
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 13 deletions.
7 changes: 7 additions & 0 deletions common/texture/texture_slots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ std::vector<std::string> jak3_slots = {
"jakc-face",
"jakc-finger",
"jakc-hair",
"jakchires-arm",
"jakchires-eye",
"jakchires-eyebrow",
"jakchires-eyelid",
"jakchires-facelft",
"jakchires-facert",
"jakchires-hair",
// default-water
"bomb-gradient",
"blue-beam-dest",
Expand Down
23 changes: 23 additions & 0 deletions decompiler/config/jak3/ntsc_v1/inputs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,29 @@
"jakc-finger-dark",
"jakc-hair-dark",

// darkjak-highres
"jakchires-arm",
"jakchires-arm-norm",
"jakchires-arm-dark",
"jakchires-eye",
"jakchires-eye-norm",
"jakchires-eye-dark",
"jakchires-eyebrow",
"jakchires-eyebrow-norm",
"jakchires-eyebrow-dark",
"jakchires-eyelid",
"jakchires-eyelid-norm",
"jakchires-eyelid-dark",
"jakchires-facelft",
"jakchires-facelft-norm",
"jakchires-facelft-dark",
"jakchires-facert",
"jakchires-facert-norm",
"jakchires-facert-dark",
"jakchires-hair",
"jakchires-hair-norm",
"jakchires-hair-dark",

// Skull Gem
"skull-gem-dest",
"skull-gem-alpha-00",
Expand Down
5 changes: 5 additions & 0 deletions game/graphics/opengl_renderer/TextureAnimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ enum class PcTextureAnimCodesJak3 : u16 {
SET_SHADER = 17,
DRAW = 18,
DARKJAK = 22,
DARKJAK_HIGHRES = 23,
SKULL_GEM = 27,
DEFAULT_WATER = 28,
DEFAULT_WARP = 29,
Expand Down Expand Up @@ -1218,6 +1219,10 @@ void TextureAnimator::handle_texture_anim_data(DmaFollower& dma,
auto p = scoped_prof("darkjak");
run_clut_blender_group(tf, m_darkjak_clut_blender_idx, frame_idx);
} break;
case PcTextureAnimCodesJak3::DARKJAK_HIGHRES: {
auto p = scoped_prof("darkjak-highres");
run_clut_blender_group(tf, m_darkjak_highres_clut_blender_idx, frame_idx);
} break;
case PcTextureAnimCodesJak3::SKULL_GEM:
case PcTextureAnimCodesJak3::DEFAULT_WATER:
case PcTextureAnimCodesJak3::DEFAULT_WARP:
Expand Down
1 change: 1 addition & 0 deletions game/graphics/opengl_renderer/TextureAnimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class TextureAnimator {
int m_templex_water_anim_array_idx = -1;
int m_volcanoa_anim_array_idx = -1;
int m_deshover_anim_array_idx = -1;
int m_darkjak_highres_clut_blender_idx = -1;

std::vector<FixedAnimArray> m_fixed_anim_arrays;

Expand Down
21 changes: 20 additions & 1 deletion game/graphics/opengl_renderer/TextureAnimatorDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@

void TextureAnimator::setup_texture_anims_jak3() {
m_darkjak_clut_blender_idx = create_clut_blender_group(
{"jakc-arm", "jakc-eyebrow", "jakc-face", "jakc-finger", "jakc-hair"}, "-norm", "-dark", {});
{
"jakc-arm",
"jakc-eyebrow",
"jakc-face",
"jakc-finger",
"jakc-hair",
},
"-norm", "-dark", {});

m_darkjak_highres_clut_blender_idx = create_clut_blender_group(
{
"jakchires-arm",
"jakchires-eye",
"jakchires-eyebrow",
"jakchires-eyelid",
"jakchires-facelft",
"jakchires-facert",
"jakchires-hair",
},
"-norm", "-dark", "MHCTYCST.DGO");

// default-water
{
Expand Down
4 changes: 1 addition & 3 deletions goal_src/jak3/engine/common-obs/elevator.gc
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,7 @@
(process-grab? *target* #f)
)
(if (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) *target*)
;; og:preserve-this not-yet-implemented
;; (process-drawable-cloth-command *target* '(set-flags local-space-y))
0
(process-drawable-cloth-command *target* '(set-flags local-space-y))
)
(if (>= (+ (current-time) (seconds -1)) (-> self sticky-player-last-ride-time))
(remove-setting! 'board)
Expand Down
2 changes: 1 addition & 1 deletion goal_src/jak3/engine/game/main.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@
(free-nodes *touching-list*)
(prepare *collide-rider-pool*)
(update-actor-hash)
;; (blerc-init)
(blerc-init)
; (dma-send
; (the-as dma-bank #x10008000)
; (the-as uint (-> *collide-vif0-init* data))
Expand Down
7 changes: 0 additions & 7 deletions goal_src/jak3/engine/gfx/foreground/eye-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@

;; DECOMP BEGINS

;; TODO: remove this - just a stub.
(defun find-free-eye-index ((a int) (b string) (c int))
0)
(defun get-eye-block ((a int) (c int))
0)


(deftype eye (structure)
"Data for a single eye."
((data vector 2 :inline)
Expand Down
15 changes: 14 additions & 1 deletion goal_src/jak3/engine/gfx/texture/texture-anim.gc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
(set-clut-alpha 20)
(copy-clut-alpha 21)
(darkjak 22)
(darkjak-highres 23)
(skull-gem 27) ;; same as jak 2
(default-water 28)
(default-warp 29)
Expand Down Expand Up @@ -486,7 +487,19 @@
(return #f)
)
((*darkjak-highres-texture-anim-array*)
(print-anim "*darkjak-highres-texture-anim-array*~%")
(with-dma-buffer-add-bucket ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf))
bucket
)
(pc-texture-anim-flag start-anim-array dma-buf)
(pc-texture-anim-flag darkjak-highres dma-buf :qwc 1)
(let ((morph (-> anim-array array-data 0 frame-time))
(vec (the vector (-> dma-buf base)))
)
(set! (-> vec x) morph)
)
(&+! (-> dma-buf base) 16)
(pc-texture-anim-flag finish-anim-array dma-buf)
)
(return #f)
)
((*skull-gem-texture-anim-array*)
Expand Down
2 changes: 2 additions & 0 deletions goal_src/jak3/levels/stadium/rublcst-scenes.gc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
:anim "palace-ruins-attack-res-a"
:parts 3
:command-list '((0 (fadein (frame-time-30 10)) (send-event *target* 'draw-vehicle #f))
;; og:preserve-this added to reset texture morph
(1 (apply ,(lambda :behavior scene-player () (set-darkjak-highres-texture-morph! 0.0))))
(160 (part-tracker
"group-rubble-missile"
entity
Expand Down

0 comments on commit ce97863

Please sign in to comment.