mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 23:01:56 -04:00
[jak3] Fix neosat particles and tentacle (#3722)
Fixes issue with not handling texture flipping flags in sprite renderer (new jak 3 feature). As far as I can tell, there is no visible difference because the textures that use this flag are symmetric. Fix issue with not adding an `and` with `0xf` on the offset into the xy table. This is added only in jak 3, where `vi07`'s upper bits are sometimes nonzero, but doesn't hurt to have in all three games. ``` iaddi vi09, vi00, 0xf | nop iand vi07, vi07, vi09 | nop ```  Fix issue with inf/nan causing the tentacle to not appear:  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
@@ -119,7 +119,7 @@ void main() {
|
||||
float sp_sin = sin(quat.z);
|
||||
float sp_cos = cos(quat.z);
|
||||
|
||||
vec4 xy0_vf19 = xy_array[vert_id + flags_matrix.x];
|
||||
vec4 xy0_vf19 = xy_array[vert_id + (flags_matrix.x & 15)];
|
||||
vec4 vf12_rotated = (basis_x * sp_cos) - (basis_y * sp_sin);
|
||||
vec4 vf13_rotated_trans = (basis_x * sp_sin) + (basis_y * sp_cos);
|
||||
|
||||
@@ -141,7 +141,7 @@ void main() {
|
||||
float sp_sin = sin(quat.z);
|
||||
float sp_cos = cos(quat.z);
|
||||
|
||||
vec4 xy0_vf19 = xy_array[vert_id + flags_matrix.x];
|
||||
vec4 xy0_vf19 = xy_array[vert_id + (flags_matrix.x & 15)];
|
||||
vec4 vf12_rotated = (basis_x * sp_cos) - (basis_y * sp_sin);
|
||||
vec4 vf13_rotated_trans = (basis_x * sp_sin) + (basis_y * sp_cos);
|
||||
|
||||
|
||||
@@ -837,6 +837,7 @@ void Sprite3::do_block_common(SpriteMode mode,
|
||||
|
||||
if (render_state->version == GameVersion::Jak3) {
|
||||
auto flag = m_vec_data_2d[sprite_idx].flag();
|
||||
|
||||
if ((flag & 0x10) || (flag & 0x20)) {
|
||||
// these flags mean we need to swap vertex order around - not yet implemented since it's too
|
||||
// hard to get right without this code running.
|
||||
@@ -868,6 +869,34 @@ void Sprite3::do_block_common(SpriteMode mode,
|
||||
m_vertices_3d.at(start_vtx_id + 2).info[2] = 3;
|
||||
m_vertices_3d.at(start_vtx_id + 3).info[2] = 2;
|
||||
|
||||
// note that PC swaps the last two vertices
|
||||
if (render_state->version == GameVersion::Jak3) {
|
||||
auto flag = m_vec_data_2d[sprite_idx].flag();
|
||||
switch (flag & 0x30) {
|
||||
case 0x10:
|
||||
// FLAG 16: 1, 0, 3, 2
|
||||
m_vertices_3d.at(start_vtx_id + 0).info[2] = 0;
|
||||
m_vertices_3d.at(start_vtx_id + 1).info[2] = 1;
|
||||
m_vertices_3d.at(start_vtx_id + 2).info[2] = 3;
|
||||
m_vertices_3d.at(start_vtx_id + 3).info[2] = 2;
|
||||
break;
|
||||
case 0x20:
|
||||
// FLAG 32: 3, 2, 1, 0
|
||||
m_vertices_3d.at(start_vtx_id + 0).info[2] = 3;
|
||||
m_vertices_3d.at(start_vtx_id + 1).info[2] = 2;
|
||||
m_vertices_3d.at(start_vtx_id + 2).info[2] = 0;
|
||||
m_vertices_3d.at(start_vtx_id + 3).info[2] = 1;
|
||||
break;
|
||||
case 0x30:
|
||||
// 2, 3, 0, 1
|
||||
m_vertices_3d.at(start_vtx_id + 0).info[2] = 2;
|
||||
m_vertices_3d.at(start_vtx_id + 1).info[2] = 3;
|
||||
m_vertices_3d.at(start_vtx_id + 2).info[2] = 1;
|
||||
m_vertices_3d.at(start_vtx_id + 3).info[2] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
++m_sprite_idx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2183,7 +2183,10 @@
|
||||
)
|
||||
(set! (-> s3-0 quad) (-> this node-list data gp-0 bone transform fvec quad))
|
||||
(let ((gp-1 (-> this ropes (-> *neo-sat-laser-array* arg0 rope-index))))
|
||||
(set! (-> gp-1 knots data 0 mass) (the-as float #x7f800000))
|
||||
;; og:preserve-this made infinite mass slightly less infinite.
|
||||
;; PS2 does math on this float, and it behaves like an extremely large float rather than
|
||||
;; IEEE754 inf.
|
||||
(set! (-> gp-1 knots data 0 mass) (the-as float #x7f700000))
|
||||
(if (and (-> this next-state) (= (-> this next-state name) 'neo-sat-sit-and-spin))
|
||||
(set! (-> gp-1 gravity-dir quad) (-> s3-0 quad))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user