mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 11:29:59 +00:00
Reorder CEntity functions into their original order
This commit is contained in:
parent
06df781bca
commit
b9e97ab79d
|
@ -21,6 +21,83 @@ CReferences::Init(void)
|
||||||
aRefs[NUMREFERENCES-1].next = nil;
|
aRefs[NUMREFERENCES-1].next = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CEntity::RegisterReference(CEntity **pent)
|
||||||
|
{
|
||||||
|
if(IsBuilding())
|
||||||
|
return;
|
||||||
|
CReference *ref;
|
||||||
|
// check if already registered
|
||||||
|
for(ref = m_pFirstReference; ref; ref = ref->next)
|
||||||
|
if(ref->pentity == pent)
|
||||||
|
return;
|
||||||
|
// have to allocate new reference
|
||||||
|
ref = CReferences::pEmptyList;
|
||||||
|
if(ref){
|
||||||
|
CReferences::pEmptyList = ref->next;
|
||||||
|
|
||||||
|
ref->pentity = pent;
|
||||||
|
ref->next = m_pFirstReference;
|
||||||
|
m_pFirstReference = ref;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up the reference from *pent -> 'this'
|
||||||
|
void
|
||||||
|
CEntity::CleanUpOldReference(CEntity **pent)
|
||||||
|
{
|
||||||
|
CReference* ref, ** lastnextp;
|
||||||
|
lastnextp = &m_pFirstReference;
|
||||||
|
for (ref = m_pFirstReference; ref; ref = ref->next) {
|
||||||
|
if (ref->pentity == pent) {
|
||||||
|
*lastnextp = ref->next;
|
||||||
|
ref->next = CReferences::pEmptyList;
|
||||||
|
CReferences::pEmptyList = ref;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lastnextp = &ref->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear all references to this entity
|
||||||
|
void
|
||||||
|
CEntity::ResolveReferences(void)
|
||||||
|
{
|
||||||
|
CReference *ref;
|
||||||
|
// clear pointers to this entity
|
||||||
|
for(ref = m_pFirstReference; ref; ref = ref->next)
|
||||||
|
if(*ref->pentity == this)
|
||||||
|
*ref->pentity = nil;
|
||||||
|
// free list
|
||||||
|
if(m_pFirstReference){
|
||||||
|
for(ref = m_pFirstReference; ref->next; ref = ref->next)
|
||||||
|
;
|
||||||
|
ref->next = CReferences::pEmptyList;
|
||||||
|
CReferences::pEmptyList = m_pFirstReference;
|
||||||
|
m_pFirstReference = nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free all references that no longer point to this entity
|
||||||
|
void
|
||||||
|
CEntity::PruneReferences(void)
|
||||||
|
{
|
||||||
|
CReference *ref, *next, **lastnextp;
|
||||||
|
lastnextp = &m_pFirstReference;
|
||||||
|
for(ref = m_pFirstReference; ref; ref = next){
|
||||||
|
next = ref->next;
|
||||||
|
if(*ref->pentity == this)
|
||||||
|
lastnextp = &ref->next;
|
||||||
|
else{
|
||||||
|
*lastnextp = ref->next;
|
||||||
|
ref->next = CReferences::pEmptyList;
|
||||||
|
CReferences::pEmptyList = ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CReferences::RemoveReferencesToPlayer(void)
|
CReferences::RemoveReferencesToPlayer(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1643,14 +1643,24 @@ CWorld::ExtinguishAllCarFiresInArea(CVector point, float range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
AddSteamsFromGround(CPtrList& list)
|
||||||
|
{
|
||||||
|
CPtrNode* pNode = list.first;
|
||||||
|
while (pNode) {
|
||||||
|
((CEntity*)pNode->item)->AddSteamsFromGround(nil);
|
||||||
|
pNode = pNode->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CWorld::AddParticles(void)
|
CWorld::AddParticles(void)
|
||||||
{
|
{
|
||||||
for(int32 y = 0; y < NUMSECTORS_Y; y++) {
|
for(int32 y = 0; y < NUMSECTORS_Y; y++) {
|
||||||
for(int32 x = 0; x < NUMSECTORS_X; x++) {
|
for(int32 x = 0; x < NUMSECTORS_X; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
|
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
|
||||||
CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
|
AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -130,7 +130,7 @@ public:
|
||||||
virtual void PreRender(void);
|
virtual void PreRender(void);
|
||||||
virtual void Render(void);
|
virtual void Render(void);
|
||||||
virtual bool SetupLighting(void);
|
virtual bool SetupLighting(void);
|
||||||
virtual void RemoveLighting(bool) {}
|
virtual void RemoveLighting(bool);
|
||||||
virtual void FlagToDestroyWhenNextProcessed(void) {}
|
virtual void FlagToDestroyWhenNextProcessed(void) {}
|
||||||
|
|
||||||
bool IsBuilding(void) { return m_type == ENTITY_TYPE_BUILDING; }
|
bool IsBuilding(void) { return m_type == ENTITY_TYPE_BUILDING; }
|
||||||
|
@ -149,14 +149,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetBoundCentre(CVector &out);
|
void GetBoundCentre(CVector &out);
|
||||||
CVector GetBoundCentre(void) { CVector v; GetBoundCentre(v); return v; }
|
CVector GetBoundCentre(void);
|
||||||
float GetBoundRadius(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; }
|
float GetBoundRadius(void);
|
||||||
float GetDistanceFromCentreOfMassToBaseOfModel(void) { return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z; }
|
float GetDistanceFromCentreOfMassToBaseOfModel(void);
|
||||||
bool GetIsTouching(CVector const ¢er, float r);
|
bool GetIsTouching(CVector const ¢er, float r);
|
||||||
bool GetIsOnScreen(void);
|
bool GetIsOnScreen(void);
|
||||||
bool GetIsOnScreenComplex(void);
|
bool GetIsOnScreenComplex(void);
|
||||||
bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); }
|
bool IsVisible(void);
|
||||||
bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); }
|
bool IsVisibleComplex(void);
|
||||||
bool IsEntityOccluded(void);
|
bool IsEntityOccluded(void);
|
||||||
int16 GetModelIndex(void) const { return m_modelIndex; }
|
int16 GetModelIndex(void) const { return m_modelIndex; }
|
||||||
void UpdateRwFrame(void);
|
void UpdateRwFrame(void);
|
||||||
|
@ -179,8 +179,6 @@ public:
|
||||||
void ModifyMatrixForBannerInWind(void);
|
void ModifyMatrixForBannerInWind(void);
|
||||||
void ProcessLightsForEntity(void);
|
void ProcessLightsForEntity(void);
|
||||||
void SetRwObjectAlpha(int32 alpha);
|
void SetRwObjectAlpha(int32 alpha);
|
||||||
|
|
||||||
static void AddSteamsFromGround(CPtrList& list);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool IsEntityPointerValid(CEntity*);
|
bool IsEntityPointerValid(CEntity*);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
|
#include "Entity.h"
|
||||||
#include "RenderBuffer.h"
|
#include "RenderBuffer.h"
|
||||||
#include "TxdStore.h"
|
#include "TxdStore.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
@ -12,6 +13,10 @@
|
||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "Coronas.h"
|
#include "Coronas.h"
|
||||||
|
#include "PointLights.h"
|
||||||
|
#include "Shadows.h"
|
||||||
|
#include "Clock.h"
|
||||||
|
#include "Bridge.h"
|
||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
|
||||||
|
@ -715,3 +720,234 @@ CRegisteredCorona::Update(void)
|
||||||
firstUpdate = false;
|
firstUpdate = false;
|
||||||
registeredThisFrame = false;
|
registeredThisFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CEntity::ProcessLightsForEntity(void)
|
||||||
|
{
|
||||||
|
int i, n;
|
||||||
|
C2dEffect *effect;
|
||||||
|
CVector pos;
|
||||||
|
bool lightOn, lightFlickering;
|
||||||
|
uint32 flashTimer1, flashTimer2, flashTimer3;
|
||||||
|
|
||||||
|
if(bRenderDamaged || !bIsVisible || GetUp().z < 0.96f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
flashTimer1 = 0;
|
||||||
|
flashTimer2 = 0;
|
||||||
|
flashTimer3 = 0;
|
||||||
|
|
||||||
|
n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects();
|
||||||
|
for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){
|
||||||
|
effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i);
|
||||||
|
|
||||||
|
switch(effect->type){
|
||||||
|
case EFFECT_LIGHT:
|
||||||
|
pos = GetMatrix() * effect->pos;
|
||||||
|
|
||||||
|
lightOn = false;
|
||||||
|
lightFlickering = false;
|
||||||
|
switch(effect->light.lightType){
|
||||||
|
case LIGHT_ON:
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_ON_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLICKER:
|
||||||
|
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
|
||||||
|
lightOn = true;
|
||||||
|
else
|
||||||
|
lightFlickering = true;
|
||||||
|
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLICKER_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){
|
||||||
|
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
|
||||||
|
lightOn = true;
|
||||||
|
else
|
||||||
|
lightFlickering = true;
|
||||||
|
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3)
|
||||||
|
lightOn = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH1:
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH1_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH2:
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH2_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH3:
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_FLASH3_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
|
||||||
|
if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_RANDOM_FLICKER:
|
||||||
|
if(m_randomSeed > 16)
|
||||||
|
lightOn = true;
|
||||||
|
else{
|
||||||
|
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60)
|
||||||
|
lightOn = true;
|
||||||
|
else
|
||||||
|
lightFlickering = true;
|
||||||
|
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3)
|
||||||
|
lightOn = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LIGHT_RANDOM_FLICKER_NIGHT:
|
||||||
|
if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
|
||||||
|
if(m_randomSeed > 16)
|
||||||
|
lightOn = true;
|
||||||
|
else{
|
||||||
|
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60)
|
||||||
|
lightOn = true;
|
||||||
|
else
|
||||||
|
lightFlickering = true;
|
||||||
|
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3)
|
||||||
|
lightOn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LIGHT_BRIDGE_FLASH1:
|
||||||
|
if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
case LIGHT_BRIDGE_FLASH2:
|
||||||
|
if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60)
|
||||||
|
lightOn = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(effect->light.flags & LIGHTFLAG_HIDE_OBJECT){
|
||||||
|
if(lightOn)
|
||||||
|
bDoNotRender = false;
|
||||||
|
else
|
||||||
|
bDoNotRender = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Corona
|
||||||
|
if(lightOn)
|
||||||
|
CCoronas::RegisterCorona((uintptr)this + i,
|
||||||
|
effect->col.r, effect->col.g, effect->col.b, 255,
|
||||||
|
pos, effect->light.size, effect->light.dist,
|
||||||
|
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
|
||||||
|
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f,
|
||||||
|
!!(effect->light.flags&LIGHTFLAG_LONG_DIST));
|
||||||
|
else if(lightFlickering)
|
||||||
|
CCoronas::RegisterCorona((uintptr)this + i,
|
||||||
|
0, 0, 0, 255,
|
||||||
|
pos, effect->light.size, effect->light.dist,
|
||||||
|
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
|
||||||
|
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f,
|
||||||
|
!!(effect->light.flags&LIGHTFLAG_LONG_DIST));
|
||||||
|
|
||||||
|
// Pointlight
|
||||||
|
bool alreadyProcessedFog;
|
||||||
|
alreadyProcessedFog = false;
|
||||||
|
if(effect->light.range != 0.0f && lightOn){
|
||||||
|
if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){
|
||||||
|
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||||
|
pos, CVector(0.0f, 0.0f, 0.0f),
|
||||||
|
effect->light.range,
|
||||||
|
0.0f, 0.0f, 0.0f,
|
||||||
|
CPointLights::FOG_NONE, true);
|
||||||
|
}else{
|
||||||
|
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||||
|
pos, CVector(0.0f, 0.0f, 0.0f),
|
||||||
|
effect->light.range,
|
||||||
|
effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f,
|
||||||
|
effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f,
|
||||||
|
effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f,
|
||||||
|
(effect->light.flags & LIGHTFLAG_FOG) >> 1,
|
||||||
|
true);
|
||||||
|
alreadyProcessedFog = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!alreadyProcessedFog){
|
||||||
|
if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){
|
||||||
|
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS,
|
||||||
|
pos, CVector(0.0f, 0.0f, 0.0f),
|
||||||
|
0.0f,
|
||||||
|
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
|
||||||
|
CPointLights::FOG_ALWAYS, true);
|
||||||
|
}else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){
|
||||||
|
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY,
|
||||||
|
pos, CVector(0.0f, 0.0f, 0.0f),
|
||||||
|
0.0f,
|
||||||
|
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
|
||||||
|
CPointLights::FOG_NORMAL, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Light shadow
|
||||||
|
if(effect->light.shadowSize != 0.0f){
|
||||||
|
if(lightOn){
|
||||||
|
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
|
||||||
|
effect->light.shadow, &pos,
|
||||||
|
effect->light.shadowSize, 0.0f,
|
||||||
|
0.0f, -effect->light.shadowSize,
|
||||||
|
128,
|
||||||
|
effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
|
||||||
|
effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
|
||||||
|
effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
|
||||||
|
15.0f, 1.0f, 40.0f, false, 0.0f);
|
||||||
|
}else if(lightFlickering){
|
||||||
|
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
|
||||||
|
effect->light.shadow, &pos,
|
||||||
|
effect->light.shadowSize, 0.0f,
|
||||||
|
0.0f, -effect->light.shadowSize,
|
||||||
|
0, 0.0f, 0.0f, 0.0f,
|
||||||
|
15.0f, 1.0f, 40.0f, false, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFFECT_SUNGLARE:
|
||||||
|
if(CWeather::SunGlare >= 0.0f){
|
||||||
|
CVector pos = GetMatrix() * effect->pos;
|
||||||
|
CVector glareDir = pos - GetPosition();
|
||||||
|
glareDir.Normalise();
|
||||||
|
CVector camDir = TheCamera.GetPosition() - pos;
|
||||||
|
float dist = camDir.Magnitude();
|
||||||
|
camDir *= 2.0f/dist;
|
||||||
|
glareDir += camDir;
|
||||||
|
glareDir.Normalise();
|
||||||
|
float camAngle = -DotProduct(glareDir, CTimeCycle::GetSunDirection());
|
||||||
|
if(camAngle > 0.0f){
|
||||||
|
float intens = Sqrt(camAngle) * CWeather::SunGlare;
|
||||||
|
pos += camDir;
|
||||||
|
CCoronas::RegisterCorona((uintptr)this + 33 + i,
|
||||||
|
intens * (CTimeCycle::GetSunCoreRed() + 2*255)/3.0f,
|
||||||
|
intens * (CTimeCycle::GetSunCoreGreen() + 2*255)/3.0f,
|
||||||
|
intens * (CTimeCycle::GetSunCoreBlue() + 2*255)/3.0f,
|
||||||
|
255,
|
||||||
|
pos, 0.5f*CWeather::SunGlare*Sqrt(dist), 120.0f,
|
||||||
|
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE,
|
||||||
|
CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF,
|
||||||
|
CCoronas::STREAK_OFF, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "Entity.h"
|
||||||
#include "Occlusion.h"
|
#include "Occlusion.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
@ -493,3 +494,36 @@ void COcclusion::Render() {
|
||||||
DefinedState();
|
DefinedState();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool CEntity::IsEntityOccluded(void) {
|
||||||
|
|
||||||
|
CVector coors;
|
||||||
|
float width, height;
|
||||||
|
|
||||||
|
if (COcclusion::NumActiveOccluders == 0 || !CalcScreenCoors(GetBoundCentre(), &coors, &width, &height))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
float area = Max(width, height) * GetBoundRadius() * 0.9f;
|
||||||
|
|
||||||
|
for (int i = 0; i < COcclusion::NumActiveOccluders; i++) {
|
||||||
|
if (coors.z - (GetBoundRadius() * 0.85f) > COcclusion::aActiveOccluders[i].radius) {
|
||||||
|
if (COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, area)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) {
|
||||||
|
CVector min = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.min;
|
||||||
|
CVector max = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.max;
|
||||||
|
|
||||||
|
if (CalcScreenCoors(min, &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
|
||||||
|
if (CalcScreenCoors(CVector(max.x, max.y, min.z), &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
|
||||||
|
if (CalcScreenCoors(CVector(max.x, min.y, max.z), &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
|
||||||
|
if (CalcScreenCoors(CVector(min.x, max.y, max.z), &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -2472,3 +2472,43 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CEntity::AddSteamsFromGround(CVector *unused)
|
||||||
|
{
|
||||||
|
int i, n;
|
||||||
|
C2dEffect *effect;
|
||||||
|
CVector pos;
|
||||||
|
|
||||||
|
n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects();
|
||||||
|
for(i = 0; i < n; i++){
|
||||||
|
effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i);
|
||||||
|
if(effect->type != EFFECT_PARTICLE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pos = GetMatrix() * effect->pos;
|
||||||
|
switch(effect->particle.particleType){
|
||||||
|
case 0:
|
||||||
|
CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
CParticleObject::AddObject(POBJECT_DRY_ICE, pos, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_VERT, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_HORIZ, pos, effect->particle.dir, effect->particle.scale, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1497,6 +1497,17 @@ CRenderer::RequestObjectsInFrustum(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CEntity::SetupLighting(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CEntity::RemoveLighting(bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// --MIAMI: Done
|
// --MIAMI: Done
|
||||||
bool
|
bool
|
||||||
CPed::SetupLighting(void)
|
CPed::SetupLighting(void)
|
||||||
|
|
|
@ -289,26 +289,6 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
|
||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
RpAtomic*
|
|
||||||
AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
|
||||||
{
|
|
||||||
if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))){
|
|
||||||
RpHAnimHierarchy *hier = RpSkinAtomicGetHAnimHierarchy(atomic);
|
|
||||||
#ifdef LIBRW
|
|
||||||
if(hier && hier->interpolator->currentAnim){
|
|
||||||
RpHAnimAnimationDestroy(hier->interpolator->currentAnim);
|
|
||||||
hier->interpolator->currentAnim = nil;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(hier && hier->currentAnim){
|
|
||||||
RpHAnimAnimationDestroy(hier->currentAnim->pCurrentAnim);
|
|
||||||
hier->currentAnim = nil;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return atomic;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RenderSkeleton(RpHAnimHierarchy *hier)
|
RenderSkeleton(RpHAnimHierarchy *hier)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue