Numberplates code optimised

This commit is contained in:
Silent 2014-06-23 15:08:48 +02:00
parent 4b8d9be799
commit 675c2d114b
3 changed files with 13 additions and 12 deletions

View file

@ -44,7 +44,7 @@ bool CVehicle::CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo)
return true;
}
static RwTexture* pPushedTextures[NUM_MAX_PLATES];
//static RwTexture* pPushedTextures[NUM_MAX_PLATES];
void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo)
{
@ -52,10 +52,10 @@ void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo
{
if ( pModelInfo->m_apPlateMaterials[i] )
{
RwTexture* pPlateTex = RpMaterialGetTexture(pModelInfo->m_apPlateMaterials[i]);
//RwTexture* pPlateTex = RpMaterialGetTexture(pModelInfo->m_apPlateMaterials[i]);
RwTextureAddRef(pPlateTex);
pPushedTextures[i] = pPlateTex;
//RwTextureAddRef(pPlateTex);
//pPushedTextures[i] = pPlateTex;
RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], PlateTexture);
}
@ -71,8 +71,8 @@ void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo
}
}
void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo)
// This is not needed
/*void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo)
{
for ( int i = 0; i < NUM_MAX_PLATES; i++ )
{
@ -83,13 +83,13 @@ void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo)
//RwTextureAddRef(pPlateTex);
//pPushedTextures[i] = pPlateTex;
RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], pPushedTextures[i]);
RwTextureDestroy(pPushedTextures[i]);
pPushedTextures[i] = nullptr;
//RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], pPushedTextures[i]);
//RwTextureDestroy(pPushedTextures[i]);
//pPushedTextures[i] = nullptr;
}
}
}
}*/
void CHeli::Render()
{

View file

@ -111,7 +111,7 @@ public:
bool CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo);
void CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo);
void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
//void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
bool IsLawEnforcementVehicle();

View file

@ -2388,10 +2388,11 @@ __forceinline void Patch_SA_10()
mov [pFunc], eax
}
Patch<const void*>(&pVMT[7], pFunc);
Patch<BYTE>(0x6D0E43, 0xEB);
InjectMethodVP(0x4C9660, CVehicleModelInfo::SetCarCustomPlate, PATCH_NOTHING);
InjectMethodVP(0x6D6A58, CVehicle::CustomCarPlate_TextureCreate, PATCH_NOTHING);
InjectMethodVP(0x6D651C, CVehicle::CustomCarPlate_BeforeRenderingStart, PATCH_NOTHING);
InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING);
//InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING);
// Fixed police scanner names
char* pScannerNames = *(char**)0x4E72D4;