1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-16 18:14:05 +02:00

code formatting and minor fixes

This commit is contained in:
XProger
2019-01-31 11:00:21 +03:00
parent f5213e31f6
commit 417a2cd3be
6 changed files with 101 additions and 110 deletions

View File

@@ -2237,11 +2237,7 @@ struct GiantMutant : Enemy {
}
virtual void updatePosition() {
float angleY = 0.0f;
if (target && target->health > 0.0f && fabsf(targetAngle) > GIANT_MUTANT_MIN_ANGLE)
if (state == STATE_TURN_LEFT || state == STATE_TURN_RIGHT || state == STATE_WALK || state == STATE_STOP)
angleY = targetAngle;
turn(angleY, GIANT_MUTANT_TURN_SLOW);
turn(false, GIANT_MUTANT_TURN_SLOW);
Enemy::updatePosition();
//setOverrides(true, jointChest, jointHead);

View File

@@ -40,7 +40,7 @@ namespace Input {
mat4 controllers[2];
vec3 zero;
bool ready;
bool down[cMAX]; // internal state for VR controllers( based on actions not buttons)
bool state[cMAX];
void setView(const mat4 &pL, const mat4 &pR, const mat4 &vL, const mat4 &vR) {
proj[0] = pL;
@@ -213,7 +213,7 @@ namespace Input {
Core::Settings::Controls &ctrl = Core::settings.controls[j];
for (int i = 0; i < cMAX; i++) {
KeySet &c = ctrl.keys[i];
newState[j][i] = (c.key != ikNone && down[c.key]) || (c.joy != jkNone && joy[ctrl.joyIndex].down[c.joy]) || hmd.down[i]; //adding vr check with hmd[down]
newState[j][i] = (c.key != ikNone && down[c.key]) || (c.joy != jkNone && joy[ctrl.joyIndex].down[c.joy]) || hmd.state[i];
}
}

View File

@@ -3040,6 +3040,11 @@ struct Lara : Character {
// VR control
if (Core::settings.detail.stereo == Core::Settings::STEREO_VR && camera->firstPerson && canFreeRotate()) {
if (!(input & WALK)) {
input &= ~(LEFT | RIGHT);
}
vec3 ang = getAngleAbs(Input::hmd.head.dir().xyz());
angle.y = ang.y;
if (stand == STAND_UNDERWATER) {
@@ -3075,10 +3080,6 @@ struct Lara : Character {
|| state == STATE_ROLL_END
|| state == STATE_MIDAS_USE
|| state == STATE_MIDAS_DEATH
// make me sick!
//|| state == STATE_BACK_JUMP
//|| state == STATE_LEFT_JUMP
//|| state == STATE_RIGHT_JUMP
|| animation.index == ANIM_CLIMB_2
|| animation.index == ANIM_CLIMB_3
|| animation.index == ANIM_CLIMB_JUMP;

View File

@@ -2704,14 +2704,14 @@ struct Level : IGame {
Viewport vp = Core::viewportDef;
Core::defaultTarget = Core::eyeTex[0];
Core::viewportDef = Viewport(0, 0, float(Core::defaultTarget->width), float(Core::defaultTarget->height));
Core::viewportDef = Viewport(0, 0, Core::defaultTarget->width, Core::defaultTarget->height);
Core::setTarget(NULL,Core::defaultTarget, 0); // changing to 0 and adding defaultTarget parameter
Core::eye = -1.0f;
setup();
renderView(camera->getRoomIndex(), true);
Core::defaultTarget = Core::eyeTex[1];
Core::viewportDef = Viewport(0, 0, float(Core::defaultTarget->width), float(Core::defaultTarget->height));
Core::viewportDef = Viewport(0, 0, Core::defaultTarget->width, Core::defaultTarget->height);
Core::setTarget(NULL, Core::defaultTarget, 0);
Core::eye = 1.0f;
setup();

View File

@@ -698,14 +698,11 @@ bool GetDigitalActionState(vr::VRActionHandle_t action, vr::VRInputValueHandle_t
{
vr::InputDigitalActionData_t actionData;
vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData), vr::k_ulInvalidInputValueHandle);
if (pDevicePath)
{
if (pDevicePath) {
*pDevicePath = vr::k_ulInvalidInputValueHandle;
if (actionData.bActive)
{
if (actionData.bActive) {
vr::InputOriginInfo_t originInfo;
if (vr::VRInputError_None == vr::VRInput()->GetOriginTrackedDeviceInfo(actionData.activeOrigin, &originInfo, sizeof(originInfo)))
{
if (vr::VRInputError_None == vr::VRInput()->GetOriginTrackedDeviceInfo(actionData.activeOrigin, &originInfo, sizeof(originInfo))) {
*pDevicePath = originInfo.devicePath;
}
}
@@ -727,6 +724,7 @@ void ProcessVREvent(const vr::VREvent_t &event) {
break;
case vr::VREvent_TrackedDeviceDeactivated:
LOG("Device %u detached.\n", event.trackedDeviceIndex);
Input::reset();
break;
case vr::VREvent_TrackedDeviceUpdated: //not sure what to do here
LOG("Device %u updated.\n", event.trackedDeviceIndex);
@@ -734,33 +732,29 @@ void ProcessVREvent(const vr::VREvent_t &event) {
}
}
//taken from openvrsimpleexamples
void vrUpdateInput() { // going to use action manifest and ivr:input(Steam Vr Input) // broken
void vrUpdateInput() {
if (!hmd) return;
vr::VREvent_t event;
while (hmd->PollNextEvent(&event, sizeof(event))) {
ProcessVREvent( event ); // eventually going to be the function for this while loop
ProcessVREvent(event);
}
//process actions( set hmd down)
vr::VRActiveActionSet_t actionSet = { 0 };
actionSet.ulActionSet = m_actionsetDemo;
vr::VRInput()->UpdateActionState(&actionSet, sizeof(actionSet), 1);
Input::hmd.down[cUp] = GetDigitalActionState(VRcUp);
Input::hmd.down[cDown] = GetDigitalActionState(VRcDown);
Input::hmd.down[cRight] = GetDigitalActionState(VRcRight);
Input::hmd.down[cLeft] = GetDigitalActionState(VRcLeft);
Input::hmd.down[cJump] = GetDigitalActionState(VRcJump);
Input::hmd.down[cWalk] = GetDigitalActionState(VRcWalk);
Input::hmd.down[cAction] = GetDigitalActionState(VRcAction);
Input::hmd.down[cWeapon] = GetDigitalActionState(VRcWeapon);
Input::hmd.down[cRoll] = GetDigitalActionState(VRcRoll);
Input::hmd.down[cStart] = GetDigitalActionState(VRcStart);
Input::hmd.down[cInventory] = GetDigitalActionState(VRcInventory);
Input::hmd.state[cUp] = GetDigitalActionState(VRcUp);
Input::hmd.state[cDown] = GetDigitalActionState(VRcDown);
Input::hmd.state[cRight] = GetDigitalActionState(VRcRight);
Input::hmd.state[cLeft] = GetDigitalActionState(VRcLeft);
Input::hmd.state[cJump] = GetDigitalActionState(VRcJump);
Input::hmd.state[cWalk] = GetDigitalActionState(VRcWalk);
Input::hmd.state[cAction] = GetDigitalActionState(VRcAction);
Input::hmd.state[cWeapon] = GetDigitalActionState(VRcWeapon);
Input::hmd.state[cRoll] = GetDigitalActionState(VRcRoll);
Input::hmd.state[cStart] = GetDigitalActionState(VRcStart);
Input::hmd.state[cInventory] = GetDigitalActionState(VRcInventory);
}
void vrUpdateView() {
@@ -784,7 +778,7 @@ void vrUpdateView() {
vL.setPos(vL.getPos() * ONE_METER);
vR.setPos(vR.getPos() * ONE_METER);
Input::hmd.setView(pL, pR, vL, vR);
// pass this to Lara's rotation value
Input::hmd.head = head;
}