Added movebob removed viewheight
"movebob" lets you determine the strength of movement bobbing (does not affect landing delta, that's technically not movement bobbing :p), values range from 0.0 to 4.0. viewheight is now relative to player->height.
This commit is contained in:
parent
f31cdf395a
commit
8a676d8aa4
|
@ -1129,7 +1129,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||||
|
|
||||||
// make sure viewz follows player if in 1st person mode
|
// make sure viewz follows player if in 1st person mode
|
||||||
player->deltaviewheight = 0;
|
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)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
||||||
else
|
else
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
#define FLOATSPEED (FRACUNIT*4)
|
#define FLOATSPEED (FRACUNIT*4)
|
||||||
|
|
||||||
#define VIEWHEIGHTS "41"
|
|
||||||
|
|
||||||
// Maximum player score.
|
// Maximum player score.
|
||||||
#define MAXSCORE 999999990
|
#define MAXSCORE 999999990
|
||||||
|
|
||||||
|
@ -217,7 +215,7 @@ void P_RestoreMultiMusic(player_t *player);
|
||||||
extern mapthing_t *itemrespawnque[ITEMQUESIZE];
|
extern mapthing_t *itemrespawnque[ITEMQUESIZE];
|
||||||
extern tic_t itemrespawntime[ITEMQUESIZE];
|
extern tic_t itemrespawntime[ITEMQUESIZE];
|
||||||
extern size_t iquehead, iquetail;
|
extern size_t iquehead, iquetail;
|
||||||
extern consvar_t cv_gravity, cv_viewheight;
|
extern consvar_t cv_gravity, cv_movebob;
|
||||||
|
|
||||||
void P_RespawnSpecials(void);
|
void P_RespawnSpecials(void);
|
||||||
|
|
||||||
|
|
10
src/p_mobj.c
10
src/p_mobj.c
|
@ -36,9 +36,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include "f_finale.h"
|
#include "f_finale.h"
|
||||||
|
|
||||||
// protos.
|
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}};
|
consvar_t cv_movebob = {"movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_viewheight = {"viewheight", VIEWHEIGHTS, 0, viewheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
#ifdef WALLSPLATS
|
#ifdef WALLSPLATS
|
||||||
consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
#endif
|
||||||
|
@ -2896,7 +2896,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
mo->player->viewheight -= mo->floorz - mo->z;
|
mo->player->viewheight -= mo->floorz - mo->z;
|
||||||
|
|
||||||
mo->player->deltaviewheight =
|
mo->player->deltaviewheight =
|
||||||
(FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;
|
(FixedMul(41*mo->player->height/48, mo->scale) - mo->player->viewheight)>>3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust height
|
// adjust height
|
||||||
|
@ -9088,7 +9088,7 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
||||||
else if (playernum == secondarydisplayplayer)
|
else if (playernum == secondarydisplayplayer)
|
||||||
localangle2 = mobj->angle;
|
localangle2 = mobj->angle;
|
||||||
|
|
||||||
p->viewheight = cv_viewheight.value<<FRACBITS;
|
p->viewheight = 41*p->height/48;
|
||||||
|
|
||||||
if (p->mo->eflags & MFE_VERTICALFLIP)
|
if (p->mo->eflags & MFE_VERTICALFLIP)
|
||||||
p->viewz = p->mo->z + p->mo->height - p->viewheight;
|
p->viewz = p->mo->z + p->mo->height - p->viewheight;
|
||||||
|
|
|
@ -413,7 +413,7 @@ static void P_NetUnArchivePlayers(void)
|
||||||
if (flags & AWAYVIEW)
|
if (flags & AWAYVIEW)
|
||||||
players[i].awayviewmobj = (mobj_t *)(size_t)READUINT32(save_p);
|
players[i].awayviewmobj = (mobj_t *)(size_t)READUINT32(save_p);
|
||||||
|
|
||||||
players[i].viewheight = cv_viewheight.value<<FRACBITS;
|
players[i].viewheight = READFIXED(save_p);
|
||||||
|
|
||||||
players[i].camerascale = READFIXED(save_p);
|
players[i].camerascale = READFIXED(save_p);
|
||||||
players[i].shieldscale = READFIXED(save_p);
|
players[i].shieldscale = READFIXED(save_p);
|
||||||
|
|
19
src/p_user.c
19
src/p_user.c
|
@ -188,11 +188,12 @@ void P_CalcHeight(player_t *player)
|
||||||
// Note: a LUT allows for effects
|
// Note: a LUT allows for effects
|
||||||
// like a ramp with low health.
|
// like a ramp with low health.
|
||||||
|
|
||||||
player->bob = (FixedMul(player->rmomx,player->rmomx)
|
player->bob = FixedMul(cv_movebob.value,
|
||||||
+ FixedMul(player->rmomy,player->rmomy))>>2;
|
(FixedMul(player->rmomx,player->rmomx)
|
||||||
|
+ FixedMul(player->rmomy,player->rmomy))>>2);
|
||||||
|
|
||||||
if (player->bob > FixedMul(MAXBOB, mo->scale))
|
if (player->bob > FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale)))
|
||||||
player->bob = FixedMul(MAXBOB, mo->scale);
|
player->bob = FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale));
|
||||||
|
|
||||||
if (!P_IsObjectOnGround(mo))
|
if (!P_IsObjectOnGround(mo))
|
||||||
{
|
{
|
||||||
|
@ -215,7 +216,7 @@ void P_CalcHeight(player_t *player)
|
||||||
bob = FixedMul(player->bob/2, FINESINE(angle));
|
bob = FixedMul(player->bob/2, FINESINE(angle));
|
||||||
|
|
||||||
// move viewheight
|
// 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)
|
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);
|
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);
|
y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius);
|
||||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
z = player->mo->z + player->mo->height - (cv_viewheight.value<<FRACBITS) - 16*FRACUNIT;
|
z = player->mo->z + player->mo->height - (41*player->height/48) - 16*FRACUNIT;
|
||||||
else
|
else
|
||||||
z = player->mo->z + (cv_viewheight.value<<FRACBITS);
|
z = player->mo->z + (41*player->height/48);
|
||||||
|
|
||||||
// set bits for the camera
|
// set bits for the camera
|
||||||
thiscam->x = x;
|
thiscam->x = x;
|
||||||
|
@ -8876,7 +8877,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
#endif // bad 2D camera code
|
#endif // bad 2D camera code
|
||||||
|
|
||||||
pviewheight = FixedMul(cv_viewheight.value<<FRACBITS, mo->scale);
|
pviewheight = FixedMul(41*player->height/48, mo->scale);
|
||||||
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
z = mo->z + mo->height - pviewheight - height;
|
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
|
// defaults to make sure 1st person cam doesn't do anything weird on startup
|
||||||
player->deltaviewheight = 0;
|
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)
|
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1312,9 +1312,7 @@ void R_RegisterEngineStuff(void)
|
||||||
|
|
||||||
CV_RegisterVar(&cv_maxportals);
|
CV_RegisterVar(&cv_maxportals);
|
||||||
|
|
||||||
// Default viewheight is changeable,
|
CV_RegisterVar(&cv_movebob);
|
||||||
// initialized to standard viewheight
|
|
||||||
CV_RegisterVar(&cv_viewheight);
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
// GL-specific Commands
|
// GL-specific Commands
|
||||||
|
|
Loading…
Reference in New Issue