mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 20:10:00 +00:00
CAutomobile effect stuff
This commit is contained in:
parent
0c447c70e4
commit
e200eb1a2f
|
@ -150,6 +150,18 @@ FixCar(void)
|
||||||
((CAutomobile*)veh)->Fix();
|
((CAutomobile*)veh)->Fix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int engineStatus;
|
||||||
|
static void
|
||||||
|
SetEngineStatus(void)
|
||||||
|
{
|
||||||
|
CVehicle *veh = FindPlayerVehicle();
|
||||||
|
if(veh == nil)
|
||||||
|
return;
|
||||||
|
if(!veh->IsCar())
|
||||||
|
return;
|
||||||
|
((CAutomobile*)veh)->Damage.SetEngineStatus(engineStatus);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ToggleComedy(void)
|
ToggleComedy(void)
|
||||||
{
|
{
|
||||||
|
@ -300,7 +312,8 @@ DebugMenuPopulate(void)
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
||||||
|
|
||||||
|
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
|
||||||
|
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
|
||||||
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
||||||
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
||||||
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
||||||
|
|
|
@ -79,7 +79,7 @@ RwObjectNameIdAssocation boatIds[] = {
|
||||||
{ "boat_moving_hi", 1, VEHICLE_FLAG_COLLAPSE },
|
{ "boat_moving_hi", 1, VEHICLE_FLAG_COLLAPSE },
|
||||||
{ "boat_rudder_hi", 3, VEHICLE_FLAG_COLLAPSE },
|
{ "boat_rudder_hi", 3, VEHICLE_FLAG_COLLAPSE },
|
||||||
{ "windscreen", 2, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
|
{ "windscreen", 2, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
|
||||||
{ "ped_frontseat", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
|
{ "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
|
||||||
{ nil, 0, 0 }
|
{ nil, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,6 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VEHICLE_DUMMY_BOAT_RUDDER = 0,
|
|
||||||
VEHICLE_DUMMY_FRONT_SEATS = 2,
|
|
||||||
VEHICLE_DUMMY_REAR_SEATS = 3,
|
|
||||||
NUM_VEHICLE_POSITIONS = 10
|
NUM_VEHICLE_POSITIONS = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1456,8 +1456,8 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
|
||||||
ped->m_ped_flagI4 = false;
|
ped->m_ped_flagI4 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
CVector
|
||||||
CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult)
|
CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatPosMult)
|
||||||
{
|
{
|
||||||
CVehicleModelInfo *vehModel;
|
CVehicleModelInfo *vehModel;
|
||||||
CVector vehDoorPos;
|
CVector vehDoorPos;
|
||||||
|
@ -1465,7 +1465,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enter
|
||||||
float seatOffset;
|
float seatOffset;
|
||||||
|
|
||||||
vehModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(veh->m_modelIndex);
|
vehModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(veh->m_modelIndex);
|
||||||
if (veh->bIsVan && (enterType == CAR_DOOR_LR || enterType == CAR_DOOR_RR)) {
|
if (veh->bIsVan && (component == CAR_DOOR_LR || component == CAR_DOOR_RR)) {
|
||||||
seatOffset = 0.0f;
|
seatOffset = 0.0f;
|
||||||
vehDoorOffset = offsetToOpenVanDoor;
|
vehDoorOffset = offsetToOpenVanDoor;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1477,63 +1477,63 @@ CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (enterType) {
|
switch (component) {
|
||||||
case CAR_DOOR_RF:
|
case CAR_DOOR_RF:
|
||||||
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
|
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
|
||||||
else
|
else
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
|
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
|
||||||
|
|
||||||
vehDoorPos.x += seatOffset;
|
vehDoorPos.x += seatOffset;
|
||||||
vehDoorOffset.x = -vehDoorOffset.x;
|
vehDoorOffset.x = -vehDoorOffset.x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAR_DOOR_RR:
|
case CAR_DOOR_RR:
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_REAR_SEATS];
|
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
|
||||||
vehDoorPos.x += seatOffset;
|
vehDoorPos.x += seatOffset;
|
||||||
vehDoorOffset.x = -vehDoorOffset.x;
|
vehDoorOffset.x = -vehDoorOffset.x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAR_DOOR_LF:
|
case CAR_DOOR_LF:
|
||||||
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
|
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
|
||||||
else
|
else
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
|
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
|
||||||
|
|
||||||
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
|
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAR_DOOR_LR:
|
case CAR_DOOR_LR:
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_REAR_SEATS];
|
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
|
||||||
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
|
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
|
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
|
||||||
else
|
else
|
||||||
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
|
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
|
||||||
|
|
||||||
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
|
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
*output = vehDoorPos - vehDoorOffset;
|
return vehDoorPos - vehDoorOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function was mostly duplicate of GetLocalPositionToOpenCarDoor, so I've used it.
|
// This function was mostly duplicate of GetLocalPositionToOpenCarDoor, so I've used it.
|
||||||
void
|
CVector
|
||||||
CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType)
|
CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component)
|
||||||
{
|
{
|
||||||
CVector localPos;
|
CVector localPos;
|
||||||
CVector vehDoorPos;
|
CVector vehDoorPos;
|
||||||
|
|
||||||
GetLocalPositionToOpenCarDoor(&localPos, veh, enterType, 1.0f);
|
localPos = GetLocalPositionToOpenCarDoor(veh, component, 1.0f);
|
||||||
vehDoorPos = Multiply3x3(veh->GetMatrix(), localPos) + veh->GetPosition();
|
vehDoorPos = Multiply3x3(veh->GetMatrix(), localPos) + veh->GetPosition();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Not used.
|
// Not used.
|
||||||
CVector localVehDoorOffset;
|
CVector localVehDoorOffset;
|
||||||
|
|
||||||
if (veh->bIsVan && (enterType == VEHICLE_ENTER_REAR_LEFT || enterType == VEHICLE_ENTER_REAR_RIGHT)) {
|
if (veh->bIsVan && (component == VEHICLE_ENTER_REAR_LEFT || component == VEHICLE_ENTER_REAR_RIGHT)) {
|
||||||
localVehDoorOffset = offsetToOpenVanDoor;
|
localVehDoorOffset = offsetToOpenVanDoor;
|
||||||
} else {
|
} else {
|
||||||
if (veh->bIsLow) {
|
if (veh->bIsLow) {
|
||||||
|
@ -1545,19 +1545,18 @@ CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType)
|
||||||
|
|
||||||
vehDoorPosWithoutOffset = Multiply3x3(veh->GetMatrix(), localPos + localVehDoorOffset) + veh->GetPosition();
|
vehDoorPosWithoutOffset = Multiply3x3(veh->GetMatrix(), localPos + localVehDoorOffset) + veh->GetPosition();
|
||||||
*/
|
*/
|
||||||
*output = vehDoorPos;
|
return vehDoorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
CVector
|
||||||
CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset)
|
CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset)
|
||||||
{
|
{
|
||||||
CVector doorPos;
|
CVector doorPos;
|
||||||
CMatrix vehMat(veh->GetMatrix());
|
CMatrix vehMat(veh->GetMatrix());
|
||||||
|
|
||||||
GetLocalPositionToOpenCarDoor(output, veh, enterType, offset);
|
doorPos = Multiply3x3(vehMat, GetLocalPositionToOpenCarDoor(veh, component, offset));
|
||||||
doorPos = Multiply3x3(vehMat, *output);
|
|
||||||
|
|
||||||
*output = veh->GetPosition() + doorPos;
|
return veh->GetPosition() + doorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1678,7 +1677,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
||||||
if (phase == LINE_UP_TO_CAR_2) {
|
if (phase == LINE_UP_TO_CAR_2) {
|
||||||
neededPos = GetPosition();
|
neededPos = GetPosition();
|
||||||
} else {
|
} else {
|
||||||
GetPositionToOpenCarDoor(&neededPos, veh, m_vehEnterType, seatPosMult);
|
neededPos = GetPositionToOpenCarDoor(veh, m_vehEnterType, seatPosMult);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVector autoZPos = neededPos;
|
CVector autoZPos = neededPos;
|
||||||
|
@ -1776,11 +1775,9 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
||||||
// It will be all 0 after rotate.
|
// It will be all 0 after rotate.
|
||||||
GetPosition() = neededPos;
|
GetPosition() = neededPos;
|
||||||
} else {
|
} else {
|
||||||
CVector output;
|
|
||||||
CMatrix vehDoorMat(veh->GetMatrix());
|
CMatrix vehDoorMat(veh->GetMatrix());
|
||||||
|
|
||||||
GetLocalPositionToOpenCarDoor(&output, veh, m_vehEnterType, 0.0f);
|
vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehEnterType, 0.0f));
|
||||||
vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, output);
|
|
||||||
GetMatrix() = vehDoorMat;
|
GetMatrix() = vehDoorMat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4822,8 +4819,8 @@ STARTPATCHES
|
||||||
InjectHook(0x4CF000, &CPed::PedSetDraggedOutCarCB, PATCH_JUMP);
|
InjectHook(0x4CF000, &CPed::PedSetDraggedOutCarCB, PATCH_JUMP);
|
||||||
InjectHook(0x4C5D80, &CPed::RestartNonPartialAnims, PATCH_JUMP);
|
InjectHook(0x4C5D80, &CPed::RestartNonPartialAnims, PATCH_JUMP);
|
||||||
InjectHook(0x4E4730, &CPed::GetLocalPositionToOpenCarDoor, PATCH_JUMP);
|
InjectHook(0x4E4730, &CPed::GetLocalPositionToOpenCarDoor, PATCH_JUMP);
|
||||||
InjectHook(0x4E4660, (void (*)(CVector*, CVehicle*, uint32, float)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
|
InjectHook(0x4E4660, (CVector (*)(CVehicle*, uint32, float)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
|
||||||
InjectHook(0x4E1A30, (void (*)(CVector*, CVehicle*, uint32)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
|
InjectHook(0x4E1A30, (CVector (*)(CVehicle*, uint32)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
|
||||||
InjectHook(0x4DF940, &CPed::LineUpPedWithCar, PATCH_JUMP);
|
InjectHook(0x4DF940, &CPed::LineUpPedWithCar, PATCH_JUMP);
|
||||||
InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP);
|
InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP);
|
||||||
InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP);
|
InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP);
|
||||||
|
|
|
@ -558,9 +558,9 @@ public:
|
||||||
void SetFall(int, AnimationId, uint8);
|
void SetFall(int, AnimationId, uint8);
|
||||||
|
|
||||||
// Static methods
|
// Static methods
|
||||||
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
||||||
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
|
static CVector GetPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatPosMult);
|
||||||
static void GetPositionToOpenCarDoor(CVector* output, CVehicle* veh, uint32 enterType);
|
static CVector GetPositionToOpenCarDoor(CVehicle* veh, uint32 component);
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
|
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "Floater.h"
|
#include "Floater.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
|
#include "Weather.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
#include "Record.h"
|
#include "Record.h"
|
||||||
#include "Remote.h"
|
#include "Remote.h"
|
||||||
|
@ -2466,6 +2467,110 @@ CAutomobile::dmgDrawCarCollidingParticles(const CVector &pos, float amount)
|
||||||
CGeneral::GetRandomNumberInRange(0.0f, 4.0f));
|
CGeneral::GetRandomNumberInRange(0.0f, 4.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::AddDamagedVehicleParticles(void)
|
||||||
|
{
|
||||||
|
if(this == FindPlayerVehicle() && TheCamera.GetLookingForwardFirstPerson())
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8 engineStatus = Damage.GetEngineStatus();
|
||||||
|
if(engineStatus < ENGINE_STATUS_STEAM1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward()) * 180.0f;
|
||||||
|
CVector direction = 0.5f*m_vecMoveSpeed;
|
||||||
|
CVector damagePos = ((CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()))->m_positions[CAR_POS_HEADLIGHTS];
|
||||||
|
|
||||||
|
switch(Damage.GetDoorStatus(DOOR_BONNET)){
|
||||||
|
case DOOR_STATUS_OK:
|
||||||
|
case DOOR_STATUS_SMASHED:
|
||||||
|
// Bonnet is still there, smoke comes out at the edge
|
||||||
|
damagePos += vecDAMAGE_ENGINE_POS_SMALL;
|
||||||
|
break;
|
||||||
|
case DOOR_STATUS_SWINGING:
|
||||||
|
case DOOR_STATUS_MISSING:
|
||||||
|
// Bonnet is gone, smoke comes out at the engine
|
||||||
|
damagePos += vecDAMAGE_ENGINE_POS_BIG;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GetModelIndex() == MI_BFINJECT)
|
||||||
|
damagePos = CVector(0.3f, -1.5f, -0.1f);
|
||||||
|
|
||||||
|
damagePos = GetMatrix()*damagePos;
|
||||||
|
damagePos.z += 0.15f;
|
||||||
|
|
||||||
|
if(engineStatus < ENGINE_STATUS_STEAM2){
|
||||||
|
if(fwdSpeed < 90.0f){
|
||||||
|
direction.z += 0.05f;
|
||||||
|
CParticle::AddParticle(PARTICLE_ENGINE_STEAM, damagePos, direction, nil, 0.1f);
|
||||||
|
}
|
||||||
|
}else if(engineStatus < ENGINE_STATUS_SMOKE){
|
||||||
|
if(fwdSpeed < 90.0f)
|
||||||
|
CParticle::AddParticle(PARTICLE_ENGINE_STEAM, damagePos, direction, nil, 0.0f);
|
||||||
|
}else if(engineStatus < ENGINE_STATUS_ON_FIRE){
|
||||||
|
if(fwdSpeed < 90.0f){
|
||||||
|
CParticle::AddParticle(PARTICLE_ENGINE_STEAM, damagePos, direction, nil, 0.0f);
|
||||||
|
CParticle::AddParticle(PARTICLE_ENGINE_SMOKE, damagePos, 0.3f*direction, nil, 0.0f);
|
||||||
|
}
|
||||||
|
}else if(m_fHealth > 250.0f){
|
||||||
|
if(fwdSpeed < 90.0f)
|
||||||
|
CParticle::AddParticle(PARTICLE_ENGINE_SMOKE2, damagePos, 0.2f*direction, nil, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CVector dir;
|
||||||
|
static RwRGBA grassCol = { 8, 24, 8, 255 };
|
||||||
|
static RwRGBA dirtCol = { 64, 64, 64, 255 };
|
||||||
|
static RwRGBA dirttrackCol = { 64, 32, 16, 255 };
|
||||||
|
static RwRGBA waterCol = { 48, 48, 64, 0 };
|
||||||
|
|
||||||
|
if(!belowEffectSpeed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(colpoint->surfaceB){
|
||||||
|
case SURFACE_GRASS:
|
||||||
|
dir.x = -0.05f*m_vecMoveSpeed.x;
|
||||||
|
dir.y = -0.05f*m_vecMoveSpeed.y;
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
|
||||||
|
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
|
||||||
|
CGeneral::GetRandomNumberInRange(0.02f, 0.1f), grassCol);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SURFACE_DIRT:
|
||||||
|
dir.x = -0.05f*m_vecMoveSpeed.x;
|
||||||
|
dir.y = -0.05f*m_vecMoveSpeed.y;
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
|
||||||
|
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
|
||||||
|
CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirtCol);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SURFACE_DIRTTRACK:
|
||||||
|
dir.x = -0.05f*m_vecMoveSpeed.x;
|
||||||
|
dir.y = -0.05f*m_vecMoveSpeed.y;
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
|
||||||
|
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
|
||||||
|
CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirttrackCol);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Is this even visible?
|
||||||
|
if(CWeather::WetRoads > 0.01f && CTimer::GetFrameCounter() & 1)
|
||||||
|
CParticle::AddParticle(PARTICLE_WATERSPRAY,
|
||||||
|
colpoint->point + CVector(0.0f, 0.0f, 0.25f+0.25f),
|
||||||
|
CVector(0.0f, 0.0f, 1.0f), nil,
|
||||||
|
CGeneral::GetRandomNumberInRange(0.1f, 0.5f), waterCol);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CAutomobile::GetComponentWorldPosition(int32 component, CVector &pos)
|
CAutomobile::GetComponentWorldPosition(int32 component, CVector &pos)
|
||||||
{
|
{
|
||||||
|
@ -2824,7 +2929,64 @@ CAutomobile::BurstTyre(uint8 wheel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER bool CAutomobile::IsRoomForPedToLeaveCar(uint32, CVector *) { EAXJMP(0x53C5B0); }
|
bool
|
||||||
|
CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos)
|
||||||
|
{
|
||||||
|
CColPoint colpoint;
|
||||||
|
CEntity *ent;
|
||||||
|
colpoint.point = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
||||||
|
|
||||||
|
CVector seatPos;
|
||||||
|
switch(component){
|
||||||
|
case CAR_DOOR_RF:
|
||||||
|
seatPos = mi->m_positions[IsBoat() ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
|
||||||
|
break;
|
||||||
|
case CAR_DOOR_LF:
|
||||||
|
seatPos = mi->m_positions[IsBoat() ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
|
||||||
|
seatPos.x = -seatPos.x;
|
||||||
|
break;
|
||||||
|
case CAR_DOOR_RR:
|
||||||
|
seatPos = mi->m_positions[CAR_POS_BACKSEAT];
|
||||||
|
break;
|
||||||
|
case CAR_DOOR_LR:
|
||||||
|
seatPos = mi->m_positions[CAR_POS_BACKSEAT];
|
||||||
|
seatPos.x = -seatPos.x;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
seatPos = GetMatrix() * seatPos;
|
||||||
|
|
||||||
|
CVector doorPos = CPed::GetPositionToOpenCarDoor(this, component);
|
||||||
|
if(forcedDoorPos){
|
||||||
|
doorPos = *forcedDoorPos;
|
||||||
|
if(component == CAR_DOOR_RF || component == CAR_DOOR_RR)
|
||||||
|
doorPos.x = -doorPos.x;
|
||||||
|
doorPos = Multiply3x3(GetMatrix(), doorPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GetUp().z < 0.0f){
|
||||||
|
seatPos.z += 0.5f;
|
||||||
|
doorPos.z += 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector dist = doorPos - seatPos;
|
||||||
|
float length = dist.Magnitude();
|
||||||
|
CVector pedPos = seatPos + dist*((length+0.6f)/length);
|
||||||
|
|
||||||
|
if(!CWorld::GetIsLineOfSightClear(seatPos, pedPos, true, false, false, true, false, false))
|
||||||
|
return false;
|
||||||
|
if(CWorld::TestSphereAgainstWorld(doorPos, 0.6f, this, true, true, false, true, false, false))
|
||||||
|
return false;
|
||||||
|
if(CWorld::ProcessVerticalLine(doorPos, 1000.0f, colpoint, ent, true, false, false, true, false, false, nil))
|
||||||
|
if(colpoint.point.z > doorPos.z && colpoint.point.z < doorPos.z + 0.6f)
|
||||||
|
return false;
|
||||||
|
float upperZ = colpoint.point.z;
|
||||||
|
if(!CWorld::ProcessVerticalLine(doorPos, -1000.0f, colpoint, ent, true, false, false, true, false, false, nil))
|
||||||
|
return false;
|
||||||
|
if(upperZ != 0.0f && upperZ < colpoint.point.z)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
CAutomobile::GetHeightAboveRoad(void)
|
CAutomobile::GetHeightAboveRoad(void)
|
||||||
|
@ -3452,10 +3614,13 @@ STARTPATCHES
|
||||||
InjectHook(0x53BC60, &CAutomobile_::BlowUpCar_, PATCH_JUMP);
|
InjectHook(0x53BC60, &CAutomobile_::BlowUpCar_, PATCH_JUMP);
|
||||||
InjectHook(0x53BF70, &CAutomobile_::SetUpWheelColModel_, PATCH_JUMP);
|
InjectHook(0x53BF70, &CAutomobile_::SetUpWheelColModel_, PATCH_JUMP);
|
||||||
InjectHook(0x53C0E0, &CAutomobile_::BurstTyre_, PATCH_JUMP);
|
InjectHook(0x53C0E0, &CAutomobile_::BurstTyre_, PATCH_JUMP);
|
||||||
|
InjectHook(0x53C5B0, &CAutomobile_::IsRoomForPedToLeaveCar_, PATCH_JUMP);
|
||||||
InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP);
|
InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP);
|
||||||
InjectHook(0x53C450, &CAutomobile_::PlayCarHorn_, PATCH_JUMP);
|
InjectHook(0x53C450, &CAutomobile_::PlayCarHorn_, PATCH_JUMP);
|
||||||
InjectHook(0x53E090, &CAutomobile::PlaceOnRoadProperly, PATCH_JUMP);
|
InjectHook(0x53E090, &CAutomobile::PlaceOnRoadProperly, PATCH_JUMP);
|
||||||
InjectHook(0x52F030, &CAutomobile::dmgDrawCarCollidingParticles, PATCH_JUMP);
|
InjectHook(0x52F030, &CAutomobile::dmgDrawCarCollidingParticles, PATCH_JUMP);
|
||||||
|
InjectHook(0x535450, &CAutomobile::AddDamagedVehicleParticles, PATCH_JUMP);
|
||||||
|
InjectHook(0x5357D0, &CAutomobile::AddWheelDirtAndWater, PATCH_JUMP);
|
||||||
InjectHook(0x5353A0, &CAutomobile::ResetSuspension, PATCH_JUMP);
|
InjectHook(0x5353A0, &CAutomobile::ResetSuspension, PATCH_JUMP);
|
||||||
InjectHook(0x52D210, &CAutomobile::SetupSuspensionLines, PATCH_JUMP);
|
InjectHook(0x52D210, &CAutomobile::SetupSuspensionLines, PATCH_JUMP);
|
||||||
InjectHook(0x53E000, &CAutomobile::BlowUpCarsInPath, PATCH_JUMP);
|
InjectHook(0x53E000, &CAutomobile::BlowUpCarsInPath, PATCH_JUMP);
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
void BlowUpCar(CEntity *ent);
|
void BlowUpCar(CEntity *ent);
|
||||||
bool SetUpWheelColModel(CColModel *colModel);
|
bool SetUpWheelColModel(CColModel *colModel);
|
||||||
void BurstTyre(uint8 tyre);
|
void BurstTyre(uint8 tyre);
|
||||||
bool IsRoomForPedToLeaveCar(uint32, CVector *);
|
bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos);
|
||||||
float GetHeightAboveRoad(void);
|
float GetHeightAboveRoad(void);
|
||||||
void PlayCarHorn(void);
|
void PlayCarHorn(void);
|
||||||
|
|
||||||
|
@ -122,6 +122,8 @@ public:
|
||||||
int32 RcbanditCheck1CarWheels(CPtrList &list);
|
int32 RcbanditCheck1CarWheels(CPtrList &list);
|
||||||
void PlaceOnRoadProperly(void);
|
void PlaceOnRoadProperly(void);
|
||||||
void dmgDrawCarCollidingParticles(const CVector &pos, float amount);
|
void dmgDrawCarCollidingParticles(const CVector &pos, float amount);
|
||||||
|
void AddDamagedVehicleParticles(void);
|
||||||
|
void AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed);
|
||||||
void PlayHornIfNecessary(void);
|
void PlayHornIfNecessary(void);
|
||||||
void ResetSuspension(void);
|
void ResetSuspension(void);
|
||||||
void SetupSuspensionLines(void);
|
void SetupSuspensionLines(void);
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
enum eEngineStatus
|
enum eEngineStatus
|
||||||
{
|
{
|
||||||
|
ENGINE_STATUS_STEAM1 = 100,
|
||||||
|
ENGINE_STATUS_STEAM2 = 150,
|
||||||
|
ENGINE_STATUS_SMOKE = 200,
|
||||||
ENGINE_STATUS_ON_FIRE = 225
|
ENGINE_STATUS_ON_FIRE = 225
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,11 @@ enum
|
||||||
CAR_POS_EXHAUST = 9,
|
CAR_POS_EXHAUST = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
BOAT_POS_FRONTSEAT
|
||||||
|
};
|
||||||
|
|
||||||
enum eDoors
|
enum eDoors
|
||||||
{
|
{
|
||||||
DOOR_BONNET = 0,
|
DOOR_BONNET = 0,
|
||||||
|
@ -253,7 +258,7 @@ public:
|
||||||
virtual void BlowUpCar(CEntity *ent) {}
|
virtual void BlowUpCar(CEntity *ent) {}
|
||||||
virtual bool SetUpWheelColModel(CColModel *colModel) { return false; }
|
virtual bool SetUpWheelColModel(CColModel *colModel) { return false; }
|
||||||
virtual void BurstTyre(uint8 tyre) {}
|
virtual void BurstTyre(uint8 tyre) {}
|
||||||
virtual bool IsRoomForPedToLeaveCar(uint32, CVector *) { return false;}
|
virtual bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos) { return false;}
|
||||||
virtual float GetHeightAboveRoad(void);
|
virtual float GetHeightAboveRoad(void);
|
||||||
virtual void PlayCarHorn(void) {}
|
virtual void PlayCarHorn(void) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue