Attempt to consider player input when moving with mech code

This commit is contained in:
Robert MacGregor 2016-01-18 21:45:07 -05:00
parent c64b0739f9
commit 752155db59

View file

@ -58,11 +58,6 @@ __declspec(naked) void updateMoveHook()
if (dAtob((playervar->CallMethod("isMechControlEnabled",0))) && mechchangedmove.freelook && (mechchangedmove.y>0.0)) if (dAtob((playervar->CallMethod("isMechControlEnabled",0))) && mechchangedmove.freelook && (mechchangedmove.y>0.0))
{ {
mechchangedmove.pitch = 0;
mechchangedmove.yaw = 0;
mechchangedmove.roll = 0;
mechchangedmove.freelook = true;
// FIXME: The 3 here should reference the datablock's maximum turning angle -- we're essentially normalizing our rotation here. // FIXME: The 3 here should reference the datablock's maximum turning angle -- we're essentially normalizing our rotation here.
float turnStrength = playervar->headRotationZ / 3; float turnStrength = playervar->headRotationZ / 3;
// Use whatever is leftover in our forward movement // Use whatever is leftover in our forward movement
@ -72,14 +67,18 @@ __declspec(naked) void updateMoveHook()
float newHeadTurn = turnStrength * (MECH_TURNING_SPEED/20); float newHeadTurn = turnStrength * (MECH_TURNING_SPEED/20);
mechchangedmove.y = forwardStrength; mechchangedmove.y = forwardStrength;
mechchangedmove.x = turnStrength; mechchangedmove.x += turnStrength;
// FIXME: Is the yaw value definitely in radians? // FIXME: Is the yaw value definitely in radians?
playervar->mRotZ += newTurn; playervar->mRotZ += newTurn + mechchangedmove.yaw;
// Now, we must translate the turning strength into an appropriate subtraction for our // Now, we must translate the turning strength into an appropriate subtraction for our
// head rotation. // head rotation.
playervar->headRotationZ += -newTurn; playervar->headRotationZ += -newTurn;
mechchangedmove.pitch = 0;
mechchangedmove.yaw = 0;
mechchangedmove.roll = 0;
mechchangedmove.freelook = true;
} }
__asm { __asm {
mov eax,offset mechchangedmove mov eax,offset mechchangedmove
@ -284,4 +283,3 @@ __declspec(naked) void updateMoveHook()
DX::memPatch(0x5D2D6E,(unsigned char *)mechcode,7); DX::memPatch(0x5D2D6E,(unsigned char *)mechcode,7);
} }
} }