Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
700f551
Added 5267: ([Request and Patch] serverside set/getElementRotation)
Mar 30, 2010
0505abe
Fixed 5269: (1.0.4 Custom - Flobu's Build: Default Handling Is Incorr…
Mar 30, 2010
309538d
Fixed killed timers rarely being executed when killed in the exact mo…
Mar 30, 2010
7c1b8a3
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
Mar 30, 2010
f026c10
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
Mar 31, 2010
993aaf9
Enable custom vehicle handling
Mar 31, 2010
5ea79fd
Handling RPC clientside
Mar 31, 2010
f657d8e
Handling serverside
Mar 31, 2010
45de4c2
Fixed: use CCLIENTVEHICLE in CHandlingRPC clientside
Mar 31, 2010
e57d99d
Fixed some warnings in CLuaFunctionDefs.Vehicle clientside
Mar 31, 2010
3d55355
delete CClientHandling and CClientHandlingManager clientside
Mar 31, 2010
0341da1
Rename IHandlingManager to CHandlingManager clientside
Mar 31, 2010
646156b
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
Apr 1, 2010
ff9317b
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
MrHankey Apr 1, 2010
99062c6
Added a basic setVehicleHandling function serverside
MrHankey Apr 1, 2010
e91b68a
Merge branch 'merge' of git://github.com/MrHankey/multitheftauto into…
Apr 1, 2010
5188a31
removed unused handling code clientside
Apr 1, 2010
6dae7b6
deleted CHandling
Apr 2, 2010
f537475
Add getVehicleHandling(vehicle[, property] ) serverside
Apr 3, 2010
a4e1d6f
added PROPERTY_MONETARY to eHandlingProperty
Apr 3, 2010
8803993
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
Apr 4, 2010
08696b8
moved getVehicleHandling to CStaticFunctionDefinitions
Apr 5, 2010
cba22f8
Merge branch 'merge' of git://github.com/multitheftauto/multitheftaut…
Apr 5, 2010
9a275fc
Added 5272: ([request] getTimer)
Apr 6, 2010
50070f5
Changed PROPERTY enums to HANDLING
Apr 8, 2010
e141466
Rename Set/GetVehicleHandling to Set/GetHandling and moved it to CLua…
Apr 8, 2010
e9e81b2
Rename Set/GetVehicleHandling to Set/GetHandling in CStaticFunctionDe…
Apr 8, 2010
d54acea
Changed ABS to unsigned int
Apr 8, 2010
adf7382
Moved unsigned int Handlings to float
Apr 8, 2010
059aa4c
Added getModelHandling( int model [, int property] ) serverside
Apr 8, 2010
1173864
Revert (Rename Set/GetVehicleHandling to Set/GetHandling)
Apr 8, 2010
f45320a
removed unused handling code serverside
Apr 8, 2010
381ee2d
Fixed some wrong code
Apr 9, 2010
4b6cb0d
Fixed handling data doesn't fit if the vehicle is created from XML or…
Apr 9, 2010
1b70f62
Implement handling join packet
Apr 9, 2010
e1923ec
Renamed getModelHandling to getOriginalHandling
Apr 9, 2010
946558d
Removed m_pOriginalHandlingEntry in CVehicle
Apr 9, 2010
1e6cecb
Prepare for per model handling
Apr 9, 2010
a17c427
Use model handling instead of original for new created vehicles
Apr 11, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MTA10/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CGameSA : public CGame
inline CCarEnterExit * GetCarEnterExit() { DEBUG_TRACE("CCarEnterExit * GetCarEnterExit()");return m_pCarEnterExit; };
inline CControllerConfigManager * GetControllerConfigManager() { DEBUG_TRACE("CControllerConfigManager* GetControllerConfigManager()");return m_pControllerConfigManager; };
inline CRenderWare * GetRenderWare() { DEBUG_TRACE("CRenderWare * GetRenderWare()");return m_pRenderWare; };
inline IHandlingManager * GetHandlingManager () { return m_pHandlingManager; };
inline CHandlingManager * GetHandlingManager () { return m_pHandlingManager; };
inline CAnimManager * GetAnimManager () { return m_pAnimManager; }
inline CStreaming * GetStreaming () { return m_pStreaming; }
inline CVisibilityPlugins * GetVisibilityPlugins () { return m_pVisibilityPlugins; }
Expand Down Expand Up @@ -187,7 +187,7 @@ class CGameSA : public CGame
CExplosionManager * m_pExplosionManager;
C3DMarkers * m_p3DMarkers;
CRenderWare * m_pRenderWare;
IHandlingManager * m_pHandlingManager;
CHandlingManager * m_pHandlingManager;
CAnimManager * m_pAnimManager;
CStreaming * m_pStreaming;
CVisibilityPlugins * m_pVisibilityPlugins;
Expand Down
36 changes: 0 additions & 36 deletions MTA10/game_sa/CHandlingEntrySA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ CHandlingEntrySA::CHandlingEntrySA ( void )
}


