Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fixes, some thanks to ASan
  • Loading branch information
erorcun committed Oct 8, 2020
1 parent b97f86d commit ca950c652b6057b89e87dfd6ae32b55567f79b9a
Showing with 22 additions and 9 deletions.
  1. +3 −3 src/core/Pad.cpp
  2. +6 −3 src/render/Occlusion.cpp
  3. +13 −3 src/render/Particle.cpp
@@ -3209,7 +3209,7 @@ int16 CPad::SniperModeLookLeftRight(void)


if ( Abs(axis) > Abs(dpad) ) { if ( Abs(axis) > Abs(dpad) ) {
if ( Abs(axis) > 35.0f ) { if ( Abs(axis) > 35.0f ) {
return (axis > 0.f ? axis - 35.f : axis + 35.f) * 1.3763441f; return (axis > 0.f ? axis - 35.f : axis + 35.f) * (128.f / (128 - 35));
} else { } else {
return 0; return 0;
} }
@@ -3231,7 +3231,7 @@ int16 CPad::SniperModeLookUpDown(void)


if ( Abs(axis) > Abs(dpad) ) { if ( Abs(axis) > Abs(dpad) ) {
if ( Abs(axis) > 35.0f ) { if ( Abs(axis) > 35.0f ) {
return (axis > 0.f ? axis - 35.f : axis + 35.f) * 1.3763441f; return (axis > 0.f ? axis - 35.f : axis + 35.f) * (128.f / (128 - 35);
} else { } else {
return 0; return 0;
} }
@@ -3573,4 +3573,4 @@ void CPad::FixPadsAfterSave(void)
bObsoleteControllerMessage = false; bObsoleteControllerMessage = false;
GetPad(0)->Phase = 0; GetPad(0)->Phase = 0;
} }
} }
@@ -356,10 +356,13 @@ COcclusion::ProcessBeforeRendering(void)


for (i = 0; i < NumActiveOccluders; i++) { for (i = 0; i < NumActiveOccluders; i++) {
for (int j = 0; j < NumActiveOccluders; j++) { for (int j = 0; j < NumActiveOccluders; j++) {
#ifdef FIX_BUGS
if (i >= 0)
#endif
if (i != j && aActiveOccluders[j].radius < aActiveOccluders[i].radius) { if (i != j && aActiveOccluders[j].radius < aActiveOccluders[i].radius) {
if (OccluderHidesBehind(&aActiveOccluders[i], &aActiveOccluders[j])) { if (OccluderHidesBehind(&aActiveOccluders[i], &aActiveOccluders[j])) {
for (int k = i; k < NumActiveOccluders - 1; k++) { for (int k = i; k < NumActiveOccluders - 1; k++) {
for (int l = 0; l < aActiveOccluders[k + 1].linesCount; l++) for (int l = 0; l < aActiveOccluders[k].linesCount; l++)
aActiveOccluders[k].lines[l] = aActiveOccluders[k + 1].lines[l]; aActiveOccluders[k].lines[l] = aActiveOccluders[k + 1].lines[l];
aActiveOccluders[k].linesCount = aActiveOccluders[k + 1].linesCount; aActiveOccluders[k].linesCount = aActiveOccluders[k + 1].linesCount;
aActiveOccluders[k].radius = aActiveOccluders[k + 1].radius; aActiveOccluders[k].radius = aActiveOccluders[k + 1].radius;
@@ -481,4 +484,4 @@ void COcclusion::Render() {


DefinedState(); DefinedState();
} }
#endif #endif
@@ -1220,8 +1220,11 @@ void CParticle::Update()


if ( psystem->m_Type == PARTICLE_HEATHAZE || psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST ) 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; int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE;
#endif
vecMoveStep.x = Sin(nSinCosIndex); vecMoveStep.x = Sin(nSinCosIndex);
vecMoveStep.y = Sin(nSinCosIndex); vecMoveStep.y = Sin(nSinCosIndex);


@@ -1233,8 +1236,11 @@ void CParticle::Update()


if ( psystem->m_Type == PARTICLE_BEASTIE ) 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; 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.x = 0.50f * Cos(nSinCosIndex);
particle->m_vecVelocity.y = Cos(nSinCosIndex); particle->m_vecVelocity.y = Cos(nSinCosIndex);
particle->m_vecVelocity.z = 0.25f * Sin(nSinCosIndex); particle->m_vecVelocity.z = 0.25f * Sin(nSinCosIndex);
@@ -1750,7 +1756,11 @@ void CParticle::Update()
} }


if ( particle->m_nRotationStep != 0 ) 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; particle->m_nRotation += particle->m_nRotationStep;
#endif


if ( particle->m_fCurrentZRadius != 0.0f ) if ( particle->m_fCurrentZRadius != 0.0f )
{ {
@@ -2403,7 +2413,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
{ {
float fHeadingRad = entity->GetForward().Heading(); float fHeadingRad = entity->GetForward().Heading();
float fHeading = RADTODEG(fHeadingRad); 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]; tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[PARTICLE_BIRD_FRONT];
CParticle *particle = psystem->m_pParticles; CParticle *particle = psystem->m_pParticles;

0 comments on commit ca950c6

Please sign in to comment.