Skip to content
Permalink
Browse files

Fix #578: doors state with setElementModel (#599)

Changing vehicle model from doorless or "doorful" causes doors to fall off.

1. Take a tractor.
2. Set its model to a 4 door vehicle.
3. Doors fall off.

From bugs.mtasa.com/view.php?id=9915
  • Loading branch information
FileEX committed Mar 23, 2020
1 parent 2429683 commit c2dc4633e334f0531762b9f561e1c789d9801186
Showing with 10 additions and 52 deletions.
  1. +5 −26 Client/mods/deathmatch/logic/CClientVehicle.cpp
  2. +5 −26 Server/mods/deathmatch/logic/CVehicle.cpp
@@ -3598,32 +3598,11 @@ void CClientVehicle::Interpolate()

void CClientVehicle::GetInitialDoorStates(SFixedArray<unsigned char, MAX_DOORS>& ucOutDoorStates)
{
switch (m_usModel)
{
case VT_BAGGAGE:
case VT_BANDITO:
case VT_BFINJECT:
case VT_CADDY:
case VT_DOZER:
case VT_FORKLIFT:
case VT_KART:
case VT_MOWER:
case VT_QUAD:
case VT_RCBANDIT:
case VT_RCCAM:
case VT_RCGOBLIN:
case VT_RCRAIDER:
case VT_RCTIGER:
case VT_TRACTOR:
case VT_VORTEX:
memset(&ucOutDoorStates[0], DT_DOOR_MISSING, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
break;
default:
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}

void CClientVehicle::SetTargetPosition(const CVector& vecTargetPosition, unsigned long ulDelay, bool bValidVelocityZ, float fVelocityZ)
@@ -777,32 +777,11 @@ void CVehicle::SetPaintjob(unsigned char ucPaintjob)

void CVehicle::GetInitialDoorStates(SFixedArray<unsigned char, MAX_DOORS>& ucOutDoorStates)
{
switch (m_usModel)
{
case VT_BAGGAGE:
case VT_BANDITO:
case VT_BFINJECT:
case VT_CADDY:
case VT_DOZER:
case VT_FORKLIFT:
case VT_KART:
case VT_MOWER:
case VT_QUAD:
case VT_RCBANDIT:
case VT_RCCAM:
case VT_RCGOBLIN:
case VT_RCRAIDER:
case VT_RCTIGER:
case VT_TRACTOR:
case VT_VORTEX:
memset(&ucOutDoorStates[0], DT_DOOR_MISSING, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
break;
default:
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);

// Keep the bonet and boot intact
ucOutDoorStates[0] = ucOutDoorStates[1] = DT_DOOR_INTACT;
memset(&ucOutDoorStates[0], DT_DOOR_INTACT, MAX_DOORS);
}

void CVehicle::GenerateHandlingData()

0 comments on commit c2dc463

Please sign in to comment.
You can’t perform that action at this time.