1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 17:30:00 +00:00

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

This commit is contained in:
Nikolay Korolev 2020-06-08 01:01:39 +03:00
commit 5ec46bcdfb
9 changed files with 97 additions and 39 deletions

View file

@ -1127,7 +1127,7 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
} }
} }
pVehicle->bWarnedPeds = true; pVehicle->bWarnedPeds = true;
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS) if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS || pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS)
return maxSpeed; return maxSpeed;
return (maxSpeed + pVehicle->AutoPilot.GetCruiseSpeed()) / 2; return (maxSpeed + pVehicle->AutoPilot.GetCruiseSpeed()) / 2;
} }
@ -1226,13 +1226,13 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
if (pVehicle->GetModelIndex() == MI_RCBANDIT){ if (pVehicle->GetModelIndex() == MI_RCBANDIT){
if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit) if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
}else if (dotVelocity > 0.3f){ }else if (dotVelocity > 0.3f) {
if (sideLength - 0.5f < sidewaysDistance) if (sideLength + 0.1f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
else else
pPed->SetEvasiveDive(pVehicle, 0); pPed->SetEvasiveDive(pVehicle, 0);
}else{ }else if (dotVelocity > 0.1f) {
if (sideLength + 0.1f < sidewaysDistance) if (sideLength - 0.5f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
else else
pPed->SetEvasiveDive(pVehicle, 0); pPed->SetEvasiveDive(pVehicle, 0);
@ -1261,7 +1261,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
CPlayerPed* pPlayerPed = (CPlayerPed*)pPed; CPlayerPed* pPlayerPed = (CPlayerPed*)pPed;
if (pPlayerPed->IsPlayer() && dotDirection < frontSafe && if (pPlayerPed->IsPlayer() && dotDirection < frontSafe &&
pPlayerPed->IsPedInControl() && pPlayerPed->IsPedInControl() &&
pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking && pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking &&
CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) { CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) {
pPlayerPed->AnnoyPlayerPed(false); pPlayerPed->AnnoyPlayerPed(false);
pPlayerPed->SetLookFlag(pVehicle, true); pPlayerPed->SetLookFlag(pVehicle, true);
@ -2751,10 +2751,12 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
if (PickNextNodeAccordingStrategy(pVehicle)) { if (PickNextNodeAccordingStrategy(pVehicle)) {
switch (pVehicle->AutoPilot.m_nCarMission){ switch (pVehicle->AutoPilot.m_nCarMission){
case MISSION_GOTOCOORDS: case MISSION_GOTOCOORDS:
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x, SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake); pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return; return;
case MISSION_GOTOCOORDS_ACCURATE: case MISSION_GOTOCOORDS_ACCURATE:
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x, SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake); pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return; return;

View file

@ -2268,7 +2268,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->SetStatus(STATUS_PHYSICS); car->SetStatus(STATUS_PHYSICS);
car->bEngineOn = true; car->bEngineOn = true;
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); car->AutoPilot.m_nCruiseSpeed = Max(1, car->AutoPilot.m_nCruiseSpeed);
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0; return 0;
} }

View file

@ -2198,26 +2198,24 @@ CCamera::ProcessWideScreenOn(void)
void void
CCamera::DrawBordersForWideScreen(void) CCamera::DrawBordersForWideScreen(void)
{ {
float bottomBorderTopY, topBorderBottomY;
if (m_WideScreenOn) {
float centerY = (SCREEN_HEIGHT / 2) * (m_ScreenReductionPercentage / 100.f);
topBorderBottomY = centerY - SCREEN_SCALE_Y(22.f);
bottomBorderTopY = SCREEN_HEIGHT - centerY - SCREEN_SCALE_Y(14.f);
} else {
topBorderBottomY = 0.f;
bottomBorderTopY = SCREEN_HEIGHT;
}
if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL) if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL)
SetMotionBlurAlpha(80); SetMotionBlurAlpha(80);
CSprite2d::DrawRect( // top border
#ifdef FIX_BUGS CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, topBorderBottomY), CRGBA(0, 0, 0, 255));
CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f),
#else
CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f,
#endif
SCREEN_WIDTH, 0.0f),
CRGBA(0, 0, 0, 255));
CSprite2d::DrawRect( // bottom border
CRect(0.0f, SCREEN_HEIGHT, CSprite2d::DrawRect(CRect(0.0f, bottomBorderTopY, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
#ifdef FIX_BUGS
SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f)),
#else
SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f),
#endif
CRGBA(0, 0, 0, 255));
} }

View file

@ -3272,7 +3272,7 @@ CMenuManager::MessageScreen(const char *text, bool blackBg)
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
} }
// TODO(Miami) // --MIAMI: Done
void void
CMenuManager::SmallMessageScreen(const char* text) CMenuManager::SmallMessageScreen(const char* text)
{ {
@ -3284,9 +3284,19 @@ CMenuManager::SmallMessageScreen(const char* text)
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetCentreSize(SCREEN_SCALE_X(430.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(430.0f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetColor(CRGBA(255, 217, 106, FadeIn(255))); CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255)));
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE)); CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE));
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get(text));
int numOfLines = CFont::GetNumberLines(SCREEN_WIDTH / 2.f, SCREEN_SCALE_Y(135.f), TheText.Get(text));
float y;
if (numOfLines > 1)
y = SCREEN_SCALE_Y(192.f) - numOfLines * SCREEN_SCALE_Y(8.f);
else
y = SCREEN_SCALE_Y(182.f);
CFont::PrintString(SCREEN_WIDTH / 2.f, y, TheText.Get(text));
} }
void void

