[qw] Move view hight adjustment out of screen update

cl_screen.c is that little bit closer to being merged.
This commit is contained in:
Bill Currie 2022-11-02 09:52:35 +09:00
parent efee9c87a9
commit 9c6c59b370
4 changed files with 13 additions and 12 deletions

View file

@ -58,9 +58,9 @@ typedef struct viewstate_s {
vec4f_t movecmd;
vec4f_t velocity;
vec4f_t punchangle;
float frametime;
transform_t camera_transform;
double time;
float frametime;
float height;
int weaponframe;
int onground; // -1 when in air

View file

@ -807,7 +807,13 @@ V_CalcRefdef (viewstate_t *vs)
bob = V_CalcBob (vs);
// refresh position
if (vs->flags & VF_GIB) {
origin[2] += 8; // gib view height
} else if (vs->flags & VF_DEAD) {
origin[2] += -16; // corpse view height
} else {
origin[2] += vs->height + bob;
}
// never let it sit exactly on a node line, because a water plane can
// disappear when viewed with the eye exactly on it.

View file

@ -1168,6 +1168,11 @@ CL_SetStat (int stat, int value)
}
cl.stats[stat] = value;
cl.viewstate.weapon_model = cl_world.models.a[cl.stats[STAT_WEAPON]];
if (cl.stdver) {
cl.viewstate.height = cl.stats[STAT_VIEWHEIGHT];
} else {
cl.viewstate.height = DEFAULT_VIEWHEIGHT; // view height
}
}
static void

View file

@ -281,16 +281,6 @@ CL_UpdateScreen (double realtime)
}
scr_funcs_normal[0] = r_funcs->Draw_Crosshair;
if (cl.viewstate.flags & VF_GIB) {
cl.viewstate.height = 8; // gib view height
} else if (cl.viewstate.flags & VF_DEAD) {
cl.viewstate.height = -16; // corpse view height
} else {
cl.viewstate.height = DEFAULT_VIEWHEIGHT; // view height
if (cl.stdver)
cl.viewstate.height = cl.stats[STAT_VIEWHEIGHT];
}
cl.viewstate.intermission = cl.intermission != 0;
V_PrepBlend (&cl.viewstate);
int seq = (cls.netchan.outgoing_sequence - 1) & UPDATE_MASK;