File src/rsod.cpp changed (mode: 100644) (index 2156a2d..4733c22) |
... |
... |
void Render(){ |
3463 |
3463 |
void FirstPersonLoop( double d ){ |
void FirstPersonLoop( double d ){ |
3464 |
3464 |
linalg::vec<double,3> player_translation = { 0.0, 0.0, 0.0 }; |
linalg::vec<double,3> player_translation = { 0.0, 0.0, 0.0 }; |
3465 |
3465 |
|
|
3466 |
|
static bool bobbing = false; |
|
|
3466 |
|
static bool autorotate = false, bobbing = false; |
3467 |
3467 |
|
|
3468 |
3468 |
if( dungeon.playerAgent && convo_main.screen.ids.empty() |
if( dungeon.playerAgent && convo_main.screen.ids.empty() |
3469 |
3469 |
&& !inputTarget ){ |
&& !inputTarget ){ |
|
... |
... |
void FirstPersonLoop( double d ){ |
3496 |
3496 |
0.0 |
0.0 |
3497 |
3497 |
} ); |
} ); |
3498 |
3498 |
|
|
|
3499 |
|
// Allow free look in third-person mode. |
|
3500 |
|
if(fgl::mouseMoveX != 0 || fgl::mouseMoveY != 0 || rsx != 0.0f || rsy != 0.0f) |
|
3501 |
|
autorotate = false; |
|
3502 |
|
|
3499 |
3503 |
// Calculate rotation deltas. |
// Calculate rotation deltas. |
3500 |
3504 |
double mf = -dungeon.mouseSpeed / std::max( dungeon.playerZoom, 1.0 ); |
double mf = -dungeon.mouseSpeed / std::max( dungeon.playerZoom, 1.0 ); |
3501 |
3505 |
double rx = fgl::mouseMoveY * mf + rsy * f * d; |
double rx = fgl::mouseMoveY * mf + rsy * f * d; |
|
... |
... |
void FirstPersonLoop( double d ){ |
3654 |
3658 |
// Move the player with directional input. |
// Move the player with directional input. |
3655 |
3659 |
linalg::vec<float,2> move = { moveX, moveY }; |
linalg::vec<float,2> move = { moveX, moveY }; |
3656 |
3660 |
bool walking = linalg::length( move ) > dead_zone_left; |
bool walking = linalg::length( move ) > dead_zone_left; |
|
3661 |
|
if(walking) autorotate = true; |
3657 |
3662 |
float speed_factor = 1.0f; |
float speed_factor = 1.0f; |
3658 |
3663 |
|
|
3659 |
3664 |
fdungeon::Agent *parentAgent = dungeon.playerAgent->parentAgent; |
fdungeon::Agent *parentAgent = dungeon.playerAgent->parentAgent; |
|
... |
... |
void FirstPersonLoop( double d ){ |
3834 |
3839 |
// Bob the weapon. |
// Bob the weapon. |
3835 |
3840 |
bobbing = true; |
bobbing = true; |
3836 |
3841 |
} |
} |
3837 |
|
// Rotate the third-person camera about the player. TODO: Make the speed adjustable, adjust pitch, don't fight mouse/joystick input. |
|
3838 |
|
{ |
|
|
3842 |
|
// Rotate the third-person camera about the player. TODO: Make the speed adjustable, adjust pitch. |
|
3843 |
|
if(autorotate){ |
3839 |
3844 |
double yaw = dungeon.thirdPersonYawOffset; |
double yaw = dungeon.thirdPersonYawOffset; |
3840 |
3845 |
double rdist = std::abs(std::atan2(std::sin(yaw), std::cos(yaw))); |
double rdist = std::abs(std::atan2(std::sin(yaw), std::cos(yaw))); |
3841 |
3846 |
double rspeed = (1.0 - (rdist / M_PI)) * 1.5 * d; |
double rspeed = (1.0 - (rdist / M_PI)) * 1.5 * d; |