Numberplates now randomised a bit

This commit is contained in:
Silent 2014-06-23 14:54:36 +02:00
parent c6a0801221
commit 4b8d9be799
3 changed files with 16 additions and 1 deletions

View File

@ -34,6 +34,12 @@ void GTAdelete(void* data);
extern unsigned char& nGameClockDays;
extern unsigned char& nGameClockMonths;
template<typename T>
inline T random(T a, T b)
{
return a + static_cast<T>(rand() * (1.0f/(RAND_MAX+1)) * (b - a));
}
//#define HIDE_MATERIAL
//#define EXPAND_ALPHA_ENTITY_LISTS 800
//#define EXPAND_BOAT_ALPHA_ATOMIC_LISTS 400

View File

@ -5,6 +5,7 @@
WRAPPER void CVehicle::SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha) { WRAPARG(pAtomic); WRAPARG(nAlpha); EAXJMP(0x6D2960); }
WRAPPER void CVehicle::Render() { EAXJMP(0x6D0E60); }
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { EAXJMP(0x6D2370); }
static RwObject* GetCurrentAtomicObjectCB(RwObject* pObject, void* data)
{
@ -27,7 +28,13 @@ bool CVehicle::CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo)
CCustomCarPlateMgr::GeneratePlateText(PlateText, 8);
PlateTexture = CCustomCarPlateMgr::CreatePlateTexture(PlateText, pModelInfo->m_nPlateType);
PlateDesign = pModelInfo->m_nPlateType != -1 ? pModelInfo->m_nPlateType : CCustomCarPlateMgr::GetMapRegionPlateDesign();
//PlateDesign = pModelInfo->m_nPlateType != -1 ? pModelInfo->m_nPlateType : CCustomCarPlateMgr::GetMapRegionPlateDesign();
if ( pModelInfo->m_nPlateType != -1 )
PlateDesign = pModelInfo->m_nPlateType;
else if ( IsLawEnforcementVehicle() )
PlateDesign = CCustomCarPlateMgr::GetMapRegionPlateDesign();
else
PlateDesign = random(0, 20) == 0 ? random<signed char>(0, 3) : CCustomCarPlateMgr::GetMapRegionPlateDesign();
assert(PlateDesign >= 0 && PlateDesign < 3);

View File

@ -113,6 +113,8 @@ public:
void CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo);
void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
bool IsLawEnforcementVehicle();
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
};