CHandlingEntrySA::CHandlingEntrySA ( tHandlingDataSA* pDataSA, tHandlingDataSA* pOriginalUncalculatedData )
{
// Store gta's pointer
m_pHandlingSA = pDataSA;
m_bDeleteInterface = false;
m_pOriginalData = pOriginalUncalculatedData;
}


CHandlingEntrySA::CHandlingEntrySA ( tHandlingDataSA* pOriginal )
{
// Store gta's pointer
Expand All @@ -52,26 +43,6 @@ CHandlingEntrySA::~CHandlingEntrySA ( void )
}
}

// Does vehicle entry already exist?
bool CHandlingEntrySA::IsVehicleAdded ( CVehicle* pVeh )
{
// std::list < CVehicleSA* > ::iterator iter = m_VehicleList.begin ();
// for ( ; iter != m_VehicleList.begin (); iter++ )
// {
// if (*iter == pVeh)
// return true;
// }
return false;
}

// Adds a vehicle to list
void CHandlingEntrySA::AddVehicle ( CVehicle* pVeh )
{
// if ( IsVehicleAdded ( pVeh ) )
// return;
// m_VehicleList.push_front ( dynamic_cast < CVehicleSA* > ( pVeh ) );
}


// Apply the handlingdata from another data
void CHandlingEntrySA::ApplyHandlingData ( CHandlingEntry* pData )
Expand All @@ -82,13 +53,6 @@ void CHandlingEntrySA::ApplyHandlingData ( CHandlingEntry* pData )
}


// Remove a vehicle from list
void CHandlingEntrySA::RemoveVehicle ( CVehicle* pVeh )
{
// m_VehicleList.remove ( dynamic_cast < CVehicleSA* > ( pVeh ) );
}


void CHandlingEntrySA::Recalculate ( void )
{
// Real GTA class?
Expand Down
11 changes: 0 additions & 11 deletions MTA10/game_sa/CHandlingEntrySA.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,14 @@ class CHandlingEntrySA : public CHandlingEntry
// Constructor for creatable dummy entries
CHandlingEntrySA ( void );

// Constructor for game linked entries
CHandlingEntrySA ( tHandlingDataSA* pDataSA, tHandlingDataSA* pOriginalUncalculatedData );

// Constructor for original entries
CHandlingEntrySA ( tHandlingDataSA* pOriginal );

virtual ~CHandlingEntrySA ( void );

bool IsVehicleAdded ( CVehicle* pVeh );
// We add a vehicle to this entry
void AddVehicle ( CVehicle* pVeh );

// Use this to copy data from an another handling class to this
void ApplyHandlingData ( CHandlingEntry* pData );

// Remove a vehicle from list
void RemoveVehicle ( CVehicle* pVeh );

// Get functions
float GetMass ( void ) const { return m_Handling.fMass; };
float GetTurnMass ( void ) const { return m_Handling.fTurnMass; };
Expand Down Expand Up @@ -210,7 +200,6 @@ class CHandlingEntrySA : public CHandlingEntry
tHandlingDataSA m_Handling;

tHandlingDataSA* m_pOriginalData;
std::list < CVehicleSA* > m_VehicleList; // Single vehicles to apply data to
};

#endif
193 changes: 0 additions & 193 deletions MTA10/game_sa/CHandlingManagerSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
DWORD CHandlingManagerSA::m_dwStore_LoadHandlingCfg = 0;

tHandlingDataSA CHandlingManagerSA::m_OriginalHandlingData [HT_MAX];
CHandlingEntrySA* CHandlingManagerSA::m_pEntries [HT_MAX];
CHandlingEntrySA* CHandlingManagerSA::m_pOriginalEntries [HT_MAX];
tHandlingDataSA CHandlingManagerSA::m_RealHandlingData [HT_MAX];

