mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-14 00:54:05 +02:00
#3 rotate camera only while look button is pressed; remove side steps buttons;
This commit is contained in:
13
src/camera.h
13
src/camera.h
@@ -518,8 +518,17 @@ struct Camera : ICamera {
|
||||
}
|
||||
|
||||
// TODO: use player index
|
||||
advAngle.x -= Input::joy[cameraIndex].R.y * 2.0f * Core::deltaTime;
|
||||
advAngle.y += Input::joy[cameraIndex].R.x * 2.0f * Core::deltaTime;
|
||||
if (Input::state[cameraIndex][cLook]) {
|
||||
float d = 2.0f * Core::deltaTime;
|
||||
|
||||
advAngle.x -= Input::joy[cameraIndex].L.y * d;
|
||||
advAngle.y += Input::joy[cameraIndex].L.x * d;
|
||||
|
||||
if (Input::state[cameraIndex][cUp]) advAngle.y += d;
|
||||
if (Input::state[cameraIndex][cDown]) advAngle.y -= d;
|
||||
if (Input::state[cameraIndex][cLeft]) advAngle.x += d;
|
||||
if (Input::state[cameraIndex][cRight]) advAngle.x -= d;
|
||||
}
|
||||
|
||||
if (advAngleOld == advAngle) {
|
||||
if (advTimer > 0.0f) {
|
||||
|
@@ -29,7 +29,8 @@ struct Character : Controller {
|
||||
WALK = 1 << 6,
|
||||
ACTION = 1 << 7,
|
||||
WEAPON = 1 << 8,
|
||||
DEATH = 1 << 9
|
||||
LOOK = 1 << 9,
|
||||
DEATH = 1 << 10
|
||||
};
|
||||
|
||||
Controller *viewTarget;
|
||||
|
10
src/core.h
10
src/core.h
@@ -247,7 +247,7 @@ enum JoyKey {
|
||||
};
|
||||
|
||||
enum ControlKey {
|
||||
cLeft, cRight, cUp, cDown, cJump, cWalk, cAction, cWeapon, cLook, cStepLeft, cStepRight, cRoll, cInventory, cStart, cMAX
|
||||
cLeft, cRight, cUp, cDown, cJump, cWalk, cAction, cWeapon, cLook, cDuck, cDash, cRoll, cInventory, cStart, cMAX
|
||||
};
|
||||
|
||||
struct KeySet {
|
||||
@@ -1043,8 +1043,8 @@ namespace Core {
|
||||
ctrl.keys[ cAction ] = KeySet( ikCtrl, jkA );
|
||||
ctrl.keys[ cWeapon ] = KeySet( ikSpace, jkY );
|
||||
ctrl.keys[ cLook ] = KeySet( ikC, jkLB );
|
||||
ctrl.keys[ cStepLeft ] = KeySet( ikZ, jkLT );
|
||||
ctrl.keys[ cStepRight ] = KeySet( ikX, jkRT );
|
||||
ctrl.keys[ cDuck ] = KeySet( ikZ, jkLT );
|
||||
ctrl.keys[ cDash ] = KeySet( ikX, jkRT );
|
||||
ctrl.keys[ cRoll ] = KeySet( ikA, jkB );
|
||||
ctrl.keys[ cInventory ] = KeySet( ikTab, jkSelect );
|
||||
ctrl.keys[ cStart ] = KeySet( ikEnter, jkStart );
|
||||
@@ -1067,8 +1067,8 @@ namespace Core {
|
||||
ctrl.keys[ cAction ] = KeySet( ikNone, jkA );
|
||||
ctrl.keys[ cWeapon ] = KeySet( ikNone, jkY );
|
||||
ctrl.keys[ cLook ] = KeySet( ikNone, jkLB );
|
||||
ctrl.keys[ cStepLeft ] = KeySet( ikNone, jkLT );
|
||||
ctrl.keys[ cStepRight ] = KeySet( ikNone, jkRT );
|
||||
ctrl.keys[ cDuck ] = KeySet( ikNone, jkLT );
|
||||
ctrl.keys[ cDash ] = KeySet( ikNone, jkRT );
|
||||
ctrl.keys[ cRoll ] = KeySet( ikNone, jkB );
|
||||
ctrl.keys[ cInventory ] = KeySet( ikNone, jkSelect );
|
||||
ctrl.keys[ cStart ] = KeySet( ikEnter, jkStart );
|
||||
|
@@ -810,13 +810,13 @@ struct Inventory {
|
||||
key = cAction;
|
||||
else if (Input::state[playerIndex][cInventory] || Input::state[playerIndex][cJump])
|
||||
key = cInventory;
|
||||
else if (Input::state[playerIndex][cLeft] || joy.L.x < -0.5f || joy.R.x > 0.5f)
|
||||
else if (Input::state[playerIndex][cLeft] || joy.L.x < -0.5f)
|
||||
key = cLeft;
|
||||
else if (Input::state[playerIndex][cRight] || joy.L.x > 0.5f || joy.R.x < -0.5f)
|
||||
else if (Input::state[playerIndex][cRight] || joy.L.x > 0.5f)
|
||||
key = cRight;
|
||||
else if (Input::state[playerIndex][cUp] || joy.L.y < -0.5f || joy.R.y > 0.5f)
|
||||
else if (Input::state[playerIndex][cUp] || joy.L.y < -0.5f)
|
||||
key = cUp;
|
||||
else if (Input::state[playerIndex][cDown] || joy.L.y > 0.5f || joy.R.y < -0.5f)
|
||||
else if (Input::state[playerIndex][cDown] || joy.L.y > 0.5f)
|
||||
key = cDown;
|
||||
|
||||
Item *item = items[getGlobalIndex(page, index)];
|
||||
|
20
src/lara.h
20
src/lara.h
@@ -2582,7 +2582,7 @@ struct Lara : Character {
|
||||
input = 0;
|
||||
int pid = camera->cameraIndex;
|
||||
|
||||
if (!dozy && ((Input::state[pid][cAction] && Input::state[pid][cJump] && Input::state[pid][cLook] && Input::state[pid][cStepRight]) || Input::down[ikO])) {
|
||||
if (!dozy && ((Input::state[pid][cAction] && Input::state[pid][cJump] && Input::state[pid][cLook] && Input::state[pid][cDash]) || Input::down[ikO])) {
|
||||
dozy = true;
|
||||
health = LARA_MAX_HEALTH;
|
||||
oxygen = LARA_MAX_OXYGEN;
|
||||
@@ -2598,13 +2598,16 @@ struct Lara : Character {
|
||||
input = Character::getInput();
|
||||
if (input & DEATH) return input;
|
||||
|
||||
if (Input::state[pid][cUp]) input |= FORTH;
|
||||
if (Input::state[pid][cRight]) input |= RIGHT;
|
||||
if (Input::state[pid][cDown]) input |= BACK;
|
||||
if (Input::state[pid][cLeft]) input |= LEFT;
|
||||
if (Input::state[pid][cLook]) input |= LOOK;
|
||||
if (!(input & LOOK)) {
|
||||
if (Input::state[pid][cUp]) input |= FORTH;
|
||||
if (Input::state[pid][cRight]) input |= RIGHT;
|
||||
if (Input::state[pid][cDown]) input |= BACK;
|
||||
if (Input::state[pid][cLeft]) input |= LEFT;
|
||||
}
|
||||
if (Input::state[pid][cRoll]) input = FORTH | BACK;
|
||||
if (Input::state[pid][cStepRight]) input = WALK | RIGHT;
|
||||
if (Input::state[pid][cStepLeft]) input = WALK | LEFT;
|
||||
//if (Input::state[pid][cStepRight]) input = WALK | RIGHT;
|
||||
//if (Input::state[pid][cStepLeft]) input = WALK | LEFT;
|
||||
if (Input::state[pid][cJump]) input |= JUMP;
|
||||
if (Input::state[pid][cWalk]) input |= WALK;
|
||||
if (Input::state[pid][cAction]) input |= ACTION;
|
||||
@@ -2642,6 +2645,9 @@ struct Lara : Character {
|
||||
// analog control
|
||||
rotFactor = vec2(1.0f);
|
||||
|
||||
if (input & LOOK)
|
||||
return input;
|
||||
|
||||
Input::Joystick &joy = Input::joy[pid];
|
||||
|
||||
if ((state == STATE_STOP || state == STATE_SURF_TREAD || state == STATE_HANG) && fabsf(joy.L.x) < 0.5f && fabsf(joy.L.y) < 0.5f)
|
||||
|
Reference in New Issue
Block a user