summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.travis.yml15
-rw-r--r--src/audio/oal/aldlist.cpp2
-rw-r--r--src/audio/sampman_miles.cpp8
-rw-r--r--src/audio/sampman_oal.cpp8
-rw-r--r--src/control/Script.cpp14
-rw-r--r--src/core/Stats.h18
-rw-r--r--src/core/SurfaceTable.cpp128
-rw-r--r--src/core/SurfaceTable.h43
-rw-r--r--src/core/Timer.h2
-rw-r--r--src/core/World.cpp2
-rw-r--r--src/core/config.h2
-rw-r--r--src/entities/Entity.cpp2
-rw-r--r--src/entities/Physical.cpp105
-rw-r--r--src/entities/Physical.h7
-rw-r--r--src/modelinfo/ModelIndices.cpp6
-rw-r--r--src/modelinfo/ModelIndices.h322
-rw-r--r--src/objects/Object.h9
-rw-r--r--src/peds/Population.cpp20
-rw-r--r--src/render/Timecycle.h2
-rw-r--r--src/vehicles/Boat.cpp2
-rw-r--r--src/vehicles/HandlingMgr.cpp2
-rw-r--r--src/vehicles/HandlingMgr.h6
-rw-r--r--src/vehicles/Vehicle.cpp4
23 files changed, 352 insertions, 377 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..51ef58eb
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: cpp
+os: linux
+dist: focal
+matrix:
+ include:
+ - env: TARGET=release_linux-amd64-librw_gl3_glfw-oal
+ - env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal
+script:
+ - sudo apt-get update
+ - sudo apt-get -y install linux-libc-dev libopenal-dev libglew-dev libglfw3-dev libsndfile1-dev libmpg123-dev gcc-8-multilib g++-8-multilib
+ - mkdir -p "$TRAVIS_BUILD_DIR/build"
+ - cd "$TRAVIS_BUILD_DIR"
+ - ./premake5Linux --with-librw gmake2
+ - cd build
+ - CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1
diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp
index 458b7c80..7401e036 100644
--- a/src/audio/oal/aldlist.cpp
+++ b/src/audio/oal/aldlist.cpp
@@ -73,7 +73,7 @@ ALDeviceList::ALDeviceList()
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
ALDeviceInfo.bSelected = true;
- ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName));
+ ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index a2a206a4..d625ac35 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1445,7 +1445,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
bool
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
@@ -1464,11 +1464,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
slot = nCurrentPedSlot - i - 1;
+#ifdef FIX_BUGS
+ if (slot < 0)
+ slot += ARRAY_SIZE(nPedSlotSfx);
+#endif
if ( nComment == nPedSlotSfx[slot] )
return slot;
}
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index d8d7ac24..ff50ac07 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -809,7 +809,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
- uint8 slot;
+ int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ )
{
@@ -829,11 +829,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
- uint8 slot;
+ int8 slot;
for (int32 i = 0; i < _TODOCONST(3); i++)
{
slot = nCurrentPedSlot - i - 1;
+#ifdef FIX_BUGS
+ if (slot < 0)
+ slot += ARRAY_SIZE(nPedSlotSfx);
+#endif
if (nComment == nPedSlotSfx[slot])
return slot;
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 357436c6..68b396f3 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -759,6 +759,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
case COMMAND_WAIT:
CollectParameters(&m_nIp, 1);
m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0];
+ m_bSkipWakeTime = false;
return 1;
case COMMAND_GOTO:
CollectParameters(&m_nIp, 1);
@@ -2997,9 +2998,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
pCarGen->SwitchOff();
}else if (ScriptParams[1] <= 100){
pCarGen->SwitchOn();
+ pCarGen->SetUsesRemaining(ScriptParams[1]);
}else{
pCarGen->SwitchOn();
- pCarGen->SetUsesRemaining(ScriptParams[1]);
}
return 0;
}
@@ -6862,7 +6863,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
float heading = LimitAngleOnCircle(
RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y)));
float headingTarget = *(float*)&ScriptParams[1];
+#ifdef FIX_BUGS
+ float rotateBy = *(float*)&ScriptParams[2] * CTimer::GetTimeStepFix();
+#else
float rotateBy = *(float*)&ScriptParams[2];
+#endif
if (headingTarget == heading) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@@ -6911,7 +6916,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
assert(pObject);
CVector pos = pObject->GetPosition();
CVector posTarget = *(CVector*)&ScriptParams[1];
+#ifdef FIX_BUGS
+ CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix();
+#else
CVector slideBy = *(CVector*)&ScriptParams[4];
+#endif
if (posTarget == pos) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@@ -8213,7 +8222,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3]));
CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->SetStatus(STATUS_ABANDONED);
- car->bIsLocked = true;
+ car->bIsLocked = false;
car->bIsCarParkVehicle = true;
CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_NONE;
@@ -8687,6 +8696,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
+ CTheScripts::bAlreadyRunningAMissionScript = true;
return 0;
}
case COMMAND_SET_OBJECT_DRAW_LAST:
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 4445ecf4..ae3c0cb4 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -10,7 +10,7 @@ public:
TOTAL_HIGHEST_SCORES = 16
};
static int32 DaysPassed;
- static int32 HeadsPopped;
+ static int32 HeadsPopped;
static int32 CommercialPassed;
static int32 IndustrialPassed;
static int32 SuburbanPassed;
@@ -52,14 +52,14 @@ public:
static int32 LongestFlightInDodo;
static int32 TimeTakenDefuseMission;
static int32 TotalNumberKillFrenzies;
- static int32 TotalNumberMissions;
- static int32 RoundsFiredByPlayer;
- static int32 KgsOfExplosivesUsed;
- static int32 InstantHitsFiredByPlayer;
- static int32 InstantHitsHitByPlayer;
- static int32 BestTimeBombDefusal;
- static int32 mmRain;
- static int32 CarsCrushed;
+ static int32 TotalNumberMissions;
+ static int32 RoundsFiredByPlayer;
+ static int32 KgsOfExplosivesUsed;
+ static int32 InstantHitsFiredByPlayer;
+ static int32 InstantHitsHitByPlayer;
+ static int32 BestTimeBombDefusal;
+ static int32 mmRain;
+ static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp
index 08a84cfd..e4f9c0cd 100644
--- a/src/core/SurfaceTable.cpp
+++ b/src/core/SurfaceTable.cpp
@@ -56,40 +56,40 @@ int
CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
{
switch(surfaceType){
- case SURFACE_0: return ADHESIVE_ROAD;
- case SURFACE_1: return ADHESIVE_ROAD;
- case SURFACE_2: return ADHESIVE_LOOSE;
- case SURFACE_3: return ADHESIVE_LOOSE;
- case SURFACE_4: return ADHESIVE_HARD;
- case SURFACE_5: return ADHESIVE_ROAD;
- case SURFACE_6: return ADHESIVE_HARD;
- case SURFACE_7: return ADHESIVE_HARD;
- case SURFACE_8: return ADHESIVE_HARD;
- case SURFACE_9: return ADHESIVE_HARD;
- case SURFACE_10: return ADHESIVE_HARD;
- case SURFACE_11: return ADHESIVE_HARD;
- case SURFACE_12: return ADHESIVE_HARD;
- case SURFACE_13: return ADHESIVE_HARD;
- case SURFACE_14: return ADHESIVE_HARD;
- case SURFACE_15: return ADHESIVE_HARD;
- case SURFACE_16: return ADHESIVE_HARD;
- case SURFACE_17: return ADHESIVE_RUBBER;
- case SURFACE_18: return ADHESIVE_LOOSE;
- case SURFACE_19: return ADHESIVE_WET;
- case SURFACE_20: return ADHESIVE_ROAD;
- case SURFACE_21: return ADHESIVE_ROAD;
- case SURFACE_22: return ADHESIVE_ROAD;
- case SURFACE_23: return ADHESIVE_RUBBER;
- case SURFACE_24: return ADHESIVE_HARD;
- case SURFACE_25: return ADHESIVE_LOOSE;
- case SURFACE_26: return ADHESIVE_LOOSE;
- case SURFACE_27: return ADHESIVE_HARD;
- case SURFACE_28: return ADHESIVE_HARD;
- case SURFACE_29: return ADHESIVE_RUBBER;
- case SURFACE_30: return ADHESIVE_LOOSE;
- case SURFACE_31: return ADHESIVE_HARD;
- case SURFACE_32: return ADHESIVE_HARD;
- default: return ADHESIVE_ROAD;
+ case SURFACE_DEFAULT: return ADHESIVE_ROAD;
+ case SURFACE_TARMAC: return ADHESIVE_ROAD;
+ case SURFACE_GRASS: return ADHESIVE_LOOSE;
+ case SURFACE_DIRT: return ADHESIVE_LOOSE;
+ case SURFACE_DIRTTRACK: return ADHESIVE_HARD;
+ case SURFACE_PAVEMENT: return ADHESIVE_ROAD;
+ case SURFACE_METAL6: return ADHESIVE_HARD;
+ case SURFACE_GLASS: return ADHESIVE_HARD;
+ case SURFACE_SCAFFOLD: return ADHESIVE_HARD;
+ case SURFACE_METAL_DOOR: return ADHESIVE_HARD;
+ case SURFACE_BILLBOARD: return ADHESIVE_HARD;
+ case SURFACE_STEEL: return ADHESIVE_HARD;
+ case SURFACE_METAL_POLE: return ADHESIVE_HARD;
+ case SURFACE_STREET_LIGHT: return ADHESIVE_HARD;
+ case SURFACE_METAL14: return ADHESIVE_HARD;
+ case SURFACE_METAL15: return ADHESIVE_HARD;
+ case SURFACE_METAL_FENCE: return ADHESIVE_HARD;
+ case SURFACE_FLESH: return ADHESIVE_RUBBER;
+ case SURFACE_SAND: return ADHESIVE_LOOSE;
+ case SURFACE_PUDDLE: return ADHESIVE_WET;
+ case SURFACE_WOOD: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_BOX: return ADHESIVE_ROAD;
+ case SURFACE_WOOD_PLANK: return ADHESIVE_ROAD;
+ case SURFACE_TIRE: return ADHESIVE_RUBBER;
+ case SURFACE_HARD24: return ADHESIVE_HARD;
+ case SURFACE_HEDGE: return ADHESIVE_LOOSE;
+ case SURFACE_STONE: return ADHESIVE_LOOSE;
+ case SURFACE_METAL27: return ADHESIVE_HARD;
+ case SURFACE_METAL28: return ADHESIVE_HARD;
+ case SURFACE_RUBBER29: return ADHESIVE_RUBBER;
+ case SURFACE_LOOSE30: return ADHESIVE_LOOSE;
+ case SURFACE_BOLLARD: return ADHESIVE_HARD;
+ case SURFACE_GATE: return ADHESIVE_HARD;
+ default: return ADHESIVE_ROAD;
}
}
@@ -97,38 +97,38 @@ float
CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
{
switch(surfaceType){
- case SURFACE_0:
- case SURFACE_1:
- case SURFACE_4:
- case SURFACE_5:
- case SURFACE_8:
- case SURFACE_20:
- case SURFACE_21:
- case SURFACE_22:
- case SURFACE_25:
- case SURFACE_30:
- case SURFACE_31:
+ case SURFACE_DEFAULT:
+ case SURFACE_TARMAC:
+ case SURFACE_DIRTTRACK:
+ case SURFACE_PAVEMENT:
+ case SURFACE_SCAFFOLD:
+ case SURFACE_WOOD:
+ case SURFACE_WOOD_BOX:
+ case SURFACE_WOOD_PLANK:
+ case SURFACE_HEDGE:
+ case SURFACE_LOOSE30:
+ case SURFACE_BOLLARD:
return 1.0f - CWeather::WetRoads*0.25f;
- case SURFACE_2:
- case SURFACE_6:
- case SURFACE_7:
- case SURFACE_9:
- case SURFACE_10:
- case SURFACE_11:
- case SURFACE_12:
- case SURFACE_13:
- case SURFACE_14:
- case SURFACE_15:
- case SURFACE_16:
- case SURFACE_17:
- case SURFACE_23:
- case SURFACE_24:
- case SURFACE_26:
- case SURFACE_27:
- case SURFACE_28:
- case SURFACE_29:
- case SURFACE_32:
+ case SURFACE_GRASS:
+ case SURFACE_METAL6:
+ case SURFACE_GLASS:
+ case SURFACE_METAL_DOOR:
+ case SURFACE_BILLBOARD:
+ case SURFACE_STEEL:
+ case SURFACE_METAL_POLE:
+ case SURFACE_STREET_LIGHT:
+ case SURFACE_METAL14:
+ case SURFACE_METAL15:
+ case SURFACE_METAL_FENCE:
+ case SURFACE_FLESH:
+ case SURFACE_TIRE:
+ case SURFACE_HARD24:
+ case SURFACE_STONE:
+ case SURFACE_METAL27:
+ case SURFACE_METAL28:
+ case SURFACE_RUBBER29:
+ case SURFACE_GATE:
return 1.0f - CWeather::WetRoads*0.4f;
default:
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index 12246dce..768521bf 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -1,47 +1,6 @@
#pragma once
-
-enum
-{
- SURFACE_0,
- SURFACE_1,
- SURFACE_2,
- SURFACE_3,
- SURFACE_4,
- SURFACE_5,
- SURFACE_6,
- SURFACE_7,
- SURFACE_8,
- SURFACE_9,
- SURFACE_10,
- SURFACE_11,
- SURFACE_12,
- SURFACE_13,
- SURFACE_14,
- SURFACE_15,
- SURFACE_16,
- SURFACE_17,
- SURFACE_18,
- SURFACE_19,
- SURFACE_20,
- SURFACE_21,
- SURFACE_22,
- SURFACE_23,
- SURFACE_24,
- SURFACE_25,
- SURFACE_26,
- SURFACE_27,
- SURFACE_28,
- SURFACE_29,
- SURFACE_30,
- SURFACE_31,
- SURFACE_32,
-
- NUMSURFACETYPES
-};
-
-// From nick
-// TODO: check and use this
+// TODO: check this
enum eSurfaceType
{
SURFACE_DEFAULT,
diff --git a/src/core/Timer.h b/src/core/Timer.h
index 004cda4d..e7b6fec8 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -58,7 +58,7 @@ public:
friend bool GenericSave(int file);
#ifdef FIX_BUGS
- static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; }
+ static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
#endif
};
diff --git a/src/core/World.cpp b/src/core/World.cpp
index c15c134d..edcfd865 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1823,7 +1823,7 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->GetModelIndex();
- if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
+ if (IsStreetLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
diff --git a/src/core/config.h b/src/core/config.h
index d9f892a6..40882128 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -65,8 +65,6 @@ enum Config {
NUMATTRIBZONES = 288,
NUMZONEINDICES = 55000,
- NUMHANDLINGS = 57,
-
PATHNODESIZE = 4500,
NUMWEATHERS = 4,
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index ec50dd30..a9b6b2b8 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void)
lightOn = true;
break;
case LIGHT_FLICKER_NIGHT:
- if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
+ if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true;
else
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 64358cbf..f9f8ae7e 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -45,9 +45,9 @@ CPhysical::CPhysical(void)
bUsesCollision = true;
m_audioEntityId = -5;
- unk1 = 100.0f;
+ m_phys_unused1 = 100.0f;
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
- field_EC = 0;
+ m_phys_unused2 = 0;
bIsHeavy = false;
bAffectedByGravity = true;
@@ -527,26 +527,26 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
bool ispedcontactA = false;
bool ispedcontactB = false;
- float timestepA;
+ float massFactorA;
if(B->bPedPhysics){
- timestepA = 10.0f;
+ massFactorA = 10.0f;
if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A)
ispedcontactA = true;
}else
- timestepA = A->bIsHeavy ? 2.0f : 1.0f;
+ massFactorA = A->bIsHeavy ? 2.0f : 1.0f;
- float timestepB;
+ float massFactorB;
if(A->bPedPhysics){
if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() &&
(B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall))
- timestepB = 2200.0f / B->m_fMass;
+ massFactorB = 2200.0f / B->m_fMass;
else
- timestepB = 10.0f;
+ massFactorB = 10.0f;
if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B)
ispedcontactB = true;
}else
- timestepB = B->bIsHeavy ? 2.0f : 1.0f;
+ massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB;
if(B->IsStatic()){
@@ -646,14 +646,17 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
// positive if B is moving towards A
// not interested in how much B moves into A apparently?
// only interested in cases where A collided into B
- speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
+ speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
+ float speedSum = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
// A has moved into B
- if(speedA < speedB){
- if(!A->bHasHitWall)
- speedB -= (speedA - speedB) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (speedB-speedA) * A->m_fMass * timestepA;
+ if(speedA < speedSum){
+ if(A->bHasHitWall)
+ eA = speedSum;
+ else
+ eA = speedSum - (speedA - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
+ impulseA = (eA-speedA) * A->m_fMass * massFactorA;
if(!A->bInfiniteMass)
- A->ApplyMoveForce(colpoint.normal*(impulseA/timestepA));
+ A->ApplyMoveForce(colpoint.normal*(impulseA/massFactorA));
return true;
}
}else if(A->bPedPhysics){
@@ -661,9 +664,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
- float a = A->m_fMass*timestepA;
- float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->m_fMass*massFactorA;
+ float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -673,10 +676,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass){
if(fA.z < 0.0f) fA.z = 0.0f;
if(ispedcontactB){
@@ -696,9 +699,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
- float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
- float b = B->m_fMass*timestepB;
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
+ float mB = B->m_fMass*massFactorB;
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -708,10 +711,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass && !ispedcontactA){
if(fA.z < 0.0f) fA.z = 0.0f;
A->ApplyMoveForce(fA);
@@ -736,9 +739,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
CVector pointposB = colpoint.point - B->GetPosition();
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
- float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
- float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
- float speedSum = (b*speedB + a*speedA)/(a + b);
+ float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
+ float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
+ float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){
if(A->bHasHitWall)
eA = speedSum;
@@ -748,10 +751,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum;
else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
- impulseA = (eA - speedA) * a;
- impulseB = -(eB - speedB) * b;
- CVector fA = colpoint.normal*(impulseA/timestepA);
- CVector fB = colpoint.normal*(-impulseB/timestepB);
+ impulseA = (eA - speedA) * mA;
+ impulseB = -(eB - speedB) * mB;
+ CVector fA = colpoint.normal*(impulseA/massFactorA);
+ CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(A->IsVehicle() && !A->bHasHitWall){
fA.x *= 1.4f;
fA.y *= 1.4f;
@@ -767,7 +770,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(B->IsVehicle() && !B->bHasHitWall){
fB.x *= 1.4f;
fB.y *= 1.4f;
- if(colpoint.normal.z < 0.7f)
+ if(-colpoint.normal.z < 0.7f)
fB.z *= 0.3f;
if(B->GetStatus() == STATUS_PLAYER)
pointposB *= 0.8f;
@@ -813,7 +816,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
speed = GetSpeed(pointpos);
normalSpeed = DotProduct(speed, colpoint.normal);
if(normalSpeed < 0.0f){
- float minspeed = 0.0104f * CTimer::GetTimeStep();
+ float minspeed = 1.3f*GRAVITY * CTimer::GetTimeStep();
#ifdef GTA3_1_1_PATCH
if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) &&
#else
@@ -1015,7 +1018,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
if(fOtherSpeed > 0.1f &&
- colpoint.surfaceB != SURFACE_2 && colpoint.surfaceB != SURFACE_4 &&
+ colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_DIRTTRACK &&
CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){
CVector v = frictionDir * fOtherSpeed * 0.25f;
for(int i = 0; i < 4; i++)
@@ -1064,7 +1067,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true;
else
canshift = A->IsPed() &&
- B->IsObject() && B->bInfiniteMass && !Bobj->bHasBeenDamaged;
+ B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged;
if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision ||
@@ -1076,15 +1079,14 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(B->IsBuilding())
skipShift = false;
- else if(IsTrafficLight(A->GetModelIndex()) &&
+ else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f)
skipShift = true;
else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f &&
- IsTrafficLight(B->GetModelIndex()))
+ IsStreetLight(B->GetModelIndex()))
skipShift = true;
-// TODO: maybe flip some ifs here
else if(A->IsObject() && B->IsVehicle()){
CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
@@ -1407,7 +1409,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(B->IsBuilding())
skipCollision = false;
- else if(IsTrafficLight(A->GetModelIndex()) &&
+ else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f){
skipCollision = true;
@@ -1415,7 +1417,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
Aobj->m_pCollidingEntity = B;
}else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f &&
- IsTrafficLight(B->GetModelIndex())){
+ IsStreetLight(B->GetModelIndex())){
skipCollision = true;
A->bSkipLineCol = true;
Bobj->m_pCollidingEntity = A;
@@ -1699,16 +1701,16 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
}
if(B->IsPed() && A->IsVehicle() &&
- (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > 0.0025f))
+ (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > SQR(0.05f)))
Bped->KillPedWithCar((CVehicle*)A, maxImpulseB);
else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() &&
(!Aped->IsPlayer() || A->bHasHitWall))
Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f);
else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){
+ // BUG? not impulseA?
if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Bobj->ObjectDamage(maxImpulseB);
}else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){
- // BUG? not impulseA?
if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Aobj->ObjectDamage(maxImpulseB);
}
@@ -1774,7 +1776,7 @@ CPhysical::ProcessShift(void)
m_bIsVehicleBeingShifted = true;
CEntryInfoNode *node;
- bool hasshifted = false; // whatever that means...
+ bool hasshifted = false;
for(node = m_entryInfoList.first; node; node = node->next)
hasshifted |= ProcessShiftSectorList(node->sector->m_lists);
m_bIsVehicleBeingShifted = false;
@@ -1831,7 +1833,7 @@ CPhysical::ProcessCollision(void)
int8 n = 1; // The number of steps we divide the time step into
float step = 0.0f; // divided time step
- float distSq = GetDistanceSq();
+ float distSq = m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep());
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
if(ped->IsPlayer())
@@ -1920,8 +1922,11 @@ CPhysical::ProcessCollision(void)
bSkipLineCol = false;
if(!m_vecMoveSpeed.IsZero() ||
!m_vecTurnSpeed.IsZero() ||
+#ifdef GTA_TRAIN
bHitByTrain ||
- GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
+#endif
+ GetStatus() == STATUS_PLAYER ||
+ IsPed() && ped->IsPlayer()){
if(IsVehicle())
((CVehicle*)this)->bVehicleColProcessed = true;
if(CheckCollision()){
diff --git a/src/entities/Physical.h b/src/entities/Physical.h
index c84686ed..f8921a5c 100644
--- a/src/entities/Physical.h
+++ b/src/entities/Physical.h
@@ -18,7 +18,7 @@ public:
// The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId;
- float unk1;
+ float m_phys_unused1;
CTreadable *m_treadable[2]; // car and ped
uint32 m_nLastTimeCollided;
CVector m_vecMoveSpeed; // velocity
@@ -37,7 +37,7 @@ public:
CEntryInfoList m_entryInfoList;
CPtrNode *m_movingListNode;
- char field_EC;
+ int8 m_phys_unused2;
uint8 m_nStaticFrames;
uint8 m_nCollisionRecords;
bool m_bIsVehicleBeingShifted;
@@ -86,7 +86,6 @@ public:
void RemoveRefsToEntity(CEntity *ent);
static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos);
- float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); }
// get speed of point p relative to entity center
CVector GetSpeed(const CVector &r);
CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); }
@@ -94,7 +93,7 @@ public:
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass +
1.0f/m_fMass);
}
- float GetMassTime(const CVector &pos, const CVector &dir, float t) {
+ float GetMassTweak(const CVector &pos, const CVector &dir, float t) {
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) +
1.0f/(m_fMass*t));
}
diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp
index 9a6a74d0..056c3733 100644
--- a/src/modelinfo/ModelIndices.cpp
+++ b/src/modelinfo/ModelIndices.cpp
@@ -3,14 +3,14 @@
#include "General.h"
#include "ModelIndices.h"
-#define X(name, var, addr) int16 var;
+#define X(name, var) int16 var;
MODELINDICES
#undef X
void
InitModelIndices(void)
{
-#define X(name, var, addr) var = -1;
+#define X(name, var) var = -1;
MODELINDICES
#undef X
}
@@ -18,7 +18,7 @@ InitModelIndices(void)
void
MatchModelString(const char *modelname, int16 id)
{
-#define X(name, var, addr) \
+#define X(name, var) \
if(!CGeneral::faststrcmp(name, modelname)){ \
var = id; \
return; \
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index cc6ed25c..c0f01929 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -1,164 +1,164 @@
#pragma once
#define MODELINDICES \
- X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \
- X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \
- X("fish01", MI_FISHSTALL01, 0x5F59EC) \
- X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \
- X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \
- X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \
- X("taxisign", MI_TAXISIGN, 0x5F59E8) \
- X("phonesign", MI_PHONESIGN, 0x5F59E4) \
- X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \
- X("bussign1", MI_BUSSIGN1, 0x5F59DC) \
- X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \
- X("dump1", MI_DUMP1, 0x5F59D4) \
- X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \
- X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \
- X("postbox1", MI_POSTBOX1, 0x5F59C8) \
- X("bin1", MI_BIN, 0x5F59C4) \
- X("wastebin", MI_WASTEBIN, 0x5F59C0) \
- X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \
- X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \
- X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \
- X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \
- X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \
- X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \
- X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \
- X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \
- X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \
- X("veg_tree1", MI_TREE1, 0x5F5974) \
- X("veg_tree3", MI_TREE2, 0x5F5978) \
- X("veg_treea1", MI_TREE3, 0x5F597C) \
- X("veg_treenew01", MI_TREE4, 0x5F5980) \
- X("veg_treenew05", MI_TREE5, 0x5F5984) \
- X("veg_treeb1", MI_TREE6, 0x5F5988) \
- X("veg_treenew10", MI_TREE7, 0x5F598C) \
- X("veg_treea3", MI_TREE8, 0x5F5990) \
- X("veg_treenew09", MI_TREE9, 0x5F5994) \
- X("veg_treenew08", MI_TREE10, 0x5F5998) \
- X("veg_treenew03", MI_TREE11, 0x5F599C) \
- X("veg_treenew16", MI_TREE12, 0x5F59A0) \
- X("veg_treenew17", MI_TREE13, 0x5F59A4) \
- X("veg_treenew06", MI_TREE14, 0x5F59A8) \
- X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \
- X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \
- X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \
- X("package1", MI_COLLECTABLE1, 0x5F5A04) \
- X("Money", MI_MONEY, 0x5F5A08) \
- X("barrel1", MI_CARMINE, 0x5F5A0C) \
- X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \
- X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \
- X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \
- X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \
- X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \
- X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \
- X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \
- X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \
- X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \
- X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \
- X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \
- X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \
- X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \
- X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \
- X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \
- X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \
- X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \
- X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \
- X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \
- X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \
- X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \
- X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \
- X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \
- X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \
- X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \
- X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \
- X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \
- X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \
- X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \
- X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \
- X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \
- X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \
- X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \
- X("crushertop", MI_CRUSHERLID, 0x5F5A94) \
- X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \
- X("bullion", MI_BULLION, 0x5F5A9C) \
- X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \
- X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \
- X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \
- X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \
- X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \
- X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \
- X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \
- X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \
- X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \
- X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \
- X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \
- X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \
- X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \
- X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \
- X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \
- X("glassfx1", MI_GLASS1, 0x5F5ADC) \
- X("glassfx2", MI_GLASS2, 0x5F5AE0) \
- X("glassfx3", MI_GLASS3, 0x5F5AE4) \
- X("glassfx4", MI_GLASS4, 0x5F5AE8) \
- X("glassfx55", MI_GLASS5, 0x5F5AEC) \
- X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \
- X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \
- X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \
- X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \
- X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \
- X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \
- X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \
- X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \
- X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \
- X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \
- X("info", MI_PICKUP_INFO, 0x5F5B18) \
- X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \
- X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \
- X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \
- X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \
- X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \
- X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \
- X("magnet", MI_MAGNET, 0x5F5B34) \
- X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \
- X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \
- X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \
- X("bar_barrier10", MI_FENCE, 0x5F5B44) \
- X("bar_barrier12", MI_FENCE2, 0x5F5B48) \
- X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \
- X("bodycast", MI_BODYCAST, 0x5F5B50) \
- X("backdoor", MI_BACKDOOR, 0x5F5B54) \
- X("coffee", MI_COFFEE, 0x5F5B58) \
- X("bouy", MI_BUOY, 0x5F5B5C) \
- X("parktable1", MI_PARKTABLE, 0x5F5B60) \
- X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \
- X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \
- X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \
- X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \
- X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \
- X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \
- X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \
- X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \
- X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \
- X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \
- X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \
- X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \
- X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \
- X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \
- X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \
- X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \
- X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \
- X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \
- X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \
- X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \
- X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \
- X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \
- X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \
- X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \
- X("files", MI_FILES, 0x5F5BC4)
+ X("fire_hydrant", MI_FIRE_HYDRANT) \
+ X("bagelstnd02", MI_BAGELSTAND2) \
+ X("fish01", MI_FISHSTALL01) \
+ X("fishstall02", MI_FISHSTALL02) \
+ X("fishstall03", MI_FISHSTALL03) \
+ X("fishstall04", MI_FISHSTALL04) \
+ X("taxisign", MI_TAXISIGN) \
+ X("phonesign", MI_PHONESIGN) \
+ X("noparkingsign1", MI_NOPARKINGSIGN1) \
+ X("bussign1", MI_BUSSIGN1) \
+ X("roadworkbarrier1", MI_ROADWORKBARRIER1) \
+ X("dump1", MI_DUMP1) \
+ X("trafficcone", MI_TRAFFICCONE) \
+ X("newsstand1", MI_NEWSSTAND) \
+ X("postbox1", MI_POSTBOX1) \
+ X("bin1", MI_BIN) \
+ X("wastebin", MI_WASTEBIN) \
+ X("phonebooth1", MI_PHONEBOOTH1) \
+ X("parkingmeter", MI_PARKINGMETER) \
+ X("trafficlight1", MI_TRAFFICLIGHTS) \
+ X("lamppost1", MI_SINGLESTREETLIGHTS1) \
+ X("lamppost2", MI_SINGLESTREETLIGHTS2) \
+ X("lamppost3", MI_SINGLESTREETLIGHTS3) \
+ X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \
+ X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \
+ X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \
+ X("veg_tree1", MI_TREE1) \
+ X("veg_tree3", MI_TREE2) \
+ X("veg_treea1", MI_TREE3) \
+ X("veg_treenew01", MI_TREE4) \
+ X("veg_treenew05", MI_TREE5) \
+ X("veg_treeb1", MI_TREE6) \
+ X("veg_treenew10", MI_TREE7) \
+ X("veg_treea3", MI_TREE8) \
+ X("veg_treenew09", MI_TREE9) \
+ X("veg_treenew08", MI_TREE10) \
+ X("veg_treenew03", MI_TREE11) \
+ X("veg_treenew16", MI_TREE12) \
+ X("veg_treenew17", MI_TREE13) \
+ X("veg_treenew06", MI_TREE14) \
+ X("doc_crane_cab", MODELID_CRANE_1) \
+ X("cranetopb", MODELID_CRANE_2) \
+ X("cranetopa", MODELID_CRANE_3) \
+ X("package1", MI_COLLECTABLE1) \
+ X("Money", MI_MONEY) \
+ X("barrel1", MI_CARMINE) \
+ X("oddjgaragdoor", MI_GARAGEDOOR1) \
+ X("bombdoor", MI_GARAGEDOOR2) \
+ X("door_bombshop", MI_GARAGEDOOR3) \
+ X("vheistlocdoor", MI_GARAGEDOOR4) \
+ X("door2_garage", MI_GARAGEDOOR5) \
+ X("ind_slidedoor", MI_GARAGEDOOR6) \
+ X("bankjobdoor", MI_GARAGEDOOR7) \
+ X("door_jmsgrage", MI_GARAGEDOOR9) \
+ X("jamesgrge_kb", MI_GARAGEDOOR10) \
+ X("door_sfehousegrge", MI_GARAGEDOOR11) \
+ X("shedgaragedoor", MI_GARAGEDOOR12) \
+ X("door4_garage", MI_GARAGEDOOR13) \
+ X("door_col_compnd_01", MI_GARAGEDOOR14) \
+ X("door_col_compnd_02", MI_GARAGEDOOR15) \
+ X("door_col_compnd_03", MI_GARAGEDOOR16) \
+ X("door_col_compnd_04", MI_GARAGEDOOR17) \
+ X("door_col_compnd_05", MI_GARAGEDOOR18) \
+ X("impex_door", MI_GARAGEDOOR19) \
+ X("SalvGarage", MI_GARAGEDOOR20) \
+ X("door3_garage", MI_GARAGEDOOR21) \
+ X("leveldoor2", MI_GARAGEDOOR22) \
+ X("double_garage_dr", MI_GARAGEDOOR23) \
+ X("amcogaragedoor", MI_GARAGEDOOR24) \
+ X("towergaragedoor1", MI_GARAGEDOOR25) \
+ X("towergaragedoor2", MI_GARAGEDOOR26) \
+ X("towergaragedoor3", MI_GARAGEDOOR27) \
+ X("plysve_gragedoor", MI_GARAGEDOOR28) \
+ X("impexpsubgrgdoor", MI_GARAGEDOOR29) \
+ X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \
+ X("ind_plyrwoor", MI_GARAGEDOOR31) \
+ X("8ballsuburbandoor", MI_GARAGEDOOR32) \
+ X("barrel2", MI_NAUTICALMINE) \
+ X("crushercrush", MI_CRUSHERBODY) \
+ X("crushertop", MI_CRUSHERLID) \
+ X("donkeymag", MI_DONKEYMAG) \
+ X("bullion", MI_BULLION) \
+ X("floatpackge1", MI_FLOATPACKAGE1) \
+ X("briefcase", MI_BRIEFCASE) \
+ X("chinabanner1", MI_CHINABANNER1) \
+ X("chinabanner2", MI_CHINABANNER2) \
+ X("chinabanner3", MI_CHINABANNER3) \
+ X("chinabanner4", MI_CHINABANNER4) \
+ X("iten_chinatown5", MI_CHINABANNER5) \
+ X("iten_chinatown7", MI_CHINABANNER6) \
+ X("iten_chinatown3", MI_CHINABANNER7) \
+ X("iten_chinatown2", MI_CHINABANNER8) \
+ X("iten_chinatown4", MI_CHINABANNER9) \
+ X("iten_washline01", MI_CHINABANNER10) \
+ X("iten_washline02", MI_CHINABANNER11) \
+ X("iten_washline03", MI_CHINABANNER12) \
+ X("chinalanterns", MI_CHINALANTERN) \
+ X("glassfx1", MI_GLASS1) \
+ X("glassfx2", MI_GLASS2) \
+ X("glassfx3", MI_GLASS3) \
+ X("glassfx4", MI_GLASS4) \
+ X("glassfx55", MI_GLASS5) \
+ X("glassfxsub1", MI_GLASS6) \
+ X("glassfxsub2", MI_GLASS7) \
+ X("glassfx_composh", MI_GLASS8) \
+ X("bridge_liftsec", MI_BRIDGELIFT) \
+ X("bridge_liftweight", MI_BRIDGEWEIGHT) \
+ X("subbridge_lift", MI_BRIDGEROADSEGMENT) \
+ X("barrel4", MI_EXPLODINGBARREL) \
+ X("flagsitaly", MI_ITALYBANNER1) \
+ X("adrenaline", MI_PICKUP_ADRENALINE) \
+ X("bodyarmour", MI_PICKUP_BODYARMOUR) \
+ X("info", MI_PICKUP_INFO) \
+ X("health", MI_PICKUP_HEALTH) \
+ X("bonus", MI_PICKUP_BONUS) \
+ X("bribe", MI_PICKUP_BRIBE) \
+ X("killfrenzy", MI_PICKUP_KILLFRENZY) \
+ X("camerapickup", MI_PICKUP_CAMERA) \
+ X("bollardlight", MI_BOLLARDLIGHT) \
+ X("magnet", MI_MAGNET) \
+ X("streetlamp1", MI_STREETLAMP1) \
+ X("streetlamp2", MI_STREETLAMP2) \
+ X("railtrax_lo4b", MI_RAILTRACKS) \
+ X("bar_barrier10", MI_FENCE) \
+ X("bar_barrier12", MI_FENCE2) \
+ X("petrolpump", MI_PETROLPUMP) \
+ X("bodycast", MI_BODYCAST) \
+ X("backdoor", MI_BACKDOOR) \
+ X("coffee", MI_COFFEE) \
+ X("bouy", MI_BUOY) \
+ X("parktable1", MI_PARKTABLE) \
+ X("sbwy_tunl_start", MI_SUBWAY1) \
+ X("sbwy_tunl_bit", MI_SUBWAY2) \
+ X("sbwy_tunl_bend", MI_SUBWAY3) \
+ X("sbwy_tunl_cstm6", MI_SUBWAY4) \
+ X("sbwy_tunl_cstm7", MI_SUBWAY5) \
+ X("sbwy_tunl_cstm8", MI_SUBWAY6) \
+ X("sbwy_tunl_cstm10", MI_SUBWAY7) \
+ X("sbwy_tunl_cstm9", MI_SUBWAY8) \
+ X("sbwy_tunl_cstm11", MI_SUBWAY9) \
+ X("sbwy_tunl_cstm1", MI_SUBWAY10) \
+ X("sbwy_tunl_cstm2", MI_SUBWAY11) \
+ X("sbwy_tunl_cstm4", MI_SUBWAY12) \
+ X("sbwy_tunl_cstm3", MI_SUBWAY13) \
+ X("sbwy_tunl_cstm5", MI_SUBWAY14) \
+ X("subplatform_n2", MI_SUBWAY15) \
+ X("suby_tunl_start", MI_SUBWAY16) \
+ X("sbwy_tunl_start2", MI_SUBWAY17) \
+ X("indy_tunl_start", MI_SUBWAY18) \
+ X("indsubway03", MI_SUBPLATFORM_IND) \
+ X("comerside_subway", MI_SUBPLATFORM_COMS) \
+ X("subplatform", MI_SUBPLATFORM_COMS2) \
+ X("subplatform_n", MI_SUBPLATFORM_COMN) \
+ X("Otherside_subway", MI_SUBPLATFORM_SUB) \
+ X("subplatform_sub", MI_SUBPLATFORM_SUB2) \
+ X("files", MI_FILES)
-#define X(name, var, addr) extern int16 var;
+#define X(name, var) extern int16 var;
MODELINDICES
#undef X
@@ -255,7 +255,9 @@ enum
MI_BUSKER4,
// three more peds possible
- MI_FIRST_VEHICLE = 90,
+ MI_LAST_PED = 89,
+ MI_FIRST_VEHICLE,
+
MI_LANDSTAL = MI_FIRST_VEHICLE,
MI_IDAHO,
MI_STINGER,
@@ -382,7 +384,7 @@ IsGlass(int16 id)
}
inline bool
-IsTrafficLight(int16 id)
+IsStreetLight(int16 id)
{
return id == MI_TRAFFICLIGHTS ||
id == MI_SINGLESTREETLIGHTS1 ||
@@ -410,7 +412,7 @@ IsBoatModel(int16 id)
inline bool
IsPedModel(int16 id)
{
- return id >= 0 && id <= 89;
+ return id >= MI_PLAYER && id <= MI_LAST_PED;
}
inline bool
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 79589dc9..c9a1bba8 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -55,14 +55,7 @@ public:
uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject;
-
- // this batch is unused
- int8 field_17B;
- int8 field_17C;
- int8 field_17D;
- int8 field_17E;
- int8 field_17F;
-
+ uint32 m_obj_unused1;
uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex;
CEntity *m_pCurSurface;
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 1566ba3d..e2257a28 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (!obj)
return;
- bool makeInvisible;
CWorld::Remove(dummy);
delete dummy;
CWorld::Add(obj);
- int16 mi = obj->GetModelIndex();
- if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
- mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
- makeInvisible = true;
- else
- makeInvisible = false;
- if (makeInvisible) {
+ if (IsGlass(obj->GetModelIndex())) {
obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false;
@@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj)
dummy->GetMatrix().UpdateRW();
dummy->UpdateRwFrame();
- bool makeInvisible;
- int16 mi = obj->GetModelIndex();
- if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
- mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
- makeInvisible = true;
- else
- makeInvisible = false;
-
- if (makeInvisible) {
+ if (IsGlass(obj->GetModelIndex()))
dummy->bIsVisible = false;
- }
CWorld::Remove(obj);
delete obj;
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index 28a0b7dd..9af4df49 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -122,7 +122,7 @@ public:
static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
- static int GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
+ static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
static float GetFarClip(void) { return m_fCurrentFarClip; }
static float GetFogStart(void) { return m_fCurrentFogStart; }
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 72fca542..0ed7876a 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -79,7 +79,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
bIsInWater = true;
- unk1 = 0.0f;
+ m_phys_unused1 = 0.0f;
m_bIsAnchored = true;
m_fOrientation = INVALID_ORIENTATION;
bTouchingWater = true;
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 3ac0da38..5beed29e 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -78,7 +78,7 @@ cHandlingDataMgr::Initialise(void)
{
LoadHandlingData();
field_0 = 0.1f;
- field_4 = 0.9f;
+ fWheelFriction = 0.9f;
field_8 = 1.0f;
field_C = 0.8f;
field_10 = 0.98f;
diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h
index 398a415f..10e25573 100644
--- a/src/vehicles/HandlingMgr.h
+++ b/src/vehicles/HandlingMgr.h
@@ -60,7 +60,9 @@ enum eHandlingId
HANDLING_PANLANT,
HANDLING_FLATBED,
HANDLING_YANKEE,
- HANDLING_BORGNINE
+ HANDLING_BORGNINE,
+
+ NUMHANDLINGS
};
enum
@@ -120,7 +122,7 @@ class cHandlingDataMgr
{
float field_0; // unused it seems
public:
- float field_4; // wheel related
+ float fWheelFriction; // wheel related
private:
float field_8; //
float field_C; // unused it seems
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 6646f7f3..0dd95faf 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -521,9 +521,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
if(!bBraking){
if(m_fGasPedal < 0.01f){
if(GetModelIndex() == MI_RCBANDIT)
- brake = 0.2f * mod_HandlingManager.field_4 / m_fMass;
+ brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass;
else
- brake = mod_HandlingManager.field_4 / m_fMass;
+ brake = mod_HandlingManager.fWheelFriction / m_fMass;
#ifdef FIX_BUGS
brake *= CTimer::GetTimeStepFix();
#endif