Camera adjustin's

- Look backward button works
- Increased default cam_speed, from 0.3 to 0.45. This is the highest
value that I think doesn't look overly stiff.
- Removed bobbing in first person
I was trying to do the camera angle thing that we've been talking about
for a while, but I can't get it to work well.
This commit is contained in:
TehRealSalt 2018-01-22 17:08:31 -05:00
parent 43842468cf
commit bb6694a72b
7 changed files with 147 additions and 178 deletions

View File

@ -244,7 +244,6 @@ typedef enum
k_lakitu, // Timer for Lakitu to carry and drop the player k_lakitu, // Timer for Lakitu to carry and drop the player
k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir") k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir")
k_camspin, // Used to 180 the camera while a button is held
k_lapanimation, // Used to make a swoopy lap lakitu, maybe other effects in the future k_lapanimation, // Used to make a swoopy lap lakitu, maybe other effects in the future
k_cardanimation, // Used to determine the position of some full-screen Battle Mode graphics k_cardanimation, // Used to determine the position of some full-screen Battle Mode graphics
k_sounds, // Used this to stop and then force music restores as it hits zero k_sounds, // Used this to stop and then force music restores as it hits zero
@ -356,9 +355,9 @@ typedef struct player_s
// Base height above floor for viewz. // Base height above floor for viewz.
fixed_t viewheight; fixed_t viewheight;
// Bob/squat speed. // Bob/squat speed.
fixed_t deltaviewheight; //fixed_t deltaviewheight;
// bounded/scaled total momentum. // bounded/scaled total momentum.
fixed_t bob; //fixed_t bob;
// Mouse aiming, where the guy is looking at! // Mouse aiming, where the guy is looking at!
// It is updated with cmd->aiming. // It is updated with cmd->aiming.

View File