// Use the following code to dump handling data unrecalculated on GTA load.
// NB: You need to disable the other hook in the constructor of the manager and uncomment the other
Expand Down Expand Up @@ -108,67 +106,12 @@ __declspec(naked) void Hook_Calculate ( void )
}
}

// Fixme: Does return Vehicledata, I guess
CHandlingEntry* CHandlingManagerSA::GetOriginalHandlingTable ( eHandlingTypes eHandling )
{
tHandlingDataSA* pRet;
// GTA has a function for that
BYTE ucID = (BYTE)eHandling;
__asm
{
mov ecx,ARRAY_HANDLINGDATA
xor eax,eax
mov al,ucID
mov ebx,Func_GetOriginalHandling
push eax
call ebx
mov pRet,eax
}
//return (CHandlingEntry*)pRet;
return m_pEntries[eHandling];
}

// Fixme: Retrives vehicle type specific handlingdata
CHandlingEntry* CHandlingManagerSA::GetPreviousHandlingTable ( eHandlingTypes eHandling )
{
tHandlingDataSA* pRet;
// Well, as above :P
BYTE ucID = (BYTE)eHandling;
__asm
{
mov ecx,ARRAY_HANDLINGDATA
xor eax,eax
mov al,ucID
mov ebx,Func_GetPreviousHandling
push eax
call ebx
mov pRet,eax
}
//return pRet;
return m_pEntries[eHandling-1];
}

float CHandlingManagerSA::GetDragMultiplier ( void )
{
return *(float*)(Var_fTurnMassMultiplier);
}

float CHandlingManagerSA::GetBasicDragCoeff ( void )
{
return *(float*)(Var_fBasicDragCoeff);
}

CHandlingManagerSA::CHandlingManagerSA ( void )
{
// Initialize all default handlings
InitializeDefaultHandlings ();

// Create a handling entry for every handling data.
for ( int i = 0; i < HT_MAX; i++ )
{
m_pEntries [i] = new CHandlingEntrySA ( &m_RealHandlingData [i], &m_OriginalHandlingData[i]);
}

// Create a handling entry for every original handling data.
for ( int i = 0; i < HT_MAX; i++ )
{
Expand All @@ -195,22 +138,6 @@ CHandlingManagerSA::~CHandlingManagerSA ( void )
{
delete m_pOriginalEntries [i];
}

// Destroy all handling entries
for ( int i = 0; i < HT_MAX; i++ )
{
delete m_pEntries [i];
}
}


void CHandlingManagerSA::LoadDefaultHandlings ( void )
{
// Create a handling entry for every handling data
for ( int i = 0; i < HT_MAX; i++ )
{
m_pEntries [i]->Restore ();
}
}


Expand All @@ -220,59 +147,6 @@ CHandlingEntry* CHandlingManagerSA::CreateHandlingData ( void )
}


bool CHandlingManagerSA::ApplyHandlingData ( enum eVehicleTypes eModel, CHandlingEntry* pEntry )
{
// Within range?
if ( eModel >= 400 && eModel < VT_MAX )
{
// Apply the data and return success
m_pEntries [GetHandlingID(eModel)]->ApplyHandlingData ( pEntry );
return true;
}

// Failed
return false;
}


/*bool CHandlingManagerSA::ApplyHandlingData ( CVehicle* pVehicle, CHandlingEntry* pEntry )
{
// Create new handling and apply it
// Those entry have a higher priority than those global ones
//CHandlingEntrySA* pEntrySA = new CHandlingEntrySA;
//pEntrySA->ApplyHandlingData ( pEntry );
pVehicle->SetHandlingData ( pEntry );
}*/

/*bool CHandlingManagerSA::ApplyHandlingData ( CVehicleSA *pVehicle, CHandlingEntry* pEntry )
{

}


void CHandlingManagerSA::RemoveFromVeh ( CVehicle* pVeh )
{
std::list < CHandlingEntrySA* > ::iterator iter = m_HandlingList.begin ();
for ( ; iter != m_HandlingList.end (); iter++ )
{
(*iter)->RemoveFromVeh
}
}*/


CHandlingEntry* CHandlingManagerSA::GetHandlingData ( eVehicleTypes eModel )
{
// Within range?
if ( eModel >= 400 && eModel < VT_MAX )
{
// Return it
return m_pEntries [GetHandlingID(eModel)];
}

return NULL;
}


