Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2021-01-04 21:03:31 +03:00
commit 601f77b5c8
10 changed files with 77 additions and 43 deletions

View File

@ -1542,10 +1542,11 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
nChannelVolume[nChannel] = vol; nChannelVolume[nChannel] = vol;
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE if (MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE ) {
&& MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_FINALE ) if (MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE)
{ nChannelVolume[nChannel] = 0;
nChannelVolume[nChannel] = vol / 4; else
nChannelVolume[nChannel] >>= 2;
} }
// no idea, does this one looks like a bug or it's SetChannelVolume ? // no idea, does this one looks like a bug or it's SetChannelVolume ?
@ -1936,7 +1937,7 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
{ {
if ( nEffectFlag ) { if ( nEffectFlag ) {
if ( nStream == 1 || nStream == 2 ) if ( nStream == 1 || nStream == 2 )
stream->SetVolume(128*nVolume*m_nEffectsVolume >> 14); stream->SetVolume(2*128*nVolume*m_nEffectsVolume >> 14); // double the volume for now as it plays too quiet
else else
stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14); stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14);
} }

View File

@ -1191,7 +1191,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CollectParameters(&m_nIp, 8); CollectParameters(&m_nIp, 8);
CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed *pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
CVehicle *pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle *pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->AttachPedToEntity(pVehicle, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(ScriptParams[6]), (eWeaponType)ScriptParams[7]); pPed->AttachPedToEntity(pVehicle, *(CVector*)&ScriptParams[2], ScriptParams[5], DEGTORAD(*(float*)&ScriptParams[6]), (eWeaponType)ScriptParams[7]);
return 0; return 0;
} }
case COMMAND_DETACH_CHAR_FROM_CAR: case COMMAND_DETACH_CHAR_FROM_CAR:

View File

@ -2370,8 +2370,10 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
} }
while(Beta >= PI) Beta -= 2*PI; if (!isAttached) {
while(Beta < -PI) Beta += 2*PI; while(Beta >= TWOPI) Beta -= TWOPI;
while(Beta < 0) Beta += TWOPI;
}
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
@ -2414,13 +2416,14 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
} }
} }
}else{ }else{
while(Beta < -PI) Beta += 2*PI; while(Beta < -PI) Beta += TWOPI;
while(Beta >= PI) Beta -= 2*PI; while(Beta >= PI) Beta -= TWOPI;
} }
mat = TargetPed->m_attachedTo->GetMatrix(); mat = TargetPed->m_attachedTo->GetMatrix();
rot.SetRotateX(Alpha); rot.SetRotateX(Alpha);
switch(TargetPed->m_attachType){ switch(TargetPed->m_attachType){
case 0: rot.RotateZ(Beta); break;
case 1: rot.RotateZ(Beta + HALFPI); break; case 1: rot.RotateZ(Beta + HALFPI); break;
case 2: rot.RotateZ(Beta + PI); break; case 2: rot.RotateZ(Beta + PI); break;
case 3: rot.RotateZ(Beta - HALFPI); break; case 3: rot.RotateZ(Beta - HALFPI); break;

View File

@ -225,7 +225,6 @@ void LoadINISettings()
void SaveINISettings() void SaveINISettings()
{ {
bool changed = false; bool changed = false;
char temp[4];
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) { if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) {

View File

@ -126,6 +126,7 @@ CEntity::CreateRwObject(void)
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false); m_matrix.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); m_matrix.AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
mi->AddRef(); mi->AddRef();
} }
} }
@ -139,6 +140,7 @@ CEntity::AttachToRwObject(RwObject *obj)
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false); m_matrix.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); m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
CModelInfo::GetModelInfo(m_modelIndex)->AddRef(); CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
} }
} }
@ -239,12 +241,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));
}
} }
void void

View File