@ -1160,6 +1160,7 @@ static INT32 JoyAxis(axis_input_e axissel, UINT8 p)
// //
INT32 localaiming, localaiming2, localaiming3, localaiming4; INT32 localaiming, localaiming2, localaiming3, localaiming4;
angle_t localangle, localangle2, localangle3, localangle4; angle_t localangle, localangle2, localangle3, localangle4;
boolean camspin, camspin2, camspin3, camspin4;
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16}; static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t sidemove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16}; // faster! static fixed_t sidemove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16}; // faster!
@ -1179,45 +1180,45 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning
static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard
if (ssplayer == 2) switch (ssplayer)
{ {
player = &players[secondarydisplayplayer]; case 2:
thiscam = (player->bot == 2 ? &camera : &camera2); player = &players[secondarydisplayplayer];
lang = localangle2; thiscam = (player->bot == 2 ? &camera : &camera2);
laim = localaiming2; lang = localangle2;
th = turnheld2; laim = localaiming2;
kbl = keyboard_look2; th = turnheld2;
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); kbl = keyboard_look2;
} G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
else if (ssplayer == 3) break;
{ case 3:
player = &players[thirddisplayplayer]; player = &players[thirddisplayplayer];
thiscam = &camera3; thiscam = &camera3;
lang = localangle3; lang = localangle3;
laim = localaiming3; laim = localaiming3;
th = turnheld3; th = turnheld3;
kbl = keyboard_look3; kbl = keyboard_look3;
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1); G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
} break;
else if (ssplayer == 4) case 4:
{ player = &players[fourthdisplayplayer];
player = &players[fourthdisplayplayer]; thiscam = &camera4;
thiscam = &camera4; lang = localangle4;
lang = localangle4; laim = localaiming4;
laim = localaiming4; th = turnheld4;
th = turnheld4; kbl = keyboard_look4;
kbl = keyboard_look4; G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1); break;
} case 1:
else default:
{ player = &players[consoleplayer];
player = &players[consoleplayer]; thiscam = &camera;
thiscam = &camera; lang = localangle;
lang = localangle; laim = localaiming;
laim = localaiming; th = turnheld;
th = turnheld; kbl = keyboard_look;
kbl = keyboard_look; G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver break;
} }
// why build a ticcmd if we're paused? // why build a ticcmd if we're paused?
@ -1229,41 +1230,41 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
return; return;
} }
if (ssplayer == 2) switch (ssplayer)
{ {
mouseaiming = (PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value; case 2:
invertmouse = cv_invertmouse2.value; mouseaiming = (PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value;
lookaxis = cv_lookaxis2.value; invertmouse = cv_invertmouse2.value;
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle; lookaxis = cv_lookaxis2.value;
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle; analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
analog = cv_analog2.value; gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
} analog = cv_analog2.value;
else if (ssplayer == 3) break;
{ case 3:
mouseaiming = false; mouseaiming = false;
invertmouse = false; invertmouse = false;
lookaxis = cv_lookaxis3.value; lookaxis = cv_lookaxis3.value;
analogjoystickmove = cv_usejoystick3.value && !Joystick3.bGamepadStyle; analogjoystickmove = cv_usejoystick3.value && !Joystick3.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick3.value && Joystick3.bGamepadStyle; gamepadjoystickmove = cv_usejoystick3.value && Joystick3.bGamepadStyle;
analog = cv_analog3.value; analog = cv_analog3.value;
} break;
else if (ssplayer == 4) case 4:
{ mouseaiming = false;
mouseaiming = false; invertmouse = false;
invertmouse = false; lookaxis = cv_lookaxis4.value;
lookaxis = cv_lookaxis4.value; analogjoystickmove = cv_usejoystick4.value && !Joystick4.bGamepadStyle;
analogjoystickmove = cv_usejoystick4.value && !Joystick4.bGamepadStyle; gamepadjoystickmove = cv_usejoystick4.value && Joystick4.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick4.value && Joystick4.bGamepadStyle; analog = cv_analog4.value;
analog = cv_analog4.value; break;
} case 1:
else default:
{ mouseaiming = (PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value;
mouseaiming = (PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value; invertmouse = cv_invertmouse.value;
invertmouse = cv_invertmouse.value; lookaxis = cv_lookaxis.value;
lookaxis = cv_lookaxis.value; analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle; gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle; analog = cv_analog.value;
analog = cv_analog.value; break;
} }
turnright = InputDown(gc_turnright, ssplayer); turnright = InputDown(gc_turnright, ssplayer);
@ -1429,6 +1430,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_spectate, ssplayer)) if (InputDown(gc_spectate, ssplayer))
cmd->buttons |= BT_SPECTATE; cmd->buttons |= BT_SPECTATE;
// SRB2Kart: look backward
if (InputDown(gc_lookback, ssplayer))
// Lua scriptable buttons // Lua scriptable buttons
if (InputDown(gc_custom1, ssplayer)) if (InputDown(gc_custom1, ssplayer))
cmd->buttons |= BT_CUSTOM1; cmd->buttons |= BT_CUSTOM1;
@ -1454,16 +1458,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
} }
*/ */
/*
if (InputDown(gc_lookback, ssplayer))
{
if (thiscam->chase && !player->kartstuff[k_camspin])
player->kartstuff[k_camspin] = 1;
}
else if (player->kartstuff[k_camspin] > 0)
player->kartstuff[k_camspin] = -1;
*/
// jump button // jump button
if (InputDown(gc_jump, ssplayer)) if (InputDown(gc_jump, ssplayer))
cmd->buttons |= BT_JUMP; cmd->buttons |= BT_JUMP;
@ -1608,33 +1602,37 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->angleturn = (INT16)(lang >> 16); cmd->angleturn = (INT16)(lang >> 16);
} }
if (ssplayer == 2) switch (ssplayer)
{ {
localangle2 = lang; case 2:
localaiming2 = laim; localangle2 = lang;
keyboard_look2 = kbl; localaiming2 = laim;
turnheld2 = th; keyboard_look2 = kbl;
} turnheld2 = th;
else if (ssplayer == 3) camspin2 = InputDown(gc_lookback, ssplayer);
{ break;
localangle3 = lang; case 3:
localaiming3 = laim; localangle3 = lang;
keyboard_look3 = kbl; localaiming3 = laim;
turnheld3 = th; keyboard_look3 = kbl;
} turnheld3 = th;
else if (ssplayer == 4) camspin3 = InputDown(gc_lookback, ssplayer);
{ break;
localangle4 = lang; case 4:
localaiming4 = laim; localangle4 = lang;
keyboard_look4 = kbl; localaiming4 = laim;
turnheld4 = th; keyboard_look4 = kbl;
} turnheld4 = th;
else camspin4 = InputDown(gc_lookback, ssplayer);
{ break;
localangle = lang; case 1:
localaiming = laim; default:
keyboard_look = kbl; localangle = lang;
turnheld = th; localaiming = laim;
keyboard_look = kbl;
turnheld = th;
camspin = InputDown(gc_lookback, ssplayer);
break;
} }
//Reset away view if a command is given. //Reset away view if a command is given.

