mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
signed/unsigned fixes, and some other fixes
This commit is contained in:
parent
c5010d443c
commit
36e64dbd22
@ -2986,12 +2986,12 @@ CCamera::LoadTrainCamNodes(char const *name)
|
|||||||
char token[16] = { 0 };
|
char token[16] = { 0 };
|
||||||
char filename[16] = { 0 };
|
char filename[16] = { 0 };
|
||||||
uint8 *buf;
|
uint8 *buf;
|
||||||
size_t bufpos = 0;
|
ssize_t bufpos = 0;
|
||||||
int field = 0;
|
int field = 0;
|
||||||
int tokpos = 0;
|
int tokpos = 0;
|
||||||
char c;
|
char c;
|
||||||
int i;
|
int i;
|
||||||
size_t len;
|
ssize_t len;
|
||||||
|
|
||||||
strcpy(filename, name);
|
strcpy(filename, name);
|
||||||
len = (int)strlen(filename);
|
len = (int)strlen(filename);
|
||||||
|
@ -120,7 +120,7 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(criminal == FindPlayerPed())
|
if(criminal == FindPlayerPed())
|
||||||
ReportCrimeForEvent(type, (uintptr)ent, copsDontCare);
|
ReportCrimeForEvent(type, (intptr)ent, copsDontCare);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -198,7 +198,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
|
CEventList::ReportCrimeForEvent(eEventType type, intptr crimeId, bool copsDontCare)
|
||||||
{
|
{
|
||||||
eCrimeType crime;
|
eCrimeType crime;
|
||||||
switch(type){
|
switch(type){
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
static bool GetEvent(eEventType type, int32 *event);
|
static bool GetEvent(eEventType type, int32 *event);
|
||||||
static void ClearEvent(int32 event);
|
static void ClearEvent(int32 event);
|
||||||
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
|
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
|
||||||
static void ReportCrimeForEvent(eEventType type, int32, bool);
|
static void ReportCrimeForEvent(eEventType type, intptr, bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CEvent gaEvent[NUMEVENTS];
|
extern CEvent gaEvent[NUMEVENTS];
|
@ -240,20 +240,22 @@ CFileMgr::SetDirMyDocuments(void)
|
|||||||
mychdir(_psGetUserFilesFolder());
|
mychdir(_psGetUserFilesFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
ssize_t
|
||||||
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
|
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
size_t n, len;
|
ssize_t n, len;
|
||||||
|
|
||||||
fd = myfopen(file, mode);
|
fd = myfopen(file, mode);
|
||||||
if(fd == 0)
|
if(fd == 0)
|
||||||
return 0;
|
return -1;
|
||||||
len = 0;
|
len = 0;
|
||||||
do{
|
do{
|
||||||
n = myfread(buf + len, 1, 0x4000, fd);
|
n = myfread(buf + len, 1, 0x4000, fd);
|
||||||
if(n < 0)
|
#ifndef FIX_BUGS
|
||||||
|
if (n < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
len += n;
|
len += n;
|
||||||
}while(n == 0x4000);
|
}while(n == 0x4000);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
@ -274,13 +276,13 @@ CFileMgr::OpenFileForWriting(const char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
CFileMgr::Read(int fd, const char *buf, int len)
|
CFileMgr::Read(int fd, const char *buf, ssize_t len)
|
||||||
{
|
{
|
||||||
return myfread((void*)buf, 1, len, fd);
|
return myfread((void*)buf, 1, len, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
CFileMgr::Write(int fd, const char *buf, int len)
|
CFileMgr::Write(int fd, const char *buf, ssize_t len)
|
||||||
{
|
{
|
||||||
return myfwrite((void*)buf, 1, len, fd);
|
return myfwrite((void*)buf, 1, len, fd);
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,12 @@ public:
|
|||||||
static void ChangeDir(const char *dir);
|
static void ChangeDir(const char *dir);
|
||||||
static void SetDir(const char *dir);
|
static void SetDir(const char *dir);
|
||||||
static void SetDirMyDocuments(void);
|
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, const char *mode);
|
||||||
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
|
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
|
||||||
static int OpenFileForWriting(const char *file);
|
static int OpenFileForWriting(const char *file);
|
||||||
static size_t Read(int fd, const char *buf, int len);
|
static size_t Read(int fd, const char *buf, ssize_t len);
|
||||||
static size_t Write(int fd, const char *buf, int len);
|
static size_t Write(int fd, const char *buf, ssize_t len);
|
||||||
static bool Seek(int fd, int offset, int whence);
|
static bool Seek(int fd, int offset, int whence);
|
||||||
static bool ReadLine(int fd, char *buf, int len);
|
static bool ReadLine(int fd, char *buf, int len);
|
||||||
static int CloseFile(int fd);
|
static int CloseFile(int fd);
|
||||||
|
@ -43,7 +43,7 @@ CFire::ProcessFire(void)
|
|||||||
float fDamagePlayer;
|
float fDamagePlayer;
|
||||||
float fDamagePeds;
|
float fDamagePeds;
|
||||||
float fDamageVehicle;
|
float fDamageVehicle;
|
||||||
int8 nRandNumber;
|
int16 nRandNumber;
|
||||||
float fGreen;
|
float fGreen;
|
||||||
float fRed;
|
float fRed;
|
||||||
CVector lightpos;
|
CVector lightpos;
|
||||||
@ -135,11 +135,10 @@ CFire::ProcessFire(void)
|
|||||||
CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
|
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);
|
nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
|
||||||
}
|
}
|
||||||
fGreen = nRandNumber / 128;
|
fGreen = nRandNumber / 128.f;
|
||||||
fRed = nRandNumber / 128;
|
fRed = nRandNumber / 128.f;
|
||||||
|
|
||||||
CPointLights::AddLight(0, m_vecPos, CVector(0.0f, 0.0f, 0.0f),
|
CPointLights::AddLight(CPointLights::LIGHT_POINT, m_vecPos, CVector(0.0f, 0.0f, 0.0f), 12.0f, fRed, fGreen, 0, 0, 0);
|
||||||
12.0f, fRed, fGreen, 0, 0, 0);
|
|
||||||
} else {
|
} else {
|
||||||
Extinguish();
|
Extinguish();
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
static bool RemoveLeastUsedModel(void);
|
static bool RemoveLeastUsedModel(void);
|
||||||
static void RemoveAllUnusedModels(void);
|
static void RemoveAllUnusedModels(void);
|
||||||
static void RemoveUnusedModelsInLoadedList(void);
|
static void RemoveUnusedModelsInLoadedList(void);
|
||||||
static bool RemoveReferencedTxds(size_t mem);
|
static bool RemoveReferencedTxds(size_t mem); // originally signed
|
||||||
static int32 GetAvailableVehicleSlot(void);
|
static int32 GetAvailableVehicleSlot(void);
|
||||||
static bool IsTxdUsedByRequestedModels(int32 txdId);
|
static bool IsTxdUsedByRequestedModels(int32 txdId);
|
||||||
static bool AddToLoadedVehiclesList(int32 modelId);
|
static bool AddToLoadedVehiclesList(int32 modelId);
|
||||||
@ -176,11 +176,11 @@ public:
|
|||||||
static void DeleteFarAwayRwObjects(const CVector &pos);
|
static void DeleteFarAwayRwObjects(const CVector &pos);
|
||||||
static void DeleteAllRwObjects(void);
|
static void DeleteAllRwObjects(void);
|
||||||
static void DeleteRwObjectsAfterDeath(const CVector &pos);
|
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 DeleteRwObjectsInSectorList(CPtrList &list);
|
||||||
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
|
static void DeleteRwObjectsInOverlapSectorList(CPtrList &list, int32 x, int32 y);
|
||||||
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem);
|
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, size_t mem); // originally signed
|
||||||
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem);
|
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem); // originally signed
|
||||||
|
|
||||||
static void LoadScene(const CVector &pos);
|
static void LoadScene(const CVector &pos);
|
||||||
|
|
||||||
|
@ -73,11 +73,16 @@ typedef int16_t int16;
|
|||||||
typedef uint32_t uint32;
|
typedef uint32_t uint32;
|
||||||
typedef int32_t int32;
|
typedef int32_t int32;
|
||||||
typedef uintptr_t uintptr;
|
typedef uintptr_t uintptr;
|
||||||
|
typedef intptr_t intptr;
|
||||||
typedef uint64_t uint64;
|
typedef uint64_t uint64;
|
||||||
typedef int64_t int64;
|
typedef int64_t int64;
|
||||||
// hardcode ucs-2
|
// hardcode ucs-2
|
||||||
typedef uint16_t wchar;
|
typedef uint16_t wchar;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
typedef ptrdiff_t ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef nil
|
#ifndef nil
|
||||||
#define nil NULL
|
#define nil NULL
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,7 +45,7 @@ CPedType::LoadPedData(void)
|
|||||||
char *buf;
|
char *buf;
|
||||||
char line[256];
|
char line[256];
|
||||||
char word[32];
|
char word[32];
|
||||||
size_t bp, buflen;
|
ssize_t bp, buflen;
|
||||||
int lp, linelen;
|
int lp, linelen;
|
||||||
int type;
|
int type;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
@ -246,13 +246,12 @@ CPedStats::LoadPedStats(void)
|
|||||||
char *buf;
|
char *buf;
|
||||||
char line[256];
|
char line[256];
|
||||||
char name[32];
|
char name[32];
|
||||||
size_t bp, buflen;
|
ssize_t bp, buflen;
|
||||||
int lp, linelen;
|
int lp, linelen;
|
||||||
int type;
|
int type;
|
||||||
float fleeDist, headingChangeRate, attackStrength, defendWeakness;
|
float fleeDist, headingChangeRate, attackStrength, defendWeakness;
|
||||||
int fear, temper, lawfullness, sexiness, flags;
|
int fear, temper, lawfullness, sexiness, flags;
|
||||||
|
|
||||||
|
|
||||||
type = 0;
|
type = 0;
|
||||||
buf = new char[16 * 1024];
|
buf = new char[16 * 1024];
|
||||||
|
|
||||||
|
@ -936,12 +936,12 @@ CVisibilityPlugins::FrameCopyConstructor(void *dst, const void *src, int32, int3
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, uintptr id)
|
CVisibilityPlugins::SetFrameHierarchyId(RwFrame *frame, intptr id)
|
||||||
{
|
{
|
||||||
FRAMEEXT(frame)->id = id;
|
FRAMEEXT(frame)->id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr
|
intptr
|
||||||
CVisibilityPlugins::GetFrameHierarchyId(RwFrame *frame)
|
CVisibilityPlugins::GetFrameHierarchyId(RwFrame *frame)
|
||||||
{
|
{
|
||||||
return FRAMEEXT(frame)->id;
|
return FRAMEEXT(frame)->id;
|
||||||
@ -978,7 +978,7 @@ void
|
|||||||
CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo)
|
CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo)
|
||||||
{
|
{
|
||||||
CVehicleModelInfo *vmi;
|
CVehicleModelInfo *vmi;
|
||||||
SetFrameHierarchyId(RpClumpGetFrame(clump), (uintptr)modelInfo);
|
SetFrameHierarchyId(RpClumpGetFrame(clump), (intptr)modelInfo);
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
switch (modelInfo->GetModelType()) {
|
switch (modelInfo->GetModelType()) {
|
||||||
|
@ -103,10 +103,10 @@ public:
|
|||||||
struct FrameExt
|
struct FrameExt
|
||||||
{
|
{
|
||||||
// BUG: this is abused to hold a pointer by SetClumpModelInfo
|
// BUG: this is abused to hold a pointer by SetClumpModelInfo
|
||||||
uintptr id;
|
intptr id;
|
||||||
};
|
};
|
||||||
static void SetFrameHierarchyId(RwFrame *frame, uintptr id);
|
static void SetFrameHierarchyId(RwFrame *frame, intptr id);
|
||||||
static uintptr GetFrameHierarchyId(RwFrame *frame);
|
static intptr GetFrameHierarchyId(RwFrame *frame);
|
||||||
|
|
||||||
static void *FrameConstructor(void *object, int32 offset, int32 len);
|
static void *FrameConstructor(void *object, int32 offset, int32 len);
|
||||||
static void *FrameDestructor(void *object, int32 offset, int32 len);
|
static void *FrameDestructor(void *object, int32 offset, int32 len);
|
||||||
|
@ -23,7 +23,7 @@ CText::Load(void)
|
|||||||
{
|
{
|
||||||
uint8 *filedata;
|
uint8 *filedata;
|
||||||
char filename[32], type[4];
|
char filename[32], type[4];
|
||||||
intptr_t offset, length;
|
ssize_t offset, length;
|
||||||
size_t sectlen;
|
size_t sectlen;
|
||||||
|
|
||||||
Unload();
|
Unload();
|
||||||
@ -176,7 +176,7 @@ CText::UpperCase(wchar *s)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CKeyArray::Load(size_t length, uint8 *data, intptr_t *offset)
|
CKeyArray::Load(size_t length, uint8 *data, ssize_t *offset)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
uint8 *rawbytes;
|
uint8 *rawbytes;
|
||||||
@ -256,7 +256,7 @@ CKeyArray::Search(const char *key)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CData::Load(size_t length, uint8 *data, intptr_t *offset)
|
CData::Load(size_t length, uint8 *data, ssize_t *offset)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
uint8 *rawbytes;
|
uint8 *rawbytes;
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
CKeyArray(void) : entries(nil), numEntries(0) {}
|
CKeyArray(void) : entries(nil), numEntries(0) {}
|
||||||
~CKeyArray(void) { Unload(); }
|
~CKeyArray(void) { Unload(); }
|
||||||
void Load(size_t length, uint8 *data, intptr_t *offset);
|
void Load(size_t length, uint8 *data, ssize_t *offset);
|
||||||
void Unload(void);
|
void Unload(void);
|
||||||
void Update(wchar *chars);
|
void Update(wchar *chars);
|
||||||
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
|
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
|
||||||
@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
CData(void) : chars(nil), numChars(0) {}
|
CData(void) : chars(nil), numChars(0) {}
|
||||||
~CData(void) { Unload(); }
|
~CData(void) { Unload(); }
|
||||||
void Load(size_t length, uint8 *data, intptr_t *offset);
|
void Load(size_t length, uint8 *data, ssize_t *offset);
|
||||||
void Unload(void);
|
void Unload(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user