Skip to content

Commit 3e41e5b

Browse files
authored
Fix center reticle firepoints swaying (scp-fs2open#7525)
Center reticle does not move if player is looking around, but there is a bug where the drawn firepoints of the center reticle do impromperly sway when the player is looking around. This is b/c the live global Eye_matrix, which has the free-look rotation baked into it by `object_get_eye()` then `compute_slew_matrix(eye_orient, &Viewer_slew_angles)` Thus, do note use `Eye_matrix` b/c firepoints will sway if looking around, instead just use 'object_get_eye' with the properly set values. Tested and fire-points work as normal but also fix the issue when looking around in free-look or TrackIR.
1 parent 741693a commit 3e41e5b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

code/hud/hudreticle.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ void HudGaugeReticle::getFirepointStatus() {
414414
eye eyepoint = pm->view_positions[shipp->current_viewpoint];
415415
vec2d ep = { eyepoint.pnt.xyz.x, eyepoint.pnt.xyz.y };
416416

417+
// Center reticle does not move if player is looking around, so ensure that firepoints also do not move.
418+
// Use object_get_eye to get the needed eye values (do not use Eye_matrix b/c firepoints will sway if looking).
419+
vec3d unused_eye_pos;
420+
matrix eye_orient;
421+
object_get_eye(&unused_eye_pos, &eye_orient, &Objects[Player->objnum], false, false, true);
422+
417423
for (int i = 0; i < pm->n_guns; i++) {
418424
int bankactive = 0;
419425
ship_weapon *swp = &shipp->weapons;
@@ -497,11 +503,6 @@ void HudGaugeReticle::getFirepointStatus() {
497503
}
498504

499505
vec3d fpfromeye;
500-
501-
matrix eye_orient, player_transpose;
502-
503-
vm_copy_transpose(&player_transpose, &Objects[Player->objnum].orient);
504-
vm_matrix_x_matrix(&eye_orient, &player_transpose, &Eye_matrix);
505506
vm_vec_rotate(&fpfromeye, &pm->gun_banks[i].pnt[j], &eye_orient);
506507

507508
firepoint tmp = { { fpfromeye.xyz.x - ep.x, ep.y - fpfromeye.xyz.y }, fpactive };

0 commit comments

Comments
 (0)