Merge fixes

This commit is contained in:
Silent 2017-06-20 18:33:31 +02:00
parent 38705cf740
commit 22c484a9f9
3 changed files with 16 additions and 14 deletions

View File

@ -7,7 +7,7 @@ int32_t (*FLAUtils::GetExtendedIDFunc)(const void* ptr) = nullptr;
void FLAUtils::Init()
{
HMODULE hFLA = GetModuleHandle("$fastman92limitAdjuster.asi");
HMODULE hFLA = GetModuleHandle(TEXT("$fastman92limitAdjuster.asi"));
if ( hFLA != nullptr )
{
GetExtendedIDFunc = reinterpret_cast<decltype(GetExtendedIDFunc)>(GetProcAddress( hFLA, "GetExtendedIDfrom16bitBefore" ));

View File

@ -1067,7 +1067,7 @@ void DrawScriptSpritesAndRectangles( uint8_t arg )
orgDrawScriptSpritesAndRectangles( arg );
}
std::vector< std::pair<uint32_t, bool> > doubleRearWheelsList;
std::vector< std::pair<int32_t, bool> > doubleRearWheelsList;
void ReadDoubleRearWheels(const wchar_t* pPath)
{
const size_t SCRATCH_PAD_SIZE = 32767;
@ -1083,8 +1083,8 @@ void ReadDoubleRearWheels(const wchar_t* pPath)
wcscpy_s( textLine, str );
token = wcstok_s( textLine, L"=", &context );
uint32_t toList = wcstoul( token, nullptr, 0 );
if ( toList == 0 ) continue;
int32_t toList = wcstol( token, nullptr, 0 );
if ( toList <= 0 ) continue;
wchar_t* begin = wcstok_s( nullptr, L"=", &context );
if ( begin == nullptr ) continue;
@ -1106,7 +1106,7 @@ bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData )
if ( modelInfo == lastModelInfo ) return lastResult;
lastModelInfo = modelInfo;
uint32_t modelID = std::distance( ms_modelInfoPtrs, std::find( ms_modelInfoPtrs, ms_modelInfoPtrs+m_numModelInfoPtrs, modelInfo ) );
int32_t modelID = std::distance( ms_modelInfoPtrs, std::find( ms_modelInfoPtrs, ms_modelInfoPtrs+m_numModelInfoPtrs, modelInfo ) );
auto it = std::find_if( doubleRearWheelsList.begin(), doubleRearWheelsList.end(), [modelID]( const auto& item ) {
return item.first == modelID;

View File

@ -7,9 +7,9 @@
#include "TimerSA.h"
#include "DelimStringReader.h"
std::vector<uint32_t> vecRotorExceptions;
std::vector<int32_t> vecRotorExceptions;
static bool ShouldIgnoreRotor( uint32_t id )
static bool ShouldIgnoreRotor( int32_t id )
{
return std::find( vecRotorExceptions.begin(), vecRotorExceptions.end(), id ) != vecRotorExceptions.end();
}
@ -78,8 +78,8 @@ void ReadRotorFixExceptions(const wchar_t* pPath)
GetPrivateProfileSectionW( L"RotorFixExceptions", reader.GetBuffer(), reader.GetSize(), pPath );
while ( const wchar_t* str = reader.GetString() )
{
uint32_t toList = wcstoul( str, nullptr, 0 );
if ( toList != 0 )
int32_t toList = wcstol( str, nullptr, 0 );
if ( toList > 0 )
vecRotorExceptions.push_back( toList );
}
}
@ -138,7 +138,7 @@ void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo
void CHeli::Render()
{
double dRotorsSpeed, dMovingRotorSpeed;
bool bDisplayRotors = !ShouldIgnoreRotor( m_nModelIndex );
bool bDisplayRotors = !ShouldIgnoreRotor( FLAUtils::GetExtendedID( &m_nModelIndex ) );
bool bHasMovingRotor = m_pCarNode[13] != nullptr && bDisplayRotors;
bool bHasMovingRotor2 = m_pCarNode[15] != nullptr && bDisplayRotors;
@ -190,7 +190,7 @@ void CHeli::Render()
void CPlane::Render()
{
double dRotorsSpeed, dMovingRotorSpeed;
bool bDisplayRotors = !ShouldIgnoreRotor( m_nModelIndex );
bool bDisplayRotors = !ShouldIgnoreRotor( FLAUtils::GetExtendedID( &m_nModelIndex ) );
bool bHasMovingProp = m_pCarNode[13] != nullptr && bDisplayRotors;
bool bHasMovingProp2 = m_pCarNode[15] != nullptr && bDisplayRotors;
@ -243,7 +243,8 @@ void CPlane::Fix_SilentPatch()
{
// Reset bouncing panels
// No reset on Vortex
for ( ptrdiff_t i = m_nModelIndex == 539 ? 1 : 0; i < 3; i++ )
const int32_t extID = FLAUtils::GetExtendedID( &m_nModelIndex );
for ( ptrdiff_t i = extID == 539 ? 1 : 0; i < 3; i++ )
{
m_aBouncingPanel[i].m_nNodeIndex = -1;
}
@ -254,7 +255,8 @@ void CAutomobile::Fix_SilentPatch()
ResetFrames();
// Reset bouncing panels
for ( ptrdiff_t i = (m_nModelIndex == 525 && m_pCarNode[21]) || (m_nModelIndex == 531 && m_pCarNode[17]) ? 1 : 0; i < 3; i++ )
const int32_t extID = FLAUtils::GetExtendedID( &m_nModelIndex );
for ( ptrdiff_t i = (extID == 525 && m_pCarNode[21]) || (extID == 531 && m_pCarNode[17]) ? 1 : 0; i < 3; i++ )
{
// Towtruck/Tractor fix
m_aBouncingPanel[i].m_nNodeIndex = -1;
@ -263,7 +265,7 @@ void CAutomobile::Fix_SilentPatch()
void CAutomobile::ResetFrames()
{
RpClump* pOrigClump = reinterpret_cast<RpClump*>(ms_modelInfoPtrs[m_nModelIndex]->pRwObject);
RpClump* pOrigClump = reinterpret_cast<RpClump*>(ms_modelInfoPtrs[ FLAUtils::GetExtendedID( &m_nModelIndex ) ]->pRwObject);
if ( pOrigClump != nullptr )
{
// Instead of setting frame rotation to (0,0,0) like R* did, obtain the original frame matrix from CBaseNodelInfo clump