mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-26 04:43:44 +00:00
Merge branch 'miami' into lcs
# Conflicts: # src/core/World.cpp
This commit is contained in:
commit
8f54093de1
14 changed files with 56 additions and 58 deletions
|
@ -3494,7 +3494,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params)
|
||||||
brakeState = veh->m_fBrakePedal * 255.0f;
|
brakeState = veh->m_fBrakePedal * 255.0f;
|
||||||
}
|
}
|
||||||
freqModifier = Abs(veh->GetUp().y);
|
freqModifier = Abs(veh->GetUp().y);
|
||||||
cameraAngle = (DotProduct(veh->m_matrix.GetForward(), TheCamera.GetForward()) + 1.0f) / 2.0f;
|
cameraAngle = (DotProduct(veh->GetMatrix().GetForward(), TheCamera.GetForward()) + 1.0f) / 2.0f;
|
||||||
if (veh->m_modelIndex == MI_SKIMMER) {
|
if (veh->m_modelIndex == MI_SKIMMER) {
|
||||||
boat = (CBoat*)veh;
|
boat = (CBoat*)veh;
|
||||||
propellerSpeed = boat->m_fMovingSpeed * 50.0f / 11.0f;
|
propellerSpeed = boat->m_fMovingSpeed * 50.0f / 11.0f;
|
||||||
|
|
|
@ -200,8 +200,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
||||||
const float fBoundMaxY = boundingBox.max.y + 0.3f;
|
const float fBoundMaxY = boundingBox.max.y + 0.3f;
|
||||||
const float fBoundMinY = boundingBox.min.y - 0.3f;
|
const float fBoundMinY = boundingBox.min.y - 0.3f;
|
||||||
const float fBoundMaxX = boundingBox.max.x + 0.3f;
|
const float fBoundMaxX = boundingBox.max.x + 0.3f;
|
||||||
const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
|
const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
|
||||||
const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
|
const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
|
||||||
const float fBoundRadius = pEntity->GetBoundRadius();
|
const float fBoundRadius = pEntity->GetBoundRadius();
|
||||||
CVector vecBoundCentre;
|
CVector vecBoundCentre;
|
||||||
pEntity->GetBoundCentre(vecBoundCentre);
|
pEntity->GetBoundCentre(vecBoundCentre);
|
||||||
|
@ -215,8 +215,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
||||||
if (!pathNodes[x][y].bBlockade) {
|
if (!pathNodes[x][y].bBlockade) {
|
||||||
const float pointY = y * 0.7f + fDistanceY;
|
const float pointY = y * 0.7f + fDistanceY;
|
||||||
CVector2D point(pointX, pointY);
|
CVector2D point(pointX, pointY);
|
||||||
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
|
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
|
||||||
float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
|
float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
|
||||||
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
|
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
|
||||||
pathNodes[x][y].bBlockade = true;
|
pathNodes[x][y].bBlockade = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1008,8 +1008,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||||
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
||||||
|
|
||||||
if (!entity->bDoNotRender) {
|
if (!entity->bDoNotRender) {
|
||||||
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
|
float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
|
||||||
float modifiedSin = 0.3f * (s + 1.0f);
|
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
int16 colorId = 0;
|
int16 colorId = 0;
|
||||||
|
@ -1149,7 +1148,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||||
if (model == MI_MINIGUN || model == MI_MINIGUN2)
|
if (model == MI_MINIGUN || model == MI_MINIGUN2)
|
||||||
scale = 1.2f;
|
scale = 1.2f;
|
||||||
|
|
||||||
entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale);
|
float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
|
||||||
|
float c = Cos(angle) * scale;
|
||||||
|
float s = Sin(angle) * scale;
|
||||||
|
|
||||||
|
// we know from SA they were setting each field manually like this
|
||||||
|
entity->GetMatrix().rx = c;
|
||||||
|
entity->GetMatrix().ry = s;
|
||||||
|
entity->GetMatrix().rz = 0.0f;
|
||||||
|
entity->GetMatrix().fx = -s;
|
||||||
|
entity->GetMatrix().fy = c;
|
||||||
|
entity->GetMatrix().fz = 0.0f;
|
||||||
|
entity->GetMatrix().ux = 0.0f;
|
||||||
|
entity->GetMatrix().uy = 0.0f;
|
||||||
|
entity->GetMatrix().uz = scale;
|
||||||
|
|
||||||
if (entity->GetModelIndex() == MI_MINIGUN2) {
|
if (entity->GetModelIndex() == MI_MINIGUN2) {
|
||||||
CMatrix matrix1;
|
CMatrix matrix1;
|
||||||
|
|
|
@ -64,7 +64,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
||||||
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
||||||
for (int32 i = 0; i < 2; i++) {
|
for (int32 i = 0; i < 2; i++) {
|
||||||
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
||||||
CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
||||||
int32 modelInfoId = MI_COP;
|
int32 modelInfoId = MI_COP;
|
||||||
eCopType copType = COP_STREET;
|
eCopType copType = COP_STREET;
|
||||||
switch (pVehicle->GetModelIndex())
|
switch (pVehicle->GetModelIndex())
|
||||||
|
@ -239,10 +239,10 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
|
||||||
pVehicle->SetStatus(STATUS_ABANDONED);
|
pVehicle->SetStatus(STATUS_ABANDONED);
|
||||||
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
||||||
tmp.GetPosition().z += fModelRadius - 0.6f;
|
tmp.GetPosition().z += fModelRadius - 0.6f;
|
||||||
pVehicle->m_matrix = tmp;
|
pVehicle->SetMatrix(tmp);
|
||||||
pVehicle->PlaceOnRoadProperly();
|
pVehicle->PlaceOnRoadProperly();
|
||||||
pVehicle->SetIsStatic(false);
|
pVehicle->SetIsStatic(false);
|
||||||
pVehicle->m_matrix.UpdateRW();
|
pVehicle->GetMatrix().UpdateRW();
|
||||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->bIsLocked = false;
|
pVehicle->bIsLocked = false;
|
||||||
|
|
|
@ -214,7 +214,7 @@ CCamera::Init(void)
|
||||||
m_iModeToGoTo = CCam::MODE_FOLLOWPED;
|
m_iModeToGoTo = CCam::MODE_FOLLOWPED;
|
||||||
m_bJust_Switched = false;
|
m_bJust_Switched = false;
|
||||||
m_bUseTransitionBeta = false;
|
m_bUseTransitionBeta = false;
|
||||||
m_matrix.SetScale(1.0f);
|
GetMatrix().SetScale(1.0f);
|
||||||
m_bTargetJustBeenOnTrain = false;
|
m_bTargetJustBeenOnTrain = false;
|
||||||
m_bInitialNoNodeStaticsSet = false;
|
m_bInitialNoNodeStaticsSet = false;
|
||||||
m_uiLongestTimeInMill = 5000;
|
m_uiLongestTimeInMill = 5000;
|
||||||
|
@ -4019,7 +4019,7 @@ CCamera::SetRwCamera(RwCamera *cam)
|
||||||
void
|
void
|
||||||
CCamera::CalculateDerivedValues(void)
|
CCamera::CalculateDerivedValues(void)
|
||||||
{
|
{
|
||||||
m_cameraMatrix = Invert(m_matrix);
|
m_cameraMatrix = Invert(GetMatrix());
|
||||||
|
|
||||||
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
|
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
|
||||||
float c = Cos(hfov);
|
float c = Cos(hfov);
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ CFileLoader::LoadObjectInstance(const char *line)
|
||||||
if(!CStreaming::IsObjectInCdImage(id))
|
if(!CStreaming::IsObjectInCdImage(id))
|
||||||
debug("Not in cdimage %s\n", mi->GetModelName());
|
debug("Not in cdimage %s\n", mi->GetModelName());
|
||||||
|
|
||||||
angle = -RADTODEG(2.0f * acosf(angle));
|
angle = -RADTODEG(2.0f * Acos(angle));
|
||||||
xform = RwMatrixCreate();
|
xform = RwMatrixCreate();
|
||||||
RwMatrixRotate(xform, &axis, angle, rwCOMBINEREPLACE);
|
RwMatrixRotate(xform, &axis, angle, rwCOMBINEREPLACE);
|
||||||
RwMatrixTranslate(xform, &trans, rwCOMBINEPOSTCONCAT);
|
RwMatrixTranslate(xform, &trans, rwCOMBINEPOSTCONCAT);
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
|
|
||||||
class CPlaceable
|
class CPlaceable
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
CMatrix m_matrix;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// disable allocation
|
// disable allocation
|
||||||
static void *operator new(size_t);
|
static void *operator new(size_t);
|
||||||
|
|
||||||
CMatrix m_matrix;
|
|
||||||
|
|
||||||
CPlaceable(void);
|
CPlaceable(void);
|
||||||
const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
|
const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
|
||||||
void SetPosition(float x, float y, float z) {
|
void SetPosition(float x, float y, float z) {
|
||||||
|
@ -20,6 +21,7 @@ public:
|
||||||
CVector &GetForward(void) { return m_matrix.GetForward(); }
|
CVector &GetForward(void) { return m_matrix.GetForward(); }
|
||||||
CVector &GetUp(void) { return m_matrix.GetUp(); }
|
CVector &GetUp(void) { return m_matrix.GetUp(); }
|
||||||
CMatrix &GetMatrix(void) { return m_matrix; }
|
CMatrix &GetMatrix(void) { return m_matrix; }
|
||||||
|
void SetMatrix(CMatrix &newMatrix) { m_matrix = newMatrix; }
|
||||||
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
|
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
|
||||||
void SetHeading(float angle);
|
void SetHeading(float angle);
|
||||||
void SetOrientation(float x, float y, float z){
|
void SetOrientation(float x, float y, float z){
|
||||||
|
|
|
@ -1486,7 +1486,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
|
||||||
CColModel *pColModel = pVehicle->GetColModel();
|
CColModel *pColModel = pVehicle->GetColModel();
|
||||||
bool bInsideSphere = false;
|
bool bInsideSphere = false;
|
||||||
for(int32 i = 0; i < pColModel->numSpheres; i++) {
|
for(int32 i = 0; i < pColModel->numSpheres; i++) {
|
||||||
CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center;
|
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
|
||||||
float fRadius = pColModel->spheres[i].radius;
|
float fRadius = pColModel->spheres[i].radius;
|
||||||
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
|
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
|
||||||
pos.y - fRadius < y2)
|
pos.y - fRadius < y2)
|
||||||
|
@ -1801,7 +1801,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
|
||||||
position.z = FindGroundZFor3DCoord(position.x, position.y,
|
position.z = FindGroundZFor3DCoord(position.x, position.y,
|
||||||
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
|
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
|
||||||
fBoundingBoxMinZ;
|
fBoundingBoxMinZ;
|
||||||
pEntity->m_matrix.UpdateRW();
|
pEntity->GetMatrix().UpdateRW();
|
||||||
pEntity->UpdateRwFrame();
|
pEntity->UpdateRwFrame();
|
||||||
} else if(modelId == MI_BUOY) {
|
} else if(modelId == MI_BUOY) {
|
||||||
float fWaterLevel = 0.0f;
|
float fWaterLevel = 0.0f;
|
||||||
|
|
|
@ -122,9 +122,9 @@ CEntity::CreateRwObject(void)
|
||||||
if(IsBuilding())
|
if(IsBuilding())
|
||||||
gBuildings++;
|
gBuildings++;
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||||
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
|
GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic *)m_rwObject)), false);
|
||||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||||
m_matrix.AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
|
GetMatrix().AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump *)m_rwObject)), false);
|
||||||
|
|
||||||
mi->AddRef();
|
mi->AddRef();
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ CEntity::AttachToRwObject(RwObject *obj)
|
||||||
m_rwObject = obj;
|
m_rwObject = obj;
|
||||||
if(m_rwObject){
|
if(m_rwObject){
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||||
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
|
GetMatrix().Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic *)m_rwObject)), false);
|
||||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||||
m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
|
GetMatrix().Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump *)m_rwObject)), false);
|
||||||
|
|
||||||
CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
|
CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ CEntity::DetachFromRwObject(void)
|
||||||
if(m_rwObject)
|
if(m_rwObject)
|
||||||
CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef();
|
CModelInfo::GetModelInfo(m_modelIndex)->RemoveRef();
|
||||||
m_rwObject = nil;
|
m_rwObject = nil;
|
||||||
m_matrix.Detach();
|
GetMatrix().Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
RpAtomic*
|
RpAtomic*
|
||||||
|
@ -178,7 +178,7 @@ CEntity::DeleteRwObject(void)
|
||||||
{
|
{
|
||||||
RwFrame *f;
|
RwFrame *f;
|
||||||
|
|
||||||
m_matrix.Detach();
|
GetMatrix().Detach();
|
||||||
if(m_rwObject){
|
if(m_rwObject){
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){
|
if(RwObjectGetType(m_rwObject) == rpATOMIC){
|
||||||
f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
||||||
|
@ -203,16 +203,16 @@ CEntity::GetBoundRect(void)
|
||||||
CVector v;
|
CVector v;
|
||||||
CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
|
CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
|
||||||
|
|
||||||
rect.ContainPoint(m_matrix * col->boundingBox.min);
|
rect.ContainPoint(GetMatrix() * col->boundingBox.min);
|
||||||
rect.ContainPoint(m_matrix * col->boundingBox.max);
|
rect.ContainPoint(GetMatrix() * col->boundingBox.max);
|
||||||
|
|
||||||
v = col->boundingBox.min;
|
v = col->boundingBox.min;
|
||||||
v.x = col->boundingBox.max.x;
|
v.x = col->boundingBox.max.x;
|
||||||
rect.ContainPoint(m_matrix * v);
|
rect.ContainPoint(GetMatrix() * v);
|
||||||
|
|
||||||
v = col->boundingBox.max;
|
v = col->boundingBox.max;
|
||||||
v.x = col->boundingBox.min.x;
|
v.x = col->boundingBox.min.x;
|
||||||
rect.ContainPoint(m_matrix * v);
|
rect.ContainPoint(GetMatrix() * v);
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ CEntity::GetBoundCentre(void)
|
||||||
void
|
void
|
||||||
CEntity::GetBoundCentre(CVector &out)
|
CEntity::GetBoundCentre(CVector &out)
|
||||||
{
|
{
|
||||||
out = m_matrix * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
|
out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
|
|
|
@ -463,7 +463,7 @@ CPhysical::ApplyMoveForce(float jx, float jy, float jz)
|
||||||
void
|
void
|
||||||
CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz)
|
CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz)
|
||||||
{
|
{
|
||||||
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass);
|
CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
|
||||||
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
|
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
|
||||||
m_vecTurnSpeed += turnimpulse*(1.0f/m_fTurnMass);
|
m_vecTurnSpeed += turnimpulse*(1.0f/m_fTurnMass);
|
||||||
m_vecTurnSpeed.x = clamp(m_vecTurnSpeed.x, -4.0f, 4.0f);
|
m_vecTurnSpeed.x = clamp(m_vecTurnSpeed.x, -4.0f, 4.0f);
|
||||||
|
@ -482,7 +482,7 @@ CPhysical::ApplyFrictionMoveForce(float jx, float jy, float jz)
|
||||||
void
|
void
|
||||||
CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz)
|
CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz)
|
||||||
{
|
{
|
||||||
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass);
|
CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
|
||||||
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
|
CVector turnimpulse = CrossProduct(CVector(px, py, pz)-com, CVector(jx, jy, jz));
|
||||||
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
|
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
|
||||||
moveSpeed += vImpulse * (1.0f/m_fMass);
|
moveSpeed += vImpulse * (1.0f/m_fMass);
|
||||||
|
|
||||||
// ApplyTurnForce
|
// ApplyTurnForce
|
||||||
CVector com = Multiply3x3(m_matrix, m_vecCentreOfMass);
|
CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
|
||||||
CVector turnimpulse = CrossProduct(pointpos-com, vImpulse);
|
CVector turnimpulse = CrossProduct(pointpos-com, vImpulse);
|
||||||
turnSpeed += turnimpulse*(1.0f/m_fTurnMass);
|
turnSpeed += turnimpulse*(1.0f/m_fTurnMass);
|
||||||
|
|
||||||
|
|
|
@ -92,22 +92,6 @@ public:
|
||||||
void SetRotateXOnly(float angle);
|
void SetRotateXOnly(float angle);
|
||||||
void SetRotateYOnly(float angle);
|
void SetRotateYOnly(float angle);
|
||||||
void SetRotateZOnly(float angle);
|
void SetRotateZOnly(float angle);
|
||||||
void SetRotateZOnlyScaled(float angle, float scale) {
|
|
||||||
float c = Cos(angle);
|
|
||||||
float s = Sin(angle);
|
|
||||||
|
|
||||||
rx = c * scale;
|
|
||||||
ry = s * scale;
|
|
||||||
rz = 0.0f;
|
|
||||||
|
|
||||||
fx = -s * scale;
|
|
||||||
fy = c * scale;
|
|
||||||
fz = 0.0f;
|
|
||||||
|
|
||||||
ux = 0.0f;
|
|
||||||
uy = 0.0f;
|
|
||||||
uz = scale;
|
|
||||||
}
|
|
||||||
void SetRotateX(float angle);
|
void SetRotateX(float angle);
|
||||||
void SetRotateY(float angle);
|
void SetRotateY(float angle);
|
||||||
void SetRotateZ(float angle);
|
void SetRotateZ(float angle);
|
||||||
|
|
|
@ -77,7 +77,7 @@ CObject::CObject(CDummyObject *dummy)
|
||||||
if (dummy->m_rwObject)
|
if (dummy->m_rwObject)
|
||||||
AttachToRwObject(dummy->m_rwObject);
|
AttachToRwObject(dummy->m_rwObject);
|
||||||
else
|
else
|
||||||
GetMatrix() = dummy->GetMatrix();
|
SetMatrix(dummy->GetMatrix());
|
||||||
|
|
||||||
m_objectMatrix = dummy->GetMatrix();
|
m_objectMatrix = dummy->GetMatrix();
|
||||||
dummy->DetachFromRwObject();
|
dummy->DetachFromRwObject();
|
||||||
|
@ -190,8 +190,8 @@ void
|
||||||
CObject::Teleport(CVector vecPos)
|
CObject::Teleport(CVector vecPos)
|
||||||
{
|
{
|
||||||
CWorld::Remove(this);
|
CWorld::Remove(this);
|
||||||
m_matrix.GetPosition() = vecPos;
|
GetMatrix().GetPosition() = vecPos;
|
||||||
m_matrix.UpdateRW();
|
GetMatrix().UpdateRW();
|
||||||
UpdateRwFrame();
|
UpdateRwFrame();
|
||||||
CWorld::Add(this);
|
CWorld::Add(this);
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ CObject::ObjectDamage(float amount)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
|
if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
|
||||||
const CVector &vecPos = m_matrix.GetPosition();
|
const CVector& vecPos = GetMatrix().GetPosition();
|
||||||
const float fDirectionZ = 0.0002f * amount;
|
const float fDirectionZ = 0.0002f * amount;
|
||||||
switch (m_nCollisionDamageEffect) {
|
switch (m_nCollisionDamageEffect) {
|
||||||
case DAMAGE_EFFECT_CHANGE_MODEL:
|
case DAMAGE_EFFECT_CHANGE_MODEL:
|
||||||
|
@ -653,7 +653,7 @@ CObject::ObjectDamage(float amount)
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, particlePos, particleDir, nil, fSize, particleColor, nRotationSpeed, 0, nCurFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, particlePos, particleDir, nil, fSize, particleColor, nRotationSpeed, 0, nCurFrame, 0);
|
||||||
if ((i % 7) == 0) {
|
if ((i % 7) == 0) {
|
||||||
static RwRGBA secondaryColor = { 0x9A, 0x99, 0x99, 0x3E };
|
static RwRGBA secondaryColor = { 0x9A, 0x99, 0x99, 0x3E };
|
||||||
CParticle::AddParticle(PARTICLE_DEBRIS, particlePos, particleDir, nil, 0.3, secondaryColor, nRotationSpeed, 0, 0, 0);
|
CParticle::AddParticle(PARTICLE_DEBRIS, particlePos, particleDir, nil, 0.3f, secondaryColor, nRotationSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
|
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
|
||||||
|
@ -746,7 +746,7 @@ CObject::Init(void)
|
||||||
m_pCollidingEntity = nil;
|
m_pCollidingEntity = nil;
|
||||||
CColPoint point;
|
CColPoint point;
|
||||||
CEntity *outEntity = nil;
|
CEntity *outEntity = nil;
|
||||||
const CVector &vecPos = m_matrix.GetPosition();
|
const CVector& vecPos = GetMatrix().GetPosition();
|
||||||
if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
|
if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
|
||||||
m_pCurSurface = outEntity;
|
m_pCurSurface = outEntity;
|
||||||
else
|
else
|
||||||
|
|
|
@ -7761,7 +7761,7 @@ CPed::SetPedPositionInCar(void)
|
||||||
} else {
|
} else {
|
||||||
m_fRotationCur = m_pMyVehicle->GetForward().Heading();
|
m_fRotationCur = m_pMyVehicle->GetForward().Heading();
|
||||||
}
|
}
|
||||||
GetMatrix() = newMat;
|
SetMatrix(newMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -123,7 +123,7 @@ void
|
||||||
CPlane::DeleteRwObject(void)
|
CPlane::DeleteRwObject(void)
|
||||||
{
|
{
|
||||||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
||||||
m_matrix.Detach();
|
GetMatrix().Detach();
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
||||||
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
||||||
RpAtomicDestroy((RpAtomic*)m_rwObject);
|
RpAtomicDestroy((RpAtomic*)m_rwObject);
|
||||||
|
@ -567,13 +567,13 @@ CPlane::ProcessControl(void)
|
||||||
m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance();
|
m_rwObject = CModelInfo::GetModelInfo(mi->m_planeLodId)->CreateInstance();
|
||||||
POP_MEMID();
|
POP_MEMID();
|
||||||
if(m_rwObject)
|
if(m_rwObject)
|
||||||
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)));
|
GetMatrix().AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(CStreaming::HasModelLoaded(GetModelIndex())){
|
}else if(CStreaming::HasModelLoaded(GetModelIndex())){
|
||||||
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
if(m_rwObject && RwObjectGetType(m_rwObject) == rpATOMIC){
|
||||||
// Get rid of LOD model
|
// Get rid of LOD model
|
||||||
m_matrix.Detach();
|
GetMatrix().Detach();
|
||||||
if(m_rwObject){ // useless check
|
if(m_rwObject){ // useless check
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
if(RwObjectGetType(m_rwObject) == rpATOMIC){ // useless check
|
||||||
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
RwFrame *f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
||||||
|
|
Loading…
Reference in a new issue