View file

@ -2064,6 +2064,10 @@ CWorld::Process(void)
movingPed->bInVehicle = false; movingPed->bInVehicle = false;
movingPed->QuitEnteringCar(); movingPed->QuitEnteringCar();
} }
} else if (movingPed->m_attachedTo) {
movingPed->PositionAttachedPed();
movingPed->GetMatrix().UpdateRW();
movingPed->UpdateRwFrame();
} }
} }
} }

View file

@ -234,18 +234,13 @@ DoFade(void)
fadeColor.a = alpha; fadeColor.a = alpha;
} }
// This is CCamera::GetScreenRect in VC
if(TheCamera.m_WideScreenOn){ if(TheCamera.m_WideScreenOn){
// what's this?
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f; float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f; rect.left = 0.0f;
rect.right = SCREEN_WIDTH; rect.right = SCREEN_WIDTH;
#ifdef FIX_BUGS rect.top = y - SCREEN_SCALE_Y(22.0f);
rect.top = y - SCREEN_SCALE_Y(8.0f); rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(14.0f);
rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(8.0f);
#else
rect.top = y - 8.0f;
rect.bottom = SCREEN_HEIGHT - y - 8.0f;
#endif // FIX_BUGS
}else{ }else{
rect.left = 0.0f; rect.left = 0.0f;
rect.right = SCREEN_WIDTH; rect.right = SCREEN_WIDTH;

View file

@ -18809,7 +18809,7 @@ CPed::AttachPedToEntity(CEntity *ent, CVector offset, uint16 type, float rot, eW
m_attachedTo->RegisterReference(&m_attachedTo); m_attachedTo->RegisterReference(&m_attachedTo);
m_vecAttachOffset = offset; m_vecAttachOffset = offset;
m_attachType = type; m_attachType = type;
m_attachRot = rot; m_attachRotStep = rot;
if (IsPlayer()) { if (IsPlayer()) {
bUsesCollision = false; bUsesCollision = false;
} else if (ent->IsVehicle()) { } else if (ent->IsVehicle()) {
@ -18843,8 +18843,7 @@ CPed::AttachPedToEntity(CEntity *ent, CVector offset, uint16 type, float rot, eW
SetCurrentWeapon(weapon); SetCurrentWeapon(weapon);
} }
// TODO(Miami) PositionAttachedPed();
// PositionAttachedPed();
} }
// --MIAMI: Done // --MIAMI: Done
@ -19198,6 +19197,55 @@ CPed::DriveVehicle(void)
} }
} }
// --MIAMI: Done
void
CPed::PositionAttachedPed()
{
CMatrix rotMatrix, targetMat;
targetMat = m_attachedTo->GetMatrix();
targetMat.GetPosition() += Multiply3x3(m_attachedTo->GetMatrix(), m_vecAttachOffset);
float objAngle = m_attachedTo->GetForward().Heading();
if (!IsPlayer()) {
float targetAngle = objAngle;
switch (m_attachType) {
case 1:
targetAngle += HALFPI;
break;
case 2:
targetAngle += PI;
break;
case 3:
targetAngle -= HALFPI;
break;
default:
break;
}
targetAngle = CGeneral::LimitRadianAngle(targetAngle);
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
float neededTurn = m_fRotationCur - targetAngle;
if (neededTurn > PI)
neededTurn -= TWOPI;
else if (neededTurn < -PI)
neededTurn += TWOPI;
if (neededTurn > m_attachRotStep)
m_fRotationCur = CGeneral::LimitRadianAngle(targetAngle + m_attachRotStep);
else if (-m_attachRotStep > neededTurn)
m_fRotationCur = CGeneral::LimitRadianAngle(targetAngle - m_attachRotStep);
else
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
}
rotMatrix.SetRotateZ(m_fRotationCur - objAngle);
targetMat = targetMat * rotMatrix;
GetMatrix() = targetMat;
if (m_attachedTo->IsVehicle() || m_attachedTo->IsObject()) {
m_vecMoveSpeed = ((CPhysical*)m_attachedTo)->m_vecMoveSpeed;
m_vecTurnSpeed = ((CPhysical*)m_attachedTo)->m_vecTurnSpeed;
}
}
void void
PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount) PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount)
{ {

View file

@ -616,7 +616,7 @@ public:
CEntity *m_attachedTo; CEntity *m_attachedTo;
CVector m_vecAttachOffset; CVector m_vecAttachOffset;
uint16 m_attachType; uint16 m_attachType;
float m_attachRot; float m_attachRotStep;
uint32 m_attachWepAmmo; uint32 m_attachWepAmmo;
uint32 m_threatFlags; uint32 m_threatFlags;
uint32 m_threatCheck; uint32 m_threatCheck;
@ -841,6 +841,7 @@ public:
void DettachPedFromEntity(); void DettachPedFromEntity();
void PedShuffle(); void PedShuffle();
void DriveVehicle(); void DriveVehicle();
void PositionAttachedPed();
// Static methods // Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset); static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);

View file

@ -20,7 +20,7 @@
#include "TxdStore.h" #include "TxdStore.h"
#include "User.h" #include "User.h"
#include "World.h" #include "World.h"
#include <animation\CutsceneMgr.h> #include "CutsceneMgr.h"
// Game has colors inlined in code. // Game has colors inlined in code.
// For easier modification we collect them here: // For easier modification we collect them here: