Skip to content

Commit

Permalink
KOTOR: De-hardcode PC movement speed
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii authored and DrMcCoy committed Jul 15, 2018
1 parent ac52abf commit 624cdc7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/engines/kotor/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ namespace Engines {

namespace KotOR {

static const float kPCMovementSpeed = 5;

bool Module::Action::operator<(const Action &s) const {
return timestamp < s.timestamp;
}
Expand Down Expand Up @@ -622,17 +620,18 @@ void Module::handlePCMovement() {
float x, y, z;
_pc->getPosition(x, y, z);
float yaw = SatelliteCam.getYaw();
float moveRate = _pc->getRunRate();
float newX, newY;

if (_forwardBtnPressed && !_backwardsBtnPressed) {
_pc->setOrientation(0, 0, 1, Common::rad2deg(yaw));
newX = x - kPCMovementSpeed * sin(yaw) * _frameTime;
newY = y + kPCMovementSpeed * cos(yaw) * _frameTime;
newX = x - moveRate * sin(yaw) * _frameTime;
newY = y + moveRate * cos(yaw) * _frameTime;
haveMovement = true;
} else if (_backwardsBtnPressed && !_forwardBtnPressed) {
_pc->setOrientation(0, 0, 1, 180 + Common::rad2deg(yaw));
newX = x + kPCMovementSpeed * sin(yaw) * _frameTime;
newY = y - kPCMovementSpeed * cos(yaw) * _frameTime;
newX = x + moveRate * sin(yaw) * _frameTime;
newY = y - moveRate * cos(yaw) * _frameTime;
haveMovement = true;
}

Expand Down

0 comments on commit 624cdc7

Please sign in to comment.