Skip to content

Commit

Permalink
Merge pull request #841 from edge-classic/weapon-model-tilt-fix
Browse files Browse the repository at this point in the history
Revert previous model interpolated tilt fix for player weapons only
  • Loading branch information
dashodanger authored Jan 16, 2025
2 parents 4086340 + 30fd169 commit 8e5c1b1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
9 changes: 7 additions & 2 deletions source_files/edge/render/gl/gl_md2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1062,17 +1062,22 @@ void MD2RenderModel(MD2Model *md, const Image *skin_img, bool is_weapon, int fra

bool tilt = is_weapon || (mo->flags_ & kMapObjectFlagMissile) || (mo->hyper_flags_ & kHyperFlagForceModelTilt);

BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);

if (uncapped_frames.d_ && !paused && !menu_active && !rts_menu_active &&
(is_weapon || (!time_stop_active && !erraticism_active)))
{
if (is_weapon)
BAMAngleToMatrix(tilt ? ~epi::BAMInterpolate(mo->old_vertical_angle_, mo->vertical_angle_, fractional_tic) : 0,
&data.mouselook_x_matrix_, &data.mouselook_z_matrix_);
else
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);

BAMAngle ang = epi::BAMInterpolate(mo->old_angle_, mo->angle_, fractional_tic) + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_x_matrix_, &data.rotation_y_matrix_);
}
else
{
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);
BAMAngle ang = mo->angle_ + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_x_matrix_, &data.rotation_y_matrix_);
Expand Down
9 changes: 7 additions & 2 deletions source_files/edge/render/gl/gl_mdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -729,17 +729,22 @@ void MDLRenderModel(MDLModel *md, bool is_weapon, int frame1, int frame2, float

bool tilt = is_weapon || (mo->flags_ & kMapObjectFlagMissile) || (mo->hyper_flags_ & kHyperFlagForceModelTilt);

BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_vector_, &data.mouselook_z_vector_);

if (uncapped_frames.d_ && !paused && !menu_active && !rts_menu_active &&
(is_weapon || (!time_stop_active && !erraticism_active)))
{
if (is_weapon)
BAMAngleToMatrix(tilt ? ~epi::BAMInterpolate(mo->old_vertical_angle_, mo->vertical_angle_, fractional_tic) : 0,
&data.mouselook_x_vector_, &data.mouselook_z_vector_);
else
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_vector_, &data.mouselook_z_vector_);

BAMAngle ang = epi::BAMInterpolate(mo->old_angle_, mo->angle_, fractional_tic) + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_vector_x_, &data.rotation_vector_y_);
}
else
{
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_vector_, &data.mouselook_z_vector_);
BAMAngle ang = mo->angle_ + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_vector_x_, &data.rotation_vector_y_);
Expand Down
9 changes: 7 additions & 2 deletions source_files/edge/render/sokol/sokol_md2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1067,17 +1067,22 @@ void MD2RenderModel(MD2Model *md, const Image *skin_img, bool is_weapon, int fra

bool tilt = is_weapon || (mo->flags_ & kMapObjectFlagMissile) || (mo->hyper_flags_ & kHyperFlagForceModelTilt);

BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);

if (uncapped_frames.d_ && !paused && !menu_active && !rts_menu_active &&
(is_weapon || (!time_stop_active && !erraticism_active)))
{
if (is_weapon)
BAMAngleToMatrix(tilt ? ~epi::BAMInterpolate(mo->old_vertical_angle_, mo->vertical_angle_, fractional_tic) : 0,
&data.mouselook_x_matrix_, &data.mouselook_z_matrix_);
else
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);

BAMAngle ang = epi::BAMInterpolate(mo->old_angle_, mo->angle_, fractional_tic) + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_x_matrix_, &data.rotation_y_matrix_);
}
else
{
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_matrix_, &data.mouselook_z_matrix_);
BAMAngle ang = mo->angle_ + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_x_matrix_, &data.rotation_y_matrix_);
Expand Down
7 changes: 7 additions & 0 deletions source_files/edge/render/sokol/sokol_mdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,19 @@ void MDLRenderModel(MDLModel *md, bool is_weapon, int frame1, int frame2, float
if (uncapped_frames.d_ && !paused && !menu_active && !rts_menu_active &&
(is_weapon || (!time_stop_active && !erraticism_active)))
{
if (is_weapon)
BAMAngleToMatrix(tilt ? ~epi::BAMInterpolate(mo->old_vertical_angle_, mo->vertical_angle_, fractional_tic) : 0,
&data.mouselook_x_vector_, &data.mouselook_z_vector_);
else
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_vector_, &data.mouselook_z_vector_);

BAMAngle ang = epi::BAMInterpolate(mo->old_angle_, mo->angle_, fractional_tic) + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_vector_x_, &data.rotation_vector_y_);
}
else
{
BAMAngleToMatrix(tilt ? ~mo->vertical_angle_ : 0, &data.mouselook_x_vector_, &data.mouselook_z_vector_);
BAMAngle ang = mo->angle_ + rotation;
render_mirror_set.Angle(ang);
BAMAngleToMatrix(~ang, &data.rotation_vector_x_, &data.rotation_vector_y_);
Expand Down

0 comments on commit 8e5c1b1

Please sign in to comment.