CWaterCreatures

This commit is contained in:
majestic
2020-10-08 19:22:50 -07:00
35 changed files with 1065 additions and 514 deletions

View File

@ -366,6 +366,12 @@ COcclusion::ProcessBeforeRendering(void)
}
NumActiveOccluders--;
i--;
// Taken from Mobile!
#ifdef FIX_BUGS
if (i == -1) {
i = 0;
}
#endif
}
}
}
@ -481,4 +487,4 @@ void COcclusion::Render() {
DefinedState();
}
#endif
#endif

View File

@ -1220,8 +1220,11 @@ void CParticle::Update()
if ( psystem->m_Type == PARTICLE_HEATHAZE || psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST )
{
#ifdef FIX_BUGS
int32 nSinCosIndex = (int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) + SIN_COS_TABLE_SIZE) % SIN_COS_TABLE_SIZE;
#else
int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE;
#endif
vecMoveStep.x = Sin(nSinCosIndex);
vecMoveStep.y = Sin(nSinCosIndex);
@ -1233,8 +1236,11 @@ void CParticle::Update()
if ( psystem->m_Type == PARTICLE_BEASTIE )
{
#ifdef FIX_BUGS
int32 nSinCosIndex = (int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) + SIN_COS_TABLE_SIZE) % SIN_COS_TABLE_SIZE;
#else
int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE;
#endif
particle->m_vecVelocity.x = 0.50f * Cos(nSinCosIndex);
particle->m_vecVelocity.y = Cos(nSinCosIndex);
particle->m_vecVelocity.z = 0.25f * Sin(nSinCosIndex);
@ -1750,7 +1756,11 @@ void CParticle::Update()
}
if ( particle->m_nRotationStep != 0 )
#ifdef FIX_BUGS
particle->m_nRotation = CGeneral::LimitAngle(particle->m_nRotation + particle->m_nRotationStep);
#else
particle->m_nRotation += particle->m_nRotationStep;
#endif
if ( particle->m_fCurrentZRadius != 0.0f )
{
@ -2403,7 +2413,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
{
float fHeadingRad = entity->GetForward().Heading();
float fHeading = RADTODEG(fHeadingRad);
float fBirdAngle = Cos(DEGTORAD(1.5f));
float fBirdAngle = ::Cos(DEGTORAD(1.5f));
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[PARTICLE_BIRD_FRONT];
CParticle *particle = psystem->m_pParticles;

View File

@ -160,16 +160,16 @@ void CWaterCreatures::CreateOne(CVector pos, int16 modelID) {
&& CWaterLevel::GetWaterDepth(pos, &fDepth, &fLevelNoWaves, nil) && fDepth > 4.5f) {
if (modelID == -1 || modelID > 64)
modelID = CGeneral::GetRandomNumberInRange(0.0f, 64.0f);
modelID = CGeneral::GetRandomNumberInRange(0, 64);
WaterCreatureProperties *creature = &aProperties[modelID];
pos.z = fLevelNoWaves - creature->fLevel;
float fRightMult = CGeneral::GetRandomNumberInRange(0.0f, 0.01);
float fRightMult = CGeneral::GetRandomNumberInRange(0.0f, 0.01f);
float angle = CWaterCreatures::CalculateFishHeading(FindPlayerPed()->GetPosition(), pos);
CObject *fish = CreateSeaLifeForm(pos, modelID, angle);
if (!fish)
return;
if (!fish) return;
fish->SetRwObjectAlpha(255);
CWaterCreature *wc = GetFishStructSlot();
wc->Allocate(fish, fRightMult, 0.0f, creature->fWaterDepth, 255, WATER_CREATURE_ALLOCATED);