const CHandlingEntry* CHandlingManagerSA::GetOriginalHandlingData ( eVehicleTypes eModel )
{
// Within range?
Expand Down Expand Up @@ -507,69 +381,6 @@ eHandlingTypes CHandlingManagerSA::GetHandlingID ( eVehicleTypes eModel )
}


void CHandlingManagerSA::LoadHandlingCfg ( void )
{
// This is when GTA loads its default handlings. We do that for GTA so handling.cfg
// is not used anymore.
pGame->GetHandlingManager ()->LoadDefaultHandlings ();

// Lets do some stuff here
// Uncomment code to dump vehicle information
/*FILE *fh = fopen("C:\\yo.txt", "a+");
FILE *hh = fopen("C:\\Programme\\Rockstar Games\\GTA San Andreas\\data\\vehicles.ide", "r");
DWORD n=0;
DWORD j=0;
BYTE fbuff[256][4096];

while (!feof(hh))
{
BYTE ucRead; fread(&ucRead,1,1,hh);
if (ucRead==' ' || ucRead==' ')
continue;
if (ucRead=='\n')
{
fbuff[j][n]=0;
j++;
n=0;
continue;
}
fbuff[j][n]=ucRead;
n++;

}
fbuff[j][n]=0;

for (n=0; n<j; n++)
{
if (fbuff[n][0] == '#' || fbuff[n][0] == 0)
continue;
BYTE *item = (BYTE*)strtok((char*)fbuff[n],",");
if (strncmp((const char*)item,"cars",4)==0 || strncmp((const char*)item,"end",3)==0)
continue;
BYTE act=0;
do
{
// Convert item to uppercase
DWORD j;
for (j=0; j<strlen((const char*)item); j++)
if (islower(item[j])) item[j]=toupper(item[j]);
switch(act)
{
case 1:
fprintf(fh, "case VT_%s:", item);
break;
case 4:
fprintf(fh, " return HT_%s;\n", item);
break;
}
act++;
} while ( item = (BYTE*)strtok( NULL, "," ) );
}
fclose(hh);
fclose(fh);*/
}


__declspec(naked) void CHandlingManagerSA::Hook_LoadHandlingCfg ( void )
{
_asm
Expand All @@ -586,10 +397,6 @@ __declspec(naked) void CHandlingManagerSA::Hook_LoadHandlingCfg ( void )
call eax
};

// Calculate handling.cfg values. We've already initialized them
// like they would come from handling.cfg
LoadHandlingCfg ();

_asm
{
// Restore registers
Expand Down
20 changes: 2 additions & 18 deletions MTA10/game_sa/CHandlingManagerSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,30 @@
#include <game/CHandlingManager.h>
#include "CHandlingEntrySA.h"

class CHandlingManagerSA: public IHandlingManager
class CHandlingManagerSA: public CHandlingManager
{
public:
CHandlingManagerSA ( void );
~CHandlingManagerSA ( void );

void LoadDefaultHandlings ( void );

CHandlingEntry* CreateHandlingData ( void );
bool ApplyHandlingData ( enum eVehicleTypes eModel, CHandlingEntry* pEntry );
void RemoveFromVeh ( CVehicle* pVeh );

CHandlingEntry* GetHandlingData ( eVehicleTypes eModel );
const CHandlingEntry* GetOriginalHandlingData ( eVehicleTypes eModel );
CHandlingEntry* GetOriginalHandlingTable ( eHandlingTypes eHandling );
CHandlingEntry* GetPreviousHandlingTable ( eHandlingTypes eHandling );
float GetDragMultiplier ( void );
float GetBasicDragCoeff ( void );

eHandlingTypes GetHandlingID ( eVehicleTypes eModel );

private:
void InitializeDefaultHandlings ( void );

static DWORD m_dwStore_LoadHandlingCfg;

static void LoadHandlingCfg ( void );
static void Hook_LoadHandlingCfg ( void );

// Original handling data unaffected by handling.cfg changes
static tHandlingDataSA m_OriginalHandlingData [HT_MAX];

// Our wrapper classes for the classes GTA use and the original data
static CHandlingEntrySA* m_pEntries [HT_MAX];
static CHandlingEntrySA* m_pOriginalEntries [HT_MAX];

// These are the entries GTA use
static tHandlingDataSA m_RealHandlingData [HT_MAX];

// Additional entries are saved here
std::list < CHandlingEntrySA* > m_HandlingList;
};

#endif
Loading