Skip to content

Commit

Permalink
cgame: test another transition prone view, refs #1208
Browse files Browse the repository at this point in the history
  • Loading branch information
Aranud committed May 3, 2021
1 parent bf85506 commit c4f76a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/cgame/cg_local.h
Expand Up @@ -1158,6 +1158,7 @@ typedef struct
float duckChange; ///< for duck viewheight smoothing
int duckTime;
qboolean wasProne;
vec3_t proneOrigin;

int weaponSetTime; ///< mg/mortar set time

Expand Down
1 change: 1 addition & 0 deletions src/cgame/cg_playerstate.c
Expand Up @@ -552,5 +552,6 @@ void CG_TransitionPlayerState(playerState_t *ps, playerState_t *ops)
cg.duckChange = ps->viewheight - ops->viewheight;
cg.duckTime = cg.time;
cg.wasProne = ops->eFlags & EF_PRONE;
VectorCopy(ops->origin, cg.proneOrigin);
}
}
14 changes: 7 additions & 7 deletions src/cgame/cg_view.c
Expand Up @@ -718,8 +718,8 @@ static void CG_OffsetFirstPersonView(void)
}
if (timeDelta < PRONE_TIME)
{
//cg.refdef_current->vieworg[0] -= (forward[0] * 18) * (PRONE_TIME - timeDelta) / PRONE_TIME;
//cg.refdef_current->vieworg[1] -= (forward[1] * 18) * (PRONE_TIME - timeDelta) / PRONE_TIME;
cg.refdef_current->vieworg[0] += (cg.proneOrigin[0] - origin[0]) * (PRONE_TIME - timeDelta) / PRONE_TIME;
cg.refdef_current->vieworg[1] += (cg.proneOrigin[1] - origin[1]) * (PRONE_TIME - timeDelta) / PRONE_TIME;
cg.refdef_current->vieworg[2] -= cg.duckChange * (PRONE_TIME - timeDelta) / PRONE_TIME;
}
}
Expand All @@ -731,11 +731,11 @@ static void CG_OffsetFirstPersonView(void)
}
if (timeDelta < DUCK_TIME)
{
//if (cg.wasProne)
//{
// cg.refdef_current->vieworg[0] += (forward[0] * 18) * (DUCK_TIME - timeDelta) / DUCK_TIME;
// cg.refdef_current->vieworg[1] += (forward[1] * 18) * (DUCK_TIME - timeDelta) / DUCK_TIME;
//}
if (cg.wasProne)
{
cg.refdef_current->vieworg[0] -= (cg.proneOrigin[0] - origin[0]) * (DUCK_TIME - timeDelta) / DUCK_TIME;
cg.refdef_current->vieworg[1] -= (cg.proneOrigin[1] - origin[1]) * (DUCK_TIME - timeDelta) / DUCK_TIME;
}
cg.refdef_current->vieworg[2] -= cg.duckChange * (DUCK_TIME - timeDelta) / DUCK_TIME;
}
}
Expand Down

0 comments on commit c4f76a1

Please sign in to comment.