@ -235,6 +235,7 @@ CPhysical::GetBoundRect(void)
return CRect(center.x-radius, center.y-radius, center.x+radius, center.y+radius); return CRect(center.x-radius, center.y-radius, center.x+radius, center.y+radius);
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddToMovingList(void) CPhysical::AddToMovingList(void)
{ {
@ -242,6 +243,7 @@ CPhysical::AddToMovingList(void)
m_movingListNode = CWorld::GetMovingEntityList().InsertItem(this); m_movingListNode = CWorld::GetMovingEntityList().InsertItem(this);
} }
// --MIAMI: Proof-read once
void void
CPhysical::RemoveFromMovingList(void) CPhysical::RemoveFromMovingList(void)
{ {
@ -261,12 +263,14 @@ CPhysical::SetDamagedPieceRecord(uint16 piece, float impulse, CEntity *entity, C
m_vecDamageNormal = dir; m_vecDamageNormal = dir;
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddCollisionRecord(CEntity *ent) CPhysical::AddCollisionRecord(CEntity *ent)
{ {
AddCollisionRecord_Treadable(ent); AddCollisionRecord_Treadable(ent);
this->bHasCollided = true; this->bHasCollided = true;
ent->bHasCollided = true; ent->bHasCollided = true;
this->m_nLastTimeCollided = CTimer::GetTimeInMilliseconds();
if(IsVehicle() && ent->IsVehicle()){ if(IsVehicle() && ent->IsVehicle()){
if(((CVehicle*)this)->m_nAlarmState == -1) if(((CVehicle*)this)->m_nAlarmState == -1)
((CVehicle*)this)->m_nAlarmState = 15000; ((CVehicle*)this)->m_nAlarmState = 15000;
@ -280,10 +284,10 @@ CPhysical::AddCollisionRecord(CEntity *ent)
return; return;
if(m_nCollisionRecords < PHYSICAL_MAX_COLLISIONRECORDS) if(m_nCollisionRecords < PHYSICAL_MAX_COLLISIONRECORDS)
m_aCollisionRecords[m_nCollisionRecords++] = ent; m_aCollisionRecords[m_nCollisionRecords++] = ent;
m_nLastTimeCollided = CTimer::GetTimeInMilliseconds();
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddCollisionRecord_Treadable(CEntity *ent) CPhysical::AddCollisionRecord_Treadable(CEntity *ent)
{ {
@ -291,6 +295,7 @@ CPhysical::AddCollisionRecord_Treadable(CEntity *ent)
} }
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::GetHasCollidedWith(CEntity *ent) CPhysical::GetHasCollidedWith(CEntity *ent)
{ {
@ -302,20 +307,23 @@ CPhysical::GetHasCollidedWith(CEntity *ent)
return false; return false;
} }
// --MIAMI: Proof-read once
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++;
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos) CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos)
{ {
@ -332,6 +340,7 @@ CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phy
CWorld::Add(phys); CWorld::Add(phys);
} }
// --MIAMI: Proof-read once
int32 int32
CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
{ {
@ -350,6 +359,7 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
return numSpheres; return numSpheres;
} }
// --MIAMI: Proof-read once
void void
CPhysical::ProcessControl(void) CPhysical::ProcessControl(void)
{ {
@ -417,6 +427,7 @@ CPhysical::GetSpeed(const CVector &r)
return m_vecMoveSpeed + m_vecMoveFriction + CrossProduct(m_vecTurnFriction + m_vecTurnSpeed, r); return m_vecMoveSpeed + m_vecMoveFriction + CrossProduct(m_vecTurnFriction + m_vecTurnSpeed, r);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyMoveSpeed(void) CPhysical::ApplyMoveSpeed(void)
{ {
@ -426,7 +437,7 @@ CPhysical::ApplyMoveSpeed(void)
GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep()); GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep());
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyTurnSpeed(void) CPhysical::ApplyTurnSpeed(void)
{ {
@ -442,12 +453,14 @@ CPhysical::ApplyTurnSpeed(void)
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyMoveForce(float jx, float jy, float jz) CPhysical::ApplyMoveForce(float jx, float jy, float jz)
{ {
m_vecMoveSpeed += CVector(jx, jy, jz)*(1.0f/m_fMass); m_vecMoveSpeed += CVector(jx, jy, jz)*(1.0f/m_fMass);
} }
// --MIAMI: Proof-read once
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)
{ {
@ -462,6 +475,7 @@ CPhysical::ApplyFrictionMoveForce(float jx, float jy, float jz)
m_vecMoveFriction += CVector(jx, jy, jz)*(1.0f/m_fMass); m_vecMoveFriction += CVector(jx, jy, jz)*(1.0f/m_fMass);
} }
// --MIAMI: Proof-read once
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)
{ {
@ -470,6 +484,7 @@ CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass); m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias) CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias)
{ {
@ -483,6 +498,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVector &point, float springRatio, float bias, CVector &forceDir) CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVector &point, float springRatio, float bias, CVector &forceDir)
{ {
@ -500,6 +516,7 @@ CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVecto
return true; return true;
} }
// --MIAMI: Proof-read once
// What exactly is speed? // What exactly is speed?
bool bool
CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed) CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed)
@ -560,17 +577,16 @@ CPhysical::ApplyFriction(void)
m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f); m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyAirResistance(void) CPhysical::ApplyAirResistance(void)
{ {
if(m_fAirResistance > 0.1f){ if(m_fAirResistance > 0.1f){
if(GetStatus() != STATUS_GHOST){ float f = Pow(m_fAirResistance, CTimer::GetTimeStep());
float f = Pow(m_fAirResistance, CTimer::GetTimeStep()); m_vecMoveSpeed *= f;
m_vecMoveSpeed *= f; m_vecTurnSpeed *= f;
m_vecTurnSpeed *= f; }else if(GetStatus() != STATUS_GHOST){
} float f = Pow(1.0f/Abs(1.0f + m_fAirResistance*0.5f*m_vecMoveSpeed.MagnitudeSqr()), CTimer::GetTimeStep());
}else{
float f = Pow(1.0f/(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;
} }
@ -1015,6 +1031,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
{ {
@ -1044,7 +1061,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;
@ -1139,6 +1160,7 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
{ {
@ -1176,7 +1198,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);
@ -1194,6 +1216,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessShiftSectorList(CPtrList *lists) CPhysical::ProcessShiftSectorList(CPtrList *lists)
{ {
@ -1267,7 +1290,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 &&
@ -1282,7 +1306,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()))
@ -1354,6 +1379,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists) CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists)
{ {
@ -1520,6 +1546,7 @@ collision:
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessCollisionSectorList(CPtrList *lists) CPhysical::ProcessCollisionSectorList(CPtrList *lists)
{ {
@ -1656,8 +1683,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
return true; return true;
if(numCollisions == 0 && A == (CEntity*)FindPlayerPed() && Aped->m_pCollidingEntity == B) if(numCollisions == 0 && A == (CEntity*)FindPlayerPed() && Aped->m_pCollidingEntity == B)
Aped->m_pCollidingEntity = nil; Aped->m_pCollidingEntity = nil;
}else if(B->IsBuilding() || B->bIsStuck || B->bInfiniteMass || altcollision){ }else if(B->IsBuilding() || B->bIsStuck || B->m_phy_flagA08 || altcollision){
// This is the case where B doesn't move // This is the case where B doesn't move
B->m_scanCode = CWorld::GetCurrentScanCode(); B->m_scanCode = CWorld::GetCurrentScanCode();
@ -1925,18 +1951,22 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(B->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetModelInfo(B->GetModelIndex())->GetColModel()->boundingBox.GetSize();
size = B->GetMatrix() * size; size = B->GetMatrix() * size;
if(size.z < B->GetPosition().z || if(size.z < A->GetPosition().z ||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f) (Invert(A->GetMatrix(), inv) * size).z < 0.0f)
Bobj->ObjectDamage(50.0f); Bobj->ObjectDamage(50.0f);
} }
}else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){ }else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){
if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f) if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Aobj->ObjectDamage(maxImpulseB); Aobj->ObjectDamage(maxImpulseB);
#ifdef FIX_BUGS
else if(Aobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){ else if(Aobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){
#else
else if(Bobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){
#endif
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(A->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetModelInfo(A->GetModelIndex())->GetColModel()->boundingBox.GetSize();
size = A->GetMatrix() * size; size = A->GetMatrix() * size;
if(size.z < A->GetPosition().z || if(size.z < B->GetPosition().z ||
(Invert(B->GetMatrix(), inv) * size).z < 0.0f) (Invert(B->GetMatrix(), inv) * size).z < 0.0f)
Aobj->ObjectDamage(50.0f); Aobj->ObjectDamage(50.0f);
} }
@ -1987,6 +2017,7 @@ CPhysical::CheckCollision_SimpleCar(void)
float PHYSICAL_SHIFT_SPEED_DAMP = 0.707f; float PHYSICAL_SHIFT_SPEED_DAMP = 0.707f;
// --MIAMI: Proof-read once
void void
CPhysical::ProcessShift(void) CPhysical::ProcessShift(void)
{ {
@ -1997,8 +2028,8 @@ CPhysical::ProcessShift(void)
RemoveAndAdd(); RemoveAndAdd();
}else{ }else{
CPhysical *surf; CPhysical *surf;
if(bHasHitWall && IsPed() && (surf = ((CPed*)this)->m_pCurrentPhysSurface, surf == nil || !surf->bInfiniteMass || surf->m_phy_flagA08) || if(bHasHitWall && (IsPed() && (surf = ((CPed*)this)->m_pCurrentPhysSurface, surf == nil || !surf->bInfiniteMass || surf->m_phy_flagA08) ||
CWorld::bSecondShift){ CWorld::bSecondShift)){
m_vecMoveSpeed *= Pow(PHYSICAL_SHIFT_SPEED_DAMP, CTimer::GetTimeStep()); m_vecMoveSpeed *= Pow(PHYSICAL_SHIFT_SPEED_DAMP, CTimer::GetTimeStep());
m_vecTurnSpeed *= Pow(PHYSICAL_SHIFT_SPEED_DAMP, CTimer::GetTimeStep()); m_vecTurnSpeed *= Pow(PHYSICAL_SHIFT_SPEED_DAMP, CTimer::GetTimeStep());
} }

View File

@ -111,7 +111,7 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint
option.m_TargetMenu = targetMenu; option.m_TargetMenu = targetMenu;
} }
void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName) void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName, bool disableIfGameLoaded)
{ {
int8 screenOptionOrder = RegisterNewOption(); int8 screenOptionOrder = RegisterNewOption();
@ -133,6 +133,7 @@ void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align
option.m_CFOSelect->save = saveName; option.m_CFOSelect->save = saveName;
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter; option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
option.m_CFOSelect->changeFunc = changeFunc; option.m_CFOSelect->changeFunc = changeFunc;
option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded;
} }
void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName) void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName)

View File

@ -78,7 +78,7 @@ void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false);
// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0 // var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0
void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE); void FrontendOptionAddBuiltinAction(const char* gxtKey, uint16 x, uint16 y, uint8 align, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE);
void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil); void FrontendOptionAddSelect(const char* gxtKey, uint16 x, uint16 y, uint8 align, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil, bool disableIfGameLoaded = false);
void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil); void FrontendOptionAddDynamic(const char* gxtKey, uint16 x, uint16 y, uint8 align, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil);
// lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT // lineHeight = 0 means game will use MENU_DEFAULT_LINE_HEIGHT

View File

@ -14,6 +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); }

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