summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-08-28 12:58:42 +0200
committerGitHub <noreply@github.com>2019-08-28 12:58:42 +0200
commit792893df594b8cd09d7e9e8486148aa0126eef3a (patch)
treef775059bd6cd968b096f989243e496bea776ae4f /src/core
parentMerge pull request #197 from Nick007J/master (diff)
parentAudio fixes (diff)
downloadre3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar.gz
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar.bz2
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar.lz
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar.xz
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.tar.zst
re3-792893df594b8cd09d7e9e8486148aa0126eef3a.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/CdStream.cpp4
-rw-r--r--src/core/EventList.cpp2
-rw-r--r--src/core/Explosion.cpp24
-rw-r--r--src/core/Explosion.h9
-rw-r--r--src/core/FileMgr.cpp8
-rw-r--r--src/core/FileMgr.h4
-rw-r--r--src/core/Frontend.cpp4
-rw-r--r--src/core/Game.cpp2
-rw-r--r--src/core/General.h2
-rw-r--r--src/core/Instance.h1
-rw-r--r--src/core/Placeable.cpp2
-rw-r--r--src/core/common.h15
-rw-r--r--src/core/re3.cpp4
14 files changed, 57 insertions, 26 deletions
diff --git a/src/core/Camera.h b/src/core/Camera.h
index c617c3d7..1f38963b 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -442,7 +442,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson;
bool Get_Just_Switched_Status() { return m_bJust_Switched; }
- inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; }
+ inline const CMatrix& GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp
index 255e46bb..57b1cbe2 100644
--- a/src/core/CdStream.cpp
+++ b/src/core/CdStream.cpp
@@ -5,8 +5,8 @@
#include "rwcore.h"
#include "RwHelper.h"
-#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", __VA_ARGS__)
-#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", __VA_ARGS__)
+#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
+#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
struct CdReadInfo
{
diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp
index a833cc8e..caf0cb3f 100644
--- a/src/core/EventList.cpp
+++ b/src/core/EventList.cpp
@@ -4,7 +4,7 @@
#include "ModelIndices.h"
#include "World.h"
#include "Wanted.h"
-#include "Eventlist.h"
+#include "EventList.h"
int32 CEventList::ms_nFirstFreeSlotIndex;
//CEvent gaEvent[NUMEVENTS];
diff --git a/src/core/Explosion.cpp b/src/core/Explosion.cpp
index f55cbcd6..9ccd6e81 100644
--- a/src/core/Explosion.cpp
+++ b/src/core/Explosion.cpp
@@ -3,3 +3,27 @@
#include "Explosion.h"
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
+
+WRAPPER
+int8 CExplosion::GetExplosionActiveCounter(uint8 id)
+{
+ EAXJMP(0x559140);
+}
+
+WRAPPER
+CVector *CExplosion::GetExplosionPosition(uint8 id)
+{
+ EAXJMP(0x5591A0);
+}
+
+WRAPPER
+uint8 CExplosion::GetExplosionType(uint8 id)
+{
+ EAXJMP(0x559180);
+}
+
+WRAPPER
+void CExplosion::ResetExplosionActiveCounter(uint8 id)
+{
+ EAXJMP(0x559160);
+}
diff --git a/src/core/Explosion.h b/src/core/Explosion.h
index 93d60ab3..fde4ad7f 100644
--- a/src/core/Explosion.h
+++ b/src/core/Explosion.h
@@ -1,6 +1,7 @@
#pragma once
class CEntity;
+class CVector;
enum eExplosionType
{
@@ -19,5 +20,11 @@ enum eExplosionType
class CExplosion
{
public:
- static void AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32);
+ static void AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type,
+ const CVector &pos, uint32);
+
+ static int8 GetExplosionActiveCounter(uint8 id);
+ static CVector *GetExplosionPosition(uint8 id);
+ static uint8 GetExplosionType(uint8 id);
+ static void ResetExplosionActiveCounter(uint8 id);
};
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..effcb0b4 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", "",
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index e07106ce..b488a217 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -1,7 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "Game.h"
-#include "Main.h"
+#include "main.h"
#include "CdStream.h"
#include "FileMgr.h"
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/Instance.h b/src/core/Instance.h
index 1038c005..bb74ea84 100644
--- a/src/core/Instance.h
+++ b/src/core/Instance.h
@@ -7,4 +7,5 @@
class CInstance : CPlaceable
{
public:
+ ~CInstance() = default;
};
diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp
index c1fe705e..d2cec82b 100644
--- a/src/core/Placeable.cpp
+++ b/src/core/Placeable.cpp
@@ -7,7 +7,7 @@ CPlaceable::CPlaceable(void)
m_matrix.SetScale(1.0f);
}
-CPlaceable::~CPlaceable(void) { }
+CPlaceable::~CPlaceable(void) = default;
void
CPlaceable::SetHeading(float angle)
diff --git a/src/core/common.h b/src/core/common.h
index 36f67bfa..b3a271c6 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,16 +171,16 @@ 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();
-#define debug(f, ...) re3_debug("[DBG]: " f, __VA_ARGS__)
-#define DEV(f, ...) re3_debug("[DEV]: " f, __VA_ARGS__)
-#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, __VA_ARGS__)
-#define Error(f, ...) re3_debug("[ERROR]: " f, __VA_ARGS__)
+#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
+#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
+#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
+#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
#define ASSERT assert
@@ -200,7 +200,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
-
#define STRINGIFY(x) #x
#define STR(x) STRINGIFY(x)
#define CONCAT_(x,y) x##y
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;