int __cdecl materialProcessVehicleColorsAndLights(RpMaterial *material, int ppRestoreMatData) { int result; // eax@1 int pMaterialColor; // edx@1 int MaterialColor2; // esi@1 int MaterialColor; // esi@1 int _temp_pRestoreMatData; // ebx@4 signed int LightID; // edi@6 int _temp_pRestoreMatData2; // esi@14 int _temp_pRestoreMatData3; // edx@16 int _temp_pRestoreMatData4; // ebx@16 int _temp_pRestoreMatData5; // edi@16 int CarColorID; // esi@18 int _temp_pRestoreMatData6; // ebx@25 result = material; MaterialColor = *&material->color.red; pMaterialColor = &material->color; MaterialColor2 = MaterialColor & 0xFFFFFF; if ( someTexture_B4E47C ) { if ( material->texture ) { if ( *(material->texture + 16) == '#' ) // RwTexture.Name { **ppRestoreMatData = material; _temp_pRestoreMatData = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData; *_temp_pRestoreMatData = material->texture; *ppRestoreMatData += 4; material->texture = someTexture_B4E47C; } } } if ( material->texture == texVehiclelights128 ) { LightID = -1; switch ( MaterialColor2 ) { case 0xAFFF: LightID = 0; break; case 0xC8FF00: LightID = 1; break; case 0xFFB9: LightID = 2; break; case 0x3CFF: LightID = 3; break; } **ppRestoreMatData = pMaterialColor; _temp_pRestoreMatData2 = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData2; *_temp_pRestoreMatData2 = *pMaterialColor; *ppRestoreMatData += 4; *pMaterialColor |= 0xFFFFFFu; if ( LightID != -1 ) { if ( data_light_FR[LightID] ) { **ppRestoreMatData = material; _temp_pRestoreMatData3 = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData3; *_temp_pRestoreMatData3 = material->texture; _temp_pRestoreMatData4 = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData4; *_temp_pRestoreMatData4 = material + 12; _temp_pRestoreMatData5 = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData5; *_temp_pRestoreMatData5 = material->surfaceProps.ambient; *ppRestoreMatData += 4; material->texture = texVehiclelightson128; material->surfaceProps.ambient = vehlighton_Ambient; material->surfaceProps.specular = vehlighton_Specular; material->surfaceProps.diffuse = vehlighton_Diffuse; } } } else { switch ( MaterialColor2 ) { case 0xFF3C: CarColorID = data_primaryColor; break; case 0xAF00FF: CarColorID = data_secondaryColor; break; case 0xFFFF00: CarColorID = data_tertiaryColor; break; default: if ( MaterialColor2 != 0xFF00FF ) return result; CarColorID = data_quaternaryColor; break; } **ppRestoreMatData = pMaterialColor; _temp_pRestoreMatData6 = *ppRestoreMatData + 4; *ppRestoreMatData = _temp_pRestoreMatData6; *_temp_pRestoreMatData6 = *pMaterialColor; *ppRestoreMatData += 4; *pMaterialColor = vehicleColors[CarColorID].red; material->color.green = vehicleColors[CarColorID].green; material->color.blue = vehicleColors[CarColorID].blue; } return result; }