1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 04:10:00 +00:00

Fixes from miami Entity/Physical proof-read 1

This commit is contained in:
erorcun 2021-01-04 16:28:30 +03:00
parent 2860f6e4a9
commit 3b1400eaed
4 changed files with 20 additions and 18 deletions

View file

@ -228,12 +228,8 @@ CEntity::GetBoundRadius(void)
void void
CEntity::UpdateRwFrame(void) CEntity::UpdateRwFrame(void)
{ {
if(m_rwObject){ if(m_rwObject)
if(RwObjectGetType(m_rwObject) == rpATOMIC) RwFrameUpdateObjects(rwObjectGetParent(m_rwObject));
RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject));
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject));
}
} }
#ifdef PED_SKIN #ifdef PED_SKIN

View file

@ -303,14 +303,15 @@ CPhysical::GetHasCollidedWith(CEntity *ent)
void void
CPhysical::RemoveRefsToEntity(CEntity *ent) CPhysical::RemoveRefsToEntity(CEntity *ent)
{ {
int i, j; int i = 0, j;
for(i = 0; i < m_nCollisionRecords; i++){ while(i < m_nCollisionRecords) {
if(m_aCollisionRecords[i] == ent){ if(m_aCollisionRecords[i] == ent){
for(j = i; j < m_nCollisionRecords-1; j++) for(j = i; j < m_nCollisionRecords-1; j++)
m_aCollisionRecords[j] = m_aCollisionRecords[j+1]; m_aCollisionRecords[j] = m_aCollisionRecords[j+1];
m_nCollisionRecords--; m_nCollisionRecords--;
} } else
i++;
} }
} }
@ -518,13 +519,12 @@ CPhysical::ApplyAirResistance(void)
m_vecMoveSpeed *= f; m_vecMoveSpeed *= f;
m_vecTurnSpeed *= f; m_vecTurnSpeed *= f;
}else{ }else{
float f = Pow(1.0f/(m_fAirResistance*0.5f*m_vecMoveSpeed.MagnitudeSqr() + 1.0f), CTimer::GetTimeStep()); float f = Pow(1.0f/Abs(m_fAirResistance*0.5f*m_vecMoveSpeed.MagnitudeSqr() + 1.0f), CTimer::GetTimeStep());
m_vecMoveSpeed *= f; m_vecMoveSpeed *= f;
m_vecTurnSpeed *= 0.99f; m_vecTurnSpeed *= 0.99f;
} }
} }
bool bool
CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, float &impulseB) CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, float &impulseB)
{ {
@ -888,7 +888,11 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
impulseB = (speedSum - fOtherSpeedB) * B->m_fMass; impulseB = (speedSum - fOtherSpeedB) * B->m_fMass;
impulseLimit = adhesiveLimit*CTimer::GetTimeStep(); impulseLimit = adhesiveLimit*CTimer::GetTimeStep();
if(impulseA < -impulseLimit) impulseA = -impulseLimit; if(impulseA < -impulseLimit) impulseA = -impulseLimit;
if(impulseB > impulseLimit) impulseB = impulseLimit; // BUG: game has A's clamp again here, but this can't be right #ifdef FIX_BUGS
if(impulseB > impulseLimit) impulseB = impulseLimit;
#else
if(impulseA < -impulseLimit) impulseA = -impulseLimit; // duplicate
#endif
A->ApplyFrictionMoveForce(frictionDir*impulseA); A->ApplyFrictionMoveForce(frictionDir*impulseA);
B->ApplyFrictionMoveForce(frictionDir*impulseB); B->ApplyFrictionMoveForce(frictionDir*impulseB);
return true; return true;
@ -1020,7 +1024,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
if(fOtherSpeed > 0.0f){ if(fOtherSpeed > 0.0f){
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
fImpulse = -fOtherSpeed * m_fMass; fImpulse = -fOtherSpeed * m_fMass;
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5f; impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5;
if(fImpulse < -impulseLimit) fImpulse = -impulseLimit; if(fImpulse < -impulseLimit) fImpulse = -impulseLimit;
ApplyFrictionMoveForce(frictionDir*fImpulse); ApplyFrictionMoveForce(frictionDir*fImpulse);
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos); ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
@ -1111,7 +1115,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
skipShift = true; skipShift = true;
Aobj->m_pCollidingEntity = B; Aobj->m_pCollidingEntity = B;
} }
} } else
skipShift = true;
}else if(B->IsObject() && A->IsVehicle()){ }else if(B->IsObject() && A->IsVehicle()){
CObject *Bobj = (CObject*)B; CObject *Bobj = (CObject*)B;
if(Bobj->ObjectCreatedBy != TEMP_OBJECT && if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
@ -1126,7 +1131,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(size.z < A->GetPosition().z || if(size.z < A->GetPosition().z ||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f) (Invert(A->GetMatrix(), inv) * size).z < 0.0f)
skipShift = true; skipShift = true;
} } else
skipShift = true;
}else if(IsBodyPart(A->GetModelIndex()) && B->IsPed()) }else if(IsBodyPart(A->GetModelIndex()) && B->IsPed())
skipShift = true; skipShift = true;
else if(A->IsPed() && IsBodyPart(B->GetModelIndex())) else if(A->IsPed() && IsBodyPart(B->GetModelIndex()))

View file

@ -14,7 +14,7 @@
using namespace rw; using namespace rw;
RwUInt8 RwObjectGetType(const RwObject *obj) { return obj->type; } RwUInt8 RwObjectGetType(const RwObject *obj) { return obj->type; }
RwFrame* rwObjectGetParent(const RwObject *obj) { return (RwFrame*)obj->parent; }
void *RwMalloc(size_t size) { return engine->memfuncs.rwmalloc(size, 0); } void *RwMalloc(size_t size) { return engine->memfuncs.rwmalloc(size, 0); }
void *RwCalloc(size_t numObj, size_t sizeObj) { void *RwCalloc(size_t numObj, size_t sizeObj) {

View file

@ -108,12 +108,12 @@ enum RwCorePluginID
//struct RwObject; //struct RwObject;
typedef rw::Object RwObject; typedef rw::Object RwObject;
typedef rw::Frame RwFrame;
typedef RwObject *(*RwObjectCallBack)(RwObject *object, void *data); typedef RwObject *(*RwObjectCallBack)(RwObject *object, void *data);
RwUInt8 RwObjectGetType(const RwObject *obj); RwUInt8 RwObjectGetType(const RwObject *obj);
RwFrame* rwObjectGetParent(const RwObject *obj);
#define rwsprintf sprintf #define rwsprintf sprintf
#define rwvsprintf vsprintf #define rwvsprintf vsprintf