mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 19:14:15 +01:00
New math wrappers
from miami
This commit is contained in:
parent
98dd771d6c
commit
7e32c603fc
@ -108,7 +108,7 @@ public:
|
||||
if (angle >= TWOPI)
|
||||
angle -= TWOPI;
|
||||
|
||||
return (int)floorf(angle / DEGTORAD(45.0f));
|
||||
return (int)Floor(angle / DEGTORAD(45.0f));
|
||||
}
|
||||
|
||||
// Unlike usual string comparison functions, these don't care about greater or lesser
|
||||
|
@ -746,8 +746,8 @@ void CRadar::DrawRadarMap()
|
||||
DrawRadarMask();
|
||||
|
||||
// top left ist (0, 0)
|
||||
int x = floorf((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
|
||||
int y = ceilf((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
|
||||
int x = Floor((vec2DRadarOrigin.x - RADAR_MIN_X) / RADAR_TILE_SIZE);
|
||||
int y = Ceil((RADAR_NUM_TILES - 1) - (vec2DRadarOrigin.y - RADAR_MIN_Y) / RADAR_TILE_SIZE);
|
||||
StreamRadarSections(x, y);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
@ -1251,7 +1251,7 @@ void CRadar::Shutdown()
|
||||
|
||||
void CRadar::StreamRadarSections(const CVector &posn)
|
||||
{
|
||||
StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
|
||||
StreamRadarSections(Floor((2000.0f + posn.x) / 500.0f), Ceil(7.0f - (2000.0f + posn.y) / 500.0f));
|
||||
}
|
||||
|
||||
void CRadar::StreamRadarSections(int32 x, int32 y)
|
||||
|
@ -15,3 +15,5 @@ inline float Sqrt(float x) { return sqrtf(x); }
|
||||
inline float RecipSqrt(float x, float y) { return x/Sqrt(y); }
|
||||
inline float RecipSqrt(float x) { return RecipSqrt(1.0f, x); }
|
||||
inline float Pow(float x, float y) { return powf(x, y); }
|
||||
inline float Floor(float x) { return floorf(x); }
|
||||
inline float Ceil(float x) { return ceilf(x); }
|
||||
|
@ -9349,7 +9349,7 @@ CPed::ProcessControl(void)
|
||||
m_collidingEntityWhileFleeing = collidingEnt;
|
||||
m_collidingEntityWhileFleeing->RegisterReference((CEntity **) &m_collidingEntityWhileFleeing);
|
||||
|
||||
uint8 currentDir = floorf((PI + m_fRotationCur) / DEGTORAD(45.0f));
|
||||
uint8 currentDir = Floor((PI + m_fRotationCur) / DEGTORAD(45.0f));
|
||||
uint8 nextDir;
|
||||
ThePaths.FindNextNodeWandering(PATH_PED, GetPosition(), &m_pLastPathNode, &m_pNextPathNode, currentDir, &nextDir);
|
||||
|
||||
|
@ -857,9 +857,9 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
|
||||
|
||||
// prestep x1 and x2 to next integer y
|
||||
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
|
||||
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
|
||||
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
|
||||
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
|
||||
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
|
||||
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
|
||||
|
||||
if(y != yend){
|
||||
if(deltaB < 0.0f && (int)xB < xstart)
|
||||
@ -904,7 +904,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
|
||||
xstart = poly[b1].x;
|
||||
}while(y == (int)poly[b2].y);
|
||||
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
|
||||
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
|
||||
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
|
||||
if(deltaB < 0.0f && (int)xB < xstart)
|
||||
xstart = xB;
|
||||
}
|
||||
@ -940,7 +940,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
|
||||
xend = poly[a1].x;
|
||||
}while(y == (int)poly[a2].y);
|
||||
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
|
||||
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
|
||||
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
|
||||
if(deltaA >= 0.0f && (int)xA > xend)
|
||||
xend = xA;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user