summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-11 22:21:26 +0200
committeraap <aap@papnet.eu>2020-05-11 22:21:26 +0200
commit0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2 (patch)
tree16bf11e0e8a0353448a643322e9511e8ba659fca /src/core
parentCVisibilityPlugins (diff)
parentMerge remote-tracking branch 'origin/master' into miami (diff)
downloadre3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar.gz
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar.bz2
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar.lz
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar.xz
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.tar.zst
re3-0eb5f93e96bfc4b31c0bde01e9f1296b3b612bc2.zip
Diffstat (limited to '')
-rw-r--r--src/core/Cam.cpp3
-rw-r--r--src/core/Camera.h20
-rw-r--r--src/core/CdStream.cpp1
-rw-r--r--src/core/CdStream.h1
-rw-r--r--src/core/Frontend.h2
-rw-r--r--src/core/Game.cpp19
-rw-r--r--src/core/Placeable.h3
-rw-r--r--src/core/Radar.h2
-rw-r--r--src/core/Wanted.h2
-rw-r--r--src/core/World.h3
-rw-r--r--src/core/common.h6
-rw-r--r--src/core/config.h3
-rw-r--r--src/core/re3.cpp14
13 files changed, 40 insertions, 39 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index e6a10267..3357c5c0 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4542,6 +4542,9 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(TheCamera.m_bUseTransitionBeta)
Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta));
+ if(TheCamera.m_bUseTransitionBeta)
+ Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta));
+
Front = CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha));
Source = TargetCoors - Front*CamDist;
TargetCoors.z -= BaseOffset; // now get back to the real target coors again
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 51138f99..94bcbd23 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -260,9 +260,8 @@ public:
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
};
-static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
-static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
-static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
+
+VALIDATE_SIZE(CCam, 0x1A4);
class CCamPathSplines
{
@@ -637,19 +636,8 @@ uint32 unknown; // some counter having to do with music
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
};
-static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
-static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
-static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");
-static_assert(offsetof(CCamera, m_uiNumberOfTrainCamNodes) == 0x84, "CCamera: error");
-static_assert(offsetof(CCamera, m_uiTransitionState) == 0x89, "CCamera: error");
-static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error");
-static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
-static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
-static_assert(offsetof(CCamera, pToGarageWeAreIn) == 0x690, "CCamera: error");
-static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: error");
-static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error");
-static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
-static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
+
+VALIDATE_SIZE(CCamera, 0xE9D8);
extern CCamera TheCamera;
diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp
index ea79fb9a..666041e1 100644
--- a/src/core/CdStream.cpp
+++ b/src/core/CdStream.cpp
@@ -22,6 +22,7 @@ struct CdReadInfo
HANDLE hFile;
OVERLAPPED Overlapped;
};
+
VALIDATE_SIZE(CdReadInfo, 0x30);
char gCdImageNames[MAX_CDIMAGES+1][64];
diff --git a/src/core/CdStream.h b/src/core/CdStream.h
index 9ef71b65..ba6c63a3 100644
--- a/src/core/CdStream.h
+++ b/src/core/CdStream.h
@@ -27,7 +27,6 @@ struct Queue
VALIDATE_SIZE(Queue, 0x10);
-
void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels);
uint32 GetGTA3ImgSize(void);
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index a6ca4aa0..99597a15 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -660,7 +660,7 @@ public:
};
#ifndef IMPROVED_VIDEOMODE
-static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
+VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 3ea85659..2ba3ae3a 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -221,22 +221,9 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 )
{
CMenuManager::m_PrefsSpeakers = 0;
-
- for ( int32 i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++ )
- {
- wchar buff[64];
-
- char *name = DMAudio.Get3DProviderName(i);
- AsciiToUnicode(name, buff);
- char *providername = UnicodeToAscii(buff);
- strupr(providername);
-
- if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") )
- {
- FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i;
- break;
- }
- }
+ int8 provider = DMAudio.AutoDetect3DProviders();
+ if ( provider != -1 )
+ FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider;
}
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index 7e858283..970c0d48 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -31,4 +31,5 @@ public:
bool IsWithinArea(float x1, float y1, float x2, float y2);
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
};
-static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); \ No newline at end of file
+
+VALIDATE_SIZE(CPlaceable, 0x4C);
diff --git a/src/core/Radar.h b/src/core/Radar.h
index e39a17f0..7d07671d 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -71,7 +71,7 @@ struct sRadarTrace
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
-static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
+VALIDATE_SIZE(sRadarTrace, 0x30);
// Values for screen space
#define RADAR_LEFT (40.0f)
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index 0e0e70c3..99ca6e4b 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -55,4 +55,4 @@ public:
static void SetMaximumWantedLevel(int32 level);
};
-static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
+VALIDATE_SIZE(CWanted, 0x204);
diff --git a/src/core/World.h b/src/core/World.h
index 19d480ff..bc905bf5 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -45,7 +45,8 @@ class CSector
public:
CPtrList m_lists[NUMSECTORENTITYLISTS];
};
-static_assert(sizeof(CSector) == 0x28, "CSector: error");
+
+VALIDATE_SIZE(CSector, 0x28);
class CEntity;
struct CColPoint;
diff --git a/src/core/common.h b/src/core/common.h
index 8f400a46..ed331bbb 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -213,6 +213,7 @@ void mysrand(unsigned int seed);
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);
+void re3_usererror(const char *format, ...);
#define DEBUGBREAK() __debugbreak();
@@ -220,6 +221,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#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 USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
#define ASSERT assert
@@ -227,7 +229,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define _TODO(x)
#define _TODOCONST(x) (x)
+#ifdef CHECK_STRUCT_SIZES
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
+#else
+#define VALIDATE_SIZE(struc, size)
+#endif
#define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...")
#define PERCENT(x, p) ((float(x) * (float(p) / 100.0f)))
diff --git a/src/core/config.h b/src/core/config.h
index 78fca69b..816d3771 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -199,7 +199,8 @@ enum Config {
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define USE_TEXTURE_POOL
-//#define OPENAL
+//#define AUDIO_OAL
+#define AUDIO_MSS
// Particle
//#define PC_PARTICLE
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 1915e135..bbac265f 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -465,6 +465,20 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons
OutputDebugStringA(buff);
}
+void re3_usererror(const char *format, ...)
+{
+ va_list va;
+ va_start(va, format);
+ vsprintf_s(re3_buff, re3_buffsize, format, va);
+ va_end(va);
+
+ ::MessageBoxA(nil, re3_buff, "RE3 Error!",
+ MB_OK|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);
+
+ raise(SIGABRT);
+ _exit(3);
+}
+
#ifdef VALIDATE_SAVE_SIZE
int32 _saveBufCount;
#endif