summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2020-12-21 21:26:32 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2020-12-25 10:54:41 +0100
commita50244dc16085a49f4949cf75f6220320480cebd (patch)
tree34a022c699eed9c8651ddbe8391c985753e46b2b
parentMerge branch 'miami' of github.com:GTAmodding/re3 into miami (diff)
downloadre3-a50244dc16085a49f4949cf75f6220320480cebd.tar
re3-a50244dc16085a49f4949cf75f6220320480cebd.tar.gz
re3-a50244dc16085a49f4949cf75f6220320480cebd.tar.bz2
re3-a50244dc16085a49f4949cf75f6220320480cebd.tar.lz
re3-a50244dc16085a49f4949cf75f6220320480cebd.tar.xz
re3-a50244dc16085a49f4949cf75f6220320480cebd.tar.zst
re3-a50244dc16085a49f4949cf75f6220320480cebd.zip
-rw-r--r--src/core/Camera.cpp4
-rw-r--r--src/core/Directory.cpp2
-rw-r--r--src/core/EventList.cpp4
-rw-r--r--src/core/EventList.h2
-rw-r--r--src/core/FileMgr.cpp14
-rw-r--r--src/core/FileMgr.h6
-rw-r--r--src/core/Fire.cpp32
-rw-r--r--src/core/Streaming.h6
-rw-r--r--src/core/Zones.cpp6
-rw-r--r--src/core/common.h5
-rw-r--r--src/peds/PedType.cpp10
-rw-r--r--src/rw/VisibilityPlugins.cpp6
-rw-r--r--src/rw/VisibilityPlugins.h6
-rw-r--r--src/text/Text.cpp6
-rw-r--r--src/weapons/WeaponInfo.cpp2
15 files changed, 57 insertions, 54 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index e11410e2..9c0da263 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -3395,12 +3395,12 @@ CCamera::LoadTrainCamNodes(char const *name)
char token[16] = { 0 };
char filename[16] = { 0 };
uint8 *buf;
- size_t bufpos = 0;
+ ssize_t bufpos = 0;
int field = 0;
int tokpos = 0;
char c;
int i;
- size_t len;
+ ssize_t len;
strcpy(filename, name);
len = (int)strlen(filename);
diff --git a/src/core/Directory.cpp b/src/core/Directory.cpp
index 05344065..046c999d 100644
--- a/src/core/Directory.cpp
+++ b/src/core/Directory.cpp
@@ -31,7 +31,7 @@ bool
CDirectory::WriteDirFile(const char *filename)
{
int fd;
- size_t n;
+ ssize_t n;
fd = CFileMgr::OpenFileForWriting(filename);
n = CFileMgr::Write(fd, (char*)entries, numEntries*sizeof(DirectoryInfo));
CFileMgr::CloseFile(fd);
diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp
index fc345163..8e639656 100644
--- a/src/core/EventList.cpp
+++ b/src/core/EventList.cpp
@@ -120,7 +120,7 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent
}
if(criminal == FindPlayerPed())
- ReportCrimeForEvent(type, (uintptr)ent, copsDontCare);
+ ReportCrimeForEvent(type, (intptr)ent, copsDontCare);
}
void
@@ -198,7 +198,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
}
void
-CEventList::ReportCrimeForEvent(eEventType type, size_t crimeId, bool copsDontCare)
+CEventList::ReportCrimeForEvent(eEventType type, intptr crimeId, bool copsDontCare)
{
eCrimeType crime;
switch(type){
diff --git a/src/core/EventList.h b/src/core/EventList.h
index dcca1270..3e9d8fd4 100644
--- a/src/core/EventList.h
+++ b/src/core/EventList.h
@@ -62,7 +62,7 @@ public:
static bool GetEvent(eEventType type, int32 *event);
static void ClearEvent(int32 event);
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
- static void ReportCrimeForEvent(eEventType type, size_t, bool);
+ static void ReportCrimeForEvent(eEventType type, intptr, bool);
};
extern CEvent gaEvent[NUMEVENTS]; \ No newline at end of file
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp
index d3695cb4..99923ddf 100644
--- a/src/core/FileMgr.cpp
+++ b/src/core/FileMgr.cpp
@@ -240,20 +240,22 @@ CFileMgr::SetDirMyDocuments(void)
mychdir(_psGetUserFilesFolder());
}
-size_t
+ssize_t
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
{
int fd;
- size_t n, len;
+ ssize_t n, len;
fd = myfopen(file, mode);
if(fd == 0)
- return 0;
+ return -1;
len = 0;
do{
n = myfread(buf + len, 1, 0x4000, fd);
- if(n < 0)
+#ifndef FIX_BUGS
+ if (n < 0)
return -1;
+#endif
len += n;
}while(n == 0x4000);
buf[len] = 0;
@@ -274,13 +276,13 @@ CFileMgr::OpenFileForWriting(const char *file)
}
size_t
-CFileMgr::Read(int fd, const char *buf, size_t len)
+CFileMgr::Read(int fd, const char *buf, ssize_t len)
{
return myfread((void*)buf, 1, len, fd);
}
size_t
-CFileMgr::Write(int fd, const char *buf, size_t len)
+CFileMgr::Write(int fd, const char *buf, ssize_t len)
{
return myfwrite((void*)buf, 1, len, fd);
}
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index 8278953b..98a78360 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -9,12 +9,12 @@ public:
static void ChangeDir(const char *dir);
static void SetDir(const char *dir);
static void SetDirMyDocuments(void);
- static size_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
+ static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
- static size_t Read(int fd, const char *buf, size_t len);
- static size_t Write(int fd, const char *buf, size_t len);
+ static size_t Read(int fd, const char *buf, ssize_t len);
+ static size_t Write(int fd, const char *buf, ssize_t 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/Fire.cpp b/src/core/Fire.cpp
index e73ffea1..c4c39b1f 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -46,7 +46,7 @@ CFire::ProcessFire(void)
float fDamagePlayer;
float fDamagePeds;
float fDamageVehicle;
- int8 nRandNumber;
+ int16 nRandNumber;
float fGreen;
float fRed;
CVector lightpos;
@@ -152,11 +152,10 @@ CFire::ProcessFire(void)
CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
}
- fGreen = nRandNumber / 128;
- fRed = nRandNumber / 128;
+ fGreen = nRandNumber / 128.f;
+ fRed = nRandNumber / 128.f;
- CPointLights::AddLight(0, m_vecPos, CVector(0.0f, 0.0f, 0.0f),
- 12.0f, fRed, fGreen, 0, 0, 0);
+ CPointLights::AddLight(CPointLights::LIGHT_POINT, m_vecPos, CVector(0.0f, 0.0f, 0.0f), 12.0f, fRed, fGreen, 0.0f, 0, 0);
} else {
Extinguish();
}
@@ -395,19 +394,16 @@ CFireManager::ExtinguishPoint(CVector point, float range)
bool
CFireManager::ExtinguishPointWithWater(CVector point, float range)
{
- int fireI = 0;
- for (int i = 0; i < NUM_FIRES; i++) {
- if (m_aFires[i].m_bIsOngoing) {
- if ((point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range)) {
- fireI = i;
- break;
- }
- }
- }
- if (fireI == NUM_FIRES)
- return false;
-
- CFire *fireToExtinguish = &m_aFires[fireI];
+ int i;
+ for (i = 0; i < NUM_FIRES;) {
+ if (m_aFires[i].m_bIsOngoing && (point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range)) {
+ break;
+ }
+ if (++i >= NUM_FIRES)
+ return false;
+ }
+
+ CFire *fireToExtinguish = &m_aFires[i];
fireToExtinguish->m_fWaterExtinguishCountdown -= 0.012f * CTimer::GetTimeStep();
CVector steamPos = fireToExtinguish->m_vecPos +
CVector((CGeneral::GetRandomNumber() - 128) * 3.1f / 200.f,
diff --git a/src/core/Streaming.h b/src/core/Streaming.h
index 510da7a0..a67384f6 100644
--- a/src/core/Streaming.h
+++ b/src/core/Streaming.h
@@ -197,11 +197,11 @@ public:
static void DeleteFarAwayRwObjects(const CVector &pos);
static void DeleteAllRwObjects(void);
static void DeleteRwObjectsAfterDeath(const CVector &pos);
- static void DeleteRwObjectsBehindCamera(size_t mem);
+ static void DeleteRwObjectsBehindCamera(size_t mem); // originally signed
static void DeleteRwObjectsInSectorList(CPtrList &list);
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
- static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem);
- static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem);
+ static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem); // originally signed
+ static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem); // originally signed
static void LoadScene(const CVector &pos);
static void LoadSceneCollision(const CVector &pos);
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 8abe0f1e..55b43c10 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -209,6 +209,9 @@ CTheZones::PostZoneCreation(void)
for(i = 1; i < TotalNumberOfNavigationZones; i++)
InsertZoneIntoZoneHierarchy(&NavigationZoneArray[i]);
InitialiseAudioZoneArray();
+#ifndef MASTER
+ CheckZonesForOverlap();
+#endif
}
void
@@ -222,8 +225,7 @@ CTheZones::CheckZonesForOverlap(void)
for(j = 1; j < TotalNumberOfInfoZones; j++)
if(i != j && ZoneIsEntirelyContainedWithinOtherZone(&InfoZoneArray[i], &InfoZoneArray[j]))
- sprintf(str, "Info zone %s contains %s\n",
- &InfoZoneArray[j].name, &InfoZoneArray[i].name);
+ sprintf(str, "Info zone %s contains %s\n", InfoZoneArray[j].name, InfoZoneArray[i].name);
}
}
diff --git a/src/core/common.h b/src/core/common.h
index 882e2fae..155b5dba 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -73,11 +73,16 @@ typedef int16_t int16;
typedef uint32_t uint32;
typedef int32_t int32;
typedef uintptr_t uintptr;
+typedef intptr_t intptr;
typedef uint64_t uint64;
typedef int64_t int64;
// hardcode ucs-2
typedef uint16_t wchar;
+#if defined(_MSC_VER)
+typedef ptrdiff_t ssize_t;
+#endif
+
#ifndef nil
#define nil NULL
#endif
diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp
index e16fcee6..746eb3a5 100644
--- a/src/peds/PedType.cpp
+++ b/src/peds/PedType.cpp
@@ -47,7 +47,7 @@ CPedType::LoadPedData(void)
char *buf;
char line[256];
char word[32];
- size_t bp, buflen;
+ ssize_t bp, buflen;
int lp, linelen;
int type;
uint32 flags;
@@ -56,9 +56,9 @@ CPedType::LoadPedData(void)
type = NUM_PEDTYPES;
buf = new char[16 * 1024];
- CFileMgr::SetDir("DATA");
- buflen = CFileMgr::LoadFile("PED.DAT", (uint8*)buf, 16 * 1024, "r");
- CFileMgr::SetDir("");
+ CFileMgr::SetDir("DATA");
+ buflen = CFileMgr::LoadFile("PED.DAT", (uint8*)buf, 16 * 1024, "r");
+ CFileMgr::SetDir("");
for(bp = 0; bp < buflen; ){
// read file line by line
@@ -248,7 +248,7 @@ CPedStats::LoadPedStats(void)
char *buf;
char line[256];
char name[32];
- size_t bp, buflen;
+ ssize_t bp, buflen;
int lp, linelen;
int type;
float fleeDist, headingChangeRate, attackStrength, defendWeakness;
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index aa4bdcc0..83c3c5bc 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -872,12 +872,12 @@ CVisibilityPlugins::FrameCopyConstructor(void *dst, const void *src, int32, int3
}
void
-CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, uintptr id)
+CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, intptr id)
{
FRAMEEXT(frame)->id = id;
}
-uintptr
+intptr
CVisibilityPlugins::GetFrameHierarchyId(RwFrame *frame)
{
return FRAMEEXT(frame)->id;
@@ -914,7 +914,7 @@ void
CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo)
{
CVehicleModelInfo *vmi;
- SetFrameHierarchyId(RpClumpGetFrame(clump), (uintptr)modelInfo);
+ SetFrameHierarchyId(RpClumpGetFrame(clump), (intptr)modelInfo);
// Unused
switch (modelInfo->GetModelType()) {
diff --git a/src/rw/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h
index 03833c9c..13365c7a 100644
--- a/src/rw/VisibilityPlugins.h
+++ b/src/rw/VisibilityPlugins.h
@@ -115,10 +115,10 @@ public:
struct FrameExt
{
// BUG: this is abused to hold a pointer by SetClumpModelInfo
- uintptr id;
+ intptr id;
};
- static void SetFrameHierarchyId(RwFrame *frame, uintptr id);
- static uintptr GetFrameHierarchyId(RwFrame *frame);
+ static void SetFrameHierarchyId(RwFrame *frame, intptr id);
+ static intptr GetFrameHierarchyId(RwFrame *frame);
static void *FrameConstructor(void *object, int32 offset, int32 len);
static void *FrameDestructor(void *object, int32 offset, int32 len);
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index e23369fb..5f7a07cc 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -318,7 +318,7 @@ CKeyArray::Load(size_t length, int file, size_t* offset)
entries = new CKeyEntry[numEntries];
rawbytes = (char*)entries;
-#if DUMB
+#if THIS_IS_STUPID
for (uint32 i = 0; i < length; i++) {
CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++;
@@ -412,7 +412,7 @@ CData::Load(size_t length, int file, size_t * offset)
chars = new wchar[numChars];
rawbytes = (char*)chars;
-#if DUMB
+#if THIS_IS_STUPID
for(uint32 i = 0; i < length; i++){
CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++;
@@ -434,7 +434,7 @@ CData::Unload(void)
void
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
{
-#if DUMB
+#if THIS_IS_STUPID
size_t num_of_entries = table_size / sizeof(CMissionTextOffsets::Entry);
for (size_t mi = 0; mi < num_of_entries; mi++) {
for (uint32 i = 0; i < sizeof(data[mi].szMissionName); i++) {
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index b911805d..4a61e42c 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -105,7 +105,6 @@ CWeaponInfo::GetWeaponInfo(eWeaponType weaponType)
return &ms_apWeaponInfos[weaponType];
}
-// --MIAMI: done except WEAPONTYPE_TOTALWEAPONS value
void
CWeaponInfo::Initialise(void)
{
@@ -142,7 +141,6 @@ CWeaponInfo::Initialise(void)
debug("CWeaponInfo ready\n");
}
-// --MIAMI: Done, commented parts wait for weapons port
void
CWeaponInfo::LoadWeaponData(void)
{