mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 20:00:01 +00:00
commit
1e679dcb8d
|
@ -474,6 +474,8 @@ DebugMenuPopulate(void)
|
||||||
DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); });
|
DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); });
|
DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); });
|
DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); });
|
||||||
|
DebugMenuAddCmd("Spawn", "Spawn Squalo", [](){ SpawnCar(MI_SQUALO); });
|
||||||
|
DebugMenuAddCmd("Spawn", "Spawn Skimmer", [](){ SpawnCar(MI_SKIMMER); });
|
||||||
|
|
||||||
DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil);
|
DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil);
|
DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil);
|
||||||
|
|
|
@ -89,7 +89,17 @@ RwObjectNameIdAssocation boatIds[] = {
|
||||||
{ "boat_flap_right", BOAT_FLAP_RIGHT, 0 },
|
{ "boat_flap_right", BOAT_FLAP_RIGHT, 0 },
|
||||||
{ "boat_rearflap_left", BOAT_REARFLAP_LEFT, 0 },
|
{ "boat_rearflap_left", BOAT_REARFLAP_LEFT, 0 },
|
||||||
{ "boat_rearflap_right", BOAT_REARFLAP_RIGHT, 0 },
|
{ "boat_rearflap_right", BOAT_REARFLAP_RIGHT, 0 },
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
// let's just accept both
|
||||||
|
{ "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
|
||||||
{ "windscreen_hi_ok", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
|
{ "windscreen_hi_ok", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
|
||||||
|
#else
|
||||||
|
#ifdef GTA_PS2
|
||||||
|
{ "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
|
||||||
|
#else
|
||||||
|
{ "windscreen_hi_ok", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_DRAWLAST },
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
{ "ped_frontseat", BOAT_POS_FRONTSEAT, 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 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,5 +98,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool clearWaterDrop;
|
extern bool clearWaterDrop;
|
||||||
|
extern int32 numWaterDropOnScreen;
|
||||||
|
|
||||||
VALIDATE_SIZE(CParticle, 0x58);
|
VALIDATE_SIZE(CParticle, 0x58);
|
||||||
|
|
|
@ -279,7 +279,7 @@ void CWeather::Update(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
Wind = InterpolationValue * Windiness[NewWeatherType] + (1.0f - InterpolationValue) * Windiness[OldWeatherType];
|
Wind = InterpolationValue * Windiness[NewWeatherType] + (1.0f - InterpolationValue) * Windiness[OldWeatherType];
|
||||||
WindClipped = Max(1.0f, Wind);
|
WindClipped = Min(1.0f, Wind);
|
||||||
|
|
||||||
if (CClock::GetHours() == 20)
|
if (CClock::GetHours() == 20)
|
||||||
TrafficLightBrightness = CClock::GetMinutes() / 60.0f;
|
TrafficLightBrightness = CClock::GetMinutes() / 60.0f;
|
||||||
|
|
|
@ -625,6 +625,14 @@ CVisibilityPlugins::RenderPedCB(RpAtomic *atomic)
|
||||||
return atomic;
|
return atomic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
CVisibilityPlugins::GetDistanceSquaredFromCamera(RwV3d *pos)
|
||||||
|
{
|
||||||
|
RwV3d dist;
|
||||||
|
RwV3dSub(&dist, pos, ms_pCameraPosn);
|
||||||
|
return RwV3dDotProduct(&dist, &dist);
|
||||||
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
CVisibilityPlugins::GetDistanceSquaredFromCamera(RwFrame *frame)
|
CVisibilityPlugins::GetDistanceSquaredFromCamera(RwFrame *frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
static bool VehicleVisibilityCB(RpClump *clump);
|
static bool VehicleVisibilityCB(RpClump *clump);
|
||||||
static bool VehicleVisibilityCB_BigVehicle(RpClump *clump);
|
static bool VehicleVisibilityCB_BigVehicle(RpClump *clump);
|
||||||
|
|
||||||
|
static float GetDistanceSquaredFromCamera(RwV3d *pos);
|
||||||
static float GetDistanceSquaredFromCamera(RwFrame *frame);
|
static float GetDistanceSquaredFromCamera(RwFrame *frame);
|
||||||
static float GetDotProductWithCameraVector(RwMatrix *atomicMat, RwMatrix *clumpMat, uint32 flags);
|
static float GetDotProductWithCameraVector(RwMatrix *atomicMat, RwMatrix *clumpMat, uint32 flags);
|
||||||
|
|
||||||
|
|
|
@ -3796,7 +3796,7 @@ void
|
||||||
CAutomobile::DoDriveByShootings(void)
|
CAutomobile::DoDriveByShootings(void)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation *anim = nil;
|
CAnimBlendAssociation *anim = nil;
|
||||||
CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed();
|
CPlayerInfo* playerInfo = ((CPlayerPed*)pDriver)->GetPlayerInfoForThisPlayerPed();
|
||||||
if (playerInfo && !playerInfo->m_bDriveByAllowed)
|
if (playerInfo && !playerInfo->m_bDriveByAllowed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1989,7 +1989,7 @@ void
|
||||||
CBike::DoDriveByShootings(void)
|
CBike::DoDriveByShootings(void)
|
||||||
{
|
{
|
||||||
CAnimBlendAssociation *anim;
|
CAnimBlendAssociation *anim;
|
||||||
CPlayerInfo* playerInfo = ((CPlayerPed*)this)->GetPlayerInfoForThisPlayerPed();
|
CPlayerInfo* playerInfo = ((CPlayerPed*)pDriver)->GetPlayerInfoForThisPlayerPed();
|
||||||
if (playerInfo && !playerInfo->m_bDriveByAllowed)
|
if (playerInfo && !playerInfo->m_bDriveByAllowed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
#include "Door.h"
|
||||||
|
|
||||||
enum eBoatNodes
|
enum eBoatNodes
|
||||||
{
|
{
|
||||||
|
@ -10,33 +11,34 @@ enum eBoatNodes
|
||||||
BOAT_FLAP_LEFT,
|
BOAT_FLAP_LEFT,
|
||||||
BOAT_FLAP_RIGHT,
|
BOAT_FLAP_RIGHT,
|
||||||
BOAT_REARFLAP_LEFT,
|
BOAT_REARFLAP_LEFT,
|
||||||
BOAT_REARFLAP_RIGHT
|
BOAT_REARFLAP_RIGHT,
|
||||||
|
NUM_BOAT_NODES
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBoat : public CVehicle
|
class CBoat : public CVehicle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// 0x288
|
float m_fMovingRotation;
|
||||||
float m_fPropellerZ;
|
float m_fMovingSpeed;
|
||||||
float m_fPropellerY;
|
int32 m_boat_unused1;
|
||||||
CVector m_waterMoveDrag;
|
RwFrame *m_aBoatNodes[NUM_BOAT_NODES];
|
||||||
CVector m_waterTurnDrag;
|
CDoor m_boom;
|
||||||
float m_fMovingHiRotation;
|
tBoatHandlingData *pBoatHandling;
|
||||||
int32 _unk0;
|
|
||||||
RwFrame *m_aBoatNodes[4];
|
|
||||||
uint8 bBoatInWater : 1;
|
uint8 bBoatInWater : 1;
|
||||||
uint8 bPropellerInWater : 1;
|
uint8 bPropellerInWater : 1;
|
||||||
bool m_bIsAnchored;
|
bool m_bIsAnchored;
|
||||||
float m_fOrientation;
|
float m_fOrientation;
|
||||||
int32 _unk1;
|
uint32 m_nPoliceShoutTimer;
|
||||||
|
int32 m_boat_unused2;
|
||||||
float m_fDamage;
|
float m_fDamage;
|
||||||
CEntity *m_pSetOnFireEntity;
|
CEntity *m_pSetOnFireEntity;
|
||||||
bool _unk2;
|
float m_skimmerThingTimer;
|
||||||
|
bool m_boat_unused3;
|
||||||
float m_fAccelerate;
|
float m_fAccelerate;
|
||||||
float m_fBrake;
|
float m_fBrake;
|
||||||
float m_fSteeringLeftRight;
|
float m_fSteeringLeftRight;
|
||||||
uint8 m_nPadID;
|
uint8 m_nPadID;
|
||||||
int32 _unk3;
|
int32 m_boat_unused4;
|
||||||
float m_fVolumeUnderWater;
|
float m_fVolumeUnderWater;
|
||||||
CVector m_vecBuoyancePoint;
|
CVector m_vecBuoyancePoint;
|
||||||
float m_fPrevVolumeUnderWater;
|
float m_fPrevVolumeUnderWater;
|
||||||
|
@ -54,7 +56,7 @@ public:
|
||||||
virtual void SetModelIndex(uint32 id);
|
virtual void SetModelIndex(uint32 id);
|
||||||
virtual void ProcessControl();
|
virtual void ProcessControl();
|
||||||
virtual void Teleport(CVector v);
|
virtual void Teleport(CVector v);
|
||||||
virtual void PreRender(void) {};
|
virtual void PreRender(void);
|
||||||
virtual void Render(void);
|
virtual void Render(void);
|
||||||
virtual void ProcessControlInputs(uint8);
|
virtual void ProcessControlInputs(uint8);
|
||||||
virtual void GetComponentWorldPosition(int32 component, CVector &pos);
|
virtual void GetComponentWorldPosition(int32 component, CVector &pos);
|
||||||
|
|
|
@ -7,18 +7,40 @@
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "Floater.h"
|
#include "Floater.h"
|
||||||
|
|
||||||
|
//--MIAMI: done
|
||||||
|
|
||||||
cBuoyancy mod_Buoyancy;
|
cBuoyancy mod_Buoyancy;
|
||||||
|
|
||||||
static float fVolMultiplier = 1.0f;
|
float fVolMultiplier = 1.0f;
|
||||||
// amount of boat volume in bounding box
|
// amount of boat volume in bounding box
|
||||||
// 1.0-volume is the empty space in the bbox
|
// 1.0-volume is the empty space in the bbox
|
||||||
static float fBoatVolumeDistribution[9] = {
|
float fBoatVolumeDistribution[9] = {
|
||||||
// rear
|
// rear
|
||||||
0.75f, 0.9f, 0.75f,
|
0.75f, 0.9f, 0.75f,
|
||||||
0.95f, 1.0f, 0.95f,
|
0.95f, 1.0f, 0.95f,
|
||||||
0.3f, 0.7f, 0.3f
|
0.4f, 0.7f, 0.4f
|
||||||
// bow
|
// bow
|
||||||
};
|
};
|
||||||
|
float fBoatVolumeDistributionCat[9] = {
|
||||||
|
0.9f, 0.3f, 0.9f,
|
||||||
|
1.0f, 0.5f, 1.0f,
|
||||||
|
0.95f, 0.4f, 0.95f
|
||||||
|
};
|
||||||
|
float fBoatVolumeDistributionSail[9] = {
|
||||||
|
0.55f, 0.95f, 0.55f,
|
||||||
|
0.75f, 1.1f, 0.75f,
|
||||||
|
0.3f, 0.8f, 0.3f
|
||||||
|
};
|
||||||
|
float fBoatVolumeDistributionDinghy[9] = {
|
||||||
|
0.65f, 0.85f, 0.65f,
|
||||||
|
0.85f, 1.1f, 0.85f,
|
||||||
|
0.65f, 0.95f, 0.65f
|
||||||
|
};
|
||||||
|
float fBoatVolumeDistributionSpeed[9] = {
|
||||||
|
0.7f, 0.9f, 0.7f,
|
||||||
|
0.95f, 1.0f, 0.95f,
|
||||||
|
0.6f, 0.7f, 0.6f
|
||||||
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVector *impulse)
|
cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVector *impulse)
|
||||||
|
@ -37,6 +59,76 @@ cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVec
|
||||||
return f != 0.0f;
|
return f != 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
cBuoyancy::ProcessBuoyancyBoat(CVehicle *veh, float buoyancy, CVector *point, CVector *impulse, bool bNoTurnForce)
|
||||||
|
{
|
||||||
|
m_numSteps = 2.0f;
|
||||||
|
|
||||||
|
if(!CWaterLevel::GetWaterLevel(veh->GetPosition(), &m_waterlevel, veh->bTouchingWater))
|
||||||
|
return false;
|
||||||
|
m_matrix = veh->GetMatrix();
|
||||||
|
PreCalcSetup(veh, buoyancy);
|
||||||
|
|
||||||
|
|
||||||
|
float x, y;
|
||||||
|
int ix, i;
|
||||||
|
tWaterLevel waterPosition;
|
||||||
|
CVector waterNormal;
|
||||||
|
|
||||||
|
// Floater is divided into 3x3 parts. Process and sum each of them
|
||||||
|
float volDiv = 1.0f/((m_dimMax.z - m_dimMin.z)*sq(m_numSteps+1.0f));
|
||||||
|
ix = 0;
|
||||||
|
for(x = m_dimMin.x; x <= m_dimMax.x; x += m_step.x){
|
||||||
|
i = ix;
|
||||||
|
for(y = m_dimMin.y; y <= m_dimMax.y; y += m_step.y){
|
||||||
|
CVector waterLevel(x, y, 0.0f);
|
||||||
|
FindWaterLevelNorm(m_positionZ, &waterLevel, &waterPosition, &waterNormal);
|
||||||
|
switch(veh->GetModelIndex()){
|
||||||
|
case MI_RIO:
|
||||||
|
fVolMultiplier = fBoatVolumeDistributionCat[i];
|
||||||
|
break;
|
||||||
|
case MI_SQUALO:
|
||||||
|
case MI_SPEEDER:
|
||||||
|
case MI_JETMAX:
|
||||||
|
fVolMultiplier = fBoatVolumeDistributionSpeed[i];
|
||||||
|
break;
|
||||||
|
case MI_COASTG:
|
||||||
|
case MI_DINGHY:
|
||||||
|
fVolMultiplier = fBoatVolumeDistributionDinghy[i];
|
||||||
|
break;
|
||||||
|
case MI_MARQUIS:
|
||||||
|
fVolMultiplier = fBoatVolumeDistributionSail[i];
|
||||||
|
break;
|
||||||
|
case MI_PREDATOR:
|
||||||
|
case MI_SKIMMER:
|
||||||
|
case MI_REEFER:
|
||||||
|
case MI_TROPIC:
|
||||||
|
default:
|
||||||
|
fVolMultiplier = fBoatVolumeDistribution[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(waterPosition != FLOATER_ABOVE_WATER){
|
||||||
|
float volume = SimpleSumBuoyancyData(waterLevel, waterPosition);
|
||||||
|
float upImpulse = volume * volDiv * buoyancy * CTimer::GetTimeStep();
|
||||||
|
CVector speed = veh->GetSpeed(Multiply3x3(veh->GetMatrix(), CVector(x, y, 0.0f)));
|
||||||
|
float damp = 1.0f - DotProduct(speed, waterNormal)*veh->pHandling->fSuspensionDampingLevel;
|
||||||
|
float finalImpulse = upImpulse*Max(damp, 0.0f);
|
||||||
|
impulse->z += finalImpulse;
|
||||||
|
if(!bNoTurnForce)
|
||||||
|
veh->ApplyTurnForce(finalImpulse*waterNormal, Multiply3x3(m_matrix, waterLevel));
|
||||||
|
}
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
ix++;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_volumeUnderWater *= volDiv;
|
||||||
|
|
||||||
|
*point = Multiply3x3(m_matrix, m_impulsePoint);
|
||||||
|
return m_isBoat || m_haveVolume;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cBuoyancy::PreCalcSetup(CPhysical *phys, float buoyancy)
|
cBuoyancy::PreCalcSetup(CPhysical *phys, float buoyancy)
|
||||||
{
|
{
|
||||||
|
@ -48,17 +140,55 @@ cBuoyancy::PreCalcSetup(CPhysical *phys, float buoyancy)
|
||||||
m_dimMax = colModel->boundingBox.max;
|
m_dimMax = colModel->boundingBox.max;
|
||||||
|
|
||||||
if(m_isBoat){
|
if(m_isBoat){
|
||||||
if(phys->GetModelIndex() == MI_PREDATOR){
|
switch(phys->GetModelIndex()){
|
||||||
|
case MI_PREDATOR:
|
||||||
|
default:
|
||||||
|
m_dimMax.y *= 1.05f;
|
||||||
|
m_dimMin.y *= 0.9f;
|
||||||
|
break;
|
||||||
|
case MI_SPEEDER:
|
||||||
|
m_dimMax.y *= 1.25f;
|
||||||
|
m_dimMin.y *= 0.83f;
|
||||||
|
break;
|
||||||
|
case MI_REEFER:
|
||||||
|
m_dimMin.y *= 0.9f;
|
||||||
|
break;
|
||||||
|
case MI_RIO:
|
||||||
m_dimMax.y *= 0.9f;
|
m_dimMax.y *= 0.9f;
|
||||||
m_dimMin.y *= 0.9f;
|
m_dimMin.y *= 0.9f;
|
||||||
}else if(phys->GetModelIndex() == MI_SPEEDER){
|
m_dimMax.z += 0.25f;
|
||||||
|
m_dimMin.z -= 0.2f;
|
||||||
|
break;
|
||||||
|
case MI_SQUALO:
|
||||||
|
m_dimMax.y *= 0.9f;
|
||||||
|
m_dimMin.y *= 0.9f;
|
||||||
|
break;
|
||||||
|
case MI_TROPIC:
|
||||||
|
m_dimMax.y *= 1.3f;
|
||||||
|
m_dimMin.y *= 0.82f;
|
||||||
|
m_dimMin.z -= 0.2f;
|
||||||
|
break;
|
||||||
|
case MI_SKIMMER:
|
||||||
|
m_dimMin.y = -m_dimMax.y;
|
||||||
|
m_dimMax.y *= 1.2f;
|
||||||
|
break;
|
||||||
|
case MI_COASTG:
|
||||||
m_dimMax.y *= 1.1f;
|
m_dimMax.y *= 1.1f;
|
||||||
m_dimMin.y *= 0.9f;
|
m_dimMin.y *= 0.9f;
|
||||||
}else if(phys->GetModelIndex() == MI_REEFER){
|
m_dimMin.z -= 0.3f;
|
||||||
|
break;
|
||||||
|
case MI_DINGHY:
|
||||||
|
m_dimMax.y *= 1.3f;
|
||||||
m_dimMin.y *= 0.9f;
|
m_dimMin.y *= 0.9f;
|
||||||
}else{
|
m_dimMin.z -= 0.2f;
|
||||||
m_dimMax.y *= 0.9f;
|
break;
|
||||||
|
case MI_MARQUIS:
|
||||||
|
m_dimMax.y *= 1.3f;
|
||||||
m_dimMin.y *= 0.9f;
|
m_dimMin.y *= 0.9f;
|
||||||
|
break;
|
||||||
|
case MI_JETMAX:
|
||||||
|
m_dimMin.y *= 0.9f;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,22 +222,17 @@ void
|
||||||
cBuoyancy::SimpleCalcBuoyancy(void)
|
cBuoyancy::SimpleCalcBuoyancy(void)
|
||||||
{
|
{
|
||||||
float x, y;
|
float x, y;
|
||||||
int ix, i;
|
|
||||||
tWaterLevel waterPosition;
|
tWaterLevel waterPosition;
|
||||||
|
|
||||||
// Floater is divided into 3x3 parts. Process and sum each of them
|
// Floater is divided into 3x3 parts. Process and sum each of them
|
||||||
ix = 0;
|
|
||||||
for(x = m_dimMin.x; x <= m_dimMax.x; x += m_step.x){
|
for(x = m_dimMin.x; x <= m_dimMax.x; x += m_step.x){
|
||||||
i = ix;
|
|
||||||
for(y = m_dimMin.y; y <= m_dimMax.y; y += m_step.y){
|
for(y = m_dimMin.y; y <= m_dimMax.y; y += m_step.y){
|
||||||
CVector waterLevel(x, y, 0.0f);
|
CVector waterLevel(x, y, 0.0f);
|
||||||
FindWaterLevel(m_positionZ, &waterLevel, &waterPosition);
|
FindWaterLevel(m_positionZ, &waterLevel, &waterPosition);
|
||||||
fVolMultiplier = m_isBoat ? fBoatVolumeDistribution[i] : 1.0f;
|
fVolMultiplier = 1.0f;
|
||||||
if(waterPosition != FLOATER_ABOVE_WATER)
|
if(waterPosition != FLOATER_ABOVE_WATER)
|
||||||
SimpleSumBuoyancyData(waterLevel, waterPosition);
|
SimpleSumBuoyancyData(waterLevel, waterPosition);
|
||||||
i += 3;
|
|
||||||
}
|
}
|
||||||
ix++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_volumeUnderWater /= (m_dimMax.z - m_dimMin.z)*sq(m_numSteps+1.0f);
|
m_volumeUnderWater /= (m_dimMax.z - m_dimMin.z)*sq(m_numSteps+1.0f);
|
||||||
|
@ -129,10 +254,6 @@ cBuoyancy::SimpleSumBuoyancyData(CVector &waterLevel, tWaterLevel waterPosition)
|
||||||
|
|
||||||
if(m_isBoat){
|
if(m_isBoat){
|
||||||
fThisVolume *= fVolMultiplier;
|
fThisVolume *= fVolMultiplier;
|
||||||
if(fThisVolume < 0.5f)
|
|
||||||
fThisVolume = 2.0f*sq(fThisVolume);
|
|
||||||
if(fThisVolume < 1.0f)
|
|
||||||
fThisVolume = sq(fThisVolume);
|
|
||||||
fThisVolume = sq(fThisVolume);
|
fThisVolume = sq(fThisVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +294,26 @@ cBuoyancy::FindWaterLevel(const CVector &zpos, CVector *waterLevel, tWaterLevel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Same as above but also get normal
|
||||||
|
void
|
||||||
|
cBuoyancy::FindWaterLevelNorm(const CVector &zpos, CVector *waterLevel, tWaterLevel *waterPosition, CVector *normal)
|
||||||
|
{
|
||||||
|
*waterPosition = FLOATER_IN_WATER;
|
||||||
|
CVector xWaterLevel = Multiply3x3(m_matrix, *waterLevel);
|
||||||
|
CWaterLevel::GetWaterLevel(xWaterLevel.x + m_position.x, xWaterLevel.y + m_position.y, m_position.z,
|
||||||
|
&waterLevel->z, true);
|
||||||
|
waterLevel->z -= xWaterLevel.z + zpos.z; // make local
|
||||||
|
if(waterLevel->z >= m_dimMin.z)
|
||||||
|
*normal = CWaterLevel::GetWaterNormal(xWaterLevel.x + m_position.x, xWaterLevel.y + m_position.y);
|
||||||
|
if(waterLevel->z > m_dimMax.z){
|
||||||
|
waterLevel->z = m_dimMax.z;
|
||||||
|
*waterPosition = FLOATER_UNDER_WATER;
|
||||||
|
}else if(waterLevel->z < m_dimMin.z){
|
||||||
|
waterLevel->z = m_dimMin.z;
|
||||||
|
*waterPosition = FLOATER_ABOVE_WATER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cBuoyancy::CalcBuoyancyForce(CPhysical *phys, CVector *point, CVector *impulse)
|
cBuoyancy::CalcBuoyancyForce(CPhysical *phys, CVector *point, CVector *impulse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,10 +36,12 @@ public:
|
||||||
CVector m_impulsePoint;
|
CVector m_impulsePoint;
|
||||||
|
|
||||||
bool ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVector *impulse);
|
bool ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVector *impulse);
|
||||||
|
bool ProcessBuoyancyBoat(CVehicle *phys, float buoyancy, CVector *point, CVector *impulse, bool bNoTurnForce);
|
||||||
void PreCalcSetup(CPhysical *phys, float buoyancy);
|
void PreCalcSetup(CPhysical *phys, float buoyancy);
|
||||||
void SimpleCalcBuoyancy(void);
|
void SimpleCalcBuoyancy(void);
|
||||||
float SimpleSumBuoyancyData(CVector &waterLevel, tWaterLevel waterPosition);
|
float SimpleSumBuoyancyData(CVector &waterLevel, tWaterLevel waterPosition);
|
||||||
void FindWaterLevel(const CVector &zpos, CVector *waterLevel, tWaterLevel *waterPosition);
|
void FindWaterLevel(const CVector &zpos, CVector *waterLevel, tWaterLevel *waterPosition);
|
||||||
|
void FindWaterLevelNorm(const CVector &zpos, CVector *waterLevel, tWaterLevel *waterPosition, CVector *normal);
|
||||||
bool CalcBuoyancyForce(CPhysical *phys, CVector *impulse, CVector *point);
|
bool CalcBuoyancyForce(CPhysical *phys, CVector *impulse, CVector *point);
|
||||||
};
|
};
|
||||||
extern cBuoyancy mod_Buoyancy;
|
extern cBuoyancy mod_Buoyancy;
|
||||||
|
|
Loading…
Reference in a new issue