diff --git a/build/graphics/poker.exe b/build/graphics/poker.exe index a6e03f8..b5a8caf 100644 Binary files a/build/graphics/poker.exe and b/build/graphics/poker.exe differ diff --git a/casino3d.inc b/casino3d.inc index 6b02338..2903f96 100644 --- a/casino3d.inc +++ b/casino3d.inc @@ -4450,6 +4450,10 @@ HandlePlayerInput PROC uses ebx esi edi local speed:DWORD local nextX:DWORD local nextY:DWORD + local fwdDir:DWORD + local strafeDir:DWORD + local deltaMoveX:DWORD + local deltaMoveY:DWORD local rcClient[16]:BYTE local ptCenter:C3D_POINT local ptCursor:C3D_POINT @@ -4485,6 +4489,8 @@ HandlePlayerInput PROC uses ebx esi edi mouse_recenter: invoke SetCursorPos, ptCenter.x, ptCenter.y skip_mouse_look: + + ; Movement speed with sprint (Shift = 10h) mov eax, deltaTime3D imul eax, 200 mov speed, eax @@ -4492,53 +4498,101 @@ skip_mouse_look: je @F shl speed, 1 @@: + + ; --- Keyboard Arrow Turning (VK_LEFT = 25h, VK_RIGHT = 27h) --- mov eax, deltaTime3D shr eax, 2 inc eax - cmp keys3D[41h], 0 - jne input_turn_left cmp keys3D[25h], 0 - je input_right -input_turn_left: + je @F sub playerAngle, eax -input_right: - cmp keys3D[44h], 0 - jne input_turn_right +@@: cmp keys3D[27h], 0 - je input_forward -input_turn_right: + je @F add playerAngle, eax -input_forward: +@@: and playerAngle, 511 call UpdateCamera3D - xor edi, edi + + ; --- Forward / Backward Direction (W / Up / S / Down) --- + mov fwdDir, 0 cmp keys3D[57h], 0 - jne input_go_forward + jne @F cmp keys3D[26h], 0 - je input_back -input_go_forward: - inc edi -input_back: + je check_back_key +@@: + inc fwdDir +check_back_key: cmp keys3D[53h], 0 - jne input_go_back + jne @F cmp keys3D[28h], 0 - je input_move -input_go_back: - dec edi -input_move: + je check_strafe_keys +@@: + dec fwdDir + +check_strafe_keys: + ; --- Strafe Direction (A = Left, D = Right) --- + mov strafeDir, 0 + cmp keys3D[44h], 0 + je @F + inc strafeDir +@@: + cmp keys3D[41h], 0 + je @F + dec strafeDir +@@: + + ; --- Movement Calculation --- + mov deltaMoveX, 0 + mov deltaMoveY, 0 + + ; Forward / Backward component + mov edi, fwdDir test edi, edi - jz input_action + jz calc_strafe_comp + imul edi, speed mov eax, playerDirX imul edi shrd eax, edx, 16 - add eax, playerX - mov nextX, eax + add deltaMoveX, eax + mov eax, playerDirY imul edi shrd eax, edx, 16 - add eax, playerY + add deltaMoveY, eax + +calc_strafe_comp: + ; Strafe Left / Right component: Right vector is (-playerDirY, playerDirX) + mov edi, strafeDir + test edi, edi + jz check_total_movement + + imul edi, speed + mov eax, playerDirY + neg eax + imul edi + shrd eax, edx, 16 + add deltaMoveX, eax + + mov eax, playerDirX + imul edi + shrd eax, edx, 16 + add deltaMoveY, eax + +check_total_movement: + mov eax, deltaMoveX + or eax, deltaMoveY + jz input_action + + mov eax, playerX + add eax, deltaMoveX + mov nextX, eax + + mov eax, playerY + add eax, deltaMoveY mov nextY, eax + invoke CanWalk3D, nextX, playerY test eax, eax jz @F @@ -4550,6 +4604,7 @@ input_move: jz input_action mov eax, nextY mov playerY, eax + input_action: invoke Pressed3D, 45h test eax, eax diff --git a/poker.exe b/poker.exe index a6e03f8..b5a8caf 100644 Binary files a/poker.exe and b/poker.exe differ diff --git a/poker.obj b/poker.obj index cb4c587..37d3a90 100644 Binary files a/poker.obj and b/poker.obj differ