summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.cpp10
-rw-r--r--src/core/Collision.cpp8
-rw-r--r--src/core/FileMgr.cpp8
-rw-r--r--src/core/FileMgr.h4
-rw-r--r--src/core/Frontend.cpp6
-rw-r--r--src/core/General.h2
-rw-r--r--src/core/IniFile.cpp4
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/Streaming.cpp42
-rw-r--r--src/core/Wanted.cpp2
-rw-r--r--src/core/common.h10
-rw-r--r--src/core/main.cpp2
-rw-r--r--src/core/re3.cpp4
13 files changed, 53 insertions, 53 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index cb16c3ad..f15232f3 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -209,7 +209,7 @@ WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSp
else if(TargetSpeed > 0.0f && *CurrentSpeed > TargetSpeed)
*CurrentSpeed = TargetSpeed;
- *CurrentValue += *CurrentSpeed * min(10.0f, CTimer::GetTimeStep());
+ *CurrentValue += *CurrentSpeed * Min(10.0f, CTimer::GetTimeStep());
}
void
@@ -697,7 +697,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
// Process height offset to avoid peds and cars
float TargetZOffSet = m_fUnknownZOffSet + m_fDimensionOfHighestNearCar;
- TargetZOffSet = max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
+ TargetZOffSet = Max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
if(TargetHeight > m_fCamBufferedHeight){
@@ -753,7 +753,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
}
}
- TargetCoors.z += min(1.0f, m_fCamBufferedHeight/2.0f);
+ TargetCoors.z += Min(1.0f, m_fCamBufferedHeight/2.0f);
m_cvecTargetCoorsForFudgeInter = TargetCoors;
Front = TargetCoors - Source;
@@ -991,7 +991,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
}
if(FoundCamRoof){
// Camera is under something
- float roof = FoundRoofCenter ? min(CamRoof, CarRoof) : CamRoof;
+ float roof = FoundRoofCenter ? Min(CamRoof, CarRoof) : CamRoof;
// Same weirdness again?
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
CamClear = false;
@@ -1249,7 +1249,7 @@ void
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
{
CA_MAX_DISTANCE = BaseDist + 0.1f + TheCamera.CarZoomValueSmooth;
- CA_MIN_DISTANCE = min(BaseDist*0.6f, 3.5f);
+ CA_MIN_DISTANCE = Min(BaseDist*0.6f, 3.5f);
CVector Dist = Source - TargetCoors;
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 66b29d9f..538bcae6 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -153,10 +153,10 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
// on water we expect to be between levels
multipleLevels = true;
}else{
- xmin = max(sx - 1, 0);
- xmax = min(sx + 1, NUMSECTORS_X-1);
- ymin = max(sy - 1, 0);
- ymax = min(sy + 1, NUMSECTORS_Y-1);
+ xmin = Max(sx - 1, 0);
+ xmax = Min(sx + 1, NUMSECTORS_X-1);
+ ymin = Max(sy - 1, 0);
+ ymax = Min(sy + 1, NUMSECTORS_Y-1);
for(x = xmin; x <= xmax; x++)
for(y = ymin; y <= ymax; y++){
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp
index 954fcdef..2a8628b0 100644
--- a/src/core/FileMgr.cpp
+++ b/src/core/FileMgr.cpp
@@ -248,15 +248,15 @@ CFileMgr::OpenFileForWriting(const char *file)
}
int
-CFileMgr::Read(int fd, char *buf, int len)
+CFileMgr::Read(int fd, const char *buf, int len)
{
- return myfread(buf, 1, len, fd);
+ return myfread((void*)buf, 1, len, fd);
}
int
-CFileMgr::Write(int fd, char *buf, int len)
+CFileMgr::Write(int fd, const char *buf, int len)
{
- return myfwrite(buf, 1, len, fd);
+ return myfwrite((void*)buf, 1, len, fd);
}
bool
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index bab86e38..3df0c7d8 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -12,8 +12,8 @@ public:
static int LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFileForWriting(const char *file);
- static int Read(int fd, char *buf, int len);
- static int Write(int fd, char *buf, int len);
+ static int Read(int fd, const char *buf, int len);
+ static int Write(int fd, const char *buf, int len);
static bool Seek(int fd, int offset, int whence);
static bool ReadLine(int fd, char *buf, int len);
static int CloseFile(int fd);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 1de5c94f..f4545f7b 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -95,7 +95,7 @@ bool GetMouseMoveRight();
bool GetPadInput();
bool GetMouseInput();
-char *FrontendFilenames[] = {
+const char *FrontendFilenames[] = {
"fe2_mainpanel_ul",
"fe2_mainpanel_ur",
"fe2_mainpanel_dl",
@@ -126,7 +126,7 @@ char *FrontendFilenames[] = {
"fe_radio9", // CHATTERBOX
};
-char *MenuFilenames[] = {
+const char *MenuFilenames[] = {
"connection24", "",
"findgame24", "",
"hostgame24", "",
@@ -1030,7 +1030,7 @@ int CMenuManager::FadeIn(int alpha)
m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS ||
m_nCurrScreen == MENUPAGE_DELETING)
return alpha;
- return min(m_nMenuFadeAlpha, alpha);
+ return Min(m_nMenuFadeAlpha, alpha);
}
#endif
diff --git a/src/core/General.h b/src/core/General.h
index 8f9aa044..366c571c 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -97,7 +97,7 @@ public:
}
// should return direction in 0-8 range. fits perfectly to peds' path directions.
- static int CGeneral::GetNodeHeadingFromVector(float x, float y)
+ static int GetNodeHeadingFromVector(float x, float y)
{
float angle = CGeneral::GetRadianAngleBetweenPoints(x, y, 0.0f, 0.0f);
if (angle < 0.0f)
diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp
index 08b30876..46dceff3 100644
--- a/src/core/IniFile.cpp
+++ b/src/core/IniFile.cpp
@@ -17,10 +17,10 @@ void CIniFile::LoadIniFile()
if (f){
CFileMgr::ReadLine(f, gString, 200);
sscanf(gString, "%f", &PedNumberMultiplier);
- PedNumberMultiplier = min(3.0f, max(0.5f, PedNumberMultiplier));
+ PedNumberMultiplier = Min(3.0f, Max(0.5f, PedNumberMultiplier));
CFileMgr::ReadLine(f, gString, 200);
sscanf(gString, "%f", &CarNumberMultiplier);
- CarNumberMultiplier = min(3.0f, max(0.5f, CarNumberMultiplier));
+ CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
CFileMgr::CloseFile(f);
}
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index f334a255..b5086d64 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -299,10 +299,10 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
{ if ( State1.button || State2.button ) ReconState.button = 255; }
#define _RECONCILE_AXIS_POSITIVE(axis) \
- { if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = max(State1.axis, State2.axis); }
+ { if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = Max(State1.axis, State2.axis); }
#define _RECONCILE_AXIS_NEGATIVE(axis) \
- { if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = min(State1.axis, State2.axis); }
+ { if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = Min(State1.axis, State2.axis); }
#define _RECONCILE_AXIS(axis) \
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index a7bde91e..8158cd1d 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1940,7 +1940,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
lodDistSq = sq(mi->GetLargestLodDistance());
- lodDistSq = min(lodDistSq, sq(STREAM_DIST));
+ lodDistSq = Min(lodDistSq, sq(STREAM_DIST));
pos = CVector2D(e->GetPosition());
if(xmin < pos.x && pos.x < xmax &&
ymin < pos.y && pos.y < ymax &&
@@ -2160,20 +2160,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
// looking west/east
- ymin = max(iy - 10, 0);
- ymax = min(iy + 10, NUMSECTORS_Y);
+ ymin = Max(iy - 10, 0);
+ ymax = Min(iy + 10, NUMSECTORS_Y);
assert(ymin <= ymax);
// Delete a block of sectors that we know is behind the camera
if(TheCamera.GetForward().x > 0){
// looking east
- xmax = max(ix - 2, 0);
- xmin = max(ix - 10, 0);
+ xmax = Max(ix - 2, 0);
+ xmin = Max(ix - 10, 0);
inc = 1;
}else{
// looking west
- xmax = min(ix + 2, NUMSECTORS_X);
- xmin = min(ix + 10, NUMSECTORS_X);
+ xmax = Min(ix + 2, NUMSECTORS_X);
+ xmin = Min(ix + 10, NUMSECTORS_X);
inc = -1;
}
for(y = ymin; y <= ymax; y++){
@@ -2189,13 +2189,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
// Now a block that intersects with the camera's frustum
if(TheCamera.GetForward().x > 0){
// looking east
- xmax = max(ix + 10, 0);
- xmin = max(ix - 2, 0);
+ xmax = Max(ix + 10, 0);
+ xmin = Max(ix - 2, 0);
inc = 1;
}else{
// looking west
- xmax = min(ix - 10, NUMSECTORS_X);
- xmin = min(ix + 2, NUMSECTORS_X);
+ xmax = Min(ix - 10, NUMSECTORS_X);
+ xmin = Min(ix + 2, NUMSECTORS_X);
inc = -1;
}
for(y = ymin; y <= ymax; y++){
@@ -2224,20 +2224,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
}else{
// looking north/south
- xmin = max(ix - 10, 0);
- xmax = min(ix + 10, NUMSECTORS_X);
+ xmin = Max(ix - 10, 0);
+ xmax = Min(ix + 10, NUMSECTORS_X);
assert(xmin <= xmax);
// Delete a block of sectors that we know is behind the camera
if(TheCamera.GetForward().y > 0){
// looking north
- ymax = max(iy - 2, 0);
- ymin = max(iy - 10, 0);
+ ymax = Max(iy - 2, 0);
+ ymin = Max(iy - 10, 0);
inc = 1;
}else{
// looking south
- ymax = min(iy + 2, NUMSECTORS_Y);
- ymin = min(iy + 10, NUMSECTORS_Y);
+ ymax = Min(iy + 2, NUMSECTORS_Y);
+ ymin = Min(iy + 10, NUMSECTORS_Y);
inc = -1;
}
for(x = xmin; x <= xmax; x++){
@@ -2253,13 +2253,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
// Now a block that intersects with the camera's frustum
if(TheCamera.GetForward().y > 0){
// looking north
- ymax = max(iy + 10, 0);
- ymin = max(iy - 2, 0);
+ ymax = Max(iy + 10, 0);
+ ymin = Max(iy - 2, 0);
inc = 1;
}else{
// looking south
- ymax = min(iy - 10, NUMSECTORS_Y);
- ymin = min(iy + 2, NUMSECTORS_Y);
+ ymax = Min(iy - 10, NUMSECTORS_Y);
+ ymin = Min(iy + 2, NUMSECTORS_Y);
inc = -1;
}
for(x = xmin; x <= xmax; x++){
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 26b115e3..daed9155 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -209,7 +209,7 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
else
sensitivity = m_fCrimeSensitivity;
- wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
+ wantedLevelDrop = Min(CCullZones::GetWantedLevelDrop(), 100);
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
if (policeDoesntCare)
diff --git a/src/core/common.h b/src/core/common.h
index 73e57c21..d1f71720 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -156,7 +156,7 @@ public:
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))
-#define PI M_PI
+#define PI (float)M_PI
#define TWOPI (PI*2)
#define HALFPI (PI/2)
#define DEGTORAD(x) ((x) * PI / 180.0f)
@@ -171,8 +171,8 @@ inline float sq(float x) { return x*x; }
int myrand(void);
void mysrand(unsigned int seed);
-void re3_debug(char *format, ...);
-void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...);
+void re3_debug(const char *format, ...);
+void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...);
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func);
#define DEBUGBREAK() __debugbreak();
@@ -195,8 +195,8 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#define BIT(num) (1<<(num))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define Max(a, b) (((a) > (b)) ? (a) : (b))
+#define Min(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 50494ef3..a82a2ab8 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -453,7 +453,7 @@ DoFade(void)
CRGBA fadeColor;
CRect rect;
int fadeValue = CDraw::FadeValue;
- float brightness = min(CMenuManager::m_PrefsBrightness, 256);
+ float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
if(brightness <= 50)
brightness = 50;
if(FrontEndMenuManager.m_bMenuActive)
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index ad3838bd..9737fddb 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -425,7 +425,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
abort();
}
-void re3_debug(char *format, ...)
+void re3_debug(const char *format, ...)
{
va_list va;
va_start(va, format);
@@ -435,7 +435,7 @@ void re3_debug(char *format, ...)
printf("%s", re3_buff);
}
-void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...)
+void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
{
char buff[re3_buffsize *2];
va_list va;