2019-05-15 10:52:37 -04:00
|
|
|
#include "common.h"
|
2019-06-12 15:17:02 -04:00
|
|
|
#include "patcher.h"
|
2019-06-17 04:30:02 -04:00
|
|
|
#include "main.h"
|
2019-06-12 15:17:02 -04:00
|
|
|
#include "lights.h"
|
|
|
|
#include "PointLights.h"
|
|
|
|
#include "RpAnimBlend.h"
|
|
|
|
#include "AnimBlendClumpData.h"
|
|
|
|
#include "Renderer.h"
|
|
|
|
#include "ModelIndices.h"
|
|
|
|
#include "Shadows.h"
|
|
|
|
#include "TimeCycle.h"
|
2019-05-15 10:52:37 -04:00
|
|
|
#include "CutsceneObject.h"
|
2019-06-12 14:07:37 -04:00
|
|
|
|
|
|
|
CCutsceneObject::CCutsceneObject(void)
|
|
|
|
{
|
|
|
|
m_status = STATUS_SIMPLE;
|
|
|
|
bUsesCollision = false;
|
2019-06-27 08:17:42 -04:00
|
|
|
bStreamingDontDelete = true;
|
2019-06-12 14:07:37 -04:00
|
|
|
ObjectCreatedBy = CUTSCENE_OBJECT;
|
|
|
|
m_fMass = 1.0f;
|
|
|
|
m_fTurnMass = 1.0f;
|
|
|
|
}
|
2019-06-12 15:17:02 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
CCutsceneObject::SetModelIndex(uint32 id)
|
|
|
|
{
|
|
|
|
CEntity::SetModelIndex(id);
|
|
|
|
assert(RwObjectGetType(m_rwObject) == rpCLUMP);
|
|
|
|
RpAnimBlendClumpInit((RpClump*)m_rwObject);
|
|
|
|
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed;
|
|
|
|
(*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CCutsceneObject::ProcessControl(void)
|
|
|
|
{
|
|
|
|
CPhysical::ProcessControl();
|
|
|
|
|
|
|
|
if(CTimer::GetTimeStep() < 1/100.0f)
|
|
|
|
m_vecMoveSpeed *= 100.0f;
|
|
|
|
else
|
|
|
|
m_vecMoveSpeed *= 1.0f/CTimer::GetTimeStep();
|
|
|
|
|
|
|
|
ApplyMoveSpeed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CCutsceneObject::PreRender(void)
|
|
|
|
{
|
|
|
|
if(IsPedModel(GetModelIndex()))
|
|
|
|
CShadows::StoreShadowForPedObject(this,
|
|
|
|
CTimeCycle::m_fShadowDisplacementX[CTimeCycle::m_CurrentStoredValue],
|
|
|
|
CTimeCycle::m_fShadowDisplacementY[CTimeCycle::m_CurrentStoredValue],
|
|
|
|
CTimeCycle::m_fShadowFrontX[CTimeCycle::m_CurrentStoredValue],
|
|
|
|
CTimeCycle::m_fShadowFrontY[CTimeCycle::m_CurrentStoredValue],
|
|
|
|
CTimeCycle::m_fShadowSideX[CTimeCycle::m_CurrentStoredValue],
|
|
|
|
CTimeCycle::m_fShadowSideY[CTimeCycle::m_CurrentStoredValue]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CCutsceneObject::Render(void)
|
|
|
|
{
|
|
|
|
CObject::Render();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CCutsceneObject::SetupLighting(void)
|
|
|
|
{
|
|
|
|
ActivateDirectional();
|
|
|
|
SetAmbientColoursForPedsCarsAndObjects();
|
|
|
|
|
|
|
|
if(bRenderScorched){
|
|
|
|
WorldReplaceNormalLightsWithScorched(Scene.world, 0.1f);
|
|
|
|
}else{
|
|
|
|
CVector coors = GetPosition();
|
|
|
|
float lighting = CPointLights::GenerateLightsAffectingObject(&coors);
|
2019-06-22 05:42:21 -04:00
|
|
|
if(!bHasBlip && lighting != 1.0f){
|
2019-06-12 15:17:02 -04:00
|
|
|
SetAmbientAndDirectionalColours(lighting);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CCutsceneObject::RemoveLighting(bool reset)
|
|
|
|
{
|
|
|
|
CRenderer::RemoveVehiclePedLights(this, reset);
|
|
|
|
}
|
|
|
|
|
|
|
|
STARTPATCHES
|
|
|
|
InjectHook(0x4BA980, &CCutsceneObject::SetModelIndex_, PATCH_JUMP);
|
|
|
|
InjectHook(0x4BA9C0, &CCutsceneObject::ProcessControl_, PATCH_JUMP);
|
|
|
|
InjectHook(0x4BAA40, &CCutsceneObject::PreRender_, PATCH_JUMP);
|
|
|
|
InjectHook(0x4BAAA0, &CCutsceneObject::Render_, PATCH_JUMP);
|
|
|
|
InjectHook(0x4A7E70, &CCutsceneObject::SetupLighting_, PATCH_JUMP);
|
|
|
|
InjectHook(0x4A7F00, &CCutsceneObject::RemoveLighting_, PATCH_JUMP);
|
|
|
|
ENDPATCHES
|