View File

@ -82,6 +82,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
extern angle_t localangle, localangle2, localangle3, localangle4; extern angle_t localangle, localangle2, localangle3, localangle4;
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
// //
// GAME // GAME

View File

@ -112,10 +112,10 @@ static int player_get(lua_State *L)
lua_pushfixed(L, plr->viewz); lua_pushfixed(L, plr->viewz);
else if (fastcmp(field,"viewheight")) else if (fastcmp(field,"viewheight"))
lua_pushfixed(L, plr->viewheight); lua_pushfixed(L, plr->viewheight);
else if (fastcmp(field,"deltaviewheight")) /*else if (fastcmp(field,"deltaviewheight"))
lua_pushfixed(L, plr->deltaviewheight); lua_pushfixed(L, plr->deltaviewheight);
else if (fastcmp(field,"bob")) else if (fastcmp(field,"bob"))
lua_pushfixed(L, plr->bob); lua_pushfixed(L, plr->bob);*/
else if (fastcmp(field,"aiming")) else if (fastcmp(field,"aiming"))
lua_pushangle(L, plr->aiming); lua_pushangle(L, plr->aiming);
else if (fastcmp(field,"health")) else if (fastcmp(field,"health"))
@ -371,10 +371,10 @@ static int player_set(lua_State *L)
plr->viewz = luaL_checkfixed(L, 3); plr->viewz = luaL_checkfixed(L, 3);
else if (fastcmp(field,"viewheight")) else if (fastcmp(field,"viewheight"))
plr->viewheight = luaL_checkfixed(L, 3); plr->viewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"deltaviewheight")) /*else if (fastcmp(field,"deltaviewheight"))
plr->deltaviewheight = luaL_checkfixed(L, 3); plr->deltaviewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"bob")) else if (fastcmp(field,"bob"))
plr->bob = luaL_checkfixed(L, 3); plr->bob = luaL_checkfixed(L, 3);*/
else if (fastcmp(field,"aiming")) { else if (fastcmp(field,"aiming")) {
plr->aiming = luaL_checkangle(L, 3); plr->aiming = luaL_checkangle(L, 3);
if (plr == &players[consoleplayer]) if (plr == &players[consoleplayer])

View File

@ -1130,7 +1130,7 @@ void OP_ObjectplaceMovement(player_t *player)
player->mo->eflags &= ~MFE_VERTICALFLIP; player->mo->eflags &= ~MFE_VERTICALFLIP;
// 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(cv_viewheight.value << FRACBITS, 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;

View File

@ -2738,8 +2738,8 @@ static void P_PlayerZMovement(mobj_t *mo)
else else
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(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;*/
} }
// adjust height // adjust height
@ -2812,8 +2812,9 @@ static void P_PlayerZMovement(mobj_t *mo)
mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement. mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement.
// Squat down. Decrease viewheight for a moment after hitting the ground (hard), // Squat down. Decrease viewheight for a moment after hitting the ground (hard),
if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale)) /*if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale))
mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative
*/
if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR)
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack

