mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 18:20:02 +00:00
commit
c2c65207a3
|
@ -89,6 +89,7 @@
|
||||||
#include "Occlusion.h"
|
#include "Occlusion.h"
|
||||||
#include "debugmenu.h"
|
#include "debugmenu.h"
|
||||||
#include "Ropes.h"
|
#include "Ropes.h"
|
||||||
|
#include "WindModifiers.h"
|
||||||
|
|
||||||
eLevelName CGame::currLevel;
|
eLevelName CGame::currLevel;
|
||||||
int32 CGame::currArea;
|
int32 CGame::currArea;
|
||||||
|
@ -695,6 +696,7 @@ void CGame::Process(void)
|
||||||
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
|
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
|
||||||
FrontEndMenuManager.Process();
|
FrontEndMenuManager.Process();
|
||||||
CStreaming::Update();
|
CStreaming::Update();
|
||||||
|
CWindModifiers::Number = 0;
|
||||||
if (!CTimer::GetIsPaused())
|
if (!CTimer::GetIsPaused())
|
||||||
{
|
{
|
||||||
CTheZones::Update();
|
CTheZones::Update();
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "GameLogic.h"
|
#include "GameLogic.h"
|
||||||
#include "Bike.h"
|
#include "Bike.h"
|
||||||
|
#include "WindModifiers.h"
|
||||||
#include "CutsceneShadow.h"
|
#include "CutsceneShadow.h"
|
||||||
|
|
||||||
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
|
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
|
||||||
|
@ -16425,6 +16426,77 @@ CPed::PreRender(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool bIsWindModifierTurnedOn = false;
|
||||||
|
float fAnyDirectionShift = 1.0f;
|
||||||
|
if (IsPlayer() && CWindModifiers::FindWindModifier(GetPosition(), &fAnyDirectionShift, &fAnyDirectionShift)
|
||||||
|
&& !CCullZones::PlayerNoRain() && GetPedState() != PED_DRIVING)
|
||||||
|
bIsWindModifierTurnedOn = true;
|
||||||
|
|
||||||
|
bool bIsPedDrivingBikeOrOpenTopCar = false;
|
||||||
|
if (GetPedState() == PED_DRIVING && m_pMyVehicle) {
|
||||||
|
if (m_pMyVehicle->m_vehType == VEHICLE_TYPE_BIKE
|
||||||
|
|| (m_pMyVehicle->m_vehType == VEHICLE_TYPE_CAR && m_pMyVehicle->IsOpenTopCar()))
|
||||||
|
bIsPedDrivingBikeOrOpenTopCar = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bIsWindModifierTurnedOn || bIsPedDrivingBikeOrOpenTopCar) {
|
||||||
|
float fWindMult = 0.0f;
|
||||||
|
if (bIsPedDrivingBikeOrOpenTopCar) {
|
||||||
|
fWindMult = DotProduct(m_pMyVehicle->m_vecMoveSpeed, GetForward());
|
||||||
|
if (fWindMult > 0.4f) {
|
||||||
|
float volume = (fWindMult - 0.4f) / 0.6f;
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SET_202, volume); //TODO(MIAMI): revise when audio is done
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bIsWindModifierTurnedOn)
|
||||||
|
fWindMult = Min(fWindMult, Abs(fAnyDirectionShift - 1.0f));
|
||||||
|
|
||||||
|
RpHAnimHierarchy* hier = GetAnimHierarchyFromSkinClump(GetClump());
|
||||||
|
int32 idx;
|
||||||
|
RwV3d scale;
|
||||||
|
float fScaleOffset;
|
||||||
|
|
||||||
|
fScaleOffset = fWindMult * 0.2f;
|
||||||
|
scale.x = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.y = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.z = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_NECK));
|
||||||
|
RwMatrix* neck = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(neck, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
fScaleOffset = fWindMult * 0.1f;
|
||||||
|
scale.x = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.y = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.z = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_CLAVICLEL));
|
||||||
|
RwMatrix* clavicleL = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(clavicleL, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_CLAVICLER));
|
||||||
|
RwMatrix* clavicleR = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(clavicleR, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_MID));
|
||||||
|
RwMatrix* mid = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(mid, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
fScaleOffset = fWindMult * 0.2f;
|
||||||
|
scale.x = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.y = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
scale.z = CGeneral::GetRandomNumberInRange(1.0f - fScaleOffset, 1.0f + fScaleOffset);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERARML));
|
||||||
|
RwMatrix* upperArmL = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(upperArmL, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
|
||||||
|
idx = RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(PED_UPPERARMR));
|
||||||
|
RwMatrix* upperArmR = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
|
||||||
|
RwMatrixScale(upperArmR, &scale, rwCOMBINEPRECONCAT);
|
||||||
|
}
|
||||||
|
|
||||||
if (bBodyPartJustCameOff && bIsPedDieAnimPlaying && m_bodyPartBleeding != -1 && (CTimer::GetFrameCounter() & 7) > 3) {
|
if (bBodyPartJustCameOff && bIsPedDieAnimPlaying && m_bodyPartBleeding != -1 && (CTimer::GetFrameCounter() & 7) > 3) {
|
||||||
CVector bloodDir(0.0f, 0.0f, 0.0f);
|
CVector bloodDir(0.0f, 0.0f, 0.0f);
|
||||||
CVector bloodPos(0.0f, 0.0f, 0.0f);
|
CVector bloodPos(0.0f, 0.0f, 0.0f);
|
||||||
|
|
|
@ -1,13 +1,51 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "WindModifiers.h"
|
#include "WindModifiers.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "General.h"
|
||||||
|
|
||||||
|
#define MAX_HEIGHT_DIST 40.0f
|
||||||
|
#define MIN_FADE_DIST 20.0f
|
||||||
|
#define MAX_FADE_DIST 50.0f
|
||||||
|
|
||||||
|
CWindModifiers Array[16];
|
||||||
|
int32 CWindModifiers::Number;
|
||||||
|
|
||||||
void
|
void
|
||||||
CWindModifiers::RegisterOne(CVector pos, int32 unk)
|
CWindModifiers::RegisterOne(CVector pos, int32 type = 1)
|
||||||
{
|
{
|
||||||
|
if (CWindModifiers::Number < 16 && (pos - TheCamera.GetPosition()).Magnitude() < 100.0f) {
|
||||||
|
Array[Number].m_pos = pos;
|
||||||
|
Array[Number].m_type = type;
|
||||||
|
Number++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
bool
|
||||||
CWindModifiers::FindWindModifier(CVector pos, float *x, float *y)
|
CWindModifiers::FindWindModifier(CVector pos, float *x, float *y)
|
||||||
{
|
{
|
||||||
return 0;
|
bool bWasWindModifierFound = false;
|
||||||
|
CVector2D dir;
|
||||||
|
for (int i = 0; i < Number; i++) {
|
||||||
|
if (Array[i].m_type == 1) {
|
||||||
|
float zDist = Abs(15.0f + pos.z - Array[i].m_pos.z);
|
||||||
|
|
||||||
|
if (zDist < MAX_HEIGHT_DIST) {
|
||||||
|
float dist = (pos - Array[i].m_pos).Magnitude();
|
||||||
|
if (dist < MAX_FADE_DIST) {
|
||||||
|
float distFade = dist < MIN_FADE_DIST ? 1.0f : 1.0f - (dist - MIN_FADE_DIST) / (MAX_FADE_DIST - MIN_FADE_DIST);
|
||||||
|
float heightFade = 1.0f - zDist / MAX_HEIGHT_DIST;
|
||||||
|
dir = (pos - Array[i].m_pos) * heightFade / dist;
|
||||||
|
bWasWindModifierFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bWasWindModifierFound) {
|
||||||
|
float directionMult = ((CGeneral::GetRandomNumber() & 0x1F) - 16) * 0.0035f + 1.0f;
|
||||||
|
*x += dir.x * directionMult;
|
||||||
|
*y += dir.y * directionMult;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bWasWindModifierFound;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
class CWindModifiers
|
class CWindModifiers
|
||||||
{
|
{
|
||||||
|
CVector m_pos;
|
||||||
|
int32 m_type;
|
||||||
public:
|
public:
|
||||||
static void RegisterOne(CVector pos, int32 unk);
|
static int32 Number;
|
||||||
static int32 FindWindModifier(CVector pos, float *x, float *y);
|
static void RegisterOne(CVector pos, int32 windSourceType);
|
||||||
|
static bool FindWindModifier(CVector pos, float *x, float *y);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue