[saco] Implement/match CVehicle::GetVehicleSubtype()

* Implement/match `GetVehicleSubtypeFromVehiclePtr(...)`
This commit is contained in:
RD42 2024-08-20 23:26:04 +08:00
parent 6669d58ffd
commit 587e87d11d
4 changed files with 41 additions and 0 deletions

View File

@ -1936,5 +1936,32 @@ DWORD unnamed_100B6100(char *szString, int nMaxLen)
return 0;
}
UINT GetVehicleSubtypeFromVehiclePtr(VEHICLE_TYPE *pVehicle)
{
if(!pVehicle) return 0;
if(pVehicle->entity.vtable == 0x871120) {
return VEHICLE_SUBTYPE_CAR;
}
else if(pVehicle->entity.vtable == 0x8721A0) {
return VEHICLE_SUBTYPE_BOAT;
}
else if(pVehicle->entity.vtable == 0x871360) {
return VEHICLE_SUBTYPE_BIKE;
}
else if(pVehicle->entity.vtable == 0x871948) {
return VEHICLE_SUBTYPE_PLANE;
}
else if(pVehicle->entity.vtable == 0x871680) {
return VEHICLE_SUBTYPE_HELI;
}
else if(pVehicle->entity.vtable == 0x871528) {
return VEHICLE_SUBTYPE_PUSHBIKE;
}
else if(pVehicle->entity.vtable == 0x872370) {
return VEHICLE_SUBTYPE_TRAIN;
}
return 0;
}

View File

@ -70,3 +70,6 @@ BOOL IsHexChar(wchar_t c);
DWORD GetColorFromEmbedCode(char *szString);
DWORD GetColorFromEmbedCode(wchar_t *szString);
void RemoveColorEmbedsFromString(char *szString);
UINT GetVehicleSubtypeFromVehiclePtr(VEHICLE_TYPE *pVehicle);

View File

@ -139,6 +139,16 @@ void CVehicle::UpdateColor()
//-----------------------------------------------------------
UINT CVehicle::GetVehicleSubtype()
{
if(m_pVehicle) {
return GetVehicleSubtypeFromVehiclePtr(m_pVehicle);
}
return 0;
}
//-----------------------------------------------------------
BOOL CVehicle::HasSunk()
{
if(!m_pVehicle) return FALSE;

View File

@ -31,6 +31,7 @@ public:
void ResetPointers();
void SetLockedState(int iLocked);
UINT GetVehicleSubtype();
float GetHealth();
void SetHealth(float fHealth);