Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ namespace game
FVAR(IDF_PERSIST, firstpersonswayinertia, 0.0f, 0.2f, 1.0f);
FVAR(IDF_PERSIST, firstpersonswaymaxinertia, 0.0f, 32.0f, 1000.0f);

FVAR(IDF_PERSIST, firstpersonside, -10.0f, 0.0f, 10.0f);
FVAR(IDF_PERSIST, firstpersonup, -10.0f, 0.0f, 10.0f);
FVAR(IDF_PERSIST, firstpersondist, -10.0f, 0.0f, 10.0f);

VAR(IDF_PERSIST, firstpersonbob, 0, 0, 1);
FVAR(IDF_PERSIST, firstpersonbobmin, 0, 0.2f, 1);
FVAR(IDF_PERSIST, firstpersonbobstep, 1, 40.f, 1000);
Expand Down Expand Up @@ -3745,6 +3749,18 @@ namespace game
if(!firstpersoncamera && gs_playing(gamestate) && firstpersonsway)
calchwepsway(mdl);

// apply constant first-person model offset

vec dirforward = vec(mdl.yaw*RAD, mdl.pitch*RAD);
vec dirside = vec((mdl.yaw+90)*RAD, 0.0f);
vec dirup = vec(mdl.yaw*RAD, (mdl.pitch+90)*RAD);

vec trans = vec(0, 0, 0);
trans.add(vec(dirforward).mul(firstpersondist));
trans.add(vec(dirside).mul(firstpersonside));
trans.add(vec(dirup).mul(firstpersonup));
mdl.o.add(trans);

if(d->sliding(true) && firstpersonslidetime && firstpersonslideroll != 0)
{
int dur = min(impulseslidelen/2, firstpersonslidetime), millis = lastmillis-d->slidetime();
Expand Down