diff --git a/src/m_cheat.c b/src/m_cheat.c index 3308f721c..5f45790a1 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1129,7 +1129,7 @@ void OP_ObjectplaceMovement(player_t *player) // make sure viewz follows player if in 1st person mode player->deltaviewheight = 0; - player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale); + player->viewheight = FixedMul(41*player->height/48, player->mo->scale); if (player->mo->eflags & MFE_VERTICALFLIP) player->viewz = player->mo->z + player->mo->height - player->viewheight; else diff --git a/src/p_local.h b/src/p_local.h index 91ee0c496..59f9bee0a 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -25,8 +25,6 @@ #define FLOATSPEED (FRACUNIT*4) -#define VIEWHEIGHTS "41" - // Maximum player score. #define MAXSCORE 999999990 @@ -217,7 +215,7 @@ void P_RestoreMultiMusic(player_t *player); extern mapthing_t *itemrespawnque[ITEMQUESIZE]; extern tic_t itemrespawntime[ITEMQUESIZE]; extern size_t iquehead, iquetail; -extern consvar_t cv_gravity, cv_viewheight; +extern consvar_t cv_gravity, cv_movebob; void P_RespawnSpecials(void); diff --git a/src/p_mobj.c b/src/p_mobj.c index 10bdee2bc..4fe5be9c4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -36,9 +36,9 @@ #endif #include "f_finale.h" -// protos. -static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}}; -consvar_t cv_viewheight = {"viewheight", VIEWHEIGHTS, 0, viewheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}}; +consvar_t cv_movebob = {"movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}; + #ifdef WALLSPLATS consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif @@ -2896,7 +2896,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->player->viewheight -= mo->floorz - mo->z; mo->player->deltaviewheight = - (FixedMul(cv_viewheight.value<scale) - mo->player->viewheight)>>3; + (FixedMul(41*mo->player->height/48, mo->scale) - mo->player->viewheight)>>3; } // adjust height @@ -9088,7 +9088,7 @@ void P_AfterPlayerSpawn(INT32 playernum) else if (playernum == secondarydisplayplayer) localangle2 = mobj->angle; - p->viewheight = cv_viewheight.value<viewheight = 41*p->height/48; if (p->mo->eflags & MFE_VERTICALFLIP) p->viewz = p->mo->z + p->mo->height - p->viewheight; diff --git a/src/p_saveg.c b/src/p_saveg.c index 8efe7027b..71bc93971 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -413,7 +413,7 @@ static void P_NetUnArchivePlayers(void) if (flags & AWAYVIEW) players[i].awayviewmobj = (mobj_t *)(size_t)READUINT32(save_p); - players[i].viewheight = cv_viewheight.value<bob = (FixedMul(player->rmomx,player->rmomx) - + FixedMul(player->rmomy,player->rmomy))>>2; + player->bob = FixedMul(cv_movebob.value, + (FixedMul(player->rmomx,player->rmomx) + + FixedMul(player->rmomy,player->rmomy))>>2); - if (player->bob > FixedMul(MAXBOB, mo->scale)) - player->bob = FixedMul(MAXBOB, mo->scale); + if (player->bob > FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale))) + player->bob = FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale)); if (!P_IsObjectOnGround(mo)) { @@ -215,7 +216,7 @@ void P_CalcHeight(player_t *player) bob = FixedMul(player->bob/2, FINESINE(angle)); // move viewheight - pviewheight = FixedMul(cv_viewheight.value << FRACBITS, mo->scale); // default eye view height + pviewheight = FixedMul(41*player->height/48, mo->scale); // default eye view height if (player->playerstate == PST_LIVE) { @@ -8606,9 +8607,9 @@ void P_ResetCamera(player_t *player, camera_t *thiscam) x = player->mo->x - P_ReturnThrustX(player->mo, thiscam->angle, player->mo->radius); y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius); if (player->mo->eflags & MFE_VERTICALFLIP) - z = player->mo->z + player->mo->height - (cv_viewheight.value<mo->z + player->mo->height - (41*player->height/48) - 16*FRACUNIT; else - z = player->mo->z + (cv_viewheight.value<mo->z + (41*player->height/48); // set bits for the camera thiscam->x = x; @@ -8876,7 +8877,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } #endif // bad 2D camera code - pviewheight = FixedMul(cv_viewheight.value<scale); + pviewheight = FixedMul(41*player->height/48, mo->scale); if (mo->eflags & MFE_VERTICALFLIP) z = mo->z + mo->height - pviewheight - height; @@ -10427,7 +10428,7 @@ void P_PlayerAfterThink(player_t *player) { // defaults to make sure 1st person cam doesn't do anything weird on startup player->deltaviewheight = 0; - player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale); + player->viewheight = FixedMul(41*player->height/48, player->mo->scale); if (player->mo->eflags & MFE_VERTICALFLIP) player->viewz = player->mo->z + player->mo->height - player->viewheight; else diff --git a/src/r_main.c b/src/r_main.c index cabefed14..c5f64c1e9 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1311,10 +1311,8 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_translucenthud); CV_RegisterVar(&cv_maxportals); - - // Default viewheight is changeable, - // initialized to standard viewheight - CV_RegisterVar(&cv_viewheight); + + CV_RegisterVar(&cv_movebob); #ifdef HWRENDER // GL-specific Commands