View File

@ -63,7 +63,7 @@ static void P_NukeAllPlayers(player_t *player);
// //
// 16 pixels of bob // 16 pixels of bob
#define MAXBOB (0x10 << FRACBITS) //#define MAXBOB (0x10 << FRACBITS)
static boolean onground; static boolean onground;
@ -179,9 +179,9 @@ boolean P_AutoPause(void)
// //
void P_CalcHeight(player_t *player) void P_CalcHeight(player_t *player)
{ {
INT32 angle; //INT32 angle;
fixed_t bob; //fixed_t bob;
fixed_t pviewheight; //fixed_t pviewheight;
mobj_t *mo = player->mo; mobj_t *mo = player->mo;
// Regular movement bobbing. // Regular movement bobbing.
@ -190,11 +190,11 @@ 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(player->rmomx,player->rmomx)
+ FixedMul(player->rmomy,player->rmomy))>>2; + FixedMul(player->rmomy,player->rmomy))>>2;
if (player->bob > FixedMul(MAXBOB, mo->scale)) if (player->bob > FixedMul(MAXBOB, mo->scale))
player->bob = FixedMul(MAXBOB, mo->scale); player->bob = FixedMul(MAXBOB, mo->scale);*/
if (!P_IsObjectOnGround(mo)) if (!P_IsObjectOnGround(mo))
{ {
@ -213,13 +213,13 @@ void P_CalcHeight(player_t *player)
return; return;
} }
angle = (FINEANGLES/20*localgametic)&FINEMASK; //angle = (FINEANGLES/20*localgametic)&FINEMASK;
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 player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, mo->scale); // default eye view height
if (player->playerstate == PST_LIVE) /*if (player->playerstate == PST_LIVE)
{ {
player->viewheight += player->deltaviewheight; player->viewheight += player->deltaviewheight;
@ -242,12 +242,12 @@ void P_CalcHeight(player_t *player)
if (!player->deltaviewheight) if (!player->deltaviewheight)
player->deltaviewheight = 1; player->deltaviewheight = 1;
} }
} }*/
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = mo->z + mo->height - player->viewheight - bob; player->viewz = mo->z + mo->height - player->viewheight; //- bob
else else
player->viewz = mo->z + player->viewheight + bob; player->viewz = mo->z + player->viewheight; //+ bob
if (player->viewz > mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale)) if (player->viewz > mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale))
player->viewz = mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale); player->viewz = mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale);
@ -7992,7 +7992,7 @@ void P_FindEmerald(void)
static void P_DeathThink(player_t *player) static void P_DeathThink(player_t *player)
{ {
ticcmd_t *cmd = &player->cmd; ticcmd_t *cmd = &player->cmd;
player->deltaviewheight = 0; //player->deltaviewheight = 0;
if (player->deadtimer < INT32_MAX) if (player->deadtimer < INT32_MAX)
player->deadtimer++; player->deadtimer++;
@ -8160,25 +8160,25 @@ static CV_PossibleValue_t CV_CamRotate[] = {{-720, "MIN"}, {720, "MAX"}, {0, NUL
consvar_t cv_cam_dist = {"cam_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_dist = {"cam_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_height = {"cam_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_height = {"cam_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_speed = {"cam_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_speed = {"cam_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_height = {"cam2_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_height = {"cam2_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_speed = {"cam2_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_speed = {"cam2_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_dist = {"cam3_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_dist = {"cam3_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_height = {"cam3_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_height = {"cam3_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_still = {"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_still = {"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_speed = {"cam3_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_speed = {"cam3_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotate = {"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_rotate = {"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotspeed = {"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam3_rotspeed = {"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_dist = {"cam4_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_dist = {"cam4_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_height = {"cam4_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_height = {"cam4_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_still = {"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_still = {"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_speed = {"cam4_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_speed = {"cam4_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -8244,7 +8244,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
angle_t angle = 0, focusangle = 0, focusaiming = 0; angle_t angle = 0, focusangle = 0, focusaiming = 0;
fixed_t x, y, z, dist, height, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight; fixed_t x, y, z, dist, height, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
INT32 camrotate; INT32 camrotate;
boolean camstill, cameranoclip; boolean camstill, cameranoclip, lookback;
mobj_t *mo; mobj_t *mo;
subsector_t *newsubsec; subsector_t *newsubsec;
fixed_t f1, f2; fixed_t f1, f2;
@ -8353,6 +8353,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam_rotate.value; camrotate = cv_cam_rotate.value;
camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale); camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin;
} }
else if (thiscam == &camera2) // Camera 2 else if (thiscam == &camera2) // Camera 2
{ {
@ -8361,6 +8362,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam2_rotate.value; camrotate = cv_cam2_rotate.value;
camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale); camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin2;
} }
else if (thiscam == &camera3) // Camera 3 else if (thiscam == &camera3) // Camera 3
{ {
@ -8369,6 +8371,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam3_rotate.value; camrotate = cv_cam3_rotate.value;
camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale); camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin3;
} }
else // Camera 4 else // Camera 4
{ {
@ -8377,12 +8380,16 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam4_rotate.value; camrotate = cv_cam4_rotate.value;
camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale); camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin4;
} }
// SRB2kart - Camera flipper
if (lookback)
camrotate += 180;
#ifdef REDSANALOG #ifdef REDSANALOG
if (P_AnalogMove(player) && (player->cmd.buttons & (BT_FORWARD|BT_BACKWARD)) == (BT_FORWARD|BT_BACKWARD)) { if (P_AnalogMove(player) && (player->cmd.buttons & (BT_FORWARD|BT_BACKWARD)) == (BT_FORWARD|BT_BACKWARD)) {
camstill = true; camstill = true;
if (camspeed < 4*FRACUNIT/5) if (camspeed < 4*FRACUNIT/5)
camspeed = 4*FRACUNIT/5; camspeed = 4*FRACUNIT/5;
} }
@ -8437,43 +8444,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
thiscam->angle = angle; thiscam->angle = angle;
} }
// SRB2kart - Camera flipper
if (!objectplacing && displayplayer == consoleplayer)
{
if (player->kartstuff[k_camspin] == 1)
{
if (thiscam == &camera)
{
CV_SetValue(&cv_cam_rotate, camrotate + 180);
}
else if (thiscam == &camera2)
{
CV_SetValue(&cv_cam2_rotate, camrotate + 180);
}
else if (thiscam == &camera3)
{
CV_SetValue(&cv_cam3_rotate, camrotate + 180);
}
else
{
CV_SetValue(&cv_cam4_rotate, camrotate + 180);
}
player->kartstuff[k_camspin] = 2;
}
if (player->kartstuff[k_camspin] == -1)
{
if (thiscam == &camera)
{
CV_SetValue(&cv_cam_rotate, camrotate - 180);
}
else
{
CV_SetValue(&cv_cam2_rotate, camrotate - 180);
}
player->kartstuff[k_camspin] = 0;
}
}
/* // SRB2kart - camera controls are disabled... for now. /* // SRB2kart - camera controls are disabled... for now.
if (!objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_NIGHTSMODE) && displayplayer == consoleplayer) if (!objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_NIGHTSMODE) && displayplayer == consoleplayer)
{ {
@ -8791,7 +8761,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// point viewed by the camera // point viewed by the camera
// this point is just 64 unit forward the player // this point is just 64 unit forward the player
dist = FixedMul(64 << FRACBITS, mo->scale); dist = FixedMul(64 << FRACBITS, mapheaderinfo[gamemap-1]->mobj_scale);
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist); viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
@ -10032,7 +10002,7 @@ void P_PlayerAfterThink(player_t *player)
else else
{ {
// 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(cv_viewheight.value << FRACBITS, 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;