Skip to content

Commit

Permalink
Use rounding instead of truncation for viewpos/setpos output (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Nov 28, 2023
1 parent 143e3bc commit f1dea3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions Quake/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,22 +854,22 @@ void CL_Viewpos_f (void)
//camera position
q_snprintf (buf, sizeof (buf),
"(%i %i %i) %i %i %i",
(int)r_refdef.vieworg[0],
(int)r_refdef.vieworg[1],
(int)r_refdef.vieworg[2],
(int)r_refdef.viewangles[PITCH],
(int)r_refdef.viewangles[YAW],
(int)r_refdef.viewangles[ROLL]);
Q_rint (r_refdef.vieworg[0]),
Q_rint (r_refdef.vieworg[1]),
Q_rint (r_refdef.vieworg[2]),
Q_rint (r_refdef.viewangles[PITCH]),
Q_rint (r_refdef.viewangles[YAW]),
Q_rint (r_refdef.viewangles[ROLL]));
#else
//player position
q_snprintf (buf, sizeof (buf),
"(%i %i %i) %i %i %i",
(int)cl_entities[cl.viewentity].origin[0],
(int)cl_entities[cl.viewentity].origin[1],
(int)cl_entities[cl.viewentity].origin[2],
(int)cl.viewangles[PITCH],
(int)cl.viewangles[YAW],
(int)cl.viewangles[ROLL]
Q_rint (cl_entities[cl.viewentity].origin[0]),
Q_rint (cl_entities[cl.viewentity].origin[1]),
Q_rint (cl_entities[cl.viewentity].origin[2]),
Q_rint (cl.viewangles[PITCH]),
Q_rint (cl.viewangles[YAW]),
Q_rint (cl.viewangles[ROLL])
);
#endif
Con_Printf ("Viewpos: %s\n", buf);
Expand Down
12 changes: 6 additions & 6 deletions Quake/host_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,12 +1789,12 @@ static void Host_SetPos_f(void)
SV_ClientPrintf(" setpos <x> <y> <z> <pitch> <yaw> <roll>\n");
SV_ClientPrintf("current values:\n");
SV_ClientPrintf(" %i %i %i %i %i %i\n",
(int)sv_player->v.origin[0],
(int)sv_player->v.origin[1],
(int)sv_player->v.origin[2],
(int)sv_player->v.v_angle[0],
(int)sv_player->v.v_angle[1],
(int)sv_player->v.v_angle[2]);
Q_rint (sv_player->v.origin[0]),
Q_rint (sv_player->v.origin[1]),
Q_rint (sv_player->v.origin[2]),
Q_rint (sv_player->v.v_angle[0]),
Q_rint (sv_player->v.v_angle[1]),
Q_rint (sv_player->v.v_angle[2]));
return;
}

Expand Down

0 comments on commit f1dea3d

Please sign in to comment.