summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-08-21 19:07:26 +0300
committererorcun <erorcunerorcun@hotmail.com.tr>2021-08-21 19:07:26 +0300
commitc52aebe8e7561c428c610e17827eb1347197369f (patch)
tree28faa3c8b6f8052b407b90c487fa3b54492c5fe5
parentf86bdb2cdb2256a9348001e230c9c8eb6fe76e8e (diff)
Fix an original bug about entering boat sometimes takes 2 key press
-rw-r--r--src/peds/PedAI.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index f1c753ec..8bd6791c 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -3531,23 +3531,17 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_vecOffsetSeek = doorOpenPos - GetPosition();
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
if (car->IsBoat()) {
-#ifdef VC_PED_PORTS
- // VC checks for handling flag, but we can't do that
- if(car->GetModelIndex() == MI_SPEEDER)
- m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_STD_CAR_SIT, 100.0f);
- else
- m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_STD_BOAT_DRIVE, 100.0f);
-
- PedSetInCarCB(nil, this);
- bVehExitWillBeInstant = true;
-#else
-
#ifndef FIX_BUGS
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_STD_BOAT_DRIVE, 100.0f);
#else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
#endif
+ // Otherwise boat enter key sometimes processed multiple times, so you enter/exit instantly
+#if defined VC_PED_PORTS || defined FIX_BUGS
+ PedSetInCarCB(nil, this);
+ bVehExitWillBeInstant = true;
+#else
m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, this);
#endif
if (IsPlayer())
@@ -5194,8 +5188,10 @@ CPed::SeekBoatPosition(void)
enterOffset = boatModel->GetFrontSeatPosn();
enterOffset.x = 0.0f;
CMatrix boatMat(m_carInObjective->GetMatrix());
+ CVector boatEnterPos = Multiply3x3(boatMat, enterOffset);
+ boatEnterPos += m_carInObjective->GetPosition();
SetMoveState(PEDMOVE_WALK);
- m_vecSeekPos = boatMat * enterOffset;
+ m_vecSeekPos = boatEnterPos;
if (Seek()) {
// We arrived to the boat
m_vehDoor = 0;